more reformatting/cleanups

This commit is contained in:
Michael Stapelberg 2010-04-13 17:52:23 +02:00
parent dd7acf73e9
commit eec762ea8f
3 changed files with 80 additions and 181 deletions

View File

@ -1,11 +1,8 @@
/* /*
* vim:ts=8:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* * © 2009-2010 Michael Stapelberg and contributors (see also: LICENSE)
* © 2009-2010 Michael Stapelberg and contributors
*
* See file LICENSE for license information.
* *
* include/data.h: This file defines all data structures used by i3 * include/data.h: This file defines all data structures used by i3
* *
@ -110,17 +107,6 @@ struct Ignore_Event {
SLIST_ENTRY(Ignore_Event) ignore_events; SLIST_ENTRY(Ignore_Event) ignore_events;
}; };
/**
* Emulates the behaviour of tables of libxcb-wm, which in libxcb 0.3.4
* suddenly vanished.
*
*/
struct keyvalue_element {
uint32_t key;
void *value;
TAILQ_ENTRY(keyvalue_element) elements;
};
/****************************************************************************** /******************************************************************************
* Major types * Major types
*****************************************************************************/ *****************************************************************************/
@ -167,27 +153,6 @@ struct Autostart {
TAILQ_ENTRY(Autostart) autostarts; TAILQ_ENTRY(Autostart) autostarts;
}; };
/**
* Holds an assignment for a given window class/title to a specific workspace
* (see src/config.c)
*
*/
struct Assignment {
char *windowclass_title;
/** floating is true if this was an assignment to the special
* workspace "~". Matching clients will be put into floating mode
* automatically. */
enum {
ASSIGN_FLOATING_NO, /* dont float, but put on a workspace */
ASSIGN_FLOATING_ONLY, /* float, but dont assign on a workspace */
ASSIGN_FLOATING /* float and put on a workspace */
} floating;
/** The number of the workspace to assign to. */
int workspace;
TAILQ_ENTRY(Assignment) assignments;
};
/** /**
* Data structure for cached font information: * Data structure for cached font information:
* - font id in X11 (load it once) * - font id in X11 (load it once)

View File

@ -34,10 +34,6 @@
} \ } \
while (0) while (0)
TAILQ_HEAD(keyvalue_table_head, keyvalue_element);
extern struct keyvalue_table_head by_parent;
extern struct keyvalue_table_head by_child;
int min(int a, int b); int min(int a, int b);
int max(int a, int b); int max(int a, int b);
@ -76,26 +72,6 @@ void *srealloc(void *ptr, size_t size);
*/ */
char *sstrdup(const char *str); char *sstrdup(const char *str);
/**
* Inserts an element into the given keyvalue-table using the given key.
*
*/
bool table_put(struct keyvalue_table_head *head, uint32_t key, void *value);
/**
* Removes the element from the given keyvalue-table with the given key and
* returns its value;
*
*/
void *table_remove(struct keyvalue_table_head *head, uint32_t key);
/**
* Returns the value of the element of the given keyvalue-table with the given
* key.
*
*/
void *table_get(struct keyvalue_table_head *head, uint32_t key);
/** /**
* Starts the given application by passing it through a shell. We use double * Starts the given application by passing it through a shell. We use double
* fork to avoid zombie processes. As the started applications parent exits * fork to avoid zombie processes. As the started applications parent exits

View File

@ -22,8 +22,6 @@
#include "all.h" #include "all.h"
static iconv_t conversion_descriptor = 0; static iconv_t conversion_descriptor = 0;
struct keyvalue_table_head by_parent = TAILQ_HEAD_INITIALIZER(by_parent);
struct keyvalue_table_head by_child = TAILQ_HEAD_INITIALIZER(by_child);
int min(int a, int b) { int min(int a, int b) {
return (a < b ? a : b); return (a < b ? a : b);
@ -73,46 +71,6 @@ char *sstrdup(const char *str) {
return result; return result;
} }
#if 0
/*
* The table_* functions emulate the behaviour of libxcb-wm, which in libxcb 0.3.4 suddenly
* vanished. Great.
*
*/
bool table_put(struct keyvalue_table_head *head, uint32_t key, void *value) {
struct keyvalue_element *element = scalloc(sizeof(struct keyvalue_element));
element->key = key;
element->value = value;
TAILQ_INSERT_TAIL(head, element, elements);
return true;
}
void *table_remove(struct keyvalue_table_head *head, uint32_t key) {
struct keyvalue_element *element;
TAILQ_FOREACH(element, head, elements)
if (element->key == key) {
void *value = element->value;
TAILQ_REMOVE(head, element, elements);
free(element);
return value;
}
return NULL;
}
void *table_get(struct keyvalue_table_head *head, uint32_t key) {
struct keyvalue_element *element;
TAILQ_FOREACH(element, head, elements)
if (element->key == key)
return element->value;
return NULL;
}
#endif
/* /*
* Starts the given application by passing it through a shell. We use double fork * Starts the given application by passing it through a shell. We use double fork
* to avoid zombie processes. As the started applications parent exits (immediately), * to avoid zombie processes. As the started applications parent exits (immediately),