X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Ftint.c;h=0352aa891d9064545a087347c94635943eab7aee;hb=a72ae04bf96477f11d8bf24baea54596f6d3356b;hp=8316bdde59a56f8a0fb841731f72391b2fce2d00;hpb=57dab661b3f5b1c318f782cdc00c5e534dfe58d9;p=chaz%2Ftint2 diff --git a/src/tint.c b/src/tint.c index 8316bdd..0352aa8 100644 --- a/src/tint.c +++ b/src/tint.c @@ -38,6 +38,7 @@ #include "task.h" #include "taskbar.h" #include "systraybar.h" +#include "launcher.h" #include "panel.h" #include "tooltip.h" #include "timer.h" @@ -63,6 +64,7 @@ void init (int argc, char *argv[]) default_battery(); #endif default_clock(); + default_launcher(); default_taskbar(); default_tooltip(); default_panel(); @@ -91,11 +93,12 @@ void init (int argc, char *argv[]) // Set signal handler signal_pending = 0; struct sigaction sa = { .sa_handler = signal_handler }; + struct sigaction sa_chld = { .sa_handler = SIG_DFL, .sa_flags = SA_NOCLDWAIT }; sigaction(SIGUSR1, &sa, 0); sigaction(SIGINT, &sa, 0); sigaction(SIGTERM, &sa, 0); sigaction(SIGHUP, &sa, 0); -// signal(SIGCHLD, SIG_IGN); // don't have to wait() after fork() + sigaction(SIGCHLD, &sa_chld, 0); // BSD does not support pselect(), therefore we have to use select and hope that we do not // end up in a race condition there (see 'man select()' on a linux machine for more information) @@ -155,12 +158,13 @@ void cleanup() { cleanup_timeout(); cleanup_systray(); - cleanup_panel(); cleanup_tooltip(); cleanup_clock(); + cleanup_launcher(); #ifdef ENABLE_BATTERY cleanup_battery(); #endif + cleanup_panel(); cleanup_config(); if (default_icon) { @@ -182,6 +186,8 @@ void get_snapshot(const char *path) panel->area.width = server.monitor[0].width; panel->temp_pmap = XCreatePixmap(server.dsp, server.root_win, panel->area.width, panel->area.height, server.depth); + size_by_content(&panel->area); + size_by_layout(&panel->area); refresh(&panel->area); Imlib_Image img = NULL; @@ -277,7 +283,15 @@ int tint2_handles_click(Panel* panel, XButtonEvent* e) else return 0; } - // no task clicked --> check if taskbar clicked + LauncherIcon *icon = click_launcher_icon(panel, e->x, e->y); + if (icon) { + if (e->button == 1) { + return 1; + } else { + return 0; + } + } + // no launcher/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; @@ -420,6 +434,15 @@ void event_button_release (XEvent *e) return; } + if ( click_launcher(panel, e->xbutton.x, e->xbutton.y)) { + LauncherIcon *icon = click_launcher_icon(panel, e->xbutton.x, e->xbutton.y); + if (icon) { + launcher_action(icon); + } + task_drag = 0; + return; + } + Taskbar *tskbar; if ( !(tskbar = click_taskbar(panel, e->xbutton.x, e->xbutton.y)) ) { // TODO: check better solution to keep window below @@ -754,6 +777,8 @@ start: else { if (panel->temp_pmap) XFreePixmap(server.dsp, panel->temp_pmap); panel->temp_pmap = XCreatePixmap(server.dsp, server.root_win, panel->area.width, panel->area.height, server.depth); + size_by_content(&panel->area); + size_by_layout(&panel->area); refresh(&panel->area); XCopyArea(server.dsp, panel->temp_pmap, panel->main_win, server.gc, 0, 0, panel->area.width, panel->area.height, 0, 0); } @@ -824,7 +849,7 @@ start: Panel* panel = get_panel(e.xmotion.window); 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); + tooltip_trigger_show(area, panel, &e); else tooltip_trigger_hide(); break;