mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 13:41:07 +00:00
Make window_get_pointer a window impl virtual
This commit is contained in:
parent
247e1945a0
commit
4720bbc15e
@ -539,16 +539,15 @@ gdk_window_real_window_get_pointer (GdkDisplay *display,
|
||||
GdkModifierType *mask)
|
||||
{
|
||||
GdkWindowObject *private;
|
||||
GdkWindow *pointer_window;
|
||||
gint tmpx, tmpy;
|
||||
GdkModifierType tmp_mask;
|
||||
gboolean normal_child;
|
||||
|
||||
private = (GdkWindowObject *) window;
|
||||
|
||||
_gdk_windowing_window_get_pointer (display,
|
||||
window,
|
||||
&tmpx, &tmpy,
|
||||
mask);
|
||||
normal_child = GDK_WINDOW_IMPL_GET_IFACE (private->impl)->get_pointer (window,
|
||||
&tmpx, &tmpy,
|
||||
&tmp_mask);
|
||||
/* We got the coords on the impl, conver to the window */
|
||||
tmpx -= private->abs_x;
|
||||
tmpy -= private->abs_y;
|
||||
@ -557,8 +556,12 @@ gdk_window_real_window_get_pointer (GdkDisplay *display,
|
||||
*x = tmpx;
|
||||
if (y)
|
||||
*y = tmpy;
|
||||
if (mask)
|
||||
*mask = tmp_mask;
|
||||
|
||||
return _gdk_window_find_child_at (window, x, y);
|
||||
if (normal_child)
|
||||
return _gdk_window_find_child_at (window, tmpx, tmpy);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -853,9 +856,8 @@ synthesize_crossing_events (GdkDisplay *display,
|
||||
src_toplevel == dest_toplevel)
|
||||
{
|
||||
/* Same toplevels */
|
||||
_gdk_windowing_window_get_pointer (display,
|
||||
dest_toplevel,
|
||||
&x, &y, &state);
|
||||
gdk_window_get_pointer (dest_toplevel,
|
||||
&x, &y, &state);
|
||||
_gdk_syntesize_crossing_events (display,
|
||||
src_window,
|
||||
dest_window,
|
||||
@ -867,9 +869,8 @@ synthesize_crossing_events (GdkDisplay *display,
|
||||
}
|
||||
else if (dest_toplevel == NULL)
|
||||
{
|
||||
_gdk_windowing_window_get_pointer (display,
|
||||
src_toplevel,
|
||||
&x, &y, &state);
|
||||
gdk_window_get_pointer (src_toplevel,
|
||||
&x, &y, &state);
|
||||
_gdk_syntesize_crossing_events (display,
|
||||
src_window,
|
||||
NULL,
|
||||
@ -882,9 +883,8 @@ synthesize_crossing_events (GdkDisplay *display,
|
||||
else
|
||||
{
|
||||
/* Different toplevels */
|
||||
_gdk_windowing_window_get_pointer (display,
|
||||
src_toplevel,
|
||||
&x, &y, &state);
|
||||
gdk_window_get_pointer (src_toplevel,
|
||||
&x, &y, &state);
|
||||
_gdk_syntesize_crossing_events (display,
|
||||
src_window,
|
||||
NULL,
|
||||
@ -893,9 +893,8 @@ synthesize_crossing_events (GdkDisplay *display,
|
||||
time,
|
||||
NULL,
|
||||
serial);
|
||||
_gdk_windowing_window_get_pointer (display,
|
||||
dest_toplevel,
|
||||
&x, &y, &state);
|
||||
gdk_window_get_pointer (dest_toplevel,
|
||||
&x, &y, &state);
|
||||
_gdk_syntesize_crossing_events (display,
|
||||
NULL,
|
||||
dest_window,
|
||||
|
@ -448,11 +448,6 @@ void _gdk_windowing_get_pointer (GdkDisplay *display,
|
||||
gint *x,
|
||||
gint *y,
|
||||
GdkModifierType *mask);
|
||||
GdkWindow* _gdk_windowing_window_get_pointer (GdkDisplay *display,
|
||||
GdkWindow *window,
|
||||
gint *x,
|
||||
gint *y,
|
||||
GdkModifierType *mask);
|
||||
GdkWindow* _gdk_windowing_window_at_pointer (GdkDisplay *display,
|
||||
gint *win_x,
|
||||
gint *win_y,
|
||||
|
@ -698,6 +698,21 @@ gdk_offscreen_window_get_origin (GdkWindow *window,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_offscreen_window_get_pointer (GdkWindow *window,
|
||||
gint *x,
|
||||
gint *y,
|
||||
GdkModifierType *mask)
|
||||
{
|
||||
*x = 0;
|
||||
*y = 0;
|
||||
*mask = 0;
|
||||
|
||||
/* TODO: Implement this by signal emission */
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_window_get_offscreen_pixmap:
|
||||
* @window: a #GdkWindow
|
||||
@ -1079,6 +1094,7 @@ gdk_offscreen_window_impl_iface_init (GdkWindowImplIface *iface)
|
||||
iface->queue_antiexpose = gdk_offscreen_window_queue_antiexpose;
|
||||
iface->queue_translation = gdk_offscreen_window_queue_translation;
|
||||
iface->get_origin = gdk_offscreen_window_get_origin;
|
||||
iface->get_pointer = gdk_offscreen_window_get_pointer;
|
||||
iface->destroy = gdk_offscreen_window_destroy;
|
||||
}
|
||||
|
||||
|
@ -86,6 +86,10 @@ struct _GdkWindowImplIface
|
||||
gint (* get_deskrelative_origin) (GdkWindow *window,
|
||||
gint *x,
|
||||
gint *y);
|
||||
gboolean (* get_pointer) (GdkWindow *window,
|
||||
gint *x,
|
||||
gint *y,
|
||||
GdkModifierType *mask);
|
||||
|
||||
void (* shape_combine_region) (GdkWindow *window,
|
||||
const GdkRegion *shape_region,
|
||||
|
@ -3087,14 +3087,14 @@ _gdk_windowing_get_pointer (GdkDisplay *display,
|
||||
*mask = xmask;
|
||||
}
|
||||
|
||||
GdkWindow*
|
||||
_gdk_windowing_window_get_pointer (GdkDisplay *display,
|
||||
GdkWindow *window,
|
||||
gint *x,
|
||||
gint *y,
|
||||
GdkModifierType *mask)
|
||||
static gboolean
|
||||
gdk_window_x11_get_pointer (GdkWindow *window,
|
||||
gint *x,
|
||||
gint *y,
|
||||
GdkModifierType *mask)
|
||||
{
|
||||
GdkWindow *return_val;
|
||||
GdkDisplay *display = GDK_WINDOW_DISPLAY (window);
|
||||
gboolean return_val;
|
||||
Window root;
|
||||
Window child;
|
||||
int rootx, rooty;
|
||||
@ -3102,37 +3102,38 @@ _gdk_windowing_window_get_pointer (GdkDisplay *display,
|
||||
int winy = 0;
|
||||
unsigned int xmask = 0;
|
||||
|
||||
g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
|
||||
g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), FALSE);
|
||||
|
||||
|
||||
return_val = NULL;
|
||||
if (!GDK_WINDOW_DESTROYED (window))
|
||||
return_val = TRUE;
|
||||
if (!GDK_WINDOW_DESTROYED (window))
|
||||
{
|
||||
if (G_LIKELY (GDK_DISPLAY_X11 (display)->trusted_client))
|
||||
if (G_LIKELY (GDK_DISPLAY_X11 (display)->trusted_client))
|
||||
{
|
||||
if (XQueryPointer (GDK_WINDOW_XDISPLAY (window),
|
||||
GDK_WINDOW_XID (window),
|
||||
&root, &child, &rootx, &rooty, &winx, &winy, &xmask))
|
||||
{
|
||||
if (child)
|
||||
return_val = gdk_window_lookup_for_display (GDK_WINDOW_DISPLAY (window), child);
|
||||
return_val = gdk_window_lookup_for_display (GDK_WINDOW_DISPLAY (window), child) != NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
GdkScreen *screen;
|
||||
int originx, originy;
|
||||
_gdk_windowing_get_pointer (gdk_drawable_get_display (window), &screen,
|
||||
_gdk_windowing_get_pointer (gdk_drawable_get_display (window), &screen,
|
||||
&rootx, &rooty, &xmask);
|
||||
gdk_window_get_origin (window, &originx, &originy);
|
||||
winx = rootx - originx;
|
||||
winy = rooty - originy;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
*x = winx;
|
||||
*y = winy;
|
||||
*mask = xmask;
|
||||
|
||||
|
||||
return return_val;
|
||||
}
|
||||
|
||||
@ -5575,6 +5576,7 @@ gdk_window_impl_iface_init (GdkWindowImplIface *iface)
|
||||
iface->set_cursor = gdk_window_x11_set_cursor;
|
||||
iface->get_geometry = gdk_window_x11_get_geometry;
|
||||
iface->get_origin = gdk_window_x11_get_origin;
|
||||
iface->get_pointer = gdk_window_x11_get_pointer;
|
||||
iface->get_deskrelative_origin = gdk_window_x11_get_deskrelative_origin;
|
||||
iface->shape_combine_region = gdk_window_x11_shape_combine_region;
|
||||
iface->input_shape_combine_region = gdk_window_x11_input_shape_combine_region;
|
||||
|
Loading…
Reference in New Issue
Block a user