RE: Creating a popup from an event of another Thread



I managed to solve by myself this problem. Here is the method I used :

The worker Thread has a Glib::Dispatcher member connected to a method that fire a signal. This signal is connected to a method of a GTK::Window method that create the popup. Owing to Glib::Dispatcher, the signal is processed inside the GTK main
loop.


Yunus ARSLAN.


Date: Thu, 28 Sep 2006 08:57:22 +0000
From: "Yunus Arslan" <brainiac_s hotmail com>
Subject: Creating a popup from an event of another Thread
To: gtkmm-list gnome org
Message-ID: <BAY121-F371855E6A46E3FD6B6B3FAFE1B0 phx gbl>
Content-Type: text/plain; charset=iso-8859-1; format=flowed

Hi,

I will design a GTKmm application with two threads. One for UI (high
priority)
and another (lower priority) waiting for network events. This way the UI
response
time will be fast.

Everything work fine except one particular case. Let's imagine the network
thread fire an event, and UI should respond by creating a popup.

I have tried several methods to communicate and interact between threads
but none solved my problem.

Method 1 :
- I have added a gtk idle function to UI thread, that pop events received
from
the network thread. If I create a popup from the gtk idle, it is displayed
but the
screen freeze. I think it's because the popup has been created outside the
GTK
event loop. Am I right ?

Method 2 :
- The network thread has a sigc::signal that I have connected to a
Gtk::Window.
When I fire the signal, I get this error message :

Xlib: unexpected async reply (sequence 0xf6)!
(main:22651): Gdk-CRITICAL **: gdk_window_set_geometry_hints: assertion
`window != NULL' failed
(main:22651): Gdk-CRITICAL **: gdk_window_move_resize: assertion `window !=
NULL' failed

Any idea to solve, or explain this problem ?

Thanks in advance,
Regards.

Yunus ARSLAN.





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