[gtk+/wip/mir] mir: allow windows to become focused



commit 7411de3353b1ea6acdd409fc707b29cc6a717db9
Author: Ryan Lortie <desrt desrt ca>
Date:   Wed May 28 16:21:31 2014 +0200

    mir: allow windows to become focused
    
    Send focus change events to toplevels in response to getting the event
    from mir.
    
    Now that the window is focused, cursor blink works, so wire up those
    GtkSettings as well.

 gdk/mir/gdkmireventsource.c |   22 ++++++++++++++++++----
 gdk/mir/gdkmirscreen.c      |   18 ++++++++++++++++++
 2 files changed, 36 insertions(+), 4 deletions(-)
---
diff --git a/gdk/mir/gdkmireventsource.c b/gdk/mir/gdkmireventsource.c
index c1b7feb..78ea4c3 100644
--- a/gdk/mir/gdkmireventsource.c
+++ b/gdk/mir/gdkmireventsource.c
@@ -472,6 +472,23 @@ generate_crossing_event (GdkWindow *window, GdkEventType type, gdouble x, gdoubl
   send_event (window, get_pointer (window), event);
 }
 
+static void
+generate_focus_event (GdkWindow *window, gboolean focused)
+{
+  GdkEvent *event;
+
+  if (focused)
+    gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FOCUSED);
+  else
+    gdk_synthesize_window_state (window, GDK_WINDOW_STATE_FOCUSED, 0);
+
+  event = gdk_event_new (GDK_FOCUS_CHANGE);
+  event->focus_change.send_event = FALSE;
+  event->focus_change.in = focused;
+
+  send_event (window, get_pointer (window), event);
+}
+
 static guint
 get_modifier_state (unsigned int modifiers, unsigned int button_state)
 {
@@ -603,10 +620,7 @@ handle_surface_event (GdkWindow *window, const MirSurfaceEvent *event)
     case mir_surface_attrib_swapinterval:
       break;
     case mir_surface_attrib_focus:
-      if (event->value)
-        gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FOCUSED);
-      else
-        gdk_synthesize_window_state (window, GDK_WINDOW_STATE_FOCUSED, 0);
+      generate_focus_event (window, event->value != 0);
       break;
     default:
       break;
diff --git a/gdk/mir/gdkmirscreen.c b/gdk/mir/gdkmirscreen.c
index 122918e..157405a 100644
--- a/gdk/mir/gdkmirscreen.c
+++ b/gdk/mir/gdkmirscreen.c
@@ -525,6 +525,24 @@ gdk_mir_screen_get_setting (GdkScreen   *screen,
       return TRUE;
     }
 
+  if (g_str_equal (name, "gtk-cursor-blink"))
+    {
+      g_value_set_boolean (value, TRUE);
+      return TRUE;
+    }
+
+  if (g_str_equal (name, "gtk-cursor-blink-time"))
+    {
+      g_value_set_int (value, 1200);
+      return TRUE;
+    }
+
+  if (g_str_equal (name, "gtk-cursor-blink-timeout"))
+    {
+      g_value_set_int (value, 10);
+      return TRUE;
+    }
+
   g_error ("unknown property %s", name);
 
   return FALSE;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]