Compare commits
184 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 70eec3ee01 | |||
| 05d5860dc0 | |||
| 2e08db91ca | |||
| 2c9b47ff3c | |||
| 62ad1a61dc | |||
| 3fc9de7539 | |||
| 1c9a55d185 | |||
| 492940205e | |||
| 985e4906c8 | |||
| e9dcf8167c | |||
| 3aa6c27c26 | |||
| 7075e6be89 | |||
| 016354b6dd | |||
| 1dfc6d65df | |||
| b7d0295481 | |||
| a2854af325 | |||
| 320496b039 | |||
| f004f14b89 | |||
| 8f15f6959c | |||
| f26efd9adf | |||
| 3f342d75b2 | |||
| 3ab189404e | |||
| 48fc8d6606 | |||
| 2e0f411de9 | |||
| f08e36e225 | |||
| 9f358ac655 | |||
| 33d1349e53 | |||
| 76421847a5 | |||
| 840cd6e44c | |||
| f81038e99a | |||
| 007e7c68dc | |||
| e5e147ad53 | |||
| 58e00040e0 | |||
| 5d1b8399fb | |||
| deec2b6c6c | |||
| 246eb8ea25 | |||
| 815df9a76a | |||
| f896dddadc | |||
| d733e94a8b | |||
| 59db0ca328 | |||
| 3bd97590a1 | |||
| 722a0fa36d | |||
| b21708c5e4 | |||
| b5fb584316 | |||
| fd1e1b9b7c | |||
| c0caae0ff0 | |||
| 5c972e4786 | |||
| 1a3c5cf420 | |||
| eb7affd911 | |||
| a05dbff2c9 | |||
| 4b0d17b332 | |||
| 2d8f677e63 | |||
| b5c9b6aa25 | |||
| 86924c2f9a | |||
| af0f5e3f30 | |||
| 9e6c72210d | |||
| ce0b2d6953 | |||
| d1bb3f66ac | |||
| 70cd0e28ab | |||
| 2e00bcc580 | |||
| db68c1f2c6 | |||
| e3fa60a070 | |||
| c9c29d8bde | |||
| cd59d62947 | |||
| 4f4fe4ef44 | |||
| 06f83847c6 | |||
| 941b5c2aeb | |||
| d661b7f258 | |||
| f86d996d58 | |||
| fe3031fb99 | |||
| 4b001a24db | |||
| 4727fea631 | |||
| 7ff4cba624 | |||
| 0363cc83b9 | |||
| c1327e2c1b | |||
| 9971707544 | |||
| 02115912aa | |||
| e29571e6a6 | |||
| 582ad79088 | |||
| 3fac42fd3c | |||
| 8f0b38b462 | |||
| 6c5a106d7e | |||
| 5f7cab4632 | |||
| 558db5a3a7 | |||
| bc94b4f235 | |||
| 4c809281b2 | |||
| 81faf7caa3 | |||
| 7477e8626d | |||
| 47f30d208c | |||
| 74a1c0916a | |||
| ee67edbe3a | |||
| ec9cdb74ef | |||
| ad0f9144ec | |||
| 3e8215a971 | |||
| 8df7487e2a | |||
| 633692b53e | |||
| e0a5c65003 | |||
| e4753791c0 | |||
| a57f7e3935 | |||
| 8de5a94eb7 | |||
| 88872d1986 | |||
| ab33b56ec9 | |||
| c37e88d561 | |||
| 2638700435 | |||
| 0a5a720fe1 | |||
| 0e5f7601e4 | |||
| e583e823b5 | |||
| a96358046f | |||
| 40f26ea09b | |||
| 71a7f0771b | |||
| 00739718ab | |||
| 19881c8c06 | |||
| 8b0aae8536 | |||
| fbe000734a | |||
| 0c67b367ac | |||
| f75b4aac1d | |||
| d563d158c0 | |||
| 5c892fa4ea | |||
| 4aac64edf0 | |||
| c97bbfdfb1 | |||
| a44598772d | |||
| 933a0e5a98 | |||
| e33e9c506d | |||
| 0108a5f56d | |||
| c995473407 | |||
| 3f9bdaa4c8 | |||
| a70998aa50 | |||
| 0fb1f44eec | |||
| 26cc96bb7f | |||
| 1c8b22cf05 | |||
| abbbd08931 | |||
| 587cf28dd3 | |||
| 53231a137c | |||
| 104a264d8b | |||
| 75fd582b97 | |||
| 89977412e9 | |||
| ce030b1b36 | |||
| 6c5dc8cd1f | |||
| fb4b38e5ea | |||
| fc405f8882 | |||
| afe61e28e0 | |||
| 4f3f3c9ae2 | |||
| e699685003 | |||
| 9583195e96 | |||
| a526f0770e | |||
| 707e492f0d | |||
| 680dba6524 | |||
| d1bb1d091c | |||
| 6510b876d1 | |||
| e376941e49 | |||
| 4889199b14 | |||
| 2e15225446 | |||
| 9dad71513c | |||
| ed072b4b5d | |||
| 7ffc4e0a21 | |||
| b9403f4f5b | |||
| 9f1aa3141b | |||
| 06e905f87d | |||
| 2ba8dcebff | |||
| 95a8def7c2 | |||
| 777799070d | |||
| 0f83a9550b | |||
| 17f2443350 | |||
| 6bfc995097 | |||
| 8068111c6e | |||
| 6e1c47b021 | |||
| aed4ced032 | |||
| 96160ea5dc | |||
| c76c07ddfe | |||
| 7b82dc7ac5 | |||
| a63e9d38fb | |||
| cc8db1805d | |||
| 948532f3c9 | |||
| 8f39f8d827 | |||
| 5e28c05121 | |||
| 32d15a5858 | |||
| c0b813940e | |||
| d90dc7f75e | |||
| 3c94e91e5e | |||
| 8a1bee1d79 | |||
| 9297439de4 | |||
| 02cdb36421 | |||
| b3d4d70bc1 | |||
| 715c0bfc0a |
+1
-2
@@ -445,9 +445,8 @@ reference:
|
||||
--force-fallback-for=gdk-pixbuf,pango
|
||||
-Dintrospection=enabled
|
||||
-Ddocumentation=true
|
||||
-Dgtk_doc=true
|
||||
-Dgdk-pixbuf:gtk_doc=true
|
||||
-Dpango:gtk_doc=true
|
||||
-Dpango:documentation=true
|
||||
-Dbuild-demos=false
|
||||
-Dbuild-examples=false
|
||||
-Dbuild-tests=false
|
||||
|
||||
@@ -24,7 +24,7 @@ flatpak build ${builddir} meson \
|
||||
-Dbuild-examples=false \
|
||||
-Dintrospection=disabled \
|
||||
-Dbuild-demos=true \
|
||||
-Ddemo-profile=devel \
|
||||
-Dprofile=devel \
|
||||
_flatpak_build
|
||||
|
||||
flatpak build --env=CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA ${builddir} ninja -C _flatpak_build install
|
||||
|
||||
+9
-14
@@ -35,7 +35,7 @@ The issue tracker is meant to be used for actionable issues only.
|
||||
|
||||
You should not open a new issue for security related questions.
|
||||
|
||||
When in doubt, follow [security](https://security.gnome.org/).
|
||||
When in doubt, follow the process for [GNOME security issues](https://security.gnome.org/).
|
||||
|
||||
### Bug reports
|
||||
|
||||
@@ -144,33 +144,28 @@ $ git clone https://gitlab.gnome.org/yourusername/gtk.git
|
||||
$ cd gtk
|
||||
```
|
||||
|
||||
**Note**: if you plan to push changes to back to the main repository and
|
||||
have a GNOME account, you can skip the fork, and use the following instead:
|
||||
|
||||
```sh
|
||||
$ git clone git@gitlab.gnome.org:GNOME/gtk.git
|
||||
$ cd gtk
|
||||
```
|
||||
|
||||
To compile the Git version of GTK on your system, you will need to
|
||||
configure your build using Meson:
|
||||
|
||||
```sh
|
||||
$ meson _builddir .
|
||||
$ cd _builddir
|
||||
$ ninja
|
||||
$ meson setup _builddir .
|
||||
$ meson compile -C _builddir
|
||||
```
|
||||
|
||||
Typically, you should work on your own branch:
|
||||
|
||||
```sh
|
||||
$ git checkout -b your-branch
|
||||
$ git switch -C your-branch
|
||||
```
|
||||
|
||||
Once you've finished working on the bug fix or feature, push the branch
|
||||
to the Git repository and open a new merge request, to let the GTK
|
||||
maintainers review your contribution.
|
||||
|
||||
**Important**: Do **not** attach a diff or a patch file to a GitLab issue.
|
||||
Patches cannot be reviewed, and do not not go through the CI pipeline. If
|
||||
you wish to submit your changes to GTK, always use a merge request.
|
||||
|
||||
### Code reviews
|
||||
|
||||
Each contribution is reviewed by the core developers of the GTK project.
|
||||
@@ -262,4 +257,4 @@ people committing to GTK to follow a few rules:
|
||||
|
||||
If you have been contributing to GTK for a while and you don't have commit
|
||||
access to the repository, you may ask to obtain it following the [GNOME account
|
||||
process](https://wiki.gnome.org/AccountsTeam/NewAccounts).
|
||||
process](https://handbook.gnome.org/infrastructure/developer-access.html).
|
||||
|
||||
@@ -1,6 +1,111 @@
|
||||
Overview of Changes in 4.15.0, xx-xx-xxxx
|
||||
Overview of Changes in 4.15.1, xx-xx-xxxx
|
||||
=========================================
|
||||
|
||||
Overview of Changes in 4.15.0, 21-04-2024
|
||||
=========================================
|
||||
|
||||
This release changes the default GSK renderer to be Vulkan, on
|
||||
Wayland. Other platforms still use ngl.
|
||||
|
||||
The intent of this change is to get wider testing and verify that
|
||||
Vulkan drivers are good enough for us to rely on. If significant
|
||||
problems show up, we will revert this change for 4.16.
|
||||
|
||||
You can still override the renderer choice using the GSK_RENDERER
|
||||
environment variable.
|
||||
|
||||
---
|
||||
|
||||
This release also changes font rendering settings by introducing
|
||||
a new high-level gtk-font-rendering settings which gives GTK more
|
||||
freedom to decide on font rendering.
|
||||
|
||||
You can still use the low-level font-related settings by changing
|
||||
the new property to 'manual'.
|
||||
|
||||
---
|
||||
|
||||
* GtkColumnView:
|
||||
- Fix infinite loops in dispose
|
||||
- Fix problems with weak ref cycles in GtkExpression
|
||||
|
||||
* GtkListView:
|
||||
* GtkShortcutManager:
|
||||
- Track the propagation phase of added controllers
|
||||
|
||||
* GtkGLArea:
|
||||
- Produce dmabuf textures, so graphics offload is possible
|
||||
|
||||
* GtkTextView:
|
||||
- Support text shadows
|
||||
|
||||
* GtkGraphicsOffload:
|
||||
- Add a black-background property
|
||||
|
||||
* Settings:
|
||||
- Add a new gtk-font-rendering setting
|
||||
|
||||
* Accessibility:
|
||||
- Add support for GetRangeExtents to GtkAccessibleText
|
||||
- Add support for GetOffsetAtPoint to GtkAccessibleText
|
||||
- Implement GtkAccessibleRange for scrollbars
|
||||
|
||||
* GDK:
|
||||
- Add a callback-based cursor API
|
||||
|
||||
* GSK:
|
||||
- Use the Vulkan renderer by default
|
||||
- Avoid an infinite recursion with offscreens in some cases
|
||||
- Optimize graphics offload to make it more likely that compositors
|
||||
can use direct scanout
|
||||
|
||||
* X11:
|
||||
- Fix some confusing debug messages
|
||||
- Drop a no-longer-relevant optimization that was interfering with
|
||||
getting the current window manager capabilities
|
||||
|
||||
* macOS:
|
||||
- Implement the color picker for macOS 10.15+
|
||||
|
||||
* Debugging:
|
||||
- Snow monitor resolution in the inspector
|
||||
|
||||
* Demos:
|
||||
- Use graphics offload in the shadertoy demo
|
||||
- Show more reliable fps numbers in the fishbowl demo
|
||||
|
||||
* Tools:
|
||||
- Support generating pdf in gtk4-rendernode-tool
|
||||
|
||||
* Build:
|
||||
- Require pango 1.52
|
||||
- Require cairo 1.18
|
||||
- Add a missing dependency that was causing build failures
|
||||
- Drop deprecated build options:
|
||||
gtk_doc -> documentation
|
||||
update_screenshots -> screenshots
|
||||
demo-profile -> profile
|
||||
demos -> build-demos
|
||||
|
||||
* Deprecations:
|
||||
- gdk_widget_set/get_font_options
|
||||
- gdk_wayland/x11_display_set_cursor_theme
|
||||
|
||||
* Translation updates:
|
||||
Basque
|
||||
Brazilian Portuguese
|
||||
British English
|
||||
Chinese (China)
|
||||
Hebrew
|
||||
Kabyle
|
||||
Persian
|
||||
Polish
|
||||
Russian
|
||||
Slovenian
|
||||
Swedish
|
||||
Turkish
|
||||
|
||||
|
||||
Overview of Changes in 4.14.2, 03-04-2024
|
||||
=========================================
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Ddemo-profile=devel"
|
||||
"-Dprofile=devel"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Ddemo-profile=devel"
|
||||
"-Dprofile=devel"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Ddemo-profile=devel"
|
||||
"-Dprofile=devel"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Ddemo-profile=devel"
|
||||
"-Dprofile=devel"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
|
||||
@@ -74,6 +74,7 @@ in a selector, widget names must be prefixed with a # character.
|
||||
| E:not(selector) | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#negation) | |
|
||||
| E:dir(ltr), E:dir(rtl) | [CSS Selector Level 4](https://drafts.csswg.org/selectors/#the-dir-pseudo) | |
|
||||
| E:drop(active) | [CSS Selector Level 4](https://drafts.csswg.org/selectors/#drag-pseudos) | |
|
||||
| E:root | [CSS Selector Level 3](https://www.w3.org/TR/selectors-3/#root-pseudo) | |
|
||||
| E F | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#descendent-combinators) | |
|
||||
| E > F | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#child-combinators) | |
|
||||
| E ~ F | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#general-sibling-combinators) | |
|
||||
|
||||
@@ -8,6 +8,10 @@ gtk4-broadwayd
|
||||
The Broadway display server
|
||||
---------------------------
|
||||
|
||||
:Version: GTK
|
||||
:Manual section: 1
|
||||
:Manual group: GTK commands
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
| **gtk4-broadwayd** [OPTIONS...] <DISPLAY>
|
||||
|
||||
@@ -8,6 +8,10 @@ gtk4-builder-tool
|
||||
GtkBuilder File Utility
|
||||
-----------------------
|
||||
|
||||
:Version: GTK
|
||||
:Manual section: 1
|
||||
:Manual group: GTK commands
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
| **gtk4-builder-tool** <COMMAND> [OPTIONS...] <FILE>
|
||||
|
||||
@@ -8,6 +8,9 @@ gtk4-demo-application
|
||||
Demonstrate GtkApplication
|
||||
--------------------------
|
||||
|
||||
:Version: GTK
|
||||
:Manual section: 1
|
||||
:Manual group: GTK commands
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
@@ -8,6 +8,10 @@ gtk4-demo
|
||||
Demonstrate GTK widgets
|
||||
-----------------------
|
||||
|
||||
:Version: GTK
|
||||
:Manual section: 1
|
||||
:Manual group: GTK commands
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
|
||||
@@ -8,6 +8,10 @@ gtk4-encode-symbolic-svg
|
||||
Symbolic icon conversion utility
|
||||
--------------------------------
|
||||
|
||||
:Version: GTK
|
||||
:Manual section: 1
|
||||
:Manual group: GTK commands
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
|
||||
@@ -8,6 +8,10 @@ gtk4-icon-browser
|
||||
List themed icons
|
||||
-----------------
|
||||
|
||||
:Version: GTK
|
||||
:Manual section: 1
|
||||
:Manual group: GTK commands
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
|
||||
@@ -8,6 +8,10 @@ gtk4-launch
|
||||
Launch an application
|
||||
---------------------
|
||||
|
||||
:Version: GTK
|
||||
:Manual section: 1
|
||||
:Manual group: GTK commands
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
|
||||
@@ -8,6 +8,10 @@ gtk4-node-editor
|
||||
Editor render nodes
|
||||
-----------------
|
||||
|
||||
:Version: GTK
|
||||
:Manual section: 1
|
||||
:Manual group: GTK commands
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
|
||||
@@ -8,6 +8,10 @@ gtk4-path-tool
|
||||
GskPath Utility
|
||||
-----------------------
|
||||
|
||||
:Version: GTK
|
||||
:Manual section: 1
|
||||
:Manual group: GTK commands
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
| **gtk4-path-tool** <COMMAND> [OPTIONS...] <PATH>
|
||||
|
||||
@@ -8,6 +8,10 @@ gtk4-query-settings
|
||||
Print name and value of GTK settings
|
||||
------------------------------------
|
||||
|
||||
:Version: GTK
|
||||
:Manual section: 1
|
||||
:Manual group: GTK commands
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
|
||||
@@ -8,6 +8,10 @@ gtk4-rendernode-tool
|
||||
GskRenderNode Utility
|
||||
-----------------------
|
||||
|
||||
:Version: GTK
|
||||
:Manual section: 1
|
||||
:Manual group: GTK commands
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
| **gtk4-rendernode-tool** <COMMAND> [OPTIONS...] <FILE>
|
||||
@@ -45,13 +49,14 @@ without any titlebar.
|
||||
Rendering
|
||||
^^^^^^^^^
|
||||
|
||||
The ``render`` command saves a rendering of the rendernode as a png or tiff image.
|
||||
The name of the file to write can be specified as a second FILE argument.
|
||||
The ``render`` command saves a rendering of the rendernode as a png, tiff or svg
|
||||
image or as pdf document. The name of the file to write can be specified as a second
|
||||
FILE argument.
|
||||
|
||||
``--renderer=RENDERER``
|
||||
|
||||
Use the given renderer. Use ``--renderer=help`` to get a information
|
||||
about poassible values for the ``RENDERER``.
|
||||
about possible values for the ``RENDERER``.
|
||||
|
||||
Benchmark
|
||||
^^^^^^^^^
|
||||
@@ -93,4 +98,4 @@ exit code is 1. If the images are identical, it is 0.
|
||||
|
||||
``--quiet``
|
||||
|
||||
Don't write results to stdout.`
|
||||
Don't write results to stdout.
|
||||
|
||||
@@ -8,6 +8,10 @@ gtk4-update-icon-cache
|
||||
Icon theme caching utility
|
||||
--------------------------
|
||||
|
||||
:Version: GTK
|
||||
:Manual section: 1
|
||||
:Manual group: GTK commands
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
|
||||
@@ -8,6 +8,10 @@ gtk4-widget-factory
|
||||
Showcase GTK widgets and styles
|
||||
-------------------------------
|
||||
|
||||
:Version: GTK
|
||||
:Manual section: 1
|
||||
:Manual group: GTK commands
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ if get_option('man-pages') and rst2man.found()
|
||||
[ 'gtk4-path-tool', '1', ],
|
||||
]
|
||||
|
||||
if get_option('demos')
|
||||
if get_option('build-demos')
|
||||
rst_files += [
|
||||
[ 'gtk4-demo', '1', ],
|
||||
[ 'gtk4-demo-application', '1', ],
|
||||
|
||||
@@ -58,12 +58,12 @@ GTK is divided into three parts:
|
||||
storage types for efficient use in GUI applications, and much more.
|
||||
|
||||
[gnu-lgpl]: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
|
||||
[glib]: https://developer.gnome.org/glib/stable/
|
||||
[gobject]: https://developer.gnome.org/gobject/stable/
|
||||
[gio]: https://developer.gnome.org/gio/stable/
|
||||
[glib]: https://docs.gtk.org/glib/
|
||||
[gobject]: https://docs.gtk.org/gobject/
|
||||
[gio]: https://docs.gtk.org/gio/
|
||||
[cairo]: https://www.cairographics.org/manual/
|
||||
[opengl]: https://www.opengl.org/about/
|
||||
[vulkan]: https://www.vulkan.org/
|
||||
[pango]: https://pango.gnome.org/
|
||||
[gdkpixbuf]: https://developer.gnome.org/gdk-pixbuf/stable/
|
||||
[pango]: https://docs.gtk.org/pango/
|
||||
[gdkpixbuf]: https://docs.gtk.org/gdk-pixbuf/
|
||||
[graphene]: https://ebassi.github.io/graphene/
|
||||
|
||||
@@ -217,6 +217,10 @@ A number of options affect behavior instead of logging:
|
||||
`no-portals`
|
||||
: Disable use of [portals](https://docs.flatpak.org/en/latest/portals.html)
|
||||
|
||||
`force-offload`
|
||||
: Force graphics offload for all textures, even when slower. This allows
|
||||
to debug offloading in the absence of dmabufs.
|
||||
|
||||
`gl-disable`
|
||||
: Disable OpenGL support
|
||||
|
||||
|
||||
+132
-17
@@ -91,6 +91,31 @@ const GDK_META_MASK = 1 << 28;
|
||||
|
||||
var useDataUrls = window.location.search.includes("datauri");
|
||||
|
||||
/* check if we are on Android and using Chrome */
|
||||
var isAndroidChrome = false;
|
||||
{
|
||||
var ua = navigator.userAgent.toLowerCase();
|
||||
if (ua.indexOf("android") > -1 && ua.indexOf("chrom") > -1) {
|
||||
isAndroidChrome = true;
|
||||
}
|
||||
}
|
||||
/* check for the passive option for Event listener */
|
||||
let passiveSupported = false;
|
||||
try {
|
||||
const options = {
|
||||
get passive() { // This function will be called when the browser
|
||||
// attempts to access the passive property.
|
||||
passiveSupported = true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener("test", null, options);
|
||||
window.removeEventListener("test", null, options);
|
||||
} catch(err) {
|
||||
passiveSupported = false;
|
||||
}
|
||||
|
||||
/* This base64code is based on https://github.com/beatgammit/base64-js/blob/master/index.js which is MIT licensed */
|
||||
|
||||
var b64_lookup = [];
|
||||
@@ -215,11 +240,32 @@ function logStackTrace(len) {
|
||||
log(callstack[i]);
|
||||
}
|
||||
|
||||
/* Helper functions for touch identifier to make it unique on Android */
|
||||
var globalTouchIdentifier = Math.round(Date.now() / 1000);
|
||||
function touchIdentifierStart(tId)
|
||||
{
|
||||
if (isAndroidChrome) {
|
||||
if (tId == 0) {
|
||||
return ++globalTouchIdentifier;
|
||||
}
|
||||
return globalTouchIdentifier + tId;
|
||||
}
|
||||
return tId;
|
||||
}
|
||||
function touchIdentifier(tId)
|
||||
{
|
||||
if (isAndroidChrome) {
|
||||
return globalTouchIdentifier + tId;
|
||||
}
|
||||
return tId;
|
||||
}
|
||||
|
||||
var grab = new Object();
|
||||
grab.surface = null;
|
||||
grab.ownerEvents = false;
|
||||
grab.implicit = false;
|
||||
var keyDownList = [];
|
||||
var inputList = [];
|
||||
var lastSerial = 0;
|
||||
var lastX = 0;
|
||||
var lastY = 0;
|
||||
@@ -987,7 +1033,14 @@ function handleDisplayCommands(display_commands)
|
||||
break;
|
||||
case DISPLAY_OP_DELETE_SURFACE:
|
||||
var id = cmd[1];
|
||||
delete surfaces[id];
|
||||
if (id == surfaceWithMouse) {
|
||||
surfaceWithMouse = 0;
|
||||
}
|
||||
if (id == realSurfaceWithMouse) {
|
||||
realSurfaceWithMouse = 0;
|
||||
firstTouchDownId = null;
|
||||
}
|
||||
delete surfaces[id];
|
||||
break;
|
||||
case DISPLAY_OP_CHANGE_TEXTURE:
|
||||
var image = cmd[1];
|
||||
@@ -1371,8 +1424,14 @@ function getEffectiveEventTarget (id) {
|
||||
function updateKeyboardStatus() {
|
||||
if (fakeInput != null && showKeyboardChanged) {
|
||||
showKeyboardChanged = false;
|
||||
if (showKeyboard)
|
||||
if (showKeyboard) {
|
||||
if (isAndroidChrome) {
|
||||
fakeInput.blur();
|
||||
fakeInput.value = ' '.repeat(80); // TODO: Should be exchange with broadway server
|
||||
// to bring real value here.
|
||||
}
|
||||
fakeInput.focus();
|
||||
}
|
||||
else
|
||||
fakeInput.blur();
|
||||
}
|
||||
@@ -2924,6 +2983,19 @@ function pushKeyEvent(fev) {
|
||||
keyDownList.push(fev);
|
||||
}
|
||||
|
||||
function copyInputEvent(ev) {
|
||||
var members = ['inputType', 'data'], i, obj = {};
|
||||
for (i = 0; i < members.length; i++) {
|
||||
if (typeof ev[members[i]] !== "undefined")
|
||||
obj[members[i]] = ev[members[i]];
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
function pushInputEvent(fev) {
|
||||
inputList.push(fev);
|
||||
}
|
||||
|
||||
function getKeyEvent(keyCode, pop) {
|
||||
var i, fev = null;
|
||||
for (i = keyDownList.length-1; i >= 0; i--) {
|
||||
@@ -3022,6 +3094,29 @@ function handleKeyUp(e) {
|
||||
keysym = fev.keysym;
|
||||
else {
|
||||
//log("Key event (keyCode = " + ev.keyCode + ") not found on keyDownList");
|
||||
if (isAndroidChrome && (ev.keyCode == 229)) {
|
||||
var i, fev = null, len = inputList.length, str;
|
||||
for (i = 0; i < len; i++) {
|
||||
fev = inputList[i];
|
||||
switch(fev.inputType) {
|
||||
case "deleteContentBackward":
|
||||
sendInput(BROADWAY_EVENT_KEY_PRESS, [65288, lastState]);
|
||||
sendInput(BROADWAY_EVENT_KEY_RELEASE, [65288, lastState]);
|
||||
break;
|
||||
case "insertText":
|
||||
if (fev.data !== undefined) {
|
||||
for (let sym of fev.data) {
|
||||
sendInput(BROADWAY_EVENT_KEY_PRESS, [sym.codePointAt(0), lastState]);
|
||||
sendInput(BROADWAY_EVENT_KEY_RELEASE, [sym.codePointAt(0), lastState]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
inputList.splice(0, len);
|
||||
}
|
||||
keysym = 0;
|
||||
}
|
||||
|
||||
@@ -3030,6 +3125,16 @@ function handleKeyUp(e) {
|
||||
return cancelEvent(ev);
|
||||
}
|
||||
|
||||
function handleInput (e) {
|
||||
var fev = null, ev = (e ? e : window.event), keysym = null, suppress = false;
|
||||
|
||||
fev = copyInputEvent(ev);
|
||||
pushInputEvent(fev);
|
||||
|
||||
// Stop keypress events just in case
|
||||
return cancelEvent(ev);
|
||||
}
|
||||
|
||||
function onKeyDown (ev) {
|
||||
updateForEvent(ev);
|
||||
return handleKeyDown(ev);
|
||||
@@ -3045,6 +3150,11 @@ function onKeyUp (ev) {
|
||||
return handleKeyUp(ev);
|
||||
}
|
||||
|
||||
function onInput (ev) {
|
||||
updateForEvent(ev);
|
||||
return handleInput(ev);
|
||||
}
|
||||
|
||||
function cancelEvent(ev)
|
||||
{
|
||||
ev = ev ? ev : window.event;
|
||||
@@ -3076,13 +3186,14 @@ function onMouseWheel(ev)
|
||||
}
|
||||
|
||||
function onTouchStart(ev) {
|
||||
event.preventDefault();
|
||||
ev.preventDefault();
|
||||
|
||||
updateKeyboardStatus();
|
||||
updateForEvent(ev);
|
||||
|
||||
for (var i = 0; i < ev.changedTouches.length; i++) {
|
||||
var touch = ev.changedTouches.item(i);
|
||||
var touchId = touchIdentifierStart(touch.identifier);
|
||||
|
||||
var origId = getSurfaceId(touch);
|
||||
var id = getEffectiveEventTarget (origId);
|
||||
@@ -3090,7 +3201,7 @@ function onTouchStart(ev) {
|
||||
var isEmulated = 0;
|
||||
|
||||
if (firstTouchDownId == null) {
|
||||
firstTouchDownId = touch.identifier;
|
||||
firstTouchDownId = touchId;
|
||||
isEmulated = 1;
|
||||
|
||||
if (realSurfaceWithMouse != origId || id != surfaceWithMouse) {
|
||||
@@ -3105,52 +3216,54 @@ function onTouchStart(ev) {
|
||||
}
|
||||
}
|
||||
|
||||
sendInput (BROADWAY_EVENT_TOUCH, [0, id, touch.identifier, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
|
||||
sendInput (BROADWAY_EVENT_TOUCH, [0, id, touchId, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
|
||||
}
|
||||
}
|
||||
|
||||
function onTouchMove(ev) {
|
||||
event.preventDefault();
|
||||
ev.preventDefault();
|
||||
|
||||
updateKeyboardStatus();
|
||||
updateForEvent(ev);
|
||||
|
||||
for (var i = 0; i < ev.changedTouches.length; i++) {
|
||||
var touch = ev.changedTouches.item(i);
|
||||
var touchId = touchIdentifier(touch.identifier);
|
||||
|
||||
var origId = getSurfaceId(touch);
|
||||
var id = getEffectiveEventTarget (origId);
|
||||
var pos = getPositionsFromEvent(touch, id);
|
||||
|
||||
var isEmulated = 0;
|
||||
if (firstTouchDownId == touch.identifier) {
|
||||
if (firstTouchDownId == touchId) {
|
||||
isEmulated = 1;
|
||||
}
|
||||
|
||||
sendInput (BROADWAY_EVENT_TOUCH, [1, id, touch.identifier, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
|
||||
sendInput (BROADWAY_EVENT_TOUCH, [1, id, touchId, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
|
||||
}
|
||||
}
|
||||
|
||||
function onTouchEnd(ev) {
|
||||
event.preventDefault();
|
||||
ev.preventDefault();
|
||||
|
||||
updateKeyboardStatus();
|
||||
updateForEvent(ev);
|
||||
|
||||
for (var i = 0; i < ev.changedTouches.length; i++) {
|
||||
var touch = ev.changedTouches.item(i);
|
||||
var touchId = touchIdentifier(touch.identifier);
|
||||
|
||||
var origId = getSurfaceId(touch);
|
||||
var id = getEffectiveEventTarget (origId);
|
||||
var pos = getPositionsFromEvent(touch, id);
|
||||
|
||||
var isEmulated = 0;
|
||||
if (firstTouchDownId == touch.identifier) {
|
||||
if (firstTouchDownId == touchId) {
|
||||
isEmulated = 1;
|
||||
firstTouchDownId = null;
|
||||
}
|
||||
|
||||
sendInput (BROADWAY_EVENT_TOUCH, [2, id, touch.identifier, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
|
||||
sendInput (BROADWAY_EVENT_TOUCH, [2, id, touchId, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3167,11 +3280,11 @@ function setupDocument(document)
|
||||
document.onkeyup = onKeyUp;
|
||||
|
||||
if (document.addEventListener) {
|
||||
document.addEventListener('DOMMouseScroll', onMouseWheel, false);
|
||||
document.addEventListener('mousewheel', onMouseWheel, false);
|
||||
document.addEventListener('touchstart', onTouchStart, false);
|
||||
document.addEventListener('touchmove', onTouchMove, false);
|
||||
document.addEventListener('touchend', onTouchEnd, false);
|
||||
document.addEventListener('DOMMouseScroll', onMouseWheel, passiveSupported ? { passive: false, capture: false } : false);
|
||||
document.addEventListener('mousewheel', onMouseWheel, passiveSupported ? { passive: false, capture: false } : false);
|
||||
document.addEventListener('touchstart', onTouchStart, passiveSupported ? { passive: false, capture: false } : false);
|
||||
document.addEventListener('touchmove', onTouchMove, passiveSupported ? { passive: false, capture: false } : false);
|
||||
document.addEventListener('touchend', onTouchEnd, passiveSupported ? { passive: false, capture: false } : false);
|
||||
} else if (document.attachEvent) {
|
||||
element.attachEvent("onmousewheel", onMouseWheel);
|
||||
}
|
||||
@@ -3237,12 +3350,14 @@ function connect()
|
||||
};
|
||||
|
||||
var iOS = /(iPad|iPhone|iPod)/g.test( navigator.userAgent );
|
||||
if (iOS) {
|
||||
if (iOS || isAndroidChrome) {
|
||||
fakeInput = document.createElement("input");
|
||||
fakeInput.type = "text";
|
||||
fakeInput.style.position = "absolute";
|
||||
fakeInput.style.left = "-1000px";
|
||||
fakeInput.style.top = "-1000px";
|
||||
document.body.appendChild(fakeInput);
|
||||
if (isAndroidChrome)
|
||||
fakeInput.addEventListener('input', onInput, passiveSupported ? { passive: false, capture: false } : false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,8 +52,7 @@ broadwayjs_h = custom_target('broadwayjs.h',
|
||||
)
|
||||
|
||||
libgdk_broadway = static_library('gdk-broadway',
|
||||
clienthtml_h, broadwayjs_h,
|
||||
gdk_broadway_sources, gdkconfig, gdkenum_h,
|
||||
sources: [ clienthtml_h, broadwayjs_h, gdk_broadway_sources, gdk_gen_headers ],
|
||||
include_directories: [confinc, gdkinc],
|
||||
c_args: [
|
||||
'-DGTK_COMPILATION',
|
||||
|
||||
@@ -122,6 +122,7 @@ static const GdkDebugKey gdk_debug_keys[] = {
|
||||
|
||||
{ "portals", GDK_DEBUG_PORTALS, "Force use of portals" },
|
||||
{ "no-portals", GDK_DEBUG_NO_PORTALS, "Disable use of portals" },
|
||||
{ "force-offload", GDK_DEBUG_FORCE_OFFLOAD, "Force graphics offload for all textures" },
|
||||
{ "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support" },
|
||||
{ "gl-no-fractional", GDK_DEBUG_GL_NO_FRACTIONAL, "Disable fractional scaling for OpenGL" },
|
||||
{ "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL" },
|
||||
|
||||
@@ -44,7 +44,7 @@ typedef enum {
|
||||
GDK_DEBUG_NO_PORTALS = 1 << 15,
|
||||
GDK_DEBUG_GL_DISABLE = 1 << 16,
|
||||
GDK_DEBUG_GL_NO_FRACTIONAL= 1 << 17,
|
||||
|
||||
GDK_DEBUG_FORCE_OFFLOAD = 1 << 18,
|
||||
GDK_DEBUG_GL_DISABLE_GL = 1 << 19,
|
||||
GDK_DEBUG_GL_DISABLE_GLES = 1 << 20,
|
||||
GDK_DEBUG_GL_PREFER_GL = 1 << 21,
|
||||
|
||||
@@ -72,7 +72,10 @@ gdk_dmabuf_texture_dispose (GObject *object)
|
||||
GdkDmabufTexture *self = GDK_DMABUF_TEXTURE (object);
|
||||
|
||||
if (self->destroy)
|
||||
self->destroy (self->data);
|
||||
{
|
||||
self->destroy (self->data);
|
||||
self->destroy = NULL;
|
||||
}
|
||||
|
||||
g_clear_object (&self->downloader);
|
||||
g_clear_object (&self->display);
|
||||
|
||||
@@ -744,3 +744,11 @@ gdk_monitor_set_description (GdkMonitor *monitor,
|
||||
g_object_notify_by_pspec (G_OBJECT (monitor), props[PROP_DESCRIPTION]);
|
||||
}
|
||||
|
||||
#define MM_PER_INCH 25.4
|
||||
|
||||
double
|
||||
gdk_monitor_get_dpi (GdkMonitor *monitor)
|
||||
{
|
||||
return MAX ((monitor->geometry.width * monitor->scale) / (monitor->width_mm / MM_PER_INCH),
|
||||
(monitor->geometry.height * monitor->scale) / (monitor->height_mm / MM_PER_INCH));
|
||||
}
|
||||
|
||||
@@ -76,6 +76,7 @@ void gdk_monitor_set_subpixel_layout (GdkMonitor *monitor,
|
||||
void gdk_monitor_invalidate (GdkMonitor *monitor);
|
||||
void gdk_monitor_set_description (GdkMonitor *monitor,
|
||||
const char *description);
|
||||
double gdk_monitor_get_dpi (GdkMonitor *monitor);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
+7
-18
@@ -98,9 +98,9 @@ gdk_rgba_free (GdkRGBA *rgba)
|
||||
* Returns: %TRUE if the @rgba is clear
|
||||
*/
|
||||
gboolean
|
||||
gdk_rgba_is_clear (const GdkRGBA *rgba)
|
||||
(gdk_rgba_is_clear) (const GdkRGBA *rgba)
|
||||
{
|
||||
return rgba->alpha < ((float) 0x00ff / (float) 0xffff);
|
||||
return _gdk_rgba_is_clear (rgba);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,9 +115,9 @@ gdk_rgba_is_clear (const GdkRGBA *rgba)
|
||||
* Returns: %TRUE if the @rgba is opaque
|
||||
*/
|
||||
gboolean
|
||||
gdk_rgba_is_opaque (const GdkRGBA *rgba)
|
||||
(gdk_rgba_is_opaque) (const GdkRGBA *rgba)
|
||||
{
|
||||
return rgba->alpha > ((float)0xff00 / (float)0xffff);
|
||||
return _gdk_rgba_is_opaque (rgba);
|
||||
}
|
||||
|
||||
#define SKIP_WHITESPACES(s) while (*(s) == ' ') (s)++;
|
||||
@@ -368,21 +368,10 @@ gdk_rgba_hash (gconstpointer p)
|
||||
* Returns: %TRUE if the two colors compare equal
|
||||
*/
|
||||
gboolean
|
||||
gdk_rgba_equal (gconstpointer p1,
|
||||
gconstpointer p2)
|
||||
(gdk_rgba_equal) (gconstpointer p1,
|
||||
gconstpointer p2)
|
||||
{
|
||||
const GdkRGBA *rgba1, *rgba2;
|
||||
|
||||
rgba1 = p1;
|
||||
rgba2 = p2;
|
||||
|
||||
if (rgba1->red == rgba2->red &&
|
||||
rgba1->green == rgba2->green &&
|
||||
rgba1->blue == rgba2->blue &&
|
||||
rgba1->alpha == rgba2->alpha)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
return _gdk_rgba_equal (p1, p2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,5 +43,34 @@
|
||||
gboolean gdk_rgba_parser_parse (GtkCssParser *parser,
|
||||
GdkRGBA *rgba);
|
||||
|
||||
#define gdk_rgba_is_clear(rgba) _gdk_rgba_is_clear (rgba)
|
||||
#define gdk_rgba_is_opaque(rgba) _gdk_rgba_is_opaque (rgba)
|
||||
#define gdk_rgba_equal(p1, p2) _gdk_rgba_equal (p1, p2)
|
||||
|
||||
static inline gboolean
|
||||
_gdk_rgba_is_clear (const GdkRGBA *rgba)
|
||||
{
|
||||
return rgba->alpha < ((float) 0x00ff / (float) 0xffff);
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
_gdk_rgba_is_opaque (const GdkRGBA *rgba)
|
||||
{
|
||||
return rgba->alpha > ((float)0xff00 / (float)0xffff);
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
_gdk_rgba_equal (gconstpointer p1,
|
||||
gconstpointer p2)
|
||||
{
|
||||
const GdkRGBA *rgba1 = p1;
|
||||
const GdkRGBA *rgba2 = p2;
|
||||
|
||||
return rgba1->red == rgba2->red &&
|
||||
rgba1->green == rgba2->green &&
|
||||
rgba1->blue == rgba2->blue &&
|
||||
rgba1->alpha == rgba2->alpha;
|
||||
}
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
+162
-13
@@ -48,6 +48,14 @@ gdk_subsurface_class_init (GdkSubsurfaceClass *class)
|
||||
object_class->finalize = gdk_subsurface_finalize;
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_subsurface_get_parent:
|
||||
* @subsurface: a `GdkSubsurface`
|
||||
*
|
||||
* Returns the parent surface of @subsurface.
|
||||
*
|
||||
* Returns: the parent surface
|
||||
*/
|
||||
GdkSurface *
|
||||
gdk_subsurface_get_parent (GdkSubsurface *subsurface)
|
||||
{
|
||||
@@ -108,17 +116,41 @@ insert_subsurface (GdkSubsurface *subsurface,
|
||||
}
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_subsurface_attach:
|
||||
* @subsurface: the `GdkSubsurface`
|
||||
* @texture: the texture to attach. This typically has to be a `GdkDmabufTexture`
|
||||
* @source: the source rectangle (i.e. the subset of the texture) to display
|
||||
* @dest: the dest rectangle, in application pixels, relative to the parent surface.
|
||||
* It must be integral in application and device pixels, or attaching will fail
|
||||
* @transform: the transform to apply to the texture contents before displaying
|
||||
* @background: (nullable): the background rectangle, in application pixels relative
|
||||
* to the parent surface. This tells GDK to put a black background of this
|
||||
* size below the subsurface. It must be integral in application and device pixels,
|
||||
* or attaching will fail
|
||||
* @above: whether the subsurface should be above its sibling
|
||||
* @sibling: (nullable): the sibling subsurface to stack relative to, or `NULL` to
|
||||
* stack relative to the parent surface
|
||||
*
|
||||
* Attaches content to a subsurface.
|
||||
*
|
||||
* This function takes all the necessary arguments to determine the subsurface
|
||||
* configuration, including its position, size, content, background and stacking.
|
||||
*
|
||||
* Returns: `TRUE` if the attaching succeeded
|
||||
*/
|
||||
gboolean
|
||||
gdk_subsurface_attach (GdkSubsurface *subsurface,
|
||||
GdkTexture *texture,
|
||||
const graphene_rect_t *source,
|
||||
const graphene_rect_t *dest,
|
||||
GdkTextureTransform transform,
|
||||
gboolean lightbox,
|
||||
const graphene_rect_t *background,
|
||||
gboolean above,
|
||||
GdkSubsurface *sibling)
|
||||
{
|
||||
GdkSurface *parent = subsurface->parent;
|
||||
gboolean result;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), FALSE);
|
||||
g_return_val_if_fail (GDK_IS_TEXTURE (texture), FALSE);
|
||||
@@ -132,6 +164,15 @@ gdk_subsurface_attach (GdkSubsurface *subsurface,
|
||||
g_return_val_if_fail (sibling == NULL || GDK_IS_SUBSURFACE (sibling), FALSE);
|
||||
g_return_val_if_fail (sibling == NULL || sibling->parent == subsurface->parent, FALSE);
|
||||
|
||||
result = GDK_SUBSURFACE_GET_CLASS (subsurface)->attach (subsurface,
|
||||
texture,
|
||||
source,
|
||||
dest,
|
||||
transform,
|
||||
background,
|
||||
above,
|
||||
sibling);
|
||||
|
||||
remove_subsurface (subsurface);
|
||||
|
||||
if (sibling)
|
||||
@@ -157,9 +198,17 @@ gdk_subsurface_attach (GdkSubsurface *subsurface,
|
||||
}
|
||||
}
|
||||
|
||||
return GDK_SUBSURFACE_GET_CLASS (subsurface)->attach (subsurface, texture, source, dest, transform, lightbox, above, sibling);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_subsurface_detach:
|
||||
* @subsurface: a `GdkSubsurface`
|
||||
*
|
||||
* Hides the subsurface.
|
||||
*
|
||||
* To show it again, you need to call gdk_subsurface_attach().
|
||||
*/
|
||||
void
|
||||
gdk_subsurface_detach (GdkSubsurface *subsurface)
|
||||
{
|
||||
@@ -170,6 +219,14 @@ gdk_subsurface_detach (GdkSubsurface *subsurface)
|
||||
GDK_SUBSURFACE_GET_CLASS (subsurface)->detach (subsurface);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_subsurface_get_texture:
|
||||
* @subsurface: a `GdkSubsurface`
|
||||
*
|
||||
* Gets the texture that is currently displayed by the subsurface.
|
||||
*
|
||||
* Returns: (nullable): the texture that is displayed
|
||||
*/
|
||||
GdkTexture *
|
||||
gdk_subsurface_get_texture (GdkSubsurface *subsurface)
|
||||
{
|
||||
@@ -178,34 +235,91 @@ gdk_subsurface_get_texture (GdkSubsurface *subsurface)
|
||||
return GDK_SUBSURFACE_GET_CLASS (subsurface)->get_texture (subsurface);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_subsurface_get_source_rect:
|
||||
* @subsurface: a `GdkSubsurface`
|
||||
* @rect: (out caller-allocates): return location for the rectangle
|
||||
*
|
||||
* Returns the source rect that was specified in the most recent
|
||||
* gdk_subsurface_attach() call for @subsurface.
|
||||
*/
|
||||
void
|
||||
gdk_subsurface_get_source (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *source)
|
||||
gdk_subsurface_get_source_rect (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *rect)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_SUBSURFACE (subsurface));
|
||||
g_return_if_fail (source != NULL);
|
||||
g_return_if_fail (rect != NULL);
|
||||
|
||||
GDK_SUBSURFACE_GET_CLASS (subsurface)->get_source (subsurface, source);
|
||||
GDK_SUBSURFACE_GET_CLASS (subsurface)->get_source_rect (subsurface, rect);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_subsurface_get_texture_rect:
|
||||
* @subsurface: a `GdkSubsurface`
|
||||
* @rect: (out caller-allocates): return location for the rectangle
|
||||
*
|
||||
* Returns the texture rect that was specified in the most recent
|
||||
* gdk_subsurface_attach() call for @subsurface.
|
||||
*/
|
||||
void
|
||||
gdk_subsurface_get_dest (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *dest)
|
||||
gdk_subsurface_get_texture_rect (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *rect)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_SUBSURFACE (subsurface));
|
||||
g_return_if_fail (dest != NULL);
|
||||
g_return_if_fail (rect != NULL);
|
||||
|
||||
GDK_SUBSURFACE_GET_CLASS (subsurface)->get_dest (subsurface, dest);
|
||||
GDK_SUBSURFACE_GET_CLASS (subsurface)->get_texture_rect (subsurface, rect);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_subsurface_is_above_parent:
|
||||
* @subsurface: a `GdkSubsurface`
|
||||
*
|
||||
* Returns whether the subsurface is above the parent surface
|
||||
* or below. Note that a subsurface can be above its parent
|
||||
* surface, and still be covered by sibling subsurfaces.
|
||||
*
|
||||
* Returns: `TRUE` if @subsurface is above its parent
|
||||
*/
|
||||
gboolean
|
||||
gdk_subsurface_is_above_parent (GdkSubsurface *subsurface)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), TRUE);
|
||||
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), FALSE);
|
||||
|
||||
return subsurface->above_parent;
|
||||
}
|
||||
|
||||
/*< private>
|
||||
* gdk_subsurface_get_sibling:
|
||||
* @subsurface: the `GdkSubsurface`
|
||||
* @above: whether to get the subsurface above
|
||||
*
|
||||
* Returns the subsurface above (or below) @subsurface in
|
||||
* the stacking order.
|
||||
*
|
||||
* Returns: the sibling, or `NULL` if there is none.
|
||||
*/
|
||||
GdkSubsurface *
|
||||
gdk_subsurface_get_sibling (GdkSubsurface *subsurface,
|
||||
gboolean above)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), NULL);
|
||||
|
||||
if (above)
|
||||
return subsurface->sibling_above;
|
||||
else
|
||||
return subsurface->sibling_below;
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_subsurface_get_transform:
|
||||
* @subsurface: a `GdkSubsurface`
|
||||
*
|
||||
* Returns the transform that was specified in the most recent call to
|
||||
* gdk_subsurface_attach() call for @subsurface.
|
||||
*
|
||||
* Returns: the transform
|
||||
*/
|
||||
GdkTextureTransform
|
||||
gdk_subsurface_get_transform (GdkSubsurface *subsurface)
|
||||
{
|
||||
@@ -214,10 +328,45 @@ gdk_subsurface_get_transform (GdkSubsurface *subsurface)
|
||||
return GDK_SUBSURFACE_GET_CLASS (subsurface)->get_transform (subsurface);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_subsurface_get_background_rect:
|
||||
* @subsurface: a `GdkSubsurface`
|
||||
* @rect: (out caller-allocates): return location for the rectangle
|
||||
*
|
||||
* Obtains the background rect that was specified in the most recent
|
||||
* gdk_subsurface_attach() call for @subsurface.
|
||||
*
|
||||
* Returns: `TRUE` if @subsurface has a background
|
||||
*/
|
||||
gboolean
|
||||
gdk_subsurface_get_lightbox (GdkSubsurface *subsurface)
|
||||
gdk_subsurface_get_background_rect (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *rect)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), FALSE);
|
||||
g_return_val_if_fail (rect != NULL, FALSE);
|
||||
|
||||
return GDK_SUBSURFACE_GET_CLASS (subsurface)->get_lightbox (subsurface);
|
||||
return GDK_SUBSURFACE_GET_CLASS (subsurface)->get_background_rect (subsurface, rect);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_subsurface_get_bounds:
|
||||
* @subsurface: a `GdkSubsurface`
|
||||
* @bounds: (out caller-allocates): return location for the bounds
|
||||
*
|
||||
* Returns the bounds of the subsurface.
|
||||
*
|
||||
* The bounds are the union of the texture and background rects.
|
||||
*/
|
||||
void
|
||||
gdk_subsurface_get_bounds (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *bounds)
|
||||
{
|
||||
graphene_rect_t background;
|
||||
|
||||
g_return_if_fail (GDK_IS_SUBSURFACE (subsurface));
|
||||
g_return_if_fail (bounds != NULL);
|
||||
|
||||
gdk_subsurface_get_texture_rect (subsurface, bounds);
|
||||
if (gdk_subsurface_get_background_rect (subsurface, &background))
|
||||
graphene_rect_union (bounds, &background, bounds);
|
||||
}
|
||||
|
||||
+41
-36
@@ -62,48 +62,53 @@ struct _GdkSubsurfaceClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
gboolean (* attach) (GdkSubsurface *subsurface,
|
||||
GdkTexture *texture,
|
||||
const graphene_rect_t *source,
|
||||
const graphene_rect_t *dest,
|
||||
GdkTextureTransform transform,
|
||||
gboolean lightbox,
|
||||
gboolean above,
|
||||
GdkSubsurface *sibling);
|
||||
void (* detach) (GdkSubsurface *subsurface);
|
||||
GdkTexture * (* get_texture) (GdkSubsurface *subsurface);
|
||||
void (* get_source) (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *source);
|
||||
void (* get_dest) (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *dest);
|
||||
gboolean (* attach) (GdkSubsurface *subsurface,
|
||||
GdkTexture *texture,
|
||||
const graphene_rect_t *source,
|
||||
const graphene_rect_t *dest,
|
||||
GdkTextureTransform transform,
|
||||
const graphene_rect_t *bg,
|
||||
gboolean above,
|
||||
GdkSubsurface *sibling);
|
||||
void (* detach) (GdkSubsurface *subsurface);
|
||||
GdkTexture * (* get_texture) (GdkSubsurface *subsurface);
|
||||
void (* get_source_rect) (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *rect);
|
||||
void (* get_texture_rect) (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *rect);
|
||||
GdkTextureTransform
|
||||
(* get_transform) (GdkSubsurface *subsurface);
|
||||
gboolean (* get_lightbox) (GdkSubsurface *subsurface);
|
||||
(* get_transform) (GdkSubsurface *subsurface);
|
||||
gboolean (* get_background_rect) (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *rect);
|
||||
};
|
||||
|
||||
GType gdk_subsurface_get_type (void) G_GNUC_CONST;
|
||||
GType gdk_subsurface_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GdkSurface * gdk_subsurface_get_parent (GdkSubsurface *subsurface);
|
||||
GdkSurface * gdk_subsurface_get_parent (GdkSubsurface *subsurface);
|
||||
|
||||
gboolean gdk_subsurface_attach (GdkSubsurface *subsurface,
|
||||
GdkTexture *texture,
|
||||
const graphene_rect_t *source,
|
||||
const graphene_rect_t *dest,
|
||||
GdkTextureTransform transform,
|
||||
gboolean lightbox,
|
||||
gboolean above,
|
||||
GdkSubsurface *sibling);
|
||||
void gdk_subsurface_detach (GdkSubsurface *subsurface);
|
||||
GdkTexture * gdk_subsurface_get_texture (GdkSubsurface *subsurface);
|
||||
void gdk_subsurface_get_source (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *source);
|
||||
void gdk_subsurface_get_dest (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *dest);
|
||||
gboolean gdk_subsurface_is_above_parent (GdkSubsurface *subsurface);
|
||||
gboolean gdk_subsurface_attach (GdkSubsurface *subsurface,
|
||||
GdkTexture *texture,
|
||||
const graphene_rect_t *source,
|
||||
const graphene_rect_t *dest,
|
||||
GdkTextureTransform transform,
|
||||
const graphene_rect_t *background,
|
||||
gboolean above,
|
||||
GdkSubsurface *sibling);
|
||||
void gdk_subsurface_detach (GdkSubsurface *subsurface);
|
||||
GdkTexture * gdk_subsurface_get_texture (GdkSubsurface *subsurface);
|
||||
void gdk_subsurface_get_source_rect (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *rect);
|
||||
void gdk_subsurface_get_texture_rect (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *rect);
|
||||
gboolean gdk_subsurface_is_above_parent (GdkSubsurface *subsurface);
|
||||
GdkSubsurface * gdk_subsurface_get_sibling (GdkSubsurface *subsurface,
|
||||
gboolean above);
|
||||
GdkTextureTransform
|
||||
gdk_subsurface_get_transform (GdkSubsurface *subsurface);
|
||||
gboolean gdk_subsurface_get_lightbox (GdkSubsurface *subsurface);
|
||||
|
||||
gdk_subsurface_get_transform (GdkSubsurface *subsurface);
|
||||
gboolean gdk_subsurface_get_background_rect (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *rect);
|
||||
void gdk_subsurface_get_bounds (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *bounds);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -57,6 +57,9 @@ static const GdkDebugKey gsk_vulkan_feature_keys[] = {
|
||||
*
|
||||
* Support for `GdkVulkanContext` is platform-specific and context creation
|
||||
* can fail, returning %NULL context.
|
||||
*
|
||||
* Deprecated: 4.14: GTK does not expose any Vulkan internals. This
|
||||
* struct is a leftover that was accidentally exposed.
|
||||
*/
|
||||
|
||||
typedef struct _GdkVulkanContextPrivate GdkVulkanContextPrivate;
|
||||
|
||||
@@ -161,7 +161,8 @@ void _gdk_macos_display_send_event (GdkMacosDisp
|
||||
void _gdk_macos_display_warp_pointer (GdkMacosDisplay *self,
|
||||
int x,
|
||||
int y);
|
||||
NSEvent *_gdk_macos_display_get_nsevent (GdkEvent *event);
|
||||
NSEvent *_gdk_macos_display_get_matching_nsevent (GdkEvent *event);
|
||||
NSEvent *_gdk_macos_display_get_exact_nsevent (GdkEvent *event);
|
||||
NSEvent *_gdk_macos_display_get_last_nsevent (void);
|
||||
GdkDrag *_gdk_macos_display_find_drag (GdkMacosDisplay *self,
|
||||
NSInteger sequence_number);
|
||||
|
||||
@@ -77,6 +77,9 @@ gdk_macos_display_get_setting (GdkDisplay *display,
|
||||
const char *setting,
|
||||
GValue *value)
|
||||
{
|
||||
if (gdk_display_get_debug_flags (display) & GDK_DEBUG_DEFAULT_SETTINGS)
|
||||
return FALSE;
|
||||
|
||||
return _gdk_macos_display_get_setting (GDK_MACOS_DISPLAY (display), setting, value);
|
||||
}
|
||||
|
||||
@@ -991,17 +994,41 @@ _gdk_macos_display_warp_pointer (GdkMacosDisplay *self,
|
||||
CGWarpMouseCursorPosition ((CGPoint) { x, y });
|
||||
}
|
||||
|
||||
/* Find the matching `NSEvent` for an `GdkEvent`. This function
|
||||
* return the `NSEvent`, also for rewritten `GdkEvent`'s.
|
||||
*/
|
||||
NSEvent *
|
||||
_gdk_macos_display_get_nsevent (GdkEvent *event)
|
||||
_gdk_macos_display_get_matching_nsevent (GdkEvent *event)
|
||||
{
|
||||
for (const GList *iter = event_map.head; iter; iter = iter->next)
|
||||
for (GList *iter = event_map.head; iter; iter = iter->next)
|
||||
{
|
||||
const GdkToNSEventMap *map = iter->data;
|
||||
GdkToNSEventMap *map = iter->data;
|
||||
|
||||
if (map->gdk_event->event_type == event->event_type &&
|
||||
map->gdk_event->device == event->device &&
|
||||
map->gdk_event->time == event->time)
|
||||
return map->nsevent;
|
||||
{
|
||||
return map->nsevent;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Find the matching `NSEvent` for the original `GdkEvent`.
|
||||
* If an event was rewritten, it returns `NULL`.
|
||||
*/
|
||||
NSEvent *
|
||||
_gdk_macos_display_get_exact_nsevent (GdkEvent *event)
|
||||
{
|
||||
for (GList *iter = event_map.head; iter; iter = iter->next)
|
||||
{
|
||||
GdkToNSEventMap *map = iter->data;
|
||||
|
||||
if (map->gdk_event == event)
|
||||
{
|
||||
return map->nsevent;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
@@ -738,7 +738,7 @@ gdk_macos_event_source_dispatch (GSource *source,
|
||||
|
||||
if (!handled)
|
||||
{
|
||||
NSEvent *nsevent = _gdk_macos_display_get_nsevent (event);
|
||||
NSEvent *nsevent = _gdk_macos_display_get_exact_nsevent (event);
|
||||
if (nsevent != NULL)
|
||||
[NSApp sendEvent: nsevent];
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ gdk_macos_deps = [
|
||||
libgdk_c_args += ['-xobjective-c']
|
||||
|
||||
libgdk_macos = static_library('gdk-macos',
|
||||
gdk_macos_sources, gdkconfig, gdkenum_h,
|
||||
sources: [ gdk_macos_sources, gdk_gen_headers ],
|
||||
include_directories: [ confinc, gdkinc, ],
|
||||
c_args: [ libgdk_c_args, common_cflags, ],
|
||||
link_with: [],
|
||||
|
||||
+9
-3
@@ -202,7 +202,13 @@ gdkwayland_inc = include_directories('wayland')
|
||||
wlinc = include_directories('.')
|
||||
win32rcinc = include_directories('win32/rc')
|
||||
|
||||
gdk_gen_headers = [gdkenum_h, gdkmarshal_h, gdkconfig, gdkversionmacros_h, gdk_visibility_h]
|
||||
gdk_gen_headers = [
|
||||
gdkenum_h,
|
||||
gdkmarshal_h,
|
||||
gdkconfig,
|
||||
gdkversionmacros_h,
|
||||
gdk_visibility_h,
|
||||
]
|
||||
|
||||
gdk_deps = [
|
||||
libm,
|
||||
@@ -278,7 +284,7 @@ if gdk_backends.length() == 0
|
||||
endif
|
||||
|
||||
libgdk = static_library('gdk',
|
||||
sources: [gdk_sources, gdk_backends_gen_headers, gdkconfig],
|
||||
sources: [gdk_sources, gdk_backends_gen_headers, gdk_gen_headers],
|
||||
dependencies: gdk_deps + [libgtk_css_dep],
|
||||
link_with: [libgtk_css],
|
||||
include_directories: [confinc, gdkx11_inc, wlinc],
|
||||
@@ -290,7 +296,7 @@ libgdk = static_library('gdk',
|
||||
# list the dependencies and generated headers and such, for use in the
|
||||
# "public" libgtk_dep used by internal executables.
|
||||
libgdk_dep = declare_dependency(
|
||||
sources: ['gdk.h', gdkconfig, gdkenum_h],
|
||||
sources: ['gdk.h', gdk_gen_headers],
|
||||
include_directories: [confinc, gdkx11_inc, wlinc],
|
||||
dependencies: gdk_deps + [libgtk_css_dep],
|
||||
)
|
||||
|
||||
@@ -198,17 +198,8 @@ static void
|
||||
gdk_wayland_cairo_context_empty_frame (GdkDrawContext *draw_context)
|
||||
{
|
||||
GdkSurface *surface = gdk_draw_context_get_surface (draw_context);
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
|
||||
if (!impl->has_pending_subsurface_commits)
|
||||
return;
|
||||
|
||||
gdk_wayland_surface_sync (surface);
|
||||
gdk_wayland_surface_request_frame (surface);
|
||||
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
|
||||
gdk_wayland_surface_commit (surface);
|
||||
gdk_wayland_surface_notify_committed (surface);
|
||||
gdk_wayland_surface_handle_empty_frame (surface);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -105,6 +105,9 @@
|
||||
#endif
|
||||
|
||||
static void _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland);
|
||||
static void _gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
|
||||
const char *name,
|
||||
int size);
|
||||
|
||||
G_DEFINE_TYPE (GdkWaylandDisplay, gdk_wayland_display, GDK_TYPE_DISPLAY)
|
||||
|
||||
@@ -310,7 +313,9 @@ linux_dmabuf_main_device (void *data,
|
||||
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1,
|
||||
struct wl_array *device)
|
||||
{
|
||||
dev_t dev G_GNUC_UNUSED = *(dev_t *)device->data;
|
||||
dev_t dev G_GNUC_UNUSED;
|
||||
|
||||
memcpy (&dev, device->data, sizeof (dev_t));
|
||||
|
||||
GDK_DEBUG (MISC, "got dmabuf main device: %u %u", major (dev), minor (dev));
|
||||
}
|
||||
@@ -327,7 +332,9 @@ linux_dmabuf_tranche_target_device (void *data,
|
||||
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1,
|
||||
struct wl_array *device)
|
||||
{
|
||||
dev_t dev G_GNUC_UNUSED = *(dev_t *)device->data;
|
||||
dev_t dev G_GNUC_UNUSED;
|
||||
|
||||
memcpy (&dev, device->data, sizeof (dev_t));
|
||||
|
||||
GDK_DEBUG (MISC, "got dmabuf tranche target device: %u %u", major (dev), minor (dev));
|
||||
}
|
||||
@@ -437,7 +444,7 @@ gdk_registry_handle_global (void *data,
|
||||
{
|
||||
display_wayland->compositor =
|
||||
wl_registry_bind (display_wayland->wl_registry, id,
|
||||
&wl_compositor_interface, MIN (version, 5));
|
||||
&wl_compositor_interface, MIN (version, 6));
|
||||
}
|
||||
else if (strcmp (interface, "wl_shm") == 0)
|
||||
{
|
||||
@@ -606,7 +613,13 @@ gdk_registry_handle_global (void *data,
|
||||
&wp_presentation_interface,
|
||||
MIN (version, 1));
|
||||
}
|
||||
|
||||
else if (strcmp (interface, wp_single_pixel_buffer_manager_v1_interface.name) == 0)
|
||||
{
|
||||
display_wayland->single_pixel_buffer =
|
||||
wl_registry_bind (display_wayland->wl_registry, id,
|
||||
&wp_single_pixel_buffer_manager_v1_interface,
|
||||
MIN (version, 1));
|
||||
}
|
||||
|
||||
g_hash_table_insert (display_wayland->known_globals,
|
||||
GUINT_TO_POINTER (id), g_strdup (interface));
|
||||
@@ -817,6 +830,7 @@ gdk_wayland_display_dispose (GObject *object)
|
||||
g_clear_pointer (&display_wayland->fractional_scale, wp_fractional_scale_manager_v1_destroy);
|
||||
g_clear_pointer (&display_wayland->viewporter, wp_viewporter_destroy);
|
||||
g_clear_pointer (&display_wayland->presentation, wp_presentation_destroy);
|
||||
g_clear_pointer (&display_wayland->single_pixel_buffer, wp_single_pixel_buffer_manager_v1_destroy);
|
||||
g_clear_pointer (&display_wayland->linux_dmabuf, zwp_linux_dmabuf_v1_destroy);
|
||||
g_clear_pointer (&display_wayland->linux_dmabuf_feedback, zwp_linux_dmabuf_feedback_v1_destroy);
|
||||
if (display_wayland->linux_dmabuf_formats)
|
||||
@@ -1122,7 +1136,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
display_class->get_monitors = gdk_wayland_display_get_monitors;
|
||||
display_class->get_monitor_at_surface = gdk_wayland_display_get_monitor_at_surface;
|
||||
display_class->get_setting = gdk_wayland_display_get_setting;
|
||||
display_class->set_cursor_theme = gdk_wayland_display_set_cursor_theme;
|
||||
display_class->set_cursor_theme = _gdk_wayland_display_set_cursor_theme;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1195,11 +1209,22 @@ get_cursor_theme (GdkWaylandDisplay *display_wayland,
|
||||
* @size: the size to use for cursors
|
||||
*
|
||||
* Sets the cursor theme for the given @display.
|
||||
*
|
||||
* Deprecated: 4.16: Use the cursor-related properties of
|
||||
* [GtkSettings](../gtk4/class.Settings.html) to set the cursor theme
|
||||
*/
|
||||
void
|
||||
gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
|
||||
const char *name,
|
||||
int size)
|
||||
{
|
||||
_gdk_wayland_display_set_cursor_theme (display, name, size);
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
|
||||
const char *name,
|
||||
int size)
|
||||
{
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY(display);
|
||||
struct wl_cursor_theme *theme;
|
||||
@@ -1268,7 +1293,7 @@ _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland)
|
||||
else
|
||||
name = "default";
|
||||
|
||||
gdk_wayland_display_set_cursor_theme (GDK_DISPLAY (display_wayland), name, size);
|
||||
_gdk_wayland_display_set_cursor_theme (GDK_DISPLAY (display_wayland), name, size);
|
||||
g_value_unset (&v);
|
||||
|
||||
gdk_profiler_end_mark (before, "Wayland cursor theme load", NULL);
|
||||
@@ -1804,6 +1829,7 @@ static TranslationEntry translations[] = {
|
||||
{ FALSE, "org.gnome.desktop.interface", "font-hinting", "gtk-xft-hinting", G_TYPE_NONE, { .i = 1 } },
|
||||
{ FALSE, "org.gnome.desktop.interface", "font-hinting", "gtk-xft-hintstyle", G_TYPE_NONE, { .i = 1 } },
|
||||
{ FALSE, "org.gnome.desktop.interface", "font-rgba-order", "gtk-xft-rgba", G_TYPE_NONE, { .i = 0 } },
|
||||
{ FALSE, "org.gnome.desktop.interface", "font-rendering", "gtk-font-rendering", G_TYPE_ENUM, { .i = 0 } },
|
||||
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "antialiasing", "gtk-xft-antialias", G_TYPE_NONE, { .i = 1 } },
|
||||
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "hinting", "gtk-xft-hinting", G_TYPE_NONE, { .i = 1 } },
|
||||
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "hinting", "gtk-xft-hintstyle", G_TYPE_NONE, { .i = 1 } },
|
||||
@@ -1895,6 +1921,7 @@ apply_portal_setting (TranslationEntry *entry,
|
||||
entry->fallback.s = g_intern_string (g_variant_get_string (value, NULL));
|
||||
break;
|
||||
case G_TYPE_INT:
|
||||
case G_TYPE_ENUM:
|
||||
entry->fallback.i = g_variant_get_int32 (value);
|
||||
break;
|
||||
case G_TYPE_BOOLEAN:
|
||||
@@ -2144,6 +2171,9 @@ set_value_from_entry (GdkDisplay *display,
|
||||
case G_TYPE_BOOLEAN:
|
||||
g_value_set_boolean (value, entry->fallback.b);
|
||||
break;
|
||||
case G_TYPE_ENUM:
|
||||
g_value_set_enum (value, entry->fallback.i);
|
||||
break;
|
||||
case G_TYPE_NONE:
|
||||
if (g_str_equal (entry->setting, "gtk-fontconfig-timestamp"))
|
||||
g_value_set_uint (value, (guint)entry->fallback.i);
|
||||
@@ -2194,6 +2224,11 @@ set_value_from_entry (GdkDisplay *display,
|
||||
? g_settings_get_boolean (settings, entry->key)
|
||||
: entry->fallback.b);
|
||||
break;
|
||||
case G_TYPE_ENUM:
|
||||
g_value_set_enum (value, settings && entry->valid
|
||||
? g_settings_get_enum (settings, entry->key)
|
||||
: entry->fallback.i);
|
||||
break;
|
||||
case G_TYPE_NONE:
|
||||
if (g_str_equal (entry->setting, "gtk-fontconfig-timestamp"))
|
||||
g_value_set_uint (value, (guint)entry->fallback.i);
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <gdk/wayland/fractional-scale-v1-client-protocol.h>
|
||||
#include <gdk/wayland/viewporter-client-protocol.h>
|
||||
#include <gdk/wayland/presentation-time-client-protocol.h>
|
||||
#include <gdk/wayland/single-pixel-buffer-v1-client-protocol.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <gdk/gdkkeys.h>
|
||||
@@ -127,6 +128,7 @@ struct _GdkWaylandDisplay
|
||||
struct wp_fractional_scale_manager_v1 *fractional_scale;
|
||||
struct wp_viewporter *viewporter;
|
||||
struct wp_presentation *presentation;
|
||||
struct wp_single_pixel_buffer_manager_v1 *single_pixel_buffer;
|
||||
|
||||
GList *async_roundtrips;
|
||||
|
||||
|
||||
@@ -88,14 +88,7 @@ gdk_wayland_gl_context_empty_frame (GdkDrawContext *draw_context)
|
||||
{
|
||||
GdkSurface *surface = gdk_draw_context_get_surface (draw_context);
|
||||
|
||||
if (gdk_wayland_surface_needs_commit (surface))
|
||||
{
|
||||
gdk_wayland_surface_sync (surface);
|
||||
gdk_wayland_surface_request_frame (surface);
|
||||
|
||||
gdk_wayland_surface_commit (surface);
|
||||
gdk_wayland_surface_notify_committed (surface);
|
||||
}
|
||||
gdk_wayland_surface_handle_empty_frame (surface);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -131,7 +131,7 @@ guint _gdk_wayland_cursor_get_next_image_index (GdkWaylandDisplay *display,
|
||||
guint *next_image_delay);
|
||||
|
||||
void gdk_wayland_surface_sync (GdkSurface *surface);
|
||||
gboolean gdk_wayland_surface_needs_commit (GdkSurface *surface);
|
||||
void gdk_wayland_surface_handle_empty_frame (GdkSurface *surface);
|
||||
void gdk_wayland_surface_commit (GdkSurface *surface);
|
||||
void gdk_wayland_surface_notify_committed (GdkSurface *surface);
|
||||
void gdk_wayland_surface_request_frame (GdkSurface *surface);
|
||||
|
||||
@@ -781,8 +781,8 @@ pointer_handle_motion (void *data,
|
||||
{
|
||||
double x, y;
|
||||
gdk_event_get_position (event, &x, &y);
|
||||
g_message ("motion %f %f, seat %p state %d",
|
||||
x, y, seat, gdk_event_get_modifier_state (event));
|
||||
gdk_debug_message ("motion %f %f, seat %p state %d",
|
||||
x, y, seat, gdk_event_get_modifier_state (event));
|
||||
}
|
||||
|
||||
if (wl_seat_get_version (seat->wl_seat) < WL_POINTER_HAS_FRAME)
|
||||
@@ -1664,7 +1664,7 @@ touch_handle_down (void *data,
|
||||
{
|
||||
double xx, yy;
|
||||
gdk_event_get_position (event, &xx, &yy);
|
||||
g_message ("touch begin %f %f", xx, yy);
|
||||
gdk_debug_message ("touch begin %f %f", xx, yy);
|
||||
}
|
||||
|
||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||
@@ -1699,7 +1699,7 @@ touch_handle_up (void *data,
|
||||
{
|
||||
double x, y;
|
||||
gdk_event_get_position (event, &x, &y);
|
||||
g_message ("touch end %f %f", x, y);
|
||||
gdk_debug_message ("touch end %f %f", x, y);
|
||||
}
|
||||
|
||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||
@@ -1747,7 +1747,7 @@ touch_handle_motion (void *data,
|
||||
{
|
||||
double xx, yy;
|
||||
gdk_event_get_position (event, &xx, &yy);
|
||||
g_message ("touch update %f %f", xx, yy);
|
||||
gdk_debug_message ("touch update %f %f", xx, yy);
|
||||
}
|
||||
|
||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||
@@ -1841,9 +1841,9 @@ emit_gesture_swipe_event (GdkWaylandSeat *seat,
|
||||
{
|
||||
double x, y;
|
||||
gdk_event_get_position (event, &x, &y);
|
||||
g_message ("swipe event %d, coords: %f %f, seat %p state %d",
|
||||
gdk_event_get_event_type (event), x, y, seat,
|
||||
gdk_event_get_modifier_state (event));
|
||||
gdk_debug_message ("swipe event %d, coords: %f %f, seat %p state %d",
|
||||
gdk_event_get_event_type (event), x, y, seat,
|
||||
gdk_event_get_modifier_state (event));
|
||||
}
|
||||
|
||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||
@@ -1936,10 +1936,10 @@ emit_gesture_pinch_event (GdkWaylandSeat *seat,
|
||||
{
|
||||
double x, y;
|
||||
gdk_event_get_position (event, &x, &y);
|
||||
g_message ("pinch event %d, coords: %f %f, seat %p state %d",
|
||||
gdk_event_get_event_type (event),
|
||||
x, y, seat,
|
||||
gdk_event_get_modifier_state (event));
|
||||
gdk_debug_message ("pinch event %d, coords: %f %f, seat %p state %d",
|
||||
gdk_event_get_event_type (event),
|
||||
x, y, seat,
|
||||
gdk_event_get_modifier_state (event));
|
||||
}
|
||||
|
||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||
@@ -2030,10 +2030,10 @@ emit_gesture_hold_event (GdkWaylandSeat *seat,
|
||||
{
|
||||
double x, y;
|
||||
gdk_event_get_position (event, &x, &y);
|
||||
g_message ("hold event %d, coords: %f %f, seat %p state %d",
|
||||
gdk_event_get_event_type (event),
|
||||
x, y, seat,
|
||||
gdk_event_get_modifier_state (event));
|
||||
gdk_debug_message ("hold event %d, coords: %f %f, seat %p state %d",
|
||||
gdk_event_get_event_type (event),
|
||||
x, y, seat,
|
||||
gdk_event_get_modifier_state (event));
|
||||
}
|
||||
|
||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||
|
||||
@@ -25,11 +25,16 @@ struct _GdkWaylandSubsurface
|
||||
cairo_rectangle_int_t dest;
|
||||
graphene_rect_t source;
|
||||
enum wl_output_transform transform;
|
||||
gboolean lightbox;
|
||||
|
||||
struct wl_region *opaque_region;
|
||||
|
||||
struct wl_callback *frame_callback;
|
||||
|
||||
struct wl_surface *bg_surface;
|
||||
struct wl_subsurface *bg_subsurface;
|
||||
struct wp_viewport *bg_viewport;
|
||||
cairo_rectangle_int_t bg_rect;
|
||||
gboolean bg_attached;
|
||||
};
|
||||
|
||||
struct _GdkWaylandSubsurfaceClass
|
||||
|
||||
+404
-107
@@ -25,6 +25,8 @@
|
||||
#include "gdkdmabuftextureprivate.h"
|
||||
#include "gdksurface-wayland-private.h"
|
||||
#include "gdksubsurfaceprivate.h"
|
||||
#include "gdkdebugprivate.h"
|
||||
#include "gsk/gskrectprivate.h"
|
||||
|
||||
#include "linux-dmabuf-unstable-v1-client-protocol.h"
|
||||
|
||||
@@ -46,11 +48,55 @@ gdk_wayland_subsurface_finalize (GObject *object)
|
||||
g_clear_pointer (&self->viewport, wp_viewport_destroy);
|
||||
g_clear_pointer (&self->subsurface, wl_subsurface_destroy);
|
||||
g_clear_pointer (&self->surface, wl_surface_destroy);
|
||||
g_clear_pointer (&self->subsurface, wl_subsurface_destroy);
|
||||
g_clear_pointer (&self->bg_viewport, wp_viewport_destroy);
|
||||
g_clear_pointer (&self->bg_subsurface, wl_subsurface_destroy);
|
||||
g_clear_pointer (&self->bg_surface, wl_surface_destroy);
|
||||
|
||||
G_OBJECT_CLASS (gdk_wayland_subsurface_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
shm_buffer_release (void *data,
|
||||
struct wl_buffer *buffer)
|
||||
{
|
||||
cairo_surface_t *surface = data;
|
||||
|
||||
/* Note: the wl_buffer is destroyed as cairo user data */
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
|
||||
static const struct wl_buffer_listener shm_buffer_listener = {
|
||||
shm_buffer_release,
|
||||
};
|
||||
|
||||
static struct wl_buffer *
|
||||
get_shm_wl_buffer (GdkWaylandSubsurface *self,
|
||||
GdkTexture *texture)
|
||||
{
|
||||
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (GDK_SUBSURFACE (self)->parent));
|
||||
int width, height;
|
||||
cairo_surface_t *surface;
|
||||
GdkTextureDownloader *downloader;
|
||||
struct wl_buffer *buffer;
|
||||
|
||||
width = gdk_texture_get_width (texture);
|
||||
height = gdk_texture_get_height (texture);
|
||||
surface = gdk_wayland_display_create_shm_surface (display, width, height, &GDK_FRACTIONAL_SCALE_INIT_INT (1));
|
||||
|
||||
downloader = gdk_texture_downloader_new (texture);
|
||||
|
||||
gdk_texture_downloader_download_into (downloader,
|
||||
cairo_image_surface_get_data (surface),
|
||||
cairo_image_surface_get_stride (surface));
|
||||
|
||||
gdk_texture_downloader_free (downloader);
|
||||
|
||||
buffer = _gdk_wayland_shm_surface_get_wl_buffer (surface);
|
||||
wl_buffer_add_listener (buffer, &shm_buffer_listener, surface);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static void
|
||||
dmabuf_buffer_release (void *data,
|
||||
struct wl_buffer *buffer)
|
||||
@@ -97,8 +143,8 @@ static const struct zwp_linux_buffer_params_v1_listener params_listener = {
|
||||
};
|
||||
|
||||
static struct wl_buffer *
|
||||
get_wl_buffer (GdkWaylandSubsurface *self,
|
||||
GdkTexture *texture)
|
||||
get_dmabuf_wl_buffer (GdkWaylandSubsurface *self,
|
||||
GdkTexture *texture)
|
||||
{
|
||||
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (GDK_SUBSURFACE (self)->parent));
|
||||
const GdkDmabuf *dmabuf;
|
||||
@@ -149,6 +195,52 @@ get_wl_buffer (GdkWaylandSubsurface *self,
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static struct wl_buffer *
|
||||
get_wl_buffer (GdkWaylandSubsurface *self,
|
||||
GdkTexture *texture)
|
||||
{
|
||||
GdkDisplay *display = gdk_surface_get_display (GDK_SUBSURFACE (self)->parent);
|
||||
struct wl_buffer *buffer = NULL;
|
||||
|
||||
if (GDK_IS_DMABUF_TEXTURE (texture))
|
||||
buffer = get_dmabuf_wl_buffer (self, texture);
|
||||
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (display, FORCE_OFFLOAD))
|
||||
{
|
||||
if (!buffer)
|
||||
buffer = get_shm_wl_buffer (self, texture);
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static void
|
||||
sp_buffer_release (void *data,
|
||||
struct wl_buffer *buffer)
|
||||
{
|
||||
wl_buffer_destroy (buffer);
|
||||
}
|
||||
|
||||
static const struct wl_buffer_listener sp_buffer_listener = {
|
||||
sp_buffer_release,
|
||||
};
|
||||
|
||||
static struct wl_buffer *
|
||||
get_sp_buffer (GdkWaylandSubsurface *self)
|
||||
{
|
||||
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (GDK_SUBSURFACE (self)->parent));
|
||||
struct wl_buffer *buffer = NULL;
|
||||
|
||||
if (display->single_pixel_buffer)
|
||||
buffer = wp_single_pixel_buffer_manager_v1_create_u32_rgba_buffer (display->single_pixel_buffer,
|
||||
0, 0, 0, 0xffffffffU);
|
||||
|
||||
if (buffer)
|
||||
wl_buffer_add_listener (buffer, &sp_buffer_listener, self);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static inline enum wl_output_transform
|
||||
gdk_texture_transform_to_wl (GdkTextureTransform transform)
|
||||
{
|
||||
@@ -161,25 +253,80 @@ wl_output_transform_to_gdk (enum wl_output_transform transform)
|
||||
return (GdkTextureTransform) transform;
|
||||
}
|
||||
|
||||
static void
|
||||
ensure_bg_surface (GdkWaylandSubsurface *self)
|
||||
{
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (GDK_SUBSURFACE (self)->parent);
|
||||
GdkDisplay *display = gdk_surface_get_display (GDK_SUBSURFACE (self)->parent);
|
||||
GdkWaylandDisplay *disp = GDK_WAYLAND_DISPLAY (display);
|
||||
struct wl_region *region;
|
||||
|
||||
if (self->bg_surface)
|
||||
return;
|
||||
|
||||
self->bg_surface = wl_compositor_create_surface (disp->compositor);
|
||||
self->bg_subsurface = wl_subcompositor_get_subsurface (disp->subcompositor,
|
||||
self->bg_surface,
|
||||
impl->display_server.wl_surface);
|
||||
self->bg_viewport = wp_viewporter_get_viewport (disp->viewporter, self->bg_surface);
|
||||
|
||||
/* We are opaque */
|
||||
wl_surface_set_opaque_region (self->bg_surface, self->opaque_region);
|
||||
|
||||
/* No input, please */
|
||||
region = wl_compositor_create_region (disp->compositor);
|
||||
wl_surface_set_input_region (self->bg_surface, region);
|
||||
wl_region_destroy (region);
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
scaled_rect_is_integral (const graphene_rect_t *rect,
|
||||
float scale,
|
||||
graphene_rect_t *device_rect)
|
||||
{
|
||||
cairo_rectangle_int_t device_int;
|
||||
|
||||
gsk_rect_scale (rect, scale, scale, device_rect);
|
||||
|
||||
device_int.x = device_rect->origin.x;
|
||||
device_int.y = device_rect->origin.y;
|
||||
device_int.width = device_rect->size.width;
|
||||
device_int.height = device_rect->size.height;
|
||||
|
||||
return device_int.x == device_rect->origin.x &&
|
||||
device_int.y == device_rect->origin.y &&
|
||||
device_int.width == device_rect->size.width &&
|
||||
device_int.height == device_rect->size.height;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
||||
GdkTexture *texture,
|
||||
const graphene_rect_t *source,
|
||||
const graphene_rect_t *dest,
|
||||
GdkTextureTransform transform,
|
||||
const graphene_rect_t *background,
|
||||
gboolean above,
|
||||
gboolean lightbox,
|
||||
GdkSubsurface *sibling)
|
||||
{
|
||||
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
|
||||
GdkWaylandSurface *parent = GDK_WAYLAND_SURFACE (sub->parent);
|
||||
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (sub->parent));
|
||||
struct wl_buffer *buffer = NULL;
|
||||
gboolean result = FALSE;
|
||||
GdkWaylandSubsurface *sib = sibling ? GDK_WAYLAND_SUBSURFACE (sibling) : NULL;
|
||||
gboolean will_be_above;
|
||||
double scale;
|
||||
graphene_rect_t device_rect;
|
||||
cairo_rectangle_int_t device_dest;
|
||||
gboolean has_background;
|
||||
enum wl_output_transform tf;
|
||||
gboolean dest_changed = FALSE;
|
||||
gboolean source_changed = FALSE;
|
||||
gboolean transform_changed = FALSE;
|
||||
gboolean stacking_changed = FALSE;
|
||||
gboolean needs_commit = FALSE;
|
||||
gboolean background_changed = FALSE;
|
||||
gboolean needs_bg_commit = FALSE;
|
||||
|
||||
if (sibling)
|
||||
will_be_above = sibling->above_parent;
|
||||
@@ -192,72 +339,133 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
self->dest.x = dest->origin.x;
|
||||
self->dest.y = dest->origin.y;
|
||||
self->dest.width = dest->size.width;
|
||||
self->dest.height = dest->size.height;
|
||||
|
||||
self->source.origin.x = source->origin.x;
|
||||
self->source.origin.y = source->origin.y;
|
||||
self->source.size.width = source->size.width;
|
||||
self->source.size.height = source->size.height;
|
||||
|
||||
self->transform = gdk_texture_transform_to_wl (transform);
|
||||
self->lightbox = lightbox;
|
||||
|
||||
scale = gdk_fractional_scale_to_double (&parent->scale);
|
||||
|
||||
device_rect.origin.x = dest->origin.x * scale;
|
||||
device_rect.origin.y = dest->origin.y * scale;
|
||||
device_rect.size.width = dest->size.width * scale;
|
||||
device_rect.size.height = dest->size.height * scale;
|
||||
|
||||
device_dest.x = device_rect.origin.x;
|
||||
device_dest.y = device_rect.origin.y;
|
||||
device_dest.width = device_rect.size.width;
|
||||
device_dest.height = device_rect.size.height;
|
||||
|
||||
if (self->dest.x != dest->origin.x ||
|
||||
self->dest.y != dest->origin.y ||
|
||||
self->dest.width != dest->size.width ||
|
||||
self->dest.height != dest->size.height)
|
||||
{
|
||||
self->dest.x = dest->origin.x;
|
||||
self->dest.y = dest->origin.y;
|
||||
self->dest.width = dest->size.width;
|
||||
self->dest.height = dest->size.height;
|
||||
dest_changed = TRUE;
|
||||
}
|
||||
|
||||
if (!gsk_rect_equal (&self->source, source))
|
||||
{
|
||||
self->source.origin.x = source->origin.x;
|
||||
self->source.origin.y = source->origin.y;
|
||||
self->source.size.width = source->size.width;
|
||||
self->source.size.height = source->size.height;
|
||||
source_changed = TRUE;
|
||||
}
|
||||
|
||||
tf = gdk_texture_transform_to_wl (transform);
|
||||
if (self->transform != tf)
|
||||
{
|
||||
self->transform = tf;
|
||||
transform_changed = TRUE;
|
||||
}
|
||||
|
||||
if (sibling != gdk_subsurface_get_sibling (sub, above) ||
|
||||
will_be_above != gdk_subsurface_is_above_parent (sub))
|
||||
stacking_changed = TRUE;
|
||||
|
||||
if (self->texture == NULL)
|
||||
{
|
||||
dest_changed = TRUE;
|
||||
source_changed = TRUE;
|
||||
transform_changed = TRUE;
|
||||
stacking_changed = TRUE;
|
||||
}
|
||||
|
||||
scale = gdk_fractional_scale_to_double (&parent->scale);
|
||||
|
||||
if (background)
|
||||
{
|
||||
background_changed =
|
||||
!self->bg_attached ||
|
||||
self->bg_rect.x != background->origin.x ||
|
||||
self->bg_rect.y != background->origin.y ||
|
||||
self->bg_rect.width != background->size.width ||
|
||||
self->bg_rect.height != background->size.height;
|
||||
self->bg_rect.x = background->origin.x;
|
||||
self->bg_rect.y = background->origin.y;
|
||||
self->bg_rect.width = background->size.width;
|
||||
self->bg_rect.height = background->size.height;
|
||||
}
|
||||
else
|
||||
{
|
||||
background_changed = self->bg_attached;
|
||||
self->bg_rect.x = 0;
|
||||
self->bg_rect.y = 0;
|
||||
self->bg_rect.width = 0;
|
||||
self->bg_rect.height = 0;
|
||||
}
|
||||
|
||||
has_background = self->bg_rect.width > 0 && self->bg_rect.height > 0;
|
||||
|
||||
if (has_background)
|
||||
ensure_bg_surface (self);
|
||||
|
||||
if (!scaled_rect_is_integral (dest, 1, &device_rect))
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
||||
"Non-integer coordinates %g %g %g %g for %dx%d texture, hiding subsurface %p",
|
||||
"[%p] 🗙 Non-integral coordinates %g %g %g %g",
|
||||
self,
|
||||
dest->origin.x, dest->origin.y,
|
||||
dest->size.width, dest->size.height,
|
||||
gdk_texture_get_width (texture),
|
||||
gdk_texture_get_height (texture),
|
||||
self);
|
||||
dest->size.width, dest->size.height);
|
||||
}
|
||||
else if (device_dest.x != device_rect.origin.x ||
|
||||
device_dest.y != device_rect.origin.y ||
|
||||
device_dest.width != device_rect.size.width ||
|
||||
device_dest.height != device_rect.size.height)
|
||||
else if (!scaled_rect_is_integral (dest, scale, &device_rect))
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
||||
"Non-integral device coordinates %g %g %g %g (fractional scale %.2f), hiding subsurface %p",
|
||||
"[%p] 🗙 Non-integral device coordinates %g %g %g %g (scale %.2f)",
|
||||
self,
|
||||
device_rect.origin.x, device_rect.origin.y,
|
||||
device_rect.size.width, device_rect.size.width,
|
||||
scale,
|
||||
self);
|
||||
device_rect.size.width, device_rect.size.height,
|
||||
scale);
|
||||
}
|
||||
else if (!GDK_IS_DMABUF_TEXTURE (texture))
|
||||
else if (background && !scaled_rect_is_integral (background, 1, &device_rect))
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
||||
"%dx%d %s is not a GdkDmabufTexture, hiding subsurface %p",
|
||||
gdk_texture_get_width (texture),
|
||||
gdk_texture_get_height (texture),
|
||||
"[%p] 🗙 Non-integral background coordinates %g %g %g %g",
|
||||
self,
|
||||
background->origin.x, background->origin.y,
|
||||
background->size.width, background->size.height);
|
||||
}
|
||||
else if (background && !scaled_rect_is_integral (background, scale, &device_rect))
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
||||
"[%p] 🗙 Non-integral background device coordinates %g %g %g %g (scale %.2f)",
|
||||
self,
|
||||
device_rect.origin.x, device_rect.origin.y,
|
||||
device_rect.size.width, device_rect.size.height,
|
||||
scale);
|
||||
}
|
||||
else if (!GDK_IS_DMABUF_TEXTURE (texture) &&
|
||||
!GDK_DISPLAY_DEBUG_CHECK (gdk_surface_get_display (sub->parent), FORCE_OFFLOAD))
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
||||
"[%p] 🗙 %s (%dx%d) is not a GdkDmabufTexture",
|
||||
self,
|
||||
G_OBJECT_TYPE_NAME (texture),
|
||||
self);
|
||||
gdk_texture_get_width (texture),
|
||||
gdk_texture_get_height (texture));
|
||||
}
|
||||
else if (!will_be_above &&
|
||||
gdk_memory_format_alpha (gdk_texture_get_format (texture)) != GDK_MEMORY_ALPHA_OPAQUE)
|
||||
gdk_memory_format_alpha (gdk_texture_get_format (texture)) != GDK_MEMORY_ALPHA_OPAQUE &&
|
||||
!has_background)
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
||||
"Cannot offload non-opaque %dx%d texture below, hiding subsurface %p",
|
||||
"[%p] 🗙 Non-opaque texture (%dx%d) below",
|
||||
self,
|
||||
gdk_texture_get_width (texture),
|
||||
gdk_texture_get_height (texture),
|
||||
gdk_texture_get_height (texture));
|
||||
}
|
||||
else if (has_background && !display->single_pixel_buffer)
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
||||
"[%p] 🗙 Texture has background, but no single-pixel buffer support",
|
||||
self);
|
||||
}
|
||||
else
|
||||
@@ -286,10 +494,13 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
||||
}
|
||||
|
||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
||||
"Attached %dx%d texture to subsurface %p at %d %d %d %d",
|
||||
"[%p] %s Attaching texture (%dx%d) at %d %d %d %d",
|
||||
self,
|
||||
will_be_above
|
||||
? (has_background ? "▲" : "△")
|
||||
: (has_background ? "▼" : "▽"),
|
||||
gdk_texture_get_width (texture),
|
||||
gdk_texture_get_height (texture),
|
||||
self,
|
||||
self->dest.x, self->dest.y,
|
||||
self->dest.width, self->dest.height);
|
||||
result = TRUE;
|
||||
@@ -297,36 +508,53 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
||||
else
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
||||
"Compositor failed to create wl_buffer for %dx%d texture, hiding subsurface %p",
|
||||
gdk_texture_get_width (texture),
|
||||
gdk_texture_get_height (texture),
|
||||
"[%p] 🗙 Failed to create wl_buffer",
|
||||
self);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dest_changed)
|
||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
||||
"[%p] %s Moving texture (%dx%d) to %d %d %d %d",
|
||||
self,
|
||||
will_be_above
|
||||
? (has_background ? "▲" : "△")
|
||||
: (has_background ? "▼" : "▽"),
|
||||
gdk_texture_get_width (texture),
|
||||
gdk_texture_get_height (texture),
|
||||
self->dest.x, self->dest.y,
|
||||
self->dest.width, self->dest.height);
|
||||
|
||||
buffer = NULL;
|
||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
||||
"Moved %dx%d texture in subsurface %p to %d %d %d %d",
|
||||
gdk_texture_get_width (texture),
|
||||
gdk_texture_get_height (texture),
|
||||
self,
|
||||
self->dest.x, self->dest.y,
|
||||
self->dest.width, self->dest.height);
|
||||
result = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (result)
|
||||
{
|
||||
wl_surface_set_buffer_transform (self->surface, self->transform);
|
||||
wl_subsurface_set_position (self->subsurface, self->dest.x, self->dest.y);
|
||||
wp_viewport_set_destination (self->viewport, self->dest.width, self->dest.height);
|
||||
wp_viewport_set_source (self->viewport,
|
||||
wl_fixed_from_double (self->source.origin.x),
|
||||
wl_fixed_from_double (self->source.origin.y),
|
||||
wl_fixed_from_double (self->source.size.width),
|
||||
wl_fixed_from_double (self->source.size.height));
|
||||
if (transform_changed)
|
||||
{
|
||||
wl_surface_set_buffer_transform (self->surface, self->transform);
|
||||
needs_commit = TRUE;
|
||||
}
|
||||
|
||||
if (dest_changed)
|
||||
{
|
||||
wl_subsurface_set_position (self->subsurface, self->dest.x, self->dest.y);
|
||||
wp_viewport_set_destination (self->viewport, self->dest.width, self->dest.height);
|
||||
needs_commit = TRUE;
|
||||
}
|
||||
|
||||
if (source_changed)
|
||||
{
|
||||
wp_viewport_set_source (self->viewport,
|
||||
wl_fixed_from_double (self->source.origin.x),
|
||||
wl_fixed_from_double (self->source.origin.y),
|
||||
wl_fixed_from_double (self->source.size.width),
|
||||
wl_fixed_from_double (self->source.size.height));
|
||||
needs_commit = TRUE;
|
||||
}
|
||||
|
||||
if (buffer)
|
||||
{
|
||||
@@ -335,39 +563,95 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
||||
0, 0,
|
||||
gdk_texture_get_width (texture),
|
||||
gdk_texture_get_height (texture));
|
||||
needs_commit = TRUE;
|
||||
}
|
||||
|
||||
if (has_background)
|
||||
{
|
||||
if (background_changed)
|
||||
{
|
||||
wl_subsurface_set_position (self->bg_subsurface, self->bg_rect.x, self->bg_rect.y);
|
||||
wp_viewport_set_destination (self->bg_viewport, self->bg_rect.width, self->bg_rect.height);
|
||||
needs_bg_commit = TRUE;
|
||||
}
|
||||
|
||||
if (!self->bg_attached)
|
||||
{
|
||||
self->bg_attached = TRUE;
|
||||
|
||||
wp_viewport_set_source (self->bg_viewport,
|
||||
wl_fixed_from_int (0),
|
||||
wl_fixed_from_int (0),
|
||||
wl_fixed_from_int (1),
|
||||
wl_fixed_from_int (1));
|
||||
wl_surface_attach (self->bg_surface, get_sp_buffer (self), 0, 0);
|
||||
wl_surface_damage_buffer (self->bg_surface, 0, 0, 1, 1);
|
||||
needs_bg_commit = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (self->bg_attached)
|
||||
{
|
||||
self->bg_attached = FALSE;
|
||||
wl_surface_attach (self->bg_surface, NULL, 0, 0);
|
||||
needs_bg_commit = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
result = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_set_object (&self->texture, NULL);
|
||||
if (g_set_object (&self->texture, NULL))
|
||||
{
|
||||
wl_surface_attach (self->surface, NULL, 0, 0);
|
||||
needs_commit = TRUE;
|
||||
}
|
||||
|
||||
wl_surface_attach (self->surface, NULL, 0, 0);
|
||||
if (self->bg_attached)
|
||||
{
|
||||
self->bg_attached = FALSE;
|
||||
wl_surface_attach (self->bg_surface, NULL, 0, 0);
|
||||
needs_bg_commit = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (sib)
|
||||
if (stacking_changed)
|
||||
{
|
||||
if (above)
|
||||
wl_subsurface_place_above (self->subsurface, sib->surface);
|
||||
if (sib)
|
||||
{
|
||||
if (above)
|
||||
wl_subsurface_place_above (self->subsurface, sib->surface);
|
||||
else
|
||||
wl_subsurface_place_below (self->subsurface, sib->surface);
|
||||
}
|
||||
else
|
||||
wl_subsurface_place_below (self->subsurface, sib->surface);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (above)
|
||||
wl_subsurface_place_above (self->subsurface,
|
||||
GDK_WAYLAND_SURFACE (sub->parent)->display_server.wl_surface);
|
||||
else
|
||||
wl_subsurface_place_below (self->subsurface,
|
||||
GDK_WAYLAND_SURFACE (sub->parent)->display_server.wl_surface);
|
||||
{
|
||||
if (above)
|
||||
wl_subsurface_place_above (self->subsurface,
|
||||
GDK_WAYLAND_SURFACE (sub->parent)->display_server.wl_surface);
|
||||
else
|
||||
wl_subsurface_place_below (self->subsurface,
|
||||
GDK_WAYLAND_SURFACE (sub->parent)->display_server.wl_surface);
|
||||
}
|
||||
needs_commit = TRUE;
|
||||
|
||||
if (self->bg_attached)
|
||||
{
|
||||
wl_subsurface_place_below (self->bg_subsurface, self->surface);
|
||||
needs_bg_commit = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
wl_surface_commit (self->surface);
|
||||
if (needs_commit)
|
||||
wl_surface_commit (self->surface);
|
||||
|
||||
((GdkWaylandSurface *)sub->parent)->has_pending_subsurface_commits = TRUE;
|
||||
GDK_WAYLAND_SURFACE (sub->parent)->opaque_region_dirty = TRUE;
|
||||
if (needs_bg_commit)
|
||||
wl_surface_commit (self->bg_surface);
|
||||
|
||||
((GdkWaylandSurface *)sub->parent)->has_pending_subsurface_commits = needs_commit || needs_bg_commit;
|
||||
GDK_WAYLAND_SURFACE (sub->parent)->opaque_region_dirty = stacking_changed || dest_changed || background_changed;
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -379,7 +663,7 @@ gdk_wayland_subsurface_detach (GdkSubsurface *sub)
|
||||
|
||||
if (sub->parent == NULL)
|
||||
{
|
||||
g_warning ("Can't draw to destroyed subsurface %p", self);
|
||||
g_warning ("Can't detach from destroyed subsurface %p", self);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -388,6 +672,13 @@ gdk_wayland_subsurface_detach (GdkSubsurface *sub)
|
||||
wl_surface_set_opaque_region (self->surface, self->opaque_region);
|
||||
wl_surface_commit (self->surface);
|
||||
|
||||
if (self->bg_attached)
|
||||
{
|
||||
wl_surface_attach (self->bg_surface, NULL, 0, 0);
|
||||
wl_surface_commit (self->bg_surface);
|
||||
self->bg_attached = FALSE;
|
||||
}
|
||||
|
||||
((GdkWaylandSurface *)sub->parent)->has_pending_subsurface_commits = TRUE;
|
||||
GDK_WAYLAND_SURFACE (sub->parent)->opaque_region_dirty = TRUE;
|
||||
}
|
||||
@@ -401,27 +692,27 @@ gdk_wayland_subsurface_get_texture (GdkSubsurface *sub)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_subsurface_get_dest (GdkSubsurface *sub,
|
||||
graphene_rect_t *dest)
|
||||
gdk_wayland_subsurface_get_texture_rect (GdkSubsurface *sub,
|
||||
graphene_rect_t *rect)
|
||||
{
|
||||
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
|
||||
|
||||
dest->origin.x = self->dest.x;
|
||||
dest->origin.y = self->dest.y;
|
||||
dest->size.width = self->dest.width;
|
||||
dest->size.height = self->dest.height;
|
||||
rect->origin.x = self->dest.x;
|
||||
rect->origin.y = self->dest.y;
|
||||
rect->size.width = self->dest.width;
|
||||
rect->size.height = self->dest.height;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_subsurface_get_source (GdkSubsurface *sub,
|
||||
graphene_rect_t *source)
|
||||
gdk_wayland_subsurface_get_source_rect (GdkSubsurface *sub,
|
||||
graphene_rect_t *rect)
|
||||
{
|
||||
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
|
||||
|
||||
source->origin.x = self->source.origin.x;
|
||||
source->origin.y = self->source.origin.y;
|
||||
source->size.width = self->source.size.width;
|
||||
source->size.height = self->source.size.height;
|
||||
rect->origin.x = self->source.origin.x;
|
||||
rect->origin.y = self->source.origin.y;
|
||||
rect->size.width = self->source.size.width;
|
||||
rect->size.height = self->source.size.height;
|
||||
}
|
||||
|
||||
static GdkTextureTransform
|
||||
@@ -433,11 +724,17 @@ gdk_wayland_subsurface_get_transform (GdkSubsurface *sub)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_wayland_subsurface_get_lightbox (GdkSubsurface *sub)
|
||||
gdk_wayland_subsurface_get_background_rect (GdkSubsurface *sub,
|
||||
graphene_rect_t *rect)
|
||||
{
|
||||
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
|
||||
|
||||
return self->lightbox;
|
||||
rect->origin.x = self->bg_rect.x;
|
||||
rect->origin.y = self->bg_rect.y;
|
||||
rect->size.width = self->bg_rect.width;
|
||||
rect->size.height = self->bg_rect.height;
|
||||
|
||||
return rect->size.width > 0 && rect->size.height > 0;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -451,10 +748,10 @@ gdk_wayland_subsurface_class_init (GdkWaylandSubsurfaceClass *class)
|
||||
subsurface_class->attach = gdk_wayland_subsurface_attach;
|
||||
subsurface_class->detach = gdk_wayland_subsurface_detach;
|
||||
subsurface_class->get_texture = gdk_wayland_subsurface_get_texture;
|
||||
subsurface_class->get_source = gdk_wayland_subsurface_get_source;
|
||||
subsurface_class->get_dest = gdk_wayland_subsurface_get_dest;
|
||||
subsurface_class->get_source_rect = gdk_wayland_subsurface_get_source_rect;
|
||||
subsurface_class->get_texture_rect = gdk_wayland_subsurface_get_texture_rect;
|
||||
subsurface_class->get_transform = gdk_wayland_subsurface_get_transform;
|
||||
subsurface_class->get_lightbox = gdk_wayland_subsurface_get_lightbox;
|
||||
subsurface_class->get_background_rect = gdk_wayland_subsurface_get_background_rect;
|
||||
};
|
||||
|
||||
static void
|
||||
|
||||
@@ -54,6 +54,8 @@
|
||||
#include "linux-dmabuf-unstable-v1-client-protocol.h"
|
||||
#include "presentation-time-client-protocol.h"
|
||||
|
||||
#include "gsk/gskrectprivate.h"
|
||||
|
||||
|
||||
/**
|
||||
* GdkWaylandSurface:
|
||||
@@ -657,6 +659,7 @@ static void
|
||||
gdk_wayland_surface_sync_opaque_region (GdkSurface *surface)
|
||||
{
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
|
||||
struct wl_region *wl_region = NULL;
|
||||
|
||||
if (!impl->display_server.wl_surface)
|
||||
@@ -679,16 +682,21 @@ gdk_wayland_surface_sync_opaque_region (GdkSurface *surface)
|
||||
continue;
|
||||
|
||||
if (sub->texture != NULL)
|
||||
cairo_region_subtract_rectangle (region, &sub->dest);
|
||||
{
|
||||
graphene_rect_t bounds;
|
||||
cairo_rectangle_int_t rect;
|
||||
|
||||
gdk_subsurface_get_bounds (subsurface, &bounds);
|
||||
gsk_rect_to_cairo_grow (&bounds, &rect);
|
||||
cairo_region_subtract_rectangle (region, &rect);
|
||||
}
|
||||
}
|
||||
|
||||
wl_region = wl_region_from_cairo_region (GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface)),
|
||||
region);
|
||||
wl_region = wl_region_from_cairo_region (display, region);
|
||||
cairo_region_destroy (region);
|
||||
}
|
||||
else
|
||||
wl_region = wl_region_from_cairo_region (GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface)),
|
||||
impl->opaque_region);
|
||||
wl_region = wl_region_from_cairo_region (display, impl->opaque_region);
|
||||
}
|
||||
|
||||
wl_surface_set_opaque_region (impl->display_server.wl_surface, wl_region);
|
||||
@@ -775,7 +783,7 @@ gdk_wayland_surface_sync (GdkSurface *surface)
|
||||
gdk_wayland_surface_sync_viewport (surface);
|
||||
}
|
||||
|
||||
gboolean
|
||||
static gboolean
|
||||
gdk_wayland_surface_needs_commit (GdkSurface *surface)
|
||||
{
|
||||
GdkWaylandSurface *self = GDK_WAYLAND_SURFACE (surface);
|
||||
@@ -787,6 +795,20 @@ gdk_wayland_surface_needs_commit (GdkSurface *surface)
|
||||
self->viewport_dirty;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_wayland_surface_handle_empty_frame (GdkSurface *surface)
|
||||
{
|
||||
if (!gdk_wayland_surface_needs_commit (surface))
|
||||
return;
|
||||
|
||||
gdk_wayland_surface_sync (surface);
|
||||
gdk_wayland_surface_request_frame (surface);
|
||||
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
|
||||
gdk_wayland_surface_commit (surface);
|
||||
gdk_wayland_surface_notify_committed (surface);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_surface_fractional_scale_preferred_scale_cb (void *data,
|
||||
struct wp_fractional_scale_v1 *fractional_scale,
|
||||
@@ -799,6 +821,11 @@ gdk_wayland_surface_fractional_scale_preferred_scale_cb (void *data,
|
||||
gdk_wayland_surface_update_size (surface,
|
||||
surface->width, surface->height,
|
||||
&GDK_FRACTIONAL_SCALE_INIT (scale));
|
||||
|
||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (surface), EVENTS,
|
||||
"preferred fractional scale, surface %p scale %f",
|
||||
surface,
|
||||
gdk_fractional_scale_to_double (&GDK_FRACTIONAL_SCALE_INIT (scale)));
|
||||
}
|
||||
|
||||
static const struct wp_fractional_scale_v1_listener fractional_scale_listener = {
|
||||
@@ -815,8 +842,8 @@ surface_enter (void *data,
|
||||
GdkDisplay *display = gdk_surface_get_display (surface);
|
||||
GdkMonitor *monitor;
|
||||
|
||||
GDK_DISPLAY_DEBUG(gdk_surface_get_display (surface), EVENTS,
|
||||
"surface enter, surface %p output %p", surface, output);
|
||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (surface), EVENTS,
|
||||
"surface enter, surface %p output %p", surface, output);
|
||||
|
||||
impl->display_server.outputs = g_slist_prepend (impl->display_server.outputs, output);
|
||||
|
||||
@@ -848,9 +875,38 @@ surface_leave (void *data,
|
||||
gdk_surface_leave_monitor (surface, monitor);
|
||||
}
|
||||
|
||||
static void
|
||||
surface_preferred_buffer_scale (void *data,
|
||||
struct wl_surface *wl_surface,
|
||||
int32_t factor)
|
||||
{
|
||||
GdkSurface *surface = GDK_SURFACE (data);
|
||||
|
||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (surface), EVENTS,
|
||||
"preferred buffer scale, surface %p scale %d",
|
||||
surface, factor);
|
||||
}
|
||||
|
||||
static void
|
||||
surface_preferred_buffer_transform (void *data,
|
||||
struct wl_surface *wl_surface,
|
||||
uint32_t transform)
|
||||
{
|
||||
GdkSurface *surface = GDK_SURFACE (data);
|
||||
const char *transform_name[] = {
|
||||
"normal", "90", "180", "270", "flipped", "flipped-90", "flipped-180", "flipped-270"
|
||||
};
|
||||
|
||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (surface), EVENTS,
|
||||
"preferred buffer transform, surface %p transform %s",
|
||||
surface, transform_name[transform]);
|
||||
}
|
||||
|
||||
static const struct wl_surface_listener surface_listener = {
|
||||
surface_enter,
|
||||
surface_leave
|
||||
surface_leave,
|
||||
surface_preferred_buffer_scale,
|
||||
surface_preferred_buffer_transform,
|
||||
};
|
||||
|
||||
static void
|
||||
|
||||
@@ -77,16 +77,8 @@ static void
|
||||
gdk_vulkan_context_wayland_empty_frame (GdkDrawContext *context)
|
||||
{
|
||||
GdkSurface *surface = gdk_draw_context_get_surface (GDK_DRAW_CONTEXT (context));
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
|
||||
if (!impl->has_pending_subsurface_commits)
|
||||
return;
|
||||
|
||||
gdk_wayland_surface_sync (surface);
|
||||
gdk_wayland_surface_request_frame (surface);
|
||||
|
||||
gdk_wayland_surface_commit (surface);
|
||||
gdk_wayland_surface_notify_committed (surface);
|
||||
gdk_wayland_surface_handle_empty_frame (surface);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -48,7 +48,7 @@ GDK_AVAILABLE_IN_ALL
|
||||
struct wl_display *gdk_wayland_display_get_wl_display (GdkDisplay *display);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
struct wl_compositor *gdk_wayland_display_get_wl_compositor (GdkDisplay *display);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_16
|
||||
void gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
|
||||
const char *name,
|
||||
int size);
|
||||
@@ -60,7 +60,7 @@ void gdk_wayland_display_set_startup_notification_id (GdkDisp
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_wayland_display_query_registry (GdkDisplay *display,
|
||||
const char *global);
|
||||
const char *global);
|
||||
|
||||
GDK_AVAILABLE_IN_4_4
|
||||
gpointer gdk_wayland_display_get_egl_display (GdkDisplay *display);
|
||||
|
||||
+25
-67
@@ -47,82 +47,40 @@ gdk_wayland_deps = [
|
||||
wlegldep,
|
||||
]
|
||||
|
||||
wayland_scanner = find_program('wayland-scanner')
|
||||
|
||||
# Format:
|
||||
# - protocol name
|
||||
# - protocol stability ('private', 'stable' or 'unstable')
|
||||
# - protocol version (if stability is 'unstable')
|
||||
wlmod = import('unstable-wayland')
|
||||
proto_sources = [
|
||||
['gtk-shell', 'private', ],
|
||||
['primary-selection', 'unstable', 'v1', ],
|
||||
['pointer-gestures', 'unstable', 'v1', ],
|
||||
['viewporter', 'stable', ],
|
||||
['xdg-shell', 'unstable', 'v6', ],
|
||||
['xdg-shell', 'stable', ],
|
||||
['xdg-foreign', 'unstable', 'v1', ],
|
||||
['xdg-foreign', 'unstable', 'v2', ],
|
||||
['tablet', 'unstable', 'v2', ],
|
||||
['keyboard-shortcuts-inhibit', 'unstable', 'v1', ],
|
||||
['server-decoration', 'private' ],
|
||||
['xdg-output', 'unstable', 'v1', ],
|
||||
['idle-inhibit', 'unstable', 'v1', ],
|
||||
['xdg-activation', 'staging', 'v1', ],
|
||||
['fractional-scale', 'staging', 'v1', ],
|
||||
['linux-dmabuf', 'unstable', 'v1', ],
|
||||
['presentation-time', 'stable', 'v1', ],
|
||||
'protocol/gtk-shell.xml',
|
||||
'protocol/server-decoration.xml',
|
||||
wlmod.find_protocol('primary-selection', state: 'unstable', version: 1),
|
||||
wlmod.find_protocol('pointer-gestures', state: 'unstable', version: 1),
|
||||
wlmod.find_protocol('viewporter', state: 'stable'),
|
||||
wlmod.find_protocol('xdg-shell', state: 'unstable', version: 6),
|
||||
wlmod.find_protocol('xdg-shell', state: 'stable'),
|
||||
wlmod.find_protocol('xdg-foreign', state: 'unstable', version: 1),
|
||||
wlmod.find_protocol('xdg-foreign', state: 'unstable', version: 2),
|
||||
wlmod.find_protocol('tablet', state: 'unstable', version: 2),
|
||||
wlmod.find_protocol('keyboard-shortcuts-inhibit', state: 'unstable', version: 1),
|
||||
wlmod.find_protocol('xdg-output', state: 'unstable', version: 1),
|
||||
wlmod.find_protocol('idle-inhibit', state: 'unstable', version: 1),
|
||||
wlmod.find_protocol('xdg-activation', state: 'staging', version: 1),
|
||||
wlmod.find_protocol('fractional-scale', state: 'staging', version: 1),
|
||||
wlmod.find_protocol('linux-dmabuf', state: 'unstable', version: 1),
|
||||
wlmod.find_protocol('presentation-time', state: 'stable'),
|
||||
wlmod.find_protocol('single-pixel-buffer', state: 'staging', version: 1),
|
||||
]
|
||||
|
||||
gdk_wayland_gen_headers = []
|
||||
|
||||
foreach p: proto_sources
|
||||
proto_name = p.get(0)
|
||||
proto_stability = p.get(1)
|
||||
|
||||
if proto_stability == 'stable'
|
||||
output_base = proto_name
|
||||
input = files(join_paths(wlproto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base)))
|
||||
elif proto_stability == 'staging'
|
||||
proto_version = p.get(2)
|
||||
output_base = '@0@-@1@'.format(proto_name, proto_version)
|
||||
input = files(join_paths(wlproto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base)))
|
||||
elif proto_stability == 'private'
|
||||
output_base = proto_name
|
||||
input = files('protocol/@0@.xml'.format(proto_name))
|
||||
else
|
||||
proto_version = p.get(2)
|
||||
output_base = '@0@-@1@-@2@'.format(proto_name, proto_stability, proto_version)
|
||||
input = files(join_paths(wlproto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base)))
|
||||
endif
|
||||
|
||||
gdk_wayland_gen_headers += custom_target('@0@ client header'.format(output_base),
|
||||
input: input,
|
||||
output: '@0@-client-protocol.h'.format(output_base),
|
||||
command: [
|
||||
wayland_scanner,
|
||||
'client-header',
|
||||
'@INPUT@', '@OUTPUT@',
|
||||
],
|
||||
)
|
||||
|
||||
gdk_wayland_sources += custom_target('@0@ source'.format(output_base),
|
||||
input: input,
|
||||
output: '@0@-protocol.c'.format(output_base),
|
||||
command: [
|
||||
wayland_scanner,
|
||||
'private-code',
|
||||
'@INPUT@', '@OUTPUT@',
|
||||
],
|
||||
)
|
||||
# Returns a list [.c, .h]
|
||||
gen = wlmod.scan_xml(p)
|
||||
assert(gen.length() == 2)
|
||||
gdk_wayland_sources += gen[0]
|
||||
gdk_wayland_gen_headers += gen[1]
|
||||
endforeach
|
||||
|
||||
libgdk_wayland = static_library('gdk-wayland',
|
||||
sources: [
|
||||
gdk_wayland_sources,
|
||||
gdk_wayland_gen_headers,
|
||||
gdkconfig,
|
||||
gdkenum_h,
|
||||
],
|
||||
sources: [ gdk_wayland_sources, gdk_wayland_gen_headers, gdk_gen_headers ],
|
||||
include_directories: [ confinc, gdkinc, ],
|
||||
c_args: [
|
||||
'-DGTK_COMPILATION',
|
||||
|
||||
@@ -3071,20 +3071,6 @@ gdk_event_translate (MSG *msg,
|
||||
}
|
||||
}
|
||||
|
||||
if ((windowpos->flags & SWP_HIDEWINDOW) &&
|
||||
!GDK_SURFACE_DESTROYED (window))
|
||||
{
|
||||
/* Make transient parent the foreground window when window unmaps */
|
||||
impl = GDK_WIN32_SURFACE (window);
|
||||
|
||||
if (impl->transient_owner &&
|
||||
GetForegroundWindow () == GDK_SURFACE_HWND (window))
|
||||
{
|
||||
SetForegroundWindow (GDK_SURFACE_HWND (impl->transient_owner));
|
||||
SetCapture (GDK_SURFACE_HWND (impl->transient_owner));
|
||||
}
|
||||
}
|
||||
|
||||
if (!(windowpos->flags & SWP_NOCLIENTSIZE))
|
||||
{
|
||||
if (window->resize_count > 1)
|
||||
|
||||
@@ -4200,82 +4200,13 @@ BOOL WINAPI
|
||||
GtkShowWindow (GdkSurface *window,
|
||||
int cmd_show)
|
||||
{
|
||||
cairo_t *cr;
|
||||
cairo_surface_t *surface;
|
||||
RECT window_rect;
|
||||
HDC hdc;
|
||||
POINT window_position;
|
||||
SIZE window_size;
|
||||
POINT source_point;
|
||||
BLENDFUNCTION blender;
|
||||
|
||||
HWND hwnd = GDK_SURFACE_HWND (window);
|
||||
GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
|
||||
|
||||
switch (cmd_show)
|
||||
{
|
||||
case SW_FORCEMINIMIZE:
|
||||
case SW_HIDE:
|
||||
case SW_MINIMIZE:
|
||||
break;
|
||||
case SW_MAXIMIZE:
|
||||
case SW_RESTORE:
|
||||
case SW_SHOW:
|
||||
case SW_SHOWDEFAULT:
|
||||
case SW_SHOWMINIMIZED:
|
||||
case SW_SHOWMINNOACTIVE:
|
||||
case SW_SHOWNA:
|
||||
case SW_SHOWNOACTIVATE:
|
||||
case SW_SHOWNORMAL:
|
||||
if (IsWindowVisible (hwnd))
|
||||
break;
|
||||
|
||||
/* Window was hidden, will be shown. Erase it, GDK will repaint soon,
|
||||
* but not soon enough, so it's possible to see old content before
|
||||
* the next redraw, unless we erase the window first.
|
||||
*/
|
||||
GetWindowRect (hwnd, &window_rect);
|
||||
source_point.x = source_point.y = 0;
|
||||
|
||||
window_position.x = window_rect.left;
|
||||
window_position.y = window_rect.top;
|
||||
window_size.cx = window_rect.right - window_rect.left;
|
||||
window_size.cy = window_rect.bottom - window_rect.top;
|
||||
|
||||
blender.BlendOp = AC_SRC_OVER;
|
||||
blender.BlendFlags = 0;
|
||||
blender.AlphaFormat = AC_SRC_ALPHA;
|
||||
blender.SourceConstantAlpha = 255;
|
||||
|
||||
/* Create a surface of appropriate size and clear it */
|
||||
surface = cairo_win32_surface_create_with_dib (CAIRO_FORMAT_ARGB32,
|
||||
window_size.cx,
|
||||
window_size.cy);
|
||||
cairo_surface_set_device_scale (surface, impl->surface_scale, impl->surface_scale);
|
||||
cr = cairo_create (surface);
|
||||
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
|
||||
cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.0);
|
||||
cairo_paint (cr);
|
||||
cairo_destroy (cr);
|
||||
cairo_surface_flush (surface);
|
||||
hdc = cairo_win32_surface_get_dc (surface);
|
||||
|
||||
/* No API_CALL() wrapper, don't check for errors */
|
||||
UpdateLayeredWindow (hwnd, NULL,
|
||||
&window_position, &window_size,
|
||||
hdc, &source_point,
|
||||
0, &blender, ULW_ALPHA);
|
||||
|
||||
cairo_surface_destroy (surface);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/* Ensure that maximized window size is corrected later on */
|
||||
if (cmd_show == SW_MAXIMIZE)
|
||||
impl->maximizing = TRUE;
|
||||
|
||||
return ShowWindow (hwnd, cmd_show);
|
||||
return ShowWindow (GDK_SURFACE_HWND (window), cmd_show);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -4804,10 +4735,7 @@ gdk_win32_toplevel_set_property (GObject *object,
|
||||
GDK_SURFACE (surface)->modal_hint = g_value_get_boolean (value);
|
||||
|
||||
if (GDK_SURFACE (surface)->modal_hint)
|
||||
{
|
||||
SetCapture (GDK_SURFACE_HWND (surface));
|
||||
_gdk_push_modal_window (surface);
|
||||
}
|
||||
_gdk_push_modal_window (surface);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (surface), pspec);
|
||||
break;
|
||||
|
||||
@@ -64,7 +64,7 @@ gdk_win32_deps = [
|
||||
]
|
||||
|
||||
libgdk_win32 = static_library('gdk-win32',
|
||||
gdk_win32_sources, gdkconfig, gdkenum_h,
|
||||
sources: [ gdk_win32_sources, gdk_gen_headers ],
|
||||
include_directories: [ confinc, gdkinc ],
|
||||
c_args: [
|
||||
'-DGTK_COMPILATION',
|
||||
|
||||
@@ -274,11 +274,22 @@ gdk_x11_cursor_create_for_name (GdkDisplay *display,
|
||||
* will have to be handled by the application (GTK applications can learn
|
||||
* about cursor theme changes by listening for change notification
|
||||
* for the corresponding `GtkSetting`).
|
||||
*
|
||||
* Deprecated: 4.16: Use the cursor-related properties of
|
||||
* [GtkSettings](../gtk4/class.Settings.html) to set the cursor theme
|
||||
*/
|
||||
void
|
||||
gdk_x11_display_set_cursor_theme (GdkDisplay *display,
|
||||
const char *theme,
|
||||
const int size)
|
||||
{
|
||||
_gdk_x11_display_set_cursor_theme (display, theme, size);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_x11_display_set_cursor_theme (GdkDisplay *display,
|
||||
const char *theme,
|
||||
const int size)
|
||||
{
|
||||
#if defined(HAVE_XCURSOR) && defined(HAVE_XFIXES) && XFIXES_MAJOR >= 2
|
||||
GdkX11Screen *x11_screen;
|
||||
|
||||
@@ -520,7 +520,7 @@ create_device (GdkX11DeviceManagerXI2 *device_manager,
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (display, INPUT))
|
||||
{
|
||||
const char *type_names[] = { "logical", "physical", "floating" };
|
||||
const char *source_names[] = { "mouse", "pen", "eraser", "cursor", "keyboard", "direct touch", "indirect touch", "trackpoint", "pad" };
|
||||
const char *source_names[] = { "mouse", "pen", "keyboard", "direct touch", "indirect touch", "trackpoint", "pad" };
|
||||
gdk_debug_message ("input device:\n\tname: %s\n\ttype: %s\n\tsource: %s\n\thas cursor: %d\n\ttouches: %d",
|
||||
dev->name,
|
||||
type_names[type],
|
||||
|
||||
@@ -665,7 +665,6 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
|
||||
if (x11_screen->wmspec_check_window == xevent->xdestroywindow.window)
|
||||
{
|
||||
x11_screen->wmspec_check_window = None;
|
||||
x11_screen->last_wmspec_check_time = 0;
|
||||
g_free (x11_screen->window_manager_name);
|
||||
x11_screen->window_manager_name = g_strdup ("unknown");
|
||||
|
||||
@@ -3079,7 +3078,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
display_class->get_monitors = gdk_x11_display_get_monitors;
|
||||
display_class->get_setting = gdk_x11_display_get_setting;
|
||||
display_class->set_cursor_theme = gdk_x11_display_set_cursor_theme;
|
||||
display_class->set_cursor_theme = _gdk_x11_display_set_cursor_theme;
|
||||
|
||||
class->xevent = gdk_event_source_xevent;
|
||||
|
||||
|
||||
@@ -490,7 +490,7 @@ gdk_x11_context_create_glx_context (GdkGLContext *context,
|
||||
GdkGLContext *share = gdk_display_get_gl_context (display);
|
||||
GdkX11GLContextGLX *share_glx = NULL;
|
||||
GdkSurface *surface = gdk_gl_context_get_surface (context);
|
||||
GLXContext ctx;
|
||||
GLXContext ctx = NULL;
|
||||
int context_attribs[N_GLX_ATTRS], i = 0, flags = 0;
|
||||
gsize major_idx, minor_idx;
|
||||
GdkGLVersion version;
|
||||
|
||||
@@ -206,6 +206,10 @@ GdkFilterReturn
|
||||
gdk_surface_cache_shape_filter (const XEvent *xevent,
|
||||
gpointer data);
|
||||
|
||||
void _gdk_x11_display_set_cursor_theme (GdkDisplay *display,
|
||||
const char *theme,
|
||||
const int size);
|
||||
|
||||
void _gdk_x11_cursor_display_finalize (GdkDisplay *display);
|
||||
|
||||
void _gdk_x11_surface_register_dnd (GdkSurface *window);
|
||||
|
||||
@@ -1145,7 +1145,6 @@ fetch_net_wm_check_window (GdkX11Screen *x11_screen)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
Window window;
|
||||
guint64 now;
|
||||
int error;
|
||||
|
||||
display = x11_screen->display;
|
||||
@@ -1155,11 +1154,6 @@ fetch_net_wm_check_window (GdkX11Screen *x11_screen)
|
||||
if (x11_screen->wmspec_check_window != None)
|
||||
return; /* already have it */
|
||||
|
||||
now = g_get_monotonic_time ();
|
||||
|
||||
if ((now - x11_screen->last_wmspec_check_time) / 1e6 < 15)
|
||||
return; /* we've checked recently */
|
||||
|
||||
window = get_net_supporting_wm_check (x11_screen, x11_screen->xroot_window);
|
||||
if (window == None)
|
||||
return;
|
||||
@@ -1184,7 +1178,6 @@ fetch_net_wm_check_window (GdkX11Screen *x11_screen)
|
||||
return;
|
||||
|
||||
x11_screen->wmspec_check_window = window;
|
||||
x11_screen->last_wmspec_check_time = now;
|
||||
x11_screen->need_refetch_net_supported = TRUE;
|
||||
x11_screen->need_refetch_wm_name = TRUE;
|
||||
|
||||
|
||||
@@ -48,7 +48,6 @@ struct _GdkX11Screen
|
||||
int xft_dpi;
|
||||
|
||||
/* Window manager */
|
||||
gint64 last_wmspec_check_time;
|
||||
Window wmspec_check_window;
|
||||
char *window_manager_name;
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ GDK_AVAILABLE_IN_ALL
|
||||
void gdk_x11_display_set_program_class (GdkDisplay *display,
|
||||
const char *program_class);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_16
|
||||
void gdk_x11_display_set_cursor_theme (GdkDisplay *display,
|
||||
const char *theme,
|
||||
const int size);
|
||||
|
||||
+1
-6
@@ -73,12 +73,7 @@ gdk_x11_deps = [
|
||||
]
|
||||
|
||||
libgdk_x11 = static_library('gdk-x11',
|
||||
sources: [
|
||||
gdkmarshal_h,
|
||||
gdkenum_h,
|
||||
gdkconfig,
|
||||
gdk_x11_sources,
|
||||
],
|
||||
sources: [ gdk_gen_headers, gdk_x11_sources ],
|
||||
include_directories: [ confinc, gdkinc, ],
|
||||
c_args: [
|
||||
'-DGTK_COMPILATION',
|
||||
|
||||
@@ -4013,7 +4013,7 @@ gsk_gl_render_job_visit_subsurface_node (GskGLRenderJob *job,
|
||||
/* Clear the area so we can see through */
|
||||
GskGLCommandBatch *batch;
|
||||
guint16 color[4];
|
||||
rgba_to_half (&(GdkRGBA){0,0,0,0}, color);
|
||||
rgba_to_half (&GDK_RGBA_TRANSPARENT, color);
|
||||
|
||||
batch = gsk_gl_command_queue_get_batch (job->command_queue);
|
||||
batch->draw.blend = 0;
|
||||
|
||||
+10
-1
@@ -907,6 +907,7 @@ gsk_gpu_device_lookup_glyph_image (GskGpuDevice *self,
|
||||
gsize atlas_x, atlas_y, padding;
|
||||
float subpixel_x, subpixel_y;
|
||||
PangoFont *scaled_font;
|
||||
cairo_hint_metrics_t hint_metrics;
|
||||
|
||||
cache = g_hash_table_lookup (priv->glyph_cache, &lookup);
|
||||
if (cache)
|
||||
@@ -918,7 +919,15 @@ gsk_gpu_device_lookup_glyph_image (GskGpuDevice *self,
|
||||
return cache->image;
|
||||
}
|
||||
|
||||
scaled_font = gsk_reload_font (font, scale, CAIRO_HINT_METRICS_DEFAULT, CAIRO_HINT_STYLE_DEFAULT, CAIRO_ANTIALIAS_DEFAULT);
|
||||
/* The combination of hint-style != none and hint-metrics == off
|
||||
* leads to broken rendering with some fonts.
|
||||
*/
|
||||
if (gsk_font_get_hint_style (font) != CAIRO_HINT_STYLE_NONE)
|
||||
hint_metrics = CAIRO_HINT_METRICS_ON;
|
||||
else
|
||||
hint_metrics = CAIRO_HINT_METRICS_DEFAULT;
|
||||
|
||||
scaled_font = gsk_reload_font (font, scale, hint_metrics, CAIRO_HINT_STYLE_DEFAULT, CAIRO_ANTIALIAS_DEFAULT);
|
||||
|
||||
subpixel_x = (flags & 3) / 4.f;
|
||||
subpixel_y = ((flags >> 2) & 3) / 4.f;
|
||||
|
||||
@@ -48,5 +48,5 @@ gsk_vulkan_descriptors_bind (GskVulkanDescriptors *self,
|
||||
GskVulkanDescriptors *previous,
|
||||
VkCommandBuffer vk_command_buffer)
|
||||
{
|
||||
return GSK_VULKAN_DESCRIPTORS_GET_CLASS (self)->bind (self, previous, vk_command_buffer);
|
||||
GSK_VULKAN_DESCRIPTORS_GET_CLASS (self)->bind (self, previous, vk_command_buffer);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "gdk/gdkdisplayprivate.h"
|
||||
#include "gdk/gdkvulkancontextprivate.h"
|
||||
#include "gdk/gdkprofilerprivate.h"
|
||||
|
||||
struct _GskVulkanDevice
|
||||
{
|
||||
@@ -949,6 +950,7 @@ gsk_vulkan_device_get_vk_pipeline (GskVulkanDevice *self,
|
||||
GdkDisplay *display;
|
||||
const char *version_string;
|
||||
char *vertex_shader_name, *fragment_shader_name;
|
||||
G_GNUC_UNUSED gint64 begin_time = GDK_PROFILER_CURRENT_TIME;
|
||||
|
||||
cache_key = (PipelineCacheKey) {
|
||||
.op_class = op_class,
|
||||
@@ -1125,6 +1127,10 @@ gsk_vulkan_device_get_vk_pipeline (GskVulkanDevice *self,
|
||||
NULL,
|
||||
&pipeline);
|
||||
|
||||
gdk_profiler_end_markf (begin_time,
|
||||
"Create Vulkan pipeline frag=%s vert=%s",
|
||||
fragment_shader_name, vertex_shader_name);
|
||||
|
||||
g_free (fragment_shader_name);
|
||||
g_free (vertex_shader_name);
|
||||
|
||||
|
||||
@@ -825,7 +825,7 @@ gsk_vulkan_image_new_for_dmabuf (GskVulkanDevice *device,
|
||||
self->vk_tiling = VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT;
|
||||
self->vk_format = vk_format;
|
||||
self->vk_pipeline_stage = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
|
||||
self->vk_image_layout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
self->vk_image_layout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
self->vk_access = 0;
|
||||
|
||||
res = vkCreateImage (vk_device,
|
||||
|
||||
+1
-1
@@ -556,7 +556,7 @@ gsk_standard_contour_init (GskContour *contour,
|
||||
gsize n_points,
|
||||
const gskpathop *ops,
|
||||
gsize n_ops,
|
||||
ptrdiff_t offset);
|
||||
gssize offset);
|
||||
|
||||
static void
|
||||
gsk_standard_contour_copy (const GskContour *contour,
|
||||
|
||||
+2
-1
@@ -227,7 +227,7 @@ get_t_by_bisection (const GskCurve *curve,
|
||||
t1 = 0;
|
||||
t2 = 1;
|
||||
|
||||
while (t1 < t2)
|
||||
do
|
||||
{
|
||||
t = (t1 + t2) / 2;
|
||||
if (t == t1 || t == t2)
|
||||
@@ -243,6 +243,7 @@ get_t_by_bisection (const GskCurve *curve,
|
||||
else
|
||||
t2 = t;
|
||||
}
|
||||
while (t1 < t2);
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
+68
-58
@@ -29,6 +29,7 @@
|
||||
#include "gskdebugprivate.h"
|
||||
#include "gskrendernodeprivate.h"
|
||||
#include "gdksurfaceprivate.h"
|
||||
#include "gdkrgbaprivate.h"
|
||||
|
||||
#include <graphene.h>
|
||||
|
||||
@@ -81,11 +82,12 @@ find_texture_transform (GskTransform *transform)
|
||||
}
|
||||
|
||||
static GdkTexture *
|
||||
find_texture_to_attach (GskOffload *self,
|
||||
const GskRenderNode *subsurface_node,
|
||||
graphene_rect_t *out_clip,
|
||||
GdkTextureTransform *out_texture_transform,
|
||||
gboolean *out_lightbox)
|
||||
find_texture_to_attach (GskOffload *self,
|
||||
const GskRenderNode *subsurface_node,
|
||||
graphene_rect_t *out_texture_rect,
|
||||
graphene_rect_t *out_source_rect,
|
||||
gboolean *has_background,
|
||||
GdkTextureTransform *out_texture_transform)
|
||||
{
|
||||
GdkSubsurface *subsurface;
|
||||
const GskRenderNode *node;
|
||||
@@ -94,8 +96,8 @@ find_texture_to_attach (GskOffload *self,
|
||||
GskTransform *transform = NULL;
|
||||
GdkTexture *ret = NULL;
|
||||
|
||||
*has_background = FALSE;
|
||||
*out_texture_transform = GDK_TEXTURE_TRANSFORM_NORMAL;
|
||||
*out_lightbox = FALSE;
|
||||
|
||||
subsurface = gsk_subsurface_node_get_subsurface (subsurface_node);
|
||||
node = subsurface_node;
|
||||
@@ -105,10 +107,13 @@ find_texture_to_attach (GskOffload *self,
|
||||
switch ((int) GSK_RENDER_NODE_TYPE (node))
|
||||
{
|
||||
case GSK_DEBUG_NODE:
|
||||
case GSK_SUBSURFACE_NODE:
|
||||
node = gsk_debug_node_get_child (node);
|
||||
break;
|
||||
|
||||
case GSK_SUBSURFACE_NODE:
|
||||
node = gsk_subsurface_node_get_child (node);
|
||||
break;
|
||||
|
||||
case GSK_CONTAINER_NODE:
|
||||
if (gsk_container_node_get_n_children (node) == 1)
|
||||
{
|
||||
@@ -117,22 +122,22 @@ find_texture_to_attach (GskOffload *self,
|
||||
}
|
||||
else if (gsk_container_node_get_n_children (node) == 2)
|
||||
{
|
||||
GskRenderNode *child;
|
||||
GskRenderNode *child = gsk_container_node_get_child (node, 0);
|
||||
graphene_rect_t bounds;
|
||||
|
||||
child = gsk_container_node_get_child (node, 0);
|
||||
gsk_transform_transform_bounds (transform, &child->bounds, &bounds);
|
||||
if (GSK_RENDER_NODE_TYPE (child) == GSK_COLOR_NODE &&
|
||||
gsk_rect_equal (&child->bounds, &subsurface_node->bounds) &&
|
||||
gdk_rgba_equal (gsk_color_node_get_color (child), &(GdkRGBA) { 0, 0, 0, 1 }))
|
||||
gsk_rect_equal (&bounds, &subsurface_node->bounds) &&
|
||||
gdk_rgba_equal (gsk_color_node_get_color (child), &GDK_RGBA_BLACK))
|
||||
{
|
||||
g_print ("found lightbox\n");
|
||||
*out_lightbox = TRUE;
|
||||
*has_background = TRUE;
|
||||
node = gsk_container_node_get_child (node, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (self->surface), OFFLOAD,
|
||||
"Can't offload subsurface %p: too much content, container with %d children",
|
||||
"[%p] 🗙 Too much content, container with %d children",
|
||||
subsurface, gsk_container_node_get_n_children (node));
|
||||
goto out;
|
||||
|
||||
@@ -144,7 +149,7 @@ find_texture_to_attach (GskOffload *self,
|
||||
{
|
||||
char *s = gsk_transform_to_string (t);
|
||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (self->surface), OFFLOAD,
|
||||
"Can't offload subsurface %p: transform %s is not just scale/translate",
|
||||
"[%p] 🗙 Transform %s is not just scale/translate",
|
||||
subsurface, s);
|
||||
g_free (s);
|
||||
goto out;
|
||||
@@ -172,12 +177,13 @@ find_texture_to_attach (GskOffload *self,
|
||||
if (!gsk_rect_intersection (c, &clip, &clip))
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (self->surface), OFFLOAD,
|
||||
"Can't offload subsurface %p: empty clip", subsurface);
|
||||
"[%p] 🗙 Empty clip", subsurface);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gsk_transform_transform_bounds (transform, &node->bounds, out_texture_rect);
|
||||
clip = *c;
|
||||
has_clip = TRUE;
|
||||
}
|
||||
@@ -201,17 +207,18 @@ find_texture_to_attach (GskOffload *self,
|
||||
|
||||
gsk_rect_intersection (&node->bounds, &clip, &clip);
|
||||
|
||||
out_clip->origin.x = (clip.origin.x - dx) * sx;
|
||||
out_clip->origin.y = (clip.origin.y - dy) * sy;
|
||||
out_clip->size.width = clip.size.width * sx;
|
||||
out_clip->size.height = clip.size.height * sy;
|
||||
out_source_rect->origin.x = (clip.origin.x - dx) * sx;
|
||||
out_source_rect->origin.y = (clip.origin.y - dy) * sy;
|
||||
out_source_rect->size.width = clip.size.width * sx;
|
||||
out_source_rect->size.height = clip.size.height * sy;
|
||||
}
|
||||
else
|
||||
{
|
||||
out_clip->origin.x = 0;
|
||||
out_clip->origin.y = 0;
|
||||
out_clip->size.width = gdk_texture_get_width (texture);
|
||||
out_clip->size.height = gdk_texture_get_height (texture);
|
||||
gsk_transform_transform_bounds (transform, &node->bounds, out_texture_rect);
|
||||
out_source_rect->origin.x = 0;
|
||||
out_source_rect->origin.y = 0;
|
||||
out_source_rect->size.width = gdk_texture_get_width (texture);
|
||||
out_source_rect->size.height = gdk_texture_get_height (texture);
|
||||
}
|
||||
|
||||
ret = texture;
|
||||
@@ -220,7 +227,7 @@ find_texture_to_attach (GskOffload *self,
|
||||
|
||||
default:
|
||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (self->surface), OFFLOAD,
|
||||
"Can't offload subsurface %p: Only textures supported but found %s",
|
||||
"[%p] 🗙 Only textures supported (found %s)",
|
||||
subsurface, g_type_name_from_instance ((GTypeInstance *) node));
|
||||
goto out;
|
||||
}
|
||||
@@ -469,7 +476,8 @@ visit_node (GskOffload *self,
|
||||
|
||||
if (info->can_raise)
|
||||
{
|
||||
if (gsk_rect_intersects (&transformed_bounds, &info->dest))
|
||||
if (gsk_rect_intersects (&transformed_bounds, &info->texture_rect) ||
|
||||
gsk_rect_intersects (&transformed_bounds, &info->background_rect))
|
||||
{
|
||||
GskRenderNodeType type = GSK_RENDER_NODE_TYPE (node);
|
||||
|
||||
@@ -480,7 +488,7 @@ visit_node (GskOffload *self,
|
||||
type != GSK_DEBUG_NODE)
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (self->surface), OFFLOAD,
|
||||
"Can't raise subsurface %p because a %s overlaps",
|
||||
"[%p] Lowering because a %s overlaps",
|
||||
info->subsurface,
|
||||
g_type_name_from_instance ((GTypeInstance *) node));
|
||||
info->can_raise = FALSE;
|
||||
@@ -494,7 +502,6 @@ visit_node (GskOffload *self,
|
||||
switch (GSK_RENDER_NODE_TYPE (node))
|
||||
{
|
||||
case GSK_BORDER_NODE:
|
||||
case GSK_COLOR_NODE:
|
||||
case GSK_CONIC_GRADIENT_NODE:
|
||||
case GSK_LINEAR_GRADIENT_NODE:
|
||||
case GSK_REPEATING_LINEAR_GRADIENT_NODE:
|
||||
@@ -504,6 +511,7 @@ visit_node (GskOffload *self,
|
||||
case GSK_TEXTURE_NODE:
|
||||
case GSK_TEXTURE_SCALE_NODE:
|
||||
case GSK_CAIRO_NODE:
|
||||
case GSK_COLOR_NODE:
|
||||
case GSK_INSET_SHADOW_NODE:
|
||||
case GSK_OUTSET_SHADOW_NODE:
|
||||
case GSK_GL_SHADER_NODE:
|
||||
@@ -517,7 +525,7 @@ visit_node (GskOffload *self,
|
||||
case GSK_MASK_NODE:
|
||||
case GSK_FILL_NODE:
|
||||
case GSK_STROKE_NODE:
|
||||
break;
|
||||
break;
|
||||
|
||||
case GSK_CLIP_NODE:
|
||||
{
|
||||
@@ -623,29 +631,33 @@ complex_clip:
|
||||
if (info == NULL)
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (self->surface), OFFLOAD,
|
||||
"Can't offload: unknown subsurface %p",
|
||||
"[%p] 🗙 Unknown subsurface",
|
||||
subsurface);
|
||||
}
|
||||
else if (!self->current_clip->is_fully_contained)
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (self->surface), OFFLOAD,
|
||||
"Can't offload subsurface %p: clipped",
|
||||
"[%p] 🗙 Clipped",
|
||||
subsurface);
|
||||
}
|
||||
else if (gsk_transform_get_category (transform) < GSK_TRANSFORM_CATEGORY_2D_AFFINE)
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (self->surface), OFFLOAD,
|
||||
"Can't offload subsurface %p: non-affine transform",
|
||||
"[%p] 🗙 Non-affine transform",
|
||||
subsurface);
|
||||
}
|
||||
else
|
||||
{
|
||||
info->texture = find_texture_to_attach (self, node, &info->source, &info->transform, &info->lightbox);
|
||||
gboolean has_background;
|
||||
|
||||
info->texture = find_texture_to_attach (self, node, &info->texture_rect, &info->source_rect, &has_background, &info->transform);
|
||||
if (info->texture)
|
||||
{
|
||||
info->can_offload = TRUE;
|
||||
info->can_raise = TRUE;
|
||||
transform_bounds (self, &node->bounds, &info->dest);
|
||||
transform_bounds (self, &info->texture_rect, &info->texture_rect);
|
||||
info->has_background = has_background;
|
||||
transform_bounds (self, &node->bounds, &info->background_rect);
|
||||
info->place_above = self->last_info ? self->last_info->subsurface : NULL;
|
||||
self->last_info = info;
|
||||
}
|
||||
@@ -668,7 +680,6 @@ gsk_offload_new (GdkSurface *surface,
|
||||
GskRenderNode *root,
|
||||
cairo_region_t *diff)
|
||||
{
|
||||
GdkDisplay *display = gdk_surface_get_display (surface);
|
||||
GskOffload *self;
|
||||
|
||||
self = g_new0 (GskOffload, 1);
|
||||
@@ -685,9 +696,12 @@ gsk_offload_new (GdkSurface *surface,
|
||||
for (gsize i = 0; i < self->n_subsurfaces; i++)
|
||||
{
|
||||
GskOffloadInfo *info = &self->subsurfaces[i];
|
||||
graphene_rect_t rect;
|
||||
|
||||
info->subsurface = gdk_surface_get_subsurface (self->surface, i);
|
||||
info->was_offloaded = gdk_subsurface_get_texture (info->subsurface) != NULL;
|
||||
info->was_above = gdk_subsurface_is_above_parent (info->subsurface);
|
||||
info->had_background = gdk_subsurface_get_background_rect (info->subsurface, &rect);
|
||||
}
|
||||
|
||||
if (self->n_subsurfaces > 0)
|
||||
@@ -704,27 +718,28 @@ gsk_offload_new (GdkSurface *surface,
|
||||
for (gsize i = 0; i < self->n_subsurfaces; i++)
|
||||
{
|
||||
GskOffloadInfo *info = &self->subsurfaces[i];
|
||||
graphene_rect_t old_dest;
|
||||
graphene_rect_t old_bounds;
|
||||
graphene_rect_t bounds;
|
||||
|
||||
gdk_subsurface_get_dest (info->subsurface, &old_dest);
|
||||
gdk_subsurface_get_bounds (info->subsurface, &old_bounds);
|
||||
|
||||
if (info->can_offload)
|
||||
{
|
||||
if (info->can_raise)
|
||||
info->is_offloaded = gdk_subsurface_attach (info->subsurface,
|
||||
info->texture,
|
||||
&info->source,
|
||||
&info->dest,
|
||||
&info->source_rect,
|
||||
&info->texture_rect,
|
||||
info->transform,
|
||||
info->lightbox,
|
||||
info->has_background ? &info->background_rect : NULL,
|
||||
TRUE, NULL);
|
||||
else
|
||||
info->is_offloaded = gdk_subsurface_attach (info->subsurface,
|
||||
info->texture,
|
||||
&info->source,
|
||||
&info->dest,
|
||||
&info->source_rect,
|
||||
&info->texture_rect,
|
||||
info->transform,
|
||||
info->lightbox,
|
||||
info->has_background ? &info->background_rect : NULL,
|
||||
info->place_above != NULL,
|
||||
info->place_above);
|
||||
}
|
||||
@@ -732,34 +747,29 @@ gsk_offload_new (GdkSurface *surface,
|
||||
{
|
||||
info->is_offloaded = FALSE;
|
||||
if (info->was_offloaded)
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (display, OFFLOAD, "Hiding subsurface %p", info->subsurface);
|
||||
gdk_subsurface_detach (info->subsurface);
|
||||
}
|
||||
gdk_subsurface_detach (info->subsurface);
|
||||
}
|
||||
|
||||
if (info->is_offloaded && gdk_subsurface_is_above_parent (info->subsurface))
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (display, OFFLOAD, "Raising subsurface %p", info->subsurface);
|
||||
info->is_above = TRUE;
|
||||
}
|
||||
info->is_above = info->is_offloaded && gdk_subsurface_is_above_parent (info->subsurface);
|
||||
|
||||
gdk_subsurface_get_bounds (info->subsurface, &bounds);
|
||||
|
||||
if (info->is_offloaded != info->was_offloaded ||
|
||||
info->is_above != info->was_above ||
|
||||
(info->is_offloaded && !gsk_rect_equal (&info->dest, &old_dest)))
|
||||
(info->is_offloaded && !gsk_rect_equal (&bounds, &old_bounds)))
|
||||
{
|
||||
/* We changed things, need to invalidate everything */
|
||||
cairo_rectangle_int_t int_dest;
|
||||
cairo_rectangle_int_t rect;
|
||||
|
||||
if (info->is_offloaded)
|
||||
{
|
||||
gsk_rect_to_cairo_grow (&info->dest, &int_dest);
|
||||
cairo_region_union_rectangle (diff, &int_dest);
|
||||
gsk_rect_to_cairo_grow (&bounds, &rect);
|
||||
cairo_region_union_rectangle (diff, &rect);
|
||||
}
|
||||
if (info->was_offloaded)
|
||||
{
|
||||
gsk_rect_to_cairo_grow (&old_dest, &int_dest);
|
||||
cairo_region_union_rectangle (diff, &int_dest);
|
||||
gsk_rect_to_cairo_grow (&old_bounds, &rect);
|
||||
cairo_region_union_rectangle (diff, &rect);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,10 +31,10 @@ typedef struct
|
||||
GdkSubsurface *subsurface;
|
||||
GdkTexture *texture;
|
||||
GdkSubsurface *place_above;
|
||||
graphene_rect_t dest;
|
||||
graphene_rect_t source;
|
||||
graphene_rect_t texture_rect;
|
||||
graphene_rect_t source_rect;
|
||||
GdkTextureTransform transform;
|
||||
gboolean lightbox;
|
||||
graphene_rect_t background_rect;
|
||||
|
||||
guint was_offloaded : 1;
|
||||
guint can_offload : 1;
|
||||
@@ -43,6 +43,9 @@ typedef struct
|
||||
guint was_above : 1;
|
||||
guint can_raise : 1;
|
||||
guint is_above : 1;
|
||||
|
||||
guint had_background : 1;
|
||||
guint has_background : 1;
|
||||
} GskOffloadInfo;
|
||||
|
||||
GskOffload * gsk_offload_new (GdkSurface *surface,
|
||||
|
||||
+22
-2
@@ -1,5 +1,4 @@
|
||||
/* GSK - The GTK Scene Kit
|
||||
*
|
||||
* Copyright 2016 Endless
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
@@ -685,6 +684,26 @@ get_renderer_for_vulkan (GdkSurface *surface)
|
||||
#endif
|
||||
}
|
||||
|
||||
static gboolean
|
||||
vulkan_friendly_platform (GdkSurface *surface)
|
||||
{
|
||||
#ifdef GDK_WINDOWING_WAYLAND
|
||||
if (GDK_IS_WAYLAND_DISPLAY (gdk_surface_get_display (surface)))
|
||||
return TRUE;
|
||||
#endif
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static GType
|
||||
get_renderer_for_vulkan_friendly_platform (GdkSurface *surface)
|
||||
{
|
||||
if (vulkan_friendly_platform (surface))
|
||||
return get_renderer_for_vulkan (surface);
|
||||
|
||||
return G_TYPE_INVALID;
|
||||
}
|
||||
|
||||
static GType
|
||||
get_renderer_for_gles2 (GdkSurface *surface)
|
||||
{
|
||||
@@ -703,9 +722,10 @@ static struct {
|
||||
{ get_renderer_for_display },
|
||||
{ get_renderer_for_env_var },
|
||||
{ get_renderer_for_backend },
|
||||
{ get_renderer_for_vulkan_friendly_platform },
|
||||
{ get_renderer_for_gl },
|
||||
{ get_renderer_for_gles2 },
|
||||
{ get_renderer_for_vulkan },
|
||||
{ get_renderer_for_gles2 },
|
||||
{ get_renderer_fallback },
|
||||
};
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "gdk/gdksubsurfaceprivate.h"
|
||||
#include "gdk/gdktextureprivate.h"
|
||||
#include "gdk/gdktexturedownloaderprivate.h"
|
||||
#include "gdk/gdkrgbaprivate.h"
|
||||
|
||||
#include <cairo.h>
|
||||
#ifdef CAIRO_HAS_SVG_SURFACE
|
||||
|
||||
@@ -1020,7 +1020,7 @@ gtk_css_tokenizer_read_ident_like (GtkCssTokenizer *tokenizer,
|
||||
{
|
||||
gtk_css_tokenizer_read_name (tokenizer);
|
||||
|
||||
if (*tokenizer->data == '(')
|
||||
if (gtk_css_tokenizer_remaining (tokenizer) > 0 && *tokenizer->data == '(')
|
||||
{
|
||||
gtk_css_tokenizer_consume_ascii (tokenizer);
|
||||
if (g_ascii_strcasecmp (tokenizer->name_buffer->str, "url") == 0)
|
||||
|
||||
+27
-7
@@ -27,6 +27,8 @@
|
||||
#include "gtktextviewprivate.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "gtkcsscolorvalueprivate.h"
|
||||
#include "gdk/gdkrgbaprivate.h"
|
||||
#include "gtkcssshadowvalueprivate.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
@@ -96,6 +98,11 @@ gsk_pango_renderer_draw_glyph_item (PangoRenderer *renderer,
|
||||
{
|
||||
GskPangoRenderer *crenderer = (GskPangoRenderer *) (renderer);
|
||||
GdkRGBA color;
|
||||
gboolean has_shadow = FALSE;
|
||||
|
||||
if (crenderer->shadow_style)
|
||||
has_shadow = gtk_css_shadow_value_push_snapshot (crenderer->shadow_style->font->text_shadow,
|
||||
crenderer->snapshot);
|
||||
|
||||
get_color (crenderer, PANGO_RENDER_PART_FOREGROUND, &color);
|
||||
|
||||
@@ -105,6 +112,9 @@ gsk_pango_renderer_draw_glyph_item (PangoRenderer *renderer,
|
||||
&color,
|
||||
(float) x / PANGO_SCALE,
|
||||
(float) y / PANGO_SCALE);
|
||||
|
||||
if (has_shadow)
|
||||
gtk_snapshot_pop (crenderer->snapshot);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -201,7 +211,7 @@ gsk_pango_renderer_draw_error_underline (PangoRenderer *renderer,
|
||||
gtk_snapshot_append_color (crenderer->snapshot, &rgba, &dot.bounds);
|
||||
gtk_snapshot_pop (crenderer->snapshot);
|
||||
gtk_snapshot_append_color (crenderer->snapshot,
|
||||
&(GdkRGBA) { 0.f, 0.f, 0.f, 0.f },
|
||||
&GDK_RGBA_TRANSPARENT,
|
||||
&GRAPHENE_RECT_INIT (xx, yy, 1.5 * hh, hh));
|
||||
|
||||
gtk_snapshot_pop (crenderer->snapshot);
|
||||
@@ -342,20 +352,20 @@ gsk_pango_renderer_prepare_run (PangoRenderer *renderer,
|
||||
GTK_IS_TEXT_VIEW (crenderer->widget))
|
||||
{
|
||||
GtkCssNode *node;
|
||||
GtkCssValue *value;
|
||||
GtkCssStyle *style;
|
||||
|
||||
node = gtk_text_view_get_selection_node ((GtkTextView *)crenderer->widget);
|
||||
value = gtk_css_node_get_style (node)->core->color;
|
||||
fg_rgba = gtk_css_color_value_get_rgba (value);
|
||||
style = gtk_css_node_get_style (node);
|
||||
fg_rgba = gtk_css_color_value_get_rgba (style->core->color);
|
||||
}
|
||||
else if (crenderer->state == GSK_PANGO_RENDERER_CURSOR && gtk_widget_has_focus (crenderer->widget))
|
||||
{
|
||||
GtkCssNode *node;
|
||||
GtkCssValue *value;
|
||||
GtkCssStyle *style;
|
||||
|
||||
node = gtk_widget_get_css_node (crenderer->widget);
|
||||
value = gtk_css_node_get_style (node)->background->background_color;
|
||||
fg_rgba = gtk_css_color_value_get_rgba (value);
|
||||
style = gtk_css_node_get_style (node);
|
||||
fg_rgba = gtk_css_color_value_get_rgba (style->background->background_color);
|
||||
}
|
||||
else
|
||||
fg_rgba = appearance->fg_rgba;
|
||||
@@ -381,6 +391,15 @@ gsk_pango_renderer_prepare_run (PangoRenderer *renderer,
|
||||
}
|
||||
else
|
||||
text_renderer_set_rgba (crenderer, PANGO_RENDER_PART_UNDERLINE, fg_rgba);
|
||||
|
||||
crenderer->shadow_style = NULL;
|
||||
if (GTK_IS_TEXT_VIEW (crenderer->widget))
|
||||
{
|
||||
if (crenderer->state == GSK_PANGO_RENDERER_SELECTED)
|
||||
crenderer->shadow_style = gtk_css_node_get_style (gtk_text_view_get_selection_node ((GtkTextView *)crenderer->widget));
|
||||
else if (crenderer->state != GSK_PANGO_RENDERER_CURSOR)
|
||||
crenderer->shadow_style = gtk_css_node_get_style (gtk_widget_get_css_node (crenderer->widget));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -438,6 +457,7 @@ gsk_pango_renderer_release (GskPangoRenderer *renderer)
|
||||
{
|
||||
renderer->widget = NULL;
|
||||
renderer->snapshot = NULL;
|
||||
renderer->shadow_style = NULL;
|
||||
|
||||
if (renderer->error_color)
|
||||
{
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include <pango/pango.h>
|
||||
#include "gtk/gtksnapshot.h"
|
||||
#include "gtk/gtkcssstyleprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -58,6 +59,7 @@ struct _GskPangoRenderer
|
||||
GtkWidget *widget;
|
||||
GtkSnapshot *snapshot;
|
||||
const GdkRGBA *fg_color;
|
||||
GtkCssStyle *shadow_style;
|
||||
|
||||
/* Error underline color for this widget */
|
||||
GdkRGBA *error_color;
|
||||
|
||||
@@ -990,11 +990,13 @@ GtkActionMuxer *
|
||||
gtk_application_get_parent_muxer_for_window (GtkWindow *window)
|
||||
{
|
||||
GtkApplication *application = gtk_window_get_application (window);
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
GtkApplicationPrivate *priv;
|
||||
|
||||
if (!application)
|
||||
return NULL;
|
||||
|
||||
priv = gtk_application_get_instance_private (application);
|
||||
|
||||
return priv->muxer;
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -2695,8 +2695,10 @@ gtk_builder_value_from_string_type (GtkBuilder *builder,
|
||||
{
|
||||
GtkShortcutAction *action = gtk_shortcut_action_parse_builder (builder, string, error);
|
||||
|
||||
/* Works for success and failure (NULL) case */
|
||||
g_value_take_object (value, action);
|
||||
if (action)
|
||||
g_value_take_object (value, action);
|
||||
else
|
||||
ret = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1006,7 +1006,7 @@ gtk_check_button_set_group (GtkCheckButton *self,
|
||||
GtkCheckButton *group)
|
||||
{
|
||||
GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (self);
|
||||
GtkCheckButtonPrivate *group_priv = gtk_check_button_get_instance_private (group);
|
||||
GtkCheckButtonPrivate *group_priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_CHECK_BUTTON (self));
|
||||
g_return_if_fail (self != group);
|
||||
@@ -1037,6 +1037,8 @@ gtk_check_button_set_group (GtkCheckButton *self,
|
||||
if (priv->group_next == group)
|
||||
return;
|
||||
|
||||
group_priv = gtk_check_button_get_instance_private (group);
|
||||
|
||||
priv->group_prev = NULL;
|
||||
if (group_priv->group_prev)
|
||||
{
|
||||
|
||||
+61
-11
@@ -541,9 +541,9 @@ match_any (const GtkCssSelector *selector,
|
||||
|
||||
#undef GTK_CSS_CHANGE_ANY
|
||||
#define GTK_CSS_CHANGE_ANY 0
|
||||
DEFINE_SIMPLE_SELECTOR(any, ANY, print_any, match_any,
|
||||
gtk_css_selector_default_hash_one, gtk_css_selector_default_compare_one,
|
||||
FALSE, FALSE, FALSE, TRUE)
|
||||
DEFINE_SIMPLE_SELECTOR (any, ANY, print_any, match_any,
|
||||
gtk_css_selector_default_hash_one, gtk_css_selector_default_compare_one,
|
||||
FALSE, FALSE, FALSE, TRUE)
|
||||
#undef GTK_CSS_CHANGE_ANY
|
||||
|
||||
/* NAME */
|
||||
@@ -575,7 +575,7 @@ comp_name (const GtkCssSelector *a,
|
||||
return a->name.name - b->name.name;
|
||||
}
|
||||
|
||||
DEFINE_SIMPLE_SELECTOR(name, NAME, print_name, match_name, hash_name, comp_name, FALSE, FALSE, TRUE, FALSE)
|
||||
DEFINE_SIMPLE_SELECTOR (name, NAME, print_name, match_name, hash_name, comp_name, FALSE, FALSE, TRUE, FALSE)
|
||||
|
||||
/* CLASS */
|
||||
|
||||
@@ -612,7 +612,7 @@ comp_class (const GtkCssSelector *a,
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_SIMPLE_SELECTOR(class, CLASS, print_class, match_class, hash_class, comp_class, FALSE, TRUE, FALSE, FALSE)
|
||||
DEFINE_SIMPLE_SELECTOR (class, CLASS, print_class, match_class, hash_class, comp_class, FALSE, TRUE, FALSE, FALSE)
|
||||
|
||||
/* ID */
|
||||
|
||||
@@ -644,7 +644,7 @@ comp_id (const GtkCssSelector *a,
|
||||
return a->id.name - b->id.name;
|
||||
}
|
||||
|
||||
DEFINE_SIMPLE_SELECTOR(id, ID, print_id, match_id, hash_id, comp_id, TRUE, FALSE, FALSE, FALSE)
|
||||
DEFINE_SIMPLE_SELECTOR (id, ID, print_id, match_id, hash_id, comp_id, TRUE, FALSE, FALSE, FALSE)
|
||||
|
||||
/* PSEUDOCLASS FOR STATE */
|
||||
static void
|
||||
@@ -700,8 +700,8 @@ change_pseudoclass_state (const GtkCssSelector *selector)
|
||||
}
|
||||
|
||||
#define GTK_CSS_CHANGE_PSEUDOCLASS_STATE change_pseudoclass_state (selector)
|
||||
DEFINE_SIMPLE_SELECTOR(pseudoclass_state, PSEUDOCLASS_STATE, print_pseudoclass_state,
|
||||
match_pseudoclass_state, hash_pseudoclass_state, comp_pseudoclass_state,
|
||||
DEFINE_SIMPLE_SELECTOR (pseudoclass_state, PSEUDOCLASS_STATE, print_pseudoclass_state,
|
||||
match_pseudoclass_state, hash_pseudoclass_state, comp_pseudoclass_state,
|
||||
FALSE, TRUE, FALSE, TRUE)
|
||||
#undef GTK_CSS_CHANGE_PSEUDOCLASS_STATE
|
||||
|
||||
@@ -888,10 +888,52 @@ change_pseudoclass_position (const GtkCssSelector *selector)
|
||||
}
|
||||
|
||||
#define GTK_CSS_CHANGE_PSEUDOCLASS_POSITION change_pseudoclass_position(selector)
|
||||
DEFINE_SIMPLE_SELECTOR(pseudoclass_position, PSEUDOCLASS_POSITION, print_pseudoclass_position,
|
||||
match_pseudoclass_position, hash_pseudoclass_position, comp_pseudoclass_position,
|
||||
FALSE, TRUE, FALSE, TRUE)
|
||||
DEFINE_SIMPLE_SELECTOR (pseudoclass_position, PSEUDOCLASS_POSITION, print_pseudoclass_position,
|
||||
match_pseudoclass_position, hash_pseudoclass_position, comp_pseudoclass_position,
|
||||
FALSE, TRUE, FALSE, TRUE)
|
||||
#undef GTK_CSS_CHANGE_PSEUDOCLASS_POSITION
|
||||
|
||||
/* PSEUDOCLASS FOR ROOT */
|
||||
|
||||
static void
|
||||
print_pseudoclass_root (const GtkCssSelector *selector,
|
||||
GString *string)
|
||||
{
|
||||
g_string_append (string, ":root");
|
||||
}
|
||||
|
||||
static gboolean
|
||||
match_pseudoclass_root (const GtkCssSelector *selector,
|
||||
GtkCssNode *node)
|
||||
{
|
||||
return gtk_css_node_get_parent (node) == NULL;
|
||||
}
|
||||
|
||||
static guint
|
||||
hash_pseudoclass_root (const GtkCssSelector *selector)
|
||||
{
|
||||
return GPOINTER_TO_UINT (selector->class);
|
||||
}
|
||||
|
||||
static int
|
||||
comp_pseudoclass_root (const GtkCssSelector *a,
|
||||
const GtkCssSelector *b)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static GtkCssChange
|
||||
change_pseudoclass_root (const GtkCssSelector *selector)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define GTK_CSS_CHANGE_PSEUDOCLASS_ROOT change_pseudoclass_root(selector)
|
||||
DEFINE_SIMPLE_SELECTOR (pseudoclass_root, PSEUDOCLASS_ROOT, print_pseudoclass_root,
|
||||
match_pseudoclass_root, hash_pseudoclass_root, comp_pseudoclass_root,
|
||||
FALSE, TRUE, FALSE, TRUE)
|
||||
#undef GTK_CSS_CHANGE_PSEUDOCLASS_ROOT
|
||||
|
||||
/* API */
|
||||
|
||||
static guint
|
||||
@@ -1267,6 +1309,7 @@ gtk_css_selector_parse_selector_pseudo_class (GtkCssParser *parser,
|
||||
PositionType position_type;
|
||||
int position_a;
|
||||
int position_b;
|
||||
gboolean is_root;
|
||||
} pseudo_classes[] = {
|
||||
{ "first-child", 0, POSITION_FORWARD, 0, 1 },
|
||||
{ "last-child", 0, POSITION_BACKWARD, 0, 1 },
|
||||
@@ -1283,6 +1326,7 @@ gtk_css_selector_parse_selector_pseudo_class (GtkCssParser *parser,
|
||||
{ "checked", GTK_STATE_FLAG_CHECKED, },
|
||||
{ "focus-visible", GTK_STATE_FLAG_FOCUS_VISIBLE, },
|
||||
{ "focus-within", GTK_STATE_FLAG_FOCUS_WITHIN, },
|
||||
{ "root", 0, 0, 0, 0, TRUE },
|
||||
};
|
||||
guint i;
|
||||
|
||||
@@ -1297,6 +1341,12 @@ gtk_css_selector_parse_selector_pseudo_class (GtkCssParser *parser,
|
||||
selector);
|
||||
selector->state.state = pseudo_classes[i].state_flag;
|
||||
}
|
||||
else if (pseudo_classes[i].is_root)
|
||||
{
|
||||
selector = gtk_css_selector_new (negate ? >K_CSS_SELECTOR_NOT_PSEUDOCLASS_ROOT
|
||||
: >K_CSS_SELECTOR_PSEUDOCLASS_ROOT,
|
||||
selector);
|
||||
}
|
||||
else
|
||||
{
|
||||
selector = gtk_css_selector_new (negate ? >K_CSS_SELECTOR_NOT_PSEUDOCLASS_POSITION
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "gsk/gskcairoblurprivate.h"
|
||||
#include "gsk/gskroundedrectprivate.h"
|
||||
#include "gdk/gdkrgbaprivate.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
|
||||
@@ -1222,6 +1222,15 @@ gtk_editable_delegate_get_property (GObject *object,
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* Note that the widget which is the delegate *must* be a direct child of
|
||||
* this widget, otherwise your implementation of [vfunc@Gtk.Accessible.get_platform_state]
|
||||
* might not even be called, as the platform change will originate from
|
||||
* the parent of the delegate, and, as a result, will not work properly.
|
||||
*
|
||||
* So, if you can't ensure the direct child condition, you should give the
|
||||
* delegate the %GTK_ACCESSIBLE_ROLE_TEXT_BOX role, or you can
|
||||
* change your tree to allow this function to work.
|
||||
*
|
||||
* Since: 4.10
|
||||
*/
|
||||
gboolean
|
||||
|
||||
@@ -1852,4 +1852,21 @@ typedef enum { /*< prefix=GTK_POPOVER_MENU >*/
|
||||
GTK_POPOVER_MENU_NESTED = 1 << 0
|
||||
} GtkPopoverMenuFlags;
|
||||
|
||||
/**
|
||||
* GtkFontRendering:
|
||||
* @GTK_FONT_RENDERING_AUTOMATIC: Set up font rendering automatically,
|
||||
* taking factors like screen resolution and scale into account
|
||||
* @GTK_FONT_RENDERING_MANUAL: Follow low-level font-related settings
|
||||
* when configuring font rendering
|
||||
*
|
||||
* Values for the [property@Gtk.Settings:gtk-font-rendering] setting
|
||||
* that influence how GTK renders fonts.
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
typedef enum {
|
||||
GTK_FONT_RENDERING_AUTOMATIC,
|
||||
GTK_FONT_RENDERING_MANUAL,
|
||||
} GtkFontRendering;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
+35
-26
@@ -156,7 +156,8 @@
|
||||
|
||||
typedef struct {
|
||||
GdkGLTextureBuilder *builder;
|
||||
GdkTexture *holder;
|
||||
GdkTexture *gl_texture;
|
||||
GdkTexture *dmabuf_texture;
|
||||
} Texture;
|
||||
|
||||
typedef struct {
|
||||
@@ -415,16 +416,20 @@ delete_one_texture (gpointer data)
|
||||
Texture *texture = data;
|
||||
guint id;
|
||||
|
||||
if (texture->holder)
|
||||
gdk_gl_texture_release (GDK_GL_TEXTURE (texture->holder));
|
||||
if (texture->gl_texture)
|
||||
{
|
||||
gdk_gl_texture_release (GDK_GL_TEXTURE (texture->gl_texture));
|
||||
texture->gl_texture = NULL;
|
||||
}
|
||||
|
||||
id = gdk_gl_texture_builder_get_id (texture->builder);
|
||||
if (id != 0)
|
||||
glDeleteTextures (1, &id);
|
||||
|
||||
g_object_unref (texture->builder);
|
||||
g_clear_object (&texture->builder);
|
||||
|
||||
g_free (texture);
|
||||
if (texture->gl_texture == NULL && texture->dmabuf_texture == NULL)
|
||||
g_free (texture);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -449,7 +454,7 @@ gtk_gl_area_ensure_texture (GtkGLArea *area)
|
||||
link = l;
|
||||
l = l->next;
|
||||
|
||||
if (texture->holder)
|
||||
if (texture->gl_texture)
|
||||
continue;
|
||||
|
||||
priv->textures = g_list_delete_link (priv->textures, link);
|
||||
@@ -466,7 +471,8 @@ gtk_gl_area_ensure_texture (GtkGLArea *area)
|
||||
GLuint id;
|
||||
|
||||
priv->texture = g_new (Texture, 1);
|
||||
priv->texture->holder = NULL;
|
||||
priv->texture->gl_texture = NULL;
|
||||
priv->texture->dmabuf_texture = NULL;
|
||||
|
||||
priv->texture->builder = gdk_gl_texture_builder_new ();
|
||||
gdk_gl_texture_builder_set_context (priv->texture->builder, priv->context);
|
||||
@@ -524,7 +530,7 @@ gtk_gl_area_allocate_texture (GtkGLArea *area)
|
||||
if (priv->texture == NULL)
|
||||
return;
|
||||
|
||||
g_assert (priv->texture->holder == NULL);
|
||||
g_assert (priv->texture->gl_texture == NULL);
|
||||
|
||||
scale = gtk_widget_get_scale_factor (widget);
|
||||
width = gtk_widget_get_width (widget) * scale;
|
||||
@@ -706,7 +712,7 @@ gtk_gl_area_draw_error_screen (GtkGLArea *area,
|
||||
}
|
||||
|
||||
static void
|
||||
release_texture (gpointer data)
|
||||
release_gl_texture (gpointer data)
|
||||
{
|
||||
Texture *texture = data;
|
||||
gpointer sync;
|
||||
@@ -718,7 +724,7 @@ release_texture (gpointer data)
|
||||
gdk_gl_texture_builder_set_sync (texture->builder, NULL);
|
||||
}
|
||||
|
||||
texture->holder = NULL;
|
||||
texture->gl_texture = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -735,10 +741,14 @@ release_dmabuf_texture (gpointer data)
|
||||
{
|
||||
Texture *texture = data;
|
||||
|
||||
release_dmabuf (gdk_dmabuf_texture_get_dmabuf (GDK_DMABUF_TEXTURE (texture->holder)));
|
||||
g_object_set_data (G_OBJECT (texture->holder), "gltexture", NULL);
|
||||
g_clear_object (&texture->gl_texture);
|
||||
|
||||
texture->holder = NULL;
|
||||
if (texture->dmabuf_texture == NULL)
|
||||
return;
|
||||
|
||||
release_dmabuf (gdk_dmabuf_texture_get_dmabuf (GDK_DMABUF_TEXTURE (texture->dmabuf_texture )));
|
||||
|
||||
texture->dmabuf_texture = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -784,8 +794,8 @@ gtk_gl_area_snapshot (GtkWidget *widget,
|
||||
{
|
||||
Texture *texture;
|
||||
gpointer sync = NULL;
|
||||
GdkTexture *gltexture;
|
||||
GdkDmabuf dmabuf;
|
||||
GdkTexture *holder;
|
||||
|
||||
if (priv->needs_render || priv->auto_render)
|
||||
{
|
||||
@@ -809,9 +819,10 @@ gtk_gl_area_snapshot (GtkWidget *widget,
|
||||
|
||||
gdk_gl_texture_builder_set_sync (texture->builder, sync);
|
||||
|
||||
gltexture = gdk_gl_texture_builder_build (texture->builder,
|
||||
release_texture,
|
||||
texture);
|
||||
texture->gl_texture = gdk_gl_texture_builder_build (texture->builder,
|
||||
release_gl_texture,
|
||||
texture);
|
||||
holder = texture->gl_texture;
|
||||
|
||||
if (gdk_gl_context_export_dmabuf (priv->context,
|
||||
gdk_gl_texture_builder_get_id (texture->builder),
|
||||
@@ -820,22 +831,20 @@ gtk_gl_area_snapshot (GtkWidget *widget,
|
||||
GdkDmabufTextureBuilder *builder = gdk_dmabuf_texture_builder_new ();
|
||||
|
||||
gdk_dmabuf_texture_builder_set_display (builder, gdk_gl_context_get_display (priv->context));
|
||||
gdk_dmabuf_texture_builder_set_width (builder, gdk_texture_get_width (gltexture));
|
||||
gdk_dmabuf_texture_builder_set_height (builder, gdk_texture_get_height (gltexture));
|
||||
gdk_dmabuf_texture_builder_set_width (builder, gdk_texture_get_width (texture->gl_texture));
|
||||
gdk_dmabuf_texture_builder_set_height (builder, gdk_texture_get_height (texture->gl_texture));
|
||||
gdk_dmabuf_texture_builder_set_premultiplied (builder, TRUE);
|
||||
gdk_dmabuf_texture_builder_set_dmabuf (builder, &dmabuf);
|
||||
|
||||
texture->holder = gdk_dmabuf_texture_builder_build (builder, release_dmabuf_texture, texture, NULL);
|
||||
texture->dmabuf_texture = gdk_dmabuf_texture_builder_build (builder, release_dmabuf_texture, texture, NULL);
|
||||
|
||||
g_object_unref (builder);
|
||||
|
||||
if (texture->holder != NULL)
|
||||
g_object_set_data_full (G_OBJECT (texture->holder), "gltexture", gltexture, g_object_unref);
|
||||
if (texture->dmabuf_texture != NULL)
|
||||
holder = texture->dmabuf_texture;
|
||||
else
|
||||
release_dmabuf (&dmabuf);
|
||||
}
|
||||
else
|
||||
texture->holder = gltexture;
|
||||
|
||||
/* Our texture is rendered by OpenGL, so it is upside down,
|
||||
* compared to what GSK expects, so flip it back.
|
||||
@@ -844,13 +853,13 @@ gtk_gl_area_snapshot (GtkWidget *widget,
|
||||
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (0, gtk_widget_get_height (widget)));
|
||||
gtk_snapshot_scale (snapshot, 1, -1);
|
||||
gtk_snapshot_append_texture (snapshot,
|
||||
texture->holder,
|
||||
holder,
|
||||
&GRAPHENE_RECT_INIT (0, 0,
|
||||
gtk_widget_get_width (widget),
|
||||
gtk_widget_get_height (widget)));
|
||||
gtk_snapshot_restore (snapshot);
|
||||
|
||||
g_object_unref (texture->holder);
|
||||
g_object_unref (holder);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "gtkprivate.h"
|
||||
#include "gdk/gdksurfaceprivate.h"
|
||||
#include "gdk/gdksubsurfaceprivate.h"
|
||||
#include "gdk/gdkrgbaprivate.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
|
||||
/**
|
||||
@@ -82,6 +83,7 @@ struct _GtkGraphicsOffload
|
||||
GdkSubsurface *subsurface;
|
||||
|
||||
GtkGraphicsOffloadEnabled enabled;
|
||||
gboolean black_background;
|
||||
};
|
||||
|
||||
struct _GtkGraphicsOffloadClass
|
||||
@@ -94,6 +96,7 @@ enum
|
||||
PROP_0,
|
||||
PROP_CHILD,
|
||||
PROP_ENABLED,
|
||||
PROP_BLACK_BACKGROUND,
|
||||
LAST_PROP,
|
||||
};
|
||||
|
||||
@@ -135,6 +138,10 @@ gtk_graphics_offload_set_property (GObject *object,
|
||||
gtk_graphics_offload_set_enabled (self, g_value_get_enum (value));
|
||||
break;
|
||||
|
||||
case PROP_BLACK_BACKGROUND:
|
||||
gtk_graphics_offload_set_black_background (self, g_value_get_boolean (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
}
|
||||
@@ -158,6 +165,10 @@ gtk_graphics_offload_get_property (GObject *object,
|
||||
g_value_set_enum (value, gtk_graphics_offload_get_enabled (self));
|
||||
break;
|
||||
|
||||
case PROP_BLACK_BACKGROUND:
|
||||
g_value_set_boolean (value, gtk_graphics_offload_get_black_background (self));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
}
|
||||
@@ -208,14 +219,15 @@ gtk_graphics_offload_snapshot (GtkWidget *widget,
|
||||
if (self->subsurface)
|
||||
gtk_snapshot_push_subsurface (snapshot, self->subsurface);
|
||||
|
||||
if (self->enabled == GTK_GRAPHICS_OFFLOAD_ENABLED_WITH_LIGHTBOX)
|
||||
if (self->black_background)
|
||||
gtk_snapshot_append_color (snapshot,
|
||||
&(GdkRGBA) { 0, 0, 0, 1 },
|
||||
&GDK_RGBA_BLACK,
|
||||
&GRAPHENE_RECT_INIT (0, 0,
|
||||
gtk_widget_get_width (widget),
|
||||
gtk_widget_get_height (widget)));
|
||||
|
||||
gtk_widget_snapshot_child (widget, self->child, snapshot);
|
||||
if (self->child)
|
||||
gtk_widget_snapshot_child (widget, self->child, snapshot);
|
||||
|
||||
if (self->subsurface)
|
||||
gtk_snapshot_pop (snapshot);
|
||||
@@ -258,6 +270,17 @@ gtk_graphics_offload_class_init (GtkGraphicsOffloadClass *class)
|
||||
GTK_GRAPHICS_OFFLOAD_ENABLED,
|
||||
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GtkGraphicsOffload:black_background: (attributes org.gtk.Property.get=gtk_graphics_offload_get_black_background org.gtk.Property.set=gtk_graphics_offload_set_black_background)
|
||||
*
|
||||
* Whether to draw a black background.
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
properties[PROP_BLACK_BACKGROUND] = g_param_spec_boolean ("black-background", NULL, NULL,
|
||||
FALSE,
|
||||
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, LAST_PROP, properties);
|
||||
|
||||
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
|
||||
@@ -270,7 +293,7 @@ gtk_graphics_offload_class_init (GtkGraphicsOffloadClass *class)
|
||||
*
|
||||
* Creates a new GtkGraphicsOffload widget.
|
||||
*
|
||||
* Returns: (transfer full): the new widget
|
||||
* Returns: the new widget
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
@@ -374,3 +397,61 @@ gtk_graphics_offload_get_enabled (GtkGraphicsOffload *self)
|
||||
|
||||
return self->enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_graphics_offload_set_black_background:
|
||||
* @self: a `GtkGraphicsOffload`
|
||||
* @value: whether to draw a black background behind the content
|
||||
*
|
||||
* Sets whether this GtkGraphicsOffload widget will draw a black
|
||||
* background.
|
||||
*
|
||||
* A main use case for this is **_letterboxing_** where black bars are
|
||||
* visible next to the content if the aspect ratio of the content does
|
||||
* not match the dimensions of the monitor.
|
||||
*
|
||||
* Using this property for letterboxing instead of CSS allows compositors
|
||||
* to show content with maximum efficiency, using direct scanout to avoid
|
||||
* extra copies in the compositor.
|
||||
*
|
||||
* On Wayland, this is implemented using the
|
||||
* [single-pixel buffer](https://wayland.app/protocols/single-pixel-buffer-v1)
|
||||
* protocol.
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
void
|
||||
gtk_graphics_offload_set_black_background (GtkGraphicsOffload *self,
|
||||
gboolean value)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_GRAPHICS_OFFLOAD (self));
|
||||
|
||||
if (self->black_background == value)
|
||||
return;
|
||||
|
||||
self->black_background = value;
|
||||
|
||||
gtk_widget_queue_draw (GTK_WIDGET (self));
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_BLACK_BACKGROUND]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_graphics_offload_get_black_background:
|
||||
* @self: a `GtkGraphicsOffload`
|
||||
*
|
||||
* Returns whether the widget draws a black background.
|
||||
*
|
||||
* See [method@Gtk.GraphicsOffload.set_black_background].
|
||||
*
|
||||
* Returns: `TRUE` if black background is drawn
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
gboolean
|
||||
gtk_graphics_offload_get_black_background (GtkGraphicsOffload *self)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_GRAPHICS_OFFLOAD (self), FALSE);
|
||||
|
||||
return self->black_background;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ GtkWidget * gtk_graphics_offload_get_child (GtkGraphicsOffload *
|
||||
* @GTK_GRAPHICS_OFFLOAD_ENABLED: Graphics offloading is enabled.
|
||||
* @GTK_GRAPHICS_OFFLOAD_DISABLED: Graphics offloading is disabled.
|
||||
*
|
||||
* Represents the state of graphics offlodading.
|
||||
* Represents the state of graphics offloading.
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
@@ -57,7 +57,6 @@ typedef enum
|
||||
{
|
||||
GTK_GRAPHICS_OFFLOAD_ENABLED,
|
||||
GTK_GRAPHICS_OFFLOAD_DISABLED,
|
||||
GTK_GRAPHICS_OFFLOAD_ENABLED_WITH_LIGHTBOX,
|
||||
} GtkGraphicsOffloadEnabled;
|
||||
|
||||
GDK_AVAILABLE_IN_4_14
|
||||
@@ -68,4 +67,11 @@ GDK_AVAILABLE_IN_4_14
|
||||
GtkGraphicsOffloadEnabled
|
||||
gtk_graphics_offload_get_enabled (GtkGraphicsOffload *self);
|
||||
|
||||
GDK_AVAILABLE_IN_4_16
|
||||
void gtk_graphics_offload_set_black_background (GtkGraphicsOffload *self,
|
||||
gboolean value);
|
||||
|
||||
GDK_AVAILABLE_IN_4_16
|
||||
gboolean gtk_graphics_offload_get_black_background (GtkGraphicsOffload *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
+12
-5
@@ -743,7 +743,7 @@ gtk_grid_view_size_allocate (GtkWidget *widget,
|
||||
int baseline)
|
||||
{
|
||||
GtkGridView *self = GTK_GRID_VIEW (widget);
|
||||
GtkListTile *tile, *start;
|
||||
GtkListTile *tile, *start, *footer;
|
||||
GArray *heights;
|
||||
int min_row_height, unknown_row_height, row_height, col_min, col_nat;
|
||||
GtkOrientation orientation;
|
||||
@@ -880,11 +880,11 @@ gtk_grid_view_size_allocate (GtkWidget *widget,
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
/* Add a filler tile for empty space in the bottom right */
|
||||
footer = gtk_list_item_manager_get_last (self->item_manager);
|
||||
g_assert (gtk_list_tile_is_footer (footer));
|
||||
/* Make the footer tile fill the empty space in the bottom right */
|
||||
if (i > 0)
|
||||
{
|
||||
GtkListTile *footer = gtk_list_item_manager_get_last (self->item_manager);
|
||||
g_assert (gtk_list_tile_is_footer (footer));
|
||||
tile = gtk_rb_tree_node_get_previous (footer);
|
||||
gtk_list_tile_set_area_position (self->item_manager,
|
||||
footer,
|
||||
@@ -895,8 +895,15 @@ gtk_grid_view_size_allocate (GtkWidget *widget,
|
||||
column_end (self, xspacing, self->n_columns - 1) - footer->area.x,
|
||||
tile->area.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_list_tile_set_area_size (self->item_manager,
|
||||
footer,
|
||||
0,
|
||||
0);
|
||||
}
|
||||
|
||||
/* step 4: allocate the rest */
|
||||
/* step 5: allocate the rest */
|
||||
gtk_list_base_allocate (GTK_LIST_BASE (self));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -637,7 +637,7 @@ resource_is_pixdata (const char *resource_path)
|
||||
if (data_size < sizeof(guint32))
|
||||
goto out;
|
||||
|
||||
magic = (stream[0] << 24) + (stream[1] << 16) + (stream[2] << 8) + stream[3];
|
||||
magic = (((guint32)(stream[0])) << 24) | (((guint32)(stream[1])) << 16) | (((guint32)(stream[2])) << 8) | (guint32)(stream[3]);
|
||||
if (magic == GDK_PIXBUF_MAGIC_NUMBER)
|
||||
ret = TRUE;
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ quartz_filter_keypress (GtkIMContext *context,
|
||||
keyval = gdk_key_event_get_keyval (event);
|
||||
keycode = gdk_key_event_get_keycode (event);
|
||||
|
||||
NSEvent *nsevent = _gdk_macos_display_get_nsevent ((GdkEvent *)event);
|
||||
NSEvent *nsevent = _gdk_macos_display_get_matching_nsevent ((GdkEvent *)event);
|
||||
|
||||
if (!nsevent)
|
||||
{
|
||||
|
||||
@@ -586,7 +586,7 @@ gtk_list_factory_widget_set_activatable (GtkListFactoryWidget *self,
|
||||
else
|
||||
gtk_widget_remove_css_class (GTK_WIDGET (self), "activatable");
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SINGLE_CLICK_ACTIVATE]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ACTIVATABLE]);
|
||||
}
|
||||
|
||||
gboolean
|
||||
@@ -608,7 +608,7 @@ gtk_list_factory_widget_set_selectable (GtkListFactoryWidget *self,
|
||||
|
||||
priv->selectable = selectable;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SINGLE_CLICK_ACTIVATE]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SELECTABLE]);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
||||
@@ -123,6 +123,14 @@ gtk_list_item_widget_setup_object (GtkListFactoryWidget *fw,
|
||||
gtk_list_factory_widget_set_selectable (fw, list_item->selectable);
|
||||
gtk_widget_set_focusable (GTK_WIDGET (self), list_item->focusable);
|
||||
|
||||
if (list_item->selectable)
|
||||
gtk_accessible_update_state (GTK_ACCESSIBLE (self),
|
||||
GTK_ACCESSIBLE_STATE_SELECTED, FALSE,
|
||||
-1);
|
||||
else
|
||||
gtk_accessible_reset_state (GTK_ACCESSIBLE (self),
|
||||
GTK_ACCESSIBLE_STATE_SELECTED);
|
||||
|
||||
gtk_accessible_update_property (GTK_ACCESSIBLE (self),
|
||||
GTK_ACCESSIBLE_PROPERTY_LABEL, list_item->accessible_label,
|
||||
GTK_ACCESSIBLE_PROPERTY_DESCRIPTION, list_item->accessible_description,
|
||||
@@ -176,6 +184,11 @@ gtk_list_item_widget_update_object (GtkListFactoryWidget *fw,
|
||||
/* Track notify manually instead of freeze/thaw_notify for performance reasons. */
|
||||
gboolean notify_item = FALSE, notify_position = FALSE, notify_selected = FALSE;
|
||||
|
||||
if (list_item->selectable)
|
||||
gtk_accessible_update_state (GTK_ACCESSIBLE (self),
|
||||
GTK_ACCESSIBLE_STATE_SELECTED, selected,
|
||||
-1);
|
||||
|
||||
/* FIXME: It's kinda evil to notify external objects from here... */
|
||||
notify_item = gtk_list_item_base_get_item (base) != item;
|
||||
notify_position = gtk_list_item_base_get_position (base) != position;
|
||||
|
||||
+28
-2
@@ -28,6 +28,7 @@
|
||||
#include "gtkscrollbar.h"
|
||||
#include "gtkrange.h"
|
||||
|
||||
#include "gtkaccessiblerange.h"
|
||||
#include "gtkadjustment.h"
|
||||
#include "gtkorientable.h"
|
||||
#include "gtkprivate.h"
|
||||
@@ -107,13 +108,38 @@ enum {
|
||||
LAST_PROP = PROP_ORIENTATION
|
||||
};
|
||||
|
||||
static void gtk_scrollbar_accessible_range_init (GtkAccessibleRangeInterface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkScrollbar, gtk_scrollbar, GTK_TYPE_WIDGET,
|
||||
G_ADD_PRIVATE (GtkScrollbar)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL))
|
||||
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_ACCESSIBLE_RANGE,
|
||||
gtk_scrollbar_accessible_range_init))
|
||||
|
||||
static GParamSpec *props[LAST_PROP] = { NULL, };
|
||||
|
||||
static gboolean
|
||||
accessible_range_set_current_value (GtkAccessibleRange *range,
|
||||
double value)
|
||||
{
|
||||
GtkScrollbar *self = GTK_SCROLLBAR (range);
|
||||
GtkAdjustment *adjustment = gtk_scrollbar_get_adjustment (self);
|
||||
|
||||
if (adjustment)
|
||||
{
|
||||
gtk_adjustment_set_value (adjustment, value);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scrollbar_accessible_range_init (GtkAccessibleRangeInterface *iface)
|
||||
{
|
||||
iface->set_current_value = accessible_range_set_current_value;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scrollbar_get_property (GObject *object,
|
||||
guint property_id,
|
||||
|
||||
+28
-6
@@ -73,7 +73,7 @@
|
||||
* utilities that let the user change these settings.
|
||||
*
|
||||
* On Wayland, the settings are obtained either via a settings portal,
|
||||
* or by reading desktop settings from DConf.
|
||||
* or by reading desktop settings from [class@Gio.Settings].
|
||||
*
|
||||
* On macOS, the settings are obtained from `NSUserDefaults`.
|
||||
*
|
||||
@@ -202,6 +202,7 @@ enum {
|
||||
PROP_LONG_PRESS_TIME,
|
||||
PROP_KEYNAV_USE_CARET,
|
||||
PROP_OVERLAY_SCROLLING,
|
||||
PROP_FONT_RENDERING,
|
||||
|
||||
NUM_PROPERTIES
|
||||
};
|
||||
@@ -507,7 +508,7 @@ gtk_settings_class_init (GtkSettingsClass *class)
|
||||
* Since: 4.6
|
||||
*/
|
||||
pspecs[PROP_HINT_FONT_METRICS] = g_param_spec_boolean ("gtk-hint-font-metrics", NULL, NULL,
|
||||
FALSE,
|
||||
TRUE,
|
||||
GTK_PARAM_READWRITE);
|
||||
|
||||
/**
|
||||
@@ -955,6 +956,27 @@ gtk_settings_class_init (GtkSettingsClass *class)
|
||||
TRUE,
|
||||
GTK_PARAM_READWRITE);
|
||||
|
||||
/**
|
||||
* GtkSettings:gtk-font-rendering:
|
||||
*
|
||||
* How GTK font rendering is set up.
|
||||
*
|
||||
* When set to [enum@Gtk.FontRendering.MANUAL], GTK respects the low-level
|
||||
* font-related settings ([property@Gtk.Settings:gtk-hint-font-metrics],
|
||||
* [property@Gtk.Settings:gtk-xft-antialias], [property@Gtk.Settings:gtk-xft-hinting],
|
||||
* [property@Gtk.Settings:gtk-xft-hintstyle] and [property@Gtk.Settings:gtk-xft-rgba])
|
||||
* as much as practical.
|
||||
*
|
||||
* When set to [enum@Gtk.FontRendering.AUTOMATIC], GTK will consider factors such
|
||||
* as screen resolution and scale in deciding how to render fonts.
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
pspecs[PROP_FONT_RENDERING] = g_param_spec_enum ("gtk-font-rendering", NULL, NULL,
|
||||
GTK_TYPE_FONT_RENDERING,
|
||||
GTK_FONT_RENDERING_AUTOMATIC,
|
||||
GTK_PARAM_READWRITE);
|
||||
|
||||
g_object_class_install_properties (gobject_class, NUM_PROPERTIES, pspecs);
|
||||
}
|
||||
|
||||
@@ -1260,6 +1282,9 @@ gtk_settings_notify (GObject *object,
|
||||
if (settings_update_fontconfig (settings))
|
||||
gtk_system_setting_changed (settings->display, GTK_SYSTEM_SETTING_FONT_CONFIG);
|
||||
break;
|
||||
case PROP_FONT_RENDERING:
|
||||
gtk_system_setting_changed (settings->display, GTK_SYSTEM_SETTING_FONT_CONFIG);
|
||||
break;
|
||||
case PROP_ENABLE_ANIMATIONS:
|
||||
settings_invalidate_style (settings);
|
||||
break;
|
||||
@@ -1773,7 +1798,6 @@ settings_update_xsetting (GtkSettings *settings,
|
||||
gboolean force)
|
||||
{
|
||||
GType value_type;
|
||||
GType fundamental_type;
|
||||
gboolean retval = FALSE;
|
||||
|
||||
if (settings->property_values[pspec->param_id - 1].source == GTK_SETTINGS_SOURCE_APPLICATION)
|
||||
@@ -1783,10 +1807,8 @@ settings_update_xsetting (GtkSettings *settings,
|
||||
return FALSE;
|
||||
|
||||
value_type = G_PARAM_SPEC_VALUE_TYPE (pspec);
|
||||
fundamental_type = G_TYPE_FUNDAMENTAL (value_type);
|
||||
|
||||
if ((g_value_type_transformable (G_TYPE_INT, value_type) &&
|
||||
!(fundamental_type == G_TYPE_ENUM || fundamental_type == G_TYPE_FLAGS)) ||
|
||||
if (g_value_type_transformable (G_TYPE_INT, value_type) ||
|
||||
g_value_type_transformable (G_TYPE_STRING, value_type) ||
|
||||
g_value_type_transformable (GDK_TYPE_RGBA, value_type))
|
||||
{
|
||||
|
||||
@@ -511,7 +511,7 @@ gtk_toggle_button_set_group (GtkToggleButton *toggle_button,
|
||||
GtkToggleButton *group)
|
||||
{
|
||||
GtkToggleButtonPrivate *priv = gtk_toggle_button_get_instance_private (toggle_button);
|
||||
GtkToggleButtonPrivate *group_priv = gtk_toggle_button_get_instance_private (group);
|
||||
GtkToggleButtonPrivate *group_priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_TOGGLE_BUTTON (toggle_button));
|
||||
g_return_if_fail (toggle_button != group);
|
||||
@@ -538,6 +538,8 @@ gtk_toggle_button_set_group (GtkToggleButton *toggle_button,
|
||||
if (priv->group_next == group)
|
||||
return;
|
||||
|
||||
group_priv = gtk_toggle_button_get_instance_private (group);
|
||||
|
||||
priv->group_prev = NULL;
|
||||
if (group_priv->group_prev)
|
||||
{
|
||||
|
||||
+82
-55
@@ -74,6 +74,7 @@
|
||||
|
||||
#include "gdk/gdkeventsprivate.h"
|
||||
#include "gdk/gdkprofilerprivate.h"
|
||||
#include "gdk/gdkmonitorprivate.h"
|
||||
#include "gsk/gskdebugprivate.h"
|
||||
#include "gsk/gskrendererprivate.h"
|
||||
|
||||
@@ -6463,10 +6464,8 @@ gtk_widget_update_pango_context (GtkWidget *widget,
|
||||
GtkCssStyle *style = gtk_css_node_get_style (priv->cssnode);
|
||||
PangoFontDescription *font_desc;
|
||||
GtkSettings *settings;
|
||||
cairo_font_options_t *font_options;
|
||||
guint old_serial;
|
||||
gboolean hint_font_metrics = FALSE;
|
||||
int scale;
|
||||
GtkFontRendering font_rendering;
|
||||
|
||||
old_serial = pango_context_get_serial (context);
|
||||
|
||||
@@ -6474,20 +6473,6 @@ gtk_widget_update_pango_context (GtkWidget *widget,
|
||||
pango_context_set_font_description (context, font_desc);
|
||||
pango_font_description_free (font_desc);
|
||||
|
||||
scale = gtk_widget_get_scale_factor (widget);
|
||||
settings = gtk_widget_get_settings (widget);
|
||||
|
||||
if (settings)
|
||||
{
|
||||
g_object_get (settings, "gtk-hint-font-metrics", &hint_font_metrics, NULL);
|
||||
|
||||
/* Override the user setting on non-HiDPI */
|
||||
if (scale == 1)
|
||||
hint_font_metrics = TRUE;
|
||||
|
||||
pango_context_set_round_glyph_positions (context, hint_font_metrics);
|
||||
}
|
||||
|
||||
if (direction != GTK_TEXT_DIR_NONE)
|
||||
pango_context_set_base_dir (context, direction == GTK_TEXT_DIR_LTR
|
||||
? PANGO_DIRECTION_LTR
|
||||
@@ -6495,36 +6480,77 @@ gtk_widget_update_pango_context (GtkWidget *widget,
|
||||
|
||||
pango_cairo_context_set_resolution (context, _gtk_css_number_value_get (style->core->dpi, 100));
|
||||
|
||||
font_options = (cairo_font_options_t*)g_object_get_qdata (G_OBJECT (widget), quark_font_options);
|
||||
if (settings && font_options)
|
||||
{
|
||||
cairo_font_options_t *options;
|
||||
|
||||
options = cairo_font_options_copy (gtk_settings_get_font_options (settings));
|
||||
cairo_font_options_merge (options, font_options);
|
||||
|
||||
cairo_font_options_set_hint_metrics (options,
|
||||
hint_font_metrics == 1 ? CAIRO_HINT_METRICS_ON
|
||||
: CAIRO_HINT_METRICS_OFF);
|
||||
|
||||
pango_cairo_context_set_font_options (context, options);
|
||||
cairo_font_options_destroy (options);
|
||||
}
|
||||
else if (settings)
|
||||
{
|
||||
cairo_font_options_t *options;
|
||||
|
||||
options = cairo_font_options_copy (gtk_settings_get_font_options (settings));
|
||||
cairo_font_options_set_hint_metrics (options,
|
||||
hint_font_metrics == 1 ? CAIRO_HINT_METRICS_ON
|
||||
: CAIRO_HINT_METRICS_OFF);
|
||||
|
||||
pango_cairo_context_set_font_options (context, options);
|
||||
cairo_font_options_destroy (options);
|
||||
}
|
||||
|
||||
pango_context_set_font_map (context, gtk_widget_get_effective_font_map (widget));
|
||||
|
||||
settings = gtk_widget_get_settings (widget);
|
||||
|
||||
if (settings)
|
||||
g_object_get (settings, "gtk-font-rendering", &font_rendering, NULL);
|
||||
else
|
||||
font_rendering = GTK_FONT_RENDERING_AUTOMATIC;
|
||||
|
||||
if (font_rendering == GTK_FONT_RENDERING_MANUAL)
|
||||
{
|
||||
gboolean hint_font_metrics;
|
||||
cairo_font_options_t *font_options, *options;
|
||||
|
||||
g_object_get (settings, "gtk-hint-font-metrics", &hint_font_metrics, NULL);
|
||||
|
||||
options = cairo_font_options_copy (gtk_settings_get_font_options (settings));
|
||||
font_options = (cairo_font_options_t*)g_object_get_qdata (G_OBJECT (widget), quark_font_options);
|
||||
if (font_options)
|
||||
cairo_font_options_merge (options, font_options);
|
||||
|
||||
cairo_font_options_set_hint_metrics (options,
|
||||
hint_font_metrics == 1 ? CAIRO_HINT_METRICS_ON
|
||||
: CAIRO_HINT_METRICS_OFF);
|
||||
|
||||
pango_context_set_round_glyph_positions (context, hint_font_metrics);
|
||||
pango_cairo_context_set_font_options (context, options);
|
||||
|
||||
cairo_font_options_destroy (options);
|
||||
}
|
||||
else
|
||||
{
|
||||
cairo_font_options_t *options;
|
||||
double dpi = 96.;
|
||||
GdkSurface *surface;
|
||||
|
||||
surface = gtk_widget_get_surface (widget);
|
||||
if (surface)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
GdkMonitor *monitor;
|
||||
|
||||
display = gdk_surface_get_display (surface);
|
||||
monitor = gdk_display_get_monitor_at_surface (display, surface);
|
||||
if (monitor)
|
||||
dpi = gdk_monitor_get_dpi (monitor);
|
||||
}
|
||||
|
||||
options = cairo_font_options_create ();
|
||||
|
||||
cairo_font_options_set_antialias (options, CAIRO_ANTIALIAS_GRAY);
|
||||
|
||||
if (dpi < 200.)
|
||||
{
|
||||
/* Not high-dpi. Prefer sharpness by enabling hinting */
|
||||
cairo_font_options_set_hint_metrics (options, CAIRO_HINT_METRICS_ON);
|
||||
cairo_font_options_set_hint_style (options, CAIRO_HINT_STYLE_SLIGHT);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* High-dpi. Prefer precise positioning */
|
||||
cairo_font_options_set_hint_metrics (options, CAIRO_HINT_METRICS_OFF);
|
||||
cairo_font_options_set_hint_style (options, CAIRO_HINT_STYLE_NONE);
|
||||
}
|
||||
|
||||
pango_context_set_round_glyph_positions (context, FALSE);
|
||||
pango_cairo_context_set_font_options (context, options);
|
||||
|
||||
cairo_font_options_destroy (options);
|
||||
}
|
||||
|
||||
return old_serial != pango_context_get_serial (context);
|
||||
}
|
||||
|
||||
@@ -6551,6 +6577,8 @@ gtk_widget_update_default_pango_context (GtkWidget *widget)
|
||||
*
|
||||
* When not set, the default font options for the `GdkDisplay`
|
||||
* will be used.
|
||||
*
|
||||
* Deprecated: 4.16
|
||||
*/
|
||||
void
|
||||
gtk_widget_set_font_options (GtkWidget *widget,
|
||||
@@ -6580,8 +6608,9 @@ gtk_widget_set_font_options (GtkWidget *widget,
|
||||
*
|
||||
* Seee [method@Gtk.Widget.set_font_options].
|
||||
*
|
||||
* Returns: (transfer none) (nullable): the `cairo_font_options_t`
|
||||
* of widget
|
||||
* Returns: (transfer none) (nullable): the `cairo_font_options_t` of widget
|
||||
*
|
||||
* Deprecated: 4.16
|
||||
*/
|
||||
const cairo_font_options_t *
|
||||
gtk_widget_get_font_options (GtkWidget *widget)
|
||||
@@ -8638,28 +8667,26 @@ gtk_widget_accessible_get_bounds (GtkAccessible *self,
|
||||
parent = gtk_widget_get_parent (widget);
|
||||
if (parent != NULL)
|
||||
{
|
||||
graphene_point_t p;
|
||||
if (!gtk_widget_compute_point (widget, parent, &GRAPHENE_POINT_INIT (0, 0), &p))
|
||||
graphene_point_init (&p, 0, 0);
|
||||
*x = floorf (p.x);
|
||||
*y = floorf (p.y);
|
||||
bounds_relative_to = parent;
|
||||
}
|
||||
else
|
||||
{
|
||||
*x = *y = 0;
|
||||
bounds_relative_to = widget;
|
||||
}
|
||||
|
||||
if (!gtk_widget_compute_bounds (widget, bounds_relative_to, &bounds))
|
||||
{
|
||||
*x = 0;
|
||||
*y = 0;
|
||||
*width = 0;
|
||||
*height = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
*width = ceilf (graphene_rect_get_width (&bounds));
|
||||
*height = ceilf (graphene_rect_get_height (&bounds));
|
||||
*x = floorf (graphene_rect_get_x (&bounds));
|
||||
*y = floorf (graphene_rect_get_y (&bounds));
|
||||
*width = ceil (*x + graphene_rect_get_width (&bounds)) - *x;
|
||||
*height = ceil (*y + graphene_rect_get_height (&bounds)) - *y;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
+2
-2
@@ -636,10 +636,10 @@ GDK_AVAILABLE_IN_ALL
|
||||
PangoContext *gtk_widget_create_pango_context (GtkWidget *widget);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
PangoContext *gtk_widget_get_pango_context (GtkWidget *widget);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_16
|
||||
void gtk_widget_set_font_options (GtkWidget *widget,
|
||||
const cairo_font_options_t *options);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_16
|
||||
const cairo_font_options_t *gtk_widget_get_font_options (GtkWidget *widget);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
PangoLayout *gtk_widget_create_pango_layout (GtkWidget *widget,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user