diff --git a/kstyle/breeze.kcfg b/kstyle/breeze.kcfg
--- a/kstyle/breeze.kcfg
+++ b/kstyle/breeze.kcfg
@@ -162,11 +162,6 @@
-
-
- true
-
-
true
diff --git a/kstyle/breezewindowmanager.h b/kstyle/breezewindowmanager.h
--- a/kstyle/breezewindowmanager.h
+++ b/kstyle/breezewindowmanager.h
@@ -37,17 +37,6 @@
#include
#endif
-#if BREEZE_HAVE_KWAYLAND
-namespace KWayland
-{
- namespace Client
- {
- class Pointer;
- class Seat;
- }
-}
-#endif
-
namespace Breeze
{
@@ -105,14 +94,6 @@
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; }
@@ -143,12 +124,6 @@
*/
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
@@ -171,17 +146,7 @@
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;
@@ -206,9 +171,6 @@
//* enability
bool _enabled = true;
- //* use WM moveResize
- bool _useWMMoveResize = true;
-
//* drag mode
int _dragMode = StyleConfigData::WD_FULL;
@@ -293,25 +255,9 @@
//* 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/breezewindowmanager.cpp b/kstyle/breezewindowmanager.cpp
--- a/kstyle/breezewindowmanager.cpp
+++ b/kstyle/breezewindowmanager.cpp
@@ -84,22 +84,6 @@
#include
#endif
-#if BREEZE_HAVE_X11
-#include
-#include
-
-#include
-
-#endif
-
-#if BREEZE_HAVE_KWAYLAND
-#include
-#include
-#include
-#include
-#include
-#endif
-
namespace Util
{
template
@@ -152,7 +136,7 @@
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;
@@ -203,67 +187,12 @@
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
}
//_____________________________________________________________
@@ -388,9 +317,9 @@
{
_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 {
@@ -497,14 +426,6 @@
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;
}
@@ -797,13 +718,6 @@
void WindowManager::resetDrag()
{
- if( (!useWMMoveResize() ) && _target && _cursorOverride ) {
-
- qApp->restoreOverrideCursor();
- _cursorOverride = false;
-
- }
-
_target.clear();
#if BREEZE_HAVE_QTQUICK
_quickTarget.clear();
@@ -817,91 +731,13 @@
}
//____________________________________________________________
- 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();
}