[gtk/wip/baedert/for-master: 45/54] snapshot: Refactor some device code




commit 36f0b7f38d680f8146099b6e6124f2e2e271026b
Author: Timm Bäder <mail baedert org>
Date:   Sun Oct 11 11:55:04 2020 +0200

    snapshot: Refactor some device code
    
    Make a bit clearer what this does.

 gtk/gtkstylecontext.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 4150df3ae7..708e61f9fb 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -1141,7 +1141,6 @@ gtk_snapshot_render_insertion_cursor (GtkSnapshot     *snapshot,
   PangoRectangle strong_pos, weak_pos;
   PangoRectangle *cursor1, *cursor2;
   GdkSeat *seat;
-  GdkDevice *keyboard;
   PangoDirection keyboard_direction;
   PangoDirection direction2;
 
@@ -1155,15 +1154,15 @@ gtk_snapshot_render_insertion_cursor (GtkSnapshot     *snapshot,
                 "gtk-cursor-aspect-ratio", &aspect_ratio,
                 NULL);
 
+  keyboard_direction = PANGO_DIRECTION_LTR;
   seat = gdk_display_get_default_seat (priv->display);
   if (seat)
-    keyboard = gdk_seat_get_keyboard (seat);
-  else
-    keyboard = NULL;
-  if (keyboard)
-    keyboard_direction = gdk_device_get_direction (keyboard);
-  else
-    keyboard_direction = PANGO_DIRECTION_LTR;
+    {
+      GdkDevice *keyboard = gdk_seat_get_keyboard (seat);
+
+      if (keyboard)
+        keyboard_direction = gdk_device_get_direction (keyboard);
+    }
 
   pango_layout_get_cursor_pos (layout, index, &strong_pos, &weak_pos);
 


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