Commit Graph

556 Commits

Author SHA1 Message Date
Matthias Clasen
19b534f7de Avoid copying static debug strings
The g_source_set_name calls were showing up as a
major source of strdups in our profiles. Avoid that
by using new GLib api when available.
2021-07-28 22:42:46 -04:00
Matthias Clasen
7fe0610b68 introspection: Stop using allow-none
allow-none has been deprecated for a long time
already. Instead use optional and nullable everywhere.
2021-05-20 19:17:49 -04:00
Matthias Clasen
8ba16eb4f1 Documentation fixes
Mostly fixing up indentation of continuation lines,
and other small cleanups.
2021-05-20 19:17:49 -04:00
Matthias Clasen
0d238f4c99 range: Convert docs 2021-03-11 16:37:33 +00:00
Emmanuele Bassi
78e3908a00 gtk: Move from g_memdup() to g_memdup2()
The g_memdup() function is replaced by a safer version in newer versions
of GLib.
2021-02-11 14:22:22 +00:00
Carlos Garnacho
7a4d15dc67 gtk/range: Move button release handling to GtkGestureDrag
Tracking it through the GtkGestureClick becomes a bit cumbersome for
handling of simultaneously pressed buttons. We can track ::stopped,
but that also emits for a number of situations where we want drag to
continue.

However, the GtkGestureDrag is grouped with the click gesture, and
knows better when to finish the drag gesture (not just because of a
button release), so hook drag and zoom mode finalization there.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3426
2020-12-12 01:42:42 +01:00
Matthias Clasen
39dfdac771 range: Hide internals from accessibility
The nameless, faceless gizmos inside a range do not
contribute to the accessible experience at all, lets
not add them to the tree. All the accessible functionality
is on the main widget (either a scale or a scrollbar).
2020-10-21 08:01:25 -04:00
Christian Hergert
07bb07abbe macos: port gtk to GDK_WINDOWING_MACOS
For the various uses of GDK_WINDOWING_QUARTZ, we need to use
alternatives from GDK_WINDOWING_MACOS.

Some minor loss of functionality is here, such as icons sent with
application menus. That can certainly be added back at a future
point.
2020-10-09 20:08:23 -07:00
Matthias Clasen
929a56e53c Clean up lots of GTK+ -> GTK
Replace most remaining uses of GTK+ in the docs and
user-visible strings by GTK. Also remove some leftover
"Was added in 3.x" sentences from the docs.
2020-09-12 12:01:04 -04:00
Matthias Clasen
ae7cefd97d Drop style class defines
We document the supported style classes by name,
not by macro name, and these macros don't really
add any value. Drop them for GTK 4.
2020-08-14 07:03:27 -04:00
Carlos Garnacho
cab1dcb696 gdk: Conflate GDK devices
Make GdkEvents hold a single GdkDevice. This device is closer to
the logical device conceptually, although it must be sufficient for
device checks (i.e. GdkInputSource), which makes it similar to the
physical devices.

Make the logical devices have a more accurate GdkInputSource where
needed, and conflate the event devices altogether.
2020-07-29 01:27:51 +02:00
Emmanuele Bassi
59d85d42cf a11y: Update the accessible state for GtkRange 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
d7266b25ba Replace "gint" with "int" 2020-07-25 00:47:36 +02:00
Carlos Garnacho
e1a0171094 gtkrange: group gestures the right way around
The gtk_gesture_group() call is not a commutative operation, it
takes two gestures, maybe detaches the first one from its current
group, and adds it to the same group than the second gesture.

With the flipped argument order here, GtkRange was actually detaching
the same gesture in order to group it with a second one two times, so
the desired effect to group all 3 gestures was not achieved.

Fixes autoscroll as the drag gesture is now actually grouped with the
click one, so drag offsets can be accessed from the autoscroll
timeout.
2020-07-09 20:49:25 +02:00
Timm Bäder
20935f678b scale: Rearrange child widgets
Always keep the order:

 - [value]
 - [marks.top]
 - [marks.bottom]
 - trough

Which makes sense given the rendering order. Slider should be drawn
after the marks.

Makes it possible to simply remove the custom snapshot implementations
in scale and range. And Adwaita does not depend on the node order
anyway.
2020-06-27 10:51:06 +02:00
Yuri Chornoivan
c0cf839729 Fix minor typos 2020-06-18 10:47:16 +03:00
Emmanuele Bassi
f5ed59b7f2 a11y: Drop notify_gtk() from GtkRangeAccessible
Let the GtkRange notify the accessible instance when the adjustment
changes.
2020-06-05 20:35:10 +01:00
Emmanuele Bassi
6e52ef96a4 Move orientable style classes into GtkWidget
It feels slightly wrong to have GtkOrientable operate on widgets, but at
least what happens when an orientable widget changes orientation should
be part of GtkWidget.

This will allow to add more state changes without accessing widget state
from the outside of gtkwidget.c.
2020-06-05 20:35:09 +01:00
Matthias Clasen
e9872d52d8 range: Treat lower and upper limit the same
When clamping values to be within the range of
the adjustment, treat the lower and upper limit
the same.

Fixes: #328
2020-05-21 20:37:54 -04:00
Matthias Clasen
75d9310986 Change coordinate translation apis to take doubles
Change gtk_widget_translate_coordinates and
gtk_native_get_surface_transform to operate
on doubles. Update all callers.
2020-05-17 17:17:31 -04:00
Matthias Clasen
aae0770b82 scale: Make the area around the trough clickable
The narrow trough is too hard to hit as a click target.
Make the entire scale clickable.
2020-05-13 15:27:35 -04:00
Matthias Clasen
c60ffeedfa range: Use dispose instead of destroy
The destroy vfunc is going away.
2020-05-05 18:23:54 -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
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