Commit Graph

2234 Commits

Author SHA1 Message Date
Benjamin Otte
563ad2db1b containter: Remove gtk_container_get_path_for_child() 2020-01-21 12:47:16 +01:00
Benjamin Otte
b9c81b1b94 widget: Initialize cssnode name asap
That way, it's correct in subclass's init functions.
2020-01-21 12:47:16 +01:00
Matthias Clasen
6e88ccf7fb pick: Take advantage of transform categories
Transform categories let us easily avoid doing matrix math
when we can just do a simple translation.
2020-01-19 15:56:54 -05:00
Matthias Clasen
cec4c15f05 Refactor gtk_widget_pick
Split this into a recursive part and a public
entry point. This lets us avoid some duplicate
checks.
2020-01-19 15:56:54 -05:00
Timm Bäder
f8fa946989 widget: Get opacity without GtkStyleContext
GtkStyleContext is really just unnecessary here.
2020-01-18 08:49:52 +01:00
Timm Bäder
119ebe1d70 cssstyle: set font variations in get_pango_font()
Doesn't make sense to set all the css values on the font description in
there except for the font variations, so do these here as well.
2020-01-18 08:49:52 +01:00
Timm Bäder
dda54b2b8f widget: Get DPI from style directly
Instead of going through GtkStyleContext.
2020-01-18 08:49:52 +01:00
Timm Bäder
821efcb725 cssstyle: Implement get_pango_font() directly
Instead of going through the slow GValue code path. This function was
unused, so use it in GtkWidget's update_pango_context() now.
2020-01-18 08:49:52 +01:00
Timm Bäder
45455f1bdb Remove GtkCssShadowsValue
Previously, we wrapped all GtkCssShadowValues in a GtkCssShadowsValue,
even if it was just one shadow. This causes an unnecessary bloat in
css values.

Make each GtkCssShadowValue able to handle multiple shadows instead, and
use gtk_css_shadow_value* API everywhere.
2020-01-18 08:49:52 +01:00
Matthias Clasen
6e09c5cee8 Quiet compiler warnings in release builds 2020-01-17 23:47:34 -05:00
Matthias Clasen
3182063ffe Quiet a compiler warning
This was causing warnings in a release build.
2020-01-16 13:04:33 -05:00
Matthias Clasen
e8eb1df29f Speed up gtk_widget_pick
Add early exits, and avoid as much work as
possible.
2020-01-15 11:01:20 -05:00
Robert Ancell
83867f9cbf Add missing (closure) GIR annotations 2020-01-13 14:26:50 +13: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
Timm Bäder
73ce437459 widget: Use cssnode api to get the filter value
it's confusing that we use GtkStyleContext here while we use the CssNode
directly elsewhere.
2020-01-07 17:27:18 +01:00
Timm Bäder
6a9bc5daef Avoid a few state changes
We can't optimize the save/restore calls away in the snapshot code, so
do it from the caller side.
2020-01-07 17:27:16 +01:00
Matthias Clasen
448a402353 widget: Remove an unused signal
HIERARCHY_CHANGED is no longer used.
2020-01-06 08:19:01 -05:00
Matthias Clasen
9ba184adf7 widget: Be more careful with roots
We were assuming that all roots are windows,
and calling GtkWindow apis on them.
2019-12-30 00:29:52 -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
Matthias Clasen
7ee5779efc gtk: Remove menu code
GtkMenu, GtkMenuBar, GtkMenuItem and their subclasses
and supporting classes are replaced by model-based popover
implementations.
2019-12-29 20:31:58 -05:00
Matthias Clasen
7e8393ba0f widget: Remove menu special-casing 2019-12-29 20:31:58 -05:00
Matthias Clasen
08d4bb4785 widget: Fix a memory leak
The transform passed to gtk_widget_allocate is
transfer full, so we must consume the reference
before returning.
2019-12-25 09:47:22 -05:00
Matthias Clasen
a02e25ffff widget: Avoid a crash in event handling
I was seeing crashes in gtk_widget_run_controllers.
We were accessing the controller after calling out
to application code that might remove it. Better
be safe and do the access before.
2019-12-25 09:47:22 -05:00
Matthias Clasen
7db2abf918 widget: Fix a small memory leak 2019-12-25 09:47:22 -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
Benjamin Otte
1f94028ff7 builder: Add gtk_builder_set_current_object()
Use it as the default object for expression binds and when connecting
signals. It is intended to work kind of as the "this" object while
parsing. In fact, the term "current object" was stolen from the Java
docs and various C++ tutorials for the this pointer.

