polytreewm/src/state.h

76 lines
1.6 KiB
C
Raw Normal View History

2021-11-20 19:34:34 +00:00
#ifndef _STATE_H
#define _STATE_H
2021-11-20 20:01:49 +00:00
#include <stdbool.h>
2021-11-20 19:48:37 +00:00
#include <X11/Xutil.h>
2021-11-20 20:22:36 +00:00
/*****************
* Pointer types *
*****************/
2021-11-20 19:34:34 +00:00
2021-11-20 21:44:01 +00:00
typedef struct Position *Position;
2021-11-20 21:56:08 +00:00
typedef struct Sizes *Sizes;
2021-11-20 20:27:23 +00:00
typedef struct BasicGeometry *BasicGeometry;
typedef struct ClientGeometry *ClientGeometry;
2021-11-20 20:22:36 +00:00
typedef struct ClientSizeHints *ClientSizeHints;
2021-11-20 20:27:23 +00:00
typedef struct ClientState *ClientState;
2021-11-20 20:22:36 +00:00
/**************
* Structures *
**************/
2021-11-20 21:44:01 +00:00
struct Position {
int x, y;
};
2021-11-20 21:56:08 +00:00
struct Sizes {
int w, h;
};
2021-11-20 21:44:01 +00:00
struct BasicGeometry {
struct Position position;
2021-11-20 21:56:08 +00:00
struct Sizes sizes;
2021-11-20 21:44:01 +00:00
};
2021-11-20 20:22:36 +00:00
struct ClientGeometry {
2021-11-20 19:34:34 +00:00
struct BasicGeometry basic;
2021-11-20 20:25:56 +00:00
int border_width;
2021-11-20 20:22:36 +00:00
};
2021-11-20 19:34:34 +00:00
2021-11-20 20:22:36 +00:00
struct ClientSizeHints {
2021-11-20 19:34:34 +00:00
float mina, maxa;
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
2021-11-20 20:22:36 +00:00
};
2021-11-20 19:34:34 +00:00
2021-11-20 20:22:36 +00:00
struct ClientState {
2021-11-20 19:34:34 +00:00
char name[256];
struct ClientGeometry geometry;
2021-11-20 20:01:49 +00:00
bool is_fixed, is_floating, is_urgent, never_focus, is_fullscreen;
2021-11-20 20:22:36 +00:00
};
/*************
* Functions *
*************/
2021-11-20 20:16:53 +00:00
2021-11-20 21:44:01 +00:00
void position_init(Position position);
2021-11-20 21:56:08 +00:00
void sizes_init(Sizes sizes);
2021-11-20 20:16:53 +00:00
void basic_geometry_init(BasicGeometry basic_geometry);
void client_geometry_init(ClientGeometry client_geometry);
void client_size_hints_init(ClientSizeHints client_size_hints);
void client_state_init(ClientState client_state);
2021-11-20 19:34:34 +00:00
2021-11-20 21:00:39 +00:00
int client_geometry_total_width(const struct ClientGeometry *client_geometry);
int client_geometry_total_height(const struct ClientGeometry *client_geometry);
void client_geometry_adjust_to_boundary(
ClientGeometry client_geometry,
const struct BasicGeometry *boundary_geometry
);
2021-11-20 19:48:37 +00:00
void client_size_hints_update(
ClientSizeHints size_hints,
const XSizeHints *size
);
2021-11-20 19:34:34 +00:00
#endif // _STATE_H