Center the tooltip correctly when the text changes while the tooltip is visible
git-svn-id: http://tint2.googlecode.com/svn/trunk@541 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
parent
c1bdb560b2
commit
95b35aefc0
1 changed files with 6 additions and 3 deletions
|
@ -27,7 +27,7 @@
|
||||||
#include "panel.h"
|
#include "panel.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
|
|
||||||
static int x, y, width, height;
|
static int x_original, y_original, x, y, width, height;
|
||||||
|
|
||||||
// the next functions are helper functions for tooltip handling
|
// the next functions are helper functions for tooltip handling
|
||||||
void start_show_timeout();
|
void start_show_timeout();
|
||||||
|
@ -78,8 +78,8 @@ void init_tooltip()
|
||||||
void tooltip_trigger_show(Area* area, Panel* p, XEvent *e)
|
void tooltip_trigger_show(Area* area, Panel* p, XEvent *e)
|
||||||
{
|
{
|
||||||
// Position the tooltip in the center of the area
|
// Position the tooltip in the center of the area
|
||||||
x = area->posx + area->width / 2 + e->xmotion.x_root - e->xmotion.x;
|
x = x_original = 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;
|
y = y_original = area->posy + area->height / 2 + e->xmotion.y_root - e->xmotion.y;
|
||||||
g_tooltip.panel = p;
|
g_tooltip.panel = p;
|
||||||
if (g_tooltip.mapped && g_tooltip.area != area) {
|
if (g_tooltip.mapped && g_tooltip.area != area) {
|
||||||
tooltip_copy_text(area);
|
tooltip_copy_text(area);
|
||||||
|
@ -124,6 +124,9 @@ void tooltip_update_geometry()
|
||||||
width = 2*g_tooltip.bg->border.width + 2*g_tooltip.paddingx + r2.width;
|
width = 2*g_tooltip.bg->border.width + 2*g_tooltip.paddingx + r2.width;
|
||||||
height = 2*g_tooltip.bg->border.width + 2*g_tooltip.paddingy + r2.height;
|
height = 2*g_tooltip.bg->border.width + 2*g_tooltip.paddingy + r2.height;
|
||||||
|
|
||||||
|
x = x_original;
|
||||||
|
y = y_original;
|
||||||
|
|
||||||
Panel* panel = g_tooltip.panel;
|
Panel* panel = g_tooltip.panel;
|
||||||
if (panel_horizontal && panel_position & BOTTOM)
|
if (panel_horizontal && panel_position & BOTTOM)
|
||||||
y = panel->posy-height;
|
y = panel->posy-height;
|
||||||
|
|
Loading…
Reference in a new issue