all repos — tint2 @ 26ab02d533483b9bf1a8ad9623ebacd445d86359

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

clock command on rigt/left click by dmitry.medvinsky

git-svn-id: http://tint2.googlecode.com/svn/trunk@84 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
lorthiois@bbsoft.fr lorthiois@bbsoft.fr@121b4492-b84c-0410-8b4c-0d4edfb3f3cc
commit

26ab02d533483b9bf1a8ad9623ebacd445d86359

parent

fa749b70265a6f3f011640e671737be97831d5d3

7 files changed, 60 insertions(+), 9 deletions(-)

jump to
M ChangeLogChangeLog

@@ -1,3 +1,6 @@

+2009-06-04 +- patch by dmitry.medvinsky : right/left clic command + 2009-06-02 - Systray Temp_Fix from keshto not yet perfect, but a first step
M src/clock/clock.csrc/clock/clock.c

@@ -22,6 +22,7 @@ #include <stdio.h>

#include <cairo.h> #include <cairo-xlib.h> #include <pango/pangocairo.h> +#include <unistd.h> #include "window.h" #include "server.h"

@@ -31,8 +32,10 @@ #include "area.h"

#include "clock.h" -char *time1_format = 0; -char *time2_format = 0; +char *time1_format; +char *time2_format; +char *clock_lclick_command; +char *clock_rclick_command; struct timeval time_clock; int time_precision; PangoFontDescription *time1_font_desc;

@@ -189,3 +192,25 @@ cairo_surface_destroy (cs);

XFreePixmap (server.dsp, pmap); } + +void clock_action(int button) +{ + char *command = 0; + switch (button) { + case 1: + command = clock_lclick_command; + break; + case 3: + command = clock_rclick_command; + break; + } + if (command) { + pid_t pid; + pid = fork(); + if (pid == 0) { + execl("/bin/sh", "/bin/sh", "-c", command, NULL); + _exit(0); + } + } +} +
M src/clock/clock.hsrc/clock/clock.h

@@ -30,6 +30,8 @@ extern struct timeval time_clock;

extern int time_precision; extern PangoFontDescription *time1_font_desc; extern PangoFontDescription *time2_font_desc; +extern char *clock_lclick_command; +extern char *clock_rclick_command; // initialize clock : y position, precision, ...

@@ -38,5 +40,7 @@

void draw_clock (void *obj, cairo_t *c, int active); void resize_clock (void *obj); + +void clock_action(int button); #endif
M src/config.csrc/config.c

@@ -398,6 +398,16 @@ Area *a = g_slist_nth_data(list_back, id);

memcpy(&panel_config->clock.area.pix.back, &a->pix.back, sizeof(Color)); memcpy(&panel_config->clock.area.pix.border, &a->pix.border, sizeof(Border)); } + else if (strcmp(key, "clock_lclick_command") == 0) { + if (clock_lclick_command) g_free(clock_lclick_command); + if (strlen(value) > 0) clock_lclick_command = strdup(value); + else clock_lclick_command = 0; + } + else if (strcmp(key, "clock_rclick_command") == 0) { + if (clock_rclick_command) g_free(clock_rclick_command); + if (strlen(value) > 0) clock_rclick_command = strdup(value); + else clock_rclick_command = 0; + } /* Taskbar */ else if (strcmp (key, "taskbar_mode") == 0) {
M src/systray/systraybar.csrc/systray/systraybar.c

@@ -109,7 +109,8 @@ XSelectInput(server.dsp, traywin->id, StructureNotifyMask|ResizeRedirectMask);

// position and size the icon window XMoveResizeWindow(server.dsp, traywin->id, traywin->x, traywin->y, icon_size, icon_size); - XSetWindowBackgroundPixmap (server.dsp, panel->main_win, systray.area.pix.pmap); + // ceci intervertie les fonds : le premier icone prend le fond du dernier + // le dernier prend le fond de l'avant dernier, ... // resize our window so that the new window can fit in it //fix_geometry();

@@ -123,6 +124,7 @@

// show the window XMapRaised(server.dsp, traywin->id); } + XSetWindowBackgroundPixmap (server.dsp, panel->main_win, systray.area.pix.pmap); }
M src/tint.csrc/tint.c

@@ -99,6 +99,8 @@ if (path_energy_now) g_free(path_energy_now);

if (path_energy_full) g_free(path_energy_full); if (path_current_now) g_free(path_current_now); if (path_status) g_free(path_status); + if (clock_lclick_command) g_free(clock_lclick_command); + if (clock_rclick_command) g_free(clock_rclick_command); if (server.monitor) free(server.monitor); XFreeGC(server.dsp, server.gc);

@@ -194,12 +196,17 @@

// search taskbar Taskbar *tskbar; GSList *l0; - for (l0 = panel->area.list; l0 ; l0 = l0->next) { - tskbar = l0->data; - if (!tskbar->area.on_screen) continue; - if (x >= tskbar->area.posx && x <= (tskbar->area.posx + tskbar->area.width)) - goto suite; - } + Clock clk = panel->clock; + if (clk.area.on_screen && x >= clk.area.posx && x <= (clk.area.posx + clk.area.width)) + clock_action(e->xbutton.button); + else { + for (l0 = panel->area.list; l0 ; l0 = l0->next) { + tskbar = l0->data; + if (!tskbar->area.on_screen) continue; + if (x >= tskbar->area.posx && x <= (tskbar->area.posx + tskbar->area.width)) + goto suite; + } + } // TODO: check better solution to keep window below XLowerWindow (server.dsp, panel->main_win);