Re: GTK with libdispatch (GCD) on Linux and X11

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

 







Message: 1
Date: Mon, 2 May 2016 10:23:08 +0200
From: Hrvoje Niksic <hrvoje.niksic@xxxxxxx>
To: <gtk-list@xxxxxxxxx>
Subject: Re: GTK with libdispatch (GCD) on Linux and X11
Message-ID: <57270E6C.8000009@xxxxxxx>
Content-Type: text/plain; charset="UTF-8"; format=flowed

> On 04/30/2016 03:26 PM, Integratron wrote:
> > I have been investigating using GTK windows and widgets in a program
> > whose main loop is controlled by libdispatch.  The target is X11 on
> > Linux.  GTK is used only for the GUI.  (Other glib event sources are
> > not used in this application.  Networking is done using libdispatch.)
> >
> > I've read through the gtk source and the mainloop and believe that
> > updating the GUI may be as simple as registering the following block
> > callback for the main queue, where the file descriptor watched is the
> > X11 socket.

> How will this handle timeout events? Although your code only uses GTK, 
> the implementation of GTK itself can and does use g_timeout_add and friends.

> Also, you will almost certainly need to consider other sources. Again, 
> even if your code doesn't use them, it is pretty likely that some GTK 
> widgets make use of arbitrary GSources - the file chooser comes to mind.

> Another thing you need to think about are modal dialogs, which run their 
> own inner main loop. Your libdispatch main loop will be unresponsive 
> during a modal dialog run.

Thanks for these insights - these are exactly the types of "gotchas" I was wondering about.

> Could you simply run the GTK main loop in one thread, and the 
> libdispatch main loop in another? A libdispatch callback would then use 
> g_idle_add to invoke GTK code, and GTK callbacks could do similar for 
> libdispatch.

> Hrvoje

This is great feedback!  My application is very simple - it will only have buttons, checkboxes and a graphics area for showing monitoring information from a running application.  There will be no file chooser, or modal dialogs.  (It is easy to imagine these types of widgets creeping in.)

I wonder, however, if there might be a "Simple GTK Subset" that is safe to use in the manner I outlined.  What do you think?  Would it be a useful subset?

The dual thread solution you outlined sounds promising.  I'll investigate and if I learn anything, I'll report it here.

Fundamentally, GTK is based on an event-loop waiting on a poll, and libdispatch unravels the poll into individual callbacks for each event source.  It may turn out to be that these two aren't very compatible.

Thanks again Hrvoje.

------------------------------

Subject: Digest Footer

_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list


------------------------------

End of gtk-list Digest, Vol 145, Issue 2
****************************************
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list



[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux