John A. Grahor | 2 Jun 2012 05:04
Favicon

dwm window outline during mouse resize/move patch

I forward X halfway around the world and the mouse move/resize as implemented 
in dwm brings things to a screeching halt.

I noticed that the non-solid move/resize in evilwm works much better because 
it doesn't demand the client to redraw a billion times as you drag the mouse 
because it just draws a wire frame of the window as you drag.

I have included a patch for dwm-5.8.2 in which I basically stole the wire 
frame move/resize code from evilwm and adapted it for dwm.

If anyone is interested I'll do a patch for a more modern release.
diff -up dwm-5.8.2/dwm.c dwm-5.8.2-wired/dwm.c
--- dwm-5.8.2/dwm.c	2010-06-04 06:39:15.000000000 -0400
+++ dwm-5.8.2-wired/dwm.c	2012-06-01 22:58:02.000000000 -0400
 <at>  <at>  -101,6 +101,7  <at>  <at>  typedef struct {
 	unsigned long sel[ColLast];
 	Drawable drawable;
 	GC gc;
+	GC invert_gc;
 	struct {
 		int ascent;
 		int descent;
 <at>  <at>  -177,6 +178,7  <at>  <at>  static void drawbar(Monitor *m);
 static void drawbars(void);
 static void drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]);
 static void drawtext(const char *text, unsigned long col[ColLast], Bool invert);
+static void draw_outline(int x, int y, int w, int h, int bw);
 static void enternotify(XEvent *e);
(Continue reading)

Luis Anaya | 2 Jun 2012 05:53
Picon
Favicon
Gravatar

Re: dwm window outline during mouse resize/move patch

"John A. Grahor" <jag <at> techma.com> writes:

> I have included a patch for dwm-5.8.2 in which I basically stole the
> wire frame move/resize code from evilwm and adapted it for dwm.
> If anyone is interested I'll do a patch for a more modern release.

John:

I've been always partial to wireframe move/resize because it is more
efficient when you're working remote. (Yes, I understand the reasoning
behind stack window managers :) )

If you feel inclined to adapt it to 6.0, it would be great. I can also 
look at the patch and work on it as well. 

Up to you;  I would certainly find it of value.

Thanks!

--

-- 
Luis Anaya
papo anaya aroba hot mail punto com
"Do not use 100 words if you can say it in 10" - Yamamoto Tsunetomo

Nick | 2 Jun 2012 11:02
Picon
Favicon

Re: dwm window outline during mouse resize/move patch

Quoth John A. Grahor:
> I forward X halfway around the world and the mouse move/resize as
> implemented in dwm brings things to a screeching halt.

This would be useful to me too. Even on a local computer, with a 
sufficiently crappy video driver and rotated X, resizing and moving 
can slow significantly.

Nick

stanio | 2 Jun 2012 13:39
Picon

[surf] generic toggle patch

Hi,

Here is a simple patch to toggle binary webkit features by name.

--s_
diff -r 51a6d05c2c84 config.def.h
--- a/config.def.h	Mon Mar 26 09:33:42 2012 +0200
+++ b/config.def.h	Thu May 31 09:31:38 2012 +0200
 <at>  <at>  -42,4 +42,8  <at>  <at> 
     { MODKEY,               GDK_f,      spawn,      SETPROP("_SURF_FIND", "_SURF_FIND") },
     { MODKEY,               GDK_n,      find,       { .b = TRUE } },
     { MODKEY|GDK_SHIFT_MASK,GDK_n,      find,       { .b = FALSE } },
+    { MODKEY,               GDK_v,      toggle,     { .v = "enable-plugins" } },
+    { MODKEY|GDK_SHIFT_MASK,GDK_i,      toggle,     { .v = "auto-load-images" } },
+    { MODKEY,               GDK_c,      toggle,     { .v = "enable-caret-browsing" } },
+    { MODKEY|GDK_SHIFT_MASK,GDK_s,      toggle,     { .v = "enable-scripts" } },
 };
