summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--NEWS4
-rw-r--r--src/actions.c4
-rw-r--r--src/main.c32
-rw-r--r--src/manage.c11
5 files changed, 45 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index fb9ebeb..cb8933f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2003-04-13 Shawn Betts <sabetts@sfu.ca>
+ * src/main.c (init_screen): print the display string for
+ debugging.
+
+ * src/manage.c (current_screen): search for the current screen
+ using rp_current_screen.
+
* src/main.c (main): add switch case for the display command line
option.
(print_help): add --display option. Add text to demonstrate
diff --git a/NEWS b/NEWS
index bf7171c..940e020 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,10 @@
ratpoison NEWS --- history of user-visible changes. -*- outline -*-
* Changes since 1.2.0-beta3
+** new command line argumen --screen
+Now you can specify the screen you want to manage. By default
+ratpoison manages all screens on the display.
+
** new command line argument --display
Now you can specify the display to connect to.
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