Patch from George Liebl to add a GdkGrabStatus enumeration to use as a

Thu Jul  6 11:54:03 2000  Owen Taylor  <otaylor@redhat.com>

	* gdk/gdk.h gdk/gdktypes.h gdk/linux-fb/gdkmain-fb.c
	gdk/nanox/gdkmain-nanox.c gdk/win32/gdkevents-win32.c
	gdk/win32/gdkinput-win32.c gdk/win32/gdkwin32.h
	gdk/x11/gdkmain-x11.c:

	Patch from George Liebl to add a GdkGrabStatus enumeration to use
	as a return value of gdk_*_grab(). Previously, we just
	returned the X11 values directly.
This commit is contained in:
Owen Taylor 2000-07-06 16:20:45 +00:00 committed by Owen Taylor
parent f60e216527
commit 0611f06b5a
16 changed files with 156 additions and 51 deletions

View File

@ -1,3 +1,14 @@
Thu Jul 6 11:54:03 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.h gdk/gdktypes.h gdk/linux-fb/gdkmain-fb.c
gdk/nanox/gdkmain-nanox.c gdk/win32/gdkevents-win32.c
gdk/win32/gdkinput-win32.c gdk/win32/gdkwin32.h
gdk/x11/gdkmain-x11.c:
Patch from George Liebl to add a GdkGrabStatus enumeration to use
as a return value of gdk_*_grab(). Previously, we just
returned the X11 values directly.
Thu Jul 6 11:27:44 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/Makefile.am: Patch from George Liebl to

View File

@ -1,3 +1,14 @@
Thu Jul 6 11:54:03 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.h gdk/gdktypes.h gdk/linux-fb/gdkmain-fb.c
gdk/nanox/gdkmain-nanox.c gdk/win32/gdkevents-win32.c
gdk/win32/gdkinput-win32.c gdk/win32/gdkwin32.h
gdk/x11/gdkmain-x11.c:
Patch from George Liebl to add a GdkGrabStatus enumeration to use
as a return value of gdk_*_grab(). Previously, we just
returned the X11 values directly.
Thu Jul 6 11:27:44 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/Makefile.am: Patch from George Liebl to

View File

@ -1,3 +1,14 @@
Thu Jul 6 11:54:03 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.h gdk/gdktypes.h gdk/linux-fb/gdkmain-fb.c
gdk/nanox/gdkmain-nanox.c gdk/win32/gdkevents-win32.c
gdk/win32/gdkinput-win32.c gdk/win32/gdkwin32.h
gdk/x11/gdkmain-x11.c:
Patch from George Liebl to add a GdkGrabStatus enumeration to use
as a return value of gdk_*_grab(). Previously, we just
returned the X11 values directly.
Thu Jul 6 11:27:44 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/Makefile.am: Patch from George Liebl to

View File

@ -1,3 +1,14 @@
Thu Jul 6 11:54:03 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.h gdk/gdktypes.h gdk/linux-fb/gdkmain-fb.c
gdk/nanox/gdkmain-nanox.c gdk/win32/gdkevents-win32.c
gdk/win32/gdkinput-win32.c gdk/win32/gdkwin32.h
gdk/x11/gdkmain-x11.c:
Patch from George Liebl to add a GdkGrabStatus enumeration to use
as a return value of gdk_*_grab(). Previously, we just
returned the X11 values directly.
Thu Jul 6 11:27:44 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/Makefile.am: Patch from George Liebl to

View File

@ -1,3 +1,14 @@
Thu Jul 6 11:54:03 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.h gdk/gdktypes.h gdk/linux-fb/gdkmain-fb.c
gdk/nanox/gdkmain-nanox.c gdk/win32/gdkevents-win32.c
gdk/win32/gdkinput-win32.c gdk/win32/gdkwin32.h
gdk/x11/gdkmain-x11.c:
Patch from George Liebl to add a GdkGrabStatus enumeration to use
as a return value of gdk_*_grab(). Previously, we just
returned the X11 values directly.
Thu Jul 6 11:27:44 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/Makefile.am: Patch from George Liebl to

View File

@ -1,3 +1,14 @@
Thu Jul 6 11:54:03 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.h gdk/gdktypes.h gdk/linux-fb/gdkmain-fb.c
gdk/nanox/gdkmain-nanox.c gdk/win32/gdkevents-win32.c
gdk/win32/gdkinput-win32.c gdk/win32/gdkwin32.h
gdk/x11/gdkmain-x11.c:
Patch from George Liebl to add a GdkGrabStatus enumeration to use
as a return value of gdk_*_grab(). Previously, we just
returned the X11 values directly.
Thu Jul 6 11:27:44 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/Makefile.am: Patch from George Liebl to

View File

