Discussion:
[zathura] [PATCH] Girara statusbar and inputbar fixes for GTK3
Abdó Roig-Maranges
2013-07-08 00:35:34 UTC
Permalink
Hi again,

I've done some changes on girara statusbar, inputbar and friends. It all
started because on GTK3, notification and inputbar had different heights.

I attach a patch with three commits:

1. reorganize widgets from statusbar inputbar and friends.

Just put them all under a common container "bottom box", and make sure the
heights of all the bars are the same. This solves the issue I had with
heights on gtk3.

There is a mysterious -5 for the gtk2 height setup that I don't know where
it comes from. Without it sizes do not match. Also the GTK3 part uses some
CSS styling! Oh well, maybe somene else can improve it!

2. make the bottom box an overlay on top of view

I discovered gtk3's GtkOverlay widget, that puts widgets on top of
others. I used it to make the bottom box (the container grouping the bars
and completion menu) into an overlay on top of the main view.

The idea is that now showing / hiding the inputbar does not trigger a
resize event on the view. This way we can eventually get rid of some hacks!
I'm thinking about the recent jumplist thing that messes with the gtk event
loop...

Unfortunately, GtkOverlay is gtk3 only, and doing overlays in gtk2 seemed
trickier. We would probably need to subclass a container and mess with
child positioning...

3. add a configuration setting for statusbar vertical padding

Well, it was easy enough, and now I can align zathura's statusbar with
emacs when put side by side :)

For 1. above, I had to change girara's structs. As everything is public in
there, this means we need to recompile zathura too, otherwise it segfaults.

Good night.

Abd?.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: girara-statusbar-thing.patch
Type: text/x-diff
Size: 15917 bytes
Desc: statusbar things for gtk3
URL: <http://lists.pwmt.org/archive/zathura/attachments/20130708/2a151ef9/attachment.patch>
Sebastian Ramacher
2013-07-09 16:13:34 UTC
Permalink
Hi,

I didn't look at the patches in detail, but here are some first
comments.
Post by Abdó Roig-Maranges
Hi again,
I've done some changes on girara statusbar, inputbar and friends. It all
started because on GTK3, notification and inputbar had different heights.
1. reorganize widgets from statusbar inputbar and friends.
Just put them all under a common container "bottom box", and make sure the
heights of all the bars are the same. This solves the issue I had with
heights on gtk3.
There is a mysterious -5 for the gtk2 height setup that I don't know where
it comes from. Without it sizes do not match. Also the GTK3 part uses some
CSS styling! Oh well, maybe somene else can improve it!
2. make the bottom box an overlay on top of view
I discovered gtk3's GtkOverlay widget, that puts widgets on top of
others. I used it to make the bottom box (the container grouping the bars
and completion menu) into an overlay on top of the main view.
The idea is that now showing / hiding the inputbar does not trigger a
resize event on the view. This way we can eventually get rid of some hacks!
I'm thinking about the recent jumplist thing that messes with the gtk event
loop...
Unfortunately, GtkOverlay is gtk3 only, and doing overlays in gtk2 seemed
trickier. We would probably need to subclass a container and mess with
child positioning...
I think that once we get the GTK3 stuff working properly [1], we should just
get rid of the GTK2 support.
Post by Abdó Roig-Maranges
3. add a configuration setting for statusbar vertical padding
Well, it was easy enough, and now I can align zathura's statusbar with
emacs when put side by side :)
For 1. above, I had to change girara's structs. As everything is public in
there, this means we need to recompile zathura too, otherwise it segfaults.
Oh, yeah, that's an ABI break. Do we need the new members anywhere
outside of girara? If not, I'd say we introduce a
girara_session_private_s struct and add a pointer to it at the end of
girara_session_s. This wouldn't break the ABI.

