summaryrefslogtreecommitdiff
path: root/shared/frame.c
diff options
context:
space:
mode:
authorLouis-Francis Ratté-Boulianne <lfrb@collabora.com>2017-11-13 16:20:55 -0500
committerDaniel Stone <daniels@collabora.com>2017-12-05 14:09:24 +0000
commit864e39bf96edd86906239f6c079fab2550df41f7 (patch)
tree63f02ad72917ef7765c22a23c19567f902383e4f /shared/frame.c
parente5d655c4840ff96e45e8faead55be944f45c4f47 (diff)
xwm: Deal with title in a smarter way when there isn't enough space
The title in X11 windows and Wayland application using Weston toy toolkit were placing the title in a very naive fashion. It was only try to center the string in the title bar. This patch: * Makes sure the title isn't renderer underneath buttons; * Move the title to the left if the titlebar isn't large enough; * Clip the end of the title if needed. Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
Diffstat (limited to 'shared/frame.c')
-rw-r--r--shared/frame.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/shared/frame.c b/shared/frame.c
index eb0cd77a..5ca7e08b 100644
--- a/shared/frame.c
+++ b/shared/frame.c
@@ -98,6 +98,8 @@ struct frame {
int opaque_margin;
int geometry_dirty;
+ cairo_rectangle_int_t title_rect;
+
uint32_t status;
struct wl_list buttons;
@@ -532,6 +534,11 @@ frame_refresh_geometry(struct frame *frame)
}
}
+ frame->title_rect.x = x_l;
+ frame->title_rect.y = y;
+ frame->title_rect.width = x_r - x_l;
+ frame->title_rect.height = titlebar_height;
+
frame->geometry_dirty = 0;
}
@@ -938,7 +945,8 @@ frame_repaint(struct frame *frame, cairo_t *cr)
cairo_save(cr);
theme_render_frame(frame->theme, cr, frame->width, frame->height,
- frame->title, &frame->buttons, flags);
+ frame->title, &frame->title_rect,
+ &frame->buttons, flags);
cairo_restore(cr);
wl_list_for_each(button, &frame->buttons, link)