Rename struct fields

This commit is contained in:
Alex Kotov 2021-11-21 01:25:56 +05:00
parent 6686a58ae1
commit 989b6b421d
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
5 changed files with 31 additions and 24 deletions

View File

@ -38,8 +38,11 @@
#define ISVISIBLE(C) (true) #define ISVISIBLE(C) (true)
#define LENGTH(X) (sizeof(X) / sizeof(X[0])) #define LENGTH(X) (sizeof(X) / sizeof(X[0]))
#define MOUSEMASK (BUTTONMASK | PointerMotionMask) #define MOUSEMASK (BUTTONMASK | PointerMotionMask)
#define WIDTH(X) ((X)->state.geometry.basic.w + 2 * (X)->state.geometry.bw)
#define HEIGHT(X) ((X)->state.geometry.basic.h + 2 * (X)->state.geometry.bw) #define WIDTH(X) \
((X)->state.geometry.basic.w + 2 * (X)->state.geometry.border_width)
#define HEIGHT(X) \
((X)->state.geometry.basic.h + 2 * (X)->state.geometry.border_width)
#define CLEANMASK(mask) ( \ #define CLEANMASK(mask) ( \
(mask) & \ (mask) & \
@ -406,7 +409,7 @@ int applysizehints(
|| ||
*h != c->state.geometry.basic.h *h != c->state.geometry.basic.h
|| ||
bw != c->state.geometry.bw bw != c->state.geometry.border_width
); );
} }
@ -549,7 +552,7 @@ void configure(Client *c)
.y = c->state.geometry.basic.y, .y = c->state.geometry.basic.y,
.width = c->state.geometry.basic.w, .width = c->state.geometry.basic.w,
.height = c->state.geometry.basic.h, .height = c->state.geometry.basic.h,
.border_width = c->state.geometry.bw, .border_width = c->state.geometry.border_width,
.above = None, .above = None,
.override_redirect = False, .override_redirect = False,
}; };
@ -909,11 +912,11 @@ void manage(Window w, XWindowAttributes *wa)
c->state.geometry.basic.y = c->state.geometry.basic.y =
MAX(c->state.geometry.basic.y, c->mon->screen_geometry.y); MAX(c->state.geometry.basic.y, c->mon->screen_geometry.y);
c->state.geometry.bw = settings_get_border_width(); c->state.geometry.border_width = settings_get_border_width();
{ {
XWindowChanges wc; XWindowChanges wc;
wc.border_width = c->state.geometry.bw; wc.border_width = c->state.geometry.border_width;
XConfigureWindow(dpy, w, CWBorderWidth, &wc); XConfigureWindow(dpy, w, CWBorderWidth, &wc);
} }
@ -1084,7 +1087,7 @@ void movemouse(__attribute__((unused)) const Arg *arg)
ny, ny,
c->state.geometry.basic.w, c->state.geometry.basic.w,
c->state.geometry.basic.h, c->state.geometry.basic.h,
c->state.geometry.bw, c->state.geometry.border_width,
1 1
); );
} }
@ -1237,7 +1240,7 @@ void resizeclient(Client *c, int x, int y, int w, int h, int bw)
c->state.geometry.basic.y = wc.y = y; c->state.geometry.basic.y = wc.y = y;
c->state.geometry.basic.w = wc.width = w; c->state.geometry.basic.w = wc.width = w;
c->state.geometry.basic.h = wc.height = h; c->state.geometry.basic.h = wc.height = h;
c->state.geometry.bw = wc.border_width = bw; c->state.geometry.border_width = wc.border_width = bw;
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
configure(c); configure(c);
@ -1266,8 +1269,8 @@ void resizemouse(__attribute__((unused)) const Arg *arg)
0, 0,
0, 0,
0, 0,
c->state.geometry.basic.w + c->state.geometry.bw - 1, c->state.geometry.basic.w + c->state.geometry.border_width - 1,
c->state.geometry.basic.h + c->state.geometry.bw - 1 c->state.geometry.basic.h + c->state.geometry.border_width - 1
); );
const unsigned int snap_distance = settings_get_snap_distance(); const unsigned int snap_distance = settings_get_snap_distance();
@ -1296,10 +1299,14 @@ void resizemouse(__attribute__((unused)) const Arg *arg)
lasttime = ev.xmotion.time; lasttime = ev.xmotion.time;
const int nw = const int nw = MAX(
MAX(ev.xmotion.x - ocx - 2 * c->state.geometry.bw + 1, 1); ev.xmotion.x - ocx - 2 * c->state.geometry.border_width + 1,
const int nh = 1
MAX(ev.xmotion.y - ocy - 2 * c->state.geometry.bw + 1, 1); );
const int nh = MAX(
ev.xmotion.y - ocy - 2 * c->state.geometry.border_width + 1,
1
);
if ( if (
( (
@ -1350,7 +1357,7 @@ void resizemouse(__attribute__((unused)) const Arg *arg)
c->state.geometry.basic.y, c->state.geometry.basic.y,
nw, nw,
nh, nh,
c->state.geometry.bw, c->state.geometry.border_width,
1 1
); );
} }
@ -1367,8 +1374,8 @@ void resizemouse(__attribute__((unused)) const Arg *arg)
0, 0,
0, 0,
0, 0,
c->state.geometry.basic.w + c->state.geometry.bw - 1, c->state.geometry.basic.w + c->state.geometry.border_width - 1,
c->state.geometry.basic.h + c->state.geometry.bw - 1 c->state.geometry.basic.h + c->state.geometry.border_width - 1
); );
XUngrabPointer(dpy, CurrentTime); XUngrabPointer(dpy, CurrentTime);
@ -1695,7 +1702,7 @@ void showhide(Client *c)
c->state.geometry.basic.y, c->state.geometry.basic.y,
c->state.geometry.basic.w, c->state.geometry.basic.w,
c->state.geometry.basic.h, c->state.geometry.basic.h,
c->state.geometry.bw, c->state.geometry.border_width,
0 0
); );
} }
@ -1750,9 +1757,9 @@ void togglefloating(__attribute__((unused)) const Arg *arg)
selmon->sel->state.geometry.basic.x, selmon->sel->state.geometry.basic.x,
selmon->sel->state.geometry.basic.y, selmon->sel->state.geometry.basic.y,
selmon->sel->state.geometry.basic.w - selmon->sel->state.geometry.basic.w -
2 * (border_width - selmon->sel->state.geometry.bw), 2 * (border_width - selmon->sel->state.geometry.border_width),
selmon->sel->state.geometry.basic.h - selmon->sel->state.geometry.basic.h -
2 * (border_width - selmon->sel->state.geometry.bw), 2 * (border_width - selmon->sel->state.geometry.border_width),
border_width, border_width,
0 0
); );

