diff options
author | sabetts <sabetts> | 2001-04-06 07:43:17 +0000 |
---|---|---|
committer | sabetts <sabetts> | 2001-04-06 07:43:17 +0000 |
commit | 4ef01dc374bd76295e7a46140591e516187e33df (patch) | |
tree | 0534514c60d47f7ed7640091840516bef51273a0 /src/events.c | |
parent | b5272706dbd9346033add6edee2aaa519f11b182 (diff) | |
download | ratpoison-4ef01dc374bd76295e7a46140591e516187e33df.zip |
* src/split.h (h_split_frame): renamed frome h_split_window
(v_split_frame): renamed frome v_split_window
(split_frame): renamed frome split_window
(remove_all_splits): renamed frome remove_all_frames
(find_windows_frame): new prototype
(find_frame_next): likewise
(find_frame_prev): likewise
(current_window): likewise
(init_frame_list): likewise
(set_active_frame): likewise
* src/split.c (create_initial_frame): new function
(init_frame_list): likewise
(find_windows_frame): likewise
(find_frame_next): likewise
(find_frame_prev): likewise
(current_window): likewise
(update_frame_indicator): likewise
(set_active_frame): likewise
(split_frame): rename from split_window
(v_split_frame): rename from v_split_window
(h_split_frame): rename from h_split_window
(remove_all_splits): renamed frome remove_all_frames
(total_frame_area): traverses rp_window_frame list
(num_frames): likewise
(frame_overlaps): likewise
(remove_frame): likewise
(remove_frame): calls delete_frame_from_list
* src/manage.c (scanwins): skips the frame_window
(maximize_transient): finds the window's frame
(maximize_normal): likewise
* src/main.c (main): calls init_frame_list
(init_screen): create and map the frame_window
* src/list.c (give_window_focus): new function
(goto_window): likewise
(set_active_window): calls give_window_focus
* src/list.h (give_window_focus): new prototype
(goto_window): likewise
* src/events.c (new_window): the screen's frame_window is not
managed
(cleanup_frame): new function
(unmap_notify): calls cleanup_frame if window exists in a frame
(destroy_window): likewise
* src/data.h (struct screen_info): remove frame field
(struct rp_window_frame): new fields win, prev, next
(rp_window_frame_sentinel): new global
* src/actions.c (cmd_prev): jumps to last accessed window if
current frame is empty.
(cmd_next): likewise
(cmd_remove): nothing is done if only 1 frame exists
* src/data.h (struct screen_info): new field frame_window
(rp_current_frame): new global
(rp_current_window): removed. All dependant code updated.
Diffstat (limited to 'src/events.c')
-rw-r--r-- | src/events.c | 75 |
1 files changed, 22 insertions, 53 deletions
diff --git a/src/events.c b/src/events.c index cbf6cd7..b0c9a1b 100644 --- a/src/events.c +++ b/src/events.c @@ -48,13 +48,19 @@ new_window (XCreateWindowEvent *e) win = find_window (e->window); if (s && !win && e->window != s->key_window && e->window != s->bar_window - && e->window != s->input_window) + && e->window != s->input_window && e->window != s->frame_window) { win = add_to_window_list (s, e->window); update_window_information (win); } } +static void +cleanup_frame (rp_window_frame *frame) +{ + frame->win = find_window_other (); +} + void unmap_notify (XEvent *ev) { @@ -68,6 +74,7 @@ unmap_notify (XEvent *ev) if (s && win) { + rp_window_frame *frame; long data[2] = { WithdrawnState, None }; /* Give back the window number. the window will get another one, @@ -78,52 +85,8 @@ unmap_notify (XEvent *ev) ignore_badwindow++; - if (win->frame) - { - rp_window *new_window; - - PRINT_DEBUG ("unmapping framed window.\n"); - - new_window = find_window_for_frame (win->frame); - if (new_window) - { - PRINT_DEBUG ("Found a window to fit the frame.\n"); - - new_window->frame = xmalloc (sizeof (rp_window_frame)); - memcpy (new_window->frame, win->frame, sizeof (rp_window_frame)); - maximize (new_window); - XRaiseWindow (dpy, new_window->w); - - if (win == rp_current_window) - { - set_active_window (new_window); - } - } - else - { - PRINT_DEBUG ("No window to fit the frame.\n"); - - /* We coudn't find a window to occupy the frame, so get - rid of it. */ - remove_frame (win); - new_window = find_window_next_with_frame (rp_current_window); - if (new_window) - { - set_active_window (new_window); - } - else - { - set_active_window (find_window_other()); - } - } - - free (win->frame); - win->frame = NULL; - } - else if (rp_current_window == win) - { - cmd_other (NULL); - } + frame = find_windows_frame (win); + if (frame) cleanup_frame (frame); remove_from_list (win); append_to_list (win, rp_unmapped_window_sentinel); @@ -136,6 +99,8 @@ unmap_notify (XEvent *ev) XSync(dpy, False); + if (win == current_window()) cmd_other (NULL); + ignore_badwindow--; update_window_names (s); @@ -213,11 +178,15 @@ destroy_window (XDestroyWindowEvent *ev) if (win) { - if (win == rp_current_window) + rp_window_frame *frame; + + frame = find_windows_frame (win); + if (frame) cleanup_frame (frame); + + if (win == current_window()) { PRINT_DEBUG ("Destroying the current window.\n"); - rp_current_window = NULL; set_active_window (find_window_other ()); unmanage (win); } @@ -409,11 +378,11 @@ key_press (XEvent *ev) } else { - if (rp_current_window) + if (current_window()) { ignore_badwindow++; - ev->xkey.window = rp_current_window->w; - XSendEvent (dpy, rp_current_window->w, False, KeyPressMask, ev); + ev->xkey.window = current_window()->w; + XSendEvent (dpy, current_window()->w, False, KeyPressMask, ev); XSync (dpy, False); ignore_badwindow--; } @@ -557,7 +526,7 @@ colormap_notify (XEvent *ev) XGetWindowAttributes (dpy, win->w, &attr); win->colormap = attr.colormap; - if (win == rp_current_window) + if (win == current_window()) { XInstallColormap (dpy, win->colormap); } |