Update local copy of GPLv2 and FSF address in copyrights
[wmaker-crm.git] / src / main.c
blob41c011ba992c763b1d4e625164a9589daba13ef1
1 /*
2 * Window Maker window manager
4 * Copyright (c) 1997-2003 Alfredo K. Kojima
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #include "wconfig.h"
23 #ifdef HAVE_INOTIFY
24 #include <sys/inotify.h>
25 #endif
27 #include <stdio.h>
28 #include <stdlib.h>
29 #include <unistd.h>
30 #include <string.h>
31 #include <sys/stat.h>
32 #include <sys/types.h>
33 #include <fcntl.h>
35 #include <X11/Xlib.h>
36 #include <X11/Xutil.h>
38 /* Xlocale.h and locale.h are the same if X_LOCALE is undefind in wconfig.h,
39 * and if X_LOCALE is defined, X's locale emulating functions will be used.
40 * See Xlocale.h for more information.
42 #include <X11/Xlocale.h>
44 #define MAINFILE
46 #include "WindowMaker.h"
47 #include "window.h"
48 #include "funcs.h"
49 #include "menu.h"
50 #include "keybind.h"
51 #include "xmodifier.h"
52 #include "session.h"
53 #include "dialog.h"
55 #include <WINGs/WUtil.h>
57 #ifndef GLOBAL_DEFAULTS_SUBDIR
58 #define GLOBAL_DEFAULTS_SUBDIR "WindowMaker"
59 #endif
61 /****** Global Variables ******/
63 /* general info */
65 Display *dpy;
67 char *ProgName;
69 unsigned int ValidModMask = 0xff;
71 #ifdef HAVE_INOTIFY
72 int inotifyFD;
73 int inotifyWD;
74 #endif
75 /* locale to use. NULL==POSIX or C */
76 char *Locale = NULL;
78 int wScreenCount = 0;
80 WPreferences wPreferences;
82 WMPropList *wDomainName;
83 WMPropList *wAttributeDomainName;
85 WShortKey wKeyBindings[WKBD_LAST];
87 /* defaults domains */
88 WDDomain *WDWindowMaker = NULL;
89 WDDomain *WDWindowAttributes = NULL;
90 WDDomain *WDRootMenu = NULL;
92 /* XContexts */
93 XContext wWinContext;
94 XContext wAppWinContext;
95 XContext wStackContext;
96 XContext wVEdgeContext;
98 /* Atoms */
99 Atom _XA_WM_STATE;
100 Atom _XA_WM_CHANGE_STATE;
101 Atom _XA_WM_PROTOCOLS;
102 Atom _XA_WM_TAKE_FOCUS;
103 Atom _XA_WM_DELETE_WINDOW;
104 Atom _XA_WM_SAVE_YOURSELF;
105 Atom _XA_WM_CLIENT_LEADER;
106 Atom _XA_WM_COLORMAP_WINDOWS;
107 Atom _XA_WM_COLORMAP_NOTIFY;
109 Atom _XA_GNUSTEP_WM_ATTR;
110 Atom _XA_GNUSTEP_WM_MINIATURIZE_WINDOW;
111 Atom _XA_GNUSTEP_WM_RESIZEBAR;
112 Atom _XA_GNUSTEP_TITLEBAR_STATE;
114 Atom _XA_WINDOWMAKER_MENU;
115 Atom _XA_WINDOWMAKER_WM_PROTOCOLS;
116 Atom _XA_WINDOWMAKER_STATE;
118 Atom _XA_WINDOWMAKER_WM_FUNCTION;
119 Atom _XA_WINDOWMAKER_NOTICEBOARD;
120 Atom _XA_WINDOWMAKER_COMMAND;
122 Atom _XA_WINDOWMAKER_ICON_SIZE;
123 Atom _XA_WINDOWMAKER_ICON_TILE;
125 Atom _XA_WM_IGNORE_FOCUS_EVENTS;
127 /* cursors */
128 Cursor wCursor[WCUR_LAST];
130 /* last event timestamp for XSetInputFocus */
131 Time LastTimestamp = CurrentTime;
132 /* timestamp on the last time we did XSetInputFocus() */
133 Time LastFocusChange = CurrentTime;
135 #ifdef SHAPE
136 Bool wShapeSupported;
137 int wShapeEventBase;
138 #endif
140 #ifdef KEEP_XKB_LOCK_STATUS
141 Bool wXkbSupported;
142 int wXkbEventBase;
143 #endif
145 #ifdef HAVE_XRANDR
146 Bool has_randr;
147 int randr_event_base;
148 #endif
150 /* special flags */
151 char WProgramSigState = 0;
152 char WProgramState = WSTATE_NORMAL;
153 char WDelayedActionSet = 0;
155 /* notifications */
156 const char *WMNManaged = "WMNManaged";
157 const char *WMNUnmanaged = "WMNUnmanaged";
158 const char *WMNChangedWorkspace = "WMNChangedWorkspace";
159 const char *WMNChangedState = "WMNChangedState";
160 const char *WMNChangedFocus = "WMNChangedFocus";
161 const char *WMNChangedStacking = "WMNChangedStacking";
162 const char *WMNChangedName = "WMNChangedName";
164 const char *WMNWorkspaceCreated = "WMNWorkspaceCreated";
165 const char *WMNWorkspaceDestroyed = "WMNWorkspaceDestroyed";
166 const char *WMNWorkspaceChanged = "WMNWorkspaceChanged";
167 const char *WMNWorkspaceNameChanged = "WMNWorkspaceNameChanged";
169 const char *WMNResetStacking = "WMNResetStacking";
171 /******** End Global Variables *****/
173 static char *DisplayName = NULL;
175 static char **Arguments;
177 static int ArgCount;
179 extern void EventLoop(void);
180 extern void StartUp(Bool defaultScreenOnly);
181 extern int MonitorLoop(int argc, char **argv);
183 static Bool multiHead = True;
185 static int *wVisualID = NULL;
186 static int wVisualID_len = 0;
188 static int real_main(int argc, char **argv);
190 int getWVisualID(int screen)
192 if (wVisualID == NULL)
193 return -1;
194 if (screen < 0 || screen >= wVisualID_len)
195 return -1;
197 return wVisualID[screen];
200 static void setWVisualID(int screen, int val)
202 int i;
204 if (screen < 0)
205 return;
207 if (wVisualID == NULL) {
208 /* no array at all, alloc space for screen + 1 entries
209 * and init with default value */
210 wVisualID_len = screen + 1;
211 wVisualID = (int *)malloc(wVisualID_len * sizeof(int));
212 for (i = 0; i < wVisualID_len; i++) {
213 wVisualID[i] = -1;
215 } else if (screen >= wVisualID_len) {
216 /* larger screen number than previously allocated
217 so enlarge array */
218 int oldlen = wVisualID_len;
220 wVisualID_len = screen + 1;
221 wVisualID = (int *)realloc(wVisualID, wVisualID_len * sizeof(int));
222 for (i = oldlen; i < wVisualID_len; i++) {
223 wVisualID[i] = -1;
227 wVisualID[screen] = val;
231 * this function splits a given string at the comma into tokens
232 * and set the wVisualID variable to each parsed number
234 static int initWVisualID(const char *user_str)
236 char *mystr = strdup(user_str);
237 int cur_in_pos = 0;
238 int cur_out_pos = 0;
239 int cur_screen = 0;
240 int error_found = 0;
242 for (;;) {
243 /* check for delimiter */
244 if (user_str[cur_in_pos] == '\0' || user_str[cur_in_pos] == ',') {
245 int v;
247 mystr[cur_out_pos] = '\0';
249 if (sscanf(mystr, "%i", &v) != 1) {
250 error_found = 1;
251 break;
254 setWVisualID(cur_screen, v);
256 cur_screen++;
257 cur_out_pos = 0;
260 /* break in case last char has been consumed */
261 if (user_str[cur_in_pos] == '\0')
262 break;
264 /* if the current char is no delimiter put it into mystr */
265 if (user_str[cur_in_pos] != ',') {
266 mystr[cur_out_pos++] = user_str[cur_in_pos];
268 cur_in_pos++;
271 free(mystr);
273 if (cur_screen == 0||error_found != 0)
274 return 1;
276 return 0;
279 void Exit(int status)
281 if (dpy)
282 XCloseDisplay(dpy);
284 exit(status);
287 void Restart(char *manager, Bool abortOnFailure)
289 char *prog = NULL;
290 char *argv[MAX_RESTART_ARGS];
291 int i;
293 if (manager && manager[0] != 0) {
294 prog = argv[0] = strtok(manager, " ");
295 for (i = 1; i < MAX_RESTART_ARGS; i++) {
296 argv[i] = strtok(NULL, " ");
297 if (argv[i] == NULL) {
298 break;
302 if (dpy) {
303 XCloseDisplay(dpy);
304 dpy = NULL;
306 if (!prog) {
307 execvp(Arguments[0], Arguments);
308 wfatal(_("failed to restart Window Maker."));
309 } else {
310 execvp(prog, argv);
311 werror(_("could not exec %s"), prog);
313 if (abortOnFailure)
314 exit(7);
317 void SetupEnvironment(WScreen * scr)
319 char *tmp, *ptr;
320 char buf[16];
322 if (multiHead) {
323 int len = strlen(DisplayName) + 64;
324 tmp = wmalloc(len);
325 snprintf(tmp, len, "DISPLAY=%s", XDisplayName(DisplayName));
326 ptr = strchr(strchr(tmp, ':'), '.');
327 if (ptr)
328 *ptr = 0;
329 snprintf(buf, sizeof(buf), ".%i", scr->screen);
330 strcat(tmp, buf);
331 putenv(tmp);
333 tmp = wmalloc(60);
334 snprintf(tmp, 60, "WRASTER_COLOR_RESOLUTION%i=%i", scr->screen,
335 scr->rcontext->attribs->colors_per_channel);
336 putenv(tmp);
339 typedef struct {
340 WScreen *scr;
341 char *command;
342 } _tuple;
344 static void shellCommandHandler(pid_t pid, unsigned char status, _tuple * data)
346 if (status == 127) {
347 char *buffer;
349 buffer = wstrconcat(_("Could not execute command: "), data->command);
351 wMessageDialog(data->scr, _("Error"), buffer, _("OK"), NULL, NULL);
352 wfree(buffer);
353 } else if (status != 127) {
355 printf("%s: %i\n", data->command, status);
359 wfree(data->command);
360 wfree(data);
363 void ExecuteShellCommand(WScreen * scr, char *command)
365 static char *shell = NULL;
366 pid_t pid;
369 * This have a problem: if the shell is tcsh (not sure about others)
370 * and ~/.tcshrc have /bin/stty erase ^H somewhere on it, the shell
371 * will block and the command will not be executed.
372 if (!shell) {
373 shell = getenv("SHELL");
374 if (!shell)
375 shell = "/bin/sh";
378 shell = "/bin/sh";
380 pid = fork();
382 if (pid == 0) {
384 SetupEnvironment(scr);
386 #ifdef HAVE_SETSID
387 setsid();
388 #endif
389 execl(shell, shell, "-c", command, NULL);
390 werror("could not execute %s -c %s", shell, command);
391 Exit(-1);
392 } else if (pid < 0) {
393 werror("cannot fork a new process");
394 } else {
395 _tuple *data = wmalloc(sizeof(_tuple));
397 data->scr = scr;
398 data->command = wstrdup(command);
400 wAddDeathHandler(pid, (WDeathHandler *) shellCommandHandler, data);
405 *---------------------------------------------------------------------
406 * wAbort--
407 * Do a major cleanup and exit the program
409 *----------------------------------------------------------------------
411 void wAbort(Bool dumpCore)
413 int i;
414 WScreen *scr;
416 for (i = 0; i < wScreenCount; i++) {
417 scr = wScreenWithNumber(i);
418 if (scr)
419 RestoreDesktop(scr);
421 printf(_("%s aborted.\n"), ProgName);
422 if (dumpCore)
423 abort();
424 else
425 exit(1);
428 void print_help()
430 printf(_("Usage: %s [options]\n"), ProgName);
431 puts(_("The Window Maker window manager for the X window system"));
432 puts("");
433 puts(_(" -display host:dpy display to use"));
434 #ifdef USECPP
435 puts(_(" --no-cpp disable preprocessing of configuration files"));
436 #endif
437 puts(_(" --no-dock do not open the application Dock"));
438 puts(_(" --no-clip do not open the workspace Clip"));
439 puts(_(" --no-autolaunch do not autolaunch applications"));
440 puts(_(" --dont-restore do not restore saved session"));
442 puts(_(" --locale locale locale to use"));
444 puts(_(" --create-stdcmap create the standard colormap hint in PseudoColor visuals"));
445 puts(_(" --visual-id visualid visual id of visual to use"));
446 puts(_(" --static do not update or save configurations"));
447 #ifndef HAVE_INOTIFY
448 puts(_(" --no-polling do not periodically check for configuration updates"));
449 #endif
450 puts(_(" --version print version and exit"));
451 puts(_(" --help show this message"));
454 void check_defaults()
456 char *path;
458 path = wdefaultspathfordomain("WindowMaker");
460 if (access(path, R_OK) != 0) {
461 wwarning(_("could not find user GNUstep directory (%s)."), path);
463 if (system("wmaker.inst --batch") != 0) {
464 wwarning(_("There was an error while creating GNUstep directory, please "
465 "make sure you have installed Window Maker correctly and run wmaker.inst"));
466 } else {
467 wwarning(_("%s directory created with default configuration."), path);
471 wfree(path);
474 #ifdef HAVE_INOTIFY
476 * Add watch here, used to notify if configuration
477 * files have changed, using linux kernel inotify mechanism
480 static void inotifyWatchConfig()
482 char *watchPath = NULL;
483 inotifyFD = inotify_init(); /* Initialise an inotify instance */
484 if (inotifyFD < 0) {
485 wwarning(_("could not initialise an inotify instance."
486 " Changes to the defaults database will require"
487 " a restart to take effect. Check your kernel!"));
488 } else {
489 watchPath = wstrconcat(wusergnusteppath(), "/Defaults");
490 /* Add the watch; really we are only looking for modify events
491 * but we might want more in the future so check all events for now.
492 * The individual events are checked for in event.c.
494 inotifyWD = inotify_add_watch(inotifyFD, watchPath, IN_ALL_EVENTS);
495 if (inotifyWD < 0) {
496 wwarning(_("could not add an inotify watch on path %s."
497 "Changes to the defaults database will require"
498 " a restart to take effect."), watchPath);
499 close(inotifyFD);
502 wfree(watchPath);
504 #endif /* HAVE_INOTIFY */
506 static void execInitScript()
508 char *file, *paths;
510 paths = wstrconcat(wusergnusteppath(), "/Library/WindowMaker");
511 paths = wstrappend(paths, ":" DEF_CONFIG_PATHS);
513 file = wfindfile(paths, DEF_INIT_SCRIPT);
514 wfree(paths);
516 if (file) {
517 if (system(file) != 0) {
518 werror(_("%s:could not execute initialization script"), file);
520 wfree(file);
524 void ExecExitScript()
526 char *file, *paths;
528 paths = wstrconcat(wusergnusteppath(), "/Library/WindowMaker");
529 paths = wstrappend(paths, ":" DEF_CONFIG_PATHS);
531 file = wfindfile(paths, DEF_EXIT_SCRIPT);
532 wfree(paths);
534 if (file) {
535 if (system(file) != 0) {
536 werror(_("%s:could not execute exit script"), file);
538 wfree(file);
542 int main(int argc, char **argv)
544 int i_am_the_monitor, i, len;
545 char *str, *alt;
547 /* setup common stuff for the monitor and wmaker itself */
548 WMInitializeApplication("WindowMaker", &argc, argv);
550 memset(&wPreferences, 0, sizeof(WPreferences));
552 wPreferences.fallbackWMs = WMCreateArray(8);
553 alt = getenv("WINDOWMAKER_ALT_WM");
554 if (alt != NULL)
555 WMAddToArray(wPreferences.fallbackWMs, wstrdup(alt));
557 WMAddToArray(wPreferences.fallbackWMs, wstrdup("blackbox"));
558 WMAddToArray(wPreferences.fallbackWMs, wstrdup("metacity"));
559 WMAddToArray(wPreferences.fallbackWMs, wstrdup("fvwm"));
560 WMAddToArray(wPreferences.fallbackWMs, wstrdup("twm"));
561 WMAddToArray(wPreferences.fallbackWMs, NULL);
562 WMAddToArray(wPreferences.fallbackWMs, wstrdup("rxvt"));
563 WMAddToArray(wPreferences.fallbackWMs, wstrdup("xterm"));
565 i_am_the_monitor = 1;
567 for (i = 1; i < argc; i++) {
568 if (strncmp(argv[i], "--for-real", strlen("--for-real")) == 0) {
569 i_am_the_monitor = 0;
570 break;
571 } else if (strcmp(argv[i], "-display") == 0 || strcmp(argv[i], "--display") == 0) {
572 i++;
573 if (i >= argc) {
574 wwarning(_("too few arguments for %s"), argv[i - 1]);
575 exit(0);
577 DisplayName = argv[i];
581 DisplayName = XDisplayName(DisplayName);
582 len = strlen(DisplayName) + 64;
583 str = wmalloc(len);
584 snprintf(str, len, "DISPLAY=%s", DisplayName);
585 putenv(str);
587 if (i_am_the_monitor)
588 return MonitorLoop(argc, argv);
589 else
590 return real_main(argc, argv);
593 static int real_main(int argc, char **argv)
595 int i, restart = 0;
596 char *pos;
597 int d, s;
598 int flag;
600 setlocale(LC_ALL, "");
601 wsetabort(wAbort);
603 /* for telling WPrefs what's the name of the wmaker binary being ran */
604 setenv("WMAKER_BIN_NAME", argv[0], 1);
606 flag = 0;
607 ArgCount = argc;
608 Arguments = wmalloc(sizeof(char *) * (ArgCount + 1));
609 for (i = 0; i < argc; i++) {
610 Arguments[i] = argv[i];
612 /* add the extra option to signal that we're just restarting wmaker */
613 Arguments[argc - 1] = "--for-real=";
614 Arguments[argc] = NULL;
616 ProgName = strrchr(argv[0], '/');
617 if (!ProgName)
618 ProgName = argv[0];
619 else
620 ProgName++;
622 restart = 0;
624 if (argc > 1) {
625 for (i = 1; i < argc; i++) {
626 #ifdef USECPP
627 if (strcmp(argv[i], "-nocpp") == 0 || strcmp(argv[i], "--no-cpp") == 0) {
628 wPreferences.flags.nocpp = 1;
629 } else
630 #endif
631 if (strcmp(argv[i], "--for-real") == 0) {
632 wPreferences.flags.restarting = 0;
633 } else if (strcmp(argv[i], "--for-real=") == 0) {
634 wPreferences.flags.restarting = 1;
635 } else if (strcmp(argv[i], "--for-real-") == 0) {
636 wPreferences.flags.restarting = 2;
637 } else if (strcmp(argv[i], "-no-autolaunch") == 0
638 || strcmp(argv[i], "--no-autolaunch") == 0) {
639 wPreferences.flags.noautolaunch = 1;
640 } else if (strcmp(argv[i], "-dont-restore") == 0 || strcmp(argv[i], "--dont-restore") == 0) {
641 wPreferences.flags.norestore = 1;
642 } else if (strcmp(argv[i], "-nodock") == 0 || strcmp(argv[i], "--no-dock") == 0) {
643 wPreferences.flags.nodock = 1;
644 } else if (strcmp(argv[i], "-noclip") == 0 || strcmp(argv[i], "--no-clip") == 0) {
645 wPreferences.flags.noclip = 1;
646 } else if (strcmp(argv[i], "-version") == 0 || strcmp(argv[i], "--version") == 0) {
647 printf("Window Maker %s\n", VERSION);
648 exit(0);
649 } else if (strcmp(argv[i], "--global_defaults_path") == 0) {
650 printf("%s/%s\n", SYSCONFDIR, GLOBAL_DEFAULTS_SUBDIR);
651 exit(0);
652 } else if (strcmp(argv[i], "-locale") == 0 || strcmp(argv[i], "--locale") == 0) {
653 i++;
654 if (i >= argc) {
655 wwarning(_("too few arguments for %s"), argv[i - 1]);
656 exit(0);
658 Locale = argv[i];
659 } else if (strcmp(argv[i], "-display") == 0 || strcmp(argv[i], "--display") == 0) {
660 i++;
661 if (i >= argc) {
662 wwarning(_("too few arguments for %s"), argv[i - 1]);
663 exit(0);
665 DisplayName = argv[i];
666 } else if (strcmp(argv[i], "-visualid") == 0 || strcmp(argv[i], "--visual-id") == 0) {
667 i++;
668 if (i >= argc) {
669 wwarning(_("too few arguments for %s"), argv[i - 1]);
670 exit(0);
672 if (initWVisualID(argv[i]) != 0) {
673 wwarning(_("bad value for visualid: \"%s\""), argv[i]);
674 exit(0);
676 } else if (strcmp(argv[i], "-static") == 0 || strcmp(argv[i], "--static") == 0
677 #ifndef HAVE_INOTIFY
678 || strcmp(argv[i], "--no-polling") == 0
679 #endif
681 wPreferences.flags.noupdates = 1;
682 } else if (strcmp(argv[i], "--help") == 0) {
683 print_help();
684 exit(0);
685 } else {
686 printf(_("%s: invalid argument '%s'\n"), argv[0], argv[i]);
687 printf(_("Try '%s --help' for more information\n"), argv[0]);
688 exit(1);
693 if (!wPreferences.flags.noupdates) {
694 /* check existence of Defaults DB directory */
695 check_defaults();
698 if (Locale) {
699 setenv("LANG", Locale, 1);
700 } else {
701 Locale = getenv("LC_ALL");
702 if (!Locale) {
703 Locale = getenv("LANG");
707 setlocale(LC_ALL, "");
709 if (!Locale || strcmp(Locale, "C") == 0 || strcmp(Locale, "POSIX") == 0)
710 Locale = NULL;
711 #ifdef I18N
712 if (getenv("NLSPATH")) {
713 bindtextdomain("WindowMaker", getenv("NLSPATH"));
714 #if defined(MENU_TEXTDOMAIN)
715 bindtextdomain(MENU_TEXTDOMAIN, getenv("NLSPATH"));
716 #endif
717 } else {
718 bindtextdomain("WindowMaker", LOCALEDIR);
719 #if defined(MENU_TEXTDOMAIN)
720 bindtextdomain(MENU_TEXTDOMAIN, LOCALEDIR);
721 #endif
723 bind_textdomain_codeset("WindowMaker", "UTF-8");
724 #if defined(MENU_TEXTDOMAIN)
725 bind_textdomain_codeset(MENU_TEXTDOMAIN, "UTF-8");
726 #endif
727 textdomain("WindowMaker");
729 if (!XSupportsLocale()) {
730 wwarning(_("X server does not support locale"));
733 if (XSetLocaleModifiers("") == NULL) {
734 wwarning(_("cannot set locale modifiers"));
736 #endif
738 if (Locale) {
739 char *ptr;
741 Locale = wstrdup(Locale);
742 ptr = strchr(Locale, '.');
743 if (ptr)
744 *ptr = 0;
747 /* open display */
748 dpy = XOpenDisplay(DisplayName);
749 if (dpy == NULL) {
750 wfatal(_("could not open display \"%s\""), XDisplayName(DisplayName));
751 exit(1);
754 if (fcntl(ConnectionNumber(dpy), F_SETFD, FD_CLOEXEC) < 0) {
755 werror("error setting close-on-exec flag for X connection");
756 exit(1);
760 if (getWVisualID(0) < 0) {
762 * If unspecified, use default visual instead of waiting
763 * for wrlib/context.c:bestContext() that may end up choosing
764 * the "fake" 24 bits added by the Composite extension.
765 * This is required to avoid all sort of corruptions when
766 * composite is enabled, and at a depth other than 24.
768 setWVisualID(0, (int)DefaultVisual(dpy, DefaultScreen(dpy))->visualid);
771 /* check if the user specified a complete display name (with screen).
772 * If so, only manage the specified screen */
773 if (DisplayName)
774 pos = strchr(DisplayName, ':');
775 else
776 pos = NULL;
778 if (pos && sscanf(pos, ":%i.%i", &d, &s) == 2)
779 multiHead = False;
781 DisplayName = XDisplayName(DisplayName);
782 setenv("DISPLAY", DisplayName, 1);
784 wXModifierInitialize();
785 StartUp(!multiHead);
787 if (wScreenCount == 1)
788 multiHead = False;
790 execInitScript();
791 #ifdef HAVE_INOTIFY
792 inotifyWatchConfig();
793 #endif
794 EventLoop();
795 return -1;