[1] "working properly" in the sense that we are able to set the default
GTK version to 3 and maybe do one release with that as default and see
if there are any major regressions.
Post by Abdó Roig-Maranges
Good night.
Abd?.
From cc858bcb172aa963b7f9b11e01510d56cc23b9ef Mon Sep 17 00:00:00 2001
From: Abdo Roig-Maranges <abdo.roig at gmail.com>
Date: Sun, 7 Jul 2013 22:58:26 +0200
Subject: [PATCH 1/3] reorganize widgets from statusbar inputbar and friends
We group the status input notification and completion widgets into a new
bottom_box container.
Also, make sure, particularly in GTK3, that status, input and
notification bars get the same height.
---
completion.c | 2 +-
session.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
session.h | 1 +
statusbar.c | 12 +++++++---
4 files changed, 76 insertions(+), 10 deletions(-)
diff --git a/completion.c b/completion.c
index 030a073..caa975f 100644
--- a/completion.c
+++ b/completion.c
@@ -380,7 +380,7 @@ girara_isc_completion(girara_session_t* session, girara_argument_t* argument, gi
if (entries != NULL) {
entries_current = (argument->n == GIRARA_NEXT) ? g_list_last(entries) : entries;
- gtk_box_pack_start(session->gtk.box, GTK_WIDGET(session->gtk.results), FALSE, FALSE, 0);
+ gtk_box_pack_start(session->gtk.bottom_box, GTK_WIDGET(session->gtk.results), FALSE, FALSE, 0);
gtk_widget_show(GTK_WIDGET(session->gtk.results));
}
}
diff --git a/session.c b/session.c
index 338ea7a..053a67d 100644
--- a/session.c
+++ b/session.c
@@ -88,11 +88,13 @@ girara_session_create()
/* create widgets */
#if GTK_MAJOR_VERSION == 2
session->gtk.box = GTK_BOX(gtk_vbox_new(FALSE, 0));
+ session->gtk.bottom_box = GTK_BOX(gtk_vbox_new(FALSE, 0));
session->gtk.statusbar_entries = GTK_BOX(gtk_hbox_new(FALSE, 0));
session->gtk.tabbar = gtk_hbox_new(TRUE, 0);
session->gtk.inputbar_box = GTK_BOX(gtk_hbox_new(TRUE, 0));
#else
session->gtk.box = GTK_BOX(gtk_box_new(GTK_ORIENTATION_VERTICAL, 0));
+ session->gtk.bottom_box = GTK_BOX(gtk_box_new(GTK_ORIENTATION_VERTICAL, 0));
session->gtk.statusbar_entries = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0));
session->gtk.tabbar = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
session->gtk.inputbar_box = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0));
@@ -216,15 +218,66 @@ girara_session_init(girara_session_t* session, const char* sessionname)
/* notification area */
gtk_container_add(GTK_CONTAINER(session->gtk.notification_area), GTK_WIDGET(session->gtk.notification_text));
- gtk_misc_set_alignment(GTK_MISC(session->gtk.notification_text), 0.0, 0.0);
- gtk_misc_set_padding(GTK_MISC(session->gtk.notification_text), 2, 2);
+ gtk_misc_set_alignment(GTK_MISC(session->gtk.notification_text), 0.0, 0.5);
gtk_label_set_use_markup(GTK_LABEL(session->gtk.notification_text), TRUE);
/* inputbar */
- gtk_entry_set_inner_border(session->gtk.inputbar_entry, NULL);
gtk_entry_set_has_frame(session->gtk.inputbar_entry, FALSE);
gtk_editable_set_editable(GTK_EDITABLE(session->gtk.inputbar_entry), TRUE);
+ /* we want inputbar_entry the same height as notification_text and statusbar,
+ so that when inputbar_entry is hidden, the size of the bottom_box remains
+ the same. We need to get rid of the builtin padding in the GtkEntry
+ widget. */
+
+ guint ypadding = 2; /* total amount of padding (top + bottom) */
+ guint leftpadding = 4; /* left padding */
+
+#if (GTK_MAJOR_VERSION == 3)
+ /* gtk_entry_set_inner_border is deprecated since gtk 3.4 and does nothing. */
+ GtkCssProvider* provider = gtk_css_provider_new();
+ char css[256];
+ const char* css_pattern = "#bottom_box { padding:%dpx 0px %dpx %dpx; }";
+ sprintf(css, css_pattern, ypadding - ypadding/2, ypadding/2, leftpadding);
+
+ gtk_css_provider_load_from_data(provider, css, strlen(css), NULL);
+ GdkDisplay *display = gdk_display_get_default ();
+ GdkScreen *screen = gdk_display_get_default_screen (display);
+ gtk_style_context_add_provider_for_screen (screen,
+ GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ g_object_unref (provider);
+
+ gtk_widget_set_name(session->gtk.inputbar_entry, "bottom_box");
+ gtk_widget_set_name(session->gtk.notification_text, "bottom_box");
+#else
+ // TODO: test this GTK2 block
+ GtkBorder inner_border = {
+ .left = leftpadding,
+ .right = 0,
+ .top = ypadding - ypadding/2,
+ .bottom = ypadding/2
+ };
+
+ gtk_entry_set_inner_border(session->gtk.inputbar_entry, &inner_border);
+
+ /* obtain the actual inputbar height */
+ /* TODO: for some reason does not match */
+ 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 other
+ widgets get larger than the inputbar */
+ guint statusbar_height = req.height - 5;
+
+ /* force all widgets to have the same height as inputbar */
+ gtk_widget_set_size_request(GTK_WIDGET(session->gtk.inputbar_entry), -1, statusbar_height);
+ gtk_widget_set_size_request(GTK_WIDGET(session->gtk.statusbar_entries), -1, statusbar_height);
+ gtk_widget_set_size_request(GTK_WIDGET(session->gtk.notification_text), -1, statusbar_height);
+
+ /* set horizontal padding. same for statusbar entries in statusbar.c */
+ gtk_misc_set_padding(GTK_MISC(session->gtk.notification_text), leftpadding, 0);
+#endif
+
session->signals.inputbar_key_pressed = g_signal_connect(
G_OBJECT(session->gtk.inputbar_entry),
"key-press-event",
@@ -249,10 +302,18 @@ girara_session_init(girara_session_t* session, const char* sessionname)
gtk_box_set_homogeneous(session->gtk.inputbar_box, FALSE);
gtk_box_set_spacing(session->gtk.inputbar_box, 5);
+ /* inputbar box */
gtk_box_pack_start(GTK_BOX(session->gtk.inputbar_box), GTK_WIDGET(session->gtk.inputbar_dialog), FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(session->gtk.inputbar_box), GTK_WIDGET(session->gtk.inputbar_entry), TRUE, TRUE, 0);
gtk_container_add(GTK_CONTAINER(session->gtk.inputbar), GTK_WIDGET(session->gtk.inputbar_box));
+ /* bottom box */
+ gtk_box_set_spacing(session->gtk.bottom_box, 0);
+
+ gtk_box_pack_end(GTK_BOX(session->gtk.bottom_box), GTK_WIDGET(session->gtk.inputbar), TRUE, TRUE, 0);
+ gtk_box_pack_end(GTK_BOX(session->gtk.bottom_box), GTK_WIDGET(session->gtk.notification_area), TRUE, TRUE, 0);
+ gtk_box_pack_end(GTK_BOX(session->gtk.bottom_box), GTK_WIDGET(session->gtk.statusbar), TRUE, TRUE, 0);
+
/* tabs */
gtk_notebook_set_show_border(session->gtk.tabs, FALSE);
gtk_notebook_set_show_tabs(session->gtk.tabs, FALSE);
@@ -260,9 +321,7 @@ girara_session_init(girara_session_t* session, const char* sessionname)
/* packing */
gtk_box_pack_start(session->gtk.box, GTK_WIDGET(session->gtk.tabbar), FALSE, FALSE, 0);
gtk_box_pack_start(session->gtk.box, GTK_WIDGET(session->gtk.view), TRUE, TRUE, 0);
- gtk_box_pack_start(session->gtk.box, GTK_WIDGET(session->gtk.statusbar), FALSE, FALSE, 0);
- gtk_box_pack_start(session->gtk.box, GTK_WIDGET(session->gtk.notification_area), FALSE, FALSE, 0);
- gtk_box_pack_end( session->gtk.box, GTK_WIDGET(session->gtk.inputbar), FALSE, FALSE, 0);
+ gtk_box_pack_end(session->gtk.box, GTK_WIDGET(session->gtk.bottom_box), FALSE, FALSE, 0);
/* parse color values */
typedef struct color_setting_mapping_s
diff --git a/session.h b/session.h
index 5e44f53..bc1c2ca 100644
--- a/session.h
+++ b/session.h
@@ -27,6 +27,7 @@ struct girara_session_s
GtkBox *box; /**< A box that contains all widgets */
GtkWidget *view; /**< The view area of the applications widgets */
GtkWidget *viewport; /**< The viewport of view */
+ GtkBox *bottom_box; /**< Box grouping input, status and notification */
GtkWidget *statusbar; /**< The statusbar */
GtkBox *statusbar_entries; /**< Statusbar entry box */
GtkWidget *notification_area; /**< The notification area */
diff --git a/statusbar.c b/statusbar.c
index 67a1a85..1b8cc2d 100644
--- a/statusbar.c
+++ b/statusbar.c
@@ -25,10 +25,17 @@ girara_statusbar_item_add(girara_session_t* session, bool expand, bool fill, boo
gtk_widget_override_font(GTK_WIDGET(item->text), session->style.font);
/* set properties */
- gtk_misc_set_alignment(GTK_MISC(item->text), left ? 0.0 : 1.0, 0.0);
- gtk_misc_set_padding(GTK_MISC(item->text), 2, 4);
+ gtk_misc_set_alignment(GTK_MISC(item->text), left ? 0.0 : 1.0, 0.5);
gtk_label_set_use_markup(item->text, TRUE);
+#if (GTK_MAJOR_VERSION == 3)
+ /* add name so it uses a custom style */
+ gtk_widget_set_name(item->text, "bottom_box");
+#else
+ /* set padding */
+ gtk_misc_set_padding(GTK_MISC(item->text), 4, 0);
+#endif
+
if (callback != NULL) {
g_signal_connect(G_OBJECT(item->box), "button-press-event", G_CALLBACK(callback), session);
}
@@ -85,4 +92,3 @@ girara_statusbar_set_background(girara_session_t* session, const char* color)
return true;
}
-
--
1.8.3.2
From b90f8b0c572a4e251b6b885ffa249dc7bedd8fe2 Mon Sep 17 00:00:00 2001
From: Abdo Roig-Maranges <abdo.roig at gmail.com>
Date: Mon, 8 Jul 2013 00:05:58 +0200
Subject: [PATCH 2/3] make the bottom box an overlay on top of view
On GTK3, we make the bottom_box container that groups status, input
notification and completions, into an overlay on top of the main view.
This means that hiding the inputbar no loger triggers a content resize,
and we will be able, eventually, to get rid of some ugly hacks elsewhere.
---
session.c | 27 +++++++++++++++++++++++----
session.h | 1 +
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/session.c b/session.c
index 053a67d..381b9a3 100644
--- a/session.c
+++ b/session.c
@@ -88,12 +88,14 @@ girara_session_create()
/* create widgets */
#if GTK_MAJOR_VERSION == 2
session->gtk.box = GTK_BOX(gtk_vbox_new(FALSE, 0));
+ session->gtk.overlay = NULL;
session->gtk.bottom_box = GTK_BOX(gtk_vbox_new(FALSE, 0));
session->gtk.statusbar_entries = GTK_BOX(gtk_hbox_new(FALSE, 0));
session->gtk.tabbar = gtk_hbox_new(TRUE, 0);
session->gtk.inputbar_box = GTK_BOX(gtk_hbox_new(TRUE, 0));
#else
session->gtk.box = GTK_BOX(gtk_box_new(GTK_ORIENTATION_VERTICAL, 0));
+ session->gtk.overlay = gtk_overlay_new();
session->gtk.bottom_box = GTK_BOX(gtk_box_new(GTK_ORIENTATION_VERTICAL, 0));
session->gtk.statusbar_entries = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0));
session->gtk.tabbar = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
@@ -209,10 +211,6 @@ girara_session_init(girara_session_t* session, const char* sessionname)
gtk_widget_modify_bg(GTK_WIDGET(session->gtk.viewport), GTK_STATE_NORMAL, &(session->style.default_background));
#endif
- /* box */
- gtk_box_set_spacing(session->gtk.box, 0);
- gtk_container_add(GTK_CONTAINER(session->gtk.window), GTK_WIDGET(session->gtk.box));
-
/* statusbar */
gtk_container_add(GTK_CONTAINER(session->gtk.statusbar), GTK_WIDGET(session->gtk.statusbar_entries));
@@ -318,11 +316,32 @@ girara_session_init(girara_session_t* session, const char* sessionname)
gtk_notebook_set_show_border(session->gtk.tabs, FALSE);
gtk_notebook_set_show_tabs(session->gtk.tabs, FALSE);
+#if (GTK_MAJOR_VERSION == 3)
/* packing */
+ gtk_box_set_spacing(session->gtk.box, 0);
+ gtk_box_pack_start(session->gtk.box, GTK_WIDGET(session->gtk.tabbar), FALSE, FALSE, 0);
+ gtk_box_pack_start(session->gtk.box, GTK_WIDGET(session->gtk.view), TRUE, TRUE, 0);
+
+ /* box */
+ gtk_container_add(GTK_CONTAINER(session->gtk.overlay), GTK_WIDGET(session->gtk.box));
+ /* overlay */
+ g_object_set(session->gtk.bottom_box, "halign", GTK_ALIGN_FILL, NULL);
+ g_object_set(session->gtk.bottom_box, "valign", GTK_ALIGN_END, NULL);
+
+ gtk_overlay_add_overlay(GTK_OVERLAY(session->gtk.overlay), GTK_WIDGET(session->gtk.bottom_box));
+ gtk_container_add(GTK_CONTAINER(session->gtk.window), GTK_WIDGET(session->gtk.overlay));
+
+#else
+ /* packing */
+ gtk_box_set_spacing(session->gtk.box, 0);
gtk_box_pack_start(session->gtk.box, GTK_WIDGET(session->gtk.tabbar), FALSE, FALSE, 0);
gtk_box_pack_start(session->gtk.box, GTK_WIDGET(session->gtk.view), TRUE, TRUE, 0);
gtk_box_pack_end(session->gtk.box, GTK_WIDGET(session->gtk.bottom_box), FALSE, FALSE, 0);
+ /* box */
+ gtk_container_add(GTK_CONTAINER(session->gtk.window), GTK_WIDGET(session->gtk.box));
+#endif
+
/* parse color values */
typedef struct color_setting_mapping_s
{
diff --git a/session.h b/session.h
index bc1c2ca..a50d04d 100644
--- a/session.h
+++ b/session.h
@@ -27,6 +27,7 @@ struct girara_session_s
GtkBox *box; /**< A box that contains all widgets */
GtkWidget *view; /**< The view area of the applications widgets */
GtkWidget *viewport; /**< The viewport of view */
+ GtkWidget *overlay; /**< So we can overlay bottom_box on top of view */
GtkBox *bottom_box; /**< Box grouping input, status and notification */
GtkWidget *statusbar; /**< The statusbar */
GtkBox *statusbar_entries; /**< Statusbar entry box */
--
1.8.3.2
From 4c0747ab9db0ca9be0b7c6d0f9b7a9b14495584b Mon Sep 17 00:00:00 2001
From: Abdo Roig-Maranges <abdo.roig at gmail.com>
Date: Mon, 8 Jul 2013 01:36:47 +0200
Subject: [PATCH 3/3] add a configuration setting for statusbar vertical
padding
---
config.c | 2 ++
session.c | 5 +++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/config.c b/config.c
index 5910d43..e14df33 100644
--- a/config.c
+++ b/config.c
@@ -184,6 +184,7 @@ girara_config_load_default(girara_session_t* session)
}
/* values */
+ int statusbar_padding = 2;
int window_width = 800;
int window_height = 600;
int n_completion_items = 15;
@@ -220,6 +221,7 @@ 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, "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 381b9a3..dde197b 100644
--- a/session.c
+++ b/session.c
@@ -228,8 +228,9 @@ girara_session_init(girara_session_t* session, const char* sessionname)
the same. We need to get rid of the builtin padding in the GtkEntry
widget. */
- guint ypadding = 2; /* total amount of padding (top + bottom) */
- guint leftpadding = 4; /* left padding */
+ guint ypadding = 2; /* total amount of padding (top + bottom) */
+ guint leftpadding = 4; /* left padding */
+ girara_setting_get(session, "statusbar-padding", &ypadding);
#if (GTK_MAJOR_VERSION == 3)
/* gtk_entry_set_inner_border is deprecated since gtk 3.4 and does nothing. */
--
1.8.3.2
_______________________________________________
zathura mailing list
zathura at lists.pwmt.org
http://lists.pwmt.org/mailman/listinfo/zathura
--
Sebastian Ramacher
Abdó Roig-Maranges
2013-07-09 17:32:08 UTC
Permalink
Hi
Post by Sebastian Ramacher
I think that once we get the GTK3 stuff working properly [1], we should just
get rid of the GTK2 support.
ok
Post by Sebastian Ramacher
Oh, yeah, that's an ABI break. Do we need the new members anywhere outside of
girara? If not, I'd say we introduce a girara_session_private_s struct and add
a pointer to it at the end of girara_session_s. This wouldn't break the ABI.
It's just a couple of container widgets for the overlay and the floating
stuff. I had them in session.gtk, but they don't need to be public. I attach a
patch on top of the previous one doing as you suggest. Plus some other minor
tweaks.

Abd?.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: girara-statusbar-2.patch
Type: text/x-diff
Size: 9923 bytes
Desc: don't break it
URL: <http://lists.pwmt.org/archive/zathura/attachments/20130709/e296c944/attachment-0001.patch>
Sebastian Ramacher
2013-07-09 18:04:06 UTC
Permalink
I have applied this now with some modifications.

I've renamed the private member to private_data since private is a
reserved keyword in C++ and hence I try to avoid it in headers. It's
also in internal.h now. No user of girara needs to know about the
definition.
Post by Abdó Roig-Maranges
Hi
Post by Sebastian Ramacher
I think that once we get the GTK3 stuff working properly [1], we should just
get rid of the GTK2 support.
ok
Post by Sebastian Ramacher
Oh, yeah, that's an ABI break. Do we need the new members anywhere outside of
girara? If not, I'd say we introduce a girara_session_private_s struct and add
a pointer to it at the end of girara_session_s. This wouldn't break the ABI.
It's just a couple of container widgets for the overlay and the floating
stuff. I had them in session.gtk, but they don't need to be public. I attach a
patch on top of the previous one doing as you suggest. Plus some other minor
tweaks.
Abd?.
From 6b1cad1c76a21c2193f3e288eb959b69af1b9c4e Mon Sep 17 00:00:00 2001
From: Abdo Roig-Maranges <abdo.roig at gmail.com>
Date: Mon, 8 Jul 2013 16:07:21 +0200
Subject: [PATCH 1/3] fix css style
---
session.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/session.c b/session.c
index dde197b..9f095d4 100644
--- a/session.c
+++ b/session.c
@@ -236,7 +236,7 @@ girara_session_init(girara_session_t* session, const char* sessionname)
/* gtk_entry_set_inner_border is deprecated since gtk 3.4 and does nothing. */
GtkCssProvider* provider = gtk_css_provider_new();
char css[256];
- const char* css_pattern = "#bottom_box { padding:%dpx 0px %dpx %dpx; }";
+ const char* css_pattern = "#bottom_box { border-style: none; margin: 0px 0px 0px 0px; padding:%dpx 0px %dpx %dpx; }";
sprintf(css, css_pattern, ypadding - ypadding/2, ypadding/2, leftpadding);
Please use the string functions provided by glib for such code.
I've replaced it with a call to g_strdup_printf so we don't have to
remember to change the size of css if we ever need to change the CSS.

