mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-12 13:30:19 +00:00
Add _gdk_win32_get_cursor_pos utility
This commit is contained in:
parent
68db945e47
commit
52f7bb6950
@ -89,7 +89,7 @@ gdk_device_win32_query_state (GdkDevice *device,
|
||||
hwnd = NULL;
|
||||
}
|
||||
|
||||
GetCursorPos (&point);
|
||||
_gdk_win32_get_cursor_pos (&point);
|
||||
|
||||
if (hwnd)
|
||||
ScreenToClient (hwnd, &point);
|
||||
@ -177,7 +177,7 @@ _gdk_device_win32_surface_at_position (GdkDevice *device,
|
||||
HWND hwnd;
|
||||
RECT rect;
|
||||
|
||||
if (!GetCursorPos (&screen_pt))
|
||||
if (!_gdk_win32_get_cursor_pos (&screen_pt))
|
||||
return NULL;
|
||||
|
||||
/* Use WindowFromPoint instead of ChildWindowFromPoint(Ex).
|
||||
|
@ -80,7 +80,7 @@ gdk_device_winpointer_query_state (GdkDevice *device,
|
||||
hwnd = NULL;
|
||||
}
|
||||
|
||||
GetCursorPos (&point);
|
||||
_gdk_win32_get_cursor_pos (&point);
|
||||
|
||||
if (hwnd)
|
||||
ScreenToClient (hwnd, &point);
|
||||
@ -154,7 +154,7 @@ gdk_device_winpointer_surface_at_position (GdkDevice *device,
|
||||
HWND hwnd;
|
||||
RECT rect;
|
||||
|
||||
if (!GetCursorPos (&screen_pt))
|
||||
if (!_gdk_win32_get_cursor_pos (&screen_pt))
|
||||
return NULL;
|
||||
|
||||
/* Use WindowFromPoint instead of ChildWindowFromPoint(Ex).
|
||||
|
@ -88,7 +88,7 @@ gdk_device_wintab_query_state (GdkDevice *device,
|
||||
hwnd = NULL;
|
||||
}
|
||||
|
||||
GetCursorPos (&point);
|
||||
_gdk_win32_get_cursor_pos (&point);
|
||||
|
||||
if (hwnd)
|
||||
ScreenToClient (hwnd, &point);
|
||||
|
@ -166,6 +166,9 @@ static int both_shift_pressed[2]; /* to store keycodes for shift keys */
|
||||
static HHOOK keyboard_hook = NULL;
|
||||
static UINT aerosnap_message;
|
||||
|
||||
static gboolean pen_touch_input;
|
||||
static POINT pen_touch_cursor_position;
|
||||
|
||||
static void
|
||||
track_mouse_event (DWORD dwFlags,
|
||||
HWND hwnd)
|
||||
@ -200,6 +203,18 @@ _gdk_win32_get_next_tick (gulong suggested_tick)
|
||||
return cur_tick = suggested_tick;
|
||||
}
|
||||
|
||||
BOOL
|
||||
_gdk_win32_get_cursor_pos (LPPOINT lpPoint)
|
||||
{
|
||||
if (pen_touch_input)
|
||||
{
|
||||
*lpPoint = pen_touch_cursor_position;
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return GetCursorPos (lpPoint);
|
||||
}
|
||||
|
||||
static void
|
||||
generate_focus_event (GdkDeviceManagerWin32 *device_manager,
|
||||
GdkSurface *window,
|
||||
@ -2215,6 +2230,8 @@ gdk_event_translate (MSG *msg,
|
||||
g_print (" (%d,%d)",
|
||||
GET_X_LPARAM (msg->lParam), GET_Y_LPARAM (msg->lParam)));
|
||||
|
||||
pen_touch_input = FALSE;
|
||||
|
||||
g_set_object (&window, find_window_for_mouse_event (window, msg));
|
||||
/* TODO_CSW?: there used to some synthesize and propagate */
|
||||
if (GDK_SURFACE_DESTROYED (window))
|
||||
@ -2257,6 +2274,8 @@ gdk_event_translate (MSG *msg,
|
||||
g_print (" (%d,%d)",
|
||||
GET_X_LPARAM (msg->lParam), GET_Y_LPARAM (msg->lParam)));
|
||||
|
||||
pen_touch_input = FALSE;
|
||||
|
||||
g_set_object (&window, find_window_for_mouse_event (window, msg));
|
||||
|
||||
if (pointer_grab == NULL && implicit_grab_surface != NULL)
|
||||
@ -2315,6 +2334,8 @@ gdk_event_translate (MSG *msg,
|
||||
(gpointer) msg->wParam,
|
||||
GET_X_LPARAM (msg->lParam), GET_Y_LPARAM (msg->lParam)));
|
||||
|
||||
pen_touch_input = FALSE;
|
||||
|
||||
new_window = window;
|
||||
|
||||
if (pointer_grab != NULL)
|
||||
@ -2417,6 +2438,8 @@ gdk_event_translate (MSG *msg,
|
||||
GDK_NOTE (EVENTS, g_print (" %d (%ld,%ld)",
|
||||
HIWORD (msg->wParam), msg->pt.x, msg->pt.y));
|
||||
|
||||
pen_touch_input = FALSE;
|
||||
|
||||
new_window = NULL;
|
||||
hwnd = WindowFromPoint (msg->pt);
|
||||
ignore_leave = FALSE;
|
||||
@ -2464,6 +2487,13 @@ gdk_event_translate (MSG *msg,
|
||||
break;
|
||||
}
|
||||
|
||||
if (IS_POINTER_PRIMARY_WPARAM (msg->wParam))
|
||||
{
|
||||
current_root_x = pen_touch_cursor_position.x = GET_X_LPARAM (msg->lParam);
|
||||
current_root_y = pen_touch_cursor_position.y = GET_Y_LPARAM (msg->lParam);
|
||||
pen_touch_input = TRUE;
|
||||
}
|
||||
|
||||
if (pointer_grab != NULL &&
|
||||
!pointer_grab->implicit &&
|
||||
!pointer_grab->owner_events)
|
||||
@ -2486,6 +2516,13 @@ gdk_event_translate (MSG *msg,
|
||||
break;
|
||||
}
|
||||
|
||||
if (IS_POINTER_PRIMARY_WPARAM (msg->wParam))
|
||||
{
|
||||
current_root_x = pen_touch_cursor_position.x = GET_X_LPARAM (msg->lParam);
|
||||
current_root_y = pen_touch_cursor_position.y = GET_Y_LPARAM (msg->lParam);
|
||||
pen_touch_input = TRUE;
|
||||
}
|
||||
|
||||
if (pointer_grab != NULL &&
|
||||
!pointer_grab->implicit &&
|
||||
!pointer_grab->owner_events)
|
||||
@ -2511,6 +2548,13 @@ gdk_event_translate (MSG *msg,
|
||||
break;
|
||||
}
|
||||
|
||||
if (IS_POINTER_PRIMARY_WPARAM (msg->wParam))
|
||||
{
|
||||
current_root_x = pen_touch_cursor_position.x = GET_X_LPARAM (msg->lParam);
|
||||
current_root_y = pen_touch_cursor_position.y = GET_Y_LPARAM (msg->lParam);
|
||||
pen_touch_input = TRUE;
|
||||
}
|
||||
|
||||
if (pointer_grab != NULL &&
|
||||
!pointer_grab->implicit &&
|
||||
!pointer_grab->owner_events)
|
||||
@ -2542,6 +2586,13 @@ gdk_event_translate (MSG *msg,
|
||||
break;
|
||||
}
|
||||
|
||||
if (IS_POINTER_PRIMARY_WPARAM (msg->wParam))
|
||||
{
|
||||
current_root_x = pen_touch_cursor_position.x = GET_X_LPARAM (msg->lParam);
|
||||
current_root_y = pen_touch_cursor_position.y = GET_Y_LPARAM (msg->lParam);
|
||||
pen_touch_input = TRUE;
|
||||
}
|
||||
|
||||
if (IS_POINTER_PRIMARY_WPARAM (msg->wParam) &&
|
||||
!IS_POINTER_INCONTACT_WPARAM (msg->wParam) &&
|
||||
mouse_window != NULL)
|
||||
@ -2553,7 +2604,7 @@ gdk_event_translate (MSG *msg,
|
||||
{
|
||||
make_crossing_event(event_device,
|
||||
NULL,
|
||||
&msg->pt,
|
||||
&pen_touch_cursor_position,
|
||||
event_time);
|
||||
}
|
||||
}
|
||||
@ -2569,6 +2620,13 @@ gdk_event_translate (MSG *msg,
|
||||
break;
|
||||
}
|
||||
|
||||
if (IS_POINTER_PRIMARY_WPARAM (msg->wParam))
|
||||
{
|
||||
current_root_x = pen_touch_cursor_position.x = GET_X_LPARAM (msg->lParam);
|
||||
current_root_y = pen_touch_cursor_position.y = GET_Y_LPARAM (msg->lParam);
|
||||
pen_touch_input = TRUE;
|
||||
}
|
||||
|
||||
if (pointer_grab != NULL &&
|
||||
!pointer_grab->implicit &&
|
||||
!pointer_grab->owner_events)
|
||||
@ -2591,6 +2649,13 @@ gdk_event_translate (MSG *msg,
|
||||
break;
|
||||
}
|
||||
|
||||
if (IS_POINTER_PRIMARY_WPARAM (msg->wParam))
|
||||
{
|
||||
current_root_x = pen_touch_cursor_position.x = GET_X_LPARAM (msg->lParam);
|
||||
current_root_y = pen_touch_cursor_position.y = GET_Y_LPARAM (msg->lParam);
|
||||
pen_touch_input = TRUE;
|
||||
}
|
||||
|
||||
if (!IS_POINTER_INRANGE_WPARAM (msg->wParam))
|
||||
{
|
||||
gdk_winpointer_input_events (window, NULL, msg);
|
||||
@ -2604,7 +2669,7 @@ gdk_event_translate (MSG *msg,
|
||||
{
|
||||
make_crossing_event(event_device,
|
||||
NULL,
|
||||
&msg->pt,
|
||||
&pen_touch_cursor_position,
|
||||
event_time);
|
||||
}
|
||||
}
|
||||
|
@ -157,6 +157,8 @@ GType _gdk_gc_win32_get_type (void);
|
||||
|
||||
gulong _gdk_win32_get_next_tick (gulong suggested_tick);
|
||||
|
||||
BOOL _gdk_win32_get_cursor_pos (LPPOINT lpPoint);
|
||||
|
||||
void _gdk_surface_init_position (GdkSurface *window);
|
||||
void _gdk_surface_move_resize_child (GdkSurface *window,
|
||||
int x,
|
||||
|
Loading…
Reference in New Issue
Block a user