1
0
Fork 0

Unix: Rename X11Display to X11Window and make it work again with Spectre/Window/Window

This commit is contained in:
Henrik Hautakoski 2023-08-22 10:06:19 +02:00
parent 96f6725428
commit 45d3bff620
9 changed files with 60 additions and 62 deletions

View file

@ -1,88 +0,0 @@
#ifndef PLATFORM_UNIX_X11DISPLAY_H
#define PLATFORM_UNIX_X11DISPLAY_H
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
#include <cstdint>
#include <Platform/PlatformDisplay.h>
#include "Xrandr.h"
namespace sp {
// NOTE: This class wraps a X11 Window and Screen handle
// and is NOT a Class wrapper around X11's `Display` type.
class X11Display : public PlatformDisplay
{
public :
static X11Display* getFocused();
X11Display();
virtual bool create(DisplayDescription description);
virtual void destroy();
virtual bool isValid();
virtual void* getHandle() const;
virtual void setSize(unsigned int width, unsigned int height);
virtual Vector2u getSize() const;
virtual void setPosition(unsigned int x, unsigned int y);
virtual Vector2u getPosition() const;
virtual void setVisible(bool visible);
virtual void setDecoration(unsigned decoration);
virtual void minimize();
virtual void maximize();
virtual void enterFullscreen(DisplayMode mode);
virtual void exitFullscreen();
virtual void setCaption(const std::string& caption);
virtual void setIcon(unsigned int width, unsigned int height, const uint8_t *pixels);
virtual void showCursor(bool value);
virtual void grabCursor(bool value);
void processEvent(const ::XEvent& event);
protected :
void createHiddenCursor();
void toggleFullscreen(bool enabled);
void wm_fullscreen(bool enabled);
protected :
::Window m_win;
int m_screen;
::Cursor m_cur_hidden;
::Cursor m_cur_last;
Vector2u m_size;
XRandR::VideoMode m_fullscreen_mode;
XRandR::VideoMode m_desktop_mode;
};
} // namespace sp
#endif /* PLATFORM_UNIX_X11DISPLAY_H */