[hackers] [wmii] Better Xinerama fullscreen support || Kris Maglione

From: <hg_AT_suckless.org>
Date: Fri, 17 Oct 2008 16:08:47 +0000 (UTC)

changeset: 2385:7156dbf89315
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Fri Oct 17 12:08:44 2008 -0400
files: cmd/wmii/Makefile cmd/wmii/area.c cmd/wmii/client.c cmd/wmii/dat.h cmd/wmii/ewmh.c cmd/wmii/float.c cmd/wmii/fns.h cmd/wmii/frame.c cmd/wmii/mouse.c cmd/wmii/view.c cmd/wmii9menu.c
description:
Better Xinerama fullscreen support

diff -r 1f19e60bd76c -r 7156dbf89315 cmd/wmii/Makefile
--- a/cmd/wmii/Makefile Fri Oct 17 10:39:13 2008 -0400
+++ b/cmd/wmii/Makefile Fri Oct 17 12:08:44 2008 -0400
@@ -32,6 +32,7 @@
         mouse \
         rule \
         printevent\
+ screen \
         utf \
         _util \
         view \
diff -r 1f19e60bd76c -r 7156dbf89315 cmd/wmii/area.c
--- a/cmd/wmii/area.c Fri Oct 17 10:39:13 2008 -0400
+++ b/cmd/wmii/area.c Fri Oct 17 12:08:44 2008 -0400
@@ -179,7 +179,7 @@
 
         assert(to->view == f->view);
 
- if(f->client->fullscreen && !to->floating)
+ if(f->client->fullscreen >= 0 && !to->floating)
                 return;
 
         from = f->area;
@@ -257,7 +257,7 @@
         f = a->sel;
         old_a = v->sel;
 
- if(view_fullscreen_p(v) && !a->floating)
+ if(!a->floating && view_fullscreen_p(v, a->screen))
                 return;
 
         v->sel = a;
diff -r 1f19e60bd76c -r 7156dbf89315 cmd/wmii/client.c
--- a/cmd/wmii/client.c Fri Oct 17 10:39:13 2008 -0400
+++ b/cmd/wmii/client.c Fri Oct 17 12:08:44 2008 -0400
@@ -97,6 +97,7 @@
         int depth;
 
         c = emallocz(sizeof *c);
+ c->fullscreen = -1;
         c->border = wa->border_width;
 
         c->r.min = Pt(wa->x, wa->y);
@@ -381,7 +382,7 @@
             || c->fixedsize
             || c->titleless
             || c->borderless
- || c->fullscreen
+ || c->fullscreen >= 0
             || (c->w.ewmh.type & (TypeDialog|TypeSplash|TypeDock));
 }
 
@@ -593,14 +594,14 @@
         bool wassel;
         
         if(fullscreen == Toggle)
- fullscreen = c->fullscreen ^ On;
- if(fullscreen == c->fullscreen)
+ fullscreen = (c->fullscreen >= 0) ^ On;
+ if(fullscreen == (c->fullscreen >= 0))
                 return;
 
         event("Fullscreen %C %s\n", c, (fullscreen ? "on" : "off"));
- c->fullscreen = fullscreen;
         ewmh_updatestate(c);
 
+ c->fullscreen = -1;
         if(!fullscreen)
                 for(f=c->frame; f; f=f->cnext) {
                         if(f->oldarea == 0) {
@@ -617,6 +618,7 @@
                         }
                 }
         else {
+ c->fullscreen = ownerscreen(c->r);
                 for(f=c->frame; f; f=f->cnext)
                         f->oldarea = -1;
                 if((f = c->sel))
diff -r 1f19e60bd76c -r 7156dbf89315 cmd/wmii/dat.h
--- a/cmd/wmii/dat.h Fri Oct 17 10:39:13 2008 -0400
+++ b/cmd/wmii/dat.h Fri Oct 17 12:08:44 2008 -0400
@@ -177,16 +177,16 @@
         char name[256];
         char tags[256];
         char props[512];
+ long proto;
         uint border;
- long proto;
+ int fullscreen;
+ int unmapped;
         char floating;
         char fixedsize;
- char fullscreen;
         char urgent;
         char borderless;
         char titleless;
         char noinput;
- int unmapped;
 };
 
 struct Divide {
diff -r 1f19e60bd76c -r 7156dbf89315 cmd/wmii/ewmh.c
--- a/cmd/wmii/ewmh.c Fri Oct 17 10:39:13 2008 -0400
+++ b/cmd/wmii/ewmh.c Fri Oct 17 12:08:44 2008 -0400
@@ -445,7 +445,7 @@
         i = 0;
         if(f->collapsed)
                 state[i++] = STATE("SHADED");
- if(c->fullscreen)
+ if(c->fullscreen >= 0)
                 state[i++] = STATE("FULLSCREEN");
         if(c->urgent)
                 state[i++] = STATE("DEMANDS_ATTENTION");
diff -r 1f19e60bd76c -r 7156dbf89315 cmd/wmii/float.c
--- a/cmd/wmii/float.c Fri Oct 17 10:39:13 2008 -0400
+++ b/cmd/wmii/float.c Fri Oct 17 12:08:44 2008 -0400
@@ -173,7 +173,7 @@
         if(c->trans)
                 return;
         */
- if(c->fullscreen || c->w.hints->position || starting) {
+ if(c->fullscreen >= 0 || c->w.hints->position || starting) {
                 f->r = f->floatr;
                 return;
         }
diff -r 1f19e60bd76c -r 7156dbf89315 cmd/wmii/fns.h
--- a/cmd/wmii/fns.h Fri Oct 17 10:39:13 2008 -0400
+++ b/cmd/wmii/fns.h Fri Oct 17 12:08:44 2008 -0400
@@ -236,6 +236,9 @@
 /* printevent.c */
 void printevent(XEvent*);
 
+/* screen.c */
+int ownerscreen(Rectangle);
+
 /* rule.c */
 void trim(char *str, const char *chars);
 void update_rules(Rule**, const char*);
@@ -248,7 +251,7 @@
 void view_detach(Frame*);
 Area* view_findarea(View*, int, bool);
 void view_focus(WMScreen*, View*);
-bool view_fullscreen_p(View*);
+bool view_fullscreen_p(View*, int);
 char* view_index(View*);
 void view_init(View*, int iscreen);
 char** view_names(void);
diff -r 1f19e60bd76c -r 7156dbf89315 cmd/wmii/frame.c
--- a/cmd/wmii/frame.c Fri Oct 17 10:39:13 2008 -0400
+++ b/cmd/wmii/frame.c Fri Oct 17 12:08:44 2008 -0400
@@ -298,7 +298,7 @@
 }
 
 #define ADJ(PE, ME) \
- if(c->fullscreen) \
+ if(c->fullscreen >= 0) \
                 return r; \
                                                      \
         if(!floating) { \
@@ -350,9 +350,9 @@
         }
 
         c = f->client;
- if(c->fullscreen) {
- f->crect = screen->r;
- f->r = screen->r;
+ if(c->fullscreen >= 0) {
+ f->crect = screens[c->fullscreen]->r;
+ f->r = rectsetorigin(f->crect, ZP);
                 return;
         }
 
diff -r 1f19e60bd76c -r 7156dbf89315 cmd/wmii/mouse.c
--- a/cmd/wmii/mouse.c Fri Oct 17 10:39:13 2008 -0400
+++ b/cmd/wmii/mouse.c Fri Oct 17 12:08:44 2008 -0400
@@ -362,7 +362,7 @@
         Frame *f;
 
         f = c->sel;
- if(f->client->fullscreen)
+ if(f->client->fullscreen >= 0)
                 return;
         if(!f->area->floating) {
                 if(align==Center)
diff -r 1f19e60bd76c -r 7156dbf89315 cmd/wmii/view.c
--- a/cmd/wmii/view.c Fri Oct 17 10:39:13 2008 -0400
+++ b/cmd/wmii/view.c Fri Oct 17 12:08:44 2008 -0400
@@ -46,11 +46,11 @@
 }
 
 bool
-view_fullscreen_p(View *v) {
+view_fullscreen_p(View *v, int scrn) {
         Frame *f;
 
         for(f=v->floating->frame; f; f=f->anext)
- if(f->client->fullscreen)
+ if(f->client->fullscreen == scrn)
                         return true;
         return false;
 }
@@ -269,7 +269,6 @@
         Client *c;
         Frame *f;
         Area *a;
- bool fscrn;
         int s;
 
         if(v != selview)
@@ -280,11 +279,9 @@
         frames_update_sel(v);
         view_arrange(v);
 
- fscrn = false;
         foreach_frame(v, s, a, f)
- if(f->client->fullscreen) {
+ if(f->client->fullscreen >= 0) {
                         f->collapsed = false;
- fscrn = true;
                         if(!f->area->floating) {
                                 f->oldarea = area_idx(f->area);
                                 area_moveto(v->floating, f);
@@ -308,7 +305,7 @@
         }
 
         view_restack(v);
- if(fscrn)
+ if(!v->sel->floating && view_fullscreen_p(v, v->sel->screen))
                 area_focus(v->floating);
         else
                 area_focus(v->sel);
@@ -427,13 +424,11 @@
         Divide *d;
         Frame *f;
         Area *a;
- bool fscrn;
         
         if(v != selview)
                 return;
 
         wins.n = 0;
- fscrn = view_fullscreen_p(v);
 
         /* *sigh */
         for(f=v->floating->stack; f; f=f->snext)
@@ -442,14 +437,11 @@
                 else
                         break;
 
- if(!fscrn)
- vector_lpush(&wins, screen->barwin->w);
-
         for(; f; f=f->snext)
                 vector_lpush(&wins, f->client->framewin->w);
 
- if(fscrn)
- vector_lpush(&wins, screen->barwin->w);
+ for(int s=0; s < nscreens; s++)
+ vector_lpush(&wins, screens[s]->barwin->w);
 
         for(d = divs; d && d->w->mapped; d = d->next)
                 vector_lpush(&wins, d->w->w);
diff -r 1f19e60bd76c -r 7156dbf89315 cmd/wmii9menu.c
--- a/cmd/wmii9menu.c Fri Oct 17 10:39:13 2008 -0400
+++ b/cmd/wmii9menu.c Fri Oct 17 12:08:44 2008 -0400
@@ -213,7 +213,7 @@
                 wide = max(wide, textwidth(font, labels[i]));
         wide += font->height & ~1;
 
- size_window(wide, high * i);
+ size_window(wide, high);
         warpmouse(wide, high);
 
         for(;;) {
@@ -248,7 +248,8 @@
                 case Expose:
                         redraw(high, wide);
                         break;
- case MappingNotify: /* why do we get this? */
+ case ConfigureNotify:
+ case MappingNotify:
                         break;
                 }
         }
@@ -277,16 +278,18 @@
 void
 size_window(int wide, int high)
 {
+ Rectangle r;
         Point p;
         int h;
 
         h = high * numitems;
+ r = Rect(0, 0, wide, h);
 
         p = querypointer(&scr.root);
         p.x -= wide / 2;
         if(p.x < 0)
                 p.x = 0;
- else if(p.x + wide > Dy(scr.rect))
+ else if(p.x + wide > Dx(scr.rect))
                 p.x = Dy(scr.rect) - wide;
 
         p.y -= cur * high + high / 2;
@@ -295,7 +298,7 @@
         else if(p.y + h > Dy(scr.rect))
                 p.y = Dy(scr.rect) - h;
 
- reshapewin(menuwin, Rpt(p, addpt(p, Pt(wide, high))));
+ reshapewin(menuwin, rectaddpt(r, p));
 
         //XSetWindowBackground(display, menuwin->w, cnorm.bg);
         setborder(menuwin, 1, cnorm.border);
Received on Fri Oct 17 2008 - 16:08:47 UTC

This archive was generated by hypermail 2.2.0 : Fri Oct 17 2008 - 16:12:07 UTC