static void gdk_device_wintab_get_state (GdkDevice *device, GdkSurface *window, gdouble *axes, GdkModifierType *mask) { GdkDeviceWintab *device_wintab; device_wintab = GDK_DEVICE_WINTAB (device); /* For now just use the last known button and axis state of the device. * Since graphical tablets send an insane amount of motion events each * second, the info should be fairly up to date */ if (mask) { *mask = get_current_mask (); *mask &= 0xFF; /* Mask away core pointer buttons */ *mask |= ((device_wintab->button_state << 8) & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK | GDK_BUTTON4_MASK | GDK_BUTTON5_MASK)); } if (axes && device_wintab->last_axis_data) _gdk_device_wintab_translate_axes (device_wintab, window, axes, NULL, NULL); }
static void gdk_device_win32_query_state (GdkDevice *device, GdkWindow *window, GdkWindow **root_window, GdkWindow **child_window, gdouble *root_x, gdouble *root_y, gdouble *win_x, gdouble *win_y, GdkModifierType *mask) { POINT point; HWND hwnd, hwndc; hwnd = GDK_WINDOW_HWND (window); GetCursorPos (&point); if (root_x) *root_x = point.x; if (root_y) *root_y = point.y; ScreenToClient (hwnd, &point); if (win_x) *win_x = point.x; if (win_y) *win_y = point.y; if (window == _gdk_root) { if (win_x) *win_x += _gdk_offset_x; if (win_y) *win_y += _gdk_offset_y; if (root_x) *root_x += _gdk_offset_x; if (root_y) *root_y += _gdk_offset_y; } if (child_window) { hwndc = ChildWindowFromPoint (hwnd, point); if (hwndc && hwndc != hwnd) *child_window = gdk_win32_handle_table_lookup (hwndc); else *child_window = NULL; /* Direct child unknown to gdk */ } if (root_window) { GdkScreen *screen; screen = gdk_window_get_screen (window); *root_window = gdk_screen_get_root_window (screen); } if (mask) *mask = get_current_mask (); }
static void gdk_device_wintab_query_state (GdkDevice *device, GdkSurface *window, GdkSurface **child_window, gdouble *root_x, gdouble *root_y, gdouble *win_x, gdouble *win_y, GdkModifierType *mask) { GdkDeviceWintab *device_wintab; POINT point; HWND hwnd, hwndc; int scale; device_wintab = GDK_DEVICE_WINTAB (device); if (window) { scale = GDK_SURFACE_IMPL_WIN32 (window->impl)->surface_scale; hwnd = GDK_SURFACE_HWND (window); } else { GdkDisplay *display = gdk_device_get_display (device); scale = GDK_WIN32_DISPLAY (display)->surface_scale; hwnd = NULL; } GetCursorPos (&point); if (root_x) *root_x = point.x / scale; if (root_y) *root_y = point.y / scale; if (hwnd) ScreenToClient (hwnd, &point); if (win_x) *win_x = point.x / scale; if (win_y) *win_y = point.y / scale; if (!window) { if (win_x) *win_x += _gdk_offset_x; if (win_y) *win_y += _gdk_offset_y; } if (hwnd && child_window) { hwndc = ChildWindowFromPoint (hwnd, point); if (hwndc && hwndc != hwnd) *child_window = gdk_win32_handle_table_lookup (hwndc); else *child_window = NULL; /* Direct child unknown to gdk */ } if (mask) { *mask = get_current_mask (); *mask &= 0xFF; /* Mask away core pointer buttons */ *mask |= ((device_wintab->button_state << 8) & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK | GDK_BUTTON4_MASK | GDK_BUTTON5_MASK)); } }