Migrate to queue.h
This commit is contained in:
@ -1,18 +1,21 @@
|
||||
#ifndef OUTPUTS_H_
|
||||
#define OUTPUTS_H_
|
||||
|
||||
#include "common.h"
|
||||
#include <xcb/xcb.h>
|
||||
|
||||
typedef struct i3_output_t i3_output;
|
||||
#include "common.h"
|
||||
#include "workspaces.h"
|
||||
|
||||
i3_output* outputs;
|
||||
typedef struct i3_output i3_output;
|
||||
|
||||
SLIST_HEAD(outputs_head, i3_output);
|
||||
struct outputs_head *outputs;
|
||||
|
||||
void parse_outputs_json(char* json);
|
||||
void free_outputs();
|
||||
i3_output* get_output_by_name(char* name);
|
||||
|
||||
struct i3_output_t {
|
||||
struct i3_output {
|
||||
char* name;
|
||||
bool active;
|
||||
int ws;
|
||||
@ -21,7 +24,9 @@ struct i3_output_t {
|
||||
xcb_window_t bar;
|
||||
xcb_gcontext_t bargc;
|
||||
|
||||
i3_output* next;
|
||||
struct ws_head *workspaces;
|
||||
|
||||
SLIST_ENTRY(i3_output) slist;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef UTIL_H_
|
||||
#define UTIL_H_
|
||||
|
||||
#include "queue.h"
|
||||
|
||||
/* Securely free p */
|
||||
#define FREE(p) do { \
|
||||
if (p != NULL) { \
|
||||
@ -10,13 +12,23 @@
|
||||
} while (0)
|
||||
|
||||
/* Securely fee single-linked list */
|
||||
#define FREE_LIST(l, type) do { \
|
||||
type* FREE_LIST_TMP; \
|
||||
while (l != NULL) { \
|
||||
FREE_LIST_TMP = l; \
|
||||
free(l); \
|
||||
l = l->next; \
|
||||
#define FREE_SLIST(l, type) do { \
|
||||
type *walk = SLIST_FIRST(l); \
|
||||
while (!SLIST_EMPTY(l)) { \
|
||||
SLIST_REMOVE_HEAD(l, slist); \
|
||||
FREE(walk); \
|
||||
walk = SLIST_FIRST(l); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
|
||||
/* Securely fee tail-queues */
|
||||
#define FREE_TAILQ(l, type) do { \
|
||||
type *walk = TAILQ_FIRST(l); \
|
||||
while (!TAILQ_EMPTY(l)) { \
|
||||
TAILQ_REMOVE(l, TAILQ_FIRST(l), tailq); \
|
||||
FREE(walk); \
|
||||
walk = TAILQ_FIRST(l); \
|
||||
} \
|
||||
} while (0)
|
||||
|
@ -4,24 +4,24 @@
|
||||
#include "common.h"
|
||||
#include "outputs.h"
|
||||
|
||||
typedef struct i3_ws_t i3_ws;
|
||||
typedef struct i3_ws i3_ws;
|
||||
|
||||
i3_ws* workspaces;
|
||||
TAILQ_HEAD(ws_head, i3_ws);
|
||||
|
||||
void parse_workspaces_json();
|
||||
void free_workspaces();
|
||||
|
||||
struct i3_ws_t {
|
||||
int num;
|
||||
char* name;
|
||||
int name_width;
|
||||
bool visible;
|
||||
bool focused;
|
||||
bool urgent;
|
||||
rect rect;
|
||||
i3_output* output;
|
||||
struct i3_ws {
|
||||
int num;
|
||||
char *name;
|
||||
int name_width;
|
||||
bool visible;
|
||||
bool focused;
|
||||
bool urgent;
|
||||
rect rect;
|
||||
struct i3_output *output;
|
||||
|
||||
i3_ws* next;
|
||||
TAILQ_ENTRY(i3_ws) tailq;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -25,5 +25,6 @@ void destroy_windows();
|
||||
void create_windows();
|
||||
void draw_buttons();
|
||||
int get_string_width(char *string);
|
||||
void handle_xcb_event(xcb_generic_event_t *event);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user