Commit Graph

158 Commits

Author SHA1 Message Date
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
Matthias Clasen
4c150d8eb5 The big versioning cleanup
Remove all the old 2.x and 3.x version annotations.
GTK+ 4 is a new start, and from the perspective of a
GTK+ 4 developer all these APIs have been around since
the beginning.
2018-02-06 01:16:32 -05:00
Emmanuele Bassi
1ed17df7a0 Rename GtkActionHelper private header
Follow the naming scheme for private headers.
2018-02-02 10:28:17 +01:00
Timm Bäder
8619ff0744 switch: Remove unused variable 2017-12-04 18:35:48 +01:00
Timm Bäder
93df23d962 Remove some more gtk_widget_get_content_size uses 2017-12-04 12:42:52 +01:00
Matthias Clasen
ffd6baec42 gtk: Intern css names
This avoids a bunch of strdups at startup.
2017-11-17 22:49:57 -05:00
Benjamin Otte
801d69017a switch: Use gtk_widget_contains() 2017-11-01 20:52:57 +01:00
Timm Bäder
7770bdcb36 switch: Fix int/double comparison
We get a double coordinate.
2017-10-05 10:21:54 +02:00
Timm Bäder
29a6c66aec switch: Remove priv pointer 2017-10-01 09:19:09 +02:00
Timm Bäder
53409623e5 switch: Remove some unneeded includes 2017-10-01 09:19:09 +02:00
Timm Bäder
36ab70ddf5 widget: Add baseline and out_clip parameters to size-allocate
Since setting a clip is mandatory for almost all widgets, we can as well
change the size-allocate signature to include a out_clip parameter, just
like GtkCssGadget did. And since we now always propagate baselines, we
might as well pass that one on to size-allocate.

This way we can also make sure to transform the clip returned from
size-allocate to parent-coordinates, i.e. the same coordinate space
priv->allocation is in.
2017-07-19 21:27:16 -04:00
Timm Bäder
d25af7ce10 switch: Put the slider node last
Makes sense since we draw it over both labels. Also make this obvious by
using the default snapshot implementation.
2017-07-19 21:27:15 -04:00
Timm Bäder
24abbac114 switch: Remove in_switch flag
It's pretty simple and less code to just check whether the gesture
coords are inside the widget at the one place where we actually used the
flag.
2017-07-19 21:27:14 -04:00
Timm Bäder
63158fd3ff switch: Fix handle dragging with padding applied
We only move the handle inside the content allocation, so we need to use
the content width when calculating the new handle_pos.
2017-07-19 21:27:14 -04:00
Timm Bäder
5aeb25f460 switch: Remove manual PRELIGHT code
This works automatically now
2017-07-19 21:27:13 -04:00
Timm Bäder
071c205c92 switch: Use a gizmo as slider
The button was jut a stop-gap solution before GtkGizmo existed.
2017-07-19 21:27:13 -04:00
Timm Bäder
a1b2dc6e05 switch: Remove gadget 2017-07-19 21:27:11 -04:00
Timm Bäder
706b0722d4 switch: Remove css box drawing 2017-07-19 21:27:11 -04:00
Carlos Garnacho
072a13d0b7 gtkswitch: Remove event window
It's not necessary anymore to receive input events. The pan gesture has
been set on the capture phase as the child widgets may capture during
bubbling.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
a72404dd5a gtk: Mass delete all GtkWidget event mask API
We now rely on toplevels receiving and forwarding all the events
the windowing should be able to handle. Event masks are no longer a
way to determine whether an event is deliverable ot a widget.

Events will always be delivered in the three captured/target/bubbled
phases, widgets can now just attach GtkEventControllers and let those
handle the events.
2017-05-25 16:25:58 +02:00
Matthias Clasen
95d2895a05 switch: Update css docs to reflect current reality
This should have been done when the hierarchy was changed.
2017-03-31 12:48:05 -04:00
Timm Bäder
7d85ffce33 switch: remove unnecessary gtk_widget_show calls 2017-03-02 15:16:08 +01:00
Timm Bäder
239f14cc96 switch: Fix build
Partial revert of 2b6b5c1c8f, which
removed a little too much.
2017-01-16 21:01:59 +01:00
Timm Bäder
2b6b5c1c8f switch: Remove some unused code 2017-01-16 18:17:28 +01:00
Timm Bäder
545fb271b7 switch: Use a widget as slider 2017-01-08 16:54:34 +01:00