Re: Problem with XID]



Andre Lerche wrote:

Hi List!

Currently I play a little bit with events/signals and wrote the following
program to send events to itself (this doesn't make much sense, it's only
for learning). If I try get the xid of my window with
gtk_widget_get_root_window and GDK_DRAWABLE_XID (drawable), the event is thrown,
but never receives. It works only if I search for the xid for example with
xwininfo and add it manual. What's causing this and how can I get the right
xid within gdk/gtk? I am using gtk 2.2.1-4 on Redhat 9.
1. You can obtain any widget's GdkWindow by pointer widget->window.
2. If I'm not mistaken gtk_widget_get_root_window returns the default root window of screen, not the root window of your application. 3. You can get XID of your app's main window, but keep in mind that the gdk window will be created after widget will get realized. You probably will need to connect to "realize" event.

<...>

int ButtonPressEvent (GtkWidget *widget, GdkEventCrossing *event, gpointer data) {
   GtkWidget *win;
   gboolean send;
   GdkEventClient ev;

/* It would be nice to clear local allocated ev structure: */
               memset(&ev, 0, sizeof(ev));

   details *p = data;

<...>

   Olexiy





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