From: "Jan Djärv" <jan.h.d@swipnet.se>
To: Frans Oilinki <moilinki@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: GTK3 deprecation fix (GtkFontSelection replaced with GtkFontChooser)
Date: Tue, 21 Aug 2012 22:54:20 +0200 [thread overview]
Message-ID: <24E4E73B-A6C4-426C-A9BF-4D72784B1BD8@swipnet.se> (raw)
In-Reply-To: <CAL2O=cBG99YB9W_ss6-tQUkEL_q+dPifh--PNr5pidvvqZZNQA@mail.gmail.com>
20 aug 2012 kl. 11:45 skrev Frans Oilinki:
> Hello Jan,
Hello.
>
> 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... ;-)
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.
>
> Frans
>
> On Sat, Aug 11, 2012 at 5:00 PM, Jan Djärv <jan.h.d@swipnet.se> 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 when
>> it can't render a font, like this:
>>
>> (emacs:9374): Pango-WARNING **: failed to choose a font, expect ugly output.
>> engine-type='PangoRenderFc', script='latin'
>>
>> (emacs:9374): Pango-WARNING **: failed to choose a font, expect ugly output.
>> engine-type='PangoRenderFc', script='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=/usr/local
>>> --program-suffix=-git.master --enable-check-lisp-object-type
>>> --enable-link-time-optimization --enable-gcc-warnings
>>> --with-x-toolkit=gtk3 --with-x".
>>>
>>> The file "src/gtkutil.c" gave the following warning:
>>>
>>> gcc -std=gnu99 -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=2 -Wmultichar
>>> -Wnormalized=nfc -Woverflow -Wpointer-to-int-cast -Wpragmas
>>> -Wsuggest-attribute=const -Wsuggest-attribute=noreturn -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=1 gtkutil.c
>>> gtkutil.c: In function ‘xg_get_font_name’:
>>> gtkutil.c:2003:3: error: ‘gtk_font_selection_dialog_new’ is
>>> deprecated (declared at
>>> /usr/include/gtk-3.0/gtk/deprecated/gtkfontsel.h:142): Use
>>> 'GtkFontChooser' instead [-Werror=deprecated-declarations]
>>> gtkutil.c:2006:3: error: ‘gtk_font_selection_dialog_set_font_name’
>>> is deprecated (declared at
>>> /usr/include/gtk-3.0/gtk/deprecated/gtkfontsel.h:153): Use
>>> 'GtkFontChooser' instead [-Werror=deprecated-declarations]
>>> gtkutil.c:2019:7: error: ‘gtk_font_selection_dialog_get_font_name’
>>> is deprecated (declared at
>>> /usr/include/gtk-3.0/gtk/deprecated/gtkfontsel.h:151): Use
>>> 'GtkFontChooser' instead [-Werror=deprecated-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
>>>
>>> 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 = gtk_font_selection_dialog_new ("Pick a font");
>>> + w = gtk_font_chooser_dialog_new ("Pick a font", NULL);
>>> if (!default_name)
>>> default_name = "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 == GTK_RESPONSE_OK)
>>> - fontname = gtk_font_selection_dialog_get_font_name
>>> - (GTK_FONT_SELECTION_DIALOG (w));
>>> + fontname = 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
>>>
>>
>>
prev parent reply other threads:[~2012-08-21 20:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-10 9:35 GTK3 deprecation fix (GtkFontSelection replaced with GtkFontChooser) Frans Oilinki
2012-08-11 9:00 ` Jan Djärv
2012-08-20 9:45 ` Frans Oilinki
2012-08-21 20:54 ` Jan Djärv [this message]
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=24E4E73B-A6C4-426C-A9BF-4D72784B1BD8@swipnet.se \
--to=jan.h.d@swipnet.se \
--cc=emacs-devel@gnu.org \
--cc=moilinki@gmail.com \
/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.