|
From: Ethan A M. <sf...@us...> - 2015-08-27 19:44:13
|
On Tuesday, 25 August, 2015 16:17:52 Allin Cottrell wrote:
> On Tue, 25 Aug 2015, Ethan A Merritt wrote:
> >
> >>> The single- and multi- threaded versions use a different section of
> >>> code in the routine wxt_gui.cpp: wxt_waitforinput()
> >>> It sounds like there is some tweak needed for the single-threaded
> >>> code block so that it doesn't exit if "pause mouse close" is active.
> >>>
> >>> You could try adding a check for
> >>> if (!paused_for_mouse)
> >>> or maybe it would need to be
> >>> if ((paused_for_mouse & PAUSE_WINCLOSE) != 0)
> >>>
> >>> before breaking from the loop that starts at line 3869.
> >>> But I'm not sure... that might cause it to hang in other
> >>> circumstances.
> >>
> >> Thanks for the hint, I'll give it a try.
I tried building the single-threaded option on linux.
"pause mouse" commands did not work at all; the program
resumed on the next keyboard input regardless of mousing.
The following 2 patches fixed it:
Patch 1 prevents "pause mouse" from returning prematurely
--- a/src/wxterminal/wxt_gui.cpp 2015-07-13 10:54:44.000000000 -0700
+++ b/src/wxterminal/wxt_gui.cpp 2015-08-27 12:26:12.000000000 -0700
@@ -3880,6 +3881,7 @@ int wxt_waitforinput(int options)
FD_ZERO(&read_fd);
FD_SET(0, &read_fd);
if (select(1, &read_fd, NULL, NULL, &tv) != -1 && FD_ISSET(0, &read_fd))
+ if (!paused_for_mouse)
break;
}
return getchar();
Patch 2 prevents loss of a character from the input stream after
waiting for a mouse click.
I am not sure if this is needed or even safe on Windows.
--- a/src/wxterminal/wxt_gui.cpp 2015-07-13 10:54:44.000000000 -0700
+++ b/src/wxterminal/wxt_gui.cpp 2015-08-27 12:26:12.000000000 -0700
@@ -3716,7 +3716,8 @@ bool wxt_exec_event(int type, int mx, in
event.winid = id;
#if defined(WXT_MONOTHREADED) || defined(_Windows)
- wxt_process_one_event(&event);
+ if (wxt_process_one_event(&event))
+ ungetc('\n',stdin); /* FIXME: OK on Windows? */
return true;
#else
if (!wxt_handling_persist)
|