Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2af0682074 |
+1
-3
@@ -445,10 +445,9 @@ reference:
|
||||
--force-fallback-for=gdk-pixbuf,pango
|
||||
-Dintrospection=enabled
|
||||
-Ddocumentation=true
|
||||
-Dman-pages=true
|
||||
-Dgdk-pixbuf:gtk_doc=true
|
||||
-Dpango:documentation=true
|
||||
-Dbuild-demos=true
|
||||
-Dbuild-demos=false
|
||||
-Dbuild-examples=false
|
||||
-Dbuild-tests=false
|
||||
-Dbuild-testsuite=false
|
||||
@@ -460,7 +459,6 @@ reference:
|
||||
- mv _build/docs/reference/gdk/gdk4-wayland/ _reference/gdk4-wayland/
|
||||
- mv _build/docs/reference/gsk/gsk4/ _reference/gsk4/
|
||||
- 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/PangoCairo/ _reference/PangoCairo/
|
||||
- mv _build/subprojects/pango/docs/PangoFc/ _reference/PangoFc/
|
||||
|
||||
@@ -1,144 +1,6 @@
|
||||
Overview of Changes in 4.15.3, 29-06-2024
|
||||
Overview of Changes in 4.15.1, xx-xx-xxxx
|
||||
=========================================
|
||||
|
||||
* Accessibility:
|
||||
- Only emit notifications when cursor positions change in GtkText
|
||||
- Fix handling of help text properties
|
||||
|
||||
* CSS:
|
||||
- Fix some crashes introduced in recent currentcolor changes
|
||||
|
||||
* DND:
|
||||
- Avoid a critical
|
||||
|
||||
* Documentation:
|
||||
- Fix many oversights and missing docs
|
||||
|
||||
* maxOS:
|
||||
- Add native keyboard shortcuts
|
||||
|
||||
|
||||
Overview of Changes in 4.15.2, 28-06-2024
|
||||
=========================================
|
||||
|
||||
* GtkFileChooserWidget:
|
||||
- Plug some memory leaks
|
||||
- Make Ctrl-Shift-N create a new folder
|
||||
|
||||
* GtkPopover:
|
||||
- Handle resizing and position changes better
|
||||
|
||||
* 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/)
|
||||
- Support more colorspaces in color()
|
||||
- Allow percentages for opacity
|
||||
- Handle currentcolor more correctly
|
||||
|
||||
* Accessibility:
|
||||
- Avoid markup when reading labels
|
||||
|
||||
* GSK:
|
||||
- Subset fonts when serializing node trees
|
||||
- Make ngl export render_texture results as dmabufs
|
||||
|
||||
* Wayland:
|
||||
- Use xdg-dialog protocol for attached dialogs
|
||||
|
||||
* Windows:
|
||||
- Build with UNICODE
|
||||
|
||||
* macOS:
|
||||
- Implement fullscreen-on-monitor
|
||||
|
||||
* Documentation:
|
||||
- Widget shortcuts and actions are now described in the docs
|
||||
|
||||
* Debugging:
|
||||
- Add GTK_DEBUG=css for warning about deprecated css syntax
|
||||
|
||||
* Tools:
|
||||
- rendernode-tool: Add an extract command for data urls
|
||||
|
||||
* Deprecations:
|
||||
- CSS Color functions shade(), lighter(), darker(), alpha(), mix()
|
||||
|
||||
* Translation updates:
|
||||
Czech
|
||||
Hebrew
|
||||
Serbian
|
||||
|
||||
|
||||
Overview of Changes in 4.15.1, 21-05-2024
|
||||
=========================================
|
||||
|
||||
* GtkGraphicsOffload:
|
||||
- Don't crash without a child
|
||||
|
||||
* GtkSpinner:
|
||||
- Don't animate when unmapped
|
||||
|
||||
* CSS:
|
||||
- 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:
|
||||
- Make symbolic svg loading more efficient
|
||||
- Handle color-free symbolics more efficiently
|
||||
|
||||
* Accessibility:
|
||||
- Make the gtk-demo sidebar search more accessible
|
||||
- Stop emitting focus events
|
||||
- Realize child contexts when necessary
|
||||
|
||||
* GDK:
|
||||
- Support XDG_ACTIVATION_TOKEN
|
||||
- dmabuf: Be more defensive when importing unknown formats to GL
|
||||
- dmabuf: Use narrow range for YUV
|
||||
- vulkan: Recreate swapchains when necessary or beneficial
|
||||
|
||||
* GSK:
|
||||
- Improve logging for GDK_DEBUG=offload
|
||||
- Improve logging for GSK_DEBUG=renderer
|
||||
- gpu: Warn about inefficient texture import
|
||||
- gpu: Handle tiny offscreens correctly
|
||||
- vulkan: Add profiler marks in various places
|
||||
- vulkan: Fix a problem with imported dmabufs showing up black
|
||||
- cairo: Speed up mask nodes, since we use them for symbolic icons
|
||||
|
||||
* Wayland:
|
||||
- Use wl_compositor version 6
|
||||
|
||||
* X11:
|
||||
- Implement a missing method
|
||||
|
||||
* Build:
|
||||
- Fix many ubsan warnings
|
||||
|
||||
* Debugging:
|
||||
- Show more texture details in the recorder
|
||||
- Use GTK_DEBUG=css to see CSS deprecations
|
||||
|
||||
* macOS:
|
||||
- Fix problems with events handed back to the OS
|
||||
- Respect GDK_DEBUG=default-settings
|
||||
- Allow applictions to handle Dock > Quit
|
||||
|
||||
* Deprecations:
|
||||
- Use of @name colors in CSS
|
||||
|
||||
* Translation updates:
|
||||
Catalan
|
||||
Georgian
|
||||
Hungarian
|
||||
Korean
|
||||
Portuguese
|
||||
Turkish
|
||||
|
||||
|
||||
Overview of Changes in 4.15.0, 21-04-2024
|
||||
=========================================
|
||||
|
||||
|
||||
@@ -363,9 +363,7 @@ insert_markup_idle (gpointer data)
|
||||
|
||||
if (g_get_monotonic_time () - begin > G_TIME_SPAN_MILLISECOND)
|
||||
{
|
||||
guint id;
|
||||
id = g_idle_add (insert_markup_idle, data);
|
||||
g_source_set_name_by_id (id, "[gtk-demo] insert_markup_idle");
|
||||
g_idle_add (insert_markup_idle, data);
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
@@ -400,9 +398,7 @@ parse_markup_idle (gpointer data)
|
||||
do {
|
||||
if (g_get_monotonic_time () - begin > G_TIME_SPAN_MILLISECOND)
|
||||
{
|
||||
guint id;
|
||||
id = g_idle_add (parse_markup_idle, data);
|
||||
g_source_set_name_by_id (id, "[gtk-demo] parse_markup_idle");
|
||||
g_idle_add (parse_markup_idle, data);
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ get_win32_all_locales_scripts (LPWSTR locale_w, DWORD flags, LPARAM param)
|
||||
{
|
||||
wchar_t *langname_w = NULL;
|
||||
wchar_t locale_abbrev_w[9];
|
||||
gchar *langname, *locale_abbrev, *locale;
|
||||
gchar *langname, *locale_abbrev, *locale, *p;
|
||||
gint i;
|
||||
const LCTYPE iso639_lctypes[] = { LOCALE_SISO639LANGNAME, LOCALE_SISO639LANGNAME2 };
|
||||
GHashTable *ht_scripts_langs = (GHashTable *) param;
|
||||
@@ -59,6 +59,7 @@ get_win32_all_locales_scripts (LPWSTR locale_w, DWORD flags, LPARAM param)
|
||||
GetLocaleInfoEx (locale_w, LOCALE_SLOCALIZEDDISPLAYNAME, langname_w, langname_size);
|
||||
langname = g_utf16_to_utf8 (langname_w, -1, NULL, NULL, NULL);
|
||||
locale = g_utf16_to_utf8 (locale_w, -1, NULL, NULL, NULL);
|
||||
p = strchr (locale, '-');
|
||||
lang = pango_language_from_string (locale);
|
||||
if (g_hash_table_lookup (ht_scripts_langs, lang) == NULL)
|
||||
g_hash_table_insert (ht_scripts_langs, lang, langname);
|
||||
|
||||
@@ -299,7 +299,7 @@ node_editor_application_new (void)
|
||||
|
||||
app = g_object_new (NODE_EDITOR_APPLICATION_TYPE,
|
||||
"application-id", "org.gtk.gtk4.NodeEditor",
|
||||
"flags", G_APPLICATION_HANDLES_OPEN | G_APPLICATION_NON_UNIQUE,
|
||||
"flags", G_APPLICATION_HANDLES_OPEN,
|
||||
NULL);
|
||||
|
||||
g_application_add_main_option (G_APPLICATION (app), "version", 0, 0,G_OPTION_ARG_NONE, "Show program version", NULL);
|
||||
|
||||
@@ -330,7 +330,6 @@ stroke bounds of the path.
|
||||
| offset | `<point>` | 0 0 | non-default |
|
||||
| hint-style | `<hint style>` | slight | non-default |
|
||||
| antialias | `<antialias>` | gray | non-default |
|
||||
| hint-metrics | `<hint metrics>` | off | non-default |
|
||||
|
||||
Creates a node like `gsk_text_node_new()` with the given properties.
|
||||
|
||||
@@ -347,7 +346,6 @@ font, an error node will be returned.
|
||||
|
||||
Possible values for hint-style are none, slight or full.
|
||||
Possible value for antialias are none or gray.
|
||||
Possible value for hint-metrics are on or off.
|
||||
|
||||
### texture
|
||||
|
||||
|
||||
@@ -111,11 +111,3 @@ content_images = [
|
||||
]
|
||||
content_base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/docs/reference/gdk/"
|
||||
urlmap_file = "urlmap.js"
|
||||
|
||||
[[object]]
|
||||
name = "DECLARE_INTERNAL_TYPE"
|
||||
hidden = true
|
||||
|
||||
[[object]]
|
||||
pattern = "KEY_*"
|
||||
check_ignore = true
|
||||
|
||||
@@ -29,18 +29,6 @@ if get_option('documentation')
|
||||
install_dir: docs_dir,
|
||||
)
|
||||
|
||||
test('doc-check-gdk',
|
||||
gidocgen,
|
||||
args: [
|
||||
'check',
|
||||
'--config', gdk4_toml,
|
||||
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
|
||||
gdk_gir[0],
|
||||
],
|
||||
depends: gdk_gir[0],
|
||||
suite: ['docs'],
|
||||
)
|
||||
|
||||
if x11_enabled
|
||||
gdk4x11_toml = configure_file(
|
||||
input: 'gdk4-x11.toml.in',
|
||||
@@ -99,17 +87,5 @@ if get_option('documentation')
|
||||
install: true,
|
||||
install_dir: docs_dir,
|
||||
)
|
||||
|
||||
test('doc-check-gdk-wayland',
|
||||
gidocgen,
|
||||
args: [
|
||||
'check',
|
||||
'--config', gdk4wayland_toml,
|
||||
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
|
||||
gdk_wayland_gir[0],
|
||||
],
|
||||
depends: gdk_wayland_gir[0],
|
||||
suite: ['docs'],
|
||||
)
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -66,7 +66,3 @@ content_images = [
|
||||
]
|
||||
content_base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/docs/reference/gsk/"
|
||||
urlmap_file = "urlmap.js"
|
||||
|
||||
[[object]]
|
||||
name = "INCLUDE_WARNING"
|
||||
hidden = true
|
||||
|
||||
@@ -30,16 +30,4 @@ if get_option('documentation')
|
||||
install: true,
|
||||
install_dir: docs_dir,
|
||||
)
|
||||
|
||||
test('doc-check-gsk',
|
||||
gidocgen,
|
||||
args: [
|
||||
'check',
|
||||
'--config', gsk4_toml,
|
||||
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
|
||||
gsk_gir[0],
|
||||
],
|
||||
depends: gsk_gir[0],
|
||||
suite: ['docs'],
|
||||
)
|
||||
endif
|
||||
|
||||
@@ -15,16 +15,16 @@ spec.
|
||||
The following units are supported for basic datatypes:
|
||||
|
||||
Length
|
||||
: px, pt, em, ex, rem, pc, in, cm, mm
|
||||
: px, pt, em, ex, rem, pc, in, cm, mm, calc()
|
||||
|
||||
Percentage
|
||||
: %
|
||||
: %, calc()
|
||||
|
||||
Angle
|
||||
: deg, rad, grad, turn
|
||||
: deg, grad, turn, calc()
|
||||
|
||||
Time
|
||||
: s, ms
|
||||
: s, ms, calc()
|
||||
|
||||
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
|
||||
@@ -33,15 +33,11 @@ which case they are resolved using the inherited font size value.
|
||||
The rem unit is resolved using the initial font size value, which is
|
||||
not quite the same as the CSS definition of rem.
|
||||
|
||||
Length values using physical units (pt, pc, in, cm, mm) are translated
|
||||
to px using the dpi value specified by the -gtk-dpi property, which is
|
||||
different from the CSS definition, which uses a fixed dpi of 96.
|
||||
|
||||
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.
|
||||
The calc() notation adds considerable expressive power. 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
|
||||
[CSS3 Values and Units](https://www.w3.org/TR/css3-values/#calc-notation)
|
||||
spec.
|
||||
|
||||
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
|
||||
@@ -60,80 +56,38 @@ follows:
|
||||
1 value:
|
||||
: all
|
||||
|
||||
## Custom Properties
|
||||
|
||||
GTK supports custom properties as defined in the
|
||||
[CSS Custom Properties for Cascading Variables](https://www.w3.org/TR/css-variables-1)
|
||||
spec.
|
||||
|
||||
Custom properties are defined as follows:
|
||||
|
||||
```css
|
||||
--prop: red;
|
||||
```
|
||||
|
||||
and used via the `var` keyword:
|
||||
|
||||
```css
|
||||
color: var(--prop);
|
||||
```
|
||||
|
||||
Custom properties can have a fallback for when the referred property is invalid:
|
||||
|
||||
```css
|
||||
color: var(--prop, green);
|
||||
```
|
||||
|
||||
## 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.
|
||||
GTK extends the CSS syntax with several additional ways to specify colors.
|
||||
|
||||
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:
|
||||
|
||||
```
|
||||
@define-color name color
|
||||
@define-color Name Color
|
||||
```
|
||||
|
||||
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
|
||||
new ones. Color expressions can be nested, providing a rich language to
|
||||
define colors. Color expressions resemble functions, taking 1 or more colors
|
||||
and in some cases a number as arguments.
|
||||
|
||||
`lighter(color)`
|
||||
: produces a brighter variant of `color`.
|
||||
`lighter(Color)`
|
||||
: produces a brighter variant of Color
|
||||
|
||||
`darker(color)`
|
||||
: produces a darker variant of `color`.
|
||||
`darker(Color)`
|
||||
: produces a darker variant of Color
|
||||
|
||||
`shade(color, number)`
|
||||
: changes the lightness of `color`. The `number` ranges from 0 for black to 2 for white.
|
||||
`shade(Color, Number)`
|
||||
: changes the lightness of Color. The number ranges from 0 for black to 2 for white.
|
||||
|
||||
`alpha(color, number)`
|
||||
: multiplies the alpha value of `color` by `number` (between 0 and 1).
|
||||
`alpha(Color, Number)`
|
||||
: replaces the alpha value of color with number (between 0 and 1)
|
||||
|
||||
`mix(color1, color2, number)`
|
||||
: interpolates between the two colors.
|
||||
`mix(Color1, Color2, Number)`
|
||||
: interpolates between the two colors
|
||||
|
||||
## Images
|
||||
|
||||
@@ -141,7 +95,7 @@ GTK extends the CSS syntax for images and also uses it for specifying icons.
|
||||
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
|
||||
@@ -170,14 +124,14 @@ and the
|
||||
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
|
||||
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
|
||||
images can specify normal and hi-resolution variants. From CSS, this can be
|
||||
done with
|
||||
|
||||
```
|
||||
-gtk-scaled(image1, image2)
|
||||
-gtk-scaled(Image1, Image2)
|
||||
```
|
||||
|
||||
## GTK CSS Properties
|
||||
|
||||
@@ -99,15 +99,16 @@ reaches the requested phase. However, in practice most things
|
||||
happen at higher levels:
|
||||
|
||||
- If you are doing an animation, you can use
|
||||
[method@Gtk.Widget.add_tick_callback] which will cause a regular
|
||||
gtk_widget_add_tick_callback() which will cause a regular
|
||||
beating of the clock with a callback in the Update phase
|
||||
until you stop the tick.
|
||||
- If some state changes that causes the size of your widget to
|
||||
change you call [method@Gtk.Widget.queue_resize] which will request
|
||||
change you call gtk_widget_queue_resize() which will request
|
||||
a Layout phase and mark your widget as needing relayout.
|
||||
- If some state changes so you need to redraw your widget you
|
||||
use [method@Gtk.Widget.queue_draw] to request a Paint phase for
|
||||
your widget.
|
||||
- If some state changes so you need to redraw some area of
|
||||
your widget you use the normal gtk_widget_queue_draw()
|
||||
set of functions. These will request a Paint phase and
|
||||
mark the region as needing redraw.
|
||||
|
||||
There are also a lot of implicit triggers of these from the
|
||||
CSS layer (which does animations, resizes and repaints as needed).
|
||||
|
||||
@@ -18,7 +18,6 @@ SYNOPSIS
|
||||
|
|
||||
| **gtk4-rendernode-tool** benchmark [OPTIONS...] <FILE>
|
||||
| **gtk4-rendernode-tool** compare [OPTIONS...] <FILE1> <FILE2>
|
||||
| **gtk4-rendernode-tool** extract [OPTIONS...] <FILE>
|
||||
| **gtk4-rendernode-tool** info [OPTIONS...] <FILE>
|
||||
| **gtk4-rendernode-tool** render [OPTIONS...] <FILE> [<FILE>]
|
||||
| **gtk4-rendernode-tool** show [OPTIONS...] <FILE>
|
||||
@@ -100,15 +99,3 @@ exit code is 1. If the images are identical, it is 0.
|
||||
``--quiet``
|
||||
|
||||
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,13 +77,11 @@ content_files = [
|
||||
"section-tree-widget.md",
|
||||
"migrating-2to4.md",
|
||||
"migrating-3to4.md",
|
||||
"migrating-4to5.md",
|
||||
"broadway.md",
|
||||
"osx.md",
|
||||
"wayland.md",
|
||||
"windows.md",
|
||||
"x11.md",
|
||||
"tools.md",
|
||||
"visual_index.md",
|
||||
]
|
||||
content_images = [
|
||||
@@ -251,12 +249,3 @@ content_images = [
|
||||
]
|
||||
content_base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/docs/reference/gtk/"
|
||||
urlmap_file = "urlmap.js"
|
||||
|
||||
[[object]]
|
||||
name = "StyleProvider"
|
||||
[[object.signal]]
|
||||
name = "gtk-private-changed"
|
||||
hidden = true
|
||||
|
||||
[check]
|
||||
skip_deprecated = true
|
||||
|
||||
@@ -140,11 +140,6 @@ capture phase, and key bindings locally, during the target phase.
|
||||
Under the hood, all shortcuts are represented as instances of `GtkShortcut`,
|
||||
and they are managed by `GtkShortcutController`.
|
||||
|
||||
Note that GTK does not do anything to map the primary shortcut modifier
|
||||
to <kbd>Command</kbd> on macOS. If you want to let your application to follow
|
||||
macOS user experience conventions, you must create macOS-specific keyboard shortcuts.
|
||||
The <kbd>Command</kbd> is named `Meta` (`GDK_META_MASK`) in GTK.
|
||||
|
||||
## Text input
|
||||
|
||||
When actual text input is needed (i.e. not just keyboard shortcuts),
|
||||
|
||||
@@ -14,7 +14,6 @@ expand_content_md_files = [
|
||||
'running.md',
|
||||
'migrating-2to4.md',
|
||||
'migrating-3to4.md',
|
||||
'migrating-4to5.md',
|
||||
'actions.md',
|
||||
'input-handling.md',
|
||||
'drawing-model.md',
|
||||
@@ -26,8 +25,7 @@ expand_content_md_files = [
|
||||
'section-tree-widget.md',
|
||||
'section-list-widget.md',
|
||||
'question_index.md',
|
||||
'visual_index.md',
|
||||
'tools.md',
|
||||
'visual_index.md'
|
||||
]
|
||||
|
||||
gtk_images = []
|
||||
@@ -62,51 +60,39 @@ if get_option('documentation')
|
||||
build_by_default: true,
|
||||
install: true,
|
||||
install_dir: docs_dir,
|
||||
install_tag: 'doc',
|
||||
)
|
||||
|
||||
test('doc-check-gtk',
|
||||
gidocgen,
|
||||
args: [
|
||||
'check',
|
||||
'--config', gtk4_toml,
|
||||
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
|
||||
gtk_gir[0],
|
||||
],
|
||||
depends: gtk_gir[0],
|
||||
suite: ['docs'],
|
||||
)
|
||||
endif
|
||||
|
||||
rst2man = find_program('rst2man', 'rst2man.py', required: get_option('man-pages'))
|
||||
rst2html5 = find_program('rst2html5', 'rst2html5.py', required: get_option('documentation'))
|
||||
rst2man = find_program('rst2man', 'rst2man.py', required: false)
|
||||
if get_option('man-pages') and not rst2man.found()
|
||||
error('No rst2man found, but man pages were explicitly enabled')
|
||||
endif
|
||||
|
||||
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', ],
|
||||
if get_option('man-pages') and rst2man.found()
|
||||
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', ],
|
||||
]
|
||||
endif
|
||||
|
||||
rst2x_flags = [
|
||||
'--syntax-highlight=none',
|
||||
]
|
||||
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
|
||||
|
||||
if get_option('man-pages')
|
||||
rst2man_flags = [
|
||||
'--syntax-highlight=none',
|
||||
]
|
||||
|
||||
foreach rst: rst_files
|
||||
man_name = rst[0]
|
||||
@@ -117,34 +103,12 @@ if get_option('man-pages')
|
||||
output: '@0@.@1@'.format(man_name, man_section),
|
||||
command: [
|
||||
rst2man,
|
||||
rst2x_flags,
|
||||
rst2man_flags,
|
||||
'@INPUT@',
|
||||
],
|
||||
capture: true,
|
||||
install: true,
|
||||
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
|
||||
endif
|
||||
|
||||
@@ -451,11 +451,11 @@ hint about how modifiers are expected to be used. It also promoted
|
||||
the use of `<Primary>` instead of `<Control>` to specify accelerators that
|
||||
adapt to platform conventions.
|
||||
|
||||
In GTK 4, the meaning of modifiers has been fixed, and applications are
|
||||
In GTK 4, the meaning of modifiers has been fixed, and backends are
|
||||
expected to map the platform conventions to the existing modifiers.
|
||||
The expected use of modifiers in GTK 4 is:
|
||||
|
||||
`GDK_CONTROL_MASK` (`GDK_META_MASK` on macOS)
|
||||
`GDK_CONTROL_MASK`
|
||||
: Primary accelerators
|
||||
|
||||
`GDK_ALT_MASK`
|
||||
@@ -464,7 +464,7 @@ The expected use of modifiers in GTK 4 is:
|
||||
`GDK_SHIFT_MASK`
|
||||
: Extending selections
|
||||
|
||||
`GDK_CONTROL_MASK` (`GDK_META_MASK` on macOS)
|
||||
`GDK_CONTROL_MASK`
|
||||
: Modifying selections
|
||||
|
||||
`GDK_CONTROL_MASK|GDK_ALT_MASK`
|
||||
@@ -473,15 +473,9 @@ The expected use of modifiers in GTK 4 is:
|
||||
Consequently, `GdkModifierIntent` and related APIs have been removed,
|
||||
and `<Control>` is preferred over `<Primary>` in accelerators.
|
||||
|
||||
In GTK 3 on macOS, the `<Primary>` modifier mapped to the <kbd>Command</kbd> key.
|
||||
In GTK 4, this is no longer the case: `<Primary>` is synonymous to `<Control>`.
|
||||
If you want to make your application to feel native on macOS,
|
||||
you need to add accelerators for macOS that use the `<Meta>` modifier.
|
||||
|
||||
A related change is that GTK 4 no longer supports the use of archaic
|
||||
X11 'real' modifiers with the names Mod1,..., Mod5, and `GDK_MOD1_MASK`
|
||||
has been renamed to `GDK_ALT_MASK` and `GDK_MOD2_MASK` has been renamed to
|
||||
`GDK_META_MASK`.
|
||||
has been renamed to `GDK_ALT_MASK`.
|
||||
|
||||
### Replace `GtkClipboard` with `GdkClipboard`
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ use a GtkLabel.
|
||||
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
|
||||
get the current style foreground color, using
|
||||
[method@Gtk.Widget.get_color].
|
||||
[method@Gtk.Widget.get_style_color].
|
||||
|
||||
## Local stylesheets are going away
|
||||
|
||||
@@ -73,103 +73,6 @@ 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())
|
||||
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
|
||||
|
||||
The GtkColorChooser, GtkFontChooser, GtkFileChooser and GtkAppChooser
|
||||
|
||||
@@ -64,6 +64,6 @@ GTK is divided into three parts:
|
||||
[cairo]: https://www.cairographics.org/manual/
|
||||
[opengl]: https://www.opengl.org/about/
|
||||
[vulkan]: https://www.vulkan.org/
|
||||
[pango]: https://docs.gtk.org/Pango/
|
||||
[pango]: https://docs.gtk.org/pango/
|
||||
[gdkpixbuf]: https://docs.gtk.org/gdk-pixbuf/
|
||||
[graphene]: https://ebassi.github.io/graphene/
|
||||
|
||||
@@ -155,7 +155,6 @@ Each property name is part of the `GtkAccessibleProperty` enumeration.
|
||||
| %GTK_ACCESSIBLE_PROPERTY_VALUE_MIN | “aria-valuemin” | double |
|
||||
| %GTK_ACCESSIBLE_PROPERTY_VALUE_NOW | “aria-valuenow” | double |
|
||||
| %GTK_ACCESSIBLE_PROPERTY_VALUE_TEXT | “aria-valuetext” | translatable string |
|
||||
| %GTK_ACCESSIBLE_PROPERTY_HELP_TEXT | N/A | translatable string |
|
||||
|
||||
#### List of accessible relations
|
||||
|
||||
@@ -217,10 +216,6 @@ are accessible as part of the development process. The GTK Inspector shows
|
||||
the accessible attributes of each widget, and also provides an overlay that
|
||||
can highlight accessibility issues.
|
||||
|
||||
If you support some non-standard keyboard interactions for a widget, you
|
||||
**should** set an appropriate `GTK_ACCESSIBLE_PROPERTY_HELP_TEXT` to help
|
||||
discoverability of the behavior.
|
||||
|
||||
It is possible to set accessible attributes in UI files as well:
|
||||
```xml
|
||||
<object class="GtkButton" id="button1">
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
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)
|
||||
+8
-16
@@ -41,10 +41,8 @@ G_BEGIN_DECLS
|
||||
|
||||
#ifdef GDK_ARRAY_NULL_TERMINATED
|
||||
#define GDK_ARRAY_REAL_SIZE(_size) ((_size) + 1)
|
||||
#define GDK_ARRAY_MAX_SIZE (G_MAXSIZE / sizeof (_T_) - 1)
|
||||
#else
|
||||
#define GDK_ARRAY_REAL_SIZE(_size) (_size)
|
||||
#define GDK_ARRAY_MAX_SIZE (G_MAXSIZE / sizeof (_T_))
|
||||
#endif
|
||||
|
||||
/* make this readable */
|
||||
@@ -179,23 +177,18 @@ G_GNUC_UNUSED static inline void
|
||||
gdk_array(reserve) (GdkArray *self,
|
||||
gsize n)
|
||||
{
|
||||
gsize new_capacity, size, capacity;
|
||||
gsize new_size, size;
|
||||
|
||||
if (G_UNLIKELY (n > GDK_ARRAY_MAX_SIZE))
|
||||
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;
|
||||
if (n <= gdk_array(get_capacity) (self))
|
||||
return;
|
||||
|
||||
size = gdk_array(get_size) (self);
|
||||
/* capacity * 2 can overflow, that's why we MAX() */
|
||||
new_capacity = MAX (GDK_ARRAY_REAL_SIZE (n), capacity * 2);
|
||||
new_size = ((gsize) 1) << g_bit_storage (MAX (GDK_ARRAY_REAL_SIZE (n), 16) - 1);
|
||||
|
||||
#ifdef GDK_ARRAY_PREALLOC
|
||||
if (self->start == self->preallocated)
|
||||
{
|
||||
self->start = g_new (_T_, new_capacity);
|
||||
self->start = g_new (_T_, new_size);
|
||||
memcpy (self->start, self->preallocated, sizeof (_T_) * GDK_ARRAY_REAL_SIZE (size));
|
||||
}
|
||||
else
|
||||
@@ -203,15 +196,15 @@ gdk_array(reserve) (GdkArray *self,
|
||||
#ifdef GDK_ARRAY_NULL_TERMINATED
|
||||
if (self->start == NULL)
|
||||
{
|
||||
self->start = g_new (_T_, new_capacity);
|
||||
self->start = g_new (_T_, new_size);
|
||||
*self->start = *(_T_[1]) { 0 };
|
||||
}
|
||||
else
|
||||
#endif
|
||||
self->start = g_renew (_T_, self->start, new_capacity);
|
||||
self->start = g_renew (_T_, self->start, new_size);
|
||||
|
||||
self->end = self->start + size;
|
||||
self->end_allocation = self->start + new_capacity;
|
||||
self->end_allocation = self->start + new_size;
|
||||
#ifdef GDK_ARRAY_NULL_TERMINATED
|
||||
self->end_allocation--;
|
||||
#endif
|
||||
@@ -319,7 +312,6 @@ gdk_array(get) (const GdkArray *self,
|
||||
#undef gdk_array_paste
|
||||
#undef gdk_array
|
||||
#undef GDK_ARRAY_REAL_SIZE
|
||||
#undef GDK_ARRAY_MAX_SIZE
|
||||
|
||||
#undef GDK_ARRAY_BY_VALUE
|
||||
#undef GDK_ARRAY_ELEMENT_TYPE
|
||||
|
||||
@@ -522,6 +522,8 @@ gdk_clipboard_get_content (GdkClipboard *clipboard)
|
||||
*
|
||||
* 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
|
||||
* lifetime of an application, so this function is typically called on
|
||||
* exit. Depending on the platform, the functionality may not be available
|
||||
@@ -636,6 +638,9 @@ gdk_clipboard_read_internal (GdkClipboard *clipboard,
|
||||
* Asynchronously requests an input stream to read the @clipboard's
|
||||
* 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
|
||||
* to fulfill the request, preferring the ones listed first.
|
||||
*/
|
||||
@@ -829,6 +834,9 @@ gdk_clipboard_read_value_internal (GdkClipboard *clipboard,
|
||||
* Asynchronously request the @clipboard contents converted to the given
|
||||
* @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`,
|
||||
* the value will be copied directly. Otherwise, GDK will try to use
|
||||
* [func@content_deserialize_async] to convert the clipboard's data.
|
||||
@@ -887,6 +895,9 @@ gdk_clipboard_read_value_finish (GdkClipboard *clipboard,
|
||||
*
|
||||
* 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].
|
||||
* Use that function or [method@Gdk.Clipboard.read_async] directly if you
|
||||
* need more control over the operation.
|
||||
@@ -949,6 +960,9 @@ gdk_clipboard_read_texture_finish (GdkClipboard *clipboard,
|
||||
*
|
||||
* 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].
|
||||
* Use that function or [method@Gdk.Clipboard.read_async] directly if you
|
||||
* need more control over the operation.
|
||||
|
||||
@@ -540,6 +540,9 @@ deserialize_not_found (GdkContentDeserializer *deserializer)
|
||||
*
|
||||
* The default I/O priority is %G_PRIORITY_DEFAULT (i.e. 0), and lower numbers
|
||||
* 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
|
||||
gdk_content_deserialize_async (GInputStream *stream,
|
||||
|
||||
@@ -279,6 +279,10 @@ gdk_content_provider_content_changed (GdkContentProvider *provider)
|
||||
* Asynchronously writes the contents of @provider to @stream in the given
|
||||
* @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
|
||||
* [method@Gdk.ContentProvider.ref_formats]. However, if the given `GType` is
|
||||
* not supported, `G_IO_ERROR_NOT_SUPPORTED` will be reported.
|
||||
|
||||
@@ -546,6 +546,9 @@ serialize_not_found (GdkContentSerializer *serializer)
|
||||
*
|
||||
* The default I/O priority is %G_PRIORITY_DEFAULT (i.e. 0), and lower numbers
|
||||
* 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
|
||||
gdk_content_serialize_async (GOutputStream *stream,
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ GdkCursor* gdk_cursor_new_from_name (const char *name,
|
||||
GdkCursor *fallback);
|
||||
|
||||
/**
|
||||
* GdkCursorGetTextureCallback:
|
||||
* GdkCursorGetTestureCallback:
|
||||
* @cursor: the `GdkCursor`
|
||||
* @cursor_size: the nominal cursor size, in application pixels
|
||||
* @scale: the device scale
|
||||
|
||||
+1
-6
@@ -163,8 +163,6 @@ gdk_dmabuf_get_egl_downloader (GdkDisplay *display,
|
||||
return NULL;
|
||||
|
||||
previous = gdk_gl_context_get_current ();
|
||||
if (previous)
|
||||
g_object_ref (previous);
|
||||
formats = gdk_dmabuf_formats_builder_new ();
|
||||
external = gdk_dmabuf_formats_builder_new ();
|
||||
|
||||
@@ -196,10 +194,7 @@ gdk_dmabuf_get_egl_downloader (GdkDisplay *display,
|
||||
}
|
||||
|
||||
if (previous)
|
||||
{
|
||||
gdk_gl_context_make_current (previous);
|
||||
g_object_unref (previous);
|
||||
}
|
||||
gdk_gl_context_make_current (previous);
|
||||
|
||||
return GDK_DMABUF_DOWNLOADER (renderer);
|
||||
}
|
||||
|
||||
@@ -62,13 +62,6 @@ struct _GdkDmabufTextureClass
|
||||
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_TYPE (GdkDmabufTexture, gdk_dmabuf_texture, GDK_TYPE_TEXTURE)
|
||||
|
||||
+6
-2
@@ -134,7 +134,7 @@ gdk_drop_read_local_async (GdkDrop *self,
|
||||
|
||||
g_object_get (priv->drag, "content", &content, NULL);
|
||||
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);
|
||||
mime_type = gdk_content_formats_match_mime_type (content_formats, formats);
|
||||
|
||||
@@ -784,7 +784,7 @@ gdk_drop_read_value_internal (GdkDrop *self,
|
||||
GdkContentFormats *formats;
|
||||
GValue *value;
|
||||
GTask *task;
|
||||
|
||||
|
||||
g_return_if_fail (priv->state != GDK_DROP_STATE_FINISHED);
|
||||
|
||||
task = g_task_new (self, cancellable, callback, user_data);
|
||||
@@ -849,6 +849,10 @@ gdk_drop_read_value_internal (GdkDrop *self,
|
||||
* Asynchronously request the drag operation's contents converted
|
||||
* 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
|
||||
* `GType`, the value will be copied directly. Otherwise, GDK will
|
||||
* try to use [func@Gdk.content_deserialize_async] to convert the data.
|
||||
|
||||
+3
-3
@@ -98,9 +98,9 @@ typedef enum
|
||||
* @GDK_BUTTON3_MASK: the third mouse button.
|
||||
* @GDK_BUTTON4_MASK: the fourth mouse button.
|
||||
* @GDK_BUTTON5_MASK: the fifth mouse button.
|
||||
* @GDK_SUPER_MASK: the Super modifier.
|
||||
* @GDK_HYPER_MASK: the Hyper modifier.
|
||||
* @GDK_META_MASK: the Meta modifier. Maps to Command on macOS.
|
||||
* @GDK_SUPER_MASK: the Super modifier
|
||||
* @GDK_HYPER_MASK: the Hyper modifier
|
||||
* @GDK_META_MASK: the Meta modifier
|
||||
*
|
||||
* Flags to indicate the state of modifier keys and mouse buttons
|
||||
* in events.
|
||||
|
||||
@@ -1371,8 +1371,6 @@ gdk_event_get_modifier_state (GdkEvent *event)
|
||||
* Extract the event surface relative x/y coordinates from an event.
|
||||
*
|
||||
* This position is in [surface coordinates](coordinates.html).
|
||||
*
|
||||
* Returns: whether the positions were set
|
||||
*/
|
||||
gboolean
|
||||
gdk_event_get_position (GdkEvent *event,
|
||||
|
||||
+2
-7
@@ -152,13 +152,6 @@ enum {
|
||||
|
||||
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_ABSTRACT_TYPE_WITH_PRIVATE (GdkGLContext, gdk_gl_context, GDK_TYPE_DRAW_CONTEXT)
|
||||
@@ -1963,6 +1956,8 @@ gdk_gl_context_get_glsl_version_string (GdkGLContext *self)
|
||||
return "#version 310 es";
|
||||
else if (gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 0)))
|
||||
return "#version 300 es";
|
||||
else if (gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 0)))
|
||||
return "#version 300 es";
|
||||
else
|
||||
return "#version 100";
|
||||
}
|
||||
|
||||
+2
-1
@@ -471,7 +471,8 @@ gdk_gl_texture_release (GdkGLTexture *self)
|
||||
g_return_if_fail (self->saved == NULL);
|
||||
|
||||
texture = GDK_TEXTURE (self);
|
||||
self->saved = GDK_TEXTURE (gdk_memory_texture_from_texture (texture));
|
||||
self->saved = GDK_TEXTURE (gdk_memory_texture_from_texture (texture,
|
||||
gdk_texture_get_format (texture)));
|
||||
|
||||
drop_gl_resources (self);
|
||||
}
|
||||
|
||||
@@ -327,7 +327,6 @@ ADD_ALPHA_FUNC(r8g8b8_to_a8b8g8r8, 0, 1, 2, 3, 2, 1, 0)
|
||||
|
||||
struct _GdkMemoryFormatDescription
|
||||
{
|
||||
const char *name;
|
||||
GdkMemoryAlpha alpha;
|
||||
GdkMemoryFormat premultiplied;
|
||||
GdkMemoryFormat straight;
|
||||
@@ -367,7 +366,6 @@ struct _GdkMemoryFormatDescription
|
||||
|
||||
static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
[GDK_MEMORY_B8G8R8A8_PREMULTIPLIED] = {
|
||||
.name = "*BGRA8",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_B8G8R8A8_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_B8G8R8A8,
|
||||
@@ -396,7 +394,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = b8g8r8a8_premultiplied_from_float,
|
||||
},
|
||||
[GDK_MEMORY_A8R8G8B8_PREMULTIPLIED] = {
|
||||
.name = "*ARGB8",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_A8R8G8B8_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_A8R8G8B8,
|
||||
@@ -425,7 +422,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = a8r8g8b8_premultiplied_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R8G8B8A8_PREMULTIPLIED] = {
|
||||
.name = "*RGBA8",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_R8G8B8A8,
|
||||
@@ -453,7 +449,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r8g8b8a8_premultiplied_from_float,
|
||||
},
|
||||
[GDK_MEMORY_A8B8G8R8_PREMULTIPLIED] = {
|
||||
.name = "*ABGR8",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_A8B8G8R8_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_A8B8G8R8,
|
||||
@@ -482,7 +477,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = a8b8g8r8_premultiplied_from_float,
|
||||
},
|
||||
[GDK_MEMORY_B8G8R8A8] = {
|
||||
.name = "BGRA8",
|
||||
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
|
||||
.premultiplied = GDK_MEMORY_B8G8R8A8_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_B8G8R8A8,
|
||||
@@ -511,7 +505,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = b8g8r8a8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_A8R8G8B8] = {
|
||||
.name = "ARGB8",
|
||||
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
|
||||
.premultiplied = GDK_MEMORY_A8R8G8B8_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_A8R8G8B8,
|
||||
@@ -540,7 +533,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = a8r8g8b8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R8G8B8A8] = {
|
||||
.name = "RGBA8",
|
||||
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
|
||||
.premultiplied = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_R8G8B8A8,
|
||||
@@ -568,7 +560,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r8g8b8a8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_A8B8G8R8] = {
|
||||
.name = "ABGR8",
|
||||
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
|
||||
.premultiplied = GDK_MEMORY_A8B8G8R8_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_A8B8G8R8,
|
||||
@@ -597,7 +588,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = a8b8g8r8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_B8G8R8X8] = {
|
||||
.name = "BGRX8",
|
||||
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
|
||||
.premultiplied = GDK_MEMORY_B8G8R8X8,
|
||||
.straight = GDK_MEMORY_B8G8R8X8,
|
||||
@@ -627,7 +617,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = b8g8r8x8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_X8R8G8B8] = {
|
||||
.name = "XRGB8",
|
||||
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
|
||||
.premultiplied = GDK_MEMORY_X8R8G8B8,
|
||||
.straight = GDK_MEMORY_X8R8G8B8,
|
||||
@@ -657,7 +646,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = x8r8g8b8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R8G8B8X8] = {
|
||||
.name = "RGBX8",
|
||||
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
|
||||
.premultiplied = GDK_MEMORY_R8G8B8X8,
|
||||
.straight = GDK_MEMORY_R8G8B8X8,
|
||||
@@ -686,7 +674,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r8g8b8x8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_X8B8G8R8] = {
|
||||
.name = "XBGR8",
|
||||
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
|
||||
.premultiplied = GDK_MEMORY_X8B8G8R8,
|
||||
.straight = GDK_MEMORY_X8B8G8R8,
|
||||
@@ -716,7 +703,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = x8b8g8r8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R8G8B8] = {
|
||||
.name = "RGB8",
|
||||
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
|
||||
.premultiplied = GDK_MEMORY_R8G8B8,
|
||||
.straight = GDK_MEMORY_R8G8B8,
|
||||
@@ -745,7 +731,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r8g8b8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_B8G8R8] = {
|
||||
.name = "BGR8",
|
||||
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
|
||||
.premultiplied = GDK_MEMORY_B8G8R8,
|
||||
.straight = GDK_MEMORY_B8G8R8,
|
||||
@@ -775,7 +760,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = b8g8r8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R16G16B16] = {
|
||||
.name = "RGB16",
|
||||
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
|
||||
.premultiplied = GDK_MEMORY_R16G16B16,
|
||||
.straight = GDK_MEMORY_R16G16B16,
|
||||
@@ -807,7 +791,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r16g16b16_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R16G16B16A16_PREMULTIPLIED] = {
|
||||
.name = "*RGBA16",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_R16G16B16A16_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_R16G16B16A16,
|
||||
@@ -838,7 +821,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r16g16b16a16_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R16G16B16A16] = {
|
||||
.name = "RGBA16",
|
||||
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
|
||||
.premultiplied = GDK_MEMORY_R16G16B16A16_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_R16G16B16A16,
|
||||
@@ -869,7 +851,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r16g16b16a16_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R16G16B16_FLOAT] = {
|
||||
.name = "RGBA16f",
|
||||
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
|
||||
.premultiplied = GDK_MEMORY_R16G16B16_FLOAT,
|
||||
.straight = GDK_MEMORY_R16G16B16_FLOAT,
|
||||
@@ -900,7 +881,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r16g16b16_float_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED] = {
|
||||
.name = "*RGBA16f",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_R16G16B16A16_FLOAT,
|
||||
@@ -930,7 +910,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r16g16b16a16_float_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R16G16B16A16_FLOAT] = {
|
||||
.name = "RGBA16f",
|
||||
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
|
||||
.premultiplied = GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_R16G16B16A16_FLOAT,
|
||||
@@ -960,7 +939,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r16g16b16a16_float_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R32G32B32_FLOAT] = {
|
||||
.name = "RGB32f",
|
||||
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
|
||||
.premultiplied = GDK_MEMORY_R32G32B32_FLOAT,
|
||||
.straight = GDK_MEMORY_R32G32B32_FLOAT,
|
||||
@@ -991,7 +969,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r32g32b32_float_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED] = {
|
||||
.name = "*RGBA32f",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_R32G32B32A32_FLOAT,
|
||||
@@ -1021,7 +998,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r32g32b32a32_float_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R32G32B32A32_FLOAT] = {
|
||||
.name = "RGBA32f",
|
||||
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
|
||||
.premultiplied = GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_R32G32B32A32_FLOAT,
|
||||
@@ -1051,7 +1027,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r32g32b32a32_float_from_float,
|
||||
},
|
||||
[GDK_MEMORY_G8A8_PREMULTIPLIED] = {
|
||||
.name = "*GA8",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_G8A8_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_G8A8,
|
||||
@@ -1080,7 +1055,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = g8a8_premultiplied_from_float,
|
||||
},
|
||||
[GDK_MEMORY_G8A8] = {
|
||||
.name = "GA8",
|
||||
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
|
||||
.premultiplied = GDK_MEMORY_G8A8_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_G8A8,
|
||||
@@ -1109,7 +1083,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = g8a8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_G8] = {
|
||||
.name = "G8",
|
||||
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
|
||||
.premultiplied = GDK_MEMORY_G8,
|
||||
.straight = GDK_MEMORY_G8,
|
||||
@@ -1138,7 +1111,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = g8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_G16A16_PREMULTIPLIED] = {
|
||||
.name = "*GA16",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_G16A16_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_G16A16,
|
||||
@@ -1170,7 +1142,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = g16a16_premultiplied_from_float,
|
||||
},
|
||||
[GDK_MEMORY_G16A16] = {
|
||||
.name = "GA16",
|
||||
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
|
||||
.premultiplied = GDK_MEMORY_G16A16_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_G16A16,
|
||||
@@ -1202,7 +1173,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = g16a16_from_float,
|
||||
},
|
||||
[GDK_MEMORY_G16] = {
|
||||
.name = "G16",
|
||||
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
|
||||
.premultiplied = GDK_MEMORY_G16,
|
||||
.straight = GDK_MEMORY_G16,
|
||||
@@ -1234,7 +1204,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = g16_from_float,
|
||||
},
|
||||
[GDK_MEMORY_A8] = {
|
||||
.name = "A8",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_A8,
|
||||
.straight = GDK_MEMORY_A8,
|
||||
@@ -1263,7 +1232,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = a8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_A16] = {
|
||||
.name = "A16",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_A16,
|
||||
.straight = GDK_MEMORY_A16,
|
||||
@@ -1295,7 +1263,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = a16_from_float,
|
||||
},
|
||||
[GDK_MEMORY_A16_FLOAT] = {
|
||||
.name = "A16f",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_A16_FLOAT,
|
||||
.straight = GDK_MEMORY_A16_FLOAT,
|
||||
@@ -1326,7 +1293,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = a16_float_from_float,
|
||||
},
|
||||
[GDK_MEMORY_A32_FLOAT] = {
|
||||
.name = "A32f",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_A32_FLOAT,
|
||||
.straight = GDK_MEMORY_A32_FLOAT,
|
||||
@@ -1695,12 +1661,6 @@ gdk_memory_format_get_dmabuf_fourcc (GdkMemoryFormat format)
|
||||
#endif
|
||||
}
|
||||
|
||||
const char *
|
||||
gdk_memory_format_get_name (GdkMemoryFormat format)
|
||||
{
|
||||
return memory_formats[format].name;
|
||||
}
|
||||
|
||||
static void
|
||||
premultiply (float *rgba,
|
||||
gsize n)
|
||||
|
||||
@@ -75,7 +75,7 @@ VkFormat gdk_memory_format_vk_rgba_format (GdkMemoryFormat
|
||||
VkComponentMapping *out_swizzle);
|
||||
#endif
|
||||
guint32 gdk_memory_format_get_dmabuf_fourcc (GdkMemoryFormat format);
|
||||
const char * gdk_memory_format_get_name (GdkMemoryFormat format);
|
||||
|
||||
|
||||
void gdk_memory_convert (guchar *dest_data,
|
||||
gsize dest_stride,
|
||||
|
||||
+11
-5
@@ -202,7 +202,8 @@ gdk_memory_texture_new_subtexture (GdkMemoryTexture *source,
|
||||
}
|
||||
|
||||
GdkMemoryTexture *
|
||||
gdk_memory_texture_from_texture (GdkTexture *texture)
|
||||
gdk_memory_texture_from_texture (GdkTexture *texture,
|
||||
GdkMemoryFormat format)
|
||||
{
|
||||
GdkTexture *result;
|
||||
GBytes *bytes;
|
||||
@@ -212,16 +213,21 @@ gdk_memory_texture_from_texture (GdkTexture *texture)
|
||||
g_return_val_if_fail (GDK_IS_TEXTURE (texture), NULL);
|
||||
|
||||
if (GDK_IS_MEMORY_TEXTURE (texture))
|
||||
return g_object_ref (GDK_MEMORY_TEXTURE (texture));
|
||||
{
|
||||
GdkMemoryTexture *memtex = GDK_MEMORY_TEXTURE (texture);
|
||||
|
||||
stride = texture->width * gdk_memory_format_bytes_per_pixel (texture->format);
|
||||
if (gdk_texture_get_format (texture) == format)
|
||||
return g_object_ref (memtex);
|
||||
}
|
||||
|
||||
stride = texture->width * gdk_memory_format_bytes_per_pixel (format);
|
||||
data = g_malloc_n (stride, texture->height);
|
||||
|
||||
gdk_texture_do_download (texture, texture->format, data, stride);
|
||||
gdk_texture_do_download (texture, format, data, stride);
|
||||
bytes = g_bytes_new_take (data, stride * texture->height);
|
||||
result = gdk_memory_texture_new (texture->width,
|
||||
texture->height,
|
||||
texture->format,
|
||||
format,
|
||||
bytes,
|
||||
stride);
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
@@ -28,7 +28,8 @@ G_BEGIN_DECLS
|
||||
#define GDK_MEMORY_GDK_PIXBUF_OPAQUE GDK_MEMORY_R8G8B8
|
||||
#define GDK_MEMORY_GDK_PIXBUF_ALPHA GDK_MEMORY_R8G8B8A8
|
||||
|
||||
GdkMemoryTexture * gdk_memory_texture_from_texture (GdkTexture *texture);
|
||||
GdkMemoryTexture * gdk_memory_texture_from_texture (GdkTexture *texture,
|
||||
GdkMemoryFormat format);
|
||||
GdkTexture * gdk_memory_texture_new_subtexture (GdkMemoryTexture *texture,
|
||||
int x,
|
||||
int y,
|
||||
|
||||
+1
-1
@@ -109,7 +109,7 @@ gdk_popup_default_init (GdkPopupInterface *iface)
|
||||
*
|
||||
* Present @popup after having processed the `GdkPopupLayout` rules.
|
||||
*
|
||||
* If the popup was previously not showing, it will be shown,
|
||||
* If the popup was previously now showing, it will be showed,
|
||||
* otherwise it will change position according to @layout.
|
||||
*
|
||||
* After calling this function, the result should be handled in response
|
||||
|
||||
+2
-13
@@ -396,18 +396,10 @@ gboolean
|
||||
*/
|
||||
char *
|
||||
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)
|
||||
{
|
||||
g_string_append_printf (string,
|
||||
"rgb(%d,%d,%d)",
|
||||
return g_strdup_printf ("rgb(%d,%d,%d)",
|
||||
(int)(0.5 + CLAMP (rgba->red, 0., 1.) * 255.),
|
||||
(int)(0.5 + CLAMP (rgba->green, 0., 1.) * 255.),
|
||||
(int)(0.5 + CLAMP (rgba->blue, 0., 1.) * 255.));
|
||||
@@ -418,15 +410,12 @@ gdk_rgba_print (const GdkRGBA *rgba,
|
||||
|
||||
g_ascii_formatd (alpha, G_ASCII_DTOSTR_BUF_SIZE, "%g", CLAMP (rgba->alpha, 0, 1));
|
||||
|
||||
g_string_append_printf (string,
|
||||
"rgba(%d,%d,%d,%s)",
|
||||
return g_strdup_printf ("rgba(%d,%d,%d,%s)",
|
||||
(int)(0.5 + CLAMP (rgba->red, 0., 1.) * 255.),
|
||||
(int)(0.5 + CLAMP (rgba->green, 0., 1.) * 255.),
|
||||
(int)(0.5 + CLAMP (rgba->blue, 0., 1.) * 255.),
|
||||
alpha);
|
||||
}
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
||||
@@ -72,8 +72,5 @@ _gdk_rgba_equal (gconstpointer p1,
|
||||
rgba1->alpha == rgba2->alpha;
|
||||
}
|
||||
|
||||
GString * gdk_rgba_print (const GdkRGBA *rgba,
|
||||
GString *string);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -50,13 +50,6 @@
|
||||
#include "loaders/gdktiffprivate.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)
|
||||
|
||||
/* HACK: So we don't need to include any (not-yet-created) GSK or GTK headers */
|
||||
|
||||
+3
-4
@@ -745,10 +745,6 @@ gdk_toplevel_begin_move (GdkToplevel *toplevel,
|
||||
* @toplevel: a `GdkToplevel`
|
||||
* @gesture: a `GdkTitlebarGesture`
|
||||
*
|
||||
* Performs a title bar gesture.
|
||||
*
|
||||
* Returns: whether the gesture was performed
|
||||
*
|
||||
* Since: 4.4
|
||||
*/
|
||||
gboolean
|
||||
@@ -771,6 +767,9 @@ gdk_toplevel_titlebar_gesture (GdkToplevel *toplevel,
|
||||
* This function asynchronously obtains a handle for a toplevel surface
|
||||
* 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
|
||||
* exported.
|
||||
*
|
||||
|
||||
+3
-6
@@ -118,12 +118,9 @@ typedef enum
|
||||
|
||||
/**
|
||||
* GdkTitlebarGesture:
|
||||
* @GDK_TITLEBAR_GESTURE_DOUBLE_CLICK: double click gesture
|
||||
* @GDK_TITLEBAR_GESTURE_RIGHT_CLICK: right click gesture
|
||||
* @GDK_TITLEBAR_GESTURE_MIDDLE_CLICK: middle click gesture
|
||||
*
|
||||
* The kind of title bar gesture to emit with
|
||||
* [method@Gdk.Toplevel.titlebar_gesture].
|
||||
* @GDK_TITLEBAR_GESTURE_DOUBLE_CLICK:
|
||||
* @GDK_TITLEBAR_GESTURE_RIGHT_CLICK:
|
||||
* @GDK_TITLEBAR_GESTURE_MIDDLE_CLICK:
|
||||
*
|
||||
* Since: 4.4
|
||||
*/
|
||||
|
||||
+1
-1
@@ -99,7 +99,7 @@ typedef struct _GdkVulkanContext GdkVulkanContext;
|
||||
typedef struct _GdkDmabufFormats GdkDmabufFormats;
|
||||
typedef struct _GdkDmabufTexture GdkDmabufTexture;
|
||||
|
||||
/*<private>
|
||||
/*
|
||||
* GDK_DECLARE_INTERNAL_TYPE:
|
||||
* @ModuleObjName: The name of the new type, in camel case (like GtkWidget)
|
||||
* @module_obj_name: The name of the new type in lowercase, with words
|
||||
|
||||
+36
-64
@@ -30,7 +30,6 @@
|
||||
#include "gdkdmabuftextureprivate.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkprofilerprivate.h"
|
||||
#include "gdkmemorytexture.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <math.h>
|
||||
|
||||
@@ -73,7 +72,8 @@ struct _GdkVulkanContextPrivate {
|
||||
VkSurfaceFormatKHR vk_format;
|
||||
GdkMemoryFormat gdk_format;
|
||||
} formats[4];
|
||||
GdkMemoryDepth current_depth;
|
||||
GdkMemoryDepth current_format;
|
||||
GdkMemoryFormat offscreen_formats[4];
|
||||
|
||||
VkSwapchainKHR swapchain;
|
||||
VkSemaphore draw_semaphore;
|
||||
@@ -94,13 +94,6 @@ enum {
|
||||
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)
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
@@ -473,8 +466,8 @@ gdk_vulkan_context_check_swapchain (GdkVulkanContext *context,
|
||||
.minImageCount = CLAMP (4,
|
||||
capabilities.minImageCount,
|
||||
capabilities.maxImageCount ? capabilities.maxImageCount : G_MAXUINT32),
|
||||
.imageFormat = priv->formats[priv->current_depth].vk_format.format,
|
||||
.imageColorSpace = priv->formats[priv->current_depth].vk_format.colorSpace,
|
||||
.imageFormat = priv->formats[priv->current_format].vk_format.format,
|
||||
.imageColorSpace = priv->formats[priv->current_format].vk_format.colorSpace,
|
||||
.imageExtent = capabilities.currentExtent,
|
||||
.imageArrayLayers = 1,
|
||||
.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,
|
||||
@@ -614,8 +607,7 @@ physical_device_check_features (VkPhysicalDevice device)
|
||||
features |= GDK_VULKAN_FEATURE_YCBCR;
|
||||
|
||||
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_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME))
|
||||
physical_device_supports_extension (device, VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME))
|
||||
features |= GDK_VULKAN_FEATURE_DMABUF;
|
||||
|
||||
if (physical_device_supports_extension (device, VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME))
|
||||
@@ -640,54 +632,33 @@ gdk_vulkan_context_begin_frame (GdkDrawContext *draw_context,
|
||||
{
|
||||
GdkVulkanContext *context = GDK_VULKAN_CONTEXT (draw_context);
|
||||
GdkVulkanContextPrivate *priv = gdk_vulkan_context_get_instance_private (context);
|
||||
VkResult acquire_result;
|
||||
guint i;
|
||||
|
||||
if (depth != priv->current_depth)
|
||||
if (depth != priv->current_format)
|
||||
{
|
||||
if (priv->formats[depth].gdk_format != priv->formats[priv->current_depth].gdk_format)
|
||||
if (priv->formats[depth].gdk_format != priv->formats[priv->current_format].gdk_format)
|
||||
{
|
||||
GdkMemoryDepth old_depth = priv->current_depth;
|
||||
GError *error = NULL;
|
||||
|
||||
priv->current_depth = depth;
|
||||
if (!gdk_vulkan_context_check_swapchain (context, &error))
|
||||
{
|
||||
g_warning ("%s", error->message);
|
||||
g_error_free (error);
|
||||
priv->current_depth = old_depth;
|
||||
return;
|
||||
}
|
||||
}
|
||||
priv->current_format = depth;
|
||||
}
|
||||
for (i = 0; i < priv->n_images; i++)
|
||||
{
|
||||
cairo_region_union (priv->regions[i], region);
|
||||
}
|
||||
|
||||
acquire_next_image:
|
||||
acquire_result = GDK_VK_CHECK (vkAcquireNextImageKHR, gdk_vulkan_context_get_device (context),
|
||||
priv->swapchain,
|
||||
UINT64_MAX,
|
||||
priv->draw_semaphore,
|
||||
VK_NULL_HANDLE,
|
||||
&priv->draw_index);
|
||||
if ((acquire_result == VK_ERROR_OUT_OF_DATE_KHR) ||
|
||||
(acquire_result == VK_SUBOPTIMAL_KHR))
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
GDK_DEBUG (VULKAN, "Recreating the swapchain");
|
||||
|
||||
if (!gdk_vulkan_context_check_swapchain (context, &error))
|
||||
{
|
||||
g_warning ("%s", error->message);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
goto acquire_next_image;
|
||||
}
|
||||
GDK_VK_CHECK (vkAcquireNextImageKHR, gdk_vulkan_context_get_device (context),
|
||||
priv->swapchain,
|
||||
UINT64_MAX,
|
||||
priv->draw_semaphore,
|
||||
VK_NULL_HANDLE,
|
||||
&priv->draw_index);
|
||||
|
||||
cairo_region_union (region, priv->regions[priv->draw_index]);
|
||||
}
|
||||
@@ -827,6 +798,11 @@ gdk_vulkan_context_real_init (GInitable *initable,
|
||||
if (!priv->vulkan_ref)
|
||||
return FALSE;
|
||||
|
||||
priv->offscreen_formats[GDK_MEMORY_U8] = GDK_MEMORY_B8G8R8A8_PREMULTIPLIED;
|
||||
priv->offscreen_formats[GDK_MEMORY_U16] = GDK_MEMORY_R16G16B16A16_PREMULTIPLIED;
|
||||
priv->offscreen_formats[GDK_MEMORY_FLOAT16] = GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED;
|
||||
priv->offscreen_formats[GDK_MEMORY_FLOAT32] = GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED;
|
||||
|
||||
if (surface == NULL)
|
||||
{
|
||||
for (i = 0; i < G_N_ELEMENTS (priv->formats); i++)
|
||||
@@ -882,6 +858,7 @@ gdk_vulkan_context_real_init (GInitable *initable,
|
||||
{
|
||||
priv->formats[GDK_MEMORY_U8].vk_format = formats[i];
|
||||
priv->formats[GDK_MEMORY_U8].gdk_format = GDK_MEMORY_B8G8R8A8_PREMULTIPLIED;
|
||||
priv->offscreen_formats[GDK_MEMORY_U8] = GDK_MEMORY_B8G8R8A8_PREMULTIPLIED;
|
||||
};
|
||||
break;
|
||||
|
||||
@@ -958,6 +935,15 @@ out_surface:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GdkMemoryFormat
|
||||
gdk_vulkan_context_get_offscreen_format (GdkVulkanContext *context,
|
||||
GdkMemoryDepth depth)
|
||||
{
|
||||
GdkVulkanContextPrivate *priv = gdk_vulkan_context_get_instance_private (context);
|
||||
|
||||
return priv->offscreen_formats[depth];
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_vulkan_context_initable_init (GInitableIface *iface)
|
||||
{
|
||||
@@ -1279,18 +1265,9 @@ gdk_vulkan_context_get_image_format (GdkVulkanContext *context)
|
||||
|
||||
g_return_val_if_fail (GDK_IS_VULKAN_CONTEXT (context), VK_FORMAT_UNDEFINED);
|
||||
|
||||
return priv->formats[priv->current_depth].vk_format.format;
|
||||
return priv->formats[priv->current_format].vk_format.format;
|
||||
}
|
||||
|
||||
GdkMemoryFormat
|
||||
gdk_vulkan_context_get_memory_format (GdkVulkanContext *context)
|
||||
{
|
||||
GdkVulkanContextPrivate *priv = gdk_vulkan_context_get_instance_private (context);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_VULKAN_CONTEXT (context), GDK_MEMORY_DEFAULT);
|
||||
|
||||
return priv->formats[priv->current_depth].gdk_format;
|
||||
}
|
||||
/**
|
||||
* gdk_vulkan_context_get_n_images:
|
||||
* @context: a `GdkVulkanContext`
|
||||
@@ -1522,7 +1499,6 @@ 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_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_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME);
|
||||
@@ -1863,9 +1839,8 @@ gdk_display_unref_vulkan (GdkDisplay *display)
|
||||
{
|
||||
g_free (key);
|
||||
vkDestroyShaderModule (display->vk_device,
|
||||
*((VkShaderModule *)value),
|
||||
value,
|
||||
NULL);
|
||||
g_free (value);
|
||||
}
|
||||
g_hash_table_unref (display->vk_shader_modules);
|
||||
|
||||
@@ -1993,13 +1968,13 @@ VkShaderModule
|
||||
gdk_display_get_vk_shader_module (GdkDisplay *self,
|
||||
const char *resource_name)
|
||||
{
|
||||
VkShaderModule *shader;
|
||||
VkShaderModule shader;
|
||||
GError *error = NULL;
|
||||
GBytes *bytes;
|
||||
|
||||
shader = g_hash_table_lookup (self->vk_shader_modules, resource_name);
|
||||
if (shader)
|
||||
return *shader;
|
||||
return shader;
|
||||
|
||||
bytes = g_resources_lookup_data (resource_name, 0, &error);
|
||||
if (bytes == NULL)
|
||||
@@ -2009,7 +1984,6 @@ gdk_display_get_vk_shader_module (GdkDisplay *self,
|
||||
return VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
shader = g_new0 (VkShaderModule, 1);
|
||||
if (GDK_VK_CHECK (vkCreateShaderModule, self->vk_device,
|
||||
&(VkShaderModuleCreateInfo) {
|
||||
.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO,
|
||||
@@ -2017,20 +1991,18 @@ gdk_display_get_vk_shader_module (GdkDisplay *self,
|
||||
.pCode = (uint32_t *) g_bytes_get_data (bytes, NULL),
|
||||
},
|
||||
NULL,
|
||||
shader) == VK_SUCCESS)
|
||||
&shader) == VK_SUCCESS)
|
||||
{
|
||||
g_hash_table_insert (self->vk_shader_modules, g_strdup (resource_name), shader);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_free (shader);
|
||||
|
||||
return VK_NULL_HANDLE;
|
||||
shader = VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
return *shader;
|
||||
return shader;
|
||||
}
|
||||
|
||||
#else /* GDK_RENDERING_VULKAN */
|
||||
|
||||
@@ -94,13 +94,15 @@ VkDevice gdk_vulkan_context_get_device (GdkVulk
|
||||
VkQueue gdk_vulkan_context_get_queue (GdkVulkanContext *context);
|
||||
uint32_t gdk_vulkan_context_get_queue_family_index (GdkVulkanContext *context);
|
||||
VkFormat gdk_vulkan_context_get_image_format (GdkVulkanContext *context);
|
||||
GdkMemoryFormat gdk_vulkan_context_get_memory_format (GdkVulkanContext *context);
|
||||
uint32_t gdk_vulkan_context_get_n_images (GdkVulkanContext *context);
|
||||
VkImage gdk_vulkan_context_get_image (GdkVulkanContext *context,
|
||||
guint id);
|
||||
uint32_t gdk_vulkan_context_get_draw_index (GdkVulkanContext *context);
|
||||
VkSemaphore gdk_vulkan_context_get_draw_semaphore (GdkVulkanContext *context);
|
||||
|
||||
GdkMemoryFormat gdk_vulkan_context_get_offscreen_format (GdkVulkanContext *context,
|
||||
GdkMemoryDepth depth);
|
||||
|
||||
#else /* !GDK_RENDERING_VULKAN */
|
||||
|
||||
|
||||
|
||||
@@ -176,7 +176,6 @@ void _gdk_macos_display_set_drop (GdkMacosDisp
|
||||
GdkDrop *drop);
|
||||
void _gdk_macos_display_position_surface (GdkMacosDisplay *self,
|
||||
GdkMacosSurface *surface,
|
||||
GdkMonitor *monitor,
|
||||
int *x,
|
||||
int *y);
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#include "gdk/gdkeventsprivate.h"
|
||||
|
||||
#define GDK_MOD2_MASK (1 << 4)
|
||||
#define GRIP_WIDTH 15
|
||||
#define GRIP_HEIGHT 15
|
||||
#define GDK_LION_RESIZE 5
|
||||
@@ -174,7 +175,7 @@ get_keyboard_modifiers_from_ns_flags (NSUInteger nsflags)
|
||||
if (nsflags & NSEventModifierFlagOption)
|
||||
modifiers |= GDK_ALT_MASK;
|
||||
if (nsflags & NSEventModifierFlagCommand)
|
||||
modifiers |= GDK_META_MASK;
|
||||
modifiers |= GDK_MOD2_MASK;
|
||||
|
||||
return modifiers;
|
||||
}
|
||||
@@ -313,6 +314,13 @@ get_group_from_ns_event (NSEvent *nsevent)
|
||||
return ([nsevent modifierFlags] & NSEventModifierFlagOption) ? 1 : 0;
|
||||
}
|
||||
|
||||
static void
|
||||
add_virtual_modifiers (GdkModifierType *state)
|
||||
{
|
||||
if (*state & GDK_MOD2_MASK)
|
||||
*state |= GDK_META_MASK;
|
||||
}
|
||||
|
||||
static GdkEvent *
|
||||
fill_key_event (GdkMacosDisplay *display,
|
||||
GdkMacosSurface *surface,
|
||||
@@ -359,7 +367,7 @@ fill_key_event (GdkMacosDisplay *display,
|
||||
{
|
||||
case GDK_KEY_Meta_R:
|
||||
case GDK_KEY_Meta_L:
|
||||
mask = GDK_META_MASK;
|
||||
mask = GDK_MOD2_MASK;
|
||||
break;
|
||||
case GDK_KEY_Shift_R:
|
||||
case GDK_KEY_Shift_L:
|
||||
@@ -387,6 +395,7 @@ fill_key_event (GdkMacosDisplay *display,
|
||||
}
|
||||
|
||||
state |= _gdk_macos_display_get_current_mouse_modifiers (display);
|
||||
add_virtual_modifiers (&state);
|
||||
|
||||
translated.keyval = keyval;
|
||||
translated.consumed = consumed;
|
||||
|
||||
@@ -82,7 +82,6 @@ has_surface_at_origin (const GList *surfaces,
|
||||
static void
|
||||
_gdk_macos_display_position_toplevel (GdkMacosDisplay *self,
|
||||
GdkMacosSurface *surface,
|
||||
GdkMonitor *selected_monitor,
|
||||
int *x,
|
||||
int *y)
|
||||
{
|
||||
@@ -96,11 +95,7 @@ _gdk_macos_display_position_toplevel (GdkMacosDisplay *self,
|
||||
g_assert (GDK_IS_MACOS_TOPLEVEL_SURFACE (surface));
|
||||
|
||||
mouse = [NSEvent mouseLocation];
|
||||
if (!selected_monitor)
|
||||
monitor = _gdk_macos_display_get_monitor_at_display_coords (self, mouse.x, mouse.y);
|
||||
else
|
||||
monitor = selected_monitor;
|
||||
|
||||
monitor = _gdk_macos_display_get_monitor_at_display_coords (self, mouse.x, mouse.y);
|
||||
gdk_macos_monitor_get_workarea (monitor, &workarea);
|
||||
|
||||
/* First place at top-left of current monitor */
|
||||
@@ -109,7 +104,7 @@ _gdk_macos_display_position_toplevel (GdkMacosDisplay *self,
|
||||
surface_rect.x = workarea.x + ((workarea.width - surface_rect.width) / 2);
|
||||
surface_rect.y = workarea.y + ((workarea.height - surface_rect.height) / 2);
|
||||
|
||||
_gdk_macos_monitor_clamp (GDK_MACOS_MONITOR (selected_monitor ? selected_monitor : surface->best_monitor), &surface_rect);
|
||||
_gdk_macos_monitor_clamp (GDK_MACOS_MONITOR (surface->best_monitor), &surface_rect);
|
||||
|
||||
*x = surface_rect.x;
|
||||
*y = surface_rect.y;
|
||||
@@ -143,7 +138,6 @@ _gdk_macos_display_position_toplevel (GdkMacosDisplay *self,
|
||||
void
|
||||
_gdk_macos_display_position_surface (GdkMacosDisplay *self,
|
||||
GdkMacosSurface *surface,
|
||||
GdkMonitor *monitor,
|
||||
int *x,
|
||||
int *y)
|
||||
{
|
||||
@@ -157,5 +151,5 @@ _gdk_macos_display_position_surface (GdkMacosDisplay *self,
|
||||
if (transient_for != NULL)
|
||||
_gdk_macos_display_position_toplevel_with_parent (self, surface, GDK_MACOS_SURFACE (transient_for), x, y);
|
||||
else
|
||||
_gdk_macos_display_position_toplevel (self, surface, monitor, x, y);
|
||||
_gdk_macos_display_position_toplevel (self, surface, x, y);
|
||||
}
|
||||
|
||||
@@ -96,12 +96,12 @@ _gdk_macos_drag_surface_constructed (GObject *object)
|
||||
defer:NO
|
||||
screen:screen];
|
||||
|
||||
_gdk_macos_surface_set_native (self, window);
|
||||
|
||||
[window setOpaque:NO];
|
||||
[window setBackgroundColor:[NSColor clearColor]];
|
||||
[window setDecorated:NO];
|
||||
|
||||
_gdk_macos_surface_set_native (self, window);
|
||||
|
||||
frame_clock = _gdk_frame_clock_idle_new ();
|
||||
gdk_surface_set_frame_clock (surface, frame_clock);
|
||||
g_object_unref (frame_clock);
|
||||
|
||||
@@ -52,7 +52,6 @@ gdk_macos_popup_surface_layout (GdkMacosPopupSurface *self,
|
||||
GdkRectangle bounds;
|
||||
GdkRectangle final_rect;
|
||||
int x, y;
|
||||
int shadow_left, shadow_right, shadow_top, shadow_bottom;
|
||||
|
||||
g_assert (GDK_IS_MACOS_POPUP_SURFACE (self));
|
||||
g_assert (layout != NULL);
|
||||
@@ -69,19 +68,10 @@ gdk_macos_popup_surface_layout (GdkMacosPopupSurface *self,
|
||||
monitor = _gdk_macos_surface_get_best_monitor (GDK_MACOS_SURFACE (self));
|
||||
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),
|
||||
width,
|
||||
height,
|
||||
shadow_left,
|
||||
shadow_right,
|
||||
shadow_top,
|
||||
shadow_bottom,
|
||||
0, 0, 0, 0, /* shadow-left/right/top/bottom */
|
||||
monitor,
|
||||
&bounds,
|
||||
self->layout,
|
||||
@@ -316,14 +306,14 @@ _gdk_macos_popup_surface_constructed (GObject *object)
|
||||
defer:NO
|
||||
screen:screen];
|
||||
|
||||
_gdk_macos_surface_set_native (GDK_MACOS_SURFACE (self), window);
|
||||
|
||||
[window setOpaque:NO];
|
||||
[window setBackgroundColor:[NSColor clearColor]];
|
||||
[window setDecorated:NO];
|
||||
[window setExcludedFromWindowsMenu:YES];
|
||||
[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_END_MACOS_ALLOC_POOL;
|
||||
|
||||
@@ -261,30 +261,7 @@ _gdk_macos_toplevel_surface_present (GdkToplevel *toplevel,
|
||||
if (gdk_toplevel_layout_get_fullscreen (layout, &fullscreen))
|
||||
{
|
||||
if (fullscreen)
|
||||
{
|
||||
GdkMonitor *fullscreen_monitor =
|
||||
gdk_toplevel_layout_get_fullscreen_monitor (layout);
|
||||
|
||||
if (fullscreen_monitor)
|
||||
{
|
||||
int x = 0, y = 0;
|
||||
|
||||
_gdk_macos_display_position_surface (GDK_MACOS_DISPLAY (display),
|
||||
GDK_MACOS_SURFACE (self),
|
||||
fullscreen_monitor,
|
||||
&x, &y);
|
||||
|
||||
GDK_DEBUG (MISC, "Moving toplevel \"%s\" to %d,%d",
|
||||
GDK_MACOS_SURFACE (self)->title ?
|
||||
GDK_MACOS_SURFACE (self)->title :
|
||||
"untitled",
|
||||
x, y);
|
||||
|
||||
_gdk_macos_surface_move (GDK_MACOS_SURFACE (self), x, y);
|
||||
}
|
||||
|
||||
_gdk_macos_toplevel_surface_fullscreen (self);
|
||||
}
|
||||
_gdk_macos_toplevel_surface_fullscreen (self);
|
||||
else
|
||||
_gdk_macos_toplevel_surface_unfullscreen (self);
|
||||
}
|
||||
@@ -297,7 +274,6 @@ _gdk_macos_toplevel_surface_present (GdkToplevel *toplevel,
|
||||
|
||||
_gdk_macos_display_position_surface (GDK_MACOS_DISPLAY (display),
|
||||
GDK_MACOS_SURFACE (self),
|
||||
gdk_toplevel_layout_get_fullscreen_monitor (layout),
|
||||
&x, &y);
|
||||
|
||||
GDK_DEBUG (MISC, "Placing new toplevel \"%s\" at %d,%d",
|
||||
@@ -615,11 +591,11 @@ _gdk_macos_toplevel_surface_constructed (GObject *object)
|
||||
defer:NO
|
||||
screen:screen];
|
||||
|
||||
_gdk_macos_surface_set_native (GDK_MACOS_SURFACE (self), window);
|
||||
|
||||
/* Allow NSWindow to go fullscreen */
|
||||
[window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
|
||||
|
||||
_gdk_macos_surface_set_native (GDK_MACOS_SURFACE (self), window);
|
||||
|
||||
frame_clock = _gdk_frame_clock_idle_new ();
|
||||
gdk_surface_set_frame_clock (surface, frame_clock);
|
||||
g_object_unref (frame_clock);
|
||||
@@ -681,7 +657,6 @@ _gdk_macos_toplevel_surface_attach_to_parent (GdkMacosToplevelSurface *self)
|
||||
_gdk_macos_display_clear_sorting (GDK_MACOS_DISPLAY (surface->display));
|
||||
_gdk_macos_display_position_surface (GDK_MACOS_DISPLAY (surface->display),
|
||||
GDK_MACOS_SURFACE (surface),
|
||||
NULL,
|
||||
&x, &y);
|
||||
_gdk_macos_surface_move (GDK_MACOS_SURFACE (surface), x, y);
|
||||
}
|
||||
|
||||
+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_private_h_sources = files([
|
||||
'gdkdevicetoolprivate.h',
|
||||
'gdkeventsprivate.h',
|
||||
'gdkdevicetoolprivate.h',
|
||||
'gdkhslaprivate.h',
|
||||
'gdkmonitorprivate.h',
|
||||
'gdkseatdefaultprivate.h',
|
||||
|
||||
@@ -165,29 +165,25 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
|
||||
double *scale)
|
||||
{
|
||||
GdkTexture *texture;
|
||||
int desired_scale_factor;
|
||||
|
||||
desired_scale_factor = (int) ceil (desired_scale);
|
||||
|
||||
if (gdk_cursor_get_name (cursor))
|
||||
{
|
||||
struct wl_cursor *c;
|
||||
int scale_factor;
|
||||
|
||||
if (g_str_equal (gdk_cursor_get_name (cursor), "none"))
|
||||
{
|
||||
*hotspot_x = *hotspot_y = 0;
|
||||
*width = *height = 0;
|
||||
*scale = 1;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
scale_factor = (int) ceil (desired_scale);
|
||||
goto none;
|
||||
|
||||
c = gdk_wayland_cursor_load_for_name (display,
|
||||
display->cursor_theme,
|
||||
scale_factor,
|
||||
_gdk_wayland_display_get_cursor_theme (display),
|
||||
desired_scale_factor,
|
||||
gdk_cursor_get_name (cursor));
|
||||
if (c && c->image_count > 0)
|
||||
{
|
||||
struct wl_cursor_image *image;
|
||||
int cursor_scale;
|
||||
|
||||
if (image_index >= c->image_count)
|
||||
{
|
||||
@@ -199,23 +195,23 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
|
||||
|
||||
image = c->images[image_index];
|
||||
|
||||
*width = display->cursor_theme_size;
|
||||
*height = display->cursor_theme_size;
|
||||
*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)
|
||||
cursor_scale = desired_scale_factor;
|
||||
if ((image->width % cursor_scale != 0) ||
|
||||
(image->height % cursor_scale != 0))
|
||||
{
|
||||
g_warning (G_STRLOC " cursor image size (%d) not an integer "
|
||||
"multiple of theme size (%d)", image->width, *width);
|
||||
*width = image->width;
|
||||
*height = image->height;
|
||||
*hotspot_x = image->hotspot_x;
|
||||
*hotspot_y = image->hotspot_y;
|
||||
*scale = 1;
|
||||
g_warning (G_STRLOC " cursor image size (%dx%d) not an integer "
|
||||
"multiple of scale (%d)", image->width, image->height,
|
||||
cursor_scale);
|
||||
cursor_scale = 1;
|
||||
}
|
||||
|
||||
*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);
|
||||
}
|
||||
}
|
||||
@@ -261,7 +257,7 @@ from_texture:
|
||||
else
|
||||
{
|
||||
if (!use_viewporter)
|
||||
*scale = ceil (desired_scale);
|
||||
*scale = desired_scale_factor;
|
||||
else
|
||||
*scale = desired_scale;
|
||||
|
||||
@@ -298,23 +294,28 @@ from_texture:
|
||||
}
|
||||
|
||||
if (gdk_cursor_get_fallback (cursor))
|
||||
{
|
||||
return _gdk_wayland_cursor_get_buffer (display,
|
||||
gdk_cursor_get_fallback (cursor),
|
||||
desired_scale,
|
||||
use_viewporter,
|
||||
image_index,
|
||||
hotspot_x, hotspot_y,
|
||||
width, height,
|
||||
scale);
|
||||
}
|
||||
return _gdk_wayland_cursor_get_buffer (display,
|
||||
gdk_cursor_get_fallback (cursor),
|
||||
desired_scale,
|
||||
use_viewporter,
|
||||
image_index,
|
||||
hotspot_x, hotspot_y,
|
||||
width, height,
|
||||
scale);
|
||||
else
|
||||
{
|
||||
texture = gdk_texture_new_from_resource ("/org/gtk/libgdk/cursor/default");
|
||||
goto from_texture;
|
||||
}
|
||||
|
||||
g_assert_not_reached ();
|
||||
none:
|
||||
*hotspot_x = 0;
|
||||
*hotspot_y = 0;
|
||||
*width = 0;
|
||||
*height = 0;
|
||||
*scale = 1;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
guint
|
||||
|
||||
@@ -97,7 +97,6 @@
|
||||
#define OUTPUT_VERSION_WITH_DONE 2
|
||||
#define NO_XDG_OUTPUT_DONE_SINCE_VERSION 3
|
||||
#define OUTPUT_VERSION 3
|
||||
#define XDG_WM_DIALOG_VERSION 1
|
||||
|
||||
#ifdef HAVE_TOPLEVEL_STATE_SUSPENDED
|
||||
#define XDG_WM_BASE_VERSION 6
|
||||
@@ -383,13 +382,6 @@ gdk_registry_handle_global (void *data,
|
||||
{
|
||||
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)
|
||||
{
|
||||
display_wayland->gtk_shell =
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
#include <gdk/wayland/viewporter-client-protocol.h>
|
||||
#include <gdk/wayland/presentation-time-client-protocol.h>
|
||||
#include <gdk/wayland/single-pixel-buffer-v1-client-protocol.h>
|
||||
#include <gdk/wayland/xdg-dialog-v1-client-protocol.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <gdk/gdkkeys.h>
|
||||
@@ -103,7 +102,6 @@ struct _GdkWaylandDisplay
|
||||
DmabufFormatsInfo *dmabuf_formats_info;
|
||||
struct xdg_wm_base *xdg_wm_base;
|
||||
struct zxdg_shell_v6 *zxdg_shell_v6;
|
||||
struct xdg_wm_dialog_v1 *xdg_wm_dialog;
|
||||
struct gtk_shell1 *gtk_shell;
|
||||
struct wl_data_device_manager *data_device_manager;
|
||||
struct wl_subcompositor *subcompositor;
|
||||
|
||||
@@ -3866,25 +3866,9 @@ pointer_surface_leave (void *data,
|
||||
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 = {
|
||||
pointer_surface_enter,
|
||||
pointer_surface_leave,
|
||||
pointer_surface_preferred_buffer_scale,
|
||||
pointer_surface_preferred_buffer_transform,
|
||||
pointer_surface_leave
|
||||
};
|
||||
|
||||
static void
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
#include <wayland/presentation-time-client-protocol.h>
|
||||
#include <wayland/xdg-shell-unstable-v6-client-protocol.h>
|
||||
#include <wayland/xdg-foreign-unstable-v2-client-protocol.h>
|
||||
#include <wayland/xdg-dialog-v1-client-protocol.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
@@ -85,7 +84,6 @@ struct _GdkWaylandToplevel
|
||||
struct gtk_surface1 *gtk_surface;
|
||||
struct xdg_toplevel *xdg_toplevel;
|
||||
struct zxdg_toplevel_v6 *zxdg_toplevel_v6;
|
||||
struct xdg_dialog_v1 *xdg_dialog;
|
||||
} display_server;
|
||||
|
||||
GdkWaylandToplevel *transient_for;
|
||||
@@ -207,7 +205,6 @@ 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_modal (GdkWaylandToplevel *wayland_toplevel);
|
||||
static gboolean maybe_set_xdg_dialog_modal (GdkWaylandToplevel *wayland_toplevel);
|
||||
|
||||
static void
|
||||
gdk_wayland_toplevel_hide_surface (GdkWaylandSurface *wayland_surface)
|
||||
@@ -218,7 +215,6 @@ 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.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)
|
||||
{
|
||||
@@ -881,8 +877,7 @@ gdk_wayland_surface_create_xdg_toplevel (GdkWaylandToplevel *wayland_toplevel)
|
||||
gdk_wayland_toplevel_set_application_id (GDK_TOPLEVEL (wayland_toplevel), app_id);
|
||||
|
||||
maybe_set_gtk_surface_dbus_properties (wayland_toplevel);
|
||||
if (!maybe_set_xdg_dialog_modal (wayland_toplevel))
|
||||
maybe_set_gtk_surface_modal (wayland_toplevel);
|
||||
maybe_set_gtk_surface_modal (wayland_toplevel);
|
||||
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
|
||||
wl_surface_commit (wayland_surface->display_server.wl_surface);
|
||||
@@ -1094,40 +1089,12 @@ 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
|
||||
gdk_wayland_toplevel_set_modal_hint (GdkWaylandToplevel *wayland_toplevel,
|
||||
gboolean modal)
|
||||
{
|
||||
GDK_SURFACE (wayland_toplevel)->modal_hint = modal;
|
||||
|
||||
if (!maybe_set_xdg_dialog_modal (wayland_toplevel))
|
||||
maybe_set_gtk_surface_modal (wayland_toplevel);
|
||||
maybe_set_gtk_surface_modal (wayland_toplevel);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
+24
-121
@@ -48,133 +48,36 @@ gdk_wayland_deps = [
|
||||
wlegldep,
|
||||
]
|
||||
|
||||
# Fields:
|
||||
# - name: protocol name
|
||||
# - stability: protocol stability ('private', 'stable' or 'unstable')
|
||||
# - version: protocol version
|
||||
# - required: wayland_protocols version check
|
||||
wlmod = import('unstable-wayland')
|
||||
proto_sources = [
|
||||
{
|
||||
'name': 'gtk-shell',
|
||||
'stability': 'private',
|
||||
},
|
||||
{
|
||||
'name': 'primary-selection',
|
||||
'stability': 'unstable',
|
||||
'version': 1,
|
||||
},
|
||||
{
|
||||
'name': 'pointer-gestures',
|
||||
'stability': 'unstable',
|
||||
'version': 1,
|
||||
},
|
||||
{
|
||||
'name': 'viewporter',
|
||||
'stability': 'stable',
|
||||
},
|
||||
{
|
||||
'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,
|
||||
},
|
||||
'protocol/gtk-shell.xml',
|
||||
'protocol/server-decoration.xml',
|
||||
wlmod.find_protocol('primary-selection', state: 'unstable', version: 1),
|
||||
wlmod.find_protocol('pointer-gestures', state: 'unstable', version: 1),
|
||||
wlmod.find_protocol('viewporter', state: 'stable'),
|
||||
wlmod.find_protocol('xdg-shell', state: 'unstable', version: 6),
|
||||
wlmod.find_protocol('xdg-shell', state: 'stable'),
|
||||
wlmod.find_protocol('xdg-foreign', state: 'unstable', version: 1),
|
||||
wlmod.find_protocol('xdg-foreign', state: 'unstable', version: 2),
|
||||
wlmod.find_protocol('tablet', state: 'unstable', version: 2),
|
||||
wlmod.find_protocol('keyboard-shortcuts-inhibit', state: 'unstable', version: 1),
|
||||
wlmod.find_protocol('xdg-output', state: 'unstable', version: 1),
|
||||
wlmod.find_protocol('idle-inhibit', state: 'unstable', version: 1),
|
||||
wlmod.find_protocol('xdg-activation', state: 'staging', version: 1),
|
||||
wlmod.find_protocol('fractional-scale', state: 'staging', version: 1),
|
||||
wlmod.find_protocol('linux-dmabuf', state: 'unstable', version: 1),
|
||||
wlmod.find_protocol('presentation-time', state: 'stable'),
|
||||
wlmod.find_protocol('single-pixel-buffer', state: 'staging', version: 1),
|
||||
]
|
||||
|
||||
gdk_wayland_gen_headers = []
|
||||
|
||||
wlmod = import('unstable-wayland')
|
||||
foreach p: proto_sources
|
||||
if wlprotocolsdep.version().version_compare(p.get('required', '>=0'))
|
||||
if p.get('stability') == 'private'
|
||||
if (p.has_key('version'))
|
||||
proto_file = 'protocol/@0@-v@1@.xml'.format(p.get('name'), p.get('version'))
|
||||
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
|
||||
# Returns a list [.c, .h]
|
||||
gen = wlmod.scan_xml(p)
|
||||
assert(gen.length() == 2)
|
||||
gdk_wayland_sources += gen[0]
|
||||
gdk_wayland_gen_headers += gen[1]
|
||||
endforeach
|
||||
|
||||
libgdk_wayland = static_library('gdk-wayland',
|
||||
|
||||
@@ -1408,7 +1408,7 @@ register_clipboard_notification ()
|
||||
WNDCLASS wclass = { 0, };
|
||||
ATOM klass;
|
||||
|
||||
wclass.lpszClassName = L"GdkClipboardNotification";
|
||||
wclass.lpszClassName = "GdkClipboardNotification";
|
||||
wclass.lpfnWndProc = _clipboard_window_procedure;
|
||||
wclass.hInstance = this_module ();
|
||||
wclass.cbWndExtra = sizeof (GdkWin32ClipboardThread *);
|
||||
@@ -1506,9 +1506,9 @@ gdk_win32_clipdrop_init (GdkWin32Clipdrop *win32_clipdrop)
|
||||
GdkWin32ContentFormatPair fmt;
|
||||
HMODULE user32;
|
||||
|
||||
thread_wakeup_message = RegisterWindowMessage (L"GDK_WORKER_THREAD_WEAKEUP");
|
||||
thread_wakeup_message = RegisterWindowMessage ("GDK_WORKER_THREAD_WEAKEUP");
|
||||
|
||||
user32 = LoadLibrary (L"user32.dll");
|
||||
user32 = LoadLibrary ("user32.dll");
|
||||
win32_clipdrop->GetUpdatedClipboardFormats = (GetUpdatedClipboardFormatsFunc) GetProcAddress (user32, "GetUpdatedClipboardFormats");
|
||||
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
|
||||
* format name "PNG" etc.
|
||||
*/
|
||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_PNG) = RegisterClipboardFormat (L"PNG");
|
||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_JFIF) = RegisterClipboardFormat (L"JFIF");
|
||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_GIF) = RegisterClipboardFormat (L"GIF");
|
||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_PNG) = RegisterClipboardFormatA ("PNG");
|
||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_JFIF) = RegisterClipboardFormatA ("JFIF");
|
||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_GIF) = RegisterClipboardFormatA ("GIF");
|
||||
|
||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_UNIFORMRESOURCELOCATORW) = RegisterClipboardFormat (L"UniformResourceLocatorW");
|
||||
_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) = RegisterClipboardFormat (L"HTML Format");
|
||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_TEXT_HTML) = RegisterClipboardFormat (L"text/html");
|
||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_UNIFORMRESOURCELOCATORW) = RegisterClipboardFormatA ("UniformResourceLocatorW");
|
||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_CFSTR_SHELLIDLIST) = RegisterClipboardFormatA (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_TEXT_HTML) = RegisterClipboardFormatA ("text/html");
|
||||
|
||||
_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) = RegisterClipboardFormat (L"image/jpeg");
|
||||
_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) = RegisterClipboardFormat (L"image/gif");
|
||||
_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) = RegisterClipboardFormat (L"text/plain;charset=utf-8");
|
||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_PNG) = RegisterClipboardFormatA ("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_BMP) = RegisterClipboardFormatA ("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_TEXT_URI_LIST) = RegisterClipboardFormatA ("text/uri-list");
|
||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_TEXT_PLAIN_UTF8) = RegisterClipboardFormatA ("text/plain;charset=utf-8");
|
||||
|
||||
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?
|
||||
*/
|
||||
(IsClipboardFormatAvailable
|
||||
(RegisterClipboardFormat (L"application/x-moz-nativeimage")) ||
|
||||
(RegisterClipboardFormatA ("application/x-moz-nativeimage")) ||
|
||||
IsClipboardFormatAvailable
|
||||
(RegisterClipboardFormat (L"UniformResourceLocatorW"))) &&
|
||||
(RegisterClipboardFormatA ("UniformResourceLocatorW"))) &&
|
||||
#endif
|
||||
TRUE)
|
||||
{
|
||||
|
||||
+35
-38
@@ -31,13 +31,12 @@
|
||||
|
||||
static struct {
|
||||
char *name;
|
||||
const wchar_t *id;
|
||||
char *id;
|
||||
} default_cursors[] = {
|
||||
/* -- Win32 cursor names: -- */
|
||||
{ "appstarting", IDC_APPSTARTING },
|
||||
{ "arrow", IDC_ARROW },
|
||||
{ "cross", IDC_CROSS },
|
||||
{ "dnd-move", IDC_ARROW },
|
||||
{ "hand", IDC_HAND },
|
||||
{ "help", IDC_HELP },
|
||||
{ "ibeam", IDC_IBEAM },
|
||||
@@ -457,32 +456,32 @@ win32_cursor_create_win32hcursor (GdkWin32Display *display,
|
||||
break;
|
||||
case GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_NULL:
|
||||
result = gdk_win32_hcursor_new (display,
|
||||
LoadImage (NULL,
|
||||
cursor->resource_name,
|
||||
IMAGE_CURSOR,
|
||||
cursor->width,
|
||||
cursor->height,
|
||||
cursor->load_flags),
|
||||
LoadImageA (NULL,
|
||||
(const char *) cursor->resource_name,
|
||||
IMAGE_CURSOR,
|
||||
cursor->width,
|
||||
cursor->height,
|
||||
cursor->load_flags),
|
||||
cursor->load_flags & LR_SHARED ? FALSE : TRUE);
|
||||
break;
|
||||
case GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_THIS:
|
||||
result = gdk_win32_hcursor_new (display,
|
||||
LoadImage (GetModuleHandle (NULL),
|
||||
cursor->resource_name,
|
||||
IMAGE_CURSOR,
|
||||
cursor->width,
|
||||
cursor->height,
|
||||
cursor->load_flags),
|
||||
LoadImageA (GetModuleHandle (NULL),
|
||||
(const char *) cursor->resource_name,
|
||||
IMAGE_CURSOR,
|
||||
cursor->width,
|
||||
cursor->height,
|
||||
cursor->load_flags),
|
||||
cursor->load_flags & LR_SHARED ? FALSE : TRUE);
|
||||
break;
|
||||
case GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_GTK:
|
||||
result = gdk_win32_hcursor_new (display,
|
||||
LoadImage (this_module (),
|
||||
cursor->resource_name,
|
||||
IMAGE_CURSOR,
|
||||
cursor->width,
|
||||
cursor->height,
|
||||
cursor->load_flags),
|
||||
LoadImageA (this_module (),
|
||||
(const char *) cursor->resource_name,
|
||||
IMAGE_CURSOR,
|
||||
cursor->width,
|
||||
cursor->height,
|
||||
cursor->load_flags),
|
||||
cursor->load_flags & LR_SHARED ? FALSE : TRUE);
|
||||
break;
|
||||
case GDK_WIN32_CURSOR_CREATE:
|
||||
@@ -499,12 +498,12 @@ win32_cursor_create_win32hcursor (GdkWin32Display *display,
|
||||
}
|
||||
|
||||
static Win32Cursor *
|
||||
win32_cursor_new (GdkWin32CursorLoadType load_type,
|
||||
wchar_t *resource_name,
|
||||
int width,
|
||||
int height,
|
||||
guint load_flags,
|
||||
int xcursor_number)
|
||||
win32_cursor_new (GdkWin32CursorLoadType load_type,
|
||||
gpointer resource_name,
|
||||
int width,
|
||||
int height,
|
||||
guint load_flags,
|
||||
int xcursor_number)
|
||||
{
|
||||
Win32Cursor *result;
|
||||
|
||||
@@ -632,9 +631,9 @@ win32_cursor_theme_load_system (Win32CursorTheme *theme,
|
||||
|
||||
/* Prefer W32 cursors */
|
||||
if (cursors[i].builtin)
|
||||
shared_hcursor = LoadImage (NULL, cursors[i].builtin, IMAGE_CURSOR,
|
||||
size, size,
|
||||
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0));
|
||||
shared_hcursor = LoadImageA (NULL, cursors[i].builtin, IMAGE_CURSOR,
|
||||
size, size,
|
||||
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0));
|
||||
|
||||
/* 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)
|
||||
@@ -646,7 +645,7 @@ win32_cursor_theme_load_system (Win32CursorTheme *theme,
|
||||
DestroyCursor (x_hcursor);
|
||||
|
||||
cursor = win32_cursor_new (shared_hcursor ? GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_NULL : GDK_WIN32_CURSOR_CREATE,
|
||||
(wchar_t*) cursors[i].builtin,
|
||||
(gpointer) cursors[i].builtin,
|
||||
size,
|
||||
size,
|
||||
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0),
|
||||
@@ -661,14 +660,14 @@ win32_cursor_theme_load_system (Win32CursorTheme *theme,
|
||||
if (default_cursors[i].name == NULL)
|
||||
break;
|
||||
|
||||
shared_hcursor = LoadImage (NULL, default_cursors[i].id, IMAGE_CURSOR, size, size,
|
||||
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0));
|
||||
shared_hcursor = LoadImageA (NULL, default_cursors[i].id, IMAGE_CURSOR, size, size,
|
||||
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0));
|
||||
|
||||
if (shared_hcursor == NULL)
|
||||
continue;
|
||||
|
||||
cursor = win32_cursor_new (GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_NULL,
|
||||
(wchar_t*) default_cursors[i].id,
|
||||
(gpointer) default_cursors[i].id,
|
||||
size,
|
||||
size,
|
||||
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0),
|
||||
@@ -780,8 +779,8 @@ win32hcursor_idc_from_name (GdkWin32Display *display,
|
||||
continue;
|
||||
|
||||
return gdk_win32_hcursor_new (display,
|
||||
LoadImage (NULL, default_cursors[i].id, IMAGE_CURSOR, 0, 0,
|
||||
LR_SHARED | LR_DEFAULTSIZE),
|
||||
LoadImageA (NULL, default_cursors[i].id, IMAGE_CURSOR, 0, 0,
|
||||
LR_SHARED | LR_DEFAULTSIZE),
|
||||
FALSE);
|
||||
}
|
||||
|
||||
@@ -885,7 +884,7 @@ gdk_win32hcursor_create_for_name (GdkWin32Display *display,
|
||||
/* Allow to load named cursor resources linked into the executable.
|
||||
* Cursors obtained with LoadCursor() cannot be destroyed.
|
||||
*/
|
||||
return gdk_win32_hcursor_new (display, LoadCursorA (hinstance, name), FALSE);
|
||||
return gdk_win32_hcursor_new (display, LoadCursor (hinstance, name), FALSE);
|
||||
}
|
||||
|
||||
static HICON
|
||||
@@ -909,9 +908,7 @@ _gdk_win32_create_hicon_for_texture (GdkTexture *texture,
|
||||
width = cairo_image_surface_get_width (surface);
|
||||
height = cairo_image_surface_get_height (surface);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, width, height);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
icon = pixbuf_to_hicon (pixbuf, is_icon, x, y);
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ gdk_device_manager_win32_finalize (GObject *object)
|
||||
#if DEBUG_WINTAB
|
||||
|
||||
static void
|
||||
print_lc(LOGCONTEXTA *lc)
|
||||
print_lc(LOGCONTEXT *lc)
|
||||
{
|
||||
g_print ("lcName = %s\n", lc->lcName);
|
||||
g_print ("lcOptions =");
|
||||
@@ -374,13 +374,13 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager)
|
||||
|
||||
wintab_contexts = NULL;
|
||||
|
||||
n = GetSystemDirectoryA (&dummy, 0);
|
||||
n = GetSystemDirectory (&dummy, 0);
|
||||
|
||||
if (n <= 0)
|
||||
return;
|
||||
|
||||
wintab32_dll_path = g_malloc (n + 1 + strlen (WINTAB32_DLL));
|
||||
k = GetSystemDirectoryA (wintab32_dll_path, n);
|
||||
k = GetSystemDirectory (wintab32_dll_path, 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, WINTAB32_DLL);
|
||||
|
||||
if ((wintab32 = LoadLibraryA (wintab32_dll_path)) == NULL)
|
||||
if ((wintab32 = LoadLibrary (wintab32_dll_path)) == NULL)
|
||||
return;
|
||||
|
||||
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++)
|
||||
{
|
||||
LOGCONTEXTA lc;
|
||||
LOGCONTEXT lc;
|
||||
|
||||
/* We open the Wintab device (hmm, what if there are several, or
|
||||
* can there even be several, probably not?) as a system
|
||||
|
||||
@@ -480,7 +480,7 @@ register_display_change_notification (GdkDisplay *display)
|
||||
WNDCLASS wclass = { 0, };
|
||||
ATOM klass;
|
||||
|
||||
wclass.lpszClassName = L"GdkDisplayChange";
|
||||
wclass.lpszClassName = "GdkDisplayChange";
|
||||
wclass.lpfnWndProc = display_change_window_procedure;
|
||||
wclass.hInstance = this_module ();
|
||||
wclass.style = CS_OWNDC;
|
||||
@@ -606,7 +606,7 @@ gdk_win32_display_get_name (GdkDisplay *display)
|
||||
window_station_name = "WinSta0";
|
||||
}
|
||||
|
||||
processIdToSessionId = (PFN_ProcessIdToSessionId) GetProcAddress (GetModuleHandle (L"kernel32.dll"), "ProcessIdToSessionId");
|
||||
processIdToSessionId = (PFN_ProcessIdToSessionId) GetProcAddress (GetModuleHandle ("kernel32.dll"), "ProcessIdToSessionId");
|
||||
if (!processIdToSessionId || !processIdToSessionId (GetCurrentProcessId (), &session_id))
|
||||
session_id = 0;
|
||||
|
||||
|
||||
@@ -134,7 +134,6 @@ struct _GdkWin32Display
|
||||
guint hasWglEXTSwapControl : 1;
|
||||
guint hasWglOMLSyncControl : 1;
|
||||
guint hasWglARBPixelFormat : 1;
|
||||
guint force_enable_depth_bits : 1;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
guint hasEglKHRCreateContext : 1;
|
||||
|
||||
@@ -658,7 +658,7 @@ _gdk_win32_dnd_thread_main (gpointer data)
|
||||
/* Create a message queue */
|
||||
PeekMessage (&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
|
||||
|
||||
thread_wakeup_message = RegisterWindowMessage (L"GDK_WORKER_THREAD_WEAKEUP");
|
||||
thread_wakeup_message = RegisterWindowMessage ("GDK_WORKER_THREAD_WEAKEUP");
|
||||
|
||||
/* Signal the main thread that we're ready.
|
||||
* This is the only time the queue works in reverse.
|
||||
|
||||
@@ -419,7 +419,7 @@ set_up_low_level_keyboard_hook (void)
|
||||
else
|
||||
WIN32_API_FAILED ("SetWindowsHookEx");
|
||||
|
||||
aerosnap_message = RegisterWindowMessage (L"GDK_WIN32_AEROSNAP_MESSAGE");
|
||||
aerosnap_message = RegisterWindowMessage ("GDK_WIN32_AEROSNAP_MESSAGE");
|
||||
}
|
||||
|
||||
void
|
||||
@@ -470,7 +470,7 @@ _gdk_events_init (GdkDisplay *display)
|
||||
};
|
||||
#endif
|
||||
|
||||
got_gdk_events_message = RegisterWindowMessage (L"GDK_WIN32_GOT_EVENTS");
|
||||
got_gdk_events_message = RegisterWindowMessage ("GDK_WIN32_GOT_EVENTS");
|
||||
|
||||
#if 0
|
||||
/* 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_info.cbSize = sizeof (nearest_info);
|
||||
|
||||
if (GetMonitorInfo (nearest_monitor, &nearest_info))
|
||||
if (GetMonitorInfoA (nearest_monitor, &nearest_info))
|
||||
{
|
||||
/* MSDN says that we must specify maximized window
|
||||
* size as if it was located on the primary monitor.
|
||||
|
||||
@@ -142,7 +142,8 @@ get_wgl_pfd (HDC hdc,
|
||||
|
||||
pfd->nSize = sizeof (PIXELFORMATDESCRIPTOR);
|
||||
|
||||
if (display_win32->hasWglARBPixelFormat)
|
||||
if (display_win32 != NULL &&
|
||||
display_win32->hasWglARBPixelFormat)
|
||||
{
|
||||
UINT num_formats;
|
||||
int colorbits = GetDeviceCaps (hdc, BITSPIXEL);
|
||||
@@ -175,18 +176,15 @@ get_wgl_pfd (HDC hdc,
|
||||
pixelAttribs[i++] = WGL_ALPHA_BITS_ARB;
|
||||
pixelAttribs[i++] = 8;
|
||||
|
||||
pixelAttribs[i++] = WGL_DEPTH_BITS_ARB;
|
||||
pixelAttribs[i++] = 0;
|
||||
|
||||
pixelAttribs[i++] = WGL_STENCIL_BITS_ARB;
|
||||
pixelAttribs[i++] = 0;
|
||||
|
||||
pixelAttribs[i++] = WGL_ACCUM_BITS_ARB;
|
||||
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!" */
|
||||
|
||||
pixelAttribs[i++] = 0; /* end of pixelAttribs */
|
||||
@@ -217,20 +215,8 @@ get_wgl_pfd (HDC hdc,
|
||||
pfd->cColorBits = GetDeviceCaps (hdc, BITSPIXEL);
|
||||
pfd->cAlphaBits = 8;
|
||||
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);
|
||||
|
||||
/* 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;
|
||||
@@ -248,7 +234,7 @@ gdk_init_dummy_wgl_context (GdkWin32Display *display_win32)
|
||||
|
||||
memset (&pfd, 0, sizeof (PIXELFORMATDESCRIPTOR));
|
||||
|
||||
best_idx = get_wgl_pfd (display_win32->dummy_context_wgl.hdc, &pfd, display_win32);
|
||||
best_idx = get_wgl_pfd (display_win32->dummy_context_wgl.hdc, &pfd, NULL);
|
||||
|
||||
if (best_idx != 0)
|
||||
set_pixel_format_result = SetPixelFormat (display_win32->dummy_context_wgl.hdc,
|
||||
@@ -281,9 +267,9 @@ create_dummy_gl_window (void)
|
||||
{
|
||||
WNDCLASS wclass = { 0, };
|
||||
ATOM klass;
|
||||
HWND hwnd = NULL;
|
||||
HWND hwnd;
|
||||
|
||||
wclass.lpszClassName = L"GdkGLDummyWindow";
|
||||
wclass.lpszClassName = "GdkGLDummyWindow";
|
||||
wclass.lpfnWndProc = DefWindowProc;
|
||||
wclass.hInstance = this_module ();
|
||||
wclass.style = CS_OWNDC;
|
||||
|
||||
@@ -730,7 +730,7 @@ _gdk_win32_key_to_string (LONG lParam)
|
||||
char buf[100];
|
||||
char *keyname_utf8;
|
||||
|
||||
if (GetKeyNameTextA (lParam, buf, sizeof (buf)) &&
|
||||
if (GetKeyNameText (lParam, buf, sizeof (buf)) &&
|
||||
(keyname_utf8 = g_locale_to_utf8 (buf, -1, NULL, NULL, NULL)) != NULL)
|
||||
{
|
||||
char *retval = static_printf ("%s", keyname_utf8);
|
||||
@@ -780,7 +780,7 @@ _gdk_win32_cf_to_string (UINT format)
|
||||
if (format >= CF_PRIVATEFIRST &&
|
||||
format <= CF_PRIVATELAST)
|
||||
return static_printf ("CF_PRIVATE%d", format - CF_PRIVATEFIRST);
|
||||
if (GetClipboardFormatNameA (format, buf, sizeof (buf)))
|
||||
if (GetClipboardFormatName (format, buf, sizeof (buf)))
|
||||
return static_printf ("'%s'", buf);
|
||||
else
|
||||
return static_printf ("unk-%#lx", format);
|
||||
|
||||
@@ -197,7 +197,7 @@ typedef struct _Win32Cursor Win32Cursor;
|
||||
|
||||
struct _Win32Cursor {
|
||||
GdkWin32CursorLoadType load_type;
|
||||
wchar_t *resource_name;
|
||||
gunichar2 *resource_name;
|
||||
int width;
|
||||
int height;
|
||||
guint load_flags;
|
||||
|
||||
@@ -326,7 +326,7 @@ RegisterGdkClass (GType wtype)
|
||||
static WNDCLASSEXW wcl;
|
||||
ATOM klass = 0;
|
||||
|
||||
wcl.cbSize = sizeof (WNDCLASSEXW);
|
||||
wcl.cbSize = sizeof (WNDCLASSEX);
|
||||
wcl.style = 0; /* DON'T set CS_<H,V>REDRAW. It causes total redraw
|
||||
* on WM_SIZE and WM_MOVE. Flicker, Performance!
|
||||
*/
|
||||
@@ -340,7 +340,7 @@ RegisterGdkClass (GType wtype)
|
||||
/* initialize once! */
|
||||
if (0 == hAppIcon && 0 == hAppIconSm)
|
||||
{
|
||||
wchar_t sLoc [MAX_PATH+1];
|
||||
char sLoc [MAX_PATH+1];
|
||||
|
||||
// try to load first icon of executable program
|
||||
if (0 != GetModuleFileName (NULL, sLoc, MAX_PATH))
|
||||
@@ -2064,7 +2064,7 @@ stash_window (GdkSurface *window,
|
||||
hmonitor = MonitorFromWindow (GDK_SURFACE_HWND (window), MONITOR_DEFAULTTONEAREST);
|
||||
hmonitor_info.cbSize = sizeof (hmonitor_info);
|
||||
|
||||
if (!GetMonitorInfo (hmonitor, &hmonitor_info))
|
||||
if (!GetMonitorInfoA (hmonitor, &hmonitor_info))
|
||||
return;
|
||||
|
||||
if (impl->snap_stash == NULL)
|
||||
|
||||
@@ -38,6 +38,7 @@ gdk_win32_vulkan_context_create_surface (GdkVulkanContext *context,
|
||||
{
|
||||
GdkSurface *window = gdk_draw_context_get_surface (GDK_DRAW_CONTEXT (context));
|
||||
GdkDisplay *display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
|
||||
GdkWin32Surface *win32_surface = GDK_WIN32_SURFACE (window);
|
||||
VkWin32SurfaceCreateInfoKHR info;
|
||||
VkResult result;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
static const struct { const char *name; const wchar_t *builtin; int type; guchar width; guchar height; guchar hotx; guchar hoty; char *data; } cursors[] = {
|
||||
static const struct { const char *name; const char *builtin; int type; guchar width; guchar height; guchar hotx; guchar hoty; char *data; } cursors[] = {
|
||||
{ "X_cursor", NULL, 0, 16, 16, 7, 7,
|
||||
"\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"
|
||||
|
||||
@@ -1776,6 +1776,11 @@ _gdk_x11_display_is_root_window (GdkDisplay *display,
|
||||
return GDK_SCREEN_XROOTWIN (display_x11->screen) == xroot_window;
|
||||
}
|
||||
|
||||
struct XPointerUngrabInfo {
|
||||
GdkDisplay *display;
|
||||
guint32 time;
|
||||
};
|
||||
|
||||
static void
|
||||
device_grab_update_callback (GdkDisplay *display,
|
||||
gpointer data,
|
||||
|
||||
@@ -10,13 +10,6 @@
|
||||
#include "gskrendernodeprivate.h"
|
||||
#include "gdk/gdktextureprivate.h"
|
||||
|
||||
/**
|
||||
* GskBroadwayRenderer:
|
||||
*
|
||||
* A Broadway based renderer.
|
||||
*
|
||||
* See [class@Gsk.Renderer].
|
||||
*/
|
||||
struct _GskBroadwayRenderer
|
||||
{
|
||||
GskRenderer parent_instance;
|
||||
|
||||
@@ -972,7 +972,7 @@ gsk_gl_driver_load_texture (GskGLDriver *self,
|
||||
|
||||
if (texture_id == 0)
|
||||
{
|
||||
downloaded_texture = gdk_memory_texture_from_texture (texture);
|
||||
downloaded_texture = gdk_memory_texture_from_texture (texture, gdk_texture_get_format (texture));
|
||||
|
||||
/* The download_texture() call may have switched the GL context. Make sure
|
||||
* the right context is at work again.
|
||||
@@ -1471,7 +1471,8 @@ gsk_gl_driver_add_texture_slices (GskGLDriver *self,
|
||||
}
|
||||
|
||||
slices = g_new0 (GskGLTextureSlice, n_slices);
|
||||
memtex = gdk_memory_texture_from_texture (texture);
|
||||
memtex = gdk_memory_texture_from_texture (texture,
|
||||
gdk_texture_get_format (texture));
|
||||
|
||||
if (ensure_mipmap)
|
||||
{
|
||||
|
||||
@@ -127,7 +127,7 @@ gsk_gl_glyph_library_init_atlas (GskGLTextureLibrary *self,
|
||||
else
|
||||
{
|
||||
gl_format = GL_BGRA;
|
||||
gl_type = GL_UNSIGNED_INT_8_8_8_8_REV;
|
||||
gl_type = GL_UNSIGNED_BYTE;
|
||||
}
|
||||
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);
|
||||
gl_format = GL_BGRA;
|
||||
gl_type = GL_UNSIGNED_INT_8_8_8_8_REV;
|
||||
gl_type = GL_UNSIGNED_BYTE;
|
||||
}
|
||||
|
||||
glPixelStorei (GL_UNPACK_ROW_LENGTH, stride / 4);
|
||||
|
||||
@@ -125,7 +125,7 @@ gsk_gl_icon_library_add (GskGLIconLibrary *self,
|
||||
{
|
||||
pixel_data = surface_data;
|
||||
gl_format = GL_BGRA;
|
||||
gl_type = GL_UNSIGNED_INT_8_8_8_8_REV;
|
||||
gl_type = GL_UNSIGNED_BYTE;
|
||||
}
|
||||
|
||||
texture_id = GSK_GL_TEXTURE_ATLAS_ENTRY_TEXTURE (icon_data);
|
||||
|
||||
@@ -41,15 +41,6 @@
|
||||
#include <gsk/gskroundedrectprivate.h>
|
||||
#include <gsk/gskrectprivate.h>
|
||||
|
||||
/**
|
||||
* GskGLRenderer:
|
||||
*
|
||||
* A GL based renderer.
|
||||
*
|
||||
* See [class@Gsk.Renderer].
|
||||
*
|
||||
* Since: 4.2
|
||||
*/
|
||||
struct _GskGLRendererClass
|
||||
{
|
||||
GskRendererClass parent_class;
|
||||
|
||||
@@ -70,10 +70,7 @@ gsk_gl_frame_cleanup (GskGpuFrame *frame)
|
||||
if (self->sync)
|
||||
{
|
||||
glClientWaitSync (self->sync, 0, -1);
|
||||
|
||||
/* can't use g_clear_pointer() on glDeleteSync(), see MR !7294 */
|
||||
glDeleteSync (self->sync);
|
||||
self->sync = NULL;
|
||||
g_clear_pointer (&self->sync, glDeleteSync);
|
||||
}
|
||||
|
||||
self->next_texture_slot = 0;
|
||||
|
||||
@@ -23,7 +23,6 @@ gsk_gpu_blend_mode_op_print_instance (GskGpuShaderOp *shader,
|
||||
{
|
||||
GskGpuBlendmodeInstance *instance = (GskGpuBlendmodeInstance *) instance_;
|
||||
|
||||
gsk_gpu_print_enum (string, GSK_TYPE_BLEND_MODE, shader->variation);
|
||||
gsk_gpu_print_rect (string, instance->rect);
|
||||
gsk_gpu_print_image_descriptor (string, shader->desc, instance->bottom_id);
|
||||
gsk_gpu_print_enum (string, GSK_TYPE_BLEND_MODE, shader->variation);
|
||||
|
||||
@@ -21,7 +21,7 @@ color_equal (const float *color1,
|
||||
const float *color2)
|
||||
{
|
||||
return gdk_rgba_equal (&(GdkRGBA) { color1[0], color1[1], color1[2], color1[3] },
|
||||
&(GdkRGBA) { color2[0], color2[1], color2[2], color2[3] });
|
||||
&(GdkRGBA) { color1[0], color1[1], color1[2], color1[3] });
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
+14
-5
@@ -14,7 +14,7 @@ struct _GskGpuClearOp
|
||||
GskGpuOp op;
|
||||
|
||||
cairo_rectangle_int_t rect;
|
||||
float color[4];
|
||||
GdkRGBA color;
|
||||
};
|
||||
|
||||
static void
|
||||
@@ -29,14 +29,23 @@ gsk_gpu_clear_op_print (GskGpuOp *op,
|
||||
guint indent)
|
||||
{
|
||||
GskGpuClearOp *self = (GskGpuClearOp *) op;
|
||||
float rgba[4];
|
||||
|
||||
gsk_gpu_print_op (string, indent, "clear");
|
||||
gsk_gpu_print_int_rect (string, &self->rect);
|
||||
gsk_gpu_print_rgba (string, self->color);
|
||||
gsk_gpu_rgba_to_float (&self->color, rgba);
|
||||
gsk_gpu_print_rgba (string, rgba);
|
||||
gsk_gpu_print_newline (string);
|
||||
}
|
||||
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
static void
|
||||
gsk_gpu_init_clear_value (VkClearValue *value,
|
||||
const GdkRGBA *rgba)
|
||||
{
|
||||
gsk_gpu_rgba_to_float (rgba, value->color.float32);
|
||||
}
|
||||
|
||||
static GskGpuOp *
|
||||
gsk_gpu_clear_op_vk_command (GskGpuOp *op,
|
||||
GskGpuFrame *frame,
|
||||
@@ -45,7 +54,7 @@ gsk_gpu_clear_op_vk_command (GskGpuOp *op,
|
||||
GskGpuClearOp *self = (GskGpuClearOp *) op;
|
||||
VkClearValue clear_value;
|
||||
|
||||
memcpy (clear_value.color.float32, self->color, sizeof (float) * 4);
|
||||
gsk_gpu_init_clear_value (&clear_value, &self->color);
|
||||
|
||||
vkCmdClearAttachments (state->vk_command_buffer,
|
||||
1,
|
||||
@@ -83,7 +92,7 @@ gsk_gpu_clear_op_gl_command (GskGpuOp *op,
|
||||
else
|
||||
glScissor (self->rect.x, self->rect.y, self->rect.width, self->rect.height);
|
||||
|
||||
glClearColor (self->color[0], self->color[1], self->color[2], self->color[3]);
|
||||
glClearColor (self->color.red, self->color.green, self->color.blue, self->color.alpha);
|
||||
glClear (GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glScissor (scissor[0], scissor[1], scissor[2], scissor[3]);
|
||||
@@ -112,5 +121,5 @@ gsk_gpu_clear_op (GskGpuFrame *frame,
|
||||
self = (GskGpuClearOp *) gsk_gpu_op_alloc (frame, &GSK_GPU_CLEAR_OP_CLASS);
|
||||
|
||||
self->rect = *rect;
|
||||
gsk_gpu_rgba_to_float (color, self->color);
|
||||
self->color = *color;
|
||||
}
|
||||
|
||||
@@ -546,7 +546,7 @@ gsk_gpu_device_maybe_gc (GskGpuDevice *self)
|
||||
|
||||
if (priv->cache_timeout == 0 || dead_texture_pixels > 1000000)
|
||||
{
|
||||
GSK_DEBUG (GLYPH_CACHE, "Pre-frame GC (%" G_GSIZE_FORMAT " dead pixels)", dead_texture_pixels);
|
||||
GSK_DEBUG (GLYPH_CACHE, "Pre-frame GC (%lu dead pixels)", dead_texture_pixels);
|
||||
gsk_gpu_device_gc (self, g_get_monotonic_time ());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include "gskvulkanimageprivate.h"
|
||||
#endif
|
||||
|
||||
#include "gdk/gdkdmabuftexturebuilderprivate.h"
|
||||
#include "gdk/gdkdmabuftextureprivate.h"
|
||||
#include "gdk/gdkglcontextprivate.h"
|
||||
|
||||
@@ -250,36 +249,13 @@ gsk_gl_texture_data_free (gpointer user_data)
|
||||
|
||||
gdk_gl_context_make_current (data->context);
|
||||
|
||||
/* can't use g_clear_pointer() on glDeleteSync(), see MR !7294 */
|
||||
if (data->sync)
|
||||
{
|
||||
glDeleteSync (data->sync);
|
||||
data->sync = NULL;
|
||||
}
|
||||
|
||||
g_clear_pointer (&data->sync, glDeleteSync);
|
||||
glDeleteTextures (1, &data->texture_id);
|
||||
g_object_unref (data->context);
|
||||
|
||||
g_free (data);
|
||||
}
|
||||
|
||||
#ifdef HAVE_DMABUF
|
||||
typedef struct
|
||||
{
|
||||
GdkDmabuf dmabuf;
|
||||
} Texture;
|
||||
|
||||
static void
|
||||
release_dmabuf_texture (gpointer data)
|
||||
{
|
||||
Texture *texture = data;
|
||||
|
||||
for (unsigned int i = 0; i < texture->dmabuf.n_planes; i++)
|
||||
g_close (texture->dmabuf.planes[i].fd, NULL);
|
||||
g_free (texture);
|
||||
}
|
||||
#endif
|
||||
|
||||
static GskGpuOp *
|
||||
gsk_gpu_download_op_gl_command (GskGpuOp *op,
|
||||
GskGpuFrame *frame,
|
||||
@@ -289,44 +265,12 @@ gsk_gpu_download_op_gl_command (GskGpuOp *op,
|
||||
GdkGLTextureBuilder *builder;
|
||||
GskGLTextureData *data;
|
||||
GdkGLContext *context;
|
||||
guint texture_id;
|
||||
|
||||
context = GDK_GL_CONTEXT (gsk_gpu_frame_get_context (frame));
|
||||
texture_id = gsk_gl_image_steal_texture (GSK_GL_IMAGE (self->image));
|
||||
|
||||
#ifdef HAVE_DMABUF
|
||||
if (self->allow_dmabuf)
|
||||
{
|
||||
Texture *texture;
|
||||
|
||||
texture = g_new0 (Texture, 1);
|
||||
|
||||
if (gdk_gl_context_export_dmabuf (context, texture_id, &texture->dmabuf))
|
||||
{
|
||||
GdkDmabufTextureBuilder *db;
|
||||
|
||||
db = gdk_dmabuf_texture_builder_new ();
|
||||
gdk_dmabuf_texture_builder_set_display (db, gdk_gl_context_get_display (context));
|
||||
gdk_dmabuf_texture_builder_set_dmabuf (db, &texture->dmabuf);
|
||||
gdk_dmabuf_texture_builder_set_premultiplied (db, gdk_memory_format_get_premultiplied (gsk_gpu_image_get_format (self->image)));
|
||||
gdk_dmabuf_texture_builder_set_width (db, gsk_gpu_image_get_width (self->image));
|
||||
gdk_dmabuf_texture_builder_set_height (db, gsk_gpu_image_get_height (self->image));
|
||||
|
||||
self->texture = gdk_dmabuf_texture_builder_build (db, release_dmabuf_texture, texture, NULL);
|
||||
|
||||
g_object_unref (db);
|
||||
|
||||
if (self->texture)
|
||||
return op->next;
|
||||
}
|
||||
|
||||
g_free (texture);
|
||||
}
|
||||
#endif
|
||||
|
||||
data = g_new (GskGLTextureData, 1);
|
||||
data->context = g_object_ref (context);
|
||||
data->texture_id = texture_id;
|
||||
data->texture_id = gsk_gl_image_steal_texture (GSK_GL_IMAGE (self->image));
|
||||
|
||||
if (gdk_gl_context_has_feature (context, GDK_GL_FEATURE_SYNC))
|
||||
data->sync = glFenceSync (GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "gskgpuframeprivate.h"
|
||||
#include "gskgpuprintprivate.h"
|
||||
#include "gskrectprivate.h"
|
||||
#include "gskenumtypes.h"
|
||||
|
||||
#include "gpu/shaders/gskgpumaskinstance.h"
|
||||
|
||||
@@ -23,7 +22,6 @@ gsk_gpu_mask_op_print_instance (GskGpuShaderOp *shader,
|
||||
{
|
||||
GskGpuMaskInstance *instance = (GskGpuMaskInstance *) instance_;
|
||||
|
||||
gsk_gpu_print_enum (string, GSK_TYPE_MASK_MODE, shader->variation);
|
||||
gsk_gpu_print_rect (string, instance->rect);
|
||||
gsk_gpu_print_image_descriptor (string, shader->desc, instance->source_id);
|
||||
gsk_gpu_print_image_descriptor (string, shader->desc, instance->mask_id);
|
||||
|
||||
@@ -140,10 +140,9 @@ void
|
||||
gsk_gpu_print_image (GString *string,
|
||||
GskGpuImage *image)
|
||||
{
|
||||
g_string_append_printf (string, "%zux%zu %s ",
|
||||
g_string_append_printf (string, "%zux%zu ",
|
||||
gsk_gpu_image_get_width (image),
|
||||
gsk_gpu_image_get_height (image),
|
||||
gdk_memory_format_get_name (gsk_gpu_image_get_format (image)));
|
||||
gsk_gpu_image_get_height (image));
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -13,15 +13,6 @@
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
/**
|
||||
* GskNglRenderer:
|
||||
*
|
||||
* A GL based renderer.
|
||||
*
|
||||
* See [class@Gsk.Renderer].
|
||||
*
|
||||
* Since: 4.2
|
||||
*/
|
||||
struct _GskNglRenderer
|
||||
{
|
||||
GskGpuRenderer parent_instance;
|
||||
|
||||
+12
-25
@@ -81,7 +81,6 @@ struct _PipelineCacheKey
|
||||
GskGpuShaderClip clip;
|
||||
GskGpuBlend blend;
|
||||
VkFormat format;
|
||||
VkPipeline pipeline;
|
||||
};
|
||||
|
||||
struct _RenderPassCacheKey
|
||||
@@ -89,7 +88,6 @@ struct _RenderPassCacheKey
|
||||
VkFormat format;
|
||||
VkImageLayout from_layout;
|
||||
VkImageLayout to_layout;
|
||||
VkRenderPass render_pass;
|
||||
};
|
||||
|
||||
static guint
|
||||
@@ -299,10 +297,8 @@ gsk_vulkan_pipeline_layout_unref (GskVulkanDevice *self,
|
||||
g_hash_table_iter_init (&iter, layout->pipeline_cache);
|
||||
while (g_hash_table_iter_next (&iter, &key, &value))
|
||||
{
|
||||
vkDestroyPipeline (display->vk_device,
|
||||
((PipelineCacheKey *)key)->pipeline,
|
||||
NULL);
|
||||
g_free (key);
|
||||
vkDestroyPipeline (display->vk_device, value, NULL);
|
||||
}
|
||||
g_hash_table_unref (layout->pipeline_cache);
|
||||
|
||||
@@ -467,10 +463,8 @@ gsk_vulkan_device_finalize (GObject *object)
|
||||
g_hash_table_iter_init (&iter, self->render_pass_cache);
|
||||
while (g_hash_table_iter_next (&iter, &key, &value))
|
||||
{
|
||||
vkDestroyRenderPass (display->vk_device,
|
||||
((RenderPassCacheKey *)key)->render_pass,
|
||||
NULL);
|
||||
g_free (key);
|
||||
vkDestroyRenderPass (display->vk_device, value, NULL);
|
||||
}
|
||||
g_hash_table_unref (self->render_pass_cache);
|
||||
|
||||
@@ -830,7 +824,6 @@ gsk_vulkan_device_get_vk_render_pass (GskVulkanDevice *self,
|
||||
VkImageLayout to_layout)
|
||||
{
|
||||
RenderPassCacheKey cache_key;
|
||||
RenderPassCacheKey *cached_result;
|
||||
VkRenderPass render_pass;
|
||||
GdkDisplay *display;
|
||||
|
||||
@@ -839,9 +832,9 @@ gsk_vulkan_device_get_vk_render_pass (GskVulkanDevice *self,
|
||||
.from_layout = from_layout,
|
||||
.to_layout = to_layout,
|
||||
};
|
||||
cached_result = g_hash_table_lookup (self->render_pass_cache, &cache_key);
|
||||
if (cached_result)
|
||||
return cached_result->render_pass;
|
||||
render_pass = g_hash_table_lookup (self->render_pass_cache, &cache_key);
|
||||
if (render_pass)
|
||||
return render_pass;
|
||||
|
||||
display = gsk_gpu_device_get_display (GSK_GPU_DEVICE (self));
|
||||
|
||||
@@ -885,10 +878,7 @@ gsk_vulkan_device_get_vk_render_pass (GskVulkanDevice *self,
|
||||
NULL,
|
||||
&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);
|
||||
g_hash_table_insert (self->render_pass_cache, g_memdup (&cache_key, sizeof (RenderPassCacheKey)), render_pass);
|
||||
|
||||
return render_pass;
|
||||
}
|
||||
@@ -956,7 +946,6 @@ gsk_vulkan_device_get_vk_pipeline (GskVulkanDevice *self,
|
||||
VkRenderPass render_pass)
|
||||
{
|
||||
PipelineCacheKey cache_key;
|
||||
PipelineCacheKey *cached_result;
|
||||
VkPipeline pipeline;
|
||||
GdkDisplay *display;
|
||||
const char *version_string;
|
||||
@@ -972,9 +961,9 @@ gsk_vulkan_device_get_vk_pipeline (GskVulkanDevice *self,
|
||||
.blend = blend,
|
||||
.format = format,
|
||||
};
|
||||
cached_result = g_hash_table_lookup (layout->pipeline_cache, &cache_key);
|
||||
if (cached_result)
|
||||
return cached_result->pipeline;
|
||||
pipeline = g_hash_table_lookup (layout->pipeline_cache, &cache_key);
|
||||
if (pipeline)
|
||||
return pipeline;
|
||||
|
||||
display = gsk_gpu_device_get_display (GSK_GPU_DEVICE (self));
|
||||
if (gsk_vulkan_device_has_feature (self, GDK_VULKAN_FEATURE_DYNAMIC_INDEXING) &&
|
||||
@@ -1150,7 +1139,7 @@ gsk_vulkan_device_get_vk_pipeline (GskVulkanDevice *self,
|
||||
format);
|
||||
|
||||
GSK_DEBUG (SHADERS,
|
||||
"Create Vulkan pipeline (%s %s, %u/%s/%s/%u) for layout (%" G_GSIZE_FORMAT "/%" G_GSIZE_FORMAT "/%" G_GSIZE_FORMAT ")",
|
||||
"Create Vulkan pipeline (%s %s, %u/%s/%s/%u) for layout (%lu/%lu/%lu)",
|
||||
op_class->shader_name,
|
||||
version_string + 1,
|
||||
variation,
|
||||
@@ -1164,9 +1153,7 @@ gsk_vulkan_device_get_vk_pipeline (GskVulkanDevice *self,
|
||||
g_free (fragment_shader_name);
|
||||
g_free (vertex_shader_name);
|
||||
|
||||
cached_result = g_memdup (&cache_key, sizeof (PipelineCacheKey));
|
||||
cached_result->pipeline = pipeline;
|
||||
g_hash_table_insert (layout->pipeline_cache, cached_result, cached_result);
|
||||
g_hash_table_insert (layout->pipeline_cache, g_memdup (&cache_key, sizeof (PipelineCacheKey)), pipeline);
|
||||
gdk_display_vulkan_pipeline_cache_updated (display);
|
||||
|
||||
return pipeline;
|
||||
@@ -1274,7 +1261,7 @@ gsk_vulkan_device_find_allocator (GskVulkanDevice *self,
|
||||
|
||||
g_assert (found < properties.memoryTypeCount);
|
||||
|
||||
return gsk_vulkan_allocator_ref (gsk_vulkan_device_get_allocator (self, found, &properties.memoryTypes[found]));
|
||||
return gsk_vulkan_allocator_ref (gsk_vulkan_device_get_allocator (self, i, &properties.memoryTypes[i]));
|
||||
}
|
||||
|
||||
GskVulkanAllocator *
|
||||
|
||||
+14
-15
@@ -202,9 +202,6 @@ gsk_vulkan_device_check_format (GskVulkanDevice *device,
|
||||
#define CHECK_FLAGS (GSK_GPU_IMAGE_NO_BLIT | GSK_GPU_IMAGE_FILTERABLE | GSK_GPU_IMAGE_RENDERABLE)
|
||||
GskGpuImageFlags flags;
|
||||
|
||||
if (vk_format == VK_FORMAT_UNDEFINED)
|
||||
return FALSE;
|
||||
|
||||
if (vk_usage & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT &&
|
||||
!gsk_component_mapping_is_framebuffer_compatible (vk_components))
|
||||
return FALSE;
|
||||
@@ -264,13 +261,15 @@ gsk_vulkan_image_new (GskVulkanDevice *device,
|
||||
|
||||
/* First, try the actual format */
|
||||
vk_format = gdk_memory_format_vk_format (format, &vk_components);
|
||||
if (!gsk_vulkan_device_check_format (device, vk_format, &vk_components, required_flags,
|
||||
if (vk_format == VK_FORMAT_UNDEFINED ||
|
||||
!gsk_vulkan_device_check_format (device, vk_format, &vk_components, required_flags,
|
||||
tiling, usage, width, height,
|
||||
&tiling, &flags))
|
||||
{
|
||||
/* Second, try the potential RGBA format */
|
||||
vk_format = gdk_memory_format_vk_rgba_format (format, NULL, &vk_components);
|
||||
if (!gsk_vulkan_device_check_format (device, vk_format, &vk_components, required_flags,
|
||||
if (vk_format == VK_FORMAT_UNDEFINED ||
|
||||
!gsk_vulkan_device_check_format (device, vk_format, &vk_components, required_flags,
|
||||
tiling, usage, width, height,
|
||||
&tiling, &flags))
|
||||
{
|
||||
@@ -282,7 +281,8 @@ gsk_vulkan_image_new (GskVulkanDevice *device,
|
||||
for (i = 0; fallbacks[i] != -1; i++)
|
||||
{
|
||||
vk_format = gdk_memory_format_vk_format (fallbacks[i], &vk_components);
|
||||
if (gsk_vulkan_device_check_format (device, vk_format, &vk_components, required_flags,
|
||||
if (vk_format != VK_FORMAT_UNDEFINED &&
|
||||
gsk_vulkan_device_check_format (device, vk_format, &vk_components, required_flags,
|
||||
tiling, usage, width, height,
|
||||
&tiling, &flags))
|
||||
{
|
||||
@@ -433,7 +433,6 @@ GskGpuImage *
|
||||
gsk_vulkan_image_new_for_swapchain (GskVulkanDevice *device,
|
||||
VkImage image,
|
||||
VkFormat format,
|
||||
GdkMemoryFormat memory_format,
|
||||
gsize width,
|
||||
gsize height)
|
||||
{
|
||||
@@ -450,8 +449,8 @@ gsk_vulkan_image_new_for_swapchain (GskVulkanDevice *device,
|
||||
self->vk_image_layout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
self->vk_access = 0;
|
||||
|
||||
/* FIXME: The flags here are very suboptimal */
|
||||
gsk_gpu_image_setup (GSK_GPU_IMAGE (self), 0, memory_format, width, height);
|
||||
/* FIXME: The memory format and flags here are very suboptimal */
|
||||
gsk_gpu_image_setup (GSK_GPU_IMAGE (self), 0, GDK_MEMORY_DEFAULT, width, height);
|
||||
|
||||
gsk_vulkan_image_create_view (self,
|
||||
format,
|
||||
@@ -548,9 +547,6 @@ gsk_vulkan_device_check_dmabuf_format (GskVulkanDevice *device,
|
||||
.pNext = &drm_properties
|
||||
};
|
||||
|
||||
if (vk_format == VK_FORMAT_UNDEFINED)
|
||||
return FALSE;
|
||||
|
||||
if (!gsk_component_mapping_is_framebuffer_compatible (vk_components))
|
||||
return FALSE;
|
||||
|
||||
@@ -636,7 +632,8 @@ gsk_vulkan_image_new_dmabuf (GskVulkanDevice *device,
|
||||
|
||||
/* First, try the actual format */
|
||||
vk_format = gdk_memory_format_vk_format (format, &vk_components);
|
||||
if (!gsk_vulkan_device_check_dmabuf_format (device, vk_format, &vk_components, width, height,
|
||||
if (vk_format == VK_FORMAT_UNDEFINED ||
|
||||
!gsk_vulkan_device_check_dmabuf_format (device, vk_format, &vk_components, width, height,
|
||||
modifiers, &flags, &n_modifiers))
|
||||
{
|
||||
/* Second, try the potential RGBA format, but as a fallback */
|
||||
@@ -644,7 +641,8 @@ gsk_vulkan_image_new_dmabuf (GskVulkanDevice *device,
|
||||
vk_format = gdk_memory_format_vk_rgba_format (format, &rgba_format, NULL);
|
||||
if (vk_format != VK_FORMAT_UNDEFINED)
|
||||
vk_format = gdk_memory_format_vk_format (rgba_format, &vk_components);
|
||||
if (gsk_vulkan_device_check_dmabuf_format (device, vk_format, &vk_components, width, height,
|
||||
if (vk_format != VK_FORMAT_UNDEFINED &&
|
||||
gsk_vulkan_device_check_dmabuf_format (device, vk_format, &vk_components, width, height,
|
||||
modifiers, &flags, &n_modifiers))
|
||||
{
|
||||
format = rgba_format;
|
||||
@@ -659,7 +657,8 @@ gsk_vulkan_image_new_dmabuf (GskVulkanDevice *device,
|
||||
for (i = 0; fallbacks[i] != -1; i++)
|
||||
{
|
||||
vk_format = gdk_memory_format_vk_format (fallbacks[i], &vk_components);
|
||||
if (gsk_vulkan_device_check_dmabuf_format (device, vk_format, &vk_components, width, height,
|
||||
if (vk_format != VK_FORMAT_UNDEFINED &&
|
||||
gsk_vulkan_device_check_dmabuf_format (device, vk_format, &vk_components, width, height,
|
||||
modifiers, &flags, &n_modifiers))
|
||||
{
|
||||
format = fallbacks[i];
|
||||
|
||||
@@ -14,7 +14,6 @@ G_DECLARE_FINAL_TYPE (GskVulkanImage, gsk_vulkan_image, GSK, VULKAN_IMAGE, GskGp
|
||||
GskGpuImage * gsk_vulkan_image_new_for_swapchain (GskVulkanDevice *device,
|
||||
VkImage image,
|
||||
VkFormat format,
|
||||
GdkMemoryFormat memory_format,
|
||||
gsize width,
|
||||
gsize height);
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ gsk_vulkan_buddy_allocator_alloc (GskVulkanAllocator *allocator,
|
||||
if (self->cache.vk_memory)
|
||||
{
|
||||
*alloc = self->cache;
|
||||
self->cache.vk_memory = VK_NULL_HANDLE;
|
||||
self->cache.vk_memory = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -240,7 +240,7 @@ restart:
|
||||
alloc->size <<= 1;
|
||||
if (slot == 0)
|
||||
{
|
||||
if (self->cache.vk_memory == VK_NULL_HANDLE)
|
||||
if (self->cache.vk_memory == NULL)
|
||||
self->cache = *alloc;
|
||||
else
|
||||
gsk_vulkan_free (self->allocator, alloc);
|
||||
|
||||
@@ -75,7 +75,6 @@ gsk_vulkan_renderer_update_images_cb (GdkVulkanContext *context,
|
||||
self->targets[i] = gsk_vulkan_image_new_for_swapchain (device,
|
||||
gdk_vulkan_context_get_image (context, i),
|
||||
gdk_vulkan_context_get_image_format (context),
|
||||
gdk_vulkan_context_get_memory_format (context),
|
||||
width, height);
|
||||
}
|
||||
}
|
||||
@@ -111,6 +110,11 @@ gsk_vulkan_renderer_create_context (GskGpuRenderer *renderer,
|
||||
!gdk_display_has_vulkan_feature (display, GDK_VULKAN_FEATURE_NONUNIFORM_INDEXING))
|
||||
*supported &= ~GSK_GPU_OPTIMIZE_UBER;
|
||||
|
||||
/* Sadly, there are too many systems out there where compiling the uber shader
|
||||
* takes multiple seconds, or even minutes. So just disabled it for now.
|
||||
*/
|
||||
*supported &= ~GSK_GPU_OPTIMIZE_UBER;
|
||||
|
||||
return GDK_DRAW_CONTEXT (context);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -439,7 +439,7 @@ gsk_gl_shader_class_init (GskGLShaderClass *klass)
|
||||
object_class->constructed = gsk_gl_shader_constructed;
|
||||
|
||||
/**
|
||||
* GskGLShader:source: (attributes org.gtk.Property.get=gsk_gl_shader_get_source)
|
||||
* GskGLShader:sourcecode: (attributes org.gtk.Property.get=gsk_gl_shader_get_source)
|
||||
*
|
||||
* The source code for the shader, as a `GBytes`.
|
||||
*/
|
||||
|
||||
@@ -387,7 +387,6 @@ gsk_path_builder_add_reverse_path (GskPathBuilder *self,
|
||||
/**
|
||||
* gsk_path_builder_add_cairo_path:
|
||||
* @self: a `GskPathBuilder`
|
||||
* @path: a path
|
||||
*
|
||||
* Adds a Cairo path to the builder.
|
||||
*
|
||||
|
||||
@@ -51,16 +51,6 @@ G_DEFINE_BOXED_TYPE (GskPathPoint, gsk_path_point,
|
||||
gsk_path_point_copy,
|
||||
gsk_path_point_free)
|
||||
|
||||
/**
|
||||
* gsk_path_point_copy:
|
||||
* @point: a path point
|
||||
*
|
||||
* Copies a path point.
|
||||
*
|
||||
* Returns: the copied point
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
GskPathPoint *
|
||||
gsk_path_point_copy (GskPathPoint *point)
|
||||
{
|
||||
@@ -73,14 +63,6 @@ gsk_path_point_copy (GskPathPoint *point)
|
||||
return copy;
|
||||
}
|
||||
|
||||
/**
|
||||
* gsk_path_point_free:
|
||||
* @point: a path point
|
||||
*
|
||||
* Frees a path point copied by [method@Gsk.PathPoint.copy].
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
void
|
||||
gsk_path_point_free (GskPathPoint *point)
|
||||
{
|
||||
|
||||
+3
-10
@@ -679,16 +679,9 @@ vulkan_supported_platform (GdkSurface *surface,
|
||||
if (props.deviceType == VK_PHYSICAL_DEVICE_TYPE_CPU)
|
||||
{
|
||||
if (!as_fallback)
|
||||
GSK_DEBUG (RENDERER, "Not using '%s': device is CPU", g_type_name (renderer_type));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
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));
|
||||
GSK_DEBUG (RENDERER,
|
||||
"Not using '%s': device is CPU",
|
||||
g_type_name (renderer_type));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,13 +48,6 @@
|
||||
|
||||
#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)
|
||||
|
||||
#define GSK_RENDER_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GSK_TYPE_RENDER_NODE, GskRenderNodeClass))
|
||||
|
||||
+4
-10
@@ -3335,15 +3335,17 @@ gsk_container_node_new (GskRenderNode **children,
|
||||
|
||||
self->children[0] = gsk_render_node_ref (children[0]);
|
||||
node->offscreen_for_opacity = children[0]->offscreen_for_opacity;
|
||||
node->preferred_depth = children[0]->preferred_depth;
|
||||
gsk_rect_init_from_rect (&bounds, &(children[0]->bounds));
|
||||
node->preferred_depth = gdk_memory_depth_merge (node->preferred_depth,
|
||||
gsk_render_node_get_preferred_depth (children[0]));
|
||||
|
||||
for (guint i = 1; i < n_children; i++)
|
||||
{
|
||||
self->children[i] = gsk_render_node_ref (children[i]);
|
||||
self->disjoint = self->disjoint && !gsk_rect_intersects (&bounds, &(children[i]->bounds));
|
||||
graphene_rect_union (&bounds, &(children[i]->bounds), &bounds);
|
||||
node->preferred_depth = gdk_memory_depth_merge (node->preferred_depth, children[i]->preferred_depth);
|
||||
node->preferred_depth = gdk_memory_depth_merge (node->preferred_depth,
|
||||
gsk_render_node_get_preferred_depth (children[i]));
|
||||
node->offscreen_for_opacity = node->offscreen_for_opacity || children[i]->offscreen_for_opacity;
|
||||
}
|
||||
|
||||
@@ -4767,8 +4769,6 @@ gsk_fill_node_new (GskRenderNode *child,
|
||||
|
||||
self = gsk_render_node_alloc (GSK_FILL_NODE);
|
||||
node = (GskRenderNode *) self;
|
||||
node->offscreen_for_opacity = child->offscreen_for_opacity;
|
||||
node->preferred_depth = gsk_render_node_get_preferred_depth (child);
|
||||
|
||||
self->child = gsk_render_node_ref (child);
|
||||
self->path = gsk_path_ref (path);
|
||||
@@ -4976,8 +4976,6 @@ gsk_stroke_node_new (GskRenderNode *child,
|
||||
|
||||
self = gsk_render_node_alloc (GSK_STROKE_NODE);
|
||||
node = (GskRenderNode *) self;
|
||||
node->offscreen_for_opacity = child->offscreen_for_opacity;
|
||||
node->preferred_depth = gsk_render_node_get_preferred_depth (child);
|
||||
|
||||
self->child = gsk_render_node_ref (child);
|
||||
self->path = gsk_path_ref (path);
|
||||
@@ -6399,10 +6397,6 @@ gsk_mask_node_draw (GskRenderNode *node,
|
||||
graphene_matrix_t color_matrix;
|
||||
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))
|
||||
return;
|
||||
|
||||
|
||||
+130
-196
@@ -54,8 +54,6 @@
|
||||
#include <pango/pangofc-fontmap.h>
|
||||
#endif
|
||||
|
||||
#include <hb-subset.h>
|
||||
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
typedef struct _Context Context;
|
||||
@@ -948,22 +946,23 @@ create_ascii_glyphs (PangoFont *font)
|
||||
PangoGlyphString *result, *glyph_string;
|
||||
guint i;
|
||||
|
||||
result = pango_glyph_string_new ();
|
||||
|
||||
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 ();
|
||||
pango_glyph_string_set_size (result, N_ASCII_GLYPHS);
|
||||
glyph_string = pango_glyph_string_new ();
|
||||
for (i = MIN_ASCII_GLYPH; i < MAX_ASCII_GLYPH; i++)
|
||||
{
|
||||
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,
|
||||
text, 1,
|
||||
¬_a_hack,
|
||||
@@ -971,13 +970,14 @@ create_ascii_glyphs (PangoFont *font)
|
||||
PANGO_SHAPE_NONE);
|
||||
|
||||
if (glyph_string->num_glyphs != 1)
|
||||
result->glyphs[i - MIN_ASCII_GLYPH].glyph = PANGO_GLYPH_INVALID_INPUT;
|
||||
else
|
||||
result->glyphs[i - MIN_ASCII_GLYPH] = glyph_string->glyphs[0];
|
||||
{
|
||||
pango_glyph_string_free (glyph_string);
|
||||
pango_glyph_string_free (result);
|
||||
return NULL;
|
||||
}
|
||||
result->glyphs[i - MIN_ASCII_GLYPH] = glyph_string->glyphs[0];
|
||||
}
|
||||
|
||||
g_object_unref (coverage);
|
||||
|
||||
pango_glyph_string_free (glyph_string);
|
||||
|
||||
return result;
|
||||
@@ -1005,7 +1005,7 @@ ensure_fontmap (Context *context)
|
||||
|
||||
context->fontmap = pango_cairo_font_map_new ();
|
||||
|
||||
config = FcConfigCreate ();
|
||||
config = FcInitLoadConfig ();
|
||||
pango_fc_font_map_set_config (PANGO_FC_FONT_MAP (context->fontmap), config);
|
||||
FcConfigDestroy (config);
|
||||
|
||||
@@ -1113,70 +1113,81 @@ parse_font (GtkCssParser *parser,
|
||||
if (font_name == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (context->fontmap)
|
||||
font = font_from_string (context->fontmap, font_name, FALSE);
|
||||
|
||||
if (gtk_css_parser_has_url (parser))
|
||||
{
|
||||
char *url;
|
||||
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)
|
||||
if (font != NULL)
|
||||
{
|
||||
scheme = g_uri_parse_scheme (url);
|
||||
if (scheme && g_ascii_strcasecmp (scheme, "data") == 0)
|
||||
{
|
||||
bytes = gtk_css_data_url_parse (url, NULL, &error);
|
||||
}
|
||||
else
|
||||
{
|
||||
GFile *file;
|
||||
|
||||
file = g_file_new_for_uri (url);
|
||||
bytes = g_file_load_bytes (file, NULL, NULL, &error);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
g_free (scheme);
|
||||
gtk_css_parser_error_value (parser, "A font with this name already exists.");
|
||||
/* consume the url to avoid more errors */
|
||||
url = gtk_css_parser_consume_url (parser);
|
||||
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)
|
||||
else
|
||||
{
|
||||
font = font_from_string (context->fontmap, font_name, FALSE);
|
||||
if (!font)
|
||||
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)
|
||||
{
|
||||
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);
|
||||
scheme = g_uri_parse_scheme (url);
|
||||
if (scheme && g_ascii_strcasecmp (scheme, "data") == 0)
|
||||
{
|
||||
bytes = gtk_css_data_url_parse (url, NULL, &error);
|
||||
}
|
||||
else
|
||||
{
|
||||
GFile *file;
|
||||
|
||||
file = g_file_new_for_uri (url);
|
||||
bytes = g_file_load_bytes (file, NULL, NULL, &error);
|
||||
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)
|
||||
{
|
||||
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
|
||||
{
|
||||
if (context->fontmap)
|
||||
font = font_from_string (context->fontmap, font_name, FALSE);
|
||||
|
||||
if (!font)
|
||||
font = font_from_string (pango_cairo_font_map_get_default (), font_name, TRUE);
|
||||
|
||||
@@ -2244,12 +2255,6 @@ unpack_glyphs (PangoFont *font,
|
||||
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->geometry.width = ascii->glyphs[idx].geometry.width;
|
||||
}
|
||||
@@ -2307,25 +2312,6 @@ parse_antialias (GtkCssParser *parser,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
parse_hint_metrics (GtkCssParser *parser,
|
||||
Context *context,
|
||||
gpointer out)
|
||||
{
|
||||
if (!parse_enum (parser, CAIRO_GOBJECT_TYPE_HINT_METRICS, out))
|
||||
return FALSE;
|
||||
|
||||
if (*(cairo_hint_metrics_t *) out != CAIRO_HINT_METRICS_OFF &&
|
||||
*(cairo_hint_metrics_t *) out != CAIRO_HINT_METRICS_ON)
|
||||
{
|
||||
gtk_css_parser_error_value (parser, "Unsupported value for enum \"%s\"",
|
||||
g_type_name (CAIRO_GOBJECT_TYPE_HINT_METRICS));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GskRenderNode *
|
||||
parse_text_node (GtkCssParser *parser,
|
||||
Context *context)
|
||||
@@ -2336,7 +2322,6 @@ parse_text_node (GtkCssParser *parser,
|
||||
PangoGlyphString *glyphs = NULL;
|
||||
cairo_hint_style_t hint_style = CAIRO_HINT_STYLE_SLIGHT;
|
||||
cairo_antialias_t antialias = CAIRO_ANTIALIAS_GRAY;
|
||||
cairo_hint_metrics_t hint_metrics = CAIRO_HINT_METRICS_OFF;
|
||||
PangoFont *hinted;
|
||||
const Declaration declarations[] = {
|
||||
{ "font", parse_font, clear_font, &font },
|
||||
@@ -2345,7 +2330,6 @@ parse_text_node (GtkCssParser *parser,
|
||||
{ "glyphs", parse_glyphs, clear_glyphs, &glyphs },
|
||||
{ "hint-style", parse_hint_style, NULL, &hint_style },
|
||||
{ "antialias", parse_antialias, NULL, &antialias },
|
||||
{ "hint-metrics", parse_hint_metrics, NULL, &hint_metrics },
|
||||
};
|
||||
GskRenderNode *result;
|
||||
|
||||
@@ -2357,7 +2341,7 @@ parse_text_node (GtkCssParser *parser,
|
||||
g_assert (font);
|
||||
}
|
||||
|
||||
hinted = gsk_reload_font (font, 1.0, hint_metrics, hint_style, antialias);
|
||||
hinted = gsk_reload_font (font, 1.0, CAIRO_HINT_METRICS_OFF, hint_style, antialias);
|
||||
g_object_unref (font);
|
||||
font = hinted;
|
||||
|
||||
@@ -2941,7 +2925,7 @@ typedef struct
|
||||
gsize named_node_counter;
|
||||
GHashTable *named_textures;
|
||||
gsize named_texture_counter;
|
||||
GHashTable *fonts;
|
||||
GHashTable *serialized_fonts;
|
||||
} Printer;
|
||||
|
||||
static void
|
||||
@@ -2956,64 +2940,6 @@ printer_init_check_texture (Printer *printer,
|
||||
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"))
|
||||
{
|
||||
if (g_strcmp0 (g_getenv ("GSK_SUBSET_FONTS"), "1") == 0)
|
||||
{
|
||||
info->input = hb_subset_input_create_or_fail ();
|
||||
hb_subset_input_set_flags (info->input, HB_SUBSET_FLAGS_RETAIN_GIDS);
|
||||
}
|
||||
else
|
||||
info->serialized = TRUE; /* Don't subset (or serialize) system fonts */
|
||||
}
|
||||
|
||||
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
|
||||
printer_init_duplicates_for_node (Printer *printer,
|
||||
GskRenderNode *node)
|
||||
@@ -3027,11 +2953,8 @@ printer_init_duplicates_for_node (Printer *printer,
|
||||
|
||||
switch (gsk_render_node_get_node_type (node))
|
||||
{
|
||||
case GSK_TEXT_NODE:
|
||||
printer_init_collect_font_info (printer, node);
|
||||
break;
|
||||
|
||||
case GSK_CAIRO_NODE:
|
||||
case GSK_TEXT_NODE:
|
||||
case GSK_COLOR_NODE:
|
||||
case GSK_LINEAR_GRADIENT_NODE:
|
||||
case GSK_REPEATING_LINEAR_GRADIENT_NODE:
|
||||
@@ -3155,7 +3078,7 @@ printer_init (Printer *self,
|
||||
self->named_node_counter = 0;
|
||||
self->named_textures = g_hash_table_new_full (NULL, NULL, NULL, g_free);
|
||||
self->named_texture_counter = 0;
|
||||
self->fonts = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, font_info_free);
|
||||
self->serialized_fonts = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
|
||||
printer_init_duplicates_for_node (self, node);
|
||||
}
|
||||
@@ -3167,7 +3090,7 @@ printer_clear (Printer *self)
|
||||
g_string_free (self->str, TRUE);
|
||||
g_hash_table_unref (self->named_nodes);
|
||||
g_hash_table_unref (self->named_textures);
|
||||
g_hash_table_unref (self->fonts);
|
||||
g_hash_table_unref (self->serialized_fonts);
|
||||
}
|
||||
|
||||
#define IDENT_LEVEL 2 /* Spaces per level */
|
||||
@@ -3288,6 +3211,17 @@ 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
|
||||
append_point (GString *str,
|
||||
const graphene_point_t *p)
|
||||
@@ -3333,7 +3267,7 @@ append_rgba_param (Printer *p,
|
||||
{
|
||||
_indent (p);
|
||||
g_string_append_printf (p->str, "%s: ", param_name);
|
||||
gdk_rgba_print (value, p->str);
|
||||
append_rgba (p->str, value);
|
||||
g_string_append_c (p->str, ';');
|
||||
g_string_append_c (p->str, '\n');
|
||||
}
|
||||
@@ -3487,7 +3421,7 @@ append_stops_param (Printer *p,
|
||||
|
||||
string_append_double (p->str, stops[i].offset);
|
||||
g_string_append_c (p->str, ' ');
|
||||
gdk_rgba_print (&stops[i].color, p->str);
|
||||
append_rgba (p->str, &stops[i].color);
|
||||
}
|
||||
g_string_append (p->str, ";\n");
|
||||
}
|
||||
@@ -3605,13 +3539,13 @@ append_texture_param (Printer *p,
|
||||
case GDK_MEMORY_U8:
|
||||
case GDK_MEMORY_U16:
|
||||
bytes = gdk_texture_save_to_png_bytes (texture);
|
||||
g_string_append (p->str, "url(\"data:image/png;base64,\\\n");
|
||||
g_string_append (p->str, "url(\"data:image/png;base64,");
|
||||
break;
|
||||
|
||||
case GDK_MEMORY_FLOAT16:
|
||||
case GDK_MEMORY_FLOAT32:
|
||||
bytes = gdk_texture_save_to_tiff_bytes (texture);
|
||||
g_string_append (p->str, "url(\"data:image/tiff;base64,\\\n");
|
||||
g_string_append (p->str, "url(\"data:image/tiff;base64,");
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -3632,14 +3566,9 @@ gsk_text_node_serialize_font (GskRenderNode *node,
|
||||
Printer *p)
|
||||
{
|
||||
PangoFont *font = gsk_text_node_get_font (node);
|
||||
PangoFontMap *fontmap = pango_font_get_font_map (font);
|
||||
PangoFontDescription *desc;
|
||||
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);
|
||||
s = pango_font_description_to_string (desc);
|
||||
@@ -3647,29 +3576,42 @@ gsk_text_node_serialize_font (GskRenderNode *node,
|
||||
g_free (s);
|
||||
pango_font_description_free (desc);
|
||||
|
||||
info = g_hash_table_lookup (p->fonts, hb_font_get_face (pango_font_get_hb_font (font)));
|
||||
if (info->serialized)
|
||||
/* Check if this is a custom font that we created from a url */
|
||||
if (!g_object_get_data (G_OBJECT (fontmap), "font-files"))
|
||||
return;
|
||||
|
||||
if (info->input)
|
||||
face = hb_subset_or_fail (info->face, info->input);
|
||||
else
|
||||
face = hb_face_reference (info->face);
|
||||
#ifdef HAVE_PANGOFT
|
||||
{
|
||||
FcPattern *pat;
|
||||
FcResult res;
|
||||
const char *file;
|
||||
char *data;
|
||||
gsize len;
|
||||
char *b64;
|
||||
|
||||
blob = hb_face_reference_blob (face);
|
||||
data = hb_blob_get_data (blob, &length);
|
||||
pat = pango_fc_font_get_pattern (PANGO_FC_FONT (font));
|
||||
res = FcPatternGetString (pat, FC_FILE, 0, (FcChar8 **)&file);
|
||||
if (res != FcResultMatch)
|
||||
return;
|
||||
|
||||
b64 = base64_encode_with_linebreaks ((const guchar *) data, length);
|
||||
if (g_hash_table_contains (p->serialized_fonts, file))
|
||||
return;
|
||||
|
||||
g_string_append (p->str, " url(\"data:font/ttf;base64,\\\n");
|
||||
append_escaping_newlines (p->str, b64);
|
||||
g_string_append (p->str, "\")");
|
||||
if (!g_file_get_contents (file, &data, &len, NULL))
|
||||
return;
|
||||
|
||||
g_free (b64);
|
||||
hb_blob_destroy (blob);
|
||||
hb_face_destroy (face);
|
||||
g_hash_table_add (p->serialized_fonts, (gpointer) file);
|
||||
|
||||
info->serialized = TRUE;
|
||||
b64 = base64_encode_with_linebreaks ((const guchar *) data, len);
|
||||
|
||||
g_string_append (p->str, " url(\"data:font/ttf;base64,");
|
||||
append_escaping_newlines (p->str, b64);
|
||||
g_string_append (p->str, "\")");
|
||||
|
||||
g_free (b64);
|
||||
g_free (data);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -3681,13 +3623,11 @@ gsk_text_node_serialize_font_options (GskRenderNode *node,
|
||||
cairo_font_options_t *options;
|
||||
cairo_hint_style_t hint_style;
|
||||
cairo_antialias_t antialias;
|
||||
cairo_hint_metrics_t hint_metrics;
|
||||
|
||||
options = cairo_font_options_create ();
|
||||
cairo_scaled_font_get_font_options (sf, options);
|
||||
hint_style = cairo_font_options_get_hint_style (options);
|
||||
antialias = cairo_font_options_get_antialias (options);
|
||||
hint_metrics = cairo_font_options_get_hint_metrics (options);
|
||||
cairo_font_options_destroy (options);
|
||||
|
||||
/* medium and full are identical in the absence of subpixel modes */
|
||||
@@ -3703,12 +3643,6 @@ gsk_text_node_serialize_font_options (GskRenderNode *node,
|
||||
*/
|
||||
if (antialias == CAIRO_ANTIALIAS_NONE)
|
||||
append_enum_param (p, "antialias", CAIRO_GOBJECT_TYPE_ANTIALIAS, antialias);
|
||||
|
||||
/* CAIRO_HINT_METRICS_ON is the only value we ever emit here, since off is the default,
|
||||
* and we don't accept any other values.
|
||||
*/
|
||||
if (hint_metrics == CAIRO_HINT_METRICS_ON)
|
||||
append_enum_param (p, "hint-metrics", CAIRO_GOBJECT_TYPE_HINT_METRICS, CAIRO_HINT_METRICS_ON);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -4105,7 +4039,7 @@ render_node_print (Printer *p,
|
||||
{
|
||||
if (i > 0)
|
||||
g_string_append_c (p->str, ' ');
|
||||
gdk_rgba_print (&colors[i], p->str);
|
||||
append_rgba (p->str, &colors[i]);
|
||||
}
|
||||
g_string_append (p->str, ";\n");
|
||||
}
|
||||
@@ -4480,7 +4414,7 @@ render_node_print (Printer *p,
|
||||
cairo_surface_write_to_png_stream (surface, cairo_write_array, array);
|
||||
|
||||
_indent (p);
|
||||
g_string_append (p->str, "pixels: url(\"data:image/png;base64,\\\n");
|
||||
g_string_append (p->str, "pixels: url(\"data:image/png;base64,");
|
||||
b64 = base64_encode_with_linebreaks (array->data, array->len);
|
||||
append_escaping_newlines (p->str, b64);
|
||||
g_free (b64);
|
||||
@@ -4500,7 +4434,7 @@ render_node_print (Printer *p,
|
||||
if (cairo_script_from_recording_surface (script, surface) == CAIRO_STATUS_SUCCESS)
|
||||
{
|
||||
_indent (p);
|
||||
g_string_append (p->str, "script: url(\"data:;base64,\\\n");
|
||||
g_string_append (p->str, "script: url(\"data:;base64,");
|
||||
b64 = base64_encode_with_linebreaks (array->data, array->len);
|
||||
append_escaping_newlines (p->str, b64);
|
||||
g_free (b64);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user