summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorsabetts <sabetts>2001-12-09 02:04:49 +0000
committersabetts <sabetts>2001-12-09 02:04:49 +0000
commit9c0fbfffd7268ce6a2c0a0263dded6f1fe6e72c9 (patch)
tree41cc210fa1de2f209f84d8ff79589ce3d925d7ab /src/main.c
parent917953c69be92a5be1b3c20f1cf64a3dac3fd40a (diff)
downloadratpoison-9c0fbfffd7268ce6a2c0a0263dded6f1fe6e72c9.zip
* src/events.c (handle_key): revert the focus immediately after
reading the key. * src/list.c (give_window_focus): update rp_current_frame when setting the window focus. * src/main.c (main): scan for windows in a seperate pass after initializing the screen structures. (init_screen): build a display string for each screen. (init_screen): remove the call to scanwins. * src/manage.c (current_screen): return the current screen using rp_current_screen. * src/split.h (init_frame_lists): new function * src/split.c (rp_window_frame_sentinel): remove. (rp_current_frame): remove. (frames_screen): new function (maximize_frame): use the frame's screen to find out the width and height of the display. (create_initial_frame): take a pointer to a screen_info as an argument. (init_frame_lists): new function (init_frame_list): take a pointer to a screen_info as an argument. (find_last_frame): take a pointer to a screen_info as an argument. * src/actions.c (spawn): Set the DISPLAY environment variable to point to the current screen. * src/data.h (struct screen_info): add display_string, rp_window_frame_sentinel, rp_current_frame. (rp_current_screen): new global (rp_current_frame): Remove. Dependant code uses screen_info.rp_current_frame.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/src/main.c b/src/main.c
index b9ac3e6..9671399 100644
--- a/src/main.c
+++ b/src/main.c
@@ -56,6 +56,7 @@ Atom rp_command;
Atom rp_command_request;
Atom rp_command_result;
+int rp_current_screen;
screen_info *screens;
int num_screens;
Display *dpy;
@@ -156,7 +157,7 @@ handler (Display *d, XErrorEvent *e)
XGetErrorText (d, e->error_code, error_msg + 7, sizeof (error_msg) - 7);
fprintf (stderr, "ratpoison: %s!\n", error_msg);
- marked_message (error_msg, 0, strlen (error_msg));
+ // marked_message (error_msg, 0, strlen (error_msg));
/* exit (EXIT_FAILURE); */
return 0;
@@ -472,22 +473,29 @@ main (int argc, char *argv[])
/* Setup ratpoison's internal structures */
init_defaults();
init_numbers ();
- init_window_list ();
- init_frame_list ();
- update_modifier_map ();
- initialize_default_keybindings ();
+ /* Initialize the screens */
num_screens = ScreenCount (dpy);
screens = (screen_info *)xmalloc (sizeof (screen_info) * num_screens);
-
PRINT_DEBUG ("%d screens.\n", num_screens);
- /* Initialize the screens */
for (i=0; i<num_screens; i++)
{
init_screen (&screens[i], i);
}
+ init_window_list ();
+ init_frame_lists ();
+ update_modifier_map ();
+ initialize_default_keybindings ();
+
+ /* Scan for windows */
+ rp_current_screen = 0;
+ for (i=0; i<num_screens; i++)
+ {
+ scanwins (&screens[i]);
+ }
+
read_startup_files ();
/* Indicate to the user that ratpoison has booted. */
@@ -523,6 +531,18 @@ init_screen (screen_info *s, int screen_num)
| SubstructureRedirectMask | SubstructureNotifyMask );
XSync (dpy, False);
+ /* Build the display string for each screen */
+ s->display_string = xmalloc (strlen(DisplayString (dpy)) + 21);
+ sprintf (s->display_string, "DISPLAY=%s", DisplayString (dpy));
+ if (strrchr (DisplayString (dpy), ':'))
+ {
+ char *dot;
+
+ dot = strrchr(s->display_string, '.');
+ if (dot)
+ sprintf(dot, ".%i", screen_num);
+ }
+
s->screen_num = screen_num;
s->root = RootWindow (dpy, screen_num);
s->def_cmap = DefaultColormap (dpy, screen_num);
@@ -573,8 +593,6 @@ init_screen (screen_info *s, int screen_num)
XSelectInput (dpy, s->help_window, KeyPressMask);
XSync (dpy, 0);
-
- scanwins (s);
}
void