view.c
author Anselm R. Garbe <arg@suckless.org>
Fri, 05 Jan 2007 21:52:17 +0100
changeset 659 498b86c72a40
parent 658 b4d1ef7e407f
child 660 4c6d27f03773
permissions -rw-r--r--
preserving c1->snext and c2->snext in swap() as well.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
644
1ed8c40dde36 corrections
arg@mig29
parents: 643
diff changeset
     1
/* (C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com>
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
     2
 * See LICENSE file for license details.
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
     3
 */
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
     4
#include "dwm.h"
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
     5
380
4bf79305d675 this algorithm seems to keep order for any scenario
Anselm R. Garbe <arg@10kloc.org>
parents: 378
diff changeset
     6
/* static */
4bf79305d675 this algorithm seems to keep order for any scenario
Anselm R. Garbe <arg@10kloc.org>
parents: 378
diff changeset
     7
382
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
     8
static Client *
480
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
     9
nexttiled(Client *c) {
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
    10
	for(c = getnext(c); c && c->isfloat; c = getnext(c->next));
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
    11
	return c;
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
    12
}
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
    13
651
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    14
static Bool
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    15
ismaster(Client *c) {
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    16
	Client *cl;
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    17
	unsigned int i;
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    18
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    19
	for(cl = nexttiled(clients), i = 0; cl && cl != c; cl = nexttiled(cl->next), i++);
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    20
	return i < nmaster;
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    21
}
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    22
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    23
static void
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    24
pop(Client *c) {
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    25
	detach(c);
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    26
	if(clients)
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    27
		clients->prev = c;
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    28
	c->next = clients;
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    29
	clients = c;
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    30
}
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    31
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    32
static void
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    33
swap(Client *c1, Client *c2) {
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    34
	Client tmp = *c1;
658
b4d1ef7e407f fixing some minor issues
Anselm R. Garbe <arg@suckless.org>
parents: 656
diff changeset
    35
	Client *c1p = c1->prev;
b4d1ef7e407f fixing some minor issues
Anselm R. Garbe <arg@suckless.org>
parents: 656
diff changeset
    36
	Client *c1n = c1->next;
659
498b86c72a40 preserving c1->snext and c2->snext in swap() as well.
Anselm R. Garbe <arg@suckless.org>
parents: 658
diff changeset
    37
	Client *c1s = c1->snext;
658
b4d1ef7e407f fixing some minor issues
Anselm R. Garbe <arg@suckless.org>
parents: 656
diff changeset
    38
	Client *c2p = c2->prev;
b4d1ef7e407f fixing some minor issues
Anselm R. Garbe <arg@suckless.org>
parents: 656
diff changeset
    39
	Client *c2n = c2->next;
659
498b86c72a40 preserving c1->snext and c2->snext in swap() as well.
Anselm R. Garbe <arg@suckless.org>
parents: 658
diff changeset
    40
	Client *c2s = c2->snext;
651
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    41
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    42
	*c1 = *c2;
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    43
	*c2 = tmp;
658
b4d1ef7e407f fixing some minor issues
Anselm R. Garbe <arg@suckless.org>
parents: 656
diff changeset
    44
	c1->prev = c1p;
b4d1ef7e407f fixing some minor issues
Anselm R. Garbe <arg@suckless.org>
parents: 656
diff changeset
    45
	c1->next = c1n;
659
498b86c72a40 preserving c1->snext and c2->snext in swap() as well.
Anselm R. Garbe <arg@suckless.org>
parents: 658
diff changeset
    46
	c1->snext = c1s;
658
b4d1ef7e407f fixing some minor issues
Anselm R. Garbe <arg@suckless.org>
parents: 656
diff changeset
    47
	c2->prev = c2p;
b4d1ef7e407f fixing some minor issues
Anselm R. Garbe <arg@suckless.org>
parents: 656
diff changeset
    48
	c2->next = c2n;
659
498b86c72a40 preserving c1->snext and c2->snext in swap() as well.
Anselm R. Garbe <arg@suckless.org>
parents: 658
diff changeset
    49
	c2->snext = c2s;
651
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    50
}
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    51
442
056a5072c70a no this is better
Anselm R. Garbe <arg@10kloc.org>
parents: 437
diff changeset
    52
static void
532
651f2c868b31 code polishing, removed unnecessary newlines
Anselm R. Garbe <arg@10kloc.org>
parents: 531
diff changeset
    53
togglemax(Client *c) {
481
arg@mmvi
parents: 480
diff changeset
    54
	XEvent ev;
548
3d23384eb5ab applied sanders max size fix
arg@mig29
parents: 535
diff changeset
    55
		
549
fd1061442711 applied sanders try2 patch
arg@mig29
parents: 548
diff changeset
    56
	if(c->isfixed)
548
3d23384eb5ab applied sanders max size fix
arg@mig29
parents: 535
diff changeset
    57
		return;
532
651f2c868b31 code polishing, removed unnecessary newlines
Anselm R. Garbe <arg@10kloc.org>
parents: 531
diff changeset
    58
480
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
    59
	if((c->ismax = !c->ismax)) {
565
fe766305eed1 applied Gottox' windowarea patch
arg@mig29
parents: 561
diff changeset
    60
		c->rx = c->x; c->x = wax;
fe766305eed1 applied Gottox' windowarea patch
arg@mig29
parents: 561
diff changeset
    61
		c->ry = c->y; c->y = way;
fe766305eed1 applied Gottox' windowarea patch
arg@mig29
parents: 561
diff changeset
    62
		c->rw = c->w; c->w = waw - 2 * BORDERPX;
fe766305eed1 applied Gottox' windowarea patch
arg@mig29
parents: 561
diff changeset
    63
		c->rh = c->h; c->h = wah - 2 * BORDERPX;
480
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
    64
	}
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
    65
	else {
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
    66
		c->x = c->rx;
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
    67
		c->y = c->ry;
481
arg@mmvi
parents: 480
diff changeset
    68
		c->w = c->rw;
arg@mmvi
parents: 480
diff changeset
    69
		c->h = c->rh;
480
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
    70
	}
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
    71
	resize(c, True, TopLeft);
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
    72
	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
430
1e8aba00964e no, reodering floating clients definately breaks the manage() policy which attaches all clients zoomed (otherwise higher-weight clients couldn't be attached zoomed, which sucks)
Anselm R. Garbe <arg@10kloc.org>
parents: 429
diff changeset
    73
}
1e8aba00964e no, reodering floating clients definately breaks the manage() policy which attaches all clients zoomed (otherwise higher-weight clients couldn't be attached zoomed, which sucks)
Anselm R. Garbe <arg@10kloc.org>
parents: 429
diff changeset
    74
651
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    75
static Client *
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    76
topofstack() {
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    77
	Client *c;
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    78
	unsigned int i;
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    79
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    80
	for(c = nexttiled(clients), i = 0; c && i < nmaster; c = nexttiled(c->next), i++);
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    81
	return (i < nmaster) ? NULL : c;
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    82
}
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
    83
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
    84
/* extern */
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
    85
533
a5567a0d3011 do* has no Arg arument anymore (never called directly)
Anselm R. Garbe <arg@10kloc.org>
parents: 532
diff changeset
    86
void (*arrange)(void) = DEFMODE;
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
    87
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
    88
void
461
9d23330a5268 removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents: 450
diff changeset
    89
detach(Client *c) {
378
83576f5f0a90 added attach/detach functions which don't attach at the begin of list, but at the slot of a first match of the tags of a client
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    90
	if(c->prev)
83576f5f0a90 added attach/detach functions which don't attach at the begin of list, but at the slot of a first match of the tags of a client
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    91
		c->prev->next = c->next;
83576f5f0a90 added attach/detach functions which don't attach at the begin of list, but at the slot of a first match of the tags of a client
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    92
	if(c->next)
83576f5f0a90 added attach/detach functions which don't attach at the begin of list, but at the slot of a first match of the tags of a client
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    93
		c->next->prev = c->prev;
83576f5f0a90 added attach/detach functions which don't attach at the begin of list, but at the slot of a first match of the tags of a client
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    94
	if(c == clients)
83576f5f0a90 added attach/detach functions which don't attach at the begin of list, but at the slot of a first match of the tags of a client
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    95
		clients = c->next;
83576f5f0a90 added attach/detach functions which don't attach at the begin of list, but at the slot of a first match of the tags of a client
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    96
	c->next = c->prev = NULL;
83576f5f0a90 added attach/detach functions which don't attach at the begin of list, but at the slot of a first match of the tags of a client
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    97
}
83576f5f0a90 added attach/detach functions which don't attach at the begin of list, but at the slot of a first match of the tags of a client
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    98
83576f5f0a90 added attach/detach functions which don't attach at the begin of list, but at the slot of a first match of the tags of a client
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    99
void
533
a5567a0d3011 do* has no Arg arument anymore (never called directly)
Anselm R. Garbe <arg@10kloc.org>
parents: 532
diff changeset
   100
dofloat(void) {
402
c7d5ff57998d removed unused vars
Anselm R. Garbe <arg@10kloc.org>
parents: 401
diff changeset
   101
	Client *c;
400
052657ff2e7b applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents: 397
diff changeset
   102
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   103
	for(c = clients; c; c = c->next) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   104
		if(isvisible(c)) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   105
			resize(c, True, TopLeft);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   106
		}
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   107
		else
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   108
			ban(c);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   109
	}
446
a2e587651c79 using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents: 443
diff changeset
   110
	if(!sel || !isvisible(sel)) {
450
728c9089b079 applied sanders patch of not manipulating sel
Anselm R. Garbe <arg@10kloc.org>
parents: 446
diff changeset
   111
		for(c = stack; c && !isvisible(c); c = c->snext);
728c9089b079 applied sanders patch of not manipulating sel
Anselm R. Garbe <arg@10kloc.org>
parents: 446
diff changeset
   112
		focus(c);
446
a2e587651c79 using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents: 443
diff changeset
   113
	}
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   114
	restack();
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   115
}
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   116
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   117
void
533
a5567a0d3011 do* has no Arg arument anymore (never called directly)
Anselm R. Garbe <arg@10kloc.org>
parents: 532
diff changeset
   118
dotile(void) {
650
f3b8c71a69d4 experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents: 644
diff changeset
   119
	unsigned int i, n, mw, mh, tw, th;
402
c7d5ff57998d removed unused vars
Anselm R. Garbe <arg@10kloc.org>
parents: 401
diff changeset
   120
	Client *c;
400
052657ff2e7b applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents: 397
diff changeset
   121
488
0d2559f46b9e applied sanders jukka patch
arg@mmvi
parents: 487
diff changeset
   122
	for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
0d2559f46b9e applied sanders jukka patch
arg@mmvi
parents: 487
diff changeset
   123
		n++;
650
f3b8c71a69d4 experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents: 644
diff changeset
   124
	/* window geoms */
f3b8c71a69d4 experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents: 644
diff changeset
   125
	mw = (n > nmaster) ? (waw * master) / 1000 : waw;
f3b8c71a69d4 experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents: 644
diff changeset
   126
	mh = (n > nmaster) ? wah / nmaster : wah / (n > 0 ? n : 1);
f3b8c71a69d4 experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents: 644
diff changeset
   127
	tw = waw - mw;
f3b8c71a69d4 experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents: 644
diff changeset
   128
	th = (n > nmaster) ? wah / (n - nmaster) : 0;
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   129
535
Anselm R. Garbe <arg@10kloc.org>
parents: 533
diff changeset
   130
	for(i = 0, c = clients; c; c = c->next)
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   131
		if(isvisible(c)) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   132
			if(c->isfloat) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   133
				resize(c, True, TopLeft);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   134
				continue;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   135
			}
488
0d2559f46b9e applied sanders jukka patch
arg@mmvi
parents: 487
diff changeset
   136
			c->ismax = False;
565
fe766305eed1 applied Gottox' windowarea patch
arg@mig29
parents: 561
diff changeset
   137
			c->x = wax;
fe766305eed1 applied Gottox' windowarea patch
arg@mig29
parents: 561
diff changeset
   138
			c->y = way;
