clock command on rigt/left click by dmitry.medvinsky

git-svn-id: http://tint2.googlecode.com/svn/trunk@84 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
lorthiois@bbsoft.fr
2009-06-04 18:41:14 +00:00
parent fa749b7026
commit 26ab02d533
7 changed files with 60 additions and 9 deletions

View File

@@ -22,6 +22,7 @@
#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 "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 @@ void resize_clock (void *obj)
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);
}
}
}