Commit Graph

443 Commits

Author SHA1 Message Date
Matthias Clasen
7b76be5360 button: Add explicit key bindings for activation
We should not rely on GtkWindow to have global
"activate-default" key bindings that happen to
fall back to activating the focus widget. This is
unreliable, since the bubbling up from the button
to the toplevel may run across other widgets that
may want to use Enter for their own purpose, and
then the button loses out. By adding our own
key bindings, the button gets to handle it before
its ancestors.

This fixes check buttons in the inspector property
list not reacting to Enter despite having focus.
2020-07-18 12:53:10 -04:00
Carlos Garnacho
df30741535 gtkbutton: Drop grab_notify handler
The click gesture already has a ::cancel handler, and does almost
everything it should. Move the last bits and remove the grab_notify
handler.
2020-06-24 20:35:22 +02:00
Matthias Clasen
b526722000 button: Center images
If we leave the valign to be the default fill, then
the images pick up baseline alignment from the environment,
which can occasionally lead to misplaced -/+ icons in
spinbuttons, for example in the "Page Setup" tab of
the print dialog.
2020-06-15 12:24:48 -04:00
Emmanuele Bassi
9d51aa1443 a11y: Drop notify_gtk() from GtkButtonAccessible
Make GtkButton notify the accessible state directly when updating the
label.
2020-06-05 20:35:10 +01:00
Matthias Clasen
b93631164f Remove lots of focus vfuncs
In many cases, the default widget vfuncs work just fine,
combined with setting focusable.
2020-05-11 00:11:37 -04:00
Matthias Clasen
edc31a264c widget: Add a :focusable property
Add back a property that determines whether an individual
widget will accept focus or not. :can-focus prevents the
focus from ever entering the entire widget hierarchy
below a widget, and :focusable just determines if grabbing
the focus to the widget itself will succeed.

See #2686
2020-05-10 23:24:48 -04:00
Matthias Clasen
4aa5fba0b5 button: Derive from GtkWidget
We want to remove GtkBin and GtkContainer as they don't
provide much useful functionality anymore. This requires
us to move get_request_mode and compute_expand down.

We have to implement GtkBuildable, in order to keep
the <child> element in ui files working for buttons.

See #2681
2020-05-04 22:53:07 -04:00
Matthias Clasen
04e4a02cd0 button: Add a child property 2020-05-04 22:53:07 -04:00
Matthias Clasen
b55195fa2e Move the idle sizer to GtkWindow
This was only living in gtkcontainer.c for historic
reasons. Move it closer to where it belongs, and
rename it from 'idle' to 'layout', since it is
really about the layout phase of the frame clock,
nowadays.
2020-04-20 16:30:45 -04:00
Matthias Clasen
b4c79bad34 Assorted documentation fixes 2020-04-20 00:38:58 -04:00
Matthias Clasen
df1816a29c button: Drop relief
We are only using this as a boolean, so change it
to a boolean property named has-frame.
2020-04-17 10:57:36 -04:00
Matthias Clasen
0ee58e9ef4 gtk: Port widgets away from gtk_get_current_ apis
Use the event controller equivalents where needed.
This commit covers the simple cases.
2020-04-11 17:29:27 -04:00
Matthias Clasen
632524f679 Reinstate expected focus behavior
After the :can-focus change in the previous commit, widgets
need to set suitable focus and grab_focus implementations
to implement the desired focus behavior.

This commit does that for all widgets.
2020-04-09 17:50:29 -04:00
Matthias Clasen
22e1827f84 Change the default value of GtkWidget:can-focus
Make widgets can-focus by default, and change the semantics
of can-focus to be recursive . If it is set to FALSE, focus
can not enter the widget or its descendents at all anymore.

