#447 BLOC 9.1.0: Sugar grab/scroll key not implemented

Zarro Boogs per Child bugtracker at laptop.org
Wed Jul 9 19:17:34 EDT 2008


#447: Sugar grab/scroll key not implemented
---------------------------+------------------------------------------------
   Reporter:  walter       |       Owner:  erikg   
       Type:  enhancement  |      Status:  assigned
   Priority:  blocker      |   Milestone:  9.1.0   
  Component:  sugar        |     Version:          
 Resolution:               |    Keywords:  9.1.0:? 
Next_action:  never set    |    Verified:  0       
  Blockedby:               |    Blocking:          
---------------------------+------------------------------------------------

Comment(by erikg):

 ''Summary:'' I used the grab keys to convert the touchpad into a virtual
 mouse scrollwheel.  Holding down the grab key and moving the mouse a small
 number pixels causes a fake mouse button 4/5/6/7 press, depending on the
 direction of motion.  This approach works in all applications which
 support mouse scroll buttons.

 ''Patches:''

 The attached patch to sugar-toolkit adds glib/C-side hooks to grab an
 ungrab the mouse, and pass motion-notify events to the python side of the
 Sugar shell.  I have packaged (and also attached) this patch in an rpm
 which should be installable on an XO running a recent joyride (tested on
 joyride-2123).

 The attached patch to sugar (specifically keyhandler.py) adds the python-
 side hooks required to enable the grab/scroll button functionality.

 The patches work in the following manner:

  * When the left or right grab buttons are pressed, XGrabPointer is
 called.  Subsequently, we capture all of the motion-notify events which
 occur when the user moves the mouse, and each event hits
 KeyHandler._motion_notify_cb() with the coordinates of the mouse.  After
 we move N pixels (currently 10) we issue a fake mouse scroll button press
 corresponding to the direction of motion of the mouse (4/5/6/7).  To issue
 the fake button press I have found it is necessary to ungrab the mouse,
 issue the press, and then re-grab.

 ''Known issues:''

  * In some cases key-releases are not registered.  This is problematic
 because without the release signal the mouse grabbing does not stop and
 Sugar becomes entirely unusable.  I have not been able to establish why,
 but have noticed that hitting the journal view key after Sugar startup
 ''before'' any of the other special keys (registered in keyhandler.py)
 tends to resolve the issue for the Super_L and Super_R keys (the grab
 buttons).

  * The mouse still scrolls around the screen, and the cursor is visible
 during the grab.  ''Solution:'' Hide the mouse; When a grab key press is
 registered, hide the mouse by setting the cursor pixmap to a blank map
 (and set it back when the grab key release is registered).

  * Eventually, after scrolling in one direction, the mouse can move out of
 or to the edge of the scrolling window and the scrolling stops.
 ''Solution:'' Every time we issue a fake button press, warp the mouse back
 to the position it was at when we first pressed the grab key.

-- 
Ticket URL: <http://dev.laptop.org/ticket/447#comment:28>
One Laptop Per Child <http://laptop.org/>
OLPC bug tracking system


More information about the Bugs mailing list