Hi, On Tue, Jun 06, 2017 at 10:19:34AM +0300, Snir Sheriber wrote: > Currently the client grabs keyboard based on session focus, on windows > environment gtk sends grab_broken if wm_killfocus is received (when > focus is changed) while the application has the grab. It means that > when grab is based on the session, clicking inside focusless window > will cause wm_killfocus to be sent towards the focused window, this > will generate grab_broken event which follows by no grab at all. > > This patch expands the solution presented in 143ebfd to work also on > windows client without causing grab_broken event. > This is implemented a bit differently from linux, if on mouse entrance > session already has focus, focus will be set to the current window, > this will generate focus events that will release and take grab again > without grab_broken event. > > Resolves: rhbz#1429611 > Related: rhbz#1275231 > --- > Changes: Commit message bit more detailed now And pushed: commit 178fe41e9fb8a50b72155becdd367820c88ef177 Author: Snir Sheriber <ssheribe@xxxxxxxxxx> Date: Tue Jun 6 10:19:34 2017 +0300 > --- > src/spice-widget.c | 17 ++++++++++++++++- > 1 file changed, 16 insertions(+), 1 deletion(-) > > diff --git a/src/spice-widget.c b/src/spice-widget.c > index 1a1d5a6..b3407b5 100644 > --- a/src/spice-widget.c > +++ b/src/spice-widget.c > @@ -850,10 +850,17 @@ static void try_keyboard_grab(SpiceDisplay *display) > return; > if (d->keyboard_grab_active) > return; > +#ifdef G_OS_WIN32 > + if (!d->keyboard_have_focus) > + return; > + if (!d->mouse_have_pointer) > + return; > +#else > if (!spice_gtk_session_get_keyboard_has_focus(d->gtk_session)) > return; > if (!spice_gtk_session_get_mouse_has_pointer(d->gtk_session)) > return; > +#endif > if (d->keyboard_grab_released) > return; > > @@ -1543,6 +1550,12 @@ static void update_display(SpiceDisplay *display) > win32_window = display ? > gdk_win32_window_get_impl_hwnd(gtk_widget_get_window(GTK_WIDGET(display))) : > NULL; > + if(win32_window) { > + SpiceDisplayPrivate *d = display->priv; > + if(spice_gtk_session_get_keyboard_has_focus(d->gtk_session) && > + spice_gtk_session_get_mouse_has_pointer(d->gtk_session)) > + SetFocus(win32_window); > + } > #endif > } > > @@ -1862,7 +1875,6 @@ static gboolean focus_in_event(GtkWidget *widget, GdkEventFocus *focus G_GNUC_UN > static gboolean focus_out_event(GtkWidget *widget, GdkEventFocus *focus G_GNUC_UNUSED) > { > SpiceDisplay *display = SPICE_DISPLAY(widget); > - SpiceDisplayPrivate *d = display->priv; > > DISPLAY_DEBUG(display, "%s", __FUNCTION__); > update_display(NULL); > @@ -1871,8 +1883,11 @@ static gboolean focus_out_event(GtkWidget *widget, GdkEventFocus *focus G_GNUC_U > * Ignore focus out after a keyboard grab > * (this happens when doing the grab from the enter_event callback). > */ > +#ifndef G_OS_WIN32 > + SpiceDisplayPrivate *d = display->priv; > if (d->keyboard_grab_active) > return true; > +#endif > > release_keys(display); > update_keyboard_focus(display, false); > -- > 2.9.3 > > _______________________________________________ > Spice-devel mailing list > Spice-devel@xxxxxxxxxxxxxxxxxxxxx > https://lists.freedesktop.org/mailman/listinfo/spice-devel
Attachment:
signature.asc
Description: PGP signature
_______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel