Commit 253458ec authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

- Replace GdkPointerHooks with a multihead-safe GdkDisplayPointerHooks,

Mon Oct  7 15:10:00 2002  Owen Taylor  <otaylor@redhat.com>

        * gdk/gdkdisplay.[ch] gdk/gdkinternals.h
        gdk/gdkwindow.[ch] gdk/linux-fb/gdkwindow-fb.c
        gdk/win32/gdkwindow-win32.c gdk/x11/gdkwindow-x11.c:

        - Replace GdkPointerHooks with a multihead-safe
          GdkDisplayPointerHooks, leave GdkPointerHooks
          around for singlehead.
        - Add gdk_display_get_pointer() to get the pointer
          location with the screen it is on.

        * gdk/gdk.def gdk/gdkdisplay.[ch] gdk/gdkscreen.[ch]:
        Change gdk_screen_get_window_at_pointer() to
        gdk_display_get_window_at_pointer().

        * gtk/gtktreeview.c demos/gtk-demo/changedisplay.c
        tests/testgtk.c: Use gdk_display_get_window_at_pointer(),
        not gdk_screen_get_window_at_pointer().

        * gtk/gtkcolorsel.c: Fix grabbing color to be multihead
        safe.

        * gtk/gtkwidget.c: Allow gtk_widget_push_colormap (NULL).
        since it is useful for writing code that doesn't
        know the dcurrent state but needs a clean colormap.

        * gtk/gtkrc.c: When loading the settings for a particular
        screen, only reset toplevels on that screen.

        * gtk/gtkiconfactory.h: Fix #ifdef GTK_MULTIHEAD_SAFE
        that should have been #ifndef GTK_MULTIHEAD_SAFE.
parent 55704fc7
Mon Oct 7 15:10:00 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdisplay.[ch] gdk/gdkinternals.h
gdk/gdkwindow.[ch] gdk/linux-fb/gdkwindow-fb.c
gdk/win32/gdkwindow-win32.c gdk/x11/gdkwindow-x11.c:
- Replace GdkPointerHooks with a multihead-safe
GdkDisplayPointerHooks, leave GdkPointerHooks
around for singlehead.
- Add gdk_display_get_pointer() to get the pointer
location with the screen it is on.
* gdk/gdk.def gdk/gdkdisplay.[ch] gdk/gdkscreen.[ch]:
Change gdk_screen_get_window_at_pointer() to
gdk_display_get_window_at_pointer().
* gtk/gtktreeview.c demos/gtk-demo/changedisplay.c
tests/testgtk.c: Use gdk_display_get_window_at_pointer(),
not gdk_screen_get_window_at_pointer().
* gtk/gtkcolorsel.c: Fix grabbing color to be multihead
safe.
* gtk/gtkwidget.c: Allow gtk_widget_push_colormap (NULL).
since it is useful for writing code that doesn't
know the dcurrent state but needs a clean colormap.
* gtk/gtkrc.c: When loading the settings for a particular
screen, only reset toplevels on that screen.
* gtk/gtkiconfactory.h: Fix #ifdef GTK_MULTIHEAD_SAFE
that should have been #ifndef GTK_MULTIHEAD_SAFE.
Mon Oct 7 11:59:33 2002 Manish Singh <yosh@gimp.org>
* gtk/gtkliststore.[ch] gtk/gtktreedatalist.[ch] gtk/gtktreednd.c
......
Mon Oct 7 15:10:00 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdisplay.[ch] gdk/gdkinternals.h
gdk/gdkwindow.[ch] gdk/linux-fb/gdkwindow-fb.c
gdk/win32/gdkwindow-win32.c gdk/x11/gdkwindow-x11.c:
- Replace GdkPointerHooks with a multihead-safe
GdkDisplayPointerHooks, leave GdkPointerHooks
around for singlehead.
- Add gdk_display_get_pointer() to get the pointer
location with the screen it is on.
* gdk/gdk.def gdk/gdkdisplay.[ch] gdk/gdkscreen.[ch]:
Change gdk_screen_get_window_at_pointer() to
gdk_display_get_window_at_pointer().
* gtk/gtktreeview.c demos/gtk-demo/changedisplay.c
tests/testgtk.c: Use gdk_display_get_window_at_pointer(),
not gdk_screen_get_window_at_pointer().
* gtk/gtkcolorsel.c: Fix grabbing color to be multihead
safe.
* gtk/gtkwidget.c: Allow gtk_widget_push_colormap (NULL).
since it is useful for writing code that doesn't
know the dcurrent state but needs a clean colormap.
* gtk/gtkrc.c: When loading the settings for a particular
screen, only reset toplevels on that screen.
* gtk/gtkiconfactory.h: Fix #ifdef GTK_MULTIHEAD_SAFE
that should have been #ifndef GTK_MULTIHEAD_SAFE.
Mon Oct 7 11:59:33 2002 Manish Singh <yosh@gimp.org>
* gtk/gtkliststore.[ch] gtk/gtktreedatalist.[ch] gtk/gtktreednd.c
......
Mon Oct 7 15:10:00 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdisplay.[ch] gdk/gdkinternals.h
gdk/gdkwindow.[ch] gdk/linux-fb/gdkwindow-fb.c
gdk/win32/gdkwindow-win32.c gdk/x11/gdkwindow-x11.c:
- Replace GdkPointerHooks with a multihead-safe
GdkDisplayPointerHooks, leave GdkPointerHooks
around for singlehead.
- Add gdk_display_get_pointer() to get the pointer
location with the screen it is on.
* gdk/gdk.def gdk/gdkdisplay.[ch] gdk/gdkscreen.[ch]:
Change gdk_screen_get_window_at_pointer() to
gdk_display_get_window_at_pointer().
* gtk/gtktreeview.c demos/gtk-demo/changedisplay.c
tests/testgtk.c: Use gdk_display_get_window_at_pointer(),
not gdk_screen_get_window_at_pointer().
* gtk/gtkcolorsel.c: Fix grabbing color to be multihead
safe.
* gtk/gtkwidget.c: Allow gtk_widget_push_colormap (NULL).
since it is useful for writing code that doesn't
know the dcurrent state but needs a clean colormap.
* gtk/gtkrc.c: When loading the settings for a particular
screen, only reset toplevels on that screen.
* gtk/gtkiconfactory.h: Fix #ifdef GTK_MULTIHEAD_SAFE
that should have been #ifndef GTK_MULTIHEAD_SAFE.
Mon Oct 7 11:59:33 2002 Manish Singh <yosh@gimp.org>
* gtk/gtkliststore.[ch] gtk/gtktreedatalist.[ch] gtk/gtktreednd.c
......
Mon Oct 7 15:10:00 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdisplay.[ch] gdk/gdkinternals.h
gdk/gdkwindow.[ch] gdk/linux-fb/gdkwindow-fb.c
gdk/win32/gdkwindow-win32.c gdk/x11/gdkwindow-x11.c:
- Replace GdkPointerHooks with a multihead-safe
GdkDisplayPointerHooks, leave GdkPointerHooks
around for singlehead.
- Add gdk_display_get_pointer() to get the pointer
location with the screen it is on.
* gdk/gdk.def gdk/gdkdisplay.[ch] gdk/gdkscreen.[ch]:
Change gdk_screen_get_window_at_pointer() to
gdk_display_get_window_at_pointer().
* gtk/gtktreeview.c demos/gtk-demo/changedisplay.c
tests/testgtk.c: Use gdk_display_get_window_at_pointer(),
not gdk_screen_get_window_at_pointer().
* gtk/gtkcolorsel.c: Fix grabbing color to be multihead
safe.
* gtk/gtkwidget.c: Allow gtk_widget_push_colormap (NULL).
since it is useful for writing code that doesn't
know the dcurrent state but needs a clean colormap.
* gtk/gtkrc.c: When loading the settings for a particular
screen, only reset toplevels on that screen.
* gtk/gtkiconfactory.h: Fix #ifdef GTK_MULTIHEAD_SAFE
that should have been #ifndef GTK_MULTIHEAD_SAFE.
Mon Oct 7 11:59:33 2002 Manish Singh <yosh@gimp.org>
* gtk/gtkliststore.[ch] gtk/gtktreedatalist.[ch] gtk/gtktreednd.c
......
Mon Oct 7 15:10:00 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdisplay.[ch] gdk/gdkinternals.h
gdk/gdkwindow.[ch] gdk/linux-fb/gdkwindow-fb.c
gdk/win32/gdkwindow-win32.c gdk/x11/gdkwindow-x11.c:
- Replace GdkPointerHooks with a multihead-safe
GdkDisplayPointerHooks, leave GdkPointerHooks
around for singlehead.
- Add gdk_display_get_pointer() to get the pointer
location with the screen it is on.
* gdk/gdk.def gdk/gdkdisplay.[ch] gdk/gdkscreen.[ch]:
Change gdk_screen_get_window_at_pointer() to
gdk_display_get_window_at_pointer().
* gtk/gtktreeview.c demos/gtk-demo/changedisplay.c
tests/testgtk.c: Use gdk_display_get_window_at_pointer(),
not gdk_screen_get_window_at_pointer().
* gtk/gtkcolorsel.c: Fix grabbing color to be multihead
safe.
* gtk/gtkwidget.c: Allow gtk_widget_push_colormap (NULL).
since it is useful for writing code that doesn't
know the dcurrent state but needs a clean colormap.
* gtk/gtkrc.c: When loading the settings for a particular
screen, only reset toplevels on that screen.
* gtk/gtkiconfactory.h: Fix #ifdef GTK_MULTIHEAD_SAFE
that should have been #ifndef GTK_MULTIHEAD_SAFE.
Mon Oct 7 11:59:33 2002 Manish Singh <yosh@gimp.org>
* gtk/gtkliststore.[ch] gtk/gtktreedatalist.[ch] gtk/gtktreednd.c
......
Mon Oct 7 15:10:00 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdisplay.[ch] gdk/gdkinternals.h
gdk/gdkwindow.[ch] gdk/linux-fb/gdkwindow-fb.c
gdk/win32/gdkwindow-win32.c gdk/x11/gdkwindow-x11.c:
- Replace GdkPointerHooks with a multihead-safe
GdkDisplayPointerHooks, leave GdkPointerHooks
around for singlehead.
- Add gdk_display_get_pointer() to get the pointer
location with the screen it is on.
* gdk/gdk.def gdk/gdkdisplay.[ch] gdk/gdkscreen.[ch]:
Change gdk_screen_get_window_at_pointer() to
gdk_display_get_window_at_pointer().
* gtk/gtktreeview.c demos/gtk-demo/changedisplay.c
tests/testgtk.c: Use gdk_display_get_window_at_pointer(),
not gdk_screen_get_window_at_pointer().
* gtk/gtkcolorsel.c: Fix grabbing color to be multihead
safe.
* gtk/gtkwidget.c: Allow gtk_widget_push_colormap (NULL).
since it is useful for writing code that doesn't
know the dcurrent state but needs a clean colormap.
* gtk/gtkrc.c: When loading the settings for a particular
screen, only reset toplevels on that screen.
* gtk/gtkiconfactory.h: Fix #ifdef GTK_MULTIHEAD_SAFE
that should have been #ifndef GTK_MULTIHEAD_SAFE.
Mon Oct 7 11:59:33 2002 Manish Singh <yosh@gimp.org>
* gtk/gtkliststore.[ch] gtk/gtktreedatalist.[ch] gtk/gtktreednd.c
......
......@@ -70,12 +70,12 @@ enum
/* Finds the toplevel window under the mouse pointer, if any.
*/
static GtkWidget *
find_toplevel_at_pointer (GdkScreen *screen)
find_toplevel_at_pointer (GdkDisplay *display)
{
GdkWindow *pointer_window;
GtkWidget *widget = NULL;
pointer_window = gdk_screen_get_window_at_pointer (screen, NULL, NULL);
pointer_window = gdk_display_get_window_at_pointer (display, NULL, NULL);
/* The user data field of a GdkWindow is used to store a pointer
* to the widget that created it.
......@@ -142,7 +142,7 @@ query_for_toplevel (GdkScreen *screen,
while (!clicked)
g_main_context_iteration (NULL, TRUE);
toplevel = find_toplevel_at_pointer (screen);
toplevel = find_toplevel_at_pointer (gdk_screen_get_display (screen));
if (toplevel == popup)
toplevel = NULL;
}
......
......@@ -62,6 +62,7 @@ EXPORTS
gdk_display_get_n_screens
gdk_display_get_screen
gdk_display_get_type
gdk_display_get_window_at_pointer
gdk_display_keyboard_ungrab
gdk_display_pointer_is_grabbed
gdk_display_pointer_ungrab
......@@ -335,7 +336,6 @@ EXPORTS
gdk_screen_get_system_colormap
gdk_screen_get_type
gdk_screen_get_width
gdk_screen_get_window_at_pointer
gdk_screen_height
gdk_screen_height_mm
gdk_screen_set_default_colormap
......
......@@ -38,11 +38,53 @@ static void gdk_display_init (GdkDisplay *display);
static void gdk_display_dispose (GObject *object);
static void gdk_display_finalize (GObject *object);
void singlehead_get_pointer (GdkDisplay *display,
GdkScreen **screen,
gint *x,
gint *y,
GdkModifierType *mask);
GdkWindow* singlehead_window_get_pointer (GdkDisplay *display,
GdkWindow *window,
gint *x,
gint *y,
GdkModifierType *mask);
GdkWindow* singlehead_window_at_pointer (GdkDisplay *display,
gint *win_x,
gint *win_y);
GdkWindow* singlehead_default_window_get_pointer (GdkWindow *window,
gint *x,
gint *y,
GdkModifierType *mask);
GdkWindow* singlehead_default_window_at_pointer (GdkScreen *screen,
gint *win_x,
gint *win_y);
static guint signals[LAST_SIGNAL] = { 0 };
static GObjectClass *parent_class;
static char *gdk_sm_client_id;
static const GdkDisplayPointerHooks default_pointer_hooks = {
_gdk_windowing_get_pointer,
_gdk_windowing_window_get_pointer,
_gdk_windowing_window_at_pointer
};
static const GdkDisplayPointerHooks singlehead_pointer_hooks = {
singlehead_get_pointer,
singlehead_window_get_pointer,
singlehead_window_at_pointer
};
static const GdkPointerHooks singlehead_default_pointer_hooks = {
singlehead_default_window_get_pointer,
singlehead_default_window_at_pointer
};
static const GdkPointerHooks *singlehead_current_pointer_hooks = &singlehead_default_pointer_hooks;
GType
gdk_display_get_type (void)
{
......@@ -101,6 +143,8 @@ gdk_display_init (GdkDisplay *display)
display->button_number[0] = display->button_number[1] = -1;
display->double_click_time = 250;
display->pointer_hooks = &default_pointer_hooks;
}
static void
......@@ -379,3 +423,191 @@ _gdk_get_sm_client_id (void)
{
return gdk_sm_client_id;
}
/**
* gdk_display_get_pointer:
* @display: a #GdkDisplay
* @screen: location to store the screen that the
* cursor is on, or %NULL.
* @x: location to store root window X coordinate of pointer, or %NULL.
* @y: location to store root window Y coordinate of pointer, or %NULL.
* @mask: location to store current modifier mask, or %NULL
*
* Gets the current location of the pointer and the current modifier
* mask for a given display.
**/
void
gdk_display_get_pointer (GdkDisplay *display,
GdkScreen **screen,
gint *x,
gint *y,
GdkModifierType *mask)
{
GdkScreen *tmp_screen;
gint tmp_x, tmp_y;
GdkModifierType tmp_mask;
g_return_if_fail (GDK_IS_DISPLAY (display));
display->pointer_hooks->get_pointer (display, &tmp_screen, &tmp_x, &tmp_y, &tmp_mask);
if (screen)
*screen = tmp_screen;
if (x)
*x = tmp_x;
if (y)
*y = tmp_y;
if (mask)
*mask = tmp_mask;
}
/**
* gdk_display_get_window_at_pointer:
* @display: a #GdkDisplay
* @win_x: return location for origin of the window under the pointer
* @win_y: return location for origin of the window under the pointer
*
* Obtains the window underneath the mouse pointer, returning the location
* of that window in @win_x, @win_y for @screen. Returns %NULL if the window
* under the mouse pointer is not known to GDK (for example, belongs to
* another application).
*
* Returns: the window under the mouse pointer, or %NULL
**/
GdkWindow *
gdk_display_get_window_at_pointer (GdkDisplay *display,
gint *win_x,
gint *win_y)
{
gint tmp_x, tmp_y;
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
return display->pointer_hooks->window_at_pointer (display, &tmp_x, &tmp_y);
if (win_x)
*win_x = tmp_x;
if (win_y)
*win_y = tmp_y;
}
/**
* gdk_display_set_pointer_hooks:
* @new_hooks: a table of pointers to functions for getting
* quantities related to the current pointer position,
* or %NULL to restore the default table.
*
* This function allows for hooking into the operation
* of getting the current location of the pointer on a particular
* display. This is only useful for such low-level tools as an
* event recorder. Applications should never have any
* reason to use this facility.
*
* Return value: the previous pointer hook table
**/
GdkDisplayPointerHooks *
gdk_display_set_pointer_hooks (GdkDisplay *display,
const GdkDisplayPointerHooks *new_hooks)
{
const GdkDisplayPointerHooks *result;
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
result = display->pointer_hooks;
if (new_hooks)
display->pointer_hooks = new_hooks;
else
display->pointer_hooks = &default_pointer_hooks;
return (GdkDisplayPointerHooks *)result;
}
void
singlehead_get_pointer (GdkDisplay *display,
GdkScreen **screen,
gint *x,
gint *y,
GdkModifierType *mask)
{
GdkScreen *default_screen = gdk_display_get_default_screen (display);
GdkWindow *root_window = gdk_screen_get_root_window (default_screen);
*screen = default_screen;
singlehead_current_pointer_hooks->get_pointer (root_window, x, y, mask);
}
GdkWindow*
singlehead_window_get_pointer (GdkDisplay *display,
GdkWindow *window,
gint *x,
gint *y,
GdkModifierType *mask)
{
return singlehead_current_pointer_hooks->get_pointer (window, x, y, mask);
}
GdkWindow*
singlehead_window_at_pointer (GdkDisplay *display,
gint *win_x,
gint *win_y)
{
GdkScreen *default_screen = gdk_display_get_default_screen (display);
return singlehead_current_pointer_hooks->window_at_pointer (default_screen,
win_x, win_y);
}
GdkWindow*
singlehead_default_window_get_pointer (GdkWindow *window,
gint *x,
gint *y,
GdkModifierType *mask)
{
return _gdk_windowing_window_get_pointer (gdk_drawable_get_display (window),
window, x, y, mask);
}
GdkWindow*
singlehead_default_window_at_pointer (GdkScreen *screen,
gint *win_x,
gint *win_y)
{
return _gdk_windowing_window_at_pointer (gdk_screen_get_display (screen),
win_x, win_y);
}
/**
* gdk_set_pointer_hooks:
* @new_hooks: a table of pointers to functions for getting
* quantities related to the current pointer position,
* or %NULL to restore the default table.
*
* This function allows for hooking into the operation
* of getting the current location of the pointer. This
* is only useful for such low-level tools as an
* event recorder. Applications should never have any
* reason to use this facility.
*
* This function is not multihead safe. For multihead operation,
* see gdk_display_set_pointer_hooks().
*
* Return value: the previous pointer hook table
**/
GdkPointerHooks *
gdk_set_pointer_hooks (const GdkPointerHooks *new_hooks)
{
const GdkPointerHooks *result = singlehead_current_pointer_hooks;
if (new_hooks)
singlehead_current_pointer_hooks = new_hooks;
else
singlehead_current_pointer_hooks = &singlehead_default_pointer_hooks;
gdk_display_set_pointer_hooks (gdk_display_get_default (),
&singlehead_pointer_hooks);
return (GdkPointerHooks *)result;
}
......@@ -31,6 +31,7 @@
G_BEGIN_DECLS
typedef struct _GdkDisplayClass GdkDisplayClass;
typedef struct _GdkDisplayPointerHooks GdkDisplayPointerHooks;
#define GDK_TYPE_DISPLAY (gdk_display_get_type ())
#define GDK_DISPLAY_OBJECT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DISPLAY, GdkDisplay))
......@@ -58,6 +59,8 @@ struct _GdkDisplay
guint double_click_time; /* Maximum time between clicks in msecs */
GdkDevice *core_pointer; /* Core pointer device */
const GdkDisplayPointerHooks *pointer_hooks; /* Current hooks for querying pointer */
guint closed : 1; /* Whether this display has been closed */
};
......@@ -77,6 +80,23 @@ struct _GdkDisplayClass
gboolean is_error);
};
struct _GdkDisplayPointerHooks
{
void (*get_pointer) (GdkDisplay *display,
GdkScreen **screen,
gint *x,
gint *y,
GdkModifierType *mask);
GdkWindow* (*window_get_pointer) (GdkDisplay *display,
GdkWindow *window,
gint *x,
gint *y,
GdkModifierType *mask);
GdkWindow* (*window_at_pointer) (GdkDisplay *display,
gint *win_x,
gint *win_y);
};
GType gdk_display_get_type (void);
GdkDisplay *gdk_display_open (const gchar *display_name);
......@@ -114,6 +134,18 @@ GdkDisplay *gdk_display_get_default (void);
GdkDevice *gdk_display_get_core_pointer (GdkDisplay *display);
void gdk_display_get_pointer (GdkDisplay *display,
GdkScreen **screen,
gint *x,
gint *y,
GdkModifierType *mask);
GdkWindow * gdk_display_get_window_at_pointer (GdkDisplay *display,
gint *win_x,
gint *win_y);
GdkDisplayPointerHooks *gdk_display_set_pointer_hooks (GdkDisplay *display,
const GdkDisplayPointerHooks *new_hooks);
G_END_DECLS
#endif /* __GDK_DISPLAY_H__ */
......@@ -167,8 +167,6 @@ extern GDestroyNotify _gdk_event_notify;
extern GSList *_gdk_displays;
extern gchar *_gdk_display_name;
extern const GdkPointerHooks *_gdk_current_pointer_hooks;
void _gdk_events_queue (GdkDisplay *display);
GdkEvent* _gdk_event_unqueue (GdkDisplay *display);
......@@ -252,13 +250,19 @@ void _gdk_windowing_window_clear_area_e (GdkWindow *window,
gint width,
gint height);
GdkWindow* _gdk_windowing_window_at_pointer (GdkScreen *screen,
gint *win_x,
gint *win_y);
GdkWindow* _gdk_windowing_window_get_pointer (GdkWindow *window,
gint *x,
gint *y,
GdkModifierType *mask);
void _gdk_windowing_get_pointer (GdkDisplay *display,
GdkScreen **screen,
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);
/* Return the number of bits-per-pixel for images of the specified depth. */
gint _gdk_windowing_get_bits_for_depth (GdkDisplay *display,
......
......@@ -221,24 +221,3 @@ gdk_screen_height_mm (void)
{
return gdk_screen_get_height_mm (gdk_screen_get_default ());
}
/**
* gdk_screen_get_window_at_pointer:
* @screen: a #GdkScreen
* @win_x: return location for origin of the window under the pointer
* @win_y: return location for origin of the window under the pointer
*
* Obtains the window underneath the mouse pointer, returning the location
* of that window in @win_x, @win_y for @screen. Returns %NULL if the window
* under the mouse pointer is not known to GDK (for example, belongs to
* another application).
*
* Returns: the window under the mouse pointer, or %NULL
**/
GdkWindow *
gdk_screen_get_window_at_pointer (GdkScreen *screen,
gint *win_x,
gint *win_y)
{
return _gdk_current_pointer_hooks->window_at_pointer (screen, win_x, win_y);
}
......@@ -64,9 +64,6 @@ GdkVisual * gdk_screen_get_rgb_visual (GdkScreen *screen);
GdkWindow * gdk_screen_get_root_window (GdkScreen *screen);
GdkDisplay * gdk_screen_get_display (GdkScreen *screen);
gint gdk_screen_get_number (GdkScreen *screen);
GdkWindow * gdk_screen_get_window_at_pointer (GdkScreen *screen,
gint *win_x,
gint *win_y);
gint gdk_screen_get_width (GdkScreen *screen);
gint gdk_screen_get_height (GdkScreen *screen);
gint gdk_screen_get_width_mm (GdkScreen *screen);
......
......@@ -44,13 +44,6 @@ struct _GdkWindowPaint
gint y_offset;
};
static const GdkPointerHooks default_pointer_hooks = {
_gdk_windowing_window_get_pointer,
_gdk_windowing_window_at_pointer
};
const GdkPointerHooks *_gdk_current_pointer_hooks = &default_pointer_hooks;
static GdkGC *gdk_window_create_gc (GdkDrawable *drawable,
GdkGCValues *values,
GdkGCValuesMask mask);
......@@ -2698,33 +2691,6 @@ gdk_window_constrain_size (GdkGeometry *geometry,
*new_height = height;
}
/**
* gdk_set_pointer_hooks:
* @new_hooks: a table of pointers to functions for getting
* quantities related to the current pointer position,
* or %NULL to restore the default table.
*
* This function allows for hooking into the operation
* of getting the current location of the pointer. This
* is only useful for such low-level tools as an
* event recorder. Applications should never have any
* reason to use this facility
*
* Return value: the previous pointer hook table
**/
GdkPointerHooks *
gdk_set_pointer_hooks (const GdkPointerHooks *new_hooks)
{
const GdkPointerHooks *result = _gdk_current_pointer_hooks;
if (new_hooks)
_gdk_current_pointer_hooks = new_hooks;
else
_gdk_current_pointer_hooks = &default_pointer_hooks;
return (GdkPointerHooks *)result;
}
/**
* gdk_window_get_pointer:
* @window: a #GdkWindow
......@@ -2743,11 +2709,41 @@ GdkWindow*
gdk_window_get_pointer (GdkWindow *window,
gint *x,
gint *y,
GdkModifierType *mask)
GdkModifierType *mask)
{
g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
GdkDisplay *display;
gint tmp_x, tmp_y;
GdkModifierType tmp_mask;
GdkWindow *child;
return _gdk_current_pointer_hooks->get_pointer (window, x, y, mask);
g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
if (window)
{
display = gdk_drawable_get_display (window);
}
else
{
GdkScreen *screen = gdk_screen_get_default ();
display = gdk_screen_get_display (screen);
window = gdk_screen_get_root_window (screen);
GDK_NOTE (MULTIHEAD,
g_message ("Passing NULL for window to gdk_window_get_pointer()\n"
"is not multihead safe"));
}
child = display->pointer_hooks->window_get_pointer (display, window, &tmp_x, &tmp_y, &tmp_mask);
if (x)
*x = tmp_x;
if (y)
*y = tmp_y;
if (mask)
*mask = tmp_mask;
return child;
}
/**
......@@ -2762,7 +2758,7 @@ gdk_window_get_pointer (GdkWindow *window,
* for it with gdk_window_foreign_new())
*
* NOTE: For multihead-aware widgets or applications use
* gdk_screen_get_window_at_pointer() instead.
* gdk_display_get_window_at_pointer() instead.
*
* Return value: window under the mouse pointer
**/
......@@ -2770,7 +2766,7 @@ GdkWindow*
gdk_window_at_pointer (gint *win_x,
gint *win_y)
{
return gdk_screen_get_window_at_pointer (gdk_screen_get_default (), win_x, win_y);
return gdk_display_get_window_at_pointer (gdk_display_get_default (), win_x, win_y);
}
/**
......
......@@ -207,7 +207,7 @@ struct _GdkPointerHooks