Re: Flickering with Socket and Plug



Hey Eric,

It looks like you are trying to paint a surface 100 times every 16ms.
Maybe not such a good thing to do.

Yes, I agree but that's on purpose in order to make the problem *very* obvious ;) In one of my projects I draw round about 25 bitmaps (which partly overlap) onto the drawingarea. While some mouse interaction takes place I need to redraw several times. This results in flickering of all single bitmaps almost everytime I redraw. It looks as if the drawingarea gets cleared before I finish drawing my bitmaps.

> The plug and socket are separate programs. You would start your socket
> and add one or more plugs to it. Each plug is running as it's own
> process.

Yes, that's correct. But in the documentation of Gtk::Socket::add_id it says:
"Adds an XEMBED client, such as a Gtk::Plug, to the Gtk::Socket.
The client may be in the same process or in a different process."

So I am of the assumption that both is possible. Either Socket and Plug live in the same process or different processes. Is that correct?

Some details about my real world project (I hope it is not too confusing). I have a host application (executable) which builds its GUI with Gtk. Then I have a plug-in (shared object resp. .so file) which also builds its GUI with Gtk. But the plug-ins GUI must be shown by embedding it into the host application (like x11 is capable of). So I pass the socket_id of the host to the plug-in so it can connect by creating a plug. The plug-in lives inside the host application's process. But it is also possible that the host creates an extra process to let the plug-in run, but still, the GUI must be shown inside the host application. Both scenarios are possible.

> There is some socket and plug test code at the following.
...
> I just added a frame clock to the plug. If you are looking to animate a drawing in a plug that might be of some help.

Thanks! I will have closer look and try to figure out how this works.

> If you are programming in C++, the gtkmm tutorial is very good.

Yes, I know this one, built it and let it run successfully. No flickering. Afterwards I extended this example by having both socket and plug in the same process. I added some idle call to the plug and let it draw a bunch of bitmaps. It started flickering. Then I removed all the gtkmm stuff in order to have plain Gtk code. And this is the example I have put on my github ;)

Thanks for help. I will study your "plug2.c" example and see what I will come up with.

René


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