Commit 191e83b3 authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

Add gdk_set_pointer_hooks() to allow pointer-querying to be hooked by an

Mon Jul  2 01:09:37 2001  Owen Taylor  <otaylor@redhat.com>

 	* gdk/gdkwindow.[ch] gdk/gdkinternals.h gdk/x11/gdkwindow-x11.c
 	gdk/linux-fb/gdkwindow-fb.c gdk/x11/gdkwindow-x11.c gdk/gdk:
 	Add gdk_set_pointer_hooks() to allow pointer-querying to
 	be hooked by an event record/playback system like GERD.
	(#56914)
parent bf7258ea
Mon Jul 2 01:09:37 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.[ch] gdk/gdkinternals.h gdk/x11/gdkwindow-x11.c
gdk/linux-fb/gdkwindow-fb.c gdk/x11/gdkwindow-x11.c gdk/gdk:
Add gdk_set_pointer_hooks() to allow pointer-querying to
be hooked by an event record/playback system like GERD.
(#56914)
Thu Jul 5 08:57:07 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_reset_rc_style): Pass
......
Mon Jul 2 01:09:37 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.[ch] gdk/gdkinternals.h gdk/x11/gdkwindow-x11.c
gdk/linux-fb/gdkwindow-fb.c gdk/x11/gdkwindow-x11.c gdk/gdk:
Add gdk_set_pointer_hooks() to allow pointer-querying to
be hooked by an event record/playback system like GERD.
(#56914)
Thu Jul 5 08:57:07 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_reset_rc_style): Pass
......
Mon Jul 2 01:09:37 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.[ch] gdk/gdkinternals.h gdk/x11/gdkwindow-x11.c
gdk/linux-fb/gdkwindow-fb.c gdk/x11/gdkwindow-x11.c gdk/gdk:
Add gdk_set_pointer_hooks() to allow pointer-querying to
be hooked by an event record/playback system like GERD.
(#56914)
Thu Jul 5 08:57:07 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_reset_rc_style): Pass
......
Mon Jul 2 01:09:37 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.[ch] gdk/gdkinternals.h gdk/x11/gdkwindow-x11.c
gdk/linux-fb/gdkwindow-fb.c gdk/x11/gdkwindow-x11.c gdk/gdk:
Add gdk_set_pointer_hooks() to allow pointer-querying to
be hooked by an event record/playback system like GERD.
(#56914)
Thu Jul 5 08:57:07 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_reset_rc_style): Pass
......
Mon Jul 2 01:09:37 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.[ch] gdk/gdkinternals.h gdk/x11/gdkwindow-x11.c
gdk/linux-fb/gdkwindow-fb.c gdk/x11/gdkwindow-x11.c gdk/gdk:
Add gdk_set_pointer_hooks() to allow pointer-querying to
be hooked by an event record/playback system like GERD.
(#56914)
Thu Jul 5 08:57:07 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_reset_rc_style): Pass
......
Mon Jul 2 01:09:37 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.[ch] gdk/gdkinternals.h gdk/x11/gdkwindow-x11.c
gdk/linux-fb/gdkwindow-fb.c gdk/x11/gdkwindow-x11.c gdk/gdk:
Add gdk_set_pointer_hooks() to allow pointer-querying to
be hooked by an event record/playback system like GERD.
(#56914)
Thu Jul 5 08:57:07 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_reset_rc_style): Pass
......
Mon Jul 2 01:09:37 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.[ch] gdk/gdkinternals.h gdk/x11/gdkwindow-x11.c
gdk/linux-fb/gdkwindow-fb.c gdk/x11/gdkwindow-x11.c gdk/gdk:
Add gdk_set_pointer_hooks() to allow pointer-querying to
be hooked by an event record/playback system like GERD.
(#56914)
Thu Jul 5 08:57:07 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_reset_rc_style): Pass
......
......@@ -159,6 +159,13 @@ void _gdk_windowing_window_clear_area_e (GdkWindow *window,
gint width,
gint height);
GdkWindow* _gdk_windowing_window_at_pointer (gint *win_x,
gint *win_y);
GdkWindow* _gdk_windowing_window_get_pointer (GdkWindow *window,
gint *x,
gint *y,
GdkModifierType *mask);
#define GDK_WINDOW_IS_MAPPED(window) ((((GdkWindowObject*)window)->state & GDK_WINDOW_STATE_WITHDRAWN) == 0)
/* Called before processing updates for a window. This gives the windowing
......
......@@ -42,6 +42,14 @@ struct _GdkWindowPaint
gint x_offset;
gint y_offset;
};
static const GdkPointerHooks default_pointer_hooks = {
_gdk_windowing_window_get_pointer,
_gdk_windowing_window_at_pointer
};
const GdkPointerHooks *current_pointer_hooks = &default_pointer_hooks;
static GdkGC *gdk_window_create_gc (GdkDrawable *drawable,
GdkGCValues *values,
GdkGCValuesMask mask);
......@@ -2279,3 +2287,48 @@ gdk_window_constrain_size (GdkGeometry *geometry,
*new_width = width;
*new_height = height;
}
/**
* gdk_set_pointer_hooks:
* @new_hooks: a table of pointer 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 = current_pointer_hooks;
if (new_hooks)
current_pointer_hooks = new_hooks;
else
current_pointer_hooks = &default_pointer_hooks;
return (GdkPointerHooks *)result;
}
GdkWindow*
gdk_window_get_pointer (GdkWindow *window,
gint *x,
gint *y,
GdkModifierType *mask)
{
g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
return current_pointer_hooks->get_pointer (window, x, y, mask);
}
GdkWindow*
gdk_window_at_pointer (gint *win_x,
gint *win_y)
{
return current_pointer_hooks->window_at_pointer (win_x, win_y);
}
......@@ -12,6 +12,7 @@ extern "C" {
typedef struct _GdkGeometry GdkGeometry;
typedef struct _GdkWindowAttr GdkWindowAttr;
typedef struct _GdkPointerHooks GdkPointerHooks;
/* Classes of windows.
* InputOutput: Almost every window should be of this type. Such windows
......@@ -195,6 +196,16 @@ struct _GdkGeometry
GdkGravity win_gravity;
};
struct _GdkPointerHooks
{
GdkWindow* (*get_pointer) (GdkWindow *window,
gint *x,
gint *y,
GdkModifierType *mask);
GdkWindow* (*window_at_pointer) (gint *win_x,
gint *win_y);
};
typedef struct _GdkWindowObject GdkWindowObject;
typedef struct _GdkWindowObjectClass GdkWindowObjectClass;
......@@ -496,6 +507,8 @@ void gdk_window_constrain_size (GdkGeometry *geometry,
gint *new_width,
gint *new_height);
GdkPointerHooks *gdk_set_pointer_hooks (const GdkPointerHooks *new_hooks);
#ifdef __cplusplus
}
#endif /* __cplusplus */
......
......@@ -1602,10 +1602,10 @@ gdk_window_fb_get_visible_region (GdkDrawable *drawable)
}
GdkWindow *
gdk_window_get_pointer (GdkWindow *window,
gint *x,
gint *y,
GdkModifierType *mask)
_gdk_windowing_window_get_pointer (GdkWindow *window,
gint *x,
gint *y,
GdkModifierType *mask)
{
GdkWindow *return_val;
int winx = 0;
......@@ -1686,8 +1686,8 @@ gdk_window_get_pointer (GdkWindow *window,
}
GdkWindow*
gdk_window_at_pointer (gint *win_x,
gint *win_y)
_gdk_windowing_window_at_pointer (gint *win_x,
gint *win_y)
{
gint rx, ry;
GdkWindow *retval = gdk_window_get_pointer (NULL, win_x, win_y, NULL);
......
......@@ -1739,10 +1739,10 @@ gdk_window_get_frame_extents (GdkWindow *window,
}
GdkWindow*
gdk_window_get_pointer (GdkWindow *window,
gint *x,
gint *y,
GdkModifierType *mask)
_gdk_windowing_window_get_pointer (GdkWindow *window,
gint *x,
gint *y,
GdkModifierType *mask)
{
GdkWindow *return_val;
POINT pointc, point;
......@@ -1801,8 +1801,8 @@ gdk_window_get_pointer (GdkWindow *window,
}
GdkWindow*
gdk_window_at_pointer (gint *win_x,
gint *win_y)
_gdk_windowing_window_at_pointer (gint *win_x,
gint *win_y)
{
GdkWindow *window;
POINT point, pointc;
......@@ -2505,4 +2505,4 @@ gdk_window_begin_move_drag (GdkWindow *window,
return;
/* XXX: isn't all this default on win32 ... */
}
\ No newline at end of file
}
......@@ -1976,10 +1976,10 @@ gdk_window_get_frame_extents (GdkWindow *window,
}
GdkWindow*
gdk_window_get_pointer (GdkWindow *window,
gint *x,
gint *y,
GdkModifierType *mask)
_gdk_windowing_window_get_pointer (GdkWindow *window,
gint *x,
gint *y,
GdkModifierType *mask)
{
GdkWindow *return_val;
Window root;
......@@ -2018,8 +2018,8 @@ gdk_window_get_pointer (GdkWindow *window,
}
GdkWindow*
gdk_window_at_pointer (gint *win_x,
gint *win_y)
_gdk_windowing_window_at_pointer (gint *win_x,
gint *win_y)
{
GdkWindow *window;
Window root;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment