[dev] Panels and Touch support

2011-04-06 Thread Christoph Lohmann

Hello comrades,

attached is a patch for dwm, which will add real support for the
_NET_WM_WINDOW_TYPE. There _NET_WM_WINDOW_TYPE_DOCK and _NET_WM-
WINDOW_TYPE_TOOLBAR are handled in a special way. The docks now
appear according to their aspect ratio on the screen and will sit
there, appearing on all tags.
The patch is in beta now. One spurious segmentation fault is still
there.

How it works:
When a window is started, having a width of 300 and a height of
200, an initial position in the upper half of the screen and the
Atom _NET_WM_WINDOW_TYPE is set to *_DOCK, then dwm will set it
to be isdock = 1, set its tag mask to 0xFF and force the win-
dow to be sitting at the top of the screen, with the height be-
ing the original value, but the width set to the current window
drawing area width. The window drawing area is decreased accord-
ingly.
If more than one panel is found, they are arranged according to
their order of occurence.

The given panel feature could be used by dmenu, to not overlap
the window drawing area, when being run.
I'm using it for having svkbd on a defined position on the screen,
when rotating my Laptop into tablet mode. The needed patches for
svkbd are sent to the maintainer.

A screenshot can be found here: [0]

The patch will push dwm beyond the 2k sloc mark, so it will need
to be a separately maintained patch.


Sincerely,

Christoph Lohmann

[0] 
http://www.r-36.net/media/pic/Bildschirmphotos/Screenshot-touching-2011-04-06.png
# HG changeset patch
# User Christoph Lohmann <2...@r-36.net>
# Date 1302074113 -7200
# Node ID 43fd667d9cb634cc09200e4f90dde95d239e0d14
# Parent  d92f9b65f85f19122ccc0e19ee7dca089644bd81
A common touching and panel patch.

diff -r d92f9b65f85f -r 43fd667d9cb6 dwm.c
--- a/dwm.c Fri Mar 25 09:24:05 2011 +0100
+++ b/dwm.c Wed Apr 06 09:15:13 2011 +0200
@@ -58,7 +58,9 @@
 enum { CurNormal, CurResize, CurMove, CurLast };/* cursor */
 enum { ColBorder, ColFG, ColBG, ColLast };  /* color */
 enum { NetSupported, NetWMName, NetWMState,
-   NetWMFullscreen, NetWMWindowType, NetLast }; /* EWMH atoms */
+   NetWMFullscreen, NetWMWindowType,
+   NetWMWindowTypeDock, NetWMWindowTypeToolbar,
+   NetLast }; /* EWMH atoms */
 enum { WMProtocols, WMDelete, WMState, WMLast };/* default atoms */
 enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
@@ -88,7 +90,7 @@
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
int bw, oldbw;
unsigned int tags;
-   Bool isfixed, isfloating, isurgent, oldstate, isfocusable, istoolbar;
+   Bool isfixed, isfloating, isurgent, oldstate, isfocusable, isdock, 
istoolbar;
Client *next;
Client *snext;
Monitor *mon;
@@ -229,6 +231,7 @@
 static void unmapnotify(XEvent *e);
 static Bool updategeom(void);
 static void updatebarpos(Monitor *m);
+void updatedocks(Monitor *m);
 static void updatebars(void);
 static void updatenumlockmask(void);
 static void updatesizehints(Client *c);
