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
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
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).
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.
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.
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)
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
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.
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.
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++;
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.
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>
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)
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_2099344Fixes: #454
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.
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.
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.
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
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
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.