50 lines
1.3 KiB
C
Raw Normal View History

2025-12-28 03:14:31 +01:00
/*
* DWN - Desktop Window Manager
* retoor <retoor@molodetz.nl>
2025-12-28 03:14:31 +01:00
* Window decorations (title bars, borders, buttons)
*/
#ifndef DWN_DECORATIONS_H
#define DWN_DECORATIONS_H
#include "dwn.h"
#include <stdbool.h>
/* Button types */
typedef enum {
BUTTON_CLOSE,
BUTTON_MAXIMIZE,
BUTTON_MINIMIZE,
BUTTON_COUNT
} ButtonType;
/* Button areas for hit testing */
typedef struct {
int x, y;
int width, height;
} ButtonArea;
/* Decoration initialization */
void decorations_init(void);
void decorations_cleanup(void);
/* Rendering */
void decorations_render(Client *client, bool focused);
void decorations_render_title_bar(Client *client, bool focused);
void decorations_render_buttons(Client *client, bool focused);
void decorations_render_border(Client *client, bool focused);
/* Hit testing */
ButtonType decorations_hit_test_button(Client *client, int x, int y);
bool decorations_hit_test_title_bar(Client *client, int x, int y);
bool decorations_hit_test_resize_area(Client *client, int x, int y, int *direction);
/* Button actions */
void decorations_button_press(Client *client, ButtonType button);
/* Text rendering */
void decorations_draw_text(Window window, GC gc, int x, int y,
const char *text, unsigned long color);
#endif /* DWN_DECORATIONS_H */