Commit Graph

35 Commits

Author SHA1 Message Date
Ivan Molodetskikh
7ef54e9c53 picture: Return natural size 0 for size 0
It was returning the full natural size (same as -1) due to default value
handling in the code below.

Tests have been updated to match this output.
2021-12-08 19:20:24 +01:00
Marco Melorio
d3347e64ba picture: Setting keep-aspect-ratio requires a redraw 2021-11-18 02:39:15 +01:00
Benjamin Otte
c4e5242be0 picture: Setting can-shrink requires a resize
So queue one.
2021-11-05 20:51:00 +01:00
Matthias Clasen
938bfff3dd Add type annotations for filename arguments
Add missing "(type filename)" annotations for string
arguments that are filenames.

Fixes: #633
2021-06-12 11:12:06 -04:00
Matthias Clasen
8f4b0cd30d picture: Make setters actually take NULL
gtk_picture_set_file was claiming to be nullable,
but choked on NULL.

Fixes: #3974
2021-05-26 07:30:57 -04:00
Matthias Clasen
4a0d3d7acc docs: Reduce redundancy
Remove a boatload of "or %NULL" from nullable parameters
and return values. gi-docgen generates suitable text from
the annotation that we don't need to duplicate.

This adds a few missing nullable annotations too.
2021-05-20 20:45:06 -04:00
Matthias Clasen
91f3f5c63b image, picture: Move pixbuf code to gdkpixbufutils
This cleans up and moves the code to load files
while taking the scale into account. Along the way,
we drop the last uses of GdkPixbufAnimation, and
consolidate the pixbuf using code in one place.
2021-04-16 18:27:40 -04:00
Matthias Clasen
8eacbc3a20 picture: Add property annotations
Connect properties, getters, and setters with annotations.
2021-03-11 16:37:32 +00:00
Matthias Clasen
3b42440805 picture: Convert docs
Change link syntax, add an example image, generally clean things up.
2021-03-11 16:37:30 +00:00
Emmanuele Bassi
e8b6e6cad0 docs: Clean up the first paragraph for various symbols
The documentation engine will use the first paragraph as the summary for
a type or constant.
2021-03-11 16:37:30 +00:00
Matthias Clasen
a5e929ce36 docs: Add details
Explain the difference between GtkPicture and GtkImage,
and when you might want to use which.
2021-01-16 14:45:20 -05:00
Benjamin Otte
f7f8990f7a picture: Fix copy/paste error in docs 2020-12-24 06:38:45 +01:00
Matthias Clasen
24124452d5 docs: Fix up GtkPicture docs
These were missing proper linking.
2020-12-04 11:47:43 -05:00
Benjamin Otte
66c3a43e96 Add docs about sizing pictures
Suggested by Christopher Davis.
2020-12-04 02:04:19 +00:00
Matthias Clasen
ed571ae68a picture: Set alternative text as description
Use the alternative text as accessible description
for GtkPicture.
2020-10-22 07:51:44 -04:00
Matthias Clasen
c43d535aab docs: Fix a copy-paste error 2020-10-01 17:07:53 -04:00
Matthias Clasen
efd4169fa2 a11y: Set accessible roles for GtkImage and GtkPicture
Use the img accessible role for these.
Also update the documentation and add tests.
2020-07-28 18:16:37 -04:00
Emmanuele Bassi
c63087a563 Remove ATK
To build a better world sometimes means having to tear the old one down.
        -- Alexander Pierce, "Captain America: The Winter Soldier"

ATK served us well for nearly 20 years, but the world has changed, and
GTK has changed with it. Now ATK is mostly a hindrance towards improving
the accessibility stack:

 - it maps to a very specific implementation, AT-SPI, which is Linux and
   Unix specific
 - it requires implementing the same functionality in three different
   layers of the stack: AT-SPI, ATK, and GTK
 - only GTK uses it; every other Linux and Unix toolkit and application
   talks to AT-SPI directly, including assistive technologies

Sadly, we cannot incrementally port GTK to a new accessibility stack;
since ATK insulates us entirely from the underlying implementation, we
cannot replace it piecemeal. Instead, we're going to remove everything
and then incrementally build on a clean slate:

 - add an "accessible" interface, implemented by GTK objects directly,
   which describe the accessible role and state changes for every UI
   element
 - add an "assistive technology context" to proxy a native accessibility
   API, and assign it to every widget
 - implement the AT context depending on the platform

For more information, see: https://gitlab.gnome.org/GNOME/gtk/-/issues/2833
2020-07-26 20:31:14 +01:00
Benjamin Otte
d7266b25ba Replace "gint" with "int" 2020-07-25 00:47:36 +02:00
Matthias Clasen
3d008d5929 picture: Don't leak alternative-test
This leak showed up while running the testsuite
under asan.
2020-07-08 17:44:29 -04:00
Corentin Noël
076b2f11d2 docs: Fix several missing references in the documentation
This fixes several typos and missing references
2020-05-11 19:26:20 +02:00
Matthias Clasen
b93631164f Remove lots of focus vfuncs
In many cases, the default widget vfuncs work just fine,
combined with setting focusable.
2020-05-11 00:11:37 -04:00
Matthias Clasen
632524f679 Reinstate expected focus behavior
After the :can-focus change in the previous commit, widgets
need to set suitable focus and grab_focus implementations
to implement the desired focus behavior.

This commit does that for all widgets.
2020-04-09 17:50:29 -04:00
Matthias Clasen
10e4c04e61 Use style values directly
Replace uses of gtk_css_style_get_value with direct access,
throughout the tree. We don't replace all uses, just those
where we are dealing with a fixed property. Be careful to
handle the currentColor special case for color properties.
2020-01-29 11:07:32 +01:00
Timm Bäder
2884691740 picture: Unref previous paintable
We were leaking all of them.
2019-07-13 09:38:28 +02:00
Matthias Clasen
18788c2a86 Remove gtk_widget_get/set_has_surface
These serve no purpose anymore - widgets don't
have surfaces, unless they're a GtkNative.
2019-05-28 20:25:15 +00:00
Benjamin Otte
7918eaf677 picture: Don't cause warnings on load failures
When a file set via gtk_picture_set_file() can't be loaded, just
silently don't load it.

Reftest picture-load-invalid-file added for that case.
2019-03-29 09:56:52 +01:00
Benjamin Otte
6e19fb7b36 picture: Use new snapshot transforms 2019-02-21 19:47:28 +01:00
Timm Bäder
b4f2a3416e picture: Avoid some unnecessary signal connections
We don't need to ever invalidate the picture size if the paintable tells
us its size is static. Same for the contents.
2018-12-31 12:44:02 +01:00
Timm Bäder
ec576088bb picture: Fix doc typo 2018-08-25 08:06:28 +02:00
Timm Bäder
af8fe182c8 Fix a few documentation warnings 2018-07-08 09:41:15 +02:00
Timm Bäder
346ec706f7 picture: Fix up some docs
Use nullable instead of allow-none consistently, remove trailing
whitespace and fix some c&p problems.
2018-06-18 17:35:03 +02:00
Rico Tzschichholz
b1f934d3b0 picture: Fix g-i annotation warning 2018-06-13 13:08:28 +02:00
Benjamin Otte
a34a5df674 picture: Don't use g_str_equal() with potential NULLs 2018-06-10 02:56:18 +02:00
Benjamin Otte
6546ef3459 picture: Introduce
This commit introduces GtkPicture, which is supposed to complement
GtkImage.

GtkImage will be adapted to always display an icon, while
GtkPicture displays regular imagery.
2018-06-10 02:23:02 +02:00