[digesting_libdecor] collapse new/free states and just pass W,H to frame_commit
parent
4d9d8d1081
commit
a569108d82
|
|
@ -545,9 +545,7 @@ int main(){
|
|||
|
||||
if (ctx.has_cached_config){
|
||||
ctx.has_cached_config = 0;
|
||||
struct libdecor_state *state = libdecor_state_new(ctx.w, ctx.h);
|
||||
libdecor_frame_commit(ctx.frame, state, &ctx.cached_config);
|
||||
libdecor_state_free(state);
|
||||
libdecor_frame_commit(ctx.frame, ctx.w, ctx.h, &ctx.cached_config);
|
||||
}
|
||||
|
||||
/* (nodocs-wl_egl) */
|
||||
|
|
@ -676,9 +674,7 @@ libdecor_state_get_window_state(struct libdecor_state *state)
|
|||
}
|
||||
|
||||
struct libdecor_state *
|
||||
libdecor_state_new(int width,
|
||||
int height)
|
||||
{
|
||||
libdecor_state_new(int width, int height){
|
||||
struct libdecor_state *state;
|
||||
|
||||
state = calloc(1, sizeof *state);
|
||||
|
|
@ -825,9 +821,7 @@ xdg_surface_configure(void *user_data, struct xdg_surface *xdg_surface, uint32_t
|
|||
}
|
||||
if (!ctx.configured){
|
||||
ctx.configured = 1;
|
||||
struct libdecor_state *state = libdecor_state_new(w, h);
|
||||
libdecor_frame_commit(frame, state, configuration);
|
||||
libdecor_state_free(state);
|
||||
libdecor_frame_commit(frame, w, h, configuration);
|
||||
}
|
||||
else{
|
||||
ctx.has_cached_config = 1;
|
||||
|
|
@ -1135,9 +1129,7 @@ set_capabilities(struct libdecor_frame *frame, const enum libdecor_capabilities
|
|||
frame->content_limits = frame->interactive_limits;
|
||||
}
|
||||
|
||||
state = libdecor_state_new(frame->frame_content_width, frame->frame_content_height);
|
||||
libdecor_frame_commit(frame, state, 0);
|
||||
libdecor_state_free(state);
|
||||
libdecor_frame_commit(frame, frame->frame_content_width, frame->frame_content_height, 0);
|
||||
|
||||
wl_surface_commit(ctx.wl_surface);
|
||||
}
|
||||
|
|
@ -1341,22 +1333,25 @@ libdecor_frame_apply_state(struct libdecor_frame *frame, struct libdecor_state *
|
|||
}
|
||||
|
||||
void
|
||||
libdecor_frame_commit(struct libdecor_frame *frame, struct libdecor_state *state,
|
||||
libdecor_frame_commit(struct libdecor_frame *frame, int w, int h,
|
||||
struct libdecor_configuration *configuration){
|
||||
if (configuration && configuration->has_window_state){
|
||||
struct libdecor_state state = {0};
|
||||
state.content_width = w;
|
||||
state.content_height = h;
|
||||
|
||||
if (configuration != 0 && configuration->has_window_state){
|
||||
frame->frame_window_state = configuration->window_state;
|
||||
state->window_state = configuration->window_state;
|
||||
state.window_state = configuration->window_state;
|
||||
}
|
||||
else{
|
||||
state->window_state = frame->frame_window_state;
|
||||
state.window_state = frame->frame_window_state;
|
||||
}
|
||||
|
||||
libdecor_frame_apply_state(frame, state);
|
||||
libdecor_frame_apply_state(frame, &state);
|
||||
|
||||
/* switch between decoration modes */
|
||||
if (frame_has_visible_client_side_decoration(frame)){
|
||||
libdecor_plugin_gtk_frame_commit(frame, state,
|
||||
configuration);
|
||||
libdecor_plugin_gtk_frame_commit(frame, &state, configuration);
|
||||
}
|
||||
else{
|
||||
libdecor_plugin_gtk_frame_free(frame);
|
||||
|
|
@ -1364,7 +1359,7 @@ libdecor_frame_commit(struct libdecor_frame *frame, struct libdecor_state *state
|
|||
|
||||
frame_set_window_geometry(frame, frame->frame_content_width, frame->frame_content_height);
|
||||
|
||||
if (configuration){
|
||||
if (configuration != 0){
|
||||
xdg_surface_ack_configure(frame->xdg_surface, configuration->serial);
|
||||
}
|
||||
}
|
||||
|
|
@ -2795,9 +2790,7 @@ draw_title_bar(struct libdecor_frame *frame)
|
|||
H = frame->frame_content_height;
|
||||
if (W < frame->content_limits.min_width) {
|
||||
W = frame->content_limits.min_width;
|
||||
struct libdecor_state *libdecor_state = libdecor_state_new(W, H);
|
||||
libdecor_frame_commit(frame, libdecor_state, NULL);
|
||||
libdecor_state_free(libdecor_state);
|
||||
libdecor_frame_commit(frame, W, H, NULL);
|
||||
return;
|
||||
}
|
||||
/* set default height */
|
||||
|
|
|
|||
|
|
@ -387,7 +387,7 @@ void libdecor_frame_move(struct libdecor_frame *frame,
|
|||
struct wl_seat *wl_seat,
|
||||
uint32_t serial);
|
||||
void libdecor_frame_commit(struct libdecor_frame *frame,
|
||||
struct libdecor_state *state,
|
||||
int w, int h,
|
||||
struct libdecor_configuration *configuration);
|
||||
void libdecor_frame_set_minimized(struct libdecor_frame *frame);
|
||||
void libdecor_frame_set_maximized(struct libdecor_frame *frame);
|
||||
|
|
@ -399,8 +399,6 @@ bool libdecor_frame_is_floating(struct libdecor_frame *frame);
|
|||
void libdecor_frame_close(struct libdecor_frame *frame);
|
||||
void libdecor_frame_map(struct libdecor_frame *frame);
|
||||
|
||||
struct libdecor_state * libdecor_state_new(int width, int height);
|
||||
void libdecor_state_free(struct libdecor_state *state);
|
||||
bool libdecor_configuration_get_content_size(struct libdecor_configuration *configuration,
|
||||
struct libdecor_frame *frame,
|
||||
int *width,
|
||||
|
|
|
|||
Loading…
Reference in New Issue