diff --git a/gtkdoc-mkdb.in b/gtkdoc-mkdb.in
index 7592293..0cda5b1 100755
--- a/gtkdoc-mkdb.in
+++ b/gtkdoc-mkdb.in
@@ -258,9 +258,11 @@ my %AllDocumentedSymbols;
 # Undeclared yet documented symbols
 my %UndeclaredSymbols;
 
-# These global arrays store GObject, subclasses and the hierarchy.
+# These global arrays store GObject, subclasses and the hierarchy (also of
+# non-object derived types).
 my @Objects;
 my @ObjectLevels;
+my %ObjectRoots;
 
 my %Interfaces;
 my %Prerequisites;
@@ -1447,6 +1449,27 @@ sub OutputStruct {
         $default_to_public = 0;
     }
 
+    my $params = $SymbolParams{$symbol};
+
+    # If no parameters are filled in, we don't generate the description
+    # table, for backwards compatibility.  But if at least some are filled
+    # in we default to public.
+
+    my $found_params = 0;
+    if (defined $params) {
+        for (my $i = 1; $i <= $#$params; $i += $PARAM_FIELD_COUNT) {
+            if ($params->[$i] =~ /\S/) {
+                $found_params = 1;
+                last;
+            }
+        }
+    }
+
+    if ($found_params and (!defined($ObjectRoots{$symbol})
+                           or $ObjectRoots{$symbol} eq 'GBoxed')) {
+        $default_to_public = 1;
+    }
+
     my $id;
     my $condition;
     if ($is_gtype) {
@@ -1555,22 +1578,7 @@ sub OutputStruct {
                                         sub {
                                             "<structfield id=\"".&CreateValidSGMLID("$id.$_[0]")."\">$_[0]</structfield>";
                                         });
-    my $params = $SymbolParams{$symbol};
-
-    # If no parameters are filled in, we don't generate the description
-    # table, for backwards compatibility
-
-    my $found = 0;
-    if (defined $params) {
-        for (my $i = 1; $i <= $#$params; $i += $PARAM_FIELD_COUNT) {
-            if ($params->[$i] =~ /\S/) {
-                $found = 1;
-                last;
-            }
-        }
-    }
-
-    if ($found) {
+    if ($found_params) {
         my %field_descrs = @$params;
         my $missing_parameters = "";
         my $unused_parameters = "";
@@ -5149,12 +5157,17 @@ sub ReadObjectHierarchy {
     # child turns up.
     my @pending_objects = ();
     my @pending_levels = ();
+    my $root;
     while (<INPUT>) {
         if (m/\S+/) {
             my $object = $&;
             my $level = (length($`)) / 2 + 1;
             my $xref = "";
 
+            if ($level == 1) {
+                $root = $object;
+            }
+
             while (($#pending_levels >= 0) && ($pending_levels[$#pending_levels] >= $level)) {
                 my $pobject = pop(@pending_objects);
                 my $plevel = pop(@pending_levels);
@@ -5172,6 +5185,7 @@ sub ReadObjectHierarchy {
                      print (OUTPUT ' ' x ($level * 4), "$xref\n");
                     push (@Objects, $object);
                     push (@ObjectLevels, $level);
+                    $ObjectRoots{$object} = $root;
                 }
             }
             #else {
@@ -5370,14 +5384,9 @@ sub ReadArgsFile {
 
 sub CheckIsObject {
     my ($name) = @_;
-
-    my $object;
-    foreach $object (@Objects) {
-        if ($object eq $name) {
-            return 1;
-        }
-    }
-    return 0;
+    my $root = $ObjectRoots{$name};
+    # Let GBoxed pass as an object here.
+    return defined($root) and $root ne 'GEnum' and $root ne 'GFlags';
 }
 
 
