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 662799 - Style fixes for PopupComboBoxMenuItem
Style fixes for PopupComboBoxMenuItem
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
: 664746 (view as bug list)
Depends on:
Blocks: 662800
 
 
Reported: 2011-10-26 20:26 UTC by Florian Müllner
Modified: 2011-11-24 18:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
combo-box-menu-item: Propagate style changes to the combo menu (1.67 KB, patch)
2011-10-26 20:26 UTC, Florian Müllner
committed Details | Review
combo-box-menu-item: Propagate :insensitive state to the combo menu (1.30 KB, patch)
2011-10-26 20:26 UTC, Florian Müllner
reviewed Details | Review
combo-box-menu-item: Propagate :insensitive state to the combo menu (1.30 KB, patch)
2011-10-26 20:39 UTC, Florian Müllner
reviewed Details | Review
combo-box-menu-item: Propagate :insensitive state to the combo menu (1.64 KB, patch)
2011-10-26 22:00 UTC, Florian Müllner
needs-work Details | Review
combo-box-menu-item: Propagate pseudo classes to the combo menu (2.43 KB, patch)
2011-10-27 11:35 UTC, Florian Müllner
committed Details | Review

Description Florian Müllner 2011-10-26 20:26:11 UTC
See patches.
Comment 1 Florian Müllner 2011-10-26 20:26:21 UTC
Created attachment 200055 [details] [review]
combo-box-menu-item: Propagate style changes to the combo menu

ComboBoxMenuItems use ClutterClones to reconstruct the active item
in the associated ComboMenu to not impose a particular MenuItem type
in the menu. However, this results in style changes (for instance
those triggered by icon-theme or text-scaling-factor changes) of
the ComboBoxMenuItem not having a visual effect until the ComboBoxMenu
is shown.
As a fix, force a style update on the ComboBoxMenu when the item's
style changes.
Comment 2 Florian Müllner 2011-10-26 20:26:29 UTC
Created attachment 200056 [details] [review]
combo-box-menu-item: Propagate :insensitive state to the combo menu

ComboBoxMenuItems use ClutterClones to reconstruct the active item
in the associated ComboMenu, so when making the ComboBoxMenuItem
insensitive, the item's content lacks a visual hint (as the actual
style information is taken from the associated ComboBoxMenu item).
As a fix, propagate the :insensitive state to the active ComboBoxMenu
item.
Comment 3 Jasper St. Pierre (not reading bugmail) 2011-10-26 20:30:14 UTC
Review of attachment 200055 [details] [review]:

Makes sense.
Comment 4 Jasper St. Pierre (not reading bugmail) 2011-10-26 20:34:25 UTC
Review of attachment 200056 [details] [review]:

::: js/ui/popupMenu.js
@@ +1527,3 @@
     _onSourceActorStyleChanged: function() {
+        let activeItem = this._getMenuItems()[this._activeItemPos];
+        if (this.sourceActor.pseudo_class.match(/ *insensitive */))

Is there something wrong with has_style_pseudo_class?
Comment 5 Florian Müllner 2011-10-26 20:39:38 UTC
Created attachment 200060 [details] [review]
combo-box-menu-item: Propagate :insensitive state to the combo menu

(In reply to comment #4)
> Is there something wrong with has_style_pseudo_class?

Nothing, except that I somehow remembered the has_foo_class() methods as being static and didn't bother to check ;-)
Comment 6 Jasper St. Pierre (not reading bugmail) 2011-10-26 20:43:14 UTC
Review of attachment 200060 [details] [review]:

A comment would be nice. Besides that, should we propagate any other pseudo classes? If so:

    activeItem.pseudo_class = this.sourceActor.pseudo_class;

is probably clearer.
Comment 7 Florian Müllner 2011-10-26 22:00:04 UTC
Created attachment 200066 [details] [review]
combo-box-menu-item: Propagate :insensitive state to the combo menu

(In reply to comment #6)
> Review of attachment 200060 [details] [review]:
> 
> A comment would be nice.

Sure.


> Besides that, should we propagate any other pseudo
> classes?

I was going to say 'no', but changed my mind while writing the comment. The pseudo classes relevant for PopupMenuItems are

 :open (specific to Submenus)
 :alternate (specific to AlternatingMenuItem)
 :active

So only the last one is relevant here, and it's a tricky case - just copying the style class is buggy: if the active item changes *after* hovering the ComboBoxMenuItem but *before* activating it, the popup menu ends up with two items being marked :active (:insensitive on the other hand is inherently safe, as the ComboBoxMenu cannot be triggered at all in that case).
Given that (at least at the moment) :active does not change anything that needs propagating, I had left it out originally. I figured that setActive() propagates the change correctly, so I've included it now - still, changes to e.g. the grab handling in setActive() may now have unintended side effects in the combo box, so I'd still consider leaving it out ...


> If so:
> 
>     activeItem.pseudo_class = this.sourceActor.pseudo_class;
> 
> is probably clearer.

I agree it's clearer - I originally did this, that's how I found the issue mentioned above.


Aaaanyway, I forgot to update the commit message, so if we decide to propagate :active after all, I know it'll need updating ;-)
Comment 8 Jasper St. Pierre (not reading bugmail) 2011-10-26 22:07:55 UTC
Review of attachment 200066 [details] [review]:

Looks good.
Comment 9 Florian Müllner 2011-10-26 22:46:48 UTC
Comment on attachment 200066 [details] [review]
combo-box-menu-item: Propagate :insensitive state to the combo menu

Speaking of "changes to grab handling in setActive() having unintended side effects" - it was only working because I was testing some (unrelated) patch ...

To fix, we'd need to do more than copying the style, less than setActive() ...
Comment 10 Florian Müllner 2011-10-27 11:35:55 UTC
Created attachment 200090 [details] [review]
combo-box-menu-item: Propagate pseudo classes to the combo menu

ComboBoxMenuItems use ClutterClones to reconstruct the active item
in the associated ComboMenu, so pseudo class changes due to state
changes of the ComboBoxMenuItem don't have the intended effect
(since the actual style information is taken from the associated
ComboBoxMenu item).
As a fix, propagate relevant pseudo class changes to the active
ComboBoxMenu item.
Comment 11 Jasper St. Pierre (not reading bugmail) 2011-11-05 21:03:04 UTC
Review of attachment 200090 [details] [review]:

I believe this went through IRC review, but I forget the outcome.
Comment 12 Florian Müllner 2011-11-15 12:55:50 UTC
Attachment 200055 [details] pushed as d20e646 - combo-box-menu-item: Propagate style changes to the combo menu
Attachment 200090 [details] pushed as b88657a - combo-box-menu-item: Propagate pseudo classes to the combo menu

(In reply to comment #11)
> I believe this went through IRC review, but I forget the outcome.

You requested some more comments.
Comment 13 Florian Müllner 2011-11-24 18:05:49 UTC
*** Bug 664746 has been marked as a duplicate of this bug. ***