[dwm] patch on movemouse/resizemouse

2008-10-07 Thread Peter Kosyh

Hi all!
I am not sure, if my patch is *right way*, but it helps me to avoid
lags/memory effect and high cpu usage while movemouse/resizemouse on my 
system.

Hopes, it will help for someone... :)

Thanx for dwm. :)

w.b.r Peter
diff -Nur dwm-5.2/dwm.c dwm-5.2.moveresize/dwm.c
--- dwm-5.2/dwm.c	2008-09-09 23:46:17.0 +0400
+++ dwm-5.2.moveresize/dwm.c	2008-10-07 13:10:07.0 +0400
@@ -961,6 +961,8 @@
 			break;
 		case MotionNotify:
 			XSync(dpy, False);
+			if (XCheckMaskEvent(dpy, MOUSEMASK, ev))
+break;
 			nx = ocx + (ev.xmotion.x - x);
 			ny = ocy + (ev.xmotion.y - y);
 			if(snap  nx = wx  nx = wx + ww
@@ -1130,9 +1132,10 @@
 			break;
 		case MotionNotify:
 			XSync(dpy, False);
+			if (XCheckMaskEvent(dpy, MOUSEMASK, ev))
+break;
 			nw = MAX(ev.xmotion.x - NOBORDER(ocx) + 1, 1);
 			nh = MAX(ev.xmotion.y - NOBORDER(ocy) + 1, 1);
-
 			if(snap  nw = wx  nw = wx + ww
 			 nh = wy  nh = wy + wh) {
 if(!c-isfloating  lt[sellt]-arrange


Re: [dwm] patch on movemouse/resizemouse

2008-10-07 Thread Claudio M. Alessi
On Tue, Oct 07, 2008 at 02:18:35PM +0400, Peter Kosyh wrote:
 Hopes, it will help for someone... :)
No changes here: i still have an high CPU usage while resizing (not
moving) clients.

Claudio M. Alessi

-- 
JID: [EMAIL PROTECTED]
WWW: http://dinotte.altervista.org

-BEGIN GEEK CODE BLOCK-
Version: 3.1
GCS/MU d-@ s: a-- C++(+++) UB++$ P+ !L E--- W++(+++)
N+@ o-- K? w+@ O-@ M- V? PS+@ PE+@ Y+ PGP t(-)@ 5?
X+ R? tv-- b+ DI-- D? G e+@ h--@ r y*
--END GEEK CODE BLOCK--




Re: [dwm] patch on movemouse/resizemouse

2008-10-07 Thread Peter Kosyh
Hm... I can't say it's not high... On my notebook system now i can use
move and resize without lags and without gaining to higher CPU
clock speed, but ok, it is still high, i think. 

На Tue, Oct 07, 2008 at 01:27:41PM +0200, Claudio M. Alessi писал(а):
 On Tue, Oct 07, 2008 at 02:18:35PM +0400, Peter Kosyh wrote:
  Hopes, it will help for someone... :)
 No changes here: i still have an high CPU usage while resizing (not
 moving) clients.
 
 Claudio M. Alessi
 
 -- 
 JID: [EMAIL PROTECTED]
 WWW: http://dinotte.altervista.org
 
 -BEGIN GEEK CODE BLOCK-
 Version: 3.1
 GCS/MU d-@ s: a-- C++(+++) UB++$ P+ !L E--- W++(+++)
 N+@ o-- K? w+@ O-@ M- V? PS+@ PE+@ Y+ PGP t(-)@ 5?
 X+ R? tv-- b+ DI-- D? G e+@ h--@ r y*
 --END GEEK CODE BLOCK--
 
 



Re: [dwm] [dvtm] testing current git HEAD aka dvtm-0.5-rc1

2008-10-07 Thread Marc Andre Tanner
On Tue, Oct 07, 2008 at 02:12:52AM +0200, Claudio M. Alessi wrote:
 
 Hi,
i gave a quick try to the git HEAD and i found that something doesn't
 work properly. I toggled the CONFIG_CMDFIFO constant in config.mk and i
 had to change the following line 626 to this one:
 
const char *env[] = { NULL };
 
 Now i get lots of errors about moving/resize. I'm playing around a bit
 from about 5 minutes so i didn't figure out what's the problem, yet.
 I'll play more with dvtm tomorrow and i'll eventually post here other
 bugs and/or some patches.

Thanks for testing! I have fixed the issues, guess i should introduce a
randconfig script like the kernel does ;) Unfortunately repo.or.cz seems
to be down so I couldn't push the changes. 

 I would like to suggest the scripting support to be disabled by default.

I have no strong feeling about it, lets wait and see whether someone
steps up who would like it enabled by default. 

 THX for the scrollback!