Set the current object in gtk_widget_init_template() and
GtkListItemBuilder.

This more-or-less replaces the object passed to
gtk_builder_connect_signals() in GTK3.
2019-12-12 19:12:11 +01:00
Benjamin Otte
b025ee428c builder: Connect signals automatically
gtk_builder_connect_signals() is no longer necessary, because all the
setup that made it necessary to have this extra step is now done
automatically via the closure functions.
2019-11-22 17:42:31 +01: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
ab53731f4a widget: Reinstate custom closure func
It turns out it ws used in various places.
2019-11-22 07:46:18 +01:00
Benjamin Otte
27d05102ab builder: Remove user_data argument from gtk_builder_connect_signals()
This is pretty unused and gets in the way of the next steps.

A potential side effect is that for templates the widget was passed as
the user data argument. If that turns out to be important, we have to
special case that situation.
2019-11-22 07:46:18 +01:00
Benjamin Otte
4eb077979f widget: Don't grab focus when can-focus == false
... inside the default vfunc.

Instead, walk the children until we find the first widget that can be
focused. If no child can be focused, return FALSE from grab_focus.
2019-10-15 16:33:05 +02:00
Benjamin Otte
9c1b1eb894 widget: Insist that widgets are rooted to be focusable
This check was in the vfunc before, but it's a general rule, so apply it
before.
2019-10-15 16:33:05 +02:00
Benjamin Otte
14c34a7014 widget: Make grab_focus() fail on insensitive widgets
We can return FALSE early now instead of silently failing in
gtk_window_set_focus().
2019-10-15 16:33:05 +02: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
c23afb2c86 widget: Compare adjusted sizes in size_allocate 2019-10-09 16:57:22 +02:00
Timm Bäder
d8c940325c widget: Create finalize assertions in destroy() 2019-10-09 16:57:22 +02:00
Timm Bäder
355d3f070a widget: Plug layout manager leak 2019-10-09 16:57:22 +02:00
Timm Bäder
8ec1c866e1 widget: Inline build_finalize_assertions into only caller 2019-09-11 08:12:31 +02:00
Alexander Larsson
73042bfc54 GtkWidget: Precompile template xml on class creation
Ideally we will precompile during build and store the result in the
resource, but if that doesn't happen at least we will only parse
the xml once.
2019-09-10 12:08:20 -04:00
Alexander Larsson
96b37f4eb8 Use the new GtkBuildableParser type in GtkBuildable interfaces 2019-09-10 12:08:20 -04:00
Timm Bäder
1339c425a8 widget: Queue an allocate on native widgets when changing opacity
This way the opacity change works on toplevel windows on wayland.
2019-09-09 17:36:25 +02:00
Timm Bäder
9952f72680 filechooserwidget: Properly watch for different display
The value returned by gtk_widget_get_settings() depends on the widget's
display, so watch for notify::display instead of using (un)root for
this.

Fixes the warnings seen when show a file chooser from the inspector.
2019-09-09 17:36:25 +02:00
Timm Bäder
0821d5b29d widget: Clear up gtk_widget_class_install_property_action docs 2019-09-09 17:36:24 +02:00
Timm Bäder
b3cffc0516 widget: Remove reference to non-existent function
gtk_widget_class_install_stateful_action() does not exist.
2019-09-09 17:36:24 +02:00
Timm Bäder
80a58672d1 widget: Add some missing annotations to gtk_widget_class_query_action 2019-09-09 17:36:24 +02:00
Дилян Палаузов
6ded38de2b Minor typos in the Documentation (a/an) 2019-08-25 12:52:46 +00:00
Timm Bäder
960e766206 widget: Don't duplicate events to translate coordinates 2019-08-15 16:23:01 +02:00
Timm Bäder
1c9fbe3773 widget: Remove captured event handler code 2019-08-15 16:23:01 +02:00