https://bugs.kde.org/show_bug.cgi?id=525792

            Bug ID: 525792
           Summary: Panel edit mode: the panel toolbar closes when
                    dragging a widget if a non-focusable "desktop"
                    layer-shell window exists     (e.g. conky)
    Classification: Plasma
           Product: kwin
      Version First 6.6.6
       Reported In:
          Platform: TuxedoOS
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: core
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

With conky running on Wayland (`out_to_wayland = true`,
`own_window_namespace = 'desktop'`), moving a widget inside a panel in edit
mode fails: as soon as the drag starts, the panel configuration toolbar closes.
Dragging works if you start moving before the small widget popup (title plus
configure/remove buttons) has appeared. Without conky everything works.

What happens, from KWin's `windowActivated` signal and the 6.6 sources:

1. Since 6.6.5 (plasma-desktop, "Actually start the drag only after a pointer
   move"), the popup shown when hovering a panel widget in edit mode calls
   `requestActivate()`, so it owns keyboard focus. It hides when the drag
starts.
2. KWin then runs `Workspace::activateNextWindow()`. The window under the mouse
   is the panel, which does not accept focus, so it falls back to
   `findDesktop()`, which returns the topmost desktop-type window in the
   stacking order. A layer-shell surface with scope "desktop" is a desktop-type
   window (`scopeToType` in layershellv1window.cpp); conky's one is above
   plasmashell's and refuses focus (`wantsInput() == false`). `requestFocus()`
   fails and KWin calls `resetFocus()`: no active window at all.
3. plasmashell receives a null focus window.
`PanelConfigView::focusVisibilityCheck()`
   hides the toolbar on `!focusWindow` before it checks
`m_panelView->mouseGrabberItem()`,
   which is set since the drag is in progress.

Two possible fixes, either is enough:

- KWin: `findDesktop()` (or `activateNextWindow()`) should skip desktop-type
  windows that do not want input, and keep looking for one that does.
- plasma-workspace: in `focusVisibilityCheck()`, test `mouseGrabberItem()`
before
  the null focus window case, so an active drag never closes the toolbar.

STEP TO REPRODUCE

1. Plasma 6.6.6 Wayland. Start conky with `out_to_wayland = true` and
   `own_window_namespace = 'desktop'` (any layer-shell "desktop" surface that
   does not accept keyboard focus should do).
2. Right-click a panel, "Enter edit mode" (toolbar shown).
3. Hover a widget until its popup appears, then press and drag it.

Observed: the toolbar closes, the widget is not moved.
Expected: the widget moves, the toolbar stays.

Confirmation: with any other layer-shell namespace for conky (so it is no
longer
a desktop-type window) the problem disappears. This is not a conky bug, though:
any client placing a "desktop" layer-shell surface that does not take keyboard
focus (conky, animated wallpaper tools, widgets drawn on the background) makes
KWin end up with no active window whenever the focused window goes away, and
anything that reacts to a null focus window, the panel toolbar here, breaks.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to