summaryrefslogtreecommitdiffstats
path: root/panels/common/gsd-device-manager.h
blob: f48b5ad2cb4d17dc5e9d45c0391dd07ee77e06a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
 *
 * Copyright (C) 2014 Carlos Garnacho <carlosg@gnome.org>
 *
 * 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.
 */

#pragma once

#include <gdk/gdk.h>
#include <glib-object.h>
#include <gio/gio.h>

G_BEGIN_DECLS

#define GSD_TYPE_DEVICE (gsd_device_get_type ())
G_DECLARE_DERIVABLE_TYPE (GsdDevice, gsd_device, GSD, DEVICE, GObject)

#define GSD_TYPE_DEVICE_MANAGER (gsd_device_manager_get_type ())
G_DECLARE_DERIVABLE_TYPE (GsdDeviceManager, gsd_device_manager, GSD, DEVICE_MANAGER, GObject)

typedef enum {
	GSD_DEVICE_TYPE_MOUSE	     = 1 << 0,
	GSD_DEVICE_TYPE_KEYBOARD     = 1 << 1,
	GSD_DEVICE_TYPE_TOUCHPAD     = 1 << 2,
	GSD_DEVICE_TYPE_TABLET	     = 1 << 3,
	GSD_DEVICE_TYPE_TOUCHSCREEN  = 1 << 4,
	GSD_DEVICE_TYPE_PAD          = 1 << 5
} GsdDeviceType;

struct _GsdDeviceClass {
	GObjectClass parent_class;
};

struct _GsdDeviceManagerClass
{
	GObjectClass parent_class;

	GList * (* list_devices) (GsdDeviceManager *manager,
				  GsdDeviceType	    type);

	void (* device_added)	(GsdDeviceManager *manager,
				 GsdDevice	  *device);
	void (* device_removed) (GsdDeviceManager *manager,
				 GsdDevice	  *device);
	void (* device_changed) (GsdDeviceManager *manager,
				 GsdDevice	  *device);

	GsdDevice * (* lookup_device) (GsdDeviceManager *manager,
				       GdkDevice	*gdk_device);
};

GsdDeviceManager * gsd_device_manager_get	      (void);
GList *		   gsd_device_manager_list_devices    (GsdDeviceManager *manager,
						       GsdDeviceType	 type);

const gchar *	   gsd_device_get_name	      (GsdDevice  *device);
GsdDeviceType	   gsd_device_get_device_type (GsdDevice  *device);
void		   gsd_device_get_device_ids  (GsdDevice    *device,
					       const gchar **vendor,
					       const gchar **product);
GSettings *	   gsd_device_get_settings    (GsdDevice  *device);

const gchar *	   gsd_device_get_device_file (GsdDevice  *device);
gboolean	   gsd_device_get_dimensions  (GsdDevice  *device,
					       guint	  *width,
					       guint	  *height);

GsdDevice *	   gsd_device_manager_lookup_gdk_device (GsdDeviceManager *manager,
							 GdkDevice	  *gdk_device);
gboolean	   gsd_device_shares_group (GsdDevice *device1,
					    GsdDevice *device2);

G_END_DECLS