window: Allow hinting of a preference for RGB565 when creating a window
And check if the renderer supports the RGB565 format for wl_shm buffers
before creating the cairo surface and requesting the buffer.
It can save quite some memory with big surfaces such as desktop
backgrounds.
diff --git a/clients/window.h b/clients/window.h
index 75be165..e045b95 100644
--- a/clients/window.h
+++ b/clients/window.h
@@ -139,6 +139,8 @@
#define SURFACE_HINT_RESIZE 0x10
+#define SURFACE_HINT_RGB565 0x100
+
cairo_surface_t *
display_create_surface(struct display *display,
struct wl_surface *surface,
@@ -383,6 +385,15 @@
void
window_set_text_cursor_position(struct window *window, int32_t x, int32_t y);
+enum preferred_format {
+ WINDOW_PREFERRED_FORMAT_NONE,
+ WINDOW_PREFERRED_FORMAT_RGB565
+};
+
+void
+window_set_preferred_format(struct window *window,
+ enum preferred_format format);
+
int
widget_set_tooltip(struct widget *parent, char *entry, float x, float y);