|
From: Allin C. <cot...@wf...> - 2015-08-29 14:36:41
|
On Thu, 27 Aug 2015, Ethan A Merritt wrote:
> 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)
Thanks, Ethan. I can confirm that these patches work nicely for me
with wxWidgets 3.0.2 on OS X 10.10.
On an unrelated cosmetic point: there's some comment in the gnuplot
wxt* sources about "blurry" icons on cocoa, with a workaround to
make the gnuplot-specific PNG-derived icons come out better. The
workaround is effective, but that leaves the two icons on the left
of the wxt terminal toolbar (Copy to clipboard and Save to disk),
which are added via the wxArtProvider API. In my build, at any rate,
these come out horrible (I think they must be bitmaps downsized from
the cocoa default of 32x32). They are bigger than the other icons
and also blurry.
In my build I have added a 16x16 "Save" icon (from GTK stock) in the
same mode as the gnuplot-specific icons in wxterminal/bitmaps/png
and I'm using this (plus the clipboard icon that's already present
in that directory but not used currently) to replace the wxArt icons
-- so that all items on the toolbar are of a uniform size and
sharpness.
If there's interest in this I could submit a patch; I guess it's
specific to __WXOSX_COCOA__.
Allin Cottrell
|