Commit Graph

1826 Commits

Author SHA1 Message Date
Matthias Clasen
66b062a976 Deprecate GtkMessageDialog
It is getting replaced by GtkAlertDialog

This commit only moves the header to deprecated/,
and keeps the implementation in gtk/, since it will
eventually be salvaged into a private, dialog-free
widget.
2022-10-29 13:31:41 -04:00
Matthias Clasen
e1d78821f6 window: Keep a reference to move_focus_widget
If we don't take a reference, it can happen that
the pointer is no longer valid by the time we
dereference it in after_paint.
2022-10-18 14:23:11 -04:00
Matthias Clasen
f5063c1435 window: Don't focus invisible widgets
Only clear a queued move_focus if the widget
we are focusing is actually visible.

This was happening in some cases when popovers
are dismissed by clicking outside, and it was
causing us to miss proper focus updates that
were already queued.
2022-10-18 06:42:17 -04:00
Matthias Clasen
100605ef0c window: Fix focus updates
This partially undoes changes from 3dbf5038fa.

That commit did two things:
1) Move the focus update to after-paint time
2) Change from grabbing focus to the visible parent
   to  calling move_focus (TAB)

The second part did have the unintended consequence
of moving focus laterally.

Fixes: #4903
2022-10-17 15:10:41 -04:00
Matthias Clasen
dd7cd6ffdd Add more names to sources
This helps with identifying things in sysprof logs,
and while debugging.
2022-09-28 12:37:21 -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
32796cad10 Use gtk_event_controller_set_static_name
This avoids strdups.
2022-08-27 22:35:13 -04:00
Carlos Garnacho
54465adff2 gtkwindow: Use pointer-oriented function to deal with crossing events
Commit adba0b97 fixed missed pointer crossings by using a helper function that
was already present and looked like did everything that was needed. However
this function was oriented to keyboard focus and it also did update the related
widget state. Doing these changes on pointer-based crossing was misuse, and
could cause weird interactions with keyboard focus management.

Fix this by using gtkmain.c gtk_synthesize_crossing_event() that is in fact
oriented to pointers.

Fixes: adba0b97 (gtkwindow: Synthesize pointer crossing events on state changes)
Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5094
2022-08-09 19:48:15 +02:00
Carlos Garnacho
adba0b972e gtkwindow: Synthesize pointer crossing events on state changes
When widgets go mapped/unmapped, we repick but don't generate crossing
events. Since there could be stateful controllers that use those in
the previously picked widget (e.g. GtkEventControllerMotion), skipping
those breaks their state.

Ensure to send the relevant crossing events on every situation that
changes the pointer focus, so these controllers get a fair opportunity
to undo their state.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/2877
2022-08-05 19:25:13 +02:00
Luca Bacci
a1d03e69a4 Add stub gtk_window_export_handle implementation for some backends 2022-06-21 22:56:33 +02: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
Matthias Clasen
d9ad7884e9 window: Update has-focus property
Update the :has-focus property of the focus
widget when the active status of the window
changes.

We change the property after generating the
GDK_CROSSING_ACTIVE crossing events.
2022-03-08 06:05:49 -07:00
Guido Günther
5dca6dce91 window: Make sure we call gdk_wayland_surface_focus
When using xdg_activation this is responsible for submitting
the activation token / startup id to the compositor.
2022-02-28 16:55:54 +00:00
Emmanuele Bassi
226f0e0567 Remove unnecessary warning
Unexporting the window handle on X11 is a no-op, so there's no need
to emit a warning.
2022-02-24 02:04:06 +00:00
Christian Hergert
f8e7ecfde1 window: use GtkNative API to update opaque region
This switches to using the new GtkNative machinery for updating the
opaque region. Some amount of local calculation is still required for
determining when we should apply shadows, and this inherits what was
done previous for that.

Related #4689
2022-02-11 14:37:46 -08:00
Hofer-Julian
ac210c1765 docs: Add missing star to block comment 2021-12-29 15:46:59 +01:00
Hofer-Julian
c58e48e648 doc: Fix docs of window.minimize 2021-12-29 15:45:44 +01:00
Hofer-Julian
acdadab617 docs: Document built-in actions on GtkWindow 2021-12-29 15:45:43 +01:00
Matthias Clasen
f1612e36ee Merge branch 'update_focus_indicators_in_popovers' into 'main'
update focus indicators in popovers

See merge request GNOME/gtk!4124
2021-12-01 01:21:32 +00:00
Benjamin Otte
0709dc7a6a window: Add a new fancy way to compute min size
Try to compute a min size that matches the current aspect ratio.

This means that when interactively resizing, we adapt the min size to
the current window area dynamically.

And that means that we always have a min size that is large enough, but
users can interactively cause it to be small-width x large-height,
large-width x small-width or anything inbetween.
2021-11-21 18:52:42 +00:00
Benjamin Otte
c990134e49 window: Properly distribute size between title and child
Otherwise we can end up with a window that's too small in certain corner
cases after resizing.
2021-11-21 08:19:07 +01:00
Benjamin Otte
358893aa84 window: Always clamp to max size
When computing the window size, always try to clamp to the max size.
This will shrink a window down into a sane size if it was too big
before.
2021-11-21 05:33:28 +01:00
Benjamin Otte
170bc0a8de window: properly compute desired size
Previously, the code did not expand the size properly when a default
size was already set.

Reftest included.
2021-11-21 01:31:06 +01:00
Caolán McNamara
155b791d43 update focus indicators in popovers
https://gitlab.gnome.org/GNOME/gtk/-/issues/4383
2021-11-05 13:50:48 +00:00
Benjamin Otte
811b5d995b gdk: Don't include gdkinternals.h in gdk-private.h 2021-09-24 22:11:57 +02:00
Benjamin Otte
765e78f72b window: Add a titlebar property
It just turns get/set_titlebar into a property.
2021-09-21 02:52:30 +00:00
Benjamin Otte
32871f997e window: Make priv->titlebar the titlebar
It was priv->title_box before - unless priv->titlebar wasn't NULL, then
it was NULL.

Confusing? Yeah, that's why I changed it.
2021-09-21 02:52:30 +00:00
Benjamin Otte
9fb729ccc0 window: Improve set_titlebar() function
Get rid of a goto and check if the titlebar is already set.
2021-09-21 02:52:30 +00:00
Matthias Clasen
0b4817a1c6 window: Drop some dead code
The gtk_window_set_buildable_property implementation
was only used to set the unused builder_visible flag.
Remove both the flag and the vfunc.

This means we no longer have any set_buildable_property
implementations and could eventually drop that vfunc and
the support for it in GtkBuilder.
2021-09-20 00:01:24 -04:00
Timm Bäder
c2ab1f172d window: Fix mnemonics-visible getter+setter annotations 2021-09-18 08:29:18 +02:00
Florian Müllner
3fa26861cd window: Prefer menu bars when handling F10
Focusing the first widget in the titlebar is a good fallback,
but a "real" menubar or :primary menu button should take
precedence.
2021-08-28 00:19:23 +02:00
Matthias Clasen
f5b6488eb2 window: Make resizeability changes work
We were forgetting to update the toplevel
properties here.
2021-08-19 16:03:58 -04:00
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
64af90111e window: Propagate accel changes
When the global accels change, tell the
shortcut controller to re-inject them into
the action muxer hierarchy.
2021-06-17 08:50:26 -04:00
Christian Hergert
a4c5d1d94d window: clear move_focus when focus is already set
This can get set in other places, so we need to ensure it is cleared so
that an after-paint handler does not move the focus to a new widget.
2021-06-10 14:01:41 -07:00
Matthias Clasen
e8852c9a25 Merge branch 'primary-menu-button' into 'master'
menubutton: Enable F10 for primary menus

See merge request GNOME/gtk!3580
2021-06-03 19:37:23 +00:00
Emmanuele Bassi
a88b4f517e docs: Fix link to the interactive debugging section
It's in the "running" document.
2021-06-03 09:31:13 +01:00
Matthias Clasen
a74420bc1a menubutton: Enable F10 for primary menus
Add a ::primary property to GtkMenuButton, which can
be set to make the menu activatable with F10, like
menubars.
2021-05-24 17:27:40 -04:00
Matthias Clasen
91f7b9663f gtk: Clean up docs syntax
Replace leftover gtk-doc syntax (#Type) with backquotes.
2021-05-22 17:25:26 -04:00
Matthias Clasen
4a0d3d7acc docs: Reduce redundancy
Remove a boatload of "or %NULL" from nullable parameters
and return values. gi-docgen generates suitable text from
the annotation that we don't need to duplicate.

This adds a few missing nullable annotations too.
2021-05-20 20:45:06 -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
Carlos Garnacho
6b7b232114 gtkwindow: Fix "shadowed" checks for GTK grabs
We iterate here from the target widget up the toplevel checking
for the previous and new grab, there's however 2 bugs here:
- The check for is_shadowed was different to the check for was_shadowed
- The loop started with the assumption that the widgets did not hold
  a grab, just to change it if the grab widget was found. (or maybe
  it's the other way around? it's unclear with the differing checks
  for past/present state).

Make these checks consistent, and ensure we start with the right
assumption for the past/present grabbing state, and accounting that
new/old grab widgets may or may not be part of the pick stack.
2021-05-18 00:16:55 +02:00
Carlos Garnacho
0a5d21ca9e gtkwindow: Rename function
With gtk_grab_notify_foreach() just taking care of emitting crossing
notifications due to the GTK grab change, rename it to a more apt
gtk_synthesize_grab_crossing().
2021-05-18 00:16:48 +02:00
Carlos Garnacho
f003a4c6cc gtkwindow: Simplify GTK grab notification
The _gtk_widget_grab_notify() function just (maybe) did a) reset
controllers and b) hide toplevels. The second part was a testing
remnant introduced in commit 024d832d94, not part of the original
fix.

Do the former more concisely, called from the place where we figure
out whether a widget's ability to receive events changed due to
GTK grabs. It's across those changes that we are interested in
resetting the controllers.

With the gestures being reset both ways, GtkWindowHandle (and
probably other) gestures are now able to reset after a GTK grab
takes input away (e.g. GtkMenuButton). This could be seen as
a sudden jump the next time they'd be dragged with the mouse,
as the gesture would "resume" the previous interaction.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3942
2021-05-18 00:16:48 +02:00
Matthias Clasen
aa569acaa1 window: Don't let solid-csd linger
Just from reading the code, it seems that we
should unset .csd and .solid-csd at the same
time, since the are mutually exclusive and
we unset them here so realize() can set one
of them again.
2021-04-24 11:29:19 -04:00
Matthias Clasen
1c1c030b8e Simplify shadow conditions
The code in gtkwindow.c for dealing with the various
combinations of client-side decorations and client-side
shadows is entirely too complicated.

This commit does not really clean it up, but simplifies
one of the shadow conditions far enough to make some
sense.

With this change, I get the expected decorations in
all the cases I can easily reproduce locally.
2021-04-24 11:07:20 -04:00
Matthias Clasen
628d5406d7 x11: Fix shadows
Commit a2cd21cab6 changed a condition and inadvertedly
broke client-side shadows on X11. Change this back.

Fixes: #3896
2021-04-24 09:19:18 -04:00
Matthias Clasen
be927d9ce6 Merge branch 'resize-borders' into 'master'
window: Fix up resize borders

Closes #3856

See merge request GNOME/gtk!3467
2021-04-22 11:13:20 +00:00
Matthias Clasen
01d81ffc17 window: Make resize border size independent
Deriving the resize border size from the shadows
carries the risk that we might end up with uneven
resize borders (or none at all, on some sides).

So, justs enforce that we have a big enough shadow
width on all sides.
2021-04-22 06:45:28 -04:00