qemu-e2k/ui
Philippe Mathieu-Daudé 28b58f19d2 ui/gtk: Get display refresh rate with GDK version 3.22 or later
Commit c4c00922cc introduced the use of the GdkMonitor API, which
was introduced in GTK+ 3.22:
https://developer.gnome.org/gdk3/stable/api-index-3-22.html#api-index-3.22

Unfortunately this break building with older versions, as on Ubuntu
Xenial which provides GTK+ 3.18:

  $ lsb_release -cd
  Description:    Ubuntu 16.04.5 LTS
  Codename:       xenial

  $ ./configure && make
  GTK support       yes (3.18.9)
  GTK GL support    no
  [...]
    CC      ui/gtk.o
  qemu/ui/gtk.c: In function ‘gd_vc_gfx_init’:
  qemu/ui/gtk.c:1973:5: error: unknown type name ‘GdkMonitor’
       GdkMonitor *monitor = gdk_display_get_monitor_at_window(dpy, win);
       ^
  qemu/ui/gtk.c:1973:27: error: implicit declaration of function ‘gdk_display_get_monitor_at_window’ [-Werror=implicit-function-declaration]
       GdkMonitor *monitor = gdk_display_get_monitor_at_window(dpy, win);
                             ^
  qemu/ui/gtk.c:1973:5: error: nested extern declaration of ‘gdk_display_get_monitor_at_window’ [-Werror=nested-externs]
       GdkMonitor *monitor = gdk_display_get_monitor_at_window(dpy, win);
       ^
  qemu/ui/gtk.c:1973:27: error: initialization makes pointer from integer without a cast [-Werror=int-conversion]
       GdkMonitor *monitor = gdk_display_get_monitor_at_window(dpy, win);
                             ^
  qemu/ui/gtk.c:2035:28: error: implicit declaration of function ‘gdk_monitor_get_refresh_rate’ [-Werror=implicit-function-declaration]
       refresh_rate_millihz = gdk_monitor_get_refresh_rate(monitor);
                              ^
  qemu/ui/gtk.c:2035:5: error: nested extern declaration of ‘gdk_monitor_get_refresh_rate’ [-Werror=nested-externs]
       refresh_rate_millihz = gdk_monitor_get_refresh_rate(monitor);
       ^
  cc1: all warnings being treated as errors
  qemu/rules.mak:69: recipe for target 'ui/gtk.o' failed
  make: *** [ui/gtk.o] Error 1

GTK+ provides convenient definition in <gdk/gdkversionmacros.h>
(already include by <gdk/gdk.h>) to check which API are available.

We only use the GdkMonitor API to get the monitor refresh rate.

Extract this code as a new gd_refresh_rate_millihz() function,
and check GDK_VERSION_3_22 is defined before calling its API.
If it is not defined, return 0. This is safe and fixes our build
failure (see https://travis-ci.org/qemu/qemu/builds/636992508).

Reported-by: Travis-CI
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20200116115413.31650-1-philmd@redhat.com
Fixes: c4c00922cc (display/gtk: get proper refreshrate)
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-01-16 14:03:45 +00:00
..
icons ui: install logo icons to $prefix/share/icons 2019-01-21 09:43:13 +01:00
keycodemapdb@6b3d716e2b
shader
cocoa.m ui: Fix hanging up Cocoa display on macOS 10.15 (Catalina) 2019-10-18 10:35:31 +02:00
console-gl.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
console.c ui: Print available display backends with '-display help' 2020-01-14 07:26:36 +01:00
curses_keys.h curses: support wide input 2019-03-11 08:39:02 +01:00
curses.c curses: correctly pass the color pair to setcchar() 2019-10-18 10:39:12 +02:00
cursor_hidden.xpm
cursor_left_ptr.xpm
cursor.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
egl-context.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
egl-headless.c ui/egl: fix framebuffer reads 2019-09-17 13:42:02 +02:00
egl-helpers.c ui/egl: fix framebuffer reads 2019-09-17 13:42:02 +02:00
gtk-egl.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
gtk-gl-area.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
gtk.c ui/gtk: Get display refresh rate with GDK version 3.22 or later 2020-01-16 14:03:45 +00:00
input-barrier.c ui: fix keymap file search in input-barrier object 2019-10-18 10:40:46 +02:00
input-barrier.h ui: add an embedded Barrier client 2019-09-17 13:43:22 +02:00
input-keymap.c Clean up inclusion of sysemu/sysemu.h 2019-08-16 13:31:53 +02:00
input-legacy.c Clean up inclusion of sysemu/sysemu.h 2019-08-16 13:31:53 +02:00
input-linux.c input-linux: add shift+shift as a grab toggle 2019-08-21 12:25:46 +02:00
input.c sysemu: Split sysemu/runstate.h off sysemu/sysemu.h 2019-08-16 13:37:36 +02:00
kbd-state.c Include qemu/queue.h slightly less 2019-08-16 13:31:52 +02:00
keymaps.c Clean up inclusion of sysemu/sysemu.h 2019-08-16 13:31:53 +02:00
keymaps.h Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
Makefile.objs ui: add an embedded Barrier client 2019-09-17 13:43:22 +02:00
qemu-pixman.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
qemu-x509.h
qemu.desktop ui: fix icon display for GTK frontend under GNOME Shell with Wayland 2019-01-21 09:43:13 +01:00
sdl2-2d.c Clean up inclusion of sysemu/sysemu.h 2019-08-16 13:31:53 +02:00
sdl2-gl.c Clean up inclusion of sysemu/sysemu.h 2019-08-16 13:31:53 +02:00
sdl2-input.c Clean up inclusion of sysemu/sysemu.h 2019-08-16 13:31:53 +02:00
sdl2.c glib: use portable g_setenv() 2019-12-17 09:05:23 +01:00
shader.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
spice-app.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
spice-core.c sysemu: Split sysemu/runstate.h off sysemu/sysemu.h 2019-08-16 13:37:36 +02:00
spice-display.c Clean up inclusion of sysemu/sysemu.h 2019-08-16 13:31:53 +02:00
spice-input.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
trace-events ppm-save: pass opened fd 2020-01-02 13:54:57 +04:00
vgafont.h
vnc_keysym.h
vnc-auth-sasl.c authz: delete existing ACL implementation 2019-02-26 15:32:19 +00:00
vnc-auth-sasl.h Include qemu/main-loop.h less 2019-08-16 13:31:52 +02:00
vnc-auth-vencrypt.c authz: delete existing ACL implementation 2019-02-26 15:32:19 +00:00
vnc-auth-vencrypt.h
vnc-enc-hextile-template.h ui: vnc: finish removing TABs 2019-02-05 16:50:18 +01:00
vnc-enc-hextile.c
vnc-enc-tight.c vnc: fix memory leak when vnc disconnect 2019-09-17 13:45:10 +02:00
vnc-enc-tight.h
vnc-enc-zlib.c vnc: fix memory leak when vnc disconnect 2019-09-17 13:45:10 +02:00
vnc-enc-zrle.c vnc: fix memory leak when vnc disconnect 2019-09-17 13:45:10 +02:00
vnc-enc-zrle.h
vnc-enc-zrle.inc.c vnc: fix memory leak when vnc disconnect 2019-09-17 13:45:10 +02:00
vnc-enc-zywrle-template.c avoid TABs in files that only contain a few 2019-01-11 15:46:56 +01:00
vnc-enc-zywrle.h ui: vnc: finish removing TABs 2019-02-05 16:50:18 +01:00
vnc-jobs.c vnc: fix memleak of the "vnc-worker-output" name 2018-08-24 08:40:10 +02:00
vnc-jobs.h
vnc-palette.c
vnc-palette.h
vnc-stubs.c
vnc-ws.c authz: delete existing ACL implementation 2019-02-26 15:32:19 +00:00
vnc-ws.h
vnc.c vnc: drop Error pointer indirection in vnc_client_io_error 2019-12-18 08:36:16 +01:00
vnc.h vnc: drop Error pointer indirection in vnc_client_io_error 2019-12-18 08:36:16 +01:00
x_keymap.c
x_keymap.h