diff -r 51a6d05c2c84 surf.c
--- a/surf.c	Mon Mar 26 09:33:42 2012 +0200
+++ b/surf.c	Thu May 31 09:31:38 2012 +0200
 <at>  <at>  -106,6 +106,7  <at>  <at> 
 static void eval(Client *c, const Arg *arg);
 static void stop(Client *c, const Arg *arg);
 static void titlechange(WebKitWebView *v, WebKitWebFrame* frame, const char* title, Client *c);
+static void toggle(Client *c, const Arg *arg);
 static void update(Client *c);
 static void updatewinid(Client *c);
 static void usage(void);
(Continue reading)

stanio | 2 Jun 2012 14:00
Picon

[surf] alternate style patch

I use this as a simple heuristic to make some broken web pages more
readable. It's proven very useful for reading news, docs, all sorts of
long text, where the content is more important than what the author
assumes is the best appearance.

The patch just alternates the default and text_style css. For longer
readings I prefer, as evident in text_style.css, reading light on dark
with modest contrast

--s_
diff -r 51a6d05c2c84 config.def.h
--- a/config.def.h	Mon Mar 26 09:33:42 2012 +0200
+++ b/config.def.h	Thu May 31 19:18:35 2012 +0200
 <at>  <at>  -42,4 +42,6  <at>  <at> 
     { MODKEY,               GDK_f,      spawn,      SETPROP("_SURF_FIND", "_SURF_FIND") },
     { MODKEY,               GDK_n,      find,       { .b = TRUE } },
     { MODKEY|GDK_SHIFT_MASK,GDK_n,      find,       { .b = FALSE } },
+    { MODKEY,               GDK_t,           setstyle,   { .v = ".surf/text_style.css" } },
+    { MODKEY|GDK_SHIFT_MASK,GDK_t,           setstyle,   { .v = (const char *)NULL} },
 };
diff -r 51a6d05c2c84 surf.c
--- a/surf.c	Mon Mar 26 09:33:42 2012 +0200
+++ b/surf.c	Thu May 31 19:18:35 2012 +0200
 <at>  <at>  -99,6 +99,7  <at>  <at> 
 static void scroll(Client *c, const Arg *arg);
 static void setatom(Client *c, int a, const char *v);
 static void setcookie(SoupCookie *c);
+static void setstyle(Client *c, const Arg *v);
(Continue reading)

stanio | 2 Jun 2012 14:10
Picon

[surf] insert mode patch


Most of this code is certainly not by me, but I couldn't find such
patch, and I tought it could be useful to have around. 

Surf starts in 'normal' mode, where all your keybindings have effect
with and without pressing the modkey, e.g. both 'j' and '^j' scroll down
a line. 

Pressing 'i' in 'normal mode' brings you to 'insert mode', where your
keybindings take effect only when modkey is pressed. Without modkey,
keypress come through and are being processed by the engine (by the
website), so you can write to text elements or control an web
application.

'Esc' brings you again to 'normal mode'.

--s_
diff -r 51a6d05c2c84 config.def.h
--- a/config.def.h	Mon Mar 26 09:33:42 2012 +0200
+++ b/config.def.h	Thu May 31 19:39:00 2012 +0200
 <at>  <at>  -42,4 +42,5  <at>  <at> 
     { MODKEY,               GDK_f,      spawn,      SETPROP("_SURF_FIND", "_SURF_FIND") },
     { MODKEY,               GDK_n,      find,       { .b = TRUE } },
     { MODKEY|GDK_SHIFT_MASK,GDK_n,      find,       { .b = FALSE } },
+    { 0,                    GDK_i,      insert,     { 0 } },
 };
diff -r 51a6d05c2c84 surf.c
--- a/surf.c	Mon Mar 26 09:33:42 2012 +0200
(Continue reading)

stanio | 2 Jun 2012 14:22
Picon

[surf] status area patch

This patch writes several letters in the beginning of the title which
represent the current status of boolean options: capital 'I' means
'showing images is enabled', while 'i' means it is disabled. Same for
javascript, plugins, caret browsing,...

I've had several implementations of this for a year or two; I quite like
the idea to see compact representation of what is on/off in that window.
In conjunction with the script/plugin toggle and alternate style style
patches it gives me better control on browsing and makes the web
a bit less broken.

