bugGNU Octave - Bugs: bug #39738, Keyboard events discarded if mouse...

 
 

bug #39738: Keyboard events discarded if mouse pointer out of figure window

Submitter:  Cristian <r41nm4n>
Submitted:  Fri 09 Aug 2013 02:36:49 PM UTC
   
 
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  andy1978
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 19 Aug 2014 02:33:00 PM UTC, comment #2: 

No response from the original poster for 3 weeks. I think this issue hase been resolved in the default branch. I'm closing the report now but feel free to reopen it if the problem still exists.

Andreas Weber <andy1978>
Group Member
Thu 31 Jul 2014 10:00:47 PM UTC, comment #1: 

This should now be fixed in default. If I follow your instructions I get

Key pressed:
e =

  scalar structure containing the fields:

    Character =  49
    Key =  49
    Modifier = {}(0x0)

Key released:
e =

  scalar structure containing the fields:

    Character =  49
    Key =  49
    Modifier = {}(0x0)


Andreas Weber <andy1978>
Group Member
Fri 09 Aug 2013 02:36:49 PM UTC, original submission:  

If the mouse pointer is out of the figure window, all the events are discarded, including keyboard events.

This happens according to the implementation of _init_fltk_.cc, as this code snippet of the function "int handle (int event)" shows:


    // We only handle events which are in the canvas area.
    if (!Fl::event_inside (canvas))
      return retval;


However, this implies incorrect behaviour for the detection of events related to key press and release, and key modifiers.

Such a wrong behaviour can be shown with the help of the following script:


imshow(0);
function DisplayKeys(~, e, press)
  if press
     disp('Key pressed:');
  else
     disp('Key released:');
  endif
  e
endfunction
set(gcf, 'KeyPressFcn', {@DisplayKeys, true});
set(gcf, 'KeyReleaseFcn', {@DisplayKeys, false});


Once the script is run, the wrong behaviour can be verified by following these instructions:

1) go on the black square in the figure window with the mouse pointer, without pressing any mouse button
2) press "alt" (or "ctrl", or "shift", ...) and keep it pressed
3) move the mouse pointer out of the figure window
4) release "alt" (or what was pressed at step 2)
5) move the mouse pointer back on the black square
6) press "1" (or any other number or letter)

At the console, then I get


e = scalar structure containing the fields:
      Character =  49
      Key =  49
      Modifier =
      {
        [1,1] = alt
      }


which shows that the keyboard event was detected as a key press with modifier "alt", which is of course not correct. The correct result would be


e = scalar structure containing the fields:
      Character =  49
      Key =  49
      Modifier = {}(0x0)



Cristian <r41nm4n>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by andy1978 (Posted a comment)
  • -email is unavailable- added by r41nm4n (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-08-19 andy1978 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2014-07-31 andy1978 StatusNone Ready For Test
        Assigned toNone andy1978

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code