Commit Graph

28781 Commits

Author SHA1 Message Date
Gaël Bonithon
34c12e4885 gtkdnd: Keep a reference on destination drag context
If we don't keep a reference on it, it is released somewhere before
gtk_drag_abort_timeout is called. This can cause a crash e.g. when the
dnd takes place in the GtkSocket/GtkPlug framework.

Fixes: #7128
2025-03-05 17:19:12 +01:00
Gaël Bonithon
2353a7a176 gtkdnd: Add missing sanity check
Can be NULL when the dnd takes place in the GtkSocket/GtkPlug framework.
2025-03-05 16:56:59 +01:00
Emmanuele Bassi
e8dbe4049d Add more translatable attributes in the ITS file
GtkBuilder uses GMarkup, which defines a boolean attribute as:

- yes/no
- true/false
- 1/0

The current ITS file used by xgettext to extract translatable strings
from GtkBuilder UI files only covers the first value.

See: 9e83eb65017cb38b809c733535195507bd442bd8

See: #4596
2025-03-02 14:18:16 +00:00
Matthias Clasen
b5f3117801 Merge branch 'gtk3_a11y_small_fix' into 'gtk-3-24'
GtkBooleanCellAccessible: fix AtkAction iface methods

See merge request GNOME/gtk!7840
2025-02-21 17:02:30 +00:00
Matthias Clasen
7eeafe292e Merge branch 'cm/fix-statusicon-leak' into 'gtk-3-24'
statusicon: Fix leak in gtk_status_icon_color_changed

See merge request GNOME/gtk!7841
2025-02-21 17:01:52 +00:00
Matthias Clasen
ff29793fb6 Merge branch 'cm/fix-context-leak' into 'gtk-3-24'
updateiconcache: Fix GOptionContext leak in 3.24

See merge request GNOME/gtk!7917
2025-02-21 16:57:15 +00:00
Matthias Clasen
6f80370a48 Merge branch 'cm/fix-updateiconcache-path-leak' into 'gtk-3-24'
updateiconcache: Fix path leak in scan_directory

