|
|
@ -99,7 +99,6 @@ struct window { |
|
|
|
struct input *keyboard_device; |
|
|
|
struct input *keyboard_device; |
|
|
|
uint32_t name; |
|
|
|
uint32_t name; |
|
|
|
enum window_buffer_type buffer_type; |
|
|
|
enum window_buffer_type buffer_type; |
|
|
|
int mapped; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EGLImageKHR *image; |
|
|
|
EGLImageKHR *image; |
|
|
|
cairo_surface_t *cairo_surface, *pending_surface; |
|
|
|
cairo_surface_t *cairo_surface, *pending_surface; |
|
|
@ -599,15 +598,14 @@ window_attach_surface(struct window *window) |
|
|
|
wl_surface_attach(window->surface, buffer, x, y); |
|
|
|
wl_surface_attach(window->surface, buffer, x, y); |
|
|
|
wl_display_sync_callback(display->display, free_surface, window); |
|
|
|
wl_display_sync_callback(display->display, free_surface, window); |
|
|
|
|
|
|
|
|
|
|
|
if (!window->mapped) { |
|
|
|
if (window->fullscreen) |
|
|
|
if (!window->parent) |
|
|
|
wl_surface_map_fullscreen(window->surface); |
|
|
|
wl_surface_map_toplevel(window->surface); |
|
|
|
else if (!window->parent) |
|
|
|
else |
|
|
|
wl_surface_map_toplevel(window->surface); |
|
|
|
wl_surface_map_transient(window->surface, |
|
|
|
else |
|
|
|
window->parent->surface, |
|
|
|
wl_surface_map_transient(window->surface, |
|
|
|
window->x, window->y, 0); |
|
|
|
window->parent->surface, |
|
|
|
window->mapped = 1; |
|
|
|
window->x, window->y, 0); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wl_surface_damage(window->surface, 0, 0, |
|
|
|
wl_surface_damage(window->surface, 0, 0, |
|
|
|
window->allocation.width, |
|
|
|
window->allocation.width, |
|
|
@ -1086,10 +1084,10 @@ handle_configure(void *data, struct wl_shell *shell, |
|
|
|
struct window *window = wl_surface_get_user_data(surface); |
|
|
|
struct window *window = wl_surface_get_user_data(surface); |
|
|
|
int32_t child_width, child_height; |
|
|
|
int32_t child_width, child_height; |
|
|
|
|
|
|
|
|
|
|
|
/* FIXME this is probably the wrong place to check for width or
|
|
|
|
/* FIXME: this is probably the wrong place to check for width
|
|
|
|
height <= 0, but it prevents the compositor from crashing |
|
|
|
* or height <= 0, but it prevents the compositor from crashing |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
if(width <= 0 || height <= 0) |
|
|
|
if (width <= 0 || height <= 0) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
window->resize_edges = edges; |
|
|
|
window->resize_edges = edges; |
|
|
@ -1118,7 +1116,7 @@ void |
|
|
|
window_get_child_allocation(struct window *window, |
|
|
|
window_get_child_allocation(struct window *window, |
|
|
|
struct rectangle *allocation) |
|
|
|
struct rectangle *allocation) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (window->fullscreen && !window->decoration) { |
|
|
|
if (window->fullscreen || !window->decoration) { |
|
|
|
*allocation = window->allocation; |
|
|
|
*allocation = window->allocation; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
allocation->x = window->margin + 10; |
|
|
|
allocation->x = window->margin + 10; |
|
|
@ -1134,8 +1132,15 @@ void |
|
|
|
window_set_child_size(struct window *window, int32_t width, int32_t height) |
|
|
|
window_set_child_size(struct window *window, int32_t width, int32_t height) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!window->fullscreen) { |
|
|
|
if (!window->fullscreen) { |
|
|
|
|
|
|
|
window->allocation.x = 20 + window->margin; |
|
|
|
|
|
|
|
window->allocation.y = 60 + window->margin; |
|
|
|
window->allocation.width = width + 20 + window->margin * 2; |
|
|
|
window->allocation.width = width + 20 + window->margin * 2; |
|
|
|
window->allocation.height = height + 60 + window->margin * 2; |
|
|
|
window->allocation.height = height + 60 + window->margin * 2; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
window->allocation.x = 0; |
|
|
|
|
|
|
|
window->allocation.y = 0; |
|
|
|
|
|
|
|
window->allocation.width = width; |
|
|
|
|
|
|
|
window->allocation.height = height; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1163,13 +1168,22 @@ window_schedule_redraw(struct window *window) |
|
|
|
void |
|
|
|
void |
|
|
|
window_set_fullscreen(struct window *window, int fullscreen) |
|
|
|
window_set_fullscreen(struct window *window, int fullscreen) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
int32_t width, height; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (window->fullscreen == fullscreen) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
window->fullscreen = fullscreen; |
|
|
|
window->fullscreen = fullscreen; |
|
|
|
if (window->fullscreen) { |
|
|
|
if (window->fullscreen) { |
|
|
|
window->saved_allocation = window->allocation; |
|
|
|
window->saved_allocation = window->allocation; |
|
|
|
window->allocation = window->display->screen_allocation; |
|
|
|
width = window->display->screen_allocation.width; |
|
|
|
|
|
|
|
height = window->display->screen_allocation.height; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
window->allocation = window->saved_allocation; |
|
|
|
width = window->saved_allocation.width - 20 - window->margin * 2; |
|
|
|
|
|
|
|
height = window->saved_allocation.height - 60 - window->margin * 2; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(*window->resize_handler)(window, width, height, window->user_data); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void |
|
|
|
void |
|
|
|