Ticket #3895: 0001-Fix-Tabbinghandler-not-working-SL-3895.patch

File 0001-Fix-Tabbinghandler-not-working-SL-3895.patch, 2.9 KB (added by godiard, 11 years ago)

New patch based in manuq work

  • src/jarabe/view/tabbinghandler.py

    From c88d5d2d851656017ea93b151eb68f0ee1c9b841 Mon Sep 17 00:00:00 2001
    From: Gonzalo Odiard <godiard@gmail.com>
    Date: Wed, 12 Dec 2012 17:03:02 -0300
    Subject: [PATCH] Fix Tabbinghandler not working - SL #3895
    
    The methods to grab/ungrab keyboard and mouse in Gdk3 [1] has changed,
    this patch update the code.
    Also the mask returned by window.get_pointer() can return as 0,
    then the code was changed to ungrab in that situation.
    
    Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
    
    [1] http://developer.gnome.org/gdk3/stable/gdk3-General.html
    ---
     src/jarabe/view/tabbinghandler.py | 21 +++++++++++++++------
     1 file changed, 15 insertions(+), 6 deletions(-)
    
    diff --git a/src/jarabe/view/tabbinghandler.py b/src/jarabe/view/tabbinghandler.py
    index 0d42c3f..755a8ee 100644
    a b from jarabe.model import shell 
    2525
    2626_RAISE_DELAY = 250
    2727
     28_MOUSE_MASK = Gdk.EventMask.POINTER_MOTION_MASK | \
     29                Gdk.EventMask.POINTER_MOTION_HINT_MASK | \
     30                Gdk.EventMask.BUTTON_PRESS_MASK | \
     31                Gdk.EventMask.BUTTON_RELEASE_MASK | \
     32                Gdk.EventMask.BUTTON_MOTION_MASK
    2833
    2934class TabbingHandler(object):
    3035    def __init__(self, frame, modifier):
    class TabbingHandler(object): 
    3944
    4045            screen = Gdk.Screen.get_default()
    4146            window = screen.get_root_window()
    42             keyboard_grab_result = Gdk.keyboard_grab(window, False)
    43             pointer_grab_result = Gdk.pointer_grab(window)
     47            keyboard_grab_result = Gdk.keyboard_grab(window, False, Gdk.CURRENT_TIME)
     48            # TODO: why we need grab the pointer?
     49            pointer_grab_result = Gdk.pointer_grab(window, False,
     50                    _MOUSE_MASK, None, None, Gdk.CURRENT_TIME)
    4451
    4552            self._tabbing = (keyboard_grab_result == Gdk.GrabStatus.SUCCESS and
    4653                             pointer_grab_result == Gdk.GrabStatus.SUCCESS)
    4754
    4855            # Now test that the modifier is still active to prevent race
    4956            # conditions. We also test if one of the grabs failed.
    50             mask = window.get_pointer()[2]
    51             if not self._tabbing or not (mask & self._modifier):
     57            _pointer = window.get_pointer()
     58            # mask is in position 3 now
     59            mask = _pointer[3]
     60            if not self._tabbing or (mask in (0, self._modifier)):
    5261                logging.debug('Releasing grabs again.')
    5362
    5463                # ungrab keyboard/pointer if the grab was successfull.
    5564                if keyboard_grab_result == Gdk.GrabStatus.SUCCESS:
    56                     Gdk.keyboard_ungrab()
     65                    Gdk.keyboard_ungrab(Gdk.CURRENT_TIME)
    5766                if pointer_grab_result == Gdk.GrabStatus.SUCCESS:
    58                     Gdk.pointer_ungrab()
     67                    Gdk.pointer_ungrab(Gdk.CURRENT_TIME)
    5968
    6069                self._tabbing = False
    6170            else: