Re: patch: push window to frame
Johannes Altmanninger <[email protected]> Sun, 07 Sep 2014 21:10:34 +0200
| Newsgroups | gmane.comp.window-managers.ratpoison.devel |
|---|---|
| Message-ID | <[email protected]> |
Now that I have played around with this a bit, it seems like a really great idea. Combined with pullwindow it would make working with many frames much easier. > I've bound the command to "h", which is the last letter of "push". I'd > like > to implement "pullwindow" the same way, and I'd like to bind it to "l" > (lower case "L"). This is currently bound, along with C-L, to > redisplay, so > maybe that's a bad idea (changing the binding). I think the bindings > for > push and pull should be thought through together. The names pushwindow and pullwindow seem good to me. Rebinding "l" shouldn't be a problem, in my experience it is rarely necessary but I don't know what's the policy for such things. I have modified the pushwindow function to not crash when there is either no window to reveal or I try to push an empty frame. When there is no window to reveal, I think the most obvious solution is to just swap the window, hence window_to_reveal = window_to_cover. diff --git a/src/actions.c b/src/actions.c index 7ce76c1..e7e261d 100644 --- a/src/actions.c +++ b/src/actions.c @@ -3693,8 +3693,12 @@ cmd_pushwindow (int interactive UNUSED, struct cmdarg **args) rp_frame *dest_frame = ARG(0, frame); rp_window *window_to_move = find_window_number(src_frame->win_number); + if (window_to_move == NULL) + return cmdret_new (RET_FAILURE, "pushwindow: no window to push"); rp_window *window_to_reveal = find_window_for_frame (src_frame); rp_window *window_to_cover = set_frames_window(dest_frame, window_to_move); + if (window_to_reveal == NULL) + window_to_reveal = window_to_cover; maximize (window_to_move); unhide_window (window_to_move); XRaiseWindow (dpy, window_to_move->w); @@ -3704,7 +3708,8 @@ cmd_pushwindow (int interactive UNUSED, struct cmdarg **args) set_frames_window(src_frame, window_to_reveal); maximize (window_to_reveal); unhide_window (window_to_reveal); - XRaiseWindow (dpy, window_to_reveal->w); + if (window_to_reveal != NULL) + XRaiseWindow (dpy, window_to_reveal->w); set_active_frame(src_frame, 0);