tools: disable GTK's deprecated warnings

I'd be surprised if those get removed before the whole X11 support is
removed - and in that case we can remove the x11 support as well.
So let's disable the warnings and deal with it when it truly breaks -
there are no replacements for what we want to do here after all.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1233>
This commit is contained in:
Peter Hutterer 2025-06-19 14:40:11 +10:00
parent 56f0524115
commit f6c4a361c0

View file

@ -311,12 +311,22 @@ x_lock_pointer(struct window *w)
Window x_win;
int result;
/* gdk_display_get_default() is deprecated but probably won't be removed
* before GTK X11 is removed completely so this whole section will
* be gone anyway. Meanwhile, disable the warning
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
x_display = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
#pragma GCC diagnostic pop
#if HAVE_GTK4
GtkNative *window = gtk_widget_get_native(w->win);
GdkSurface *surface = gtk_native_get_surface(window);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
x_win = GDK_SURFACE_XID(surface);
#pragma GCC diagnostic pop
#else
GdkWindow *window = gtk_widget_get_window(w->win);
x_win = GDK_WINDOW_XID(window);
@ -336,7 +346,10 @@ x_unlock_pointer(struct window *w)
{
Display *x_display;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
x_display = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
#pragma GCC diagnostic pop
XUngrabPointer(x_display, CurrentTime);
}