From 9c0fbfffd7268ce6a2c0a0263dded6f1fe6e72c9 Mon Sep 17 00:00:00 2001 From: sabetts Date: Sun, 9 Dec 2001 02:04:49 +0000 Subject: * 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. --- src/main.c | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) (limited to 'src/main.c') 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; idisplay_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 -- cgit v1.2.3