Re: [dev] [dwm] Crazy Window Behavior

2011-09-06 Thread Bastien Dejean
Bogdan Ionuț a écrit :
 On Mon, Sep 5, 2011 at 17:10, Bastien Dejean esch...@gmail.com wrote:
   don't know if it's a known bug, but I stumble upon this crazy window
  behavior happening in floating layout.
 
  In the following video, I try to move and resize the window, then I hit
  MODKEY+space which is bound, in my config.h, to togglefloating, at this
 
 I can bet that it's uselessgap patch related.

Indeed.
Is there a rock solid version of that patch floating around?

-- 
Bastien



Re: [dev] [dwm] Crazy Window Behavior

2011-09-06 Thread Bogdan Ionuț
On Tue, Sep 6, 2011 at 11:29, Bastien Dejean esch...@gmail.com wrote:

 Bogdan Ionuț a écrit :
  On Mon, Sep 5, 2011 at 17:10, Bastien Dejean esch...@gmail.com wrote:
don't know if it's a known bug, but I stumble upon this crazy window
   behavior happening in floating layout.
  
   In the following video, I try to move and resize the window, then I hit
   MODKEY+space which is bound, in my config.h, to togglefloating, at this
  
  I can bet that it's uselessgap patch related.

 Indeed.
 Is there a rock solid version of that patch floating around?

 --
 Bastien


Try the patch attached.
--- a/config.def.h	2011-07-10 23:24:25.0 +0300
+++ b/config.def.h	2011-09-06 11:52:50.092771712 +0300
@@ -9,6 +9,7 @@ static const char selbordercolor[]  = #
 static const char selbgcolor[]  = #0066ff;
 static const char selfgcolor[]  = #ff;
 static const unsigned int borderpx  = 1;/* border pixel of windows */
+static const unsigned int gappx = 6;/* gap pixel between windows */
 static const unsigned int snap  = 32;   /* snap pixel */
 static const Bool showbar   = True; /* False means no bar */
 static const Bool topbar= True; /* False means bottom bar */
@@ -27,10 +28,10 @@ static const float mfact  = 0.55; /*
 static const Bool resizehints = True; /* True means respect size hints in tiled resizals */
 
 static const Layout layouts[] = {
-	/* symbol arrange function */
-	{ []=,  tile },/* first entry is default */
-	{ ,  NULL },/* no layout function means floating behavior */
-	{ [M],  monocle },
+	/* symbol gaps   arrange function */
+	{ []=,  True,  tile },/* first entry is default */
+	{ ,  False, NULL },/* no layout function means floating behavior */
+	{ [M],  False, monocle },
 };
 
 /* key definitions */
