view.c
author arg@mig29
Thu, 26 Oct 2006 12:13:41 +0200
changeset 541 08d3d329270a
parent 535 13ef0d218c67
child 548 3d23384eb5ab
permissions -rw-r--r--
using MASTER 600 again, it is definately better, and using urxvtc for the moment (it doesn't flickers on refreshes, but this is not because of Marc Lehmann, it is because of the original rxvt code)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
532
651f2c868b31 code polishing, removed unnecessary newlines
Anselm R. Garbe <arg@10kloc.org>
parents: 531
diff changeset
     1
/* (C)opyright MMVI 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 *
487
be4f90c03582 applied Jukkas patch
arg@mmvi
parents: 486
diff changeset
     9
minclient(void) {
382
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
    10
	Client *c, *min;
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
    11
443
548084f8d92e this patch keeps track of global z-layer order of clients which are floating or if floating mode is enabled
Anselm R. Garbe <arg@10kloc.org>
parents: 442
diff changeset
    12
	if((clients && clients->isfloat) || arrange == dofloat)
548084f8d92e this patch keeps track of global z-layer order of clients which are floating or if floating mode is enabled
Anselm R. Garbe <arg@10kloc.org>
parents: 442
diff changeset
    13
		return clients; /* don't touch floating order */
382
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
    14
	for(min = c = clients; c; c = c->next)
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
    15
		if(c->weight < min->weight)
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
    16
			min = c;
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
    17
	return min;
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
    18
}
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
    19
480
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
    20
static Client *
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
    21
nexttiled(Client *c) {
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
    22
	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
    23
	return c;
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
    24
}
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
    25
442
056a5072c70a no this is better
Anselm R. Garbe <arg@10kloc.org>
parents: 437
diff changeset
    26
static void
487
be4f90c03582 applied Jukkas patch
arg@mmvi
parents: 486
diff changeset
    27
reorder(void) {
382
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
    28
	Client *c, *newclients, *tail;
381
b00cc483d13b still something wrong with reorder()
Anselm R. Garbe <arg@10kloc.org>
parents: 380
diff changeset
    29
382
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
    30
	newclients = tail = NULL;
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
    31
	while((c = minclient())) {
381
b00cc483d13b still something wrong with reorder()
Anselm R. Garbe <arg@10kloc.org>
parents: 380
diff changeset
    32
		detach(c);
382
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
    33
		if(tail) {
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
    34
			c->prev = tail;
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
    35
			tail->next = c;
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
    36
			tail = c;
381
b00cc483d13b still something wrong with reorder()
Anselm R. Garbe <arg@10kloc.org>
parents: 380
diff changeset
    37
		}
b00cc483d13b still something wrong with reorder()
Anselm R. Garbe <arg@10kloc.org>
parents: 380
diff changeset
    38
		else
382
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
    39
			tail = newclients = c;
380
4bf79305d675 this algorithm seems to keep order for any scenario
Anselm R. Garbe <arg@10kloc.org>
parents: 378
diff changeset
    40
	}
382
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
    41
	clients = newclients;
380
4bf79305d675 this algorithm seems to keep order for any scenario
Anselm R. Garbe <arg@10kloc.org>
parents: 378
diff changeset
    42
}
4bf79305d675 this algorithm seems to keep order for any scenario
Anselm R. Garbe <arg@10kloc.org>
parents: 378
diff changeset
    43
480
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
    44
static void
532
651f2c868b31 code polishing, removed unnecessary newlines
Anselm R. Garbe <arg@10kloc.org>
parents: 531
diff changeset
    45
togglemax(Client *c) {
481
arg@mmvi
parents: 480
diff changeset
    46
	XEvent ev;
532
651f2c868b31 code polishing, removed unnecessary newlines
Anselm R. Garbe <arg@10kloc.org>
parents: 531
diff changeset
    47
480
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
    48
	if((c->ismax = !c->ismax)) {
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
    49
		c->rx = c->x; c->x = sx;
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
    50
		c->ry = c->y; c->y = bh;
502
9aa3d06199cb applied Jukkas patch
Anselm R. Garbe <arg@10kloc.org>
parents: 488
diff changeset
    51
		c->rw = c->w; c->w = sw - 2 * BORDERPX;
9aa3d06199cb applied Jukkas patch
Anselm R. Garbe <arg@10kloc.org>
parents: 488
diff changeset
    52
		c->rh = c->h; c->h = sh - bh - 2 * BORDERPX;
480
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
    53
	}
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
    54
	else {
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
    55
		c->x = c->rx;
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
    56
		c->y = c->ry;
481
arg@mmvi
parents: 480
diff changeset
    57
		c->w = c->rw;
arg@mmvi
parents: 480
diff changeset
    58
		c->h = c->rh;
480
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
    59
	}
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
    60
	resize(c, True, TopLeft);
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
    61
	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
    62
}
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
    63
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
    64
/* extern */
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
    65
533
a5567a0d3011 do* has no Arg arument anymore (never called directly)
Anselm R. Garbe <arg@10kloc.org>
parents: 532
diff changeset
    66
void (*arrange)(void) = DEFMODE;
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
    67
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
    68
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
    69
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
    70
	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
    71
		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
    72
	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
    73
		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
    74
	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
    75
		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
    76
	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
    77
}
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
    78
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
    79
void
533
a5567a0d3011 do* has no Arg arument anymore (never called directly)
Anselm R. Garbe <arg@10kloc.org>
parents: 532
diff changeset
    80
dofloat(void) {
402
c7d5ff57998d removed unused vars
Anselm R. Garbe <arg@10kloc.org>
parents: 401
diff changeset
    81
	Client *c;
400
052657ff2e7b applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents: 397
diff changeset
    82
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
    83
	for(c = clients; c; c = c->next) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
    84
		if(isvisible(c)) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
    85
			resize(c, True, TopLeft);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
    86
		}
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
    87
		else
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
    88
			ban(c);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
    89
	}
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
    90
	if(!sel || !isvisible(sel)) {
450
728c9089b079 applied sanders patch of not manipulating sel
Anselm R. Garbe <arg@10kloc.org>
parents: 446
diff changeset
    91
		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
    92
		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
    93
	}
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
    94
	restack();
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
    95
}
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
    96
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
    97
void
533
a5567a0d3011 do* has no Arg arument anymore (never called directly)
Anselm R. Garbe <arg@10kloc.org>
parents: 532
diff changeset
    98
dotile(void) {
531
96563762b4ad yet another small fix and simplification of dotile
Anselm R. Garbe <arg@10kloc.org>
parents: 530
diff changeset
    99
	unsigned int i, n, mpx, stackw, stackh, th;
402
c7d5ff57998d removed unused vars
Anselm R. Garbe <arg@10kloc.org>
parents: 401
diff changeset
   100
	Client *c;
400
052657ff2e7b applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents: 397
diff changeset
   101
488
0d2559f46b9e applied sanders jukka patch
arg@mmvi
parents: 487
diff changeset
   102
	for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
0d2559f46b9e applied sanders jukka patch
arg@mmvi
parents: 487
diff changeset
   103
		n++;
531
96563762b4ad yet another small fix and simplification of dotile
Anselm R. Garbe <arg@10kloc.org>
parents: 530
diff changeset
   104
	mpx = (sw * master) / 1000;
96563762b4ad yet another small fix and simplification of dotile
Anselm R. Garbe <arg@10kloc.org>
parents: 530
diff changeset
   105
	stackw = sw - mpx;
530
451f19d48845 removed the stack position stuff
Anselm R. Garbe <arg@10kloc.org>
parents: 529
diff changeset
   106
	stackh = sh - bh;
451f19d48845 removed the stack position stuff
Anselm R. Garbe <arg@10kloc.org>
parents: 529
diff changeset
   107
	th = stackh;
511
1599c953647b removed the direction flipping
Anselm R. Garbe <arg@10kloc.org>
parents: 510
diff changeset
   108
	if(n > 1)
530
451f19d48845 removed the stack position stuff
Anselm R. Garbe <arg@10kloc.org>
parents: 529
diff changeset
   109
		th /= (n - 1);
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   110
535
Anselm R. Garbe <arg@10kloc.org>
parents: 533
diff changeset
   111
	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
   112
		if(isvisible(c)) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   113
			if(c->isfloat) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   114
				resize(c, True, TopLeft);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   115
				continue;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   116
			}
