Commit Graph

224 Commits

Author SHA1 Message Date
Owen W. Taylor
c546ad9720 Fix for gdk/x11 changes
Handle the move of gdk_window_lookup() and gdk_window_foreign_new()
into the gdk_x11_ namespace.
2010-12-22 16:26:08 -05:00
Giovanni Campagna
23f3af832c StIcon: fix typo
After having freed pending_texture, we should nullify it, not an
unrelated actor.
2010-12-21 22:54:27 +01:00
Colin Walters
bdfc516715 StTextureCache: Plug leaks in tiled image loading
We weren't freeing the whole pixbuf, nor were we the GList of
subpixbufs.  Plug both of these leaks in the error handling path
and in the default case.

All of the unreffing/cleanup should happen in the GDestroyNotify
for the result, not some in the handler.

https://bugzilla.gnome.org/show_bug.cgi?id=636489
2010-12-18 13:44:37 -05:00
Florian Müllner
cb5c18c783 st-theme-node: Support non-uniform border widths
While non-uniform border widths were parsed correctly, an arbitrary
side's width was picked when painting, so that each border ended up
with the same width and the widths specified in CSS were ignored.

At least for sides between non-rounded corners, using a different
border width can be reasonable, for instance at screen edges.

Different border widths around rounded corners are kind of crack,
but then it would be lame not to support it ...

https://bugzilla.gnome.org/show_bug.cgi?id=607500
2010-12-13 18:15:00 +01:00
Florian Müllner
cb2babb1a0 st-theme-node: Improve borders with gradient backgrounds
For gradient backgrounds, borders were implemented by filling the
background shape with the border color first, and then scaling down
the path to draw the background.

The result is not correct[0], which is especially visible if the border
width is greater than the border radius - so instead of scaling down
the original path, use a separate path for the background.

The result is consistent with the borders we draw for non-gradient
backgrounds, and much closer to the correct standard behavior.

[0] http://www.w3.org/TR/css3-background/#the-border-radius

https://bugzilla.gnome.org/show_bug.cgi?id=607500
2010-12-13 18:15:00 +01:00
Ray Strode
c648a5f117 StThemeNode: handle url() in inline styles better
non-absolute paths specified as url()'s in
stylesheets are resolved to be relative to the location
of the stylesheets they are in.

Inline styles don't have physical styleshseets sitting on disk,
which leads to a crash in the url resolving code.

This commit ensures that we don't try to use the stylesheet associated
with a url, if there isn't one to use.

This commit doesn't try to handle relative paths in inline styles.
It only prevents crashes when absolute paths are used.

https://bugzilla.gnome.org/show_bug.cgi?id=636975
2010-12-13 11:48:36 -05:00
Giovanni Campagna
a2528a7a98 StIcon: fill the structure corretly in _init
GSlice already fills with zeros when allocating, but we need to
set the shadow_material field appropriately.

https://bugzilla.gnome.org/show_bug.cgi?id=634814
2010-12-09 22:27:32 +01:00
Giovanni Campagna
2332e2b0c5 StIcon: remove implementation of ::map and ::unmap
They're not needed since Clutter 1.5.8, which internally
keeps a list of children, used by the default implementations of
::map and ::unmap.

https://bugzilla.gnome.org/show_bug.cgi?id=634814
2010-12-09 22:27:11 +01:00
Giovanni Campagna
a70f1f449b StIcon: don't show the icon until fully loaded
When updating the texture, keep the old one until the new one is
loaded.

https://bugzilla.gnome.org/show_bug.cgi?id=634814
2010-12-09 17:59:28 +01:00
Owen W. Taylor
d870fef122 StBoxLayout: report correct paint volume when scrolled
When scrolled, st_box_layout_apply_transform() includes the scroll
offset and affects paint volumes. This is right for our children, but
our paint volume is determined by our allocation and borders and
doesn't scroll, so we need to reverse-compensate, the same as we do
when painting.

https://bugzilla.gnome.org/show_bug.cgi?id=630932
2010-11-29 11:23:47 -05:00
Owen W. Taylor
6b723ed72a StImText: add get_paint_volume()
Since StImText isn't a StWidget, it needs it's own implementation
of get_paint_volume() to enable clipped redraws.

https://bugzilla.gnome.org/show_bug.cgi?id=630932
2010-11-29 11:23:47 -05:00
Adel Gadllah
56fb7e2c58 St: Take advantage of clipped redraws
In order to take advantage of clipped redraws (only redraw the
parts that actually changed), we have to inform clutter about
our paint_volume by implementing the get_paint_volume virtual
method.

As this feature had been added in in clutter 1.5.x we now require
that.

https://bugzilla.gnome.org/show_bug.cgi?id=630932
2010-11-29 11:23:47 -05:00
Florian Müllner
4f7a28863c st-icon: Add support for -st-shadow property
Add a drop shadow to the icon texture if the -st-shadow property is
specified.

https://bugzilla.gnome.org/show_bug.cgi?id=635608
2010-11-25 05:38:20 +01:00
Owen W. Taylor
1fce237538 StThemeNode: suppress compiler warnings and fix minor bugs
Aggressive compiler flags can cause the compiler to be smart enough
to inline functions and detect variables not being set on certain
code paths but not smart enough to understand the overall logic;
add some extra initializations to suppress the warnings.

Fix several minor bugs in the logic found when double checking the
logic before adding the initializations.

Based on a patch by Marc-Antoine Perennou <Marc-Antoine@Perennou.com>.

https://bugzilla.gnome.org/show_bug.cgi?id=634225
2010-11-20 14:14:57 -05:00
Giovanni Campagna
21ac225981 StIcon: add support for GIcon
Add a "gicon" property so that a GIcon can be used instead of an
icon name, while still getting icon recoloring from the theme.
Also include a compatibility wrapper in libshell until GJS has
support for interface static methods.

https://bugzilla.gnome.org/show_bug.cgi?id=622451
2010-11-16 22:11:27 +01:00
Giovanni Campagna
aa91491730 StTooltip: Rework to use StLabel
Replaces the internal ClutterText with StLabel, so full CSS
styling is supported.

https://bugzilla.gnome.org/show_bug.cgi?id=622450
2010-11-16 19:22:01 +01:00
Owen W. Taylor
8734a59cd7 Handle icon theme changes
Connect to the "changed" signal on the default icon theme, and
when it triggers:

 - Evict all cached looked up icons from the StTextureCache
 - Fake a style change on all StThemeContext; this will result
   in StIcon looking up icons again.

https://bugzilla.gnome.org/show_bug.cgi?id=633866
2010-11-15 18:45:36 -05:00
Giovanni Campagna
141b4ffe87 StFocusManager: don't unref removed groups
It is not referencing them when adding, and also it is connecting
to the "destroy" signal, emitted on dispose, so there is no risk
of storing finalized objects.

https://bugzilla.gnome.org/show_bug.cgi?id=634781
2010-11-14 20:51:27 +01:00
Owen W. Taylor
3138b20b11 Skip drawing transparent borders and backgrounds
We were always drawing the border and background of each
StThemeNode, even if they were transparent. The simple
optimization of checking the alpha provides a significant
performance boost (in a quick test, it increased the
overviewFpsSubsequent metric in the core performance test
from 28fps to 35fps).

https://bugzilla.gnome.org/show_bug.cgi?id=634752
2010-11-13 10:12:40 -05:00
Owen W. Taylor
dc1e23501c Remove _for_theme() variant of st_texture_cache_load_icon_name()
Now that we're using St.Icon in the Javascript, there is no reason
to have separate st_texture_cache_load_icon_name() and
st_texture_cache_load_icon_name_for_theme(), instead just add
the StThemeNode argument to st_texture_cache_load_icon_name().

https://bugzilla.gnome.org/show_bug.cgi?id=633866
2010-11-12 17:36:26 -05:00
Owen W. Taylor
af7ba00e97 StIcon: pass in the StThemeNode to get colorized symbolic icons
Use st_texture_cache_load_icon_name_for_theme() so that we get the
right colors for symbolic icons. The code refactoring to achieve this
also avoids constantly starting a new icon load each time we set
a property on initialization ... the icon is loaded only after we
have a #StThemeNode assigned.

