Commit Graph

182 Commits

Author SHA1 Message Date
Matthias Clasen
e499a09759 Drop gtkintl.h
Include gtkprivate.h for I_() and glib-i18n.h for
gettext macros.
2022-09-24 10:03:37 -04:00
Sophie Herold
a546ae32d7 Remove all nicks and blurbs from param specs
Those property features don't seem to be in use anywhere.
They are redundant since the docs cover the same information
and more. They also created unnecessary translation work.

Closes #4904
2022-05-11 18:16:29 +02:00
Bilal Elmoussaoui
13defc7ceb gtk: remove unneeded backtick from gi-docgen item 2021-10-29 18:32:06 +00:00
Bilal Elmoussaoui
23ea33b656 gtk: drop unwanted char on Switch::state-set docs link 2021-05-25 20:29:46 +00:00
Matthias Clasen
29f2e5f84e switch: Use markdown for css tree 2021-03-11 16:37:35 +00:00
Matthias Clasen
e4054d62fe switch: Add property annotations
Connect properties, getters, and setters with annotations
2021-03-11 16:37:33 +00:00
Matthias Clasen
18e5192a58 switch: Convert docs
Change link syntax, add an example image, generally clean things up.
2021-03-11 16:37:31 +00:00
Matthias Clasen
10d5705b70 Reduce use of GtkStyleContext
Remove some unnecessary uses of GtkStyleContext where
we can directly go to the GtkCssStyle, and and drop
unnnecessary includes.
2021-01-28 12:27:07 -05:00
Emmanuele Bassi
213024a560 Use function setter for WidgetClass.activate_signal 2020-12-05 01:04:18 +00:00
Matthias Clasen
ca9b06878d switch: Hide internal structure from a11y
According to section 7.1 of WAI-ARIA, the switch role
has the "Children presentational" characteristic, which
indicates that children should not be represented in
the a11y tree.
2020-10-21 14:55:13 -04:00
Matthias Clasen
2ef4be21c8 switch: Initialize accessible state
The checked state defaults to undefined, so we need
to set it to the desired false state.
2020-07-27 21:18:10 -04:00
Matthias Clasen
d90f79de0e a11y: Document roles of widgets
Add a section to the long description for each
widget that is using a non-default accessible role.
2020-07-27 10:48:08 -04:00
Emmanuele Bassi
52c1fb8dfe a11y: Implement role and state change in GtkSwitch
Set the "switch" role, and update the "checked" state when the :active
property is toggled.
2020-07-26 20:31:15 +01: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
Matthias Clasen
2ff3e3d1e4 gtk: Improve struct packing in places
Plug some holes in our structs by rearranging
a few fields. This is was done looking at
pahole output.
2020-07-25 11:57:37 -04:00
Benjamin Otte
3078b180fe Replace "gdouble" with "double" 2020-07-25 00:47:36 +02:00
Benjamin Otte
d375dce9f5 Replace "gchar" with "char" 2020-07-25 00:47:36 +02:00
Benjamin Otte
d7266b25ba Replace "gint" with "int" 2020-07-25 00:47:36 +02:00
Carlos Garnacho
b81bbde7c8 gtkswitch: Don't be eager in accepting the gesture
The gesture should be accepted whenever it triggers uncancellable
actions in the widget. This means it should be accepted if the
click does result in toggling the switch.

This leaves the pan gesture room to handle dragging the handle.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/2895
2020-06-26 17:48:10 +02:00
Christoph Reiter
2d5cf2b4c4 Drop fallback-c89.c
We require a C compiler supporting C99 now. The main purpose of
these fallbacks was for MSVC. From what I can see this is now all supported
by MSVC 2015+ anyway.

The only other change this includes is to replace isnanf() with the
(type infering) C99 isnan() macro, because MSVC doesn't provide isnanf().
2020-05-31 17:09:23 +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
edc31a264c widget: Add a :focusable property
Add back a property that determines whether an individual
widget will accept focus or not. :can-focus prevents the
focus from ever entering the entire widget hierarchy
below a widget, and :focusable just determines if grabbing
the focus to the widget itself will succeed.

See #2686
2020-05-10 23:24:48 -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
46ff9f891a gizmo: Allow passing changing focus behavior
We need this in popovers. Maybe it could be done better
by defining one-off custom widgets.
2020-04-09 17:50:29 -04:00
Timm Bäder
60f2e452a1 switch: Stop using a private struct
Private type, no private struct needed.
2019-09-11 08:12:31 +02:00
Christian Hergert
828c36636c va_marshaller: add various va_marshallers
We don't need to cover every case with a va_marshaller, but there are a
number of them that are useful because they will often only be connected
to by a single signal handler.

Generally speaking, if I opened into a file to add a va_marshaller, I just
set all of them.
2019-06-06 15:30:42 -07:00
Matthias Clasen
7f65e5f96b Rename GtkGestureMultiPress to GtkGestureClick
The name just made it hard for people to find the
right gesture to use.
2019-05-29 17:10:46 +00: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
Matthias Clasen
fb334b1b15 switch: Make final
This should not be subclassed.
2019-05-26 15:34:31 -04:00
Matthias Clasen
5b78a3048f gizmo: Add a contains_func
Let GtkGizmo override the contains() implementation.
Update all callers to pass NULL for the contains_func.
2019-04-07 15:47:24 +00:00
Emmanuele Bassi
65965bed16 Changes after review
- Rename GtkLegacyLayout to GtkCustomLayout
 - Use for() to iterate over children in GtkBinLayout
 - Whitespace fixes for code imported from GtkBox
 - Store the GtkLayoutChild instances inside LayoutManager
 - Simplify the GtkLayoutManager API by dropping unnecessary arguments
 - Fix the ownership model of GtkLayoutManager
