[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){
|
if (ctx.has_cached_config){
|
||||||
ctx.has_cached_config = 0;
|
ctx.has_cached_config = 0;
|
||||||
struct libdecor_state *state = libdecor_state_new(ctx.w, ctx.h);
|
libdecor_frame_commit(ctx.frame, ctx.w, ctx.h, &ctx.cached_config);
|
||||||
libdecor_frame_commit(ctx.frame, state, &ctx.cached_config);
|
|
||||||
libdecor_state_free(state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (nodocs-wl_egl) */
|
/* (nodocs-wl_egl) */
|
||||||
|
|
@ -676,9 +674,7 @@ libdecor_state_get_window_state(struct libdecor_state *state)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct libdecor_state *
|
struct libdecor_state *
|
||||||
libdecor_state_new(int width,
|
libdecor_state_new(int width, int height){
|
||||||
int height)
|
|
||||||
{
|
|
||||||
struct libdecor_state *state;
|
struct libdecor_state *state;
|
||||||
|
|
||||||
state = calloc(1, sizeof *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){
|
if (!ctx.configured){
|
||||||
ctx.configured = 1;
|
ctx.configured = 1;
|
||||||
struct libdecor_state *state = libdecor_state_new(w, h);
|
libdecor_frame_commit(frame, w, h, configuration);
|
||||||
libdecor_frame_commit(frame, state, configuration);
|
|
||||||
libdecor_state_free(state);
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
ctx.has_cached_config = 1;
|
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;
|
frame->content_limits = frame->interactive_limits;
|
||||||
}
|
}
|
||||||
|
|
||||||
state = libdecor_state_new(frame->frame_content_width, frame->frame_content_height);
|
libdecor_frame_commit(frame, frame->frame_content_width, frame->frame_content_height, 0);
|
||||||
libdecor_frame_commit(frame, state, 0);
|
|
||||||
libdecor_state_free(state);
|
|
||||||
|
|
||||||
wl_surface_commit(ctx.wl_surface);
|
wl_surface_commit(ctx.wl_surface);
|
||||||
}
|
}
|
||||||
|
|
@ -1341,22 +1333,25 @@ libdecor_frame_apply_state(struct libdecor_frame *frame, struct libdecor_state *
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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){
|
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;
|
frame->frame_window_state = configuration->window_state;
|
||||||
state->window_state = configuration->window_state;
|
state.window_state = configuration->window_state;
|
||||||
}
|
}
|
||||||
else{
|
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 */
|
/* switch between decoration modes */
|
||||||
if (frame_has_visible_client_side_decoration(frame)){
|
if (frame_has_visible_client_side_decoration(frame)){
|
||||||
libdecor_plugin_gtk_frame_commit(frame, state,
|
libdecor_plugin_gtk_frame_commit(frame, &state, configuration);
|
||||||
configuration);
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
libdecor_plugin_gtk_frame_free(frame);
|
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);
|
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);
|
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;
|
H = frame->frame_content_height;
|
||||||
if (W < frame->content_limits.min_width) {
|
if (W < frame->content_limits.min_width) {
|
||||||
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, W, H, NULL);
|
||||||
libdecor_frame_commit(frame, libdecor_state, NULL);
|
|
||||||
libdecor_state_free(libdecor_state);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* set default height */
|
/* set default height */
|
||||||
|
|
|
||||||
|
|
@ -387,7 +387,7 @@ void libdecor_frame_move(struct libdecor_frame *frame,
|
||||||
struct wl_seat *wl_seat,
|
struct wl_seat *wl_seat,
|
||||||
uint32_t serial);
|
uint32_t serial);
|
||||||
void libdecor_frame_commit(struct libdecor_frame *frame,
|
void libdecor_frame_commit(struct libdecor_frame *frame,
|
||||||
struct libdecor_state *state,
|
int w, int h,
|
||||||
struct libdecor_configuration *configuration);
|
struct libdecor_configuration *configuration);
|
||||||
void libdecor_frame_set_minimized(struct libdecor_frame *frame);
|
void libdecor_frame_set_minimized(struct libdecor_frame *frame);
|
||||||
void libdecor_frame_set_maximized(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_close(struct libdecor_frame *frame);
|
||||||
void libdecor_frame_map(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,
|
bool libdecor_configuration_get_content_size(struct libdecor_configuration *configuration,
|
||||||
struct libdecor_frame *frame,
|
struct libdecor_frame *frame,
|
||||||
int *width,
|
int *width,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue