Compare commits

..

397 Commits

Author SHA1 Message Date
Matthias Clasen b5808192f6 Drop @define-color from the css machinery
Stop parsing @define-color rules, and drop related
apis and css value implementations.
2022-09-14 21:51:24 -04:00
Matthias Clasen 848000b419 testsuite: Remove @define-color from css tests 2022-09-14 21:51:24 -04:00
Matthias Clasen 2937d83e79 Drop @define-color from included themes 2022-09-14 21:21:55 -04:00
Benjamin Otte b9b2ac2ce3 Merge branch 'wip/coreyberla/gridview-rubberband' into 'main'
gridview: Fix rubberbanding from negative x coordinates

Closes nautilus#2492

See merge request GNOME/gtk!5030
2022-09-14 18:48:11 +00:00
Corey Berla ad041fc5d4 gridview: Fix rubberbanding from negative x coordinates
This is a follow-up to 1e9a36ffa8. For GridView
we also need to make sure that we aren't rubberbanding below x=0 which
causes unexpected rubberbanding behavior.

Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2492
2022-09-14 11:27:52 -07:00
Matthias Clasen 952f85c12d Merge branch 'single-key-compose' into 'main'
input: Accept short compose sequences

Closes #5172

See merge request GNOME/gtk!5026
2022-09-13 10:24:49 +00:00
Matthias Clasen 72d6241c84 Add a test for short compose sequences
Add a table that has a short sequence
to verify that we can parse this.
2022-09-12 22:30:47 -04:00
Matthias Clasen aac3f1860f Update test results
The table sizes change, even though none of our
test tables include short sequences.
2022-09-12 22:30:47 -04:00
Matthias Clasen 6be27682a8 Regenerate builtin sequences
The table format has changed.
2022-09-12 22:30:47 -04:00
Matthias Clasen 8931169e00 input: Accept short compose sequences
Some of the X keyboard layouts use compose
sequences of length one to make individual
keys generate multiple Unicode characters.

To support this use case, change the index
part of the table format to also include
an offset for length 1. Bump the table
version to indicate this change.

Fixes: #5172
2022-09-12 22:30:47 -04:00
Matthias Clasen 72785c68d6 Cosmetics: Fix a typo 2022-09-12 12:01:30 -04:00
Boyuan Yang 5c831d030a Update Chinese (China) translation 2022-09-11 19:24:40 +00:00
Jordi Mas f17a924e7b Update Catalan translation 2022-09-11 14:32:27 +02:00
Matthias Clasen 2e542d8cae Merge branch 'misc-gl-fixes' into 'main'
gsk: Make glyph upload more similar to icons

See merge request GNOME/gtk!4074
2022-09-10 20:09:28 +00:00
Matthias Clasen 511a4ec475 gsk: Make glyph upload more similar to icons
When uploading glyphs to the atlas, clear
the padding bytes so that no dirt remains there.
2022-09-10 15:25:59 -04:00
Matthias Clasen b76a2e44ba Merge branch 'matthiasc/for-main' into 'main'
clang-format: This did not work

See merge request GNOME/gtk!5021
2022-09-10 18:51:14 +00:00
Matthias Clasen d28b94f0cb clang-format: This did not work
I thought AlignConsecutiveDeclarations would
align function parameters, but it doesn't.
So drop it again.
2022-09-10 14:35:40 -04:00
Cheng-Chia Tseng c4766b2747 Update Chinese (Taiwan) translation 2022-09-10 09:09:29 +00:00
Matthias Clasen 98bdf67468 Merge branch 'game-sounds' into 'main'
gtk-demo: Make losing games hurt

See merge request GNOME/gtk!5017
2022-09-10 00:32:45 +00:00
Emmanuele Bassi dca57bebb7 Merge branch 'a11y-state-changes' into 'main'
a11y: Be safe against state type changes

See merge request GNOME/gtk!5018
2022-09-10 00:04:03 +00:00
Matthias Clasen de9a5f94c2 Merge branch 'less-fetching-in-ci' into 'main'
ci: Improve style check script

See merge request GNOME/gtk!5020
2022-09-10 00:02:41 +00:00
Matthias Clasen 659a129f81 Merge branch 'clang-format-improvement' into 'main'
ci: Improve clang-format style

See merge request GNOME/gtk!3770
2022-09-09 23:59:49 +00:00
Matthias Clasen 0c8bdf2ac2 ci: Improve clang-format style
Add

AlignConsecutiveDeclarations: true
PointerAlignment: Right

which will produce the style we want with llvm 13.
2022-09-09 19:43:27 -04:00
Matthias Clasen 3d2dcb437c ci: Improve style check script
Only fetch the two branches we are about to
compare, and use existing git merge-base to
find the common ancestor.
2022-09-09 19:41:42 -04:00
Emmanuele Bassi 22de54a9dc Merge branch 'ebassi/style-check' into 'main'
ci: Re-sync the style check with GLib

See merge request GNOME/gtk!5019
2022-09-09 23:30:38 +00:00
Matthias Clasen 4b5ed886ce ci: Fix the git usage in scripts
Thanks, git.
2022-09-10 00:16:12 +01:00
Emmanuele Bassi 821dd26934 ci: Move style check to its own stage
Drop the `.pre` phase.
2022-09-10 00:16:12 +01:00
Emmanuele Bassi d6597098f1 ci: Re-sync the style check with GLib 2022-09-10 00:16:12 +01:00
Matthias Clasen 4c1bc93f6f a11y: Be safe against state type changes
For some of the a11y states, calling gtk_accessible_reset_state
can change the type of the state value from boolean or tristate
to undefined.

Handle that, instead of throwing criticals.

Related: !4910
2022-09-09 16:07:24 -04:00
Matthias Clasen ef9b844c7f Merge branch 'filechooser-keybindings' into 'main'
filechooser: Restore ~ and . functionality

See merge request GNOME/gtk!5016
2022-09-09 19:38:39 +00:00
Matthias Clasen 681ec04b85 gtk-demo: Make losing games hurt
Use a more annoying sound for losses.
And use it for all games.
2022-09-09 15:36:31 -04:00
Matthias Clasen 7dd3289837 Merge branch 'widget-factory-filechooser' into 'main'
widget-factory: Add a file chooser