See merge request GNOME/gtk!7915
2025-02-21 16:56:51 +00:00
Matthias Clasen
32381771b1 im: Fix signal handler signature
This was causing crashes, probably since 2019 :(

Fixes: #7306
Fixes: #7331
2025-02-12 12:34:36 +01:00
Matthias Clasen
c4c3e01849 text: Add a way to override direction
Add a Ctrl+Shift+T shortcut to toggle the widgets direction,
to give the user control in the rare cases where a different
direction is appropriate.

This is a backport of 0b33abe44b4f42cba (without the context
menu item, since that needs new strings).
2025-01-24 12:17:31 -05:00
Matthias Clasen
5c6f33d1f3 entry: Drop keyboard direction leftovers
Now that we are no longer relying on keyboard direction to
determine the direction of empty entries, there's no need
for a direction-changed signal handler.
2025-01-24 11:39:32 -05:00
Matthias Clasen
fd6eb60478 entry: Remove text direction complications
Instead of trying to derive a direction from content and
keyboard layout, just let the widgets direction prevail.
This avoids irritating jumping text on focus in, in situations
where the directions are mixed.

See discussion in !7971

This is a backport of d0bfed5195be99c21e.
2025-01-24 11:05:07 -05:00
Matthias Clasen
755c314465 Make numeric spin buttons LTR
This is the expected way to enter Latin digits.

See discussion in !7971.

This is a backport of e7531b738e2ef2a.
2025-01-24 11:04:44 -05:00
Matthias Clasen
15a6061890 Stop replacing : (colon) with U+2236 (ratio)
The new default GNOME font already does the right thing for
colon in numeric context, and this replacement can show up
as a missing glyph on other platforms. So, just rely on
smart fonts, going forward.

Fixes: #7279
(cherry picked from commit e4d919a2df73f0fe5ccb1657fed97ce5673aa542)
2025-01-20 23:27:17 +00:00
correctmost
0b874d13a7 updateiconcache: Fix path leak 2025-01-12 00:08:42 -05:00
Sergio Costas
e71a817fff gtk3: Fix enter and leave signals in EventControllerMotion
The Gtk.EventMotionController implementation in Gtk3 doesn't
emit the enter or leave signals when the mouse cursor enters
or leaves the associated widget.

After doing several tests, I discovered that the
gtk_event_controller_handle_event() method never receives any
of the events from the Gtk core, although they are generated
inside the core and enter-notify-event and leave-notify-event
signals are correctly emited.

This patch fixes it by adding the missing
gtk_widget_real_XXXXX_event handlers for enter and leave
event notifications.

Fix #7225
2025-01-04 12:41:08 +01:00
Matthias Clasen
6a59d61edd Merge branch 'wip/gtk-3-24-emoji-16' into 'gtk-3-24'
[gtk3] emoji: Update data to CLDR v46

See merge request GNOME/gtk!7992
2024-12-06 23:58:57 +00:00
Matthias Clasen
65df8d197d accelgroup: Fix a doc comment
The escaping madness with gtk-doc is different.

Lets see if this works.
2024-12-06 17:15:46 -05:00
Jeremy Bícha
a97513bd8d emoji: Update data to CLDR v46
Based on emojibase commit 04b7926

Contains the changes in Unicode 16.0

https://unicode.org/versions/Unicode16.0.0/
https://cldr.unicode.org/index/downloads/cldr-46
04b79264e4
2024-12-05 09:24:54 -05:00
Nate Graham
3adefdb319 Use semantically appropriate spinbox button icons 2024-11-21 19:20:51 +00:00
correctmost
d84d16018f updateiconcache: Fix GOptionContext leak in main 2024-11-12 18:33:10 -05:00
correctmost
cd7fa32866 updateiconcache: Fix path leak in scan_directory 2024-11-12 03:15:11 -05:00
correctmost
0eafe81a4f statusicon: Fix leak in gtk_status_icon_color_changed 2024-10-16 17:25:41 -04:00
Juan Pablo Ugarte
37752bd484 GtkBooleanCellAccessible: fix AtkAction iface methods
Fix gtk_boolean_cell_accessible_action_get_name() and
gtk_boolean_cell_accessible_action_get_localized_name()
parent class call.
2024-10-16 17:04:05 -04:00
correctmost
3d737519f1 menuitem: Fix leak in _gtk_menu_item_popup_submenu
Previously, the PopupInfo data would leak if the timer was
cleared before the gtk_menu_item_popup_timeout callback ran.

Fixes #1715
2024-09-16 14:55:25 -04:00
Matthias Clasen
4c92ca1857 Merge branch 'gtk3-remove-warning-export-handle' into 'gtk-3-24'
Remove warning "Couldn't export handle, unsupported windowing system"

See merge request GNOME/gtk!7694
2024-09-06 12:39:18 +00:00
Hannes Müller
9191dfe2e2 Remove warning "Couldn't export handle, unsupported windowing system"
For GDK_WINDOWING_BROADWAY, GDK_WINDOWING_WIN32 and GDK_WINDOWING_QUARTZ
links open correctly. For example, for GDK_WINDOWING_WIN32 this happens
via gspawn-win32-helper.exe / gspawn-win32-helper-console.exe. If these
helpers are missing, a corresponding error message is displayed, see
e.g. gtk3-demo.exe => Links. So there are already other error messages
if something goes wrong. For gtk4 the behavior also occurs without
warning. In my view this warning is more confusing than helpful.
2024-09-06 13:06:02 +02:00
Matthijs Velsink
7d1b9bf280 selection: Fix portal retrieval of GVFS files
When drag-and-dropping a file from Nautilus to for example Firefox, this
does not work if the file is from a GVFS mounted source. The retrieved
URI with `g_file_get_uri()` still contains the protocol.

Instead, we can use `g_filename_to_uri()`, which resolves to the local
`file://...` URI instead.

A similar fix was applied to GTK4 on the sending side in commit
ea056d26.
2024-08-24 17:45:46 +02:00
Matthias Clasen
f22e5b0b23 Avoid criticals on headless systems
If we don't have a monitor, don't try to use it.
This avoids pointless critical warnings on headless systems.
2024-08-22 11:20:17 -04:00
Matthias Clasen
8e6cc9b5c9 Merge branch 'work/gtk-3-24' into 'gtk-3-24'
gesture: set widget x and y if coordinate translation between widgets fails

See merge request GNOME/gtk!7513
2024-08-16 17:35:00 +00:00
Michael Weghorn
939737c3e7 a11y: Use non-empty message dialog title as a11y name
If a `GtkMessageDialog` has a non-empty title set, use
that for the accessible name instead of a generic name
indicating the type of the message dialog, as the
window title is generally more informative, if set.
It also better matches the information presented
visually on screen (in the window title, task switchers,...)
and is in line with the handling for non-message-dialog
windows.

This can easily be tested with the "Dialogs and
Message Boxes" sample from gtk3-demo when setting
a title for the message dialog in there like this:

    diff --git a/demos/gtk-demo/dialog.c b/demos/gtk-demo/dialog.c
    index 0eb1c62397..53fb7f8b0e 100644
    --- a/demos/gtk-demo/dialog.c
    +++ b/demos/gtk-demo/dialog.c
    @@ -25,6 +25,8 @@ message_dialog_clicked (GtkButton *button,
                                        "number of times:");
       gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
                                                 "%d", i);
    +  gtk_window_set_title (GTK_WINDOW (dialog), "Some informative title");
    +
       gtk_dialog_run (GTK_DIALOG (dialog));
       gtk_widget_destroy (dialog);
       i++;
