Compare commits
325 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e04cdce680 | |||
| 812b30eb54 | |||
| 2b5ec9e879 | |||
| c18a7ff5cf | |||
| 24fc38b287 | |||
| aa03c50f05 | |||
| 03e971b2e3 | |||
| a595133b77 | |||
| e50f4ecccf | |||
| 67913e4af0 | |||
| b3d1795327 | |||
| 6edcc8f256 | |||
| d5e5f47666 | |||
| 0524c40640 | |||
| b5fd894f77 | |||
| d8492121aa | |||
| 4a0bf603d7 | |||
| 02fa89df9e | |||
| 5b6dde9a73 | |||
| e9d8ebdfc9 | |||
| 366efc3d61 | |||
| 3b890fd3c1 | |||
| 5de373a14b | |||
| 24cb9d2437 | |||
| 83aa176466 | |||
| 0e94e5ecda | |||
| 130485a583 | |||
| f34c10abb5 | |||
| 48b00f0ac1 | |||
| 743329a3af | |||
| f5783f1637 | |||
| 67f61a8d39 | |||
| f7df663dea | |||
| c99278aa58 | |||
| 1765e1b7c2 | |||
| bf1a434d5c | |||
| 9256b5b552 | |||
| 577e4afb3c | |||
| 2a05c04db7 | |||
| a6ffd6b3b2 | |||
| 24eba7c4c1 | |||
| 80de844922 | |||
| a2223c0884 | |||
| 5ffa2b757c | |||
| b660fa27d3 | |||
| 77f0e5e1ba | |||
| 1080822ffa | |||
| 3fef45683c | |||
| cfcc5c5c0b | |||
| 856f1808de | |||
| 4341344545 | |||
| 20392e8840 | |||
| 426fefff81 | |||
| 13013053f7 | |||
| 62b9a4af75 | |||
| 76caf2c812 | |||
| 3d5fce1b9f | |||
| bfe8adbee4 | |||
| 827642303c | |||
| 6b6a0e1257 | |||
| 7a98176a02 | |||
| a93a986ef2 | |||
| 39dbc5ea87 | |||
| cf4d13bee3 | |||
| 0bacde8e0a | |||
| 949cd45bb7 | |||
| 2e9e216641 | |||
| 1ab8ffaceb | |||
| 3cc1726856 | |||
| 30eaa2c3cc | |||
| ba5993195a | |||
| bf42351ebf | |||
| ee277f4d92 | |||
| 00acc7957f | |||
| a931335f24 | |||
| 1ef320a9ec | |||
| 411b7f12b5 | |||
| 611fcfb1c7 | |||
| 6257a51f4f | |||
| e24630bd18 | |||
| 6b0b3a4db7 | |||
| fd19c7c2ab | |||
| 4aa2206699 | |||
| eae23ebf69 | |||
| ecd27f6c3c | |||
| 01f3c72338 | |||
| 87be414c05 | |||
| f6d676cc8a | |||
| 4961241f26 | |||
| 60c944bb94 | |||
| 740c10282f | |||
| 3a4c69f370 | |||
| c3083572fb | |||
| 8ecb00be66 | |||
| 48e707aceb | |||
| e2f9ff2304 | |||
| fa3a72c8f6 | |||
| fc45d90834 | |||
| fcd95cd5c6 | |||
| b8c1ac41d2 | |||
| 90e1ce0906 | |||
| d121fd5b7d | |||
| 4d88fcc1db | |||
| 85fcda178e | |||
| ecc678454b | |||
| 5a85bc691e | |||
| d506a5eea8 | |||
| aefa79413b | |||
| 73e4eb7552 | |||
| dff340530a | |||
| f6ea3e1684 | |||
| f790441505 | |||
| 0c307f7563 | |||
| f89dc9644c | |||
| 735455b523 | |||
| d037cfaf44 | |||
| 293d63425a | |||
| 38f9bb87bc | |||
| 64abadb370 | |||
| 6f85827fcb | |||
| b0e321cfb8 | |||
| 46d0569365 | |||
| 2eea911a0f | |||
| ee4a817121 | |||
| 3d1f914271 | |||
| 7bb0639a75 | |||
| f8f38aab63 | |||
| 75c2bd53aa | |||
| 83921750ae | |||
| 413512eba7 | |||
| e824764dc3 | |||
| 61b12abdab | |||
| 07bd5c7b05 | |||
| 1dc20eda28 | |||
| 5a9299f626 | |||
| 9c86c67f06 | |||
| e6ca7668be | |||
| 0b540b9ad1 | |||
| 514cdf7398 | |||
| 2ab52d73ab | |||
| b3ae172c1e | |||
| a6d1df66ec | |||
| ba92ce342e | |||
| 9f4c715516 | |||
| 5aa47b6e45 | |||
| 3b40d95581 | |||
| 3ad2d91e1c | |||
| d4c586e882 | |||
| 612c547ed3 | |||
| 1a777ce7f3 | |||
| 7ec4f6e297 | |||
| afaa0f3afd | |||
| 8841a002ed | |||
| 6da606aaad | |||
| 51bd155670 | |||
| 8fa16ec1cc | |||
| 04e5a0006d | |||
| a1d2169992 | |||
| 778976f8da | |||
| f81dea58a2 | |||
| e82606a538 | |||
| fe5b28f5b8 | |||
| 82fd0d7eef | |||
| 16761fcb49 | |||
| 4fac5680fb | |||
| 4ec4280e51 | |||
| 15bb77472d | |||
| 5c92d5e081 | |||
| 1626c5f1e7 | |||
| 3b5f0ed05e | |||
| d2298f1c8f | |||
| 085062ab89 | |||
| 9741082467 | |||
| 3db4a05493 | |||
| e3b9df2cec | |||
| 4a4e445a35 | |||
| db0f9b60ac | |||
| d51de390ba | |||
| c14e167a11 | |||
| 2837a85461 | |||
| 282510e113 | |||
| accabe3eee | |||
| 9dbdbaca43 | |||
| 5935bc95b7 | |||
| 4c677e4dcd | |||
| d4c25c9ec0 | |||
| b69df2bc4d | |||
| 7f9363d471 | |||
| 01d86eab66 | |||
| 09e85aa809 | |||
| d49816d2e6 | |||
| 59a00d6768 | |||
| 6bd6c6acba | |||
| be2ff60787 | |||
| 070b9a87b6 | |||
| ecbe6a421e | |||
| 317e68a58c | |||
| 9b42377347 | |||
| 7372a845fb | |||
| cf8c3be030 | |||
| 4eb715cf81 | |||
| d4899fdf1f | |||
| 4142c4d79e | |||
| ca442f8641 | |||
| 3c1491423a | |||
| eb4993d3fb | |||
| aa057da1ca | |||
| 1de09d59fb | |||
| 130a6fe0cf | |||
| e1f7c027d7 | |||
| 396ef5ebe5 | |||
| 840a20db3b | |||
| 8c6f7d1ae9 | |||
| c69fa6221b | |||
| 3c92c81705 | |||
| 297de981c4 | |||
| 53beb054b6 | |||
| 0431492284 | |||
| aed9cc1874 | |||
| c15804d124 | |||
| 1bd208d937 | |||
| b70bcd6bfe | |||
| 74a1d45238 | |||
| 3ada35460d | |||
| 1f133c3d64 | |||
| 4440ce874e | |||
| db302df82a | |||
| b550b58e8f | |||
| ed889b951b | |||
| b603479fe2 | |||
| 7c39b2cea3 | |||
| b1bce7a62b | |||
| fa73e17fba | |||
| dee2150a04 | |||
| f647fc3fe2 | |||
| 6bae80c331 | |||
| 2aeb80f490 | |||
| 8a2f434443 | |||
| d4134430fc | |||
| 73f64971c8 | |||
| ecc2c953e5 | |||
| e353117937 | |||
| 492ae6df35 | |||
| a19d0471e9 | |||
| 5b5ba36999 | |||
| 89b64cbf47 | |||
| e65d1f2122 | |||
| 2756496d47 | |||
| 8b653f21cc | |||
| 4e6759a126 | |||
| d20e0b0370 | |||
| ed8255993f | |||
| f5d69fa0c5 | |||
| e1431f31c1 | |||
| f191fc0047 | |||
| b60c60f03b | |||
| af0c277bba | |||
| 88203fbf4d | |||
| 970c9eef63 | |||
| 2439876bd3 | |||
| 97582ae9ad | |||
| a5b85f0dc5 | |||
| aefb16510b | |||
| 4360d433b5 | |||
| 5927319589 | |||
| 25db645f65 | |||
| b3c6a98132 | |||
| 031109aec3 | |||
| 18d2f9c8a4 | |||
| 0ae721f144 | |||
| 7898d1b46d | |||
| 3648398f6d | |||
| 019916c5b9 | |||
| ebb31590ae | |||
| 32ea1cf32d | |||
| 172cdf8e21 | |||
| dc07bcf3a3 | |||
| bd96c10563 | |||
| 76299396cf | |||
| a96dd2ad0a | |||
| 1e210e83bb | |||
| 14f1a91bff | |||
| 3f2bcdf82e | |||
| c61d8bc188 | |||
| 4e5976427b | |||
| 7fcdb0205f | |||
| 4814c5f653 | |||
| eb24e3548f | |||
| 87f0f374a9 | |||
| 0cd95951e6 | |||
| c45815c217 | |||
| b914869715 | |||
| ff5699e097 | |||
| 8846f85874 | |||
| fc1c6cfb1a | |||
| 77028362ab | |||
| 496aee5b02 | |||
| b2fb624496 | |||
| f2ef5d85ea | |||
| 7eca32edf0 | |||
| 7775bcf2fb | |||
| ed35f6f8b8 | |||
| 307942e1f7 | |||
| 92b7231168 | |||
| 14d7eb97d2 | |||
| fed1c3d3fc | |||
| e1ac97a185 | |||
| 08a48dd97e | |||
| 50df3ebb46 | |||
| df77f22740 | |||
| 2437a551ec | |||
| 46ab71fc8a | |||
| f922ff8597 | |||
| 690c06109e | |||
| 94505987fe | |||
| c6d7b704cb | |||
| 349509c332 | |||
| 84fd420271 | |||
| 0c40defaf1 | |||
| d665274eb1 | |||
| 81b6251073 | |||
| 32a4f805b8 | |||
| 54a86a2a7e | |||
| 06351844bb | |||
| bcf78aeb39 |
@@ -459,6 +459,7 @@ reference:
|
|||||||
- mv _build/docs/reference/gdk/gdk4-wayland/ _reference/gdk4-wayland/
|
- mv _build/docs/reference/gdk/gdk4-wayland/ _reference/gdk4-wayland/
|
||||||
- mv _build/docs/reference/gsk/gsk4/ _reference/gsk4/
|
- mv _build/docs/reference/gsk/gsk4/ _reference/gsk4/
|
||||||
- mv _build/docs/reference/gtk/gtk4/ _reference/gtk4/
|
- mv _build/docs/reference/gtk/gtk4/ _reference/gtk4/
|
||||||
|
- mv _build/docs/reference/gtk/*.html _reference/gtk4/
|
||||||
- mv _build/subprojects/pango/docs/Pango/ _reference/Pango/
|
- mv _build/subprojects/pango/docs/Pango/ _reference/Pango/
|
||||||
- mv _build/subprojects/pango/docs/PangoCairo/ _reference/PangoCairo/
|
- mv _build/subprojects/pango/docs/PangoCairo/ _reference/PangoCairo/
|
||||||
- mv _build/subprojects/pango/docs/PangoFc/ _reference/PangoFc/
|
- mv _build/subprojects/pango/docs/PangoFc/ _reference/PangoFc/
|
||||||
|
|||||||
@@ -1,11 +1,54 @@
|
|||||||
Overview of Changes in 4.15.1, xx-xx-xxxx
|
Overview of Changes in 4.15.2, xx-xx-xxxx
|
||||||
|
=========================================
|
||||||
|
|
||||||
|
* GtkFileChooserWidget:
|
||||||
|
- Plug some memory leaks
|
||||||
|
- Make Ctrl-Shift-N create a new folder
|
||||||
|
|
||||||
|
* CSS:
|
||||||
|
- Support color(), oklab(), etc (https://www.w3.org/TR/css-color-4/)
|
||||||
|
- Support color-mix() (https://www.w3.org/TR/css-color-5/)
|
||||||
|
- Support relative colors (https://www.w3.org/TR/css-color-5/)
|
||||||
|
|
||||||
|
* Accessibility:
|
||||||
|
- Avoid markup when reading labels
|
||||||
|
|
||||||
|
* GSK:
|
||||||
|
- Subset fonts when serializing node trees
|
||||||
|
|
||||||
|
* Wayland:
|
||||||
|
- Use xdg-dialog protocol for attached dialogs
|
||||||
|
|
||||||
|
* Windows:
|
||||||
|
- Build with UNICODE
|
||||||
|
|
||||||
|
* Debugging:
|
||||||
|
- Add GTK_DEBUG=css for warning about deprecated css syntax
|
||||||
|
|
||||||
|
* Tools:
|
||||||
|
- nodeparser: Add an extract command for data urls
|
||||||
|
|
||||||
|
* Deprecations:
|
||||||
|
- CSS Color functions shade(), lighter(), darker(), alpha(), mix()
|
||||||
|
|
||||||
|
* Translation updates:
|
||||||
|
Hebrew
|
||||||
|
|
||||||
|
|
||||||
|
Overview of Changes in 4.15.1, 21-05-2024
|
||||||
=========================================
|
=========================================
|
||||||
|
|
||||||
* GtkGraphicsOffload:
|
* GtkGraphicsOffload:
|
||||||
- Don't crash without a child
|
- Don't crash without a child
|
||||||
|
|
||||||
|
* GtkSpinner:
|
||||||
|
- Don't animate when unmapped
|
||||||
|
|
||||||
* CSS:
|
* CSS:
|
||||||
- Support the :root selector
|
- Support the :root selector
|
||||||
|
- Support variables and custom properties (https://www.w3.org/TR/css-variables-1/)
|
||||||
|
- Implement math functions (https://www.w3.org/TR/css-values-4/)
|
||||||
|
- Support modern syntax and calc in rgb() and hsl()
|
||||||
|
|
||||||
* Icontheme:
|
* Icontheme:
|
||||||
- Make symbolic svg loading more efficient
|
- Make symbolic svg loading more efficient
|
||||||
@@ -14,19 +57,22 @@ Overview of Changes in 4.15.1, xx-xx-xxxx
|
|||||||
* Accessibility:
|
* Accessibility:
|
||||||
- Make the gtk-demo sidebar search more accessible
|
- Make the gtk-demo sidebar search more accessible
|
||||||
- Stop emitting focus events
|
- Stop emitting focus events
|
||||||
|
- Realize child contexts when necessary
|
||||||
|
|
||||||
* GDK:
|
* GDK:
|
||||||
- Support XDG_ACTIVATION_TOKEN
|
- Support XDG_ACTIVATION_TOKEN
|
||||||
- dmabuf: Be more defensive when importing unknown formats to GL
|
- dmabuf: Be more defensive when importing unknown formats to GL
|
||||||
- dmabuf: Use narrow range for YUV
|
- dmabuf: Use narrow range for YUV
|
||||||
|
- vulkan: Recreate swapchains when necessary or beneficial
|
||||||
|
|
||||||
* GSK:
|
* GSK:
|
||||||
- Improve logging for GDK_DEBUG=offload
|
- Improve logging for GDK_DEBUG=offload
|
||||||
- Improve logging for GSK_DEBUG=renderer
|
- Improve logging for GSK_DEBUG=renderer
|
||||||
- gpu: Warn about inefficient texture import
|
- gpu: Warn about inefficient texture import
|
||||||
- gpu: Handle tiny offscreens correctly
|
- gpu: Handle tiny offscreens correctly
|
||||||
- vulkan: Add profiler marks in various places
|
- vulkan: Add profiler marks in various places
|
||||||
- vulkan: Fix a problem with imported dmabufs showing up black
|
- vulkan: Fix a problem with imported dmabufs showing up black
|
||||||
|
- cairo: Speed up mask nodes, since we use them for symbolic icons
|
||||||
|
|
||||||
* Wayland:
|
* Wayland:
|
||||||
- Use wl_compositor version 6
|
- Use wl_compositor version 6
|
||||||
@@ -39,13 +85,22 @@ Overview of Changes in 4.15.1, xx-xx-xxxx
|
|||||||
|
|
||||||
* Debugging:
|
* Debugging:
|
||||||
- Show more texture details in the recorder
|
- Show more texture details in the recorder
|
||||||
|
- Use GTK_DEBUG=css to see CSS deprecations
|
||||||
|
|
||||||
* macOS:
|
* macOS:
|
||||||
- Fix problems with events handed back to the OS
|
- Fix problems with events handed back to the OS
|
||||||
- Respect GDK_DEBUG=default-settings
|
- Respect GDK_DEBUG=default-settings
|
||||||
|
- Allow applictions to handle Dock > Quit
|
||||||
|
|
||||||
|
* Deprecations:
|
||||||
|
- Use of @name colors in CSS
|
||||||
|
|
||||||
* Translation updates:
|
* Translation updates:
|
||||||
|
Catalan
|
||||||
|
Georgian
|
||||||
|
Hungarian
|
||||||
Korean
|
Korean
|
||||||
|
Portuguese
|
||||||
Turkish
|
Turkish
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,16 +15,16 @@ spec.
|
|||||||
The following units are supported for basic datatypes:
|
The following units are supported for basic datatypes:
|
||||||
|
|
||||||
Length
|
Length
|
||||||
: px, pt, em, ex, rem, pc, in, cm, mm, calc()
|
: px, pt, em, ex, rem, pc, in, cm, mm
|
||||||
|
|
||||||
Percentage
|
Percentage
|
||||||
: %, calc()
|
: %
|
||||||
|
|
||||||
Angle
|
Angle
|
||||||
: deg, grad, turn, calc()
|
: deg, rad, grad, turn
|
||||||
|
|
||||||
Time
|
Time
|
||||||
: s, ms, calc()
|
: s, ms
|
||||||
|
|
||||||
Length values with the em or ex units are resolved using the font
|
Length values with the em or ex units are resolved using the font
|
||||||
size value, unless they occur in setting the font-size itself, in
|
size value, unless they occur in setting the font-size itself, in
|
||||||
@@ -33,11 +33,15 @@ which case they are resolved using the inherited font size value.
|
|||||||
The rem unit is resolved using the initial font size value, which is
|
The rem unit is resolved using the initial font size value, which is
|
||||||
not quite the same as the CSS definition of rem.
|
not quite the same as the CSS definition of rem.
|
||||||
|
|
||||||
The calc() notation adds considerable expressive power. There are limits
|
Length values using physical units (pt, pc, in, cm, mm) are translated
|
||||||
on what types can be combined in such an expression (e.g. it does not make
|
to px using the dpi value specified by the -gtk-dpi property, which is
|
||||||
sense to add a number and a time). For the full details, see the
|
different from the CSS definition, which uses a fixed dpi of 96.
|
||||||
[CSS3 Values and Units](https://www.w3.org/TR/css3-values/#calc-notation)
|
|
||||||
spec.
|
The calc() notation adds considerable expressive power to all of these
|
||||||
|
datatypes. There are limits on what types can be combined in such an
|
||||||
|
expression (e.g. it does not make sense to add a number and a time).
|
||||||
|
For the full details, see the
|
||||||
|
[CSS Values and Units](https://www.w3.org/TR/css-values-4/) spec.
|
||||||
|
|
||||||
A common pattern among shorthand properties (called 'four sides') is one
|
A common pattern among shorthand properties (called 'four sides') is one
|
||||||
where one to four values can be specified, to determine a value for each
|
where one to four values can be specified, to determine a value for each
|
||||||
@@ -82,36 +86,54 @@ color: var(--prop, green);
|
|||||||
|
|
||||||
## Colors
|
## Colors
|
||||||
|
|
||||||
GTK extends the CSS syntax with several additional ways to specify colors.
|
### CSS Colors
|
||||||
|
|
||||||
|
Colors can be expressed in numerous ways in CSS (see the
|
||||||
|
[Color Module](https://www.w3.org/TR/css-color-5/). GTK supports
|
||||||
|
many (but not all) of these.
|
||||||
|
|
||||||
|
You can use rgb(), rgba(), hsl() with both the legacy or the modern CSS
|
||||||
|
syntax, and calc() can be used as well in color expressions. hwb(), oklab(),
|
||||||
|
oklch(), color(), color-mix() and relative colors are supported as well.
|
||||||
|
|
||||||
|
### Non-CSS Colors
|
||||||
|
|
||||||
|
GTK extends the CSS syntax with several additional ways to specify colors.
|
||||||
|
|
||||||
|
These extensions are deprecated and should be replaced by the equivalent
|
||||||
|
standard CSS notions.
|
||||||
|
|
||||||
The first is a reference to a color defined via a @define-color rule in CSS.
|
The first is a reference to a color defined via a @define-color rule in CSS.
|
||||||
The syntax for @define-color rules is as follows:
|
The syntax for @define-color rules is as follows:
|
||||||
|
|
||||||
```
|
```
|
||||||
@define-color Name Color
|
@define-color name color
|
||||||
```
|
```
|
||||||
|
|
||||||
To refer to the color defined by a @define-color rule, prefix the name with @.
|
To refer to the color defined by a @define-color rule, prefix the name with @.
|
||||||
|
|
||||||
|
The standard CSS mechanisms that should be used instead of @define-color are
|
||||||
|
custom properties, :root and var().
|
||||||
|
|
||||||
GTK also supports color expressions, which allow colors to be transformed to
|
GTK also supports color expressions, which allow colors to be transformed to
|
||||||
new ones. Color expressions can be nested, providing a rich language to
|
new ones. Color expressions can be nested, providing a rich language to
|
||||||
define colors. Color expressions resemble functions, taking 1 or more colors
|
define colors. Color expressions resemble functions, taking 1 or more colors
|
||||||
and in some cases a number as arguments.
|
and in some cases a number as arguments.
|
||||||
|
|
||||||
`lighter(Color)`
|
`lighter(color)`
|
||||||
: produces a brighter variant of Color
|
: produces a brighter variant of `color`.
|
||||||
|
|
||||||
`darker(Color)`
|
`darker(color)`
|
||||||
: produces a darker variant of Color
|
: produces a darker variant of `color`.
|
||||||
|
|
||||||
`shade(Color, Number)`
|
`shade(color, number)`
|
||||||
: changes the lightness of Color. The number ranges from 0 for black to 2 for white.
|
: changes the lightness of `color`. The `number` ranges from 0 for black to 2 for white.
|
||||||
|
|
||||||
`alpha(Color, Number)`
|
`alpha(color, number)`
|
||||||
: replaces the alpha value of color with number (between 0 and 1)
|
: multiplies the alpha value of `color` by `number` (between 0 and 1).
|
||||||
|
|
||||||
`mix(Color1, Color2, Number)`
|
`mix(color1, color2, number)`
|
||||||
: interpolates between the two colors
|
: interpolates between the two colors.
|
||||||
|
|
||||||
## Images
|
## Images
|
||||||
|
|
||||||
@@ -119,7 +141,7 @@ GTK extends the CSS syntax for images and also uses it for specifying icons.
|
|||||||
To load a themed icon, use
|
To load a themed icon, use
|
||||||
|
|
||||||
```
|
```
|
||||||
-gtk-icontheme(Name)
|
-gtk-icontheme(name)
|
||||||
```
|
```
|
||||||
|
|
||||||
The specified icon name is used to look up a themed icon, while taking into
|
The specified icon name is used to look up a themed icon, while taking into
|
||||||
@@ -148,14 +170,14 @@ and the
|
|||||||
syntax makes this available. -gtk-recolor requires a url as first argument.
|
syntax makes this available. -gtk-recolor requires a url as first argument.
|
||||||
The remaining arguments specify the color palette to use. If the palette is
|
The remaining arguments specify the color palette to use. If the palette is
|
||||||
not explicitly specified, the current value of the -gtk-icon-palette property
|
not explicitly specified, the current value of the -gtk-icon-palette property
|
||||||
is used.
|
is used.
|
||||||
|
|
||||||
GTK supports scaled rendering on hi-resolution displays. This works best if
|
GTK supports scaled rendering on hi-resolution displays. This works best if
|
||||||
images can specify normal and hi-resolution variants. From CSS, this can be
|
images can specify normal and hi-resolution variants. From CSS, this can be
|
||||||
done with
|
done with
|
||||||
|
|
||||||
```
|
```
|
||||||
-gtk-scaled(Image1, Image2)
|
-gtk-scaled(image1, image2)
|
||||||
```
|
```
|
||||||
|
|
||||||
## GTK CSS Properties
|
## GTK CSS Properties
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ SYNOPSIS
|
|||||||
|
|
|
|
||||||
| **gtk4-rendernode-tool** benchmark [OPTIONS...] <FILE>
|
| **gtk4-rendernode-tool** benchmark [OPTIONS...] <FILE>
|
||||||
| **gtk4-rendernode-tool** compare [OPTIONS...] <FILE1> <FILE2>
|
| **gtk4-rendernode-tool** compare [OPTIONS...] <FILE1> <FILE2>
|
||||||
|
| **gtk4-rendernode-tool** extract [OPTIONS...] <FILE>
|
||||||
| **gtk4-rendernode-tool** info [OPTIONS...] <FILE>
|
| **gtk4-rendernode-tool** info [OPTIONS...] <FILE>
|
||||||
| **gtk4-rendernode-tool** render [OPTIONS...] <FILE> [<FILE>]
|
| **gtk4-rendernode-tool** render [OPTIONS...] <FILE> [<FILE>]
|
||||||
| **gtk4-rendernode-tool** show [OPTIONS...] <FILE>
|
| **gtk4-rendernode-tool** show [OPTIONS...] <FILE>
|
||||||
@@ -99,3 +100,15 @@ exit code is 1. If the images are identical, it is 0.
|
|||||||
``--quiet``
|
``--quiet``
|
||||||
|
|
||||||
Don't write results to stdout.
|
Don't write results to stdout.
|
||||||
|
|
||||||
|
|
||||||
|
Extract
|
||||||
|
^^^^^^^
|
||||||
|
|
||||||
|
The ``extract`` command saves all the data urls found in a node file to a given
|
||||||
|
directory. The file names for the extracted files are derived from the mimetype
|
||||||
|
of the url.
|
||||||
|
|
||||||
|
``--dir=DIRECTORY``
|
||||||
|
|
||||||
|
Save extracted files in ``DIRECTORY`` (defaults to the current directory).
|
||||||
|
|||||||
@@ -77,11 +77,13 @@ content_files = [
|
|||||||
"section-tree-widget.md",
|
"section-tree-widget.md",
|
||||||
"migrating-2to4.md",
|
"migrating-2to4.md",
|
||||||
"migrating-3to4.md",
|
"migrating-3to4.md",
|
||||||
|
"migrating-4to5.md",
|
||||||
"broadway.md",
|
"broadway.md",
|
||||||
"osx.md",
|
"osx.md",
|
||||||
"wayland.md",
|
"wayland.md",
|
||||||
"windows.md",
|
"windows.md",
|
||||||
"x11.md",
|
"x11.md",
|
||||||
|
"tools.md",
|
||||||
"visual_index.md",
|
"visual_index.md",
|
||||||
]
|
]
|
||||||
content_images = [
|
content_images = [
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ expand_content_md_files = [
|
|||||||
'running.md',
|
'running.md',
|
||||||
'migrating-2to4.md',
|
'migrating-2to4.md',
|
||||||
'migrating-3to4.md',
|
'migrating-3to4.md',
|
||||||
|
'migrating-4to5.md',
|
||||||
'actions.md',
|
'actions.md',
|
||||||
'input-handling.md',
|
'input-handling.md',
|
||||||
'drawing-model.md',
|
'drawing-model.md',
|
||||||
@@ -25,7 +26,8 @@ expand_content_md_files = [
|
|||||||
'section-tree-widget.md',
|
'section-tree-widget.md',
|
||||||
'section-list-widget.md',
|
'section-list-widget.md',
|
||||||
'question_index.md',
|
'question_index.md',
|
||||||
'visual_index.md'
|
'visual_index.md',
|
||||||
|
'tools.md',
|
||||||
]
|
]
|
||||||
|
|
||||||
gtk_images = []
|
gtk_images = []
|
||||||
@@ -60,39 +62,39 @@ if get_option('documentation')
|
|||||||
build_by_default: true,
|
build_by_default: true,
|
||||||
install: true,
|
install: true,
|
||||||
install_dir: docs_dir,
|
install_dir: docs_dir,
|
||||||
|
install_tag: 'doc',
|
||||||
)
|
)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
rst2man = find_program('rst2man', 'rst2man.py', required: false)
|
rst2man = find_program('rst2man', 'rst2man.py', required: get_option('man-pages'))
|
||||||
if get_option('man-pages') and not rst2man.found()
|
rst2html5 = find_program('rst2html5', 'rst2html5.py', required: get_option('documentation'))
|
||||||
error('No rst2man found, but man pages were explicitly enabled')
|
|
||||||
|
rst_files = [
|
||||||
|
[ 'gtk4-broadwayd', '1' ],
|
||||||
|
[ 'gtk4-builder-tool', '1' ],
|
||||||
|
[ 'gtk4-encode-symbolic-svg', '1', ],
|
||||||
|
[ 'gtk4-launch', '1', ],
|
||||||
|
[ 'gtk4-query-settings', '1', ],
|
||||||
|
[ 'gtk4-rendernode-tool', '1' ],
|
||||||
|
[ 'gtk4-update-icon-cache', '1', ],
|
||||||
|
[ 'gtk4-path-tool', '1', ],
|
||||||
|
]
|
||||||
|
|
||||||
|
if get_option('build-demos')
|
||||||
|
rst_files += [
|
||||||
|
[ 'gtk4-demo', '1', ],
|
||||||
|
[ 'gtk4-demo-application', '1', ],
|
||||||
|
[ 'gtk4-widget-factory', '1', ],
|
||||||
|
[ 'gtk4-icon-browser', '1', ],
|
||||||
|
[ 'gtk4-node-editor', '1', ],
|
||||||
|
]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if get_option('man-pages') and rst2man.found()
|
rst2x_flags = [
|
||||||
rst_files = [
|
'--syntax-highlight=none',
|
||||||
[ 'gtk4-broadwayd', '1' ],
|
]
|
||||||
[ 'gtk4-builder-tool', '1' ],
|
|
||||||
[ 'gtk4-encode-symbolic-svg', '1', ],
|
|
||||||
[ 'gtk4-launch', '1', ],
|
|
||||||
[ 'gtk4-query-settings', '1', ],
|
|
||||||
[ 'gtk4-rendernode-tool', '1' ],
|
|
||||||
[ 'gtk4-update-icon-cache', '1', ],
|
|
||||||
[ 'gtk4-path-tool', '1', ],
|
|
||||||
]
|
|
||||||
|
|
||||||
if get_option('build-demos')
|
if get_option('man-pages')
|
||||||
rst_files += [
|
|
||||||
[ 'gtk4-demo', '1', ],
|
|
||||||
[ 'gtk4-demo-application', '1', ],
|
|
||||||
[ 'gtk4-widget-factory', '1', ],
|
|
||||||
[ 'gtk4-icon-browser', '1', ],
|
|
||||||
[ 'gtk4-node-editor', '1', ],
|
|
||||||
]
|
|
||||||
endif
|
|
||||||
|
|
||||||
rst2man_flags = [
|
|
||||||
'--syntax-highlight=none',
|
|
||||||
]
|
|
||||||
|
|
||||||
foreach rst: rst_files
|
foreach rst: rst_files
|
||||||
man_name = rst[0]
|
man_name = rst[0]
|
||||||
@@ -103,12 +105,34 @@ if get_option('man-pages') and rst2man.found()
|
|||||||
output: '@0@.@1@'.format(man_name, man_section),
|
output: '@0@.@1@'.format(man_name, man_section),
|
||||||
command: [
|
command: [
|
||||||
rst2man,
|
rst2man,
|
||||||
rst2man_flags,
|
rst2x_flags,
|
||||||
'@INPUT@',
|
'@INPUT@',
|
||||||
],
|
],
|
||||||
capture: true,
|
capture: true,
|
||||||
install: true,
|
install: true,
|
||||||
install_dir: get_option('mandir') / 'man@0@'.format(man_section),
|
install_dir: get_option('mandir') / 'man@0@'.format(man_section),
|
||||||
|
install_tag: 'doc',
|
||||||
|
)
|
||||||
|
endforeach
|
||||||
|
endif
|
||||||
|
|
||||||
|
if get_option('documentation')
|
||||||
|
|
||||||
|
foreach rst: rst_files
|
||||||
|
man_name = rst[0]
|
||||||
|
|
||||||
|
custom_target(
|
||||||
|
input: '@0@.rst'.format(man_name),
|
||||||
|
output: '@0@.html'.format(man_name),
|
||||||
|
command: [
|
||||||
|
rst2html5,
|
||||||
|
rst2x_flags,
|
||||||
|
'@INPUT@',
|
||||||
|
],
|
||||||
|
capture: true,
|
||||||
|
install: true,
|
||||||
|
install_dir: docs_dir / 'gtk4',
|
||||||
|
install_tag: 'doc',
|
||||||
)
|
)
|
||||||
endforeach
|
endforeach
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ use a GtkLabel.
|
|||||||
If you have a need for custom drawing that fits into the current
|
If you have a need for custom drawing that fits into the current
|
||||||
(dark or light) theme, e.g. for rendering a graph, you can still
|
(dark or light) theme, e.g. for rendering a graph, you can still
|
||||||
get the current style foreground color, using
|
get the current style foreground color, using
|
||||||
[method@Gtk.Widget.get_style_color].
|
[method@Gtk.Widget.get_color].
|
||||||
|
|
||||||
## Local stylesheets are going away
|
## Local stylesheets are going away
|
||||||
|
|
||||||
@@ -73,6 +73,103 @@ GTK 5 will no longer provide this functionality. The recommendations
|
|||||||
is to use a global stylesheet (i.e. gtk_style_context_add_provider_for_display())
|
is to use a global stylesheet (i.e. gtk_style_context_add_provider_for_display())
|
||||||
and rely on style classes to make your CSS apply only where desired.
|
and rely on style classes to make your CSS apply only where desired.
|
||||||
|
|
||||||
|
## Non-standard CSS extensions are going away
|
||||||
|
|
||||||
|
GTK's CSS machinery has a some non-standard extensions around colors:
|
||||||
|
named colors with \@define-color and color functions: lighter(), darker(),
|
||||||
|
shade(), alpha(), mix().
|
||||||
|
|
||||||
|
GTK now implements equivalent functionality from the CSS specs.
|
||||||
|
|
||||||
|
### \@define-color is going away
|
||||||
|
|
||||||
|
\@define-color should be replaced by custom properties in the :root scope.
|
||||||
|
|
||||||
|
Instead of
|
||||||
|
|
||||||
|
```
|
||||||
|
@define-color fg_color #2e3436
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
box {
|
||||||
|
color: @fg_color;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
use
|
||||||
|
|
||||||
|
```
|
||||||
|
:root {
|
||||||
|
--fg-color: #2e3436;
|
||||||
|
}
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
box {
|
||||||
|
color: var(--fg-color);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
For more information about custom CSS properties and variables, see the
|
||||||
|
[CSS Custom Properties for Cascading Variables](https://www.w3.org/TR/css-variables-1/)
|
||||||
|
spec.
|
||||||
|
|
||||||
|
### Color expressions are going away
|
||||||
|
|
||||||
|
The color functions can all be replaced by combinations of calc() and color-mix().
|
||||||
|
|
||||||
|
ligher(c) and darker(c) are just shade(c, 1.3) or shade(c, 0.7), respectively, and
|
||||||
|
thus can be handled the same way as shade in the examples below.
|
||||||
|
|
||||||
|
Replace
|
||||||
|
|
||||||
|
```
|
||||||
|
a {
|
||||||
|
color: mix(red, green, 0.8);
|
||||||
|
}
|
||||||
|
|
||||||
|
b {
|
||||||
|
color: alpha(green, 0.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
c {
|
||||||
|
color: shade(red, 1.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
d {
|
||||||
|
color: shade(red, 0.7);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
with
|
||||||
|
|
||||||
|
```
|
||||||
|
a {
|
||||||
|
color: color-mix(in srgb, red, green 80%);
|
||||||
|
}
|
||||||
|
|
||||||
|
b {
|
||||||
|
color: rgb(from green, r g b / calc(alpha * 0.6));
|
||||||
|
}
|
||||||
|
|
||||||
|
c {
|
||||||
|
color: hsl(from red, h calc(s * 1.3) calc(l * 1.3));
|
||||||
|
}
|
||||||
|
|
||||||
|
d {
|
||||||
|
color: hsl(from red, h calc(s * 0.7) calc(l * 0.7));
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Variations of these replacements are possible.
|
||||||
|
|
||||||
|
Note that GTK has historically computed mix() and shade() values in the SRGB and HSL
|
||||||
|
colorspaces, but using OKLAB instead might yield slightly better results.
|
||||||
|
|
||||||
|
For more information about color-mix(), see the
|
||||||
|
[CSS Color](https://drafts.csswg.org/css-color-5) spec.
|
||||||
|
|
||||||
## Chooser interfaces are going away
|
## Chooser interfaces are going away
|
||||||
|
|
||||||
The GtkColorChooser, GtkFontChooser, GtkFileChooser and GtkAppChooser
|
The GtkColorChooser, GtkFontChooser, GtkFileChooser and GtkAppChooser
|
||||||
|
|||||||
@@ -64,6 +64,6 @@ GTK is divided into three parts:
|
|||||||
[cairo]: https://www.cairographics.org/manual/
|
[cairo]: https://www.cairographics.org/manual/
|
||||||
[opengl]: https://www.opengl.org/about/
|
[opengl]: https://www.opengl.org/about/
|
||||||
[vulkan]: https://www.vulkan.org/
|
[vulkan]: https://www.vulkan.org/
|
||||||
[pango]: https://docs.gtk.org/pango/
|
[pango]: https://docs.gtk.org/Pango/
|
||||||
[gdkpixbuf]: https://docs.gtk.org/gdk-pixbuf/
|
[gdkpixbuf]: https://docs.gtk.org/gdk-pixbuf/
|
||||||
[graphene]: https://ebassi.github.io/graphene/
|
[graphene]: https://ebassi.github.io/graphene/
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
Title: Tools and Demos
|
||||||
|
|
||||||
|
GTK ships with a number of tools and demos that come with their own
|
||||||
|
documentation in the form of man pages.
|
||||||
|
|
||||||
|
- [gtk4-broadwayd](gtk4-broadwayd.html)
|
||||||
|
- [gtk4-builder-tool](gtk4-builder-tool.html)
|
||||||
|
- [gtk4-demo](gtk4-demo.html)
|
||||||
|
- [gtk4-demo-application](gtk4-demo-application.html)
|
||||||
|
- [gtk4-encode-symbolic-svg](gtk4-encode-symbolic-svg.html)
|
||||||
|
- [gtk4-icon-browser](gtk4-icon-browser.html)
|
||||||
|
- [gtk4-launch](gtk4-launch.html)
|
||||||
|
- [gtk4-node-editor](gtk4-node-editor.html)
|
||||||
|
- [gtk4-path-tool](gtk4-path-tool.html)
|
||||||
|
- [gtk4-query-settings](gtk4-query-settings.html)
|
||||||
|
- [gtk4-rendernode-tool](gtk4-rendernode-tool.html)
|
||||||
|
- [gtk4-update-icon-cache](gtk4-update-icon-cache.html)
|
||||||
|
- [gtk4-widget-factory](gtk4-widget-factory.html)
|
||||||
+16
-8
@@ -41,8 +41,10 @@ G_BEGIN_DECLS
|
|||||||
|
|
||||||
#ifdef GDK_ARRAY_NULL_TERMINATED
|
#ifdef GDK_ARRAY_NULL_TERMINATED
|
||||||
#define GDK_ARRAY_REAL_SIZE(_size) ((_size) + 1)
|
#define GDK_ARRAY_REAL_SIZE(_size) ((_size) + 1)
|
||||||
|
#define GDK_ARRAY_MAX_SIZE (G_MAXSIZE / sizeof (_T_) - 1)
|
||||||
#else
|
#else
|
||||||
#define GDK_ARRAY_REAL_SIZE(_size) (_size)
|
#define GDK_ARRAY_REAL_SIZE(_size) (_size)
|
||||||
|
#define GDK_ARRAY_MAX_SIZE (G_MAXSIZE / sizeof (_T_))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* make this readable */
|
/* make this readable */
|
||||||
@@ -177,18 +179,23 @@ G_GNUC_UNUSED static inline void
|
|||||||
gdk_array(reserve) (GdkArray *self,
|
gdk_array(reserve) (GdkArray *self,
|
||||||
gsize n)
|
gsize n)
|
||||||
{
|
{
|
||||||
gsize new_size, size;
|
gsize new_capacity, size, capacity;
|
||||||
|
|
||||||
if (n <= gdk_array(get_capacity) (self))
|
if (G_UNLIKELY (n > GDK_ARRAY_MAX_SIZE))
|
||||||
return;
|
g_error ("requesting array size of %zu, but maximum size is %zu", n, GDK_ARRAY_MAX_SIZE);
|
||||||
|
|
||||||
|
capacity = gdk_array(get_capacity) (self);
|
||||||
|
if (n <= capacity)
|
||||||
|
return;
|
||||||
|
|
||||||
size = gdk_array(get_size) (self);
|
size = gdk_array(get_size) (self);
|
||||||
new_size = ((gsize) 1) << g_bit_storage (MAX (GDK_ARRAY_REAL_SIZE (n), 16) - 1);
|
/* capacity * 2 can overflow, that's why we MAX() */
|
||||||
|
new_capacity = MAX (GDK_ARRAY_REAL_SIZE (n), capacity * 2);
|
||||||
|
|
||||||
#ifdef GDK_ARRAY_PREALLOC
|
#ifdef GDK_ARRAY_PREALLOC
|
||||||
if (self->start == self->preallocated)
|
if (self->start == self->preallocated)
|
||||||
{
|
{
|
||||||
self->start = g_new (_T_, new_size);
|
self->start = g_new (_T_, new_capacity);
|
||||||
memcpy (self->start, self->preallocated, sizeof (_T_) * GDK_ARRAY_REAL_SIZE (size));
|
memcpy (self->start, self->preallocated, sizeof (_T_) * GDK_ARRAY_REAL_SIZE (size));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -196,15 +203,15 @@ gdk_array(reserve) (GdkArray *self,
|
|||||||
#ifdef GDK_ARRAY_NULL_TERMINATED
|
#ifdef GDK_ARRAY_NULL_TERMINATED
|
||||||
if (self->start == NULL)
|
if (self->start == NULL)
|
||||||
{
|
{
|
||||||
self->start = g_new (_T_, new_size);
|
self->start = g_new (_T_, new_capacity);
|
||||||
*self->start = *(_T_[1]) { 0 };
|
*self->start = *(_T_[1]) { 0 };
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
self->start = g_renew (_T_, self->start, new_size);
|
self->start = g_renew (_T_, self->start, new_capacity);
|
||||||
|
|
||||||
self->end = self->start + size;
|
self->end = self->start + size;
|
||||||
self->end_allocation = self->start + new_size;
|
self->end_allocation = self->start + new_capacity;
|
||||||
#ifdef GDK_ARRAY_NULL_TERMINATED
|
#ifdef GDK_ARRAY_NULL_TERMINATED
|
||||||
self->end_allocation--;
|
self->end_allocation--;
|
||||||
#endif
|
#endif
|
||||||
@@ -312,6 +319,7 @@ gdk_array(get) (const GdkArray *self,
|
|||||||
#undef gdk_array_paste
|
#undef gdk_array_paste
|
||||||
#undef gdk_array
|
#undef gdk_array
|
||||||
#undef GDK_ARRAY_REAL_SIZE
|
#undef GDK_ARRAY_REAL_SIZE
|
||||||
|
#undef GDK_ARRAY_MAX_SIZE
|
||||||
|
|
||||||
#undef GDK_ARRAY_BY_VALUE
|
#undef GDK_ARRAY_BY_VALUE
|
||||||
#undef GDK_ARRAY_ELEMENT_TYPE
|
#undef GDK_ARRAY_ELEMENT_TYPE
|
||||||
|
|||||||
@@ -522,8 +522,6 @@ gdk_clipboard_get_content (GdkClipboard *clipboard)
|
|||||||
*
|
*
|
||||||
* If the clipboard is not local, this function does nothing but report success.
|
* If the clipboard is not local, this function does nothing but report success.
|
||||||
*
|
*
|
||||||
* The @callback must call [method@Gdk.Clipboard.store_finish].
|
|
||||||
*
|
|
||||||
* The purpose of this call is to preserve clipboard contents beyond the
|
* The purpose of this call is to preserve clipboard contents beyond the
|
||||||
* lifetime of an application, so this function is typically called on
|
* lifetime of an application, so this function is typically called on
|
||||||
* exit. Depending on the platform, the functionality may not be available
|
* exit. Depending on the platform, the functionality may not be available
|
||||||
@@ -638,9 +636,6 @@ gdk_clipboard_read_internal (GdkClipboard *clipboard,
|
|||||||
* Asynchronously requests an input stream to read the @clipboard's
|
* Asynchronously requests an input stream to read the @clipboard's
|
||||||
* contents from.
|
* contents from.
|
||||||
*
|
*
|
||||||
* When the operation is finished @callback will be called. You must then
|
|
||||||
* call [method@Gdk.Clipboard.read_finish] to get the result of the operation.
|
|
||||||
*
|
|
||||||
* The clipboard will choose the most suitable mime type from the given list
|
* The clipboard will choose the most suitable mime type from the given list
|
||||||
* to fulfill the request, preferring the ones listed first.
|
* to fulfill the request, preferring the ones listed first.
|
||||||
*/
|
*/
|
||||||
@@ -834,9 +829,6 @@ gdk_clipboard_read_value_internal (GdkClipboard *clipboard,
|
|||||||
* Asynchronously request the @clipboard contents converted to the given
|
* Asynchronously request the @clipboard contents converted to the given
|
||||||
* @type.
|
* @type.
|
||||||
*
|
*
|
||||||
* When the operation is finished @callback will be called. You must then call
|
|
||||||
* [method@Gdk.Clipboard.read_value_finish] to get the resulting `GValue`.
|
|
||||||
*
|
|
||||||
* For local clipboard contents that are available in the given `GType`,
|
* For local clipboard contents that are available in the given `GType`,
|
||||||
* the value will be copied directly. Otherwise, GDK will try to use
|
* the value will be copied directly. Otherwise, GDK will try to use
|
||||||
* [func@content_deserialize_async] to convert the clipboard's data.
|
* [func@content_deserialize_async] to convert the clipboard's data.
|
||||||
@@ -895,9 +887,6 @@ gdk_clipboard_read_value_finish (GdkClipboard *clipboard,
|
|||||||
*
|
*
|
||||||
* Asynchronously request the @clipboard contents converted to a `GdkPixbuf`.
|
* Asynchronously request the @clipboard contents converted to a `GdkPixbuf`.
|
||||||
*
|
*
|
||||||
* When the operation is finished @callback will be called. You must then
|
|
||||||
* call [method@Gdk.Clipboard.read_texture_finish] to get the result.
|
|
||||||
*
|
|
||||||
* This is a simple wrapper around [method@Gdk.Clipboard.read_value_async].
|
* This is a simple wrapper around [method@Gdk.Clipboard.read_value_async].
|
||||||
* Use that function or [method@Gdk.Clipboard.read_async] directly if you
|
* Use that function or [method@Gdk.Clipboard.read_async] directly if you
|
||||||
* need more control over the operation.
|
* need more control over the operation.
|
||||||
@@ -960,9 +949,6 @@ gdk_clipboard_read_texture_finish (GdkClipboard *clipboard,
|
|||||||
*
|
*
|
||||||
* Asynchronously request the @clipboard contents converted to a string.
|
* Asynchronously request the @clipboard contents converted to a string.
|
||||||
*
|
*
|
||||||
* When the operation is finished @callback will be called. You must then
|
|
||||||
* call [method@Gdk.Clipboard.read_text_finish] to get the result.
|
|
||||||
*
|
|
||||||
* This is a simple wrapper around [method@Gdk.Clipboard.read_value_async].
|
* This is a simple wrapper around [method@Gdk.Clipboard.read_value_async].
|
||||||
* Use that function or [method@Gdk.Clipboard.read_async] directly if you
|
* Use that function or [method@Gdk.Clipboard.read_async] directly if you
|
||||||
* need more control over the operation.
|
* need more control over the operation.
|
||||||
|
|||||||
@@ -540,9 +540,6 @@ deserialize_not_found (GdkContentDeserializer *deserializer)
|
|||||||
*
|
*
|
||||||
* The default I/O priority is %G_PRIORITY_DEFAULT (i.e. 0), and lower numbers
|
* The default I/O priority is %G_PRIORITY_DEFAULT (i.e. 0), and lower numbers
|
||||||
* indicate a higher priority.
|
* indicate a higher priority.
|
||||||
*
|
|
||||||
* When the operation is finished, @callback will be called. You must then
|
|
||||||
* call [func@Gdk.content_deserialize_finish] to get the result of the operation.
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gdk_content_deserialize_async (GInputStream *stream,
|
gdk_content_deserialize_async (GInputStream *stream,
|
||||||
|
|||||||
@@ -279,10 +279,6 @@ gdk_content_provider_content_changed (GdkContentProvider *provider)
|
|||||||
* Asynchronously writes the contents of @provider to @stream in the given
|
* Asynchronously writes the contents of @provider to @stream in the given
|
||||||
* @mime_type.
|
* @mime_type.
|
||||||
*
|
*
|
||||||
* When the operation is finished @callback will be called. You must then call
|
|
||||||
* [method@Gdk.ContentProvider.write_mime_type_finish] to get the result
|
|
||||||
* of the operation.
|
|
||||||
*
|
|
||||||
* The given mime type does not need to be listed in the formats returned by
|
* The given mime type does not need to be listed in the formats returned by
|
||||||
* [method@Gdk.ContentProvider.ref_formats]. However, if the given `GType` is
|
* [method@Gdk.ContentProvider.ref_formats]. However, if the given `GType` is
|
||||||
* not supported, `G_IO_ERROR_NOT_SUPPORTED` will be reported.
|
* not supported, `G_IO_ERROR_NOT_SUPPORTED` will be reported.
|
||||||
|
|||||||
@@ -546,9 +546,6 @@ serialize_not_found (GdkContentSerializer *serializer)
|
|||||||
*
|
*
|
||||||
* The default I/O priority is %G_PRIORITY_DEFAULT (i.e. 0), and lower numbers
|
* The default I/O priority is %G_PRIORITY_DEFAULT (i.e. 0), and lower numbers
|
||||||
* indicate a higher priority.
|
* indicate a higher priority.
|
||||||
*
|
|
||||||
* When the operation is finished, @callback will be called. You must then
|
|
||||||
* call [func@Gdk.content_serialize_finish] to get the result of the operation.
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gdk_content_serialize_async (GOutputStream *stream,
|
gdk_content_serialize_async (GOutputStream *stream,
|
||||||
|
|||||||
+1
-1
@@ -52,7 +52,7 @@ GdkCursor* gdk_cursor_new_from_name (const char *name,
|
|||||||
GdkCursor *fallback);
|
GdkCursor *fallback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GdkCursorGetTestureCallback:
|
* GdkCursorGetTextureCallback:
|
||||||
* @cursor: the `GdkCursor`
|
* @cursor: the `GdkCursor`
|
||||||
* @cursor_size: the nominal cursor size, in application pixels
|
* @cursor_size: the nominal cursor size, in application pixels
|
||||||
* @scale: the device scale
|
* @scale: the device scale
|
||||||
|
|||||||
@@ -62,6 +62,13 @@ struct _GdkDmabufTextureClass
|
|||||||
GdkTextureClass parent_class;
|
GdkTextureClass parent_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gdk_dmabuf_error_quark:
|
||||||
|
*
|
||||||
|
* Registers an error quark for [class@Gdk.DmabufTexture] errors.
|
||||||
|
*
|
||||||
|
* Returns: the error quark
|
||||||
|
**/
|
||||||
G_DEFINE_QUARK (gdk-dmabuf-error-quark, gdk_dmabuf_error)
|
G_DEFINE_QUARK (gdk-dmabuf-error-quark, gdk_dmabuf_error)
|
||||||
|
|
||||||
G_DEFINE_TYPE (GdkDmabufTexture, gdk_dmabuf_texture, GDK_TYPE_TEXTURE)
|
G_DEFINE_TYPE (GdkDmabufTexture, gdk_dmabuf_texture, GDK_TYPE_TEXTURE)
|
||||||
|
|||||||
+2
-6
@@ -134,7 +134,7 @@ gdk_drop_read_local_async (GdkDrop *self,
|
|||||||
|
|
||||||
g_object_get (priv->drag, "content", &content, NULL);
|
g_object_get (priv->drag, "content", &content, NULL);
|
||||||
content_formats = gdk_content_provider_ref_formats (content);
|
content_formats = gdk_content_provider_ref_formats (content);
|
||||||
g_object_unref (content);
|
g_object_unref (content);
|
||||||
content_formats = gdk_content_formats_union_serialize_mime_types (content_formats);
|
content_formats = gdk_content_formats_union_serialize_mime_types (content_formats);
|
||||||
mime_type = gdk_content_formats_match_mime_type (content_formats, formats);
|
mime_type = gdk_content_formats_match_mime_type (content_formats, formats);
|
||||||
|
|
||||||
@@ -784,7 +784,7 @@ gdk_drop_read_value_internal (GdkDrop *self,
|
|||||||
GdkContentFormats *formats;
|
GdkContentFormats *formats;
|
||||||
GValue *value;
|
GValue *value;
|
||||||
GTask *task;
|
GTask *task;
|
||||||
|
|
||||||
g_return_if_fail (priv->state != GDK_DROP_STATE_FINISHED);
|
g_return_if_fail (priv->state != GDK_DROP_STATE_FINISHED);
|
||||||
|
|
||||||
task = g_task_new (self, cancellable, callback, user_data);
|
task = g_task_new (self, cancellable, callback, user_data);
|
||||||
@@ -849,10 +849,6 @@ gdk_drop_read_value_internal (GdkDrop *self,
|
|||||||
* Asynchronously request the drag operation's contents converted
|
* Asynchronously request the drag operation's contents converted
|
||||||
* to the given @type.
|
* to the given @type.
|
||||||
*
|
*
|
||||||
* When the operation is finished @callback will be called. You must
|
|
||||||
* then call [method@Gdk.Drop.read_value_finish] to get the resulting
|
|
||||||
* `GValue`.
|
|
||||||
*
|
|
||||||
* For local drag-and-drop operations that are available in the given
|
* For local drag-and-drop operations that are available in the given
|
||||||
* `GType`, the value will be copied directly. Otherwise, GDK will
|
* `GType`, the value will be copied directly. Otherwise, GDK will
|
||||||
* try to use [func@Gdk.content_deserialize_async] to convert the data.
|
* try to use [func@Gdk.content_deserialize_async] to convert the data.
|
||||||
|
|||||||
@@ -1371,6 +1371,8 @@ gdk_event_get_modifier_state (GdkEvent *event)
|
|||||||
* Extract the event surface relative x/y coordinates from an event.
|
* Extract the event surface relative x/y coordinates from an event.
|
||||||
*
|
*
|
||||||
* This position is in [surface coordinates](coordinates.html).
|
* This position is in [surface coordinates](coordinates.html).
|
||||||
|
*
|
||||||
|
* Returns: whether the positions were set
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
gdk_event_get_position (GdkEvent *event,
|
gdk_event_get_position (GdkEvent *event,
|
||||||
|
|||||||
@@ -152,6 +152,13 @@ enum {
|
|||||||
|
|
||||||
static GParamSpec *properties[LAST_PROP] = { NULL, };
|
static GParamSpec *properties[LAST_PROP] = { NULL, };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gdk_gl_error_quark:
|
||||||
|
*
|
||||||
|
* Registers an error quark for [class@Gdk.GLContext] errors.
|
||||||
|
*
|
||||||
|
* Returns: the error quark
|
||||||
|
**/
|
||||||
G_DEFINE_QUARK (gdk-gl-error-quark, gdk_gl_error)
|
G_DEFINE_QUARK (gdk-gl-error-quark, gdk_gl_error)
|
||||||
|
|
||||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkGLContext, gdk_gl_context, GDK_TYPE_DRAW_CONTEXT)
|
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkGLContext, gdk_gl_context, GDK_TYPE_DRAW_CONTEXT)
|
||||||
|
|||||||
+13
-2
@@ -396,10 +396,18 @@ gboolean
|
|||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
gdk_rgba_to_string (const GdkRGBA *rgba)
|
gdk_rgba_to_string (const GdkRGBA *rgba)
|
||||||
|
{
|
||||||
|
return g_string_free (gdk_rgba_print (rgba, g_string_new ("")), FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
GString *
|
||||||
|
gdk_rgba_print (const GdkRGBA *rgba,
|
||||||
|
GString *string)
|
||||||
{
|
{
|
||||||
if (rgba->alpha > 0.999)
|
if (rgba->alpha > 0.999)
|
||||||
{
|
{
|
||||||
return g_strdup_printf ("rgb(%d,%d,%d)",
|
g_string_append_printf (string,
|
||||||
|
"rgb(%d,%d,%d)",
|
||||||
(int)(0.5 + CLAMP (rgba->red, 0., 1.) * 255.),
|
(int)(0.5 + CLAMP (rgba->red, 0., 1.) * 255.),
|
||||||
(int)(0.5 + CLAMP (rgba->green, 0., 1.) * 255.),
|
(int)(0.5 + CLAMP (rgba->green, 0., 1.) * 255.),
|
||||||
(int)(0.5 + CLAMP (rgba->blue, 0., 1.) * 255.));
|
(int)(0.5 + CLAMP (rgba->blue, 0., 1.) * 255.));
|
||||||
@@ -410,12 +418,15 @@ gdk_rgba_to_string (const GdkRGBA *rgba)
|
|||||||
|
|
||||||
g_ascii_formatd (alpha, G_ASCII_DTOSTR_BUF_SIZE, "%g", CLAMP (rgba->alpha, 0, 1));
|
g_ascii_formatd (alpha, G_ASCII_DTOSTR_BUF_SIZE, "%g", CLAMP (rgba->alpha, 0, 1));
|
||||||
|
|
||||||
return g_strdup_printf ("rgba(%d,%d,%d,%s)",
|
g_string_append_printf (string,
|
||||||
|
"rgba(%d,%d,%d,%s)",
|
||||||
(int)(0.5 + CLAMP (rgba->red, 0., 1.) * 255.),
|
(int)(0.5 + CLAMP (rgba->red, 0., 1.) * 255.),
|
||||||
(int)(0.5 + CLAMP (rgba->green, 0., 1.) * 255.),
|
(int)(0.5 + CLAMP (rgba->green, 0., 1.) * 255.),
|
||||||
(int)(0.5 + CLAMP (rgba->blue, 0., 1.) * 255.),
|
(int)(0.5 + CLAMP (rgba->blue, 0., 1.) * 255.),
|
||||||
alpha);
|
alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|||||||
@@ -72,5 +72,8 @@ _gdk_rgba_equal (gconstpointer p1,
|
|||||||
rgba1->alpha == rgba2->alpha;
|
rgba1->alpha == rgba2->alpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GString * gdk_rgba_print (const GdkRGBA *rgba,
|
||||||
|
GString *string);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,13 @@
|
|||||||
#include "loaders/gdktiffprivate.h"
|
#include "loaders/gdktiffprivate.h"
|
||||||
#include "loaders/gdkjpegprivate.h"
|
#include "loaders/gdkjpegprivate.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gdk_texture_error_quark:
|
||||||
|
*
|
||||||
|
* Registers an error quark for [class@Gdk.Texture] errors.
|
||||||
|
*
|
||||||
|
* Returns: the error quark
|
||||||
|
**/
|
||||||
G_DEFINE_QUARK (gdk-texture-error-quark, gdk_texture_error)
|
G_DEFINE_QUARK (gdk-texture-error-quark, gdk_texture_error)
|
||||||
|
|
||||||
/* HACK: So we don't need to include any (not-yet-created) GSK or GTK headers */
|
/* HACK: So we don't need to include any (not-yet-created) GSK or GTK headers */
|
||||||
|
|||||||
@@ -767,9 +767,6 @@ gdk_toplevel_titlebar_gesture (GdkToplevel *toplevel,
|
|||||||
* This function asynchronously obtains a handle for a toplevel surface
|
* This function asynchronously obtains a handle for a toplevel surface
|
||||||
* that can be passed to other processes.
|
* that can be passed to other processes.
|
||||||
*
|
*
|
||||||
* When a handle has been obtained, @callback will be called, and can
|
|
||||||
* receive the handle via [method@Gdk.Toplevel.export_handle_finish].
|
|
||||||
*
|
|
||||||
* It is an error to call this function on a surface that is already
|
* It is an error to call this function on a surface that is already
|
||||||
* exported.
|
* exported.
|
||||||
*
|
*
|
||||||
|
|||||||
+6
-3
@@ -118,9 +118,12 @@ typedef enum
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* GdkTitlebarGesture:
|
* GdkTitlebarGesture:
|
||||||
* @GDK_TITLEBAR_GESTURE_DOUBLE_CLICK:
|
* @GDK_TITLEBAR_GESTURE_DOUBLE_CLICK: double click gesture
|
||||||
* @GDK_TITLEBAR_GESTURE_RIGHT_CLICK:
|
* @GDK_TITLEBAR_GESTURE_RIGHT_CLICK: right click gesture
|
||||||
* @GDK_TITLEBAR_GESTURE_MIDDLE_CLICK:
|
* @GDK_TITLEBAR_GESTURE_MIDDLE_CLICK: middle click gesture
|
||||||
|
*
|
||||||
|
* The kind of title bar gesture to emit with
|
||||||
|
* [method@Gdk.Toplevel.titlebar_gesture].
|
||||||
*
|
*
|
||||||
* Since: 4.4
|
* Since: 4.4
|
||||||
*/
|
*/
|
||||||
|
|||||||
+20
-7
@@ -94,6 +94,13 @@ enum {
|
|||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gdk_vulkan_error_quark:
|
||||||
|
*
|
||||||
|
* Registers an error quark for [class@Gdk.VulkanContext] errors.
|
||||||
|
*
|
||||||
|
* Returns: the error quark
|
||||||
|
**/
|
||||||
G_DEFINE_QUARK (gdk-vulkan-error-quark, gdk_vulkan_error)
|
G_DEFINE_QUARK (gdk-vulkan-error-quark, gdk_vulkan_error)
|
||||||
|
|
||||||
static guint signals[LAST_SIGNAL] = { 0 };
|
static guint signals[LAST_SIGNAL] = { 0 };
|
||||||
@@ -607,7 +614,8 @@ physical_device_check_features (VkPhysicalDevice device)
|
|||||||
features |= GDK_VULKAN_FEATURE_YCBCR;
|
features |= GDK_VULKAN_FEATURE_YCBCR;
|
||||||
|
|
||||||
if (physical_device_supports_extension (device, VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME) &&
|
if (physical_device_supports_extension (device, VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME) &&
|
||||||
physical_device_supports_extension (device, VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME))
|
physical_device_supports_extension (device, VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME) &&
|
||||||
|
physical_device_supports_extension (device, VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME))
|
||||||
features |= GDK_VULKAN_FEATURE_DMABUF;
|
features |= GDK_VULKAN_FEATURE_DMABUF;
|
||||||
|
|
||||||
if (physical_device_supports_extension (device, VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME))
|
if (physical_device_supports_extension (device, VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME))
|
||||||
@@ -1517,6 +1525,7 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
|
|||||||
|
|
||||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME);
|
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME);
|
||||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME);
|
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME);
|
||||||
|
g_ptr_array_add (device_extensions, (gpointer) VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME);
|
||||||
|
|
||||||
g_ptr_array_add (device_extensions, (gpointer) VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME);
|
g_ptr_array_add (device_extensions, (gpointer) VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME);
|
||||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME);
|
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME);
|
||||||
@@ -1857,8 +1866,9 @@ gdk_display_unref_vulkan (GdkDisplay *display)
|
|||||||
{
|
{
|
||||||
g_free (key);
|
g_free (key);
|
||||||
vkDestroyShaderModule (display->vk_device,
|
vkDestroyShaderModule (display->vk_device,
|
||||||
value,
|
*((VkShaderModule *)value),
|
||||||
NULL);
|
NULL);
|
||||||
|
g_free (value);
|
||||||
}
|
}
|
||||||
g_hash_table_unref (display->vk_shader_modules);
|
g_hash_table_unref (display->vk_shader_modules);
|
||||||
|
|
||||||
@@ -1986,13 +1996,13 @@ VkShaderModule
|
|||||||
gdk_display_get_vk_shader_module (GdkDisplay *self,
|
gdk_display_get_vk_shader_module (GdkDisplay *self,
|
||||||
const char *resource_name)
|
const char *resource_name)
|
||||||
{
|
{
|
||||||
VkShaderModule shader;
|
VkShaderModule *shader;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GBytes *bytes;
|
GBytes *bytes;
|
||||||
|
|
||||||
shader = g_hash_table_lookup (self->vk_shader_modules, resource_name);
|
shader = g_hash_table_lookup (self->vk_shader_modules, resource_name);
|
||||||
if (shader)
|
if (shader)
|
||||||
return shader;
|
return *shader;
|
||||||
|
|
||||||
bytes = g_resources_lookup_data (resource_name, 0, &error);
|
bytes = g_resources_lookup_data (resource_name, 0, &error);
|
||||||
if (bytes == NULL)
|
if (bytes == NULL)
|
||||||
@@ -2002,6 +2012,7 @@ gdk_display_get_vk_shader_module (GdkDisplay *self,
|
|||||||
return VK_NULL_HANDLE;
|
return VK_NULL_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
shader = g_new0 (VkShaderModule, 1);
|
||||||
if (GDK_VK_CHECK (vkCreateShaderModule, self->vk_device,
|
if (GDK_VK_CHECK (vkCreateShaderModule, self->vk_device,
|
||||||
&(VkShaderModuleCreateInfo) {
|
&(VkShaderModuleCreateInfo) {
|
||||||
.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO,
|
||||||
@@ -2009,18 +2020,20 @@ gdk_display_get_vk_shader_module (GdkDisplay *self,
|
|||||||
.pCode = (uint32_t *) g_bytes_get_data (bytes, NULL),
|
.pCode = (uint32_t *) g_bytes_get_data (bytes, NULL),
|
||||||
},
|
},
|
||||||
NULL,
|
NULL,
|
||||||
&shader) == VK_SUCCESS)
|
shader) == VK_SUCCESS)
|
||||||
{
|
{
|
||||||
g_hash_table_insert (self->vk_shader_modules, g_strdup (resource_name), shader);
|
g_hash_table_insert (self->vk_shader_modules, g_strdup (resource_name), shader);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
shader = VK_NULL_HANDLE;
|
g_free (shader);
|
||||||
|
|
||||||
|
return VK_NULL_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_bytes_unref (bytes);
|
g_bytes_unref (bytes);
|
||||||
|
|
||||||
return shader;
|
return *shader;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* GDK_RENDERING_VULKAN */
|
#else /* GDK_RENDERING_VULKAN */
|
||||||
|
|||||||
@@ -96,12 +96,12 @@ _gdk_macos_drag_surface_constructed (GObject *object)
|
|||||||
defer:NO
|
defer:NO
|
||||||
screen:screen];
|
screen:screen];
|
||||||
|
|
||||||
|
_gdk_macos_surface_set_native (self, window);
|
||||||
|
|
||||||
[window setOpaque:NO];
|
[window setOpaque:NO];
|
||||||
[window setBackgroundColor:[NSColor clearColor]];
|
[window setBackgroundColor:[NSColor clearColor]];
|
||||||
[window setDecorated:NO];
|
[window setDecorated:NO];
|
||||||
|
|
||||||
_gdk_macos_surface_set_native (self, window);
|
|
||||||
|
|
||||||
frame_clock = _gdk_frame_clock_idle_new ();
|
frame_clock = _gdk_frame_clock_idle_new ();
|
||||||
gdk_surface_set_frame_clock (surface, frame_clock);
|
gdk_surface_set_frame_clock (surface, frame_clock);
|
||||||
g_object_unref (frame_clock);
|
g_object_unref (frame_clock);
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ gdk_macos_popup_surface_layout (GdkMacosPopupSurface *self,
|
|||||||
GdkRectangle bounds;
|
GdkRectangle bounds;
|
||||||
GdkRectangle final_rect;
|
GdkRectangle final_rect;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
int shadow_left, shadow_right, shadow_top, shadow_bottom;
|
||||||
|
|
||||||
g_assert (GDK_IS_MACOS_POPUP_SURFACE (self));
|
g_assert (GDK_IS_MACOS_POPUP_SURFACE (self));
|
||||||
g_assert (layout != NULL);
|
g_assert (layout != NULL);
|
||||||
@@ -68,10 +69,19 @@ gdk_macos_popup_surface_layout (GdkMacosPopupSurface *self,
|
|||||||
monitor = _gdk_macos_surface_get_best_monitor (GDK_MACOS_SURFACE (self));
|
monitor = _gdk_macos_surface_get_best_monitor (GDK_MACOS_SURFACE (self));
|
||||||
gdk_macos_monitor_get_workarea (monitor, &bounds);
|
gdk_macos_monitor_get_workarea (monitor, &bounds);
|
||||||
|
|
||||||
|
gdk_popup_layout_get_shadow_width (layout,
|
||||||
|
&shadow_left,
|
||||||
|
&shadow_right,
|
||||||
|
&shadow_top,
|
||||||
|
&shadow_bottom);
|
||||||
|
|
||||||
gdk_surface_layout_popup_helper (GDK_SURFACE (self),
|
gdk_surface_layout_popup_helper (GDK_SURFACE (self),
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
0, 0, 0, 0, /* shadow-left/right/top/bottom */
|
shadow_left,
|
||||||
|
shadow_right,
|
||||||
|
shadow_top,
|
||||||
|
shadow_bottom,
|
||||||
monitor,
|
monitor,
|
||||||
&bounds,
|
&bounds,
|
||||||
self->layout,
|
self->layout,
|
||||||
@@ -306,14 +316,14 @@ _gdk_macos_popup_surface_constructed (GObject *object)
|
|||||||
defer:NO
|
defer:NO
|
||||||
screen:screen];
|
screen:screen];
|
||||||
|
|
||||||
|
_gdk_macos_surface_set_native (GDK_MACOS_SURFACE (self), window);
|
||||||
|
|
||||||
[window setOpaque:NO];
|
[window setOpaque:NO];
|
||||||
[window setBackgroundColor:[NSColor clearColor]];
|
[window setBackgroundColor:[NSColor clearColor]];
|
||||||
[window setDecorated:NO];
|
[window setDecorated:NO];
|
||||||
[window setExcludedFromWindowsMenu:YES];
|
[window setExcludedFromWindowsMenu:YES];
|
||||||
[window setLevel:NSPopUpMenuWindowLevel];
|
[window setLevel:NSPopUpMenuWindowLevel];
|
||||||
|
|
||||||
_gdk_macos_surface_set_native (GDK_MACOS_SURFACE (self), window);
|
|
||||||
|
|
||||||
gdk_surface_set_frame_clock (surface, gdk_surface_get_frame_clock (surface->parent));
|
gdk_surface_set_frame_clock (surface, gdk_surface_get_frame_clock (surface->parent));
|
||||||
|
|
||||||
GDK_END_MACOS_ALLOC_POOL;
|
GDK_END_MACOS_ALLOC_POOL;
|
||||||
|
|||||||
@@ -591,11 +591,11 @@ _gdk_macos_toplevel_surface_constructed (GObject *object)
|
|||||||
defer:NO
|
defer:NO
|
||||||
screen:screen];
|
screen:screen];
|
||||||
|
|
||||||
|
_gdk_macos_surface_set_native (GDK_MACOS_SURFACE (self), window);
|
||||||
|
|
||||||
/* Allow NSWindow to go fullscreen */
|
/* Allow NSWindow to go fullscreen */
|
||||||
[window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
|
[window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
|
||||||
|
|
||||||
_gdk_macos_surface_set_native (GDK_MACOS_SURFACE (self), window);
|
|
||||||
|
|
||||||
frame_clock = _gdk_frame_clock_idle_new ();
|
frame_clock = _gdk_frame_clock_idle_new ();
|
||||||
gdk_surface_set_frame_clock (surface, frame_clock);
|
gdk_surface_set_frame_clock (surface, frame_clock);
|
||||||
g_object_unref (frame_clock);
|
g_object_unref (frame_clock);
|
||||||
|
|||||||
+1
-1
@@ -128,8 +128,8 @@ install_headers(gdk_deprecated_headers, subdir: 'gtk-4.0/gdk/deprecated')
|
|||||||
gdk_sources = gdk_public_sources + gdk_deprecated_sources
|
gdk_sources = gdk_public_sources + gdk_deprecated_sources
|
||||||
|
|
||||||
gdk_private_h_sources = files([
|
gdk_private_h_sources = files([
|
||||||
'gdkeventsprivate.h',
|
|
||||||
'gdkdevicetoolprivate.h',
|
'gdkdevicetoolprivate.h',
|
||||||
|
'gdkeventsprivate.h',
|
||||||
'gdkhslaprivate.h',
|
'gdkhslaprivate.h',
|
||||||
'gdkmonitorprivate.h',
|
'gdkmonitorprivate.h',
|
||||||
'gdkseatdefaultprivate.h',
|
'gdkseatdefaultprivate.h',
|
||||||
|
|||||||
@@ -165,25 +165,29 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
|
|||||||
double *scale)
|
double *scale)
|
||||||
{
|
{
|
||||||
GdkTexture *texture;
|
GdkTexture *texture;
|
||||||
int desired_scale_factor;
|
|
||||||
|
|
||||||
desired_scale_factor = (int) ceil (desired_scale);
|
|
||||||
|
|
||||||
if (gdk_cursor_get_name (cursor))
|
if (gdk_cursor_get_name (cursor))
|
||||||
{
|
{
|
||||||
struct wl_cursor *c;
|
struct wl_cursor *c;
|
||||||
|
int scale_factor;
|
||||||
|
|
||||||
if (g_str_equal (gdk_cursor_get_name (cursor), "none"))
|
if (g_str_equal (gdk_cursor_get_name (cursor), "none"))
|
||||||
goto none;
|
{
|
||||||
|
*hotspot_x = *hotspot_y = 0;
|
||||||
|
*width = *height = 0;
|
||||||
|
*scale = 1;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
scale_factor = (int) ceil (desired_scale);
|
||||||
|
|
||||||
c = gdk_wayland_cursor_load_for_name (display,
|
c = gdk_wayland_cursor_load_for_name (display,
|
||||||
_gdk_wayland_display_get_cursor_theme (display),
|
display->cursor_theme,
|
||||||
desired_scale_factor,
|
scale_factor,
|
||||||
gdk_cursor_get_name (cursor));
|
gdk_cursor_get_name (cursor));
|
||||||
if (c && c->image_count > 0)
|
if (c && c->image_count > 0)
|
||||||
{
|
{
|
||||||
struct wl_cursor_image *image;
|
struct wl_cursor_image *image;
|
||||||
int cursor_scale;
|
|
||||||
|
|
||||||
if (image_index >= c->image_count)
|
if (image_index >= c->image_count)
|
||||||
{
|
{
|
||||||
@@ -195,23 +199,23 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
|
|||||||
|
|
||||||
image = c->images[image_index];
|
image = c->images[image_index];
|
||||||
|
|
||||||
cursor_scale = desired_scale_factor;
|
*width = display->cursor_theme_size;
|
||||||
if ((image->width % cursor_scale != 0) ||
|
*height = display->cursor_theme_size;
|
||||||
(image->height % cursor_scale != 0))
|
*scale = image->width / (double) *width;
|
||||||
|
*hotspot_x = image->hotspot_x / scale_factor;
|
||||||
|
*hotspot_y = image->hotspot_y / scale_factor;
|
||||||
|
|
||||||
|
if (*scale != scale_factor && !use_viewporter)
|
||||||
{
|
{
|
||||||
g_warning (G_STRLOC " cursor image size (%dx%d) not an integer "
|
g_warning (G_STRLOC " cursor image size (%d) not an integer "
|
||||||
"multiple of scale (%d)", image->width, image->height,
|
"multiple of theme size (%d)", image->width, *width);
|
||||||
cursor_scale);
|
*width = image->width;
|
||||||
cursor_scale = 1;
|
*height = image->height;
|
||||||
|
*hotspot_x = image->hotspot_x;
|
||||||
|
*hotspot_y = image->hotspot_y;
|
||||||
|
*scale = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
*hotspot_x = image->hotspot_x / cursor_scale;
|
|
||||||
*hotspot_y = image->hotspot_y / cursor_scale;
|
|
||||||
|
|
||||||
*width = image->width / cursor_scale;
|
|
||||||
*height = image->height / cursor_scale;
|
|
||||||
*scale = cursor_scale;
|
|
||||||
|
|
||||||
return wl_cursor_image_get_buffer (image);
|
return wl_cursor_image_get_buffer (image);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -257,7 +261,7 @@ from_texture:
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!use_viewporter)
|
if (!use_viewporter)
|
||||||
*scale = desired_scale_factor;
|
*scale = ceil (desired_scale);
|
||||||
else
|
else
|
||||||
*scale = desired_scale;
|
*scale = desired_scale;
|
||||||
|
|
||||||
@@ -294,28 +298,23 @@ from_texture:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (gdk_cursor_get_fallback (cursor))
|
if (gdk_cursor_get_fallback (cursor))
|
||||||
return _gdk_wayland_cursor_get_buffer (display,
|
{
|
||||||
gdk_cursor_get_fallback (cursor),
|
return _gdk_wayland_cursor_get_buffer (display,
|
||||||
desired_scale,
|
gdk_cursor_get_fallback (cursor),
|
||||||
use_viewporter,
|
desired_scale,
|
||||||
image_index,
|
use_viewporter,
|
||||||
hotspot_x, hotspot_y,
|
image_index,
|
||||||
width, height,
|
hotspot_x, hotspot_y,
|
||||||
scale);
|
width, height,
|
||||||
|
scale);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
texture = gdk_texture_new_from_resource ("/org/gtk/libgdk/cursor/default");
|
texture = gdk_texture_new_from_resource ("/org/gtk/libgdk/cursor/default");
|
||||||
goto from_texture;
|
goto from_texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
none:
|
g_assert_not_reached ();
|
||||||
*hotspot_x = 0;
|
|
||||||
*hotspot_y = 0;
|
|
||||||
*width = 0;
|
|
||||||
*height = 0;
|
|
||||||
*scale = 1;
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
guint
|
guint
|
||||||
|
|||||||
@@ -97,6 +97,7 @@
|
|||||||
#define OUTPUT_VERSION_WITH_DONE 2
|
#define OUTPUT_VERSION_WITH_DONE 2
|
||||||
#define NO_XDG_OUTPUT_DONE_SINCE_VERSION 3
|
#define NO_XDG_OUTPUT_DONE_SINCE_VERSION 3
|
||||||
#define OUTPUT_VERSION 3
|
#define OUTPUT_VERSION 3
|
||||||
|
#define XDG_WM_DIALOG_VERSION 1
|
||||||
|
|
||||||
#ifdef HAVE_TOPLEVEL_STATE_SUSPENDED
|
#ifdef HAVE_TOPLEVEL_STATE_SUSPENDED
|
||||||
#define XDG_WM_BASE_VERSION 6
|
#define XDG_WM_BASE_VERSION 6
|
||||||
@@ -382,6 +383,13 @@ gdk_registry_handle_global (void *data,
|
|||||||
{
|
{
|
||||||
display_wayland->zxdg_shell_v6_id = id;
|
display_wayland->zxdg_shell_v6_id = id;
|
||||||
}
|
}
|
||||||
|
else if (strcmp (interface, "xdg_wm_dialog_v1") == 0)
|
||||||
|
{
|
||||||
|
display_wayland->xdg_wm_dialog =
|
||||||
|
wl_registry_bind (display_wayland->wl_registry, id,
|
||||||
|
&xdg_wm_dialog_v1_interface,
|
||||||
|
MIN (version, XDG_WM_DIALOG_VERSION));
|
||||||
|
}
|
||||||
else if (strcmp (interface, "gtk_shell1") == 0)
|
else if (strcmp (interface, "gtk_shell1") == 0)
|
||||||
{
|
{
|
||||||
display_wayland->gtk_shell =
|
display_wayland->gtk_shell =
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
#include <gdk/wayland/viewporter-client-protocol.h>
|
#include <gdk/wayland/viewporter-client-protocol.h>
|
||||||
#include <gdk/wayland/presentation-time-client-protocol.h>
|
#include <gdk/wayland/presentation-time-client-protocol.h>
|
||||||
#include <gdk/wayland/single-pixel-buffer-v1-client-protocol.h>
|
#include <gdk/wayland/single-pixel-buffer-v1-client-protocol.h>
|
||||||
|
#include <gdk/wayland/xdg-dialog-v1-client-protocol.h>
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <gdk/gdkkeys.h>
|
#include <gdk/gdkkeys.h>
|
||||||
@@ -102,6 +103,7 @@ struct _GdkWaylandDisplay
|
|||||||
DmabufFormatsInfo *dmabuf_formats_info;
|
DmabufFormatsInfo *dmabuf_formats_info;
|
||||||
struct xdg_wm_base *xdg_wm_base;
|
struct xdg_wm_base *xdg_wm_base;
|
||||||
struct zxdg_shell_v6 *zxdg_shell_v6;
|
struct zxdg_shell_v6 *zxdg_shell_v6;
|
||||||
|
struct xdg_wm_dialog_v1 *xdg_wm_dialog;
|
||||||
struct gtk_shell1 *gtk_shell;
|
struct gtk_shell1 *gtk_shell;
|
||||||
struct wl_data_device_manager *data_device_manager;
|
struct wl_data_device_manager *data_device_manager;
|
||||||
struct wl_subcompositor *subcompositor;
|
struct wl_subcompositor *subcompositor;
|
||||||
|
|||||||
@@ -3866,9 +3866,25 @@ pointer_surface_leave (void *data,
|
|||||||
pointer_surface_update_scale (device);
|
pointer_surface_update_scale (device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
pointer_surface_preferred_buffer_scale (void *data,
|
||||||
|
struct wl_surface *wl_surface,
|
||||||
|
int32_t factor)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
pointer_surface_preferred_buffer_transform (void *data,
|
||||||
|
struct wl_surface *wl_surface,
|
||||||
|
uint32_t transform)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
static const struct wl_surface_listener pointer_surface_listener = {
|
static const struct wl_surface_listener pointer_surface_listener = {
|
||||||
pointer_surface_enter,
|
pointer_surface_enter,
|
||||||
pointer_surface_leave
|
pointer_surface_leave,
|
||||||
|
pointer_surface_preferred_buffer_scale,
|
||||||
|
pointer_surface_preferred_buffer_transform,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
#include <wayland/presentation-time-client-protocol.h>
|
#include <wayland/presentation-time-client-protocol.h>
|
||||||
#include <wayland/xdg-shell-unstable-v6-client-protocol.h>
|
#include <wayland/xdg-shell-unstable-v6-client-protocol.h>
|
||||||
#include <wayland/xdg-foreign-unstable-v2-client-protocol.h>
|
#include <wayland/xdg-foreign-unstable-v2-client-protocol.h>
|
||||||
|
#include <wayland/xdg-dialog-v1-client-protocol.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -84,6 +85,7 @@ struct _GdkWaylandToplevel
|
|||||||
struct gtk_surface1 *gtk_surface;
|
struct gtk_surface1 *gtk_surface;
|
||||||
struct xdg_toplevel *xdg_toplevel;
|
struct xdg_toplevel *xdg_toplevel;
|
||||||
struct zxdg_toplevel_v6 *zxdg_toplevel_v6;
|
struct zxdg_toplevel_v6 *zxdg_toplevel_v6;
|
||||||
|
struct xdg_dialog_v1 *xdg_dialog;
|
||||||
} display_server;
|
} display_server;
|
||||||
|
|
||||||
GdkWaylandToplevel *transient_for;
|
GdkWaylandToplevel *transient_for;
|
||||||
@@ -205,6 +207,7 @@ gdk_wayland_toplevel_clear_saved_size (GdkWaylandToplevel *toplevel)
|
|||||||
|
|
||||||
static void maybe_set_gtk_surface_dbus_properties (GdkWaylandToplevel *wayland_toplevel);
|
static void maybe_set_gtk_surface_dbus_properties (GdkWaylandToplevel *wayland_toplevel);
|
||||||
static void maybe_set_gtk_surface_modal (GdkWaylandToplevel *wayland_toplevel);
|
static void maybe_set_gtk_surface_modal (GdkWaylandToplevel *wayland_toplevel);
|
||||||
|
static gboolean maybe_set_xdg_dialog_modal (GdkWaylandToplevel *wayland_toplevel);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_wayland_toplevel_hide_surface (GdkWaylandSurface *wayland_surface)
|
gdk_wayland_toplevel_hide_surface (GdkWaylandSurface *wayland_surface)
|
||||||
@@ -215,6 +218,7 @@ gdk_wayland_toplevel_hide_surface (GdkWaylandSurface *wayland_surface)
|
|||||||
|
|
||||||
g_clear_pointer (&toplevel->display_server.xdg_toplevel, xdg_toplevel_destroy);
|
g_clear_pointer (&toplevel->display_server.xdg_toplevel, xdg_toplevel_destroy);
|
||||||
g_clear_pointer (&toplevel->display_server.zxdg_toplevel_v6, zxdg_toplevel_v6_destroy);
|
g_clear_pointer (&toplevel->display_server.zxdg_toplevel_v6, zxdg_toplevel_v6_destroy);
|
||||||
|
g_clear_pointer (&toplevel->display_server.xdg_dialog, xdg_dialog_v1_destroy);
|
||||||
|
|
||||||
if (toplevel->display_server.gtk_surface)
|
if (toplevel->display_server.gtk_surface)
|
||||||
{
|
{
|
||||||
@@ -877,7 +881,8 @@ gdk_wayland_surface_create_xdg_toplevel (GdkWaylandToplevel *wayland_toplevel)
|
|||||||
gdk_wayland_toplevel_set_application_id (GDK_TOPLEVEL (wayland_toplevel), app_id);
|
gdk_wayland_toplevel_set_application_id (GDK_TOPLEVEL (wayland_toplevel), app_id);
|
||||||
|
|
||||||
maybe_set_gtk_surface_dbus_properties (wayland_toplevel);
|
maybe_set_gtk_surface_dbus_properties (wayland_toplevel);
|
||||||
maybe_set_gtk_surface_modal (wayland_toplevel);
|
if (!maybe_set_xdg_dialog_modal (wayland_toplevel))
|
||||||
|
maybe_set_gtk_surface_modal (wayland_toplevel);
|
||||||
|
|
||||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
|
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
|
||||||
wl_surface_commit (wayland_surface->display_server.wl_surface);
|
wl_surface_commit (wayland_surface->display_server.wl_surface);
|
||||||
@@ -1089,12 +1094,40 @@ maybe_set_gtk_surface_modal (GdkWaylandToplevel *wayland_toplevel)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
maybe_set_xdg_dialog_modal (GdkWaylandToplevel *wayland_toplevel)
|
||||||
|
{
|
||||||
|
GdkWaylandDisplay *display_wayland =
|
||||||
|
GDK_WAYLAND_DISPLAY (gdk_surface_get_display (GDK_SURFACE (wayland_toplevel)));
|
||||||
|
|
||||||
|
if (!display_wayland->xdg_wm_dialog)
|
||||||
|
return FALSE;
|
||||||
|
if (!is_realized_toplevel (GDK_WAYLAND_SURFACE (wayland_toplevel)))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (!wayland_toplevel->display_server.xdg_dialog)
|
||||||
|
{
|
||||||
|
wayland_toplevel->display_server.xdg_dialog =
|
||||||
|
xdg_wm_dialog_v1_get_xdg_dialog (display_wayland->xdg_wm_dialog,
|
||||||
|
wayland_toplevel->display_server.xdg_toplevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GDK_SURFACE (wayland_toplevel)->modal_hint)
|
||||||
|
xdg_dialog_v1_set_modal (wayland_toplevel->display_server.xdg_dialog);
|
||||||
|
else
|
||||||
|
xdg_dialog_v1_unset_modal (wayland_toplevel->display_server.xdg_dialog);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_wayland_toplevel_set_modal_hint (GdkWaylandToplevel *wayland_toplevel,
|
gdk_wayland_toplevel_set_modal_hint (GdkWaylandToplevel *wayland_toplevel,
|
||||||
gboolean modal)
|
gboolean modal)
|
||||||
{
|
{
|
||||||
GDK_SURFACE (wayland_toplevel)->modal_hint = modal;
|
GDK_SURFACE (wayland_toplevel)->modal_hint = modal;
|
||||||
maybe_set_gtk_surface_modal (wayland_toplevel);
|
|
||||||
|
if (!maybe_set_xdg_dialog_modal (wayland_toplevel))
|
||||||
|
maybe_set_gtk_surface_modal (wayland_toplevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
+121
-24
@@ -48,36 +48,133 @@ gdk_wayland_deps = [
|
|||||||
wlegldep,
|
wlegldep,
|
||||||
]
|
]
|
||||||
|
|
||||||
wlmod = import('unstable-wayland')
|
# Fields:
|
||||||
|
# - name: protocol name
|
||||||
|
# - stability: protocol stability ('private', 'stable' or 'unstable')
|
||||||
|
# - version: protocol version
|
||||||
|
# - required: wayland_protocols version check
|
||||||
proto_sources = [
|
proto_sources = [
|
||||||
'protocol/gtk-shell.xml',
|
{
|
||||||
'protocol/server-decoration.xml',
|
'name': 'gtk-shell',
|
||||||
wlmod.find_protocol('primary-selection', state: 'unstable', version: 1),
|
'stability': 'private',
|
||||||
wlmod.find_protocol('pointer-gestures', state: 'unstable', version: 1),
|
},
|
||||||
wlmod.find_protocol('viewporter', state: 'stable'),
|
{
|
||||||
wlmod.find_protocol('xdg-shell', state: 'unstable', version: 6),
|
'name': 'primary-selection',
|
||||||
wlmod.find_protocol('xdg-shell', state: 'stable'),
|
'stability': 'unstable',
|
||||||
wlmod.find_protocol('xdg-foreign', state: 'unstable', version: 1),
|
'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),
|
'name': 'pointer-gestures',
|
||||||
wlmod.find_protocol('xdg-output', state: 'unstable', version: 1),
|
'stability': 'unstable',
|
||||||
wlmod.find_protocol('idle-inhibit', state: 'unstable', version: 1),
|
'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),
|
'name': 'viewporter',
|
||||||
wlmod.find_protocol('presentation-time', state: 'stable'),
|
'stability': 'stable',
|
||||||
wlmod.find_protocol('single-pixel-buffer', state: 'staging', version: 1),
|
},
|
||||||
|
{
|
||||||
|
'name': 'xdg-shell',
|
||||||
|
'stability': 'unstable',
|
||||||
|
'version': 6,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'xdg-shell',
|
||||||
|
'stability': 'stable',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'xdg-foreign',
|
||||||
|
'stability': 'unstable',
|
||||||
|
'version': 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'xdg-foreign',
|
||||||
|
'stability': 'unstable',
|
||||||
|
'version': 2,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'tablet',
|
||||||
|
'stability': 'unstable',
|
||||||
|
'version': 2,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'keyboard-shortcuts-inhibit',
|
||||||
|
'stability': 'unstable',
|
||||||
|
'version': 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'server-decoration',
|
||||||
|
'stability': 'private',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'xdg-output',
|
||||||
|
'stability': 'unstable',
|
||||||
|
'version': 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'idle-inhibit',
|
||||||
|
'stability': 'unstable',
|
||||||
|
'version': 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'xdg-activation',
|
||||||
|
'stability': 'staging',
|
||||||
|
'version': 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'fractional-scale',
|
||||||
|
'stability': 'staging',
|
||||||
|
'version': 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'linux-dmabuf',
|
||||||
|
'stability': 'unstable',
|
||||||
|
'version': 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'presentation-time',
|
||||||
|
'stability': 'stable',
|
||||||
|
'version': 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'single-pixel-buffer',
|
||||||
|
'stability': 'staging',
|
||||||
|
'version': 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'xdg-dialog',
|
||||||
|
'stability': 'staging',
|
||||||
|
'version': 1,
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
gdk_wayland_gen_headers = []
|
gdk_wayland_gen_headers = []
|
||||||
|
|
||||||
|
wlmod = import('unstable-wayland')
|
||||||
foreach p: proto_sources
|
foreach p: proto_sources
|
||||||
# Returns a list [.c, .h]
|
if wlprotocolsdep.version().version_compare(p.get('required', '>=0'))
|
||||||
gen = wlmod.scan_xml(p)
|
if p.get('stability') == 'private'
|
||||||
assert(gen.length() == 2)
|
if (p.has_key('version'))
|
||||||
gdk_wayland_sources += gen[0]
|
proto_file = 'protocol/@0@-v@1@.xml'.format(p.get('name'), p.get('version'))
|
||||||
gdk_wayland_gen_headers += gen[1]
|
else
|
||||||
|
proto_file = 'protocol/@0@.xml'.format(p.get('name'))
|
||||||
|
endif
|
||||||
|
elif p.get('stability') == 'stable'
|
||||||
|
proto_file = wlmod.find_protocol(p.get('name'),
|
||||||
|
state: p.get('stability'),
|
||||||
|
)
|
||||||
|
else
|
||||||
|
proto_file = wlmod.find_protocol(p.get('name'),
|
||||||
|
state: p.get('stability'),
|
||||||
|
version: p.get('version'),
|
||||||
|
)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Returns a list [.c, .h]
|
||||||
|
gen = wlmod.scan_xml(proto_file)
|
||||||
|
assert(gen.length() == 2)
|
||||||
|
gdk_wayland_sources += gen[0]
|
||||||
|
gdk_wayland_gen_headers += gen[1]
|
||||||
|
endif
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
libgdk_wayland = static_library('gdk-wayland',
|
libgdk_wayland = static_library('gdk-wayland',
|
||||||
|
|||||||
@@ -1408,7 +1408,7 @@ register_clipboard_notification ()
|
|||||||
WNDCLASS wclass = { 0, };
|
WNDCLASS wclass = { 0, };
|
||||||
ATOM klass;
|
ATOM klass;
|
||||||
|
|
||||||
wclass.lpszClassName = "GdkClipboardNotification";
|
wclass.lpszClassName = L"GdkClipboardNotification";
|
||||||
wclass.lpfnWndProc = _clipboard_window_procedure;
|
wclass.lpfnWndProc = _clipboard_window_procedure;
|
||||||
wclass.hInstance = this_module ();
|
wclass.hInstance = this_module ();
|
||||||
wclass.cbWndExtra = sizeof (GdkWin32ClipboardThread *);
|
wclass.cbWndExtra = sizeof (GdkWin32ClipboardThread *);
|
||||||
@@ -1506,9 +1506,9 @@ gdk_win32_clipdrop_init (GdkWin32Clipdrop *win32_clipdrop)
|
|||||||
GdkWin32ContentFormatPair fmt;
|
GdkWin32ContentFormatPair fmt;
|
||||||
HMODULE user32;
|
HMODULE user32;
|
||||||
|
|
||||||
thread_wakeup_message = RegisterWindowMessage ("GDK_WORKER_THREAD_WEAKEUP");
|
thread_wakeup_message = RegisterWindowMessage (L"GDK_WORKER_THREAD_WEAKEUP");
|
||||||
|
|
||||||
user32 = LoadLibrary ("user32.dll");
|
user32 = LoadLibrary (L"user32.dll");
|
||||||
win32_clipdrop->GetUpdatedClipboardFormats = (GetUpdatedClipboardFormatsFunc) GetProcAddress (user32, "GetUpdatedClipboardFormats");
|
win32_clipdrop->GetUpdatedClipboardFormats = (GetUpdatedClipboardFormatsFunc) GetProcAddress (user32, "GetUpdatedClipboardFormats");
|
||||||
FreeLibrary (user32);
|
FreeLibrary (user32);
|
||||||
|
|
||||||
@@ -1557,21 +1557,21 @@ gdk_win32_clipdrop_init (GdkWin32Clipdrop *win32_clipdrop)
|
|||||||
* the lead and map the GDK contentformat "image/png" to the clipboard
|
* the lead and map the GDK contentformat "image/png" to the clipboard
|
||||||
* format name "PNG" etc.
|
* format name "PNG" etc.
|
||||||
*/
|
*/
|
||||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_PNG) = RegisterClipboardFormatA ("PNG");
|
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_PNG) = RegisterClipboardFormat (L"PNG");
|
||||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_JFIF) = RegisterClipboardFormatA ("JFIF");
|
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_JFIF) = RegisterClipboardFormat (L"JFIF");
|
||||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_GIF) = RegisterClipboardFormatA ("GIF");
|
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_GIF) = RegisterClipboardFormat (L"GIF");
|
||||||
|
|
||||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_UNIFORMRESOURCELOCATORW) = RegisterClipboardFormatA ("UniformResourceLocatorW");
|
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_UNIFORMRESOURCELOCATORW) = RegisterClipboardFormat (L"UniformResourceLocatorW");
|
||||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_CFSTR_SHELLIDLIST) = RegisterClipboardFormatA (CFSTR_SHELLIDLIST);
|
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_CFSTR_SHELLIDLIST) = RegisterClipboardFormat (CFSTR_SHELLIDLIST);
|
||||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_HTML_FORMAT) = RegisterClipboardFormatA ("HTML Format");
|
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_HTML_FORMAT) = RegisterClipboardFormat (L"HTML Format");
|
||||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_TEXT_HTML) = RegisterClipboardFormatA ("text/html");
|
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_TEXT_HTML) = RegisterClipboardFormat (L"text/html");
|
||||||
|
|
||||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_PNG) = RegisterClipboardFormatA ("image/png");
|
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_PNG) = RegisterClipboardFormat (L"image/png");
|
||||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_JPEG) = RegisterClipboardFormatA ("image/jpeg");
|
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_JPEG) = RegisterClipboardFormat (L"image/jpeg");
|
||||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_BMP) = RegisterClipboardFormatA ("image/bmp");
|
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_BMP) = RegisterClipboardFormat (L"image/bmp");
|
||||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_GIF) = RegisterClipboardFormatA ("image/gif");
|
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_GIF) = RegisterClipboardFormat (L"image/gif");
|
||||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_TEXT_URI_LIST) = RegisterClipboardFormatA ("text/uri-list");
|
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_TEXT_URI_LIST) = RegisterClipboardFormat (L"text/uri-list");
|
||||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_TEXT_PLAIN_UTF8) = RegisterClipboardFormatA ("text/plain;charset=utf-8");
|
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_TEXT_PLAIN_UTF8) = RegisterClipboardFormat (L"text/plain;charset=utf-8");
|
||||||
|
|
||||||
win32_clipdrop->active_source_drags = g_hash_table_new_full (NULL, NULL, (GDestroyNotify) g_object_unref, NULL);
|
win32_clipdrop->active_source_drags = g_hash_table_new_full (NULL, NULL, (GDestroyNotify) g_object_unref, NULL);
|
||||||
|
|
||||||
@@ -2364,9 +2364,9 @@ transmute_cf_dib_to_image_bmp (const guchar *data,
|
|||||||
* check?
|
* check?
|
||||||
*/
|
*/
|
||||||
(IsClipboardFormatAvailable
|
(IsClipboardFormatAvailable
|
||||||
(RegisterClipboardFormatA ("application/x-moz-nativeimage")) ||
|
(RegisterClipboardFormat (L"application/x-moz-nativeimage")) ||
|
||||||
IsClipboardFormatAvailable
|
IsClipboardFormatAvailable
|
||||||
(RegisterClipboardFormatA ("UniformResourceLocatorW"))) &&
|
(RegisterClipboardFormat (L"UniformResourceLocatorW"))) &&
|
||||||
#endif
|
#endif
|
||||||
TRUE)
|
TRUE)
|
||||||
{
|
{
|
||||||
|
|||||||
+36
-35
@@ -31,12 +31,13 @@
|
|||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
char *name;
|
char *name;
|
||||||
char *id;
|
const wchar_t *id;
|
||||||
} default_cursors[] = {
|
} default_cursors[] = {
|
||||||
/* -- Win32 cursor names: -- */
|
/* -- Win32 cursor names: -- */
|
||||||
{ "appstarting", IDC_APPSTARTING },
|
{ "appstarting", IDC_APPSTARTING },
|
||||||
{ "arrow", IDC_ARROW },
|
{ "arrow", IDC_ARROW },
|
||||||
{ "cross", IDC_CROSS },
|
{ "cross", IDC_CROSS },
|
||||||
|
{ "dnd-move", IDC_ARROW },
|
||||||
{ "hand", IDC_HAND },
|
{ "hand", IDC_HAND },
|
||||||
{ "help", IDC_HELP },
|
{ "help", IDC_HELP },
|
||||||
{ "ibeam", IDC_IBEAM },
|
{ "ibeam", IDC_IBEAM },
|
||||||
@@ -456,32 +457,32 @@ win32_cursor_create_win32hcursor (GdkWin32Display *display,
|
|||||||
break;
|
break;
|
||||||
case GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_NULL:
|
case GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_NULL:
|
||||||
result = gdk_win32_hcursor_new (display,
|
result = gdk_win32_hcursor_new (display,
|
||||||
LoadImageA (NULL,
|
LoadImage (NULL,
|
||||||
(const char *) cursor->resource_name,
|
cursor->resource_name,
|
||||||
IMAGE_CURSOR,
|
IMAGE_CURSOR,
|
||||||
cursor->width,
|
cursor->width,
|
||||||
cursor->height,
|
cursor->height,
|
||||||
cursor->load_flags),
|
cursor->load_flags),
|
||||||
cursor->load_flags & LR_SHARED ? FALSE : TRUE);
|
cursor->load_flags & LR_SHARED ? FALSE : TRUE);
|
||||||
break;
|
break;
|
||||||
case GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_THIS:
|
case GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_THIS:
|
||||||
result = gdk_win32_hcursor_new (display,
|
result = gdk_win32_hcursor_new (display,
|
||||||
LoadImageA (GetModuleHandle (NULL),
|
LoadImage (GetModuleHandle (NULL),
|
||||||
(const char *) cursor->resource_name,
|
cursor->resource_name,
|
||||||
IMAGE_CURSOR,
|
IMAGE_CURSOR,
|
||||||
cursor->width,
|
cursor->width,
|
||||||
cursor->height,
|
cursor->height,
|
||||||
cursor->load_flags),
|
cursor->load_flags),
|
||||||
cursor->load_flags & LR_SHARED ? FALSE : TRUE);
|
cursor->load_flags & LR_SHARED ? FALSE : TRUE);
|
||||||
break;
|
break;
|
||||||
case GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_GTK:
|
case GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_GTK:
|
||||||
result = gdk_win32_hcursor_new (display,
|
result = gdk_win32_hcursor_new (display,
|
||||||
LoadImageA (this_module (),
|
LoadImage (this_module (),
|
||||||
(const char *) cursor->resource_name,
|
cursor->resource_name,
|
||||||
IMAGE_CURSOR,
|
IMAGE_CURSOR,
|
||||||
cursor->width,
|
cursor->width,
|
||||||
cursor->height,
|
cursor->height,
|
||||||
cursor->load_flags),
|
cursor->load_flags),
|
||||||
cursor->load_flags & LR_SHARED ? FALSE : TRUE);
|
cursor->load_flags & LR_SHARED ? FALSE : TRUE);
|
||||||
break;
|
break;
|
||||||
case GDK_WIN32_CURSOR_CREATE:
|
case GDK_WIN32_CURSOR_CREATE:
|
||||||
@@ -498,12 +499,12 @@ win32_cursor_create_win32hcursor (GdkWin32Display *display,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Win32Cursor *
|
static Win32Cursor *
|
||||||
win32_cursor_new (GdkWin32CursorLoadType load_type,
|
win32_cursor_new (GdkWin32CursorLoadType load_type,
|
||||||
gpointer resource_name,
|
wchar_t *resource_name,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
guint load_flags,
|
guint load_flags,
|
||||||
int xcursor_number)
|
int xcursor_number)
|
||||||
{
|
{
|
||||||
Win32Cursor *result;
|
Win32Cursor *result;
|
||||||
|
|
||||||
@@ -631,9 +632,9 @@ win32_cursor_theme_load_system (Win32CursorTheme *theme,
|
|||||||
|
|
||||||
/* Prefer W32 cursors */
|
/* Prefer W32 cursors */
|
||||||
if (cursors[i].builtin)
|
if (cursors[i].builtin)
|
||||||
shared_hcursor = LoadImageA (NULL, cursors[i].builtin, IMAGE_CURSOR,
|
shared_hcursor = LoadImage (NULL, cursors[i].builtin, IMAGE_CURSOR,
|
||||||
size, size,
|
size, size,
|
||||||
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0));
|
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0));
|
||||||
|
|
||||||
/* Fall back to X cursors, but only if we've got no theme cursor */
|
/* Fall back to X cursors, but only if we've got no theme cursor */
|
||||||
if (shared_hcursor == NULL && g_hash_table_lookup (theme->named_cursors, cursors[i].name) == NULL)
|
if (shared_hcursor == NULL && g_hash_table_lookup (theme->named_cursors, cursors[i].name) == NULL)
|
||||||
@@ -645,7 +646,7 @@ win32_cursor_theme_load_system (Win32CursorTheme *theme,
|
|||||||
DestroyCursor (x_hcursor);
|
DestroyCursor (x_hcursor);
|
||||||
|
|
||||||
cursor = win32_cursor_new (shared_hcursor ? GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_NULL : GDK_WIN32_CURSOR_CREATE,
|
cursor = win32_cursor_new (shared_hcursor ? GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_NULL : GDK_WIN32_CURSOR_CREATE,
|
||||||
(gpointer) cursors[i].builtin,
|
(wchar_t*) cursors[i].builtin,
|
||||||
size,
|
size,
|
||||||
size,
|
size,
|
||||||
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0),
|
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0),
|
||||||
@@ -660,14 +661,14 @@ win32_cursor_theme_load_system (Win32CursorTheme *theme,
|
|||||||
if (default_cursors[i].name == NULL)
|
if (default_cursors[i].name == NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
shared_hcursor = LoadImageA (NULL, default_cursors[i].id, IMAGE_CURSOR, size, size,
|
shared_hcursor = LoadImage (NULL, default_cursors[i].id, IMAGE_CURSOR, size, size,
|
||||||
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0));
|
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0));
|
||||||
|
|
||||||
if (shared_hcursor == NULL)
|
if (shared_hcursor == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
cursor = win32_cursor_new (GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_NULL,
|
cursor = win32_cursor_new (GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_NULL,
|
||||||
(gpointer) default_cursors[i].id,
|
(wchar_t*) default_cursors[i].id,
|
||||||
size,
|
size,
|
||||||
size,
|
size,
|
||||||
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0),
|
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0),
|
||||||
@@ -779,8 +780,8 @@ win32hcursor_idc_from_name (GdkWin32Display *display,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
return gdk_win32_hcursor_new (display,
|
return gdk_win32_hcursor_new (display,
|
||||||
LoadImageA (NULL, default_cursors[i].id, IMAGE_CURSOR, 0, 0,
|
LoadImage (NULL, default_cursors[i].id, IMAGE_CURSOR, 0, 0,
|
||||||
LR_SHARED | LR_DEFAULTSIZE),
|
LR_SHARED | LR_DEFAULTSIZE),
|
||||||
FALSE);
|
FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -884,7 +885,7 @@ gdk_win32hcursor_create_for_name (GdkWin32Display *display,
|
|||||||
/* Allow to load named cursor resources linked into the executable.
|
/* Allow to load named cursor resources linked into the executable.
|
||||||
* Cursors obtained with LoadCursor() cannot be destroyed.
|
* Cursors obtained with LoadCursor() cannot be destroyed.
|
||||||
*/
|
*/
|
||||||
return gdk_win32_hcursor_new (display, LoadCursor (hinstance, name), FALSE);
|
return gdk_win32_hcursor_new (display, LoadCursorA (hinstance, name), FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HICON
|
static HICON
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ gdk_device_manager_win32_finalize (GObject *object)
|
|||||||
#if DEBUG_WINTAB
|
#if DEBUG_WINTAB
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_lc(LOGCONTEXT *lc)
|
print_lc(LOGCONTEXTA *lc)
|
||||||
{
|
{
|
||||||
g_print ("lcName = %s\n", lc->lcName);
|
g_print ("lcName = %s\n", lc->lcName);
|
||||||
g_print ("lcOptions =");
|
g_print ("lcOptions =");
|
||||||
@@ -374,13 +374,13 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager)
|
|||||||
|
|
||||||
wintab_contexts = NULL;
|
wintab_contexts = NULL;
|
||||||
|
|
||||||
n = GetSystemDirectory (&dummy, 0);
|
n = GetSystemDirectoryA (&dummy, 0);
|
||||||
|
|
||||||
if (n <= 0)
|
if (n <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wintab32_dll_path = g_malloc (n + 1 + strlen (WINTAB32_DLL));
|
wintab32_dll_path = g_malloc (n + 1 + strlen (WINTAB32_DLL));
|
||||||
k = GetSystemDirectory (wintab32_dll_path, n);
|
k = GetSystemDirectoryA (wintab32_dll_path, n);
|
||||||
|
|
||||||
if (k == 0 || k > n)
|
if (k == 0 || k > n)
|
||||||
{
|
{
|
||||||
@@ -392,7 +392,7 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager)
|
|||||||
strcat (wintab32_dll_path, G_DIR_SEPARATOR_S);
|
strcat (wintab32_dll_path, G_DIR_SEPARATOR_S);
|
||||||
strcat (wintab32_dll_path, WINTAB32_DLL);
|
strcat (wintab32_dll_path, WINTAB32_DLL);
|
||||||
|
|
||||||
if ((wintab32 = LoadLibrary (wintab32_dll_path)) == NULL)
|
if ((wintab32 = LoadLibraryA (wintab32_dll_path)) == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((p_WTInfoA = (t_WTInfoA) GetProcAddress (wintab32, "WTInfoA")) == NULL)
|
if ((p_WTInfoA = (t_WTInfoA) GetProcAddress (wintab32, "WTInfoA")) == NULL)
|
||||||
@@ -433,7 +433,7 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager)
|
|||||||
|
|
||||||
for (devix = 0; devix < ndevices; devix++)
|
for (devix = 0; devix < ndevices; devix++)
|
||||||
{
|
{
|
||||||
LOGCONTEXT lc;
|
LOGCONTEXTA lc;
|
||||||
|
|
||||||
/* We open the Wintab device (hmm, what if there are several, or
|
/* We open the Wintab device (hmm, what if there are several, or
|
||||||
* can there even be several, probably not?) as a system
|
* can there even be several, probably not?) as a system
|
||||||
|
|||||||
@@ -480,7 +480,7 @@ register_display_change_notification (GdkDisplay *display)
|
|||||||
WNDCLASS wclass = { 0, };
|
WNDCLASS wclass = { 0, };
|
||||||
ATOM klass;
|
ATOM klass;
|
||||||
|
|
||||||
wclass.lpszClassName = "GdkDisplayChange";
|
wclass.lpszClassName = L"GdkDisplayChange";
|
||||||
wclass.lpfnWndProc = display_change_window_procedure;
|
wclass.lpfnWndProc = display_change_window_procedure;
|
||||||
wclass.hInstance = this_module ();
|
wclass.hInstance = this_module ();
|
||||||
wclass.style = CS_OWNDC;
|
wclass.style = CS_OWNDC;
|
||||||
@@ -606,7 +606,7 @@ gdk_win32_display_get_name (GdkDisplay *display)
|
|||||||
window_station_name = "WinSta0";
|
window_station_name = "WinSta0";
|
||||||
}
|
}
|
||||||
|
|
||||||
processIdToSessionId = (PFN_ProcessIdToSessionId) GetProcAddress (GetModuleHandle ("kernel32.dll"), "ProcessIdToSessionId");
|
processIdToSessionId = (PFN_ProcessIdToSessionId) GetProcAddress (GetModuleHandle (L"kernel32.dll"), "ProcessIdToSessionId");
|
||||||
if (!processIdToSessionId || !processIdToSessionId (GetCurrentProcessId (), &session_id))
|
if (!processIdToSessionId || !processIdToSessionId (GetCurrentProcessId (), &session_id))
|
||||||
session_id = 0;
|
session_id = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -134,6 +134,7 @@ struct _GdkWin32Display
|
|||||||
guint hasWglEXTSwapControl : 1;
|
guint hasWglEXTSwapControl : 1;
|
||||||
guint hasWglOMLSyncControl : 1;
|
guint hasWglOMLSyncControl : 1;
|
||||||
guint hasWglARBPixelFormat : 1;
|
guint hasWglARBPixelFormat : 1;
|
||||||
|
guint force_enable_depth_bits : 1;
|
||||||
|
|
||||||
#ifdef HAVE_EGL
|
#ifdef HAVE_EGL
|
||||||
guint hasEglKHRCreateContext : 1;
|
guint hasEglKHRCreateContext : 1;
|
||||||
|
|||||||
@@ -658,7 +658,7 @@ _gdk_win32_dnd_thread_main (gpointer data)
|
|||||||
/* Create a message queue */
|
/* Create a message queue */
|
||||||
PeekMessage (&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
|
PeekMessage (&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
|
||||||
|
|
||||||
thread_wakeup_message = RegisterWindowMessage ("GDK_WORKER_THREAD_WEAKEUP");
|
thread_wakeup_message = RegisterWindowMessage (L"GDK_WORKER_THREAD_WEAKEUP");
|
||||||
|
|
||||||
/* Signal the main thread that we're ready.
|
/* Signal the main thread that we're ready.
|
||||||
* This is the only time the queue works in reverse.
|
* This is the only time the queue works in reverse.
|
||||||
|
|||||||
@@ -419,7 +419,7 @@ set_up_low_level_keyboard_hook (void)
|
|||||||
else
|
else
|
||||||
WIN32_API_FAILED ("SetWindowsHookEx");
|
WIN32_API_FAILED ("SetWindowsHookEx");
|
||||||
|
|
||||||
aerosnap_message = RegisterWindowMessage ("GDK_WIN32_AEROSNAP_MESSAGE");
|
aerosnap_message = RegisterWindowMessage (L"GDK_WIN32_AEROSNAP_MESSAGE");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -470,7 +470,7 @@ _gdk_events_init (GdkDisplay *display)
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
got_gdk_events_message = RegisterWindowMessage ("GDK_WIN32_GOT_EVENTS");
|
got_gdk_events_message = RegisterWindowMessage (L"GDK_WIN32_GOT_EVENTS");
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* Check if we have some input locale identifier loaded that uses a
|
/* Check if we have some input locale identifier loaded that uses a
|
||||||
@@ -1685,7 +1685,7 @@ _gdk_win32_surface_fill_min_max_info (GdkSurface *window,
|
|||||||
nearest_monitor = MonitorFromWindow (GDK_SURFACE_HWND (window), MONITOR_DEFAULTTONEAREST);
|
nearest_monitor = MonitorFromWindow (GDK_SURFACE_HWND (window), MONITOR_DEFAULTTONEAREST);
|
||||||
nearest_info.cbSize = sizeof (nearest_info);
|
nearest_info.cbSize = sizeof (nearest_info);
|
||||||
|
|
||||||
if (GetMonitorInfoA (nearest_monitor, &nearest_info))
|
if (GetMonitorInfo (nearest_monitor, &nearest_info))
|
||||||
{
|
{
|
||||||
/* MSDN says that we must specify maximized window
|
/* MSDN says that we must specify maximized window
|
||||||
* size as if it was located on the primary monitor.
|
* size as if it was located on the primary monitor.
|
||||||
|
|||||||
@@ -142,8 +142,7 @@ get_wgl_pfd (HDC hdc,
|
|||||||
|
|
||||||
pfd->nSize = sizeof (PIXELFORMATDESCRIPTOR);
|
pfd->nSize = sizeof (PIXELFORMATDESCRIPTOR);
|
||||||
|
|
||||||
if (display_win32 != NULL &&
|
if (display_win32->hasWglARBPixelFormat)
|
||||||
display_win32->hasWglARBPixelFormat)
|
|
||||||
{
|
{
|
||||||
UINT num_formats;
|
UINT num_formats;
|
||||||
int colorbits = GetDeviceCaps (hdc, BITSPIXEL);
|
int colorbits = GetDeviceCaps (hdc, BITSPIXEL);
|
||||||
@@ -176,15 +175,18 @@ get_wgl_pfd (HDC hdc,
|
|||||||
pixelAttribs[i++] = WGL_ALPHA_BITS_ARB;
|
pixelAttribs[i++] = WGL_ALPHA_BITS_ARB;
|
||||||
pixelAttribs[i++] = 8;
|
pixelAttribs[i++] = 8;
|
||||||
|
|
||||||
pixelAttribs[i++] = WGL_DEPTH_BITS_ARB;
|
|
||||||
pixelAttribs[i++] = 0;
|
|
||||||
|
|
||||||
pixelAttribs[i++] = WGL_STENCIL_BITS_ARB;
|
pixelAttribs[i++] = WGL_STENCIL_BITS_ARB;
|
||||||
pixelAttribs[i++] = 0;
|
pixelAttribs[i++] = 0;
|
||||||
|
|
||||||
pixelAttribs[i++] = WGL_ACCUM_BITS_ARB;
|
pixelAttribs[i++] = WGL_ACCUM_BITS_ARB;
|
||||||
pixelAttribs[i++] = 0;
|
pixelAttribs[i++] = 0;
|
||||||
|
|
||||||
|
if (!display_win32->force_enable_depth_bits)
|
||||||
|
{
|
||||||
|
pixelAttribs[i++] = WGL_DEPTH_BITS_ARB;
|
||||||
|
pixelAttribs[i++] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* end of "Update PIXEL_ATTRIBUTES above if any groups are added here!" */
|
/* end of "Update PIXEL_ATTRIBUTES above if any groups are added here!" */
|
||||||
|
|
||||||
pixelAttribs[i++] = 0; /* end of pixelAttribs */
|
pixelAttribs[i++] = 0; /* end of pixelAttribs */
|
||||||
@@ -215,8 +217,20 @@ get_wgl_pfd (HDC hdc,
|
|||||||
pfd->cColorBits = GetDeviceCaps (hdc, BITSPIXEL);
|
pfd->cColorBits = GetDeviceCaps (hdc, BITSPIXEL);
|
||||||
pfd->cAlphaBits = 8;
|
pfd->cAlphaBits = 8;
|
||||||
pfd->iLayerType = PFD_MAIN_PLANE;
|
pfd->iLayerType = PFD_MAIN_PLANE;
|
||||||
|
pfd->cAccumBits = 0;
|
||||||
|
pfd->cStencilBits = 0;
|
||||||
|
|
||||||
|
if (!display_win32->force_enable_depth_bits)
|
||||||
|
pfd->cDepthBits = 0;
|
||||||
|
|
||||||
best_pf = ChoosePixelFormat (hdc, pfd);
|
best_pf = ChoosePixelFormat (hdc, pfd);
|
||||||
|
|
||||||
|
/* try again if driver enforces depth buffers */
|
||||||
|
if (best_pf == 0 && !display_win32->force_enable_depth_bits)
|
||||||
|
{
|
||||||
|
display_win32->force_enable_depth_bits = TRUE;
|
||||||
|
get_wgl_pfd (hdc, pfd, display_win32);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return best_pf;
|
return best_pf;
|
||||||
@@ -234,7 +248,7 @@ gdk_init_dummy_wgl_context (GdkWin32Display *display_win32)
|
|||||||
|
|
||||||
memset (&pfd, 0, sizeof (PIXELFORMATDESCRIPTOR));
|
memset (&pfd, 0, sizeof (PIXELFORMATDESCRIPTOR));
|
||||||
|
|
||||||
best_idx = get_wgl_pfd (display_win32->dummy_context_wgl.hdc, &pfd, NULL);
|
best_idx = get_wgl_pfd (display_win32->dummy_context_wgl.hdc, &pfd, display_win32);
|
||||||
|
|
||||||
if (best_idx != 0)
|
if (best_idx != 0)
|
||||||
set_pixel_format_result = SetPixelFormat (display_win32->dummy_context_wgl.hdc,
|
set_pixel_format_result = SetPixelFormat (display_win32->dummy_context_wgl.hdc,
|
||||||
@@ -269,7 +283,7 @@ create_dummy_gl_window (void)
|
|||||||
ATOM klass;
|
ATOM klass;
|
||||||
HWND hwnd = NULL;
|
HWND hwnd = NULL;
|
||||||
|
|
||||||
wclass.lpszClassName = "GdkGLDummyWindow";
|
wclass.lpszClassName = L"GdkGLDummyWindow";
|
||||||
wclass.lpfnWndProc = DefWindowProc;
|
wclass.lpfnWndProc = DefWindowProc;
|
||||||
wclass.hInstance = this_module ();
|
wclass.hInstance = this_module ();
|
||||||
wclass.style = CS_OWNDC;
|
wclass.style = CS_OWNDC;
|
||||||
|
|||||||
@@ -730,7 +730,7 @@ _gdk_win32_key_to_string (LONG lParam)
|
|||||||
char buf[100];
|
char buf[100];
|
||||||
char *keyname_utf8;
|
char *keyname_utf8;
|
||||||
|
|
||||||
if (GetKeyNameText (lParam, buf, sizeof (buf)) &&
|
if (GetKeyNameTextA (lParam, buf, sizeof (buf)) &&
|
||||||
(keyname_utf8 = g_locale_to_utf8 (buf, -1, NULL, NULL, NULL)) != NULL)
|
(keyname_utf8 = g_locale_to_utf8 (buf, -1, NULL, NULL, NULL)) != NULL)
|
||||||
{
|
{
|
||||||
char *retval = static_printf ("%s", keyname_utf8);
|
char *retval = static_printf ("%s", keyname_utf8);
|
||||||
@@ -780,7 +780,7 @@ _gdk_win32_cf_to_string (UINT format)
|
|||||||
if (format >= CF_PRIVATEFIRST &&
|
if (format >= CF_PRIVATEFIRST &&
|
||||||
format <= CF_PRIVATELAST)
|
format <= CF_PRIVATELAST)
|
||||||
return static_printf ("CF_PRIVATE%d", format - CF_PRIVATEFIRST);
|
return static_printf ("CF_PRIVATE%d", format - CF_PRIVATEFIRST);
|
||||||
if (GetClipboardFormatName (format, buf, sizeof (buf)))
|
if (GetClipboardFormatNameA (format, buf, sizeof (buf)))
|
||||||
return static_printf ("'%s'", buf);
|
return static_printf ("'%s'", buf);
|
||||||
else
|
else
|
||||||
return static_printf ("unk-%#lx", format);
|
return static_printf ("unk-%#lx", format);
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ typedef struct _Win32Cursor Win32Cursor;
|
|||||||
|
|
||||||
struct _Win32Cursor {
|
struct _Win32Cursor {
|
||||||
GdkWin32CursorLoadType load_type;
|
GdkWin32CursorLoadType load_type;
|
||||||
gunichar2 *resource_name;
|
wchar_t *resource_name;
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
guint load_flags;
|
guint load_flags;
|
||||||
|
|||||||
@@ -326,7 +326,7 @@ RegisterGdkClass (GType wtype)
|
|||||||
static WNDCLASSEXW wcl;
|
static WNDCLASSEXW wcl;
|
||||||
ATOM klass = 0;
|
ATOM klass = 0;
|
||||||
|
|
||||||
wcl.cbSize = sizeof (WNDCLASSEX);
|
wcl.cbSize = sizeof (WNDCLASSEXW);
|
||||||
wcl.style = 0; /* DON'T set CS_<H,V>REDRAW. It causes total redraw
|
wcl.style = 0; /* DON'T set CS_<H,V>REDRAW. It causes total redraw
|
||||||
* on WM_SIZE and WM_MOVE. Flicker, Performance!
|
* on WM_SIZE and WM_MOVE. Flicker, Performance!
|
||||||
*/
|
*/
|
||||||
@@ -340,7 +340,7 @@ RegisterGdkClass (GType wtype)
|
|||||||
/* initialize once! */
|
/* initialize once! */
|
||||||
if (0 == hAppIcon && 0 == hAppIconSm)
|
if (0 == hAppIcon && 0 == hAppIconSm)
|
||||||
{
|
{
|
||||||
char sLoc [MAX_PATH+1];
|
wchar_t sLoc [MAX_PATH+1];
|
||||||
|
|
||||||
// try to load first icon of executable program
|
// try to load first icon of executable program
|
||||||
if (0 != GetModuleFileName (NULL, sLoc, MAX_PATH))
|
if (0 != GetModuleFileName (NULL, sLoc, MAX_PATH))
|
||||||
@@ -2064,7 +2064,7 @@ stash_window (GdkSurface *window,
|
|||||||
hmonitor = MonitorFromWindow (GDK_SURFACE_HWND (window), MONITOR_DEFAULTTONEAREST);
|
hmonitor = MonitorFromWindow (GDK_SURFACE_HWND (window), MONITOR_DEFAULTTONEAREST);
|
||||||
hmonitor_info.cbSize = sizeof (hmonitor_info);
|
hmonitor_info.cbSize = sizeof (hmonitor_info);
|
||||||
|
|
||||||
if (!GetMonitorInfoA (hmonitor, &hmonitor_info))
|
if (!GetMonitorInfo (hmonitor, &hmonitor_info))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (impl->snap_stash == NULL)
|
if (impl->snap_stash == NULL)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
static const struct { const char *name; const char *builtin; int type; guchar width; guchar height; guchar hotx; guchar hoty; char *data; } cursors[] = {
|
static const struct { const char *name; const wchar_t *builtin; int type; guchar width; guchar height; guchar hotx; guchar hoty; char *data; } cursors[] = {
|
||||||
{ "X_cursor", NULL, 0, 16, 16, 7, 7,
|
{ "X_cursor", NULL, 0, 16, 16, 7, 7,
|
||||||
"\125\000\000\125\152\100\001\251\152\220\006\251\152\244\032\251"
|
"\125\000\000\125\152\100\001\251\152\220\006\251\152\244\032\251"
|
||||||
"\032\251\152\244\006\252\252\220\001\252\252\100\000\152\251\000"
|
"\032\251\152\244\006\252\252\220\001\252\252\100\000\152\251\000"
|
||||||
|
|||||||
@@ -1776,11 +1776,6 @@ _gdk_x11_display_is_root_window (GdkDisplay *display,
|
|||||||
return GDK_SCREEN_XROOTWIN (display_x11->screen) == xroot_window;
|
return GDK_SCREEN_XROOTWIN (display_x11->screen) == xroot_window;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct XPointerUngrabInfo {
|
|
||||||
GdkDisplay *display;
|
|
||||||
guint32 time;
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
device_grab_update_callback (GdkDisplay *display,
|
device_grab_update_callback (GdkDisplay *display,
|
||||||
gpointer data,
|
gpointer data,
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ gsk_gl_glyph_library_init_atlas (GskGLTextureLibrary *self,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
gl_format = GL_BGRA;
|
gl_format = GL_BGRA;
|
||||||
gl_type = GL_UNSIGNED_BYTE;
|
gl_type = GL_UNSIGNED_INT_8_8_8_8_REV;
|
||||||
}
|
}
|
||||||
glBindTexture (GL_TEXTURE_2D, atlas->texture_id);
|
glBindTexture (GL_TEXTURE_2D, atlas->texture_id);
|
||||||
|
|
||||||
@@ -293,7 +293,7 @@ gsk_gl_glyph_library_upload_glyph (GskGLGlyphLibrary *self,
|
|||||||
{
|
{
|
||||||
pixel_data = cairo_image_surface_get_data (surface);
|
pixel_data = cairo_image_surface_get_data (surface);
|
||||||
gl_format = GL_BGRA;
|
gl_format = GL_BGRA;
|
||||||
gl_type = GL_UNSIGNED_BYTE;
|
gl_type = GL_UNSIGNED_INT_8_8_8_8_REV;
|
||||||
}
|
}
|
||||||
|
|
||||||
glPixelStorei (GL_UNPACK_ROW_LENGTH, stride / 4);
|
glPixelStorei (GL_UNPACK_ROW_LENGTH, stride / 4);
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ gsk_gl_icon_library_add (GskGLIconLibrary *self,
|
|||||||
{
|
{
|
||||||
pixel_data = surface_data;
|
pixel_data = surface_data;
|
||||||
gl_format = GL_BGRA;
|
gl_format = GL_BGRA;
|
||||||
gl_type = GL_UNSIGNED_BYTE;
|
gl_type = GL_UNSIGNED_INT_8_8_8_8_REV;
|
||||||
}
|
}
|
||||||
|
|
||||||
texture_id = GSK_GL_TEXTURE_ATLAS_ENTRY_TEXTURE (icon_data);
|
texture_id = GSK_GL_TEXTURE_ATLAS_ENTRY_TEXTURE (icon_data);
|
||||||
|
|||||||
@@ -41,6 +41,15 @@
|
|||||||
#include <gsk/gskroundedrectprivate.h>
|
#include <gsk/gskroundedrectprivate.h>
|
||||||
#include <gsk/gskrectprivate.h>
|
#include <gsk/gskrectprivate.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GskGLRenderer:
|
||||||
|
*
|
||||||
|
* A GL based renderer.
|
||||||
|
*
|
||||||
|
* See [class@Gsk.Renderer].
|
||||||
|
*
|
||||||
|
* Since: 4.2
|
||||||
|
*/
|
||||||
struct _GskGLRendererClass
|
struct _GskGLRendererClass
|
||||||
{
|
{
|
||||||
GskRendererClass parent_class;
|
GskRendererClass parent_class;
|
||||||
|
|||||||
@@ -70,7 +70,10 @@ gsk_gl_frame_cleanup (GskGpuFrame *frame)
|
|||||||
if (self->sync)
|
if (self->sync)
|
||||||
{
|
{
|
||||||
glClientWaitSync (self->sync, 0, -1);
|
glClientWaitSync (self->sync, 0, -1);
|
||||||
g_clear_pointer (&self->sync, glDeleteSync);
|
|
||||||
|
/* can't use g_clear_pointer() on glDeleteSync(), see MR !7294 */
|
||||||
|
glDeleteSync (self->sync);
|
||||||
|
self->sync = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
self->next_texture_slot = 0;
|
self->next_texture_slot = 0;
|
||||||
|
|||||||
@@ -249,7 +249,13 @@ gsk_gl_texture_data_free (gpointer user_data)
|
|||||||
|
|
||||||
gdk_gl_context_make_current (data->context);
|
gdk_gl_context_make_current (data->context);
|
||||||
|
|
||||||
g_clear_pointer (&data->sync, glDeleteSync);
|
/* can't use g_clear_pointer() on glDeleteSync(), see MR !7294 */
|
||||||
|
if (data->sync)
|
||||||
|
{
|
||||||
|
glDeleteSync (data->sync);
|
||||||
|
data->sync = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
glDeleteTextures (1, &data->texture_id);
|
glDeleteTextures (1, &data->texture_id);
|
||||||
g_object_unref (data->context);
|
g_object_unref (data->context);
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,15 @@
|
|||||||
|
|
||||||
#include <glib/gi18n-lib.h>
|
#include <glib/gi18n-lib.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GskNglRenderer:
|
||||||
|
*
|
||||||
|
* A GL based renderer.
|
||||||
|
*
|
||||||
|
* See [class@Gsk.Renderer].
|
||||||
|
*
|
||||||
|
* Since: 4.2
|
||||||
|
*/
|
||||||
struct _GskNglRenderer
|
struct _GskNglRenderer
|
||||||
{
|
{
|
||||||
GskGpuRenderer parent_instance;
|
GskGpuRenderer parent_instance;
|
||||||
|
|||||||
+24
-11
@@ -81,6 +81,7 @@ struct _PipelineCacheKey
|
|||||||
GskGpuShaderClip clip;
|
GskGpuShaderClip clip;
|
||||||
GskGpuBlend blend;
|
GskGpuBlend blend;
|
||||||
VkFormat format;
|
VkFormat format;
|
||||||
|
VkPipeline pipeline;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _RenderPassCacheKey
|
struct _RenderPassCacheKey
|
||||||
@@ -88,6 +89,7 @@ struct _RenderPassCacheKey
|
|||||||
VkFormat format;
|
VkFormat format;
|
||||||
VkImageLayout from_layout;
|
VkImageLayout from_layout;
|
||||||
VkImageLayout to_layout;
|
VkImageLayout to_layout;
|
||||||
|
VkRenderPass render_pass;
|
||||||
};
|
};
|
||||||
|
|
||||||
static guint
|
static guint
|
||||||
@@ -297,8 +299,10 @@ gsk_vulkan_pipeline_layout_unref (GskVulkanDevice *self,
|
|||||||
g_hash_table_iter_init (&iter, layout->pipeline_cache);
|
g_hash_table_iter_init (&iter, layout->pipeline_cache);
|
||||||
while (g_hash_table_iter_next (&iter, &key, &value))
|
while (g_hash_table_iter_next (&iter, &key, &value))
|
||||||
{
|
{
|
||||||
|
vkDestroyPipeline (display->vk_device,
|
||||||
|
((PipelineCacheKey *)key)->pipeline,
|
||||||
|
NULL);
|
||||||
g_free (key);
|
g_free (key);
|
||||||
vkDestroyPipeline (display->vk_device, value, NULL);
|
|
||||||
}
|
}
|
||||||
g_hash_table_unref (layout->pipeline_cache);
|
g_hash_table_unref (layout->pipeline_cache);
|
||||||
|
|
||||||
@@ -463,8 +467,10 @@ gsk_vulkan_device_finalize (GObject *object)
|
|||||||
g_hash_table_iter_init (&iter, self->render_pass_cache);
|
g_hash_table_iter_init (&iter, self->render_pass_cache);
|
||||||
while (g_hash_table_iter_next (&iter, &key, &value))
|
while (g_hash_table_iter_next (&iter, &key, &value))
|
||||||
{
|
{
|
||||||
|
vkDestroyRenderPass (display->vk_device,
|
||||||
|
((RenderPassCacheKey *)key)->render_pass,
|
||||||
|
NULL);
|
||||||
g_free (key);
|
g_free (key);
|
||||||
vkDestroyRenderPass (display->vk_device, value, NULL);
|
|
||||||
}
|
}
|
||||||
g_hash_table_unref (self->render_pass_cache);
|
g_hash_table_unref (self->render_pass_cache);
|
||||||
|
|
||||||
@@ -824,6 +830,7 @@ gsk_vulkan_device_get_vk_render_pass (GskVulkanDevice *self,
|
|||||||
VkImageLayout to_layout)
|
VkImageLayout to_layout)
|
||||||
{
|
{
|
||||||
RenderPassCacheKey cache_key;
|
RenderPassCacheKey cache_key;
|
||||||
|
RenderPassCacheKey *cached_result;
|
||||||
VkRenderPass render_pass;
|
VkRenderPass render_pass;
|
||||||
GdkDisplay *display;
|
GdkDisplay *display;
|
||||||
|
|
||||||
@@ -832,9 +839,9 @@ gsk_vulkan_device_get_vk_render_pass (GskVulkanDevice *self,
|
|||||||
.from_layout = from_layout,
|
.from_layout = from_layout,
|
||||||
.to_layout = to_layout,
|
.to_layout = to_layout,
|
||||||
};
|
};
|
||||||
render_pass = g_hash_table_lookup (self->render_pass_cache, &cache_key);
|
cached_result = g_hash_table_lookup (self->render_pass_cache, &cache_key);
|
||||||
if (render_pass)
|
if (cached_result)
|
||||||
return render_pass;
|
return cached_result->render_pass;
|
||||||
|
|
||||||
display = gsk_gpu_device_get_display (GSK_GPU_DEVICE (self));
|
display = gsk_gpu_device_get_display (GSK_GPU_DEVICE (self));
|
||||||
|
|
||||||
@@ -878,7 +885,10 @@ gsk_vulkan_device_get_vk_render_pass (GskVulkanDevice *self,
|
|||||||
NULL,
|
NULL,
|
||||||
&render_pass);
|
&render_pass);
|
||||||
|
|
||||||
g_hash_table_insert (self->render_pass_cache, g_memdup (&cache_key, sizeof (RenderPassCacheKey)), render_pass);
|
cached_result = g_memdup (&cache_key, sizeof (RenderPassCacheKey));
|
||||||
|
cached_result->render_pass = render_pass;
|
||||||
|
|
||||||
|
g_hash_table_insert (self->render_pass_cache, cached_result, cached_result);
|
||||||
|
|
||||||
return render_pass;
|
return render_pass;
|
||||||
}
|
}
|
||||||
@@ -946,6 +956,7 @@ gsk_vulkan_device_get_vk_pipeline (GskVulkanDevice *self,
|
|||||||
VkRenderPass render_pass)
|
VkRenderPass render_pass)
|
||||||
{
|
{
|
||||||
PipelineCacheKey cache_key;
|
PipelineCacheKey cache_key;
|
||||||
|
PipelineCacheKey *cached_result;
|
||||||
VkPipeline pipeline;
|
VkPipeline pipeline;
|
||||||
GdkDisplay *display;
|
GdkDisplay *display;
|
||||||
const char *version_string;
|
const char *version_string;
|
||||||
@@ -961,9 +972,9 @@ gsk_vulkan_device_get_vk_pipeline (GskVulkanDevice *self,
|
|||||||
.blend = blend,
|
.blend = blend,
|
||||||
.format = format,
|
.format = format,
|
||||||
};
|
};
|
||||||
pipeline = g_hash_table_lookup (layout->pipeline_cache, &cache_key);
|
cached_result = g_hash_table_lookup (layout->pipeline_cache, &cache_key);
|
||||||
if (pipeline)
|
if (cached_result)
|
||||||
return pipeline;
|
return cached_result->pipeline;
|
||||||
|
|
||||||
display = gsk_gpu_device_get_display (GSK_GPU_DEVICE (self));
|
display = gsk_gpu_device_get_display (GSK_GPU_DEVICE (self));
|
||||||
if (gsk_vulkan_device_has_feature (self, GDK_VULKAN_FEATURE_DYNAMIC_INDEXING) &&
|
if (gsk_vulkan_device_has_feature (self, GDK_VULKAN_FEATURE_DYNAMIC_INDEXING) &&
|
||||||
@@ -1153,7 +1164,9 @@ gsk_vulkan_device_get_vk_pipeline (GskVulkanDevice *self,
|
|||||||
g_free (fragment_shader_name);
|
g_free (fragment_shader_name);
|
||||||
g_free (vertex_shader_name);
|
g_free (vertex_shader_name);
|
||||||
|
|
||||||
g_hash_table_insert (layout->pipeline_cache, g_memdup (&cache_key, sizeof (PipelineCacheKey)), pipeline);
|
cached_result = g_memdup (&cache_key, sizeof (PipelineCacheKey));
|
||||||
|
cached_result->pipeline = pipeline;
|
||||||
|
g_hash_table_insert (layout->pipeline_cache, cached_result, cached_result);
|
||||||
gdk_display_vulkan_pipeline_cache_updated (display);
|
gdk_display_vulkan_pipeline_cache_updated (display);
|
||||||
|
|
||||||
return pipeline;
|
return pipeline;
|
||||||
@@ -1261,7 +1274,7 @@ gsk_vulkan_device_find_allocator (GskVulkanDevice *self,
|
|||||||
|
|
||||||
g_assert (found < properties.memoryTypeCount);
|
g_assert (found < properties.memoryTypeCount);
|
||||||
|
|
||||||
return gsk_vulkan_allocator_ref (gsk_vulkan_device_get_allocator (self, i, &properties.memoryTypes[i]));
|
return gsk_vulkan_allocator_ref (gsk_vulkan_device_get_allocator (self, found, &properties.memoryTypes[found]));
|
||||||
}
|
}
|
||||||
|
|
||||||
GskVulkanAllocator *
|
GskVulkanAllocator *
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ gsk_vulkan_buddy_allocator_alloc (GskVulkanAllocator *allocator,
|
|||||||
if (self->cache.vk_memory)
|
if (self->cache.vk_memory)
|
||||||
{
|
{
|
||||||
*alloc = self->cache;
|
*alloc = self->cache;
|
||||||
self->cache.vk_memory = NULL;
|
self->cache.vk_memory = VK_NULL_HANDLE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -240,7 +240,7 @@ restart:
|
|||||||
alloc->size <<= 1;
|
alloc->size <<= 1;
|
||||||
if (slot == 0)
|
if (slot == 0)
|
||||||
{
|
{
|
||||||
if (self->cache.vk_memory == NULL)
|
if (self->cache.vk_memory == VK_NULL_HANDLE)
|
||||||
self->cache = *alloc;
|
self->cache = *alloc;
|
||||||
else
|
else
|
||||||
gsk_vulkan_free (self->allocator, alloc);
|
gsk_vulkan_free (self->allocator, alloc);
|
||||||
|
|||||||
+1
-1
@@ -439,7 +439,7 @@ gsk_gl_shader_class_init (GskGLShaderClass *klass)
|
|||||||
object_class->constructed = gsk_gl_shader_constructed;
|
object_class->constructed = gsk_gl_shader_constructed;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GskGLShader:sourcecode: (attributes org.gtk.Property.get=gsk_gl_shader_get_source)
|
* GskGLShader:source: (attributes org.gtk.Property.get=gsk_gl_shader_get_source)
|
||||||
*
|
*
|
||||||
* The source code for the shader, as a `GBytes`.
|
* The source code for the shader, as a `GBytes`.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -387,6 +387,7 @@ gsk_path_builder_add_reverse_path (GskPathBuilder *self,
|
|||||||
/**
|
/**
|
||||||
* gsk_path_builder_add_cairo_path:
|
* gsk_path_builder_add_cairo_path:
|
||||||
* @self: a `GskPathBuilder`
|
* @self: a `GskPathBuilder`
|
||||||
|
* @path: a path
|
||||||
*
|
*
|
||||||
* Adds a Cairo path to the builder.
|
* Adds a Cairo path to the builder.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -51,6 +51,16 @@ G_DEFINE_BOXED_TYPE (GskPathPoint, gsk_path_point,
|
|||||||
gsk_path_point_copy,
|
gsk_path_point_copy,
|
||||||
gsk_path_point_free)
|
gsk_path_point_free)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gsk_path_point_copy:
|
||||||
|
* @point: a path point
|
||||||
|
*
|
||||||
|
* Copies a path point.
|
||||||
|
*
|
||||||
|
* Returns: the copied point
|
||||||
|
*
|
||||||
|
* Since: 4.14
|
||||||
|
*/
|
||||||
GskPathPoint *
|
GskPathPoint *
|
||||||
gsk_path_point_copy (GskPathPoint *point)
|
gsk_path_point_copy (GskPathPoint *point)
|
||||||
{
|
{
|
||||||
@@ -63,6 +73,14 @@ gsk_path_point_copy (GskPathPoint *point)
|
|||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gsk_path_point_free:
|
||||||
|
* @point: a path point
|
||||||
|
*
|
||||||
|
* Frees a path point copied by [method@Gsk.PathPoint.copy].
|
||||||
|
*
|
||||||
|
* Since: 4.14
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
gsk_path_point_free (GskPathPoint *point)
|
gsk_path_point_free (GskPathPoint *point)
|
||||||
{
|
{
|
||||||
|
|||||||
+10
-3
@@ -679,9 +679,16 @@ vulkan_supported_platform (GdkSurface *surface,
|
|||||||
if (props.deviceType == VK_PHYSICAL_DEVICE_TYPE_CPU)
|
if (props.deviceType == VK_PHYSICAL_DEVICE_TYPE_CPU)
|
||||||
{
|
{
|
||||||
if (!as_fallback)
|
if (!as_fallback)
|
||||||
GSK_DEBUG (RENDERER,
|
GSK_DEBUG (RENDERER, "Not using '%s': device is CPU", g_type_name (renderer_type));
|
||||||
"Not using '%s': device is CPU",
|
return FALSE;
|
||||||
g_type_name (renderer_type));
|
}
|
||||||
|
|
||||||
|
gdk_display_init_dmabuf (display);
|
||||||
|
if (!display->vk_dmabuf_formats ||
|
||||||
|
gdk_dmabuf_formats_get_n_formats (display->vk_dmabuf_formats) == 0)
|
||||||
|
{
|
||||||
|
if (!as_fallback)
|
||||||
|
GSK_DEBUG (RENDERER, "Not using '%s': no dmabuf support", g_type_name (renderer_type));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,13 @@
|
|||||||
|
|
||||||
#include <gobject/gvaluecollector.h>
|
#include <gobject/gvaluecollector.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gsk_serialization_error_quark:
|
||||||
|
*
|
||||||
|
* Registers an error quark for [class@Gsk.RenderNode] errors.
|
||||||
|
*
|
||||||
|
* Returns: the error quark
|
||||||
|
**/
|
||||||
G_DEFINE_QUARK (gsk-serialization-error-quark, gsk_serialization_error)
|
G_DEFINE_QUARK (gsk-serialization-error-quark, gsk_serialization_error)
|
||||||
|
|
||||||
#define GSK_RENDER_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GSK_TYPE_RENDER_NODE, GskRenderNodeClass))
|
#define GSK_RENDER_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GSK_TYPE_RENDER_NODE, GskRenderNodeClass))
|
||||||
|
|||||||
@@ -6397,6 +6397,10 @@ gsk_mask_node_draw (GskRenderNode *node,
|
|||||||
graphene_matrix_t color_matrix;
|
graphene_matrix_t color_matrix;
|
||||||
graphene_vec4_t color_offset;
|
graphene_vec4_t color_offset;
|
||||||
|
|
||||||
|
/* clip so the push_group() creates a smaller surface */
|
||||||
|
gsk_cairo_rectangle (cr, &node->bounds);
|
||||||
|
cairo_clip (cr);
|
||||||
|
|
||||||
if (has_empty_clip (cr))
|
if (has_empty_clip (cr))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
+184
-123
@@ -54,6 +54,8 @@
|
|||||||
#include <pango/pangofc-fontmap.h>
|
#include <pango/pangofc-fontmap.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <hb-subset.h>
|
||||||
|
|
||||||
#include <glib/gstdio.h>
|
#include <glib/gstdio.h>
|
||||||
|
|
||||||
typedef struct _Context Context;
|
typedef struct _Context Context;
|
||||||
@@ -946,23 +948,22 @@ create_ascii_glyphs (PangoFont *font)
|
|||||||
PangoGlyphString *result, *glyph_string;
|
PangoGlyphString *result, *glyph_string;
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
coverage = pango_font_get_coverage (font, language);
|
|
||||||
for (i = MIN_ASCII_GLYPH; i < MAX_ASCII_GLYPH; i++)
|
|
||||||
{
|
|
||||||
if (!pango_coverage_get (coverage, i))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
g_object_unref (coverage);
|
|
||||||
if (i < MAX_ASCII_GLYPH)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
result = pango_glyph_string_new ();
|
result = pango_glyph_string_new ();
|
||||||
|
|
||||||
|
coverage = pango_font_get_coverage (font, language);
|
||||||
|
|
||||||
pango_glyph_string_set_size (result, N_ASCII_GLYPHS);
|
pango_glyph_string_set_size (result, N_ASCII_GLYPHS);
|
||||||
glyph_string = pango_glyph_string_new ();
|
glyph_string = pango_glyph_string_new ();
|
||||||
for (i = MIN_ASCII_GLYPH; i < MAX_ASCII_GLYPH; i++)
|
for (i = MIN_ASCII_GLYPH; i < MAX_ASCII_GLYPH; i++)
|
||||||
{
|
{
|
||||||
const char text[2] = { i, 0 };
|
const char text[2] = { i, 0 };
|
||||||
|
|
||||||
|
if (!pango_coverage_get (coverage, i))
|
||||||
|
{
|
||||||
|
result->glyphs[i - MIN_ASCII_GLYPH].glyph = PANGO_GLYPH_INVALID_INPUT;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
pango_shape_with_flags (text, 1,
|
pango_shape_with_flags (text, 1,
|
||||||
text, 1,
|
text, 1,
|
||||||
¬_a_hack,
|
¬_a_hack,
|
||||||
@@ -970,14 +971,13 @@ create_ascii_glyphs (PangoFont *font)
|
|||||||
PANGO_SHAPE_NONE);
|
PANGO_SHAPE_NONE);
|
||||||
|
|
||||||
if (glyph_string->num_glyphs != 1)
|
if (glyph_string->num_glyphs != 1)
|
||||||
{
|
result->glyphs[i - MIN_ASCII_GLYPH].glyph = PANGO_GLYPH_INVALID_INPUT;
|
||||||
pango_glyph_string_free (glyph_string);
|
else
|
||||||
pango_glyph_string_free (result);
|
result->glyphs[i - MIN_ASCII_GLYPH] = glyph_string->glyphs[0];
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
result->glyphs[i - MIN_ASCII_GLYPH] = glyph_string->glyphs[0];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_object_unref (coverage);
|
||||||
|
|
||||||
pango_glyph_string_free (glyph_string);
|
pango_glyph_string_free (glyph_string);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -1113,81 +1113,70 @@ parse_font (GtkCssParser *parser,
|
|||||||
if (font_name == NULL)
|
if (font_name == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (context->fontmap)
|
|
||||||
font = font_from_string (context->fontmap, font_name, FALSE);
|
|
||||||
|
|
||||||
if (gtk_css_parser_has_url (parser))
|
if (gtk_css_parser_has_url (parser))
|
||||||
{
|
{
|
||||||
char *url;
|
char *url;
|
||||||
|
char *scheme;
|
||||||
|
GBytes *bytes;
|
||||||
|
GError *error = NULL;
|
||||||
|
GtkCssLocation start_location;
|
||||||
|
gboolean success = FALSE;
|
||||||
|
|
||||||
if (font != NULL)
|
start_location = *gtk_css_parser_get_start_location (parser);
|
||||||
|
url = gtk_css_parser_consume_url (parser);
|
||||||
|
|
||||||
|
if (url != NULL)
|
||||||
{
|
{
|
||||||
gtk_css_parser_error_value (parser, "A font with this name already exists.");
|
scheme = g_uri_parse_scheme (url);
|
||||||
/* consume the url to avoid more errors */
|
if (scheme && g_ascii_strcasecmp (scheme, "data") == 0)
|
||||||
url = gtk_css_parser_consume_url (parser);
|
|
||||||
g_free (url);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
char *scheme;
|
|
||||||
GBytes *bytes;
|
|
||||||
GError *error = NULL;
|
|
||||||
GtkCssLocation start_location;
|
|
||||||
gboolean success = FALSE;
|
|
||||||
|
|
||||||
start_location = *gtk_css_parser_get_start_location (parser);
|
|
||||||
url = gtk_css_parser_consume_url (parser);
|
|
||||||
|
|
||||||
if (url != NULL)
|
|
||||||
{
|
{
|
||||||
scheme = g_uri_parse_scheme (url);
|
bytes = gtk_css_data_url_parse (url, NULL, &error);
|
||||||
if (scheme && g_ascii_strcasecmp (scheme, "data") == 0)
|
}
|
||||||
{
|
else
|
||||||
bytes = gtk_css_data_url_parse (url, NULL, &error);
|
{
|
||||||
}
|
GFile *file;
|
||||||
else
|
|
||||||
{
|
|
||||||
GFile *file;
|
|
||||||
|
|
||||||
file = g_file_new_for_uri (url);
|
file = g_file_new_for_uri (url);
|
||||||
bytes = g_file_load_bytes (file, NULL, NULL, &error);
|
bytes = g_file_load_bytes (file, NULL, NULL, &error);
|
||||||
g_object_unref (file);
|
g_object_unref (file);
|
||||||
}
|
|
||||||
|
|
||||||
g_free (scheme);
|
|
||||||
g_free (url);
|
|
||||||
if (bytes != NULL)
|
|
||||||
{
|
|
||||||
success = add_font_from_bytes (context, bytes, &error);
|
|
||||||
g_bytes_unref (bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!success)
|
|
||||||
{
|
|
||||||
gtk_css_parser_emit_error (parser,
|
|
||||||
&start_location,
|
|
||||||
gtk_css_parser_get_end_location (parser),
|
|
||||||
error);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success)
|
g_free (scheme);
|
||||||
|
g_free (url);
|
||||||
|
if (bytes != NULL)
|
||||||
{
|
{
|
||||||
font = font_from_string (context->fontmap, font_name, FALSE);
|
success = add_font_from_bytes (context, bytes, &error);
|
||||||
if (!font)
|
g_bytes_unref (bytes);
|
||||||
{
|
}
|
||||||
gtk_css_parser_error (parser,
|
|
||||||
GTK_CSS_PARSER_ERROR_UNKNOWN_VALUE,
|
if (!success)
|
||||||
&start_location,
|
{
|
||||||
gtk_css_parser_get_end_location (parser),
|
gtk_css_parser_emit_error (parser,
|
||||||
"The given url does not define a font named \"%s\"",
|
&start_location,
|
||||||
font_name);
|
gtk_css_parser_get_end_location (parser),
|
||||||
}
|
error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
font = font_from_string (context->fontmap, font_name, FALSE);
|
||||||
|
if (!font)
|
||||||
|
{
|
||||||
|
gtk_css_parser_error (parser,
|
||||||
|
GTK_CSS_PARSER_ERROR_UNKNOWN_VALUE,
|
||||||
|
&start_location,
|
||||||
|
gtk_css_parser_get_end_location (parser),
|
||||||
|
"The given url does not define a font named \"%s\"",
|
||||||
|
font_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (context->fontmap)
|
||||||
|
font = font_from_string (context->fontmap, font_name, FALSE);
|
||||||
|
|
||||||
if (!font)
|
if (!font)
|
||||||
font = font_from_string (pango_cairo_font_map_get_default (), font_name, TRUE);
|
font = font_from_string (pango_cairo_font_map_get_default (), font_name, TRUE);
|
||||||
|
|
||||||
@@ -2255,6 +2244,12 @@ unpack_glyphs (PangoFont *font,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ascii->glyphs[idx].glyph == PANGO_GLYPH_INVALID_INPUT)
|
||||||
|
{
|
||||||
|
g_clear_pointer (&ascii, pango_glyph_string_free);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
gi->glyph = ascii->glyphs[idx].glyph;
|
gi->glyph = ascii->glyphs[idx].glyph;
|
||||||
gi->geometry.width = ascii->glyphs[idx].geometry.width;
|
gi->geometry.width = ascii->glyphs[idx].geometry.width;
|
||||||
}
|
}
|
||||||
@@ -2946,7 +2941,7 @@ typedef struct
|
|||||||
gsize named_node_counter;
|
gsize named_node_counter;
|
||||||
GHashTable *named_textures;
|
GHashTable *named_textures;
|
||||||
gsize named_texture_counter;
|
gsize named_texture_counter;
|
||||||
GHashTable *serialized_fonts;
|
GHashTable *fonts;
|
||||||
} Printer;
|
} Printer;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -2961,6 +2956,59 @@ printer_init_check_texture (Printer *printer,
|
|||||||
g_hash_table_insert (printer->named_textures, texture, g_strdup (""));
|
g_hash_table_insert (printer->named_textures, texture, g_strdup (""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
hb_face_t *face;
|
||||||
|
hb_subset_input_t *input;
|
||||||
|
gboolean serialized;
|
||||||
|
} FontInfo;
|
||||||
|
|
||||||
|
static void
|
||||||
|
font_info_free (gpointer data)
|
||||||
|
{
|
||||||
|
FontInfo *info = (FontInfo *) data;
|
||||||
|
|
||||||
|
hb_face_destroy (info->face);
|
||||||
|
if (info->input)
|
||||||
|
hb_subset_input_destroy (info->input);
|
||||||
|
g_free (info);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
printer_init_collect_font_info (Printer *printer,
|
||||||
|
GskRenderNode *node)
|
||||||
|
{
|
||||||
|
PangoFont *font;
|
||||||
|
FontInfo *info;
|
||||||
|
|
||||||
|
font = gsk_text_node_get_font (node);
|
||||||
|
|
||||||
|
info = (FontInfo *) g_hash_table_lookup (printer->fonts, hb_font_get_face (pango_font_get_hb_font (font)));
|
||||||
|
if (!info)
|
||||||
|
{
|
||||||
|
info = g_new0 (FontInfo, 1);
|
||||||
|
|
||||||
|
info->face = hb_face_reference (hb_font_get_face (pango_font_get_hb_font (font)));
|
||||||
|
if (!g_object_get_data (G_OBJECT (pango_font_get_font_map (font)), "font-files"))
|
||||||
|
{
|
||||||
|
info->input = hb_subset_input_create_or_fail ();
|
||||||
|
hb_subset_input_set_flags (info->input, HB_SUBSET_FLAGS_RETAIN_GIDS);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_hash_table_insert (printer->fonts, info->face, info);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info->input)
|
||||||
|
{
|
||||||
|
const PangoGlyphInfo *glyphs;
|
||||||
|
guint n_glyphs;
|
||||||
|
|
||||||
|
glyphs = gsk_text_node_get_glyphs (node, &n_glyphs);
|
||||||
|
|
||||||
|
for (guint i = 0; i < n_glyphs; i++)
|
||||||
|
hb_set_add (hb_subset_input_glyph_set (info->input), glyphs[i].glyph);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
printer_init_duplicates_for_node (Printer *printer,
|
printer_init_duplicates_for_node (Printer *printer,
|
||||||
GskRenderNode *node)
|
GskRenderNode *node)
|
||||||
@@ -2976,6 +3024,9 @@ printer_init_duplicates_for_node (Printer *printer,
|
|||||||
{
|
{
|
||||||
case GSK_CAIRO_NODE:
|
case GSK_CAIRO_NODE:
|
||||||
case GSK_TEXT_NODE:
|
case GSK_TEXT_NODE:
|
||||||
|
printer_init_collect_font_info (printer, node);
|
||||||
|
break;
|
||||||
|
|
||||||
case GSK_COLOR_NODE:
|
case GSK_COLOR_NODE:
|
||||||
case GSK_LINEAR_GRADIENT_NODE:
|
case GSK_LINEAR_GRADIENT_NODE:
|
||||||
case GSK_REPEATING_LINEAR_GRADIENT_NODE:
|
case GSK_REPEATING_LINEAR_GRADIENT_NODE:
|
||||||
@@ -3099,7 +3150,7 @@ printer_init (Printer *self,
|
|||||||
self->named_node_counter = 0;
|
self->named_node_counter = 0;
|
||||||
self->named_textures = g_hash_table_new_full (NULL, NULL, NULL, g_free);
|
self->named_textures = g_hash_table_new_full (NULL, NULL, NULL, g_free);
|
||||||
self->named_texture_counter = 0;
|
self->named_texture_counter = 0;
|
||||||
self->serialized_fonts = g_hash_table_new (g_str_hash, g_str_equal);
|
self->fonts = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, font_info_free);
|
||||||
|
|
||||||
printer_init_duplicates_for_node (self, node);
|
printer_init_duplicates_for_node (self, node);
|
||||||
}
|
}
|
||||||
@@ -3111,7 +3162,7 @@ printer_clear (Printer *self)
|
|||||||
g_string_free (self->str, TRUE);
|
g_string_free (self->str, TRUE);
|
||||||
g_hash_table_unref (self->named_nodes);
|
g_hash_table_unref (self->named_nodes);
|
||||||
g_hash_table_unref (self->named_textures);
|
g_hash_table_unref (self->named_textures);
|
||||||
g_hash_table_unref (self->serialized_fonts);
|
g_hash_table_unref (self->fonts);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define IDENT_LEVEL 2 /* Spaces per level */
|
#define IDENT_LEVEL 2 /* Spaces per level */
|
||||||
@@ -3232,17 +3283,6 @@ append_rounded_rect (GString *str,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
append_rgba (GString *str,
|
|
||||||
const GdkRGBA *rgba)
|
|
||||||
{
|
|
||||||
char *rgba_str = gdk_rgba_to_string (rgba);
|
|
||||||
|
|
||||||
g_string_append (str, rgba_str);
|
|
||||||
|
|
||||||
g_free (rgba_str);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
append_point (GString *str,
|
append_point (GString *str,
|
||||||
const graphene_point_t *p)
|
const graphene_point_t *p)
|
||||||
@@ -3288,7 +3328,7 @@ append_rgba_param (Printer *p,
|
|||||||
{
|
{
|
||||||
_indent (p);
|
_indent (p);
|
||||||
g_string_append_printf (p->str, "%s: ", param_name);
|
g_string_append_printf (p->str, "%s: ", param_name);
|
||||||
append_rgba (p->str, value);
|
gdk_rgba_print (value, p->str);
|
||||||
g_string_append_c (p->str, ';');
|
g_string_append_c (p->str, ';');
|
||||||
g_string_append_c (p->str, '\n');
|
g_string_append_c (p->str, '\n');
|
||||||
}
|
}
|
||||||
@@ -3442,7 +3482,7 @@ append_stops_param (Printer *p,
|
|||||||
|
|
||||||
string_append_double (p->str, stops[i].offset);
|
string_append_double (p->str, stops[i].offset);
|
||||||
g_string_append_c (p->str, ' ');
|
g_string_append_c (p->str, ' ');
|
||||||
append_rgba (p->str, &stops[i].color);
|
gdk_rgba_print (&stops[i].color, p->str);
|
||||||
}
|
}
|
||||||
g_string_append (p->str, ";\n");
|
g_string_append (p->str, ";\n");
|
||||||
}
|
}
|
||||||
@@ -3582,14 +3622,46 @@ append_texture_param (Printer *p,
|
|||||||
g_bytes_unref (bytes);
|
g_bytes_unref (bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
print_font (PangoFont *font)
|
||||||
|
{
|
||||||
|
PangoFontDescription *desc;
|
||||||
|
char *s;
|
||||||
|
hb_face_t *face;
|
||||||
|
hb_blob_t *blob;
|
||||||
|
const char *data;
|
||||||
|
unsigned int length;
|
||||||
|
char *csum;
|
||||||
|
|
||||||
|
desc = pango_font_describe_with_absolute_size (font);
|
||||||
|
s = pango_font_description_to_string (desc);
|
||||||
|
|
||||||
|
face = hb_font_get_face (pango_font_get_hb_font (font));
|
||||||
|
blob = hb_face_reference_blob (face);
|
||||||
|
|
||||||
|
data = hb_blob_get_data (blob, &length);
|
||||||
|
csum = g_compute_checksum_for_data (G_CHECKSUM_SHA256, (const guchar *)data, length);
|
||||||
|
|
||||||
|
g_print ("%s, face %p, sha %s\n", s, face, csum);
|
||||||
|
|
||||||
|
g_free (csum);
|
||||||
|
hb_blob_destroy (blob);
|
||||||
|
g_free (s);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gsk_text_node_serialize_font (GskRenderNode *node,
|
gsk_text_node_serialize_font (GskRenderNode *node,
|
||||||
Printer *p)
|
Printer *p)
|
||||||
{
|
{
|
||||||
PangoFont *font = gsk_text_node_get_font (node);
|
PangoFont *font = gsk_text_node_get_font (node);
|
||||||
PangoFontMap *fontmap = pango_font_get_font_map (font);
|
|
||||||
PangoFontDescription *desc;
|
PangoFontDescription *desc;
|
||||||
char *s;
|
char *s;
|
||||||
|
FontInfo *info;
|
||||||
|
hb_face_t *face;
|
||||||
|
hb_blob_t *blob;
|
||||||
|
const char *data;
|
||||||
|
guint length;
|
||||||
|
char *b64;
|
||||||
|
|
||||||
desc = pango_font_describe_with_absolute_size (font);
|
desc = pango_font_describe_with_absolute_size (font);
|
||||||
s = pango_font_description_to_string (desc);
|
s = pango_font_description_to_string (desc);
|
||||||
@@ -3597,42 +3669,31 @@ gsk_text_node_serialize_font (GskRenderNode *node,
|
|||||||
g_free (s);
|
g_free (s);
|
||||||
pango_font_description_free (desc);
|
pango_font_description_free (desc);
|
||||||
|
|
||||||
/* Check if this is a custom font that we created from a url */
|
g_print ("serializing ");
|
||||||
if (!g_object_get_data (G_OBJECT (fontmap), "font-files"))
|
print_font (font);
|
||||||
|
info = g_hash_table_lookup (p->fonts, hb_font_get_face (pango_font_get_hb_font (font)));
|
||||||
|
if (info->serialized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef HAVE_PANGOFT
|
if (info->input)
|
||||||
{
|
face = hb_subset_or_fail (info->face, info->input);
|
||||||
FcPattern *pat;
|
else
|
||||||
FcResult res;
|
face = hb_face_reference (info->face);
|
||||||
const char *file;
|
|
||||||
char *data;
|
|
||||||
gsize len;
|
|
||||||
char *b64;
|
|
||||||
|
|
||||||
pat = pango_fc_font_get_pattern (PANGO_FC_FONT (font));
|
blob = hb_face_reference_blob (face);
|
||||||
res = FcPatternGetString (pat, FC_FILE, 0, (FcChar8 **)&file);
|
data = hb_blob_get_data (blob, &length);
|
||||||
if (res != FcResultMatch)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (g_hash_table_contains (p->serialized_fonts, file))
|
b64 = base64_encode_with_linebreaks ((const guchar *) data, length);
|
||||||
return;
|
|
||||||
|
|
||||||
if (!g_file_get_contents (file, &data, &len, NULL))
|
g_string_append (p->str, " url(\"data:font/ttf;base64,\\\n");
|
||||||
return;
|
append_escaping_newlines (p->str, b64);
|
||||||
|
g_string_append (p->str, "\")");
|
||||||
|
|
||||||
g_hash_table_add (p->serialized_fonts, (gpointer) file);
|
g_free (b64);
|
||||||
|
hb_blob_destroy (blob);
|
||||||
|
hb_face_destroy (face);
|
||||||
|
|
||||||
b64 = base64_encode_with_linebreaks ((const guchar *) data, len);
|
info->serialized = TRUE;
|
||||||
|
|
||||||
g_string_append (p->str, " url(\"data:font/ttf;base64,\\\n");
|
|
||||||
append_escaping_newlines (p->str, b64);
|
|
||||||
g_string_append (p->str, "\")");
|
|
||||||
|
|
||||||
g_free (b64);
|
|
||||||
g_free (data);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -4068,7 +4129,7 @@ render_node_print (Printer *p,
|
|||||||
{
|
{
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
g_string_append_c (p->str, ' ');
|
g_string_append_c (p->str, ' ');
|
||||||
append_rgba (p->str, &colors[i]);
|
gdk_rgba_print (&colors[i], p->str);
|
||||||
}
|
}
|
||||||
g_string_append (p->str, ";\n");
|
g_string_append (p->str, ";\n");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -354,6 +354,8 @@ gsk_stroke_set_miter_limit (GskStroke *self,
|
|||||||
*
|
*
|
||||||
* Returns the miter limit of a `GskStroke`.
|
* Returns the miter limit of a `GskStroke`.
|
||||||
*
|
*
|
||||||
|
* Returns: the miter limit
|
||||||
|
*
|
||||||
* Since: 4.14
|
* Since: 4.14
|
||||||
*/
|
*/
|
||||||
float
|
float
|
||||||
@@ -478,6 +480,8 @@ gsk_stroke_set_dash_offset (GskStroke *self,
|
|||||||
*
|
*
|
||||||
* Returns the dash_offset of a `GskStroke`.
|
* Returns the dash_offset of a `GskStroke`.
|
||||||
*
|
*
|
||||||
|
* Returns: the dash_offset
|
||||||
|
*
|
||||||
* Since: 4.14
|
* Since: 4.14
|
||||||
*/
|
*/
|
||||||
float
|
float
|
||||||
|
|||||||
+1
-1
@@ -2023,7 +2023,7 @@ GskTransformCategory
|
|||||||
return self->category;
|
return self->category;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* gsk_transform_new: (constructor):
|
* gsk_transform_new: (constructor):
|
||||||
*
|
*
|
||||||
* Creates a new identity transform.
|
* Creates a new identity transform.
|
||||||
|
|||||||
@@ -530,6 +530,15 @@ handle_accessible_method (GDBusConnection *connection,
|
|||||||
g_variant_builder_open (&builder, G_VARIANT_TYPE ("a{ss}"));
|
g_variant_builder_open (&builder, G_VARIANT_TYPE ("a{ss}"));
|
||||||
g_variant_builder_add (&builder, "{ss}", "toolkit", "GTK");
|
g_variant_builder_add (&builder, "{ss}", "toolkit", "GTK");
|
||||||
|
|
||||||
|
if (gtk_at_context_has_accessible_property (GTK_AT_CONTEXT (self), GTK_ACCESSIBLE_PROPERTY_LEVEL))
|
||||||
|
{
|
||||||
|
GtkAccessibleValue *value = gtk_at_context_get_accessible_property (GTK_AT_CONTEXT (self),
|
||||||
|
GTK_ACCESSIBLE_PROPERTY_LEVEL);
|
||||||
|
char *level = g_strdup_printf ("%d", gtk_int_accessible_value_get (value));
|
||||||
|
g_variant_builder_add (&builder, "{ss}", "level", level);
|
||||||
|
g_free (level);
|
||||||
|
}
|
||||||
|
|
||||||
if (gtk_at_context_has_accessible_property (GTK_AT_CONTEXT (self), GTK_ACCESSIBLE_PROPERTY_PLACEHOLDER))
|
if (gtk_at_context_has_accessible_property (GTK_AT_CONTEXT (self), GTK_ACCESSIBLE_PROPERTY_PLACEHOLDER))
|
||||||
{
|
{
|
||||||
GtkAccessibleValue *value;
|
GtkAccessibleValue *value;
|
||||||
@@ -1257,10 +1266,13 @@ gtk_at_spi_context_child_change (GtkATContext *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (change & GTK_ACCESSIBLE_CHILD_CHANGE_ADDED)
|
if (change & GTK_ACCESSIBLE_CHILD_CHANGE_ADDED)
|
||||||
|
{
|
||||||
|
gtk_at_context_realize (child_context);
|
||||||
emit_children_changed (self,
|
emit_children_changed (self,
|
||||||
GTK_AT_SPI_CONTEXT (child_context),
|
GTK_AT_SPI_CONTEXT (child_context),
|
||||||
idx,
|
idx,
|
||||||
GTK_ACCESSIBLE_CHILD_STATE_ADDED);
|
GTK_ACCESSIBLE_CHILD_STATE_ADDED);
|
||||||
|
}
|
||||||
else if (change & GTK_ACCESSIBLE_CHILD_CHANGE_REMOVED)
|
else if (change & GTK_ACCESSIBLE_CHILD_CHANGE_REMOVED)
|
||||||
emit_children_changed (self,
|
emit_children_changed (self,
|
||||||
GTK_AT_SPI_CONTEXT (child_context),
|
GTK_AT_SPI_CONTEXT (child_context),
|
||||||
|
|||||||
@@ -21,12 +21,26 @@
|
|||||||
|
|
||||||
#include "gtkcsserror.h"
|
#include "gtkcsserror.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_css_parser_error_quark:
|
||||||
|
*
|
||||||
|
* Registers an error quark for CSS parsing errors.
|
||||||
|
*
|
||||||
|
* Returns: the error quark
|
||||||
|
**/
|
||||||
GQuark
|
GQuark
|
||||||
gtk_css_parser_error_quark (void)
|
gtk_css_parser_error_quark (void)
|
||||||
{
|
{
|
||||||
return g_quark_from_static_string ("gtk-css-parser-error-quark");
|
return g_quark_from_static_string ("gtk-css-parser-error-quark");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_css_parser_warning_quark:
|
||||||
|
*
|
||||||
|
* Registers an error quark for CSS parsing warnings.
|
||||||
|
*
|
||||||
|
* Returns: the warning quark
|
||||||
|
**/
|
||||||
GQuark
|
GQuark
|
||||||
gtk_css_parser_warning_quark (void)
|
gtk_css_parser_warning_quark (void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,6 +27,11 @@ G_BEGIN_DECLS
|
|||||||
|
|
||||||
typedef struct _GtkCssLocation GtkCssLocation;
|
typedef struct _GtkCssLocation GtkCssLocation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkCssLocation:
|
||||||
|
*
|
||||||
|
* A description of a location inside a CSS stream.
|
||||||
|
*/
|
||||||
struct _GtkCssLocation
|
struct _GtkCssLocation
|
||||||
{
|
{
|
||||||
gsize bytes;
|
gsize bytes;
|
||||||
|
|||||||
+60
-27
@@ -26,6 +26,10 @@
|
|||||||
#include "gtkcsserror.h"
|
#include "gtkcsserror.h"
|
||||||
#include "gtkcsslocationprivate.h"
|
#include "gtkcsslocationprivate.h"
|
||||||
|
|
||||||
|
/* We cannot include gtkdebug.h, so we must keep this in sync */
|
||||||
|
extern unsigned int gtk_get_debug_flags (void);
|
||||||
|
#define DEBUG_CHECK_CSS ((gtk_get_debug_flags () & GTK_CSS_PARSER_DEBUG_CSS) != 0)
|
||||||
|
|
||||||
static void clear_ref (GtkCssVariableValueReference *ref);
|
static void clear_ref (GtkCssVariableValueReference *ref);
|
||||||
|
|
||||||
#define GDK_ARRAY_NAME gtk_css_parser_references
|
#define GDK_ARRAY_NAME gtk_css_parser_references
|
||||||
@@ -49,7 +53,7 @@ struct _GtkCssParserBlock
|
|||||||
#define GDK_ARRAY_NAME gtk_css_parser_blocks
|
#define GDK_ARRAY_NAME gtk_css_parser_blocks
|
||||||
#define GDK_ARRAY_TYPE_NAME GtkCssParserBlocks
|
#define GDK_ARRAY_TYPE_NAME GtkCssParserBlocks
|
||||||
#define GDK_ARRAY_ELEMENT_TYPE GtkCssParserBlock
|
#define GDK_ARRAY_ELEMENT_TYPE GtkCssParserBlock
|
||||||
#define GDK_ARRAY_PREALLOC 32
|
#define GDK_ARRAY_PREALLOC 12
|
||||||
#define GDK_ARRAY_NO_MEMSET 1
|
#define GDK_ARRAY_NO_MEMSET 1
|
||||||
#include "gdk/gdkarrayimpl.c"
|
#include "gdk/gdkarrayimpl.c"
|
||||||
|
|
||||||
@@ -626,7 +630,7 @@ void
|
|||||||
gtk_css_parser_skip (GtkCssParser *self)
|
gtk_css_parser_skip (GtkCssParser *self)
|
||||||
{
|
{
|
||||||
const GtkCssToken *token;
|
const GtkCssToken *token;
|
||||||
|
|
||||||
token = gtk_css_parser_get_token (self);
|
token = gtk_css_parser_get_token (self);
|
||||||
if (gtk_css_token_is_preserved (token, NULL))
|
if (gtk_css_token_is_preserved (token, NULL))
|
||||||
{
|
{
|
||||||
@@ -659,7 +663,7 @@ gtk_css_parser_skip_until (GtkCssParser *self,
|
|||||||
GtkCssTokenType token_type)
|
GtkCssTokenType token_type)
|
||||||
{
|
{
|
||||||
const GtkCssToken *token;
|
const GtkCssToken *token;
|
||||||
|
|
||||||
for (token = gtk_css_parser_get_token (self);
|
for (token = gtk_css_parser_get_token (self);
|
||||||
!gtk_css_token_is (token, token_type) &&
|
!gtk_css_token_is (token, token_type) &&
|
||||||
!gtk_css_token_is (token, GTK_CSS_TOKEN_EOF);
|
!gtk_css_token_is (token, GTK_CSS_TOKEN_EOF);
|
||||||
@@ -812,6 +816,29 @@ gtk_css_parser_warn_syntax (GtkCssParser *self,
|
|||||||
va_end (args);
|
va_end (args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gtk_css_parser_warn_deprecated (GtkCssParser *self,
|
||||||
|
const char *format,
|
||||||
|
...)
|
||||||
|
{
|
||||||
|
if (DEBUG_CHECK_CSS)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
GError *error;
|
||||||
|
|
||||||
|
va_start (args, format);
|
||||||
|
error = g_error_new_valist (GTK_CSS_PARSER_WARNING,
|
||||||
|
GTK_CSS_PARSER_WARNING_DEPRECATED,
|
||||||
|
format, args);
|
||||||
|
gtk_css_parser_emit_error (self,
|
||||||
|
gtk_css_parser_get_start_location (self),
|
||||||
|
gtk_css_parser_get_end_location (self),
|
||||||
|
error);
|
||||||
|
g_error_free (error);
|
||||||
|
va_end (args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gtk_css_parser_consume_function (GtkCssParser *self,
|
gtk_css_parser_consume_function (GtkCssParser *self,
|
||||||
guint min_args,
|
guint min_args,
|
||||||
@@ -1133,7 +1160,7 @@ gtk_css_parser_parse_url_arg (GtkCssParser *parser,
|
|||||||
*out_url = gtk_css_parser_consume_string (parser);
|
*out_url = gtk_css_parser_consume_string (parser);
|
||||||
if (*out_url == NULL)
|
if (*out_url == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1179,7 +1206,7 @@ gtk_css_parser_consume_url (GtkCssParser *self)
|
|||||||
gtk_css_parser_error_syntax (self, "Expected a URL");
|
gtk_css_parser_error_syntax (self, "Expected a URL");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1300,6 +1327,9 @@ gtk_css_parser_has_references (GtkCssParser *self)
|
|||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
int inner_blocks = 0, i;
|
int inner_blocks = 0, i;
|
||||||
|
|
||||||
|
/* We don't want gtk_css_parser_ensure_token to expand references on us here */
|
||||||
|
g_assert (self->n_refs == 0);
|
||||||
|
|
||||||
gtk_css_tokenizer_save (tokenizer);
|
gtk_css_tokenizer_save (tokenizer);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
@@ -1315,7 +1345,7 @@ gtk_css_parser_has_references (GtkCssParser *self)
|
|||||||
if (gtk_css_token_is (token, GTK_CSS_TOKEN_CLOSE_PARENS) ||
|
if (gtk_css_token_is (token, GTK_CSS_TOKEN_CLOSE_PARENS) ||
|
||||||
gtk_css_token_is (token, GTK_CSS_TOKEN_CLOSE_SQUARE))
|
gtk_css_token_is (token, GTK_CSS_TOKEN_CLOSE_SQUARE))
|
||||||
{
|
{
|
||||||
goto error;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1338,7 +1368,7 @@ gtk_css_parser_has_references (GtkCssParser *self)
|
|||||||
inner_blocks++;
|
inner_blocks++;
|
||||||
gtk_css_parser_start_block (self);
|
gtk_css_parser_start_block (self);
|
||||||
|
|
||||||
if (!ret && is_var)
|
if (is_var)
|
||||||
{
|
{
|
||||||
token = gtk_css_parser_get_token (self);
|
token = gtk_css_parser_get_token (self);
|
||||||
|
|
||||||
@@ -1346,18 +1376,18 @@ gtk_css_parser_has_references (GtkCssParser *self)
|
|||||||
{
|
{
|
||||||
const char *var_name = gtk_css_token_get_string (token);
|
const char *var_name = gtk_css_token_get_string (token);
|
||||||
|
|
||||||
if (var_name[0] != '-' || var_name[1] != '-')
|
if (strlen (var_name) < 3 || var_name[0] != '-' || var_name[1] != '-')
|
||||||
goto error;
|
goto done;
|
||||||
|
|
||||||
gtk_css_parser_consume_token (self);
|
gtk_css_parser_consume_token (self);
|
||||||
|
|
||||||
if (!gtk_css_parser_has_token (self, GTK_CSS_TOKEN_EOF) &&
|
if (!gtk_css_parser_has_token (self, GTK_CSS_TOKEN_EOF) &&
|
||||||
!gtk_css_parser_has_token (self, GTK_CSS_TOKEN_COMMA))
|
!gtk_css_parser_has_token (self, GTK_CSS_TOKEN_COMMA))
|
||||||
{
|
goto done;
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
|
/* We got our answer. Now get it out as fast as possible! */
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1365,18 +1395,7 @@ gtk_css_parser_has_references (GtkCssParser *self)
|
|||||||
while (!gtk_css_parser_has_token (self, GTK_CSS_TOKEN_SEMICOLON) &&
|
while (!gtk_css_parser_has_token (self, GTK_CSS_TOKEN_SEMICOLON) &&
|
||||||
!gtk_css_parser_has_token (self, GTK_CSS_TOKEN_CLOSE_CURLY));
|
!gtk_css_parser_has_token (self, GTK_CSS_TOKEN_CLOSE_CURLY));
|
||||||
|
|
||||||
if (inner_blocks > 0)
|
done:
|
||||||
goto error;
|
|
||||||
|
|
||||||
g_assert (tokenizer == get_tokenizer (self));
|
|
||||||
|
|
||||||
gtk_css_tokenizer_restore (tokenizer);
|
|
||||||
self->location = *gtk_css_tokenizer_get_location (tokenizer);
|
|
||||||
gtk_css_tokenizer_read_token (tokenizer, &self->token, NULL);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
error:
|
|
||||||
for (i = 0; i < inner_blocks; i++)
|
for (i = 0; i < inner_blocks; i++)
|
||||||
gtk_css_parser_end_block (self);
|
gtk_css_parser_end_block (self);
|
||||||
|
|
||||||
@@ -1386,7 +1405,7 @@ error:
|
|||||||
self->location = *gtk_css_tokenizer_get_location (tokenizer);
|
self->location = *gtk_css_tokenizer_get_location (tokenizer);
|
||||||
gtk_css_tokenizer_read_token (tokenizer, &self->token, NULL);
|
gtk_css_tokenizer_read_token (tokenizer, &self->token, NULL);
|
||||||
|
|
||||||
return FALSE;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1482,9 +1501,9 @@ gtk_css_parser_parse_value_into_token_stream (GtkCssParser *self)
|
|||||||
GtkCssVariableValueReference ref;
|
GtkCssVariableValueReference ref;
|
||||||
char *var_name = g_strdup (gtk_css_token_get_string (token));
|
char *var_name = g_strdup (gtk_css_token_get_string (token));
|
||||||
|
|
||||||
if (var_name[0] != '-' || var_name[1] != '-')
|
if (strlen (var_name) < 3 || var_name[0] != '-' || var_name[1] != '-')
|
||||||
{
|
{
|
||||||
gtk_css_parser_error_value (self, "Invalid variable name: %s", var_name);
|
gtk_css_parser_error_syntax (self, "Invalid variable name: %s", var_name);
|
||||||
g_free (var_name);
|
g_free (var_name);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@@ -1527,6 +1546,20 @@ gtk_css_parser_parse_value_into_token_stream (GtkCssParser *self)
|
|||||||
|
|
||||||
gtk_css_parser_references_append (&refs, &ref);
|
gtk_css_parser_references_append (&refs, &ref);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (gtk_css_token_is (token, GTK_CSS_TOKEN_EOF))
|
||||||
|
{
|
||||||
|
gtk_css_parser_error_syntax (self, "Missing variable name");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char *s = gtk_css_token_to_string (token);
|
||||||
|
gtk_css_parser_error_syntax (self, "Expected a variable name, not %s", s);
|
||||||
|
g_free (s);
|
||||||
|
}
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,6 +120,9 @@ void gtk_css_parser_warn (GtkCssParser
|
|||||||
void gtk_css_parser_warn_syntax (GtkCssParser *self,
|
void gtk_css_parser_warn_syntax (GtkCssParser *self,
|
||||||
const char *format,
|
const char *format,
|
||||||
...) G_GNUC_PRINTF(2, 3);
|
...) G_GNUC_PRINTF(2, 3);
|
||||||
|
void gtk_css_parser_warn_deprecated (GtkCssParser *self,
|
||||||
|
const char *format,
|
||||||
|
...) G_GNUC_PRINTF(2, 3);
|
||||||
|
|
||||||
|
|
||||||
gboolean gtk_css_parser_has_token (GtkCssParser *self,
|
gboolean gtk_css_parser_has_token (GtkCssParser *self,
|
||||||
@@ -169,5 +172,9 @@ void gtk_css_parser_get_expanding_variables (GtkCssParser
|
|||||||
char ***names,
|
char ***names,
|
||||||
gsize *n_variables);
|
gsize *n_variables);
|
||||||
|
|
||||||
|
|
||||||
|
/* We cannot include gtkdebug.h, so we must keep this in sync */
|
||||||
|
#define GTK_CSS_PARSER_DEBUG_CSS (1 << 20)
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|||||||
+27
-1
@@ -53,6 +53,21 @@ gtk_css_section_new (GFile *file,
|
|||||||
return gtk_css_section_new_with_bytes (file, NULL,start, end);
|
return gtk_css_section_new_with_bytes (file, NULL,start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_css_section_new_with_bytes: (constructor)
|
||||||
|
* @file: (nullable) (transfer none): The file this section refers to
|
||||||
|
* @bytes: (nullable) (transfer none): The bytes this sections refers to
|
||||||
|
* @start: The start location
|
||||||
|
* @end: The end location
|
||||||
|
*
|
||||||
|
* Creates a new `GtkCssSection` referring to the section
|
||||||
|
* in the given `file` or the given `bytes` from the `start` location to the
|
||||||
|
* `end` location.
|
||||||
|
*
|
||||||
|
* Returns: (transfer full): a new `GtkCssSection`
|
||||||
|
*
|
||||||
|
* Since: 4.16
|
||||||
|
**/
|
||||||
GtkCssSection *
|
GtkCssSection *
|
||||||
gtk_css_section_new_with_bytes (GFile *file,
|
gtk_css_section_new_with_bytes (GFile *file,
|
||||||
GBytes *bytes,
|
GBytes *bytes,
|
||||||
@@ -165,6 +180,17 @@ gtk_css_section_get_file (const GtkCssSection *section)
|
|||||||
return section->file;
|
return section->file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_css_section_get_bytes:
|
||||||
|
* @section: the section
|
||||||
|
*
|
||||||
|
* Gets the bytes that @section was parsed from.
|
||||||
|
*
|
||||||
|
* Returns: (transfer none) (nullable): the `GBytes` from which the `section`
|
||||||
|
* was parsed
|
||||||
|
*
|
||||||
|
* Since: 4.16
|
||||||
|
**/
|
||||||
GBytes *
|
GBytes *
|
||||||
gtk_css_section_get_bytes (const GtkCssSection *section)
|
gtk_css_section_get_bytes (const GtkCssSection *section)
|
||||||
{
|
{
|
||||||
@@ -242,7 +268,7 @@ gtk_css_section_print (const GtkCssSection *section,
|
|||||||
g_string_append (string, "<data>");
|
g_string_append (string, "<data>");
|
||||||
}
|
}
|
||||||
|
|
||||||
g_string_append_printf (string, ":%zu:%zu",
|
g_string_append_printf (string, ":%zu:%zu",
|
||||||
section->start_location.lines + 1,
|
section->start_location.lines + 1,
|
||||||
section->start_location.line_chars + 1);
|
section->start_location.line_chars + 1);
|
||||||
if (section->start_location.lines != section->end_location.lines ||
|
if (section->start_location.lines != section->end_location.lines ||
|
||||||
|
|||||||
@@ -689,6 +689,11 @@ gtk_cell_renderer_progress_class_init (GtkCellRendererProgressClass *klass)
|
|||||||
PROP_ORIENTATION,
|
PROP_ORIENTATION,
|
||||||
"orientation");
|
"orientation");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkCellRendererProgress:inverted:
|
||||||
|
*
|
||||||
|
* Whether progess is inverted.
|
||||||
|
*/
|
||||||
g_object_class_install_property (object_class,
|
g_object_class_install_property (object_class,
|
||||||
PROP_INVERTED,
|
PROP_INVERTED,
|
||||||
g_param_spec_boolean ("inverted", NULL, NULL,
|
g_param_spec_boolean ("inverted", NULL, NULL,
|
||||||
|
|||||||
@@ -175,7 +175,8 @@ gtk_cell_renderer_spinner_class_init (GtkCellRendererSpinnerClass *klass)
|
|||||||
cell_class->get_preferred_height = gtk_cell_renderer_spinner_get_preferred_height;
|
cell_class->get_preferred_height = gtk_cell_renderer_spinner_get_preferred_height;
|
||||||
cell_class->snapshot = gtk_cell_renderer_spinner_snapshot;
|
cell_class->snapshot = gtk_cell_renderer_spinner_snapshot;
|
||||||
|
|
||||||
/* GtkCellRendererSpinner:active:
|
/**
|
||||||
|
* GtkCellRendererSpinner:active:
|
||||||
*
|
*
|
||||||
* Whether the spinner is active (ie. shown) in the cell
|
* Whether the spinner is active (ie. shown) in the cell
|
||||||
*/
|
*/
|
||||||
@@ -253,7 +254,7 @@ gtk_cell_renderer_spinner_update_size (GtkCellRendererSpinner *cell,
|
|||||||
node = gtk_style_context_get_node (context);
|
node = gtk_style_context_get_node (context);
|
||||||
gtk_icon_size_set_style_classes (node, priv->icon_size);
|
gtk_icon_size_set_style_classes (node, priv->icon_size);
|
||||||
style = gtk_css_node_get_style (node);
|
style = gtk_css_node_get_style (node);
|
||||||
priv->size = _gtk_css_number_value_get (style->icon->icon_size, 100);
|
priv->size = gtk_css_number_value_get (style->icon->icon_size, 100);
|
||||||
|
|
||||||
gtk_style_context_restore (context);
|
gtk_style_context_restore (context);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -370,7 +370,7 @@ static int
|
|||||||
calc_indicator_size (GtkStyleContext *context)
|
calc_indicator_size (GtkStyleContext *context)
|
||||||
{
|
{
|
||||||
GtkCssStyle *style = gtk_style_context_lookup_style (context);
|
GtkCssStyle *style = gtk_style_context_lookup_style (context);
|
||||||
return _gtk_css_number_value_get (style->icon->icon_size, 100);
|
return gtk_css_number_value_get (style->icon->icon_size, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -512,6 +512,8 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass)
|
|||||||
* This is an [keybinding signal](class.SignalAction.html).
|
* This is an [keybinding signal](class.SignalAction.html).
|
||||||
*
|
*
|
||||||
* The default bindings for this signal are Alt+Up and Escape.
|
* The default bindings for this signal are Alt+Up and Escape.
|
||||||
|
*
|
||||||
|
* Returns: whether the combo box was popped down
|
||||||
*/
|
*/
|
||||||
combo_box_signals[POPDOWN] =
|
combo_box_signals[POPDOWN] =
|
||||||
g_signal_new_class_handler (I_("popdown"),
|
g_signal_new_class_handler (I_("popdown"),
|
||||||
|
|||||||
@@ -297,11 +297,21 @@ gtk_entry_completion_class_init (GtkEntryCompletionClass *klass)
|
|||||||
NULL,
|
NULL,
|
||||||
G_TYPE_NONE, 0);
|
G_TYPE_NONE, 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkEntryCompletion:model:
|
||||||
|
*
|
||||||
|
* The model used as data source.
|
||||||
|
*/
|
||||||
entry_completion_props[PROP_MODEL] =
|
entry_completion_props[PROP_MODEL] =
|
||||||
g_param_spec_object ("model", NULL, NULL,
|
g_param_spec_object ("model", NULL, NULL,
|
||||||
GTK_TYPE_TREE_MODEL,
|
GTK_TYPE_TREE_MODEL,
|
||||||
GTK_PARAM_READWRITE);
|
GTK_PARAM_READWRITE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkEntryCompletion:minimum-key-length:
|
||||||
|
*
|
||||||
|
* The minimum key length as set for completion.
|
||||||
|
*/
|
||||||
entry_completion_props[PROP_MINIMUM_KEY_LENGTH] =
|
entry_completion_props[PROP_MINIMUM_KEY_LENGTH] =
|
||||||
g_param_spec_int ("minimum-key-length", NULL, NULL,
|
g_param_spec_int ("minimum-key-length", NULL, NULL,
|
||||||
0, G_MAXINT, 1,
|
0, G_MAXINT, 1,
|
||||||
|
|||||||
@@ -410,6 +410,11 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
|
|||||||
-1, G_MAXINT, -1,
|
-1, G_MAXINT, -1,
|
||||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkIconView:model:
|
||||||
|
*
|
||||||
|
* The model of the icon view.
|
||||||
|
*/
|
||||||
g_object_class_install_property (gobject_class,
|
g_object_class_install_property (gobject_class,
|
||||||
PROP_MODEL,
|
PROP_MODEL,
|
||||||
g_param_spec_object ("model", NULL, NULL,
|
g_param_spec_object ("model", NULL, NULL,
|
||||||
@@ -516,6 +521,12 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
|
|||||||
FALSE,
|
FALSE,
|
||||||
G_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
G_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkIconView:tooltip-column:
|
||||||
|
*
|
||||||
|
* The column of the icon view model which is being used for displaying
|
||||||
|
* tooltips on it's rows.
|
||||||
|
*/
|
||||||
g_object_class_install_property (gobject_class,
|
g_object_class_install_property (gobject_class,
|
||||||
PROP_TOOLTIP_COLUMN,
|
PROP_TOOLTIP_COLUMN,
|
||||||
g_param_spec_int ("tooltip-column", NULL, NULL,
|
g_param_spec_int ("tooltip-column", NULL, NULL,
|
||||||
@@ -712,6 +723,8 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
|
|||||||
* programmatically.
|
* programmatically.
|
||||||
*
|
*
|
||||||
* The default bindings for this signal are Space, Return and Enter.
|
* The default bindings for this signal are Space, Return and Enter.
|
||||||
|
*
|
||||||
|
* Returns: whether the item was activated
|
||||||
*/
|
*/
|
||||||
icon_view_signals[ACTIVATE_CURSOR_ITEM] =
|
icon_view_signals[ACTIVATE_CURSOR_ITEM] =
|
||||||
g_signal_new (I_("activate-cursor-item"),
|
g_signal_new (I_("activate-cursor-item"),
|
||||||
@@ -747,6 +760,8 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
|
|||||||
* - PageUp/PageDown which move by "pages"
|
* - PageUp/PageDown which move by "pages"
|
||||||
* All of these will extend the selection when combined with
|
* All of these will extend the selection when combined with
|
||||||
* the Shift modifier.
|
* the Shift modifier.
|
||||||
|
*
|
||||||
|
* Returns: whether the cursor was moved
|
||||||
*/
|
*/
|
||||||
icon_view_signals[MOVE_CURSOR] =
|
icon_view_signals[MOVE_CURSOR] =
|
||||||
g_signal_new (I_("move-cursor"),
|
g_signal_new (I_("move-cursor"),
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ struct _GtkMessageDialog
|
|||||||
*
|
*
|
||||||
* > Please note that %GTK_BUTTONS_OK, %GTK_BUTTONS_YES_NO
|
* > Please note that %GTK_BUTTONS_OK, %GTK_BUTTONS_YES_NO
|
||||||
* > and %GTK_BUTTONS_OK_CANCEL are discouraged by the
|
* > and %GTK_BUTTONS_OK_CANCEL are discouraged by the
|
||||||
* > [GNOME Human Interface Guidelines](http://library.gnome.org/devel/hig-book/stable/).
|
* > [GNOME Human Interface Guidelines](https://developer.gnome.org/hig/).
|
||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -99,7 +99,6 @@ window_handle_exported (GtkWindow *window,
|
|||||||
* a given uri.
|
* a given uri.
|
||||||
*
|
*
|
||||||
* The @callback will be called when the launch is completed.
|
* The @callback will be called when the launch is completed.
|
||||||
* It should call gtk_show_uri_full_finish() to obtain the result.
|
|
||||||
*
|
*
|
||||||
* This is the recommended call to be used as it passes information
|
* This is the recommended call to be used as it passes information
|
||||||
* necessary for sandbox helpers to parent their dialogs properly.
|
* necessary for sandbox helpers to parent their dialogs properly.
|
||||||
@@ -153,8 +152,8 @@ gtk_show_uri_full (GtkWindow *parent,
|
|||||||
* Returns: %TRUE if the URI was shown successfully.
|
* Returns: %TRUE if the URI was shown successfully.
|
||||||
* Otherwise, %FALSE is returned and @error is set
|
* Otherwise, %FALSE is returned and @error is set
|
||||||
*
|
*
|
||||||
* Deprecated: 4.10: Use [method@Gtk.FileLauncher.launch_finish] or
|
* Deprecated: 4.10: Use [method@Gtk.FileLauncher.launch] or
|
||||||
* [method@Gtk.UriLauncher.launch_finish] instead
|
* [method@Gtk.UriLauncher.launch] instead
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
gtk_show_uri_full_finish (GtkWindow *parent,
|
gtk_show_uri_full_finish (GtkWindow *parent,
|
||||||
|
|||||||
@@ -122,6 +122,11 @@ gtk_style_context_class_init (GtkStyleContextClass *klass)
|
|||||||
object_class->set_property = gtk_style_context_impl_set_property;
|
object_class->set_property = gtk_style_context_impl_set_property;
|
||||||
object_class->get_property = gtk_style_context_impl_get_property;
|
object_class->get_property = gtk_style_context_impl_get_property;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkStyleContext:display:
|
||||||
|
*
|
||||||
|
* The display of the style context.
|
||||||
|
*/
|
||||||
properties[PROP_DISPLAY] =
|
properties[PROP_DISPLAY] =
|
||||||
g_param_spec_object ("display", NULL, NULL,
|
g_param_spec_object ("display", NULL, NULL,
|
||||||
GDK_TYPE_DISPLAY,
|
GDK_TYPE_DISPLAY,
|
||||||
@@ -773,20 +778,27 @@ gtk_style_context_resolve_color (GtkStyleContext *context,
|
|||||||
{
|
{
|
||||||
GtkStyleContextPrivate *priv = gtk_style_context_get_instance_private (context);
|
GtkStyleContextPrivate *priv = gtk_style_context_get_instance_private (context);
|
||||||
GtkCssValue *val;
|
GtkCssValue *val;
|
||||||
|
GtkCssComputeContext ctx = { NULL, };
|
||||||
|
|
||||||
g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), FALSE);
|
g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), FALSE);
|
||||||
g_return_val_if_fail (color != NULL, FALSE);
|
g_return_val_if_fail (color != NULL, FALSE);
|
||||||
g_return_val_if_fail (result != NULL, FALSE);
|
g_return_val_if_fail (result != NULL, FALSE);
|
||||||
|
|
||||||
val = _gtk_css_color_value_resolve (color,
|
ctx.provider = GTK_STYLE_PROVIDER (priv->cascade);
|
||||||
GTK_STYLE_PROVIDER (priv->cascade),
|
ctx.style = gtk_css_node_get_style (priv->cssnode);
|
||||||
_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR),
|
if (gtk_css_node_get_parent (priv->cssnode))
|
||||||
NULL);
|
ctx.parent_style = gtk_css_node_get_style (gtk_css_node_get_parent (priv->cssnode));
|
||||||
|
|
||||||
|
val = gtk_css_color_value_resolve (color,
|
||||||
|
GTK_CSS_PROPERTY_COLOR,
|
||||||
|
&ctx,
|
||||||
|
_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR));
|
||||||
|
|
||||||
if (val == NULL)
|
if (val == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
*result = *gtk_css_color_value_get_rgba (val);
|
*result = *gtk_css_color_value_get_rgba (val);
|
||||||
_gtk_css_value_unref (val);
|
gtk_css_value_unref (val);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -860,10 +872,10 @@ gtk_style_context_get_border (GtkStyleContext *context,
|
|||||||
|
|
||||||
style = gtk_style_context_lookup_style (context);
|
style = gtk_style_context_lookup_style (context);
|
||||||
|
|
||||||
border->top = round (_gtk_css_number_value_get (style->border->border_top_width, 100));
|
border->top = round (gtk_css_number_value_get (style->border->border_top_width, 100));
|
||||||
border->right = round (_gtk_css_number_value_get (style->border->border_right_width, 100));
|
border->right = round (gtk_css_number_value_get (style->border->border_right_width, 100));
|
||||||
border->bottom = round (_gtk_css_number_value_get (style->border->border_bottom_width, 100));
|
border->bottom = round (gtk_css_number_value_get (style->border->border_bottom_width, 100));
|
||||||
border->left = round (_gtk_css_number_value_get (style->border->border_left_width, 100));
|
border->left = round (gtk_css_number_value_get (style->border->border_left_width, 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -886,10 +898,10 @@ gtk_style_context_get_padding (GtkStyleContext *context,
|
|||||||
|
|
||||||
style = gtk_style_context_lookup_style (context);
|
style = gtk_style_context_lookup_style (context);
|
||||||
|
|
||||||
padding->top = round (_gtk_css_number_value_get (style->size->padding_top, 100));
|
padding->top = round (gtk_css_number_value_get (style->size->padding_top, 100));
|
||||||
padding->right = round (_gtk_css_number_value_get (style->size->padding_right, 100));
|
padding->right = round (gtk_css_number_value_get (style->size->padding_right, 100));
|
||||||
padding->bottom = round (_gtk_css_number_value_get (style->size->padding_bottom, 100));
|
padding->bottom = round (gtk_css_number_value_get (style->size->padding_bottom, 100));
|
||||||
padding->left = round (_gtk_css_number_value_get (style->size->padding_left, 100));
|
padding->left = round (gtk_css_number_value_get (style->size->padding_left, 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -912,10 +924,10 @@ gtk_style_context_get_margin (GtkStyleContext *context,
|
|||||||
|
|
||||||
style = gtk_style_context_lookup_style (context);
|
style = gtk_style_context_lookup_style (context);
|
||||||
|
|
||||||
margin->top = round (_gtk_css_number_value_get (style->size->margin_top, 100));
|
margin->top = round (gtk_css_number_value_get (style->size->margin_top, 100));
|
||||||
margin->right = round (_gtk_css_number_value_get (style->size->margin_right, 100));
|
margin->right = round (gtk_css_number_value_get (style->size->margin_right, 100));
|
||||||
margin->bottom = round (_gtk_css_number_value_get (style->size->margin_bottom, 100));
|
margin->bottom = round (gtk_css_number_value_get (style->size->margin_bottom, 100));
|
||||||
margin->left = round (_gtk_css_number_value_get (style->size->margin_left, 100));
|
margin->left = round (gtk_css_number_value_get (style->size->margin_left, 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -527,12 +527,22 @@ gtk_tree_model_filter_class_init (GtkTreeModelFilterClass *filter_class)
|
|||||||
filter_class->visible = gtk_tree_model_filter_real_visible;
|
filter_class->visible = gtk_tree_model_filter_real_visible;
|
||||||
filter_class->modify = gtk_tree_model_filter_real_modify;
|
filter_class->modify = gtk_tree_model_filter_real_modify;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkTreeModelFilter:child-model:
|
||||||
|
*
|
||||||
|
* The child model of the tree model filter.
|
||||||
|
*/
|
||||||
g_object_class_install_property (object_class,
|
g_object_class_install_property (object_class,
|
||||||
PROP_CHILD_MODEL,
|
PROP_CHILD_MODEL,
|
||||||
g_param_spec_object ("child-model", NULL, NULL,
|
g_param_spec_object ("child-model", NULL, NULL,
|
||||||
GTK_TYPE_TREE_MODEL,
|
GTK_TYPE_TREE_MODEL,
|
||||||
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkTreeModelFilter:virtual-root:
|
||||||
|
*
|
||||||
|
* The virtual root of the tree model filter.
|
||||||
|
*/
|
||||||
g_object_class_install_property (object_class,
|
g_object_class_install_property (object_class,
|
||||||
PROP_VIRTUAL_ROOT,
|
PROP_VIRTUAL_ROOT,
|
||||||
g_param_spec_boxed ("virtual-root", NULL, NULL,
|
g_param_spec_boxed ("virtual-root", NULL, NULL,
|
||||||
|
|||||||
@@ -479,6 +479,12 @@ gtk_tree_model_sort_class_init (GtkTreeModelSortClass *class)
|
|||||||
object_class->finalize = gtk_tree_model_sort_finalize;
|
object_class->finalize = gtk_tree_model_sort_finalize;
|
||||||
|
|
||||||
/* Properties */
|
/* Properties */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkTreeModelSort:model:
|
||||||
|
*
|
||||||
|
* The model of the tree model sort.
|
||||||
|
*/
|
||||||
g_object_class_install_property (object_class,
|
g_object_class_install_property (object_class,
|
||||||
PROP_MODEL,
|
PROP_MODEL,
|
||||||
g_param_spec_object ("model", NULL, NULL,
|
g_param_spec_object ("model", NULL, NULL,
|
||||||
|
|||||||
@@ -2691,8 +2691,8 @@ gtk_tree_view_get_expander_size (GtkTreeView *tree_view)
|
|||||||
gtk_style_context_add_class (context, "expander");
|
gtk_style_context_add_class (context, "expander");
|
||||||
|
|
||||||
style = gtk_style_context_lookup_style (context);
|
style = gtk_style_context_lookup_style (context);
|
||||||
min_width = _gtk_css_number_value_get (style->size->min_width, 100);
|
min_width = gtk_css_number_value_get (style->size->min_width, 100);
|
||||||
min_height = _gtk_css_number_value_get (style->size->min_height, 100);
|
min_height = gtk_css_number_value_get (style->size->min_height, 100);
|
||||||
|
|
||||||
gtk_style_context_restore (context);
|
gtk_style_context_restore (context);
|
||||||
|
|
||||||
@@ -5521,7 +5521,7 @@ get_separator_height (GtkTreeView *tree_view)
|
|||||||
gtk_style_context_add_class (context, "separator");
|
gtk_style_context_add_class (context, "separator");
|
||||||
|
|
||||||
style = gtk_style_context_lookup_style (context);
|
style = gtk_style_context_lookup_style (context);
|
||||||
d = _gtk_css_number_value_get (style->size->min_height, 100);
|
d = gtk_css_number_value_get (style->size->min_height, 100);
|
||||||
|
|
||||||
if (d < 1)
|
if (d < 1)
|
||||||
min_size = ceil (d);
|
min_size = ceil (d);
|
||||||
|
|||||||
@@ -1129,7 +1129,7 @@ gtk_about_dialog_set_copyright (GtkAboutDialog *about,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_about_dialog_get_comments: (attributes org.gtk.Method.set_property=comments)
|
* gtk_about_dialog_get_comments: (attributes org.gtk.Method.get_property=comments)
|
||||||
* @about: a `GtkAboutDialog`
|
* @about: a `GtkAboutDialog`
|
||||||
*
|
*
|
||||||
* Returns the comments string.
|
* Returns the comments string.
|
||||||
|
|||||||
@@ -505,6 +505,8 @@ out:
|
|||||||
*
|
*
|
||||||
* If the parse operation fails, @accelerator_key and @accelerator_mods will
|
* If the parse operation fails, @accelerator_key and @accelerator_mods will
|
||||||
* be set to 0 (zero).
|
* be set to 0 (zero).
|
||||||
|
*
|
||||||
|
* Returns: whether parsing succeeded
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
gtk_accelerator_parse (const char *accelerator,
|
gtk_accelerator_parse (const char *accelerator,
|
||||||
|
|||||||
@@ -56,10 +56,21 @@ G_DEFINE_INTERFACE (GtkActionable, gtk_actionable, GTK_TYPE_WIDGET)
|
|||||||
static void
|
static void
|
||||||
gtk_actionable_default_init (GtkActionableInterface *iface)
|
gtk_actionable_default_init (GtkActionableInterface *iface)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkActionable:action-name:
|
||||||
|
*
|
||||||
|
* The name of the action with which this widget should be associated.
|
||||||
|
*/
|
||||||
g_object_interface_install_property (iface,
|
g_object_interface_install_property (iface,
|
||||||
g_param_spec_string ("action-name", NULL, NULL,
|
g_param_spec_string ("action-name", NULL, NULL,
|
||||||
NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkActionable:action-target:
|
||||||
|
*
|
||||||
|
* The target value of the actionable widget's action.
|
||||||
|
*/
|
||||||
g_object_interface_install_property (iface,
|
g_object_interface_install_property (iface,
|
||||||
g_param_spec_variant ("action-target", NULL, NULL,
|
g_param_spec_variant ("action-target", NULL, NULL,
|
||||||
G_VARIANT_TYPE_ANY, NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
G_VARIANT_TYPE_ANY, NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|||||||
@@ -33,8 +33,7 @@
|
|||||||
* are needed to present a message to the user.
|
* are needed to present a message to the user.
|
||||||
*
|
*
|
||||||
* The message is shown with the [method@Gtk.AlertDialog.choose]
|
* The message is shown with the [method@Gtk.AlertDialog.choose]
|
||||||
* function. This API follows the GIO async pattern, and the result can
|
* function.
|
||||||
* be obtained by calling [method@Gtk.AlertDialog.choose_finish].
|
|
||||||
*
|
*
|
||||||
* If you don't need to wait for a button to be clicked, you can use
|
* If you don't need to wait for a button to be clicked, you can use
|
||||||
* [method@Gtk.AlertDialog.show].
|
* [method@Gtk.AlertDialog.show].
|
||||||
@@ -687,10 +686,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS
|
|||||||
*
|
*
|
||||||
* This function shows the alert to the user.
|
* This function shows the alert to the user.
|
||||||
*
|
*
|
||||||
* The @callback will be called when the alert is dismissed.
|
|
||||||
* It should call [method@Gtk.AlertDialog.choose_finish]
|
|
||||||
* to obtain the result.
|
|
||||||
*
|
|
||||||
* It is ok to pass `NULL` for the callback if the alert
|
* It is ok to pass `NULL` for the callback if the alert
|
||||||
* does not have more than one button. A simpler API for
|
* does not have more than one button. A simpler API for
|
||||||
* this case is [method@Gtk.AlertDialog.show].
|
* this case is [method@Gtk.AlertDialog.show].
|
||||||
|
|||||||
@@ -76,13 +76,19 @@ G_DEFINE_TYPE (GtkApplicationImplQuartz, gtk_application_impl_quartz, GTK_TYPE_A
|
|||||||
|
|
||||||
-(NSApplicationTerminateReply) applicationShouldTerminate:(NSApplication *)sender
|
-(NSApplicationTerminateReply) applicationShouldTerminate:(NSApplication *)sender
|
||||||
{
|
{
|
||||||
/* We have no way to give our message other than to pop up a dialog
|
const gchar *quit_action_name = "quit";
|
||||||
* ourselves, which we should not do since the OS will already show
|
GActionGroup *action_group = G_ACTION_GROUP (quartz->impl.application);
|
||||||
* one when we return NSTerminateNow.
|
|
||||||
*
|
if (quartz->quit_inhibit != 0)
|
||||||
* Just let the OS show the generic message...
|
return NSTerminateCancel;
|
||||||
*/
|
|
||||||
return quartz->quit_inhibit == 0 ? NSTerminateNow : NSTerminateCancel;
|
if (g_action_group_has_action (action_group, quit_action_name))
|
||||||
|
{
|
||||||
|
g_action_group_activate_action (action_group, quit_action_name, NULL);
|
||||||
|
return NSTerminateCancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NSTerminateNow;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)application:(NSApplication *)theApplication openFiles:(NSArray *)filenames
|
-(void)application:(NSApplication *)theApplication openFiles:(NSArray *)filenames
|
||||||
|
|||||||
@@ -2953,6 +2953,13 @@ gtk_builder_get_type_from_name (GtkBuilder *builder,
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_builder_error_quark:
|
||||||
|
*
|
||||||
|
* Registers an error quark for [class@Gtk.Builder] errors.
|
||||||
|
*
|
||||||
|
* Returns: the error quark
|
||||||
|
**/
|
||||||
GQuark
|
GQuark
|
||||||
gtk_builder_error_quark (void)
|
gtk_builder_error_quark (void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -434,11 +434,10 @@ gtk_builder_cscope_new (void)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_builder_cscope_add_callback:
|
* gtk_builder_cscope_add_callback:
|
||||||
* @self: a `GtkBuilderCScope`
|
* @scope: a `GtkBuilderCScope`
|
||||||
* @callback_symbols: (scope async): The callback pointer
|
* @callback: (scope async): The callback pointer
|
||||||
*
|
*
|
||||||
* Adds the @callback_symbol to the scope of @builder under its
|
* Adds the @callback to the scope of @builder under its own name.
|
||||||
* own name.
|
|
||||||
*
|
*
|
||||||
* This is a convenience wrapper of [method@Gtk.BuilderCScope.add_callback_symbol].
|
* This is a convenience wrapper of [method@Gtk.BuilderCScope.add_callback_symbol].
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ gtk_builtin_icon_measure (GtkWidget *widget,
|
|||||||
|
|
||||||
style = gtk_css_node_get_style (gtk_widget_get_css_node (widget));
|
style = gtk_css_node_get_style (gtk_widget_get_css_node (widget));
|
||||||
|
|
||||||
*minimum = *natural = _gtk_css_number_value_get (style->icon->icon_size, 100);
|
*minimum = *natural = gtk_css_number_value_get (style->icon->icon_size, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -232,6 +232,14 @@ gtk_color_chooser_dialog_class_init (GtkColorChooserDialogClass *class)
|
|||||||
|
|
||||||
g_object_class_override_property (object_class, PROP_RGBA, "rgba");
|
g_object_class_override_property (object_class, PROP_RGBA, "rgba");
|
||||||
g_object_class_override_property (object_class, PROP_USE_ALPHA, "use-alpha");
|
g_object_class_override_property (object_class, PROP_USE_ALPHA, "use-alpha");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkColorChooserDialog:show-editor:
|
||||||
|
*
|
||||||
|
* Whether the color chooser dialog is showing the single-color editor.
|
||||||
|
*
|
||||||
|
* It can be set to switch the color chooser into single-color editing mode.
|
||||||
|
*/
|
||||||
g_object_class_install_property (object_class, PROP_SHOW_EDITOR,
|
g_object_class_install_property (object_class, PROP_SHOW_EDITOR,
|
||||||
g_param_spec_boolean ("show-editor", NULL, NULL,
|
g_param_spec_boolean ("show-editor", NULL, NULL,
|
||||||
FALSE, GTK_PARAM_READWRITE));
|
FALSE, GTK_PARAM_READWRITE));
|
||||||
|
|||||||
@@ -36,9 +36,7 @@
|
|||||||
* should be modal.
|
* should be modal.
|
||||||
*
|
*
|
||||||
* The dialog is shown with the [method@Gtk.ColorDialog.choose_rgba]
|
* The dialog is shown with the [method@Gtk.ColorDialog.choose_rgba]
|
||||||
* function. This API follows the GIO async pattern, and the
|
* function.
|
||||||
* result can be obtained by calling
|
|
||||||
* [method@Gtk.ColorDialog.choose_rgba_finish].
|
|
||||||
*
|
*
|
||||||
* See [class@Gtk.ColorDialogButton] for a convenient control
|
* See [class@Gtk.ColorDialogButton] for a convenient control
|
||||||
* that uses `GtkColorDialog` and presents the results.
|
* that uses `GtkColorDialog` and presents the results.
|
||||||
@@ -436,10 +434,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS
|
|||||||
* This function initiates a color choice operation by
|
* This function initiates a color choice operation by
|
||||||
* presenting a color chooser dialog to the user.
|
* presenting a color chooser dialog to the user.
|
||||||
*
|
*
|
||||||
* The @callback will be called when the dialog is dismissed.
|
|
||||||
* It should call [method@Gtk.ColorDialog.choose_rgba_finish]
|
|
||||||
* to obtain the result.
|
|
||||||
*
|
|
||||||
* Since: 4.10
|
* Since: 4.10
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
|
|||||||
+198
-1
@@ -32,7 +32,9 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "gtkcolorutils.h"
|
#include "gtkcolorutilsprivate.h"
|
||||||
|
#include "gdkhslaprivate.h"
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
/* Converts from RGB to HSV */
|
/* Converts from RGB to HSV */
|
||||||
static void
|
static void
|
||||||
@@ -226,3 +228,198 @@ gtk_rgb_to_hsv (float r, float g, float b,
|
|||||||
if (v)
|
if (v)
|
||||||
*v = b;
|
*v = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gtk_rgb_to_hsl (float red, float green, float blue,
|
||||||
|
float *hue, float *saturation, float *lightness)
|
||||||
|
{
|
||||||
|
GdkHSLA hsla;
|
||||||
|
|
||||||
|
_gdk_hsla_init_from_rgba (&hsla, &(GdkRGBA) { red, green, blue, 1.0 });
|
||||||
|
|
||||||
|
*hue = hsla.hue;
|
||||||
|
*saturation = hsla.saturation;
|
||||||
|
*lightness = hsla.lightness;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gtk_hsl_to_rgb (float hue, float saturation, float lightness,
|
||||||
|
float *red, float *green, float *blue)
|
||||||
|
{
|
||||||
|
GdkRGBA rgba;
|
||||||
|
|
||||||
|
_gdk_rgba_init_from_hsla (&rgba, &(GdkHSLA) { hue, saturation, lightness, 1.0 });
|
||||||
|
|
||||||
|
*red = rgba.red;
|
||||||
|
*green = rgba.green;
|
||||||
|
*blue = rgba.blue;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gtk_rgb_to_hwb (float red, float green, float blue,
|
||||||
|
float *hue, float *white, float *black)
|
||||||
|
{
|
||||||
|
GdkRGBA rgba = (GdkRGBA) { red, green, blue, 1 };
|
||||||
|
GdkHSLA hsla;
|
||||||
|
|
||||||
|
_gdk_hsla_init_from_rgba (&hsla, &rgba);
|
||||||
|
|
||||||
|
*hue = hsla.hue;
|
||||||
|
*white = MIN (MIN (red, green), blue);
|
||||||
|
*black = (1 - MAX (MAX (red, green), blue));
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gtk_hwb_to_rgb (float hue, float white, float black,
|
||||||
|
float *red, float *green, float *blue)
|
||||||
|
{
|
||||||
|
GdkHSLA hsla;
|
||||||
|
GdkRGBA rgba;
|
||||||
|
|
||||||
|
if (white + black >= 1)
|
||||||
|
{
|
||||||
|
float gray = white / (white + black);
|
||||||
|
|
||||||
|
*red = gray;
|
||||||
|
*green = gray;
|
||||||
|
*blue = gray;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
hsla.hue = hue;
|
||||||
|
hsla.saturation = 1.0;
|
||||||
|
hsla.lightness = 0.5;
|
||||||
|
|
||||||
|
_gdk_rgba_init_from_hsla (&rgba, &hsla);
|
||||||
|
|
||||||
|
*red = rgba.red * (1 - white - black) + white;
|
||||||
|
*green = rgba.green * (1 - white - black) + white;
|
||||||
|
*blue = rgba.blue * (1 - white - black) + white;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define DEG_TO_RAD(x) ((x) * G_PI / 180)
|
||||||
|
#define RAD_TO_DEG(x) ((x) * 180 / G_PI)
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
_sincosf (float angle,
|
||||||
|
float *out_s,
|
||||||
|
float *out_c)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_SINCOSF
|
||||||
|
sincosf (angle, out_s, out_c);
|
||||||
|
#else
|
||||||
|
*out_s = sinf (angle);
|
||||||
|
*out_c = cosf (angle);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gtk_oklab_to_oklch (float L, float a, float b,
|
||||||
|
float *L2, float *C, float *H)
|
||||||
|
{
|
||||||
|
*L2 = L;
|
||||||
|
*C = hypotf (a, b);
|
||||||
|
*H = RAD_TO_DEG (atan2 (b, a));
|
||||||
|
*H = fmod (*H, 360);
|
||||||
|
if (*H < 0)
|
||||||
|
*H += 360;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gtk_oklch_to_oklab (float L, float C, float H,
|
||||||
|
float *L2, float *a, float *b)
|
||||||
|
{
|
||||||
|
*L2 = L;
|
||||||
|
_sincosf (DEG_TO_RAD (H), b, a);
|
||||||
|
*a *= C;
|
||||||
|
*b *= C;
|
||||||
|
}
|
||||||
|
|
||||||
|
static float
|
||||||
|
apply_gamma (float v)
|
||||||
|
{
|
||||||
|
if (v > 0.0031308)
|
||||||
|
return 1.055 * pow (v, 1/2.4) - 0.055;
|
||||||
|
else
|
||||||
|
return 12.92 * v;
|
||||||
|
}
|
||||||
|
|
||||||
|
static float
|
||||||
|
unapply_gamma (float v)
|
||||||
|
{
|
||||||
|
if (v >= 0.04045)
|
||||||
|
return pow (((v + 0.055)/(1 + 0.055)), 2.4);
|
||||||
|
else
|
||||||
|
return v / 12.92;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gtk_oklab_to_linear_srgb (float L, float a, float b,
|
||||||
|
float *red, float *green, float *blue)
|
||||||
|
{
|
||||||
|
float l = L + 0.3963377774f * a + 0.2158037573f * b;
|
||||||
|
float m = L - 0.1055613458f * a - 0.0638541728f * b;
|
||||||
|
float s = L - 0.0894841775f * a - 1.2914855480f * b;
|
||||||
|
|
||||||
|
l = powf (l, 3);
|
||||||
|
m = powf (m, 3);
|
||||||
|
s = powf (s, 3);
|
||||||
|
|
||||||
|
*red = +4.0767416621f * l - 3.3077115913f * m + 0.2309699292f * s;
|
||||||
|
*green = -1.2684380046f * l + 2.6097574011f * m - 0.3413193965f * s;
|
||||||
|
*blue = -0.0041960863f * l - 0.7034186147f * m + 1.7076147010f * s;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gtk_oklab_to_rgb (float L, float a, float b,
|
||||||
|
float *red, float *green, float *blue)
|
||||||
|
{
|
||||||
|
float linear_red, linear_green, linear_blue;
|
||||||
|
gtk_oklab_to_linear_srgb (L, a, b, &linear_red, &linear_green, &linear_blue);
|
||||||
|
gtk_linear_srgb_to_rgb (linear_red, linear_green, linear_blue, red, green, blue);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gtk_linear_srgb_to_oklab (float red, float green, float blue,
|
||||||
|
float *L, float *a, float *b)
|
||||||
|
{
|
||||||
|
float l = 0.4122214708f * red + 0.5363325363f * green + 0.0514459929f * blue;
|
||||||
|
float m = 0.2119034982f * red + 0.6806995451f * green + 0.1073969566f * blue;
|
||||||
|
float s = 0.0883024619f * red + 0.2817188376f * green + 0.6299787005f * blue;
|
||||||
|
|
||||||
|
l = cbrtf (l);
|
||||||
|
m = cbrtf (m);
|
||||||
|
s = cbrtf (s);
|
||||||
|
|
||||||
|
*L = 0.2104542553f*l + 0.7936177850f*m - 0.0040720468f*s;
|
||||||
|
*a = 1.9779984951f*l - 2.4285922050f*m + 0.4505937099f*s;
|
||||||
|
*b = 0.0259040371f*l + 0.7827717662f*m - 0.8086757660f*s;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gtk_rgb_to_oklab (float red, float green, float blue,
|
||||||
|
float *L, float *a, float *b)
|
||||||
|
{
|
||||||
|
float linear_red, linear_green, linear_blue;
|
||||||
|
gtk_rgb_to_linear_srgb (red, green, blue, &linear_red, &linear_green, &linear_blue);
|
||||||
|
gtk_linear_srgb_to_oklab (linear_red, linear_green, linear_blue, L, a, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gtk_rgb_to_linear_srgb (float red, float green, float blue,
|
||||||
|
float *linear_red, float *linear_green, float *linear_blue)
|
||||||
|
{
|
||||||
|
*linear_red = unapply_gamma (red);
|
||||||
|
*linear_green = unapply_gamma (green);
|
||||||
|
*linear_blue = unapply_gamma (blue);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gtk_linear_srgb_to_rgb (float linear_red, float linear_green, float linear_blue,
|
||||||
|
float *red, float *green, float *blue)
|
||||||
|
{
|
||||||
|
*red = apply_gamma (linear_red);
|
||||||
|
*green = apply_gamma (linear_green);
|
||||||
|
*blue = apply_gamma (linear_blue);
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
/* GTK - The GIMP Toolkit
|
||||||
|
* Copyright (C) 2024 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "gtkcolorutils.h"
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
void gtk_rgb_to_hsl (float red, float green, float blue,
|
||||||
|
float *hue, float *saturation, float *lightness);
|
||||||
|
void gtk_hsl_to_rgb (float hue, float saturation, float lightness,
|
||||||
|
float *red, float *green, float *blue);
|
||||||
|
|
||||||
|
void gtk_rgb_to_hwb (float red, float green, float blue,
|
||||||
|
float *hue, float *white, float *black);
|
||||||
|
void gtk_hwb_to_rgb (float hue, float white, float black,
|
||||||
|
float *red, float *green, float *blue);
|
||||||
|
|
||||||
|
void gtk_oklab_to_oklch (float L, float a, float b,
|
||||||
|
float *L2, float *C, float *H);
|
||||||
|
void gtk_oklch_to_oklab (float L, float C, float H,
|
||||||
|
float *L2, float *a, float *b);
|
||||||
|
|
||||||
|
void gtk_oklab_to_linear_srgb (float L, float a, float b,
|
||||||
|
float *red, float *green, float *blue);
|
||||||
|
void gtk_linear_srgb_to_oklab (float red, float green, float blue,
|
||||||
|
float *L, float *a, float *b);
|
||||||
|
|
||||||
|
void gtk_oklab_to_rgb (float L, float a, float b,
|
||||||
|
float *red, float *green, float *blue);
|
||||||
|
void gtk_rgb_to_oklab (float red, float green, float blue,
|
||||||
|
float *L, float *a, float *b);
|
||||||
|
|
||||||
|
void gtk_rgb_to_linear_srgb (float red, float green, float blue,
|
||||||
|
float *linear_red, float *linear_green, float *linear_blue);
|
||||||
|
void gtk_linear_srgb_to_rgb (float linear_red, float linear_green, float linear_blue,
|
||||||
|
float *red, float *green, float *blue);
|
||||||
|
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
+3
-1
@@ -2188,7 +2188,8 @@ gtk_column_view_set_header_factory (GtkColumnView *self,
|
|||||||
/**
|
/**
|
||||||
* gtk_column_view_scroll_to:
|
* gtk_column_view_scroll_to:
|
||||||
* @self: The columnview to scroll in
|
* @self: The columnview to scroll in
|
||||||
* @pos: position of the item
|
* @pos: position of the item. Must be less than the number of
|
||||||
|
* items in the view.
|
||||||
* @column: (nullable) (transfer none): The column to scroll to
|
* @column: (nullable) (transfer none): The column to scroll to
|
||||||
* or %NULL to not scroll columns.
|
* or %NULL to not scroll columns.
|
||||||
* @flags: actions to perform
|
* @flags: actions to perform
|
||||||
@@ -2211,6 +2212,7 @@ gtk_column_view_scroll_to (GtkColumnView *self,
|
|||||||
GtkScrollInfo *scroll)
|
GtkScrollInfo *scroll)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_COLUMN_VIEW (self));
|
g_return_if_fail (GTK_IS_COLUMN_VIEW (self));
|
||||||
|
g_return_if_fail (pos < gtk_list_base_get_n_items (GTK_LIST_BASE (self->listview)));
|
||||||
g_return_if_fail (column == NULL || GTK_IS_COLUMN_VIEW_COLUMN (column));
|
g_return_if_fail (column == NULL || GTK_IS_COLUMN_VIEW_COLUMN (column));
|
||||||
if (column)
|
if (column)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1924,6 +1924,13 @@ attribute_from_name (const char *name)
|
|||||||
return GTK_CONSTRAINT_ATTRIBUTE_NONE;
|
return GTK_CONSTRAINT_ATTRIBUTE_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_constraint_vfl_parser_error_quark:
|
||||||
|
*
|
||||||
|
* Registers an error quark for VFL error parsing.
|
||||||
|
*
|
||||||
|
* Returns: the error quark
|
||||||
|
**/
|
||||||
GQuark
|
GQuark
|
||||||
gtk_constraint_vfl_parser_error_quark (void)
|
gtk_constraint_vfl_parser_error_quark (void)
|
||||||
{
|
{
|
||||||
|
|||||||
+97
-31
@@ -42,9 +42,37 @@
|
|||||||
|
|
||||||
G_DEFINE_TYPE (GtkCssAnimatedStyle, gtk_css_animated_style, GTK_TYPE_CSS_STYLE)
|
G_DEFINE_TYPE (GtkCssAnimatedStyle, gtk_css_animated_style, GTK_TYPE_CSS_STYLE)
|
||||||
|
|
||||||
|
static inline gboolean
|
||||||
|
property_has_color (guint id)
|
||||||
|
{
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case GTK_CSS_PROPERTY_COLOR:
|
||||||
|
case GTK_CSS_PROPERTY_ICON_PALETTE:
|
||||||
|
case GTK_CSS_PROPERTY_TEXT_DECORATION_COLOR:
|
||||||
|
case GTK_CSS_PROPERTY_TEXT_SHADOW:
|
||||||
|
case GTK_CSS_PROPERTY_BOX_SHADOW:
|
||||||
|
case GTK_CSS_PROPERTY_BORDER_TOP_COLOR:
|
||||||
|
case GTK_CSS_PROPERTY_BORDER_RIGHT_COLOR:
|
||||||
|
case GTK_CSS_PROPERTY_BORDER_BOTTOM_COLOR:
|
||||||
|
case GTK_CSS_PROPERTY_BORDER_LEFT_COLOR:
|
||||||
|
case GTK_CSS_PROPERTY_OUTLINE_COLOR:
|
||||||
|
case GTK_CSS_PROPERTY_BACKGROUND_IMAGE:
|
||||||
|
case GTK_CSS_PROPERTY_ICON_SOURCE:
|
||||||
|
case GTK_CSS_PROPERTY_ICON_SHADOW:
|
||||||
|
case GTK_CSS_PROPERTY_CARET_COLOR:
|
||||||
|
case GTK_CSS_PROPERTY_SECONDARY_CARET_COLOR:
|
||||||
|
return TRUE;
|
||||||
|
default:
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#define DEFINE_VALUES(ENUM, TYPE, NAME) \
|
#define DEFINE_VALUES(ENUM, TYPE, NAME) \
|
||||||
static inline void \
|
static inline void \
|
||||||
gtk_css_ ## NAME ## _values_recompute (GtkCssAnimatedStyle *animated) \
|
gtk_css_ ## NAME ## _values_recompute (GtkCssAnimatedStyle *animated, \
|
||||||
|
GtkCssComputeContext *context, \
|
||||||
|
GtkCssAnimationChange change) \
|
||||||
{ \
|
{ \
|
||||||
GtkCssStyle *style = (GtkCssStyle *)animated; \
|
GtkCssStyle *style = (GtkCssStyle *)animated; \
|
||||||
GtkCssValue **values = (GtkCssValue **)((guint8*)(animated->style->NAME) + sizeof (GtkCssValues)); \
|
GtkCssValue **values = (GtkCssValue **)((guint8*)(animated->style->NAME) + sizeof (GtkCssValues)); \
|
||||||
@@ -54,6 +82,7 @@ gtk_css_ ## NAME ## _values_recompute (GtkCssAnimatedStyle *animated) \
|
|||||||
{ \
|
{ \
|
||||||
guint id = NAME ## _props[i]; \
|
guint id = NAME ## _props[i]; \
|
||||||
GtkCssValue *original, *computed; \
|
GtkCssValue *original, *computed; \
|
||||||
|
gboolean needs_recompute = FALSE; \
|
||||||
\
|
\
|
||||||
if (values[i] == NULL) \
|
if (values[i] == NULL) \
|
||||||
continue; \
|
continue; \
|
||||||
@@ -62,16 +91,27 @@ gtk_css_ ## NAME ## _values_recompute (GtkCssAnimatedStyle *animated) \
|
|||||||
if (original == NULL) \
|
if (original == NULL) \
|
||||||
continue; \
|
continue; \
|
||||||
\
|
\
|
||||||
computed = _gtk_css_value_compute (original, \
|
if ((change & GTK_CSS_ANIMATION_CHANGE_VARIABLES) && \
|
||||||
id, \
|
gtk_css_value_contains_variables (original)) \
|
||||||
animated->provider, \
|
needs_recompute = TRUE; \
|
||||||
style, \
|
\
|
||||||
animated->parent_style, \
|
if ((change & GTK_CSS_ANIMATION_CHANGE_COLOR) && \
|
||||||
NULL); \
|
property_has_color (id)) \
|
||||||
|
needs_recompute = TRUE; \
|
||||||
|
\
|
||||||
|
if (!needs_recompute) \
|
||||||
|
continue; \
|
||||||
|
\
|
||||||
|
computed = gtk_css_value_compute (original, \
|
||||||
|
id, \
|
||||||
|
context); \
|
||||||
if (computed == NULL) \
|
if (computed == NULL) \
|
||||||
continue; \
|
continue; \
|
||||||
\
|
\
|
||||||
gtk_css_animated_style_set_animated_value (animated, id, computed); \
|
gtk_css_animated_style_set_animated_value (animated, id, computed); \
|
||||||
|
\
|
||||||
|
if (id == GTK_CSS_PROPERTY_COLOR) \
|
||||||
|
change |= GTK_CSS_ANIMATION_CHANGE_COLOR; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -605,15 +645,20 @@ gtk_css_animated_style_get_intrinsic_value (GtkCssAnimatedStyle *style,
|
|||||||
return gtk_css_style_get_value (style->style, id);
|
return gtk_css_style_get_value (style->style, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
gboolean
|
||||||
gtk_css_animated_style_set_animated_custom_value (GtkCssAnimatedStyle *animated,
|
gtk_css_animated_style_set_animated_custom_value (GtkCssAnimatedStyle *animated,
|
||||||
int id,
|
int id,
|
||||||
GtkCssVariableValue *value)
|
GtkCssVariableValue *value)
|
||||||
{
|
{
|
||||||
GtkCssStyle *style = (GtkCssStyle *)animated;
|
GtkCssStyle *style = (GtkCssStyle *)animated;
|
||||||
|
GtkCssVariableValue *old_value;
|
||||||
|
|
||||||
gtk_internal_return_if_fail (GTK_IS_CSS_ANIMATED_STYLE (style));
|
gtk_internal_return_val_if_fail (GTK_IS_CSS_ANIMATED_STYLE (style), FALSE);
|
||||||
gtk_internal_return_if_fail (value != NULL);
|
gtk_internal_return_val_if_fail (value != NULL, FALSE);
|
||||||
|
|
||||||
|
old_value = gtk_css_style_get_custom_property (style, id);
|
||||||
|
if (gtk_css_variable_value_equal (old_value, value))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (style->variables == NULL)
|
if (style->variables == NULL)
|
||||||
{
|
{
|
||||||
@@ -630,17 +675,38 @@ gtk_css_animated_style_set_animated_custom_value (GtkCssAnimatedStyle *animated,
|
|||||||
|
|
||||||
gtk_css_variable_set_add (style->variables, id, value);
|
gtk_css_variable_set_add (style->variables, id, value);
|
||||||
|
|
||||||
gtk_css_core_values_recompute (animated);
|
return TRUE;
|
||||||
gtk_css_background_values_recompute (animated);
|
}
|
||||||
gtk_css_border_values_recompute (animated);
|
|
||||||
gtk_css_icon_values_recompute (animated);
|
void
|
||||||
gtk_css_outline_values_recompute (animated);
|
gtk_css_animated_style_recompute (GtkCssAnimatedStyle *style,
|
||||||
gtk_css_font_values_recompute (animated);
|
GtkCssAnimationChange change)
|
||||||
gtk_css_font_variant_values_recompute (animated);
|
{
|
||||||
gtk_css_animation_values_recompute (animated);
|
GtkCssComputeContext context = { NULL, };
|
||||||
gtk_css_transition_values_recompute (animated);
|
GtkCssValue *shorthands[GTK_CSS_SHORTHAND_PROPERTY_N_PROPERTIES] = { NULL, };
|
||||||
gtk_css_size_values_recompute (animated);
|
|
||||||
gtk_css_other_values_recompute (animated);
|
context.provider = style->provider;
|
||||||
|
context.style = style->style;
|
||||||
|
context.parent_style = style->parent_style;
|
||||||
|
context.shorthands = shorthands;
|
||||||
|
|
||||||
|
gtk_css_core_values_recompute (style, &context, change);
|
||||||
|
gtk_css_background_values_recompute (style, &context, change);
|
||||||
|
gtk_css_border_values_recompute (style, &context, change);
|
||||||
|
gtk_css_icon_values_recompute (style, &context, change);
|
||||||
|
gtk_css_outline_values_recompute (style, &context, change);
|
||||||
|
gtk_css_font_values_recompute (style, &context, change);
|
||||||
|
gtk_css_font_variant_values_recompute (style, &context, change);
|
||||||
|
gtk_css_animation_values_recompute (style, &context, change);
|
||||||
|
gtk_css_transition_values_recompute (style, &context, change);
|
||||||
|
gtk_css_size_values_recompute (style, &context, change);
|
||||||
|
gtk_css_other_values_recompute (style, &context, change);
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < GTK_CSS_SHORTHAND_PROPERTY_N_PROPERTIES; i++)
|
||||||
|
{
|
||||||
|
if (shorthands[i])
|
||||||
|
gtk_css_value_unref (shorthands[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkCssVariableValue *
|
GtkCssVariableValue *
|
||||||
@@ -789,8 +855,8 @@ gtk_css_animated_style_create_css_transitions (GPtrArray *animations,
|
|||||||
|
|
||||||
if (_gtk_css_array_value_get_n_values (durations) == 1 &&
|
if (_gtk_css_array_value_get_n_values (durations) == 1 &&
|
||||||
_gtk_css_array_value_get_n_values (delays) == 1 &&
|
_gtk_css_array_value_get_n_values (delays) == 1 &&
|
||||||
_gtk_css_number_value_get (_gtk_css_array_value_get_nth (durations, 0), 100) +
|
gtk_css_number_value_get (_gtk_css_array_value_get_nth (durations, 0), 100) +
|
||||||
_gtk_css_number_value_get (_gtk_css_array_value_get_nth (delays, 0), 100) == 0)
|
gtk_css_number_value_get (_gtk_css_array_value_get_nth (delays, 0), 100) == 0)
|
||||||
return animations;
|
return animations;
|
||||||
|
|
||||||
transition_infos_set (transitions, base_style->transition->transition_property);
|
transition_infos_set (transitions, base_style->transition->transition_property);
|
||||||
@@ -805,8 +871,8 @@ gtk_css_animated_style_create_css_transitions (GPtrArray *animations,
|
|||||||
if (!transitions[i].pending)
|
if (!transitions[i].pending)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
duration = _gtk_css_number_value_get (_gtk_css_array_value_get_nth (durations, transitions[i].index), 100);
|
duration = gtk_css_number_value_get (_gtk_css_array_value_get_nth (durations, transitions[i].index), 100);
|
||||||
delay = _gtk_css_number_value_get (_gtk_css_array_value_get_nth (delays, transitions[i].index), 100);
|
delay = gtk_css_number_value_get (_gtk_css_array_value_get_nth (delays, transitions[i].index), 100);
|
||||||
if (duration + delay == 0.0)
|
if (duration + delay == 0.0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -815,7 +881,7 @@ gtk_css_animated_style_create_css_transitions (GPtrArray *animations,
|
|||||||
start = gtk_css_animated_style_get_intrinsic_value ((GtkCssAnimatedStyle *)source, i);
|
start = gtk_css_animated_style_get_intrinsic_value ((GtkCssAnimatedStyle *)source, i);
|
||||||
end = gtk_css_style_get_value (base_style, i);
|
end = gtk_css_style_get_value (base_style, i);
|
||||||
|
|
||||||
if (_gtk_css_value_equal (start, end))
|
if (gtk_css_value_equal (start, end))
|
||||||
{
|
{
|
||||||
animation = gtk_css_animated_style_find_transition ((GtkCssAnimatedStyle *)source, i);
|
animation = gtk_css_animated_style_find_transition ((GtkCssAnimatedStyle *)source, i);
|
||||||
if (animation)
|
if (animation)
|
||||||
@@ -831,8 +897,8 @@ gtk_css_animated_style_create_css_transitions (GPtrArray *animations,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_gtk_css_value_equal (gtk_css_style_get_value (source, i),
|
if (gtk_css_value_equal (gtk_css_style_get_value (source, i),
|
||||||
gtk_css_style_get_value (base_style, i)))
|
gtk_css_style_get_value (base_style, i)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
animation = _gtk_css_transition_new (i,
|
animation = _gtk_css_transition_new (i,
|
||||||
@@ -938,13 +1004,13 @@ gtk_css_animated_style_create_css_animations (GPtrArray *animations,
|
|||||||
animation = _gtk_css_animation_new (name,
|
animation = _gtk_css_animation_new (name,
|
||||||
keyframes,
|
keyframes,
|
||||||
timestamp,
|
timestamp,
|
||||||
_gtk_css_number_value_get (_gtk_css_array_value_get_nth (delays, i), 100) * G_USEC_PER_SEC,
|
gtk_css_number_value_get (_gtk_css_array_value_get_nth (delays, i), 100) * G_USEC_PER_SEC,
|
||||||
_gtk_css_number_value_get (_gtk_css_array_value_get_nth (durations, i), 100) * G_USEC_PER_SEC,
|
gtk_css_number_value_get (_gtk_css_array_value_get_nth (durations, i), 100) * G_USEC_PER_SEC,
|
||||||
_gtk_css_array_value_get_nth (timing_functions, i),
|
_gtk_css_array_value_get_nth (timing_functions, i),
|
||||||
_gtk_css_direction_value_get (_gtk_css_array_value_get_nth (directions, i)),
|
_gtk_css_direction_value_get (_gtk_css_array_value_get_nth (directions, i)),
|
||||||
_gtk_css_play_state_value_get (_gtk_css_array_value_get_nth (play_states, i)),
|
_gtk_css_play_state_value_get (_gtk_css_array_value_get_nth (play_states, i)),
|
||||||
_gtk_css_fill_mode_value_get (_gtk_css_array_value_get_nth (fill_modes, i)),
|
_gtk_css_fill_mode_value_get (_gtk_css_array_value_get_nth (fill_modes, i)),
|
||||||
_gtk_css_number_value_get (_gtk_css_array_value_get_nth (iteration_counts, i), 100));
|
gtk_css_number_value_get (_gtk_css_array_value_get_nth (iteration_counts, i), 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!animations)
|
if (!animations)
|
||||||
|
|||||||
@@ -70,9 +70,17 @@ void gtk_css_animated_style_set_animated_value(GtkCssAnimated
|
|||||||
GtkCssValue * gtk_css_animated_style_get_intrinsic_value (GtkCssAnimatedStyle *style,
|
GtkCssValue * gtk_css_animated_style_get_intrinsic_value (GtkCssAnimatedStyle *style,
|
||||||
guint id);
|
guint id);
|
||||||
|
|
||||||
void gtk_css_animated_style_set_animated_custom_value (GtkCssAnimatedStyle *animated,
|
gboolean gtk_css_animated_style_set_animated_custom_value (GtkCssAnimatedStyle *animated,
|
||||||
int id,
|
int id,
|
||||||
GtkCssVariableValue *value);
|
GtkCssVariableValue *value);
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
GTK_CSS_ANIMATION_CHANGE_VARIABLES = 1 << 0,
|
||||||
|
GTK_CSS_ANIMATION_CHANGE_COLOR = 1 << 1,
|
||||||
|
} GtkCssAnimationChange;
|
||||||
|
|
||||||
|
void gtk_css_animated_style_recompute (GtkCssAnimatedStyle *style,
|
||||||
|
GtkCssAnimationChange change);
|
||||||
GtkCssVariableValue * gtk_css_animated_style_get_intrinsic_custom_value (GtkCssAnimatedStyle *style,
|
GtkCssVariableValue * gtk_css_animated_style_get_intrinsic_custom_value (GtkCssAnimatedStyle *style,
|
||||||
int id);
|
int id);
|
||||||
|
|
||||||
|
|||||||
+13
-5
@@ -95,6 +95,7 @@ gtk_css_animation_apply_values (GtkStyleAnimation *style_animation,
|
|||||||
GtkCssKeyframes *resolved_keyframes;
|
GtkCssKeyframes *resolved_keyframes;
|
||||||
double progress;
|
double progress;
|
||||||
guint i;
|
guint i;
|
||||||
|
GtkCssAnimationChange change = 0;
|
||||||
|
|
||||||
if (!gtk_css_animation_is_executing (animation))
|
if (!gtk_css_animation_is_executing (animation))
|
||||||
return;
|
return;
|
||||||
@@ -125,7 +126,8 @@ gtk_css_animation_apply_values (GtkStyleAnimation *style_animation,
|
|||||||
if (!value)
|
if (!value)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
gtk_css_animated_style_set_animated_custom_value (style, variable_id, value);
|
if (gtk_css_animated_style_set_animated_custom_value (style, variable_id, value))
|
||||||
|
change |= GTK_CSS_ANIMATION_CHANGE_VARIABLES;
|
||||||
|
|
||||||
gtk_css_variable_value_unref (value);
|
gtk_css_variable_value_unref (value);
|
||||||
}
|
}
|
||||||
@@ -134,7 +136,7 @@ gtk_css_animation_apply_values (GtkStyleAnimation *style_animation,
|
|||||||
{
|
{
|
||||||
GtkCssValue *value;
|
GtkCssValue *value;
|
||||||
guint property_id;
|
guint property_id;
|
||||||
|
|
||||||
property_id = _gtk_css_keyframes_get_property_id (resolved_keyframes, i);
|
property_id = _gtk_css_keyframes_get_property_id (resolved_keyframes, i);
|
||||||
|
|
||||||
value = _gtk_css_keyframes_get_value (resolved_keyframes,
|
value = _gtk_css_keyframes_get_value (resolved_keyframes,
|
||||||
@@ -142,8 +144,14 @@ gtk_css_animation_apply_values (GtkStyleAnimation *style_animation,
|
|||||||
progress,
|
progress,
|
||||||
gtk_css_animated_style_get_intrinsic_value (style, property_id));
|
gtk_css_animated_style_get_intrinsic_value (style, property_id));
|
||||||
gtk_css_animated_style_set_animated_value (style, property_id, value);
|
gtk_css_animated_style_set_animated_value (style, property_id, value);
|
||||||
|
|
||||||
|
if (property_id == GTK_CSS_PROPERTY_COLOR)
|
||||||
|
change |= GTK_CSS_ANIMATION_CHANGE_COLOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (change != 0)
|
||||||
|
gtk_css_animated_style_recompute (style, change);
|
||||||
|
|
||||||
_gtk_css_keyframes_unref (resolved_keyframes);
|
_gtk_css_keyframes_unref (resolved_keyframes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,7 +179,7 @@ gtk_css_animation_free (GtkStyleAnimation *animation)
|
|||||||
|
|
||||||
g_free (self->name);
|
g_free (self->name);
|
||||||
_gtk_css_keyframes_unref (self->keyframes);
|
_gtk_css_keyframes_unref (self->keyframes);
|
||||||
_gtk_css_value_unref (self->ease);
|
gtk_css_value_unref (self->ease);
|
||||||
|
|
||||||
g_free (self);
|
g_free (self);
|
||||||
}
|
}
|
||||||
@@ -211,7 +219,7 @@ _gtk_css_animation_new (const char *name,
|
|||||||
|
|
||||||
animation->name = g_strdup (name);
|
animation->name = g_strdup (name);
|
||||||
animation->keyframes = _gtk_css_keyframes_ref (keyframes);
|
animation->keyframes = _gtk_css_keyframes_ref (keyframes);
|
||||||
animation->ease = _gtk_css_value_ref (ease);
|
animation->ease = gtk_css_value_ref (ease);
|
||||||
animation->direction = direction;
|
animation->direction = direction;
|
||||||
animation->play_state = play_state;
|
animation->play_state = play_state;
|
||||||
animation->fill_mode = fill_mode;
|
animation->fill_mode = fill_mode;
|
||||||
@@ -242,7 +250,7 @@ _gtk_css_animation_advance_with_play_state (GtkCssAnimation *source,
|
|||||||
|
|
||||||
animation->name = g_strdup (source->name);
|
animation->name = g_strdup (source->name);
|
||||||
animation->keyframes = _gtk_css_keyframes_ref (source->keyframes);
|
animation->keyframes = _gtk_css_keyframes_ref (source->keyframes);
|
||||||
animation->ease = _gtk_css_value_ref (source->ease);
|
animation->ease = gtk_css_value_ref (source->ease);
|
||||||
animation->direction = source->direction;
|
animation->direction = source->direction;
|
||||||
animation->play_state = play_state;
|
animation->play_state = play_state;
|
||||||
animation->fill_mode = source->fill_mode;
|
animation->fill_mode = source->fill_mode;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user