Platform/Unix: Rename X11SharedDisplay to Xlib, and remove Display member variable from all classes.
We now initialize/destroy the display in Xlib::init/shutdown that is called in UnixApplication::init/shutdown and therefore is valid through the whole lifetime. So no need for classes to keep references.
This commit is contained in:
parent
60dd9bacb0
commit
090646b61a
17 changed files with 137 additions and 201 deletions
|
|
@ -1,29 +1,19 @@
|
|||
|
||||
#include <Spectre/System/Event.h>
|
||||
#include <Spectre/System/Log.h>
|
||||
#include "Xlib.h"
|
||||
#include "X11Display.h"
|
||||
#include "X11Mouse.h"
|
||||
|
||||
#include "X11SharedDisplay.h"
|
||||
|
||||
namespace sp {
|
||||
|
||||
X11Mouse::X11Mouse() :
|
||||
m_disp(NULL),
|
||||
m_btn_state(0)
|
||||
{
|
||||
}
|
||||
|
||||
X11Mouse::~X11Mouse()
|
||||
{
|
||||
if (m_disp) {
|
||||
XReleaseDisplay(m_disp);
|
||||
}
|
||||
}
|
||||
|
||||
void X11Mouse::init()
|
||||
{
|
||||
m_disp = XGetDisplay();
|
||||
updateFocusedWindow();
|
||||
}
|
||||
|
||||
|
|
@ -62,14 +52,15 @@ bool X11Mouse::isButtonDown(Mouse::Button button) const
|
|||
|
||||
void X11Mouse::update(InputModule *input)
|
||||
{
|
||||
::Display* disp = Xlib::getDisplay();
|
||||
::Window root, child;
|
||||
int rx, ry, x = 0, y = 0;
|
||||
|
||||
updateFocusedWindow();
|
||||
|
||||
// Query position and button state.
|
||||
XQueryPointer(m_disp,
|
||||
m_win ? m_win : ::XDefaultRootWindow(m_disp),
|
||||
XQueryPointer(disp,
|
||||
m_win ? m_win : ::XDefaultRootWindow(disp),
|
||||
&root, &child,
|
||||
&rx, &ry,
|
||||
&x, &y, &m_btn_state);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue