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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* Metacity device structures */
/*
* Copyright (C) 2007 Paulo Ricardo Zanoni
*
* 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_DEVICES_H
#define META_DEVICES_H
#ifdef MPX
#include <X11/extensions/XInput.h>
#include "common.h"
#include "boxes.h"
#ifdef HAVE_XSYNC
#include <X11/extensions/sync.h>
#endif
/* By default, the MetaDevInfo lists have size 4. Almost no client has more
* than 4 mice or keyboards... */
#define DEFAULT_INPUT_ARRAY_SIZE 4
typedef struct _MetaDevices MetaDevices;
/* typedef struct _MetaDevInfo MetaDevInfo; This guy was declared at common.h */
typedef struct _MetaGrabOpInfo MetaGrabOpInfo;
typedef struct _MetaDevList MetaDevList;
/* TODO: create MetaPtrInfo and MetaKbdInfo, so that you can differentiate it
* and force correct type using in function prototypes */
struct _MetaGrabOpInfo
{
/* current window operation */
MetaGrabOp op;
MetaScreen *screen;
MetaWindow *window;
Window xwindow;
int button;
int anchor_root_x;
int anchor_root_y;
MetaRectangle anchor_window_pos;
int latest_motion_x;
int latest_motion_y;
gulong mask;
guint have_pointer : 1;
guint grabbed_pointer : 1;
guint have_keyboard : 1;
guint wireframe_active : 1;
guint was_cancelled : 1; /* Only used in wireframe mode */
guint frame_action : 1;
MetaRectangle wireframe_rect;
MetaRectangle wireframe_last_xor_rect;
MetaRectangle initial_window_pos;
int initial_x, initial_y; /* These are only relevant for */
gboolean threshold_movement_reached; /* raise_on_click == FALSE. */
MetaResizePopup *resize_popup;
GTimeVal last_moveresize_time;
guint32 motion_notify_time;
int wireframe_last_display_width;
int wireframe_last_display_height;
GList* old_window_stacking;
MetaEdgeResistanceData *edge_resistance_data;
unsigned int last_user_action_was_snap;
int resize_timeout_id;
#ifdef HAVE_XSYNC
/* alarm monitoring client's _NET_WM_SYNC_REQUEST_COUNTER */
XSyncAlarm sync_request_alarm;
#endif
};
struct _MetaDevInfo
{
XDevice *xdev;
gchar *name;
MetaGrabOpInfo *grab_op;
};
struct _MetaDevices
{
MetaDevInfo *mice;
int miceUsed;
int miceSize;
MetaDevInfo *keyboards;
int keybsUsed; /* XXX :%s/keybsUsed/kbdsUsed/g or something else? */
int keybsSize; /* I don't like "keybs" */
XID *pairedPointers; /* indexed by the keyboards! */
/* TODO: consider creating a structure to store the pairs!! */
};
struct _MetaDevList
{
MetaDevInfo **devices;
int used;
int size;
};
MetaDevInfo* meta_devices_find_mouse_by_name (MetaDisplay *display,
gchar *name);
MetaDevInfo* meta_devices_find_mouse_by_id (MetaDisplay *display,
XID id);
MetaDevInfo* meta_devices_find_keyboard_by_id (MetaDisplay *display,
XID id);
MetaDevInfo* meta_devices_find_paired_mouse (MetaDisplay *display,
XID id);
MetaDevInfo* meta_devices_find_paired_keyboard (MetaDisplay *display,
XID id);
void meta_devices_list_create (MetaDevList *list);
void meta_devices_list_destroy (MetaDevList *list);
gboolean meta_devices_list_add (MetaDevList *list,
MetaDevInfo *dev);
gboolean meta_devices_list_remove (MetaDevList *list,
MetaDevInfo *dev);
gboolean meta_devices_list_is_member (MetaDevList *list,
MetaDevInfo *dev);
#else
#error "This branch will ONLY compile if you enable --enable-mpx!"
#endif
#endif
|