Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions shell/Ui/KeyboardPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -432,16 +432,18 @@ PanelWindow {
// the pointer never sees itself held; it's told, for its press feedback,
// the way the bar's own press handler tells it.
property var heldTarget: null
function hold(target) {
if (heldTarget && heldTarget !== target && "held" in heldTarget) heldTarget.held = false
heldTarget = target && "held" in target ? target : null
if (heldTarget) heldTarget.held = true
function hold(target, button) {
if (heldTarget && heldTarget !== target && "heldButtons" in heldTarget) heldTarget.heldButtons = Qt.NoButton
heldTarget = target && "heldButtons" in target ? target : null
if (heldTarget) heldTarget.heldButtons = button
}

// Every button still down, so a second button pressed or let go mid-hold
// leaves the first one's feedback alone.
onPressed: function(mouse) {
hold(root.focusPrimed && inBarRegion(mouse.x, mouse.y) ? pressTargetAt(mouse.x, mouse.y) : null)
hold(root.focusPrimed && inBarRegion(mouse.x, mouse.y) ? pressTargetAt(mouse.x, mouse.y) : null, mouse.buttons)
}
onReleased: hold(null)
onReleased: function(mouse) { hold(mouse.buttons ? heldTarget : null, mouse.buttons) }
onCanceled: hold(null)
onEnabledChanged: if (!enabled) hold(null)

Expand Down
7 changes: 5 additions & 2 deletions shell/Ui/WidgetButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ Item {
property var registeredBar: null
// Set by the bar while its own press handler, laid over the widget for
// dragging, holds this button down; mouseArea never sees that press.
property bool held: false
property int heldButtons: Qt.NoButton
// The mouse buttons the mark gives under. A button whose click changes the
// mark itself, like the clock's format cycle, is left out.
property int pressFeedbackButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton

signal pressed(int button)
signal wheelMoved(int delta)
Expand Down Expand Up @@ -102,7 +105,7 @@ Item {
// Only the label and glyph shrink, never the button, so the hit area and
// the bar's layout hold still. A bar glyph is small, so it gives more than
// a panel button's 0.97, or nothing would show.
property real pressScale: root.pressable && (mouseArea.pressed || root.held) ? 0.9 : 1
property real pressScale: root.pressable && ((mouseArea.pressedButtons | root.heldButtons) & root.pressFeedbackButtons) ? 0.9 : 1
Behavior on pressScale {
NumberAnimation {
duration: Style.duration(160)
Expand Down
10 changes: 5 additions & 5 deletions shell/plugins/bar/Bar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3041,15 +3041,15 @@ Item {
suppressClick = false
pressedX = mouse.x
pressedY = mouse.y
hold(root.moduleClickTargetAt(slot, mouse.x, mouse.y))
hold(root.moduleClickTargetAt(slot, mouse.x, mouse.y), mouse.button)
root.finishBarSettle()
root.clearBarDrag()
}

function hold(target) {
if (heldTarget && heldTarget !== target && "held" in heldTarget) heldTarget.held = false
heldTarget = target && "held" in target ? target : null
if (heldTarget) heldTarget.held = true
function hold(target, button) {
if (heldTarget && heldTarget !== target && "heldButtons" in heldTarget) heldTarget.heldButtons = Qt.NoButton
heldTarget = target && "heldButtons" in target ? target : null
if (heldTarget) heldTarget.heldButtons = button
}

onPositionChanged: function(mouse) {
Expand Down
3 changes: 3 additions & 0 deletions shell/plugins/panels/clock/BarWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ BarWidget {
horizontalMargin: 8.75
verticalPadding: 8.75
tooltipText: I18n.t("clock.toggleFormat")
// Right click swaps the label for the next format, which is its own
// feedback; shrinking the new text as it lands reads as a glitch.
pressFeedbackButtons: Qt.LeftButton | Qt.MiddleButton

onPressed: function(b) {
if (b === Qt.RightButton) root.cycleFormat()
Expand Down
Loading