1
0
Fork 0
spectre/source/Platform/Unix/X11Display.h

62 lines
1.2 KiB
C++

#ifndef PLATFORM_UNIX_X11DISPLAY_H
#define PLATFORM_UNIX_X11DISPLAY_H
#include <Spectre/Display/DisplayDescription.h> // Prevents conflict with X.h defining "None"
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
#include <Platform/PlatformDisplay.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 :
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 void setCaption(const std::string& caption);
virtual void setIcon(const std::string& icon);
virtual void showCursor(bool value);
void processEvent(const ::XEvent& event);
protected :
void createHiddenCursor();
protected :
::Display* m_disp;
::Window m_win;
int m_screen;
::Cursor m_cur_hidden;
::Cursor m_cur_last;
Vector2u m_size;
};
} // namespace sp
#endif /* PLATFORM_UNIX_X11DISPLAY_H */