1 /* GDK - The GIMP Drawing Kit
2 * Copyright (C) 2009 Carlos Garnacho <carlosg@gnome.org>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
22 #include "gdkx11devicemanager-core.h"
24 #include "gdkx11devicemanager-xi.h"
26 #include "gdkx11devicemanager-xi2.h"
29 #include "gdkinternals.h"
30 #include "gdkprivate-x11.h"
33 _gdk_x11_device_manager_new (GdkDisplay *display)
35 if (!g_getenv ("GDK_CORE_DEVICE_EVENTS"))
37 #if defined (XINPUT_2) || defined (XINPUT_XFREE)
38 int opcode, firstevent, firsterror;
41 xdisplay = GDK_DISPLAY_XDISPLAY (display);
43 if (XQueryExtension (xdisplay, "XInputExtension",
44 &opcode, &firstevent, &firsterror))
52 if (!_gdk_disable_multidevice &&
53 XIQueryVersion (xdisplay, &major, &minor) != BadRequest)
55 GdkX11DeviceManagerXI2 *device_manager_xi2;
57 GDK_NOTE (INPUT, g_print ("Creating XI2 device manager\n"));
59 device_manager_xi2 = g_object_new (GDK_TYPE_X11_DEVICE_MANAGER_XI2,
62 device_manager_xi2->opcode = opcode;
64 return GDK_DEVICE_MANAGER (device_manager_xi2);
69 GDK_NOTE (INPUT, g_print ("Creating XI device manager\n"));
71 return g_object_new (GDK_TYPE_X11_DEVICE_MANAGER_XI,
73 "event-base", firstevent,
77 #endif /* XINPUT_2 || XINPUT_XFREE */
80 GDK_NOTE (INPUT, g_print ("Creating core device manager\n"));
82 return g_object_new (GDK_TYPE_X11_DEVICE_MANAGER_CORE,