Remove duplicate descriptions of the switch's appearance, describe more
particularly how the default signal handler for `GtkSwitch::state-set`
behaves, and add a suggestion that the `state` property should
only be set when communicating a delayed state change.
Fixes#6600
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
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).
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
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.
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)
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.
We still keep the editable implementation, since not all our
editable widgets implement GtkAccessibleText yet, but the label,
inscription and textview implementations are unused.
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.
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.
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.