Add st_texture_cache_load_icon_name_for_theme() which, when loading a
symbolic icon, gets a #StIconColors from the theme node and uses that
to colorize the icon.
https://bugzilla.gnome.org/show_bug.cgi?id=633865
A new StIconColors object is used to efficiently track the colors
we need to colorize a symbolic icon.
st_theme_node_compute_icon_colors() is added to compute the
StIconColors for a theme node. (Refcounting of StIconColors means
that we'll typically share the colors object of the parent node.)
https://bugzilla.gnome.org/show_bug.cgi?id=633865
Scaling up icons from the loaded size to a larger size is uniformly
ugly and results in a long series of "fuzzy icon" bugs. It's better
to just load at the specified size and center. (Centering can be
overridden by packing not-fill in the parent container.)
https://bugzilla.gnome.org/show_bug.cgi?id=633865
We don't want the layout to change when we say, change from
battery-full to battery-full-charging, so we should request a square
based on the icon size unconditionally and not try to adapt to the
size of the texture we loaded. This also means that our layout is
independent of the loaded texure which, if we switch away from
using a ClutterActor child will allow us not queue a relayout when
the icon finishes loading.
https://bugzilla.gnome.org/show_bug.cgi?id=633865
Make StIcon compile and work in St.
Changes:
* ::icon-type and st_icon_set_icon_type are added to allow
specifying SYMBOLIC/FULLCOLOR for an icon.
* Ability to set the icon name from the theme is removed; it
wouldn't easily fit into our framework and two levels of
abstraction between code and image doesn't seem that useful.
* size CSS property is renamed from x-st-icon-size to icon-size
to correspond to what we are doing elsewhere.
* CSS and property based icon sizing are cleanly layered - if
you set the icon-size property, the CSS size is ignored.
* Add a simple JS test of StIcon.
https://bugzilla.gnome.org/show_bug.cgi?id=633865
StIconType will be used by a new StIcon class, so move it to the
header file of common enumerations. Including st-types.h which had
the St single-include check revealed that st-texture-cache.h didn't
have that check and several places were including that directly.
Fix that up.
https://bugzilla.gnome.org/show_bug.cgi?id=633865
The ability to set a "content image" on an icon relies on the ability
to have custom theme properties of a "border image" (9-slice) type.
We don't have this, and the capability of a bordered image specified
by the theme can be achieved more naturally with standard CSS facilities.
https://bugzilla.gnome.org/show_bug.cgi?id=633865
* Make sure all source files have a LGPL copyright header, and standardize
non-standard variations of the header to a common form.
* Check and update all copyright notices.
* Remove 'Written By:' lines. They are universally incomplete and
typically indicate only who started a particular file.
https://bugzilla.gnome.org/show_bug.cgi?id=634550
We weren't properly nulling out the vadjustment variable in dispose()
which meant in the case of explicit-destroy followed some time later
by garbage collection and disposing the actor again we would crash.
Use StWidget:track-hover rather than doing it ourselves. Don't assume
that hover is always TRUE after an enter_event or FALSE after a
leave_event, since we have a pointer grab and will be getting other
actors' events.
Don't ungrab the pointer when it leaves the button, since that
destroys the whole point of getting a grab in the first place.
Only consider the button to have been clicked when it has both grab
(meaning the mouse was pressed over the button) and hover (meaning the
mouse was released over the button).
Also remove the virtual pressed/released methods, which weren't being
used anyway.
https://bugzilla.gnome.org/show_bug.cgi?id=633853
Add StWidget:can-focus, st_widget_navigate_focus(), and
st_container_get_focus_chain(), and implement as needed to allow
keyboard navigation of widgets.
https://bugzilla.gnome.org/show_bug.cgi?id=621671
In d66e7dd49 I got confused between border_texture and
background_texture. The background_texture was being created as normal
but in the one place that it gets drawn I accidentally made it use the
border_material instead. This patch makes it create a
background_material similar to the border_material and uses it to
paint.
A few places in st-theme-node-drawing create one-shot material, paint
with it and then free it. This is suboptimal with current Cogl because
it will end up compiling an ARBfp program just for that single paint
and then it will throw it away when the material is destroyed.
There is a new function in st-private.c called
_st_create_texture_material. This creates a simple material for a
texture based on a common parent material that points to a dummy
texture. Any materials created with this function are likely to be
able to share the same program unless the material is further modified
to contain a different number of layers. It would be possible to use
cogl_set_source_texture for this instead except that it's not possible
to modify the material's color in that case so we couldn't render the
texture with opacity.
The corner textures are now stored as a handle to a material that
references the texture rather than storing the texure directly. There
is also a separate border_material member which always points to
border_texture as the only layer.
https://bugzilla.gnome.org/show_bug.cgi?id=633340
Although within St itself there are situations where the semantics of
these functions (return TRUE or FALSE and return the actual value in
an out parameter) is useful, it's mostly just annoying at the
application level, where you generally know that the CSS property is
going to specified, and there is no especially sane fallback if it's
not.
So rename the current methods to lookup_color, lookup_double, and
lookup_length, and add new get_color, get_double, and get_length
methods that don't take an "inherit" parameter, and return their
values directly. (Well, except for get_color, due to the lack of (out
caller-allocates) in gjs.)
And update the code to use either the old or new methods as appropriate.
https://bugzilla.gnome.org/show_bug.cgi?id=632590
st-theme stores some loaded stylesheets in a custom
stylesheets list. When removing items from this list
it unrefs them, but when adding items to the list it
neglects to ref them. This means that under certain
circumstances the list will contain items that have
already been freed.
https://bugzilla.gnome.org/show_bug.cgi?id=632477
StDrawingArea uses the member variable needs_repaint to keep track
of whether it needs repainting. The variable is set to TRUE correctly,
e.g. on allocation or style changes - alas, it is never set to FALSE,
resulting in the area being repainted continuously.
https://bugzilla.gnome.org/show_bug.cgi?id=632197
Non-uniform border-radii are already supported when using a gradient
background, this patch adds support for solid colors as well.
The currently applied technique of using corner textures and filling
the remaining area with rectangles is extended, so that each corner is
padded with rectangles to the size of the largest corner.
Add border-radius.js to test cases, to test non-uniform border-radii
with both solid color and gradient backgrounds.
https://bugzilla.gnome.org/show_bug.cgi?id=631091
Icons can be loaded as St.Icon.SYMBOLIC, FULLCOLOR, APPLICATION or
DOCUMENT. The first will look for a symbolic equivalent, the second
looks for a full-color version (and does fallback, eg, from
"drive-harddisk-usb" to "drive-harddisk"). APPLICATION and DOCUMENT do
full-color icons without fallback (as specified by the icon spec).
And update various callers to use the right flags.
Based on a patch from Matt Novenstern.
https://bugzilla.gnome.org/show_bug.cgi?id=621311
Switch to using the layer combine constant rather than the material
primary color for representing the opacity of the material; this
avoids triggering a Cogl bug where changing the primary color corrupts
the layer state.
https://bugzilla.gnome.org/show_bug.cgi?id=629616
* Use --warn-all, --warn-error
* Fix various broken gtk-doc
* Drop unused shell_get_event_related
* For header defines, we currently require them to end in _H to be skipped
* Drop the no-longer-necessary fix-meta-rectangle.py hack
* Move to the convention of using -private.h for headers that are,
well, private.
* Add shell-wm-private.h
Move shadow helper functions from st-theme-node-drawing to st-private
to make them available to widgets which want to add shadows to internal
actors.
Also add a new helper function for creating the shadow material from a
ClutterActor.
https://bugzilla.gnome.org/show_bug.cgi?id=624384
Reorganize the existing code which parses the -st-shadow property
to allow parsing different shadow properties and add support for
the text-shadow property.
https://bugzilla.gnome.org/show_bug.cgi?id=624384
If a shadow property is inherited from a parent, multiple StThemeNodes
share a common StShadow. It would be possible to use st_shadow_copy()
for this purpose, but proper reference counting is nicer.
https://bugzilla.gnome.org/show_bug.cgi?id=624384
Add basic support for background-position, which only supports absolute
values.
Also don't require an unit to be specified for 0 (because the unit does not
really matter here 0 is 0 regardless of the unit).
https://bugzilla.gnome.org/show_bug.cgi?id=624375
Add st_theme_node_paint_equal() and use that to do two things:
1) Avoid animating transitions where nothing changes.
2) Copy cached painting state from the old theme node to the new
theme node.
https://bugzilla.gnome.org/show_bug.cgi?id=627083
Creating an FBO may be expensive, so we should avoid the operation
if possible. When transitioning between theme nodes, the widget's
opacity is used to paint to the offscreen textures which are blended
together - this means that the textures have to be recreated each time
the widget's opacity changes. It is much more effective to paint the
textures at full opacity and respect the widget's paint opacity when
blending the textures together.
https://bugzilla.gnome.org/show_bug.cgi?id=627085
The function has been upstreamed as clutter_actor_contains() - with
the switch to clutter-1.4 it is now available to the Shell, so it
is no longer necessary to keep a copy in-tree.
https://bugzilla.gnome.org/show_bug.cgi?id=626512
Add support for the CSS :first-child and :last-child properties to
StContainer, and thus to all containers in St and ShellGenericContainer.
The internal ordering of the container's children is used to determine
the child to which to attach the pseudo class, not the children's
positions. This means that containers where positions can differ from
the ordering (ShellGenericContainer / StGroup) may behave unexpectedly,
so some caution is required.
https://bugzilla.gnome.org/show_bug.cgi?id=625316
There's an assertion in calculate_gaussian_kernel() to avoid a division
by zero - due to an unnecessary cast from float to int this assertion
is triggered incorrectly for small (but non-zero) values, e.g. a blur
radius of 1px.
"text-align" allows setting the alignment of text, with respect to
other lines and allocated space, without requiring a reference to
the ClutterText (which is private for most widgets).
If not specified, all text is left-aligned.
https://bugzilla.gnome.org/show_bug.cgi?id=622447
It has probably crossed the line to evil by a mile or so, but here
it is: a Tweener.slowDownFactor replacement used by all animations
without exception.
While at it, update Tweener to use the new setTimeScale() upstream
function instead of adjusting the timeline directly.
https://bugzilla.gnome.org/show_bug.cgi?id=622249
This function reads a single image file which contains multiple
images internally.
The image file will be divided using @grid_width and @grid_height;
note that the dimensions of the image loaded from @path
should be a multiple of the specified grid dimensions.
https://bugzilla.gnome.org/show_bug.cgi?id=598349
The framebuffer setup code can fail, e.g. when the texture used as
color buffer has a height/width of 0. In that case, the call to
cogl_pop_framebuffer() will crash the shell trigger an assert. Add
error checking to fail gracefully.
Add _st_actor_contains() in st-private for use within St, and
monkey-patch in a Clutter.Actor.contains() for use by javascript, and
then replace all the duplicate implementations with one or the other
of those.
https://bugzilla.gnome.org/show_bug.cgi?id=621197
Our behavior of reversing the animation when the widget's style
changes back to the previous one is sound. On the other hand, when
there's a change to a new style while a transition is active, we
simply cancel the ongoing transition. Updating the transition
correctly so that the new one starts from an intermediate state
is hard.
Nevertheless, if the style changes before any time of the transition
has elapsed, we should do better than the current behavior.
https://bugzilla.gnome.org/show_bug.cgi?id=621140
The current code only sets up / updates transitions when the new
node's transition-duration is non-zero. It should cancel an
existing transition if the duration is 0.
It is sometimes desirable to fade smoothly between two styles
instead of changing it abruptly.
Add transitions controlled by the transition-duration CSS property.
https://bugzilla.gnome.org/show_bug.cgi?id=619025
StThemeNodes may have properties - namely shadows - which paint
outside an actor's allocation. This is not a problem unless drawing
is redirected to an offscreen buffer, in which case the actually
painted size is needed in advance when setting up the buffer.
Add a convenience method to calculate an allocation large enough to
paint the node.
https://bugzilla.gnome.org/show_bug.cgi?id=619025
Add st_theme_node_equal() - two nodes are considered equal iff they
refer to identical elements, so e.g. .example and .example:hover are
not equal, even if no .example:hover rule exists in the CSS.
https://bugzilla.gnome.org/show_bug.cgi?id=619025
When hovering over the entry's ClutterText, the entry itself
currently receives a leave event and updates the hover state.
Apply the same logic as StWidget itself to treat children as
part of the entry.
https://bugzilla.gnome.org/show_bug.cgi?id=620381
Currently shadows disregard the overall opacity, so e.g. setting
an ancestor's opacity does not effect the shadow. Fix this by
deferring the setting of the shadow's color until it is painted.
Also move duplicated drawing code from st_theme_node_paint() into
its own function.
https://bugzilla.gnome.org/show_bug.cgi?id=619083
Currently the size of an StGroup depends exclusively on the group's
children - it should be possible to override this behaviour with
fixed values in the CSS.
https://bugzilla.gnome.org/show_bug.cgi?id=613907
I have no idea why there existed code that if we saw e.g. min-width
without a width, we assigned min-width to ->width, thus effectively
treating it as a maximum.
Just delete that bit.
https://bugzilla.gnome.org/show_bug.cgi?id=618482
Passing an explicit width in the wfh case or a height in the hfw case
messes up the request caching, and confuses actors that assume they
won't be called with an explicit width/height unless they're being
allocated along the other axis.
https://bugzilla.gnome.org/show_bug.cgi?id=618295
Add StContainer, which implements the ClutterContainer interface based
on the container methods in st-private and make the existing containers
subclass it.
https://bugzilla.gnome.org/show_bug.cgi?id=613907
The StTable code only supports height-for-width. When called in
width-for-height sizing mode, instead of treating the -1 flag
value of 'for_width' as a real width, and requesting all the
children at 1 pixel wide, use the natural width of the table
as the width for determing the height.
Since we can't rewrap in width-for-height mode, we then report
the natural width also as the minimum width of the table.
https://bugzilla.gnome.org/show_bug.cgi?id=618104
As StEntry handles hover differently depending on whether it is
activated or not, the generic hover support in StWidget is
insufficient. Nevertheless it makes sense to set the hover status
using StWidget methods instead of setting the pseudo class directly.
The (optional) spread radius allows to make the shadow bigger without
enlarging the blur value. Mozilla supports this parameter for the
-moz-box-shadow property.
https://bugzilla.gnome.org/show_bug.cgi?id=613832
Most subclasses override get_preferred_width/height, but if they don't
(eg, StDrawingArea), then make sure they still take CSS-specified
sizes into account.
https://bugzilla.gnome.org/show_bug.cgi?id=614516
StThemeNode holds a reference to its parent, but we never released
that reference. This could cause us to hold onto whole chains
of theme nodes with rather dire memory usage implications.
Also move the other g_object_unref into _dispose.
https://bugzilla.gnome.org/show_bug.cgi?id=614660
Paint/pick all children, regardless of whether or not they lie within
the content_box. The previous behavior was that a child that was 99%
outside the box would be fully visible, but a child that was 100%
outside the box would be fully hidden. This is somewhat odd, and
doesn't match the behavior of the other St container classes, and at
any rate, the use of clutter_actor_get_allocation_box() for this
optimization was incorrect since it doesn't take into account
transformations (anchor point, rotation, etc) that might cause the
child to be drawn within the content_box anyway.
(For scrolled StBoxLayouts, drawing is still clipped to the
content_box, as before, but will now properly take transformations
into account as well.)
https://bugzilla.gnome.org/show_bug.cgi?id=614047
The idea behind this move is that we have a lot more control over
rendering if StWidget isn't a big pile of actors, and things are
more efficient.
https://bugzilla.gnome.org/show_bug.cgi?id=607500
The hover rewrite added a freeze/thaw_notify to
st_clickable_leave_event() (to match the one already in
st_clickable_enter_event()), which broke code in two places that
assumed "pressed" would still be TRUE when "hover" changed to FALSE.
Fix that by exposing the "held" property as well.
A pointer does not equal to an int on x86_64
(which results into pointer - pointer not being an int either),
fix that by casting the resulting value to an int.
Breakage was introduced by commit 909b5ec43c
If track-hover is set, update the hover property automatically, and
the "hover" pseudo class to match, as StClickable used to do. (Remove
the corresponding code in StClickable). Tweak the tooltip handling to
use track-hover, which also makes it slightly more reliable in the
presence of reactive children, etc.
Since style_class and pseudo_class are space-separated lists of names,
add new methods to add and remove individual names rather than just
re-setting the entire name.
Update existing code to use the new pseudo-class methods where
appropriate. In some cases, this may result in actors having multiple
pseudoclasses where previously they only had one at a time, but there
don't seem to be any visible differences.
(There are some places that could usefully use the new style_class
methods as well, but this patch doesn't change them.)
Also, update test-theme.c to test the new methods.
https://bugzilla.gnome.org/show_bug.cgi?id=604943