Skip to content

Commit

Permalink
Use input handlers to move windows
Browse files Browse the repository at this point in the history
We don't need to customize ShellSurfaceItem to do this anymore.

Closes: #196
  • Loading branch information
plfiorini committed Dec 23, 2020
1 parent 2d22770 commit 28d918f
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 178 deletions.
3 changes: 3 additions & 0 deletions src/compositor/qml/ShellSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ FluidCore.Object {
readonly property alias lockScreen: lockSettings
readonly property alias shell: shellSettings
readonly property alias session: sessionSettings
readonly property alias input: inputSettings
readonly property int numWorkspaces: 4

/*
Expand Down Expand Up @@ -79,6 +80,8 @@ FluidCore.Object {
*/

P.InputSettings {
id: inputSettings

compositor: liriCompositor
}

Expand Down
7 changes: 7 additions & 0 deletions src/compositor/qml/windows/MoveItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,17 @@
***************************************************************************/

import QtQuick 2.0
import Liri.WaylandServer 1.0 as WS

Item {
id: moveItem

property bool moving: false

onMovingChanged: {
shellHelper.grabCursor(moving ? WS.LiriShell.MoveGrabCursor : WS.LiriShell.ArrowGrabCursor);
}

ParallelAnimation {
id: moveAnimation

Expand Down
28 changes: 16 additions & 12 deletions src/compositor/qml/windows/WaylandChrome.qml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
* $END_LICENSE$
***************************************************************************/

import QtQuick 2.0
import QtWayland.Compositor 1.0
import QtQuick 2.15
import QtWayland.Compositor 1.15
import Fluid.Effects 1.0 as FluidEffects
import Liri.WaylandServer 1.0 as WS
import Liri.private.shell 1.0 as P
Expand Down Expand Up @@ -146,7 +146,7 @@ P.ChromeItem {
visible: chrome.window.mapped && enabled
}

P.ShellSurfaceItem {
ShellSurfaceItem {
id: shellSurfaceItem

x: chrome.window.borderSize
Expand All @@ -159,20 +159,24 @@ P.ChromeItem {

focusOnClick: chrome.window.focusable

onMoveStarted: {
// Move initiated with Meta+LeftMouseButton has started
shellHelper.grabCursor(WS.LiriShell.MoveGrabCursor);
}
onMoveStopped: {
// Move initiated with Meta+LeftMouseButton has stopped
shellHelper.grabCursor(WS.LiriShell.ArrowGrabCursor);
}

onSurfaceDestroyed: {
bufferLocked = true;
destroyAnimation.start();
}

// Drag windows with Meta
DragHandler {
id: dragHandler

acceptedModifiers: liriCompositor.settings.input.windowActionKey
target: shellSurfaceItem.moveItem
property var movingBinding: Binding {
target: shellSurfaceItem.moveItem
property: "moving"
value: dragHandler.active
}
}

/*
* Animations
*/
Expand Down
2 changes: 0 additions & 2 deletions src/imports/shell-private/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ liri_add_qml_plugin(shell-private
screencast.h
screenmodel.cpp
screenmodel.h
shellsurfaceitem.cpp
shellsurfaceitem.h
waylandwindow.cpp
waylandwindow.h
windowmousetracker.cpp
Expand Down
2 changes: 0 additions & 2 deletions src/imports/shell-private/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#include "quickoutput.h"
#include "screencast.h"
#include "screenmodel.h"
#include "shellsurfaceitem.h"
#include "waylandwindow.h"
#include "windowmousetracker.h"

Expand Down Expand Up @@ -110,7 +109,6 @@ class ShellPrivatePlugin : public QQmlExtensionPlugin
QStringLiteral("Cannot create instance of ScreenMode"));
qmlRegisterUncreatableType<ScreenItem>(uri, versionMajor, versionMinor, "ScreenItem",
QStringLiteral("Cannot create instance of ScreenItem"));
qmlRegisterType<ShellSurfaceItem>(uri, versionMajor, versionMinor, "ShellSurfaceItem");
qmlRegisterType<WaylandWindowQuickParent>(uri, versionMajor, versionMinor, "WaylandWindow");
qmlRegisterType<WindowMouseTracker>(uri, versionMajor, versionMinor, "WindowMouseTracker");

Expand Down
106 changes: 0 additions & 106 deletions src/imports/shell-private/shellsurfaceitem.cpp

This file was deleted.

56 changes: 0 additions & 56 deletions src/imports/shell-private/shellsurfaceitem.h

This file was deleted.

0 comments on commit 28d918f

Please sign in to comment.