[sysprof] libsysprof-ui: try to keep text aligned on 5/8's split
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof] libsysprof-ui: try to keep text aligned on 5/8's split
- Date: Wed, 29 May 2019 22:42:32 +0000 (UTC)
commit b34d781cdd6b97c7d311be1d275af8daf93360f5
Author: Christian Hergert <chergert redhat com>
Date: Wed May 22 16:12:57 2019 -0700
libsysprof-ui: try to keep text aligned on 5/8's split
src/libsysprof-ui/sysprof-cell-renderer-duration.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/src/libsysprof-ui/sysprof-cell-renderer-duration.c
b/src/libsysprof-ui/sysprof-cell-renderer-duration.c
index 5d1bdc4..b0fc704 100644
--- a/src/libsysprof-ui/sysprof-cell-renderer-duration.c
+++ b/src/libsysprof-ui/sysprof-cell-renderer-duration.c
@@ -152,10 +152,22 @@ sysprof_cell_renderer_duration_render (GtkCellRenderer *renderer,
pango_layout_set_text (layout, str->str, str->len);
pango_layout_get_pixel_size (layout, &w, &h);
- if ((r.x + r.width + w) < (cell_area->x + cell_area->width))
- cairo_move_to (cr, r.x + r.width, r.y + ((r.height - h) / 2));
+ if (r.x < (cell_area->x + (cell_area->width / 8 * 5)))
+ {
+ /* This is if we're in the first half of screen */
+ if ((r.x + r.width + w) < (cell_area->x + cell_area->width))
+ cairo_move_to (cr, r.x + r.width, r.y + ((r.height - h) / 2));
+ else
+ cairo_move_to (cr, r.x - w, r.y + ((r.height - h) / 2));
+ }
else
- cairo_move_to (cr, r.x - w, r.y + ((r.height - h) / 2));
+ {
+ /* This is if we're in the second half of screen, do opposite */
+ if ((r.x - r.width) >= cell_area->x)
+ cairo_move_to (cr, r.x - w, r.y + ((r.height - h) / 2));
+ else
+ cairo_move_to (cr, r.x + r.width, r.y + ((r.height - h) / 2));
+ }
if (off > -1)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]