widget: Don't assume opacity is 100%

... just because there is no style context instantiated yet. Instead,
instantiate a style context during realize() and ask it.

Fixes problems with dim labels not being dimmed on first show.

Testcase included.

https://bugzilla.gnome.org/show_bug.cgi?id=735240
This commit is contained in:
Benjamin Otte
2014-09-06 06:41:05 +02:00
parent 95959ef470
commit 9a8a4a8b14
5 changed files with 55 additions and 12 deletions

View File

@ -314,6 +314,9 @@ testdata = \
opacity.css \
opacity.ui \
opacity.ref.ui \
opacity-initial.css \
opacity-initial.ref.ui \
opacity-initial.ui \
overlay-no-main-widget.ref.ui \
overlay-no-main-widget.ui \
paned-undersized.css \

View File

@ -0,0 +1,3 @@
GtkLabel {
opacity: 0;
}

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.1 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkWindow" id="window1">
<property name="width_request">200</property>
<property name="height_request">100</property>
<property name="can_focus">False</property>
<property name="type">popup</property>
</object>
</interface>

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.1 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkWindow" id="window1">
<property name="width_request">200</property>
<property name="height_request">100</property>
<property name="can_focus">False</property>
<property name="type">popup</property>
<child>
<object class="GtkOverlay" id="overlay1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
<child type="overlay">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">I'm the invisible label.
Incredible how you can
see right through me.</property>
</object>
</child>
</object>
</child>
</object>
</interface>