client.c
author Anselm R. Garbe <arg@10kloc.org>
Thu, 07 Sep 2006 18:12:40 +0200
changeset 447 16c4e4c5fb15
parent 446 a2e587651c79
child 448 8089f22fdb46
permissions -rw-r--r--
simplified unmanage
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5
e5018cae273f added several other stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
     1
/*
e5018cae273f added several other stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
     2
 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
e5018cae273f added several other stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
     3
 * See LICENSE file for license details.
e5018cae273f added several other 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"
10
703255003abb changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents: 9
diff changeset
     6
#include <stdlib.h>
5
e5018cae273f added several other stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
     7
#include <string.h>
e5018cae273f added several other stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
     8
#include <X11/Xatom.h>
32
082c75b937b5 removed unnecessary crap
Anselm R. Garbe <garbeam@wmii.de>
parents: 31
diff changeset
     9
#include <X11/Xutil.h>
5
e5018cae273f added several other stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    10
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
    11
/* static functions */
50
148f25ed0ad7 several other additions/fixes, dwm is quite usable already
Anselm R. Garbe <garbeam@wmii.de>
parents: 49
diff changeset
    12
26
e8f627998d6f simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
Anselm R. Garbe <garbeam@wmii.de>
parents: 23
diff changeset
    13
static void
446
a2e587651c79 using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents: 442
diff changeset
    14
detachstack(Client *c)
a2e587651c79 using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents: 442
diff changeset
    15
{
a2e587651c79 using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents: 442
diff changeset
    16
	Client **tc;
a2e587651c79 using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents: 442
diff changeset
    17
	for(tc=&stack; *tc && *tc != c; tc=&(*tc)->snext);
a2e587651c79 using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents: 442
diff changeset
    18
	*tc = c->snext;
a2e587651c79 using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents: 442
diff changeset
    19
}
a2e587651c79 using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents: 442
diff changeset
    20
a2e587651c79 using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents: 442
diff changeset
    21
static void
372
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    22
grabbuttons(Client *c, Bool focus)
318
1b45d6f14fca applied Sanders focus_* patches, removed the unnecessary clean-prefix from the new function names
Anselm R.Garbe <arg@10ksloc.org>
parents: 315
diff changeset
    23
{
372
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    24
	XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    25
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    26
	if(focus) {
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    27
		XGrabButton(dpy, Button1, MODKEY, c->win, False, BUTTONMASK,
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    28
				GrabModeAsync, GrabModeSync, None, None);
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    29
		XGrabButton(dpy, Button1, MODKEY | LockMask, c->win, False, BUTTONMASK,
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    30
				GrabModeAsync, GrabModeSync, None, None);
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    31
		XGrabButton(dpy, Button1, MODKEY | numlockmask, c->win, False, BUTTONMASK,
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    32
				GrabModeAsync, GrabModeSync, None, None);
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    33
		XGrabButton(dpy, Button1, MODKEY | numlockmask | LockMask, c->win, False, BUTTONMASK,
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    34
				GrabModeAsync, GrabModeSync, None, None);
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    35
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    36
		XGrabButton(dpy, Button2, MODKEY, c->win, False, BUTTONMASK,
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    37
				GrabModeAsync, GrabModeSync, None, None);
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    38
		XGrabButton(dpy, Button2, MODKEY | LockMask, c->win, False, BUTTONMASK,
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    39
				GrabModeAsync, GrabModeSync, None, None);
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    40
		XGrabButton(dpy, Button2, MODKEY | numlockmask, c->win, False, BUTTONMASK,
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    41
				GrabModeAsync, GrabModeSync, None, None);
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    42
		XGrabButton(dpy, Button2, MODKEY | numlockmask | LockMask, c->win, False, BUTTONMASK,
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    43
				GrabModeAsync, GrabModeSync, None, None);
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    44
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    45
		XGrabButton(dpy, Button3, MODKEY, c->win, False, BUTTONMASK,
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    46
				GrabModeAsync, GrabModeSync, None, None);
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    47
		XGrabButton(dpy, Button3, MODKEY | LockMask, c->win, False, BUTTONMASK,
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    48
				GrabModeAsync, GrabModeSync, None, None);
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    49
		XGrabButton(dpy, Button3, MODKEY | numlockmask, c->win, False, BUTTONMASK,
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    50
				GrabModeAsync, GrabModeSync, None, None);
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    51
		XGrabButton(dpy, Button3, MODKEY | numlockmask | LockMask, c->win, False, BUTTONMASK,
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    52
				GrabModeAsync, GrabModeSync, None, None);
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    53
	}
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    54
	else
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    55
		XGrabButton(dpy, AnyButton, AnyModifier, c->win, False, BUTTONMASK,
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    56
				GrabModeAsync, GrabModeSync, None, None);
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
    57
318
1b45d6f14fca applied Sanders focus_* patches, removed the unnecessary clean-prefix from the new function names
Anselm R.Garbe <arg@10ksloc.org>
parents: 315
diff changeset
    58
}
1b45d6f14fca applied Sanders focus_* patches, removed the unnecessary clean-prefix from the new function names
Anselm R.Garbe <arg@10ksloc.org>
parents: 315
diff changeset
    59
