Merge lp:~unity-team/unity/touchy-feely into lp:unity
- touchy-feely
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 466 |
Proposed branch: | lp:~unity-team/unity/touchy-feely |
Merge into: | lp:unity |
Diff against target: |
2436 lines (+2240/-5) 16 files modified
.bzrignore (+6/-0) configure.ac (+2/-0) targets/mutter/expose-manager.vala (+2/-1) targets/mutter/plugin.vala (+493/-1) unity-private/Makefile.am (+11/-0) unity-private/gesture/gesture-dispatcher-xcb-glu.vala (+24/-0) unity-private/gesture/gesture-dispatcher-xcb-glue.c (+448/-0) unity-private/gesture/gesture-dispatcher-xcb.vala (+34/-0) unity-private/gesture/gesture-dispatcher.vala (+26/-0) unity-private/gesture/gesture-event.vala (+164/-0) unity-private/gesture/gesture.c (+467/-0) unity-private/gesture/gesture.h (+547/-0) unity-private/launcher/scroller-view.vala (+0/-3) unity-private/testing/background.vala (+5/-0) unity-private/testing/test-window.vala (+3/-0) vapi/mutter-2.28.vapi (+8/-0) |
To merge this branch: | bzr merge lp:~unity-team/unity/touchy-feely |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Unity Team | Pending | ||
Review via email: mp+33794@code.launchpad.net |
Commit message
Description of the change
Initial gesture bits. Going to be changed again before next week, but this is the result of the initial development phase.
You'll need to
sudo apt-get install utouch libutouch-grail-dev libxcb-icccm1-dev
The actual dispatch of gestures code will be tweaked again to have gesture-handler objects (so you don't have an epic if/def), I couldn't land that for this week, unfortunately.
Apart from that, please make sure the code makes sense and, the most important thing, doesn't kill your system if you don't have any MT.
Thanks!
if you do have MT, then
- three-finger-drag to move windows (move them toward the top for maximize options)
- splay to maxmize, splay again to fullscreen
- pinch to unfullscreen, pinch again to unmaximise
- four-finger-tap for dash
- four-finger-
*** These gestures are _NOT_ final ***
Preview Diff
1 | === modified file '.bzrignore' |
2 | --- .bzrignore 2010-08-23 17:01:29 +0000 |
3 | +++ .bzrignore 2010-08-26 15:13:42 +0000 |
4 | @@ -344,6 +344,12 @@ |
5 | unity-private/places/places-volume-controller.c |
6 | unity-private/places/places-volume-child-controller.c |
7 | tests/unit/test-place-browser.c |
8 | +unity-private/gesture/gesture-dispatcher-xcb-glu.c |
9 | +unity-private/gesture/gesture-dispatcher-xcb.c |
10 | +unity-private/gesture/gesture-dispatcher.c |
11 | +unity-private/gesture/gesture-event.c |
12 | +unity-private/gesture/gesture-dispatcher-geis-glu.c |
13 | +unity-private/gesture/gesture-dispatcher-geis.c |
14 | unity-private/places/places-place-home-renderer.c |
15 | unity/unity-stripe-texture.c |
16 | unity/unity-layered-bin.c |
17 | |
18 | === modified file 'configure.ac' |
19 | --- configure.ac 2010-08-25 11:12:12 +0000 |
20 | +++ configure.ac 2010-08-26 15:13:42 +0000 |
21 | @@ -118,6 +118,8 @@ |
22 | pango >= 1.6.0 |
23 | unique-1.0 |
24 | unity-misc |
25 | + utouch-grail |
26 | + xcb-icccm |
27 | x11) |
28 | |
29 | AC_SUBST(BASE_CFLAGS) |
30 | |
31 | === modified file 'targets/mutter/expose-manager.vala' |
32 | --- targets/mutter/expose-manager.vala 2010-08-19 10:36:39 +0000 |
33 | +++ targets/mutter/expose-manager.vala 2010-08-26 15:13:42 +0000 |
34 | @@ -235,7 +235,8 @@ |
35 | |
36 | public class ExposeManager : Object |
37 | { |
38 | - private List<ExposeClone> exposed_windows; |
39 | + public List<ExposeClone> exposed_windows; |
40 | + |
41 | private Clutter.Group expose_group; |
42 | private Plugin owner; |
43 | private Clutter.Stage stage; |
44 | |
45 | === modified file 'targets/mutter/plugin.vala' |
46 | --- targets/mutter/plugin.vala 2010-08-19 10:36:39 +0000 |
47 | +++ targets/mutter/plugin.vala 2010-08-26 15:13:42 +0000 |
48 | @@ -46,6 +46,7 @@ |
49 | ZERO, |
50 | } |
51 | |
52 | + /* |
53 | public class ActorBlur : Ctk.Bin |
54 | { |
55 | private Clutter.Clone clone; |
56 | @@ -70,6 +71,7 @@ |
57 | } |
58 | } |
59 | |
60 | + */ |
61 | public class Plugin : Object, Shell |
62 | { |
63 | /* Signals */ |
64 | @@ -159,6 +161,29 @@ |
65 | private DBus.Connection screensaver_conn; |
66 | private dynamic DBus.Object screensaver; |
67 | |
68 | + public Gesture.Dispatcher gesture_dispatcher; |
69 | + |
70 | + /* Pinch info */ |
71 | + private float start_pinch_radius = 0.0f; |
72 | + private unowned Mutter.Window? resize_window = null; |
73 | + /*private float resize_last_x1 = 0.0f; |
74 | + private float resize_last_y1 = 0.0f; |
75 | + private float resize_last_x2 = 0.0f; |
76 | + private float resize_last_y2 = 0.0f;*/ |
77 | + |
78 | + /* Pan info */ |
79 | + private unowned Mutter.Window? start_pan_window = null; |
80 | + private unowned Clutter.Rectangle? start_frame_rect = null; |
81 | + private float last_pan_x_root = 0.0f; |
82 | + private float last_pan_maximised_x_root = 0.0f; |
83 | + private enum MaximizeType { |
84 | + NONE, |
85 | + FULL, |
86 | + LEFT, |
87 | + RIGHT |
88 | + } |
89 | + private MaximizeType maximize_type = MaximizeType.NONE; |
90 | + |
91 | construct |
92 | { |
93 | fullscreen_requests = new Gee.ArrayList<Object> (); |
94 | @@ -317,8 +342,12 @@ |
95 | }); |
96 | } |
97 | |
98 | + gesture_dispatcher = new Gesture.XCBDispatcher (); |
99 | + gesture_dispatcher.gesture.connect (on_gesture_received); |
100 | + |
101 | this.ensure_input_region (); |
102 | return false; |
103 | + |
104 | } |
105 | |
106 | private void on_focus_window_changed () |
107 | @@ -770,6 +799,470 @@ |
108 | } |
109 | } |
110 | |
111 | + private void on_gesture_received (Gesture.Event event) |
112 | + { |
113 | + if (event.type == Gesture.Type.TAP && |
114 | + expose_manager.expose_showing == false) |
115 | + { |
116 | + if (event.fingers == 3) |
117 | + { |
118 | + ; |
119 | + } |
120 | + else if (event.fingers == 4) |
121 | + { |
122 | + show_unity (); |
123 | + } |
124 | + } |
125 | + else if (event.type == Gesture.Type.PINCH && |
126 | + places_showing == false) |
127 | + { |
128 | + if (event.fingers == 3) |
129 | + { |
130 | + if (event.state == Gesture.State.ENDED) |
131 | + { |
132 | + var actor = stage.get_actor_at_pos (Clutter.PickMode.ALL, |
133 | + (int)event.root_x, |
134 | + (int)event.root_y); |
135 | + |
136 | + while (!(actor is Mutter.Window) && actor != null && actor != stage) |
137 | + actor = actor.get_parent (); |
138 | + |
139 | + if (actor is Mutter.Window) |
140 | + { |
141 | + unowned Mutter.MetaWindow win = (actor as Mutter.Window).get_meta_window (); |
142 | + bool fullscreen = false; |
143 | + |
144 | + (win as Object).get ("fullscreen", out fullscreen); |
145 | + |
146 | + if (event.pinch_event.radius_delta >= 0.0f) |
147 | + { |
148 | + if (Mutter.MetaWindow.is_maximized (win)) |
149 | + { |
150 | + /* Fullscreen */ |
151 | + Mutter.MetaWindow.make_fullscreen (win); |
152 | + } |
153 | + else |
154 | + { |
155 | + /* Maximize */ |
156 | + Mutter.MetaWindow.maximize (win, |
157 | + Mutter.MetaMaximizeFlags.HORIZONTAL | |
158 | + Mutter.MetaMaximizeFlags.VERTICAL); |
159 | + } |
160 | + |
161 | + } |
162 | + else |
163 | + { |
164 | + if (fullscreen) |
165 | + { |
166 | + Mutter.MetaWindow.unmake_fullscreen (win); |
167 | + } |
168 | + else if (Mutter.MetaWindow.is_maximized (win)) |
169 | + { |
170 | + Mutter.MetaWindow.unmaximize (win, |
171 | + Mutter.MetaMaximizeFlags.HORIZONTAL | Mutter.MetaMaximizeFlags.VERTICAL); |
172 | + } |
173 | + } |
174 | + } |
175 | + } |
176 | + |
177 | + /* FIXME: This can't work with the current information we are getting */ |
178 | + /* |
179 | + debug ("Resize Window"); |
180 | + if (true == true) |
181 | + return; |
182 | + |
183 | + if (event.state == Gesture.State.BEGAN) |
184 | + { |
185 | + resize_window = null; |
186 | + |
187 | + var actor = stage.get_actor_at_pos (Clutter.PickMode.ALL, |
188 | + (int)event.root_x, |
189 | + (int)event.root_y); |
190 | + if (actor is Mutter.Window == false) |
191 | + actor = actor.get_parent (); |
192 | + |
193 | + if (actor is Mutter.Window) |
194 | + { |
195 | + resize_window = actor as Mutter.Window; |
196 | + resize_last_x1 = event.pinch_event.bounding_box_x1; |
197 | + resize_last_y1 = event.pinch_event.bounding_box_y1; |
198 | + resize_last_x2 = event.pinch_event.bounding_box_x2; |
199 | + resize_last_y2 = event.pinch_event.bounding_box_y2; |
200 | + } |
201 | + } |
202 | + else if (event.state == Gesture.State.CONTINUED) |
203 | + { |
204 | + if (resize_window is Mutter.Window == false) |
205 | + return; |
206 | + |
207 | + print ("RESIZE: %f %f %f %f\n", |
208 | + resize_last_x1 - event.pinch_event.bounding_box_x1, |
209 | + resize_last_y1 - event.pinch_event.bounding_box_y1, |
210 | + resize_last_x2 - event.pinch_event.bounding_box_x2, |
211 | + resize_last_y2 - event.pinch_event.bounding_box_y2); |
212 | + |
213 | + var nx = resize_window.x; |
214 | + var ny = resize_window.y; |
215 | + var nwidth = resize_window.width; |
216 | + var nheight = resize_window.height; |
217 | + |
218 | + nx += (resize_last_x1 - event.pinch_event.bounding_box_x1) * event.pinch_event.radius_delta; |
219 | + ny += (resize_last_y1 - event.pinch_event.bounding_box_y1) * event.pinch_event.radius_delta; |
220 | + nwidth += (resize_last_x2 - event.pinch_event.bounding_box_x2) * event.pinch_event.radius_delta; |
221 | + nheight += (resize_last_y2 - event.pinch_event.bounding_box_y2) * event.pinch_event.radius_delta; |
222 | + |
223 | + Mutter.MetaWindow.move_resize (resize_window.get_meta_window (), |
224 | + false, |
225 | + (int)nx, |
226 | + (int)ny, |
227 | + (int)nwidth, |
228 | + (int)nheight); |
229 | + |
230 | + |
231 | + resize_last_x1 = event.pinch_event.bounding_box_x1; |
232 | + resize_last_y1 = event.pinch_event.bounding_box_y1; |
233 | + resize_last_x2 = event.pinch_event.bounding_box_x2; |
234 | + resize_last_y2 = event.pinch_event.bounding_box_y2; |
235 | + } |
236 | + else if (event.state == Gesture.State.ENDED) |
237 | + { |
238 | + if (resize_window is Mutter.Window == false) |
239 | + return; |
240 | + |
241 | + resize_window = null; |
242 | + } |
243 | + print (@"$event\n"); |
244 | + */ |
245 | + } |
246 | + else if (event.fingers == 4) |
247 | + { |
248 | + if (event.state == Gesture.State.BEGAN) |
249 | + { |
250 | + if (expose_manager.expose_showing) |
251 | + { |
252 | + expose_manager.end_expose (); |
253 | + } |
254 | + else |
255 | + { |
256 | + SList<Clutter.Actor> windows = new SList<Clutter.Actor> (); |
257 | + unowned GLib.List<Mutter.Window> mutter_windows = plugin.get_windows (); |
258 | + foreach (Mutter.Window w in mutter_windows) |
259 | + { |
260 | + windows.append (w); |
261 | + } |
262 | + expose_windows (windows, get_launcher_width_foobar () + 10); |
263 | + } |
264 | + |
265 | + foreach (ExposeClone clone in expose_manager.exposed_windows) |
266 | + { |
267 | + clone.get_animation ().get_timeline ().pause (); |
268 | + } |
269 | + |
270 | + start_pinch_radius = event.pinch_event.radius_delta; |
271 | + } |
272 | + else if (event.state == Gesture.State.CONTINUED) |
273 | + { |
274 | + foreach (ExposeClone clone in expose_manager.exposed_windows) |
275 | + { |
276 | + int I_JUST_PULLED_THIS_FROM_MY_FOO = 5; |
277 | + |
278 | + if (event.pinch_event.radius_delta >= 0) |
279 | + { |
280 | + if (start_pinch_radius < 0) |
281 | + { |
282 | + /* We're moving backward */ |
283 | + I_JUST_PULLED_THIS_FROM_MY_FOO *= -1; |
284 | + } |
285 | + } |
286 | + else |
287 | + { |
288 | + if (start_pinch_radius >= 0) |
289 | + { |
290 | + /* We're moving backward */ |
291 | + I_JUST_PULLED_THIS_FROM_MY_FOO *= -1; |
292 | + } |
293 | + } |
294 | + |
295 | + var tl = clone.get_animation ().get_timeline (); |
296 | + tl.advance (tl.get_elapsed_time () |
297 | + + I_JUST_PULLED_THIS_FROM_MY_FOO); |
298 | + |
299 | + float factor = (float)tl.get_elapsed_time () / |
300 | + (float)tl.get_duration (); |
301 | + |
302 | + Value v = Value (typeof (float)); |
303 | + |
304 | + var interval = clone.get_animation ().get_interval ("x"); |
305 | + interval.compute_value (factor, v); |
306 | + clone.x = v.get_float (); |
307 | + |
308 | + interval = clone.get_animation ().get_interval ("y"); |
309 | + interval.compute_value (factor, v); |
310 | + clone.y = v.get_float (); |
311 | + |
312 | + double scalex, scaley; |
313 | + clone.get_scale (out scalex, out scaley); |
314 | + |
315 | + v = Value (typeof (double)); |
316 | + |
317 | + interval = clone.get_animation ().get_interval ("scale-x"); |
318 | + interval.compute_value (factor, v); |
319 | + scalex = v.get_double (); |
320 | + |
321 | + interval = clone.get_animation ().get_interval ("scale-y"); |
322 | + interval.compute_value (factor, v); |
323 | + scaley = v.get_double (); |
324 | + |
325 | + clone.set_scale (scalex, scaley); |
326 | + } |
327 | + } |
328 | + else if (event.state == Gesture.State.ENDED) |
329 | + { |
330 | + foreach (ExposeClone clone in expose_manager.exposed_windows) |
331 | + { |
332 | + var anim = clone.get_animation (); |
333 | + |
334 | + Value v = Value (typeof (float)); |
335 | + |
336 | + var interval = anim.get_interval ("x"); |
337 | + v.set_float (clone.x); |
338 | + interval.set_initial_value (v); |
339 | + |
340 | + interval = anim.get_interval ("y"); |
341 | + v.set_float (clone.y); |
342 | + interval.set_initial_value (v); |
343 | + |
344 | + v = Value (typeof (double)); |
345 | + double scalex, scaley; |
346 | + clone.get_scale (out scalex, out scaley); |
347 | + |
348 | + interval = anim.get_interval ("scale-x"); |
349 | + v.set_double (scalex); |
350 | + interval.set_initial_value (v); |
351 | + |
352 | + interval = anim.get_interval ("scale-y"); |
353 | + v.set_double (scaley); |
354 | + interval.set_initial_value (v); |
355 | + |
356 | + clone.get_animation ().get_timeline ().start (); |
357 | + clone.queue_relayout (); |
358 | + } |
359 | + } |
360 | + } |
361 | + } |
362 | + else if (event.type == Gesture.Type.PAN) |
363 | + { |
364 | + if (resize_window is Mutter.Window) |
365 | + return; |
366 | + if (event.fingers == 3) |
367 | + { |
368 | + if (event.state == Gesture.State.BEGAN) |
369 | + { |
370 | + start_pan_window = null; |
371 | + |
372 | + var actor = stage.get_actor_at_pos (Clutter.PickMode.ALL, |
373 | + (int)event.root_x, |
374 | + (int)event.root_y); |
375 | + if (actor is Mutter.Window == false) |
376 | + actor = actor.get_parent (); |
377 | + |
378 | + if (actor is Mutter.Window) |
379 | + { |
380 | + start_pan_window = actor as Mutter.Window; |
381 | + |
382 | + if (start_pan_window.get_window_type () != Mutter.MetaCompWindowType.NORMAL && |
383 | + start_pan_window.get_window_type () != Mutter.MetaCompWindowType.DIALOG && |
384 | + start_pan_window.get_window_type () != Mutter.MetaCompWindowType.MODAL_DIALOG && |
385 | + start_pan_window.get_window_type () != Mutter.MetaCompWindowType.UTILITY) |
386 | + start_pan_window = null; |
387 | + } |
388 | + } |
389 | + else if (event.state == Gesture.State.CONTINUED) |
390 | + { |
391 | + if (start_pan_window is Mutter.Window == false) |
392 | + return; |
393 | + |
394 | + last_pan_x_root = event.root_x; |
395 | + |
396 | + unowned Mutter.MetaWindow win = start_pan_window.get_meta_window (); |
397 | + bool fullscreen = false; |
398 | + win.get ("fullscreen", out fullscreen); |
399 | + |
400 | + if (!Mutter.MetaWindow.is_maximized (win) && fullscreen == false) |
401 | + { |
402 | + if (start_pan_window.y == PANEL_HEIGHT |
403 | + && event.pan_event.delta_y < 0.0f) |
404 | + { |
405 | + if (start_frame_rect is Clutter.Rectangle == false) |
406 | + { |
407 | + Clutter.Rectangle frame = new Clutter.Rectangle.with_color ({ 0, 0, 0, 10 }); |
408 | + frame.border_color = { 255, 255, 255, 255 }; |
409 | + frame.border_width = 3; |
410 | + |
411 | + stage.add_actor (frame); |
412 | + frame.set_size (start_pan_window.width, |
413 | + start_pan_window.height); |
414 | + frame.set_position (start_pan_window.x, |
415 | + start_pan_window.y); |
416 | + frame.show (); |
417 | + |
418 | + start_frame_rect = frame; |
419 | + |
420 | + last_pan_maximised_x_root = event.root_x; |
421 | + } |
422 | + |
423 | + maximize_type = MaximizeType.FULL; |
424 | + var MAX_DELTA = 50.0f; |
425 | + if (event.root_x < last_pan_maximised_x_root - MAX_DELTA) |
426 | + { |
427 | + maximize_type = MaximizeType.LEFT; |
428 | + start_frame_rect.animate (Clutter.AnimationMode.EASE_OUT_QUAD, |
429 | + 150, |
430 | + "x", (float)QUICKLAUNCHER_WIDTH, |
431 | + "y", (float)PANEL_HEIGHT, |
432 | + "width", (stage.width - QUICKLAUNCHER_WIDTH)/2.0f, |
433 | + "height", stage.height - PANEL_HEIGHT); |
434 | + |
435 | + } |
436 | + else if (event.root_x > last_pan_maximised_x_root + MAX_DELTA) |
437 | + { |
438 | + maximize_type = MaximizeType.RIGHT; |
439 | + start_frame_rect.animate (Clutter.AnimationMode.EASE_OUT_QUAD, |
440 | + 150, |
441 | + "x", (float)((stage.width - QUICKLAUNCHER_WIDTH)/2.0f) + QUICKLAUNCHER_WIDTH, |
442 | + "y", (float)PANEL_HEIGHT, |
443 | + "width", (stage.width - QUICKLAUNCHER_WIDTH)/2.0f, |
444 | + "height", stage.height - PANEL_HEIGHT); |
445 | + } |
446 | + else |
447 | + { |
448 | + start_frame_rect.animate (Clutter.AnimationMode.EASE_OUT_QUAD, |
449 | + 150, |
450 | + "x", (float)QUICKLAUNCHER_WIDTH, |
451 | + "y", (float)PANEL_HEIGHT, |
452 | + "width", stage.width - QUICKLAUNCHER_WIDTH, |
453 | + "height", stage.height - PANEL_HEIGHT); |
454 | + |
455 | + } |
456 | + } |
457 | + else |
458 | + { |
459 | + start_pan_window.x += Math.floorf (event.pan_event.delta_x + 0.5f); |
460 | + start_pan_window.y += Math.floorf (event.pan_event.delta_y + 0.5f); |
461 | + start_pan_window.x = float.max (start_pan_window.x, QUICKLAUNCHER_WIDTH); |
462 | + start_pan_window.y = float.max (start_pan_window.y, PANEL_HEIGHT); |
463 | + |
464 | + if (start_frame_rect is Clutter.Rectangle) |
465 | + { |
466 | + if (start_frame_rect.opacity == 0) |
467 | + { |
468 | + stage.remove_actor (start_frame_rect); |
469 | + start_frame_rect = null; |
470 | + } |
471 | + else if (start_pan_window.y > PANEL_HEIGHT + 5 && |
472 | + (start_frame_rect.get_animation () is Clutter.Animation == false)) |
473 | + { |
474 | + start_frame_rect.animate (Clutter.AnimationMode.EASE_IN_QUAD, |
475 | + 150, |
476 | + "x", start_pan_window.x, |
477 | + "y", start_pan_window.y, |
478 | + "width", start_pan_window.width, |
479 | + "height", start_pan_window.height, |
480 | + "opacity", 0); |
481 | + } |
482 | + } |
483 | + } |
484 | + } |
485 | + else |
486 | + { |
487 | + if (event.pan_event.delta_y >= 0.0f && fullscreen == false) |
488 | + { |
489 | + Mutter.MetaWindow.unmaximize (win, |
490 | + Mutter.MetaMaximizeFlags.HORIZONTAL | Mutter.MetaMaximizeFlags.VERTICAL); |
491 | + } |
492 | + } |
493 | + } |
494 | + else if (event.state == Gesture.State.ENDED) |
495 | + { |
496 | + if (start_pan_window is Mutter.Window) |
497 | + { |
498 | + unowned Mutter.MetaWindow win = start_pan_window.get_meta_window (); |
499 | + float nx = 0; |
500 | + float ny = 0; |
501 | + float nwidth = 0; |
502 | + float nheight = 0; |
503 | + bool move_resize = false; |
504 | + bool fullscreen = false; |
505 | + win.get ("fullscreen", out fullscreen); |
506 | + |
507 | + int wx, wy, ww, wh; |
508 | + Mutter.MetaWindow.get_geometry (win, out wx, out wy, out ww, out wh); |
509 | + Mutter.MetaRectangle rect = Mutter.MetaRectangle (); |
510 | + Mutter.MetaWindow.get_outer_rect (win, rect); |
511 | + |
512 | + if (Mutter.MetaWindow.is_maximized (win) || fullscreen) |
513 | + { |
514 | + } |
515 | + else if (start_pan_window.y == PANEL_HEIGHT && event.pan_event.delta_y < 0.0f) |
516 | + { |
517 | + if (maximize_type == MaximizeType.FULL) |
518 | + { |
519 | + |
520 | + Mutter.MetaWindow.maximize (win, |
521 | + Mutter.MetaMaximizeFlags.HORIZONTAL | Mutter.MetaMaximizeFlags.VERTICAL); |
522 | + } |
523 | + else if (maximize_type == MaximizeType.RIGHT) |
524 | + { |
525 | + nx = (float)QUICKLAUNCHER_WIDTH + (stage.width-QUICKLAUNCHER_WIDTH)/2.0f; |
526 | + ny = (float)PANEL_HEIGHT; |
527 | + nwidth = (stage.width - QUICKLAUNCHER_WIDTH)/2.0f; |
528 | + nheight = stage.height - PANEL_HEIGHT; |
529 | + |
530 | + move_resize = true; |
531 | + } |
532 | + else if (maximize_type == MaximizeType.LEFT) |
533 | + { |
534 | + nx = (float)QUICKLAUNCHER_WIDTH; |
535 | + ny = (float)PANEL_HEIGHT; |
536 | + nwidth = (stage.width - QUICKLAUNCHER_WIDTH)/2.0f; |
537 | + nheight = stage.height - PANEL_HEIGHT; |
538 | + |
539 | + move_resize = true; |
540 | + } |
541 | + } |
542 | + else |
543 | + { |
544 | + /* FIXME: We need to somehow convince Mutter to tell |
545 | + * us the size of the frame. 27 = top + bottom frame |
546 | + * 1 = left frame |
547 | + * 24 = size of top frame |
548 | + */ |
549 | + nx = start_pan_window.x; |
550 | + ny = start_pan_window.y; /* Kittens are dying */ |
551 | + nwidth = start_pan_window.width; |
552 | + nheight = start_pan_window.height; |
553 | + move_resize = true; |
554 | + |
555 | + print ("%d %d %d %d\n",wx, wy, rect.x, rect.y); |
556 | + } |
557 | + |
558 | + X.Window xwin = start_pan_window.get_x_window (); |
559 | + unowned Gdk.Window w = Gdk.Window.foreign_new ((Gdk.NativeWindow)xwin); |
560 | + if (w is Gdk.Window && move_resize) |
561 | + { |
562 | + Mutter.MetaWindow.move_resize (win, false, ((int)nx), |
563 | + ((int)ny), |
564 | + (int)nwidth, (int)nheight); |
565 | + } |
566 | + } |
567 | + |
568 | + if (start_frame_rect is Clutter.Rectangle) |
569 | + stage.remove_actor (start_frame_rect); |
570 | + } |
571 | + } |
572 | + } |
573 | + } |
574 | + |
575 | /* |
576 | * MUTTER PLUGIN HOOKS |
577 | */ |
578 | @@ -889,6 +1382,5 @@ |
579 | { |
580 | return this.get_launcher_width (); |
581 | } |
582 | - |
583 | } |
584 | } |
585 | |
586 | === modified file 'unity-private/Makefile.am' |
587 | --- unity-private/Makefile.am 2010-08-19 14:58:10 +0000 |
588 | +++ unity-private/Makefile.am 2010-08-26 15:13:42 +0000 |
589 | @@ -127,6 +127,13 @@ |
590 | launcher/scroller-model.vala \ |
591 | launcher/scroller-view.vala |
592 | |
593 | +gesture_sources = \ |
594 | + gesture/gesture-dispatcher.vala \ |
595 | + gesture/gesture-dispatcher-xcb.vala \ |
596 | + gesture/gesture-dispatcher-xcb-glu.vala \ |
597 | + gesture/gesture-event.vala |
598 | + |
599 | + |
600 | testing_sources = \ |
601 | testing/background.vala \ |
602 | testing/object-registry.vala \ |
603 | @@ -136,6 +143,7 @@ |
604 | testing/test-window.vala |
605 | |
606 | libunity_private_la_VALASOURCES = \ |
607 | + $(gesture_sources) \ |
608 | $(private_sources) \ |
609 | $(panel_sources) \ |
610 | $(places_sources) \ |
611 | @@ -143,6 +151,9 @@ |
612 | $(testing_sources) |
613 | |
614 | libunity_private_la_SOURCES = \ |
615 | + gesture/gesture.c \ |
616 | + gesture/gesture.h \ |
617 | + gesture/gesture-dispatcher-xcb-glue.c \ |
618 | unity-utils.c \ |
619 | unity-utils.h \ |
620 | $(libunity_private_la_VALASOURCES:.vala=.c) |
621 | |
622 | === added directory 'unity-private/gesture' |
623 | === added file 'unity-private/gesture/gesture-dispatcher-xcb-glu.vala' |
624 | --- unity-private/gesture/gesture-dispatcher-xcb-glu.vala 1970-01-01 00:00:00 +0000 |
625 | +++ unity-private/gesture/gesture-dispatcher-xcb-glu.vala 2010-08-26 15:13:42 +0000 |
626 | @@ -0,0 +1,24 @@ |
627 | +/* |
628 | + * Copyright (C) 2010 Canonical Ltd |
629 | + * |
630 | + * This program is free software: you can redistribute it and/or modify |
631 | + * it under the terms of the GNU General Public License version 3 as |
632 | + * published by the Free Software Foundation. |
633 | + * |
634 | + * This program is distributed in the hope that it will be useful, |
635 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
636 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
637 | + * GNU General Public License for more details. |
638 | + * |
639 | + * You should have received a copy of the GNU General Public License |
640 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
641 | + * |
642 | + * Authored by Neil Jagdish Patel <neil.patel@canonical.com> |
643 | + * |
644 | + */ |
645 | + |
646 | +namespace Unity.Gesture.XCBDispatcherGlue |
647 | +{ |
648 | + public extern void init (GLib.Object obj); |
649 | + public extern void finish (); |
650 | +} |
651 | |
652 | === added file 'unity-private/gesture/gesture-dispatcher-xcb-glue.c' |
653 | --- unity-private/gesture/gesture-dispatcher-xcb-glue.c 1970-01-01 00:00:00 +0000 |
654 | +++ unity-private/gesture/gesture-dispatcher-xcb-glue.c 2010-08-26 15:13:42 +0000 |
655 | @@ -0,0 +1,448 @@ |
656 | +/* |
657 | + * Copyright (C) 2010 Canonical Ltd |
658 | + * |
659 | + * This program is free software: you can redistribute it and/or modify |
660 | + * it under the terms of the GNU General Public License version 3 as |
661 | + * published by the Free Software Foundation. |
662 | + * |
663 | + * This program is distributed in the hope that it will be useful, |
664 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
665 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
666 | + * GNU General Public License for more details. |
667 | + * |
668 | + * You should have received a copy of the GNU General Public License |
669 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
670 | + * |
671 | + * Authored by Neil Jagdish Patel <neil.patel@canonical.com> |
672 | + * Chase Douglas <chase.douglas@canonical.com> |
673 | + * |
674 | + */ |
675 | + |
676 | +#include <limits.h> |
677 | +#include <stdio.h> |
678 | +#include <stdlib.h> |
679 | +#include <string.h> |
680 | +#include <xcb/xcb.h> |
681 | +#include <xcb/xcb_icccm.h> |
682 | +#include <X11/X.h> |
683 | + |
684 | +#include <glib.h> |
685 | +#include <glib-object.h> |
686 | + |
687 | +#include <grail.h> |
688 | + |
689 | +#include "gesture.h" |
690 | + |
691 | +#include "../unity-private.h" |
692 | + |
693 | +#define XCB_DISPATCHER_TIMEOUT 100 |
694 | + |
695 | +typedef struct |
696 | +{ |
697 | + GSource source; |
698 | + |
699 | + |
700 | + xcb_connection_t *connection; |
701 | + xcb_generic_event_t *event; |
702 | + |
703 | + GObject *dispatcher; |
704 | + |
705 | + UnityGestureEvent *gesture_event; |
706 | + |
707 | +} XCBSource; |
708 | + |
709 | +static gboolean source_prepare (GSource *source, gint *timeout); |
710 | +static gboolean source_check (GSource *source); |
711 | +static gboolean source_dispatch(GSource *source, |
712 | + GSourceFunc callback, |
713 | + gpointer user_data); |
714 | +static void source_finalize(GSource *source); |
715 | + |
716 | +static gint set_mask (xcb_connection_t *connection, |
717 | + xcb_window_t window, |
718 | + uint16_t device_id, |
719 | + uint16_t mask_len, |
720 | + uint32_t *mask); |
721 | + |
722 | +static GSourceFuncs XCBFuncs = { |
723 | + &source_prepare, |
724 | + &source_check, |
725 | + &source_dispatch, |
726 | + &source_finalize, |
727 | + 0, |
728 | + 0 |
729 | +}; |
730 | + |
731 | +void |
732 | +unity_gesture_xcb_dispatcher_glue_init (GObject *object) |
733 | +{ |
734 | + g_debug ("%s", G_STRFUNC); |
735 | + xcb_connection_t *connection; |
736 | + XCBSource *source; |
737 | + uint16_t mask_len = 1; |
738 | + grail_mask_t *mask; |
739 | + |
740 | + connection = xcb_connect (NULL, NULL); |
741 | + |
742 | + mask = calloc (1, sizeof(grail_mask_t) * mask_len); |
743 | + |
744 | + /* Fiddle */ |
745 | + grail_mask_set (mask, GRAIL_TYPE_TAP3); |
746 | + grail_mask_set (mask, GRAIL_TYPE_TAP4); |
747 | + |
748 | + /* Gropes */ |
749 | + grail_mask_set (mask, GRAIL_TYPE_EPINCH); |
750 | + grail_mask_set (mask, GRAIL_TYPE_MPINCH); |
751 | + |
752 | + /* Pots and */ |
753 | + grail_mask_set (mask, GRAIL_TYPE_EDRAG); |
754 | + grail_mask_set (mask, GRAIL_TYPE_MDRAG); |
755 | + |
756 | + if (set_mask (connection, 0, 0, mask_len, (uint32_t*)mask)) |
757 | + { |
758 | + g_warning ("Unable to initialize gesture dispatcher xcb"); |
759 | + return; |
760 | + } |
761 | + |
762 | + source = (XCBSource*)g_source_new (&XCBFuncs, sizeof(XCBSource)); |
763 | + source->connection = connection; |
764 | + source->dispatcher = object; |
765 | + source->gesture_event = unity_gesture_event_new (); |
766 | + source->gesture_event->pan_event = unity_gesture_pan_event_new (); |
767 | + source->gesture_event->pinch_event = unity_gesture_pinch_event_new (); |
768 | + source->gesture_event->tap_event = unity_gesture_tap_event_new (); |
769 | + |
770 | + g_source_attach (&source->source, NULL); |
771 | +} |
772 | + |
773 | +void |
774 | +unity_gesture_xcb_dispatcher_glue_finish () |
775 | +{ |
776 | + g_debug ("%s", G_STRFUNC); |
777 | +} |
778 | + |
779 | +void |
780 | +unity_gesture_xcb_dispatcher_glue_main_iteration (XCBSource *source) |
781 | +{ |
782 | + const xcb_query_extension_reply_t *extension_info; |
783 | + xcb_connection_t *connection = source->connection; |
784 | + |
785 | + extension_info = xcb_get_extension_data(connection, &xcb_gesture_id); |
786 | + |
787 | + if (source->event != NULL) |
788 | + { |
789 | + xcb_generic_event_t *event; |
790 | + xcb_gesture_notify_event_t *gesture_event; |
791 | + float *properties; |
792 | + int i; |
793 | + UnityGestureEvent *dispatch_event = source->gesture_event; |
794 | + |
795 | + dispatch_event->type = UNITY_GESTURE_TYPE_NONE; |
796 | + |
797 | + event = source->event; |
798 | + if (!event) |
799 | + { |
800 | + fprintf (stderr, "Warning: I/O error while waiting for event\n"); |
801 | + return; |
802 | + } |
803 | + |
804 | + if (event->response_type != GenericEvent) |
805 | + { |
806 | + fprintf (stderr, "Warning: Received non-generic event type: " |
807 | + "%d\n", event->response_type); |
808 | + return; |
809 | + } |
810 | + |
811 | + gesture_event = (xcb_gesture_notify_event_t *)event; |
812 | + properties = (float *)(gesture_event + 1); |
813 | + |
814 | + if (gesture_event->extension != extension_info->major_opcode) |
815 | + { |
816 | + fprintf (stderr, "Warning: Received non-gesture extension " |
817 | + "event: %d\n", gesture_event->extension); |
818 | + return; |
819 | + } |
820 | + |
821 | + if (gesture_event->event_type != XCB_GESTURE_NOTIFY) |
822 | + { |
823 | + fprintf (stderr, "Warning: Received unrecognized gesture event " |
824 | + "type: %d\n", gesture_event->event_type); |
825 | + return; |
826 | + } |
827 | + |
828 | + switch (gesture_event->gesture_type) |
829 | + { |
830 | + case GRAIL_TYPE_EDRAG: |
831 | + case GRAIL_TYPE_MDRAG: |
832 | + dispatch_event->type = UNITY_GESTURE_TYPE_PAN; |
833 | + dispatch_event->fingers = gesture_event->gesture_type == GRAIL_TYPE_EDRAG ? 3 : 4; |
834 | + |
835 | + break; |
836 | + case GRAIL_TYPE_EPINCH: |
837 | + case GRAIL_TYPE_MPINCH: |
838 | + dispatch_event->type = UNITY_GESTURE_TYPE_PINCH; |
839 | + dispatch_event->fingers = gesture_event->gesture_type == GRAIL_TYPE_EPINCH ? 3 : 4; |
840 | + break; |
841 | + case GRAIL_TYPE_TAP3: |
842 | + case GRAIL_TYPE_TAP4: |
843 | + dispatch_event->type = UNITY_GESTURE_TYPE_TAP; |
844 | + dispatch_event->fingers = |
845 | + gesture_event->gesture_type == GRAIL_TYPE_TAP3 ? 3 : 4; |
846 | + break; |
847 | + default: |
848 | + g_warning ("Unknown Gesture Event Type %d\n", |
849 | + gesture_event->gesture_type); |
850 | + break; |
851 | + } |
852 | + |
853 | + if (dispatch_event->type != UNITY_GESTURE_TYPE_NONE) |
854 | + { |
855 | + dispatch_event->device_id = gesture_event->device_id; |
856 | + dispatch_event->gesture_id = gesture_event->gesture_id; |
857 | + dispatch_event->timestamp = gesture_event->time; |
858 | + dispatch_event->state = gesture_event->status; |
859 | + dispatch_event->root_x = (gint32)gesture_event->focus_x; |
860 | + dispatch_event->root_y = (gint32)gesture_event->focus_y; |
861 | + dispatch_event->root_window = gesture_event->root; |
862 | + dispatch_event->event_window = gesture_event->event; |
863 | + dispatch_event->child_window = gesture_event->child; |
864 | + |
865 | + g_signal_emit_by_name (source->dispatcher, |
866 | + "gesture", |
867 | + dispatch_event); |
868 | + } |
869 | + |
870 | + /* Load in properties */ |
871 | + if (dispatch_event->type == UNITY_GESTURE_TYPE_PAN && |
872 | + gesture_event->num_props >= 6) |
873 | + { |
874 | + UnityGesturePanEvent *ev = dispatch_event->pan_event; |
875 | + ev->delta_x = properties[GRAIL_PROP_DRAG_DX]; |
876 | + ev->delta_y = properties[GRAIL_PROP_DRAG_DY]; |
877 | + ev->velocity_x = properties[GRAIL_PROP_DRAG_VX]; |
878 | + ev->velocity_y = properties[GRAIL_PROP_DRAG_VY]; |
879 | + ev->x = properties[GRAIL_PROP_DRAG_X]; |
880 | + ev->y = properties[GRAIL_PROP_DRAG_Y]; |
881 | + } |
882 | + else if (dispatch_event->type == UNITY_GESTURE_TYPE_PINCH && |
883 | + gesture_event->num_props >= 7) |
884 | + { |
885 | + UnityGesturePinchEvent *ev = dispatch_event->pinch_event; |
886 | + ev->radius_delta = properties[GRAIL_PROP_PINCH_DR]; |
887 | + ev->radius_velocity = properties[GRAIL_PROP_PINCH_VR]; |
888 | + ev->radius = properties[GRAIL_PROP_PINCH_R]; |
889 | + ev->bounding_box_x1 = properties[GRAIL_PROP_PINCH_X1]; |
890 | + ev->bounding_box_y1 = properties[GRAIL_PROP_PINCH_Y1]; |
891 | + ev->bounding_box_x2 = properties[GRAIL_PROP_PINCH_X2]; |
892 | + ev->bounding_box_y2 = properties[GRAIL_PROP_PINCH_Y2]; |
893 | + |
894 | + } |
895 | + else if (dispatch_event->type == UNITY_GESTURE_TYPE_TAP && |
896 | + gesture_event->num_props >= 3) |
897 | + { |
898 | + UnityGestureTapEvent *ev = dispatch_event->tap_event; |
899 | + ev->duration = properties[GRAIL_PROP_TAP_DT]; |
900 | + ev->x2 = properties[GRAIL_PROP_TAP_X]; |
901 | + ev->y2 = properties[GRAIL_PROP_TAP_Y]; |
902 | + } |
903 | + } |
904 | +} |
905 | + |
906 | +static gboolean |
907 | +source_prepare (GSource *source, gint *timeout) |
908 | +{ |
909 | + XCBSource *s = (XCBSource *)source; |
910 | + |
911 | + *timeout = XCB_DISPATCHER_TIMEOUT; |
912 | + |
913 | + s->event = xcb_poll_for_event (s->connection); |
914 | + |
915 | + return s->event == NULL ? FALSE : TRUE; |
916 | +} |
917 | + |
918 | +static gboolean |
919 | +source_check (GSource *source) |
920 | +{ |
921 | + return ((XCBSource*)source)->event == NULL ? FALSE : TRUE; |
922 | +} |
923 | + |
924 | +static gboolean |
925 | +source_dispatch(GSource *source, |
926 | + GSourceFunc callback, |
927 | + gpointer user_data) |
928 | +{ |
929 | + unity_gesture_xcb_dispatcher_glue_main_iteration ((XCBSource*)source); |
930 | + return TRUE; |
931 | +} |
932 | + |
933 | +static void |
934 | +source_finalize (GSource *source) |
935 | +{ |
936 | + |
937 | +} |
938 | + |
939 | +static int set_mask_on_window(xcb_connection_t *connection, xcb_window_t window, |
940 | + uint16_t device_id, uint16_t mask_len, |
941 | + uint32_t *mask) { |
942 | + xcb_generic_error_t *error; |
943 | + xcb_void_cookie_t select_cookie; |
944 | + xcb_gesture_get_selected_events_cookie_t events_cookie; |
945 | + xcb_gesture_get_selected_events_reply_t *events_reply; |
946 | + xcb_gesture_event_mask_iterator_t events_iterator; |
947 | + int masks_len_reply; |
948 | + int mask_len_reply; |
949 | + uint32_t *mask_reply; |
950 | + |
951 | + select_cookie = xcb_gesture_select_events_checked(connection, window, |
952 | + device_id, mask_len, |
953 | + mask); |
954 | + error = xcb_request_check(connection, select_cookie); |
955 | + if (error) { |
956 | + fprintf(stderr, |
957 | + "Error: Failed to select events on window 0x%x\n", |
958 | + window); |
959 | + return -1; |
960 | + } |
961 | + |
962 | + events_cookie = xcb_gesture_get_selected_events(connection, window); |
963 | + events_reply = xcb_gesture_get_selected_events_reply(connection, |
964 | + events_cookie, |
965 | + &error); |
966 | + if (!events_reply) { |
967 | + fprintf(stderr, |
968 | + "Error: Failed to receive selected events reply on " |
969 | + "window 0x%x\n", window); |
970 | + return -1; |
971 | + } |
972 | + |
973 | + masks_len_reply = |
974 | + xcb_gesture_get_selected_events_masks_length(events_reply); |
975 | + if (masks_len_reply != 1) { |
976 | + fprintf(stderr, |
977 | + "Error: Wrong selected masks length returned: %d\n", |
978 | + masks_len_reply); |
979 | + return -1; |
980 | + } |
981 | + |
982 | + events_iterator = |
983 | + xcb_gesture_get_selected_events_masks_iterator(events_reply); |
984 | + if (events_iterator.data->device_id != device_id) { |
985 | + fprintf(stderr, |
986 | + "Error: Incorrect device id returned by server: %d\n", |
987 | + events_iterator.data->device_id); |
988 | + return -1; |
989 | + } |
990 | + |
991 | + mask_len_reply = |
992 | + xcb_gesture_event_mask_mask_data_length(events_iterator.data); |
993 | + if (mask_len_reply != mask_len) { |
994 | + fprintf(stderr, |
995 | + "Error: Incorrect mask length returned by server: %d\n", |
996 | + mask_len_reply); |
997 | + return -1; |
998 | + } |
999 | + |
1000 | + mask_reply = xcb_gesture_event_mask_mask_data(events_iterator.data); |
1001 | + if (memcmp(mask, mask_reply, mask_len * 4) != 0) { |
1002 | + fprintf(stderr, "Error: Incorrect mask returned by server\n"); |
1003 | + return -1; |
1004 | + } |
1005 | + |
1006 | + free(events_reply); |
1007 | + |
1008 | + return 0; |
1009 | +} |
1010 | + |
1011 | +static int set_mask_on_subwindows(xcb_connection_t *connection, |
1012 | + xcb_window_t window, uint16_t device_id, |
1013 | + uint16_t mask_len, uint32_t *mask) { |
1014 | + xcb_generic_error_t *error; |
1015 | + xcb_query_tree_cookie_t tree_cookie; |
1016 | + xcb_query_tree_reply_t *tree_reply; |
1017 | + xcb_window_t *children; |
1018 | + int num_children; |
1019 | + int i; |
1020 | + |
1021 | + if (set_mask_on_window(connection, window, device_id, mask_len, mask)) |
1022 | + return -1; |
1023 | + |
1024 | + tree_cookie = xcb_query_tree(connection, window); |
1025 | + tree_reply = xcb_query_tree_reply(connection, tree_cookie, &error); |
1026 | + if (!tree_reply) { |
1027 | + fprintf(stderr, "Error: Failed to query tree for window 0x%x\n", |
1028 | + window); |
1029 | + return -1; |
1030 | + } |
1031 | + |
1032 | + num_children = xcb_query_tree_children_length(tree_reply); |
1033 | + if (num_children <= 0) |
1034 | + return 0; |
1035 | + |
1036 | + children = xcb_query_tree_children(tree_reply); |
1037 | + if (!children) { |
1038 | + fprintf(stderr, |
1039 | + "Error: Failed to retrieve children of window 0x%x\n", |
1040 | + window); |
1041 | + return -1; |
1042 | + } |
1043 | + |
1044 | + for (i = 0; i < num_children; i++) |
1045 | + if (set_mask_on_subwindows(connection, children[i], device_id, |
1046 | + mask_len, mask)) |
1047 | + return -1; |
1048 | + |
1049 | + free(tree_reply); |
1050 | + |
1051 | + return 0; |
1052 | +} |
1053 | + |
1054 | +static int set_mask(xcb_connection_t *connection, xcb_window_t window, |
1055 | + uint16_t device_id, uint16_t mask_len, uint32_t *mask) { |
1056 | + xcb_generic_error_t *error; |
1057 | + xcb_gesture_query_version_cookie_t version_cookie; |
1058 | + xcb_gesture_query_version_reply_t *version_reply; |
1059 | + |
1060 | + version_cookie = xcb_gesture_query_version(connection, 0, 5); |
1061 | + version_reply = xcb_gesture_query_version_reply(connection, |
1062 | + version_cookie, &error); |
1063 | + if (!version_reply) { |
1064 | + fprintf(stderr, |
1065 | + "Error: Failed to receive gesture version reply\n"); |
1066 | + return -1; |
1067 | + } |
1068 | + |
1069 | + if (version_reply->major_version != 0 && |
1070 | + version_reply->minor_version != 5) { |
1071 | + fprintf(stderr, |
1072 | + "Error: Server supports unrecognized version: %d.%d\n", |
1073 | + version_reply->major_version, |
1074 | + version_reply->minor_version); |
1075 | + return -1; |
1076 | + } |
1077 | + |
1078 | + free(version_reply); |
1079 | + |
1080 | + if (window != 0) { |
1081 | + if (set_mask_on_window(connection, window, device_id, mask_len, |
1082 | + mask)) |
1083 | + return -1; |
1084 | + } |
1085 | + else { |
1086 | + const xcb_setup_t *setup; |
1087 | + xcb_screen_iterator_t screen; |
1088 | + |
1089 | + setup = xcb_get_setup(connection); |
1090 | + if (!setup) { |
1091 | + fprintf(stderr, "Error: Failed to get xcb setup\n"); |
1092 | + return -1; |
1093 | + } |
1094 | + |
1095 | + for (screen = xcb_setup_roots_iterator(setup); screen.rem; |
1096 | + xcb_screen_next(&screen)) |
1097 | + if (set_mask_on_subwindows(connection, |
1098 | + screen.data->root, device_id, mask_len, mask)) |
1099 | + return -1; |
1100 | + } |
1101 | + |
1102 | + return 0; |
1103 | +} |
1104 | |
1105 | === added file 'unity-private/gesture/gesture-dispatcher-xcb.vala' |
1106 | --- unity-private/gesture/gesture-dispatcher-xcb.vala 1970-01-01 00:00:00 +0000 |
1107 | +++ unity-private/gesture/gesture-dispatcher-xcb.vala 2010-08-26 15:13:42 +0000 |
1108 | @@ -0,0 +1,34 @@ |
1109 | +/* |
1110 | + * Copyright (C) 2010 Canonical Ltd |
1111 | + * |
1112 | + * This program is free software: you can redistribute it and/or modify |
1113 | + * it under the terms of the GNU General Public License version 3 as |
1114 | + * published by the Free Software Foundation. |
1115 | + * |
1116 | + * This program is distributed in the hope that it will be useful, |
1117 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1118 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1119 | + * GNU General Public License for more details. |
1120 | + * |
1121 | + * You should have received a copy of the GNU General Public License |
1122 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1123 | + * |
1124 | + * Authored by Neil Jagdish Patel <neil.patel@canonical.com> |
1125 | + * |
1126 | + */ |
1127 | + |
1128 | +namespace Unity.Gesture |
1129 | +{ |
1130 | + public class XCBDispatcher : Dispatcher |
1131 | + { |
1132 | + public XCBDispatcher () |
1133 | + { |
1134 | + XCBDispatcherGlue.init (this as GLib.Object); |
1135 | + } |
1136 | + |
1137 | + ~XCBDispatcher () |
1138 | + { |
1139 | + XCBDispatcherGlue.finish (); |
1140 | + } |
1141 | + } |
1142 | +} |
1143 | |
1144 | === added file 'unity-private/gesture/gesture-dispatcher.vala' |
1145 | --- unity-private/gesture/gesture-dispatcher.vala 1970-01-01 00:00:00 +0000 |
1146 | +++ unity-private/gesture/gesture-dispatcher.vala 2010-08-26 15:13:42 +0000 |
1147 | @@ -0,0 +1,26 @@ |
1148 | +/* |
1149 | + * Copyright (C) 2010 Canonical Ltd |
1150 | + * |
1151 | + * This program is free software: you can redistribute it and/or modify |
1152 | + * it under the terms of the GNU General Public License version 3 as |
1153 | + * published by the Free Software Foundation. |
1154 | + * |
1155 | + * This program is distributed in the hope that it will be useful, |
1156 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1157 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1158 | + * GNU General Public License for more details. |
1159 | + * |
1160 | + * You should have received a copy of the GNU General Public License |
1161 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1162 | + * |
1163 | + * Authored by Neil Jagdish Patel <neil.patel@canonical.com> |
1164 | + * |
1165 | + */ |
1166 | + |
1167 | +namespace Unity.Gesture |
1168 | +{ |
1169 | + public abstract class Dispatcher : GLib.Object |
1170 | + { |
1171 | + public signal void gesture (Gesture.Event event); |
1172 | + } |
1173 | +} |
1174 | |
1175 | === added file 'unity-private/gesture/gesture-event.vala' |
1176 | --- unity-private/gesture/gesture-event.vala 1970-01-01 00:00:00 +0000 |
1177 | +++ unity-private/gesture/gesture-event.vala 2010-08-26 15:13:42 +0000 |
1178 | @@ -0,0 +1,164 @@ |
1179 | +/* |
1180 | + * Copyright (C) 2010 Canonical Ltd |
1181 | + * |
1182 | + * This program is free software: you can redistribute it and/or modify |
1183 | + * it under the terms of the GNU General Public License version 3 as |
1184 | + * published by the Free Software Foundation. |
1185 | + * |
1186 | + * This program is distributed in the hope that it will be useful, |
1187 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1188 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1189 | + * GNU General Public License for more details. |
1190 | + * |
1191 | + * You should have received a copy of the GNU General Public License |
1192 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1193 | + * |
1194 | + * Authored by Neil Jagdish Patel <neil.patel@canonical.com> |
1195 | + * |
1196 | + */ |
1197 | + |
1198 | +using X; |
1199 | + |
1200 | +namespace Unity.Gesture |
1201 | +{ |
1202 | + public enum Type |
1203 | + { |
1204 | + NONE, |
1205 | + PAN, |
1206 | + PINCH, |
1207 | + ROTATE, |
1208 | + TAP |
1209 | + } |
1210 | + |
1211 | + public enum State |
1212 | + { |
1213 | + BEGAN, |
1214 | + CONTINUED, |
1215 | + ENDED |
1216 | + } |
1217 | + |
1218 | + public class Event |
1219 | + { |
1220 | + public Type type; |
1221 | + |
1222 | + public uint32 device_id; |
1223 | + public uint32 gesture_id; |
1224 | + public uint32 timestamp; |
1225 | + public State state; |
1226 | + public int32 fingers; |
1227 | + |
1228 | + public float root_x; |
1229 | + public float root_y; |
1230 | + |
1231 | + public Window root_window; |
1232 | + public Window event_window; |
1233 | + public Window child_window; |
1234 | + |
1235 | + public PanEvent pan_event; |
1236 | + public PinchEvent pinch_event; |
1237 | + public TapEvent tap_event; |
1238 | + |
1239 | + public string to_string () |
1240 | + { |
1241 | + string ret = ""; |
1242 | + |
1243 | + ret += type_to_string (type) + " Gesture\n"; |
1244 | + ret += "\tDevice ID : %u\n".printf (device_id); |
1245 | + ret += "\tGesture ID : %u\n".printf (gesture_id); |
1246 | + ret += "\tTimestamp : %u\n".printf (timestamp); |
1247 | + ret += "\tState : " + state_to_string (state) + "\n"; |
1248 | + ret += "\tFingers : %u\n".printf (fingers); |
1249 | + ret += "\tX Root : %f\n".printf (root_x); |
1250 | + ret += "\tY Root : %f\n".printf (root_y); |
1251 | + ret += "\tRootWin : %u\n".printf ((uint32)root_window); |
1252 | + ret += "\tEventWin : %u\n".printf ((uint32)event_window); |
1253 | + ret += "\tChildWin : %u\n".printf ((uint32)child_window); |
1254 | + |
1255 | + switch (type) |
1256 | + { |
1257 | + case Type.PAN: |
1258 | + ret += "\tDeltaX : %f\n".printf (pan_event.delta_x); |
1259 | + ret += "\tDeltaY : %f\n".printf (pan_event.delta_y); |
1260 | + ret += "\tVelocityX : %f\n".printf (pan_event.velocity_x); |
1261 | + ret += "\tVelocityY : %f\n".printf (pan_event.velocity_y); |
1262 | + ret += "\tX : %f\n".printf (pan_event.x); |
1263 | + ret += "\tY : %f\n".printf (pan_event.y); |
1264 | + break; |
1265 | + case Type.PINCH: |
1266 | + ret += "\tRadiusDelta: %f\n".printf (pinch_event.radius_delta); |
1267 | + ret += "\tRadiusVeloc: %f\n".printf (pinch_event.radius_velocity); |
1268 | + ret += "\tRadius : %f\n".printf (pinch_event.radius); |
1269 | + ret += "\tBoundingX1 : %f\n".printf (pinch_event.bounding_box_x1); |
1270 | + ret += "\tBoundingY1 : %f\n".printf (pinch_event.bounding_box_y1); |
1271 | + ret += "\tBoundingX2 : %f\n".printf (pinch_event.bounding_box_x2); |
1272 | + ret += "\tBoundingY2 : %f\n".printf (pinch_event.bounding_box_y2); |
1273 | + break; |
1274 | + |
1275 | + case Type.TAP: |
1276 | + ret += "\tDuration : %f\n".printf (tap_event.duration); |
1277 | + ret += "\tX2 : %f\n".printf (tap_event.x2); |
1278 | + ret += "\tY2 : %f\n".printf (tap_event.y2); |
1279 | + break; |
1280 | + |
1281 | + default: |
1282 | + break; |
1283 | + } |
1284 | + |
1285 | + return ret; |
1286 | + } |
1287 | + |
1288 | + public static string type_to_string (Type type) |
1289 | + { |
1290 | + if (type == Type.PAN) |
1291 | + return "Pan"; |
1292 | + else if (type == Type.PINCH) |
1293 | + return "Pinch"; |
1294 | + else if (type == Type.ROTATE) |
1295 | + return "Rotate"; |
1296 | + else if (type == Type.TAP) |
1297 | + return "Tap"; |
1298 | + else |
1299 | + return "Unknown"; |
1300 | + } |
1301 | + |
1302 | + public static string state_to_string (State state) |
1303 | + { |
1304 | + if (state == State.BEGAN) |
1305 | + return "Began"; |
1306 | + else if (state == State.CONTINUED) |
1307 | + return "Continued"; |
1308 | + else if (state == State.ENDED) |
1309 | + return "Ended"; |
1310 | + else |
1311 | + return "Unknown"; |
1312 | + } |
1313 | + } |
1314 | + |
1315 | + public class PanEvent |
1316 | + { |
1317 | + public float delta_x; |
1318 | + public float delta_y; |
1319 | + public float velocity_x; |
1320 | + public float velocity_y; |
1321 | + public float x; |
1322 | + public float y; |
1323 | + } |
1324 | + |
1325 | + public class PinchEvent |
1326 | + { |
1327 | + public float radius_delta; |
1328 | + public float radius_velocity; |
1329 | + public float radius; |
1330 | + public float bounding_box_x1; |
1331 | + public float bounding_box_y1; |
1332 | + public float bounding_box_x2; |
1333 | + public float bounding_box_y2; |
1334 | + } |
1335 | + |
1336 | + public class TapEvent |
1337 | + { |
1338 | + public float duration; |
1339 | + public float x2; |
1340 | + public float y2; |
1341 | + } |
1342 | +} |
1343 | |
1344 | === added file 'unity-private/gesture/gesture.c' |
1345 | --- unity-private/gesture/gesture.c 1970-01-01 00:00:00 +0000 |
1346 | +++ unity-private/gesture/gesture.c 2010-08-26 15:13:42 +0000 |
1347 | @@ -0,0 +1,467 @@ |
1348 | +/* |
1349 | + * This file generated automatically from gesture.xml by c_client.py. |
1350 | + * Edit at your peril. |
1351 | + */ |
1352 | + |
1353 | +#include <string.h> |
1354 | +#include <assert.h> |
1355 | +#include "xcb/xcbext.h" |
1356 | +#include "gesture.h" |
1357 | +#include "X11/Xproto.h" |
1358 | + |
1359 | +xcb_extension_t xcb_gesture_id = { "GestureExtension", 0 }; |
1360 | + |
1361 | + |
1362 | +/***************************************************************************** |
1363 | + ** |
1364 | + ** void xcb_gesture_float32_next |
1365 | + ** |
1366 | + ** @param xcb_gesture_float32_iterator_t *i |
1367 | + ** @returns void |
1368 | + ** |
1369 | + *****************************************************************************/ |
1370 | + |
1371 | +void |
1372 | +xcb_gesture_float32_next (xcb_gesture_float32_iterator_t *i /**< */) |
1373 | +{ |
1374 | + --i->rem; |
1375 | + ++i->data; |
1376 | + i->index += sizeof(xcb_gesture_float32_t); |
1377 | +} |
1378 | + |
1379 | + |
1380 | +/***************************************************************************** |
1381 | + ** |
1382 | + ** xcb_generic_iterator_t xcb_gesture_float32_end |
1383 | + ** |
1384 | + ** @param xcb_gesture_float32_iterator_t i |
1385 | + ** @returns xcb_generic_iterator_t |
1386 | + ** |
1387 | + *****************************************************************************/ |
1388 | + |
1389 | +xcb_generic_iterator_t |
1390 | +xcb_gesture_float32_end (xcb_gesture_float32_iterator_t i /**< */) |
1391 | +{ |
1392 | + xcb_generic_iterator_t ret; |
1393 | + ret.data = i.data + i.rem; |
1394 | + ret.index = i.index + ((char *) ret.data - (char *) i.data); |
1395 | + ret.rem = 0; |
1396 | + return ret; |
1397 | +} |
1398 | + |
1399 | + |
1400 | +/***************************************************************************** |
1401 | + ** |
1402 | + ** uint32_t * xcb_gesture_event_mask_mask_data |
1403 | + ** |
1404 | + ** @param const xcb_gesture_event_mask_t *R |
1405 | + ** @returns uint32_t * |
1406 | + ** |
1407 | + *****************************************************************************/ |
1408 | + |
1409 | +uint32_t * |
1410 | +xcb_gesture_event_mask_mask_data (const xcb_gesture_event_mask_t *R /**< */) |
1411 | +{ |
1412 | + return (uint32_t *) (R + 1); |
1413 | +} |
1414 | + |
1415 | + |
1416 | +/***************************************************************************** |
1417 | + ** |
1418 | + ** int xcb_gesture_event_mask_mask_data_length |
1419 | + ** |
1420 | + ** @param const xcb_gesture_event_mask_t *R |
1421 | + ** @returns int |
1422 | + ** |
1423 | + *****************************************************************************/ |
1424 | + |
1425 | +int |
1426 | +xcb_gesture_event_mask_mask_data_length (const xcb_gesture_event_mask_t *R /**< */) |
1427 | +{ |
1428 | + return R->mask_len; |
1429 | +} |
1430 | + |
1431 | + |
1432 | +/***************************************************************************** |
1433 | + ** |
1434 | + ** xcb_generic_iterator_t xcb_gesture_event_mask_mask_data_end |
1435 | + ** |
1436 | + ** @param const xcb_gesture_event_mask_t *R |
1437 | + ** @returns xcb_generic_iterator_t |
1438 | + ** |
1439 | + *****************************************************************************/ |
1440 | + |
1441 | +xcb_generic_iterator_t |
1442 | +xcb_gesture_event_mask_mask_data_end (const xcb_gesture_event_mask_t *R /**< */) |
1443 | +{ |
1444 | + xcb_generic_iterator_t i; |
1445 | + i.data = ((uint32_t *) (R + 1)) + (R->mask_len); |
1446 | + i.rem = 0; |
1447 | + i.index = (char *) i.data - (char *) R; |
1448 | + return i; |
1449 | +} |
1450 | + |
1451 | + |
1452 | +/***************************************************************************** |
1453 | + ** |
1454 | + ** void xcb_gesture_event_mask_next |
1455 | + ** |
1456 | + ** @param xcb_gesture_event_mask_iterator_t *i |
1457 | + ** @returns void |
1458 | + ** |
1459 | + *****************************************************************************/ |
1460 | + |
1461 | +void |
1462 | +xcb_gesture_event_mask_next (xcb_gesture_event_mask_iterator_t *i /**< */) |
1463 | +{ |
1464 | + xcb_gesture_event_mask_t *R = i->data; |
1465 | + xcb_generic_iterator_t child = xcb_gesture_event_mask_mask_data_end(R); |
1466 | + --i->rem; |
1467 | + i->data = (xcb_gesture_event_mask_t *) child.data; |
1468 | + i->index = child.index; |
1469 | +} |
1470 | + |
1471 | + |
1472 | +/***************************************************************************** |
1473 | + ** |
1474 | + ** xcb_generic_iterator_t xcb_gesture_event_mask_end |
1475 | + ** |
1476 | + ** @param xcb_gesture_event_mask_iterator_t i |
1477 | + ** @returns xcb_generic_iterator_t |
1478 | + ** |
1479 | + *****************************************************************************/ |
1480 | + |
1481 | +xcb_generic_iterator_t |
1482 | +xcb_gesture_event_mask_end (xcb_gesture_event_mask_iterator_t i /**< */) |
1483 | +{ |
1484 | + xcb_generic_iterator_t ret; |
1485 | + while(i.rem > 0) |
1486 | + xcb_gesture_event_mask_next(&i); |
1487 | + ret.data = i.data; |
1488 | + ret.rem = i.rem; |
1489 | + ret.index = i.index; |
1490 | + return ret; |
1491 | +} |
1492 | + |
1493 | + |
1494 | +/***************************************************************************** |
1495 | + ** |
1496 | + ** xcb_gesture_query_version_cookie_t xcb_gesture_query_version |
1497 | + ** |
1498 | + ** @param xcb_connection_t *c |
1499 | + ** @param uint16_t major_version |
1500 | + ** @param uint16_t minor_version |
1501 | + ** @returns xcb_gesture_query_version_cookie_t |
1502 | + ** |
1503 | + *****************************************************************************/ |
1504 | + |
1505 | +xcb_gesture_query_version_cookie_t |
1506 | +xcb_gesture_query_version (xcb_connection_t *c /**< */, |
1507 | + uint16_t major_version /**< */, |
1508 | + uint16_t minor_version /**< */) |
1509 | +{ |
1510 | + static const xcb_protocol_request_t xcb_req = { |
1511 | + /* count */ 2, |
1512 | + /* ext */ &xcb_gesture_id, |
1513 | + /* opcode */ XCB_GESTURE_QUERY_VERSION, |
1514 | + /* isvoid */ 0 |
1515 | + }; |
1516 | + |
1517 | + struct iovec xcb_parts[4]; |
1518 | + xcb_gesture_query_version_cookie_t xcb_ret; |
1519 | + xcb_gesture_query_version_request_t xcb_out; |
1520 | + |
1521 | + xcb_out.major_version = major_version; |
1522 | + xcb_out.minor_version = minor_version; |
1523 | + |
1524 | + xcb_parts[2].iov_base = (char *) &xcb_out; |
1525 | + xcb_parts[2].iov_len = sizeof(xcb_out); |
1526 | + xcb_parts[3].iov_base = 0; |
1527 | + xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; |
1528 | + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); |
1529 | + return xcb_ret; |
1530 | +} |
1531 | + |
1532 | + |
1533 | +/***************************************************************************** |
1534 | + ** |
1535 | + ** xcb_gesture_query_version_cookie_t xcb_gesture_query_version_unchecked |
1536 | + ** |
1537 | + ** @param xcb_connection_t *c |
1538 | + ** @param uint16_t major_version |
1539 | + ** @param uint16_t minor_version |
1540 | + ** @returns xcb_gesture_query_version_cookie_t |
1541 | + ** |
1542 | + *****************************************************************************/ |
1543 | + |
1544 | +xcb_gesture_query_version_cookie_t |
1545 | +xcb_gesture_query_version_unchecked (xcb_connection_t *c /**< */, |
1546 | + uint16_t major_version /**< */, |
1547 | + uint16_t minor_version /**< */) |
1548 | +{ |
1549 | + static const xcb_protocol_request_t xcb_req = { |
1550 | + /* count */ 2, |
1551 | + /* ext */ &xcb_gesture_id, |
1552 | + /* opcode */ XCB_GESTURE_QUERY_VERSION, |
1553 | + /* isvoid */ 0 |
1554 | + }; |
1555 | + |
1556 | + struct iovec xcb_parts[4]; |
1557 | + xcb_gesture_query_version_cookie_t xcb_ret; |
1558 | + xcb_gesture_query_version_request_t xcb_out; |
1559 | + |
1560 | + xcb_out.major_version = major_version; |
1561 | + xcb_out.minor_version = minor_version; |
1562 | + |
1563 | + xcb_parts[2].iov_base = (char *) &xcb_out; |
1564 | + xcb_parts[2].iov_len = sizeof(xcb_out); |
1565 | + xcb_parts[3].iov_base = 0; |
1566 | + xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; |
1567 | + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); |
1568 | + return xcb_ret; |
1569 | +} |
1570 | + |
1571 | + |
1572 | +/***************************************************************************** |
1573 | + ** |
1574 | + ** xcb_gesture_query_version_reply_t * xcb_gesture_query_version_reply |
1575 | + ** |
1576 | + ** @param xcb_connection_t *c |
1577 | + ** @param xcb_gesture_query_version_cookie_t cookie |
1578 | + ** @param xcb_generic_error_t **e |
1579 | + ** @returns xcb_gesture_query_version_reply_t * |
1580 | + ** |
1581 | + *****************************************************************************/ |
1582 | + |
1583 | +xcb_gesture_query_version_reply_t * |
1584 | +xcb_gesture_query_version_reply (xcb_connection_t *c /**< */, |
1585 | + xcb_gesture_query_version_cookie_t cookie /**< */, |
1586 | + xcb_generic_error_t **e /**< */) |
1587 | +{ |
1588 | + return (xcb_gesture_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); |
1589 | +} |
1590 | + |
1591 | + |
1592 | +/***************************************************************************** |
1593 | + ** |
1594 | + ** xcb_void_cookie_t xcb_gesture_select_events_checked |
1595 | + ** |
1596 | + ** @param xcb_connection_t *c |
1597 | + ** @param xcb_window_t window |
1598 | + ** @param uint16_t device_id |
1599 | + ** @param uint16_t mask_len |
1600 | + ** @param const uint32_t *mask |
1601 | + ** @returns xcb_void_cookie_t |
1602 | + ** |
1603 | + *****************************************************************************/ |
1604 | + |
1605 | +xcb_void_cookie_t |
1606 | +xcb_gesture_select_events_checked (xcb_connection_t *c /**< */, |
1607 | + xcb_window_t window /**< */, |
1608 | + uint16_t device_id /**< */, |
1609 | + uint16_t mask_len /**< */, |
1610 | + const uint32_t *mask /**< */) |
1611 | +{ |
1612 | + static const xcb_protocol_request_t xcb_req = { |
1613 | + /* count */ 4, |
1614 | + /* ext */ &xcb_gesture_id, |
1615 | + /* opcode */ XCB_GESTURE_SELECT_EVENTS, |
1616 | + /* isvoid */ 1 |
1617 | + }; |
1618 | + |
1619 | + struct iovec xcb_parts[6]; |
1620 | + xcb_void_cookie_t xcb_ret; |
1621 | + xcb_gesture_select_events_request_t xcb_out; |
1622 | + |
1623 | + xcb_out.window = window; |
1624 | + xcb_out.device_id = device_id; |
1625 | + xcb_out.mask_len = mask_len; |
1626 | + |
1627 | + xcb_parts[2].iov_base = (char *) &xcb_out; |
1628 | + xcb_parts[2].iov_len = sizeof(xcb_out); |
1629 | + xcb_parts[3].iov_base = 0; |
1630 | + xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; |
1631 | + xcb_parts[4].iov_base = (char *) mask; |
1632 | + xcb_parts[4].iov_len = mask_len * sizeof(uint32_t); |
1633 | + xcb_parts[5].iov_base = 0; |
1634 | + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; |
1635 | + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); |
1636 | + return xcb_ret; |
1637 | +} |
1638 | + |
1639 | + |
1640 | +/***************************************************************************** |
1641 | + ** |
1642 | + ** xcb_void_cookie_t xcb_gesture_select_events |
1643 | + ** |
1644 | + ** @param xcb_connection_t *c |
1645 | + ** @param xcb_window_t window |
1646 | + ** @param uint16_t device_id |
1647 | + ** @param uint16_t mask_len |
1648 | + ** @param const uint32_t *mask |
1649 | + ** @returns xcb_void_cookie_t |
1650 | + ** |
1651 | + *****************************************************************************/ |
1652 | + |
1653 | +xcb_void_cookie_t |
1654 | +xcb_gesture_select_events (xcb_connection_t *c /**< */, |
1655 | + xcb_window_t window /**< */, |
1656 | + uint16_t device_id /**< */, |
1657 | + uint16_t mask_len /**< */, |
1658 | + const uint32_t *mask /**< */) |
1659 | +{ |
1660 | + static const xcb_protocol_request_t xcb_req = { |
1661 | + /* count */ 4, |
1662 | + /* ext */ &xcb_gesture_id, |
1663 | + /* opcode */ XCB_GESTURE_SELECT_EVENTS, |
1664 | + /* isvoid */ 1 |
1665 | + }; |
1666 | + |
1667 | + struct iovec xcb_parts[6]; |
1668 | + xcb_void_cookie_t xcb_ret; |
1669 | + xcb_gesture_select_events_request_t xcb_out; |
1670 | + |
1671 | + xcb_out.window = window; |
1672 | + xcb_out.device_id = device_id; |
1673 | + xcb_out.mask_len = mask_len; |
1674 | + |
1675 | + xcb_parts[2].iov_base = (char *) &xcb_out; |
1676 | + xcb_parts[2].iov_len = sizeof(xcb_out); |
1677 | + xcb_parts[3].iov_base = 0; |
1678 | + xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; |
1679 | + xcb_parts[4].iov_base = (char *) mask; |
1680 | + xcb_parts[4].iov_len = mask_len * sizeof(uint32_t); |
1681 | + xcb_parts[5].iov_base = 0; |
1682 | + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; |
1683 | + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); |
1684 | + return xcb_ret; |
1685 | +} |
1686 | + |
1687 | + |
1688 | +/***************************************************************************** |
1689 | + ** |
1690 | + ** xcb_gesture_get_selected_events_cookie_t xcb_gesture_get_selected_events |
1691 | + ** |
1692 | + ** @param xcb_connection_t *c |
1693 | + ** @param xcb_window_t window |
1694 | + ** @returns xcb_gesture_get_selected_events_cookie_t |
1695 | + ** |
1696 | + *****************************************************************************/ |
1697 | + |
1698 | +xcb_gesture_get_selected_events_cookie_t |
1699 | +xcb_gesture_get_selected_events (xcb_connection_t *c /**< */, |
1700 | + xcb_window_t window /**< */) |
1701 | +{ |
1702 | + static const xcb_protocol_request_t xcb_req = { |
1703 | + /* count */ 2, |
1704 | + /* ext */ &xcb_gesture_id, |
1705 | + /* opcode */ XCB_GESTURE_GET_SELECTED_EVENTS, |
1706 | + /* isvoid */ 0 |
1707 | + }; |
1708 | + |
1709 | + struct iovec xcb_parts[4]; |
1710 | + xcb_gesture_get_selected_events_cookie_t xcb_ret; |
1711 | + xcb_gesture_get_selected_events_request_t xcb_out; |
1712 | + |
1713 | + xcb_out.window = window; |
1714 | + |
1715 | + xcb_parts[2].iov_base = (char *) &xcb_out; |
1716 | + xcb_parts[2].iov_len = sizeof(xcb_out); |
1717 | + xcb_parts[3].iov_base = 0; |
1718 | + xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; |
1719 | + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); |
1720 | + return xcb_ret; |
1721 | +} |
1722 | + |
1723 | + |
1724 | +/***************************************************************************** |
1725 | + ** |
1726 | + ** xcb_gesture_get_selected_events_cookie_t xcb_gesture_get_selected_events_unchecked |
1727 | + ** |
1728 | + ** @param xcb_connection_t *c |
1729 | + ** @param xcb_window_t window |
1730 | + ** @returns xcb_gesture_get_selected_events_cookie_t |
1731 | + ** |
1732 | + *****************************************************************************/ |
1733 | + |
1734 | +xcb_gesture_get_selected_events_cookie_t |
1735 | +xcb_gesture_get_selected_events_unchecked (xcb_connection_t *c /**< */, |
1736 | + xcb_window_t window /**< */) |
1737 | +{ |
1738 | + static const xcb_protocol_request_t xcb_req = { |
1739 | + /* count */ 2, |
1740 | + /* ext */ &xcb_gesture_id, |
1741 | + /* opcode */ XCB_GESTURE_GET_SELECTED_EVENTS, |
1742 | + /* isvoid */ 0 |
1743 | + }; |
1744 | + |
1745 | + struct iovec xcb_parts[4]; |
1746 | + xcb_gesture_get_selected_events_cookie_t xcb_ret; |
1747 | + xcb_gesture_get_selected_events_request_t xcb_out; |
1748 | + |
1749 | + xcb_out.window = window; |
1750 | + |
1751 | + xcb_parts[2].iov_base = (char *) &xcb_out; |
1752 | + xcb_parts[2].iov_len = sizeof(xcb_out); |
1753 | + xcb_parts[3].iov_base = 0; |
1754 | + xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; |
1755 | + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); |
1756 | + return xcb_ret; |
1757 | +} |
1758 | + |
1759 | + |
1760 | +/***************************************************************************** |
1761 | + ** |
1762 | + ** int xcb_gesture_get_selected_events_masks_length |
1763 | + ** |
1764 | + ** @param const xcb_gesture_get_selected_events_reply_t *R |
1765 | + ** @returns int |
1766 | + ** |
1767 | + *****************************************************************************/ |
1768 | + |
1769 | +int |
1770 | +xcb_gesture_get_selected_events_masks_length (const xcb_gesture_get_selected_events_reply_t *R /**< */) |
1771 | +{ |
1772 | + return R->num_masks; |
1773 | +} |
1774 | + |
1775 | + |
1776 | +/***************************************************************************** |
1777 | + ** |
1778 | + ** xcb_gesture_event_mask_iterator_t xcb_gesture_get_selected_events_masks_iterator |
1779 | + ** |
1780 | + ** @param const xcb_gesture_get_selected_events_reply_t *R |
1781 | + ** @returns xcb_gesture_event_mask_iterator_t |
1782 | + ** |
1783 | + *****************************************************************************/ |
1784 | + |
1785 | +xcb_gesture_event_mask_iterator_t |
1786 | +xcb_gesture_get_selected_events_masks_iterator (const xcb_gesture_get_selected_events_reply_t *R /**< */) |
1787 | +{ |
1788 | + xcb_gesture_event_mask_iterator_t i; |
1789 | + i.data = (xcb_gesture_event_mask_t *) (R + 1); |
1790 | + i.rem = R->num_masks; |
1791 | + i.index = (char *) i.data - (char *) R; |
1792 | + return i; |
1793 | +} |
1794 | + |
1795 | + |
1796 | +/***************************************************************************** |
1797 | + ** |
1798 | + ** xcb_gesture_get_selected_events_reply_t * xcb_gesture_get_selected_events_reply |
1799 | + ** |
1800 | + ** @param xcb_connection_t *c |
1801 | + ** @param xcb_gesture_get_selected_events_cookie_t cookie |
1802 | + ** @param xcb_generic_error_t **e |
1803 | + ** @returns xcb_gesture_get_selected_events_reply_t * |
1804 | + ** |
1805 | + *****************************************************************************/ |
1806 | + |
1807 | +xcb_gesture_get_selected_events_reply_t * |
1808 | +xcb_gesture_get_selected_events_reply (xcb_connection_t *c /**< */, |
1809 | + xcb_gesture_get_selected_events_cookie_t cookie /**< */, |
1810 | + xcb_generic_error_t **e /**< */) |
1811 | +{ |
1812 | + return (xcb_gesture_get_selected_events_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); |
1813 | +} |
1814 | + |
1815 | |
1816 | === added file 'unity-private/gesture/gesture.h' |
1817 | --- unity-private/gesture/gesture.h 1970-01-01 00:00:00 +0000 |
1818 | +++ unity-private/gesture/gesture.h 2010-08-26 15:13:42 +0000 |
1819 | @@ -0,0 +1,547 @@ |
1820 | +/* |
1821 | + * This file generated automatically from gesture.xml by c_client.py. |
1822 | + * Edit at your peril. |
1823 | + */ |
1824 | + |
1825 | +/** |
1826 | + * @defgroup XCB_gesture_API XCB gesture API |
1827 | + * @brief gesture XCB Protocol Implementation. |
1828 | + * @{ |
1829 | + **/ |
1830 | + |
1831 | +#ifndef __GESTURE_H |
1832 | +#define __GESTURE_H |
1833 | + |
1834 | +#include "xcb/xcb.h" |
1835 | +#include "X11/Xproto.h" |
1836 | + |
1837 | +#ifdef __cplusplus |
1838 | +extern "C" { |
1839 | +#endif |
1840 | + |
1841 | +#define XCB_GESTURE_MAJOR_VERSION 0 |
1842 | +#define XCB_GESTURE_MINOR_VERSION 5 |
1843 | + |
1844 | +extern xcb_extension_t xcb_gesture_id; |
1845 | + |
1846 | +typedef float xcb_gesture_float32_t; |
1847 | + |
1848 | +/** |
1849 | + * @brief xcb_gesture_float32_iterator_t |
1850 | + **/ |
1851 | +typedef struct xcb_gesture_float32_iterator_t { |
1852 | + xcb_gesture_float32_t *data; /**< */ |
1853 | + int rem; /**< */ |
1854 | + int index; /**< */ |
1855 | +} xcb_gesture_float32_iterator_t; |
1856 | + |
1857 | +/** |
1858 | + * @brief xcb_gesture_event_mask_t |
1859 | + **/ |
1860 | +typedef struct xcb_gesture_event_mask_t { |
1861 | + uint16_t device_id; /**< */ |
1862 | + uint16_t mask_len; /**< */ |
1863 | +} xcb_gesture_event_mask_t; |
1864 | + |
1865 | +/** |
1866 | + * @brief xcb_gesture_event_mask_iterator_t |
1867 | + **/ |
1868 | +typedef struct xcb_gesture_event_mask_iterator_t { |
1869 | + xcb_gesture_event_mask_t *data; /**< */ |
1870 | + int rem; /**< */ |
1871 | + int index; /**< */ |
1872 | +} xcb_gesture_event_mask_iterator_t; |
1873 | + |
1874 | +/** |
1875 | + * @brief xcb_gesture_query_version_cookie_t |
1876 | + **/ |
1877 | +typedef struct xcb_gesture_query_version_cookie_t { |
1878 | + unsigned int sequence; /**< */ |
1879 | +} xcb_gesture_query_version_cookie_t; |
1880 | + |
1881 | +/** Opcode for xcb_gesture_query_version. */ |
1882 | +#define XCB_GESTURE_QUERY_VERSION 1 |
1883 | + |
1884 | +/** |
1885 | + * @brief xcb_gesture_query_version_request_t |
1886 | + **/ |
1887 | +typedef struct xcb_gesture_query_version_request_t { |
1888 | + uint8_t major_opcode; /**< */ |
1889 | + uint8_t minor_opcode; /**< */ |
1890 | + uint16_t length; /**< */ |
1891 | + uint16_t major_version; /**< */ |
1892 | + uint16_t minor_version; /**< */ |
1893 | +} xcb_gesture_query_version_request_t; |
1894 | + |
1895 | +/** |
1896 | + * @brief xcb_gesture_query_version_reply_t |
1897 | + **/ |
1898 | +typedef struct xcb_gesture_query_version_reply_t { |
1899 | + uint8_t response_type; /**< */ |
1900 | + uint8_t pad0; /**< */ |
1901 | + uint16_t sequence; /**< */ |
1902 | + uint32_t length; /**< */ |
1903 | + uint16_t major_version; /**< */ |
1904 | + uint16_t minor_version; /**< */ |
1905 | + uint8_t pad1[20]; /**< */ |
1906 | +} xcb_gesture_query_version_reply_t; |
1907 | + |
1908 | +/** Opcode for xcb_gesture_select_events. */ |
1909 | +#define XCB_GESTURE_SELECT_EVENTS 2 |
1910 | + |
1911 | +/** |
1912 | + * @brief xcb_gesture_select_events_request_t |
1913 | + **/ |
1914 | +typedef struct xcb_gesture_select_events_request_t { |
1915 | + uint8_t major_opcode; /**< */ |
1916 | + uint8_t minor_opcode; /**< */ |
1917 | + uint16_t length; /**< */ |
1918 | + xcb_window_t window; /**< */ |
1919 | + uint16_t device_id; /**< */ |
1920 | + uint16_t mask_len; /**< */ |
1921 | +} xcb_gesture_select_events_request_t; |
1922 | + |
1923 | +/** |
1924 | + * @brief xcb_gesture_get_selected_events_cookie_t |
1925 | + **/ |
1926 | +typedef struct xcb_gesture_get_selected_events_cookie_t { |
1927 | + unsigned int sequence; /**< */ |
1928 | +} xcb_gesture_get_selected_events_cookie_t; |
1929 | + |
1930 | +/** Opcode for xcb_gesture_get_selected_events. */ |
1931 | +#define XCB_GESTURE_GET_SELECTED_EVENTS 3 |
1932 | + |
1933 | +/** |
1934 | + * @brief xcb_gesture_get_selected_events_request_t |
1935 | + **/ |
1936 | +typedef struct xcb_gesture_get_selected_events_request_t { |
1937 | + uint8_t major_opcode; /**< */ |
1938 | + uint8_t minor_opcode; /**< */ |
1939 | + uint16_t length; /**< */ |
1940 | + xcb_window_t window; /**< */ |
1941 | +} xcb_gesture_get_selected_events_request_t; |
1942 | + |
1943 | +/** |
1944 | + * @brief xcb_gesture_get_selected_events_reply_t |
1945 | + **/ |
1946 | +typedef struct xcb_gesture_get_selected_events_reply_t { |
1947 | + uint8_t response_type; /**< */ |
1948 | + uint8_t pad0; /**< */ |
1949 | + uint16_t sequence; /**< */ |
1950 | + uint32_t length; /**< */ |
1951 | + uint16_t num_masks; /**< */ |
1952 | + uint8_t pad1[22]; /**< */ |
1953 | +} xcb_gesture_get_selected_events_reply_t; |
1954 | + |
1955 | +/** Opcode for xcb_gesture_notify. */ |
1956 | +#define XCB_GESTURE_NOTIFY 0 |
1957 | + |
1958 | +/** |
1959 | + * @brief xcb_gesture_notify_event_t |
1960 | + **/ |
1961 | +typedef struct xcb_gesture_notify_event_t { |
1962 | + uint8_t response_type; /**< */ |
1963 | + uint8_t extension; /**< */ |
1964 | + uint16_t sequence; /**< */ |
1965 | + uint32_t length; /**< */ |
1966 | + uint16_t event_type; /**< */ |
1967 | + uint16_t gesture_id; /**< */ |
1968 | + uint16_t gesture_type; /**< */ |
1969 | + uint16_t device_id; /**< */ |
1970 | + xcb_timestamp_t time; /**< */ |
1971 | + xcb_window_t root; /**< */ |
1972 | + xcb_window_t event; /**< */ |
1973 | + xcb_window_t child; /**< */ |
1974 | + uint32_t full_sequence; /**< */ |
1975 | + xcb_gesture_float32_t focus_x; /**< */ |
1976 | + xcb_gesture_float32_t focus_y; /**< */ |
1977 | + uint16_t status; /**< */ |
1978 | + uint16_t num_props; /**< */ |
1979 | +} xcb_gesture_notify_event_t; |
1980 | + |
1981 | +/** |
1982 | + * Get the next element of the iterator |
1983 | + * @param i Pointer to a xcb_gesture_float32_iterator_t |
1984 | + * |
1985 | + * Get the next element in the iterator. The member rem is |
1986 | + * decreased by one. The member data points to the next |
1987 | + * element. The member index is increased by sizeof(xcb_gesture_float32_t) |
1988 | + */ |
1989 | + |
1990 | +/***************************************************************************** |
1991 | + ** |
1992 | + ** void xcb_gesture_float32_next |
1993 | + ** |
1994 | + ** @param xcb_gesture_float32_iterator_t *i |
1995 | + ** @returns void |
1996 | + ** |
1997 | + *****************************************************************************/ |
1998 | + |
1999 | +void |
2000 | +xcb_gesture_float32_next (xcb_gesture_float32_iterator_t *i /**< */); |
2001 | + |
2002 | +/** |
2003 | + * Return the iterator pointing to the last element |
2004 | + * @param i An xcb_gesture_float32_iterator_t |
2005 | + * @return The iterator pointing to the last element |
2006 | + * |
2007 | + * Set the current element in the iterator to the last element. |
2008 | + * The member rem is set to 0. The member data points to the |
2009 | + * last element. |
2010 | + */ |
2011 | + |
2012 | +/***************************************************************************** |
2013 | + ** |
2014 | + ** xcb_generic_iterator_t xcb_gesture_float32_end |
2015 | + ** |
2016 | + ** @param xcb_gesture_float32_iterator_t i |
2017 | + ** @returns xcb_generic_iterator_t |
2018 | + ** |
2019 | + *****************************************************************************/ |
2020 | + |
2021 | +xcb_generic_iterator_t |
2022 | +xcb_gesture_float32_end (xcb_gesture_float32_iterator_t i /**< */); |
2023 | + |
2024 | + |
2025 | +/***************************************************************************** |
2026 | + ** |
2027 | + ** uint32_t * xcb_gesture_event_mask_mask_data |
2028 | + ** |
2029 | + ** @param const xcb_gesture_event_mask_t *R |
2030 | + ** @returns uint32_t * |
2031 | + ** |
2032 | + *****************************************************************************/ |
2033 | + |
2034 | +uint32_t * |
2035 | +xcb_gesture_event_mask_mask_data (const xcb_gesture_event_mask_t *R /**< */); |
2036 | + |
2037 | + |
2038 | +/***************************************************************************** |
2039 | + ** |
2040 | + ** int xcb_gesture_event_mask_mask_data_length |
2041 | + ** |
2042 | + ** @param const xcb_gesture_event_mask_t *R |
2043 | + ** @returns int |
2044 | + ** |
2045 | + *****************************************************************************/ |
2046 | + |
2047 | +int |
2048 | +xcb_gesture_event_mask_mask_data_length (const xcb_gesture_event_mask_t *R /**< */); |
2049 | + |
2050 | + |
2051 | +/***************************************************************************** |
2052 | + ** |
2053 | + ** xcb_generic_iterator_t xcb_gesture_event_mask_mask_data_end |
2054 | + ** |
2055 | + ** @param const xcb_gesture_event_mask_t *R |
2056 | + ** @returns xcb_generic_iterator_t |
2057 | + ** |
2058 | + *****************************************************************************/ |
2059 | + |
2060 | +xcb_generic_iterator_t |
2061 | +xcb_gesture_event_mask_mask_data_end (const xcb_gesture_event_mask_t *R /**< */); |
2062 | + |
2063 | +/** |
2064 | + * Get the next element of the iterator |
2065 | + * @param i Pointer to a xcb_gesture_event_mask_iterator_t |
2066 | + * |
2067 | + * Get the next element in the iterator. The member rem is |
2068 | + * decreased by one. The member data points to the next |
2069 | + * element. The member index is increased by sizeof(xcb_gesture_event_mask_t) |
2070 | + */ |
2071 | + |
2072 | +/***************************************************************************** |
2073 | + ** |
2074 | + ** void xcb_gesture_event_mask_next |
2075 | + ** |
2076 | + ** @param xcb_gesture_event_mask_iterator_t *i |
2077 | + ** @returns void |
2078 | + ** |
2079 | + *****************************************************************************/ |
2080 | + |
2081 | +void |
2082 | +xcb_gesture_event_mask_next (xcb_gesture_event_mask_iterator_t *i /**< */); |
2083 | + |
2084 | +/** |
2085 | + * Return the iterator pointing to the last element |
2086 | + * @param i An xcb_gesture_event_mask_iterator_t |
2087 | + * @return The iterator pointing to the last element |
2088 | + * |
2089 | + * Set the current element in the iterator to the last element. |
2090 | + * The member rem is set to 0. The member data points to the |
2091 | + * last element. |
2092 | + */ |
2093 | + |
2094 | +/***************************************************************************** |
2095 | + ** |
2096 | + ** xcb_generic_iterator_t xcb_gesture_event_mask_end |
2097 | + ** |
2098 | + ** @param xcb_gesture_event_mask_iterator_t i |
2099 | + ** @returns xcb_generic_iterator_t |
2100 | + ** |
2101 | + *****************************************************************************/ |
2102 | + |
2103 | +xcb_generic_iterator_t |
2104 | +xcb_gesture_event_mask_end (xcb_gesture_event_mask_iterator_t i /**< */); |
2105 | + |
2106 | +/** |
2107 | + * Delivers a request to the X server |
2108 | + * @param c The connection |
2109 | + * @return A cookie |
2110 | + * |
2111 | + * Delivers a request to the X server. |
2112 | + * |
2113 | + */ |
2114 | + |
2115 | +/***************************************************************************** |
2116 | + ** |
2117 | + ** xcb_gesture_query_version_cookie_t xcb_gesture_query_version |
2118 | + ** |
2119 | + ** @param xcb_connection_t *c |
2120 | + ** @param uint16_t major_version |
2121 | + ** @param uint16_t minor_version |
2122 | + ** @returns xcb_gesture_query_version_cookie_t |
2123 | + ** |
2124 | + *****************************************************************************/ |
2125 | + |
2126 | +xcb_gesture_query_version_cookie_t |
2127 | +xcb_gesture_query_version (xcb_connection_t *c /**< */, |
2128 | + uint16_t major_version /**< */, |
2129 | + uint16_t minor_version /**< */); |
2130 | + |
2131 | +/** |
2132 | + * Delivers a request to the X server |
2133 | + * @param c The connection |
2134 | + * @return A cookie |
2135 | + * |
2136 | + * Delivers a request to the X server. |
2137 | + * |
2138 | + * This form can be used only if the request will cause |
2139 | + * a reply to be generated. Any returned error will be |
2140 | + * placed in the event queue. |
2141 | + */ |
2142 | + |
2143 | +/***************************************************************************** |
2144 | + ** |
2145 | + ** xcb_gesture_query_version_cookie_t xcb_gesture_query_version_unchecked |
2146 | + ** |
2147 | + ** @param xcb_connection_t *c |
2148 | + ** @param uint16_t major_version |
2149 | + ** @param uint16_t minor_version |
2150 | + ** @returns xcb_gesture_query_version_cookie_t |
2151 | + ** |
2152 | + *****************************************************************************/ |
2153 | + |
2154 | +xcb_gesture_query_version_cookie_t |
2155 | +xcb_gesture_query_version_unchecked (xcb_connection_t *c /**< */, |
2156 | + uint16_t major_version /**< */, |
2157 | + uint16_t minor_version /**< */); |
2158 | + |
2159 | +/** |
2160 | + * Return the reply |
2161 | + * @param c The connection |
2162 | + * @param cookie The cookie |
2163 | + * @param e The xcb_generic_error_t supplied |
2164 | + * |
2165 | + * Returns the reply of the request asked by |
2166 | + * |
2167 | + * The parameter @p e supplied to this function must be NULL if |
2168 | + * xcb_gesture_query_version_unchecked(). is used. |
2169 | + * Otherwise, it stores the error if any. |
2170 | + * |
2171 | + * The returned value must be freed by the caller using free(). |
2172 | + */ |
2173 | + |
2174 | +/***************************************************************************** |
2175 | + ** |
2176 | + ** xcb_gesture_query_version_reply_t * xcb_gesture_query_version_reply |
2177 | + ** |
2178 | + ** @param xcb_connection_t *c |
2179 | + ** @param xcb_gesture_query_version_cookie_t cookie |
2180 | + ** @param xcb_generic_error_t **e |
2181 | + ** @returns xcb_gesture_query_version_reply_t * |
2182 | + ** |
2183 | + *****************************************************************************/ |
2184 | + |
2185 | +xcb_gesture_query_version_reply_t * |
2186 | +xcb_gesture_query_version_reply (xcb_connection_t *c /**< */, |
2187 | + xcb_gesture_query_version_cookie_t cookie /**< */, |
2188 | + xcb_generic_error_t **e /**< */); |
2189 | + |
2190 | +/** |
2191 | + * Delivers a request to the X server |
2192 | + * @param c The connection |
2193 | + * @return A cookie |
2194 | + * |
2195 | + * Delivers a request to the X server. |
2196 | + * |
2197 | + * This form can be used only if the request will not cause |
2198 | + * a reply to be generated. Any returned error will be |
2199 | + * saved for handling by xcb_request_check(). |
2200 | + */ |
2201 | + |
2202 | +/***************************************************************************** |
2203 | + ** |
2204 | + ** xcb_void_cookie_t xcb_gesture_select_events_checked |
2205 | + ** |
2206 | + ** @param xcb_connection_t *c |
2207 | + ** @param xcb_window_t window |
2208 | + ** @param uint16_t device_id |
2209 | + ** @param uint16_t mask_len |
2210 | + ** @param const uint32_t *mask |
2211 | + ** @returns xcb_void_cookie_t |
2212 | + ** |
2213 | + *****************************************************************************/ |
2214 | + |
2215 | +xcb_void_cookie_t |
2216 | +xcb_gesture_select_events_checked (xcb_connection_t *c /**< */, |
2217 | + xcb_window_t window /**< */, |
2218 | + uint16_t device_id /**< */, |
2219 | + uint16_t mask_len /**< */, |
2220 | + const uint32_t *mask /**< */); |
2221 | + |
2222 | +/** |
2223 | + * Delivers a request to the X server |
2224 | + * @param c The connection |
2225 | + * @return A cookie |
2226 | + * |
2227 | + * Delivers a request to the X server. |
2228 | + * |
2229 | + */ |
2230 | + |
2231 | +/***************************************************************************** |
2232 | + ** |
2233 | + ** xcb_void_cookie_t xcb_gesture_select_events |
2234 | + ** |
2235 | + ** @param xcb_connection_t *c |
2236 | + ** @param xcb_window_t window |
2237 | + ** @param uint16_t device_id |
2238 | + ** @param uint16_t mask_len |
2239 | + ** @param const uint32_t *mask |
2240 | + ** @returns xcb_void_cookie_t |
2241 | + ** |
2242 | + *****************************************************************************/ |
2243 | + |
2244 | +xcb_void_cookie_t |
2245 | +xcb_gesture_select_events (xcb_connection_t *c /**< */, |
2246 | + xcb_window_t window /**< */, |
2247 | + uint16_t device_id /**< */, |
2248 | + uint16_t mask_len /**< */, |
2249 | + const uint32_t *mask /**< */); |
2250 | + |
2251 | +/** |
2252 | + * Delivers a request to the X server |
2253 | + * @param c The connection |
2254 | + * @return A cookie |
2255 | + * |
2256 | + * Delivers a request to the X server. |
2257 | + * |
2258 | + */ |
2259 | + |
2260 | +/***************************************************************************** |
2261 | + ** |
2262 | + ** xcb_gesture_get_selected_events_cookie_t xcb_gesture_get_selected_events |
2263 | + ** |
2264 | + ** @param xcb_connection_t *c |
2265 | + ** @param xcb_window_t window |
2266 | + ** @returns xcb_gesture_get_selected_events_cookie_t |
2267 | + ** |
2268 | + *****************************************************************************/ |
2269 | + |
2270 | +xcb_gesture_get_selected_events_cookie_t |
2271 | +xcb_gesture_get_selected_events (xcb_connection_t *c /**< */, |
2272 | + xcb_window_t window /**< */); |
2273 | + |
2274 | +/** |
2275 | + * Delivers a request to the X server |
2276 | + * @param c The connection |
2277 | + * @return A cookie |
2278 | + * |
2279 | + * Delivers a request to the X server. |
2280 | + * |
2281 | + * This form can be used only if the request will cause |
2282 | + * a reply to be generated. Any returned error will be |
2283 | + * placed in the event queue. |
2284 | + */ |
2285 | + |
2286 | +/***************************************************************************** |
2287 | + ** |
2288 | + ** xcb_gesture_get_selected_events_cookie_t xcb_gesture_get_selected_events_unchecked |
2289 | + ** |
2290 | + ** @param xcb_connection_t *c |
2291 | + ** @param xcb_window_t window |
2292 | + ** @returns xcb_gesture_get_selected_events_cookie_t |
2293 | + ** |
2294 | + *****************************************************************************/ |
2295 | + |
2296 | +xcb_gesture_get_selected_events_cookie_t |
2297 | +xcb_gesture_get_selected_events_unchecked (xcb_connection_t *c /**< */, |
2298 | + xcb_window_t window /**< */); |
2299 | + |
2300 | + |
2301 | +/***************************************************************************** |
2302 | + ** |
2303 | + ** int xcb_gesture_get_selected_events_masks_length |
2304 | + ** |
2305 | + ** @param const xcb_gesture_get_selected_events_reply_t *R |
2306 | + ** @returns int |
2307 | + ** |
2308 | + *****************************************************************************/ |
2309 | + |
2310 | +int |
2311 | +xcb_gesture_get_selected_events_masks_length (const xcb_gesture_get_selected_events_reply_t *R /**< */); |
2312 | + |
2313 | + |
2314 | +/***************************************************************************** |
2315 | + ** |
2316 | + ** xcb_gesture_event_mask_iterator_t xcb_gesture_get_selected_events_masks_iterator |
2317 | + ** |
2318 | + ** @param const xcb_gesture_get_selected_events_reply_t *R |
2319 | + ** @returns xcb_gesture_event_mask_iterator_t |
2320 | + ** |
2321 | + *****************************************************************************/ |
2322 | + |
2323 | +xcb_gesture_event_mask_iterator_t |
2324 | +xcb_gesture_get_selected_events_masks_iterator (const xcb_gesture_get_selected_events_reply_t *R /**< */); |
2325 | + |
2326 | +/** |
2327 | + * Return the reply |
2328 | + * @param c The connection |
2329 | + * @param cookie The cookie |
2330 | + * @param e The xcb_generic_error_t supplied |
2331 | + * |
2332 | + * Returns the reply of the request asked by |
2333 | + * |
2334 | + * The parameter @p e supplied to this function must be NULL if |
2335 | + * xcb_gesture_get_selected_events_unchecked(). is used. |
2336 | + * Otherwise, it stores the error if any. |
2337 | + * |
2338 | + * The returned value must be freed by the caller using free(). |
2339 | + */ |
2340 | + |
2341 | +/***************************************************************************** |
2342 | + ** |
2343 | + ** xcb_gesture_get_selected_events_reply_t * xcb_gesture_get_selected_events_reply |
2344 | + ** |
2345 | + ** @param xcb_connection_t *c |
2346 | + ** @param xcb_gesture_get_selected_events_cookie_t cookie |
2347 | + ** @param xcb_generic_error_t **e |
2348 | + ** @returns xcb_gesture_get_selected_events_reply_t * |
2349 | + ** |
2350 | + *****************************************************************************/ |
2351 | + |
2352 | +xcb_gesture_get_selected_events_reply_t * |
2353 | +xcb_gesture_get_selected_events_reply (xcb_connection_t *c /**< */, |
2354 | + xcb_gesture_get_selected_events_cookie_t cookie /**< */, |
2355 | + xcb_generic_error_t **e /**< */); |
2356 | + |
2357 | + |
2358 | +#ifdef __cplusplus |
2359 | +} |
2360 | +#endif |
2361 | + |
2362 | +#endif |
2363 | + |
2364 | +/** |
2365 | + * @} |
2366 | + */ |
2367 | |
2368 | === modified file 'unity-private/launcher/scroller-view.vala' |
2369 | --- unity-private/launcher/scroller-view.vala 2010-08-26 10:27:34 +0000 |
2370 | +++ unity-private/launcher/scroller-view.vala 2010-08-26 15:13:42 +0000 |
2371 | @@ -586,9 +586,6 @@ |
2372 | Cairo.TextExtents real_extents = Cairo.TextExtents (); |
2373 | cr.text_extents (text, out extents); |
2374 | |
2375 | - double w_diff = extents.width - real_extents.width; |
2376 | - double h_diff = extents.height - real_extents.height; |
2377 | - |
2378 | w += extents.width; |
2379 | h += extents.height; |
2380 | cr.set_source_rgba (0.07, 0.07, 0.07, 0.8); |
2381 | |
2382 | === modified file 'unity-private/testing/background.vala' |
2383 | --- unity-private/testing/background.vala 2010-08-25 16:39:53 +0000 |
2384 | +++ unity-private/testing/background.vala 2010-08-26 15:13:42 +0000 |
2385 | @@ -44,6 +44,11 @@ |
2386 | private string sec_col; |
2387 | private string filename; |
2388 | |
2389 | + public Background () |
2390 | + { |
2391 | + Object (); |
2392 | + } |
2393 | + |
2394 | construct |
2395 | { |
2396 | START_FUNCTION (); |
2397 | |
2398 | === modified file 'unity-private/testing/test-window.vala' |
2399 | --- unity-private/testing/test-window.vala 2010-08-12 10:18:36 +0000 |
2400 | +++ unity-private/testing/test-window.vala 2010-08-26 15:13:42 +0000 |
2401 | @@ -43,6 +43,7 @@ |
2402 | private Panel.View panel; |
2403 | private Places.Controller controller; |
2404 | private Unity.Places.View places; |
2405 | + private Gesture.Dispatcher gesture_dispatcher; |
2406 | |
2407 | private bool showing_places; |
2408 | |
2409 | @@ -156,6 +157,8 @@ |
2410 | this.wnck_screen.active_window_changed.connect (this.on_active_window_changed); |
2411 | } |
2412 | |
2413 | + gesture_dispatcher = new Gesture.XCBDispatcher (); |
2414 | + |
2415 | END_FUNCTION (); |
2416 | } |
2417 | |
2418 | |
2419 | === modified file 'vapi/mutter-2.28.vapi' |
2420 | --- vapi/mutter-2.28.vapi 2010-08-12 11:41:51 +0000 |
2421 | +++ vapi/mutter-2.28.vapi 2010-08-26 15:13:42 +0000 |
2422 | @@ -789,6 +789,14 @@ |
2423 | public static void unmaximize (Mutter.MetaWindow window, Mutter.MetaMaximizeFlags directions); |
2424 | [CCode (cname = "meta_window_unminimize")] |
2425 | public static void unminimize (Mutter.MetaWindow window); |
2426 | + [CCode (cname = "meta_window_move_resize")] |
2427 | + public static void move_resize (Mutter.MetaWindow window, bool user_op, int root_x, int root_y, int width, int height); |
2428 | + [CCode (cname = "meta_window_get_geometry")] |
2429 | + public static void get_geometry (Mutter.MetaWindow window, out int x, out int y, out int width, out int height); |
2430 | + [CCode (cname = "meta_window_make_fullscreen")] |
2431 | + public static void make_fullscreen (Mutter.MetaWindow window); |
2432 | + [CCode (cname = "meta_window_unmake_fullscreen")] |
2433 | + public static void unmake_fullscreen (Mutter.MetaWindow window); |
2434 | } |
2435 | [Compact] |
2436 | [CCode (cheader_filename = "mutter-plugins.h")] |