Receiving client-event on a GtkWindow

Posted by fret on Stack Overflow See other posts from Stack Overflow or by fret
Published on 2010-06-15T00:34:35Z Indexed on 2010/06/15 0:42 UTC
Read the original article Hit count: 352

Filed under:

I'm trying to send and receive a client-event using a GtkWindow on the win32 platform. The sending code looks like this:

GtkWidget *Wnd;
GdkNativeWindow Hnd =
#ifdef WIN32
    GDK_WINDOW_HWND(Wnd->window);
#else
    GDK_WINDOW_XWINDOW(Wnd->window);
#endif
GdkEvent *Event = gdk_event_new(GDK_CLIENT_EVENT);
// fill out Event params
gdk_event_send_client_message(Event, Hnd);

Receiving code looks like this:

static gboolean 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",
                    G_CALLBACK(MyClientEvent),
                    this);
gtk_widget_add_events(Wnd, GDK_ALL_EVENTS_MASK);

I used Spy++ to see the message getting sent, so I know the sending side is ok. The receiving side however doesn't get the client-event. I was expecting my breakpoint in the callback to trigger... but it doesn't.

I'm not even sure if a GtkWindow can receive a client-event... from past experience on X11 I thought it was pretty much the same as any other GtkWidget in that respect. Maybe on the win32 platform it's kinda different. But still I'd like to be able to get this working.

© Stack Overflow or respective owner

Related posts about gtk