Skip to content
Merged
2 changes: 2 additions & 0 deletions data/wingpanel.metainfo.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@
</ul>
</description>
<issues>
<issue url="https://github.com/elementary/wingpanel/issues/133">Don't initiate focus/drag on click/release</issue>
<issue url="https://github.com/elementary/wingpanel/issues/238">Wingpanel stays black until hovering over dock after minimizing all windows using wmctrl</issue>
<issue url="https://github.com/elementary/wingpanel/issues/414">Window switch on wingpanel click</issue>
<issue url="https://github.com/elementary/wingpanel/issues/588">Less heavy "scroll to change desktop"</issue>
<issue url="https://github.com/elementary/wingpanel/issues/638">Whitelist/Blacklist: still relevant?</issue>
<issue url="https://github.com/elementary/wingpanel/pull/611">Use dark style in greeter session</issue>
Expand Down
38 changes: 22 additions & 16 deletions wingpanel-interface/FocusManager.vala
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
/*
* Copyright (c) 2011-2015 Wingpanel Developers (http://launchpad.net/wingpanel)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
* SPDX-License-Identifier: GPL-2-or-later
* SPDX-FileCopyrightText: 2011-2015 Wingpanel Developers (http://launchpad.net/wingpanel)
* 2025 elementary, Inc. (https://elementary.io)
*/

public class WingpanelInterface.FocusManager : Object {
Expand Down Expand Up @@ -120,6 +107,8 @@ public class WingpanelInterface.FocusManager : Object {
var proxy = wm.push_modal (stage, true);

ulong handler = 0;
var started_drag = false;
float start_x = 0, start_y = 0;
handler = stage.captured_event.connect ((event) => {
if (event.get_type () == LEAVE || event.get_type () == ENTER) { // We need to filter ENTER for X because reasons I don't understand :( (I think something with pushing modal)
/* We get leave emitted when beginning a grab op, so we have
Expand All @@ -128,6 +117,23 @@ public class WingpanelInterface.FocusManager : Object {
}

if (event.get_type () == MOTION || event.get_type () == TOUCH_UPDATE) {
if (!started_drag) {
started_drag = true;
event.get_coords (out start_x, out start_y);

return Clutter.EVENT_PROPAGATE;
}

float current_x, current_y;
event.get_coords (out current_x, out current_y);

var dx = start_x - current_x;
var dy = start_y - current_y;
var drag_threshold = Clutter.Settings.get_default ().dnd_drag_threshold;
if (dx * dx + dy * dy < drag_threshold * drag_threshold) {
return Clutter.EVENT_PROPAGATE;
}

#if HAS_MUTTER46
window.begin_grab_op (
Meta.GrabOp.MOVING,
Expand Down
Loading