summaryrefslogtreecommitdiff
path: root/shared
diff options
context:
space:
mode:
authorBoyan Ding <stu_dby@126.com>2014-08-05 15:22:04 +0800
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2014-08-19 16:45:15 +0300
commit850a514137c13771cb26841d596a2b282898dcf1 (patch)
tree7c380bda1c3360663300aba3e4ab610796567194 /shared
parentc06a180dd574c24ca50766461c10d3a6bfa3ad2b (diff)
downloadweston-850a514137c13771cb26841d596a2b282898dcf1.tar.gz
cairo-util: Draw solid titlebar for frames with only buttons
Previously geometry was changed to leave space for titlebar if a frame has only buttons but no title. This patch fixes theme_render_frame to avoid transparent titlebar. Signed-off-by: Boyan Ding <stu_dby@126.com>
Diffstat (limited to 'shared')
-rw-r--r--shared/cairo-util.c8
-rw-r--r--shared/cairo-util.h5
-rw-r--r--shared/frame.c2
3 files changed, 10 insertions, 5 deletions
diff --git a/shared/cairo-util.c b/shared/cairo-util.c
index 2a332490..26286c5e 100644
--- a/shared/cairo-util.c
+++ b/shared/cairo-util.c
@@ -28,6 +28,7 @@
#include <string.h>
#include <stdio.h>
#include <math.h>
+#include <wayland-util.h>
#include <cairo.h>
#include "cairo-util.h"
@@ -413,7 +414,8 @@ theme_destroy(struct theme *t)
void
theme_render_frame(struct theme *t,
cairo_t *cr, int width, int height,
- const char *title, uint32_t flags)
+ const char *title, struct wl_list *buttons,
+ uint32_t flags)
{
cairo_text_extents_t extents;
cairo_font_extents_t font_extents;
@@ -439,7 +441,7 @@ theme_render_frame(struct theme *t,
else
source = t->inactive_frame;
- if (title)
+ if (title || !wl_list_empty(buttons))
top_margin = t->titlebar_height;
else
top_margin = t->width;
@@ -449,7 +451,7 @@ theme_render_frame(struct theme *t,
width - margin * 2, height - margin * 2,
t->width, top_margin);
- if (title) {
+ if (title || !wl_list_empty(buttons)) {
cairo_rectangle (cr, margin + t->width, margin,
width - (margin + t->width) * 2,
t->titlebar_height - t->width);
diff --git a/shared/cairo-util.h b/shared/cairo-util.h
index 4493b0d9..fb25c341 100644
--- a/shared/cairo-util.h
+++ b/shared/cairo-util.h
@@ -26,6 +26,8 @@
#include <stdint.h>
#include <cairo.h>
+#include <wayland-util.h>
+
void
surface_flush_device(cairo_surface_t *surface);
@@ -69,7 +71,8 @@ theme_set_background_source(struct theme *t, cairo_t *cr, uint32_t flags);
void
theme_render_frame(struct theme *t,
cairo_t *cr, int width, int height,
- const char *title, uint32_t flags);
+ const char *title, struct wl_list *buttons,
+ uint32_t flags);
enum theme_location {
THEME_LOCATION_INTERIOR = 0,
diff --git a/shared/frame.c b/shared/frame.c
index 53f3f5f7..5ea0e120 100644
--- a/shared/frame.c
+++ b/shared/frame.c
@@ -853,7 +853,7 @@ frame_repaint(struct frame *frame, cairo_t *cr)
cairo_save(cr);
theme_render_frame(frame->theme, cr, frame->width, frame->height,
- frame->title, flags);
+ frame->title, &frame->buttons, flags);
cairo_restore(cr);
wl_list_for_each(button, &frame->buttons, link)