summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorsabetts <sabetts>2003-04-14 02:15:05 +0000
committersabetts <sabetts>2003-04-14 02:15:05 +0000
commitfd27c5399c536a4cc290eeb8a36c5f8b56374eec (patch)
tree4fe6868255ffc8748d1eda526c6175731d7987e4 /src/main.c
parent9165a8f99b67acf07f5a30e481885d72660026b7 (diff)
downloadratpoison-fd27c5399c536a4cc290eeb8a36c5f8b56374eec.zip
* src/main.c (init_screen): print the display string for
debugging. (main): parse the screen argument and process it.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/src/main.c b/src/main.c
index 43a65cd..9571ec6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -598,11 +598,10 @@ main (int argc, char *argv[])
init_defaults ();
init_window_stuff ();
- /* Initialize the screens */
+ /* Get the number of screens */
num_screens = ScreenCount (dpy);
- screens = (screen_info *)xmalloc (sizeof (screen_info) * num_screens);
- PRINT_DEBUG (("%d screens.\n", num_screens));
+ /* make sure the screen specified is valid. */
if (screen_arg)
{
if (screen_num < 0 || screen_num >= num_screens)
@@ -610,12 +609,25 @@ main (int argc, char *argv[])
fprintf (stderr, "%d is an invalid screen for the display\n", screen_num);
exit (EXIT_FAILURE);
}
+
+ /* we're only going to use one screen. */
+ num_screens = 1;
}
- for (i=0; i<num_screens; i++)
+ /* Initialize the screens */
+ screens = (screen_info *)xmalloc (sizeof (screen_info) * num_screens);
+ PRINT_DEBUG (("%d screens.\n", num_screens));
+
+ if (screen_arg)
+ {
+ init_screen (&screens[0], screen_num);
+ }
+ else
{
- init_screen (&screens[i], i);
- init_frame_list (&screens[i]);
+ for (i=0; i<num_screens; i++)
+ {
+ init_screen (&screens[i], i);
+ }
}
init_frame_lists ();
@@ -626,7 +638,7 @@ main (int argc, char *argv[])
if (screen_arg)
{
rp_current_screen = screen_num;
- scanwins (&screens[screen_num]);
+ scanwins (&screens[0]);
}
else
{
@@ -668,8 +680,8 @@ init_screen (screen_info *s, int screen_num)
there is already a WM running and the X Error handler will catch
it, terminating ratpoison. */
XSelectInput(dpy, RootWindow (dpy, screen_num),
- PropertyChangeMask | ColormapChangeMask
- | SubstructureRedirectMask | SubstructureNotifyMask );
+ PropertyChangeMask | ColormapChangeMask
+ | SubstructureRedirectMask | SubstructureNotifyMask );
XSync (dpy, False);
/* Create the numset for the frames. */
@@ -687,6 +699,8 @@ init_screen (screen_info *s, int screen_num)
sprintf(dot, ".%i", screen_num);
}
+ PRINT_DEBUG (("%s\n", s->display_string));
+
s->screen_num = screen_num;
s->root = RootWindow (dpy, screen_num);
s->def_cmap = DefaultColormap (dpy, screen_num);