Platform/Unix/X11Display: Implement showCursor()
This commit is contained in:
parent
10e1a9071e
commit
396f47cc22
2 changed files with 32 additions and 5 deletions
|
|
@ -10,9 +10,11 @@ namespace sp {
|
||||||
|
|
||||||
X11Display::
|
X11Display::
|
||||||
X11Display() :
|
X11Display() :
|
||||||
m_screen (0),
|
m_screen (0),
|
||||||
m_disp (NULL),
|
m_disp (NULL),
|
||||||
m_size (200,200)
|
m_size (200,200),
|
||||||
|
m_cur_last (0),
|
||||||
|
m_cur_hidden (0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -65,6 +67,8 @@ bool X11Display::create(DisplayDescription description)
|
||||||
|
|
||||||
Log::info("X11: Created display");
|
Log::info("X11: Created display");
|
||||||
|
|
||||||
|
createHiddenCursor();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -117,9 +121,27 @@ void X11Display::setIcon(const std::string& icon)
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void X11Display::createHiddenCursor()
|
||||||
|
{
|
||||||
|
XColor c;
|
||||||
|
Pixmap pix = ::XCreatePixmap(m_disp, m_win, 1, 1, 1);
|
||||||
|
GC gc = ::XCreateGC(m_disp, pix, 0, NULL);
|
||||||
|
|
||||||
|
// Draw transparent pixel.
|
||||||
|
::XDrawPoint(m_disp, pix, gc, 0, 0);
|
||||||
|
|
||||||
|
c.red = c.green = c.blue = 0;
|
||||||
|
c.flags = DoRed | DoGreen | DoBlue;
|
||||||
|
m_cur_hidden = XCreatePixmapCursor(m_disp, pix, pix, &c, &c, 0, 0);
|
||||||
|
|
||||||
|
// Free GC and pixmap.
|
||||||
|
::XFreePixmap(m_disp, pix);
|
||||||
|
::XFreeGC(m_disp, gc);
|
||||||
|
}
|
||||||
|
|
||||||
void X11Display::showCursor(bool value)
|
void X11Display::showCursor(bool value)
|
||||||
{
|
{
|
||||||
// TODO: Implement
|
XDefineCursor(m_disp, m_win, value ? m_cur_last : m_cur_hidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
void X11Display::processEvent(const ::XEvent& event)
|
void X11Display::processEvent(const ::XEvent& event)
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,10 @@ public :
|
||||||
|
|
||||||
void processEvent(const ::XEvent& event);
|
void processEvent(const ::XEvent& event);
|
||||||
|
|
||||||
|
protected :
|
||||||
|
|
||||||
|
void createHiddenCursor();
|
||||||
|
|
||||||
protected :
|
protected :
|
||||||
|
|
||||||
::Display* m_disp;
|
::Display* m_disp;
|
||||||
|
|
@ -47,7 +51,8 @@ protected :
|
||||||
|
|
||||||
int m_screen;
|
int m_screen;
|
||||||
|
|
||||||
//GC m_GC;
|
::Cursor m_cur_hidden;
|
||||||
|
::Cursor m_cur_last;
|
||||||
|
|
||||||
Vector2u m_size;
|
Vector2u m_size;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue