|
From: Jun T. <tak...@kb...> - 2014-11-19 16:21:05
|
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).
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 ....'.
|