Bug 391034 - _NET_CURRENT_DESKTOP not set on startup
Summary: _NET_CURRENT_DESKTOP not set on startup
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: core (show other bugs)
Version: 5.12.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL: https://phabricator.kde.org/D10836
Keywords: regression
: 393731 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-02-25 07:17 UTC by Deleted User
Modified: 2018-05-01 16:04 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.12.5
mgraesslin: Wayland+
mgraesslin: X11+
mgraesslin: ReviewRequest+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Deleted User 2018-02-25 07:17:44 UTC
When a program queries KWin for the root window property _NET_CURRENT_DESKTOP, fails to respond correctly.

According to the FreeDesktop spec on "Extended Window Manager Hints", specifically the section "Root Window Properties (and related messages)", at https://specifications.freedesktop.org/wm-spec/1.3/ar01s03.html, window managers _must_ return an integer between 0 and (num_desktops - 1) in response to a query for this property.

Expected Behaviour:

  $ xdotool get_desktop
  0

Actual Behaviour:

  $ xdotool get_desktop
  XGetWindowProperty[_NET_CURRENT_DESKTOP] failed (code=1)
  -1

Notes:

  If one switches workspaces/desktops and tries again, it begins to work. However, after a reboot or just waiting for some time, it agains starts failing.

  Getting the _NET_NUMBER_OF_DESKTOPS property works:

    $ xdotool get_num_desktops
    4
Comment 1 Martin Flöser 2018-02-25 14:12:57 UTC
It looks like this feature has been broken for years without anybody noticing. We only seem to sync to X property when a window switches virtual desktop.
Comment 2 jingyu9575 2018-02-25 14:33:57 UTC
(In reply to Martin Flöser from comment #1)
> It looks like this feature has been broken for years without anybody
> noticing. We only seem to sync to X property when a window switches virtual
> desktop.

For me (Arch Linux), this feature is only broken recently. I frequently use a script that calls "xdotool get_desktop". It used to work on kwin-5.11.5 but is broken on 5.12.
Comment 3 Deleted User 2018-02-25 15:13:57 UTC
(In reply to Martin Flöser from comment #1)
> It looks like this feature has been broken for years without anybody
> noticing. We only seem to sync to X property when a window switches virtual
> desktop.

Can confirm jingyu9575's experience. This has been broken only recently, on both Arch Linux and Neon (User edition).
Comment 4 Martin Flöser 2018-02-25 16:03:50 UTC
Yeah I misinterpreted the code. An area I didn't expect to be relevant for changing the property actually changes the property on desktop changes.

I have a fix for the issue.
Comment 5 Martin Flöser 2018-02-25 16:09:57 UTC
patch at: https://phabricator.kde.org/D10836
Comment 6 Martin Flöser 2018-03-29 15:50:45 UTC
Git commit 4205496033728c82643e78340b4ddae3079c6280 by Martin Flöser.
Committed on 29/03/2018 at 15:50.
Pushed by graesslin into branch 'Plasma/5.12'.

Ensure _NET_CURRENT_DESKTOP is set on startup

Summary:
Seems to have regressed in Plasma 5.12 due to code reordering. Now the
property is explicitly updated once the NETRootInfo is created.
FIXED-IN: 5.12.5

Test Plan:
Test case exposing the problem added. Fails without the patch,
succeeds with the patch.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D10836

M  +52   -0    autotests/integration/virtual_desktop_test.cpp
M  +1    -0    workspace.cpp

https://commits.kde.org/kwin/4205496033728c82643e78340b4ddae3079c6280
Comment 7 Martin Flöser 2018-05-01 16:04:04 UTC
*** Bug 393731 has been marked as a duplicate of this bug. ***