[gtk+] tooltip: Remove unnecessary checks



commit 0ebcc56a77230984597986a58839f4df1babbd53
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jul 17 18:40:37 2015 -0400

    tooltip: Remove unnecessary checks
    
    Coverity uses these as clues to complain.

 gtk/gtktooltip.c |   62 ++++++++++++++++++++++++++---------------------------
 1 files changed, 30 insertions(+), 32 deletions(-)
---
diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c
index fd2ba14..a5e4f55 100644
--- a/gtk/gtktooltip.c
+++ b/gtk/gtktooltip.c
@@ -1145,38 +1145,37 @@ gtk_tooltip_position (GtkTooltip *tooltip,
 
 found:
   /* Show it */
-  if (tooltip->current_window)
-    {
-      if (x + width > monitor.x + monitor.width)
-        x -= x - (monitor.x + monitor.width) + width;
-      else if (x < monitor.x)
-        x = monitor.x;
+  if (x + width > monitor.x + monitor.width)
+    x -= x - (monitor.x + monitor.width) + width;
+  else if (x < monitor.x)
+    x = monitor.x;
 
-      if (y + height > monitor.y + monitor.height)
-        y -= y - (monitor.y + monitor.height) + height;
-      else if (y < monitor.y)
-        y = monitor.y;
+  if (y + height > monitor.y + monitor.height)
+    y -= y - (monitor.y + monitor.height) + height;
+  else if (y < monitor.y)
+    y = monitor.y;
 
-      if (!tooltip->keyboard_mode_enabled)
-        {
-          /* don't pop up under the pointer */
-          if (x <= tooltip->last_x && tooltip->last_x < x + width &&
-              y <= tooltip->last_y && tooltip->last_y < y + height)
-            y = tooltip->last_y - height - 2;
-        }
+  if (!tooltip->keyboard_mode_enabled)
+    {
+      /* don't pop up under the pointer */
+      if (x <= tooltip->last_x && tooltip->last_x < x + width &&
+          y <= tooltip->last_y && tooltip->last_y < y + height)
+        y = tooltip->last_y - height - 2;
+    }
 
 #ifdef GDK_WINDOWING_WAYLAND
-      /* set the transient parent on the tooltip when running with the Wayland
-       * backend to allow correct positioning of the tooltip windows */
-      if (GDK_IS_WAYLAND_DISPLAY (display))
-        {
-          GtkWidget *toplevel;
+  /* set the transient parent on the tooltip when running with the Wayland
+   * backend to allow correct positioning of the tooltip windows
+   */
+  if (GDK_IS_WAYLAND_DISPLAY (display))
+    {
+      GtkWidget *toplevel;
 
-          toplevel = gtk_widget_get_toplevel (tooltip->tooltip_widget);
-          if (GTK_IS_WINDOW (toplevel))
-            gtk_window_set_transient_for (GTK_WINDOW (tooltip->current_window),
-                                          GTK_WINDOW (toplevel));
-        }
+      toplevel = gtk_widget_get_toplevel (tooltip->tooltip_widget);
+      if (GTK_IS_WINDOW (toplevel))
+        gtk_window_set_transient_for (GTK_WINDOW (tooltip->current_window),
+                                      GTK_WINDOW (toplevel));
+    }
 #endif
 #ifdef GDK_WINDOWING_MIR
       /* Set the transient parent on the tooltip when running with the Mir
@@ -1192,12 +1191,11 @@ found:
         }
 #endif
 
-      x -= border.left;
-      y -= border.top;
+  x -= border.left;
+  y -= border.top;
 
-      gtk_window_move (GTK_WINDOW (tooltip->current_window), x, y);
-      gtk_widget_show (GTK_WIDGET (tooltip->current_window));
-    }
+  gtk_window_move (GTK_WINDOW (tooltip->current_window), x, y);
+  gtk_widget_show (GTK_WIDGET (tooltip->current_window));
 }
 
 static void


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