Timm Bäder
ded745a4b9
Make gtk_icon_helper_invalidate private
2016-02-07 19:16:26 +01:00
Timm Bäder
0bd6c48315
Add and use gtk_icon_helper_invalidate_for_change
2016-02-07 19:16:26 +01:00
Timm Bäder
0c80210685
iconhelper: Save whether the surface is symbolic
2016-02-07 19:16:26 +01:00
Timm Bäder
2902063f24
iconhelper: Un-duplicate some code
2016-02-07 19:16:26 +01:00
Matthias Clasen
f63e8edec6
Make sure icons update on theme change
...
Gadgets don't connect to style-changed for widget nodes, and
GtkImage uses its widget node for the icon helper. The visible
effect of this is that symbolic icons don't change color when
switching to the dark variant of Adwaita.
Fix this by manually invalidating the icon helper.
2016-01-04 21:32:19 -05:00
Руслан Ижбулатов
1f154f576a
Fix a surface leak
...
Was introduced as part of b79a187d47
.
Results in memory leaks (and GDI objects leaks on W32).
2015-12-27 02:02:19 +00:00
Matthias Clasen
ac65952f0d
icon helper: suppress style_changed when transient
...
Transient nodes should not propagate style-changed signals
that can cause widgets to get reallocated. This was causing
treeviews and iconviews with pixbuf cells to be constantly
resized and redrawn.
2015-12-18 20:53:02 -05:00
Benjamin Otte
1f6efbf669
iconhelper: Queue resize on invalidation
...
When things change in the iconhelper, queue a resize on the owner widget
so that it automatically resizes.
Only do this for iconhelpers that are used as gadgets though, not for
temporary helpers - and to check this, check if the node is transient.
2015-12-15 08:41:16 -05:00
Benjamin Otte
4586503e93
iconhelper: Finish gadget conversion
...
Implement missing vfuncs
2015-12-15 08:41:16 -05:00
Benjamin Otte
b79a187d47
iconhelper: Handle invalidation
...
When CSS, direction or scale factor change, handle the invalidation
inside the iconhelper.
This way the widgets using them don't have to.
2015-12-15 08:41:16 -05:00
Benjamin Otte
de6dca4f81
iconhelper: Use the gadget's node
...
... instead of looking at the widget's style context.
This removes all calls to the style context.
2015-12-15 08:41:16 -05:00
Benjamin Otte
ad22612ab2
iconhelper: Require passing a cssnode to the constructor
...
Note that we don't use it yet.
2015-12-15 08:41:16 -05:00
Benjamin Otte
7075d00958
iconhelper: Use the gadget's owner property
...
Don't keep the owner widget ourselves.
2015-12-15 08:41:16 -05:00
Benjamin Otte
25ecd8cd37
iconhelper: Turn into gadget
...
This is just the basic conversion to inheriting from
GTK_TYPE_CSS_GADGET.
2015-12-15 08:41:16 -05:00
Benjamin Otte
861ac8e373
iconhelper_ Don't use deprecated functions
...
Use gtk_widget_get_direction() instead of
gtk_style_context_get_direction().
2015-12-09 13:30:40 +01:00
Benjamin Otte
ccfc4d3f12
iconhelper: Remove the context argument
...
Instead, use the widget's context.
2015-12-09 13:30:40 +01:00
Benjamin Otte
e95e2d5048
iconhelper: Get rid of _gtk_icon_helper_set_window()
...
Instead use the window of the owner widget.
2015-12-09 13:30:40 +01:00
Benjamin Otte
c9d1a45d30
iconhelper: Require a widget as construction argument
...
Note that the caller needs to ensure the widget lives as long as the
iconhelper as the iconhelper will not ref the widget.
2015-12-09 13:30:40 +01:00
Benjamin Otte
01387428a3
iconhelper: Pass only the CssStyle when loading pixbufs
2015-12-09 13:30:40 +01:00
Benjamin Otte
6afeab4313
iconhelper: Remove unused GtkStyleContext parameters
2015-12-09 13:30:40 +01:00
Benjamin Otte
cf77c1695d
iconhelper: Pass only the CssStyle when loading iconsets
2015-12-09 13:30:40 +01:00
Benjamin Otte
ee6e685478
iconhelper: Pass only the CssStyle when loading icons
...
This is the first step in replacing StyleContext usage with CssNode
usage.
2015-12-09 13:30:39 +01:00
Benjamin Otte
d14e2a489a
iconhelper: Fold function into callers
...
The function takes so many arguments and is so short that it's not worth
keeping.
2015-12-04 17:44:51 +01:00
Benjamin Otte
72d4b65b1d
iconhelper: Apply icon-effect directly
...
Instead of creating an icon source, making sure no state is set and
therefore the icon-effect will be applied and then rendering that icon
source, just call the icon-effect apply function.
Also, the new way isn't deprecated.
2015-12-04 17:44:51 +01:00
Benjamin Otte
cefba86fb3
iconhelper: Return surface from icon-effect function
...
All the callers where converting to a surface anyway.
2015-12-04 17:44:51 +01:00
Benjamin Otte
295f208e1c
iconhelper: Refactor missing icon handling
...
In particular, stop using deprecated code for loading the missing image
icon.
2015-12-04 17:44:51 +01:00
Benjamin Otte
3c54a49633
iconhelper: Fold function into only caller
2015-12-04 17:44:51 +01:00
Benjamin Otte
bc1b53a34c
css: Query icon theme from style, not from settings
...
No need to look at the settings when the CSS has a property for the icon
theme.
2015-12-02 03:18:26 +01:00
Benjamin Otte
0c027937e8
iconhelper: Stop tracking state
...
The iconfactory code doesn't use it anymore, so we don't need to track
it either.
2015-12-02 00:29:31 +01:00
Benjamin Otte
6a4b91d0ed
iconhelper: Remove _gtk_icon_helper_ensure_pixbuf()
...
The code isn't used anymore. Everything uses
gtk_icon_helper_load_surface() now.
2015-12-02 00:29:30 +01:00
Benjamin Otte
4a42aa5229
imagedefinition: Remove icon-size
...
The size of icons is a property that is relevant to who is rendering the
icon, not to the icon itself.
Example: Starting a DND operation from an entry icon should cause the
icon to resize (from the entr icon's size to the DND icon size).
2015-12-02 00:29:30 +01:00
Benjamin Otte
e99eba4415
dnd: Rewrite iconhelper code
...
It now uses GtkImageDefinition instead.
2015-12-02 00:29:30 +01:00
Benjamin Otte
482d71d680
iconhelper: Add a scale argument to gtk_icon_helper_load_surface()
...
It will be used in the next patch.
2015-12-02 00:29:30 +01:00
Benjamin Otte
afad393b15
iconhelper: Refactor ensure_surface()
...
Make gtk_icon_helper_ensure_surface() a private function that just
ensures the surface was loaded.
Add gtk_icon_helper_load_surface() that is called by the above function
and the dnd code to actually load the surface.
2015-12-02 00:29:30 +01:00
Benjamin Otte
2ce67f0098
iconhelper: Store surface in ensure_surface()
...
Do not assign it in the functions that actually load the surface. Make
those just return the surface.
2015-12-02 00:29:30 +01:00
Benjamin Otte
b2584eb8ed
iconhelper: Don't store surface size
...
Instead, compute it on demand.
This avoids having to cache it in lots of places and simplifies code.
2015-12-02 00:29:29 +01:00
Benjamin Otte
751a1a9926
iconhelper: Move invalidation check
...
Just do the invalidation check once, there's no need to do it in every
branch of the switch.
Also remove useless checks: These functions will not be called if we
already have a rendered surface.
2015-12-02 00:29:29 +01:00
Benjamin Otte
c601a9653a
iconhelper: Move invalidation check
...
Just do the invalidation check once, there's no need to do it in every
branch of the switch.
Also remove useless checks: These functions will not be called if we
already have a rendered surface.
2015-12-02 00:29:29 +01:00
Benjamin Otte
afd0e28437
iconhelper: Improve size determination for surfaces
...
Instead of just working for image surface, this should now work for all
bounded surfaces.
Test included.
2015-12-02 00:29:29 +01:00
Benjamin Otte
071d2a1d69
iconhelper: Move size computation
...
We do a switch on the image type, so compute the size for a certain
image type right there.
2015-12-02 00:29:29 +01:00
Benjamin Otte
1c96b703a6
dragsource: Store an itemdefinition, not an iconhelper
...
The icon is never rendered, so there's no need for the extra iconhelper
code.
2015-12-02 00:29:29 +01:00
Benjamin Otte
e666106a43
imagedefinition: Split out from icon helper
...
The image definition is supposed to hold the description about the image
to be displayed. The icon helper actually does caching and tracks
changes.
2015-12-02 00:29:29 +01:00
Benjamin Otte
29cdb2001c
iconhelper: Don't include gtk.h
2015-11-25 16:32:39 +01:00
Benjamin Otte
4843925660
iconhelper: Remove unused function
2015-11-25 16:32:39 +01:00
Benjamin Otte
2a8e6619a7
iconhelper: Remove unused context argument
...
Various functions don't use the style context.
2015-11-25 16:32:39 +01:00
Benjamin Otte
5cffbed165
iconhelper: Don't pass GENERIC_FALLBACK flag
...
It's not used when looking up with a GIcon.
2015-10-28 19:44:26 +01:00
Benjamin Otte
b6bf982289
iconhelper: Track icon-name fallback usage in the GIcon
...
Passing GTK_ICON_LOOKUP_GENERIC_FALLBACK to the icon lookup doesn't work
for GIcons, so we have to make sure we use the right GThemedIcon.
Fixes image-icon-name-use-fallback reftest.
2015-10-08 14:44:38 +02:00
Matthias Clasen
ddf7501acd
More of the same
...
A similar case in GtkIconHelper. Here we were confusing ourselves,
and compared a icon_size against -1, although the variable is
never set to -1.
2015-03-22 15:14:42 -04:00
Benjamin Otte
49881eebbb
Revert "iconhelper: Don't check states"
...
This reverts commit 63f59dde3a
.
It turns out, the state was not just necessary for style computation,
but also for tracking RTL and LTR. And so it broke the reftests.
2015-03-12 04:31:45 +01:00
Benjamin Otte
7ad203732f
iconhelper: Use the screen's icon theme
...
... and not the default one.
2015-03-12 01:15:38 +01:00
Benjamin Otte
93f8966bd9
iconhelper: Replace function
...
The old one just calls the other one.
2015-03-12 01:15:38 +01:00
Benjamin Otte
181e58e402
iconhelper: Move function from style context into only user
2015-03-12 01:15:38 +01:00
Benjamin Otte
63f59dde3a
iconhelper: Don't check states
...
This is the wrong thing to do in today's world.
2015-03-12 01:15:38 +01:00
Javier Jardón
710f332082
configure.ac: Depend on cairo 1.14.0
...
This is needed for cairo_set_device_scale()
2014-11-10 15:12:17 +00:00
Alexander Larsson
928822f1a5
GtkIconHelper: Short circuit _gtk_icon_helper_get_size in some cases
...
_gtk_icon_helper_get_size() is often used during size request and may
not necessary mean that the icon will be displayed immediately. In
many common cases we know the size without having to ensure a surface.
In many cases this means we can avoid loading an icon until needed, and
in the case of stateless IconHelpers such as GtkCellRendererPixbuf this
is very important as otherwise it will constantly be reloading icons
if the displayed set is larger than the in-memory icon cache.
https://bugzilla.gnome.org/show_bug.cgi?id=734651
2014-08-12 15:47:42 +02:00
Cosimo Cecchi
09a36b1e9f
iconhelper: reset original pixbuf scale on clear
...
Avoids a previously set value for a different image to accidentally
stick around.
https://bugzilla.gnome.org/show_bug.cgi?id=733416
2014-07-29 10:13:21 +02:00
Matthias Clasen
6d83b173df
GtkIconHelper: use FORCE_SCALE when force_scale_pixbuf is set
...
When force_scale_pixbuf is set, the icon helper will scale the
icon to the requested size (either the pixel size, or the resolved
icon size), so we can just as well instruct the icon theme code
to do the scaling for us.
2014-06-22 11:52:11 -04:00
Matthias Clasen
7e40d74b0b
GtkIconHelper: Change setters to return success
...
This makes it easier to avoid redundant notifications in users.
2014-06-09 13:31:04 -04:00
Benjamin Otte
f8cccbad0e
iconhelper: Respect -gtk-icon-style
...
This allows styling of entry icons, treeview pixbufs and images. They
can now be forced to be symbolic or regular.
2014-05-14 04:28:34 +02:00
Benjamin Otte
fa8ca5fd13
iconhelper: Simplify code
...
In the GTK_IMAGE_ICON_NAME case, instead of keeping around the icon_name,
create a GThemedIcon and use that. This way, we can reuse the code paths
for the GTK_IMAGE_GICON case.
2014-05-11 03:23:54 +02:00
Cosimo Cecchi
b0a0b7ebe7
iconhelper: always ensure a stated pixbuf
...
Even when we are set a pixbuf itself.
https://bugzilla.gnome.org/show_bug.cgi?id=726271
2014-04-13 22:26:18 -07:00
Bastien Nocera
744b790fdb
iconhelper: Fix leak when rendering to cairo surface
...
https://bugzilla.gnome.org/show_bug.cgi?id=709264
2013-10-02 17:21:48 +02:00
Bastien Nocera
e53bb1bf1b
iconhelper: Use g_clear_* helpers
...
https://bugzilla.gnome.org/show_bug.cgi?id=709264
2013-10-02 17:21:48 +02:00
Cosimo Cecchi
417d6666e5
iconhelper: refactor some code into a single function
...
https://bugzilla.gnome.org/show_bug.cgi?id=705443
2013-08-20 02:50:40 +02:00
Cosimo Cecchi
ab88110b51
iconhelper: clear the surface on invalidation
...
This was missed during the pixbuf->surface conversion, so when the state
changed we were not recreating a new surface for it.
2013-08-03 18:08:33 +02:00
Kjell Ahlstedt
4d86472b92
Continue the deprecation of GtkIconSet
...
Deprecate gtk_icon_set_render_icon_surface() and gtk_image_get_icon_set(),
which take parameters of the deprecated GtkIconSet.
https://bugzilla.gnome.org/show_bug.cgi?id=703616
2013-07-09 06:54:27 -04:00
Kjell Ahlstedt
16c08ae135
Fix some inconsistent deprecations
...
Some functions had only a deprecation comment in the .c file, or only a
deprecation annotation in the .h file. Add the missing parts.
https://bugzilla.gnome.org/show_bug.cgi?id=703616
2013-07-09 06:54:26 -04:00
Emmanuele Bassi
0899ef7cc9
gtk: Use new macros for defining private data
...
https://bugzilla.gnome.org/show_bug.cgi?id=702996
2013-07-09 09:30:02 +01:00
Matthias Clasen
4eac681eba
Avoid deprecation warning
...
There was one overlooked use of GTK_STOCK_MISSING_IMAGE.
2013-07-03 19:52:11 -04:00
Alexander Larsson
031e1a98a0
GtkIconHelper: Convert to using cairo surfaces as base and support scales
...
We render the source into a cairo_surface_t so that we can render it
with cairo directly, rather than having to convert it from a pixbuf
every time. We also specify the target window when creating the cairo
surface so that rendering can be faster.
Using cairo surfaces also allows us to seamlessly support window scales.
We also add a GTK_IMAGE_SURFACE source type.
2013-07-03 14:39:26 +02:00
Alexander Larsson
5d8fd4ee24
GtkIconHelper: Add set_window()
...
This is a hint on where the icon will be drawn. It
will allow us to pre-allocate cairo surfaces for the right
target.
2013-07-03 14:39:25 +02:00
William Jon McCann
aef9dca9d5
Deprecate GtkIconFactory, GtkIconSet, GtkIconSource
...
We want to use GtkIconTheme instead. It is worth noting that
the parts that remain undeprecated are GtkIconSize and gtk_icon_size_lookup.
2013-06-26 20:02:27 -04:00
William Jon McCann
02c793f24a
Start migrating internals away from GtkStock
2013-06-24 22:20:49 -04:00
Jasper St. Pierre
367364a8e1
Fix deprecations for GtkIconInfo
2013-02-15 19:48:56 -05:00
Sébastien Wilmet
2c3b9a89a9
iconhelper: small code simplification
...
https://bugzilla.gnome.org/show_bug.cgi?id=687025
2013-01-17 16:21:18 +01:00
Murray Cumming
7114e63cee
iconhelper: treat the empty string as a NULL stock-id
...
https://bugzilla.gnome.org/show_bug.cgi?id=687025
2013-01-04 17:21:11 +01:00
Alexander Larsson
444a92d6d8
IconHelper: Avoid warnings for non-existing stock ids
...
There are some registred stock ids like gtk-discards that have no icons,
and you could also pass a non-registred stock id. Both of these means
gtk_style_context_lookup_icon_set returns NULL, which causes
a critical in gtk_icon_set_render_icon_pixbuf.
We avoid this by just making these render as EMPTY.
2012-12-13 10:11:00 +01:00
Carlos Garnacho
b5d45a9edc
Add API to force a GtkIconHelper pixbuf rescaling
...
This API is handy in entries and status icons, where the size is
limited and independent of the pixbuf size
2012-07-13 16:56:37 +02:00
Javier Jardón
9d0febc9a6
Change FSF Address
2012-02-27 17:06:11 +00:00
Cosimo Cecchi
f0714338b3
iconhelper: treat the empty string as a NULL icon name
...
Treat the empty string as if it was a NULL icon name instead of
rendering GTK_STOCK_MISSING_IMAGE.
This used to be the previous behavior of GtkCellRendererPixbuf and
applications might still rely on it.
2011-12-15 20:01:35 +01:00
Cosimo Cecchi
864c5610f8
icon-helper: remove useless checks
...
When we change storage type, we always clear the rest of the object, so
these checks do not add any safety.
2011-11-30 19:04:17 -05:00
Cosimo Cecchi
d300ddc5e4
icon-helper: don't warn out when the icon size is GTK_ICON_SIZE_INVALID
...
We can call ensure_icon_size() for an empty image; don't warn out in
that case, but just return a zero width.
2011-11-30 18:32:01 -05:00
Cosimo Cecchi
e37c55aa3e
icon-helper: don't reset pixel_size when clearing the helper
...
Don't reset the pixel size when clearing the helper; pixel-size is e.g a
property of GtkImage, which is stable unless explicitly set.
2011-11-30 18:15:05 -05:00
Cosimo Cecchi
b5d8d2c4a8
icon-helper: add GtkIconHelper private object
...
GtkIconHelper is a helper object to easily obtain a pixbuf from
different icon sources (e.g. a GIcon, an icon name, a stock id, ...).
Code is ported from GtkImage, which will be adapted in the next commit.
2011-11-30 16:39:59 -05:00