+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
#include <cairo.h>
#include <cairo-xlib.h>
#include <pango/pangocairo.h>
+#include <unistd.h>
#include "window.h"
#include "server.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;
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);
+ }
+ }
+}
+
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, ...
void resize_clock (void *obj);
+void clock_action(int button);
+
#endif
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) {
// 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();
// show the window
XMapRaised(server.dsp, traywin->id);
}
+ XSetWindowBackgroundPixmap (server.dsp, panel->main_win, systray.area.pix.pmap);
}
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);
// 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);