650
f3b8c71a69d4 experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents: 644
diff changeset
   139
			if(i < nmaster) {
f3b8c71a69d4 experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents: 644
diff changeset
   140
				c->y += i * mh;
f3b8c71a69d4 experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents: 644
diff changeset
   141
				c->w = mw - 2 * BORDERPX;
f3b8c71a69d4 experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents: 644
diff changeset
   142
				c->h = mh - 2 * BORDERPX;
507
2824b5d0f0f0 prelim of dotile()
Anselm R. Garbe <arg@10kloc.org>
parents: 505
diff changeset
   143
			}
523
c1dd19da63ef yet another simplification of dotile()
Anselm R. Garbe <arg@10kloc.org>
parents: 522
diff changeset
   144
			else {  /* tile window */
650
f3b8c71a69d4 experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents: 644
diff changeset
   145
				c->x += mw;
f3b8c71a69d4 experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents: 644
diff changeset
   146
				c->w = tw - 2 * BORDERPX;
523
c1dd19da63ef yet another simplification of dotile()
Anselm R. Garbe <arg@10kloc.org>
parents: 522
diff changeset
   147
				if(th > bh) {
650
f3b8c71a69d4 experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents: 644
diff changeset
   148
					c->y += (i - nmaster) * th;
565
fe766305eed1 applied Gottox' windowarea patch
arg@mig29
parents: 561
diff changeset
   149
					c->h = th - 2 * BORDERPX;
507
2824b5d0f0f0 prelim of dotile()
Anselm R. Garbe <arg@10kloc.org>
parents: 505
diff changeset
   150
				}
531
96563762b4ad yet another small fix and simplification of dotile
Anselm R. Garbe <arg@10kloc.org>
parents: 530
diff changeset
   151
				else /* fallback if th < bh */
565
fe766305eed1 applied Gottox' windowarea patch
arg@mig29
parents: 561
diff changeset
   152
					c->h = wah - 2 * BORDERPX;
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   153
			}
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   154
			resize(c, False, TopLeft);
535
Anselm R. Garbe <arg@10kloc.org>
parents: 533
diff changeset
   155
			i++;
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   156
		}
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   157
		else
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   158
			ban(c);
532
651f2c868b31 code polishing, removed unnecessary newlines
Anselm R. Garbe <arg@10kloc.org>
parents: 531
diff changeset
   159
446
a2e587651c79 using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents: 443
diff changeset
   160
	if(!sel || !isvisible(sel)) {
450
728c9089b079 applied sanders patch of not manipulating sel
Anselm R. Garbe <arg@10kloc.org>
parents: 446
diff changeset
   161
		for(c = stack; c && !isvisible(c); c = c->snext);
728c9089b079 applied sanders patch of not manipulating sel
Anselm R. Garbe <arg@10kloc.org>
parents: 446
diff changeset
   162
		focus(c);
446
a2e587651c79 using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents: 443
diff changeset
   163
	}
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   164
	restack();
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   165
}
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   166
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   167
void
461
9d23330a5268 removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents: 450
diff changeset
   168
focusnext(Arg *arg) {
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   169
	Client *c;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   170
   
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   171
	if(!sel)
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   172
		return;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   173
	if(!(c = getnext(sel->next)))
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   174
		c = getnext(clients);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   175
	if(c) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   176
		focus(c);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   177
		restack();
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   178
	}
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   179
}
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   180
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   181
void
461
9d23330a5268 removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents: 450
diff changeset
   182
focusprev(Arg *arg) {
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   183
	Client *c;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   184
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   185
	if(!sel)
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   186
		return;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   187
	if(!(c = getprev(sel->prev))) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   188
		for(c = clients; c && c->next; c = c->next);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   189
		c = getprev(c);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   190
	}
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   191
	if(c) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   192
		focus(c);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   193
		restack();
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   194
	}
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   195
}
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   196
650
f3b8c71a69d4 experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents: 644
diff changeset
   197
void
f3b8c71a69d4 experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents: 644
diff changeset
   198
