#include "taskbar.h"
#include "systraybar.h"
#include "panel.h"
+#include "tooltip.h"
void signal_handler(int sig)
signal(SIGTERM, signal_handler);
signal(SIGHUP, signal_handler);
signal(SIGCHLD, SIG_IGN); // don't have to wait() after fork()
+ signal(SIGALRM, tooltip_sighandler);
// set global data
memset(&server, 0, sizeof(Server_global));
Taskbar *click_taskbar (Panel *panel, int x, int y)
{
- GSList *l0;
- Taskbar *tskbar = NULL;
+ Taskbar *tskbar;
+ int i;
+
if (panel_horizontal) {
- for (l0 = panel->area.list; l0 ; l0 = l0->next) {
- tskbar = l0->data;
+ for (i=0; i < panel->nb_desktop ; i++) {
+ tskbar = &panel->taskbar[i];
if (!tskbar->area.on_screen) continue;
if (x >= tskbar->area.posx && x <= (tskbar->area.posx + tskbar->area.width))
- break;
+ return tskbar;
}
}
else {
- for (l0 = panel->area.list; l0 ; l0 = l0->next) {
- tskbar = l0->data;
+ for (i=0; i < panel->nb_desktop ; i++) {
+ tskbar = &panel->taskbar[i];
if (!tskbar->area.on_screen) continue;
if (y >= tskbar->area.posy && y <= (tskbar->area.posy + tskbar->area.height))
- break;
+ return tskbar;
}
}
- return tskbar;
+ return NULL;
}
if (tsk->win == tsk2->win && tsk != tsk2) {
tsk2->icon_width = tsk->icon_width;
tsk2->icon_height = tsk->icon_height;
- tsk2->icon_data = tsk->icon_data;
- tsk2->icon_data_active = tsk->icon_data_active;
+ tsk2->icon = tsk->icon;
+ tsk2->icon_active = tsk->icon_active;
tsk2->area.redraw = 1;
}
}
panel_refresh = 1;
}
}
+ else if (at == server.atom.WM_HINTS) {
+ XWMHints* wmhints = XGetWMHints(server.dsp, win);
+ if (wmhints && wmhints->flags & XUrgencyHint) {
+ task_urgent = tsk;
+ tick_urgent = 0;
+ time_precision = 1;
+ }
+ XFree(wmhints);
+ }
if (!server.got_root_win) server.root_win = RootWindow (server.dsp, server.screen);
}
void event_expose (XEvent *e)
{
- Panel *panel;
-
- panel = get_panel(e->xany.window);
- if (!panel) return;
- // TODO : one panel_refresh per panel ?
- panel_refresh = 1;
+ if (e->xany.window == g_tooltip.window)
+ tooltip_update();
+ else {
+ Panel *panel;
+ panel = get_panel(e->xany.window);
+ if (!panel) return;
+ // TODO : one panel_refresh per panel ?
+ panel_refresh = 1;
+ }
}
GSList *it;
init (argc, argv);
-
load_config:
i = 0;
init_config();
switch (e.type) {
case ButtonPress:
+ tooltip_hide();
event_button_press (&e);
break;
event_button_release(&e);
break;
+ case MotionNotify: {
+ 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);
+ else
+ tooltip_trigger_hide();
+ break;
+ }
+
+ case LeaveNotify:
+ tooltip_trigger_hide();
+ break;
+
case Expose:
event_expose(&e);
break;