Benjamin Otte
0eb1228902
widget: Add gtk_widget_class_add_shortcut()
...
This allows adding shortcuts as a replacement for keybindings.
2020-03-25 22:36:03 -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
Benjamin Otte
17d9ba362c
widget: Remove gtk_widget_add_accelerator()
...
People should use shortcut controllers instead (global, capture).
A side effect of this is that GtkAccelLabel now lost its method to
magically look up accelerators to display. Somebody needs to add that
back later.
2020-03-18 23:00:51 -04:00
Benjamin Otte
e6d0560a82
shortcut: Add GtkShortcutAction
...
Similar to GtkShortcutTrigger, GtkShortCutAction provides all the
different ways to activate a shortcut.
So far, these different ways are supported:
- do nothing
- Call a user-provided callback
- Call gtk_widget_activate()
- Call gtk_widget_mnemonic_activate()
- Emit an action signal
- Activate an action from the widget's action muxer
- Activate a GAction
2020-03-18 23:00:51 -04:00
Benjamin Otte
ba3882de83
gtk: Remove accel paths
...
It's an outdated technology now that everybody is using GActionGroups.
If somebody wanted to support changeable shortcuts, they'd need to
reintroduce it in another way.
2020-03-18 23:00:51 -04:00
Emmanuele Bassi
d75fd59ddf
Allow installing bindings bound to actions
...
This is just convenience code around GtkShortcut, just like bindings for
signal emission and callback invocation.
2020-03-18 23:00:49 -04:00
Benjamin Otte
b18f9da807
shortcut: Add gtk_shortcut_set_callback()
...
... and gtk_widget_class_add_binding() to go with it.
This allows shortcuts to invoke manually added callbacks.
2020-03-18 23:00:49 -04:00
Benjamin Otte
e19b49f5aa
widget: Add gtk_widget_class_add_shortcut()
...
This allows adding shortcuts as a replacement for keybindings.
2020-03-18 23:00:49 -04:00
Timm Bäder
d5327a61e6
widget: Remove gtk_widget_input_shape_combine_region()
...
Widget's don't have surfaces anymore these days.
2020-02-25 14:18:24 +01:00
Matthias Clasen
0fc2505ed6
Drop gtk_widget_event from API
...
We don't want events to be injected randomly from
the outside. Plus, there's no way to create such
events from the outside now.
2020-02-21 00:51:03 -05:00
Matthias Clasen
e54e48f6d1
Explicitly pass the target to handle_event
...
Pass the event propagation target explicitly down to
the event controllers. This is a step towards getting
rid of gdk_event_set_target.
2020-02-21 00:51:02 -05:00
Matthias Clasen
e3158a1bfb
Make crossing events handled the same way
2020-02-21 00:50:59 -05:00
Timm Bäder
7e43034068
widget: Add css-classes property
...
Mirroring the values added and removed via {add,remove}_css_class().
2020-02-15 17:18:26 +01:00
Benjamin Otte
264967b764
widget: Add gtk_widget_get_css_name() API
2020-02-14 21:18:49 +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
Benjamin Otte
546a748cd8
widget: Replace style-updated signal with css_changed vfunc
...
1. Rename the thing
2. Turn it from a signal to a vfunc
3. Pass the GtkCssStyleChange to it
We don't export any public API about the GtkCssStyleChange yet, it's
just a boring opaque struct.
2020-02-05 02:46:13 +01:00
Timm Bäder
a7b34df6af
widget: Add style class API
...
Add GtkWidget API for adding and removing style classes, as well as
checking whether a widget has a style class applied.
Everyone has to go through GtkStyleContext for this these days but with
GtkStyleContext eventually going away, it makse sense for GtkWidget to
have API for this.
2020-01-29 09:36:48 +01:00
Benjamin Otte
193eb5b0dd
widget: Remove gtk_widget_get_path()
2020-01-21 12:47:16 +01:00
Matthias Clasen
853063bea7
Remove old drag dest api
2020-01-08 18:48:20 -05:00
Matthias Clasen
9b01d9a784
Remove traditional drag source API
...
gtk_drag_source_set, gtk_drag_begin, related apis
and the GtkWidget source-side signals have all been
replaced by GtkDragSource.
2020-01-08 18:48:20 -05:00
Matthias Clasen
de694958b5
Drop custom tooltip windows
...
We want to put tooltips into something other than
windows, so this needs to go. Custom widgets are
still possible.
2019-12-29 20:52:08 -05:00
Benjamin Otte
f8a7f30a0d
builder: Add GtkBuilderScope
...
GtkBuilderScope is an interface that provides the scope that a builder
instance operates in.
It creates closures and resolves types. Language bindings are meant to
use this interface to customize the behavior of builder files, in
particular when instantiating templates.
A default implementation for C is provided via GtkBuilderCScope (to keep
with the awkward naming that glib uses for closures). It is derivable on
purpose so that languages or extensions that extend C can use it.
The reftest code in fact does derive GtkBuilderCScope for its own scope
implementation that implements looking up symbols in modules.
gtk-widget-factory was updated to use the new GtkBuilderCScope to add
its custom callback symbols.
So it does it different from gtk-demo, which uses the normal way of
exporting symbols for dlsym() and thereby makes the 2 demos test the 2
ways GtkBuilder uses for looking up symbols.
2019-12-12 19:39:23 +01:00
Hubert Figuière
585397937d
doc: Cleanup doc removing mentions of gdk_surface_shape_combine_region()
2019-12-05 11:33:09 -05:00
Benjamin Otte
b7ff017f8d
widget: Change templates to use closure functions
...
... instead of connect functions.
2019-11-22 17:42:31 +01:00
Benjamin Otte
427deb4f13
widget: Make gtk_widget_grab_focus() return a boolean
...
So now it can actually fail.
It doesn't yet though.
2019-10-15 16:33:05 +02:00
Benjamin Otte
01be7f0666
widget: Make gtk_widget_activate_action() return TRUE/FALSE
...
TRUE if an action was successfully activated, FALSE if it wasn't found.
2019-10-15 07:17:30 +02:00
Timm Bäder
960e766206
widget: Don't duplicate events to translate coordinates
2019-08-15 16:23:01 +02:00
Timm Bäder
264d4bada6
widget: Remove queue_resize_no_redraw
...
We always invalidate the widget in size_allocate() anyway.
2019-07-07 07:43:08 +02:00
Timm Bäder
633172fd66
widget: Make queue_compute_expand() private
...
Nobody needs to call this anymore.
2019-07-07 07:36:29 +02:00
Matthias Clasen
2405e2711e
Add a non-varargs variant of activate_action
...
I recently turned gtk_widget_activate_action()
into a varargs function. That is more convenient
from C, but we need a non-varargs variant for
bindings. So add the old API back, under the
name gtk_widget_activate_action_variant(),
with a rename-to annotation.
2019-06-24 15:51:39 +00:00
Matthias Clasen
3acc014499
Make gtk_widget_activate_action better
...
As a convenience API, this should be easy to use,
so don't expect callers to manually create a
variant, do it for them.
Update all callers.
2019-06-23 22:51:55 +00:00
Matthias Clasen
1f0904d3df
widget: Teach query_action about property actions
...
This might be useful for documentation purposes.
2019-06-22 17:04:01 -04:00
Matthias Clasen
35a88c1440
widget: Rename a function
...
set_enabled is shorter and more to the point
than enabled_changed, now that we no longer have
a callback to query the state.
Adapt all callers.
2019-06-22 17:03:51 -04:00
Matthias Clasen
d1f4068b94
Replace stateful actions by property actions
...
The only cases of stateful actions we've seen
so far have been boolean properties, and we
don't really want to add much state handling
API, so lets just go with property actions
for now.
Adapt the only user in GtkText.
2019-06-22 17:03:38 -04:00
Matthias Clasen
7e73da5f73
widget: Add parameter type back to install_action
...
Adapt all callers.
2019-06-22 16:48:16 -04:00
Matthias Clasen
412006ad23
Add owner types for widget actions
...
This lets us filter out actions from parent classes
when introspecting.
2019-06-22 09:38:30 -04:00
Matthias Clasen
ea456b80da
Make actions minimally introspectable
...
This will let us autogenerate some docs for
actions, in the future.
2019-06-21 22:47:40 -04:00
Matthias Clasen
152eabbaba
widget actions: Add an explicit state type
...
Make the state type part of the API for installing
stateful widget actions. That lets us introspect it.
Update all callers.
2019-06-21 22:47:40 -04:00
Matthias Clasen
ef031e1a9d
Allow registering actions per-class
...
Add a facility to register and install actions
at class init time. The intended use for these
actions is for
a) context and other model-based menus
b) key bindings
Most of these actions are going to be stateless,
so add separate apis for the simple and stateful
cases.
We avoid creating an action group for these by
teaching the action muxer about these actions.
The action muxer also maintains the enabled
state for these actions.
2019-06-18 14:47:33 -04:00
Matthias Clasen
cc667926d6
Drop gtk_widget_get_action_group
...
Ths api exposes too much of the internal
action muxer setup; we want to add actions
to the muxer without an action group.
2019-06-15 21:41:11 -04:00
Matthias Clasen
9bb2d1eb5c
widget: Remove gtk_widget_list_action_prefixes
...
This function was added just for the inspector,
and is not used there anymore. Drop it.
2019-06-15 21:40:38 -04:00
Matthias Clasen
d2e0d3222f
widget: Cosmetics
2019-06-15 21:40:33 -04:00
Matthias Clasen
21a5c7f0eb
layout managers: Handle native children
...
Add a convenience api to skip children
that should not be included in the layout,
and call gtk_native_check_resize on all
native children outside of the vfunc.
2019-06-11 14:52:30 -04:00
Matthias Clasen
693b2aa4d1
Drop gtk_widget_get_toplevel
...
Not used anymore.
2019-05-28 20:25:16 +00:00
Matthias Clasen
6674f2764e
Drop gtk_widget_is_toplevel
...
No longer used.
2019-05-28 20:25:16 +00:00
Matthias Clasen
8fc6f07327
Drop gtk_widget_get_surface
...
It is no longer used.
2019-05-28 20:25:16 +00:00
Matthias Clasen
b99962e7a2
Drop gtk_widget_set_surface
...
Not used anymore. Only GtkNative's have surfaces.
2019-05-28 20:25:15 +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
bab5836e89
Drop gtk_widget_register_surface
...
This is no longer used.
2019-05-28 20:25:14 +00:00
Matthias Clasen
7dcb163ee6
Add gtk_widget_get_native
...
This is a common enough operation to deserve api.
2019-05-28 20:24:39 +00:00
Matthias Clasen
8d1f05f5ac
Cosmetics
2019-05-26 04:00:07 +00:00
Matthias Clasen
bd6c4a0dec
Padding review
...
Ensure that the class structs of all subclassable
types have sufficient padding (standardizing on 8
slots, here).
GtkApplication
GtkWidget
GtkContainer
GtkWindow
GtkDialog
GtkApplicationWindow
GtkToolItem
GtkBin
2019-05-19 16:24:44 +00:00
Emmanuele Bassi
fe473dbef8
Make get_layout_manager_type() public
...
The inspector, and other tools introspecting the widget structure like
gtk-builder-tool and Glade, may very well want to access the default
layout manager used by a class, especially if there are layout
properties involved, without having a whitelist of widget/layout manager
associations.
2019-05-06 12:15:21 +01:00
Emmanuele Bassi
c6b2184aa0
Allow specifying the layout manager for a widget type
...
Some widgets have a well-defined layout manager created alongside their
own instance; if they do, we can handle the layout manager creation at
the GtkWidget instantiation.
2019-05-06 11:57:32 +01:00
Matthias Clasen
bea8025fb5
Drop the GtkWidget::display-changed signal
...
Display changes now happen exclusively through
the ::root and ::unroot vfuncs. Third parties
can observe display changes by listening
for notify::root.
2019-05-02 01:33:41 +00:00
Matthias Clasen
92e21c3f1c
Drop the can-default property
...
It was added at a time when default buttons
had a very large external border that would disrupt
aligment. Not a problem nowadays.
2019-04-28 23:28:39 +00:00
Matthias Clasen
59d50be737
widget: Drop gtk_widget_grab_default
...
The default widget is mostly a dialog concept,
and does not really need this generic api.
If you need to mark a widget as default,
use gtk_window_set_default() directly.
2019-04-28 23:23:11 +00:00
Matthias Clasen
f4880f5df5
Add gtk_widget_activate_default
...
This is a convenience wrapper for
activating the "default.activate" action.
2019-04-28 23:20:13 +00:00
Matthias Clasen
aa8ada3fed
widget: Add a convenience api to activate actions
...
Since actions are used increasingly, we should
have a convenient way to trigger an action in
the context of a widget.
2019-04-28 23:19:05 +00:00
Matthias Clasen
b9770fa752
widget: Drop gtk_widget_set_parent_surface
...
And the getter, too. Widgets no longer have
extra surfaces that could serve as parent surfaces.
2019-04-24 20:57:09 -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
6bc32a3d5d
widget: Drop the pick vfunc
...
The way to influence picking is to implement contains,
we no longer use the pick vfunc.
2019-04-07 17:00:51 +00:00
Matthias Clasen
70bf6d4b97
Drop child property related apis
...
We no longer have any child properties in
our containers, so drop the infrastructure for it.
2019-04-05 12:01:43 +00:00
Daniel Boles
96bf90abe4
Widget: Don't refer to the old get_preferred_*()
...
measure() replaced get_preferred_height() and get_preferred_width().
2019-03-30 19:47:50 +00:00
Emmanuele Bassi
1b8595b5f2
Hook GtkLayoutManager into GtkWidget
...
We delegate the size request mode, the measuring, and the allocation of
a widget through a GtkLayoutManager instance, if one has been attached
to the widget; otherwise, we fall back to the widget's own implementation.
2019-03-26 00:11:27 +00:00
Matthias Clasen
492a38c229
Make gtk_widget_get_focus_child public
...
It doesn't really make sense to have only
the setter, but not the getter public.
2019-03-16 21:24:45 -04:00
Matthias Clasen
7819a5aab9
Drop gtk_widget_send_focus_change
...
Replace this with gtk_widget_set_has_focus + gtk_widget_event.
2019-03-16 21:24:44 -04:00
Benjamin Otte
0e1a50366a
transform: Move to GSK
...
The renaming of the prefix makes this a large patch.
2019-03-04 23:09:02 +01:00
Matthias Clasen
89470ab201
Document that root and unroot must chain up
...
I overlooked this at first.
2019-02-23 09:43:57 -05:00
Matthias Clasen
5dd0863bd7
widget: Drop ::hierarchy-changed
...
It is no longer used and has been replaced by the
root and unroot vfuncs.
2019-02-23 09:43:57 -05:00
Matthias Clasen
445dca42f5
widget: Remove ::event leftovers
...
The signal is long gone, no need for this unused
vfunc anymore.
2019-02-22 20:06:06 -05:00
Matthias Clasen
2e5ccce088
Make gtk_widget_set/get_can_pick public
...
This is a generally useful property to make widgets
'transparent' for input purposes.
2019-02-21 21:53:34 -05:00
Benjamin Otte
c24f32619f
widget: Make gtk_widget_allocate() take a GtkTransform
...
We can reason about GtkTransform way better - and determine its category or
do equality checks.
2019-02-21 19:47:27 +01:00
Benjamin Otte
02e856f62e
widget: Mark compute functions as G_GNUC_WARN_UNUSED_RESULT
...
Lots of code does not error-check these functions, and when we add CSS
transforms, they will start failing. And we want people to check that.
2019-02-20 05:26:39 +01:00
Benjamin Otte
9a8082bab2
widget: Remove gtk_widget_get_allocated_size()
...
Use gtk_widget_get_allocated_width/height in the only user (GtkStack),
even though that isn't 100% correct.
2019-02-19 19:29:58 +01:00
Benjamin Otte
e223f16aa9
widget: Add gtk_widget_compute_point()
...
It's the replacement for gtk_widget_translate_coordinates()
2019-02-19 19:22:10 +01:00
Timm Bäder
dbf0654e5b
widget: Add gtk_widget_compute_transform
2019-02-19 19:22:09 +01:00
Timm Bäder
10e5856583
widget: Save transform as matrix
...
The transform matrix is a translation matrix from the parent's origin to
the widget origin. We will later allow more transformations than just
translations.
2019-02-16 15:44:37 +01:00
Benjamin Otte
ddf2a3681d
widget: Add a GtkWidget::root property and gtk_widget_get_root()
...
The property is just for API completeness, the getter is meant to
replace toplevel usage.
2019-02-15 06:53:17 +01:00
Benjamin Otte
4ca1f7e29f
widget: Add GtkWidgetClass:root and :unroot functions
...
They get added whenever a widget gets added into a hierarchy with a root
widget.
2019-02-15 06:53:17 +01:00
Benjamin Otte
49cbf2a16b
widget: Add gtk_widget_set_overflow()
...
This adds a simple abilities for widget implementations to clip their
content. See future commits for users of this.
2019-02-08 18:26:42 +01:00
Matthias Clasen
8a667a5f1d
Remove vestigial ::event support
...
The signal is gone, no need to keep the vfunc around.
2019-01-26 15:36:55 -05:00
Timm Bäder
904fd5f1fc
Remove gtk_widget_intersect
...
It's been broken for quite a while now and doesn't make sense anymore
these days.
2018-11-29 11:14:26 +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
867042f88f
widget: Add gtk_widget_observe_controllers()
...
This mirrors gtk_widget_observe_children() - just that it observes the
controllers, not the children.
2018-09-16 18:50:17 +02:00
Benjamin Otte
dd94129e27
widget: Add gtk_widget_observe_children()
...
This creates a listmodel that tracks a widget's children. Doing so turns
adding/removing children from O(1) to O(N) though, so use with caution.
2018-09-16 18:50:17 +02:00
Matthias Clasen
7733f646d6
gdk: Rename GdkDragContext to GdkDrag
...
This is to go along with the newly introduced GdkDrop.
This commit includes the necessary updates to the X11, Wayland
and Broadway backends. Other backends have to be updated separately.
2018-07-02 14:59:26 +02:00
Benjamin Otte
9a91d3739d
widget: Remove time argument from drag_data_get() vfunc
2018-06-18 23:49:53 +02:00
Benjamin Otte
b00609c21c
dnd: Make drag-motion and drag-drop signals use GdkDrop
2018-06-18 23:49:52 +02:00
Benjamin Otte
6d7cb2b781
dnd: Make drag-data-received use a GdkDrop
2018-06-18 23:49:52 +02:00
Benjamin Otte
314eaf7d10
widget: Make GtkWidgetClass::drag_leave() take a GdkDrop
...
Drag Contexts are on their way out!
2018-06-18 23:49:20 +02:00
Matthias Clasen
8746322d53
Drop the ::key-press/release-event signals
...
These are the last event-type specific signals,
we are just relying on the generic ::event signal now.
2018-05-21 20:20:55 -04:00
Matthias Clasen
287c900bdb
Remove key-press-event from more docs
...
This signal will be going away, so stop mentioning it so much.
2018-05-19 23:36:01 -04:00
Matthias Clasen
7fdf3d1769
Fixes to the gtk docs
2018-05-05 18:03:31 -04:00
Timm Bäder
e0205eb27c
widget: add shortcut to gtk_widget_set_child_visible
...
So we don't do unnecessary work when just setting priv->child_visible to
the same value again.
2018-05-01 15:13:11 +02:00
Benjamin Otte
9af03fa602
widget: Expose gtk_widget_add_controller()
...
.. and gtk_widget_remove_controller().
2018-04-26 17:59:41 +02:00
Benjamin Otte
7ef8cb652b
widget: Remove gtk_widget_set_realized()
...
Everybody chains up now.
2018-04-11 03:16:34 +02:00
Benjamin Otte
ebea84474d
widget: Fix variable names
...
Stop docs build from complaining
2018-04-05 17:09:52 +02:00
Benjamin Otte
cbf26fbd02
widget: Add gtk_widget_compute_bounds()
...
The first in a set of functions intended to query widget coordinates
from another widget's coordinate system.
2018-04-05 14:57:10 +02:00