1997-11-24 22:37:52 +00:00
|
|
|
/* GDK - The GIMP Drawing Kit
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
2000-07-26 11:33:08 +00:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
1997-11-24 22:37:52 +00:00
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2000-07-26 11:33:08 +00:00
|
|
|
* Lesser General Public License for more details.
|
1997-11-24 22:37:52 +00:00
|
|
|
*
|
2000-07-26 11:33:08 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
1998-04-13 02:02:47 +00:00
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
1997-11-24 22:37:52 +00:00
|
|
|
*/
|
|
|
|
|
2004-03-06 03:38:59 +00:00
|
|
|
#include <config.h>
|
1999-11-08 20:14:59 +00:00
|
|
|
#include "gdkinputprivate.h"
|
2002-04-25 22:29:14 +00:00
|
|
|
#include "gdkdisplay-x11.h"
|
2005-03-16 03:17:27 +00:00
|
|
|
#include "gdkalias.h"
|
1999-11-08 20:14:59 +00:00
|
|
|
|
1999-02-24 07:37:18 +00:00
|
|
|
/*
|
2000-07-26 11:33:08 +00:00
|
|
|
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
1999-02-24 07:37:18 +00:00
|
|
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
|
|
* files for a list of changes. These files are distributed with
|
|
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
|
|
|
*/
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/* forward declarations */
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
static void gdk_input_check_proximity (GdkDisplay *display);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
void
|
2002-04-25 22:29:14 +00:00
|
|
|
_gdk_input_init(GdkDisplay *display)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
Start implementing display/screen closing scheme; keep a flag for whether
Thu Aug 1 11:26:03 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdisplay.[ch] gdk/gdkscreen.[ch] gdkinternals.h:
Start implementing display/screen closing scheme; keep a
flag for whether displays and screens are closed,
call g_object_run_dispose(). Remove public gdk_screen_close().
* gdk/x11/gdkdisplay-x11.c gdk/x11/gdkscreen-x11.c: Add
dispose() methods; move appropriate parts of the finalize
there.
* gdk/x11/gdkcolor-x11.c gdk/x11/gdkimage-x11.c
gdk/x11/gdkmain-x11.c gdk/x11/gdkpango-x11.c
gdk/x11/gdkpixmap-x11.c gdk/x11/gdkproperty-x11.c
gdk/x11/gdkselection-x11.c gdk/x11/gdkwindow-x11.c:
Start of making everything correctly ignore operations
when a display has been closed.
* gdk/x11/gdkwindow-x11.c (gdk_window_get_decorations):
Handle decorations == NULL.
* gdk/x11/gdkcolor-x11.c (gdk_colormap_remove):
Remove unnecessary hash table creation.
* gdk/x11/gdkinput.c gdk/x11/gdkinput-x11.c gdk/win32/gdkinput.c
Fix up gdk_device_get_history - handle events, n_events == NULL,
etc.
* gdk/x11/gdkproperty-x11.c (gdk_property_get):
Handle failure better.
* gdk/x11/gdkselection-x11.c (gdk_selection_property_get):
Handle failure better, handle data == NULL, move docs
here, remove an excess round trip by asking for
all selection data at once.
* gdk/gdkselection.c gdk/win32/{x11,win32}/gdkselection-{x11,win32}.c
gdk/{x11,win32}/gdkmain-{x11,win32}.c gdk/gdkdisplay.c: Move
gdk_text_property_to_text_list(), gdk_string_to_compound_text(),
gdk_display_set_sm_client_id() to display-independent part of GDK.
* gdk/Makefile.am (gdk_c_sources): Sort gdkdisplay/screen.[ch]
into the right place.
2002-08-01 15:28:40 +00:00
|
|
|
_gdk_init_input_core (display);
|
2002-04-25 22:29:14 +00:00
|
|
|
GDK_DISPLAY_X11 (display)->input_ignore_core = FALSE;
|
2002-08-02 20:22:49 +00:00
|
|
|
_gdk_input_common_init (display, FALSE);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
2000-07-03 19:00:23 +00:00
|
|
|
gboolean
|
|
|
|
gdk_device_set_mode (GdkDevice *device,
|
|
|
|
GdkInputMode mode)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
GList *tmp_list;
|
|
|
|
GdkDevicePrivate *gdkdev;
|
|
|
|
GdkInputMode old_mode;
|
|
|
|
GdkInputWindow *input_window;
|
2002-04-25 22:29:14 +00:00
|
|
|
GdkDisplayX11 *display_impl;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-07-03 19:00:23 +00:00
|
|
|
if (GDK_IS_CORE (device))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
gdkdev = (GdkDevicePrivate *)device;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-07-03 19:00:23 +00:00
|
|
|
if (device->mode == mode)
|
1997-11-24 22:37:52 +00:00
|
|
|
return TRUE;
|
|
|
|
|
2000-07-03 19:00:23 +00:00
|
|
|
old_mode = device->mode;
|
|
|
|
device->mode = mode;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
display_impl = GDK_DISPLAY_X11 (gdkdev->display);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (mode == GDK_MODE_WINDOW)
|
|
|
|
{
|
2000-07-03 19:00:23 +00:00
|
|
|
device->has_cursor = FALSE;
|
2002-04-25 22:29:14 +00:00
|
|
|
for (tmp_list = display_impl->input_windows; tmp_list; tmp_list = tmp_list->next)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
input_window = (GdkInputWindow *)tmp_list->data;
|
|
|
|
if (input_window->mode != GDK_EXTENSION_EVENTS_CURSOR)
|
2000-07-03 19:00:23 +00:00
|
|
|
_gdk_input_enable_window (input_window->window, gdkdev);
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
|
|
|
if (old_mode != GDK_MODE_DISABLED)
|
2000-07-03 19:00:23 +00:00
|
|
|
_gdk_input_disable_window (input_window->window, gdkdev);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (mode == GDK_MODE_SCREEN)
|
|
|
|
{
|
2000-07-03 19:00:23 +00:00
|
|
|
device->has_cursor = TRUE;
|
2002-04-25 22:29:14 +00:00
|
|
|
for (tmp_list = display_impl->input_windows; tmp_list; tmp_list = tmp_list->next)
|
2000-07-03 19:00:23 +00:00
|
|
|
_gdk_input_enable_window (((GdkInputWindow *)tmp_list->data)->window,
|
|
|
|
gdkdev);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
else /* mode == GDK_MODE_DISABLED */
|
|
|
|
{
|
2002-04-25 22:29:14 +00:00
|
|
|
for (tmp_list = display_impl->input_windows; tmp_list; tmp_list = tmp_list->next)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
input_window = (GdkInputWindow *)tmp_list->data;
|
|
|
|
if (old_mode != GDK_MODE_WINDOW ||
|
|
|
|
input_window->mode != GDK_EXTENSION_EVENTS_CURSOR)
|
2000-07-03 19:00:23 +00:00
|
|
|
_gdk_input_disable_window (input_window->window, gdkdev);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-04-25 22:29:14 +00:00
|
|
|
gdk_input_check_proximity (GdkDisplay *display)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
gint new_proximity = 0;
|
2002-04-25 22:29:14 +00:00
|
|
|
GdkDisplayX11 *display_impl = GDK_DISPLAY_X11 (display);
|
|
|
|
GList *tmp_list = display_impl->input_devices;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
while (tmp_list && !new_proximity)
|
|
|
|
{
|
|
|
|
GdkDevicePrivate *gdkdev = (GdkDevicePrivate *)(tmp_list->data);
|
|
|
|
|
|
|
|
if (gdkdev->info.mode != GDK_MODE_DISABLED
|
2000-07-03 19:00:23 +00:00
|
|
|
&& !GDK_IS_CORE (gdkdev)
|
1997-11-24 22:37:52 +00:00
|
|
|
&& gdkdev->xdevice)
|
|
|
|
{
|
2002-04-25 22:29:14 +00:00
|
|
|
XDeviceState *state = XQueryDeviceState(display_impl->xdisplay,
|
1997-11-24 22:37:52 +00:00
|
|
|
gdkdev->xdevice);
|
|
|
|
XInputClass *xic;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
xic = state->data;
|
|
|
|
for (i=0; i<state->num_classes; i++)
|
|
|
|
{
|
|
|
|
if (xic->class == ValuatorClass)
|
|
|
|
{
|
|
|
|
XValuatorState *xvs = (XValuatorState *)xic;
|
|
|
|
if ((xvs->mode & ProximityState) == InProximity)
|
|
|
|
{
|
|
|
|
new_proximity = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
xic = (XInputClass *)((char *)xic + xic->length);
|
|
|
|
}
|
1999-11-10 17:15:58 +00:00
|
|
|
|
|
|
|
XFreeDeviceState (state);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
tmp_list = tmp_list->next;
|
|
|
|
}
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
display_impl->input_ignore_core = new_proximity;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
2000-07-03 19:00:23 +00:00
|
|
|
void
|
|
|
|
_gdk_input_configure_event (XConfigureEvent *xevent,
|
|
|
|
GdkWindow *window)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
GdkInputWindow *input_window;
|
|
|
|
gint root_x, root_y;
|
|
|
|
|
2002-08-02 20:22:49 +00:00
|
|
|
input_window = _gdk_input_window_find(window);
|
2006-12-21 16:28:28 +00:00
|
|
|
g_return_if_fail (input_window != NULL);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2002-08-02 20:22:49 +00:00
|
|
|
_gdk_input_get_root_relative_geometry(GDK_WINDOW_XDISPLAY (window),
|
|
|
|
GDK_WINDOW_XWINDOW (window),
|
|
|
|
&root_x, &root_y, NULL, NULL);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
input_window->root_x = root_x;
|
|
|
|
input_window->root_y = root_y;
|
|
|
|
}
|
|
|
|
|
2000-07-03 19:00:23 +00:00
|
|
|
void
|
|
|
|
_gdk_input_enter_event (XCrossingEvent *xevent,
|
|
|
|
GdkWindow *window)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
GdkInputWindow *input_window;
|
|
|
|
gint root_x, root_y;
|
|
|
|
|
2002-08-02 20:22:49 +00:00
|
|
|
input_window = _gdk_input_window_find (window);
|
2006-12-21 16:28:28 +00:00
|
|
|
g_return_if_fail (input_window != NULL);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
gdk_input_check_proximity(GDK_WINDOW_DISPLAY (window));
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2002-08-02 20:22:49 +00:00
|
|
|
_gdk_input_get_root_relative_geometry(GDK_WINDOW_XDISPLAY (window),
|
|
|
|
GDK_WINDOW_XWINDOW(window),
|
|
|
|
&root_x, &root_y, NULL, NULL);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
input_window->root_x = root_x;
|
|
|
|
input_window->root_y = root_y;
|
|
|
|
}
|
|
|
|
|
2003-03-08 21:11:39 +00:00
|
|
|
gboolean
|
2000-07-03 19:00:23 +00:00
|
|
|
_gdk_input_other_event (GdkEvent *event,
|
|
|
|
XEvent *xevent,
|
|
|
|
GdkWindow *window)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
GdkInputWindow *input_window;
|
2000-07-03 19:00:23 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
GdkDevicePrivate *gdkdev;
|
|
|
|
gint return_val;
|
2002-04-25 22:29:14 +00:00
|
|
|
GdkDisplayX11 *display_impl = GDK_DISPLAY_X11 (GDK_WINDOW_DISPLAY (window));
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2002-08-02 20:22:49 +00:00
|
|
|
input_window = _gdk_input_window_find(window);
|
2006-12-21 16:28:28 +00:00
|
|
|
g_return_val_if_fail (input_window != NULL, FALSE);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
/* This is a sort of a hack, as there isn't any XDeviceAnyEvent -
|
|
|
|
but it's potentially faster than scanning through the types of
|
|
|
|
every device. If we were deceived, then it won't match any of
|
|
|
|
the types for the device anyways */
|
2002-08-02 20:22:49 +00:00
|
|
|
gdkdev = _gdk_input_find_device (GDK_WINDOW_DISPLAY (window),
|
|
|
|
((XDeviceButtonEvent *)xevent)->deviceid);
|
2000-07-03 19:00:23 +00:00
|
|
|
if (!gdkdev)
|
2003-03-08 21:11:39 +00:00
|
|
|
return FALSE; /* we don't handle it - not an XInput event */
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
/* FIXME: It would be nice if we could just get rid of the events
|
|
|
|
entirely, instead of having to ignore them */
|
|
|
|
if (gdkdev->info.mode == GDK_MODE_DISABLED ||
|
|
|
|
(gdkdev->info.mode == GDK_MODE_WINDOW
|
|
|
|
&& input_window->mode == GDK_EXTENSION_EVENTS_CURSOR))
|
|
|
|
return FALSE;
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
if (!display_impl->input_ignore_core)
|
|
|
|
gdk_input_check_proximity(GDK_WINDOW_DISPLAY (window));
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2002-08-02 20:22:49 +00:00
|
|
|
return_val = _gdk_input_common_other_event (event, xevent,
|
|
|
|
input_window, gdkdev);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2003-03-08 21:11:39 +00:00
|
|
|
if (return_val && event->type == GDK_PROXIMITY_OUT &&
|
2002-04-25 22:29:14 +00:00
|
|
|
display_impl->input_ignore_core)
|
|
|
|
gdk_input_check_proximity(GDK_WINDOW_DISPLAY (window));
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
return return_val;
|
|
|
|
}
|
|
|
|
|
2000-07-03 19:00:23 +00:00
|
|
|
gboolean
|
|
|
|
_gdk_input_enable_window(GdkWindow *window, GdkDevicePrivate *gdkdev)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
/* FIXME: watchout, gdkdev might be core pointer, never opened */
|
2002-08-02 20:22:49 +00:00
|
|
|
_gdk_input_common_select_events (window, gdkdev);
|
1997-11-24 22:37:52 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2000-07-03 19:00:23 +00:00
|
|
|
gboolean
|
|
|
|
_gdk_input_disable_window(GdkWindow *window, GdkDevicePrivate *gdkdev)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2002-08-02 20:22:49 +00:00
|
|
|
_gdk_input_common_select_events (window, gdkdev);
|
1997-11-24 22:37:52 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2000-07-03 19:00:23 +00:00
|
|
|
gint
|
|
|
|
_gdk_input_grab_pointer (GdkWindow * window,
|
|
|
|
gint owner_events,
|
|
|
|
GdkEventMask event_mask,
|
|
|
|
GdkWindow * confine_to,
|
|
|
|
guint32 time)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
GdkInputWindow *input_window, *new_window;
|
1998-09-05 21:22:51 +00:00
|
|
|
gboolean need_ungrab;
|
1997-11-24 22:37:52 +00:00
|
|
|
GdkDevicePrivate *gdkdev;
|
|
|
|
GList *tmp_list;
|
1997-12-18 02:17:14 +00:00
|
|
|
XEventClass event_classes[GDK_MAX_DEVICE_CLASSES];
|
1997-11-24 22:37:52 +00:00
|
|
|
gint num_classes;
|
1997-12-18 02:17:14 +00:00
|
|
|
gint result;
|
2002-04-25 22:29:14 +00:00
|
|
|
GdkDisplayX11 *display_impl = GDK_DISPLAY_X11 (GDK_WINDOW_DISPLAY (window));
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
tmp_list = display_impl->input_windows;
|
1997-11-24 22:37:52 +00:00
|
|
|
new_window = NULL;
|
1998-09-05 21:22:51 +00:00
|
|
|
need_ungrab = FALSE;
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
while (tmp_list)
|
|
|
|
{
|
|
|
|
input_window = (GdkInputWindow *)tmp_list->data;
|
|
|
|
|
|
|
|
if (input_window->window == window)
|
1997-12-18 02:17:14 +00:00
|
|
|
new_window = input_window;
|
1998-09-05 21:22:51 +00:00
|
|
|
else if (input_window->grabbed)
|
|
|
|
{
|
|
|
|
input_window->grabbed = FALSE;
|
|
|
|
need_ungrab = TRUE;
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
tmp_list = tmp_list->next;
|
|
|
|
}
|
|
|
|
|
1998-09-05 21:22:51 +00:00
|
|
|
if (new_window)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-09-05 21:22:51 +00:00
|
|
|
new_window->grabbed = TRUE;
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
tmp_list = display_impl->input_devices;
|
1998-09-05 21:22:51 +00:00
|
|
|
while (tmp_list)
|
|
|
|
{
|
|
|
|
gdkdev = (GdkDevicePrivate *)tmp_list->data;
|
2000-07-03 19:00:23 +00:00
|
|
|
if (!GDK_IS_CORE (gdkdev) && gdkdev->xdevice)
|
1998-09-05 21:22:51 +00:00
|
|
|
{
|
2002-08-02 20:22:49 +00:00
|
|
|
_gdk_input_common_find_events (window, gdkdev,
|
|
|
|
event_mask,
|
|
|
|
event_classes, &num_classes);
|
2001-12-11 01:08:33 +00:00
|
|
|
#ifdef G_ENABLE_DEBUG
|
|
|
|
if (_gdk_debug_flags & GDK_DEBUG_NOGRABS)
|
|
|
|
result = GrabSuccess;
|
|
|
|
else
|
|
|
|
#endif
|
2002-04-25 22:29:14 +00:00
|
|
|
result = XGrabDevice (display_impl->xdisplay, gdkdev->xdevice,
|
2001-12-11 01:08:33 +00:00
|
|
|
GDK_WINDOW_XWINDOW (window),
|
|
|
|
owner_events, num_classes, event_classes,
|
|
|
|
GrabModeAsync, GrabModeAsync, time);
|
1998-09-05 21:22:51 +00:00
|
|
|
|
|
|
|
/* FIXME: if failure occurs on something other than the first
|
|
|
|
device, things will be badly inconsistent */
|
|
|
|
if (result != Success)
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
tmp_list = tmp_list->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-04-25 22:29:14 +00:00
|
|
|
tmp_list = display_impl->input_devices;
|
1998-09-05 21:22:51 +00:00
|
|
|
while (tmp_list)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-09-05 21:22:51 +00:00
|
|
|
gdkdev = (GdkDevicePrivate *)tmp_list->data;
|
2000-07-03 19:00:23 +00:00
|
|
|
if (!GDK_IS_CORE (gdkdev) && gdkdev->xdevice &&
|
1998-09-05 21:22:51 +00:00
|
|
|
((gdkdev->button_state != 0) || need_ungrab))
|
|
|
|
{
|
2002-04-25 22:29:14 +00:00
|
|
|
XUngrabDevice (display_impl->xdisplay, gdkdev->xdevice, time);
|
1998-09-05 21:22:51 +00:00
|
|
|
gdkdev->button_state = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
tmp_list = tmp_list->next;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
1998-09-05 21:22:51 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return Success;
|
1998-09-05 21:22:51 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
2000-07-03 19:00:23 +00:00
|
|
|
void
|
2002-04-25 22:29:14 +00:00
|
|
|
_gdk_input_ungrab_pointer (GdkDisplay *display,
|
|
|
|
guint32 time)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2000-07-06 16:20:45 +00:00
|
|
|
GdkInputWindow *input_window = NULL; /* Quiet GCC */
|
1997-11-24 22:37:52 +00:00
|
|
|
GdkDevicePrivate *gdkdev;
|
|
|
|
GList *tmp_list;
|
2002-04-25 22:29:14 +00:00
|
|
|
GdkDisplayX11 *display_impl = GDK_DISPLAY_X11 (display);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
tmp_list = display_impl->input_windows;
|
1997-11-24 22:37:52 +00:00
|
|
|
while (tmp_list)
|
|
|
|
{
|
|
|
|
input_window = (GdkInputWindow *)tmp_list->data;
|
|
|
|
if (input_window->grabbed)
|
|
|
|
break;
|
|
|
|
tmp_list = tmp_list->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tmp_list) /* we found a grabbed window */
|
|
|
|
{
|
|
|
|
input_window->grabbed = FALSE;
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
tmp_list = display_impl->input_devices;
|
1997-11-24 22:37:52 +00:00
|
|
|
while (tmp_list)
|
|
|
|
{
|
|
|
|
gdkdev = (GdkDevicePrivate *)tmp_list->data;
|
2000-07-03 19:00:23 +00:00
|
|
|
if (!GDK_IS_CORE (gdkdev) && gdkdev->xdevice)
|
2002-04-25 22:29:14 +00:00
|
|
|
XUngrabDevice( display_impl->xdisplay, gdkdev->xdevice, time);
|
1997-12-18 02:17:14 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
tmp_list = tmp_list->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2000-07-03 19:00:23 +00:00
|
|
|
|
2005-04-10 01:01:18 +00:00
|
|
|
#define __GDK_INPUT_XFREE_C__
|
2005-03-16 04:35:33 +00:00
|
|
|
#include "gdkaliasdef.c"
|