Position tooltips correctly on first show git-svn-id: http://tint2.googlecode.com/svn/trunk@749 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
o9000 o9000
1 files changed,
8 insertions(+),
4 deletions(-)
jump to
M
src/tooltip/tooltip.c
→
src/tooltip/tooltip.c
@@ -28,6 +28,7 @@ #include "panel.h"
#include "timer.h" static int x, y, width, height; +static int just_shown; // the next functions are helper functions for tooltip handling void start_show_timeout();@@ -46,6 +47,7 @@ g_tooltip.font_color.color[0] = 1;
g_tooltip.font_color.color[1] = 1; g_tooltip.font_color.color[2] = 1; g_tooltip.font_color.alpha = 1; + just_shown = 0; } void cleanup_tooltip()@@ -86,8 +88,7 @@ {
// Position the tooltip in the center of the area x = area->posx + area->width / 2 + e->xmotion.x_root - e->xmotion.x; y = area->posy + area->height / 2 + e->xmotion.y_root - e->xmotion.y; - if (!panel_horizontal) - y -= height/2; + just_shown = 1; g_tooltip.panel = p; if (g_tooltip.mapped && g_tooltip.area != area) { tooltip_copy_text(area);@@ -106,8 +107,6 @@ int mx, my;
Window w; XTranslateCoordinates( server.dsp, server.root_win, g_tooltip.panel->main_win, x, y, &mx, &my, &w); Area* area; - if (!panel_horizontal) - my += height/2; /* we adjusted y in tooltip_trigger_show, revert or we won't find the correct area anymore */ area = click_area(g_tooltip.panel, mx, my); stop_tooltip_timeout(); if (!g_tooltip.mapped && area->_get_tooltip_text) {@@ -205,6 +204,11 @@ return;
} tooltip_update_geometry(); + if (just_shown) { + if (!panel_horizontal) + y -= height/2; // center vertically + just_shown = 0; + } tooltip_adjust_geometry(); XMoveResizeWindow(server.dsp, g_tooltip.window, x, y, width, height);