2024-08-09 21:02:50 +02:00
Michael Weghorn
13f55cd3e6 a11y: Extract helper function to set GtkMessageDialog a11y name
Extract the existing logic to set an accessible name for the
`GtkMessageDialog` based on the message type from `setup_type`
to a new helper function `update_accessible_name`.

That helper function will be reused and extended in a follow-up
commit.
2024-08-09 21:00:54 +02:00
likai
a1046a13da gesture: set widget x and y if coordinate translation between widgets fails
Bug Description: In a GTK+ application with a menu bar, clicking the
menu item displays a dialog. However, when the user opens this dialog
and drags the parent window's menu bar with the cursor, the dialog
gets moved.
Issue: When _gtk_gesture_update_point calls the _update_widget_coordinates
function, the local variables x and y are not explicitly initialized, leading
to arbitrary values. For instance, in my case, x was 32767 and y was
-145750164 . These values are used in the subsequent call to
gtk_widget_translate_coordinates. In gtk_widget_translate_coordinates,
if ancestor is NULL, the function returns FALSE, and dest_x and dest_y
are not updated. The incorrect values of x and y cause data->widget_x
and data->widget_y to be incorrect, ultimately leading to abnormal
x and y values in the gtk_gesture_drag_update function.

To avoid this, we should set x and y to values clearly outside the widget.

Signed-off-by: Li Kai <likai@kylinos.cn>
2024-08-07 22:13:59 +08:00
Benjamin Otte
39345212e8 immulticontext: Don't have a global_context_id
Context IDs are dependant on the display - both because displays can use
different backends, but also because changing the GtkSetting is a
per-display operation.

So just remove the cache.
If it turns out we need a per-display cache, we can add one to
GtkSettings.

(cherry picked from commit 16d4ce4d0301b7af2a67703e792efdcf27b1d397
 with slight changes to use priv->client_window instead of
 priv->client_widget)
2024-08-02 17:27:16 +02:00
Danial Behzadi
cd9174daa2 Mark "%-e %b" as "no-c-format" for xgettext. 2024-07-01 19:31:40 +00:00
Matthias Clasen
e81aad25a1 Merge branch 'gtk3-module-loading-fix' into 'gtk-3-24'
Stop looking for modules in cwd

See merge request GNOME/gtk!7361
2024-06-15 21:58:49 +00:00
Matthias Clasen
3bbf0b6176 Stop looking for modules in cwd
This is just not a good idea. It is surprising, and can be misused.

Fixes: #6786
2024-06-15 14:18:01 -04:00
Christoph Reiter
fcc5219910 gtkprintoperation-win32: fix the build on Windows with GCC 14.1.0
Both cases expect a DLGTEMPLATE but the docs say that DLGTEMPLATEEX
works too, despite it being a different struct, so just cast it.
See https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-createdialogindirectw

This avoids two "-Wincompatible-pointer-types" which GCC 14 switched
to being an error by default.
2024-05-16 23:04:27 +02:00
Michael Weghorn
5147e95d1d a11y: Port from deprecated atk_focus_tracker_notify
Port `gail_focus_notify` from using the deprecated
`atk_focus_tracker_notify` to notify about the new
focus object. Notify of a state of the focused state
instead, as suggested in the
`atk_focus_tracker_notify` doc [1].

Using the deprecated function e.g. resulted in
the Orca screen reader no longer announcing
initial focus on editable comboboxes in
LibreOffice Writer's toolbars after Orca dropped
support for the deprecated "focus" AT-SPI event
in this commit [2]:

    commit 9e2902dd46c7e583a097e235dfd7e3c50b016383
    Author: Joanmarie Diggs <jdiggs@igalia.com>
    Date:   Wed May 1 12:14:07 2024 +0200

        Remove the on_focus handler for the LibreOffice script

        The "focus:" event was deprecated many years ago. If the expected
        "object:state-changed:focused" event is absent, that bug should
        be fixed.

This commit makes the announcement work again.

It also fixes the scenario described in [3].

