Commit Graph

2628 Commits

Author SHA1 Message Date
Matthias Clasen
7801dd8944 Merge branch 'wip/phako/fix-activate-action-annotation' into 'main'
widget: Mark format as nullable in activate_action

See merge request GNOME/gtk!4653
2023-01-07 01:06:00 +00:00
Matthias Clasen
eec8cf1309 Deprecate gtk_widget_show/hide
gtk_widget_set_visible does the same job.
2022-12-13 13:46:02 -05:00
Matthias Clasen
23a3bf7a3c Merge branch 'show-hide-cleanup' into 'main'
gtk: Stop using gtk_widget_show/hide

See merge request GNOME/gtk!5273
2022-11-29 07:30:04 +00:00
Matthias Clasen
a46bee1285 Revert "builder: Stop using GtkBuildable.get_id"
This reverts commit 92edd4c476.

This commit changed behavior that GNOME Builder relies on.
2022-11-28 14:36:47 -05:00
Matthias Clasen
f339cc276c gtk: Stop using gtk_widget_show/hide
gtk_widget_set_visible and gtk_window_present
are better alternatives, and calling gtk_widget_show
on newly created widgets is no longer necessary
anyway.
2022-11-28 14:34:55 -05:00
Matthias Clasen
e357ff6055 Drop gtk_widget_buildable_parser_finished
No need to have this no-op implementation.
This was the only implementation of this vfunc
in GTK.
2022-11-20 14:36:35 -05:00
Matthias Clasen
92edd4c476 builder: Stop using GtkBuildable.get_id
Drop the only implementation of this vfunc,
and stop using it. It isn't needed, and the
only implementation did the same thing GtkBuilder
does anyway.
2022-11-20 14:35:36 -05:00
Matthias Clasen
b12d31d189 Fix spelling errors
These were pointed out by codespell.
2022-11-17 22:49:45 -05:00
Emmanuele Bassi
21bc2c5078 docs: Remove mentions of Glade
Glade does not support GTK4, so we should not link to it when discussing
developing GTK4 applications.
2022-10-24 20:11:50 +01:00
Matthias Clasen
d775caff7f Rename gtk_widget_get_style_color
This name wasn't everybody's favorite, so go with
the generic name gtk_widget_get_color() instead.
2022-10-16 21:41:43 -04:00
Sebastian Dröge
294e5bb79f Fix documentation for gtk_widget_get_style_color()
It was pointing at `gtk_widget_get_css_style()` instead.
2022-10-14 12:36:11 +03:00
Matthias Clasen
5627542d7c Add gtk_widget_get_style_color
There is a widespread need to access the CSS foreground
color for custom drawing in snapshot functions, so make
it available after gtk_style_context_get_color was
deprecated with a new widget api.
2022-10-12 15:35:00 -04:00
Matthias Clasen
ee8c2a235f stylecontext: Deprecate most apis
The notable exception here are the global provider apis,
which are needed in some form and don't have a replacement
yet. Move them to gtkstyleprovider.[hc], so we can wholly
deprecated gtkstylecontext.[hc].
2022-10-12 15:35:00 -04:00
Benjamin Otte
d4d0192405 widget: Changing the scale does no longer require a redraw
It doesn't require one generally anyway, because only the root can
change scale and when that happens the root will queue a redraw.

But even if the root doesn't queue a redraw, render nodes (the only
thing discarded by queue_draw()) are scale-independant.
2022-10-09 08:50:32 -04:00
Matthias Clasen
e499a09759 Drop gtkintl.h
Include gtkprivate.h for I_() and glib-i18n.h for
gettext macros.
2022-09-24 10:03:37 -04:00
Matthias Clasen
f33f55bcbb gtk: Use the new debug macros 2022-09-23 18:12:39 -04:00
Matthias Clasen
32796cad10 Use gtk_event_controller_set_static_name
This avoids strdups.
2022-08-27 22:35:13 -04:00
David Demelier
06bec5fb45 gtk: Missing end of code block 2022-07-26 14:52:30 +00:00
Philip Withnall
87ba99f66b gtkwidget: Fix a small typo in a docs comment
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-07-25 23:15:58 +02:00
Emmanuele Bassi
f4f683a469 Rename clear_template to dispose_template
Make it more clear that the function is supposed to be called during the
dispose sequence of a widget.
2022-07-11 18:24:37 +01:00
Emmanuele Bassi
c2ec244b84 docs: Include clear_template() in the templates overview
Make sure that it's clear how to use it in idiomatic code, by tying it
to gtk_widget_init_template().
2022-07-11 18:24:37 +01:00
Emmanuele Bassi
620d48ca0c docs: Clarify scope of gtk_widget_clear_template()
The clear_template() method only clears the template children.
2022-07-11 18:24:37 +01:00
Emmanuele Bassi
7857c1a66b Add gtk_widget_clear_template()
The dual of gtk_widget_init_template(), which should be used to clear
the template data associated with a specific GtkWidget type.
2022-07-11 18:24:37 +01:00
Sophie Herold
a546ae32d7 Remove all nicks and blurbs from param specs
Those property features don't seem to be in use anywhere.
They are redundant since the docs cover the same information
and more. They also created unnecessary translation work.

Closes #4904
2022-05-11 18:16:29 +02:00
Jens Georg
b9551a8952 Remove obsolete "or %NULL" documentation 2022-04-20 15:15:51 +02:00
Jens Georg
e600fcbcc5 widget: Mark format as nullable in activate_action
The doc and the code allow it to be NULL
2022-04-19 10:17:39 +02:00
Benjamin Otte
7149bfd100 widget: Don't queue an allocate on a nonexisting parent
No test, no idea how to trigger this reliably.
2021-12-26 22:17:54 +01:00
Benjamin Otte
15528599f4 Merge branch 'wip/otte/for-master' into 'master'
window: Always clamp to max size

See merge request GNOME/gtk!4185
2021-11-21 18:44:26 +00:00
Emmanuele Bassi
031aab3ef6 Merge branch 'ebassi/issue-4421' into 'master'
Unrealize ATContext on unroot

Closes #4421

See merge request GNOME/gtk!4136
2021-11-21 15:36:25 +00:00
Benjamin Otte
822508f33e widget: Clear size request cache on queue_resize()
... and not later.

Otherwise future calls to sizing fucntions will reuse an outdated cache
and compute wrong values.
2021-11-21 06:08:06 +01:00
Benjamin Otte
1eb86d6394 widget: Remove a check
That consistency check is entirely outdated and just prints confusing
stuff.
2021-11-20 06:04:10 +01:00
Benjamin Otte
50e0893497 widget: force adjustment method is one size is FILL
If halign=fill, force adjustment to height-for-width.
If valign=fill, force adjustment to width-for-height.
Otherwise look at request mode.

This way we don't try to adapt the filled dimension and only adjust
the one that is not set to fill.
2021-11-20 06:04:10 +01:00
Benjamin Otte
7459d430eb widget: Don't forget margins when adjusting
This could lead to the wrong values being passed and computing invalid
sizes which would then lead to very unhappy code.

Test included.
2021-11-19 23:46:59 +01:00
Carlos Garnacho
615b8fc569 gtkwidget: Do not check event sequence state before cancelling gesture
The sequence should be cancelled from the gesture despite its current state.
Also, there was a piece of pointer emulation that was not dropped here,
maybe breaking things further for the pointer emulated touchpoint.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4387
2021-11-16 00:41:17 +01:00
Emmanuele Bassi
018388d321 Unrealize ATContext on unroot
Non-root widgets should unrealize their ATContext, if they have one,
when they are unrooted, as they don't have a connection to a top level
any more.

