Enable "Use native mouse cursors" option if the platform supports native cursors

This commit is contained in:
David Capello 2017-04-21 15:31:22 -03:00
parent daf1e3fb3e
commit c947425051

View File

@ -136,18 +136,21 @@ public:
if (m_pref.selection.moveEdges()) if (m_pref.selection.moveEdges())
moveEdges()->setSelected(true); moveEdges()->setSelected(true);
#if defined(_WIN32) || defined(__APPLE__) // If the platform supports native cursors...
if (m_pref.cursor.useNativeCursor()) if ((int(she::instance()->capabilities()) &
nativeCursor()->setSelected(true); int(she::Capabilities::CustomNativeMouseCursor)) != 0) {
nativeCursor()->Click.connect(base::Bind<void>(&OptionsWindow::onNativeCursorChange, this)); if (m_pref.cursor.useNativeCursor())
nativeCursor()->setSelected(true);
nativeCursor()->Click.connect(base::Bind<void>(&OptionsWindow::onNativeCursorChange, this));
cursorScale()->setSelectedItemIndex(
cursorScale()->findItemIndexByValue(
base::convert_to<std::string>(m_pref.cursor.cursorScale())));
}
else {
nativeCursor()->setEnabled(false);
}
cursorScale()->setSelectedItemIndex(
cursorScale()->findItemIndexByValue(
base::convert_to<std::string>(m_pref.cursor.cursorScale())));
#else
// TODO impl this on Linux
nativeCursor()->setEnabled(false);
#endif
onNativeCursorChange(); onNativeCursorChange();
if (m_pref.experimental.useNativeFileDialog()) if (m_pref.experimental.useNativeFileDialog())
@ -379,11 +382,13 @@ public:
private: private:
void onNativeCursorChange() { void onNativeCursorChange() {
#if defined(_WIN32) || defined(__APPLE__) bool state =
bool state = !nativeCursor()->isSelected(); // If the platform supports native cursors...
#else (((int(she::instance()->capabilities()) &
bool state = false; int(she::Capabilities::CustomNativeMouseCursor)) != 0) &&
#endif // If the native cursor option is not selec
!nativeCursor()->isSelected());
cursorScaleLabel()->setEnabled(state); cursorScaleLabel()->setEnabled(state);
cursorScale()->setEnabled(state); cursorScale()->setEnabled(state);
} }