summaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/actions.c4
-rw-r--r--src/main.c32
-rw-r--r--src/manage.c11
3 files changed, 35 insertions, 12 deletions
diff --git a/src/actions.c b/src/actions.c
index 4c4f221..ab47586 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -2802,7 +2802,7 @@ cmd_tmpwm (int interactive, char *data)
have it. */
for (i=0; i<num_screens; i++)
{
- XSelectInput(dpy, RootWindow (dpy, i), 0);
+ XSelectInput(dpy, RootWindow (dpy, screens[i].screen_num), 0);
/* Unmap its key window */
XUnmapWindow (dpy, screens[i].key_window);
}
@@ -2843,7 +2843,7 @@ cmd_tmpwm (int interactive, char *data)
/* Enable the event selection on the root window. */
for (i=0; i<num_screens; i++)
{
- XSelectInput(dpy, RootWindow (dpy, i),
+ XSelectInput(dpy, RootWindow (dpy, screens[i].screen_num),
PropertyChangeMask | ColormapChangeMask
| SubstructureRedirectMask | SubstructureNotifyMask);
/* Map its key window */
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);
diff --git a/src/manage.c b/src/manage.c
index 059c480..f66f723 100644
--- a/src/manage.c
+++ b/src/manage.c
@@ -64,7 +64,16 @@ ungrab_prefix_key (Window w)
screen_info*
current_screen ()
{
- return &screens[rp_current_screen];
+ int i;
+
+ for (i=0; i<num_screens; i++)
+ {
+ if (screens[i].screen_num == rp_current_screen)
+ return &screens[i];
+ }
+
+ /* This should never happen. */
+ return &screens[0];
}
void