gl-renderer: Add support for per-output multi-texture borders.
The first advantage of this new API is that it is per-output instead of
global to the gl_renderer instance. This means that different windows can
have different titles, different button states, etc. The new api also uses
four textures (one for each side) instead of one. This allows you to draw
real borders with text and buttons in them instead of a simple image that
gets streached.
Images will be scaled as needed, so the right and left can be one pixel
tall if desired.
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
diff --git a/src/gl-renderer.h b/src/gl-renderer.h
index 0342134..8a36c89 100644
--- a/src/gl-renderer.h
+++ b/src/gl-renderer.h
@@ -39,6 +39,13 @@
#endif
+enum gl_renderer_border_side {
+ GL_RENDERER_BORDER_TOP = 0,
+ GL_RENDERER_BORDER_LEFT = 1,
+ GL_RENDERER_BORDER_RIGHT = 2,
+ GL_RENDERER_BORDER_BOTTOM = 3,
+};
+
struct gl_renderer_interface {
const EGLint *opaque_attribs;
const EGLint *alpha_attribs;
@@ -57,6 +64,38 @@
EGLSurface (*output_surface)(struct weston_output *output);
+ /* Sets the output border.
+ *
+ * The side specifies the side for which we are setting the border.
+ * The width and height are the width and height of the border.
+ * The tex_width patemeter specifies the width of the actual
+ * texture; this may be larger than width if the data is not
+ * tightly packed.
+ *
+ * The top and bottom textures will extend over the sides to the
+ * full width of the bordered window while. The right and left
+ * edges, however, will extend only to the top and bottom of the
+ * compositor surface. This is demonstrated by the picture below:
+ *
+ * +-----------------------+
+ * | TOP |
+ * +-+-------------------+-+
+ * | | | |
+ * |L| |R|
+ * |E| |I|
+ * |F| |G|
+ * |T| |H|
+ * | | |T|
+ * | | | |
+ * +-+-------------------+-+
+ * | BOTTOM |
+ * +-----------------------+
+ */
+ void (*output_set_border)(struct weston_output *output,
+ enum gl_renderer_border_side side,
+ int32_t width, int32_t height,
+ int32_t tex_width, unsigned char *data);
+
void (*set_border)(struct weston_compositor *ec,
int32_t width, int32_t height,
void *data, int32_t *edges);