Commit Graph

231 Commits

Author SHA1 Message Date
Neil Roberts
d66e7dd49e st-theme-node-drawing: Don't create lots of one-shot materials
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
2010-10-28 20:02:41 +01:00
Giovanni Campagna
a915af4b30 Avoid warnings on leave-event for widgets tracking hover
ClutterCrossingEvent->related can be NULL if the pointer is not under
any actor. Unconditionally set hover to FALSE in that case.

https://bugzilla.gnome.org/show_bug.cgi?id=633028
2010-10-25 15:18:07 +02:00
Dan Winship
8886b7433c StThemeNode: simplify use of get_color/get_double/get_length
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
2010-10-21 15:02:33 -04:00
Dan Winship
33e955770c st_theme_node_get_color: fix inheritance
This wasn't actually recursing if you passed the "inherit" flag

https://bugzilla.gnome.org/show_bug.cgi?id=632590
2010-10-21 09:13:30 -04:00
Ray Strode
a5d4abda00 st-theme: ref items in custom stylesheets list
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
2010-10-18 15:52:38 -04:00
Florian Müllner
42c736614c st-drawing-area: Avoid unnecessary repaints
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
2010-10-15 12:31:34 +02:00
Florian Müllner
3d2d396c09 st-theme-node: Support non-uniform border-radii
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
2010-10-05 00:18:49 +02:00
Adel Gadllah
1413fa6e03 Revert "StThemeNodeTransition: work around Cogl bug"
This reverts commit 8f0f159960.

Cogl has been fixed, so it is no longer needed.

https://bugzilla.gnome.org/show_bug.cgi?id=629616
2010-09-24 17:31:41 +02:00
Dan Winship
a6e4bab990 Add symbolic icons to TextureCache's load_icon_name()
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
2010-09-24 10:57:27 -04:00
Owen W. Taylor
8f0f159960 StThemeNodeTransition: work around Cogl bug
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
2010-09-23 12:44:07 -04:00
Florian Müllner
652ce3ce8c introspection: Fix annotations
The scanner got more strict, now some annotations need fixing.
2010-09-15 03:02:26 +02:00
Adel Gadllah
25f907ffb1 St: Use a local material template
To be consistent with what we do with the shadow
material, use the same pattern in setup_framebuffer().
2010-09-14 00:00:34 +02:00
Florian Müllner
1034798969 st-shadows: Use a template material when creating shadows
To avoid recompiling shadows each time a new shadow is created,
use a copy of a static template material.

See http://bugzilla.clutter-project.org/show_bug.cgi?id=2280#c5.

https://bugzilla.gnome.org/show_bug.cgi?id=629383
2010-09-13 18:11:03 +02:00
Florian Müllner
862f1ea18c st: Use template material for transitions
To avoid compiling a new shader each time a transition is started,
use a copy of a static template material.

See http://bugzilla.clutter-project.org/show_bug.cgi?id=2280#c5.

https://bugzilla.gnome.org/show_bug.cgi?id=629384
2010-09-13 17:50:05 +02:00
Maxim Ermilov
4f61f9a43d remove scrollbar-[width/height]
1. They are useless
2. We can get its value from get_preferred_[width/height] in StScrollBar
https://bugzilla.gnome.org/show_bug.cgi?id=624893
2010-09-10 05:57:36 +04:00
Maxim Ermilov
d6995194dd add get_preferred_[width/height] to StScrollBar
https://bugzilla.gnome.org/show_bug.cgi?id=624893
2010-09-10 05:57:15 +04:00
Maxim Ermilov
ab25b8ab69 change parent class of StScrollBar from StBin to StWidget
1. It doesn't have child
2. It work like StWidget without child
https://bugzilla.gnome.org/show_bug.cgi?id=624893
2010-09-10 05:56:07 +04:00
Maxim Ermilov
178c8c50a0 Fix build with recent gtk3
use new keysyms names
https://bugzilla.gnome.org/show_bug.cgi?id=629128
2010-09-09 18:34:09 +04:00
Colin Walters
dddd97f6df introspection: Build with --warn-all --warn-error
* 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
2010-09-07 13:07:52 -04:00
Florian Müllner
a243ba6693 [StLabel] Implement text-shadow property
Use the existing shadow code to add a drop shadow to the underlying
ClutterText actor if the text-shadow property is specified.

https://bugzilla.gnome.org/show_bug.cgi?id=624384
2010-09-02 21:49:59 +02:00
Florian Müllner
ba1da9deb9 [StThemeNode] Make shadow helper functions semi-public
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
2010-09-02 21:49:59 +02:00
Florian Müllner
29781b2e5c [StThemeNode] Add text-shadow property
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
2010-09-02 21:49:59 +02:00
Florian Müllner
e942444630 [StShadow] Add reference counting
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
2010-09-02 21:49:59 +02:00
Adel Gadllah
9f9067e29b [StThemeNode] Add basic background-position support
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
2010-09-01 18:13:43 +02:00
Owen W. Taylor
5e7c25e136 Notice style transitions that don't change how StThemeNode paints
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
2010-08-30 13:40:12 -04:00
Florian Müllner
5bd977dd3c [transitions] Do not recreate FBOs on opacity changes
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
2010-08-23 18:41:34 +02:00
Florian Müllner
766b5b801c [St] Remove _st_actor_contains()
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
2010-08-10 15:03:13 +02:00
Florian Müllner
0905940ef8 [StContainer] Add :first-child, :last-child pseudo classes
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
2010-08-05 19:05:18 +02:00
Adel Gadllah
7fa9e88294 [St] Remove unused width/height from st_theme_node_transition_paint
We query the texture size here but never actually use it.

