Commit Graph

149 Commits

Author SHA1 Message Date
Giovanni Campagna
97f883b10e Implement "text-align"
"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
2010-06-25 22:43:14 +02:00
Florian Müllner
35764fa09e Move Tweener.slowDownFactor into St
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
2010-06-21 16:19:25 +02:00
Florian Müllner
04ecde9f8e [StButton] Cleanup left-over animation code
StButton used to animate hover changes - the animation itself was
removed in commit a4481b38d, but some related member variables were
left in place.
2010-06-21 00:01:05 +02:00
Dan Winship
cae61e62fd [StThemeNode] implement CSS "outline" property
Could potentially be used for focus indication

https://bugzilla.gnome.org/show_bug.cgi?id=621669
2010-06-17 14:06:47 -04:00
Dan Winship
792dc489ee [St] add st_describe_actor, for debugging
This can be used when adding debug printfs, to get clear descriptions of
actors.

Also update the Looking Glass inspector to use it

https://bugzilla.gnome.org/show_bug.cgi?id=621668
2010-06-17 12:48:13 -04:00
Maxim Ermilov
bbfc980fe6 add st_texture_cache_load_sliced_image
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
2010-06-14 19:36:55 +04:00
Florian Müllner
c0134067d7 [Transitions] Add error checking when setting up framebuffers
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.
2010-06-12 19:33:19 +02:00
Dan Winship
a4befeba53 De-duplicate "actor contains actor" code
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
2010-06-11 10:05:46 -04:00
Florian Müllner
49919acb7c [StyleTransition] Improve style changes during transitions
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
2010-06-10 04:06:13 +02:00
Marc-Antoine Perennou
0e91a213f5 [StThemeNodeTransition] Do not access CoglColor private members directly
We should not access CoglColor members directly since they are private starting with clutter 1.3.

Signed-off-by: Adel Gadllah <adel.gadllah@gmail.com>
2010-06-08 21:03:34 +02:00
Florian Müllner
0e40782723 [StWidget] Cancel transitions if duration is zero
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.
2010-06-08 20:37:38 +02:00
Florian Müllner
db45c0920b [StWidget] Support style transitions
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
2010-06-08 17:55:51 +02:00
Florian Müllner
d4a8c64d22 [StThemeNode] Add transition-duration CSS property
Add a CSS property to control style transitions.

https://bugzilla.gnome.org/show_bug.cgi?id=619025
2010-06-08 17:55:50 +02:00
Florian Müllner
0deffbaaf0 [St] Add StThemeNodeTransition
Introduce a small helper class in order to add transitions between
theme nodes to StWidget.

https://bugzilla.gnome.org/show_bug.cgi?id=619025
transition update
2010-06-08 17:55:50 +02:00
Florian Müllner
af3ca027a1 [StThemeNode] Add helper method to get the paint allocation
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
2010-06-08 17:55:41 +02:00
Florian Müllner
24a4ca0c6d [StThemeNode] Add a comparison function
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
2010-06-08 17:55:40 +02:00
Florian Müllner
cc163237cc [StEntry] Consider children when setting hover state
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
2010-06-02 23:21:13 +02:00
Florian Müllner
a433a1c637 [StThemeNode] Make shadows respect paint opacity
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
2010-05-25 23:03:15 +02:00
Florian Müllner
d05cf2445d [StWidget] Clean up private member variables
When moving the drawing code into StThemeNode, most private members
of StWidget became obsolete, so remove them.

https://bugzilla.gnome.org/show_bug.cgi?id=619025
2010-05-25 23:03:15 +02:00
Florian Müllner
f0645d468c [StGroup] Respect CSS sizing in size requests
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
2010-05-25 23:03:14 +02:00
Colin Walters
7bf748c579 [StTable] Align children to integral positions
Like the other St widgets, ensure we position children at integrals.

https://bugzilla.gnome.org/show_bug.cgi?id=619623
2010-05-25 11:21:34 -04:00
Colin Walters
04f33e8dc7 [StTable] Clamp children to integral positions 2010-05-25 11:00:50 -04:00
Colin Walters
47a92e7fc0 Don't treat min-width and min-height as a fixed size
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
2010-05-13 13:15:39 -04:00
Dan Winship
74ccdbf3a9 St: fix allocation to not use both wfh and hfw
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
2010-05-11 15:58:54 -04:00
Florian Müllner
014ac2d388 Support -st-shadow for all background properties
Extend the existing support for -st-shadow to apply to the background,
background-gradient and border properties in addition to background-image.

