Revert "add patch for handling mouse grabs in gdk/quartz by foreign (nested) windows"

This reverts commit a6d67fdd56.
This commit is contained in:
Paul Davis 2016-11-21 11:21:23 +00:00
parent a6d67fdd56
commit c319696ceb
1 changed files with 0 additions and 106 deletions

View File

@ -1,106 +0,0 @@
--- /tmp/gtk+-2.24.23/gdk/quartz/gdkevents-quartz.c 2013-10-16 11:31:40.000000000 -0400
+++ gdkevents-quartz.c 2016-11-18 06:53:12.000000000 -0500
@@ -43,6 +43,9 @@
GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN && \
GDK_WINDOW_TYPE (window) != GDK_WINDOW_OFFSCREEN)
+/* This is the NSView not owned by GDK where a mouse down event occurs */
+static NSView *foreign_mouse_down_view;
+
/* This is the window corresponding to the key window */
static GdkWindow *current_keyboard_window;
@@ -705,14 +708,35 @@
NSPoint screen_point;
NSEventType event_type;
+ event_type = [nsevent type];
+
+ if (foreign_mouse_down_view) {
+ switch (event_type) {
+ case NSLeftMouseUp:
+ case NSRightMouseUp:
+ case NSOtherMouseUp:
+ /* mouse up happened, foreign view needs to handle it
+ but we will also assume that it does (e.g. ends
+ a drag and whatever goes with it) and so we reset
+ foreign_mouse_down_view.
+ */
+ foreign_mouse_down_view = 0;
+ return NULL;
+
+ default:
+ /* foreign view needs to handle this */
+ return NULL;
+ }
+ }
+
view = (GdkQuartzView *)[[nsevent window] contentView];
toplevel = get_toplevel_from_ns_event (nsevent, &screen_point, x, y);
- if (!toplevel)
- return NULL;
+ if (!toplevel)
+ return NULL;
+
_gdk_quartz_window_nspoint_to_gdk_xy (screen_point, x_root, y_root);
- event_type = [nsevent type];
switch (event_type)
{
@@ -749,10 +773,10 @@
* event mask should not be checked.
*/
if (!grab->implicit
- && (grab->event_mask & get_event_mask_from_ns_event (nsevent)) == 0)
- return NULL;
+ && (grab->event_mask & get_event_mask_from_ns_event (nsevent)) == 0)
+ return NULL;
- if (grab->owner_events)
+ if (grab->owner_events)
{
/* For owner events, we need to use the toplevel under the
* pointer, not the window from the NSEvent, since that is
@@ -823,13 +847,25 @@
{
unsigned int subviews = [[toplevel_impl->view subviews] count];
unsigned int si;
-
+
for (si = 0; si < subviews; ++si) {
NSView* sv = [[toplevel_impl->view subviews] objectAtIndex:si];
NSRect r = [sv frame];
if (r.origin.x <= *x && r.origin.x + r.size.width >= *x &&
r.origin.y <= *y && r.origin.y + r.size.height >= *y) {
/* event is within subview, forward back to Cocoa */
+
+ switch (event_type)
+ {
+ case NSLeftMouseDown:
+ case NSRightMouseDown:
+ case NSOtherMouseDown:
+ foreign_mouse_down_view = sv;
+ break;
+ default:
+ break;
+ }
+
return NULL;
}
}
@@ -838,12 +874,11 @@
*x = x_tmp;
*y = y_tmp;
}
-
return toplevel;
}
}
break;
-
+
case NSMouseEntered:
case NSMouseExited:
/* Only handle our own entered/exited events, not the ones for the