diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2020-10-08 15:55:29 +0800 |
---|---|---|
committer | Chun-wei Fan <fanchunwei@src.gnome.org> | 2020-10-08 16:10:22 +0800 |
commit | 865f623d3a7707e7667f3280375f164604975f15 (patch) | |
tree | 2aeb2137a9582b4c307d421cd7340e80b9b394a5 | |
parent | 12799ff4569be4e50d85b8b417d9c314614cfc4a (diff) | |
download | gtk+-win32.modal.tar.gz |
gdk/Win32: Fix mouse pointer capturewin32.modal
Call SetCapture() explcitly for the (new) modal window so that we make the
modal window respond to mouse input, and also call SetCapture() to the parent
of the transient window that we are destroying so that mouse input capture is
returned to the parent window.
This attempts to fix the following:
* Upon creating a new modal window, the new modal window does not receive
pointer input unless one switches to another program and back
* Upon closing a transient window, the parent window that activated the
transient window does not receive pointer input unless one switches to
another and back
-rw-r--r-- | gdk/win32/gdkevents-win32.c | 5 | ||||
-rw-r--r-- | gdk/win32/gdksurface-win32.c | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c index 24c300f932..8652f8c5f3 100644 --- a/gdk/win32/gdkevents-win32.c +++ b/gdk/win32/gdkevents-win32.c @@ -2901,7 +2901,10 @@ gdk_event_translate (MSG *msg, if (impl->transient_owner && GetForegroundWindow () == GDK_SURFACE_HWND (window)) - SetForegroundWindow (GDK_SURFACE_HWND (impl->transient_owner)); + { + SetForegroundWindow (GDK_SURFACE_HWND (impl->transient_owner)); + SetCapture (GDK_SURFACE_HWND (impl->transient_owner)); + } } if (!(windowpos->flags & SWP_NOCLIENTSIZE)) diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c index 9ecbb6dbad..076e18aac1 100644 --- a/gdk/win32/gdksurface-win32.c +++ b/gdk/win32/gdksurface-win32.c @@ -4828,7 +4828,10 @@ gdk_win32_toplevel_set_property (GObject *object, GDK_SURFACE (surface)->modal_hint = g_value_get_boolean (value); if (GDK_SURFACE (surface)->modal_hint) - _gdk_push_modal_window (surface); + { + SetCapture (GDK_SURFACE_HWND (surface)); + _gdk_push_modal_window (surface); + } g_object_notify_by_pspec (G_OBJECT (surface), pspec); break; |