Remove unnecessary code (layouts)
This commit is contained in:
parent
d2b40dc8e3
commit
367bbc735f
4 changed files with 7 additions and 188 deletions
1
Makefile
1
Makefile
|
@ -30,7 +30,6 @@ MODULES_SRC = \
|
|||
src/drw.c \
|
||||
src/dwm.c \
|
||||
src/geom.c \
|
||||
src/layouts.c \
|
||||
src/logger.c \
|
||||
src/spawn.c \
|
||||
src/state.c \
|
||||
|
|
16
src/dwm.c
16
src/dwm.c
|
@ -1,7 +1,6 @@
|
|||
#include "dwm.h"
|
||||
|
||||
#include "helpers.h"
|
||||
#include "layouts.h"
|
||||
#include "logger.h"
|
||||
#include "main.h"
|
||||
#include "settings.h"
|
||||
|
@ -122,7 +121,6 @@ typedef struct {
|
|||
} Key;
|
||||
|
||||
typedef struct {
|
||||
LayoutsSymbolFunc symbol_func;
|
||||
void (*arrange)(Monitor *);
|
||||
} Layout;
|
||||
|
||||
|
@ -250,12 +248,12 @@ static const char *colors[][3] = {
|
|||
};
|
||||
|
||||
const Layout layouts[] = {
|
||||
/* symbol function, arrange function */
|
||||
{ layouts_symbol_monocle, monocle }, /* first entry is default */
|
||||
{ layouts_symbol_floating, NULL }, /* no layout function means floating behavior */
|
||||
{ layouts_symbol_tile, tile },
|
||||
{ layouts_symbol_horizontile, horizontile },
|
||||
{ layouts_symbol_centeredmaster, centeredmaster },
|
||||
/* arrange function */
|
||||
{ monocle }, /* first entry is default */
|
||||
{ NULL }, /* no layout function means floating behavior */
|
||||
{ tile },
|
||||
{ horizontile },
|
||||
{ centeredmaster },
|
||||
};
|
||||
|
||||
/************************************
|
||||
|
@ -344,7 +342,7 @@ int dwm_main(const char *const new_program_title)
|
|||
|
||||
// Cleanup start
|
||||
|
||||
Layout foo = { NULL, NULL };
|
||||
Layout foo = { NULL };
|
||||
selmon->lt[selmon->sellt] = &foo;
|
||||
|
||||
for (Monitor *m = mons; m; m = m->next) {
|
||||
|
|
115
src/layouts.c
115
src/layouts.c
|
@ -1,115 +0,0 @@
|
|||
#include "layouts.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define TMP_BUFFER_SIZE 128
|
||||
|
||||
void layouts_symbol_func(
|
||||
LayoutsSymbolFunc func,
|
||||
char *const buffer,
|
||||
const size_t buffer_size,
|
||||
const unsigned int clients_in_master,
|
||||
const unsigned int visible_clients
|
||||
) {
|
||||
if (func == NULL) {
|
||||
func = layouts_symbol_unknown;
|
||||
}
|
||||
|
||||
func(
|
||||
buffer,
|
||||
buffer_size,
|
||||
clients_in_master,
|
||||
visible_clients
|
||||
);
|
||||
}
|
||||
|
||||
void layouts_symbol_unknown(
|
||||
char *const buffer,
|
||||
const size_t buffer_size,
|
||||
const unsigned int clients_in_master,
|
||||
const unsigned int visible_clients
|
||||
) {
|
||||
// TODO: maybe we should assert
|
||||
if (buffer == NULL) return;
|
||||
|
||||
char tmp[TMP_BUFFER_SIZE];
|
||||
sprintf(tmp, "?%u/%u?", clients_in_master, visible_clients);
|
||||
tmp[(buffer_size > TMP_BUFFER_SIZE ? TMP_BUFFER_SIZE : buffer_size) - 1] = '\0';
|
||||
strncpy(buffer, tmp, buffer_size);
|
||||
}
|
||||
|
||||
void layouts_symbol_monocle(
|
||||
char *const buffer,
|
||||
const size_t buffer_size,
|
||||
const unsigned int clients_in_master,
|
||||
const unsigned int visible_clients
|
||||
) {
|
||||
// TODO: maybe we should assert
|
||||
if (buffer == NULL) return;
|
||||
|
||||
char tmp[TMP_BUFFER_SIZE];
|
||||
sprintf(tmp, "[%u/%u]", clients_in_master, visible_clients);
|
||||
tmp[(buffer_size > TMP_BUFFER_SIZE ? TMP_BUFFER_SIZE : buffer_size) - 1] = '\0';
|
||||
strncpy(buffer, tmp, buffer_size);
|
||||
}
|
||||
|
||||
void layouts_symbol_floating(
|
||||
char *const buffer,
|
||||
const size_t buffer_size,
|
||||
const unsigned int clients_in_master,
|
||||
const unsigned int visible_clients
|
||||
) {
|
||||
// TODO: maybe we should assert
|
||||
if (buffer == NULL) return;
|
||||
|
||||
char tmp[TMP_BUFFER_SIZE];
|
||||
sprintf(tmp, "<%u/%u>", clients_in_master, visible_clients);
|
||||
tmp[(buffer_size > TMP_BUFFER_SIZE ? TMP_BUFFER_SIZE : buffer_size) - 1] = '\0';
|
||||
strncpy(buffer, tmp, buffer_size);
|
||||
}
|
||||
|
||||
void layouts_symbol_tile(
|
||||
char *const buffer,
|
||||
const size_t buffer_size,
|
||||
const unsigned int clients_in_master,
|
||||
const unsigned int visible_clients
|
||||
) {
|
||||
// TODO: maybe we should assert
|
||||
if (buffer == NULL) return;
|
||||
|
||||
char tmp[TMP_BUFFER_SIZE];
|
||||
sprintf(tmp, "{%u/%u}=", clients_in_master, visible_clients);
|
||||
tmp[(buffer_size > TMP_BUFFER_SIZE ? TMP_BUFFER_SIZE : buffer_size) - 1] = '\0';
|
||||
strncpy(buffer, tmp, buffer_size);
|
||||
}
|
||||
|
||||
void layouts_symbol_horizontile(
|
||||
char *const buffer,
|
||||
const size_t buffer_size,
|
||||
const unsigned int clients_in_master,
|
||||
const unsigned int visible_clients
|
||||
) {
|
||||
// TODO: maybe we should assert
|
||||
if (buffer == NULL) return;
|
||||
|
||||
char tmp[TMP_BUFFER_SIZE];
|
||||
sprintf(tmp, "v{%u/%u}v", clients_in_master, visible_clients);
|
||||
tmp[(buffer_size > TMP_BUFFER_SIZE ? TMP_BUFFER_SIZE : buffer_size) - 1] = '\0';
|
||||
strncpy(buffer, tmp, buffer_size);
|
||||
}
|
||||
|
||||
void layouts_symbol_centeredmaster(
|
||||
char *const buffer,
|
||||
const size_t buffer_size,
|
||||
const unsigned int clients_in_master,
|
||||
const unsigned int visible_clients
|
||||
) {
|
||||
// TODO: maybe we should assert
|
||||
if (buffer == NULL) return;
|
||||
|
||||
char tmp[TMP_BUFFER_SIZE];
|
||||
sprintf(tmp, "={%u/%u}=", clients_in_master, visible_clients);
|
||||
tmp[(buffer_size > TMP_BUFFER_SIZE ? TMP_BUFFER_SIZE : buffer_size) - 1] = '\0';
|
||||
strncpy(buffer, tmp, buffer_size);
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
#ifndef _LAYOUTS_H
|
||||
#define _LAYOUTS_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
typedef void (*LayoutsSymbolFunc)(
|
||||
char *buffer,
|
||||
size_t buffer_size,
|
||||
unsigned int clients_in_master,
|
||||
unsigned int visible_clients
|
||||
);
|
||||
|
||||
void layouts_symbol_func(
|
||||
LayoutsSymbolFunc func,
|
||||
char *buffer,
|
||||
size_t buffer_size,
|
||||
unsigned int clients_in_master,
|
||||
unsigned int visible_clients
|
||||
);
|
||||
|
||||
void layouts_symbol_unknown(
|
||||
char *buffer,
|
||||
size_t buffer_size,
|
||||
unsigned int clients_in_master,
|
||||
unsigned int visible_clients
|
||||
);
|
||||
|
||||
void layouts_symbol_monocle(
|
||||
char *buffer,
|
||||
size_t buffer_size,
|
||||
unsigned int clients_in_master,
|
||||
unsigned int visible_clients
|
||||
);
|
||||
|
||||
void layouts_symbol_floating(
|
||||
char *buffer,
|
||||
size_t buffer_size,
|
||||
unsigned int clients_in_master,
|
||||
unsigned int visible_clients
|
||||
);
|
||||
|
||||
void layouts_symbol_tile(
|
||||
char *buffer,
|
||||
size_t buffer_size,
|
||||
unsigned int clients_in_master,
|
||||
unsigned int visible_clients
|
||||
);
|
||||
|
||||
void layouts_symbol_horizontile(
|
||||
char *buffer,
|
||||
size_t buffer_size,
|
||||
unsigned int clients_in_master,
|
||||
unsigned int visible_clients
|
||||
);
|
||||
|
||||
void layouts_symbol_centeredmaster(
|
||||
char *buffer,
|
||||
size_t buffer_size,
|
||||
unsigned int clients_in_master,
|
||||
unsigned int visible_clients
|
||||
);
|
||||
|
||||
#endif // _LAYOUTS_H
|
Loading…
Reference in a new issue