[ghex: 1/2] Distribute extra empty space between offsets and xdisp
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ghex: 1/2] Distribute extra empty space between offsets and xdisp
- Date: Wed, 5 Sep 2018 12:23:09 +0000 (UTC)
commit 8abbf4875bb85820b0a1b854ea2ce564e7b7962e
Author: Rok Mandeljc <rok mandeljc gmail com>
Date: Mon Jul 23 22:05:45 2018 +0200
Distribute extra empty space between offsets and xdisp
If offsets are shown, distribute the extra empty space among the
gap between the offsets and xdisp and the gap between xdisp and
adisp instead of allocating it all to the second gap.
Allows better visual separation of offsets from the first xdisp
column on themes that do not have any padding (e.g., adwaita on
Fedora 28).
src/gtkhex.c | 7 +++++--
src/gtkhex.h | 2 +-
2 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/gtkhex.c b/src/gtkhex.c
index 5f745d0..1469423 100644
--- a/src/gtkhex.c
+++ b/src/gtkhex.c
@@ -910,7 +910,7 @@ draw_shadow (GtkWidget *widget,
border,
8 * gh->char_width + padding.left + padding.right,
allocation.height - 2 * border);
- x += 8 * gh->char_width + padding.left + padding.right;
+ x += 8 * gh->char_width + padding.left + padding.right + gh->extra_width/2;
}
gtk_render_frame (context,
@@ -1005,6 +1005,8 @@ static void recalc_displays(GtkHex *gh, guint width, guint height) {
xcpl = gh->cpl*2 + (gh->cpl - 1)/gh->group_type;
gh->xdisp_width = xcpl*gh->char_width;
+ gh->extra_width = total_width - gh->xdisp_width - gh->adisp_width;
+
if (gh->priv->disp_buffer)
g_free (gh->priv->disp_buffer);
@@ -1972,7 +1974,7 @@ static void gtk_hex_size_allocate(GtkWidget *w, GtkAllocation *alloc) {
my_alloc.width = 8*gh->char_width;
gtk_widget_size_allocate(gh->offsets, &my_alloc);
gtk_widget_queue_draw(gh->offsets);
- my_alloc.x += padding.left + padding.right + my_alloc.width;
+ my_alloc.x += padding.left + padding.right + my_alloc.width + gh->extra_width/2;
}
gtk_widget_get_requisition(gh->scrollbar, &sb_req);
@@ -2139,6 +2141,7 @@ static void gtk_hex_init(GtkHex *gh, gpointer klass) {
gh->starting_offset = 0;
gh->xdisp_width = gh->adisp_width = 200;
+ gh->extra_width = 0;
gh->active_view = VIEW_HEX;
gh->group_type = GROUP_BYTE;
gh->lines = gh->vis_lines = gh->top_line = gh->cpl = 0;
diff --git a/src/gtkhex.h b/src/gtkhex.h
index f43392f..fdbe626 100644
--- a/src/gtkhex.h
+++ b/src/gtkhex.h
@@ -103,7 +103,7 @@ struct _GtkHex
gint lines, vis_lines, cpl, top_line;
gint cursor_shown;
- gint xdisp_width, adisp_width;
+ gint xdisp_width, adisp_width, extra_width;
/*< private > */
GtkHexPrivate *priv;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]