@ -1,3 +1,14 @@
Thu Jul 6 11:54:03 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.h gdk/gdktypes.h gdk/linux-fb/gdkmain-fb.c
gdk/nanox/gdkmain-nanox.c gdk/win32/gdkevents-win32.c
gdk/win32/gdkinput-win32.c gdk/win32/gdkwin32.h
gdk/x11/gdkmain-x11.c:
Patch from George Liebl to add a GdkGrabStatus enumeration to use
as a return value of gdk_*_grab(). Previously, we just
returned the X11 values directly.
Thu Jul 6 11:27:44 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/Makefile.am: Patch from George Liebl to

View File

@ -88,18 +88,18 @@ gint gdk_input_add (gint source,
gpointer data);
void gdk_input_remove (gint tag);
gint gdk_pointer_grab (GdkWindow *window,
gboolean owner_events,
GdkEventMask event_mask,
GdkWindow *confine_to,
GdkCursor *cursor,
guint32 time);
void gdk_pointer_ungrab (guint32 time);
gint gdk_keyboard_grab (GdkWindow *window,
gboolean owner_events,
guint32 time);
void gdk_keyboard_ungrab (guint32 time);
gboolean gdk_pointer_is_grabbed (void);
GdkGrabStatus gdk_pointer_grab (GdkWindow *window,
gboolean owner_events,
GdkEventMask event_mask,
GdkWindow *confine_to,
GdkCursor *cursor,
guint32 time);
void gdk_pointer_ungrab (guint32 time);
GdkGrabStatus gdk_keyboard_grab (GdkWindow *window,
gboolean owner_events,
guint32 time);
void gdk_keyboard_ungrab (guint32 time);
gboolean gdk_pointer_is_grabbed (void);
gint gdk_screen_width (void);
gint gdk_screen_height (void);

View File

@ -145,6 +145,19 @@ typedef enum
GDK_ERROR_MEM = -4
} GdkStatus;
/* We define specific numeric values for these constants,
* since old application code may depend on them matching the X values
* We don't actually depend on the matchup ourselves.
*/
typedef enum
{
GDK_GRAB_SUCCESS = 0,
GDK_GRAB_ALREADY_GRABBED = 1,
GDK_GRAB_INVALID_TIME = 2,
GDK_GRAB_NOT_VIEWABLE = 3,
GDK_GRAB_FROZEN = 4
} GdkGrabStatus;
typedef void (*GdkInputFunction) (gpointer data,
gint source,
GdkInputCondition condition);

View File

