Re: GTK internals



thanks but i didn't find gtk_parse_args calling gdk_parse_args:
gboolean
     gtk_parse_args (int    *argc,
             char ***argv)
     {
       GOptionContext *option_context;
       GOptionGroup *gtk_group;
       GError *error = NULL;
 
       if (gtk_initialized)
         return TRUE;
 
       gettext_initialization ();
 
       if (!check_setugid ())
         return FALSE;
 
       option_context = g_option_context_new (NULL);
       g_option_context_set_ignore_unknown_options (option_context, TRUE);
       g_option_context_set_help_enabled (option_context, FALSE);
       gtk_group = gtk_get_option_group (FALSE);
       g_option_context_set_main_group (option_context, gtk_group);
       if (!g_option_context_parse (option_context, argc, argv, &error))
         {
           g_warning ("%s", error->message);
           g_error_free (error);
        }
 
       g_option_context_free (option_context);
 
       return TRUE;
     }

one more doubt :
in function  do_pre_parse_initialization (int    *argc,  char ***argv),
gtk_main_do_event is being registered using following function 

gdk_event_handler_set ((GdkEventFunc)gtk_main_do_event, NULL, NULL);
gdk_event_handler_set registers this with itself in a variable 
_gdk_event_func

void
gdk_event_handler_set (GdkEventFunc   func,
                gpointer       data,
               GDestroyNotify notify)
{
   if (_gdk_event_notify)
     (*_gdk_event_notify) (_gdk_event_data);
 
   _gdk_event_func = func;
  _gdk_event_data = data;
  _gdk_event_notify = notify;
}
and definition of gtk_main_do_event starts with : void  gtk_main_do_event
(GdkEvent *event)
{...}

but when you look at file gdkevent-x11.c, gtk_main_do_event is being called
with 2 arguments:
...
 if (event)
    {
      if (_gdk_event_func)
                (*_gdk_event_func) (event, _gdk_event_data);

      gdk_event_free (event);
   }
...

how is this possible?



muppet wrote:
> 
> 
> varun_shrivastava wrote:
>>
>> but how gtk takes care of calling gdk_init is a mystery to me, as we
>> never
>> call gdk_init from our gtk program. [we only call gtk_init() ]
>>
>> Can any one provide a view to that?
> 
> grep just a little further, and your answers are right there.
> 
> gdk_init() calls gdk_init_check();
> gdk_init_check() calls gdk_parse_args();
> gdk_parse_args() is where gdk initialization actually happens
> 
> gtk_init() calls gtk_init_check();
> gtk_init_check() calls gtk_parse_args()
> 
> gtk_parse_args() calls gdk_parse_args()
> 
> 
> 
> 
> 
> -- 
> muppet <scott at asofyet dot org>
> 
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list
> 
> 

-- 
View this message in context: http://www.nabble.com/GTK-internals-tf4012561.html#a11738017
Sent from the Gtk+ - Dev - General mailing list archive at Nabble.com.




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