Re: About execf, and about moving frames

"Bernhard R. Link" <[email protected]>
Newsgroups gmane.comp.window-managers.ratpoison.devel
Message-ID <[email protected]>
* Shawn <[email protected]> [081010 22:59]:
> I believe this function already exists as frames_screen().

Indeed, and even nicer implemented than mine. But only static in
split.c and to get a proper error message it would be best when accessed
in actions.c.

How about the attched patch?

Hochachtungsvoll,
	Bernhard R. Link

_______________________________________________
Ratpoison-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/ratpoison-devel
ratpoison-swap-secure.diff (text/x-diff, 1.5 KB)
diff --git a/src/actions.c b/src/actions.c
index c7534bc..4187877 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -4185,12 +4185,20 @@ cmd_exchangeright (int interactive, struct cmdarg **args)
 cmdret *
 cmd_swap (int interactive, struct cmdarg **args)
 {
+  rp_screen *s;
   rp_frame *dest_frame;
   rp_frame *src_frame;
 
   dest_frame = ARG(0, frame);
   src_frame = args[1] ? ARG (1, frame) : current_frame();
-  
+
+  if (!rp_have_xinerama)
+    {
+      s = frames_screen(src_frame);
+      if (screen_find_frame_by_frame(s, dest_frame) == NULL)
+    	return cmdret_new (RET_FAILURE, "swap: frames on different screens");
+    }
+
   exchange_with_frame (current_screen(), src_frame, dest_frame);
 
   return cmdret_new (RET_SUCCESS, NULL);
diff --git a/src/frame.h b/src/frame.h
index 7fad406..611ecc0 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -42,4 +42,6 @@ rp_frame *frame_copy (rp_frame *frame);
 char *frame_dump (rp_frame *frame, rp_screen *screen);
 rp_frame *frame_read (char *str, rp_screen *screen);
 
+rp_screen *frames_screen (rp_frame *);
+
 #endif
diff --git a/src/split.c b/src/split.c
index 6a6773d..9b31b89 100644
--- a/src/split.c
+++ b/src/split.c
@@ -29,8 +29,6 @@
 #define VERTICALLY 0
 #define HORIZONTALLY 1
 
-static rp_screen *frames_screen(rp_frame *);
-
 static void
 update_last_access (rp_frame *frame)
 {
@@ -110,7 +108,7 @@ set_frames_window (rp_frame *frame, rp_window *win)
   return find_window_number (last_win);
 }
 
-static rp_screen *
+rp_screen *
 frames_screen (rp_frame *frame)
 {
   int i;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.