[gtk/gtk-3-24: 1/2] gdk: quartz: prevent titlebar events from falling to the window below
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-3-24: 1/2] gdk: quartz: prevent titlebar events from falling to the window below
- Date: Wed, 27 Nov 2019 13:32:31 +0000 (UTC)
commit f91b42983937c94a2875af3498fa2ea6078ec58d
Author: Jeremy Tan <jtanx outlook com>
Date: Sat Oct 19 18:15:35 2019 +0800
gdk: quartz: prevent titlebar events from falling to the window below
gdk/quartz/gdkevents-quartz.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
---
diff --git a/gdk/quartz/gdkevents-quartz.c b/gdk/quartz/gdkevents-quartz.c
index d525759a4f..d97cebd2bd 100644
--- a/gdk/quartz/gdkevents-quartz.c
+++ b/gdk/quartz/gdkevents-quartz.c
@@ -457,6 +457,29 @@ get_toplevel_from_ns_event (NSEvent *nsevent,
* here, not very nice.
*/
_gdk_quartz_events_break_all_grabs (get_time_from_ns_event (nsevent));
+
+ /* Check if the event occurred on the titlebar. If it did,
+ * explicitly return NULL to prevent going through the
+ * fallback path, which could match the window that is
+ * directly under the titlebar.
+ */
+ if (view_point.y < 0 &&
+ view_point.x >= view_frame.origin.x &&
+ view_point.x < view_frame.origin.x + view_frame.size.width)
+ {
+ NSView *superview = [view superview];
+ if (superview)
+ {
+ NSRect superview_frame = [superview frame];
+ int titlebar_height = superview_frame.size.height -
+ view_frame.size.height;
+
+ if (titlebar_height > 0 && view_point.y >= -titlebar_height)
+ {
+ return NULL;
+ }
+ }
+ }
}
else
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]