all repos — tint2 @ c9ca6a400677f5f2ec8f3d3a9263bc702bf07845

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

adjust tooltip position (mrovi)

git-svn-id: http://tint2.googlecode.com/svn/trunk@524 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
thilor77 thilor77@121b4492-b84c-0410-8b4c-0d4edfb3f3cc
commit

c9ca6a400677f5f2ec8f3d3a9263bc702bf07845

parent

7a2004c979618eae2c527fc654977b3f4030128e

6 files changed, 43 insertions(+), 23 deletions(-)

jump to
M src/panel.csrc/panel.c

@@ -303,6 +303,7 @@

void resize_panel(void *obj) { Panel *panel = (Panel*)obj; +//printf("resize_panel : taskbar\n"); if (panel_horizontal) { int taskbar_width, modulo_width = 0;
M src/tint.csrc/tint.c

@@ -845,7 +845,7 @@ if (!g_tooltip.enabled) break;

Panel* panel = get_panel(e.xmotion.window); Area* area = click_area(panel, e.xmotion.x, e.xmotion.y); if (area->_get_tooltip_text) - tooltip_trigger_show(area, panel, e.xmotion.x_root, e.xmotion.y_root); + tooltip_trigger_show(area, panel, &e); else tooltip_trigger_hide(); break;
M src/tooltip/tooltip.csrc/tooltip/tooltip.c

@@ -75,10 +75,11 @@ g_tooltip.window = XCreateWindow(server.dsp, server.root_win, 0, 0, 100, 20, 0, server.depth, InputOutput, server.visual, mask, &attr);

} -void tooltip_trigger_show(Area* area, Panel* p, int x_root, int y_root) +void tooltip_trigger_show(Area* area, Panel* p, XEvent *e) { - x = x_root; - y = y_root; + // 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; g_tooltip.panel = p; if (g_tooltip.mapped && g_tooltip.area != area) { tooltip_copy_text(area);

@@ -93,10 +94,10 @@

void tooltip_show(void* arg) { - int mx, my; - Window w; - XTranslateCoordinates( server.dsp, server.root_win, g_tooltip.panel->main_win, x, y, &mx, &my, &w); - Area* area = click_area(g_tooltip.panel, mx, my); + int mx, my; + Window w; + XTranslateCoordinates( server.dsp, server.root_win, g_tooltip.panel->main_win, x, y, &mx, &my, &w); + Area* area = click_area(g_tooltip.panel, mx, my); stop_tooltip_timeout(); if (!g_tooltip.mapped && area->_get_tooltip_text) { tooltip_copy_text(area);
M src/tooltip/tooltip.hsrc/tooltip/tooltip.h

@@ -50,7 +50,7 @@ // freed memory

void cleanup_tooltip(); void init_tooltip(); -void tooltip_trigger_show(Area* area, Panel* p, int x, int y); +void tooltip_trigger_show(Area* area, Panel* p, XEvent *e); void tooltip_show(void* /*arg*/); void tooltip_update(); void tooltip_trigger_hide();
M src/util/area.csrc/util/area.c

@@ -31,10 +31,21 @@ #include "server.h"

#include "panel.h" -// 1) resize child -// 2) resize parent -// 3) redraw parent -// 4) redraw child +/* +// TODO : layering & drawing loop +1) browse tree and calculate 'size' for SIZE_BY_CONTENT + - SIZE_BY_CONTENT loop calculate child first + - if 'size' changed then 'resize = 1' on the parent (tester resize aprés la boucle) + - size == width on horizontal panel and == height on vertical panel +2) browse tree and calculate 'size' for SIZE_BY_LAYOUT + - SIZE_BY_LAYOUT loop calculate parent first + - if 'size' changed then 'resize = 1' on childs with SIZE_BY_LAYOUT + - calculate width = size - somme(child_with_of_SIZE_BY_CONTENT) modulo(number of child_SIZE_BY_LAYOUT) + - calculate modulo = +3) calculate posx of all objects +4) redraw needed objects +*/ + void refresh (Area *a) { // don't draw and resize hide objects

@@ -137,9 +148,9 @@ // draw border inside (x, y, width, height)

draw_rect(c, a->bg->border.width/2.0, a->bg->border.width/2.0, a->width - a->bg->border.width, a->height - a->bg->border.width, a->bg->border.rounded); /* // convert : radian = degre * M_PI/180 - // définir le dégradé dans un carré de (0,0) (100,100) - // ensuite ce dégradé est extrapolé selon le ratio width/height - // dans repère (0, 0) (100, 100) + // définir le dégradé dans un carré de (0,0) (100,100) + // ensuite ce dégradé est extrapolé selon le ratio width/height + // dans repère (0, 0) (100, 100) double X0, Y0, X1, Y1, degre; // x = X * (a->width / 100), y = Y * (a->height / 100) double x0, y0, x1, y1;

@@ -148,13 +159,13 @@ Y0 = 100;

X1 = 100; Y1 = 0; degre = 45; - // et ensuite faire la changement d'unité du repère - // car ce qui doit resté inchangée est les traits et pas la direction + // et ensuite faire la changement d'unité du repère + // car ce qui doit resté inchangée est les traits et pas la direction - // il faut d'abord appliquer une rotation de 90° (et -180° si l'angle est supérieur à 180°) - // ceci peut être appliqué une fois pour toute au départ - // ensuite calculer l'angle dans le nouveau repère - // puis faire une rotation de 90° + // il faut d'abord appliquer une rotation de 90° (et -180° si l'angle est supérieur à 180°) + // ceci peut être appliqué une fois pour toute au départ + // ensuite calculer l'angle dans le nouveau repère + // puis faire une rotation de 90° x0 = X0 * ((double)a->width / 100); x1 = X1 * ((double)a->width / 100); y0 = Y0 * ((double)a->height / 100);
M src/util/area.hsrc/util/area.h

@@ -47,6 +47,10 @@ Border border;

} Background; +// way to calculate the size +// SIZE_BY_LAYOUT objects : taskbar and task +// SIZE_BY_CONTENT objects : clock, battery, launcher, systray +enum { SIZE_BY_LAYOUT, SIZE_BY_CONTENT }; typedef struct { // coordinate relative to panel window

@@ -59,8 +63,11 @@

// list of child : Area object GSList *list; + // object visible on screen int on_screen; - // need compute position and width + // way to calculate the size (SIZE_BY_CONTENT or SIZE_BY_LAYOUT) + int size_mode; + // need to calculate position and width int resize; // need redraw Pixmap int redraw;