Compare commits

..

152 Commits

Author SHA1 Message Date
Matthias Clasen 10d075ee47 Steal enough Weston test code to show a yuv surface
This isn't mean to be mergable. It is just a quick hack
to get a yuv surface onscreen. It only runs under weston
atm, since mutter does not support yuv yet.
2022-06-08 15:36:11 -04:00
Matthias Clasen 9ec662dbba Flesh this out a bit 2022-06-08 14:53:34 -04:00
Matthias Clasen 5b6297e00f Add a quick subsurface test
Add a subsurface to a GTK toplevel,
and paint it green.
2022-06-08 14:53:34 -04:00
Matthias Clasen 27db4b5c2f node-editor: Add a zoom button
This is a bit more convenient than manually
adding a transform node in the text editor.
2022-06-07 13:39:22 -04:00
Hugo Carvalho 5abaee4f02 Update Portuguese translation 2022-06-07 13:54:09 +00:00
Yuri Chornoivan d2b6fef1f8 Update Ukrainian translation 2022-06-07 06:15:52 +00:00
Benjamin Otte a639aaefae Merge branch 'wip/otte/for-main' into 'main'
listview: cull listitems that are out of view

See merge request GNOME/gtk!4799
2022-06-07 01:36:06 +00:00
Benjamin Otte 39645d3258 listview: cull listitems that are out of view
Use set_child_visible(FALSE) on those widgets and don't allocate them.

This should usually be the majority of items, so it's quite a worthwhile
addition.

Idea by Ivan Molodetskikh.

Related: #3334
2022-06-07 03:20:11 +02:00
Matthias Clasen 526b62e0be Merge branch 'fix-ui-file-translation-main' into 'main'
Fix ui files to work for translations

Closes #4957

See merge request GNOME/gtk!4798
2022-06-06 22:45:44 +00:00
Matthias Clasen 19fb336c39 Fix ui files to work for translations
We need to keep using translatable="yes", since
that is what the installed its file is looking
for.

Fixes: #4957
2022-06-06 18:29:14 -04:00
Matthias Clasen 1f3674cf3e Merge branch 'matthiasc/for-main' into 'main'
gdk: Improve GdkTimeCoord docs

See merge request GNOME/gtk!4795
2022-06-06 13:12:15 +00:00
Matthias Clasen c76069389c gdk: Improve GdkTimeCoord docs 2022-06-06 08:55:51 -04:00
Danial Behzadi eef0c81be9 Update Persian translation 2022-06-06 08:13:32 +00:00
Aleksandr Melman c78eeaa874 Update Russian translation 2022-06-05 12:34:50 +00:00
Yuri Chornoivan 2766f61abc Update Ukrainian translation 2022-06-05 08:26:34 +00:00
Benjamin Otte 45422f7b61 Merge branch 'gl-api-es-fix' into 'main'
glcontext: Respect ES API when getting gl version from shared context

Closes #4763

See merge request GNOME/gtk!4687
2022-06-04 20:26:58 +00:00
Pablo Correa Gómez c4feca1311 glcontext: Simplify get_required_version api
Simplify the API to just return the requirements that the user
has asked for. The rest of the code was undocumented and previously
used as a buggy source for a default value from internal code.
Since the buggy code is now fixed, remove all unnecessary cruft.
2022-06-04 20:48:40 +02:00
Pablo Correa Gómez 9426b20759 glcontext: Do not check for correctness in set_required_version
There are two reasons for this:
 * First, the refactored realize code now makes sure that no
   context with unsupported version is ever created.
 * Second, this code could bump into false possitives and negatives, since
   the user is not requested, nor expected to set_required_version
   in any specific order relative to set_allowed_apis. Therefore,
   some version could be rejected or accepted based on a set of
   allowed apis that the user has not yet correctly configured.
2022-06-04 20:48:40 +02:00
Pablo Correa Gómez f97cff1454 glcontext-glx: Refactor realize function
Mimic the behavior of the egl context creation by stablishing
some sane logic for the api and version used. Split the decision
of the type of context (api, legacy) and the creation of a context
of a certain version and all its properties.
2022-06-04 20:48:40 +02:00
Pablo Correa Gómez 549a2b4c86 glcontext: Refactor realize function, fix interaction with shared context 2022-06-04 20:48:40 +02:00
Pablo Correa Gómez f4f0daa113 macosglcontext: Do not rely on default from get_required_version
get_required_version cannot warranty to return any default. Instead,
fetch the user requisites clipped by the requirements in our backend.
2022-06-04 20:48:40 +02:00
Pablo Correa Gómez d4f8a80f2a glcontext-win32-wgl: Respect user required version, use display as minimum
By setting and then getting the required version in a context, the code
was not respecting user requirements. Instead, simply get the requested
version by the user clipped by the requirements (display version)
2022-06-04 20:48:40 +02:00
Pablo Correa Gómez 8d175801d7 glcontext: Add internal get_clipped_version function
It is useful for backends to get user set preferences while
ensuring the correctness of the result, which will be always
greater or equal than the minimum version provided
2022-06-04 20:48:40 +02:00
Pablo Correa Gómez 6bc3ecbe56 glcontext: Improve get_version documentation 2022-06-04 20:48:29 +02:00
Matthias Clasen 31da5f7e2a Merge branch 'expand-builtin-icontheme' into 'main'
Add more directories to the builtin hicolor index

Closes #4960

See merge request GNOME/gtk!4786
2022-06-04 10:44:48 +00:00
Matthias Clasen 48228efe42 Merge branch 'wip/carlosg/activation-roundtrip-fix' into 'main'
gdk/wayland: Check the GdkSurface wl_surface before using it for activation

Closes gnome-control-center#1862

See merge request GNOME/gtk!4789
2022-06-02 21:24:10 +00:00
Carlos Garnacho 4b41d4f78c gdk/wayland: Check the GdkSurface wl_surface before using it for activation
Double check the GdkSurface has a wl_surface before using it as the activation
token source, since we cannot use NULL surfaces here.

Fixes: https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1862
2022-06-02 23:08:40 +02:00
Carlos Garnacho fb68600d88 gdk/wayland: Dispatch GdkAppLaunchContext activation token in its own queue
Use a separate queue to dispatch the token object exclusively, just like we
do on the GdkSurface activation paths.
2022-06-02 23:08:40 +02:00
Matthias Clasen 0e6a3ab397 Merge branch 'ebassi/a11y-text-extents' into 'main'
a11y: Implement atspi.Text.GetCharacterExtents for GtkTextView

See merge request GNOME/gtk!4754
2022-06-02 17:13:53 +00:00
Carlos Garnacho e895f7dd70 a11y: Transform GetCharacterExtents coords to native surface ones
These coordinates are "window"-relative, so transform textview coordinates
to the coordinate system of the GtkNative containing it.
2022-06-02 14:35:53 +02:00
Matthias Clasen dae892d8f6 Add more directories to the builtin hicolor index
We haven't had any scalable directories in this list.
Add some. Since we seem to have settled on including
just actions and status as subdirectories for each
size, add scalable/actions and scalable/status.

Fixes: #4960
2022-06-02 06:38:12 -04:00
Matthias Clasen ad5c3168a9 Merge branch 'wip/chergert/GTK_DEBUG_TEXT_DIR' into 'main'
main: add GTK_DEBUG_TEXT_DIR environment variable

See merge request GNOME/gtk!4768
2022-06-01 18:54:54 +00:00
Christian Hergert 8f1db27b6b gtkmain: add support for GTK_DEBUG=invert-text-dir
This allows inverting the default text-direction in an application for
debugging, testing, and QA purposes. IDEs such as Builder may automate this
to encourage more application developers to test with a text-direction
different than their own.
2022-06-01 11:26:44 -07:00
Matthias Clasen 56a1cbe217 Merge branch 'wip/chergert/fix-lookup-with-interfaces' into 'main'
builderparser: fix <lookup/> with interface types

See merge request GNOME/gtk!4782
2022-06-01 00:13:44 +00:00
Christian Hergert 63e9e7e899 builderparser: fix <lookup/> with interface types
If we have a <lookup name="foo" type="SomeInterface"> a runtime warning
would be emitted and the expression would fail to be created. This is
because the interfaces will likely be a GObject as well, meaning we check
the object type branch instead of the interface.

Instead, we need to use the fundamental type like other parts of the
expression system use.
2022-05-31 15:58:21 -07:00
Matthias Clasen 480a933546 Merge branch 'matthiasc/for-main' into 'main'
shortcutcontroller: Fix a typo

See merge request GNOME/gtk!4778
2022-05-30 21:05:34 +00:00
Matthias Clasen 2623c396cb shortcutcontroller: Fix a typo 2022-05-30 16:27:03 -04:00
Pablo Correa Gómez 826fdc4a80 glcontext: Improve documentation on get_use_es api 2022-05-30 20:48:47 +02:00
Carlos Garnacho 3b088281ca Merge branch 'gesture-click-unpaired-release-nullable-sequence' into 'main'
Mark sequence parameter in GtkGestureClick::unpaired-release signal as nullable

See merge request GNOME/gtk!4777
2022-05-30 09:55:29 +00:00
Sebastian Dröge e61aecd67e Mark sequence parameter in GtkGestureClick::unpaired-release signal as nullable 2022-05-30 11:33:59 +03:00
Aurimas Černius bd68339390 Updated Lithuanian translation 2022-05-29 23:05:31 +03:00
Matthias Clasen 491d1f67c7 Merge branch 'fix-tests-with-recent-glib' into 'main'
Avoid g_log_set_writer_func in tests

See merge request GNOME/gtk!4772
2022-05-28 15:34:13 +00:00
Matthias Clasen 73dc741a82 Avoid g_log_set_writer_func in tests
It is not usable anymore since GLib 2.72.
2022-05-28 10:43:26 -04:00
Luming Zh 38ec040fce Update Chinese (China) translation 2022-05-28 01:52:42 +00:00
Matthias Clasen 6bb1873183 Merge branch 'headerbar-demo-upgrade' into 'main'
Make our demos more likable

See merge request GNOME/gtk!4769
2022-05-27 22:18:26 +00:00
Matthias Clasen 5ba5693efd Make our demos more likable
Nobody likes Facebook.
Everybody loves the Eagles.
2022-05-27 17:34:55 -04:00
Matthias Clasen 797cc2e91b Merge branch 'wayland-cursor-scale2' into 'main'
wayland: scale cursors to the right size

See merge request GNOME/gtk!4766
2022-05-27 16:47:38 +00:00
Matthias Clasen 5507b3f8c1 wayland: scale cursors to the right size
When loading cursors at scale, we expect the
cursor images to have a size of scale * size.
If we don't find such images, load them at their
unscaled size and scale them up ourselves.

Without this, cursors will appear in unexpected
sizes depending on scales and themes.

Related: #4746
2022-05-27 12:26:45 -04:00
Matthias Clasen f9a3f13702 Merge branch 'main' into 'main'
GtkIMContextSimple: array bounds was not correctly checked

Closes #4771

See merge request GNOME/gtk!4748
2022-05-27 14:24:54 +00:00
Matthias Clasen b4c72ac508 Merge branch 'use-flathub-link' into 'main'
Make the formatted link more neutral

See merge request GNOME/gtk!4765
2022-05-27 14:10:47 +00:00
Matthias Clasen bcad305136 Make the formatted link more neutral
There have been complaints about company names in
our demos. Lets use something else.

Part of: #4716
2022-05-27 08:43:06 -04:00
Matthias Clasen 00d45c6743 Merge branch 'update-initial-layout' into 'main'
vulkan: Set initial layout to undefined

See merge request GNOME/gtk!4706
2022-05-27 12:26:24 +00:00
Matthias Clasen 38b393ff5d Merge branch 'update-command-buffer-freeing' into 'main'
vulkan: Don't attempt to free 0 command buffers

See merge request GNOME/gtk!4705
2022-05-27 12:25:48 +00:00
Matthias Clasen 23f92ca1c2 Merge branch 'wayland-cursor-scale' into 'main'
wayland: Sanity check cursor image size

Closes #4746

See merge request GNOME/gtk!4761
2022-05-27 10:58:12 +00:00
Matthias Clasen 34a9bc4632 wayland: Make cursors have the right size
The Wayland protocol requires that width and height
of cursor surfaces is an integer multiple of the
surface scale. Make it so.

Fixes: #4746
2022-05-26 22:29:37 -04:00
Matthias Clasen d603164ec2 wayland: Sanity check cursor image size
On Wayland it is a protocol violation to upload buffers with
dimensions that are not an integer multiple of the buffer scale.

Until recently, Mutter did not enforce this. When it started
doing so, some users started seeing crashes in GTK apps because the
cursor theme ended up with e.g. a 15x16 pixel image at scale of 2.

Add a small sanity check for this case.
2022-05-26 22:29:37 -04:00
Matthias Clasen a033e838b2 Merge branch 'TTMaZa-LGPL-vs-GPL' into 'main'
GDK is LGPL-2.1-or-later not GPL-2.1-or-later, right?

See merge request GNOME/gtk!4755
2022-05-26 12:23:56 +00:00
Matthias Clasen 511a2f4d03 Merge branch 'wip/chergert/fix-sysprof-wrapper' into 'main'
build: fix sysprof default options

See merge request GNOME/gtk!4759
2022-05-26 11:43:56 +00:00
Matthias Clasen c089912a52 Merge branch 'wip/otte/for-main' into 'main'
x11: Always update shadow size

Closes #4136

See merge request GNOME/gtk!4758
2022-05-26 10:03:39 +00:00
Christian Hergert 2694d81d63 build: fix sysprof default options
Sysprof just recently cleaned up it's meson_options.txt and this makes
the tracking of the master branch match the new values.
2022-05-25 22:52:34 -07:00
Benjamin Otte 213490099b x11: Always update shadow size
Not updating shadow size unconditionally would lead to shadow size not
being set on map, which would lead mutter to think that we are a Window
without extents and then become confused when we suddenly set some.

Make sure that doesn't happen by always having shadows set on map, just
like GTK3.

Fixes #4136
2022-05-26 04:38:29 +02:00
Emmanuele Bassi 166af48904 Merge branch 'fix-stack-page-at-spi-parent' into 'main'
a11y: Realize GtkStackPage parent context before trying to get a ref

Closes #4944

See merge request GNOME/gtk!4757
2022-05-25 14:29:41 +00:00
Sebastian Keller 6e3dbc42a8 a11y: Realize GtkStackPage parent context before trying to get a ref
If a context is not realized, calling gtk_at_spi_context_to_ref() will
return a null ref, because its path has not been initialized yet. This
was already done for all other cases in get_parent_context_ref(), but
was missing for the GtkStackPage case.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4944
2022-05-25 14:56:05 +02:00
Matthias Clasen 36fbbfc5c7 Merge branch 'pkgconfig' into 'main'
Meson: Simplify pkgconfig file generator

See merge request GNOME/gtk!4756
2022-05-24 16:46:18 +00:00
Luca Bacci 9bfc89e23d Merge branch 'remove-emulated-scroll-events' into 'main'
Drop pointer_emulated discrete scroll events

See merge request GNOME/gtk!4694
2022-05-24 15:26:24 +00:00
Xavier Claessens 802bf41999 Meson: Simplify pkgconfig file generator
Meson knows all private dependencies itself when passing the library as
first positional argument, no need to specify them manually. Also
simplify backend specific files by simply requiring gtk4, just like
unix-print already did.

This should fix generated gtk4-uninstalled.pc, see Meson bug report:
https://github.com/mesonbuild/meson/issues/10415
2022-05-24 10:30:58 -04:00
Manuel Zabelt 93636d4c5a Update docs/reference/gdk/gdk4-x11.toml.in 2022-05-24 13:37:43 +00:00
Manuel Zabelt 88f761f2c8 GDK is LGPL-2.1-or-later not GPL-2.1-or-later, right? 2022-05-24 13:36:07 +00:00
Luca Bacci 7752467847 Drop pointer_emulated discrete scroll events
GTK4 has had smooth scroll events since the beginning, so we
prefer not to emit emulated discrete scroll events at all
2022-05-24 12:30:49 +00:00
Luca Bacci 8514457d0f Wayland: Only send smooth scroll events for tablet tools 2022-05-24 12:30:49 +00:00
Luca Bacci c0d79aa1ef Merge branch 'scroll-surface-unit-dpi-scale' into 'main'
DirectManipulation: Account for DPI scale

See merge request GNOME/gtk!4749
2022-05-24 12:19:39 +00:00
Luca Bacci 8a6d6fe6b1 DirectManipulation: Account for DPI scale 2022-05-24 11:37:06 +02:00
Emmanuele Bassi 7750a2c423 a11y: Implement atspi.Text.GetCharacterExtents for GtkTextView
Retrieve the location of a given offset in window-relative coordinate
space.
2022-05-23 15:54:13 +01:00
Matthias Clasen 393893b8db Merge branch 'blink-assertion' into 'main'
Remove an assertion that we hit

See merge request GNOME/gtk!4753
2022-05-23 14:08:43 +00:00
Matthias Clasen 4f16242807 Merge branch 'otte-main-patch-30652' into 'main'
gesturedrag: Fix docs

See merge request GNOME/gtk!4752
2022-05-23 12:43:25 +00:00
Matthias Clasen e82fb8e894 Merge branch 'ci-meson-bump' into 'main'
CI: bump meson version from 0.59 to 0.60.3

See merge request GNOME/gtk!4751
2022-05-23 12:33:30 +00:00
Matthias Clasen b3e65bfdc1 Remove an assertion that we hit
It appears that we mess up accounting for blinking
cursors sometimes, and can hit blink_cb when there
is a nonempty selection.

Instead of asserting, warn and stop blinking.

Related: #4767
2022-05-23 08:28:00 -04:00
Aleksandr Melman 111daecd3b Update Russian translation 2022-05-23 12:25:59 +00:00
Benjamin Otte 72fe406c4d gesturedrag: Fix docs
Leftover from GTK3. Coordinates are widget relative everywhere now.
2022-05-22 12:45:28 +00:00
Christian Kirbach 0f01629ce3 Update German translation
(cherry picked from commit 7703aa5cd3)
2022-05-22 10:41:21 +00:00
Christoph Reiter 2f695388e9 CI: bump meson version from 0.59 to 0.60.3
We pull in glib main via a submodule in CI and glib has recently
bumped its meson requirement to >= 0.60:
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2641

Install 0.60.3 where needed to make things build again.
2022-05-22 11:46:54 +02:00
Víctor Marzo 3955633aa8 GtkIMContextSimple: array bounds was not correctly checked
Fixes #4771
2022-05-19 11:35:14 +02:00
Luca Bacci f77f941401 Merge branch 'fix-memory-leak' into 'main'
GdkWin32: Plug memory leak

See merge request GNOME/gtk!4747
2022-05-19 09:05:50 +00:00
Luca Bacci 288dd406e0 GdkWin32: Plug memory leak 2022-05-19 08:49:05 +02:00
Benjamin Otte 8667b7a46c Merge branch 'wip/otte/for-main' into 'main'
nodeparser: Fix parsing of color-matrix node

See merge request GNOME/gtk!4745
2022-05-18 21:08:46 +00:00
Benjamin Otte 0410125f20 nodeparser: Fix parsing of color-matrix node
Negative offsets in the color matrix were inverted because it used the
rect parser.
2022-05-18 21:16:33 +02:00
Benjamin Otte 1ea0de61e1 Merge branch 'wip/otte/for-main' into 'main'
CI: Include reftest nodes in artifacts

See merge request GNOME/gtk!4743
2022-05-18 18:27:29 +00:00
Benjamin Otte e8eb96ae0c CI: Include reftest nodes in artifacts 2022-05-18 19:54:34 +02:00
Hugo Carvalho 04f924c13e Update Portuguese translation 2022-05-18 14:54:31 +00:00
Matthias Clasen 1fbca7a76a Merge branch 'let_selectable_label_mnemonic_self_focus' into 'main'
Allow selectable labels contents to be selected by mnemonic

See merge request GNOME/gtk!4741
2022-05-18 13:55:33 +00:00
Caolán McNamara 3f49d335d1 Allow selectable labels contents to be selected by mnemonic
expecially by the mnemonic of another label that targets it.

https://gitlab.gnome.org/GNOME/gtk/-/issues/4927

see also https://bugs.documentfoundation.org/show_bug.cgi?id=137748
2022-05-18 12:40:40 +01:00
Jordi Mas 3882e14053 Update Catalan translation 2022-05-18 13:32:32 +02:00
Matthias Clasen 5f5fda911d Merge branch 'wip/chergert/fix-4934' into 'main'
checkbutton: fix critical when setting use-underline

Closes #4934

See merge request GNOME/gtk!4740
2022-05-18 01:34:47 +00:00
Christian Hergert b9574e119b checkbutton: fix critical when setting use-underline
This needs to make sure that we've created the label before applying the
setting on a child widget.

Fixes #4934
2022-05-17 12:28:25 -07:00
Benjamin Otte 5f469a0d2d Merge branch 'wip/otte/for-main' into 'main'
testsuite: Add tests for label overdraw

See merge request GNOME/gtk!4737
2022-05-17 00:19:01 +00:00
Benjamin Otte ffd3801b1d testsuite: Add tests for label overdraw
This brings back a subset of what quit-mnemonic.ui tested for, but
trying a lot harder to trigger the label overdrawing its allocation,
which will cause the text to be cut off when clipping is happening.

It should not be an issue at all with GTK4, but keeping that test around
is a good idea.
2022-05-17 00:14:19 +02:00
Matthias Clasen fd21df7244 Merge branch 'wip/chergert/fix-4625' into 'main'
gsk/gl: use critical instead of assert in dispose

Closes #4625

See merge request GNOME/gtk!4736
2022-05-16 20:27:53 +00:00
Christian Hergert 654d74bfb8 gsk/gl: use critical instead of assert in dispose
Instead of asserting only in debug builds (which are generally not
shipped in distributions) we should deliver a critical log-level message
so that these can be found sooner when not developing with jhbuild,
Flatpak, etc.

Also assert that we've setup the state correctly when realizing the
GskGLRenderer object.

Fixes #4625
2022-05-16 10:50:48 -07:00
Fran Dieguez a26c72ef79 Update Galician translation 2022-05-16 07:58:59 +00:00
Danial Behzadi 6b55a14429 Update Persian translation 2022-05-16 07:38:02 +00:00
Matthias Clasen bc241d62af Merge branch 'wip/sophie-h/remove-properties-translation' into 'main'
l10n: Remove po/pot for dropped nicks/blurbs

See merge request GNOME/gtk!4718
2022-05-16 00:14:28 +00:00
Matthias Clasen 2b2894490f Merge branch 'hb-dependency' into 'main'
Add an explicit harfbuzz dependency

See merge request GNOME/gtk!4732
2022-05-15 16:34:19 +00:00
Matthias Clasen c0747f2c2e Add an explicit harfbuzz dependency
We are using Harfbuzz api in the file chooser,
so lets make this official.
2022-05-15 10:37:24 -04:00
Luca Bacci b34beb9380 Merge branch 'gdk-win32-direct-manipulation' into 'main'
GdkWin32: Add support for DirectManipulation

See merge request GNOME/gtk!4698
2022-05-15 12:55:22 +00:00
Luca Bacci 8f19099f1a GdkWin32: Add support for DirectManipulation
Adds support for Precision TouchPads (PTPs) gestures
and scroll events.
2022-05-15 14:37:55 +02:00
Piotr Drąg db2516af0a Update Polish translation 2022-05-15 14:04:06 +02:00
Emin Tufan Çetin bd07f846ef Update Turkish translation 2022-05-15 11:14:27 +00:00
Danial Behzadi d938352fb3 Update Persian translation
(cherry picked from commit 2b1c09dd42)
2022-05-15 06:30:32 +00:00
Matthias Clasen 13eef432fc Merge branch 'ci-update' into 'main'
ci: Update the Fedora image to Fedora 36

See merge request GNOME/gtk!4730
2022-05-14 21:59:09 +00:00
Matthias Clasen 1b355ff2e0 Drop the quit-mnemonic reftest
I can't quite figure out what this test was meant
to test, and how to make it do so in a way that
does not fall afoul of rendering issues in the GL
renderer and rounding differences in pango.

Can't win with reftests.
2022-05-14 17:03:37 -04:00
Matthias Clasen aa9a8702e4 ci: Update the Fedora image to Fedora 36
Also remove systemtap from the image, since
we don't need it.

The v36 image is still used in gtk-4-6.
2022-05-14 12:23:02 -04:00
Benjamin Otte ab2109ea6b Merge branch 'wip/otte/for-main' into 'main'
listitemmanager: Clarify warning

See merge request GNOME/gtk!4731
2022-05-14 15:28:09 +00:00
Benjamin Otte 926eb161f8 broadway: Fix gcc 12 complaining 2022-05-14 16:53:44 +02:00
Benjamin Otte 61bb9bb935 listitemmanager: Clarify warning
Lars doesn't have an opinion on this problem anymore.

And when people see this warning, they should know what to do.
2022-05-14 16:53:44 +02:00
Matthias Clasen 8f55a014b1 Merge branch 'matthiasc/for-main' into 'main'
Cosmetic fixes to objcopy hack

See merge request GNOME/gtk!4729
2022-05-14 12:48:40 +00:00
Yuri Chornoivan c3e5d80853 Update Ukrainian translation 2022-05-14 12:22:13 +00:00
Matthias Clasen 8bd77441a9 Cosmetic fixes to objcopy hack
Preserve the elf section name that we would get
without the objcopy hack. Minimizing the differences
2022-05-14 07:53:47 -04:00
Anders Jonsson a2af794cb0 Update Swedish translation
(cherry picked from commit 2d8a8e3575)
2022-05-14 10:03:38 +00:00
Matthias Clasen 0c86b28828 Merge branch 'texture-serialize-tiff' into 'main'
gsk: Serialize textures as tiff

See merge request GNOME/gtk!4725
2022-05-13 17:06:46 +00:00
Matthias Clasen 4278e91a46 Merge branch 'texture-fixes' into 'main'
Fixes for gdk_memory_texture_new_subtexture

See merge request GNOME/gtk!4724
2022-05-13 16:38:45 +00:00
Matthias Clasen dd16d7c4c8 gsk: Serialize float textures as tiff
Otherwise, we lose precision when converting them
to 16bit integers.
2022-05-13 12:34:24 -04:00
Matthias Clasen 6164908bd3 Add tests for gdk_memory_texture_new_subtexture
This checks the fixes in the previous commit.
2022-05-13 11:44:11 -04:00
Matthias Clasen 2ff98dad03 Merge branch 'file-chooser-widget-make-key-controller-on-external-entry-work-at-bubble-phase' into 'main'
GtkFileChooserWidget: Propagate keys from external entry to fcwidget at the BUBBLE phase

Closes #4905

