[hackers] [wmii] Restore windows from floating layer to their original Xinerama screen. Closes issue #70. || Kris Maglione

From: <hg_AT_suckless.org>
Date: Fri, 2 Oct 2009 21:07:24 +0000 (UTC)

changeset: 2515:1d4063200fb4
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Fri Oct 02 17:06:41 2009 -0400
files: cmd/wmii/area.c cmd/wmii/client.c cmd/wmii/column.c cmd/wmii/dat.h cmd/wmii/float.c cmd/wmii/fns.h cmd/wmii/message.c cmd/wmii/view.c
description:
Restore windows from floating layer to their original Xinerama screen. Closes issue #70.

diff -r 10caf8c39257 -r 1d4063200fb4 cmd/wmii/area.c
--- a/cmd/wmii/area.c Fri Oct 02 16:21:12 2009 -0400
+++ b/cmd/wmii/area.c Fri Oct 02 17:06:41 2009 -0400
@@ -291,9 +291,10 @@
                 return;
 
         v->sel = a;
- /* XXX: Multihead. */
- if(!a->floating)
+ if(!a->floating) {
                 v->selcol = area_idx(a);
+ v->selscreen = a->screen;
+ }
         if(a != old_a)
                 v->oldsel = nil;
 
diff -r 10caf8c39257 -r 1d4063200fb4 cmd/wmii/client.c
--- a/cmd/wmii/client.c Fri Oct 02 16:21:12 2009 -0400
+++ b/cmd/wmii/client.c Fri Oct 02 17:06:41 2009 -0400
@@ -613,7 +613,7 @@
                         }
                         else if(f->oldarea > 0) {
                                 wassel = (f == f->area->sel);
- area_moveto(view_findarea(f->view, f->oldarea, true),
+ area_moveto(view_findarea(f->view, f->oldscreen, f->oldarea, true),
                                             f);
                                 if(wassel)
                                         frame_focus(f);
diff -r 10caf8c39257 -r 1d4063200fb4 cmd/wmii/column.c
--- a/cmd/wmii/column.c Fri Oct 02 16:21:12 2009 -0400
+++ b/cmd/wmii/column.c Fri Oct 02 17:06:41 2009 -0400
@@ -107,6 +107,7 @@
 
         f->area = a;
         f->client->floating = false;
+ f->screen = a->screen;
         f->column = area_idx(a);
         frame_insert(f, pos);
         if(a->sel == nil)
diff -r 10caf8c39257 -r 1d4063200fb4 cmd/wmii/dat.h
--- a/cmd/wmii/dat.h Fri Oct 02 16:21:12 2009 -0400
+++ b/cmd/wmii/dat.h Fri Oct 02 17:06:41 2009 -0400
@@ -209,7 +209,9 @@
         Client* client;
         View* view;
         Area* area;
+ int oldscreen;
         int oldarea;
+ int screen;
         int column;
         ushort id;
         bool collapsed;
@@ -277,6 +279,7 @@
         Area* oldsel;
         Area* revert;
         int selcol;
+ int selscreen;
         bool dead;
         Rectangle *r;
         Rectangle *pad;
diff -r 10caf8c39257 -r 1d4063200fb4 cmd/wmii/float.c
--- a/cmd/wmii/float.c Fri Oct 02 16:21:12 2009 -0400
+++ b/cmd/wmii/float.c Fri Oct 02 17:06:41 2009 -0400
@@ -29,7 +29,7 @@
 
         v = f->view;
         a = f->area;
- sel = view_findarea(v, v->selcol, false);
+ sel = view_findarea(v, v->selscreen, v->selcol, false);
         oldsel = v->oldsel;
         pr = f->aprev;
 
@@ -203,7 +203,7 @@
         else if (selclient())
                 s = ownerscreen(selclient()->sel->r);
         else {
- sel = view_findarea(a->view, a->view->selcol, false);
+ sel = view_findarea(a->view, a->view->selscreen, a->view->selcol, false);
                 if (sel)
                         s = sel->screen;
         }
diff -r 10caf8c39257 -r 1d4063200fb4 cmd/wmii/fns.h
--- a/cmd/wmii/fns.h Fri Oct 02 16:21:12 2009 -0400
+++ b/cmd/wmii/fns.h Fri Oct 02 17:06:41 2009 -0400
@@ -270,7 +270,7 @@
 View* view_create(const char*);
 void view_destroy(View*);
 void view_detach(Frame*);
-Area* view_findarea(View*, int, bool);
+Area* view_findarea(View*, int, int, bool);
 void view_focus(WMScreen*, View*);
 bool view_fullscreen_p(View*, int);
 char* view_index(View*);
diff -r 10caf8c39257 -r 1d4063200fb4 cmd/wmii/message.c
--- a/cmd/wmii/message.c Fri Oct 02 16:21:12 2009 -0400
+++ b/cmd/wmii/message.c Fri Oct 02 17:06:41 2009 -0400
@@ -1003,7 +1003,7 @@
         Frame *f, *ff;
         Client *c;
         char *s;
- ulong i;
+ ulong i, scrn;
         int sym;
 
         s = msg_getword(m);
@@ -1041,9 +1041,9 @@
                 if(!a->floating)
                         to = v->floating;
                 else if(f->column)
- to = view_findarea(v, f->column, true);
+ to = view_findarea(v, f->screen, f->column, true);
                 else
- to = view_findarea(v, v->selcol, true);
+ to = view_findarea(v, v->selscreen, v->selcol, true);
                 break;
         case LTILDE:
                 if(a->floating)
@@ -1051,9 +1051,13 @@
                 to = v->floating;
                 break;
         default:
- if(!getulong(s, &i) || i == 0)
+ scrn = 0;
+ if(!getulong(s, &i))
+ if(2 != sscanf(s, "%lu:%lu", &scrn, &i))
+ return Ebadvalue;
+ if(i == 0 || scrn > nscreens)
                         return Ebadvalue;
- to = view_findarea(v, i, true);
+ to = view_findarea(v, scrn, i, true);
                 break;
         }
 
diff -r 10caf8c39257 -r 1d4063200fb4 cmd/wmii/view.c
--- a/cmd/wmii/view.c Fri Oct 02 16:21:12 2009 -0400
+++ b/cmd/wmii/view.c Fri Oct 02 17:06:41 2009 -0400
@@ -154,12 +154,14 @@
 }
 
 Area*
-view_findarea(View *v, int idx, bool create) {
+view_findarea(View *v, int screen, int idx, bool create) {
         Area *a;
 
- for(a=v->firstarea; a && --idx > 0; a=a->next)
+ assert(screen >= 0 && screen < nscreens);
+
+ for(a=v->areas[screen]; a && --idx > 0; a=a->next)
                 if(create && a->next == nil)
- return area_create(v, a, screen->idx, 0);
+ return area_create(v, a, screen, 0);
         return a;
 }
 
@@ -282,6 +284,7 @@
                         f->collapsed = false;
                         if(!f->area->floating) {
                                 f->oldarea = area_idx(f->area);
+ f->oldscreen = f->area->screen;
                                 area_moveto(v->floating, f);
                                 area_setsel(v->floating, f);
                         }else if(f->oldarea == -1)
Received on Fri Oct 02 2009 - 21:07:24 UTC

This archive was generated by hypermail 2.2.0 : Fri Oct 02 2009 - 21:12:05 UTC