commit 787e0ffeca962d25ffae4212e028fe6beaea48e7
parent 4fa7c605208a77f6fb03cb2ad4cdbdbe97e95b30
Author: Michael Forney <mforney@mforney.org>
Date: Wed, 11 Sep 2013 16:48:04 -0700
surface: Add resize event
Diffstat:
2 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/libswc/surface.c b/libswc/surface.c
@@ -115,8 +115,21 @@ static void set_size(struct swc_surface * surface,
/* Check if the surface was resized. */
if (width != surface->geometry.width || height != surface->geometry.height)
{
+ struct swc_surface_event_data data = {
+ .surface = surface,
+ .resize = {
+ .old_width = surface->geometry.width,
+ .old_height = surface->geometry.height,
+ .new_width = width,
+ .new_height = height
+ }
+ };
+
surface->geometry.width = width;
surface->geometry.height = height;
+
+ swc_send_event(&surface->event_signal,
+ SWC_SURFACE_EVENT_TYPE_RESIZE, &data);
}
}
diff --git a/libswc/surface.h b/libswc/surface.h
@@ -30,6 +30,22 @@
struct swc_surface;
+enum swc_surface_event_type
+{
+ SWC_SURFACE_EVENT_TYPE_RESIZE
+};
+
+struct swc_surface_event_data
+{
+ struct swc_surface * surface;
+
+ struct
+ {
+ uint32_t old_width, old_height;
+ uint32_t new_width, new_height;
+ } resize;
+};
+
enum swc_surface_commit_info
{
SWC_SURFACE_COMMIT_ATTACH = (1 << 0),