bugGNU Octave - Bugs: bug #44834, [FLTK] ginput doesn't return...

 
 

bug #44834: [FLTK] ginput doesn't return proper (X,Y) coordinates for key press

Submitted by:  Philip Nienhuis <philipnienhuis>
Submitted on:  Tue 14 Apr 2015 12:49:33 PM UTC  
 
Category: Plotting with OpenGLSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: None
Originator Name: Philip NienhuisOpen/Closed: Closed
Release: devOperating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Thu 23 Apr 2015 03:41:37 PM UTC, comment #12:

Thanks for testing. They are doing what I expected. I checked in a fix for FLTK here (http://hg.savannah.gnu.org/hgweb/octave/rev/144498565de9). Closing report.

Rik <rik5>
Project Administrator
Thu 23 Apr 2015 12:03:03 PM UTC, comment #11:

BTW, ginput does move currentpoint.
Clicking lower left:

and then, moving mouse cursor to upper right and...:

Is this enough info?

Philip Nienhuis <philipnienhuis>
Project Member
Thu 23 Apr 2015 10:26:30 AM UTC, comment #10:

(added comment)
I can see that the focus is on the graphics window when I type the key because I have "focus follows mouse" set in one of those UI tweak utilities for Windows and the graphics title bar indicates focus.

Philip Nienhuis <philipnienhuis>
Project Member
Thu 23 Apr 2015 10:24:23 AM UTC, comment #9:

Rik,
The secondaction (type "a") gives me an error message in the terminal:

Apparently Matlab transfers the focus to the terminal for key presses even if the mouse cursor is in the graphics windows.

The currentpoint for the entire action sequence remains to be the same and it is two rather than one for reasons unknown to me:

Philip Nienhuis <philipnienhuis>
Project Member
Tue 21 Apr 2015 08:53:59 PM UTC, comment #8:

I think I need another test run. I know that Matlab updates the currentpoint property when ginput is run. Does it update the currentpoint property for every keypress regardless of whether ginput is running?

Sample code:

Is the answer (1,1) or (10,10)?

Rik <rik5>
Project Administrator
Tue 21 Apr 2015 07:38:50 PM UTC, comment #7:

Thank you very much for the fix!
I'll try later tonight, or tomorrow.

Philip Nienhuis <philipnienhuis>
Project Member
Tue 21 Apr 2015 03:52:13 AM UTC, comment #6:

I fixed the return coordinates for Qt in this cset (http://hg.savannah.gnu.org/hgweb/octave/rev/248f2f2e7d48). It was more difficult than I had hoped.

I'm re-titling to reflect that FLTK has not been updated

Rik <rik5>
Project Administrator
Sun 19 Apr 2015 03:29:07 AM UTC, comment #5:

Thanks Guillaume. I now have enough information to code a solution.

Rik <rik5>
Project Administrator
Sat 18 Apr 2015 11:30:58 PM UTC, comment #4:

Here is what MATLAB returns:

Guillaume <gyom>
Sat 18 Apr 2015 10:43:17 PM UTC, comment #3:

@Philip: Could you test whether Matlab is updating the CurrentPoint property when a key is pressed?

Sample code:

You said that the value returned in (x,y) was correct for a keypress. Was the value of the CurrentPoint property the same as that returned in (x,y) which is something like (5,5)?

Rik <rik5>
Project Administrator
Tue 14 Apr 2015 07:44:27 PM UTC, comment #2:

I just tested on Linux -> same issue -> OS set to Any

Philip Nienhuis <philipnienhuis>
Project Member
Tue 14 Apr 2015 07:18:12 PM UTC, comment #1:

Confirmed. Although what it appears to do is simply return the coordinates of the last mouse button press (maybe initialized to 0,0 if there has bee no mouse button yet).

This will have to be fixed separatel for the FLTK toolkit and for the Qt toolkit.

For the FLTK toolkit the file is libinterp/dldfcn/__init_fltk__.cc. The function is handle() and the case statement block is FL_KEYDOWN. Probably need to borrow the code from FL_PUSH (single mouse click) and set the currentpoint property of the axis.

This is what the callback for a keypress in ginput.m relies on to get the positioning.

Of course, this might not be exactly Matlab compatible as my reading of the documentation suggests that only a true mouse click should set the currentpoint property. But, maybe this small Matlab incompatibity isn't as bad as not returning X,Y coordinates.

For Qt, the file to change is libgui/graphics/Canvas.cc. The function is Canvas::canvasKeyPressEvent. Very likely the same solution in that updateCurrentPoint (figObj, obj, event) needs to be called when a key is pressed, not just for a mouse event.

Rik <rik5>
Project Administrator
Tue 14 Apr 2015 12:49:33 PM UTC, original submission:

With the OpenGL toolkits, ginput returns (0, 0) for the XY coordinates when a key is pressed. This has been the case since 3.8.2

In gnuplot has been working fine since at least 3.8.2. Matlab's ginput also returns proper plot coordinates for key presses

Philip Nienhuis <philipnienhuis>
Project Member

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by gyom (Posted a comment)
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by philipnienhuis (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 23 Apr 2015 03:41:37 PM UTCrik5StatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Tue 21 Apr 2015 03:52:13 AM UTCrik5Summary[OpenGL] ginput doesn\'t return proper (X,Y) coordinates for key press=>[FLTK] ginput doesn't return proper (X,Y) coordinates for key press
    Tue 14 Apr 2015 07:44:27 PM UTCphilipnienhuisOperating SystemMicrosoft Windows=>Any
    Tue 14 Apr 2015 07:18:12 PM UTCrik5StatusNone=>Confirmed

    Back to the top


    Powered by Savane 3.1-cleanup1