[gtk/wip/chergert/quartz4u: 77/142] macos: fix refocusing bug
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/quartz4u: 77/142] macos: fix refocusing bug
- Date: Tue, 23 Jun 2020 18:36:11 +0000 (UTC)
commit 1e1bde09f96ed4dbc6508b92297103017dd38889
Author: Christian Hergert <chergert redhat com>
Date: Tue May 19 14:06:11 2020 -0700
macos: fix refocusing bug
We had a situation since the beginning here where you'd have to
refocus the window after doing window drag operations.
gdk/macos/GdkMacosWindow.c | 8 ++++++++
gdk/macos/gdkmacosdisplay-private.h | 2 ++
gdk/macos/gdkmacosdisplay-translate.c | 22 ++++++++++++++++++++++
3 files changed, 32 insertions(+)
---
diff --git a/gdk/macos/GdkMacosWindow.c b/gdk/macos/GdkMacosWindow.c
index 108d6cb86b..7be84c515c 100644
--- a/gdk/macos/GdkMacosWindow.c
+++ b/gdk/macos/GdkMacosWindow.c
@@ -131,6 +131,14 @@
inManualResize = NO;
inMove = NO;
+ /* We need to deliver the event to the proper drag gestures or we
+ * will leave the window in inconsistent state that requires clicking
+ * in the window to cancel the gesture.
+ *
+ * TODO: Can we improve grab breaking to fix this?
+ */
+ _gdk_macos_display_send_button_event ([self gdkDisplay], event);
+
break;
}
diff --git a/gdk/macos/gdkmacosdisplay-private.h b/gdk/macos/gdkmacosdisplay-private.h
index 303be3535e..a29bea4ba2 100644
--- a/gdk/macos/gdkmacosdisplay-private.h
+++ b/gdk/macos/gdkmacosdisplay-private.h
@@ -143,6 +143,8 @@ void _gdk_macos_display_surface_became_key (GdkMacosDisp
int _gdk_macos_display_get_nominal_refresh_rate (GdkMacosDisplay *self);
void _gdk_macos_display_clear_sorting (GdkMacosDisplay *self);
const GList *_gdk_macos_display_get_surfaces (GdkMacosDisplay *self);
+void _gdk_macos_display_send_button_event (GdkMacosDisplay *self,
+ NSEvent *nsevent);
G_END_DECLS
diff --git a/gdk/macos/gdkmacosdisplay-translate.c b/gdk/macos/gdkmacosdisplay-translate.c
index 77657f4d22..636173aa27 100644
--- a/gdk/macos/gdkmacosdisplay-translate.c
+++ b/gdk/macos/gdkmacosdisplay-translate.c
@@ -1199,3 +1199,25 @@ _gdk_macos_display_synthesize_motion (GdkMacosDisplay *self,
node = _gdk_event_queue_append (GDK_DISPLAY (self), event);
_gdk_windowing_got_event (GDK_DISPLAY (self), node, event, 0);
}
+
+void
+_gdk_macos_display_send_button_event (GdkMacosDisplay *self,
+ NSEvent *nsevent)
+{
+ GdkMacosSurface *surface;
+ GdkEvent *event;
+ int x;
+ int y;
+
+ g_return_if_fail (GDK_IS_MACOS_DISPLAY (self));
+ g_return_if_fail (nsevent != NULL);
+
+ if (!(surface = find_surface_for_ns_event (self, nsevent, &x, &y)))
+ return;
+
+ event = fill_button_event (self, surface, nsevent, x, y);
+ _gdk_windowing_got_event (GDK_DISPLAY (self),
+ _gdk_event_queue_append (GDK_DISPLAY (self), event),
+ event,
+ 0);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]