488
0d2559f46b9e applied sanders jukka patch
arg@mmvi
parents: 487
diff changeset
   117
			c->ismax = False;
523
c1dd19da63ef yet another simplification of dotile()
Anselm R. Garbe <arg@10kloc.org>
parents: 522
diff changeset
   118
			c->x = sx;
c1dd19da63ef yet another simplification of dotile()
Anselm R. Garbe <arg@10kloc.org>
parents: 522
diff changeset
   119
			c->y = sy + bh;
507
2824b5d0f0f0 prelim of dotile()
Anselm R. Garbe <arg@10kloc.org>
parents: 505
diff changeset
   120
			if(n == 1) { /* only 1 window */
502
9aa3d06199cb applied Jukkas patch
Anselm R. Garbe <arg@10kloc.org>
parents: 488
diff changeset
   121
				c->w = sw - 2 * BORDERPX;
9aa3d06199cb applied Jukkas patch
Anselm R. Garbe <arg@10kloc.org>
parents: 488
diff changeset
   122
				c->h = sh - 2 * BORDERPX - bh;
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   123
			}
507
2824b5d0f0f0 prelim of dotile()
Anselm R. Garbe <arg@10kloc.org>
parents: 505
diff changeset
   124
			else if(i == 0) { /* master window */
531
96563762b4ad yet another small fix and simplification of dotile
Anselm R. Garbe <arg@10kloc.org>
parents: 530
diff changeset
   125
				c->w = mpx - 2 * BORDERPX;
530
451f19d48845 removed the stack position stuff
Anselm R. Garbe <arg@10kloc.org>
parents: 529
diff changeset
   126
				c->h = sh - bh - 2 * BORDERPX;
507
2824b5d0f0f0 prelim of dotile()
Anselm R. Garbe <arg@10kloc.org>
parents: 505
diff changeset
   127
			}
523
c1dd19da63ef yet another simplification of dotile()
Anselm R. Garbe <arg@10kloc.org>
parents: 522
diff changeset
   128
			else {  /* tile window */
531
96563762b4ad yet another small fix and simplification of dotile
Anselm R. Garbe <arg@10kloc.org>
parents: 530
diff changeset
   129
				c->x += mpx;
96563762b4ad yet another small fix and simplification of dotile
Anselm R. Garbe <arg@10kloc.org>
parents: 530
diff changeset
   130
				c->w = stackw - 2 * BORDERPX;
523
c1dd19da63ef yet another simplification of dotile()
Anselm R. Garbe <arg@10kloc.org>
parents: 522
diff changeset
   131
				if(th > bh) {
530
451f19d48845 removed the stack position stuff
Anselm R. Garbe <arg@10kloc.org>
parents: 529
diff changeset
   132
					c->y = sy + (i - 1) * th + bh;
451f19d48845 removed the stack position stuff
Anselm R. Garbe <arg@10kloc.org>
parents: 529
diff changeset
   133
					if(i + 1 == n)
451f19d48845 removed the stack position stuff
Anselm R. Garbe <arg@10kloc.org>
parents: 529
diff changeset
   134
						c->h = sh - c->y - 2 * BORDERPX;
531
96563762b4ad yet another small fix and simplification of dotile
Anselm R. Garbe <arg@10kloc.org>
parents: 530
diff changeset
   135
					else
96563762b4ad yet another small fix and simplification of dotile
Anselm R. Garbe <arg@10kloc.org>
parents: 530
diff changeset
   136
						c->h = th - 2 * BORDERPX;
507
2824b5d0f0f0 prelim of dotile()
Anselm R. Garbe <arg@10kloc.org>
parents: 505
diff changeset
   137
				}
531
96563762b4ad yet another small fix and simplification of dotile
Anselm R. Garbe <arg@10kloc.org>
parents: 530
diff changeset
   138
				else /* fallback if th < bh */
523
c1dd19da63ef yet another simplification of dotile()
Anselm R. Garbe <arg@10kloc.org>
parents: 522
diff changeset
   139
					c->h = stackh - 2 * BORDERPX;
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   140
			}
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   141
			resize(c, False, TopLeft);
535
Anselm R. Garbe <arg@10kloc.org>
parents: 533
diff changeset
   142
			i++;
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   143
		}
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   144
		else
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   145
			ban(c);
