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
This commit is contained in:
Jonas Ådahl 2016-09-12 23:17:28 +08:00
parent d2cdbd433d
commit a6646b32d0
11 changed files with 99 additions and 10 deletions

View File

@ -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 \

View File

@ -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)
{
}

View File

@ -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 */

View File

@ -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,

View File

@ -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;

View File

@ -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)

View File

@ -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;

View File

@ -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"

View File

@ -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
{

View File

@ -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;

View File

@ -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;