X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Ftint.c;h=fd89b8c468a528467ec22347a4913fee61c19894;hb=7a03bbf353324d6803aa84ca8fd41e6c6f4d099c;hp=8052aecc3bce02837e9ad74e0c330521284f67fa;hpb=da414049c77fcbe8346c1920ec668901de30b6bd;p=chaz%2Ftint2 diff --git a/src/tint.c b/src/tint.c index 8052aec..fd89b8c 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,7 +186,7 @@ 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); - refresh(&panel->area); + rendering(panel); Imlib_Image img = NULL; imlib_context_set_drawable(panel->temp_pmap); @@ -277,7 +281,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 +432,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 @@ -708,6 +729,7 @@ int main (int argc, char *argv[]) Panel *panel; GSList *it; struct timeval* timeout; + int hidden_dnd = 0; start: init (argc, argv); @@ -753,7 +775,7 @@ 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); - refresh(&panel->area); + rendering(panel); XCopyArea(server.dsp, panel->temp_pmap, panel->main_win, server.gc, 0, 0, panel->area.width, panel->area.height, 0, 0); } } @@ -791,11 +813,17 @@ start: else if (e.type == LeaveNotify) autohide_trigger_hide(panel); if (panel->is_hidden) { - if (e.type == ClientMessage && e.xclient.message_type == server.atom.XdndPosition) + if (e.type == ClientMessage && e.xclient.message_type == server.atom.XdndPosition) { + hidden_dnd = 1; autohide_show(panel); + } else continue; // discard further processing of this event because the panel is not visible yet } + else if (hidden_dnd && e.type == ClientMessage && e.xclient.message_type == server.atom.XdndLeave) { + hidden_dnd = 0; + autohide_hide(panel); + } } switch (e.type) { @@ -817,7 +845,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;