From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Frans Oilinki Newsgroups: gmane.emacs.devel Subject: Re: GTK3 deprecation fix (GtkFontSelection replaced with GtkFontChooser) Date: Mon, 20 Aug 2012 17:45:15 +0800 Message-ID: References: <50261F1D.8070605@swipnet.se> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1345455945 16905 80.91.229.3 (20 Aug 2012 09:45:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 20 Aug 2012 09:45:45 +0000 (UTC) Cc: emacs-devel@gnu.org To: =?UTF-8?Q?Jan_Dj=C3=A4rv?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 20 11:45:45 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 1T3OYK-0006ua-GG for ged-emacs-devel@m.gmane.org; Mon, 20 Aug 2012 11:45:44 +0200 Original-Received: from localhost ([::1]:57117 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3OYJ-00045s-5Q for ged-emacs-devel@m.gmane.org; Mon, 20 Aug 2012 05:45:43 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35253) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3OYF-00044p-68 for emacs-devel@gnu.org; Mon, 20 Aug 2012 05:45:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T3OYD-0003CG-Dd for emacs-devel@gnu.org; Mon, 20 Aug 2012 05:45:39 -0400 Original-Received: from mail-qa0-f48.google.com ([209.85.216.48]:38504) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3OYD-0003C5-8r for emacs-devel@gnu.org; Mon, 20 Aug 2012 05:45:37 -0400 Original-Received: by qady1 with SMTP id y1so3188717qad.0 for ; Mon, 20 Aug 2012 02:45:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=3OZj9TZa5ocXLuypG+vcrR4qCcduTvu+FKbD+V4JkdA=; b=OuhZvb4/ZzuiCqmubF+D0CEA47Wl3t1xyeuiRVbKUerOYg3tNnH3hI9mLm/vFrkt9F wRmjLzEywb/XCz9rcMmKfRroARvvy+4vPP7ezjx5yIfy/dfv74qXqx6eAEpWLo6bHlHd WXI797DLnvVJfyNRLm9wBA67P9tIo6tJUAei//mtpwZo+3z+e43wriMSQ6fswYm5epf1 LF+WlA+BXgkFnYOdXXKkJ/YhtcIMYsFysT9XtMqEVc8zlI0dl/C8BPn/TZ6vQbEp9NH8 +EDW4fofbxpOfSuJgGjS515XXvJaW03REq4YmAwMMP6i4qBzYkSvV+pl4RAaxlWkg5Fm yMiA== Original-Received: by 10.229.114.217 with SMTP id f25mr12278025qcq.127.1345455936151; Mon, 20 Aug 2012 02:45:36 -0700 (PDT) Original-Received: by 10.229.91.78 with HTTP; Mon, 20 Aug 2012 02:45:15 -0700 (PDT) In-Reply-To: <50261F1D.8070605@swipnet.se> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.216.48 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:152694 Archived-At: Hello Jan, 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". 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... ;-) Frans On Sat, Aug 11, 2012 at 5:00 PM, Jan Dj=C3=A4rv wrote: > 2012-08-10 11:35, Frans Oilinki skrev: >> >> Hello, > > > Hello. > > I guess we have to conform then. I fixed this in a backwards compatible > fashion. > > 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 whe= n > it can't render a font, like this: > > (emacs:9374): Pango-WARNING **: failed to choose a font, expect ugly outp= ut. > engine-type=3D'PangoRenderFc', script=3D'latin' > > (emacs:9374): Pango-WARNING **: failed to choose a font, expect ugly outp= ut. > engine-type=3D'PangoRenderFc', script=3D'common' > > and it uses a red X for minus on some themes (see screenshot) which is > confusing. But hey, this is "progress". > > Jan D. > > > > >> >> I just tried building the newest emacs master branch (git cloned >> repository), running Ubuntu 12.04 GNU/Linux system. >> >> 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". >> >> The file "src/gtkutil.c" gave the following warning: >> >> 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 =E2=80=98xg_get_font_name=E2=80=99: >> gtkutil.c:2003:3: error: =E2=80=98gtk_font_selection_dialog_new=E2= =80=99 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: =E2=80=98gtk_font_selection_dialog_set_fon= t_name=E2=80=99 >> 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: =E2=80=98gtk_font_selection_dialog_get_fon= t_name=E2=80=99 >> 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/sr= c' >> make: *** [src] Error 2 >> >> I found GTK3 API documentation and within couple of minutes of reading >> quickly applied the following fix: >> >> $ 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 */ >> >> - 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); >> >> gtk_widget_set_name (w, "emacs-fontdialog"); >> >> @@ -2015,8 +2014,7 @@ xg_get_font_name (FRAME_PTR f, const char >> *default_name) >> #endif >> >> 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)); >> >> gtk_widget_destroy (w); >> return fontname; >> >> 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. >> >> 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. >> >> Best regards and thanks for everybody's work for fabulous text editing >> environment (or whatever emacs should be called), >> >> Frans >> > >