Commit Graph

28694 Commits

Author SHA1 Message Date
Matthias Clasen
8e48e6548b Merge branch 'doc-link-fixes' into 'gtk-3-24'
docs: Fix some links

See merge request GNOME/gtk!5718
2023-03-25 14:20:24 +00:00
Matthias Clasen
19c2e87627 docs: Fix some links
The links to the overview sections were all broken.
Fix them.
2023-03-25 10:09:00 -04:00
Christian Hergert
c26a209283 inspector: add im-module
This adds a new row to the Global/Information section which displays the
GTK im-module that is likely to be in use unless changed by an application.
It responds to updates of GtkSettings:gtk-im-module unless the
GTK_IM_MODULE environment variable is set.

Fixes #4512

(cherry picked from commit 6be352f4468b4dbbb1d71f427948dda154b9a658)
2023-03-23 21:26:33 +01:00
Matthias Clasen
22dd7189bb inspector: Show the pango backend
(cherry picked from commit 7eb5dfd2947c8e8de0957f4339af66b47811f2c7)
2023-03-23 18:59:40 +01:00
Emmanuele Bassi
c1fa916e88 Check for attribute availability before accessing it
Starting from GLib 2.76, the standard attribute getters in the GFileInfo
object will warn if the attribute is unset, instead of silently bailing
out and returning a default value.
2023-03-13 11:54:01 +00:00
Nelson Benítez León
2c951f122d dark theme: create $caret_color and use it
Fixes Evince showing a dark caret when using
dark theme, which makes it almost invisible.

This is in css node "textview text" of Evince
annotation window (a GtkScrolledWindow).

We create a new $caret_color var based on
$text_color and use it accordingly.

Fixes evince#1842
2023-03-12 18:50:56 -04:00
Matthias Clasen
5fee632386 selection: Use the right mime type
The correct mime type for portal file transfers
is application/vnd.portal.filetransfer.

Fixes: #5643
2023-03-06 23:07:53 -05:00
Benjamin Otte
b56202937a liststore: Fix gtk_list_store_iter_is_valid()
The iter may be invalid, so we may not read from it.

testsuite/gtk/treemodel tests this and valgrind is shouting about it,
but it never crashed until I just ran it...

This bug is from 2004 and the test is from 2007. I guess invalid memory
accesses don't get caught by CI much.
2023-03-02 19:29:42 -05:00
Matthias Clasen
6402137bbf impcontextsimple: Return from GTask
GLib complains about this now, so do it.
2023-03-02 19:18:34 -05:00
Carlos Garnacho
a3c604d5cc gtkwindow: Fix fallbacks through xdg_activation_v1
When activating a window, avoid the "old" gdk_notify_startup_complete*()
API that does not fallback into xdg_activation on wayland (as this is still
deferred here until show vs present happens on the surface). This was
mistakenly changed wrt the original commit backported from GTK4.

Fixes: a067938589 ("gtkwindow: Minor refactor")
2023-03-01 17:14:01 +01:00
Matthias Clasen
9f81db139d selection: Support the file transfer portal
When the selection target is application/vnd.portal.files,
send files through the file transfer portal.
2023-02-25 08:41:07 -05:00
Gaël Bonithon
857f734d83 searchengine: Emit a simple warning when tracker init failed
Failure is allowed by nature of GInitable, and this avoids unnecessary
crashing of programs running with G_DEBUG=fatal-criticals.

(cherry picked from commit 6215b38e645f5047d52e625562efccc1e4f85867)
2023-02-09 23:21:04 +01:00
Gaël Bonithon
8497425535 searchengine: Add missing sanity check
(cherry picked from commit 41490f96240eb04d85cbe5e1f264ab09ec00b9e0)
2023-02-09 23:20:47 +01:00
Matthias Clasen
5554113c74 Merge branch 'gtk-3-24' into 'gtk-3-24'
Fixes incorrect grabbing behaviour causing subsequent rejection of input

See merge request GNOME/gtk!5212
2023-01-28 17:46:05 +00:00
hrdl
15f0ac6f93 Remove warning 2023-01-28 14:20:49 +01:00
Alexander Mikhaylenko
384d9a75cd Revert "Revert "wayland: Add support for gtk_surface1_titlebar_gesture()""
This reverts commit 5aaa373b70
2023-01-28 09:41:34 +00:00
Matthias Clasen
5aaa373b70 Revert "wayland: Add support for gtk_surface1_titlebar_gesture()"
This reverts commit 45ba6e9329.

This caused regressions in libhandy-using applications.

Fixes: #5389
2023-01-27 21:34:44 -05:00
Matthias Clasen
b6795f8ff9 Merge branch 'wip/carlosg/startup-vs-focus-3-24' into 'gtk-3-24'
Consider startup vs focus requests for the Wayland platform [3.24]

See merge request GNOME/gtk!5443
2023-01-25 13:09:17 +00:00
Carlos Garnacho
79e11bed1a gtkapplication: Do not call gdk_display_notify_startup_complete()
This should do nothing worthwhile anymore, the X11/Wayland GtkApplication
implementations do already pass the startup ID from the platform_data
via windowing specific APIs, and the application handling the request
via show()/present() should trigger the activation request.

