1 diff -Naur unity-4.24.0.orig/CMakeLists.txt unity-4.24.0/CMakeLists.txt
2 --- unity-4.24.0.orig/CMakeLists.txt 2011-10-12 14:02:40.000000000 +0200
3 +++ unity-4.24.0/CMakeLists.txt 2011-11-12 18:08:29.953890912 +0100
8 -set (UNITY_PLUGIN_DEPS "compiz;nux-1.0 >= 1.2.2;libbamf3;dee-1.0;gio-2.0;gio-unix-2.0;dbusmenu-glib-0.4;x11;libstartup-notification-1.0;gthread-2.0;indicator3-0.4;atk;unity-misc >= 0.4.0;gconf-2.0;libutouch-geis;gtk+-3.0 >= 3.1;sigc++-2.0;json-glib-1.0;libnotify;gnome-desktop-3.0")
9 +set (UNITY_PLUGIN_DEPS "compiz;nux-1.0 >= 1.2.2;libbamf3;dee-1.0;gio-2.0;gio-unix-2.0;dbusmenu-glib-0.4;x11;libstartup-notification-1.0;gthread-2.0;indicator3-0.4;atk;unity-misc >= 0.4.0;gconf-2.0;gtk+-3.0 >= 3.1;sigc++-2.0;json-glib-1.0;libnotify;gnome-desktop-3.0")
12 find_package (Compiz REQUIRED)
13 diff -Naur unity-4.24.0.orig/plugins/unityshell/src/GeisAdapter.cpp unity-4.24.0/plugins/unityshell/src/GeisAdapter.cpp
14 --- unity-4.24.0.orig/plugins/unityshell/src/GeisAdapter.cpp 2011-10-12 14:02:40.000000000 +0200
15 +++ unity-4.24.0/plugins/unityshell/src/GeisAdapter.cpp 1970-01-01 01:00:00.000000000 +0100
17 -// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
19 - * Copyright (C) 2010 Canonical Ltd
21 - * This program is free software: you can redistribute it and/or modify
22 - * it under the terms of the GNU General Public License version 3 as
23 - * published by the Free Software Foundation.
25 - * This program is distributed in the hope that it will be useful,
26 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 - * GNU General Public License for more details.
30 - * You should have received a copy of the GNU General Public License
31 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
33 - * Authored by: Jason Smith <jason.smith@canonical.com>
37 -#include <gdk/gdkx.h>
38 -#include "GeisAdapter.h"
40 -GeisAdapter* GeisAdapter::_default = 0;
44 -GeisAdapter::Default()
47 - return _default = new GeisAdapter(); // should be using a dictionary
51 -GeisAdapter::GeisAdapter()
53 - RegisterRootInstance();
56 -GeisAdapter::~GeisAdapter()
66 - status = geis_configuration_get_value(_root_instance, GEIS_CONFIG_UNIX_FD, &fd);
68 - if (status != GEIS_STATUS_SUCCESS)
71 - _watch_id = g_io_add_watch(g_io_channel_unix_new(fd),
73 - &GeisAdapter::OnWatchIn,
78 -GeisAdapter::OnWatchIn(GIOChannel* source, GIOCondition condition, gpointer data)
80 - GeisAdapter* self = static_cast<GeisAdapter*>(data);
81 - geis_event_dispatch(self->_root_instance);
86 -GeisAdapter::InputDeviceAdded(void* cookie, GeisInputDeviceId device_id, void* attrs)
92 -GeisAdapter::InputDeviceChanged(void* cookie, GeisInputDeviceId device_id, void* attrs)
98 -GeisAdapter::InputDeviceRemoved(void* cookie, GeisInputDeviceId device_id, void* attrs)
103 -GeisAdapter::GestureAdded(void* cookie, GeisGestureType gesture_type, GeisGestureId gesture_id, GeisSize count, GeisGestureAttr* attrs)
108 -GeisAdapter::GestureRemoved(void* cookie, GeisGestureType gesture_type, GeisGestureId gesture_id, GeisSize count, GeisGestureAttr* attrs)
113 -GeisAdapter::GestureStart(void* cookie, GeisGestureType gesture_type, GeisGestureId gesture_id, GeisSize count, GeisGestureAttr* attrs)
115 - GeisAdapter* self = static_cast<GeisAdapter*>(cookie);
117 - if (gesture_type == GEIS_GESTURE_PRIMITIVE_DRAG)
119 - GeisDragData* data = self->ProcessDragGesture(count, attrs);
120 - data->id = gesture_id;
121 - self->drag_start.emit(data);
124 - else if (gesture_type == GEIS_GESTURE_PRIMITIVE_ROTATE)
126 - GeisRotateData* data = self->ProcessRotateGesture(count, attrs);
127 - data->id = gesture_id;
128 - self->rotate_start.emit(data);
131 - else if (gesture_type == GEIS_GESTURE_PRIMITIVE_PINCH)
133 - GeisPinchData* data = self->ProcessPinchGesture(count, attrs);
134 - data->id = gesture_id;
135 - self->pinch_start.emit(data);
138 - else if (gesture_type == GEIS_GESTURE_PRIMITIVE_TAP)
140 - GeisTapData* data = self->ProcessTapGesture(count, attrs);
141 - data->id = gesture_id;
142 - self->tap.emit(data);
145 - else if (gesture_type == GEIS_GESTURE_PRIMITIVE_TOUCH)
147 - GeisTouchData* data = self->ProcessTouchGesture(count, attrs);
148 - data->id = gesture_id;
149 - self->touch_start.emit(data);
155 -GeisAdapter::GestureUpdate(void* cookie, GeisGestureType gesture_type, GeisGestureId gesture_id, GeisSize count, GeisGestureAttr* attrs)
157 - GeisAdapter* self = static_cast<GeisAdapter*>(cookie);
159 - if (gesture_type == GEIS_GESTURE_PRIMITIVE_DRAG)
161 - GeisDragData* data = self->ProcessDragGesture(count, attrs);
162 - data->id = gesture_id;
163 - self->drag_update.emit(data);
166 - else if (gesture_type == GEIS_GESTURE_PRIMITIVE_ROTATE)
168 - GeisRotateData* data = self->ProcessRotateGesture(count, attrs);
169 - data->id = gesture_id;
170 - self->rotate_update.emit(data);
173 - else if (gesture_type == GEIS_GESTURE_PRIMITIVE_PINCH)
175 - GeisPinchData* data = self->ProcessPinchGesture(count, attrs);
176 - data->id = gesture_id;
177 - self->pinch_update.emit(data);
180 - else if (gesture_type == GEIS_GESTURE_PRIMITIVE_TAP)
182 - GeisTapData* data = self->ProcessTapGesture(count, attrs);
183 - data->id = gesture_id;
184 - self->tap.emit(data);
187 - else if (gesture_type == GEIS_GESTURE_PRIMITIVE_TOUCH)
189 - GeisTouchData* data = self->ProcessTouchGesture(count, attrs);
190 - data->id = gesture_id;
191 - self->touch_update.emit(data);
197 -GeisAdapter::GestureFinish(void* cookie, GeisGestureType gesture_type, GeisGestureId gesture_id, GeisSize count, GeisGestureAttr* attrs)
199 - GeisAdapter* self = static_cast<GeisAdapter*>(cookie);
201 - if (gesture_type == GEIS_GESTURE_PRIMITIVE_DRAG)
203 - GeisDragData* data = self->ProcessDragGesture(count, attrs);
204 - data->id = gesture_id;
205 - self->drag_finish.emit(data);
208 - else if (gesture_type == GEIS_GESTURE_PRIMITIVE_ROTATE)
210 - GeisRotateData* data = self->ProcessRotateGesture(count, attrs);
211 - data->id = gesture_id;
212 - self->rotate_finish.emit(data);
215 - else if (gesture_type == GEIS_GESTURE_PRIMITIVE_PINCH)
217 - GeisPinchData* data = self->ProcessPinchGesture(count, attrs);
218 - data->id = gesture_id;
219 - self->pinch_finish.emit(data);
222 - else if (gesture_type == GEIS_GESTURE_PRIMITIVE_TAP)
224 - GeisTapData* data = self->ProcessTapGesture(count, attrs);
225 - data->id = gesture_id;
226 - self->tap.emit(data);
229 - else if (gesture_type == GEIS_GESTURE_PRIMITIVE_TOUCH)
231 - GeisTouchData* data = self->ProcessTouchGesture(count, attrs);
232 - data->id = gesture_id;
233 - self->touch_finish.emit(data);
238 -GeisAdapter::GeisTapData* GeisAdapter::ProcessTapGesture(GeisSize count, GeisGestureAttr* attrs)
240 - GeisTapData* result = (GeisTapData*) g_malloc0(sizeof(GeisTapData));
243 - for (i = 0; i < (int) count; i++)
245 - GeisGestureAttr attr = attrs[i];
246 - if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_DEVICE_ID))
247 - result->device_id = attr.integer_val;
248 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_CHILD_WINDOW_ID))
249 - result->window = (Window) attr.integer_val;
250 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_TIMESTAMP))
251 - result->timestamp = attr.integer_val;
252 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_FOCUS_X))
253 - result->focus_x = attr.integer_val;
254 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_FOCUS_Y))
255 - result->focus_y = attr.integer_val;
256 - else if (g_str_equal (attr.name, GEIS_GESTURE_ATTRIBUTE_TOUCHES))
257 - result->touches = attr.integer_val;
258 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_GESTURE_NAME))
260 - if (!g_strcmp0(attr.string_val, GEIS_GESTURE_TYPE_TAP1))
261 - result->touches = 1;
262 - else if (!g_strcmp0(attr.string_val, GEIS_GESTURE_TYPE_TAP2))
263 - result->touches = 2;
264 - else if (!g_strcmp0(attr.string_val, GEIS_GESTURE_TYPE_TAP3))
265 - result->touches = 3;
266 - else if (!g_strcmp0(attr.string_val, GEIS_GESTURE_TYPE_TAP4))
267 - result->touches = 4;
268 - else if (!g_strcmp0(attr.string_val, GEIS_GESTURE_TYPE_TAP5))
269 - result->touches = 5;
271 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_TAP_TIME))
272 - result->tap_length_ms = attr.integer_val;
273 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_POSITION_X))
274 - result->position_x = attr.float_val;
275 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_POSITION_Y))
276 - result->position_y = attr.float_val;
277 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X1))
278 - result->bound_x1 = attr.float_val;
279 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y1))
280 - result->bound_y1 = attr.float_val;
281 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X2))
282 - result->bound_x2 = attr.float_val;
283 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y2))
284 - result->bound_y2 = attr.float_val;
290 -GeisAdapter::GeisTouchData* GeisAdapter::ProcessTouchGesture(GeisSize count, GeisGestureAttr* attrs)
292 - GeisTouchData* result = (GeisTouchData*) g_malloc0(sizeof(GeisTouchData));
295 - for (i = 0; i < (int) count; i++)
297 - GeisGestureAttr attr = attrs[i];
298 - if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_DEVICE_ID))
299 - result->device_id = attr.integer_val;
300 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_CHILD_WINDOW_ID))
301 - result->window = (Window) attr.integer_val;
302 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_TIMESTAMP))
303 - result->timestamp = attr.integer_val;
304 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_FOCUS_X))
305 - result->focus_x = attr.integer_val;
306 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_FOCUS_Y))
307 - result->focus_y = attr.integer_val;
308 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_TOUCHES))
309 - result->touches = attr.integer_val;
310 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X1))
311 - result->bound_x1 = attr.float_val;
312 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y1))
313 - result->bound_y1 = attr.float_val;
314 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X2))
315 - result->bound_x2 = attr.float_val;
316 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y2))
317 - result->bound_y2 = attr.float_val;
323 -GeisAdapter::GeisDragData* GeisAdapter::ProcessDragGesture(GeisSize count, GeisGestureAttr* attrs)
325 - GeisDragData* result = (GeisDragData*) g_malloc0(sizeof(GeisDragData));
328 - for (i = 0; i < (int) count; i++)
330 - GeisGestureAttr attr = attrs[i];
331 - if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_DEVICE_ID))
332 - result->device_id = attr.integer_val;
333 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_CHILD_WINDOW_ID))
334 - result->window = (Window) attr.integer_val;
335 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_TIMESTAMP))
336 - result->timestamp = attr.integer_val;
337 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_FOCUS_X))
338 - result->focus_x = attr.integer_val;
339 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_FOCUS_Y))
340 - result->focus_y = attr.integer_val;
341 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_TOUCHES))
342 - result->touches = attr.integer_val;
343 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_POSITION_X))
344 - result->position_x = attr.float_val;
345 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_POSITION_Y))
346 - result->position_y = attr.float_val;
347 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_VELOCITY_X))
348 - result->velocity_x = attr.float_val;
349 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_VELOCITY_Y))
350 - result->velocity_y = attr.float_val;
351 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_DELTA_X))
352 - result->delta_x = attr.float_val;
353 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_DELTA_Y))
354 - result->delta_y = attr.float_val;
355 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X1))
356 - result->bound_x1 = attr.float_val;
357 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y1))
358 - result->bound_y1 = attr.float_val;
359 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X2))
360 - result->bound_x2 = attr.float_val;
361 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y2))
362 - result->bound_y2 = attr.float_val;
368 -GeisAdapter::GeisPinchData* GeisAdapter::ProcessPinchGesture(GeisSize count, GeisGestureAttr* attrs)
370 - GeisPinchData* result = (GeisPinchData*) g_malloc0(sizeof(GeisPinchData));
373 - for (i = 0; i < (int) count; i++)
375 - GeisGestureAttr attr = attrs[i];
376 - if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_DEVICE_ID))
377 - result->device_id = attr.integer_val;
378 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_CHILD_WINDOW_ID))
379 - result->window = (Window) attr.integer_val;
380 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_TIMESTAMP))
381 - result->timestamp = attr.integer_val;
382 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_FOCUS_X))
383 - result->focus_x = attr.integer_val;
384 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_FOCUS_Y))
385 - result->focus_y = attr.integer_val;
386 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_TOUCHES))
387 - result->touches = attr.integer_val;
388 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_RADIUS))
389 - result->radius = attr.float_val;
390 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_RADIUS_DELTA))
391 - result->radius_delta = attr.float_val;
392 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_RADIAL_VELOCITY))
393 - result->radius_velocity = attr.float_val;
394 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X1))
395 - result->bound_x1 = attr.float_val;
396 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y1))
397 - result->bound_y1 = attr.float_val;
398 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X2))
399 - result->bound_x2 = attr.float_val;
400 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y2))
401 - result->bound_y2 = attr.float_val;
407 -GeisAdapter::GeisRotateData* GeisAdapter::ProcessRotateGesture(GeisSize count, GeisGestureAttr* attrs)
409 - GeisRotateData* result = (GeisRotateData*) g_malloc0(sizeof(GeisRotateData));
412 - for (i = 0; i < (int) count; i++)
414 - GeisGestureAttr attr = attrs[i];
415 - if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_DEVICE_ID))
416 - result->device_id = attr.integer_val;
417 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_CHILD_WINDOW_ID))
418 - result->window = (Window) attr.integer_val;
419 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_TIMESTAMP))
420 - result->timestamp = attr.integer_val;
421 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_FOCUS_X))
422 - result->focus_x = attr.integer_val;
423 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_FOCUS_Y))
424 - result->focus_y = attr.integer_val;
425 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_TOUCHES))
426 - result->touches = attr.integer_val;
427 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_ANGLE))
428 - result->angle = attr.float_val;
429 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_ANGLE_DELTA))
430 - result->angle_delta = attr.float_val;
431 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_ANGULAR_VELOCITY))
432 - result->angle_velocity = attr.float_val;
433 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X1))
434 - result->bound_x1 = attr.float_val;
435 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y1))
436 - result->bound_y1 = attr.float_val;
437 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X2))
438 - result->bound_x2 = attr.float_val;
439 - else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y2))
440 - result->bound_y2 = attr.float_val;
446 -static const char* s_gestures[] =
448 - GEIS_GESTURE_TYPE_DRAG3, GEIS_GESTURE_TYPE_TAP3, GEIS_GESTURE_TYPE_ROTATE3, GEIS_GESTURE_TYPE_PINCH3, GEIS_GESTURE_TYPE_TOUCH3,
449 - GEIS_GESTURE_TYPE_DRAG4, GEIS_GESTURE_TYPE_TAP4, GEIS_GESTURE_TYPE_ROTATE4, GEIS_GESTURE_TYPE_PINCH4, GEIS_GESTURE_TYPE_TOUCH4,
450 - GEIS_GESTURE_TYPE_SYSTEM,
455 -GeisAdapter::RegisterRootInstance()
457 - static GeisInputFuncs input_funcs =
459 - &GeisAdapter::InputDeviceAdded,
460 - &GeisAdapter::InputDeviceChanged,
461 - &GeisAdapter::InputDeviceRemoved
464 - static GeisGestureFuncs gesture_funcs =
466 - &GeisAdapter::GestureAdded,
467 - &GeisAdapter::GestureRemoved,
468 - &GeisAdapter::GestureStart,
469 - &GeisAdapter::GestureUpdate,
470 - &GeisAdapter::GestureFinish
473 - GeisStatus status = GEIS_UNKNOWN_ERROR;
475 - GeisXcbWinInfo xcb_win_info;
476 - xcb_win_info.display_name = NULL,
477 - xcb_win_info.screenp = NULL,
478 - xcb_win_info.window_id = gdk_x11_get_default_root_xwindow();
480 - GeisWinInfo win_info =
482 - GEIS_XCB_FULL_WINDOW,
485 - GeisInstance instance;
487 - status = geis_init(&win_info, &instance);
488 - if (status != GEIS_STATUS_SUCCESS)
490 - fprintf(stderr, "error in geis_init\n");
494 - status = geis_input_devices(instance, &input_funcs, this);
495 - if (status != GEIS_STATUS_SUCCESS)
497 - fprintf(stderr, "error subscribing to input devices\n");
501 - status = geis_subscribe(instance,
502 - GEIS_ALL_INPUT_DEVICES,
506 - if (status != GEIS_STATUS_SUCCESS)
508 - fprintf(stderr, "error subscribing to gestures\n");
512 - _root_instance = instance;
514 diff -Naur unity-4.24.0.orig/plugins/unityshell/src/GeisAdapter.h unity-4.24.0/plugins/unityshell/src/GeisAdapter.h
515 --- unity-4.24.0.orig/plugins/unityshell/src/GeisAdapter.h 2011-10-12 14:02:40.000000000 +0200
516 +++ unity-4.24.0/plugins/unityshell/src/GeisAdapter.h 1970-01-01 01:00:00.000000000 +0100
518 -// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
520 - * Copyright (C) 2010 Canonical Ltd
522 - * This program is free software: you can redistribute it and/or modify
523 - * it under the terms of the GNU General Public License version 3 as
524 - * published by the Free Software Foundation.
526 - * This program is distributed in the hope that it will be useful,
527 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
528 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
529 - * GNU General Public License for more details.
531 - * You should have received a copy of the GNU General Public License
532 - * aint with this program. If not, see <http://www.gnu.org/licenses/>.
534 - * Authored by: Jason Smith <jason.smith@canonical.com>
537 -#ifndef GEISADAPTER_H
538 -#define GEISADAPTER_H
541 -#include <sigc++/sigc++.h>
542 -#include <geis/geis.h>
543 -#include <Nux/Nux.h>
545 -class GeisAdapter : public sigc::trackable
548 - static GeisAdapter* Default();
554 - typedef struct _GeisTapData
572 - typedef struct _GeisDragData
593 - typedef struct _GeisRotateData
604 - float angle_velocity;
611 - typedef struct _GeisPinchData
621 - float radius_delta;
622 - float radius_velocity;
629 - typedef struct _GeisTouchData
644 - sigc::signal<void, GeisTapData*> tap;
646 - sigc::signal<void, GeisDragData*> drag_start;
647 - sigc::signal<void, GeisDragData*> drag_update;
648 - sigc::signal<void, GeisDragData*> drag_finish;
650 - sigc::signal<void, GeisRotateData*> rotate_start;
651 - sigc::signal<void, GeisRotateData*> rotate_update;
652 - sigc::signal<void, GeisRotateData*> rotate_finish;
654 - sigc::signal<void, GeisPinchData*> pinch_start;
655 - sigc::signal<void, GeisPinchData*> pinch_update;
656 - sigc::signal<void, GeisPinchData*> pinch_finish;
658 - sigc::signal<void, GeisTouchData*> touch_start;
659 - sigc::signal<void, GeisTouchData*> touch_update;
660 - sigc::signal<void, GeisTouchData*> touch_finish;
664 - static gboolean OnWatchIn(GIOChannel* source, GIOCondition condition, gpointer data);
666 - static void InputDeviceAdded(void* cookie, GeisInputDeviceId device_id, void* attrs);
667 - static void InputDeviceChanged(void* cookie, GeisInputDeviceId device_id, void* attrs);
668 - static void InputDeviceRemoved(void* cookie, GeisInputDeviceId device_id, void* attrs);
670 - static void GestureAdded(void* cookie, GeisGestureType gesture_type, GeisGestureId gesture_id, GeisSize attr_count, GeisGestureAttr* attrs);
671 - static void GestureRemoved(void* cookie, GeisGestureType gesture_type, GeisGestureId gesture_id, GeisSize attr_count, GeisGestureAttr* attrs);
673 - static void GestureStart(void* cookie, GeisGestureType gesture_type, GeisGestureId gesture_id, GeisSize attr_count, GeisGestureAttr* attrs);
674 - static void GestureUpdate(void* cookie, GeisGestureType gesture_type, GeisGestureId gesture_id, GeisSize attr_count, GeisGestureAttr* attrs);
675 - static void GestureFinish(void* cookie, GeisGestureType gesture_type, GeisGestureId gesture_id, GeisSize attr_count, GeisGestureAttr* attrs);
677 - GeisTapData* ProcessTapGesture(GeisSize attr_count, GeisGestureAttr* attrs);
678 - GeisDragData* ProcessDragGesture(GeisSize attr_count, GeisGestureAttr* attrs);
679 - GeisPinchData* ProcessPinchGesture(GeisSize attr_count, GeisGestureAttr* attrs);
680 - GeisRotateData* ProcessRotateGesture(GeisSize attr_count, GeisGestureAttr* attrs);
681 - GeisTouchData* ProcessTouchGesture(GeisSize attr_count, GeisGestureAttr* attrs);
684 - void RegisterRootInstance();
686 - GeisInstance _root_instance;
690 - static GeisAdapter* _default;
695 diff -Naur unity-4.24.0.orig/plugins/unityshell/src/GestureEngine.cpp unity-4.24.0/plugins/unityshell/src/GestureEngine.cpp
696 --- unity-4.24.0.orig/plugins/unityshell/src/GestureEngine.cpp 2011-10-12 14:02:40.000000000 +0200
697 +++ unity-4.24.0/plugins/unityshell/src/GestureEngine.cpp 1970-01-01 01:00:00.000000000 +0100
700 - * GestureEngine.cpp
701 - * This file is part of Unity
703 - * Copyright (C) 2011 - Canonical Ltd.
705 - * Unity is free software; you can redistribute it and/or modify
706 - * it under the terms of the GNU General Public License as published by
707 - * the Free Software Foundation; either version 2 of the License, or
708 - * (at your option) any later version.
710 - * Unity is distributed in the hope that it will be useful,
711 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
712 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
713 - * GNU General Public License for more details.
715 - * You should have received a copy of the GNU General Public License
716 - * along with Unity; if not, write to the Free Software
717 - * Foundation, Inc., 51 Franklin St, Fifth Floor,
718 - * Boston, MA 02110-1301 USA
721 -#include <X11/cursorfont.h>
723 -#include "ubus-server.h"
724 -#include "UBusMessages.h"
725 -#include "GestureEngine.h"
726 -#include "PluginAdapter.h"
728 -GestureEngine::GestureEngine(CompScreen* screen)
737 - _fleur_cursor = XCreateFontCursor (screen->dpy (), XC_fleur);
739 - GeisAdapter* adapter = GeisAdapter::Default();
741 - adapter->tap.connect(sigc::mem_fun(this, &GestureEngine::OnTap));
743 - adapter->drag_start.connect(sigc::mem_fun(this, &GestureEngine::OnDragStart));
744 - adapter->drag_update.connect(sigc::mem_fun(this, &GestureEngine::OnDragUpdate));
745 - adapter->drag_finish.connect(sigc::mem_fun(this, &GestureEngine::OnDragFinish));
747 - adapter->rotate_start.connect(sigc::mem_fun(this, &GestureEngine::OnRotateStart));
748 - adapter->rotate_update.connect(sigc::mem_fun(this, &GestureEngine::OnRotateUpdate));
749 - adapter->rotate_finish.connect(sigc::mem_fun(this, &GestureEngine::OnRotateFinish));
751 - adapter->pinch_start.connect(sigc::mem_fun(this, &GestureEngine::OnPinchStart));
752 - adapter->pinch_update.connect(sigc::mem_fun(this, &GestureEngine::OnPinchUpdate));
753 - adapter->pinch_finish.connect(sigc::mem_fun(this, &GestureEngine::OnPinchFinish));
755 - adapter->touch_start.connect(sigc::mem_fun(this, &GestureEngine::OnTouchStart));
756 - adapter->touch_update.connect(sigc::mem_fun(this, &GestureEngine::OnTouchUpdate));
757 - adapter->touch_finish.connect(sigc::mem_fun(this, &GestureEngine::OnTouchFinish));
760 -GestureEngine::~GestureEngine()
763 - XFreeCursor (screen->dpy (), _fleur_cursor);
767 -GestureEngine::OnTap(GeisAdapter::GeisTapData* data)
769 - if (data->touches == 4)
771 - UBusServer* ubus = ubus_server_get_default();
772 - ubus_server_send_message(ubus, UBUS_DASH_EXTERNAL_ACTIVATION, NULL);
777 -GestureEngine::FindCompWindow(Window window)
779 - CompWindow* result = _screen->findTopLevelWindow(window);
783 - Window parent, root;
784 - Window* children = NULL;
785 - unsigned int nchildren;
787 - XQueryTree(_screen->dpy(), window, &root, &parent, &children, &nchildren);
792 - if (parent == root)
796 - result = _screen->findTopLevelWindow(window);
801 - if (!(result->type() & (CompWindowTypeUtilMask |
802 - CompWindowTypeNormalMask |
803 - CompWindowTypeDialogMask |
804 - CompWindowTypeModalDialogMask)))
812 -GestureEngine::OnDragStart(GeisAdapter::GeisDragData* data)
814 - if (data->touches == 3)
816 - _drag_window = FindCompWindow(data->window);
822 - if (!(_drag_window->actions() & CompWindowActionMoveMask))
828 - /* Don't allow windows to be dragged if completely maximized */
829 - if ((_drag_window->state() & MAXIMIZE_STATE) == MAXIMIZE_STATE)
836 - _screen->removeGrab(_drag_grab, NULL);
837 - _drag_id = data->id;
838 - _drag_grab = _screen->pushGrab(_fleur_cursor, "unity");
839 - _drag_window->grabNotify (_drag_window->serverGeometry ().x (),
840 - _drag_window->serverGeometry ().y (),
841 - 0, CompWindowGrabMoveMask | CompWindowGrabButtonMask);
845 -/* FIXME: CompScreen::warpPointer filters out motion events which
846 - * other plugins may need to process, but for most cases in core
847 - * they should be filtered out. */
849 -GestureEngine::OnDragUpdate(GeisAdapter::GeisDragData* data)
851 - if (_drag_id == data->id && _drag_window)
853 - unsigned int px = std::max (std::min (pointerX + static_cast <int> (data->delta_x), screen->width ()), 0);
854 - unsigned int py = std::max (std::min (pointerY + static_cast <int> (data->delta_y), screen->height ()), 0);
856 - if (_drag_window->state () & CompWindowStateMaximizedVertMask)
858 - if (_drag_window->state () & CompWindowStateMaximizedHorzMask)
861 - XWarpPointer(screen->dpy (),
862 - None, screen->root (),
866 - XSync(screen->dpy (), false);
867 - _drag_window->move(px - pointerX, py - pointerY, false);
875 -GestureEngine::OnDragFinish(GeisAdapter::GeisDragData* data)
877 - if (_drag_id == data->id && _drag_window)
879 - _drag_window->ungrabNotify ();
880 - _drag_window->syncPosition();
886 -GestureEngine::EndDrag()
888 - if (_drag_id && _drag_window)
890 - _screen->removeGrab(_drag_grab, NULL);
898 -GestureEngine::OnRotateStart(GeisAdapter::GeisRotateData* data)
903 -GestureEngine::OnRotateUpdate(GeisAdapter::GeisRotateData* data)
908 -GestureEngine::OnRotateFinish(GeisAdapter::GeisRotateData* data)
914 -GestureEngine::OnTouchStart(GeisAdapter::GeisTouchData* data)
916 - if (data->touches == 3)
918 - CompWindow* result = FindCompWindow(data->window);
922 - PluginAdapter::Default()->ShowGrabHandles(result, false);
923 - _touch_id = data->id;
924 - _touch_window = result;
930 -GestureEngine::OnTouchUpdate(GeisAdapter::GeisTouchData* data)
936 -GestureEngine::OnTouchFinish(GeisAdapter::GeisTouchData* data)
938 - if (_touch_id == data->id)
941 - PluginAdapter::Default()->ShowGrabHandles(_touch_window, true);
948 -GestureEngine::OnPinchStart(GeisAdapter::GeisPinchData* data)
950 - if (data->touches == 3)
952 - _pinch_window = FindCompWindow(data->window);
954 - if (!_pinch_window)
957 - _pinch_id = data->id;
958 - _pinch_start_radius = data->radius;
961 - _screen->removeGrab(_pinch_grab, NULL);
962 - _pinch_grab = _screen->pushGrab(_screen->invisibleCursor(), "unity");
966 -GestureEngine::OnPinchUpdate(GeisAdapter::GeisPinchData* data)
968 - if (data->id != _pinch_id)
971 - float delta_radius = data->radius - _pinch_start_radius;
972 - if (delta_radius > 110.0f)
974 - _pinch_window->maximize(MAXIMIZE_STATE);
975 - _pinch_start_radius = data->radius;
978 - else if (delta_radius < -110.0f)
980 - _pinch_window->maximize(0);
981 - _pinch_start_radius = data->radius;
986 -GestureEngine::OnPinchFinish(GeisAdapter::GeisPinchData* data)
988 - if (_pinch_id == data->id && _pinch_window)
990 - _screen->removeGrab(_pinch_grab, NULL);
995 diff -Naur unity-4.24.0.orig/plugins/unityshell/src/GestureEngine.h unity-4.24.0/plugins/unityshell/src/GestureEngine.h
996 --- unity-4.24.0.orig/plugins/unityshell/src/GestureEngine.h 2011-10-12 14:02:40.000000000 +0200
997 +++ unity-4.24.0/plugins/unityshell/src/GestureEngine.h 1970-01-01 01:00:00.000000000 +0100
1001 - * This file is part of Unity
1003 - * Copyright (C) 2011 - Canonical Ltd.
1005 - * Unity is free software; you can redistribute it and/or modify
1006 - * it under the terms of the GNU General Public License as published by
1007 - * the Free Software Foundation; either version 2 of the License, or
1008 - * (at your option) any later version.
1010 - * Unity is distributed in the hope that it will be useful,
1011 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
1012 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1013 - * GNU General Public License for more details.
1015 - * You should have received a copy of the GNU General Public License
1016 - * along with Unity; if not, write to the Free Software
1017 - * Foundation, Inc., 51 Franklin St, Fifth Floor,
1018 - * Boston, MA 02110-1301 USA
1021 -#include <core/core.h>
1023 -#include <sigc++/sigc++.h>
1024 -#include <Nux/Nux.h>
1025 -#include "GeisAdapter.h"
1027 -class GestureEngine : public sigc::trackable
1030 - GestureEngine(CompScreen* screen);
1031 - virtual ~GestureEngine();
1033 - void OnTap(GeisAdapter::GeisTapData* data);
1035 - void OnDragStart(GeisAdapter::GeisDragData* data);
1036 - void OnDragUpdate(GeisAdapter::GeisDragData* data);
1037 - void OnDragFinish(GeisAdapter::GeisDragData* data);
1039 - void OnRotateStart(GeisAdapter::GeisRotateData* data);
1040 - void OnRotateUpdate(GeisAdapter::GeisRotateData* data);
1041 - void OnRotateFinish(GeisAdapter::GeisRotateData* data);
1043 - void OnPinchStart(GeisAdapter::GeisPinchData* data);
1044 - void OnPinchUpdate(GeisAdapter::GeisPinchData* data);
1045 - void OnPinchFinish(GeisAdapter::GeisPinchData* data);
1047 - void OnTouchStart(GeisAdapter::GeisTouchData* data);
1048 - void OnTouchUpdate(GeisAdapter::GeisTouchData* data);
1049 - void OnTouchFinish(GeisAdapter::GeisTouchData* data);
1053 - CompWindow* FindCompWindow(Window window);
1055 - CompScreen* _screen;
1056 - CompWindow* _drag_window;
1057 - CompWindow* _pinch_window;
1058 - CompWindow* _touch_window;
1059 - CompScreen::GrabHandle _drag_grab;
1060 - CompScreen::GrabHandle _pinch_grab;
1066 - float _pinch_start_radius;
1067 - Cursor _fleur_cursor;
1069 diff -Naur unity-4.24.0.orig/plugins/unityshell/src/Launcher.cpp unity-4.24.0/plugins/unityshell/src/Launcher.cpp
1070 --- unity-4.24.0.orig/plugins/unityshell/src/Launcher.cpp 2011-10-12 14:02:40.000000000 +0200
1071 +++ unity-4.24.0/plugins/unityshell/src/Launcher.cpp 2011-11-12 18:10:42.702441566 +0100
1072 @@ -187,11 +187,6 @@
1073 plugin_adapter.compiz_screen_viewport_switch_started.connect(sigc::mem_fun(this, &Launcher::OnViewPortSwitchStarted));
1074 plugin_adapter.compiz_screen_viewport_switch_ended.connect(sigc::mem_fun(this, &Launcher::OnViewPortSwitchEnded));
1076 - GeisAdapter& adapter = *(GeisAdapter::Default());
1077 - adapter.drag_start.connect(sigc::mem_fun(this, &Launcher::OnDragStart));
1078 - adapter.drag_update.connect(sigc::mem_fun(this, &Launcher::OnDragUpdate));
1079 - adapter.drag_finish.connect(sigc::mem_fun(this, &Launcher::OnDragFinish));
1081 display.changed.connect(sigc::mem_fun(this, &Launcher::OnDisplayChanged));
1083 _current_icon = NULL;
1084 @@ -397,50 +392,6 @@
1088 -Launcher::OnDragStart(GeisAdapter::GeisDragData* data)
1090 - if (_drag_out_id && _drag_out_id == data->id)
1093 - if (data->touches == 4)
1095 - _drag_out_id = data->id;
1098 - _drag_out_delta_x = 0.0f;
1102 - _drag_out_delta_x = DRAG_OUT_PIXELS;
1103 - _hide_machine->SetQuirk(LauncherHideMachine::MT_DRAG_OUT, false);
1109 -Launcher::OnDragUpdate(GeisAdapter::GeisDragData* data)
1111 - if (data->id == _drag_out_id)
1113 - _drag_out_delta_x = CLAMP(_drag_out_delta_x + data->delta_x, 0.0f, DRAG_OUT_PIXELS);
1114 - EnsureAnimation();
1119 -Launcher::OnDragFinish(GeisAdapter::GeisDragData* data)
1121 - if (data->id == _drag_out_id)
1123 - if (_drag_out_delta_x >= DRAG_OUT_PIXELS - 90.0f)
1124 - _hide_machine->SetQuirk(LauncherHideMachine::MT_DRAG_OUT, true);
1125 - SetTimeStruct(&_times[TIME_DRAG_OUT], &_times[TIME_DRAG_OUT], ANIM_DURATION_SHORT);
1127 - EnsureAnimation();
1132 Launcher::startKeyNavMode()
1134 SetStateKeyNav(true);
1135 diff -Naur unity-4.24.0.orig/plugins/unityshell/src/Launcher.h unity-4.24.0/plugins/unityshell/src/Launcher.h
1136 --- unity-4.24.0.orig/plugins/unityshell/src/Launcher.h 2011-10-12 14:02:40.000000000 +0200
1137 +++ unity-4.24.0/plugins/unityshell/src/Launcher.h 2011-11-12 18:11:00.897995790 +0100
1139 #include "BackgroundEffectHelper.h"
1140 #include "DNDCollectionWindow.h"
1141 #include "DndData.h"
1142 -#include "GeisAdapter.h"
1143 #include "Introspectable.h"
1144 #include "LauncherIcon.h"
1145 #include "LauncherDragWindow.h"
1146 @@ -247,10 +246,6 @@
1147 void OnWindowMapped(guint32 xid);
1148 void OnWindowUnmapped(guint32 xid);
1150 - void OnDragStart(GeisAdapter::GeisDragData* data);
1151 - void OnDragUpdate(GeisAdapter::GeisDragData* data);
1152 - void OnDragFinish(GeisAdapter::GeisDragData* data);
1154 void OnPluginStateChanged();
1156 void OnViewPortSwitchStarted();
1157 diff -Naur unity-4.24.0.orig/plugins/unityshell/src/unityshell.cpp unity-4.24.0/plugins/unityshell/src/unityshell.cpp
1158 --- unity-4.24.0.orig/plugins/unityshell/src/unityshell.cpp 2011-10-12 14:02:40.000000000 +0200
1159 +++ unity-4.24.0/plugins/unityshell/src/unityshell.cpp 2011-11-12 18:11:53.241462268 +0100
1161 #include "Launcher.h"
1162 #include "LauncherIcon.h"
1163 #include "LauncherController.h"
1164 -#include "GeisAdapter.h"
1165 #include "DevicesSettings.h"
1166 #include "PluginAdapter.h"
1167 #include "QuicklistManager.h"
1169 , controller(nullptr)
1170 , panelController(nullptr)
1171 , switcherController(nullptr)
1172 - , gestureEngine(nullptr)
1174 , launcherWindow(nullptr)
1175 , panelWindow(nullptr)
1177 g_timeout_add(0, &UnityScreen::initPluginActions, this);
1178 super_keypressed_ = false;
1180 - GeisAdapter::Default()->Run();
1181 - gestureEngine = new GestureEngine(screen);
1183 CompString name(PKGDATADIR"/panel-shadow.png");
1184 CompString pname("unityshell");
1185 CompSize size(1, 20);
1186 diff -Naur unity-4.24.0.orig/plugins/unityshell/src/unityshell.h unity-4.24.0/plugins/unityshell/src/unityshell.h
1187 --- unity-4.24.0.orig/plugins/unityshell/src/unityshell.h 2011-10-12 14:02:40.000000000 +0200
1188 +++ unity-4.24.0/plugins/unityshell/src/unityshell.h 2011-11-12 18:12:14.780145431 +0100
1190 #include "PanelController.h"
1191 #include "PlacesStyle.h"
1192 #include "UScreen.h"
1193 -#include "GestureEngine.h"
1194 #include "DebugDBusInterface.h"
1195 #include "SwitcherController.h"
1196 #include "UBusWrapper.h"
1198 DashController::Ptr dashController;
1199 PanelController* panelController;
1200 SwitcherController* switcherController;
1201 - GestureEngine* gestureEngine;
1202 nux::WindowThread* wt;
1203 nux::BaseWindow* launcherWindow;
1204 nux::BaseWindow* panelWindow;
1205 diff -Naur unity-4.24.0.orig/tests/CMakeLists.txt unity-4.24.0/tests/CMakeLists.txt
1206 --- unity-4.24.0.orig/tests/CMakeLists.txt 2011-10-12 14:02:40.000000000 +0200
1207 +++ unity-4.24.0/tests/CMakeLists.txt 2011-11-12 18:12:39.441970984 +0100
1209 ${UNITY_SRC}/LauncherHoverMachine.h
1210 ${UNITY_SRC}/LauncherDragWindow.cpp
1211 ${UNITY_SRC}/LauncherDragWindow.h
1212 - ${UNITY_SRC}/GeisAdapter.cpp
1213 - ${UNITY_SRC}/GeisAdapter.h
1214 ${UNITY_SRC}/WindowManager.h
1215 ${UNITY_SRC}/WindowManager.cpp
1216 ${UNITY_SRC}/IconRenderer.cpp