Transfer the Mac SDK bockbuild profiles & resources inside the Mono repository.
[mono.git] / bockbuild / mac-sdk / patches / gtk / 0052-nsview-also-focus-the-GtkNSView-if-a-focussable-subv.patch
1 From 6bf17cdaffe648ce53dd39619c3ff9a65d272831 Mon Sep 17 00:00:00 2001
2 From: Michael Natterer <mitch@gimp.org>
3 Date: Fri, 5 Jul 2013 11:49:22 +0200
4 Subject: [PATCH 52/68] nsview: also focus the GtkNSView if a focussable
5  subview was clicked
6
7 ---
8  gtk/gtknsview.c |   22 +++++++++++++++-------
9  1 file changed, 15 insertions(+), 7 deletions(-)
10
11 diff --git a/gtk/gtknsview.c b/gtk/gtknsview.c
12 index b37b2fa..3b30d3b 100644
13 --- a/gtk/gtknsview.c
14 +++ b/gtk/gtknsview.c
15 @@ -713,17 +713,25 @@ gtk_ns_view_native_child_event (GdkWindow *window,
16          {
17          case NSLeftMouseDown:
18            if (! gtk_widget_has_focus (GTK_WIDGET (ns_view)) &&
19 -
20 -              /*  other code can set can-focus, so check for both  */
21 -              gtk_widget_get_can_focus (GTK_WIDGET (ns_view)) &&
22 -              [ns_view->priv->view acceptsFirstResponder])
23 +              gtk_widget_get_can_focus (GTK_WIDGET (ns_view)))
24              {
25 +              NSPoint point = [[view superview ] convertPoint: [event locationInWindow]
26 +                                                     fromView: nil];
27 +              NSView *hit   = [view hitTest: point];
28 +
29 +              if (hit &&
30 +                  (hit == view ||
31 +                   [hit ancestorSharedWithView: view] == view) &&
32 +                  ([hit acceptsFirstResponder] ||
33 +                   [view acceptsFirstResponder]))
34 +                {
35  #if DEBUG_FOCUS
36 -              g_printerr ("grabbing focus on %s\n",
37 -                          class_getName ([ns_view->priv->view class]));
38 +                  g_printerr ("grabbing focus on %s\n",
39 +                              class_getName ([ns_view->priv->view class]));
40  #endif
41
42 -              gtk_widget_grab_focus (GTK_WIDGET (ns_view));
43 +                  gtk_widget_grab_focus (GTK_WIDGET (ns_view));
44 +                }
45              }
46            break;
47
48 --
49 1.7.10.2 (Apple Git-33)