Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/bockbuild.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody Russell <cody@jhu.edu>2018-12-07 18:15:37 +0300
committerCody Russell <cody@jhu.edu>2018-12-07 18:17:07 +0300
commite0002d950396f943c31cc1a95c9cd3222f6f08d1 (patch)
tree37156916665f022d2cc63c77b3a9ea5b59824a18
parent4a3e9edd2738e1bbdeca61f54ee2054ffd3cdeb5 (diff)
[GTK] Fix focus handling to better handle subviews for GtkNSView
Fixes VSTS #737323
-rw-r--r--packages/gtk+.py5
-rw-r--r--packages/patches/gtk/gtk-nsview-subview-focus-fixes.patch47
2 files changed, 51 insertions, 1 deletions
diff --git a/packages/gtk+.py b/packages/gtk+.py
index 9c9d516..e7c8d12 100644
--- a/packages/gtk+.py
+++ b/packages/gtk+.py
@@ -213,7 +213,10 @@ class GtkPackage (GitHubPackage):
#'patches/gtk/gtk-fix-find_nsview_at_pos-recursive.patch',
# https://devdiv.visualstudio.com/DevDiv/_workitems/edit/569768
- 'patches/gtk/gtk-imquartz-commit-on-focus-out.patch'
+ 'patches/gtk/gtk-imquartz-commit-on-focus-out.patch',
+
+ # https://devdiv.visualstudio.com/DevDiv/_workitems/edit/737323
+ 'patches/gtk/gtk-nsview-subview-focus-fixes.patch'
])
def prep(self):
diff --git a/packages/patches/gtk/gtk-nsview-subview-focus-fixes.patch b/packages/patches/gtk/gtk-nsview-subview-focus-fixes.patch
new file mode 100644
index 0000000..50ed1dd
--- /dev/null
+++ b/packages/patches/gtk/gtk-nsview-subview-focus-fixes.patch
@@ -0,0 +1,47 @@
+diff --git a/gtk/gtknsview.c b/gtk/gtknsview.c
+index a4b4dd4dbe..0fc5055ed0 100644
+--- a/gtk/gtknsview.c
++++ b/gtk/gtknsview.c
+@@ -442,15 +442,30 @@ gtk_ns_view_replace_draw_insertion_point (void)
+ }
+ }
+
++gboolean
++does_accept_first_responder_recursively (NSView *view)
++{
++ if ([view acceptsFirstResponder]) {
++ g_print ("%s accepts? %d\n", object_getClassName (view), [view acceptsFirstResponder]);
++ return TRUE;
++ }
++
++ for (NSView *subview in [view subviews]) {
++ return does_accept_first_responder_recursively (subview);
++ }
++
++ return FALSE;
++}
++
+ static void
+ gtk_ns_view_constructed (GObject *object)
+ {
+ GtkNSView *ns_view = GTK_NS_VIEW (object);
++ gboolean can_focus = does_accept_first_responder_recursively (ns_view->priv->view);
+
+ G_OBJECT_CLASS (gtk_ns_view_parent_class)->constructed (object);
+
+- gtk_widget_set_can_focus (GTK_WIDGET (ns_view),
+- [ns_view->priv->view acceptsFirstResponder]);
++ gtk_widget_set_can_focus (GTK_WIDGET (ns_view), can_focus);
+
+ #if DEBUG_FOCUS
+ g_printerr ("%s can focus: %d\n",
+@@ -819,8 +834,7 @@ gtk_ns_view_native_child_event (GdkWindow *window,
+ if (hit &&
+ (hit == view ||
+ [hit ancestorSharedWithView: view] == view) &&
+- ([hit acceptsFirstResponder] ||
+- [view acceptsFirstResponder]))
++ does_accept_first_responder_recursively (view))
+ {
+ #if DEBUG_FOCUS
+ g_printerr ("grabbing focus on %s\n",