https://bugzilla.gnome.org/show_bug.cgi?id=633865
2010-11-12 17:36:26 -05:00
Owen W. Taylor
8d6ab6fe84 Add st_widget_peek_theme_node()
Sometimes it's useful to get the theme node if there is one and do
nothing and wait for the ::style-changed signal if there is no theme
node. Add st_widget_peek_theme_node() that just gets the current
theme node if available. The caller must handle a %NULL return.

https://bugzilla.gnome.org/show_bug.cgi?id=633865
2010-11-12 17:36:26 -05:00
Owen W. Taylor
4917c79d09 StTextureCache: support loading a named icon with colors from a theme node
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
2010-11-12 17:36:26 -05:00
Owen W. Taylor
04da2a61db Add StIconColors object, compute in StThemeNode
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
2010-11-12 17:36:26 -05:00
Owen W. Taylor
3ca86b2197 StIcon: Center the icon rather than scaling it up
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
2010-11-12 17:36:25 -05:00
Owen W. Taylor
35400238aa StIcon: Always request a square icon size
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
2010-11-12 17:36:25 -05:00
Owen W. Taylor
439d7f036f Port StIcon from MX framework to St framework
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
2010-11-12 17:36:25 -05:00
Owen W. Taylor
aed6375a2d Move StIconType to st-types.h from st-texture-cache.h
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
2010-11-12 17:36:25 -05:00
Owen W. Taylor
a9a8b1ec6a StIcon: Remove content-image capability
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
2010-11-12 17:36:25 -05:00
Owen W. Taylor
b0e713b775 StIcon: use g_strcmp0()
Simplify a check for an unchanged string with g_strcmp0().

https://bugzilla.gnome.org/show_bug.cgi?id=633865
2010-11-12 17:36:25 -05:00
Owen W. Taylor
32fc25a3ac StIcon: Adopt copyright notice to standard
- Replace FSF address with URL
- Remove explicit Authors: list

https://bugzilla.gnome.org/show_bug.cgi?id=633865
2010-11-12 17:36:25 -05:00
Owen W. Taylor
839492f15b Import MxIcon as StIcon
https://bugzilla.gnome.org/show_bug.cgi?id=633865
2010-11-12 17:36:25 -05:00
Owen W. Taylor
86f3a637f1 st_texture_cache_load_from_raw: Don't pointlessly include size in cache key
The texture is independent of the size that the user passed in; so there
is no obvious reason to include the texture in the cache key.

https://bugzilla.gnome.org/show_bug.cgi?id=633595
2010-11-12 17:34:16 -05:00
Owen W. Taylor
ce72aaf008 Fix up copyright and license notices for St
* 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
2010-11-12 15:23:28 -05:00
Owen W. Taylor
b856e2990b StScrollView: null out the right variable in dispose
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.
2010-11-11 08:41:07 -05:00
Owen W. Taylor
f25e6916bd Remove unused StSubtexture 2010-11-10 22:00:11 -05:00
Florian Müllner
ad624d546f st-texture-cache: Fix include
The file gnome-desktop-thumbnail.h was moved from libgnomeui to
libgnome-desktop.

https://bugzilla.gnome.org/show_bug.cgi?id=634555
2010-11-11 01:42:30 +01:00
Dan Winship
35f806df4e St: add keyboard support to StClickable and StButton
Allow triggering clicks with space/return

https://bugzilla.gnome.org/show_bug.cgi?id=633853
2010-11-08 13:06:41 -05:00
Dan Winship
4f1f226828 StButton: fix hover and grab tracking
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
2010-11-08 13:06:41 -05:00
Dan Winship
4c6dd64e87 StButton: fix code style
https://bugzilla.gnome.org/show_bug.cgi?id=633853
2010-11-08 13:06:41 -05:00
Dan Winship
5a83ef8325 St: add StFocusManager, to handle keyboard navigation
StFocusManager allows setting up "focus groups" in which it will
automatically handle navigation between can_focus widgets.

https://bugzilla.gnome.org/show_bug.cgi?id=621671
2010-10-29 08:38:05 -04:00
Dan Winship
d2b968a7df St: add keyboard focus navigation support
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
2010-10-29 08:38:05 -04:00
Neil Roberts
8872913665 StThemeNode: Fix the confusion between border and background
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.
2010-10-28 21:51:13 +01:00
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