ratpoison-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RP] patch: push window to frame


From: Jeff Abrahamson
Subject: Re: [RP] patch: push window to frame
Date: Sun, 7 Sep 2014 21:21:40 +0200

Hi, Johannes.

Thanks much for the feedback and kind words, and thanks even more for noticing the bug. It occurs to me that I also forgot to test with transient windows. I'll send another patch. I'm just writing pullwindow tonight, and so there's a quick refactor involved, since I think the two use almost the same code.


Jeff Abrahamson
+33 6 24 40 01 57
+44 7920 594 255    <-- only if I'm in the UK

http://jeff.purple.com/
http://blog.purple.com/jeff/



On 7 September 2014 21:10, Johannes Altmanninger <address@hidden> wrote:

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);


reply via email to

[Prev in Thread] Current Thread [Next in Thread]