[mutter] wayland: Add common object for device classes
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] wayland: Add common object for device classes
- Date: Thu, 15 Sep 2016 02:32:26 +0000 (UTC)
commit a6646b32d0b078948bbb47e84037f09b5b6ff990
Author: Jonas Ådahl <jadahl gmail com>
Date: Mon Sep 12 23:17:28 2016 +0800
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
src/Makefile.am | 2 +
src/wayland/meta-wayland-input-device.c | 41 +++++++++++++++++++++++++++++++
src/wayland/meta-wayland-input-device.h | 41 +++++++++++++++++++++++++++++++
src/wayland/meta-wayland-keyboard.c | 3 +-
src/wayland/meta-wayland-keyboard.h | 4 +-
src/wayland/meta-wayland-pointer.c | 3 +-
src/wayland/meta-wayland-pointer.h | 5 ++-
src/wayland/meta-wayland-seat.h | 1 +
src/wayland/meta-wayland-touch.c | 3 +-
src/wayland/meta-wayland-touch.h | 5 +--
src/wayland/meta-wayland-types.h | 1 +
11 files changed, 99 insertions(+), 10 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 2e8d47e..da4e3df 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 0000000..ed72eb2
--- /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 0000000..d76e91b
--- /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 3c726e1..b6eade8 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 5e7d84b..e87c4dd 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 34e262b..2af1736 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 93bda6b..58550fb 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 1b3cd8a..52db072 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 440d6ab..d3793d5 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 5b27c6a..45f8337 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 11d76f4..6fcc670 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]