From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefano Facchini Newsgroups: gmane.emacs.bugs Subject: bug#9451: GTK3 toolbar style Date: Tue, 06 Sep 2011 18:11:06 +0200 Message-ID: <1315325477.1105.17.camel@localhost.localdomain> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-OqzNKQnU06SBqJju0iik" X-Trace: dough.gmane.org 1315325613 5809 80.91.229.12 (6 Sep 2011 16:13:33 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 6 Sep 2011 16:13:33 +0000 (UTC) To: 9451@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Sep 06 18:13:26 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R0yH7-0005nR-5s for geb-bug-gnu-emacs@m.gmane.org; Tue, 06 Sep 2011 18:13:25 +0200 Original-Received: from localhost ([::1]:42845 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0yH6-0002g7-58 for geb-bug-gnu-emacs@m.gmane.org; Tue, 06 Sep 2011 12:13:24 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:33597) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0yGx-0002eX-Pj for bug-gnu-emacs@gnu.org; Tue, 06 Sep 2011 12:13:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R0yGw-0002rB-Jt for bug-gnu-emacs@gnu.org; Tue, 06 Sep 2011 12:13:15 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44356) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0yGw-0002r7-Hs for bug-gnu-emacs@gnu.org; Tue, 06 Sep 2011 12:13:14 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1R0yKc-00008y-92; Tue, 06 Sep 2011 12:17:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefano Facchini Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 06 Sep 2011 16:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 9451 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.1315325800519 (code B ref -1); Tue, 06 Sep 2011 16:17:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 6 Sep 2011 16:16:40 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R0yKG-00008K-9I for submit@debbugs.gnu.org; Tue, 06 Sep 2011 12:16:40 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R0yHv-0007p3-Qw for submit@debbugs.gnu.org; Tue, 06 Sep 2011 12:14:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R0yE9-0001xb-SY for submit@debbugs.gnu.org; Tue, 06 Sep 2011 12:10:27 -0400 Original-Received: from lists.gnu.org ([140.186.70.17]:50694) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0yE9-0001xX-Qy for submit@debbugs.gnu.org; Tue, 06 Sep 2011 12:10:21 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:55111) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0yE5-0001hS-RW for bug-gnu-emacs@gnu.org; Tue, 06 Sep 2011 12:10:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R0yDz-0001w6-Jz for bug-gnu-emacs@gnu.org; Tue, 06 Sep 2011 12:10:17 -0400 Original-Received: from mail-ew0-f41.google.com ([209.85.215.41]:33265) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0yDz-0001vs-FH for bug-gnu-emacs@gnu.org; Tue, 06 Sep 2011 12:10:11 -0400 Original-Received: by ewy9 with SMTP id 9so3186492ewy.0 for ; Tue, 06 Sep 2011 09:10:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=subject:from:to:date:content-type:x-mailer:message-id:mime-version; bh=UfZtlZ01n+/JDmUwREncHYhH301PcP5JdJkUH7rNhdM=; b=vimXOikdniu8Ebyc6CisPMq4wWtTloEfagUrvF49ZkS3gl0RP2Qk7rRv/hjihdm/92 wl5BrzE7nQ8EfZdZGibwifzruMpRaGipYej3SVNlDxLFO/ZzsBc8kp0ZCEsyCkR7ekPs 7t1sKPlJViZm1iSs+GxMQt/hgAbT9DCsOV370= Original-Received: by 10.14.11.149 with SMTP id 21mr1773373eex.160.1315325409290; Tue, 06 Sep 2011 09:10:09 -0700 (PDT) Original-Received: from [192.168.95.152] (qopt.unipv.it [193.206.68.137]) by mx.google.com with ESMTPS id f3sm1037800eea.4.2011.09.06.09.10.08 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 06 Sep 2011 09:10:08 -0700 (PDT) X-Mailer: Evolution 3.0.3 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Mailman-Approved-At: Tue, 06 Sep 2011 12:16:38 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Tue, 06 Sep 2011 12:17:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:50638 Archived-At: --=-OqzNKQnU06SBqJju0iik Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit 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". Feedback/comments welcome -- Stefano Facchini --=-OqzNKQnU06SBqJju0iik Content-Disposition: attachment; filename="gtk3toolbar.patch" Content-Type: text/x-patch; name="gtk3toolbar.patch"; charset="UTF-8" Content-Transfer-Encoding: 7bit === modified file 'src/gtkutil.c' --- src/gtkutil.c 2011-08-29 20:57:42 +0000 +++ src/gtkutil.c 2011-09-06 15:47:54 +0000 @@ -3855,7 +3855,7 @@ static gboolean xg_tool_bar_menu_proxy (GtkToolItem *toolitem, gpointer user_data) { - GtkButton *wbutton = GTK_BUTTON (XG_BIN_CHILD (XG_BIN_CHILD (toolitem))); + GtkButton *wbutton = GTK_BUTTON (XG_BIN_CHILD (toolitem)); GtkWidget *vb = XG_BIN_CHILD (wbutton); GtkWidget *c1; GtkLabel *wlbl = GTK_LABEL (xg_get_tool_bar_widgets (vb, &c1)); @@ -4165,6 +4165,9 @@ xg_create_tool_bar (FRAME_PTR f) { struct x_output *x = f->output_data.x; +#ifdef HAVE_GTK3 + GtkStyleContext *gsty; +#endif x->toolbar_widget = gtk_toolbar_new (); x->toolbar_detached = 0; @@ -4173,6 +4176,10 @@ gtk_toolbar_set_style (GTK_TOOLBAR (x->toolbar_widget), GTK_TOOLBAR_ICONS); toolbar_set_orientation (x->toolbar_widget, GTK_ORIENTATION_HORIZONTAL); +#ifdef HAVE_GTK3 + gsty = gtk_widget_get_style_context (x->toolbar_widget); + gtk_style_context_add_class (gsty, "primary-toolbar"); +#endif } @@ -4219,7 +4226,6 @@ GtkToolItem *ti = gtk_tool_item_new (); GtkWidget *vb = horiz ? gtk_hbox_new (FALSE, 0) : gtk_vbox_new (FALSE, 0); GtkWidget *wb = gtk_button_new (); - GtkWidget *weventbox = gtk_event_box_new (); if (wimage && !text_image) gtk_box_pack_start (GTK_BOX (vb), wimage, TRUE, TRUE, 0); @@ -4231,8 +4237,7 @@ gtk_button_set_focus_on_click (GTK_BUTTON (wb), FALSE); gtk_button_set_relief (GTK_BUTTON (wb), GTK_RELIEF_NONE); gtk_container_add (GTK_CONTAINER (wb), vb); - gtk_container_add (GTK_CONTAINER (weventbox), wb); - gtk_container_add (GTK_CONTAINER (ti), weventbox); + gtk_container_add (GTK_CONTAINER (ti), wb); if (wimage) { @@ -4247,7 +4252,6 @@ G_CALLBACK (xg_tool_bar_callback), gi); - g_object_set_data (G_OBJECT (weventbox), XG_FRAME_DATA, (gpointer)f); #ifndef HAVE_GTK3 /* Catch expose events to overcome an annoying redraw bug, see @@ -4273,11 +4277,11 @@ "leave", so we can have only one callback. The event will tell us what kind of event it is. */ /* The EMACS_INT cast avoids a warning. */ - g_signal_connect (G_OBJECT (weventbox), + g_signal_connect (G_OBJECT (wb), "enter-notify-event", G_CALLBACK (xg_tool_bar_help_callback), gi); - g_signal_connect (G_OBJECT (weventbox), + g_signal_connect (G_OBJECT (wb), "leave-notify-event", G_CALLBACK (xg_tool_bar_help_callback), gi); @@ -4480,7 +4484,7 @@ ti = NULL; } - if (ti) wbutton = XG_BIN_CHILD (XG_BIN_CHILD (ti)); + if (ti) wbutton = XG_BIN_CHILD (ti); /* Ignore invalid image specifications. */ image = PROP (TOOL_BAR_ITEM_IMAGES); --=-OqzNKQnU06SBqJju0iik--