polytreewm/src/state.h

89 lines
1.9 KiB
C
Raw Normal View History

2021-11-20 19:34:34 +00:00
#ifndef _STATE_H
#define _STATE_H
2021-12-04 17:14:07 +00:00
#include "geom.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 20:27:23 +00:00
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 *
**************/
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
};
2021-11-21 00:32:59 +00:00
/**************************
* Default init functions *
**************************/
2021-11-20 20:16:53 +00:00
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-21 00:32:59 +00:00
/***************************
* Argument init functions *
***************************/
2021-11-20 22:49:19 +00:00
void client_geometry_init_from_args(
ClientGeometry client_geometry,
int x,
int y,
int width,
int height,
int border_width
);
2021-11-21 00:32:59 +00:00
/************************
* Conversion functions *
************************/
2021-11-20 22:49:19 +00:00
2021-11-21 00:32:59 +00:00
void client_geometry_convert_to_x_window_changes(
2021-11-20 22:49:19 +00:00
const struct ClientGeometry *client_geometry,
XWindowChanges *x_window_changes
);
2021-11-21 00:32:59 +00:00
/**********************
* Constant functions *
**********************/
int client_geometry_total_width(const struct ClientGeometry *client_geometry);
int client_geometry_total_height(const struct ClientGeometry *client_geometry);
/***********************
* Modifying functions *
***********************/
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