[digesting_libdecor] eliminate the 'visible frames' list, and gtk_link field of frame

main
Allen Webster 2026-02-27 11:41:59 -08:00
parent 85814a2bca
commit 0a2e383fcf
2 changed files with 105 additions and 186 deletions

View File

@ -432,7 +432,6 @@ int main(){
LIBDECOR_WM_CAPABILITIES_FULLSCREEN | LIBDECOR_WM_CAPABILITIES_FULLSCREEN |
LIBDECOR_WM_CAPABILITIES_MINIMIZE); LIBDECOR_WM_CAPABILITIES_MINIMIZE);
wl_list_insert(&ctx.visible_frame_list, &ctx.frame->gtk_link);
ctx.frame->visible = true; ctx.frame->visible = true;
set_capabilities(ctx.frame, (LIBDECOR_ACTION_MOVE | set_capabilities(ctx.frame, (LIBDECOR_ACTION_MOVE |
@ -441,17 +440,17 @@ int main(){
LIBDECOR_ACTION_FULLSCREEN | LIBDECOR_ACTION_FULLSCREEN |
LIBDECOR_ACTION_CLOSE)); LIBDECOR_ACTION_CLOSE));
ctx.frame->xdg_surface = xdg_wm_base_get_xdg_surface(ctx.xdg_wm_base, ctx.wl_surface); ctx.xdg_surface = xdg_wm_base_get_xdg_surface(ctx.xdg_wm_base, ctx.wl_surface);
xdg_surface_add_listener(ctx.frame->xdg_surface, &xdg_surface_listener, ctx.frame); xdg_surface_add_listener(ctx.xdg_surface, &xdg_surface_listener, ctx.frame);
ctx.frame->xdg_toplevel = xdg_surface_get_toplevel(ctx.frame->xdg_surface); ctx.xdg_toplevel = xdg_surface_get_toplevel(ctx.xdg_surface);
xdg_toplevel_add_listener(ctx.frame->xdg_toplevel, &xdg_toplevel_listener, ctx.frame); xdg_toplevel_add_listener(ctx.xdg_toplevel, &xdg_toplevel_listener, ctx.frame);
ctx.frame->decoration_mode = ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE; ctx.frame->decoration_mode = ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE;
ctx.frame->toplevel_decoration = NULL; ctx.toplevel_decoration = 0;
if (ctx.decoration_manager != 0){ if (ctx.decoration_manager != 0){
ctx.frame->toplevel_decoration = zxdg_decoration_manager_v1_get_toplevel_decoration(ctx.decoration_manager, ctx.frame->xdg_toplevel); ctx.toplevel_decoration = zxdg_decoration_manager_v1_get_toplevel_decoration(ctx.decoration_manager, ctx.xdg_toplevel);
zxdg_toplevel_decoration_v1_add_listener(ctx.frame->toplevel_decoration, &xdg_toplevel_decoration_listener, ctx.frame); zxdg_toplevel_decoration_v1_add_listener(ctx.toplevel_decoration, &xdg_toplevel_decoration_listener, ctx.frame);
} }
} }
@ -692,25 +691,25 @@ frame_get_window_size_for(struct libdecor_frame *frame,
static void static void
frame_set_window_geometry(struct libdecor_frame *frame, frame_set_window_geometry(struct libdecor_frame *frame,
int32_t content_width, int32_t content_height) int32_t content_width, int32_t content_height){
{
int x, y, width, height; int x, y, width, height;
int left, right, top, bottom; int left, right, top, bottom;
if (frame_has_visible_client_side_decoration(frame) && if (frame_has_visible_client_side_decoration(frame) &&
libdecor_plugin_gtk_frame_get_border_size(frame, NULL, &left, &right, &top, &bottom)) { libdecor_plugin_gtk_frame_get_border_size(frame, NULL, &left, &right, &top, &bottom)){
x = -left; x = -left;
y = -top; y = -top;
width = content_width + left + right; width = content_width + left + right;
height = content_height + top + bottom; height = content_height + top + bottom;
} else { }
else{
x = 0; x = 0;
y = 0; y = 0;
width = content_width; width = content_width;
height = content_height; height = content_height;
} }
xdg_surface_set_window_geometry(frame->xdg_surface, x, y, width, height); xdg_surface_set_window_geometry(ctx.xdg_surface, x, y, width, height);
} }
bool bool
@ -970,18 +969,16 @@ xdg_toplevel_decoration_listener = {
void void
libdecor_frame_unref(struct libdecor_frame *frame){ libdecor_frame_unref(struct libdecor_frame *frame){
if (ctx.decoration_manager && frame->toplevel_decoration){ if (ctx.decoration_manager != 0 && ctx.toplevel_decoration != 0){
zxdg_toplevel_decoration_v1_destroy(frame->toplevel_decoration); zxdg_toplevel_decoration_v1_destroy(ctx.toplevel_decoration);
frame->toplevel_decoration = NULL; ctx.toplevel_decoration = 0;
} }
wl_list_remove(&frame->frame_link); if (ctx.xdg_toplevel != 0){
xdg_toplevel_destroy(ctx.xdg_toplevel);
if (frame->xdg_toplevel){
xdg_toplevel_destroy(frame->xdg_toplevel);
} }
if (frame->xdg_surface != 0){ if (ctx.xdg_surface != 0){
xdg_surface_destroy(frame->xdg_surface); xdg_surface_destroy(ctx.xdg_surface);
} }
libdecor_plugin_gtk_frame_free(frame); libdecor_plugin_gtk_frame_free(frame);
@ -1002,33 +999,32 @@ libdecor_frame_set_visibility(struct libdecor_frame *frame, bool visible){
* *
* See also: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/17 * See also: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/17
*/ */
if (ctx.decoration_manager && if (ctx.decoration_manager != 0 &&
frame->toplevel_decoration && ctx.toplevel_decoration != 0 &&
frame->has_decoration_mode && frame->has_decoration_mode != 0 &&
frame->decoration_mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE) { frame->decoration_mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE) {
zxdg_toplevel_decoration_v1_set_mode(frame->toplevel_decoration, zxdg_toplevel_decoration_v1_set_mode(ctx.toplevel_decoration,
frame->visible frame->visible
? ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE ? ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE
: ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE); : ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE);
} }
if (frame->frame_content_width <= 0 || if (frame->frame_content_width > 0 &&
frame->frame_content_height <= 0) frame->frame_content_height > 0){
return; /* enable/disable decorations that are managed by a plugin */
if (frame_has_visible_client_side_decoration(frame)){
/* show client-side decorations */
libdecor_plugin_gtk_frame_commit(frame, NULL, NULL);
}
else{
/* destroy client-side decorations */
libdecor_plugin_gtk_frame_free(frame);
}
/* enable/disable decorations that are managed by a plugin */ frame_set_window_geometry(frame, frame->frame_content_width, frame->frame_content_height);
if (frame_has_visible_client_side_decoration(frame)){
/* show client-side decorations */ wl_surface_commit(ctx.wl_surface);
libdecor_plugin_gtk_frame_commit(frame, NULL, NULL);
} }
else{
/* destroy client-side decorations */
libdecor_plugin_gtk_frame_free(frame);
}
frame_set_window_geometry(frame, frame->frame_content_width, frame->frame_content_height);
wl_surface_commit(ctx.wl_surface);
} }
void void
@ -1036,8 +1032,8 @@ libdecor_frame_set_title(struct libdecor_frame *frame, const char *title){
if (!STREQL(frame->title, title)){ if (!STREQL(frame->title, title)){
free(frame->title); free(frame->title);
frame->title = strdup(title); frame->title = strdup(title);
if (frame->xdg_toplevel != 0){ if (ctx.xdg_toplevel != 0){
xdg_toplevel_set_title(frame->xdg_toplevel, title); xdg_toplevel_set_title(ctx.xdg_toplevel, title);
if (GTK_IS_WIDGET(frame->header)){ if (GTK_IS_WIDGET(frame->header)){
draw_decoration(frame); draw_decoration(frame);
wl_surface_commit(ctx.wl_surface); wl_surface_commit(ctx.wl_surface);
@ -1051,8 +1047,8 @@ libdecor_frame_set_app_id(struct libdecor_frame *frame, const char *app_id){
free(frame->app_id); free(frame->app_id);
frame->app_id = strdup(app_id); frame->app_id = strdup(app_id);
if (frame->xdg_toplevel != 0){ if (ctx.xdg_toplevel != 0){
xdg_toplevel_set_app_id(frame->xdg_toplevel, app_id); xdg_toplevel_set_app_id(ctx.xdg_toplevel, app_id);
} }
} }
@ -1102,20 +1098,14 @@ libdecor_frame_popup_ungrab(struct libdecor_frame *frame, const char *seat_name)
} }
void void
libdecor_frame_show_window_menu(struct libdecor_frame *frame, struct wl_seat *wl_seat, uint32_t serial, libdecor_frame_show_window_menu(struct libdecor_frame *frame, struct wl_seat *wl_seat, uint32_t serial, int x, int y){
int x, int y){ if (ctx.xdg_toplevel != 0){
if (!frame->xdg_toplevel) { xdg_toplevel_show_window_menu(ctx.xdg_toplevel, wl_seat, serial, x, y);
fprintf(stderr, "Can't show window menu before being mapped\n");
return;
} }
xdg_toplevel_show_window_menu(frame->xdg_toplevel, wl_seat, serial, x, y);
} }
void void
libdecor_frame_translate_coordinate(struct libdecor_frame *frame, libdecor_frame_translate_coordinate(struct libdecor_frame *frame, int content_x, int content_y, int *frame_x, int *frame_y){
int content_x, int content_y,
int *frame_x, int *frame_y)
{
*frame_x = content_x; *frame_x = content_x;
*frame_y = content_y; *frame_y = content_y;
@ -1159,25 +1149,22 @@ libdecor_frame_resize(struct libdecor_frame *frame, struct wl_seat *wl_seat,
uint32_t serial, enum libdecor_resize_edge edge){ uint32_t serial, enum libdecor_resize_edge edge){
enum xdg_toplevel_resize_edge xdg_edge; enum xdg_toplevel_resize_edge xdg_edge;
xdg_edge = edge_to_xdg_edge(edge); xdg_edge = edge_to_xdg_edge(edge);
xdg_toplevel_resize(frame->xdg_toplevel, wl_seat, serial, xdg_edge); xdg_toplevel_resize(ctx.xdg_toplevel, wl_seat, serial, xdg_edge);
} }
void void
libdecor_frame_move(struct libdecor_frame *frame, struct wl_seat *wl_seat, uint32_t serial){ libdecor_frame_move(struct libdecor_frame *frame, struct wl_seat *wl_seat, uint32_t serial){
xdg_toplevel_move(frame->xdg_toplevel, wl_seat, serial); xdg_toplevel_move(ctx.xdg_toplevel, wl_seat, serial);
} }
void void
libdecor_frame_set_fullscreen(struct libdecor_frame *frame, libdecor_frame_set_fullscreen(struct libdecor_frame *frame, struct wl_output *output){
struct wl_output *output) xdg_toplevel_set_fullscreen(ctx.xdg_toplevel, output);
{
xdg_toplevel_set_fullscreen(frame->xdg_toplevel, output);
} }
void void
libdecor_frame_unset_fullscreen(struct libdecor_frame *frame) libdecor_frame_unset_fullscreen(struct libdecor_frame *frame){
{ xdg_toplevel_unset_fullscreen(ctx.xdg_toplevel);
xdg_toplevel_unset_fullscreen(frame->xdg_toplevel);
} }
bool bool
@ -1213,7 +1200,7 @@ libdecor_frame_apply_limits(struct libdecor_frame *frame, enum libdecor_window_s
/* If the frame is configured as non-resizable before the first /* If the frame is configured as non-resizable before the first
* configure event is received, we have to manually set the min/max * configure event is received, we have to manually set the min/max
* limits with the configured content size afterwards. */ * limits with the configured content size afterwards. */
if (!(frame->frame_capabilities & LIBDECOR_ACTION_RESIZE)) { if (!(frame->frame_capabilities & LIBDECOR_ACTION_RESIZE)){
frame->content_limits.min_width = frame->frame_content_width; frame->content_limits.min_width = frame->frame_content_width;
frame->content_limits.max_width = frame->frame_content_width; frame->content_limits.max_width = frame->frame_content_width;
@ -1222,7 +1209,7 @@ libdecor_frame_apply_limits(struct libdecor_frame *frame, enum libdecor_window_s
} }
if (frame->content_limits.min_width > 0 && if (frame->content_limits.min_width > 0 &&
frame->content_limits.min_height > 0) { frame->content_limits.min_height > 0){
struct libdecor_state state_min; struct libdecor_state state_min;
int win_min_width, win_min_height; int win_min_width, win_min_height;
@ -1232,14 +1219,14 @@ libdecor_frame_apply_limits(struct libdecor_frame *frame, enum libdecor_window_s
frame_get_window_size_for(frame, &state_min, frame_get_window_size_for(frame, &state_min,
&win_min_width, &win_min_height); &win_min_width, &win_min_height);
xdg_toplevel_set_min_size(frame->xdg_toplevel, xdg_toplevel_set_min_size(ctx.xdg_toplevel, win_min_width, win_min_height);
win_min_width, win_min_height); }
} else { else{
xdg_toplevel_set_min_size(frame->xdg_toplevel, 0, 0); xdg_toplevel_set_min_size(ctx.xdg_toplevel, 0, 0);
} }
if (frame->content_limits.max_width > 0 && if (frame->content_limits.max_width > 0 &&
frame->content_limits.max_height > 0) { frame->content_limits.max_height > 0){
struct libdecor_state state_max; struct libdecor_state state_max;
int win_max_width, win_max_height; int win_max_width, win_max_height;
@ -1247,12 +1234,11 @@ libdecor_frame_apply_limits(struct libdecor_frame *frame, enum libdecor_window_s
state_max.content_height = frame->content_limits.max_height; state_max.content_height = frame->content_limits.max_height;
state_max.window_state = window_state; state_max.window_state = window_state;
frame_get_window_size_for(frame, &state_max, frame_get_window_size_for(frame, &state_max, &win_max_width, &win_max_height);
&win_max_width, &win_max_height); xdg_toplevel_set_max_size(ctx.xdg_toplevel, win_max_width, win_max_height);
xdg_toplevel_set_max_size(frame->xdg_toplevel, }
win_max_width, win_max_height); else{
} else { xdg_toplevel_set_max_size(ctx.xdg_toplevel, 0, 0);
xdg_toplevel_set_max_size(frame->xdg_toplevel, 0, 0);
} }
} }
@ -1291,7 +1277,7 @@ libdecor_frame_commit(struct libdecor_frame *frame, int w, int h,
frame_set_window_geometry(frame, frame->frame_content_width, frame->frame_content_height); frame_set_window_geometry(frame, frame->frame_content_width, frame->frame_content_height);
if (configuration != 0){ if (configuration != 0){
xdg_surface_ack_configure(frame->xdg_surface, configuration->serial); xdg_surface_ack_configure(ctx.xdg_surface, configuration->serial);
} }
} }
@ -1353,16 +1339,8 @@ cleanup(void){
} }
} }
{ if (ctx.wl_shm){
struct libdecor_frame *frame, *frame_tmp; wl_shm_destroy(ctx.wl_shm);
wl_list_for_each_safe(frame, frame_tmp,
&ctx.visible_frame_list, gtk_link) {
wl_list_remove(&frame->gtk_link);
}
if (ctx.wl_shm){
wl_shm_destroy(ctx.wl_shm);
}
} }
if (ctx.wl_subcompositor != 0){ if (ctx.wl_subcompositor != 0){
@ -1889,10 +1867,10 @@ libdecor_plugin_gtk_set_handle_application_cursor(bool handle_cursor){
static void static void
toggle_maximized(void){ toggle_maximized(void){
if (ctx.frame->frame_window_state & LIBDECOR_WINDOW_STATE_MAXIMIZED){ if (ctx.frame->frame_window_state & LIBDECOR_WINDOW_STATE_MAXIMIZED){
xdg_toplevel_unset_maximized(ctx.frame->xdg_toplevel); xdg_toplevel_unset_maximized(ctx.xdg_toplevel);
} }
else{ else{
xdg_toplevel_set_maximized(ctx.frame->xdg_toplevel); xdg_toplevel_set_maximized(ctx.xdg_toplevel);
} }
} }
@ -2005,10 +1983,6 @@ libdecor_plugin_gtk_frame_free(struct libdecor_frame *frame){
g_clear_pointer(&frame->title, free); g_clear_pointer(&frame->title, free);
frame->decoration_type = DECORATION_TYPE_NONE; frame->decoration_type = DECORATION_TYPE_NONE;
if (frame->gtk_link.next != 0){
wl_list_remove(&frame->gtk_link);
}
} }
static bool static bool
@ -2155,26 +2129,20 @@ static void
create_surface_subsurface_pair(struct libdecor_frame *frame, create_surface_subsurface_pair(struct libdecor_frame *frame,
struct wl_surface **out_wl_surface, struct wl_surface **out_wl_surface,
struct wl_subsurface **out_wl_subsurface){ struct wl_subsurface **out_wl_subsurface){
struct wl_compositor *wl_compositor = ctx.wl_compositor;
struct wl_surface *wl_surface; struct wl_surface *wl_surface;
struct wl_surface *parent;
struct wl_subsurface *wl_subsurface; struct wl_subsurface *wl_subsurface;
wl_surface = wl_compositor_create_surface(wl_compositor); wl_surface = wl_compositor_create_surface(ctx.wl_compositor);
wl_proxy_set_tag((struct wl_proxy *) wl_surface, &libdecor_gtk_proxy_tag); wl_proxy_set_tag((struct wl_proxy *)wl_surface, &libdecor_gtk_proxy_tag);
wl_subsurface = wl_subcompositor_get_subsurface(ctx.wl_subcompositor, wl_surface, ctx.wl_surface);
parent = ctx.wl_surface;
wl_subsurface = wl_subcompositor_get_subsurface(ctx.wl_subcompositor, wl_surface, parent);
*out_wl_surface = wl_surface; *out_wl_surface = wl_surface;
*out_wl_subsurface = wl_subsurface; *out_wl_subsurface = wl_subsurface;
} }
static void static void
ensure_component(struct libdecor_frame *frame, ensure_component(struct libdecor_frame *frame, struct border_component *cmpnt){
struct border_component *cmpnt) if (!cmpnt->wl_surface){
{
if (!cmpnt->wl_surface) {
wl_list_init(&cmpnt->output_list); wl_list_init(&cmpnt->output_list);
cmpnt->scale = 1; cmpnt->scale = 1;
create_surface_subsurface_pair(frame, &cmpnt->wl_surface, &cmpnt->wl_subsurface); create_surface_subsurface_pair(frame, &cmpnt->wl_surface, &cmpnt->wl_subsurface);
@ -2705,9 +2673,6 @@ static void
draw_decoration(struct libdecor_frame *frame){ draw_decoration(struct libdecor_frame *frame){
switch (frame->decoration_type) { switch (frame->decoration_type) {
case DECORATION_TYPE_NONE: { case DECORATION_TYPE_NONE: {
if (frame->gtk_link.next != NULL){
wl_list_remove(&frame->gtk_link);
}
if (is_border_surfaces_showing(frame)){ if (is_border_surfaces_showing(frame)){
hide_border_surfaces(frame); hide_border_surfaces(frame);
} }
@ -2721,10 +2686,6 @@ draw_decoration(struct libdecor_frame *frame){
/* show title bar */ /* show title bar */
ensure_title_bar_surfaces(frame); ensure_title_bar_surfaces(frame);
draw_title_bar(frame); draw_title_bar(frame);
/* link frame */
if (frame->gtk_link.next == NULL){
wl_list_insert(&ctx.visible_frame_list, &frame->gtk_link);
}
}break; }break;
case DECORATION_TYPE_TITLE_ONLY: { case DECORATION_TYPE_TITLE_ONLY: {
@ -2734,10 +2695,6 @@ draw_decoration(struct libdecor_frame *frame){
/* show title bar */ /* show title bar */
ensure_title_bar_surfaces(frame); ensure_title_bar_surfaces(frame);
draw_title_bar(frame); draw_title_bar(frame);
/* link frame */
if (frame->gtk_link.next == NULL){
wl_list_insert(&ctx.visible_frame_list, &frame->gtk_link);
}
}break; }break;
} }
} }
@ -3381,7 +3338,7 @@ handle_button_on_header(struct libdecor_frame *frame, struct seat *seat, uint32_
switch (frame->hdr_focus.type) { switch (frame->hdr_focus.type) {
case HEADER_MIN: { case HEADER_MIN: {
if (frame->frame_capabilities & LIBDECOR_ACTION_MINIMIZE){ if (frame->frame_capabilities & LIBDECOR_ACTION_MINIMIZE){
xdg_toplevel_set_minimized(frame->xdg_toplevel); xdg_toplevel_set_minimized(ctx.xdg_toplevel);
} }
}break; }break;
@ -3393,7 +3350,7 @@ handle_button_on_header(struct libdecor_frame *frame, struct seat *seat, uint32_
case HEADER_CLOSE: { case HEADER_CLOSE: {
if (frame->frame_capabilities & LIBDECOR_ACTION_CLOSE){ if (frame->frame_capabilities & LIBDECOR_ACTION_CLOSE){
xdg_toplevel_close(frame, frame->xdg_toplevel); xdg_toplevel_close(frame, ctx.xdg_toplevel);
seat->pointer_focus = 0; seat->pointer_focus = 0;
} }
}break; }break;
@ -3402,7 +3359,7 @@ handle_button_on_header(struct libdecor_frame *frame, struct seat *seat, uint32_
} }
frame->hdr_focus.state &= ~GTK_STATE_FLAG_ACTIVE; frame->hdr_focus.state &= ~GTK_STATE_FLAG_ACTIVE;
if (GTK_IS_WIDGET(frame->header)) { if (GTK_IS_WIDGET(frame->header)){
draw_title_bar(frame); draw_title_bar(frame);
wl_surface_commit(ctx.wl_surface); wl_surface_commit(ctx.wl_surface);
} }
@ -3561,8 +3518,7 @@ touch_down(void *data, struct wl_touch *wl_touch, uint32_t serial,
} }
static void static void
touch_up(void *data, struct wl_touch *wl_touch, uint32_t serial, touch_up(void *data, struct wl_touch *wl_touch, uint32_t serial, uint32_t time, int32_t id){
uint32_t time, int32_t id){
struct seat *seat = data; struct seat *seat = data;
if (seat->touch_focus && own_surface(seat->touch_focus)){ if (seat->touch_focus && own_surface(seat->touch_focus)){
struct libdecor_frame *frame = wl_surface_get_user_data(seat->touch_focus); struct libdecor_frame *frame = wl_surface_get_user_data(seat->touch_focus);
@ -3571,7 +3527,7 @@ touch_up(void *data, struct wl_touch *wl_touch, uint32_t serial,
switch (frame->hdr_focus.type) { switch (frame->hdr_focus.type) {
case HEADER_MIN: { case HEADER_MIN: {
if (frame->frame_capabilities & LIBDECOR_ACTION_MINIMIZE){ if (frame->frame_capabilities & LIBDECOR_ACTION_MINIMIZE){
xdg_toplevel_set_minimized(frame->xdg_toplevel); xdg_toplevel_set_minimized(ctx.xdg_toplevel);
} }
}break; }break;
@ -3583,7 +3539,7 @@ touch_up(void *data, struct wl_touch *wl_touch, uint32_t serial,
case HEADER_CLOSE: { case HEADER_CLOSE: {
if (frame->frame_capabilities & LIBDECOR_ACTION_CLOSE){ if (frame->frame_capabilities & LIBDECOR_ACTION_CLOSE){
xdg_toplevel_close(frame, frame->xdg_toplevel); xdg_toplevel_close(frame, ctx.xdg_toplevel);
seat->touch_focus = 0; seat->touch_focus = 0;
} }
}break; }break;
@ -3629,10 +3585,7 @@ static void
touch_frame(void *data, struct wl_touch *wl_touch){} touch_frame(void *data, struct wl_touch *wl_touch){}
static void static void
touch_cancel(void *data, touch_cancel(void *data, struct wl_touch *wl_touch){}
struct wl_touch *wl_touch)
{
}
const struct wl_touch_listener touch_listener = { const struct wl_touch_listener touch_listener = {
touch_down, touch_down,
@ -3643,40 +3596,26 @@ const struct wl_touch_listener touch_listener = {
}; };
static void static void
output_geometry(void *data, output_geometry(void *data, struct wl_output *wl_output,
struct wl_output *wl_output, int32_t x, int32_t y,
int32_t x, int32_t physical_width, int32_t physical_height,
int32_t y, int32_t subpixel, const char *make, const char *model,
int32_t physical_width, int32_t transform){}
int32_t physical_height,
int32_t subpixel,
const char *make,
const char *model,
int32_t transform)
{
}
static void static void
output_mode(void *data, output_mode(void *data, struct wl_output *wl_output,
struct wl_output *wl_output, uint32_t flags, int32_t width, int32_t height,
uint32_t flags, int32_t refresh){}
int32_t width,
int32_t height,
int32_t refresh)
{
}
static void static void
output_done(void *data, output_done(void *data, struct wl_output *wl_output){
struct wl_output *wl_output)
{
struct output *output = data; struct output *output = data;
struct libdecor_frame *frame; struct libdecor_frame *frame;
struct seat *seat; struct seat *seat;
wl_list_for_each(frame, &ctx.visible_frame_list, gtk_link){ if (ctx.frame != 0 &&
bool updated = false; ctx.frame->decoration_type != DECORATION_TYPE_NONE){
updated |= redraw_scale(frame, &frame->shadow); bool updated = redraw_scale(ctx.frame, &ctx.frame->shadow);
if (updated){ if (updated){
wl_surface_commit(ctx.wl_surface); wl_surface_commit(ctx.wl_surface);
} }
@ -3688,12 +3627,8 @@ output_done(void *data,
} }
static void static void
output_scale(void *data, output_scale(void *data, struct wl_output *wl_output, int32_t factor){
struct wl_output *wl_output,
int32_t factor)
{
struct output *output = data; struct output *output = data;
output->scale = factor; output->scale = factor;
} }
@ -3705,8 +3640,7 @@ const struct wl_output_listener output_listener = {
}; };
static void static void
remove_surface_outputs(struct border_component *cmpnt, const struct output *output) remove_surface_outputs(struct border_component *cmpnt, const struct output *output){
{
struct surface_output *surface_output; struct surface_output *surface_output;
wl_list_for_each(surface_output, &cmpnt->output_list, link) { wl_list_for_each(surface_output, &cmpnt->output_list, link) {
if (surface_output->output == output) { if (surface_output->output == output) {
@ -3718,13 +3652,13 @@ remove_surface_outputs(struct border_component *cmpnt, const struct output *outp
} }
static void static void
output_removed(struct output *output) output_removed(struct output *output){
{
struct libdecor_frame *frame; struct libdecor_frame *frame;
struct seat *seat; struct seat *seat;
wl_list_for_each(frame, &ctx.visible_frame_list, gtk_link) { if (ctx.frame != 0 &&
remove_surface_outputs(&frame->shadow, output); ctx.frame->decoration_type != DECORATION_TYPE_NONE){
remove_surface_outputs(&ctx.frame->shadow, output);
} }
wl_list_for_each(seat, &ctx.seat_list, link) { wl_list_for_each(seat, &ctx.seat_list, link) {
struct cursor_output *cursor_output; struct cursor_output *cursor_output;
@ -3744,8 +3678,7 @@ output_removed(struct output *output)
//#include "desktop-settings.c" //#include "desktop-settings.c"
static bool static bool
get_cursor_settings_from_env(char **theme, int *size) get_cursor_settings_from_env(char **theme, int *size){
{
char *env_xtheme; char *env_xtheme;
char *env_xsize; char *env_xsize;
@ -3764,9 +3697,7 @@ get_cursor_settings_from_env(char **theme, int *size)
#include <dbus/dbus.h> #include <dbus/dbus.h>
static DBusMessage * static DBusMessage *
get_setting_sync(DBusConnection *const connection, get_setting_sync(DBusConnection *const connection, const char *key, const char *value){
const char *key, const char *value)
{
DBusError error; DBusError error;
dbus_bool_t success; dbus_bool_t success;
DBusMessage *message; DBusMessage *message;

View File

@ -163,18 +163,7 @@ struct border_component {
}; };
struct libdecor_frame { struct libdecor_frame {
//struct libdecor_frame;
struct wl_list frame_link;
//struct libdecor_frame_private; //struct libdecor_frame_private;
void *user_data;
struct xdg_surface *xdg_surface;
struct xdg_toplevel *xdg_toplevel;
struct zxdg_toplevel_decoration_v1 *toplevel_decoration;
bool pending_map;
char *app_id; char *app_id;
char *title; char *title;
struct libdecor_limits content_limits; struct libdecor_limits content_limits;
@ -187,16 +176,14 @@ struct libdecor_frame {
enum libdecor_window_state frame_window_state; enum libdecor_window_state frame_window_state;
bool has_decoration_mode; bool has_decoration_mode;
enum zxdg_toplevel_decoration_v1_mode decoration_mode; enum zxdg_toplevel_decoration_v1_mode decoration_mode;
enum libdecor_capabilities frame_capabilities; enum libdecor_capabilities frame_capabilities;
enum libdecor_wm_capabilities wm_capabilities; enum libdecor_wm_capabilities wm_capabilities;
/* original limits for interactive resize */ /* original limits for interactive resize */
struct libdecor_limits interactive_limits; struct libdecor_limits interactive_limits;
bool visible; bool visible;
//struct libdecor_frame_gtk; //struct libdecor_frame_gtk;
@ -226,8 +213,6 @@ struct libdecor_frame {
/* store pre-processed shadow tile */ /* store pre-processed shadow tile */
cairo_surface_t *shadow_blur; cairo_surface_t *shadow_blur;
struct wl_list gtk_link;
struct { struct {
enum titlebar_gesture_state state; enum titlebar_gesture_state state;
int button_pressed_count; int button_pressed_count;
@ -474,6 +459,9 @@ typedef struct Ctx{
/* window */ /* window */
struct wl_surface *wl_surface; struct wl_surface *wl_surface;
struct libdecor_frame *frame; struct libdecor_frame *frame;
struct xdg_surface *xdg_surface;
struct xdg_toplevel *xdg_toplevel;
struct zxdg_toplevel_decoration_v1 *toplevel_decoration;
struct wl_egl_window *wl_egl_window; struct wl_egl_window *wl_egl_window;
int configured; int configured;
int w; int w;