Add the ping/pong events to avoid non-responding window and few other minor fixes

This commit is contained in:
Deve 2017-04-28 23:04:34 +02:00
parent 01ffc129fb
commit fc79ee50d0
5 changed files with 40 additions and 2 deletions

View File

@ -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.

View File

@ -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()

View File

@ -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<CIrrDeviceWayland *>(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,

View File

@ -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);

View File

@ -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"
/*