Rename ClientGeom to WinGeom
This commit is contained in:
parent
db8f485909
commit
a5e8ed0fee
7 changed files with 140 additions and 140 deletions
74
src/dwm.c
74
src/dwm.c
|
@ -144,7 +144,7 @@ struct Monitor {
|
|||
* function declarations *
|
||||
*************************/
|
||||
|
||||
static int applysizehints(Client *c, ClientGeom client_geom, int interact);
|
||||
static int applysizehints(Client *c, WinGeom win_geom, int interact);
|
||||
static void arrange(Monitor *m);
|
||||
static void arrangemon(Monitor *m);
|
||||
static void attach(Client *c);
|
||||
|
@ -178,8 +178,8 @@ static void pop(Client *);
|
|||
static void quit(const Arg *arg);
|
||||
static Monitor *recttomon(int x, int y, int w, int h);
|
||||
static void resetnmaster(const Arg *arg);
|
||||
static void resize(Client *c, struct ClientGeom client_geom, int interact);
|
||||
static void resizeclient(Client *c, struct ClientGeom client_geom);
|
||||
static void resize(Client *c, struct WinGeom win_geom, int interact);
|
||||
static void resizeclient(Client *c, struct WinGeom win_geom);
|
||||
static void resizemouse(const Arg *arg);
|
||||
static void restack(Monitor *m);
|
||||
static void run();
|
||||
|
@ -390,14 +390,14 @@ int dwm_main(const char *const new_program_title)
|
|||
|
||||
int applysizehints(
|
||||
Client *c,
|
||||
ClientGeom client_geom,
|
||||
WinGeom win_geom,
|
||||
int interact
|
||||
) {
|
||||
int *const x = &client_geom->basic.position.x;
|
||||
int *const y = &client_geom->basic.position.y;
|
||||
int *const w = &client_geom->basic.sizes.w;
|
||||
int *const h = &client_geom->basic.sizes.h;
|
||||
int const bw = client_geom->border_width;
|
||||
int *const x = &win_geom->basic.position.x;
|
||||
int *const y = &win_geom->basic.position.y;
|
||||
int *const w = &win_geom->basic.sizes.w;
|
||||
int *const h = &win_geom->basic.sizes.h;
|
||||
int const bw = win_geom->border_width;
|
||||
|
||||
Monitor *m = c->mon;
|
||||
|
||||
|
@ -410,13 +410,13 @@ int applysizehints(
|
|||
*x =
|
||||
xbase->screen_sizes.w
|
||||
-
|
||||
client_geom_total_width(&c->state.geom);
|
||||
win_geom_total_width(&c->state.geom);
|
||||
}
|
||||
if (*y > xbase->screen_sizes.h) {
|
||||
*y =
|
||||
xbase->screen_sizes.h
|
||||
-
|
||||
client_geom_total_height(&c->state.geom);
|
||||
win_geom_total_height(&c->state.geom);
|
||||
}
|
||||
if (*x + *w + 2 * bw < 0) {
|
||||
*x = 0;
|
||||
|
@ -435,7 +435,7 @@ int applysizehints(
|
|||
+
|
||||
m->window_area_geom.sizes.w
|
||||
-
|
||||
client_geom_total_width(&c->state.geom);
|
||||
win_geom_total_width(&c->state.geom);
|
||||
}
|
||||
if (
|
||||
*y
|
||||
|
@ -447,7 +447,7 @@ int applysizehints(
|
|||
+
|
||||
m->window_area_geom.sizes.h
|
||||
-
|
||||
client_geom_total_height(&c->state.geom);
|
||||
win_geom_total_height(&c->state.geom);
|
||||
}
|
||||
if (*x + *w + 2 * bw <= m->window_area_geom.position.x) {
|
||||
*x = m->window_area_geom.position.x;
|
||||
|
@ -1024,7 +1024,7 @@ void manage(Window w, XWindowAttributes *wa)
|
|||
}
|
||||
}
|
||||
|
||||
client_geom_adjust_to_boundary(
|
||||
win_geom_adjust_to_boundary(
|
||||
&c->state.geom,
|
||||
&c->mon->screen_geom
|
||||
);
|
||||
|
@ -1045,9 +1045,9 @@ void manage(Window w, XWindowAttributes *wa)
|
|||
updatewmhints(c);
|
||||
|
||||
{
|
||||
const int total_width = client_geom_total_width(&c->state.geom);
|
||||
const int total_width = win_geom_total_width(&c->state.geom);
|
||||
const int total_height =
|
||||
client_geom_total_height(&c->state.geom);
|
||||
win_geom_total_height(&c->state.geom);
|
||||
|
||||
c->state.geom.basic.position.x =
|
||||
c->mon->screen_geom.position.x
|
||||
|
@ -1223,7 +1223,7 @@ void movemouse(__attribute__((unused)) const Arg *arg)
|
|||
selmon->window_area_geom.sizes.w
|
||||
)
|
||||
-
|
||||
(nx + client_geom_total_width(&c->state.geom))
|
||||
(nx + win_geom_total_width(&c->state.geom))
|
||||
)
|
||||
<
|
||||
snap_distance
|
||||
|
@ -1233,7 +1233,7 @@ void movemouse(__attribute__((unused)) const Arg *arg)
|
|||
+
|
||||
selmon->window_area_geom.sizes.w
|
||||
-
|
||||
client_geom_total_width(&c->state.geom);
|
||||
win_geom_total_width(&c->state.geom);
|
||||
}
|
||||
|
||||
if (
|
||||
|
@ -1248,7 +1248,7 @@ void movemouse(__attribute__((unused)) const Arg *arg)
|
|||
selmon->window_area_geom.position.y
|
||||
+
|
||||
selmon->window_area_geom.sizes.h
|
||||
) - (ny + client_geom_total_height(&c->state.geom))
|
||||
) - (ny + win_geom_total_height(&c->state.geom))
|
||||
)
|
||||
<
|
||||
snap_distance
|
||||
|
@ -1258,7 +1258,7 @@ void movemouse(__attribute__((unused)) const Arg *arg)
|
|||
+
|
||||
selmon->window_area_geom.sizes.h
|
||||
-
|
||||
client_geom_total_height(&c->state.geom);
|
||||
win_geom_total_height(&c->state.geom);
|
||||
}
|
||||
|
||||
if (
|
||||
|
@ -1273,9 +1273,9 @@ void movemouse(__attribute__((unused)) const Arg *arg)
|
|||
}
|
||||
|
||||
if (!selmon->lt[selmon->sellt]->arrange || c->state.is_floating) {
|
||||
struct ClientGeom client_geom = c->state.geom;
|
||||
position_init_from_args(&client_geom.basic.position, nx, ny);
|
||||
resize(c, client_geom, 1);
|
||||
struct WinGeom win_geom = c->state.geom;
|
||||
position_init_from_args(&win_geom.basic.position, nx, ny);
|
||||
resize(c, win_geom, 1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -1412,19 +1412,19 @@ void resetnmaster(const Arg *arg)
|
|||
arrange(selmon);
|
||||
}
|
||||
|
||||
void resize(Client *c, struct ClientGeom client_geom, int interact)
|
||||
void resize(Client *c, struct WinGeom win_geom, int interact)
|
||||
{
|
||||
if (applysizehints(c, &client_geom, interact)) {
|
||||
resizeclient(c, client_geom);
|
||||
if (applysizehints(c, &win_geom, interact)) {
|
||||
resizeclient(c, win_geom);
|
||||
}
|
||||
}
|
||||
|
||||
void resizeclient(Client *c, const struct ClientGeom client_geom)
|
||||
void resizeclient(Client *c, const struct WinGeom win_geom)
|
||||
{
|
||||
c->state.geom = client_geom;
|
||||
c->state.geom = win_geom;
|
||||
|
||||
XWindowChanges wc = { 0 };
|
||||
client_geom_convert_to_x_window_changes(&client_geom, &wc);
|
||||
win_geom_convert_to_x_window_changes(&win_geom, &wc);
|
||||
|
||||
XConfigureWindow(
|
||||
xbase->x_display,
|
||||
|
@ -1556,9 +1556,9 @@ void resizemouse(__attribute__((unused)) const Arg *arg)
|
|||
}
|
||||
|
||||
if (!selmon->lt[selmon->sellt]->arrange || c->state.is_floating) {
|
||||
struct ClientGeom client_geom = c->state.geom;
|
||||
sizes_init_from_args(&client_geom.basic.sizes, nw, nh);
|
||||
resize(c, client_geom, 1);
|
||||
struct WinGeom win_geom = c->state.geom;
|
||||
sizes_init_from_args(&win_geom.basic.sizes, nw, nh);
|
||||
resize(c, win_geom, 1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -1881,7 +1881,7 @@ void showhide(Client *c)
|
|||
XMoveWindow(
|
||||
xbase->x_display,
|
||||
c->x_window,
|
||||
client_geom_total_width(&c->state.geom) * -2,
|
||||
win_geom_total_width(&c->state.geom) * -2,
|
||||
c->state.geom.basic.position.y
|
||||
);
|
||||
}
|
||||
|
@ -1918,18 +1918,18 @@ void togglefloating(__attribute__((unused)) const Arg *arg)
|
|||
const int border_width = settings_get_border_width();
|
||||
|
||||
if (selmon->sel->state.is_floating) {
|
||||
struct ClientGeom client_geom = selmon->sel->state.geom;
|
||||
struct WinGeom win_geom = selmon->sel->state.geom;
|
||||
|
||||
client_geom.basic.sizes = sizes_create_from_args(
|
||||
win_geom.basic.sizes = sizes_create_from_args(
|
||||
selmon->sel->state.geom.basic.sizes.w -
|
||||
2 * (border_width - selmon->sel->state.geom.border_width),
|
||||
selmon->sel->state.geom.basic.sizes.h -
|
||||
2 * (border_width - selmon->sel->state.geom.border_width)
|
||||
);
|
||||
|
||||
client_geom.border_width = border_width;
|
||||
win_geom.border_width = border_width;
|
||||
|
||||
resize(selmon->sel, client_geom, 0);
|
||||
resize(selmon->sel, win_geom, 0);
|
||||
}
|
||||
|
||||
arrange(selmon);
|
||||
|
|
|
@ -113,7 +113,7 @@ void on_configure_request(XEvent *e)
|
|||
(
|
||||
m->screen_geom.sizes.w / 2
|
||||
-
|
||||
client_geom_total_width(&c->state.geom) / 2
|
||||
win_geom_total_width(&c->state.geom) / 2
|
||||
);
|
||||
}
|
||||
if (
|
||||
|
@ -134,7 +134,7 @@ void on_configure_request(XEvent *e)
|
|||
(
|
||||
m->screen_geom.sizes.h / 2
|
||||
-
|
||||
client_geom_total_height(&c->state.geom) / 2
|
||||
win_geom_total_height(&c->state.geom) / 2
|
||||
);
|
||||
}
|
||||
if ((ev->value_mask & (CWX|CWY)) && !(ev->value_mask & (CWWidth|CWHeight))) {
|
||||
|
|
|
@ -51,9 +51,9 @@ void centeredmaster(Monitor *m)
|
|||
const int right_gap = n <= m->nmaster ? gap_size : bottom_right_half_gap;
|
||||
const int bottom_gap = (i == m->nmaster - 1 || i == n - 1) ? gap_size : bottom_right_half_gap;
|
||||
|
||||
struct ClientGeom client_geom;
|
||||
client_geom_init_from_args(
|
||||
&client_geom,
|
||||
struct WinGeom win_geom;
|
||||
win_geom_init_from_args(
|
||||
&win_geom,
|
||||
m->window_area_geom.position.x + mx + left_gap,
|
||||
m->window_area_geom.position.y + my + top_gap,
|
||||
mw - 2 * border_width - left_gap - right_gap,
|
||||
|
@ -61,10 +61,10 @@ void centeredmaster(Monitor *m)
|
|||
border_width
|
||||
);
|
||||
|
||||
resize(c, client_geom, 0);
|
||||
resize(c, win_geom, 0);
|
||||
|
||||
const int total_height =
|
||||
client_geom_total_height(&c->state.geom);
|
||||
win_geom_total_height(&c->state.geom);
|
||||
|
||||
my += total_height + top_gap + bottom_gap;
|
||||
} else {
|
||||
|
@ -78,9 +78,9 @@ void centeredmaster(Monitor *m)
|
|||
const int right_gap = bottom_right_half_gap;
|
||||
const int bottom_gap = (i == n - 1 || i == n - 2) ? gap_size : bottom_right_half_gap;
|
||||
|
||||
struct ClientGeom client_geom;
|
||||
client_geom_init_from_args(
|
||||
&client_geom,
|
||||
struct WinGeom win_geom;
|
||||
win_geom_init_from_args(
|
||||
&win_geom,
|
||||
m->window_area_geom.position.x + left_gap,
|
||||
m->window_area_geom.position.y + ety + top_gap,
|
||||
tw - 2 * border_width - left_gap - right_gap,
|
||||
|
@ -88,10 +88,10 @@ void centeredmaster(Monitor *m)
|
|||
border_width
|
||||
);
|
||||
|
||||
resize(c, client_geom, 0);
|
||||
resize(c, win_geom, 0);
|
||||
|
||||
const int total_height =
|
||||
client_geom_total_height(&c->state.geom);
|
||||
win_geom_total_height(&c->state.geom);
|
||||
|
||||
ety += total_height + top_gap + bottom_gap;
|
||||
} else {
|
||||
|
@ -103,9 +103,9 @@ void centeredmaster(Monitor *m)
|
|||
const int right_gap = gap_size;
|
||||
const int bottom_gap = (i == n - 1 || i == n - 2) ? gap_size : bottom_right_half_gap;
|
||||
|
||||
struct ClientGeom client_geom;
|
||||
client_geom_init_from_args(
|
||||
&client_geom,
|
||||
struct WinGeom win_geom;
|
||||
win_geom_init_from_args(
|
||||
&win_geom,
|
||||
m->window_area_geom.position.x + mx + mw + left_gap,
|
||||
m->window_area_geom.position.y + oty + top_gap,
|
||||
tw - 2 * border_width - left_gap - right_gap,
|
||||
|
@ -113,10 +113,10 @@ void centeredmaster(Monitor *m)
|
|||
border_width
|
||||
);
|
||||
|
||||
resize(c, client_geom, 0);
|
||||
resize(c, win_geom, 0);
|
||||
|
||||
const int total_height =
|
||||
client_geom_total_height(&c->state.geom);
|
||||
win_geom_total_height(&c->state.geom);
|
||||
|
||||
oty += total_height + top_gap + bottom_gap;
|
||||
}
|
||||
|
@ -130,9 +130,9 @@ void floating(Monitor *m)
|
|||
|
||||
for (Client *c = m->clients; c; c = c->next) {
|
||||
if (ISVISIBLE(c) && c->state.geom.border_width == 0) {
|
||||
struct ClientGeom client_geom;
|
||||
client_geom_init_from_args(
|
||||
&client_geom,
|
||||
struct WinGeom win_geom;
|
||||
win_geom_init_from_args(
|
||||
&win_geom,
|
||||
c->state.geom.basic.position.x,
|
||||
c->state.geom.basic.position.y,
|
||||
c->state.geom.basic.sizes.w - 2 * border_width,
|
||||
|
@ -140,7 +140,7 @@ void floating(Monitor *m)
|
|||
border_width
|
||||
);
|
||||
|
||||
resize(c, client_geom, 0);
|
||||
resize(c, win_geom, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -182,9 +182,9 @@ void horizontile(Monitor *m)
|
|||
const unsigned int right_gap = (i == m->nmaster - 1 || i == n - 1) ? gap_size : bottom_right_half_gap;
|
||||
const unsigned int bottom_gap = n <= m->nmaster ? gap_size : bottom_right_half_gap;
|
||||
|
||||
struct ClientGeom client_geom;
|
||||
client_geom_init_from_args(
|
||||
&client_geom,
|
||||
struct WinGeom win_geom;
|
||||
win_geom_init_from_args(
|
||||
&win_geom,
|
||||
m->window_area_geom.position.x + mx + left_gap,
|
||||
m->window_area_geom.position.y + top_gap,
|
||||
w - 2 * border_width - left_gap - right_gap,
|
||||
|
@ -192,10 +192,10 @@ void horizontile(Monitor *m)
|
|||
border_width
|
||||
);
|
||||
|
||||
resize(c, client_geom, 0);
|
||||
resize(c, win_geom, 0);
|
||||
|
||||
const int total_width =
|
||||
client_geom_total_width(&c->state.geom);
|
||||
win_geom_total_width(&c->state.geom);
|
||||
|
||||
// FIXME: maybe need + left_gap + right_gap
|
||||
if (mx + total_width < m->window_area_geom.sizes.w) {
|
||||
|
@ -209,9 +209,9 @@ void horizontile(Monitor *m)
|
|||
const unsigned int right_gap = (i == n - 1) ? gap_size : bottom_right_half_gap;
|
||||
const unsigned int bottom_gap = gap_size;
|
||||
|
||||
struct ClientGeom client_geom;
|
||||
client_geom_init_from_args(
|
||||
&client_geom,
|
||||
struct WinGeom win_geom;
|
||||
win_geom_init_from_args(
|
||||
&win_geom,
|
||||
m->window_area_geom.position.x + tx + left_gap,
|
||||
m->window_area_geom.position.y + mh + top_gap,
|
||||
w - 2 * border_width - left_gap - right_gap,
|
||||
|
@ -219,10 +219,10 @@ void horizontile(Monitor *m)
|
|||
border_width
|
||||
);
|
||||
|
||||
resize(c, client_geom, 0);
|
||||
resize(c, win_geom, 0);
|
||||
|
||||
const int total_width =
|
||||
client_geom_total_width(&c->state.geom);
|
||||
win_geom_total_width(&c->state.geom);
|
||||
|
||||
// FIXME: maybe need + left_gap + right_gap
|
||||
if (tx + total_width < m->window_area_geom.sizes.w) {
|
||||
|
@ -245,9 +245,9 @@ void monocle(Monitor *m)
|
|||
const int border_width = helpers_border_width(1, is_fullscreen, any_is_fullscreen);
|
||||
|
||||
for (Client *c = nexttiled(m->clients); c; c = nexttiled(c->next)) {
|
||||
struct ClientGeom client_geom;
|
||||
client_geom_init_from_args(
|
||||
&client_geom,
|
||||
struct WinGeom win_geom;
|
||||
win_geom_init_from_args(
|
||||
&win_geom,
|
||||
m->window_area_geom.position.x + gap_size,
|
||||
m->window_area_geom.position.y + gap_size,
|
||||
m->window_area_geom.sizes.w - 2 * border_width - 2 * gap_size,
|
||||
|
@ -255,7 +255,7 @@ void monocle(Monitor *m)
|
|||
border_width
|
||||
);
|
||||
|
||||
resize(c, client_geom, 0);
|
||||
resize(c, win_geom, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -294,9 +294,9 @@ void tile(Monitor *m)
|
|||
const unsigned int right_gap = n <= m->nmaster ? gap_size : bottom_right_half_gap;
|
||||
const unsigned int bottom_gap = (i == m->nmaster - 1 || i == n - 1) ? gap_size : bottom_right_half_gap;
|
||||
|
||||
struct ClientGeom client_geom;
|
||||
client_geom_init_from_args(
|
||||
&client_geom,
|
||||
struct WinGeom win_geom;
|
||||
win_geom_init_from_args(
|
||||
&win_geom,
|
||||
m->window_area_geom.position.x + left_gap,
|
||||
m->window_area_geom.position.y + my + top_gap,
|
||||
mw - 2 * border_width - left_gap - right_gap,
|
||||
|
@ -304,10 +304,10 @@ void tile(Monitor *m)
|
|||
border_width
|
||||
);
|
||||
|
||||
resize(c, client_geom, 0);
|
||||
resize(c, win_geom, 0);
|
||||
|
||||
const int total_height =
|
||||
client_geom_total_height(&c->state.geom);
|
||||
win_geom_total_height(&c->state.geom);
|
||||
|
||||
// FIXME: maybe need + top_gap + bottom_gap
|
||||
if (my + total_height < m->window_area_geom.sizes.h) {
|
||||
|
@ -322,9 +322,9 @@ void tile(Monitor *m)
|
|||
const unsigned int right_gap = gap_size;
|
||||
const unsigned int bottom_gap = (i == n - 1) ? gap_size : bottom_right_half_gap;
|
||||
|
||||
struct ClientGeom client_geom;
|
||||
client_geom_init_from_args(
|
||||
&client_geom,
|
||||
struct WinGeom win_geom;
|
||||
win_geom_init_from_args(
|
||||
&win_geom,
|
||||
m->window_area_geom.position.x + mw + left_gap,
|
||||
m->window_area_geom.position.y + ty + top_gap,
|
||||
m->window_area_geom.sizes.w - mw - 2 * border_width - left_gap - right_gap,
|
||||
|
@ -332,10 +332,10 @@ void tile(Monitor *m)
|
|||
border_width
|
||||
);
|
||||
|
||||
resize(c, client_geom, 0);
|
||||
resize(c, win_geom, 0);
|
||||
|
||||
const int total_height =
|
||||
client_geom_total_height(&c->state.geom);
|
||||
win_geom_total_height(&c->state.geom);
|
||||
|
||||
// FIXME: maybe need + top_gap + bottom_gap
|
||||
if (ty + total_height < m->window_area_geom.sizes.h) {
|
||||
|
|
80
src/geom.c
80
src/geom.c
|
@ -25,11 +25,11 @@ struct BasicGeom basic_geom_create()
|
|||
return basic_geom;
|
||||
}
|
||||
|
||||
struct ClientGeom client_geom_create()
|
||||
struct WinGeom win_geom_create()
|
||||
{
|
||||
struct ClientGeom client_geom;
|
||||
client_geom_init(&client_geom);
|
||||
return client_geom;
|
||||
struct WinGeom win_geom;
|
||||
win_geom_init(&win_geom);
|
||||
return win_geom;
|
||||
}
|
||||
|
||||
/**************************
|
||||
|
@ -54,10 +54,10 @@ void basic_geom_init(const BasicGeom basic_geom)
|
|||
sizes_init(&basic_geom->sizes);
|
||||
}
|
||||
|
||||
void client_geom_init(const ClientGeom client_geom)
|
||||
void win_geom_init(const WinGeom win_geom)
|
||||
{
|
||||
basic_geom_init(&client_geom->basic);
|
||||
client_geom->border_width = 0;
|
||||
basic_geom_init(&win_geom->basic);
|
||||
win_geom->border_width = 0;
|
||||
}
|
||||
|
||||
/*****************************
|
||||
|
@ -89,16 +89,16 @@ struct BasicGeom basic_geom_create_from_args(
|
|||
return basic_geom;
|
||||
}
|
||||
|
||||
struct ClientGeom client_geom_create_from_args(
|
||||
struct WinGeom win_geom_create_from_args(
|
||||
const int x,
|
||||
const int y,
|
||||
const int width,
|
||||
const int height,
|
||||
const int border_width
|
||||
) {
|
||||
struct ClientGeom client_geom;
|
||||
client_geom_init_from_args(&client_geom, x, y, width, height, border_width);
|
||||
return client_geom;
|
||||
struct WinGeom win_geom;
|
||||
win_geom_init_from_args(&win_geom, x, y, width, height, border_width);
|
||||
return win_geom;
|
||||
}
|
||||
|
||||
/***************************
|
||||
|
@ -128,66 +128,66 @@ void basic_geom_init_from_args(
|
|||
sizes_init_from_args(&basic_geom->sizes, width, height);
|
||||
}
|
||||
|
||||
void client_geom_init_from_args(
|
||||
const ClientGeom client_geom,
|
||||
void win_geom_init_from_args(
|
||||
const WinGeom win_geom,
|
||||
const int x,
|
||||
const int y,
|
||||
const int width,
|
||||
const int height,
|
||||
const int border_width
|
||||
) {
|
||||
basic_geom_init_from_args(&client_geom->basic, x, y, width, height);
|
||||
client_geom->border_width = border_width;
|
||||
basic_geom_init_from_args(&win_geom->basic, x, y, width, height);
|
||||
win_geom->border_width = border_width;
|
||||
}
|
||||
|
||||
/************************
|
||||
* Conversion functions *
|
||||
************************/
|
||||
|
||||
void client_geom_convert_to_x_window_changes(
|
||||
const struct ClientGeom *const client_geom,
|
||||
void win_geom_convert_to_x_window_changes(
|
||||
const struct WinGeom *const win_geom,
|
||||
XWindowChanges *const x_window_changes
|
||||
) {
|
||||
x_window_changes->x = client_geom->basic.position.x;
|
||||
x_window_changes->y = client_geom->basic.position.y;
|
||||
x_window_changes->width = client_geom->basic.sizes.w;
|
||||
x_window_changes->height = client_geom->basic.sizes.h;
|
||||
x_window_changes->border_width = client_geom->border_width;
|
||||
x_window_changes->x = win_geom->basic.position.x;
|
||||
x_window_changes->y = win_geom->basic.position.y;
|
||||
x_window_changes->width = win_geom->basic.sizes.w;
|
||||
x_window_changes->height = win_geom->basic.sizes.h;
|
||||
x_window_changes->border_width = win_geom->border_width;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* Constant functions *
|
||||
**********************/
|
||||
|
||||
int client_geom_total_width(
|
||||
const struct ClientGeom *const client_geom
|
||||
int win_geom_total_width(
|
||||
const struct WinGeom *const win_geom
|
||||
) {
|
||||
return client_geom->basic.sizes.w + 2 * client_geom->border_width;
|
||||
return win_geom->basic.sizes.w + 2 * win_geom->border_width;
|
||||
}
|
||||
|
||||
int client_geom_total_height(
|
||||
const struct ClientGeom *const client_geom
|
||||
int win_geom_total_height(
|
||||
const struct WinGeom *const win_geom
|
||||
) {
|
||||
return client_geom->basic.sizes.h + 2 * client_geom->border_width;
|
||||
return win_geom->basic.sizes.h + 2 * win_geom->border_width;
|
||||
}
|
||||
|
||||
/***********************
|
||||
* Modifying functions *
|
||||
***********************/
|
||||
|
||||
void client_geom_adjust_to_boundary(
|
||||
const ClientGeom client_geom,
|
||||
void win_geom_adjust_to_boundary(
|
||||
const WinGeom win_geom,
|
||||
const struct BasicGeom *const boundary_geom
|
||||
) {
|
||||
const int total_width = client_geom_total_width(client_geom);
|
||||
const int total_height = client_geom_total_height(client_geom);
|
||||
const int total_width = win_geom_total_width(win_geom);
|
||||
const int total_height = win_geom_total_height(win_geom);
|
||||
|
||||
if (
|
||||
client_geom->basic.position.x + total_width
|
||||
win_geom->basic.position.x + total_width
|
||||
>
|
||||
boundary_geom->position.x + boundary_geom->sizes.w
|
||||
) {
|
||||
client_geom->basic.position.x =
|
||||
win_geom->basic.position.x =
|
||||
boundary_geom->position.x
|
||||
+
|
||||
boundary_geom->sizes.w
|
||||
|
@ -196,11 +196,11 @@ void client_geom_adjust_to_boundary(
|
|||
}
|
||||
|
||||
if (
|
||||
client_geom->basic.position.y + total_height
|
||||
win_geom->basic.position.y + total_height
|
||||
>
|
||||
boundary_geom->position.y + boundary_geom->sizes.h
|
||||
) {
|
||||
client_geom->basic.position.y =
|
||||
win_geom->basic.position.y =
|
||||
boundary_geom->position.y
|
||||
+
|
||||
boundary_geom->sizes.h
|
||||
|
@ -208,11 +208,11 @@ void client_geom_adjust_to_boundary(
|
|||
total_height;
|
||||
}
|
||||
|
||||
if (client_geom->basic.position.x < boundary_geom->position.x) {
|
||||
client_geom->basic.position.x = boundary_geom->position.x;
|
||||
if (win_geom->basic.position.x < boundary_geom->position.x) {
|
||||
win_geom->basic.position.x = boundary_geom->position.x;
|
||||
}
|
||||
|
||||
if (client_geom->basic.position.y < boundary_geom->position.y) {
|
||||
client_geom->basic.position.y = boundary_geom->position.y;
|
||||
if (win_geom->basic.position.y < boundary_geom->position.y) {
|
||||
win_geom->basic.position.y = boundary_geom->position.y;
|
||||
}
|
||||
}
|
||||
|
|
32
src/geom.h
32
src/geom.h
|
@ -7,10 +7,10 @@
|
|||
* Pointer types *
|
||||
*****************/
|
||||
|
||||
typedef struct Position *Position;
|
||||
typedef struct Sizes *Sizes;
|
||||
typedef struct BasicGeom *BasicGeom;
|
||||
typedef struct ClientGeom *ClientGeom;
|
||||
typedef struct Position *Position;
|
||||
typedef struct Sizes *Sizes;
|
||||
typedef struct BasicGeom *BasicGeom;
|
||||
typedef struct WinGeom *WinGeom;
|
||||
|
||||
/**************
|
||||
* Structures *
|
||||
|
@ -29,7 +29,7 @@ struct BasicGeom {
|
|||
struct Sizes sizes;
|
||||
};
|
||||
|
||||
struct ClientGeom {
|
||||
struct WinGeom {
|
||||
struct BasicGeom basic;
|
||||
int border_width;
|
||||
};
|
||||
|
@ -41,7 +41,7 @@ struct ClientGeom {
|
|||
struct Position position_create();
|
||||
struct Sizes sizes_create();
|
||||
struct BasicGeom basic_geom_create();
|
||||
struct ClientGeom client_geom_create();
|
||||
struct WinGeom win_geom_create();
|
||||
|
||||
/**************************
|
||||
* Default init functions *
|
||||
|
@ -50,7 +50,7 @@ struct ClientGeom client_geom_create();
|
|||
void position_init(Position position);
|
||||
void sizes_init(Sizes sizes);
|
||||
void basic_geom_init(BasicGeom basic_geom);
|
||||
void client_geom_init(ClientGeom client_geom);
|
||||
void win_geom_init(WinGeom win_geom);
|
||||
|
||||
/*****************************
|
||||
* Argument create functions *
|
||||
|
@ -66,7 +66,7 @@ struct BasicGeom basic_geom_create_from_args(
|
|||
int height
|
||||
);
|
||||
|
||||
struct ClientGeom client_geom_create_from_args(
|
||||
struct WinGeom win_geom_create_from_args(
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
|
@ -89,8 +89,8 @@ void basic_geom_init_from_args(
|
|||
int height
|
||||
);
|
||||
|
||||
void client_geom_init_from_args(
|
||||
ClientGeom client_geom,
|
||||
void win_geom_init_from_args(
|
||||
WinGeom win_geom,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
|
@ -102,8 +102,8 @@ void client_geom_init_from_args(
|
|||
* Conversion functions *
|
||||
************************/
|
||||
|
||||
void client_geom_convert_to_x_window_changes(
|
||||
const struct ClientGeom *client_geom,
|
||||
void win_geom_convert_to_x_window_changes(
|
||||
const struct WinGeom *win_geom,
|
||||
XWindowChanges *x_window_changes
|
||||
);
|
||||
|
||||
|
@ -111,15 +111,15 @@ void client_geom_convert_to_x_window_changes(
|
|||
* Constant functions *
|
||||
**********************/
|
||||
|
||||
int client_geom_total_width(const struct ClientGeom *client_geom);
|
||||
int client_geom_total_height(const struct ClientGeom *client_geom);
|
||||
int win_geom_total_width(const struct WinGeom *win_geom);
|
||||
int win_geom_total_height(const struct WinGeom *win_geom);
|
||||
|
||||
/***********************
|
||||
* Modifying functions *
|
||||
***********************/
|
||||
|
||||
void client_geom_adjust_to_boundary(
|
||||
ClientGeom client_geom,
|
||||
void win_geom_adjust_to_boundary(
|
||||
WinGeom win_geom,
|
||||
const struct BasicGeom *boundary_geom
|
||||
);
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ void client_size_hints_init(const ClientSizeHints client_size_hints)
|
|||
void client_state_init(const ClientState client_state)
|
||||
{
|
||||
memset(client_state->name, 0, sizeof(client_state->name));
|
||||
client_geom_init(&client_state->geom);
|
||||
win_geom_init(&client_state->geom);
|
||||
client_state->is_fixed = false;
|
||||
client_state->is_floating = false;
|
||||
client_state->is_urgent = false;
|
||||
|
|
|
@ -23,7 +23,7 @@ struct ClientSizeHints {
|
|||
|
||||
struct ClientState {
|
||||
char name[256];
|
||||
struct ClientGeom geom;
|
||||
struct WinGeom geom;
|
||||
bool is_fixed, is_floating, is_urgent, never_focus, is_fullscreen;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue