unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#28189: 26.0.50; Emacs uses deprecated function gtk_window_parse_geometry
@ 2017-08-22 20:22 Philipp
  2017-08-23  8:46 ` martin rudalics
  0 siblings, 1 reply; 21+ messages in thread
From: Philipp @ 2017-08-22 20:22 UTC (permalink / raw)
  To: 28189


Code in src/gtkutil.c calls gtk_window_parse_geometry, which is
deprecated
(https://developer.gnome.org/gtk3/stable/GtkWindow.html#gtk-window-parse-geometry)
and has been removed in unstable
(https://git.gnome.org/browse/gtk+/diff/gtk/gtkwindow.h?id=c2125e80a345af13d5d886d4ae56fba2926dc267).
Emacs needs to stop using this function.


In GNU Emacs 26.0.50 (build 6, x86_64-pc-linux-gnu, GTK+ Version 3.10.8)
 of 2017-08-22 built on unknown
Repository revision: 4309d1574ae86244751600171b605b2b2eca4697
Windowing system distributor 'The X.Org Foundation', version 11.0.11803000
System Description:	Ubuntu 14.04.5 LTS

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
scroll-up-command: End of buffer

Configured using:
 'configure --with-modules --without-pop --with-mailutils
 --enable-checking --enable-check-lisp-object-type --enable-gcc-warnings
 'CFLAGS=-ggdb3 -O0''

Configured features:
XPM JPEG TIFF GIF PNG SOUND GSETTINGS NOTIFY GNUTLS FREETYPE XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 MODULES

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message subr-x puny seq byte-opt gv
bytecomp byte-compile cconv cl-loaddefs cl-lib dired dired-loaddefs
format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg
epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils elec-pair time-date
mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote inotify dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 94687 11372)
 (symbols 48 20136 1)
 (miscs 40 43 144)
 (strings 32 28611 1366)
 (string-bytes 1 762371)
 (vectors 16 13988)
 (vector-slots 8 488130 14278)
 (floats 8 48 68)
 (intervals 56 207 0)
 (buffers 992 11)
 (heap 1024 18489 1000))





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#28189: 26.0.50; Emacs uses deprecated function gtk_window_parse_geometry
  2017-08-22 20:22 bug#28189: 26.0.50; Emacs uses deprecated function gtk_window_parse_geometry Philipp
@ 2017-08-23  8:46 ` martin rudalics
  2017-08-23 10:38   ` Philipp Stephani
  0 siblings, 1 reply; 21+ messages in thread
From: martin rudalics @ 2017-08-23  8:46 UTC (permalink / raw)
  To: Philipp, 28189

 > Code in src/gtkutil.c calls gtk_window_parse_geometry, which is
 > deprecated
 > (https://developer.gnome.org/gtk3/stable/GtkWindow.html#gtk-window-parse-geometry)
 > and has been removed in unstable
 > (https://git.gnome.org/browse/gtk+/diff/gtk/gtkwindow.h?id=c2125e80a345af13d5d886d4ae56fba2926dc267).
 > Emacs needs to stop using this function.

By default we don't call gtk_window_parse_geometry any more so this
should not be grave.  The more annoying aspect is that they apparently
removed gtk_window_set_geometry_hints as well and we now have to either
use gdk_window_set_geometry_hints (which has a different signature) or
copy the old definition of gtk_window_set_geometry_hints to our sources.

Can you build with unstable?

martin





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#28189: 26.0.50; Emacs uses deprecated function gtk_window_parse_geometry
  2017-08-23  8:46 ` martin rudalics
@ 2017-08-23 10:38   ` Philipp Stephani
  2017-08-23 13:19     ` martin rudalics
  0 siblings, 1 reply; 21+ messages in thread
From: Philipp Stephani @ 2017-08-23 10:38 UTC (permalink / raw)
  To: martin rudalics, 28189

[-- Attachment #1: Type: text/plain, Size: 946 bytes --]

martin rudalics <rudalics@gmx.at> schrieb am Mi., 23. Aug. 2017 um
10:46 Uhr:

>  > Code in src/gtkutil.c calls gtk_window_parse_geometry, which is
>  > deprecated
>  > (
> https://developer.gnome.org/gtk3/stable/GtkWindow.html#gtk-window-parse-geometry
> )
>  > and has been removed in unstable
>  > (
> https://git.gnome.org/browse/gtk+/diff/gtk/gtkwindow.h?id=c2125e80a345af13d5d886d4ae56fba2926dc267
> ).
>  > Emacs needs to stop using this function.
>
> By default we don't call gtk_window_parse_geometry any more so this
> should not be grave.


But doesn't removing the declaration break the build even if the function
isn't called?


> Can you build with unstable?
>

Haven't tried that (GTK appears to use a quite idiosyncratic build system),
but the Emacs build already breaks on Debian testing when configuring with
'--enable-gcc-warnings --enable-gtk-deprecation-warnings' (there are a few
more deprecated functions that Emacs uses).

[-- Attachment #2: Type: text/html, Size: 1696 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#28189: 26.0.50; Emacs uses deprecated function gtk_window_parse_geometry
  2017-08-23 10:38   ` Philipp Stephani
@ 2017-08-23 13:19     ` martin rudalics
  2017-08-23 23:26       ` Philipp Stephani
  0 siblings, 1 reply; 21+ messages in thread
From: martin rudalics @ 2017-08-23 13:19 UTC (permalink / raw)
  To: Philipp Stephani, 28189

 > But doesn't removing the declaration break the build even if the function
 > isn't called?

Sure.  We can either remove x_gtk_use_window_move and call
gtk_window_move unconditionally or leave x_gtk_use_window_move alone and
call gtk_window_parse_geometry only if GTK_CHECK_VERSION permits it.

 >> Can you build with unstable?
 >>
 >
 > Haven't tried that (GTK appears to use a quite idiosyncratic build system),
 > but the Emacs build already breaks on Debian testing when configuring with
 > '--enable-gcc-warnings --enable-gtk-deprecation-warnings' (there are a few
 > more deprecated functions that Emacs uses).

Have these already been deprecated with GTK 3.10.8?  I'm using 3.4.2
here.  In any case please post a list of these functions here (unless
you intend to take care of them by yourself).

Thanks, martin





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#28189: 26.0.50; Emacs uses deprecated function gtk_window_parse_geometry
  2017-08-23 13:19     ` martin rudalics
@ 2017-08-23 23:26       ` Philipp Stephani
  2017-08-24  9:37         ` martin rudalics
  2017-08-25  9:28         ` Philipp Stephani
  0 siblings, 2 replies; 21+ messages in thread
From: Philipp Stephani @ 2017-08-23 23:26 UTC (permalink / raw)
  To: martin rudalics, 28189


[-- Attachment #1.1: Type: text/plain, Size: 936 bytes --]

martin rudalics <rudalics@gmx.at> schrieb am Mi., 23. Aug. 2017 um
15:19 Uhr:

>  > But doesn't removing the declaration break the build even if the
> function
>  > isn't called?
>
> Sure.  We can either remove x_gtk_use_window_move and call
> gtk_window_move unconditionally
>

Would there be any downsides of that?


>
>  >> Can you build with unstable?
>  >>
>  >
>  > Haven't tried that (GTK appears to use a quite idiosyncratic build
> system),
>  > but the Emacs build already breaks on Debian testing when configuring
> with
>  > '--enable-gcc-warnings --enable-gtk-deprecation-warnings' (there are a
> few
>  > more deprecated functions that Emacs uses).
>
> Have these already been deprecated with GTK 3.10.8?  I'm using 3.4.2
> here.  In any case please post a list of these functions here (unless
> you intend to take care of them by yourself).
>
>
I've attached the compilation log including all GTK-related error messages.

[-- Attachment #1.2: Type: text/html, Size: 1473 bytes --]

[-- Attachment #2: gtk-compile.txt --]
[-- Type: text/plain, Size: 24465 bytes --]

  CC       dispnew.o
  CC       frame.o
  CC       scroll.o
  CC       xdisp.o
  CC       menu.o
  CC       xmenu.o
xmenu.c: In function ‘create_and_show_popup_menu’:
xmenu.c:1299:3: error: ‘gtk_menu_popup’ is deprecated: Use '(gtk_menu_popup_at_widget, gtk_menu_popup_at_pointer, gtk_menu_popup_at_rect)' instead [-Werror=deprecated-declarations]
   gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i,
   ^~~~~~~~~~~~~~
In file included from /usr/include/gtk-3.0/gtk/gtklabel.h:34:0,
                 from /usr/include/gtk-3.0/gtk/gtkaccellabel.h:35,
                 from /usr/include/gtk-3.0/gtk/gtk.h:33,
                 from xterm.h:49,
                 from keyboard.h:27,
                 from xmenu.c:38:
/usr/include/gtk-3.0/gtk/gtkmenu.h:138:9: note: declared here
 void    gtk_menu_popup    (GtkMenu        *menu,
         ^~~~~~~~~~~~~~
cc1: all warnings being treated as errors
Makefile:374: recipe for target 'xmenu.o' failed
make: *** [xmenu.o] Error 1
  CC       window.o
  CC       charset.o
  CC       coding.o
  CC       category.o
  CC       ccl.o
  CC       character.o
  CC       chartab.o
  CC       bidi.o
  CC       cm.o
  CC       term.o
  CC       terminal.o
  CC       xfaces.o
  CC       xterm.o
xterm.c: In function ‘x_hide_hourglass’:
xterm.c:4003:7: error: ‘gdk_window_process_all_updates’ is deprecated [-Werror=deprecated-declarations]
       XSync (FRAME_X_DISPLAY (f), False);
       ^~~~~
In file included from /usr/include/gtk-3.0/gdk/gdkseat.h:28:0,
                 from /usr/include/gtk-3.0/gdk/gdkdisplay.h:33,
                 from /usr/include/gtk-3.0/gdk/gdkscreen.h:32,
                 from /usr/include/gtk-3.0/gdk/gdkapplaunchcontext.h:31,
                 from /usr/include/gtk-3.0/gdk/gdk.h:32,
                 from /usr/include/gtk-3.0/gtk/gtk.h:30,
                 from xterm.h:49,
                 from xterm.c:33:
/usr/include/gtk-3.0/gdk/gdkwindow.h:1058:12: note: declared here
 void       gdk_window_process_all_updates (void);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xterm.c: In function ‘XTflash’:
xterm.c:4021:5: error: ‘gdk_cairo_create’ is deprecated: Use 'gdk_window_begin_draw_frame() and gdk_drawing_context_get_cairo_context()' instead [-Werror=deprecated-declarations]
     cairo_t *cr = gdk_cairo_create (window);
     ^~~~~~~
In file included from /usr/include/gtk-3.0/gdk/gdk.h:33:0,
                 from /usr/include/gtk-3.0/gtk/gtk.h:30,
                 from xterm.h:49,
                 from xterm.c:33:
/usr/include/gtk-3.0/gdk/gdkcairo.h:35:12: note: declared here
 cairo_t  * gdk_cairo_create             (GdkWindow          *window);
            ^~~~~~~~~~~~~~~~
xterm.c: In function ‘x_catch_errors_with_handler’:
xterm.c:9597:3: error: ‘gdk_window_process_all_updates’ is deprecated [-Werror=deprecated-declarations]
   XSync (dpy, False);
   ^~~~~
In file included from /usr/include/gtk-3.0/gdk/gdkseat.h:28:0,
                 from /usr/include/gtk-3.0/gdk/gdkdisplay.h:33,
                 from /usr/include/gtk-3.0/gdk/gdkscreen.h:32,
                 from /usr/include/gtk-3.0/gdk/gdkapplaunchcontext.h:31,
                 from /usr/include/gtk-3.0/gdk/gdk.h:32,
                 from /usr/include/gtk-3.0/gtk/gtk.h:30,
                 from xterm.h:49,
                 from xterm.c:33:
/usr/include/gtk-3.0/gdk/gdkwindow.h:1058:12: note: declared here
 void       gdk_window_process_all_updates (void);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xterm.c: In function ‘x_uncatch_errors’:
xterm.c:9645:5: error: ‘gdk_window_process_all_updates’ is deprecated [-Werror=deprecated-declarations]
     XSync (x_error_message->dpy, False);
     ^~~~~
In file included from /usr/include/gtk-3.0/gdk/gdkseat.h:28:0,
                 from /usr/include/gtk-3.0/gdk/gdkdisplay.h:33,
                 from /usr/include/gtk-3.0/gdk/gdkscreen.h:32,
                 from /usr/include/gtk-3.0/gdk/gdkapplaunchcontext.h:31,
                 from /usr/include/gtk-3.0/gdk/gdk.h:32,
                 from /usr/include/gtk-3.0/gtk/gtk.h:30,
                 from xterm.h:49,
                 from xterm.c:33:
/usr/include/gtk-3.0/gdk/gdkwindow.h:1058:12: note: declared here
 void       gdk_window_process_all_updates (void);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xterm.c: In function ‘x_check_errors’:
xterm.c:9661:3: error: ‘gdk_window_process_all_updates’ is deprecated [-Werror=deprecated-declarations]
   XSync (dpy, False);
   ^~~~~
In file included from /usr/include/gtk-3.0/gdk/gdkseat.h:28:0,
                 from /usr/include/gtk-3.0/gdk/gdkdisplay.h:33,
                 from /usr/include/gtk-3.0/gdk/gdkscreen.h:32,
                 from /usr/include/gtk-3.0/gdk/gdkapplaunchcontext.h:31,
                 from /usr/include/gtk-3.0/gdk/gdk.h:32,
                 from /usr/include/gtk-3.0/gtk/gtk.h:30,
                 from xterm.h:49,
                 from xterm.c:33:
/usr/include/gtk-3.0/gdk/gdkwindow.h:1058:12: note: declared here
 void       gdk_window_process_all_updates (void);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xterm.c: In function ‘x_had_errors_p’:
xterm.c:9679:3: error: ‘gdk_window_process_all_updates’ is deprecated [-Werror=deprecated-declarations]
   XSync (dpy, False);
   ^~~~~
In file included from /usr/include/gtk-3.0/gdk/gdkseat.h:28:0,
                 from /usr/include/gtk-3.0/gdk/gdkdisplay.h:33,
                 from /usr/include/gtk-3.0/gdk/gdkscreen.h:32,
                 from /usr/include/gtk-3.0/gdk/gdkapplaunchcontext.h:31,
                 from /usr/include/gtk-3.0/gdk/gdk.h:32,
                 from /usr/include/gtk-3.0/gtk/gtk.h:30,
                 from xterm.h:49,
                 from xterm.c:33:
/usr/include/gtk-3.0/gdk/gdkwindow.h:1058:12: note: declared here
 void       gdk_window_process_all_updates (void);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xterm.c: In function ‘x_sync_with_move’:
xterm.c:10992:7: error: ‘gdk_window_process_all_updates’ is deprecated [-Werror=deprecated-declarations]
       XSync (FRAME_X_DISPLAY (f), False);
       ^~~~~
In file included from /usr/include/gtk-3.0/gdk/gdkseat.h:28:0,
                 from /usr/include/gtk-3.0/gdk/gdkdisplay.h:33,
                 from /usr/include/gtk-3.0/gdk/gdkscreen.h:32,
                 from /usr/include/gtk-3.0/gdk/gdkapplaunchcontext.h:31,
                 from /usr/include/gtk-3.0/gdk/gdk.h:32,
                 from /usr/include/gtk-3.0/gtk/gtk.h:30,
                 from xterm.h:49,
                 from xterm.c:33:
/usr/include/gtk-3.0/gdk/gdkwindow.h:1058:12: note: declared here
 void       gdk_window_process_all_updates (void);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xterm.c: In function ‘xembed_send_message’:
xterm.c:11350:3: error: ‘gdk_window_process_all_updates’ is deprecated [-Werror=deprecated-declarations]
   XSync (FRAME_X_DISPLAY (f), False);
   ^~~~~
In file included from /usr/include/gtk-3.0/gdk/gdkseat.h:28:0,
                 from /usr/include/gtk-3.0/gdk/gdkdisplay.h:33,
                 from /usr/include/gtk-3.0/gdk/gdkscreen.h:32,
                 from /usr/include/gtk-3.0/gdk/gdkapplaunchcontext.h:31,
                 from /usr/include/gtk-3.0/gdk/gdk.h:32,
                 from /usr/include/gtk-3.0/gtk/gtk.h:30,
                 from xterm.h:49,
                 from xterm.c:33:
/usr/include/gtk-3.0/gdk/gdkwindow.h:1058:12: note: declared here
 void       gdk_window_process_all_updates (void);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
Makefile:374: recipe for target 'xterm.o' failed
make: *** [xterm.o] Error 1
  CC       xfns.o
xfns.c: In function ‘Fx_display_monitor_attributes_list’:
xfns.c:4901:3: error: ‘gdk_screen_get_primary_monitor’ is deprecated: Use 'gdk_display_get_primary_monitor' instead [-Werror=deprecated-declarations]
   primary_monitor = gdk_screen_get_primary_monitor (gscreen);
   ^~~~~~~~~~~~~~~
In file included from /usr/include/gtk-3.0/gdk/gdkapplaunchcontext.h:31:0,
                 from /usr/include/gtk-3.0/gdk/gdk.h:32,
                 from /usr/include/gtk-3.0/gtk/gtk.h:30,
                 from xterm.h:49,
                 from xfns.c:27:
/usr/include/gtk-3.0/gdk/gdkscreen.h:76:14: note: declared here
 gint         gdk_screen_get_primary_monitor   (GdkScreen    *screen);
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xfns.c:4903:3: error: ‘gdk_screen_get_n_monitors’ is deprecated: Use 'gdk_display_get_n_monitors' instead [-Werror=deprecated-declarations]
   n_monitors = gdk_screen_get_n_monitors (gscreen);
   ^~~~~~~~~~
In file included from /usr/include/gtk-3.0/gdk/gdkapplaunchcontext.h:31:0,
                 from /usr/include/gtk-3.0/gdk/gdk.h:32,
                 from /usr/include/gtk-3.0/gtk/gtk.h:30,
                 from xterm.h:49,
                 from xfns.c:27:
/usr/include/gtk-3.0/gdk/gdkscreen.h:74:14: note: declared here
 gint         gdk_screen_get_n_monitors        (GdkScreen    *screen);
              ^~~~~~~~~~~~~~~~~~~~~~~~~
xfns.c:4916:4: error: ‘gdk_screen_get_monitor_at_window’ is deprecated: Use 'gdk_display_get_monitor_at_window' instead [-Werror=deprecated-declarations]
    i = gdk_screen_get_monitor_at_window (gscreen, gwin);
    ^
In file included from /usr/include/gtk-3.0/gdk/gdkapplaunchcontext.h:31:0,
                 from /usr/include/gtk-3.0/gdk/gdk.h:32,
                 from /usr/include/gtk-3.0/gtk/gtk.h:30,
                 from xterm.h:49,
                 from xfns.c:27:
/usr/include/gtk-3.0/gdk/gdkscreen.h:91:15: note: declared here
 gint          gdk_screen_get_monitor_at_window (GdkScreen *screen,
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xfns.c:4927:7: error: ‘gdk_screen_get_monitor_geometry’ is deprecated: Use 'gdk_monitor_get_geometry' instead [-Werror=deprecated-declarations]
       gdk_screen_get_monitor_geometry (gscreen, i, &rec);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/gtk-3.0/gdk/gdkapplaunchcontext.h:31:0,
                 from /usr/include/gtk-3.0/gdk/gdk.h:32,
                 from /usr/include/gtk-3.0/gtk/gtk.h:30,
                 from xterm.h:49,
                 from xfns.c:27:
/usr/include/gtk-3.0/gdk/gdkscreen.h:78:14: note: declared here
 void         gdk_screen_get_monitor_geometry  (GdkScreen    *screen,
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xfns.c:4930:7: error: ‘gdk_screen_get_monitor_width_mm’ is deprecated: Use 'gdk_monitor_get_width_mm' instead [-Werror=deprecated-declarations]
       width_mm = gdk_screen_get_monitor_width_mm (gscreen, i);
       ^~~~~~~~
In file included from /usr/include/gtk-3.0/gdk/gdkapplaunchcontext.h:31:0,
                 from /usr/include/gtk-3.0/gdk/gdk.h:32,
                 from /usr/include/gtk-3.0/gtk/gtk.h:30,
                 from xterm.h:49,
                 from xfns.c:27:
/usr/include/gtk-3.0/gdk/gdkscreen.h:94:15: note: declared here
 gint          gdk_screen_get_monitor_width_mm  (GdkScreen *screen,
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xfns.c:4931:7: error: ‘gdk_screen_get_monitor_height_mm’ is deprecated: Use 'gdk_monitor_get_height_mm' instead [-Werror=deprecated-declarations]
       height_mm = gdk_screen_get_monitor_height_mm (gscreen, i);
       ^~~~~~~~~
In file included from /usr/include/gtk-3.0/gdk/gdkapplaunchcontext.h:31:0,
                 from /usr/include/gtk-3.0/gdk/gdk.h:32,
                 from /usr/include/gtk-3.0/gtk/gtk.h:30,
                 from xterm.h:49,
                 from xfns.c:27:
/usr/include/gtk-3.0/gdk/gdkscreen.h:97:15: note: declared here
 gint          gdk_screen_get_monitor_height_mm (GdkScreen *screen,
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xfns.c:4939:7: error: ‘gdk_screen_get_monitor_workarea’ is deprecated: Use 'gdk_monitor_get_workarea' instead [-Werror=deprecated-declarations]
       gdk_screen_get_monitor_workarea (gscreen, i, &work);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/gtk-3.0/gdk/gdkapplaunchcontext.h:31:0,
                 from /usr/include/gtk-3.0/gdk/gdk.h:32,
                 from /usr/include/gtk-3.0/gtk/gtk.h:30,
                 from xterm.h:49,
                 from xfns.c:27:
/usr/include/gtk-3.0/gdk/gdkscreen.h:82:14: note: declared here
 void         gdk_screen_get_monitor_workarea  (GdkScreen    *screen,
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xfns.c:4972:7: error: ‘gdk_screen_get_monitor_plug_name’ is deprecated: Use 'gdk_monitor_get_model' instead [-Werror=deprecated-declarations]
       mi->name = gdk_screen_get_monitor_plug_name (gscreen, i);
       ^~
In file included from /usr/include/gtk-3.0/gdk/gdkapplaunchcontext.h:31:0,
                 from /usr/include/gtk-3.0/gdk/gdk.h:32,
                 from /usr/include/gtk-3.0/gtk/gtk.h:30,
                 from xterm.h:49,
                 from xfns.c:27:
/usr/include/gtk-3.0/gdk/gdkscreen.h:100:15: note: declared here
 gchar *       gdk_screen_get_monitor_plug_name (GdkScreen *screen,
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xfns.c: In function ‘x_sync’:
xfns.c:5669:3: error: ‘gdk_window_process_all_updates’ is deprecated [-Werror=deprecated-declarations]
   XSync (FRAME_X_DISPLAY (f), False);
   ^~~~~
In file included from /usr/include/gtk-3.0/gdk/gdkseat.h:28:0,
                 from /usr/include/gtk-3.0/gdk/gdkdisplay.h:33,
                 from /usr/include/gtk-3.0/gdk/gdkscreen.h:32,
                 from /usr/include/gtk-3.0/gdk/gdkapplaunchcontext.h:31,
                 from /usr/include/gtk-3.0/gdk/gdk.h:32,
                 from /usr/include/gtk-3.0/gtk/gtk.h:30,
                 from xterm.h:49,
                 from xfns.c:27:
/usr/include/gtk-3.0/gdk/gdkwindow.h:1058:12: note: declared here
 void       gdk_window_process_all_updates (void);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
Makefile:374: recipe for target 'xfns.o' failed
make: *** [xfns.o] Error 1
  CC       xselect.o
xselect.c: In function ‘x_reply_selection_request’:
xselect.c:732:3: error: ‘gdk_window_process_all_updates’ is deprecated [-Werror=deprecated-declarations]
   XSync (display, False);
   ^~~~~
In file included from /usr/include/gtk-3.0/gdk/gdkseat.h:28:0,
                 from /usr/include/gtk-3.0/gdk/gdkdisplay.h:33,
                 from /usr/include/gtk-3.0/gdk/gdkscreen.h:32,
                 from /usr/include/gtk-3.0/gdk/gdkapplaunchcontext.h:31,
                 from /usr/include/gtk-3.0/gdk/gdk.h:32,
                 from /usr/include/gtk-3.0/gtk/gtk.h:30,
                 from xterm.h:49,
                 from xselect.c:33:
/usr/include/gtk-3.0/gdk/gdkwindow.h:1058:12: note: declared here
 void       gdk_window_process_all_updates (void);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
Makefile:374: recipe for target 'xselect.o' failed
make: *** [xselect.o] Error 1
  CC       xrdb.o
  CC       xsmfns.o
  CC       xsettings.o
  CC       gtkutil.o
gtkutil.c: In function ‘xg_check_special_colors’:
gtkutil.c:580:7: error: ‘gtk_style_context_get_background_color’ is deprecated: Use 'gtk_render_background' instead [-Werror=deprecated-declarations]
       gtk_style_context_get_background_color (gsty, state, &col);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/gtk-3.0/gtk/gtkicontheme.h:27:0,
                 from /usr/include/gtk-3.0/gtk/gtk.h:123,
                 from xterm.h:49,
                 from gtkutil.c:32:
/usr/include/gtk-3.0/gtk/gtkstylecontext.h:1201:6: note: declared here
 void gtk_style_context_get_background_color (GtkStyleContext *context,
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gtkutil.c: In function ‘xg_set_geometry’:
gtkutil.c:856:4: error: ‘gtk_window_parse_geometry’ is deprecated [-Werror=deprecated-declarations]
    if (!gtk_window_parse_geometry (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
    ^~
In file included from /usr/include/gtk-3.0/gtk/gtkdialog.h:32:0,
                 from /usr/include/gtk-3.0/gtk/gtkaboutdialog.h:30,
                 from /usr/include/gtk-3.0/gtk/gtk.h:31,
                 from xterm.h:49,
                 from gtkutil.c:32:
/usr/include/gtk-3.0/gtk/gtkwindow.h:443:10: note: declared here
 gboolean gtk_window_parse_geometry   (GtkWindow   *window,
          ^~~~~~~~~~~~~~~~~~~~~~~~~
gtkutil.c: In function ‘xg_set_widget_bg’:
gtkutil.c:1056:7: error: ‘gtk_widget_override_background_color’ is deprecated [-Werror=deprecated-declarations]
       gtk_widget_override_background_color (w, GTK_STATE_FLAG_NORMAL, &bg);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/gtk-3.0/gtk/gtkapplication.h:27:0,
                 from /usr/include/gtk-3.0/gtk/gtkwindow.h:33,
                 from /usr/include/gtk-3.0/gtk/gtkdialog.h:32,
                 from /usr/include/gtk-3.0/gtk/gtkaboutdialog.h:30,
                 from /usr/include/gtk-3.0/gtk/gtk.h:31,
                 from xterm.h:49,
                 from gtkutil.c:32:
/usr/include/gtk-3.0/gtk/gtkwidget.h:1148:14: note: declared here
 void         gtk_widget_override_background_color (GtkWidget     *widget,
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gtkutil.c: In function ‘xg_create_frame_widgets’:
gtkutil.c:1215:3: error: ‘gtk_widget_set_double_buffered’ is deprecated [-Werror=deprecated-declarations]
   gtk_widget_set_double_buffered (wfixed, FALSE);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/gtk-3.0/gtk/gtkapplication.h:27:0,
                 from /usr/include/gtk-3.0/gtk/gtkwindow.h:33,
                 from /usr/include/gtk-3.0/gtk/gtkdialog.h:32,
                 from /usr/include/gtk-3.0/gtk/gtkaboutdialog.h:30,
                 from /usr/include/gtk-3.0/gtk/gtk.h:31,
                 from xterm.h:49,
                 from gtkutil.c:32:
/usr/include/gtk-3.0/gtk/gtkwidget.h:883:23: note: declared here
 void                  gtk_widget_set_double_buffered    (GtkWidget    *widget,
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gtkutil.c:1217:3: error: ‘gtk_window_set_wmclass’ is deprecated [-Werror=deprecated-declarations]
   gtk_window_set_wmclass (GTK_WINDOW (wtop),
   ^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/gtk-3.0/gtk/gtkdialog.h:32:0,
                 from /usr/include/gtk-3.0/gtk/gtkaboutdialog.h:30,
                 from /usr/include/gtk-3.0/gtk/gtk.h:31,
                 from xterm.h:49,
                 from gtkutil.c:32:
/usr/include/gtk-3.0/gtk/gtkwindow.h:154:12: note: declared here
 void       gtk_window_set_wmclass              (GtkWindow           *window,
            ^~~~~~~~~~~~~~~~~~~~~~
gtkutil.c: In function ‘xg_set_toolkit_scroll_bar_thumb’:
gtkutil.c:4083:11: error: ‘gtk_adjustment_changed’ is deprecated [-Werror=deprecated-declarations]
           gtk_adjustment_changed (adj);
           ^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/gtk-3.0/gtk/gtk.h:38:0,
                 from xterm.h:49,
                 from gtkutil.c:32:
/usr/include/gtk-3.0/gtk/gtkadjustment.h:87:12: note: declared here
 void       gtk_adjustment_changed               (GtkAdjustment   *adjustment);
            ^~~~~~~~~~~~~~~~~~~~~~
gtkutil.c: In function ‘xg_set_toolkit_horizontal_scroll_bar_thumb’:
gtkutil.c:4120:7: error: ‘gtk_adjustment_changed’ is deprecated [-Werror=deprecated-declarations]
       gtk_adjustment_changed (adj);
       ^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/gtk-3.0/gtk/gtk.h:38:0,
                 from xterm.h:49,
                 from gtkutil.c:32:
/usr/include/gtk-3.0/gtk/gtkadjustment.h:87:12: note: declared here
 void       gtk_adjustment_changed               (GtkAdjustment   *adjustment);
            ^~~~~~~~~~~~~~~~~~~~~~
gtkutil.c: In function ‘xg_event_is_for_scrollbar’:
gtkutil.c:4142:9: error: ‘gdk_device_manager_get_client_pointer’ is deprecated [-Werror=deprecated-declarations]
         (gdk_display_get_device_manager (gdpy));
         ^
In file included from /usr/include/gtk-3.0/gdk/gdkdisplay.h:32:0,
                 from /usr/include/gtk-3.0/gdk/gdkscreen.h:32,
                 from /usr/include/gtk-3.0/gdk/gdkapplaunchcontext.h:31,
                 from /usr/include/gtk-3.0/gdk/gdk.h:32,
                 from /usr/include/gtk-3.0/gtk/gtk.h:30,
                 from xterm.h:49,
                 from gtkutil.c:32:
/usr/include/gtk-3.0/gdk/gdkdevicemanager.h:44:14: note: declared here
 GdkDevice *  gdk_device_manager_get_client_pointer (GdkDeviceManager *device_manager);
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gtkutil.c:4142:9: error: ‘gdk_display_get_device_manager’ is deprecated: Use 'gdk_display_get_default_seat' instead [-Werror=deprecated-declarations]
         (gdk_display_get_device_manager (gdpy));
         ^
In file included from /usr/include/gtk-3.0/gdk/gdkscreen.h:32:0,
                 from /usr/include/gtk-3.0/gdk/gdkapplaunchcontext.h:31,
                 from /usr/include/gtk-3.0/gdk/gdk.h:32,
                 from /usr/include/gtk-3.0/gtk/gtk.h:30,
                 from xterm.h:49,
                 from gtkutil.c:32:
/usr/include/gtk-3.0/gdk/gdkdisplay.h:171:20: note: declared here
 GdkDeviceManager * gdk_display_get_device_manager (GdkDisplay *display);
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gtkutil.c: In function ‘xg_make_tool_item’:
gtkutil.c:4615:3: error: ‘gtk_button_set_focus_on_click’ is deprecated: Use 'gtk_widget_set_focus_on_click' instead [-Werror=deprecated-declarations]
   gtk_button_set_focus_on_click (GTK_BUTTON (wb), FALSE);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/gtk-3.0/gtk/gtk.h:54:0,
                 from xterm.h:49,
                 from gtkutil.c:32:
/usr/include/gtk-3.0/gtk/gtkbutton.h:138:23: note: declared here
 void                  gtk_button_set_focus_on_click (GtkButton      *button,
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gtkutil.c: In function ‘xg_initialize’:
gtkutil.c:5235:3: error: ‘gtk_settings_set_string_property’ is deprecated [-Werror=deprecated-declarations]
   gtk_settings_set_string_property (settings,
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/gtk-3.0/gtk/gtk.h:190:0,
                 from xterm.h:49,
                 from gtkutil.c:32:
/usr/include/gtk-3.0/gtk/gtksettings.h:128:10: note: declared here
 void     gtk_settings_set_string_property  (GtkSettings            *settings,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gtkutil.c:5242:3: error: ‘gtk_settings_set_string_property’ is deprecated [-Werror=deprecated-declarations]
   gtk_settings_set_string_property (settings,
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/gtk-3.0/gtk/gtk.h:190:0,
                 from xterm.h:49,
                 from gtkutil.c:32:
/usr/include/gtk-3.0/gtk/gtksettings.h:128:10: note: declared here
 void     gtk_settings_set_string_property  (GtkSettings            *settings,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
Makefile:374: recipe for target 'gtkutil.o' failed
make: *** [gtkutil.o] Error 1
  CC       emacsgtkfixed.o
  CC       dbusbind.o
  CC       emacs.o
  CC       keyboard.o
  CC       macros.o
  CC       keymap.o
  CC       sysdep.o
  CC       buffer.o
  CC       filelock.o
  CC       insdel.o
  CC       marker.o
  CC       minibuf.o
  CC       fileio.o
  CC       dired.o
  CC       cmds.o
  CC       casetab.o
  CC       casefiddle.o
  CC       indent.o
  CC       search.o
  CC       regex.o
  CC       undo.o
  CC       alloc.o
  CC       data.o
  CC       doc.o
  CC       editfns.o
  CC       callint.o
  CC       eval.o
  CC       floatfns.o
  CC       fns.o
  CC       font.o
  CC       print.o
  CC       lread.o
  CC       dynlib.o
  CC       emacs-module.o
  CC       syntax.o
  CC       unexelf.o
  CC       bytecode.o
  CC       process.o
  CC       gnutls.o
  CC       callproc.o
  CC       region-cache.o
  CC       sound.o
  CC       atimer.o
  CC       doprnt.o
  CC       intervals.o
  CC       textprop.o
  CC       composite.o
  CC       xml.o
  CC       inotify.o
  CC       profiler.o
  CC       decompress.o
  CC       thread.o
  CC       systhread.o
  CC       sheap.o
  CC       xfont.o
  CC       ftfont.o
  CC       xftfont.o
  CC       ftxfont.o
  CC       fontset.o
  CC       fringe.o
  CC       image.o
  CC       xgselect.o
  CC       terminfo.o
  CC       lastfile.o
  CC       gmalloc.o

^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#28189: 26.0.50; Emacs uses deprecated function gtk_window_parse_geometry
  2017-08-23 23:26       ` Philipp Stephani
@ 2017-08-24  9:37         ` martin rudalics
  2017-08-25  9:28         ` Philipp Stephani
  1 sibling, 0 replies; 21+ messages in thread
From: martin rudalics @ 2017-08-24  9:37 UTC (permalink / raw)
  To: Philipp Stephani, 28189

 >> Sure.  We can either remove x_gtk_use_window_move and call
 >> gtk_window_move unconditionally
 >>
 >
 > Would there be any downsides of that?

Currently, x_gtk_use_window_move is a backdoor to get the earlier
behavior that was based on calling gtk_window_parse_geometry.  I'never
been able to understand why Jan did the latter.  I suppose it's because
he wanted to position a window at an offset from the bottom right corner
of the screen.  However, for showing a window for the first time, this
never could have worked because gtk was not able to determine the size
of a yet unfinished window.  But maybe I'm all wrong.

In either case, Emacs doesn't use gtk_window_parse_geometry by default
for a couple of months already and I did not receive any complaints so
far.  Hence there should not be any downsides calling gtk_window_move
unconditionally.

 > I've attached the compilation log including all GTK-related error messages.

Thanks.  I'm still puzzled by the fact that they apparently never
deprecated gtk_window_set_geometry_hints and yet removed it in 3.91.2.
Also, gdk_window_set_override_redirect seems to have been removed
without former deprecation.  That's annoying, at least.  And I have no
idea yet whether gdk_window_process_all_updates is essential and, if so,
how to replace it.

martin





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#28189: 26.0.50; Emacs uses deprecated function gtk_window_parse_geometry
  2017-08-23 23:26       ` Philipp Stephani
  2017-08-24  9:37         ` martin rudalics
@ 2017-08-25  9:28         ` Philipp Stephani
  2017-08-26  9:29           ` martin rudalics
  1 sibling, 1 reply; 21+ messages in thread
From: Philipp Stephani @ 2017-08-25  9:28 UTC (permalink / raw)
  To: martin rudalics, 28189


[-- Attachment #1.1: Type: text/plain, Size: 428 bytes --]

Philipp Stephani <p.stephani2@gmail.com> schrieb am Do., 24. Aug. 2017 um
01:26 Uhr:

>
> I've attached the compilation log including all GTK-related error messages.
>

I've attached a patch that fixes all deprecation warnings. It's not
intended to be installed as-is, more as a baseline for discussion. Some of
the functions have straightforward replacements, others are harder to
replace, yet others have vanished altogether.

[-- Attachment #1.2: Type: text/html, Size: 849 bytes --]

[-- Attachment #2: 0001-Fix-all-GDK-GTK-warnings.txt --]
[-- Type: text/plain, Size: 16514 bytes --]

From 71874784ddd654dae24d6fce9303832c2ee17da2 Mon Sep 17 00:00:00 2001
From: Philipp Stephani <phst@google.com>
Date: Fri, 25 Aug 2017 11:08:25 +0200
Subject: [PATCH] Fix all GDK/GTK warnings

---
 src/gtkutil.c | 41 +++++++++++++++++++++++++++++++++++++++++
 src/xfns.c    | 36 +++++++++++++++++++++++++++++++++---
 src/xmenu.c   | 49 +++++++++++++++++++++++++++++++++++++++++++++----
 src/xterm.c   | 11 +++++++++++
 src/xterm.h   | 18 +++++++++++-------
 5 files changed, 141 insertions(+), 14 deletions(-)

diff --git a/src/gtkutil.c b/src/gtkutil.c
index 0c8395efe9..648fc808c3 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -566,6 +566,11 @@ xg_check_special_colors (struct frame *f,
   if (! FRAME_GTK_WIDGET (f) || ! (get_bg || get_fg))
     return success_p;
 
+#if GTK_CHECK_VERSION (3, 16, 0)
+  if (get_bg)
+    return success_p;
+#endif
+
   block_input ();
   {
 #ifdef HAVE_GTK3
@@ -577,7 +582,11 @@ xg_check_special_colors (struct frame *f,
     if (get_fg)
       gtk_style_context_get_color (gsty, state, &col);
     else
+#if GTK_CHECK_VERSION (3, 16, 0)
+      emacs_abort ();
+#else
       gtk_style_context_get_background_color (gsty, state, &col);
+#endif
 
     unsigned short
       r = col.red * 65535,
@@ -792,6 +801,7 @@ xg_hide_tooltip (struct frame *f)
     General functions for creating widgets, resizing, events, e.t.c.
  ***********************************************************************/
 
+#if ! GTK_CHECK_VERSION (3, 22, 0)
 static void
 my_log_handler (const gchar *log_domain, GLogLevelFlags log_level,
 		const gchar *msg, gpointer user_data)
@@ -799,6 +809,7 @@ my_log_handler (const gchar *log_domain, GLogLevelFlags log_level,
   if (!strstr (msg, "visible children"))
     fprintf (stderr, "XX %s-WARNING **: %s\n", log_domain, msg);
 }
+#endif
 
 /* Make a geometry string and pass that to GTK.  It seems this is the
    only way to get geometry position right if the user explicitly
@@ -810,8 +821,10 @@ xg_set_geometry (struct frame *f)
 {
   if (f->size_hint_flags & (USPosition | PPosition))
     {
+#if ! GTK_CHECK_VERSION (3, 22, 0)
       if (x_gtk_use_window_move)
 	{
+#endif
 	  /* Handle negative positions without consulting
 	     gtk_window_parse_geometry (Bug#25851).  The position will
 	     be off by scrollbar width + window manager decorations.  */
@@ -828,6 +841,7 @@ xg_set_geometry (struct frame *f)
 
 	  /* Reset size hint flags.  */
 	  f->size_hint_flags &= ~ (XNegative | YNegative);
+# if ! GTK_CHECK_VERSION (3, 22, 0)
 	}
       else
 	{
@@ -859,6 +873,7 @@ xg_set_geometry (struct frame *f)
 
 	  g_log_remove_handler ("Gtk", id);
 	}
+#endif
     }
 }
 
@@ -1044,6 +1059,7 @@ static void
 xg_set_widget_bg (struct frame *f, GtkWidget *w, unsigned long pixel)
 {
 #ifdef HAVE_GTK3
+#if ! GTK_CHECK_VERSION (3, 22, 0)
   GdkRGBA bg;
   XColor xbg;
   xbg.pixel = pixel;
@@ -1055,6 +1071,7 @@ xg_set_widget_bg (struct frame *f, GtkWidget *w, unsigned long pixel)
       bg.alpha = 1.0;
       gtk_widget_override_background_color (w, GTK_STATE_FLAG_NORMAL, &bg);
     }
+#endif
 #else
   GdkColor bg;
   GdkColormap *map = gtk_widget_get_colormap (w);
@@ -1207,16 +1224,20 @@ xg_create_frame_widgets (struct frame *f)
   if (FRAME_EXTERNAL_TOOL_BAR (f))
     update_frame_tool_bar (f);
 
+#if ! GTK_CHECK_VERSION (3, 14, 0)
   /* We don't want this widget double buffered, because we draw on it
      with regular X drawing primitives, so from a GTK/GDK point of
      view, the widget is totally blank.  When an expose comes, this
      will make the widget blank, and then Emacs redraws it.  This flickers
      a lot, so we turn off double buffering.  */
   gtk_widget_set_double_buffered (wfixed, FALSE);
+#endif
 
+#if ! GTK_CHECK_VERSION (3, 22, 0)
   gtk_window_set_wmclass (GTK_WINDOW (wtop),
                           SSDATA (Vx_resource_name),
                           SSDATA (Vx_resource_class));
+#endif
 
   /* Add callback to do nothing on WM_DELETE_WINDOW.  The default in
      GTK is to destroy the widget.  We want Emacs to do that instead.  */
@@ -4079,8 +4100,10 @@ xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
 
         if (int_gtk_range_get_value (GTK_RANGE (wscroll)) != value)
           gtk_range_set_value (GTK_RANGE (wscroll), (gdouble)value);
+#if ! GTK_CHECK_VERSION (3, 18, 0)
         else if (changed)
           gtk_adjustment_changed (adj);
+#endif
 
         xg_ignore_gtk_scrollbar = 0;
 
@@ -4117,7 +4140,9 @@ xg_set_toolkit_horizontal_scroll_bar_thumb (struct scroll_bar *bar,
       gtk_adjustment_configure (adj, (gdouble) value, (gdouble) lower,
 				(gdouble) upper, (gdouble) step_increment,
 				(gdouble) page_increment, (gdouble) pagesize);
+#if ! GTK_CHECK_VERSION (3, 18, 0)
       gtk_adjustment_changed (adj);
+#endif
       unblock_input ();
     }
 }
@@ -4138,8 +4163,13 @@ xg_event_is_for_scrollbar (struct frame *f, const XEvent *event)
       GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f));
       GdkWindow *gwin;
 #ifdef HAVE_GTK3
+#if GTK_CHECK_VERSION (3, 20, 0)
+      GdkDevice *gdev
+        = gdk_seat_get_pointer (gdk_display_get_default_seat (gdpy));
+#else
       GdkDevice *gdev = gdk_device_manager_get_client_pointer
         (gdk_display_get_device_manager (gdpy));
+#endif
       gwin = gdk_device_get_window_at_position (gdev, NULL, NULL);
 #else
       gwin = gdk_display_get_window_at_pointer (gdpy, NULL, NULL);
@@ -4612,7 +4642,11 @@ xg_make_tool_item (struct frame *f,
   if (wimage && text_image)
     gtk_box_pack_start (GTK_BOX (vb), wimage, TRUE, TRUE, 0);
 
+#if GTK_CHECK_VERSION (3, 20, 0)
+  gtk_widget_set_focus_on_click (wb, FALSE);
+#else
   gtk_button_set_focus_on_click (GTK_BUTTON (wb), FALSE);
+#endif
   gtk_button_set_relief (GTK_BUTTON (wb), GTK_RELIEF_NONE);
   gtk_container_add (GTK_CONTAINER (wb), vb);
   gtk_container_add (GTK_CONTAINER (weventbox), wb);
@@ -5229,6 +5263,12 @@ xg_initialize (void)
 
   settings = gtk_settings_get_for_screen (gdk_display_get_default_screen
                                           (gdk_display_get_default ()));
+#if GTK_CHECK_VERSION (3, 16, 0)
+  g_object_set (settings,
+                "gtk-menu-bar-accel", EMACS_CLASS,
+                "gtk-key-theme-name", "Emacs",
+                NULL);
+#else
   /* Remove F10 as a menu accelerator, it does not mix well with Emacs key
      bindings.  It doesn't seem to be any way to remove properties,
      so we set it to "" which in means "no key".  */
@@ -5243,6 +5283,7 @@ xg_initialize (void)
                                     "gtk-key-theme-name",
                                     "Emacs",
                                     EMACS_CLASS);
+#endif
 
   /* Make dialogs close on C-g.  Since file dialog inherits from
      dialog, this works for them also.  */
diff --git a/src/xfns.c b/src/xfns.c
index 2f8c9c2541..9bea7a0228 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -4884,7 +4884,9 @@ Internal use only, use `display-monitor-attributes-list' instead.  */)
 #ifdef USE_GTK
   double mm_width_per_pixel, mm_height_per_pixel;
   GdkDisplay *gdpy;
+#if ! GTK_CHECK_VERSION (3, 22, 0)
   GdkScreen *gscreen;
+#endif
   gint primary_monitor = 0, n_monitors, i;
   Lisp_Object monitor_frames, rest, frame;
   static const char *source = "Gdk";
@@ -4896,11 +4898,18 @@ Internal use only, use `display-monitor-attributes-list' instead.  */)
   mm_height_per_pixel = ((double) HeightMMOfScreen (dpyinfo->screen)
 			 / x_display_pixel_height (dpyinfo));
   gdpy = gdk_x11_lookup_xdisplay (dpyinfo->display);
+#if GTK_CHECK_VERSION (3, 22, 0)
+  /* FIXME: This function assumes that GdkMonitor objects are never
+   * destroyed, even if the monitor is unplugged.  That’s probably the
+   * case, but should be verified.  */
+  n_monitors = gdk_display_get_n_monitors (gdpy);
+#else
   gscreen = gdk_display_get_default_screen (gdpy);
 #if GTK_CHECK_VERSION (2, 20, 0)
   primary_monitor = gdk_screen_get_primary_monitor (gscreen);
 #endif
   n_monitors = gdk_screen_get_n_monitors (gscreen);
+#endif
   monitor_frames = Fmake_vector (make_number (n_monitors), Qnil);
   monitors = xzalloc (n_monitors * sizeof *monitors);
 
@@ -4913,7 +4922,14 @@ Internal use only, use `display-monitor-attributes-list' instead.  */)
 	{
 	  GdkWindow *gwin = gtk_widget_get_window (FRAME_GTK_WIDGET (f));
 
+#if GTK_CHECK_VERSION (3, 22, 0)
+          for (i = 0; i < n_monitors; i++)
+            if (gdk_display_get_monitor_at_window (gdpy, gwin)
+                == gdk_display_get_monitor (gdpy, i))
+              break;
+#else
 	  i = gdk_screen_get_monitor_at_window (gscreen, gwin);
+#endif
 	  ASET (monitor_frames, i, Fcons (frame, AREF (monitor_frames, i)));
 	}
     }
@@ -4924,9 +4940,19 @@ Internal use only, use `display-monitor-attributes-list' instead.  */)
       GdkRectangle rec, work;
       struct MonitorInfo *mi = &monitors[i];
 
+#if GTK_CHECK_VERSION (3, 22, 0)
+      GdkMonitor *monitor = gdk_display_get_monitor (gdpy, i);
+      if (gdk_monitor_is_primary (monitor))
+        primary_monitor = i;
+      gdk_monitor_get_geometry (monitor, &rec);
+#else
       gdk_screen_get_monitor_geometry (gscreen, i, &rec);
+#endif
 
-#if GTK_CHECK_VERSION (2, 14, 0)
+#if GTK_CHECK_VERSION (3, 22, 0)
+      width_mm = gdk_monitor_get_width_mm (monitor);
+      height_mm = gdk_monitor_get_height_mm (monitor);
+#elif GTK_CHECK_VERSION (2, 14, 0)
       width_mm = gdk_screen_get_monitor_width_mm (gscreen, i);
       height_mm = gdk_screen_get_monitor_height_mm (gscreen, i);
 #endif
@@ -4935,7 +4961,9 @@ Internal use only, use `display-monitor-attributes-list' instead.  */)
       if (height_mm < 0)
 	height_mm = rec.height * mm_height_per_pixel + 0.5;
 
-#if GTK_CHECK_VERSION (3, 4, 0)
+#if GTK_CHECK_VERSION (3, 22, 0)
+      gdk_monitor_get_workarea (monitor, &work);
+#elif GTK_CHECK_VERSION (3, 4, 0)
       gdk_screen_get_monitor_workarea (gscreen, i, &work);
 #else
       /* Emulate the behavior of GTK+ 3.4.  */
@@ -4968,7 +4996,9 @@ Internal use only, use `display-monitor-attributes-list' instead.  */)
       mi->mm_width = width_mm;
       mi->mm_height = height_mm;
 
-#if GTK_CHECK_VERSION (2, 14, 0)
+#if GTK_CHECK_VERSION (3, 22, 0)
+      mi->name = g_strdup (gdk_monitor_get_model (monitor));
+#elif GTK_CHECK_VERSION (2, 14, 0)
       mi->name = gdk_screen_get_monitor_plug_name (gscreen, i);
 #endif
     }
diff --git a/src/xmenu.c b/src/xmenu.c
index 64df151b28..2b1ef4a29d 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -1145,6 +1145,7 @@ struct next_popup_x_y
   int y;
 };
 
+#if ! GTK_CHECK_VERSION (3, 22, 0)
 /* The menu position function to use if we are not putting a popup
    menu where the pointer is.
    MENU is the menu to pop up.
@@ -1203,6 +1204,7 @@ menu_position_func (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer
   if (data->y + req.height > max_y)
     *y -= data->y + req.height - max_y;
 }
+#endif
 
 static void
 popup_selection_callback (GtkWidget *widget, gpointer client_data)
@@ -1231,12 +1233,14 @@ create_and_show_popup_menu (struct frame *f, widget_value *first_wv,
 {
   int i;
   GtkWidget *menu;
+#if ! GTK_CHECK_VERSION (3, 22, 0)
   GtkMenuPositionFunc pos_func = 0;  /* Pop up at pointer.  */
   struct next_popup_x_y popup_x_y;
+#endif
   ptrdiff_t specpdl_count = SPECPDL_INDEX ();
   bool use_pos_func = ! for_click;
 
-#ifdef HAVE_GTK3
+#if defined HAVE_GTK3 && ! GTK_CHECK_VERSION (3, 22, 0)
   /* Always use position function for Gtk3.  Otherwise menus may become
      too small to show anything.  */
   use_pos_func = true;
@@ -1253,13 +1257,16 @@ create_and_show_popup_menu (struct frame *f, widget_value *first_wv,
 
   if (use_pos_func)
     {
-      Window dummy_window;
-
+#if ! GTK_CHECK_VERSION (3, 22, 0)
       /* Not invoked by a click.  pop up at x/y.  */
       pos_func = menu_position_func;
+#endif
 
-      /* Adjust coordinates to be root-window-relative.  */
+      /* Adjust coordinates to be root-window-relative, but not for
+       * GTK+ 3.22, where the menu position is frame-relative.  */
       block_input ();
+#if ! GTK_CHECK_VERSION (3, 22, 0)
+      Window dummy_window;
       XTranslateCoordinates (FRAME_X_DISPLAY (f),
 
                              /* From-window, to-window.  */
@@ -1271,15 +1278,18 @@ create_and_show_popup_menu (struct frame *f, widget_value *first_wv,
 
                              /* Child of win.  */
                              &dummy_window);
+#endif
 #ifdef HAVE_GTK3
       /* Use window scaling factor to adjust position for hidpi screens. */
       x /= xg_get_scale (f);
       y /= xg_get_scale (f);
 #endif
       unblock_input ();
+#if ! GTK_CHECK_VERSION (3, 22, 0)
       popup_x_y.x = x;
       popup_x_y.y = y;
       popup_x_y.f = f;
+#endif
 
       i = 0;  /* gtk_menu_popup needs this to be 0 for a non-button popup.  */
     }
@@ -1296,8 +1306,39 @@ create_and_show_popup_menu (struct frame *f, widget_value *first_wv,
   /* Display the menu.  */
   gtk_widget_show_all (menu);
 
+#if GTK_CHECK_VERSION (3, 22, 0)
+  /* FIXME: We should pass the GDK event to this function instead of
+   * synthesizing it.  */
+  GdkWindow *window = gtk_widget_get_window (FRAME_GTK_WIDGET (f));
+  GdkDisplay *display = gdk_window_get_display (window);
+  GdkEvent *event = gdk_event_new (GDK_BUTTON_PRESS);
+  event->button.window = window;
+  event->button.time = FRAME_DISPLAY_INFO (f)->last_user_time;
+  event->button.button = i;
+  event->button.device
+    = gdk_seat_get_pointer (gdk_display_get_default_seat (display));
+  if (for_click)
+    gtk_menu_popup_at_pointer (GTK_MENU (menu), event);
+  else
+    {
+      GtkRequisition req;
+      gtk_widget_get_preferred_size (menu, NULL, &req);
+      GdkRectangle rect = {
+        .x = x,
+        .y = y,
+        .width = req.width,
+        .height = req.height,
+      };
+      /* FIXME: Check whether the adjustments in menu_position_func
+       * are still needed.  */
+      gtk_menu_popup_at_rect (GTK_MENU (menu), window, &rect,
+                              GDK_GRAVITY_NORTH_WEST, GDK_GRAVITY_NORTH_WEST,
+                              event);
+    }
+#else
   gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i,
 		  FRAME_DISPLAY_INFO (f)->last_user_time);
+#endif
 
   record_unwind_protect_ptr (pop_down_menu, menu);
 
diff --git a/src/xterm.c b/src/xterm.c
index 77daa22ae0..4038c78c9c 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -4018,7 +4018,13 @@ XTflash (struct frame *f)
        when the scroll bars and the edit widget share the same X window.  */
     GdkWindow *window = gtk_widget_get_window (FRAME_GTK_WIDGET (f));
 #ifdef HAVE_GTK3
+#if GTK_CHECK_VERSION (3, 22, 0)
+    cairo_region_t *region = gdk_window_get_visible_region (window);
+    GdkDrawingContext *context = gdk_window_begin_draw_frame (window, region);
+    cairo_t *cr = gdk_drawing_context_get_cairo_context (context);
+#else
     cairo_t *cr = gdk_cairo_create (window);
+#endif
     cairo_set_source_rgb (cr, 1, 1, 1);
     cairo_set_operator (cr, CAIRO_OPERATOR_DIFFERENCE);
 #define XFillRectangle(d, win, gc, x, y, w, h) \
@@ -4132,7 +4138,12 @@ XTflash (struct frame *f)
 
 #ifdef USE_GTK
 #ifdef HAVE_GTK3
+#if GTK_CHECK_VERSION (3, 22, 0)
+      gdk_window_end_draw_frame (window, context);
+      cairo_region_destroy (region);
+#else
       cairo_destroy (cr);
+#endif
 #else
       g_object_unref (G_OBJECT (gc));
 #endif
diff --git a/src/xterm.h b/src/xterm.h
index 803feda99f..b40ed960b7 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -49,13 +49,6 @@ typedef Widget xt_or_gtk_widget;
 #include <gtk/gtk.h>
 #include <gdk/gdkx.h>
 
-/* Some definitions to reduce conditionals.  */
-typedef GtkWidget *xt_or_gtk_widget;
-#undef XSync
-#define XSync(d, b) do { gdk_window_process_all_updates (); \
-                         XSync (d, b);  } while (false)
-#endif /* USE_GTK */
-
 /* True iff GTK's version is at least I.J.K.  */
 #ifndef GTK_CHECK_VERSION
 # ifdef USE_GTK
@@ -69,6 +62,17 @@ typedef GtkWidget *xt_or_gtk_widget;
 # endif
 #endif
 
+/* Some definitions to reduce conditionals.  */
+typedef GtkWidget *xt_or_gtk_widget;
+#undef XSync
+#if GTK_CHECK_VERSION (3, 22, 0)
+#define XSync(d, b) do { XSync ((d), (b)); } while (false)
+#else
+#define XSync(d, b) do { gdk_window_process_all_updates (); \
+                         XSync (d, b);  } while (false)
+#endif
+#endif /* USE_GTK */
+
 /* The GtkTooltip API came in 2.12, but gtk-enable-tooltips in 2.14. */
 #if GTK_CHECK_VERSION (2, 14, 0)
 #define USE_GTK_TOOLTIP