See merge request GNOME/gtk!5015
2022-09-09 18:44:31 +00:00
Matthias Clasen 7e54a7e5a5 filechooser: Restore ~ and . functionality
We'll have to keep patching up these things
until somebody rewrites the file chooser :(

Inspired by: !4970
2022-09-09 14:44:28 -04:00
Matthias Clasen f050a9e889 widget-factory: Add a file chooser
We don't have a readily accessible file chooser
in our demo apps. Fix that by making the Open
menu item on page 2 bring up a file chooser.
2022-09-09 14:28:08 -04:00
Matthias Clasen ae2964c7c6 Merge branch 'fix-fontrendering-demo' into 'main'
gtk-demo: Avoid a segfault

Closes #5166

See merge request GNOME/gtk!5014
2022-09-09 16:57:27 +00:00
Matthias Clasen 54daad3878 gtk-demo: Avoid a segfault
The code in the fontrendering demo is a bit sloppy
and assumes that we always get a single run when
appending a sequence of 4 chars and 4 spaces.

That is not in general true, such as for Emoji.

Instead of working harder to handle Emoji here,
just give up and fall back to 'a'.

Fixes: #5166
2022-09-09 12:34:54 -04:00
Matthias Clasen d7817e6fc6 Merge branch 'gtkplaces' into 'main'
gtkplacesview: Right click popover fix crash and align menu with mouse

See merge request GNOME/gtk!4662
2022-09-09 14:59:03 +00:00
Matthias Clasen de94f3d97f Merge branch 'gtktooltip.c-optimise' into 'main'
gtk/gtktooltip.c: check result of event position get operation

Closes #5134

See merge request GNOME/gtk!4996
2022-09-09 14:56:33 +00:00
Matthias Clasen 066884aed1 Merge branch 'wip/carlosg/im-reset' into 'main'
Avoid early IM reset on updates

Closes #5133

See merge request GNOME/gtk!5012
2022-09-09 12:36:43 +00:00
Rūdolfs Mazurs e7501185cd Update Latvian translation 2022-09-07 20:56:57 +00:00
Matthias Clasen a08277adcd Merge branch 'fix-file-transfer-portal' into 'main'
Stop recursion in registering serializers

See merge request GNOME/gtk!5013
2022-09-07 15:04:43 +00:00
Matthias Clasen e8e69a1208 Make clipboard tests work with portals
This was not working right, since it hasn't been
tested with portals - there are no portals in ci.
2022-09-07 08:45:31 -04:00
Matthias Clasen e16414b3ac Handle absence of portals
When the documents portal is not on the bus,
we still get an (unowned) proxy, and we need
to handle that situation.
2022-09-07 08:45:31 -04:00
Matthias Clasen 2e42786091 portals: Fix FileTransfer portal calls
We were not passing the right arguments to
the AddFiles call, causing the file transfer
to fail.
2022-09-07 06:47:02 -04:00
Matthias Clasen b756aa0764 Make the file transfer portal setup sync again
We need to register the portal mime types before
the others to prefer them, doing this call async
messes up that ordering.

This is effectively reverting 69fb3648b2
2022-09-07 06:45:03 -04:00
Matthias Clasen 9654fd451f Stop recursion in registering serializers
This was probably unintentional, and messes up
the ordering of our registration.
2022-09-06 23:35:48 -04:00
Matthias Clasen 7d564ecdc9 Merge branch 'textbuffer-set-text-docs' into 'main'
Document irreversibility of gtk_text_buffer_set_text

See merge request GNOME/gtk!5005
2022-09-06 22:19:30 +00:00
Matthias Clasen d850dfd245 Merge branch 'launch-uri-no-export' into 'main'
Make gtk_launch_uri more robust

Closes #5152

See merge request GNOME/gtk!5010
2022-09-06 20:50:06 +00:00
Matthias Clasen a6d5757627 Merge branch 'gtk-scale-set-digits-update-label' into 'main'
GtkScale: Update the label size request from set_digits ()

Closes #5156

See merge request GNOME/gtk!5011
2022-09-06 20:34:39 +00:00
Matthias Clasen ad8a3e5b45 Merge branch 'wip/antoniof/columnview-rtl' into 'main'
columnview: Invert columns on RTL

Closes nautilus#2302

See merge request GNOME/gtk!5002
2022-09-06 20:30:15 +00:00
Carlos Garnacho 5b78fe2721 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-09-06 22:17:40 +02:00
Carlos Garnacho 7c0a395ff9 gtktext: 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-09-06 22:17:40 +02:00
Carlos Garnacho 41f26975a9 gtktext: 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.

Fixes: 52ac71b972 ("gtktextview: Shuffle the places doing IM reset")
Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5133
2022-09-06 22:17:40 +02:00
Carlos Garnacho 085374198f gtktext: 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.

Fixes: 9e29739e66 ("gtktext: Shuffle the places doing IM reset")
Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5133
2022-09-06 22:17:40 +02:00
Matthias Clasen 586675c902 Merge branch 'treepopover-ellipsize' into 'main'
treepopover: Do not propagate natural width of content

See merge request GNOME/gtk!4895
2022-09-06 20:17:33 +00:00
Matthias Clasen 1679fc8675 Merge branch 'display-wayland-update-scale' into 'main'
wayland/display: Remove duplicate update_scale() call

See merge request GNOME/gtk!5003
2022-09-06 20:14:38 +00:00
Matthias Clasen 9cc1dcf2a4 4.8.0 2022-09-06 15:59:04 -04:00
Luca Bacci cc57692345 GtkScale: Update the label's size request from set_digits ()
Update the label size request when setting the digits property
by calling the update_label_request () util function.

That util function works by measuring the size request of the
label with the lower and upper values of the adjustment, then
taking the max. That way the size requisition is constant
regardless of the actual displayed value.

Since the util function internally works by setting the text
of the label, let it also set the text at last by taking in
account the current adjustment's value. Most of its callers
do that anyway.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5156
2022-09-06 21:08:31 +02:00
Matthias Clasen a0db8a24c2 Make gtk_launch_uri more robust
We were failing to launch the uri if we are on
Wayland, but have no xdg_foreign protocol support.

Fixes: #5152
2022-09-06 12:37:56 -04:00
Zurab Kargareteli e4be073f0a Update Georgian translation 2022-09-06 16:28:59 +00:00
Zurab Kargareteli 4ffefec469 Update Georgian translation 2022-09-06 16:28:00 +00:00
Changwoo Ryu db2432b5db Update Korean translation 2022-09-06 04:15:30 +00:00
Aurimas Černius 7d29b456b8 Updated Lithuanian translation 2022-09-05 22:38:20 +03:00
Daniel Mustieles 8fbb647daa Updated Spanish translation 2022-09-05 14:30:59 +02:00
Fran Dieguez c28b8297ee Update Galician translation 2022-09-04 22:24:45 +00:00
Aleksandr Melman 4eb0dd7264 Update Russian translation 2022-09-04 20:45:34 +00:00
Rūdolfs Mazurs b3d6972803 Update Latvian translation 2022-09-04 15:50:02 +00:00
Jürgen Benvenuti 0eab3c3940 Update German translation 2022-09-04 13:57:48 +00:00
Elliott Sales de Andrade 4cbfb69f74 Document irreversibility of gtk_text_buffer_set_text
If you've begun a user action and call `gtk_text_buffer_set_text`, you
get an unexpected warning:
```
Gtk-WARNING **: Cannot begin irreversible action while in user action
```
which can be fixed by doing the delete/insert yourself. But this is not
documented as occurring, so document it.
2022-09-04 02:47:57 -04:00
Boyuan Yang 4603e7bb18 Update Chinese (China) translation 2022-09-03 21:16:03 +00:00
Rūdolfs Mazurs 8d504cae44 Update Latvian translation 2022-09-03 13:04:54 +00:00
Piotr Drąg 0f35ece2af Update Polish translation 2022-09-03 15:00:46 +02:00
Marek Černocký 204cac7ebf Updated Czech translation 2022-09-03 09:50:27 +02:00
Robert Mader 06a51b6ca6 wayland/display: Remove duplicate update_scale() call
`apply_monitor_change()` already calls `update_scale()`.
Note that this only affects old compositor versions (see
`should_update_monitor()`) so it's just a minor cleanup.
2022-09-03 00:53:02 +02:00
Balázs Úr 853bfcb130 Update Hungarian translation 2022-09-02 21:29:08 +00:00
Jordi Mas 6a1f5c0af5 Update Catalan translation 2022-09-02 20:34:04 +02:00
António Fernandes 91e6f8e4b9 columnview: Invert columns on RTL
Respect text direction.

Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2302
2022-09-02 15:44:59 +01:00
Carlos Garnacho bce90df49d Merge branch 'treeview-gesture-claim' into 'main'
treeview: Don't claim event sequence too early

Closes #3649, #3985, #4206, and #4669

See merge request GNOME/gtk!4883
2022-09-02 12:40:15 +00:00
Mat 58953671fe treeview: Don't claim event sequence too early
We want to claim the event sequence in the click gesture when appropriate,
such as activating a row or clicking an editable cell, but this is currently
done too early, preventing other gestures for drag-and-drop and rubberband
selection entirely.

Fixes #3649
Fixes #3985
Fixes #4669
2022-09-02 15:04:43 +03:00
Ask Hjorth Larsen df527758b1 Updated Danish translation 2022-09-02 11:51:27 +02:00
Emin Tufan Çetin 3cd55fdf35 Update Turkish translation 2022-09-01 22:53:55 +00:00
Alexander Shopov 25783573c6 Update Bulgarian translation 2022-09-01 21:11:55 +00:00
Luca Bacci 041a186272 Merge branch 'implement-gtk-color-picker-for-windows' into 'main'
Implement GtkColorPicker for Windows

Closes #5136

See merge request GNOME/gtk!4983
2022-09-01 20:39:15 +00:00
Christian Hergert f5488bb4b2 gdk: fix typo in frame clock docs 2022-09-01 12:16:10 -07:00
Luca Bacci 86a38918d7 Implement GtkColorPicker for Windows
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5136
2022-09-01 19:25:07 +02:00
Hugo Carvalho 88f38f598b Update Portuguese translation 2022-09-01 17:18:51 +00:00
Nathan Follens 4aee6edbbd Update Dutch translation 2022-09-01 16:21:14 +00:00
Matthias Clasen adcec93b02 Merge branch 'gtkplacessidebar' into 'main'
gtkplacessidebar: Fix crash when remove or rename bookmark

See merge request GNOME/gtk!4625
2022-09-01 15:00:42 +00:00
Matthias Clasen 79ff151624 Merge branch 'inscription_a11y' into 'main'
GtkInscription: Set the a11y label when updating the text property

See merge request GNOME/gtk!5000
2022-09-01 14:38:49 +00:00
Lukáš Tyrychtr 27f32b7f9b GtkInscription: Set the a11y label when updating the text property 2022-09-01 16:19:59 +02:00
Anders Jonsson 1771f75c6c Update Swedish translation 2022-09-01 13:15:36 +00:00
Marek Černocký 979c418e46 Updated Czech translation 2022-09-01 14:41:37 +02:00
Marek Černocký 28f63259ab Updated Czech translation 2022-09-01 14:34:27 +02:00
Leônidas Araújo 105a2262dc Update Brazilian Portuguese translation 2022-08-31 14:53:19 +00:00
Danial Behzadi 3615619f41 Update Persian translation 2022-08-31 12:45:30 +00:00
Kukuh Syafaat 0782bfa52b Update Indonesian translation 2022-08-31 09:17:12 +00:00
Asier Sarasua Garmendia ccd5565f75 Update Basque translation 2022-08-31 07:04:00 +00:00
Matthias Clasen e502155dfa Merge branch 'gbsneto/cleanup-gsettings' into 'main'
gtk: Remove last-folder-uri from schema

See merge request GNOME/gtk!4998
2022-08-30 19:14:44 +00:00
Georges Basile Stavracas Neto 9261b0079d gtk: Remove last-folder-uri from schema
It's unused since 2013, apparently.
2022-08-30 15:58:47 -03:00
Goran Vidović 4638f942b8 Update Croatian translation 2022-08-30 11:56:21 +00:00
Maxim Zakharov 982b4ff3b2 gtk/gtktooltip.c: check result of event position get operation
Do not perform coordinates transformation when gdk_event_get_position()
returns FALSE as it returns NaNs in that case and these coordinates
are not used anyway in further processing (closes #5134).
2022-08-30 15:54:52 +10:00
Yuri Chornoivan 46483bebcd Update Ukrainian translation 2022-08-29 19:21:22 +00:00
Matthias Clasen e077a6bffe Merge branch 'wip/jimmac/HC-italic-hints' into 'main'
HC: entry - make hints italic

Closes #5143

See merge request GNOME/gtk!4994
2022-08-29 18:55:34 +00:00
Matthias Clasen 66dc193aeb Merge branch 'font-feature-work' into 'main'
fontchooser: Rename default feature value

See merge request GNOME/gtk!4995
2022-08-29 18:48:00 +00:00
Matthias Clasen 39439aa838 fontchooser: Rename default feature value
"Default" is a better fit than "None" here.
2022-08-29 14:14:07 -04:00
Matthias Clasen 018bd0a927 fontchooser: Add a tooltip to the tweak button
Icon-only buttons are always better with a tooltip.
2022-08-29 12:13:32 -04:00
Matthias Clasen 975ab6e7cf fontchooser: Remove placeholder from preview entry
The way we explicitly set the font on the entry
conflicts with the placeholder text styling. But the
entry isn't normally empty, so placeholder text is
not that important here. Remove it and use a tooltip
instead.
2022-08-29 10:21:37 -04:00
Jordi Mas 53c8975739 Update Catalan translation 2022-08-29 12:28:26 +02:00
Jakub Steiner 09176fc1b3 HC: entry - make hints italic
- to keep contrast but indicated difference between a value and a hint

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5143
2022-08-29 11:58:29 +02:00
Matthias Clasen 0f2582ff02 Merge branch 'font-feature-work' into 'main'
fontchooser: Improve handling of features

See merge request GNOME/gtk!4992
2022-08-29 01:26:12 +00:00
Matthias Clasen a217be14f9 Merge branch 'gtknotebook-arrow-press' into 'main'
gtknotebook: Claim event sequence after pressing notebook arrow buttons

See merge request GNOME/gtk!4990
2022-08-28 23:30:00 +00:00
Matthias Clasen e7b332c532 Merge branch 'gtknotebook-arrow-state' into 'main'
gtknotebook: update arrow button state when reordering tabs

See merge request GNOME/gtk!4991
2022-08-28 23:29:25 +00:00
Piotr Drąg 13382937d1 Update Polish translation 2022-08-28 23:34:58 +02:00
Matthias Clasen c364f1ee12 fontchooser: Improve handling of features
salt and swsh need to be treated like cvXX, with
a dropdown. Also add examples to the default cases
of radio groups.
2022-08-28 17:02:56 -04:00
Mat dd8c899737 gtknotebook: update arrow button state when reordering tabs
When reordering notebook tabs, updating the sensitivity state of the
arrow buttons is necessary if the tab is moved to the beginning or
end of the tab list.
2022-08-29 00:00:10 +03:00
Mat d69fdaa04d gtknotebook: Claim event sequence after pressing notebook arrow buttons
When notebook tabs are reorderable, pressing the notebook arrow buttons to
change the active tab results in tabs reordering unexpectedly.
Claim the event sequence after pressing an arrow button to avoid conflicts
with the motion/drag gesture used for reordering.
2022-08-28 23:42:59 +03:00
Aleksandr Melman 16eced7bf1 Update Russian translation 2022-08-28 18:51:12 +00:00
Matthias Clasen 1276e8868d Merge branch 'notebook-tab-accessibility' into 'main'
gtkatspiselection: Retrieve the correct GtkNotebook tab widget

See merge request GNOME/gtk!4989
2022-08-28 14:53:03 +00:00
Goran Vidović 7539fb4ced Update Croatian translation 2022-08-28 14:41:32 +00:00
Matthias Clasen f24efd175e Merge branch 'strdup-avoidance' into 'main'
notebook: Use canonical signal names

See merge request GNOME/gtk!4988
2022-08-28 14:05:02 +00:00
Mat df40efd50d gtkatspiselection: Retrieve the correct GtkNotebook tab widget
A typo resulted in the tab container widget being retrieved instead of
the tab widget. If an adjacent action widget was present, an infinite
loop occurred when switching tabs while a screen reader was enabled.
2022-08-28 17:02:01 +03:00
Hugo Carvalho db5868d89b Update Portuguese translation 2022-08-28 13:14:19 +00:00
Matthias Clasen 32796cad10 Use gtk_event_controller_set_static_name
This avoids strdups.
2022-08-27 22:35:13 -04:00
Matthias Clasen b6a965a67c eventcontroller: Allow static names
These names are a debug-only feature, and we
use string literals everywhere, so avoid the
overhead of copying them.
2022-08-27 22:35:13 -04:00
Matthias Clasen 6136f3ab95 shortcutaction: Intern signal names
Signal names are already interned anyway,
so we can avoid strdups here, and just use
the interned names.
2022-08-27 22:35:13 -04:00
Matthias Clasen d3e79633e1 notebook: Use canonical signal names
No excuse for not doing that.
2022-08-27 22:34:31 -04:00
Goran Vidović b362098f63 Update Croatian translation 2022-08-27 20:18:12 +00:00
Luca Bacci 35583c8d36 Merge branch 'gl-renderer-make-context-current-in-remove-program' into 'main'
GL Renderer: Make GdkGLContext current in gsk_gl_driver_shader_weak_cb

Closes #5140

See merge request GNOME/gtk!4985
2022-08-27 17:53:39 +00:00
Piotr Drąg 581bfd20e4 Update Polish translation 2022-08-27 16:16:35 +02:00
Piotr Drąg c5bbdfb7b1 Update POTFILES.in and POTFILES.skip 2022-08-27 15:54:10 +02:00
Luca Bacci bcccb46b7c GL Renderer: Ensure that GdkGLContext is current in gsk_gl_driver_shader_weak_cb
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5140
2022-08-27 13:58:17 +02:00
Yuri Chornoivan 916328da2b Update Ukrainian translation 2022-08-27 09:56:43 +00:00
Danial Behzadi 6ca0d616d4 Update Persian translation 2022-08-27 05:32:31 +00:00
Matthias Clasen 137af44f81 Merge branch 'font-chooser-feature-work' into 'main'
fontchooser: Handle font features better

See merge request GNOME/gtk!4984
2022-08-26 22:10:52 +00:00
Matthias Clasen 0441fd3678 fontchooser: Handle font features better
Properly show multiple-choice cvXX features as dropdowns,
include afrc, and fix bugs in feature enumeration that
made some features not show up.
2022-08-26 17:53:55 -04:00
Luca Bacci 3abc3425cb Merge branch 'win32-gir' into 'main'
gdk/win32: do not expose gdk_win32_*_libgtk_only in public headers

See merge request GNOME/gtk!4980
2022-08-26 13:14:30 +00:00
Matthias Clasen 2017f3debe Some strdup avoidance 2022-08-25 14:33:30 -04:00
Marc-André Lureau 4b08570727 gdk/win32: add missing Since tag for gdk_win32_display_get_egl_display
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-25 17:33:25 +04:00
Nart Tlisha 1042ca7e52 Update Abkhazian translation 2022-08-25 10:29:34 +00:00
Marc-André Lureau 52e3ed13e2 gdk/win32: deprecate gdk_win32_handle_table_lookup
This function is probably not generally useful for a Gtk+/win32 user,
and it's only used internally by gdk-win32. It's time to deprecate it, I
believe.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-24 21:02:57 +04:00
Benjamin Otte fb7257a1f5 Merge branch 'treelistmodel-collapse-test' into 'main'
treelistmodel: Fix handling of collapsed nodes

Closes #4595

See merge request GNOME/gtk!4981
2022-08-24 13:42:51 +00:00
Matthias Clasen 83bf193218 Add a test for treelistmodel row collapse
Test that we can expand and collapse a row, and then
add another child below it, without crashing.

Adapted from the testcase in #4595.

This tests the fix in the previous commit.
2022-08-24 08:23:22 -04:00
Matthias Clasen f1c1c979c2 treelistmodel: Fix handling of collapsed nodes
When we collapse a node, we clear out the children,
but we were not disconnecting the signal handler on
the child listmodel, leading to bad outcomes when
that model is persistent and changing.

Fixes: #4595
2022-08-24 08:23:20 -04:00
Marc-André Lureau 6cfb6e0c9c gdk/win32: do not expose gdk_win32_*_libgtk_only in public headers
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-24 15:44:32 +04:00
Luca Bacci ef831235fe Merge branch 'win32-gir' into 'main'
win32: various GI annotations and fixes

See merge request GNOME/gtk!4977
2022-08-24 09:41:11 +00:00
Luca Bacci 5286e9405d Merge branch 'gdk-win32-scale-text-with-dpi-as-gtk3' into 'main'
GdkWin32: Scale text like in GTK3 with SYSTEM_DPI_AWARENESS

Closes #4187

See merge request GNOME/gtk!4979
2022-08-24 09:35:30 +00:00
Luca Bacci c11ea42644 GdkWin32: Scale text with DPI like in GTK3 with SYSTEM_DPI_AWARENESS
Right now we only support system DPI awareness in GTK4. In that case
it makes sense to scale text with the DPI of the primary monitor, like
done in GTK3.

We plan to land support for proper fractional scaling in Gdk/Win32, so
in the future the "gtk-xft-dpi" setting will be gathered as intended,
i.e. for text magnification, as an a11y feature.
2022-08-23 19:53:44 +02:00
Luca Bacci d7c04145ee Merge branch 'gdk-win32-fix-monitor-for-popup' into 'main'
GdkWin32: Use primary monitor as fallback if popup layout does not intersect any

See merge request GNOME/gtk!4978
2022-08-23 17:20:02 +00:00
Marc-André Lureau 0d7a0132bb gdk/win32: annotate gdk_win32_surface_lookup_for_display
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-23 17:20:39 +04:00
Marc-André Lureau cad32636ce gdk/win32: annotate gdk_win32_surface_set_urgency_hint
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-23 17:06:48 +04:00
Luca Bacci d125fcd35a GdkWin32: Position popups on the primary monitor if outside of the visible screen area
Fixes a crash caused by attempting to dereference a NULL GdkMonitor*
in GdkWin32.

See https://gitlab.gnome.org/GNOME/gtk/-/issues/5125
2022-08-23 14:54:01 +02:00
Marc-André Lureau 88503bcc3b gtk/win32: fix a switch-default warning
gtk/gtkimcontextime.c:714:3: warning: switch missing default case [-Wswitch-default]

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-23 16:42:17 +04:00
Matthias Clasen e68925a932 Merge branch 'tweak-option-docs' into 'main'
Tweak the vulkan option description

See merge request GNOME/gtk!4976
2022-08-23 12:41:46 +00:00
Marc-André Lureau a6418d5028 gdk/win32: deprecate gdk_win32_surface_get_impl_hwnd
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-23 16:35:07 +04:00
Marc-André Lureau 04ebec0fa7 gtk/win32: use gdk_win32_surface_get_handle
As I propose to deprecate gdk_win32_surface_get_impl_hwnd() next,
replace it with the alternative.

The main difference between the two functions is that
gdk_win32_surface_get_impl_hwnd() fails gracefully by returning NULL if
the surface is not of the win32 implementation.

All the surfaces should be native surfaces here, and the existing code
doesn't seem to deal with NULL case anyway.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-23 16:31:09 +04:00
Matthias Clasen aa0f564aa1 Tweak the vulkan option description
The thing that is experimental is our renderer,
not the vulkan API.
2022-08-23 08:27:24 -04:00
Marc-André Lureau 3cbf6c9d6e gdk/win32: annotate gdk_win32_surface_get_handle
And adjust the argument precondition check.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-23 16:25:33 +04:00
Marc-André Lureau a75de5fb90 gdk/win32: correct gdk_win32_surface_get_handle return type
The associated surface window handle is a HWND, not a HGDIOBJ.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-23 16:17:19 +04:00
Sveinn í Felli 1b66373a5d Update Icelandic translation
(cherry picked from commit a27ae5362c)
2022-08-23 11:49:42 +00:00
Sveinn í Felli 8786ac844c Update Icelandic translation
(cherry picked from commit e6d3c58ccf)
2022-08-23 11:38:46 +00:00
Marc-André Lureau 180dd5fb7f gdk/win32: deprecate gdk_win32_surface_is_win32
The function isn't used by Gtk itself anymore, and does not help much.
It creates extra issues for bindings, as it doesn't fit well with code
doing the same job for other objects.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-23 15:34:50 +04:00
Marc-André Lureau a53650d9da gdk/win32: annotate filter callbacks
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-23 12:57:20 +04:00
Luca Bacci 0d4d52d322 Merge branch 'win32-gir' into 'main'
Generate gtk/GdkWin32-4.0.gir

Closes #5112

See merge request GNOME/gtk!4965
2022-08-22 22:26:09 +00:00
Aurimas Černius 896155fab7 Updated Lithuanian translation 2022-08-22 23:21:45 +03:00
Matthias Clasen 727ec4cf7d Merge branch 'fix-calc-value-free' into 'main'
css: Fix freeing of calc values

Closes #5130

See merge request GNOME/gtk!4974
2022-08-22 16:31:23 +00:00
Matthias Clasen a52ee9ee22 css: Fix freeing of calc values
We were getting our memory allocations mixed
up here.

Fixes: #5130
2022-08-22 11:51:56 -04:00
Matthias Clasen 94a9859391 Merge branch 'jpeg-memory-limit' into 'main'
Bump the jpeg memory limit

See merge request GNOME/gtk!4973
2022-08-22 15:03:40 +00:00
Matthias Clasen d1755337a2 Bump the jpeg memory limit
Commit 59f6c50df8 set the memory limit to 100M,
which turns out to exclude some large, valid jpegs.
So, bump things to 300M, matching what was done
in gdk-pixbuf.
2022-08-22 10:48:00 -04:00
Matthias Clasen 092c166f54 Merge branch 'no-emoji-insert' into 'main'
text: Respect no-emoji hint fully

See merge request GNOME/gtk!4972
2022-08-21 20:47:27 +00:00
Matthias Clasen 13f8eeb3ee text: Respect no-emoji hint fully
We were disabling the insert-emoji action when the
no-emoji input hint is set, but the Ctrl-. shortcut
was bypassing the action and kept working. Make
the shortcut activate the action instead.

Fixes: #5123
2022-08-21 16:31:14 -04:00
Matthias Clasen 36768471e5 Merge branch 'wip/smcv/log-writer' into 'main'
icontheme test: Assert that the subprocess passed

See merge request GNOME/gtk!4969
2022-08-21 11:55:00 +00:00
Simon McVittie 3cfe04aa74 icontheme test: Assert that the subprocess passed
Noticed while backporting GLogWriterFunc fixes to 3.24.x (#5119).

Signed-off-by: Simon McVittie <smcv@debian.org>
2022-08-20 19:38:29 +01:00
Марко Костић 4965a3ea4b Update Serbian translation 2022-08-20 13:06:02 +00:00
Fran Dieguez adc8a27f7a Update Galician translation 2022-08-20 11:26:34 +00:00
Luca Bacci 37d4dfb6b5 Merge branch 'gdk-win32-fix-handling-of-input-region' into 'main'
GdkWin32: Fix handling of WM_NCHITTEST

Closes #5114

See merge request GNOME/gtk!4966
2022-08-20 10:08:32 +00:00
Zurab Kargareteli d887af0748 Update Georgian translation 2022-08-20 07:37:42 +00:00
Matthias Clasen 803ba1da4f Merge branch 'fix-emojichooser-keynav' into 'main'
emojichooser: Fix arrow keynav

Closes #5076

See merge request GNOME/gtk!4967
2022-08-19 20:12:51 +00:00
Matthias Clasen 78eaad614a emojichooser: Fix arrow keynav
When some of the Emoji have been filtered out by
a search term, arrow keynav would behave oddly and
get stuck in invisible sections. Fix this by ignoring
any filtered out children when moving between
sections for arrow keynav.

Fixes: #5076
2022-08-19 15:55:10 -04:00
Luca Bacci 749425808d Fix typo
And reword comment
2022-08-19 19:29:17 +02:00
Luca Bacci 5e299cd3d2 GdkWin32: Fix handling of WM_NCHITTEST
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5114
2022-08-19 19:21:17 +02:00
Marc-André Lureau 8ab57fc8ef build-sys: generate GdkWin32.gir
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-19 17:42:30 +04:00
Matthias Clasen 3a8e45963f Merge branch 'mingw' into 'main'
Cross-building with mingw & fixes

See merge request GNOME/gtk!4341
2022-08-19 11:06:10 +00:00
Marc-André Lureau ff16446b0b build-sys: do not install gdkwin32keys.h
Fixes: commit 89ad7893ad ("gdk: Make GdkKeymap a private api")

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-19 11:58:12 +04:00
Marc-André Lureau 82bcebe3de gdk/win32: remove old declaration
The function is gone since commit ea65abc7e2 ("Rewrite
GdkWin32Keymap (load table directly from layout DLL)")

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-19 11:58:12 +04:00
Benjamin Otte a790764a7a Merge branch 'wip/otte/for-main' into 'main'
gdk: Plug a memleak

Closes #5110

See merge request GNOME/gtk!4964
2022-08-19 01:08:59 +00:00
Benjamin Otte 248e33e3c9 gdk: Plug a memleak
Free GdkIOPipe struct when freeing it
Don't just free all its members.

Fixes #5110
2022-08-19 02:38:11 +02:00
Matthias Clasen 44931aa8f8 Merge branch 'treeview-search-focus' into 'main'
treeview: Always call grab_focus_without_selecting on search entry

Closes #4551

See merge request GNOME/gtk!4961
2022-08-18 23:51:02 +00:00
Luca Bacci fb83adef25 Merge branch 'remove-msys2-ci-subproject-workaround' into 'main'
CI: remove workaround for some subproject builds failing on Windows

See merge request GNOME/gtk!4923
2022-08-18 18:40:05 +00:00
Matthias Clasen 08de13e9d2 Merge branch 'wip/carlosg/im-fixes' into 'main'
gtkimcontextwayland: Refactor handling of client updates

Closes #5106 and #5105

See merge request GNOME/gtk!4962
2022-08-18 17:58:26 +00:00
Carlos Garnacho f66ffde68d gtkimcontextwayland: Refactor handling of client updates
Currently, the wayland IM context sends zwp_text_input_v3.commit from
a number of places, and some of them with partial data. In order to
make client state updates "atomic" and complete, make the communication
happen over an unified notify_im_change() function that happens on
a narrower set of circumstances:

  - The GtkIMContext is reset
  - The GtkIMContext is just focused
  - The gesture to invoke the OSK is triggered
  - The IM context is reacting to changes coming from the compositor

Notably, setting the cursor location or the surrounding text do not try
to commit state on their own, and now will be flushed with the corresponding
IM update or reset. But also, these requests won't be prevented from
happening individually on serial mismatch, instead it will be the whole
state commit which is held off.

With these changes in place, all client-side updates are notified
atomically to the compositor under a single .commit request.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5106
Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5105
2022-08-18 19:19:53 +02:00
Carlos Garnacho 52ac71b972 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-08-18 19:07:12 +02:00
Mat 27eaca8b79 treeview: Always call grab_focus_without_selecting on search entry
The search text entry is always a GtkText widget, not GtkEntry. If a
custom search entry is set, this part of the code is never reached.

Fixes #4551
2022-08-18 18:03:04 +03:00
Marc-André Lureau 63dce34396 ci: add fedora-mingw64 job
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-18 11:45:21 +04:00
Marc-André Lureau 3585da6b7f build-sys: fix linker warning on win32
[196/296] Linking target testsuite/gtk/builder.exe
/usr/lib/gcc/x86_64-w64-mingw32/11.2.1/../../../../x86_64-w64-mingw32/bin/ld: warning: --export-dynamic is not supported for PE+ targets, did you mean --export-all-symbols?

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-18 11:44:34 +04:00
Carlos Garnacho 9e29739e66 gtktext: 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.
2022-08-18 00:55:30 +02:00
Matthias Clasen 82395e73ad Merge branch 'wip/smcv/rej' into 'main'
demos: Remove detritus from a patch not applying cleanly

See merge request GNOME/gtk!4957
2022-08-16 12:28:46 +00:00
Simon McVittie 0237713c3a demos: Remove detritus from a patch not applying cleanly
I assume this was committed by mistake. It isn't used, and some
packaging systems will automatically remove it during `clean`.

Signed-off-by: Simon McVittie <smcv@debian.org>
2022-08-16 08:32:45 +01:00
Jordi Mas 7e0e8365bd Update Catalan translation 2022-08-15 23:58:40 +02:00
Luca Bacci fbd11fc595 Merge branch 'overshoot-win32-fix' into 'main'
GdkWin32: Support high resolution scroll wheel events

See merge request GNOME/gtk!4950
2022-08-15 21:33:19 +00:00
Matthias Clasen bebaac64e1 Merge branch 'gtktreeview-adjustment' into 'main'
treeview: Do not set top row adjustment value while animating

Closes #4550

See merge request GNOME/gtk!4940
2022-08-14 22:40:32 +00:00
Matthias Clasen 1d232a725f Merge branch 'treeview-widget-coords' into 'main'
treeview: Use widget coordinates where required

See merge request GNOME/gtk!4939
2022-08-14 22:39:21 +00:00
Benjamin Otte fb4312738d Merge branch 'wip/otte/for-main' into 'main'
listitemwidget: Actually unref the listitems

Closes #5102

See merge request GNOME/gtk!4955
2022-08-14 21:19:48 +00:00
Benjamin Otte 918dd66dca listitemwidget: Actually unref the listitems
Fixes #5102
2022-08-14 22:55:27 +02:00
Ricardo Maia Louro 6ceacee0f9 GdkWin32: Support high resolution scroll wheel events 2022-08-14 18:30:28 +01:00
Piotr Drąg f1e81d176c Update Polish translation 2022-08-14 15:24:39 +02:00
Matthias Clasen 8d18b2b92d Merge branch 'fix-gears-leak' into 'main'
gtk4-demo: Fix a memory leak

See merge request GNOME/gtk!4954
2022-08-13 21:42:35 +00:00
Matthias Clasen 4a04e468fd gtk4-demo: Fix a memory leak
The gears demo was leaking its vertices.
2022-08-13 17:27:40 -04:00
Matthias Clasen f8d1912098 Merge branch 'wayland-cursor-texture-leak' into 'main'
wayland: Avoid leaking cursor textures

See merge request GNOME/gtk!4953
2022-08-13 17:35:56 +00:00
Matthias Clasen 0bd15b44f2 wayland: Avoid leaking cursor textures
When we fall back to the default cursor and load it
from a resource, we need to free the texture.
2022-08-13 13:19:49 -04:00
Matthias Clasen e4fb6933d2 Merge branch 'inscription-leak-fixes' into 'main'
inscription: Plug a memory leak

See merge request GNOME/gtk!4952
2022-08-13 00:49:33 +00:00
Matthias Clasen 33cf8f9404 inscription: Plug a memory leak
PangoFontMetrics also need to be freed.
2022-08-12 20:35:36 -04:00
Matthias Clasen 1640390839 inscription: Plug a memory leak
PangoLayoutIter needs to be freed.
2022-08-12 20:35:36 -04:00
Matthias Clasen b01f28b9e2 Merge branch 'fix-cups-backend-leak' into 'main'
Add more valgrind suppressions

See merge request GNOME/gtk!4951
2022-08-12 23:00:44 +00:00
Matthias Clasen 62192cba6e cups printbackend: Plug memory leaks
This loop has many early exits, and all of them
need to free this info object that gets allocated
at the beginning.
2022-08-12 18:44:25 -04:00
Matthias Clasen 586826d34c Add more valgrind suppressions
This gets all GQuark functions out of the logs.
2022-08-12 12:44:02 -04:00
Matthias Clasen c7a55faf37 Merge branch 'fix-a11y-leak' into 'main'
a11y: Fix a memory leak

See merge request GNOME/gtk!4949
2022-08-12 16:17:48 +00:00
Matthias Clasen e81db46578 a11y: Fix a memory leak
We need to free the queued context list in dispose
if we didn't get to register the contexts, and we also
need to free the list properly when we do get to
register them.

This showed up in valgrind as leaked GList structs.
2022-08-12 12:01:42 -04:00
Goran Vidović e036eebde8 Update Croatian translation 2022-08-12 14:33:14 +00:00
Goran Vidović dfa45c0da2 Update Croatian translation 2022-08-12 14:25:29 +00:00
Goran Vidović 6692c7e9c4 Update Croatian translation 2022-08-12 14:22:10 +00:00
Zurab Kargareteli 671f33a7b8 Update Georgian translation 2022-08-12 03:32:05 +00:00
Matthias Clasen 0fee50d1a5 Merge branch 'fix-leak' into 'main'
gtk/css: data_url_path fix leak in error path

See merge request GNOME/gtk!4947
2022-08-12 00:09:15 +00:00
Pablo Correa Gómez 97d3363360 gtk/css: data_url_path fix leak in error path
Fixes 7900032f30
2022-08-12 01:34:18 +02:00
Matthias Clasen 6eb3548192 4.7.2 2022-08-11 14:26:50 -04:00
Matthias Clasen e5a47b5592 Merge branch 'improve-css-test' into 'main'
css: Propagate charset conversion errors

See merge request GNOME/gtk!4943
2022-08-11 11:58:04 +00:00
Matthias Clasen 6c3119bc33 tests: Check the error first
The error contains useful information when
things fail, so check it first to get useful
output in case of failure.
2022-08-11 07:29:56 -04:00
Matthias Clasen 7900032f30 css: Propagate charset conversion errors
Lets not throw away informtation that
helps to figure out why things fail.
2022-08-11 07:29:56 -04:00
Matthias Clasen a020cf7534 Merge branch 'matthiasc/for-main' into 'main'
jpeg loader: Limit memory consumption

See merge request GNOME/gtk!4942
2022-08-10 17:57:55 +00:00
Matthias Clasen 59f6c50df8 jpeg loader: Limit memory consumption
This will prevent stupid oom situations with pathological
jpeg files, without affecting our ability to load reasonable
images.
2022-08-10 13:25:17 -04:00
Matthias Clasen bbd6fdaa04 Merge branch 'jx/hi-res-scrolling' into 'main'
High-resolution scroll wheel support

See merge request GNOME/gtk!3839
2022-08-10 16:51:55 +00:00
Carlos Garnacho 6a7136d5fb ci: Disable -Werror on wayland submodule
CI is mostly interested in GTK not introducing compiler warnings, other
submodules like Wayland might have their own and that shouldn't hinder
CI testing of GTK.

Disable -Werror for the wayland submodule, and let it be fixed independently
at some point.
2022-08-10 16:37:17 +02:00
José Expósito 95860d4989 gtkeventcontrollerscroll: Always accumulate discrete deltas
When GTK_EVENT_CONTROLLER_SCROLL_DISCRETE is set, accumulate deltas also
for mouse scroll so a high-resolution mouse wheel click behaves in the
in the same manner as a low-resolution mouse wheel click.
2022-08-10 14:23:58 +00:00
José Expósito 37a561eb53 gdk/x11: Handle high-resolution scroll events 2022-08-10 14:23:58 +00:00
José Expósito ed0a2a203c gdk/wayland: Handle high-resolution scroll events
Starting with the Wayland protocol wl_pointer >= 8, discrete axis
events have been deprecated in favour of high-resolution scroll event.

Add a listener for high-resolution scroll events and, for backwards
compatibility, handle discrete events as discrete*120.
2022-08-10 14:23:58 +00:00
José Expósito fc3aca8223 gdk/wayland: Calculate discrete scroll direction in its helper
Refactor, no functional changes.
2022-08-10 14:23:58 +00:00
José Expósito 6ebb38e12e gdk/events: Set discrete scroll deltas in its constructor
Instead of calculating the discrete scroll deltas in
GtkEventControllerScroll, move that code to the event constructor and
access the precalculated values using gdk_scroll_event_get_deltas.

Refactor, no functional changes.
2022-08-10 14:23:58 +00:00
José Expósito 51ca454eef gdk/events: Add constructor for high-resolution scroll events
Starting with Linux Kernel v5.0 two new axes are available for
mice that support high-resolution wheel scrolling: REL_WHEEL_HI_RES and
REL_HWHEEL_HI_RES.

Both axes send data in fractions of 120 where each multiple of 120
amounts to one logical scroll event. Fractions of 120 indicate a wheel
movement less than one detent.

The 120 magic number is a copy of the Windows API, so this new
constructor can be used both in Linux >= 5.0 and Windows >= Vista.
2022-08-10 14:23:58 +00:00
José Expósito fb100d719f build: Update Wayland to >= 1.21.0 2022-08-10 14:23:58 +00:00
Jordi Mas cf1974f6b1 Update Catalan translation 2022-08-10 14:27:44 +02:00
Emmanuele Bassi 3f4a0aa1f3 Merge branch 'rounded-clip-node-new-transfer-full' into 'main'
Mark gsk_rounded_clip_node_new() return value as (transfer full)

See merge request GNOME/gtk!4941
2022-08-10 09:23:02 +00:00
Sebastian Dröge 0cc2d5559b Mark gsk_rounded_clip_node_new() return value as (transfer full)
Like all the other constructors for nodes already do. Without this,
newly created rounded clip nodes are leaked in bindings.
2022-08-10 11:07:51 +03:00
Mat b4ade026f1 treeview: Do not set top row adjustment value while animating
gtk_tree_view_top_row_to_dy, which is called from GtkTreeView's
size_allocate function, changes the adjustment value. Since this
conflicts with the animation when changing the active row, bail
out until the animation is finished.

Fixes #4550
2022-08-10 08:32:47 +03:00
Mat 102ca838b8 treeview: Use widget coordinates where required
When a GtkTreeView scrolled horizontally, it was not possible to
select rows outside the initial area due to an erroneous comparison
between widget and bin window coordinates.

Original change to widget coordinates occurred in commit
a0de570e47
2022-08-10 04:25:19 +03:00
Carlos Garnacho 378ae4fbc1 Merge branch 'gbsneto/paned-focus-infloop' into 'main'
paned: Protect against NULL variable

Closes #5094

See merge request GNOME/gtk!4938
2022-08-09 18:26:48 +00:00
Matthias Clasen 00f079d705 Merge branch 'wip/carlosg/fix-crossing-on-unmap' into 'main'
gtkwindow: Use pointer-oriented function to deal with crossing events

Closes #5094

See merge request GNOME/gtk!4937
2022-08-09 18:15:41 +00: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
Georges Basile Stavracas Neto 29580d4252 paned: Warn if child is not actually a child
This will at least allow us to debug this in the future.
2022-08-09 14:20:25 -03:00
Carlos Garnacho 25c3616a79 gtkmain: Pass coordinates when synthesizing pointer events
Instead of passing an event and figuring out coordinates from it, pass
directly the toplevel coordinates so that we can use this outside event
handling.

All callers have been updated to pass the coordinates, in practical effects
they were already based on the GtkNative.
2022-08-09 19:13:28 +02:00
Georges Basile Stavracas Neto 120399cc92 paned: Protect against NULL variable
The inner loop in gtk_paned_set_focus_child() tries to find the
topmost GtkPaned, however, if the `w` variable ends up becoming
NULL after bubbling up the entire GtkWidget hierarchy, this loop
never breaks.

Check for NULL in this loop.

Closes https://gitlab.gnome.org/GNOME/gtk/-/issues/5094
2022-08-09 13:59:09 -03:00
Kukuh Syafaat 86e5ad85b7 Update Indonesian translation 2022-08-09 02:12:09 +00:00
Quentin PAGÈS 04ad5e8936 Update Occitan translation 2022-08-08 20:49:35 +00:00
Carlos Garnacho 9691a11076 Merge branch 'wip/exalm/multiplier' into 'main'
scrolledwindow: Lower the scroll multiplier

See merge request GNOME/gtk!4933
2022-08-08 12:00:15 +00:00
Daniel Mustieles fef3ab0b62 Updated Spanish translation 2022-08-08 12:42:06 +02:00
Alexander Mikhaylenko 493660a296 scrolledwindow: Lower the scroll multiplier
c68247f63b introduced a scroll multiplier,
intended to be significantly lower than the GTK 4.6 behavior but higher
than 1. However, it was _higher_ than 4.6, since 4.6 also had a permanent
1/10 multiplier in GDK, so the cited multiplier values were really 6.4 and
9.7.
2022-08-08 00:07:36 +04:00
Matthias Clasen 73f634435a Merge branch 'build-fix-glib-2.66' into 'main'
build: fix for use with glib 2.66.0 (2nd try)

See merge request GNOME/gtk!4932
2022-08-07 19:09:04 +00:00
Matthias Clasen b17bba4af2 Merge branch 'wip/carlosg/scroll-overshoot' into 'main'
gtk/scrolledwindow: Check for overshoot setting up kinetic scroll helpers

Closes #4784

See merge request GNOME/gtk!4909
2022-08-07 19:01:25 +00:00
Emmanuele Bassi ba1a084899 Apply 1 suggestion(s) to 1 file(s) 2022-08-07 18:54:19 +00:00
Carlos Garnacho 0e5a97ae58 gtk/scrolledwindow: Check for overshoot setting up kinetic scroll helpers
We may have situations where velocity is 0/0, but are overshooting. Places where
this happens are mouse wheels, and continuous scroll that ended up still before
finish. In this situation we also want to run the animation for overshoot, so
check for the corresponding axes to also set up the kinetic scroll helper.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4784
2022-08-07 20:26:52 +02:00
Matthias Clasen 7a306fe32f Merge branch 'wip/carlosg/fixes' into 'main'
Some fixes

Closes #2877 and #5003

See merge request GNOME/gtk!4929
2022-08-07 18:06:28 +00:00
Emmanuele Bassi ac7009d56c Merge branch 'clipboard-seg2' into 'main'
x11: Don't assume valid type

See merge request GNOME/gtk!4912
2022-08-07 16:21:40 +00:00
Carlos Garnacho c68247f63b gtkscrolledwindow: Add fixed multiplier to scroll events in surface units
The expected configurability is not going to arrive yet from compositors, and
it is precipitate for GTK to gain any configurability. We do know a factor of 1
feels way too slow, and we do know a factor of page_size * pow (2 / 3) feels way
way too fast.

With the previous multiplier, gtk4-demo at its default size had a vertical textview
factor of 64.332901, and maximized on a 1920x1080 screen a factor of 97.585365.
Pick a magic multiplier that is both significantly below these values and above 1,
and stick to it.

Future work will add the configurability of smooth scroll events where it belongs.
At that point this commit may be reverted so we don't pile up on magic numbers again.

Related: https://gitlab.gnome.org/GNOME/gtk/-/issues/4793
2022-08-07 17:16:14 +02:00
Asier Sarasua Garmendia 668a2c0f3e Update Basque translation 2022-08-07 09:49:00 +00:00
Hugo Carvalho c435c7e764 Update Portuguese translation 2022-08-06 23:01:57 +00:00
Danial Behzadi 4d36a4ebd7 Update Persian translation 2022-08-06 22:43:23 +00:00
Hannes Müller 703fc51d8e build: fix for use with glib 2.66.0
Add missing #define g_memdup2() for gdksurface-broadway.c in case of enabled
broadway-backend as used otherwise.

Copy static would_drop() replacement for g_log_writer_default_would_drop()
from gtk-builder-tool.c to gtk-reftest.c
2022-08-06 21:11:08 +02:00
Aleksandr Melman fb008578b4 Update Russian translation 2022-08-06 14:44:53 +00: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
Carlos Garnacho c77b98d716 gdk/wayland: Drop surface checks on wl_pointer.leave handling
Even though the argument is non-nullable, GTK sometimes incurs in that
by itself by destroying the surface while the event is in flight. This
is the case of popping down a GtkDropdown. When this happens we simply
ignore the crossing event, but we should let it through instead, the
compositor did not send it in vain and we possibly still have pointer
state to undo.

Drop the surface checks, so that the event is propagated along GTK.
2022-08-05 19:25:13 +02:00
Carlos Garnacho 8eda182f24 gtkeventcontroller: Fix internal enum documentation
Copy and paste typo.
2022-08-05 19:25:13 +02:00
Carlos Garnacho 15e0c175a3 gtkgesturerotate: Filter touchpad holds events
Since the pinch touchpad gestures already have begin/update/end phases,
this gesture has no actual use for these events.
2022-08-05 19:25:13 +02:00
Carlos Garnacho bc953eebdd gtkgesturerotate: Filter touchpad holds events
Since the pinch touchpad gestures already have begin/update/end phases,
this gesture has no actual use for these events.
2022-08-05 19:25:13 +02:00
Carlos Garnacho 6238f97cb6 gdkevent: Give touchpad hold events a sequence
Following what was done for pinch/swipe events, give hold gestures their
own distinct sequence as well. Without this it was NULL, which was already
distinct to other touchpad gestures.
2022-08-05 19:25:13 +02:00
Carlos Garnacho 023924bca9 gtkgesture: Do not coalesce hold events with other touchpad gestures
This delaying of the cancel event was made to avoid intermediate cancellation
for >=2fg hold gestures followed by pinch/swipe gestures, and it worked as
long as everything was considered to have the same sequence.

Since each pinch/swipe pointer gesture now gets its own sequence, this no
longer applies, nor works. This results in zoom/rotate/swipe gestures being
stuck since the sequence for the touchpad events changes mid-gesture.

Sticking to this pattern of giving touchpad gestures their own sequence,
these hold events cannot be assumed to coalesce with other touchpad gestures,
it is better to let it propagate altogether so that both the hold gesture
and the incoming gesture trigger coherent begin and end/cancel phases.

In the worst case, this results in "::begin, ::cancel, ::begin , ..." before
triggering a touchpad gesture, but the extra begin/cancel ought to be a safe
no-op in widgets.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5003
2022-08-05 19:25:13 +02:00
Matthias Clasen af6432aa67 Merge branch 'ebassi/textbuffer-private-api' into 'main'
Move private function out of the AT-SPI a11y backend

See merge request GNOME/gtk!4924
2022-08-05 12:01:27 +00:00
Emmanuele Bassi 6c37158bbc Re-enable the TextBuffer wrap-mode serialization test
The private serialization function is now available on all platforms.
2022-08-04 23:39:54 +01:00
Emmanuele Bassi d030c92d63 Move private function out of the AT-SPI a11y backend
The textbuffer test is calling into a function defined by the AT-SPI
accessibility backend. As of commit 4ddf1b70 we only build and run the
test on Linux, but the function in question isn't really
accessibility-related: it's just a serialization function.
2022-08-04 23:34:41 +01:00
Christoph Reiter efe100df9e CI: remove workaround for some subproject builds failing on Windows
In some cases subproject builds under MSYS2 failed, see
https://gitlab.gnome.org/GNOME/gtk/-/issues/2243
https://gitlab.gnome.org/GNOME/gtk/-/issues/3002
https://gitlab.gnome.org/GNOME/gtk/-/issues/5053

These manual pango/glib build instructions were added to work around
the problem by avoiding the subprojects.

https://gitlab.gnome.org/GNOME/gtk/-/issues/5053 uncovered the bug in
binutils, which is now fixed in master there and was also backported
into MSYS2 which we use in CI.

So we can just remove the workaround again now.
2022-08-04 22:26:04 +02:00
Yuri Chornoivan a07ee709d2 Update Ukrainian translation 2022-08-04 14:33:50 +00:00
Matthias Clasen 60b77736b5 Merge branch 'cleanup-ffmpeg' into 'main'
ffmpeg: add audio playback through avdevice

See merge request GNOME/gtk!4852
2022-08-04 10:49:45 +00:00
Stephan Vedder 83ff85d227 ffmpeg: add audio playback through avdevice 2022-08-04 10:49:44 +00:00
Matthias Clasen f7b3a214f3 Merge branch 'mount_operation' into 'main'
mountoperation: Fix authentication dialog

Closes #5059 and #5058

See merge request GNOME/gtk!4899
2022-08-03 11:56:25 +00:00
Matthias Clasen c1053096bd Merge branch 'win32-nahimic-nv-notes' into 'main'
running.md: Mention about issue with Nahimic on Windows

Closes #4113

See merge request GNOME/gtk!4915
2022-08-02 11:10:25 +00:00
Chun-wei Fan f2b85fa1c7 running.md: Mention about issue with Nahimic on Windows
Let people know that they will need to use GTK with the Nahimic service
disabled or OpenGL disabled or put their GTK application into the Nahimic
backlist, or try to use GLES, since there is a known issue in the Windows
nVidia graphics drivers and Nahimic that causes GL operations to fail,
causing crashes in operations such as window resizes.

This will close issue #4113--sadly, there is nothing we can do within
GTK to fix the issue.
2022-08-02 13:50:49 +08:00
Matthias Clasen a48942bf39 Merge branch 'label-tabs' into 'main'
Label tabs

See merge request GNOME/gtk!4914
2022-08-02 00:18:44 +00:00
Benjamin Otte c1d6160bd4 Merge branch 'otte-main-patch-86462' into 'main'
Fix g_object_new(GTK_TYPE_SNAPSHOT)

See merge request GNOME/gtk!4919
2022-08-01 20:47:12 +00:00
Benjamin Otte dbab69c453 snapshot: Don't critical on dispose
When there's remaining state that draws nothing, it returns no
rendernode. So do a NULL-check before unreffing it.
2022-08-01 20:28:46 +00:00
Benjamin Otte 09f0c96b9b Fix g_object_new(GTK_TYPE_SNAPSHOT)
GJS apparent likes g_object_new() over actual constructors, so make that work.
2022-08-01 20:08:58 +00:00
Matthias Clasen 641a589734 Add GtkLabel:tabs
This adds more powerful formatting capabilities to GtkLabel
without costing us much, since Pango already supports tabs.
2022-08-01 08:20:05 -04:00
Christian Hergert 9bce70ed8d Merge branch 'wip/chergert/builder-expose-object-fix' into 'main'
builder: gracefully handle re-exposing builder object

See merge request GNOME/gtk!4913
2022-08-01 05:09:53 +00:00
Christian Hergert d00d1334ce gtkbuilder: update gtk_builder_expose_object() docs 2022-07-31 21:37:20 -07:00
Christian Hergert fbe124ca54 gtkbuilder: update gtk_builder_extend_with_templat() docs 2022-07-31 21:25:58 -07:00
Christian Hergert f680b86130 gtkbuilder: check for existing object before extending template
If gtk_builder_expose_object() is called twice with the same name, it will
result in a g_critical(). This improves that situation by checking for the
object before exposing additional times.

This turns out to be handy in situations where templates are expanded
multiple times, such as application-side implementations of UI merging.
2022-07-31 21:25:58 -07:00
Dr. David Alan Gilbert dbc4e18bf8 x11: Don't assume valid type
If we get an invalid TARGETS reply, we might not have a valid 'type',
which ends up as NULL and segs in the g_str_equal.

(This is probably fallout from my fix 506566b6a4, which I still
can't reproduce reliably, so the last one just moved the seg a bit
further along, and we still don't know who is sending a bad TARGETS).

This corresponds to:
https://bugzilla.redhat.com/show_bug.cgi?id=2062143
2022-07-30 22:11:59 +01:00
Luca Bacci 924da0e84b Merge branch 'fix-gdk-win32-dnd' into 'main'
Fix DnD on Windows

Closes #4498

See merge request GNOME/gtk!4900
2022-07-29 12:42:57 +00:00
Christian Kirbach 38f14303d8 Update German translation 2022-07-28 21:13:07 +00:00
Nart Tlisha b896b73e5e Update Abkhazian translation 2022-07-28 19:19:12 +00:00
Matthias Clasen 81a65690f8 Merge branch 'alatiera/node-flatpak' into 'main'
flatpak: add a NodeEditor demo

See merge request GNOME/gtk!4898
2022-07-28 18:08:47 +00:00
Matthias Clasen 33f7d96e8f Merge branch 'ebassi/file-list-fixes' into 'main'
Add constructors for GdkFileList

See merge request GNOME/gtk!4907
2022-07-28 18:07:34 +00:00
Emmanuele Bassi dcd549aebe Add constructors for GdkFileList
C API users can keep dealing with the implicit equivalence of
GdkFileList and GSList, but language bindings have no idea that one type
is another, and none of them exposes GSList as a type anyway, so they
will need a way to construct a GdkFileList.

Instead of making GdkFileList mutable, and re-implement GSList, we only
provide a constructors pair that lets you create a GdkFileList from a
linked list or from an array.
2022-07-28 14:41:35 +01:00
Emmanuele Bassi 8a4aee583c Merge branch 'barthalion/gnome-runtime-images-quay' into 'main'
Update (or drop) the Docker image used by Flatpak job

See merge request GNOME/gtk!4906
2022-07-27 11:39:55 +00:00
Bartłomiej Piotrowski ea21923932 Update (or drop) the Docker image used by Flatpak job
The gnome-runtime-images have been recently migrated to Quay. This is already reflected in the template.

Please note this MR has been created semi-automatically. If it doesn't make sense, feel free to close it.
2022-07-27 12:47:50 +02:00
Daniel Mustieles 5ca266f137 Updated Spanish translation 2022-07-27 11:36:48 +02:00
Christian Hergert b9f374c0c6 Merge branch 'wip/chergert/disable-sysprof-agent' into 'main'
build: configure subproject sysprof with -Dagent=false

See merge request GNOME/gtk!4896
2022-07-26 23:44:37 +00:00
Christian Hergert a32b9d8b51 build: configure subproject sysprof with -Dagent=false
Sysprof has a new -Dagent=true build option which allows installing a
/usr/bin/sysprof-agent program (simimlar to sysprof-cli). It provides a
P2P D-Bus API to the process which can control subprocesses. It's used by
IDE tooling to have more control across container boundaries.

However, we do not need it for GTK CI.
2022-07-26 16:29:25 -07:00
Emmanuele Bassi c92b27f41b Merge branch 'markand-main-patch-04776' into 'main'
gtk: Missing end of code block

See merge request GNOME/gtk!4902
2022-07-26 15:09:28 +00:00
David Demelier 06bec5fb45 gtk: Missing end of code block 2022-07-26 14:52:30 +00:00
Nart Tlisha e0be85ccca Add Abkhazian translation 2022-07-26 11:17:20 +00:00
Benjamin Otte 0c052c9a37 Merge branch 'gridview' into 'main'
Gridview fix rubberbanding issues

Closes #3462 and #3445

See merge request GNOME/gtk!4688
2022-07-26 01:08:08 +00:00
Corey Berla a7bbc25851 listview: Fix selection for last item in get_items_in_rect
Make the last item dependent on y + height
2022-07-25 17:55:26 -07:00
Corey Berla d6fab1408a listview: Allow starting rubberband in empty space below last row
Rubberband does not work when initiated past the last row
(warning is printed "Could not start rubberbanding: No item).

Clamp y at the max height of the widgets in the listview
2022-07-25 17:55:15 -07:00
Corey Berla e14b84ff67 listview: Return an empty bitset when selecting only empty space
Return an empty bitset if the user selects exclusively below the last
row.
2022-07-25 17:54:44 -07:00
Corey Berla aba2d994e6 gridview: Fix typo in docstring for gtk_grid_view_get_cell_at_y() 2022-07-25 17:54:44 -07:00
Corey Berla 57c032e6cc listbase: Clear selection if rubberband selected an empty set
If rubberband returns an empty bitset the selection should be cleared
unless the shift or ctrl key is held
2022-07-25 17:54:44 -07:00
Corey Berla f3fc8f5b35 gridview: Return an empty bitset when selecting only empty space
Return an empty bitset if the user selects exclusively below the last
row.  No need to calculate selection.
2022-07-25 17:54:44 -07:00
Corey Berla ba909cf901 gridview: Fix get_items_in_rect() selection
last_row should be dependent on y + height, not y
2022-07-25 17:54:44 -07:00
Corey Berla 1e9a36ffa8 gridview: Allow starting rubberband in empty space below last row
Rubberband does not work when initiated past the last row
(warning is printed "Could not start rubberbanding: No item).

Clamp y at the max height of the widgets in the gridview

Fixes: #3462
2022-07-25 17:54:35 -07:00
Corey Berla c6f357e447 gridview: Limit rectangle to gridview columns
The function gtk_grid_view_get_items_in_rect() erroneously calculates
columns less than 0 and greater than n_columns when the user attempts
to rubberband all the way to the left or right respectively.  This
causes the rubberband to persistent and creates unexpected behavior.
Limit the rows to a minimum of 0 and maximum of n_columns - 1.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3445
2022-07-25 17:27:24 -07:00
Corey Berla 2bcae546b3 gridview: Move gtk_grid_view_computer_total_height() up for reuse 2022-07-25 17:27:24 -07:00
Emmanuele Bassi 291696607a Merge branch 'widget-docs-fix' into 'main'
gtkwidget: Fix a small typo in a docs comment

See merge request GNOME/gtk!4901
2022-07-25 21:31:18 +00:00
Philip Withnall 87ba99f66b gtkwidget: Fix a small typo in a docs comment
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-07-25 23:15:58 +02:00
Zurab Kargareteli fc20268cb8 Update Georgian translation 2022-07-25 16:03:57 +00:00
darkcutler 64a959dad9 Fix DnD on Windows
DnD under Windows needed 3 fixes to work with Gtk.DropTarget.

1. The droptarget_w32format_contentformat_map list never gets
filled so the gdk_win32_drop_read_async throws
"No compatible transfer format found".
This is an easy fix and done the same way in the win32 clipboard code.

2. After a drop no gdk_drop_emit_leave_event gets emitted.
This causes a second drop to trigger a bunch of assertion
'self->drop == drop' failed because the first drop is still active.
This is also an easy fix and done the same way by the macos backend.

3. Handling gdk_drop_status/gdk_drop_get_actions interaction.
In gtk_drop_target_do_drop the code
```gdk_drop_finish (self->drop, gdk_drop_get_actions (self->drop));```
calls the finish operation with the actions of the drop which triggers
```g_return_if_fail (gdk_drag_action_is_unique (action));```
in gdk_drop_finish. The code assumes that GdkDrop::actions gets
narrowed down by calling gdk_drop_status. This is hard to assure
because at the same time gdk_drop_get_actions is used by
gtk_drop_target_accept to figure out if a drag is accepted.
GdkDrop::actions serves a double purpose here as the supported source
actions and the currently agreed on action. Both the x11 and the
wayland backend get this wrong somewhat too. Under wayland/x11 when
a drag coming from a source that supports both MOVE and COPY is
first hovering a drop target that only supports COPY it is afterwards
no longer accepted by other drop targets only accepting MOVE.
Under x11 this is permanent for this drag but with wayland the drag
recovers when hovering other widgets. The win32 backend now sets the
supported source actions before any enter/move/drop and narrows them
down in gdk_win32_drop_status.

The patch only touches the win32 backend and fixes all three issues,
for me restoring DnD under windows.

Closes #4498
2022-07-25 15:16:23 +00:00
Corey Berla 111929593a mountoperation: Free user_widgets list upon dialog destruction
There's a list user_widgets that contains all of the entries and
selections during authentication.  This is only freed  upon
finalizing the GtkMountOperation.  It's possible (and true for the
GVFS SMB implementation) that a MountOperation can have the
gtk_mount_operation_ask_password_do_gtk () function called multiple
times (i.e. bad password).  The user_widgets list grows with now
invalid pointers to old widgets (causing unexpected behavior and
seg faults).

Free the user_widgets list upon dialog destruction, we don't need it
anymore.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5059
Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5058
2022-07-25 06:54:14 -07:00
Jordan Petridis 23bd7c1c05 flatpak-build.sh: change the buildtype to debugoptimized
So that the flatpaks will include debuginfo and make debugging
easier.
2022-07-25 15:42:14 +03:00
Jordan Petridis f99880a74a flatpak: add a NodeEditor demo 2022-07-25 15:38:55 +03:00
Emmanuele Bassi 61bf5ac009 Merge branch 'content-fit-since' into 'main'
picture: Fix Since and Deprecated annotations for content-fit

See merge request GNOME/gtk!4897
2022-07-25 11:45:43 +00:00
Maximiliano Sandoval R ef07d1556b picture: Fix Since and Deprecated annotations
gi-docgen will parse four or more whitespaces of indentation as code blocks,
two whitespaces were used.

This was missing in https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4873.
2022-07-25 12:59:47 +02:00
Corey Berla dd5d1030b5 mountoperation: Select "Anonymous" check button by default
It is already explicitly assumed that anonymous authentication will
be used when available, but it is not clear to the user since neither
of the check buttons are selected.  Select the Anonymous check button
by default.
2022-07-24 20:53:41 -07:00
Jordi Mas f480ff2e4d Update Catalan translation 2022-07-21 04:25:20 +02:00
Mat 9c919ffa46 treepopover: Do not propagate natural width of content
Propagating the natural width of the tree popover contents breaks ellipsizing of items
(see 'Unconstrained menu' in tests/testcombo).
2022-07-20 16:51:33 +03:00
Carlos Garnacho 2b131f09a8 Merge branch 'fix-controller-key-event-propagation-file-chooser-widget' into 'main'
GtkFileChooserWidget: Propagate captured key events when the location entry is focused

Closes #4880

See merge request GNOME/gtk!4674
2022-07-19 22:15:04 +00:00
Matthias Clasen b165028e86 Merge branch 'drag-action' into 'main'
tree/iconview: Use a unique drag action in drag_enter/motion callbacks

Closes #3187

See merge request GNOME/gtk!4882
2022-07-18 14:35:11 +00:00
Matthias Clasen 6e379181d9 Merge branch 'treeview-drag-ancestor' into 'main'
treeview: Check for column header area in row click/drag gestures

Closes #4453

See merge request GNOME/gtk!4885
2022-07-18 14:33:26 +00:00
Matthias Clasen edf8c9e501 Merge branch 'matthiasc/for-main' into 'main'
css: Fix handling of transform values

See merge request GNOME/gtk!4890
2022-07-18 14:24:49 +00:00
Matthias Clasen f95f992d32 Merge branch 'wip/carlosg/use-press-serial' into 'main'
gdk/wayland: Use last implicit grab serial for DnD start requests

Closes #5048

See merge request GNOME/gtk!4889
2022-07-18 14:18:22 +00:00
Carlos Garnacho 95cf34ab4c gdk/wayland: Stop storing the last serial in GdkWaylandDisplay
This is not used anymore, so we can drop the serial being stored
here.
2022-07-18 15:21:40 +02:00
Matthias Clasen 0cebf6d9c5 Merge branch 'drop-target-unique' into 'main'
droptarget: Provide a unique action for gdk_drop_finish

Closes #5051

See merge request GNOME/gtk!4888
2022-07-18 12:38:52 +00:00
Matthias Clasen de6b8da6c4 Merge branch 'tree-popover-scroll' into 'main'
treepopover: Add support for scrolling

Closes #3674 and #4877

See merge request GNOME/gtk!4887
2022-07-18 12:28:34 +00:00
Matthias Clasen 03f24bb5cf css: Improve test coverage
Among other things, this includes a test for the fix
in the previous commit.
2022-07-18 07:08:01 -05:00
Matthias Clasen 6ef3968227 css: Fix handling of transform values
When computing a transform value, there is nothing
to do, but we still need to copy the matrix from
src to dest, since it depends on the other transforms
in the array whether we are using the src or the
dest in the end.

This fixes cases like
-gtk-icon-transform: perspective(100px) matrix(1,2,...);
which would otherwise end up with a zero matrix.
2022-07-18 07:08:01 -05:00
Matthias Clasen eb1a2268bb gtk: Improve test coverage 2022-07-18 07:08:01 -05:00
Matthias Clasen 64193ae706 sortlistmodel: Add more tests 2022-07-18 07:08:01 -05:00
Matthias Clasen 4682eb214a filterlistmodel: Add more tests 2022-07-18 07:08:01 -05:00
Carlos Garnacho 5a34b7ecc6 gdk/wayland: Use last press serial for clipboard/primary selections
This serial observes key and button presses, we can use that instead
of relying on the last serial which might come from other
events/devices.
2022-07-18 13:01:27 +02:00
Carlos Garnacho eb0b98d5f2 gdk/wayland: Use last implicit grab serial for DnD start requests
This serial should be that from a button press/touch down/etc, use
the last implicit grab here, which will presumably be from the same
device that triggered the event.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5048
2022-07-18 13:00:32 +02:00
Mat 89db59a40d treepopover: Add support for scrolling
Add support for scrolling large tree popovers in a similar fashion to GtkPopoverMenu.

Fixes #3674
Fixes #4877
2022-07-18 00:44:28 +03:00
Mat 9209fd65a5 droptarget: Provide a unique action for gdk_drop_finish
gdk_drop_finish() requires a unique drop action. Reuse the existing
make_action_unique() function to get one.

Fixes #5051
2022-07-17 22:59:59 +03:00
Quentin PAGÈS 7dd874cec8 Update Occitan translation 2022-07-17 15:38:50 +00:00
Emmanuele Bassi 4a5d15535e Merge branch 'picture-suggest-content-fit' into 'main'
picture: Remove keep-aspect-ratio mention in the doc

See merge request GNOME/gtk!4886
2022-07-17 15:00:19 +00:00
Mat c9a48736d6 treeview: Check for column header area in row click/drag gestures
Bail out if a row click/drag gesture is performed in the column header area,
since separate gestures handle column headers.

Fixes #4453
2022-07-17 17:36:38 +03:00
Marco Melorio 8376f5c9fa picture: Remove keep-aspect-ratio mention in the doc
We were still suggesting to use it in the main doc page. Suggest using
content-fit instead.
2022-07-17 16:21:53 +02:00
Matthias Clasen 1d94c75a78 Merge branch 'matthiasc/for-main' into 'main'
filterlistmodel: Add a test

See merge request GNOME/gtk!4884
2022-07-17 10:50:22 +00:00
Matthias Clasen d840e082e6 slicelistmodel: Improve a test
Make sure that replacements in the underlying model
don't affect the slice list model if they are outside
the slice window.
2022-07-17 06:32:15 -04:00
Matthias Clasen 2ed954d307 sortlistmodel: Add a test
Add  a test to prove that additions and removals
in the underlying model show up as expected.
2022-07-17 06:22:55 -04:00
Matthias Clasen 7b815768e0 filterlistmodel: Add a test
Test that items added in the underlying model show
up in the filter model (if they pass the filter).

Test removals as well.

See #5050
2022-07-17 06:22:31 -04:00
Mat d89297b152 tree/iconview: Use a unique drag action in drag_enter/motion callbacks
Functions already exist for providing a unique drag action for gdk_drop_finish().
Reuse these functions in the drag_enter/motion callbacks, since they require
a unique action as the return value.

Fixes #3187
2022-07-17 06:09:53 +03:00
Matthias Clasen ff038428d8 Merge branch 'matthiasc/for-main' into 'main'
widget-factory: Make the icon work uninstalled

See merge request GNOME/gtk!4881
2022-07-17 01:33:09 +00:00
Matthias Clasen 7321eb881a widget-factory: Make the icon work uninstalled
Include the app logo as a resource, so we can show
it even when uninstalled.
2022-07-16 21:16:40 -04:00
Matthias Clasen 648e423cc5 Merge branch 'fix-wrong-label-wrap-in-popover' into 'main'
popover: Correctly substract arrow height when measuring popover widget

See merge request GNOME/gtk!4880
2022-07-16 23:19:10 +00:00
Benjamin Otte 09da4db81f Merge branch 'dnd' into 'main'
DnD Fix Preferred Action for X11

Closes #4259

See merge request GNOME/gtk!4785
2022-07-16 21:37:15 +00:00
Corey Berla 16fd2608fd gdkdrop-x11: Use the preferred action if possible
The XDND suggested action is a relic from when the source would control
the action for a drop.  With the new GtkDropTarget the target decides
the action (not the source).  That means the all of the returned
results from the ::enter and ::motion handlers will be unexpectely
ignored. Prefer to use the preferred action over the x11 suggested action.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4259
2022-07-16 14:02:47 -07:00
Corey Berla c9c48d78bf gdkdrop-x11: Fix preferred action
gdk_x11_drop_update_actions() sets actions to
drop_x11->suggested_action when !drop_x11->xdnd_have_actions
and then sets it again to drop_x11->suggested_action if it is.
If xdnd_have_actions is true use xdnd_actions.
2022-07-16 13:42:58 -07:00
Yubao Liu 50a8cbc0da popover: Correctly substract arrow height when measuring popover widget
For default popover arrow position and default height-for-width layout mode,
natural_width is calculated first with for_size=-1 and orientation=HORIZONTAL,
at the end of gtk_popover_measure() natural_width  won't be added with tail_height.

Then to measure with for_size=natural_width and orientation=VERTICAL, obviously
for_size shouldn't be substract with tail_height.

The wrong logic will force content in popover gets less width and then text labels
in popover may get wrapped unnecessarily.
2022-07-17 00:29:42 +08:00
Benjamin Otte 188cb49b44 Merge branch 'content-fit-reftests' into 'main'
reftests: Add content-fit picture tests

See merge request GNOME/gtk!4879
2022-07-16 16:06:57 +00:00
Marco Melorio 6da65b25b6 reftests: Add content-fit picture tests 2022-07-16 17:53:13 +02:00
Matthias Clasen 405cfc8f1f Merge branch 'test-coverage' into 'main'
gtk-demo: Fix icon theme breakage

See merge request GNOME/gtk!4878
2022-07-16 14:08:37 +00:00
Matthias Clasen 9daf83a1da gtk-demo: Make the icon work uninstalled
Include the app logo as a resource, so we can show
it even when uninstalled.
2022-07-16 09:43:46 -04:00
Matthias Clasen f7811f5dc3 gtk-demo: Add a winning sound to the puzzle
We should celebrate every win.
2022-07-16 09:43:46 -04:00
Matthias Clasen 25ec58be3c gtk-demo: Fix icon theme breakage
The starred emblem silently went away :(
2022-07-16 09:43:46 -04:00
Matthias Clasen 61a843e824 gdk: Improve test coverage 2022-07-16 09:43:46 -04:00
Matthias Clasen 14cb208ec2 png loader: gray can have alpha 2022-07-16 09:43:46 -04:00
Matthias Clasen c642649311 gdk: Drop an unused function 2022-07-16 09:43:46 -04:00
Matthias Clasen 882c805b53 gdk: Improve test coverage 2022-07-16 09:43:46 -04:00
Benjamin Otte 9cc7dbe9c9 Merge branch 'content-fit-followup' into 'main'
GtkContentFit followups

See merge request GNOME/gtk!4877
2022-07-16 00:24:31 +00:00
Marco Melorio 3eac4ef5c9 picture: Move variable definition at the top 2022-07-16 01:40:08 +02:00
Marco Melorio f1faa71d6d picture: Set overflow to be hidden
The new content-fit property was wrongly suggesting to manually set
widgets' overflow property, but that property is not really intended to
be set by external code. This commit removes those suggestions and
directly set picture's overflow to be hidden.
2022-07-16 01:40:01 +02:00
Marco Melorio a08bc46936 picture: Fix replacement for deprecated methods 2022-07-16 01:18:07 +02:00
Matthias Clasen c6a56b52dc Merge branch 'text-placeholder-visibility' into 'main'
text: Update placeholder visibility more

See merge request GNOME/gtk!4875
2022-07-15 23:00:16 +00:00
Matthias Clasen 63c61340ac Merge branch 'test-coverage' into 'main'
node-editor: Make the help more helpful

See merge request GNOME/gtk!4874
2022-07-15 22:34:02 +00:00
Matthias Clasen 09f99ffb27 Merge branch 'gtk-content-fit' into 'main'
picture: Add content-fit property

Closes #5027

See merge request GNOME/gtk!4873
2022-07-15 22:28:42 +00:00
Matthias Clasen 3cc3a73d97 Merge branch 'nick.richards-main-patch-67353' into 'main'
Improve style in GtkInscription documentation

See merge request GNOME/gtk!4876
2022-07-15 22:21:23 +00:00
Marco Melorio d8a73cbd03 picture: Add content-fit property
It allows to specify the resize mode of the paintable inside the
GtkPicture allocation. This also deprecates the keep-aspect-ratio
property.

Fixes #5027.
2022-07-15 23:01:23 +02:00
nick richards 624f5ba0ec Improve style in GtkInscription documentation 2022-07-15 20:55:37 +00:00
Matthias Clasen ac81ed3adb text: Update placeholder visibility more
When the text in the buffer changes, we should
update the placeholder visibility, since we might
have gone from empty to non-empty.
2022-07-15 16:47:02 -04:00
Matthias Clasen 5064a8eac0 gsk: Improve test coverage 2022-07-15 16:41:05 -04:00
Matthias Clasen a4c6517d06 glshader: Add preconditions
Add preconditions to many of the glshader
uniform apis.
2022-07-15 15:47:11 -04:00
Matthias Clasen 7ebc5454f4 Drop an unused function 2022-07-15 15:47:11 -04:00
Matthias Clasen 35e6a2fdb8 node-editor: Sort help better
Move the gshader section where it belongs.
2022-07-15 15:46:06 -04:00
Matthias Clasen 69336fa5f1 node-editor: Make the help more helpful
I struggled to remember how newlines vs strings work in
this format, so put it in the docs.
2022-07-15 15:46:06 -04:00
Matthias Clasen 2cbb955e49 rendernodeparser: Cosmetics 2022-07-15 15:46:06 -04:00
Matthias Clasen 42042e6811 Add some tests for GtkNoSelection 2022-07-15 15:46:06 -04:00
Matthias Clasen f8f669b895 Add some tests for the listlistmodel 2022-07-15 15:46:06 -04:00
Corey Berla 7df347d9a5 places: Align popover menu with mouse position
The popover menu previously always pops up in the center of each
row regardless of where the mouse cursor is currently positioned.

Make the popover popup at the current mouse position. If the popover
is triggered by the keyboard (i.e. SHIFT+F10), then align it with the
start of the row.
2022-05-07 18:50:59 +01:00
Corey Berla 7ed8a6ae3c places: Fix crash when right clicking row
After right clicking multiple rows, or after adding / removing rows
(i.e. new network locations), right clicking the row will crash
nautilus.

This happens because the popover may become orphan but still expect
a parent.

Reposition the popover menu instead of reparenting it.
2022-05-07 18:45:17 +01:00
Corey Berla ff84b96480 places: Fix crash when disconnecting
After disconnecting a network mount in places (when there's 2 or more
mounts), right clicking another mount crashes the application.
Set row_for_action to NULL when successfully unmounted.
2022-05-07 18:22:15 +01:00
António Fernandes 64347f2c79 placessidebar: Point to row instead or reparenting popovers
In GTK 3 we used to move the popovers around using set_relative_to();
this is gone in GTK 4 and the apparent direct replacement is setting
the target widget as the new parent.

But this requires a lot of careful handling least the popover become
orphan, which gets us ready to crash at any moment.

Since we only care about positioning the popovers relative to a row,
let's use the set_pointing_to() instead of reparenting. Now, the
sidebar is always the parent.
2022-05-07 18:10:44 +01:00
Luca Bacci 1af7cde1a8 Propagate key events when the location entry is focused
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4880
2022-04-29 16:53:02 +02:00
391 changed files with 50381 additions and 37684 deletions
+1
View File
@@ -4,6 +4,7 @@ AlwaysBreakAfterDefinitionReturnType: All
BreakBeforeBinaryOperators: None
BinPackParameters: false
SpaceAfterCStyleCast: true
PointerAlignment: Right
# Our column limit is actually 80, but setting that results in clang-format
# making a lot of dubious hanging-indent choices; disable it and assume the
# developer will line wrap appropriately. clang-format will still check
+44 -3
View File
@@ -3,6 +3,7 @@ include:
file: 'flatpak/flatpak_ci_initiative.yml'
stages:
- check
- build
- analysis
- docs
@@ -21,12 +22,12 @@ stages:
# Common variables
variables:
COMMON_MESON_FLAGS: "-Dwerror=true -Dglib:werror=false -Dpango:werror=false -Dgtk-doc:werror=false -Dwayland-protocols:werror=false -Dsysprof:werror=false"
COMMON_MESON_FLAGS: "-Dwerror=true -Dglib:werror=false -Dpango:werror=false -Dgtk-doc:werror=false -Dwayland-protocols:werror=false -Dsysprof:werror=false -Dwayland:werror=false"
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true"
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled"
MESON_TEST_TIMEOUT_MULTIPLIER: 3
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v38"
FLATPAK_IMAGE: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master"
FLATPAK_IMAGE: "quay.io/gnome_infrastructure/gnome-runtime-images:gnome-master"
.only-default:
only:
@@ -37,7 +38,7 @@ variables:
style-check-diff:
extends: .only-default
image: $FEDORA_IMAGE
stage: .pre
stage: check
allow_failure: true
script:
- .gitlab-ci/run-style-check-diff.sh
@@ -109,6 +110,29 @@ release-build:
- ninja -C _build
- .gitlab-ci/run-tests.sh _build x11
fedora-mingw64:
extends: .build-fedora-default
stage: build
needs: []
before_script:
- sudo dnf install -y
mingw64-filesystem
mingw64-gcc
mingw64-binutils
mingw64-cairo
mingw64-gdk-pixbuf
mingw64-gstreamer1-plugins-bad-free
mingw64-glib2
mingw64-libepoxy
mingw64-pango
# mingw64-graphene (rawhide)
script:
- .gitlab-ci/show-info-linux.sh
- meson subprojects update
- mkdir _build && cd _build
- mingw64-meson -Dintrospection=disabled -Dgraphene:introspection=disabled
- ninja
installed-tests:
extends: .build-fedora-default
stage: build
@@ -269,6 +293,18 @@ flatpak-main:icon-browser:
variables:
APPID: org.gtk.IconBrowser4
flatpak-manual:node-editor:
extends: .flatpak-manual
needs: []
variables:
APPID: org.gtk.gtk4.NodeEditor
flatpak-main:node-editor:
extends: .flatpak-main
needs: []
variables:
APPID: org.gtk.gtk4.NodeEditor
# Publish the demo apps to the GNOME Nightly repo
# https://wiki.gnome.org/Apps/Nightly
# https://gitlab.gnome.org/GNOME/Initiatives/-/wikis/DevOps-with-Flatpak
@@ -287,6 +323,11 @@ nightly icon-browser:
dependencies: ['flatpak-main:icon-browser']
needs: ['flatpak-main:icon-browser']
nightly node-editor:
extends: '.publish_nightly'
dependencies: ['flatpak-main:node-editor']
needs: ['flatpak-main:node-editor']
static-scan:
image: $FEDORA_IMAGE
stage: analysis
+1 -1
View File
@@ -16,7 +16,7 @@ flatpak-builder \
flatpak build ${builddir} meson \
--prefix=/app \
--libdir=/app/lib \
--buildtype=release \
--buildtype=debugoptimized \
-Dx11-backend=true \
-Dwayland-backend=true \
-Dbuild-tests=false \
+33 -15
View File
@@ -2,25 +2,43 @@
set -e
# We need to add a new remote for the upstream main, since this script could
# be running in a personal fork of the repository which has out of date branches.
if [ "${CI_PROJECT_NAMESPACE}" != "GNOME" ]; then
echo "Retrieving the current upstream repository from ${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}..."
ancestor_horizon=31 # days (one month)
# Recently, git is picky about directory ownership. Tell it not to worry.
git config --global --add safe.directory "$PWD"
# We need to add a new remote for the upstream target branch, since this script
# could be running in a personal fork of the repository which has out of date
# branches.
#
# Limit the fetch to a certain date horizon to limit the amount of data we get.
# If the branch was forked from origin/main before this horizon, it should
# probably be rebased.
if ! git ls-remote --exit-code upstream >/dev/null 2>&1 ; then
git remote add upstream https://gitlab.gnome.org/GNOME/gtk.git
git fetch upstream
ORIGIN="upstream"
else
echo "Reusing the existing repository on ${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}"
ORIGIN="origin"
fi
# Work out the newest common ancestor between the detached HEAD that this CI job
# has checked out, and the upstream target branch (which will typically be
# `upstream/main` or `upstream/gtk-3-24`).
#
# `${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}` is only defined if were running in
# a merge request pipeline; fall back to `${CI_DEFAULT_BRANCH}` otherwise.
newest_common_ancestor_sha=$(diff --old-line-format='' --new-line-format='' <(git rev-list --first-parent "${ORIGIN}/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-${CI_DEFAULT_BRANCH}}") <(git rev-list --first-parent HEAD) | head -1)
# `upstream/main` or `upstream/glib-2-62`).
# `${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}` or `${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}`
# are only defined if were running in a merge request pipeline,
# fall back to `${CI_DEFAULT_BRANCH}` or `${CI_COMMIT_BRANCH}` respectively
# otherwise.
source_branch="${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:-${CI_COMMIT_BRANCH}}"
target_branch="${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-${CI_DEFAULT_BRANCH}}"
git fetch --shallow-since="$(date --date="${ancestor_horizon} days ago" +%Y-%m-%d)" origin "${source_branch}"
git fetch --shallow-since="$(date --date="${ancestor_horizon} days ago" +%Y-%m-%d)" upstream "${target_branch}"
newest_common_ancestor_sha=$(git merge-base upstream/${target_branch} origin/${source_branch})
if [ -z "${newest_common_ancestor_sha}" ]; then
echo "Couldnt find common ancestor with upstream main branch. This typically"
echo "happens if you branched from main a long time ago. Please update"
echo "your clone, rebase, and re-push your branch."
exit 1
fi
git diff -U0 --no-color "${newest_common_ancestor_sha}" | .gitlab-ci/clang-format-diff.py -binary "clang-format" -p1
exit_status=$?
@@ -36,7 +54,7 @@ exit_status=$?
echo ""
echo "Note that clang-format output is advisory and cannot always match the"
echo "GTK coding style, documented at:"
echo " https://gitlab.gnome.org/GNOME/gtk/blob/main/docs/CODING-STYLE"
echo " https://gitlab.gnome.org/GNOME/gtk/blob/main/docs/CODING-STYLE.md"
echo "Warnings from this tool can be ignored in favour of the documented "
echo "coding style, or in favour of matching the style of existing"
echo "surrounding code."
-19
View File
@@ -38,25 +38,6 @@ mkdir -p _ccache
export CCACHE_BASEDIR="$(pwd)"
export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
# https://gitlab.gnome.org/GNOME/gtk/-/issues/2243
# https://gitlab.gnome.org/GNOME/gtk/-/issues/3002
if ! pkg-config --atleast-version=2.66.0 glib-2.0; then
git clone https://gitlab.gnome.org/GNOME/glib.git _glib
meson setup _glib_build _glib
meson compile -C _glib_build
meson install -C _glib_build
fi
pkg-config --modversion glib-2.0
if ! pkg-config --atleast-version=1.50.0 pango; then
git clone https://gitlab.gnome.org/GNOME/pango.git _pango
meson setup _pango_build _pango
meson compile -C _pango_build
meson install -C _pango_build
fi
pkg-config --modversion pango
# Build
ccache --zero-stats
ccache --show-stats
+148
View File
@@ -1,3 +1,151 @@
Overview of Changes in 4.8.0, 06-09-2022
========================================
* GtkTreeView:
- Fix a problem with scrolling animations
- Fix some event handling problems
- Drop unreachable code
* GtkText:
- Respect the no-emoji input hint fully
* GtkEmojiChooser:
- Fix arrow key navigation
* GtkFontChooser:
- Improve the handling of OpenType font features
* GtkTreeListModel:
- Fix handling of collapsed child nodes
* GtkInscription:
- Fix accessible name
* Theme:
- Fix placeholder text in HighContrast
* Increase the memory limit for the jpeg loader to 300M
* Miscellaneous memory leak fixes
* Wayland:
- Refator handling of text protocol client updates
* Windows:
- Support high-resolution scroll wheel events
- Generate GdkWin32.gir
- Implement color picking
* Translation updates
Abkhazian
Basque
Brazilian Portuguese
Bulgarian
Catalan
Chinese (China)
Croatian
Czech
Danish
Dutch
Galician
Georgian
German
Hungarian
Icelandic
Indonesian
Korean
Latvian
Lithuanian
Persian
Polish
Portuguese
Russian
Serbian
Spanish
Swedish
Turkish
Ukrainian
Overview of Changes in 4.7.2, 10-08-2022
========================================
* GtkTextView:
- Fix child positioning with gutters
* GtkText:
- Update placeholder visibility when necessary
* GtkPicture:
- Add a content-fit property
* GtkPopover:
- Fix a size allocation problem with the arrow
* GtkTreeView:
- Fix a problem with DND
* GtkTreePopover:
- Support scrolling
* GtkGridView:
- Fix issues with rubberband selection
* GtkLabel:
- Add a tabs property
* GtkSnapshot:
- Make GtkSnapshot work from bindings
* GtkScrolledWindow:
- Scroll at a reasonable speed
* GtkPaned:
- Avoid an infinite loop
* GtkWindow:
- Improve generation and handling of crossing events
* CSS:
- Fix handling of certain transform values
* Media support:
- Add audio support to the ffmpeg backend
- Avoid oom with pathological jpeg images
* GDK:
- Fix handling of touchpad hold events
- Add support for hi-resolution scroll events
* X11:
- Fix preferred action for DND
* Windows:
- Fix DND
* List models:
- Fix items-changed emission
- Add more list model tests
* Demos:
- Add a winning sound to game demos
- Make app icons work uninstalled
* Translation updates:
Abkhazian
Basque
Catalan
Georgian
German
Indonesian
Occitan
Persian
Portuguese
Russian
Spanish
Ukrainian
Overview of Changes in 4.7.1, 12-07-2022
========================================
@@ -0,0 +1,138 @@
{
"app-id" : "org.gtk.gtk4.NodeEditor",
"runtime" : "org.gnome.Platform",
"runtime-version" : "master",
"sdk" : "org.gnome.Sdk",
"command" : "gtk4-node-editor",
"tags" : [
"devel",
"development",
"nightly"
],
"desktop-file-name-prefix" : "(Development) ",
"finish-args" : [
"--device=dri",
"--share=ipc",
"--socket=fallback-x11",
"--socket=wayland",
"--talk-name=org.gtk.vfs",
"--talk-name=org.gtk.vfs.*"
],
"cleanup" : [
"/include",
"/lib/pkgconfig",
"/share/pkgconfig",
"/share/aclocal",
"/man",
"/share/man",
"/share/gtk-doc",
"*.la",
".a",
"/lib/girepository-1.0",
"/share/gir-1.0",
"/share/doc"
],
"modules" : [
{
"name" : "wayland",
"buildsystem" : "meson",
"builddir" : true,
"config-opts" : [
"-Ddocumentation=false"
],
"sources" : [
{
"type" : "git",
"url" : "https://gitlab.freedesktop.org/wayland/wayland.git",
"branch" : "main"
}
]
},
{
"name" : "graphene",
"buildsystem" : "meson",
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib",
"-Dtests=false"
],
"sources" : [
{
"type" : "git",
"url" : "https://github.com/ebassi/graphene.git"
}
]
},
{
"name" : "libsass",
"buildsystem" : "meson",
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib"
],
"sources" : [
{
"type" : "git",
"url" : "https://github.com/lazka/libsass.git",
"branch" : "meson"
}
]
},
{
"name" : "sassc",
"buildsystem" : "meson",
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib"
],
"sources" : [
{
"type" : "git",
"url" : "https://github.com/lazka/sassc.git",
"branch" : "meson"
}
]
},
{
"name" : "pango",
"buildsystem" : "meson",
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib"
],
"sources" : [
{
"type" : "git",
"url" : "https://gitlab.gnome.org/GNOME/pango.git",
"branch" : "main"
}
]
},
{
"name" : "gtk",
"buildsystem" : "meson",
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized",
"-Dprofile=devel"
],
"sources" : [
{
"type" : "git",
"url" : "https://gitlab.gnome.org/GNOME/gtk.git",
"branch" : "main"
}
]
}
],
"build-options" : {
"env" : {
"DBUS_SESSION_BUS_ADDRESS" : "''",
"GSK_RENDERER" : "opengl",
"GDK_DEBUG" : "vulkan-disable",
"G_ENABLE_DEBUG" : "true"
}
}
}
+2
View File
@@ -428,6 +428,8 @@
<file>icons/16x16/emotes/face-laugh-symbolic.symbolic.png</file>
<file>icons/16x16/status/battery-caution-charging-symbolic.symbolic.png</file>
<file>icons/16x16/categories/applications-other.png</file>
<file>icons/48x48/status/starred.png</file>
<file alias="icons/scalable/apps/org.gtk.Demo4.svg">data/scalable/apps/org.gtk.Demo4.svg</file>
</gresource>
<gresource prefix="/org/gtk/Demo4/gtk">
<file preprocess="xml-stripblanks">help-overlay.ui</file>
-65
View File
@@ -1,65 +0,0 @@
--- demos/gtk-demo/font_features.c
+++ demos/gtk-demo/font_features.c
@@ -434,7 +434,7 @@ static void
update_display (void)
{
GString *s;
- const char *text;
+ char *text;
gboolean has_feature;
GtkTreeIter iter;
GtkTreeModel *model;
@@ -452,8 +452,12 @@ update_display (void)
gboolean do_waterfall;
GString *waterfall;
char *palette;
+ GtkTextBuffer *buffer;
+ GtkTextIter start_iter, end_iter;
- text = gtk_editable_get_text (GTK_EDITABLE (demo->the_entry));
+ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (demo->the_entry));
+ gtk_text_buffer_get_bounds (buffer, &start_iter, &end_iter);
+ text = gtk_text_buffer_get_text (buffer, &start_iter, &end_iter, FALSE);
text_len = strlen (text);
do_waterfall = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (demo->waterfall_toggle));
@@ -631,6 +635,8 @@ update_display (void)
pango2_font_description_free (desc);
g_free (features);
pango2_attr_list_unref (attrs);
+
+ g_free (text);
}
static Pango2Font *
@@ -1603,8 +1609,12 @@ font_features_toggle_edit (void)
{
if (strcmp (gtk_stack_get_visible_child_name (GTK_STACK (demo->stack)), "entry") != 0)
{
+ GtkTextBuffer *buffer;
+ GtkTextIter start, end;
g_free (demo->text);
- demo->text = g_strdup (gtk_editable_get_text (GTK_EDITABLE (demo->the_entry)));
+ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (demo->the_entry));
+ gtk_text_buffer_get_bounds (buffer, &start, &end);
+ demo->text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
gtk_stack_set_visible_child_name (GTK_STACK (demo->stack), "entry");
gtk_widget_grab_focus (demo->the_entry);
gtk_adjustment_set_value (gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (demo->swin)), 0);
@@ -1632,7 +1642,7 @@ entry_key_press (GtkEventController *controller,
{
if (keyval == GDK_KEY_Escape)
{
- gtk_editable_set_text (GTK_EDITABLE (entry), demo->text);
+ gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (demo->the_entry)), demo->text, -1);
return GDK_EVENT_STOP;
}
@@ -1701,7 +1711,6 @@ do_font_features (GtkWidget *do_widget)
basic_value_changed (demo->line_height_adjustment, demo->line_height_entry);
controller = gtk_event_controller_key_new ();
- g_object_set_data_full (G_OBJECT (demo->the_entry), "controller", g_object_ref (controller), g_object_unref);
g_signal_connect (controller, "key-pressed", G_CALLBACK (entry_key_press), demo->the_entry);
gtk_widget_add_controller (demo->the_entry, controller);
+15 -6
View File
@@ -217,30 +217,39 @@ update_image (void)
text = " ";
ch = g_utf8_get_char (text);
str = g_string_new ("");
layout = pango_layout_new (context);
retry:
for (i = 0; i < 4; i++)
{
g_string_append_unichar (str, ch);
g_string_append_unichar (str, 0x200c);
}
layout = pango_layout_new (context);
pango_layout_set_font_description (layout, desc);
pango_layout_set_text (layout, str->str, -1);
g_string_free (str, TRUE);
pango_layout_get_extents (layout, &ink, &logical);
pango_extents_to_pixels (&logical, NULL);
iter = pango_layout_get_iter (layout);
run = pango_layout_iter_get_run (iter);
if (run->glyphs->num_glyphs < 8)
{
/* not a good char to use */
g_string_truncate (str, 0);
ch = 'a';
goto retry;
}
g_string_free (str, TRUE);
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, logical.width * 3 / 2, 4*logical.height);
cr = cairo_create (surface);
cairo_set_source_rgb (cr, 1, 1, 1);
cairo_paint (cr);
iter = pango_layout_get_iter (layout);
run = pango_layout_iter_get_run (iter);
cairo_set_source_rgb (cr, 0, 0, 0);
for (i = 0; i < 4; i++)
{
+1
View File
@@ -223,6 +223,7 @@ static void
destroy_gear (struct gear *g)
{
g_free (g->strips);
g_free (g->vertices);
g_free (g);
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

+20
View File
@@ -8,6 +8,7 @@
* to implement rather different interaction behavior to a typical list.
*/
#include "config.h"
#include <glib/gi18n.h>
#include <gtk/gtk.h>
@@ -375,6 +376,23 @@ sweeper_game_init (SweeperGame *self)
sweeper_game_new_game (self, 8, 8, 10);
}
static void
celebrate (gboolean win)
{
char *path;
GtkMediaStream *stream;
if (win)
path = g_build_filename (GTK_DATADIR, "sounds", "freedesktop", "stereo", "complete.oga", NULL);
else
path = g_build_filename (GTK_DATADIR, "sounds", "freedesktop", "stereo", "suspend-error.oga", NULL);
stream = gtk_media_file_new_for_filename (path);
gtk_media_stream_set_volume (stream, 1.0);
gtk_media_stream_play (stream);
g_signal_connect (stream, "notify::ended", G_CALLBACK (g_object_unref), NULL);
g_free (path);
}
static void
sweeper_game_end (SweeperGame *self,
gboolean win)
@@ -383,7 +401,9 @@ sweeper_game_end (SweeperGame *self,
{
self->playing = FALSE;
g_object_notify_by_pspec (G_OBJECT (self), game_properties[GAME_PROP_PLAYING]);
celebrate (win);
}
if (self->win != win)
{
self->win = win;
+2 -8
View File
@@ -119,12 +119,6 @@ solitaire_peg_new (void)
/*** Helper for finding a win ***/
static void
ended (GObject *object)
{
g_object_unref (object);
}
static void
celebrate (gboolean win)
{
@@ -134,12 +128,12 @@ celebrate (gboolean win)
if (win)
path = g_build_filename (GTK_DATADIR, "sounds", "freedesktop", "stereo", "complete.oga", NULL);
else
path = g_build_filename (GTK_DATADIR, "sounds", "freedesktop", "stereo", "dialog-error.oga", NULL);
path = g_build_filename (GTK_DATADIR, "sounds", "freedesktop", "stereo", "suspend-error.oga", NULL);
stream = gtk_media_file_new_for_filename (path);
gtk_media_stream_set_volume (stream, 1.0);
gtk_media_stream_play (stream);
g_signal_connect (stream, "notify::ended", G_CALLBACK (ended), NULL);
g_signal_connect (stream, "notify::ended", G_CALLBACK (g_object_unref), NULL);
g_free (path);
}
+28 -1
View File
@@ -5,6 +5,7 @@
* small sliding puzzle game.
*/
#include "config.h"
#include <gtk/gtk.h>
/* Include the header for the puzzle piece */
@@ -24,6 +25,30 @@ static guint height = 3;
static guint pos_x;
static guint pos_y;
static void
ended (GObject *object)
{
g_object_unref (object);
}
static void
celebrate (gboolean win)
{
char *path;
GtkMediaStream *stream;
if (win)
path = g_build_filename (GTK_DATADIR, "sounds", "freedesktop", "stereo", "complete.oga", NULL);
else
path = g_build_filename (GTK_DATADIR, "sounds", "freedesktop", "stereo", "suspend-error.oga", NULL);
stream = gtk_media_file_new_for_filename (path);
gtk_media_stream_set_volume (stream, 1.0);
gtk_media_stream_play (stream);
g_signal_connect (stream, "notify::ended", G_CALLBACK (ended), NULL);
g_free (path);
}
static gboolean
move_puzzle (GtkWidget *grid,
int dx,
@@ -157,6 +182,8 @@ check_solved (GtkWidget *grid)
picture = gtk_grid_get_child_at (GTK_GRID (grid), pos_x, pos_y);
gtk_picture_set_paintable (GTK_PICTURE (picture), piece);
celebrate (TRUE);
return TRUE;
}
@@ -330,7 +357,7 @@ start_puzzle (GdkPaintable *paintable)
x, y,
width, height);
picture = gtk_picture_new_for_paintable (piece);
gtk_picture_set_keep_aspect_ratio (GTK_PICTURE (picture), FALSE);
gtk_picture_set_content_fit (GTK_PICTURE (picture), GTK_CONTENT_FIT_FILL);
gtk_grid_attach (GTK_GRID (grid),
picture,
x, y,
-1
View File
@@ -216,7 +216,6 @@
<child>
<object class="GtkPicture" id="picture">
<property name="can-shrink">0</property>
<property name="keep-aspect-ratio">1</property>
<property name="halign">center</property>
<property name="valign">center</property>
<child>
+19 -17
View File
@@ -13,6 +13,8 @@ Each node has its own `<node-name>` and supports a custom set of properties, eac
When serializing and the value of a property equals the default value, this value will not be serialized. Serialization aims to produce an output as small as possible.
To embed newlines in strings, use \A. To break a long string into multiple lines, escape the newline with a \.
# Nodes
### container
@@ -135,6 +137,23 @@ Creates a node like `gsk_cross_fade_node_new()` with the given properties.
Creates a node like `gsk_debug_node_new()` with the given properties.
### glshader
| property | syntax | default | printed |
| ---------- | ------------------ | ---------------------- | ----------- |
| bounds | `<rect>` | 50 | always |
| sourcecode | `<string>` | "" | always |
| args | `<uniform values>` | none | non-default |
| child1 | `<node>` | none | non-default |
| child2 | `<node>` | none | non-default |
| child3 | `<node>` | none | non-default |
| child4 | `<node>` | none | non-default |
Creates a GLShader node. The `sourcecode` must be a GLSL fragment shader.
The `args` must match the uniforms of simple types declared in that shader,
in order and comma-separated. The `child` properties must match the sampler
uniforms in the shader.
### inset-shadow
| property | syntax | default | printed |
@@ -286,20 +305,3 @@ representation for this texture is `url("data:image/png;base64,iVBORw0KGgoAAAANS
| transform| `<transform>` | none | non-default |
Creates a node like `gsk_transform_node_new()` with the given properties.
### glshader
| property | syntax | default | printed |
| ---------- | ------------------ | ---------------------- | ----------- |
| bounds | `<rect>` | 50 | always |
| sourcecode | `<string>` | "" | always |
| args | `<uniform values>` | none | non-default |
| child1 | `<node>` | none | non-default |
| child2 | `<node>` | none | non-default |
| child3 | `<node>` | none | non-default |
| child4 | `<node>` | none | non-default |
Creates a GLShader node. The `sourcecode` must be a GLSL fragment shader.
The `args` must match the uniforms of simple types declared in that shader,
in order and comma-separated. The `child` properties must match the sampler
uniforms in the shader.
+26 -1
View File
@@ -213,6 +213,31 @@ activate_background (GSimpleAction *action,
populate_flowbox (flowbox);
}
static void
file_chooser_response (GtkNativeDialog *self,
int response)
{
gtk_native_dialog_destroy (self);
}
static void
activate_open_file (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
GtkFileChooserNative *chooser;
chooser = gtk_file_chooser_native_new ("Open file",
NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
"Open",
"Cancel");
g_signal_connect (chooser, "response", G_CALLBACK (file_chooser_response), NULL);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (chooser));
}
static void
activate_open (GSimpleAction *action,
GVariant *parameter,
@@ -2451,7 +2476,7 @@ main (int argc, char *argv[])
{ "share", activate_action, NULL, NULL, NULL },
{ "labels", activate_action, NULL, NULL, NULL },
{ "new", activate_action, NULL, NULL, NULL },
{ "open", activate_action, NULL, NULL, NULL },
{ "open", activate_open_file, NULL, NULL, NULL },
{ "open-in", activate_action, NULL, NULL, NULL },
{ "open-tab", activate_action, NULL, NULL, NULL },
{ "open-window", activate_action, NULL, NULL, NULL },
@@ -111,6 +111,8 @@
<file>icons/scalable/status/weather-showers-symbolic.svg</file>
<file>icons/scalable/status/weather-snow-symbolic.svg</file>
<file alias='icons/scalable/apps/org.gtk.WidgetFactory4.svg'>data/scalable/apps/org.gtk.WidgetFactory4.svg</file>
</gresource>
<gresource prefix="/org/gtk/WidgetFactory4">
<file>gtk-logo.webm</file>
+1
View File
@@ -1265,6 +1265,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="child">
<object class="GtkPicture">
<property name="file">resource:///org/gtk/WidgetFactory4/sunset.jpg</property>
<property name="content-fit">cover</property>
<child>
<object class="GtkDragSource">
<signal name="prepare" handler="on_picture_drag_prepare" swapped="no"/>
+14
View File
@@ -339,6 +339,20 @@ using and the GDK backend supports them:
`vulkan`
: Selects the Vulkan renderer
Note that on Windows, if one is running Nahimic 3 on a system with
nVidia graphics, one needs to stop the "Nahimic service" or insert
the GTK application into the Nahimic blacklist, as noted in
https://www.nvidia.com/en-us/geforce/forums/game-ready-drivers/13/297952/nahimic-and-nvidia-drivers-conflict/2334568/, or use the cairo renderer (at the cost of being unable to use
OpenGL features), or use GDK_DEBUG=gl-gles if you know that GLES
support is enabled for the build.
This is a known issue, as the above link indicates, and affects quite
a number of applications--sadly, since this issue lies within the
nVidia graphics driver and/or the Nahimic 3 code, we are not able
to rememdy this on the GTK side; the best bet before trying the above
workarounds is to try to update your graphics drivers and Nahimic
installation.
### `GTK_CSD`
The default value of this environment variable is `1`. If changed
+4
View File
@@ -47,6 +47,10 @@
#include <stdio.h>
#include <string.h>
#if !GLIB_CHECK_VERSION (2, 67, 3)
# define g_memdup2(mem,size) g_memdup((mem), (size))
#endif
/* Forward declarations */
static void gdk_broadway_surface_finalize (GObject *object);
+27 -17
View File
@@ -97,7 +97,7 @@ add_files (GDBusProxy *proxy,
AddFileData *afd)
{
GUnixFDList *fd_list;
GVariantBuilder fds;
GVariantBuilder fds, options;
int i;
char *key;
@@ -146,9 +146,10 @@ add_files (GDBusProxy *proxy,
key = (char *)g_object_get_data (G_OBJECT (afd->task), "key");
g_variant_builder_init (&options, G_VARIANT_TYPE_VARDICT);
g_dbus_proxy_call_with_unix_fd_list (proxy,
"AddFiles",
g_variant_new ("(sah)", key, &fds),
g_variant_new ("(saha{sv})", key, &fds, &options),
0, -1,
fd_list,
NULL,
@@ -480,20 +481,8 @@ connection_closed (GDBusConnection *connection,
}
static void
got_proxy (GObject *source,
GAsyncResult *result,
gpointer data)
finish_registration (void)
{
GError *error = NULL;
file_transfer_proxy = g_dbus_proxy_new_for_bus_finish (result, &error);
if (!file_transfer_proxy)
{
g_message ("Failed to get file transfer portal: %s", error->message);
g_clear_error (&error);
return;
}
gdk_content_register_serializer (G_TYPE_FILE,
"application/vnd.portal.files",
portal_file_serializer,
@@ -523,6 +512,21 @@ got_proxy (GObject *source,
"closed", G_CALLBACK (connection_closed), NULL);
}
static gboolean
proxy_has_owner (GDBusProxy *proxy)
{
char *owner;
owner = g_dbus_proxy_get_name_owner (proxy);
if (owner)
{
g_free (owner);
return TRUE;
}
return FALSE;
}
void
file_transfer_portal_register (void)
{
@@ -531,7 +535,8 @@ file_transfer_portal_register (void)
if (!called)
{
called = TRUE;
g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
file_transfer_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES
| G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS
| G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
@@ -540,8 +545,13 @@ file_transfer_portal_register (void)
"/org/freedesktop/portal/documents",
"org.freedesktop.portal.FileTransfer",
NULL,
got_proxy,
NULL);
if (file_transfer_proxy && !proxy_has_owner (file_transfer_proxy))
g_clear_object (&file_transfer_proxy);
if (file_transfer_proxy)
finish_registration ();
}
}
+4
View File
@@ -59,4 +59,8 @@ void gdk_source_set_static_name_by_id (guint tag,
#define g_source_set_static_name(source, name) g_source_set_name ((source), (name))
#endif
#ifndef I_
#define I_(string) g_intern_static_string (string)
#endif
#endif /* __GDK__PRIVATE_H__ */
+2 -1
View File
@@ -29,6 +29,7 @@
#include "gdkintl.h"
#include "gdkpipeiostreamprivate.h"
#include "gdktexture.h"
#include "gdk-private.h"
#include <gobject/gvaluecollector.h>
@@ -408,7 +409,7 @@ gdk_clipboard_class_init (GdkClipboardClass *class)
* Emitted when the clipboard changes ownership.
*/
signals[CHANGED] =
g_signal_new ("changed",
g_signal_new (I_("changed"),
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GdkClipboardClass, changed),
-2
View File
@@ -407,8 +407,6 @@ gdk_content_register_deserializer (const char *mime_type,
g_return_if_fail (mime_type != NULL);
g_return_if_fail (deserialize != NULL);
init ();
deserializer = g_slice_new0 (Deserializer);
deserializer->mime_type = g_intern_string (mime_type);
+50 -4
View File
@@ -184,7 +184,7 @@ gdk_content_formats_new_for_gtype (GType type)
* @string: the string to parse
*
* Parses the given @string into `GdkContentFormats` and
* returns the formats.
* returns the formats.
*
* Strings printed via [method@Gdk.ContentFormats.to_string]
* can be read in again successfully using this function.
@@ -540,7 +540,7 @@ gdk_content_formats_get_gtypes (const GdkContentFormats *formats,
if (n_gtypes)
*n_gtypes = formats->n_gtypes;
return formats->gtypes;
}
@@ -567,7 +567,7 @@ gdk_content_formats_get_mime_types (const GdkContentFormats *formats,
if (n_mime_types)
*n_mime_types = formats->n_mime_types;
return formats->mime_types;
}
@@ -663,7 +663,7 @@ gdk_content_formats_builder_unref (GdkContentFormatsBuilder *builder)
if (builder->ref_count > 0)
return;
gdk_content_formats_builder_clear (builder);
g_slice_free (GdkContentFormatsBuilder, builder);
}
@@ -862,4 +862,50 @@ gdk_file_list_get_files (GdkFileList *file_list)
return g_slist_copy ((GSList *) file_list);
}
/**
* gdk_file_list_new_from_list:
* @files: (element-type GFile): a list of files
*
* Creates a new files list container from a singly linked list of
* `GFile` instances.
*
* This function is meant to be used by language bindings
*
* Returns: (transfer full): the newly created files list
*
* Since: 4.8
*/
GdkFileList *
gdk_file_list_new_from_list (GSList *files)
{
return gdk_file_list_copy (files);
}
/**
* gdk_file_list_new_from_array:
* @files: (array length=n_files): the files to add to the list
* @n_files: the number of files in the array
*
* Creates a new `GdkFileList` for the given array of files.
*
* This function is meant to be used by language bindings.
*
* Returns: (transfer full): the newly create files list
*
* Since: 4.8
*/
GdkFileList *
gdk_file_list_new_from_array (GFile **files,
gsize n_files)
{
if (files == NULL || n_files == 0)
return NULL;
GSList *res = NULL;
for (gssize i = n_files - 1; i >= 0; i--)
res = g_slist_prepend (res, g_object_ref (files[i]));
return (GdkFileList *) res;
}
/* }}} */
+5
View File
@@ -122,6 +122,11 @@ typedef struct _GdkFileList GdkFileList;
GDK_AVAILABLE_IN_4_6
GSList * gdk_file_list_get_files (GdkFileList *file_list);
GDK_AVAILABLE_IN_4_8
GdkFileList * gdk_file_list_new_from_list (GSList *files);
GDK_AVAILABLE_IN_4_8
GdkFileList * gdk_file_list_new_from_array (GFile **files,
gsize n_files);
G_END_DECLS
+2 -1
View File
@@ -23,6 +23,7 @@
#include "gdkclipboard.h"
#include "gdkcontentformats.h"
#include "gdkintl.h"
#include "gdk-private.h"
/**
* GdkContentProvider:
@@ -197,7 +198,7 @@ gdk_content_provider_class_init (GdkContentProviderClass *class)
* Emitted whenever the content provided by this provider has changed.
*/
signals[CONTENT_CHANGED] =
g_signal_new ("content-changed",
g_signal_new (I_("content-changed"),
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GdkContentProviderClass, content_changed),
-2
View File
@@ -413,8 +413,6 @@ gdk_content_register_serializer (GType type,
g_return_if_fail (mime_type != NULL);
g_return_if_fail (serialize != NULL);
init ();
serializer = g_slice_new0 (Serializer);
serializer->mime_type = g_intern_string (mime_type);
+67
View File
@@ -2368,10 +2368,75 @@ gdk_scroll_event_new_discrete (GdkSurface *surface,
GdkScrollDirection direction)
{
GdkScrollEvent *self = gdk_event_alloc (GDK_SCROLL, surface, device, time);
double delta_x = 0, delta_y = 0;
switch (direction)
{
case GDK_SCROLL_UP:
delta_y = -1;
break;
case GDK_SCROLL_DOWN:
delta_y = 1;
break;
case GDK_SCROLL_LEFT:
delta_x = -1;
break;
case GDK_SCROLL_RIGHT:
delta_x = 1;
break;
case GDK_SCROLL_SMOOTH:
default:
g_assert_not_reached ();
break;
}
self->tool = tool != NULL ? g_object_ref (tool) : NULL;
self->state = state;
self->direction = direction;
self->delta_x = delta_x;
self->delta_y = delta_y;
self->unit = GDK_SCROLL_UNIT_WHEEL;
return (GdkEvent *) self;
}
/*< private >
* gtk_scroll_event_new_value120:
* @surface: the `GdkSurface` of the event
* @device: the `GdkDevice` of the event
* @tool: (nullable): the tool that generated to event
* @time: the event serial
* @state: Flags to indicate the state of modifier keys and mouse buttons
* in events.
* @direction: scroll direction.
* @delta_x: delta on the X axis in the 120.0 scale
* @delta_x: delta on the Y axis in the 120.0 scale
*
* Creates a new discrete GdkScrollEvent for high resolution mouse wheels.
*
* Both axes send data in fractions of 120 where each multiple of 120
* amounts to one logical scroll event. Fractions of 120 indicate a wheel
* movement less than one detent.
*
* Returns: the newly created scroll event
*/
GdkEvent *
gdk_scroll_event_new_value120 (GdkSurface *surface,
GdkDevice *device,
GdkDeviceTool *tool,
guint32 time,
GdkModifierType state,
GdkScrollDirection direction,
double delta_x,
double delta_y)
{
GdkScrollEvent *self = gdk_event_alloc (GDK_SCROLL, surface, device, time);
self->tool = tool != NULL ? g_object_ref (tool) : NULL;
self->state = state;
self->direction = direction;
self->delta_x = delta_x / 120.0;
self->delta_y = delta_y / 120.0;
self->unit = GDK_SCROLL_UNIT_WHEEL;
return (GdkEvent *) self;
@@ -2611,6 +2676,7 @@ gdk_touchpad_event_new_pinch (GdkSurface *surface,
GdkEvent *
gdk_touchpad_event_new_hold (GdkSurface *surface,
GdkEventSequence *sequence,
GdkDevice *device,
guint32 time,
GdkModifierType state,
@@ -2623,6 +2689,7 @@ gdk_touchpad_event_new_hold (GdkSurface *surface,
self->state = state;
self->phase = phase;
self->sequence = sequence;
self->x = x;
self->y = y;
self->n_fingers = n_fingers;
+10
View File
@@ -495,6 +495,15 @@ GdkEvent * gdk_scroll_event_new_discrete (GdkSurface *surface,
GdkModifierType state,
GdkScrollDirection direction);
GdkEvent * gdk_scroll_event_new_value120 (GdkSurface *surface,
GdkDevice *device,
GdkDeviceTool *tool,
guint32 time,
GdkModifierType state,
GdkScrollDirection direction,
double delta_x,
double delta_y);
GdkEvent * gdk_touch_event_new (GdkEventType type,
GdkEventSequence *sequence,
GdkSurface *surface,
@@ -533,6 +542,7 @@ GdkEvent * gdk_touchpad_event_new_pinch (GdkSurface *surface,
double angle_delta);
GdkEvent * gdk_touchpad_event_new_hold (GdkSurface *surface,
GdkEventSequence *sequence,
GdkDevice *device,
guint32 time,
GdkModifierType state,
+1 -1
View File
@@ -50,7 +50,7 @@ typedef struct _GdkFrameClockClass GdkFrameClockClass;
* @GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS: corresponds to GdkFrameClock::flush-events. Should not be handled by applications.
* @GDK_FRAME_CLOCK_PHASE_BEFORE_PAINT: corresponds to GdkFrameClock::before-paint. Should not be handled by applications.
* @GDK_FRAME_CLOCK_PHASE_UPDATE: corresponds to GdkFrameClock::update.
* @GDK_FRAME_CLOCK_PHASE_LAYOUT: corresponds to GdkFrameClock::layout. Should not be handled by applicatiosn.
* @GDK_FRAME_CLOCK_PHASE_LAYOUT: corresponds to GdkFrameClock::layout. Should not be handled by applications.
* @GDK_FRAME_CLOCK_PHASE_PAINT: corresponds to GdkFrameClock::paint.
* @GDK_FRAME_CLOCK_PHASE_RESUME_EVENTS: corresponds to GdkFrameClock::resume-events. Should not be handled by applications.
* @GDK_FRAME_CLOCK_PHASE_AFTER_PAINT: corresponds to GdkFrameClock::after-paint. Should not be handled by applications.
-16
View File
@@ -199,22 +199,6 @@ gdk_keymap_init (GdkKeymap *keymap)
keymap->cache = g_hash_table_new (g_direct_hash, g_direct_equal);
}
/*< private >
* gdk_keymap_get_display:
* @keymap: a `GdkKeymap`
*
* Retrieves the `GdkDisplay` associated to the @keymap.
*
* Returns: (transfer none): a `GdkDisplay`
*/
GdkDisplay *
gdk_keymap_get_display (GdkKeymap *keymap)
{
g_return_val_if_fail (GDK_IS_KEYMAP (keymap), NULL);
return keymap->display;
}
/* Other key-handling stuff
*/
-2
View File
@@ -89,8 +89,6 @@ struct _GdkKeymap
GType gdk_keymap_get_type (void) G_GNUC_CONST;
GdkDisplay * gdk_keymap_get_display (GdkKeymap *keymap);
guint gdk_keymap_lookup_key (GdkKeymap *keymap,
const GdkKeymapKey *key);
gboolean gdk_keymap_translate_keyboard_state (GdkKeymap *keymap,
+3 -2
View File
@@ -22,6 +22,7 @@
#include "gdkpaintable.h"
#include "gdksnapshotprivate.h"
#include "gdk-private.h"
/* HACK: So we don't need to include any (not-yet-created) GSK or GTK headers */
void gtk_snapshot_push_debug (GdkSnapshot *snapshot,
@@ -170,7 +171,7 @@ gdk_paintable_default_init (GdkPaintableInterface *iface)
* the icon theme for an icon changing.
*/
signals[INVALIDATE_CONTENTS] =
g_signal_new ("invalidate-contents",
g_signal_new (I_("invalidate-contents"),
GDK_TYPE_PAINTABLE,
G_SIGNAL_RUN_LAST,
0,
@@ -194,7 +195,7 @@ gdk_paintable_default_init (GdkPaintableInterface *iface)
* the contents of a toplevel surface being resized.
*/
signals[INVALIDATE_SIZE] =
g_signal_new ("invalidate-size",
g_signal_new (I_("invalidate-size"),
GDK_TYPE_PAINTABLE,
G_SIGNAL_RUN_LAST,
0,
+2
View File
@@ -75,6 +75,8 @@ gdk_io_pipe_unref (GdkIOPipe *pipe)
g_cond_clear (&pipe->cond);
g_mutex_clear (&pipe->mutex);
g_slice_free (GdkIOPipe, pipe);
}
static void
+2 -1
View File
@@ -24,6 +24,7 @@
#include "gdkdisplay.h"
#include "gdkenumtypes.h"
#include "gdkintl.h"
#include "gdk-private.h"
#include <graphene-gobject.h>
#include <math.h>
@@ -247,7 +248,7 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
* will result in an arbitrary size being used as a result.
*/
signals[COMPUTE_SIZE] =
g_signal_new ("compute-size",
g_signal_new (I_("compute-size"),
GDK_TYPE_TOPLEVEL,
G_SIGNAL_RUN_LAST,
0,
+5
View File
@@ -161,6 +161,8 @@ gdk_load_jpeg (GBytes *input_bytes,
jpeg_create_decompress (&info);
info.mem->max_memory_to_use = 300 * 1024 * 1024;
jpeg_mem_src (&info,
g_bytes_get_data (input_bytes, NULL),
g_bytes_get_size (input_bytes));
@@ -272,6 +274,7 @@ gdk_save_jpeg (GdkTexture *texture)
info.err = jpeg_std_error (&err);
jpeg_create_compress (&info);
info.image_width = width;
info.image_height = height;
info.input_components = 3;
@@ -280,6 +283,8 @@ gdk_save_jpeg (GdkTexture *texture)
jpeg_set_defaults (&info);
jpeg_set_quality (&info, 75, TRUE);
info.mem->max_memory_to_use = 300 * 1024 * 1024;
jpeg_mem_dest (&info, &data, &size);
memtex = gdk_memory_texture_from_texture (texture,
+2 -1
View File
@@ -184,7 +184,8 @@ gdk_load_png (GBytes *bytes,
if (color_type == PNG_COLOR_TYPE_PALETTE)
png_set_palette_to_rgb (png);
if (color_type == PNG_COLOR_TYPE_GRAY)
if (color_type == PNG_COLOR_TYPE_GRAY ||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
png_set_expand_gray_1_2_4_to_8 (png);
if (png_get_valid (png, info, PNG_INFO_tRNS))
+3 -1
View File
@@ -215,7 +215,7 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
cairo_surface_t *surface;
struct wl_buffer *buffer;
texture = gdk_cursor_get_texture (cursor);
texture = g_object_ref (gdk_cursor_get_texture (cursor));
from_texture:
surface = g_hash_table_lookup (display->cursor_surface_cache, cursor);
@@ -245,6 +245,8 @@ from_texture:
buffer = _gdk_wayland_shm_surface_get_wl_buffer (surface);
wl_buffer_add_listener (buffer, &buffer_listener, surface);
g_object_unref (texture);
return buffer;
}
+93 -84
View File
@@ -112,7 +112,7 @@ struct _GdkWaylandPointerFrameData
/* Specific to the scroll event */
double delta_x, delta_y;
int32_t discrete_x, discrete_y;
int32_t value120_x, value120_y;
gint8 is_scroll_stop;
enum wl_pointer_axis_source source;
};
@@ -1383,20 +1383,54 @@ static GdkDevice * get_scroll_device (GdkWaylandSeat *seat,
static void
flush_discrete_scroll_event (GdkWaylandSeat *seat,
GdkScrollDirection direction)
gint value120_x,
gint value120_y)
{
GdkEvent *event;
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
GdkEvent *event = NULL;
GdkDevice *source;
GdkScrollDirection direction;
if (value120_x > 0)
direction = GDK_SCROLL_LEFT;
else if (value120_x < 0)
direction = GDK_SCROLL_RIGHT;
else if (value120_y > 0)
direction = GDK_SCROLL_DOWN;
else
direction = GDK_SCROLL_UP;
source = get_scroll_device (seat, seat->pointer_info.frame.source);
event = gdk_scroll_event_new_discrete (seat->pointer_info.focus,
source,
NULL,
seat->pointer_info.time,
device_get_modifiers (seat->logical_pointer),
direction);
_gdk_wayland_display_deliver_event (seat->display, event);
if (display_wayland->seat_version >= WL_POINTER_AXIS_VALUE120_SINCE_VERSION)
{
event = gdk_scroll_event_new_value120 (seat->pointer_info.focus,
source,
NULL,
seat->pointer_info.time,
device_get_modifiers (seat->logical_pointer),
direction,
value120_x,
value120_y);
}
else
{
gint discrete_x = value120_x / 120;
gint discrete_y = value120_y / 120;
if (discrete_x != 0 || discrete_y != 0)
{
event = gdk_scroll_event_new_discrete (seat->pointer_info.focus,
source,
NULL,
seat->pointer_info.time,
device_get_modifiers (seat->logical_pointer),
direction);
}
}
if (event)
_gdk_wayland_display_deliver_event (seat->display, event);
}
static void
@@ -1427,22 +1461,13 @@ flush_scroll_event (GdkWaylandSeat *seat,
{
gboolean is_stop = FALSE;
if (pointer_frame->discrete_x || pointer_frame->discrete_y)
if (pointer_frame->value120_x || pointer_frame->value120_y)
{
GdkScrollDirection direction;
if (pointer_frame->discrete_x > 0)
direction = GDK_SCROLL_LEFT;
else if (pointer_frame->discrete_x < 0)
direction = GDK_SCROLL_RIGHT;
else if (pointer_frame->discrete_y > 0)
direction = GDK_SCROLL_DOWN;
else
direction = GDK_SCROLL_UP;
flush_discrete_scroll_event (seat, direction);
pointer_frame->discrete_x = 0;
pointer_frame->discrete_y = 0;
flush_discrete_scroll_event (seat,
pointer_frame->value120_x,
pointer_frame->value120_y);
pointer_frame->value120_x = 0;
pointer_frame->value120_y = 0;
}
else if (pointer_frame->is_scroll_stop ||
pointer_frame->delta_x != 0 ||
@@ -1462,8 +1487,8 @@ flush_scroll_event (GdkWaylandSeat *seat,
is_stop);
}
pointer_frame->discrete_x = 0;
pointer_frame->discrete_y = 0;
pointer_frame->value120_x = 0;
pointer_frame->value120_y = 0;
pointer_frame->delta_x = 0;
pointer_frame->delta_y = 0;
pointer_frame->is_scroll_stop = FALSE;
@@ -1514,8 +1539,6 @@ pointer_handle_enter (void *data,
if (!GDK_IS_SURFACE (wl_surface_get_user_data (surface)))
return;
_gdk_wayland_display_update_serial (display_wayland, serial);
seat->pointer_info.focus = wl_surface_get_user_data (surface);
g_object_ref (seat->pointer_info.focus);
@@ -1557,16 +1580,9 @@ pointer_handle_leave (void *data,
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
GdkDeviceGrabInfo *grab;
if (!surface)
return;
if (!GDK_IS_SURFACE (wl_surface_get_user_data (surface)))
return;
if (!seat->pointer_info.focus)
return;
_gdk_wayland_display_update_serial (display_wayland, serial);
grab = _gdk_display_get_last_device_grab (seat->display,
seat->logical_pointer);
@@ -1666,8 +1682,6 @@ pointer_handle_button (void *data,
if (!seat->pointer_info.focus)
return;
_gdk_wayland_display_update_serial (display, serial);
switch (button)
{
case BTN_LEFT:
@@ -1873,10 +1887,10 @@ pointer_handle_axis_discrete (void *data,
switch (axis)
{
case WL_POINTER_AXIS_VERTICAL_SCROLL:
pointer_frame->discrete_y = value;
pointer_frame->value120_y = value * 120;
break;
case WL_POINTER_AXIS_HORIZONTAL_SCROLL:
pointer_frame->discrete_x = value;
pointer_frame->value120_x = value * 120;
break;
default:
g_return_if_reached ();
@@ -1887,6 +1901,35 @@ pointer_handle_axis_discrete (void *data,
get_axis_name (axis), value, seat));
}
static void
pointer_handle_axis_value120 (void *data,
struct wl_pointer *pointer,
uint32_t axis,
int32_t value)
{
GdkWaylandSeat *seat = data;
GdkWaylandPointerFrameData *pointer_frame = &seat->pointer_info.frame;
if (!seat->pointer_info.focus)
return;
switch (axis)
{
case WL_POINTER_AXIS_VERTICAL_SCROLL:
pointer_frame->value120_y = value;
break;
case WL_POINTER_AXIS_HORIZONTAL_SCROLL:
pointer_frame->value120_x = value;
break;
default:
g_return_if_reached ();
}
GDK_SEAT_NOTE (seat, EVENTS,
g_message ("value120 scroll, axis %s, value %d, seat %p",
get_axis_name (axis), value, seat));
}
static int
get_active_layout (GdkKeymap *keymap)
{
@@ -1986,7 +2029,6 @@ keyboard_handle_enter (void *data,
{
GdkWaylandSeat *seat = data;
GdkEvent *event;
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
if (!surface)
return;
@@ -1994,8 +2036,6 @@ keyboard_handle_enter (void *data,
if (!GDK_IS_SURFACE (wl_surface_get_user_data (surface)))
return;
_gdk_wayland_display_update_serial (display, serial);
seat->keyboard_focus = wl_surface_get_user_data (surface);
g_object_ref (seat->keyboard_focus);
seat->repeat_key = 0;
@@ -2021,7 +2061,6 @@ keyboard_handle_leave (void *data,
{
GdkWaylandSeat *seat = data;
GdkEvent *event;
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
if (!seat->keyboard_focus)
return;
@@ -2032,8 +2071,6 @@ keyboard_handle_leave (void *data,
*/
stop_key_repeat (seat);
_gdk_wayland_display_update_serial (display, serial);
event = gdk_focus_event_new (seat->keyboard_focus,
seat->logical_keyboard,
FALSE);
@@ -2272,7 +2309,6 @@ keyboard_handle_key (void *data,
uint32_t state_w)
{
GdkWaylandSeat *seat = data;
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
if (!seat->keyboard_focus)
return;
@@ -2280,7 +2316,6 @@ keyboard_handle_key (void *data,
seat->keyboard_time = time;
seat->keyboard_key_serial = serial;
seat->repeat_count = 0;
_gdk_wayland_display_update_serial (display, serial);
deliver_key_event (data, time, key + 8, state_w, FALSE);
}
@@ -2470,12 +2505,9 @@ touch_handle_down (void *data,
wl_fixed_t y)
{
GdkWaylandSeat *seat = data;
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
GdkWaylandTouchData *touch;
GdkEvent *event;
_gdk_wayland_display_update_serial (display, serial);
if (!wl_surface)
return;
@@ -2519,12 +2551,9 @@ touch_handle_up (void *data,
int32_t id)
{
GdkWaylandSeat *seat = data;
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
GdkWaylandTouchData *touch;
GdkEvent *event;
_gdk_wayland_display_update_serial (display, serial);
touch = gdk_wayland_seat_get_touch (seat, id);
if (!touch)
return;
@@ -2704,9 +2733,6 @@ gesture_swipe_begin (void *data,
uint32_t fingers)
{
GdkWaylandSeat *seat = data;
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
_gdk_wayland_display_update_serial (display, serial);
emit_gesture_swipe_event (seat,
GDK_TOUCHPAD_GESTURE_PHASE_BEGIN,
@@ -2739,11 +2765,8 @@ gesture_swipe_end (void *data,
int32_t cancelled)
{
GdkWaylandSeat *seat = data;
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
GdkTouchpadGesturePhase phase;
_gdk_wayland_display_update_serial (display, serial);
phase = (cancelled) ?
GDK_TOUCHPAD_GESTURE_PHASE_CANCEL :
GDK_TOUCHPAD_GESTURE_PHASE_END;
@@ -2806,9 +2829,7 @@ gesture_pinch_begin (void *data,
uint32_t fingers)
{
GdkWaylandSeat *seat = data;
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
_gdk_wayland_display_update_serial (display, serial);
emit_gesture_pinch_event (seat,
GDK_TOUCHPAD_GESTURE_PHASE_BEGIN,
time, fingers, 0, 0, 1, 0);
@@ -2843,11 +2864,8 @@ gesture_pinch_end (void *data,
int32_t cancelled)
{
GdkWaylandSeat *seat = data;
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
GdkTouchpadGesturePhase phase;
_gdk_wayland_display_update_serial (display, serial);
phase = (cancelled) ?
GDK_TOUCHPAD_GESTURE_PHASE_CANCEL :
GDK_TOUCHPAD_GESTURE_PHASE_END;
@@ -2870,7 +2888,11 @@ emit_gesture_hold_event (GdkWaylandSeat *seat,
seat->pointer_info.time = _time;
if (phase == GDK_TOUCHPAD_GESTURE_PHASE_BEGIN)
seat->pointer_info.touchpad_event_sequence++;
event = gdk_touchpad_event_new_hold (seat->pointer_info.focus,
GDK_SLOT_TO_EVENT_SEQUENCE (seat->pointer_info.touchpad_event_sequence),
seat->logical_pointer,
_time,
device_get_modifiers (seat->logical_pointer),
@@ -2901,9 +2923,6 @@ gesture_hold_begin (void *data,
uint32_t fingers)
{
GdkWaylandSeat *seat = data;
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
_gdk_wayland_display_update_serial (display, serial);
emit_gesture_hold_event (seat,
GDK_TOUCHPAD_GESTURE_PHASE_BEGIN,
@@ -2919,11 +2938,8 @@ gesture_hold_end (void *data,
int32_t cancelled)
{
GdkWaylandSeat *seat = data;
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
GdkTouchpadGesturePhase phase;
_gdk_wayland_display_update_serial (display, serial);
phase = (cancelled) ?
GDK_TOUCHPAD_GESTURE_PHASE_CANCEL :
GDK_TOUCHPAD_GESTURE_PHASE_END;
@@ -3108,6 +3124,7 @@ static const struct wl_pointer_listener pointer_listener = {
pointer_handle_axis_source,
pointer_handle_axis_stop,
pointer_handle_axis_discrete,
pointer_handle_axis_value120,
};
static const struct wl_keyboard_listener keyboard_listener = {
@@ -3630,8 +3647,6 @@ tablet_tool_handle_proximity_in (void *data,
{
GdkWaylandTabletToolData *tool = data;
GdkWaylandTabletData *tablet = zwp_tablet_v2_get_user_data (wp_tablet);
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (tablet->seat);
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
GdkSurface *surface;
GdkEvent *event;
@@ -3648,7 +3663,6 @@ tablet_tool_handle_proximity_in (void *data,
tool->current_tablet = tablet;
tablet->current_tool = tool;
_gdk_wayland_display_update_serial (display_wayland, serial);
tablet->pointer_info.enter_serial = serial;
tablet->pointer_info.focus = g_object_ref (surface);
@@ -3669,9 +3683,9 @@ tablet_tool_handle_proximity_in (void *data,
gdk_wayland_surface_get_wl_output (surface));
pointer_surface_update_scale (tablet->logical_device);
GDK_SEAT_NOTE (seat, EVENTS,
GDK_SEAT_NOTE (tablet->seat, EVENTS,
g_message ("proximity in, seat %p surface %p tool %d",
seat, tablet->pointer_info.focus,
tablet->seat, tablet->pointer_info.focus,
gdk_device_tool_get_tool_type (tool->tool)));
}
@@ -3748,13 +3762,10 @@ tablet_tool_handle_down (void *data,
{
GdkWaylandTabletToolData *tool = data;
GdkWaylandTabletData *tablet = tool->current_tablet;
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (tool->seat);
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
if (!tablet || !tablet->pointer_info.focus)
return;
_gdk_wayland_display_update_serial (display_wayland, serial);
tablet->pointer_info.press_serial = serial;
tablet_create_button_event_frame (tablet, GDK_BUTTON_PRESS, GDK_BUTTON_PRIMARY);
@@ -5305,15 +5316,13 @@ gdk_wayland_device_set_selection (GdkDevice *gdk_device,
struct wl_data_source *source)
{
GdkWaylandSeat *seat;
GdkWaylandDisplay *display_wayland;
guint32 serial;
g_return_if_fail (GDK_IS_WAYLAND_DEVICE (gdk_device));
seat = GDK_WAYLAND_SEAT (gdk_device_get_seat (gdk_device));
display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
wl_data_device_set_selection (seat->data_device, source,
_gdk_wayland_display_get_serial (display_wayland));
serial = _gdk_wayland_seat_get_implicit_grab_serial (GDK_SEAT (seat), NULL);
wl_data_device_set_selection (seat->data_device, source, serial);
}
/**
+1 -21
View File
@@ -145,10 +145,6 @@ zxdg_shell_v6_ping (void *data,
struct zxdg_shell_v6 *xdg_shell,
uint32_t serial)
{
GdkWaylandDisplay *display_wayland = data;
_gdk_wayland_display_update_serial (display_wayland, serial);
GDK_DISPLAY_NOTE (GDK_DISPLAY (data), EVENTS,
g_message ("ping, shell %p, serial %u\n", xdg_shell, serial));
@@ -236,7 +232,7 @@ _gdk_wayland_display_add_seat (GdkWaylandDisplay *display_wayland,
{
struct wl_seat *seat;
display_wayland->seat_version = MIN (version, 7);
display_wayland->seat_version = MIN (version, 8);
seat = wl_registry_bind (display_wayland->wl_registry,
id, &wl_seat_interface,
display_wayland->seat_version);
@@ -1124,19 +1120,6 @@ _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland)
}
guint32
_gdk_wayland_display_get_serial (GdkWaylandDisplay *display_wayland)
{
return display_wayland->serial;
}
void
_gdk_wayland_display_update_serial (GdkWaylandDisplay *display_wayland,
guint32 serial)
{
display_wayland->serial = serial;
}
/**
* gdk_wayland_display_get_wl_display: (skip)
* @display: (type GdkWaylandDisplay): a `GdkDisplay`
@@ -2466,9 +2449,6 @@ output_handle_geometry (void *data,
if (should_update_monitor (monitor) || !monitor_has_xdg_output (monitor))
apply_monitor_change (monitor);
if (should_update_monitor (monitor))
update_scale (GDK_MONITOR (monitor)->display);
}
static void
-3
View File
@@ -84,9 +84,6 @@ struct _GdkWaylandDisplay
/* Startup notification */
char *startup_notification_id;
/* Most recent serial */
guint32 serial;
uint32_t xdg_wm_base_id;
int xdg_wm_base_version;
uint32_t zxdg_shell_v6_id;
+2 -2
View File
@@ -393,8 +393,8 @@ _gdk_wayland_surface_drag_begin (GdkSurface *surface,
wl_data_device_start_drag (gdk_wayland_device_get_data_device (device),
drag_wayland->data_source,
gdk_wayland_surface_get_wl_surface (surface),
drag_wayland->dnd_wl_surface,
_gdk_wayland_display_get_serial (display_wayland));
drag_wayland->dnd_wl_surface,
_gdk_wayland_seat_get_implicit_grab_serial (seat, NULL));
cursor = gdk_drag_get_cursor (drag, gdk_drag_get_selected_action (drag));
gdk_drag_set_cursor (drag, cursor);
+5 -1
View File
@@ -263,6 +263,8 @@ gdk_wayland_primary_claim (GdkClipboard *clipboard,
GdkWaylandDisplay *wdisplay = GDK_WAYLAND_DISPLAY (gdk_clipboard_get_display (clipboard));
const char * const *mime_types;
gsize i, n_mime_types;
GdkSeat *seat;
guint32 serial;
gdk_wayland_primary_discard_offer (cb);
gdk_wayland_primary_discard_source (cb);
@@ -276,9 +278,11 @@ gdk_wayland_primary_claim (GdkClipboard *clipboard,
zwp_primary_selection_source_v1_offer (cb->source, mime_types[i]);
}
seat = gdk_display_get_default_seat (GDK_DISPLAY (wdisplay));
serial = _gdk_wayland_seat_get_implicit_grab_serial (seat, NULL);
zwp_primary_selection_device_v1_set_selection (cb->primary_data_device,
cb->source,
_gdk_wayland_display_get_serial (wdisplay));
serial);
}
return GDK_CLIPBOARD_CLASS (gdk_wayland_primary_parent_class)->claim (clipboard, formats, local, content);
-4
View File
@@ -170,10 +170,6 @@ GdkMonitor *gdk_wayland_display_get_monitor_for_output (GdkDisplay *displa
void _gdk_wayland_surface_set_grab_seat (GdkSurface *surface,
GdkSeat *seat);
guint32 _gdk_wayland_display_get_serial (GdkWaylandDisplay *display_wayland);
void _gdk_wayland_display_update_serial (GdkWaylandDisplay *display_wayland,
guint32 serial);
cairo_surface_t * _gdk_wayland_display_create_shm_surface (GdkWaylandDisplay *display,
int width,
int height,
+2 -2
View File
@@ -105,7 +105,7 @@ gdk_device_win32_query_state (GdkDevice *device,
hwndc = ChildWindowFromPoint (hwnd, point);
if (hwndc && hwndc != hwnd)
*child_window = gdk_win32_handle_table_lookup (hwndc);
*child_window = gdk_win32_handle_table_lookup_ (hwndc);
else
*child_window = NULL; /* Direct child unknown to gdk */
}
@@ -183,7 +183,7 @@ _gdk_device_win32_surface_at_position (GdkDevice *device,
if (!PtInRect (&rect, client_pt))
hwnd = NULL;
window = gdk_win32_handle_table_lookup (hwnd);
window = gdk_win32_handle_table_lookup_ (hwnd);
if (window && (win_x || win_y))
{
+2 -2
View File
@@ -96,7 +96,7 @@ gdk_device_winpointer_query_state (GdkDevice *device,
hwndc = ChildWindowFromPoint (hwnd, point);
if (hwndc && hwndc != hwnd)
*child_window = gdk_win32_handle_table_lookup (hwndc);
*child_window = gdk_win32_handle_table_lookup_ (hwndc);
else
*child_window = NULL; /* Direct child unknown to gdk */
}
@@ -160,7 +160,7 @@ gdk_device_winpointer_surface_at_position (GdkDevice *device,
if (!PtInRect (&rect, client_pt))
hwnd = NULL;
surface = gdk_win32_handle_table_lookup (hwnd);
surface = gdk_win32_handle_table_lookup_ (hwnd);
if (surface && (win_x || win_y))
{
+1 -1
View File
@@ -104,7 +104,7 @@ gdk_device_wintab_query_state (GdkDevice *device,
hwndc = ChildWindowFromPoint (hwnd, point);
if (hwndc && hwndc != hwnd)
*child_window = gdk_win32_handle_table_lookup (hwndc);
*child_window = gdk_win32_handle_table_lookup_ (hwndc);
else
*child_window = NULL; /* Direct child unknown to gdk */
}
+6 -4
View File
@@ -51,8 +51,8 @@ static int debug_indent = 0;
/**
* gdk_win32_display_add_filter:
* @display: a `GdkWin32Display`
* @function: filter callback
* @data: data to pass to filter callback
* @function: (scope notified): filter callback
* @data: (closure): data to pass to filter callback
*
* Adds an event filter to @window, allowing you to intercept messages
* before they reach GDK. This is a low-level operation and makes it
@@ -136,8 +136,8 @@ _gdk_win32_message_filter_unref (GdkWin32Display *display,
/**
* gdk_win32_display_remove_filter:
* @display: A `GdkWin32Display`
* @function: previously-added filter function
* @data: user data for previously-added filter function
* @function: (scope notified): previously-added filter function
* @data: (closure): user data for previously-added filter function
*
* Remove a filter previously added with gdk_win32_display_add_filter().
*/
@@ -1247,6 +1247,8 @@ gdk_win32_display_init_gl (GdkDisplay *display,
* Retrieves the EGL display connection object for the given GDK display.
*
* Returns: (nullable): the EGL display
*
* Since: 4.4
*/
gpointer
gdk_win32_display_get_egl_display (GdkDisplay *display)
+23 -11
View File
@@ -142,8 +142,6 @@ struct _drop_target_context
static void
gdk_win32_drop_init (GdkWin32Drop *drop)
{
drop->droptarget_w32format_contentformat_map = g_array_new (FALSE, FALSE, sizeof (GdkWin32ContentFormatPair));
GDK_NOTE (DND, g_print ("gdk_win32_drop_init %p\n", drop));
}
@@ -414,9 +412,13 @@ set_source_actions_helper (GdkDrop *drop,
DWORD grfKeyState)
{
GdkDragAction user_action;
GdkWin32Drop *drop_win32;
user_action = get_user_action (grfKeyState);
drop_win32 = GDK_WIN32_DROP (drop);
drop_win32->actions = actions;
if (user_action != 0)
gdk_drop_set_actions (drop, user_action);
else
@@ -471,6 +473,7 @@ idroptarget_dragenter (LPDROPTARGET This,
GdkDragAction source_actions;
GdkDragAction dest_actions;
GdkContentFormats *formats;
GArray *droptarget_w32format_contentformat_map;
GDK_NOTE (DND, g_print ("idroptarget_dragenter %p @ %ld : %ld"
" for dest window 0x%p"
@@ -491,7 +494,8 @@ idroptarget_dragenter (LPDROPTARGET This,
display = gdk_surface_get_display (ctx->surface);
formats = query_object_formats (pDataObj, NULL);
droptarget_w32format_contentformat_map = g_array_new (FALSE, FALSE, sizeof (GdkWin32ContentFormatPair));
formats = query_object_formats (pDataObj, droptarget_w32format_contentformat_map);
drop = gdk_drop_new (display,
gdk_seat_get_pointer (gdk_display_get_default_seat (display)),
drag,
@@ -499,7 +503,7 @@ idroptarget_dragenter (LPDROPTARGET This,
ctx->surface,
GDK_DRAG_PROTO_OLE2);
drop_win32 = GDK_WIN32_DROP (drop);
g_array_set_size (drop_win32->droptarget_w32format_contentformat_map, 0);
drop_win32->droptarget_w32format_contentformat_map = droptarget_w32format_contentformat_map;
gdk_content_formats_unref (formats);
ctx->drop = drop;
@@ -520,7 +524,7 @@ idroptarget_dragenter (LPDROPTARGET This,
drop_win32->last_key_state = grfKeyState;
drop_win32->last_x = pt_x;
drop_win32->last_y = pt_y;
dest_actions = filter_actions (drop_win32->actions, source_actions);
dest_actions = filter_actions (gdk_drop_get_actions (drop), source_actions);
*pdwEffect_and_dwOKEffects = drop_effect_for_actions (dest_actions);
GDK_NOTE (DND, g_print ("idroptarget_dragenter returns S_OK with actions %s"
@@ -554,9 +558,7 @@ idroptarget_dragover (LPDROPTARGET This,
GdkDragAction source_actions;
GdkDragAction dest_actions;
source_actions = set_source_actions_helper (ctx->drop,
actions_for_drop_effects (*pdwEffect_and_dwOKEffects),
grfKeyState);
source_actions = actions_for_drop_effects (*pdwEffect_and_dwOKEffects);
GDK_NOTE (DND, g_print ("idroptarget_dragover %p @ %d : %d"
" (raw %ld : %ld)"
@@ -569,7 +571,8 @@ idroptarget_dragover (LPDROPTARGET This,
if (pt_x != drop_win32->last_x ||
pt_y != drop_win32->last_y ||
grfKeyState != drop_win32->last_key_state)
grfKeyState != drop_win32->last_key_state ||
source_actions != drop_win32->actions)
{
double x = 0.0;
double y = 0.0;
@@ -578,13 +581,15 @@ idroptarget_dragover (LPDROPTARGET This,
x /= drop_win32->scale;
y /= drop_win32->scale;
set_source_actions_helper (ctx->drop, source_actions, grfKeyState);
gdk_drop_emit_motion_event (ctx->drop, TRUE, x, y, GDK_CURRENT_TIME);
drop_win32->last_key_state = grfKeyState;
drop_win32->last_x = pt_x;
drop_win32->last_y = pt_y;
}
dest_actions = filter_actions (drop_win32->actions, source_actions);
dest_actions = filter_actions (gdk_drop_get_actions (ctx->drop), source_actions);
*pdwEffect_and_dwOKEffects = drop_effect_for_actions (dest_actions);
GDK_NOTE (DND, g_print ("idroptarget_dragover returns S_OK with actions %s"
@@ -645,8 +650,12 @@ idroptarget_drop (LPDROPTARGET This,
x /= drop_win32->scale;
y /= drop_win32->scale;
gdk_drop_emit_motion_event (ctx->drop, TRUE, x, y, GDK_CURRENT_TIME);
gdk_drop_emit_drop_event (ctx->drop, TRUE, x, y, GDK_CURRENT_TIME);
gdk_drop_emit_leave_event (ctx->drop, TRUE, GDK_CURRENT_TIME);
while (!drop_win32->drop_finished)
g_main_context_iteration (NULL, FALSE);
@@ -824,7 +833,10 @@ gdk_win32_drop_status (GdkDrop *drop,
_gdk_win32_drag_action_to_string (gdk_drop_get_actions (drop)),
_gdk_win32_drag_action_to_string (preferred)));
drop_win32->actions = actions;
if (preferred != 0)
actions = preferred;
gdk_drop_set_actions (drop, drop_win32->actions & actions);
}
static void
+50 -33
View File
@@ -388,7 +388,7 @@ low_level_keyboard_proc (int code,
if (kbd_focus_owner == NULL)
break;
gdk_kbd_focus_owner = gdk_win32_handle_table_lookup (kbd_focus_owner);
gdk_kbd_focus_owner = gdk_win32_handle_table_lookup_ (kbd_focus_owner);
if (gdk_kbd_focus_owner == NULL)
break;
@@ -618,7 +618,7 @@ find_window_for_mouse_event (GdkSurface* reported_window,
ScreenToClient (hwnd, &client_pt);
GetClientRect (hwnd, &rect);
if (PtInRect (&rect, client_pt))
event_surface = gdk_win32_handle_table_lookup (hwnd);
event_surface = gdk_win32_handle_table_lookup_ (hwnd);
}
if (event_surface == NULL)
event_surface = grab->surface;
@@ -1433,35 +1433,42 @@ handle_nchittest (HWND hwnd,
gint16 screen_y,
int *ret_valp)
{
RECT rect;
GdkWin32Surface *impl;
RECT client_rect;
POINT client_pt;
if (window == NULL || window->input_region == NULL)
if (window == NULL)
return FALSE;
/* If the window has decorations, DefWindowProc() will take
* care of NCHITTEST.
*/
if (!_gdk_win32_surface_lacks_wm_decorations (window))
/* If the window has no particular input pass-through region,
* then we can simply let DefWindowProc() handle the message */
if (window->input_region == NULL)
return FALSE;
if (!GetWindowRect (hwnd, &rect))
if (!GetClientRect (hwnd, &client_rect))
return FALSE;
client_pt.x = screen_x;
client_pt.y = screen_y;
if (!ScreenToClient (hwnd, &client_pt))
return FALSE;
/* Check whether the point lies within the client area */
if (!PtInRect (&client_rect, client_pt))
return FALSE;
impl = GDK_WIN32_SURFACE (window);
rect.left = screen_x - rect.left;
rect.top = screen_y - rect.top;
/* If it's inside the rect, return FALSE and let DefWindowProc() handle it */
/* If the point lies inside the input region, return HTCLIENT,
* otherwise return HTTRANSPARENT. */
if (cairo_region_contains_point (window->input_region,
rect.left / impl->surface_scale,
rect.top / impl->surface_scale))
return FALSE;
client_pt.x / impl->surface_scale,
client_pt.y / impl->surface_scale))
*ret_valp = HTCLIENT;
else
*ret_valp = HTTRANSPARENT;
/* Otherwise override DefWindowProc() and tell WM that the point is not
* within the window
*/
*ret_valp = HTNOWHERE;
/* We handled the message, no need to call DefWindowProc() */
return TRUE;
}
@@ -1775,7 +1782,7 @@ gdk_event_translate (MSG *msg,
return TRUE;
}
window = gdk_win32_handle_table_lookup (msg->hwnd);
window = gdk_win32_handle_table_lookup_ (msg->hwnd);
if (window == NULL)
{
@@ -2290,7 +2297,7 @@ gdk_event_translate (MSG *msg,
ScreenToClient (hwnd, &client_pt);
GetClientRect (hwnd, &rect);
if (PtInRect (&rect, client_pt))
new_window = gdk_win32_handle_table_lookup (hwnd);
new_window = gdk_win32_handle_table_lookup_ (hwnd);
}
synthesize_crossing_events (display,
@@ -2431,7 +2438,7 @@ gdk_event_translate (MSG *msg,
ScreenToClient (hwnd, &client_pt);
GetClientRect (hwnd, &rect);
if (PtInRect (&rect, client_pt))
new_window = gdk_win32_handle_table_lookup (hwnd);
new_window = gdk_win32_handle_table_lookup_ (hwnd);
}
if (!ignore_leave)
@@ -2669,6 +2676,7 @@ gdk_event_translate (MSG *msg,
{
int16_t scroll_x = 0;
int16_t scroll_y = 0;
GdkScrollDirection direction;
char classname[64];
@@ -2708,7 +2716,7 @@ gdk_event_translate (MSG *msg,
msg->hwnd = hwnd;
g_set_object (&window, gdk_win32_handle_table_lookup (hwnd));
g_set_object (&window, gdk_win32_handle_table_lookup_ (hwnd));
if (!window)
break;
@@ -2720,15 +2728,24 @@ gdk_event_translate (MSG *msg,
_gdk_device_virtual_set_active (_gdk_device_manager->core_pointer,
_gdk_device_manager->system_pointer);
event = gdk_scroll_event_new (window,
device_manager_win32->core_pointer,
NULL,
_gdk_win32_get_next_tick (msg->time),
build_pointer_event_state (msg),
(double) scroll_x / (double) WHEEL_DELTA,
(double) -scroll_y / (double) WHEEL_DELTA,
FALSE,
GDK_SCROLL_UNIT_WHEEL);
direction = 0;
if (msg->message == WM_MOUSEWHEEL)
direction = (((short) HIWORD (msg->wParam)) > 0)
? GDK_SCROLL_UP
: GDK_SCROLL_DOWN;
else if (msg->message == WM_MOUSEHWHEEL)
direction = (((short) HIWORD (msg->wParam)) > 0)
? GDK_SCROLL_RIGHT
: GDK_SCROLL_LEFT;
event = gdk_scroll_event_new_value120 (window,
device_manager_win32->core_pointer,
NULL,
_gdk_win32_get_next_tick (msg->time),
build_pointer_event_state (msg),
direction,
(double) scroll_x,
(double) -scroll_y);
_gdk_win32_append_event (event);
@@ -3229,7 +3246,7 @@ gdk_event_translate (MSG *msg,
{
if (msg->lParam != 0)
{
GdkSurface *other_surface = gdk_win32_handle_table_lookup ((HWND) msg->lParam);
GdkSurface *other_surface = gdk_win32_handle_table_lookup_ ((HWND) msg->lParam);
if (other_surface != NULL &&
(GDK_IS_POPUP (other_surface) || GDK_IS_DRAG_SURFACE (other_surface)))
{
+8
View File
@@ -441,4 +441,12 @@ typedef enum _GdkWin32ProcessorCheckType
gboolean _gdk_win32_check_processor (GdkWin32ProcessorCheckType check_type);
GdkPixbuf *gdk_win32_icon_to_pixbuf_libgtk_only (HICON hicon,
double *x_hot,
double *y_hot);
HICON gdk_win32_pixbuf_to_hicon_libgtk_only (GdkPixbuf *pixbuf);
void gdk_win32_set_modal_dialog_libgtk_only (HWND window);
gpointer gdk_win32_handle_table_lookup_ (HWND handle);
#endif /* __GDK_PRIVATE_WIN32_H__ */
+20
View File
@@ -31,6 +31,7 @@
#include "gdkdisplayprivate.h"
#include "gdkprivate-win32.h"
#include "gdkdisplay-win32.h"
#include "gdkwin32.h"
static char *
@@ -162,6 +163,25 @@ _gdk_win32_get_setting (const char *name,
g_value_set_int (value, 1);
return TRUE;
}
else if (strcmp ("gtk-xft-dpi", name) == 0)
{
GdkWin32Display *display = GDK_WIN32_DISPLAY (_gdk_display);
if (display->dpi_aware_type == PROCESS_SYSTEM_DPI_AWARE &&
!display->has_fixed_scale)
{
int dpi = GetDeviceCaps (GetDC (NULL), LOGPIXELSX);
if (dpi >= 96)
{
int xft_dpi = 1024 * dpi / display->surface_scale;
g_value_set_int (value, xft_dpi);
GDK_NOTE(MISC, g_print ("gdk_screen_get_setting(\"%s\") : %d\n", name, xft_dpi));
return TRUE;
}
}
return FALSE;
}
else if (strcmp ("gtk-xft-hintstyle", name) == 0)
{
g_value_set_static_string (value, "hintfull");
+60 -21
View File
@@ -1180,6 +1180,11 @@ gdk_win32_surface_layout_popup (GdkSurface *surface,
monitor = gdk_surface_get_layout_monitor (surface, layout,
gdk_win32_monitor_get_workarea);
if (!monitor)
{
GdkDisplay *display = gdk_surface_get_display (surface);
monitor = gdk_win32_display_get_primary_monitor (display);
}
gdk_win32_monitor_get_workarea (monitor, &bounds);
gdk_popup_layout_get_shadow_width (layout,
@@ -1305,19 +1310,27 @@ gdk_win32_surface_raise (GdkSurface *window)
}
}
/**
* gdk_win32_surface_set_urgency_hint:
* @surface: (type GdkWin32Surface): a native `GdkSurface`.
* @urgent: if %TRUE, flashes both the window and the taskbar button
* continuously.
*
* Flashes the specified @surface.
*/
void
gdk_win32_surface_set_urgency_hint (GdkSurface *window,
gdk_win32_surface_set_urgency_hint (GdkSurface *surface,
gboolean urgent)
{
FLASHWINFO flashwinfo;
g_return_if_fail (GDK_IS_SURFACE (window));
g_return_if_fail (GDK_IS_WIN32_SURFACE (surface));
if (GDK_SURFACE_DESTROYED (window))
if (GDK_SURFACE_DESTROYED (surface))
return;
flashwinfo.cbSize = sizeof (flashwinfo);
flashwinfo.hwnd = GDK_SURFACE_HWND (window);
flashwinfo.hwnd = GDK_SURFACE_HWND (surface);
if (urgent)
flashwinfo.dwFlags = FLASHW_ALL | FLASHW_TIMER;
else
@@ -4233,19 +4246,34 @@ gdk_win32_surface_focus (GdkSurface *window,
SetFocus (GDK_SURFACE_HWND (window));
}
/**
* gdk_win32_surface_lookup_for_display:
* @display: a %GdkDisplay
* @anid: a HWND window handle
*
* Returns: (nullable): the %GdkSurface associated with the given @anid, or %NULL.
*/
GdkSurface *
gdk_win32_surface_lookup_for_display (GdkDisplay *display,
HWND anid)
{
g_return_val_if_fail (display == gdk_display_get_default (), NULL);
return (GdkSurface*) gdk_win32_handle_table_lookup (anid);
return (GdkSurface*) gdk_win32_handle_table_lookup_ (anid);
}
/**
* gdk_win32_surface_is_win32:
* @surface: a `GdkSurface`
*
* Returns: %TRUE if the @surface is a win32 implemented surface.
*
* Deprecated: 4.8: Use `GDK_IS_WIN32_SURFACE` instead.
*/
gboolean
gdk_win32_surface_is_win32 (GdkSurface *window)
gdk_win32_surface_is_win32 (GdkSurface *surface)
{
return GDK_IS_WIN32_SURFACE (window);
return GDK_IS_WIN32_SURFACE (surface);
}
static gboolean
@@ -4279,11 +4307,19 @@ gdk_win32_surface_show_window_menu (GdkSurface *surface,
return TRUE;
}
/**
* gdk_win32_surface_get_impl_hwnd:
* @surface: a `GdkSurface`
*
* Returns: the associated @surface HWND handle.
*
* Deprecated: 4.8: Use gdk_win32_surface_get_handle() instead.
*/
HWND
gdk_win32_surface_get_impl_hwnd (GdkSurface *window)
gdk_win32_surface_get_impl_hwnd (GdkSurface *surface)
{
if (GDK_IS_WIN32_SURFACE (window))
return GDK_SURFACE_HWND (window);
if (GDK_IS_WIN32_SURFACE (surface))
return GDK_SURFACE_HWND (surface);
return NULL;
}
@@ -4449,9 +4485,8 @@ static void
gdk_win32_surface_set_input_region (GdkSurface *window,
cairo_region_t *input_region)
{
/* Partial input shape support is implemented by handling the
* NC_NCHITTEST message
*/
/* Input region support is implemented by handling the
* WM_NCHITTEST message. */
}
static void
@@ -4614,16 +4649,20 @@ gdk_win32_surface_class_init (GdkWin32SurfaceClass *klass)
impl_class->compute_size = _gdk_win32_surface_compute_size;
}
HGDIOBJ
gdk_win32_surface_get_handle (GdkSurface *window)
/**
* gdk_win32_surface_get_handle:
* @surface: (type GdkWin32Surface): a native `GdkSurface`.
*
* Returns the HWND handle belonging to @surface.
*
* Returns: the associated HWND handle.
*/
HWND
gdk_win32_surface_get_handle (GdkSurface *surface)
{
if (!GDK_IS_WIN32_SURFACE (window))
{
g_warning (G_STRLOC " window is not a native Win32 window");
return NULL;
}
g_return_val_if_fail (GDK_IS_WIN32_SURFACE (surface), NULL);
return GDK_SURFACE_HWND (window);
return GDK_SURFACE_HWND (surface);
}
#define LAST_PROP 1
+7 -1
View File
@@ -70,7 +70,7 @@ gdk_win32_handle_table_remove (HANDLE handle)
}
gpointer
gdk_win32_handle_table_lookup (HWND handle)
gdk_win32_handle_table_lookup_ (HWND handle)
{
gpointer data = NULL;
@@ -79,3 +79,9 @@ gdk_win32_handle_table_lookup (HWND handle)
return data;
}
gpointer
gdk_win32_handle_table_lookup (HWND handle)
{
return gdk_win32_handle_table_lookup_ (handle);
}
-6
View File
@@ -61,12 +61,6 @@ typedef struct _GdkWin32KeymapClass GdkWin32KeymapClass;
GType gdk_win32_keymap_get_type (void);
GdkWin32KeymapMatch gdk_win32_keymap_check_compose (GdkWin32Keymap *keymap,
guint16 *compose_buffer,
gsize compose_buffer_len,
guint16 *output,
gsize *output_len);
G_END_DECLS
#endif /* __GDK_WIN32_KEYMAP_H__ */
+7 -22
View File
@@ -68,37 +68,22 @@ G_BEGIN_DECLS
#define XBUTTON2 2
#endif
/* Return true if the GdkSurface is a win32 implemented window */
GDK_AVAILABLE_IN_ALL
gboolean gdk_win32_surface_is_win32 (GdkSurface *window);
GDK_AVAILABLE_IN_ALL
HWND gdk_win32_surface_get_impl_hwnd (GdkSurface *window);
GDK_DEPRECATED_IN_4_8_FOR(GDK_IS_WIN32_SURFACE)
gboolean gdk_win32_surface_is_win32 (GdkSurface *surface);
GDK_DEPRECATED_IN_4_8_FOR(gdk_win32_surface_get_handle)
HWND gdk_win32_surface_get_impl_hwnd (GdkSurface *surface);
/* Return the Gdk* for a particular HANDLE */
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_8
gpointer gdk_win32_handle_table_lookup (HWND handle);
/* Translate from window to Windows handle */
GDK_AVAILABLE_IN_ALL
HGDIOBJ gdk_win32_surface_get_handle (GdkSurface *window);
HWND gdk_win32_surface_get_handle (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
GdkSurface * gdk_win32_surface_lookup_for_display (GdkDisplay *display,
HWND anid);
#if defined (INSIDE_GDK_WIN32) || defined (GTK_COMPILATION) || defined (GTK_COMPILATION)
/* For internal GTK use only */
GDK_AVAILABLE_IN_ALL
GdkPixbuf *gdk_win32_icon_to_pixbuf_libgtk_only (HICON hicon,
double *x_hot,
double *y_hot);
GDK_AVAILABLE_IN_ALL
HICON gdk_win32_pixbuf_to_hicon_libgtk_only (GdkPixbuf *pixbuf);
GDK_AVAILABLE_IN_ALL
void gdk_win32_set_modal_dialog_libgtk_only (HWND window);
#endif
G_END_DECLS
#endif /* __GDK_WIN32_MISC_H__ */
+16 -13
View File
@@ -1,6 +1,19 @@
gdk_win32_sources = files([
'gdkcairocontext-win32.c',
gdk_win32_public_sources = files([
'gdkcursor-win32.c',
'gdkdisplay-win32.c',
'gdkdisplaymanager-win32.c',
'gdkdrag-win32.c',
'gdkglcontext-win32.c',
'gdkglcontext-win32-wgl.c',
'gdkwin32id.c',
'gdksurface-win32.c',
'gdkevents-win32.c',
'gdkmonitor-win32.c',
'gdkscreen-win32.c',
])
gdk_win32_sources = gdk_win32_public_sources + files([
'gdkcairocontext-win32.c',
'gdkclipboard-win32.c',
'gdkclipdrop-win32.c',
'gdkdevicemanager-win32.c',
@@ -8,13 +21,7 @@ gdk_win32_sources = files([
'gdkdevice-win32.c',
'gdkdevice-winpointer.c',
'gdkdevice-wintab.c',
'gdkdisplay-win32.c',
'gdkdisplaymanager-win32.c',
'gdkdrag-win32.c',
'gdkdrop-win32.c',
'gdkevents-win32.c',
'gdkglcontext-win32.c',
'gdkglcontext-win32-wgl.c',
'gdkglobals-win32.c',
'gdkhdataoutputstream-win32.c',
'gdkinput-dmanipulation.c',
@@ -24,14 +31,11 @@ gdk_win32_sources = files([
'gdkkeys-win32-impl-wow64.c',
'gdkwin32langnotification.c',
'gdkmain-win32.c',
'gdkmonitor-win32.c',
'gdkproperty-win32.c',
'gdkscreen-win32.c',
'gdkvulkancontext-win32.c',
'gdkwin32cursor.h',
'gdkwin32display.h',
'gdkwin32id.c',
'gdksurface-win32.c',
'gdkwin32keys.h',
])
gdk_win32_public_headers = files([
@@ -40,7 +44,6 @@ gdk_win32_public_headers = files([
'gdkwin32displaymanager.h',
'gdkwin32dnd.h',
'gdkwin32glcontext.h',
'gdkwin32keys.h',
'gdkwin32misc.h',
'gdkwin32monitor.h',
'gdkwin32screen.h',
+2 -2
View File
@@ -358,10 +358,10 @@ gdk_x11_clipboard_request_targets_got_stream (GObject *source,
g_error_free (error);
return;
}
else if (!g_str_equal (type, "ATOM") || format != 32)
else if (g_strcmp0 (type, "ATOM") != 0 || format != 32)
{
GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("%s: Wrong reply type to TARGETS: type %s != ATOM or format %d != 32\n",
cb->selection, type, format));
cb->selection, type ? type : "NULL", format));
g_input_stream_close (stream, NULL, NULL);
g_object_unref (stream);
g_object_unref (cb);
+21 -11
View File
@@ -1729,6 +1729,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
&xev->valuators, &delta_x, &delta_y))
{
GdkModifierType state;
GdkScrollDirection direction;
GDK_DISPLAY_NOTE (display, EVENTS,
g_message ("smooth scroll: \n\tdevice: %u\n\tsource device: %u\n\twindow %ld\n\tdeltas: %f %f",
@@ -1737,21 +1738,19 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group);
if (delta_x > 0)
direction = GDK_SCROLL_RIGHT;
else if (delta_x < 0)
direction = GDK_SCROLL_LEFT;
else if (delta_y > 0)
direction = GDK_SCROLL_DOWN;
else
direction = GDK_SCROLL_UP;
if (gdk_device_get_source (source_device) != GDK_SOURCE_TOUCHPAD &&
((delta_x == 0.0 && ABS (delta_y) == 1.0) ||
(ABS (delta_x) == 1.0 && delta_y == 0.0)))
{
GdkScrollDirection direction;
if (delta_x > 0)
direction = GDK_SCROLL_RIGHT;
else if (delta_x < 0)
direction = GDK_SCROLL_LEFT;
else if (delta_y > 0)
direction = GDK_SCROLL_DOWN;
else
direction = GDK_SCROLL_UP;
event = gdk_scroll_event_new_discrete (surface,
device,
NULL,
@@ -1759,6 +1758,17 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
state,
direction);
}
else if (gdk_device_get_source (source_device) == GDK_SOURCE_MOUSE)
{
event = gdk_scroll_event_new_value120 (surface,
device,
NULL,
xev->time,
state,
direction,
delta_x * 120.0,
delta_y * 120.0);
}
else
{
event = gdk_scroll_event_new (surface,
+12 -16
View File
@@ -361,9 +361,9 @@ gdk_x11_drop_update_actions (GdkX11Drop *drop_x11)
if (!drop_x11->xdnd_have_actions)
actions = drop_x11->suggested_action;
else if (drop_x11->suggested_action & GDK_ACTION_ASK)
actions = drop_x11->xdnd_actions & GDK_ACTION_ALL;
actions = drop_x11->xdnd_actions | GDK_ACTION_ASK;
else
actions = drop_x11->suggested_action;
actions = drop_x11->xdnd_actions & GDK_ACTION_ALL;
gdk_drop_set_actions (GDK_DROP (drop_x11), actions);
}
@@ -769,22 +769,18 @@ gdk_x11_drop_status (GdkDrop *drop,
possible_actions = actions & gdk_drop_get_actions (drop);
if (drop_x11->suggested_action != 0)
if (preferred & possible_actions)
suggested_action = preferred;
else if (drop_x11->suggested_action & possible_actions)
suggested_action = drop_x11->suggested_action;
else if (possible_actions & GDK_ACTION_COPY)
suggested_action = GDK_ACTION_COPY;
else if (possible_actions & GDK_ACTION_MOVE)
suggested_action = GDK_ACTION_MOVE;
else if (possible_actions & GDK_ACTION_ASK)
suggested_action = GDK_ACTION_ASK;
else
suggested_action = preferred & possible_actions;
if (suggested_action == 0 && possible_actions != 0)
{
if (possible_actions & GDK_ACTION_COPY)
suggested_action = GDK_ACTION_COPY;
else if (possible_actions & GDK_ACTION_MOVE)
suggested_action = GDK_ACTION_MOVE;
else if (possible_actions & GDK_ACTION_ASK)
suggested_action = GDK_ACTION_ASK;
else
suggested_action = 0;
}
suggested_action = 0;
xev.xclient.type = ClientMessage;
xev.xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "XdndStatus");
+6 -1
View File
@@ -176,7 +176,12 @@ gsk_gl_driver_shader_weak_cb (gpointer data,
g_assert (GSK_IS_GL_DRIVER (self));
if (self->shader_cache != NULL)
g_hash_table_remove (self->shader_cache, where_object_was);
{
if (self->command_queue != NULL)
gsk_gl_command_queue_make_current (self->command_queue);
g_hash_table_remove (self->shader_cache, where_object_was);
}
}
G_GNUC_NULL_TERMINATED static inline GBytes *
+74 -12
View File
@@ -241,8 +241,8 @@ static void
gsk_gl_glyph_library_upload_glyph (GskGLGlyphLibrary *self,
const GskGLGlyphKey *key,
const GskGLGlyphValue *value,
int x,
int y,
int packed_x,
int packed_y,
int width,
int height,
int uwidth,
@@ -275,19 +275,16 @@ gsk_gl_glyph_library_upload_glyph (GskGLGlyphLibrary *self,
g_assert (texture_id > 0);
glPixelStorei (GL_UNPACK_ROW_LENGTH, stride / 4);
glBindTexture (GL_TEXTURE_2D, texture_id);
if G_UNLIKELY (gdk_gl_context_get_use_es (gdk_gl_context_get_current ()))
{
pixel_data = free_data = g_malloc (width * height * 4);
gdk_memory_convert (pixel_data,
width * 4,
gdk_memory_convert (pixel_data, width * 4,
GDK_MEMORY_R8G8B8A8_PREMULTIPLIED,
cairo_image_surface_get_data (surface),
width * 4,
stride,
GDK_MEMORY_DEFAULT,
width, height);
stride = width * 4;
gl_format = GL_RGBA;
gl_type = GL_UNSIGNED_BYTE;
}
@@ -298,9 +295,74 @@ gsk_gl_glyph_library_upload_glyph (GskGLGlyphLibrary *self,
gl_type = GL_UNSIGNED_INT_8_8_8_8_REV;
}
glTexSubImage2D (GL_TEXTURE_2D, 0, x, y, width, height,
gl_format, gl_type, pixel_data);
glPixelStorei (GL_UNPACK_ROW_LENGTH, stride / 4);
glBindTexture (GL_TEXTURE_2D, texture_id);
glTexSubImage2D (GL_TEXTURE_2D, 0,
packed_x + 1, packed_y + 1,
width, height,
gl_format, gl_type,
pixel_data);
/* Padding top */
glTexSubImage2D (GL_TEXTURE_2D, 0,
packed_x + 1, packed_y,
width, 1,
gl_format, gl_type,
pixel_data);
/* Padding left */
glTexSubImage2D (GL_TEXTURE_2D, 0,
packed_x, packed_y + 1,
1, height,
gl_format, gl_type,
pixel_data);
/* Padding top left */
glTexSubImage2D (GL_TEXTURE_2D, 0,
packed_x, packed_y,
1, 1,
gl_format, gl_type,
pixel_data);
/* Padding right */
glPixelStorei (GL_UNPACK_ROW_LENGTH, width);
glPixelStorei (GL_UNPACK_SKIP_PIXELS, width - 1);
glTexSubImage2D (GL_TEXTURE_2D, 0,
packed_x + width + 1, packed_y + 1,
1, height,
gl_format, gl_type,
pixel_data);
/* Padding top right */
glTexSubImage2D (GL_TEXTURE_2D, 0,
packed_x + width + 1, packed_y,
1, 1,
gl_format, gl_type,
pixel_data);
/* Padding bottom */
glPixelStorei (GL_UNPACK_SKIP_PIXELS, 0);
glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
glPixelStorei (GL_UNPACK_SKIP_ROWS, height - 1);
glTexSubImage2D (GL_TEXTURE_2D, 0,
packed_x + 1, packed_y + 1 + height,
width, 1,
gl_format, gl_type,
pixel_data);
/* Padding bottom left */
glTexSubImage2D (GL_TEXTURE_2D, 0,
packed_x, packed_y + 1 + height,
1, 1,
gl_format, gl_type,
pixel_data);
/* Padding bottom right */
glPixelStorei (GL_UNPACK_ROW_LENGTH, width);
glPixelStorei (GL_UNPACK_SKIP_PIXELS, width - 1);
glTexSubImage2D (GL_TEXTURE_2D, 0,
packed_x + 1 + width, packed_y + 1 + height,
1, 1,
gl_format, gl_type,
pixel_data);
/* Reset this */
glPixelStorei (GL_UNPACK_SKIP_PIXELS, 0);
glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
glPixelStorei (GL_UNPACK_SKIP_ROWS, 0);
cairo_surface_destroy (surface);
g_free (free_data);
@@ -359,8 +421,8 @@ gsk_gl_glyph_library_add (GskGLGlyphLibrary *self,
gsk_gl_glyph_library_upload_glyph (self,
key,
value,
packed_x + 1,
packed_y + 1,
packed_x,
packed_y,
width,
height,
ink_rect.width,
+7
View File
@@ -162,6 +162,7 @@ uniform_type_from_glsl (const char *str)
return GSK_GL_UNIFORM_TYPE_NONE;
}
#ifdef G_ENABLE_DEBUG
static const char *
uniform_type_name (GskGLUniformType type)
{
@@ -194,6 +195,7 @@ uniform_type_name (GskGLUniformType type)
return NULL;
}
}
#endif
static int
uniform_type_size (GskGLUniformType type)
@@ -397,6 +399,7 @@ gsk_gl_shader_constructed (GObject *object)
shader->n_textures = max_texture_seen;
#ifdef G_ENABLE_DEBUG
if (GSK_DEBUG_CHECK(SHADERS))
{
GString *s;
@@ -414,6 +417,7 @@ gsk_gl_shader_constructed (GObject *object)
s->str);
g_string_free (s, TRUE);
}
#endif
}
#define SPACE_RE "[ \\t]+" // Don't use \s, we don't want to match newlines
@@ -631,6 +635,7 @@ gsk_gl_shader_get_uniform_name (GskGLShader *shader,
int idx)
{
g_return_val_if_fail (GSK_IS_GL_SHADER (shader), NULL);
g_return_val_if_fail (0 <= idx && idx < shader->uniforms->len, NULL);
return g_array_index (shader->uniforms, GskGLUniform, idx).name;
}
@@ -675,6 +680,7 @@ gsk_gl_shader_get_uniform_type (GskGLShader *shader,
int idx)
{
g_return_val_if_fail (GSK_IS_GL_SHADER (shader), 0);
g_return_val_if_fail (0 <= idx && idx < shader->uniforms->len, 0);
return g_array_index (shader->uniforms, GskGLUniform, idx).type;
}
@@ -693,6 +699,7 @@ gsk_gl_shader_get_uniform_offset (GskGLShader *shader,
int idx)
{
g_return_val_if_fail (GSK_IS_GL_SHADER (shader), 0);
g_return_val_if_fail (0 <= idx && idx < shader->uniforms->len, 0);
return g_array_index (shader->uniforms, GskGLUniform, idx).offset;
}
-20
View File
@@ -15,23 +15,3 @@ gsk_ensure_resources (void)
g_once (&register_resources_once, register_resources, NULL);
}
int
pango_glyph_string_num_glyphs (PangoGlyphString *glyphs)
{
int i, count;
count = 0;
for (i = 0; i < glyphs->num_glyphs; i++)
{
PangoGlyphInfo *gi = &glyphs->glyphs[i];
if (gi->glyph != PANGO_GLYPH_EMPTY)
{
if (!(gi->glyph & PANGO_GLYPH_UNKNOWN_FLAG))
count++;
}
}
return count;
}
-2
View File
@@ -8,8 +8,6 @@ G_BEGIN_DECLS
void gsk_ensure_resources (void);
int pango_glyph_string_num_glyphs (PangoGlyphString *glyphs) G_GNUC_PURE;
typedef struct _GskVulkanRender GskVulkanRender;
typedef struct _GskVulkanRenderPass GskVulkanRenderPass;
+1 -1
View File
@@ -3752,7 +3752,7 @@ gsk_rounded_clip_node_diff (GskRenderNode *node1,
* Creates a `GskRenderNode` that will clip the @child to the area
* given by @clip.
*
* Returns: (transfer none) (type GskRoundedClipNode): A new `GskRenderNode`
* Returns: (transfer full) (type GskRoundedClipNode): A new `GskRenderNode`
*/
GskRenderNode *
gsk_rounded_clip_node_new (GskRenderNode *child,
+22 -22
View File
@@ -982,7 +982,7 @@ parse_color_node (GtkCssParser *parser)
{ "color", parse_color, NULL, &color },
};
parse_declarations (parser, declarations, G_N_ELEMENTS(declarations));
parse_declarations (parser, declarations, G_N_ELEMENTS (declarations));
return gsk_color_node_new (&color, &bounds);
}
@@ -1003,7 +1003,7 @@ parse_linear_gradient_node_internal (GtkCssParser *parser,
};
GskRenderNode *result;
parse_declarations (parser, declarations, G_N_ELEMENTS(declarations));
parse_declarations (parser, declarations, G_N_ELEMENTS (declarations));
if (stops == NULL)
{
GskColorStop from = { 0.0, GDK_RGBA("AAFF00") };
@@ -1058,7 +1058,7 @@ parse_radial_gradient_node_internal (GtkCssParser *parser,
};
GskRenderNode *result;
parse_declarations (parser, declarations, G_N_ELEMENTS(declarations));
parse_declarations (parser, declarations, G_N_ELEMENTS (declarations));
if (stops == NULL)
{
GskColorStop from = { 0.0, GDK_RGBA("AAFF00") };
@@ -1108,7 +1108,7 @@ parse_conic_gradient_node (GtkCssParser *parser)
};
GskRenderNode *result;
parse_declarations (parser, declarations, G_N_ELEMENTS(declarations));
parse_declarations (parser, declarations, G_N_ELEMENTS (declarations));
if (stops == NULL)
{
GskColorStop from = { 0.0, GDK_RGBA("AAFF00") };
@@ -1142,7 +1142,7 @@ parse_inset_shadow_node (GtkCssParser *parser)
{ "blur", parse_double, NULL, &blur }
};
parse_declarations (parser, declarations, G_N_ELEMENTS(declarations));
parse_declarations (parser, declarations, G_N_ELEMENTS (declarations));
return gsk_inset_shadow_node_new (&outline, &color, dx, dy, spread, blur);
}
@@ -1325,7 +1325,7 @@ parse_glshader_node (GtkCssParser *parser)
GBytes *args = NULL;
int len, i;
parse_declarations (parser, declarations, G_N_ELEMENTS(declarations));
parse_declarations (parser, declarations, G_N_ELEMENTS (declarations));
for (len = 0; len < 4; len++)
{
@@ -1362,7 +1362,7 @@ parse_border_node (GtkCssParser *parser)
{ "colors", parse_colors4, NULL, &colors }
};
parse_declarations (parser, declarations, G_N_ELEMENTS(declarations));
parse_declarations (parser, declarations, G_N_ELEMENTS (declarations));
return gsk_border_node_new (&outline, widths, colors);
}
@@ -1378,7 +1378,7 @@ parse_texture_node (GtkCssParser *parser)
};
GskRenderNode *node;
parse_declarations (parser, declarations, G_N_ELEMENTS(declarations));
parse_declarations (parser, declarations, G_N_ELEMENTS (declarations));
if (texture == NULL)
texture = create_default_texture ();
@@ -1402,7 +1402,7 @@ parse_cairo_node (GtkCssParser *parser)
};
GskRenderNode *node;
parse_declarations (parser, declarations, G_N_ELEMENTS(declarations));
parse_declarations (parser, declarations, G_N_ELEMENTS (declarations));
node = gsk_cairo_node_new (&bounds);
@@ -1447,7 +1447,7 @@ parse_outset_shadow_node (GtkCssParser *parser)
{ "blur", parse_double, NULL, &blur }
};
parse_declarations (parser, declarations, G_N_ELEMENTS(declarations));
parse_declarations (parser, declarations, G_N_ELEMENTS (declarations));
return gsk_outset_shadow_node_new (&outline, &color, dx, dy, spread, blur);
}
@@ -1463,7 +1463,7 @@ parse_transform_node (GtkCssParser *parser)
};
GskRenderNode *result;
parse_declarations (parser, declarations, G_N_ELEMENTS(declarations));
parse_declarations (parser, declarations, G_N_ELEMENTS (declarations));
if (child == NULL)
child = create_default_render_node ();
@@ -1490,7 +1490,7 @@ parse_opacity_node (GtkCssParser *parser)
};
GskRenderNode *result;
parse_declarations (parser, declarations, G_N_ELEMENTS(declarations));
parse_declarations (parser, declarations, G_N_ELEMENTS (declarations));
if (child == NULL)
child = create_default_render_node ();
@@ -1517,7 +1517,7 @@ parse_color_matrix_node (GtkCssParser *parser)
graphene_vec4_init (&offset, 0, 0, 0, 0);
parse_declarations (parser, declarations, G_N_ELEMENTS(declarations));
parse_declarations (parser, declarations, G_N_ELEMENTS (declarations));
if (child == NULL)
child = create_default_render_node ();
@@ -1544,7 +1544,7 @@ parse_cross_fade_node (GtkCssParser *parser)
};
GskRenderNode *result;
parse_declarations (parser, declarations, G_N_ELEMENTS(declarations));
parse_declarations (parser, declarations, G_N_ELEMENTS (declarations));
if (start == NULL)
start = gsk_color_node_new (&GDK_RGBA("AAFF00"), &GRAPHENE_RECT_INIT (0, 0, 50, 50));
if (end == NULL)
@@ -1571,7 +1571,7 @@ parse_blend_node (GtkCssParser *parser)
};
GskRenderNode *result;
parse_declarations (parser, declarations, G_N_ELEMENTS(declarations));
parse_declarations (parser, declarations, G_N_ELEMENTS (declarations));
if (bottom == NULL)
bottom = gsk_color_node_new (&GDK_RGBA("AAFF00"), &GRAPHENE_RECT_INIT (0, 0, 50, 50));
if (top == NULL)
@@ -1599,7 +1599,7 @@ parse_repeat_node (GtkCssParser *parser)
GskRenderNode *result;
guint parse_result;
parse_result = parse_declarations (parser, declarations, G_N_ELEMENTS(declarations));
parse_result = parse_declarations (parser, declarations, G_N_ELEMENTS (declarations));
if (child == NULL)
child = create_default_render_node ();
@@ -1663,7 +1663,7 @@ parse_text_node (GtkCssParser *parser)
};
GskRenderNode *result;
parse_declarations (parser, declarations, G_N_ELEMENTS(declarations));
parse_declarations (parser, declarations, G_N_ELEMENTS (declarations));
if (font == NULL)
{
@@ -1721,7 +1721,7 @@ parse_blur_node (GtkCssParser *parser)
};
GskRenderNode *result;
parse_declarations (parser, declarations, G_N_ELEMENTS(declarations));
parse_declarations (parser, declarations, G_N_ELEMENTS (declarations));
if (child == NULL)
child = create_default_render_node ();
@@ -1743,7 +1743,7 @@ parse_clip_node (GtkCssParser *parser)
};
GskRenderNode *result;
parse_declarations (parser, declarations, G_N_ELEMENTS(declarations));
parse_declarations (parser, declarations, G_N_ELEMENTS (declarations));
if (child == NULL)
child = create_default_render_node ();
@@ -1768,7 +1768,7 @@ parse_rounded_clip_node (GtkCssParser *parser)
};
GskRenderNode *result;
parse_declarations (parser, declarations, G_N_ELEMENTS(declarations));
parse_declarations (parser, declarations, G_N_ELEMENTS (declarations));
if (child == NULL)
child = create_default_render_node ();
@@ -1790,7 +1790,7 @@ parse_shadow_node (GtkCssParser *parser)
};
GskRenderNode *result;
parse_declarations (parser, declarations, G_N_ELEMENTS(declarations));
parse_declarations (parser, declarations, G_N_ELEMENTS (declarations));
if (child == NULL)
child = create_default_render_node ();
@@ -1819,7 +1819,7 @@ parse_debug_node (GtkCssParser *parser)
};
GskRenderNode *result;
parse_declarations (parser, declarations, G_N_ELEMENTS(declarations));
parse_declarations (parser, declarations, G_N_ELEMENTS (declarations));
if (child == NULL)
child = create_default_render_node ();
+8
View File
@@ -285,6 +285,14 @@
...
fun:g_intern_static_string
}
{
glib GQuark
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
...
fun:g_intern_string
}
# Threads
{
+43 -26
View File
@@ -953,22 +953,30 @@ gtk_at_spi_context_state_change (GtkATContext *ctx,
{
value = gtk_accessible_attribute_set_get_value (states, GTK_ACCESSIBLE_STATE_CHECKED);
switch (gtk_tristate_accessible_value_get (value))
if (value->value_class->type == GTK_ACCESSIBLE_VALUE_TYPE_TRISTATE)
{
switch (gtk_tristate_accessible_value_get (value))
{
case GTK_ACCESSIBLE_TRISTATE_TRUE:
emit_state_changed (self, "checked", TRUE);
emit_state_changed (self, "indeterminate", FALSE);
break;
case GTK_ACCESSIBLE_TRISTATE_MIXED:
emit_state_changed (self, "checked", FALSE);
emit_state_changed (self, "indeterminate", TRUE);
break;
case GTK_ACCESSIBLE_TRISTATE_FALSE:
emit_state_changed (self, "checked", FALSE);
emit_state_changed (self, "indeterminate", FALSE);
break;
default:
break;
}
}
else
{
case GTK_ACCESSIBLE_TRISTATE_TRUE:
emit_state_changed (self, "checked", TRUE);
emit_state_changed (self, "indeterminate", FALSE);
break;
case GTK_ACCESSIBLE_TRISTATE_MIXED:
emit_state_changed (self, "checked", FALSE);
emit_state_changed (self, "indeterminate", TRUE);
break;
case GTK_ACCESSIBLE_TRISTATE_FALSE:
emit_state_changed (self, "checked", FALSE);
emit_state_changed (self, "indeterminate", FALSE);
break;
default:
break;
}
}
@@ -1011,22 +1019,31 @@ gtk_at_spi_context_state_change (GtkATContext *ctx,
if (changed_states & GTK_ACCESSIBLE_STATE_CHANGE_PRESSED)
{
value = gtk_accessible_attribute_set_get_value (states, GTK_ACCESSIBLE_STATE_PRESSED);
switch (gtk_tristate_accessible_value_get (value))
if (value->value_class->type == GTK_ACCESSIBLE_VALUE_TYPE_TRISTATE)
{
switch (gtk_tristate_accessible_value_get (value))
{
case GTK_ACCESSIBLE_TRISTATE_TRUE:
emit_state_changed (self, "pressed", TRUE);
emit_state_changed (self, "indeterminate", FALSE);
break;
case GTK_ACCESSIBLE_TRISTATE_MIXED:
emit_state_changed (self, "pressed", FALSE);
emit_state_changed (self, "indeterminate", TRUE);
break;
case GTK_ACCESSIBLE_TRISTATE_FALSE:
emit_state_changed (self, "pressed", FALSE);
emit_state_changed (self, "indeterminate", FALSE);
break;
default:
break;
}
}
else
{
case GTK_ACCESSIBLE_TRISTATE_TRUE:
emit_state_changed (self, "pressed", TRUE);
emit_state_changed (self, "indeterminate", FALSE);
break;
case GTK_ACCESSIBLE_TRISTATE_MIXED:
emit_state_changed (self, "pressed", FALSE);
emit_state_changed (self, "indeterminate", TRUE);
break;
case GTK_ACCESSIBLE_TRISTATE_FALSE:
emit_state_changed (self, "pressed", FALSE);
emit_state_changed (self, "indeterminate", FALSE);
break;
default:
break;
}
}
+1 -124
View File
@@ -18,130 +18,7 @@
#include "config.h"
#include "gtkatspipangoprivate.h"
const char *
pango_style_to_string (PangoStyle style)
{
switch (style)
{
case PANGO_STYLE_NORMAL:
return "normal";
case PANGO_STYLE_OBLIQUE:
return "oblique";
case PANGO_STYLE_ITALIC:
return "italic";
default:
g_assert_not_reached ();
}
}
const char *
pango_variant_to_string (PangoVariant variant)
{
switch (variant)
{
case PANGO_VARIANT_NORMAL:
return "normal";
case PANGO_VARIANT_SMALL_CAPS:
return "small_caps";
case PANGO_VARIANT_ALL_SMALL_CAPS:
return "all_small_caps";
case PANGO_VARIANT_PETITE_CAPS:
return "petite_caps";
case PANGO_VARIANT_ALL_PETITE_CAPS:
return "all_petite_caps";
case PANGO_VARIANT_UNICASE:
return "unicase";
case PANGO_VARIANT_TITLE_CAPS:
return "title_caps";
default:
g_assert_not_reached ();
}
}
const char *
pango_stretch_to_string (PangoStretch stretch)
{
switch (stretch)
{
case PANGO_STRETCH_ULTRA_CONDENSED:
return "ultra_condensed";
case PANGO_STRETCH_EXTRA_CONDENSED:
return "extra_condensed";
case PANGO_STRETCH_CONDENSED:
return "condensed";
case PANGO_STRETCH_SEMI_CONDENSED:
return "semi_condensed";
case PANGO_STRETCH_NORMAL:
return "normal";
case PANGO_STRETCH_SEMI_EXPANDED:
return "semi_expanded";
case PANGO_STRETCH_EXPANDED:
return "expanded";
case PANGO_STRETCH_EXTRA_EXPANDED:
return "extra_expanded";
case PANGO_STRETCH_ULTRA_EXPANDED:
return "ultra_expanded";
default:
g_assert_not_reached ();
}
}
const char *
pango_underline_to_string (PangoUnderline value)
{
switch (value)
{
case PANGO_UNDERLINE_NONE:
return "none";
case PANGO_UNDERLINE_SINGLE:
case PANGO_UNDERLINE_SINGLE_LINE:
return "single";
case PANGO_UNDERLINE_DOUBLE:
case PANGO_UNDERLINE_DOUBLE_LINE:
return "double";
case PANGO_UNDERLINE_LOW:
return "low";
case PANGO_UNDERLINE_ERROR:
case PANGO_UNDERLINE_ERROR_LINE:
return "error";
default:
g_assert_not_reached ();
}
}
const char *
pango_wrap_mode_to_string (PangoWrapMode mode)
{
/* Keep these in sync with gtk_wrap_mode_to_string() */
switch (mode)
{
case PANGO_WRAP_WORD:
return "word";
case PANGO_WRAP_CHAR:
return "char";
case PANGO_WRAP_WORD_CHAR:
return "word-char";
default:
g_assert_not_reached ();
}
}
static const char *
pango_align_to_string (PangoAlignment align)
{
switch (align)
{
case PANGO_ALIGN_LEFT:
return "left";
case PANGO_ALIGN_CENTER:
return "center";
case PANGO_ALIGN_RIGHT:
return "right";
default:
g_assert_not_reached ();
}
}
#include "gtkpango.h"
void
gtk_pango_get_font_attributes (PangoFontDescription *font,
-6
View File
@@ -22,12 +22,6 @@
G_BEGIN_DECLS
const char *pango_wrap_mode_to_string (PangoWrapMode mode);
const char *pango_underline_to_string (PangoUnderline underline);
const char *pango_stretch_to_string (PangoStretch stretch);
const char *pango_style_to_string (PangoStyle style);
const char *pango_variant_to_string (PangoVariant variant);
void gtk_pango_get_font_attributes (PangoFontDescription *font,
GVariantBuilder *builder);
void gtk_pango_get_default_attributes (PangoLayout *layout,
+3 -1
View File
@@ -106,6 +106,7 @@ gtk_at_spi_root_dispose (GObject *gobject)
g_clear_object (&self->cache);
g_clear_object (&self->connection);
g_clear_pointer (&self->queued_contexts, g_list_free);
G_OBJECT_CLASS (gtk_at_spi_root_parent_class)->dispose (gobject);
}
@@ -517,7 +518,8 @@ on_registration_reply (GObject *gobject,
/* Drain the list of queued GtkAtSpiContexts, and add them to the cache */
if (self->queued_contexts != NULL)
{
for (GList *l = g_list_reverse (self->queued_contexts); l != NULL; l = l->next)
self->queued_contexts = g_list_reverse (self->queued_contexts);
for (GList *l = self->queued_contexts; l != NULL; l = l->next)
{
if (data->register_func != NULL)
data->register_func (self, l->data);
+1 -1
View File
@@ -864,7 +864,7 @@ notebook_handle_method (GDBusConnection *connection,
for (child = gtk_widget_get_first_child (widget);
child;
child = gtk_widget_get_next_sibling (widget))
child = gtk_widget_get_next_sibling (child))
{
/* skip actions */
if (gtk_accessible_get_accessible_role (GTK_ACCESSIBLE (child)) != GTK_ACCESSIBLE_ROLE_TAB)
+5 -3
View File
@@ -32,13 +32,15 @@
#include "gtkatcontextprivate.h"
#include "gtkdebug.h"
#include "gtkeditable.h"
#include "gtkentryprivate.h"
#include "gtkinscriptionprivate.h"
#include "gtklabelprivate.h"
#include "gtkentryprivate.h"
#include "gtksearchentryprivate.h"
#include "gtkpango.h"
#include "gtkpasswordentryprivate.h"
#include "gtksearchentryprivate.h"
#include "gtkspinbuttonprivate.h"
#include "gtktextview.h"
#include "gtktextbufferprivate.h"
#include "gtktextviewprivate.h"
#include <gio/gio.h>
+2 -553
View File
@@ -19,62 +19,9 @@
#include "config.h"
#include "gtkatspitextbufferprivate.h"
#include "gtkatspipangoprivate.h"
#include "gtktextbufferprivate.h"
#include "gtktextviewprivate.h"
static const char *
gtk_justification_to_string (GtkJustification just)
{
switch (just)
{
case GTK_JUSTIFY_LEFT:
return "left";
case GTK_JUSTIFY_RIGHT:
return "right";
case GTK_JUSTIFY_CENTER:
return "center";
case GTK_JUSTIFY_FILL:
return "fill";
default:
g_assert_not_reached ();
}
}
static const char *
gtk_text_direction_to_string (GtkTextDirection direction)
{
switch (direction)
{
case GTK_TEXT_DIR_NONE:
return "none";
case GTK_TEXT_DIR_LTR:
return "ltr";
case GTK_TEXT_DIR_RTL:
return "rtl";
default:
g_assert_not_reached ();
}
}
static const char *
gtk_wrap_mode_to_string (GtkWrapMode wrap_mode)
{
/* Keep these in sync with pango_wrap_mode_to_string(); note that
* here we have an extra case for NONE.
*/
switch (wrap_mode)
{
case GTK_WRAP_NONE:
return "none";
case GTK_WRAP_CHAR:
return "char";
case GTK_WRAP_WORD:
return "word";
case GTK_WRAP_WORD_CHAR:
return "word-char";
default:
g_assert_not_reached ();
}
}
#include "gtkpango.h"
void
gtk_text_view_add_default_attributes (GtkTextView *view,
@@ -161,504 +108,6 @@ gtk_text_view_add_default_attributes (GtkTextView *view,
gtk_text_attributes_unref (text_attrs);
}
void
gtk_text_buffer_get_run_attributes (GtkTextBuffer *buffer,
GVariantBuilder *builder,
int offset,
int *start_offset,
int *end_offset)
{
GtkTextIter iter;
GSList *tags, *temp_tags;
double scale = 1;
gboolean val_set = FALSE;
gtk_text_buffer_get_iter_at_offset (buffer, &iter, offset);
gtk_text_iter_forward_to_tag_toggle (&iter, NULL);
*end_offset = gtk_text_iter_get_offset (&iter);
gtk_text_iter_backward_to_tag_toggle (&iter, NULL);
*start_offset = gtk_text_iter_get_offset (&iter);
gtk_text_buffer_get_iter_at_offset (buffer, &iter, offset);
tags = gtk_text_iter_get_tags (&iter);
tags = g_slist_reverse (tags);
temp_tags = tags;
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
PangoStyle style;
g_object_get (tag,
"style-set", &val_set,
"style", &style,
NULL);
if (val_set)
g_variant_builder_add (builder, "{ss}", "style", pango_style_to_string (style));
temp_tags = temp_tags->next;
}
val_set = FALSE;
temp_tags = tags;
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
PangoVariant variant;
g_object_get (tag,
"variant-set", &val_set,
"variant", &variant,
NULL);
if (val_set)
g_variant_builder_add (builder, "{ss}", "variant", pango_variant_to_string (variant));
temp_tags = temp_tags->next;
}
val_set = FALSE;
temp_tags = tags;
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
PangoStretch stretch;
g_object_get (tag,
"stretch-set", &val_set,
"stretch", &stretch,
NULL);
if (val_set)
g_variant_builder_add (builder, "{ss}", "stretch", pango_stretch_to_string (stretch));
temp_tags = temp_tags->next;
}
val_set = FALSE;
temp_tags = tags;
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
GtkJustification justification;
g_object_get (tag,
"justification-set", &val_set,
"justification", &justification,
NULL);
if (val_set)
g_variant_builder_add (builder, "{ss}", "justification", gtk_justification_to_string (justification));
temp_tags = temp_tags->next;
}
val_set = FALSE;
temp_tags = tags;
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
GtkTextDirection direction;
g_object_get (tag, "direction", &direction, NULL);
if (direction != GTK_TEXT_DIR_NONE)
{
val_set = TRUE;
g_variant_builder_add (builder, "{ss}", "direction", gtk_text_direction_to_string (direction));
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
temp_tags = tags;
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
GtkWrapMode wrap_mode;
g_object_get (tag,
"wrap-mode-set", &val_set,
"wrap-mode", &wrap_mode,
NULL);
if (val_set)
g_variant_builder_add (builder, "{ss}", "wrap-mode", gtk_wrap_mode_to_string (wrap_mode));
temp_tags = temp_tags->next;
}
val_set = FALSE;
temp_tags = tags;
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
g_object_get (tag, "foreground-set", &val_set, NULL);
if (val_set)
{
GdkRGBA *rgba;
char *value;
g_object_get (tag, "foreground", &rgba, NULL);
value = g_strdup_printf ("%u,%u,%u",
(guint) rgba->red * 65535,
(guint) rgba->green * 65535,
(guint) rgba->blue * 65535);
gdk_rgba_free (rgba);
g_variant_builder_add (builder, "{ss}", "fg-color", value);
g_free (value);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
temp_tags = tags;
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
g_object_get (tag, "background-set", &val_set, NULL);
if (val_set)
{
GdkRGBA *rgba;
char *value;
g_object_get (tag, "background-rgba", &rgba, NULL);
value = g_strdup_printf ("%u,%u,%u",
(guint) rgba->red * 65535,
(guint) rgba->green * 65535,
(guint) rgba->blue * 65535);
gdk_rgba_free (rgba);
g_variant_builder_add (builder, "{ss}", "bg-color", value);
g_free (value);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
temp_tags = tags;
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
g_object_get (tag, "family-set", &val_set, NULL);
if (val_set)
{
char *value;
g_object_get (tag, "family", &value, NULL);
g_variant_builder_add (builder, "{ss}", "family-name", value);
g_free (value);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
temp_tags = tags;
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
g_object_get (tag, "language-set", &val_set, NULL);
if (val_set)
{
char *value;
g_object_get (tag, "language", &value, NULL);
g_variant_builder_add (builder, "{ss}", "language", value);
g_free (value);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
temp_tags = tags;
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
int weight;
g_object_get (tag,
"weight-set", &val_set,
"weight", &weight,
NULL);
if (val_set)
{
char *value;
value = g_strdup_printf ("%d", weight);
g_variant_builder_add (builder, "{ss}", "weight", value);
g_free (value);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
/* scale is special as the effective value is the product
* of all specified values
*/
temp_tags = tags;
while (temp_tags)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
gboolean scale_set;
g_object_get (tag, "scale-set", &scale_set, NULL);
if (scale_set)
{
double font_scale;
g_object_get (tag, "scale", &font_scale, NULL);
val_set = TRUE;
scale *= font_scale;
}
temp_tags = temp_tags->next;
}
if (val_set)
{
char *value = g_strdup_printf ("%g", scale);
g_variant_builder_add (builder, "{ss}", "scale", value);
g_free (value);
}
val_set = FALSE;
temp_tags = tags;
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
int size;
g_object_get (tag,
"size-set", &val_set,
"size", &size,
NULL);
if (val_set)
{
char *value = g_strdup_printf ("%i", size);
g_variant_builder_add (builder, "{ss}", "size", value);
g_free (value);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
temp_tags = tags;
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
gboolean strikethrough;
g_object_get (tag,
"strikethrough-set", &val_set,
"strikethrough", &strikethrough,
NULL);
if (val_set)
g_variant_builder_add (builder, "{ss}", "strikethrough", strikethrough ? "true" : "false");
temp_tags = temp_tags->next;
}
val_set = FALSE;
temp_tags = tags;
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
PangoUnderline underline;
g_object_get (tag,
"underline-set", &val_set,
"underline", &underline,
NULL);
if (val_set)
g_variant_builder_add (builder, "{ss}", "underline",
pango_underline_to_string (underline));
temp_tags = temp_tags->next;
}
val_set = FALSE;
temp_tags = tags;
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
int rise;
g_object_get (tag,
"rise-set", &val_set,
"rise", &rise,
NULL);
if (val_set)
{
char *value = g_strdup_printf ("%i", rise);
g_variant_builder_add (builder, "{ss}", "rise", value);
g_free (value);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
temp_tags = tags;
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
gboolean bg_full_height;
g_object_get (tag,
"background-full-height-set", &val_set,
"background-full-height", &bg_full_height,
NULL);
if (val_set)
g_variant_builder_add (builder, "{ss}", "bg-full-height", bg_full_height ? "true" : "false");
temp_tags = temp_tags->next;
}
val_set = FALSE;
temp_tags = tags;
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
int pixels;
g_object_get (tag,
"pixels-inside-wrap-set", &val_set,
"pixels-inside-wrap", &pixels,
NULL);
if (val_set)
{
char *value = g_strdup_printf ("%i", pixels);
g_variant_builder_add (builder, "{ss}", "pixels-inside-wrap", value);
g_free (value);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
temp_tags = tags;
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
int pixels;
g_object_get (tag,
"pixels-below-lines-set", &val_set,
"pixels-below-lines", &pixels,
NULL);
if (val_set)
{
char *value = g_strdup_printf ("%i", pixels);
g_variant_builder_add (builder, "{ss}", "pixels-below-lines", value);
g_free (value);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
temp_tags = tags;
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
int pixels;
g_object_get (tag,
"pixels-above-lines-set", &val_set,
"pixels-above-lines", &pixels,
NULL);
if (val_set)
{
char *value = g_strdup_printf ("%i", pixels);
g_variant_builder_add (builder, "{ss}", "pixels-above-lines", value);
g_free (value);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
temp_tags = tags;
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
gboolean editable;
g_object_get (tag,
"editable-set", &val_set,
"editable", &editable,
NULL);
if (val_set)
g_variant_builder_add (builder, "{ss}", "editable", editable ? "true" : "false");
temp_tags = temp_tags->next;
}
val_set = FALSE;
temp_tags = tags;
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
gboolean invisible;
g_object_get (tag,
"invisible-set", &val_set,
"invisible", &invisible,
NULL);
if (val_set)
g_variant_builder_add (builder, "{ss}", "invisible", invisible ? "true" : "false");
temp_tags = temp_tags->next;
}
val_set = FALSE;
temp_tags = tags;
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
int indent;
g_object_get (tag,
"indent-set", &val_set,
"indent", &indent,
NULL);
if (val_set)
{
char *value = g_strdup_printf ("%i", indent);
g_variant_builder_add (builder, "{ss}", "indent", value);
g_free (value);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
temp_tags = tags;
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
int margin;
g_object_get (tag,
"right-margin-set", &val_set,
"right-margin", &margin,
NULL);
if (val_set)
{
char *value = g_strdup_printf ("%i", margin);
g_variant_builder_add (builder, "{ss}", "right-margin", value);
g_free (value);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
temp_tags = tags;
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
int margin;
g_object_get (tag,
"left-margin-set", &val_set,
"left-margin", &margin,
NULL);
if (val_set)
{
char *value = g_strdup_printf ("%i", margin);
g_variant_builder_add (builder, "{ss}", "left-margin", value);
g_free (value);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
g_slist_free (tags);
}
char *
gtk_text_view_get_text_before (GtkTextView *view,
int offset,
-5
View File
@@ -25,11 +25,6 @@ G_BEGIN_DECLS
void gtk_text_view_add_default_attributes (GtkTextView *view,
GVariantBuilder *builder);
void gtk_text_buffer_get_run_attributes (GtkTextBuffer *buffer,
GVariantBuilder *builder,
int offset,
int *start_offset,
int *end_offset);
char *gtk_text_view_get_text_before (GtkTextView *view,
int offset,
BIN
View File
Binary file not shown.
+3 -3
View File
@@ -2,8 +2,8 @@
#define __GTK_COMPOSE_DATA__
#define MAX_SEQ_LEN 5
#define N_INDEX_SIZE 30
#define DATA_SIZE 16477
#define N_CHARS 1241
#define N_INDEX_SIZE 39
#define DATA_SIZE 15777
#define N_CHARS 1321
#endif
Binary file not shown.
Binary file not shown.
+12 -1
View File
@@ -152,13 +152,24 @@ gtk_css_data_url_parse (const char *url,
gsize read;
gsize written;
gpointer data;
GError *local_error = NULL;
data = g_convert_with_fallback (bdata, bsize,
"UTF-8", charset,
(char *) "*",
&read, &written, NULL);
&read, &written, &local_error);
g_free (bdata);
if (local_error)
{
g_propagate_error (error, local_error);
g_free (charset);
g_free (data);
g_free (mimetype);
return NULL;
}
bdata = data;
bsize = written;
}
+17 -4
View File
@@ -1353,8 +1353,8 @@ gtk_builder_add_objects_from_file (GtkBuilder *builder,
* Main private entry point for building composite components
* from template XML.
*
* This is exported purely to let `gtk-builder-tool` validate
* templates, applications have no need to call this function.
* Most likely you do not need to call this function in applications as
* templates are handled by `GtkWidget`.
*
* Returns: A positive value on success, 0 if an error occurred
*/
@@ -1367,6 +1367,7 @@ gtk_builder_extend_with_template (GtkBuilder *builder,
GError **error)
{
GtkBuilderPrivate *priv = gtk_builder_get_instance_private (builder);
const char *name;
GError *tmp_error;
char *filename;
@@ -1384,8 +1385,15 @@ gtk_builder_extend_with_template (GtkBuilder *builder,
priv->resource_prefix = NULL;
priv->template_type = template_type;
filename = g_strconcat ("<", g_type_name (template_type), " template>", NULL);
gtk_builder_expose_object (builder, g_type_name (template_type), object);
/* We specifically allow this function to be called multiple times with
* the same @template_type as that is used in applications like Builder
* to implement UI merging.
*/
name = g_type_name (template_type);
if (gtk_builder_get_object (builder, name) != object)
gtk_builder_expose_object (builder, name, object);
filename = g_strconcat ("<", name, " template>", NULL);
_gtk_builder_parser_parse_buffer (builder, filename,
buffer, length,
NULL,
@@ -1772,6 +1780,11 @@ gtk_builder_get_translation_domain (GtkBuilder *builder)
*
* Add @object to the @builder object pool so it can be
* referenced just like any other object built by builder.
*
* Only a single object may be added using @name. However,
* it is not an error to expose the same object under multiple
* names. `gtk_builder_get_object()` may be used to determine
* if an object has already been added with @name.
*/
void
gtk_builder_expose_object (GtkBuilder *builder,
+13 -2
View File
@@ -21,6 +21,11 @@
#include "gtkcolorpickerportalprivate.h"
#include "gtkcolorpickershellprivate.h"
#include "gtkcolorpickerkwinprivate.h"
#ifdef G_OS_WIN32
#include "gtkcolorpickerwin32private.h"
#endif
#include <gio/gio.h>
@@ -51,13 +56,19 @@ gtk_color_picker_pick_finish (GtkColorPicker *picker,
GtkColorPicker *
gtk_color_picker_new (void)
{
GtkColorPicker *picker;
GtkColorPicker *picker = NULL;
picker = gtk_color_picker_portal_new ();
#if defined (G_OS_UNIX)
if (!picker)
picker = gtk_color_picker_portal_new ();
if (!picker)
picker = gtk_color_picker_shell_new ();
if (!picker)
picker = gtk_color_picker_kwin_new ();
#elif defined (G_OS_WIN32)
if (!picker)
picker = gtk_color_picker_win32_new ();
#endif
if (!picker)
g_debug ("No suitable GtkColorPicker implementation");
+246
View File
@@ -0,0 +1,246 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2022 the GTK team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "gtkcolorpickerwin32private.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
GList *pickers;
HHOOK hook;
static void remove_hook (void);
extern IMAGE_DOS_HEADER __ImageBase;
#define this_hmodule ((HMODULE)&__ImageBase)
struct _GtkColorPickerWin32
{
GObject parent_instance;
GTask *task;
POINT point;
};
struct _GtkColorPickerWin32Class
{
GObjectClass parent_class;
};
static GInitableIface *initable_parent_iface;
static void gtk_color_picker_win32_initable_iface_init (GInitableIface *iface);
static void gtk_color_picker_win32_iface_init (GtkColorPickerInterface *iface);
G_DEFINE_TYPE_WITH_CODE (GtkColorPickerWin32, gtk_color_picker_win32, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, gtk_color_picker_win32_initable_iface_init)
G_IMPLEMENT_INTERFACE (GTK_TYPE_COLOR_PICKER, gtk_color_picker_win32_iface_init))
static gboolean
gtk_color_picker_win32_initable_init (GInitable *initable,
GCancellable *cancellable,
GError **error)
{
return TRUE;
}
static void
gtk_color_picker_win32_initable_iface_init (GInitableIface *iface)
{
initable_parent_iface = g_type_interface_peek_parent (iface);
iface->init = gtk_color_picker_win32_initable_init;
}
static void
gtk_color_picker_win32_init (GtkColorPickerWin32 *picker)
{
}
static void
gtk_color_picker_win32_class_init (GtkColorPickerWin32Class *class)
{
}
GtkColorPicker *
gtk_color_picker_win32_new (void)
{
return GTK_COLOR_PICKER (g_initable_new (GTK_TYPE_COLOR_PICKER_WIN32, NULL, NULL, NULL));
}
static void
on_task_completed (GObject *object,
GParamSpec *pspec,
gpointer user_data)
{
gpointer source = g_task_get_source_object (G_TASK (object));
GtkColorPickerWin32 *picker = GTK_COLOR_PICKER_WIN32 (source);
g_clear_object (&picker->task);
}
static void
pick_color (GTask *task,
gpointer source_object,
gpointer task_data,
GCancellable *cancellable)
{
GtkColorPickerWin32 *picker = GTK_COLOR_PICKER_WIN32 (source_object);
GdkRGBA rgba = (GdkRGBA) { 1.0, 1.0, 1.0, 1.0 };
HDC hdc = GetDC(HWND_DESKTOP);
if (hdc)
{
COLORREF color = GetPixel(hdc, picker->point.x, picker->point.y);
rgba = (GdkRGBA){
(double) GetRValue (color) / 255.0,
(double) GetGValue (color) / 255.0,
(double) GetBValue (color) / 255.0,
1.0,
};
ReleaseDC (HWND_DESKTOP, hdc);
}
g_task_return_pointer (task,
gdk_rgba_copy (&rgba),
(GDestroyNotify) gdk_rgba_free);
}
static void
picked (GtkColorPickerWin32 *picker)
{
g_task_run_in_thread (picker->task, pick_color);
}
static LRESULT CALLBACK
mouse_proc (int nCode,
WPARAM wParam,
LPARAM lParam)
{
if (nCode == HC_ACTION)
{
MSLLHOOKSTRUCT *info = (MSLLHOOKSTRUCT*) lParam;
switch (wParam)
{
case WM_LBUTTONDOWN:
case WM_MBUTTONDOWN:
case WM_RBUTTONDOWN:
case WM_XBUTTONDOWN:
{
GtkColorPickerWin32 *picker = GTK_COLOR_PICKER_WIN32 (pickers->data);
if (!pickers)
break;
/* A low-level mouse hook always receives screen points in
* per-monitor DPI aware screen coordinates, regardless of
* the DPI awareness setting of the application. */
picker->point = info->pt;
picked (picker);
pickers = g_list_delete_link (pickers, pickers);
/* It's safe to remove a hook from within its callback */
if (!pickers)
remove_hook ();
return 1;
}
break;
default:
break;
}
}
return CallNextHookEx(NULL, nCode, wParam, lParam);
}
static gboolean
ensure_mouse_hook (void)
{
if (!hook)
{
hook = SetWindowsHookEx (WH_MOUSE_LL, mouse_proc, this_hmodule, 0);
if (!hook)
{
g_warning ("SetWindowsHookEx failed with error code "
"%"G_GUINT32_FORMAT, (unsigned) GetLastError ());
return FALSE;
}
}
return TRUE;
}
static void
remove_hook (void)
{
if (hook)
{
UnhookWindowsHookEx (hook);
hook = NULL;
}
}
static void
gtk_color_picker_win32_pick (GtkColorPicker *cp,
GAsyncReadyCallback callback,
gpointer user_data)
{
GtkColorPickerWin32 *picker = GTK_COLOR_PICKER_WIN32 (cp);
if (picker->task)
return;
picker->task = g_task_new (picker, NULL, callback, user_data);
g_task_set_name (picker->task, "GtkColorPicker");
g_signal_connect (picker->task, "notify::completed",
G_CALLBACK (on_task_completed),
NULL);
if (!ensure_mouse_hook ())
{
g_task_return_new_error (picker->task,
G_IO_ERROR,
G_IO_ERROR_FAILED,
"Cannot capture the mouse pointer");
return;
}
pickers = g_list_prepend (pickers, cp);
}
static GdkRGBA *
gtk_color_picker_win32_pick_finish (GtkColorPicker *cp,
GAsyncResult *res,
GError **error)
{
g_return_val_if_fail (g_task_is_valid (res, cp), NULL);
return g_task_propagate_pointer (G_TASK (res), error);
}
static void
gtk_color_picker_win32_iface_init (GtkColorPickerInterface *iface)
{
iface->pick = gtk_color_picker_win32_pick;
iface->pick_finish = gtk_color_picker_win32_pick_finish;
}
+41
View File
@@ -0,0 +1,41 @@
/*
* GTK - The GIMP Toolkit
* Copyright (C) 2022 the GTK team
* All rights reserved.
*
* This Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This Library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GTK_COLOR_PICKER_WIN32_H__
#define __GTK_COLOR_PICKER_WIN32_H__
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif
#include <gtk/gtkcolorpickerprivate.h>
G_BEGIN_DECLS
#define GTK_TYPE_COLOR_PICKER_WIN32 gtk_color_picker_win32_get_type ()
G_DECLARE_FINAL_TYPE (GtkColorPickerWin32, gtk_color_picker_win32, GTK, COLOR_PICKER_WIN32, GObject)
GDK_AVAILABLE_IN_ALL
GtkColorPicker * gtk_color_picker_win32_new (void);
G_END_DECLS
#endif /* __GTK_COLOR_PICKER_WIN32_H__ */
+15 -4
View File
@@ -376,17 +376,24 @@ static int
gtk_column_view_allocate_columns (GtkColumnView *self,
int width)
{
gboolean rtl;
guint i, n;
int x;
int total_width, x;
GtkRequestedSize *sizes;
rtl = gtk_widget_get_direction (GTK_WIDGET (self)) == GTK_TEXT_DIR_RTL;
n = g_list_model_get_n_items (G_LIST_MODEL (self->columns));
sizes = g_newa (GtkRequestedSize, n);
gtk_column_view_distribute_width (self, width, sizes);
x = 0;
total_width = 0;
for (i = 0; i < n; i++)
total_width += sizes[i].minimum_size;
x = rtl ? total_width : 0;
for (i = 0; i < n; i++)
{
GtkColumnViewColumn *column;
@@ -397,17 +404,21 @@ gtk_column_view_allocate_columns (GtkColumnView *self,
{
col_size = sizes[i].minimum_size;
if (rtl)
x -= col_size;
gtk_column_view_column_allocate (column, x, col_size);
if (self->in_column_reorder && i == self->drag_pos)
gtk_column_view_column_set_header_position (column, self->drag_x);
x += col_size;
if (!rtl)
x += col_size;
}
g_object_unref (column);
}
return x;
return total_width;
}
static void
+22 -30
View File
@@ -28,7 +28,7 @@
#define GTK_COMPOSE_TABLE_MAGIC "GtkComposeTable"
#define GTK_COMPOSE_TABLE_VERSION (3)
#define GTK_COMPOSE_TABLE_VERSION (4)
extern const GtkComposeTable builtin_compose_table;
@@ -504,12 +504,6 @@ parser_remove_duplicates (GtkComposeParser *parser)
goto next;
}
if (sequence[1] == 0)
{
remove_sequence = TRUE;
goto next;
}
for (i = 0; i < MAX_COMPOSE_LEN + 1; i++)
keysyms[i] = 0;
@@ -907,7 +901,7 @@ parser_get_compose_table (GtkComposeParser *parser)
(GCompareDataFunc) sequence_compare,
NULL);
index_rowstride = max_compose_len + 1;
index_rowstride = max_compose_len + 2;
data = g_new0 (guint16, n_first * index_rowstride + size);
char_data = g_string_new ("");
@@ -923,7 +917,7 @@ parser_get_compose_table (GtkComposeParser *parser)
char *value = g_hash_table_lookup (parser->sequences, sequence);
int len = sequence_length (sequence);
g_assert (2 <= len && len <= max_compose_len);
g_assert (1 <= len && len <= max_compose_len);
/* Encode the value. If the value is a single
* character with a value smaller than 1 << 15,
@@ -979,10 +973,10 @@ parser_get_compose_table (GtkComposeParser *parser)
rest_pos += len;
for (i = len; i <= max_compose_len; i++)
for (i = len + 1; i < index_rowstride; i++)
data[first_pos + i] = rest_pos;
for (i = 1; i < max_compose_len; i++)
for (i = 1; i + 1 < index_rowstride; i++)
g_assert (data[first_pos + i] <= data[first_pos + i + 1]);
}
@@ -1275,7 +1269,7 @@ gtk_compose_table_check (const GtkComposeTable *table,
gboolean *compose_match,
GString *output)
{
int row_stride;
int len;
guint16 *seq_index;
guint16 *seq;
int i;
@@ -1297,7 +1291,7 @@ gtk_compose_table_check (const GtkComposeTable *table,
seq_index = bsearch (compose_buffer,
table->data,
table->n_index_size,
sizeof (guint16) * (table->max_seq_len + 1),
sizeof (guint16) * (table->max_seq_len + 2),
compare_seq_index);
if (!seq_index)
@@ -1312,21 +1306,21 @@ gtk_compose_table_check (const GtkComposeTable *table,
for (i = n_compose - 1; i < table->max_seq_len; i++)
{
row_stride = i + 1;
len = i + 1;
if (seq_index[i + 1] - seq_index[i] > 0)
if (seq_index[len + 1] - seq_index[len] > 0)
{
seq = bsearch (compose_buffer + 1,
table->data + seq_index[i],
(seq_index[i + 1] - seq_index[i]) / row_stride,
sizeof (guint16) * row_stride,
table->data + seq_index[len],
(seq_index[len + 1] - seq_index[len]) / len,
sizeof (guint16) * len,
compare_seq);
if (seq)
{
if (i == n_compose - 1)
{
value = seq[row_stride - 1];
value = seq[len - 1];
if ((value & (1 << 15)) != 0)
g_string_append (output, &table->char_data[value & ~(1 << 15)]);
@@ -1367,7 +1361,7 @@ gtk_compose_table_get_prefix (const GtkComposeTable *table,
int n_compose,
int *prefix)
{
int index_stride = table->max_seq_len + 1;
int index_stride = table->max_seq_len + 2;
int p = 0;
for (int idx = 0; idx < table->n_index_size; idx++)
@@ -1378,9 +1372,9 @@ gtk_compose_table_get_prefix (const GtkComposeTable *table,
{
p = 1;
for (int i = 1; i < table->max_seq_len; i++)
for (int i = 1; i < table->max_seq_len + 1; i++)
{
int len = i + 1;
int len = i;
for (int j = seq_index[i]; j < seq_index[i + 1]; j += len)
{
@@ -1407,20 +1401,20 @@ gtk_compose_table_foreach (const GtkComposeTable *table,
GtkComposeSequenceCallback callback,
gpointer data)
{
int index_stride = table->max_seq_len + 1;
int index_stride = table->max_seq_len + 2;
gunichar *sequence;
int seqno;
sequence = g_new0 (gunichar, table->max_seq_len + 1);
sequence = g_newa (gunichar, table->max_seq_len + 1);
seqno = 0;
for (int idx = 0; idx < table->n_index_size; idx++)
{
const guint16 *seq_index = table->data + (idx * index_stride);
for (int i = 1; i < table->max_seq_len; i++)
for (int i = 1; i <= table->max_seq_len; i++)
{
int len = i + 1;
int len = i;
g_assert (seq_index[i] <= seq_index[i + 1]);
g_assert (seq_index[i + 1] <= table->data_size);
@@ -1433,8 +1427,8 @@ gtk_compose_table_foreach (const GtkComposeTable *table,
char *value;
sequence[0] = seq_index[0];
for (int k = 0; k < len - 1; k++)
sequence[k + 1] = (gunichar) table->data[j + k];
for (int k = 1; k < len; k++)
sequence[k] = (gunichar) table->data[j + k - 1];
sequence[len] = 0;
encoded_value = table->data[j + len - 1];
@@ -1456,8 +1450,6 @@ gtk_compose_table_foreach (const GtkComposeTable *table,
}
}
}
g_free (sequence);
}
/* Checks if a keysym is a dead key.
+1 -1
View File
@@ -40,7 +40,7 @@ typedef struct _GtkComposeTableCompact GtkComposeTableCompact;
*
* The values are encoded as follows:
*
* If the value is a single Unicode character smaler than 0x8000,
* If the value is a single Unicode character smaller than 0x8000,
* then we place it directly. Otherwise, we put the UTF8-encoded
* value in the char_data array, and use offset | 0x8000 as the
* encoded value.
-30
View File
@@ -28,7 +28,6 @@
typedef enum {
COLOR_TYPE_LITERAL,
COLOR_TYPE_NAME,
COLOR_TYPE_SHADE,
COLOR_TYPE_ALPHA,
COLOR_TYPE_MIX,
@@ -69,9 +68,6 @@ gtk_css_value_color_free (GtkCssValue *color)
switch (color->type)
{
case COLOR_TYPE_NAME:
g_free (color->sym_col.name);
break;
case COLOR_TYPE_SHADE:
_gtk_css_value_unref (color->sym_col.shade.color);
break;
@@ -187,8 +183,6 @@ gtk_css_value_color_equal (const GtkCssValue *value1,
{
case COLOR_TYPE_LITERAL:
return gdk_rgba_equal (&value1->sym_col.rgba, &value2->sym_col.rgba);
case COLOR_TYPE_NAME:
return g_str_equal (value1->sym_col.name, value2->sym_col.name);
case COLOR_TYPE_SHADE:
return value1->sym_col.shade.factor == value2->sym_col.shade.factor &&
_gtk_css_value_equal (value1->sym_col.shade.color,
@@ -233,10 +227,6 @@ gtk_css_value_color_print (const GtkCssValue *value,
g_free (s);
}
break;
case COLOR_TYPE_NAME:
g_string_append (string, "@");
g_string_append (string, value->sym_col.name);
break;
case COLOR_TYPE_SHADE:
{
char factor[G_ASCII_DTOSTR_BUF_SIZE];
@@ -359,26 +349,7 @@ _gtk_css_color_value_resolve (GtkCssValue *color,
{
case COLOR_TYPE_LITERAL:
return _gtk_css_value_ref (color);
case COLOR_TYPE_NAME:
{
GtkCssValue *named;
GSList cycle = { color, cycle_list };
/* If color exists in cycle_list, we're currently resolving it.
* So we've detected a cycle. */
if (g_slist_find (cycle_list, color))
return NULL;
named = gtk_style_provider_get_color (provider, color->sym_col.name);
if (named == NULL)
return NULL;
value = _gtk_css_color_value_resolve (named, provider, current, &cycle);
if (value == NULL)
return NULL;
}
break;
case COLOR_TYPE_SHADE:
{
const GdkRGBA *c;
@@ -529,7 +500,6 @@ _gtk_css_color_value_new_name (const char *name)
gtk_internal_return_val_if_fail (name != NULL, NULL);
value = _gtk_css_value_new (GtkCssValue, &GTK_CSS_VALUE_COLOR);
value->type = COLOR_TYPE_NAME;
value->sym_col.name = g_strdup (name);
return value;
+7 -2
View File
@@ -28,6 +28,7 @@
static GtkCssValue * gtk_css_calc_value_new (guint n_terms);
static GtkCssValue * gtk_css_calc_value_new_sum (GtkCssValue *a,
GtkCssValue *b);
static gsize gtk_css_value_calc_get_size (gsize n_terms);
enum {
TYPE_CALC = 0,
@@ -78,9 +79,13 @@ gtk_css_value_number_free (GtkCssValue *number)
for (guint i = 0; i < n_terms; i++)
_gtk_css_value_unref (number->calc.terms[i]);
}
g_slice_free (GtkCssValue, number);
g_slice_free1 (gtk_css_value_calc_get_size (n_terms), number);
}
else
{
g_slice_free (GtkCssValue, number);
}
}
static double
-79
View File
@@ -127,7 +127,6 @@ struct _GtkCssProviderPrivate
{
GScanner *scanner;
GHashTable *symbolic_colors;
GHashTable *keyframes;
GArray *rulesets;
@@ -395,9 +394,6 @@ gtk_css_provider_init (GtkCssProvider *css_provider)
priv->rulesets = g_array_new (FALSE, FALSE, sizeof (GtkCssRuleset));
priv->symbolic_colors = g_hash_table_new_full (g_str_hash, g_str_equal,
(GDestroyNotify) g_free,
(GDestroyNotify) _gtk_css_value_unref);
priv->keyframes = g_hash_table_new_full (g_str_hash, g_str_equal,
(GDestroyNotify) g_free,
(GDestroyNotify) _gtk_css_keyframes_unref);
@@ -440,16 +436,6 @@ verify_tree_match_results (GtkCssProvider *provider,
#endif
}
static GtkCssValue *
gtk_css_style_provider_get_color (GtkStyleProvider *provider,
const char *name)
{
GtkCssProvider *css_provider = GTK_CSS_PROVIDER (provider);
GtkCssProviderPrivate *priv = gtk_css_provider_get_instance_private (css_provider);
return g_hash_table_lookup (priv->symbolic_colors, name);
}
static GtkCssKeyframes *
gtk_css_style_provider_get_keyframes (GtkStyleProvider *provider,
const char *name)
@@ -515,7 +501,6 @@ gtk_css_style_provider_lookup (GtkStyleProvider *provider,
static void
gtk_css_style_provider_iface_init (GtkStyleProviderInterface *iface)
{
iface->get_color = gtk_css_style_provider_get_color;
iface->get_keyframes = gtk_css_style_provider_get_keyframes;
iface->lookup = gtk_css_style_provider_lookup;
iface->emit_error = gtk_css_style_provider_emit_error;
@@ -534,7 +519,6 @@ gtk_css_provider_finalize (GObject *object)
g_array_free (priv->rulesets, TRUE);
_gtk_css_selector_tree_free (priv->tree);
g_hash_table_destroy (priv->symbolic_colors);
g_hash_table_destroy (priv->keyframes);
if (priv->resource)
@@ -607,7 +591,6 @@ gtk_css_provider_reset (GtkCssProvider *css_provider)
priv->path = NULL;
}
g_hash_table_remove_all (priv->symbolic_colors);
g_hash_table_remove_all (priv->keyframes);
for (i = 0; i < priv->rulesets->len; i++)
@@ -688,41 +671,6 @@ parse_import (GtkCssScanner *scanner)
return TRUE;
}
static gboolean
parse_color_definition (GtkCssScanner *scanner)
{
GtkCssProviderPrivate *priv = gtk_css_provider_get_instance_private (scanner->provider);
GtkCssValue *color;
char *name;
if (!gtk_css_parser_try_at_keyword (scanner->parser, "define-color"))
return FALSE;
name = gtk_css_parser_consume_ident (scanner->parser);
if (name == NULL)
return TRUE;
color = _gtk_css_color_value_parse (scanner->parser);
if (color == NULL)
{
g_free (name);
return TRUE;
}
if (!gtk_css_parser_has_token (scanner->parser, GTK_CSS_TOKEN_EOF))
{
g_free (name);
_gtk_css_value_unref (color);
gtk_css_parser_error_syntax (scanner->parser,
"Missing semicolon at end of color definition");
return TRUE;
}
g_hash_table_insert (priv->symbolic_colors, name, color);
return TRUE;
}
static gboolean
parse_keyframes (GtkCssScanner *scanner)
{
@@ -761,7 +709,6 @@ parse_at_keyword (GtkCssScanner *scanner)
gtk_css_parser_start_semicolon_block (scanner->parser, GTK_CSS_TOKEN_OPEN_CURLY);
if (!parse_import (scanner) &&
!parse_color_definition (scanner) &&
!parse_keyframes (scanner))
{
gtk_css_parser_error_syntax (scanner->parser, "Unknown @ rule");
@@ -1458,31 +1405,6 @@ gtk_css_ruleset_print (const GtkCssRuleset *ruleset,
g_string_append (str, "}\n");
}
static void
gtk_css_provider_print_colors (GHashTable *colors,
GString *str)
{
GList *keys, *walk;
keys = g_hash_table_get_keys (colors);
/* so the output is identical for identical styles */
keys = g_list_sort (keys, (GCompareFunc) strcmp);
for (walk = keys; walk; walk = walk->next)
{
const char *name = walk->data;
GtkCssValue *color = g_hash_table_lookup (colors, (gpointer) name);
g_string_append (str, "@define-color ");
g_string_append (str, name);
g_string_append (str, " ");
_gtk_css_value_print (color, str);
g_string_append (str, ";\n");
}
g_list_free (keys);
}
static void
gtk_css_provider_print_keyframes (GHashTable *keyframes,
GString *str)
@@ -1535,7 +1457,6 @@ gtk_css_provider_to_string (GtkCssProvider *provider)
str = g_string_new ("");
gtk_css_provider_print_colors (priv->symbolic_colors, str);
gtk_css_provider_print_keyframes (priv->keyframes, str);
for (i = 0; i < priv->rulesets->len; i++)
+1
View File
@@ -287,6 +287,7 @@ gtk_css_transform_compute (GtkCssTransform *dest,
switch (src->type)
{
case GTK_CSS_TRANSFORM_MATRIX:
memcpy (dest, src, sizeof (GtkCssTransform));
return TRUE;
case GTK_CSS_TRANSFORM_TRANSLATE:
dest->translate.x = _gtk_css_value_compute (src->translate.x, property_id, provider, style, parent_style);
+16 -16
View File
@@ -208,6 +208,21 @@ gtk_drop_target_end_drop (GtkDropTarget *self)
g_object_thaw_notify (G_OBJECT (self));
}
static GdkDragAction
make_action_unique (GdkDragAction actions)
{
if (actions & GDK_ACTION_COPY)
return GDK_ACTION_COPY;
if (actions & GDK_ACTION_MOVE)
return GDK_ACTION_MOVE;
if (actions & GDK_ACTION_LINK)
return GDK_ACTION_LINK;
return 0;
}
static void
gtk_drop_target_do_drop (GtkDropTarget *self)
{
@@ -219,7 +234,7 @@ gtk_drop_target_do_drop (GtkDropTarget *self)
g_signal_emit (self, signals[DROP], 0, &self->value, self->coords.x, self->coords.y, &success);
if (success)
gdk_drop_finish (self->drop, gdk_drop_get_actions (self->drop));
gdk_drop_finish (self->drop, make_action_unique (self->actions & gdk_drop_get_actions (self->drop)));
else
gdk_drop_finish (self->drop, 0);
@@ -348,21 +363,6 @@ gtk_drop_target_accept (GtkDropTarget *self,
return gdk_content_formats_match_gtype (self->formats, gdk_drop_get_formats (drop)) != G_TYPE_INVALID;
}
static GdkDragAction
make_action_unique (GdkDragAction actions)
{
if (actions & GDK_ACTION_COPY)
return GDK_ACTION_COPY;
if (actions & GDK_ACTION_MOVE)
return GDK_ACTION_MOVE;
if (actions & GDK_ACTION_LINK)
return GDK_ACTION_LINK;
return 0;
}
static GdkDragAction
gtk_drop_target_enter (GtkDropTarget *self,
double x,
+110 -52
View File
@@ -1042,6 +1042,34 @@ gtk_emoji_chooser_show (GtkWidget *widget)
gtk_editable_set_text (GTK_EDITABLE (chooser->search_entry), "");
}
static EmojiSection *
find_section (GtkEmojiChooser *chooser,
GtkWidget *box)
{
if (box == chooser->recent.box)
return &chooser->recent;
else if (box == chooser->people.box)
return &chooser->people;
else if (box == chooser->body.box)
return &chooser->body;
else if (box == chooser->nature.box)
return &chooser->nature;
else if (box == chooser->food.box)
return &chooser->food;
else if (box == chooser->travel.box)
return &chooser->travel;
else if (box == chooser->activities.box)
return &chooser->activities;
else if (box == chooser->objects.box)
return &chooser->objects;
else if (box == chooser->symbols.box)
return &chooser->symbols;
else if (box == chooser->flags.box)
return &chooser->flags;
else
return NULL;
}
static EmojiSection *
find_next_section (GtkEmojiChooser *chooser,
GtkWidget *box,
@@ -1113,81 +1141,111 @@ keynav_failed (GtkWidget *box,
GtkWidget *focus;
GtkWidget *child;
GtkWidget *sibling;
GtkAllocation alloc;
int i;
int column;
int n_columns = 7;
int child_x;
focus = gtk_root_get_focus (gtk_widget_get_root (box));
if (focus == NULL)
return FALSE;
/* determine the number of columns */
child_x = -1;
for (i = 0; i < 20; i++)
{
GtkAllocation alloc;
gtk_widget_get_allocation (GTK_WIDGET (gtk_flow_box_get_child_at_index (GTK_FLOW_BOX (box), i)),
&alloc);
if (alloc.x > child_x)
child_x = alloc.x;
else
{
n_columns = i;
break;
}
}
n_columns = MAX (n_columns, 1);
child = gtk_widget_get_ancestor (focus, GTK_TYPE_EMOJI_CHOOSER_CHILD);
i = 0;
column = 0;
child_x = G_MAXINT;
for (sibling = gtk_widget_get_first_child (box);
sibling != child;
sibling;
sibling = gtk_widget_get_next_sibling (sibling))
i++;
{
if (!gtk_widget_get_child_visible (sibling))
continue;
column = i % n_columns;
gtk_widget_get_allocation (sibling, &alloc);
if (alloc.x < child_x)
column = 0;
else
column++;
child_x = alloc.x;
if (sibling == child)
break;
}
if (direction == GTK_DIR_DOWN)
{
next = find_next_section (chooser, box, TRUE);
if (next == NULL)
return FALSE;
i = 0;
for (sibling = gtk_widget_get_first_child (next->box);
sibling;
sibling = gtk_widget_get_next_sibling (sibling), i++)
{
next = find_section (chooser, box);
while (TRUE)
{
if (i == column)
next = find_next_section (chooser, next->box, TRUE);
if (next == NULL)
return FALSE;
i = 0;
child_x = G_MAXINT;
for (sibling = gtk_widget_get_first_child (next->box);
sibling;
sibling = gtk_widget_get_next_sibling (sibling))
{
gtk_widget_grab_focus (sibling);
return TRUE;
if (!gtk_widget_get_child_visible (sibling))
continue;
gtk_widget_get_allocation (sibling, &alloc);
if (alloc.x < child_x)
i = 0;
else
i++;
child_x = alloc.x;
if (i == column)
{
gtk_widget_grab_focus (sibling);
return TRUE;
}
}
}
}
else if (direction == GTK_DIR_UP)
{
next = find_next_section (chooser, box, FALSE);
if (next == NULL)
return FALSE;
next = find_section (chooser, box);
while (TRUE)
{
next = find_next_section (chooser, next->box, FALSE);
if (next == NULL)
return FALSE;
i = 0;
child = NULL;
for (sibling = gtk_widget_get_first_child (next->box);
sibling;
sibling = gtk_widget_get_next_sibling (sibling), i++)
{
if ((i % n_columns) == column)
child = sibling;
}
if (child)
{
gtk_widget_grab_focus (child);
return TRUE;
i = 0;
child_x = G_MAXINT;
child = NULL;
for (sibling = gtk_widget_get_first_child (next->box);
sibling;
sibling = gtk_widget_get_next_sibling (sibling))
{
if (!gtk_widget_get_child_visible (sibling))
continue;
gtk_widget_get_allocation (sibling, &alloc);
if (alloc.x < child_x)
i = 0;
else
i++;
child_x = alloc.x;
if (i == column)
child = sibling;
}
if (child)
{
gtk_widget_grab_focus (child);
return TRUE;
}
}
}
+2 -2
View File
@@ -2050,12 +2050,12 @@ connect_completion_signals (GtkEntryCompletion *completion)
GtkEntryBuffer *buffer = gtk_text_get_buffer (text);
controller = completion->entry_key_controller = gtk_event_controller_key_new ();
gtk_event_controller_set_name (controller, "gtk-entry-completion");
gtk_event_controller_set_static_name (controller, "gtk-entry-completion");
g_signal_connect (controller, "key-pressed",
G_CALLBACK (gtk_entry_completion_key_pressed), completion);
gtk_widget_add_controller (GTK_WIDGET (text), controller);
controller = completion->entry_focus_controller = gtk_event_controller_focus_new ();
gtk_event_controller_set_name (controller, "gtk-entry-completion");
gtk_event_controller_set_static_name (controller, "gtk-entry-completion");
g_signal_connect_swapped (controller, "leave", G_CALLBACK (text_focus_out), completion);
gtk_widget_add_controller (GTK_WIDGET (text), controller);
+29
View File
@@ -110,6 +110,35 @@ typedef enum
GTK_BASELINE_POSITION_BOTTOM
} GtkBaselinePosition;
/**
* GtkContentFit:
* @GTK_CONTENT_FIT_FILL: Make the content fill the entire allocation,
* without taking its aspect ratio in consideration. The resulting
* content will appear as stretched if its aspect ratio is different
* from the allocation aspect ratio.
* @GTK_CONTENT_FIT_CONTAIN: Scale the content to fit the allocation,
* while taking its aspect ratio in consideration. The resulting
* content will appear as letterboxed if its aspect ratio is different
* from the allocation aspect ratio.
* @GTK_CONTENT_FIT_COVER: Cover the entire allocation, while taking
* the content aspect ratio in consideration. The resulting content
* will appear as clipped if its aspect ratio is different from the
* allocation aspect ratio.
* @GTK_CONTENT_FIT_SCALE_DOWN: The content is scaled down to fit the
* allocation, if needed, otherwise its original size is used.
*
* Controls how a content should be made to fit inside an allocation.
*
* Since: 4.8
*/
typedef enum
{
GTK_CONTENT_FIT_FILL,
GTK_CONTENT_FIT_CONTAIN,
GTK_CONTENT_FIT_COVER,
GTK_CONTENT_FIT_SCALE_DOWN,
} GtkContentFit;
/**
* GtkDeleteType:
* @GTK_DELETE_CHARS: Delete characters.
+30 -3
View File
@@ -66,6 +66,7 @@ struct _GtkEventControllerPrivate
char *name;
GtkWidget *target;
GdkEvent *event;
unsigned int name_is_static : 1;
};
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GtkEventController, gtk_event_controller, G_TYPE_OBJECT)
@@ -173,8 +174,9 @@ gtk_event_controller_finalize (GObject *object)
{
GtkEventController *self = GTK_EVENT_CONTROLLER (object);
GtkEventControllerPrivate *priv = gtk_event_controller_get_instance_private (self);
g_free (priv->name);
if (!priv->name_is_static)
g_free (priv->name);
G_OBJECT_CLASS (gtk_event_controller_parent_class)->finalize (object);
}
@@ -571,8 +573,33 @@ gtk_event_controller_set_name (GtkEventController *controller,
g_return_if_fail (GTK_IS_EVENT_CONTROLLER (controller));
g_free (priv->name);
if (!priv->name_is_static)
g_free (priv->name);
priv->name = g_strdup (name);
priv->name_is_static = FALSE;
}
/**
* gtk_event_controller_set_static_name:
* @controller: a `GtkEventController`
* @name: (nullable): a name for @controller, must be a static string
*
* Sets a name on the controller that can be used for debugging.
*
* Since: 4.8
*/
void
gtk_event_controller_set_static_name (GtkEventController *controller,
const char *name)
{
GtkEventControllerPrivate *priv = gtk_event_controller_get_instance_private (controller);
g_return_if_fail (GTK_IS_EVENT_CONTROLLER (controller));
if (!priv->name_is_static)
g_free (priv->name);
priv->name = (char *)name;
priv->name_is_static = TRUE;
}
GtkWidget *

Some files were not shown because too many files have changed in this diff Show More