Re: Status von device abfragen [fehler]



On Wed, 2003-11-26 at 20:51, Robert Schulze wrote:
GdkWindow     *gdwin;
GdkDevice     *device;
GdkModifierType       state;

device = gdk_device_get_core_pointer();
gdk_device_get_state(device, gdwin, NULL, &state);

   === error-msg ===
 (gmouse:1239): Gdk-CRITICAL **: file gdkinput-none.c: line 47 (gdk_device_get_state): assertion 
`GDK_IS_WINDOW (window)' failed
  
  ==================
 
 What's my mistake?

well, it is likely that gdwin is not a valid variable when
gdk_device_get_state is called. Maybe you should try to make sure you
initialize it correctly (your listing lacks the variable
initialization). 

If you initialize it correctly, your problem is probably due to the fact
that the GdkWindow you use comes from the window field of a widget. If
this is the case, you should know that the window field of a widget is
valid if and only if the widget is realized. That is, either run the
above code from a handler connected to the realized signal or run this
code after invoking gtk_widget_realize (the latter looks really evil and
ugly to me but should work).

regards,
Mathieu 
-- 
Mathieu Lacage <mathieu gnu org>




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