532
651f2c868b31 code polishing, removed unnecessary newlines
Anselm R. Garbe <arg@10kloc.org>
parents: 531
diff changeset
   146
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
   147
	if(!sel || !isvisible(sel)) {
450
728c9089b079 applied sanders patch of not manipulating sel
Anselm R. Garbe <arg@10kloc.org>
parents: 446
diff changeset
   148
		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
   149
		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
   150
	}
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   151
	restack();
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   152
}
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
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
   155
focusnext(Arg *arg) {
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   156
	Client *c;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   157
   
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   158
	if(!sel)
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   159
		return;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   160
	if(!(c = getnext(sel->next)))
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   161
		c = getnext(clients);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   162
	if(c) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   163
		focus(c);
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
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   168
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
   169
focusprev(Arg *arg) {
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   170
	Client *c;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   171
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   172
	if(!sel)
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   173
		return;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   174
	if(!(c = getprev(sel->prev))) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   175
		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
   176
		c = getprev(c);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   177
	}
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   178
	if(c) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   179
		focus(c);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   180
		restack();
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   181
	}
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   182
}
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   183
420
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
   184
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
   185
isvisible(Client *c) {
420
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
   186
	unsigned int i;
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
   187
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
   188
	for(i = 0; i < ntags; i++)
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
   189
		if(c->tags[i] && seltag[i])
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
   190
			return True;
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
   191
	return False;
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
   192
}
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
   193
415
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
   194
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
   195
resizecol(Arg *arg) {
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
   196
	unsigned int n;
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
   197
	Client *c;
418
Anselm R. Garbe <arg@10kloc.org>
parents: 417
diff changeset
   198
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
   199
	for(n = 0, c = clients; c; c = c->next)
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
   200
		if(isvisible(c) && !c->isfloat)
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
   201
			n++;
486
8d564b9e3cd4 removed all dotile checks
arg@mmvi
parents: 485
diff changeset
   202
	if(!sel || sel->isfloat || n < 2 || (arrange == dofloat))
415
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
   203
		return;
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
   204
	if(sel == getnext(clients)) {
529
e2bd83191fc6 small boundary check fix
Anselm R. Garbe <arg@10kloc.org>
parents: 528
diff changeset
   205
		if(master + arg->i > 950 || master + arg->i < 50)
415
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
   206
			return;
505
2c29d74b11dc first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents: 504
diff changeset
   207
		master += arg->i;
415
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
   208
	}
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
   209
	else {
529
e2bd83191fc6 small boundary check fix
Anselm R. Garbe <arg@10kloc.org>
parents: 528
diff changeset
   210
		if(master - arg->i > 950 || master - arg->i < 50)
415
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
   211
			return;
505
2c29d74b11dc first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents: 504
diff changeset
   212
		master -= arg->i;
415
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
   213
	}
533
a5567a0d3011 do* has no Arg arument anymore (never called directly)
Anselm R. Garbe <arg@10kloc.org>
parents: 532
diff changeset
   214
	arrange();
415
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
   215
}
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
   216
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   217
void
487
be4f90c03582 applied Jukkas patch
arg@mmvi
parents: 486
diff changeset
   218
