After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 646761 - Mutter should not apply the special modal decoration if the parent window is the desktop
Mutter should not apply the special modal decoration if the parent window is ...
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: general
3.0.x
Other Linux
: Normal major
: ---
Assigned To: Owen Taylor
mutter-maint
: 633946 655258 656124 (view as bug list)
Depends on: 647712
Blocks: 657077
 
 
Reported: 2011-04-05 00:23 UTC by Cosimo Cecchi
Modified: 2011-09-08 16:27 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
window: only attach dialogs to NORMAL, DIALOG, and MODAL_DIALOG windows (4.85 KB, patch)
2011-04-05 14:19 UTC, Dan Winship
needs-work Details | Review
windowManager: use meta_window_is_attached_dialog() (2.67 KB, patch)
2011-04-05 14:20 UTC, Dan Winship
needs-work Details | Review
window: only attach dialogs to NORMAL, DIALOG, and MODAL_DIALOG windows (6.16 KB, patch)
2011-04-25 13:52 UTC, Dan Winship
needs-work Details | Review
windowManager: use meta_window_is_attached_dialog() (2.65 KB, patch)
2011-04-25 13:53 UTC, Dan Winship
needs-work Details | Review
window: only attach dialogs to NORMAL, DIALOG, and MODAL_DIALOG windows (9.02 KB, patch)
2011-07-14 20:33 UTC, Dan Winship
needs-work Details | Review
windowManager: replace GLSL window fader with a Lightbox (8.33 KB, patch)
2011-07-14 20:34 UTC, Dan Winship
rejected Details | Review
windowManager: use meta_window_is_attached_dialog() (3.08 KB, patch)
2011-07-14 20:35 UTC, Dan Winship
none Details | Review
window-dimmer: Make the effect more notice able (1.00 KB, patch)
2011-07-17 12:18 UTC, drago01
none Details | Review
window-dimmer: Make the effect more notice able (1.00 KB, patch)
2011-07-17 12:20 UTC, drago01
none Details | Review
window: make determination of attached dialog windows more consistent (10.50 KB, patch)
2011-07-22 16:45 UTC, Dan Winship
reviewed Details | Review
window: only attach dialogs to NORMAL, DIALOG, and MODAL_DIALOG windows (952 bytes, patch)
2011-07-22 16:46 UTC, Dan Winship
none Details | Review
attached dialog test program (1.69 KB, text/plain)
2011-08-02 16:49 UTC, Dan Winship
  Details
updated attach test, now with choice of two parent windows (2.88 KB, text/plain)
2011-08-02 18:08 UTC, Dan Winship
  Details
window: make determination of attached dialog windows more consistent (14.49 KB, patch)
2011-08-02 18:08 UTC, Dan Winship
committed Details | Review
window: only attach dialogs to NORMAL, DIALOG, and MODAL_DIALOG windows (942 bytes, patch)
2011-08-02 18:08 UTC, Dan Winship
committed Details | Review
test-attached: new program for testing attached dialogs (4.70 KB, patch)
2011-08-02 20:26 UTC, Dan Winship
committed Details | Review
windowManager: use meta_window_is_attached_dialog() (3.08 KB, patch)
2011-08-26 13:38 UTC, Dan Winship
committed Details | Review

Description Cosimo Cecchi 2011-04-05 00:23:29 UTC
To reproduce:
- enable Nautilus desktop icons; gsettings set org.gnome.desktop.background show-desktop-icons true
- start Nautilus
- try to permanently delete a file with Shift+Delete, so you get a confirmation dialog

This is way worse with a dual monitor setup, as the confirmation dialog ends up being placed in the middle of the two screens (especially if the two monitors have the same resolution), which may not even be top-aligned vertically.
Comment 1 Matthias Clasen 2011-04-05 13:34:21 UTC
I've complained about this long ago...
Comment 2 Dan Winship 2011-04-05 14:19:24 UTC
Created attachment 185200 [details] [review]
window: only attach dialogs to NORMAL, DIALOG, and MODAL_DIALOG windows

