X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Ftint2;a=blobdiff_plain;f=src%2Ftint.c;h=2ba8727d05297a8b5188db4e1dcb812773f27e2a;hp=8316bdde59a56f8a0fb841731f72391b2fce2d00;hb=928fc258ac46f2cc098f714921c028351b07ec31;hpb=57dab661b3f5b1c318f782cdc00c5e534dfe58d9 diff --git a/src/tint.c b/src/tint.c index 8316bdd..2ba8727 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 @@ -469,10 +490,11 @@ void event_property_notify (XEvent *e) server.nb_desktop = server_get_number_of_desktop (); cleanup_taskbar(); init_taskbar(); - visible_object(); for (i=0 ; i < nb_panel ; i++) { + set_panel_items(&panel1[i]); panel1[i].area.resize = 1; } + visible_object(); task_refresh_tasklist(); active_task(); panel_refresh = 1; @@ -754,7 +776,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); } } @@ -824,7 +846,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; @@ -862,7 +884,7 @@ start: signal_pending = SIGUSR1; break; } - if (e.xany.window == g_tooltip.window || !systray.area.on_screen) + if (e.xany.window == g_tooltip.window || !systray_enabled) break; for (it = systray.list_icons; it; it = g_slist_next(it)) { if (((TrayWindow*)it->data)->tray_id == e.xany.window) { @@ -882,7 +904,7 @@ start: // Start real_transparency signal_pending = SIGUSR1; } - if (systray.area.on_screen && e.xclient.message_type == server.atom._NET_SYSTEM_TRAY_OPCODE && e.xclient.format == 32 && e.xclient.window == net_sel_win) { + if (systray_enabled && e.xclient.message_type == server.atom._NET_SYSTEM_TRAY_OPCODE && e.xclient.format == 32 && e.xclient.window == net_sel_win) { net_message(&e.xclient); } else if (e.xclient.message_type == server.atom.XdndPosition) {