mirror of
https://github.com/brl/mutter.git
synced 2024-11-27 18:40:40 -05:00
devices: Make MetaDevice/MetaDeviceMap partly public
MetaDevice is quite limited outside of the core, mostly useful to represent a device, and get the paired one.
This commit is contained in:
parent
e08c4756eb
commit
49dfb40b82
@ -76,13 +76,15 @@ libmutter_la_SOURCES = \
|
||||
core/core.c \
|
||||
core/delete.c \
|
||||
core/device.c \
|
||||
core/device.h \
|
||||
meta/device.h \
|
||||
core/device-keyboard.c \
|
||||
core/device-keyboard.h \
|
||||
core/device-pointer.c \
|
||||
core/device-pointer.h \
|
||||
core/device-private.h \
|
||||
core/device-map.c \
|
||||
core/device-map.h \
|
||||
meta/device-map.h \
|
||||
core/device-map-private.h \
|
||||
core/device-map-core.c \
|
||||
core/device-map-core.h \
|
||||
core/devices-core.c \
|
||||
@ -186,6 +188,8 @@ libmutterinclude_base_headers = \
|
||||
meta/common.h \
|
||||
meta/compositor-mutter.h \
|
||||
meta/compositor.h \
|
||||
meta/device.h \
|
||||
meta/device-map.h \
|
||||
meta/display.h \
|
||||
meta/errors.h \
|
||||
meta/gradient.h \
|
||||
|
@ -31,7 +31,7 @@
|
||||
#define META_DEVICE_KEYBOARD_H
|
||||
|
||||
#include "display-private.h"
|
||||
#include "device.h"
|
||||
#include "device-private.h"
|
||||
|
||||
#define META_TYPE_DEVICE_KEYBOARD (meta_device_keyboard_get_type ())
|
||||
#define META_DEVICE_KEYBOARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_DEVICE_KEYBOARD, MetaDeviceKeyboard))
|
||||
|
@ -32,7 +32,7 @@
|
||||
typedef struct _MetaDeviceMapCore MetaDeviceMapCore;
|
||||
typedef struct _MetaDeviceMapCoreClass MetaDeviceMapCoreClass;
|
||||
|
||||
#include "device-map.h"
|
||||
#include "device-map-private.h"
|
||||
|
||||
#define META_TYPE_DEVICE_MAP_CORE (meta_device_map_core_get_type ())
|
||||
#define META_DEVICE_MAP_CORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_DEVICE_MAP_CORE, MetaDeviceMapCore))
|
||||
|
@ -27,21 +27,13 @@
|
||||
* 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef META_DEVICE_MAP_H
|
||||
#define META_DEVICE_MAP_H
|
||||
|
||||
typedef struct _MetaDeviceMap MetaDeviceMap;
|
||||
typedef struct _MetaDeviceMapClass MetaDeviceMapClass;
|
||||
#ifndef META_DEVICE_MAP_PRIVATE_H
|
||||
#define META_DEVICE_MAP_PRIVATE_H
|
||||
|
||||
#include <meta/device-map.h>
|
||||
#include <meta/device.h>
|
||||
#include "display-private.h"
|
||||
#include "device.h"
|
||||
|
||||
#define META_TYPE_DEVICE_MAP (meta_device_map_get_type ())
|
||||
#define META_DEVICE_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_DEVICE_MAP, MetaDeviceMap))
|
||||
#define META_DEVICE_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_DEVICE_MAP, MetaDeviceMapClass))
|
||||
#define META_IS_DEVICE_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_DEVICE_MAP))
|
||||
#define META_IS_DEVICE_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_DEVICE_MAP))
|
||||
#define META_DEVICE_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_DEVICE_MAP, MetaDeviceMapClass))
|
||||
#include "device-private.h"
|
||||
|
||||
struct _MetaDeviceMap
|
||||
{
|
||||
@ -90,11 +82,6 @@ void meta_device_map_add_device (MetaDeviceMap *device_map,
|
||||
void meta_device_map_remove_device (MetaDeviceMap *device_map,
|
||||
MetaDevice *device);
|
||||
|
||||
MetaDevice * meta_device_map_lookup (MetaDeviceMap *device_map,
|
||||
gint device_id);
|
||||
|
||||
MetaDisplay * meta_device_map_get_display (MetaDeviceMap *device_map);
|
||||
|
||||
gboolean meta_device_map_grab_key (MetaDeviceMap *device_map,
|
||||
Window xwindow,
|
||||
guint keycode,
|
||||
@ -115,5 +102,4 @@ void meta_device_map_ungrab_button (MetaDeviceMap *device_map,
|
||||
guint n_button,
|
||||
guint modifiers);
|
||||
|
||||
|
||||
#endif /* META_DEVICE_MAP_H */
|
||||
#endif /* META_DEVICE_MAP_PRIVATE_H */
|
@ -32,7 +32,7 @@
|
||||
typedef struct _MetaDeviceMapXI2 MetaDeviceMapXI2;
|
||||
typedef struct _MetaDeviceMapXI2Class MetaDeviceMapXI2Class;
|
||||
|
||||
#include "device-map.h"
|
||||
#include "device-map-private.h"
|
||||
|
||||
#define META_TYPE_DEVICE_MAP_XI2 (meta_device_map_xi2_get_type ())
|
||||
#define META_DEVICE_MAP_XI2(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_DEVICE_MAP_XI2, MetaDeviceMapXI2))
|
||||
|
@ -22,7 +22,7 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "device-map.h"
|
||||
#include "device-map-private.h"
|
||||
#include "device-map-core.h"
|
||||
|
||||
#ifdef HAVE_XINPUT2
|
||||
@ -250,6 +250,15 @@ meta_device_map_new (MetaDisplay *display,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_device_map_lookup:
|
||||
* @device_map: a #MetaDeviceMap
|
||||
* @device_id: ID for a device
|
||||
*
|
||||
* returns the device corresponding to @device_id
|
||||
*
|
||||
* Returns: (transfer none): (allow-none): The matching device, or %NULL.
|
||||
**/
|
||||
MetaDevice *
|
||||
meta_device_map_lookup (MetaDeviceMap *device_map,
|
||||
gint device_id)
|
||||
@ -263,6 +272,14 @@ meta_device_map_lookup (MetaDeviceMap *device_map,
|
||||
GINT_TO_POINTER (device_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_device_map_get_display:
|
||||
* @device_map: a #MetaDeviceMap
|
||||
*
|
||||
* Returns the #MetaDisplay to which @device_map belongs to.
|
||||
*
|
||||
* Returns: (transfer none): The #MetaDisplay.
|
||||
**/
|
||||
MetaDisplay *
|
||||
meta_device_map_get_display (MetaDeviceMap *device_map)
|
||||
{
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
#include "display-private.h"
|
||||
#include <meta/screen.h>
|
||||
#include "device.h"
|
||||
#include "device-private.h"
|
||||
|
||||
#define META_TYPE_DEVICE_POINTER (meta_device_pointer_get_type ())
|
||||
#define META_DEVICE_POINTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_DEVICE_POINTER, MetaDevicePointer))
|
||||
|
@ -27,21 +27,12 @@
|
||||
* 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef META_DEVICE_H
|
||||
#define META_DEVICE_H
|
||||
|
||||
typedef struct _MetaDevice MetaDevice;
|
||||
typedef struct _MetaDeviceClass MetaDeviceClass;
|
||||
#ifndef META_DEVICE_PRIVATE_H
|
||||
#define META_DEVICE_PRIVATE_H
|
||||
|
||||
#include <meta/device.h>
|
||||
#include "display-private.h"
|
||||
|
||||
#define META_TYPE_DEVICE (meta_device_get_type ())
|
||||
#define META_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_DEVICE, MetaDevice))
|
||||
#define META_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_DEVICE, MetaDeviceClass))
|
||||
#define META_IS_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_DEVICE))
|
||||
#define META_IS_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_DEVICE))
|
||||
#define META_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_DEVICE, MetaDeviceClass))
|
||||
|
||||
struct _MetaDevice
|
||||
{
|
||||
GObject parent_instance;
|
||||
@ -69,9 +60,6 @@ struct _MetaDeviceClass
|
||||
|
||||
GType meta_device_get_type (void) G_GNUC_CONST;
|
||||
|
||||
int meta_device_get_id (MetaDevice *device);
|
||||
MetaDisplay *meta_device_get_display (MetaDevice *device);
|
||||
|
||||
void meta_device_allow_events (MetaDevice *device,
|
||||
int mode,
|
||||
Time time);
|
||||
@ -88,6 +76,5 @@ void meta_device_ungrab (MetaDevice *device,
|
||||
|
||||
void meta_device_pair_devices (MetaDevice *device,
|
||||
MetaDevice *other_device);
|
||||
MetaDevice * meta_device_get_paired_device (MetaDevice *device);
|
||||
|
||||
#endif /* META_DEVICE_H */
|
||||
#endif /* META_DEVICE_PRIVATE_H */
|
@ -22,7 +22,7 @@
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "device.h"
|
||||
#include "device-private.h"
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE (MetaDevice, meta_device, G_TYPE_OBJECT)
|
||||
|
||||
@ -148,6 +148,14 @@ meta_device_get_id (MetaDevice *device)
|
||||
return priv->device_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_device_get_display:
|
||||
* @device: a #MetaDevice
|
||||
*
|
||||
* Returns the #MetaDisplay to which the device belongs
|
||||
*
|
||||
* Returns: (transfer none): the #MetaDisplay to which the device belongs
|
||||
**/
|
||||
MetaDisplay *
|
||||
meta_device_get_display (MetaDevice *device)
|
||||
{
|
||||
@ -242,6 +250,14 @@ meta_device_pair_devices (MetaDevice *device,
|
||||
g_object_notify (G_OBJECT (other_device), "paired-device");
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_device_get_paired_device:
|
||||
* @device: a #MetaDevice
|
||||
*
|
||||
* Returns the paired device. Devices come in keyboard/pointer pairs.
|
||||
*
|
||||
* Returns: (transfer none): The paired device.
|
||||
**/
|
||||
MetaDevice *
|
||||
meta_device_get_paired_device (MetaDevice *device)
|
||||
{
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include <meta/boxes.h>
|
||||
#include <meta/display.h>
|
||||
#include "keybindings-private.h"
|
||||
#include "device-map.h"
|
||||
#include "device-map-private.h"
|
||||
#include <meta/prefs.h>
|
||||
|
||||
#ifdef HAVE_STARTUP_NOTIFICATION
|
||||
|
@ -48,7 +48,7 @@
|
||||
#include "xprops.h"
|
||||
#include "workspace-private.h"
|
||||
#include "bell.h"
|
||||
#include "device.h"
|
||||
#include "device-private.h"
|
||||
#include "input-events.h"
|
||||
#include <meta/compositor.h>
|
||||
#include <X11/Xatom.h>
|
||||
@ -5537,3 +5537,19 @@ meta_display_get_leader_window (MetaDisplay *display)
|
||||
{
|
||||
return display->leader_window;
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_display_get_device_map:
|
||||
* @display: a #MetaDisplay
|
||||
*
|
||||
* Returns the MetaDeviceMap used to handle the display devices.
|
||||
*
|
||||
* Returns: (transfer none): The display's #MetaDeviceMap
|
||||
**/
|
||||
MetaDeviceMap *
|
||||
meta_display_get_device_map (MetaDisplay *display)
|
||||
{
|
||||
g_return_val_if_fail (META_IS_DISPLAY (display), NULL);
|
||||
|
||||
return display->device_map;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include <config.h>
|
||||
#include "input-events.h"
|
||||
#include "devices-core.h"
|
||||
#include "device-map.h"
|
||||
#include "device-map-private.h"
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#ifdef HAVE_XINPUT2
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include <config.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include "display-private.h"
|
||||
#include "device-map.h"
|
||||
#include <meta/device-map.h>
|
||||
|
||||
gboolean meta_input_event_get_type (MetaDisplay *display,
|
||||
XEvent *ev,
|
||||
|
45
src/meta/device-map.h
Normal file
45
src/meta/device-map.h
Normal file
@ -0,0 +1,45 @@
|
||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011 Carlos Garnacho
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef META_DEVICE_MAP_H
|
||||
#define META_DEVICE_MAP_H
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <meta/types.h>
|
||||
#include <meta/device.h>
|
||||
|
||||
#define META_TYPE_DEVICE_MAP (meta_device_map_get_type ())
|
||||
#define META_DEVICE_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_DEVICE_MAP, MetaDeviceMap))
|
||||
#define META_DEVICE_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_DEVICE_MAP, MetaDeviceMapClass))
|
||||
#define META_IS_DEVICE_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_DEVICE_MAP))
|
||||
#define META_IS_DEVICE_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_DEVICE_MAP))
|
||||
#define META_DEVICE_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_DEVICE_MAP, MetaDeviceMapClass))
|
||||
|
||||
typedef struct _MetaDeviceMapClass MetaDeviceMapClass;
|
||||
|
||||
GType meta_device_map_get_type (void) G_GNUC_CONST;
|
||||
|
||||
MetaDevice * meta_device_map_lookup (MetaDeviceMap *device_map,
|
||||
gint device_id);
|
||||
|
||||
MetaDisplay * meta_device_map_get_display (MetaDeviceMap *device_map);
|
||||
|
||||
#endif
|
@ -28,6 +28,7 @@
|
||||
#include <meta/types.h>
|
||||
#include <meta/prefs.h>
|
||||
#include <meta/common.h>
|
||||
#include <meta/device-map.h>
|
||||
|
||||
typedef enum
|
||||
{
|
||||
@ -155,4 +156,6 @@ GSList *meta_display_sort_windows_by_stacking (MetaDisplay *display,
|
||||
|
||||
Window meta_display_get_leader_window (MetaDisplay *display);
|
||||
|
||||
MetaDeviceMap * meta_display_get_device_map (MetaDisplay *display);
|
||||
|
||||
#endif
|
||||
|
@ -32,6 +32,8 @@ typedef struct _MetaFrame MetaFrame;
|
||||
typedef struct _MetaScreen MetaScreen;
|
||||
typedef struct _MetaWindow MetaWindow;
|
||||
typedef struct _MetaWorkspace MetaWorkspace;
|
||||
typedef struct _MetaDevice MetaDevice;
|
||||
typedef struct _MetaDeviceMap MetaDeviceMap;
|
||||
/**
|
||||
* MetaGroup: (skip)
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user