incnmaster(Arg *arg) {
658
b4d1ef7e407f fixing some minor issues
Anselm R. Garbe <arg@suckless.org>
parents: 656
diff changeset
   199
	if((nmaster + arg->i < 1) || (wah / (nmaster + arg->i) < bh))
650
f3b8c71a69d4 experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents: 644
diff changeset
   200
		return;
f3b8c71a69d4 experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents: 644
diff changeset
   201
	nmaster += arg->i;
f3b8c71a69d4 experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents: 644
diff changeset
   202
	arrange();
f3b8c71a69d4 experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents: 644
diff changeset
   203
}
f3b8c71a69d4 experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents: 644
diff changeset
   204
420
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
   205
Bool
461
9d23330a5268 removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents: 450
diff changeset
   206
isvisible(Client *c) {
420
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
   207
	unsigned int i;
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
   208
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
   209
	for(i = 0; i < ntags; i++)
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
   210
		if(c->tags[i] && seltag[i])
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
   211
			return True;
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
   212
	return False;
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
   213
}
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
   214
415
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
   215
void
559
a2c465098a3b renamed resizecol into resizemaster
arg@mig29
parents: 558
diff changeset
   216
resizemaster(Arg *arg) {
561
b5435d3fb7b0 applied Jukkas patch
arg@mig29
parents: 559
diff changeset
   217
	if(arg->i == 0)
b5435d3fb7b0 applied Jukkas patch
arg@mig29
parents: 559
diff changeset
   218
		master = MASTER;
b5435d3fb7b0 applied Jukkas patch
arg@mig29
parents: 559
diff changeset
   219
	else {
b5435d3fb7b0 applied Jukkas patch
arg@mig29
parents: 559
diff changeset
   220
		if(master + arg->i > 950 || master + arg->i < 50)
b5435d3fb7b0 applied Jukkas patch
arg@mig29
parents: 559
diff changeset
   221
			return;
b5435d3fb7b0 applied Jukkas patch
arg@mig29
parents: 559
diff changeset
   222
		master += arg->i;
b5435d3fb7b0 applied Jukkas patch
arg@mig29
parents: 559
diff changeset
   223
	}
533
a5567a0d3011 do* has no Arg arument anymore (never called directly)
Anselm R. Garbe <arg@10kloc.org>
parents: 532
diff changeset
   224
	arrange();
415
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
   225
}
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
   226
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   227
void
487
be4f90c03582 applied Jukkas patch
arg@mmvi
parents: 486
diff changeset
   228
restack(void) {
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   229
	Client *c;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   230
	XEvent ev;
481
arg@mmvi
parents: 480
diff changeset
   231
437
433a5c662f73 drawstatus even if no client exists
Anselm R. Garbe <arg@10kloc.org>
parents: 436
diff changeset
   232
	if(!sel) {
433a5c662f73 drawstatus even if no client exists
Anselm R. Garbe <arg@10kloc.org>
parents: 436
diff changeset
   233
		drawstatus();
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   234
		return;
437
433a5c662f73 drawstatus even if no client exists
Anselm R. Garbe <arg@10kloc.org>
parents: 436
diff changeset
   235
	}
436
b3659c3c5dab sanders solution is convincing and elegant
Anselm R. Garbe <arg@10kloc.org>
parents: 433
diff changeset
   236
	if(sel->isfloat || arrange == dofloat) {
b3659c3c5dab sanders solution is convincing and elegant
Anselm R. Garbe <arg@10kloc.org>
parents: 433
diff changeset
   237
		XRaiseWindow(dpy, sel->win);
b3659c3c5dab sanders solution is convincing and elegant
Anselm R. Garbe <arg@10kloc.org>
parents: 433
diff changeset
   238
		XRaiseWindow(dpy, sel->twin);
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   239
	}
512
aca04c3022c1 fixed the z-layer issue described on mailinglist
Anselm R. Garbe <arg@10kloc.org>
parents: 511
diff changeset
   240
	if(arrange != dofloat) {
aca04c3022c1 fixed the z-layer issue described on mailinglist
Anselm R. Garbe <arg@10kloc.org>
parents: 511
diff changeset
   241
		if(!sel->isfloat) {
aca04c3022c1 fixed the z-layer issue described on mailinglist
Anselm R. Garbe <arg@10kloc.org>
parents: 511
diff changeset
   242
			XLowerWindow(dpy, sel->twin);
aca04c3022c1 fixed the z-layer issue described on mailinglist
Anselm R. Garbe <arg@10kloc.org>
parents: 511
diff changeset
   243
			XLowerWindow(dpy, sel->win);
aca04c3022c1 fixed the z-layer issue described on mailinglist
Anselm R. Garbe <arg@10kloc.org>
parents: 511
diff changeset
   244
		}
436
b3659c3c5dab sanders solution is convincing and elegant
Anselm R. Garbe <arg@10kloc.org>
parents: 433
diff changeset
   245
		for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
512
aca04c3022c1 fixed the z-layer issue described on mailinglist
Anselm R. Garbe <arg@10kloc.org>
parents: 511
diff changeset
   246
			if(c == sel)
aca04c3022c1 fixed the z-layer issue described on mailinglist
Anselm R. Garbe <arg@10kloc.org>
parents: 511
diff changeset
   247
				continue;
436
b3659c3c5dab sanders solution is convincing and elegant
Anselm R. Garbe <arg@10kloc.org>
parents: 433
diff changeset
   248
			XLowerWindow(dpy, c->twin);
b3659c3c5dab sanders solution is convincing and elegant
Anselm R. Garbe <arg@10kloc.org>
parents: 433
diff changeset
   249
			XLowerWindow(dpy, c->win);
414
c6ffcc201229 don't access sel in restack without checking for NULL (multihead crashing bug)
Anselm R. Garbe <arg@10kloc.org>
parents: 402
diff changeset
   250
		}
512
aca04c3022c1 fixed the z-layer issue described on mailinglist
Anselm R. Garbe <arg@10kloc.org>
parents: 511
diff changeset
   251
	}
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   252
	drawall();
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   253
	XSync(dpy, False);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   254
	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   255
}
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   256
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   257
void
584
37281ebc1b5b added togglefloat to hg tip (i consider this useful for some cases), using MODKEY-Shift-space as shortcut
arg@mig29
parents: 573
diff changeset
   258
