summaryrefslogtreecommitdiff
path: root/overlay/x11
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-08-18 18:40:03 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-08-18 18:40:03 +0100
commit74032f4b4559fee909aec97b16617c40a81bc642 (patch)
tree0d0cfd55cfb73d5deab232824522d9b71033b6f0 /overlay/x11
parent7d950fa6f26e823a741f8c2db95ce4dd96c8d432 (diff)
overlay: Rearrange GUI state
Planning a new layout... Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'overlay/x11')
-rw-r--r--overlay/x11/x11-overlay.c45
1 files changed, 27 insertions, 18 deletions
diff --git a/overlay/x11/x11-overlay.c b/overlay/x11/x11-overlay.c
index b9144087..41c02f58 100644
--- a/overlay/x11/x11-overlay.c
+++ b/overlay/x11/x11-overlay.c
@@ -118,7 +118,7 @@ static void x11_overlay_destroy(void *data)
}
cairo_surface_t *
-x11_overlay_create(enum position position, int max_width, int max_height)
+x11_overlay_create(enum position position, int *width, int *height)
{
Display *dpy;
Screen *scr;
@@ -171,23 +171,29 @@ x11_overlay_create(enum position position, int max_width, int max_height)
XSetErrorHandler(noop);
- w = scr->width;
- switch (position & 7) {
- default:
- case 0:
- case 2: w >>= 1; break;
- }
- if (max_width > 0 && w > max_width)
- w = max_width;
-
- h = scr->height;
- switch ((position >> 4) & 7) {
- default:
- case 0:
- case 2: h >>= 1; break;
- }
- if (max_height > 0 && h > max_height)
- h = max_height;
+ if (*width == -1) {
+ w = scr->width;
+ switch (position & 7) {
+ default:
+ case 0:
+ case 2: w >>= 1; break;
+ }
+ } else if (*width > scr->width) {
+ w = scr->width;
+ } else
+ w = *width;
+
+ if (*height == -1) {
+ h = scr->height;
+ switch ((position >> 4) & 7) {
+ default:
+ case 0:
+ case 2: h >>= 1; break;
+ }
+ } else if (*height > scr->height)
+ h = scr->height;
+ else
+ h = *height;
image = XvCreateImage(dpy, port, FOURCC_RGB565, NULL, w, h);
if (image == NULL)
@@ -301,6 +307,9 @@ x11_overlay_create(enum position position, int max_width, int max_height)
XvSetPortAttribute(dpy, port, XInternAtom(dpy, "XV_ALWAYS_ON_TOP", True), 1);
close(fd);
+
+ *width = image->width;
+ *height = image->height;
return surface;
err_surface: