Skip to content

Commit 95bee09

Browse files
dwrobeltomasz-karczewski-red
authored andcommitted
Disable X11 backend when compiling for Wayland
The following explicit call to XOpenDisplay: self->display = XOpenDisplay(DisplayString(display)); prevents us from linking without X11 library, so let's define DISALBE_X11_BACKEND when "use_wayland_backend" is in use and disable the X11 backend entirely. resolved conflicts on shell/platform/linux/fl_view.cc again removed shell/platform/linux/fl_renderer_x11.cc shell/platform/linux/fl_renderer_x11.h Signed-off-by: Damian Wrobel <[email protected]>
1 parent aaf8116 commit 95bee09

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

shell/platform/linux/BUILD.gn

+6
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,12 @@ source_set("flutter_linux_sources") {
126126
"FLUTTER_ENGINE_NO_PROTOTYPES",
127127
]
128128

129+
if (use_wayland_backend) {
130+
defines += [
131+
"DISALBE_X11_BACKEND",
132+
]
133+
}
134+
129135
deps = [
130136
"//flutter/shell/platform/common:common_cpp_input",
131137
"//flutter/shell/platform/common:common_cpp_switches",

shell/platform/linux/fl_view.cc

+13
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
#include "flutter/shell/platform/linux/fl_view_private.h"
88

9+
#include <gdk/gdkwayland.h>
10+
#if defined(GDK_WINDOWING_X11) && !defined(DISALBE_X11_BACKEND)
11+
#include <gdk/gdkx.h>
12+
#endif
913
#include <cstring>
1014

1115
#include "flutter/shell/platform/linux/fl_accessibility_plugin.h"
@@ -154,9 +158,18 @@ static void fl_view_plugin_registry_iface_init(
154158
iface->get_registrar_for_plugin = fl_view_get_registrar_for_plugin;
155159
}
156160

161+
<<<<<<< HEAD
157162
static gboolean event_box_button_release_event(GtkWidget* widget,
158163
GdkEventButton* event,
159164
FlView* view);
165+
=======
166+
static FlRenderer* fl_view_get_renderer_for_display(GdkDisplay* display) {
167+
#if defined(GDK_WINDOWING_X11) && !defined(DISALBE_X11_BACKEND)
168+
if (GDK_IS_X11_DISPLAY(display)) {
169+
return FL_RENDERER(fl_renderer_x11_new());
170+
}
171+
#endif
172+
>>>>>>> b456129a1... Disable X11 backend when compiling for Wayland
160173

161174
static gboolean event_box_button_press_event(GtkWidget* widget,
162175
GdkEventButton* event,

0 commit comments

Comments
 (0)