From: Stefano Facchini <stefano.facchini@gmail.com>
To: "Jan Djärv" <jan.h.d@swipnet.se>
Cc: 9451@debbugs.gnu.org
Subject: bug#9451: GTK3 toolbar style
Date: Tue, 20 Dec 2011 12:01:51 +0100 [thread overview]
Message-ID: <1324378911.31734.2.camel@localhost.localdomain> (raw)
In-Reply-To: <4E667EB5.4070105@swipnet.se>
[-- Attachment #1: Type: text/plain, Size: 910 bytes --]
Il giorno mar, 06/09/2011 alle 22.12 +0200, Jan Djärv ha scritto:
>
> Stefano Facchini skrev 2011-09-06 18:11:
> > When compiling with GTK3 the toolbar style should be set to
> > "primary-toolbar" to match the new theme. However, simply setting the
> > style in this way makes the toolbar looks bad because of the GtkEventBox
> > wrapped around every GtkButton.
> >
> > It seems that the GtkEventBox is only used in connecting signals which
> > can be connected directly to the GtkButton itself. In the attached patch
> > the event box is removed and the toolbar style set to "primary-toolbar".
> >
>
> The GtkEventBox is there to make tooltips work on disabled buttons. Any patch
> made must preserve that.
>
> Jan D.
>
Since Gtk+ 3.3.6 it is possible to make transparent the background of a
widget. This allows to solve the GtkEventBox issue when using a primary
toolbar style. A patch is attached.
[-- Attachment #2: gtk3primarytoolbar.patch --]
[-- Type: text/x-patch, Size: 1533 bytes --]
=== modified file 'src/gtkutil.c'
--- src/gtkutil.c 2011-11-27 18:33:17 +0000
+++ src/gtkutil.c 2011-12-20 10:45:52 +0000
@@ -4175,6 +4175,9 @@
xg_create_tool_bar (FRAME_PTR f)
{
struct x_output *x = f->output_data.x;
+#if (defined HAVE_GTK3) && GTK_CHECK_VERSION (3, 3, 6)
+ GtkStyleContext *gsty;
+#endif
x->toolbar_widget = gtk_toolbar_new ();
x->toolbar_detached = 0;
@@ -4183,6 +4186,10 @@
gtk_toolbar_set_style (GTK_TOOLBAR (x->toolbar_widget), GTK_TOOLBAR_ICONS);
toolbar_set_orientation (x->toolbar_widget, GTK_ORIENTATION_HORIZONTAL);
+#if (defined HAVE_GTK3) && GTK_CHECK_VERSION (3, 3, 6)
+ gsty = gtk_widget_get_style_context (x->toolbar_widget);
+ gtk_style_context_add_class (gsty, "primary-toolbar");
+#endif
}
@@ -4231,6 +4238,22 @@
GtkWidget *wb = gtk_button_new ();
/* The eventbox is here so we can have tooltips on disabled items. */
GtkWidget *weventbox = gtk_event_box_new ();
+#if (defined HAVE_GTK3) && GTK_CHECK_VERSION (3, 3, 6)
+ GtkCssProvider *css_prov = gtk_css_provider_new ();
+ GtkStyleContext *gsty;
+
+ gtk_css_provider_load_from_data (css_prov,
+ "GtkEventBox {"
+ " background-color: transparent;"
+ "}",
+ -1, NULL);
+
+ gsty = gtk_widget_get_style_context (weventbox);
+ gtk_style_context_add_provider (gsty,
+ GTK_STYLE_PROVIDER (css_prov),
+ GTK_STYLE_PROVIDER_PRIORITY_USER);
+ g_object_unref (css_prov);
+#endif
if (wimage && !text_image)
gtk_box_pack_start (GTK_BOX (vb), wimage, TRUE, TRUE, 0);
next prev parent reply other threads:[~2011-12-20 11:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-06 16:11 bug#9451: GTK3 toolbar style Stefano Facchini
2011-09-06 20:12 ` Jan Djärv
2011-12-20 11:01 ` Stefano Facchini [this message]
2012-07-15 14:22 ` Chong Yidong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1324378911.31734.2.camel@localhost.localdomain \
--to=stefano.facchini@gmail.com \
--cc=9451@debbugs.gnu.org \
--cc=jan.h.d@swipnet.se \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.