Re: GdkLibrary



Hi,

Owen Taylor <otaylor redhat com> writes:

> > while you are changing this part of GDK anyway, would it hurt to to
> > allow GDK backends to modify the argv array just like gtk_init() and
> > gdk_init()? This would remove the need for some patching we had to do
> > to integrate DirectFBInit (int *argc, char **argv[]).
> > 
> > I haven't found the time to look at the HEAD branch, but if you think
> > this makes sense, I could try to come up with a patch soon.
> 
> Did you miss the _gdk_windowing_args[] functionality? The only
> reason that wouldn't work is if the directfb support is taking
> arguments that don't match that format of the rest of the
> GTK+ args. (which seems like a bad idea to me.)

I didn't miss it but I didn't want to add all DirectFB command-line
options by hand since there are a _lot_ of them. In case you're
interested, I'm posting the patch we use at the moment.  It adds the
new type GDK_ARG_WINDOWING_OPTION which is detected by matching the
start of the argument string against a backend supplied prefix. This
works well for DirectFB since all our command-line arguments are
prefixed with 'dfb:' but I don't consider this hack overly nice and
would prefer if _gdk_windowing_init_check() would be able to
manipulate its arguments just like gtk_init() and gdk_init().


Salut, Sven


diff -u -p -r1.15 gdkinternals.h
--- gdk/gdkinternals.h  13 Feb 2002 21:59:47 -0000      1.15
+++ gdk/gdkinternals.h  16 Jun 2002 11:58:04 -0000
@@ -117,7 +117,8 @@ typedef enum 
   GDK_ARG_INT,
   GDK_ARG_BOOL,
   GDK_ARG_NOBOOL,
-  GDK_ARG_CALLBACK
+  GDK_ARG_CALLBACK,
+  GDK_ARG_WINDOWING_OPTION
 } GdkArgType;
 
 typedef struct _GdkArgContext GdkArgContext;

diff -u -p -r1.139 gdk.c
--- gdk/gdk.c   13 Feb 2002 21:59:47 -0000      1.139
+++ gdk/gdk.c   16 Jun 2002 11:58:04 -0000
@@ -178,6 +178,12 @@ gdk_arg_context_parse (GdkArgContext *co
                          *(gboolean *)table[k].location = (table[k].type == GDK_ARG_BOOL) ? TRUE : FALSE;
                          goto next_arg;
                        }
+                      break;
+                    case GDK_ARG_WINDOWING_OPTION:
+                        if (strncmp (arg, table[k].name, 
+                                     strlen (table[k].name)) == 0)
+                          (*argv)[i] = NULL;
+                        break;
                    }
                }
            }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]