Thanks, the patch was from Donald Chai.

 Just another thing about the top stack layout which, for istance, is the
 only layout i use. If i'm not alone it would be very appreciated to have
 it included somewhere into the official tarball.

Could you please post a link to the source, i am too lazy to search ;)

Regards,
Marc

-- 
 Marc Andre Tanner  http://www.brain-dump.org/  GPG key: CF7D56C0



[dwm] [patch] move clients in layout

2008-10-07 Thread Niki Yoshiuchi
Hello!  This is my first message to this mailing list so I thought I'd start
by contributing a patch.  This patch allows you to move clients around to
reposition them in a tiled layout.  The behavior is meant to emulate
Xmonad's mod-shift-k and mod-shift-j.  m-s-j swaps a client with the next
visible, tiled client in the clients list.  m-s-k swaps the client with the
previous.

I hope some of you find this useful and I certainly hope to contribute more
in the future.

-Niki Yoshiuchi
diff -ruN dwm/config.def.h movestack/config.def.h
--- dwm/config.def.h	2008-10-04 15:57:46.0 -0400
+++ movestack/config.def.h	2008-10-05 17:13:15.0 -0400
@@ -50,6 +50,7 @@
 static const char *dmenucmd[] = { dmenu_run, -fn, font, -nb, normbgcolor, -nf, normfgcolor, -sb, selbgcolor, -sf, selfgcolor, NULL };
 static const char *termcmd[]  = { uxterm, NULL };
 
+#include movestack.c
 static Key keys[] = {
 	/* modifier keyfunctionargument */
 	{ MODKEY,   XK_p,  spawn,  {.v = dmenucmd } },
@@ -59,6 +60,8 @@
 	{ MODKEY,   XK_k,  focusstack, {.i = -1 } },
 	{ MODKEY,   XK_h,  setmfact,   {.f = -0.05} },
 	{ MODKEY,   XK_l,  setmfact,   {.f = +0.05} },
+	{ MODKEY|ShiftMask, XK_j,  movestack,  {.i = +1 } },
+	{ MODKEY|ShiftMask, XK_k,  movestack,  {.i = -1 } },
 	{ MODKEY,   XK_Return, zoom,   {0} },
 	{ MODKEY,   XK_Tab,view,   {0} },
 	{ MODKEY|ShiftMask, XK_c,  killclient, {0} },
diff -ruN dwm/movestack.c movestack/movestack.c
--- dwm/movestack.c	1969-12-31 19:00:00.0 -0500
+++ movestack/movestack.c	2008-10-07 21:31:03.0 -0400
@@ -0,0 +1,49 @@
+void
+movestack(const Arg *arg) {
+	Client *c = NULL, *p = NULL, *pc = NULL, *i;
+
+	if(arg-i  0) {
+		/* find the client after sel */
+		for(c = sel-next; c  (!ISVISIBLE(c) || c-isfloating); c = c-next);
+		if(!c)
+			for(c = clients; c  (!ISVISIBLE(c) || c-isfloating); c = c-next);
+
+	}
+	else {
+		/* find the client before sel */
+		for(i = clients; i != sel; i = i-next)
+			if(ISVISIBLE(i)  !i-isfloating)
+c = i;
+		if(!c)
+			for(; i; i = i-next)
+if(ISVISIBLE(i)  !i-isfloating)
+	c = i;
+	}
+	/* find the client before sel */
+	for(i = clients; i != sel; i = i-next)
+		p = i;
+
+	/* find the client before c */
+	for(i = clients; i != c; i = i-next)
+		pc = i;
+
+	/* swap c and sel clients in the clients list */
+	if(c  c != sel) {
+		Client *temp = sel-next==c?sel:sel-next;
+		sel-next = c-next==sel?c:c-next;
+		c-next = temp;
+
+		if(p  p != c)
+			p-next = c;
+		if(pc  pc != sel)
+			pc-next = sel;
+
+		if(sel == clients)
+			clients = c;
+		else if(c == clients)
+			clients = sel;
+
+		arrange();
+	}
+}
+


Re: [dwm] [patch] move clients in layout

2008-10-07 Thread Monsieur Pinocchio
On Tue, Oct 7, 2008 at 10:36 PM, Niki Yoshiuchi [EMAIL PROTECTED] wrote:

 Hello!  This is my first message to this mailing list so I thought I'd
 start by contributing a patch.  This patch allows you to move clients around
 to reposition them in a tiled layout.  The behavior is meant to emulate
 Xmonad's mod-shift-k and mod-shift-j.  m-s-j swaps a client with the next
 visible, tiled client in the clients list.  m-s-k swaps the client with the
 previous.

 I hope some of you find this useful and I certainly hope to contribute more
 in the future.

 -Niki Yoshiuchi


Thanks a lot for this patch... I really liked it!

-- 
Pinocchio