window: Set egl_window_resize late and once
Previously we resized in attach_surface and create_surface. THe second resize overwrote dx or dy from the first.
This commit is contained in:
parent
d4af320178
commit
14f7ff91ad
|
@ -680,6 +680,23 @@ free_surface(void *data)
|
||||||
window_attach_surface(window);
|
window_attach_surface(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
window_get_resize_dx_dy(struct window *window, int *x, int *y)
|
||||||
|
{
|
||||||
|
if (window->resize_edges & WINDOW_RESIZING_LEFT)
|
||||||
|
*x = window->server_allocation.width - window->allocation.width;
|
||||||
|
else
|
||||||
|
*x = 0;
|
||||||
|
|
||||||
|
if (window->resize_edges & WINDOW_RESIZING_TOP)
|
||||||
|
*y = window->server_allocation.height -
|
||||||
|
window->allocation.height;
|
||||||
|
else
|
||||||
|
*y = 0;
|
||||||
|
|
||||||
|
window->resize_edges = 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
window_attach_surface(struct window *window)
|
window_attach_surface(struct window *window)
|
||||||
{
|
{
|
||||||
|
@ -687,27 +704,12 @@ window_attach_surface(struct window *window)
|
||||||
struct wl_buffer *buffer;
|
struct wl_buffer *buffer;
|
||||||
struct egl_window_surface_data *data;
|
struct egl_window_surface_data *data;
|
||||||
int32_t x, y;
|
int32_t x, y;
|
||||||
int width = window->allocation.width;
|
|
||||||
int height = window->allocation.height;
|
|
||||||
|
|
||||||
if (window->resize_edges & WINDOW_RESIZING_LEFT)
|
|
||||||
x = window->server_allocation.width - width;
|
|
||||||
else
|
|
||||||
x = 0;
|
|
||||||
|
|
||||||
if (window->resize_edges & WINDOW_RESIZING_TOP)
|
|
||||||
y = window->server_allocation.height - height;
|
|
||||||
else
|
|
||||||
y = 0;
|
|
||||||
|
|
||||||
window->resize_edges = 0;
|
|
||||||
|
|
||||||
switch (window->buffer_type) {
|
switch (window->buffer_type) {
|
||||||
case WINDOW_BUFFER_TYPE_EGL_WINDOW:
|
case WINDOW_BUFFER_TYPE_EGL_WINDOW:
|
||||||
data = cairo_surface_get_user_data(window->cairo_surface,
|
data = cairo_surface_get_user_data(window->cairo_surface,
|
||||||
&surface_data_key);
|
&surface_data_key);
|
||||||
|
|
||||||
wl_egl_window_resize(data->window, width, height, x, y);
|
|
||||||
cairo_gl_surface_swapbuffers(window->cairo_surface);
|
cairo_gl_surface_swapbuffers(window->cairo_surface);
|
||||||
wl_egl_window_get_attached_size(data->window,
|
wl_egl_window_get_attached_size(data->window,
|
||||||
&window->server_allocation.width,
|
&window->server_allocation.width,
|
||||||
|
@ -715,6 +717,8 @@ window_attach_surface(struct window *window)
|
||||||
break;
|
break;
|
||||||
case WINDOW_BUFFER_TYPE_EGL_IMAGE:
|
case WINDOW_BUFFER_TYPE_EGL_IMAGE:
|
||||||
case WINDOW_BUFFER_TYPE_SHM:
|
case WINDOW_BUFFER_TYPE_SHM:
|
||||||
|
window_get_resize_dx_dy(window, &x, &y);
|
||||||
|
|
||||||
if (window->pending_surface != NULL)
|
if (window->pending_surface != NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -781,13 +785,17 @@ static void
|
||||||
window_resize_cairo_window_surface(struct window *window)
|
window_resize_cairo_window_surface(struct window *window)
|
||||||
{
|
{
|
||||||
struct egl_window_surface_data *data;
|
struct egl_window_surface_data *data;
|
||||||
|
int x, y;
|
||||||
|
|
||||||
data = cairo_surface_get_user_data(window->cairo_surface,
|
data = cairo_surface_get_user_data(window->cairo_surface,
|
||||||
&surface_data_key);
|
&surface_data_key);
|
||||||
|
|
||||||
|
window_get_resize_dx_dy(window, &x, &y),
|
||||||
wl_egl_window_resize(data->window,
|
wl_egl_window_resize(data->window,
|
||||||
window->allocation.width,
|
window->allocation.width,
|
||||||
window->allocation.height, 0, 0);
|
window->allocation.height,
|
||||||
|
x,y);
|
||||||
|
|
||||||
cairo_gl_surface_set_size(window->cairo_surface,
|
cairo_gl_surface_set_size(window->cairo_surface,
|
||||||
window->allocation.width,
|
window->allocation.width,
|
||||||
window->allocation.height);
|
window->allocation.height);
|
||||||
|
|
Loading…
Reference in New Issue