Commit Graph

79923 Commits

Author SHA1 Message Date
Athmane MOKRAOUI
eb13ecfbe7 Update Kabyle translation 2024-04-04 12:13:23 +00:00
Matthias Clasen
85c4507609 spinbutton: Fix a corner case
Fix a bug where a zero increment would make the value unsettable,
when the more natural operation is to allow any value to be set.
2024-04-04 14:11:10 +02:00
Matthias Clasen
fcb6c8e447 Revert "spinbutton: Tangential refactoring, small fix"
This reverts commit 3d898af736.

The commit caused a regression where, depending on the update policy,
we would not apply value changes at all.

Fixes: #6599
2024-04-04 14:00:25 +02:00
Michael Weghorn
0b27f39c2b a11y atspi: Don't require GtkWidget for GetOffsetAtPoint
Use the existing `gtk_at_spi_translate_coordinates_to_accessible`
to translate the coordinates passed as parameters to AT-SPI
Text's GetOffsetAtPoint method instead of having a
custom GtkWidget-specific translation.

This makes this work for non-GtkWidget GtkAccessibles
as well, and also adds support for parent-relative
coordinates (ATSPI_COORD_TYPE_PARENT).
2024-04-04 13:53:49 +02:00
Michael Weghorn
2101f880af a11 atspi: Fix type for GetOffsetAtPoint result
With the fix from the previous commit in place,
trying to use the GetOffsetAtPoint AT-SPI Text method
from Accerciser's IPython console with the gtk4-demo
Hypertext example would still give this error:

    In [46]: acc.queryText().getCharacterExtents(5, pyatspi.XY_WINDOW)
    Out[46]: (58, 20, 5, 19)
    In [47]: acc.queryText().getOffsetAtPoint(59, 21, pyatspi.XY_WINDOW)
    ---------------------------------------------------------------------------
    Error                                     Traceback (most recent call last)
    Cell In[47], line 1
    ----> 1 acc.queryText().getOffsetAtPoint(59, 21, pyatspi.XY_WINDOW)

    File /usr/lib/python3/dist-packages/pyatspi/text.py:346, in Text.getOffsetAtPoint(self, x, y, coordType)
        331 def getOffsetAtPoint(self, x, y, coordType):
        332         """
        333         Get the offset of the character at a given onscreen coordinate.
        334         The coordinate system used to interpret x and y is determined
       (...)
        344         -1 if the point is outside the bounds of any glyph.
        345         """
    --> 346         return Atspi.Text.get_offset_at_point(self.obj, x, y, coordType)

    Error: atspi_error: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken. (1)

and the gtk4-demo output would show the actual problem:

    (gtk4-demo:563491): GLib-GIO-WARNING **: 13:18:27.652: Type of return value is incorrect: expected '(i)', got '(u)'

Fix this by returning an int as expected.

With this in place, the result is now as expected:

    In [48]: acc.queryText().getCharacterExtents(5, pyatspi.XY_WINDOW)
    Out[48]: (58, 20, 5, 19)
    In [49]: acc.queryText().getOffsetAtPoint(59, 21, pyatspi.XY_WINDOW)
    Out[49]: 5
2024-04-04 13:52:28 +02:00
Michael Weghorn
2cc241732d a11y atspi: Fix input variant type for Text's GetOffsetAtPoint
Trying to use the AT-SPI Text GetOffsetAtPoint method
didn't work.

For example, trying to use it from Accerciser's IPython
console with the gtk4-demo Hypertext example, would
give this error:

    In [45]: acc.queryText().getOffsetAtPoint(59, 21, pyatspi.XY_WINDOW)
    ---------------------------------------------------------------------------
    Error                                     Traceback (most recent call last)
    Cell In[45], line 1
    ----> 1 acc.queryText().getOffsetAtPoint(59, 21, pyatspi.XY_WINDOW)

    File /usr/lib/python3/dist-packages/pyatspi/text.py:346, in Text.getOffsetAtPoint(self, x, y, coordType)
        331 def getOffsetAtPoint(self, x, y, coordType):
        332         """
        333         Get the offset of the character at a given onscreen coordinate.
        334         The coordinate system used to interpret x and y is determined
       (...)
        344         -1 if the point is outside the bounds of any glyph.
        345         """
    --> 346         return Atspi.Text.get_offset_at_point(self.obj, x, y, coordType)

    Error: atspi_error: Unsupported coordinate space (1)

and the gtk4-demo output would show the actual problem:

    (gtk4-demo:562820): GLib-CRITICAL **: 13:14:10.862: the GVariant format string '(i&s)' has a type of '(is)' but the given value has a type of '(iiu)'

    (gtk4-demo:562820): GLib-CRITICAL **: 13:14:10.863: g_variant_get: assertion 'valid_format_string (format_string, TRUE, value)' failed

