Commit Graph

531 Commits

Author SHA1 Message Date
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
Matthias Clasen
28b05eea67 range: Remove ::popup-menu emission
This signal is going away, and having context menus
on sliders is not really a thing anyway.
2020-03-25 23:14:44 -04:00
Matthias Clasen
31db615885 Revert "Merge branch 'disable-window-test' into 'master'"
This reverts commit 3ac4c76b18, reversing
changes made to 6ec96d2e98.
2020-03-19 18:03:16 -04:00
Matthias Clasen
ab9b094f80 range: Remove ::popup-menu emission
This signal is going away, and having context menus
on sliders is not really a thing anyway.
2020-03-18 23:00:51 -04:00
Timm Bäder
a1fc94f1f7 range: Remove an outdated comment
What even is a CList.
2020-02-25 14:18:23 +01:00
Timm Bäder
b81cd8c929 range: Inline function into only caller 2020-02-25 14:18:23 +01:00
Timm Bäder
838fc4fdf4 range: Clean up compute_slider_position() 2020-02-25 14:18:23 +01:00
Matthias Clasen
b1eaa502df events: reorganize getters
Restructure the getters for event fields to
be more targeted at particular event types.

Update all callers, and replace all direct
event struct access with getters.

As a side-effect, this drops some unused getters.
2020-02-21 00:51:03 -05:00
Matthias Clasen
31bf9da63a Strip const from GdkEvent
Events are refcounted structs, and we generally don't
pass these as const.
2020-02-21 00:51:02 -05:00
Timm Bäder
2529464e21 range: Avoid rounding errors when allocating highlight
Fixes #2438
2020-02-15 17:18:26 +01:00
Timm Bäder
655711fef2 Rename gtk_widget{get,set,has}_style_class to _css_class
We want to use css instead of style everywhere now.
2020-02-07 13:16:45 -05:00
Timm Bäder
b7ee2cbc28 Start using GtkWidget's new style class API 2020-02-07 13:16:32 -05:00
Timm Bäder
9999ac1255 range: Avoid a divison by 0
Based on a patch by Blake Latchford

Fixes #618
2019-08-11 10:06:52 +02:00
Timm Bäder
c6961f1b61 range: Use public delay-factory API 2019-08-11 09:34:50 +02:00
Timm Bäder
0a96c3f062 scale: Properly update when inverted
Just queue_resize()ing the range itself doesn't work as it will just
re-allocate all the child widgets (i.e. just the trough) to its old
position and size.
2019-08-10 19:51:45 +02:00
Timm Bäder
1125d08f0d range: Remove outdated comment 2019-08-10 19:51:45 +02:00
Timm Bäder
ebc0d3760f range: remove range_size_request vfunc
It's unneeded in GtkScale and named after the gtk2 size_request function
2019-08-09 14:30:01 +02: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
a2d2c8afc4 range: Use standard padding 2019-05-26 23:18:38 -04:00
Matthias Clasen
ef982b7d46 Rename things
Rename the can-pick property to can-target,
and redo the pick flags with more descriptive names.
2019-04-08 08:42:25 -04:00
Matthias Clasen
b804235aea Add a flags argument to gtk_widget_pick
This will be used to let the inspector and other users
pick insensitive widgets again. For now, update all
callers to pass no flags, preserving the current
behavior.
2019-04-07 17:19:09 +00: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
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
131e8d8905 Remove some unnecessary gtkwindow.h includes 2019-02-05 08:11:43 -05:00
Emmanuele Bassi
25fd230327 gtk: Drop the "plus"
Source names should use "[gtk]" without the plus.
2019-02-05 11:26:20 +01:00
Timm Bäder
20429f4764 Remove :active state handling on widgets 2019-01-29 07:19:54 +01:00
Timm Bäder
c49cc977fa gizmo: return void from snapshot func
This boolean return was from the old gadget code and we weren't using it
in the new gizmo code.
2019-01-18 19:43:50 +01:00
Timm Bäder
9b15c6900a colorscale: Redraw correct widget after setting rgba
The entire color scale hack is still done in GtkRange, which draws the
color scale in the range gizmo. So, to correctly redraw the color scale
when setting a new color, we need to redraw the proper widget and that's
the trough widget.

Fixes #1453
2019-01-16 19:20:53 +01:00
Timm Bäder
359d874ddb Use g_clear_pointer to unparent widgets 2018-11-13 20:53:14 +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
Ernestas Kulik
edc4b2f7d0 eventcontrollerscroll: Conditionally propagate ::scroll
Currently, gtk_event_controller_scroll_handle_event() always returns
TRUE if it is handled, which stops the propagation of the event. If
there’s a single GtkEventControllerScroll in the widget hierarchy, that
means that no others will run, depending on the propagation phase. In
Nautilus, this can be observed when adding a scroll controller to the
GtkScrolledWindow (ctrl-scrolling controls the zoom level) - either the
scrolling or the zooming breaks.

Fixes https://gitlab.gnome.org/GNOME/gtk/issues/45
2018-11-12 10:35:37 +01:00
Timm Bäder
6eba544ad4 colorscale: Remove x/y arguments from snapshot_scale
We only pass 0 anyway.
2018-11-09 18:01:58 +01:00
Timm Bäder
ac4134c298 range: Remove multipress_gesture member
We don't need it in the instance struct since we only set it up and then
access it in its signal callbacks.
2018-11-08 05:13:50 +01:00
Timm Bäder
93c688cd93 range: Remove has_origin flag
It's equivalent to the highlight_widget being !NULL.
2018-07-08 09:41:15 +02:00
Daniel Boles
19ed1b92b0 Range: Up should only mean ++ if we are a GtkScale
The last round of patches to get the desired direction of value move in
response to scrolls/keypresses on scales had the inadvertent side effect
of giving the opposite direction on scrollbars. Seeing as gtkrange.c is
already a collection of hacks, add another so that fix only holds if the
instance is a GtkScale, since that is what those patches were aimed at.

Close https://gitlab.gnome.org/GNOME/gtk/issues/1065
2018-05-21 20:21:25 +01:00
Carlos Garnacho
15e00759c7 eventcontrollerkey: Port to new API model 2018-04-26 17:59:42 +02:00
Benjamin Otte
74dbb057ed eventcontrollerscroll: Port to new API model 2018-04-26 17:59:42 +02:00
Benjamin Otte
1e6eb1f8b9 draggesture: Port to new API model 2018-04-26 17:59:42 +02:00
Benjamin Otte
bf82149271 longpressgesture: Port to new API model 2018-04-26 17:59:42 +02:00
Benjamin Otte
4ddc94b293 multipressgesture: Port to new API model 2018-04-26 17:59:42 +02:00
Carlos Garnacho
23f4724a23 range: Do not unconditionally stop events in event handler
Prevents keybindings from working on scales.
2018-04-25 02:16:35 +02:00
Daniel Boles
45c8c8f934 Range: Make down/up keys act like down/up scrolls
Before now, down/up keys on H Ranges would increase/decrease value resp,
which is unintuitive & worse, contradicts what we already do for scrolls

Fix simply by moving to the new should_invert_move() as scrolls just did
– which also gets us the other benefits explained in the last 2 commits.

https://bugzilla.gnome.org/show_bug.cgi?id=407242
https://bugzilla.gnome.org/show_bug.cgi?id=791802
2018-04-18 18:36:55 +01:00
Daniel Boles
6985dde320 Range: Use should_invert_move() to scroll value
This fixes RTL and/or :inverted Ranges responding to a horizontal scroll
by moving the value/slider button in the opposite direction... See prev.

https://bugzilla.gnome.org/show_bug.cgi?id=791802
2018-04-18 18:36:55 +01:00
Daniel Boles
bc2a38a59e Range: Add should_invert_move() for scrolls & keys
This will be used in subsequent commits to fix the sign by which the
value is changed in response to directional scroll or keypress events.

The idea is: you have a movement to make – in the form of a delta that
follows widget directions, i.e. −1 means left or up, +1 means right or
down – and you want to know whether that delta needs to be inverted in
order to produce the intuitively expected directional change of :value.

The existing should_invert() is not sufficient: it just determines
whether to invert visually, but we need more nuance than that for input.

To answer that – while not doubling up the work for scrolls and keys – I
add a helper should_invert_move(), which considers other relevant state:

 • A parallel movement on priv->orientation should just use the existing
   should_invert(), which already worked OK for this case (not others).

 • Movements on the other orientation now depend on priv->orientation:

    ◦ For a horizontal Range, always invert, so up (i.e. −ve in terms of
      widget coords) always means increase value & vice-versa. This was
      done in get_wheel_delta(), but move it here for use with keys too.

    ◦ For a vertical Range, ignore :invert as it’s only relevant to the
      parallel orientation. Do not care about text direction here either
      as RTL locales do not invert number lines, Cartesian plots, etc.

This returns TRUE if the delta should be inverted before applying to the
value, and we can now use this function in both scroll and key handlers.

https://bugzilla.gnome.org/show_bug.cgi?id=407242
https://bugzilla.gnome.org/show_bug.cgi?id=791802
2018-04-18 18:36:09 +01: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
Carlos Garnacho
385fa18c27 gtkrange: Stop using ::key-press-event
Use GtkEventControllerKey for the task
2018-04-05 19:26:54 +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
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
fd20e42932 range: Fix typo in allocate_trough
lower - upper results in something negative of course.
2018-02-23 10:59:21 +01:00