LauncherIcon *click_launcher_icon(Panel *panel, int x, int y) { Launcher *launcher = click_launcher(panel, x, y); if (launcher) { for (GSList *l = launcher->list_icons; l; l = l->next) { LauncherIcon *icon = (LauncherIcon *)l->data; if (area_is_under_mouse(icon, x, y)) return icon; } } return NULL; }
LauncherIcon *click_launcher_icon (Panel *panel, int x, int y) { GSList *l0; Launcher *launcher; //printf("Click x=%d y=%d\n", x, y); if ( (launcher = click_launcher(panel, x, y)) ) { LauncherIcon *icon; for (l0 = launcher->list_icons; l0 ; l0 = l0->next) { icon = l0->data; if (x >= (launcher->area.posx + icon->x) && x <= (launcher->area.posx + icon->x + icon->icon_size) && y >= (launcher->area.posy + icon->y) && y <= (launcher->area.posy + icon->y + icon->icon_size)) { //printf("Hit rect x=%d y=%d xmax=%d ymax=%d\n", launcher->area.posx + icon->x, launcher->area.posy + icon->y, launcher->area.posx + icon->x + icon->width, launcher->area.posy + icon->y + icon->height); return icon; } } } return NULL; }
void event_button_release(XEvent* e) { Panel* panel = get_panel(e->xany.window); if (!panel) return; if (wm_menu && !tinto_handles_click(panel, &e->xbutton)) { forward_click(e); if (panel_layer == BOTTOM_LAYER) XLowerWindow(server.dsp, panel->main_win); task_drag = 0; return; } int action = TOGGLE_ICONIFY; switch (e->xbutton.button) { case 1: action = mouse_left; break; case 2: action = mouse_middle; break; case 3: action = mouse_right; break; case 4: action = mouse_scroll_up; break; case 5: action = mouse_scroll_down; break; case 6: action = mouse_tilt_left; break; case 7: action = mouse_tilt_right; break; } point_T point = {e->xbutton.x, e->xbutton.y}; if (click_clock(panel, point)) { clock_action(e->xbutton.button); if (panel_layer == BOTTOM_LAYER) XLowerWindow(server.dsp, panel->main_win); task_drag = 0; return; } point.x = e->xbutton.x; point.y = e->xbutton.y; if (click_launcher(panel, point)) { point.x = e->xbutton.x; point.y = e->xbutton.y; LauncherIcon* icon = click_launcher_icon(panel, point); if (icon) { launcher_action(icon, e); } task_drag = 0; return; } Taskbar* tskbar; if (!(tskbar = click_taskbar(panel, point))) { // TODO: check better solution to keep window below if (panel_layer == BOTTOM_LAYER) XLowerWindow(server.dsp, panel->main_win); task_drag = 0; return; } // drag and drop task if (task_dragged) { task_drag = 0; task_dragged = 0; return; } // switch desktop if (panel_mode == MULTI_DESKTOP) { if (tskbar->desktop != server.desktop && action != CLOSE && action != DESKTOP_LEFT && action != DESKTOP_RIGHT) set_desktop(tskbar->desktop); } // action on task // e->xbutton.x, e->xbutton.y window_action(click_task(panel, point), action); // to keep window below if (panel_layer == BOTTOM_LAYER) XLowerWindow(server.dsp, panel->main_win); }