source: ldm/trunk/fuentes/wwm/mapfunctions.c @ 516

Last change on this file since 516 was 516, checked in by mabarracus, 5 years ago

Copy trusty code

File size: 3.8 KB
Line 
1#include <X11/Xlib.h>
2#include <X11/Xutil.h>
3#include <signal.h>
4#include <stdio.h>
5#include "wwm.h"
6
7/*
8 *  Start of the keyboard set functions.
9 */
10
11
12/*
13 * move_win_up: move a window up WMDELTA pixels
14 */
15
16void
17move_win_up(Client *c)
18{
19    if (!c)
20        return;
21    c->y -= WMDELTA;
22    move(c, 1);
23}
24
25/*
26 * move_win_down: move a window down WMDELTA pixels
27 */
28
29void
30move_win_down(Client *c)
31{
32    if (!c)
33        return;
34    c->y += WMDELTA;
35    move(c, 1);
36}
37
38/*
39 * move_win_left: move a window left WMDELTA pixels
40 */
41
42void
43move_win_left(Client *c)
44{
45    if (!c)
46        return;
47    c->x -= WMDELTA;
48    move(c, 1);
49}
50
51/*
52 * move_win_right: move a window right WMDELTA pixels
53 */
54
55void
56move_win_right(Client *c)
57{
58    if (!c)
59        return;
60    c->x += WMDELTA;
61    move(c, 1);
62}
63
64/*
65 * expand_win_y: make window larger horzontaly
66 */
67
68void
69expand_win_y(Client *c)
70{
71    if (!c)
72        return;
73    c->height += WMDELTA;
74    resize(c, 1);
75}
76
77/*
78 * contract_win_y: make window smaller horzontaly
79 */
80
81void
82contract_win_y(Client *c)
83{
84    if (!c || c->height <= WMDELTA)
85        return;
86    c->height -= WMDELTA;
87    resize(c, 1);
88}
89
90void
91expand_win_x(Client *c)
92{
93    if (!c)
94        return;
95    c->width += WMDELTA;
96    resize(c, 1);
97}
98
99void
100contract_win_x(Client *c)
101{
102    if (!c || c->width <= WMDELTA)
103        return;
104    c->width -= WMDELTA;
105    resize(c, 1);
106}
107
108void
109kill_client(Client *c)
110{
111    if (!c)
112        return;
113    send_wm_delete(c);
114}
115
116void
117raise_client(Client *c)
118{
119    if (!c)
120        return;
121    XRaiseWindow(display, c->parent);
122}
123
124void
125lower_client(Client *c)
126{
127    if (!c)
128        return;
129    XLowerWindow(display, c->parent);
130}
131
132void
133horizontal_toggle(Client *c)
134{
135    if (!c)
136        return;
137    maximise_horiz(c);
138    resize(c, 1);
139}
140
141void
142vertical_toggle(Client *c)
143{
144    if (!c)
145        return;
146    maximise_vert(c);
147    resize(c, 1);
148}
149
150void
151maximize_toggle(Client *c)
152{
153    if (!c)
154        return;
155    maximise_horiz(c);
156    maximise_vert(c);
157    resize(c, 1);
158}
159
160void
161lock_window(Client *c)
162{
163    if (!c)
164        return;
165    XSetWindowBackground(display, c->parent,
166             c->vdesk == LOCKED ? fg.pixel : fc.pixel);
167    XClearWindow(display, c->parent);
168    c->vdesk = c->vdesk == LOCKED ? vdesk_get() : LOCKED;
169}
170
171void
172new_term(Client *c)
173{
174    spawn(term);
175}
176
177void
178next_client(Client *c)
179{
180    next(current);
181}
182
183void
184quit_wm(Client *c)
185{
186    handle_signal(SIGHUP);
187}
188
189void
190start_passthrough(Client *c)
191{
192    passthrough++;
193}
194
195void
196goto_vdesk_0(Client *c)
197{
198    switch_vdesk(0);
199}
200
201void
202goto_vdesk_1(Client *c)
203{
204    switch_vdesk(1);
205}
206
207void
208goto_vdesk_2(Client *c)
209{
210    switch_vdesk(2);
211}
212
213void
214goto_vdesk_3(Client *c)
215{
216    switch_vdesk(3);
217}
218
219void
220goto_vdesk_4(Client *c)
221{
222    switch_vdesk(4);
223}
224
225void
226goto_vdesk_5(Client *c)
227{
228    switch_vdesk(5);
229}
230
231void
232goto_vdesk_6(Client *c)
233{
234    switch_vdesk(6);
235}
236
237void
238goto_vdesk_7(Client *c)
239{
240    switch_vdesk(7);
241}
242
243void
244prev_vdesk(Client *c)
245{
246    int v = vdesk(VDESK_PREV, VDESK_NULL);
247    switch_vdesk(v);
248    vdesk(VDESK_SET, v);
249}
250
251void
252next_vdesk(Client *c)
253{
254    int v = vdesk(VDESK_NEXT, VDESK_NULL);
255    switch_vdesk(v);
256    vdesk(VDESK_SET, v);
257}
258
259void
260top_left(Client *c)
261{
262    if (!c)
263        return;
264
265    c->x = c->border;
266    c->y = c->border;
267    move(c, 1);
268}
269
270void
271top_right(Client *c)
272{
273    if (!c)
274        return;
275
276    c->x = xmax() - (c->width + c->border);
277    c->y = c->border;
278    move(c, 1);
279}
280
281void
282bottom_left(Client *c)
283{
284    if (!c)
285        return;
286
287    c->x = c->border;
288    c->y = ymax() - (c->height + c->border);
289    move(c, 1);
290}
291
292void
293bottom_right(Client *c)
294{
295    if (!c)
296        return;
297
298    c->x = xmax() - (c->width + c->border);
299    c->y = ymax() - (c->height + c->border);
300    move(c, 1);
301}
302
303void
304toggle_focus(Client *c)
305{
306    nomousefocus = (nomousefocus + 1) % 2;
307}
308
309void
310dummy_func(Client *c)
311{
312    return;
313}
Note: See TracBrowser for help on using the repository browser.