Hi,

> I've attached two screenshots of zathura 0.2.4 running with girara 0.1.6
> and girara 0.1.7 plus the patch. With girara 0.1.6 there is a lot more
> padding around the text in the statusbar and it's readable (maybe the
> status bar is just too small in 0.1.7 and it's not the padding after
> all, I don't know).

Ok, I don't see the same thing on my end. It may be due to the fact that I use a
larger font, I don't know... For me the statusbar has a reasonable padding, and
exactly the same height as the inputbar in both, GTK3 and GTK2.

Anyway, I attach another patch that does two things:

1. Adds config settings statusbar-h-padding and statusbar-v-padding to set the
   padding for status, input and notification bars. Defaults are

   statusbar-h-padding 8
   statusbar-v-padding 2

   The value means total padding, for instance, 8 = 4 (left) + 4 (right). If you
   don't like those defaults, they can be adjusted in config.c, of course.


2. Remove a hack for setting the statusbar height, that I suspect was the source
   of trouble. Now instead of set_size_request on the statusbar_entries GtkBox
   object, we set the padding on the individual statusbar items, as it was done
   before my GTK3 commits.

After this patch, the padding on status, notification and input bars should be
adjustable via config, and all 3 bars should be rendered exactly with the same
height.

Abdó.

>From 4d5bace156ed04e347b4eff36baed2c44cda911c Mon Sep 17 00:00:00 2001
From: Abdo Roig-Maranges <abdo.r...@gmail.com>
Date: Fri, 23 Aug 2013 13:43:16 +0200
Subject: [PATCH] add config options for vertical and horizontal padding in
 statusbar

Adds statusbar-h-padding and statusbar-v-padding options replacing
statusbar-padding, to adjust vertical and horizontal padding for the
status, input and notification bars.

In addition, we remove a GTK2 hack introduced in commit a026b72b297b7d8
for forcing the statusbar and inputbar to have the same height. Now we
adjust the statusbar items padding directly in girara_statusbar_item_add.
---
 config.c    |  6 ++++--
 session.c   | 13 ++-----------
 statusbar.c |  8 +++++++-
 3 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/config.c b/config.c
index 51aed4e..b8cc80e 100644
--- a/config.c
+++ b/config.c
@@ -188,7 +188,8 @@ girara_config_load_default(girara_session_t* session)
   }
 
   /* values */
-  int statusbar_padding     = 2;
+  int statusbar_h_padding     = 8;
+  int statusbar_v_padding     = 2;
   int window_width          = 800;
   int window_height         = 600;
   int n_completion_items    = 15;
@@ -225,7 +226,8 @@ girara_config_load_default(girara_session_t* session)
   girara_setting_add(session, "word-separator",           " /.-=&#?",           STRING,  TRUE,  NULL, NULL, NULL);
   girara_setting_add(session, "window-width",             &window_width,        INT,     TRUE,  _("Initial window width"), NULL, NULL);
   girara_setting_add(session, "window-height",            &window_height,       INT,     TRUE,  _("Initial window height"), NULL, NULL);
-  girara_setting_add(session, "statusbar-padding",        &statusbar_padding,   INT,     TRUE,  _("Vertical padding for the status input and notification bars"), NULL, NULL);
+  girara_setting_add(session, "statusbar-h-padding",      &statusbar_h_padding, INT,     TRUE,  _("Horizontal padding for the status input and notification bars"), NULL, NULL);
+  girara_setting_add(session, "statusbar-v-padding",      &statusbar_v_padding, INT,     TRUE,  _("Vertical padding for the status input and notification bars"), NULL, NULL);
   girara_setting_add(session, "n-completion-items",       &n_completion_items,  INT,     TRUE,  _("Number of completion items"), NULL, NULL);
   girara_setting_add(session, "show-scrollbars",          &show_scrollbars,     BOOLEAN, FALSE, _("Show both the horizontal and vertical scrollbars"), cb_scrollbars, NULL);
   girara_setting_add(session, "show-h-scrollbar",         &show_scrollbars,     BOOLEAN, FALSE, _("Show the horizontal scrollbar"), cb_scrollbars, NULL);
diff --git a/session.c b/session.c
index 71c35ac..bdd16a9 100644
--- a/session.c
+++ b/session.c
@@ -248,7 +248,8 @@ girara_session_init(girara_session_t* session, const char* sessionname)
 
   guint ypadding = 2;         /* total amount of padding (top + bottom) */
   guint xpadding = 8;         /* total amount of padding (left + right) */
-  girara_setting_get(session, "statusbar-padding", &ypadding);
+  girara_setting_get(session, "statusbar-h-padding", &xpadding);
+  girara_setting_get(session, "statusbar-v-padding", &ypadding);
 
 #if (GTK_MAJOR_VERSION == 3)
   /* gtk_entry_set_inner_border is deprecated since gtk 3.4 and does nothing. */
@@ -279,16 +280,6 @@ girara_session_init(girara_session_t* session, const char* sessionname)
   /* set inner borders for inputbar and notification_text */
   gtk_entry_set_inner_border(session->gtk.inputbar_entry, &inner_border);
   gtk_misc_set_padding(GTK_MISC(session->gtk.notification_text), xpadding/2, ypadding/2);
-
-  /* obtain the actual inputbar height */
-  GtkRequisition req;
-  gtk_widget_size_request(GTK_WIDGET(session->gtk.inputbar_entry), &req);
-  /* have no idea where the extra 5 pixels come from. without this, the statusbar
-     gets larger than the inputbar */
-  guint statusbar_height = req.height - 5;
-
-  /* force statusbar to have same height as inputbar */
-  gtk_widget_set_size_request(GTK_WIDGET(session->gtk.statusbar_entries), -1, statusbar_height);
 #endif
 
   session->signals.inputbar_key_pressed = g_signal_connect(
diff --git a/statusbar.c b/statusbar.c
index 8cfa8d7..bfe163e 100644
--- a/statusbar.c
+++ b/statusbar.c
@@ -4,6 +4,7 @@
 #include "session.h"
 #include "datastructures.h"
 #include "internal.h"
+#include "settings.h"
 
 #if GTK_MAJOR_VERSION == 2
 #include "gtk2-compat.h"
@@ -33,7 +34,12 @@ girara_statusbar_item_add(girara_session_t* session, bool expand, bool fill, boo
   gtk_widget_set_name(GTK_WIDGET(item->text), "bottom_box");
 #else
   /* set padding */
-  gtk_misc_set_padding(GTK_MISC(item->text), 4, 0);
+  guint ypadding = 2;         /* total amount of padding (top + bottom) */
+  guint xpadding = 8;         /* total amount of padding (left + right) */
+  girara_setting_get(session, "statusbar-h-padding", &xpadding);
+  girara_setting_get(session, "statusbar-v-padding", &ypadding);
+
+  gtk_misc_set_padding(GTK_MISC(item->text), xpadding/2, ypadding/2);
 #endif
 
   if (callback != NULL) {
-- 
1.8.3.4

_______________________________________________
zathura mailing list
zathura@lists.pwmt.org
http://lists.pwmt.org/mailman/listinfo/zathura

Reply via email to