diff options
author | sabetts <sabetts> | 2004-11-19 02:09:42 +0000 |
---|---|---|
committer | sabetts <sabetts> | 2004-11-19 02:09:42 +0000 |
commit | 4bbc65a39c7fb6c4b14dcb9c6bc22ba29ad148ba (patch) | |
tree | 02aed8e089c3b8409156f7f0cd6590d55e4c1545 /src/window.c | |
parent | 3597d7d9eaff4d51b8825b9eea443ce7db86c733 (diff) | |
download | ratpoison-4bbc65a39c7fb6c4b14dcb9c6bc22ba29ad148ba.zip |
* src/actions.c (set_vars): add maxundos
(push_frame_undo): new function
(pop_frame_undo): likewise
(initialize_default_keybindings): add binding for "undo"
(initialize_default_keybindings): add def alias for maxundos
(cmd_other): call set_active_window_force instead of
set_active_window
(cmd_v_split): push the frame set
(cmd_h_split): likewise
(cmd_only): likewise
(cmd_remove): likewise
(cmd_shrink): likewise
(cmd_tmpwm): likewise
(cmd_license): update copyright. Add build date and time.
(cmd_fselect): simplify code that returns the frame selected.
(fdump): new function
(cmd_fdump): call fdump to dump the screen's frame set.
(frestore): new function
(cmd_frestore): call frestore to restore the screen's frame set.
(cmd_sfdump): new function
(cmd_sdump): likewise
(set_maxundos): likewise
(cmd_cnext): likewise
(cmd_cprev): likewise
(cmd_inext): likewise
(cmd_iprev): likewise
(cmd_cother): likewise
(cmd_iother): likewise
(cmd_undo): likewise
(cmd_prompt): likewise
(cmd_describekey): likewise
(cmd_dedicate): likewise
* src/main.c (init_defaults): init maxundos to 20
(clean_up): free the undo history lists
* src/window.h (set_active_window_body): new function
(set_active_window_force): likewise
* src/window.c (set_active_window): new function
(set_active_window_force): likewise
(set_active_window_body): renamed from set_active_window
(set_active_window_body): Add code to handle dedicated frames.
* src/screen.h (screen_dump): new prototype
* src/screen.c (screen_dump): new function
* src/linkedlist.h (list_last): new macro
* src/group.h (group_last_window_by_class_complement): new prototype
(group_last_window_by_class): likewise
* src/group.c (group_last_window_by_class): new function
(group_last_window_by_class_complement): likewise
* src/globals.h (rp_frame_undos): new extern.
(rp_num_frame_undos): likewise
* src/globals.c (rp_frame_undos): new list.
(rp_num_frame_undos): new global
* src/frame.c (frame_new): init f->dedicated to 0.
* src/data.h (struct rp_frame): add dedicated member.
(struct rp_defaults): add maxundos member.
(struct rp_frame_undo): new struct.
* src/actions.c: new commands, cnext, cother, cprev,
Diffstat (limited to 'src/window.c')
-rw-r--r-- | src/window.c | 66 |
1 files changed, 64 insertions, 2 deletions
diff --git a/src/window.c b/src/window.c index 68e5963..5ba5454 100644 --- a/src/window.c +++ b/src/window.c @@ -455,11 +455,21 @@ is_transient_ancestor (rp_window *win, rp_window *transient_for) #endif /* In the current frame, set the active window to win. win will have focus. */ +void set_active_window (rp_window *win) +{ + set_active_window_body(win, 0); +} + +void set_active_window_force (rp_window *win) +{ + set_active_window_body(win, 1); +} + void -set_active_window (rp_window *win) +set_active_window_body (rp_window *win, int force) { rp_window *last_win; - rp_frame *frame; + rp_frame *frame, *last_frame = NULL; if (win == NULL) return; @@ -474,6 +484,54 @@ set_active_window (rp_window *win) { frame = screen_get_frame (win->scr, win->scr->current_frame); } + + if (frame->dedicated && !force) + { + /* Try to find a non-dedicated frame. */ + rp_frame *cur; + rp_screen *scr; + int done; + + scr = (rp_have_xinerama)?&screens[rp_current_screen]:win->scr; + done = 0; + + /* Try the only / current screen... */ + for (cur = list_next_entry (frame, &scr->frames, node); + cur != frame && !done; + cur = list_next_entry (cur, &scr->frames, node)) + { + if (!cur->dedicated) + { + set_active_frame (cur); + last_frame = frame; + frame = cur; + done = 1; + } + } + + /* If we have Xinerama, we can check *all* screens... */ + if (rp_have_xinerama && !done) + { + int i; + + for (i=0; i<num_screens && !done; i++) + { + if (scr == &screens[i]) continue; + list_for_each_entry (cur,&screens[i].frames,node) + { + if (!cur->dedicated) + { + set_active_frame (cur); + last_frame = frame; + frame = cur; + done = 1; /* Break outer loop. */ + break; /* Break inner loop. */ + } + } + } + } + } + last_win = set_frames_window (frame, win); if (last_win) PRINT_DEBUG (("last window: %s\n", window_name (last_win))); @@ -502,6 +560,10 @@ set_active_window (rp_window *win) XSync (dpy, False); + /* If we switched frame, go back to the old one. */ + if (last_frame) + set_active_frame (last_frame); + /* Call the switch window hook */ hook_run (&rp_switch_win_hook); } |