1b45d6f14fca applied Sanders focus_* patches, removed the unnecessary clean-prefix from the new function names
Anselm R.Garbe <arg@10ksloc.org>
parents: 315
diff changeset
    60
static void
75
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents: 74
diff changeset
    61
resizetitle(Client *c)
26
e8f627998d6f simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
Anselm R. Garbe <garbeam@wmii.de>
parents: 23
diff changeset
    62
{
342
a1901753deef updated man page
Anselm R. Garbe <arg@10kloc.org>
parents: 327
diff changeset
    63
	c->tw = textw(c->name);
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
    64
	if(c->tw > c->w)
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
    65
		c->tw = c->w + 2;
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
    66
	c->tx = c->x + c->w - c->tw + 2;
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
    67
	c->ty = c->y;
261
d6fd632d861c implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents: 254
diff changeset
    68
	if(isvisible(c))
342
a1901753deef updated man page
Anselm R. Garbe <arg@10kloc.org>
parents: 327
diff changeset
    69
		XMoveResizeWindow(dpy, c->twin, c->tx, c->ty, c->tw, c->th);
106
c292574503dd fixed the bug mentioned by Sander
arg@10ksloc.org
parents: 105
diff changeset
    70
	else
342
a1901753deef updated man page
Anselm R. Garbe <arg@10kloc.org>
parents: 327
diff changeset
    71
		XMoveResizeWindow(dpy, c->twin, c->tx + 2 * sw, c->ty, c->tw, c->th);
106
c292574503dd fixed the bug mentioned by Sander
arg@10ksloc.org
parents: 105
diff changeset
    72
26
e8f627998d6f simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
Anselm R. Garbe <garbeam@wmii.de>
parents: 23
diff changeset
    73
}
18
1efa34c6e1b6 added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents: 16
diff changeset
    74
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
    75
static int
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
    76
xerrordummy(Display *dsply, XErrorEvent *ee)
5
e5018cae273f added several other stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    77
{
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
    78
	return 0;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
    79
}
5
e5018cae273f added several other stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    80
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
    81
/* extern functions */
5
e5018cae273f added several other stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
    82
10
703255003abb changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents: 9
diff changeset
    83
void
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
    84
ban(Client *c)
20
4560e0882c1d made code more readable
Anselm R. Garbe <garbeam@wmii.de>
parents: 19
diff changeset
    85
{
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
    86
	XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
342
a1901753deef updated man page
Anselm R. Garbe <arg@10kloc.org>
parents: 327
diff changeset
    87
	XMoveWindow(dpy, c->twin, c->tx + 2 * sw, c->ty);
26
e8f627998d6f simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
Anselm R. Garbe <garbeam@wmii.de>
parents: 23
diff changeset
    88
}
e8f627998d6f simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
Anselm R. Garbe <garbeam@wmii.de>
parents: 23
diff changeset
    89
e8f627998d6f simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
Anselm R. Garbe <garbeam@wmii.de>
parents: 23
diff changeset
    90
void
13
5cc5e55a132d added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents: 10
diff changeset
    91
focus(Client *c)
5cc5e55a132d added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents: 10
diff changeset
    92
{
400
052657ff2e7b applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
    93
	Client *old;
286
Anselm R.Garbe <arg@10ksloc.org>
parents: 283
diff changeset
    94
319
94d2d7658673 after switching to OpenBSD again, I switched back to a saner color scheme
arg@localhost.10kloc.org
parents: 318
diff changeset
    95
	if(!issel)
239
e5390f8e06b9 applied sumik's multihead patch
Anselm R.Garbe <arg@10ksloc.org>
parents: 232
diff changeset
    96
		return;
319
94d2d7658673 after switching to OpenBSD again, I switched back to a saner color scheme
arg@localhost.10kloc.org
parents: 318
diff changeset
    97
	if(!sel)
94d2d7658673 after switching to OpenBSD again, I switched back to a saner color scheme
arg@localhost.10kloc.org
parents: 318
diff changeset
    98
		sel = c;
94d2d7658673 after switching to OpenBSD again, I switched back to a saner color scheme
arg@localhost.10kloc.org
parents: 318
diff changeset
    99
	else if(sel != c) {
400
052657ff2e7b applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
   100
		if(maximized)
319
94d2d7658673 after switching to OpenBSD again, I switched back to a saner color scheme
arg@localhost.10kloc.org
parents: 318
diff changeset
   101
			togglemax(NULL);
400
052657ff2e7b applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
   102
		old = sel;
319
94d2d7658673 after switching to OpenBSD again, I switched back to a saner color scheme
arg@localhost.10kloc.org
parents: 318
diff changeset
   103
		sel = c;
400
052657ff2e7b applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
   104
		if(old) {
052657ff2e7b applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
   105
			grabbuttons(old, False);
052657ff2e7b applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
   106
			drawtitle(old);
052657ff2e7b applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
   107
		}
318
1b45d6f14fca applied Sanders focus_* patches, removed the unnecessary clean-prefix from the new function names
Anselm R.Garbe <arg@10ksloc.org>
parents: 315
diff changeset
   108
	}
400
052657ff2e7b applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
   109
	if(c) {
446
a2e587651c79 using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents: 442
diff changeset
   110
		detachstack(c);
a2e587651c79 using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents: 442
diff changeset
   111
		c->snext = stack;
a2e587651c79 using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents: 442
diff changeset
   112
		stack = c;
400
052657ff2e7b applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
   113
		grabbuttons(c, True);
052657ff2e7b applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
   114
		drawtitle(c);
052657ff2e7b applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
   115
		XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
052657ff2e7b applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
   116
	}
052657ff2e7b applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
   117
	else
052657ff2e7b applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
   118
		XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
13
5cc5e55a132d added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents: 10
diff changeset
   119
}
5cc5e55a132d added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents: 10
diff changeset
   120
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   121
Client *
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   122
getclient(Window w)
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   123
{
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   124
	Client *c;
123
61490330e90a cleaned up code
arg@10ksloc.org
parents: 115
diff changeset
   125
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   126
	for(c = clients; c; c = c->next)
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   127
		if(c->win == w)
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   128
			return c;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   129
	return NULL;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   130
}
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   131
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   132
Client *
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   133
getctitle(Window w)
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   134
{
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   135
	Client *c;
123
61490330e90a cleaned up code
arg@10ksloc.org
parents: 115
diff changeset
   136
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   137
	for(c = clients; c; c = c->next)
342
a1901753deef updated man page
Anselm R. Garbe <arg@10kloc.org>
parents: 327
diff changeset
   138
		if(c->twin == w)
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   139
			return c;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   140
	return NULL;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   141
}
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   142
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   143
void
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   144
gravitate(Client *c, Bool invert)
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   145
{
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   146
	int dx = 0, dy = 0;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   147
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   148
	switch(c->grav) {
127
1480e19f6377 using double-linked list in order to get correct prev focus handling
arg@10ksloc.org
parents: 124
diff changeset
   149
	default:
1480e19f6377 using double-linked list in order to get correct prev focus handling
arg@10ksloc.org
parents: 124
diff changeset
   150
		break;
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   151
	case StaticGravity:
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   152
	case NorthWestGravity:
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   153
	case NorthGravity:
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   154
	case NorthEastGravity:
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   155
		dy = c->border;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   156
		break;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   157
	case EastGravity:
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   158
	case CenterGravity:
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   159
	case WestGravity:
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
   160
		dy = -(c->h / 2) + c->border;
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   161
		break;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   162
	case SouthEastGravity:
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   163
	case SouthGravity:
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   164
	case SouthWestGravity:
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
   165
		dy = -(c->h);
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   166
		break;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   167
	}
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   168
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   169
	switch (c->grav) {
127
1480e19f6377 using double-linked list in order to get correct prev focus handling
arg@10ksloc.org
parents: 124
diff changeset
   170
	default:
1480e19f6377 using double-linked list in order to get correct prev focus handling
arg@10ksloc.org
parents: 124
diff changeset
   171
		break;
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   172
	case StaticGravity:
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   173
	case NorthWestGravity:
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   174
	case WestGravity:
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   175
	case SouthWestGravity:
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   176
		dx = c->border;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   177
		break;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   178
	case NorthGravity:
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   179
	case CenterGravity:
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   180
	case SouthGravity:
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
   181
		dx = -(c->w / 2) + c->border;
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   182
		break;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   183
	case NorthEastGravity:
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   184
	case EastGravity:
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   185
	case SouthEastGravity:
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
   186
		dx = -(c->w + c->border);
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   187
		break;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   188
	}
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   189
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   190
	if(invert) {
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   191
		dx = -dx;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   192
		dy = -dy;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   193
	}
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
   194
	c->x += dx;
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
   195
	c->y += dy;
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   196
}
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   197
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   198
void
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   199
killclient(Arg *arg)
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   200
{
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   201
	if(!sel)
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   202
		return;
157
93012e947eae renamed WM_PROTOCOL_DELWIN into PROTODELWIN
arg@10ksloc.org
parents: 151
diff changeset
   203
	if(sel->proto & PROTODELWIN)
77
38c8f7f7d401 sanitized other stuff
Anselm R. Garbe <garbeam@wmii.de>
parents: 76
diff changeset
   204
		sendevent(sel->win, wmatom[WMProtocols], wmatom[WMDelete]);
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   205
	else
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   206
		XKillClient(dpy, sel->win);
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   207
}
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   208
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   209
void
10
703255003abb changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents: 9
diff changeset
   210
manage(Window w, XWindowAttributes *wa)
5
e5018cae273f added several other stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
   211
{
431
a230e4432bb7 moved transient_for tag inheritance to settags
Anselm R. Garbe <arg@10kloc.org>
parents: 430
diff changeset
   212
	Client *c;
123
61490330e90a cleaned up code
arg@10ksloc.org
parents: 115
diff changeset
   213
	Window trans;
5
e5018cae273f added several other stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
   214
	XSetWindowAttributes twa;
e5018cae273f added several other stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
   215
e5018cae273f added several other stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
   216
	c = emallocz(sizeof(Client));
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: 173
diff changeset
   217
	c->tags = emallocz(ntags * sizeof(Bool));
5
e5018cae273f added several other stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
   218
	c->win = w;
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
   219
	c->x = c->tx = wa->x;
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
   220
	c->y = c->ty = wa->y;
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
   221
	c->w = c->tw = wa->width;
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
   222
	c->h = wa->height;
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
   223
	c->th = bh;
100
bb3803fb560c floating clients get random (x,y) offsets now
arg@10ksloc.org
parents: 99
diff changeset
   224
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: 163
diff changeset
   225
	c->border = 0;
163
e2e1de08341d new stuff
arg@10ksloc.org
parents: 161
diff changeset
   226
	setsize(c);
e2e1de08341d new stuff
arg@10ksloc.org
parents: 161
diff changeset
   227
315
d9bef4067cd5 applied Sanders patch
Anselm R.Garbe <arg@10ksloc.org>
parents: 314
diff changeset
   228
	if(c->x + c->w + 2 > sw)
314
8bafc3ac9f58 made a new client position strategy similiar to that one proposed by Sander, but which takes top bar into account
Anselm R.Garbe <arg@10ksloc.org>
parents: 313
diff changeset
   229
		c->x = sw - c->w - 2;
8bafc3ac9f58 made a new client position strategy similiar to that one proposed by Sander, but which takes top bar into account
Anselm R.Garbe <arg@10ksloc.org>
parents: 313
diff changeset
   230
	if(c->x < 0)
8bafc3ac9f58 made a new client position strategy similiar to that one proposed by Sander, but which takes top bar into account
Anselm R.Garbe <arg@10ksloc.org>
parents: 313
diff changeset
   231
		c->x = 0;
315
d9bef4067cd5 applied Sanders patch
Anselm R.Garbe <arg@10ksloc.org>
parents: 314
diff changeset
   232
	if(c->y + c->h + 2 > sh)
314
8bafc3ac9f58 made a new client position strategy similiar to that one proposed by Sander, but which takes top bar into account
Anselm R.Garbe <arg@10ksloc.org>
parents: 313
diff changeset
   233
		c->y = sh - c->h - 2;
163
e2e1de08341d new stuff
arg@10ksloc.org
parents: 161
diff changeset
   234
	if(c->h != sh && c->y < bh)
314
8bafc3ac9f58 made a new client position strategy similiar to that one proposed by Sander, but which takes top bar into account
Anselm R.Garbe <arg@10ksloc.org>
parents: 313
diff changeset
   235
		c->y = bh;
104
3a708f113f55 implemented fallback for too many clients in stacked mode
arg@10ksloc.org
parents: 103
diff changeset
   236
75
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents: 74
diff changeset
   237
	c->proto = getproto(c->win);
26
e8f627998d6f simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
Anselm R. Garbe <garbeam@wmii.de>
parents: 23
diff changeset
   238
	XSelectInput(dpy, c->win,
127
1480e19f6377 using double-linked list in order to get correct prev focus handling
arg@10ksloc.org
parents: 124
diff changeset
   239
		StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
53
529901e6a227 added mini stuff
Anselm R. Garbe <garbeam@wmii.de>
parents: 52
diff changeset
   240
	XGetTransientForHint(dpy, c->win, &trans);
5
e5018cae273f added several other stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
   241
	twa.override_redirect = 1;
e5018cae273f added several other stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
   242
	twa.background_pixmap = ParentRelative;
161
f381e34158d9 implemented focus on enterwindow on titlebars
arg@10ksloc.org
parents: 159
diff changeset
   243
	twa.event_mask = ExposureMask | EnterWindowMask;
5
e5018cae273f added several other stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
   244
342
a1901753deef updated man page
Anselm R. Garbe <arg@10kloc.org>
parents: 327
diff changeset
   245
	c->twin = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th,
20
4560e0882c1d made code more readable
Anselm R. Garbe <garbeam@wmii.de>
parents: 19
diff changeset
   246
			0, DefaultDepth(dpy, screen), CopyFromParent,
5
e5018cae273f added several other stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
   247
			DefaultVisual(dpy, screen),
e5018cae273f added several other stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
   248
			CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa);
31
386649deb651 before leaning things up
Anselm R. Garbe <garbeam@wmii.de>
parents: 30
diff changeset
   249
372
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
   250
	grabbuttons(c, False);
431
a230e4432bb7 moved transient_for tag inheritance to settags
Anselm R. Garbe <arg@10kloc.org>
parents: 430
diff changeset
   251
	settags(c, getclient(trans));
80
8125f908c80c several additions in mouse handling ;)
Anselm R. Garbe <garbeam@wmii.de>
parents: 79
diff changeset
   252
	if(!c->isfloat)
163
e2e1de08341d new stuff
arg@10ksloc.org
parents: 161
diff changeset
   253
		c->isfloat = trans
e2e1de08341d new stuff
arg@10ksloc.org
parents: 161
diff changeset
   254
			|| (c->maxw && c->minw &&
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: 163
diff changeset
   255
				c->maxw == c->minw && c->maxh == c->minh);
378
83576f5f0a90 added attach/detach functions which don't attach at the begin of list, but at the slot of a first match of the tags of a client
Anselm R. Garbe <arg@10kloc.org>
parents: 377
diff changeset
   256
381
b00cc483d13b still something wrong with reorder()
Anselm R. Garbe <arg@10kloc.org>
parents: 378
diff changeset
   257
	if(clients)
b00cc483d13b still something wrong with reorder()
Anselm R. Garbe <arg@10kloc.org>
parents: 378
diff changeset
   258
		clients->prev = c;
b00cc483d13b still something wrong with reorder()
Anselm R. Garbe <arg@10kloc.org>
parents: 378
diff changeset
   259
	c->next = clients;
446
a2e587651c79 using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents: 442
diff changeset
   260
	c->snext = stack;
a2e587651c79 using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents: 442
diff changeset
   261
	stack = clients = c;
378
83576f5f0a90 added attach/detach functions which don't attach at the begin of list, but at the slot of a first match of the tags of a client
Anselm R. Garbe <arg@10kloc.org>
parents: 377
diff changeset
   262
95
5d88952cbf96 implemened distinguishing float/managed geometries of clients (works quite well)
Anselm R. Garbe <garbeam@wmii.de>
parents: 94
diff changeset
   263
	settitle(c);
408
a031bbee1816 simplified manage
Anselm R. Garbe <arg@10kloc.org>
parents: 405
diff changeset
   264
	ban(c);
270
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 261
diff changeset
   265
	XMapWindow(dpy, c->win);
342
a1901753deef updated man page
Anselm R. Garbe <arg@10kloc.org>
parents: 327
diff changeset
   266
	XMapWindow(dpy, c->twin);
261
d6fd632d861c implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents: 254
diff changeset
   267
	if(isvisible(c))
51
035617ee18d1 new stuff
Anselm R. Garbe <garbeam@wmii.de>
parents: 50
diff changeset
   268
		focus(c);
408
a031bbee1816 simplified manage
Anselm R. Garbe <arg@10kloc.org>
parents: 405
diff changeset
   269
	arrange(NULL);
94
6efe82c775c9 pop on heretag
Anselm R. Garbe <garbeam@wmii.de>
parents: 93
diff changeset
   270
}
6efe82c775c9 pop on heretag
Anselm R. Garbe <garbeam@wmii.de>
parents: 93
diff changeset
   271
6efe82c775c9 pop on heretag
Anselm R. Garbe <garbeam@wmii.de>
parents: 93
diff changeset
   272
void
129
c478383db7c9 applied sanders no_sizehints for tiled mode patch (thx!)
arg@10ksloc.org
parents: 128
diff changeset
   273
resize(Client *c, Bool sizehints, Corner sticky)
18
1efa34c6e1b6 added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents: 16
diff changeset
   274
{
123
61490330e90a cleaned up code
arg@10ksloc.org
parents: 115
diff changeset
   275
	int bottom = c->y + c->h;
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
   276
	int right = c->x + c->w;
163
e2e1de08341d new stuff
arg@10ksloc.org
parents: 161
diff changeset
   277
	XWindowChanges wc;
18
1efa34c6e1b6 added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents: 16
diff changeset
   278
129
c478383db7c9 applied sanders no_sizehints for tiled mode patch (thx!)
arg@10ksloc.org
parents: 128
diff changeset
   279
	if(sizehints) {
52
d18f6dd0cf23 fixed several things, nearly feature complete
Anselm R. Garbe <garbeam@wmii.de>
parents: 51
diff changeset
   280
		if(c->incw)
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
   281
			c->w -= (c->w - c->basew) % c->incw;
52
d18f6dd0cf23 fixed several things, nearly feature complete
Anselm R. Garbe <garbeam@wmii.de>
parents: 51
diff changeset
   282
		if(c->inch)
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
   283
			c->h -= (c->h - c->baseh) % c->inch;
129
c478383db7c9 applied sanders no_sizehints for tiled mode patch (thx!)
arg@10ksloc.org
parents: 128
diff changeset
   284
		if(c->minw && c->w < c->minw)
c478383db7c9 applied sanders no_sizehints for tiled mode patch (thx!)
arg@10ksloc.org
parents: 128
diff changeset
   285
			c->w = c->minw;
c478383db7c9 applied sanders no_sizehints for tiled mode patch (thx!)
arg@10ksloc.org
parents: 128
diff changeset
   286
		if(c->minh && c->h < c->minh)
c478383db7c9 applied sanders no_sizehints for tiled mode patch (thx!)
arg@10ksloc.org
parents: 128
diff changeset
   287
			c->h = c->minh;
c478383db7c9 applied sanders no_sizehints for tiled mode patch (thx!)
arg@10ksloc.org
parents: 128
diff changeset
   288
		if(c->maxw && c->w > c->maxw)
c478383db7c9 applied sanders no_sizehints for tiled mode patch (thx!)
arg@10ksloc.org
parents: 128
diff changeset
   289
			c->w = c->maxw;
c478383db7c9 applied sanders no_sizehints for tiled mode patch (thx!)
arg@10ksloc.org
parents: 128
diff changeset
   290
		if(c->maxh && c->h > c->maxh)
c478383db7c9 applied sanders no_sizehints for tiled mode patch (thx!)
arg@10ksloc.org
parents: 128
diff changeset
   291
			c->h = c->maxh;
52
d18f6dd0cf23 fixed several things, nearly feature complete
Anselm R. Garbe <garbeam@wmii.de>
parents: 51
diff changeset
   292
	}
105
3e74cc981e9b refactored Sanders code somewhat
arg@10ksloc.org
parents: 104
diff changeset
   293
	if(sticky == TopRight || sticky == BotRight)
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
   294
		c->x = right - c->w;
105
3e74cc981e9b refactored Sanders code somewhat
arg@10ksloc.org
parents: 104
diff changeset
   295
	if(sticky == BotLeft || sticky == BotRight)
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
   296
		c->y = bottom - c->h;
106
c292574503dd fixed the bug mentioned by Sander
arg@10ksloc.org
parents: 105
diff changeset
   297
75
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents: 74
diff changeset
   298
	resizetitle(c);
163
e2e1de08341d new stuff
arg@10ksloc.org
parents: 161
diff changeset
   299
	wc.x = c->x;
e2e1de08341d new stuff
arg@10ksloc.org
parents: 161
diff changeset
   300
	wc.y = c->y;
e2e1de08341d new stuff
arg@10ksloc.org
parents: 161
diff changeset
   301
	wc.width = c->w;
e2e1de08341d new stuff
arg@10ksloc.org
parents: 161
diff changeset
   302
	wc.height = c->h;
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: 163
diff changeset
   303
	if(c->w == sw && c->h == sh)
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: 163
diff changeset
   304
		wc.border_width = 0;
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: 163
diff changeset
   305
	else
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: 163
diff changeset
   306
		wc.border_width = 1;
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: 163
diff changeset
   307
	XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
79
aabebd6e61f3 fixed XSync handling and finished man page
Anselm R. Garbe <garbeam@wmii.de>
parents: 77
diff changeset
   308
	XSync(dpy, False);
18
1efa34c6e1b6 added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents: 16
diff changeset
   309
}
1efa34c6e1b6 added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents: 16
diff changeset
   310
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   311
void
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   312
setsize(Client *c)
10
703255003abb changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents: 9
diff changeset
   313
{
123
61490330e90a cleaned up code
arg@10ksloc.org
parents: 115
diff changeset
   314
	long msize;
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   315
	XSizeHints size;
123
61490330e90a cleaned up code
arg@10ksloc.org
parents: 115
diff changeset
   316
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   317
	if(!XGetWMNormalHints(dpy, c->win, &size, &msize) || !size.flags)
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   318
		size.flags = PSize;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   319
	c->flags = size.flags;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   320
	if(c->flags & PBaseSize) {
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   321
		c->basew = size.base_width;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   322
		c->baseh = size.base_height;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   323
	}
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   324
	else
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   325
		c->basew = c->baseh = 0;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   326
	if(c->flags & PResizeInc) {
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   327
		c->incw = size.width_inc;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   328
		c->inch = size.height_inc;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   329
	}
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   330
	else
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   331
		c->incw = c->inch = 0;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   332
	if(c->flags & PMaxSize) {
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   333
		c->maxw = size.max_width;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   334
		c->maxh = size.max_height;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   335
	}
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   336
	else
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   337
		c->maxw = c->maxh = 0;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   338
	if(c->flags & PMinSize) {
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   339
		c->minw = size.min_width;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   340
		c->minh = size.min_height;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   341
	}
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   342
	else
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   343
		c->minw = c->minh = 0;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   344
	if(c->flags & PWinGravity)
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   345
		c->grav = size.win_gravity;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   346
	else
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   347
		c->grav = NorthWestGravity;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   348
}
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   349
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   350
void
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   351
settitle(Client *c)
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   352
{
123
61490330e90a cleaned up code
arg@10ksloc.org
parents: 115
diff changeset
   353
	char **list = NULL;
377
b1159a638d0a removed crappy variables
Anselm R. Garbe <arg@10kloc.org>
parents: 372
diff changeset
   354
	int n;
123
61490330e90a cleaned up code
arg@10ksloc.org
parents: 115
diff changeset
   355
	XTextProperty name;
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   356
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   357
	name.nitems = 0;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   358
	c->name[0] = 0;
77
38c8f7f7d401 sanitized other stuff
Anselm R. Garbe <garbeam@wmii.de>
parents: 76
diff changeset
   359
	XGetTextProperty(dpy, c->win, &name, netatom[NetWMName]);
76
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   360
	if(!name.nitems)
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   361
		XGetWMName(dpy, c->win, &name);
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   362
	if(!name.nitems)
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   363
		return;
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   364
	if(name.encoding == XA_STRING)
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   365
		strncpy(c->name, (char *)name.value, sizeof(c->name));
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   366
	else {
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   367
		if(XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   368
				&& n > 0 && *list)
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   369
		{
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   370
			strncpy(c->name, *list, sizeof(c->name));
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   371
			XFreeStringList(list);
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   372
		}
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   373
	}
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   374
	XFree(name.value);
4bd49f404f10 proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents: 75
diff changeset
   375
	resizetitle(c);
10
703255003abb changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents: 9
diff changeset
   376
}
703255003abb changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents: 9
diff changeset
   377
703255003abb changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents: 9
diff changeset
   378
void
124
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
   379
togglemax(Arg *arg)
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
   380
{
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
   381
	int ox, oy, ow, oh;
400
052657ff2e7b applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
   382
	Client *c;
124
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
   383
	XEvent ev;
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
   384
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
   385
	if(!sel)
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
   386
		return;
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
   387
400
052657ff2e7b applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
   388
	if((maximized = !maximized)) {
124
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
   389
		ox = sel->x;
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
   390
		oy = sel->y;
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
   391
		ow = sel->w;
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
   392
		oh = sel->h;
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
   393
		sel->x = sx;
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
   394
		sel->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: 163
diff changeset
   395
		sel->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: 163
diff changeset
   396
		sel->h = sh - 2 - bh;
124
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
   397
270
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 261
diff changeset
   398
		restack();
400
052657ff2e7b applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
   399
		for(c = getnext(clients); c; c = getnext(c->next))
052657ff2e7b applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
   400
			if(c != sel)
052657ff2e7b applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
   401
				ban(c);
247
c45ba25c3d26 respecting inc hints in floating mode on togglemax
Anselm R.Garbe <arg@10ksloc.org>
parents: 246
diff changeset
   402
		resize(sel, arrange == dofloat, TopLeft);
124
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
   403
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
   404
		sel->x = ox;
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
   405
		sel->y = oy;
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
   406
		sel->w = ow;
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
   407
		sel->h = oh;
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
   408
	}
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
   409
	else
400
052657ff2e7b applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
   410
		arrange(NULL);
124
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
   411
	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
   412
}
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
   413
75576e44c1d8 made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents: 123
diff changeset
   414
void
10
703255003abb changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents: 9
diff changeset
   415
unmanage(Client *c)
703255003abb changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents: 9
diff changeset
   416
{
703255003abb changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents: 9
diff changeset
   417
	XGrabServer(dpy);
75
f08271b7cb20 rearranged several stuff
Anselm R. Garbe <garbeam@wmii.de>
parents: 74
diff changeset
   418
	XSetErrorHandler(xerrordummy);
10
703255003abb changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents: 9
diff changeset
   419
400
052657ff2e7b applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
   420
	detach(c);
052657ff2e7b applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
   421
	if(sel == c) {
447
16c4e4c5fb15 simplified unmanage
Anselm R. Garbe <arg@10kloc.org>
parents: 446
diff changeset
   422
		for(sel = stack; sel && !isvisible(sel); sel = sel->snext);
16c4e4c5fb15 simplified unmanage
Anselm R. Garbe <arg@10kloc.org>
parents: 446
diff changeset
   423
		focus(sel);
400
052657ff2e7b applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
   424
	}
372
a9b4077ec058 applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents: 342
diff changeset
   425
18
1efa34c6e1b6 added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents: 16
diff changeset
   426
	XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
342
a1901753deef updated man page
Anselm R. Garbe <arg@10kloc.org>
parents: 327
diff changeset
   427
	XDestroyWindow(dpy, c->twin);
10
703255003abb changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents: 9
diff changeset
   428
446
a2e587651c79 using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents: 442
diff changeset
   429
	detachstack(c);
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: 173
diff changeset
   430
	free(c->tags);
10
703255003abb changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents: 9
diff changeset
   431
	free(c);
703255003abb changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents: 9
diff changeset
   432
79
aabebd6e61f3 fixed XSync handling and finished man page
Anselm R. Garbe <garbeam@wmii.de>
parents: 77
diff changeset
   433
	XSync(dpy, False);
74
5370ef170cc9 sanitized names
Anselm R. Garbe <garbeam@wmii.de>
parents: 73
diff changeset
   434
	XSetErrorHandler(xerror);
10
703255003abb changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents: 9
diff changeset
   435
	XUngrabServer(dpy);
270
dacd3f3c5823 implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents: 261
diff changeset
   436
	arrange(NULL);
10
703255003abb changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents: 9
diff changeset
   437
}