restack(void) {
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   219
	Client *c;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   220
	XEvent ev;
481
arg@mmvi
parents: 480
diff changeset
   221
437
433a5c662f73 drawstatus even if no client exists
Anselm R. Garbe <arg@10kloc.org>
parents: 436
diff changeset
   222
	if(!sel) {
433a5c662f73 drawstatus even if no client exists
Anselm R. Garbe <arg@10kloc.org>
parents: 436
diff changeset
   223
		drawstatus();
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   224
		return;
437
433a5c662f73 drawstatus even if no client exists
Anselm R. Garbe <arg@10kloc.org>
parents: 436
diff changeset
   225
	}
436
b3659c3c5dab sanders solution is convincing and elegant
Anselm R. Garbe <arg@10kloc.org>
parents: 433
diff changeset
   226
	if(sel->isfloat || arrange == dofloat) {
b3659c3c5dab sanders solution is convincing and elegant
Anselm R. Garbe <arg@10kloc.org>
parents: 433
diff changeset
   227
		XRaiseWindow(dpy, sel->win);
b3659c3c5dab sanders solution is convincing and elegant
Anselm R. Garbe <arg@10kloc.org>
parents: 433
diff changeset
   228
		XRaiseWindow(dpy, sel->twin);
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   229
	}
512
aca04c3022c1 fixed the z-layer issue described on mailinglist
Anselm R. Garbe <arg@10kloc.org>
parents: 511
diff changeset
   230
	if(arrange != dofloat) {
aca04c3022c1 fixed the z-layer issue described on mailinglist
Anselm R. Garbe <arg@10kloc.org>
parents: 511
diff changeset
   231
		if(!sel->isfloat) {
aca04c3022c1 fixed the z-layer issue described on mailinglist
Anselm R. Garbe <arg@10kloc.org>
parents: 511
diff changeset
   232
			XLowerWindow(dpy, sel->twin);
aca04c3022c1 fixed the z-layer issue described on mailinglist
Anselm R. Garbe <arg@10kloc.org>
parents: 511
diff changeset
   233
			XLowerWindow(dpy, sel->win);
aca04c3022c1 fixed the z-layer issue described on mailinglist
Anselm R. Garbe <arg@10kloc.org>
parents: 511
diff changeset
   234
		}
436
b3659c3c5dab sanders solution is convincing and elegant
Anselm R. Garbe <arg@10kloc.org>
parents: 433
diff changeset
   235
		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
   236
			if(c == sel)
aca04c3022c1 fixed the z-layer issue described on mailinglist
Anselm R. Garbe <arg@10kloc.org>
parents: 511
diff changeset
   237
				continue;
436
b3659c3c5dab sanders solution is convincing and elegant
Anselm R. Garbe <arg@10kloc.org>
parents: 433
diff changeset
   238
			XLowerWindow(dpy, c->twin);
b3659c3c5dab sanders solution is convincing and elegant
Anselm R. Garbe <arg@10kloc.org>
parents: 433
diff changeset
   239
			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
   240
		}
512
aca04c3022c1 fixed the z-layer issue described on mailinglist
Anselm R. Garbe <arg@10kloc.org>
parents: 511
diff changeset
   241
	}
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   242
	drawall();
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   243
	XSync(dpy, False);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   244
	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   245
}
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   246
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   247
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
   248
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
   249
	arrange = (arrange == dofloat) ? dotile : dofloat;
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   250
	if(sel)
533
a5567a0d3011 do* has no Arg arument anymore (never called directly)
Anselm R. Garbe <arg@10kloc.org>
parents: 532
diff changeset
   251
		arrange();
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   252
	else
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   253
		drawstatus();
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   254
}
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
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
   257
toggleview(Arg *arg) {
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   258
	unsigned int i;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   259
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   260
	seltag[arg->i] = !seltag[arg->i];
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   261
	for(i = 0; i < ntags && !seltag[i]; i++);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   262
	if(i == ntags)
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   263
		seltag[arg->i] = True; /* cannot toggle last view */
381
b00cc483d13b still something wrong with reorder()
Anselm R. Garbe <arg@10kloc.org>
parents: 380
diff changeset
   264
	reorder();
533
a5567a0d3011 do* has no Arg arument anymore (never called directly)
Anselm R. Garbe <arg@10kloc.org>
parents: 532
diff changeset
   265
	arrange();
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   266
}
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   267
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   268
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
   269
