/* * DWN - Desktop Window Manager * retoor * Main header with shared types and global state */ #ifndef DWN_H #define DWN_H #include #include #include #include #include #include #include #include /* Version */ #define DWN_VERSION "1.0.0" #define DWN_NAME "DWN" /* Limits */ #define MAX_CLIENTS 256 #define MAX_WORKSPACES 9 #define MAX_MONITORS 8 #define MAX_NOTIFICATIONS 32 #define MAX_KEYBINDINGS 64 /* Default dimensions */ #define DEFAULT_BORDER_WIDTH 2 #define DEFAULT_TITLE_HEIGHT 24 #define DEFAULT_PANEL_HEIGHT 28 #define DEFAULT_GAP 4 /* Common error/status codes */ typedef enum { DWN_OK = 0, DWN_ERROR = -1, DWN_ERROR_INVALID_ARG = -2, DWN_ERROR_NO_MEMORY = -3, DWN_ERROR_NOT_FOUND = -4, DWN_ERROR_DISPLAY = -5, DWN_ERROR_IO = -6 } DwnStatus; /* Layout types */ typedef enum { LAYOUT_TILING, LAYOUT_FLOATING, LAYOUT_MONOCLE, LAYOUT_COUNT } LayoutType; /* Focus modes */ typedef enum { FOCUS_CLICK, FOCUS_FOLLOW } FocusMode; /* Client state flags */ typedef enum { CLIENT_NORMAL = 0, CLIENT_FLOATING = (1 << 0), CLIENT_FULLSCREEN = (1 << 1), CLIENT_URGENT = (1 << 2), CLIENT_MINIMIZED = (1 << 3), CLIENT_STICKY = (1 << 4) } ClientFlags; /* Forward declarations */ typedef struct Client Client; typedef struct Workspace Workspace; typedef struct Monitor Monitor; typedef struct Panel Panel; typedef struct Config Config; /* Client structure - represents a managed window */ struct Client { Window window; /* Application window */ Window frame; /* Frame window (decoration) */ int x, y; /* Position */ int width, height; /* Size */ int old_x, old_y; /* Previous position (for floating restore) */ int old_width, old_height; int border_width; uint32_t flags; /* ClientFlags bitmask */ unsigned int workspace; /* Current workspace (0-8) */ char title[256]; /* Window title */ char class[64]; /* Window class */ Client *next; /* Linked list */ Client *prev; }; /* Monitor structure - represents a physical display */ struct Monitor { int x, y; int width, height; int index; bool primary; }; /* Workspace structure */ struct Workspace { Client *clients; /* Head of client list */ Client *focused; /* Currently focused client */ LayoutType layout; /* Current layout */ float master_ratio; /* Ratio for master area in tiling */ int master_count; /* Number of windows in master area */ char name[32]; /* Workspace name */ }; /* Panel widget types */ typedef enum { WIDGET_WORKSPACES, WIDGET_TASKBAR, WIDGET_CLOCK, WIDGET_SYSTRAY, WIDGET_AI_STATUS, WIDGET_SEPARATOR } WidgetType; /* Global state - singleton pattern */ typedef struct { Display *display; int screen; Window root; int screen_width; int screen_height; /* Monitors */ Monitor monitors[MAX_MONITORS]; int monitor_count; /* Workspaces */ Workspace workspaces[MAX_WORKSPACES]; int current_workspace; /* Clients */ Client *client_list; /* All clients */ int client_count; /* Panels */ Panel *top_panel; Panel *bottom_panel; /* Configuration */ Config *config; /* State */ bool running; bool ai_enabled; /* Graphics contexts */ GC gc; XFontStruct *font; XftFont *xft_font; /* Xft font for UTF-8 rendering */ Colormap colormap; /* Drag state */ Client *drag_client; int drag_start_x, drag_start_y; int drag_orig_x, drag_orig_y; int drag_orig_w, drag_orig_h; bool resizing; } DWNState; /* Global state accessor */ extern DWNState *dwn; /* Core functions */ int dwn_init(void); void dwn_cleanup(void); void dwn_run(void); void dwn_quit(void); /* Event handlers */ void dwn_handle_event(XEvent *ev); #endif /* DWN_H */