tooltip: Remove unnecessary checks

Coverity uses these as clues to complain.
This commit is contained in:
Matthias Clasen 2015-07-17 18:40:37 -04:00
parent 361915628d
commit 0ebcc56a77

View File

@ -1145,38 +1145,37 @@ gtk_tooltip_position (GtkTooltip *tooltip,
found: found:
/* Show it */ /* 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 (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)
{ {
if (x + width > monitor.x + monitor.width) /* don't pop up under the pointer */
x -= x - (monitor.x + monitor.width) + width; if (x <= tooltip->last_x && tooltip->last_x < x + width &&
else if (x < monitor.x) y <= tooltip->last_y && tooltip->last_y < y + height)
x = monitor.x; y = tooltip->last_y - height - 2;
}
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;
}
#ifdef GDK_WINDOWING_WAYLAND #ifdef GDK_WINDOWING_WAYLAND
/* set the transient parent on the tooltip when running with the Wayland /* set the transient parent on the tooltip when running with the Wayland
* backend to allow correct positioning of the tooltip windows */ * backend to allow correct positioning of the tooltip windows
if (GDK_IS_WAYLAND_DISPLAY (display)) */
{ if (GDK_IS_WAYLAND_DISPLAY (display))
GtkWidget *toplevel; {
GtkWidget *toplevel;
toplevel = gtk_widget_get_toplevel (tooltip->tooltip_widget); toplevel = gtk_widget_get_toplevel (tooltip->tooltip_widget);
if (GTK_IS_WINDOW (toplevel)) if (GTK_IS_WINDOW (toplevel))
gtk_window_set_transient_for (GTK_WINDOW (tooltip->current_window), gtk_window_set_transient_for (GTK_WINDOW (tooltip->current_window),
GTK_WINDOW (toplevel)); GTK_WINDOW (toplevel));
} }
#endif #endif
#ifdef GDK_WINDOWING_MIR #ifdef GDK_WINDOWING_MIR
/* Set the transient parent on the tooltip when running with the Mir /* Set the transient parent on the tooltip when running with the Mir
@ -1192,12 +1191,11 @@ found:
} }
#endif #endif
x -= border.left; x -= border.left;
y -= border.top; y -= border.top;
gtk_window_move (GTK_WINDOW (tooltip->current_window), x, y); gtk_window_move (GTK_WINDOW (tooltip->current_window), x, y);
gtk_widget_show (GTK_WIDGET (tooltip->current_window)); gtk_widget_show (GTK_WIDGET (tooltip->current_window));
}
} }
static void static void