* GTK3 deprecation fix (GtkFontSelection replaced with GtkFontChooser) @ 2012-08-10 9:35 Frans Oilinki 2012-08-11 9:00 ` Jan Djärv 0 siblings, 1 reply; 4+ messages in thread From: Frans Oilinki @ 2012-08-10 9:35 UTC (permalink / raw) To: emacs-devel Hello, 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: GTK3 deprecation fix (GtkFontSelection replaced with GtkFontChooser) 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 0 siblings, 1 reply; 4+ messages in thread From: Jan Djärv @ 2012-08-11 9:00 UTC (permalink / raw) To: Frans Oilinki; +Cc: emacs-devel [-- Attachment #1: Type: text/plain, Size: 6945 bytes --] 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 > [-- Attachment #2: xasminus.png --] [-- Type: image/png, Size: 27930 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: GTK3 deprecation fix (GtkFontSelection replaced with GtkFontChooser) 2012-08-11 9:00 ` Jan Djärv @ 2012-08-20 9:45 ` Frans Oilinki 2012-08-21 20:54 ` Jan Djärv 0 siblings, 1 reply; 4+ messages in thread From: Frans Oilinki @ 2012-08-20 9:45 UTC (permalink / raw) To: Jan Djärv; +Cc: emacs-devel 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ä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 >> > > ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: GTK3 deprecation fix (GtkFontSelection replaced with GtkFontChooser) 2012-08-20 9:45 ` Frans Oilinki @ 2012-08-21 20:54 ` Jan Djärv 0 siblings, 0 replies; 4+ messages in thread From: Jan Djärv @ 2012-08-21 20:54 UTC (permalink / raw) To: Frans Oilinki; +Cc: emacs-devel 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 >>> >> >> ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-08-21 20:54 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).