(cherry-picked from commit 3526d8b299becb7cd1e970ea5228a141eae20257)
2023-01-25 11:22:40 +01:00
Carlos Garnacho
2a47038635 gtkwindow: Shuffle gdk_window_set_startup_id() calls
While this used to be tangential to windows showing or requesting
focus, the xdg-activation Wayland protocol does merge both concepts
together.

But also, for a correct interaction with the compositor, the
toolkit should ideally merge the activation request resulting from
both into the same one, so that the gdk_window_focus() request
replies to the startup token that started the application and
correct focus-stealing prevention/etc happens, instead making up
one just in time for the focus request.

This kind of requires doing things in the right order, a show()
request on the GtkWindow should activate any pending activation
token on the toplevel, a present() request should additionally
create a new token if there was none pending. And
xdg_activation_v1_activate() should happen once on both.

Shuffle the gdk_window_set_startup_id() calls so that this
happens in the right order for Wayland, while making X11 happy
too.

(cherry-picked from commit e8adfa2a889cd45ee0ce0727d7eae0a61fdb7dce)
2023-01-25 11:22:40 +01:00
Carlos Garnacho
a067938589 gtkwindow: Minor refactor
Move the handling of the startup ID to a separate function, since
this will be called from several places.

(cherry-picked from commit 6f01f846dc66a6359a1524ace13377536821dbb0)
2023-01-25 11:22:40 +01:00
Brian J. Tarricone
89c7d5fe4b Take UI scale into acount when loading "image-missing" fallback
Fallback icons loaded were loading at half size (for a 2x scale) and for
cases where it mattered, were being positioned off-center.
2023-01-21 12:47:40 -08:00
Matteo Percivaldi
6a2fb84446 gtkcssanimatedstyle: Fix return of new_advance()
This was causing animation and transition to stop randomly and reset
their state to initial state.

This issue has existed since commit
7b68bdb831.

Closes #4426
2023-01-13 15:20:01 -05:00
robxnano
c1aec7f100
filechoosernativewin32: Set default extension
Setting the default extension before a filter is selected allows
the IFileDialog to automatically change the extension when the
filter is changed. See:
https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-setdefaultextension
2023-01-07 18:21:54 +00:00
Matthias Clasen
2f6d0792f8 Merge branch 'gtk3_fix_chooser_dead_tilde_trigger_location' into 'gtk-3-24'
Fix open location entry when pressing '~'

See merge request GNOME/gtk!4971
2022-12-13 13:00:36 +00:00
Matthias Clasen
3b9531d3d3 Merge branch 'ebassi/no-more-autotools-redux' into 'gtk-3-24'
Drop the Autotools build

See merge request GNOME/gtk!5299
2022-12-13 12:10:34 +00:00
Ross Burton
8eb4e59613 Use @basename@ in enumeration type templates
The @filename@ directive will use the full path of the file being parsed
for enumeration types; we should use @basename@, instead, as it improves
the reproducibility of the build by using only the file name.

Backport of 4040f76529bbf6d3310a71df2d37c9d95af83892 from main.
2022-12-12 13:09:53 +00:00
Guido Günther
900454e9d9 emojichooser: Actually disable the recent section
The loop sets empty = FALSE when there are emojis but for that
to work we need to initialize the value to TRUE initially.

Fixes: 7928532bc5c33b2c6a10bae138ebc6dca1843cb0
(cherry picked from commit 89c816a614db4083e80862b631f4b3e44aa17eae)
2022-12-08 13:12:54 +01:00
Emmanuele Bassi
2b0a605c5d build: Remove the Autotools build
CI and downstream packagers have been using the Meson build for a while
now, and we checked that it's idempotent to the Autotools build.

Having two build systems in tree doesn't make maintaining and releasing
GTK any easier, even if it's the stable/frozen branch.
2022-12-08 11:57:39 +00:00
Emmanuele Bassi
a3e82f20a1 Use the right type when calling GtkWidget methods
Let's avoid complaints from the compiler.
2022-12-06 21:50:30 +00:00
Emmanuele Bassi
03afe9be4e Add missing annotation for GdkAtom 2022-12-06 21:50:30 +00:00
Emmanuele Bassi
75cb21e448 Use the same argument name in the header and source files
They must match so the introspection scanner can do its job.
2022-12-06 21:50:30 +00:00
Emmanuele Bassi
01ac1bbaae Drop unnecessary volatile modifier
It's completely useless, and just generates compiler warnings with
recent GLib versions.
2022-12-06 21:50:30 +00:00
Emmanuele Bassi
b310ee1eac build: Drop Meson version checks
We depend on a new enough version of Meson.
2022-12-06 21:50:30 +00:00
Emmanuele Bassi
ca1dfc7092 build: Replace deprecated get_pkgconfig_variable()
Use get_variable(pkgconfig:...) instead.
2022-12-06 20:45:58 +00:00
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
hrdl
5c6d2c8e87 Fixes incorrect grabbing behaviour causing subsequent rejection of input
mouse_location can be set to NULL in gtk_range_update_mouse_location(). This
causes a match with stepper_?_gadget in gtk_range_multipress_gesture_pressed(),
as both are NULL. This leads to a grab being added internally and as well, a
critical error message, and a subsequent rejection of touch inputs. Returning
early when mouse_location is NULL prevents this.

Closes #4947
2022-11-11 12:17:51 +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