|
From: Ethan A M. <sf...@us...> - 2014-11-19 19:56:16
|
On Thursday, 20 November, 2014 01:20:56 Jun T. wrote: > On my Mac, double-clicking on a qt terminal doesn't work. > Does it work on other OSes? If not, then please try the patches > attached below (which are tested only on Mac). I honestly did not know until just now that double-click was supposed to do anything at all. Your Email caused me to search through the documentation, and now I see that it is supposed to copy the current mouse coordinates to the clipboard. (In what format?) No, it doesn't work for me under linux either. Since version 4.something the mouse coordinates are returned in variables MOUSE_X and MOUSE_Y, which is probably more useful that retrieving them from the clipboard. Maybe we should just remove this claim from the documentaion? Ethan > > In QtGnuplotScene::mouseReleaseEvent() (QtGnuplotScene.cpp, around > line 843), GE_buttonrelease event is generated only if more than > 300ms has elapsed since the last button release. > But in event_buttonrelease() (mouse.c, line 1955 and blelow), > term->set_clipboard() is called only if the elapsed time is less > than (or equal to) mouse_setting.doubleclick, whose default value > seems to be 300ms. Thus set_clipboard() will never be called...? > > If I increase mouse_setting.doubleclick by, for example, > gnuplot>set mouse doubleclick 1000 > then double-click sometimes copies garbage to the clipboard, > and otherwise causes a crash, saying 'WRONG readEvent'. > > I guess this is due to an inconsistency between qt_set_clipboard() > (qt_term.cpp, line 912) and QtGnuplotWidget::processEvent() > (QtGnuplotWidget.cpp, line 194 and below); the former sends > 'char s[]' (a simple C-string) to the stream qt->out, > while the latter reads it as a QString. But these two data types > are serialized in different ways in the stream (QString is > encoded in UTF-16). > > If I replace line 916 of qt_term.cpp > qt->out << GECopyClipboard << s; > by > qt->out << GECopyClipboard << QString(s); > then correct data (mouse position) is copied to the clipboard, > and I don't get 'WRONG readEvent' anymore > (assuming mouse_stting.doubleclick is increased as above). > > Moreover, it seems in QtGnuplotScene::mouseReleaseEvent() we need > not filter out any mouse release event; see a patch in > QtGnuplotScence.cpp-2.diff. With this patch, double-click > works without any 'set mouse doubleclick ....'. > |