summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2016-09-12 23:17:28 +0800
committerJonas Ådahl <jadahl@gmail.com>2016-09-15 09:54:55 +0800
commita6646b32d0b078948bbb47e84037f09b5b6ff990 (patch)
tree793d9495716c6939dc76bbaa84f4b5fbf26a9221
parentd2cdbd433d5a7218e1083b12e6914feecf242715 (diff)
downloadmutter-a6646b32d0b078948bbb47e84037f09b5b6ff990.tar.gz
wayland: Add common object for device classes
Add a new object class, MetaWaylandInputDevice, and make all device classes (pointer, keyboard, touch) inherit it. In the future common functionality may be placed there. https://bugzilla.gnome.org/show_bug.cgi?id=771305
-rw-r--r--src/Makefile.am2
-rw-r--r--src/wayland/meta-wayland-input-device.c41
-rw-r--r--src/wayland/meta-wayland-input-device.h41
-rw-r--r--src/wayland/meta-wayland-keyboard.c3
-rw-r--r--src/wayland/meta-wayland-keyboard.h4
-rw-r--r--src/wayland/meta-wayland-pointer.c3
-rw-r--r--src/wayland/meta-wayland-pointer.h5
-rw-r--r--src/wayland/meta-wayland-seat.h1
-rw-r--r--src/wayland/meta-wayland-touch.c3
-rw-r--r--src/wayland/meta-wayland-touch.h5
-rw-r--r--src/wayland/meta-wayland-types.h1
11 files changed, 99 insertions, 10 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 2e8d47ee2..da4e3df23 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -291,6 +291,8 @@ libmutter_la_SOURCES += \
wayland/meta-wayland-data-device.c \
wayland/meta-wayland-data-device.h \
wayland/meta-wayland-data-device-private.h \
+ wayland/meta-wayland-input-device.c \
+ wayland/meta-wayland-input-device.h \
wayland/meta-wayland-pointer-gestures.c \
wayland/meta-wayland-pointer-gestures.h \
wayland/meta-wayland-pointer-gesture-swipe.c \
diff --git a/src/wayland/meta-wayland-input-device.c b/src/wayland/meta-wayland-input-device.c
new file mode 100644
index 000000000..ed72eb24f
--- /dev/null
+++ b/src/wayland/meta-wayland-input-device.c
@@ -0,0 +1,41 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/*
+ * Copyright (C) 2016 Red Hat
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Written by:
+ * Jonas Ådahl <jadahl@gmail.com>
+ */
+
+#include "config.h"
+
+#include "wayland/meta-wayland-input-device.h"
+
+G_DEFINE_TYPE (MetaWaylandInputDevice,
+ meta_wayland_input_device,
+ G_TYPE_OBJECT)
+
+static void
+meta_wayland_input_device_init (MetaWaylandInputDevice *input_device)
+{
+}
+
+static void
+meta_wayland_input_device_class_init (MetaWaylandInputDeviceClass *klass)
+{
+}
diff --git a/src/wayland/meta-wayland-input-device.h b/src/wayland/meta-wayland-input-device.h
new file mode 100644
index 000000000..d76e91bd3
--- /dev/null
+++ b/src/wayland/meta-wayland-input-device.h
@@ -0,0 +1,41 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/*
+ * Copyright (C) 2016 Red Hat
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Written by:
+ * Jonas Ådahl <jadahl@gmail.com>
+ */
+
+#ifndef META_WAYLAND_INPUT_DEVICE_H
+#define META_WAYLAND_INPUT_DEVICE_H
+
+#include <glib-object.h>
+
+#define META_TYPE_WAYLAND_INPUT_DEVICE (meta_wayland_input_device_get_type ())
+G_DECLARE_DERIVABLE_TYPE (MetaWaylandInputDevice,
+ meta_wayland_input_device,
+ META, WAYLAND_INPUT_DEVICE,
+ GObject)
+
+struct _MetaWaylandInputDeviceClass
+{
+ GObjectClass parent_class;
+};
+
+#endif /* META_WAYLAND_INPUT_DEVICE_H */
diff --git a/src/wayland/meta-wayland-keyboard.c b/src/wayland/meta-wayland-keyboard.c
index 3c726e140..b6eade8c3 100644
--- a/src/wayland/meta-wayland-keyboard.c
+++ b/src/wayland/meta-wayland-keyboard.c
@@ -73,7 +73,8 @@ typedef enum
GSD_KEYBOARD_NUM_LOCK_STATE_OFF
} GsdKeyboardNumLockState;
-G_DEFINE_TYPE (MetaWaylandKeyboard, meta_wayland_keyboard, G_TYPE_OBJECT);
+G_DEFINE_TYPE (MetaWaylandKeyboard, meta_wayland_keyboard,
+ META_TYPE_WAYLAND_INPUT_DEVICE)
static void meta_wayland_keyboard_update_xkb_state (MetaWaylandKeyboard *keyboard);
static void meta_wayland_keyboard_set_numlock (MetaWaylandKeyboard *keyboard,
diff --git a/src/wayland/meta-wayland-keyboard.h b/src/wayland/meta-wayland-keyboard.h
index 5e7d84b2f..e87c4dd8f 100644
--- a/src/wayland/meta-wayland-keyboard.h
+++ b/src/wayland/meta-wayland-keyboard.h
@@ -54,7 +54,7 @@
#define META_TYPE_WAYLAND_KEYBOARD (meta_wayland_keyboard_get_type ())
G_DECLARE_FINAL_TYPE (MetaWaylandKeyboard, meta_wayland_keyboard,
META, WAYLAND_KEYBOARD,
- GObject);
+ MetaWaylandInputDevice)
struct _MetaWaylandKeyboardGrabInterface
{
@@ -81,7 +81,7 @@ typedef struct
struct _MetaWaylandKeyboard
{
- GObject parent;
+ MetaWaylandInputDevice parent;
MetaWaylandSeat *seat;
diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c
index 34e262bef..2af1736d9 100644
--- a/src/wayland/meta-wayland-pointer.c
+++ b/src/wayland/meta-wayland-pointer.c
@@ -83,7 +83,8 @@ enum {
static guint signals[LAST_SIGNAL];
-G_DEFINE_TYPE (MetaWaylandPointer, meta_wayland_pointer, G_TYPE_OBJECT);
+G_DEFINE_TYPE (MetaWaylandPointer, meta_wayland_pointer,
+ META_TYPE_WAYLAND_INPUT_DEVICE)
static MetaWaylandPointerClient *
meta_wayland_pointer_client_new (void)
diff --git a/src/wayland/meta-wayland-pointer.h b/src/wayland/meta-wayland-pointer.h
index 93bda6b39..58550fbc7 100644
--- a/src/wayland/meta-wayland-pointer.h
+++ b/src/wayland/meta-wayland-pointer.h
@@ -34,7 +34,8 @@
#define META_TYPE_WAYLAND_POINTER (meta_wayland_pointer_get_type ())
G_DECLARE_FINAL_TYPE (MetaWaylandPointer, meta_wayland_pointer,
- META, WAYLAND_POINTER, GObject);
+ META, WAYLAND_POINTER,
+ MetaWaylandInputDevice)
struct _MetaWaylandPointerGrabInterface
{
@@ -62,7 +63,7 @@ struct _MetaWaylandPointerClient
struct _MetaWaylandPointer
{
- GObject parent;
+ MetaWaylandInputDevice parent;
MetaWaylandSeat *seat;
diff --git a/src/wayland/meta-wayland-seat.h b/src/wayland/meta-wayland-seat.h
index 1b3cd8acd..52db07295 100644
--- a/src/wayland/meta-wayland-seat.h
+++ b/src/wayland/meta-wayland-seat.h
@@ -26,6 +26,7 @@
#include <clutter/clutter.h>
#include "meta-wayland-types.h"
+#include "meta-wayland-input-device.h"
#include "meta-wayland-pointer.h"
#include "meta-wayland-keyboard.h"
#include "meta-wayland-touch.h"
diff --git a/src/wayland/meta-wayland-touch.c b/src/wayland/meta-wayland-touch.c
index 440d6abe6..d3793d516 100644
--- a/src/wayland/meta-wayland-touch.c
+++ b/src/wayland/meta-wayland-touch.c
@@ -34,7 +34,8 @@
#include "backends/native/meta-backend-native.h"
#endif
-G_DEFINE_TYPE (MetaWaylandTouch, meta_wayland_touch, G_TYPE_OBJECT);
+G_DEFINE_TYPE (MetaWaylandTouch, meta_wayland_touch,
+ META_TYPE_WAYLAND_INPUT_DEVICE)
struct _MetaWaylandTouchSurface
{
diff --git a/src/wayland/meta-wayland-touch.h b/src/wayland/meta-wayland-touch.h
index 5b27c6a14..45f8337ed 100644
--- a/src/wayland/meta-wayland-touch.h
+++ b/src/wayland/meta-wayland-touch.h
@@ -31,15 +31,14 @@
#define META_TYPE_WAYLAND_TOUCH (meta_wayland_touch_get_type ())
G_DECLARE_FINAL_TYPE (MetaWaylandTouch, meta_wayland_touch,
META, WAYLAND_TOUCH,
- GObject);
-
+ MetaWaylandInputDevice)
typedef struct _MetaWaylandTouchSurface MetaWaylandTouchSurface;
typedef struct _MetaWaylandTouchInfo MetaWaylandTouchInfo;
struct _MetaWaylandTouch
{
- GObject parent;
+ MetaWaylandInputDevice parent;
MetaWaylandSeat *seat;
diff --git a/src/wayland/meta-wayland-types.h b/src/wayland/meta-wayland-types.h
index 11d76f499..6fcc67070 100644
--- a/src/wayland/meta-wayland-types.h
+++ b/src/wayland/meta-wayland-types.h
@@ -23,6 +23,7 @@
typedef struct _MetaWaylandCompositor MetaWaylandCompositor;
typedef struct _MetaWaylandSeat MetaWaylandSeat;
+typedef struct _MetaWaylandInputDevice MetaWaylandInputDevice;
typedef struct _MetaWaylandPointer MetaWaylandPointer;
typedef struct _MetaWaylandPointerGrab MetaWaylandPointerGrab;
typedef struct _MetaWaylandPointerGrabInterface MetaWaylandPointerGrabInterface;