From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?iso-8859-1?Q?Jan_Dj=E4rv?= Newsgroups: gmane.emacs.devel Subject: Re: GTK3 deprecation fix (GtkFontSelection replaced with GtkFontChooser) Date: Tue, 21 Aug 2012 22:54:20 +0200 Message-ID: <24E4E73B-A6C4-426C-A9BF-4D72784B1BD8@swipnet.se> References: <50261F1D.8070605@swipnet.se> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1345582479 27152 80.91.229.3 (21 Aug 2012 20:54:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 21 Aug 2012 20:54:39 +0000 (UTC) Cc: emacs-devel@gnu.org To: Frans Oilinki Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 21 22:54:40 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1T3vTD-0008HI-Iv for ged-emacs-devel@m.gmane.org; Tue, 21 Aug 2012 22:54:39 +0200 Original-Received: from localhost ([::1]:34414 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3vTC-0001Bs-7u for ged-emacs-devel@m.gmane.org; Tue, 21 Aug 2012 16:54:38 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:43987) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3vT9-0001B3-9O for emacs-devel@gnu.org; Tue, 21 Aug 2012 16:54:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T3vT1-0000CY-Tp for emacs-devel@gnu.org; Tue, 21 Aug 2012 16:54:35 -0400 Original-Received: from mailout.attendit.se ([83.140.103.4]:37894) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3vT1-0000Bf-G4 for emacs-devel@gnu.org; Tue, 21 Aug 2012 16:54:27 -0400 Original-Received: from mail01.melmac.se (mail01.melmac.se [62.20.26.80]) by mailout.attendit.se (Postfix) with ESMTP id 499A250102 for ; Tue, 21 Aug 2012 22:48:53 +0200 (CEST) Original-Received: (qmail 19781 invoked by uid 89); 21 Aug 2012 20:54:04 -0000 Original-Received: from h-46-59-42-18.na.cust.bahnhof.se (HELO coolsville.localdomain) (boel.djarv@bdtv.se@46.59.42.18) by mail01.melmac.se with ESMTPA; 21 Aug 2012 20:54:04 -0000 Original-Received: from [172.20.199.13] (zeplin [172.20.199.13]) by coolsville.localdomain (Postfix) with ESMTPSA id B3E9F7FA05E; Tue, 21 Aug 2012 22:54:21 +0200 (CEST) In-Reply-To: X-Mailer: Apple Mail (2.1278) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 83.140.103.4 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:152717 Archived-At: 20 aug 2012 kl. 11:45 skrev Frans Oilinki: > Hello Jan, Hello. >=20 > Sorry for late reply, I just now noticed your email by searching my > overpouring inbox after witnessing the change in git repository as a > result of performing "git pull". >=20 > After my initial email report I compared unpatched version of emacs > with older font selection dialog (running in a different machine), and > also wondered about the usability degradation. I wish things will > quickly improve in GTK3 front so that I will not have to feel guilty > for lowering usability of Emacs with my report... ;-) When Gtk+ changes we can just move with it. This change would have been = made at some point anyway, so don't feel guilty :-) On the plus side, it enabled the fix of 3228. Jan D. >=20 > Frans >=20 > On Sat, Aug 11, 2012 at 5:00 PM, Jan Dj=E4rv = wrote: >> 2012-08-10 11:35, Frans Oilinki skrev: >>>=20 >>> Hello, >>=20 >>=20 >> Hello. >>=20 >> I guess we have to conform then. I fixed this in a backwards = compatible >> fashion. >>=20 >> The chooser dialog is a huge step backwards in usability. It is = larger, it >> is slower (esp. X over a slow link), it emits warnings to the console = when >> it can't render a font, like this: >>=20 >> (emacs:9374): Pango-WARNING **: failed to choose a font, expect ugly = output. >> engine-type=3D'PangoRenderFc', script=3D'latin' >>=20 >> (emacs:9374): Pango-WARNING **: failed to choose a font, expect ugly = output. >> engine-type=3D'PangoRenderFc', script=3D'common' >>=20 >> and it uses a red X for minus on some themes (see screenshot) which = is >> confusing. But hey, this is "progress". >>=20 >> Jan D. >>=20 >>=20 >>=20 >>=20 >>>=20 >>> I just tried building the newest emacs master branch (git cloned >>> repository), running Ubuntu 12.04 GNU/Linux system. >>>=20 >>> I made a mistake of adding option "--enable-gcc-warnings" to >>> "./configure" (not anticipating it would add option -Werror :-). The >>> complete list of options to ./configure: "--prefix=3D/usr/local >>> --program-suffix=3D-git.master --enable-check-lisp-object-type >>> --enable-link-time-optimization --enable-gcc-warnings >>> --with-x-toolkit=3Dgtk3 --with-x". >>>=20 >>> The file "src/gtkutil.c" gave the following warning: >>>=20 >>> gcc -std=3Dgnu99 -c -Demacs -I. >>> -I/home/fo/work/OpenSource/Emacs/emacs/src -I../lib >>> -I/home/fo/work/OpenSource/Emacs/emacs/src/../lib -pthread = -isystem >>> /usr/include/gtk-3.0 -isystem /usr/include/pango-1.0 -isystem >>> /usr/include/gio-unix-2.0/ -isystem /usr/include/atk-1.0 -isystem >>> /usr/include/cairo -isystem /usr/include/gdk-pixbuf-2.0 -isystem >>> /usr/include/freetype2 -isystem /usr/include/glib-2.0 -isystem >>> /usr/lib/x86_64-linux-gnu/glib-2.0/include -isystem >>> /usr/include/pixman-1 -isystem /usr/include/libpng12 -isystem >>> /usr/include/freetype2 -isystem /usr/include/alsa -pthread >>> -isystem /usr/include/librsvg-2.0 -isystem /usr/include/glib-2.0 >>> -isystem /usr/lib/x86_64-linux-gnu/glib-2.0/include -isystem >>> /usr/include/gdk-pixbuf-2.0 -isystem /usr/include/cairo -isystem >>> /usr/include/libpng12 -isystem /usr/include/pixman-1 -isystem >>> /usr/include/freetype2 -fopenmp -isystem /usr/include/ImageMagick >>> -isystem /usr/include/libxml2 -isystem /usr/include/dbus-1.0 >>> -isystem /usr/lib/x86_64-linux-gnu/dbus-1.0/include -pthread >>> -isystem /usr/include/glib-2.0 -isystem >>> /usr/lib/x86_64-linux-gnu/glib-2.0/include -pthread -isystem >>> /usr/include/gconf/2 -isystem /usr/include/dbus-1.0 -isystem >>> /usr/lib/x86_64-linux-gnu/dbus-1.0/include -isystem >>> /usr/include/glib-2.0 -isystem >>> /usr/lib/x86_64-linux-gnu/glib-2.0/include -isystem >>> /usr/include/freetype2 -isystem /usr/include/freetype2 -MMD = -MF >>> deps/gtkutil.d -MP -isystem /usr/include/p11-kit-1 -Wall -W >>> -Wformat-y2k -Wformat-security -Winit-self -Wmissing-include-dirs >>> -Wunused -Wunknown-pragmas -Wstrict-aliasing >>> -Wdeclaration-after-statement -Wpointer-arith -Wbad-function-cast >>> -Wcast-align -Wwrite-strings -Wstrict-prototypes >>> -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations >>> -Wmissing-noreturn -Wmissing-format-attribute -Wpacked -Winvalid-pch >>> -Wvolatile-register-var -Wdisabled-optimization >>> -Wbuiltin-macro-redefined -Wmudflap -Wpacked-bitfield-compat >>> -Wattributes -Wcoverage-mismatch -Wunused-macros -Wabi -Wcpp >>> -Wdeprecated -Wdeprecated-declarations -Wdiv-by-zero >>> -Wdouble-promotion -Wendif-labels -Wextra -Wformat-contains-nul >>> -Wformat-extra-args -Wformat-zero-length -Wformat=3D2 -Wmultichar >>> -Wnormalized=3Dnfc -Woverflow -Wpointer-to-int-cast -Wpragmas >>> -Wsuggest-attribute=3Dconst -Wsuggest-attribute=3Dnoreturn = -Wtrampolines >>> -Wno-missing-field-initializers -Wno-missing-field-initializers >>> -Wno-sign-compare -Wno-type-limits -Wno-switch -Wno-unused-parameter >>> -Wno-format-nonliteral -Wno-logical-op -fdiagnostics-show-option >>> -funit-at-a-time -Werror -g -O2 -flto=3D1 gtkutil.c >>> gtkutil.c: In function =91xg_get_font_name=92: >>> gtkutil.c:2003:3: error: =91gtk_font_selection_dialog_new=92 is >>> deprecated (declared at >>> /usr/include/gtk-3.0/gtk/deprecated/gtkfontsel.h:142): Use >>> 'GtkFontChooser' instead [-Werror=3Ddeprecated-declarations] >>> gtkutil.c:2006:3: error: = =91gtk_font_selection_dialog_set_font_name=92 >>> is deprecated (declared at >>> /usr/include/gtk-3.0/gtk/deprecated/gtkfontsel.h:153): Use >>> 'GtkFontChooser' instead [-Werror=3Ddeprecated-declarations] >>> gtkutil.c:2019:7: error: = =91gtk_font_selection_dialog_get_font_name=92 >>> is deprecated (declared at >>> /usr/include/gtk-3.0/gtk/deprecated/gtkfontsel.h:151): Use >>> 'GtkFontChooser' instead [-Werror=3Ddeprecated-declarations] >>> cc1: all warnings being treated as errors >>> make[1]: *** [gtkutil.o] Error 1 >>> make[1]: *** Waiting for unfinished jobs.... >>> make[1]: Leaving directory = `/home/fo/work/OpenSource/Emacs/emacs/src' >>> make: *** [src] Error 2 >>>=20 >>> I found GTK3 API documentation and within couple of minutes of = reading >>> quickly applied the following fix: >>>=20 >>> $ git diff >>> diff --git a/src/gtkutil.c b/src/gtkutil.c >>> index 4879479..ce9b851 100644 >>> --- a/src/gtkutil.c >>> +++ b/src/gtkutil.c >>> @@ -2000,11 +2000,10 @@ xg_get_font_name (FRAME_PTR f, const = char >>> *default_name) >>> sigblock (sigmask (__SIGRTMIN)); >>> #endif /* HAVE_PTHREAD */ >>>=20 >>> - w =3D gtk_font_selection_dialog_new ("Pick a font"); >>> + w =3D gtk_font_chooser_dialog_new ("Pick a font", NULL); >>> if (!default_name) >>> default_name =3D "Monospace 10"; >>> - gtk_font_selection_dialog_set_font_name >>> (GTK_FONT_SELECTION_DIALOG (w), >>> - default_name); >>> + gtk_font_chooser_set_font (GTK_FONT_CHOOSER (w), = default_name); >>>=20 >>> gtk_widget_set_name (w, "emacs-fontdialog"); >>>=20 >>> @@ -2015,8 +2014,7 @@ xg_get_font_name (FRAME_PTR f, const char >>> *default_name) >>> #endif >>>=20 >>> if (done =3D=3D GTK_RESPONSE_OK) >>> - fontname =3D gtk_font_selection_dialog_get_font_name >>> - (GTK_FONT_SELECTION_DIALOG (w)); >>> + fontname =3D gtk_font_chooser_get_font(GTK_FONT_CHOOSER = (w)); >>>=20 >>> gtk_widget_destroy (w); >>> return fontname; >>>=20 >>> This fixed the compilation for my Ubuntu 12.04 machine (gtk3 seems = to >>> be version 3.4.2). I tried selecting font (by [SHIFT] + >>> [LEFT-MOUSE-BUTTON]), and the new font selection widget worked for = me. >>>=20 >>> Note that I have never before done programming with GTK API, so you >>> might review this with some care, and check the compatibility with = the >>> supported versions of GTK3 if you choose to apply this kind of fix = to >>> future versions of Emacs. >>>=20 >>> Best regards and thanks for everybody's work for fabulous text = editing >>> environment (or whatever emacs should be called), >>>=20 >>> Frans >>>=20 >>=20 >>=20