diff --git a/kstyle/CMakeLists.txt b/kstyle/CMakeLists.txt
index 27a81fe4..b269cd18 100644
--- a/kstyle/CMakeLists.txt
+++ b/kstyle/CMakeLists.txt
@@ -8,8 +8,9 @@ find_package(KF5 REQUIRED COMPONENTS
ConfigWidgets
WindowSystem)
-find_package(Qt5 COMPONENTS Quick)
+find_package(Qt5 COMPONENTS Quick X11Extras)
set(BREEZE_HAVE_QTQUICK ${Qt5Quick_FOUND})
+set(BREEZE_HAVE_QTX11EXTRAS ${Qt5X11Extras_FOUND})
find_package( KF5FrameworkIntegration CONFIG )
set_package_properties(KF5FrameworkIntegration PROPERTIES
@@ -20,26 +21,6 @@ set_package_properties(KF5FrameworkIntegration PROPERTIES
set(BREEZE_HAVE_KSTYLE ${KF5FrameworkIntegration_FOUND})
-find_package(XCB COMPONENTS XCB)
-set_package_properties(XCB PROPERTIES
- DESCRIPTION "X protocol C-language Binding"
- URL "https://xcb.freedesktop.org"
- TYPE OPTIONAL
- PURPOSE "Required to pass style properties to native Windows on X11 Platform"
-)
-
-find_package(KF5Wayland CONFIG)
-set(BREEZE_HAVE_KWAYLAND ${KF5Wayland_FOUND})
-
-if(UNIX AND NOT APPLE)
- set(BREEZE_HAVE_X11 ${XCB_XCB_FOUND})
- if (XCB_XCB_FOUND)
- find_package(Qt5 REQUIRED CONFIG COMPONENTS X11Extras)
- endif()
-else()
- set(BREEZE_HAVE_X11 FALSE)
-endif()
-
################# includes #################
include_directories(
@@ -102,6 +83,9 @@ target_link_libraries(breeze Qt5::Core Qt5::Gui Qt5::Widgets Qt5::DBus)
if( BREEZE_HAVE_QTQUICK )
target_link_libraries(breeze Qt5::Quick)
endif()
+if (BREEZE_HAVE_QTX11EXTRAS)
+ target_link_libraries(breeze Qt5::X11Extras)
+endif()
target_link_libraries(breeze KF5::ConfigCore KF5::ConfigWidgets KF5::GuiAddons KF5::IconThemes KF5::WindowSystem)
target_link_libraries(breeze breezecommon5)
@@ -115,15 +99,6 @@ if (WIN32)
target_compile_definitions(breeze PRIVATE _USE_MATH_DEFINES _BSD_SOURCE)
endif()
-if(BREEZE_HAVE_X11)
- target_link_libraries(breeze ${XCB_LIBRARIES})
- target_link_libraries(breeze Qt5::X11Extras)
-endif()
-
-if(BREEZE_HAVE_KWAYLAND)
- target_link_libraries(breeze KF5::WaylandClient)
-endif()
-
########### install files ###############
install(TARGETS breeze DESTINATION ${QT_PLUGIN_INSTALL_DIR}/styles/)
diff --git a/kstyle/breeze.kcfg b/kstyle/breeze.kcfg
index eca8cb9f..b073a925 100644
--- a/kstyle/breeze.kcfg
+++ b/kstyle/breeze.kcfg
@@ -164,11 +164,6 @@
-
-
- true
-
-
true
diff --git a/kstyle/breezehelper.cpp b/kstyle/breezehelper.cpp
index 63152280..39b16a79 100644
--- a/kstyle/breezehelper.cpp
+++ b/kstyle/breezehelper.cpp
@@ -15,7 +15,7 @@
#include
#include
-#if BREEZE_HAVE_X11
+#if BREEZE_HAVE_QTX11EXTRAS
#include
#endif
@@ -1563,7 +1563,7 @@ namespace Breeze
bool Helper::compositingActive() const
{
- #if BREEZE_HAVE_X11
+ #if BREEZE_HAVE_QTX11EXTRAS
if( isX11() )
{ return QX11Info::isCompositingManagerRunning( QX11Info::appScreen() ); }
#endif
diff --git a/kstyle/breezewindowmanager.cpp b/kstyle/breezewindowmanager.cpp
index e09955c0..fdad4ec5 100644
--- a/kstyle/breezewindowmanager.cpp
+++ b/kstyle/breezewindowmanager.cpp
@@ -47,22 +47,6 @@
#include
#endif
-#if BREEZE_HAVE_X11
-#include
-#include
-
-#include
-
-#endif
-
-#if BREEZE_HAVE_KWAYLAND
-#include
-#include
-#include
-#include
-#include
-#endif
-
namespace Util
{
template
@@ -115,7 +99,7 @@ namespace Breeze
we trigger on the first MouseMove or MousePress events that are received
by any widget in the application to detect that the drag is finished
*/
- if( _parent->useWMMoveResize() && _parent->_dragInProgress && _parent->_target && ( event->type() == QEvent::MouseMove || event->type() == QEvent::MouseButtonPress ) )
+ if( _parent->_dragInProgress && _parent->_target && ( event->type() == QEvent::MouseMove || event->type() == QEvent::MouseButtonPress ) )
{ return appMouseEvent( object, event ); }
return false;
@@ -166,67 +150,12 @@ namespace Breeze
setEnabled( StyleConfigData::windowDragMode() != StyleConfigData::WD_NONE );
setDragMode( StyleConfigData::windowDragMode() );
- setUseWMMoveResize( StyleConfigData::useWMMoveResize() );
-
setDragDistance( QApplication::startDragDistance() );
setDragDelay( QApplication::startDragTime() );
initializeWhiteList();
initializeBlackList();
- initializeWayland();
-
- }
- //_______________________________________________________
- void WindowManager::initializeWayland()
- {
- #if BREEZE_HAVE_KWAYLAND
- if( !Helper::isWayland() ) return;
- if( _seat ) return;
-
- using namespace KWayland::Client;
- auto connection = ConnectionThread::fromApplication( this );
- if( !connection ) return;
-
- auto registry = new Registry( this );
- registry->create( connection );
- connect(registry, &Registry::interfacesAnnounced, this,
- [registry, this] {
- const auto interface = registry->interface( Registry::Interface::Seat );
- if( interface.name != 0 )
- {
- _seat = registry->createSeat( interface.name, interface.version, this );
- connect(_seat, &Seat::hasPointerChanged, this, &WindowManager::waylandHasPointerChanged);
- }
- }
- );
-
- registry->setup();
- connection->roundtrip();
- #endif
- }
-
- //_______________________________________________________
- void WindowManager::waylandHasPointerChanged(bool hasPointer)
- {
- #if BREEZE_HAVE_KWAYLAND
- Q_ASSERT( _seat );
- if( hasPointer )
- {
- if( !_pointer )
- {
- _pointer = _seat->createPointer(this);
- connect(_pointer, &KWayland::Client::Pointer::buttonStateChanged, this,
- [this] (quint32 serial) { _waylandSerial = serial; }
- );
- }
- } else {
- delete _pointer;
- _pointer = nullptr;
- }
- #else
- Q_UNUSED( hasPointer );
- #endif
}
//_____________________________________________________________
@@ -351,9 +280,9 @@ namespace Breeze
{
_dragTimer.stop();
- if( _target ) startDrag( _target.data()->window()->windowHandle(), _globalDragPoint );
+ if( _target ) startDrag( _target.data()->window()->windowHandle() );
#if BREEZE_HAVE_QTQUICK
- else if( _quickTarget ) startDrag( _quickTarget.data()->window(), _globalDragPoint );
+ else if( _quickTarget ) startDrag( _quickTarget.data()->window() );
#endif
} else {
@@ -460,14 +389,6 @@ namespace Breeze
return true;
- } else if( !useWMMoveResize() && _target ) {
-
- // use QWidget::move for the grabbing
- /* this works only if the sending object and the target are identical */
- auto window( _target.data()->window() );
- window->move( window->pos() + mouseEvent->pos() - _dragPoint );
- return true;
-
} else return false;
}
@@ -760,13 +681,6 @@ namespace Breeze
void WindowManager::resetDrag()
{
- if( (!useWMMoveResize() ) && _target && _cursorOverride ) {
-
- qApp->restoreOverrideCursor();
- _cursorOverride = false;
-
- }
-
_target.clear();
#if BREEZE_HAVE_QTQUICK
_quickTarget.clear();
@@ -780,91 +694,13 @@ namespace Breeze
}
//____________________________________________________________
- void WindowManager::startDrag( QWindow* window, const QPoint& position )
+ void WindowManager::startDrag( QWindow* window )
{
if( !( enabled() && window ) ) return;
if( QWidget::mouseGrabber() ) return;
- // ungrab pointer
- if( useWMMoveResize() )
- {
-
- if( Helper::isX11() ) startDragX11( window, position );
- else if( Helper::isWayland() ) startDragWayland( window, position );
-
- } else if( !_cursorOverride ) {
-
- qApp->setOverrideCursor( Qt::SizeAllCursor );
- _cursorOverride = true;
-
- }
-
- _dragInProgress = true;
-
- }
-
- //_______________________________________________________
- void WindowManager::startDragX11( QWindow* window, const QPoint& position )
- {
- #if BREEZE_HAVE_X11
- // connection
- auto connection( QX11Info::connection() );
-
- auto net_connection = connection;
- const qreal dpiRatio = window->devicePixelRatio();
- const QPoint origin = window->screen()->geometry().topLeft();
- const QPoint native = (position - origin) * dpiRatio + origin;
-
- xcb_ungrab_pointer( connection, XCB_TIME_CURRENT_TIME );
- NETRootInfo( net_connection, NET::WMMoveResize ).moveResizeRequest(
- window->winId(), native.x(), native.y(), NET::Move );
-
- #else
-
- Q_UNUSED( window );
- Q_UNUSED( position );
-
- #endif
- }
-
- //_______________________________________________________
- void WindowManager::startDragWayland( QWindow* window, const QPoint& )
- {
- #if BREEZE_HAVE_KWAYLAND
- if( !_seat ) {
- return;
- }
-
- auto shellSurface = KWayland::Client::ShellSurface::fromWindow(window);
- if( !shellSurface )
- {
- // TODO: also check for xdg-shell in future
- return;
- }
-
- shellSurface->requestMove( _seat, _waylandSerial );
- #else
- Q_UNUSED( window );
- #endif
- }
-
- //____________________________________________________________
- bool WindowManager::supportWMMoveResize() const
- {
-
- #if BREEZE_HAVE_KWAYLAND
- if( Helper::isWayland() )
- {
- return true;
- }
- #endif
-
- #if BREEZE_HAVE_X11
- return Helper::isX11();
- #else
- return false;
- #endif
+ _dragInProgress = window->startSystemMove();
}
diff --git a/kstyle/breezewindowmanager.h b/kstyle/breezewindowmanager.h
index 8892a207..279ecee9 100644
--- a/kstyle/breezewindowmanager.h
+++ b/kstyle/breezewindowmanager.h
@@ -24,17 +24,6 @@
#include
#endif
-#if BREEZE_HAVE_KWAYLAND
-namespace KWayland
-{
- namespace Client
- {
- class Pointer;
- class Seat;
- }
-}
-#endif
-
namespace Breeze
{
@@ -92,14 +81,6 @@ namespace Breeze
void setEnabled( bool value )
{ _enabled = value; }
- //* returns true if window manager is used for moving
- bool useWMMoveResize() const
- { return supportWMMoveResize() && _useWMMoveResize; }
-
- //* use window manager for moving, when available
- void setUseWMMoveResize( bool value )
- { _useWMMoveResize = value; }
-
//* drag mode
int dragMode() const
{ return _dragMode; }
@@ -130,12 +111,6 @@ namespace Breeze
*/
void initializeBlackList();
- //* initializes the Wayland specific parts
- void initializeWayland();
-
- //* The Wayland Seat's hasPointer property changed
- void waylandHasPointerChanged(bool hasPointer);
-
//@}
//* returns true if widget is dragable
@@ -158,17 +133,7 @@ namespace Breeze
void resetDrag();
//* start drag
- void startDrag( QWindow*, const QPoint& );
-
- //* X11 specific implementation for startDrag
- void startDragX11( QWindow*, const QPoint& );
-
- //* Wayland specific implementation for startDrag
- void startDragWayland( QWindow*, const QPoint& );
-
- //* returns true if window manager is used for moving
- /** right now this is true only for X11 */
- bool supportWMMoveResize() const;
+ void startDrag( QWindow* );
//* utility function
bool isDockWidgetTitle( const QWidget* ) const;
@@ -193,9 +158,6 @@ namespace Breeze
//* enability
bool _enabled = true;
- //* use WM moveResize
- bool _useWMMoveResize = true;
-
//* drag mode
int _dragMode = StyleConfigData::WD_FULL;
@@ -280,25 +242,9 @@ namespace Breeze
//* true if drag is locked
bool _locked = false;
- //* cursor override
- /** used to keep track of application cursor being overridden when dragging in non-WM mode */
- bool _cursorOverride = false;
-
//* application event filter
QObject* _appEventFilter = nullptr;
- #if BREEZE_HAVE_KWAYLAND
-
- //* The Wayland seat object which needs to be passed to move requests.
- KWayland::Client::Seat* _seat = nullptr;
-
- //* The Wayland pointer object where we get pointer events on.
- KWayland::Client::Pointer* _pointer = nullptr;
-
- //* latest serial which needs to be passed to the move requests.
- quint32 _waylandSerial = 0;
- #endif
-
//* allow access of all private members to the app event filter
friend class AppEventFilter;
diff --git a/kstyle/config-breeze.h.cmake b/kstyle/config-breeze.h.cmake
index af3b83f6..6b734460 100644
--- a/kstyle/config-breeze.h.cmake
+++ b/kstyle/config-breeze.h.cmake
@@ -12,12 +12,10 @@
/* Define to 1 if QtQuick is available */
#cmakedefine01 BREEZE_HAVE_QTQUICK
+/* Define to 1 if QtX11Extras is available */
+#cmakedefine01 BREEZE_HAVE_QTX11EXTRAS
+
/* Define to 1 if FrameworkIntegration/Kstyle libraries are found */
#cmakedefine01 BREEZE_HAVE_KSTYLE
-/* Define to 1 if XCB libraries are found */
-#cmakedefine01 BREEZE_HAVE_X11
-
-#cmakedefine01 BREEZE_HAVE_KWAYLAND
-
#endif