tag.c
author Anselm R.Garbe <arg@10ksloc.org>
Mon, 14 Aug 2006 15:31:58 +0200
changeset 276 9a0a351dd910
parent 272 be40a56df248
child 277 1e7fa455e3b4
permissions -rw-r--r--
pplied Sanders appendtag patch
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
75
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
     1
/*
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
     2
 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
     3
 * See LICENSE file for license details.
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
     4
 */
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
     5
#include "dwm.h"
114
dfa5cd0969a6 implemented regexp matching for rules
arg@10ksloc.org
parents: 104
diff changeset
     6
#include <regex.h>
dfa5cd0969a6 implemented regexp matching for rules
arg@10ksloc.org
parents: 104
diff changeset
     7
#include <stdio.h>
191
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
     8
#include <stdlib.h>
75
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
     9
#include <string.h>
114
dfa5cd0969a6 implemented regexp matching for rules
arg@10ksloc.org
parents: 104
diff changeset
    10
#include <sys/types.h>
75
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    11
#include <X11/Xutil.h>
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    12
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
    13
114
dfa5cd0969a6 implemented regexp matching for rules
arg@10ksloc.org
parents: 104
diff changeset
    14
typedef struct {
191
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
    15
	const char *clpattern;
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
    16
	const char *tpattern;
114
dfa5cd0969a6 implemented regexp matching for rules
arg@10ksloc.org
parents: 104
diff changeset
    17
	Bool isfloat;
dfa5cd0969a6 implemented regexp matching for rules
arg@10ksloc.org
parents: 104
diff changeset
    18
} Rule;
dfa5cd0969a6 implemented regexp matching for rules
arg@10ksloc.org
parents: 104
diff changeset
    19
191
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
    20
typedef struct {
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
    21
	regex_t *clregex;
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
    22
	regex_t *tregex;
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
    23
} RReg;
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
    24
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
    25
/* static */
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
    26
146
f328ce9c558c centralized/externalized configuration to config.h
arg@10ksloc.org
parents: 144
diff changeset
    27
TAGS
f328ce9c558c centralized/externalized configuration to config.h
arg@10ksloc.org
parents: 144
diff changeset
    28
RULES
84
052fe7498930 ordered variables in structs and source files alphabetically
Anselm R. Garbe <garbeam@wmii.de>
parents: 80
diff changeset
    29
191
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
    30
static RReg *rreg = NULL;
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
    31
static unsigned int len = 0;
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
    32
156
9bd8a1a50464 renamed ARRANGE into DEFMODE
arg@10ksloc.org
parents: 146
diff changeset
    33
void (*arrange)(Arg *) = DEFMODE;
125
b4b8b4236599 cleaned the CUSTOMIZE flags
arg@10ksloc.org
parents: 124
diff changeset
    34
b4b8b4236599 cleaned the CUSTOMIZE flags
arg@10ksloc.org
parents: 124
diff changeset
    35
/* extern */
b4b8b4236599 cleaned the CUSTOMIZE flags
arg@10ksloc.org
parents: 124
diff changeset
    36
75
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    37
void
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
    38
appendtag(Arg *arg)
75
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    39
{
276
9a0a351dd910 pplied Sanders appendtag patch
Anselm R.Garbe <arg@10ksloc.org>
parents: 272
diff changeset
    40
	Client *c = sel;
9a0a351dd910 pplied Sanders appendtag patch
Anselm R.Garbe <arg@10ksloc.org>
parents: 272
diff changeset
    41
9a0a351dd910 pplied Sanders appendtag patch
Anselm R.Garbe <arg@10ksloc.org>
parents: 272
diff changeset
    42
	if(!c)
75
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    43
		return;
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    44
276
9a0a351dd910 pplied Sanders appendtag patch
Anselm R.Garbe <arg@10ksloc.org>
parents: 272
diff changeset
    45
	c->tags[arg->i] = True;
75
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    46
	arrange(NULL);
276
9a0a351dd910 pplied Sanders appendtag patch
Anselm R.Garbe <arg@10ksloc.org>
parents: 272
diff changeset
    47
	focus(c);
9a0a351dd910 pplied Sanders appendtag patch
Anselm R.Garbe <arg@10ksloc.org>
parents: 272
diff changeset
    48
	restack();
75
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    49
}
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    50
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    51
void
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    52
dofloat(Arg *arg)
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    53
{
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    54
	Client *c;
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    55
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    56
	for(c = clients; c; c = c->next) {
124
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
    57
		c->ismax = False;
261
d6fd632d861c implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents: 240
diff changeset
    58
		if(isvisible(c)) {
99
a19556fe83b5 applied Sanders resize patch, fixed lower bug
arg@10ksloc.org
parents: 97
diff changeset
    59
			resize(c, True, TopLeft);
95
5d88952cbf96 implemened distinguishing float/managed geometries of clients (works quite well)
Anselm R. Garbe <garbeam@wmii.de>
parents: 94
diff changeset
    60
		}
75
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    61
		else
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    62
			ban(c);
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    63
	}
194
655e38416bb8 fixed view-change bug reported on the list
arg@10ksloc.org
parents: 191
diff changeset
    64
	if((sel = getnext(clients))) {
655e38416bb8 fixed view-change bug reported on the list
arg@10ksloc.org
parents: 191
diff changeset
    65
		focus(sel);
270
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
    66
		restack();
75
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    67
	}
194
655e38416bb8 fixed view-change bug reported on the list
arg@10ksloc.org
parents: 191
diff changeset
    68
	else
655e38416bb8 fixed view-change bug reported on the list
arg@10ksloc.org
parents: 191
diff changeset
    69
		XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
75
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    70
}
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    71
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    72
void
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    73
dotile(Arg *arg)
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    74
{
270
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
    75
	int h, i, n, w;
75
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    76
	Client *c;
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    77
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    78
	w = sw - mw;
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    79
	for(n = 0, c = clients; c; c = c->next)
261
d6fd632d861c implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents: 240
diff changeset
    80
		if(isvisible(c) && !c->isfloat)
75
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    81
			n++;
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    82
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    83
	if(n > 1)
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    84
		h = (sh - bh) / (n - 1);
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    85
	else
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    86
		h = sh - bh;
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    87
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    88
	for(i = 0, c = clients; c; c = c->next) {
124
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
    89
		c->ismax = False;
261
d6fd632d861c implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents: 240
diff changeset
    90
		if(isvisible(c)) {
80
8125f908c80c several additions in mouse handling ;)
Anselm R. Garbe <garbeam@wmii.de>
parents: 76
diff changeset
    91
			if(c->isfloat) {
99
a19556fe83b5 applied Sanders resize patch, fixed lower bug
arg@10ksloc.org
parents: 97
diff changeset
    92
				resize(c, True, TopLeft);
75
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    93
				continue;
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    94
			}
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    95
			if(n == 1) {
115
329fd7dae530 removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents: 114
diff changeset
    96
				c->x = sx;
329fd7dae530 removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents: 114
diff changeset
    97
				c->y = sy + bh;
164
21071ae1fe68 made fullscreen apps working fine in floating mode (there is no sane way to make them work in tiled mode, thus I switch to floating mode if I run such kind of app), also fixed the xterm issue reported by Sander
arg@10ksloc.org
parents: 156
diff changeset
    98
				c->w = sw - 2;
21071ae1fe68 made fullscreen apps working fine in floating mode (there is no sane way to make them work in tiled mode, thus I switch to floating mode if I run such kind of app), also fixed the xterm issue reported by Sander
arg@10ksloc.org
parents: 156
diff changeset
    99
				c->h = sh - 2 - bh;
75
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
   100
			}
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
   101
			else if(i == 0) {
115
329fd7dae530 removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents: 114
diff changeset
   102
				c->x = sx;
329fd7dae530 removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents: 114
diff changeset
   103
				c->y = sy + bh;
164
21071ae1fe68 made fullscreen apps working fine in floating mode (there is no sane way to make them work in tiled mode, thus I switch to floating mode if I run such kind of app), also fixed the xterm issue reported by Sander
arg@10ksloc.org
parents: 156
diff changeset
   104
				c->w = mw - 2;
21071ae1fe68 made fullscreen apps working fine in floating mode (there is no sane way to make them work in tiled mode, thus I switch to floating mode if I run such kind of app), also fixed the xterm issue reported by Sander
arg@10ksloc.org
parents: 156
diff changeset
   105
				c->h = sh - 2 - bh;
75
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
   106
			}
104
3a708f113f55 implemented fallback for too many clients in stacked mode
arg@10ksloc.org
parents: 99
diff changeset
   107
			else if(h > bh) {
115
329fd7dae530 removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents: 114
diff changeset
   108
				c->x = sx + mw;
329fd7dae530 removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents: 114
diff changeset
   109
				c->y = sy + (i - 1) * h + bh;
164
21071ae1fe68 made fullscreen apps working fine in floating mode (there is no sane way to make them work in tiled mode, thus I switch to floating mode if I run such kind of app), also fixed the xterm issue reported by Sander
arg@10ksloc.org
parents: 156
diff changeset
   110
				c->w = w - 2;
240
87c5d5176e17 fixed the issue reported by sander (gaps at left columns button due to round-offs)
Anselm R.Garbe <arg@10ksloc.org>
parents: 194
diff changeset
   111
				if(i + 1 == n)
87c5d5176e17 fixed the issue reported by sander (gaps at left columns button due to round-offs)
Anselm R.Garbe <arg@10ksloc.org>
parents: 194
diff changeset
   112
					c->h = sh - c->y - 2;
87c5d5176e17 fixed the issue reported by sander (gaps at left columns button due to round-offs)
Anselm R.Garbe <arg@10ksloc.org>
parents: 194
diff changeset
   113
				else
87c5d5176e17 fixed the issue reported by sander (gaps at left columns button due to round-offs)
Anselm R.Garbe <arg@10ksloc.org>
parents: 194
diff changeset
   114
					c->h = h - 2;
75
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
   115
			}
104
3a708f113f55 implemented fallback for too many clients in stacked mode
arg@10ksloc.org
parents: 99
diff changeset
   116
			else { /* fallback if h < bh */
115
329fd7dae530 removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents: 114
diff changeset
   117
				c->x = sx + mw;
329fd7dae530 removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents: 114
diff changeset
   118
				c->y = sy + bh;
164
21071ae1fe68 made fullscreen apps working fine in floating mode (there is no sane way to make them work in tiled mode, thus I switch to floating mode if I run such kind of app), also fixed the xterm issue reported by Sander
arg@10ksloc.org
parents: 156
diff changeset
   119
				c->w = w - 2;
21071ae1fe68 made fullscreen apps working fine in floating mode (there is no sane way to make them work in tiled mode, thus I switch to floating mode if I run such kind of app), also fixed the xterm issue reported by Sander
arg@10ksloc.org
parents: 156
diff changeset
   120
				c->h = sh - 2 - bh;
104
3a708f113f55 implemented fallback for too many clients in stacked mode
arg@10ksloc.org
parents: 99
diff changeset
   121
			}
99
a19556fe83b5 applied Sanders resize patch, fixed lower bug
arg@10ksloc.org
parents: 97
diff changeset
   122
			resize(c, False, TopLeft);
75
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
   123
			i++;
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
   124
		}
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
   125
		else
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
   126
			ban(c);
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
   127
	}
270
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   128
	if((sel = getnext(clients)))
194
655e38416bb8 fixed view-change bug reported on the list
arg@10ksloc.org
parents: 191
diff changeset
   129
		focus(sel);
655e38416bb8 fixed view-change bug reported on the list
arg@10ksloc.org
parents: 191
diff changeset
   130
	else
655e38416bb8 fixed view-change bug reported on the list
arg@10ksloc.org
parents: 191
diff changeset
   131
		XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
270
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   132
	restack();
75
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
   133
}
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
   134
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   135
Client *
142
9b9deafa0508 committed a patch which fixes the hints of Jukka
arg@10ksloc.org
parents: 138
diff changeset
   136
getnext(Client *c)
93
c498da7520c7 added heretag command which allows to tag a client of a foreign tag with current tag
Anselm R. Garbe <garbeam@wmii.de>
parents: 84
diff changeset
   137
{
261
d6fd632d861c implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents: 240
diff changeset
   138
	for(; c && !isvisible(c); c = c->next);
93
c498da7520c7 added heretag command which allows to tag a client of a foreign tag with current tag
Anselm R. Garbe <garbeam@wmii.de>
parents: 84
diff changeset
   139
	return c;
c498da7520c7 added heretag command which allows to tag a client of a foreign tag with current tag
Anselm R. Garbe <garbeam@wmii.de>
parents: 84
diff changeset
   140
}
c498da7520c7 added heretag command which allows to tag a client of a foreign tag with current tag
Anselm R. Garbe <garbeam@wmii.de>
parents: 84
diff changeset
   141
127
1480e19f6377 using double-linked list in order to get correct prev focus handling
arg@10ksloc.org
parents: 125
diff changeset
   142
Client *
1480e19f6377 using double-linked list in order to get correct prev focus handling
arg@10ksloc.org
parents: 125
diff changeset
   143
getprev(Client *c)
1480e19f6377 using double-linked list in order to get correct prev focus handling
arg@10ksloc.org
parents: 125
diff changeset
   144
{
261
d6fd632d861c implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents: 240
diff changeset
   145
	for(; c && !isvisible(c); c = c->prev);
127
1480e19f6377 using double-linked list in order to get correct prev focus handling
arg@10ksloc.org
parents: 125
diff changeset
   146
	return c;
1480e19f6377 using double-linked list in order to get correct prev focus handling
arg@10ksloc.org
parents: 125
diff changeset
   147
}
1480e19f6377 using double-linked list in order to get correct prev focus handling
arg@10ksloc.org
parents: 125
diff changeset
   148
93
c498da7520c7 added heretag command which allows to tag a client of a foreign tag with current tag
Anselm R. Garbe <garbeam@wmii.de>
parents: 84
diff changeset
   149
void
191
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   150
initrregs()
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   151
{
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   152
	unsigned int i;
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   153
	regex_t *reg;
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   154
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   155
	if(rreg)
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   156
		return;
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   157
	len = sizeof(rule) / sizeof(rule[0]);
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   158
	rreg = emallocz(len * sizeof(RReg));
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   159
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   160
	for(i = 0; i < len; i++) {
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   161
		if(rule[i].clpattern) {
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   162
			reg = emallocz(sizeof(regex_t));
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   163
			if(regcomp(reg, rule[i].clpattern, 0))
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   164
				free(reg);
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   165
			else
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   166
				rreg[i].clregex = reg;
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   167
		}
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   168
		if(rule[i].tpattern) {
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   169
			reg = emallocz(sizeof(regex_t));
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   170
			if(regcomp(reg, rule[i].tpattern, 0))
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   171
				free(reg);
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   172
			else
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   173
				rreg[i].tregex = reg;
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   174
		}
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   175
	}
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   176
}
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   177
261
d6fd632d861c implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents: 240
diff changeset
   178
Bool
d6fd632d861c implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents: 240
diff changeset
   179
isvisible(Client *c)
d6fd632d861c implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents: 240
diff changeset
   180
{
d6fd632d861c implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents: 240
diff changeset
   181
	unsigned int i;
d6fd632d861c implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents: 240
diff changeset
   182
d6fd632d861c implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents: 240
diff changeset
   183
	for(i = 0; i < ntags; i++)
262
d659a2dce2b5 implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents: 261
diff changeset
   184
		if(c->tags[i] && seltag[i])
261
d6fd632d861c implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents: 240
diff changeset
   185
			return True;
d6fd632d861c implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents: 240
diff changeset
   186
	return False;
d6fd632d861c implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents: 240
diff changeset
   187
}
d6fd632d861c implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents: 240
diff changeset
   188
191
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   189
void
75
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
   190
replacetag(Arg *arg)
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
   191
{
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
   192
	int i;
123
61490330e90a cleaned up code
arg@10ksloc.org
parents: 115
diff changeset
   193
75
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
   194
	if(!sel)
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
   195
		return;
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
   196
178
e848966a1ac6 removed TLast tag enum, now tags is simple defined as char *[] array, the rest is calculated correctly, rules take an int array for the tags
arg@10ksloc.org
parents: 177
diff changeset
   197
	for(i = 0; i < ntags; i++)
173
1db04019684e changed Client->tags and Rule->tags to be Bool (I'll also try to remove the TLast enum)
arg@10ksloc.org
parents: 164
diff changeset
   198
		sel->tags[i] = False;
75
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
   199
	appendtag(arg);
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
   200
}
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
   201
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   202
void
270
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   203
restack()
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   204
{
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   205
	static unsigned int nwins = 0;
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   206
	static Window *wins = NULL;
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   207
	unsigned int f, fi, m, mi, n;
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   208
	Client *c;
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   209
	XEvent ev;
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   210
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   211
	for(f = 0, m = 0, c = clients; c; c = c->next)
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   212
		if(isvisible(c)) {
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   213
			if(c->isfloat || arrange == dofloat)
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   214
				f++;
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   215
			else
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   216
				m++;
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   217
		}
272
be40a56df248 fixed a core dump
Anselm R.Garbe <arg@10ksloc.org>
parents: 270
diff changeset
   218
	if(!(n = 2 * (f + m))) {
be40a56df248 fixed a core dump
Anselm R.Garbe <arg@10ksloc.org>
parents: 270
diff changeset
   219
		drawstatus();
be40a56df248 fixed a core dump
Anselm R.Garbe <arg@10ksloc.org>
parents: 270
diff changeset
   220
		return;
be40a56df248 fixed a core dump
Anselm R.Garbe <arg@10ksloc.org>
parents: 270
diff changeset
   221
	}
270
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   222
	if(nwins < n) {
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   223
		nwins = n;
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   224
		wins = erealloc(wins, nwins * sizeof(Window));
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   225
	}
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   226
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   227
	fi = 0;
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   228
	mi = 2 * f;
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   229
	if(sel->isfloat || arrange == dofloat) {
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   230
		wins[fi++] = sel->title;
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   231
		wins[fi++] = sel->win;
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   232
	}
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   233
	else {
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   234
		wins[mi++] = sel->title;
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   235
		wins[mi++] = sel->win;
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   236
	}
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   237
	for(c = clients; c; c = c->next)
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   238
		if(isvisible(c) && c != sel) {
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   239
			if(c->isfloat || arrange == dofloat) {
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   240
				wins[fi++] = c->title;
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   241
				wins[fi++] = c->win;
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   242
			}
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   243
			else {
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   244
				wins[mi++] = c->title;
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   245
				wins[mi++] = c->win;
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   246
			}
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   247
		}
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   248
	XRestackWindows(dpy, wins, n);
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   249
	drawall();
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   250
	XSync(dpy, False);
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   251
	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   252
}
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   253
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 267
diff changeset
   254
void
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   255
settags(Client *c)
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   256
{
114
dfa5cd0969a6 implemented regexp matching for rules
arg@10ksloc.org
parents: 104
diff changeset
   257
	char classinst[256];
191
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   258
	unsigned int i, j;
114
dfa5cd0969a6 implemented regexp matching for rules
arg@10ksloc.org
parents: 104
diff changeset
   259
	regmatch_t tmp;
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   260
	Bool matched = False;
114
dfa5cd0969a6 implemented regexp matching for rules
arg@10ksloc.org
parents: 104
diff changeset
   261
	XClassHint ch;
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   262
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   263
	if(XGetClassHint(dpy, c->win, &ch)) {
114
dfa5cd0969a6 implemented regexp matching for rules
arg@10ksloc.org
parents: 104
diff changeset
   264
		snprintf(classinst, sizeof(classinst), "%s:%s",
dfa5cd0969a6 implemented regexp matching for rules
arg@10ksloc.org
parents: 104
diff changeset
   265
				ch.res_class ? ch.res_class : "",
dfa5cd0969a6 implemented regexp matching for rules
arg@10ksloc.org
parents: 104
diff changeset
   266
				ch.res_name ? ch.res_name : "");
191
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   267
		for(i = 0; !matched && i < len; i++)
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   268
			if(rreg[i].clregex && !regexec(rreg[i].clregex, classinst, 1, &tmp, 0)) {
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   269
				c->isfloat = rule[i].isfloat;
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   270
				for(j = 0; rreg[i].tregex && j < ntags; j++) {
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   271
					if(!regexec(rreg[i].tregex, tags[j], 1, &tmp, 0)) {
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   272
						matched = True;
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   273
						c->tags[j] = True;
56fee1dc9d53 switched to regexp matching for Rules
arg@10ksloc.org
parents: 178
diff changeset
   274
					}
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   275
				}
114
dfa5cd0969a6 implemented regexp matching for rules
arg@10ksloc.org
parents: 104
diff changeset
   276
			}
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   277
		if(ch.res_class)
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   278
			XFree(ch.res_class);
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   279
		if(ch.res_name)
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   280
			XFree(ch.res_name);
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   281
	}
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   282
	if(!matched)
261
d6fd632d861c implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents: 240
diff changeset
   283
		for(i = 0; i < ntags; i++)
262
d659a2dce2b5 implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents: 261
diff changeset
   284
			c->tags[i] = seltag[i];
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   285
}
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   286
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   287
void
124
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
   288
togglemode(Arg *arg)
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
   289
{
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
   290
	arrange = arrange == dofloat ? dotile : dofloat;
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
   291
	arrange(NULL);
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
   292
}
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
   293
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
   294
void
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   295
view(Arg *arg)
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   296
{
261
d6fd632d861c implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents: 240
diff changeset
   297
	unsigned int i;
d6fd632d861c implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents: 240
diff changeset
   298
d6fd632d861c implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents: 240
diff changeset
   299
	for(i = 0; i < ntags; i++)
262
d659a2dce2b5 implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents: 261
diff changeset
   300
		seltag[i] = False;
d659a2dce2b5 implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents: 261
diff changeset
   301
	seltag[arg->i] = True;
d659a2dce2b5 implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents: 261
diff changeset
   302
	arrange(NULL);
d659a2dce2b5 implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents: 261
diff changeset
   303
}
d659a2dce2b5 implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents: 261
diff changeset
   304
d659a2dce2b5 implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents: 261
diff changeset
   305
void
263
118d3e010e5e made shortcuts like proposed by Sander, renamed viewextend to toggleview (more clear)
Anselm R.Garbe <arg@10ksloc.org>
parents: 262
diff changeset
   306
toggleview(Arg *arg)
262
d659a2dce2b5 implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents: 261
diff changeset
   307
{
d659a2dce2b5 implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents: 261
diff changeset
   308
	unsigned int i;
d659a2dce2b5 implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents: 261
diff changeset
   309
d659a2dce2b5 implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents: 261
diff changeset
   310
	seltag[arg->i] = !seltag[arg->i];
d659a2dce2b5 implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents: 261
diff changeset
   311
	for(i = 0; !seltag[i] && i < ntags; i++);
d659a2dce2b5 implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents: 261
diff changeset
   312
	if(i == ntags)
d659a2dce2b5 implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents: 261
diff changeset
   313
		seltag[arg->i] = True; /* cannot toggle last view */
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   314
	arrange(NULL);
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   315
}