"Always on top" prevents application spread from working

Bug #1131385 reported by Esokrates
72
This bug affects 16 people
Affects Status Importance Assigned to Milestone
Unity
Fix Released
Low
Christopher Townsend
7.2
Fix Committed
Low
Christopher Townsend
unity (Ubuntu)
Fix Released
Low
Christopher Townsend
Trusty
Fix Released
Low
Unassigned

Bug Description

[Impact]
Consider you have many windows of the same type open. One method of switching between them is clicking the launcher icon which reveals the application spread. Now you can choose between the windows. This is how it should be.
However, the design idea was, if the windows are marked "Always on Top" there is no need for an application spread, as they are always on top. This is a bug and needs to be changed, because it does not consider minimized windows and therefore prevents switching to those windows.
If you have windows of the same application open, some of them minimized and ALL non-minimized windows are marked as "Always on top", the application spread does not work anymore, clicking the launcher does nothing. Whether the minimized windows are marked always on top or not does not matter.

[Test case]
So the simplest way to reproduce this bug would be:
1.) Open two windows of the same application.
2.) Minimize one and mark the other (non-minimized) as "Always on top".
3.) Try to switch to the minimized window using application spread
4.) Spread should work, although the always-on-top window should stay afterwards

[Regression Potential]
Alaways-on-top windows (when opened just once per app) might be not properly focused using launcher icon.

Related branches

Esokrates (esokrarkose)
summary: - "Always on top" prevents application spread to work
+ "Always on top" prevents application spread from working
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

This would be in unity alone.

Changed in compiz:
status: New → Invalid
Changed in unity:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Also I get this in 13.04, but im guessing it will be a problem in 12.10, 12.04. Could add some info on the version you are using?

Changed in unity:
milestone: none → 7.0.0
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Also the fix for this will be in unity/unity-shared/PluignAdapter.cpp. Where we tell if a window is on top. What is happening, is we skip always on top windows and if all the other windows are minimized it will return false.

Also look in unity/launcher/ApplicationLauncherIcon.cpp::ActivateLauncherIcon as this function is what calls:

 if (!any_on_top && wm.IsWindowOnTop(xid))

Which is what you will be checking to see if its false or true.

tags: added: bitesize
Changed in unity:
importance: Medium → Low
Changed in unity (Ubuntu):
status: New → Confirmed
Changed in ayatana-design:
status: New → Invalid
Stephen M. Webb (bregma)
Changed in unity:
milestone: 7.0.0 → 7.0.1
Changed in unity:
assignee: nobody → Ryan Nathaniel Smith (ryan-smith)
Changed in unity:
status: Triaged → In Progress
Changed in unity:
assignee: Ryan Nathaniel Smith (ryan-smith) → nobody
Revision history for this message
Taihsiang Ho (tai271828) wrote :

reproducible on 13.10

Changed in unity:
assignee: nobody → Taihsiang Ho (taihsiangho)
Changed in unity (Ubuntu):
assignee: nobody → Taihsiang Ho (taihsiangho)
status: Confirmed → In Progress
Revision history for this message
Taihsiang Ho (tai271828) wrote :

not reproducible on 12.04
unity 5.20.0

Revision history for this message
Taihsiang Ho (tai271828) wrote :

reproducible on 12.10
unity 6.8.0

Revision history for this message
Taihsiang Ho (tai271828) wrote :

reproducible on 14.04
unity version: 7.2.0

1. launch two calculator applications, say A and B
2. set A as "Always on top", and make B minimized
3. try to use application spread, then you will reproduce this bug
4
. minimized A
5. use application spread again. only A pop up.

Revision history for this message
Taihsiang Ho (tai271828) wrote :

gdb shows the if statement in launcher/ApplicationLauncherIcon.cpp goes to

398 Focus(arg);

instead of

404 Spread(true, 0, false);

