Added X11 to scons build and implemented file save and load using zenity.

This commit is contained in:
absquatulate
2017-04-04 19:17:31 +12:00
parent 1406e3dcac
commit b6b6871f86
3 changed files with 59 additions and 27 deletions

View File

@@ -4,33 +4,38 @@
#include <X11/Xlib.h>
#include <X11/cursorfont.h>
Cursor ibeam = XCreateFontCursor(NULL, XC_xterm);
Cursor ibeam; // = XCreateFontCursor(NULL, XC_xterm);
extern cursor_type current_cursor;
extern sf::RenderWindow mainPtr;
cCursor::cCursor(fs::path imgPath, float hotSpotX, float hotSpotY) {
cCursor::cCursor(fs::path imgPath, float hotSpotX, float hotSpotY)
: ptr(nullptr) {
}
cCursor::~cCursor() {
Cursor* realPtr = reinterpret_cast<Cursor*>(ptr);
XFreeCursor(NULL, *realPtr);
delete realPtr;
if (ptr != nullptr) {
Cursor* realPtr = reinterpret_cast<Cursor*>(ptr);
XFreeCursor(NULL, *realPtr);
delete realPtr;
}
}
void cCursor::apply() {
XDefineCursor(NULL, current_window, *reinterpret_cast<Cursor*>(ptr));
// XDefineCursor(NULL, current_window, *reinterpret_cast<Cursor*>(ptr));
}
void obscureCursor() {
// TODO: This hides it permanently; it should only hide it until it moves
XUndefineCursor(NULL, current_window);
// XUndefineCursor(NULL, current_window);
}
void set_cursor(cursor_type which_c) {
if(which_c != watch_curs)
current_cursor = which_c;
if(which_c == text_curs) {
XDefineCursor(NULL, current_window, ibeam);
// XDefineCursor(NULL, current_window, ibeam);
} else {
cCursor& curs = *ResMgr::get<CursorRsrc>(cursors[which_c]);
curs.apply();