Commit Graph

129 Commits

Author SHA1 Message Date
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
Timm Bäder
f486805ba0 Unparent child widgets 2017-01-07 17:19:30 +01:00
Timm Bäder
b2b4d9e418 switch: Use GtkLabels for on/off labels 2017-01-07 17:19:30 +01:00
Benjamin Otte
0dbdf0c428 gadget: Remove gtk_css_gadget_draw()
And with it, remove the draw func from custom gadgets, that has been
NULL everywhere.

All gadgets are snapshot now.
2016-12-20 18:01:12 +01:00
Benjamin Otte
e3b1c9f1cd snapshot: Port to GtkSwitch
Included is the addition of gtk_snapshot_render_layout(), which is meant
to replace gtk_render_layout().
2016-11-15 17:48:45 +01:00
Benjamin Otte
da207c9fdd snapshot: Add a snapshot function to GtkCssCustomGadget 2016-11-15 17:48:45 +01:00
Timm Bäder
46d80b94a8 switch: Port to indirect rendering 2016-10-28 16:33:02 +02:00
Timm Bäder
9992a616ef widget: Use ::measure vfunc to measure size
Add a new ::measure vfunc similar to GtkCssGadget's that widget
implementations have to override instead of the old get_preferred_width,
get_preferred_height, get_preferred_width_for_height,
get_preferred_height_for_width and
get_preferred_height_and_baseline_for_width.
2016-10-22 19:05:47 +02:00
Timm Bäder
dd03372eac switch: Stop implementing GtkActivatable 2016-10-18 00:29:18 +02:00
Benjamin Otte
cd8b08f98f switch: Use gdk_window_new_input() 2016-10-18 00:22:35 +02:00
Timm Bäder
feac88dc52 switch: Remove deprecated style properties 2016-10-16 18:17:21 +02:00
Benjamin Otte
e1a03ead7a Use NULL for generic marshallers in g_signal_new()
glib will use the correct marshaller automatically. And as a side
effect, we also get all glib optimizations, like a va marshaller.
2016-08-29 16:20:54 +02:00
Timm Bäder
0efe186d95 switch: Remove .slider from slider gadget
As the documentation states, neither the switch nor the slider gadget
should be using any style classes.
2016-05-04 18:55:33 +02:00
Timm Bäder
4ba1f19b03 switch: Create less pango layouts
Instead of creating 2 pango layouts in every draw() and on in
_get_content_size (and calling into gettext twice in both cases), just
keep the layouts around and create them in only one place.
2016-05-04 18:35:30 +02:00
Matthias Clasen
8457dff08a switch: Use getter for gtk-enable-animations 2016-05-01 00:40:08 -04:00
Matt Watson
7ad64a20aa switch: port to progress tracker 2016-04-08 16:09:30 -07:00
Benjamin Otte
41195f6300 switch: An active switch is :checked
Fix an oversight that should have happened in the gadget refactoring:
An active switch should be :checked, just like togglebuttons,
checkbuttons, etc.
2016-03-23 18:14:57 +01:00
Timm Bäder
1331b60029 A few more documentation fixes 2016-02-09 08:05:16 +01:00
Timm Bäder
680ec087ab switch: Don't queue draws after setting state flags 2016-02-04 20:00:21 +01:00
Timm Bäder
b8db48079f switch: Fix text positioning
https://bugzilla.gnome.org/show_bug.cgi?id=760509
2016-01-12 21:56:53 +01:00
Timm Bäder
a8ceeb1766 switch: Don't include margins in input window size
https://bugzilla.gnome.org/show_bug.cgi?id=760509
2016-01-12 21:56:53 +01:00
Matthias Clasen
abbd6b11f6 switch: Deprecate style properties
CSS min-width and min-height on the slider node fit this
perfectly. We still fall back to the slider-width and
slider-height style properties if the CSS properties are
not set.
2015-12-16 13:53:13 -05:00
Benjamin Otte
0f8233bd7b switch: Port to gadgets 2015-12-15 08:41:16 -05:00
Benjamin Otte
971a277419 cssnode: Change style-changed signal
Instead of having old and new style, now have a GtkCssStyleChange opaque
object that will compute the changes you are interested in for you.

This simplifies change signal handlers quite a bit and avoids lots of
repeated computation in every signal handler.
2015-12-12 02:16:04 +01:00
Matthias Clasen
870461475a switch: Add a diagram to CSS node documentation 2015-11-03 14:27:35 -05:00
Matthias Clasen
bab20f1d10 trivial formatting fix 2015-10-31 19:23:47 -04:00
Matthias Clasen
7ea33d82ed Remove a duplicate include 2015-10-31 19:19:53 -04:00
Matthias Clasen
506d5b5b48 switch: Document css names a bit
This is still provisional. Better gtk-doc support will be needed
to do better here.
2015-10-22 23:27:43 -04:00
Matthias Clasen
48b30e8e91 switch: Convert to element names
Use the element names switch and slider for the two css nodes,
and drop the .trough and .slider classes.
2015-10-22 21:40:31 -04:00
Benjamin Otte
1f1c7547da switch: Use the right state when querying padding
We were using the state of the widget node, not the state of the slider
node.

This caused layout loops due to invalidations.
2015-10-22 18:43:55 +02:00