ds_output: Add ds_output_set_custom_mode
[platform/core/uifw/libds-tizen.git] / src / libds / backend / wayland / output.c
index c57820f..7728abf 100644 (file)
@@ -7,6 +7,7 @@
 #include "libds/output.h"
 #include "xdg-shell-client-protocol.h"
 
+#include "output.h"
 #include "backend.h"
 
 const struct ds_output_interface wl_output_iface;
@@ -14,6 +15,8 @@ static const struct xdg_surface_listener wl_output_xdg_surface_listener;
 static const struct xdg_toplevel_listener wl_output_xdg_toplevel_listener;
 
 static void output_update_cursor(struct ds_wl_output *output);
+static bool output_set_custom_mode(struct ds_output *ds_output,
+        int32_t width, int32_t height, int32_t refresh);
 
 struct ds_output *
 ds_wl_backend_create_output(struct ds_backend *ds_backend)
@@ -286,6 +289,14 @@ wl_output_iface_commit(struct ds_output *ds_output)
 
     output = wl_output_from_output(ds_output);
 
+    if (ds_output->pending.committed & DS_OUTPUT_STATE_MODE) {
+        if (!output_set_custom_mode(ds_output,
+                    ds_output->pending.custom_mode.width,
+                    ds_output->pending.custom_mode.height,
+                    ds_output->pending.custom_mode.refresh))
+            return false;
+    }
+
     ds_buffer = ds_output->pending.buffer;
     buffer = get_or_create_wl_buffer(output->backend, ds_buffer);
     if (!buffer)
@@ -355,3 +366,11 @@ static const struct xdg_toplevel_listener wl_output_xdg_toplevel_listener =
     .configure = wl_output_xdg_toplevel_handle_configure,
     .close = wl_output_xdg_toplevel_handle_close,
 };
+
+static bool output_set_custom_mode(struct ds_output *ds_output,
+        int32_t width, int32_t height, int32_t refresh)
+{
+    ds_output_update_custom_mode(ds_output, width, height, 0);
+
+    return true;
+}