summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Ekstrand <jason@jlekstrand.net>2013-12-04 20:32:03 -0600
committerKristian Høgsberg <krh@bitplanet.net>2013-12-16 17:23:09 -0800
commit5c11a3340bf62f985c307e83b4999c8377576295 (patch)
tree842a50a398e63309b8a325b9767e7ccfda038913 /src
parentfc63fddcee7301a9c1693561a7300a2929dc4baa (diff)
Add a weston_surface_set_size function
Surfaces that are created by clients get their size automatically updated by the attach/commit. Surfaces created directly by shells (such as black surfaces) sometimes need to be manually resized. This function allows you to do that while being somewhat less messy than messing with the internals of weston_surface manually. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Diffstat (limited to 'src')
-rw-r--r--src/compositor.c15
-rw-r--r--src/compositor.h4
2 files changed, 15 insertions, 4 deletions
diff --git a/src/compositor.c b/src/compositor.c
index c4ffb5e9..d273e3fa 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -1219,8 +1219,7 @@ weston_surface_is_mapped(struct weston_surface *surface)
}
static void
-weston_surface_set_size(struct weston_surface *surface,
- int32_t width, int32_t height)
+surface_set_size(struct weston_surface *surface, int32_t width, int32_t height)
{
struct weston_view *view;
@@ -1234,13 +1233,21 @@ weston_surface_set_size(struct weston_surface *surface,
weston_view_geometry_dirty(view);
}
+WL_EXPORT void
+weston_surface_set_size(struct weston_surface *surface,
+ int32_t width, int32_t height)
+{
+ assert(!surface->resource);
+ surface_set_size(surface, width, height);
+}
+
static void
weston_surface_set_size_from_buffer(struct weston_surface *surface)
{
int32_t width, height;
if (!surface->buffer_ref.buffer) {
- weston_surface_set_size(surface, 0, 0);
+ surface_set_size(surface, 0, 0);
return;
}
@@ -1260,7 +1267,7 @@ weston_surface_set_size_from_buffer(struct weston_surface *surface)
width = width / surface->buffer_viewport.scale;
height = height / surface->buffer_viewport.scale;
- weston_surface_set_size(surface, width, height);
+ surface_set_size(surface, width, height);
}
WL_EXPORT uint32_t
diff --git a/src/compositor.h b/src/compositor.h
index f5a0ba42..f32a4976 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -1152,6 +1152,10 @@ weston_view_schedule_repaint(struct weston_view *view);
int
weston_surface_is_mapped(struct weston_surface *surface);
+WL_EXPORT void
+weston_surface_set_size(struct weston_surface *surface,
+ int32_t width, int32_t height);
+
void
weston_surface_schedule_repaint(struct weston_surface *surface);