https://bugzilla.gnome.org/show_bug.cgi?id=625713
2010-08-01 12:10:53 +02:00
Adel Gadllah
b237cf9a63 Use CoglHandle rather than CoglHandle*
This breaks building on 1.4, and has always been wrong anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=624571
2010-07-26 21:55:25 +02:00
Florian Müllner
02ebd44851 [shadows] Fix shadows with small blur radius
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.
2010-07-25 00:37:12 +02:00
Dan Winship
1b03d5cb45 [St] fix a bug noticed by gcc -O3
https://bugzilla.gnome.org/show_bug.cgi?id=623295
2010-07-12 14:24:16 -04:00
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
Florian Müllner
46f8d913a1 [StTextureCache] Fix an accidentally swapped ref/unref 2010-03-11 21:42:32 +01:00
Owen W. Taylor
89173544d4 Simplify handling of adjustments
The relationship between adjustments and scrollbars and
scrollable widgets was much more complex than it needed to be.

StScrollView: Have the scroll view own a pair of adjustments,
  set them on the child on add(), remove unnecessary
  change notification signal connections.
StBoxLayout: Remove auto-create of adjustments, just take the
  adjustments from the scrollbars and set them on the scrollable
  child. Notify for hadjustment/vadjustment properties.
StScrollBar: Notify adjustment property.
StScrollable: Document how adjustment setting works.

https://bugzilla.gnome.org/show_bug.cgi?id=611740
2010-03-11 15:08:48 -05:00
Owen W. Taylor
163b2d0403 Fixes for dispose and finalize
* Add missing chain-up for dispose and finalize methods
* ShellGenericContainer needs to destroy its children in dispose()
* Fix variable naming and excess casts in st_label_dispose()

https://bugzilla.gnome.org/show_bug.cgi?id=612511
2010-03-11 15:08:48 -05:00
Owen W. Taylor
c83883f1f7 Fixes for setting up scrolling adjustments
StScrollable: Document how to set adjustments
StBoxLayout: Make sure that we always have upper >= lower + page_size,
  so that clamping works properly. Set the page_increment to be slightly
  less than the page_size so there is some overlap, as is customary.
StScrollView: Remove unnecessary fabs() calls, rewrite expressions
  for additional clarity.

https://bugzilla.gnome.org/show_bug.cgi?id=611740
2010-03-11 15:08:48 -05:00
Owen W. Taylor
f6cbb14393 Incremental fixes for scrollview work
- Fix existing typos and spacing problems
- Get preferred height, not current height, of shadows
- Let shadows overflow don't clamp them when we have too little space
- Remove a now-unecessary stray MAX()
- Fix up scrollview visibility for the pathological case of no child
- Disconnect from adjustments on remove()
- Don't unset the adjustments on the child on remove(), since they
  already existed or were autocreated on add()

  (We should what we are doing and set the adjustments of the
  scrollbars on the child rather than setting the adjustments of
  the child, so we match GTK+'s scrolllable interface, but this
  at least makes it consistent instead of a weird mix.)

https://bugzilla.gnome.org/show_bug.cgi?id=611740
2010-03-11 15:08:48 -05:00
Owen W. Taylor
ffd25fe9e4 Fix size negotiation for StScrollView
StScrollable: Document how size negotation now works between the
  parent and scrollable child.

StBoxLayout: Adapt to the new contract for how size negotiation
  works; in particular, handle being allocated less than the
  minimum size when scrolled and treat the minimum size as the
  size of the scrolled area in instead of the natural size.

StScrollView: Substantially rewrite with fixes including:
 - Implement new size negotation contract; this allows us
   to determine scrollbar visibility without having to
   connect to the adjustment.
 - Implement all ALWAYS along with the existing NEVER/AUTO
 - When hiding and showing scrollbars and shadows, don't
   hide and show widgets, just turn on and off including them
   in pick and paint. This avoids queueing relayouts.
 - Cleanups for the code for connecting to adjustments,
   for changing policy, and for turning on and off shadows.

scroll-view-sizing.js: New test case for StScrollView, allowing
  resizing the scroll view interactively, changing the scrollbar
  policies and turning shadows on and off.

https://bugzilla.gnome.org/show_bug.cgi?id=611740
2010-03-11 15:08:48 -05:00
Owen W. Taylor
524e2ca8e2 [StScrollBar] avoid queueing a relayout during allocation
When an StScrollView is allocated, allocating the child would
cause the adjustment values to change, which would result in
the scrollbars queueing a relayout, which isn't allowed during
allocation.

To avoid this, instead of queueing a relayout when the adjustment
changes:

 - When we have a valid allocation already, just go ahead
   and reallocate the children.
 - Otherwise do nothing immediately and wait until we get allocated

Because the 'needs_allocation' flag in ClutterActor isn't exposed,
this requires some slightly ugly code to shadow that state locally.

https://bugzilla.gnome.org/show_bug.cgi?id=611944
2010-03-11 15:08:48 -05:00
Owen W. Taylor
33dca51650 Rework StDrawingArea not to use ClutterCairoTexture
Having StDrawingArea use ClutterCairoTexture causes circularity
problems with sizing - StDrawingArea wants to use its allocation for
the size of the texture, but ClutterTexture wants to use the size of
the texture to determine the requited size.

Avoid this by making StDrawingArea directly use Cairo and CoglTexture;
while doing this, the API is changed a bit for simplicity and to
match our use case:

 - Instead of clutter_cairo_texture_create(), we have
   st_drawing_area_get_context() to retrieve an already created
   context. This can only be called in the ::repaint signal.

 - The ::redraw signal is changed to ::repaint so we can have
   st_drawing_area_queue_repaint() that doesn't collide with
   clutter_actor_queue_redraw()

 - ::repaint is now emitted lazily when painting the actor rather
   than synchronously at various different points.

https://bugzilla.gnome.org/show_bug.cgi?id=611750
2010-03-11 15:08:48 -05:00
Owen W. Taylor
58bb0044b2 Support and require Clutter 1.2
- Specify a minimum version of clutter-1.2.0
 - Switch clutter branch in the moduleset to master
 - Replace deprecated cogl_texture/material_unref() with
   cogl_handle_unref()
 - Use cogl_clip_push_rectangle() rather than cogl_clip_push()
 - Replace cogl_check_extension() with strstr - should be
   accurate enough.

https://bugzilla.gnome.org/show_bug.cgi?id=610679
2010-03-11 15:08:48 -05:00
Adel Gadllah
730e8ffdf9 Add get_horizontal/vertical_padding() methods
Add get_horizontal_padding() and get_vertical_padding() methods,
that return the total padding (LEFT+RIGHT or TOP+BOTTOM).

https://bugzilla.gnome.org/show_bug.cgi?id=597983
2010-03-11 18:04:37 +01:00
Dan Winship
d128cc5af3 st_widget_get_theme_node: g_error if called on an unparented widget
It's wrong to do anything that requires looking up a widget's style
before you add the widget to the stage, since its final style may
depend on properties inherited from its parents.
st_widget_get_theme_node() used to emit a warning in this case, but
many would-be contributors apparently didn't notice. Help them out.

https://bugzilla.gnome.org/show_bug.cgi?id=610279
2010-03-10 09:29:48 -05:00
Colin Walters
e752193a54 [StTextureCache] The requested size needs to be part of the cache key
Otherwise we'll only render it once, which is clearly wrong.
2010-03-09 14:08:22 -05:00
Colin Walters
3333f30c42 Convert border_width, border_radius to integers
This saves the consumers from having to deal with rounding.

https://bugzilla.gnome.org/show_bug.cgi?id=607500
2010-03-08 16:46:47 -05:00
Colin Walters
a4481b38d2 Remove st_widget accessors for background and border actors
StButton animated the background for button transitions; since these aren't
presently part of the shell design, simply remove them.  We can readd
these in the future.

StTooltip should probably have :vertical and :horizontal pseudo classes
to make the arrow work but it should still function.

https://bugzilla.gnome.org/show_bug.cgi?id=607500
2010-03-08 16:28:34 -05:00
Colin Walters
176487834a Add st_texture_cache_load
Function for caching texture data from an arbitrary origin.

https://bugzilla.gnome.org/show_bug.cgi?id=607500
2010-03-08 15:50:59 -05:00
Colin Walters
394e01850b Rework internals to be string based
Rather than having ShellTextureCache know about the type of each
item it's caching, this lays the foundation for simply caching
arbitrary string -> CoglHandle.

https://bugzilla.gnome.org/show_bug.cgi?id=607500
2010-03-08 15:10:35 -05:00
Florian Müllner
5f8391314a Add hover style property
Set the entry's pseudo class to "hover" when the pointer enters the
inactive widget and reset it appropriately on leave.

https://bugzilla.gnome.org/show_bug.cgi?id=611095
2010-03-08 19:33:12 +01:00
Thomas Wood
d593877548 fix issues with hint text
Add a "hint_visible" private variable to keep track of when the hint text
is visible. Use this to determine whether to return the text from the
internal ClutterText or whether to return an empty string.

Fixes: http://bugzilla.moblin.org/show_bug.cgi?id=6837
       http://bugzilla.moblin.org/show_bug.cgi?id=6836

https://bugzilla.gnome.org/show_bug.cgi?id=611095
2010-03-08 19:33:11 +01:00