3 * wmxss-0.10 (C) 1999 Mike Henderson (mghenderson@lanl.gov)
5 * - Its a DockApp front end for xscreensaver
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2, or (at your option)
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program (see the file COPYING); if not, write to the
22 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 * Boston, MA 02111-1307, USA
28 * Version 0.10 - released Aug 11, 1999.
29 * just playing around right now....
49 #include "wmxss_master.xpm"
50 #include "wmxss_mask.xbm"
55 * Delay between refreshes (in microseconds)
58 #define WMXSS_VERSION "0.10"
64 void ParseCMDLine(int argc
, char *argv
[]);
65 void ButtonPressEvent(XButtonEvent
*);
69 int GotFirstClick1
, GotDoubleClick1
;
70 int GotFirstClick2
, GotDoubleClick2
;
71 int GotFirstClick3
, GotDoubleClick3
;
74 char ExecuteCommand
[1024];
80 char TimeColor
[30] = "#ffff00";
81 char BackgroundColor
[30] = "#181818";
91 int main(int argc
, char *argv
[]) {
100 * Parse any command line arguments.
102 ParseCMDLine(argc
, argv
);
110 initXwindow(argc
, argv
);
111 openXwindow(argc
, argv
, wmxss_master
, wmxss_mask_bits
, wmxss_mask_width
, wmxss_mask_height
);
116 sprintf(Command
, "%s -window-id 0x%x &", ExecuteCommand
, (int)iconwin
);
136 * Update the counter.
147 * Double Click Delays
148 * Keep track of click events. If Delay too long, set GotFirstClick's to False.
150 if (DblClkDelay
> 150) {
153 GotFirstClick1
= 0; GotDoubleClick1
= 0;
154 GotFirstClick2
= 0; GotDoubleClick2
= 0;
155 GotFirstClick3
= 0; GotDoubleClick3
= 0;
167 * Process any pending X events.
169 while(XPending(display
)){
170 XNextEvent(display
, &event
);
176 ButtonPressEvent(&event
.xbutton
);
189 * Redraw and wait for next update
213 void ParseCMDLine(int argc
, char *argv
[]) {
217 for (i
= 1; i
< argc
; i
++) {
219 if (!strcmp(argv
[i
], "-display")){
223 } else if (!strcmp(argv
[i
], "-tc")){
225 if ((i
+1 >= argc
)||(argv
[i
+1][0] == '-')) {
226 fprintf(stderr
, "wmxss: No color found\n");
230 strcpy(TimeColor
, argv
[++i
]);
232 } else if (!strcmp(argv
[i
], "-bc")){
234 if ((i
+1 >= argc
)||(argv
[i
+1][0] == '-')) {
235 fprintf(stderr
, "wmxss: No color found\n");
239 strcpy(BackgroundColor
, argv
[++i
]);
241 } else if (!strcmp(argv
[i
], "-e")){
243 if ((i
+1 >= argc
)||(argv
[i
+1][0] == '-')) {
244 fprintf(stderr
, "wmxss: No command given\n");
248 strcpy(ExecuteCommand
, argv
[++i
]);
265 printf("\nwmxss version: %s\n", WMXSS_VERSION
);
266 printf("\nusage: wmxss [-e \"Command\"] \n\n");
267 printf("\t-e \"Command\"\tCommand to execute via double click of mouse button 1.\n");
268 printf("\t-h\t\tDisplay help screen.\n");
269 printf("\nExample: wmxss -e xflame\n\n");
280 * This routine handles button presses.
283 * Mouse Button 1: Execute the command defined in the -e command-line option.
284 * Mouse Button 2: No action assigned.
285 * Mouse Button 3: No action assigned.
289 void ButtonPressEvent(XButtonEvent
*xev
){
294 if ((xev
->button
== Button1
) && (xev
->type
== ButtonPress
)){
295 if (GotFirstClick1
) GotDoubleClick1
= 1;
296 else GotFirstClick1
= 1;
297 } else if ((xev
->button
== Button2
) && (xev
->type
== ButtonPress
)){
298 if (GotFirstClick2
) GotDoubleClick2
= 1;
299 else GotFirstClick2
= 1;
300 } else if ((xev
->button
== Button3
) && (xev
->type
== ButtonPress
)){
301 if (GotFirstClick3
) GotDoubleClick3
= 1;
302 else GotFirstClick3
= 1;
307 * We got a double click on Mouse Button1 (i.e. the left one)
309 if (GotDoubleClick1
) {
312 system("xscreensaver-demo");
317 * We got a double click on Mouse Button2 (i.e. the left one)
319 if (GotDoubleClick2
) {
326 * We got a double click on Mouse Button3 (i.e. the left one)
328 if (GotDoubleClick3
) {