layout.c
author Anselm R. Garbe <garbeam@gmail.com>
Fri, 10 Aug 2007 18:16:05 +0200
changeset 939 a1ac5930ba2f
parent 937 453ee57a297c
child 940 8241aba895d8
permissions -rw-r--r--
removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
910
c13cb8c6b7a5 referred to LICENSE file
Anselm R. Garbe <arg@suckless.org>
parents: 909
diff changeset
     1
/* See LICENSE file for copyright and license details. */
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
     2
#include "dwm.h"
931
8ff0f913999e implemented ratio tile as described on the mailinglist
Anselm R. Garbe <garbeam@gmail.com>
parents: 918
diff changeset
     3
#include <stdio.h>
825
bef1854ce739 fixed some issues due to the Arg->const char * transition
Anselm R. Garbe <arg@suckless.org>
parents: 823
diff changeset
     4
#include <stdlib.h>
75
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
     5
782
92862ab407d5 introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents: 780
diff changeset
     6
unsigned int blw = 0;
92862ab407d5 introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents: 780
diff changeset
     7
Layout *lt = NULL;
773
81c5237a53b8 merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents: 769
diff changeset
     8
81c5237a53b8 merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents: 769
diff changeset
     9
/* static */
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
    10
782
92862ab407d5 introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents: 780
diff changeset
    11
static unsigned int nlayouts = 0;
773
81c5237a53b8 merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents: 769
diff changeset
    12
784
74722317b171 renamed floating into swimming (this does not clash with C naming conventions and fits better the fish symbol) - also in man page
Anselm R. Garbe <arg@suckless.org>
parents: 782
diff changeset
    13
LAYOUTS
74722317b171 renamed floating into swimming (this does not clash with C naming conventions and fits better the fish symbol) - also in man page
Anselm R. Garbe <arg@suckless.org>
parents: 782
diff changeset
    14
74722317b171 renamed floating into swimming (this does not clash with C naming conventions and fits better the fish symbol) - also in man page
Anselm R. Garbe <arg@suckless.org>
parents: 782
diff changeset
    15
/* extern */
74722317b171 renamed floating into swimming (this does not clash with C naming conventions and fits better the fish symbol) - also in man page
Anselm R. Garbe <arg@suckless.org>
parents: 782
diff changeset
    16
74722317b171 renamed floating into swimming (this does not clash with C naming conventions and fits better the fish symbol) - also in man page
Anselm R. Garbe <arg@suckless.org>
parents: 782
diff changeset
    17
void
939
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
    18
floating(const char *arg) {
837
123231b9eb87 renamed untiled into floating, keeping tiled instead of tiling (afaik tiled sounds more correct) - English speakers convinced me
Anselm R. Garbe <arg@suckless.org>
parents: 831
diff changeset
    19
	Client *c;
123231b9eb87 renamed untiled into floating, keeping tiled instead of tiling (afaik tiled sounds more correct) - English speakers convinced me
Anselm R. Garbe <arg@suckless.org>
parents: 831
diff changeset
    20
939
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
    21
	if(lt->arrange != floating)
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
    22
		return;
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
    23
904
2dfd50e4cfde applied anydot's 3 minor patches, thank you anydot
Anselm R. Garbe <arg@suckless.org>
parents: 901
diff changeset
    24
	for(c = clients; c; c = c->next)
837
123231b9eb87 renamed untiled into floating, keeping tiled instead of tiling (afaik tiled sounds more correct) - English speakers convinced me
Anselm R. Garbe <arg@suckless.org>
parents: 831
diff changeset
    25
		if(isvisible(c)) {
914
dad36921af06 applied anudots [un]ban repair patch
Anselm R. Garbe <arg@suckless.org>
parents: 912
diff changeset
    26
			unban(c);
837
123231b9eb87 renamed untiled into floating, keeping tiled instead of tiling (afaik tiled sounds more correct) - English speakers convinced me
Anselm R. Garbe <arg@suckless.org>
parents: 831
diff changeset
    27
			resize(c, c->x, c->y, c->w, c->h, True);
123231b9eb87 renamed untiled into floating, keeping tiled instead of tiling (afaik tiled sounds more correct) - English speakers convinced me
Anselm R. Garbe <arg@suckless.org>
parents: 831
diff changeset
    28
		}
904
2dfd50e4cfde applied anydot's 3 minor patches, thank you anydot
Anselm R. Garbe <arg@suckless.org>
parents: 901
diff changeset
    29
		else
2dfd50e4cfde applied anydot's 3 minor patches, thank you anydot
Anselm R. Garbe <arg@suckless.org>
parents: 901
diff changeset
    30
			ban(c);
2dfd50e4cfde applied anydot's 3 minor patches, thank you anydot
Anselm R. Garbe <arg@suckless.org>
parents: 901
diff changeset
    31
	focus(NULL);
837
123231b9eb87 renamed untiled into floating, keeping tiled instead of tiling (afaik tiled sounds more correct) - English speakers convinced me
Anselm R. Garbe <arg@suckless.org>
parents: 831
diff changeset
    32
	restack();
123231b9eb87 renamed untiled into floating, keeping tiled instead of tiling (afaik tiled sounds more correct) - English speakers convinced me
Anselm R. Garbe <arg@suckless.org>
parents: 831
diff changeset
    33
}
123231b9eb87 renamed untiled into floating, keeping tiled instead of tiling (afaik tiled sounds more correct) - English speakers convinced me
Anselm R. Garbe <arg@suckless.org>
parents: 831
diff changeset
    34
