Page 2 of 2

Re: Mouse Click Grabs keyboard focus in some hosts

Posted: Thu Nov 30, 2017 9:10 am
by bx_joscha
Will a fix for keyboard + mouse focus be integrated in a forthcoming VSTGUI release?

Re: Mouse Click Grabs keyboard focus in some hosts

Posted: Thu Nov 30, 2017 11:24 am
by ray
bx_joscha wrote:Will a fix for keyboard + mouse focus be integrated in a forthcoming VSTGUI release?
Hey Joscha,

I hope you're doing well.

Here's my pull request, let's see what happens: https://github.com/steinbergmedia/vstgui/pull/47

Re: Mouse Click Grabs keyboard focus in some hosts

Posted: Wed Dec 06, 2017 12:13 pm
by bx_joscha
Thanks for the fix, Reimund. I have merged the fix into our VSTGUI 4.3.1 code base. I had to tweak it a little bit to fix returning the keyboard focus after editing a textedit control and pressing enter.

Now I encounter the problem that in all hosts I have tested so far, pressing the arrow keys does not yield a WM_KEYDOWN event. The event is always caught by the host. Does anyone encounter a similar problem? Again, we are not using the latest VSTGUI version from the master branch, but the latest released version.

Re: Mouse Click Grabs keyboard focus in some hosts

Posted: Thu Dec 07, 2017 9:12 am
by ray
bx_joscha wrote:Thanks for the fix, Reimund. I have merged the fix into our VSTGUI 4.3.1 code base. I had to tweak it a little bit to fix returning the keyboard focus after editing a textedit control and pressing enter.

Now I encounter the problem that in all hosts I have tested so far, pressing the arrow keys does not yield a WM_KEYDOWN event. The event is always caught by the host. Does anyone encounter a similar problem? Again, we are not using the latest VSTGUI version from the master branch, but the latest released version.
Hi Joscha,

Thanks for noting the additional patch required in conjunction with text edits loosing their focus. We didn't catch that one as none of our plugins uses text edits :).

Regarding your second remark: I'm not familiar with the details of your integration into 4.3.1 and the additional patch, but I have done a little debugging by setting a breakpoint right below case WM_KEYDOWN and/or case WM_KEYUP and found the patch to be transparant as to the described behavior. Maybe try reverting the patch and see if it influences whether these breakpoints are hit at all. Keep in mind that you have to click the editor window / any of the controls first in order to give keyboard focus to VSTGUI first via SetFocus() in the cases WM_RBUTTONDBLCLK, WM_MBUTTONDBLCLK,WM_LBUTTONDBLCLK,WM_XBUTTONDBLCLK, WM_RBUTTONDOWN, WM_MBUTTONDOWN, WM_LBUTTONDOWN or WM_XBUTTONDOWN which is independent of whether the patch is applied or not. Another idea: Maybe also check whether your additional text edit fix is interfering in some way.

Re: Mouse Click Grabs keyboard focus in some hosts

Posted: Thu Dec 14, 2017 1:56 pm
by bx_joscha
I resolved the issue by adding

Code: Select all

case WM_GETDLGCODE:
{
	LONG_PTR flags = DLGC_WANTALLKEYS;
	return flags;
}
to Win32Frame::WindowProc().