https://bugzilla.gnome.org/show_bug.cgi?id=613832
2010-05-10 20:17:20 +02:00
Florian Müllner
1e3bf0ea7e Add StGroup container
Currently if we want a stylable fixed-layout container, we use either
a Clutter.Group inside an St.Bin, or we abuse St.BoxLayout.

https://bugzilla.gnome.org/show_bug.cgi?id=613907
2010-05-10 19:59:28 +02:00
Florian Müllner
54d11b65a1 Move shared container methods from st-private to a common base class
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
2010-05-10 19:00:07 +02:00
Owen W. Taylor
75b52d36f2 Do something reasonable for width-for-height sizing
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
2010-05-10 11:41:23 -04:00
Florian Müllner
d6fc2cc36f [StEntry] Use hover support from StWidget
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.
2010-05-05 21:20:32 +02:00
Florian Müllner
b0ba40f812 Pick up system settings for font rendering
The appearance capplet has a tab for font settings, which we currently
ignore - pick up the settings for resolution, antialiasing and hint style.

https://bugzilla.gnome.org/show_bug.cgi?id=599713
2010-05-04 01:08:20 +02:00
Florian Müllner
50c453c54d [StShadow] Add support for spread radius
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
2010-05-03 19:38:07 +02:00
Dan Winship
95a6353dee [StWidget] respect CSS sizing in default size request
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
2010-04-06 08:19:35 -04:00
Dan Winship
cfea0649d8 remove some Big references from places that don't need them any more
https://bugzilla.gnome.org/show_bug.cgi?id=614516
2010-04-06 08:17:33 -04:00
Colin Walters
44ede8c942 Squash epic memory leak
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
2010-04-05 21:10:19 -04:00
Adel Gadllah
2ca5cfd6f5 StTable: Update row and column count in st_table_remove_actor
Adjust the table size when removing an actor in st_table_remove_actor.

https://bugzilla.gnome.org/show_bug.cgi?id=614144
2010-03-31 16:55:14 +02:00
Dan Winship
1dd4c7140e StBoxLayout: remove an incorrect drawing optimization
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
2010-03-29 14:36:36 -04:00
Dan Winship
4aa2473d18 initialize a variable that gcc warns about
https://bugzilla.gnome.org/show_bug.cgi?id=613749
2010-03-26 11:20:10 -04:00
Dan Winship
3f5bb8f98d StScrollView: fix scrollbar allocation when one scrollbar isn't shown
https://bugzilla.gnome.org/show_bug.cgi?id=613964
2010-03-26 11:05:54 -04:00
Florian Müllner
6deee27d14 [StThemeNode] Fix gradient colors
CAIRO_FORMAT_ARGB32 matches COGL_PIXEL_FORMAT_BGRA_8888_PRE on
little Endian.
2010-03-24 23:39:43 +01:00
Colin Walters
8d3abea6ef [StThemeNode] Fix build after rebase 2010-03-24 14:24:25 -04:00
Colin Walters
5060081db5 Move rendering into st-theme-node-drawing.c
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
2010-03-24 14:14:03 -04:00
Dan Winship
a8fa8a498a Fix dragging of App Well and Places icons
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.
2010-03-24 13:48:29 -04:00
Adel Gadllah
468f30e4ab Fix build on x86_64
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
2010-03-24 17:37:56 +01:00
Dan Winship
f9e4385e02 [StWidget] add (optional) hover tracking
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.
2010-03-24 10:03:50 -04:00
Dan Winship
909b5ec43c [StWidget] add list-like methods for style_class and pseudo_class
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
2010-03-24 09:40:37 -04:00
Dan Winship
7c37e94eda st-widget.h: fix spacing
https://bugzilla.gnome.org/show_bug.cgi?id=604943
2010-03-24 09:40:37 -04:00
Dan Winship
23e11175f8 St: minor gtk-doc fixage (%NULL, %TRUE, %FALSE, not #) 2010-03-23 19:56:10 -04:00
Dan Winship
57dd02f6ae fix a gtk-doc typo that giscanner was warning about 2010-03-23 11:28:25 -04:00
Maxim Ermilov
690deeb502 unref theme_node in st_widget_dispose
https://bugzilla.gnome.org/show_bug.cgi?id=612318
2010-03-17 23:44:20 +03:00
Colin Walters
b55fd735f4 [StTextureCache] Use size in all cases for cache keys
Otherwise we're going to be returning the wrong sized image to callers,
and Clutter.Texture will scale it, which will look awful.
2010-03-13 13:11:22 -05:00