gtk - How do I send a client-event asynchronously to a GtkWidget? -


I am trying to send and receive client-events using GtkWidget on Win32 platform. The sender code looks like this:

  GtkWidget * Wnd; GdkNativeWindow Hnd = #ifdef WIN32GDK_WINDOW_HWND (wnd- & gt; Window); # Ilse GDK_WINDOW_XWINDOW (Wnd-> Window); #endif GdkEvent * Event = gdk_event_new (GDK_CLIENT_EVENT); // fill the event parameter gdk_event_send_client_message (Event, HD);  

Obtaining the code looks like this:

  Fixed Gabolian MyClientEvent (GtkWidget * widget, GdkEventClient * ev, MyWnd * Wnd) {// breakpoint here .. return TRUE; } GtkWidget * Wnd = gtk_window_new (GTK_WINDOW_TOPLEVEL); G_signal_connect (G_OBJECT (Wnd), "Client-Event", GCl Blind (MyClientEvent), this); Gtk_widget_add_events (Wnd, GDK_ALL_EVENTS_MASK);  

I am sending a message using Detective ++, so I know that the sender party is fine. The receiving party however does not get client-event. I was hoping to trigger my breakpoint in the callback ... but it's not.

I also do not believe that any GTK window can get a client-event ... from the previous experience on X11, I thought it was too much that in this regard, similar to any other GtkWidget . Maybe this is slightly different on Win32 platform. But still I want to be able to do this work.

I have to work in this asynchronous and thread-safe fashion, so that I can send events from the worker thread to the GUI thread.

I have a solution that seems to work. It can not be optimal, but this ball is in the park.

struct GlibEventParams {GtkWidget * w; GdkEvent * e; }; Static Gabolian GlobalPost Message (GleibEventPurm * P) {GDK_THREADS_ENTER (); Gtk_propagate_event (p-> gt; w, p- & gt; e); Gdk_event_free (p-> E); Remove p; GDK_THREADS_LEAVE (); return false; } Bool MySendEvent (GtkWidget * Wnd, GtkEvent * Event) {bool Status = false; If (Event & amp; Wnd) {GlibEventParams * p = new GlibEventParams; P-> W = wnd; P-> E = gdk_event_new (GDK_CLIENT_EVENT); * P-> E = * event; Position = g_idle_add (GSourceFunc) GlobalPost Message, p) & gt; 0; } And insist ("There is no event or WDD"); Return status; }

If someone else has creative comments, then I will add / modify it as necessary.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -