moved floating to layout.c, kept tile.c outside

master
Anselm R. Garbe 2007-08-12 13:10:21 +02:00
parent f6e41b0bc3
commit 0937cc78bf
7 changed files with 41 additions and 50 deletions

View File

@ -25,7 +25,6 @@ static Rule rule[] = { \
/* layout(s) */ /* layout(s) */
#include "tile.h" #include "tile.h"
#include "float.h"
#define LAYOUTS \ #define LAYOUTS \
static Layout layout[] = { \ static Layout layout[] = { \
/* symbol function */ \ /* symbol function */ \

View File

@ -26,7 +26,6 @@ static Rule rule[] = { \
/* layout(s) */ /* layout(s) */
#include "tile.h" #include "tile.h"
#include "float.h"
#define LAYOUTS \ #define LAYOUTS \
static Layout layout[] = { \ static Layout layout[] = { \
/* symbol function */ \ /* symbol function */ \

View File

@ -3,8 +3,8 @@ VERSION = 4.4
# Customize below to fit your system # Customize below to fit your system
# layouts # additional layouts beside floating
SRC = float.c tile.c SRC = tile.c
# paths # paths
PREFIX = /usr/local PREFIX = /usr/local

2
dwm.h
View File

@ -120,12 +120,14 @@ unsigned int textw(const char *text); /* return the width of text in px*/
void grabkeys(void); /* grab all keys defined in config.h */ void grabkeys(void); /* grab all keys defined in config.h */
/* layout.c */ /* layout.c */
void floating(void); /* arranges all windows floating, fallback layout */
void focusclient(const char *arg); /* focuses next(1)/previous(-1) visible client */ void focusclient(const char *arg); /* focuses next(1)/previous(-1) visible client */
void initlayouts(void); /* initialize layout array */ void initlayouts(void); /* initialize layout array */
Client *nexttiled(Client *c); /* returns tiled successor of c */ Client *nexttiled(Client *c); /* returns tiled successor of c */
void restack(void); /* restores z layers of all clients */ void restack(void); /* restores z layers of all clients */
void setlayout(const char *arg); /* sets layout, NULL means next layout */ void setlayout(const char *arg); /* sets layout, NULL means next layout */
void togglebar(const char *arg); /* shows/hides the bar */ void togglebar(const char *arg); /* shows/hides the bar */
void togglemax(const char *arg); /* toggles maximization of floating client */
/* main.c */ /* main.c */
void updatebarpos(void); /* updates the bar position */ void updatebarpos(void); /* updates the bar position */

41
float.c
View File

@ -1,41 +0,0 @@
/* See LICENSE file for copyright and license details. */
#include "dwm.h"
/* extern */
void
floating(void) {
Client *c;
if(lt->arrange != floating)
return;
for(c = clients; c; c = c->next)
if(isvisible(c)) {
unban(c);
resize(c, c->x, c->y, c->w, c->h, True);
}
else
ban(c);
focus(NULL);
restack();
}
void
togglemax(const char *arg) {
XEvent ev;
if(!sel || (lt->arrange != floating && !sel->isfloating) || sel->isfixed)
return;
if((sel->ismax = !sel->ismax)) {
sel->rx = sel->x;
sel->ry = sel->y;
sel->rw = sel->w;
sel->rh = sel->h;
resize(sel, wax, way, waw - 2 * sel->border, wah - 2 * sel->border, True);
}
else
resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, True);
drawstatus();
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
}

View File

@ -1,5 +0,0 @@
/* See LICENSE file for copyright and license details. */
/* float.c */
void floating(void); /* arranges all windows floating */
void togglemax(const char *arg); /* toggles maximization of floating client */

View File

@ -13,6 +13,24 @@ LAYOUTS
/* extern */ /* extern */
void
floating(void) {
Client *c;
if(lt->arrange != floating)
return;
for(c = clients; c; c = c->next)
if(isvisible(c)) {
unban(c);
resize(c, c->x, c->y, c->w, c->h, True);
}
else
ban(c);
focus(NULL);
restack();
}
void void
focusclient(const char *arg) { focusclient(const char *arg) {
Client *c; Client *c;
@ -115,3 +133,22 @@ togglebar(const char *arg) {
updatebarpos(); updatebarpos();
lt->arrange(); lt->arrange();
} }
void
togglemax(const char *arg) {
XEvent ev;
if(!sel || (lt->arrange != floating && !sel->isfloating) || sel->isfixed)
return;
if((sel->ismax = !sel->ismax)) {
sel->rx = sel->x;
sel->ry = sel->y;
sel->rw = sel->w;
sel->rh = sel->h;
resize(sel, wax, way, waw - 2 * sel->border, wah - 2 * sel->border, True);
}
else
resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, True);
drawstatus();
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
}