]> Dogcows Code - chaz/tint2/blobdiff - src/tint.c
added basic launcher by mrovi
[chaz/tint2] / src / tint.c
index 4f5c67372f18132a3f27b4f7c51e33001176888b..67cb81ca20ddbd5eea0bee9f9c461b6391ad4eb1 100644 (file)
@@ -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();
@@ -159,6 +161,7 @@ void cleanup()
        cleanup_panel();
        cleanup_tooltip();
        cleanup_clock();
+       cleanup_launcher();
 #ifdef ENABLE_BATTERY
        cleanup_battery();
 #endif
@@ -278,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;
@@ -421,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
This page took 0.021593 seconds and 4 git commands to generate.