Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Library : Other (not classified elsewhere) » DBus integration -- need help (Adding DBus to an existing U++ app on Linux -- need help on main event loop)
DBus integration -- need help [message #48544] Thu, 20 July 2017 17:30 Go to next message
jlfranks is currently offline  jlfranks
Messages: 57
Registered: May 2007
Location: Houston, TX, USA
Member
We are trying to add a DBus server to existing large U++ application that runs only on Linux.
I've converted from X11 to GTK for Upp project config to be compatible with GIO dbus library.

I've created a separate thread for the DBus server and ran into problems with event loop.
I've gutted my DBus server code of everything except what is causing an issue.
DBus GIO examples use GMainLoop in order for DBus to service asynchronous events.

Everything compiles and runs except the main UI is not longer visible. There must be a
GTK main loop already running and I've stepped on it with this code. Is there a way for
me to obtain a pointer to the UI main loop and use it with my DBus server?

How/where can I do that?

Code snipped example as follows:

---- code snippet ----

myDBusServerMainThread()
{
//========================================================== =====
//
// Enter main service loop for this thread
//
while (not needsExit ()) { // colaborate with join()

GMainLoop *loop;

loop = g_main_loop_new(NULL, FALSE);
g_main_loop_run(loop);
}
}
Re: DBus integration -- need help [message #48546 is a reply to message #48544] Fri, 21 July 2017 00:30 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 1075
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello,

You could try use following methods of Ctrl to obtain gtk & gdk handlers:
	GdkWindow *gdk() const { return top ? top->window->window : NULL; }
	GtkWindow *gtk() const { return top ? (GtkWindow *)top->window : NULL; }


Probably with these two variables you could try to integrate D-BUS. Sometimes ago I plan that innovation for U++, but it will require time to develop that we don't have it too much now. D-Bus could be usefull for develop such features as notification and global menu and probably more.

You could also see our GTK backend code easily. Just go to CtrlLib and analyze the files under "Gtk" separator. Probably there you will find the handling of event loop.

If you guys create something that could be used as library. It would be nice to keep it as open source.

Sincerely and good luck with implementation,
Klugier


U++ - one framework to rule them all.
Re: DBus integration -- need help [message #48552 is a reply to message #48546] Fri, 21 July 2017 13:30 Go to previous messageGo to next message
jlfranks is currently offline  jlfranks
Messages: 57
Registered: May 2007
Location: Houston, TX, USA
Member
Thank you for responding so quickly.

I will look into using those suggestions, but we have no time scheduled for this kind of integration.

If I can get something to work, I'll let you know.

-- Jeff
Re: DBus integration -- need help [message #48554 is a reply to message #48546] Fri, 21 July 2017 15:01 Go to previous messageGo to next message
jlfranks is currently offline  jlfranks
Messages: 57
Registered: May 2007
Location: Houston, TX, USA
Member
Klugier,

I've examined the code you suggested and in fact found many elements related to GtK.

What I have not been able to find if the GtK main event loop.
Is there another U++ event loop that is used as the Gtk main event loop?

I've just not been able to identify that component in order to integrate GDbus
into the main loop.

-- Jeff
Re: DBus integration -- need help [message #48696 is a reply to message #48554] Fri, 25 August 2017 09:05 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
U++ is not directly using GTK main loop. Further problem is that in U++, only main thread is allowed to run event loop - this is limitation inherited from Win32 (more or less).

You can call Ctrl::ProcessEvents at any time to fetch and process any GUI related pending events (but just from the main thread).

I suggest to post existing code, I can look into it about alternatives...
Previous Topic: GLCtrl problem
Next Topic: [Bug (minor)]: CenterScreen not working
Goto Forum:
  


Current Time: Thu Mar 28 12:32:41 CET 2024

Total time taken to generate the page: 0.01496 seconds