See merge request GNOME/gtk!4723
2022-05-13 14:53:23 +00:00
Matthias Clasen f33c521836 Fixes for gdk_memory_texture_new_subtexture
There were several mistakes here.

The width of subtextures was set to the width of
the main texture, the data size wasn't properly
calculated, and the preconditions were inverted.
Yay us!
2022-05-13 09:30:46 -04:00
Luca Bacci e1159dab93 GtkFileChooserWidget: Propagate keys from external entry to fcwidget at the BUBBLE phase
Now that we use event controllers we can forward keybindings from the
external entry to the filechooserwidget at the bubble phase.

Fixes #4905

References:
 * commit 1fb075dbca
 * commit 686116ba61
2022-05-13 14:19:14 +02:00
Matthias Clasen c4f423694f Merge branch 'egl-format-string' into 'main'
egl: Fix invalid format string

See merge request GNOME/gtk!4722
2022-05-12 15:25:29 +00:00
Loïc Minier 4f2b1b3cfc egl: Fix invalid format string 2022-05-12 09:06:20 -04:00
Matthias Clasen 122fa679a8 Merge branch 'wip/sophie-h/remove-param-nicks-blurbs' into 'main'
gtk: Remove all nicks and blurbs from param specs

Closes #4904

See merge request GNOME/gtk!4717
2022-05-12 02:18:02 +00:00
Matthias Clasen 7302407880 Merge branch 'wip/exalm/color-scales' into 'main'
Redesign GtkColorScale

See merge request GNOME/gtk!4720
2022-05-12 02:01:03 +00:00
Matthias Clasen 900a23e2bb Merge branch 'wip/chergert/action-critical-fixes' into 'main'
various action muxer correctness fixes

See merge request GNOME/gtk!4719
2022-05-12 01:53:48 +00:00
Alexander Mikhaylenko 0f7d93492d theme: Redesign color scales
See https://gitlab.gnome.org/GNOME/libadwaita/-/issues/469

Since this style needs changes in color scales themselves, it makes sense
to have it in GTK as well.
2022-05-12 02:22:52 +04:00
Alexander Mikhaylenko aee4475c0f range: Support border-radius for GtkColorScale troughs
With how this hack is organized, it's simpler to add more code here than
to pass it to GtkColorScale itself.
2022-05-12 02:21:51 +04:00
Alexander Mikhaylenko 1f61cb2251 coloreditor: Stop adding marks style to color scales 2022-05-12 02:21:34 +04:00
Christian Hergert 0382e3b46c actionmuxer: check for observer before unregistering
This can happen if the group can be resolved even when doing the initial
registration of an action as observer will not yet be in the GSList of
watchers (and therefore has no weak references).

Fixes a warning like the following:

 g_object_weak_unref: couldn't find weak ref
2022-05-11 14:43:31 -07:00
Christian Hergert 547b2891cb actionmuxer: set handler ids initially to zero
These were getting created with possible non-zero values and then inserted
into a hashtable where the readers may not know the state of the group.

Ensure those values are set to zero until we assign them below.
2022-05-11 14:43:24 -07:00
Sophie Herold 89614f5f72 inspector: Stop using blurb as tooltip
Does not make sense any longer if we don't set blurbs.
2022-05-11 18:16:44 +02:00
Sophie Herold f5fc71fe82 tests: Check for nicks and blurbs not being set 2022-05-11 18:16:44 +02:00
Sophie Herold a546ae32d7 Remove all nicks and blurbs from param specs
Those property features don't seem to be in use anywhere.
They are redundant since the docs cover the same information
and more. They also created unnecessary translation work.

Closes #4904
2022-05-11 18:16:29 +02:00
Sophie Herold 17578a97d6 l10n: Remove po/pot for dropped nicks/blurbs 2022-05-11 17:36:07 +02:00
Matthias Clasen 9536eb654b Merge branch 'fix-wayland-glitching-v2' into 'main'
gdk/wayland: freeze popups when hidden 2

See merge request GNOME/gtk!4712
2022-05-10 19:32:16 +00:00
Pablo Correa Gómez 0f21f6c273 glcontext: Make the creation of EGL context more obvious
By splitting it into its own function it becomes more that the
EGL code is a shared implementation.
2022-05-10 12:29:08 +02:00
Christian Hergert 4bf07aeef9 gdk/wayland: freeze popups when hidden
Previously, there was an issue with glitching after showing/hiding a
popover that was not also destroyed. This was due to the popover having
an update_freeze_count of zero after hiding the surface.

That resulted in it's toplevel continuously dropping frames such as during
high-frame-rate scrolling in textviews. This problem is much more visible
on high-frame-rate displays such as 120hz/144hz.

With this commit, we freeze the frame clock of the popup until it is
mapped again.
2022-05-10 07:28:25 +03:00
Pawan Chitrakar 26b250503d Update Nepali translation
(cherry picked from commit f60e5950dc)
2022-05-09 10:44:46 +00:00
Matthias Clasen 8533824084 Merge branch 'add-gtk-dropdown-buildable-example' into 'main'
dropdown: Add GtkBuildable doc

See merge request GNOME/gtk!4708
2022-05-08 22:15:32 +00:00
Sonny Piers 5a0d6e3fc8 dropdown: Add UI definition example 2022-05-08 22:52:05 +02:00
Pawan Chitrakar 6be466b675 Update Nepali translation
(cherry picked from commit 5ae37c6d99)
2022-05-08 08:44:59 +00:00
TestingPlant 1c587c7d7f vulkan: Set initial layout to undefined
Having the initial layout set to VK_IMAGE_LAYOUT_GENERAL causes issues
when going from the final layout to the initial layout since the image
layout is expected to be the general layout. Setting the initial layout
to undefined doesn't have this restriction.
2022-05-08 05:39:36 +00:00
TestingPlant 2f98de06bc vulkan: Don't attempt to free 0 command buffers
vkFreeCommandBuffers can't be called with commandBufferCount set to 0.
2022-05-08 05:37:14 +00:00
Matthias Clasen 9e6855cdb8 Merge branch 'matthiasc/for-main' into 'main'
printdialog: Handle nonexisting files better

See merge request GNOME/gtk!4702
2022-05-08 00:51:08 +00:00
Matthias Clasen a6c3e440f6 printdialog: Handle nonexisting files better
When a non-existing file is selected in the file chooser
for print-to-file, we weren't updating the button label
to show the new filename. Fix that.

Also, use newer file chooser api.
2022-05-07 20:31:46 -04:00
Matthias Clasen 08d386844a 4.7.0 2022-05-07 11:59:38 -04:00
Matthias Clasen 48e98d333e NEWS: Updates 2022-05-07 11:45:31 -04:00
489 changed files with 13238 additions and 1021907 deletions
+3 -2
View File
@@ -25,7 +25,7 @@ variables:
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:v36"
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v38"
FLATPAK_IMAGE: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master"
.only-default:
@@ -58,6 +58,7 @@ style-check-diff:
- "${CI_PROJECT_DIR}/_build/report*.xml"
- "${CI_PROJECT_DIR}/_build/report*.html"
- "${CI_PROJECT_DIR}/_build/testsuite/reftests/output/*/*.png"
- "${CI_PROJECT_DIR}/_build/testsuite/reftests/output/*/*.node"
- "${CI_PROJECT_DIR}/_build/testsuite/tools/output/*/*"
- "${CI_PROJECT_DIR}/_build/testsuite/gsk/compare/*/*/*.png"
- "${CI_PROJECT_DIR}/_build/testsuite/css/output/*/*.syscap"
@@ -172,7 +173,7 @@ macos:
needs: []
before_script:
- bash .gitlab-ci/show-info-osx.sh
- pip3 install --user meson==0.59
- pip3 install --user meson==0.60.3
- pip3 install --user ninja
- export PATH=/Users/gitlabrunner/Library/Python/3.7/bin:$PATH
- export MESON_FORCE_BACKTRACE=1
+3
View File
@@ -14,6 +14,9 @@ Each Docker image has a tag composed of two parts:
See the [container registry][registry] for the available images for each
branch, as well as their available versions.
Note that using `latest` as version number will overwrite the most
recently uploaded image in the registry.
### Checklist for Updating a CI image
- [ ] Update the `${image}.Dockerfile` file with the dependencies
+1 -2
View File
@@ -1,4 +1,4 @@
FROM fedora:34
FROM fedora:36
RUN dnf -y install \
adwaita-icon-theme \
@@ -87,7 +87,6 @@ RUN dnf -y install \
python3-wheel \
redhat-rpm-config \
sassc \
systemtap-sdt-devel \
vulkan-devel \
wayland-devel \
wayland-protocols-devel \
+4
View File
@@ -185,6 +185,8 @@ ul.images li {
<li><img alt="ref" src="{{ failure.image_data.ref }}" /></li>
<li><img alt="out" src="{{ failure.image_data.out }}" /></li>
<li><img alt="diff" src="{{ failure.image_data.diff }}" /></li>
<li><a href="{{ failure.image_data.refnode }}">ref node</a></li>
<li><a href="{{ failure.image_data.outnode }}">out node</a></li>
</ul>
{% endif %}
</li>
@@ -311,6 +313,8 @@ for line in args.infile:
image_data = {
'ref': os.path.join(args.reftest_output_dir, '{}.ref.png'.format(basename)),
'out': os.path.join(args.reftest_output_dir, '{}.out.png'.format(basename)),
'refnode': os.path.join(args.reftest_output_dir, '{}.ref.node'.format(basename)),
'outnode': os.path.join(args.reftest_output_dir, '{}.out.node'.format(basename)),
'diff': os.path.join(args.reftest_output_dir, '{}.diff.png'.format(basename)),
}
+1 -1
View File
@@ -5,7 +5,7 @@ call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliar
@echo on
:: FIXME: make warnings fatal
pip3 install --upgrade --user meson==0.59 || goto :error
pip3 install --upgrade --user meson==0.60.3 || goto :error
meson -Ddebug=false -Dmedia-gstreamer=disabled _build || goto :error
ninja -C _build || goto :error
+150
View File
@@ -1,3 +1,153 @@
Overview of Changes in 4.7.0, 07-05-2022
========================================
* GtkTextView:
- Reduce overdraws
* GtkViewport:
- Default scroll-to-focus to TRUE
* GtkText:
- Stop blinking when we lose focus
* GtkSearchEntry:
- Make search delay configurable
* GtkPopoverMenu:
- Fix RTL positioning of buttons
* GtkLabel:
- Fix focus keynav with links
* GtkFileChooser:
- Prevent undesirable completion popups
- Fix a corner case in save mode
- Keep the portal filechooser alive long enough
* GtkCheckButton:
- Allow setting a custom child
* GtkEditableLabel:
- Make the :editing property writable
* GtkColumnView:
- Various optimizations to improve scrolling performance
* GtkTreeStore:
- Allow populating tree stores from ui files
* GtkBoxLayout:
- Avoid infinite loops
* CSS:
- Optimize reordering within the same parent
* Emoji:
- Update to CLDR v40 / Unicode 14
- Add more locales
* Input:
- Add scroll unit handling
- Handle display changes in GtkIMMultiContext
- Always populate GDK_AXIS_X/Y in event history
- Don't crash for large compose tables
* Accessibility:
- Fix a crash at start when orca is running
* Theme:
- Refresh icons
- Fix selection in vertical spin buttons
- Fix selection in editable labels
* gdk:
- Optimize pixel format conversions
- Use EGL_KHR_swap_buffers_with_damage for NVidia
* gsk:
- Handle large viewports
- Prepare texture libraries for glyphy rendering
- Don't leak big glyphs in the glyph cache
- Align offscreen rendering with th pixel grid
- Check for half-float support before using it
* Wayland:
- Use xdg-activation protocol
- Fix text caret coordinates
- Fix on-screen keyboard activation
* MacOS:
- Fix sluggish and reversed scrolling
- Improve monitor detection
- Event handling fixes
- Fix keyboard input on popovers
- Support OpenGL-based video playback
- Suport fullscreen
- Improve native filechoooser size allocation
- Use CALayer and IOSurface for rendering
- Use a per-monitor CVDisplayLink
- Fix kinetic scrolling
- Improve window placement
- Improve multi-monitor handling
- Start applications in the foreground
- Fix cursor blink time
* Windows:
- Fix preedit window placement on HiDPI
* Tools:
- gtk4-builder-tool: Don't require a display for all commands
- gtk4-builder-tool: Add a screenshot command
- gtk4-node-editor: Install this utility
* Debugging:
- inspector: Show more application data
- inspector: Allow viewing PangoAttrList properties
* Documentation:
- Use the gtk-builder-tool to generate screenshots
* Build:
- Fix cross-compilation
- Fix build on aarch64
- Fix build with gcc 12
* Translation updates
Basque
Brazilian Portuguese
British English
Catalan
Chinese (China)
Chinese (Taiwan)
Croatian
Czech
Danish
Finnish
Galician
Georgian
German
Hebrew
Hungarian
Indonesian
Italian
Kazakh
Korean
Latvian
Lithuanian
Norwegian Bokmål
Persian
Polish
Portuguese
Russian
Serbian
Slovak
Slovenian
Spanish
Swedish
Turkish
Ukrainian
Overview of Changes in 4.6.1, 11-02-2022
========================================
+2 -1
View File
@@ -23,7 +23,7 @@ do_headerbar (GtkWidget *do_widget)
{
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Welcome to Facebook - Log in, sign up or learn more");
gtk_window_set_title (GTK_WINDOW (window), "Welcome to the Hotel California");
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
@@ -31,6 +31,7 @@ do_headerbar (GtkWidget *do_widget)
header = gtk_header_bar_new ();
button = gtk_button_new_from_icon_name ("mail-send-receive-symbolic");
gtk_widget_set_tooltip_text (button, "Check out");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+3 -5
View File
@@ -66,11 +66,9 @@ do_links (GtkWidget *do_widget)
"as hyperlinks, which can be clicked "
"or activated via <a href=\"keynav\">keynav</a> "
"and they work fine with other markup, like when "
"searching on <a href=\"http://www.google.com/\">"
"<span color=\"#0266C8\">G</span><span color=\"#F90101\">o</span>"
"<span color=\"#F2B50F\">o</span><span color=\"#0266C8\">g</span>"
"<span color=\"#00933B\">l</span><span color=\"#F90101\">e</span>"
"</a>.");
"linking to <a href=\"http://www.flathub.org/\"><b>"
"<span letter_spacing=\"1024\" underline=\"none\" color=\"pink\" background=\"darkslategray\">Flathub</span>"
"</b></a>.");
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
gtk_label_set_max_width_chars (GTK_LABEL (label), 40);
gtk_label_set_wrap (GTK_LABEL (label), TRUE);
+14 -17
View File
@@ -9,7 +9,6 @@
#include <gtk/gtk.h>
#include "script-names.h"
#include "unicode-names.h"
#include "simplelabel.h"
#define UCD_TYPE_ITEM (ucd_item_get_type ())
@@ -103,9 +102,7 @@ setup_centered_label (GtkSignalListItemFactory *factory,
GObject *listitem)
{
GtkWidget *label;
label = simple_label_new ();
simple_label_set_min_chars (SIMPLE_LABEL (label), 3);
simple_label_set_nat_chars (SIMPLE_LABEL (label), 20);
label = gtk_label_new ("");
gtk_list_item_set_child (GTK_LIST_ITEM (listitem), label);
}
@@ -114,9 +111,8 @@ setup_label (GtkSignalListItemFactory *factory,
GObject *listitem)
{
GtkWidget *label;
label = simple_label_new ();
simple_label_set_min_chars (SIMPLE_LABEL (label), 3);
simple_label_set_nat_chars (SIMPLE_LABEL (label), 20);
label = gtk_label_new ("");
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_list_item_set_child (GTK_LIST_ITEM (listitem), label);
}
@@ -125,9 +121,10 @@ setup_ellipsizing_label (GtkSignalListItemFactory *factory,
GObject *listitem)
{
GtkWidget *label;
label = simple_label_new ();
simple_label_set_min_chars (SIMPLE_LABEL (label), 3);
simple_label_set_nat_chars (SIMPLE_LABEL (label), 20);
label = gtk_label_new ("");
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
gtk_label_set_width_chars (GTK_LABEL (label), 20);
gtk_list_item_set_child (GTK_LIST_ITEM (listitem), label);
}
@@ -145,7 +142,7 @@ bind_codepoint (GtkSignalListItemFactory *factory,
codepoint = ucd_item_get_codepoint (UCD_ITEM (item));
g_snprintf (buffer, 10, "%#06x", codepoint);
simple_label_set_text (SIMPLE_LABEL (label), buffer);
gtk_label_set_label (GTK_LABEL (label), buffer);
}
static void
@@ -164,7 +161,7 @@ bind_char (GtkSignalListItemFactory *factory,
if (g_unichar_isprint (codepoint))
g_unichar_to_utf8 (codepoint, buffer);
simple_label_set_text (SIMPLE_LABEL (label), buffer);
gtk_label_set_label (GTK_LABEL (label), buffer);
}
static void
@@ -179,7 +176,7 @@ bind_name (GtkSignalListItemFactory *factory,
item = gtk_list_item_get_item (GTK_LIST_ITEM (listitem));
name = ucd_item_get_name (UCD_ITEM (item));
simple_label_set_text (SIMPLE_LABEL (label), name);
gtk_label_set_label (GTK_LABEL (label), name);
}
static void
@@ -194,7 +191,7 @@ bind_type (GtkSignalListItemFactory *factory,
item = gtk_list_item_get_item (GTK_LIST_ITEM (listitem));
codepoint = ucd_item_get_codepoint (UCD_ITEM (item));
simple_label_set_text (SIMPLE_LABEL (label), get_unicode_type_name (g_unichar_type (codepoint)));
gtk_label_set_label (GTK_LABEL (label), get_unicode_type_name (g_unichar_type (codepoint)));
}
static void
@@ -209,7 +206,7 @@ bind_break_type (GtkSignalListItemFactory *factory,
item = gtk_list_item_get_item (GTK_LIST_ITEM (listitem));
codepoint = ucd_item_get_codepoint (UCD_ITEM (item));
simple_label_set_text (SIMPLE_LABEL (label), get_break_type_name (g_unichar_break_type (codepoint)));
gtk_label_set_label (GTK_LABEL (label), get_break_type_name (g_unichar_break_type (codepoint)));
}
static void
@@ -224,7 +221,7 @@ bind_combining_class (GtkSignalListItemFactory *factory,
item = gtk_list_item_get_item (GTK_LIST_ITEM (listitem));
codepoint = ucd_item_get_codepoint (UCD_ITEM (item));
simple_label_set_text (SIMPLE_LABEL (label), get_combining_class_name (g_unichar_combining_class (codepoint)));
gtk_label_set_label (GTK_LABEL (label), get_combining_class_name (g_unichar_combining_class (codepoint)));
}
static void
@@ -241,7 +238,7 @@ bind_script (GtkSignalListItemFactory *factory,
codepoint = ucd_item_get_codepoint (UCD_ITEM (item));
script = g_unichar_get_script (codepoint);
simple_label_set_text (SIMPLE_LABEL (label), get_script_name (script));
gtk_label_set_label (GTK_LABEL (label), get_script_name (script));
}
static void
-1
View File
@@ -130,7 +130,6 @@ extra_demo_sources = files([
'unicode-names.c',
'suggestionentry.c',
'language-names.c',
'simplelabel.c',
])
if os_unix
-260
View File
@@ -1,260 +0,0 @@
#include "simplelabel.h"
struct _SimpleLabel
{
GtkWidget parent_instance;
PangoLayout *layout;
int min_chars;
int nat_chars;
int min_width;
int nat_width;
int height;
};
struct _SimpleLabelClass
{
GtkWidgetClass parent_class;
};
enum {
PROP_TEXT = 1,
PROP_MIN_CHARS,
PROP_NAT_CHARS,
NUM_PROPERTIES
};
static GParamSpec *properties[NUM_PROPERTIES] = { NULL, };
G_DEFINE_TYPE (SimpleLabel, simple_label, GTK_TYPE_WIDGET)
static void
simple_label_init (SimpleLabel *self)
{
self->layout = gtk_widget_create_pango_layout (GTK_WIDGET (self), "");
pango_layout_set_ellipsize (self->layout, PANGO_ELLIPSIZE_NONE);
pango_layout_set_wrap (self->layout, PANGO_WRAP_WORD);
pango_layout_set_width (self->layout, -1);
}
static void
simple_label_dispose (GObject *object)
{
SimpleLabel *self = SIMPLE_LABEL (object);
g_clear_object (&self->layout);
G_OBJECT_CLASS (simple_label_parent_class)->dispose (object);
}
static void
simple_label_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
SimpleLabel *self = SIMPLE_LABEL (object);
switch (prop_id)
{
case PROP_TEXT:
simple_label_set_text (self, g_value_get_string (value));
break;
case PROP_MIN_CHARS:
simple_label_set_min_chars (self, g_value_get_int (value));
break;
case PROP_NAT_CHARS:
simple_label_set_nat_chars (self, g_value_get_int (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
simple_label_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
SimpleLabel *self = SIMPLE_LABEL (object);
switch (prop_id)
{
case PROP_TEXT:
g_value_set_string (value, pango_layout_get_text (self->layout));
break;
case PROP_MIN_CHARS:
g_value_set_int (value, self->min_chars);
break;
case PROP_NAT_CHARS:
g_value_set_int (value, self->nat_chars);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
simple_label_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline)
{
SimpleLabel *self = SIMPLE_LABEL (widget);
if (orientation == GTK_ORIENTATION_VERTICAL)
{
*minimum = *natural = self->height;
}
else
{
*minimum = self->min_width;
*natural = self->nat_width;
}
}
static void
simple_label_size_allocate (GtkWidget *widget,
int width,
int height,
int baseline)
{
SimpleLabel *self = SIMPLE_LABEL (widget);
pango_layout_set_width (self->layout, width * PANGO_SCALE);
}
static void
simple_label_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
SimpleLabel *self = SIMPLE_LABEL (widget);
GtkStyleContext *context;
context = gtk_widget_get_style_context (widget);
gtk_snapshot_render_layout (snapshot, context, 0, 0, self->layout);
}
static void
simple_label_class_init (SimpleLabelClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
object_class->dispose = simple_label_dispose;
object_class->set_property = simple_label_set_property;
object_class->get_property = simple_label_get_property;
widget_class->measure = simple_label_measure;
widget_class->size_allocate = simple_label_size_allocate;
widget_class->snapshot = simple_label_snapshot;
properties[PROP_TEXT] =
g_param_spec_string ("text", "Text", "Text",
NULL,
G_PARAM_READWRITE);
properties[PROP_MIN_CHARS] =
g_param_spec_int ("min-chars", "Minimum Characters", "Minimum Characters",
0, G_MAXINT, 0,
G_PARAM_READWRITE);
properties[PROP_NAT_CHARS] =
g_param_spec_int ("nat-chars", "Natural Characters", "Natural Characters",
0, G_MAXINT, 0,
G_PARAM_READWRITE);
g_object_class_install_properties (object_class, NUM_PROPERTIES, properties);
}
GtkWidget *
simple_label_new (void)
{
return g_object_new (SIMPLE_TYPE_LABEL, NULL);
}
void
simple_label_set_text (SimpleLabel *self,
const char *text)
{
if (strcmp (text, pango_layout_get_text (self->layout)) == 0)
return;
pango_layout_set_text (self->layout, text, -1);
gtk_widget_queue_draw (GTK_WIDGET (self));
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_TEXT]);
}
static void
recalculate (SimpleLabel *self)
{
PangoContext *context;
PangoFontMetrics *metrics;
int char_width;
int digit_width;
int width;
int ascent;
int descent;
context = gtk_widget_get_pango_context (GTK_WIDGET (self));
metrics = pango_context_get_metrics (context,
pango_context_get_font_description (context),
pango_context_get_language (context));
char_width = pango_font_metrics_get_approximate_char_width (metrics);
digit_width = pango_font_metrics_get_approximate_digit_width (metrics);
ascent = pango_font_metrics_get_ascent (metrics);
descent = pango_font_metrics_get_descent (metrics);
pango_font_metrics_unref (metrics);
width = MAX (char_width, digit_width);
self->min_width = (width * self->min_chars) / PANGO_SCALE;
self->nat_width = (width * self->nat_chars) / PANGO_SCALE;
self->height = (ascent + descent) / PANGO_SCALE;
}
void
simple_label_set_min_chars (SimpleLabel *self,
int min_chars)
{
if (self->min_chars == min_chars)
return;
self->min_chars = min_chars;
recalculate (self);
gtk_widget_queue_resize (GTK_WIDGET (self));
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_MIN_CHARS]);
}
void
simple_label_set_nat_chars (SimpleLabel *self,
int nat_chars)
{
if (self->nat_chars == nat_chars)
return;
self->nat_chars = nat_chars;
recalculate (self);
gtk_widget_queue_resize (GTK_WIDGET (self));
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_NAT_CHARS]);
}
-15
View File
@@ -1,15 +0,0 @@
#pragma once
#include <gtk/gtk.h>
#define SIMPLE_TYPE_LABEL (simple_label_get_type ())
G_DECLARE_FINAL_TYPE (SimpleLabel, simple_label, SIMPLE, LABEL, GtkWidget)
GtkWidget * simple_label_new (void);
void simple_label_set_text (SimpleLabel *self,
const char *text);
void simple_label_set_min_chars (SimpleLabel *self,
int min_chars);
void simple_label_set_nat_chars (SimpleLabel *self,
int nat_chars);
+23
View File
@@ -57,6 +57,7 @@ struct _NodeEditorWindow
GtkWidget *testcase_cairo_checkbutton;
GtkWidget *testcase_name_entry;
GtkWidget *testcase_save_button;
GtkWidget *scale_scale;
GtkWidget *renderer_listbox;
GListStore *renderers;
@@ -171,6 +172,7 @@ text_changed (GtkTextBuffer *buffer,
GBytes *bytes;
GtkTextIter iter;
GtkTextIter start, end;
float scale;
g_array_remove_range (self->errors, 0, self->errors->len);
text = get_current_text (self->text_buffer);
@@ -181,6 +183,17 @@ text_changed (GtkTextBuffer *buffer,
/* If this is too slow, go fix the parser performance */
self->node = gsk_render_node_deserialize (bytes, deserialize_error_func, self);
scale = gtk_scale_button_get_value (GTK_SCALE_BUTTON (self->scale_scale));
if (self->node && scale != 1.0)
{
GskRenderNode *node;
node = gsk_transform_node_new (self->node, gsk_transform_scale (NULL, scale, scale));
gsk_render_node_unref (self->node);
self->node = node;
}
g_bytes_unref (bytes);
if (self->node)
{
@@ -277,6 +290,14 @@ text_changed (GtkTextBuffer *buffer,
&start, &end);
}
static void
scale_changed (GObject *object,
GParamSpec *pspec,
NodeEditorWindow *self)
{
text_changed (self->text_buffer, self);
}
static gboolean
text_view_query_tooltip_cb (GtkWidget *widget,
int x,
@@ -962,6 +983,7 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, testcase_cairo_checkbutton);
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, testcase_name_entry);
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, testcase_save_button);
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, scale_scale);
gtk_widget_class_bind_template_callback (widget_class, text_view_query_tooltip_cb);
gtk_widget_class_bind_template_callback (widget_class, open_cb);
@@ -1068,6 +1090,7 @@ node_editor_window_init (NodeEditorWindow *self)
self->text_buffer = gtk_text_buffer_new (self->tag_table);
g_signal_connect (self->text_buffer, "changed", G_CALLBACK (text_changed), self);
g_signal_connect (self->scale_scale, "notify::value", G_CALLBACK (scale_changed), self);
gtk_text_view_set_buffer (GTK_TEXT_VIEW (self->text_view), self->text_buffer);
/* Default */
+17
View File
@@ -157,6 +157,23 @@
<signal name="notify::active" handler="dark_mode_cb" swapped="0"/>
</object>
</child>
<child type="end">
<object class="GtkScaleButton" id="scale_scale">
<property name="focus-on-click">0</property>
<property name="valign">center</property>
<property name="adjustment">
<object class="GtkAdjustment">
<property name="lower">1</property>
<property name="value">1</property>
<property name="upper">10</property>
<property name="step-increment">0.1</property>
<property name="page-increment">0.5</property>
</object>
</property>
<property name="icons">zoom-in-symbolic</property>
<property name="tooltip-text" translatable="yes">Scale the image</property>
</object>
</child>
</object>
</child>
<child>
+1 -1
View File
@@ -5,7 +5,7 @@ repository_url = "https://gitlab.gnome.org/GNOME/gtk.git"
website_url = "https://www.gtk.org"
authors = "GTK Development Team"
logo_url = "gtk-logo.svg"
license = "GPL-2.1-or-later"
license = "LGPL-2.1-or-later"
description = "The GTK toolkit"
devhelp = true
+1 -1
View File
@@ -5,7 +5,7 @@ repository_url = "https://gitlab.gnome.org/GNOME/gtk.git"
website_url = "https://www.gtk.org"
authors = "GTK Development Team"
logo_url = "gtk-logo.svg"
license = "GPL-2.1-or-later"
license = "LGPL-2.1-or-later"
description = "The GTK toolkit"
dependencies = ["Gdk-4.0"]
devhelp = true
+1
View File
@@ -354,6 +354,7 @@ typedef struct {
typedef union {
BroadwayReplyBase base;
BroadwayReplySync sync;
BroadwayReplyEvent event;
BroadwayReplyQueryMouse query_mouse;
BroadwayReplyNewSurface new_surface;
+14 -18
View File
@@ -219,11 +219,7 @@ static void
client_handle_request (BroadwayClient *client,
BroadwayRequest *request)
{
BroadwayReplyNewSurface reply_new_surface;
BroadwayReplySync reply_sync;
BroadwayReplyQueryMouse reply_query_mouse;
BroadwayReplyGrabPointer reply_grab_pointer;
BroadwayReplyUngrabPointer reply_ungrab_pointer;
BroadwayReply reply;
guint32 before_serial, now_serial;
guint32 global_id;
int fd;
@@ -233,7 +229,7 @@ client_handle_request (BroadwayClient *client,
switch (request->base.type)
{
case BROADWAY_REQUEST_NEW_SURFACE:
reply_new_surface.id =
reply.new_surface.id =
broadway_server_new_surface (server, client->id,
request->new_surface.x,
request->new_surface.y,
@@ -241,9 +237,9 @@ client_handle_request (BroadwayClient *client,
request->new_surface.height);
client->surfaces =
g_list_prepend (client->surfaces,
GUINT_TO_POINTER (reply_new_surface.id));
GUINT_TO_POINTER (reply.new_surface.id));
send_reply (client, request, (BroadwayReply *)&reply_new_surface, sizeof (reply_new_surface),
send_reply (client, request, &reply, sizeof (reply.new_surface),
BROADWAY_REPLY_NEW_SURFACE);
break;
case BROADWAY_REQUEST_FLUSH:
@@ -251,7 +247,7 @@ client_handle_request (BroadwayClient *client,
break;
case BROADWAY_REQUEST_SYNC:
broadway_server_flush (server);
send_reply (client, request, (BroadwayReply *)&reply_sync, sizeof (reply_sync),
send_reply (client, request, &reply, sizeof (reply.sync),
BROADWAY_REPLY_SYNC);
break;
case BROADWAY_REQUEST_ROUNDTRIP:
@@ -261,11 +257,11 @@ client_handle_request (BroadwayClient *client,
break;
case BROADWAY_REQUEST_QUERY_MOUSE:
broadway_server_query_mouse (server,
&reply_query_mouse.surface,
&reply_query_mouse.root_x,
&reply_query_mouse.root_y,
&reply_query_mouse.mask);
send_reply (client, request, (BroadwayReply *)&reply_query_mouse, sizeof (reply_query_mouse),
&reply.query_mouse.surface,
&reply.query_mouse.root_x,
&reply.query_mouse.root_y,
&reply.query_mouse.mask);
send_reply (client, request, &reply, sizeof (reply.query_mouse),
BROADWAY_REPLY_QUERY_MOUSE);
break;
case BROADWAY_REQUEST_DESTROY_SURFACE:
@@ -361,21 +357,21 @@ client_handle_request (BroadwayClient *client,
request->move_resize.height);
break;
case BROADWAY_REQUEST_GRAB_POINTER:
reply_grab_pointer.status =
reply.grab_pointer.status =
broadway_server_grab_pointer (server,
client->id,
request->grab_pointer.id,
request->grab_pointer.owner_events,
request->grab_pointer.event_mask,
request->grab_pointer.time_);
send_reply (client, request, (BroadwayReply *)&reply_grab_pointer, sizeof (reply_grab_pointer),
send_reply (client, request, &reply, sizeof (reply.grab_pointer),
BROADWAY_REPLY_GRAB_POINTER);
break;
case BROADWAY_REQUEST_UNGRAB_POINTER:
reply_ungrab_pointer.status =
reply.ungrab_pointer.status =
broadway_server_ungrab_pointer (server,
request->ungrab_pointer.time_);
send_reply (client, request, (BroadwayReply *)&reply_ungrab_pointer, sizeof (reply_ungrab_pointer),
send_reply (client, request, &reply, sizeof (reply.ungrab_pointer),
BROADWAY_REPLY_UNGRAB_POINTER);
break;
case BROADWAY_REQUEST_FOCUS_SURFACE:
+1 -2
View File
@@ -189,8 +189,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
message->pointer.state,
message->scroll.dir == 0
? GDK_SCROLL_UP
: GDK_SCROLL_DOWN,
FALSE);
: GDK_SCROLL_DOWN);
node = _gdk_event_queue_append (display, event);
_gdk_windowing_got_event (display, node, event, message->base.serial);
+1 -1
View File
@@ -125,7 +125,7 @@ gdk_app_launch_context_class_init (GdkAppLaunchContextClass *klass)
* The display that the `GdkAppLaunchContext` is on.
*/
g_object_class_install_property (gobject_class, PROP_DISPLAY,
g_param_spec_object ("display", P_("Display"), P_("Display"),
g_param_spec_object ("display", NULL, NULL,
GDK_TYPE_DISPLAY,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
}
+4 -12
View File
@@ -357,9 +357,7 @@ gdk_clipboard_class_init (GdkClipboardClass *class)
* The `GdkDisplay` that the clipboard belongs to.
*/
properties[PROP_DISPLAY] =
g_param_spec_object ("display",
"Display",
"Display owning this clipboard",
g_param_spec_object ("display", NULL, NULL,
GDK_TYPE_DISPLAY,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
@@ -372,9 +370,7 @@ gdk_clipboard_class_init (GdkClipboardClass *class)
* The possible formats that the clipboard can provide its data in.
*/
properties[PROP_FORMATS] =
g_param_spec_boxed ("formats",
"Formats",
"The possible formats for data",
g_param_spec_boxed ("formats", NULL, NULL,
GDK_TYPE_CONTENT_FORMATS,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS |
@@ -386,9 +382,7 @@ gdk_clipboard_class_init (GdkClipboardClass *class)
* %TRUE if the contents of the clipboard are owned by this process.
*/
properties[PROP_LOCAL] =
g_param_spec_boolean ("local",
"Local",
"If the contents are owned by this process",
g_param_spec_boolean ("local", NULL, NULL,
TRUE,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS |
@@ -401,9 +395,7 @@ gdk_clipboard_class_init (GdkClipboardClass *class)
* provided otherwise.
*/
properties[PROP_CONTENT] =
g_param_spec_object ("content",
"Content",
"Provider of the clipboard's content",
g_param_spec_object ("content", NULL, NULL,
GDK_TYPE_CONTENT_PROVIDER,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS |
+2 -6
View File
@@ -173,9 +173,7 @@ gdk_content_provider_class_init (GdkContentProviderClass *class)
* The possible formats that the provider can provide its data in.
*/
properties[PROP_FORMATS] =
g_param_spec_boxed ("formats",
"Formats",
"The possible formats for data",
g_param_spec_boxed ("formats", NULL, NULL,
GDK_TYPE_CONTENT_FORMATS,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS |
@@ -187,9 +185,7 @@ gdk_content_provider_class_init (GdkContentProviderClass *class)
* The subset of formats that clipboard managers should store this provider's data in.
*/
properties[PROP_STORABLE_FORMATS] =
g_param_spec_boxed ("storable-formats",
"Storable formats",
"The formats that data should be stored in",
g_param_spec_boxed ("storable-formats", NULL, NULL,
GDK_TYPE_CONTENT_FORMATS,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS |
+5 -15
View File
@@ -174,9 +174,7 @@ gdk_cursor_class_init (GdkCursorClass *cursor_class)
*/
g_object_class_install_property (object_class,
PROP_FALLBACK,
g_param_spec_object ("fallback",
P_("Fallback"),
P_("Cursor image to fall back to if this cursor cannot be displayed"),
g_param_spec_object ("fallback", NULL, NULL,
GDK_TYPE_CURSOR,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
@@ -188,9 +186,7 @@ gdk_cursor_class_init (GdkCursorClass *cursor_class)
*/
g_object_class_install_property (object_class,
PROP_HOTSPOT_X,
g_param_spec_int ("hotspot-x",
P_("Hotspot X"),
P_("Horizontal offset of the cursor hotspot"),
g_param_spec_int ("hotspot-x", NULL, NULL,
0, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
@@ -202,9 +198,7 @@ gdk_cursor_class_init (GdkCursorClass *cursor_class)
*/
g_object_class_install_property (object_class,
PROP_HOTSPOT_Y,
g_param_spec_int ("hotspot-y",
P_("Hotspot Y"),
P_("Vertical offset of the cursor hotspot"),
g_param_spec_int ("hotspot-y", NULL, NULL,
0, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
@@ -218,9 +212,7 @@ gdk_cursor_class_init (GdkCursorClass *cursor_class)
*/
g_object_class_install_property (object_class,
PROP_NAME,
g_param_spec_string ("name",
P_("Name"),
P_("Name of this cursor"),
g_param_spec_string ("name", NULL, NULL,
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
@@ -234,9 +226,7 @@ gdk_cursor_class_init (GdkCursorClass *cursor_class)
*/
g_object_class_install_property (object_class,
PROP_TEXTURE,
g_param_spec_object ("texture",
P_("Texture"),
P_("The texture displayed by this cursor"),
g_param_spec_object ("texture", NULL, NULL,
GDK_TYPE_TEXTURE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
+16 -48
View File
@@ -109,9 +109,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
* The `GdkDisplay` the `GdkDevice` pertains to.
*/
device_props[PROP_DISPLAY] =
g_param_spec_object ("display",
P_("Device Display"),
P_("Display which the device belongs to"),
g_param_spec_object ("display", NULL, NULL,
GDK_TYPE_DISPLAY,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
@@ -121,9 +119,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
* The device name.
*/
device_props[PROP_NAME] =
g_param_spec_string ("name",
P_("Device name"),
P_("Device name"),
g_param_spec_string ("name", NULL, NULL,
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
@@ -134,9 +130,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
* Source type for the device.
*/
device_props[PROP_SOURCE] =
g_param_spec_enum ("source",
P_("Input source"),
P_("Source type for the device"),
g_param_spec_enum ("source", NULL, NULL,
GDK_TYPE_INPUT_SOURCE,
GDK_SOURCE_MOUSE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
@@ -148,9 +142,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
* Whether the device is represented by a cursor on the screen.
*/
device_props[PROP_HAS_CURSOR] =
g_param_spec_boolean ("has-cursor",
P_("Whether the device has a cursor"),
P_("Whether there is a visible cursor following device motion"),
g_param_spec_boolean ("has-cursor", NULL, NULL,
FALSE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
@@ -161,9 +153,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
* Number of axes in the device.
*/
device_props[PROP_N_AXES] =
g_param_spec_uint ("n-axes",
P_("Number of axes in the device"),
P_("Number of axes in the device"),
g_param_spec_uint ("n-axes", NULL, NULL,
0, G_MAXUINT,
0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -176,9 +166,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
* See [method@Gdk.Device.get_vendor_id].
*/
device_props[PROP_VENDOR_ID] =
g_param_spec_string ("vendor-id",
P_("Vendor ID"),
P_("Vendor ID"),
g_param_spec_string ("vendor-id", NULL, NULL,
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
@@ -191,9 +179,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
* See [method@Gdk.Device.get_product_id].
*/
device_props[PROP_PRODUCT_ID] =
g_param_spec_string ("product-id",
P_("Product ID"),
P_("Product ID"),
g_param_spec_string ("product-id", NULL, NULL,
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
@@ -204,9 +190,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
* `GdkSeat` of this device.
*/
device_props[PROP_SEAT] =
g_param_spec_object ("seat",
P_("Seat"),
P_("Seat"),
g_param_spec_object ("seat", NULL, NULL,
GDK_TYPE_SEAT,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
@@ -220,9 +204,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
* of touches is unknown.
*/
device_props[PROP_NUM_TOUCHES] =
g_param_spec_uint ("num-touches",
P_("Number of concurrent touches"),
P_("Number of concurrent touches"),
g_param_spec_uint ("num-touches", NULL, NULL,
0, G_MAXUINT,
0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
@@ -234,9 +216,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
* The `GdkDeviceTool` that is currently used with this device.
*/
device_props[PROP_TOOL] =
g_param_spec_object ("tool",
P_("Tool"),
P_("The tool that is currently used with this device"),
g_param_spec_object ("tool", NULL, NULL,
GDK_TYPE_DEVICE_TOOL,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -248,9 +228,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
* This is only relevant for keyboard devices.
*/
device_props[PROP_DIRECTION] =
g_param_spec_enum ("direction",
P_("Direction"),
P_("The direction of the current layout of the keyboard"),
g_param_spec_enum ("direction", NULL, NULL,
PANGO_TYPE_DIRECTION, PANGO_DIRECTION_NEUTRAL,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -262,9 +240,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
* This is only relevant for keyboard devices.
*/
device_props[PROP_HAS_BIDI_LAYOUTS] =
g_param_spec_boolean ("has-bidi-layouts",
P_("Has bidi layouts"),
P_("Whether the keyboard has bidi layouts"),
g_param_spec_boolean ("has-bidi-layouts", NULL, NULL,
FALSE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -276,9 +252,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
* This is only relevant for keyboard devices.
*/
device_props[PROP_CAPS_LOCK_STATE] =
g_param_spec_boolean ("caps-lock-state",
P_("Caps lock state"),
P_("Whether the keyboard caps lock is on"),
g_param_spec_boolean ("caps-lock-state", NULL, NULL,
FALSE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -290,9 +264,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
* This is only relevant for keyboard devices.
*/
device_props[PROP_NUM_LOCK_STATE] =
g_param_spec_boolean ("num-lock-state",
P_("Num lock state"),
P_("Whether the keyboard num lock is on"),
g_param_spec_boolean ("num-lock-state", NULL, NULL,
FALSE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -304,9 +276,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
* This is only relevant for keyboard devices.
*/
device_props[PROP_SCROLL_LOCK_STATE] =
g_param_spec_boolean ("scroll-lock-state",
P_("Scroll lock state"),
P_("Whether the keyboard scroll lock is on"),
g_param_spec_boolean ("scroll-lock-state", NULL, NULL,
FALSE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -318,9 +288,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
* This is only relevant for keyboard devices.
*/
device_props[PROP_MODIFIER_STATE] =
g_param_spec_flags ("modifier-state",
P_("Modifier state"),
P_("The modifier state of the keyboard"),
g_param_spec_flags ("modifier-state", NULL, NULL,
GDK_TYPE_MODIFIER_TYPE, 0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+7 -2
View File
@@ -66,10 +66,15 @@ typedef enum
/**
* GdkTimeCoord:
* @time: The timestamp for this event
* @flags: Flags indicating what axes are present
* @axes: (array fixed-size=12): axis values
* @flags: Flags indicating what axes are present, see [flags@Gdk.AxisFlags]
* @axes: (array fixed-size=12): axis values, indexed by [enum@Gdk.AxisUse]
*
* A `GdkTimeCoord` stores a single event in a motion history.
*
* To check whether an axis is present, check whether the corresponding
* flag from the [flags@Gdk.AxisFlags] enumeration is set in the @flags
* To access individual axis values, use the values of the values of
* the [enum@Gdk.AxisUse] enumerations as indices.
*/
struct _GdkTimeCoord
{
+4 -12
View File
@@ -111,9 +111,7 @@ gdk_device_tool_class_init (GdkDeviceToolClass *klass)
*
* The serial number of the tool.
*/
tool_props[TOOL_PROP_SERIAL] = g_param_spec_uint64 ("serial",
"Serial",
"Serial number",
tool_props[TOOL_PROP_SERIAL] = g_param_spec_uint64 ("serial", NULL, NULL,
0, G_MAXUINT64, 0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
@@ -124,9 +122,7 @@ gdk_device_tool_class_init (GdkDeviceToolClass *klass)
*
* The type of the tool.
*/
tool_props[TOOL_PROP_TOOL_TYPE] = g_param_spec_enum ("tool-type",
"Tool type",
"Tool type",
tool_props[TOOL_PROP_TOOL_TYPE] = g_param_spec_enum ("tool-type", NULL, NULL,
GDK_TYPE_DEVICE_TOOL_TYPE,
GDK_DEVICE_TOOL_TYPE_UNKNOWN,
G_PARAM_READWRITE |
@@ -138,9 +134,7 @@ gdk_device_tool_class_init (GdkDeviceToolClass *klass)
*
* The axes of the tool.
*/
tool_props[TOOL_PROP_AXES] = g_param_spec_flags ("axes",
"Axes",
"Tool axes",
tool_props[TOOL_PROP_AXES] = g_param_spec_flags ("axes", NULL, NULL,
GDK_TYPE_AXIS_FLAGS, 0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY);
@@ -150,9 +144,7 @@ gdk_device_tool_class_init (GdkDeviceToolClass *klass)
*
* The hardware ID of the tool.
*/
tool_props[TOOL_PROP_HARDWARE_ID] = g_param_spec_uint64 ("hardware-id",
"Hardware ID",
"Hardware ID",
tool_props[TOOL_PROP_HARDWARE_ID] = g_param_spec_uint64 ("hardware-id", NULL, NULL,
0, G_MAXUINT64, 0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
+6 -12
View File
@@ -213,9 +213,7 @@ gdk_display_class_init (GdkDisplayClass *class)
* %TRUE if the display properly composites the alpha channel.
*/
props[PROP_COMPOSITED] =
g_param_spec_boolean ("composited",
P_("Composited"),
P_("Composited"),
g_param_spec_boolean ("composited", NULL, NULL,
TRUE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -225,9 +223,7 @@ gdk_display_class_init (GdkDisplayClass *class)
* %TRUE if the display supports an alpha channel.
*/
props[PROP_RGBA] =
g_param_spec_boolean ("rgba",
P_("RGBA"),
P_("RGBA"),
g_param_spec_boolean ("rgba", NULL, NULL,
TRUE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -237,9 +233,7 @@ gdk_display_class_init (GdkDisplayClass *class)
* %TRUE if the display supports input shapes.
*/
props[PROP_INPUT_SHAPES] =
g_param_spec_boolean ("input-shapes",
P_("Input shapes"),
P_("Input shapes"),
g_param_spec_boolean ("input-shapes", NULL, NULL,
TRUE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -1628,10 +1622,10 @@ gdk_display_check_egl_extensions (EGLDisplay egl_display,
/* translators: Arguments are the number of missing extensions
* followed by a comma-separated list of their names */
g_dngettext (GETTEXT_PACKAGE,
"EGL implementation is missing extension %2$s",
"EGL implementation is missing %d extensions: %s",
"EGL implementation is missing extension %s",
"EGL implementation is missing %2$d extensions: %1$s",
n_missing),
(int) n_missing, missing->str);
missing->str, (int) n_missing);
g_string_free (missing, TRUE);
return FALSE;
+1 -3
View File
@@ -155,9 +155,7 @@ gdk_display_manager_class_init (GdkDisplayManagerClass *klass)
*/
g_object_class_install_property (object_class,
PROP_DEFAULT_DISPLAY,
g_param_spec_object ("default-display",
P_("Default Display"),
P_("The default display for GDK"),
g_param_spec_object ("default-display", NULL, NULL,
GDK_TYPE_DISPLAY,
G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
}
+7 -21
View File
@@ -379,9 +379,7 @@ gdk_drag_class_init (GdkDragClass *klass)
* The `GdkContentProvider`.
*/
properties[PROP_CONTENT] =
g_param_spec_object ("content",
"Content",
"The content being dragged",
g_param_spec_object ("content", NULL, NULL,
GDK_TYPE_CONTENT_PROVIDER,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
@@ -394,9 +392,7 @@ gdk_drag_class_init (GdkDragClass *klass)
* The `GdkDevice` that is performing the drag.
*/
properties[PROP_DEVICE] =
g_param_spec_object ("device",
"Device",
"The device performing the drag",
g_param_spec_object ("device", NULL, NULL,
GDK_TYPE_DEVICE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
@@ -409,9 +405,7 @@ gdk_drag_class_init (GdkDragClass *klass)
* The `GdkDisplay` that the drag belongs to.
*/
properties[PROP_DISPLAY] =
g_param_spec_object ("display",
"Display",
"Display this drag belongs to",
g_param_spec_object ("display", NULL, NULL,
GDK_TYPE_DISPLAY,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS |
@@ -423,9 +417,7 @@ gdk_drag_class_init (GdkDragClass *klass)
* The possible formats that the drag can provide its data in.
*/
properties[PROP_FORMATS] =
g_param_spec_boxed ("formats",
"Formats",
"The possible formats for data",
g_param_spec_boxed ("formats", NULL, NULL,
GDK_TYPE_CONTENT_FORMATS,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
@@ -438,9 +430,7 @@ gdk_drag_class_init (GdkDragClass *klass)
* The currently selected action of the drag.
*/
properties[PROP_SELECTED_ACTION] =
g_param_spec_flags ("selected-action",
"Selected action",
"The currently selected action",
g_param_spec_flags ("selected-action", NULL, NULL,
GDK_TYPE_DRAG_ACTION,
0,
G_PARAM_READWRITE |
@@ -453,9 +443,7 @@ gdk_drag_class_init (GdkDragClass *klass)
* The possible actions of this drag.
*/
properties[PROP_ACTIONS] =
g_param_spec_flags ("actions",
"Actions",
"The possible actions",
g_param_spec_flags ("actions", NULL, NULL,
GDK_TYPE_DRAG_ACTION,
0,
G_PARAM_READWRITE |
@@ -468,9 +456,7 @@ gdk_drag_class_init (GdkDragClass *klass)
* The surface where the drag originates.
*/
properties[PROP_SURFACE] =
g_param_spec_object ("surface",
"Surface",
"The surface where the drag originates",
g_param_spec_object ("surface", NULL, NULL,
GDK_TYPE_SURFACE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
+2 -6
View File
@@ -168,9 +168,7 @@ gdk_draw_context_class_init (GdkDrawContextClass *klass)
* The `GdkDisplay` used to create the `GdkDrawContext`.
*/
pspecs[PROP_DISPLAY] =
g_param_spec_object ("display",
P_("Display"),
P_("The GDK display used to create the context"),
g_param_spec_object ("display", NULL, NULL,
GDK_TYPE_DISPLAY,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
@@ -182,9 +180,7 @@ gdk_draw_context_class_init (GdkDrawContextClass *klass)
* The `GdkSurface` the context is bound to.
*/
pspecs[PROP_SURFACE] =
g_param_spec_object ("surface",
P_("Surface"),
P_("The GDK surface bound to the context"),
g_param_spec_object ("surface", NULL, NULL,
GDK_TYPE_SURFACE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
+6 -18
View File
@@ -325,9 +325,7 @@ gdk_drop_class_init (GdkDropClass *klass)
* The possible actions for this drop
*/
properties[PROP_ACTIONS] =
g_param_spec_flags ("actions",
"Actions",
"The possible actions for this drop",
g_param_spec_flags ("actions", NULL, NULL,
GDK_TYPE_DRAG_ACTION,
GDK_ACTION_ALL,
G_PARAM_READWRITE |
@@ -341,9 +339,7 @@ gdk_drop_class_init (GdkDropClass *klass)
* The `GdkDevice` performing the drop
*/
properties[PROP_DEVICE] =
g_param_spec_object ("device",
"Device",
"The device performing the drop",
g_param_spec_object ("device", NULL, NULL,
GDK_TYPE_DEVICE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
@@ -356,9 +352,7 @@ gdk_drop_class_init (GdkDropClass *klass)
* The `GdkDisplay` that the drop belongs to.
*/
properties[PROP_DISPLAY] =
g_param_spec_object ("display",
"Display",
"Display this drag belongs to",
g_param_spec_object ("display", NULL, NULL,
GDK_TYPE_DISPLAY,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS |
@@ -370,9 +364,7 @@ gdk_drop_class_init (GdkDropClass *klass)
* The `GdkDrag` that initiated this drop
*/
properties[PROP_DRAG] =
g_param_spec_object ("drag",
"Drag",
"The drag that initiated this drop",
g_param_spec_object ("drag", NULL, NULL,
GDK_TYPE_DRAG,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
@@ -385,9 +377,7 @@ gdk_drop_class_init (GdkDropClass *klass)
* The possible formats that the drop can provide its data in.
*/
properties[PROP_FORMATS] =
g_param_spec_boxed ("formats",
"Formats",
"The possible formats for data",
g_param_spec_boxed ("formats", NULL, NULL,
GDK_TYPE_CONTENT_FORMATS,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
@@ -400,9 +390,7 @@ gdk_drop_class_init (GdkDropClass *klass)
* The `GdkSurface` the drop happens on
*/
properties[PROP_SURFACE] =
g_param_spec_object ("surface",
"Surface",
"The surface the drop is happening on",
g_param_spec_object ("surface", NULL, NULL,
GDK_TYPE_SURFACE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
+1 -11
View File
@@ -920,14 +920,6 @@ gdk_event_get_pointer_emulated (GdkEvent *event)
return tevent->pointer_emulated;
}
case GDK_SCROLL:
case GDK_SCROLL_SMOOTH:
{
GdkScrollEvent *sevent = (GdkScrollEvent *) event;
return sevent->pointer_emulated;
}
default:
break;
}
@@ -2373,15 +2365,13 @@ gdk_scroll_event_new_discrete (GdkSurface *surface,
GdkDeviceTool *tool,
guint32 time,
GdkModifierType state,
GdkScrollDirection direction,
gboolean emulated)
GdkScrollDirection direction)
{
GdkScrollEvent *self = gdk_event_alloc (GDK_SCROLL, surface, device, time);
self->tool = tool != NULL ? g_object_ref (tool) : NULL;
self->state = state;
self->direction = direction;
self->pointer_emulated = emulated;
self->unit = GDK_SCROLL_UNIT_WHEEL;
return (GdkEvent *) self;
+1 -5
View File
@@ -206,8 +206,6 @@ struct _GdkTouchEvent
* %GDK_SCROLL_SMOOTH).
* @delta_x: the x coordinate of the scroll delta
* @delta_y: the y coordinate of the scroll delta
* @pointer_emulated: whether the scroll event was the result of
* a pointer emulation
* @tool: a `GdkDeviceTool`
* @history: (element-type GdkTimeCoord): array of times and deltas
* for other scroll events that were compressed before delivering the
@@ -231,7 +229,6 @@ struct _GdkScrollEvent
GdkScrollDirection direction;
double delta_x;
double delta_y;
gboolean pointer_emulated;
gboolean is_stop;
GdkDeviceTool *tool;
GArray *history; /* <GdkTimeCoord> */
@@ -496,8 +493,7 @@ GdkEvent * gdk_scroll_event_new_discrete (GdkSurface *surface,
GdkDeviceTool *tool,
guint32 time,
GdkModifierType state,
GdkScrollDirection direction,
gboolean emulated);
GdkScrollDirection direction);
GdkEvent * gdk_touch_event_new (GdkEventType type,
GdkEventSequence *sequence,
+245 -247
View File
@@ -256,181 +256,179 @@ gdk_gl_context_get_property (GObject *object,
}
}
#define N_EGL_ATTRS 16
#define N_EGL_ATTRS 16
#ifdef HAVE_EGL
static inline EGLenum
gdk_api_to_egl_api (GdkGLAPI api)
{
switch (api)
{
case GDK_GL_API_GLES:
return EGL_OPENGL_ES_API;
case GDK_GL_API_GL:
default:
return EGL_OPENGL_API;
}
}
static GdkGLAPI
gdk_gl_context_real_realize (GdkGLContext *context,
GError **error)
gdk_gl_context_create_egl_context (GdkGLContext *context,
GdkGLAPI api,
gboolean legacy)
{
#ifdef HAVE_EGL
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
GdkDisplay *display = gdk_gl_context_get_display (context);
EGLDisplay egl_display = gdk_display_get_egl_display (display);
GdkGLContext *share = gdk_display_get_gl_context (display);
GdkGLContextPrivate *share_priv = gdk_gl_context_get_instance_private (share);
EGLConfig egl_config;
EGLContext ctx;
EGLint context_attribs[N_EGL_ATTRS], i = 0, flags = 0;
gboolean debug_bit, forward_bit;
int min_major, min_minor, major = 0, minor = 0;
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
if (egl_display)
if (!gdk_gl_context_is_api_allowed (context, api, NULL))
return 0;
/* We will use the default version matching the context status
* unless the user requested a version which makes sense */
gdk_gl_context_get_matching_version (api, legacy,
display->have_egl_win32_libangle,
&min_major, &min_minor);
gdk_gl_context_get_clipped_version (context,
min_major, min_minor,
&major, &minor);
if (!eglBindAPI (gdk_api_to_egl_api (api)))
return 0;
debug_bit = gdk_gl_context_get_debug_enabled (context);
forward_bit = gdk_gl_context_get_forward_compatible (context);
if (display->have_egl_no_config_context)
egl_config = NULL;
else
egl_config = gdk_display_get_egl_config (display);
if (debug_bit)
flags |= EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
if (forward_bit)
flags |= EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
if (api == GDK_GL_API_GL)
{
EGLConfig egl_config;
GdkGLContext *share = gdk_display_get_gl_context (display);
GdkGLContextPrivate *share_priv = gdk_gl_context_get_instance_private (share);
EGLContext ctx;
EGLint context_attribs[N_EGL_ATTRS];
int major, minor, flags;
gboolean debug_bit, forward_bit, legacy_bit;
GdkGLAPI api;
int i = 0;
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
if (share != NULL)
gdk_gl_context_get_required_version (share, &major, &minor);
else
gdk_gl_context_get_required_version (context, &major, &minor);
debug_bit = gdk_gl_context_get_debug_enabled (context);
forward_bit = gdk_gl_context_get_forward_compatible (context);
legacy_bit = GDK_DISPLAY_DEBUG_CHECK (display, GL_LEGACY) ||
(share != NULL && gdk_gl_context_is_legacy (share));
if (display->have_egl_no_config_context)
egl_config = NULL;
else
egl_config = gdk_display_get_egl_config (display);
flags = 0;
if (debug_bit)
flags |= EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
if (forward_bit)
flags |= EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
if (gdk_gl_context_is_api_allowed (context, GDK_GL_API_GL, NULL) &&
eglBindAPI (EGL_OPENGL_API))
{
/* We want a core profile, unless in legacy mode */
context_attribs[i++] = EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR;
context_attribs[i++] = legacy_bit
? EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR
: EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR;
/* Specify the version */
context_attribs[i++] = EGL_CONTEXT_MAJOR_VERSION_KHR;
context_attribs[i++] = legacy_bit ? 3 : major;
context_attribs[i++] = EGL_CONTEXT_MINOR_VERSION_KHR;
context_attribs[i++] = legacy_bit ? 0 : minor;
api = GDK_GL_API_GL;
}
else if (gdk_gl_context_is_api_allowed (context, GDK_GL_API_GLES, NULL) &&
eglBindAPI (EGL_OPENGL_ES_API))
{
context_attribs[i++] = EGL_CONTEXT_CLIENT_VERSION;
if (major == 3)
context_attribs[i++] = 3;
else
context_attribs[i++] = 2;
api = GDK_GL_API_GLES;
}
else
{
g_set_error_literal (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
_("The EGL implementation does not support any allowed APIs"));
return 0;
}
/* Specify the flags */
context_attribs[i++] = EGL_CONTEXT_FLAGS_KHR;
context_attribs[i++] = flags;
context_attribs[i++] = EGL_NONE;
g_assert (i < N_EGL_ATTRS);
GDK_DISPLAY_NOTE (display, OPENGL,
g_message ("Creating EGL context version %d.%d (debug:%s, forward:%s, legacy:%s, es:%s)",
major, minor,
debug_bit ? "yes" : "no",
forward_bit ? "yes" : "no",
legacy_bit ? "yes" : "no",
api == GDK_GL_API_GLES ? "yes" : "no"));
ctx = eglCreateContext (egl_display,
egl_config,
share != NULL ? share_priv->egl_context
: EGL_NO_CONTEXT,
context_attribs);
/* If context creation failed without the ES bit, let's try again with it */
if (ctx == NULL && gdk_gl_context_is_api_allowed (context, GDK_GL_API_GLES, NULL) && eglBindAPI (EGL_OPENGL_ES_API))
{
i = 0;
context_attribs[i++] = EGL_CONTEXT_MAJOR_VERSION;
context_attribs[i++] = 2;
context_attribs[i++] = EGL_CONTEXT_MINOR_VERSION;
context_attribs[i++] = 0;
context_attribs[i++] = EGL_CONTEXT_FLAGS_KHR;
context_attribs[i++] = flags & ~EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
context_attribs[i++] = EGL_NONE;
g_assert (i < N_EGL_ATTRS);
legacy_bit = FALSE;
api = GDK_GL_API_GLES;
GDK_DISPLAY_NOTE (display, OPENGL,
g_message ("eglCreateContext failed, switching to OpenGL ES"));
ctx = eglCreateContext (egl_display,
egl_config,
share != NULL ? share_priv->egl_context
: EGL_NO_CONTEXT,
context_attribs);
}
/* If context creation failed without the legacy bit, let's try again with it */
if (ctx == NULL && gdk_gl_context_is_api_allowed (context, GDK_GL_API_GL, NULL) && eglBindAPI (EGL_OPENGL_API))
{
i = 0;
context_attribs[i++] = EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR;
context_attribs[i++] = EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR;
context_attribs[i++] = EGL_CONTEXT_MAJOR_VERSION;
context_attribs[i++] = 3;
context_attribs[i++] = EGL_CONTEXT_MINOR_VERSION;
context_attribs[i++] = 0;
context_attribs[i++] = EGL_CONTEXT_FLAGS_KHR;
context_attribs[i++] = flags & ~EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
context_attribs[i++] = EGL_NONE;
g_assert (i < N_EGL_ATTRS);
legacy_bit = TRUE;
api = GDK_GL_API_GL;
GDK_DISPLAY_NOTE (display, OPENGL,
g_message ("eglCreateContext failed, switching to legacy"));
ctx = eglCreateContext (egl_display,
egl_config,
share != NULL ? share_priv->egl_context
: EGL_NO_CONTEXT,
context_attribs);
}
if (ctx == NULL)
{
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
_("Unable to create a GL context"));
return 0;
}
GDK_DISPLAY_NOTE (display, OPENGL, g_message ("Created EGL context[%p]", ctx));
priv->egl_context = ctx;
gdk_gl_context_set_is_legacy (context, legacy_bit);
if (epoxy_has_egl_extension (egl_display, "EGL_KHR_swap_buffers_with_damage"))
priv->eglSwapBuffersWithDamage = (gpointer)epoxy_eglGetProcAddress ("eglSwapBuffersWithDamageKHR");
else if (epoxy_has_egl_extension (egl_display, "EGL_EXT_swap_buffers_with_damage"))
priv->eglSwapBuffersWithDamage = (gpointer)epoxy_eglGetProcAddress ("eglSwapBuffersWithDamageEXT");
gdk_profiler_end_mark (start_time, "realize GdkWaylandGLContext", NULL);
return api;
/* We want a core profile, unless in legacy mode */
context_attribs[i++] = EGL_CONTEXT_OPENGL_PROFILE_MASK;
context_attribs[i++] = legacy
? EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT
: EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT;
}
if (legacy || api == GDK_GL_API_GLES)
flags &= ~EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
context_attribs[i++] = EGL_CONTEXT_MAJOR_VERSION;
context_attribs[i++] = major;
context_attribs[i++] = EGL_CONTEXT_MINOR_VERSION;
context_attribs[i++] = minor;
context_attribs[i++] = EGL_CONTEXT_FLAGS_KHR;
context_attribs[i++] = flags;
context_attribs[i++] = EGL_NONE;
g_assert (i < N_EGL_ATTRS);
GDK_DISPLAY_NOTE (display, OPENGL,
g_message ("Creating EGL context version %d.%d (debug:%s, forward:%s, legacy:%s, es:%s)",
major, minor,
debug_bit ? "yes" : "no",
forward_bit ? "yes" : "no",
legacy ? "yes" : "no",
api == GDK_GL_API_GLES ? "yes" : "no"));
ctx = eglCreateContext (egl_display,
egl_config,
share ? share_priv->egl_context : EGL_NO_CONTEXT,
context_attribs);
if (ctx == NULL)
return 0;
GDK_DISPLAY_NOTE (display, OPENGL, g_message ("Created EGL context[%p]", ctx));
priv->egl_context = ctx;
gdk_gl_context_set_is_legacy (context, legacy);
if (epoxy_has_egl_extension (egl_display, "EGL_KHR_swap_buffers_with_damage"))
priv->eglSwapBuffersWithDamage = (gpointer) epoxy_eglGetProcAddress ("eglSwapBuffersWithDamageKHR");
else if (epoxy_has_egl_extension (egl_display, "EGL_EXT_swap_buffers_with_damage"))
priv->eglSwapBuffersWithDamage = (gpointer) epoxy_eglGetProcAddress ("eglSwapBuffersWithDamageEXT");
gdk_profiler_end_mark (start_time, "realize GdkWaylandGLContext", NULL);
return api;
}
static GdkGLAPI
gdk_gl_context_realize_egl (GdkGLContext *context,
GError **error)
{
GdkDisplay *display = gdk_gl_context_get_display (context);
GdkGLContext *share = gdk_display_get_gl_context (display);
GdkGLAPI api, preferred_api;
gboolean prefer_legacy;
if (share && gdk_gl_context_is_api_allowed (context,
gdk_gl_context_get_api (share),
NULL))
preferred_api = gdk_gl_context_get_api (share);
else if (gdk_gl_context_is_api_allowed (context, GDK_GL_API_GL, NULL))
preferred_api = GDK_GL_API_GL;
else if (gdk_gl_context_is_api_allowed (context, GDK_GL_API_GLES, NULL))
preferred_api = GDK_GL_API_GLES;
else
{
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
_("No GL API allowed."));
return 0;
}
prefer_legacy = (GDK_DISPLAY_DEBUG_CHECK (display, GL_LEGACY) ||
(share != NULL && gdk_gl_context_is_legacy (share)));
if (preferred_api == GDK_GL_API_GL)
{
if ((api = gdk_gl_context_create_egl_context (context, GDK_GL_API_GL, prefer_legacy)) ||
(api = gdk_gl_context_create_egl_context (context, GDK_GL_API_GLES, FALSE)) ||
(api = gdk_gl_context_create_egl_context (context, GDK_GL_API_GL, TRUE)))
return api;
}
else
{
if ((api = gdk_gl_context_create_egl_context (context, GDK_GL_API_GLES, FALSE)) ||
(api = gdk_gl_context_create_egl_context (context, GDK_GL_API_GL, prefer_legacy)) ||
(api = gdk_gl_context_create_egl_context (context, GDK_GL_API_GL, TRUE)))
return api;
}
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
_("Unable to create a GL context"));
return 0;
}
#endif /* HAVE_EGL */
static GdkGLAPI
gdk_gl_context_default_realize (GdkGLContext *context,
GError **error)
{
#ifdef HAVE_EGL
GdkDisplay *display = gdk_gl_context_get_display (context);
if (gdk_display_get_egl_display (display))
return gdk_gl_context_realize_egl (context, error);
#endif
g_set_error_literal (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
@@ -667,7 +665,7 @@ gdk_gl_context_class_init (GdkGLContextClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GdkDrawContextClass *draw_context_class = GDK_DRAW_CONTEXT_CLASS (klass);
klass->realize = gdk_gl_context_real_realize;
klass->realize = gdk_gl_context_default_realize;
klass->get_damage = gdk_gl_context_real_get_damage;
klass->is_shared = gdk_gl_context_real_is_shared;
klass->make_current = gdk_gl_context_real_make_current;
@@ -690,9 +688,7 @@ gdk_gl_context_class_init (GdkGLContextClass *klass)
* can be shared.
*/
properties[PROP_SHARED_CONTEXT] =
g_param_spec_object ("shared-context",
P_("Shared context"),
P_("The GL context this context shares data with"),
g_param_spec_object ("shared-context", NULL, NULL,
GDK_TYPE_GL_CONTEXT,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
@@ -707,9 +703,7 @@ gdk_gl_context_class_init (GdkGLContextClass *klass)
* Since: 4.6
*/
properties[PROP_ALLOWED_APIS] =
g_param_spec_flags ("allowed-apis",
P_("Allowed APIs"),
P_("The list of allowed APIs for this context"),
g_param_spec_flags ("allowed-apis", NULL, NULL,
GDK_TYPE_GL_API,
DEFAULT_ALLOWED_APIS,
G_PARAM_READWRITE |
@@ -724,9 +718,7 @@ gdk_gl_context_class_init (GdkGLContextClass *klass)
* Since: 4.6
*/
properties[PROP_API] =
g_param_spec_flags ("api",
P_("API"),
P_("The API currently in use"),
g_param_spec_flags ("api", NULL, NULL,
GDK_TYPE_GL_API,
0,
G_PARAM_READABLE |
@@ -960,6 +952,48 @@ gdk_gl_context_get_forward_compatible (GdkGLContext *context)
return priv->forward_compatible;
}
void
gdk_gl_context_get_matching_version (GdkGLAPI api,
gboolean legacy,
gboolean win32_libangle,
int *major,
int *minor)
{
int maj, min;
if (api == GDK_GL_API_GL)
{
if (legacy)
{
maj = GDK_GL_MIN_GL_LEGACY_VERSION_MAJOR;
min = GDK_GL_MIN_GL_LEGACY_VERSION_MINOR;
}
else
{
maj = GDK_GL_MIN_GL_VERSION_MAJOR;
min = GDK_GL_MIN_GL_VERSION_MINOR;
}
}
else
{
if (win32_libangle)
{
maj = GDK_GL_MIN_GLES_WIN32_ANGLE_VERSION_MAJOR;
min = GDK_GL_MIN_GLES_WIN32_ANGLE_VERSION_MINOR;
}
else
{
maj = GDK_GL_MIN_GLES_VERSION_MAJOR;
min = GDK_GL_MIN_GLES_VERSION_MINOR;
}
}
if (major != NULL)
*major = maj;
if (minor != NULL)
*minor = min;
}
/**
* gdk_gl_context_set_required_version:
* @context: a `GdkGLContext`
@@ -970,7 +1004,10 @@ gdk_gl_context_get_forward_compatible (GdkGLContext *context)
*
* Setting @major and @minor to zero will use the default values.
*
* The `GdkGLContext` must not be realized or made current prior to calling
* Setting @major and @minor lower than the minimum versions required
* by GTK will result in the context choosing the minimum version.
*
* The @context must not be realized or made current prior to calling
* this function.
*/
void
@@ -979,44 +1016,12 @@ gdk_gl_context_set_required_version (GdkGLContext *context,
int minor)
{
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
gboolean force_gles = FALSE;
int version, min_ver;
#ifdef G_ENABLE_DEBUG
GdkDisplay *display;
#endif
g_return_if_fail (GDK_IS_GL_CONTEXT (context));
g_return_if_fail (!gdk_gl_context_is_realized (context));
/* this will take care of the default */
if (major == 0 && minor == 0)
{
priv->major = 0;
priv->minor = 0;
return;
}
version = (major * 100) + minor;
#ifdef G_ENABLE_DEBUG
display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
force_gles = GDK_DISPLAY_DEBUG_CHECK (display, GL_GLES);
#endif
/* Enforce a minimum context version number of 3.2 for desktop GL,
* and 2.0 for GLES
*/
if (gdk_gl_context_get_use_es (context) || force_gles)
min_ver = 200;
else
min_ver = 302;
if (version < min_ver)
{
g_warning ("gdk_gl_context_set_required_version - GL context versions less than 3.2 are not supported.");
version = min_ver;
}
priv->major = version / 100;
priv->minor = version % 100;
priv->major = major;
priv->minor = minor;
}
gboolean
@@ -1055,7 +1060,10 @@ gdk_gl_context_check_version (GdkGLContext *self,
* @major: (out) (nullable): return location for the major version to request
* @minor: (out) (nullable): return location for the minor version to request
*
* Retrieves required OpenGL version.
* Retrieves required OpenGL version set as a requirement for the @context
* realization. It will not change even if a greater OpenGL version is supported
* and used after the @context is realized. See
* [method@Gdk.GLContext.get_version] for the real version in use.
*
* See [method@Gdk.GLContext.set_required_version].
*/
@@ -1065,47 +1073,32 @@ gdk_gl_context_get_required_version (GdkGLContext *context,
int *minor)
{
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
gboolean force_gles = FALSE;
GdkDisplay *display;
int default_major, default_minor;
int maj, min;
g_return_if_fail (GDK_IS_GL_CONTEXT (context));
display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
if (major != NULL)
*major = priv->major;
if (minor != NULL)
*minor = priv->minor;
}
#ifdef G_ENABLE_DEBUG
force_gles = GDK_DISPLAY_DEBUG_CHECK (display, GL_GLES);
#endif
void
gdk_gl_context_get_clipped_version (GdkGLContext *context,
int min_major,
int min_minor,
int *major,
int *minor)
{
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
int maj = min_major, min = min_minor;
/* libANGLE on Windows at least requires GLES 3.0+ */
if (display->have_egl_win32_libangle)
force_gles = TRUE;
g_return_if_fail (GDK_IS_GL_CONTEXT (context));
/* Default fallback values for uninitialised contexts; we
* enforce a context version number of 3.2 for desktop GL,
* and 2.0 for GLES
*/
if (gdk_gl_context_get_use_es (context) || force_gles)
if (priv->major > maj || (priv->major == maj && priv->minor > min))
{
default_major = display->have_egl_win32_libangle ? 3 : 2;
default_minor = 0;
maj = priv->major;
min = priv->minor;
}
else
{
default_major = 3;
default_minor = 2;
}
if (priv->major > 0)
maj = priv->major;
else
maj = default_major;
if (priv->minor > 0)
min = priv->minor;
else
min = default_minor;
if (major != NULL)
*major = maj;
@@ -1342,7 +1335,9 @@ gdk_gl_context_set_use_es (GdkGLContext *context,
*
* Checks whether the @context is using an OpenGL or OpenGL ES profile.
*
* Returns: %TRUE if the `GdkGLContext` is using an OpenGL ES profile
* Returns: %TRUE if the `GdkGLContext` is using an OpenGL ES profile;
* %FALSE if other profile is in use of if the @context has not yet
* been realized.
*/
gboolean
gdk_gl_context_get_use_es (GdkGLContext *context)
@@ -1673,6 +1668,10 @@ gdk_gl_context_get_shared_context (GdkGLContext *context)
* Retrieves the OpenGL version of the @context.
*
* The @context must be realized prior to calling this function.
*
* If the @context has never been made current, the version cannot
* be known and it will return 0 for both @major and @minor.
*
*/
void
gdk_gl_context_get_version (GdkGLContext *context,
@@ -1851,4 +1850,3 @@ gdk_gl_backend_use (GdkGLBackend backend_type)
g_assert (the_gl_backend_type == backend_type);
}
+26
View File
@@ -33,6 +33,22 @@ G_BEGIN_DECLS
#define GDK_EGL_MIN_VERSION_MAJOR (1)
#define GDK_EGL_MIN_VERSION_MINOR (4)
/* Minimum OpenGL versions supported by GTK.
* Backends should make sure to never create a context of a previous version.
*
* The macros refer to OpenGL; OpenGL with OPENGL_COMPATIBILITY_PROFILE_BIT as
* OPENGL_PROFILE_MASK; OpenGL ES; and OpenGL ES win32 Angle implementation,
* respectively
*/
#define GDK_GL_MIN_GL_VERSION_MAJOR (3)
#define GDK_GL_MIN_GL_VERSION_MINOR (2)
#define GDK_GL_MIN_GL_LEGACY_VERSION_MAJOR (3)
#define GDK_GL_MIN_GL_LEGACY_VERSION_MINOR (0)
#define GDK_GL_MIN_GLES_VERSION_MAJOR (2)
#define GDK_GL_MIN_GLES_VERSION_MINOR (0)
#define GDK_GL_MIN_GLES_WIN32_ANGLE_VERSION_MAJOR (3)
#define GDK_GL_MIN_GLES_WIN32_ANGLE_VERSION_MINOR (0)
typedef enum {
GDK_GL_NONE = 0,
GDK_GL_EGL,
@@ -117,6 +133,16 @@ gboolean gdk_gl_context_check_version (GdkGLContext
int required_gl_minor,
int required_gles_major,
int required_gles_minor);
void gdk_gl_context_get_clipped_version (GdkGLContext *context,
int min_major,
int min_minor,
int *major,
int *minor);
void gdk_gl_context_get_matching_version (GdkGLAPI api,
gboolean legacy,
gboolean win32_libangle,
int *major,
int *minor);
gboolean gdk_gl_context_has_unpack_subimage (GdkGLContext *context);
void gdk_gl_context_push_debug_group (GdkGLContext *context,
-2
View File
@@ -27,6 +27,4 @@
#include <glib/gi18n-lib.h>
#define P_(String) dgettext (GETTEXT_PACKAGE "-properties", String)
#endif
+1 -3
View File
@@ -123,9 +123,7 @@ gdk_keymap_class_init (GdkKeymapClass *klass)
klass->keys_changed = gdk_keymap_keys_changed;
props[PROP_DISPLAY] =
g_param_spec_object ("display",
"Display",
"The display of the keymap",
g_param_spec_object ("display", NULL, NULL,
GDK_TYPE_DISPLAY,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
+7 -7
View File
@@ -178,19 +178,19 @@ gdk_memory_texture_new_subtexture (GdkMemoryTexture *source,
GBytes *bytes;
g_return_val_if_fail (GDK_IS_MEMORY_TEXTURE (source), NULL);
g_return_val_if_fail (x < 0 || x >= GDK_TEXTURE (source)->width, NULL);
g_return_val_if_fail (y < 0 || y >= GDK_TEXTURE (source)->height, NULL);
g_return_val_if_fail (width <= 0 || x + width > GDK_TEXTURE (source)->width, NULL);
g_return_val_if_fail (height <= 0 || y + height > GDK_TEXTURE (source)->height, NULL);
g_return_val_if_fail (x >= 0 || x < GDK_TEXTURE (source)->width, NULL);
g_return_val_if_fail (y >= 0 || y < GDK_TEXTURE (source)->height, NULL);
g_return_val_if_fail (width > 0 || x + width <= GDK_TEXTURE (source)->width, NULL);
g_return_val_if_fail (height > 0 || y + height <= GDK_TEXTURE (source)->height, NULL);
texture = GDK_TEXTURE (source);
bpp = gdk_memory_format_bytes_per_pixel (texture->format);
offset = y * source->stride + x * bpp;
size = source->stride * (height - 1) + x * bpp;
size = source->stride * (height - 1) + width * bpp;
bytes = g_bytes_new_from_bytes (source->bytes, offset, size);
result = gdk_memory_texture_new (texture->width,
texture->height,
result = gdk_memory_texture_new (width,
height,
texture->format,
bytes,
source->stride);
+11 -33
View File
@@ -176,9 +176,7 @@ gdk_monitor_class_init (GdkMonitorClass *class)
* The `GdkDisplay` of the monitor.
*/
props[PROP_DISPLAY] =
g_param_spec_object ("display",
"Display",
"The display of the monitor",
g_param_spec_object ("display", NULL, NULL,
GDK_TYPE_DISPLAY,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
@@ -188,9 +186,7 @@ gdk_monitor_class_init (GdkMonitorClass *class)
* The manufacturer name.
*/
props[PROP_MANUFACTURER] =
g_param_spec_string ("manufacturer",
"Manufacturer",
"The manufacturer name",
g_param_spec_string ("manufacturer", NULL, NULL,
NULL,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -200,9 +196,7 @@ gdk_monitor_class_init (GdkMonitorClass *class)
* The model name.
*/
props[PROP_MODEL] =
g_param_spec_string ("model",
"Model",
"The model name",
g_param_spec_string ("model", NULL, NULL,
NULL,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -212,9 +206,7 @@ gdk_monitor_class_init (GdkMonitorClass *class)
* The connector name.
*/
props[PROP_CONNECTOR] =
g_param_spec_string ("connector",
"Connector",
"The connector name",
g_param_spec_string ("connector", NULL, NULL,
NULL,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -224,9 +216,7 @@ gdk_monitor_class_init (GdkMonitorClass *class)
* The scale factor.
*/
props[PROP_SCALE_FACTOR] =
g_param_spec_int ("scale-factor",
"Scale factor",
"The scale factor",
g_param_spec_int ("scale-factor", NULL, NULL,
0, G_MAXINT,
1,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -237,9 +227,7 @@ gdk_monitor_class_init (GdkMonitorClass *class)
* The geometry of the monitor.
*/
props[PROP_GEOMETRY] =
g_param_spec_boxed ("geometry",
"Geometry",
"The geometry of the monitor",
g_param_spec_boxed ("geometry", NULL, NULL,
GDK_TYPE_RECTANGLE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -249,9 +237,7 @@ gdk_monitor_class_init (GdkMonitorClass *class)
* The width of the monitor, in millimeters.
*/
props[PROP_WIDTH_MM] =
g_param_spec_int ("width-mm",
"Physical width",
"The width of the monitor, in millimeters",
g_param_spec_int ("width-mm", NULL, NULL,
0, G_MAXINT,
0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -262,9 +248,7 @@ gdk_monitor_class_init (GdkMonitorClass *class)
* The height of the monitor, in millimeters.
*/
props[PROP_HEIGHT_MM] =
g_param_spec_int ("height-mm",
"Physical height",
"The height of the monitor, in millimeters",
g_param_spec_int ("height-mm", NULL, NULL,
0, G_MAXINT,
0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -275,9 +259,7 @@ gdk_monitor_class_init (GdkMonitorClass *class)
* The refresh rate, in milli-Hertz.
*/
props[PROP_REFRESH_RATE] =
g_param_spec_int ("refresh-rate",
"Refresh rate",
"The refresh rate, in millihertz",
g_param_spec_int ("refresh-rate", NULL, NULL,
0, G_MAXINT,
0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -288,9 +270,7 @@ gdk_monitor_class_init (GdkMonitorClass *class)
* The subpixel layout.
*/
props[PROP_SUBPIXEL_LAYOUT] =
g_param_spec_enum ("subpixel-layout",
"Subpixel layout",
"The subpixel layout",
g_param_spec_enum ("subpixel-layout", NULL, NULL,
GDK_TYPE_SUBPIXEL_LAYOUT,
GDK_SUBPIXEL_LAYOUT_UNKNOWN,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -301,9 +281,7 @@ gdk_monitor_class_init (GdkMonitorClass *class)
* Whether the object is still valid.
*/
props[PROP_VALID] =
g_param_spec_boolean ("valid",
"Valid",
"Whether the monitor is still valid",
g_param_spec_boolean ("valid", NULL, NULL,
TRUE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+2 -6
View File
@@ -85,9 +85,7 @@ gdk_popup_default_init (GdkPopupInterface *iface)
* The parent surface.
*/
g_object_interface_install_property (iface,
g_param_spec_object ("parent",
P_("Parent"),
P_("The parent surface"),
g_param_spec_object ("parent", NULL, NULL,
GDK_TYPE_SURFACE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
@@ -97,9 +95,7 @@ gdk_popup_default_init (GdkPopupInterface *iface)
* Whether to hide on outside clicks.
*/
g_object_interface_install_property (iface,
g_param_spec_boolean ("autohide",
P_("Autohide"),
P_("Whether to hide on outside clicks"),
g_param_spec_boolean ("autohide", NULL, NULL,
FALSE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
}
+1 -3
View File
@@ -184,9 +184,7 @@ gdk_seat_class_init (GdkSeatClass *klass)
* `GdkDisplay` of this seat.
*/
props[PROP_DISPLAY] =
g_param_spec_object ("display",
P_("Display"),
P_("Display"),
g_param_spec_object ("display", NULL, NULL,
GDK_TYPE_DISPLAY,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
+7 -21
View File
@@ -506,9 +506,7 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
* The mouse pointer for the `GdkSurface`.
*/
properties[PROP_CURSOR] =
g_param_spec_object ("cursor",
P_("Cursor"),
P_("Cursor"),
g_param_spec_object ("cursor", NULL, NULL,
GDK_TYPE_CURSOR,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
@@ -518,9 +516,7 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
* The `GdkDisplay` connection of the surface.
*/
properties[PROP_DISPLAY] =
g_param_spec_object ("display",
P_("Display"),
P_("Display"),
g_param_spec_object ("display", NULL, NULL,
GDK_TYPE_DISPLAY,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
@@ -530,9 +526,7 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
* The `GdkFrameClock` of the surface.
*/
properties[PROP_FRAME_CLOCK] =
g_param_spec_object ("frame-clock",
P_("Frame Clock"),
P_("Frame Clock"),
g_param_spec_object ("frame-clock", NULL, NULL,
GDK_TYPE_FRAME_CLOCK,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
@@ -542,9 +536,7 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
* Whether the surface is mapped.
*/
properties[PROP_MAPPED] =
g_param_spec_boolean ("mapped",
P_("Mapped"),
P_("Mapped"),
g_param_spec_boolean ("mapped", NULL, NULL,
FALSE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -554,9 +546,7 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
* The width of the surface in pixels.
*/
properties[PROP_WIDTH] =
g_param_spec_int ("width",
P_("Width"),
P_("Width"),
g_param_spec_int ("width", NULL, NULL,
0, G_MAXINT, 0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -566,9 +556,7 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
* The height of the surface, in pixels.
*/
properties[PROP_HEIGHT] =
g_param_spec_int ("height",
P_("Height"),
P_("Height"),
g_param_spec_int ("height", NULL, NULL,
0, G_MAXINT, 0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -578,9 +566,7 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
* The scale factor of the surface.
*/
properties[PROP_SCALE_FACTOR] =
g_param_spec_int ("scale-factor",
P_("Scale factor"),
P_("Scale factor"),
g_param_spec_int ("scale-factor", NULL, NULL,
1, G_MAXINT, 1,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+2 -6
View File
@@ -304,9 +304,7 @@ gdk_texture_class_init (GdkTextureClass *klass)
* The width of the texture, in pixels.
*/
properties[PROP_WIDTH] =
g_param_spec_int ("width",
"Width",
"The width of the texture",
g_param_spec_int ("width", NULL, NULL,
1,
G_MAXINT,
1,
@@ -321,9 +319,7 @@ gdk_texture_class_init (GdkTextureClass *klass)
* The height of the texture, in pixels.
*/
properties[PROP_HEIGHT] =
g_param_spec_int ("height",
"Height",
"The height of the texture",
g_param_spec_int ("height", NULL, NULL,
1,
G_MAXINT,
1,
+10 -30
View File
@@ -131,9 +131,7 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
* The state of the toplevel.
*/
g_object_interface_install_property (iface,
g_param_spec_flags ("state",
P_("State"),
P_("State"),
g_param_spec_flags ("state", NULL, NULL,
GDK_TYPE_TOPLEVEL_STATE, 0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
@@ -143,9 +141,7 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
* The title of the surface.
*/
g_object_interface_install_property (iface,
g_param_spec_string ("title",
"Title",
"The title of the surface",
g_param_spec_string ("title", NULL, NULL,
NULL,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
@@ -158,9 +154,7 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
* startup feedback.
*/
g_object_interface_install_property (iface,
g_param_spec_string ("startup-id",
"Startup ID",
"The startup ID of the surface",
g_param_spec_string ("startup-id", NULL, NULL,
NULL,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
@@ -170,9 +164,7 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
* The transient parent of the surface.
*/
g_object_interface_install_property (iface,
g_param_spec_object ("transient-for",
"Transient For",
"The transient parent of the surface",
g_param_spec_object ("transient-for", NULL, NULL,
GDK_TYPE_SURFACE,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
@@ -182,9 +174,7 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
* Whether the surface is modal.
*/
g_object_interface_install_property (iface,
g_param_spec_boolean ("modal",
"Modal",
"Whether the surface is modal",
g_param_spec_boolean ("modal", NULL, NULL,
FALSE,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
@@ -194,9 +184,7 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
* A list of textures to use as icon.
*/
g_object_interface_install_property (iface,
g_param_spec_pointer ("icon-list",
"Icon List",
"The list of icon textures",
g_param_spec_pointer ("icon-list", NULL, NULL,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
/**
@@ -205,9 +193,7 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
* Whether the window manager should add decorations.
*/
g_object_interface_install_property (iface,
g_param_spec_boolean ("decorated",
"Decorated",
"Decorated",
g_param_spec_boolean ("decorated", NULL, NULL,
FALSE,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
@@ -217,9 +203,7 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
* Whether the window manager should allow to close the surface.
*/
g_object_interface_install_property (iface,
g_param_spec_boolean ("deletable",
"Deletable",
"Deletable",
g_param_spec_boolean ("deletable", NULL, NULL,
FALSE,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
@@ -229,9 +213,7 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
* The fullscreen mode of the surface.
*/
g_object_interface_install_property (iface,
g_param_spec_enum ("fullscreen-mode",
"Fullscreen mode",
"Fullscreen mode",
g_param_spec_enum ("fullscreen-mode", NULL, NULL,
GDK_TYPE_FULLSCREEN_MODE,
GDK_FULLSCREEN_ON_CURRENT_MONITOR,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
@@ -242,9 +224,7 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
* Whether the surface should inhibit keyboard shortcuts.
*/
g_object_interface_install_property (iface,
g_param_spec_boolean ("shortcuts-inhibited",
"Shortcuts inhibited",
"Whether keyboard shortcuts are inhibited",
g_param_spec_boolean ("shortcuts-inhibited", NULL, NULL,
FALSE,
G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY));
+1 -2
View File
@@ -700,8 +700,7 @@ fill_scroll_event (GdkMacosDisplay *self,
NULL,
get_time_from_ns_event (nsevent),
state,
direction,
FALSE);
direction);
}
if (phase == NSEventPhaseEnded || phase == NSEventPhaseCancelled)
+1 -3
View File
@@ -601,9 +601,7 @@ gdk_macos_drag_class_init (GdkMacosDragClass *klass)
drag_class->handle_event = gdk_macos_drag_handle_event;
properties [PROP_DRAG_SURFACE] =
g_param_spec_object ("drag-surface",
P_("Drag Surface"),
P_("Drag Surface"),
g_param_spec_object ("drag-surface", NULL, NULL,
GDK_TYPE_MACOS_DRAG_SURFACE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
+4 -1
View File
@@ -378,7 +378,10 @@ gdk_macos_gl_context_real_realize (GdkGLContext *context,
existing = CGLGetCurrentContext ();
gdk_gl_context_get_required_version (context, &major, &minor);
gdk_gl_context_get_clipped_version (context,
GDK_GL_MIN_GL_VERSION_MAJOR,
GDK_GL_MIN_GL_VERSION_MINOR,
&major, &minor);
display = gdk_gl_context_get_display (context);
shared = gdk_display_get_gl_context (display);
+1 -3
View File
@@ -602,9 +602,7 @@ gdk_macos_surface_class_init (GdkMacosSurfaceClass *klass)
* The "native" property contains the underlying NSWindow.
*/
properties [PROP_NATIVE] =
g_param_spec_pointer ("native",
"Native",
"The native NSWindow",
g_param_spec_pointer ("native", NULL, NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, LAST_PROP, properties);
+66 -28
View File
@@ -200,23 +200,51 @@ wl_cursor_destroy(struct wl_cursor *cursor)
}
static struct wl_cursor *
wl_cursor_create_from_xcursor_images(XcursorImages *images,
struct wl_cursor_theme *theme,
wl_cursor_create_from_xcursor_images(struct wl_cursor_theme *theme,
const char *name,
unsigned int load_size)
unsigned int size,
unsigned int scale)
{
char *path;
XcursorImages *images;
struct cursor *cursor;
struct cursor_image *image;
int i, size;
int i, nbytes;
unsigned int load_size;
int load_scale = 1;
load_size = size * scale;
path = g_strconcat (theme->path, "/", name, NULL);
images = xcursor_load_images (path, load_size);
if (!images)
{
g_free (path);
return NULL;
}
if (images->images[0]->width != load_size ||
images->images[0]->height != load_size)
{
xcursor_images_destroy (images);
images = xcursor_load_images (path, size);
load_scale = scale;
}
g_free (path);
cursor = malloc(sizeof *cursor);
if (!cursor)
if (!cursor) {
xcursor_images_destroy (images);
return NULL;
}
cursor->cursor.images =
malloc(images->nimage * sizeof cursor->cursor.images[0]);
if (!cursor->cursor.images) {
free(cursor);
xcursor_images_destroy (images);
return NULL;
}
@@ -232,22 +260,37 @@ wl_cursor_create_from_xcursor_images(XcursorImages *images,
image->theme = theme;
image->buffer = NULL;
image->image.width = images->images[i]->width;
image->image.height = images->images[i]->height;
image->image.hotspot_x = images->images[i]->xhot;
image->image.hotspot_y = images->images[i]->yhot;
image->image.width = images->images[i]->width * load_scale;
image->image.height = images->images[i]->height * load_scale;
image->image.hotspot_x = images->images[i]->xhot * load_scale;
image->image.hotspot_y = images->images[i]->yhot * load_scale;
image->image.delay = images->images[i]->delay;
size = image->image.width * image->image.height * 4;
image->offset = shm_pool_allocate(theme->pool, size);
nbytes = image->image.width * image->image.height * 4;
image->offset = shm_pool_allocate(theme->pool, nbytes);
if (image->offset < 0) {
free(image);
break;
}
/* copy pixels to shm pool */
memcpy(theme->pool->data + image->offset,
images->images[i]->pixels, size);
if (load_scale == 1) {
/* copy pixels to shm pool */
memcpy(theme->pool->data + image->offset,
images->images[i]->pixels, nbytes);
}
else {
/* scale image up while copying it */
for (int y = 0; y < image->image.height; y++) {
char *p = theme->pool->data + image->offset + y * image->image.width * 4;
char *q = ((char *)images->images[i]->pixels) + (y / load_scale) * images->images[i]->width * 4;
for (int x = 0; x < image->image.width; x++) {
p[4 * x] = q[4 * (x/load_scale)];
p[4 * x + 1] = q[4 * (x/load_scale) + 1];
p[4 * x + 2] = q[4 * (x/load_scale) + 2];
p[4 * x + 3] = q[4 * (x/load_scale) + 3];
}
}
}
cursor->total_delay += image->image.delay;
cursor->cursor.images[i] = (struct wl_cursor_image *) image;
}
@@ -257,27 +300,24 @@ wl_cursor_create_from_xcursor_images(XcursorImages *images,
free(cursor->cursor.name);
free(cursor->cursor.images);
free(cursor);
xcursor_images_destroy (images);
return NULL;
}
xcursor_images_destroy (images);
return &cursor->cursor;
}
static void
load_cursor(struct wl_cursor_theme *theme, const char *name, unsigned int size)
load_cursor(struct wl_cursor_theme *theme,
const char *name,
unsigned int size,
unsigned int scale)
{
XcursorImages *images;
struct wl_cursor *cursor;
char *path;
path = g_strconcat (theme->path, "/", name, NULL);
images = xcursor_load_images (path, size);
g_free (path);
if (!images)
return;
cursor = wl_cursor_create_from_xcursor_images(images, theme, name, size);
cursor = wl_cursor_create_from_xcursor_images(theme, name, size, scale);
if (cursor) {
theme->cursor_count++;
@@ -292,8 +332,6 @@ load_cursor(struct wl_cursor_theme *theme, const char *name, unsigned int size)
theme->cursors[theme->cursor_count - 1] = cursor;
}
}
xcursor_images_destroy (images);
}
/** Load a cursor theme to memory shared with the compositor
@@ -373,7 +411,7 @@ wl_cursor_theme_get_cursor(struct wl_cursor_theme *theme,
return theme->cursors[i];
}
load_cursor (theme, name, size);
load_cursor (theme, name, theme->size, scale);
if (i < theme->cursor_count) {
if (size == theme->cursors[i]->size &&
+13 -4
View File
@@ -59,13 +59,17 @@ gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context
if (display->xdg_activation)
{
struct xdg_activation_token_v1 *token;
struct wl_event_queue *event_queue;
struct wl_surface *wl_surface = NULL;
GdkWaylandSeat *seat;
GdkSurface *focus_surface;
AppLaunchData app_launch_data = { 0 };
event_queue = wl_display_create_queue (display->wl_display);
seat = GDK_WAYLAND_SEAT (gdk_display_get_default_seat (GDK_DISPLAY (display)));
focus_surface = gdk_wayland_device_get_focus (gdk_seat_get_keyboard (GDK_SEAT (seat)));
token = xdg_activation_v1_get_activation_token (display->xdg_activation);
wl_proxy_set_queue ((struct wl_proxy *) token, event_queue);
xdg_activation_token_v1_add_listener (token,
&token_listener,
@@ -73,16 +77,21 @@ gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context
xdg_activation_token_v1_set_serial (token,
_gdk_wayland_seat_get_last_implicit_grab_serial (seat, NULL),
gdk_wayland_seat_get_wl_seat (GDK_SEAT (seat)));
focus_surface = gdk_wayland_device_get_focus (gdk_seat_get_keyboard (GDK_SEAT (seat)));
if (focus_surface)
xdg_activation_token_v1_set_surface (token,
gdk_wayland_surface_get_wl_surface (focus_surface));
wl_surface = gdk_wayland_surface_get_wl_surface (focus_surface);
if (wl_surface)
xdg_activation_token_v1_set_surface (token, wl_surface);
xdg_activation_token_v1_commit (token);
while (app_launch_data.token == NULL)
wl_display_roundtrip (display->wl_display);
wl_display_dispatch_queue (display->wl_display, event_queue);
xdg_activation_token_v1_destroy (token);
id = app_launch_data.token;
wl_event_queue_destroy (event_queue);
}
else if (display->gtk_shell_version >= 3)
{
+16 -5
View File
@@ -178,6 +178,7 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
if (c)
{
struct wl_cursor_image *image;
int cursor_scale;
if (image_index >= c->image_count)
{
@@ -189,12 +190,22 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
image = c->images[image_index];
*hotspot_x = image->hotspot_x / desired_scale;
*hotspot_y = image->hotspot_y / desired_scale;
cursor_scale = desired_scale;
if ((image->width % cursor_scale != 0) ||
(image->height % cursor_scale != 0))
{
g_warning (G_STRLOC " cursor image size (%dx%d) not an integer"
"multiple of scale (%d)", image->width, image->height,
cursor_scale);
cursor_scale = 1;
}
*width = image->width / desired_scale;
*height = image->height / desired_scale;
*scale = desired_scale;
*hotspot_x = image->hotspot_x / cursor_scale;
*hotspot_y = image->hotspot_y / cursor_scale;
*width = image->width / cursor_scale;
*height = image->height / cursor_scale;
*scale = cursor_scale;
return wl_cursor_image_get_buffer (image);
}
+1 -13
View File
@@ -1394,8 +1394,7 @@ flush_discrete_scroll_event (GdkWaylandSeat *seat,
NULL,
seat->pointer_info.time,
device_get_modifiers (seat->logical_pointer),
direction,
TRUE);
direction);
_gdk_wayland_display_deliver_event (seat->display, event);
}
@@ -3999,17 +3998,6 @@ tablet_tool_handle_wheel (void *data,
GDK_SCROLL_UNIT_WHEEL);
_gdk_wayland_display_deliver_event (seat->display, event);
/* Send discrete event */
event = gdk_scroll_event_new_discrete (tablet->pointer_info.focus,
tablet->stylus_device,
tablet->current_tool->tool,
tablet->pointer_info.time,
device_get_modifiers (tablet->logical_device),
clicks > 0 ? GDK_SCROLL_DOWN : GDK_SCROLL_UP,
TRUE);
_gdk_wayland_display_deliver_event (seat->display, event);
}
static void
+10
View File
@@ -113,6 +113,7 @@ struct _GdkWaylandSurface
PopupState popup_state;
unsigned int popup_thaw_upon_show : 1;
unsigned int initial_configure_received : 1;
unsigned int has_uncommitted_ack_configure : 1;
unsigned int mapped : 1;
@@ -2984,6 +2985,9 @@ gdk_wayland_surface_hide_surface (GdkSurface *surface)
if (GDK_IS_POPUP (surface))
{
impl->popup_thaw_upon_show = TRUE;
gdk_surface_freeze_updates (surface);
switch (impl->popup_state)
{
case POPUP_STATE_WAITING_FOR_REPOSITIONED:
@@ -3223,6 +3227,12 @@ show_popup (GdkSurface *surface,
if (!impl->display_server.wl_surface)
gdk_wayland_surface_create_surface (surface);
if (impl->popup_thaw_upon_show)
{
impl->popup_thaw_upon_show = FALSE;
gdk_surface_thaw_updates (surface);
}
gdk_wayland_surface_map_popup (surface, width, height, layout);
}
+3 -9
View File
@@ -231,22 +231,16 @@ gdk_win32_hcursor_class_init (GdkWin32HCursorClass *klass)
object_class->set_property = gdk_win32_hcursor_set_property;
hcursor_props[PROP_DISPLAY] =
g_param_spec_object ("display",
P_("Display"),
P_("The display that will use this cursor"),
g_param_spec_object ("display", NULL, NULL,
GDK_TYPE_DISPLAY,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE);
hcursor_props[PROP_HANDLE] =
g_param_spec_pointer ("handle",
P_("Handle"),
P_("The HCURSOR handle for this cursor"),
g_param_spec_pointer ("handle", NULL, NULL,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE);
hcursor_props[PROP_DESTROYABLE] =
g_param_spec_boolean ("destroyable",
P_("Destroyable"),
P_("Whether calling DestroyCursor() is allowed on this cursor"),
g_param_spec_boolean ("destroyable", NULL, NULL,
TRUE,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE);
+10
View File
@@ -58,6 +58,7 @@
#include "gdkdeviceprivate.h"
#include "gdkdevice-virtual.h"
#include "gdkdevice-wintab.h"
#include "gdkinput-dmanipulation.h"
#include "gdkinput-winpointer.h"
#include "gdkwin32dnd.h"
#include "gdkwin32dnd-private.h"
@@ -2656,6 +2657,13 @@ gdk_event_translate (MSG *msg,
return_val = TRUE;
break;
case DM_POINTERHITTEST:
gdk_dmanipulation_maybe_add_contact (window, msg);
*ret_valp = 0;
return_val = TRUE;
break;
case WM_MOUSEWHEEL:
case WM_MOUSEHWHEEL:
{
@@ -3156,6 +3164,8 @@ gdk_event_translate (MSG *msg,
if (win32_display->tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINPOINTER)
gdk_winpointer_finalize_surface (window);
gdk_dmanipulation_finalize_surface (window);
return_val = FALSE;
break;
+5 -11
View File
@@ -548,17 +548,12 @@ gdk_win32_gl_context_wgl_realize (GdkGLContext *context,
* wglCreateContextAttribsARB() may only give us the GL context version
* that we ask for here, and nothing more. So, improve things here by
* asking for the GL version that is reported to us via epoxy_gl_version(),
* rather than the default GL core 3.2 context. Save this up in our
* GdkGLContext so that subsequent contexts that are shared with this
* context are created likewise too.
* rather than the default GL core 3.2 context.
*/
if (share != NULL)
gdk_gl_context_get_required_version (share, &major, &minor);
else
{
major = display_win32->gl_version / 10;
minor = display_win32->gl_version % 10;
}
gdk_gl_context_get_clipped_version (context,
display_win32->gl_version / 10,
display_win32->gl_version % 10,
&major, &minor);
if (surface != NULL)
hdc = GDK_WIN32_SURFACE (surface)->hdc;
@@ -626,7 +621,6 @@ gdk_win32_gl_context_wgl_realize (GdkGLContext *context,
/* Ensure that any other context is created with a legacy bit set */
gdk_gl_context_set_is_legacy (context, legacy_bit);
gdk_gl_context_set_required_version (context, major, minor);
return GDK_GL_API_GL;
}
+592
View File
@@ -0,0 +1,592 @@
/* gdkinput-dmanipulation.c
*
* Copyright © 2022 the GTK team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
/* {{{ */
#ifdef WINVER
#undef WINVER
#endif
#ifdef _WIN32_WINNT
#undef _WIN32_WINNT
#endif
#define WINVER 0x0603
#define _WIN32_WINNT 0x0603
#define COBJMACROS
#include "config.h"
#include <gdk/gdk.h>
#include "gdkwin32.h"
#include "gdkprivate-win32.h"
#include "gdkdevicemanager-win32.h"
#include "gdkdevice-virtual.h"
#include "gdkdeviceprivate.h"
#include "gdkdisplayprivate.h"
#include "gdkeventsprivate.h"
#include "gdkseatdefaultprivate.h"
#include "gdkinput-dmanipulation.h"
#include "winpointer.h"
#include <windows.h>
#include <directmanipulation.h>
typedef BOOL
(WINAPI *getPointerType_t)(UINT32 pointerId, POINTER_INPUT_TYPE *pointerType);
static getPointerType_t getPointerType;
static IDirectManipulationManager *dmanipulation_manager;
typedef struct
{
IDirectManipulationViewportEventHandlerVtbl *vtable;
LONG reference_count;
enum {
GESTURE_PAN,
GESTURE_ZOOM,
} gesture;
GdkTouchpadGesturePhase phase;
gpointer sequence;
float scale;
float pan_x;
float pan_y;
GdkSurface *surface;
GdkDevice *device;
}
DManipEventHandler;
static void dmanip_event_handler_running_state_clear (DManipEventHandler *handler);
static void dmanip_event_handler_free (DManipEventHandler *handler);
static void reset_viewport (IDirectManipulationViewport *viewport);
static gpointer util_get_next_sequence (void);
static GdkModifierType util_get_modifier_state (void);
static gboolean util_handler_free (gpointer);
/* }}} */
/* {{{ ViewportEventHandler */
static STDMETHODIMP_ (ULONG)
DManipEventHandler_AddRef (IDirectManipulationViewportEventHandler *self_)
{
DManipEventHandler *self = (DManipEventHandler*) self_;
return (ULONG) InterlockedIncrement (&self->reference_count);
}
static STDMETHODIMP_ (ULONG)
DManipEventHandler_Release (IDirectManipulationViewportEventHandler *self_)
{
DManipEventHandler *self = (DManipEventHandler*) self_;
/* NOTE: This may run from a worker thread */
LONG new_reference_count = InterlockedDecrement (&self->reference_count);
if (new_reference_count <= 0)
{
/* For safety, schedule the cleanup to be executed
* on the main thread */
g_idle_add (util_handler_free, self);
return 0;
}
return (ULONG) new_reference_count;
}
static STDMETHODIMP
DManipEventHandler_QueryInterface (IDirectManipulationViewportEventHandler *self_,
REFIID riid,
void **ppvObject)
{
DManipEventHandler *self = (DManipEventHandler*) self_;
if G_UNLIKELY (!self || !ppvObject)
return E_POINTER;
*ppvObject = NULL;
if (IsEqualGUID (riid, &IID_IUnknown))
*ppvObject = self;
else if (IsEqualGUID (riid, &IID_IDirectManipulationViewportEventHandler))
*ppvObject = self;
if (*ppvObject == NULL)
return E_NOINTERFACE;
DManipEventHandler_AddRef (self_);
return S_OK;
}
/* NOTE:
*
* All DManipEventHandler callbacks are fired from the main thread */
static STDMETHODIMP
DManipEventHandler_OnViewportUpdated (IDirectManipulationViewportEventHandler *self_,
IDirectManipulationViewport *viewport)
{
return S_OK;
}
static STDMETHODIMP
DManipEventHandler_OnContentUpdated (IDirectManipulationViewportEventHandler *self_,
IDirectManipulationViewport *viewport,
IDirectManipulationContent *content)
{
DManipEventHandler *self = (DManipEventHandler*) self_;
float transform[6] = {1., 0., 0., 1., 0., 0.};
HRESULT hr;
hr = IDirectManipulationContent_GetContentTransform (content, transform,
G_N_ELEMENTS (transform));
HR_CHECK_RETURN_VAL (hr, E_FAIL);
switch (self->gesture)
{
case GESTURE_PAN:
{
GdkWin32Surface *surface_win32;
GdkModifierType state;
uint32_t time;
int scale;
float pan_x;
float pan_y;
GdkEvent *event;
pan_x = transform[4];
pan_y = transform[5];
surface_win32 = GDK_WIN32_SURFACE (self->surface);
scale = surface_win32->surface_scale;
state = util_get_modifier_state ();
time = (uint32_t) GetMessageTime ();
event = gdk_scroll_event_new (self->surface,
self->device,
NULL, time, state,
(self->pan_x - pan_x) / scale,
(self->pan_y - pan_y) / scale,
FALSE,
GDK_SCROLL_UNIT_SURFACE);
_gdk_win32_append_event (event);
self->pan_x = pan_x;
self->pan_y = pan_y;
}
break;
case GESTURE_ZOOM:
{
GdkModifierType state;
uint32_t time;
POINT cursor = {0, 0};
float scale;
GdkEvent *event;
scale = transform[0];
state = util_get_modifier_state ();
time = (uint32_t) GetMessageTime ();
_gdk_win32_get_cursor_pos (&cursor);
ScreenToClient (GDK_SURFACE_HWND (self->surface), &cursor);
if (!self->sequence)
self->sequence = util_get_next_sequence ();
event = gdk_touchpad_event_new_pinch (self->surface, self->sequence, self->device,
time, state, self->phase, cursor.x, cursor.y,
2, 0.0, 0.0, scale, 0.0);
_gdk_win32_append_event (event);
self->scale = scale;
self->phase = GDK_TOUCHPAD_GESTURE_PHASE_UPDATE;
}
break;
default:
g_assert_not_reached ();
break;
}
return S_OK;
}
static STDMETHODIMP
DManipEventHandler_OnViewportStatusChanged (IDirectManipulationViewportEventHandler *self_,
IDirectManipulationViewport *viewport,
DIRECTMANIPULATION_STATUS current,
DIRECTMANIPULATION_STATUS previous)
{
DManipEventHandler *self = (DManipEventHandler*) self_;
if (previous == DIRECTMANIPULATION_RUNNING)
{
switch (self->gesture)
{
case GESTURE_PAN:
{
GdkModifierType state;
uint32_t time;
GdkEvent *event;
state = util_get_modifier_state ();
time = (uint32_t) GetMessageTime ();
event = gdk_scroll_event_new (self->surface, self->device,
NULL, time, state,
0.0, 0.0, TRUE,
GDK_SCROLL_UNIT_SURFACE);
_gdk_win32_append_event (event);
}
break;
case GESTURE_ZOOM:
{
GdkModifierType state;
uint32_t time;
POINT cursor = {0, 0};
GdkEvent *event;
if (self->phase == GDK_TOUCHPAD_GESTURE_PHASE_BEGIN)
break;
state = util_get_modifier_state ();
time = (uint32_t) GetMessageTime ();
_gdk_win32_get_cursor_pos (&cursor);
ScreenToClient (GDK_SURFACE_HWND (self->surface), &cursor);
event = gdk_touchpad_event_new_pinch (self->surface, self->sequence, self->device,
time, state, GDK_TOUCHPAD_GESTURE_PHASE_END,
cursor.x, cursor.y, 2, 0., 0., self->scale,
0.);
_gdk_win32_append_event (event);
}
break;
default:
g_assert_not_reached ();
break;
}
dmanip_event_handler_running_state_clear (self);
reset_viewport (viewport);
}
return S_OK;
}
static void
dmanip_event_handler_running_state_clear (DManipEventHandler *handler)
{
handler->scale = 1.0;
handler->pan_x = 0.0;
handler->pan_y = 0.0;
handler->phase = GDK_TOUCHPAD_GESTURE_PHASE_BEGIN;
handler->sequence = NULL;
}
static DManipEventHandler*
dmanip_event_handler_new (GdkSurface *surface,
int gesture)
{
static IDirectManipulationViewportEventHandlerVtbl vtable = {
DManipEventHandler_QueryInterface,
DManipEventHandler_AddRef,
DManipEventHandler_Release,
DManipEventHandler_OnViewportStatusChanged,
DManipEventHandler_OnViewportUpdated,
DManipEventHandler_OnContentUpdated,
};
DManipEventHandler *handler;
handler = g_new0 (DManipEventHandler, 1);
handler->vtable = &vtable;
handler->reference_count = 1;
handler->gesture = gesture;
handler->surface = surface;
handler->device = _gdk_device_manager->core_pointer;
dmanip_event_handler_running_state_clear (handler);
return handler;
}
static void
dmanip_event_handler_free (DManipEventHandler *handler)
{
g_free (handler);
}
/* }}} */
/* {{{ Viewport utils */
static void
reset_viewport (IDirectManipulationViewport *viewport)
{
IDirectManipulationContent *content = NULL;
REFIID iid = &IID_IDirectManipulationContent;
float identity[6] = {1., 0., 0., 1., 0., 0.};
HRESULT hr;
hr = IDirectManipulationViewport_GetPrimaryContent (viewport, iid, (void**)&content);
HR_CHECK (hr);
hr = IDirectManipulationContent_SyncContentTransform (content, identity,
G_N_ELEMENTS (identity));
HR_CHECK (hr);
IUnknown_Release (content);
}
static void
close_viewport (IDirectManipulationViewport **p_viewport)
{
IDirectManipulationViewport *viewport = *p_viewport;
if (viewport)
{
IDirectManipulationViewport_Abandon (viewport);
IUnknown_Release (viewport);
*p_viewport = NULL;
}
}
static void
create_viewport (GdkSurface *surface,
int gesture,
IDirectManipulationViewport **pViewport)
{
DIRECTMANIPULATION_CONFIGURATION configuration = 0;
HWND hwnd = GDK_SURFACE_HWND (surface);
IDirectManipulationViewportEventHandler *handler;
DWORD cookie = 0;
HRESULT hr;
hr = IDirectManipulationManager_CreateViewport (dmanipulation_manager, NULL, hwnd,
&IID_IDirectManipulationViewport,
(void**) pViewport);
HR_CHECK_GOTO (hr, failed);
switch (gesture)
{
case GESTURE_PAN:
configuration = DIRECTMANIPULATION_CONFIGURATION_INTERACTION |
DIRECTMANIPULATION_CONFIGURATION_TRANSLATION_X |
DIRECTMANIPULATION_CONFIGURATION_TRANSLATION_Y;
break;
case GESTURE_ZOOM:
configuration = DIRECTMANIPULATION_CONFIGURATION_INTERACTION |
DIRECTMANIPULATION_CONFIGURATION_SCALING;
break;
default:
g_assert_not_reached ();
break;
}
handler = (IDirectManipulationViewportEventHandler*)
dmanip_event_handler_new (surface, gesture);
hr = IDirectManipulationViewport_AddEventHandler (*pViewport, hwnd, handler, &cookie);
HR_CHECK_GOTO (hr, failed);
hr = IDirectManipulationViewport_ActivateConfiguration (*pViewport, configuration);
HR_CHECK_GOTO (hr, failed);
hr = IDirectManipulationViewport_SetViewportOptions (*pViewport,
DIRECTMANIPULATION_VIEWPORT_OPTIONS_DISABLEPIXELSNAPPING);
hr = IDirectManipulationViewport_Enable (*pViewport);
HR_CHECK_GOTO (hr, failed);
// drop our initial reference
IUnknown_Release (handler);
return;
failed:
if (handler)
IUnknown_Release (handler);
close_viewport (pViewport);
}
/* }}} */
/* {{{ Public */
void gdk_dmanipulation_initialize (void)
{
if (!getPointerType)
{
HMODULE user32_mod;
user32_mod = LoadLibraryW (L"user32.dll");
if (!user32_mod)
{
WIN32_API_FAILED ("LoadLibraryW");
return;
}
getPointerType = (getPointerType_t)
GetProcAddress (user32_mod, "GetPointerType");
if (!getPointerType)
return;
}
if (!gdk_win32_ensure_com ())
return;
if (dmanipulation_manager == NULL)
{
HRESULT hr;
hr = CoCreateInstance (&CLSID_DirectManipulationManager,
NULL,
CLSCTX_INPROC_SERVER,
&IID_IDirectManipulationManager,
(LPVOID*)&dmanipulation_manager);
if (FAILED (hr))
{
if (hr == REGDB_E_CLASSNOTREG || hr == E_NOINTERFACE);
/* Not an error,
* DirectManipulation is not available */
else HR_LOG (hr);
}
}
}
void gdk_dmanipulation_initialize_surface (GdkSurface *surface)
{
GdkWin32Surface *surface_win32;
HRESULT hr;
if (!dmanipulation_manager)
return;
surface_win32 = GDK_WIN32_SURFACE (surface);
create_viewport (surface, GESTURE_PAN,
&surface_win32->dmanipulation_viewport_pan);
create_viewport (surface, GESTURE_ZOOM,
&surface_win32->dmanipulation_viewport_zoom);
hr = IDirectManipulationManager_Activate (dmanipulation_manager,
GDK_SURFACE_HWND (surface));
HR_CHECK (hr);
}
void gdk_dmanipulation_finalize_surface (GdkSurface *surface)
{
GdkWin32Surface *surface_win32 = GDK_WIN32_SURFACE (surface);
close_viewport (&surface_win32->dmanipulation_viewport_zoom);
close_viewport (&surface_win32->dmanipulation_viewport_pan);
}
void gdk_dmanipulation_maybe_add_contact (GdkSurface *surface,
MSG *msg)
{
POINTER_INPUT_TYPE type = PT_POINTER;
UINT32 pointer_id = GET_POINTERID_WPARAM (msg->wParam);
if (!dmanipulation_manager)
return;
if (!getPointerType)
return;
if G_UNLIKELY (!getPointerType (pointer_id, &type))
{
WIN32_API_FAILED_LOG_ONCE ("GetPointerType");
return;
}
if (type == PT_TOUCHPAD)
{
GdkWin32Surface *surface_win32 = GDK_WIN32_SURFACE (surface);
HRESULT hr;
hr = IDirectManipulationViewport_SetContact (surface_win32->dmanipulation_viewport_pan,
pointer_id);
HR_CHECK (hr);
hr = IDirectManipulationViewport_SetContact (surface_win32->dmanipulation_viewport_zoom,
pointer_id);
HR_CHECK (hr);
}
}
/* }}} */
/* {{{ Utils */
static gpointer
util_get_next_sequence (void)
{
//TODO: sequence of other input types?
static unsigned char *sequence_counter = 0;
if (++sequence_counter == 0)
sequence_counter++;
return sequence_counter;
}
static GdkModifierType
util_get_modifier_state (void)
{
GdkModifierType mask = 0;
BYTE kbd[256];
GetKeyboardState (kbd);
if (kbd[VK_SHIFT] & 0x80)
mask |= GDK_SHIFT_MASK;
if (kbd[VK_CAPITAL] & 0x80)
mask |= GDK_LOCK_MASK;
if (kbd[VK_CONTROL] & 0x80)
mask |= GDK_CONTROL_MASK;
if (kbd[VK_MENU] & 0x80)
mask |= GDK_ALT_MASK;
return mask;
}
static gboolean
util_handler_free (gpointer handler)
{
dmanip_event_handler_free ((DManipEventHandler*)handler);
return G_SOURCE_REMOVE;
}
/* }}} */
+32
View File
@@ -0,0 +1,32 @@
/* gdkinput-dmanipulation.h
*
* Copyright © 2022 the GTK team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#ifndef __GDK_INPUT_DMANIPULATION_H__
#define __GDK_INPUT_DMANIPULATION_H__
void gdk_dmanipulation_initialize (void);
void gdk_dmanipulation_initialize_surface (GdkSurface *surface);
void gdk_dmanipulation_finalize_surface (GdkSurface *surface);
void gdk_dmanipulation_maybe_add_contact (GdkSurface *surface,
MSG *msg);
#endif /* __GDK_INPUT_DMANIPULATION_H__ */
+83
View File
@@ -36,6 +36,7 @@
#include "gdkkeysyms.h"
#include "gdkintl.h"
#include "gdkprivate-win32.h"
#include "gdkinput-dmanipulation.h"
#include "gdkwin32.h"
#include <objbase.h>
@@ -49,6 +50,12 @@
static gboolean gdk_synchronize = FALSE;
/* Whether GDK initialized COM */
static gboolean co_initialized = FALSE;
/* Whether GDK initialized OLE */
static gboolean ole_initialized = FALSE;
void
_gdk_win32_surfaceing_init (void)
{
@@ -67,6 +74,82 @@ _gdk_win32_surfaceing_init (void)
GDK_NOTE (EVENTS, g_print ("input_locale: %p\n", _gdk_input_locale));
_gdk_win32_clipdrop_init ();
gdk_dmanipulation_initialize ();
}
gboolean
gdk_win32_ensure_com (void)
{
if (!co_initialized)
{
/* UI thread should only use STA model. See
* -> https://devblogs.microsoft.com/oldnewthing/20080424-00/?p=22603
* -> https://devblogs.microsoft.com/oldnewthing/20071018-00/?p=24743
*/
const DWORD flags = COINIT_APARTMENTTHREADED |
COINIT_DISABLE_OLE1DDE;
HRESULT hr;
hr = CoInitializeEx (NULL, flags);
if (SUCCEEDED (hr))
co_initialized = TRUE;
else switch (hr)
{
case RPC_E_CHANGED_MODE:
g_warning ("COM runtime already initialized on the main "
"thread with an incompatible apartment model");
break;
default:
HR_LOG (hr);
break;
}
}
return co_initialized;
}
static void
gdk_win32_finalize_com (void)
{
if (co_initialized)
{
CoUninitialize ();
co_initialized = FALSE;
}
}
gboolean
gdk_win32_ensure_ole (void)
{
if (!ole_initialized)
{
HRESULT hr = OleInitialize (NULL);
if (SUCCEEDED (hr))
ole_initialized = TRUE;
else switch (hr)
{
case RPC_E_CHANGED_MODE:
g_warning ("Failed to initialize the OLE2 runtime because "
"the thread has an incompatible apartment model");
break;
default:
HR_LOG (hr);
break;
}
}
return ole_initialized;
}
static void
gdk_win32_finalize_ole (void)
{
if (ole_initialized)
{
OleUninitialize ();
ole_initialized = FALSE;
}
}
void
+10
View File
@@ -196,6 +196,9 @@ void _gdk_remove_modal_window (GdkSurface *window);
GdkSurface *_gdk_modal_current (void);
gboolean _gdk_modal_blocked (GdkSurface *window);
gboolean gdk_win32_ensure_com (void);
gboolean gdk_win32_ensure_ole (void);
#ifdef G_ENABLE_DEBUG
void _gdk_win32_print_paletteentries (const PALETTEENTRY *pep,
const int nentries);
@@ -252,6 +255,13 @@ void _gdk_other_api_failed (const char *where,
#define GDI_CALL(api, arglist) (api arglist ? 1 : (WIN32_GDI_FAILED (#api), 0))
#define API_CALL(api, arglist) (api arglist ? 1 : (WIN32_API_FAILED (#api), 0))
#define HR_LOG(hr)
#define HR_CHECK_RETURN(hr) { if G_UNLIKELY (FAILED (hr)) return; }
#define HR_CHECK_RETURN_VAL(hr, val) { if G_UNLIKELY (FAILED (hr)) return val; }
#define HR_CHECK(hr)
#define HR_CHECK_GOTO(hr, label) { if G_UNLIKELY (FAILED (hr)) goto label; }
extern LRESULT CALLBACK _gdk_win32_surface_procedure (HWND, UINT, WPARAM, LPARAM);
extern GdkDisplay *_gdk_display;
+9 -2
View File
@@ -44,6 +44,7 @@
#include "gdktoplevelprivate.h"
#include "gdkwin32surface.h"
#include "gdkwin32cursor.h"
#include "gdkinput-dmanipulation.h"
#include "gdkinput-winpointer.h"
#include "gdkglcontext-win32.h"
#include "gdkdisplay-win32.h"
@@ -639,8 +640,14 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
}
gdk_surface_set_egl_native_window (surface, (void *) impl->handle);
if (display_win32->tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINPOINTER)
gdk_winpointer_initialize_surface (surface);
if (surface_type != GDK_SURFACE_TEMP)
{
if (display_win32->tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINPOINTER)
gdk_winpointer_initialize_surface (surface);
gdk_dmanipulation_initialize_surface (surface);
}
_gdk_win32_surface_enable_transparency (surface);
_gdk_win32_surface_register_dnd (surface);
+4
View File
@@ -32,6 +32,7 @@
#include "gdk/gdkcursor.h"
#include <windows.h>
#include <directmanipulation.h>
#ifdef HAVE_EGL
# include <epoxy/egl.h>
@@ -339,6 +340,9 @@ struct _GdkWin32Surface
} next_layout;
gboolean force_recompute_size;
IDirectManipulationViewport *dmanipulation_viewport_pan;
IDirectManipulationViewport *dmanipulation_viewport_zoom;
#ifdef HAVE_EGL
guint egl_force_redraw_all : 1;
#endif
+1
View File
@@ -17,6 +17,7 @@ gdk_win32_sources = files([
'gdkglcontext-win32-wgl.c',
'gdkglobals-win32.c',
'gdkhdataoutputstream-win32.c',
'gdkinput-dmanipulation.c',
'gdkinput-winpointer.c',
'gdkkeys-win32.c',
'gdkkeys-win32-impl.c',
+1 -3
View File
@@ -116,9 +116,7 @@ gdk_x11_device_xi2_class_init (GdkX11DeviceXI2Class *klass)
g_object_class_install_property (object_class,
PROP_DEVICE_ID,
g_param_spec_int ("device-id",
P_("Device ID"),
P_("Device identifier"),
g_param_spec_int ("device-id", NULL, NULL,
0, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
+6 -16
View File
@@ -145,33 +145,25 @@ gdk_x11_device_manager_xi2_class_init (GdkX11DeviceManagerXI2Class *klass)
g_object_class_install_property (object_class,
PROP_DISPLAY,
g_param_spec_object ("display",
"Display",
"Display for the device manager",
g_param_spec_object ("display", NULL, NULL,
GDK_TYPE_DISPLAY,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
g_object_class_install_property (object_class,
PROP_OPCODE,
g_param_spec_int ("opcode",
P_("Opcode"),
P_("Opcode for XInput2 requests"),
g_param_spec_int ("opcode", NULL, NULL,
0, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
g_object_class_install_property (object_class,
PROP_MAJOR,
g_param_spec_int ("major",
P_("Major"),
P_("Major version number"),
g_param_spec_int ("major", NULL, NULL,
0, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
g_object_class_install_property (object_class,
PROP_MINOR,
g_param_spec_int ("minor",
P_("Minor"),
P_("Minor version number"),
g_param_spec_int ("minor", NULL, NULL,
0, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
@@ -1663,8 +1655,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
NULL,
xev->time,
_gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group),
direction,
FALSE);
direction);
}
else
@@ -1766,8 +1757,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
NULL,
xev->time,
state,
direction,
FALSE);
direction);
}
else
{
+143 -168
View File
@@ -213,7 +213,7 @@ gdk_x11_gl_context_glx_clear_current (GdkGLContext *context)
static gboolean
gdk_x11_gl_context_glx_make_current (GdkGLContext *context,
gboolean surfaceless)
{
GdkX11GLContextGLX *self = GDK_X11_GL_CONTEXT_GLX (context);
GdkDisplay *display = gdk_gl_context_get_display (context);
@@ -302,68 +302,6 @@ gdk_x11_gl_context_glx_get_damage (GdkGLContext *context)
return GDK_GL_CONTEXT_CLASS (gdk_x11_gl_context_glx_parent_class)->get_damage (context);
}
static GLXContext
create_gl3_context (GdkDisplay *display,
GLXFBConfig config,
GdkGLContext *share,
int profile,
int flags,
int major,
int minor)
{
int attrib_list[] = {
GLX_CONTEXT_PROFILE_MASK_ARB, profile,
GLX_CONTEXT_MAJOR_VERSION_ARB, major,
GLX_CONTEXT_MINOR_VERSION_ARB, minor,
GLX_CONTEXT_FLAGS_ARB, flags,
None,
};
GLXContext res;
GdkX11GLContextGLX *share_glx = NULL;
if (share != NULL)
share_glx = GDK_X11_GL_CONTEXT_GLX (share);
gdk_x11_display_error_trap_push (display);
res = glXCreateContextAttribsARB (gdk_x11_display_get_xdisplay (display),
config,
share_glx != NULL ? share_glx->glx_context : NULL,
True,
attrib_list);
if (gdk_x11_display_error_trap_pop (display))
return NULL;
return res;
}
static GLXContext
create_legacy_context (GdkDisplay *display,
GLXFBConfig config,
GdkGLContext *share)
{
GdkX11GLContextGLX *share_glx = NULL;
GLXContext res;
if (share != NULL)
share_glx = GDK_X11_GL_CONTEXT_GLX (share);
gdk_x11_display_error_trap_push (display);
res = glXCreateNewContext (gdk_x11_display_get_xdisplay (display),
config,
GLX_RGBA_TYPE,
share_glx != NULL ? share_glx->glx_context : NULL,
TRUE);
if (gdk_x11_display_error_trap_pop (display))
return NULL;
return res;
}
#ifdef HAVE_XDAMAGE
static void
bind_context_for_frame_fence (GdkX11GLContextGLX *self)
@@ -507,134 +445,111 @@ on_surface_state_changed (GdkGLContext *context)
*/
finish_frame (context);
}
#endif
#endif /* HAVE_XDAMAGE */
#define N_GLX_ATTRS 16
static GdkGLAPI
gdk_x11_gl_context_glx_realize (GdkGLContext *context,
GError **error)
gdk_x11_context_create_glx_context (GdkGLContext *context,
GdkGLAPI api,
gboolean legacy)
{
GdkX11Display *display_x11;
GdkDisplay *display;
GdkX11GLContextGLX *context_glx;
Display *dpy;
GdkSurface *surface;
GdkGLContext *share;
gboolean debug_bit, compat_bit, legacy_bit;
int major, minor, flags;
GdkGLAPI api = 0;
GdkX11GLContextGLX *context_glx = GDK_X11_GL_CONTEXT_GLX (context);;
GdkDisplay *display = gdk_gl_context_get_display (context);
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
Display *dpy = gdk_x11_display_get_xdisplay (display);
GdkGLContext *share = gdk_display_get_gl_context (display);
GdkX11GLContextGLX *share_glx = NULL;
GdkSurface *surface = gdk_gl_context_get_surface (context);
GLXContext ctx;
int context_attribs[N_GLX_ATTRS], i = 0, flags = 0;
int min_major, min_minor, major, minor;
gboolean debug_bit, compat_bit;
display = gdk_gl_context_get_display (context);
dpy = gdk_x11_display_get_xdisplay (display);
context_glx = GDK_X11_GL_CONTEXT_GLX (context);
display_x11 = GDK_X11_DISPLAY (display);
share = gdk_display_get_gl_context (display);
surface = gdk_gl_context_get_surface (context);
if (!gdk_gl_context_is_api_allowed (context, api, NULL))
return 0;
if (api == GDK_GL_API_GLES && legacy)
return 0;
/* We will use the default version matching the context status
* unless the user requested a version which makes sense */
gdk_gl_context_get_matching_version (api, legacy, 0,
&min_major, &min_minor);
gdk_gl_context_get_clipped_version (context, min_major, min_minor,
&major, &minor);
gdk_gl_context_get_required_version (context, &major, &minor);
debug_bit = gdk_gl_context_get_debug_enabled (context);
compat_bit = gdk_gl_context_get_forward_compatible (context);
/* If there is no glXCreateContextAttribsARB() then we default to legacy */
legacy_bit = !display_x11->has_glx_create_context || GDK_DISPLAY_DEBUG_CHECK (display, GL_LEGACY);
/* We cannot share legacy contexts with core profile ones, so the
* shared context is the one that decides if we're going to create
* a legacy context or not.
*/
if (share != NULL && gdk_gl_context_is_legacy (share))
legacy_bit = TRUE;
flags = 0;
if (debug_bit)
flags |= GLX_CONTEXT_DEBUG_BIT_ARB;
if (compat_bit)
flags |= GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
context_attribs[i++] = GLX_CONTEXT_PROFILE_MASK_ARB;
if (api == GDK_GL_API_GL)
if (legacy)
context_attribs[i++] = GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
else
context_attribs[i++] = GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
else if (api == GDK_GL_API_GLES)
context_attribs[i++] = GLX_CONTEXT_ES2_PROFILE_BIT_EXT;
context_attribs[i++] = GLX_CONTEXT_MAJOR_VERSION_ARB;
context_attribs[i++] = major;
context_attribs[i++] = GLX_CONTEXT_MINOR_VERSION_ARB;
context_attribs[i++] = minor;
context_attribs[i++] = GLX_CONTEXT_FLAGS_ARB;
context_attribs[i++] = flags;
context_attribs[i++] = None;
g_assert (i < N_GLX_ATTRS);
GDK_DISPLAY_NOTE (display, OPENGL,
g_message ("Creating GLX context (GL version:%d.%d, debug:%s, forward:%s, legacy:%s, GL:%s, GLES:%s)",
major, minor,
debug_bit ? "yes" : "no",
compat_bit ? "yes" : "no",
legacy_bit ? "yes" : "no",
gdk_gl_context_is_api_allowed (context, GDK_GL_API_GL, NULL) ? "yes" : "no",
gdk_gl_context_is_api_allowed (context, GDK_GL_API_GLES, NULL) ? "yes" : "no"));
g_message ("Creating GLX context version %d.%d (debug:%s, forward:%s, legacy:%s, es:%s)",
major, minor,
debug_bit ? "yes" : "no",
compat_bit ? "yes" : "no",
legacy ? "yes" : "no",
api == GDK_GL_API_GLES ? "yes" : "no"));
/* If we have access to GLX_ARB_create_context_profile then we can ask for
* a compatibility profile; if we don't, then we have to fall back to the
* old GLX 1.3 API.
if (share != NULL)
share_glx = GDK_X11_GL_CONTEXT_GLX (share);
gdk_x11_display_error_trap_push (display);
/* If we don't have access to GLX_ARB_create_context_profile, then
* we have to fall back to the old GLX 1.3 API.
*/
if (legacy_bit && !GDK_X11_DISPLAY (display)->has_glx_create_context)
{
GDK_DISPLAY_NOTE (display, OPENGL, g_message ("Creating legacy GL context on request"));
/* do it below */
}
if (legacy && !display_x11->has_glx_create_context)
ctx = glXCreateNewContext (gdk_x11_display_get_xdisplay (display),
display_x11->glx_config,
GLX_RGBA_TYPE,
share_glx != NULL ? share_glx->glx_context : NULL,
TRUE);
else
{
if (gdk_gl_context_is_api_allowed (context, GDK_GL_API_GL, NULL))
{
int profile = legacy_bit ? GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB
: GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
ctx = glXCreateContextAttribsARB (gdk_x11_display_get_xdisplay (display),
display_x11->glx_config,
share_glx != NULL ? share_glx->glx_context : NULL,
True,
context_attribs);
/* We need to tweak the version, otherwise we may end up requesting
* a compatibility context with a minimum version of 3.2, which is
* an error
*/
if (legacy_bit)
{
major = 3;
minor = 0;
}
GDK_DISPLAY_NOTE (display, OPENGL, g_message ("Creating GL3 context"));
context_glx->glx_context = create_gl3_context (display,
display_x11->glx_config,
share,
profile,
flags, major, minor);
api = GDK_GL_API_GL;
}
if (context_glx->glx_context == NULL && !legacy_bit &&
gdk_gl_context_is_api_allowed (context, GDK_GL_API_GLES, NULL))
{
GDK_DISPLAY_NOTE (display, OPENGL, g_message ("Creating GL3 GLES context"));
context_glx->glx_context = create_gl3_context (display,
display_x11->glx_config,
share,
GLX_CONTEXT_ES2_PROFILE_BIT_EXT,
flags, major, minor);
api = GDK_GL_API_GLES;
}
}
/* Fall back to legacy in case the GL3 context creation failed */
if (context_glx->glx_context == NULL &&
gdk_gl_context_is_api_allowed (context, GDK_GL_API_GL, NULL))
{
GDK_DISPLAY_NOTE (display, OPENGL, g_message ("Creating fallback legacy context"));
context_glx->glx_context = create_legacy_context (display, display_x11->glx_config, share);
legacy_bit = TRUE;
api = GDK_GL_API_GL;
}
if (context_glx->glx_context == NULL)
{
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
_("Unable to create a GL context"));
return 0;
}
/* Ensure that any other context is created with a legacy bit set */
gdk_gl_context_set_is_legacy (context, legacy_bit);
if (gdk_x11_display_error_trap_pop (display) || ctx == NULL)
return 0;
GDK_DISPLAY_NOTE (display, OPENGL,
g_message ("Realized GLX context[%p], %s, version: %d.%d",
context_glx->glx_context,
glXIsDirect (dpy, context_glx->glx_context) ? "direct" : "indirect",
display_x11->glx_version / 10,
display_x11->glx_version % 10));
context_glx->glx_context = ctx;
gdk_gl_context_set_is_legacy (context, legacy);
#ifdef HAVE_XDAMAGE
if (display_x11->have_damage &&
display_x11->has_async_glx_swap_buffers)
@@ -663,10 +578,70 @@ gdk_x11_gl_context_glx_realize (GdkGLContext *context,
}
}
#endif
return api;
}
static GdkGLAPI
gdk_x11_gl_context_glx_realize (GdkGLContext *context,
GError **error)
{
GdkDisplay *display = gdk_gl_context_get_display (context);
GdkGLContext *share = gdk_display_get_gl_context (display);
gboolean legacy;
GdkGLAPI api, preferred_api;
if (share && gdk_gl_context_is_api_allowed (context,
gdk_gl_context_get_api (share),
NULL))
preferred_api = gdk_gl_context_get_api (share);
else if (gdk_gl_context_is_api_allowed (context, GDK_GL_API_GL, NULL))
preferred_api = GDK_GL_API_GL;
else if (gdk_gl_context_is_api_allowed (context, GDK_GL_API_GLES, NULL))
preferred_api = GDK_GL_API_GLES;
else
{
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
_("No GL API allowed."));
return 0;
}
/* If there is no glXCreateContextAttribsARB() then we default to legacy */
legacy = !GDK_X11_DISPLAY (display)->has_glx_create_context;
if (GDK_DISPLAY_DEBUG_CHECK (display, GL_LEGACY))
legacy = TRUE;
/* We cannot share legacy contexts with core profile ones, so the
* shared context is the one that decides if we're going to create
* a legacy context or not.
*/
if (share != NULL && gdk_gl_context_is_legacy (share))
legacy = TRUE;
if (preferred_api == GDK_GL_API_GL)
{
if ((api = gdk_x11_context_create_glx_context (context, GDK_GL_API_GL, legacy)) ||
(api = gdk_x11_context_create_glx_context (context, GDK_GL_API_GLES, legacy)) ||
(api = gdk_x11_context_create_glx_context (context, GDK_GL_API_GL, TRUE)))
return api;
}
else
{
if ((api = gdk_x11_context_create_glx_context (context, GDK_GL_API_GLES, FALSE)) ||
(api = gdk_x11_context_create_glx_context (context, GDK_GL_API_GL, legacy)) ||
(api = gdk_x11_context_create_glx_context (context, GDK_GL_API_GL, TRUE)))
return api;
}
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
_("Unable to create a GL context"));
return 0;
}
#undef N_GLX_ATTRS
static void
gdk_x11_gl_context_glx_dispose (GObject *gobject)
{
@@ -820,7 +795,7 @@ gdk_x11_display_create_glx_config (GdkX11Display *self,
XFree (visinfo);
continue;
}
if (!visual_is_rgba (visinfo))
{
if (best_features < NO_ALPHA_VISUAL)
@@ -894,7 +869,7 @@ gdk_x11_display_get_glx_version (GdkDisplay *display,
/*< private >
* gdk_x11_display_init_glx:
* @display_x11: an X11 display that has not been inited yet.
* @display_x11: an X11 display that has not been inited yet.
* @out_visual: set to the Visual to be used with the returned config
* @out_depth: set to the depth to be used with the returned config
* @error: Return location for error
+1 -1
View File
@@ -280,7 +280,7 @@ compute_toplevel_size (GdkSurface *surface,
gdk_toplevel_size_init (&size, bounds_width, bounds_height);
gdk_toplevel_notify_compute_size (GDK_TOPLEVEL (surface), &size);
if (size.shadow.is_valid && update_geometry)
if (size.shadow.is_valid)
{
update_shadow_size (surface,
size.shadow.left,
+1 -3
View File
@@ -94,9 +94,7 @@ gsk_gl_profiler_class_init (GskGLProfilerClass *klass)
gobject_class->finalize = gsk_gl_profiler_finalize;
gsk_gl_profiler_properties[PROP_GL_CONTEXT] =
g_param_spec_object ("gl-context",
"GL Context",
"The GdkGLContext used by the GL profiler",
g_param_spec_object ("gl-context", NULL, NULL,
GDK_TYPE_GL_CONTEXT,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
+7 -3
View File
@@ -158,6 +158,10 @@ failure:
gdk_profiler_end_mark (start_time, "realize GskGLRenderer", NULL);
/* Assert either all or no state was set */
g_assert ((ret && self->driver != NULL && self->context != NULL && self->command_queue != NULL) ||
(!ret && self->driver == NULL && self->context == NULL && self->command_queue == NULL));
return ret;
}
@@ -403,11 +407,11 @@ gsk_gl_renderer_render_texture (GskRenderer *renderer,
static void
gsk_gl_renderer_dispose (GObject *object)
{
#ifdef G_ENABLE_DEBUG
GskGLRenderer *self = (GskGLRenderer *)object;
g_assert (self->driver == NULL);
#endif
if (self->driver != NULL)
g_critical ("Attempt to dispose %s without calling gsk_renderer_unrealize()",
G_OBJECT_TYPE_NAME (self));
G_OBJECT_CLASS (gsk_gl_renderer_parent_class)->dispose (object);
}
+1 -3
View File
@@ -127,9 +127,7 @@ gsk_gl_shadow_library_class_init (GskGLShadowLibraryClass *klass)
object_class->set_property = gsk_gl_shadow_library_set_property;
properties [PROP_DRIVER] =
g_param_spec_object ("driver",
"Driver",
"Driver",
g_param_spec_object ("driver", NULL, NULL,
GSK_TYPE_GL_DRIVER,
(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
+1 -3
View File
@@ -256,9 +256,7 @@ gsk_gl_texture_library_class_init (GskGLTextureLibraryClass *klass)
klass->allocate = gsk_gl_texture_library_real_allocate;
properties [PROP_DRIVER] =
g_param_spec_object ("driver",
"Driver",
"Driver",
g_param_spec_object ("driver", NULL, NULL,
GSK_TYPE_GL_DRIVER,
(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
+2 -6
View File
@@ -444,9 +444,7 @@ gsk_gl_shader_class_init (GskGLShaderClass *klass)
* The source code for the shader, as a `GBytes`.
*/
gsk_gl_shader_properties[GLSHADER_PROP_SOURCE] =
g_param_spec_boxed ("source",
"Source",
"The sourcecode for the shader",
g_param_spec_boxed ("source", NULL, NULL,
G_TYPE_BYTES,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
@@ -461,9 +459,7 @@ gsk_gl_shader_class_init (GskGLShaderClass *klass)
* will be %NULL.
*/
gsk_gl_shader_properties[GLSHADER_PROP_RESOURCE] =
g_param_spec_string ("resource",
"Resources",
"Resource path to the source code",
g_param_spec_string ("resource", NULL, NULL,
NULL,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
+2 -6
View File
@@ -192,9 +192,7 @@ gsk_renderer_class_init (GskRendererClass *klass)
* Whether the renderer has been associated with a surface or draw context.
*/
gsk_renderer_properties[PROP_REALIZED] =
g_param_spec_boolean ("realized",
"Realized",
"The renderer has been associated with a surface or draw context",
g_param_spec_boolean ("realized", NULL, NULL,
FALSE,
G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
@@ -204,9 +202,7 @@ gsk_renderer_class_init (GskRendererClass *klass)
* The surface associated with renderer.
*/
gsk_renderer_properties[PROP_SURFACE] =
g_param_spec_object ("surface",
"Surface",
"The surface associated to the renderer",
g_param_spec_object ("surface", NULL, NULL,
GDK_TYPE_SURFACE,
G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
+56 -11
View File
@@ -68,6 +68,23 @@ parse_rect (GtkCssParser *parser,
return TRUE;
}
static gboolean
parse_vec4 (GtkCssParser *parser,
gpointer out_vec4)
{
double numbers[4];
if (!gtk_css_parser_consume_number (parser, &numbers[0]) ||
!gtk_css_parser_consume_number (parser, &numbers[1]) ||
!gtk_css_parser_consume_number (parser, &numbers[2]) ||
!gtk_css_parser_consume_number (parser, &numbers[3]))
return FALSE;
graphene_vec4_init (out_vec4, numbers[0], numbers[1], numbers[2], numbers[3]);
return TRUE;
}
static gboolean
parse_texture (GtkCssParser *parser,
gpointer out_data)
@@ -1102,7 +1119,7 @@ parse_conic_gradient_node (GtkCssParser *parser)
g_array_append_val (stops, to);
}
result = gsk_conic_gradient_node_new (&bounds, &center, rotation,
result = gsk_conic_gradient_node_new (&bounds, &center, rotation,
(GskColorStop *) stops->data, stops->len);
g_array_free (stops, TRUE);
@@ -1388,7 +1405,7 @@ parse_cairo_node (GtkCssParser *parser)
parse_declarations (parser, declarations, G_N_ELEMENTS(declarations));
node = gsk_cairo_node_new (&bounds);
if (surface != NULL)
{
cairo_t *cr = gsk_cairo_node_get_draw_context (node);
@@ -1490,23 +1507,20 @@ parse_color_matrix_node (GtkCssParser *parser)
GskRenderNode *child = NULL;
graphene_matrix_t matrix;
GskTransform *transform = NULL;
graphene_rect_t offset_rect = GRAPHENE_RECT_INIT (0, 0, 0, 0);
graphene_vec4_t offset;
const Declaration declarations[] = {
{ "matrix", parse_transform, clear_transform, &transform },
{ "offset", parse_rect, NULL, &offset_rect },
{ "offset", parse_vec4, NULL, &offset },
{ "child", parse_node, clear_node, &child }
};
GskRenderNode *result;
graphene_vec4_init (&offset, 0, 0, 0, 0);
parse_declarations (parser, declarations, G_N_ELEMENTS(declarations));
if (child == NULL)
child = create_default_render_node ();
graphene_vec4_init (&offset,
offset_rect.origin.x, offset_rect.origin.y,
offset_rect.size.width, offset_rect.size.height);
gsk_transform_to_matrix (transform, &matrix);
result = gsk_color_matrix_node_new (child, &matrix, &offset);
@@ -2697,10 +2711,41 @@ render_node_print (Printer *p,
start_node (p, "texture");
append_rect_param (p, "bounds", &node->bounds);
bytes = gdk_texture_save_to_png_bytes (texture);
_indent (p);
g_string_append (p->str, "texture: url(\"data:image/png;base64,");
switch (gdk_texture_get_format (texture))
{
case GDK_MEMORY_B8G8R8A8_PREMULTIPLIED:
case GDK_MEMORY_A8R8G8B8_PREMULTIPLIED:
case GDK_MEMORY_R8G8B8A8_PREMULTIPLIED:
case GDK_MEMORY_B8G8R8A8:
case GDK_MEMORY_A8R8G8B8:
case GDK_MEMORY_R8G8B8A8:
case GDK_MEMORY_A8B8G8R8:
case GDK_MEMORY_R8G8B8:
case GDK_MEMORY_B8G8R8:
case GDK_MEMORY_R16G16B16:
case GDK_MEMORY_R16G16B16A16_PREMULTIPLIED:
case GDK_MEMORY_R16G16B16A16:
bytes = gdk_texture_save_to_png_bytes (texture);
g_string_append (p->str, "texture: url(\"data:image/png;base64,");
break;
case GDK_MEMORY_R16G16B16_FLOAT:
case GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED:
case GDK_MEMORY_R16G16B16A16_FLOAT:
case GDK_MEMORY_R32G32B32_FLOAT:
case GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED:
case GDK_MEMORY_R32G32B32A32_FLOAT:
bytes = gdk_texture_save_to_tiff_bytes (texture);
g_string_append (p->str, "texture: url(\"data:image/tiff;base64,");
break;
case GDK_MEMORY_N_FORMATS:
default:
g_assert_not_reached ();
}
b64 = base64_encode_with_linebreaks (g_bytes_get_data (bytes, NULL),
g_bytes_get_size (bytes));
append_escaping_newlines (p->str, b64);
+5 -4
View File
@@ -37,10 +37,11 @@ gsk_vulkan_command_pool_new (GdkVulkanContext *context)
static void
gsk_vulkan_command_pool_free_buffers (GskVulkanCommandPool *self)
{
vkFreeCommandBuffers (gdk_vulkan_context_get_device (self->vulkan),
self->vk_command_pool,
self->buffers->len,
(VkCommandBuffer *) self->buffers->pdata);
if (self->buffers->len != 0)
vkFreeCommandBuffers (gdk_vulkan_context_get_device (self->vulkan),
self->vk_command_pool,
self->buffers->len,
(VkCommandBuffer *) self->buffers->pdata);
g_ptr_array_set_size (self->buffers, 0);
}
+1 -1
View File
@@ -170,7 +170,7 @@ gsk_vulkan_render_pass_new (GdkVulkanContext *context,
.samples = VK_SAMPLE_COUNT_1_BIT,
.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR,
.storeOp = VK_ATTACHMENT_STORE_OP_STORE,
.initialLayout = VK_IMAGE_LAYOUT_GENERAL,
.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED,
.finalLayout = final_layout
}
},
+5 -1
View File
@@ -436,7 +436,11 @@ get_parent_context_ref (GtkAccessible *accessible)
gtk_accessible_get_at_context (GTK_ACCESSIBLE (parent));
if (parent_context != NULL)
res = gtk_at_spi_context_to_ref (GTK_AT_SPI_CONTEXT (parent_context));
{
gtk_at_context_realize (parent_context);
res = gtk_at_spi_context_to_ref (GTK_AT_SPI_CONTEXT (parent_context));
}
}
if (res == NULL)
+41 -1
View File
@@ -1098,7 +1098,47 @@ text_view_handle_method (GDBusConnection *connection,
}
else if (g_strcmp0 (method_name, "GetCharacterExtents") == 0)
{
g_dbus_method_invocation_return_error_literal (invocation, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED, "");
int offset = 0;
guint coords_type;
g_variant_get (parameters, "(iu)", &offset, &coords_type);
if (coords_type != ATSPI_COORD_TYPE_WINDOW)
{
g_dbus_method_invocation_return_error_literal (invocation,
G_DBUS_ERROR,
G_DBUS_ERROR_NOT_SUPPORTED,
"Unsupported coordinate space");
return;
}
GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget));
GtkTextIter iter;
gtk_text_buffer_get_iter_at_offset (buffer, &iter, offset);
GdkRectangle rect = { 0, };
gtk_text_view_get_iter_location (GTK_TEXT_VIEW (widget), &iter, &rect);
int x, y;
gtk_text_view_buffer_to_window_coords (GTK_TEXT_VIEW (widget),
GTK_TEXT_WINDOW_WIDGET,
rect.x, rect.y,
&x, &y);
double dx, dy;
gtk_widget_translate_coordinates (widget,
GTK_WIDGET (gtk_widget_get_native (widget)),
(double) x, (double) y, &dx, &dy);
x = floor (dx);
y = floor (dy);
g_dbus_method_invocation_return_value (invocation,
g_variant_new ("(iiii)",
x,
y,
rect.width,
rect.height));
}
else if (g_strcmp0 (method_name, "GetRangeExtents") == 0)
{
+16 -48
View File
@@ -378,9 +378,7 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
* `g_get_application_name()`.
*/
props[PROP_NAME] =
g_param_spec_string ("program-name",
P_("Program name"),
P_("The name of the program. If this is not set, it defaults to g_get_application_name()"),
g_param_spec_string ("program-name", NULL, NULL,
NULL,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -390,9 +388,7 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
* The version of the program.
*/
props[PROP_VERSION] =
g_param_spec_string ("version",
P_("Program version"),
P_("The version of the program"),
g_param_spec_string ("version", NULL, NULL,
NULL,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -402,9 +398,7 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
* Copyright information for the program.
*/
props[PROP_COPYRIGHT] =
g_param_spec_string ("copyright",
P_("Copyright string"),
P_("Copyright information for the program"),
g_param_spec_string ("copyright", NULL, NULL,
NULL,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -418,9 +412,7 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
* not a detailed list of features.
*/
props[PROP_COMMENTS] =
g_param_spec_string ("comments",
P_("Comments string"),
P_("Comments about the program"),
g_param_spec_string ("comments", NULL, NULL,
NULL,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -443,9 +435,7 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
* be converted into clickable links.
*/
props[PROP_LICENSE] =
g_param_spec_string ("license",
P_("License"),
P_("The license of the program"),
g_param_spec_string ("license", NULL, NULL,
NULL,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -463,9 +453,7 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
* be converted into clickable links.
*/
props[PROP_SYSTEM_INFORMATION] =
g_param_spec_string ("system-information",
P_("System Information"),
P_("Information about the system on which the program is running"),
g_param_spec_string ("system-information", NULL, NULL,
NULL,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -489,9 +477,7 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
* a side effect.
*/
props[PROP_LICENSE_TYPE] =
g_param_spec_enum ("license-type",
P_("License Type"),
P_("The license type of the program"),
g_param_spec_enum ("license-type", NULL, NULL,
GTK_TYPE_LICENSE,
GTK_LICENSE_UNKNOWN,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -504,9 +490,7 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
* This should be a string starting with `http://` or `https://`.
*/
props[PROP_WEBSITE] =
g_param_spec_string ("website",
P_("Website URL"),
P_("The URL for the link to the website of the program"),
g_param_spec_string ("website", NULL, NULL,
NULL,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -516,9 +500,7 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
* The label for the link to the website of the program.
*/
props[PROP_WEBSITE_LABEL] =
g_param_spec_string ("website-label",
P_("Website label"),
P_("The label for the link to the website of the program"),
g_param_spec_string ("website-label", NULL, NULL,
NULL,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -531,9 +513,7 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
* as links, see the introduction for more details.
*/
props[PROP_AUTHORS] =
g_param_spec_boxed ("authors",
P_("Authors"),
P_("List of authors of the program"),
g_param_spec_boxed ("authors", NULL, NULL,
G_TYPE_STRV,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -546,9 +526,7 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
* as links, see the introduction for more details.
*/
props[PROP_DOCUMENTERS] =
g_param_spec_boxed ("documenters",
P_("Documenters"),
P_("List of people documenting the program"),
g_param_spec_boxed ("documenters", NULL, NULL,
G_TYPE_STRV,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -562,9 +540,7 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
* as links.
*/
props[PROP_ARTISTS] =
g_param_spec_boxed ("artists",
P_("Artists"),
P_("List of people who have contributed artwork to the program"),
g_param_spec_boxed ("artists", NULL, NULL,
G_TYPE_STRV,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -579,9 +555,7 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
* as links, see the introduction for more details.
*/
props[PROP_TRANSLATOR_CREDITS] =
g_param_spec_string ("translator-credits",
P_("Translator credits"),
P_("Credits to the translators. This string should be marked as translatable"),
g_param_spec_string ("translator-credits", NULL, NULL,
NULL,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -594,9 +568,7 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
* [id@gtk_window_set_default_icon_name] will be used.
*/
props[PROP_LOGO] =
g_param_spec_object ("logo",
P_("Logo"),
P_("A logo for the about box."),
g_param_spec_object ("logo", NULL, NULL,
GDK_TYPE_PAINTABLE,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -608,9 +580,7 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
* This property overrides the [property@Gtk.AboutDialog:logo] property.
*/
props[PROP_LOGO_ICON_NAME] =
g_param_spec_string ("logo-icon-name",
P_("Logo Icon Name"),
P_("A named icon to use as the logo for the about box."),
g_param_spec_string ("logo-icon-name", NULL, NULL,
NULL,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -620,9 +590,7 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
* Whether to wrap the text in the license dialog.
*/
props[PROP_WRAP_LICENSE] =
g_param_spec_boolean ("wrap-license",
P_("Wrap license"),
P_("Whether to wrap the license text."),
g_param_spec_boolean ("wrap-license", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
+1 -3
View File
@@ -65,9 +65,7 @@ gtk_accessible_default_init (GtkAccessibleInterface *iface)
* The accessible role cannot be changed once set.
*/
GParamSpec *pspec =
g_param_spec_enum ("accessible-role",
"Accessible Role",
"The role of the accessible object",
g_param_spec_enum ("accessible-role", NULL, NULL,
GTK_TYPE_ACCESSIBLE_ROLE,
GTK_ACCESSIBLE_ROLE_NONE,
G_PARAM_READWRITE |
+2 -4
View File
@@ -58,13 +58,11 @@ static void
gtk_actionable_default_init (GtkActionableInterface *iface)
{
g_object_interface_install_property (iface,
g_param_spec_string ("action-name", P_("Action name"),
P_("The name of the associated action, like “app.quit”"),
g_param_spec_string ("action-name", NULL, NULL,
NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_interface_install_property (iface,
g_param_spec_variant ("action-target", P_("Action target value"),
P_("The parameter for action invocations"),
g_param_spec_variant ("action-target", NULL, NULL,
G_VARIANT_TYPE_ANY, NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
+1 -3
View File
@@ -171,9 +171,7 @@ gtk_action_bar_class_init (GtkActionBarClass *klass)
* Controls whether the action bar shows its contents.
*/
props[PROP_REVEALED] =
g_param_spec_boolean ("revealed",
P_("Reveal"),
P_("Controls whether the action bar shows its contents or not"),
g_param_spec_boolean ("revealed", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
+3 -3
View File
@@ -346,11 +346,11 @@ gtk_action_helper_class_init (GtkActionHelperClass *class)
class->get_property = gtk_action_helper_get_property;
class->finalize = gtk_action_helper_finalize;
gtk_action_helper_pspecs[PROP_ENABLED] = g_param_spec_boolean ("enabled", "enabled", "enabled", FALSE,
gtk_action_helper_pspecs[PROP_ENABLED] = g_param_spec_boolean ("enabled", NULL, NULL, FALSE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
gtk_action_helper_pspecs[PROP_ACTIVE] = g_param_spec_boolean ("active", "active", "active", FALSE,
gtk_action_helper_pspecs[PROP_ACTIVE] = g_param_spec_boolean ("active", NULL, NULL, FALSE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
gtk_action_helper_pspecs[PROP_ROLE] = g_param_spec_enum ("role", "role", "role",
gtk_action_helper_pspecs[PROP_ROLE] = g_param_spec_enum ("role", NULL, NULL,
GTK_TYPE_BUTTON_ROLE,
GTK_BUTTON_ROLE_NORMAL,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+9 -9
View File
@@ -991,13 +991,15 @@ gtk_action_muxer_unregister_observer (GtkActionObservable *observable,
GtkActionObserver *observer)
{
GtkActionMuxer *muxer = GTK_ACTION_MUXER (observable);
Action *action;
Action *action = find_observers (muxer, name);
action = find_observers (muxer, name);
if (action)
{
g_object_weak_unref (G_OBJECT (observer), gtk_action_muxer_weak_notify, action);
gtk_action_muxer_unregister_internal (action, observer);
if (g_slist_find (action->watchers, observer) != NULL)
{
g_object_weak_unref (G_OBJECT (observer), gtk_action_muxer_weak_notify, action);
gtk_action_muxer_unregister_internal (action, observer);
}
}
}
@@ -1218,14 +1220,12 @@ gtk_action_muxer_class_init (GObjectClass *class)
class->finalize = gtk_action_muxer_finalize;
class->dispose = gtk_action_muxer_dispose;
properties[PROP_PARENT] = g_param_spec_object ("parent", "Parent",
"The parent muxer",
properties[PROP_PARENT] = g_param_spec_object ("parent", NULL, NULL,
GTK_TYPE_ACTION_MUXER,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
properties[PROP_WIDGET] = g_param_spec_object ("widget", "Widget",
"The widget that owns the muxer",
properties[PROP_WIDGET] = g_param_spec_object ("widget", NULL, NULL,
GTK_TYPE_WIDGET,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
@@ -1269,7 +1269,7 @@ gtk_action_muxer_insert (GtkActionMuxer *muxer,
if (!muxer->groups)
muxer->groups = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, gtk_action_muxer_free_group);
group = g_slice_new (Group);
group = g_slice_new0 (Group);
group->muxer = muxer;
group->group = g_object_ref (action_group);
group->prefix = g_strdup (prefix);
+6 -18
View File
@@ -137,9 +137,7 @@ gtk_adjustment_class_init (GtkAdjustmentClass *class)
* The value of the adjustment.
*/
adjustment_props[PROP_VALUE] =
g_param_spec_double ("value",
P_("Value"),
P_("The value of the adjustment"),
g_param_spec_double ("value", NULL, NULL,
-G_MAXDOUBLE, G_MAXDOUBLE,
0.0,
GTK_PARAM_READWRITE);
@@ -150,9 +148,7 @@ gtk_adjustment_class_init (GtkAdjustmentClass *class)
* The minimum value of the adjustment.
*/
adjustment_props[PROP_LOWER] =
g_param_spec_double ("lower",
P_("Minimum Value"),
P_("The minimum value of the adjustment"),
g_param_spec_double ("lower", NULL, NULL,
-G_MAXDOUBLE, G_MAXDOUBLE,
0.0,
GTK_PARAM_READWRITE);
@@ -166,9 +162,7 @@ gtk_adjustment_class_init (GtkAdjustmentClass *class)
* property is nonzero.
*/
adjustment_props[PROP_UPPER] =
g_param_spec_double ("upper",
P_("Maximum Value"),
P_("The maximum value of the adjustment"),
g_param_spec_double ("upper", NULL, NULL,
-G_MAXDOUBLE, G_MAXDOUBLE,
0.0,
GTK_PARAM_READWRITE);
@@ -179,9 +173,7 @@ gtk_adjustment_class_init (GtkAdjustmentClass *class)
* The step increment of the adjustment.
*/
adjustment_props[PROP_STEP_INCREMENT] =
g_param_spec_double ("step-increment",
P_("Step Increment"),
P_("The step increment of the adjustment"),
g_param_spec_double ("step-increment", NULL, NULL,
-G_MAXDOUBLE, G_MAXDOUBLE,
0.0,
GTK_PARAM_READWRITE);
@@ -192,9 +184,7 @@ gtk_adjustment_class_init (GtkAdjustmentClass *class)
* The page increment of the adjustment.
*/
adjustment_props[PROP_PAGE_INCREMENT] =
g_param_spec_double ("page-increment",
P_("Page Increment"),
P_("The page increment of the adjustment"),
g_param_spec_double ("page-increment", NULL, NULL,
-G_MAXDOUBLE, G_MAXDOUBLE,
0.0,
GTK_PARAM_READWRITE);
@@ -209,9 +199,7 @@ gtk_adjustment_class_init (GtkAdjustmentClass *class)
* `GtkSpinButton`.
*/
adjustment_props[PROP_PAGE_SIZE] =
g_param_spec_double ("page-size",
P_("Page Size"),
P_("The page size of the adjustment"),
g_param_spec_double ("page-size", NULL, NULL,
-G_MAXDOUBLE, G_MAXDOUBLE,
0.0,
GTK_PARAM_READWRITE);
+1 -3
View File
@@ -67,9 +67,7 @@ gtk_app_chooser_default_init (GtkAppChooserIface *iface)
*
* See `GContentType` for more information about content types.
*/
pspec = g_param_spec_string ("content-type",
P_("Content type"),
P_("The content type used by the open with object"),
pspec = g_param_spec_string ("content-type", NULL, NULL,
NULL,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
+4 -12
View File
@@ -682,9 +682,7 @@ gtk_app_chooser_button_class_init (GtkAppChooserButtonClass *klass)
* a `GtkAppChooserDialog`.
*/
properties[PROP_SHOW_DIALOG_ITEM] =
g_param_spec_boolean ("show-dialog-item",
P_("Include an “Other…” item"),
P_("Whether the combobox should include an item that triggers a GtkAppChooserDialog"),
g_param_spec_boolean ("show-dialog-item", NULL, NULL,
FALSE,
G_PARAM_READWRITE|G_PARAM_CONSTRUCT|G_PARAM_STATIC_STRINGS|G_PARAM_EXPLICIT_NOTIFY);
@@ -695,9 +693,7 @@ gtk_app_chooser_button_class_init (GtkAppChooserButtonClass *klass)
* on top for the provided content type.
*/
properties[PROP_SHOW_DEFAULT_ITEM] =
g_param_spec_boolean ("show-default-item",
P_("Show default item"),
P_("Whether the combobox should show the default application on top"),
g_param_spec_boolean ("show-default-item", NULL, NULL,
FALSE,
G_PARAM_READWRITE|G_PARAM_CONSTRUCT|G_PARAM_STATIC_STRINGS|G_PARAM_EXPLICIT_NOTIFY);
@@ -710,9 +706,7 @@ gtk_app_chooser_button_class_init (GtkAppChooserButtonClass *klass)
* The string may contain Pango markup.
*/
properties[PROP_HEADING] =
g_param_spec_string ("heading",
P_("Heading"),
P_("The text to show at the top of the dialog"),
g_param_spec_string ("heading", NULL, NULL,
NULL,
G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS|G_PARAM_EXPLICIT_NOTIFY);
@@ -722,9 +716,7 @@ gtk_app_chooser_button_class_init (GtkAppChooserButtonClass *klass)
* Whether the app chooser dialog should be modal.
*/
properties[PROP_MODAL] =
g_param_spec_boolean ("modal",
P_("Modal"),
P_("Whether the dialog should be modal"),
g_param_spec_boolean ("modal", NULL, NULL,
TRUE,
G_PARAM_READWRITE|G_PARAM_CONSTRUCT|G_PARAM_STATIC_STRINGS|G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_properties (oclass, NUM_PROPERTIES, properties);
+2 -6
View File
@@ -598,9 +598,7 @@ gtk_app_chooser_dialog_class_init (GtkAppChooserDialogClass *klass)
* The dialog's `GtkAppChooserWidget` content type will
* be guessed from the file, if present.
*/
pspec = g_param_spec_object ("gfile",
P_("GFile"),
P_("The GFile used by the app chooser dialog"),
pspec = g_param_spec_object ("gfile", NULL, NULL,
G_TYPE_FILE,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
@@ -613,9 +611,7 @@ gtk_app_chooser_dialog_class_init (GtkAppChooserDialogClass *klass)
*
* The string may contain Pango markup.
*/
pspec = g_param_spec_string ("heading",
P_("Heading"),
P_("The text to show at the top of the dialog"),
pspec = g_param_spec_string ("heading", NULL, NULL,
NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY);
+6 -18
View File
@@ -906,9 +906,7 @@ gtk_app_chooser_widget_class_init (GtkAppChooserWidgetClass *klass)
* If %FALSE, the default handler is listed among the recommended
* applications.
*/
pspec = g_param_spec_boolean ("show-default",
P_("Show default app"),
P_("Whether the widget should show the default application"),
pspec = g_param_spec_boolean ("show-default", NULL, NULL,
FALSE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_property (gobject_class, PROP_SHOW_DEFAULT, pspec);
@@ -922,9 +920,7 @@ gtk_app_chooser_widget_class_init (GtkAppChooserWidgetClass *klass)
* If %FALSE, the recommended applications are listed
* among the other applications.
*/
pspec = g_param_spec_boolean ("show-recommended",
P_("Show recommended apps"),
P_("Whether the widget should show recommended applications"),
pspec = g_param_spec_boolean ("show-recommended", NULL, NULL,
TRUE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_property (gobject_class, PROP_SHOW_RECOMMENDED, pspec);
@@ -938,9 +934,7 @@ gtk_app_chooser_widget_class_init (GtkAppChooserWidgetClass *klass)
* If %FALSE, the fallback applications are listed among the
* other applications.
*/
pspec = g_param_spec_boolean ("show-fallback",
P_("Show fallback apps"),
P_("Whether the widget should show fallback applications"),
pspec = g_param_spec_boolean ("show-fallback", NULL, NULL,
FALSE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_property (gobject_class, PROP_SHOW_FALLBACK, pspec);
@@ -951,9 +945,7 @@ gtk_app_chooser_widget_class_init (GtkAppChooserWidgetClass *klass)
* Determines whether the app chooser should show a section
* for other applications.
*/
pspec = g_param_spec_boolean ("show-other",
P_("Show other apps"),
P_("Whether the widget should show other applications"),
pspec = g_param_spec_boolean ("show-other", NULL, NULL,
FALSE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_property (gobject_class, PROP_SHOW_OTHER, pspec);
@@ -965,9 +957,7 @@ gtk_app_chooser_widget_class_init (GtkAppChooserWidgetClass *klass)
* in a single list, without subsections for default,
* recommended or related applications.
*/
pspec = g_param_spec_boolean ("show-all",
P_("Show all apps"),
P_("Whether the widget should show all applications"),
pspec = g_param_spec_boolean ("show-all", NULL, NULL,
FALSE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_property (gobject_class, PROP_SHOW_ALL, pspec);
@@ -978,9 +968,7 @@ gtk_app_chooser_widget_class_init (GtkAppChooserWidgetClass *klass)
* The text that appears in the widget when there are no applications
* for the given content type.
*/
pspec = g_param_spec_string ("default-text",
P_("Widgets default text"),
P_("The default text appearing when there are no applications"),
pspec = g_param_spec_string ("default-text", NULL, NULL,
NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_property (gobject_class, PROP_DEFAULT_TEXT, pspec);
+4 -12
View File
@@ -598,9 +598,7 @@ gtk_application_class_init (GtkApplicationClass *class)
* [property@Gtk.Application:screensaver-active] property).
*/
gtk_application_props[PROP_REGISTER_SESSION] =
g_param_spec_boolean ("register-session",
P_("Register session"),
P_("Register with the session manager"),
g_param_spec_boolean ("register-session", NULL, NULL,
FALSE,
G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS);
@@ -617,9 +615,7 @@ gtk_application_class_init (GtkApplicationClass *class)
* Linux.
*/
gtk_application_props[PROP_SCREENSAVER_ACTIVE] =
g_param_spec_boolean ("screensaver-active",
P_("Screensaver Active"),
P_("Whether the screensaver is active"),
g_param_spec_boolean ("screensaver-active", NULL, NULL,
FALSE,
G_PARAM_READABLE|G_PARAM_STATIC_STRINGS);
@@ -629,9 +625,7 @@ gtk_application_class_init (GtkApplicationClass *class)
* The `GMenuModel` to be used for the application's menu bar.
*/
gtk_application_props[PROP_MENUBAR] =
g_param_spec_object ("menubar",
P_("Menubar"),
P_("The GMenuModel for the menubar"),
g_param_spec_object ("menubar", NULL, NULL,
G_TYPE_MENU_MODEL,
G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS);
@@ -641,9 +635,7 @@ gtk_application_class_init (GtkApplicationClass *class)
* The currently focused window of the application.
*/
gtk_application_props[PROP_ACTIVE_WINDOW] =
g_param_spec_object ("active-window",
P_("Active window"),
P_("The window which most recently had focus"),
g_param_spec_object ("active-window", NULL, NULL,
GTK_TYPE_WINDOW,
G_PARAM_READABLE|G_PARAM_STATIC_STRINGS);
+1 -4
View File
@@ -685,10 +685,7 @@ gtk_application_window_class_init (GtkApplicationWindowClass *class)
* of whether the desktop shell is showing it or not.
*/
gtk_application_window_properties[PROP_SHOW_MENUBAR] =
g_param_spec_boolean ("show-menubar",
P_("Show a menubar"),
P_("TRUE if the window should show a "
"menubar at the top of the window"),
g_param_spec_boolean ("show-menubar", NULL, NULL,
FALSE, G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_properties (object_class, N_PROPS, gtk_application_window_properties);
}
+5 -15
View File
@@ -140,9 +140,7 @@ gtk_aspect_frame_class_init (GtkAspectFrameClass *class)
*/
g_object_class_install_property (gobject_class,
PROP_XALIGN,
g_param_spec_float ("xalign",
P_("Horizontal Alignment"),
P_("X alignment of the child"),
g_param_spec_float ("xalign", NULL, NULL,
0.0, 1.0, 0.5,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
/**
@@ -152,9 +150,7 @@ gtk_aspect_frame_class_init (GtkAspectFrameClass *class)
*/
g_object_class_install_property (gobject_class,
PROP_YALIGN,
g_param_spec_float ("yalign",
P_("Vertical Alignment"),
P_("Y alignment of the child"),
g_param_spec_float ("yalign", NULL, NULL,
0.0, 1.0, 0.5,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
/**
@@ -167,9 +163,7 @@ gtk_aspect_frame_class_init (GtkAspectFrameClass *class)
*/
g_object_class_install_property (gobject_class,
PROP_RATIO,
g_param_spec_float ("ratio",
P_("Ratio"),
P_("Aspect ratio if obey_child is FALSE"),
g_param_spec_float ("ratio", NULL, NULL,
MIN_RATIO, MAX_RATIO, 1.0,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
/**
@@ -179,9 +173,7 @@ gtk_aspect_frame_class_init (GtkAspectFrameClass *class)
*/
g_object_class_install_property (gobject_class,
PROP_OBEY_CHILD,
g_param_spec_boolean ("obey-child",
P_("Obey child"),
P_("Force aspect ratio to match that of the frames child"),
g_param_spec_boolean ("obey-child", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
/**
@@ -191,9 +183,7 @@ gtk_aspect_frame_class_init (GtkAspectFrameClass *class)
*/
g_object_class_install_property (gobject_class,
PROP_CHILD,
g_param_spec_object ("child",
P_("Child"),
P_("The child widget"),
g_param_spec_object ("child", NULL, NULL,
GTK_TYPE_WIDGET,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
+6 -18
View File
@@ -253,9 +253,7 @@ gtk_assistant_page_class_init (GtkAssistantPageClass *class)
*/
g_object_class_install_property (object_class,
CHILD_PROP_PAGE_TYPE,
g_param_spec_enum ("page-type",
P_("Page type"),
P_("The type of the assistant page"),
g_param_spec_enum ("page-type", NULL, NULL,
GTK_TYPE_ASSISTANT_PAGE_TYPE,
GTK_ASSISTANT_PAGE_CONTENT,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
@@ -267,9 +265,7 @@ gtk_assistant_page_class_init (GtkAssistantPageClass *class)
*/
g_object_class_install_property (object_class,
CHILD_PROP_PAGE_TITLE,
g_param_spec_string ("title",
P_("Page title"),
P_("The title of the assistant page"),
g_param_spec_string ("title", NULL, NULL,
NULL,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
@@ -283,9 +279,7 @@ gtk_assistant_page_class_init (GtkAssistantPageClass *class)
*/
g_object_class_install_property (object_class,
CHILD_PROP_PAGE_COMPLETE,
g_param_spec_boolean ("complete",
P_("Page complete"),
P_("Whether all required fields on the page have been filled out"),
g_param_spec_boolean ("complete", NULL, NULL,
FALSE,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
@@ -296,9 +290,7 @@ gtk_assistant_page_class_init (GtkAssistantPageClass *class)
*/
g_object_class_install_property (object_class,
CHILD_PROP_CHILD,
g_param_spec_object ("child",
P_("Child widget"),
P_("The content the assistant page"),
g_param_spec_object ("child", NULL, NULL,
GTK_TYPE_WIDGET,
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
}
@@ -604,9 +596,7 @@ gtk_assistant_class_init (GtkAssistantClass *class)
*/
g_object_class_install_property (gobject_class,
PROP_USE_HEADER_BAR,
g_param_spec_int ("use-header-bar",
P_("Use Header Bar"),
P_("Use Header Bar for actions."),
g_param_spec_int ("use-header-bar", NULL, NULL,
-1, 1, -1,
GTK_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY));
@@ -617,9 +607,7 @@ gtk_assistant_class_init (GtkAssistantClass *class)
*/
g_object_class_install_property (gobject_class,
PROP_PAGES,
g_param_spec_object ("pages",
P_("Pages"),
P_("The pages of the assistant."),
g_param_spec_object ("pages", NULL, NULL,
G_TYPE_LIST_MODEL,
GTK_PARAM_READABLE));
+3 -9
View File
@@ -209,9 +209,7 @@ gtk_at_context_class_init (GtkATContextClass *klass)
* set or retrieved.
*/
obj_props[PROP_ACCESSIBLE_ROLE] =
g_param_spec_enum ("accessible-role",
"Accessible Role",
"The accessible role of the AT context",
g_param_spec_enum ("accessible-role", NULL, NULL,
GTK_TYPE_ACCESSIBLE_ROLE,
GTK_ACCESSIBLE_ROLE_NONE,
G_PARAM_READWRITE |
@@ -224,9 +222,7 @@ gtk_at_context_class_init (GtkATContextClass *klass)
* The `GtkAccessible` that created the `GtkATContext` instance.
*/
obj_props[PROP_ACCESSIBLE] =
g_param_spec_object ("accessible",
"Accessible",
"The accessible implementation",
g_param_spec_object ("accessible", NULL, NULL,
GTK_TYPE_ACCESSIBLE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
@@ -238,9 +234,7 @@ gtk_at_context_class_init (GtkATContextClass *klass)
* The `GdkDisplay` for the `GtkATContext`.
*/
obj_props[PROP_DISPLAY] =
g_param_spec_object ("display",
"Display",
"The display connection",
g_param_spec_object ("display", NULL, NULL,
GDK_TYPE_DISPLAY,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS |
+4 -12
View File
@@ -213,9 +213,7 @@ gtk_bookmark_list_class_init (GtkBookmarkListClass *class)
* The bookmark file to load.
*/
properties[PROP_FILENAME] =
g_param_spec_string ("filename",
P_("Filename"),
P_("Bookmark file to load"),
g_param_spec_string ("filename", NULL, NULL,
NULL,
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_EXPLICIT_NOTIFY);
/**
@@ -224,9 +222,7 @@ gtk_bookmark_list_class_init (GtkBookmarkListClass *class)
* The attributes to query.
*/
properties[PROP_ATTRIBUTES] =
g_param_spec_string ("attributes",
P_("Attributes"),
P_("Attributes to query"),
g_param_spec_string ("attributes", NULL, NULL,
NULL,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -236,9 +232,7 @@ gtk_bookmark_list_class_init (GtkBookmarkListClass *class)
* Priority used when loading.
*/
properties[PROP_IO_PRIORITY] =
g_param_spec_int ("io-priority",
P_("IO priority"),
P_("Priority used when loading"),
g_param_spec_int ("io-priority", NULL, NULL,
-G_MAXINT, G_MAXINT, G_PRIORITY_DEFAULT,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -248,9 +242,7 @@ gtk_bookmark_list_class_init (GtkBookmarkListClass *class)
* %TRUE if files are being loaded.
*/
properties[PROP_LOADING] =
g_param_spec_boolean ("loading",
P_("loading"),
P_("TRUE if files are being loaded"),
g_param_spec_boolean ("loading", NULL, NULL,
FALSE,
GTK_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY);
+2 -6
View File
@@ -159,9 +159,7 @@ gtk_bool_filter_class_init (GtkBoolFilterClass *class)
* The boolean expression to evaluate on item.
*/
properties[PROP_EXPRESSION] =
gtk_param_spec_expression ("expression",
P_("Expression"),
P_("Expression to evaluate"),
gtk_param_spec_expression ("expression", NULL, NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
/**
@@ -170,9 +168,7 @@ gtk_bool_filter_class_init (GtkBoolFilterClass *class)
* If the expression result should be inverted.
*/
properties[PROP_INVERT] =
g_param_spec_boolean ("invert",
P_("Invert"),
P_("If the expression result should be inverted"),
g_param_spec_boolean ("invert", NULL, NULL,
FALSE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
+3 -9
View File
@@ -258,9 +258,7 @@ gtk_box_class_init (GtkBoxClass *class)
* The amount of space between children.
*/
props[PROP_SPACING] =
g_param_spec_int ("spacing",
P_("Spacing"),
P_("The amount of space between children"),
g_param_spec_int ("spacing", NULL, NULL,
0, G_MAXINT, 0,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
@@ -270,9 +268,7 @@ gtk_box_class_init (GtkBoxClass *class)
* Whether the children should all be the same size.
*/
props[PROP_HOMOGENEOUS] =
g_param_spec_boolean ("homogeneous",
P_("Homogeneous"),
P_("Whether the children should all be the same size"),
g_param_spec_boolean ("homogeneous", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
@@ -282,9 +278,7 @@ gtk_box_class_init (GtkBoxClass *class)
* The position of the baseline aligned widgets if extra space is available.
*/
props[PROP_BASELINE_POSITION] =
g_param_spec_enum ("baseline-position",
P_("Baseline position"),
P_("The position of the baseline aligned widgets if extra space is available"),
g_param_spec_enum ("baseline-position", NULL, NULL,
GTK_TYPE_BASELINE_POSITION,
GTK_BASELINE_POSITION_CENTER,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
+3 -9
View File
@@ -896,9 +896,7 @@ gtk_box_layout_class_init (GtkBoxLayoutClass *klass)
* equally among the children.
*/
box_layout_props[PROP_HOMOGENEOUS] =
g_param_spec_boolean ("homogeneous",
P_("Homogeneous"),
P_("Distribute space homogeneously"),
g_param_spec_boolean ("homogeneous", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE |
G_PARAM_EXPLICIT_NOTIFY);
@@ -909,9 +907,7 @@ gtk_box_layout_class_init (GtkBoxLayoutClass *klass)
* The space to put between the children.
*/
box_layout_props[PROP_SPACING] =
g_param_spec_int ("spacing",
P_("Spacing"),
P_("Spacing between widgets"),
g_param_spec_int ("spacing", NULL, NULL,
0, G_MAXINT, 0,
GTK_PARAM_READWRITE |
G_PARAM_EXPLICIT_NOTIFY);
@@ -926,9 +922,7 @@ gtk_box_layout_class_init (GtkBoxLayoutClass *klass)
* at least one child with a baseline alignment.
*/
box_layout_props[PROP_BASELINE_POSITION] =
g_param_spec_enum ("baseline-position",
P_("Baseline position"),
P_("The position of the baseline aligned widgets if extra space is available"),
g_param_spec_enum ("baseline-position", NULL, NULL,
GTK_TYPE_BASELINE_POSITION,
GTK_BASELINE_POSITION_CENTER,
GTK_PARAM_READWRITE |
+3 -9
View File
@@ -305,9 +305,7 @@ gtk_builder_class_init (GtkBuilderClass *klass)
* otherwise g_dgettext().
*/
builder_props[PROP_TRANSLATION_DOMAIN] =
g_param_spec_string ("translation-domain",
P_("Translation Domain"),
P_("The translation domain used by gettext"),
g_param_spec_string ("translation-domain", NULL, NULL,
NULL,
GTK_PARAM_READWRITE);
@@ -317,9 +315,7 @@ gtk_builder_class_init (GtkBuilderClass *klass)
* The object the builder is evaluating for.
*/
builder_props[PROP_CURRENT_OBJECT] =
g_param_spec_object ("current-object",
P_("Current object"),
P_("The object the builder is evaluating for"),
g_param_spec_object ("current-object", NULL, NULL,
G_TYPE_OBJECT,
GTK_PARAM_READWRITE);
@@ -329,9 +325,7 @@ gtk_builder_class_init (GtkBuilderClass *klass)
* The scope the builder is operating in
*/
builder_props[PROP_SCOPE] =
g_param_spec_object ("scope",
P_("Scope"),
P_("The scope the builder is operating in"),
g_param_spec_object ("scope", NULL, NULL,
GTK_TYPE_BUILDER_SCOPE,
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT);
+3 -9
View File
@@ -264,9 +264,7 @@ gtk_builder_list_item_factory_class_init (GtkBuilderListItemFactoryClass *klass)
* `GBytes` containing the UI definition.
*/
properties[PROP_BYTES] =
g_param_spec_boxed ("bytes",
P_("Bytes"),
P_("bytes containing the UI definition"),
g_param_spec_boxed ("bytes", NULL, NULL,
G_TYPE_BYTES,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
@@ -276,9 +274,7 @@ gtk_builder_list_item_factory_class_init (GtkBuilderListItemFactoryClass *klass)
* Path of the resource containing the UI definition.
*/
properties[PROP_RESOURCE] =
g_param_spec_string ("resource",
P_("Resource"),
P_("resource containing the UI definition"),
g_param_spec_string ("resource", NULL, NULL,
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
@@ -288,9 +284,7 @@ gtk_builder_list_item_factory_class_init (GtkBuilderListItemFactoryClass *klass)
* `GtkBuilderScope` to use when instantiating listitems
*/
properties[PROP_SCOPE] =
g_param_spec_object ("scope",
P_("Scope"),
P_("scope to use when instantiating listitems"),
g_param_spec_object ("scope", NULL, NULL,
GTK_TYPE_BUILDER_SCOPE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);

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