Fixes: #4421
2021-11-08 10:18:22 +00:00
Emmanuele Bassi
59f45aa30c docs: Fix wrong fragments in type links
Due to a bug in gi-docgen we're not getting a warning if a fragment to a
type does not match the actual type, and we're generating a broken link.

See: https://gitlab.gnome.org/GNOME/gi-docgen/-/merge_requests/120
2021-11-07 18:40:24 +00:00
Benjamin Otte
1606a41116 widget: adjust allocation even better
This fixes fallout from 3742fabae0 where
we would no longer allocate widgets to their natural size when
align flags where used.

GtkPicture wants to be allocated at 100% in that case, so a picture with
a 100x100 image inside a 200x200 window should be allocated 100x100.

The new adjustment code now does the following (for width-for-height
instead of height-for-width, swap width and height in the following):

1. query the minimum width for the allocated height
2. query the natural width
3. compute the maximum of (1) and (2)
4. set the widget width to the minimum of (3) and the allocated
   width.
5. compute the natural height for (4)
6. set the widget height to the minimum of (5) and the allocated height.
2021-10-22 17:51:40 +02:00
Benjamin Otte
3742fabae0 widget: Don't overadjust allocations
When adjusting allocations, don't query height for the current width,
but query it for the adjusted width.

And adjust width not to the width-for-any-height, but to
width-for-allocated-height.
2021-10-19 01:55:59 +02:00
Matthias Clasen
a9b81577c6 widget: Provide a helper for updating pango contexts 2021-09-04 15:42:05 -04:00
Matthias Clasen
eaa2dada54 Rename an internal function
It occupies a name I want to reuse for something else.
2021-09-04 15:42:05 -04:00
Matthias Clasen
26e632e549 widget: Redraw when font options change
Its the right thing to do, even if it is a rare event.
2021-09-03 13:56:29 -04:00
Matthias Clasen
b26a370ce4 Add a gtk-hint-font-metrics setting
This lets people switch back to font rendering that is closer
to what GTK 3 does. It is not perfect - subpixel antialiasing
is not going to work. But it give us an Escape hatch while
we shake out the bugs in our linear layout.

Related: #3787
2021-09-01 15:52:07 -04:00
Alexander Mikhaylenko
342f02711b widget: Fix gtk_widget_class_query_action() annotations
Add transfer none on all out values as they aren't being copied.
2021-08-11 14:33:38 +05:00
Matthias Clasen
04f3c8054b Merge branch 'callback-annotation-again' into 'master'
widget: Change callback scope

See merge request GNOME/gtk!3796
2021-08-10 01:16:56 +00:00
Florian Müllner
bc386c9a60 widget: Change callback scope
Look who changed his mind since commit 8e2ffb3b46 :-)

The "call" scope means that the callback is only used during the
function call itself (here: gtk_widget_class_install_action()).

That's clearly wrong here, as the callback is invoked every time
the action is activated.

Arguably the "notified" scope is a better match here, where the
lack of a GDestroyNotify parameter suggests that the callback may
be used forever (which is the case here).

Related: #3498
2021-07-28 21:48:01 +02:00
Matthias Clasen
ee6491f717 widget: Avoid some unnecessary back-and-forth casting
Avoid some unnecessary casting and a redundant early exit.
2021-07-24 18:49:27 -04:00
Matthias Clasen
7044951dab widget: Avoid GObject data for action muxer
Most widget have an action muxer now, so just
store it in GtkWidgetPrivate.
2021-07-24 18:48:10 -04:00
Marco Melorio
eacfa2a966 doc: Syntax fixes 2021-07-13 22:53:19 +00:00
Matthias Clasen
4c2761302a doc: Syntax fixes
No, we can't have links that say [constructor@...] or
[mehtod@...] or [methoc@...] or [methos@...] or [metohd@...].
And no, not [signals@...] either.
2021-05-25 07:33:55 -04:00
Matthias Clasen
13a93489b7 widget: Cosmetic docs changes 2021-05-22 17:25:26 -04:00