-- 
2.14.1.342.g6490525c54-goog


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* bug#28189: 26.0.50; Emacs uses deprecated function gtk_window_parse_geometry
  2017-08-25  9:28         ` Philipp Stephani
@ 2017-08-26  9:29           ` martin rudalics
  2017-08-27 13:34             ` Philipp Stephani
  0 siblings, 1 reply; 21+ messages in thread
From: martin rudalics @ 2017-08-26  9:29 UTC (permalink / raw)
  To: Philipp Stephani, 28189

 > I've attached a patch that fixes all deprecation warnings. It's not
 > intended to be installed as-is, more as a baseline for discussion. Some of
 > the functions have straightforward replacements, others are harder to
 > replace, yet others have vanished altogether.

I think you should install most of it right now so we have enough time
to test it before a release.  There are people who build with GTK 3.22
and could tell us whether it breaks anything (substantially, at least).
The sooner we know the better.

This one

+#if GTK_CHECK_VERSION (3, 16, 0)
+      emacs_abort ();
+#else

looks a bit harsh and the corresponding logic appears quite contrived.
Maybe the entire function should be rewritten.

Removing the gtk_adjustment_changed calls should be tested ASAP.  The
changes where an alternative is provided like this one

+#if GTK_CHECK_VERSION (3, 20, 0)
+      GdkDevice *gdev
+        = gdk_seat_get_pointer (gdk_display_get_default_seat (gdpy));
+#else
        GdkDevice *gdev = gdk_device_manager_get_client_pointer
          (gdk_display_get_device_manager (gdpy));
+#endif

should be installed in any case and this one

+#if GTK_CHECK_VERSION (3, 20, 0)
+  gtk_widget_set_focus_on_click (wb, FALSE);
+#else
    gtk_button_set_focus_on_click (GTK_BUTTON (wb), FALSE);
+#endif

obviously too.  This one

+#if GTK_CHECK_VERSION (3, 16, 0)
+  g_object_set (settings,
+                "gtk-menu-bar-accel", EMACS_CLASS,
+                "gtk-key-theme-name", "Emacs",
+                NULL);
+#else
    /* Remove F10 as a menu accelerator, it does not mix well with Emacs key
       bindings.  It doesn't seem to be any way to remove properties,
       so we set it to "" which in means "no key".  */
@@ -5243,6 +5283,7 @@ xg_initialize (void)
                                      "gtk-key-theme-name",
                                      "Emacs",
                                      EMACS_CLASS);
+#endif

looks good too.  All monitor/screen related changes seem harmless to me
and should be provided as well.  I'm not sure what you mean here

+  /* FIXME: This function assumes that GdkMonitor objects are never
+   * destroyed, even if the monitor is unplugged.  That’s probably the
+   * case, but should be verified.  */

If this is a problem it is a problem already now.  Or am I missing
something?

Maybe the menu related changes (although self-contained) should be done
in a separate fix.  In particular this

-      /* Adjust coordinates to be root-window-relative.  */
+      /* Adjust coordinates to be root-window-relative, but not for
+       * GTK+ 3.22, where the menu position is frame-relative.  */

and the subsequent

+#if GTK_CHECK_VERSION (3, 22, 0)
+  /* FIXME: We should pass the GDK event to this function instead of
+   * synthesizing it.  */

(I think you might want to get this from event_handler_gdk) look more
complicated and at least warrant larger comments.

I have no idea about the cairo related change.  But the XSync change
looks definitely good too.

Thanks, martin






^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#28189: 26.0.50; Emacs uses deprecated function gtk_window_parse_geometry
  2017-08-26  9:29           ` martin rudalics
