[digesting_libdecor] move plugin_gtk fields into my context

main
Allen Webster 2026-02-26 14:34:29 -08:00
parent edb01d0014
commit 6fed08cea3
2 changed files with 109 additions and 119 deletions

View File

@ -111,13 +111,13 @@ wlevent__wl_registry_global(void *data, struct wl_registry *wl_registry,
ctx.decoration_manager = wl_registry_bind(wl_registry, name, &zxdg_decoration_manager_v1_interface, MIN(version,2)); ctx.decoration_manager = wl_registry_bind(wl_registry, name, &zxdg_decoration_manager_v1_interface, MIN(version,2));
} }
else if (strcmp(interface, "wl_subcompositor") == 0){ else if (strcmp(interface, "wl_subcompositor") == 0){
ctx.plugin_gtk->wl_subcompositor = ctx.wl_subcompositor =
wl_registry_bind(ctx.wl_registry, name, &wl_subcompositor_interface, 1); wl_registry_bind(ctx.wl_registry, name, &wl_subcompositor_interface, 1);
} }
else if (strcmp(interface, "wl_shm") == 0){ else if (strcmp(interface, "wl_shm") == 0){
ctx.plugin_gtk->wl_shm = ctx.wl_shm =
wl_registry_bind(ctx.wl_registry, name, &wl_shm_interface, 1); wl_registry_bind(ctx.wl_registry, name, &wl_shm_interface, 1);
wl_shm_add_listener(ctx.plugin_gtk->wl_shm, &shm_listener, ctx.plugin_gtk); wl_shm_add_listener(ctx.wl_shm, &shm_listener, ctx.plugin_gtk);
} }
else if (strcmp(interface, "wl_seat") == 0){ else if (strcmp(interface, "wl_seat") == 0){
struct seat *seat; struct seat *seat;
@ -130,7 +130,7 @@ wlevent__wl_registry_global(void *data, struct wl_registry *wl_registry,
seat->cursor_scale = 1; seat->cursor_scale = 1;
seat->plugin_gtk = ctx.plugin_gtk; seat->plugin_gtk = ctx.plugin_gtk;
wl_list_init(&seat->cursor_outputs); wl_list_init(&seat->cursor_outputs);
wl_list_insert(&ctx.plugin_gtk->seat_list, &seat->link); wl_list_insert(&ctx.seat_list, &seat->link);
seat->wl_seat = wl_registry_bind(ctx.wl_registry, name, &wl_seat_interface, 3); seat->wl_seat = wl_registry_bind(ctx.wl_registry, name, &wl_seat_interface, 3);
wl_seat_add_listener(seat->wl_seat, &seat_listener, seat); wl_seat_add_listener(seat->wl_seat, &seat_listener, seat);
} }
@ -143,7 +143,7 @@ wlevent__wl_registry_global(void *data, struct wl_registry *wl_registry,
output = calloc(1, sizeof *output); output = calloc(1, sizeof *output);
output->plugin_gtk = ctx.plugin_gtk; output->plugin_gtk = ctx.plugin_gtk;
wl_list_insert(&ctx.plugin_gtk->output_list, &output->link); wl_list_insert(&ctx.output_list, &output->link);
output->id = name; output->id = name;
output->wl_output = wl_registry_bind(ctx.wl_registry, name, &wl_output_interface, MIN(version, 3)); output->wl_output = wl_registry_bind(ctx.wl_registry, name, &wl_output_interface, MIN(version, 3));
wl_proxy_set_tag((struct wl_proxy *)output->wl_output, wl_proxy_set_tag((struct wl_proxy *)output->wl_output,
@ -156,7 +156,7 @@ static void
wlevent__wl_registry_global_remove(void *data, struct wl_registry *registry, wlevent__wl_registry_global_remove(void *data, struct wl_registry *registry,
uint32_t name){ uint32_t name){
struct output *output; struct output *output;
wl_list_for_each(output, &ctx.plugin_gtk->output_list, link){ wl_list_for_each(output, &ctx.output_list, link){
if (output->id == name){ if (output->id == name){
output_removed(output); output_removed(output);
break; break;
@ -219,9 +219,8 @@ libdecorevent__frame_bounds(struct libdecor_frame *frame,
static void static void
shm_format(void *user_data, struct wl_shm *wl_shm, uint32_t format){ shm_format(void *user_data, struct wl_shm *wl_shm, uint32_t format){
struct libdecor_plugin_gtk *plugin_gtk = user_data;
if (format == WL_SHM_FORMAT_ARGB8888){ if (format == WL_SHM_FORMAT_ARGB8888){
plugin_gtk->has_argb = true; ctx.has_argb = true;
} }
} }
@ -244,7 +243,7 @@ init_wl_display_callback(void *user_data,
finish_init(); finish_init();
} }
if (ctx.plugin_gtk->has_argb){ if (ctx.has_argb){
libdecor_notify_plugin_ready(); libdecor_notify_plugin_ready();
} }
} }
@ -330,9 +329,9 @@ int main(){
wl_list_init(&ctx.frames); wl_list_init(&ctx.frames);
wl_list_init(&ctx.plugin_gtk->visible_frame_list); wl_list_init(&ctx.visible_frame_list);
wl_list_init(&ctx.plugin_gtk->seat_list); wl_list_init(&ctx.seat_list);
wl_list_init(&ctx.plugin_gtk->output_list); wl_list_init(&ctx.output_list);
} }
if (gtk_init_success){ if (gtk_init_success){
@ -357,17 +356,17 @@ int main(){
if (ctx.wl_compositor == 0){ if (ctx.wl_compositor == 0){
printf("failed to get wl_compositor\n"); printf("failed to get wl_compositor\n");
} }
if (ctx.plugin_gtk->wl_subcompositor == 0){ if (ctx.wl_subcompositor == 0){
printf("failed to get wl_subcompositor\n"); printf("failed to get wl_subcompositor\n");
} }
if (ctx.plugin_gtk->wl_shm == 0){ if (ctx.wl_shm == 0){
printf("failed to get wl_shm\n"); printf("failed to get wl_shm\n");
} }
} }
if (ctx.wl_compositor != 0 && if (ctx.wl_compositor != 0 &&
ctx.plugin_gtk->wl_subcompositor != 0 && ctx.wl_subcompositor != 0 &&
ctx.plugin_gtk->wl_shm != 0){ ctx.wl_shm != 0){
ctx.wl_callback = wl_display_sync(ctx.wl_display); ctx.wl_callback = wl_display_sync(ctx.wl_display);
wl_callback_add_listener(ctx.wl_callback, wl_callback_add_listener(ctx.wl_callback,
&init_wl_display_callback_listener, &init_wl_display_callback_listener,
@ -1927,6 +1926,9 @@ cleanup(void){
if (ctx.plugin != 0){ if (ctx.plugin != 0){
ctx.plugin->priv->iface->destroy(ctx.plugin); ctx.plugin->priv->iface->destroy(ctx.plugin);
} }
if (ctx.wl_subcompositor != 0){
wl_subcompositor_destroy(ctx.wl_subcompositor);
}
if (ctx.wl_callback != 0){ if (ctx.wl_callback != 0){
wl_callback_destroy(ctx.wl_callback); wl_callback_destroy(ctx.wl_callback);
} }
@ -2628,7 +2630,7 @@ libdecor_plugin_gtk_destroy(struct libdecor_plugin *plugin)
struct output *output, *output_tmp; struct output *output, *output_tmp;
struct libdecor_frame_gtk *frame, *frame_tmp; struct libdecor_frame_gtk *frame, *frame_tmp;
wl_list_for_each_safe(seat, seat_tmp, &plugin_gtk->seat_list, link) { wl_list_for_each_safe(seat, seat_tmp, &ctx.seat_list, link) {
struct cursor_output *cursor_output, *tmp; struct cursor_output *cursor_output, *tmp;
if (seat->wl_pointer) if (seat->wl_pointer)
@ -2651,7 +2653,7 @@ libdecor_plugin_gtk_destroy(struct libdecor_plugin *plugin)
} }
wl_list_for_each_safe(output, output_tmp, wl_list_for_each_safe(output, output_tmp,
&plugin_gtk->output_list, link) { &ctx.output_list, link) {
if (wl_output_get_version (output->wl_output) >= if (wl_output_get_version (output->wl_output) >=
WL_OUTPUT_RELEASE_SINCE_VERSION) WL_OUTPUT_RELEASE_SINCE_VERSION)
wl_output_release(output->wl_output); wl_output_release(output->wl_output);
@ -2661,15 +2663,12 @@ libdecor_plugin_gtk_destroy(struct libdecor_plugin *plugin)
} }
wl_list_for_each_safe(frame, frame_tmp, wl_list_for_each_safe(frame, frame_tmp,
&plugin_gtk->visible_frame_list, link) { &ctx.visible_frame_list, link) {
wl_list_remove(&frame->link); wl_list_remove(&frame->link);
} }
if (plugin_gtk->wl_shm) if (ctx.wl_shm)
wl_shm_destroy(plugin_gtk->wl_shm); wl_shm_destroy(ctx.wl_shm);
if (plugin_gtk->wl_subcompositor)
wl_subcompositor_destroy(plugin_gtk->wl_subcompositor);
libdecor_plugin_release(&plugin_gtk->plugin); libdecor_plugin_release(&plugin_gtk->plugin);
free(plugin_gtk); free(plugin_gtk);
@ -2687,7 +2686,7 @@ libdecor_frame_gtk_new(struct libdecor_plugin_gtk *plugin_gtk)
frame_gtk->plugin_gtk = plugin_gtk; frame_gtk->plugin_gtk = plugin_gtk;
frame_gtk->shadow_blur = cairo_image_surface_create( frame_gtk->shadow_blur = cairo_image_surface_create(
CAIRO_FORMAT_ARGB32, size, size); CAIRO_FORMAT_ARGB32, size, size);
wl_list_insert(&plugin_gtk->visible_frame_list, &frame_gtk->link); wl_list_insert(&ctx.visible_frame_list, &frame_gtk->link);
cr = cairo_create(frame_gtk->shadow_blur); cr = cairo_create(frame_gtk->shadow_blur);
cairo_set_operator(cr, CAIRO_OPERATOR_OVER); cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
@ -2759,10 +2758,7 @@ static void
libdecor_plugin_gtk_set_handle_application_cursor(struct libdecor_plugin *plugin, libdecor_plugin_gtk_set_handle_application_cursor(struct libdecor_plugin *plugin,
bool handle_cursor) bool handle_cursor)
{ {
struct libdecor_plugin_gtk *plugin_gtk = ctx.handle_cursor = handle_cursor;
(struct libdecor_plugin_gtk *) plugin;
plugin_gtk->handle_cursor = handle_cursor;
} }
static struct libdecor_frame * static struct libdecor_frame *
@ -2840,7 +2836,7 @@ create_shm_buffer(struct libdecor_plugin_gtk *plugin_gtk,
buf_fmt = opaque ? WL_SHM_FORMAT_XRGB8888 : WL_SHM_FORMAT_ARGB8888; buf_fmt = opaque ? WL_SHM_FORMAT_XRGB8888 : WL_SHM_FORMAT_ARGB8888;
pool = wl_shm_create_pool(plugin_gtk->wl_shm, fd, size); pool = wl_shm_create_pool(ctx.wl_shm, fd, size);
buffer = calloc(1, sizeof *buffer); buffer = calloc(1, sizeof *buffer);
buffer->wl_buffer = wl_shm_pool_create_buffer(pool, 0, buffer->wl_buffer = wl_shm_pool_create_buffer(pool, 0,
buffer_width, buffer_height, buffer_width, buffer_height,
@ -3072,7 +3068,6 @@ create_surface_subsurface_pair(struct libdecor_frame_gtk *frame_gtk,
struct libdecor_plugin_gtk *plugin_gtk = frame_gtk->plugin_gtk; struct libdecor_plugin_gtk *plugin_gtk = frame_gtk->plugin_gtk;
struct libdecor_frame *frame = &frame_gtk->frame; struct libdecor_frame *frame = &frame_gtk->frame;
struct wl_compositor *wl_compositor = ctx.wl_compositor; struct wl_compositor *wl_compositor = ctx.wl_compositor;
struct wl_subcompositor *wl_subcompositor = plugin_gtk->wl_subcompositor;
struct wl_surface *wl_surface; struct wl_surface *wl_surface;
struct wl_surface *parent; struct wl_surface *parent;
struct wl_subsurface *wl_subsurface; struct wl_subsurface *wl_subsurface;
@ -3082,7 +3077,7 @@ create_surface_subsurface_pair(struct libdecor_frame_gtk *frame_gtk,
&libdecor_gtk_proxy_tag); &libdecor_gtk_proxy_tag);
parent = libdecor_frame_get_wl_surface(frame); parent = libdecor_frame_get_wl_surface(frame);
wl_subsurface = wl_subcompositor_get_subsurface(wl_subcompositor, wl_subsurface = wl_subcompositor_get_subsurface(ctx.wl_subcompositor,
wl_surface, wl_surface,
parent); parent);
@ -3147,9 +3142,9 @@ ensure_title_bar_surfaces(struct libdecor_frame_gtk *frame_gtk)
g_object_get(gtk_widget_get_settings(frame_gtk->window), g_object_get(gtk_widget_get_settings(frame_gtk->window),
"gtk-double-click-time", "gtk-double-click-time",
&frame_gtk->plugin_gtk->double_click_time_ms, &ctx.double_click_time_ms,
"gtk-dnd-drag-threshold", "gtk-dnd-drag-threshold",
&frame_gtk->plugin_gtk->drag_threshold, &ctx.drag_threshold,
NULL); NULL);
/* set as "default" decoration */ /* set as "default" decoration */
g_object_set(frame_gtk->header, g_object_set(frame_gtk->header,
@ -3665,7 +3660,7 @@ draw_decoration(struct libdecor_frame_gtk *frame_gtk)
hide_border_surfaces(frame_gtk); hide_border_surfaces(frame_gtk);
hide_border_component(&frame_gtk->headerbar); hide_border_component(&frame_gtk->headerbar);
break; break;
case DECORATION_TYPE_ALL: case DECORATION_TYPE_ALL: {
/* show borders */ /* show borders */
ensure_border_surfaces(frame_gtk); ensure_border_surfaces(frame_gtk);
draw_border(frame_gtk); draw_border(frame_gtk);
@ -3673,12 +3668,11 @@ draw_decoration(struct libdecor_frame_gtk *frame_gtk)
ensure_title_bar_surfaces(frame_gtk); ensure_title_bar_surfaces(frame_gtk);
draw_title_bar(frame_gtk); draw_title_bar(frame_gtk);
/* link frame */ /* link frame */
if (frame_gtk->link.next == NULL) if (frame_gtk->link.next == NULL){
wl_list_insert( wl_list_insert(&ctx.visible_frame_list, &frame_gtk->link);
&frame_gtk->plugin_gtk->visible_frame_list, }
&frame_gtk->link); }break;
break; case DECORATION_TYPE_TITLE_ONLY:{
case DECORATION_TYPE_TITLE_ONLY:
/* hide borders */ /* hide borders */
if (is_border_surfaces_showing(frame_gtk)) if (is_border_surfaces_showing(frame_gtk))
hide_border_surfaces(frame_gtk); hide_border_surfaces(frame_gtk);
@ -3686,11 +3680,10 @@ draw_decoration(struct libdecor_frame_gtk *frame_gtk)
ensure_title_bar_surfaces(frame_gtk); ensure_title_bar_surfaces(frame_gtk);
draw_title_bar(frame_gtk); draw_title_bar(frame_gtk);
/* link frame */ /* link frame */
if (frame_gtk->link.next == NULL) if (frame_gtk->link.next == NULL){
wl_list_insert( wl_list_insert(&ctx.visible_frame_list, &frame_gtk->link);
&frame_gtk->plugin_gtk->visible_frame_list, }
&frame_gtk->link); }break;
break;
} }
} }
@ -3911,7 +3904,7 @@ libdecor_plugin_gtk_frame_popup_grab(struct libdecor_plugin *plugin,
struct libdecor_plugin_gtk *plugin_gtk = frame_gtk->plugin_gtk; struct libdecor_plugin_gtk *plugin_gtk = frame_gtk->plugin_gtk;
struct seat *seat; struct seat *seat;
wl_list_for_each(seat, &plugin_gtk->seat_list, link) { wl_list_for_each(seat, &ctx.seat_list, link) {
if (streq(seat->name, seat_name)) { if (streq(seat->name, seat_name)) {
if (seat->grabbed) { if (seat->grabbed) {
fprintf(stderr, "libdecor-WARNING: Application " fprintf(stderr, "libdecor-WARNING: Application "
@ -3937,7 +3930,7 @@ libdecor_plugin_gtk_frame_popup_ungrab(struct libdecor_plugin *plugin,
struct libdecor_plugin_gtk *plugin_gtk = frame_gtk->plugin_gtk; struct libdecor_plugin_gtk *plugin_gtk = frame_gtk->plugin_gtk;
struct seat *seat; struct seat *seat;
wl_list_for_each(seat, &plugin_gtk->seat_list, link) { wl_list_for_each(seat, &ctx.seat_list, link) {
if (streq(seat->name, seat_name)) { if (streq(seat->name, seat_name)) {
if (!seat->grabbed) { if (!seat->grabbed) {
fprintf(stderr, "libdecor-WARNING: Application " fprintf(stderr, "libdecor-WARNING: Application "
@ -4094,7 +4087,7 @@ ensure_cursor_theme(struct seat *seat)
seat->cursor_scale = scale; seat->cursor_scale = scale;
theme = wl_cursor_theme_load(ctx.cursor_theme_name, ctx.cursor_size*scale, theme = wl_cursor_theme_load(ctx.cursor_theme_name, ctx.cursor_size*scale,
plugin_gtk->wl_shm); ctx.wl_shm);
if (theme == NULL) if (theme == NULL)
return false; return false;
@ -4235,7 +4228,7 @@ pointer_enter(void *data,
struct seat *seat = wl_pointer_get_user_data(wl_pointer); struct seat *seat = wl_pointer_get_user_data(wl_pointer);
struct libdecor_plugin_gtk *plugin_gtk = seat->plugin_gtk; struct libdecor_plugin_gtk *plugin_gtk = seat->plugin_gtk;
if (!plugin_gtk->handle_cursor) if (!ctx.handle_cursor)
return; return;
} else { } else {
frame_gtk = wl_surface_get_user_data(surface); frame_gtk = wl_surface_get_user_data(surface);
@ -4338,10 +4331,10 @@ pointer_motion(void *data,
if (frame_gtk->titlebar_gesture.first_pressed_button == BTN_LEFT) { if (frame_gtk->titlebar_gesture.first_pressed_button == BTN_LEFT) {
if (ABS ((double) seat->pointer_x - if (ABS ((double) seat->pointer_x -
(double) frame_gtk->titlebar_gesture.pressed_x) > (double) frame_gtk->titlebar_gesture.pressed_x) >
frame_gtk->plugin_gtk->drag_threshold || ctx.drag_threshold ||
ABS ((double) seat->pointer_y - ABS ((double) seat->pointer_y -
(double) frame_gtk->titlebar_gesture.pressed_y) > (double) frame_gtk->titlebar_gesture.pressed_y) >
frame_gtk->plugin_gtk->drag_threshold) { ctx.drag_threshold) {
libdecor_frame_move(&frame_gtk->frame, libdecor_frame_move(&frame_gtk->frame,
seat->wl_seat, seat->wl_seat,
frame_gtk->titlebar_gesture.pressed_serial); frame_gtk->titlebar_gesture.pressed_serial);
@ -4427,7 +4420,7 @@ handle_button_on_header(struct libdecor_frame_gtk *frame_gtk,
if (button == BTN_LEFT && if (button == BTN_LEFT &&
frame_gtk->titlebar_gesture.first_pressed_button == BTN_LEFT && frame_gtk->titlebar_gesture.first_pressed_button == BTN_LEFT &&
time - frame_gtk->titlebar_gesture.first_pressed_time < time - frame_gtk->titlebar_gesture.first_pressed_time <
(uint32_t) frame_gtk->plugin_gtk->double_click_time_ms) { (uint32_t) ctx.double_click_time_ms) {
handle_titlebar_gesture(frame_gtk, handle_titlebar_gesture(frame_gtk,
seat, seat,
serial, serial,
@ -4630,27 +4623,26 @@ touch_down(void *data,
draw_decoration(frame_gtk); draw_decoration(frame_gtk);
libdecor_frame_toplevel_commit(&frame_gtk->frame); libdecor_frame_toplevel_commit(&frame_gtk->frame);
enum libdecor_resize_edge edge = enum libdecor_resize_edge edge = LIBDECOR_RESIZE_EDGE_NONE;
LIBDECOR_RESIZE_EDGE_NONE;
switch (frame_gtk->touch_active->type) { switch (frame_gtk->touch_active->type) {
case SHADOW: case SHADOW: {
edge = component_edge(frame_gtk->touch_active, edge = component_edge(frame_gtk->touch_active,
wl_fixed_to_int(x), wl_fixed_to_int(x),
wl_fixed_to_int(y), wl_fixed_to_int(y),
SHADOW_MARGIN); SHADOW_MARGIN);
break; }break;
case HEADER:
case HEADER: {
switch (frame_gtk->hdr_focus.type){ switch (frame_gtk->hdr_focus.type){
case HEADER_MIN: case HEADER_MIN:
case HEADER_MAX: case HEADER_MAX:
case HEADER_CLOSE: case HEADER_CLOSE: {
frame_gtk->hdr_focus.state |= GTK_STATE_FLAG_ACTIVE; frame_gtk->hdr_focus.state |= GTK_STATE_FLAG_ACTIVE;
draw_title_bar(frame_gtk); draw_title_bar(frame_gtk);
libdecor_frame_toplevel_commit(&frame_gtk->frame); libdecor_frame_toplevel_commit(&frame_gtk->frame);
break; }break;
default: default: {
if (time - seat->touch_down_time_stamp < if (time - seat->touch_down_time_stamp < (uint32_t)ctx.double_click_time_ms) {
(uint32_t)frame_gtk->plugin_gtk->double_click_time_ms) {
toggle_maximized(&frame_gtk->frame); toggle_maximized(&frame_gtk->frame);
} }
else if (moveable(frame_gtk)) { else if (moveable(frame_gtk)) {
@ -4659,11 +4651,11 @@ touch_down(void *data,
seat->wl_seat, seat->wl_seat,
serial); serial);
} }
break; }break;
} }
break; }break;
default:
break; default: break;
} }
if (edge != LIBDECOR_RESIZE_EDGE_NONE && if (edge != LIBDECOR_RESIZE_EDGE_NONE &&
resizable(frame_gtk)) { resizable(frame_gtk)) {
@ -4811,14 +4803,13 @@ output_done(void *data,
struct libdecor_frame_gtk *frame_gtk; struct libdecor_frame_gtk *frame_gtk;
struct seat *seat; struct seat *seat;
wl_list_for_each(frame_gtk, wl_list_for_each(frame_gtk, &ctx.visible_frame_list, link){
&output->plugin_gtk->visible_frame_list, link) {
bool updated = false; bool updated = false;
updated |= redraw_scale(frame_gtk, &frame_gtk->shadow); updated |= redraw_scale(frame_gtk, &frame_gtk->shadow);
if (updated) if (updated)
libdecor_frame_toplevel_commit(&frame_gtk->frame); libdecor_frame_toplevel_commit(&frame_gtk->frame);
} }
wl_list_for_each(seat, &output->plugin_gtk->seat_list, link) { wl_list_for_each(seat, &ctx.seat_list, link) {
if (update_local_cursor(seat)) if (update_local_cursor(seat))
send_cursor(seat); send_cursor(seat);
} }
@ -4860,10 +4851,10 @@ output_removed(struct output *output)
struct libdecor_frame_gtk *frame_gtk; struct libdecor_frame_gtk *frame_gtk;
struct seat *seat; struct seat *seat;
wl_list_for_each(frame_gtk, &ctx.plugin_gtk->visible_frame_list, link) { wl_list_for_each(frame_gtk, &ctx.visible_frame_list, link) {
remove_surface_outputs(&frame_gtk->shadow, output); remove_surface_outputs(&frame_gtk->shadow, output);
} }
wl_list_for_each(seat, &ctx.plugin_gtk->seat_list, link) { wl_list_for_each(seat, &ctx.seat_list, link) {
struct cursor_output *cursor_output; struct cursor_output *cursor_output;
wl_list_for_each(cursor_output, &seat->cursor_outputs, link) { wl_list_for_each(cursor_output, &seat->cursor_outputs, link) {
if (cursor_output->output == output) { if (cursor_output->output == output) {

View File

@ -434,20 +434,6 @@ struct libdecor_frame_gtk {
struct libdecor_plugin_gtk { struct libdecor_plugin_gtk {
struct libdecor_plugin plugin; struct libdecor_plugin plugin;
struct wl_subcompositor *wl_subcompositor;
struct wl_shm *wl_shm;
bool has_argb;
struct wl_list visible_frame_list;
struct wl_list seat_list;
struct wl_list output_list;
int double_click_time_ms;
int drag_threshold;
bool handle_cursor;
}; };
enum titlebar_gesture { enum titlebar_gesture {
@ -618,17 +604,29 @@ typedef struct Ctx{
struct wl_display *wl_display; struct wl_display *wl_display;
struct wl_registry *wl_registry; struct wl_registry *wl_registry;
struct wl_compositor *wl_compositor; struct wl_compositor *wl_compositor;
struct wl_subcompositor *wl_subcompositor;
struct wl_shm *wl_shm;
struct xdg_wm_base *xdg_wm_base; struct xdg_wm_base *xdg_wm_base;
struct zxdg_decoration_manager_v1 *decoration_manager; struct zxdg_decoration_manager_v1 *decoration_manager;
struct wl_callback *wl_callback;
struct wl_list frames; struct wl_list frames;
struct wl_callback *wl_callback; struct wl_list visible_frame_list;
struct wl_list seat_list;
struct wl_list output_list;
struct libdecor_plugin_gtk *plugin_gtk; struct libdecor_plugin_gtk *plugin_gtk;
struct libdecor_plugin *plugin; struct libdecor_plugin *plugin;
bool plugin_ready; bool plugin_ready;
bool init_done; bool init_done;
bool has_error; bool has_error;
bool has_argb;
int double_click_time_ms;
int drag_threshold;
bool handle_cursor;
/* window */ /* window */
struct wl_surface *wl_surface; struct wl_surface *wl_surface;
struct libdecor_frame *libdecor_frame; struct libdecor_frame *libdecor_frame;
@ -641,6 +639,7 @@ typedef struct Ctx{
EGLContext egl_context; EGLContext egl_context;
EGLSurface egl_surface; EGLSurface egl_surface;
int has_cached_config; int has_cached_config;
struct libdecor_configuration cached_config; struct libdecor_configuration cached_config;
} Ctx; } Ctx;