view(Arg *arg) {
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   270
	unsigned int i;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   271
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   272
	for(i = 0; i < ntags; i++)
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   273
		seltag[i] = False;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   274
	seltag[arg->i] = True;
381
b00cc483d13b still something wrong with reorder()
Anselm R. Garbe <arg@10kloc.org>
parents: 380
diff changeset
   275
	reorder();
533
a5567a0d3011 do* has no Arg arument anymore (never called directly)
Anselm R. Garbe <arg@10kloc.org>
parents: 532
diff changeset
   276
	arrange();
327
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
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   279
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
   280
viewall(Arg *arg) {
395
7528080beb0e added viewall to mainstream (only Ross Mohns version, not the toggle)
Anselm R. Garbe <arg@10kloc.org>
parents: 393
diff changeset
   281
	unsigned int i;
7528080beb0e added viewall to mainstream (only Ross Mohns version, not the toggle)
Anselm R. Garbe <arg@10kloc.org>
parents: 393
diff changeset
   282
7528080beb0e added viewall to mainstream (only Ross Mohns version, not the toggle)
Anselm R. Garbe <arg@10kloc.org>
parents: 393
diff changeset
   283
	for(i = 0; i < ntags; i++)
7528080beb0e added viewall to mainstream (only Ross Mohns version, not the toggle)
Anselm R. Garbe <arg@10kloc.org>
parents: 393
diff changeset
   284
		seltag[i] = True;
397
cb8a231610c7 reorder was misssing in Ross version of viewall
Anselm R. Garbe <arg@10kloc.org>
parents: 395
diff changeset
   285
	reorder();
533
a5567a0d3011 do* has no Arg arument anymore (never called directly)
Anselm R. Garbe <arg@10kloc.org>
parents: 532
diff changeset
   286
	arrange();
395
7528080beb0e added viewall to mainstream (only Ross Mohns version, not the toggle)
Anselm R. Garbe <arg@10kloc.org>
parents: 393
diff changeset
   287
}
7528080beb0e added viewall to mainstream (only Ross Mohns version, not the toggle)
Anselm R. Garbe <arg@10kloc.org>
parents: 393
diff changeset
   288
7528080beb0e added viewall to mainstream (only Ross Mohns version, not the toggle)
Anselm R. Garbe <arg@10kloc.org>
parents: 393
diff changeset
   289
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
   290
zoom(Arg *arg) {
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
   291
	unsigned int n;
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
   292
	Client *c;
473
2d8af0d7920d implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents: 463
diff changeset
   293
2d8af0d7920d implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents: 463
diff changeset
   294
	if(!sel)
2d8af0d7920d implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents: 463
diff changeset
   295
		return;
2d8af0d7920d implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents: 463
diff changeset
   296
	if(sel->isfloat || (arrange == dofloat)) {
480
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
   297
		togglemax(sel);
473
2d8af0d7920d implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents: 463
diff changeset
   298
		return;
2d8af0d7920d implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents: 463
diff changeset
   299
	}
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
   300
	for(n = 0, c = clients; c; c = c->next)
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
   301
		if(isvisible(c) && !c->isfloat)
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
   302
			n++;
486
8d564b9e3cd4 removed all dotile checks
arg@mmvi
parents: 485
diff changeset
   303
	if(n < 2 || (arrange == dofloat))
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   304
		return;
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
   305
	if((c = sel) == nexttiled(clients))
433
a6b8994af164 small fix
Anselm R. Garbe <arg@10kloc.org>
parents: 430
diff changeset
   306
		if(!(c = nexttiled(c->next)))
429
a31de8605f72 no, ordering floating clients at the end seems better
Anselm R. Garbe <arg@10kloc.org>
parents: 428
diff changeset
   307
			return;
443
548084f8d92e this patch keeps track of global z-layer order of clients which are floating or if floating mode is enabled
Anselm R. Garbe <arg@10kloc.org>
parents: 442
diff changeset
   308
	detach(c);
548084f8d92e this patch keeps track of global z-layer order of clients which are floating or if floating mode is enabled
Anselm R. Garbe <arg@10kloc.org>
parents: 442
diff changeset
   309
	if(clients)
548084f8d92e this patch keeps track of global z-layer order of clients which are floating or if floating mode is enabled
Anselm R. Garbe <arg@10kloc.org>
parents: 442
diff changeset
   310
		clients->prev = c;
548084f8d92e this patch keeps track of global z-layer order of clients which are floating or if floating mode is enabled
Anselm R. Garbe <arg@10kloc.org>
parents: 442
diff changeset
   311
	c->next = clients;
548084f8d92e this patch keeps track of global z-layer order of clients which are floating or if floating mode is enabled
Anselm R. Garbe <arg@10kloc.org>
parents: 442
diff changeset
   312
	clients = 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
   313
	focus(c);
533
a5567a0d3011 do* has no Arg arument anymore (never called directly)
Anselm R. Garbe <arg@10kloc.org>
parents: 532
diff changeset
   314
	arrange();
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
   315
}