x11: Stop deriving from GdkDeviceManager

We can just derive from GObject.
This commit is contained in:
Matthias Clasen 2017-11-25 08:23:25 -05:00
parent da8bcc7ed9
commit bad53bc201
7 changed files with 27 additions and 36 deletions

View File

@ -125,7 +125,6 @@ create_core_pointer (GdkX11DeviceManagerCore *device_manager,
"input-mode", GDK_MODE_SCREEN,
"has-cursor", TRUE,
"display", display,
"device-manager", device_manager,
NULL);
}
@ -140,7 +139,6 @@ create_core_keyboard (GdkX11DeviceManagerCore *device_manager,
"input-mode", GDK_MODE_SCREEN,
"has-cursor", FALSE,
"display", display,
"device-manager", device_manager,
NULL);
}
@ -338,12 +336,10 @@ static GdkWindow *
get_event_window (GdkEventTranslator *translator,
XEvent *xevent)
{
GdkDeviceManager *device_manager;
GdkDisplay *display;
GdkWindow *window;
device_manager = GDK_DEVICE_MANAGER (translator);
display = GDK_X11_DEVICE_MANAGER_CORE (device_manager)->display;
display = GDK_X11_DEVICE_MANAGER_CORE (translator)->display;
window = gdk_x11_window_lookup_for_display (display, xevent->xany.window);
/* Apply keyboard grabs to non-native windows */
@ -354,7 +350,7 @@ get_event_window (GdkEventTranslator *translator,
serial = _gdk_display_get_next_serial (display);
info = _gdk_display_has_device_grab (display,
GDK_X11_DEVICE_MANAGER_CORE (device_manager)->core_keyboard,
GDK_X11_DEVICE_MANAGER_CORE (translator)->core_keyboard,
serial);
if (info &&
(!is_parent_of (info->window, window) ||

View File

@ -33,7 +33,7 @@
static gboolean _gdk_disable_multidevice = FALSE;
GdkDeviceManager *
GdkX11DeviceManagerCore *
_gdk_x11_device_manager_new (GdkDisplay *display)
{
if (!g_getenv ("GDK_CORE_DEVICE_EVENTS"))
@ -66,7 +66,7 @@ _gdk_x11_device_manager_new (GdkDisplay *display)
"minor", minor,
NULL);
return GDK_DEVICE_MANAGER (device_manager_xi2);
return GDK_X11_DEVICE_MANAGER_CORE (device_manager_xi2);
}
}
#endif /* XINPUT_2 */
@ -92,12 +92,12 @@ _gdk_x11_device_manager_new (GdkDisplay *display)
* Since: 3.2
**/
GdkDevice *
gdk_x11_device_manager_lookup (GdkDeviceManager *device_manager,
gint device_id)
gdk_x11_device_manager_lookup (GdkX11DeviceManagerCore *device_manager,
gint device_id)
{
GdkDevice *device = NULL;
g_return_val_if_fail (GDK_IS_DEVICE_MANAGER (device_manager), NULL);
g_return_val_if_fail (GDK_IS_X11_DEVICE_MANAGER_CORE (device_manager), NULL);
#ifdef XINPUT_2
if (GDK_IS_X11_DEVICE_MANAGER_XI2 (device_manager))

View File

@ -74,7 +74,7 @@ static void gdk_x11_device_manager_xi2_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
static GdkDevice * gdk_x11_device_manager_xi2_get_client_pointer (GdkDeviceManager *device_manager);
static GdkDevice * gdk_x11_device_manager_xi2_get_client_pointer (GdkX11DeviceManagerXI2 *device_manager);
static gboolean gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
GdkDisplay *display,
@ -140,9 +140,9 @@ gdk_x11_device_manager_xi2_init (GdkX11DeviceManagerXI2 *device_manager)
}
static void
_gdk_x11_device_manager_xi2_select_events (GdkDeviceManager *device_manager,
Window xwindow,
XIEventMask *event_mask)
_gdk_x11_device_manager_xi2_select_events (GdkX11DeviceManagerXI2 *device_manager,
Window xwindow,
XIEventMask *event_mask)
{
GdkDisplay *display;
Display *xdisplay;
@ -402,9 +402,9 @@ is_touchpad_device (GdkDisplay *display,
}
static GdkDevice *
create_device (GdkDeviceManager *device_manager,
GdkDisplay *display,
XIDeviceInfo *dev)
create_device (GdkX11DeviceManagerXI2 *device_manager,
GdkDisplay *display,
XIDeviceInfo *dev)
{
GdkInputSource input_source;
GdkInputSource touch_source;
@ -496,7 +496,6 @@ create_device (GdkDeviceManager *device_manager,
"input-mode", mode,
"has-cursor", (dev->use == XIMasterPointer),
"display", display,
"device-manager", device_manager,
"device-id", dev->deviceid,
"vendor-id", vendor_id,
"product-id", product_id,
@ -550,7 +549,7 @@ add_device (GdkX11DeviceManagerXI2 *device_manager,
GdkDevice *device;
display = GDK_X11_DEVICE_MANAGER_CORE (device_manager)->display;
device = create_device (GDK_DEVICE_MANAGER (device_manager), display, dev);
device = create_device (device_manager, display, dev);
g_hash_table_replace (device_manager->id_table,
GINT_TO_POINTER (dev->deviceid),
@ -737,7 +736,7 @@ gdk_x11_device_manager_xi2_constructed (GObject *object)
event_mask.mask_len = sizeof (mask);
event_mask.mask = mask;
_gdk_x11_device_manager_xi2_select_events (GDK_DEVICE_MANAGER (object),
_gdk_x11_device_manager_xi2_select_events (device_manager,
GDK_DISPLAY_XROOTWIN (display),
&event_mask);
}
@ -762,19 +761,17 @@ gdk_x11_device_manager_xi2_dispose (GObject *object)
}
static GdkDevice *
gdk_x11_device_manager_xi2_get_client_pointer (GdkDeviceManager *device_manager)
gdk_x11_device_manager_xi2_get_client_pointer (GdkX11DeviceManagerXI2 *device_manager)
{
GdkX11DeviceManagerXI2 *device_manager_xi2;
GdkDisplay *display;
int device_id;
device_manager_xi2 = (GdkX11DeviceManagerXI2 *) device_manager;
display = GDK_X11_DEVICE_MANAGER_CORE (device_manager)->display;
XIGetClientPointer (GDK_DISPLAY_XDISPLAY (display),
None, &device_id);
return g_hash_table_lookup (device_manager_xi2->id_table,
return g_hash_table_lookup (device_manager->id_table,
GINT_TO_POINTER (device_id));
}
@ -1291,7 +1288,7 @@ gdk_x11_device_manager_xi2_translate_core_event (GdkEventTranslator *translator,
* We need to override that with an XI2 device, since we are
* using XI2.
*/
device = gdk_x11_device_manager_xi2_get_client_pointer ((GdkDeviceManager *)translator);
device = gdk_x11_device_manager_xi2_get_client_pointer ((GdkX11DeviceManagerXI2 *)translator);
if (keyboard)
device = gdk_device_get_associated_device (device);
gdk_event_set_device (event, device);
@ -1933,17 +1930,14 @@ gdk_x11_device_manager_xi2_select_window_events (GdkEventTranslator *translator,
Window window,
GdkEventMask evmask)
{
GdkDeviceManager *device_manager;
XIEventMask event_mask;
device_manager = GDK_DEVICE_MANAGER (translator);
event_mask.deviceid = XIAllMasterDevices;
event_mask.mask = _gdk_x11_device_xi2_translate_event_mask (GDK_X11_DEVICE_MANAGER_XI2 (device_manager),
event_mask.mask = _gdk_x11_device_xi2_translate_event_mask (GDK_X11_DEVICE_MANAGER_XI2 (translator),
evmask,
&event_mask.mask_len);
_gdk_x11_device_manager_xi2_select_events (device_manager, window, &event_mask);
_gdk_x11_device_manager_xi2_select_events (GDK_X11_DEVICE_MANAGER_XI2 (translator), window, &event_mask);
g_free (event_mask.mask);
}

View File

@ -33,7 +33,6 @@
#include "gdkinternals.h"
#include "gdkdeviceprivate.h"
#include "gdkkeysprivate.h"
#include "gdkdevicemanager.h"
#include "xsettings-client.h"
#include "gdkdisplay-x11.h"
#include "gdkprivate-x11.h"

View File

@ -27,6 +27,7 @@
#include "gdkwindow.h"
#include "gdkinternals.h"
#include "gdkx11screen.h"
#include "gdkx11devicemanager.h"
#include <X11/X.h>
#include <X11/Xlib.h>
@ -41,7 +42,7 @@ struct _GdkX11Display
GdkX11Screen *screen;
GList *screens;
GList *toplevels;
GdkDeviceManager *device_manager;
GdkX11DeviceManagerCore *device_manager;
GSource *event_source;

View File

@ -194,7 +194,7 @@ gchar * _gdk_x11_display_utf8_to_string_target (GdkDisplay *display
void _gdk_x11_device_check_extension_events (GdkDevice *device);
GdkDeviceManager *_gdk_x11_device_manager_new (GdkDisplay *display);
GdkX11DeviceManagerCore *_gdk_x11_device_manager_new (GdkDisplay *display);
#ifdef XINPUT_2
guchar * _gdk_x11_device_xi2_translate_event_mask (GdkX11DeviceManagerXI2 *device_manager_xi2,

View File

@ -23,6 +23,7 @@
#endif
#include <gdk/gdk.h>
#include <gdk/x11/gdkx11devicemanager-core.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
@ -30,8 +31,8 @@
G_BEGIN_DECLS
GDK_AVAILABLE_IN_3_2
GdkDevice * gdk_x11_device_manager_lookup (GdkDeviceManager *device_manager,
gint device_id);
GdkDevice * gdk_x11_device_manager_lookup (GdkX11DeviceManagerCore *device_manager,
gint device_id);
GDK_AVAILABLE_IN_ALL
void gdk_disable_multidevice (void);