Closed Bug 453274 Opened 11 years ago Closed 8 months ago

the alwaysRaised flag has no effect in Linux when used in the openDialog method


(Firefox :: Shell Integration, defect)

3.0 Branch
Not set





(Reporter: linuxed7, Unassigned)



User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/2008072820 Firefox/3.0.1
Build Identifier: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/2008072820 Firefox/3.0.1

As far as I can tell there's no way to open a xul dialog window in Linux and have it remain always on top of the other Firefox windows.  I've tried using the alwaysRaised flag in the openDialog method, but it has no effect on Linux.  Yet for some reason it seems to work fine in Windows.

window.openDialog('chrome://extension/content/example.xul', '_blank', 'chrome=yes,alwaysRaised=yes', null);

I've also tried to set the zLevel index of the xul window using the code below.  Again it has no effect in Linux.

var req = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor);

var wnav = req.getInterface(Components.interfaces.nsIWebNavigation);

var dsti = wnav.QueryInterface(Components.interfaces.nsIDocShellTreeItem);

var own = dsti.treeOwner;

var req2 = own.QueryInterface(Components.interfaces.nsIInterfaceRequestor);

var win = req2.getInterface(Components.interfaces.nsIXULWindow);

win.zLevel = 5;

Is there any way to achieve the alwaysRaised effect in Linux?

Reproducible: Always

Steps to Reproduce:
1. Open a dialog window using the command below:

window.openDialog('chrome://extension/content/example.xul', '_blank', 'chrome=yes,alwaysRaised=yes', null);

2. Click on the browser window behind the popup.
Actual Results:  
The popup falls behind the browser window.

Expected Results:  
The popup should always remain on top of the other windows.

Operating System:
Ubuntu 8.04 64-bit with KDE 4.1
Component: General → OS Integration
Version: unspecified → 3.0 Branch
This happens on Mac OS X as well.  I too have tried the setting the zLevel hack and cannot get it to work.  I even went so far as to try the zLevel code that songbird uses for it's balloontips to no effect. 

This greatly reduces the usability of the KwiClick extension that I've been working on since the window will stay on top for Windows but no other OS.

Anyone able to take a look at this or give a suggestion for a hack to get it to work?
Looking at the code, "alwaysRaised" seems to modify the zLevel value for the window. That zLevel value is used in the ::SetZLevel of nsXULWindow and nsWindowMediator.

SetZLevel fires a windowZLevel event and PlaceBehind() is called on the widget from SortZOrderFrontToBack/SortZOrderBackToFront.

So I guess the trouble is that PlaceBehind() is not implemented on Linux and Mac:

I'm not completely sure if implementing that on these platforms (if something like Windows SetWindowPos() API is available) will solve the issue, but that seems likely.

See bug 91508 for Linux PlaceBehind.
Mac would be bug 417142.
Interesting comment in bug 117730 comment 25 about this.

I found the gdk_window_set_keep_above() gtk+ method for setting a window on top, but it would be on top of all other windows, not only Firefox windows.
QA Contact: general → shell.integration
test on Firefox 49

Windows 10 - Right behavior
MacOS 10.12 - Not working, window not be set to top
Ubuntu 16.04 - Not working, window always set to top
Oh, My test is base-on Addon SDK.
I file another bug:

Legacy add-ons are no longer supported, and if we ever need this for core Firefox we'll file a new bug. If you happen to want it for a WebExtension, please file a bug under the WebExtensions APIs.

Closed: 8 months ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.