This commit temporarily breaks focus behavior of widgets
that did not expect to receive focus.
2020-04-09 17:50:29 -04:00
Matthias Clasen
e662438675 button: Fix an event handling gotcha
We no longer translate event coordinates in-place,
so gdk_event_get_position() returns surface-relative
coordinates, not widget-relative ones. Just use the
coordinates we are given.
2020-03-28 14:33:01 -04: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
c343031a0e Stop using g_object_ref/unref on events
Use gdk_event_ref/unref instead of g_object_ref/unref.
Events will stop being object soon.
2020-02-21 00:47:53 -05: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
5803366f7d button: Remove unused signal enum members 2019-10-09 16:57:21 +02:00
Дилян Палаузов
6ded38de2b Minor typos in the Documentation (a/an) 2019-08-25 12:52:46 +00:00
Daniel Boles
a03e531772 FileChooserButton: Document the CSS nodes & class
The only glancing mention of this we had was that GtkButton mentioned it
in passing when discussing how `button` could get contextual classes,
and even that's not relevant in master anymore... so drop it from there.
2019-06-20 20:51:37 +01: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
bcfff5e469 Drop gtk_button_clicked
This is not an api we want to propagate anymore.
If you need to, you can still emit the "clicked"
action signal on a button using g_signal_emit_by_name.
2019-05-18 14:33:41 -04:00
Matthias Clasen
cf47bb9355 gtk: Stop using gtk_button_clicked
This function is going away.
2019-05-18 14:27:09 -04:00
Matthias Clasen
965d0e04d1 gtk: Use root/unroot instead of display-changed
The display-changed signal is going away
2019-05-02 01:33:41 +00:00
Benjamin Otte
a44ac75e65 gtk: Don't include gtkstylecontext.h from gtkcsstypesprivate.h
And make sure it's included everywhere it's needed.
2019-03-19 08:53:25 +01: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
2644da106b button: Remove some dead code 2018-12-04 06:30:47 +01:00
Timm Bäder
4860410c4a button: Remove some unnecessary includes 2018-12-04 06:30:47 +01:00
Timm Bäder
248708c282 button: Remove key_controller member
Unneeded now.
2018-09-23 17:59:37 +02:00
Timm Bäder
1a2052a40e button: Remove unused variable 2018-06-21 20:57:18 +02:00
Carlos Garnacho
7048362e6e gtkbutton: remove keyboard device GTK+ grab
This isn't really necessary, if keyboard focus forcibly goes somewhere
else we will get ::grab-notify, which is sufficient to deactivate the
button again.
2018-06-21 12:50:57 +02:00
Carlos Garnacho
5f0ed088e4 gtkbutton: Use key controller for button (de)activation through keybindings
And stop using GtkWidget::event for good.
2018-06-21 12:50:57 +02:00
Timm Bäder
945b844b7c button: Remove ICON_SIZE_BUTTON mention in docs
The icon will have the size given by css, not whatever
GTK_ICON_SIZE_BUTTON was.
2018-06-20 20:47:17 +02:00
Timm Bäder
d3ffaa0236 button: Remove measure implementation
This is already done by GtkBin.
2018-06-16 10:09:12 +02:00
Matthias Clasen
6084a7ea89 button: Stop using ::key-release-event
Use the generic ::event signal instead.
2018-05-21 20:20:24 -04:00
Timm Bäder
5ff4ef14e6 widget: Directly notify gestures of grab
Since each widget has a list of event controllers now, we don't need to
connect to ::grab-notify of the widget for every controller.
2018-05-19 10:18:50 +02:00
Benjamin Otte
4ddc94b293 multipressgesture: Port to new API model 2018-04-26 17:59:42 +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
c7294ab90e button: Remove priv pointer
This way we can also move the GtkButtonPrivate definition into
gtkbutton.c
2018-02-25 16:47:20 +01:00
Timm Bäder
f5afc17d26 button: Remove ::event handler
GRAB_BROKEN events cause the ::cancel handler of the gesture to be
emitted, which is where we also call gtk_button_do_release, so this
GtkWidget::event handler is unnecessary.
2018-02-23 21:57:49 +01:00
Benjamin Otte
3bb95a09bb a11y: Remove gtk.h include from container accessible 2018-02-09 00:42:38 +01:00
Matthias Clasen
4c150d8eb5 The big versioning cleanup
Remove all the old 2.x and 3.x version annotations.
GTK+ 4 is a new start, and from the perspective of a
GTK+ 4 developer all these APIs have been around since
the beginning.
2018-02-06 01:16:32 -05:00
Emmanuele Bassi
c655759cef Replace gdk_threads_add_timeout* with g_timeout_add()
The main GDK thread lock is not portable and deprecated.

The only reason why gdk_threads_add_timeout() and
gdk_threads_add_timeout_full() exist is to allow invoking a callback
with the GDK lock held, in case 3rd party libraries still use the
deprecated gdk_threads_enter()/gdk_threads_leave() API.

Since we're removing the GDK lock, and we're releasing a new major API,
such code cannot exist any more; this means we can use the GLib API for
installing timeout callbacks.

https://bugzilla.gnome.org/show_bug.cgi?id=793124
2018-02-03 12:06:58 +01:00
Emmanuele Bassi
1ed17df7a0 Rename GtkActionHelper private header
Follow the naming scheme for private headers.
2018-02-02 10:28:17 +01:00
Matthias Clasen
0583b80d1b button: Stop using ::grab-broken-event
The event-specific signals are going away. Just use ::event here.
2018-01-16 14:14:10 -05:00
Carlos Garnacho
d491e49fd6 gtk: s/gdk_event_free/g_object_unref/ 2017-12-14 01:05:48 +01:00