[1] https://docs.gtk.org/atk/func.focus_tracker_notify.html
[2] 9e2902dd46
[3] https://gitlab.gnome.org/GNOME/gtk/-/issues/454#note_2099344

Fixes: #454
2024-05-08 12:52:42 +02:00
Matthias Clasen
5c3d176c00 css: Avoid an uninitialized GValue
One of the confusing aspects of GOBject. When we say
'an uninitialized GValue', we mean one that is declared
via GValue v = G_VALUE_INIT;

Fixes: #6655
2024-04-24 07:24:27 -04:00
Carlos Garnacho
e9f2daa445
searchengine: Do not fight filechooser search mode sorting
Provide the hits in an order that is more easily consumed by the
filechooser, and less jarring when populating.
2024-03-18 02:02:04 +01:00
Carlos Garnacho
b62a280e0c
searchengine: Bail out on the first character
Again on massive filesystems, the very first character
is likely to bring a likewise massive amount of search
results that we need to maybe query info for, then create
icons and widgets for. While it's impressive we can do
that, it's also expensive and likely pointless, for the
first character.

Typing a second character is however very likely to
considerably reduce the amount of items to categorize and
show. So start actually searching from there.

Testing on a filesystem with 1434099 files indexed, trying 5
semi-random 1 character searches (n, h, t, i, o) returns on
average 168K items (min. 78771, max. 331471), trying 5
semi-random 2 character searches (no, he, th, in, on)
returns on average 34K items (min. 11133, max. 94961),
which is a more approachable set.

Doing this is enough that typing on a filechooser search
entry feels completely fluid.
2024-03-18 02:02:03 +01:00
Carlos Garnacho
4baa0b47e2
searchengine: Ensure some GFileInfo fields
The search provider should make it sure there are some
specific GFileInfo fields set. Fix the mimetype extraction
from the query, and use that to fill in the missing gaps
the best we can.
2024-03-18 02:02:03 +01:00
Carlos Garnacho
f550bd6391
searchengine: Populate filesystem model in an idle
When starting a search over a very populated filesystem, it
is possible that typing the first chars will return a too
high number of results. Even though iterating through the
cursor is in itself very fast, extracting the GIO information
from those many files at once is not going to be as fast.

In order to increase interactivity (i.e. not make things
possibly sluggish) iterate the cursor in an idle function
and add search results to the filechooser model little by little.

If the user keeps typing (as it is likely will happen), there
will be better chances to cancel and proceed to the next
query timely. If not, the results will be there soon enough.
2024-03-18 02:02:01 +01:00
Carlos Garnacho
870ecf2b81
searchengine: Improve performance for recursive search
As fancy as property paths are, recursive resolution of files
to a location increases the big O complexity enough that it's
not a great option on large homedirs with many indexed files.

Ensure the files are from the right location through a URI
prefix match, which does hits an index. This may dramatically
improve performance on large indexed trees.

Testing this query in an isolated testcase with a total
1434099 indexed files shows that it can run more than 1500 times
per second in this computer (an average of 15200 queries in
several 10 second runs), which presumably is a tad faster than
anyone can type.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4133
2024-03-18 02:01:01 +01:00
Matthias Clasen
190f111d8e box gadget: Drop a critical
Nobody is going to track these allocation failures down in gtk3
at this point, so drop the alarming message. The failures are
pretty harmless.
2024-03-14 21:50:00 -04:00
Emmanuele Bassi
8a26450bba Sink the floating ref on the file filter
The GtkFileChooserEntry widget creates a file filter instance, but never
sinks its floating reference. Newer versions of GLib correctly warn if
an instance with a floating reference gets finalized.

Fixes: #6527
2024-03-11 10:41:40 +00:00
Matthias Clasen
fa1fd6b5c7 Merge branch 'quartz-selection' into 'gtk-3-24'
Finish fixing pasteboard constants macOS 10.14 and later.

See merge request GNOME/gtk!6954
2024-03-01 16:32:50 +00:00
Matthias Clasen
bb99970746 Merge branch 'fix-possible-segfault' into 'gtk-3-24'
dnd: Prevent a possible segfault

See merge request GNOME/gtk!6957
2024-02-28 18:52:53 +00:00
Matthias Clasen
889057a386 dnd: Prevent a possible segfault
It is at least theoretically possible that gtk_entry_get_pixel_ranges
will return no ranges, and we should handle that without an
out-of-bounds access or segfault.
2024-02-28 13:20:59 -05:00
John Ralls
7e9676d658 Fix Cocoa pasteboard constants for gtk.
Corresponds to gdkselection-quartz changes in f30ed5ddc.
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/6480
2024-02-27 12:31:16 -08:00