From 2ab5c7fc4159a2557001237bd855dfd4436e1b21 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Mon, 30 Dec 2019 05:32:31 +0100 Subject: [PATCH] Platform/Unix/X11Display: Adding processEvent() to handle resize. --- source/Platform/Unix/X11Display.cpp | 18 ++++++++++++++++++ source/Platform/Unix/X11Display.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/source/Platform/Unix/X11Display.cpp b/source/Platform/Unix/X11Display.cpp index a98ccd3..217c21c 100644 --- a/source/Platform/Unix/X11Display.cpp +++ b/source/Platform/Unix/X11Display.cpp @@ -114,4 +114,22 @@ void X11Display::showCursor(bool value) // TODO: Implement } +void X11Display::processEvent(const ::XEvent& event) +{ + Vector2u size; + + switch(event.xany.type) { + case ConfigureNotify: + size.x = event.xconfigure.width; + size.y = event.xconfigure.height; + + if (m_size != size) { + m_size = size; + Log::info("X11: Resize event"); + onReshape(size.x, size.y); + } + break; + } +} + } // namespace sp diff --git a/source/Platform/Unix/X11Display.h b/source/Platform/Unix/X11Display.h index 28818b8..330ffba 100644 --- a/source/Platform/Unix/X11Display.h +++ b/source/Platform/Unix/X11Display.h @@ -35,6 +35,8 @@ public : virtual void showCursor(bool value); + void processEvent(const ::XEvent& event); + protected : ::Display* m_disp;