2019-03-26 00:11:27 +00:00
Emmanuele Bassi
8cf06befc0 Port GtkSwitch to GtkLegacyLayout 2019-03-26 00:11:27 +00:00
Benjamin Otte
01f7f255b5 gtk: Check return value of compute_bounds()
Half of these calls will completely break if anybody ever uses CSS
transforms with them, but hey...
2019-02-20 05:26:31 +01:00
Timm Bäder
5852a5ece8 switch: Notify :state by pspec 2019-01-30 17:46:08 +01:00
Matthias Clasen
c5f90fc20d switch: Use icons
This works better than glyphs, avoiding the
uncertainties of font availability and fallback..
2019-01-24 20:43:12 -05:00
Matthias Clasen
c1f79a935c switch: Avoid problems with glyph availability
If none of the glyphs we want are available, fall
back to using empty strings here, rather than causing
critical warnings.
2019-01-23 15:47:02 -05:00
Emmanuele Bassi
58d9c3d5bd switch: Update state labels when needed
If the text style changes, or the display settings do, we need to update
the state labels to ensure that the glyphs are available in the font
we're using.
2019-01-18 14:43:42 +00:00
Emmanuele Bassi
5c50e48156 Add fallback glyphs for GtkSwitch states
Even though the IEC power glyphs are part of Unicode 9.0 (released in
2016) not all fonts have them.

To avoid showing the hexbox of doom when the system font does not have
the glyphs we'd like to use, add a fallback pair, using the old glyphs
we suggested when the labels were translatable.
2019-01-15 22:16:05 +00:00
Emmanuele Bassi
ba9b0c6f7d Use the IEC power symbols for GtkSwitch labels
Unicode 9.0 introduced glyps for the "on" and "off" power states, in the
form of:

 - U+23FD POWER ON SYMBOL, or ⏽
 - U+2B58 HEAVY CIRCLE, or ⭘

With `HEAVY CIRCLE` as "power off symbol" selected to avoid adding yet
another circle to the standard.

Since we moved GtkSwitch to always show glyphs instead of (translatable)
strings, asking the localisation teams to either come up with a suitable
short string to replace the English "ON" and "OFF", or to fall back to
Unicode glyphs, we should ensure we're using the appropriate symbols to
begin with.

See also: gtk!503 for the corresponding gtk-3-24 change.
2019-01-11 15:25:30 +00:00
Matthias Clasen
927e49ed86 switch: Always use I/O
This allows for smaller switches, and goes better with
modern themes that have round switches.
2019-01-10 17:21:48 -05:00
Timm Bäder
eeeefb40c7 switch: Shorten size_allocate impl a bit 2018-11-27 05:37:38 +01:00
Timm Bäder
ade171a2ed widget: Don't pass a position to ->size_allocate
The values have been 0/0 for a long time now, so just drop the
GtkAllocation argument and replace it with width and height.
2018-11-13 16:28:54 +01:00
Benjamin Otte
4ddc94b293 multipressgesture: Port to new API model 2018-04-26 17:59:42 +02:00
Benjamin Otte
71991270b0 pangesture: Port to new API model 2018-04-26 17:59:41 +02:00
Timm Bäder
3ce6355bf4 widget: Remove _get_own_allocation
Replace all usages of it with _compute_bounds
2018-04-10 09:43:47 +02:00
Benjamin Otte
169203951b widget: Remove clip from size-allocate vfunc
As the clip is no longer needed, get rid of it.
2018-04-05 14:56:38 +02:00
Alexander Larsson
695d141f32 Merge branch 'rename-window-to-surface' into 'master'
Rename window to surface

See merge request GNOME/gtk!72
2018-03-20 16:16:57 +00:00
Alexander Larsson
63e060a21d GtkWidget: Start renaming widget->window
This is an automated change doing these command:

git sed -f g gtk_widget_set_has_window gtk_widget_set_has_surface
git sed -f g gtk_widget_get_has_window gtk_widget_get_has_surface
git sed -f g gtk_widget_set_parent_window gtk_widget_set_parent_surface
git sed -f g gtk_widget_get_parent_window gtk_widget_get_parent_surface
git sed -f g gtk_widget_set_window gtk_widget_set_surface
git sed -f g gtk_widget_get_window gtk_widget_get_surface
git sed -f g gtk_widget_register_window gtk_widget_register_surface
git sed -f g gtk_widget_unregister_window gtk_widget_unregister_surface

git checkout NEWS*
2018-03-20 15:21:12 +01:00
Timm Bäder
f261bf2fc6 switch: Avoid a gtk_widget_get_clip call
Since we get the correct clip anyway from the gtk_widget_size_allocate
call above.
2018-03-20 09:37:59 +01:00
Benjamin Otte
f08bc40fbb a11y: Don't include gtk.h
Also add missing includes and sort them for all the widgets that relied
on that before.
2018-02-08 15:25:53 +01:00