if (!panel) return;
if (wm_menu) {
- if ((e->xbutton.x < panel->area.paddingxlr) || (e->xbutton.x > panel->area.width-panel->area.paddingxlr) || (e->xbutton.y < panel->area.paddingy) || (e->xbutton.y > panel->area.paddingy+panel->g_taskbar.height)) {
+ if ((panel_horizontal && (e->xbutton.x < panel->area.paddingxlr || e->xbutton.x > panel->area.width-panel->area.paddingxlr || e->xbutton.y < panel->area.paddingy || e->xbutton.y > panel->area.paddingy+panel->g_taskbar.height)) || (!panel_horizontal && (e->xbutton.y < panel->area.paddingxlr || e->xbutton.y > panel->area.height-panel->area.paddingxlr || e->xbutton.x < panel->area.paddingy || e->xbutton.x > panel->area.paddingy+panel->g_taskbar.width))) {
// forward the click to the desktop window (thanks conky)
XUngrabPointer(server.dsp, e->xbutton.time);
e->xbutton.window = server.root_win;
GSList *l0;
Taskbar *tskbar;
- int x = e->xbutton.x;
- for (l0 = panel->area.list; l0 ; l0 = l0->next) {
- tskbar = l0->data;
- if (!tskbar->area.on_screen) continue;
- if (x >= tskbar->area.posx && x <= (tskbar->area.posx + tskbar->area.width))
- break;
- }
-
- if (l0) {
- Task *tsk;
- for (l0 = tskbar->area.list; l0 ; l0 = l0->next) {
- tsk = l0->data;
- if (x >= tsk->area.posx && x <= (tsk->area.posx + tsk->area.width)) {
- task_drag = tsk;
- break;
- }
- }
- }
-
+ if (panel_horizontal) {
+ int x = e->xbutton.x;
+ for (l0 = panel->area.list; l0 ; l0 = l0->next) {
+ tskbar = l0->data;
+ if (!tskbar->area.on_screen) continue;
+ if (x >= tskbar->area.posx && x <= (tskbar->area.posx + tskbar->area.width))
+ break;
+ }
+ if (l0) {
+ Task *tsk;
+ for (l0 = tskbar->area.list; l0 ; l0 = l0->next) {
+ tsk = l0->data;
+ if (x >= tsk->area.posx && x <= (tsk->area.posx + tsk->area.width)) {
+ task_drag = tsk;
+ break;
+ }
+ }
+ }
+ }
+ else {
+ int y = e->xbutton.y;
+ for (l0 = panel->area.list; l0 ; l0 = l0->next) {
+ tskbar = l0->data;
+ if (!tskbar->area.on_screen) continue;
+ if (y >= tskbar->area.posy && y <= (tskbar->area.posy + tskbar->area.height))
+ break;
+ }
+ if (l0) {
+ Task *tsk;
+ for (l0 = tskbar->area.list; l0 ; l0 = l0->next) {
+ tsk = l0->data;
+ if (y >= tsk->area.posy && y <= (tsk->area.posy + tsk->area.height)) {
+ task_drag = tsk;
+ break;
+ }
+ }
+ }
+ }
XLowerWindow (server.dsp, panel->main_win);
}
if (!panel) return;
if (wm_menu) {
- if ((e->xbutton.x < panel->area.paddingxlr) || (e->xbutton.x > panel->area.width-panel->area.paddingxlr) || (e->xbutton.y < panel->area.paddingy) || (e->xbutton.y > panel->area.paddingy+panel->g_taskbar.height)) {
+ if ((panel_horizontal && (e->xbutton.x < panel->area.paddingxlr || e->xbutton.x > panel->area.width-panel->area.paddingxlr || e->xbutton.y < panel->area.paddingy || e->xbutton.y > panel->area.paddingy+panel->g_taskbar.height)) || (!panel_horizontal && (e->xbutton.y < panel->area.paddingxlr || e->xbutton.y > panel->area.height-panel->area.paddingxlr || e->xbutton.x < panel->area.paddingy || e->xbutton.x > panel->area.paddingy+panel->g_taskbar.width))) {
// forward the click to the desktop window (thanks conky)
e->xbutton.window = server.root_win;
XSendEvent(server.dsp, e->xbutton.window, False, ButtonReleaseMask, e);
int action = TOGGLE_ICONIFY;
int x = e->xbutton.x;
- //int y = e->xbutton.y; // unused
+ int y = e->xbutton.y;
switch (e->xbutton.button) {
case 2:
action = mouse_middle;
Taskbar *tskbar;
GSList *l0;
Clock clk = panel->clock;
- if (clk.area.on_screen && x >= clk.area.posx && x <= (clk.area.posx + clk.area.width))
- clock_action(e->xbutton.button);
+ if (panel_horizontal) {
+ if (clk.area.on_screen && x >= clk.area.posx && x <= (clk.area.posx + clk.area.width))
+ clock_action(e->xbutton.button);
+ else {
+ for (l0 = panel->area.list; l0 ; l0 = l0->next) {
+ tskbar = l0->data;
+ if (!tskbar->area.on_screen) continue;
+ if (x >= tskbar->area.posx && x <= (tskbar->area.posx + tskbar->area.width))
+ goto suite;
+ }
+ }
+ }
else {
- for (l0 = panel->area.list; l0 ; l0 = l0->next) {
- tskbar = l0->data;
- if (!tskbar->area.on_screen) continue;
- if (x >= tskbar->area.posx && x <= (tskbar->area.posx + tskbar->area.width))
- goto suite;
+ if (clk.area.on_screen && y >= clk.area.posy && y <= (clk.area.posy + clk.area.height))
+ clock_action(e->xbutton.button);
+ else {
+ for (l0 = panel->area.list; l0 ; l0 = l0->next) {
+ tskbar = l0->data;
+ if (!tskbar->area.on_screen) continue;
+ if (y >= tskbar->area.posy && y <= (tskbar->area.posy + tskbar->area.height))
+ goto suite;
+ }
}
}
GSList *l;
for (l = tskbar->area.list ; l ; l = l->next) {
tsk = l->data;
- if (x >= tsk->area.posx && x <= (tsk->area.posx + tsk->area.width)) {
- window_action (tsk, action);
- break;
- }
+ if (panel_horizontal) {
+ if (x >= tsk->area.posx && x <= (tsk->area.posx + tsk->area.width)) {
+ window_action (tsk, action);
+ break;
+ }
+ }
+ else {
+ if (y >= tsk->area.posy && y <= (tsk->area.posy + tsk->area.height)) {
+ window_action (tsk, action);
+ break;
+ }
+ }
}
// to keep window below
for (i=0 ; i < nb_panel ; i++) {
set_panel_background(&panel1[i]);
}
- refresh_systray();
panel_refresh = 1;
}
}
else if (at == server.atom._NET_WM_STATE) {
if (window_is_urgent (win)) {
task_urgent = tsk;
+ tick_urgent = 0;
time_precision = 1;
}
}
// urgent task
if (task_urgent) {
- task_urgent->area.is_active = !task_urgent->area.is_active;
- task_urgent->area.redraw = 1;
+ if (tick_urgent < max_tick_urgent) {
+ task_urgent->area.is_active = !task_urgent->area.is_active;
+ task_urgent->area.redraw = 1;
+ tick_urgent++;
+ }
}
// update battery
Panel *panel;
GSList *it;
- c = getopt (argc, argv, "c:");
init ();
load_config:
i = 0;
+ c = getopt (argc, argv, "c:");
init_config();
- if (c != -1)
+ if (c != -1) {
i = config_read_file (optarg);
+ c = getopt (argc, argv, "j:");
+ if (c != -1) {
+ // usage: tint2 [-c] <config_file> -j <jpeg_file> for internal use
+ printf("jpeg file %s\n", optarg);
+ cleanup();
+ exit(0);
+ }
+ }
if (!i)
i = config_read ();
if (!i) {
switch (signal_pending) {
case SIGUSR1:
+ signal_pending = 0;
goto load_config;
case SIGINT:
case SIGTERM:
if (panel_refresh) {
panel_refresh = 0;
+ if (refresh_systray) {
+ panel = (Panel*)systray.area.panel;
+ XSetWindowBackgroundPixmap (server.dsp, panel->main_win, None);
+ }
for (i=0 ; i < nb_panel ; i++) {
panel = &panel1[i];
XCopyArea(server.dsp, panel->temp_pmap, panel->main_win, server.gc, 0, 0, panel->area.width, panel->area.height, 0, 0);
}
XFlush (server.dsp);
+
+ if (refresh_systray) {
+ refresh_systray = 0;
+ panel = (Panel*)systray.area.panel;
+ // tint2 doen't draw systray icons. it just redraw background.
+ XSetWindowBackgroundPixmap (server.dsp, panel->main_win, panel->temp_pmap);
+ // force icon's refresh
+ refresh_systray_icon();
+ }
}
}
}