Utility/X11: Try to fix Linux implementation
This commit is contained in:
parent
27b000470d
commit
d1b5357504
|
|
@ -162,9 +162,10 @@ namespace Nz
|
||||||
bool CursorImpl::Create(SystemCursor cursor)
|
bool CursorImpl::Create(SystemCursor cursor)
|
||||||
{
|
{
|
||||||
ScopedXCBConnection connection;
|
ScopedXCBConnection connection;
|
||||||
|
xcb_screen_t* screen = X11::XCBDefaultScreen(connection);
|
||||||
|
|
||||||
if (xcb_cursor_context_new(connection, m_screen, &m_cursorContext) >= 0)
|
if (xcb_cursor_context_new(connection, screen, &m_cursorContext) >= 0)
|
||||||
m_cursor = xcb_cursor_load_cursor(ctx, s_systemCursorIds[cursor]);
|
m_cursor = xcb_cursor_load_cursor(m_cursorContext, s_systemCursorIds[cursor]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -196,12 +197,12 @@ namespace Nz
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
hiddenCursor = xcb_generate_id(connection);
|
s_hiddenCursor = xcb_generate_id(connection);
|
||||||
|
|
||||||
// Create the cursor, using the pixmap as both the shape and the mask of the cursor
|
// Create the cursor, using the pixmap as both the shape and the mask of the cursor
|
||||||
if (!X11::CheckCookie(
|
if (!X11::CheckCookie(
|
||||||
connection, xcb_create_cursor(connection,
|
connection, xcb_create_cursor(connection,
|
||||||
hiddenCursor,
|
s_hiddenCursor,
|
||||||
cursorPixmap,
|
cursorPixmap,
|
||||||
cursorPixmap,
|
cursorPixmap,
|
||||||
0, 0, 0, // Foreground RGB color
|
0, 0, 0, // Foreground RGB color
|
||||||
|
|
@ -227,6 +228,8 @@ namespace Nz
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xcb_cursor_t CursorImpl::s_hiddenCursor = 0;
|
||||||
|
|
||||||
std::array<const char*, SystemCursor_Max + 1> CursorImpl::s_systemCursorIds =
|
std::array<const char*, SystemCursor_Max + 1> CursorImpl::s_systemCursorIds =
|
||||||
{
|
{
|
||||||
// http://gnome-look.org/content/preview.php?preview=1&id=128170&file1=128170-1.png&file2=&file3=&name=Dummy+X11+cursors&PHPSESSID=6
|
// http://gnome-look.org/content/preview.php?preview=1&id=128170&file1=128170-1.png&file2=&file3=&name=Dummy+X11+cursors&PHPSESSID=6
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
#include <Nazara/Prerequesites.hpp>
|
#include <Nazara/Prerequesites.hpp>
|
||||||
#include <Nazara/Utility/Enums.hpp>
|
#include <Nazara/Utility/Enums.hpp>
|
||||||
#include <xcb/xcb_cursor.h>
|
#include <xcb/xcb_cursor.h>
|
||||||
|
#include <array>
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
|
|
@ -34,6 +35,7 @@ namespace Nz
|
||||||
xcb_cursor_t m_cursor = 0;
|
xcb_cursor_t m_cursor = 0;
|
||||||
xcb_cursor_context_t* m_cursorContext = nullptr;
|
xcb_cursor_context_t* m_cursorContext = nullptr;
|
||||||
|
|
||||||
|
static xcb_cursor_t s_hiddenCursor;
|
||||||
static std::array<const char*, SystemCursor_Max + 1> s_systemCursorIds;
|
static std::array<const char*, SystemCursor_Max + 1> s_systemCursorIds;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue