Compare commits

...

218 Commits

Author SHA1 Message Date
Emin Tufan Çetin 9d60d2f788 Update Turkish translation 2023-01-11 07:19:24 +00:00
Goran Vidović c49a4cca55 Update Croatian translation 2022-09-30 12:11:58 +00:00
Balázs Úr c73d106200 Update Hungarian translation 2022-09-18 06:30:00 +00:00
Balázs Úr 1503e29f8a Update Hungarian translation 2022-09-02 21:41:07 +00:00
Matthias Clasen 120edb93a9 Merge branch 'alatiera/stable-wraps' into 'gtk-4-4'
meson: switch some .wrap files to stable branches

See merge request GNOME/gtk!4579
2022-03-19 12:27:02 +00:00
Jordan Petridis 77c9240982 meson: switch some .wrap files to stable branches
To avoid random failures if one of the projects starts
depending on new things or has incompatible changes.
2022-03-19 09:16:44 +02:00
Matthias Clasen 43c9822aa7 Fix build with wayland-protocols subproject
The missing files() was pointed out in #4530.

Fixes: #4530
2022-03-19 09:16:44 +02:00
Matthias Clasen 64a2c11178 ci: Use the v34 Fedora image
The v33 one was dropped from the registry.
2022-03-17 14:23:27 -04:00
Matthias Clasen 5f2e8e864d 4.4.2 2022-03-17 13:09:38 -04:00
Balázs Úr 388f0fddbd Update Hungarian translation 2022-03-11 01:13:46 +00:00
Sveinn í Felli 01202d42ee Update Icelandic translation 2022-01-30 21:14:16 +00:00
Sveinn í Felli 1ea83021a3 Update Icelandic translation 2022-01-30 19:49:09 +00:00
sicklylife 2b54632ebf Update Japanese translation 2022-01-30 15:25:00 +00:00
sicklylife ad7746360b Update Japanese translation 2022-01-30 15:12:51 +00:00
Sveinn í Felli 885c2d0427 Update Icelandic translation 2022-01-29 13:48:23 +00:00
Sveinn í Felli 9c823ce5b5 Update Icelandic translation 2022-01-29 12:35:51 +00:00
Christian Kirbach a46e7c33b8 Update German translation 2021-12-31 10:14:18 +00:00
Quentin PAGÈS 31287afcee Update Occitan translation 2021-12-03 16:19:07 +00:00
Quentin PAGÈS 88ac222ffe Update Occitan translation 2021-12-03 16:12:58 +00:00
Emmanuele Bassi e00bfd5442 Update placeholder visibility when setting a buffer
If we set the placeholder text before setting a buffer, we end up with
both the placeholder *and* the buffer's contents visible at the same
time.

See: GNOME/gtk#4376

(cherry picked from commit b57b12fdb7)

Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
2021-12-02 20:25:16 +00:00
Quentin PAGÈS ebdabc5e87 Update Occitan translation 2021-11-30 17:04:50 +00:00
Quentin PAGÈS db9bb17b7d Update Occitan translation 2021-11-25 15:50:21 +00:00
Luca Bacci e947fe9675 Merge branch 'backport-mr-4104-to-gtk-4-4' into 'gtk-4-4'
Backport "GdkWin32: Remove the global screen offset" to gtk-4-4

See merge request GNOME/gtk!4184
2021-11-22 11:52:56 +00:00
Luca Bacci efe5668f9a GdkWin32: Remove the global screen offset
Removes the _gdk_offset_x / _gdk_offset_y variables,
as today are not needed anymore.
2021-11-21 14:59:39 +01:00
Luca Bacci d0ae410ca7 GdkWin32: Use a signed integral type for the DPI scale 2021-11-21 14:22:44 +01:00
Christian Kirbach b3840c6a0d Update German translation 2021-11-19 21:07:35 +00:00
Matthias Clasen 34ed130fab Merge branch 'docs-typos' into 'gtk-4-4'
docs: Fix up some typos

See merge request GNOME/gtk!4146
2021-11-10 20:35:34 +00:00
Matthias Clasen bfa2b7ff68 Merge branch 'no-werror-on-stable' into 'gtk-4-4'
ci: Turn off -Werror on stable branches

See merge request GNOME/gtk!4147
2021-11-10 19:34:29 +00:00
Emmanuele Bassi 2fb975b22e docs: Fix typo in link 2021-11-10 13:51:08 -05:00
Emmanuele Bassi d64f9360c3 docs: Fix wrong fragments in type links
Due to a bug in gi-docgen we're not getting a warning if a fragment to a
type does not match the actual type, and we're generating a broken link.

See: https://gitlab.gnome.org/GNOME/gi-docgen/-/merge_requests/120
2021-11-10 13:49:24 -05:00
Marco Melorio 2d75485c24 docs: Tag Gdk.ModifierType as flags 2021-11-10 13:48:43 -05:00
Matthias Clasen 89e2b98ff4 ci: Turn off -Werror on stable branches
Otherwise we incur build failures such as the
recent one from new Pango api.
2021-11-10 13:37:04 -05:00
Matthias Clasen 5d158f583c Merge branch 'pango-api-4-4' into 'gtk-4-4'
Handle (and ignore) new Pango api

See merge request GNOME/gtk!4145
2021-11-10 17:31:48 +00:00
Benjamin Otte 106d35f2f4 Merge branch 'cherry-pick-0903ad48' into 'gtk-4-4'
css: Don't crash when color stop offsets descend

See merge request GNOME/gtk!4144
2021-11-10 17:15:41 +00:00
Matthias Clasen c09e7fabc8 Handle (and ignore) new Pango api
The PangoVariant enumeration grew some new
members. Ignore them.
2021-11-10 12:07:41 -05:00
Benjamin Otte 481ab5cf49 Merge branch 'wip/otte/for-master' into 'master'
css: Don't crash when color stop offsets descend

Closes #4424

See merge request GNOME/gtk!4143

(cherry picked from commit 0903ad48f0)

46f8600b css: Don't crash when color stop offsets descend
2021-11-10 16:48:59 +00:00
Alexey Rubtsov ae1eb55271 Update Russian translation 2021-11-09 12:42:16 +00:00
Milo Casagrande 3eb1ca3ecb Update Italian translation 2021-11-09 08:52:14 +00:00
Milo Casagrande 4fa318fa19 Update Italian translation 2021-11-09 08:34:39 +00:00
Matthias Clasen 3090fbac82 4.4.1 2021-11-01 09:20:12 -04:00
Matthias Clasen 56e61fc645 NEWS: Updates 2021-10-31 18:23:10 -04:00
Maxim Zakharov f41d98d104 gtk: Hold reference on controller until events are fully handled
Fixes premature controller unreferencing in
gtk_event_controller_handle_event() if the controller itself is being
removed while handling the event.
2021-10-31 17:52:05 -04:00
Alexander Mikhaylenko b1943e03e6 levelbar: Fill the whole space for discrete level bars
Ideally this would be using box layout, but it overrides measure() so it's
not possible - so reimplement it instead. Fix an accidentally int division
along the way.
2021-10-31 17:52:05 -04:00
Christian Hergert 63583c15db macos: fix scale on macOS 12 beta
This is a port of the fix in the quartz backend to the new macOS backend.

From the original commit:

In macOS-12.sdk CGContextConverSizeToDeviceSpace returns a negative
height and passing that to CGContextScaleCTM in turn causes the cairo
surface to draw outside the window where it can't be seen. Passing the
absolute values of the scale factors fixes the display on macOS 12 without
affecting earlier macOS versions.
2021-10-31 17:52:05 -04:00
Chun-wei Fan 0028267228 tools/generate-uac-manifest.py: Fix UAC manifest .rc
The resource compiler in the Windows 11 SDK does not allow one to include
winuser.h directly in resource scripts (.rc) with a rather cryptic error
message, so fix generating the .rc file to embed the UAC manifest by including
windows.h with WIN32_LEAN_AND_MEAN instead.
2021-10-31 17:52:05 -04:00
Chun-wei Fan 9cdc332e8a gtk: Fix version resource on for Windows 11 SDK
The rc.exe that comes with the Windows 11 SDK does not allow one to include
winuser.h directly in the .rc scripts, so make sure that it is not included
by gtk-win32.rc.body.in, but instead include windows.h with WIN32_LEAN_AND_MEAN
defined.
2021-10-31 17:52:05 -04:00
Niels De Graef c0fc8f796b calendar: Add an explanatory comment
On the magic numbers used to get the abbreviated day names.
2021-10-31 17:52:04 -04:00
Niels De Graef 5a2f94b7ef calendar: Fix abbreviated day names
... if the current locale has a different starting day than Sunday.

This needed 2 fixes:
* We need to take into account `calendar->week_start` when
  creating/adding the appropriate `day_name_labels` field
* we were only calculating `calendar->week_start` _after_ attaching the
  `day_name_labels`, so it was still set to 0 (the default value).

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4338
2021-10-31 17:52:04 -04:00
Bastien Nocera 59dd0dccbf broadway: Quiet initialisation failures
Broadway is the only GTK+ backend that throws an error on stderr for a
"display server" connection failure.

This causes problems when gtk_init_check() is used and unexpected error
output is generated such as with hotdoc, which fails when generating a
GTK plugin's documentation instead of overlooking the issue.

"Unable to init server: Could not connect: Connection refused"
2021-10-31 17:52:04 -04:00
Bastien Nocera 78d5f16bf7 broadway: Quiet initialisation failures
Broadway is the only GTK+ backend that throws an error on stderr when
failing to initialise, which causes problems when gtk_init_check() is
used and unexpected error output is generated.

This causes hotdoc to fail when generating a GTK plugin's documentation
instead of failing quietly.

"Unable to init server: Could not connect: Connection refused"
2021-10-31 17:52:04 -04:00
David Edmundson faba065161 wayland: Mark opaque_region as dirty on hide
Otherwise if we hide and show a window we recreate a new surface,
breaking the compositor's association, but potentially not resend this
data for the new surface.
This matches what we do for input_region.
2021-10-31 17:52:04 -04:00
Matthias Clasen 19adb3b8b3 filechooserportal: Take a ref on transient-for
This may fix a crash that has been reported in
file_chooser_portal_data_free.

Fixes: #4314
2021-10-31 17:52:04 -04:00
Matthias Clasen 4c9c180e27 inspector: Export gtk_inspector_init
Quietly export this function mainly for the benefit
of libadwaita, which can can use this to install its
implementation of the gtk-inspector-page extension
point.
2021-10-31 17:52:04 -04:00
Pierre Ossman 41a662ad2a searchenginemodel: finalize search results
It is necessary to signal the search engine that we are finished and
that we found something for it to reliably show the results. It would
sometimes work anyway since it is sufficient if any backend signals
completion. However if GtkSearchEngineModel was the only backend
returning results then things would break.
2021-10-31 17:52:04 -04:00
Matthias Clasen c12d398fa2 contentdeserializer: Plug a small memleak
Found by asan in ci. We intern the mimetypes
when they are registered, so there is no need
to leak this string.
2021-10-31 17:52:04 -04:00
Matthias Clasen ca4bf8b0d1 a11y: Simplify atspi context a bit
We don't really need a bus-address property
that gets copied for every single object.
We keep the address in object data on the
display anyway. Just use it from there.

This gets rid of a nice amount of strdups
at startup.
2021-10-31 17:52:04 -04:00
Matthias Clasen 16c3864e4a docs: Mention popovers in the migration guide
Things have changed around popovers, we should mention
that.
2021-10-31 17:52:04 -04:00
Matthias Clasen 1fa97e1808 entry: Clarify docs
Mention that max length is in characters.
2021-10-31 17:52:04 -04:00
Matthias Clasen a107ebdc0d coloreditor: Don't unref unless we own it
Calling gtk_widget_class_bind_template_child does
*not* give you a reference that you need to unref.
It manages the reference for you. So calling
g_clear_object on such a member is wrong.
2021-10-31 17:52:04 -04:00
Matthias Clasen 161259e9ea builder: Don't leak refs
We sometimes end up setting an object on a GValue
that we are then not interested in. We need to
unset it, or we'll leak the ref.
2021-10-31 17:52:04 -04:00
Jordan Yelloz cc5a7b153d gtktextview: Fixed arrow key crash.
When pressing the keyboard arrows to move around when the insertion point is
hidden, it causes an assertion error in blink_cb.

Insertion point blinks should only be scheduled when blinking is enabled and the
insertion point is visible.

Closes #4275
2021-10-31 17:52:04 -04:00
Martin Kühl 0476b5a34c gtkcomposetable: Accept long replacement strings
This change removes the assertions limiting replacement strings in the compose table to be less than 20 characters.
The limit seems arbitrary, is not required, will break some users' setups, and problems with it result in applications not launching.

Fixes #4273
2021-10-31 17:52:04 -04:00
Lukáš Tyrychtr 4b25b43f83 Mention that after setting a button child the user is responsible for a11y relations 2021-10-31 17:52:04 -04:00
Matthias Clasen 0d94a4fcc8 resources: Treat svgs as xml
They can have their whitespace removed just the same.
2021-10-31 17:52:04 -04:00
Matthias Clasen bcf062a578 Clean up gesture icons
These had duplicate drawing in them, and were
saved with all the extra Inkscape data.
2021-10-31 17:52:04 -04:00
Timm Bäder 252ce5a5c7 stackswitcher: Expand child buttons
Fixes #4196
2021-10-31 17:52:04 -04:00
Georges Basile Stavracas Neto ac7bdabe95 filechooserwidget: Return an id in get_choice()
gtk_file_chooser_widget_get_choice() is supposed to return the option
id of the choice, but it currently is returning the option label.

Return the option id instead.
2021-10-31 17:52:04 -04:00
Georges Basile Stavracas Neto d94ebd469e filechooserwidget: Match choice id from "options"
When choices are added to the file chooser widget, the options of
that choice are stored object data under the "options" key. However,
gtk_file_chooser_widget_set_choice() was checking for "choices".

Retrieve the options from the "options" key stored data object data.
2021-10-31 17:52:04 -04:00
Matthias Clasen de17c618fc gsk: Add a test for transform_bounds 2021-10-31 17:52:04 -04:00
James Westman 1133bff614 gtkcolorbutton: Fix documentation 2021-10-31 17:52:04 -04:00
Benjamin Otte aa07cb4f64 testsuite: remove box-order test
The test used to test that GtkBox ordered it's children left-to-right in
CSS, no matter the text direction or pack-type.

But there is neither a pack-type anymore nor does GTK4 do that.

So that test has been broken for yers, it just didn't render anything
wrong.
2021-10-31 17:52:04 -04:00
muradm f99b35162c Do not require wayland-protocols as dependency in the .pc file
Basically, I was building some packages on Guix. I figured out that
wayland-protocols was listed among propagated-inputs for gtk+ package
(gtk-3-24). propagated-inputs holds a list of runtime dependencies,
that should be available to any other package that depends on gtk+.
While discussing we clarified that wayland-protocols is not runtime
dependency. So I moved it to native-inputs of gtk+ package, which
means that, this dependency will be available only to gtk+ package and
only at build time. Once moved, building of other applications that
depening on gtk+ started to fail.

Investigation showed that, all .pc (pkg-config) files prepared by gtk+
package, was including:

Requires.private: ... wayland-protocols ...

Since it becomes requirement, other applications was failing with
missing dependency wayland-protocols of dependency gtk+, for instance:

-- Checking for module 'gtk+-3.0'
--   Package 'wayland-protocols', required by 'gdk-3.0', not found

While actually wayland-protocols is not even a build time dependency
of application that depends on gtk+. Advertisement of such
requirement, is a bit misleading, because one does not need it at
runtime, especially applications based on gtk.
2021-10-31 17:52:04 -04:00
Jakub Steiner 3ae2ebac67 theme: make toggled tbuttons in toolbars visible
- do what Alex does in libadwaita

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4264
2021-10-31 17:52:04 -04:00
Matthias Clasen 4cf9f6382f Update the README
Remove the mention of GNU (since that has not been case
for a long time, effectively), state that GTK is hosted
by the GNOME project, and point to GNOME as a place
for donations.
2021-10-31 17:52:04 -04:00
Matthias Clasen 9ffb3e5ece testsuite: Call g_test_init in test binaries
Without it, we mess out on G_DEBUG=fatal-warnings,
so our ci does not alert us that we run a bunch of
tests which spit out warnings.
2021-10-31 17:52:04 -04:00
Lukáš Tyrychtr 72ffe46e74 Fix generation of accessible description in presence of described by relations
The loop going through the relation list should have stopped on the NULL sentinel value, however it never accesed the next list element.
2021-10-31 17:52:04 -04:00
Matthias Clasen f7b5c886b3 testsuite: Fix a few memory leaks
These are keeping the asan build in ci from passing.
2021-10-31 17:52:04 -04:00
Lukáš Tyrychtr 5b186fab1a Set correct accessible relations for GtkMenuButton
Up until now, as the focus was moved to the inner button, it was not possible for
assistive technologies to determine the correct labels and descriptions
because developers could set them only for the parent widget.
Now, the proper relations are added so the labels should be picked up properly.

Fixes #4254
2021-10-31 17:52:04 -04:00
Alexander Mikhaylenko d2c610148e media-controls: Make play button flat
Match the volume button.
2021-10-31 17:52:04 -04:00
Alexander Mikhaylenko 66ef08921d searchbar: Vertically center the close button 2021-10-31 17:52:04 -04:00
Julian Sparber 137a62cb94 stack: Dispose children before emitting items-changed
This makes sure that the `GListModel` returned by
`gtk_stack_get_pages()` actually has the items removed before
`items-changed` is emitted.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4255
2021-10-31 17:52:04 -04:00
Matthias Clasen 022b396a06 GtkApplication: Call setlocale early
If we don't call setlocale early enough,
--help output may come out misformatted.

Fixes: #4234
2021-10-31 17:52:04 -04:00
Matthias Clasen afb9378405 textview: Invalidate Pango contexts
We need to invalidate the Pango contexts when
font settings change. Use the new helper
gtk_widget_update_pango_context to make it less
likely that we forget to update some things.
2021-10-31 17:52:04 -04:00
Matthias Clasen abe7407abe widget: Provide a helper for updating pango contexts 2021-10-31 17:52:04 -04:00
Matthias Clasen 1038b94ab1 Rename an internal function
It occupies a name I want to reuse for something else.
2021-10-31 17:52:04 -04:00
Emmanuele Bassi 07381e2b14 Improve the gtk_accelerator_parse() docs
We need to escape the modifiers in angular brackets, or Markdown will
consider them as HTML tags.

We also should document the modifiers we're parsing.
2021-10-31 17:52:04 -04:00
Matthias Clasen 965ca1b607 widget: Redraw when font options change
Its the right thing to do, even if it is a rare event.
2021-10-31 17:52:04 -04:00
Simon McVittie e67e51be14 reftest-compare: Treat colour channels as undefined if alpha is zero
If the alpha channel is zero, it doesn't matter what the values of the
red, green and blue channels are: the pixel is still fully transparent.
On most architectures, fully transparent pixels end up all-zeroes
(fully transparent black), matching what's in the reference PNG file;
but on mips*el the blend-difference and blend-normal tests get all-ones
(fully transparent white) and a test failure.

Resolves: https://gitlab.gnome.org/GNOME/gtk/-/issues/4227
Signed-off-by: Simon McVittie <smcv@debian.org>
2021-10-31 17:52:04 -04:00
Christoph Reiter eab7c19dfb build: fix implicit-fallthrough errors with clang
The clang build fails due to -Werror=implicit-fallthrough being
on by default and some fallthrough cases not being marked as such.

Use G_GNUC_FALLTHROUGH or duplicate the code in those cases.
2021-10-31 17:52:04 -04:00
Rafał Dzięgiel 66804b9b49 Fix wrong gettext ITS target
The installed ITS rule filename is "gtk4builder.its". The .loc file
is wrongly pointing to old "gtkbuilder.its" which makes gettext fail
on systems without GTK3 installed.
2021-10-31 17:52:04 -04:00
Emmanuele Bassi b48e158ef8 Release an extra reference on GtkExpander:child
The child of a GtkExpander is owned directly by the expander whenever
the "expanded" flag is unset.

We are adding an additional reference to the child of an expander when
expander is not expanded.

Additionally, if a GtkExpander is disposed while not expanded, we need
to explicitly release the reference on the child widget that we own.

This reference leak was masked in GTK3 by GtkContainer removing each
child from the parent container by recursively calling
gtk_widget_destroy().
2021-10-31 17:52:04 -04:00
Qiu Wenbo 4e42006d41 docs: Fix documentation for gtk_icon_view_create_drag_icon
Fixes: #4190
2021-10-31 17:52:04 -04:00
Kalev Lember 946914a2d0 build: Fix detection for pre-compiled css files
The default theme changed from Adwaita to Default and this tripped up
the logic to detect if the tarball builds contain pre-built css files or
not. Fix this by looking at pre-compiled css files in themes/Default/
instead of themes/Adwaita/.
2021-10-31 17:52:04 -04:00
Benjamin Otte 9c1bce629d docs: Expand gdk_clipboard_set() docs 2021-10-31 17:52:04 -04:00
Rūdolfs Mazurs d67982d5e0 Update Latvian translation 2021-10-31 14:59:22 +00:00
Jordi Mas i Hernandez ca02700a63 Update Catalan translation 2021-10-29 11:45:56 +00:00
Alexey Rubtsov 65b955fe26 Update Russian translation 2021-10-29 11:06:26 +00:00
Benjamin Otte 4a884ed706 Merge branch 'cherry-pick-ac8c4245' into 'gtk-4-4'
css: Don't throw warnings on broken URL in image css

See merge request GNOME/gtk!4098
2021-10-27 01:02:45 +00:00
Benjamin Otte 36cb2e932c css: Don't throw warnings on broken URL in image css
If a URL can't be loaded, we might end up with a NULL file. Handle that
case properly by creating an invalid image instead and don't crash or
complain to stderr when files are NULL.

This was broken since 0886ade182

A new reftest has been included. We need a reftest instead of a
CSS parser test, because the error only becomes visible when
compute()ing the actual image.

Fixes #4373


(cherry picked from commit ac8c4245b2)
2021-10-26 23:44:38 +00:00
Rūdolfs Mazurs 4f5264d1b7 Update Latvian translation 2021-10-25 16:59:50 +00:00
Benjamin Otte ff2345a8f8 Merge branch 'cherry-pick-3c9c7a0e' into 'gtk-4-4'
build: Make sure ifuncs exist when using fp16

See merge request GNOME/gtk!4089
2021-10-22 18:17:42 +00:00
Benjamin Otte 2a4b90a81c build: Make sure ifuncs exist when using fp16
Fixes msys compiles on Windows (and everywhere else hopefully).

Fixes #4285


(cherry picked from commit 3c9c7a0e72)
2021-10-22 16:32:55 +00:00
Goran Vidović 6aa6ab85f6 Update Croatian translation 2021-10-21 10:51:24 +00:00
Matthias Clasen c293a243d9 Merge branch 'gtk-4-4nodate' into 'gtk-4-4'
Drop date attribute from our appdata files

See merge request GNOME/gtk!4077
2021-10-19 11:36:44 +00:00
Bernhard M. Wiedemann 6681bbf8d2 Drop date attribute from our appdata files
in order to make builds reproducible.
See https://reproducible-builds.org/ for why this is good

This was suggested by Matthias Clasen as an alternative to MR !3929
2021-10-19 09:38:36 +02:00
Benjamin Otte 5b2aa196e0 Merge branch 'backport-mr-3930-to-gtk-4-4' into 'gtk-4-4'
Fix DND coordinates on Windows

See merge request GNOME/gtk!4049
2021-10-16 17:04:55 +00:00
Sveinn í Felli 83b3c7d826 Update Icelandic translation 2021-10-12 22:48:01 +00:00
Rafael Fontenelle 4b9260608a Update Brazilian Portuguese translation 2021-10-12 17:33:41 +00:00
Benjamin Otte 7f0d7aff0b Merge branch 'cherry-pick-d89e82d4' into 'gtk-4-4'
Merge branch 'wip/otte/for-master' into 'gtk-4-4'

See merge request GNOME/gtk!4055
2021-10-11 19:47:37 +00:00
Benjamin Otte 3c90385716 Merge branch 'wip/otte/for-master' into 'master'
x11: Don't try to move destroyed windows

See merge request GNOME/gtk!4054

(cherry picked from commit d89e82d4a0)

f40ce51a x11: Don't try to move destroyed windows
2021-10-11 18:37:15 +00:00
Asier Sarasua Garmendia 2492729238 Update Basque translation 2021-10-08 17:44:18 +00:00
Luca Bacci b7988d869d Fix DND coordinates on Windows 2021-10-08 14:24:29 +02:00
Luca Bacci d79b52ce55 Make the DND indicator not interfere with the drag and drop operation 2021-10-08 14:24:04 +02:00
Dušan Kazik 14f31183b8 Update Slovak translation 2021-10-04 13:20:03 +00:00
Asier Sarasua Garmendia 5959dcc112 Update Basque translation 2021-10-03 07:12:30 +00:00
Daniel Șerbănescu dc77823787 Update Romanian translation 2021-09-30 12:40:26 +00:00
Sveinn í Felli 4e08ec0ea1 Update Icelandic translation 2021-09-29 12:04:41 +00:00
Kukuh Syafaat cc70eaca93 Update Indonesian translation 2021-09-29 05:57:08 +00:00
Matthias Clasen fbf09f6e31 Merge branch 'cherry-pick-d61c71c3' into 'gtk-4-4'
macos: Actually set the vfuncs

See merge request GNOME/gtk!4007
2021-09-29 00:36:34 +00:00
Benjamin Otte c0c18459f5 macos: Actually set the vfuncs
(cherry picked from commit d61c71c378)
2021-09-29 00:05:14 +00:00
Yaron Shahrabani e230579149 Update Hebrew translation 2021-09-28 20:27:52 +00:00
Daniel Mustieles 2155486ffd Updated Spanish translation 2021-09-28 12:31:04 +02:00
Hugo Carvalho 73861c1178 Update Portuguese translation 2021-09-26 19:58:52 +00:00
Goran Vidović db82ff6ae2 Update Croatian translation 2021-09-26 16:40:30 +00:00
Goran Vidović 6fd90929b4 Update Croatian translation 2021-09-26 16:38:22 +00:00
Piotr Drąg a48e978b39 Update Polish translation 2021-09-26 17:22:36 +02:00
Aurimas Černius 7b967e1f4a Updated Lithuanian translation 2021-09-26 17:22:50 +03:00
Emin Tufan Çetin b245e8c9ef Update Turkish translation 2021-09-26 12:21:46 +00:00
Matej Urbančič 77572104a6 Update Slovenian translation 2021-09-26 11:03:51 +00:00
Мирослав Николић 1a70c49acd Update Serbian translation 2021-09-26 05:51:31 +00:00
Мирослав Николић ea63309512 Update Serbian translation 2021-09-26 05:33:02 +00:00
Rafael Fontenelle df0f886e77 Update Brazilian Portuguese translation 2021-09-25 13:57:40 +00:00
Danial Behzadi 9b7147e085 Update Persian translation 2021-09-25 10:21:18 +00:00
Charles Monzat 75e35cf646 Update French translation 2021-09-25 07:04:51 +00:00
Christian Hergert c08ba636d4 textview: improve undo grouping when overwriting
We want to group in more than one undo group when removing a selection
and replacing it with a new character or characters, unless we're
replacing a single character. In that case, the natural thing is to treat
it as an atomic change.
2021-09-24 16:37:59 -07:00
Christian Hergert f8cd883e0d texthistory: add barriers after final grouping
We don't want to allow new items to be grouped into a previous action
group after the end_user_action() is called. This ensures that we add a
barrier action in those conditions.

Fixes #4276
2021-09-24 16:37:59 -07:00
Fran Dieguez d198754ce8 Update Galician translation 2021-09-24 22:37:55 +00:00
Yuri Chornoivan 3a0d4d3d13 Update Ukrainian translation 2021-09-24 17:06:11 +00:00
Anders Jonsson 9f393f8a33 Update Swedish translation 2021-09-24 14:40:07 +00:00
Marek Černocký 8b5b02454e Updated Czech translation 2021-09-24 15:23:33 +02:00
Benjamin Otte 6d1233d3a6 Merge branch 'wip/otte/for-4-4' into 'gtk-4-4'
GL: improve intiialization

See merge request GNOME/gtk!3993
2021-09-24 12:22:19 +00:00
Benjamin Otte 21cd0f942e gdk: Make sure only one GL backend is used
Creative people managed to create an X11 display and a Wayland display
at once, thereby getting EGL and GLX involved in a fight to the death
over the ownership of the glFoo() symbolspace.

A way to force such a fight with available tools here is (on Wayland)
running something like:
GTK_INSPECTOR_DISPLAY=:1 GTK_DEBUG=interactive gtk4-demo

Related: xdg-desktop-portal-gnome#5
2021-09-24 13:54:17 +02:00
Benjamin Otte 345b06bbbf wayland: Better error on eglGetDisplay() failure
Goals:

1. Provide as much information as possible in the error message, so
   users can try to fix their system themselves.
2. Try to formulate the error message in a way that explains that this
   is not something GTK can fix, but a lower layer problem.

Related: #4193
2021-09-24 13:54:12 +02:00
Emin Tufan Çetin cbd3d5a4aa Update Turkish translation 2021-09-19 17:15:24 +00:00
Matthias Clasen 7f5cbc2234 Merge branch 'fix-win32-shader-check' into 'gtk-4-4'
gdkglcontext-win32-wgl.c: Fix Cairo fallback check

See merge request GNOME/gtk!3964
2021-09-17 11:21:36 +00:00
Chun-wei Fan b57e70fdaf gdkdisplay-win32.c: Don't retry WGL initialization
On Windows, GLES is not that widely available unless one installs wrapper
libraries such as libANGLE, so GLES/EGL support on Windows is used more like
a fallback mode if Desktop OpenGL (WGL) support is inadequate on the system.

Hence, unless one forces WGL or EGL, we will first try to initialize WGL, and
then try to initialize GLES if enabled and if WGL initialization failed, and
then just return whatever the last result we can obtain from these
initialization attempts, since unlike X11 EGL contexts, we do not have
separate modes for WGL except for legacy and non-legacy contexts.
2021-09-17 17:08:23 +08:00
Chun-wei Fan 75aa1a757b gdkglcontext-win32-wgl.c: Fix Cairo fallback check
We were setting the WGL pixel format in GdkWin32Display too early, so the code
does not bail out correctly when we retry establishing the WGL context.

Fix this by pushing back setting the WGL pixel format only after it passes the
shader availability check.

Should fix issue #4257.
2021-09-17 11:19:30 +08:00
Boyuan Yang 362208523d Update Chinese (China) translation 2021-09-15 18:56:14 +00:00
Dz Chen dc7dc6285d Update Chinese (China) translation 2021-09-15 15:37:48 +00:00
Daniel Mustieles f2c92f7e8b Updated Spanish translation 2021-09-15 08:43:45 +02:00
Daniel Mustieles 301e72cb23 Updated Spanish translation 2021-09-15 08:29:59 +02:00
Alan Mortensen 4cbfd49456 Updated Danish translation of gtk-properties 2021-09-13 20:48:55 +02:00
Alan Mortensen c3cb16126a Updated Danish translation 2021-09-13 20:48:52 +02:00
Philipp Kiemle 9cfa472cde Update German translation 2021-09-12 21:48:01 +00:00
Philipp Kiemle f4ef0c61a0 Update German translation 2021-09-12 16:27:27 +00:00
Balázs Meskó fe30ac8e6b Update Hungarian translation 2021-09-12 05:57:57 +00:00
Balázs Meskó baa4c12322 Update Hungarian translation 2021-09-11 23:38:52 +00:00
Guillaume Bernard 8ffd7e9f87 Update French translation 2021-09-11 09:41:11 +00:00
Guillaume Bernard f433c543fe Update French translation 2021-09-11 09:36:29 +00:00
Goran Vidović 33e00c9087 Update Croatian translation 2021-09-10 15:58:48 +00:00
Goran Vidović e507ff96ac Update Croatian translation 2021-09-10 15:56:27 +00:00
Goran Vidović 4b19e5d58d Update Croatian translation 2021-09-10 15:43:42 +00:00
Emin Tufan Çetin 7a6a1c8f32 Update Turkish translation 2021-09-10 06:29:45 +00:00
Matej Urbančič 1742de2f2d Update Slovenian translation 2021-09-07 18:25:03 +00:00
Matej Urbančič 9c8b297223 Update Slovenian translation 2021-09-07 18:20:01 +00:00
Danial Behzadi 462115a57e Update Persian translation 2021-09-06 13:18:07 +00:00
Daniel Șerbănescu bb72acf9cd Update Romanian translation 2021-09-05 18:43:29 +00:00
Daniel Șerbănescu 63d829bbc1 Update Romanian translation 2021-09-05 18:34:20 +00:00
Anders Jonsson 19af960163 Update Swedish translation 2021-09-05 14:11:36 +00:00
Asier Sarasua Garmendia 0768addbb3 Update Basque translation 2021-09-04 20:54:26 +00:00
Asier Sarasua Garmendia edbcd7d36e Update Basque translation 2021-09-04 20:50:17 +00:00
Changwoo Ryu 8ae31322a0 Update Korean translation 2021-09-04 14:55:06 +00:00
Changwoo Ryu 0a5af76932 Update Korean translation 2021-09-04 08:59:22 +00:00
Anders Jonsson 2dbcad428a Update Swedish translation 2021-09-03 22:59:22 +00:00
Matthias Clasen 817cfcacce Merge branch 'backports-for-4-4' into 'gtk-4-4'
windowhandle: Quiet a compiler warning

See merge request GNOME/gtk!3915
2021-09-03 00:55:54 +00:00
Matthias Clasen 5053e9917e Fix build against pango main
Handle (and ignore) new Pango attributes.
2021-09-02 19:59:41 -04:00
Xavier Claessens 4f5d959a94 media: Check for gstreamer verion instead of using cc.links()
This fix error when gstgl_dep comes from a subproject because in that
case it cannot be used in compiler checks.
2021-09-02 19:59:41 -04:00
Matthias Clasen 8407ebe1d8 editable: Clarify the docs
Make it clear that your class must have all the editable properties
already before you call the (confusingly named) function
gtk_editable_install_properties.
2021-09-02 19:59:41 -04:00
Matthias Clasen d2efdaba59 gdk: Make GDK_DEBUG=default-settings unconditional
Our tests use this settings, so we should respect it
in non-debug builds as well.
2021-09-02 19:59:41 -04:00
Simon McVittie da12386faf compose: Update sequences from libX11 1.7.2
This adds support for sequences like <Compose>,G,u -> capital G with
breve. Previously, only a capital U was accepted for E, G, I and O
(but a lower-case u was accepted for A and U for some reason).

Signed-off-by: Simon McVittie <smcv@debian.org>
2021-09-02 19:59:41 -04:00
Simon McVittie 7f9f097c3d compose: Document how to get compose-parse input from libX11 source
Signed-off-by: Simon McVittie <smcv@debian.org>
2021-09-02 19:59:41 -04:00
Simon McVittie 71f6ba92ee compose: Generate endian-dependent compact Compose data
The GtkComposeTable cache is always in big-endian format and is
byteswapped on load for the more common little-endian CPUs, but
init_builtin_table() in GtkIMContextSimple can't byteswap the built-in
data without copying it, which is undesirable. Pregenerate both big-
and little-endian compose data, and compile the correct flavour into
each build of GTK. This fixes failure of the composetable test when
building for a big-endian architecture such as s390x and (traditional,
big-endian) powerpc.

Resolves: https://gitlab.gnome.org/GNOME/gtk/-/issues/4217
Signed-off-by: Simon McVittie <smcv@debian.org>
2021-09-02 19:59:41 -04:00
Benjamin Otte 11c1b97d5c stylecontext: Remove unneeded headers 2021-09-02 19:59:41 -04:00
Benjamin Otte d36b27cc3a fontbutton: Destroy dialog in unrealize()
This way, we can be sure it's always using the right display.

We can also be sure that it doesn't leak.
2021-09-02 19:59:41 -04:00
Benjamin Otte eec783b922 fontbutton: Make sure the window is on the same display
We don't want the font buttons created by the inspector to run on the
default display.
2021-09-02 19:59:41 -04:00
Benjamin Otte edebd48b24 build: Check that introspection is enabled for docs build 2021-09-02 19:59:41 -04:00
Benjamin Otte ede1348cd8 docs: Fix vfunc references
vfunc references should just use the object name, not the
class/interface/iface name.
2021-09-02 19:59:41 -04:00
Matthias Clasen 951844a0f5 ngl: Avoid a coordinate overflow
This was showing up as big text selections going
missing sporadically.

Fixes: #4214
2021-09-02 19:59:41 -04:00
Ian Douglas Scott ddbafa4d1a x11: Fix handling of RRScreenChangeNotify/RRNotify events
It seems these are sent with `xwindow` set to the root window, so this
was failing to find a surface and get the screen from that.

I'm not sure if there's a reason not to get the screen this way
elsewhere in the function, but it seems this should be correct.

This fixes the behavior of `gdk_x11_display_get_monitors()`, which
wasn't correctly changing when monitors were added or removed. For
instance, this python code was always showing the same number of
monitors when one was turned off and on, but updates correctly with this
change applied:

```python
import gi
gi.require_version("GLib", "2.0")
gi.require_version("Gdk", "4.0")
gi.require_version("Gtk", "4.0")
from gi.repository import GLib, Gdk, Gtk

def f():
    print(len(Gdk.Display.get_default().get_monitors()))
    return True
GLib.timeout_add_seconds(1, f)

GLib.MainLoop().run()
```
2021-09-02 19:59:41 -04:00
Florian Müllner d0d982e2ed window: Prefer menu bars when handling F10
Focusing the first widget in the titlebar is a good fallback,
but a "real" menubar or :primary menu button should take
precedence.
2021-09-02 19:59:41 -04:00
Matthias Clasen 6ad047ab79 textview: Apply font features from css
We were forgetting to propagate these values from
CSS to the default attributes. Share the code for
getting these values out of a GtkCssStyle.
2021-09-02 19:59:41 -04:00
Matthias Clasen e7479db2ba textview: Apply line decoration from css
We were forgetting to propagate these values from
CSS to the default attributes.
2021-09-02 19:08:19 -04:00
Matthias Clasen 3799c9d51e textview: Don't forget to collect css letterspacing
There are more properties missing, this is just the start.

Fixes: #4207
2021-09-02 19:08:05 -04:00
Matthias Clasen 4bb230d7d7 windowhandle: Quiet a compiler warning
gesture was left uninitialized in the default case.
2021-09-02 18:22:58 -04:00
Jiri Grönroos 33a4ae12ef Update Finnish translation 2021-09-02 16:06:39 +00:00
Aurimas Černius 0c343d3aad Updated Lithuanian translation 2021-09-02 13:49:47 +03:00
Danial Behzadi 6697b738ad Update Persian translation 2021-09-01 09:43:59 +00:00
Daniel Mustieles e441f75ca6 Updated Spanish translation 2021-09-01 11:02:05 +02:00
Baurzhan Muftakhidinov 581004aa7d Update Kazakh translation 2021-08-29 17:11:04 +00:00
Baurzhan Muftakhidinov e1fbcbb93e Update Kazakh translation 2021-08-29 14:42:01 +00:00
Enrico Nicoletto cd9735eab1 Update Brazilian Portuguese translation 2021-08-28 01:00:26 +00:00
Enrico Nicoletto 8f5a1471cc Update Brazilian Portuguese translation 2021-08-28 00:44:25 +00:00
Andika Triwidada f9efd103a9 Update Indonesian translation 2021-08-26 14:45:38 +00:00
Andika Triwidada 85ad1db8ef Update Indonesian translation 2021-08-26 14:40:03 +00:00
Hugo Carvalho 6e467de751 Update Portuguese translation 2021-08-26 14:29:50 +00:00
Hugo Carvalho ae5b6395ad Update Portuguese translation 2021-08-26 14:12:47 +00:00
Andika Triwidada dcc899b621 Update Indonesian translation 2021-08-26 13:38:46 +00:00
Marek Černocký 16ad555709 Updated Czech translation 2021-08-26 14:48:55 +02:00
Marek Černocký f6387a636c Updated Czech translation 2021-08-26 14:35:37 +02:00
Jordi Mas 9ac48a3b67 Update Catalan translation 2021-08-26 13:10:52 +02:00
Jordi Mas ba33e80cad Update Catalan translation 2021-08-26 12:48:56 +02:00
Emmanuele Bassi 6f3535f35f Merge branch '4195-backport-gtk-4-4' into 'gtk-4-4'
gdkmacoseventsource: Include "gdk-private.h" (Backport to gtk-4-4)

See merge request GNOME/gtk!3884
2021-08-25 16:22:28 +00:00
Daniel Mustieles 434ffd16ce Updated Spanish translation 2021-08-25 17:36:56 +02:00
Daniel Mustieles 58fb124afb Updated Spanish translation 2021-08-25 17:36:49 +02:00
Peter Bloomfield 50c81dfc91 gdkmacoseventsource: Include "gdk-private.h"
_gdk_macos_event_source_new() calls g_source_set_static_name(), which
for GLib versions before 2.69.1 is a macro defined in gdk-private.h.

Fixes #4195
2021-08-25 10:47:24 -04:00
Fran Dieguez 410ea1049b Update Galician translation 2021-08-25 07:26:42 +00:00
Fran Dieguez 09a5828ccf Update Galician translation 2021-08-25 06:12:31 +00:00
Yuri Chornoivan 6377b23bd6 Update Ukrainian translation 2021-08-24 17:28:48 +00:00
207 changed files with 126035 additions and 122094 deletions
+2 -2
View File
@@ -21,11 +21,11 @@ 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=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:v33"
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v34"
FLATPAK_IMAGE: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master"
.only-default:
+104
View File
@@ -1,3 +1,107 @@
Overview of Changes in 4.4.2, 15-02-2022
========================================
* GtkEntry:
- Update placeholder visibility when needed
* Work with newer pango
* Translation updates:
German
Icelandic
Italian
Japanese
Occitan
Overview of Changes in 4.4.1
============================
* input:
- Fix compose data on bigendian systems
- Accept long replacement strings for compose sequences
* a11y:
- Fix accessible relations for menu buttons
- Fix accessible descriptions in some cases
- Simplify atspi context a bit
* Theme:
- Improve styling for toggle buttons in toolbars
* gsk:
- Avoid coordinate overflow with big text selections
* GtkTextView:
- Fix applying css properties such as
letterspacing, line decoration, font
features, etc
- Improve grouping for undo
- Invalidate Pango contexts when font settings change
- Fix a crash
* GtkFileChooser:
- Fix handling of choices
* GtkStackSwitcher:
- Expand child buttons
* GtkCalendar:
- Fix day names for weeks that start on monday
* GtkWindow:
- Prefer menubars when handling F10
* GtkFontButton:
- Make sure the dialog is on the same display
* X11:
- Fix handling of randr events
* Windows:
- Fix DND coordinates
- Fix build
* macOS:
- Fix handling of scale on macOS 12
* build:
- Fix detection of pre-compiled css files
* Translation updates
Basque
Brazilian Portuguese
Catalan
Chinese (China)
Croatian
Czech
Danish
Finnish
French
Galician
German
Hebrew
Hungarian
Icelandic
Indonesian
Kazakh
Korean
Latvian
Lithuanian
Persian
Polish
Portuguese
Romanian
Russian
Serbian
Slovak
Slovenian
Spanish
Swedish
Turkish
Ukrainian
Overview of Changes in 4.4.0
============================
+9 -4
View File
@@ -10,10 +10,12 @@ GTK is a multi-platform toolkit for creating graphical user interfaces.
Offering a complete set of widgets, GTK is suitable for projects ranging
from small one-off projects to complete application suites.
GTK is free software and part of the GNU Project. However, the
licensing terms for GTK, the GNU LGPL, allow it to be used by all
developers, including those developing proprietary software, without any
license fees or royalties.
GTK is a free and open-source software project. However, the licensing terms
for GTK, the GNU LGPL, allow it to be used by all developers, including those
developing proprietary software, without any license fees or royalties.
GTK is hosted by the GNOME project (thanks!) and used by a wide variety
of applications and projects.
The official download location
@@ -151,6 +153,9 @@ Contributing to GTK
Please, follow the [contribution guide](./CONTRIBUTING.md) to know how to
start contributing to GTK.
If you want to support GTK financially, please consider donating to
the GNOME project, which runs the infrastructure hosting GTK.
Release notes
-------------
+6
View File
@@ -271,6 +271,12 @@ insert_tags_for_attributes (GtkTextBuffer *buffer,
#if PANGO_VERSION_CHECK(1,49,0)
case PANGO_ATTR_TEXT_TRANSFORM:
#endif
#if PANGO_VERSION_CHECK(1,49,1)
case PANGO_ATTR_WORD:
case PANGO_ATTR_SENTENCE:
case PANGO_ATTR_BASELINE_SHIFT:
case PANGO_ATTR_FONT_SCALE:
break;
#endif
+1 -1
View File
@@ -33,7 +33,7 @@
<developer_name>Matthias Clasen and others</developer_name>
<content_rating type="oars-1.1"/>
<releases>
<release version="@BUILD_VERSION@" date="@BUILD_DATE@">
<release version="@BUILD_VERSION@">
<description>
<p>A new build of GTK.</p>
</description>
@@ -32,7 +32,7 @@
<developer_name>Matthias Clasen and others</developer_name>
<content_rating type="oars-1.1"/>
<releases>
<release version="@BUILD_VERSION@" date="@BUILD_DATE@">
<release version="@BUILD_VERSION@">
<description>
<p>A new build of GTK.</p>
</description>
-10
View File
@@ -12,19 +12,9 @@ demo_conf_h = declare_dependency(
)
# appdata
today = 'unknown'
date = find_program('date',
required: false)
if date.found()
r = run_command(date, '-I')
if r.returncode() == 0
today = r.stdout().strip()
endif
endif
appdata_config = configuration_data()
appdata_config.set('BUILD_VERSION', meson.project_version())
appdata_config.set('BUILD_DATE', today)
subdir('constraint-editor')
subdir('gtk-demo')
@@ -34,7 +34,7 @@
<developer_name>Matthias Clasen and others</developer_name>
<content_rating type="oars-1.1"/>
<releases>
<release version="@BUILD_VERSION@" date="@BUILD_DATE@">
<release version="@BUILD_VERSION@">
<description>
<p>A new build of GTK.</p>
</description>
+20 -8
View File
@@ -315,7 +315,7 @@ have been added to `GdkDisplay`.
The root window is an X11-centric concept that is no longer exposed in the
backend-neutral GDK API. If you need to interact with the X11 root window,
you can use [method@GdkX11.Display.get_xrootwindow] to get its XID.
you can use [`method@GdkX11.Display.get_xrootwindow`] to get its XID.
### Stop using `GdkVisual`
@@ -333,9 +333,9 @@ had replacements in GTK 3 and were deprecated in favor of `GdkSeat`.
In GTK 4, the two roles of a standalone toplevel window and of a popup that
is placed relative to a parent window have been separated out into two
interfaces, [class@Gdk.Toplevel] and [class@Gdk.Popup]. Surfaces
implementing these interfaces are created with [ctor@Gdk.Surface.new_toplevel]
and [ctor@Gdk.Surface.new_popup], respectively, and they are presented on
interfaces, [iface@Gdk.Toplevel] and [iface@Gdk.Popup]. Surfaces
implementing these interfaces are created with [`ctor@Gdk.Surface.new_toplevel`]
and [`ctor@Gdk.Surface.new_popup`], respectively, and they are presented on
screen using [method@Gdk.Toplevel.present] and [method@Gdk.Popup.present].
The `present()` functions take parameters in the form of an auxiliary layout
struct, [struct@Gdk.PopupLayout] or [struct@Gdk.ToplevelLayout].
@@ -362,9 +362,9 @@ windows, you you will have to use Xlib apis.
A number of minor API cleanups have happened in `GdkSurface`
as well. For example, `gdk_surface_input_shape_combine_region()`
has been renamed to [method@Gdk.Surface.set_input_region], and
has been renamed to [`method@Gdk.Surface.set_input_region`], and
`gdk_surface_begin_resize_drag()` has been renamed to
[method@Gdk.Toplevel.begin_resize].
[`method@Gdk.Toplevel.begin_resize`].
### The "iconified" window state has been renamed to "minimized"
@@ -388,7 +388,7 @@ have accessors that you will have to use.
Event compression is always enabled in GTK 4, for both motion and
scroll events. If you need to see the uncoalesced motion or scroll
history, use [method@Gdk.Event.get_history] on the latest event.
history, use [`method@Gdk.Event.get_history`] on the latest event.
### Stop using grabs
@@ -1051,7 +1051,7 @@ Observing widget contents and widget size is now done by using the
### Monitor handling has changed
Instead of a monitor number, [class@Gdk.Monitor] is now used throughout.
Instead of a monitor number, [class@Gdk.Monitor] is now used throughout.
[method@Gdk.Display.get_monitors] returns the list of monitors that can be queried
or observed for monitors to pass to APIs like [method@Gtk.Window.fullscreen_on_monitor].
@@ -1332,6 +1332,18 @@ pointer coordinates as inout arguments any more, but as normal in ones.
See: [method@Gtk.TreeView.get_tooltip_context], [method@Gtk.IconView.get_tooltip_context]
### Adapt to GtkPopover changes
In GTK 3, a `GtkPopover` could be attached to any widget, using the `relative-to`
property. This is no longer possible in GTK 4. The parent widget has to be aware
of its popover children, and manage their size allocation. Therefore, only widgets
with dedicated popover support can have them, such as [class@Gtk.MenuButton] or
[class@Gtk.PopoverMenuBar].
If you want to make a custom widget that has an attached popover, you need to call
[method@Gtk.Popover.present] in your [vfunc@Gtk.Widget.size_allocate] vfunc, in order
to update the positioning of the popover.
### Stop using GtkFileChooserButton
The `GtkFileChooserButton` widget was removed, due to its shortcomings in
+8 -8
View File
@@ -14,7 +14,7 @@ the question you have, this list is a good place to start.
(most of it about GTK 2.x and 3.x, but still somewhat applicable). This
reference manual also contains a introductory
[Getting Started](#gtk-getting-started) part.
More documentation ranging from whitepapers to online books can be found at
the [GNOME developer's site](https://developer.gnome.org). After studying these
materials you should be well prepared to come back to this reference manual for details.
@@ -93,11 +93,11 @@ the question you have, this list is a good place to start.
`gi18n.h` provides the following shorthand macros for convenience.
Conventionally, people define macros as follows for convenience:
#define _(x) gettext (x)
#define N_(x) x
#define C_(ctx,x) pgettext (ctx, x)
You use `N_()` (N stands for no-op) to mark a string for translation in
a location where a function call to gettext() is not allowed, such as
in an array initializer. You eventually have to call gettext() on the
@@ -205,14 +205,14 @@ the question you have, this list is a good place to start.
Here is an example showing the three approaches using the copyright
sign © which has Unicode and ISO-8859-1 codepoint 169 and is represented
in UTF-8 by the two bytes 194, 169, or `"\302\251"` as a string literal:
g_print ("direct UTF-8: ©");
g_print ("escaped UTF-8: \302\251");
text = g_convert ("runtime conversion: ©", -1,
"ISO-8859-1", "UTF-8", NULL, NULL, NULL);
g_print (text);
g_free (text);
If you are using gettext() to localize your application, you need
to call bind_textdomain_codeset() to ensure that translated strings
are returned in UTF-8 encoding.
@@ -432,10 +432,10 @@ the question you have, this list is a good place to start.
26. How do I associate some data with a row in the tree?
Remember that the [class@Gtk.TreeModel] columns don't necessarily have to be
Remember that the [iface@Gtk.TreeModel] columns don't necessarily have to be
displayed. So you can put non-user-visible data in your model just
like any other data, and retrieve it with [method@Gtk.TreeModel.get].
See the [tree widget overview](#TreeWidget).
See the [tree widget overview](#TreeWidget).
27. How do I put an image and some text in the same column?
@@ -447,7 +447,7 @@ the question you have, this list is a good place to start.
28. I can set data easily on my [class@Gtk.TreeStore] or [class@Gtk.ListStore] models using
[method@Gtk.ListStore.set] and [method@Gtk.TreeStore.set], but can't read it back?
Both the [class@Gtk.TreeStore] and the [class@Gtk.ListStore] implement the [class@Gtk.TreeModel]
Both the [class@Gtk.TreeStore] and the [class@Gtk.ListStore] implement the [iface@Gtk.TreeModel]
interface. As a consequence, you can use any function this interface
implements. The easiest way to read a set of data back is to use
[method@Gtk.TreeModel.get].
+4
View File
@@ -5,6 +5,10 @@ gidocgen = find_program('gi-docgen', required: get_option('gtk_doc'))
docs_dir = gtk_datadir / 'doc'
if get_option('gtk_doc') and not build_gir
error('API reference requires introspection.')
endif
subdir('gdk')
subdir('gsk')
subdir('gtk')
+1 -1
View File
@@ -214,7 +214,7 @@ _gdk_broadway_display_open (const char *display_name)
broadway_display->server = _gdk_broadway_server_new (display, display_name, &error);
if (broadway_display->server == NULL)
{
g_printerr ("Unable to init Broadway server: %s\n", error->message);
GDK_NOTE (MISC, g_message ("Unable to init Broadway server: %s\n", error->message));
g_error_free (error);
return NULL;
}
+1 -1
View File
@@ -132,7 +132,7 @@ static const GdkDebugKey gdk_debug_keys[] = {
{ "gl-wgl", GDK_DEBUG_GL_WGL, "Use WGL on Windows" },
{ "vulkan-disable", GDK_DEBUG_VULKAN_DISABLE, "Disable Vulkan support" },
{ "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer" },
{ "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings" },
{ "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings", TRUE },
};
+7 -1
View File
@@ -1253,9 +1253,15 @@ gdk_clipboard_set_content (GdkClipboard *clipboard,
* @...: value contents conforming to @type
*
* Sets the clipboard to contain the value collected from the given varargs.
*
* Values should be passed the same way they are passed to other value
* collecting APIs, such as [`method@GObject.Object.set`] or
* [`id@g_signal_emit`].
*
* ```c
* gdk_clipboard_set (clipboard, GTK_TYPE_TEXT_BUFFER, buffer);
* gdk_clipboard_set (clipboard, GTK_TYPE_STRING, "Hello World");
*
* gdk_clipboard_set (clipboard, GDK_TYPE_TEXTURE, some_texture);
* ```
*/
void
+2
View File
@@ -928,11 +928,13 @@ init (void)
if (!g_get_charset (&charset))
{
char *mime = g_strdup_printf ("text/plain;charset=%s", charset);
gdk_content_register_deserializer (mime,
G_TYPE_STRING,
string_deserializer,
(gpointer) charset,
g_free);
g_free (mime);
}
gdk_content_register_deserializer ("text/plain",
G_TYPE_STRING,
+2
View File
@@ -1233,6 +1233,8 @@ gdk_display_init_gl (GdkDisplay *self)
*/
priv->gl_context = context;
gdk_gl_backend_use (GDK_GL_CONTEXT_GET_CLASS (context)->backend_type);
gdk_profiler_end_mark (before, "initialize OpenGL", NULL);
}
+7 -7
View File
@@ -105,7 +105,7 @@ struct _GdkDeleteEvent
* GdkMotionEvent:
* @state: (type GdkModifierType): a bit-mask representing the state of
* the modifier keys (e.g. Control, Shift and Alt) set during the motion
* event. See [enum@Gdk.ModifierType]
* event. See [flags@Gdk.ModifierType]
* @x: the x coordinate of the pointer relative to the surface.
* @y: the y coordinate of the pointer relative to the surface.
* @axes: @x, @y translated to the axes of @device, or %NULL if @device is
@@ -132,7 +132,7 @@ struct _GdkMotionEvent
* GdkButtonEvent:
* @state: (type GdkModifierType): a bit-mask representing the state of
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
* buttons. See [enum@Gdk.ModifierType]
* buttons. See [flags@Gdk.ModifierType]
* @button: the button which was pressed or released, numbered from 1 to 5.
* Normally button 1 is the left mouse button, 2 is the middle button,
* and 3 is the right button. On 2-button mice, the middle button can
@@ -162,7 +162,7 @@ struct _GdkButtonEvent
* GdkTouchEvent:
* @state: (type GdkModifierType): a bit-mask representing the state of
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
* buttons. See [enum@Gdk.ModifierType]
* buttons. See [flags@Gdk.ModifierType]
* @x: the x coordinate of the pointer relative to the surface
* @y: the y coordinate of the pointer relative to the surface
* @axes: @x, @y translated to the axes of the event's device, or %NULL
@@ -200,7 +200,7 @@ struct _GdkTouchEvent
* @y: the y coordinate of the pointer relative to the surface.
* @state: (type GdkModifierType): a bit-mask representing the state of
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
* buttons. See [enum@Gdk.ModifierType]
* buttons. See [flags@Gdk.ModifierType]
* @direction: the direction to scroll to (one of %GDK_SCROLL_UP,
* %GDK_SCROLL_DOWN, %GDK_SCROLL_LEFT, %GDK_SCROLL_RIGHT or
* %GDK_SCROLL_SMOOTH).
@@ -256,7 +256,7 @@ typedef struct {
* GdkKeyEvent:
* @state: (type GdkModifierType): a bit-mask representing the state of
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
* buttons. See [enum@Gdk.ModifierType]
* buttons. See [flags@Gdk.ModifierType]
* @keycode: the raw code of the key that was pressed or released.
* @translated: the result of translating @keycode. First with the full
* @state, then while ignoring Caps Lock.
@@ -277,7 +277,7 @@ struct _GdkKeyEvent
* GdkCrossingEvent:
* @state: (type GdkModifierType): a bit-mask representing the state of
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
* buttons. See [enum@Gdk.ModifierType]
* buttons. See [flags@Gdk.ModifierType]
* @mode: the crossing mode (%GDK_CROSSING_NORMAL, %GDK_CROSSING_GRAB,
* %GDK_CROSSING_UNGRAB, %GDK_CROSSING_GTK_GRAB, %GDK_CROSSING_GTK_UNGRAB or
* %GDK_CROSSING_STATE_CHANGED). %GDK_CROSSING_GTK_GRAB, %GDK_CROSSING_GTK_UNGRAB,
@@ -383,7 +383,7 @@ struct _GdkDNDEvent
* GdkTouchpadEvent:
* @state: (type GdkModifierType): a bit-mask representing the state of
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
* buttons. See [enum@Gdk.ModifierType]
* buttons. See [flags@Gdk.ModifierType]
* @phase: (type GdkTouchpadGesturePhase): the current phase of the gesture
* @n_fingers: The number of fingers triggering the pinch
* @time: the time of the event in milliseconds
+70 -3
View File
@@ -75,11 +75,13 @@
#include "config.h"
#include "gdkglcontextprivate.h"
#include "gdkdisplayprivate.h"
#include "gdkmemorytextureprivate.h"
#include "gdkinternals.h"
#include "gdkdebug.h"
#include "gdkdisplayprivate.h"
#include "gdkinternals.h"
#include "gdkintl.h"
#include "gdkmemorytextureprivate.h"
#include "gdk-private.h"
#ifdef GDK_WINDOWING_WIN32
@@ -1335,3 +1337,68 @@ gdk_gl_context_use_es_bgra (GdkGLContext *context)
return FALSE;
}
static GdkGLBackend the_gl_backend_type = GDK_GL_NONE;
static const char *gl_backend_names[] = {
[GDK_GL_NONE] = "No GL (You should never read this)",
[GDK_GL_EGL] = "EGL",
[GDK_GL_GLX] = "X11 GLX",
[GDK_GL_WGL] = "Windows WGL",
[GDK_GL_CGL] = "Apple CGL"
};
/*<private>
* gdk_gl_backend_can_be_used:
* @backend_type: Type of backend to check
* @error: Return location for an error
*
* Checks if this backend type can be used. When multiple displays
* are opened that use different GL backends, conflicts can arise,
* so this function checks that all displays use compatible GL
* backends.
*
* Returns: %TRUE if the backend can still be used
*/
gboolean
gdk_gl_backend_can_be_used (GdkGLBackend backend_type,
GError **error)
{
if (the_gl_backend_type == GDK_GL_NONE ||
the_gl_backend_type == backend_type)
return TRUE;
g_set_error (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
/* translators: This is about OpenGL backend names, like
* "Trying to use X11 GLX, but EGL is already in use" */
_("Trying to use %s, but %s is already in use"),
gl_backend_names[backend_type],
gl_backend_names[the_gl_backend_type]);
return FALSE;
}
/*<private>
* gdk_gl_backend_use:
* @backend_type: Type of backend
*
* Ensures that the backend in use is the given one. If another backend
* is already in use, this function will abort the program. It should
* have previously checked via gdk_gl_backend_can_be_used().
**/
void
gdk_gl_backend_use (GdkGLBackend backend_type)
{
/* Check that the context class is properly initializing its backend type */
g_assert (backend_type != GDK_GL_NONE);
if (the_gl_backend_type == GDK_GL_NONE)
{
the_gl_backend_type = backend_type;
/* This is important!!!11eleven
* (But really: How do I print a message in 2 categories?) */
GDK_NOTE (OPENGL, g_print ("Using OpenGL backend %s\n", gl_backend_names[the_gl_backend_type]));
GDK_NOTE (MISC, g_message ("Using Opengl backend %s", gl_backend_names[the_gl_backend_type]));
}
g_assert (the_gl_backend_type == backend_type);
}
+14
View File
@@ -34,6 +34,14 @@ G_BEGIN_DECLS
#define GDK_EGL_MIN_VERSION_MAJOR (1)
#define GDK_EGL_MIN_VERSION_MINOR (4)
typedef enum {
GDK_GL_NONE = 0,
GDK_GL_EGL,
GDK_GL_GLX,
GDK_GL_WGL,
GDK_GL_CGL
} GdkGLBackend;
#define GDK_GL_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_GL_CONTEXT, GdkGLContextClass))
#define GDK_IS_GL_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_GL_CONTEXT))
#define GDK_GL_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_GL_CONTEXT, GdkGLContextClass))
@@ -52,6 +60,8 @@ struct _GdkGLContextClass
{
GdkDrawContextClass parent_class;
GdkGLBackend backend_type;
gboolean (* realize) (GdkGLContext *context,
GError **error);
@@ -86,6 +96,10 @@ typedef struct {
guint use_es : 1;
} GdkGLContextPaintData;
gboolean gdk_gl_backend_can_be_used (GdkGLBackend backend_type,
GError **error);
void gdk_gl_backend_use (GdkGLBackend backend_type);
GdkGLContext * gdk_gl_context_new_for_surface (GdkSurface *surface);
void gdk_gl_context_set_is_legacy (GdkGLContext *context,
+5 -5
View File
@@ -70,17 +70,17 @@ typedef enum {
* snapshot at or 0 if none. This is purely a hint. The object must still
* be able to render at any size.
* @get_intrinsic_aspect_ratio: The preferred aspect ratio for this object
* or 0 if none. If both [vfunc@Gdk.PaintableInterface.get_intrinsic_width]
* and [vfunc@Gdk.PaintableInterface.get_intrinsic_height] return non-zero
* or 0 if none. If both [vfunc@Gdk.Paintable.get_intrinsic_width]
* and [vfunc@Gdk.Paintable.get_intrinsic_height] return non-zero
* values, this function should return the aspect ratio computed from those.
*
* The list of functions that can be implemented for the `GdkPaintable`
* interface.
*
* Note that apart from the [vfunc@Gdk.PaintableInterface.snapshot] function,
* Note that apart from the [vfunc@Gdk.Paintable.snapshot] function,
* no virtual function of this interface is mandatory to implement, though it
* is a good idea to implement [vfunc@Gdk.PaintableInterface.get_current_image]
* for non-static paintables and [vfunc@Gdk.PaintableInterface.get_flags] if the
* is a good idea to implement [vfunc@Gdk.Paintable.get_current_image]
* for non-static paintables and [vfunc@Gdk.Paintable.get_flags] if the
* image is not dynamic as the default implementation returns no flags and
* that will make the implementation likely quite slow.
*/
+3 -3
View File
@@ -59,8 +59,8 @@
* Its a low-level object, used to implement high-level objects
* such as [class@Gtk.Window] or [class@Gtk.Dialog] in GTK.
*
* The surfaces you see in practice are either [class@Gdk.Toplevel] or
* [class@Gdk.Popup], and those interfaces provide much of the required
* The surfaces you see in practice are either [iface@Gdk.Toplevel] or
* [iface@Gdk.Popup], and those interfaces provide much of the required
* API to interact with these surfaces. Other, more specialized surface
* types exist, but you will rarely interact with them directly.
*/
@@ -2028,7 +2028,7 @@ gdk_surface_get_root_coords (GdkSurface *surface,
*root_y = 0;
return;
}
GDK_SURFACE_GET_CLASS (surface)->get_root_coords (surface, x, y, root_x, root_y);
}
+3
View File
@@ -641,6 +641,9 @@ static GdkGLContext *
gdk_macos_display_init_gl (GdkDisplay *display,
GError **error)
{
if (!gdk_gl_backend_can_be_used (GDK_GL_CGL, error))
return FALSE;
return g_object_new (GDK_TYPE_MACOS_GL_CONTEXT,
"display", display,
NULL);
+2
View File
@@ -32,6 +32,8 @@
#include "gdkmacoseventsource-private.h"
#include "gdkmacosdisplay-private.h"
#include "gdk-private.h"
/*
* This file implementations integration between the GLib main loop and
* the native system of the Core Foundation run loop and Cocoa event
+4
View File
@@ -514,7 +514,11 @@ gdk_macos_gl_context_class_init (GdkMacosGLContextClass *klass)
draw_context_class->surface_resized = gdk_macos_gl_context_surface_resized;
gl_class->get_damage = gdk_macos_gl_context_get_damage;
gl_class->clear_current = gdk_macos_gl_context_clear_current;
gl_class->make_current = gdk_macos_gl_context_make_current;
gl_class->realize = gdk_macos_gl_context_real_realize;
gl_class->backend_type = GDK_GL_CGL;
}
static void
+1 -1
View File
@@ -807,7 +807,7 @@ _gdk_macos_surface_acquire_context (GdkMacosSurface *self,
scale = CGSizeMake (1.0, 1.0);
scale = CGContextConvertSizeToDeviceSpace (cg_context, scale);
CGContextScaleCTM (cg_context, 1.0 / scale.width, 1.0 / scale.height);
CGContextScaleCTM (cg_context, 1.0 / fabs (scale.width), 1.0 / fabs (scale.height));
}
return cg_context;
+1 -1
View File
@@ -2117,7 +2117,7 @@ gdk_wayland_display_get_setting (GdkDisplay *display,
{
TranslationEntry *entry;
if (GDK_DISPLAY_DEBUG_CHECK (display, DEFAULT_SETTINGS))
if (gdk_display_get_debug_flags (display) & GDK_DEBUG_DEFAULT_SETTINGS)
return FALSE;
if (GDK_WAYLAND_DISPLAY (display)->settings != NULL &&
+21 -1
View File
@@ -32,6 +32,7 @@
#include "gdkprivate-wayland.h"
#include "gdkinternals.h"
#include "gdk-private.h"
#include "gdksurfaceprivate.h"
#include "gdkprofilerprivate.h"
@@ -357,6 +358,8 @@ gdk_wayland_gl_context_class_init (GdkWaylandGLContextClass *klass)
context_class->make_current = gdk_wayland_gl_context_make_current;
context_class->clear_current = gdk_wayland_gl_context_clear_current;
context_class->get_damage = gdk_wayland_gl_context_get_damage;
context_class->backend_type = GDK_GL_EGL;
}
static void
@@ -474,14 +477,31 @@ gdk_wayland_display_init_gl (GdkDisplay *display,
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
G_GNUC_UNUSED gint64 start_time2;
if (!gdk_gl_backend_can_be_used (GDK_GL_EGL, error))
return FALSE;
if (!epoxy_has_egl ())
{
gboolean sandboxed = gdk_running_in_sandbox ();
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
sandboxed ? _("libEGL not available in this sandbox")
: _("libEGL not available"));
return NULL;
}
start_time2 = GDK_PROFILER_CURRENT_TIME;
dpy = get_egl_display (display_wayland);
gdk_profiler_end_mark (start_time, "get_egl_display", NULL);
if (dpy == NULL)
{
gboolean sandboxed = gdk_running_in_sandbox ();
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
_("Failed to create EGL display"));
sandboxed ? _("Sandbox does not provide an OpenGL implementation")
: _("No OpenGL implementation available"));
return NULL;
}
+1
View File
@@ -3009,6 +3009,7 @@ gdk_wayland_surface_hide_surface (GdkSurface *surface)
impl->has_uncommitted_ack_configure = FALSE;
impl->input_region_dirty = TRUE;
impl->opaque_region_dirty = TRUE;
unset_transient_for_exported (surface);
+1 -1
View File
@@ -71,7 +71,7 @@ foreach p: proto_sources
elif proto_stability == 'staging'
proto_version = p.get(2)
output_base = '@0@-@1@'.format(proto_name, proto_version)
input = join_paths(wlproto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base))
input = files(join_paths(wlproto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base)))
elif proto_stability == 'private'
output_base = proto_name
input = files('protocol/@0@.xml'.format(proto_name))
-9
View File
@@ -100,15 +100,6 @@ gdk_device_win32_query_state (GdkDevice *device,
if (win_y)
*win_y = point.y / scale;
if (window)
{
if (win_x)
*win_x += _gdk_offset_x;
if (win_y)
*win_y += _gdk_offset_y;
}
if (hwnd && child_window)
{
hwndc = ChildWindowFromPoint (hwnd, point);
-9
View File
@@ -91,15 +91,6 @@ gdk_device_winpointer_query_state (GdkDevice *device,
if (win_y)
*win_y = point.y / scale;
if (!window)
{
if (win_x)
*win_x += _gdk_offset_x;
if (win_y)
*win_y += _gdk_offset_y;
}
if (hwnd && child_window)
{
hwndc = ChildWindowFromPoint (hwnd, point);
-9
View File
@@ -99,15 +99,6 @@ gdk_device_wintab_query_state (GdkDevice *device,
if (win_y)
*win_y = point.y / scale;
if (!window)
{
if (win_x)
*win_x += _gdk_offset_x;
if (win_y)
*win_y += _gdk_offset_y;
}
if (hwnd && child_window)
{
hwndc = ChildWindowFromPoint (hwnd, point);
+9 -7
View File
@@ -1150,6 +1150,8 @@ static gboolean
gdk_win32_display_init_gl_backend (GdkDisplay *display,
GError **error)
{
gboolean result = FALSE;
#ifdef GDK_WIN32_ENABLE_EGL
if (GDK_DISPLAY_DEBUG_CHECK (display, GL_EGL))
return gdk_win32_display_init_egl (display, error);
@@ -1161,17 +1163,17 @@ gdk_win32_display_init_gl_backend (GdkDisplay *display,
* as WGL is the more tried-and-tested configuration.
*/
if (gdk_win32_display_init_wgl (display, error))
return TRUE;
g_clear_error (error);
result = gdk_win32_display_init_wgl (display, error);
#ifdef GDK_WIN32_ENABLE_EGL
if (gdk_win32_display_init_egl (display, error))
return TRUE;
if (!result)
{
g_clear_error (error);
result = gdk_win32_display_init_egl (display, error);
}
#endif
g_clear_error (error);
return gdk_win32_display_init_wgl (display, error);
return result;
}
static GdkGLContext *
+2 -2
View File
@@ -2081,8 +2081,8 @@ gdk_dnd_handle_motion_event (GdkDrag *drag,
API_CALL (PostThreadMessage, (clipdrop->dnd_thread_id,
WM_MOUSEMOVE,
key_state,
MAKELPARAM (x * drag_win32->scale,
y * drag_win32->scale)));
MAKELPARAM (x_root * drag_win32->scale,
y_root * drag_win32->scale)));
return TRUE;
}
+50 -11
View File
@@ -426,6 +426,26 @@ set_source_actions_helper (GdkDrop *drop,
return actions;
}
/* Utility function to translate screen coordinates to surface-relative
* coordinates. This routine only works with pixel values that aren't
* scaled by any GDK DPI scale factor.
*/
static void
unscaled_screen_to_client (GdkSurface* surface,
double screen_x,
double screen_y,
double *client_x,
double *client_y)
{
POINT client_origin;
client_origin.x = 0;
client_origin.y = 0;
ClientToScreen (GDK_SURFACE_HWND (surface), &client_origin);
*client_x = screen_x - client_origin.x;
*client_y = screen_y - client_origin.y;
}
/* The pdwEffect here initially points
* to a DWORD that contains the value of dwOKEffects argument in DoDragDrop,
* i.e. the drag action that the drag source deems acceptable.
@@ -446,6 +466,8 @@ idroptarget_dragenter (LPDROPTARGET This,
GdkDisplay *display;
int pt_x;
int pt_y;
double x = 0.0;
double y = 0.0;
GdkDrag *drag;
GdkDragAction source_actions;
GdkDragAction dest_actions;
@@ -488,9 +510,14 @@ idroptarget_dragenter (LPDROPTARGET This,
grfKeyState);
set_data_object (&ctx->data_object, pDataObj);
pt_x = pt.x / drop_win32->scale + _gdk_offset_x;
pt_y = pt.y / drop_win32->scale + _gdk_offset_y;
gdk_drop_emit_enter_event (drop, TRUE, pt_x, pt_y, GDK_CURRENT_TIME);
pt_x = pt.x / drop_win32->scale;
pt_y = pt.y / drop_win32->scale;
unscaled_screen_to_client (ctx->surface, pt.x, pt.y, &x, &y);
x /= drop_win32->scale;
y /= drop_win32->scale;
gdk_drop_emit_enter_event (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;
@@ -523,8 +550,8 @@ idroptarget_dragover (LPDROPTARGET This,
{
drop_target_context *ctx = (drop_target_context *) This;
GdkWin32Drop *drop_win32 = GDK_WIN32_DROP (ctx->drop);
int pt_x = pt.x / drop_win32->scale + _gdk_offset_x;
int pt_y = pt.y / drop_win32->scale + _gdk_offset_y;
int pt_x = pt.x / drop_win32->scale;
int pt_y = pt.y / drop_win32->scale;
GdkDragAction source_actions;
GdkDragAction dest_actions;
@@ -545,7 +572,14 @@ idroptarget_dragover (LPDROPTARGET This,
pt_y != drop_win32->last_y ||
grfKeyState != drop_win32->last_key_state)
{
gdk_drop_emit_motion_event (ctx->drop, TRUE, pt_x, pt_y, GDK_CURRENT_TIME);
double x = 0.0;
double y = 0.0;
unscaled_screen_to_client (ctx->surface, pt.x, pt.y, &x, &y);
x /= drop_win32->scale;
y /= drop_win32->scale;
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;
@@ -586,8 +620,8 @@ idroptarget_drop (LPDROPTARGET This,
{
drop_target_context *ctx = (drop_target_context *) This;
GdkWin32Drop *drop_win32 = GDK_WIN32_DROP (ctx->drop);
int pt_x = pt.x / drop_win32->scale + _gdk_offset_x;
int pt_y = pt.y / drop_win32->scale + _gdk_offset_y;
double x = 0.0;
double y = 0.0;
GdkDragAction dest_action;
GDK_NOTE (DND, g_print ("idroptarget_drop %p ", This));
@@ -607,7 +641,12 @@ idroptarget_drop (LPDROPTARGET This,
grfKeyState);
drop_win32->drop_finished = FALSE;
gdk_drop_emit_drop_event (ctx->drop, TRUE, pt_x, pt_y, GDK_CURRENT_TIME);
unscaled_screen_to_client (ctx->surface, pt.x, pt.y, &x, &y);
x /= drop_win32->scale;
y /= drop_win32->scale;
gdk_drop_emit_drop_event (ctx->drop, TRUE, x, y, GDK_CURRENT_TIME);
while (!drop_win32->drop_finished)
g_main_context_iteration (NULL, FALSE);
@@ -889,8 +928,8 @@ gdk_dropfiles_filter (GdkWin32Display *display,
gdk_drop_emit_drop_event (drop,
FALSE,
pt.x / drop_win32->scale + _gdk_offset_x,
pt.y / drop_win32->scale + _gdk_offset_y,
pt.x / drop_win32->scale,
pt.y / drop_win32->scale,
_gdk_win32_get_next_tick (msg->time));
DragFinish (hdrop);
+8 -13
View File
@@ -1290,13 +1290,12 @@ make_crossing_event (GdkDevice *physical_device,
}
/* Acquires actual client area size of the underlying native window.
* Rectangle is in GDK screen coordinates (_gdk_offset_* is added).
* Returns FALSE if configure events should be inhibited,
* TRUE otherwise.
*/
gboolean
_gdk_win32_get_window_rect (GdkSurface *window,
RECT *rect)
RECT *rect)
{
RECT client_rect;
POINT point;
@@ -1311,11 +1310,7 @@ _gdk_win32_get_window_rect (GdkSurface *window,
/* top level windows need screen coords */
if (GDK_IS_TOPLEVEL (window))
{
ClientToScreen (hwnd, &point);
point.x += _gdk_offset_x * impl->surface_scale;
point.y += _gdk_offset_y * impl->surface_scale;
}
ClientToScreen (hwnd, &point);
rect->left = point.x;
rect->top = point.y;
@@ -2409,15 +2404,15 @@ gdk_event_translate (MSG *msg,
impl = GDK_WIN32_SURFACE (window);
/* If we haven't moved, don't create any GDK event. Windows
* sends WM_MOUSEMOVE messages after a new window is shows under
* sends WM_MOUSEMOVE messages after a new window is shown under
* the mouse, even if the mouse hasn't moved. This disturbs gtk.
*/
if ((msg->pt.x + _gdk_offset_x) / impl->surface_scale == current_root_x &&
(msg->pt.y + _gdk_offset_y) / impl->surface_scale == current_root_y)
break;
if (msg->pt.x / impl->surface_scale == current_root_x &&
msg->pt.y / impl->surface_scale == current_root_y)
break;
current_root_x = (msg->pt.x + _gdk_offset_x) / impl->surface_scale;
current_root_y = (msg->pt.y + _gdk_offset_y) / impl->surface_scale;
current_root_x = msg->pt.x / impl->surface_scale;
current_root_y = msg->pt.y / impl->surface_scale;
if (impl->drag_move_resize_context.op != GDK_WIN32_DRAGOP_NONE)
gdk_win32_surface_do_move_resize_drag (window, current_root_x, current_root_y);
+5
View File
@@ -256,6 +256,9 @@ gdk_win32_display_init_egl (GdkDisplay *display,
int best_idx = 0;
EGLDisplay egl_disp;
if (!gdk_gl_backend_can_be_used (GDK_GL_EGL, error))
return FALSE;
if (display_win32->egl_disp != EGL_NO_DISPLAY)
return TRUE;
@@ -488,6 +491,8 @@ gdk_win32_gl_context_egl_class_init (GdkWin32GLContextClass *klass)
GdkDrawContextClass *draw_context_class = GDK_DRAW_CONTEXT_CLASS(klass);
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
context_class->backend_type = GDK_GL_EGL;
context_class->realize = gdk_win32_gl_context_egl_realize;
context_class->make_current = gdk_win32_gl_context_egl_make_current;
context_class->clear_current = gdk_win32_gl_context_egl_clear_current;
+7 -1
View File
@@ -265,6 +265,9 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
GdkWin32Display *display_win32 = GDK_WIN32_DISPLAY (display);
HDC hdc;
if (!gdk_gl_backend_can_be_used (GDK_GL_WGL, error))
return FALSE;
if (display_win32->wgl_pixel_format != 0)
return TRUE;
@@ -288,7 +291,6 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
return FALSE;
}
display_win32->wgl_pixel_format = best_idx;
display_win32->gl_version = epoxy_gl_version ();
/* We must have OpenGL/WGL 2.0 or later, or have the GL_ARB_shader_objects extension */
@@ -307,6 +309,8 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
}
}
display_win32->wgl_pixel_format = best_idx;
display_win32->hasWglARBCreateContext =
epoxy_has_wgl_extension (hdc, "WGL_ARB_create_context");
display_win32->hasWglEXTSwapControl =
@@ -697,6 +701,8 @@ gdk_win32_gl_context_wgl_class_init (GdkWin32GLContextWGLClass *klass)
GdkDrawContextClass *draw_context_class = GDK_DRAW_CONTEXT_CLASS (klass);
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
context_class->backend_type = GDK_GL_WGL;
context_class->realize = gdk_win32_gl_context_wgl_realize;
context_class->make_current = gdk_win32_gl_context_wgl_make_current;
context_class->clear_current = gdk_win32_gl_context_wgl_clear_current;
-2
View File
@@ -30,8 +30,6 @@
GdkDisplay *_gdk_display = NULL;
GdkDeviceManagerWin32 *_gdk_device_manager = NULL;
int _gdk_offset_x, _gdk_offset_y;
HDC _gdk_display_hdc;
HINSTANCE _gdk_dll_hinstance;
HINSTANCE _gdk_app_hmodule;
+1 -43
View File
@@ -563,7 +563,7 @@ enum_monitor (HMONITOR hmonitor,
GdkWin32Monitor *w32mon;
GdkMonitor *mon;
GdkRectangle rect;
guint scale;
int scale;
memset (&dd_monitor, 0, sizeof (dd_monitor));
dd_monitor.cb = sizeof (dd_monitor);
@@ -673,9 +673,6 @@ enum_monitor (HMONITOR hmonitor,
HMONITOR hmonitor;
POINT pt;
/* Not subtracting _gdk_offset_x and _gdk_offset_y because they will only
* be added later on, in _gdk_win32_display_get_monitor_list().
*/
pt.x = w32mon->work_rect.x + w32mon->work_rect.width / 2;
pt.y = w32mon->work_rect.y + w32mon->work_rect.height / 2;
hmonitor = MonitorFromPoint (pt, MONITOR_DEFAULTTONEAREST);
@@ -772,45 +769,6 @@ _gdk_win32_display_get_monitor_list (GdkWin32Display *win32_display)
prune_monitors (&data);
}
_gdk_offset_x = G_MININT;
_gdk_offset_y = G_MININT;
for (i = 0; i < data.monitors->len; i++)
{
GdkWin32Monitor *m;
GdkRectangle rect;
m = g_ptr_array_index (data.monitors, i);
/* Calculate offset */
gdk_monitor_get_geometry (GDK_MONITOR (m), &rect);
_gdk_offset_x = MAX (_gdk_offset_x, -rect.x);
_gdk_offset_y = MAX (_gdk_offset_y, -rect.y);
}
GDK_NOTE (MISC, g_print ("Multi-monitor offset: (%d,%d)\n",
_gdk_offset_x, _gdk_offset_y));
/* Translate monitor coords into GDK coordinate space */
for (i = 0; i < data.monitors->len; i++)
{
GdkWin32Monitor *m;
GdkRectangle rect;
m = g_ptr_array_index (data.monitors, i);
gdk_monitor_get_geometry (GDK_MONITOR (m), &rect);
rect.x += _gdk_offset_x;
rect.y += _gdk_offset_y;
gdk_monitor_set_geometry (GDK_MONITOR (m), &rect);
m->work_rect.x += _gdk_offset_x;
m->work_rect.y += _gdk_offset_y;
GDK_NOTE (MISC, g_print ("Monitor %d: %dx%d@%+d%+d\n", i,
rect.width, rect.height, rect.x, rect.y));
}
return data.monitors;
}
-7
View File
@@ -259,13 +259,6 @@ extern GdkDisplay *_gdk_display;
extern GdkDeviceManagerWin32 *_gdk_device_manager;
/* Offsets to add to Windows coordinates (which are relative to the
* primary monitor's origin, and thus might be negative for monitors
* to the left and/or above the primary monitor) to get GDK
* coordinates, which should be non-negative on the whole screen.
*/
extern int _gdk_offset_x, _gdk_offset_y;
extern HDC _gdk_display_hdc;
extern HINSTANCE _gdk_dll_hinstance;
extern HINSTANCE _gdk_app_hmodule;
+51 -64
View File
@@ -472,7 +472,6 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
wchar_t *wtitle;
int window_width, window_height;
int window_x, window_y;
int offset_x = 0, offset_y = 0;
int real_x = 0, real_y = 0;
GdkFrameClock *frame_clock;
@@ -527,8 +526,6 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
dwExStyle = 0;
owner = NULL;
offset_x = _gdk_offset_x;
offset_y = _gdk_offset_y;
/* MSDN: We need WS_CLIPCHILDREN and WS_CLIPSIBLINGS for GL Context Creation */
dwStyle = WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
@@ -560,8 +557,8 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle);
real_x = (x - offset_x) * impl->surface_scale;
real_y = (y - offset_y) * impl->surface_scale;
real_x = x * impl->surface_scale;
real_y = y * impl->surface_scale;
if (surface_type == GDK_SURFACE_TOPLEVEL)
{
@@ -583,12 +580,6 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
if (!title || !*title)
title = "";
/* WS_EX_TRANSPARENT means "try draw this window last, and ignore input".
* It's the last part we're after. We don't want DND indicator to accept
* input, because that will make it a potential drop target, and if it's
* under the mouse cursor, this will kill any DND.
*/
klass = RegisterGdkClass (surface_type);
wtitle = g_utf8_to_utf16 (title, -1, NULL, NULL, NULL);
@@ -632,8 +623,8 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
GDK_NOTE (MISC, g_print ("... \"%s\" %dx%d@%+d%+d %p = %p\n",
title,
window_width, window_height,
surface->x - offset_x,
surface->y - offset_y,
surface->x,
surface->y,
owner,
hwndNew));
@@ -651,6 +642,7 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
_gdk_win32_surface_enable_transparency (surface);
_gdk_win32_surface_register_dnd (surface);
_gdk_win32_surface_update_style_bits (surface);
g_signal_connect (frame_clock,
"after-paint",
@@ -868,8 +860,8 @@ show_window_internal (GdkSurface *window,
{
GdkSurface *owner = surface->transient_owner;
/* Center on transient parent */
center_on_rect.left = (owner->x - _gdk_offset_x) * surface->surface_scale;
center_on_rect.top = (owner->y - _gdk_offset_y) * surface->surface_scale;
center_on_rect.left = owner->x * surface->surface_scale;
center_on_rect.top = owner->y * surface->surface_scale;
center_on_rect.right = center_on_rect.left + owner->width * surface->surface_scale;
center_on_rect.bottom = center_on_rect.top + owner->height * surface->surface_scale;
@@ -1051,13 +1043,13 @@ gdk_win32_surface_do_move (GdkSurface *window,
GDK_NOTE (MISC, g_print ("... SetWindowPos(%p,NULL,%d,%d,0,0,"
"NOACTIVATE|NOSIZE|NOZORDER)\n",
GDK_SURFACE_HWND (window),
(x - _gdk_offset_x) * impl->surface_scale,
(y - _gdk_offset_y) * impl->surface_scale));
x * impl->surface_scale,
y * impl->surface_scale));
API_CALL (SetWindowPos, (GDK_SURFACE_HWND (window),
SWP_NOZORDER_SPECIFIED,
(x - _gdk_offset_x) * impl->surface_scale,
(y - _gdk_offset_y) * impl->surface_scale,
x * impl->surface_scale,
y * impl->surface_scale,
0, 0,
SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER));
}
@@ -1137,15 +1129,15 @@ gdk_win32_surface_do_move_resize (GdkSurface *window,
GDK_NOTE (MISC, g_print ("... SetWindowPos(%p,NULL,%d,%d,%ld,%ld,"
"NOACTIVATE|NOZORDER)\n",
GDK_SURFACE_HWND (window),
(x - _gdk_offset_x) * impl->surface_scale,
(y - _gdk_offset_y) * impl->surface_scale,
x * impl->surface_scale,
y * impl->surface_scale,
outer_rect.right - outer_rect.left,
outer_rect.bottom - outer_rect.top));
API_CALL (SetWindowPos, (GDK_SURFACE_HWND (window),
SWP_NOZORDER_SPECIFIED,
(x - _gdk_offset_x) * impl->surface_scale,
(y - _gdk_offset_y) * impl->surface_scale,
x * impl->surface_scale,
y * impl->surface_scale,
outer_rect.right - outer_rect.left,
outer_rect.bottom - outer_rect.top,
SWP_NOACTIVATE | SWP_NOZORDER));
@@ -1688,14 +1680,6 @@ gdk_win32_surface_get_geometry (GdkSurface *window,
rect.right = pt.x;
rect.bottom = pt.y;
if (parent == NULL)
{
rect.left += _gdk_offset_x * impl->surface_scale;
rect.top += _gdk_offset_y * impl->surface_scale;
rect.right += _gdk_offset_x * impl->surface_scale;
rect.bottom += _gdk_offset_y * impl->surface_scale;
}
}
if (x)
@@ -1734,16 +1718,16 @@ gdk_win32_surface_get_root_coords (GdkSurface *window,
ty = pt.y;
if (root_x)
*root_x = (tx + _gdk_offset_x) / impl->surface_scale;
*root_x = tx / impl->surface_scale;
if (root_y)
*root_y = (ty + _gdk_offset_y) / impl->surface_scale;
*root_y = ty / impl->surface_scale;
GDK_NOTE (MISC, g_print ("gdk_win32_surface_get_root_coords: %p: %+d%+d %+d%+d\n",
GDK_SURFACE_HWND (window),
x * impl->surface_scale,
y * impl->surface_scale,
(tx + _gdk_offset_x) / impl->surface_scale,
(ty + _gdk_offset_y) / impl->surface_scale));
tx / impl->surface_scale,
ty / impl->surface_scale));
}
static gboolean
@@ -1841,6 +1825,8 @@ _gdk_win32_surface_update_style_bits (GdkSurface *window)
RECT rect, before, after;
gboolean was_topmost;
gboolean will_be_topmost;
gboolean was_layered;
gboolean will_be_layered;
HWND insert_after;
UINT flags;
@@ -1855,7 +1841,9 @@ _gdk_win32_surface_update_style_bits (GdkSurface *window)
AdjustWindowRectEx (&before, old_style, FALSE, old_exstyle);
was_topmost = (old_exstyle & WS_EX_TOPMOST) ? TRUE : FALSE;
was_layered = (old_exstyle & WS_EX_LAYERED) ? TRUE : FALSE;
will_be_topmost = was_topmost;
will_be_layered = was_layered;
old_exstyle &= ~WS_EX_TOPMOST;
@@ -1865,7 +1853,14 @@ _gdk_win32_surface_update_style_bits (GdkSurface *window)
if (GDK_IS_DRAG_SURFACE (window))
{
new_exstyle |= WS_EX_TOOLWINDOW;
/* WS_EX_LAYERED | WS_EX_TRANSPARENT makes the drag surface behave
* in pointer input passthrough mode, so it doesn't interfere with
* the drag and drop operation.
*/
new_exstyle |= WS_EX_LAYERED | WS_EX_TRANSPARENT;
will_be_topmost = TRUE;
will_be_layered = TRUE;
}
else
{
@@ -1910,6 +1905,14 @@ _gdk_win32_surface_update_style_bits (GdkSurface *window)
_gdk_win32_surface_exstyle_to_string (new_exstyle)));
SetWindowLong (GDK_SURFACE_HWND (window), GWL_EXSTYLE, new_exstyle);
if (!was_layered && will_be_layered)
{
/* We have to call SetLayeredWindowAttributes when setting the
* WS_EX_LAYERED style anew, otherwise the window won't show up
*/
API_CALL (SetLayeredWindowAttributes, (GDK_SURFACE_HWND (window), 0, 255, LWA_ALPHA));
}
}
AdjustWindowRectEx (&after, new_style, FALSE, new_exstyle);
@@ -2872,8 +2875,8 @@ redraw_indicator (gpointer user_data)
last_draw = draw_indicator (context, context->draw_timestamp);
window_position.x = (context->indicator_window_rect.x - _gdk_offset_x) * impl->surface_scale;
window_position.y = (context->indicator_window_rect.y - _gdk_offset_y) * impl->surface_scale;
window_position.x = context->indicator_window_rect.x * impl->surface_scale;
window_position.y = context->indicator_window_rect.y * impl->surface_scale;
window_size.cx = context->indicator_window_rect.width * impl->surface_scale;
window_size.cy = context->indicator_window_rect.height * impl->surface_scale;
@@ -3564,8 +3567,8 @@ setup_drag_move_resize_context (GdkSurface *window,
GDK_NOTE (MISC, g_print ("W32 WM unmaximized window placement is %ld x %ld @ %ld : %ld\n",
placement.rcNormalPosition.right - placement.rcNormalPosition.left,
placement.rcNormalPosition.bottom - placement.rcNormalPosition.top,
placement.rcNormalPosition.left + _gdk_offset_x * impl->surface_scale,
placement.rcNormalPosition.top + _gdk_offset_y * impl->surface_scale));
placement.rcNormalPosition.left,
placement.rcNormalPosition.top));
unmax_width = placement.rcNormalPosition.right - placement.rcNormalPosition.left;
unmax_height = placement.rcNormalPosition.bottom - placement.rcNormalPosition.top;
@@ -3576,40 +3579,36 @@ setup_drag_move_resize_context (GdkSurface *window,
if (offsetx * impl->surface_scale < (shadow_unmax_width / 2) &&
offsety * impl->surface_scale < (shadow_unmax_height / 2))
{
placement.rcNormalPosition.top = (root_y - offsety + impl->shadow.top - _gdk_offset_y) * impl->surface_scale;
placement.rcNormalPosition.top = (root_y - offsety + impl->shadow.top) * impl->surface_scale;
placement.rcNormalPosition.bottom = placement.rcNormalPosition.top + unmax_height;
if (left_half)
{
placement.rcNormalPosition.left = (root_x - offsetx + impl->shadow.left - _gdk_offset_x) * impl->surface_scale;
placement.rcNormalPosition.left = (root_x - offsetx + impl->shadow.left) * impl->surface_scale;
placement.rcNormalPosition.right = placement.rcNormalPosition.left + unmax_width;
}
else
{
placement.rcNormalPosition.right = (root_x + offsetx + impl->shadow.right - _gdk_offset_x) * impl->surface_scale;
placement.rcNormalPosition.right = (root_x + offsetx + impl->shadow.right) * impl->surface_scale;
placement.rcNormalPosition.left = placement.rcNormalPosition.right - unmax_width;
}
}
else
{
placement.rcNormalPosition.left = (root_x * impl->surface_scale) -
(unmax_width / 2) -
(_gdk_offset_x * impl->surface_scale);
placement.rcNormalPosition.left = root_x * impl->surface_scale - unmax_width / 2;
if (offsety * impl->surface_scale < shadow_unmax_height / 2)
placement.rcNormalPosition.top = (root_y - offsety + impl->shadow.top - _gdk_offset_y) * impl->surface_scale;
placement.rcNormalPosition.top = (root_y - offsety + impl->shadow.top) * impl->surface_scale;
else
placement.rcNormalPosition.top = (root_y * impl->surface_scale) -
(unmax_height / 2) -
(_gdk_offset_y * impl->surface_scale);
placement.rcNormalPosition.top = root_y * impl->surface_scale - unmax_height / 2;
placement.rcNormalPosition.right = placement.rcNormalPosition.left + unmax_width;
placement.rcNormalPosition.bottom = placement.rcNormalPosition.top + unmax_height;
}
GDK_NOTE (MISC, g_print ("Unmaximized window will be at %ld : %ld\n",
placement.rcNormalPosition.left + _gdk_offset_x * impl->surface_scale,
placement.rcNormalPosition.top + _gdk_offset_y * impl->surface_scale));
placement.rcNormalPosition.left,
placement.rcNormalPosition.top));
API_CALL (SetWindowPlacement, (GDK_SURFACE_HWND (window), &placement));
}
@@ -3667,7 +3666,7 @@ setup_drag_move_resize_context (GdkSurface *window,
* the titlebar is, if any.
*/
root_y = wy + wheight / 2;
SetCursorPos (root_x - _gdk_offset_x, root_y - _gdk_offset_y);
SetCursorPos (root_x, root_y);
}
}
@@ -3788,12 +3787,6 @@ gdk_win32_get_window_size_and_position_from_client_rect (GdkSurface *window,
/* Turn client area into window area */
_gdk_win32_adjust_client_rect (window, window_rect);
/* Convert GDK screen coordinates to W32 desktop coordinates */
window_rect->left -= _gdk_offset_x * impl->surface_scale;
window_rect->right -= _gdk_offset_x * impl->surface_scale;
window_rect->top -= _gdk_offset_y * impl->surface_scale;
window_rect->bottom -= _gdk_offset_y * impl->surface_scale;
window_position->x = window_rect->left;
window_position->y = window_rect->top;
window_size->cx = window_rect->right - window_rect->left;
@@ -5093,12 +5086,6 @@ gdk_win32_surface_get_queued_window_rect (GdkSurface *surface,
/* Turn client area into window area */
_gdk_win32_adjust_client_rect (surface, &window_rect);
/* Convert GDK screen coordinates to W32 desktop coordinates */
window_rect.left -= _gdk_offset_x * impl->surface_scale;
window_rect.right -= _gdk_offset_x * impl->surface_scale;
window_rect.top -= _gdk_offset_y * impl->surface_scale;
window_rect.bottom -= _gdk_offset_y * impl->surface_scale;
*return_window_rect = window_rect;
}
+2 -2
View File
@@ -1037,8 +1037,8 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
if (xevent->type - display_x11->xrandr_event_base == RRScreenChangeNotify ||
xevent->type - display_x11->xrandr_event_base == RRNotify)
{
if (x11_screen)
_gdk_x11_screen_size_changed (x11_screen, xevent);
if (display_x11->screen)
_gdk_x11_screen_size_changed (display_x11->screen, xevent);
}
else
#endif
+5
View File
@@ -642,6 +642,8 @@ gdk_x11_gl_context_egl_class_init (GdkX11GLContextEGLClass *klass)
GdkDrawContextClass *draw_context_class = GDK_DRAW_CONTEXT_CLASS (klass);
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
context_class->backend_type = GDK_GL_EGL;
context_class->realize = gdk_x11_gl_context_egl_realize;
context_class->make_current = gdk_x11_gl_context_egl_make_current;
context_class->clear_current = gdk_x11_gl_context_egl_clear_current;
@@ -670,6 +672,9 @@ gdk_x11_display_init_egl (GdkX11Display *self,
Display *dpy;
int major, minor;
if (!gdk_gl_backend_can_be_used (GDK_GL_EGL, error))
return FALSE;
dpy = gdk_x11_display_get_xdisplay (display);
if (!epoxy_has_egl ())
+5
View File
@@ -692,6 +692,8 @@ gdk_x11_gl_context_glx_class_init (GdkX11GLContextGLXClass *klass)
GdkDrawContextClass *draw_context_class = GDK_DRAW_CONTEXT_CLASS (klass);
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
context_class->backend_type = GDK_GL_GLX;
context_class->realize = gdk_x11_gl_context_glx_realize;
context_class->make_current = gdk_x11_gl_context_glx_make_current;
context_class->clear_current = gdk_x11_gl_context_glx_clear_current;
@@ -905,6 +907,9 @@ gdk_x11_display_init_glx (GdkX11Display *display_x11,
Display *dpy;
int screen_num;
if (!gdk_gl_backend_can_be_used (GDK_GL_GLX, error))
return FALSE;
dpy = gdk_x11_display_get_xdisplay (display);
if (!epoxy_has_glx (dpy))
+7 -2
View File
@@ -1923,8 +1923,13 @@ gdk_x11_surface_update_popups (GdkSurface *parent)
{
GdkX11Surface *popup_impl = l->data;
GdkSurface *popup = GDK_SURFACE (popup_impl);
int new_x = GDK_X11_SURFACE (parent)->abs_x + popup->x;
int new_y = GDK_X11_SURFACE (parent)->abs_y + popup->y;
int new_x, new_y;
if (GDK_SURFACE_DESTROYED (popup))
continue;
new_x = GDK_X11_SURFACE (parent)->abs_x + popup->x;
new_y = GDK_X11_SURFACE (parent)->abs_y + popup->y;
if (new_x != popup_impl->abs_x || new_y != popup_impl->abs_y)
x11_surface_move (popup, new_x, new_y);
+3 -3
View File
@@ -89,7 +89,7 @@ get_boolean_default (GdkX11Screen *x11_screen,
char *v;
int i;
if (GDK_DISPLAY_DEBUG_CHECK (GDK_SCREEN_DISPLAY (x11_screen), DEFAULT_SETTINGS))
if (gdk_display_get_debug_flags (GDK_SCREEN_DISPLAY (x11_screen)) & GDK_DEBUG_DEFAULT_SETTINGS)
return FALSE;
v = XGetDefault (dpy, "Xft", option);
@@ -114,7 +114,7 @@ get_double_default (GdkX11Screen *x11_screen,
Display *dpy = GDK_SCREEN_XDISPLAY (x11_screen);
char *v, *e;
if (GDK_DISPLAY_DEBUG_CHECK (GDK_SCREEN_DISPLAY (x11_screen), DEFAULT_SETTINGS))
if (gdk_display_get_debug_flags (GDK_SCREEN_DISPLAY (x11_screen)) & GDK_DEBUG_DEFAULT_SETTINGS)
return FALSE;
v = XGetDefault (dpy, "Xft", option);
@@ -141,7 +141,7 @@ get_integer_default (GdkX11Screen *x11_screen,
Display *dpy = GDK_SCREEN_XDISPLAY (x11_screen);
char *v, *e;
if (GDK_DISPLAY_DEBUG_CHECK (GDK_SCREEN_DISPLAY (x11_screen), DEFAULT_SETTINGS))
if (gdk_display_get_debug_flags (GDK_SCREEN_DISPLAY (x11_screen)) & GDK_DEBUG_DEFAULT_SETTINGS)
return FALSE;
v = XGetDefault (dpy, "Xft", option);
+4 -1
View File
@@ -1408,7 +1408,10 @@ gsk_ngl_render_job_visit_color_node (GskNglRenderJob *job,
program = CHOOSE_PROGRAM (job, coloring);
batch = gsk_ngl_command_queue_get_batch (job->command_queue);
if (batch->any.kind == GSK_NGL_COMMAND_KIND_DRAW &&
/* Limit the size, or we end up with a coordinate overflow somwhere. */
if (node->bounds.size.width < 300 &&
node->bounds.size.height < 300 &&
batch->any.kind == GSK_NGL_COMMAND_KIND_DRAW &&
batch->any.program == program->id)
{
GskNglRenderOffscreen offscreen = {0};
+8 -75
View File
@@ -90,9 +90,6 @@ struct _GtkAtSpiContext
/* The root object, used as a entry point */
GtkAtSpiRoot *root;
/* The address for the ATSPI accessibility bus */
char *bus_address;
/* The object path of the ATContext on the bus */
char *context_path;
@@ -111,15 +108,6 @@ struct _GtkAtSpiContext
guint n_registered_objects;
};
enum
{
PROP_BUS_ADDRESS = 1,
N_PROPS
};
static GParamSpec *obj_props[N_PROPS];
G_DEFINE_TYPE (GtkAtSpiContext, gtk_at_spi_context, GTK_TYPE_AT_CONTEXT)
/* {{{ State handling */
@@ -1437,61 +1425,21 @@ gtk_at_spi_context_finalize (GObject *gobject)
g_clear_object (&self->root);
g_free (self->bus_address);
g_free (self->context_path);
G_OBJECT_CLASS (gtk_at_spi_context_parent_class)->finalize (gobject);
}
static void
gtk_at_spi_context_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GtkAtSpiContext *self = GTK_AT_SPI_CONTEXT (gobject);
switch (prop_id)
{
case PROP_BUS_ADDRESS:
self->bus_address = g_value_dup_string (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
}
}
static void
gtk_at_spi_context_get_property (GObject *gobject,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GtkAtSpiContext *self = GTK_AT_SPI_CONTEXT (gobject);
switch (prop_id)
{
case PROP_BUS_ADDRESS:
g_value_set_string (value, self->bus_address);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
}
}
static void
gtk_at_spi_context_constructed (GObject *gobject)
{
GtkAtSpiContext *self G_GNUC_UNUSED = GTK_AT_SPI_CONTEXT (gobject);
/* Make sure that we were properly constructed */
g_assert (self->bus_address);
G_OBJECT_CLASS (gtk_at_spi_context_parent_class)->constructed (gobject);
}
static const char *get_bus_address (GdkDisplay *display);
static void
gtk_at_spi_context_realize (GtkATContext *context)
{
@@ -1508,7 +1456,7 @@ gtk_at_spi_context_realize (GtkATContext *context)
if (self->root == NULL)
{
self->root = gtk_at_spi_root_new (self->bus_address);
self->root = gtk_at_spi_root_new (get_bus_address (display));
g_object_set_data_full (G_OBJECT (display), "-gtk-atspi-root",
g_object_ref (self->root),
g_object_unref);
@@ -1594,8 +1542,6 @@ gtk_at_spi_context_class_init (GtkAtSpiContextClass *klass)
GtkATContextClass *context_class = GTK_AT_CONTEXT_CLASS (klass);
gobject_class->constructed = gtk_at_spi_context_constructed;
gobject_class->set_property = gtk_at_spi_context_set_property;
gobject_class->get_property = gtk_at_spi_context_get_property;
gobject_class->finalize = gtk_at_spi_context_finalize;
context_class->realize = gtk_at_spi_context_realize;
@@ -1604,15 +1550,6 @@ gtk_at_spi_context_class_init (GtkAtSpiContextClass *klass)
context_class->platform_change = gtk_at_spi_context_platform_change;
context_class->bounds_change = gtk_at_spi_context_bounds_change;
context_class->child_change = gtk_at_spi_context_child_change;
obj_props[PROP_BUS_ADDRESS] =
g_param_spec_string ("bus-address", NULL, NULL,
NULL,
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (gobject_class, N_PROPS, obj_props);
}
static void
@@ -1766,6 +1703,7 @@ get_bus_address (GdkDisplay *display)
out:
return bus_address;
}
/* }}} */
/* {{{ API */
GtkATContext *
@@ -1773,18 +1711,15 @@ gtk_at_spi_create_context (GtkAccessibleRole accessible_role,
GtkAccessible *accessible,
GdkDisplay *display)
{
const char *bus_address;
g_return_val_if_fail (GTK_IS_ACCESSIBLE (accessible), NULL);
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
static const char *bus_address;
bus_address = get_bus_address (display);
if (bus_address == NULL)
{
bus_address = get_bus_address (display);
if (bus_address == NULL)
bus_address = "";
}
bus_address = "";
if (*bus_address == '\0')
return NULL;
@@ -1795,7 +1730,6 @@ gtk_at_spi_create_context (GtkAccessibleRole accessible_role,
"accessible-role", accessible_role,
"accessible", accessible,
"display", display,
"bus-address", bus_address,
NULL);
#endif
#if defined(GDK_WINDOWING_X11)
@@ -1804,7 +1738,6 @@ gtk_at_spi_create_context (GtkAccessibleRole accessible_role,
"accessible-role", accessible_role,
"accessible", accessible,
"display", display,
"bus-address", bus_address,
NULL);
#endif
+9
View File
@@ -40,8 +40,17 @@ pango_variant_to_string (PangoVariant variant)
{
switch (variant)
{
#if PANGO_VERSION_CHECK(1,49,3)
case PANGO_VARIANT_UNICASE:
case PANGO_VARIANT_TITLE_CAPS:
#endif
case PANGO_VARIANT_NORMAL:
return "normal";
#if PANGO_VERSION_CHECK(1,49,3)
case PANGO_VARIANT_ALL_SMALL_CAPS:
case PANGO_VARIANT_PETITE_CAPS:
case PANGO_VARIANT_ALL_PETITE_CAPS:
#endif
case PANGO_VARIANT_SMALL_CAPS:
return "small_caps";
default:
+26 -5
View File
@@ -7,7 +7,8 @@
* character data, and definitions for the builtin compose table of GTK.
* Run it like this:
*
* compose-parse Compose sequences chars gtkcomposedata.h
* cpp -DXCOMM='#' Compose.pre | sed -e 's/^ *#/#/' > Compose
* compose-parse Compose sequences-little-endian sequences-big-endian chars gtkcomposedata.h
*
* The GTK build expects the output files to be in the source tree, in
* the gtk/compose directory.
@@ -15,15 +16,19 @@
int
main (int argc, char *argv[])
{
const guint16 *sequences_le;
const guint16 *sequences_be;
guint16 *other_sequences;
GtkComposeTable *table;
GError *error = NULL;
GString *str;
gsize i;
setlocale (LC_ALL, "");
if (argc < 5)
{
g_print ("Usage: compose-parse INPUT OUTPUT1 OUTPUT2 OUTPUT3\n");
g_print ("Usage: compose-parse INPUT SEQUENCES-LE SEQUENCES-BE CHARS HEADER\n");
exit (1);
}
@@ -31,11 +36,26 @@ main (int argc, char *argv[])
if (!table)
g_error ("Failed to parse %s", argv[1]);
#if G_BYTE_ORDER == G_BIG_ENDIAN
sequences_le = other_sequences = g_new0 (guint16, table->data_size);
sequences_be = (const guint16 *) table->data;
#else
sequences_le = (const guint16 *) table->data;
sequences_be = other_sequences = g_new0 (guint16, table->data_size);
#endif
for (i = 0; i < table->data_size; i++)
other_sequences[i] = GUINT16_SWAP_LE_BE (table->data[i]);
/* data_size is the size in guint16 */
if (!g_file_set_contents (argv[2], (char *)table->data, 2 * table->data_size, &error))
if (!g_file_set_contents (argv[2], (char *) sequences_le, 2 * table->data_size, &error))
g_error ("%s", error->message);
if (!g_file_set_contents (argv[3], table->char_data, table->n_chars + 1, &error))
/* data_size is the size in guint16 */
if (!g_file_set_contents (argv[3], (char *) sequences_be, 2 * table->data_size, &error))
g_error ("%s", error->message);
if (!g_file_set_contents (argv[4], table->char_data, table->n_chars + 1, &error))
g_error ("%s", error->message);
str = g_string_new ("");
@@ -55,10 +75,11 @@ main (int argc, char *argv[])
"\n"
"#endif\n");
if (!g_file_set_contents (argv[4], str->str, str->len, &error))
if (!g_file_set_contents (argv[5], str->str, str->len, &error))
g_error ("%s", error->message);
g_string_free (str, TRUE);
g_free (other_sequences);
return 0;
}
+1 -1
View File
@@ -3,7 +3,7 @@
#define MAX_SEQ_LEN 5
#define N_INDEX_SIZE 30
#define DATA_SIZE 16447
#define DATA_SIZE 16477
#define N_CHARS 1241
#endif
Binary file not shown.
+9 -8
View File
@@ -21,6 +21,7 @@ def replace_if_changed(new, old):
os.remove(new)
srcdir = sys.argv[1]
endian = sys.argv[2]
xml = '''<?xml version='1.0' encoding='UTF-8'?>
<gresources>
@@ -54,7 +55,7 @@ for f in get_files('theme/Default/assets', '.png'):
xml += '\n'
for f in get_files('theme/Default/assets', '.svg'):
xml += ' <file>theme/Default/assets/{0}</file>\n'.format(f)
xml += ' <file preprocess=\'xml-stripblanks\'>theme/Default/assets/{0}</file>\n'.format(f)
for f in get_files('theme/Default/assets-hc', '.png'):
xml += ' <file>theme/Default/assets-hc/{0}</file>\n'.format(f)
@@ -62,10 +63,10 @@ for f in get_files('theme/Default/assets-hc', '.png'):
xml += '\n'
for f in get_files('theme/Default/assets-hc', '.svg'):
xml += ' <file>theme/Default/assets-hc/{0}</file>\n'.format(f)
xml += ' <file preprocess=\'xml-stripblanks\'>theme/Default/assets-hc/{0}</file>\n'.format(f)
for f in get_files('ui', '.ui'):
xml += ' <file preprocess=\'xml-stripblanks\'>ui/{0}</file>\n'.format(f)
xml += ' <file>ui/{0}</file>\n'.format(f)
xml += '\n'
@@ -76,7 +77,7 @@ for s in ['16x16', '32x32', '64x64', 'scalable']:
for f in get_files(icons_dir, '.png'):
xml += ' <file>icons/{0}/{1}/{2}</file>\n'.format(s,c,f)
for f in get_files(icons_dir, '.svg'):
xml += ' <file>icons/{0}/{1}/{2}</file>\n'.format(s,c,f)
xml += ' <file preprocess=\'xml-stripblanks\'>icons/{0}/{1}/{2}</file>\n'.format(s,c,f)
for f in get_files('inspector', '.ui'):
xml += ' <file preprocess=\'xml-stripblanks\'>inspector/{0}</file>\n'.format(f)
@@ -84,13 +85,13 @@ for f in get_files('inspector', '.ui'):
xml += '''
<file>inspector/inspector.css</file>
<file>emoji/en.data</file>
<file>compose/sequences</file>
<file alias="compose/sequences">compose/sequences-{0}-endian</file>
<file>compose/chars</file>
</gresource>
</gresources>'''
</gresources>'''.format(endian)
if len(sys.argv) > 2:
outfile = sys.argv[2]
if len(sys.argv) > 3:
outfile = sys.argv[3]
tmpfile = outfile + '~'
with open(tmpfile, 'w') as f:
f.write(xml)
+2 -2
View File
@@ -1,5 +1,5 @@
#include <winuser.h>
#include <winver.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
GTK_ICON ICON "gtk.ico"
+17 -6
View File
@@ -484,15 +484,26 @@ out:
*
* Parses a string representing an accelerator.
*
* The format looks like <Control>a or <Shift><Alt>F1.
* The format looks like `<Control>a` or `<Shift><Alt>F1`.
*
* The parser is fairly liberal and allows lower or upper case, and also
* abbreviations such as <Ctl> and <Ctrl>. Key names are parsed using
* [func@Gdk.keyval_from_name]. For character keys the name is not the symbol,
* but the lowercase name, e.g. one would use <Ctrl>minus instead of
* <Ctrl>-.
* abbreviations such as `<Ctl>` and `<Ctrl>`.
*
* If the parse fails, @accelerator_key and @accelerator_mods will
* Key names are parsed using [func@Gdk.keyval_from_name]. For character keys
* the name is not the symbol, but the lowercase name, e.g. one would use
* `<Ctrl>minus` instead of `<Ctrl>-`.
*
* Modifiers are enclosed in angular brackets `<>`, and match the
* [flags@Gdk.ModifierType] mask:
*
* - `<Shift>` for `GDK_SHIFT_MASK`
* - `<Ctrl>` for `GDK_CONTROL_MASK`
* - `<Alt>` for `GDK_ALT_MASK`
* - `<Meta>` for `GDK_META_MASK`
* - `<Super>` for `GDK_SUPER_MASK`
* - `<Hyper>` for `GDK_HYPER_MASK`
*
* If the parse operation fails, @accelerator_key and @accelerator_mods will
* be set to 0 (zero).
*/
gboolean
+3
View File
@@ -294,6 +294,9 @@ gtk_application_local_command_line (GApplication *application,
char ***arguments,
int *exit_status)
{
/* We need to call setlocale() here so --help output works */
setlocale_initialization ();
return G_APPLICATION_CLASS (gtk_application_parent_class)->local_command_line (application, arguments, exit_status);
}
+1 -1
View File
@@ -1032,7 +1032,7 @@ gtk_at_context_get_description_accumulate (GtkATContext *self,
GList *list = gtk_reference_list_accessible_value_get (value);
for (GList *l = list; l != NULL; l = l->data)
for (GList *l = list; l != NULL; l = l->next)
{
GtkAccessible *rel = GTK_ACCESSIBLE (l->data);
GtkATContext *rel_context = gtk_accessible_get_at_context (rel);
+6 -10
View File
@@ -617,16 +617,12 @@ gtk_builder_get_parameters (GtkBuilder *builder,
continue;
}
if (prop->pspec->flags & filter_flags)
{
if (filtered_parameters)
object_properties_add (filtered_parameters, property_name, &property_value);
}
if ((prop->pspec->flags & filter_flags) != 0 && filtered_parameters)
object_properties_add (filtered_parameters, property_name, &property_value);
else if ((prop->pspec->flags & filter_flags) == 0 && parameters)
object_properties_add (parameters, property_name, &property_value);
else
{
if (parameters)
object_properties_add (parameters, property_name, &property_value);
}
g_value_unset (&property_value);
}
}
@@ -2752,7 +2748,7 @@ _gtk_builder_get_template_type (GtkBuilder *builder)
* Creates a closure to invoke the function called @function_name.
*
* This is using the create_closure() implementation of @builder's
* [class@Gtk.BuilderScope].
* [iface@Gtk.BuilderScope].
*
* If no closure could be created, %NULL will be returned and @error
* will be set.
+6
View File
@@ -1035,6 +1035,12 @@ gtk_button_get_action_helper (GtkButton *button)
* @child: (nullable): the child widget
*
* Sets the child widget of @button.
*
* Note that by using this API, you take full responsibility for setting
* up the proper accessibility label and description information for @button.
* Most likely, you'll either set the accessibility label or description
* for @button explicitly, or you'll set a labelled-by or described-by
* relations from @child to @button.
*/
void
gtk_button_set_child (GtkButton *button,
+53 -49
View File
@@ -633,11 +633,58 @@ gtk_calendar_init (GtkCalendar *calendar)
calendar);
gtk_widget_add_controller (GTK_WIDGET (calendar), controller);
#ifdef G_OS_WIN32
calendar->week_start = 0;
week_start = NULL;
if (GetLocaleInfoW (GetThreadLocale (), LOCALE_IFIRSTDAYOFWEEK,
wbuffer, G_N_ELEMENTS (wbuffer)))
week_start = g_utf16_to_utf8 (wbuffer, -1, NULL, NULL, NULL);
if (week_start != NULL)
{
calendar->week_start = (week_start[0] - '0' + 1) % 7;
g_free(week_start);
}
#else
#ifdef HAVE__NL_TIME_FIRST_WEEKDAY
langinfo.string = nl_langinfo (_NL_TIME_FIRST_WEEKDAY);
first_weekday = langinfo.string[0];
langinfo.string = nl_langinfo (_NL_TIME_WEEK_1STDAY);
week_origin = langinfo.word;
if (week_origin == 19971130) /* Sunday */
week_1stday = 0;
else if (week_origin == 19971201) /* Monday */
week_1stday = 1;
else
g_warning ("Unknown value of _NL_TIME_WEEK_1STDAY.");
calendar->week_start = (week_1stday + first_weekday - 1) % 7;
#else
/* Translate to calendar:week_start:0 if you want Sunday to be the
* first day of the week to calendar:week_start:1 if you want Monday
* to be the first day of the week, and so on.
*/
week_start = _("calendar:week_start:0");
if (strncmp (week_start, "calendar:week_start:", 20) == 0)
calendar->week_start = *(week_start + 20) - '0';
else
calendar->week_start = -1;
if (calendar->week_start < 0 || calendar->week_start > 6)
{
g_warning ("Whoever translated calendar:week_start:0 did so wrongly.");
calendar->week_start = 0;
}
#endif
#endif
if (!default_abbreviated_dayname[0])
for (i=0; i<7; i++)
{
#ifndef G_OS_WIN32
tmp_time= (i+3)*86400;
tmp_time= (i+3)*86400; /* epoch was a Thursday, so add 3 days for Sunday */
strftime (buffer, sizeof (buffer), "%a", gmtime (&tmp_time));
default_abbreviated_dayname[i] = g_locale_to_utf8 (buffer, -1, NULL, NULL, NULL);
#else
@@ -692,7 +739,11 @@ gtk_calendar_init (GtkCalendar *calendar)
/* Day name labels */
for (i = 0; i < 7; i ++)
{
GtkWidget *label = gtk_label_new (default_abbreviated_dayname[i]);
int day;
GtkWidget *label;
day = (i + calendar->week_start) % 7;
label = gtk_label_new (default_abbreviated_dayname[day]);
gtk_widget_set_hexpand (label, TRUE);
gtk_widget_set_vexpand (label, TRUE);
@@ -771,53 +822,6 @@ gtk_calendar_init (GtkCalendar *calendar)
else if (strcmp (year_before, "calendar:MY") != 0)
g_warning ("Whoever translated calendar:MY did so wrongly.");
#ifdef G_OS_WIN32
calendar->week_start = 0;
week_start = NULL;
if (GetLocaleInfoW (GetThreadLocale (), LOCALE_IFIRSTDAYOFWEEK,
wbuffer, G_N_ELEMENTS (wbuffer)))
week_start = g_utf16_to_utf8 (wbuffer, -1, NULL, NULL, NULL);
if (week_start != NULL)
{
calendar->week_start = (week_start[0] - '0' + 1) % 7;
g_free(week_start);
}
#else
#ifdef HAVE__NL_TIME_FIRST_WEEKDAY
langinfo.string = nl_langinfo (_NL_TIME_FIRST_WEEKDAY);
first_weekday = langinfo.string[0];
langinfo.string = nl_langinfo (_NL_TIME_WEEK_1STDAY);
week_origin = langinfo.word;
if (week_origin == 19971130) /* Sunday */
week_1stday = 0;
else if (week_origin == 19971201) /* Monday */
week_1stday = 1;
else
g_warning ("Unknown value of _NL_TIME_WEEK_1STDAY.");
calendar->week_start = (week_1stday + first_weekday - 1) % 7;
#else
/* Translate to calendar:week_start:0 if you want Sunday to be the
* first day of the week to calendar:week_start:1 if you want Monday
* to be the first day of the week, and so on.
*/
week_start = _("calendar:week_start:0");
if (strncmp (week_start, "calendar:week_start:", 20) == 0)
calendar->week_start = *(week_start + 20) - '0';
else
calendar->week_start = -1;
if (calendar->week_start < 0 || calendar->week_start > 6)
{
g_warning ("Whoever translated calendar:week_start:0 did so wrongly.");
calendar->week_start = 0;
}
#endif
#endif
gtk_orientable_set_orientation (GTK_ORIENTABLE (gtk_widget_get_layout_manager (GTK_WIDGET (calendar))),
GTK_ORIENTATION_VERTICAL);
+11 -11
View File
@@ -24,10 +24,10 @@
*
* An abstract class for laying out GtkCellRenderers
*
* The `GtkCellArea` is an abstract class for `GtkCellLayout` widgets
* (also referred to as "layouting widgets") to interface with an
* arbitrary number of `GtkCellRenderer`s and interact with the user
* for a given `GtkTreeModel` row.
* The `GtkCellArea` is an abstract class for [iface@Gtk.CellLayout]
* widgets (also referred to as "layouting widgets") to interface with
* an arbitrary number of [class@Gtk.CellRenderer]s and interact with the user
* for a given [iface@Gtk.TreeModel] row.
*
* The cell area handles events, focus navigation, drawing and
* size requests and allocations for a given row of data.
@@ -979,7 +979,7 @@ gtk_cell_area_real_add (GtkCellArea *area,
g_type_name (G_TYPE_FROM_INSTANCE (area)));
}
static void
static void
gtk_cell_area_real_remove (GtkCellArea *area,
GtkCellRenderer *renderer)
{
@@ -1727,8 +1727,8 @@ gtk_cell_area_foreach_alloc (GtkCellArea *area,
g_return_if_fail (cell_area != NULL);
g_return_if_fail (callback != NULL);
GTK_CELL_AREA_GET_CLASS (area)->foreach_alloc (area, context, widget,
cell_area, background_area,
GTK_CELL_AREA_GET_CLASS (area)->foreach_alloc (area, context, widget,
cell_area, background_area,
callback, callback_data);
}
@@ -2018,7 +2018,7 @@ gtk_cell_area_get_preferred_width (GtkCellArea *area,
g_return_if_fail (GTK_IS_CELL_AREA (area));
g_return_if_fail (GTK_IS_WIDGET (widget));
GTK_CELL_AREA_GET_CLASS (area)->get_preferred_width (area, context, widget,
GTK_CELL_AREA_GET_CLASS (area)->get_preferred_width (area, context, widget,
minimum_width, natural_width);
}
@@ -2090,7 +2090,7 @@ gtk_cell_area_get_preferred_height (GtkCellArea *area,
g_return_if_fail (GTK_IS_CELL_AREA (area));
g_return_if_fail (GTK_IS_WIDGET (widget));
GTK_CELL_AREA_GET_CLASS (area)->get_preferred_height (area, context, widget,
GTK_CELL_AREA_GET_CLASS (area)->get_preferred_height (area, context, widget,
minimum_height, natural_height);
}
@@ -3369,7 +3369,7 @@ gtk_cell_area_stop_editing (GtkCellArea *area,
gtk_cell_renderer_stop_editing (priv->edited_cell, canceled);
/* When editing is explicitly halted either
* the "editing-canceled" signal is emitted on the cell
* the "editing-canceled" signal is emitted on the cell
* renderer or the "editing-done" signal on the GtkCellEditable widget
*/
if (!canceled)
@@ -3527,7 +3527,7 @@ _gtk_cell_area_set_cell_data_func_with_proxy (GtkCellArea *area,
/* Note we do not take a reference to the proxy, the proxy is a GtkCellLayout
* that is forwarding its implementation to a delegate GtkCellArea therefore
* its life-cycle is longer than the area's life cycle.
* its life-cycle is longer than the area's life cycle.
*/
if (info)
{
+1 -1
View File
@@ -193,7 +193,7 @@ gtk_color_button_class_init (GtkColorButtonClass *klass)
*
* Note that this signal is only emitted when the user changes the color.
* If you need to react to programmatic color changes as well, use
* the notify::color signal.
* the notify::rgba signal.
*/
color_button_signals[COLOR_SET] = g_signal_new (I_("color-set"),
G_TYPE_FROM_CLASS (gobject_class),
-3
View File
@@ -447,9 +447,6 @@ gtk_color_editor_dispose (GObject *object)
dismiss_current_popup (editor);
g_clear_object (&editor->picker);
g_clear_object (&editor->h_adj);
g_clear_object (&editor->s_adj);
g_clear_object (&editor->v_adj);
G_OBJECT_CLASS (gtk_color_editor_parent_class)->dispose (object);
}
-3
View File
@@ -936,8 +936,6 @@ parser_get_compose_table (GtkComposeParser *parser)
}
else
{
g_assert (strlen (value) < 20);
if (char_data->len > 0)
g_string_append_c (char_data, 0);
@@ -1437,7 +1435,6 @@ gtk_compose_table_foreach (const GtkComposeTable *table,
int char_offset = encoded_value & ~(1 << 15);
g_assert (char_offset < table->n_chars);
value = &table->char_data[char_offset];
g_assert (strlen (value) < 20);
}
else
{
+5 -5
View File
@@ -2141,7 +2141,7 @@ gtk_constraint_layout_add_constraints_from_descriptionv (GtkConstraintLayout *la
* @error: return location for a `GError`
* @first_view: the name of a view in the VFL description, followed by the
* [iface@Gtk.ConstraintTarget] to which it maps
* @...: a `NULL`-terminated list of view names and [class@Gtk.ConstraintTarget]s
* @...: a `NULL`-terminated list of view names and [iface@Gtk.ConstraintTarget]s
*
* Creates a list of constraints from a VFL description.
*
@@ -2209,10 +2209,10 @@ gtk_constraint_layout_add_constraints_from_description (GtkConstraintLayout *lay
/**
* gtk_constraint_layout_observe_constraints:
* @layout: a `GtkConstraintLayout`
*
*
* Returns a `GListModel` to track the constraints that are
* part of the layout.
*
*
* Calling this function will enable extra internal bookkeeping
* to track constraints and emit signals on the returned listmodel.
* It may slow down operations a lot.
@@ -2249,10 +2249,10 @@ gtk_constraint_layout_observe_constraints (GtkConstraintLayout *layout)
/**
* gtk_constraint_layout_observe_guides:
* @layout: a `GtkConstraintLayout`
*
*
* Returns a `GListModel` to track the guides that are
* part of the layout.
*
*
* Calling this function will enable extra internal bookkeeping
* to track guides and emit signals on the returned listmodel.
* It may slow down operations a lot.
+1 -1
View File
@@ -178,7 +178,7 @@ gtk_css_image_radial_snapshot (GtkCssImage *image,
else
pos = MIN (1.0, _gtk_css_number_value_get (stop->offset, hradius) / hradius);
pos = MAX (pos, 0);
pos = MAX (pos, offset);
step = (pos - offset) / (i - last);
for (last = last + 1; last <= i; last++)
{
+10
View File
@@ -42,6 +42,12 @@ gtk_css_image_url_load_image (GtkCssImageUrl *url,
if (url->loaded_image)
return url->loaded_image;
if (url->file == NULL)
{
url->loaded_image = gtk_css_image_invalid_new ();
return url->loaded_image;
}
/* We special case resources here so we can use gdk_texture_new_from_resource. */
if (g_file_has_uri_scheme (url->file, "resource"))
{
@@ -148,6 +154,10 @@ gtk_css_image_url_equal (GtkCssImage *image1,
{
GtkCssImageUrl *url1 = GTK_CSS_IMAGE_URL (image1);
GtkCssImageUrl *url2 = GTK_CSS_IMAGE_URL (image2);
/* FIXME: We don't save data: urls, so we can't compare them here */
if (url1->file == NULL || url2->file == NULL)
return FALSE;
return g_file_equal (url1->file, url2->file);
}
+66 -55
View File
@@ -428,64 +428,14 @@ append_separated (GString **s,
g_string_append (*s, text);
}
PangoAttrList *
gtk_css_style_get_pango_attributes (GtkCssStyle *style)
char *
gtk_css_style_compute_font_features (GtkCssStyle *style)
{
PangoAttrList *attrs = NULL;
GtkTextDecorationLine decoration_line;
GtkTextDecorationStyle decoration_style;
const GdkRGBA *color;
const GdkRGBA *decoration_color;
int letter_spacing;
GtkCssFontVariantLigature ligatures;
GtkCssFontVariantNumeric numeric;
GtkCssFontVariantEastAsian east_asian;
GString *s;
char *settings;
/* text-decoration */
decoration_line = _gtk_css_text_decoration_line_value_get (style->font_variant->text_decoration_line);
decoration_style = _gtk_css_text_decoration_style_value_get (style->font_variant->text_decoration_style);
color = gtk_css_color_value_get_rgba (style->core->color);
decoration_color = gtk_css_color_value_get_rgba (style->font_variant->text_decoration_color
? style->font_variant->text_decoration_color
: style->core->color);
if (decoration_line & GTK_CSS_TEXT_DECORATION_LINE_UNDERLINE)
{
attrs = add_pango_attr (attrs, pango_attr_underline_new (get_pango_underline_from_style (decoration_style)));
if (!gdk_rgba_equal (color, decoration_color))
attrs = add_pango_attr (attrs, pango_attr_underline_color_new (decoration_color->red * 65535. + 0.5,
decoration_color->green * 65535. + 0.5,
decoration_color->blue * 65535. + 0.5));
}
if (decoration_line & GTK_CSS_TEXT_DECORATION_LINE_OVERLINE)
{
attrs = add_pango_attr (attrs, pango_attr_overline_new (get_pango_overline_from_style (decoration_style)));
if (!gdk_rgba_equal (color, decoration_color))
attrs = add_pango_attr (attrs, pango_attr_overline_color_new (decoration_color->red * 65535. + 0.5,
decoration_color->green * 65535. + 0.5,
decoration_color->blue * 65535. + 0.5));
}
if (decoration_line & GTK_CSS_TEXT_DECORATION_LINE_LINE_THROUGH)
{
attrs = add_pango_attr (attrs, pango_attr_strikethrough_new (TRUE));
if (!gdk_rgba_equal (color, decoration_color))
attrs = add_pango_attr (attrs, pango_attr_strikethrough_color_new (decoration_color->red * 65535. + 0.5,
decoration_color->green * 65535. + 0.5,
decoration_color->blue * 65535. + 0.5));
}
/* letter-spacing */
letter_spacing = _gtk_css_number_value_get (style->font->letter_spacing, 100);
if (letter_spacing != 0)
{
attrs = add_pango_attr (attrs, pango_attr_letter_spacing_new (letter_spacing * PANGO_SCALE));
}
/* OpenType features */
s = NULL;
GString *s = NULL;
switch (_gtk_css_font_kerning_value_get (style->font_variant->font_kerning))
{
@@ -635,10 +585,71 @@ gtk_css_style_get_pango_attributes (GtkCssStyle *style)
}
if (s)
return g_string_free (s, FALSE);
else
return NULL;
}
PangoAttrList *
gtk_css_style_get_pango_attributes (GtkCssStyle *style)
{
PangoAttrList *attrs = NULL;
GtkTextDecorationLine decoration_line;
GtkTextDecorationStyle decoration_style;
const GdkRGBA *color;
const GdkRGBA *decoration_color;
int letter_spacing;
/* text-decoration */
decoration_line = _gtk_css_text_decoration_line_value_get (style->font_variant->text_decoration_line);
decoration_style = _gtk_css_text_decoration_style_value_get (style->font_variant->text_decoration_style);
color = gtk_css_color_value_get_rgba (style->core->color);
decoration_color = gtk_css_color_value_get_rgba (style->font_variant->text_decoration_color
? style->font_variant->text_decoration_color
: style->core->color);
if (decoration_line & GTK_CSS_TEXT_DECORATION_LINE_UNDERLINE)
{
attrs = add_pango_attr (attrs, pango_attr_font_features_new (s->str));
g_string_free (s, TRUE);
attrs = add_pango_attr (attrs, pango_attr_underline_new (get_pango_underline_from_style (decoration_style)));
if (!gdk_rgba_equal (color, decoration_color))
attrs = add_pango_attr (attrs, pango_attr_underline_color_new (decoration_color->red * 65535. + 0.5,
decoration_color->green * 65535. + 0.5,
decoration_color->blue * 65535. + 0.5));
}
if (decoration_line & GTK_CSS_TEXT_DECORATION_LINE_OVERLINE)
{
attrs = add_pango_attr (attrs, pango_attr_overline_new (get_pango_overline_from_style (decoration_style)));
if (!gdk_rgba_equal (color, decoration_color))
attrs = add_pango_attr (attrs, pango_attr_overline_color_new (decoration_color->red * 65535. + 0.5,
decoration_color->green * 65535. + 0.5,
decoration_color->blue * 65535. + 0.5));
}
if (decoration_line & GTK_CSS_TEXT_DECORATION_LINE_LINE_THROUGH)
{
attrs = add_pango_attr (attrs, pango_attr_strikethrough_new (TRUE));
if (!gdk_rgba_equal (color, decoration_color))
attrs = add_pango_attr (attrs, pango_attr_strikethrough_color_new (decoration_color->red * 65535. + 0.5,
decoration_color->green * 65535. + 0.5,
decoration_color->blue * 65535. + 0.5));
}
/* letter-spacing */
letter_spacing = _gtk_css_number_value_get (style->font->letter_spacing, 100);
if (letter_spacing != 0)
{
attrs = add_pango_attr (attrs, pango_attr_letter_spacing_new (letter_spacing * PANGO_SCALE));
}
/* OpenType features */
{
char *font_features = gtk_css_style_compute_font_features (style);
if (font_features)
{
attrs = add_pango_attr (attrs, pango_attr_font_features_new (font_features));
g_free (font_features);
}
}
return attrs;
}
+3 -3
View File
@@ -254,17 +254,17 @@ GtkCssValue * gtk_css_style_get_value (GtkCssStyle
GtkCssSection * gtk_css_style_get_section (GtkCssStyle *style,
guint id) G_GNUC_PURE;
gboolean gtk_css_style_is_static (GtkCssStyle *style) G_GNUC_PURE;
GtkCssStaticStyle * gtk_css_style_get_static_style (GtkCssStyle *style);
char * gtk_css_style_to_string (GtkCssStyle *style);
gboolean gtk_css_style_print (GtkCssStyle *style,
GString *string,
guint indent,
gboolean skip_initial);
char * gtk_css_style_compute_font_features (GtkCssStyle *style);
PangoAttrList * gtk_css_style_get_pango_attributes (GtkCssStyle *style);
PangoFontDescription * gtk_css_style_get_pango_font (GtkCssStyle *style);
GtkCssStaticStyle * gtk_css_style_get_static_style (GtkCssStyle *style);
GtkCssValues *gtk_css_values_new (GtkCssValuesType type);
GtkCssValues *gtk_css_values_ref (GtkCssValues *values);
+5 -1
View File
@@ -945,11 +945,15 @@ gtk_editable_set_enable_undo (GtkEditable *editable,
* @object_class: a `GObjectClass`
* @first_prop: property ID to use for the first property
*
* Installs the `GtkEditable` properties for @class.
* Overrides the `GtkEditable` properties for @class.
*
* This is a helper function that should be called in class_init,
* after installing your own properties.
*
* Note that your class must have "text", "cursor-position",
* "selection-bound", "editable", "width-chars", "max-width-chars",
* "xalign" and "enable-undo" properties for this function to work.
*
* To handle the properties in your set_property and get_property
* functions, you can either use [func@Gtk.Editable.delegate_set_property]
* and [func@Gtk.Editable.delegate_get_property] (if you are using
+1 -1
View File
@@ -2278,7 +2278,7 @@ gtk_entry_get_overwrite_mode (GtkEntry *entry)
* Sets the maximum allowed length of the contents of the widget.
*
* If the current contents are longer than the given length, then
* they will be truncated to fit.
* they will be truncated to fit. The length is is in characters.
*
* This is equivalent to getting @entry's `GtkEntryBuffer` and
* calling [method@Gtk.EntryBuffer.set_max_length] on it.
+1 -1
View File
@@ -367,10 +367,10 @@ gtk_event_controller_handle_event (GtkEventController *controller,
g_object_ref (controller);
retval = controller_class->handle_event (controller, event, x, y);
g_object_unref (controller);
g_clear_object (&priv->target);
g_clear_pointer (&priv->event, gdk_event_unref);
g_object_unref (controller);
return retval;
}
+19 -6
View File
@@ -582,6 +582,10 @@ gtk_expander_dispose (GObject *object)
expander->expand_timer = 0;
}
/* If the expander is not expanded, we own the child */
if (!expander->expanded)
g_clear_object (&expander->child);
if (expander->box)
{
gtk_widget_unparent (expander->box);
@@ -900,6 +904,9 @@ gtk_expander_set_expanded (GtkExpander *expander,
if (child)
{
/* Transfer the ownership of the child to the box when
* expanded is set, and then back to us when it is unset
*/
if (expander->expanded)
{
gtk_box_append (GTK_BOX (expander->box), child);
@@ -1196,25 +1203,31 @@ gtk_expander_set_child (GtkExpander *expander,
g_return_if_fail (GTK_IS_EXPANDER (expander));
g_return_if_fail (child == NULL || GTK_IS_WIDGET (child));
if (expander->child == child)
return;
if (expander->child)
{
gtk_box_remove (GTK_BOX (expander->box), expander->child);
if (!expander->expanded)
g_object_unref (expander->child);
else
gtk_box_remove (GTK_BOX (expander->box), expander->child);
}
expander->child = child;
if (expander->child)
{
/* We only add the child to the box if the expander is
* expanded; otherwise we just claim ownership of the
* child by sinking its floating reference, or acquiring
* an additional reference to it. The reference will be
* dropped once the expander is expanded
*/
if (expander->expanded)
gtk_box_append (GTK_BOX (expander->box), expander->child);
else
{
if (g_object_is_floating (expander->child))
g_object_ref_sink (expander->child);
g_object_ref (expander->child);
}
g_object_ref_sink (expander->child);
gtk_accessible_update_relation (GTK_ACCESSIBLE (expander),
GTK_ACCESSIBLE_RELATION_CONTROLS, expander->child, NULL,
+3 -1
View File
@@ -79,6 +79,8 @@ filechooser_portal_data_free (FilechooserPortalData *data)
if (data->exported_window)
gtk_window_unexport_handle (data->exported_window);
g_clear_object (&data->exported_window);
g_free (data->portal_handle);
g_free (data);
@@ -501,7 +503,7 @@ gtk_file_chooser_native_portal_show (GtkFileChooserNative *self,
}
else
{
data->exported_window = transient_for;
data->exported_window = g_object_ref (transient_for);
}
}
else
+11 -8
View File
@@ -8028,15 +8028,15 @@ gtk_file_chooser_widget_set_choice (GtkFileChooser *chooser,
if (GTK_IS_BOX (widget))
{
guint i;
const char **choices;
const char **options;
GtkWidget *dropdown;
dropdown = gtk_widget_get_last_child (widget);
choices = (const char **) g_object_get_data (G_OBJECT (dropdown), "choices");
for (i = 0; choices[i]; i++)
options = (const char **) g_object_get_data (G_OBJECT (dropdown), "options");
for (i = 0; options[i]; i++)
{
if (strcmp (option, choices[i]) == 0)
if (strcmp (option, options[i]) == 0)
{
gtk_drop_down_set_selected (GTK_DROP_DOWN (dropdown), i);
break;
@@ -8060,10 +8060,13 @@ gtk_file_chooser_widget_get_choice (GtkFileChooser *chooser,
widget = (GtkWidget *)g_hash_table_lookup (impl->choices, id);
if (GTK_IS_DROP_DOWN (widget))
{
gpointer selected = gtk_drop_down_get_selected_item (GTK_DROP_DOWN (widget));
if (GTK_IS_STRING_OBJECT (selected))
return gtk_string_object_get_string (GTK_STRING_OBJECT (selected));
return NULL;
const char **options;
guint selected;
options = (const char **) g_object_get_data (G_OBJECT (widget), "options");
selected = gtk_drop_down_get_selected (GTK_DROP_DOWN (widget));
return options[selected];
}
else if (GTK_IS_CHECK_BUTTON (widget))
{
+21 -3
View File
@@ -461,6 +461,16 @@ gtk_font_button_activate (GtkFontButton *self)
gtk_widget_activate (self->button);
}
static void
gtk_font_button_unrealize (GtkWidget *widget)
{
GtkFontButton *font_button = GTK_FONT_BUTTON (widget);
g_clear_pointer ((GtkWindow **) &font_button->font_dialog, gtk_window_destroy);
GTK_WIDGET_CLASS (gtk_font_button_parent_class)->unrealize (widget);
}
static void
gtk_font_button_class_init (GtkFontButtonClass *klass)
{
@@ -476,6 +486,7 @@ gtk_font_button_class_init (GtkFontButtonClass *klass)
widget_class->grab_focus = gtk_widget_grab_focus_child;
widget_class->focus = gtk_widget_focus_child;
widget_class->unrealize = gtk_font_button_unrealize;
klass->font_set = NULL;
klass->activate = gtk_font_button_activate;
@@ -628,9 +639,6 @@ gtk_font_button_finalize (GObject *object)
{
GtkFontButton *font_button = GTK_FONT_BUTTON (object);
if (font_button->font_dialog != NULL)
gtk_window_destroy (GTK_WINDOW (font_button->font_dialog));
g_free (font_button->title);
clear_font_data (font_button);
@@ -968,6 +976,7 @@ gtk_font_button_clicked (GtkButton *button,
font_button->font_dialog = gtk_font_chooser_dialog_new (font_button->title, NULL);
gtk_window_set_hide_on_close (GTK_WINDOW (font_button->font_dialog), TRUE);
gtk_window_set_modal (GTK_WINDOW (font_button->font_dialog), font_button->modal);
gtk_window_set_display (GTK_WINDOW (font_button->font_dialog), gtk_widget_get_display (GTK_WIDGET (button)));
font_dialog = GTK_FONT_CHOOSER (font_button->font_dialog);
@@ -1181,8 +1190,17 @@ pango_font_description_to_css (PangoFontDescription *desc,
g_string_append (s, "font-variant: normal; ");
break;
case PANGO_VARIANT_SMALL_CAPS:
#if PANGO_VERSION_CHECK(1,49,3)
case PANGO_VARIANT_ALL_SMALL_CAPS:
case PANGO_VARIANT_PETITE_CAPS:
case PANGO_VARIANT_ALL_PETITE_CAPS:
#endif
g_string_append (s, "font-variant: small-caps; ");
break;
#if PANGO_VERSION_CHECK(1,49,3)
case PANGO_VARIANT_UNICASE:
case PANGO_VARIANT_TITLE_CAPS:
#endif
default:
break;
}
+2 -2
View File
@@ -6516,10 +6516,10 @@ gtk_icon_view_get_dest_item_at_pos (GtkIconView *icon_view,
* @icon_view: a `GtkIconView`
* @path: a `GtkTreePath` in @icon_view
*
* Creates a `cairo_surface_t` representation of the item at @path.
* Creates a `GdkPaintable` representation of the item at @path.
* This image is used for a drag icon.
*
* Returns: (transfer full): a newly-allocated surface of the drag icon.
* Returns: (transfer full): a newly-allocated `GdkPaintable` of the drag icon.
**/
GdkPaintable *
gtk_icon_view_create_drag_icon (GtkIconView *icon_view,
+2 -2
View File
@@ -724,7 +724,7 @@ gtk_im_context_ime_focus_out (GtkIMContext *context)
context_ime->priv->pretend_empty_preedit = FALSE;
g_free (utf8str);
}
/* fallthrough */
G_GNUC_FALLTHROUGH;
case GTK_WIN32_IME_FOCUS_BEHAVIOR_DISCARD:
gtk_im_context_ime_reset (context);
@@ -1054,7 +1054,7 @@ gtk_im_context_ime_message_filter (GdkWin32Display *display,
default:
break;
}
break;
default:
break;
}
+19 -2
View File
@@ -464,6 +464,7 @@ gtk_level_bar_allocate_trough_discrete (GtkLevelBar *self,
GtkAllocation block_area;
int num_blocks, i;
int block_width, block_height;
int extra_space;
gtk_level_bar_get_min_block_size (self, &block_width, &block_height);
num_blocks = gtk_level_bar_get_num_blocks (self);
@@ -473,13 +474,21 @@ gtk_level_bar_allocate_trough_discrete (GtkLevelBar *self,
if (self->orientation == GTK_ORIENTATION_HORIZONTAL)
{
block_width = MAX (block_width, (int) floor (width / num_blocks));
block_width = MAX (block_width, (int) floor ((double) width / num_blocks));
block_height = height;
extra_space = width - block_width * num_blocks;
if (extra_space > 0)
block_width++;
}
else
{
block_width = width;
block_height = MAX (block_height, (int) floor (height / num_blocks));
block_height = MAX (block_height, (int) floor ((double) height / num_blocks));
extra_space = height - block_height * num_blocks;
if (extra_space > 0)
block_height++;
}
block_area.x = 0;
@@ -489,6 +498,14 @@ gtk_level_bar_allocate_trough_discrete (GtkLevelBar *self,
for (i = 0; i < num_blocks; i++)
{
if (extra_space > 0 && i == extra_space)
{
if (self->orientation == GTK_ORIENTATION_HORIZONTAL)
block_area.width--;
else
block_area.height--;
}
gtk_widget_size_allocate (self->block_widget[i],
&block_area,
baseline);
+1 -1
View File
@@ -362,7 +362,7 @@ enum_locale_proc (LPTSTR locale)
#endif
static void
void
setlocale_initialization (void)
{
static gboolean initialized = FALSE;
+10
View File
@@ -633,6 +633,10 @@ gtk_menu_button_init (GtkMenuButton *self)
gtk_widget_set_sensitive (self->button, FALSE);
gtk_widget_add_css_class (GTK_WIDGET (self), "popup");
gtk_accessible_update_relation (GTK_ACCESSIBLE (self->button), GTK_ACCESSIBLE_RELATION_LABELLED_BY, self, NULL,
GTK_ACCESSIBLE_RELATION_DESCRIBED_BY, self, NULL,
-1);
}
/**
@@ -949,6 +953,9 @@ gtk_menu_button_set_icon_name (GtkMenuButton *menu_button,
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_set_halign (box, GTK_ALIGN_CENTER);
// Because we are setting only an icon, let the inner button be labeled by us, so the accessible label can be overridden
gtk_accessible_update_relation (GTK_ACCESSIBLE (menu_button->button), GTK_ACCESSIBLE_RELATION_LABELLED_BY, menu_button, NULL, -1);
image_widget = g_object_new (GTK_TYPE_IMAGE,
"accessible-role", GTK_ACCESSIBLE_ROLE_PRESENTATION,
"icon-name", icon_name,
@@ -1071,6 +1078,9 @@ gtk_menu_button_set_label (GtkMenuButton *menu_button,
gtk_button_set_child (GTK_BUTTON (menu_button->button), box);
menu_button->label_widget = label_widget;
// When the user explicitly set a label assume that it should be announced by assistive technologies as well
gtk_accessible_update_relation (GTK_ACCESSIBLE (menu_button->button), GTK_ACCESSIBLE_RELATION_LABELLED_BY, menu_button->label_widget, NULL, -1);
menu_button->image_widget = NULL;
update_arrow (menu_button);
+6
View File
@@ -262,6 +262,12 @@ attribute_from_text (GtkBuilder *builder,
if (gtk_builder_value_from_string_type (builder, PANGO_TYPE_TEXT_TRANSFORM, value, &val, error))
attribute = pango_attr_text_transform_new (g_value_get_enum (&val));
break;
#endif
#if PANGO_VERSION_CHECK(1, 49, 1)
case PANGO_ATTR_WORD:
case PANGO_ATTR_SENTENCE:
case PANGO_ATTR_BASELINE_SHIFT:
case PANGO_ATTR_FONT_SCALE:
#endif
case PANGO_ATTR_INVALID:
default:
+2
View File
@@ -150,6 +150,8 @@ GBytes *get_emoji_data (void);
char * _gtk_elide_underscores (const char *original);
void setlocale_initialization (void);
G_END_DECLS
#endif /* __GTK_PRIVATE_H__ */
+1
View File
@@ -366,6 +366,7 @@ gtk_search_bar_init (GtkSearchBar *bar)
gtk_widget_set_hexpand (bar->box_center, TRUE);
bar->close_button = gtk_button_new_from_icon_name ("window-close-symbolic");
gtk_widget_set_valign (bar->close_button, GTK_ALIGN_CENTER);
gtk_widget_add_css_class (bar->close_button, "close");
gtk_center_box_set_end_widget (GTK_CENTER_BOX (bar->box_center), bar->close_button);
gtk_widget_hide (bar->close_button);
+4
View File
@@ -81,6 +81,7 @@ do_search (gpointer data)
GtkSearchEngineModel *model = data;
GtkTreeIter iter;
GList *hits = NULL;
gboolean got_results = FALSE;
if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model->model), &iter))
{
@@ -107,11 +108,14 @@ do_search (gpointer data)
{
_gtk_search_engine_hits_added (GTK_SEARCH_ENGINE (model), hits);
g_list_free_full (hits, (GDestroyNotify)_gtk_search_hit_free);
got_results = TRUE;
}
}
model->idle = 0;
_gtk_search_engine_finished (GTK_SEARCH_ENGINE (model), got_results);
return G_SOURCE_REMOVE;
}
+4 -3
View File
@@ -690,13 +690,14 @@ gtk_stack_dispose (GObject *obj)
GtkStack *stack = GTK_STACK (obj);
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
GtkWidget *child;
if (priv->pages)
g_list_model_items_changed (G_LIST_MODEL (priv->pages), 0, g_list_length (priv->children), 0);
guint n_pages = g_list_length (priv->children);
while ((child = gtk_widget_get_first_child (GTK_WIDGET (stack))))
stack_remove (stack, child, TRUE);
if (priv->pages)
g_list_model_items_changed (G_LIST_MODEL (priv->pages), 0, n_pages, 0);
G_OBJECT_CLASS (gtk_stack_parent_class)->dispose (obj);
}
+2
View File
@@ -273,6 +273,8 @@ add_child (guint position,
button = g_object_new (GTK_TYPE_TOGGLE_BUTTON,
"accessible-role", GTK_ACCESSIBLE_ROLE_TAB,
"hexpand", TRUE,
"vexpand", TRUE,
NULL);
gtk_widget_set_focus_on_click (button, FALSE);
+1 -16
View File
@@ -20,31 +20,16 @@
#include "gtkstylecontextprivate.h"
#include <gdk/gdk.h>
#include <math.h>
#include <stdlib.h>
#include <gobject/gvaluecollector.h>
#include "gtkcsscolorvalueprivate.h"
#include "gtkcssenumvalueprivate.h"
#include "gtkcssimagevalueprivate.h"
#include "gtkcssnodedeclarationprivate.h"
#include "gtkcssnumbervalueprivate.h"
#include "gtkcsscolorvalueprivate.h"
#include "gtkcsscolorvalueprivate.h"
#include "gtkcssstylepropertyprivate.h"
#include "gtkcsstransientnodeprivate.h"
#include "gtkcsswidgetnodeprivate.h"
#include "gtkdebug.h"
#include "gtkintl.h"
#include "gtkprivate.h"
#include "gtkrenderbackgroundprivate.h"
#include "gtkrendericonprivate.h"
#include "gtksettings.h"
#include "gtksettingsprivate.h"
#include "gtkstylecascadeprivate.h"
#include "gtkstyleproviderprivate.h"
#include "gtktypebuiltins.h"
#include "gtkwidgetprivate.h"
#include "gtksnapshot.h"
/**
+1 -1
View File
@@ -33,7 +33,7 @@
* adding `GtkStyleProviders`.
*
* GTK uses the `GtkStyleProvider` implementation for CSS in
* [iface@Gtk.CssProvider].
* [class@Gtk.CssProvider].
*/
enum {
+49 -47
View File
@@ -386,9 +386,9 @@ static void gtk_text_set_editable (GtkText *self,
static void gtk_text_set_text (GtkText *self,
const char *text);
static void gtk_text_set_width_chars (GtkText *self,
int n_chars);
int n_chars);
static void gtk_text_set_max_width_chars (GtkText *self,
int n_chars);
int n_chars);
static void gtk_text_set_alignment (GtkText *self,
float xalign);
@@ -415,7 +415,7 @@ static void gtk_text_toggle_overwrite (GtkText *self);
static void gtk_text_insert_emoji (GtkText *self);
static void gtk_text_select_all (GtkText *self);
static void gtk_text_real_activate (GtkText *self);
static void direction_changed (GdkDevice *keyboard,
GParamSpec *pspec,
GtkText *self);
@@ -438,19 +438,19 @@ static gboolean gtk_text_delete_surrounding_cb (GtkIMContext *context,
/* Entry buffer signal handlers
*/
static void buffer_inserted_text (GtkEntryBuffer *buffer,
static void buffer_inserted_text (GtkEntryBuffer *buffer,
guint position,
const char *chars,
guint n_chars,
GtkText *self);
static void buffer_deleted_text (GtkEntryBuffer *buffer,
static void buffer_deleted_text (GtkEntryBuffer *buffer,
guint position,
guint n_chars,
GtkText *self);
static void buffer_notify_text (GtkEntryBuffer *buffer,
static void buffer_notify_text (GtkEntryBuffer *buffer,
GParamSpec *spec,
GtkText *self);
static void buffer_notify_max_length (GtkEntryBuffer *buffer,
static void buffer_notify_max_length (GtkEntryBuffer *buffer,
GParamSpec *spec,
GtkText *self);
@@ -700,7 +700,7 @@ add_move_binding (GtkWidgetClass *widget_class,
int count)
{
g_return_if_fail ((modmask & GDK_SHIFT_MASK) == 0);
gtk_widget_class_add_binding_signal (widget_class,
keyval, modmask,
"move-cursor",
@@ -997,7 +997,7 @@ gtk_text_class_init (GtkTextClass *class)
gtk_editable_install_properties (gobject_class, NUM_PROPERTIES);
/* Action signals */
/**
* GtkText::activate:
* @self: The widget on which the signal is emitted
@@ -1044,7 +1044,7 @@ gtk_text_class_init (GtkTextClass *class)
* - <kbd>Ctrl</kbd>-<kbd></kbd>, etc. move by words/paragraphs
* - <kbd>Home</kbd>, <kbd>End</kbd> move to the ends of the buffer
*/
signals[MOVE_CURSOR] =
signals[MOVE_CURSOR] =
g_signal_new (I_("move-cursor"),
G_OBJECT_CLASS_TYPE (gobject_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
@@ -1068,7 +1068,7 @@ gtk_text_class_init (GtkTextClass *class)
*
* This signal has no default bindings.
*/
signals[INSERT_AT_CURSOR] =
signals[INSERT_AT_CURSOR] =
g_signal_new (I_("insert-at-cursor"),
G_OBJECT_CLASS_TYPE (gobject_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
@@ -1096,7 +1096,7 @@ gtk_text_class_init (GtkTextClass *class)
* for deleting a character and <kbd>Ctrl</kbd>-<kbd>Delete</kbd>
* for deleting a word.
*/
signals[DELETE_FROM_CURSOR] =
signals[DELETE_FROM_CURSOR] =
g_signal_new (I_("delete-from-cursor"),
G_OBJECT_CLASS_TYPE (gobject_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
@@ -1249,7 +1249,7 @@ gtk_text_class_init (GtkTextClass *class)
NULL, NULL,
NULL,
G_TYPE_NONE, 0);
/*
* Actions
*/
@@ -1281,7 +1281,7 @@ gtk_text_class_init (GtkTextClass *class)
/**
* GtkText|selection.delete:
*
* Deletes the current selection.
* Deletes the current selection.
*/
gtk_widget_class_install_action (widget_class, "selection.delete", NULL,
gtk_text_activate_selection_delete);
@@ -1306,7 +1306,7 @@ gtk_text_class_init (GtkTextClass *class)
* GtkText|misc.toggle-visibility:
*
* Toggles the `GtkText`:visibility property.
*/
*/
gtk_widget_class_install_property_action (widget_class,
"misc.toggle-visibility",
"visibility");
@@ -1315,7 +1315,7 @@ gtk_text_class_init (GtkTextClass *class)
* GtkText|text.undo:
*
* Undoes the last change to the contents.
*/
*/
gtk_widget_class_install_action (widget_class, "text.undo", NULL, gtk_text_real_undo);
/**
@@ -1328,8 +1328,8 @@ gtk_text_class_init (GtkTextClass *class)
/**
* GtkText|menu.popup:
*
* Opens the context menu.
*/
* Opens the context menu.
*/
gtk_widget_class_install_action (widget_class, "menu.popup", NULL, gtk_text_popup_menu);
/*
@@ -1348,16 +1348,16 @@ gtk_text_class_init (GtkTextClass *class)
/* Moving the insertion point */
add_move_binding (widget_class, GDK_KEY_Right, 0,
GTK_MOVEMENT_VISUAL_POSITIONS, 1);
add_move_binding (widget_class, GDK_KEY_Left, 0,
GTK_MOVEMENT_VISUAL_POSITIONS, -1);
add_move_binding (widget_class, GDK_KEY_KP_Right, 0,
GTK_MOVEMENT_VISUAL_POSITIONS, 1);
add_move_binding (widget_class, GDK_KEY_KP_Left, 0,
GTK_MOVEMENT_VISUAL_POSITIONS, -1);
add_move_binding (widget_class, GDK_KEY_Right, GDK_CONTROL_MASK,
GTK_MOVEMENT_WORDS, 1);
@@ -1369,7 +1369,7 @@ gtk_text_class_init (GtkTextClass *class)
add_move_binding (widget_class, GDK_KEY_KP_Left, GDK_CONTROL_MASK,
GTK_MOVEMENT_WORDS, -1);
add_move_binding (widget_class, GDK_KEY_Home, 0,
GTK_MOVEMENT_DISPLAY_LINE_ENDS, -1);
@@ -1381,7 +1381,7 @@ gtk_text_class_init (GtkTextClass *class)
add_move_binding (widget_class, GDK_KEY_KP_End, 0,
GTK_MOVEMENT_DISPLAY_LINE_ENDS, 1);
add_move_binding (widget_class, GDK_KEY_Home, GDK_CONTROL_MASK,
GTK_MOVEMENT_BUFFER_ENDS, -1);
@@ -1405,7 +1405,7 @@ gtk_text_class_init (GtkTextClass *class)
GDK_KEY_slash, GDK_CONTROL_MASK,
(GtkShortcutFunc) gtk_text_select_all,
NULL);
/* Unselect all
/* Unselect all
*/
gtk_widget_class_add_binding_signal (widget_class,
GDK_KEY_backslash, GDK_CONTROL_MASK,
@@ -1427,7 +1427,7 @@ gtk_text_class_init (GtkTextClass *class)
gtk_widget_class_add_binding_signal (widget_class, GDK_KEY_KP_Enter, 0,
"activate",
NULL);
/* Deleting text */
gtk_widget_class_add_binding_signal (widget_class,
GDK_KEY_Delete, 0,
@@ -1438,7 +1438,7 @@ gtk_text_class_init (GtkTextClass *class)
GDK_KEY_KP_Delete, 0,
"delete-from-cursor",
"(ii)", GTK_DELETE_CHARS, 1);
gtk_widget_class_add_binding_signal (widget_class,
GDK_KEY_BackSpace, 0,
"backspace",
@@ -1464,7 +1464,7 @@ gtk_text_class_init (GtkTextClass *class)
GDK_KEY_KP_Delete, GDK_CONTROL_MASK,
"delete-from-cursor",
"(ii)", GTK_DELETE_WORD_ENDS, 1);
gtk_widget_class_add_binding_signal (widget_class,
GDK_KEY_BackSpace, GDK_CONTROL_MASK,
"delete-from-cursor",
@@ -2233,7 +2233,7 @@ gtk_text_unrealize (GtkWidget *widget)
GdkClipboard *clipboard;
gtk_text_reset_layout (self);
gtk_im_context_set_client_widget (priv->im_context, NULL);
clipboard = gtk_widget_get_primary_clipboard (widget);
@@ -2619,14 +2619,14 @@ gtk_text_get_pixel_ranges (GtkText *self,
if (ranges)
{
int *r = *ranges;
for (i = 0; i < real_n_ranges; ++i)
{
r[2 * i + 1] = (r[2 * i + 1] - r[2 * i]) / PANGO_SCALE;
r[2 * i] = r[2 * i] / PANGO_SCALE;
}
}
if (n_ranges)
*n_ranges = real_n_ranges;
}
@@ -3531,7 +3531,7 @@ gtk_text_update_cached_style_values (GtkText *self)
}
}
static void
static void
gtk_text_css_changed (GtkWidget *widget,
GtkCssStyleChange *change)
{
@@ -3809,7 +3809,7 @@ gtk_text_move_cursor (GtkText *self,
if (count <= 0)
new_pos = current_x < bound_x ? priv->current_pos : priv->selection_bound;
else
else
new_pos = current_x > bound_x ? priv->current_pos : priv->selection_bound;
}
break;
@@ -3919,7 +3919,7 @@ gtk_text_move_cursor (GtkText *self,
gtk_text_set_selection_bounds (self, priv->selection_bound, new_pos);
else
gtk_text_set_selection_bounds (self, new_pos, new_pos);
gtk_text_pend_cursor_blink (self);
}
@@ -3961,7 +3961,7 @@ gtk_text_delete_from_cursor (GtkText *self,
gtk_text_delete_selection (self);
return;
}
switch (type)
{
case GTK_DELETE_CHARS:
@@ -4595,7 +4595,7 @@ get_layout_position (GtkText *self,
y_pos = 0;
else if (y_pos + logical_rect.height > area_height)
y_pos = area_height - logical_rect.height;
y_pos = y_pos / PANGO_SCALE;
if (x)
@@ -4853,7 +4853,7 @@ gtk_text_find_position (GtkText *self,
int trailing;
const char *text;
int cursor_index;
layout = gtk_text_ensure_layout (self, TRUE);
text = pango_layout_get_text (layout);
cursor_index = g_utf8_offset_to_pointer (text, priv->current_pos) - text;
@@ -4891,7 +4891,7 @@ gtk_text_get_cursor_locations (GtkText *self,
{
if (strong_x)
*strong_x = 0;
if (weak_x)
*weak_x = 0;
}
@@ -4901,14 +4901,14 @@ gtk_text_get_cursor_locations (GtkText *self,
const char *text = pango_layout_get_text (layout);
PangoRectangle strong_pos, weak_pos;
int index;
index = g_utf8_offset_to_pointer (text, priv->current_pos + priv->preedit_cursor) - text;
pango_layout_get_cursor_pos (layout, index, &strong_pos, &weak_pos);
if (strong_x)
*strong_x = strong_pos.x / PANGO_SCALE;
if (weak_x)
*weak_x = weak_pos.x / PANGO_SCALE;
}
@@ -5135,7 +5135,7 @@ gtk_text_move_logically (GtkText *self,
do
new_pos++;
while (new_pos < length && !log_attrs[new_pos].is_cursor_position);
count--;
}
while (count < 0 && new_pos > 0)
@@ -5143,7 +5143,7 @@ gtk_text_move_logically (GtkText *self,
do
new_pos--;
while (new_pos > 0 && !log_attrs[new_pos].is_cursor_position);
count++;
}
}
@@ -5208,7 +5208,7 @@ gtk_text_move_backward_word (GtkText *self,
new_pos = start - 1;
/* Find the previous word boundary */
while (new_pos > 0 && !(log_attrs[new_pos].is_word_start ||
while (new_pos > 0 && !(log_attrs[new_pos].is_word_start ||
(log_attrs[new_pos].is_word_end && allow_whitespace)))
new_pos--;
}
@@ -5295,7 +5295,7 @@ paste_received (GObject *clipboard,
gtk_text_set_selection_bounds (self, pos, pos);
priv->insert_pos = -1;
}
if (priv->truncate_multiline)
length = truncate_multiline (text);
@@ -5329,7 +5329,7 @@ gtk_text_update_primary_selection (GtkText *self)
return;
clipboard = gtk_widget_get_primary_clipboard (GTK_WIDGET (self));
if (priv->selection_bound != priv->current_pos)
{
gdk_clipboard_set_content (clipboard, priv->selection_content);
@@ -5448,6 +5448,8 @@ gtk_text_set_buffer (GtkText *self,
buffer_connect_signals (self);
}
update_placeholder_visibility (self);
obj = G_OBJECT (self);
g_object_freeze_notify (obj);
g_object_notify_by_pspec (obj, text_props[PROP_BUFFER]);
@@ -5884,7 +5886,7 @@ PangoLayout *
gtk_text_get_layout (GtkText *self)
{
PangoLayout *layout;
g_return_val_if_fail (GTK_IS_TEXT (self), NULL);
layout = gtk_text_ensure_layout (self, TRUE);
@@ -6339,7 +6341,7 @@ gtk_text_drag_drop (GtkDropTarget *dest,
gtk_editable_insert_text (GTK_EDITABLE (self), str, length, &pos);
end_change (self);
}
return TRUE;
}
+6
View File
@@ -4713,6 +4713,12 @@ insert_tags_for_attributes (GtkTextBuffer *buffer,
#if PANGO_VERSION_CHECK(1, 49, 0)
case PANGO_ATTR_TEXT_TRANSFORM:
#endif
#if PANGO_VERSION_CHECK(1, 49, 1)
case PANGO_ATTR_WORD:
case PANGO_ATTR_SENTENCE:
case PANGO_ATTR_BASELINE_SHIFT:
case PANGO_ATTR_FONT_SCALE:
break;
#endif
+6
View File
@@ -224,6 +224,12 @@ action_chain (Action *action,
if (other->kind == ACTION_KIND_BARRIER)
{
/* If we're not in a user action, this barrier is meant to
* stop items from coallescing into this group.
*/
if (!in_user_action && action->u.group.depth == 0)
return FALSE;
action_free (other);
return TRUE;
}
+162 -20
View File
@@ -57,6 +57,7 @@
#include "gtknative.h"
#include "gtkwidgetprivate.h"
#include "gtkjoinedmenuprivate.h"
#include "gtkcssenumvalueprivate.h"
/**
* GtkTextView:
@@ -394,6 +395,8 @@ static void gtk_text_view_css_changed (GtkWidget *widget,
GtkCssStyleChange *change);
static void gtk_text_view_direction_changed (GtkWidget *widget,
GtkTextDirection previous_direction);
static void gtk_text_view_system_setting_changed (GtkWidget *widget,
GtkSystemSetting setting);
static void gtk_text_view_state_flags_changed (GtkWidget *widget,
GtkStateFlags previous_state);
@@ -570,6 +573,7 @@ static void gtk_text_view_update_im_spot_location (GtkTextView *text_view);
static void gtk_text_view_insert_emoji (GtkTextView *text_view);
static void update_node_ordering (GtkWidget *widget);
static void gtk_text_view_update_pango_contexts (GtkTextView *text_view);
/* GtkTextHandle handlers */
static void gtk_text_view_handle_drag_started (GtkTextHandle *handle,
@@ -816,6 +820,7 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
widget_class->map = gtk_text_view_map;
widget_class->css_changed = gtk_text_view_css_changed;
widget_class->direction_changed = gtk_text_view_direction_changed;
widget_class->system_setting_changed = gtk_text_view_system_setting_changed;
widget_class->state_flags_changed = gtk_text_view_state_flags_changed;
widget_class->measure = gtk_text_view_measure;
widget_class->size_allocate = gtk_text_view_size_allocate;
@@ -4981,7 +4986,6 @@ gtk_text_view_css_changed (GtkWidget *widget,
{
GtkTextView *text_view;
GtkTextViewPrivate *priv;
PangoContext *ltr_context, *rtl_context;
text_view = GTK_TEXT_VIEW (widget);
priv = text_view->priv;
@@ -4990,6 +4994,7 @@ gtk_text_view_css_changed (GtkWidget *widget,
if ((change == NULL ||
gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT |
GTK_CSS_AFFECTS_TEXT_ATTRS |
GTK_CSS_AFFECTS_BACKGROUND |
GTK_CSS_AFFECTS_CONTENT)) &&
priv->layout && priv->layout->default_style)
@@ -4997,16 +5002,13 @@ gtk_text_view_css_changed (GtkWidget *widget,
gtk_text_view_set_attributes_from_style (text_view,
priv->layout->default_style);
gtk_text_layout_default_style_changed (priv->layout);
}
ltr_context = gtk_widget_create_pango_context (widget);
pango_context_set_base_dir (ltr_context, PANGO_DIRECTION_LTR);
rtl_context = gtk_widget_create_pango_context (widget);
pango_context_set_base_dir (rtl_context, PANGO_DIRECTION_RTL);
gtk_text_layout_set_contexts (priv->layout, ltr_context, rtl_context);
g_object_unref (ltr_context);
g_object_unref (rtl_context);
if ((change == NULL ||
gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT)) &&
priv->layout)
{
gtk_text_view_update_pango_contexts (text_view);
}
}
@@ -5024,6 +5026,42 @@ gtk_text_view_direction_changed (GtkWidget *widget,
}
}
static void
gtk_text_view_update_pango_contexts (GtkTextView *text_view)
{
GtkWidget *widget = GTK_WIDGET (text_view);
GtkTextViewPrivate *priv = text_view->priv;
gboolean update_ltr, update_rtl;
if (!priv->layout)
return;
update_ltr = gtk_widget_update_pango_context (widget, priv->layout->ltr_context, GTK_TEXT_DIR_LTR);
update_rtl = gtk_widget_update_pango_context (widget, priv->layout->rtl_context, GTK_TEXT_DIR_RTL);
if (update_ltr || update_rtl)
{
GtkTextIter start, end;
gtk_text_buffer_get_bounds (get_buffer (text_view), &start, &end);
gtk_text_layout_invalidate (priv->layout, &start, &end);
gtk_widget_queue_draw (widget);
}
}
static void
gtk_text_view_system_setting_changed (GtkWidget *widget,
GtkSystemSetting setting)
{
if (setting == GTK_SYSTEM_SETTING_DPI ||
setting == GTK_SYSTEM_SETTING_FONT_NAME ||
setting == GTK_SYSTEM_SETTING_FONT_CONFIG)
{
gtk_text_view_update_pango_contexts (GTK_TEXT_VIEW (widget));
}
}
static void
gtk_text_view_state_flags_changed (GtkWidget *widget,
GtkStateFlags previous_state)
@@ -6162,7 +6200,7 @@ gtk_text_view_check_cursor_blink (GtkTextView *text_view)
static void
gtk_text_view_pend_cursor_blink (GtkTextView *text_view)
{
if (cursor_blinks (text_view))
if (cursor_blinks (text_view) && cursor_visible (text_view))
{
remove_blink_timeout (text_view);
add_blink_timeout (text_view, TRUE);
@@ -7633,6 +7671,29 @@ gtk_text_view_end_selection_drag (GtkTextView *text_view)
* Layout utils
*/
static PangoUnderline
get_pango_underline_from_style (GtkTextDecorationStyle style)
{
switch (style)
{
case GTK_CSS_TEXT_DECORATION_STYLE_DOUBLE:
return PANGO_UNDERLINE_DOUBLE;
case GTK_CSS_TEXT_DECORATION_STYLE_WAVY:
return PANGO_UNDERLINE_ERROR;
case GTK_CSS_TEXT_DECORATION_STYLE_SOLID:
default:
return PANGO_UNDERLINE_SINGLE;
}
g_return_val_if_reached (PANGO_UNDERLINE_SINGLE);
}
static PangoOverline
get_pango_overline_from_style (GtkTextDecorationStyle style)
{
return PANGO_OVERLINE_SINGLE;
}
static void
gtk_text_view_set_attributes_from_style (GtkTextView *text_view,
GtkTextAttributes *values)
@@ -7640,6 +7701,9 @@ gtk_text_view_set_attributes_from_style (GtkTextView *text_view,
GtkCssStyle *style;
const GdkRGBA black = { 0, };
const GdkRGBA *color;
const GdkRGBA *decoration_color;
GtkTextDecorationLine decoration_line;
GtkTextDecorationStyle decoration_style;
if (!values->appearance.bg_rgba)
values->appearance.bg_rgba = gdk_rgba_copy (&black);
@@ -7657,6 +7721,69 @@ gtk_text_view_set_attributes_from_style (GtkTextView *text_view,
pango_font_description_free (values->font);
values->font = gtk_css_style_get_pango_font (style);
values->letter_spacing = _gtk_css_number_value_get (style->font->letter_spacing, 100) * PANGO_SCALE;
/* text-decoration */
decoration_line = _gtk_css_text_decoration_line_value_get (style->font_variant->text_decoration_line);
decoration_style = _gtk_css_text_decoration_style_value_get (style->font_variant->text_decoration_style);
color = gtk_css_color_value_get_rgba (style->core->color);
decoration_color = gtk_css_color_value_get_rgba (style->font_variant->text_decoration_color
? style->font_variant->text_decoration_color
: style->core->color);
if (decoration_line & GTK_CSS_TEXT_DECORATION_LINE_UNDERLINE)
{
values->appearance.underline = get_pango_underline_from_style (decoration_style);
if (values->appearance.underline_rgba)
*values->appearance.underline_rgba = *decoration_color;
else
values->appearance.underline_rgba = gdk_rgba_copy (decoration_color);
}
else
{
values->appearance.underline = PANGO_UNDERLINE_NONE;
gdk_rgba_free (values->appearance.underline_rgba);
values->appearance.underline_rgba = NULL;
}
if (decoration_line & GTK_CSS_TEXT_DECORATION_LINE_OVERLINE)
{
values->appearance.overline = get_pango_overline_from_style (decoration_style);
if (values->appearance.overline_rgba)
*values->appearance.overline_rgba = *decoration_color;
else
values->appearance.overline_rgba = gdk_rgba_copy (decoration_color);
}
else
{
values->appearance.overline = PANGO_OVERLINE_NONE;
gdk_rgba_free (values->appearance.overline_rgba);
values->appearance.overline_rgba = NULL;
}
if (decoration_line & GTK_CSS_TEXT_DECORATION_LINE_LINE_THROUGH)
{
values->appearance.strikethrough = TRUE;
if (values->appearance.strikethrough_rgba)
*values->appearance.strikethrough_rgba = *decoration_color;
else
values->appearance.strikethrough_rgba = gdk_rgba_copy (decoration_color);
}
else
{
values->appearance.strikethrough = FALSE;
gdk_rgba_free (values->appearance.strikethrough_rgba);
values->appearance.strikethrough_rgba = NULL;
}
/* letter-spacing */
values->letter_spacing = _gtk_css_number_value_get (style->font->letter_spacing, 100) * PANGO_SCALE;
/* OpenType features */
g_free (values->font_features);
values->font_features = gtk_css_style_compute_font_features (style);
}
static void
@@ -7715,8 +7842,8 @@ gtk_text_view_ensure_layout (GtkTextView *text_view)
if (priv->layout == NULL)
{
GtkTextAttributes *style;
PangoContext *ltr_context, *rtl_context;
const GList *iter;
PangoContext *ltr_context, *rtl_context;
DV(g_print(G_STRLOC"\n"));
@@ -7749,15 +7876,15 @@ gtk_text_view_ensure_layout (GtkTextView *text_view)
priv->overwrite_mode && priv->editable);
ltr_context = gtk_widget_create_pango_context (GTK_WIDGET (text_view));
pango_context_set_base_dir (ltr_context, PANGO_DIRECTION_LTR);
rtl_context = gtk_widget_create_pango_context (GTK_WIDGET (text_view));
pango_context_set_base_dir (ltr_context, PANGO_DIRECTION_LTR);
pango_context_set_base_dir (rtl_context, PANGO_DIRECTION_RTL);
gtk_text_layout_set_contexts (priv->layout, ltr_context, rtl_context);
g_object_unref (ltr_context);
g_object_unref (rtl_context);
gtk_text_view_update_pango_contexts (text_view);
gtk_text_view_check_keymap_direction (text_view);
style = gtk_text_attributes_new ();
@@ -8310,17 +8437,32 @@ gtk_text_view_commit_text (GtkTextView *text_view,
{
GtkTextViewPrivate *priv;
gboolean had_selection;
GtkTextIter begin, end;
guint length;
priv = text_view->priv;
gtk_text_view_obscure_mouse_cursor (text_view);
gtk_text_buffer_begin_user_action (get_buffer (text_view));
had_selection = gtk_text_buffer_get_selection_bounds (get_buffer (text_view),
NULL, NULL);
gtk_text_buffer_delete_selection (get_buffer (text_view), TRUE,
priv->editable);
had_selection = gtk_text_buffer_get_selection_bounds (get_buffer (text_view), &begin, &end);
gtk_text_iter_order (&begin, &end);
length = gtk_text_iter_get_offset (&end) - gtk_text_iter_get_offset (&begin);
if (gtk_text_buffer_delete_selection (get_buffer (text_view), TRUE, priv->editable))
{
/* If something was deleted, create a second group for the insert. This
* ensures that there are two undo operations. One for the deletion, and
* one for the insertion of new text. However, if there is only a single
* character overwritten, that isn't very useful, just keep the single
* undo group.
*/
if (length > 1)
{
gtk_text_buffer_end_user_action (get_buffer (text_view));
gtk_text_buffer_begin_user_action (get_buffer (text_view));
}
}
if (!strcmp (str, "\n"))
{
+1 -1
View File
@@ -47,7 +47,7 @@
* etc. It supports autoplay, looping, and simple media controls. It does
* not have support for video overlays, multichannel audio, device
* selection, or input. If you are writing a full-fledged video player,
* you may want to use the [class@Gdk.Paintable] API and a media framework
* you may want to use the [iface@Gdk.Paintable] API and a media framework
* such as Gstreamer directly.
*/
+29 -19
View File
@@ -572,7 +572,7 @@ static void gtk_widget_pop_verify_invariants (GtkWidget
#define gtk_widget_pop_verify_invariants(widget)
#endif
static PangoContext* gtk_widget_peek_pango_context (GtkWidget *widget);
static void gtk_widget_update_pango_context (GtkWidget *widget);
static void gtk_widget_update_default_pango_context (GtkWidget *widget);
static void gtk_widget_propagate_state (GtkWidget *widget,
const GtkStateData *data);
static gboolean gtk_widget_real_mnemonic_activate (GtkWidget *widget,
@@ -4957,7 +4957,7 @@ gtk_widget_real_css_changed (GtkWidget *widget,
const gboolean has_text = gtk_widget_peek_pango_context (widget) != NULL;
if (has_text && gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT))
gtk_widget_update_pango_context (widget);
gtk_widget_update_default_pango_context (widget);
if (priv->root)
{
@@ -4980,7 +4980,7 @@ gtk_widget_real_css_changed (GtkWidget *widget,
}
else
{
gtk_widget_update_pango_context (widget);
gtk_widget_update_default_pango_context (widget);
if (priv->root)
gtk_widget_queue_resize (widget);
@@ -4997,7 +4997,7 @@ gtk_widget_real_system_setting_changed (GtkWidget *widget,
setting == GTK_SYSTEM_SETTING_FONT_NAME ||
setting == GTK_SYSTEM_SETTING_FONT_CONFIG)
{
gtk_widget_update_pango_context (widget);
gtk_widget_update_default_pango_context (widget);
if (gtk_widget_peek_pango_context (widget))
gtk_widget_queue_resize (widget);
}
@@ -6427,15 +6427,19 @@ gtk_widget_get_effective_font_map (GtkWidget *widget)
return pango_cairo_font_map_get_default ();
}
static void
update_pango_context (GtkWidget *widget,
PangoContext *context)
gboolean
gtk_widget_update_pango_context (GtkWidget *widget,
PangoContext *context,
GtkTextDirection direction)
{
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
GtkCssStyle *style = gtk_css_node_get_style (priv->cssnode);
PangoFontDescription *font_desc;
GtkSettings *settings;
cairo_font_options_t *font_options;
guint old_serial;
old_serial = pango_context_get_serial (context);
font_desc = gtk_css_style_get_pango_font (style);
pango_context_set_font_description (context, font_desc);
@@ -6444,9 +6448,10 @@ update_pango_context (GtkWidget *widget,
if (cairo_version () >= CAIRO_VERSION_ENCODE (1, 17, 4))
pango_context_set_round_glyph_positions (context, FALSE);
pango_context_set_base_dir (context,
_gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR ?
PANGO_DIRECTION_LTR : PANGO_DIRECTION_RTL);
if (direction != GTK_TEXT_DIR_NONE)
pango_context_set_base_dir (context, direction == GTK_TEXT_DIR_LTR
? PANGO_DIRECTION_LTR
: PANGO_DIRECTION_RTL);
pango_cairo_context_set_resolution (context, _gtk_css_number_value_get (style->core->dpi, 100));
@@ -6468,15 +6473,20 @@ update_pango_context (GtkWidget *widget,
}
pango_context_set_font_map (context, gtk_widget_get_effective_font_map (widget));
return old_serial != pango_context_get_serial (context);
}
static void
gtk_widget_update_pango_context (GtkWidget *widget)
gtk_widget_update_default_pango_context (GtkWidget *widget)
{
PangoContext *context = gtk_widget_peek_pango_context (widget);
if (context)
update_pango_context (widget, context);
if (!context)
return;
if (gtk_widget_update_pango_context (widget, context, _gtk_widget_get_direction (widget)))
gtk_widget_queue_draw (widget);
}
/**
@@ -6507,7 +6517,7 @@ gtk_widget_set_font_options (GtkWidget *widget,
options ? cairo_font_options_copy (options) : NULL,
(GDestroyNotify)cairo_font_options_destroy);
gtk_widget_update_pango_context (widget);
gtk_widget_update_default_pango_context (widget);
}
}
@@ -6536,7 +6546,7 @@ gtk_widget_set_font_map_recurse (GtkWidget *widget, gpointer user_data)
if (g_object_get_qdata (G_OBJECT (widget), quark_font_map))
return;
gtk_widget_update_pango_context (widget);
gtk_widget_update_default_pango_context (widget);
gtk_widget_forall (widget, gtk_widget_set_font_map_recurse, user_data);
}
@@ -6573,7 +6583,7 @@ gtk_widget_set_font_map (GtkWidget *widget,
g_object_ref (font_map),
g_object_unref);
gtk_widget_update_pango_context (widget);
gtk_widget_update_default_pango_context (widget);
gtk_widget_forall (widget, gtk_widget_set_font_map_recurse, NULL);
}
@@ -6616,7 +6626,7 @@ gtk_widget_create_pango_context (GtkWidget *widget)
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
context = pango_font_map_create_context (pango_cairo_font_map_get_default ());
update_pango_context (widget, context);
gtk_widget_update_pango_context (widget, context, _gtk_widget_get_direction (widget));
pango_context_set_language (context, gtk_get_default_language ());
return context;
@@ -7201,7 +7211,7 @@ gtk_widget_emit_direction_changed (GtkWidget *widget,
GtkTextDirection direction;
GtkStateFlags state;
gtk_widget_update_pango_context (widget);
gtk_widget_update_default_pango_context (widget);
direction = _gtk_widget_get_direction (widget);
@@ -10365,7 +10375,7 @@ gtk_widget_get_allocated_baseline (GtkWidget *widget)
* toplevel. The opacity value itself is not inherited by child
* widgets (since that would make widgets deeper in the hierarchy
* progressively more translucent). As a consequence, [class@Gtk.Popover]s
* and other [class@Gtk.Native] widgets with their own surface will use their
* and other [iface@Gtk.Native] widgets with their own surface will use their
* own opacity value, and thus by default appear non-translucent,
* even if they are attached to a toplevel that is translucent.
*/
+4
View File
@@ -370,6 +370,10 @@ void gtk_widget_update_orientation (GtkWidget *widget,
void gtk_widget_realize_at_context (GtkWidget *widget);
void gtk_widget_unrealize_at_context (GtkWidget *widget);
gboolean gtk_widget_update_pango_context (GtkWidget *widget,
PangoContext *context,
GtkTextDirection direction);
/* inline getters */
static inline GtkWidget *
+6 -8
View File
@@ -5796,16 +5796,14 @@ gtk_window_activate_menubar (GtkWidget *widget,
GtkWidget *focus;
GtkWidget *first;
focus = gtk_window_get_focus (window);
if (priv->title_box != NULL &&
(focus == NULL || !gtk_widget_is_ancestor (focus, priv->title_box)) &&
gtk_widget_child_focus (priv->title_box, GTK_DIR_TAB_FORWARD))
return TRUE;
tmp_menubars = gtk_popover_menu_bar_get_viewable_menu_bars (window);
if (tmp_menubars == NULL)
return FALSE;
{
focus = gtk_window_get_focus (window);
return priv->title_box != NULL &&
(focus == NULL || !gtk_widget_is_ancestor (focus, priv->title_box)) &&
gtk_widget_child_focus (priv->title_box, GTK_DIR_TAB_FORWARD);
}
menubars = g_ptr_array_sized_new (g_list_length (tmp_menubars));;
for (l = tmp_menubars; l; l = l->next)
+1 -1
View File
@@ -343,7 +343,7 @@ perform_titlebar_action (GtkWindowHandle *self,
gesture = GDK_TITLEBAR_GESTURE_RIGHT_CLICK;
break;
default:
break;
return FALSE;
}
if (gdk_toplevel_titlebar_gesture (GDK_TOPLEVEL (surface), gesture))

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