From fc79ee50d01062e10936acaf267db24015adbb09 Mon Sep 17 00:00:00 2001 From: Deve Date: Fri, 28 Apr 2017 23:04:34 +0200 Subject: [PATCH] Add the ping/pong events to avoid non-responding window and few other minor fixes --- lib/irrlicht/include/IrrCompileConfig.h | 2 ++ .../source/Irrlicht/CIrrDeviceLinux.cpp | 3 +- .../source/Irrlicht/CIrrDeviceWayland.cpp | 34 +++++++++++++++++++ .../source/Irrlicht/COpenGLDriver.cpp | 2 +- src/guiengine/widgets/CGUIEditBox.cpp | 1 + 5 files changed, 40 insertions(+), 2 deletions(-) diff --git a/lib/irrlicht/include/IrrCompileConfig.h b/lib/irrlicht/include/IrrCompileConfig.h index 5a2b409b4..e567740b7 100644 --- a/lib/irrlicht/include/IrrCompileConfig.h +++ b/lib/irrlicht/include/IrrCompileConfig.h @@ -215,6 +215,8 @@ define out. */ #ifdef _IRR_COMPILE_WITH_WAYLAND #define _IRR_COMPILE_WITH_EGL_ +#undef _IRR_COMPILE_WITH_X11_ +#undef _IRR_COMPILE_WITH_X11_DEVICE_ #endif //! Define _IRR_OPENGL_USE_EXTPOINTER_ if the OpenGL renderer should use OpenGL extensions via function pointers. diff --git a/lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.cpp b/lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.cpp index fedc3d630..ab622e859 100644 --- a/lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.cpp +++ b/lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.cpp @@ -516,6 +516,7 @@ void IrrPrintXGrabError(int grabResult, const c8 * grabCommand ) #endif #ifdef _IRR_COMPILE_WITH_OPENGL_ +#ifdef _IRR_COMPILE_WITH_X11_ static GLXContext getMeAGLContext(Display *display, GLXFBConfig glxFBConfig, bool force_legacy_context) { GLXContext Context; @@ -600,7 +601,7 @@ static GLXContext getMeAGLContext(Display *display, GLXFBConfig glxFBConfig, boo Context = glXCreateNewContext(display, glxFBConfig, GLX_RGBA_TYPE, NULL, True); return Context; } - +#endif #endif bool CIrrDeviceLinux::createWindow() diff --git a/lib/irrlicht/source/Irrlicht/CIrrDeviceWayland.cpp b/lib/irrlicht/source/Irrlicht/CIrrDeviceWayland.cpp index 8edc20c21..cb1e96d8e 100644 --- a/lib/irrlicht/source/Irrlicht/CIrrDeviceWayland.cpp +++ b/lib/irrlicht/source/Irrlicht/CIrrDeviceWayland.cpp @@ -384,8 +384,27 @@ public: dev->VideoModeList.setDesktop(24, core::dimension2du(width, height)); } } + + static void + handle_ping(void *data, struct wl_shell_surface *shell_surface, + uint32_t serial) + { + wl_shell_surface_pong(shell_surface, serial); + } + + static void + handle_configure(void *data, struct wl_shell_surface *shell_surface, + uint32_t edges, int32_t width, int32_t height) + { + } + + static void + handle_popup_done(void *data, struct wl_shell_surface *shell_surface) + { + } static const struct wl_output_listener output_listener; + static const struct wl_shell_surface_listener shell_surface_listener; static void registry_add (void *data, struct wl_registry *registry, uint32_t name, const char *interface, uint32_t version) { CIrrDeviceWayland *dev = static_cast(data); @@ -443,12 +462,20 @@ const struct wl_output_listener WaylandCallbacks::output_listener = { WaylandCallbacks::display_handle_scale }; +const struct wl_shell_surface_listener WaylandCallbacks::shell_surface_listener = +{ + WaylandCallbacks::handle_ping, + WaylandCallbacks::handle_configure, + WaylandCallbacks::handle_popup_done +}; + const wl_registry_listener WaylandCallbacks::registry_listener = { WaylandCallbacks::registry_add, WaylandCallbacks::registry_remove, }; + //const char* wmDeleteWindow = "WM_DELETE_WINDOW"; //! constructor @@ -495,6 +522,8 @@ CIrrDeviceWayland::CIrrDeviceWayland(const SIrrlichtCreationParameters& param) wl_seat_add_listener(seat, &WaylandCallbacks::seat_listener, this); wl_output_add_listener(output, &WaylandCallbacks::output_listener, this); + + shell_surface = NULL; // create keymap createKeyMap(); @@ -532,6 +561,8 @@ CIrrDeviceWayland::~CIrrDeviceWayland() wl_keyboard_destroy(keyboard); wl_pointer_destroy(pointer); wl_seat_destroy(seat); + if (shell_surface) + wl_shell_surface_destroy(shell_surface); wl_registry_destroy(registry); wl_display_flush(display); wl_display_disconnect(display); @@ -592,6 +623,9 @@ bool CIrrDeviceWayland::createWindow() surface = wl_compositor_create_surface(compositor); shell_surface = wl_shell_get_shell_surface(shell, surface); + wl_shell_surface_add_listener(shell_surface, + &WaylandCallbacks::shell_surface_listener, this); + if (CreationParams.Fullscreen) { wl_shell_surface_set_fullscreen(shell_surface, diff --git a/lib/irrlicht/source/Irrlicht/COpenGLDriver.cpp b/lib/irrlicht/source/Irrlicht/COpenGLDriver.cpp index cf21b5c1e..4c6210f96 100644 --- a/lib/irrlicht/source/Irrlicht/COpenGLDriver.cpp +++ b/lib/irrlicht/source/Irrlicht/COpenGLDriver.cpp @@ -978,7 +978,7 @@ bool COpenGLDriver::endScene() } #endif -#ifdef _IRR_COMPILE_WITH_X11_DEVICE_ +#ifdef _IRR_COMPILE_WITH_WAYLAND if (DeviceType == EIDT_WAYLAND) { wl_display_dispatch_pending(wl_device->display); diff --git a/src/guiengine/widgets/CGUIEditBox.cpp b/src/guiengine/widgets/CGUIEditBox.cpp index acaa1db56..978ff1d1c 100644 --- a/src/guiengine/widgets/CGUIEditBox.cpp +++ b/src/guiengine/widgets/CGUIEditBox.cpp @@ -20,6 +20,7 @@ #include "utils/translation.hpp" #include "utils/time.hpp" +#include "../../../lib/irrlicht/include/IrrCompileConfig.h" #include "../../../lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.h" /*