diff --git a/libs/ui/CMakeLists.txt b/libs/ui/CMakeLists.txt --- a/libs/ui/CMakeLists.txt +++ b/libs/ui/CMakeLists.txt @@ -13,6 +13,7 @@ if (APPLE) find_library(FOUNDATION_LIBRARY Foundation) + find_library(APPKIT_LIBRARY AppKit) endif () set(kritaui_LIB_SRCS @@ -425,6 +426,12 @@ endif() endif() +if(APPLE) + set(kritaui_LIB_SRCS + ${kritaui_LIB_SRCS} + osx.mm + ) +endif() ki18n_wrap_ui(kritaui_LIB_SRCS forms/wdgdlgpngimport.ui @@ -524,6 +531,7 @@ if(APPLE) target_link_libraries(kritaui ${FOUNDATION_LIBRARY}) + target_link_libraries(kritaui ${APPKIT_LIBRARY}) endif () diff --git a/libs/ui/KisApplication.cpp b/libs/ui/KisApplication.cpp --- a/libs/ui/KisApplication.cpp +++ b/libs/ui/KisApplication.cpp @@ -16,7 +16,7 @@ You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + Boston, MA 02110-1301, USA. */ #include "KisApplication.h" @@ -27,6 +27,10 @@ #include #endif +#ifdef Q_OS_OSX +#include "osx.h" +#endif + #include #include #include @@ -150,6 +154,10 @@ , m_mainWindow(0) , m_batchRun(false) { +#ifdef Q_OS_OSX + setMouseCoalescingEnabled(false); +#endif + QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath()); setApplicationDisplayName("Krita"); diff --git a/libs/ui/osx.h b/libs/ui/osx.h new file mode 100644 --- /dev/null +++ b/libs/ui/osx.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2017 Bernhard Liebl + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ +extern "C" { + bool isMouseCoalescingEnabled(); + void setMouseCoalescingEnabled(bool enabled); +} diff --git a/libs/ui/osx.mm b/libs/ui/osx.mm new file mode 100644 --- /dev/null +++ b/libs/ui/osx.mm @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2017 Bernhard Liebl + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ +#import + +extern "C" { + bool isMouseCoalescingEnabled(); + void setMouseCoalescingEnabled(bool enabled); +} + +bool isMouseCoalescingEnabled() { + return NSEvent.isMouseCoalescingEnabled; +} + +void setMouseCoalescingEnabled(bool enabled) { + NSEvent.mouseCoalescingEnabled = enabled; +}