@ 2017-08-27 13:34             ` Philipp Stephani
  2017-09-03 11:49               ` martin rudalics
  2017-09-23 11:22               ` Philipp Stephani
  0 siblings, 2 replies; 21+ messages in thread
From: Philipp Stephani @ 2017-08-27 13:34 UTC (permalink / raw)
  To: martin rudalics, 28189

[-- Attachment #1: Type: text/plain, Size: 2359 bytes --]

martin rudalics <rudalics@gmx.at> schrieb am Sa., 26. Aug. 2017 um
11:29 Uhr:

>  > I've attached a patch that fixes all deprecation warnings. It's not
>  > intended to be installed as-is, more as a baseline for discussion. Some
> of
>  > the functions have straightforward replacements, others are harder to
>  > replace, yet others have vanished altogether.
>
> I think you should install most of it right now so we have enough time
> to test it before a release.  There are people who build with GTK 3.22
> and could tell us whether it breaks anything (substantially, at least).
> The sooner we know the better.
>

OK, I've pushed all the "simple" changes for now.


>
> This one
>
> +#if GTK_CHECK_VERSION (3, 16, 0)
> +      emacs_abort ();
> +#else
>
> looks a bit harsh and the corresponding logic appears quite contrived.
> Maybe the entire function should be rewritten.
>

The underlying issue here is that GTK no longer seems to have a concept of
a "background color", but Emacs still assumes that concept exists.


>
> Removing the gtk_adjustment_changed calls should be tested ASAP.


How could that be tested?



> +  /* FIXME: This function assumes that GdkMonitor objects are never
> +   * destroyed, even if the monitor is unplugged.  That’s probably the
> +   * case, but should be verified.  */
>
> If this is a problem it is a problem already now.  Or am I missing
> something?
>

I think you're right, I've removed the comment. I was concerned about the
lifetime of the monitor objects, but I can't imagine this being an issue.


>
> +#if GTK_CHECK_VERSION (3, 22, 0)
> +  /* FIXME: We should pass the GDK event to this function instead of
> +   * synthesizing it.  */
>
> (I think you might want to get this from event_handler_gdk)
>

I don't think that's possible, because the filter is run before the GTK
event is even created, so it has no access to it. In fact, Emacs appears to
swallow most X events before they are translated to GTK events.
This should be fixed "for real" by creating a gtk3term, which doesn't use
any X functions. It appears to me that the current "X with a bit of GTK
sprinkled on top" can't work any more.


>
> I have no idea about the cairo related change.


That's only used for the visible bell, which still works after the change.

[-- Attachment #2: Type: text/html, Size: 3535 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#28189: 26.0.50; Emacs uses deprecated function gtk_window_parse_geometry
  2017-08-27 13:34             ` Philipp Stephani
@ 2017-09-03 11:49               ` martin rudalics
  2017-09-19 15:35                 ` Philipp Stephani
  2017-09-23 11:22               ` Philipp Stephani
  1 sibling, 1 reply; 21+ messages in thread
From: martin rudalics @ 2017-09-03 11:49 UTC (permalink / raw)
  To: Philipp Stephani, 28189

 > OK, I've pushed all the "simple" changes for now.

Belated thanks.  Do you think the warnings cited in

bug#26855: 25.2; Menus off screen, gtk errors

are handled by your changes (I've been too lazy to check that)?  This is
one of our few clients with GTK 3.22, sadly building from Emacs 25 only.

 >> This one
 >>
 >> +#if GTK_CHECK_VERSION (3, 16, 0)
 >> +      emacs_abort ();
 >> +#else
 >>
 >> looks a bit harsh and the corresponding logic appears quite contrived.
 >> Maybe the entire function should be rewritten.
 >>
 >
 > The underlying issue here is that GTK no longer seems to have a concept of
 > a "background color", but Emacs still assumes that concept exists.

I understand.  But can't we catch that in a less intimidating way?

 >> Removing the gtk_adjustment_changed calls should be tested ASAP.
 >
 >
 > How could that be tested?

By removing these calls as you proposed and waiting till someone with
GTK 3.22 hollers.

 >> +#if GTK_CHECK_VERSION (3, 22, 0)
 >> +  /* FIXME: We should pass the GDK event to this function instead of
 >> +   * synthesizing it.  */
 >>
 >> (I think you might want to get this from event_handler_gdk)
 >>
 >
 > I don't think that's possible, because the filter is run before the GTK
 > event is even created, so it has no access to it. In fact, Emacs appears to
 > swallow most X events before they are translated to GTK events.
 > This should be fixed "for real" by creating a gtk3term, which doesn't use
 > any X functions. It appears to me that the current "X with a bit of GTK
 > sprinkled on top" can't work any more.

I have no ideas of the implications of such an approach and whether it's
feasible.  We would first have to find all instances where we use an X
solution instead of a GTK one and fix them.  After that we would have to
decide whether the cases where no adequate GTK solution was found can be
simply removed or ignored for GTK built Emacsen.

Unless you are prepared to do that, I see no-one here to tackle such a
task.  Daniel Colascione has proposed to "go GTK-only" a couple of
months ago but seems to keep a low profile since then (like all others
involved in that thread).

Thanks again for all the work, martin





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#28189: 26.0.50; Emacs uses deprecated function gtk_window_parse_geometry
  2017-09-03 11:49               ` martin rudalics
@ 2017-09-19 15:35                 ` Philipp Stephani
  2017-09-19 16:38                   ` Philipp Stephani
  0 siblings, 1 reply; 21+ messages in thread
From: Philipp Stephani @ 2017-09-19 15:35 UTC (permalink / raw)
  To: martin rudalics, 28189

[-- Attachment #1: Type: text/plain, Size: 2943 bytes --]

martin rudalics <rudalics@gmx.at> schrieb am So., 3. Sep. 2017 um 13:49 Uhr:

>  > OK, I've pushed all the "simple" changes for now.
>
> Belated thanks.  Do you think the warnings cited in
>
> bug#26855: 25.2; Menus off screen, gtk errors
>
> are handled by your changes (I've been too lazy to check that)?  This is
> one of our few clients with GTK 3.22, sadly building from Emacs 25 only.
>
>
I haven't seen these warnings either with or without the patch.


>  >> This one
>  >>
>  >> +#if GTK_CHECK_VERSION (3, 16, 0)
>  >> +      emacs_abort ();
>  >> +#else
>  >>
>  >> looks a bit harsh and the corresponding logic appears quite contrived.
>  >> Maybe the entire function should be rewritten.
>  >>
>  >
>  > The underlying issue here is that GTK no longer seems to have a concept
> of
>  > a "background color", but Emacs still assumes that concept exists.
>
> I understand.  But can't we catch that in a less intimidating way?
>

If you only talk about code restructuring, then sure. But if we want to
emulate (instead of just disable) background colors, then some more work is
needed.


>
>  >> Removing the gtk_adjustment_changed calls should be tested ASAP.
>  >
>  >
>  > How could that be tested?
>
> By removing these calls as you proposed and waiting till someone with
> GTK 3.22 hollers.
>

Will do, sorry for the delay.


>
>  >> +#if GTK_CHECK_VERSION (3, 22, 0)
>  >> +  /* FIXME: We should pass the GDK event to this function instead of
>  >> +   * synthesizing it.  */
>  >>
>  >> (I think you might want to get this from event_handler_gdk)
>  >>
>  >
>  > I don't think that's possible, because the filter is run before the GTK
>  > event is even created, so it has no access to it. In fact, Emacs
> appears to
>  > swallow most X events before they are translated to GTK events.
>  > This should be fixed "for real" by creating a gtk3term, which doesn't
> use
>  > any X functions. It appears to me that the current "X with a bit of GTK
>  > sprinkled on top" can't work any more.
>
> I have no ideas of the implications of such an approach and whether it's
> feasible.  We would first have to find all instances where we use an X
> solution instead of a GTK one and fix them.  After that we would have to
> decide whether the cases where no adequate GTK solution was found can be
> simply removed or ignored for GTK built Emacsen.
>
> Unless you are prepared to do that, I see no-one here to tackle such a
> task.  Daniel Colascione has proposed to "go GTK-only" a couple of
> months ago but seems to keep a low profile since then (like all others
> involved in that thread).
>
>
This is indeed a huge amount of work. If at all, I'd start from zero by
building up a GTK event loop (probably in a background thread like
w32term.c) and then go from there, without linking against any X libraries,
and see what breaks. It's unlikely that I find the time for this in the
near future, but at some point it needs to happen.

[-- Attachment #2: Type: text/html, Size: 4106 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#28189: 26.0.50; Emacs uses deprecated function gtk_window_parse_geometry
  2017-09-19 15:35                 ` Philipp Stephani
@ 2017-09-19 16:38                   ` Philipp Stephani
  0 siblings, 0 replies; 21+ messages in thread
From: Philipp Stephani @ 2017-09-19 16:38 UTC (permalink / raw)
  To: martin rudalics, 28189


[-- Attachment #1.1: Type: text/plain, Size: 702 bytes --]

Philipp Stephani <p.stephani2@gmail.com> schrieb am Di., 19. Sep. 2017 um
17:35 Uhr:

> martin rudalics <rudalics@gmx.at> schrieb am So., 3. Sep. 2017 um
> 13:49 Uhr:
>
>>
>>  > The underlying issue here is that GTK no longer seems to have a
>> concept of
>>  > a "background color", but Emacs still assumes that concept exists.
>>
>> I understand.  But can't we catch that in a less intimidating way?
>>
>
> If you only talk about code restructuring, then sure. But if we want to
> emulate (instead of just disable) background colors, then some more work is
> needed.
>
>

At least setting the background color should be doable in a non-deprecated
way using a custom CSS provider, see attached patch.

[-- Attachment #1.2: Type: text/html, Size: 1547 bytes --]

[-- Attachment #2: 0001-GTK-Use-a-style-provider-instead-of-deprecated-functio.txt --]
[-- Type: text/plain, Size: 1858 bytes --]

From 3d933f46ec74e4b76c34feb7aa52fc8db7f3bd88 Mon Sep 17 00:00:00 2001
From: Philipp Stephani <phst@google.com>
Date: Sun, 27 Aug 2017 12:42:56 +0200
Subject: [PATCH] GTK+: Use a style provider instead of deprecated function

* src/gtkutil.c (xg_set_widget_bg): Use a CSS style provider instead
of the deprecated gtk_widget_override_background_color.
---
 src/gtkutil.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/gtkutil.c b/src/gtkutil.c
index 9dc74d4a56..4ea04befcf 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -1050,16 +1050,23 @@ static void
 xg_set_widget_bg (struct frame *f, GtkWidget *w, unsigned long pixel)
 {
 #ifdef HAVE_GTK3
-  GdkRGBA bg;
   XColor xbg;
   xbg.pixel = pixel;
   if (XQueryColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), &xbg))
     {
-      bg.red = (double)xbg.red/65535.0;
-      bg.green = (double)xbg.green/65535.0;
-      bg.blue = (double)xbg.blue/65535.0;
-      bg.alpha = 1.0;
-      gtk_widget_override_background_color (w, GTK_STATE_FLAG_NORMAL, &bg);
+      const char format[] = "* { background-color: #%02x%02x%02x; }";
+      /* The format is always longer than the resulting string.  */
+      char buffer[sizeof format];
+      int n = snprintf(buffer, sizeof buffer, format,
+                       xbg.red >> 8, xbg.green >> 8, xbg.blue >> 8);
+      eassert(n > 0);
+      eassert (n < sizeof buffer);
+      GtkCssProvider *provider = gtk_css_provider_new ();
+      gtk_css_provider_load_from_data (provider, buffer, -1, NULL);
+      gtk_style_context_add_provider (gtk_widget_get_style_context(w),
+                                      GTK_STYLE_PROVIDER (provider),
+                                      GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+      g_object_unref (provider);
     }
 #else
   GdkColor bg;
-- 
2.14.1.690.gbb1197296e-goog


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* bug#28189: 26.0.50; Emacs uses deprecated function gtk_window_parse_geometry
  2017-08-27 13:34             ` Philipp Stephani
  2017-09-03 11:49               ` martin rudalics
@ 2017-09-23 11:22               ` Philipp Stephani
  2017-09-23 13:21                 ` martin rudalics
  1 sibling, 1 reply; 21+ messages in thread
From: Philipp Stephani @ 2017-09-23 11:22 UTC (permalink / raw)
  To: martin rudalics, 28189

[-- Attachment #1: Type: text/plain, Size: 1075 bytes --]

Philipp Stephani <p.stephani2@gmail.com> schrieb am So., 27. Aug. 2017 um
15:34 Uhr:

> martin rudalics <rudalics@gmx.at> schrieb am Sa., 26. Aug. 2017 um
> 11:29 Uhr:
>
>>  > I've attached a patch that fixes all deprecation warnings. It's not
>>  > intended to be installed as-is, more as a baseline for discussion.
>> Some of
>>  > the functions have straightforward replacements, others are harder to
>>  > replace, yet others have vanished altogether.
>>
>> I think you should install most of it right now so we have enough time
>> to test it before a release.  There are people who build with GTK 3.22
>> and could tell us whether it breaks anything (substantially, at least).
>> The sooner we know the better.
>>
>
> OK, I've pushed all the "simple" changes for now.
>
>

I've now pushed the remaining changes as well, except for the popup menu
change. With that change, the menus seem to get positioned incorrectly
along the vertical axis, but I can't figure out how to fix it. I could push
the changes nevertheless and hope that somebody else might find a fix. WDYT?

[-- Attachment #2: Type: text/html, Size: 1786 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#28189: 26.0.50; Emacs uses deprecated function gtk_window_parse_geometry
  2017-09-23 11:22               ` Philipp Stephani
@ 2017-09-23 13:21                 ` martin rudalics
  2017-09-23 13:28                   ` Eli Zaretskii
  2017-09-23 16:36                   ` Philipp Stephani
  0 siblings, 2 replies; 21+ messages in thread
From: martin rudalics @ 2017-09-23 13:21 UTC (permalink / raw)
  To: Philipp Stephani, 28189

 > I've now pushed the remaining changes as well,

Thanks.  At least for the background color fix your decision to push to
master was probably right.  But we really should consider backporting
your changes to the release branch if after a few weeks no problems
arise.  From recent bug reports it's quite evident that most people
remained on master and the release branch is hardly tested at all.  So
I'm quite confident that your changes are already getting tested.

 > except for the popup menu
 > change. With that change, the menus seem to get positioned incorrectly
 > along the vertical axis, but I can't figure out how to fix it. I could push
 > the changes nevertheless and hope that somebody else might find a fix. WDYT?

Please post this patch separately and explicitly ask people to try it.
The GTK menu bug reports (25064, 26130, 26855, 27131, 27667, 28511) -
though most of them by the same author but yet all with GTK 3.22 -
abandon and really should get treatment before the release.  Virtually
any patch might give us some insight here.  So please send the patch to
the thread with most of the reports (25064, 26130, 26855, 27131) merged
in and let's see whether it at least eliminates some warnings.  Maybe
we're lucky.

And again many thanks for your efforts, martin





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#28189: 26.0.50; Emacs uses deprecated function gtk_window_parse_geometry
  2017-09-23 13:21                 ` martin rudalics
@ 2017-09-23 13:28                   ` Eli Zaretskii
  2017-09-23 16:32                     ` Philipp Stephani
  2017-09-23 18:28                     ` martin rudalics
  2017-09-23 16:36                   ` Philipp Stephani
  1 sibling, 2 replies; 21+ messages in thread
From: Eli Zaretskii @ 2017-09-23 13:28 UTC (permalink / raw)
  To: martin rudalics; +Cc: p.stephani2, 28189

> Date: Sat, 23 Sep 2017 15:21:53 +0200
> From: martin rudalics <rudalics@gmx.at>
> 
>  > I've now pushed the remaining changes as well,
> 
> Thanks.  At least for the background color fix your decision to push to
> master was probably right.  But we really should consider backporting
> your changes to the release branch if after a few weeks no problems
> arise.

Actually, the fix should have been pushed to the release branch to
begin with, since this bug is on the list of Emacs 26.1 release
blockers.

Thanks.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#28189: 26.0.50; Emacs uses deprecated function gtk_window_parse_geometry
  2017-09-23 13:28                   ` Eli Zaretskii
@ 2017-09-23 16:32                     ` Philipp Stephani
  2017-09-23 16:48                       ` Eli Zaretskii
  2017-09-23 18:28                     ` martin rudalics
  1 sibling, 1 reply; 21+ messages in thread
From: Philipp Stephani @ 2017-09-23 16:32 UTC (permalink / raw)
  To: Eli Zaretskii, martin rudalics; +Cc: 28189

[-- Attachment #1: Type: text/plain, Size: 830 bytes --]

Eli Zaretskii <eliz@gnu.org> schrieb am Sa., 23. Sep. 2017 um 15:29 Uhr:

> > Date: Sat, 23 Sep 2017 15:21:53 +0200
> > From: martin rudalics <rudalics@gmx.at>
> >
> >  > I've now pushed the remaining changes as well,
> >
> > Thanks.  At least for the background color fix your decision to push to
> > master was probably right.  But we really should consider backporting
> > your changes to the release branch if after a few weeks no problems
> > arise.
>
> Actually, the fix should have been pushed to the release branch to
> begin with, since this bug is on the list of Emacs 26.1 release
> blockers.
>
>
I'm not sure to what extent these patches should be called "fixes": Sure,
they get rid of warnings, but generally only by no longer calling the
"offending" functions, without much testing whether anything might be
broken.

[-- Attachment #2: Type: text/html, Size: 1258 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#28189: 26.0.50; Emacs uses deprecated function gtk_window_parse_geometry
  2017-09-23 13:21                 ` martin rudalics
  2017-09-23 13:28                   ` Eli Zaretskii
@ 2017-09-23 16:36                   ` Philipp Stephani
  2017-09-23 18:29                     ` martin rudalics
  1 sibling, 1 reply; 21+ messages in thread
From: Philipp Stephani @ 2017-09-23 16:36 UTC (permalink / raw)
  To: martin rudalics, 28189

[-- Attachment #1: Type: text/plain, Size: 1131 bytes --]

martin rudalics <rudalics@gmx.at> schrieb am Sa., 23. Sep. 2017 um
15:21 Uhr:

>
>  > except for the popup menu
>  > change. With that change, the menus seem to get positioned incorrectly
>  > along the vertical axis, but I can't figure out how to fix it. I could
> push
>  > the changes nevertheless and hope that somebody else might find a fix.
> WDYT?
>
> Please post this patch separately and explicitly ask people to try it.
> The GTK menu bug reports (25064, 26130, 26855, 27131, 27667, 28511) -
> though most of them by the same author but yet all with GTK 3.22 -
> abandon and really should get treatment before the release.  Virtually
> any patch might give us some insight here.  So please send the patch to
> the thread with most of the reports (25064, 26130, 26855, 27131) merged
> in and let's see whether it at least eliminates some warnings.  Maybe
> we're lucky.
>
>
What thread exactly are you referring to? Most of these bug reports haven't
seen any discussion so far, but maybe I missed a thread.
Also aren't these bugs about the menu par? My patch is for popup menus, it
doesn't touch the menu bar code at all.

[-- Attachment #2: Type: text/html, Size: 1495 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#28189: 26.0.50; Emacs uses deprecated function gtk_window_parse_geometry
  2017-09-23 16:32                     ` Philipp Stephani
@ 2017-09-23 16:48                       ` Eli Zaretskii
  0 siblings, 0 replies; 21+ messages in thread
From: Eli Zaretskii @ 2017-09-23 16:48 UTC (permalink / raw)
  To: Philipp Stephani; +Cc: 28189

> From: Philipp Stephani <p.stephani2@gmail.com>
> Date: Sat, 23 Sep 2017 16:32:54 +0000
> Cc: 28189@debbugs.gnu.org
> 
>  Actually, the fix should have been pushed to the release branch to
>  begin with, since this bug is on the list of Emacs 26.1 release
>  blockers.
> 
> I'm not sure to what extent these patches should be called "fixes": Sure, they get rid of warnings, but generally
> only by no longer calling the "offending" functions, without much testing whether anything might be broken. 

Emacs 26.1 didn't even see its first pretest.  There's ample time to
test these changes until the release.

I'm also okay with removing the bug from the list of blockers, if
that's what you recommend.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#28189: 26.0.50; Emacs uses deprecated function gtk_window_parse_geometry
  2017-09-23 13:28                   ` Eli Zaretskii
  2017-09-23 16:32                     ` Philipp Stephani
@ 2017-09-23 18:28                     ` martin rudalics
  2017-09-23 18:31                       ` Eli Zaretskii
  1 sibling, 1 reply; 21+ messages in thread
From: martin rudalics @ 2017-09-23 18:28 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: p.stephani2, 28189

> Actually, the fix should have been pushed to the release branch to
> begin with, since this bug is on the list of Emacs 26.1 release
> blockers.

Which bug is this?

martin







^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#28189: 26.0.50; Emacs uses deprecated function gtk_window_parse_geometry
  2017-09-23 16:36                   ` Philipp Stephani
@ 2017-09-23 18:29                     ` martin rudalics
  0 siblings, 0 replies; 21+ messages in thread
From: martin rudalics @ 2017-09-23 18:29 UTC (permalink / raw)
  To: Philipp Stephani, 28189

 > What thread exactly are you referring to? Most of these bug reports haven't
 > seen any discussion so far, but maybe I missed a thread.
 > Also aren't these bugs about the menu par? My patch is for popup menus, it
 > doesn't touch the menu bar code at all.

AFAICT it's about menus popped up either from the menu bar or via mouse
clicks.  The thread starts with

bug#25064: 25.1; Menus are off-screen

where the poster doesn't tell much about the kind of menus.  For
bug#26139 which was merged with the former the poster says

   The problem is that all menus and pop ups are never visible. Pop ups
   show a narrow line at the top left of the screen, so I'm assuming that
   all of them may be off screen.

For bug#26855, merged as well, the poster says

   Menus (e.g. from the menubar) are appearing off screen.

And for bug#27131 (also merged) the poster says:

   Could be gtk problem. When running emacs on Fedora 25 with either
   cygwin X or vcxsrv as the x-server running on Windows 10 or Windows 7,
   menus appear off screen.

I have no idea whether this is a scaling issue or some principal
Emacs/GTK 3.22 incompatibility.  And I had no idea what to tell the
posters so there was no discussion.  Bug#27667 which looks similar seems
to be related to scaling.  That one mentions a tiny rectangle which also
made it into bug#28375.  Both built with GTK 3.22 as well.

martin





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#28189: 26.0.50; Emacs uses deprecated function gtk_window_parse_geometry
  2017-09-23 18:28                     ` martin rudalics
@ 2017-09-23 18:31                       ` Eli Zaretskii
  0 siblings, 0 replies; 21+ messages in thread
From: Eli Zaretskii @ 2017-09-23 18:31 UTC (permalink / raw)
  To: martin rudalics; +Cc: p.stephani2, 28189

> Date: Sat, 23 Sep 2017 20:28:03 +0200
> From: martin rudalics <rudalics@gmx.at>
> CC: p.stephani2@gmail.com, 28189@debbugs.gnu.org
> 
> > Actually, the fix should have been pushed to the release branch to
> > begin with, since this bug is on the list of Emacs 26.1 release
> > blockers.
> 
> Which bug is this?

The one we are discussing here, 28189.





^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2017-09-23 18:31 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-22 20:22 bug#28189: 26.0.50; Emacs uses deprecated function gtk_window_parse_geometry Philipp
2017-08-23  8:46 ` martin rudalics
2017-08-23 10:38   ` Philipp Stephani
2017-08-23 13:19     ` martin rudalics
2017-08-23 23:26       ` Philipp Stephani
2017-08-24  9:37         ` martin rudalics
2017-08-25  9:28         ` Philipp Stephani
2017-08-26  9:29           ` martin rudalics
2017-08-27 13:34             ` Philipp Stephani
2017-09-03 11:49               ` martin rudalics
2017-09-19 15:35                 ` Philipp Stephani
2017-09-19 16:38                   ` Philipp Stephani
2017-09-23 11:22               ` Philipp Stephani
2017-09-23 13:21                 ` martin rudalics
2017-09-23 13:28                   ` Eli Zaretskii
2017-09-23 16:32                     ` Philipp Stephani
2017-09-23 16:48                       ` Eli Zaretskii
2017-09-23 18:28                     ` martin rudalics
2017-09-23 18:31                       ` Eli Zaretskii
2017-09-23 16:36                   ` Philipp Stephani
2017-09-23 18:29                     ` martin rudalics

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).