[Spice-devel] [spice-gtk] widget: Disable IME context on display widget
Frediano Ziglio
fziglio at redhat.com
Thu Jun 16 09:57:10 UTC 2016
>
> >
> > Hi Frediano,
> >
> > On Wed, 2016-06-15 at 11:54 +0100, Frediano Ziglio wrote:
> > > This prevent Windows to handle IME on the widget which cause the
> > > application to not receive keyboard events.
> > >
> > > Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> > > ---
> > > src/spice-widget.c | 9 +++++++++
> > > 1 file changed, 9 insertions(+)
> > >
> > > diff --git a/src/spice-widget.c b/src/spice-widget.c
> > > index c528614..595c8f5 100644
> > > --- a/src/spice-widget.c
> > > +++ b/src/spice-widget.c
> > > @@ -1687,6 +1687,15 @@ static gboolean focus_in_event(GtkWidget *widget,
> > > GdkEventFocus *focus G_GNUC_UN
> > > return true;
> > >
> > > release_keys(display);
> > > +#ifdef G_OS_WIN32
> > > + /* Reset the IME context of the focused window.
> > > + * Note that the focused window can be different from SpiceDisplay
> > > + * one but the events are received and forwarder by this window. */
> >
> > Does it mean that events intended to be for the window but not for
> > SpiceDisplay
> > will be now forwarded to SpiceDisplay ? e.g.: navigation in menu items
> > using
> > accelerators (alt+v to open the view menu)
> >
> > Pavel
> >
>
> No means that Windows keyboard events were/are never sent to
> SpiceDisplay Windows' window (the "focus" is related to keyboard events).
> This patch does not change the events flow, just disable IME processing
> for the Windows window that handle keyboard events for SpiceDisplay.
>
I honestly don't see any possible regression as we are not inserting
strings or text that possibly needs IME handling but just keystrokes.
Even accelerators are keystrokes and not strings.
Taking into account that we receive the focus_in_event when the
Windows window received the focus and already got the WM_SETFOCUS
(this is the Windows message that basically trigger the focus_in_event)
it surely one parent that will forward keys to us.
Frediano
>
> > > + HWND hwnd_focused = GetFocus();
> > > + if (hwnd_focused != NULL) {
> > > + ImmAssociateContext(hwnd_focused, NULL);
> > > + }
> > > +#endif
> > > if (!d->disable_inputs)
> > > spice_gtk_session_sync_keyboard_modifiers(d->gtk_session);
> > > if (d->keyboard_grab_released)
> >
More information about the Spice-devel
mailing list