Opened 9 years ago

Closed 3 years ago

#453 closed defect (fixed)

Undocked panels float above other apps on Mac

Reported by: Tom Goddard Owned by: Eric Pettersen
Priority: major Milestone:
Component: Platform Version:
Keywords: Cc: olibclarke@…, Elaine Meng
Blocked By: Blocking: 2071
Notify when closed: Platform: all
Project: ChimeraX

Description

On the Mac undocked tool panels float above the main ChimeraX window and also above other applications like web browser, email, text editor even when those other applications have the focus.

On Linux (Ubuntu 15.10 vizvault) and Windows 10 the undocked panels float above the main ChimeraX window but not above other applications when other applications are given the focus.

The ideal solution would be to make the undocked panels not float above any windows.

Change History (21)

comment:1 by Tom Goddard, 8 years ago

Cc: pett@… removed
Owner: changed from Tom Goddard to Eric Pettersen
Status: newassigned

Eric has investigated solutions for this by modifying Qt C++ code. Drawback is that it would require that we compile Qt where now we simply use prebuilt binaries.

comment:2 by Eric Pettersen, 6 years ago

Cc: olibclarke@… added

comment:3 by Eric Pettersen, 6 years ago

Blocking: 2071

comment:4 by Tom Goddard, 4 years ago

Allowed undocked tool windows to stack behind main window and continue to be visible when other windows have focus, and iconify into the operating system dock with a title bar iconify button. Tested and enabled only on Mac (10.15.7). Needs enabling and testing on Windows and Linux. Seems to be everything we want. Used the suggestion in this post

https://stackoverflow.com/a/63393988

comment:5 by Eric Pettersen, 4 years ago

Well that's largely fantastic, but not being able to redock them easily/simply is a fairly large downside.

in reply to:  6 ; comment:6 by goddard@…, 4 years ago

They redocked with no issues for me last night.  Do you mean you tested the daily build and it is not working?

comment:7 by Eric Pettersen, 4 years ago

No, I was just reading the StackOverflow post: "The only thing that does not work is drag'n'drop back to the main window, but the alternative method - clicking on the "float" button - still works." So, maybe Qt has been improved since that post was made.

in reply to:  8 ; comment:8 by goddard@…, 4 years ago

I had some small issue with redocking using code from that post, but added a line of code to change the window flags back to their docked state when the users docks the tool and that fixed the redocking problems.  Still I only tested this between midnight and 12:30 AM so I hope it holds up.

comment:9 by Eric Pettersen, 4 years ago

Woo hoo! Seemed great in my tiny tests.

comment:10 by Tom Goddard, 4 years ago

Unfortunately on macOS Big Sur undocking the Log or Model Panel now produces an ugly Qt error:

<QNSPanel: 0x7fa006cd31a0; contentView=<QNSView: 0x7fa006cd2ee0; QCocoaWindow(0x7fa006c89890, window=QWidgetWindow(0x7fa006cd4850, name="QDockWidgetClassWindow"))>> has active key-value observers (KVO)! These will stop working now that the window is recreated, and will result in exceptions when the observers are removed. Break in QCocoaWindow::recreateWindowIfNeeded to debug.

There is not even a traceback so it looks as if this does not generate a Python exception. No idea what the "key-value observers", sounds like a Qt mac implementation detail.

comment:11 by Tom Goddard, 4 years ago

Also tested the fix on Windows 10. In ChimeraX 1.2.5 on Windows the undocked tools have no iconify button, float on top of the ChimeraX window but not on top of other applications, and they disappear when the main window is iconified and reappear when it is deiconified. In the fixed version the undocked tool windows still are always on top of the main window. They have an iconify button on the title bar and it works but does a weird thing I never saw on Windows where it iconifies to position above the Windows task bar showing rather ugly deiconify, maximize, and close buttons with no indication of what tool is iconified, although it does show the ChimeraX app logo. The undocked tools still disappear when iconifying the main window. Overall the new behavior on Windows seems a little better and a little worse than the old behavior.

The flag that asks to keep a window on top Qt.WindowStaysOnTopHint is not set. It looks like the undocked tool staying on top and the weird iconified form probably are because the tool has the main window as a parent. I did not find any way to make them not stay on top. If I set the tool window parent to None when undocked ChimeraX crashes with a seg fault.

comment:12 by Tom Goddard, 4 years ago

On macOS Big Sur. I can add the iconify and maximize buttons to the undocked widget without generating any errors and they work as expected, with iconifying creating a system dock icon. This leaves out the Qt.Window flag so the undocked widget always stays on top and disappears if any other application gets the focus.

comment:13 by Eric Pettersen, 4 years ago

All these behaviors will need to be retested when we go to Qt6

comment:14 by Tom Goddard, 4 years ago

I reverted the macOS fix that allowed undocked tool windows to stack below the main window because it caused errors on Big Sur (see comment 10).
I kept the fix on macOS that add iconify and maximize buttons to undocked tools. Did not add those on Windows since iconifying behavior did not put icon in Windows task bar, and did not add buttons on Linux because I did not test it.

comment:15 by Eric Pettersen, 3 years ago

Cc: Elaine Meng added

With Qt6, Tom's fix works without error on Mac 10.15 and 12. Don't have a Big Sur machine (macOS 11) to test on, which was the platform that produced errors when this fix was tried with Qt5. Nonetheless, have committed and pushed the fix so that it can be tested more widely.

The fix is only applied on Mac, so besides testing on Big Sur it would also be good to check if the fix can be used on Windows and Linux.

comment:16 by Eric Pettersen, 3 years ago

Using Microsoft Remote Desktop I tried this on snow and with the change you cannot dock the windows back into the main window. But the default behavior just isn't as bad as it is on the Mac though since the single worst part of the behavior on Mac is that the floating windows disappear when you switch to another app, and on Windows they don't disappear.

comment:17 by Eric Pettersen, 3 years ago

So how do we feel about the new behavior? Is it good or bad that the undocked windows don't always float on top?

in reply to:  18 ; comment:18 by goddard@…, 3 years ago

I think it is better, although it is not without its downside when the windows get buried.  The fact that the windows don't disappear when another application gets the focus is a definite improvement.  I guess we could have a preference to switch between the old and new behavior but I would not add that unless someone badly wants it.

comment:19 by Eric Pettersen, 3 years ago

It is possible (Qt::WindowStaysOnTopHint) to have the floating windows stay on top but yet not disappear when switching to another app. Would we want to try out that behavior for a few days and see what we think?

comment:20 by Eric Pettersen, 3 years ago

Oops they would float on top of other apps too, so that's no good.

comment:21 by Eric Pettersen, 3 years ago

Resolution: fixed
Status: assignedclosed

I *guess* I'm closing this. It would be nice if the undocked panels always floated above ChimeraX (only), but that doesn't seem to be possible on the Mac. It's not even 100% certain that that is the better behavior. At least they don't disappear when switching to another app, which was the real PITA.

Note: See TracTickets for help on using tickets.