692eb7df74ccf720e2e975621e81c81005b6142d
[qemu] / qemu-gtk / gdk_set_window_pointer.c
1 /* TODO: figure out how to handle linux framebuffer case - need to call the gdk-fb specific handle_mouse_movement() function in gdkmouse-fb.c ... that gets ugly fast .. */
2
3 #ifndef _WIN32
4
5 #include <gdk/gdk.h>
6 #include <gdk/gdkx.h>
7 #include <X11/X.h>
8
9  GdkWindow*
10 gdk_window_set_pointer (GdkWindow       *window,
11                        gint            x,
12                        gint            y)
13 {
14   GdkWindow *return_val;
15
16   return_val = NULL;
17   XWarpPointer (GDK_WINDOW_XDISPLAY(window), None, GDK_WINDOW_XID(window), 0, 0, 0, 0, x, y);
18
19   return return_val;
20 }
21
22 #else
23
24 /* untested code based on MSDN library code... URL is :
25
26                   http://msdn.microsoft.com/library/default.asp?url=/library/
27                   en-us/winui/winui/windowsuserinterface/resources/cursors/
28                   usingcursors.asp         
29
30 Someone who codes on Windows want to tell me how to actually make this work??
31
32 */
33
34 #include <gdk/gdk.h>
35 #include <gdk/gdkwin32.h>
36 #include <windows.h>
37
38  GdkWindow*
39 gdk_window_set_pointer (GdkWindow       *window,
40                        gint            x,
41                        gint            y)
42 {
43         GdkWindow *return_val;
44         POINT pt;
45         pt.x = x;
46         pt.y = y;
47         ClientToScreen(GDK_WINDOW_HWND(window), &pt);
48         SetCursorPos(pt.x, pt.y);
49         return_val = NULL;
50         return return_val;
51 }
52
53 #endif
54