Cheers
--
Sebastian Ramacher
Marwan Tanager
2013-07-09 17:11:08 UTC
Permalink
Post by Abdó Roig-Maranges
2. make the bottom box an overlay on top of view
I discovered gtk3's GtkOverlay widget, that puts widgets on top of
others. I used it to make the bottom box (the container grouping the bars
and completion menu) into an overlay on top of the main view.
The idea is that now showing / hiding the inputbar does not trigger a
resize event on the view. This way we can eventually get rid of some hacks!
I'm thinking about the recent jumplist thing that messes with the gtk event
loop...
This sounds nice, but a quick test of your patch, without
zathura_jumplist_hide_inputbar, didn't work as expected, and the issue
addressed in 87a7f2310f44184217b8cd1ec0036b0e86f981c5 still persists.


--
Marwan
Abdó Roig-Maranges
2013-07-09 17:44:12 UTC
Permalink
It seems to work for me. Can you provide a case in which it fails? Have you
compiled it with GTK3? The overlay thing is GTK3 only. With GTK2 the issue
remains, and we can't get rid of zathura_jumplist_hide_inputbar.

Abd?.
Post by Marwan Tanager
This sounds nice, but a quick test of your patch, without
zathura_jumplist_hide_inputbar, didn't work as expected, and the issue
addressed in 87a7f2310f44184217b8cd1ec0036b0e86f981c5 still persists.
Marwan Tanager
2013-07-09 17:48:00 UTC
Permalink
Post by Marwan Tanager
Post by Abdó Roig-Maranges
2. make the bottom box an overlay on top of view
I discovered gtk3's GtkOverlay widget, that puts widgets on top of
others. I used it to make the bottom box (the container grouping the bars
and completion menu) into an overlay on top of the main view.
The idea is that now showing / hiding the inputbar does not trigger a
resize event on the view. This way we can eventually get rid of some hacks!
I'm thinking about the recent jumplist thing that messes with the gtk event
loop...
This sounds nice, but a quick test of your patch, without
zathura_jumplist_hide_inputbar, didn't work as expected, and the issue
addressed in 87a7f2310f44184217b8cd1ec0036b0e86f981c5 still persists.
Sorry, I forgot to rebuild against GTK3 (thought that we're using it by
default). I've tested again with GTK3 and everything is lovely without
zathura_jumplist_hide_inputbar.

