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++ Widgets - General questions or Mixed problems » GtkWidget inside U++
GtkWidget inside U++ [message #26850] Wed, 02 June 2010 09:35 Go to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Hi everyone,

I would like to ask if, by chance, someone ever tried incorporating GtkWidget into U++? Preferably on Linux, but I'll take even win32 solutions Wink

I guess it could be done using DHCtrl, but I probably lack the necessary knowledge of GTK internals. It would help me a lot if someone ever tried this and could give me some hints (even about the unsuccessful attempts).

I'm not really keen to dive into GTK sources... there is more casting than in average RPG game Laughing It really makes me glad I found the neat and polished U++.

Best regards,
Honza
Re: GtkWidget inside U++ [message #26859 is a reply to message #26850] Thu, 03 June 2010 19:23 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
dolik.rce wrote on Wed, 02 June 2010 03:35

Hi everyone,

I would like to ask if, by chance, someone ever tried incorporating GtkWidget into U++? Preferably on Linux, but I'll take even win32 solutions Wink

I guess it could be done using DHCtrl, but I probably lack the necessary knowledge of GTK internals. It would help me a lot if someone ever tried this and could give me some hints (even about the unsuccessful attempts).

I'm not really keen to dive into GTK sources... there is more casting than in average RPG game Laughing It really makes me glad I found the neat and polished U++.

Best regards,
Honza


Well, chameleon creates and (mis)uses Gtk widgets, but I am not sure it counts... Smile

But perhaps it would be possible to extend and create event inputs and outputs for gtk widgets. Not sure it is worth the effort...

BTW, one thing I would like to have is possibility to use gtk file selector. Unfortunately, things are not pretty, as in X11, we would have to use Gtk event loop, which means no events would ever get propagated back to U++, which means that out windows would be inactive (including paint events) while Gtk dialog is displayed...
Re: GtkWidget inside U++ [message #26862 is a reply to message #26859] Thu, 03 June 2010 20:46 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

luzr wrote on Thu, 03 June 2010 19:23

Well, chameleon creates and (mis)uses Gtk widgets, but I am not sure it counts... Smile

But perhaps it would be possible to extend and create event inputs and outputs for gtk widgets. Not sure it is worth the effort...

BTW, one thing I would like to have is possibility to use gtk file selector. Unfortunately, things are not pretty, as in X11, we would have to use Gtk event loop, which means no events would ever get propagated back to U++, which means that out windows would be inactive (including paint events) while Gtk dialog is displayed...


Hi Mirek,

Creating the widget (as chameleon does) is simple, but using it is completely different story Smile

In between I came to the same conclusion (and Andrei told me he hit the problem some time ago too). To get gtk widgets working, the gtk event loop must run, which ruins the rest of the app. I wonder if it would be possible to emulate the events for gtk using U++ event loop... But I'm probably not even trying to write that Smile

The reason why I ask this was web_view, the widget allowing really simple use of Webkit. Libwebkit is available on most Linux distros, win and mac as well. Well, looks like someone will have to write an U++ port of Webkit Smile

Thanks for your response,
Honza

Re: GtkWidget inside U++ [message #26866 is a reply to message #26862] Fri, 04 June 2010 08:32 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3354
Registered: August 2008
Senior Veteran
dolik.rce wrote on Thu, 03 June 2010 20:46

luzr wrote on Thu, 03 June 2010 19:23

Well, chameleon creates and (mis)uses Gtk widgets, but I am not sure it counts... Smile

But perhaps it would be possible to extend and create event inputs and outputs for gtk widgets. Not sure it is worth the effort...

BTW, one thing I would like to have is possibility to use gtk file selector. Unfortunately, things are not pretty, as in X11, we would have to use Gtk event loop, which means no events would ever get propagated back to U++, which means that out windows would be inactive (including paint events) while Gtk dialog is displayed...


Hi Mirek,

Creating the widget (as chameleon does) is simple, but using it is completely different story Smile

In between I came to the same conclusion (and Andrei told me he hit the problem some time ago too). To get gtk widgets working, the gtk event loop must run, which ruins the rest of the app. I wonder if it would be possible to emulate the events for gtk using U++ event loop... But I'm probably not even trying to write that Smile

The reason why I ask this was web_view, the widget allowing really simple use of Webkit. Libwebkit is available on most Linux distros, win and mac as well. Well, looks like someone will have to write an U++ port of Webkit Smile

Thanks for your response,
Honza



Hello Honza

Do you mean "the lost link" between Libwebkit (a portable web browser based on Safari) and U++ is the Gtk+ event loop that Libwebkit requires?.

In the last case would it be possible to launch webkit in a separate thread with its own Gtk+ event loop with a bridge to U++ code handling commands, windows resizing and events between main program and browser?

For example, in video player I am working Smile there are now at least these threads:

- SDL event loop
- Video handling
- Audio handling

Video is showed in a separate window so bridge code handles resizing and send commands from U++ to SDL event loop.

If everything goes right it will be possible to:

- plug SDL events to U++ events, so a mouse left click in video window could be sent to U++ to show a menu
- use U++ window instead of SDL window


Best regards
IƱaki

[Updated on: Fri, 04 June 2010 09:01]

Report message to a moderator

Re: GtkWidget inside U++ [message #26868 is a reply to message #26866] Fri, 04 June 2010 11:22 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

koldo wrote on Fri, 04 June 2010 08:32

Hello Honza

Do you mean "the lost link" between Libwebkit (a portable web browser based on Safari) and U++ is the Gtk+ event loop that Libwebkit requires?.

In the last case would it be possible to launch webkit in a separate thread with its own Gtk+ event loop with a bridge to U++ code handling commands, windows resizing and events between main program and browser?

For example, in video player I am working Smile there are now at least these threads:

- SDL event loop
- Video handling
- Audio handling

Video is showed in a separate window so bridge code handles resizing and send commands from U++ to SDL event loop.

If everything goes right it will be possible to:

- plug SDL events to U++ events, so a mouse left click in video window could be sent to U++ to show a menu
- use U++ window instead of SDL window


Hi Koldo,

Simply put yes, libwebkit could be run if U++ and gtk event loops could be connected somehow. I tried to run the webview in separate thread, but without that connecting layer it didn't make much sense. Plus it was crashing, but that was probably just my mistake Smile

It would be interesting experiment to create such connecting layers between U++ and various frameworks. It would allow to extend possibilities of U++ a lot. But on the other hand, it is pretty unclean solution. Actually more hack than solution Wink It would probably bring a lot of overhead too.

I would personally prefer clean, full port of webkit to U++ (here webkit means the interface over WebCore and JavaScriptCore, not the entire engine Wink ). In the end it might be about the same level of complexity as creating the connection layer...

Honza
Re: GtkWidget inside U++ [message #26869 is a reply to message #26868] Fri, 04 June 2010 13:38 Go to previous messageGo to next message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

dolik.rce wrote on Fri, 04 June 2010 12:22

koldo wrote on Fri, 04 June 2010 08:32

Hello Honza

Do you mean "the lost link" between Libwebkit (a portable web browser based on Safari) and U++ is the Gtk+ event loop that Libwebkit requires?.

In the last case would it be possible to launch webkit in a separate thread with its own Gtk+ event loop with a bridge to U++ code handling commands, windows resizing and events between main program and browser?

For example, in video player I am working Smile there are now at least these threads:

- SDL event loop
- Video handling
- Audio handling

Video is showed in a separate window so bridge code handles resizing and send commands from U++ to SDL event loop.

If everything goes right it will be possible to:

- plug SDL events to U++ events, so a mouse left click in video window could be sent to U++ to show a menu
- use U++ window instead of SDL window


Hi Koldo,

Simply put yes, libwebkit could be run if U++ and gtk event loops could be connected somehow. I tried to run the webview in separate thread, but without that connecting layer it didn't make much sense. Plus it was crashing, but that was probably just my mistake Smile

It would be interesting experiment to create such connecting layers between U++ and various frameworks. It would allow to extend possibilities of U++ a lot. But on the other hand, it is pretty unclean solution. Actually more hack than solution Wink It would probably bring a lot of overhead too.

I would personally prefer clean, full port of webkit to U++ (here webkit means the interface over WebCore and JavaScriptCore, not the entire engine Wink ). In the end it might be about the same level of complexity as creating the connection layer...

Honza

If you intend to implement web core why do not try to implement chrome source?
Re: GtkWidget inside U++ [message #26870 is a reply to message #26868] Fri, 04 June 2010 13:40 Go to previous messageGo to next message
andrei_natanael is currently offline  andrei_natanael
Messages: 262
Registered: January 2009
Experienced Member
Hi,
It is possible to mix U++ loop with gtk+ loop and have gtk+ widgets in U++ window. I didn't tried but once you init gtk (gtk_init(...)) you may create a widget, get and Window (XWindow) from U++ Window and wrap it to a GdkWindow and set it as widget parent and in U++ Ctrl::EventLoop0 in loop put a call to gtk_main_iteration_do(false) to process events from gtk+. I've didn't tried that so you're at risk of obtaining nothing, still it isn't that hard to try and don't have to write much code Wink.

Andrei
Re: GtkWidget inside U++ [message #26873 is a reply to message #26869] Fri, 04 June 2010 16:28 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

tojocky wrote on Fri, 04 June 2010 13:38

If you intend to implement web core why do not try to implement chrome source?

Hi Ion,
Chromium uses the same WebCore as WebKitGTK+ (which is what libwebkit should be properlys called). There is also more ports e.g. Qt, clutter, wx (under construction). The reason why I started with GTK version was that it seems to be available on many systems and that U++ already uses gtk (for chameleon). Also there is many simple examples for gtk version, but I couldn't found one that would show how to work with the chromium port.

Only difference I know about is that chromium port is tweaked towards usage in separate processes.

Technically it should be about the same amount of work to get chromium, Qt or gtk to work in U++...

Honza
Re: GtkWidget inside U++ [message #26874 is a reply to message #26870] Fri, 04 June 2010 16:30 Go to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

andrei_natanael wrote on Fri, 04 June 2010 13:40

Hi,
It is possible to mix U++ loop with gtk+ loop and have gtk+ widgets in U++ window. I didn't tried but once you init gtk (gtk_init(...)) you may create a widget, get and Window (XWindow) from U++ Window and wrap it to a GdkWindow and set it as widget parent and in U++ Ctrl::EventLoop0 in loop put a call to gtk_main_iteration_do(false) to process events from gtk+. I've didn't tried that so you're at risk of obtaining nothing, still it isn't that hard to try and don't have to write much code Wink.

Andrei

Hi Andrei,
That sounds interesting. I'll give it a try and report later Wink

Thank you,
Honza
Previous Topic: Is there an example/links how to use X11 DHCtrl?
Next Topic: howto best Ctrl Refresh handling w/ MT & very frequent refreshes
Goto Forum:
  


Current Time: Thu Mar 28 10:07:42 CET 2024

Total time taken to generate the page: 0.01117 seconds