-*/
- if (panel_mode == MULTI_DESKTOP)
- task_drag = click_task(panel, e);
-
- if (wm_menu && !task_drag && !click_clock(panel, e) && (e->xbutton.button != 1) ) {
- // forward the click to the desktop window (thanks conky)
- XUngrabPointer(server.dsp, e->xbutton.time);
- e->xbutton.window = server.root_win;
- // icewm doesn't open under the mouse.
- // and xfce doesn't open at all.
- //e->xbutton.x = e->xbutton.x_root;
- //e->xbutton.y = e->xbutton.y_root;
- //printf("**** %d, %d\n", e->xbutton.x, e->xbutton.y);
- XSetInputFocus(server.dsp, e->xbutton.window, RevertToParent, e->xbutton.time);
- XSendEvent(server.dsp, e->xbutton.window, False, ButtonPressMask, e);
- return;
- }
-/*
- if (e->xbutton.button != 1) return;
- GSList *l0;
- Taskbar *tskbar;
- 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;
- }
- }
- }
+ // no task clicked --> check if taskbar clicked
+ Taskbar *tskbar = click_taskbar(panel, e->x, e->y);
+ if (tskbar && e->button == 1 && panel_mode == MULTI_DESKTOP)
+ return 1;
+ if (click_clock(panel, e->x, e->y)) {
+ if ( (e->button == 1 && clock_lclick_command) || (e->button == 2 && clock_rclick_command) )
+ return 1;
+ else
+ return 0;