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:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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, ...
|
||||
@@ -39,4 +41,6 @@ void draw_clock (void *obj, cairo_t *c, int active);
|
||||
|
||||
void resize_clock (void *obj);
|
||||
|
||||
void clock_action(int button);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user