Provide leaveMoveResize() as virtual method in AbstractClient

The non X11 specific code is split out into a base implementation
which is called from the Client.
icc-effect-5.14.5
Martin Gräßlin 2015-10-22 15:58:24 +02:00
parent 88e097ec16
commit 1c40e809ea
4 changed files with 23 additions and 9 deletions

View File

@ -20,10 +20,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "abstract_client.h"
#include "decorations/decorationpalette.h"
#include "focuschain.h"
#include "outline.h"
#include "screens.h"
#ifdef KWIN_BUILD_TABBOX
#include "tabbox.h"
#endif
#include "screenedge.h"
#include "tabgroup.h"
#include "workspace.h"
@ -1102,4 +1104,16 @@ void AbstractClient::updateCursor()
emit moveResizeCursorChanged(c);
}
void AbstractClient::leaveMoveResize()
{
workspace()->setClientIsMoving(nullptr);
setMoveResize(false);
if (ScreenEdges::self()->isDesktopSwitchingMovingClients())
ScreenEdges::self()->reserveDesktopSwitching(false, Qt::Vertical|Qt::Horizontal);
if (isElectricBorderMaximizing()) {
outline()->hide();
elevate(false);
}
}
}

View File

@ -696,6 +696,13 @@ protected:
* Sets an appropriate cursor shape for the logical mouse position.
*/
void updateCursor();
/**
* Leaves the move resize mode.
*
* Inheriting classes must invoke the base implementation which
* ensures that the internal mode is properly ended.
**/
virtual void leaveMoveResize();
private:
void handlePaletteChange();

View File

@ -545,7 +545,7 @@ private:
void sendSyncRequest();
bool startMoveResize();
void finishMoveResize(bool cancel);
void leaveMoveResize();
void leaveMoveResize() override;
void handleMoveResize(int x, int y, int x_root, int y_root);
void handleMoveResize(const QPoint &local, const QPoint &global);
void startDelayedMoveResize();

View File

@ -2730,18 +2730,11 @@ void Client::leaveMoveResize()
move_resize_has_keyboard_grab = false;
xcb_ungrab_pointer(connection(), xTime());
m_moveResizeGrabWindow.reset();
workspace()->setClientIsMoving(0);
setMoveResize(false);
if (syncRequest.counter == XCB_NONE) // don't forget to sanitize since the timeout will no more fire
syncRequest.isPending = false;
delete syncRequest.timeout;
syncRequest.timeout = NULL;
if (ScreenEdges::self()->isDesktopSwitchingMovingClients())
ScreenEdges::self()->reserveDesktopSwitching(false, Qt::Vertical|Qt::Horizontal);
if (isElectricBorderMaximizing()) {
outline()->hide();
elevate(false);
}
AbstractClient::leaveMoveResize();
}
// This function checks if it actually makes sense to perform a restricted move/resize.