compositor/dnd: Guard X11 types

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2445>
This commit is contained in:
Bilal Elmoussaoui 2022-06-01 09:39:01 +02:00
parent 761a254e6f
commit 3e95609073
3 changed files with 12 additions and 1 deletions

View File

@ -21,17 +21,22 @@
#define META_DND_PRIVATE__H #define META_DND_PRIVATE__H
#include <glib.h> #include <glib.h>
#ifdef HAVE_X11
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include "compositor/meta-compositor-x11.h"
#endif
#include "backends/meta-backend-private.h" #include "backends/meta-backend-private.h"
#include "compositor/meta-compositor-x11.h"
#ifdef HAVE_X11
gboolean meta_dnd_handle_xdnd_event (MetaBackend *backend, gboolean meta_dnd_handle_xdnd_event (MetaBackend *backend,
MetaCompositorX11 *compositor_x11, MetaCompositorX11 *compositor_x11,
Display *xdisplay, Display *xdisplay,
XEvent *xev); XEvent *xev);
void meta_dnd_init_xdnd (MetaX11Display *x11_display); void meta_dnd_init_xdnd (MetaX11Display *x11_display);
#endif
#ifdef HAVE_WAYLAND #ifdef HAVE_WAYLAND
void meta_dnd_wayland_handle_begin_modal (MetaCompositor *compositor); void meta_dnd_wayland_handle_begin_modal (MetaCompositor *compositor);

View File

@ -125,6 +125,7 @@ meta_dnd_get_backend (MetaDnd *dnd)
return priv->backend; return priv->backend;
} }
#ifdef HAVE_X11
void void
meta_dnd_init_xdnd (MetaX11Display *x11_display) meta_dnd_init_xdnd (MetaX11Display *x11_display)
{ {
@ -155,6 +156,7 @@ meta_dnd_init_xdnd (MetaX11Display *x11_display)
XInternAtom (xdisplay, "XdndProxy", False), XA_WINDOW, XInternAtom (xdisplay, "XdndProxy", False), XA_WINDOW,
32, PropModeReplace, (const unsigned char *) &xwindow, 1); 32, PropModeReplace, (const unsigned char *) &xwindow, 1);
} }
#endif
static void static void
meta_dnd_notify_dnd_enter (MetaDnd *dnd) meta_dnd_notify_dnd_enter (MetaDnd *dnd)
@ -184,6 +186,7 @@ meta_dnd_notify_dnd_leave (MetaDnd *dnd)
* *
* http://www.freedesktop.org/wiki/Specifications/XDND * http://www.freedesktop.org/wiki/Specifications/XDND
*/ */
#ifdef HAVE_X11
gboolean gboolean
meta_dnd_handle_xdnd_event (MetaBackend *backend, meta_dnd_handle_xdnd_event (MetaBackend *backend,
MetaCompositorX11 *compositor_x11, MetaCompositorX11 *compositor_x11,
@ -243,6 +246,7 @@ meta_dnd_handle_xdnd_event (MetaBackend *backend,
return FALSE; return FALSE;
} }
#endif
#ifdef HAVE_WAYLAND #ifdef HAVE_WAYLAND
static MetaWaylandDataDevice * static MetaWaylandDataDevice *

View File

@ -1429,8 +1429,10 @@ meta_x11_display_new (MetaDisplay *display,
meta_x11_startup_notification_init (x11_display); meta_x11_startup_notification_init (x11_display);
meta_x11_selection_init (x11_display); meta_x11_selection_init (x11_display);
#ifdef HAVE_X11
if (!meta_is_wayland_compositor ()) if (!meta_is_wayland_compositor ())
meta_dnd_init_xdnd (x11_display); meta_dnd_init_xdnd (x11_display);
#endif
sprintf (buf, "WM_S%d", number); sprintf (buf, "WM_S%d", number);