[digesting_libdecor] eliminate a bunch of return-spaghetti, eliminate a bunch of reducible functions

main
Allen Webster 2026-02-27 19:12:48 -08:00
parent e556f5aa26
commit e27aa9edbe
2 changed files with 624 additions and 980 deletions

File diff suppressed because it is too large Load Diff

View File

@ -50,6 +50,15 @@
#define STREQL(a,b) (((a)==0 && (b)==0) || \
((a)!=0 && (b)!=0 && strcmp((a),(b))==0))
// mine
typedef struct Extent2D{
int x;
int y;
int w;
int h;
} Extent2D;
// libdecor.h
struct libdecor_configuration;
@ -275,11 +284,7 @@ enum titlebar_gesture {
// libdecor.h
void libdecor_frame_unref(void);
void libdecor_frame_set_visibility(bool visible);
void libdecor_frame_set_title(const char *title);
void libdecor_frame_set_app_id(const char *app_id);
void libdecor_frame_show_window_menu(struct wl_seat *wl_seat, uint32_t serial, int x, int y);
void libdecor_frame_popup_grab(const char *seat_name);
@ -295,7 +300,6 @@ bool libdecor_frame_is_floating(void);
void libdecor_frame_map(void);
bool libdecor_configuration_get_content_size(struct libdecor_configuration *configuration, int *width, int *height);
bool libdecor_configuration_get_window_state(struct libdecor_configuration *configuration, enum libdecor_window_state *window_state);
int libdecor_dispatch(int timeout);
@ -318,8 +322,6 @@ int libdecor_os_create_anonymous_file(off_t size);
static void init_shell_surface(void);
static void set_capabilities(const enum libdecor_capabilities new_capabilities);
static void do_map(void);
//#include "plugins/gtk/libdecor-gtk.c"
@ -329,6 +331,8 @@ static void init_wl_output( uint32_t id, uint32_t version);
static void output_removed(struct output *output);
static void draw_header_button(cairo_t *cr, cairo_surface_t *surface, enum header_element button_type);
static const char *libdecor_gtk_proxy_tag = "libdecor-gtk";
static int libdecor_plugin_gtk_dispatch(int timeout);
@ -337,7 +341,7 @@ static void libdecor_plugin_gtk_frame_free(void);
static void libdecor_plugin_gtk_frame_commit(struct libdecor_state *state, struct libdecor_configuration *configuration);
static void libdecor_plugin_gtk_frame_popup_grab(const char *seat_name);
static void libdecor_plugin_gtk_frame_popup_ungrab(const char *seat_name);
static bool libdecor_plugin_gtk_frame_get_border_size(struct libdecor_configuration *configuration, int *left, int *right, int *top, int *bottom);
static void libdecor_plugin_gtk_frame_get_border_size(enum libdecor_window_state window_state, int *left, int *right, int *top, int *bottom);
static void draw_decoration(void);
@ -359,7 +363,6 @@ typedef struct Ctx{
struct zxdg_decoration_manager_v1 *decoration_manager;
struct wl_callback *wl_callback;
struct wl_list visible_frame_list;
struct wl_list seat_list;
struct wl_list output_list;
@ -389,7 +392,6 @@ typedef struct Ctx{
struct libdecor_configuration cached_config;
//struct libdecor_frame_private;
char *app_id;
char *title;
struct libdecor_limits content_limits;
struct xdg_toplevel *parent;
@ -423,7 +425,6 @@ typedef struct Ctx{
struct border_component *active;
struct border_component *touch_active;
struct border_component *focus;
struct border_component *grab;