togglefloat(Arg *arg) {
591
d9e9df9fdce6 togglefloat should only work in dotile mode (thanks to Sander for this hint)
arg@mig29
parents: 588
diff changeset
   259
	if (!sel || arrange == dofloat)
584
37281ebc1b5b added togglefloat to hg tip (i consider this useful for some cases), using MODKEY-Shift-space as shortcut
arg@mig29
parents: 573
diff changeset
   260
		return;
37281ebc1b5b added togglefloat to hg tip (i consider this useful for some cases), using MODKEY-Shift-space as shortcut
arg@mig29
parents: 573
diff changeset
   261
	sel->isfloat = !sel->isfloat;
37281ebc1b5b added togglefloat to hg tip (i consider this useful for some cases), using MODKEY-Shift-space as shortcut
arg@mig29
parents: 573
diff changeset
   262
	arrange();
37281ebc1b5b added togglefloat to hg tip (i consider this useful for some cases), using MODKEY-Shift-space as shortcut
arg@mig29
parents: 573
diff changeset
   263
}
37281ebc1b5b added togglefloat to hg tip (i consider this useful for some cases), using MODKEY-Shift-space as shortcut
arg@mig29
parents: 573
diff changeset
   264
37281ebc1b5b added togglefloat to hg tip (i consider this useful for some cases), using MODKEY-Shift-space as shortcut
arg@mig29
parents: 573
diff changeset
   265
void
461
9d23330a5268 removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents: 450
diff changeset
   266
togglemode(Arg *arg) {
333
827f8f6c9e97 separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents: 327
diff changeset
   267
	arrange = (arrange == dofloat) ? dotile : dofloat;
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   268
	if(sel)
533
a5567a0d3011 do* has no Arg arument anymore (never called directly)
Anselm R. Garbe <arg@10kloc.org>
parents: 532
diff changeset
   269
		arrange();
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   270
	else
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   271
		drawstatus();
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   272
}
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   273
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   274
void
461
9d23330a5268 removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents: 450
diff changeset
   275
