Skip to content

Commit

Permalink
Bar rehaul (#425)
Browse files Browse the repository at this point in the history
  • Loading branch information
DerjenigeUberMensch authored Sep 12, 2024
1 parent 6b1eeb4 commit d5d5e61
Show file tree
Hide file tree
Showing 9 changed files with 374 additions and 597 deletions.
8 changes: 4 additions & 4 deletions config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ LINKRELEASE = ${NO_SANATIZE_FLAGS}
LINKDEBUG = -Wl,--gc-sections ${MEMFLAGS}

CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L ${XINERAMAFLAGS}
CCFLAGS = ${CCVERSION} ${WARNINGFLAGS} ${INCS} ${CPPFLAGS} ${PRELINKERFLAGS}
RELEASEFLAGS = ${CCFLAGS}
CCFLAGS = ${CCVERSION} ${WARNINGFLAGS} ${INCS} ${CPPFLAGS}
RELEASEFLAGS = ${PRELINKERFLAGS} ${CCFLAGS}

DEBUG = -ggdb -g ${SECTIONCODE} ${MEMFLAGS} -fverbose-asm -O0
DEBUG = -ggdb -g ${CFLAGS} ${SECTIONCODE} ${MEMFLAGS} -fverbose-asm -O0

SIZE = ${RELEASEFLAGS} -Os

Expand All @@ -70,7 +70,7 @@ RELEASE = ${RELEASEFLAGS} -O2
# Release Speed (-O3)
RELEASES= ${RELEASEFLAGS} -O3
# Release Speed (-O3) (debug)
#RELEASES = ${RELEASEFLAGS} -O3 ${DEBUGFLAGS} -fno-inline -DENABLE_DEBUG -DXCB_TRL_ENABLE_DEBUG
#RELEASES = ${DEBUG} -O3

# Build using cpu specific instruction set for more performance (Optional)
BUILDSELF = ${RELEASEFLAGS} ${XNATIVE} -O3
Expand Down
56 changes: 27 additions & 29 deletions include/bar.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,37 @@

#include <stdint.h>

#include "XCB-TRL/xcb_trl.h"
/* struct externs */
struct Client;
struct Desktop;
struct Monitor;



#define _SHOW_BAR ((1 << 1))

#define SHOWBAR(B) (((B)->flags & _SHOW_BAR))


typedef struct Bar Bar;

struct Bar
enum
BarSides
{
int16_t x;
int16_t y;
uint16_t w;
uint16_t h;

uint8_t flags;
uint8_t pad[3];

XCBWindow win;
XCBPixmap pix;
XCBGC gc;
XCBDisplay *dpy;
unsigned int screen;

size_t buffsize;
uint32_t *writebuff;
BarSideLeft,
BarSideRight,
BarSideTop,
BarSideBottom,
BarSideLAST,
};

/* Calculates which side the bar is currently on, in regards to geometry.
* NOTE: get_prev, gets the previous side in which the bar was on, previously.
*/
enum BarSides calculatebarside(struct Monitor *m, struct Client *bar, uint8_t get_prev);
/* Checks given the provided information if a window is eligible to be a new bar.
* if it is then it becomes the new bar.
* RETURN: 0 on Success.
* RETURN: 1 on no new bar (Failure).
*/
uint8_t checknewbar(struct Monitor *m, struct Client *c, uint8_t has_strut_or_strutp);
/* Sets up special data. */
void setupbar(struct Monitor *m, struct Client *c);
/* updates the bar geometry from the given monitor */
void updatebargeom(struct Monitor *m);
/* updates the Status Bar Position from given monitor */
void updatebarpos(struct Monitor *m);

void setshowbar(Bar *bar, uint8_t state);
void resizebar(Bar *bar, int32_t x, int32_t y, int32_t w, int32_t h);

#endif
9 changes: 0 additions & 9 deletions include/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,6 @@ enum ManageClientProperties
ManageClientLAST
};

enum BarSides
{
BarSideLeft, BarSideRight, BarSideTop, BarSideBottom
};

enum
FloatType
{
Expand Down Expand Up @@ -530,8 +525,6 @@ void unmaximizevert(Client *c);

/* MACROS */

/* checks if a client could be a bar */
uint32_t COULDBEBAR(Client *c, uint8_t strut);
uint32_t ISALWAYSONTOP(Client *c);
uint32_t ISALWAYSONBOTTOM(Client *c);
uint32_t WASFLOATING(Client *c);
Expand Down Expand Up @@ -603,8 +596,6 @@ uint16_t OLDHEIGHT(Client *c);
uint16_t WIDTH(Client *c);
uint16_t HEIGHT(Client *c);

enum BarSides GETBARSIDE(struct Monitor *m, Client *bar, uint8_t get_prev_side);




Expand Down
12 changes: 0 additions & 12 deletions include/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,6 @@ struct MotifWmHints
uint32_t status;
};

/* Checks given the provided information if a window is eligible to be a new bar.
* if it is then it becomes the new bar.
* RETURN: 0 on Success.
* RETURN: 1 on no new bar (Failure).
*/
uint8_t checknewbar(Monitor *m, Client *c, const uint8_t has_strut_or_strut_partial);
/* Inital startup check if there is another window manager running.
*/
void checkotherwm(void);
Expand Down Expand Up @@ -202,8 +196,6 @@ void scan(void);
void setup(void);
/* Sets up Atoms ID's from the XServer */
void setupatoms(void);
/* Sets up special data. */
void setupbar(Monitor *m, Client *bar);
/* Loads CFG data into Settings struct. */
void setupcfg(void);
/* Sets up System related data */
Expand All @@ -226,10 +218,6 @@ void specialconds(int argc, char *argcv[]);
void startup(void);
/* Starts the wm basic process */
void startupwm(void);
/* updates the Status Bar Position from given monitor */
void updatebarpos(Monitor *m);
/* updates the bar geometry from the given monitor */
void updatebargeom(Monitor *m);
/* Wakups the current X connection by sending a event to it */
void wakeupconnection(XCBDisplay *display, int screen);
/* Error handler */
Expand Down
Loading

0 comments on commit d5d5e61

Please sign in to comment.