linux-packaging-mono/external/bockbuild/packages/patches/gtk/0052-nsview-also-focus-the-GtkNSView-if-a-focussable-subv.patch

50 lines
1.8 KiB
Diff
Raw Normal View History

From 6bf17cdaffe648ce53dd39619c3ff9a65d272831 Mon Sep 17 00:00:00 2001
From: Michael Natterer <mitch@gimp.org>
Date: Fri, 5 Jul 2013 11:49:22 +0200
Subject: [PATCH 52/68] nsview: also focus the GtkNSView if a focussable
subview was clicked
---
gtk/gtknsview.c | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/gtk/gtknsview.c b/gtk/gtknsview.c
index b37b2fa..3b30d3b 100644
--- a/gtk/gtknsview.c
+++ b/gtk/gtknsview.c
@@ -713,17 +713,25 @@ gtk_ns_view_native_child_event (GdkWindow *window,
{
case NSLeftMouseDown:
if (! gtk_widget_has_focus (GTK_WIDGET (ns_view)) &&
-
- /* other code can set can-focus, so check for both */
- gtk_widget_get_can_focus (GTK_WIDGET (ns_view)) &&
- [ns_view->priv->view acceptsFirstResponder])
+ gtk_widget_get_can_focus (GTK_WIDGET (ns_view)))
{
+ NSPoint point = [[view superview ] convertPoint: [event locationInWindow]
+ fromView: nil];
+ NSView *hit = [view hitTest: point];
+
+ if (hit &&
+ (hit == view ||
+ [hit ancestorSharedWithView: view] == view) &&
+ ([hit acceptsFirstResponder] ||
+ [view acceptsFirstResponder]))
+ {
#if DEBUG_FOCUS
- g_printerr ("grabbing focus on %s\n",
- class_getName ([ns_view->priv->view class]));
+ g_printerr ("grabbing focus on %s\n",
+ class_getName ([ns_view->priv->view class]));
#endif
- gtk_widget_grab_focus (GTK_WIDGET (ns_view));
+ gtk_widget_grab_focus (GTK_WIDGET (ns_view));
+ }
}
break;
--
1.7.10.2 (Apple Git-33)