Attaching dialogs to unusual windows (like the desktop) looks bad, so
don't do it. Add meta_window_is_attached_dialog() with all of the
correct logic for deciding whether or not to attach a window, and use
that in several places.
Comment 3 Dan Winship 2011-04-05 14:20:07 UTC
Created attachment 185201 [details] [review]
windowManager: use meta_window_is_attached_dialog()

Use meta_window_is_attached_dialog() so that we only dim/unfold dialog
windows that mutter is actually showing as attached
Comment 4 Owen Taylor 2011-04-21 20:39:01 UTC
Review of attachment 185200 [details] [review]:

window.c:move_attached_dialog() needs a fix, or it will move dialogs that are detached by this patch to 0,0.

What's the effect on meta_window_propagate_focus_appearance()? It looks like to me that the parent will "appear focused" despite the lack of attachment because attached_focus_window will be set.

::: src/core/constraints.c
@@ -755,3 @@
-  if (!meta_prefs_get_attach_modal_dialogs ())
-    return TRUE;
-  if (window->type != META_WINDOW_MODAL_DIALOG || !parent || parent == window)

The parent == window check here is clearly ineffective for more complicated chains of loope attached windows, but I'm not comfortable removing it in the 3.0.x timescale. (And testing didn't find anything *too* bad with looped chains of attached windows when I wrote some test cases a few weeks ago, for whatever reason)

::: src/core/window.c
@@ +10227,3 @@
+    return FALSE;
+
+  switch (parent->type)

By adding this check, we've added an additional way that a window can transition from attached to non-attached or vice versa. Probably a bad idea to worry about fixing up for 3.0.x, but long term I think it would be best to see the tracking be accurate and correct rather than having a random subset of things work and another random subset not.
Comment 5 Owen Taylor 2011-04-21 21:06:27 UTC
Review of attachment 185201 [details] [review]:

Patch certainly doesn't handle complicated cases where the parent changes window types or the transient-for setup changes - seems to get that to work, we'd need a notified ::has-attached-dialogs property mantained by the mutter core. But it seems like it shouldn't make things worse.

Patch needs to up the mutter required version in configure.ac, but I guess can't until that lands and we know what the appropriate version would be.

::: js/ui/windowManager.js
@@ +383,3 @@
                && parent) {
             this._checkDimming(parent, window);
+            if (!window.is_attached_dialog() || !this._shouldAnimate())

This check didn't make any sense before, and still doesn't; breaking on !shouldAnimate seems wrong.
Comment 6 Dan Winship 2011-04-25 13:52:55 UTC
Created attachment 186592 [details] [review]
window: only attach dialogs to NORMAL, DIALOG, and MODAL_DIALOG windows

- Always call move_attached_dialog() when moving a window, but call
  meta_window_is_attached_dialog() from inside it
- Use meta_window_is_attached_dialog() in propagate_focus_appearance()
- Add the "parent != window" check to meta_window_is_attached_dialog()
Comment 7 Dan Winship 2011-04-25 13:53:43 UTC
Created attachment 186593 [details] [review]
windowManager: use meta_window_is_attached_dialog()

- remove incorrect shouldAnimate() check.
- (still doesn't update the configure check)
Comment 8 Florian Müllner 2011-05-31 22:56:06 UTC
*** Bug 633946 has been marked as a duplicate of this bug. ***
Comment 9 Owen Taylor 2011-07-07 14:09:44 UTC
Review of attachment 186592 [details] [review]:

One problem I see here (in addition to the not-really-fully-correct-but-OK-for-now caveats noted earlier)

::: src/core/window.c
@@ +6386,1 @@
     return;

I think you also need this check when walking up the chain - consider a transient-for for a window that is transient-for the desktop - the focus appearance would propagate up to the desktop, while it should stop at the immediate parent.
Comment 10 Owen Taylor 2011-07-07 14:23:45 UTC
Review of attachment 186593 [details] [review]:

::: js/ui/windowManager.js
@@ +382,2 @@
         while (window.get_window_type() == Meta.WindowType.MODAL_DIALOG
                && parent) {

This check here seems duplicative of the is_attached_dialog check below - I'd expect something like:

 while (parent && window.is_attached_dialog()) {
     this._checkDimming(parent, window);
     ....

But then again, wait, this loop really makes not much sense to me - why would we do the rest of the loop for parents of a window being destroyed? And what the heck is the return doing at the end of the loop? This loop isn't a loop at all - it's just a loop so the break can be a goto? so probably the shouldAnimate was needed?
Comment 11 Dan Winship 2011-07-14 20:33:44 UTC
Created attachment 191999 [details] [review]
window: only attach dialogs to NORMAL, DIALOG, and MODAL_DIALOG windows

====

big change here is that we now freeze the "attached" status when the
dialog maps (and make no attempt to correct it for existing windows
when the preference changes), so nothing needs to worry about the
possibility of visible dialogs changing between attached and
unattached
Comment 12 Dan Winship 2011-07-14 20:34:54 UTC
Created attachment 192000 [details] [review]
windowManager: replace GLSL window fader with a Lightbox

The GLSL-based window fader apparently doesn't work on quite a lot of
otherwise-supported hardware. So replace it with something simpler.

====

I had to do this to be able to test that the code was dimming and
undimming windows correctly. I have no idea if the dimming percentage
is correct, since I have never seen the GLSL-based effect before...
Comment 13 Dan Winship 2011-07-14 20:35:03 UTC
Created attachment 192001 [details] [review]
windowManager: use meta_window_is_attached_dialog()

Use meta_window_is_attached_dialog() so that we only dim/unfold dialog
windows that mutter is actually showing as attached
Comment 14 drago01 2011-07-16 23:03:04 UTC
(In reply to comment #12)
> Created an attachment (id=192000) [details] [review]
> windowManager: replace GLSL window fader with a Lightbox
> 
> The GLSL-based window fader apparently doesn't work on quite a lot of
> otherwise-supported hardware. So replace it with something simpler.

How exactly does it fail? Does it at least compile? Which hardware (and driver) is that?
Comment 15 drago01 2011-07-16 23:06:54 UTC
(In reply to comment #12)
> Created an attachment (id=192000) [details] [review]
> 
> I had to do this to be able to test that the code was dimming and
> undimming windows correctly. I have no idea if the dimming percentage
> is correct, since I have never seen the GLSL-based effect before...

Here is a video of the current (GLSL-based) effect:

http://193.200.113.196/apache2-default/dim.webm 

(it is very subtle, you might just not have noticed it).
Comment 16 Florian Müllner 2011-07-16 23:40:37 UTC
(In reply to comment #14)
> (In reply to comment #12)
> > Created an attachment (id=192000) [details] [review] [details] [review]
> > windowManager: replace GLSL window fader with a Lightbox
> > 
> > The GLSL-based window fader apparently doesn't work on quite a lot of
> > otherwise-supported hardware. So replace it with something simpler.
> 
> How exactly does it fail? Does it at least compile? Which hardware (and driver)
> is that?

Probably an older intel card which only supports ARB shaders.

As the existing shader desaturates the window rather than dimming it, I'm not sure the replacement is wanted unconditionally. On the other hand, the difference might not really matter in practice.
Comment 17 Dan Winship 2011-07-17 12:08:27 UTC
(In reply to comment #15)
> (it is very subtle, you might just not have noticed it).

Wow.

"Subtle" is hardly the word for that. I've spent a lot of time fiddling with modal dialogs for this bug, bug 647712, and bug 647613, and I knew that there was supposed to be a dimming effect, and I *still* never noticed it. (And Owen claimed in the original bug that the effect didn't work on any of his machines, but I wonder now if that's really true.)
Comment 18 drago01 2011-07-17 12:18:32 UTC
Created attachment 192124 [details] [review]
window-dimmer: Make the effect more notice able

The window dimming effect seems to be to subtle that some people
don't even notice it, so make it a bit more notice able.
Comment 19 drago01 2011-07-17 12:19:29 UTC
(In reply to comment #16)
> (In reply to comment #14)
> > (In reply to comment #12)
> > > Created an attachment (id=192000) [details] [review] [details] [review] [details] [review]
> > > windowManager: replace GLSL window fader with a Lightbox
> > > 
> > > The GLSL-based window fader apparently doesn't work on quite a lot of
> > > otherwise-supported hardware. So replace it with something simpler.
> > 
> > How exactly does it fail? Does it at least compile? Which hardware (and driver)
> > is that?
> 
> Probably an older intel card which only supports ARB shaders.

I can't think of any such card, iirc even 915 does support GLSL and we don't really support anything older then that.
Comment 20 drago01 2011-07-17 12:20:36 UTC
Created attachment 192125 [details] [review]
window-dimmer: Make the effect more notice able

The window dimming effect seems to be too subtle that some people
don't even notice it, so make it a bit more notice able.

---

*) Fixed commit message
Comment 21 drago01 2011-07-17 12:24:27 UTC
(In reply to comment #17)
> (In reply to comment #15)
> > (it is very subtle, you might just not have noticed it).
> (And Owen
> claimed in the original bug that the effect didn't work on any of his machines,
> but I wonder now if that's really true.)

No, after an IRC discussion back then it ended up as "didn't notice it before" rather than "does not work".
Comment 22 Florian Müllner 2011-07-17 12:28:58 UTC
(In reply to comment #19)
> > Probably an older intel card which only supports ARB shaders.
> 
> I can't think of any such card, iirc even 915 does support GLSL and we don't
> really support anything older then that.

You remember incorrectly, on my netbook with 915 I get:

  JS LOG: Error invoking Clutter.compile: GLSL shaders not supported
Comment 23 Owen Taylor 2011-07-18 14:57:03 UTC
(In reply to comment #21)
> (In reply to comment #17)
> > (In reply to comment #15)
> > > (it is very subtle, you might just not have noticed it).
> > (And Owen
> > claimed in the original bug that the effect didn't work on any of his machines,
> > but I wonder now if that's really true.)
> 
> No, after an IRC discussion back then it ended up as "didn't notice it before"
> rather than "does not work".

Yes, that was the case. But I think not drawing the eye isn't necessarily a bug. (Except when you are trying to understand if it's working correctly or not!)
Comment 24 Dan Winship 2011-07-18 15:04:08 UTC
But what is the point of having an effect at all if even people who are explicitly looking for it can't see it?
Comment 25 drago01 2011-07-18 16:32:38 UTC
(In reply to comment #22)
> (In reply to comment #19)
> > > Probably an older intel card which only supports ARB shaders.
> > 
> > I can't think of any such card, iirc even 915 does support GLSL and we don't
> > really support anything older then that.
> 
> You remember incorrectly, on my netbook with 915 I get:
> 
>   JS LOG: Error invoking Clutter.compile: GLSL shaders not supported

Yeah was wrong, 915 does not support control flow (and vertex shaders in hw) so no GLSL.
Comment 26 Owen Taylor 2011-07-18 18:20:10 UTC
(In reply to comment #24)
> But what is the point of having an effect at all if even people who are
> explicitly looking for it can't see it?

Presumably it still directs the users eye to the dialog? (One of the reasons it is subtle is that it depends on time, so it takes a second or two to fully darken. Presumably the fact that there's no sudden blink that takes your eye to the window that we are trying to deemphasize is a good thing.)

I know the designers do want some tweaking - I think they were unhappy with the fact that it blended with middle gray rather than darkening. (Though what is is supposed to do for dark-theme apps if we darken?) So, probably the best thing to do is to get them to review/mockup what they want rather than just intensifying what we have no.
Comment 27 Owen Taylor 2011-07-22 02:29:22 UTC
Review of attachment 191999 [details] [review]:

The problem I see with freezing the status at attach time is that there's an assumption that any attached dialog has a parent that it's attached to. But we can't freeze the existence of a parent - the parent might get destroyed, after all. If we want to avoid handling an attached dialog becoming unattached, the only idea I have is to fake the window being withdrawn an unmapped - it seems like you should be able to do this with:

   meta_window_unmanage (window, timestamp);
   new_window = meta_window_new (display, xid, FALSE);

With the obvious caveat that we've changed the identity of the window, and emitted all sorts of "window created signals" - so we need to be pretty careful where we do this - in particular, we'd never want to do it inside any method that could be called from application code.

::: src/core/window.c
@@ +10256,3 @@
+
+  if (window->mapped)
+    return window->attached;

I don't think window->mapped, which is the state of the client window, really has anything to do with whether you want to use the frozen window or not - e.g., if someone shaded a (non-attached) dialog, you wouldn't want to unfreeze it's map state. It seems to me that you want to compute this once towards the end of the management process and leave it that way. (Which makes me think there shouldn't be a single function that either computes the unfrozen value or returns the frozen value, but they should be split apart.)
Comment 28 Dan Winship 2011-07-22 14:01:02 UTC
(In reply to comment #27)
> With the obvious caveat that we've changed the identity of the window, and
> emitted all sorts of "window created signals" - so we need to be pretty careful
> where we do this - in particular, we'd never want to do it inside any method
> that could be called from application code.

Right. I'd suggested on IRC yesterday that we could use the unmap/remap to just fix up the window any time it's should-be-attached state changed, but it's probably safer to not do that, and instead to only do it in the parent-destroyed case.

> It seems to me that you want to compute this once towards the
> end of the management process and leave it that way.

Yes, that's more or less what I meant, I was just confused.
Comment 29 Dan Winship 2011-07-22 16:45:51 UTC
Created attachment 192466 [details] [review]
window: make determination of attached dialog windows more consistent

Different bits of code were using slightly different checks to test
whether a window was an attached dialog. Add a new
meta_window_is_attached_dialog(), and use that everywhere.

Also, freeze the is-attached status when the window first shown, since
nothing else is really set up to deal with windows switching between
attached and detached. (However, if the parent window is destroyed, we
try to fix things up in that case.)

Remove some code in display.c that tried to fix existing windows if
the gconf setting changed, but which didn't actually do anything (at
least under gnome-shell). However, if 654643 was fixed then the new
behavior with this patch would be that changing the gconf setting
would affect new dialogs, but not existing ones.
Comment 30 Dan Winship 2011-07-22 16:46:10 UTC
Created attachment 192467 [details] [review]
window: only attach dialogs to NORMAL, DIALOG, and MODAL_DIALOG windows

Attaching dialogs to unusual windows (like the desktop) looks bad, so
don't do it.
Comment 31 Dan Winship 2011-07-26 17:07:04 UTC
(In reply to comment #29)
> attached and detached. (However, if the parent window is destroyed, we
> try to fix things up in that case.)

untested, btw... anyone got an easy way to check that, or do we need to write a test program specifically for that?
Comment 32 Owen Taylor 2011-07-27 17:10:26 UTC
Review of attachment 192466 [details] [review]:

What about the case where the transient-for hint gets changed? That could equally result in a transient window without a parent. I think we need to handle it the same way. I don't think there's any reentrancy-from-application code issues, but some care would definitely be needed with the prop-hooks code for reentrancy.

(If you handle that, then it's going to be hard to write a GTK+ based test case for this case, since I think GTK+ will unset the transient-for relationship first.)

::: src/core/window.c
@@ +1127,3 @@
+  window->attached = should_attach_to_parent (window);
+  if (window->attached)
+    recalc_window_features (window);

Little weird to do this twice (it's done before out of meta_window_update_net_wm_type()), but any workaround would be added complexity for virtually no gain, think it's likely better like this, even if we get a double update of the allowed actions property on the window.
Comment 33 Dan Winship 2011-08-02 16:49:50 UTC
Created attachment 193089 [details]
attached dialog test program

compile with:

cc -o attach attach.c `pkg-config --cflags --libs gtk+-3.0`
Comment 34 Dan Winship 2011-08-02 18:08:07 UTC
Created attachment 193092 [details]
updated attach test, now with choice of two parent windows
Comment 35 Dan Winship 2011-08-02 18:08:27 UTC
Created attachment 193093 [details] [review]
window: make determination of attached dialog windows more consistent

Different bits of code were using slightly different checks to test
whether a window was an attached dialog. Add a new
meta_window_is_attached_dialog(), and use that everywhere.

Also, freeze the is-attached status when the window is first shown,
rather than recomputing it each time the caller asks, since this could
cause problems if a window changes its type after it has already been
attached, etc. However, if an attached window's parent is destroyed,
or an attached window changes its transient-for, then fix things up by
destroying the old MetaWindow and creating a new one (causing
compositor unmap and map events to be fired off, allowing the display
of the window to be fixed up).

Remove some code in display.c that tried to fix existing windows if
the gconf setting changed, but which didn't actually do anything (at
least under gnome-shell). However, if 654643 was fixed then the new
behavior with this patch would be that changing the gconf setting
would affect new dialogs, but not existing ones.
Comment 36 Dan Winship 2011-08-02 18:08:33 UTC
Created attachment 193094 [details] [review]
window: only attach dialogs to NORMAL, DIALOG, and MODAL_DIALOG windows

Attaching dialogs to unusual windows (like the desktop) looks bad, so
don't do it.
Comment 37 Dan Winship 2011-08-02 20:26:26 UTC
Created attachment 193103 [details] [review]
test-attached: new program for testing attached dialogs

====

figured out a place in mutter to stick this...
Comment 38 Rui Matos 2011-08-07 20:14:04 UTC
*** Bug 656124 has been marked as a duplicate of this bug. ***
Comment 39 Owen Taylor 2011-08-26 12:09:40 UTC
Review of attachment 193093 [details] [review]:

::: src/core/window-props.c
@@ +1538,3 @@
+          window->xtransient_for = old_transient_for;
+          timestamp = meta_display_get_current_time_roundtrip (window->display);
+          meta_window_unmanage (window, timestamp);

I'm unclear about when the window is created again - we seem to basically call meta_window_new() only from MapRequest and MapNotify.

If there's some reliable path, a comment might be useful.

Otherwise, patch looks fine to me.
Comment 40 Owen Taylor 2011-08-26 12:15:46 UTC
Review of attachment 193103 [details] [review]:

Looks like it should provide a good test of all the basic possibilities.

::: .gitignore
@@ +61,3 @@
 test-resizing
 test-size-hints
+src/wm-tester/wm-tester

why was adding the path here necessary? It seems strangely inconsistent. (If harmless)
Comment 41 Owen Taylor 2011-08-26 12:17:41 UTC
Review of attachment 193094 [details] [review]:

Looks good
Comment 42 Dan Winship 2011-08-26 13:22:10 UTC
(In reply to comment #39)
> Review of attachment 193093 [details] [review]:
> +          meta_window_unmanage (window, timestamp);
> 
> I'm unclear about when the window is created again - we seem to basically call
> meta_window_new() only from MapRequest and MapNotify.

Yeah, meta_window_unmanage() remaps it. It seems to be assuming that windows will only be unmanaged when either (a) they're withdrawn/destroyed, or (b) mutter is exiting, and in the latter case, it remaps the window "so other WMs know that it isn't Withdrawn". I'll add comments in both places.

(In reply to comment #40)
> +src/wm-tester/wm-tester
> 
> why was adding the path here necessary? It seems strangely inconsistent. (If
> harmless)

having just "wm-tester" causes the src/wm-tester directory to be ignored (which then causes git to complain when you try to add a new file to it), when we only wanted the src/wm-tester/wm-tester binary to be ignored.
Comment 43 Dan Winship 2011-08-26 13:38:45 UTC
Created attachment 194834 [details] [review]
windowManager: use meta_window_is_attached_dialog()

Use meta_window_is_attached_dialog() so that we only dim/unfold dialog
windows that mutter is actually showing as attached

====

oops, I forgot to attach the gnome-shell side of the patch along with
the mutter side in the last update. This fixes the weird pseudo-loop
from the original code and earlier versions of the patch
Comment 44 Owen Taylor 2011-08-26 14:20:40 UTC
Review of attachment 194834 [details] [review]:

Looks right to me
Comment 45 Dan Winship 2011-08-27 17:13:58 UTC
Attachment 193093 [details] pushed as 7f8c596 - window: make determination of attached dialog windows more consistent
Attachment 193094 [details] pushed as 2be1574 - window: only attach dialogs to NORMAL, DIALOG, and MODAL_DIALOG windows
Attachment 193103 [details] pushed as 368a90c - test-attached: new program for testing attached dialogs
Comment 46 Dan Winship 2011-08-27 17:14:55 UTC
closing... if we want to change the dim effect we can open a new bug
for that

Attachment 194834 [details] pushed as a13af7f - windowManager: use meta_window_is_attached_dialog()
Comment 47 Cosimo Cecchi 2011-09-08 16:27:08 UTC
*** Bug 655258 has been marked as a duplicate of this bug. ***