[Gtk-sharp-list] mouse coordinates

Sven bender@impala.mine.nu
Thu, 20 May 2004 11:52:13 +0200


I'm trying to find an easy way to retrieve the x and y coordinates for
the mouse pointer (from anywhere on the screen). I've tried this:

Screen scrn = Gdk.Screen.Default;
Display disp = scrn.Display;
disp.GetPointer (scrn, out x, out y, out mod);

It seems to work fine, but i get this message everytime i run it:

(TestingTesting:6309): Gdk-CRITICAL **: file gdkscreen-x11.c: line 122
(gdk_screen_get_display): assertion `GDK_IS_SCREEN (screen)' failed

It seems to me that I'm propably missing something important? If not,
are there some other more smarter ways to achive what I'm trying to do?