toggleview(Arg *arg) {
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   276
	unsigned int i;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   277
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   278
	seltag[arg->i] = !seltag[arg->i];
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   279
	for(i = 0; i < ntags && !seltag[i]; i++);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   280
	if(i == ntags)
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   281
		seltag[arg->i] = True; /* cannot toggle last view */
533
a5567a0d3011 do* has no Arg arument anymore (never called directly)
Anselm R. Garbe <arg@10kloc.org>
parents: 532
diff changeset
   282
	arrange();
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   283
}
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   284
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   285
void
461
9d23330a5268 removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents: 450
diff changeset
   286
view(Arg *arg) {
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   287
	unsigned int i;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   288
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   289
	for(i = 0; i < ntags; i++)
594
f7dcd3ac8d6f removed viewall(), replaced with view(-1); added tag(-1) to tag a client with all tags (new key combo MODKEY-Shift-0)
arg@mig29
parents: 591
diff changeset
   290
		seltag[i] = (arg->i == -1) ? True : False;
611
c7f84f23ec5a hotfix of a serious crashing bug
arg@mig29
parents: 594
diff changeset
   291
	if(arg->i >= 0 && arg->i < ntags)
c7f84f23ec5a hotfix of a serious crashing bug
arg@mig29
parents: 594
diff changeset
   292
		seltag[arg->i] = True;
533
a5567a0d3011 do* has no Arg arument anymore (never called directly)
Anselm R. Garbe <arg@10kloc.org>
parents: 532
diff changeset
   293
	arrange();
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   294
}
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   295
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   296
void
461
9d23330a5268 removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents: 450
diff changeset
   297
zoom(Arg *arg) {
651
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
   298
	unsigned int n;
423
6ba5dd429122 applied checking existance of >2 tiles patch (proposed by sander) to zoom and resizecol
Anselm R. Garbe <arg@10kloc.org>
parents: 422
diff changeset
   299
	Client *c;
473
2d8af0d7920d implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents: 463
diff changeset
   300
2d8af0d7920d implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents: 463
diff changeset
   301
	if(!sel)
2d8af0d7920d implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents: 463
diff changeset
   302
		return;
2d8af0d7920d implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents: 463
diff changeset
   303
	if(sel->isfloat || (arrange == dofloat)) {
480
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
   304
		togglemax(sel);
473
2d8af0d7920d implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents: 463
diff changeset
   305
		return;
2d8af0d7920d implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents: 463
diff changeset
   306
	}
650
f3b8c71a69d4 experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents: 644
diff changeset
   307
	for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
f3b8c71a69d4 experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents: 644
diff changeset
   308
		n++;
654
04734db9a219 allowing zoom within master area as well
Anselm R. Garbe <arg@suckless.org>
parents: 651
diff changeset
   309
04734db9a219 allowing zoom within master area as well
Anselm R. Garbe <arg@suckless.org>
parents: 651
diff changeset
   310
	c = sel;
658
b4d1ef7e407f fixing some minor issues
Anselm R. Garbe <arg@suckless.org>
parents: 656
diff changeset
   311
	if(arrange == dofloat)
b4d1ef7e407f fixing some minor issues
Anselm R. Garbe <arg@suckless.org>
parents: 656
diff changeset
   312
		return;
b4d1ef7e407f fixing some minor issues
Anselm R. Garbe <arg@suckless.org>
parents: 656
diff changeset
   313
	else if(n <= nmaster)
654
04734db9a219 allowing zoom within master area as well
Anselm R. Garbe <arg@suckless.org>
parents: 651
diff changeset
   314
		pop(c);
04734db9a219 allowing zoom within master area as well
Anselm R. Garbe <arg@suckless.org>
parents: 651
diff changeset
   315
	else if(ismaster(sel)) {
651
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
   316
		if(!(c = topofstack()))
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
   317
			return;
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
   318
		swap(c, sel);
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
   319
		c = sel;
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
   320
	}
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
   321
	else
b9f4efd21473 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents: 650
diff changeset
   322
		pop(c);
650
f3b8c71a69d4 experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents: 644
diff changeset
   323
378
83576f5f0a90 added attach/detach functions which don't attach at the begin of list, but at the slot of a first match of the tags of a client
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
   324
	focus(c);
533
a5567a0d3011 do* has no Arg arument anymore (never called directly)
Anselm R. Garbe <arg@10kloc.org>
parents: 532
diff changeset
   325
	arrange();
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   326
}