*change* make tooltip more generous, and preparation for setting a tooltip on the clock
git-svn-id: http://tint2.googlecode.com/svn/trunk@271 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
88
src/tint.c
88
src/tint.c
@@ -178,86 +178,6 @@ void get_snapshot(const char *path)
|
||||
}
|
||||
|
||||
|
||||
Taskbar *click_taskbar (Panel *panel, int x, int y)
|
||||
{
|
||||
Taskbar *tskbar;
|
||||
int i;
|
||||
|
||||
if (panel_horizontal) {
|
||||
for (i=0; i < panel->nb_desktop ; i++) {
|
||||
tskbar = &panel->taskbar[i];
|
||||
if (tskbar->area.on_screen && x >= tskbar->area.posx && x <= (tskbar->area.posx + tskbar->area.width))
|
||||
return tskbar;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (i=0; i < panel->nb_desktop ; i++) {
|
||||
tskbar = &panel->taskbar[i];
|
||||
if (tskbar->area.on_screen && y >= tskbar->area.posy && y <= (tskbar->area.posy + tskbar->area.height))
|
||||
return tskbar;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Task *click_task (Panel *panel, int x, int y)
|
||||
{
|
||||
GSList *l0;
|
||||
Taskbar *tskbar;
|
||||
|
||||
if ( (tskbar = click_taskbar(panel, x, y)) ) {
|
||||
if (panel_horizontal) {
|
||||
Task *tsk;
|
||||
for (l0 = tskbar->area.list; l0 ; l0 = l0->next) {
|
||||
tsk = l0->data;
|
||||
if (tsk->area.on_screen && x >= tsk->area.posx && x <= (tsk->area.posx + tsk->area.width)) {
|
||||
return tsk;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
Task *tsk;
|
||||
for (l0 = tskbar->area.list; l0 ; l0 = l0->next) {
|
||||
tsk = l0->data;
|
||||
if (tsk->area.on_screen && y >= tsk->area.posy && y <= (tsk->area.posy + tsk->area.height)) {
|
||||
return tsk;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
int click_padding(Panel *panel, int x, int y)
|
||||
{
|
||||
if (panel_horizontal) {
|
||||
if (x < panel->area.paddingxlr || x > panel->area.width-panel->area.paddingxlr)
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
if (y < panel->area.paddingxlr || y > panel->area.height-panel->area.paddingxlr)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int click_clock(Panel *panel, int x, int y)
|
||||
{
|
||||
Clock clk = panel->clock;
|
||||
if (panel_horizontal) {
|
||||
if (clk.area.on_screen && x >= clk.area.posx && x <= (clk.area.posx + clk.area.width))
|
||||
return TRUE;
|
||||
} else {
|
||||
if (clk.area.on_screen && y >= clk.area.posy && y <= (clk.area.posy + clk.area.height))
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
void window_action (Task *tsk, int action)
|
||||
{
|
||||
if (!tsk) return;
|
||||
@@ -789,9 +709,10 @@ int main (int argc, char *argv[])
|
||||
case MotionNotify: {
|
||||
if (!g_tooltip.enabled) break;
|
||||
Panel* panel = get_panel(e.xmotion.window);
|
||||
Task* task = click_task(panel, e.xmotion.x, e.xmotion.y);
|
||||
if (task)
|
||||
tooltip_trigger_show(task, e.xmotion.x_root, e.xmotion.y_root);
|
||||
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);
|
||||
}
|
||||
else
|
||||
tooltip_trigger_hide();
|
||||
break;
|
||||
@@ -810,7 +731,6 @@ int main (int argc, char *argv[])
|
||||
tooltip_update();
|
||||
break;
|
||||
|
||||
|
||||
case PropertyNotify:
|
||||
event_property_notify(&e);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user