I've never been happy with the implementation, though. In particular, it
is ugly to have redundant place to store and lookup the status of
settings. 

--s_
diff -r 51a6d05c2c84 surf.c
--- a/surf.c	Mon Mar 26 09:33:42 2012 +0200
+++ b/surf.c	Thu May 31 09:52:56 2012 +0200
 <at>  <at>  -63,6 +63,7  <at>  <at> 
 static char winid[64];
 static char *progname;
 static gboolean loadimage = 1, plugin = 1, script = 1;
+static char toggstat[5];

 static char *buildpath(const char *path);
 static void cleanup(void);
 <at>  <at>  -795,16 +796,35  <at>  <at> 
(Continue reading)

stanio | 2 Jun 2012 14:37
Picon

[surf] zoom text patch

This patch enables zooming text only, i.e. increase/decrease font size
and preserve other elements' sizes.

--s_
diff -r 51a6d05c2c84 config.def.h
--- a/config.def.h	Mon Mar 26 09:33:42 2012 +0200
+++ b/config.def.h	Thu May 31 19:30:14 2012 +0200
 <at>  <at>  -32,6 +32,9  <at>  <at> 
     { MODKEY|GDK_SHIFT_MASK,GDK_j,      zoom,       { .i = -1 } },
     { MODKEY|GDK_SHIFT_MASK,GDK_k,      zoom,       { .i = +1 } },
     { MODKEY|GDK_SHIFT_MASK,GDK_i,      zoom,       { .i = 0  } },
+    { MODKEY,               GDK_underscore,  zoomtext,   { .i = -1 } },
+    { MODKEY,               GDK_plus,        zoomtext,   { .i = +1 } },
+    { MODKEY,               GDK_parenright,  zoomtext,   { .i = 0 } },
     { MODKEY,               GDK_l,      navigate,   { .i = +1 } },
     { MODKEY,               GDK_h,      navigate,   { .i = -1 } },
     { MODKEY,               GDK_j,      scroll,     { .i = +1 } },
diff -r 51a6d05c2c84 surf.c
--- a/surf.c	Mon Mar 26 09:33:42 2012 +0200
+++ b/surf.c	Thu May 31 19:30:14 2012 +0200
 <at>  <at>  -111,6 +111,7  <at>  <at> 
 static void usage(void);
 static void windowobjectcleared(GtkWidget *w, WebKitWebFrame *frame, JSContextRef js, JSObjectRef
win, Client *c);
 static void zoom(Client *c, const Arg *arg);
+static void zoomtext(Client *c, const Arg *arg);

 /* configuration, allows nested code to access above variables */
(Continue reading)

Kurt Van Dijck | 2 Jun 2012 19:47
Picon
Favicon
Gravatar

Re: [surf] status area patch

On Sat, Jun 02, 2012 at 02:22:28PM +0200, stanio <at> cs.tu-berlin.de wrote:
> This patch writes several letters in the beginning of the title which
> represent the current status of boolean options: capital 'I' means
> 'showing images is enabled', while 'i' means it is disabled. Same for
> javascript, plugins, caret browsing,...
> 
> I've had several implementations of this for a year or two; I quite like
> the idea to see compact representation of what is on/off in that window.
> In conjunction with the script/plugin toggle and alternate style style
> patches it gives me better control on browsing and makes the web
> a bit less broken.
> 
> I've never been happy with the implementation, though. In particular, it
> is ugly to have redundant place to store and lookup the status of
> settings. 

Have you tought on indicating the normal/insert mode of your earlier patch?
Kurt

stanio | 2 Jun 2012 20:44
Picon

Re: [surf] status area patch

* Kurt Van Dijck <kurt.van.dijck <at> eia.be> [2012-06-02 19:48]:
> Have you tought on indicating the normal/insert mode of your earlier patch?
> Kurt

yes. 

but then the patch depends on the insert mode patch. I would avoid
dependencies where not needed.

It is straightforward to add, though.

	togglestat[5] = '\0';
	togglestat[4] = insert_mode?'+':'-';

--s_


Gmane