View File

@ -73,7 +73,7 @@ void on_configure_request(XEvent *e)
if ((c = wintoclient(ev->window))) { if ((c = wintoclient(ev->window))) {
if (ev->value_mask & CWBorderWidth) { if (ev->value_mask & CWBorderWidth) {
c->state.geometry.bw = ev->border_width; c->state.geometry.border_width = ev->border_width;
} else if (c->state.is_floating || !selmon->lt[selmon->sellt]->arrange) { } else if (c->state.is_floating || !selmon->lt[selmon->sellt]->arrange) {
m = c->mon; m = c->mon;
if (ev->value_mask & CWX) { if (ev->value_mask & CWX) {

View File

@ -110,7 +110,7 @@ void floating(Monitor *m)
const int border_width = settings_get_border_width(); const int border_width = settings_get_border_width();
for (Client *c = m->clients; c; c = c->next) { for (Client *c = m->clients; c; c = c->next) {
if (ISVISIBLE(c) && c->state.geometry.bw == 0) { if (ISVISIBLE(c) && c->state.geometry.border_width == 0) {
resize( resize(
c, c,
c->state.geometry.basic.x, c->state.geometry.basic.x,

View File

@ -13,7 +13,7 @@ void basic_geometry_init(const BasicGeometry basic_geometry)
void client_geometry_init(const ClientGeometry client_geometry) void client_geometry_init(const ClientGeometry client_geometry)
{ {
basic_geometry_init(&client_geometry->basic); basic_geometry_init(&client_geometry->basic);
client_geometry->bw = 0; client_geometry->border_width = 0;
} }
void client_size_hints_init(const ClientSizeHints client_size_hints) void client_size_hints_init(const ClientSizeHints client_size_hints)

View File

@ -21,7 +21,7 @@ struct BasicGeometry { int x, y, w, h; };
struct ClientGeometry { struct ClientGeometry {
struct BasicGeometry basic; struct BasicGeometry basic;
int bw; int border_width;
}; };
struct ClientSizeHints { struct ClientSizeHints {