Change to the linux kernel coding style
[wmaker-crm.git] / util / setstyle.c
Commit [+]AuthorDateLineData
9d2e6ef9 scottc1998-09-29 22:36:29 +00001/* setstyle.c - loads style related options to wmaker
2 *
3 * WindowMaker window manager
6d02fe98 dan2004-04-13 03:49:38 +00004 *
4153e2fd dan2003-01-16 23:30:45 +00005 * Copyright (c) 1997-2003 Alfredo K. Kojima
6d02fe98 dan2004-04-13 03:49:38 +00006 *
9d2e6ef9 scottc1998-09-29 22:36:29 +00007 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
6d02fe98 dan2004-04-13 03:49:38 +000019 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
9d2e6ef9 scottc1998-09-29 22:36:29 +000020 * USA.
21 */
22
fa9bfc97 kojima2000-04-07 23:20:41 +000023#define PROG_VERSION "setstyle (Window Maker) 0.6"
931a37b1 dan1999-01-29 08:11:17 +000024
9d2e6ef9 scottc1998-09-29 22:36:29 +000025#include <stdlib.h>
26#include <stdio.h>
0261c326 dan1999-01-06 15:22:33 +000027#include <sys/stat.h>
28#include <unistd.h>
33cc542e dan2001-10-04 03:07:34 +000029#include <string.h>
9df0e167 kojima1999-04-03 03:51:17 +000030#include <X11/Xlib.h>
33cc542e dan2001-10-04 03:07:34 +000031#include <WINGs/WUtil.h>
32
9d2e6ef9 scottc1998-09-29 22:36:29 +000033#include "../src/wconfig.h"
34
7f018497 kojima1999-04-24 20:08:20 +000035#define MAX_OPTIONS 128
0261c326 dan1999-01-06 15:22:33 +000036
37char *FontOptions[] = {
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020038 "IconTitleFont",
39 "ClipTitleFont",
40 "DisplayFont",
41 "LargeDisplayFont",
42 "MenuTextFont",
43 "MenuTitleFont",
44 "WindowTitleFont",
45 NULL
0261c326 dan1999-01-06 15:22:33 +000046};
47
e44cc81a dan2001-09-06 09:42:51 +000048char *CursorOptions[] = {
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020049 "NormalCursor",
50 "ArrowCursor",
51 "MoveCursor",
52 "ResizeCursor",
53 "TopLeftResizeCursor",
54 "TopRightResizeCursor",
55 "BottomLeftResizeCursor",
56 "BottomRightResizeCursor",
57 "VerticalResizeCursor",
58 "HorizontalResizeCursor",
59 "WaitCursor",
60 "QuestionCursor",
61 "TextCursor",
62 "SelectCursor",
63 NULL
e44cc81a dan2001-09-06 09:42:51 +000064};
65
9d2e6ef9 scottc1998-09-29 22:36:29 +000066char *ProgName;
0261c326 dan1999-01-06 15:22:33 +000067int ignoreFonts = 0;
e44cc81a dan2001-09-06 09:42:51 +000068int ignoreCursors = 0;
0261c326 dan1999-01-06 15:22:33 +000069
da918281 kojima1999-04-12 02:03:58 +000070Display *dpy;
9d2e6ef9 scottc1998-09-29 22:36:29 +000071
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020072extern char *convertFont(char *font, Bool keepXLFD);
5e4625da kojima1999-05-29 21:41:25 +000073
33cc542e dan2001-10-04 03:07:34 +000074WMPropList *readBlackBoxStyle(char *path);
5e4625da kojima1999-05-29 21:41:25 +000075
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020076static Bool isCursorOption(char *option)
f54b0de7 vlaad2004-04-10 14:55:55 +000077{
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020078 int i;
6d02fe98 dan2004-04-13 03:49:38 +000079
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020080 for (i = 0; CursorOptions[i] != NULL; i++) {
81 if (strcasecmp(option, CursorOptions[i]) == 0) {
82 return True;
83 }
84 }
6d02fe98 dan2004-04-13 03:49:38 +000085
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020086 return False;
f54b0de7 vlaad2004-04-10 14:55:55 +000087}
88
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020089static Bool isFontOption(char *option)
f54b0de7 vlaad2004-04-10 14:55:55 +000090{
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020091 int i;
6d02fe98 dan2004-04-13 03:49:38 +000092
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020093 for (i = 0; FontOptions[i] != NULL; i++) {
94 if (strcasecmp(option, FontOptions[i]) == 0) {
95 return True;
96 }
97 }
6d02fe98 dan2004-04-13 03:49:38 +000098
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020099 return False;
f54b0de7 vlaad2004-04-10 14:55:55 +0000100}
101
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200102char *defaultsPathForDomain(char *domain)
9d2e6ef9 scottc1998-09-29 22:36:29 +0000103{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200104 static char path[1024];
105 char *gspath;
106
107 gspath = getenv("GNUSTEP_USER_ROOT");
108 if (gspath) {
109 strcpy(path, gspath);
110 strcat(path, "/");
111 } else {
112 char *home;
113
114 home = getenv("HOME");
115 if (!home) {
116 printf("%s:could not get HOME environment variable!\n", ProgName);
117 exit(0);
118 }
119
120 strcpy(path, home);
121 strcat(path, "/GNUstep/");
122 }
123 strcat(path, DEFAULTS_DIR);
124 strcat(path, "/");
125 strcat(path, domain);
126
127 return path;
9d2e6ef9 scottc1998-09-29 22:36:29 +0000128}
129
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200130void hackPathInTexture(WMPropList * texture, char *prefix)
2effbfaf kojima1999-04-18 21:08:00 +0000131{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200132 WMPropList *type;
133 char *t;
134
135 /* get texture type */
136 type = WMGetFromPLArray(texture, 0);
137 t = WMGetFromPLString(type);
138 if (t == NULL)
139 return;
140 if (strcasecmp(t, "tpixmap") == 0
141 || strcasecmp(t, "spixmap") == 0
142 || strcasecmp(t, "mpixmap") == 0
143 || strcasecmp(t, "cpixmap") == 0
144 || strcasecmp(t, "tvgradient") == 0
145 || strcasecmp(t, "thgradient") == 0 || strcasecmp(t, "tdgradient") == 0) {
146 WMPropList *file;
147 char buffer[4018];
148
149 /* get pixmap file path */
150 file = WMGetFromPLArray(texture, 1);
151 sprintf(buffer, "%s/%s", prefix, WMGetFromPLString(file));
152 /* replace path with full path */
153 WMDeleteFromPLArray(texture, 1);
154 WMInsertInPLArray(texture, 1, WMCreatePLString(buffer));
155 } else if (strcasecmp(t, "bitmap") == 0) {
156 WMPropList *file;
157 char buffer[4018];
158
159 /* get bitmap file path */
160 file = WMGetFromPLArray(texture, 1);
161 sprintf(buffer, "%s/%s", prefix, WMGetFromPLString(file));
162 /* replace path with full path */
163 WMDeleteFromPLArray(texture, 1);
164 WMInsertInPLArray(texture, 1, WMCreatePLString(buffer));
165
166 /* get mask file path */
167 file = WMGetFromPLArray(texture, 2);
168 sprintf(buffer, "%s/%s", prefix, WMGetFromPLString(file));
169 /* replace path with full path */
170 WMDeleteFromPLArray(texture, 2);
171 WMInsertInPLArray(texture, 2, WMCreatePLString(buffer));
172 }
2effbfaf kojima1999-04-18 21:08:00 +0000173}
174
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200175void hackPaths(WMPropList * style, char *prefix)
0261c326 dan1999-01-06 15:22:33 +0000176{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200177 WMPropList *keys;
178 WMPropList *key;
179 WMPropList *value;
180 int i;
0261c326 dan1999-01-06 15:22:33 +0000181
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200182 keys = WMGetPLDictionaryKeys(style);
0261c326 dan1999-01-06 15:22:33 +0000183
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200184 for (i = 0; i < WMGetPropListItemCount(keys); i++) {
185 key = WMGetFromPLArray(keys, i);
6d02fe98 dan2004-04-13 03:49:38 +0000186
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200187 value = WMGetFromPLDictionary(style, key);
188 if (!value)
189 continue;
6d02fe98 dan2004-04-13 03:49:38 +0000190
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200191 if (strcasecmp(WMGetFromPLString(key), "WorkspaceSpecificBack") == 0) {
192 if (WMIsPLArray(value)) {
193 int j;
194 WMPropList *texture;
6d02fe98 dan2004-04-13 03:49:38 +0000195
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200196 for (j = 0; j < WMGetPropListItemCount(value); j++) {
197 texture = WMGetFromPLArray(value, j);
6d02fe98 dan2004-04-13 03:49:38 +0000198
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200199 if (texture && WMIsPLArray(texture)
200 && WMGetPropListItemCount(texture) > 2) {
6d02fe98 dan2004-04-13 03:49:38 +0000201
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200202 hackPathInTexture(texture, prefix);
203 }
204 }
205 }
206 } else {
6d02fe98 dan2004-04-13 03:49:38 +0000207
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200208 if (WMIsPLArray(value) && WMGetPropListItemCount(value) > 2) {
6d02fe98 dan2004-04-13 03:49:38 +0000209
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200210 hackPathInTexture(value, prefix);
211 }
212 }
213 }
6d02fe98 dan2004-04-13 03:49:38 +0000214
0261c326 dan1999-01-06 15:22:33 +0000215}
216
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200217static WMPropList *getColor(WMPropList * texture)
da918281 kojima1999-04-12 02:03:58 +0000218{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200219 WMPropList *value, *type;
220 char *str;
221
222 type = WMGetFromPLArray(texture, 0);
223 if (!type)
224 return NULL;
225
226 value = NULL;
227
228 str = WMGetFromPLString(type);
229 if (strcasecmp(str, "solid") == 0) {
230 value = WMGetFromPLArray(texture, 1);
231 } else if (strcasecmp(str, "dgradient") == 0
232 || strcasecmp(str, "hgradient") == 0 || strcasecmp(str, "vgradient") == 0) {
233 WMPropList *c1, *c2;
234 int r1, g1, b1, r2, g2, b2;
235 char buffer[32];
236
237 c1 = WMGetFromPLArray(texture, 1);
238 c2 = WMGetFromPLArray(texture, 2);
239 if (!dpy) {
240 if (sscanf(WMGetFromPLString(c1), "#%2x%2x%2x", &r1, &g1, &b1) == 3
241 && sscanf(WMGetFromPLString(c2), "#%2x%2x%2x", &r2, &g2, &b2) == 3) {
242 sprintf(buffer, "#%02x%02x%02x", (r1 + r2) / 2, (g1 + g2) / 2, (b1 + b2) / 2);
243 value = WMCreatePLString(buffer);
244 } else {
245 value = c1;
246 }
247 } else {
248 XColor color1;
249 XColor color2;
250
251 XParseColor(dpy, DefaultColormap(dpy, DefaultScreen(dpy)), WMGetFromPLString(c1), &color1);
252 XParseColor(dpy, DefaultColormap(dpy, DefaultScreen(dpy)), WMGetFromPLString(c2), &color2);
253
254 sprintf(buffer, "#%02x%02x%02x",
255 (color1.red + color2.red) >> 9,
256 (color1.green + color2.green) >> 9, (color1.blue + color2.blue) >> 9);
257 value = WMCreatePLString(buffer);
258 }
259 } else if (strcasecmp(str, "mdgradient") == 0
260 || strcasecmp(str, "mhgradient") == 0 || strcasecmp(str, "mvgradient") == 0) {
261
262 value = WMGetFromPLArray(texture, 1);
263
264 } else if (strcasecmp(str, "tpixmap") == 0
265 || strcasecmp(str, "cpixmap") == 0 || strcasecmp(str, "spixmap") == 0) {
266
267 value = WMGetFromPLArray(texture, 2);
268 }
269
270 return value;
da918281 kojima1999-04-12 02:03:58 +0000271}
272
0261c326 dan1999-01-06 15:22:33 +0000273/*
274 * since some of the options introduce incompatibilities, we will need
275 * to do a kluge here or the themes ppl will get real annoying.
276 * So, treat for the absence of the following options:
277 * IconTitleColor
278 * IconTitleBack
279 */
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200280void hackStyle(WMPropList * style)
0261c326 dan1999-01-06 15:22:33 +0000281{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200282 WMPropList *keys, *tmp;
283 int foundIconTitle = 0, foundResizebarBack = 0;
284 int i;
285
286 keys = WMGetPLDictionaryKeys(style);
287
288 for (i = 0; i < WMGetPropListItemCount(keys); i++) {
289 char *str;
290
291 tmp = WMGetFromPLArray(keys, i);
292 str = WMGetFromPLString(tmp);
293 if (str) {
294 if (ignoreFonts && isFontOption(str)) {
295 WMRemoveFromPLDictionary(style, tmp);
296 continue;
297 }
298 if (ignoreCursors && isCursorOption(str)) {
299 WMRemoveFromPLDictionary(style, tmp);
300 continue;
301 }
302 if (isFontOption(str)) {
303 WMPropList *value;
304 char *newfont, *oldfont;
305
306 value = WMGetFromPLDictionary(style, tmp);
307 if (value) {
308 oldfont = WMGetFromPLString(value);
309 newfont = convertFont(oldfont, False);
310 if (newfont != oldfont) {
311 value = WMCreatePLString(newfont);
312 WMPutInPLDictionary(style, tmp, value);
313 WMReleasePropList(value);
314 wfree(newfont);
315 }
316 }
317 }
318 if (strcasecmp(str, "IconTitleColor") == 0 || strcasecmp(str, "IconTitleBack") == 0) {
319 foundIconTitle = 1;
320 } else if (strcasecmp(str, "ResizebarBack") == 0) {
321 foundResizebarBack = 1;
322 }
323 }
324 }
325
326 if (!foundIconTitle) {
327 /* set the default values */
328 tmp = WMGetFromPLDictionary(style, WMCreatePLString("FTitleColor"));
329 if (tmp) {
330 WMPutInPLDictionary(style, WMCreatePLString("IconTitleColor"), tmp);
331 }
332
333 tmp = WMGetFromPLDictionary(style, WMCreatePLString("FTitleBack"));
334 if (tmp) {
335 WMPropList *value;
336
337 value = getColor(tmp);
338
339 if (value) {
340 WMPutInPLDictionary(style, WMCreatePLString("IconTitleBack"), value);
341 }
342 }
343 }
344
345 if (!foundResizebarBack) {
346 /* set the default values */
347 tmp = WMGetFromPLDictionary(style, WMCreatePLString("UTitleBack"));
348 if (tmp) {
349 WMPropList *value;
350
351 value = getColor(tmp);
352
353 if (value) {
354 WMPropList *t;
355
356 t = WMCreatePLArray(WMCreatePLString("solid"), value, NULL);
357 WMPutInPLDictionary(style, WMCreatePLString("ResizebarBack"), t);
358 }
359 }
360 }
361
362 if (!WMGetFromPLDictionary(style, WMCreatePLString("MenuStyle"))) {
363 WMPutInPLDictionary(style, WMCreatePLString("MenuStyle"), WMCreatePLString("normal"));
364 }
0261c326 dan1999-01-06 15:22:33 +0000365}
366
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200367void print_help()
931a37b1 dan1999-01-29 08:11:17 +0000368{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200369 printf("Usage: %s [OPTIONS] FILE\n", ProgName);
370 puts("Reads style/theme configuration from FILE and updates Window Maker.");
371 puts("");
372 puts(" --no-fonts ignore font related options");
373 puts(" --no-cursors ignore cursor related options");
374 puts(" --ignore <option> ignore changes in the specified option");
375 puts(" --help display this help and exit");
376 /*
377 puts(" --format <format> specifies the format of the theme to be converted");
378 */
379 puts(" --version output version information and exit");
380 /*puts("");
381 puts("Supported formats: blackbox"); */
931a37b1 dan1999-01-29 08:11:17 +0000382}
383
57b315f5 kojima1999-05-29 22:48:00 +0000384#define F_BLACKBOX 1
5e4625da kojima1999-05-29 21:41:25 +0000385
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200386int main(int argc, char **argv)
9d2e6ef9 scottc1998-09-29 22:36:29 +0000387{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200388 WMPropList *prop, *style;
389 char *path;
390 char *file = NULL;
391 struct stat statbuf;
392 int i;
393 int ignoreCount = 0;
394 char *ignoreList[MAX_OPTIONS];
395
396 dpy = XOpenDisplay("");
397
398 ProgName = argv[0];
399
400 if (argc < 2) {
401 printf("%s: missing argument\n", ProgName);
402 printf("Try '%s --help' for more information\n", ProgName);
403 exit(1);
404 }
405
406 for (i = 1; i < argc; i++) {
407 if (strcmp("--ignore", argv[i]) == 0) {
408 i++;
409 if (i == argc) {
410 printf("%s: missing argument for option --ignore\n", ProgName);
411 exit(1);
412 }
413 ignoreList[ignoreCount++] = argv[i];
414
415 } else if (strcmp("--no-fonts", argv[i]) == 0) {
416 ignoreFonts = 1;
417 } else if (strcmp("--no-cursors", argv[i]) == 0) {
418 ignoreCursors = 1;
419 } else if (strcmp("--version", argv[i]) == 0) {
420 puts(PROG_VERSION);
421 exit(0);
422 } else if (strcmp("--help", argv[i]) == 0) {
423 print_help();
424 exit(0);
57b315f5 kojima1999-05-29 22:48:00 +0000425#if 0
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200426 } else if (strcmp("--format", argv[i]) == 0) {
427 i++;
428 if (i == argc) {
429 printf("%s: missing argument for option --format\n", ProgName);
430 exit(1);
431 }
432 if (strcasecmp(argv[i], "blackbox") == 0) {
433 format = F_BLACKBOX;
434 } else {
435 printf("%s: unknown theme format '%s'\n", ProgName, argv[i]);
436 exit(1);
437 }
57b315f5 kojima1999-05-29 22:48:00 +0000438#endif
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200439 } else {
440 if (file) {
441 printf("%s: invalid argument '%s'\n", ProgName, argv[i]);
442 printf("Try '%s --help' for more information\n", ProgName);
443 exit(1);
444 }
445 file = argv[i];
446 }
447 }
448
449 WMPLSetCaseSensitive(False);
450
451 path = defaultsPathForDomain("WindowMaker");
452
453 prop = WMReadPropListFromFile(path);
454 if (!prop) {
455 perror(path);
456 printf("%s:could not load WindowMaker configuration file.\n", ProgName);
457 exit(1);
458 }
459
460 if (stat(file, &statbuf) < 0) {
461 perror(file);
462 exit(1);
463 }
57b315f5 kojima1999-05-29 22:48:00 +0000464#if 0
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200465 if (format == F_BLACKBOX) {
466 style = readBlackBoxStyle(file);
467 if (!style) {
468 printf("%s: could not open style file\n", ProgName);
469 exit(1);
470 }
471 } else
57b315f5 kojima1999-05-29 22:48:00 +0000472#endif
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200473 {
474 if (S_ISDIR(statbuf.st_mode)) {
475 char buffer[4018];
476 char *prefix;
477 /* theme pack */
478
479 if (*argv[argc - 1] != '/') {
480 if (!getcwd(buffer, 4000)) {
481 printf("%s: complete path for %s is too long\n", ProgName, file);
482 exit(1);
483 }
484 if (strlen(buffer) + strlen(file) > 4000) {
485 printf("%s: complete path for %s is too long\n", ProgName, file);
486 exit(1);
487 }
488 strcat(buffer, "/");
489 } else {
490 buffer[0] = 0;
491 }
492 strcat(buffer, file);
493
494 prefix = malloc(strlen(buffer) + 10);
495 if (!prefix) {
496 printf("%s: out of memory\n", ProgName);
497 exit(1);
498 }
499 strcpy(prefix, buffer);
500
501 strcat(buffer, "/style");
502
503 style = WMReadPropListFromFile(buffer);
504 if (!style) {
505 perror(buffer);
506 printf("%s:could not load style file.\n", ProgName);
507 exit(1);
508 }
509
510 hackPaths(style, prefix);
511 free(prefix);
512 } else {
513 /* normal style file */
514
515 style = WMReadPropListFromFile(file);
516 if (!style) {
517 perror(file);
518 printf("%s:could not load style file.\n", ProgName);
519 exit(1);
520 }
521 }
522 }
523
524 if (!WMIsPLDictionary(style)) {
525 printf("%s: '%s' is not a style file/theme\n", ProgName, file);
526 exit(1);
527 }
528
529 hackStyle(style);
530
531 if (ignoreCount > 0) {
532 for (i = 0; i < ignoreCount; i++) {
533 WMRemoveFromPLDictionary(style, WMCreatePLString(ignoreList[i]));
534 }
535 }
536
537 WMMergePLDictionaries(prop, style, True);
538
539 WMWritePropListToFile(prop, path, True);
540 {
541 XEvent ev;
542
543 if (dpy) {
544 int i;
545 char *msg = "Reconfigure";
546
547 memset(&ev, 0, sizeof(XEvent));
548
549 ev.xclient.type = ClientMessage;
550 ev.xclient.message_type = XInternAtom(dpy, "_WINDOWMAKER_COMMAND", False);
551 ev.xclient.window = DefaultRootWindow(dpy);
552 ev.xclient.format = 8;
553
554 for (i = 0; i <= strlen(msg); i++) {
555 ev.xclient.data.b[i] = msg[i];
556 }
557 XSendEvent(dpy, DefaultRootWindow(dpy), False, SubstructureRedirectMask, &ev);
558 XFlush(dpy);
559 }
560 }
561
562 exit(0);
9d2e6ef9 scottc1998-09-29 22:36:29 +0000563}
564
57b315f5 kojima1999-05-29 22:48:00 +0000565#if 0
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200566char *getToken(char *str, int i, char *buf)
5e4625da kojima1999-05-29 21:41:25 +0000567{
6d02fe98 dan2004-04-13 03:49:38 +0000568
5e4625da kojima1999-05-29 21:41:25 +0000569}
570
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200571static WMPropList *readBlackBoxStyle(char *path)
5e4625da kojima1999-05-29 21:41:25 +0000572{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200573 FILE *f;
574 char buffer[128], char token[128];
575 WMPropList *style, *p;
33cc542e dan2001-10-04 03:07:34 +0000576
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200577 f = fopen(path, "rb");
578 if (!f) {
579 perror(path);
580 return NULL;
581 }
5e4625da kojima1999-05-29 21:41:25 +0000582
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200583 while (1) {
584 if (!fgets(buffer, 127, f))
585 break;
6d02fe98 dan2004-04-13 03:49:38 +0000586
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200587 if (strncasecmp(buffer, "menu.title:", 11) == 0) {
5e4625da kojima1999-05-29 21:41:25 +0000588
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200589 }
590 }
5e4625da kojima1999-05-29 21:41:25 +0000591}
57b315f5 kojima1999-05-29 22:48:00 +0000592#endif