bugGNU Octave - Bugs: bug #44676, ginput() does not return mouse...

 
 

bug #44676: ginput() does not return mouse button value with Qt

Submitted by:  Philip Nienhuis <philipnienhuis>
Submitted on:  Tue 31 Mar 2015 11:34:01 AM UTC  
 
Category: PlottingSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Regression
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)

Tue 31 Mar 2015 08:25:24 PM UTC, comment #9:

Thanks, that was a very quick fix!

(Indeed Rik, I think 1,5 weeks ago it still worked, as scripts I made around that time that invoked ginput worked fine. Today I continued work on that code and ginput no longer worked)

Philip Nienhuis <philipnienhuis>
Project Member
Tue 31 Mar 2015 06:32:58 PM UTC, comment #8:

I fixed Qt to behave the same as FLTK and include the button number when executing the windowbuttondownfcn callback (http://hg.savannah.gnu.org/hgweb/octave/rev/0376c1225660).

Rik <rik5>
Project Administrator
Tue 31 Mar 2015 05:49:08 PM UTC, comment #7:

I think we have a small Matlab incompatibility here. Matlab's WindowButtonDownFcn is just a callback without arguments. In Octave, the file ginput.m expects that the first argument to the callback is the button number.

And in _init_fltk_.cc

so it works for FLTK.

In Canvas.cc, however,

so it doesn't work for Qt.

Easiest solution would be to add "button_number (event)" to the windowbuttondownfcn callback.

Alternatively, we can do what Matlab user's would do and check the "SelectionType" property of current figure to determine if it was "normal", "extended", or "alt".

Rik <rik5>
Project Administrator
Tue 31 Mar 2015 05:29:15 PM UTC, comment #6:

Yeah, I thought I fixed this problem recently with this patch:

http://hg.savannah.gnu.org/hgweb/octave/rev/b38b677c0fa8

What happened? Oh, I think it was this change:

http://hg.savannah.gnu.org/hgweb/octave/rev/6e5365ee200a

Should be easy to fix by also passing the button number to the windowbuttondownfcn callback.

John W. Eaton <jwe>
Project Administrator
Tue 31 Mar 2015 05:26:13 PM UTC, comment #5:

I tried to use 'hg bisect', but I couldn't find when ginput was ever correctly reporting button clicks. So, it is confirmed that there is a problem with ginput and Qt.

Rik <rik5>
Project Administrator
Tue 31 Mar 2015 03:38:42 PM UTC, comment #4:

For gnuplot, it had been reported before on being a value of 1023 sometimes, which I had seen in Windows only and had been fixed by checking if was 1023 and setting the return value to 1 [1]

[1] https://savannah.gnu.org/bugs/?func=detailitem&item_id=42489

John Donoghue <lostbard>
Project Member
Tue 31 Mar 2015 03:35:57 PM UTC, comment #3:

I'm pretty sure this is a recent regression. I believe as recently as a few weeks ago this was working. I'm adding jwe to the CC list since he was working on this code earlier.

Rik <rik5>
Project Administrator
Tue 31 Mar 2015 03:22:12 PM UTC, comment #2:

It looks like there may be a need for qt initialization like
at line 76 of ginput.m for fltk:
if (strcmp (toolkit, "fltk"))
_fltk_check_ ();
endif
for qt ? But, it almost works for gnuplot:

>> [x,y,button]=ginput(3)

x =

0.46300
0.37694
0.37694

y =

0.77482
0.67101
0.66835

button =

3
1063
2

>>

good, except button 1 shows as 1063

This is current devel on Fedora 21.

Michael Godfrey <godfrey>
Project Member
Tue 31 Mar 2015 02:51:29 PM UTC, comment #1:

Doesn't work for the qt toolkit - fltk and gnuplot work.

Also does the same on my fedora box for the empty button array.

John Donoghue <lostbard>
Project Member
Tue 31 Mar 2015 11:34:01 AM UTC, original submission:

[~, ~, b] = ginput () returns an empty value [](0x0) for b when a mouse button is clicked.
Expected is 1, 2, or 3, depending on which mouse button was pressed.

ginput() does return the ASCII value of pressed keyboard keys.

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 jwe (Posted a comment)
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by rik5
  • -unavailable- added by godfrey (Posted a comment)
  • -unavailable- added by lostbard (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 10 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 31 Mar 2015 06:32:58 PM UTCrik5StatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Tue 31 Mar 2015 05:49:08 PM UTCrik5Summaryginput() does not return mouse button value=>ginput() does not return mouse button value with Qt
    Tue 31 Mar 2015 05:29:15 PM UTCjweItem GroupIncorrect Result=>Regression
      Summaryginput() does not return mouse button value with Qt=>ginput() does not return mouse button value
    Tue 31 Mar 2015 05:26:13 PM UTCrik5Item GroupRegression=>Incorrect Result
      Summaryginput() does not return mouse button value=>ginput() does not return mouse button value with Qt
    Tue 31 Mar 2015 03:35:57 PM UTCrik5Carbon-Copy-=>Added jwe
    Tue 31 Mar 2015 02:51:29 PM UTClostbardStatusNone=>Confirmed
      Operating SystemMicrosoft Windows=>Any

    Back to the top


    Powered by Savane 3.1-cleanup1