Bug 334500 - plasmoid.screen returns -1 in multiscreen setup
Summary: plasmoid.screen returns -1 in multiscreen setup
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: generic-multiscreen (show other bugs)
Version: master
Platform: unspecified Linux
: NOR normal
Target Milestone: 1.0
Assignee: Aleix Pol
URL:
Keywords:
Depends on:
Blocks: 328593
  Show dependency treegraph
 
Reported: 2014-05-08 09:32 UTC by Martin Klapetek
Modified: 2014-06-17 14:03 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Klapetek 2014-05-08 09:32:00 UTC
After the kscreen merge, plasmoid.screen now always returns -1 instead of valid screen number. This breaks for example computing of notification popup position
Comment 1 Aleix Pol 2014-05-08 13:25:52 UTC
Looking into it
Comment 2 Aleix Pol 2014-05-08 13:41:54 UTC
Git commit 2052b811403e52bb80d1abdaf87f91ae257e0e9c by Aleix Pol.
Committed on 08/05/2014 at 13:38.
Pushed by apol into branch 'master'.

Remove hack for early initialization of PanelView

This broke screenForContainment because the Panel didn't know where it
would be placed when the panel is being set. This shouldn't be the case
anymore.
Related: bug 334502

M  +3    -22   shell/panelview.cpp
M  +1    -1    shell/panelview.h
M  +4    -3    shell/shellcorona.cpp

http://commits.kde.org/plasma-workspace/2052b811403e52bb80d1abdaf87f91ae257e0e9c
Comment 3 Martin Klapetek 2014-05-09 09:51:32 UTC
This now returns the other screen -->

I have this setup

[Screen0 - 1920x1200][Screen1 - 1440x900]

When the panel is at Screen0, I'm getting plasmoid.screen == 1, when the panel is on Screen1, I'm getting plasmoid.screen == 0

As such the notification popup now appears on the opposite screen than it's supposed to (which is where the panel with the applet is).
Comment 4 Aleix Pol 2014-05-09 09:54:21 UTC
Interesting. I'll investigate further.
Comment 5 Aleix Pol 2014-05-09 13:58:51 UTC
I've been trying to reproduce. I installed the hello world plasmoid and changed the text displayed into plasmoid.screen.

I always get 0 on the primary screen and 1 in the not-primary.
Comment 6 Martin Klapetek 2014-05-09 14:06:55 UTC
Note that I don't have a primary screen (xrandr below), I also still kinda experience the wrong panel placement, now it's just random.

As you can see from the xrandr output, the position of the screen is known (1920x1200+0+0 vs 1440x900+1920+300), so I think this should not be as much about primary screen, but rather iterating the screens from left? That's the same as QScreen works I think. I'd like Martin G's input on this tho.

Finally, this was working before, so it's a regression.

---

DVI-I-1 connected 1920x1200+0+0 (normal left inverted right x axis y axis) 518mm x 324mm
   1920x1200      60.0*+
   1920x1080      60.0
   1680x1050      60.0
   1600x1200      60.0
   1440x900       59.9
   1280x1024      75.0     60.0
   1280x800       59.8
   1024x768       75.0     60.0
   1024x576       60.0
   800x600        75.0     60.3
   640x480        75.0     59.9
HDMI-0 disconnected (normal left inverted right x axis y axis)
DP-0 disconnected (normal left inverted right x axis y axis)
DVI-D-0 connected 1440x900+1920+300 (normal left inverted right x axis y axis) 408mm x 255mm
   1440x900       59.9*+   75.0
   1280x1024      76.0     75.0     72.0     60.0
   1152x864       75.0
   1024x768       75.0     70.1     60.0
   800x600        75.0     72.2     60.3
   640x480        75.0     72.8     59.9
   640x350        70.1
DP-1 disconnected (normal left inverted right x axis y axis)
Comment 7 Aleix Pol 2014-05-09 14:41:35 UTC
You don't have any primary screen set there, then it randomly takes a primary screen. You should set a primary.

You can do so by, for example: xrandr --output DVI-D-0 --primary

KScreen daemon is responsible of doing this, I'm working on the KF5 port at the moment.
Comment 8 Martin Klapetek 2014-05-09 14:49:45 UTC
I still don't think that plasmoid.screen == 0 should be the primary screen as the concept of screen numbers everywhere else is basically an iteration from top-left corner, so eg. screen 0 is the most top-left screen.

I might be wrong though. Martin?
Comment 9 Martin Flöser 2014-05-09 14:57:57 UTC
To be honest: numbering screens doesn't make much sense. If one wants to properly do it, it would need to be a QString and the output name.

That said: in KWin we use numbering with left to right.
Comment 10 Martin Flöser 2014-05-09 14:58:55 UTC
(In reply to comment #9)

> That said: in KWin we use numbering with left to right.

and is broken as I just noticed in our screens sub-menu :-)

