Commit Graph

28657 Commits

Author SHA1 Message Date
Matthias Clasen
3bcdbc3fb2 label: Tweak selection behavior
Arrange for double-click-followed-by-drag to do
select by words, not select-and-dnd. This matches
the behavior in GtkTextView better and feels
intuitive.

Fixes: #2024
2022-12-03 11:19:29 +01:00
Guido Günther
fb72264a27 application: Switch links to gtk-3-24 branch
`master` doesn't exist anymore and we want to refer to a GTK3 example
2022-11-30 10:00:03 +01:00
Matthias Clasen
b009366e21 Merge branch 'keypad-accels' into 'gtk-3-24'
Differentiate keypad keysyms in accelerators

See merge request GNOME/gtk!5176
2022-10-28 04:02:48 +00:00
Matthias Clasen
6cc0552ab8 Differentiate keypad keysyms in accelerators
When displaying accelerators, differentiate keypad
symbols with a 'KP' prefix. Fixing a 17 year old bug.

Backport of c58d9446f40b36136f25baf.
2022-10-27 14:57:01 -04:00
Luca Bacci
bbce00f3a3 GtkTooltip: Scale the cursor size on X11
GtkSettings/X11 takes the values as provided by
XSettings. Unlike other backends, the values of
XSettings are in physical size (that's because
X11 doesn't support mixed-DPI setups anyway).

Take that in account when retrieving the cursor
size in gtk_tooltip_position ().

Note that this discrepancy between the X11 and
other backends has been fixed in GTK4.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5223
2022-10-26 15:21:38 +02:00
Carlos Garnacho
92813e52cd gtkimcontextwayland: Shuffle full resets after IM changes
Doing reset() on the text widgets after commit and delete_surrounding
is still too eager for some IMs (e.g. those that expect being able
to commit text while keeping a preedit buffer shown).

However, reset() is more of a "synchronize state" action on Wayland,
and it is still desirable to do that after changes that do come from
the IM (e.g. requesting the new surrounding text and cursor/anchor
positions). Notably here, the text_input protocol may still come up
with a preedit string after this state synchronization happens.

Shuffle the code so that the text widgets do not reset() the IM
context after text is deleted or committed, but the Wayland IM does
apply its practical effects after these actions happen. This keeps
the Wayland IM fully up-to-date wrt text widget state, while not
altering the ::commit and ::delete-surrounding-text behavior for
other IM context implementations.
2022-10-06 17:40:38 +07:00
Carlos Garnacho
a88e848306 gtktextview: Also reset IM context after IM surrounding text deletion
When the IM commands the GtkText to delete text, the cursor position
would change, and so would the surrounding text. Reset the IM context
so that these updates are properly picked up by the IM.

Fixes backspace	key behavior in	the GNOME Shell OSK, since that	relies
on the surrounding text	being properly updated for the next iteration.
2022-10-06 17:29:50 +07:00
Carlos Garnacho
018083fab7 gtkentry: Also reset IM context after IM surrounding text deletion
When the IM commands the GtkText to delete text, the cursor position
would change, and so would the surrounding text. Reset the IM context
so that these updates are properly picked up by the IM.

Fixes backspace key behavior in the GNOME Shell OSK, since that relies
on the surrounding text being properly updated for the next iteration.
2022-10-06 17:29:50 +07:00
Carlos Garnacho
fa6aca2925 gtkentry: Avoid early IM reset on updates
Resetting the IM on IM updates is too eager and indeed the simple
IM context doesn't like that this happens in the middle of dead
key handling.

We however want to reset the IM after actual text buffer changes
(say, a committed string) moved the cursor position, altered the
surrounding text, etc. So that the IM implementation does know to
update its state.

Since there is going to be an actual IM reset anyways, it does
no longer make sense to try to preserve the old priv->need_im_reset
status during commit handling.
2022-10-06 17:29:50 +07:00
Carlos Garnacho
7b1f9a3b08 gtkentry: Avoid early IM reset on updates
Resetting the IM on IM updates is too eager and indeed the simple
IM context doesn't like that this happens in the middle of dead
key handling.

We however want to reset the IM after actual text buffer changes
(say, a committed string) moved the cursor position, altered the
surrounding text, etc. So that the IM implementation does know to
update its state.
2022-10-06 17:29:36 +07:00
Carlos Garnacho
b0c4196f98 gtkentry: Shuffle the places doing IM reset
During entry widget manipulation (inserting or deleting text via keyboard)
the IM context is reset somewhat early, before the actual change took place.
This makes IM lag behind in terms of surrounding text and cursor position.

Shuffle these IM reset calls so that they happen after the changes, and
ensure that the IM is actually reset, since that is currently toggled on
a pretty narrow set of circumstances.
2022-10-06 17:28:25 +07:00
Carlos Garnacho
0a8b0025e3 gtktextview: Shuffle the places doing IM reset
During text widget manipulation (inserting or deleting text via keyboard)
the IM context is reset somewhat early, before the actual change took place.
This makes IM lag behind in terms of surrounding text and cursor position.

Shuffle these IM reset calls so that they happen after the changes, and
ensure that the IM is actually reset, since that is currently toggled on
a pretty narrow set of circumstances.

Also, fix a bug during GtkEventControllerKey::im-update where the condition
on cursor position editability to reset the IM context was inverted.
2022-10-06 17:16:39 +07:00
Jonas Ådahl
45ba6e9329 wayland: Add support for gtk_surface1_titlebar_gesture()
This adds a private GDK API that GTK calls using GDK_PRIVATE_CALL(). It
is more or less a copy of the GdkSurface::titlebar_gesture() API, and
achieves the same. If the backend or compositor doesn't support titlebar
gestures, the existing path is used as a fallback.
2022-09-30 22:38:03 +02:00
Matthias Clasen
ea9aa8ed82 Fix a critical in GtkFontChooserWidget
When the level doesn't include the style, we need
to work a bit harder to really get a face object
here.

Fixes: #5173
2022-09-13 08:54:09 -04:00
Matthias Clasen
84db04e6e1 Merge branch 'static-builds-hinstance' into 'gtk-3-24'
GdkWin32: Add support for static builds

See merge request GNOME/gtk!4538
2022-08-18 18:05:36 +00:00
Sergio Costas
4892c8901b Further simplification 2022-08-16 23:14:44 +02:00
Sergio Costas
02ea88bba2 Remove unneeded unblock
When a signal handler is disconnected, it doesn't matter if it
was blocked or not, so there's no need to unlock it before
disconnection.
2022-08-15 15:35:06 +02:00
Sergio Costas
c9a3b42734 Unblock signal on update_relative_to in Gtk.Popover
When a Gtk.Popover loses the focus, it blocks the grab_notify
signal from the associated widget, and it unblocks it when it
regains the focus. To know whether the signal is or not blocked,
it uses the priv->grab_notify_blocked flag.

On the other hand, when the method update_relative_to() is
called, all the signals connected to the old associated widget
are disconnected, and connected to the new widget.

Unfortunately, the priv->grab_notify_blocked flag isn't updated,
which means that if update_relative_to() is called while the
Gtk.Popover doesn't have the focus (for example, because the
user switched into another application), when the focus is
regained, the code in window_focus_in() will see that
priv->grab_notify_blocked is TRUE and will unblock the handler;
but that handler wasn't blocked because the one that was blocked
was disconnected when update_relative_to() was called. This
shows a WARNING in the console:

GLib-GObject-WARNING **: ../../../gobject/gsignal.c:2692: handler '5146' of instance '0x556912f84f40' is not blocked

This patch fixes this.

Fix https://gitlab.gnome.org/GNOME/gtk/-/issues/4777
2022-08-15 09:31:24 +02:00
Cédric Krier
31490df2b1 Remove annotation for GError 2022-07-20 09:52:40 +02:00
Cédric Krier
3d406fc446 Fix annotation of serialize and deserialize function 2022-07-20 00:02:42 +02:00
Sébastien Wilmet
fea466c13c docs: improve doc of gtk_style_context_get()
When using this function in GtkSourceView (for GTK 3), there was a
mistake for retrieving a GdkRGBA value.

So, better document the function to avoid further mistakes.
2022-07-13 17:12:42 +02:00
Xu Shaohua
13174cd70d gtkmodifierstyle.c: Release symbolic color memory 2022-06-24 10:05:07 +08:00
Sebastian Keller
4873f63c07 Adwaita: Hide SSD box-shadow border on maximized windows
The 1px shadow was showing up on adjacent monitors when a SSD window was
maximized. Additionally this was causing mutter to skip direct scanout
of these windows, because they extend beyond the screen.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2304
2022-06-19 16:24:59 +02:00
John Ralls
a2c54c739e [quartz] Ensure valid GdkWindowImplQuartz references.
In case of an offscreen window find its onscreen embedder, and NULL
any GdkWindowImpl that's not quartz, checking all return values.

This replaces 16ded683, removing its unnecessary search_for_nearest
functions.

Any unchecked cast of a GdkWindowImpl to GdkWindowImplQuartz risks at
least getting an invalid member reference, not just the ones in
gdk_quartz_window_get_foo, and all calls to gdk_quartz_window_get_foo need
to be checked, not just Gtk's internal calls. The motivation was that
transient_for was getting set on a Gimp offscreen window and that caused a
crash in raise_transient.
2022-06-09 13:22:59 -07:00
Lukas Oberhuber
16ded6835c macos: Fix to offscreen window selections in Gimp 2.99 2022-05-27 21:26:50 +00:00
Emmanuele Bassi
1cf58407be Merge branch 'dont-dist-gresource-srcs' into 'gtk-3-24'
Don't dist some generated sources

See merge request GNOME/gtk!4738
2022-05-25 13:22:23 +00:00
Chun-wei Fan
ff847c43ad Drop win32/Makefile.msvc-introspection
We no longer use the autotools 'dist-hook' to generate the items that we
need to build introspection with the Visual Studio projects, so drop the
autotools files and bits that we had to support this.  So, for
introspection on Visual Studio via the project files, it is purely via
NMake at this point.
2022-05-19 11:33:25 +08:00
Chun-wei Fan
c05d21c9af gtk: Build: Prefix deprecated source listings
...with gtk_, so that they are distinguished from other names and is
more clear to people.
2022-05-19 10:58:01 +08:00
Chun-wei Fan
574bd57f72 gtk-sources.inc: Split base sources in two parts
Otherwise, NMake will choke when creating a filelist from it.  This
U1095 error is nasty! :|
2022-05-19 10:58:01 +08:00
Chun-wei Fan
f4811ea1f1 build: Drop gtk3-install.[vsprops|props]
They are not used anymore, and are removed at this point.
2022-05-19 09:41:48 +08:00
Chun-wei Fan
aa83f9fb42 gtk/Makefile.am: Split out more items
... to gtk-sources.inc, since we will want to share the items in the lists that
were split out.
2022-05-19 09:41:48 +08:00
Chun-wei Fan
e21a578cb1 gtk: Rename gtk-mkenums-headers.mak to gtk-sources.inc
We want to reuse more sources listings in other non-autotools build
systems.
2022-05-19 09:41:48 +08:00
Chun-wei Fan
bac9ff22f5 gtk/Makefile.am: Fix distcheck
Apparently distcheck expects the generated gtk.gresource.xml to be
there.
2022-05-18 15:32:21 +08:00
Chun-wei Fan
39940e0892 gtk/: Don't distribute the generated sources
We already generate some of the sources for all builds, so extend this
to the other generated sources as well, since the Visual Studio projects
added support for generating these sources too.
2022-05-17 18:43:36 +08:00
Peter Bloomfield
54d319bc32 gtkimagedefinition: Extend commit b38266c0
Similarly, uses casts in `gtk_image_definition_unref()`. Compilation
succeeds without them, unlike in `gtk_image_definition_ref()`, because
`gtk_image_definition_unref()` is not called internally, unlike
`gtk_image_definition_ref()`. But the build would fail if some function
defined in the module were changed in the future to call
`gtk_image_definition_unref()`, and we can future-proof it now. This
also removes an inconsistency in how we access the members of the union.
2022-04-30 13:09:04 -04:00
Peter Bloomfield
a5d208adaf gtkimagedefinition: Check array bounds
`jhbuild build gtk+-3` with GCC 12 fails with:
```
In function ‘gtk_image_definition_ref’,
    inlined from ‘gtk_image_definition_new_empty’
    at ../../../../jhbuild/checkout/gtk+-3/gtk/gtkimagedefinition.c:107:10:
../../../../jhbuild/checkout/gtk+-3/gtk/gtkimagedefinition.c:241:13: error:
    array subscript ‘GtkImageDefinition {aka union _GtkImageDefinition}[0]’
    is partly outside array bounds of ‘GtkImageDefinitionEmpty[1]’
    {aka ‘struct _GtkImageDefinitionEmpty[1]’} [-Werror=array-bounds]
  241 |   def->empty.ref_count++;
      |   ~~~~~~~~~~^~~~~~~~~~
../../../../jhbuild/checkout/gtk+-3/gtk/gtkimagedefinition.c:
    In function ‘gtk_image_definition_new_empty’:
../../../../jhbuild/checkout/gtk+-3/gtk/gtkimagedefinition.c:105:34: note:
object ‘empty’ of size 8
  105 |   static GtkImageDefinitionEmpty empty = { GTK_IMAGE_EMPTY, 1 };
      |                                  ^~~~~
```
and many similar errors.

Fix it by casting `GtkImageDefinition` to `GtkImageDefinitionEmpty` or
similar, as appropriate.

Essentially backports 4dcd02e85315f487310e2e01fe9412706a77dc35 from main to gtk-3-24.
2022-04-30 13:08:32 -04:00
Michael Catanzaro
56ada2f01f gtkfilechooser: add missing nullable annotation 2022-04-01 13:14:00 -05:00
Jakub Steiner
5a0ffbbb45 icons: add legacy icons
- add legacy hicolor icons relied on in testsuite

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4754
2022-03-11 19:16:28 +01:00
Luca Bacci
d5ce63508f GdkWin32: Retrieve module HINSTANCE in static builds 2022-03-02 16:25:09 +01:00
Melroy van den Berg
d13e05be93 Fix dllMain win32 2022-03-01 06:03:36 +00:00
Emmanuele Bassi
887c9dea94 Merge branch 'meson-use-gnome-post-install' into 'gtk-3-24'
Meson: Use gnome.post_install

See merge request GNOME/gtk!4379
2022-02-22 10:08:16 +00:00
Bastien Nocera
5c92e6ddc6 inspector: Show app ID and resource path in the General tab
This makes it easier to figure out those values (which are mentioned in
the GtkApplication documentation) rather than working that out from the
way they're generated (or documented as being generated).
2022-02-17 12:27:19 +01:00
Emmanuele Bassi
160ef56de4 Merge branch 'fix-cell-accessible-leak' into 'gtk-3-24'
Fix a leak of cell accessibles

See merge request GNOME/gtk!4471
2022-02-12 00:56:20 +00:00
Matthias Clasen
cc977be580 Fix a leak of cell accessibles
gtk_container_cell_accessible_add_child is transfer none,
so we need to drop the reference we hold, otherwise it
leaks.
2022-02-11 18:39:55 -05:00
Matthias Clasen
38a1a23a53 Merge branch '3-24-30-api-additions-since-marker' into 'gtk-3-24'
Add `Since` markers for new API between 3.24.11 and 3.24.30

See merge request GNOME/gtk!4425
2022-02-08 00:15:10 +00:00
Matthias Clasen
5cdb9548d9 Merge branch 'tiled-border-fix-3-24' into 'gtk-3-24'
theme: Fix incorrect border color for tiled windows for 3.24

See merge request GNOME/gtk!4437
2022-02-08 00:13:27 +00:00
Matthias Clasen
08f47e0b01 Merge branch 'gtkcellrendererprogress-tabular' into 'gtk-3-24'
GtkCellRendererProgress: use tabular figures

See merge request GNOME/gtk!4444
2022-02-07 23:53:50 +00:00
Bastien Nocera
95e9d85716 inspector: Search by pointer address
Useful to find a widget that corresponds to a pointer address in gdb.
2022-02-04 18:16:50 +01:00
Joonas Henriksson
1b78ed4488
theme: Fix incorrect border color for tiled windows 2022-02-02 06:50:52 +02:00
Sebastian Dröge
133ff7687a Add Since marker for GtkHeaderBarAccessible
It was added in 3.24.11.
2022-01-30 19:09:50 +02:00