2021-12-04 17:14:07 +00:00
|
|
|
#ifndef _GEOM_H
|
|
|
|
#define _GEOM_H
|
|
|
|
|
2021-12-04 17:39:08 +00:00
|
|
|
#include <X11/Xutil.h>
|
|
|
|
|
2021-12-04 17:14:07 +00:00
|
|
|
/*****************
|
|
|
|
* Pointer types *
|
|
|
|
*****************/
|
|
|
|
|
2021-12-04 17:44:06 +00:00
|
|
|
typedef struct Position *Position;
|
|
|
|
typedef struct Sizes *Sizes;
|
|
|
|
typedef struct BasicGeom *BasicGeom;
|
|
|
|
typedef struct WinGeom *WinGeom;
|
2021-12-04 17:14:07 +00:00
|
|
|
|
|
|
|
/**************
|
|
|
|
* Structures *
|
|
|
|
**************/
|
|
|
|
|
|
|
|
struct Position {
|
|
|
|
int x, y;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Sizes {
|
|
|
|
int w, h;
|
|
|
|
};
|
|
|
|
|
2021-12-04 17:26:32 +00:00
|
|
|
struct BasicGeom {
|
2021-12-04 17:14:07 +00:00
|
|
|
struct Position position;
|
|
|
|
struct Sizes sizes;
|
|
|
|
};
|
|
|
|
|
2021-12-04 17:44:06 +00:00
|
|
|
struct WinGeom {
|
2021-12-04 17:39:08 +00:00
|
|
|
struct BasicGeom basic;
|
|
|
|
int border_width;
|
|
|
|
};
|
|
|
|
|
2021-12-04 17:14:07 +00:00
|
|
|
/****************************
|
|
|
|
* Default create functions *
|
|
|
|
****************************/
|
|
|
|
|
|
|
|
struct Position position_create();
|
|
|
|
struct Sizes sizes_create();
|
2021-12-04 17:26:32 +00:00
|
|
|
struct BasicGeom basic_geom_create();
|
2021-12-04 17:44:06 +00:00
|
|
|
struct WinGeom win_geom_create();
|
2021-12-04 17:14:07 +00:00
|
|
|
|
|
|
|
/**************************
|
|
|
|
* Default init functions *
|
|
|
|
**************************/
|
|
|
|
|
|
|
|
void position_init(Position position);
|
|
|
|
void sizes_init(Sizes sizes);
|
2021-12-04 17:26:32 +00:00
|
|
|
void basic_geom_init(BasicGeom basic_geom);
|
2021-12-04 17:44:06 +00:00
|
|
|
void win_geom_init(WinGeom win_geom);
|
2021-12-04 17:14:07 +00:00
|
|
|
|
|
|
|
/*****************************
|
|
|
|
* Argument create functions *
|
|
|
|
*****************************/
|
|
|
|
|
|
|
|
struct Position position_create_from_args(int x, int y);
|
|
|
|
struct Sizes sizes_create_from_args(int width, int height);
|
|
|
|
|
2021-12-04 17:26:32 +00:00
|
|
|
struct BasicGeom basic_geom_create_from_args(
|
2021-12-04 17:14:07 +00:00
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
int width,
|
|
|
|
int height
|
|
|
|
);
|
|
|
|
|
2021-12-04 17:44:06 +00:00
|
|
|
struct WinGeom win_geom_create_from_args(
|
2021-12-04 17:39:08 +00:00
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
int width,
|
|
|
|
int height,
|
|
|
|
int border_width
|
|
|
|
);
|
|
|
|
|
2021-12-04 17:14:07 +00:00
|
|
|
/***************************
|
|
|
|
* Argument init functions *
|
|
|
|
***************************/
|
|
|
|
|
|
|
|
void position_init_from_args(Position position, int x, int y);
|
|
|
|
void sizes_init_from_args(Sizes sizes, int width, int height);
|
|
|
|
|
2021-12-04 17:26:32 +00:00
|
|
|
void basic_geom_init_from_args(
|
|
|
|
BasicGeom basic_geom,
|
2021-12-04 17:14:07 +00:00
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
int width,
|
|
|
|
int height
|
|
|
|
);
|
|
|
|
|
2021-12-04 17:44:06 +00:00
|
|
|
void win_geom_init_from_args(
|
|
|
|
WinGeom win_geom,
|
2021-12-04 17:39:08 +00:00
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
int width,
|
|
|
|
int height,
|
|
|
|
int border_width
|
|
|
|
);
|
|
|
|
|
|
|
|
/************************
|
|
|
|
* Conversion functions *
|
|
|
|
************************/
|
|
|
|
|
2021-12-04 17:44:06 +00:00
|
|
|
void win_geom_convert_to_x_window_changes(
|
|
|
|
const struct WinGeom *win_geom,
|
2021-12-04 17:39:08 +00:00
|
|
|
XWindowChanges *x_window_changes
|
|
|
|
);
|
|
|
|
|
|
|
|
/**********************
|
|
|
|
* Constant functions *
|
|
|
|
**********************/
|
|
|
|
|
2021-12-04 17:44:06 +00:00
|
|
|
int win_geom_total_width(const struct WinGeom *win_geom);
|
|
|
|
int win_geom_total_height(const struct WinGeom *win_geom);
|
2021-12-04 17:39:08 +00:00
|
|
|
|
|
|
|
/***********************
|
|
|
|
* Modifying functions *
|
|
|
|
***********************/
|
|
|
|
|
2021-12-04 17:44:06 +00:00
|
|
|
void win_geom_adjust_to_boundary(
|
|
|
|
WinGeom win_geom,
|
2021-12-04 17:39:08 +00:00
|
|
|
const struct BasicGeom *boundary_geom
|
|
|
|
);
|
|
|
|
|
2021-12-04 17:14:07 +00:00
|
|
|
#endif // _GEOM_H
|