Signed-off-by: falkTX <falktx@falktx.com>pull/351/head
@@ -304,8 +304,7 @@ ifeq ($(HAVE_X11),true) | |||||
DGL_FLAGS += $(shell $(PKG_CONFIG) --cflags x11) -DHAVE_X11 | DGL_FLAGS += $(shell $(PKG_CONFIG) --cflags x11) -DHAVE_X11 | ||||
DGL_SYSTEM_LIBS += $(shell $(PKG_CONFIG) --libs x11) | DGL_SYSTEM_LIBS += $(shell $(PKG_CONFIG) --libs x11) | ||||
ifeq ($(HAVE_XCURSOR),true) | ifeq ($(HAVE_XCURSOR),true) | ||||
# TODO -DHAVE_XCURSOR | |||||
DGL_FLAGS += $(shell $(PKG_CONFIG) --cflags xcursor) | |||||
DGL_FLAGS += $(shell $(PKG_CONFIG) --cflags xcursor) -DHAVE_XCURSOR | |||||
DGL_SYSTEM_LIBS += $(shell $(PKG_CONFIG) --libs xcursor) | DGL_SYSTEM_LIBS += $(shell $(PKG_CONFIG) --libs xcursor) | ||||
endif | endif | ||||
ifeq ($(HAVE_XEXT),true) | ifeq ($(HAVE_XEXT),true) | ||||
@@ -130,6 +130,23 @@ enum CrossingMode { | |||||
kCrossingUngrab ///< Crossing due to a grab release | kCrossingUngrab ///< Crossing due to a grab release | ||||
}; | }; | ||||
/** | |||||
A mouse cursor type. | |||||
This is a portable subset of mouse cursors that exist on X11, MacOS, and Windows. | |||||
*/ | |||||
enum MouseCursor { | |||||
kMouseCursorArrow, ///< Default pointing arrow | |||||
kMouseCursorCaret, ///< Caret (I-Beam) for text entry | |||||
kMouseCursorCrosshair, ///< Cross-hair | |||||
kMouseCursorHand, ///< Hand with a pointing finger | |||||
kMouseCursorNotAllowed, ///< Operation not allowed | |||||
kMouseCursorLeftRight, ///< Left/right arrow for horizontal resize | |||||
kMouseCursorUpDown, ///< Up/down arrow for vertical resize | |||||
kMouseCursorDiagonal, ///< Top-left to bottom-right arrow for diagonal resize | |||||
kMouseCursorAntiDiagonal ///< Bottom-left to top-right arrow for diagonal resize | |||||
}; | |||||
/** | /** | ||||
Scroll direction. | Scroll direction. | ||||
@@ -103,6 +103,7 @@ public: | |||||
// TODO group stuff after here, convenience functions present in Window class | // TODO group stuff after here, convenience functions present in Window class | ||||
bool setClipboard(const char* mimeType, const void* data, size_t dataSize); | bool setClipboard(const char* mimeType, const void* data, size_t dataSize); | ||||
const void* getClipboard(const char*& mimeType, size_t& dataSize); | const void* getClipboard(const char*& mimeType, size_t& dataSize); | ||||
bool setCursor(MouseCursor cursor); | |||||
bool addIdleCallback(IdleCallback* callback, uint timerFrequencyInMs = 0); | bool addIdleCallback(IdleCallback* callback, uint timerFrequencyInMs = 0); | ||||
bool removeIdleCallback(IdleCallback* callback); | bool removeIdleCallback(IdleCallback* callback); | ||||
double getScaleFactor() const noexcept; | double getScaleFactor() const noexcept; | ||||
@@ -284,6 +284,15 @@ public: | |||||
*/ | */ | ||||
const void* getClipboard(const char*& mimeType, size_t& dataSize); | const void* getClipboard(const char*& mimeType, size_t& dataSize); | ||||
/** | |||||
Set the mouse cursor. | |||||
This changes the system cursor that is displayed when the pointer is inside the window. | |||||
May fail if setting the cursor is not supported on this system, | |||||
for example if compiled on X11 without Xcursor support. | |||||
*/ | |||||
bool setCursor(MouseCursor cursor); | |||||
/** | /** | ||||
Add a callback function to be triggered on every idle cycle or on a specific timer frequency. | Add a callback function to be triggered on every idle cycle or on a specific timer frequency. | ||||
You can add more than one, and remove them at anytime with removeIdleCallback(). | You can add more than one, and remove them at anytime with removeIdleCallback(). | ||||
@@ -70,6 +70,11 @@ const void* TopLevelWidget::getClipboard(const char*& mimeType, size_t& dataSize | |||||
return pData->window.getClipboard(mimeType, dataSize); | return pData->window.getClipboard(mimeType, dataSize); | ||||
} | } | ||||
bool TopLevelWidget::setCursor(const MouseCursor cursor) | |||||
{ | |||||
return pData->window.setCursor(cursor); | |||||
} | |||||
bool TopLevelWidget::addIdleCallback(IdleCallback* const callback, const uint timerFrequencyInMs) | bool TopLevelWidget::addIdleCallback(IdleCallback* const callback, const uint timerFrequencyInMs) | ||||
{ | { | ||||
return pData->window.addIdleCallback(callback, timerFrequencyInMs); | return pData->window.addIdleCallback(callback, timerFrequencyInMs); | ||||
@@ -271,6 +271,11 @@ const void* Window::getClipboard(const char*& mimeType, size_t& dataSize) | |||||
return clipboard; | return clipboard; | ||||
} | } | ||||
bool Window::setCursor(const MouseCursor cursor) | |||||
{ | |||||
return puglSetCursor(pData->view, static_cast<PuglCursor>(cursor)) == PUGL_SUCCESS; | |||||
} | |||||
bool Window::addIdleCallback(IdleCallback* const callback, const uint timerFrequencyInMs) | bool Window::addIdleCallback(IdleCallback* const callback, const uint timerFrequencyInMs) | ||||
{ | { | ||||
DISTRHO_SAFE_ASSERT_RETURN(callback != nullptr, false) | DISTRHO_SAFE_ASSERT_RETURN(callback != nullptr, false) | ||||
@@ -1 +1 @@ | |||||
Subproject commit f69d953d95dae70e32d37e522076fd41cec31a22 | |||||
Subproject commit d6c17abe22399acefc00fd0b78b99ea38ce27f41 |