[gtk+] Fix gcc warning on potentially uninitialized gdk_event.



commit bc4df6d4b300dea4ad7e66d5ea000b2e322e22be
Author: Andreas Pokorny <andreas pokorny canonical com>
Date:   Tue Jun 28 16:35:36 2016 +0200

    Fix gcc warning on potentially uninitialized gdk_event.

 gdk/mir/gdkmireventsource.c |   19 +++++++------------
 1 files changed, 7 insertions(+), 12 deletions(-)
---
diff --git a/gdk/mir/gdkmireventsource.c b/gdk/mir/gdkmireventsource.c
index b829c8f..ce6af0a 100644
--- a/gdk/mir/gdkmireventsource.c
+++ b/gdk/mir/gdkmireventsource.c
@@ -325,18 +325,13 @@ handle_touch_event (GdkWindow           *window,
 
   for (i = 0; i < n; i++)
     {
-      switch (mir_touch_event_action (mir_touch_event, i))
-        {
-        case mir_touch_action_up:
-          gdk_event = gdk_event_new (GDK_TOUCH_END);
-          break;
-        case mir_touch_action_down:
-          gdk_event = gdk_event_new (GDK_TOUCH_BEGIN);
-          break;
-        case mir_touch_action_change:
-          gdk_event = gdk_event_new (GDK_TOUCH_UPDATE);
-          break;
-        }
+      MirTouchAction action = mir_touch_event_action (mir_touch_event, i);
+      if (action == mir_touch_action_up)
+        gdk_event = gdk_event_new (GDK_TOUCH_END);
+      else if (action == mir_touch_action_down)
+        gdk_event = gdk_event_new (GDK_TOUCH_BEGIN);
+      else
+        gdk_event = gdk_event_new (GDK_TOUCH_UPDATE);
 
       gdk_event->touch.window = window;
       gdk_event->touch.sequence = GINT_TO_POINTER (mir_touch_event_id (mir_touch_event, i));


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