@@ -683,6 +686,8 @@
unsigned long *col;
Client *c;
for(c = m->clients; c; c = c->next) {
+   if(c->isdock || c->istoolbar)
+   continue;
occ |= c->tags;
if(c->isurgent)
urg |= c->tags;
@@ -702,15 +707,15 @@
x = dc.x;
if(m == selmon) { /* status is only drawn on selected monitor */
dc.w = TEXTW(stext);
-   dc.x = m->ww - dc.w;
+   dc.x = m->mw - dc.w;
if(dc.x < x) {
dc.x = x;
-   dc.w = m->ww - x;
+   dc.w = m->mw - x;
}
drawtext(stext, dc.norm, False);
}
else
-   dc.x = m->ww;
+   dc.x = m->mw;
if((dc.w = dc.x - x) > bh) {
dc.x = x;
if(m->sel) {
@@ -858,17 +863,17 @@
if(!selmon->sel)
return;
if(arg->i > 0) {
-   for(c = selmon->sel->next; c && (!ISVISIBLE(c) || 
c->istoolbar); c = c->next);
+   for(c = selmon->sel->next; c && (!ISVISIBLE(c) || c->isdock || 
c->istoolbar); c = c->next);
if(!c)
-   for(c = selmon->clients; c && (!ISVISIBLE(c) || 
c->istoolbar); c = c->next);
+   for(c = selmon->clients; c && (!ISVISIBLE(c) || 
c->isdock || c->istoolbar); c = c->next);
}
else {
for(i = selmon->clients; i != selmon->sel; i = i->next)
-   if(ISVISIBLE(i) && !c->istoolbar)
+   if(ISVISIBLE(i) && !c->isdock && !c->istoolbar)
c = i;
if(!c)
for(; i; i = i->next)
-   if(ISVISIBLE(i) && !c->istoolbar)
+   if(ISVISIBLE(i) && !c->isdo

Re: [dev] Panels and Touch support

2011-04-06 Thread Peter John Hartman
On Wed, Apr 06, 2011 at 09:30:31AM +0200, Christoph Lohmann wrote:
> The given panel feature could be used by dmenu, to not overlap
> the window drawing area, when being run.
> I'm using it for having svkbd on a defined position on the screen,
> when rotating my Laptop into tablet mode. The needed patches for
> svkbd are sent to the maintainer.

Here's what I do (in config.h):

{ ShiftMask|ControlMask,XK_F31,
set_bar_height, {.i = -1}},
{ ShiftMask|ControlMask,XK_F32,
set_bar_height, {.i = 1}},

void
set_bar_height(const Arg *arg) {
  if (arg->i > 0) 
sh = sh + 300;
  else
sh = sh - 300;
  updategeom(); 
  arrange(selmon);
}

Peter




-- 
sic dicit magister P
PhD Candidate
Collaborative Programme in Ancient and Medieval Philosophy
University of Toronto
http://individual.utoronto.ca/peterjh



Re: [dev] Panels and Touch support

2011-04-06 Thread Christoph Lohmann

Hello,

Peter John Hartman wrote:

On Wed, Apr 06, 2011 at 09:30:31AM +0200, Christoph Lohmann wrote:

The given panel feature could be used by dmenu, to not overlap
the window drawing area, when being run.
I'm using it for having svkbd on a defined position on the screen,
when rotating my Laptop into tablet mode. The needed patches for
svkbd are sent to the maintainer.


Here's what I do (in config.h):

{ ShiftMask|ControlMask,XK_F31,
set_bar_height, {.i = -1}},
{ ShiftMask|ControlMask,XK_F32,
set_bar_height, {.i = 1}},

void
set_bar_height(const Arg *arg) {
   if (arg->i>  0)
 sh = sh + 300;
   else
 sh = sh - 300;
   updategeom();
   arrange(selmon);
}


yes, that's a invariable hack. My patch adds support for panels
in every direction and opens more possibilities. The suckless
touch support will need screen estate, which is visible and can
be extended on-demand. This is added.

I'm adding a new meta-standard here, which isn't used in other
desktop environments. Other desktop environments have a fixed
panel system, but we then have a system, where a normal appli-
cation can be a panel and provide some features. Simply set your
_NET_WM_WINDOW_TYPE to _NET_WM_WINDOW_TYPE_DOCK, add a certain
height or width, make the first position to be upper/lower or
right/left and then it will be managed by dwm. This works with
multiple docks too.

One other step towards a better suckless touch support is thing-
menu [0]. At [1] is an example script, which is started on a
key press and does not require any keyboard interaction.

The new hype is touch stuff. We need to be ready for it, with-
out much patching.

Sincerely,

Christoph Lohmann

[0] http://git.r-36.net/thingmenu/
[1] http://www.r-36.net/tmp/thinkpad-menu.sh



Re: [dev] Panels and Touch support

2011-04-09 Thread Benjamin R. Haskell

On Wed, 6 Apr 2011, Christoph Lohmann wrote:


Hello comrades,

attached is a patch for dwm, which will add real support for the 
_NET_WM_WINDOW_TYPE.


What is this patch against?  I wanted to try this out, but even the 
first hunk of the patch doesn't apply against hg tip.  And the parent 
listed in the header:


# Parent  d92f9b65f85f19122ccc0e19ee7dca089644bd81

doesn't exist, AFAICT.

--
Best,
Ben



Re: [dev] Panels and Touch support

2011-04-09 Thread Benjamin R. Haskell

On Sun, 10 Apr 2011, Benjamin R. Haskell wrote:


On Wed, 6 Apr 2011, Christoph Lohmann wrote:


Hello comrades,

attached is a patch for dwm, which will add real support for the 
_NET_WM_WINDOW_TYPE.


What is this patch against?  I wanted to try this out, but even the 
first hunk of the patch doesn't apply against hg tip.


Nevermind.  Found your March 24 message with the 'toolbar and focus' 
patch.  Adding that first fixed it.


That other patch doesn't live in a branch of any sort, does it?  I never 
remember how hg does branches.


--
Best,
Ben



Re: [dev] Panels and Touch support

2011-04-10 Thread Christoph Lohmann

Hello,

Benjamin R. Haskell wrote:

On Sun, 10 Apr 2011, Benjamin R. Haskell wrote:


On Wed, 6 Apr 2011, Christoph Lohmann wrote:


Hello comrades,

attached is a patch for dwm, which will add real support for the
_NET_WM_WINDOW_TYPE.


What is this patch against? I wanted to try this out, but even the first
hunk of the patch doesn't apply against hg tip.


Nevermind. Found your March 24 message with the 'toolbar and focus' patch.
Adding that first fixed it.


depending on how Anselm receives those patches I will split
them up. Some minor fixes are for mainline too, even without
the panels stuff.


That other patch doesn't live in a branch of any sort, does it? I never
remember how hg does branches.


The patches were created while I were learning to use mercur-
ial. The beginning is a bit hard, but I'm getting used to it.

I will vote git for suckless! ;)


Sincerely,

Christoph Lohmann