diff --git a/src/plugins/platforms/x11/common/eglonxbackend.cpp b/src/plugins/platforms/x11/common/eglonxbackend.cpp
index d2900c7c39..c8acefe827 100644
--- a/src/plugins/platforms/x11/common/eglonxbackend.cpp
+++ b/src/plugins/platforms/x11/common/eglonxbackend.cpp
@@ -214,7 +214,7 @@ EGLSurface EglOnXBackend::createSurface(xcb_window_t window)
     }
 
     // Window is 64 bits on a 64-bit architecture whereas xcb_window_t is always 32 bits.
-    unsigned long nativeWindow = window;
+    uintptr_t nativeWindow = window;
 
     EGLSurface surface = EGL_NO_SURFACE;
     if (havePlatformBase()) {