(25/09/01) Erwann Chenede - <erwann.chenede@sun.com>
* modified gdk input extension implementation to work with properly with multihead applications.
This commit is contained in:
@@ -339,7 +339,7 @@ gdk_init_check (int *argc,
|
||||
_gdk_windowing_window_init (screen);
|
||||
_gdk_windowing_image_init (display);
|
||||
gdk_events_init (display);
|
||||
gdk_input_init ();
|
||||
gdk_input_init (display);
|
||||
gdk_dnd_init (display);
|
||||
|
||||
gdk_initialized = 1;
|
||||
|
||||
@@ -97,8 +97,11 @@ struct _GdkTimeCoord
|
||||
|
||||
GType gdk_device_get_type (void);
|
||||
|
||||
#ifndef GDK_MULTIHEAD_SAFE
|
||||
/* Returns a list of GdkDevice * */
|
||||
GList * gdk_devices_list (void);
|
||||
#endif
|
||||
GList * gdk_devices_list_for_display (GdkDisplay *display);
|
||||
|
||||
/* Functions to configure a device */
|
||||
void gdk_device_set_source (GdkDevice *device,
|
||||
|
||||
@@ -213,7 +213,7 @@ void gdk_dnd_init (GdkDisplay *display);
|
||||
void _gdk_windowing_image_init (GdkDisplay *display);
|
||||
void gdk_image_exit (void);
|
||||
|
||||
void gdk_input_init (void);
|
||||
void gdk_input_init (GdkDisplay *display);
|
||||
void gdk_input_exit (void);
|
||||
|
||||
void gdk_windowing_exit (void);
|
||||
|
||||
@@ -229,7 +229,7 @@ void
|
||||
gdk_display_pointer_ungrab (GdkDisplay * display, guint32 time)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DISPLAY (display));
|
||||
_gdk_input_ungrab_pointer (time);
|
||||
_gdk_input_ungrab_pointer (display, time);
|
||||
|
||||
XUngrabPointer (GDK_DISPLAY_XDISPLAY (display), time);
|
||||
GDK_DISPLAY_IMPL_X11 (display)->gdk_xgrab_window = NULL;
|
||||
@@ -305,6 +305,7 @@ gdk_display_init_new (int argc, char **argv, char *display_name)
|
||||
_gdk_windowing_window_init (screen);
|
||||
_gdk_windowing_image_init (display);
|
||||
gdk_events_init (display);
|
||||
gdk_input_init (display);
|
||||
gdk_dnd_init (display);
|
||||
|
||||
return display;
|
||||
|
||||
@@ -99,6 +99,20 @@ struct _GdkDisplayImplX11
|
||||
|
||||
/* translation queue */
|
||||
GSList *translate_queue;
|
||||
|
||||
/* Input device */
|
||||
/* input GdkDevice list */
|
||||
GList *gdk_input_devices;
|
||||
|
||||
/* input GdkWindow list */
|
||||
GList *gdk_input_windows;
|
||||
|
||||
gint gdk_input_ignore_core;
|
||||
/* information about network port and host for gxid daemon */
|
||||
gchar *gdk_input_gxid_host;
|
||||
gint gdk_input_gxid_port;
|
||||
|
||||
|
||||
};
|
||||
|
||||
struct _GdkDisplayImplX11Class
|
||||
|
||||
@@ -759,7 +759,7 @@ gdk_event_translate (GdkDisplay *display,
|
||||
|
||||
if (window_private == NULL ||
|
||||
((window_private->extension_events != 0) &&
|
||||
gdk_input_ignore_core))
|
||||
display_impl->gdk_input_ignore_core))
|
||||
{
|
||||
return_val = FALSE;
|
||||
break;
|
||||
@@ -822,7 +822,7 @@ gdk_event_translate (GdkDisplay *display,
|
||||
|
||||
if (window_private == NULL ||
|
||||
((window_private->extension_events != 0) &&
|
||||
gdk_input_ignore_core))
|
||||
display_impl->gdk_input_ignore_core))
|
||||
{
|
||||
return_val = FALSE;
|
||||
break;
|
||||
@@ -859,7 +859,7 @@ gdk_event_translate (GdkDisplay *display,
|
||||
|
||||
if (window_private == NULL ||
|
||||
((window_private->extension_events != 0) &&
|
||||
gdk_input_ignore_core))
|
||||
display_impl->gdk_input_ignore_core))
|
||||
{
|
||||
return_val = FALSE;
|
||||
break;
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
#include "gdkinputprivate.h"
|
||||
#include "gdkx.h"
|
||||
#include "gdkdisplay-x11.h"
|
||||
|
||||
/* #define DEBUG_SWITCHING */
|
||||
|
||||
@@ -49,30 +50,37 @@ static GdkDevicePrivate *gdk_input_current_device;
|
||||
static GdkDevicePrivate *gdk_input_core_pointer;
|
||||
|
||||
void
|
||||
gdk_input_init(void)
|
||||
gdk_input_init(GdkDisplay *display)
|
||||
{
|
||||
GList *tmp_list;
|
||||
GdkDisplayImplX11 *display_impl = GDK_DISPLAY_IMPL_X11 (display);
|
||||
|
||||
_gdk_init_input_core ();
|
||||
gdk_input_ignore_core = FALSE;
|
||||
display_impl->gdk_input_ignore_core = FALSE;
|
||||
gdk_input_core_pointer = NULL;
|
||||
|
||||
if (!gdk_input_gxid_host)
|
||||
/* if display is not the default one, gxid_host and gxid_port
|
||||
* need to be set explicitly */
|
||||
|
||||
if (display == gdk_get_default_display ())
|
||||
{
|
||||
gdk_input_gxid_host = getenv("GXID_HOST");
|
||||
}
|
||||
if (!gdk_input_gxid_port)
|
||||
{
|
||||
char *t = getenv("GXID_PORT");
|
||||
if (t)
|
||||
gdk_input_gxid_port = atoi(t);
|
||||
if (!gdk_input_gxid_host)
|
||||
{
|
||||
display_impl->gdk_input_gxid_host = getenv("GXID_HOST");
|
||||
}
|
||||
if (!gdk_input_gxid_port)
|
||||
{
|
||||
char *t = getenv("GXID_PORT");
|
||||
if (t)
|
||||
display_impl->gdk_input_gxid_port = atoi(t);
|
||||
}
|
||||
}
|
||||
|
||||
gdk_input_common_init(TRUE);
|
||||
gdk_input_common_init_for_display (display, TRUE);
|
||||
|
||||
/* find initial core pointer */
|
||||
|
||||
for (tmp_list = gdk_input_devices; tmp_list; tmp_list = tmp_list->next)
|
||||
for (tmp_list = display_impl->gdk_input_devices; tmp_list; tmp_list = tmp_list->next)
|
||||
{
|
||||
GdkDevicePrivate *gdkdev = (GdkDevicePrivate *)tmp_list->data;
|
||||
if (gdk_input_is_extension_device (gdkdev))
|
||||
@@ -91,10 +99,14 @@ static void
|
||||
gdk_input_gxi_select_notify (GdkDevicePrivate *gdkdev)
|
||||
{
|
||||
XEventClass class;
|
||||
GdkDisplayImplX11 * display_impl = GDK_DISPLAY_IMPL_X11 (gdkdev->display);
|
||||
|
||||
ChangeDeviceNotify (gdkdev->xdevice, gdkdev->changenotify_type, class);
|
||||
|
||||
XSelectExtensionEvent (gdk_display, gdk_root_window, &class, 1);
|
||||
/* FIXME should it be selected for all the managed screen of display ? */
|
||||
XSelectExtensionEvent (GDK_DISPLAY_XDISPLAY (gdkdev->display),
|
||||
GDK_SCREEN_XROOTWIN (display_impl->default_screen),
|
||||
&class, 1);
|
||||
}
|
||||
|
||||
/* Set the core pointer. Device should already be enabled. */
|
||||
@@ -129,7 +141,8 @@ gdk_input_gxi_set_core_pointer(GdkDevicePrivate *gdkdev)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if ( XChangePointerDevice(gdk_display,gdkdev->xdevice, x_axis, y_axis)
|
||||
if ( XChangePointerDevice(GDK_DISPLAY_XDISPLAY(gdkdev->display),
|
||||
gdkdev->xdevice, x_axis, y_axis)
|
||||
!= Success )
|
||||
{
|
||||
return FALSE;
|
||||
@@ -153,6 +166,7 @@ gdk_device_set_mode (GdkDevice *device,
|
||||
GdkDevicePrivate *gdkdev;
|
||||
GdkInputMode old_mode;
|
||||
GdkInputWindow *input_window;
|
||||
GdkDisplayImplX11 *display_impl;
|
||||
|
||||
if (GDK_IS_CORE (device))
|
||||
return FALSE;
|
||||
@@ -164,10 +178,12 @@ gdk_device_set_mode (GdkDevice *device,
|
||||
|
||||
old_mode = device->mode;
|
||||
device->mode = mode;
|
||||
|
||||
display_impl = GDK_DISPLAY_IMPL_X11 (gdkdev->display);
|
||||
|
||||
if (old_mode != GDK_MODE_DISABLED)
|
||||
{
|
||||
for (tmp_list = gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
|
||||
for (tmp_list = display_impl->gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
|
||||
{
|
||||
input_window = (GdkInputWindow *)tmp_list->data;
|
||||
if (input_window->mode != GDK_EXTENSION_EVENTS_CURSOR)
|
||||
@@ -177,7 +193,7 @@ gdk_device_set_mode (GdkDevice *device,
|
||||
|
||||
if (mode != GDK_MODE_DISABLED)
|
||||
{
|
||||
for (tmp_list = gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
|
||||
for (tmp_list = display_impl->gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
|
||||
{
|
||||
input_window = (GdkInputWindow *)tmp_list->data;
|
||||
if (input_window->mode != GDK_EXTENSION_EVENTS_CURSOR)
|
||||
@@ -201,7 +217,7 @@ gdk_input_is_extension_device (GdkDevicePrivate *private)
|
||||
if (GDK_IS_CORE (private))
|
||||
return FALSE;
|
||||
|
||||
devices = XListInputDevices(gdk_display, &num_devices);
|
||||
devices = XListInputDevices(GDK_DISPLAY_XDISPLAY (private->display), &num_devices);
|
||||
for(loop=0; loop<num_devices; loop++)
|
||||
{
|
||||
if ((devices[loop].id == private->deviceid) &&
|
||||
@@ -225,8 +241,9 @@ _gdk_input_configure_event (XConfigureEvent *xevent, GdkWindow *window)
|
||||
input_window = gdk_input_window_find(window);
|
||||
g_return_if_fail (input_window != NULL);
|
||||
|
||||
gdk_input_get_root_relative_geometry(gdk_display,GDK_WINDOW_XWINDOW(window),
|
||||
&root_x, &root_y, NULL, NULL);
|
||||
gdk_input_get_root_relative_geometry(GDK_WINDOW_XDISPLAY (window),
|
||||
GDK_WINDOW_XWINDOW(window),
|
||||
&root_x, &root_y, NULL, NULL);
|
||||
input_window->root_x = root_x;
|
||||
input_window->root_y = root_y;
|
||||
gdk_input_compute_obscuring(input_window);
|
||||
@@ -263,7 +280,8 @@ _gdk_input_other_event (GdkEvent *event,
|
||||
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 */
|
||||
gdkdev = gdk_input_find_device(((XDeviceButtonEvent *)xevent)->deviceid);
|
||||
gdkdev = gdk_input_find_device_for_display (GDK_WINDOW_DISPLAY (window),
|
||||
((XDeviceButtonEvent *)xevent)->deviceid);
|
||||
|
||||
if (!gdkdev)
|
||||
{
|
||||
@@ -309,20 +327,22 @@ static void
|
||||
gdk_input_gxi_update_device (GdkDevicePrivate *gdkdev)
|
||||
{
|
||||
GList *t;
|
||||
GdkDisplayImplX11 *display_impl = GDK_DISPLAY_IMPL_X11 (gdkdev->display);
|
||||
|
||||
if (gdk_input_is_extension_device (gdkdev))
|
||||
{
|
||||
if (!gdkdev->xdevice)
|
||||
{
|
||||
gdkdev->xdevice = XOpenDevice(gdk_display, gdkdev->deviceid);
|
||||
gdkdev->xdevice = XOpenDevice(display_impl->xdisplay,
|
||||
gdkdev->deviceid);
|
||||
gdk_input_gxi_select_notify (gdkdev);
|
||||
gdkdev->needs_update = 1;
|
||||
}
|
||||
if (gdkdev->needs_update && gdkdev->xdevice)
|
||||
{
|
||||
for (t = gdk_input_windows; t; t = t->next)
|
||||
for (t = display_impl->gdk_input_windows; t; t = t->next)
|
||||
gdk_input_common_select_events (((GdkInputWindow *)t->data)->window,
|
||||
gdkdev);
|
||||
gdkdev);
|
||||
gdkdev->needs_update = 0;
|
||||
}
|
||||
}
|
||||
@@ -332,7 +352,8 @@ gint
|
||||
_gdk_input_window_none_event (GdkEvent *event, XEvent *xevent)
|
||||
{
|
||||
GdkDevicePrivate *gdkdev =
|
||||
gdk_input_find_device(((XDeviceButtonEvent *)xevent)->deviceid);
|
||||
gdk_input_find_device_for_display (GDK_WINDOW_DISPLAY (event->any.window),
|
||||
((XDeviceButtonEvent *)xevent)->deviceid);
|
||||
|
||||
if (!gdkdev) {
|
||||
return -1; /* we don't handle it - not an XInput event */
|
||||
@@ -359,13 +380,16 @@ gboolean
|
||||
_gdk_input_enable_window (GdkWindow *window, GdkDevicePrivate *gdkdev)
|
||||
{
|
||||
GdkInputWindow *input_window;
|
||||
GdkDisplayImplX11 *display_impl =
|
||||
GDK_DISPLAY_IMPL_X11 (GDK_WINDOW_DISPLAY (window));
|
||||
|
||||
input_window = gdk_input_window_find (window);
|
||||
g_return_val_if_fail (input_window != NULL, FALSE);
|
||||
|
||||
if (!gdkdev->claimed)
|
||||
{
|
||||
if (gxid_claim_device(gdk_input_gxid_host, gdk_input_gxid_port,
|
||||
if (gxid_claim_device(display_impl->gdk_input_gxid_host,
|
||||
display_impl->gdk_input_gxid_port,
|
||||
gdkdev->deviceid,
|
||||
GDK_WINDOW_XWINDOW(window), FALSE) !=
|
||||
GXID_RETURN_OK)
|
||||
@@ -388,13 +412,16 @@ gboolean
|
||||
_gdk_input_disable_window (GdkWindow *window, GdkDevicePrivate *gdkdev)
|
||||
{
|
||||
GdkInputWindow *input_window;
|
||||
GdkDisplayImplX11 *display_impl =
|
||||
GDK_DISPLAY_IMPL_X11 (GDK_WINDOW_DISPLAY (window));
|
||||
|
||||
input_window = gdk_input_window_find (window);
|
||||
g_return_val_if_fail (input_window != NULL, FALSE);
|
||||
|
||||
if (gdkdev->claimed)
|
||||
{
|
||||
gxid_release_device(gdk_input_gxid_host, gdk_input_gxid_port,
|
||||
gxid_release_device(display_impl->gdk_input_gxid_host,
|
||||
display_impl->gdk_input_gxid_port,
|
||||
gdkdev->deviceid,
|
||||
GDK_WINDOW_XWINDOW(window));
|
||||
|
||||
@@ -457,15 +484,16 @@ gdk_input_compute_obscuring(GdkInputWindow *input_window)
|
||||
Window root,parent;
|
||||
Window *children;
|
||||
int nchildren;
|
||||
Display *xdisplay = GDK_WINDOW_XDISPLAY (input_window->window);
|
||||
|
||||
Window w = GDK_WINDOW_XWINDOW(input_window->window);
|
||||
Window root_child = gdk_input_find_root_child(gdk_display,w);
|
||||
gdk_input_get_root_relative_geometry(gdk_display,w,&x,&y,&width,&height);
|
||||
Window root_child = gdk_input_find_root_child(xdisplay, w);
|
||||
gdk_input_get_root_relative_geometry(xdisplay,w,&x,&y,&width,&height);
|
||||
|
||||
input_window->root_x = x;
|
||||
input_window->root_y = y;
|
||||
|
||||
XQueryTree(gdk_display,GDK_ROOT_WINDOW(),
|
||||
XQueryTree(xdisplay, GDK_WINDOW_XROOTWIN (input_window->window),
|
||||
&root,&parent,&children,&nchildren);
|
||||
|
||||
|
||||
@@ -490,7 +518,7 @@ gdk_input_compute_obscuring(GdkInputWindow *input_window)
|
||||
for (i=i+1;i<nchildren;i++)
|
||||
{
|
||||
int xmin, xmax, ymin, ymax;
|
||||
XGetGeometry(gdk_display,children[i],&root,&xc,&yc,&widthc,&heightc,
|
||||
XGetGeometry(xdisplay,children[i],&root,&xc,&yc,&widthc,&heightc,
|
||||
&border_widthc, &depthc);
|
||||
xmin = xc>x ? xc : x;
|
||||
xmax = (xc+widthc)<(x+width) ? xc+widthc : x+width;
|
||||
@@ -499,7 +527,7 @@ gdk_input_compute_obscuring(GdkInputWindow *input_window)
|
||||
if ((xmin < xmax) && (ymin < ymax))
|
||||
{
|
||||
XWindowAttributes attributes;
|
||||
XGetWindowAttributes(gdk_display,children[i],&attributes);
|
||||
XGetWindowAttributes(xdisplay,children[i],&attributes);
|
||||
if (attributes.map_state == IsViewable)
|
||||
{
|
||||
GdkRectangle *rect = &input_window->obscuring[input_window->num_obscuring];
|
||||
@@ -528,8 +556,10 @@ _gdk_input_grab_pointer (GdkWindow * window,
|
||||
GList *tmp_list;
|
||||
GdkInputWindow *input_window;
|
||||
GdkDevicePrivate *gdkdev;
|
||||
GdkDisplayImplX11 *display_impl =
|
||||
GDK_DISPLAY_IMPL_X11 (GDK_WINDOW_DISPLAY (window));
|
||||
|
||||
tmp_list = gdk_input_windows;
|
||||
tmp_list = display_impl->gdk_input_windows;
|
||||
while (tmp_list)
|
||||
{
|
||||
input_window = (GdkInputWindow *)tmp_list->data;
|
||||
@@ -542,7 +572,7 @@ _gdk_input_grab_pointer (GdkWindow * window,
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
|
||||
tmp_list = gdk_input_devices;
|
||||
tmp_list = display_impl->gdk_input_devices;
|
||||
while (tmp_list)
|
||||
{
|
||||
gdkdev = (GdkDevicePrivate *)tmp_list->data;
|
||||
@@ -558,12 +588,12 @@ _gdk_input_grab_pointer (GdkWindow * window,
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_input_ungrab_pointer (guint32 time)
|
||||
_gdk_input_ungrab_pointer (GdkDisplay *display, guint32 time)
|
||||
{
|
||||
GdkInputWindow *input_window;
|
||||
GList *tmp_list;
|
||||
|
||||
tmp_list = gdk_input_windows;
|
||||
tmp_list = GDK_DISPLAY_IMPL_X11 (display)->gdk_input_windows;
|
||||
while (tmp_list)
|
||||
{
|
||||
input_window = (GdkInputWindow *)tmp_list->data;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "gdkinputprivate.h"
|
||||
#include "gdkdisplay-x11.h"
|
||||
|
||||
/*
|
||||
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
||||
@@ -27,12 +28,12 @@
|
||||
*/
|
||||
|
||||
void
|
||||
gdk_input_init (void)
|
||||
gdk_input_init (GdkDisplay *display)
|
||||
{
|
||||
GdkDisplayImplX11 *display_impl = GDK_DISPLAY_IMPL_X11 (display);
|
||||
_gdk_init_input_core ();
|
||||
gdk_input_devices = g_list_append (NULL, gdk_core_pointer);
|
||||
|
||||
gdk_input_ignore_core = FALSE;
|
||||
display_impl->gdk_input_devices = g_list_append (NULL, gdk_core_pointer);
|
||||
display_impl->gdk_input_ignore_core = FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -117,7 +118,8 @@ _gdk_input_grab_pointer (GdkWindow * window,
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_input_ungrab_pointer (guint32 time)
|
||||
_gdk_input_ungrab_pointer (GdkDisplay * display,
|
||||
guint32 time)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -28,12 +28,14 @@
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkx.h"
|
||||
#include "gdk.h" /* For gdk_error_trap_push()/pop() */
|
||||
#include "gdkdisplay-x11.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/* Forward declarations */
|
||||
static GdkDevicePrivate *gdk_input_device_new(XDeviceInfo *device,
|
||||
gint include_core);
|
||||
static GdkDevicePrivate *gdk_input_device_new(GdkDisplay *display,
|
||||
XDeviceInfo *device,
|
||||
gint include_core);
|
||||
static void gdk_input_translate_coordinates(GdkDevicePrivate *gdkdev,
|
||||
GdkInputWindow *input_window,
|
||||
gint *axis_data,
|
||||
@@ -44,10 +46,28 @@ static guint gdk_input_translate_state(guint state, guint device_state);
|
||||
|
||||
/* Global variables */
|
||||
|
||||
#ifndef GDK_MULTIHEAD_SAFE
|
||||
GdkDevicePrivate *
|
||||
gdk_input_find_device (guint32 id)
|
||||
{
|
||||
GList *tmp_list = gdk_input_devices;
|
||||
GList *tmp_list =
|
||||
GDK_DISPLAY_IMPL_X11 (gdk_get_default_display ())->gdk_input_devices;
|
||||
GdkDevicePrivate *gdkdev;
|
||||
while (tmp_list)
|
||||
{
|
||||
gdkdev = (GdkDevicePrivate *)(tmp_list->data);
|
||||
if (gdkdev->deviceid == id)
|
||||
return gdkdev;
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
GdkDevicePrivate *
|
||||
gdk_input_find_device_for_display (GdkDisplay *display,
|
||||
guint32 id)
|
||||
{
|
||||
GList *tmp_list = GDK_DISPLAY_IMPL_X11 (display)->gdk_input_devices;
|
||||
GdkDevicePrivate *gdkdev;
|
||||
while (tmp_list)
|
||||
{
|
||||
@@ -89,7 +109,9 @@ gdk_input_get_root_relative_geometry(Display *display, Window w, int *x_ret, int
|
||||
}
|
||||
|
||||
static GdkDevicePrivate *
|
||||
gdk_input_device_new (XDeviceInfo *device, gint include_core)
|
||||
gdk_input_device_new (GdkDisplay *display,
|
||||
XDeviceInfo *device,
|
||||
gint include_core)
|
||||
{
|
||||
GdkDevicePrivate *gdkdev;
|
||||
gchar *tmp_name;
|
||||
@@ -99,6 +121,9 @@ gdk_input_device_new (XDeviceInfo *device, gint include_core)
|
||||
gdkdev = g_object_new (GDK_TYPE_DEVICE, NULL);
|
||||
|
||||
gdkdev->deviceid = device->id;
|
||||
|
||||
gdkdev->display = display;
|
||||
|
||||
if (device->name[0])
|
||||
gdkdev->info.name = g_strdup (device->name);
|
||||
else
|
||||
@@ -218,7 +243,8 @@ gdk_input_device_new (XDeviceInfo *device, gint include_core)
|
||||
if (device->use != IsXPointer)
|
||||
{
|
||||
gdk_error_trap_push ();
|
||||
gdkdev->xdevice = XOpenDevice(gdk_display, gdkdev->deviceid);
|
||||
gdkdev->xdevice = XOpenDevice(GDK_DISPLAY_XDISPLAY (display),
|
||||
gdkdev->deviceid);
|
||||
|
||||
/* return NULL if device is not ready */
|
||||
if (gdk_error_trap_pop ())
|
||||
@@ -366,11 +392,12 @@ gdk_input_common_select_events(GdkWindow *window,
|
||||
((GdkWindowObject *)window)->extension_events,
|
||||
classes, &num_classes);
|
||||
|
||||
XSelectExtensionEvent (gdk_display,
|
||||
XSelectExtensionEvent (GDK_WINDOW_XDISPLAY (window),
|
||||
GDK_WINDOW_XWINDOW(window),
|
||||
classes, num_classes);
|
||||
}
|
||||
|
||||
#ifndef GDK_MULTIHEAD_SAFE
|
||||
gint
|
||||
gdk_input_common_init(gint include_core)
|
||||
{
|
||||
@@ -378,35 +405,82 @@ gdk_input_common_init(gint include_core)
|
||||
XDeviceInfo *devices;
|
||||
int num_devices;
|
||||
int num_extensions, loop;
|
||||
Display *display = gdk_display;
|
||||
GdkDisplayImplX11 *display_impl = gdk_get_default_display ();
|
||||
|
||||
/* Init XInput extension */
|
||||
|
||||
extensions = XListExtensions(display, &num_extensions);
|
||||
extensions = XListExtensions(display_impl->xdisplay, &num_extensions);
|
||||
for (loop = 0; loop < num_extensions &&
|
||||
(strcmp(extensions[loop], "XInputExtension") != 0); loop++);
|
||||
XFreeExtensionList(extensions);
|
||||
gdk_input_devices = NULL;
|
||||
display_impl->gdk_input_devices = NULL;
|
||||
if (loop < num_extensions)
|
||||
{
|
||||
/* XInput extension found */
|
||||
|
||||
devices = XListInputDevices(display, &num_devices);
|
||||
devices = XListInputDevices(display_impl->xdisplay, &num_devices);
|
||||
|
||||
for(loop=0; loop<num_devices; loop++)
|
||||
{
|
||||
GdkDevicePrivate *gdkdev = gdk_input_device_new(&devices[loop],
|
||||
include_core);
|
||||
GdkDevicePrivate *gdkdev = gdk_input_device_new(display,
|
||||
&devices[loop],
|
||||
include_core);
|
||||
if (gdkdev)
|
||||
gdk_input_devices = g_list_append(gdk_input_devices, gdkdev);
|
||||
display_impl->gdk_input_devices =
|
||||
g_list_append(display_impl->gdk_input_devices, gdkdev);
|
||||
}
|
||||
XFreeDeviceList(devices);
|
||||
}
|
||||
|
||||
gdk_input_devices = g_list_append (gdk_input_devices, gdk_core_pointer);
|
||||
display_impl->gdk_input_devices =
|
||||
g_list_append (display_impl->gdk_input_devices, gdk_core_pointer);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
gint
|
||||
gdk_input_common_init_for_display (GdkDisplay *display,
|
||||
gint include_core)
|
||||
{
|
||||
char **extensions;
|
||||
XDeviceInfo *devices;
|
||||
int num_devices;
|
||||
int num_extensions, loop;
|
||||
GdkDisplayImplX11 *display_impl = GDK_DISPLAY_IMPL_X11 (display);
|
||||
|
||||
/* Init XInput extension */
|
||||
|
||||
extensions = XListExtensions(display_impl->xdisplay, &num_extensions);
|
||||
for (loop = 0; loop < num_extensions &&
|
||||
(strcmp(extensions[loop], "XInputExtension") != 0); loop++);
|
||||
XFreeExtensionList(extensions);
|
||||
display_impl->gdk_input_devices = NULL;
|
||||
if (loop < num_extensions)
|
||||
{
|
||||
/* XInput extension found */
|
||||
|
||||
devices = XListInputDevices(display_impl->xdisplay, &num_devices);
|
||||
|
||||
for(loop=0; loop<num_devices; loop++)
|
||||
{
|
||||
GdkDevicePrivate *gdkdev = gdk_input_device_new(display,
|
||||
&devices[loop],
|
||||
include_core);
|
||||
if (gdkdev)
|
||||
{
|
||||
display_impl->gdk_input_devices =
|
||||
g_list_append(display_impl->gdk_input_devices, gdkdev);
|
||||
}
|
||||
}
|
||||
XFreeDeviceList(devices);
|
||||
}
|
||||
|
||||
display_impl->gdk_input_devices =
|
||||
g_list_append (display_impl->gdk_input_devices, gdk_core_pointer);
|
||||
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_input_translate_coordinates (GdkDevicePrivate *gdkdev,
|
||||
@@ -690,7 +764,7 @@ _gdk_device_get_history (GdkDevice *device,
|
||||
|
||||
g_return_val_if_fail (input_window != NULL, FALSE);
|
||||
|
||||
device_coords = XGetDeviceMotionEvents (gdk_display,
|
||||
device_coords = XGetDeviceMotionEvents (GDK_WINDOW_XDISPLAY (window),
|
||||
gdkdev->xdevice,
|
||||
start, stop,
|
||||
n_events, &mode_return,
|
||||
@@ -756,7 +830,8 @@ gdk_device_get_state (GdkDevice *device,
|
||||
input_window = gdk_input_window_find (window);
|
||||
g_return_if_fail (input_window != NULL);
|
||||
|
||||
state = XQueryDeviceState (gdk_display, gdkdev->xdevice);
|
||||
state = XQueryDeviceState (GDK_WINDOW_XDISPLAY (window),
|
||||
gdkdev->xdevice);
|
||||
input_class = state->data;
|
||||
for (i=0; i<state->num_classes; i++)
|
||||
{
|
||||
@@ -785,3 +860,4 @@ gdk_device_get_state (GdkDevice *device,
|
||||
XFreeDeviceState (state);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "gdkinputprivate.h"
|
||||
#include "gdkdisplay-x11.h"
|
||||
|
||||
/*
|
||||
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
||||
@@ -28,14 +29,14 @@
|
||||
|
||||
/* forward declarations */
|
||||
|
||||
static void gdk_input_check_proximity (void);
|
||||
static void gdk_input_check_proximity (GdkDisplay *display);
|
||||
|
||||
void
|
||||
gdk_input_init(void)
|
||||
gdk_input_init(GdkDisplay *display)
|
||||
{
|
||||
_gdk_init_input_core ();
|
||||
gdk_input_ignore_core = FALSE;
|
||||
gdk_input_common_init(FALSE);
|
||||
GDK_DISPLAY_IMPL_X11 (display)->gdk_input_ignore_core = FALSE;
|
||||
gdk_input_common_init_for_display (display, FALSE);
|
||||
}
|
||||
|
||||
gboolean
|
||||
@@ -46,6 +47,7 @@ gdk_device_set_mode (GdkDevice *device,
|
||||
GdkDevicePrivate *gdkdev;
|
||||
GdkInputMode old_mode;
|
||||
GdkInputWindow *input_window;
|
||||
GdkDisplayImplX11 *display_impl;
|
||||
|
||||
if (GDK_IS_CORE (device))
|
||||
return FALSE;
|
||||
@@ -58,10 +60,12 @@ gdk_device_set_mode (GdkDevice *device,
|
||||
old_mode = device->mode;
|
||||
device->mode = mode;
|
||||
|
||||
display_impl = GDK_DISPLAY_IMPL_X11 (gdkdev->display);
|
||||
|
||||
if (mode == GDK_MODE_WINDOW)
|
||||
{
|
||||
device->has_cursor = FALSE;
|
||||
for (tmp_list = gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
|
||||
for (tmp_list = display_impl->gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
|
||||
{
|
||||
input_window = (GdkInputWindow *)tmp_list->data;
|
||||
if (input_window->mode != GDK_EXTENSION_EVENTS_CURSOR)
|
||||
@@ -74,13 +78,13 @@ gdk_device_set_mode (GdkDevice *device,
|
||||
else if (mode == GDK_MODE_SCREEN)
|
||||
{
|
||||
device->has_cursor = TRUE;
|
||||
for (tmp_list = gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
|
||||
for (tmp_list = display_impl->gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
|
||||
_gdk_input_enable_window (((GdkInputWindow *)tmp_list->data)->window,
|
||||
gdkdev);
|
||||
}
|
||||
else /* mode == GDK_MODE_DISABLED */
|
||||
{
|
||||
for (tmp_list = gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
|
||||
for (tmp_list = display_impl->gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
|
||||
{
|
||||
input_window = (GdkInputWindow *)tmp_list->data;
|
||||
if (old_mode != GDK_MODE_WINDOW ||
|
||||
@@ -94,10 +98,11 @@ gdk_device_set_mode (GdkDevice *device,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_input_check_proximity (void)
|
||||
gdk_input_check_proximity (GdkDisplay *display)
|
||||
{
|
||||
gint new_proximity = 0;
|
||||
GList *tmp_list = gdk_input_devices;
|
||||
GdkDisplayImplX11 *display_impl = GDK_DISPLAY_IMPL_X11 (display);
|
||||
GList *tmp_list = display_impl->gdk_input_devices;
|
||||
|
||||
while (tmp_list && !new_proximity)
|
||||
{
|
||||
@@ -107,7 +112,7 @@ gdk_input_check_proximity (void)
|
||||
&& !GDK_IS_CORE (gdkdev)
|
||||
&& gdkdev->xdevice)
|
||||
{
|
||||
XDeviceState *state = XQueryDeviceState(GDK_DISPLAY(),
|
||||
XDeviceState *state = XQueryDeviceState(display_impl->xdisplay,
|
||||
gdkdev->xdevice);
|
||||
XInputClass *xic;
|
||||
int i;
|
||||
@@ -132,7 +137,7 @@ gdk_input_check_proximity (void)
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
|
||||
gdk_input_ignore_core = new_proximity;
|
||||
display_impl->gdk_input_ignore_core = new_proximity;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -145,9 +150,9 @@ _gdk_input_configure_event (XConfigureEvent *xevent,
|
||||
input_window = gdk_input_window_find(window);
|
||||
g_return_if_fail (window != NULL);
|
||||
|
||||
gdk_input_get_root_relative_geometry(GDK_DISPLAY(),GDK_WINDOW_XWINDOW(window),
|
||||
&root_x,
|
||||
&root_y, NULL, NULL);
|
||||
gdk_input_get_root_relative_geometry(GDK_WINDOW_XDISPLAY (window),
|
||||
GDK_WINDOW_XWINDOW (window),
|
||||
&root_x, &root_y, NULL, NULL);
|
||||
|
||||
input_window->root_x = root_x;
|
||||
input_window->root_y = root_y;
|
||||
@@ -160,14 +165,14 @@ _gdk_input_enter_event (XCrossingEvent *xevent,
|
||||
GdkInputWindow *input_window;
|
||||
gint root_x, root_y;
|
||||
|
||||
input_window = gdk_input_window_find(window);
|
||||
input_window = gdk_input_window_find (window);
|
||||
g_return_if_fail (window != NULL);
|
||||
|
||||
gdk_input_check_proximity();
|
||||
gdk_input_check_proximity(GDK_WINDOW_DISPLAY (window));
|
||||
|
||||
gdk_input_get_root_relative_geometry(GDK_DISPLAY(),GDK_WINDOW_XWINDOW(window),
|
||||
&root_x,
|
||||
&root_y, NULL, NULL);
|
||||
gdk_input_get_root_relative_geometry(GDK_WINDOW_XDISPLAY (window),
|
||||
GDK_WINDOW_XWINDOW(window),
|
||||
&root_x, &root_y, NULL, NULL);
|
||||
|
||||
input_window->root_x = root_x;
|
||||
input_window->root_y = root_y;
|
||||
@@ -182,6 +187,8 @@ _gdk_input_other_event (GdkEvent *event,
|
||||
|
||||
GdkDevicePrivate *gdkdev;
|
||||
gint return_val;
|
||||
GdkDisplayImplX11 *display_impl =
|
||||
GDK_DISPLAY_IMPL_X11 (GDK_WINDOW_DISPLAY (window));
|
||||
|
||||
input_window = gdk_input_window_find(window);
|
||||
g_return_val_if_fail (window != NULL, -1);
|
||||
@@ -190,8 +197,8 @@ _gdk_input_other_event (GdkEvent *event,
|
||||
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 */
|
||||
gdkdev = gdk_input_find_device (((XDeviceButtonEvent *)xevent)->deviceid);
|
||||
|
||||
gdkdev = gdk_input_find_device_for_display (GDK_WINDOW_DISPLAY (window),
|
||||
((XDeviceButtonEvent *)xevent)->deviceid);
|
||||
if (!gdkdev)
|
||||
return -1; /* we don't handle it - not an XInput event */
|
||||
|
||||
@@ -202,15 +209,15 @@ _gdk_input_other_event (GdkEvent *event,
|
||||
&& input_window->mode == GDK_EXTENSION_EVENTS_CURSOR))
|
||||
return FALSE;
|
||||
|
||||
if (!gdk_input_ignore_core)
|
||||
gdk_input_check_proximity();
|
||||
if (!display_impl->gdk_input_ignore_core)
|
||||
gdk_input_check_proximity(GDK_WINDOW_DISPLAY (window));
|
||||
|
||||
return_val = gdk_input_common_other_event (event, xevent,
|
||||
input_window, gdkdev);
|
||||
|
||||
if (return_val > 0 && event->type == GDK_PROXIMITY_OUT &&
|
||||
gdk_input_ignore_core)
|
||||
gdk_input_check_proximity();
|
||||
display_impl->gdk_input_ignore_core)
|
||||
gdk_input_check_proximity(GDK_WINDOW_DISPLAY (window));
|
||||
|
||||
return return_val;
|
||||
}
|
||||
@@ -244,8 +251,9 @@ _gdk_input_grab_pointer (GdkWindow * window,
|
||||
XEventClass event_classes[GDK_MAX_DEVICE_CLASSES];
|
||||
gint num_classes;
|
||||
gint result;
|
||||
GdkDisplayImplX11 *display_impl = GDK_DISPLAY_IMPL_X11 (GDK_WINDOW_DISPLAY (window));
|
||||
|
||||
tmp_list = gdk_input_windows;
|
||||
tmp_list = display_impl->gdk_input_windows;
|
||||
new_window = NULL;
|
||||
need_ungrab = FALSE;
|
||||
|
||||
@@ -268,7 +276,7 @@ _gdk_input_grab_pointer (GdkWindow * window,
|
||||
{
|
||||
new_window->grabbed = TRUE;
|
||||
|
||||
tmp_list = gdk_input_devices;
|
||||
tmp_list = display_impl->gdk_input_devices;
|
||||
while (tmp_list)
|
||||
{
|
||||
gdkdev = (GdkDevicePrivate *)tmp_list->data;
|
||||
@@ -278,7 +286,7 @@ _gdk_input_grab_pointer (GdkWindow * window,
|
||||
event_mask,
|
||||
event_classes, &num_classes);
|
||||
|
||||
result = XGrabDevice( GDK_DISPLAY(), gdkdev->xdevice,
|
||||
result = XGrabDevice( display_impl->xdisplay, gdkdev->xdevice,
|
||||
GDK_WINDOW_XWINDOW (window),
|
||||
owner_events, num_classes, event_classes,
|
||||
GrabModeAsync, GrabModeAsync, time);
|
||||
@@ -293,14 +301,14 @@ _gdk_input_grab_pointer (GdkWindow * window,
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp_list = gdk_input_devices;
|
||||
tmp_list = display_impl->gdk_input_devices;
|
||||
while (tmp_list)
|
||||
{
|
||||
gdkdev = (GdkDevicePrivate *)tmp_list->data;
|
||||
if (!GDK_IS_CORE (gdkdev) && gdkdev->xdevice &&
|
||||
((gdkdev->button_state != 0) || need_ungrab))
|
||||
{
|
||||
XUngrabDevice( gdk_display, gdkdev->xdevice, time);
|
||||
XUngrabDevice (display_impl->xdisplay, gdkdev->xdevice, time);
|
||||
gdkdev->button_state = 0;
|
||||
}
|
||||
|
||||
@@ -313,13 +321,15 @@ _gdk_input_grab_pointer (GdkWindow * window,
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_input_ungrab_pointer (guint32 time)
|
||||
_gdk_input_ungrab_pointer (GdkDisplay *display,
|
||||
guint32 time)
|
||||
{
|
||||
GdkInputWindow *input_window = NULL; /* Quiet GCC */
|
||||
GdkDevicePrivate *gdkdev;
|
||||
GList *tmp_list;
|
||||
GdkDisplayImplX11 *display_impl = GDK_DISPLAY_IMPL_X11 (display);
|
||||
|
||||
tmp_list = gdk_input_windows;
|
||||
tmp_list = display_impl->gdk_input_windows;
|
||||
while (tmp_list)
|
||||
{
|
||||
input_window = (GdkInputWindow *)tmp_list->data;
|
||||
@@ -332,12 +342,12 @@ _gdk_input_ungrab_pointer (guint32 time)
|
||||
{
|
||||
input_window->grabbed = FALSE;
|
||||
|
||||
tmp_list = gdk_input_devices;
|
||||
tmp_list = display_impl->gdk_input_devices;
|
||||
while (tmp_list)
|
||||
{
|
||||
gdkdev = (GdkDevicePrivate *)tmp_list->data;
|
||||
if (!GDK_IS_CORE (gdkdev) && gdkdev->xdevice)
|
||||
XUngrabDevice( gdk_display, gdkdev->xdevice, time);
|
||||
XUngrabDevice( display_impl->xdisplay, gdkdev->xdevice, time);
|
||||
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
#include "gdkinput.h"
|
||||
#include "gdkprivate.h"
|
||||
#include "gdkinputprivate.h"
|
||||
#include "gdkdisplay-x11.h"
|
||||
#include "gdkdisplaymgr-x11.h"
|
||||
|
||||
static GdkDeviceAxis gdk_input_core_axes[] = {
|
||||
{ GDK_AXIS_X, 0, 0 },
|
||||
@@ -43,13 +45,11 @@ GdkDevice *gdk_core_pointer = NULL;
|
||||
|
||||
/* Global variables */
|
||||
|
||||
/* information about network port and host for gxid daemon */
|
||||
/* information about network port and host for gxid daemon
|
||||
* use the GdkDisplayImplX11 equivalent members, these are
|
||||
* command line arguments */
|
||||
gchar *gdk_input_gxid_host;
|
||||
gint gdk_input_gxid_port;
|
||||
gint gdk_input_ignore_core;
|
||||
|
||||
GList *gdk_input_devices;
|
||||
GList *gdk_input_windows;
|
||||
|
||||
void
|
||||
_gdk_init_input_core (void)
|
||||
@@ -94,10 +94,19 @@ gdk_device_get_type (void)
|
||||
return object_type;
|
||||
}
|
||||
|
||||
#ifndef GDK_MULTIHEAD_SAFE
|
||||
GList *
|
||||
gdk_devices_list (void)
|
||||
{
|
||||
return gdk_input_devices;
|
||||
return GDK_DISPLAY_IMPL_X11(gdk_get_default_display ())->gdk_input_devices;
|
||||
}
|
||||
#endif
|
||||
|
||||
GList *
|
||||
gdk_devices_list_for_display (GdkDisplay *display)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
|
||||
return GDK_DISPLAY_IMPL_X11 (display)->gdk_input_devices;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -232,8 +241,9 @@ GdkInputWindow *
|
||||
gdk_input_window_find(GdkWindow *window)
|
||||
{
|
||||
GList *tmp_list;
|
||||
GdkDisplayImplX11 *display_impl = GDK_DISPLAY_IMPL_X11(GDK_WINDOW_DISPLAY (window));
|
||||
|
||||
for (tmp_list=gdk_input_windows; tmp_list; tmp_list=tmp_list->next)
|
||||
for (tmp_list=display_impl->gdk_input_windows; tmp_list; tmp_list=tmp_list->next)
|
||||
if (((GdkInputWindow *)(tmp_list->data))->window == window)
|
||||
return (GdkInputWindow *)(tmp_list->data);
|
||||
|
||||
@@ -253,11 +263,13 @@ gdk_input_set_extension_events (GdkWindow *window, gint mask,
|
||||
GdkWindowObject *window_private;
|
||||
GList *tmp_list;
|
||||
GdkInputWindow *iw;
|
||||
GdkDisplayImplX11 *display_impl;
|
||||
|
||||
g_return_if_fail (window != NULL);
|
||||
g_return_if_fail (GDK_IS_WINDOW (window));
|
||||
|
||||
window_private = (GdkWindowObject*) window;
|
||||
display_impl = GDK_DISPLAY_IMPL_X11 (GDK_WINDOW_DISPLAY (window));
|
||||
if (GDK_WINDOW_DESTROYED (window))
|
||||
return;
|
||||
|
||||
@@ -275,7 +287,8 @@ gdk_input_set_extension_events (GdkWindow *window, gint mask,
|
||||
iw->num_obscuring = 0;
|
||||
iw->grabbed = FALSE;
|
||||
|
||||
gdk_input_windows = g_list_append(gdk_input_windows,iw);
|
||||
display_impl->gdk_input_windows =
|
||||
g_list_append(display_impl->gdk_input_windows,iw);
|
||||
window_private->extension_events = mask;
|
||||
|
||||
/* Add enter window events to the event mask */
|
||||
@@ -289,14 +302,15 @@ gdk_input_set_extension_events (GdkWindow *window, gint mask,
|
||||
iw = gdk_input_window_find (window);
|
||||
if (iw)
|
||||
{
|
||||
gdk_input_windows = g_list_remove(gdk_input_windows,iw);
|
||||
display_impl->gdk_input_windows =
|
||||
g_list_remove(display_impl->gdk_input_windows,iw);
|
||||
g_free(iw);
|
||||
}
|
||||
|
||||
window_private->extension_events = 0;
|
||||
}
|
||||
|
||||
for (tmp_list = gdk_input_devices; tmp_list; tmp_list = tmp_list->next)
|
||||
for (tmp_list = display_impl->gdk_input_devices; tmp_list; tmp_list = tmp_list->next)
|
||||
{
|
||||
GdkDevicePrivate *gdkdev = tmp_list->data;
|
||||
|
||||
@@ -315,11 +329,15 @@ void
|
||||
gdk_input_window_destroy (GdkWindow *window)
|
||||
{
|
||||
GdkInputWindow *input_window;
|
||||
GdkDisplayImplX11 *display_impl =
|
||||
GDK_DISPLAY_IMPL_X11 (GDK_WINDOW_DISPLAY (window));
|
||||
|
||||
input_window = gdk_input_window_find (window);
|
||||
g_return_if_fail (input_window != NULL);
|
||||
|
||||
|
||||
gdk_input_windows = g_list_remove (gdk_input_windows,input_window);
|
||||
display_impl->gdk_input_windows = g_list_remove (display_impl->gdk_input_windows,
|
||||
input_window);
|
||||
g_free(input_window);
|
||||
}
|
||||
|
||||
@@ -327,31 +345,38 @@ void
|
||||
gdk_input_exit (void)
|
||||
{
|
||||
GList *tmp_list;
|
||||
GSList *display_list;
|
||||
GdkDevicePrivate *gdkdev;
|
||||
GSList * open_displays =
|
||||
gdk_x11_display_manager_get_open_displays (gdk_get_display_manager());
|
||||
|
||||
for (tmp_list = gdk_input_devices; tmp_list; tmp_list = tmp_list->next)
|
||||
for (display_list = open_displays ; display_list ; display_list = display_list->next)
|
||||
{
|
||||
gdkdev = (GdkDevicePrivate *)(tmp_list->data);
|
||||
if (!GDK_IS_CORE (gdkdev))
|
||||
GdkDisplayImplX11 *display_impl = GDK_DISPLAY_IMPL_X11 (display_impl);
|
||||
|
||||
for (tmp_list = display_impl->gdk_input_devices; tmp_list; tmp_list = tmp_list->next)
|
||||
{
|
||||
gdk_device_set_mode (&gdkdev->info, GDK_MODE_DISABLED);
|
||||
|
||||
g_free(gdkdev->info.name);
|
||||
gdkdev = (GdkDevicePrivate *)(tmp_list->data);
|
||||
if (!GDK_IS_CORE (gdkdev))
|
||||
{
|
||||
gdk_device_set_mode (&gdkdev->info, GDK_MODE_DISABLED);
|
||||
|
||||
g_free(gdkdev->info.name);
|
||||
#ifndef XINPUT_NONE
|
||||
g_free(gdkdev->axes);
|
||||
g_free(gdkdev->axes);
|
||||
#endif
|
||||
g_free(gdkdev->info.axes);
|
||||
g_free(gdkdev->info.keys);
|
||||
g_free(gdkdev);
|
||||
g_free(gdkdev->info.axes);
|
||||
g_free(gdkdev->info.keys);
|
||||
g_free(gdkdev);
|
||||
}
|
||||
}
|
||||
g_list_free(display_impl->gdk_input_devices);
|
||||
|
||||
for (tmp_list = display_impl->gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
|
||||
g_free(tmp_list->data);
|
||||
|
||||
g_list_free(display_impl->gdk_input_windows);
|
||||
}
|
||||
|
||||
g_list_free(gdk_input_devices);
|
||||
|
||||
for (tmp_list = gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
|
||||
g_free(tmp_list->data);
|
||||
|
||||
g_list_free(gdk_input_windows);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -67,6 +67,8 @@ struct _GdkDevicePrivate
|
||||
GdkDevice info;
|
||||
|
||||
guint32 deviceid;
|
||||
|
||||
GdkDisplay *display;
|
||||
|
||||
|
||||
#ifndef XINPUT_NONE
|
||||
@@ -126,13 +128,9 @@ struct _GdkInputWindow
|
||||
|
||||
#define GDK_IS_CORE(d) (((GdkDevice *)(d)) == gdk_core_pointer)
|
||||
|
||||
extern GList *gdk_input_devices;
|
||||
extern GList *gdk_input_windows;
|
||||
|
||||
/* information about network port and host for gxid daemon */
|
||||
extern gchar *gdk_input_gxid_host;
|
||||
extern gint gdk_input_gxid_port;
|
||||
extern gint gdk_input_ignore_core;
|
||||
|
||||
/* Function declarations */
|
||||
|
||||
@@ -163,7 +161,8 @@ gint _gdk_input_grab_pointer (GdkWindow *window,
|
||||
GdkEventMask event_mask,
|
||||
GdkWindow *confine_to,
|
||||
guint32 time);
|
||||
void _gdk_input_ungrab_pointer (guint32 time);
|
||||
void _gdk_input_ungrab_pointer (GdkDisplay *display,
|
||||
guint32 time);
|
||||
gboolean _gdk_device_get_history (GdkDevice *device,
|
||||
GdkWindow *window,
|
||||
guint32 start,
|
||||
@@ -175,8 +174,15 @@ gboolean _gdk_device_get_history (GdkDevice *device,
|
||||
|
||||
#define GDK_MAX_DEVICE_CLASSES 13
|
||||
|
||||
#ifndef GDK_MULTIHEAD_SAFE
|
||||
void _gdk_input_ungrab_pointer (guint32 time);
|
||||
gint gdk_input_common_init (gint include_core);
|
||||
GdkDevicePrivate * gdk_input_find_device (guint32 id);
|
||||
#endif
|
||||
gint gdk_input_common_init_for_display (GdkDisplay *display,
|
||||
gint include_core);
|
||||
GdkDevicePrivate * gdk_input_find_device_for_display (GdkDisplay *display,
|
||||
guint32 id);
|
||||
void gdk_input_get_root_relative_geometry (Display *display,
|
||||
Window w,
|
||||
int *x_ret,
|
||||
|
||||
@@ -174,7 +174,8 @@ gtk_input_dialog_init (GtkInputDialog *inputd)
|
||||
GList *tmp_list;
|
||||
GList *device_info;
|
||||
|
||||
device_info = gdk_devices_list ();
|
||||
device_info =
|
||||
gdk_devices_list_for_display (gtk_widget_get_display (GTK_WIDGET (inputd)));
|
||||
|
||||
/* shell and main vbox */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user