diff --git a/plugins/qpa/eglhelpers.h b/plugins/qpa/eglhelpers.h
index 1eb7624771..30eb56d120 100644
--- a/plugins/qpa/eglhelpers.h
+++ b/plugins/qpa/eglhelpers.h
@@ -20,9 +20,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 #pragma once
 
-#define MESA_EGL_NO_X11_HEADERS
 #include <epoxy/egl.h>
 #include "fixqopengl.h"
+#include <fixx11h.h>
 
 #include <QSurfaceFormat>
 
diff --git a/plugins/qpa/offscreensurface.h b/plugins/qpa/offscreensurface.h
index 1254981ffa..5b8ce29750 100644
--- a/plugins/qpa/offscreensurface.h
+++ b/plugins/qpa/offscreensurface.h
@@ -20,9 +20,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 #pragma once
 
-#define MESA_EGL_NO_X11_HEADERS
 #include <epoxy/egl.h>
 #include "fixqopengl.h"
+#include <fixx11h.h>
 
 #include <qpa/qplatformoffscreensurface.h>