--- a/dwm.c	2011-07-10 23:24:25.0 +0300
+++ b/dwm.c	2011-09-06 11:52:12.212769335 +0300
@@ -119,6 +119,7 @@ typedef struct {
 
 typedef struct {
 	const char *symbol;
+	Bool addgaps;
 	void (*arrange)(Monitor *);
 } Layout;
 
@@ -470,7 +471,7 @@ checkotherwm(void) {
 void
 cleanup(void) {
 	Arg a = {.ui = ~0};
-	Layout foo = { , NULL };
+	Layout foo = { , False, NULL };
 	Monitor *m;
 
 	view(a);
@@ -1317,11 +1318,12 @@ resize(Client *c, int x, int y, int w, i
 void
 resizeclient(Client *c, int x, int y, int w, int h) {
 	XWindowChanges wc;
+	unsigned int gap = c-isfloating ? 0 : c-mon-lt[c-mon-sellt]-addgaps ? gappx : 0;
 
-	c-oldx = c-x; c-x = wc.x = x;
-	c-oldy = c-y; c-y = wc.y = y;
-	c-oldw = c-w; c-w = wc.width = w;
-	c-oldh = c-h; c-h = wc.height = h;
+	c-oldx = c-x; c-x = wc.x = x + gap;
+	c-oldy = c-y; c-y = wc.y = y + gap;
+	c-oldw = c-w; c-w = wc.width = w - (gap ? (x + w + (c-bw * 2) == c-mon-mx + c-mon-mw ? 2 : 1) * gap : 0);
+	c-oldh = c-h; c-h = wc.height = h - (gap ? (y + h + (c-bw * 2) == c-mon-my + c-mon-mh ? 2 : 1) * gap : 0);
 	wc.border_width = c-bw;
 	XConfigureWindow(dpy, c-win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, wc);
 	configure(c);


Re: [dev] [dwm] Crazy Window Behavior

2011-09-06 Thread Bogdan Ionuț
On Tue, Sep 6, 2011 at 11:29, Bastien Dejean esch...@gmail.com wrote:

 Bogdan Ionuț a écrit :
  On Mon, Sep 5, 2011 at 17:10, Bastien Dejean esch...@gmail.com wrote:
don't know if it's a known bug, but I stumble upon this crazy window
   behavior happening in floating layout.
  
   In the following video, I try to move and resize the window, then I hit
   MODKEY+space which is bound, in my config.h, to togglefloating, at this
  
  I can bet that it's uselessgap patch related.

 Indeed.
 Is there a rock solid version of that patch floating around?

 --
 Bastien

 Try the patch attached.
--- a/config.def.h	2011-07-10 23:24:25.0 +0300
+++ b/config.def.h	2011-09-06 11:52:50.092771712 +0300
@@ -9,6 +9,7 @@ static const char selbordercolor[]  = #
 static const char selbgcolor[]  = #0066ff;
 static const char selfgcolor[]  = #ff;
 static const unsigned int borderpx  = 1;/* border pixel of windows */
+static const unsigned int gappx = 6;/* gap pixel between windows */
 static const unsigned int snap  = 32;   /* snap pixel */
 static const Bool showbar   = True; /* False means no bar */
 static const Bool topbar= True; /* False means bottom bar */
@@ -27,10 +28,10 @@ static const float mfact  = 0.55; /*
 static const Bool resizehints = True; /* True means respect size hints in tiled resizals */
 
 static const Layout layouts[] = {
-	/* symbol arrange function */
-	{ []=,  tile },/* first entry is default */
-	{ ,  NULL },/* no layout function means floating behavior */
-	{ [M],  monocle },
+	/* symbol gaps   arrange function */
+	{ []=,  True,  tile },/* first entry is default */
+	{ ,  False, NULL },/* no layout function means floating behavior */
+	{ [M],  False, monocle },
 };
 
 /* key definitions */
--- a/dwm.c	2011-07-10 23:24:25.0 +0300
+++ b/dwm.c	2011-09-06 11:52:12.212769335 +0300
@@ -119,6 +119,7 @@ typedef struct {
 
 typedef struct {
 	const char *symbol;
+	Bool addgaps;
 	void (*arrange)(Monitor *);
 } Layout;
 
@@ -470,7 +471,7 @@ checkotherwm(void) {
 void
 cleanup(void) {
 	Arg a = {.ui = ~0};
-	Layout foo = { , NULL };
+	Layout foo = { , False, NULL };
 	Monitor *m;
 
 	view(a);
@@ -1317,11 +1318,12 @@ resize(Client *c, int x, int y, int w, i
 void
 resizeclient(Client *c, int x, int y, int w, int h) {
 	XWindowChanges wc;
+	unsigned int gap = c-isfloating ? 0 : c-mon-lt[c-mon-sellt]-addgaps ? gappx : 0;
 
-	c-oldx = c-x; c-x = wc.x = x;
-	c-oldy = c-y; c-y = wc.y = y;
-	c-oldw = c-w; c-w = wc.width = w;
-	c-oldh = c-h; c-h = wc.height = h;
+	c-oldx = c-x; c-x = wc.x = x + gap;
+	c-oldy = c-y; c-y = wc.y = y + gap;
+	c-oldw = c-w; c-w = wc.width = w - (gap ? (x + w + (c-bw * 2) == c-mon-mx + c-mon-mw ? 2 : 1) * gap : 0);
+	c-oldh = c-h; c-h = wc.height = h - (gap ? (y + h + (c-bw * 2) == c-mon-my + c-mon-mh ? 2 : 1) * gap : 0);
 	wc.border_width = c-bw;
 	XConfigureWindow(dpy, c-win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, wc);
 	configure(c);


Re: [dev] [dwm] Crazy Window Behavior

2011-09-06 Thread Bastien Dejean
Bogdan Ionuț a écrit :
   I can bet that it's uselessgap patch related.
  Indeed.
  Is there a rock solid version of that patch floating around?
 Try the patch attached.

In fact, I'm using this vesion.
To fix the aforementioned problem I had to change this line:

unsigned int gap = c-isfloating ? 0 : c-mon-lt[c-mon-sellt]-addgaps ? 
gappx : 0;

to:

unsigned int gap = (c-isfloating || 
!c-mon-lt[c-mon-sellt]-arrange) ? 0 : c-mon-lt[c-mon-sellt]-addgaps ? 
gappx : 0; 



Re: [dev] [dwm] Crazy Window Behavior

2011-09-06 Thread Connor Lane Smith
On 6 September 2011 10:29, Bastien Dejean esch...@gmail.com wrote:
 unsigned int gap = (c-isfloating || !c-mon-lt[c-mon-sellt]-arrange) ? 0 
 : c-mon-lt[c-mon-sellt]-addgaps ? gappx : 0;

Having to check (c-isfloating || !lt-arrange) everywhere seems like
a source of potential bugs. In fact, like 352 of vanilla dwm has such
a bug:

 if(resizehints || c-isfloating) {
 if(resizehints || c-isfloating || !c-mon-lt[c-mon-sellt]-arrange) {

But I think this is a symptom to a greater problem. Maybe a macro or
something might help.

cls



[dev] [dwm] Rotate the list of clients

2011-09-06 Thread Bastien Dejean
Hi,

Is there any patch to rotate the list of clients?
E.g. 0 becomes 1, 1 becomes 2, ..., n - 1 becomes 0.
(Same principle in the opposite direction.)

Sayonara,
-- 
Bastien



Re: [dev] [dwm] Rotate the list of clients

2011-09-06 Thread Pascal Wittmann
On 09/06/2011 02:57 PM, Bastien Dejean wrote:
 Hi,
 
 Is there any patch to rotate the list of clients?
 E.g. 0 becomes 1, 1 becomes 2, ..., n - 1 becomes 0.
 (Same principle in the opposite direction.)
 
 Sayonara,

Try this:

http://dwm.suckless.org/patches/movestack



signature.asc
Description: OpenPGP digital signature


Re: [dev] [dwm] Rotate the list of clients

2011-09-06 Thread Pascal Wittmann
On 09/06/2011 03:11 PM, Pascal Wittmann wrote:
 On 09/06/2011 02:57 PM, Bastien Dejean wrote:
 Hi,

 Is there any patch to rotate the list of clients?
 E.g. 0 becomes 1, 1 becomes 2, ..., n - 1 becomes 0.
 (Same principle in the opposite direction.)

 Sayonara,
 
 Try this:
 
 http://dwm.suckless.org/patches/movestack
 

Oh, sorry I misunderstood you… :(



signature.asc
Description: OpenPGP digital signature