From 8b6f270c70d8fa6898e7d6c3b9533026c757f48c Mon Sep 17 00:00:00 2001 From: sabetts Date: Sat, 7 Apr 2001 05:17:34 +0000 Subject: * src/split.h (hide_frame_indicator): new prototype (show_frame_indicator): likewise * src/split.c: include (split_frame): set the new_frame's window to NULL (split_frame): calls show_frame_indicator once the split is done. (set_active_frame): only call show_frame_indicator if the frame has no window or if we switched to a different frame. (update_frame_indicator): prints FRAME_STRING in the frame indicator window. (hide_frame_indicator): new function (show_frame_indicator): likewise * src/main.c (rp_rat_bits): new variable (rp_rat_mask_bits): likewise (alrm_handler): calls hide_frame_indicator (init_rat_cursor): new function (init_screen): calls init_rat_cursor * src/events.c (unmap_notify): calls set_active_frame if the window being unmapped was in the current frame (destroy_window): calls set_active_frame if the window being destroyed was in the current frame (grab_rat): new function (grab_rat): likewise (handle_key): calls grab_rat and ungrab_rat * src/data.h (struct screen_info): new variable rat * src/conf.h (FRAME_INDICATOR_TIMEOUT): new #define (FRAME_STRING): likewise (RAT_HEIGHT): likewise (RAT_WIDTH): likewise (RAT_HOT_X): likewise (RAT_HOT_Y): likewise * src/actions.h (cmd_curframe): new prototype * src/actions.c (initialize_default_keybindings): new key binds for "curframe" (user_commands): new command "curframe" (cmd_curframe): new function * src/split.c (remove_all_splits): only maximize the current window if there is one. (maximize_frame): remove unused code to retrieve the current screen_info. * src/actions.c (cmd_h_split): calls h_split_frame on the current frame. (cmd_v_split): likewise (cmd_only): even if the current frame is empty, call remove_all_splits. * src/split.c (maximize_frame): new function (create_initial_frame): calls maximize_frame to fill in the initial frame's fields. (num_frames): comment out (remove_frame): remove special case when there is only 1 frame left. * 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/main.c (main): calls init_frame_list (init_screen): create and map the frame_window * 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. --- src/events.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'src/events.c') diff --git a/src/events.c b/src/events.c index b0c9a1b..092e2bc 100644 --- a/src/events.c +++ b/src/events.c @@ -99,7 +99,10 @@ unmap_notify (XEvent *ev) XSync(dpy, False); - if (win == current_window()) cmd_other (NULL); + if (frame == rp_current_frame) + { + set_active_frame (frame); + } ignore_badwindow--; @@ -183,11 +186,11 @@ destroy_window (XDestroyWindowEvent *ev) frame = find_windows_frame (win); if (frame) cleanup_frame (frame); - if (win == current_window()) + if (frame == rp_current_frame) { PRINT_DEBUG ("Destroying the current window.\n"); - set_active_window (find_window_other ()); + set_active_frame (frame); unmanage (win); } else @@ -309,6 +312,20 @@ client_msg (XClientMessageEvent *ev) } } +static void +grab_rat () +{ + XGrabPointer (dpy, current_screen()->root, True, 0, + GrabModeAsync, GrabModeAsync, + None, current_screen()->rat, CurrentTime); +} + +static void +ungrab_rat () +{ + XUngrabPointer (dpy, CurrentTime); +} + static void handle_key (screen_info *s) { @@ -329,6 +346,10 @@ handle_key (screen_info *s) XGetInputFocus (dpy, &fwin, &revert); XSetInputFocus (dpy, s->key_window, RevertToPointerRoot, CurrentTime); + /* Change the mouse icon to indicate to the user we are waiting for + more keystrokes */ + grab_rat(); + read_key (&keysym, &mod, NULL, 0); if ((key_action = find_keybinding (keysym, mod))) @@ -352,6 +373,8 @@ handle_key (screen_info *s) free (msg); } + + ungrab_rat(); } void -- cgit v1.2.3