@ -155,7 +155,7 @@ _gdk_windowing_init_check (int argc, char **argv)
*--------------------------------------------------------------
*/
gint
GdkGrabStatus
gdk_pointer_grab (GdkWindow * window,
gint owner_events,
GdkEventMask event_mask,
@ -183,7 +183,7 @@ gdk_pointer_grab (GdkWindow * window,
if(cursor)
gdk_fb_cursor_unhide();
return 0;
return GDK_GRAB_SUCCESS;
}
/*
@ -266,7 +266,7 @@ gdk_pointer_is_grabbed (void)
*--------------------------------------------------------------
*/
gint
GdkGrabStatus
gdk_keyboard_grab (GdkWindow * window,
gint owner_events,
guint32 time)
@ -280,7 +280,7 @@ gdk_keyboard_grab (GdkWindow * window,
if(!owner_events)
_gdk_fb_keyboard_grab_window = gdk_window_ref(window);
return 0;
return GDK_GRAB_SUCCESS;
}
/*

View File

@ -42,7 +42,7 @@ gdk_get_use_xshm (void)
return gdk_use_xshm;
}
gint
GdkGrabStatus
gdk_pointer_grab (GdkWindow * window,
gboolean owner_events,
GdkEventMask event_mask,
@ -68,7 +68,7 @@ gdk_pointer_is_grabbed (void)
return gdk_xgrab_window != NULL;
}
gint
GdkGrabStatus
gdk_keyboard_grab (GdkWindow * window,
gboolean owner_events,
guint32 time)

View File

@ -472,7 +472,7 @@ event_mask_string (GdkEventMask mask)
*--------------------------------------------------------------
*/
gint
GdkGrabStatus
gdk_pointer_grab (GdkWindow * window,
gboolean owner_events,
GdkEventMask event_mask,
@ -511,9 +511,9 @@ gdk_pointer_grab (GdkWindow * window,
confine_to,
time);
else
return_val = Success;
return_val = GDK_GRAB_SUCCESS;
if (return_val == Success)
if (return_val == GDK_GRAB_SUCCESS)
{
if (!GDK_DRAWABLE_DESTROYED (window))
{
@ -531,13 +531,13 @@ gdk_pointer_grab (GdkWindow * window,
*/
SetCapture (xwindow);
#endif
return_val = GrabSuccess;
return_val = GDK_GRAB_SUCCESS;
}
else
return_val = AlreadyGrabbed;
return_val = GDK_GRAB_ALREADY_GRABBED;
}
if (return_val == GrabSuccess)
if (return_val == GDK_GRAB_SUCCESS)
{
p_grab_window = window;
p_grab_cursor = xcursor;
@ -616,7 +616,7 @@ gdk_pointer_is_grabbed (void)
*--------------------------------------------------------------
*/
gint
GdkGrabStatus
gdk_keyboard_grab (GdkWindow * window,
gboolean owner_events,
guint32 time)
@ -632,12 +632,12 @@ gdk_keyboard_grab (GdkWindow * window,
if (!GDK_DRAWABLE_DESTROYED (window))
{
k_grab_owner_events = owner_events != 0;
return_val = GrabSuccess;
return_val = GDK_GRAB_SUCCESS;
}
else
return_val = AlreadyGrabbed;
return_val = GDK_GRAB_ALREADY_GRABBED;
if (return_val == GrabSuccess)
if (return_val == GDK_GRAB_SUCCESS)
k_grab_window = window;
return return_val;

View File

@ -1326,7 +1326,7 @@ gdk_input_win32_grab_pointer (GdkWindow *window,
/* FIXME: if failure occurs on something other than the first
device, things will be badly inconsistent */
if (result != Success)
if (result != GDK_GRAB_SUCCESS)
return result;
#endif
}
@ -1353,7 +1353,7 @@ gdk_input_win32_grab_pointer (GdkWindow *window,
}
}
return Success;
return GDK_GRAB_SUCCESS;
}

View File

@ -152,15 +152,6 @@
/* Define corresponding Windows types for some X11 types, just for laziness. */
typedef PALETTEENTRY XColor;
/* Define some of the X11 constants also here, again just for laziness */
/* Error codes */
#define Success 0
/* Grabbing status */
#define GrabSuccess 0
#define AlreadyGrabbed 2
/* Some structs are somewhat useful to emulate internally, just to
* keep the code less #ifdefed.
*/

View File

@ -314,7 +314,7 @@ _gdk_input_grab_pointer (GdkWindow * window,
void
_gdk_input_ungrab_pointer (guint32 time)
{
GdkInputWindow *input_window;
GdkInputWindow *input_window = NULL; /* Quiet GCC */
GdkDevicePrivate *gdkdev;
GList *tmp_list;

View File

@ -202,6 +202,26 @@ gdk_get_use_xshm (void)
return gdk_use_xshm;
}
static GdkGrabStatus
gdk_x11_convert_grab_status (gint status)
{
switch (status)
{
case GrabSuccess:
return GDK_GRAB_SUCCESS;
case AlreadyGrabbed:
return GDK_GRAB_ALREADY_GRABBED;
case GrabInvalidTime:
return GDK_GRAB_INVALID_TIME;
case GrabNotViewable:
return GDK_GRAB_NOT_VIEWABLE;
case GrabFrozen:
return GDK_GRAB_FROZEN;
}
g_assert_not_reached();
}
/*
*--------------------------------------------------------------
* gdk_pointer_grab
@ -225,7 +245,7 @@ gdk_get_use_xshm (void)
*--------------------------------------------------------------
*/
gint
GdkGrabStatus
gdk_pointer_grab (GdkWindow * window,
gboolean owner_events,
GdkEventMask event_mask,
@ -273,7 +293,7 @@ gdk_pointer_grab (GdkWindow * window,
confine_to,
time);
if (return_val == Success)
if (return_val == GrabSuccess)
{
if (!GDK_WINDOW_DESTROYED (window))
return_val = XGrabPointer (GDK_WINDOW_XDISPLAY (window),
@ -290,8 +310,8 @@ gdk_pointer_grab (GdkWindow * window,
if (return_val == GrabSuccess)
gdk_xgrab_window = (GdkWindowObject *)window;
return return_val;
return gdk_x11_convert_grab_status (return_val);
}
/*
@ -359,22 +379,26 @@ gdk_pointer_is_grabbed (void)
*--------------------------------------------------------------
*/
gint
GdkGrabStatus
gdk_keyboard_grab (GdkWindow * window,
gboolean owner_events,
guint32 time)
{
gint return_val;
g_return_val_if_fail (window != NULL, 0);
g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
if (!GDK_WINDOW_DESTROYED (window))
return XGrabKeyboard (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
owner_events,
GrabModeAsync, GrabModeAsync,
time);
return_val = XGrabKeyboard (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
owner_events,
GrabModeAsync, GrabModeAsync,
time);
else
return AlreadyGrabbed;
return_val = AlreadyGrabbed;
return gdk_x11_convert_grab_status (return_val);
}
/*