Commit Graph

116 Commits

Author SHA1 Message Date
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
Florian Müllner
a0b5a44fe9 [StEntry] Make the cursor size stylable
Just as the cursor color can be styled using the "caret-color"
property, expose the cursor size as "caret-size".

https://bugzilla.gnome.org/show_bug.cgi?id=611095
2010-03-07 23:45:44 +01:00
Colin Walters
5ce1e3fe92 Add st_texture_cache_load_file_to_cogl_texture
For StWidget we want the ability to load raw CoglHandle references
rather than having a big pile of actors backing StWidget.

Several bits of StWidget expect to be able to synchronously load
textures; this is a crutch to support that until we can cleanly
make this asynchronous.

https://bugzilla.gnome.org/show_bug.cgi?id=607500
2010-03-05 17:08:36 -05:00
Colin Walters
22948b3d39 Merge St.TextureCache and Shell.TextureCache
Brute force merge these two by essentially replacing St.TextureCache
with a (renamed) Shell.TextureCache.

One function was added for convenience, namely "st_texture_cache_load_file_simple".
St.TextureCache had a function to load a texture from a filename, and it
returned NULL on error but only half the callers actually checked this.  This
function is better.

https://bugzilla.gnome.org/show_bug.cgi?id=607500
2010-03-05 16:19:40 -05:00
Dan Winship
f6b4fa6e7e [St] share common ClutterContainer implementation code
https://bugzilla.gnome.org/show_bug.cgi?id=611647
2010-03-04 15:41:25 -05:00
Owen W. Taylor
6423cbfc92 Fix problems on destruction
StScrollBar: Be robust against being disposed multiple times,
  which can happen, and in fact, normally happens when destroying
  the parent.

StScrollView: Implement remove() for the hscroll and vscroll members,
  and just destroy them in dispose() and let them be removed.
  unparent the shadows, instead of just unref'ing them directly.

https://bugzilla.gnome.org/show_bug.cgi?id=611203
2010-03-02 16:37:05 -05:00
Florian Müllner
b7c60b02d1 [StEntry] Add annotations
All setters in StEntry allow to pass NULL - add appropriate annotations.
2010-02-27 18:03:37 +01:00
Dan Winship
ef4c9b6f1f [StThemeNode] allow "background-gradient-direction: none"
this lets a more-specific CSS rule turn off the gradient inherited
from a less-specific rule

https://bugzilla.gnome.org/show_bug.cgi?id=610856
2010-02-23 14:44:57 -05:00
Maxim Ermilov
fc39919856 Add top and bottom shadows to app browser
Add a 'vshadow' property to StScrollView, which, when turned on,
overlays gradient shadows on the top and bottom of the StScrollView.

Turn this on for the StScrollView used for the app browser.
https://bugzilla.gnome.org/show_bug.cgi?id=609604
2010-02-23 01:12:13 +03:00
Colin Walters
fb9fd6925a [StScrollView] Fix incorrect assertion, defaults, and test case
The type we don't currently handle is _ALWAYS, my original use
of g_return_if_fail was wrong.

Also the default should be AUTOMATIC in the properties, not ALWAYS.

Finally the test case was still using the incorrect St.ScrollPolicy.

https://bugzilla.gnome.org/show_bug.cgi?id=609015
2010-02-22 12:06:56 -05:00
Colin Walters
18c5405b79 [StScrollView] Add support for GtkPolicyType for scrollbars
Previously we were hacking out the vertical scrollbar, this patch
allow us to sanely say in which directions we want to scroll.

Note this patch intentionally changes St to depend on GTK+ in the
API.  I believe this is a correct long term change where we should
view St as co-evolving with GTK+ rather than replacing or paralleling.

https://bugzilla.gnome.org/show_bug.cgi?id=609015
2010-02-19 15:37:40 -05:00
Dan Winship
721e1ea863 [St] Implement max-width/max-height in the CSS parser
st_theme_node_adjust_preferred_width/height now limit the content area
of an actor to the max, if given. (The requested width/height may be
larger to make room for borders, etc.)

https://bugzilla.gnome.org/show_bug.cgi?id=606755
2010-02-16 14:08:17 -05:00
Dan Winship
5331d3e360 [St] Make allocation handling more consistent
In StBin, StBoxLayout, and StTable, if a child has a potential
allocation that is larger than its preferred size, we give it its
preferred size instead. However, the corresponding
get_preferred_height/width methods were not making the same
assumption, which meant that if we had more width than the widget
wanted, we would allocate it its preferred width, but with the height
that corresponded to the larger width.

Fix this by defining new helpers _st_actor_get_preferred_width() and
_st_actor_get_preferred_height() and using them everywhere. Also, make
StBin and StTable use _st_allocate_fill() rather than having
nearly-identical duplicate copies of the code.

https://bugzilla.gnome.org/show_bug.cgi?id=609848
2010-02-16 14:06:39 -05:00
Dan Winship
f52744cfbc [StTable] fix x-align/y-align properties to be StAlign, not double
This puts it in sync with StBin and StBoxLayout

https://bugzilla.gnome.org/show_bug.cgi?id=609848
2010-02-16 14:06:39 -05:00
Florian Müllner
32e2ff7573 [StScrollbar] Allocate steppers according to size requests
The forward/backward steppers are always allocated a square region at the
scroll bar's ends. Change the allocation to be based on the steppers' size
requests instead.

https://bugzilla.gnome.org/show_bug.cgi?id=609401
2010-02-10 10:13:00 +01:00
Owen W. Taylor
dce4b2f325 Remove C99 use of non-constant initializers
To comply with C89, structure initializers should have
only constant values.

(Not a thorough check for this throughout the codebase, just
StWidget is fixed up in this commit.)

https://bugzilla.gnome.org/show_bug.cgi?id=608746
2010-02-08 14:04:45 -05:00