diff --git a/src/jarabe/view/tabbinghandler.py b/src/jarabe/view/tabbinghandler.py
index 0d42c3f..6aefa06 100644
a
|
b
|
class TabbingHandler(object): |
33 | 33 | self._modifier = modifier |
34 | 34 | self._timeout = None |
35 | 35 | |
| 36 | display = Gdk.Display.get_default() |
| 37 | device_manager = display.get_device_manager() |
| 38 | self._devices = device_manager.list_devices(Gdk.DeviceType.MASTER) |
| 39 | |
36 | 40 | def _start_tabbing(self): |
37 | 41 | if not self._tabbing: |
38 | 42 | logging.debug('Grabing the input.') |
39 | 43 | |
40 | 44 | screen = Gdk.Screen.get_default() |
41 | 45 | window = screen.get_root_window() |
42 | | keyboard_grab_result = Gdk.keyboard_grab(window, False) |
43 | | pointer_grab_result = Gdk.pointer_grab(window) |
44 | 46 | |
45 | | self._tabbing = (keyboard_grab_result == Gdk.GrabStatus.SUCCESS and |
46 | | pointer_grab_result == Gdk.GrabStatus.SUCCESS) |
| 47 | self._tabbing = True |
| 48 | for device in self._devices: |
| 49 | result = device.grab(window, Gdk.GrabOwnership.WINDOW, False, |
| 50 | Gdk.EventMask.ALL_EVENTS_MASK, None, |
| 51 | Gdk.CURRENT_TIME) |
| 52 | if result != Gdk.GrabStatus.SUCCESS: |
| 53 | self._tabbing = False |
| 54 | break |
47 | 55 | |
48 | 56 | # Now test that the modifier is still active to prevent race |
49 | 57 | # conditions. We also test if one of the grabs failed. |
50 | | mask = window.get_pointer()[2] |
| 58 | mask = window.get_pointer()[3] |
51 | 59 | if not self._tabbing or not (mask & self._modifier): |
52 | 60 | logging.debug('Releasing grabs again.') |
53 | 61 | |
54 | 62 | # ungrab keyboard/pointer if the grab was successfull. |
55 | | if keyboard_grab_result == Gdk.GrabStatus.SUCCESS: |
56 | | Gdk.keyboard_ungrab() |
57 | | if pointer_grab_result == Gdk.GrabStatus.SUCCESS: |
58 | | Gdk.pointer_ungrab() |
| 63 | for device in self._devices: |
| 64 | device.ungrab(Gdk.CURRENT_TIME) |
59 | 65 | |
60 | 66 | self._tabbing = False |
61 | 67 | else: |
… |
… |
class TabbingHandler(object): |
134 | 140 | next_activity.get_window().activate(event_time) |
135 | 141 | |
136 | 142 | def stop(self, event_time): |
137 | | Gdk.keyboard_ungrab() |
138 | | Gdk.pointer_ungrab() |
| 143 | for device in self._devices: |
| 144 | device.ungrab(event_time) |
139 | 145 | self._tabbing = False |
140 | 146 | |
141 | 147 | self._frame.hide() |