diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/actions.c | 19 | ||||
-rw-r--r-- | src/events.c | 4 | ||||
-rw-r--r-- | src/globals.c | 15 | ||||
-rw-r--r-- | src/globals.h | 3 | ||||
-rw-r--r-- | src/input.c | 4 | ||||
-rw-r--r-- | src/main.c | 3 | ||||
-rw-r--r-- | src/split.c | 6 | ||||
-rw-r--r-- | src/window.c | 3 |
8 files changed, 35 insertions, 22 deletions
diff --git a/src/actions.c b/src/actions.c index 700ffd1..f3485bb 100644 --- a/src/actions.c +++ b/src/actions.c @@ -1577,7 +1577,7 @@ cmd_resize (int interactive, char *data) if (num_frames (s) < 2) return NULL; XGetInputFocus (dpy, &fwin, &revert); - XSetInputFocus (dpy, s->key_window, RevertToPointerRoot, CurrentTime); + set_window_focus (s->key_window); /* Save the frameset in case the user aborts. */ bk = screen_copy_frameset (s); @@ -1623,7 +1623,7 @@ cmd_resize (int interactive, char *data) free (bk); hide_frame_indicator (); - XSetInputFocus (dpy, fwin, RevertToPointerRoot, CurrentTime); + set_window_focus (fwin); } else { @@ -1731,7 +1731,7 @@ cmd_license (int interactive, char *data) XMapRaised (dpy, s->help_window); XGetInputFocus (dpy, &fwin, &revert); - XSetInputFocus (dpy, s->help_window, RevertToPointerRoot, CurrentTime); + set_window_focus (s->help_window); /* Find the longest line. */ for(i=0; license_text[i]; i++) @@ -1762,7 +1762,7 @@ cmd_license (int interactive, char *data) /* Wait for a key press. */ XMaskEvent (dpy, KeyPressMask, &ev); XUnmapWindow (dpy, s->help_window); - XSetInputFocus (dpy, fwin, revert, CurrentTime); + set_window_focus (fwin); /* The help window overlaps the bar, so redraw it. */ if (current_screen()->bar_is_raised) @@ -1790,7 +1790,7 @@ cmd_help (int interactive, char *data) XMapRaised (dpy, s->help_window); XGetInputFocus (dpy, &fwin, &revert); - XSetInputFocus (dpy, s->help_window, RevertToPointerRoot, CurrentTime); + set_window_focus (s->help_window); XDrawString (dpy, s->help_window, s->normal_gc, 10, y + defaults.font->max_bounds.ascent, @@ -1877,7 +1877,7 @@ cmd_help (int interactive, char *data) XMaskEvent (dpy, KeyPressMask, &ev); XUnmapWindow (dpy, s->help_window); - XSetInputFocus (dpy, fwin, revert, CurrentTime); + set_window_focus (fwin); /* The help window overlaps the bar, so redraw it. */ if (current_screen()->bar_is_raised) @@ -3151,8 +3151,7 @@ cmd_tmpwm (int interactive, char *data) /* If no window has focus, give the key_window focus. */ if (current_window() == NULL) - XSetInputFocus (dpy, current_screen()->key_window, - RevertToPointerRoot, CurrentTime); + set_window_focus (current_screen()->key_window); /* And we're back in ratpoison. */ return NULL; @@ -3241,9 +3240,9 @@ cmd_fselect (int interactive, char *data) /* Read a key. */ XGetInputFocus (dpy, &fwin, &revert); - XSetInputFocus (dpy, s->key_window, RevertToPointerRoot, CurrentTime); + set_window_focus (s->key_window); read_key (&c, &mod, NULL, 0); - XSetInputFocus (dpy, fwin, RevertToPointerRoot, CurrentTime); + set_window_focus (fwin); /* Destroy our number windows and free the array. */ for (i=0; i<num_frames (s); i++) diff --git a/src/events.c b/src/events.c index 2ce6409..666c8bf 100644 --- a/src/events.c +++ b/src/events.c @@ -384,7 +384,7 @@ handle_key (rp_screen *s) alarm_signalled = 0; XGetInputFocus (dpy, &fwin, &revert); - XSetInputFocus (dpy, s->key_window, RevertToPointerRoot, CurrentTime); + set_window_focus (s->key_window); /* Change the mouse icon to indicate to the user we are waiting for more keystrokes */ @@ -399,7 +399,7 @@ handle_key (rp_screen *s) read_key (&keysym, &mod, NULL, 0); - XSetInputFocus (dpy, fwin, revert, CurrentTime); + set_window_focus (fwin); if (rat_grabbed) ungrab_rat(); diff --git a/src/globals.c b/src/globals.c index 2cc7d78..6284a66 100644 --- a/src/globals.c +++ b/src/globals.c @@ -81,3 +81,18 @@ struct rp_hook_db_entry rp_hook_db[]= {"switchgroup", &rp_switch_group_hook}, {NULL, NULL}}; +void +set_rp_window_focus (rp_window *win) +{ + PRINT_DEBUG (("Giving focus to '%s'\n", window_name (win))); + XSetInputFocus (dpy, win->w, + RevertToPointerRoot, CurrentTime); +} + +void +set_window_focus (Window window) +{ + PRINT_DEBUG (("Giving focus to %ld\n", window)); + XSetInputFocus (dpy, window, + RevertToPointerRoot, CurrentTime); +} diff --git a/src/globals.h b/src/globals.h index 0bb5ba2..c2166b1 100644 --- a/src/globals.h +++ b/src/globals.h @@ -136,4 +136,7 @@ extern struct list_head rp_switch_group_hook; extern struct rp_hook_db_entry rp_hook_db[]; +void set_rp_window_focus (rp_window *win); +void set_window_focus (Window window); + #endif diff --git a/src/input.c b/src/input.c index 31c901d..a0ee12c 100644 --- a/src/input.c +++ b/src/input.c @@ -397,7 +397,7 @@ get_more_input (char *prompt, char *preinput, update_input_window (s, line); XGetInputFocus (dpy, &fwin, &revert); - XSetInputFocus (dpy, s->input_window, RevertToPointerRoot, CurrentTime); + set_window_focus (s->input_window); /* XSync (dpy, False); */ for (;;) @@ -437,7 +437,7 @@ get_more_input (char *prompt, char *preinput, /* Clean up our line structure */ input_line_free (line); - XSetInputFocus (dpy, fwin, RevertToPointerRoot, CurrentTime); + set_window_focus (fwin); XUnmapWindow (dpy, s->input_window); return final_input; @@ -640,8 +640,7 @@ main (int argc, char *argv[]) /* If no window has focus, give the key_window focus. */ if (current_window() == NULL) - XSetInputFocus (dpy, current_screen()->key_window, - RevertToPointerRoot, CurrentTime); + set_window_focus (current_screen()->key_window); listen_for_events (); diff --git a/src/split.c b/src/split.c index 3345523..dfda926 100644 --- a/src/split.c +++ b/src/split.c @@ -859,8 +859,7 @@ set_active_frame (rp_frame *frame) focus. */ if(frame->win_number == EMPTY) { - XSetInputFocus (dpy, s->key_window, - RevertToPointerRoot, CurrentTime); + set_window_focus (s->key_window); } } @@ -883,8 +882,7 @@ blank_frame (rp_frame *frame) update_bar (s); /* Give the key window focus. */ - XSetInputFocus (dpy, current_screen()->key_window, - RevertToPointerRoot, CurrentTime); + set_window_focus (current_screen()->key_window); } void diff --git a/src/window.c b/src/window.c index 17098fe..1ac063c 100644 --- a/src/window.c +++ b/src/window.c @@ -345,8 +345,7 @@ give_window_focus (rp_window *win, rp_window *last_win) /* Finally, give the window focus */ rp_current_screen = win->scr->screen_num; - XSetInputFocus (dpy, win->w, - RevertToPointerRoot, CurrentTime); + set_rp_window_focus (win); XSync (dpy, False); } |