1
0
Fork 0

Platform/Unix/X11Display: Implement showCursor()

This commit is contained in:
Henrik Hautakoski 2020-10-17 15:07:20 +02:00
parent d73c787f40
commit 3d9dda64ca
2 changed files with 32 additions and 5 deletions

View file

@ -10,9 +10,11 @@ namespace sp {
X11Display::
X11Display() :
m_screen (0),
m_disp (NULL),
m_size (200,200)
m_screen (0),
m_disp (NULL),
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");
createHiddenCursor();
return true;
}
@ -117,9 +121,27 @@ void X11Display::setIcon(const std::string& icon)
// 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)
{
// TODO: Implement
XDefineCursor(m_disp, m_win, value ? m_cur_last : m_cur_hidden);
}
void X11Display::processEvent(const ::XEvent& event)