Specify the proper type, which gets us one step further at least.
2024-04-04 13:50:13 +02:00
Michael Weghorn
c01782b0a9 a11y atspi: Reuse helper to translate text coords
Instead of reimplementing translating coordinates
relative to a GtkAccessible in a way that requires
that the GtkAccessible is a GtkWidget, reuse the
existing helper function
`gtk_at_spi_translate_coordinates_from_accessible`
in the implementations of AT-SPI Text methods
GetCharacterExtents and GetRangeExtents.

This makes the implementation work for non-GtkWidget
GtkAccessibles, adds support for parent-relative
coordinates (ATSPI_COORD_TYPE_PARENT)
and also fixes an issue with incorrect extents
being reported in a quick test with the "Hypertext"
sample from gtk4-demo.

Sample for querying extents in Accerciser's IPython
console for the Hypertext sample previously gave this
result:

    In [39]: acc.queryText().getCharacterExtents(5, pyatspi.XY_WINDOW)
    Out[39]: (58, 20, -53, -1)

Now, a positive width and height are returned as expected and
the result matches the one when using the GTK 3 version
in gtk3-demo:

    In [1]: acc.queryText().getCharacterExtents(5, pyatspi.XY_WINDOW)
    Out[1]: (58, 20, 5, 19)
2024-04-04 13:50:13 +02:00
Michael Weghorn
a62831562f a11y atspi: Move helpers for coord translation to gtkatspiutils
Move the (so far) local helper functions used for the
AT-SPI Component method implementations,
`translate_coordinates_from_accessible` and
`translate_coordinates_to_accessible` to
`gtkatspiutilsprivate` and add a "gtk_at_spi_"
prefix to the function names.

This will allow to reuse them elsewhere in
upcoming commits.
2024-04-04 13:50:06 +02:00
Matthias Clasen
40dd81e1a4 Merge branch 'drop-redundant-a11y-code' into 'main'
a11y: Drop the per-widget text implementations

See merge request GNOME/gtk!6924
2024-04-04 10:03:15 +00:00
Matthias Clasen
a9f3a52c18 Drop some per-widget a11y text implementations
We still keep the editable implementation, since not all our
editable widgets implement GtkAccessibleText yet, but the label,
inscription and textview implementations are unused.
2024-04-04 10:14:46 +02:00
Matthias Clasen
0978912922 Merge branch 'macos-color-picker' into 'main'
macos: color picker

Closes #5137

See merge request GNOME/gtk!7099
2024-04-04 06:56:08 +00:00
Matthias Clasen
3c9923d395 Merge branch 'a11y-text-work' into 'main'
a11y: Implement GetOffsetAtPoint

See merge request GNOME/gtk!7004
2024-04-04 05:31:17 +00:00
Matthias Clasen
0296f49eb0 Merge branch 'dynamic-cursor' into 'main'
gdk: Add dynamic cursors

See merge request GNOME/gtk!7067
2024-04-04 05:30:54 +00:00
Matthias Clasen
4b7a550366 Merge branch 'bump-pango-dep' into 'main'
Bump the pango dep

Closes #6554

See merge request GNOME/gtk!7100
2024-04-04 05:29:56 +00:00
Matthias Clasen
37e18b784e gtk-demo: Add a callback cursor
Make one of the GTK logo cursors in the cursors demo use a callback
cursor that follows the cursor theme size, to show that that is
possible.
2024-04-04 01:07:28 +02:00
Matthias Clasen
1275a2cb8d wayland: Use a viewport for pointer surfaces
This should give us more flexibility for buffer size vs surface
size.

Unfortunately, mutter doesn't play along currently, so this is
only useful for kwin, weston or sway.
2024-04-04 01:07:28 +02:00
Matthias Clasen
67a6f343a0 wayland: Keep pointer_output_scale as double
We can round up to the next integer when we need to.
2024-04-04 01:07:28 +02:00
Matthias Clasen
a98e6bff85 Add a test app
This app has a dynamic cursor that is the GTK logo, loaded from
an SVG to make it come out at the nominal size of the cursor
theme, while taking fractional scaling into account.
2024-04-04 01:07:28 +02:00
Matthias Clasen
d0f5644771 macos: Handle callback cursors
This implementation matches the X11 one closely.
2024-04-04 01:07:28 +02:00
Matthias Clasen
b1a3ac8330 win32: Handle callback cursors
This implementation matches the X11 one closely.
2024-04-04 01:07:28 +02:00
Matthias Clasen
80811069ac x11: Handle callback cursors
For these cursors, get the texture for the cursor image by
calling the callback. We always use scale 1.
2024-04-04 01:07:28 +02:00
Matthias Clasen
6e3dc1e669 wayland: Handle callback cursors
For these cursors, get the texture for the cursor image by
calling the callback. We don't do any caching of the cursor
images for now.
2024-04-04 01:07:28 +02:00
Matthias Clasen
d1aa0a74e4 gdk: Add callback cursors
Add a variant of GdkCursor that obtains the texture for the cursor
via a callback. The callback gives us the flexibility to handle
fractional scales and update the cursor for cursor theme size
changes as well as scale changes.
2024-04-04 01:07:28 +02:00
Matthias Clasen
7a6fb09179 inscription: Add tests for gtk_accessible_text_get_offset
Test that we get the expected values on an inscription.
2024-04-04 01:05:38 +02:00
Matthias Clasen
5732c5e3d0 label: Add tests for gtk_accessible_text_get_offset
Test that we get the expected values on a label.
2024-04-04 01:05:38 +02:00
Matthias Clasen
79fb3d9b0c textview: Implement gtk_accessible_text_get_offset
This is relatively straightforward, reusing existing infrastructure.
2024-04-04 01:05:31 +02:00
Matthias Clasen
17455054f1 text: Implement gtk_accessible_text_get_offset
Reusing existing infrastructure as much as possible.
2024-04-04 01:04:47 +02:00
Matthias Clasen
763f51cb98 inscription: Implement gtk_accessible_text_get_offset
This is copying the corresponding code from GtkLabel.
2024-04-04 01:04:13 +02:00
Matthias Clasen
9fb78603ec label: Implement gtk_accessible_text_get_offset
We can reuse existing infrastructure for this.
2024-04-04 01:03:33 +02:00
Matthias Clasen
f802be88e9 a11y: Use gtk_accessible_text_get_offset
Implement GetOffsetAtPoint using gtk_accessible_text_get_offset.
2024-04-04 01:02:42 +02:00
Matthias Clasen
b9d2049991 a11y: Add gtk_accessible_text_get_offset
This is not implemented yet.
2024-04-04 01:02:41 +02:00
Matthias Clasen
cfe3558610 a11y: Add GetOffsetAtPoint
We don't handle it yet.
2024-04-04 01:00:25 +02:00
Matthias Clasen
35d15de3b6 label: Fix provider info lifecycle
This is a follow-up fix to a48df87a85, which was insufficient.
2024-04-04 01:00:25 +02:00
Matthias Clasen
23a336df0e Bump the pango dep
Require pango 1.52, and drop the fallback code.

Fixes: #6554
2024-04-04 00:56:24 +02:00
Matthias Clasen
bacdc735a4 Merge branch 'a11y-text-work2' into 'main'
a11y: Add gtk_accessible_text_get_extents

See merge request GNOME/gtk!7006
2024-04-03 22:55:30 +00:00
Matthias Clasen
19a168446e textview: Implement gtk_accessible_text_get_extents
There is some question if this needs to be clipped to widget extents
- if the textview is in a scrolled window, we can easily return
extents here that go beyond the window or event the screen.
2024-04-04 00:29:24 +02:00
Matthias Clasen
47ec7bc66d text: Implement gtk_accessible_text_get_extents
Using existing infrastructure.
2024-04-04 00:29:24 +02:00
Matthias Clasen
b4178870dd inscription: Implement gtk_accessible_text_get_extents
Using existing infrastructure.
2024-04-04 00:29:24 +02:00
Matthias Clasen
03ef792802 label: Implement gtk_accessible_text_get_extents
Using existing infrastructure.
2024-04-04 00:29:24 +02:00
Matthias Clasen
7955efef6c atspi: Use gtk_accessible_text_get_extents
Implement the GetCharacterExtents and GetRangeExtents methods of
the atspi Text interface using the new GtkAccessibleText api.
2024-04-04 00:29:24 +02:00
Matthias Clasen
3134003376 a11y: Add gtk_accessible_text_get_extents
This will be used to implement GetRangeExtents in atspi.
2024-04-04 00:29:24 +02:00
Matthias Clasen
a508860d1f Merge branch 'matthiasc/for-main' into 'main'
Start 4.15 development

See merge request GNOME/gtk!7098
2024-04-03 22:04:11 +00:00
Arjan Molenaar
c835ca41e0 macos: Pick color with NSColorSampler
NSColorSampler is the easiest way to pick a color.
It does require macOS 10.15+ to work.
2024-04-03 21:10:20 +02:00
Arjan Molenaar
2d5eafd014 macos: Add skeleton for color picker 2024-04-03 21:01:24 +02:00
Matthias Clasen
9b34878208 Merge branch 'cursor-demo-cosmetics' into 'main'
gtk-demo: Cosmetic changes

See merge request GNOME/gtk!7068
2024-04-03 14:08:38 +00:00
Matthias Clasen
4b1b956d27 Start 4.15 development 2024-04-03 15:53:49 +02:00
Matthias Clasen
0dd58c4d1b gtk-demo: Cosmetic changes
Remove the periods from the tooltips in the cursor demo.
Tooltips are better without periods.
2024-04-03 14:39:51 +02:00
Matthias Clasen
4b2b6d6212 Merge branch 'matthiasc/for-main' into 'main'
Post-release version bump

See merge request GNOME/gtk!7097
2024-04-03 12:23:07 +00:00
Matthias Clasen
2cdb53d524 Post-release version bump 2024-04-03 14:19:31 +02:00
Matthias Clasen
4f7721e742 Merge branch 'matthiasc/for-main' into 'main'
4.14.2

See merge request GNOME/gtk!7096
2024-04-03 12:18:20 +00:00