So yes, numbering sucks ;-)
Comment 11 Aleix Pol 2014-05-09 15:33:26 UTC
In plasma, 0 means primary, the rest is just how they're internally set up. We might want to predictably sort them, but it hasn't happened yet.
Comment 12 Martin Klapetek 2014-05-09 16:49:08 UTC
Right, that's what the bug is about now - it used to be sorted as it was based on QScreen, now it's not -> it's a regression from the previous behavior.
Comment 13 Martin Klapetek 2014-05-09 17:16:13 UTC
Actually, the bigger probelm which I forgot to mention is that now plasmoid.screen does not correspond with the panel it is in - the notification popup is on the *opposite* screen than the panel is at, while it should be the same.
Comment 14 Aleix Pol 2014-05-09 23:32:34 UTC
Can you point me to the usage of this API? It will be easier, otherwise I feel like I'm shooting randomly. Or a test, that would work too :).
Comment 15 Aleix Pol 2014-05-12 11:05:51 UTC
ping.
Comment 16 Martin Klapetek 2014-05-12 11:13:07 UTC
plasma-workspace/applets/notifications - qml sets the plasmoid screen, the plugin then gets the screen size by the number.

You can simply trigger a notification by notify-send.
Comment 17 Elias Probst 2014-05-26 17:30:56 UTC
Enabling the 2nd screen here causes the following behaviour of plasmashell/kwin:
- all windows remain on the secondary screen
- the primary screen shows no wallpaper (black background, a wallpaper is configured for this containment), needs restart of plasmashell
- plasmashell on the primary screen doesn't allow any interaction:
  - no reaction on right-clicking on the desktop
  - dragging applets to it just "swallows" them… they disappear when they're dragged there
- the panel configured for the primary screen doesn't show up until I restart plasmashell, but then it shows up on the 2nd screen

Does this sound like something for a separate bug or should I better wait for this one being resolved first?

Enabling the 2nd screen using:
/usr/bin/xrandr --output eDP1 --primary --auto --pos 528x1440 --output DP1 --auto --pos 0x0

"xrandr -q" output:
Screen 0: minimum 320 x 200, current 2560 x 2520, maximum 32767 x 32767
eDP1 connected primary 1920x1080+528+1440 (normal left inverted right x axis y axis) 294mm x 165mm
   1920x1080      60.0*+   40.0
   1400x1050      60.0
   1280x1024      60.0
   1280x960       60.0
   1024x768       60.0
   800x600        60.3     56.2
   640x480        59.9
VGA1 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
DP1 connected 2560x1440+0+0 (normal left inverted right x axis y axis) 597mm x 336mm
   2560x1440      60.0*+
   1920x1200      59.9
   1920x1080      60.0     60.0     50.0     59.9     24.0     24.0
   1920x1080i     60.1     50.0     60.0
   1600x1200      60.0
   1680x1050      60.0
   1280x1024      75.0     60.0
   1280x800       59.8
   1152x864       75.0
   1280x720       60.0     50.0     59.9
   1024x768       75.1     60.0
   800x600        75.0     60.3
   720x576        50.0
   720x480        60.0     59.9
   640x480        75.0     60.0     59.9
   720x400        70.1
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
Comment 18 Aleix Pol 2014-05-27 10:19:12 UTC
I would open a new bug report, it's unrelated to the issue discussed here, still sounds like an important issue. On the other hand, it sounds like a bug in Qt, but we can investigate it further in a separate bug report.
Comment 19 Aleix Pol 2014-06-17 14:03:08 UTC
Git commit e1051994addfc174b4919fdc12231957ad578177 by Aleix Pol.
Committed on 17/06/2014 at 14:02.
Pushed by apol into branch 'master'.

Ensure that the containment's corona is properly calculated.

The used corona is either the containment's parent or, in case the parent
is an applet, it's containment's corona. With this change we ensure the
proper corona is always found.
This change requires screenContainment to be able to walk through the
object tree in case it's not a containment directly managed by it.

M  +14   -11   src/plasma/containment.cpp

http://commits.kde.org/plasma-framework/e1051994addfc174b4919fdc12231957ad578177
Comment 20 Aleix Pol 2014-06-17 14:03:17 UTC
Git commit b5589fe3da15b486e26e4b21ca72537ca51136e1 by Aleix Pol.
Committed on 17/06/2014 at 13:57.
Pushed by apol into branch 'master'.

Recursively figure out the screen a containment is in

If a containment is in an applet, then recursively ask for the screen
until we get to an actual root containment that can tell us the screen.

M  +9    -0    shell/shellcorona.cpp

http://commits.kde.org/plasma-workspace/b5589fe3da15b486e26e4b21ca72537ca51136e1