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 "gdkdevicemanager-core.h"
24 #include "gdkdevicemanager-xi.h"
26 #include "gdkdevicemanager-xi2.h"
32 _gdk_device_manager_new (GdkDisplay *display)
34 if (!g_getenv ("GDK_CORE_DEVICE_EVENTS"))
36 #if defined (XINPUT_2) || defined (XINPUT_XFREE)
37 int opcode, firstevent, firsterror;
40 xdisplay = GDK_DISPLAY_XDISPLAY (display);
42 if (XQueryExtension (xdisplay, "XInputExtension",
43 &opcode, &firstevent, &firsterror))
51 if (_gdk_enable_multidevice &&
52 XIQueryVersion (xdisplay, &major, &minor) != BadRequest)
54 GdkDeviceManagerXI2 *device_manager_xi2;
56 GDK_NOTE (INPUT, g_print ("Creating XI2 device manager\n"));
58 device_manager_xi2 = g_object_new (GDK_TYPE_DEVICE_MANAGER_XI2,
61 device_manager_xi2->opcode = opcode;
63 return GDK_DEVICE_MANAGER (device_manager_xi2);
68 GDK_NOTE (INPUT, g_print ("Creating XI device manager\n"));
70 return g_object_new (GDK_TYPE_DEVICE_MANAGER_XI,
72 "event-base", firstevent,
76 #endif /* XINPUT_2 || XINPUT_XFREE */
79 GDK_NOTE (INPUT, g_print ("Creating core device manager\n"));
81 return g_object_new (GDK_TYPE_DEVICE_MANAGER_CORE,