123231b9eb87 renamed untiled into floating, keeping tiled instead of tiling (afaik tiled sounds more correct) - English speakers convinced me
Anselm R. Garbe <arg@suckless.org>
parents: 831
diff changeset
    35
void
829
f1ec35606dbc merged focus{prev.next} into focusclient(1/-1)
Anselm R. Garbe <arg@suckless.org>
parents: 826
diff changeset
    36
focusclient(const char *arg) {
799
30ec8b96a7f6 moved focus{next,prev} and nexttiled from client.c to layout.c (because those are not client-specific), moved toggleversatile() from layout.c to client.c (because those are client-specific)
Anselm R. Garbe <arg@suckless.org>
parents: 790
diff changeset
    37
	Client *c;
30ec8b96a7f6 moved focus{next,prev} and nexttiled from client.c to layout.c (because those are not client-specific), moved toggleversatile() from layout.c to client.c (because those are client-specific)
Anselm R. Garbe <arg@suckless.org>
parents: 790
diff changeset
    38
   
829
f1ec35606dbc merged focus{prev.next} into focusclient(1/-1)
Anselm R. Garbe <arg@suckless.org>
parents: 826
diff changeset
    39
	if(!sel || !arg)
f1ec35606dbc merged focus{prev.next} into focusclient(1/-1)
Anselm R. Garbe <arg@suckless.org>
parents: 826
diff changeset
    40
		return;
831
8b84189854dc simplified focusclient()
Anselm R. Garbe <arg@suckless.org>
parents: 830
diff changeset
    41
	if(atoi(arg) < 0) {
829
f1ec35606dbc merged focus{prev.next} into focusclient(1/-1)
Anselm R. Garbe <arg@suckless.org>
parents: 826
diff changeset
    42
		for(c = sel->prev; c && !isvisible(c); c = c->prev);
f1ec35606dbc merged focus{prev.next} into focusclient(1/-1)
Anselm R. Garbe <arg@suckless.org>
parents: 826
diff changeset
    43
		if(!c) {
f1ec35606dbc merged focus{prev.next} into focusclient(1/-1)
Anselm R. Garbe <arg@suckless.org>
parents: 826
diff changeset
    44
			for(c = clients; c && c->next; c = c->next);
f1ec35606dbc merged focus{prev.next} into focusclient(1/-1)
Anselm R. Garbe <arg@suckless.org>
parents: 826
diff changeset
    45
			for(; c && !isvisible(c); c = c->prev);
f1ec35606dbc merged focus{prev.next} into focusclient(1/-1)
Anselm R. Garbe <arg@suckless.org>
parents: 826
diff changeset
    46
		}
831
8b84189854dc simplified focusclient()
Anselm R. Garbe <arg@suckless.org>
parents: 830
diff changeset
    47
	}
8b84189854dc simplified focusclient()
Anselm R. Garbe <arg@suckless.org>
parents: 830
diff changeset
    48
	else {
8b84189854dc simplified focusclient()
Anselm R. Garbe <arg@suckless.org>
parents: 830
diff changeset
    49
		for(c = sel->next; c && !isvisible(c); c = c->next);
8b84189854dc simplified focusclient()
Anselm R. Garbe <arg@suckless.org>
parents: 830
diff changeset
    50
		if(!c)
8b84189854dc simplified focusclient()
Anselm R. Garbe <arg@suckless.org>
parents: 830
diff changeset
    51
			for(c = clients; c && !isvisible(c); c = c->next);
799
30ec8b96a7f6 moved focus{next,prev} and nexttiled from client.c to layout.c (because those are not client-specific), moved toggleversatile() from layout.c to client.c (because those are client-specific)
Anselm R. Garbe <arg@suckless.org>
parents: 790
diff changeset
    52
	}
30ec8b96a7f6 moved focus{next,prev} and nexttiled from client.c to layout.c (because those are not client-specific), moved toggleversatile() from layout.c to client.c (because those are client-specific)
Anselm R. Garbe <arg@suckless.org>
parents: 790
diff changeset
    53
	if(c) {
30ec8b96a7f6 moved focus{next,prev} and nexttiled from client.c to layout.c (because those are not client-specific), moved toggleversatile() from layout.c to client.c (because those are client-specific)
Anselm R. Garbe <arg@suckless.org>
parents: 790
diff changeset
    54
		focus(c);
30ec8b96a7f6 moved focus{next,prev} and nexttiled from client.c to layout.c (because those are not client-specific), moved toggleversatile() from layout.c to client.c (because those are client-specific)
Anselm R. Garbe <arg@suckless.org>
parents: 790
diff changeset
    55
		restack();
30ec8b96a7f6 moved focus{next,prev} and nexttiled from client.c to layout.c (because those are not client-specific), moved toggleversatile() from layout.c to client.c (because those are client-specific)
Anselm R. Garbe <arg@suckless.org>
parents: 790
diff changeset
    56
	}
30ec8b96a7f6 moved focus{next,prev} and nexttiled from client.c to layout.c (because those are not client-specific), moved toggleversatile() from layout.c to client.c (because those are client-specific)
Anselm R. Garbe <arg@suckless.org>
parents: 790
diff changeset
    57
}
30ec8b96a7f6 moved focus{next,prev} and nexttiled from client.c to layout.c (because those are not client-specific), moved toggleversatile() from layout.c to client.c (because those are client-specific)
Anselm R. Garbe <arg@suckless.org>
parents: 790
diff changeset
    58
