~josharenson/unity8/slim_greeter_real_lightdm

« back to all changes in this revision

Viewing changes to qml/Stages/WindowDecoration.qml

  • Committer: Josh Arenson
  • Date: 2016-06-29 14:44:41 UTC
  • mfrom: (1789.412.85 unity8)
  • Revision ID: joshua.arenson@canonical.com-20160629144441-du2vd7vu97b2n8pc
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
    property Item target
28
28
    property alias title: titleLabel.text
 
29
    property alias maximizeButtonShown: buttons.maximizeButtonShown
29
30
    property bool active: false
 
31
    acceptedButtons: Qt.AllButtons // prevent leaking unhandled mouse events
30
32
    property alias overlayShown: buttons.overlayShown
31
33
 
32
 
    hoverEnabled: true
33
 
 
34
34
    signal closeClicked()
35
35
    signal minimizeClicked()
36
36
    signal maximizeClicked()
37
37
    signal maximizeHorizontallyClicked()
38
38
    signal maximizeVerticallyClicked()
39
39
 
40
 
    onDoubleClicked: root.maximizeClicked()
 
40
    onDoubleClicked: {
 
41
        if (maximizeButtonShown && mouse.button == Qt.LeftButton) {
 
42
            root.maximizeClicked();
 
43
        }
 
44
    }
41
45
 
42
46
    QtObject {
43
47
        id: priv
47
51
    }
48
52
 
49
53
    onPressedChanged: {
50
 
        if (pressed) {
 
54
        if (pressed && pressedButtons == Qt.LeftButton) {
51
55
            var pos = mapToItem(root.target, mouseX, mouseY);
52
56
            priv.distanceX = pos.x;
53
57
            priv.distanceY = pos.y;
65
69
            // Use integer coordinate values to ensure that target is left in a pixel-aligned
66
70
            // position. Mouse movement could have subpixel precision, yielding a fractional
67
71
            // mouse position.
68
 
            root.target.x = Math.round(pos.x - priv.distanceX);
69
 
            root.target.y = Math.round(Math.max(pos.y - priv.distanceY, PanelState.panelHeight));
 
72
            root.target.requestedX = Math.round(pos.x - priv.distanceX);
 
73
            root.target.requestedY = Math.round(Math.max(pos.y - priv.distanceY, PanelState.panelHeight));
70
74
        }
71
75
    }
72
76
 
 
77
    // do not let unhandled wheel event pass thru the decoration
 
78
    onWheel: wheel.accepted = true;
 
79
 
73
80
    Rectangle {
74
81
        anchors.fill: parent
75
82
        anchors.bottomMargin: -radius