Make window_get_pointer a window impl virtual

This commit is contained in:
Alexander Larsson 2009-06-04 19:21:20 +02:00
parent 247e1945a0
commit 4720bbc15e
5 changed files with 56 additions and 40 deletions

View File

@ -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,
normal_child = GDK_WINDOW_IMPL_GET_IFACE (private->impl)->get_pointer (window,
&tmpx, &tmpy,
mask);
&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,8 +856,7 @@ synthesize_crossing_events (GdkDisplay *display,
src_toplevel == dest_toplevel)
{
/* Same toplevels */
_gdk_windowing_window_get_pointer (display,
dest_toplevel,
gdk_window_get_pointer (dest_toplevel,
&x, &y, &state);
_gdk_syntesize_crossing_events (display,
src_window,
@ -867,8 +869,7 @@ synthesize_crossing_events (GdkDisplay *display,
}
else if (dest_toplevel == NULL)
{
_gdk_windowing_window_get_pointer (display,
src_toplevel,
gdk_window_get_pointer (src_toplevel,
&x, &y, &state);
_gdk_syntesize_crossing_events (display,
src_window,
@ -882,8 +883,7 @@ synthesize_crossing_events (GdkDisplay *display,
else
{
/* Different toplevels */
_gdk_windowing_window_get_pointer (display,
src_toplevel,
gdk_window_get_pointer (src_toplevel,
&x, &y, &state);
_gdk_syntesize_crossing_events (display,
src_window,
@ -893,8 +893,7 @@ synthesize_crossing_events (GdkDisplay *display,
time,
NULL,
serial);
_gdk_windowing_window_get_pointer (display,
dest_toplevel,
gdk_window_get_pointer (dest_toplevel,
&x, &y, &state);
_gdk_syntesize_crossing_events (display,
NULL,

View File

@ -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,

View File

@ -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;
}

View File

@ -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,

View File

@ -3087,14 +3087,14 @@ _gdk_windowing_get_pointer (GdkDisplay *display,
*mask = xmask;
}
GdkWindow*
_gdk_windowing_window_get_pointer (GdkDisplay *display,
GdkWindow *window,
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,9 +3102,10 @@ _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;
return_val = TRUE;
if (!GDK_WINDOW_DESTROYED (window))
{
if (G_LIKELY (GDK_DISPLAY_X11 (display)->trusted_client))
@ -3114,7 +3115,7 @@ _gdk_windowing_window_get_pointer (GdkDisplay *display,
&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
@ -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;