Commit Graph

461 Commits

Author SHA1 Message Date
Benjamin Otte
c4a9fa9865 range: Stop trying to be smarter than GTK
GTK deals with PRELIGHT properly itself now, so there's no need to try
do it manually.
2017-11-05 05:13:17 +01:00
Benjamin Otte
4bb9a6360f range: Use gtk_widget_pick() to pick the mouse location
That's rather unsuccessful so far because it requires skipping a bunch
of irrelevant widgets, but oh well...
2017-11-05 05:13:17 +01:00
Benjamin Otte
cf1cd19b61 range: Stack widgets properly
The trough widgets have the slider on top of the fill level and the
hilight widget. Make sure the widget stacking respects that.

This is particularly relevant because picking event targets should pick
the slider and not the hilight widget.
2017-11-05 05:13:17 +01:00
Daniel Boles
29b8cfc952 Range: Fix inverted horizontal scroll wheel events
Bug 737175 aimed to ensure that scrolling up on a horizontal range would
result in its value increasing, as that’s what users intuitively expect.
However, its commit 416c370da1 meant that,
if the event gives scroll deltas, we inverted our delta unconditionally.

So it broke horizontal scrolling: scrolling left moved the slider right…

We must only invert if using dy as delta. dx already has the right sign,
so inverting it was wrong.

https://bugzilla.gnome.org/show_bug.cgi?id=788905
2017-10-14 18:56:32 +01:00
Matthias Clasen
2120ea60ed range: Bring back middle clicks
It does not hurt us to keep middle clicks doing the same
as shift-primary clicks. This makes the transition from gtk2
less painful in terms of muscle memory.

https://bugzilla.gnome.org/show_bug.cgi?id=787669
2017-10-11 14:07:53 -05:00
Benjamin Otte
43c212ac28 build: Enable -Wswitch-enum and -Wswitch-default
This patch makes that work using 1 of 2 options:

1. Add all missing enums to the switch statement
  or
2. Cast the switch argument to a uint to avoid having to do that (mostly
   for GdkEventType).

I even found a bug while doing that: clearing a GtkImage with a surface
did not notify thae surface property.

The reason for enabling this flag even though it is tedious at times is
that it is very useful when adding values to an enum, because it makes
GTK immediately warn about all the switch statements where this enum is
relevant.
And I expect changes to enums to be frequent during the GTK4 development
cycle.
2017-10-06 21:23:39 +02:00
Carlos Garnacho
861916fd0b gtkrange: Use scroll event controller 2017-09-19 18:40:49 +02:00
Carlos Garnacho
c0b77a2941 range: Update to using GdkEvent API 2017-09-19 18:39:02 +02:00
Timm Bäder
ccfc568a03 range: Fix trough state update 2017-08-28 11:17:47 +02:00
Timm Bäder
9f3f640c0d widget: Remove gtk_widget_get_border_allocation 2017-08-14 12:22:39 +02:00
Timm Bäder
5f859a1f24 widget: Remove gtk_widget_get_content_allocation
Replace it where we still need something similar, e.g. in
gtk_widget_translate_coordinates
2017-08-14 12:22:39 +02:00
Timm Bäder
9c7e089fc2 widget: Remove gtk_widget_get_margin_allocation
It's not needed anymore with get_outer_allocation (which will be
replaced by something more appropriately named).
2017-08-14 12:22:39 +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
4eba9442df range: Fix get_range_rect
get_own_allocation's position is relative to the given widget's origin,
not the parent.
2017-07-19 21:27:15 -04:00
Timm Bäder
468e75e43d range: Fix mark positions
The values returned by gtk_range_compute_slider_position are relative
to the trough_widget (the slider's parent), not the slider widget
itself.
2017-07-19 21:27:15 -04:00
Timm Bäder
993998085f range: Avoid division by zero 2017-07-19 21:27:15 -04:00
Timm Bäder
3dc6d240b3 Fix a few allocation coordinates & sizes 2017-07-19 21:27:15 -04:00
Timm Bäder
c2abb698be Replace a few get_content_allocation calls with get_content_size
The position of the content allocation is almost never relevant since
it's 0/0 for measure, size_allocate and snapshot.
2017-07-19 21:27:14 -04:00
Timm Bäder
1c5eec92fe range: Fix slider allocation 2017-07-19 21:27:14 -04:00
Timm Bäder
30f516ff1f range: Use a gizmo as slider
No need for this to be a GtkIcon.
2017-07-19 21:27:14 -04:00
Timm Bäder
b9f70b473c scrollbar: Add new API to gtk4-sections.txt
and update the css node docs
2017-07-19 21:27:13 -04:00
Timm Bäder
790c153b2c range: Fix click detection in slider trace
The x/y/ coordinates are relative to the range allocation, so take that
into account.
2017-07-19 21:27:13 -04:00
Timm Bäder
4f0140fa6c Remove GtkBuiltinIcon
Now unused.
2017-07-19 21:27:13 -04:00
Timm Bäder
b3f45cf1fe range: Emit value-changed when setting the adjustment
After all, the value kind of just changed.
2017-07-19 21:27:13 -04:00
Timm Bäder
af9d0cdffb range: Return trough allocation from _get_range_rect 2017-07-19 21:27:13 -04:00
Timm Bäder
753e915f87 scrollbar: Add accessor for wheel delta
Make the one in gtkrange.c static since it was only ever used from
GtkScrolledWindow.
2017-07-19 21:27:12 -04:00
Timm Bäder
706bc08b68 range: Draw the colorscale trough at 0,0 2017-07-19 21:27:12 -04:00
Timm Bäder
2e62072cbc range: Allocate the trough when the adjustment value changes
So it repositions the slider.
2017-07-19 21:27:12 -04:00
Timm Bäder
38ff761313 range: Fix mouse location tracking 2017-07-19 21:27:12 -04:00
Timm Bäder
afddfc2397 range: Snapshot slider in trough's snapshot impl 2017-07-19 21:27:12 -04:00
Timm Bäder
6e74975e41 range: make the slider a gadget 2017-07-19 21:27:12 -04:00
Timm Bäder
ba6ba94184 range: Use gizmos for highlight and fill gadgets 2017-07-19 21:27:12 -04:00
Timm Bäder
395185896f range: Use a gizmo as trough 2017-07-19 21:27:12 -04:00
Timm Bäder
90cc401f1a range: Remove contents gadget
It's not needed anymore since the range only has one child gadget: the
trough.
2017-07-19 21:27:12 -04:00
Timm Bäder
7e525ca63b range: Remove steppers
Add them back into the new scrollbars later
2017-07-19 21:27:12 -04:00
Timm Bäder
5049b35fc6 range: Make GtkRange a regular class 2017-07-19 21:27:12 -04:00
Timm Bäder
9e79684762 range: Remove gadget completely 2017-07-19 21:27:12 -04:00
Timm Bäder
1d782b8930 scale: Fix value position
by not using the range's gadget which is not allocated to any position
anymore.
2017-07-19 21:27:12 -04:00
Timm Bäder
bb7b1c56ae range: Remove gadget usage 2017-07-19 21:27:11 -04:00
Carlos Garnacho
c14e6a5119 gtkrange: Remove event window
This is not necessary anymore to receive input events.
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
Daniel Boles
db7ff6d88a Range: Remove leftover comment about update policy
Update policies were removed way back in 2011… in
commit c43a31ea33
2017-02-27 20:05:37 +00: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
81297857cc snapshot: Convert Range, Scale, ColorScale
And of course Scrollbar, but that one does no drawing itself.
2016-12-20 18:01:11 +01:00
Piotr Drąg
a2da4ddceb Use Unicode in translatable strings
See https://developer.gnome.org/hig/stable/typography.html

https://bugzilla.gnome.org/show_bug.cgi?id=772371
2016-12-19 15:08:10 -05:00
Benjamin Otte
da207c9fdd snapshot: Add a snapshot function to GtkCssCustomGadget 2016-11-15 17:48:45 +01:00
Benjamin Otte
c16a7d96b8 range: Don't leak pointers to discarded gadgets 2016-11-08 02:32:40 +01:00
Benjamin Otte
13d8ac83ee range: Use gdk_window_new_input() 2016-11-06 23:46:44 +01: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
3c901d6376 Remove a few more unused style properties 2016-10-16 18:17:21 +02:00