30ec8b96a7f6 moved focus{next,prev} and nexttiled from client.c to layout.c (because those are not client-specific), moved toggleversatile() from layout.c to client.c (because those are client-specific)
Anselm R. Garbe <arg@suckless.org>
parents: 790
diff changeset
    59
void
782
92862ab407d5 introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents: 780
diff changeset
    60
initlayouts(void) {
92862ab407d5 introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents: 780
diff changeset
    61
	unsigned int i, w;
92862ab407d5 introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents: 780
diff changeset
    62
92862ab407d5 introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents: 780
diff changeset
    63
	lt = &layout[0];
92862ab407d5 introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents: 780
diff changeset
    64
	nlayouts = sizeof layout / sizeof layout[0];
92862ab407d5 introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents: 780
diff changeset
    65
	for(blw = i = 0; i < nlayouts; i++) {
92862ab407d5 introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents: 780
diff changeset
    66
		w = textw(layout[i].symbol);
92862ab407d5 introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents: 780
diff changeset
    67
		if(w > blw)
92862ab407d5 introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents: 780
diff changeset
    68
			blw = w;
92862ab407d5 introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents: 780
diff changeset
    69
	}
92862ab407d5 introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents: 780
diff changeset
    70
}
92862ab407d5 introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents: 780
diff changeset
    71
799
30ec8b96a7f6 moved focus{next,prev} and nexttiled from client.c to layout.c (because those are not client-specific), moved toggleversatile() from layout.c to client.c (because those are client-specific)
Anselm R. Garbe <arg@suckless.org>
parents: 790
diff changeset
    72
Client *
30ec8b96a7f6 moved focus{next,prev} and nexttiled from client.c to layout.c (because those are not client-specific), moved toggleversatile() from layout.c to client.c (because those are client-specific)
Anselm R. Garbe <arg@suckless.org>
parents: 790
diff changeset
    73
nexttiled(Client *c) {
837
123231b9eb87 renamed untiled into floating, keeping tiled instead of tiling (afaik tiled sounds more correct) - English speakers convinced me
Anselm R. Garbe <arg@suckless.org>
parents: 831
diff changeset
    74
	for(; c && (c->isfloating || !isvisible(c)); c = c->next);
799
30ec8b96a7f6 moved focus{next,prev} and nexttiled from client.c to layout.c (because those are not client-specific), moved toggleversatile() from layout.c to client.c (because those are client-specific)
Anselm R. Garbe <arg@suckless.org>
parents: 790
diff changeset
    75
	return c;
30ec8b96a7f6 moved focus{next,prev} and nexttiled from client.c to layout.c (because those are not client-specific), moved toggleversatile() from layout.c to client.c (because those are client-specific)
Anselm R. Garbe <arg@suckless.org>
parents: 790
diff changeset
    76
}
30ec8b96a7f6 moved focus{next,prev} and nexttiled from client.c to layout.c (because those are not client-specific), moved toggleversatile() from layout.c to client.c (because those are client-specific)
Anselm R. Garbe <arg@suckless.org>
parents: 790
diff changeset
    77
773
81c5237a53b8 merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents: 769
diff changeset
    78
void
81c5237a53b8 merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents: 769
diff changeset
    79
restack(void) {
81c5237a53b8 merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents: 769
diff changeset
    80
	Client *c;
81c5237a53b8 merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents: 769
diff changeset
    81
	XEvent ev;
918
7c556b28f1f6 applied restack patch of anydot, with slight changes
Anselm R. Garbe <arg@suckless.org>
parents: 915
diff changeset
    82
	XWindowChanges wc;
773
81c5237a53b8 merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents: 769
diff changeset
    83
81c5237a53b8 merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents: 769
diff changeset
    84
	drawstatus();
81c5237a53b8 merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents: 769
diff changeset
    85
	if(!sel)
81c5237a53b8 merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents: 769
diff changeset
    86
		return;
837
123231b9eb87 renamed untiled into floating, keeping tiled instead of tiling (afaik tiled sounds more correct) - English speakers convinced me
Anselm R. Garbe <arg@suckless.org>
parents: 831
diff changeset
    87
	if(sel->isfloating || lt->arrange == floating)
773
81c5237a53b8 merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents: 769
diff changeset
    88
		XRaiseWindow(dpy, sel->win);
837
123231b9eb87 renamed untiled into floating, keeping tiled instead of tiling (afaik tiled sounds more correct) - English speakers convinced me
Anselm R. Garbe <arg@suckless.org>
parents: 831
diff changeset
    89
	if(lt->arrange != floating) {
918
7c556b28f1f6 applied restack patch of anydot, with slight changes
Anselm R. Garbe <arg@suckless.org>
parents: 915
diff changeset
    90
		wc.stack_mode = Below;
7c556b28f1f6 applied restack patch of anydot, with slight changes
Anselm R. Garbe <arg@suckless.org>
parents: 915
diff changeset
    91
		wc.sibling = barwin;
7c556b28f1f6 applied restack patch of anydot, with slight changes
Anselm R. Garbe <arg@suckless.org>
parents: 915
diff changeset
    92
		if(!sel->isfloating) {
7c556b28f1f6 applied restack patch of anydot, with slight changes
Anselm R. Garbe <arg@suckless.org>
parents: 915
diff changeset
    93
			XConfigureWindow(dpy, sel->win, CWSibling | CWStackMode, &wc);
7c556b28f1f6 applied restack patch of anydot, with slight changes
Anselm R. Garbe <arg@suckless.org>
parents: 915
diff changeset
    94
			wc.sibling = sel->win;
7c556b28f1f6 applied restack patch of anydot, with slight changes
Anselm R. Garbe <arg@suckless.org>
parents: 915
diff changeset
    95
		}
776
be103ae46dbc renamed view.c into screen.c
Anselm R. Garbe <arg@suckless.org>
parents: 775
diff changeset
    96
		for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
773
81c5237a53b8 merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents: 769
diff changeset
    97
			if(c == sel)
81c5237a53b8 merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents: 769
diff changeset
    98
				continue;
918
7c556b28f1f6 applied restack patch of anydot, with slight changes
Anselm R. Garbe <arg@suckless.org>
parents: 915
diff changeset
    99
			XConfigureWindow(dpy, c->win, CWSibling | CWStackMode, &wc);
7c556b28f1f6 applied restack patch of anydot, with slight changes
Anselm R. Garbe <arg@suckless.org>
parents: 915
diff changeset
   100
			wc.sibling = c->win;
773
81c5237a53b8 merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents: 769
diff changeset
   101
		}
81c5237a53b8 merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents: 769
diff changeset
   102
	}
81c5237a53b8 merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents: 769
diff changeset
   103
	XSync(dpy, False);
81c5237a53b8 merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents: 769
diff changeset
   104
	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
81c5237a53b8 merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents: 769
diff changeset
   105
}
81c5237a53b8 merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents: 769
diff changeset
   106
81c5237a53b8 merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents: 769
diff changeset
   107
void
823
fb5cbf0bd923 replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents: 819
diff changeset
   108
setlayout(const char *arg) {
826
d900a3f821a3 small bugfix
Anselm R. Garbe <arg@suckless.org>
parents: 825
diff changeset
   109
	int i;
788
a61fcdf7b4c1 replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents: 786
diff changeset
   110
823
fb5cbf0bd923 replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents: 819
diff changeset
   111
	if(!arg) {
891
b940ac76c22f applied Szabolcs proposal to simplify setlayout()
Anselm R. Garbe <arg@suckless.org>
parents: 889
diff changeset
   112
		lt++;
b940ac76c22f applied Szabolcs proposal to simplify setlayout()
Anselm R. Garbe <arg@suckless.org>
parents: 889
diff changeset
   113
		if(lt == layout + nlayouts)
b940ac76c22f applied Szabolcs proposal to simplify setlayout()
Anselm R. Garbe <arg@suckless.org>
parents: 889
diff changeset
   114
			lt = layout;
788
a61fcdf7b4c1 replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents: 786
diff changeset
   115
	}
a61fcdf7b4c1 replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents: 786
diff changeset
   116
	else {
823
fb5cbf0bd923 replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents: 819
diff changeset
   117
		i = atoi(arg);
fb5cbf0bd923 replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents: 819
diff changeset
   118
		if(i < 0 || i >= nlayouts)
788
a61fcdf7b4c1 replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents: 786
diff changeset
   119
			return;
823
fb5cbf0bd923 replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents: 819
diff changeset
   120
		lt = &layout[i];
788
a61fcdf7b4c1 replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents: 786
diff changeset
   121
	}
a61fcdf7b4c1 replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents: 786
diff changeset
   122
	if(sel)
939
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   123
		lt->arrange(NULL);
788
a61fcdf7b4c1 replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents: 786
diff changeset
   124
	else
a61fcdf7b4c1 replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents: 786
diff changeset
   125
		drawstatus();
a61fcdf7b4c1 replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents: 786
diff changeset
   126
}
a61fcdf7b4c1 replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents: 786
diff changeset
   127
a61fcdf7b4c1 replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents: 786
diff changeset
   128
void
939
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   129
tile(const char *arg) {
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   130
	static double master = MASTER;
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   131
	double delta;
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   132
	unsigned int i, n, nx, ny, nw, nh, mw, th;
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   133
	Client *c;
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   134
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   135
	if(lt->arrange != tile)
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   136
		return;
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   137
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   138
	/* arg handling, manipulate master */
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   139
	if(arg && (1 == sscanf(arg, "%lf", &delta))) {
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   140
		if(delta + master > 0.1 && delta + master < 0.9)
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   141
			master += delta;
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   142
	}
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   143
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   144
	for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   145
		n++;
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   146
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   147
	/* window geoms */
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   148
	mw = (n == 1) ? waw : master * waw;
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   149
	th = (n > 1) ? wah / (n - 1) : 0;
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   150
	if(n > 1 && th < bh)
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   151
		th = wah;
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   152
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   153
	nx = wax;
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   154
	ny = way;
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   155
	for(i = 0, c = clients; c; c = c->next)
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   156
		if(isvisible(c)) {
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   157
			unban(c);
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   158
			if(c->isfloating)
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   159
				continue;
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   160
			c->ismax = False;
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   161
			if(i == 0) { /* master */
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   162
				nw = mw - 2 * c->border;
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   163
				nh = wah - 2 * c->border;
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   164
			}
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   165
			else {  /* tile window */
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   166
				if(i == 1) {
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   167
					ny = way;
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   168
					nx += mw;
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   169
				}
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   170
				nw = waw - mw - 2 * c->border;
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   171
				if(i + 1 == n) /* remainder */
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   172
					nh = (way + wah) - ny - 2 * c->border;
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   173
				else
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   174
					nh = th - 2 * c->border;
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   175
			}
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   176
			resize(c, nx, ny, nw, nh, False);
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   177
			if(n > 1 && th != wah)
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   178
				ny += nh;
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   179
			i++;
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   180
		}
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   181
		else
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   182
			ban(c);
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   183
	focus(NULL);
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   184
	restack();
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   185
}
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   186
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   187
void
878
d2ae55f83f9f made bar togglalble
Anselm R. Garbe <arg@suckless.org>
parents: 875
diff changeset
   188
togglebar(const char *arg) {
887
44755dcf1ad4 simplification
Anselm R. Garbe <arg@suckless.org>
parents: 883
diff changeset
   189
	if(bpos == BarOff)
44755dcf1ad4 simplification
Anselm R. Garbe <arg@suckless.org>
parents: 883
diff changeset
   190
		bpos = (BARPOS == BarOff) ? BarTop : BARPOS;
883
2cbf1010be11 using BarTop as fallback if BARPOS is set to BarOff as default for toggling
Anselm R. Garbe <arg@suckless.org>
parents: 880
diff changeset
   191
	else
2cbf1010be11 using BarTop as fallback if BARPOS is set to BarOff as default for toggling
Anselm R. Garbe <arg@suckless.org>
parents: 880
diff changeset
   192
		bpos = BarOff;
878
d2ae55f83f9f made bar togglalble
Anselm R. Garbe <arg@suckless.org>
parents: 875
diff changeset
   193
	updatebarpos();
939
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   194
	lt->arrange(NULL);
878
d2ae55f83f9f made bar togglalble
Anselm R. Garbe <arg@suckless.org>
parents: 875
diff changeset
   195
}
d2ae55f83f9f made bar togglalble
Anselm R. Garbe <arg@suckless.org>
parents: 875
diff changeset
   196
d2ae55f83f9f made bar togglalble
Anselm R. Garbe <arg@suckless.org>
parents: 875
diff changeset
   197
void
823
fb5cbf0bd923 replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents: 819
diff changeset
   198
togglemax(const char *arg) {
813
0ed770c96e51 several changes, made togglemax extern and separated it from zoom() - moved zoom() and togglemax() into layout.c, changed void (*func)(Arg *) into void (*func)(Arg), changed default keybindings of focusnext/focusprev and incmasterw to h/j/k/l accordingly, made keys in config*h appear alphabetically (special keys first), renamed resizemaster into incmasterw, renamed MASTER into MASTERWIDTH
Anselm R. Garbe <arg@suckless.org>
parents: 799
diff changeset
   199
	XEvent ev;
0ed770c96e51 several changes, made togglemax extern and separated it from zoom() - moved zoom() and togglemax() into layout.c, changed void (*func)(Arg *) into void (*func)(Arg), changed default keybindings of focusnext/focusprev and incmasterw to h/j/k/l accordingly, made keys in config*h appear alphabetically (special keys first), renamed resizemaster into incmasterw, renamed MASTER into MASTERWIDTH
Anselm R. Garbe <arg@suckless.org>
parents: 799
diff changeset
   200
837
123231b9eb87 renamed untiled into floating, keeping tiled instead of tiling (afaik tiled sounds more correct) - English speakers convinced me
Anselm R. Garbe <arg@suckless.org>
parents: 831
diff changeset
   201
	if(!sel || (lt->arrange != floating && !sel->isfloating) || sel->isfixed)
813
0ed770c96e51 several changes, made togglemax extern and separated it from zoom() - moved zoom() and togglemax() into layout.c, changed void (*func)(Arg *) into void (*func)(Arg), changed default keybindings of focusnext/focusprev and incmasterw to h/j/k/l accordingly, made keys in config*h appear alphabetically (special keys first), renamed resizemaster into incmasterw, renamed MASTER into MASTERWIDTH
Anselm R. Garbe <arg@suckless.org>
parents: 799
diff changeset
   202
		return;
0ed770c96e51 several changes, made togglemax extern and separated it from zoom() - moved zoom() and togglemax() into layout.c, changed void (*func)(Arg *) into void (*func)(Arg), changed default keybindings of focusnext/focusprev and incmasterw to h/j/k/l accordingly, made keys in config*h appear alphabetically (special keys first), renamed resizemaster into incmasterw, renamed MASTER into MASTERWIDTH
Anselm R. Garbe <arg@suckless.org>
parents: 799
diff changeset
   203
	if((sel->ismax = !sel->ismax)) {
0ed770c96e51 several changes, made togglemax extern and separated it from zoom() - moved zoom() and togglemax() into layout.c, changed void (*func)(Arg *) into void (*func)(Arg), changed default keybindings of focusnext/focusprev and incmasterw to h/j/k/l accordingly, made keys in config*h appear alphabetically (special keys first), renamed resizemaster into incmasterw, renamed MASTER into MASTERWIDTH
Anselm R. Garbe <arg@suckless.org>
parents: 799
diff changeset
   204
		sel->rx = sel->x;
0ed770c96e51 several changes, made togglemax extern and separated it from zoom() - moved zoom() and togglemax() into layout.c, changed void (*func)(Arg *) into void (*func)(Arg), changed default keybindings of focusnext/focusprev and incmasterw to h/j/k/l accordingly, made keys in config*h appear alphabetically (special keys first), renamed resizemaster into incmasterw, renamed MASTER into MASTERWIDTH
Anselm R. Garbe <arg@suckless.org>
parents: 799
diff changeset
   205
		sel->ry = sel->y;
0ed770c96e51 several changes, made togglemax extern and separated it from zoom() - moved zoom() and togglemax() into layout.c, changed void (*func)(Arg *) into void (*func)(Arg), changed default keybindings of focusnext/focusprev and incmasterw to h/j/k/l accordingly, made keys in config*h appear alphabetically (special keys first), renamed resizemaster into incmasterw, renamed MASTER into MASTERWIDTH
Anselm R. Garbe <arg@suckless.org>
parents: 799
diff changeset
   206
		sel->rw = sel->w;
0ed770c96e51 several changes, made togglemax extern and separated it from zoom() - moved zoom() and togglemax() into layout.c, changed void (*func)(Arg *) into void (*func)(Arg), changed default keybindings of focusnext/focusprev and incmasterw to h/j/k/l accordingly, made keys in config*h appear alphabetically (special keys first), renamed resizemaster into incmasterw, renamed MASTER into MASTERWIDTH
Anselm R. Garbe <arg@suckless.org>
parents: 799
diff changeset
   207
		sel->rh = sel->h;
912
f7b26d6efc9f replaced BORDERPX with sel->border in togglemax(), in other places this is not possible.
Anselm R. Garbe <arg@suckless.org>
parents: 910
diff changeset
   208
		resize(sel, wax, way, waw - 2 * sel->border, wah - 2 * sel->border, True);
813
0ed770c96e51 several changes, made togglemax extern and separated it from zoom() - moved zoom() and togglemax() into layout.c, changed void (*func)(Arg *) into void (*func)(Arg), changed default keybindings of focusnext/focusprev and incmasterw to h/j/k/l accordingly, made keys in config*h appear alphabetically (special keys first), renamed resizemaster into incmasterw, renamed MASTER into MASTERWIDTH
Anselm R. Garbe <arg@suckless.org>
parents: 799
diff changeset
   209
	}
0ed770c96e51 several changes, made togglemax extern and separated it from zoom() - moved zoom() and togglemax() into layout.c, changed void (*func)(Arg *) into void (*func)(Arg), changed default keybindings of focusnext/focusprev and incmasterw to h/j/k/l accordingly, made keys in config*h appear alphabetically (special keys first), renamed resizemaster into incmasterw, renamed MASTER into MASTERWIDTH
Anselm R. Garbe <arg@suckless.org>
parents: 799
diff changeset
   210
	else
0ed770c96e51 several changes, made togglemax extern and separated it from zoom() - moved zoom() and togglemax() into layout.c, changed void (*func)(Arg *) into void (*func)(Arg), changed default keybindings of focusnext/focusprev and incmasterw to h/j/k/l accordingly, made keys in config*h appear alphabetically (special keys first), renamed resizemaster into incmasterw, renamed MASTER into MASTERWIDTH
Anselm R. Garbe <arg@suckless.org>
parents: 799
diff changeset
   211
		resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, True);
819
21562c2567a6 status needs update even in togglemax() - since we got an indicator for this
Anselm R. Garbe <arg@suckless.org>
parents: 815
diff changeset
   212
	drawstatus();
813
0ed770c96e51 several changes, made togglemax extern and separated it from zoom() - moved zoom() and togglemax() into layout.c, changed void (*func)(Arg *) into void (*func)(Arg), changed default keybindings of focusnext/focusprev and incmasterw to h/j/k/l accordingly, made keys in config*h appear alphabetically (special keys first), renamed resizemaster into incmasterw, renamed MASTER into MASTERWIDTH
Anselm R. Garbe <arg@suckless.org>
parents: 799
diff changeset
   213
	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
0ed770c96e51 several changes, made togglemax extern and separated it from zoom() - moved zoom() and togglemax() into layout.c, changed void (*func)(Arg *) into void (*func)(Arg), changed default keybindings of focusnext/focusprev and incmasterw to h/j/k/l accordingly, made keys in config*h appear alphabetically (special keys first), renamed resizemaster into incmasterw, renamed MASTER into MASTERWIDTH
Anselm R. Garbe <arg@suckless.org>
parents: 799
diff changeset
   214
}
0ed770c96e51 several changes, made togglemax extern and separated it from zoom() - moved zoom() and togglemax() into layout.c, changed void (*func)(Arg *) into void (*func)(Arg), changed default keybindings of focusnext/focusprev and incmasterw to h/j/k/l accordingly, made keys in config*h appear alphabetically (special keys first), renamed resizemaster into incmasterw, renamed MASTER into MASTERWIDTH
Anselm R. Garbe <arg@suckless.org>
parents: 799
diff changeset
   215
0ed770c96e51 several changes, made togglemax extern and separated it from zoom() - moved zoom() and togglemax() into layout.c, changed void (*func)(Arg *) into void (*func)(Arg), changed default keybindings of focusnext/focusprev and incmasterw to h/j/k/l accordingly, made keys in config*h appear alphabetically (special keys first), renamed resizemaster into incmasterw, renamed MASTER into MASTERWIDTH
Anselm R. Garbe <arg@suckless.org>
parents: 799
diff changeset
   216
void
823
fb5cbf0bd923 replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents: 819
diff changeset
   217
zoom(const char *arg) {
813
0ed770c96e51 several changes, made togglemax extern and separated it from zoom() - moved zoom() and togglemax() into layout.c, changed void (*func)(Arg *) into void (*func)(Arg), changed default keybindings of focusnext/focusprev and incmasterw to h/j/k/l accordingly, made keys in config*h appear alphabetically (special keys first), renamed resizemaster into incmasterw, renamed MASTER into MASTERWIDTH
Anselm R. Garbe <arg@suckless.org>
parents: 799
diff changeset
   218
	Client *c;
0ed770c96e51 several changes, made togglemax extern and separated it from zoom() - moved zoom() and togglemax() into layout.c, changed void (*func)(Arg *) into void (*func)(Arg), changed default keybindings of focusnext/focusprev and incmasterw to h/j/k/l accordingly, made keys in config*h appear alphabetically (special keys first), renamed resizemaster into incmasterw, renamed MASTER into MASTERWIDTH
Anselm R. Garbe <arg@suckless.org>
parents: 799
diff changeset
   219
892
42bf8e618d52 applied Szabolcs proposal for zoom() as well
Anselm R. Garbe <arg@suckless.org>
parents: 891
diff changeset
   220
	if(!sel || lt->arrange == floating || sel->isfloating)
813
0ed770c96e51 several changes, made togglemax extern and separated it from zoom() - moved zoom() and togglemax() into layout.c, changed void (*func)(Arg *) into void (*func)(Arg), changed default keybindings of focusnext/focusprev and incmasterw to h/j/k/l accordingly, made keys in config*h appear alphabetically (special keys first), renamed resizemaster into incmasterw, renamed MASTER into MASTERWIDTH
Anselm R. Garbe <arg@suckless.org>
parents: 799
diff changeset
   221
		return;
0ed770c96e51 several changes, made togglemax extern and separated it from zoom() - moved zoom() and togglemax() into layout.c, changed void (*func)(Arg *) into void (*func)(Arg), changed default keybindings of focusnext/focusprev and incmasterw to h/j/k/l accordingly, made keys in config*h appear alphabetically (special keys first), renamed resizemaster into incmasterw, renamed MASTER into MASTERWIDTH
Anselm R. Garbe <arg@suckless.org>
parents: 799
diff changeset
   222
	if((c = sel) == nexttiled(clients))
0ed770c96e51 several changes, made togglemax extern and separated it from zoom() - moved zoom() and togglemax() into layout.c, changed void (*func)(Arg *) into void (*func)(Arg), changed default keybindings of focusnext/focusprev and incmasterw to h/j/k/l accordingly, made keys in config*h appear alphabetically (special keys first), renamed resizemaster into incmasterw, renamed MASTER into MASTERWIDTH
Anselm R. Garbe <arg@suckless.org>
parents: 799
diff changeset
   223
		if(!(c = nexttiled(c->next)))
0ed770c96e51 several changes, made togglemax extern and separated it from zoom() - moved zoom() and togglemax() into layout.c, changed void (*func)(Arg *) into void (*func)(Arg), changed default keybindings of focusnext/focusprev and incmasterw to h/j/k/l accordingly, made keys in config*h appear alphabetically (special keys first), renamed resizemaster into incmasterw, renamed MASTER into MASTERWIDTH
Anselm R. Garbe <arg@suckless.org>
parents: 799
diff changeset
   224
			return;
0ed770c96e51 several changes, made togglemax extern and separated it from zoom() - moved zoom() and togglemax() into layout.c, changed void (*func)(Arg *) into void (*func)(Arg), changed default keybindings of focusnext/focusprev and incmasterw to h/j/k/l accordingly, made keys in config*h appear alphabetically (special keys first), renamed resizemaster into incmasterw, renamed MASTER into MASTERWIDTH
Anselm R. Garbe <arg@suckless.org>
parents: 799
diff changeset
   225
	detach(c);
0ed770c96e51 several changes, made togglemax extern and separated it from zoom() - moved zoom() and togglemax() into layout.c, changed void (*func)(Arg *) into void (*func)(Arg), changed default keybindings of focusnext/focusprev and incmasterw to h/j/k/l accordingly, made keys in config*h appear alphabetically (special keys first), renamed resizemaster into incmasterw, renamed MASTER into MASTERWIDTH
Anselm R. Garbe <arg@suckless.org>
parents: 799
diff changeset
   226
	attach(c);
0ed770c96e51 several changes, made togglemax extern and separated it from zoom() - moved zoom() and togglemax() into layout.c, changed void (*func)(Arg *) into void (*func)(Arg), changed default keybindings of focusnext/focusprev and incmasterw to h/j/k/l accordingly, made keys in config*h appear alphabetically (special keys first), renamed resizemaster into incmasterw, renamed MASTER into MASTERWIDTH
Anselm R. Garbe <arg@suckless.org>
parents: 799
diff changeset
   227
	focus(c);
939
a1ac5930ba2f removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist for details
Anselm R. Garbe <garbeam@gmail.com>
parents: 937
diff changeset
   228
	lt->arrange(NULL);
813
0ed770c96e51 several changes, made togglemax extern and separated it from zoom() - moved zoom() and togglemax() into layout.c, changed void (*func)(Arg *) into void (*func)(Arg), changed default keybindings of focusnext/focusprev and incmasterw to h/j/k/l accordingly, made keys in config*h appear alphabetically (special keys first), renamed resizemaster into incmasterw, renamed MASTER into MASTERWIDTH
Anselm R. Garbe <arg@suckless.org>
parents: 799
diff changeset
   229
}