the Spread method in line 404 is
what we expect to issue when clicking the launcher icon.
When we set one of the window as "Always on Top",
the statement goes go the Focus method in line 398.

testing on 13.10 with
unity 7.1.2
7.1.2+13.10.20131014.1-0ubuntu1

NEXT: why it goes to Focus instead of Spread method

Revision history for this message
Taihsiang Ho (tai271828) wrote :

Focus method mentioned in comment #8 should be in line 418

namely the two variables "active" and "scaleWasActive" are false.

A window which set as "Always on Top" make wm.IsWindowOnTop(xid) return false,
and this make "any_on_top" keep false.
Finally "active" will be set as false.

More information:
if there are two windows set as "Always onTop", this bug could be reproduced.
This is because wm.IsWindowOnTop could not make "any_on_top" be true, nor would make "active" true.

NEXT: why does wm.IsWindowOnTop(xid) return false when the window is set as "Always on Top"

Revision history for this message
Taihsiang Ho (tai271828) wrote :

why does wm.IsWindowOnTop(xid) return false when the window is set as "Always on Top"

this is because GetTopMostValidWindowInViewport() does not return the xid which is equal to the "Always on Top" window.

please see unity-shared/PluginAdapter.cpp:604

unity::PluginAdapter::IsWindowOnTop (this=0xcc5b30, window_id=65011720) at /build/buildd/unity-7.1.2+13.10.20131014.1/unity-shared/PluginAdapter.cpp:604
604 {
(gdb) list
599
600 return false;
601 }
602
603 bool PluginAdapter::IsWindowOnTop(Window window_id) const
604 {
605 if (window_id == GetTopMostValidWindowInViewport())
606 return true;
607
608 return false;
(gdb) display window_id
13: window_id = 65011720
(gdb) print GetTopMostValidWindowInViewport()
$17 = 46137350
(gdb)

Revision history for this message
Taihsiang Ho (tai271828) wrote :

looks like the name of the top window is "Desktop" in comment 10 instead of the name of the "real" "always on top" window.

(gdb) print GetWindowName(GetTopMostValidWindowInViewport())
$11 = {static npos = <optimized out>, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x1d4d228 "Desktop"}}

NEXT: Which window does has the name "Desktop"?

Revision history for this message
Taihsiang Ho (tai271828) wrote :

If all of the windows shown on desktop (active windows) are set as 'always on top',
GetTopMostValidWindowInViewport() will be "Desktop" but not any of the active windows.

This could explain the phenomenon noted in the comment #9:
'if there are two windows set as "Always onTop", this bug could be reproduced.'

It looks like the flag 'Always on Top' make active windows 'could not be seen' or 'disapear from Desktop'
If we could make GetTopMostValidWindowInViewport() return the expected value,
this bug could be fixed.

Revision history for this message
Taihsiang Ho (tai271828) wrote :

in
unity-shared/PluginAdapter.cpp

 621 if (window->defaultViewport() == screen_vp &&
 622 window->isViewable() && window->isMapped() &&
 623 !window->minimized() && !window->inShowDesktopMode() &&
 624 !(window->state() & CompWindowStateAboveMask) &&
 625 !(window->type() & CompWindowTypeSplashMask) &&
 626 !(window->type() & CompWindowTypeDockMask) &&
 627 !window->overrideRedirect() &&
 628 std::find(our_xids.begin(), our_xids.end(), window->id()) == our_xids.end())
 629 {
 630 return window->id();
 631 }

only the return value of window->state() is changed from the 'normal status' (8192) to 'always on top status' (8704)

So now the question is, why !(window->state() & CompWindowStateAboveMask) is false?

Revision history for this message
Taihsiang Ho (tai271828) wrote :

the two numbers I mentioned in comment #13, I meant:

window->state() = (unsigned int &) @0x186e480: 8192
window->state() = (unsigned int &) @0x186e480: 8704

Revision history for this message
Taihsiang Ho (tai271828) wrote :

compiz-0.9.10+13.10.20131011/include/core/window.h:
#define CompWindowStateAboveMask (1 << 9)

8192 & ( 1 << 9 ) is 0, namely !(window->state() & CompWindowStateAboveMask) is true
8704 & ( 1 << 9 ) is 512, namely !(window->state() & CompWindowStateAboveMask) is false

Revision history for this message
Taihsiang Ho (tai271828) wrote :

I think the comment #15 giving the root cause raising this bug.

Changed in unity:
milestone: 7.0.1 → 7.3.1
Stephen M. Webb (bregma)
Changed in unity:
milestone: 7.3.1 → 7.3.2
Stephen M. Webb (bregma)
Changed in unity:
milestone: 7.3.2 → 7.3.3
Changed in unity:
assignee: Taihsiang Ho (taihsiangho) → Christopher Townsend (townsend)
Changed in unity (Ubuntu):
assignee: Taihsiang Ho (taihsiangho) → Christopher Townsend (townsend)
importance: Undecided → Low
tags: removed: needs-design
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package unity - 7.3.2+15.10.20150512-0ubuntu1

---------------
unity (7.3.2+15.10.20150512-0ubuntu1) wily; urgency=medium

  [ Chris Townsend ]
  * Add new signal to tell the Launcher to terminate keynav mode and use
    that signal when a BFB quicklist item is chosen. (LP: #1052024,
    #1444643)
  * Add option to enable and disable Unity low graphics mode on the fly
    in ccsm or via gsettings. (LP: #1412937)
  * Remove code that is no longer needed and broke opening application
    spread while in Launcher keynav mode. (LP: #1445082)
  * Save the active window when showing the Dash so the correct window
    is focused when hiding the Dash. Fixes issue when "Always on Top"
    windows are present. (LP: #1446634)
  * Save the active window when showing the Hud so the correct window is
    focused when hiding the Hud. Fixes issue when "Always on Top"
    windows are present. (LP: #1366583)
  * Send signal to ensure the Dash will show when entering keynav mode
    since the first icon always highlighted is the BFB. (LP: #1444113)
  * When looking for the top-most valid window in a VP, also check if
    the window is focused if the window is set to Always on Top. This
    allows Launcher icon spread to work properly when a window is
    minimized an Always on Top exists in the group. (LP: #1131385)
  * When using the left arrow to exit a Quicklist, Launcher keynav is
    implied and should be active regardless of how the Quicklist was
    opened. (LP: #1444626)

  [ Eleni Maria Stea ]
  * The skydome rendering of the cube plugin was wrong with unity
    because transformation matrices set by the unityshell plugin were
    left in the opengl matrix stacks affecting other compiz plugins.
    Saving the compiz state at the beginning of the unityshell plugin
    rendering functions and restoring it at the end of them fixes the
    problem. (LP: #1446165)

 -- CI Train Bot <email address hidden> Tue, 12 May 2015 13:10:15 +0000

Changed in unity (Ubuntu):
status: In Progress → Fix Released
Changed in unity:
status: In Progress → Fix Committed
description: updated
Andrea Azzarone (azzar1)
description: updated
description: updated
description: updated
Changed in unity:
status: Fix Committed → Fix Released
Revision history for this message
Chris J Arges (arges) wrote : Please test proposed package

Hello Esokrates, or anyone else affected,

Accepted unity into trusty-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/unity/7.2.6+14.04.20151021-0ubuntu1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in unity (Ubuntu Trusty):
status: New → Fix Committed
tags: added: verification-needed
Mathew Hodson (mhodson)
Changed in unity (Ubuntu Trusty):
importance: Undecided → Low
affects: ayatana-design → ubuntu-translations
Mathew Hodson (mhodson)
no longer affects: ubuntu-translations
affects: compiz → ubuntu-translations
no longer affects: ubuntu-translations
Revision history for this message
Mathew Hodson (mhodson) wrote :

This is fixed with the packages in trusty-proposed.

$ apt list libunity-core-6.0-9 unity unity-services
Listing... Done
libunity-core-6.0-9/trusty-proposed,now 7.2.6+14.04.20151021-0ubuntu1 amd64 [installed,automatic]
unity/trusty-proposed,now 7.2.6+14.04.20151021-0ubuntu1 amd64 [installed,automatic]
unity-services/trusty-proposed,now 7.2.6+14.04.20151021-0ubuntu1 amd64 [installed,automatic]

tags: added: verification-done
removed: verification-needed
tags: added: quantal saucy trusty
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package unity - 7.2.6+14.04.20151021-0ubuntu1

---------------
unity (7.2.6+14.04.20151021-0ubuntu1) trusty; urgency=medium

  * New upstream release

  [ Andrea Azzarone ]
  * Merge patch from https://launchpadlibrarian.net/216276242/low-gfx-
    override.patch (LP: #1491913)
  * Properly hide decorations when on "Show Desktop" mode. (LP: #1485073)
  * Do not handle events coming from viewports not actually containing the window.
    (LP: #1449654)
  * Make sure new icons are added to the model before calling SortAndUpdate
    (LP: #1458950)
  * GnomeSessionManager: Do not allow shutdown when screen is locked. (LP: #1460626)
  * GnomeSessionManager: Do not allow shutdown when screen is locked.

  [ Chris Townsend ]
  * When looking for the top-most valid window in a VP, also check if the window
    is focused if the window is set to Always on Top. This allows Launcher icon
    spread to work properly when a window is minimized an Always on Top exists in
    the group. (LP: #1131385)
  * Wait on Spread to be terminated before showing the Quicklist. (LP: #1441626)
  * If dragging an application:// uri type from the Dash to the desktop, change it
    to a file:// uri type so Nautilus can understand the type a make a copy of it
    on the desktop. (LP: #1241972)
  * Enable real page up/page down key navigation in the Dash. When using these
    keys the view scrolls the length of the visible view. (LP: #913612)
  * Save the active window when showing the Hud so the correct window is focused
    when hiding the Hud. Fixes issue when "Always on Top" windows are present.
    (LP: #1366583)
  * Save the active window when showing the Dash so the correct window is focused
    when hiding the Dash. Fixes issue when "Always on Top" windows are present.
    (LP: #1446634)
  * When using keyboard navigation in the Dash, skip category headers that are not
    expandable. Also, do not highlight the category header when the mouse cursor
    is over it. (LP: #1045933)
  * Also use the Compiz show() method when forcing an unmapped window to be
    visible when clicking on it's active Launcher icon. (LP: #989588)
  * Add option to enable and disable Unity low graphics mode on the fly in ccsm or
    via gsettings. (LP: #1412937)
  * UScreen, PanelService: get monitor at position, ignoring pre-
    multipled Gdk scale factor (LP: #1351591)

  [ Marco Trevisan (Treviño) ]
  * ResultViewGrid: wait for double-click event only if the relative result needs
    the Preview (LP: #1291950)
  * OverlayWindowButtons: trigger a queuedraw also when a child requires a redraw
    (LP: #1461618)
  * GnomeSessionManager: Request ScreenSaver (de)activation on VT changes (LP:
    #1405349)
  * UScreen, PanelService: get monitor at position, ignoring pre-multipled Gdk
    scale factor (LP: #1351591)
  * UScreen, PanelService: get monitor at position, ignoring pre-
    multipled Gdk scale factor (LP: #1351591)

 -- Marco Trevisan (Treviño) <mail@3v1n0.net> Wed, 21 Oct 2015 15:54:44 +0000

Changed in unity (Ubuntu Trusty):
status: Fix Committed → Fix Released
Revision history for this message
Chris J Arges (arges) wrote : Update Released

The verification of the Stable Release Update for unity has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.