Thanks Abd?, this is actually the perfect solution that I had wished to have
for this problem. I was unaware of the GtkOverlay thing, though.

With this patch, I think we can also safely remove the ZATHURA_ADJUST_INPUTBAR
mode introduced in 1702fb620a5a6436d4c083951c73a33658249f53.


--
Marwan
Sebastian Ramacher
2013-08-22 10:35:07 UTC
Permalink
Hi,

maybe it was a bit to early to merge this changes. The statusbar now
doesn't work correctly anymore in GTK2. One of the bugs caused by the
changes is http://bugs.pwmt.org/issue338. Also, the padding doesn't look
right.

Could you maybe take a look at that?

Regards
--
Sebastian Ramacher
Abdó Roig-Maranges
2013-08-22 12:15:55 UTC
Permalink
Oops, sorry about that...
One of the bugs caused by the changes is http://bugs.pwmt.org/issue338.
I attach a patch fixing the :info thing. A bit of a hack remains to set the
statusbar height the same as the inputbar (session.c lines 284-291). Do you know
of a better solution? The notification box should be fine now.
Also, the padding doesn't look right.
I have changed a few lines regarding horizontal padding (add the same amount of
padding left and right). I don't think this is what you meant though. Could you
elaborate? It looks fine to me.


Abd?.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gtk2-fix.patch
Type: text/x-diff
Size: 3440 bytes
Desc: girara patch
URL: <http://lists.pwmt.org/archive/zathura/attachments/20130822/8cd24c62/attachment.patch>
Sebastian Ramacher
2013-08-22 19:43:44 UTC
Permalink
Post by Abdó Roig-Maranges
Oops, sorry about that...
One of the bugs caused by the changes is http://bugs.pwmt.org/issue338.
I attach a patch fixing the :info thing. A bit of a hack remains to set the
statusbar height the same as the inputbar (session.c lines 284-291). Do you know
of a better solution? The notification box should be fine now.
Thank you. That's fixed, yes.
Post by Abdó Roig-Maranges
Also, the padding doesn't look right.
I have changed a few lines regarding horizontal padding (add the same amount of
padding left and right). I don't think this is what you meant though. Could you
elaborate? It looks fine to me.
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).

I hope the images are large enough.

Regards
--
Sebastian Ramacher
-------------- next part --------------
A non-text attachment was scrubbed...
Name: girara-0.1.6.png
Type: image/png
Size: 1567 bytes
Desc: not available
URL: <Loading Image...>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: girara-0.1.7-git.png
Type: image/png
Size: 1483 bytes
Desc: not available
URL: <Loading Image...>
Abdó Roig-Maranges
2013-08-23 12:29:39 UTC
Permalink
Hi,
Post by Sebastian Ramacher
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?.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-gtk2-padding.patch
Type: text/x-diff
Size: 5081 bytes
Desc: fix padding
URL: <http://lists.pwmt.org/archive/zathura/attachments/20130823/21f12ff2/attachment.patch>
Sebastian Ramacher
2013-08-23 16:01:49 UTC
Permalink
Hi,
Post by Abdó Roig-Maranges
Post by Sebastian Ramacher
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.
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.
Thanks for the quick fix! That's very much appreciated.

Cheers
--
Sebastian Ramacher
Loading...