Compare commits
11 Commits
css-variab
...
cursor-fro
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2346bb4087 | ||
|
|
0f9ed94a85 | ||
|
|
11ddd5ed40 | ||
|
|
160b8a0f7e | ||
|
|
ce8cf6866b | ||
|
|
e5fb0dd3d2 | ||
|
|
c2cae1d0fb | ||
|
|
d1c7d5eac7 | ||
|
|
24e3ad54a7 | ||
|
|
7c357e7da5 | ||
|
|
667e2fc73a |
@@ -445,8 +445,9 @@ reference:
|
|||||||
--force-fallback-for=gdk-pixbuf,pango
|
--force-fallback-for=gdk-pixbuf,pango
|
||||||
-Dintrospection=enabled
|
-Dintrospection=enabled
|
||||||
-Ddocumentation=true
|
-Ddocumentation=true
|
||||||
|
-Dgtk_doc=true
|
||||||
-Dgdk-pixbuf:gtk_doc=true
|
-Dgdk-pixbuf:gtk_doc=true
|
||||||
-Dpango:documentation=true
|
-Dpango:gtk_doc=true
|
||||||
-Dbuild-demos=false
|
-Dbuild-demos=false
|
||||||
-Dbuild-examples=false
|
-Dbuild-examples=false
|
||||||
-Dbuild-tests=false
|
-Dbuild-tests=false
|
||||||
|
|||||||
BIN
.gitlab-ci/.fedora.Dockerfile.swp
Normal file
@@ -19,12 +19,13 @@ flatpak build ${builddir} meson \
|
|||||||
--buildtype=debugoptimized \
|
--buildtype=debugoptimized \
|
||||||
-Dx11-backend=true \
|
-Dx11-backend=true \
|
||||||
-Dwayland-backend=true \
|
-Dwayland-backend=true \
|
||||||
|
-Dvulkan=disabled \
|
||||||
-Dbuild-tests=false \
|
-Dbuild-tests=false \
|
||||||
-Dbuild-testsuite=false \
|
-Dbuild-testsuite=false \
|
||||||
-Dbuild-examples=false \
|
-Dbuild-examples=false \
|
||||||
-Dintrospection=disabled \
|
-Dintrospection=disabled \
|
||||||
-Dbuild-demos=true \
|
-Dbuild-demos=true \
|
||||||
-Dprofile=devel \
|
-Ddemo-profile=devel \
|
||||||
_flatpak_build
|
_flatpak_build
|
||||||
|
|
||||||
flatpak build --env=CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA ${builddir} ninja -C _flatpak_build install
|
flatpak build --env=CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA ${builddir} ninja -C _flatpak_build install
|
||||||
|
|||||||
@@ -34,8 +34,7 @@ pacman --noconfirm -S --needed \
|
|||||||
mingw-w64-$MSYS2_ARCH-shared-mime-info \
|
mingw-w64-$MSYS2_ARCH-shared-mime-info \
|
||||||
mingw-w64-$MSYS2_ARCH-python-gobject \
|
mingw-w64-$MSYS2_ARCH-python-gobject \
|
||||||
mingw-w64-$MSYS2_ARCH-shaderc \
|
mingw-w64-$MSYS2_ARCH-shaderc \
|
||||||
mingw-w64-$MSYS2_ARCH-vulkan \
|
mingw-w64-$MSYS2_ARCH-vulkan
|
||||||
mingw-w64-$MSYS2_ARCH-vulkan-headers
|
|
||||||
|
|
||||||
mkdir -p _ccache
|
mkdir -p _ccache
|
||||||
export CCACHE_BASEDIR="$(pwd)"
|
export CCACHE_BASEDIR="$(pwd)"
|
||||||
@@ -45,7 +44,7 @@ export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
|
|||||||
ccache --zero-stats
|
ccache --zero-stats
|
||||||
ccache --show-stats
|
ccache --show-stats
|
||||||
export CCACHE_DISABLE=true
|
export CCACHE_DISABLE=true
|
||||||
meson setup \
|
meson \
|
||||||
-Dx11-backend=false \
|
-Dx11-backend=false \
|
||||||
-Dwayland-backend=false \
|
-Dwayland-backend=false \
|
||||||
-Dwin32-backend=true \
|
-Dwin32-backend=true \
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ The issue tracker is meant to be used for actionable issues only.
|
|||||||
|
|
||||||
You should not open a new issue for security related questions.
|
You should not open a new issue for security related questions.
|
||||||
|
|
||||||
When in doubt, follow the process for [GNOME security issues](https://security.gnome.org/).
|
When in doubt, follow [security](https://security.gnome.org/).
|
||||||
|
|
||||||
### Bug reports
|
### Bug reports
|
||||||
|
|
||||||
@@ -144,28 +144,33 @@ $ git clone https://gitlab.gnome.org/yourusername/gtk.git
|
|||||||
$ cd gtk
|
$ cd gtk
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Note**: if you plan to push changes to back to the main repository and
|
||||||
|
have a GNOME account, you can skip the fork, and use the following instead:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ git clone git@gitlab.gnome.org:GNOME/gtk.git
|
||||||
|
$ cd gtk
|
||||||
|
```
|
||||||
|
|
||||||
To compile the Git version of GTK on your system, you will need to
|
To compile the Git version of GTK on your system, you will need to
|
||||||
configure your build using Meson:
|
configure your build using Meson:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ meson setup _builddir .
|
$ meson _builddir .
|
||||||
$ meson compile -C _builddir
|
$ cd _builddir
|
||||||
|
$ ninja
|
||||||
```
|
```
|
||||||
|
|
||||||
Typically, you should work on your own branch:
|
Typically, you should work on your own branch:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ git switch -C your-branch
|
$ git checkout -b your-branch
|
||||||
```
|
```
|
||||||
|
|
||||||
Once you've finished working on the bug fix or feature, push the branch
|
Once you've finished working on the bug fix or feature, push the branch
|
||||||
to the Git repository and open a new merge request, to let the GTK
|
to the Git repository and open a new merge request, to let the GTK
|
||||||
maintainers review your contribution.
|
maintainers review your contribution.
|
||||||
|
|
||||||
**Important**: Do **not** attach a diff or a patch file to a GitLab issue.
|
|
||||||
Patches cannot be reviewed, and do not not go through the CI pipeline. If
|
|
||||||
you wish to submit your changes to GTK, always use a merge request.
|
|
||||||
|
|
||||||
### Code reviews
|
### Code reviews
|
||||||
|
|
||||||
Each contribution is reviewed by the core developers of the GTK project.
|
Each contribution is reviewed by the core developers of the GTK project.
|
||||||
@@ -257,4 +262,4 @@ people committing to GTK to follow a few rules:
|
|||||||
|
|
||||||
If you have been contributing to GTK for a while and you don't have commit
|
If you have been contributing to GTK for a while and you don't have commit
|
||||||
access to the repository, you may ask to obtain it following the [GNOME account
|
access to the repository, you may ask to obtain it following the [GNOME account
|
||||||
process](https://handbook.gnome.org/infrastructure/developer-access.html).
|
process](https://wiki.gnome.org/AccountsTeam/NewAccounts).
|
||||||
|
|||||||
207
NEWS
@@ -1,211 +1,6 @@
|
|||||||
Overview of Changes in 4.15.1, xx-xx-xxxx
|
Overview of Changes in 4.14.2, xx-xx-xxxx
|
||||||
=========================================
|
=========================================
|
||||||
|
|
||||||
* GtkGraphicsOffload:
|
|
||||||
- Don't crash without a child
|
|
||||||
|
|
||||||
* CSS:
|
|
||||||
- Support the :root selector
|
|
||||||
|
|
||||||
* 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
|
|
||||||
|
|
||||||
* GDK:
|
|
||||||
- Support XDG_ACTIVATION_TOKEN
|
|
||||||
- dmabuf: Be more defensive when importing unknown formats to GL
|
|
||||||
- dmabuf: Use narrow range for YUV
|
|
||||||
|
|
||||||
* 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
|
|
||||||
|
|
||||||
* Wayland:
|
|
||||||
- Use wl_compositor version 6
|
|
||||||
|
|
||||||
* X11:
|
|
||||||
- Implement a missing method
|
|
||||||
|
|
||||||
* Build:
|
|
||||||
- Fix many ubsan warnings
|
|
||||||
|
|
||||||
* Debugging:
|
|
||||||
- Show more texture details in the recorder
|
|
||||||
|
|
||||||
* macOS:
|
|
||||||
- Fix problems with events handed back to the OS
|
|
||||||
- Respect GDK_DEBUG=default-settings
|
|
||||||
|
|
||||||
* Translation updates:
|
|
||||||
Korean
|
|
||||||
Turkish
|
|
||||||
|
|
||||||
|
|
||||||
Overview of Changes in 4.15.0, 21-04-2024
|
|
||||||
=========================================
|
|
||||||
|
|
||||||
This release changes the default GSK renderer to be Vulkan, on
|
|
||||||
Wayland. Other platforms still use ngl.
|
|
||||||
|
|
||||||
The intent of this change is to get wider testing and verify that
|
|
||||||
Vulkan drivers are good enough for us to rely on. If significant
|
|
||||||
problems show up, we will revert this change for 4.16.
|
|
||||||
|
|
||||||
You can still override the renderer choice using the GSK_RENDERER
|
|
||||||
environment variable.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
This release also changes font rendering settings by introducing
|
|
||||||
a new high-level gtk-font-rendering settings which gives GTK more
|
|
||||||
freedom to decide on font rendering.
|
|
||||||
|
|
||||||
You can still use the low-level font-related settings by changing
|
|
||||||
the new property to 'manual'.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
* GtkColumnView:
|
|
||||||
- Fix infinite loops in dispose
|
|
||||||
- Fix problems with weak ref cycles in GtkExpression
|
|
||||||
|
|
||||||
* GtkListView:
|
|
||||||
* GtkShortcutManager:
|
|
||||||
- Track the propagation phase of added controllers
|
|
||||||
|
|
||||||
* GtkGLArea:
|
|
||||||
- Produce dmabuf textures, so graphics offload is possible
|
|
||||||
|
|
||||||
* GtkTextView:
|
|
||||||
- Support text shadows
|
|
||||||
|
|
||||||
* GtkGraphicsOffload:
|
|
||||||
- Add a black-background property
|
|
||||||
|
|
||||||
* Settings:
|
|
||||||
- Add a new gtk-font-rendering setting
|
|
||||||
|
|
||||||
* Accessibility:
|
|
||||||
- Add support for GetRangeExtents to GtkAccessibleText
|
|
||||||
- Add support for GetOffsetAtPoint to GtkAccessibleText
|
|
||||||
- Implement GtkAccessibleRange for scrollbars
|
|
||||||
|
|
||||||
* GDK:
|
|
||||||
- Add a callback-based cursor API
|
|
||||||
|
|
||||||
* GSK:
|
|
||||||
- Use the Vulkan renderer by default
|
|
||||||
- Avoid an infinite recursion with offscreens in some cases
|
|
||||||
- Optimize graphics offload to make it more likely that compositors
|
|
||||||
can use direct scanout
|
|
||||||
|
|
||||||
* X11:
|
|
||||||
- Fix some confusing debug messages
|
|
||||||
- Drop a no-longer-relevant optimization that was interfering with
|
|
||||||
getting the current window manager capabilities
|
|
||||||
|
|
||||||
* macOS:
|
|
||||||
- Implement the color picker for macOS 10.15+
|
|
||||||
|
|
||||||
* Debugging:
|
|
||||||
- Snow monitor resolution in the inspector
|
|
||||||
|
|
||||||
* Demos:
|
|
||||||
- Use graphics offload in the shadertoy demo
|
|
||||||
- Show more reliable fps numbers in the fishbowl demo
|
|
||||||
|
|
||||||
* Tools:
|
|
||||||
- Support generating pdf in gtk4-rendernode-tool
|
|
||||||
|
|
||||||
* Build:
|
|
||||||
- Require pango 1.52
|
|
||||||
- Require cairo 1.18
|
|
||||||
- Add a missing dependency that was causing build failures
|
|
||||||
- Drop deprecated build options:
|
|
||||||
gtk_doc -> documentation
|
|
||||||
update_screenshots -> screenshots
|
|
||||||
demo-profile -> profile
|
|
||||||
demos -> build-demos
|
|
||||||
|
|
||||||
* Deprecations:
|
|
||||||
- gdk_widget_set/get_font_options
|
|
||||||
- gdk_wayland/x11_display_set_cursor_theme
|
|
||||||
|
|
||||||
* Translation updates:
|
|
||||||
Basque
|
|
||||||
Brazilian Portuguese
|
|
||||||
British English
|
|
||||||
Chinese (China)
|
|
||||||
Hebrew
|
|
||||||
Kabyle
|
|
||||||
Persian
|
|
||||||
Polish
|
|
||||||
Russian
|
|
||||||
Slovenian
|
|
||||||
Swedish
|
|
||||||
Turkish
|
|
||||||
|
|
||||||
|
|
||||||
Overview of Changes in 4.14.2, 03-04-2024
|
|
||||||
=========================================
|
|
||||||
|
|
||||||
* GtkScale:
|
|
||||||
- Improve positioning of values in some cases
|
|
||||||
|
|
||||||
* Theme:
|
|
||||||
- Make progress in entries visible
|
|
||||||
|
|
||||||
* Accessibility:
|
|
||||||
- Fix text insertion handling
|
|
||||||
|
|
||||||
* GDK:
|
|
||||||
- dnd: Use the default cursor durion motion
|
|
||||||
- dnd: Use a better cursor for indicating the move action
|
|
||||||
|
|
||||||
* GSK:
|
|
||||||
- gl: Handle offloads in offscreen context better
|
|
||||||
- Fix text rendering problems with some fonts
|
|
||||||
|
|
||||||
* Wayland:
|
|
||||||
- Tighten up some protocol version checks
|
|
||||||
- Use the presentation time protocol
|
|
||||||
- Fix a crash with subsurfaces
|
|
||||||
- Improve settings portal handling
|
|
||||||
|
|
||||||
* macOS:
|
|
||||||
- Fix up the app menu support
|
|
||||||
|
|
||||||
* Windows:
|
|
||||||
- Fix problems with minimization
|
|
||||||
- Fix build without fontconfig
|
|
||||||
|
|
||||||
* Debugging:
|
|
||||||
- Add font settings in the inspector
|
|
||||||
|
|
||||||
* Demos:
|
|
||||||
- Clean up the application demo
|
|
||||||
- Update cursor images for the cursor demo
|
|
||||||
|
|
||||||
* Translation updates:
|
|
||||||
Catalan
|
|
||||||
Czech
|
|
||||||
French
|
|
||||||
Georgian
|
|
||||||
Hebrew
|
|
||||||
Persian
|
|
||||||
Slovenian
|
|
||||||
Turkish
|
|
||||||
Ukrainian
|
|
||||||
|
|
||||||
|
|
||||||
Overview of Changes in 4.14.1, 16-03-2024
|
Overview of Changes in 4.14.1, 16-03-2024
|
||||||
=========================================
|
=========================================
|
||||||
|
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ version, for example `gtk-4-10`.
|
|||||||
How to report bugs
|
How to report bugs
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
Bugs should be reported on the [issues page](https://gitlab.gnome.org/GNOME/gtk/issues/).
|
Bugs should be reported on the [issues page](https://gitlab.gnome.org/GNOME/gtk/issues/new).
|
||||||
|
|
||||||
In the bug report please include:
|
In the bug report please include:
|
||||||
|
|
||||||
|
|||||||
@@ -186,7 +186,7 @@
|
|||||||
"config-opts" : [
|
"config-opts" : [
|
||||||
"--libdir=/app/lib",
|
"--libdir=/app/lib",
|
||||||
"-Dbuildtype=debugoptimized",
|
"-Dbuildtype=debugoptimized",
|
||||||
"-Dprofile=devel"
|
"-Ddemo-profile=devel"
|
||||||
],
|
],
|
||||||
"sources" : [
|
"sources" : [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -115,7 +115,7 @@
|
|||||||
"config-opts" : [
|
"config-opts" : [
|
||||||
"--libdir=/app/lib",
|
"--libdir=/app/lib",
|
||||||
"-Dbuildtype=debugoptimized",
|
"-Dbuildtype=debugoptimized",
|
||||||
"-Dprofile=devel"
|
"-Ddemo-profile=devel"
|
||||||
],
|
],
|
||||||
"sources" : [
|
"sources" : [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -115,7 +115,7 @@
|
|||||||
"config-opts" : [
|
"config-opts" : [
|
||||||
"--libdir=/app/lib",
|
"--libdir=/app/lib",
|
||||||
"-Dbuildtype=debugoptimized",
|
"-Dbuildtype=debugoptimized",
|
||||||
"-Dprofile=devel"
|
"-Ddemo-profile=devel"
|
||||||
],
|
],
|
||||||
"sources" : [
|
"sources" : [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -115,7 +115,7 @@
|
|||||||
"config-opts" : [
|
"config-opts" : [
|
||||||
"--libdir=/app/lib",
|
"--libdir=/app/lib",
|
||||||
"-Dbuildtype=debugoptimized",
|
"-Dbuildtype=debugoptimized",
|
||||||
"-Dprofile=devel"
|
"-Ddemo-profile=devel"
|
||||||
],
|
],
|
||||||
"sources" : [
|
"sources" : [
|
||||||
{
|
{
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
@@ -15,54 +15,12 @@ on_destroy (gpointer data)
|
|||||||
window = NULL;
|
window = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GdkTexture *
|
|
||||||
cursor_callback (GdkCursor *cursor,
|
|
||||||
int cursor_size,
|
|
||||||
double scale,
|
|
||||||
int *width,
|
|
||||||
int *height,
|
|
||||||
int *hotspot_x,
|
|
||||||
int *hotspot_y,
|
|
||||||
gpointer data)
|
|
||||||
{
|
|
||||||
GdkPixbuf *pixbuf;
|
|
||||||
GdkTexture *texture;
|
|
||||||
GError *error = NULL;
|
|
||||||
int scaled_size;
|
|
||||||
|
|
||||||
scaled_size = ceil (cursor_size * scale);
|
|
||||||
|
|
||||||
pixbuf = gdk_pixbuf_new_from_resource_at_scale ("/cursors/images/gtk-logo.svg",
|
|
||||||
scaled_size, scaled_size,
|
|
||||||
TRUE,
|
|
||||||
&error);
|
|
||||||
if (!pixbuf)
|
|
||||||
{
|
|
||||||
g_print ("%s\n", error->message);
|
|
||||||
g_error_free (error);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
|
||||||
|
|
||||||
g_object_unref (pixbuf);
|
|
||||||
|
|
||||||
*width = cursor_size;
|
|
||||||
*height = cursor_size;
|
|
||||||
*hotspot_x = 18 * cursor_size / 32.0;
|
|
||||||
*hotspot_y = 2 * cursor_size / 32.0;
|
|
||||||
|
|
||||||
return texture;
|
|
||||||
}
|
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
do_cursors (GtkWidget *do_widget)
|
do_cursors (GtkWidget *do_widget)
|
||||||
{
|
{
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
GtkBuilder *builder;
|
GtkBuilder *builder;
|
||||||
GtkWidget *logo_callback;
|
|
||||||
GdkCursor *cursor;
|
|
||||||
|
|
||||||
builder = gtk_builder_new_from_resource ("/cursors/cursors.ui");
|
builder = gtk_builder_new_from_resource ("/cursors/cursors.ui");
|
||||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
||||||
@@ -71,10 +29,6 @@ do_cursors (GtkWidget *do_widget)
|
|||||||
gtk_widget_get_display (do_widget));
|
gtk_widget_get_display (do_widget));
|
||||||
g_signal_connect (window, "destroy",
|
g_signal_connect (window, "destroy",
|
||||||
G_CALLBACK (on_destroy), NULL);
|
G_CALLBACK (on_destroy), NULL);
|
||||||
logo_callback = GTK_WIDGET (gtk_builder_get_object (builder, "logo_callback"));
|
|
||||||
cursor = gdk_cursor_new_from_callback (cursor_callback, NULL, NULL, NULL);
|
|
||||||
gtk_widget_set_cursor (logo_callback, cursor);
|
|
||||||
g_object_unref (cursor);
|
|
||||||
g_object_unref (builder);
|
g_object_unref (builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -116,7 +116,6 @@
|
|||||||
<file>w_resize_cursor.png</file>
|
<file>w_resize_cursor.png</file>
|
||||||
<file>zoom_in_cursor.png</file>
|
<file>zoom_in_cursor.png</file>
|
||||||
<file>zoom_out_cursor.png</file>
|
<file>zoom_out_cursor.png</file>
|
||||||
<file>gtk-logo.svg</file>
|
|
||||||
</gresource>
|
</gresource>
|
||||||
<gresource prefix="/dnd">
|
<gresource prefix="/dnd">
|
||||||
<file>dnd.css</file>
|
<file>dnd.css</file>
|
||||||
|
|||||||
@@ -363,9 +363,7 @@ insert_markup_idle (gpointer data)
|
|||||||
|
|
||||||
if (g_get_monotonic_time () - begin > G_TIME_SPAN_MILLISECOND)
|
if (g_get_monotonic_time () - begin > G_TIME_SPAN_MILLISECOND)
|
||||||
{
|
{
|
||||||
guint id;
|
g_idle_add (insert_markup_idle, data);
|
||||||
id = g_idle_add (insert_markup_idle, data);
|
|
||||||
g_source_set_name_by_id (id, "[gtk-demo] insert_markup_idle");
|
|
||||||
return G_SOURCE_REMOVE;
|
return G_SOURCE_REMOVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -400,9 +398,7 @@ parse_markup_idle (gpointer data)
|
|||||||
do {
|
do {
|
||||||
if (g_get_monotonic_time () - begin > G_TIME_SPAN_MILLISECOND)
|
if (g_get_monotonic_time () - begin > G_TIME_SPAN_MILLISECOND)
|
||||||
{
|
{
|
||||||
guint id;
|
g_idle_add (parse_markup_idle, data);
|
||||||
id = g_idle_add (parse_markup_idle, data);
|
|
||||||
g_source_set_name_by_id (id, "[gtk-demo] parse_markup_idle");
|
|
||||||
return G_SOURCE_REMOVE;
|
return G_SOURCE_REMOVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,138 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
||||||
|
|
||||||
<svg
|
|
||||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
||||||
xmlns:cc="http://creativecommons.org/ns#"
|
|
||||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
||||||
xmlns:svg="http://www.w3.org/2000/svg"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
||||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
||||||
width="128"
|
|
||||||
height="128"
|
|
||||||
id="svg6843"
|
|
||||||
sodipodi:version="0.32"
|
|
||||||
inkscape:version="0.92.4 5da689c313, 2019-01-14"
|
|
||||||
version="1.0"
|
|
||||||
sodipodi:docname="gtk-logo.svg"
|
|
||||||
inkscape:output_extension="org.inkscape.output.svg.inkscape"
|
|
||||||
inkscape:export-filename="/home/ebassi/Pictures/gtk-logo-256.png"
|
|
||||||
inkscape:export-xdpi="192"
|
|
||||||
inkscape:export-ydpi="192">
|
|
||||||
<defs
|
|
||||||
id="defs6845">
|
|
||||||
<inkscape:perspective
|
|
||||||
sodipodi:type="inkscape:persp3d"
|
|
||||||
inkscape:vp_x="-50 : 600 : 1"
|
|
||||||
inkscape:vp_y="0 : 1000 : 0"
|
|
||||||
inkscape:vp_z="700 : 600 : 1"
|
|
||||||
inkscape:persp3d-origin="300 : 400 : 1"
|
|
||||||
id="perspective13" />
|
|
||||||
</defs>
|
|
||||||
<sodipodi:namedview
|
|
||||||
id="base"
|
|
||||||
pagecolor="#ffffff"
|
|
||||||
bordercolor="#666666"
|
|
||||||
borderopacity="1.0"
|
|
||||||
inkscape:pageopacity="0"
|
|
||||||
inkscape:pageshadow="2"
|
|
||||||
inkscape:zoom="2.8284271"
|
|
||||||
inkscape:cx="69.874353"
|
|
||||||
inkscape:cy="64.313526"
|
|
||||||
inkscape:current-layer="layer1"
|
|
||||||
showgrid="false"
|
|
||||||
inkscape:document-units="px"
|
|
||||||
inkscape:grid-bbox="true"
|
|
||||||
width="128px"
|
|
||||||
height="128px"
|
|
||||||
showguides="true"
|
|
||||||
inkscape:guide-bbox="true"
|
|
||||||
inkscape:window-width="1920"
|
|
||||||
inkscape:window-height="1016"
|
|
||||||
inkscape:window-x="0"
|
|
||||||
inkscape:window-y="27"
|
|
||||||
inkscape:window-maximized="1">
|
|
||||||
<inkscape:grid
|
|
||||||
type="xygrid"
|
|
||||||
id="grid7947" />
|
|
||||||
</sodipodi:namedview>
|
|
||||||
<metadata
|
|
||||||
id="metadata6848">
|
|
||||||
<rdf:RDF>
|
|
||||||
<cc:Work
|
|
||||||
rdf:about="">
|
|
||||||
<dc:format>image/svg+xml</dc:format>
|
|
||||||
<dc:type
|
|
||||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
|
||||||
<dc:title />
|
|
||||||
<dc:date />
|
|
||||||
<dc:creator>
|
|
||||||
<cc:Agent>
|
|
||||||
<dc:title />
|
|
||||||
</cc:Agent>
|
|
||||||
</dc:creator>
|
|
||||||
<dc:rights>
|
|
||||||
<cc:Agent>
|
|
||||||
<dc:title />
|
|
||||||
</cc:Agent>
|
|
||||||
</dc:rights>
|
|
||||||
<dc:publisher>
|
|
||||||
<cc:Agent>
|
|
||||||
<dc:title />
|
|
||||||
</cc:Agent>
|
|
||||||
</dc:publisher>
|
|
||||||
<dc:identifier />
|
|
||||||
<dc:source />
|
|
||||||
<dc:relation />
|
|
||||||
<dc:language />
|
|
||||||
<dc:subject>
|
|
||||||
<rdf:Bag />
|
|
||||||
</dc:subject>
|
|
||||||
<dc:coverage />
|
|
||||||
<dc:description />
|
|
||||||
<dc:contributor>
|
|
||||||
<cc:Agent>
|
|
||||||
<dc:title />
|
|
||||||
</cc:Agent>
|
|
||||||
</dc:contributor>
|
|
||||||
<cc:license
|
|
||||||
rdf:resource="" />
|
|
||||||
</cc:Work>
|
|
||||||
<cc:Work
|
|
||||||
rdf:about="">
|
|
||||||
<dc:format>image/svg+xml</dc:format>
|
|
||||||
<dc:type
|
|
||||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
|
||||||
</cc:Work>
|
|
||||||
</rdf:RDF>
|
|
||||||
</metadata>
|
|
||||||
<g
|
|
||||||
id="layer1"
|
|
||||||
inkscape:label="Layer 1"
|
|
||||||
inkscape:groupmode="layer">
|
|
||||||
<path
|
|
||||||
sodipodi:nodetypes="ccccc"
|
|
||||||
id="path6976"
|
|
||||||
d="M 20.88413,30.82696 L 53.816977,55.527708 L 107.33282,39.060543 L 70.587303,17.177763 L 20.88413,30.82696 z"
|
|
||||||
style="fill:#729fcf;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:2.12364459;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline" />
|
|
||||||
<path
|
|
||||||
id="path6978"
|
|
||||||
d="M 22.94243,82.287118 L 20.88413,30.82696 L 53.816977,55.527708 L 53.816977,111.10486 L 22.94243,82.287118 z"
|
|
||||||
style="fill:#e40000;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:2.12364459;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline" />
|
|
||||||
<path
|
|
||||||
id="path6980"
|
|
||||||
d="M 53.816977,111.10486 L 103.21619,90.5207 L 107.33282,39.060543 L 53.816977,55.527708 L 53.816977,111.10486 z"
|
|
||||||
style="fill:#7fe719;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:2.12364459;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline" />
|
|
||||||
<path
|
|
||||||
sodipodi:nodetypes="ccc"
|
|
||||||
id="path6982"
|
|
||||||
d="M 23.216626,81.319479 L 70.48573,67.361442 L 103.38422,90.444516"
|
|
||||||
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
|
||||||
<path
|
|
||||||
sodipodi:nodetypes="cc"
|
|
||||||
id="path6984"
|
|
||||||
d="M 70.434539,17.875593 L 70.434539,66.984877"
|
|
||||||
style="opacity:1;fill:#babdb6;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 4.8 KiB |
@@ -456,33 +456,43 @@ gtk_fishbowl_do_update (GtkFishbowl *fishbowl)
|
|||||||
{
|
{
|
||||||
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
||||||
GdkFrameClock *frame_clock;
|
GdkFrameClock *frame_clock;
|
||||||
GdkFrameTimings *end;
|
GdkFrameTimings *start, *end;
|
||||||
gint64 end_counter;
|
gint64 start_counter, end_counter;
|
||||||
double fps, expected_fps;
|
gint64 n_frames, expected_frames;
|
||||||
|
gint64 start_timestamp, end_timestamp;
|
||||||
gint64 interval;
|
gint64 interval;
|
||||||
|
|
||||||
frame_clock = gtk_widget_get_frame_clock (GTK_WIDGET (fishbowl));
|
frame_clock = gtk_widget_get_frame_clock (GTK_WIDGET (fishbowl));
|
||||||
if (frame_clock == NULL)
|
if (frame_clock == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fps = gdk_frame_clock_get_fps (frame_clock);
|
start_counter = gdk_frame_clock_get_history_start (frame_clock);
|
||||||
if (fps <= 0.0)
|
end_counter = gdk_frame_clock_get_frame_counter (frame_clock);
|
||||||
|
start = gdk_frame_clock_get_timings (frame_clock, start_counter);
|
||||||
|
for (end = gdk_frame_clock_get_timings (frame_clock, end_counter);
|
||||||
|
end_counter > start_counter && end != NULL && !gdk_frame_timings_get_complete (end);
|
||||||
|
end = gdk_frame_clock_get_timings (frame_clock, end_counter))
|
||||||
|
end_counter--;
|
||||||
|
if (end_counter - start_counter < 4)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
priv->framerate = fps;
|
start_timestamp = gdk_frame_timings_get_presentation_time (start);
|
||||||
|
end_timestamp = gdk_frame_timings_get_presentation_time (end);
|
||||||
|
if (start_timestamp == 0 || end_timestamp == 0)
|
||||||
|
{
|
||||||
|
start_timestamp = gdk_frame_timings_get_frame_time (start);
|
||||||
|
end_timestamp = gdk_frame_timings_get_frame_time (end);
|
||||||
|
}
|
||||||
|
|
||||||
|
n_frames = end_counter - start_counter;
|
||||||
|
priv->framerate = ((double) n_frames) * G_USEC_PER_SEC / (end_timestamp - start_timestamp);
|
||||||
|
priv->framerate = ((int)(priv->framerate * 100))/100.0;
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (fishbowl), props[PROP_FRAMERATE]);
|
g_object_notify_by_pspec (G_OBJECT (fishbowl), props[PROP_FRAMERATE]);
|
||||||
|
|
||||||
if (!priv->benchmark)
|
if (!priv->benchmark)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
end_counter = gdk_frame_clock_get_frame_counter (frame_clock);
|
|
||||||
for (end = gdk_frame_clock_get_timings (frame_clock, end_counter);
|
|
||||||
end != NULL && !gdk_frame_timings_get_complete (end);
|
|
||||||
end = gdk_frame_clock_get_timings (frame_clock, end_counter))
|
|
||||||
end_counter--;
|
|
||||||
if (end == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
interval = gdk_frame_timings_get_refresh_interval (end);
|
interval = gdk_frame_timings_get_refresh_interval (end);
|
||||||
if (interval == 0)
|
if (interval == 0)
|
||||||
{
|
{
|
||||||
@@ -490,16 +500,16 @@ gtk_fishbowl_do_update (GtkFishbowl *fishbowl)
|
|||||||
if (interval == 0)
|
if (interval == 0)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
expected_fps = (double) G_USEC_PER_SEC / interval;
|
expected_frames = round ((double) (end_timestamp - start_timestamp) / interval);
|
||||||
|
|
||||||
if (fps > (expected_fps - 1))
|
if (n_frames >= expected_frames)
|
||||||
{
|
{
|
||||||
if (priv->last_benchmark_change > 0)
|
if (priv->last_benchmark_change > 0)
|
||||||
priv->last_benchmark_change *= 2;
|
priv->last_benchmark_change *= 2;
|
||||||
else
|
else
|
||||||
priv->last_benchmark_change = 1;
|
priv->last_benchmark_change = 1;
|
||||||
}
|
}
|
||||||
else if (0.95 * fps < expected_fps)
|
else if (n_frames + 1 < expected_frames)
|
||||||
{
|
{
|
||||||
if (priv->last_benchmark_change < 0)
|
if (priv->last_benchmark_change < 0)
|
||||||
priv->last_benchmark_change--;
|
priv->last_benchmark_change--;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ get_win32_all_locales_scripts (LPWSTR locale_w, DWORD flags, LPARAM param)
|
|||||||
{
|
{
|
||||||
wchar_t *langname_w = NULL;
|
wchar_t *langname_w = NULL;
|
||||||
wchar_t locale_abbrev_w[9];
|
wchar_t locale_abbrev_w[9];
|
||||||
gchar *langname, *locale_abbrev, *locale;
|
gchar *langname, *locale_abbrev, *locale, *p;
|
||||||
gint i;
|
gint i;
|
||||||
const LCTYPE iso639_lctypes[] = { LOCALE_SISO639LANGNAME, LOCALE_SISO639LANGNAME2 };
|
const LCTYPE iso639_lctypes[] = { LOCALE_SISO639LANGNAME, LOCALE_SISO639LANGNAME2 };
|
||||||
GHashTable *ht_scripts_langs = (GHashTable *) param;
|
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);
|
GetLocaleInfoEx (locale_w, LOCALE_SLOCALIZEDDISPLAYNAME, langname_w, langname_size);
|
||||||
langname = g_utf16_to_utf8 (langname_w, -1, NULL, NULL, NULL);
|
langname = g_utf16_to_utf8 (langname_w, -1, NULL, NULL, NULL);
|
||||||
locale = g_utf16_to_utf8 (locale_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);
|
lang = pango_language_from_string (locale);
|
||||||
if (g_hash_table_lookup (ht_scripts_langs, lang) == NULL)
|
if (g_hash_table_lookup (ht_scripts_langs, lang) == NULL)
|
||||||
g_hash_table_insert (ht_scripts_langs, lang, langname);
|
g_hash_table_insert (ht_scripts_langs, lang, langname);
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <glib/gstdio.h>
|
#include <glib/gstdio.h>
|
||||||
#include <glib/gi18n.h>
|
|
||||||
|
|
||||||
#include "demos.h"
|
#include "demos.h"
|
||||||
#include "fontify.h"
|
#include "fontify.h"
|
||||||
@@ -924,34 +923,6 @@ clear_search (GtkSearchBar *bar)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
search_results_update (GObject *filter_model,
|
|
||||||
GParamSpec *pspec,
|
|
||||||
GtkEntry *entry)
|
|
||||||
{
|
|
||||||
gsize n_items = g_list_model_get_n_items (G_LIST_MODEL (filter_model));
|
|
||||||
|
|
||||||
if (strlen (gtk_editable_get_text (GTK_EDITABLE (entry))) > 0)
|
|
||||||
{
|
|
||||||
char *text;
|
|
||||||
|
|
||||||
if (n_items > 0)
|
|
||||||
text = g_strdup_printf (ngettext ("%ld search result", "%ld search results", n_items), n_items);
|
|
||||||
else
|
|
||||||
text = g_strdup (_("No search results"));
|
|
||||||
|
|
||||||
gtk_accessible_update_property (GTK_ACCESSIBLE (entry),
|
|
||||||
GTK_ACCESSIBLE_PROPERTY_DESCRIPTION, text,
|
|
||||||
-1);
|
|
||||||
|
|
||||||
g_free (text);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gtk_accessible_reset_property (GTK_ACCESSIBLE (entry), GTK_ACCESSIBLE_PROPERTY_DESCRIPTION);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
activate (GApplication *app)
|
activate (GApplication *app)
|
||||||
{
|
{
|
||||||
@@ -999,7 +970,6 @@ activate (GApplication *app)
|
|||||||
|
|
||||||
search_entry = GTK_WIDGET (gtk_builder_get_object (builder, "search-entry"));
|
search_entry = GTK_WIDGET (gtk_builder_get_object (builder, "search-entry"));
|
||||||
g_signal_connect (search_entry, "search-changed", G_CALLBACK (demo_search_changed_cb), filter);
|
g_signal_connect (search_entry, "search-changed", G_CALLBACK (demo_search_changed_cb), filter);
|
||||||
g_signal_connect (filter_model, "notify::n-items", G_CALLBACK (search_results_update), search_entry);
|
|
||||||
|
|
||||||
selection = gtk_single_selection_new (G_LIST_MODEL (filter_model));
|
selection = gtk_single_selection_new (G_LIST_MODEL (filter_model));
|
||||||
g_signal_connect (selection, "notify::selected-item", G_CALLBACK (selection_cb), NULL);
|
g_signal_connect (selection, "notify::selected-item", G_CALLBACK (selection_cb), NULL);
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
@@ -120,7 +120,7 @@ create_shadertoy_window (GtkWidget *do_widget)
|
|||||||
gtk_box_append (GTK_BOX (box), aspect);
|
gtk_box_append (GTK_BOX (box), aspect);
|
||||||
|
|
||||||
shadertoy = new_shadertoy ("/shadertoy/alienplanet.glsl");
|
shadertoy = new_shadertoy ("/shadertoy/alienplanet.glsl");
|
||||||
gtk_aspect_frame_set_child (GTK_ASPECT_FRAME (aspect), gtk_graphics_offload_new (shadertoy));
|
gtk_aspect_frame_set_child (GTK_ASPECT_FRAME (aspect), shadertoy);
|
||||||
|
|
||||||
sw = gtk_scrolled_window_new ();
|
sw = gtk_scrolled_window_new ();
|
||||||
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (sw), 250);
|
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (sw), 250);
|
||||||
|
|||||||
@@ -330,7 +330,6 @@ stroke bounds of the path.
|
|||||||
| offset | `<point>` | 0 0 | non-default |
|
| offset | `<point>` | 0 0 | non-default |
|
||||||
| hint-style | `<hint style>` | slight | non-default |
|
| hint-style | `<hint style>` | slight | non-default |
|
||||||
| antialias | `<antialias>` | gray | 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.
|
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 values for hint-style are none, slight or full.
|
||||||
Possible value for antialias are none or gray.
|
Possible value for antialias are none or gray.
|
||||||
Possible value for hint-metrics are on or off.
|
|
||||||
|
|
||||||
### texture
|
### texture
|
||||||
|
|
||||||
|
|||||||
@@ -5,11 +5,8 @@ Title: Cairo interaction
|
|||||||
[Cairo](http://cairographics.org) is a graphics library that supports vector
|
[Cairo](http://cairographics.org) is a graphics library that supports vector
|
||||||
graphics and image compositing that can be used with GTK.
|
graphics and image compositing that can be used with GTK.
|
||||||
|
|
||||||
GDK does not wrap the Cairo API and it is not possible to use cairo directly
|
GDK does not wrap the Cairo API; instead it allows to create Cairo
|
||||||
to draw on a [class@Gdk.Surface]. You can either use a
|
drawing contexts which can be used to draw on [class@Gdk.Surface]s.
|
||||||
[GtkDrawingArea](../gtk4/class.DrawingArea.html) widget or
|
|
||||||
[gtk_snapshot_append_cairo](../gtk4/func.Snapshot.append_cairo.html)
|
|
||||||
for drawing with cairo in a GTK4 application.
|
|
||||||
|
|
||||||
Additional functions allow use [struct@Gdk.Rectangle]s with Cairo
|
Additional functions allow use [struct@Gdk.Rectangle]s with Cairo
|
||||||
and to use [struct@Gdk.RGBA], `GdkPixbuf`, and [class@Gdk.Surface]
|
and to use [struct@Gdk.RGBA], `GdkPixbuf`, and [class@Gdk.Surface]
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
@@ -74,7 +74,6 @@ in a selector, widget names must be prefixed with a # character.
|
|||||||
| E:not(selector) | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#negation) | |
|
| E:not(selector) | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#negation) | |
|
||||||
| E:dir(ltr), E:dir(rtl) | [CSS Selector Level 4](https://drafts.csswg.org/selectors/#the-dir-pseudo) | |
|
| E:dir(ltr), E:dir(rtl) | [CSS Selector Level 4](https://drafts.csswg.org/selectors/#the-dir-pseudo) | |
|
||||||
| E:drop(active) | [CSS Selector Level 4](https://drafts.csswg.org/selectors/#drag-pseudos) | |
|
| E:drop(active) | [CSS Selector Level 4](https://drafts.csswg.org/selectors/#drag-pseudos) | |
|
||||||
| E:root | [CSS Selector Level 3](https://www.w3.org/TR/selectors-3/#root-pseudo) | |
|
|
||||||
| E F | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#descendent-combinators) | |
|
| E F | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#descendent-combinators) | |
|
||||||
| E > F | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#child-combinators) | |
|
| E > F | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#child-combinators) | |
|
||||||
| E ~ F | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#general-sibling-combinators) | |
|
| E ~ F | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#general-sibling-combinators) | |
|
||||||
|
|||||||
@@ -56,30 +56,6 @@ follows:
|
|||||||
1 value:
|
1 value:
|
||||||
: all
|
: 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
|
## Colors
|
||||||
|
|
||||||
GTK extends the CSS syntax with several additional ways to specify colors.
|
GTK extends the CSS syntax with several additional ways to specify colors.
|
||||||
|
|||||||
@@ -8,10 +8,6 @@ gtk4-broadwayd
|
|||||||
The Broadway display server
|
The Broadway display server
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
:Version: GTK
|
|
||||||
:Manual section: 1
|
|
||||||
:Manual group: GTK commands
|
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
| **gtk4-broadwayd** [OPTIONS...] <DISPLAY>
|
| **gtk4-broadwayd** [OPTIONS...] <DISPLAY>
|
||||||
|
|||||||
@@ -8,10 +8,6 @@ gtk4-builder-tool
|
|||||||
GtkBuilder File Utility
|
GtkBuilder File Utility
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
:Version: GTK
|
|
||||||
:Manual section: 1
|
|
||||||
:Manual group: GTK commands
|
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
| **gtk4-builder-tool** <COMMAND> [OPTIONS...] <FILE>
|
| **gtk4-builder-tool** <COMMAND> [OPTIONS...] <FILE>
|
||||||
|
|||||||
@@ -8,9 +8,6 @@ gtk4-demo-application
|
|||||||
Demonstrate GtkApplication
|
Demonstrate GtkApplication
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
:Version: GTK
|
|
||||||
:Manual section: 1
|
|
||||||
:Manual group: GTK commands
|
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
|
|||||||
@@ -8,10 +8,6 @@ gtk4-demo
|
|||||||
Demonstrate GTK widgets
|
Demonstrate GTK widgets
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
:Version: GTK
|
|
||||||
:Manual section: 1
|
|
||||||
:Manual group: GTK commands
|
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,6 @@ gtk4-encode-symbolic-svg
|
|||||||
Symbolic icon conversion utility
|
Symbolic icon conversion utility
|
||||||
--------------------------------
|
--------------------------------
|
||||||
|
|
||||||
:Version: GTK
|
|
||||||
:Manual section: 1
|
|
||||||
:Manual group: GTK commands
|
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,6 @@ gtk4-icon-browser
|
|||||||
List themed icons
|
List themed icons
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
:Version: GTK
|
|
||||||
:Manual section: 1
|
|
||||||
:Manual group: GTK commands
|
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,6 @@ gtk4-launch
|
|||||||
Launch an application
|
Launch an application
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
:Version: GTK
|
|
||||||
:Manual section: 1
|
|
||||||
:Manual group: GTK commands
|
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,6 @@ gtk4-node-editor
|
|||||||
Editor render nodes
|
Editor render nodes
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
:Version: GTK
|
|
||||||
:Manual section: 1
|
|
||||||
:Manual group: GTK commands
|
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,6 @@ gtk4-path-tool
|
|||||||
GskPath Utility
|
GskPath Utility
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
:Version: GTK
|
|
||||||
:Manual section: 1
|
|
||||||
:Manual group: GTK commands
|
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
| **gtk4-path-tool** <COMMAND> [OPTIONS...] <PATH>
|
| **gtk4-path-tool** <COMMAND> [OPTIONS...] <PATH>
|
||||||
|
|||||||
@@ -8,10 +8,6 @@ gtk4-query-settings
|
|||||||
Print name and value of GTK settings
|
Print name and value of GTK settings
|
||||||
------------------------------------
|
------------------------------------
|
||||||
|
|
||||||
:Version: GTK
|
|
||||||
:Manual section: 1
|
|
||||||
:Manual group: GTK commands
|
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,6 @@ gtk4-rendernode-tool
|
|||||||
GskRenderNode Utility
|
GskRenderNode Utility
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
:Version: GTK
|
|
||||||
:Manual section: 1
|
|
||||||
:Manual group: GTK commands
|
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
| **gtk4-rendernode-tool** <COMMAND> [OPTIONS...] <FILE>
|
| **gtk4-rendernode-tool** <COMMAND> [OPTIONS...] <FILE>
|
||||||
@@ -49,14 +45,13 @@ without any titlebar.
|
|||||||
Rendering
|
Rendering
|
||||||
^^^^^^^^^
|
^^^^^^^^^
|
||||||
|
|
||||||
The ``render`` command saves a rendering of the rendernode as a png, tiff or svg
|
The ``render`` command saves a rendering of the rendernode as a png or tiff image.
|
||||||
image or as pdf document. The name of the file to write can be specified as a second
|
The name of the file to write can be specified as a second FILE argument.
|
||||||
FILE argument.
|
|
||||||
|
|
||||||
``--renderer=RENDERER``
|
``--renderer=RENDERER``
|
||||||
|
|
||||||
Use the given renderer. Use ``--renderer=help`` to get a information
|
Use the given renderer. Use ``--renderer=help`` to get a information
|
||||||
about possible values for the ``RENDERER``.
|
about poassible values for the ``RENDERER``.
|
||||||
|
|
||||||
Benchmark
|
Benchmark
|
||||||
^^^^^^^^^
|
^^^^^^^^^
|
||||||
@@ -98,4 +93,4 @@ exit code is 1. If the images are identical, it is 0.
|
|||||||
|
|
||||||
``--quiet``
|
``--quiet``
|
||||||
|
|
||||||
Don't write results to stdout.
|
Don't write results to stdout.`
|
||||||
|
|||||||
@@ -8,10 +8,6 @@ gtk4-update-icon-cache
|
|||||||
Icon theme caching utility
|
Icon theme caching utility
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
:Version: GTK
|
|
||||||
:Manual section: 1
|
|
||||||
:Manual group: GTK commands
|
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,6 @@ gtk4-widget-factory
|
|||||||
Showcase GTK widgets and styles
|
Showcase GTK widgets and styles
|
||||||
-------------------------------
|
-------------------------------
|
||||||
|
|
||||||
:Version: GTK
|
|
||||||
:Manual section: 1
|
|
||||||
:Manual group: GTK commands
|
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ if get_option('man-pages') and rst2man.found()
|
|||||||
[ 'gtk4-path-tool', '1', ],
|
[ 'gtk4-path-tool', '1', ],
|
||||||
]
|
]
|
||||||
|
|
||||||
if get_option('build-demos')
|
if get_option('demos')
|
||||||
rst_files += [
|
rst_files += [
|
||||||
[ 'gtk4-demo', '1', ],
|
[ 'gtk4-demo', '1', ],
|
||||||
[ 'gtk4-demo-application', '1', ],
|
[ 'gtk4-demo-application', '1', ],
|
||||||
|
|||||||
@@ -58,12 +58,12 @@ GTK is divided into three parts:
|
|||||||
storage types for efficient use in GUI applications, and much more.
|
storage types for efficient use in GUI applications, and much more.
|
||||||
|
|
||||||
[gnu-lgpl]: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
|
[gnu-lgpl]: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
|
||||||
[glib]: https://docs.gtk.org/glib/
|
[glib]: https://developer.gnome.org/glib/stable/
|
||||||
[gobject]: https://docs.gtk.org/gobject/
|
[gobject]: https://developer.gnome.org/gobject/stable/
|
||||||
[gio]: https://docs.gtk.org/gio/
|
[gio]: https://developer.gnome.org/gio/stable/
|
||||||
[cairo]: https://www.cairographics.org/manual/
|
[cairo]: https://www.cairographics.org/manual/
|
||||||
[opengl]: https://www.opengl.org/about/
|
[opengl]: https://www.opengl.org/about/
|
||||||
[vulkan]: https://www.vulkan.org/
|
[vulkan]: https://www.vulkan.org/
|
||||||
[pango]: https://docs.gtk.org/pango/
|
[pango]: https://pango.gnome.org/
|
||||||
[gdkpixbuf]: https://docs.gtk.org/gdk-pixbuf/
|
[gdkpixbuf]: https://developer.gnome.org/gdk-pixbuf/stable/
|
||||||
[graphene]: https://ebassi.github.io/graphene/
|
[graphene]: https://ebassi.github.io/graphene/
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ the question you have, this list is a good place to start.
|
|||||||
Every major version of GTK comes with a [migration guide](#migrating). You may also
|
Every major version of GTK comes with a [migration guide](#migrating). You may also
|
||||||
find useful information in the documentation for specific widgets and functions. If
|
find useful information in the documentation for specific widgets and functions. If
|
||||||
you have a question not covered in the manual, feel free to ask, and please
|
you have a question not covered in the manual, feel free to ask, and please
|
||||||
[file a bug report](https://gitlab.gnome.org/GNOME/gtk/issues/) against the
|
[file a bug report](https://gitlab.gnome.org/GNOME/gtk/issues/new) against the
|
||||||
documentation.
|
documentation.
|
||||||
|
|
||||||
* Should I maintain parallel versions of my UI in GTK x and GTK y?
|
* Should I maintain parallel versions of my UI in GTK x and GTK y?
|
||||||
@@ -54,7 +54,7 @@ the question you have, this list is a good place to start.
|
|||||||
For strings returned from functions, they will be declared "const" if they should
|
For strings returned from functions, they will be declared "const" if they should
|
||||||
not be freed. Non-const strings should be freed with `g_free()`. Arrays follow the
|
not be freed. Non-const strings should be freed with `g_free()`. Arrays follow the
|
||||||
same rule. If you find an undocumented exception to the rules, please
|
same rule. If you find an undocumented exception to the rules, please
|
||||||
[file a bug report.](https://gitlab.gnome.org/GNOME/gtk/issues/).
|
[file a bug report.](https://gitlab.gnome.org/GNOME/gtk/issues/new).
|
||||||
|
|
||||||
The transfer annotations for gobject-introspection that are part of the
|
The transfer annotations for gobject-introspection that are part of the
|
||||||
documentation can provide useful hints for memory handling semantics as well.
|
documentation can provide useful hints for memory handling semantics as well.
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Slug: gtk-resources
|
|||||||
## Opening a bug or feature request
|
## Opening a bug or feature request
|
||||||
|
|
||||||
If you encounter a bug, misfeature, or missing feature in GTK, please
|
If you encounter a bug, misfeature, or missing feature in GTK, please
|
||||||
file a bug report on our [GitLab project](https://gitlab.gnome.org/GNOME/gtk/issues/).
|
file a bug report on our [GitLab project](https://gitlab.gnome.org/GNOME/gtk/issues/new).
|
||||||
You should also file issues if the documentation is out of date with the
|
You should also file issues if the documentation is out of date with the
|
||||||
existing API, or unclear.
|
existing API, or unclear.
|
||||||
|
|
||||||
|
|||||||
@@ -217,10 +217,6 @@ A number of options affect behavior instead of logging:
|
|||||||
`no-portals`
|
`no-portals`
|
||||||
: Disable use of [portals](https://docs.flatpak.org/en/latest/portals.html)
|
: Disable use of [portals](https://docs.flatpak.org/en/latest/portals.html)
|
||||||
|
|
||||||
`force-offload`
|
|
||||||
: Force graphics offload for all textures, even when slower. This allows
|
|
||||||
to debug offloading in the absence of dmabufs.
|
|
||||||
|
|
||||||
`gl-disable`
|
`gl-disable`
|
||||||
: Disable OpenGL support
|
: Disable OpenGL support
|
||||||
|
|
||||||
|
|||||||
@@ -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_MIN | “aria-valuemin” | double |
|
||||||
| %GTK_ACCESSIBLE_PROPERTY_VALUE_NOW | “aria-valuenow” | double |
|
| %GTK_ACCESSIBLE_PROPERTY_VALUE_NOW | “aria-valuenow” | double |
|
||||||
| %GTK_ACCESSIBLE_PROPERTY_VALUE_TEXT | “aria-valuetext” | translatable string |
|
| %GTK_ACCESSIBLE_PROPERTY_VALUE_TEXT | “aria-valuetext” | translatable string |
|
||||||
| %GTK_ACCESSIBLE_PROPERTY_HELP_TEXT | N/A | translatable string |
|
|
||||||
|
|
||||||
#### List of accessible relations
|
#### 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
|
the accessible attributes of each widget, and also provides an overlay that
|
||||||
can highlight accessibility issues.
|
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:
|
It is possible to set accessible attributes in UI files as well:
|
||||||
```xml
|
```xml
|
||||||
<object class="GtkButton" id="button1">
|
<object class="GtkButton" id="button1">
|
||||||
|
|||||||
@@ -91,31 +91,6 @@ const GDK_META_MASK = 1 << 28;
|
|||||||
|
|
||||||
var useDataUrls = window.location.search.includes("datauri");
|
var useDataUrls = window.location.search.includes("datauri");
|
||||||
|
|
||||||
/* check if we are on Android and using Chrome */
|
|
||||||
var isAndroidChrome = false;
|
|
||||||
{
|
|
||||||
var ua = navigator.userAgent.toLowerCase();
|
|
||||||
if (ua.indexOf("android") > -1 && ua.indexOf("chrom") > -1) {
|
|
||||||
isAndroidChrome = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* check for the passive option for Event listener */
|
|
||||||
let passiveSupported = false;
|
|
||||||
try {
|
|
||||||
const options = {
|
|
||||||
get passive() { // This function will be called when the browser
|
|
||||||
// attempts to access the passive property.
|
|
||||||
passiveSupported = true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
window.addEventListener("test", null, options);
|
|
||||||
window.removeEventListener("test", null, options);
|
|
||||||
} catch(err) {
|
|
||||||
passiveSupported = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This base64code is based on https://github.com/beatgammit/base64-js/blob/master/index.js which is MIT licensed */
|
/* This base64code is based on https://github.com/beatgammit/base64-js/blob/master/index.js which is MIT licensed */
|
||||||
|
|
||||||
var b64_lookup = [];
|
var b64_lookup = [];
|
||||||
@@ -240,32 +215,11 @@ function logStackTrace(len) {
|
|||||||
log(callstack[i]);
|
log(callstack[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Helper functions for touch identifier to make it unique on Android */
|
|
||||||
var globalTouchIdentifier = Math.round(Date.now() / 1000);
|
|
||||||
function touchIdentifierStart(tId)
|
|
||||||
{
|
|
||||||
if (isAndroidChrome) {
|
|
||||||
if (tId == 0) {
|
|
||||||
return ++globalTouchIdentifier;
|
|
||||||
}
|
|
||||||
return globalTouchIdentifier + tId;
|
|
||||||
}
|
|
||||||
return tId;
|
|
||||||
}
|
|
||||||
function touchIdentifier(tId)
|
|
||||||
{
|
|
||||||
if (isAndroidChrome) {
|
|
||||||
return globalTouchIdentifier + tId;
|
|
||||||
}
|
|
||||||
return tId;
|
|
||||||
}
|
|
||||||
|
|
||||||
var grab = new Object();
|
var grab = new Object();
|
||||||
grab.surface = null;
|
grab.surface = null;
|
||||||
grab.ownerEvents = false;
|
grab.ownerEvents = false;
|
||||||
grab.implicit = false;
|
grab.implicit = false;
|
||||||
var keyDownList = [];
|
var keyDownList = [];
|
||||||
var inputList = [];
|
|
||||||
var lastSerial = 0;
|
var lastSerial = 0;
|
||||||
var lastX = 0;
|
var lastX = 0;
|
||||||
var lastY = 0;
|
var lastY = 0;
|
||||||
@@ -1033,14 +987,7 @@ function handleDisplayCommands(display_commands)
|
|||||||
break;
|
break;
|
||||||
case DISPLAY_OP_DELETE_SURFACE:
|
case DISPLAY_OP_DELETE_SURFACE:
|
||||||
var id = cmd[1];
|
var id = cmd[1];
|
||||||
if (id == surfaceWithMouse) {
|
delete surfaces[id];
|
||||||
surfaceWithMouse = 0;
|
|
||||||
}
|
|
||||||
if (id == realSurfaceWithMouse) {
|
|
||||||
realSurfaceWithMouse = 0;
|
|
||||||
firstTouchDownId = null;
|
|
||||||
}
|
|
||||||
delete surfaces[id];
|
|
||||||
break;
|
break;
|
||||||
case DISPLAY_OP_CHANGE_TEXTURE:
|
case DISPLAY_OP_CHANGE_TEXTURE:
|
||||||
var image = cmd[1];
|
var image = cmd[1];
|
||||||
@@ -1424,14 +1371,8 @@ function getEffectiveEventTarget (id) {
|
|||||||
function updateKeyboardStatus() {
|
function updateKeyboardStatus() {
|
||||||
if (fakeInput != null && showKeyboardChanged) {
|
if (fakeInput != null && showKeyboardChanged) {
|
||||||
showKeyboardChanged = false;
|
showKeyboardChanged = false;
|
||||||
if (showKeyboard) {
|
if (showKeyboard)
|
||||||
if (isAndroidChrome) {
|
|
||||||
fakeInput.blur();
|
|
||||||
fakeInput.value = ' '.repeat(80); // TODO: Should be exchange with broadway server
|
|
||||||
// to bring real value here.
|
|
||||||
}
|
|
||||||
fakeInput.focus();
|
fakeInput.focus();
|
||||||
}
|
|
||||||
else
|
else
|
||||||
fakeInput.blur();
|
fakeInput.blur();
|
||||||
}
|
}
|
||||||
@@ -2983,19 +2924,6 @@ function pushKeyEvent(fev) {
|
|||||||
keyDownList.push(fev);
|
keyDownList.push(fev);
|
||||||
}
|
}
|
||||||
|
|
||||||
function copyInputEvent(ev) {
|
|
||||||
var members = ['inputType', 'data'], i, obj = {};
|
|
||||||
for (i = 0; i < members.length; i++) {
|
|
||||||
if (typeof ev[members[i]] !== "undefined")
|
|
||||||
obj[members[i]] = ev[members[i]];
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
function pushInputEvent(fev) {
|
|
||||||
inputList.push(fev);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getKeyEvent(keyCode, pop) {
|
function getKeyEvent(keyCode, pop) {
|
||||||
var i, fev = null;
|
var i, fev = null;
|
||||||
for (i = keyDownList.length-1; i >= 0; i--) {
|
for (i = keyDownList.length-1; i >= 0; i--) {
|
||||||
@@ -3094,29 +3022,6 @@ function handleKeyUp(e) {
|
|||||||
keysym = fev.keysym;
|
keysym = fev.keysym;
|
||||||
else {
|
else {
|
||||||
//log("Key event (keyCode = " + ev.keyCode + ") not found on keyDownList");
|
//log("Key event (keyCode = " + ev.keyCode + ") not found on keyDownList");
|
||||||
if (isAndroidChrome && (ev.keyCode == 229)) {
|
|
||||||
var i, fev = null, len = inputList.length, str;
|
|
||||||
for (i = 0; i < len; i++) {
|
|
||||||
fev = inputList[i];
|
|
||||||
switch(fev.inputType) {
|
|
||||||
case "deleteContentBackward":
|
|
||||||
sendInput(BROADWAY_EVENT_KEY_PRESS, [65288, lastState]);
|
|
||||||
sendInput(BROADWAY_EVENT_KEY_RELEASE, [65288, lastState]);
|
|
||||||
break;
|
|
||||||
case "insertText":
|
|
||||||
if (fev.data !== undefined) {
|
|
||||||
for (let sym of fev.data) {
|
|
||||||
sendInput(BROADWAY_EVENT_KEY_PRESS, [sym.codePointAt(0), lastState]);
|
|
||||||
sendInput(BROADWAY_EVENT_KEY_RELEASE, [sym.codePointAt(0), lastState]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
inputList.splice(0, len);
|
|
||||||
}
|
|
||||||
keysym = 0;
|
keysym = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3125,16 +3030,6 @@ function handleKeyUp(e) {
|
|||||||
return cancelEvent(ev);
|
return cancelEvent(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleInput (e) {
|
|
||||||
var fev = null, ev = (e ? e : window.event), keysym = null, suppress = false;
|
|
||||||
|
|
||||||
fev = copyInputEvent(ev);
|
|
||||||
pushInputEvent(fev);
|
|
||||||
|
|
||||||
// Stop keypress events just in case
|
|
||||||
return cancelEvent(ev);
|
|
||||||
}
|
|
||||||
|
|
||||||
function onKeyDown (ev) {
|
function onKeyDown (ev) {
|
||||||
updateForEvent(ev);
|
updateForEvent(ev);
|
||||||
return handleKeyDown(ev);
|
return handleKeyDown(ev);
|
||||||
@@ -3150,11 +3045,6 @@ function onKeyUp (ev) {
|
|||||||
return handleKeyUp(ev);
|
return handleKeyUp(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onInput (ev) {
|
|
||||||
updateForEvent(ev);
|
|
||||||
return handleInput(ev);
|
|
||||||
}
|
|
||||||
|
|
||||||
function cancelEvent(ev)
|
function cancelEvent(ev)
|
||||||
{
|
{
|
||||||
ev = ev ? ev : window.event;
|
ev = ev ? ev : window.event;
|
||||||
@@ -3186,14 +3076,13 @@ function onMouseWheel(ev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onTouchStart(ev) {
|
function onTouchStart(ev) {
|
||||||
ev.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
updateKeyboardStatus();
|
updateKeyboardStatus();
|
||||||
updateForEvent(ev);
|
updateForEvent(ev);
|
||||||
|
|
||||||
for (var i = 0; i < ev.changedTouches.length; i++) {
|
for (var i = 0; i < ev.changedTouches.length; i++) {
|
||||||
var touch = ev.changedTouches.item(i);
|
var touch = ev.changedTouches.item(i);
|
||||||
var touchId = touchIdentifierStart(touch.identifier);
|
|
||||||
|
|
||||||
var origId = getSurfaceId(touch);
|
var origId = getSurfaceId(touch);
|
||||||
var id = getEffectiveEventTarget (origId);
|
var id = getEffectiveEventTarget (origId);
|
||||||
@@ -3201,7 +3090,7 @@ function onTouchStart(ev) {
|
|||||||
var isEmulated = 0;
|
var isEmulated = 0;
|
||||||
|
|
||||||
if (firstTouchDownId == null) {
|
if (firstTouchDownId == null) {
|
||||||
firstTouchDownId = touchId;
|
firstTouchDownId = touch.identifier;
|
||||||
isEmulated = 1;
|
isEmulated = 1;
|
||||||
|
|
||||||
if (realSurfaceWithMouse != origId || id != surfaceWithMouse) {
|
if (realSurfaceWithMouse != origId || id != surfaceWithMouse) {
|
||||||
@@ -3216,54 +3105,52 @@ function onTouchStart(ev) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sendInput (BROADWAY_EVENT_TOUCH, [0, id, touchId, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
|
sendInput (BROADWAY_EVENT_TOUCH, [0, id, touch.identifier, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onTouchMove(ev) {
|
function onTouchMove(ev) {
|
||||||
ev.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
updateKeyboardStatus();
|
updateKeyboardStatus();
|
||||||
updateForEvent(ev);
|
updateForEvent(ev);
|
||||||
|
|
||||||
for (var i = 0; i < ev.changedTouches.length; i++) {
|
for (var i = 0; i < ev.changedTouches.length; i++) {
|
||||||
var touch = ev.changedTouches.item(i);
|
var touch = ev.changedTouches.item(i);
|
||||||
var touchId = touchIdentifier(touch.identifier);
|
|
||||||
|
|
||||||
var origId = getSurfaceId(touch);
|
var origId = getSurfaceId(touch);
|
||||||
var id = getEffectiveEventTarget (origId);
|
var id = getEffectiveEventTarget (origId);
|
||||||
var pos = getPositionsFromEvent(touch, id);
|
var pos = getPositionsFromEvent(touch, id);
|
||||||
|
|
||||||
var isEmulated = 0;
|
var isEmulated = 0;
|
||||||
if (firstTouchDownId == touchId) {
|
if (firstTouchDownId == touch.identifier) {
|
||||||
isEmulated = 1;
|
isEmulated = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
sendInput (BROADWAY_EVENT_TOUCH, [1, id, touchId, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
|
sendInput (BROADWAY_EVENT_TOUCH, [1, id, touch.identifier, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onTouchEnd(ev) {
|
function onTouchEnd(ev) {
|
||||||
ev.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
updateKeyboardStatus();
|
updateKeyboardStatus();
|
||||||
updateForEvent(ev);
|
updateForEvent(ev);
|
||||||
|
|
||||||
for (var i = 0; i < ev.changedTouches.length; i++) {
|
for (var i = 0; i < ev.changedTouches.length; i++) {
|
||||||
var touch = ev.changedTouches.item(i);
|
var touch = ev.changedTouches.item(i);
|
||||||
var touchId = touchIdentifier(touch.identifier);
|
|
||||||
|
|
||||||
var origId = getSurfaceId(touch);
|
var origId = getSurfaceId(touch);
|
||||||
var id = getEffectiveEventTarget (origId);
|
var id = getEffectiveEventTarget (origId);
|
||||||
var pos = getPositionsFromEvent(touch, id);
|
var pos = getPositionsFromEvent(touch, id);
|
||||||
|
|
||||||
var isEmulated = 0;
|
var isEmulated = 0;
|
||||||
if (firstTouchDownId == touchId) {
|
if (firstTouchDownId == touch.identifier) {
|
||||||
isEmulated = 1;
|
isEmulated = 1;
|
||||||
firstTouchDownId = null;
|
firstTouchDownId = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
sendInput (BROADWAY_EVENT_TOUCH, [2, id, touchId, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
|
sendInput (BROADWAY_EVENT_TOUCH, [2, id, touch.identifier, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3280,11 +3167,11 @@ function setupDocument(document)
|
|||||||
document.onkeyup = onKeyUp;
|
document.onkeyup = onKeyUp;
|
||||||
|
|
||||||
if (document.addEventListener) {
|
if (document.addEventListener) {
|
||||||
document.addEventListener('DOMMouseScroll', onMouseWheel, passiveSupported ? { passive: false, capture: false } : false);
|
document.addEventListener('DOMMouseScroll', onMouseWheel, false);
|
||||||
document.addEventListener('mousewheel', onMouseWheel, passiveSupported ? { passive: false, capture: false } : false);
|
document.addEventListener('mousewheel', onMouseWheel, false);
|
||||||
document.addEventListener('touchstart', onTouchStart, passiveSupported ? { passive: false, capture: false } : false);
|
document.addEventListener('touchstart', onTouchStart, false);
|
||||||
document.addEventListener('touchmove', onTouchMove, passiveSupported ? { passive: false, capture: false } : false);
|
document.addEventListener('touchmove', onTouchMove, false);
|
||||||
document.addEventListener('touchend', onTouchEnd, passiveSupported ? { passive: false, capture: false } : false);
|
document.addEventListener('touchend', onTouchEnd, false);
|
||||||
} else if (document.attachEvent) {
|
} else if (document.attachEvent) {
|
||||||
element.attachEvent("onmousewheel", onMouseWheel);
|
element.attachEvent("onmousewheel", onMouseWheel);
|
||||||
}
|
}
|
||||||
@@ -3350,14 +3237,12 @@ function connect()
|
|||||||
};
|
};
|
||||||
|
|
||||||
var iOS = /(iPad|iPhone|iPod)/g.test( navigator.userAgent );
|
var iOS = /(iPad|iPhone|iPod)/g.test( navigator.userAgent );
|
||||||
if (iOS || isAndroidChrome) {
|
if (iOS) {
|
||||||
fakeInput = document.createElement("input");
|
fakeInput = document.createElement("input");
|
||||||
fakeInput.type = "text";
|
fakeInput.type = "text";
|
||||||
fakeInput.style.position = "absolute";
|
fakeInput.style.position = "absolute";
|
||||||
fakeInput.style.left = "-1000px";
|
fakeInput.style.left = "-1000px";
|
||||||
fakeInput.style.top = "-1000px";
|
fakeInput.style.top = "-1000px";
|
||||||
document.body.appendChild(fakeInput);
|
document.body.appendChild(fakeInput);
|
||||||
if (isAndroidChrome)
|
|
||||||
fakeInput.addEventListener('input', onInput, passiveSupported ? { passive: false, capture: false } : false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,8 @@ broadwayjs_h = custom_target('broadwayjs.h',
|
|||||||
)
|
)
|
||||||
|
|
||||||
libgdk_broadway = static_library('gdk-broadway',
|
libgdk_broadway = static_library('gdk-broadway',
|
||||||
sources: [ clienthtml_h, broadwayjs_h, gdk_broadway_sources, gdk_gen_headers ],
|
clienthtml_h, broadwayjs_h,
|
||||||
|
gdk_broadway_sources, gdkconfig, gdkenum_h,
|
||||||
include_directories: [confinc, gdkinc],
|
include_directories: [confinc, gdkinc],
|
||||||
c_args: [
|
c_args: [
|
||||||
'-DGTK_COMPILATION',
|
'-DGTK_COMPILATION',
|
||||||
|
|||||||
63
gdk/gdk.c
@@ -122,7 +122,6 @@ static const GdkDebugKey gdk_debug_keys[] = {
|
|||||||
|
|
||||||
{ "portals", GDK_DEBUG_PORTALS, "Force use of portals" },
|
{ "portals", GDK_DEBUG_PORTALS, "Force use of portals" },
|
||||||
{ "no-portals", GDK_DEBUG_NO_PORTALS, "Disable use of portals" },
|
{ "no-portals", GDK_DEBUG_NO_PORTALS, "Disable use of portals" },
|
||||||
{ "force-offload", GDK_DEBUG_FORCE_OFFLOAD, "Force graphics offload for all textures" },
|
|
||||||
{ "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support" },
|
{ "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support" },
|
||||||
{ "gl-no-fractional", GDK_DEBUG_GL_NO_FRACTIONAL, "Disable fractional scaling for OpenGL" },
|
{ "gl-no-fractional", GDK_DEBUG_GL_NO_FRACTIONAL, "Disable fractional scaling for OpenGL" },
|
||||||
{ "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL" },
|
{ "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL" },
|
||||||
@@ -143,50 +142,31 @@ static const GdkDebugKey gdk_debug_keys[] = {
|
|||||||
|
|
||||||
#ifdef G_HAS_CONSTRUCTORS
|
#ifdef G_HAS_CONSTRUCTORS
|
||||||
#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
|
#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
|
||||||
#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(stash_and_unset_environment)
|
#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(stash_desktop_startup_notification_id)
|
||||||
#endif
|
#endif
|
||||||
G_DEFINE_CONSTRUCTOR(stash_and_unset_environment)
|
G_DEFINE_CONSTRUCTOR(stash_desktop_startup_notification_id)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static char *startup_notification_id = NULL;
|
static char *startup_notification_id = NULL;
|
||||||
static char *xdg_activation_token = NULL;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
stash_and_unset_environment (void)
|
stash_desktop_startup_notification_id (void)
|
||||||
{
|
{
|
||||||
/* Copies environment variables and unsets them so they won't be inherited by
|
const char *desktop_startup_id;
|
||||||
* child processes and confuse things.
|
|
||||||
*
|
|
||||||
* Changing environment variables can be racy so we try to do this as early as
|
|
||||||
* possible in the program flow and before any printing that might involve
|
|
||||||
* environment variables.
|
|
||||||
*/
|
|
||||||
struct {
|
|
||||||
const char *key;
|
|
||||||
char **dst;
|
|
||||||
} vars[] = {
|
|
||||||
{ "DESKTOP_STARTUP_ID", &startup_notification_id },
|
|
||||||
{ "XDG_ACTIVATION_TOKEN", &xdg_activation_token },
|
|
||||||
};
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (vars); i++)
|
desktop_startup_id = g_getenv ("DESKTOP_STARTUP_ID");
|
||||||
*vars[i].dst = g_strdup (g_getenv (vars[i].key));
|
if (desktop_startup_id && *desktop_startup_id != '\0')
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (vars); i++)
|
|
||||||
g_unsetenv (vars[i].key);
|
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (vars); i++)
|
|
||||||
{
|
{
|
||||||
if (*vars[i].dst == NULL)
|
if (!g_utf8_validate (desktop_startup_id, -1, NULL))
|
||||||
continue;
|
g_warning ("DESKTOP_STARTUP_ID contains invalid UTF-8");
|
||||||
|
else
|
||||||
if (!g_utf8_validate (*vars[i].dst, -1, NULL))
|
startup_notification_id = g_strdup (desktop_startup_id);
|
||||||
{
|
|
||||||
g_warning ("%s contains invalid UTF-8", vars[i].key);
|
|
||||||
g_clear_pointer (vars[i].dst, g_free);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Clear the environment variable so it won't be inherited by
|
||||||
|
* child processes and confuse things.
|
||||||
|
*/
|
||||||
|
g_unsetenv ("DESKTOP_STARTUP_ID");
|
||||||
}
|
}
|
||||||
|
|
||||||
static gpointer
|
static gpointer
|
||||||
@@ -311,7 +291,7 @@ gdk_pre_parse (void)
|
|||||||
gdk_gl_backend_use (GDK_GL_WGL);
|
gdk_gl_backend_use (GDK_GL_WGL);
|
||||||
|
|
||||||
#ifndef G_HAS_CONSTRUCTORS
|
#ifndef G_HAS_CONSTRUCTORS
|
||||||
stash_and_unset_environment ();
|
stash_desktop_startup_notification_id ();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -345,20 +325,15 @@ gdk_display_open_default (void)
|
|||||||
/*< private >
|
/*< private >
|
||||||
* gdk_get_startup_notification_id:
|
* gdk_get_startup_notification_id:
|
||||||
*
|
*
|
||||||
* Returns the original value of the XDG_ACTIVATION_TOKEN environment
|
* Returns the original value of the DESKTOP_STARTUP_ID environment
|
||||||
* variable if it was defined and valid, otherwise it returns the original
|
* variable if it was defined and valid, or %NULL otherwise.
|
||||||
* value of the DESKTOP_STARTUP_ID environment variable if it was defined
|
|
||||||
* and valid, or %NULL if neither of them were defined and valid.
|
|
||||||
*
|
*
|
||||||
* Returns: (nullable) (transfer none): the original value of the
|
* Returns: (nullable) (transfer none): the original value of the
|
||||||
* XDG_ACTIVATION_TOKEN or DESKTOP_STARTUP_ID environment variable
|
* DESKTOP_STARTUP_ID environment variable
|
||||||
*/
|
*/
|
||||||
const char *
|
const char *
|
||||||
gdk_get_startup_notification_id (void)
|
gdk_get_startup_notification_id (void)
|
||||||
{
|
{
|
||||||
if (xdg_activation_token)
|
|
||||||
return xdg_activation_token;
|
|
||||||
|
|
||||||
return startup_notification_id;
|
return startup_notification_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
339
gdk/gdkcursor.c
@@ -30,11 +30,14 @@
|
|||||||
#include "gdkcursor.h"
|
#include "gdkcursor.h"
|
||||||
#include "gdkcursorprivate.h"
|
#include "gdkcursorprivate.h"
|
||||||
#include "gdktexture.h"
|
#include "gdktexture.h"
|
||||||
|
#include "gdkdisplay.h"
|
||||||
#include <glib/gi18n-lib.h>
|
#include <glib/gi18n-lib.h>
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <graphene.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GdkCursor:
|
* GdkCursor:
|
||||||
*
|
*
|
||||||
@@ -81,8 +84,11 @@ enum {
|
|||||||
PROP_HOTSPOT_Y,
|
PROP_HOTSPOT_Y,
|
||||||
PROP_NAME,
|
PROP_NAME,
|
||||||
PROP_TEXTURE,
|
PROP_TEXTURE,
|
||||||
|
PROP_PAINTABLE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static guint invalidate_signal;
|
||||||
|
|
||||||
G_DEFINE_TYPE (GdkCursor, gdk_cursor, G_TYPE_OBJECT)
|
G_DEFINE_TYPE (GdkCursor, gdk_cursor, G_TYPE_OBJECT)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -110,6 +116,9 @@ gdk_cursor_get_property (GObject *object,
|
|||||||
case PROP_TEXTURE:
|
case PROP_TEXTURE:
|
||||||
g_value_set_object (value, cursor->texture);
|
g_value_set_object (value, cursor->texture);
|
||||||
break;
|
break;
|
||||||
|
case PROP_PAINTABLE:
|
||||||
|
g_value_set_object (value, cursor->paintable);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@@ -141,6 +150,9 @@ gdk_cursor_set_property (GObject *object,
|
|||||||
case PROP_TEXTURE:
|
case PROP_TEXTURE:
|
||||||
cursor->texture = g_value_dup_object (value);
|
cursor->texture = g_value_dup_object (value);
|
||||||
break;
|
break;
|
||||||
|
case PROP_PAINTABLE:
|
||||||
|
cursor->paintable = g_value_dup_object (value);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@@ -155,6 +167,7 @@ gdk_cursor_finalize (GObject *object)
|
|||||||
g_free (cursor->name);
|
g_free (cursor->name);
|
||||||
g_clear_object (&cursor->texture);
|
g_clear_object (&cursor->texture);
|
||||||
g_clear_object (&cursor->fallback);
|
g_clear_object (&cursor->fallback);
|
||||||
|
g_clear_object (&cursor->paintable);
|
||||||
|
|
||||||
if (cursor->destroy)
|
if (cursor->destroy)
|
||||||
cursor->destroy (cursor->data);
|
cursor->destroy (cursor->data);
|
||||||
@@ -234,6 +247,37 @@ gdk_cursor_class_init (GdkCursorClass *cursor_class)
|
|||||||
GDK_TYPE_TEXTURE,
|
GDK_TYPE_TEXTURE,
|
||||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
|
||||||
G_PARAM_STATIC_STRINGS));
|
G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GdkCursor:paintable:
|
||||||
|
*
|
||||||
|
* The paintable displayed by this cursor.
|
||||||
|
*
|
||||||
|
* The intrinsic size of the paintable determines
|
||||||
|
* the size of the cursor.
|
||||||
|
*
|
||||||
|
* If the GDK backend has the capability, non-static paintables
|
||||||
|
* may create animated cursors.
|
||||||
|
*
|
||||||
|
* The paintable will be %NULL if the cursor was created
|
||||||
|
* from a name or texture.
|
||||||
|
*
|
||||||
|
* Since: 4.16
|
||||||
|
*/
|
||||||
|
g_object_class_install_property (object_class,
|
||||||
|
PROP_PAINTABLE,
|
||||||
|
g_param_spec_object ("paintable", NULL, NULL,
|
||||||
|
GDK_TYPE_PAINTABLE,
|
||||||
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
|
||||||
|
G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
|
invalidate_signal = g_signal_new ("invalidate",
|
||||||
|
GDK_TYPE_CURSOR,
|
||||||
|
G_SIGNAL_RUN_LAST,
|
||||||
|
0,
|
||||||
|
NULL, NULL,
|
||||||
|
NULL,
|
||||||
|
G_TYPE_NONE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -256,11 +300,8 @@ gdk_cursor_hash (gconstpointer pointer)
|
|||||||
hash ^= g_str_hash (cursor->name);
|
hash ^= g_str_hash (cursor->name);
|
||||||
else if (cursor->texture)
|
else if (cursor->texture)
|
||||||
hash ^= g_direct_hash (cursor->texture);
|
hash ^= g_direct_hash (cursor->texture);
|
||||||
else if (cursor->callback)
|
else if (cursor->paintable)
|
||||||
{
|
hash ^= g_direct_hash (cursor->paintable);
|
||||||
hash ^= g_direct_hash (cursor->callback);
|
|
||||||
hash ^= g_direct_hash (cursor->data);
|
|
||||||
}
|
|
||||||
|
|
||||||
hash ^= (cursor->hotspot_x << 8) | cursor->hotspot_y;
|
hash ^= (cursor->hotspot_x << 8) | cursor->hotspot_y;
|
||||||
|
|
||||||
@@ -285,12 +326,11 @@ gdk_cursor_equal (gconstpointer a,
|
|||||||
if (ca->texture != cb->texture)
|
if (ca->texture != cb->texture)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (ca->hotspot_x != cb->hotspot_x ||
|
if (ca->paintable != cb->paintable)
|
||||||
ca->hotspot_y != cb->hotspot_y)
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (ca->callback != cb->callback ||
|
if (ca->hotspot_x != cb->hotspot_x ||
|
||||||
ca->data != cb->data)
|
ca->hotspot_y != cb->hotspot_y)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -368,42 +408,42 @@ gdk_cursor_new_from_texture (GdkTexture *texture,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gdk_cursor_new_from_callback:
|
* gdk_cursor_new_from_paintable:
|
||||||
* @callback: the `GdkCursorGetTextureCallback`
|
* @paintable: the paintable providing the pixel data
|
||||||
* @data: data to pass to @callback
|
* @hotspot_x: the horizontal offset of the “hotspot” of the cursor
|
||||||
* @destroy: destroy notify for @data
|
* @hotspot_y: the vertical offset of the “hotspot” of the cursor
|
||||||
* @fallback: (nullable): the `GdkCursor` to fall back to when
|
* @fallback: (nullable): the `GdkCursor` to fall back to when
|
||||||
* this one cannot be supported
|
* this one cannot be supported
|
||||||
*
|
*
|
||||||
* Creates a new callback-based cursor object.
|
* Creates a new cursor from a `GdkPaintable`.
|
||||||
*
|
*
|
||||||
* Cursors of this kind produce textures for the cursor
|
* The intrinsic size of the paintable determines
|
||||||
* image on demand, when the @callback is called.
|
* the size of the cursor.
|
||||||
*
|
*
|
||||||
* Returns: (nullable): a new `GdkCursor`
|
* If the GDK backend has the capability, non-static paintables
|
||||||
|
* may create animated cursors.
|
||||||
|
*
|
||||||
|
* Returns: a new `GdkCursor`
|
||||||
*
|
*
|
||||||
* Since: 4.16
|
* Since: 4.16
|
||||||
*/
|
*/
|
||||||
GdkCursor *
|
GdkCursor *
|
||||||
gdk_cursor_new_from_callback (GdkCursorGetTextureCallback callback,
|
gdk_cursor_new_from_paintable (GdkPaintable *paintable,
|
||||||
gpointer data,
|
int hotspot_x,
|
||||||
GDestroyNotify destroy,
|
int hotspot_y,
|
||||||
GdkCursor *fallback)
|
GdkCursor *fallback)
|
||||||
{
|
{
|
||||||
GdkCursor *cursor;
|
g_return_val_if_fail (GDK_IS_PAINTABLE (paintable), NULL);
|
||||||
|
g_return_val_if_fail (0 <= hotspot_x && hotspot_x < gdk_paintable_get_intrinsic_width (paintable), NULL);
|
||||||
g_return_val_if_fail (callback != NULL, NULL);
|
g_return_val_if_fail (0 <= hotspot_y && hotspot_y < gdk_paintable_get_intrinsic_height (paintable), NULL);
|
||||||
g_return_val_if_fail (fallback == NULL || GDK_IS_CURSOR (fallback), NULL);
|
g_return_val_if_fail (fallback == NULL || GDK_IS_CURSOR (fallback), NULL);
|
||||||
|
|
||||||
cursor = g_object_new (GDK_TYPE_CURSOR,
|
return g_object_new (GDK_TYPE_CURSOR,
|
||||||
"fallback", fallback,
|
"paintable", paintable,
|
||||||
NULL);
|
"hotspot-x", hotspot_x,
|
||||||
|
"hotspot-y", hotspot_y,
|
||||||
cursor->callback = callback;
|
"fallback", fallback,
|
||||||
cursor->data = data;
|
NULL);
|
||||||
cursor->destroy = destroy;
|
|
||||||
|
|
||||||
return cursor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -467,6 +507,27 @@ gdk_cursor_get_texture (GdkCursor *cursor)
|
|||||||
return cursor->texture;
|
return cursor->texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gdk_cursor_get_paintable:
|
||||||
|
* @cursor: a `GdkCursor`
|
||||||
|
*
|
||||||
|
* Returns the paintable for the cursor.
|
||||||
|
*
|
||||||
|
* If the cursor is a named or texture cursor, %NULL will be returned.
|
||||||
|
*
|
||||||
|
* Returns: (transfer none) (nullable): the paintable for @cursor
|
||||||
|
* or %NULL if it is a named or texture cursor
|
||||||
|
*
|
||||||
|
* Since: 4.16
|
||||||
|
*/
|
||||||
|
GdkPaintable *
|
||||||
|
gdk_cursor_get_paintable (GdkCursor *cursor)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GDK_IS_CURSOR (cursor), NULL);
|
||||||
|
|
||||||
|
return cursor->paintable;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gdk_cursor_get_hotspot_x: (attributes org.gtk.Method.get_property=hotspot-x)
|
* gdk_cursor_get_hotspot_x: (attributes org.gtk.Method.get_property=hotspot-x)
|
||||||
* @cursor: a `GdkCursor`
|
* @cursor: a `GdkCursor`
|
||||||
@@ -511,14 +572,211 @@ gdk_cursor_get_hotspot_y (GdkCursor *cursor)
|
|||||||
return cursor->hotspot_y;
|
return cursor->hotspot_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Hack. We don't include gsk/gsk.h here to avoid a build order problem
|
||||||
|
* with the generated header gskenumtypes.h, so we need to hack around
|
||||||
|
* a bit to access the gsk and gtk api we need.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef struct _GskRenderer GskRenderer;
|
||||||
|
typedef struct _GskRenderNode GskRenderNode;
|
||||||
|
typedef struct _GdkSnapshot GtkSnapshot;
|
||||||
|
|
||||||
|
extern GskRenderer * gsk_cairo_renderer_new (void);
|
||||||
|
extern gboolean gsk_renderer_realize_for_display (GskRenderer *renderer,
|
||||||
|
GdkDisplay *display,
|
||||||
|
GError **error);
|
||||||
|
extern void gsk_renderer_unrealize (GskRenderer *renderer);
|
||||||
|
extern GdkTexture * gsk_renderer_render_texture (GskRenderer *renderer,
|
||||||
|
GskRenderNode *root,
|
||||||
|
const graphene_rect_t *viewport);
|
||||||
|
|
||||||
|
extern void gsk_render_node_get_bounds (GskRenderNode *node,
|
||||||
|
graphene_rect_t *bounds);
|
||||||
|
|
||||||
|
extern void gsk_render_node_unref (GskRenderNode *node);
|
||||||
|
|
||||||
|
extern GtkSnapshot * gtk_snapshot_new (void);
|
||||||
|
extern GskRenderNode * gtk_snapshot_free_to_node (GtkSnapshot *snapshot);
|
||||||
|
|
||||||
|
static GdkTexture *
|
||||||
|
paintable_to_texture (GdkPaintable *paintable,
|
||||||
|
double scale)
|
||||||
|
{
|
||||||
|
GtkSnapshot *snapshot;
|
||||||
|
GskRenderNode *node;
|
||||||
|
GskRenderer *renderer;
|
||||||
|
int width, height;
|
||||||
|
GdkTexture *texture;
|
||||||
|
graphene_rect_t bounds;
|
||||||
|
|
||||||
|
width = gdk_paintable_get_intrinsic_width (paintable);
|
||||||
|
height = gdk_paintable_get_intrinsic_height (paintable);
|
||||||
|
|
||||||
|
snapshot = gtk_snapshot_new ();
|
||||||
|
gdk_paintable_snapshot (paintable, snapshot, width * scale, height * scale);
|
||||||
|
node = gtk_snapshot_free_to_node (snapshot);
|
||||||
|
|
||||||
|
/* FIXME: use a proper renderer, and cache it */
|
||||||
|
renderer = gsk_cairo_renderer_new ();
|
||||||
|
gsk_renderer_realize_for_display (renderer, gdk_display_get_default (), NULL);
|
||||||
|
|
||||||
|
gsk_render_node_get_bounds (node, &bounds);
|
||||||
|
texture = gsk_renderer_render_texture (renderer, node, &bounds);
|
||||||
|
|
||||||
|
gsk_renderer_unrealize (renderer);
|
||||||
|
g_object_unref (renderer);
|
||||||
|
|
||||||
|
gsk_render_node_unref (node);
|
||||||
|
|
||||||
|
return texture;
|
||||||
|
}
|
||||||
|
|
||||||
GdkTexture *
|
GdkTexture *
|
||||||
gdk_cursor_get_texture_for_size (GdkCursor *cursor,
|
gdk_cursor_create_texture (GdkCursor *cursor,
|
||||||
int cursor_size,
|
double scale)
|
||||||
double scale,
|
{
|
||||||
int *width,
|
if (cursor->texture)
|
||||||
int *height,
|
return g_object_ref (cursor->texture);
|
||||||
int *hotspot_x,
|
else if (cursor->paintable)
|
||||||
int *hotspot_y)
|
return paintable_to_texture (cursor->paintable, scale);
|
||||||
|
else
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GdkCursorGetTestureCallback:
|
||||||
|
* @cursor: the `GdkCursor`
|
||||||
|
* @cursor_size: the nominal cursor size, in application pixels
|
||||||
|
* @scale: the device scale
|
||||||
|
* @width: (out): return location for the actual cursor width,
|
||||||
|
* in application pixels
|
||||||
|
* @height: (out): return location for the actual cursor height,
|
||||||
|
* in application pixels
|
||||||
|
* @hotspot_x: (out): return location for the hotspot X position,
|
||||||
|
* in application pixels
|
||||||
|
* @hotspot_y: (out): return location for the hotspot Y position,
|
||||||
|
* in application pixels
|
||||||
|
* @data: User data for the callback
|
||||||
|
*
|
||||||
|
* The type of callback used by a dynamic `GdkCursor` to generate
|
||||||
|
* a texture for the cursor image at the given @cursor_size
|
||||||
|
* and @scale.
|
||||||
|
*
|
||||||
|
* The actual cursor size in application pixels may be different
|
||||||
|
* from @cursor_size x @cursor_size, and will be returned in
|
||||||
|
* @width, @height.
|
||||||
|
*
|
||||||
|
* The returned texture should have a size that corresponds to
|
||||||
|
* the actual cursor size, in device pixels.
|
||||||
|
*
|
||||||
|
* This function may fail and return `NULL`, in which case
|
||||||
|
* the backend should use the fallback cursor.
|
||||||
|
*
|
||||||
|
* Returns: (nullable) (transfer full): the cursor image, or
|
||||||
|
* `NULL` if none could be produced.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gdk_cursor_new_dynamic:
|
||||||
|
* @callback: the `GdkCursorGetTextureCallback`
|
||||||
|
* @data: data to pass to @callback
|
||||||
|
* @destroy: destroy notify for @data
|
||||||
|
* @fallback: (nullable): the `GdkCursor` to fall back to when
|
||||||
|
* this one cannot be supported
|
||||||
|
*
|
||||||
|
* Creates a new dynamic cursor object.
|
||||||
|
*
|
||||||
|
* Dynamic cursors produce textures for the cursor image
|
||||||
|
* on demand, when the @callback is called.
|
||||||
|
*
|
||||||
|
* Returns: (nullable): a new `GdkCursor`
|
||||||
|
*
|
||||||
|
* Since: 4.16
|
||||||
|
*/
|
||||||
|
GdkCursor *
|
||||||
|
gdk_cursor_new_dynamic (GdkCursorGetTextureCallback callback,
|
||||||
|
gpointer data,
|
||||||
|
GDestroyNotify destroy,
|
||||||
|
GdkCursor *fallback)
|
||||||
|
{
|
||||||
|
GdkCursor *cursor;
|
||||||
|
|
||||||
|
g_return_val_if_fail (callback != NULL, NULL);
|
||||||
|
g_return_val_if_fail (fallback == NULL || GDK_IS_CURSOR (fallback), NULL);
|
||||||
|
|
||||||
|
cursor = g_object_new (GDK_TYPE_CURSOR,
|
||||||
|
"fallback", fallback,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
cursor->callback = callback;
|
||||||
|
cursor->data = data;
|
||||||
|
cursor->destroy = destroy;
|
||||||
|
|
||||||
|
return cursor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gdk_cursor_invalidate:
|
||||||
|
* @cursor: a `GdkCursor`
|
||||||
|
*
|
||||||
|
* Emits the invalidate signal to indicate that the cursor
|
||||||
|
* has changed and backends should recreate their cursor
|
||||||
|
* image.
|
||||||
|
*
|
||||||
|
* This function does nothing unless the cursor has been
|
||||||
|
* created with [constructor@Gdk.Cursor.new_dynamic].
|
||||||
|
*
|
||||||
|
* Since: 4.16
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gdk_cursor_invalidate (GdkCursor *cursor)
|
||||||
|
{
|
||||||
|
if (cursor->callback == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
g_signal_emit (cursor, invalidate_signal, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*< private >
|
||||||
|
* gdk_cursor_get_dynamic_texture:
|
||||||
|
* @cursor: a dynamic `GdkCursor`
|
||||||
|
* @cursor_size: the nominal size of the cursor image
|
||||||
|
* to produce, in application pixels
|
||||||
|
* @scale: the device scale to use
|
||||||
|
* @width: return location for the cursor width,
|
||||||
|
* in application pixels
|
||||||
|
* @height : return location for the cursor height,
|
||||||
|
* in application pixels
|
||||||
|
* @hotspot_x: return location for the hotspot X position,
|
||||||
|
* in application pixels
|
||||||
|
* @hotspot_y: return location for the hotspot X position,
|
||||||
|
* in application pixels
|
||||||
|
*
|
||||||
|
* Call the callback of a dynamic cursor to generate
|
||||||
|
* a texture for the cursor image at the given @cursor_size
|
||||||
|
* and @scale.
|
||||||
|
*
|
||||||
|
* The actual cursor size in application pixels may be different
|
||||||
|
* from @cursor_size x @cursor_size, and will be returned in
|
||||||
|
* @width, @height.
|
||||||
|
*
|
||||||
|
* The returned texture should have a size that corresponds to
|
||||||
|
* the actual cursor size, in device pixels.
|
||||||
|
*
|
||||||
|
* This function may fail and return `NULL`, in which case
|
||||||
|
* the backend should use the fallback cursor.
|
||||||
|
*
|
||||||
|
* Returns: (nullable) (transfer full): the cursor image, or
|
||||||
|
* `NULL` if none could be produced.
|
||||||
|
*/
|
||||||
|
GdkTexture *
|
||||||
|
gdk_cursor_get_dynamic_texture (GdkCursor *cursor,
|
||||||
|
int cursor_size,
|
||||||
|
double scale,
|
||||||
|
int *width,
|
||||||
|
int *height,
|
||||||
|
int *hotspot_x,
|
||||||
|
int *hotspot_y)
|
||||||
{
|
{
|
||||||
if (cursor->callback == NULL)
|
if (cursor->callback == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -529,3 +787,4 @@ gdk_cursor_get_texture_for_size (GdkCursor *cursor,
|
|||||||
hotspot_x, hotspot_y,
|
hotspot_x, hotspot_y,
|
||||||
cursor->data);
|
cursor->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <gdk/gdktypes.h>
|
#include <gdk/gdktypes.h>
|
||||||
|
#include <gdk/gdkpaintable.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
@@ -47,41 +48,31 @@ GdkCursor* gdk_cursor_new_from_texture (GdkTexture *texture,
|
|||||||
int hotspot_x,
|
int hotspot_x,
|
||||||
int hotspot_y,
|
int hotspot_y,
|
||||||
GdkCursor *fallback);
|
GdkCursor *fallback);
|
||||||
|
|
||||||
|
GDK_AVAILABLE_IN_4_14
|
||||||
|
GdkCursor * gdk_cursor_new_from_paintable (GdkPaintable *paintable,
|
||||||
|
int hotspot_x,
|
||||||
|
int hotspot_y,
|
||||||
|
GdkCursor *fallback);
|
||||||
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GdkCursor* gdk_cursor_new_from_name (const char *name,
|
GdkCursor* gdk_cursor_new_from_name (const char *name,
|
||||||
GdkCursor *fallback);
|
GdkCursor *fallback);
|
||||||
|
|
||||||
/**
|
GDK_AVAILABLE_IN_ALL
|
||||||
* GdkCursorGetTestureCallback:
|
GdkCursor * gdk_cursor_get_fallback (GdkCursor *cursor);
|
||||||
* @cursor: the `GdkCursor`
|
GDK_AVAILABLE_IN_ALL
|
||||||
* @cursor_size: the nominal cursor size, in application pixels
|
const char *gdk_cursor_get_name (GdkCursor *cursor);
|
||||||
* @scale: the device scale
|
GDK_AVAILABLE_IN_ALL
|
||||||
* @width: (out): return location for the actual cursor width,
|
GdkTexture *gdk_cursor_get_texture (GdkCursor *cursor);
|
||||||
* in application pixels
|
GDK_AVAILABLE_IN_4_14
|
||||||
* @height: (out): return location for the actual cursor height,
|
GdkPaintable *
|
||||||
* in application pixels
|
gdk_cursor_get_paintable (GdkCursor *cursor);
|
||||||
* @hotspot_x: (out): return location for the hotspot X position,
|
GDK_AVAILABLE_IN_ALL
|
||||||
* in application pixels
|
int gdk_cursor_get_hotspot_x (GdkCursor *cursor);
|
||||||
* @hotspot_y: (out): return location for the hotspot Y position,
|
GDK_AVAILABLE_IN_ALL
|
||||||
* in application pixels
|
int gdk_cursor_get_hotspot_y (GdkCursor *cursor);
|
||||||
* @data: User data for the callback
|
|
||||||
*
|
|
||||||
* The type of callback used by a dynamic `GdkCursor` to generate
|
|
||||||
* a texture for the cursor image at the given @cursor_size
|
|
||||||
* and @scale.
|
|
||||||
*
|
|
||||||
* The actual cursor size in application pixels may be different
|
|
||||||
* from @cursor_size x @cursor_size, and will be returned in
|
|
||||||
* @width, @height. The returned texture should have a size that
|
|
||||||
* corresponds to the actual cursor size, in device pixels (i.e.
|
|
||||||
* application pixels, multiplied by @scale).
|
|
||||||
*
|
|
||||||
* This function may fail and return `NULL`, in which case
|
|
||||||
* the fallback cursor will be used.
|
|
||||||
*
|
|
||||||
* Returns: (nullable) (transfer full): the cursor image, or
|
|
||||||
* `NULL` if none could be produced.
|
|
||||||
*/
|
|
||||||
typedef GdkTexture * (* GdkCursorGetTextureCallback) (GdkCursor *cursor,
|
typedef GdkTexture * (* GdkCursorGetTextureCallback) (GdkCursor *cursor,
|
||||||
int cursor_size,
|
int cursor_size,
|
||||||
double scale,
|
double scale,
|
||||||
@@ -91,22 +82,14 @@ typedef GdkTexture * (* GdkCursorGetTextureCallback) (GdkCursor *cursor,
|
|||||||
int *hotspot_y,
|
int *hotspot_y,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
|
||||||
GDK_AVAILABLE_IN_4_16
|
GDK_AVAILABLE_IN_4_14
|
||||||
GdkCursor * gdk_cursor_new_from_callback (GdkCursorGetTextureCallback callback,
|
GdkCursor * gdk_cursor_new_dynamic (GdkCursorGetTextureCallback callback,
|
||||||
gpointer data,
|
gpointer data,
|
||||||
GDestroyNotify destroy,
|
GDestroyNotify destroy,
|
||||||
GdkCursor *fallback);
|
GdkCursor *fallback);
|
||||||
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_4_14
|
||||||
GdkCursor * gdk_cursor_get_fallback (GdkCursor *cursor);
|
void gdk_cursor_invalidate (GdkCursor *cursor);
|
||||||
GDK_AVAILABLE_IN_ALL
|
|
||||||
const char *gdk_cursor_get_name (GdkCursor *cursor);
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
|
||||||
GdkTexture *gdk_cursor_get_texture (GdkCursor *cursor);
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
|
||||||
int gdk_cursor_get_hotspot_x (GdkCursor *cursor);
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
|
||||||
int gdk_cursor_get_hotspot_y (GdkCursor *cursor);
|
|
||||||
|
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkCursor, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkCursor, g_object_unref)
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ struct _GdkCursor
|
|||||||
GdkCursor *fallback;
|
GdkCursor *fallback;
|
||||||
char *name;
|
char *name;
|
||||||
GdkTexture *texture;
|
GdkTexture *texture;
|
||||||
|
GdkPaintable *paintable;
|
||||||
int hotspot_x;
|
int hotspot_x;
|
||||||
int hotspot_y;
|
int hotspot_y;
|
||||||
|
|
||||||
@@ -59,7 +60,10 @@ guint gdk_cursor_hash (gconstpointer
|
|||||||
gboolean gdk_cursor_equal (gconstpointer a,
|
gboolean gdk_cursor_equal (gconstpointer a,
|
||||||
gconstpointer b);
|
gconstpointer b);
|
||||||
|
|
||||||
GdkTexture * gdk_cursor_get_texture_for_size (GdkCursor *cursor,
|
GdkTexture * gdk_cursor_create_texture (GdkCursor *cursor,
|
||||||
|
double scale);
|
||||||
|
|
||||||
|
GdkTexture * gdk_cursor_get_dynamic_texture (GdkCursor *cursor,
|
||||||
int cursor_size,
|
int cursor_size,
|
||||||
double scale,
|
double scale,
|
||||||
int *width,
|
int *width,
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ typedef enum {
|
|||||||
GDK_DEBUG_NO_PORTALS = 1 << 15,
|
GDK_DEBUG_NO_PORTALS = 1 << 15,
|
||||||
GDK_DEBUG_GL_DISABLE = 1 << 16,
|
GDK_DEBUG_GL_DISABLE = 1 << 16,
|
||||||
GDK_DEBUG_GL_NO_FRACTIONAL= 1 << 17,
|
GDK_DEBUG_GL_NO_FRACTIONAL= 1 << 17,
|
||||||
GDK_DEBUG_FORCE_OFFLOAD = 1 << 18,
|
|
||||||
GDK_DEBUG_GL_DISABLE_GL = 1 << 19,
|
GDK_DEBUG_GL_DISABLE_GL = 1 << 19,
|
||||||
GDK_DEBUG_GL_DISABLE_GLES = 1 << 20,
|
GDK_DEBUG_GL_DISABLE_GLES = 1 << 20,
|
||||||
GDK_DEBUG_GL_PREFER_GL = 1 << 21,
|
GDK_DEBUG_GL_PREFER_GL = 1 << 21,
|
||||||
|
|||||||
@@ -1559,14 +1559,13 @@ describe_egl_config (EGLDisplay egl_display,
|
|||||||
|
|
||||||
if (!eglGetConfigAttrib (egl_display, egl_config, EGL_DEPTH_SIZE, &depth))
|
if (!eglGetConfigAttrib (egl_display, egl_config, EGL_DEPTH_SIZE, &depth))
|
||||||
depth = 0;
|
depth = 0;
|
||||||
|
|
||||||
if (!eglGetConfigAttrib (egl_display, egl_config, EGL_STENCIL_SIZE, &stencil))
|
if (!eglGetConfigAttrib (egl_display, egl_config, EGL_STENCIL_SIZE, &stencil))
|
||||||
stencil = 0;
|
stencil = 0;
|
||||||
|
|
||||||
return g_strdup_printf ("R%dG%dB%dA%d%s, depth %d, stencil %d", red, green, blue, alpha,
|
return g_strdup_printf ("R%dG%dB%dA%d%s%s%s", red, green, blue, alpha,
|
||||||
type == EGL_COLOR_COMPONENT_TYPE_FIXED_EXT ? "" : " float",
|
type == EGL_COLOR_COMPONENT_TYPE_FIXED_EXT ? "" : " float",
|
||||||
depth,
|
depth > 0 ? ", depth buffer" : "",
|
||||||
stencil);
|
stencil > 0 ? ", stencil buffer" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
gpointer
|
gpointer
|
||||||
|
|||||||
@@ -144,8 +144,8 @@ struct _YUVCoefficients
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* multiplied by 65536 */
|
/* multiplied by 65536 */
|
||||||
static const YUVCoefficients itu601_narrow = { 104597, -25675, -53279, 132201 };
|
//static const YUVCoefficients itu601_narrow = { 104597, -25675, -53279, 132201 };
|
||||||
//static const YUVCoefficients itu601_wide = { 74711, -25864, -38050, 133176 };
|
static const YUVCoefficients itu601_wide = { 74711, -25864, -38050, 133176 };
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
get_uv_values (const YUVCoefficients *coeffs,
|
get_uv_values (const YUVCoefficients *coeffs,
|
||||||
@@ -229,7 +229,7 @@ download_nv12 (guchar *dst_data,
|
|||||||
int r, g, b;
|
int r, g, b;
|
||||||
gsize xs, ys;
|
gsize xs, ys;
|
||||||
|
|
||||||
get_uv_values (&itu601_narrow, uv_data[x / X_SUB * 2 + U], uv_data[x / X_SUB * 2 + V], &r, &g, &b);
|
get_uv_values (&itu601_wide, uv_data[x / X_SUB * 2 + U], uv_data[x / X_SUB * 2 + V], &r, &g, &b);
|
||||||
|
|
||||||
for (ys = 0; ys < Y_SUB && y + ys < height; ys++)
|
for (ys = 0; ys < Y_SUB && y + ys < height; ys++)
|
||||||
for (xs = 0; xs < X_SUB && x + xs < width; xs++)
|
for (xs = 0; xs < X_SUB && x + xs < width; xs++)
|
||||||
@@ -309,7 +309,7 @@ download_yuv_3 (guchar *dst_data,
|
|||||||
int r, g, b;
|
int r, g, b;
|
||||||
gsize xs, ys;
|
gsize xs, ys;
|
||||||
|
|
||||||
get_uv_values (&itu601_narrow, u_data[x / X_SUB], v_data[x / X_SUB], &r, &g, &b);
|
get_uv_values (&itu601_wide, u_data[x / X_SUB], v_data[x / X_SUB], &r, &g, &b);
|
||||||
|
|
||||||
for (ys = 0; ys < Y_SUB && y + ys < height; ys++)
|
for (ys = 0; ys < Y_SUB && y + ys < height; ys++)
|
||||||
for (xs = 0; xs < X_SUB && x + xs < width; xs++)
|
for (xs = 0; xs < X_SUB && x + xs < width; xs++)
|
||||||
@@ -365,7 +365,7 @@ download_yuyv (guchar *dst_data,
|
|||||||
{
|
{
|
||||||
int r, g, b;
|
int r, g, b;
|
||||||
|
|
||||||
get_uv_values (&itu601_narrow, src_data[2 * x + U], src_data[2 * x + V], &r, &g, &b);
|
get_uv_values (&itu601_wide, src_data[2 * x + U], src_data[2 * x + V], &r, &g, &b);
|
||||||
set_rgb_values (&dst_data[3 * x], src_data[2 * x + Y1], r, g, b);
|
set_rgb_values (&dst_data[3 * x], src_data[2 * x + Y1], r, g, b);
|
||||||
if (x + 1 < width)
|
if (x + 1 < width)
|
||||||
set_rgb_values (&dst_data[3 * (x + 1)], src_data[2 * x + Y2], r, g, b);
|
set_rgb_values (&dst_data[3 * (x + 1)], src_data[2 * x + Y2], r, g, b);
|
||||||
|
|||||||
@@ -163,8 +163,6 @@ gdk_dmabuf_get_egl_downloader (GdkDisplay *display,
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
previous = gdk_gl_context_get_current ();
|
previous = gdk_gl_context_get_current ();
|
||||||
if (previous)
|
|
||||||
g_object_ref (previous);
|
|
||||||
formats = gdk_dmabuf_formats_builder_new ();
|
formats = gdk_dmabuf_formats_builder_new ();
|
||||||
external = gdk_dmabuf_formats_builder_new ();
|
external = gdk_dmabuf_formats_builder_new ();
|
||||||
|
|
||||||
@@ -196,10 +194,7 @@ gdk_dmabuf_get_egl_downloader (GdkDisplay *display,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (previous)
|
if (previous)
|
||||||
{
|
gdk_gl_context_make_current (previous);
|
||||||
gdk_gl_context_make_current (previous);
|
|
||||||
g_object_unref (previous);
|
|
||||||
}
|
|
||||||
|
|
||||||
return GDK_DMABUF_DOWNLOADER (renderer);
|
return GDK_DMABUF_DOWNLOADER (renderer);
|
||||||
}
|
}
|
||||||
@@ -244,7 +239,7 @@ gdk_dmabuf_egl_create_image (GdkDisplay *display,
|
|||||||
attribs[i++] = EGL_YUV_COLOR_SPACE_HINT_EXT;
|
attribs[i++] = EGL_YUV_COLOR_SPACE_HINT_EXT;
|
||||||
attribs[i++] = EGL_ITU_REC601_EXT;
|
attribs[i++] = EGL_ITU_REC601_EXT;
|
||||||
attribs[i++] = EGL_SAMPLE_RANGE_HINT_EXT;
|
attribs[i++] = EGL_SAMPLE_RANGE_HINT_EXT;
|
||||||
attribs[i++] = EGL_YUV_NARROW_RANGE_EXT;
|
attribs[i++] = EGL_YUV_FULL_RANGE_EXT;
|
||||||
|
|
||||||
#define ADD_PLANE(plane) \
|
#define ADD_PLANE(plane) \
|
||||||
{ \
|
{ \
|
||||||
@@ -270,7 +265,6 @@ gdk_dmabuf_egl_create_image (GdkDisplay *display,
|
|||||||
if (dmabuf->n_planes > 3) ADD_PLANE (3);
|
if (dmabuf->n_planes > 3) ADD_PLANE (3);
|
||||||
|
|
||||||
attribs[i++] = EGL_NONE;
|
attribs[i++] = EGL_NONE;
|
||||||
g_assert (i < G_N_ELEMENTS (attribs));
|
|
||||||
|
|
||||||
image = eglCreateImageKHR (egl_display,
|
image = eglCreateImageKHR (egl_display,
|
||||||
EGL_NO_CONTEXT,
|
EGL_NO_CONTEXT,
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
#include "gdkdmabufformatsbuilderprivate.h"
|
#include "gdkdmabufformatsbuilderprivate.h"
|
||||||
#include "gdkdmabuffourccprivate.h"
|
#include "gdkdmabuffourccprivate.h"
|
||||||
#include "gdkdmabufprivate.h"
|
#include "gdkdmabufprivate.h"
|
||||||
#include "gdkdmabuftexturebuilderprivate.h"
|
|
||||||
#include "gdktextureprivate.h"
|
#include "gdktextureprivate.h"
|
||||||
#include <gdk/gdkglcontext.h>
|
#include <gdk/gdkglcontext.h>
|
||||||
#include <gdk/gdkgltexturebuilder.h>
|
#include <gdk/gdkgltexturebuilder.h>
|
||||||
@@ -72,10 +71,7 @@ gdk_dmabuf_texture_dispose (GObject *object)
|
|||||||
GdkDmabufTexture *self = GDK_DMABUF_TEXTURE (object);
|
GdkDmabufTexture *self = GDK_DMABUF_TEXTURE (object);
|
||||||
|
|
||||||
if (self->destroy)
|
if (self->destroy)
|
||||||
{
|
self->destroy (self->data);
|
||||||
self->destroy (self->data);
|
|
||||||
self->destroy = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_clear_object (&self->downloader);
|
g_clear_object (&self->downloader);
|
||||||
g_clear_object (&self->display);
|
g_clear_object (&self->display);
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
#include "gdkdisplay.h"
|
#include "gdkdisplay.h"
|
||||||
#include "gdkenumtypes.h"
|
#include "gdkenumtypes.h"
|
||||||
#include "gdkdmabuftextureprivate.h"
|
#include "gdkdmabuftextureprivate.h"
|
||||||
#include "gdkdmabuftexturebuilderprivate.h"
|
|
||||||
|
|
||||||
#include <cairo-gobject.h>
|
#include <cairo-gobject.h>
|
||||||
|
|
||||||
@@ -949,20 +948,22 @@ gdk_dmabuf_texture_builder_set_update_region (GdkDmabufTextureBuilder *self,
|
|||||||
*
|
*
|
||||||
* Builds a new `GdkTexture` with the values set up in the builder.
|
* Builds a new `GdkTexture` with the values set up in the builder.
|
||||||
*
|
*
|
||||||
* It is a programming error to call this function if any mandatory property has not been set.
|
* It is a programming error to call this function if any mandatory
|
||||||
|
* property has not been set.
|
||||||
*
|
*
|
||||||
* Not all formats defined in the `drm_fourcc.h` header are supported. You can use
|
* If the dmabuf is not supported by GTK, %NULL will be returned and @error will be set.
|
||||||
* [method@Gdk.Display.get_dmabuf_formats] to get a list of supported formats. If the
|
|
||||||
* format is not supported by GTK, %NULL will be returned and @error will be set.
|
|
||||||
*
|
*
|
||||||
* The `destroy` function gets called when the returned texture gets released.
|
* The `destroy` function gets called when the returned texture gets released.
|
||||||
*
|
*
|
||||||
|
* It is possible to call this function multiple times to create multiple textures,
|
||||||
|
* possibly with changing properties in between.
|
||||||
|
*
|
||||||
* It is the responsibility of the caller to keep the file descriptors for the planes
|
* It is the responsibility of the caller to keep the file descriptors for the planes
|
||||||
* open until the created texture is no longer used, and close them afterwards (possibly
|
* open until the created texture is no longer used, and close them afterwards (possibly
|
||||||
* using the @destroy notify).
|
* using the @destroy notify).
|
||||||
*
|
*
|
||||||
* It is possible to call this function multiple times to create multiple textures,
|
* Not all formats defined in the `drm_fourcc.h` header are supported. You can use
|
||||||
* possibly with changing properties in between.
|
* [method@Gdk.Display.get_dmabuf_formats] to get a list of supported formats.
|
||||||
*
|
*
|
||||||
* Returns: (transfer full) (nullable): a newly built `GdkTexture` or `NULL`
|
* Returns: (transfer full) (nullable): a newly built `GdkTexture` or `NULL`
|
||||||
* if the format is not supported
|
* if the format is not supported
|
||||||
@@ -1003,19 +1004,3 @@ gdk_dmabuf_texture_builder_get_dmabuf (GdkDmabufTextureBuilder *self)
|
|||||||
{
|
{
|
||||||
return &self->dmabuf;
|
return &self->dmabuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
gdk_dmabuf_texture_builder_set_dmabuf (GdkDmabufTextureBuilder *self,
|
|
||||||
const GdkDmabuf *dmabuf)
|
|
||||||
{
|
|
||||||
gdk_dmabuf_texture_builder_set_fourcc (self, dmabuf->fourcc);
|
|
||||||
gdk_dmabuf_texture_builder_set_modifier (self, dmabuf->modifier);
|
|
||||||
gdk_dmabuf_texture_builder_set_n_planes (self, dmabuf->n_planes);
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < dmabuf->n_planes; i++)
|
|
||||||
{
|
|
||||||
gdk_dmabuf_texture_builder_set_fd (self, i, dmabuf->planes[i].fd);
|
|
||||||
gdk_dmabuf_texture_builder_set_stride (self, i, dmabuf->planes[i].stride);
|
|
||||||
gdk_dmabuf_texture_builder_set_offset (self, i, dmabuf->planes[i].offset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "gdkdmabuftexturebuilder.h"
|
|
||||||
#include "gdkdmabufprivate.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
const GdkDmabuf * gdk_dmabuf_texture_builder_get_dmabuf (GdkDmabufTextureBuilder *builder);
|
|
||||||
|
|
||||||
void gdk_dmabuf_texture_builder_set_dmabuf (GdkDmabufTextureBuilder *builder,
|
|
||||||
const GdkDmabuf *dmabuf);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
const GdkDmabuf * gdk_dmabuf_texture_builder_get_dmabuf (GdkDmabufTextureBuilder *builder);
|
||||||
|
|
||||||
GdkTexture * gdk_dmabuf_texture_new_from_builder (GdkDmabufTextureBuilder *builder,
|
GdkTexture * gdk_dmabuf_texture_new_from_builder (GdkDmabufTextureBuilder *builder,
|
||||||
GDestroyNotify destroy,
|
GDestroyNotify destroy,
|
||||||
gpointer data,
|
gpointer data,
|
||||||
|
|||||||
@@ -779,13 +779,11 @@ static struct {
|
|||||||
const char *name;
|
const char *name;
|
||||||
GdkCursor *cursor;
|
GdkCursor *cursor;
|
||||||
} drag_cursors[] = {
|
} drag_cursors[] = {
|
||||||
{ 0, "default", NULL },
|
{ 0, "default", NULL },
|
||||||
{ GDK_ACTION_ASK, "dnd-ask", NULL },
|
{ GDK_ACTION_ASK, "dnd-ask", NULL },
|
||||||
{ GDK_ACTION_COPY, "copy", NULL },
|
{ GDK_ACTION_COPY, "copy", NULL },
|
||||||
{ GDK_ACTION_MOVE, "dnd-move", NULL }, /* Not using move here, since move is stuck using
|
{ GDK_ACTION_MOVE, "move", NULL },
|
||||||
* a mismatched visual metaphor in Adwaita
|
{ GDK_ACTION_LINK, "alias", NULL },
|
||||||
*/
|
|
||||||
{ GDK_ACTION_LINK, "alias", NULL },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GdkCursor *
|
GdkCursor *
|
||||||
|
|||||||
@@ -192,6 +192,13 @@ compute_smooth_frame_time (GdkFrameClock *clock,
|
|||||||
* and new_frame_time >= old_frame_time. */
|
* and new_frame_time >= old_frame_time. */
|
||||||
frames_passed = (new_frame_time - smoothed_frame_time_base + frame_interval / 2) / frame_interval;
|
frames_passed = (new_frame_time - smoothed_frame_time_base + frame_interval / 2) / frame_interval;
|
||||||
|
|
||||||
|
if (frames_passed > 1)
|
||||||
|
gdk_profiler_add_markf ((smoothed_frame_time_base - (frame_interval * (frames_passed-1))) * 1000L,
|
||||||
|
frame_interval * (frames_passed-1) * 1000L,
|
||||||
|
"Dropped Frames",
|
||||||
|
"%u frames may have been dropped",
|
||||||
|
frames_passed-1);
|
||||||
|
|
||||||
/* We use an approximately whole number of frames in the future from
|
/* We use an approximately whole number of frames in the future from
|
||||||
* last smoothed frame time. This way we avoid minor jitter in the
|
* last smoothed frame time. This way we avoid minor jitter in the
|
||||||
* frame times making the animation speed uneven, but still animate
|
* frame times making the animation speed uneven, but still animate
|
||||||
|
|||||||
@@ -1956,6 +1956,8 @@ gdk_gl_context_get_glsl_version_string (GdkGLContext *self)
|
|||||||
return "#version 310 es";
|
return "#version 310 es";
|
||||||
else if (gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 0)))
|
else if (gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 0)))
|
||||||
return "#version 300 es";
|
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
|
else
|
||||||
return "#version 100";
|
return "#version 100";
|
||||||
}
|
}
|
||||||
@@ -2196,78 +2198,12 @@ gdk_gl_context_import_dmabuf (GdkGLContext *self,
|
|||||||
|
|
||||||
gdk_display_init_dmabuf (display);
|
gdk_display_init_dmabuf (display);
|
||||||
|
|
||||||
if (gdk_dmabuf_formats_contains (display->egl_dmabuf_formats, dmabuf->fourcc, dmabuf->modifier))
|
if (!gdk_dmabuf_formats_contains (display->egl_external_formats, dmabuf->fourcc, dmabuf->modifier))
|
||||||
{
|
{
|
||||||
/* This is the path for modern drivers that support modifiers */
|
|
||||||
|
|
||||||
if (!gdk_dmabuf_formats_contains (display->egl_external_formats, dmabuf->fourcc, dmabuf->modifier))
|
|
||||||
{
|
|
||||||
texture_id = gdk_gl_context_import_dmabuf_for_target (self,
|
|
||||||
width, height,
|
|
||||||
dmabuf,
|
|
||||||
GL_TEXTURE_2D);
|
|
||||||
if (texture_id == 0)
|
|
||||||
{
|
|
||||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
|
||||||
"Import of %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf failed",
|
|
||||||
width, height,
|
|
||||||
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
|
||||||
"Imported %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf as GL_TEXTURE_2D texture",
|
|
||||||
width, height,
|
|
||||||
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
|
||||||
*external = FALSE;
|
|
||||||
return texture_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!gdk_gl_context_get_use_es (self))
|
|
||||||
{
|
|
||||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
|
||||||
"Can't import external_only %.4s:%#" G_GINT64_MODIFIER "x outside of GLES",
|
|
||||||
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
texture_id = gdk_gl_context_import_dmabuf_for_target (self,
|
texture_id = gdk_gl_context_import_dmabuf_for_target (self,
|
||||||
width, height,
|
width, height,
|
||||||
dmabuf,
|
dmabuf,
|
||||||
GL_TEXTURE_EXTERNAL_OES);
|
GL_TEXTURE_2D);
|
||||||
if (texture_id == 0)
|
|
||||||
{
|
|
||||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
|
||||||
"Import of external_only %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf failed",
|
|
||||||
width, height,
|
|
||||||
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
|
||||||
"Imported %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf as GL_TEXTURE_EXTERNAL_OES texture",
|
|
||||||
width, height,
|
|
||||||
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
|
||||||
*external = TRUE;
|
|
||||||
return texture_id;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* This is the opportunistic path.
|
|
||||||
* We hit it both for drivers that do not support modifiers as well as for dmabufs
|
|
||||||
* that the driver did not explicitly advertise. */
|
|
||||||
int target;
|
|
||||||
|
|
||||||
if (gdk_gl_context_get_use_es (self))
|
|
||||||
target = GL_TEXTURE_EXTERNAL_OES;
|
|
||||||
else
|
|
||||||
target = GL_TEXTURE_2D;
|
|
||||||
|
|
||||||
texture_id = gdk_gl_context_import_dmabuf_for_target (self,
|
|
||||||
width, height,
|
|
||||||
dmabuf,
|
|
||||||
target);
|
|
||||||
|
|
||||||
if (texture_id == 0)
|
if (texture_id == 0)
|
||||||
{
|
{
|
||||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||||
@@ -2278,13 +2214,40 @@ gdk_gl_context_import_dmabuf (GdkGLContext *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||||
"Imported %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf as %s texture",
|
"Imported %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf as GL_TEXTURE_2D texture",
|
||||||
width, height,
|
width, height,
|
||||||
(char *) &dmabuf->fourcc, dmabuf->modifier,
|
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
||||||
target == GL_TEXTURE_EXTERNAL_OES ? "GL_TEXTURE_EXTERNAL_OES" : "GL_TEXTURE_2D");
|
*external = FALSE;
|
||||||
*external = target == GL_TEXTURE_EXTERNAL_OES;
|
|
||||||
return texture_id;
|
return texture_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!gdk_gl_context_get_use_es (self))
|
||||||
|
{
|
||||||
|
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||||
|
"Can't import external_only %.4s:%#" G_GINT64_MODIFIER "x outside of GLES",
|
||||||
|
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
texture_id = gdk_gl_context_import_dmabuf_for_target (self,
|
||||||
|
width, height,
|
||||||
|
dmabuf,
|
||||||
|
GL_TEXTURE_EXTERNAL_OES);
|
||||||
|
if (texture_id == 0)
|
||||||
|
{
|
||||||
|
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||||
|
"Import of external_only %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf failed",
|
||||||
|
width, height,
|
||||||
|
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||||
|
"Imported %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf as GL_TEXTURE_EXTERNAL_OES texture",
|
||||||
|
width, height,
|
||||||
|
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
||||||
|
*external = TRUE;
|
||||||
|
return texture_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
|
|||||||
@@ -744,11 +744,3 @@ gdk_monitor_set_description (GdkMonitor *monitor,
|
|||||||
g_object_notify_by_pspec (G_OBJECT (monitor), props[PROP_DESCRIPTION]);
|
g_object_notify_by_pspec (G_OBJECT (monitor), props[PROP_DESCRIPTION]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MM_PER_INCH 25.4
|
|
||||||
|
|
||||||
double
|
|
||||||
gdk_monitor_get_dpi (GdkMonitor *monitor)
|
|
||||||
{
|
|
||||||
return MAX ((monitor->geometry.width * monitor->scale) / (monitor->width_mm / MM_PER_INCH),
|
|
||||||
(monitor->geometry.height * monitor->scale) / (monitor->height_mm / MM_PER_INCH));
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -76,7 +76,6 @@ void gdk_monitor_set_subpixel_layout (GdkMonitor *monitor,
|
|||||||
void gdk_monitor_invalidate (GdkMonitor *monitor);
|
void gdk_monitor_invalidate (GdkMonitor *monitor);
|
||||||
void gdk_monitor_set_description (GdkMonitor *monitor,
|
void gdk_monitor_set_description (GdkMonitor *monitor,
|
||||||
const char *description);
|
const char *description);
|
||||||
double gdk_monitor_get_dpi (GdkMonitor *monitor);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ typedef enum {
|
|||||||
* @get_current_image: return a `GdkPaintable` that does not change over
|
* @get_current_image: return a `GdkPaintable` that does not change over
|
||||||
* time. This means the `GDK_PAINTABLE_STATIC_SIZE` and
|
* time. This means the `GDK_PAINTABLE_STATIC_SIZE` and
|
||||||
* `GDK_PAINTABLE_STATIC_CONTENTS` flag are set.
|
* `GDK_PAINTABLE_STATIC_CONTENTS` flag are set.
|
||||||
* @get_flags: Get the flags for this instance. See [flags@Gdk.PaintableFlags]
|
* @get_flags: Get the flags for this instance. See [enum@Gdk.PaintableFlags]
|
||||||
* for details.
|
* for details.
|
||||||
* @get_intrinsic_width: The preferred width for this object to be
|
* @get_intrinsic_width: The preferred width for this object to be
|
||||||
* snapshot at or 0 if none. This is purely a hint. The object must still
|
* snapshot at or 0 if none. This is purely a hint. The object must still
|
||||||
|
|||||||
@@ -98,9 +98,9 @@ gdk_rgba_free (GdkRGBA *rgba)
|
|||||||
* Returns: %TRUE if the @rgba is clear
|
* Returns: %TRUE if the @rgba is clear
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
(gdk_rgba_is_clear) (const GdkRGBA *rgba)
|
gdk_rgba_is_clear (const GdkRGBA *rgba)
|
||||||
{
|
{
|
||||||
return _gdk_rgba_is_clear (rgba);
|
return rgba->alpha < ((float) 0x00ff / (float) 0xffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -115,9 +115,9 @@ gboolean
|
|||||||
* Returns: %TRUE if the @rgba is opaque
|
* Returns: %TRUE if the @rgba is opaque
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
(gdk_rgba_is_opaque) (const GdkRGBA *rgba)
|
gdk_rgba_is_opaque (const GdkRGBA *rgba)
|
||||||
{
|
{
|
||||||
return _gdk_rgba_is_opaque (rgba);
|
return rgba->alpha > ((float)0xff00 / (float)0xffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SKIP_WHITESPACES(s) while (*(s) == ' ') (s)++;
|
#define SKIP_WHITESPACES(s) while (*(s) == ' ') (s)++;
|
||||||
@@ -368,10 +368,21 @@ gdk_rgba_hash (gconstpointer p)
|
|||||||
* Returns: %TRUE if the two colors compare equal
|
* Returns: %TRUE if the two colors compare equal
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
(gdk_rgba_equal) (gconstpointer p1,
|
gdk_rgba_equal (gconstpointer p1,
|
||||||
gconstpointer p2)
|
gconstpointer p2)
|
||||||
{
|
{
|
||||||
return _gdk_rgba_equal (p1, p2);
|
const GdkRGBA *rgba1, *rgba2;
|
||||||
|
|
||||||
|
rgba1 = p1;
|
||||||
|
rgba2 = p2;
|
||||||
|
|
||||||
|
if (rgba1->red == rgba2->red &&
|
||||||
|
rgba1->green == rgba2->green &&
|
||||||
|
rgba1->blue == rgba2->blue &&
|
||||||
|
rgba1->alpha == rgba2->alpha)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -43,34 +43,5 @@
|
|||||||
gboolean gdk_rgba_parser_parse (GtkCssParser *parser,
|
gboolean gdk_rgba_parser_parse (GtkCssParser *parser,
|
||||||
GdkRGBA *rgba);
|
GdkRGBA *rgba);
|
||||||
|
|
||||||
#define gdk_rgba_is_clear(rgba) _gdk_rgba_is_clear (rgba)
|
|
||||||
#define gdk_rgba_is_opaque(rgba) _gdk_rgba_is_opaque (rgba)
|
|
||||||
#define gdk_rgba_equal(p1, p2) _gdk_rgba_equal (p1, p2)
|
|
||||||
|
|
||||||
static inline gboolean
|
|
||||||
_gdk_rgba_is_clear (const GdkRGBA *rgba)
|
|
||||||
{
|
|
||||||
return rgba->alpha < ((float) 0x00ff / (float) 0xffff);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline gboolean
|
|
||||||
_gdk_rgba_is_opaque (const GdkRGBA *rgba)
|
|
||||||
{
|
|
||||||
return rgba->alpha > ((float)0xff00 / (float)0xffff);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline gboolean
|
|
||||||
_gdk_rgba_equal (gconstpointer p1,
|
|
||||||
gconstpointer p2)
|
|
||||||
{
|
|
||||||
const GdkRGBA *rgba1 = p1;
|
|
||||||
const GdkRGBA *rgba2 = p2;
|
|
||||||
|
|
||||||
return rgba1->red == rgba2->red &&
|
|
||||||
rgba1->green == rgba2->green &&
|
|
||||||
rgba1->blue == rgba2->blue &&
|
|
||||||
rgba1->alpha == rgba2->alpha;
|
|
||||||
}
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|||||||
@@ -48,14 +48,6 @@ gdk_subsurface_class_init (GdkSubsurfaceClass *class)
|
|||||||
object_class->finalize = gdk_subsurface_finalize;
|
object_class->finalize = gdk_subsurface_finalize;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*< private >
|
|
||||||
* gdk_subsurface_get_parent:
|
|
||||||
* @subsurface: a `GdkSubsurface`
|
|
||||||
*
|
|
||||||
* Returns the parent surface of @subsurface.
|
|
||||||
*
|
|
||||||
* Returns: the parent surface
|
|
||||||
*/
|
|
||||||
GdkSurface *
|
GdkSurface *
|
||||||
gdk_subsurface_get_parent (GdkSubsurface *subsurface)
|
gdk_subsurface_get_parent (GdkSubsurface *subsurface)
|
||||||
{
|
{
|
||||||
@@ -116,41 +108,15 @@ insert_subsurface (GdkSubsurface *subsurface,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*< private >
|
|
||||||
* gdk_subsurface_attach:
|
|
||||||
* @subsurface: the `GdkSubsurface`
|
|
||||||
* @texture: the texture to attach. This typically has to be a `GdkDmabufTexture`
|
|
||||||
* @source: the source rectangle (i.e. the subset of the texture) to display
|
|
||||||
* @dest: the dest rectangle, in application pixels, relative to the parent surface.
|
|
||||||
* It must be integral in application and device pixels, or attaching will fail
|
|
||||||
* @transform: the transform to apply to the texture contents before displaying
|
|
||||||
* @background: (nullable): the background rectangle, in application pixels relative
|
|
||||||
* to the parent surface. This tells GDK to put a black background of this
|
|
||||||
* size below the subsurface. It must be integral in application and device pixels,
|
|
||||||
* or attaching will fail
|
|
||||||
* @above: whether the subsurface should be above its sibling
|
|
||||||
* @sibling: (nullable): the sibling subsurface to stack relative to, or `NULL` to
|
|
||||||
* stack relative to the parent surface
|
|
||||||
*
|
|
||||||
* Attaches content to a subsurface.
|
|
||||||
*
|
|
||||||
* This function takes all the necessary arguments to determine the subsurface
|
|
||||||
* configuration, including its position, size, content, background and stacking.
|
|
||||||
*
|
|
||||||
* Returns: `TRUE` if the attaching succeeded
|
|
||||||
*/
|
|
||||||
gboolean
|
gboolean
|
||||||
gdk_subsurface_attach (GdkSubsurface *subsurface,
|
gdk_subsurface_attach (GdkSubsurface *subsurface,
|
||||||
GdkTexture *texture,
|
GdkTexture *texture,
|
||||||
const graphene_rect_t *source,
|
const graphene_rect_t *source,
|
||||||
const graphene_rect_t *dest,
|
const graphene_rect_t *dest,
|
||||||
GdkTextureTransform transform,
|
|
||||||
const graphene_rect_t *background,
|
|
||||||
gboolean above,
|
gboolean above,
|
||||||
GdkSubsurface *sibling)
|
GdkSubsurface *sibling)
|
||||||
{
|
{
|
||||||
GdkSurface *parent = subsurface->parent;
|
GdkSurface *parent = subsurface->parent;
|
||||||
gboolean result;
|
|
||||||
|
|
||||||
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), FALSE);
|
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), FALSE);
|
||||||
g_return_val_if_fail (GDK_IS_TEXTURE (texture), FALSE);
|
g_return_val_if_fail (GDK_IS_TEXTURE (texture), FALSE);
|
||||||
@@ -164,15 +130,6 @@ gdk_subsurface_attach (GdkSubsurface *subsurface,
|
|||||||
g_return_val_if_fail (sibling == NULL || GDK_IS_SUBSURFACE (sibling), FALSE);
|
g_return_val_if_fail (sibling == NULL || GDK_IS_SUBSURFACE (sibling), FALSE);
|
||||||
g_return_val_if_fail (sibling == NULL || sibling->parent == subsurface->parent, FALSE);
|
g_return_val_if_fail (sibling == NULL || sibling->parent == subsurface->parent, FALSE);
|
||||||
|
|
||||||
result = GDK_SUBSURFACE_GET_CLASS (subsurface)->attach (subsurface,
|
|
||||||
texture,
|
|
||||||
source,
|
|
||||||
dest,
|
|
||||||
transform,
|
|
||||||
background,
|
|
||||||
above,
|
|
||||||
sibling);
|
|
||||||
|
|
||||||
remove_subsurface (subsurface);
|
remove_subsurface (subsurface);
|
||||||
|
|
||||||
if (sibling)
|
if (sibling)
|
||||||
@@ -198,17 +155,9 @@ gdk_subsurface_attach (GdkSubsurface *subsurface,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return GDK_SUBSURFACE_GET_CLASS (subsurface)->attach (subsurface, texture, source, dest, above, sibling);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*< private >
|
|
||||||
* gdk_subsurface_detach:
|
|
||||||
* @subsurface: a `GdkSubsurface`
|
|
||||||
*
|
|
||||||
* Hides the subsurface.
|
|
||||||
*
|
|
||||||
* To show it again, you need to call gdk_subsurface_attach().
|
|
||||||
*/
|
|
||||||
void
|
void
|
||||||
gdk_subsurface_detach (GdkSubsurface *subsurface)
|
gdk_subsurface_detach (GdkSubsurface *subsurface)
|
||||||
{
|
{
|
||||||
@@ -219,14 +168,6 @@ gdk_subsurface_detach (GdkSubsurface *subsurface)
|
|||||||
GDK_SUBSURFACE_GET_CLASS (subsurface)->detach (subsurface);
|
GDK_SUBSURFACE_GET_CLASS (subsurface)->detach (subsurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*< private >
|
|
||||||
* gdk_subsurface_get_texture:
|
|
||||||
* @subsurface: a `GdkSubsurface`
|
|
||||||
*
|
|
||||||
* Gets the texture that is currently displayed by the subsurface.
|
|
||||||
*
|
|
||||||
* Returns: (nullable): the texture that is displayed
|
|
||||||
*/
|
|
||||||
GdkTexture *
|
GdkTexture *
|
||||||
gdk_subsurface_get_texture (GdkSubsurface *subsurface)
|
gdk_subsurface_get_texture (GdkSubsurface *subsurface)
|
||||||
{
|
{
|
||||||
@@ -235,138 +176,30 @@ gdk_subsurface_get_texture (GdkSubsurface *subsurface)
|
|||||||
return GDK_SUBSURFACE_GET_CLASS (subsurface)->get_texture (subsurface);
|
return GDK_SUBSURFACE_GET_CLASS (subsurface)->get_texture (subsurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*< private >
|
|
||||||
* gdk_subsurface_get_source_rect:
|
|
||||||
* @subsurface: a `GdkSubsurface`
|
|
||||||
* @rect: (out caller-allocates): return location for the rectangle
|
|
||||||
*
|
|
||||||
* Returns the source rect that was specified in the most recent
|
|
||||||
* gdk_subsurface_attach() call for @subsurface.
|
|
||||||
*/
|
|
||||||
void
|
void
|
||||||
gdk_subsurface_get_source_rect (GdkSubsurface *subsurface,
|
gdk_subsurface_get_source (GdkSubsurface *subsurface,
|
||||||
graphene_rect_t *rect)
|
graphene_rect_t *source)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GDK_IS_SUBSURFACE (subsurface));
|
g_return_if_fail (GDK_IS_SUBSURFACE (subsurface));
|
||||||
g_return_if_fail (rect != NULL);
|
g_return_if_fail (source != NULL);
|
||||||
|
|
||||||
GDK_SUBSURFACE_GET_CLASS (subsurface)->get_source_rect (subsurface, rect);
|
GDK_SUBSURFACE_GET_CLASS (subsurface)->get_source (subsurface, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*< private >
|
|
||||||
* gdk_subsurface_get_texture_rect:
|
|
||||||
* @subsurface: a `GdkSubsurface`
|
|
||||||
* @rect: (out caller-allocates): return location for the rectangle
|
|
||||||
*
|
|
||||||
* Returns the texture rect that was specified in the most recent
|
|
||||||
* gdk_subsurface_attach() call for @subsurface.
|
|
||||||
*/
|
|
||||||
void
|
void
|
||||||
gdk_subsurface_get_texture_rect (GdkSubsurface *subsurface,
|
gdk_subsurface_get_dest (GdkSubsurface *subsurface,
|
||||||
graphene_rect_t *rect)
|
graphene_rect_t *dest)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GDK_IS_SUBSURFACE (subsurface));
|
g_return_if_fail (GDK_IS_SUBSURFACE (subsurface));
|
||||||
g_return_if_fail (rect != NULL);
|
g_return_if_fail (dest != NULL);
|
||||||
|
|
||||||
GDK_SUBSURFACE_GET_CLASS (subsurface)->get_texture_rect (subsurface, rect);
|
GDK_SUBSURFACE_GET_CLASS (subsurface)->get_dest (subsurface, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*< private >
|
|
||||||
* gdk_subsurface_is_above_parent:
|
|
||||||
* @subsurface: a `GdkSubsurface`
|
|
||||||
*
|
|
||||||
* Returns whether the subsurface is above the parent surface
|
|
||||||
* or below. Note that a subsurface can be above its parent
|
|
||||||
* surface, and still be covered by sibling subsurfaces.
|
|
||||||
*
|
|
||||||
* Returns: `TRUE` if @subsurface is above its parent
|
|
||||||
*/
|
|
||||||
gboolean
|
gboolean
|
||||||
gdk_subsurface_is_above_parent (GdkSubsurface *subsurface)
|
gdk_subsurface_is_above_parent (GdkSubsurface *subsurface)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), FALSE);
|
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), TRUE);
|
||||||
|
|
||||||
return subsurface->above_parent;
|
return subsurface->above_parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*< private>
|
|
||||||
* gdk_subsurface_get_sibling:
|
|
||||||
* @subsurface: the `GdkSubsurface`
|
|
||||||
* @above: whether to get the subsurface above
|
|
||||||
*
|
|
||||||
* Returns the subsurface above (or below) @subsurface in
|
|
||||||
* the stacking order.
|
|
||||||
*
|
|
||||||
* Returns: the sibling, or `NULL` if there is none.
|
|
||||||
*/
|
|
||||||
GdkSubsurface *
|
|
||||||
gdk_subsurface_get_sibling (GdkSubsurface *subsurface,
|
|
||||||
gboolean above)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), NULL);
|
|
||||||
|
|
||||||
if (above)
|
|
||||||
return subsurface->sibling_above;
|
|
||||||
else
|
|
||||||
return subsurface->sibling_below;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*< private >
|
|
||||||
* gdk_subsurface_get_transform:
|
|
||||||
* @subsurface: a `GdkSubsurface`
|
|
||||||
*
|
|
||||||
* Returns the transform that was specified in the most recent call to
|
|
||||||
* gdk_subsurface_attach() call for @subsurface.
|
|
||||||
*
|
|
||||||
* Returns: the transform
|
|
||||||
*/
|
|
||||||
GdkTextureTransform
|
|
||||||
gdk_subsurface_get_transform (GdkSubsurface *subsurface)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), GDK_TEXTURE_TRANSFORM_NORMAL);
|
|
||||||
|
|
||||||
return GDK_SUBSURFACE_GET_CLASS (subsurface)->get_transform (subsurface);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*< private >
|
|
||||||
* gdk_subsurface_get_background_rect:
|
|
||||||
* @subsurface: a `GdkSubsurface`
|
|
||||||
* @rect: (out caller-allocates): return location for the rectangle
|
|
||||||
*
|
|
||||||
* Obtains the background rect that was specified in the most recent
|
|
||||||
* gdk_subsurface_attach() call for @subsurface.
|
|
||||||
*
|
|
||||||
* Returns: `TRUE` if @subsurface has a background
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
gdk_subsurface_get_background_rect (GdkSubsurface *subsurface,
|
|
||||||
graphene_rect_t *rect)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), FALSE);
|
|
||||||
g_return_val_if_fail (rect != NULL, FALSE);
|
|
||||||
|
|
||||||
return GDK_SUBSURFACE_GET_CLASS (subsurface)->get_background_rect (subsurface, rect);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*< private >
|
|
||||||
* gdk_subsurface_get_bounds:
|
|
||||||
* @subsurface: a `GdkSubsurface`
|
|
||||||
* @bounds: (out caller-allocates): return location for the bounds
|
|
||||||
*
|
|
||||||
* Returns the bounds of the subsurface.
|
|
||||||
*
|
|
||||||
* The bounds are the union of the texture and background rects.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
gdk_subsurface_get_bounds (GdkSubsurface *subsurface,
|
|
||||||
graphene_rect_t *bounds)
|
|
||||||
{
|
|
||||||
graphene_rect_t background;
|
|
||||||
|
|
||||||
g_return_if_fail (GDK_IS_SUBSURFACE (subsurface));
|
|
||||||
g_return_if_fail (bounds != NULL);
|
|
||||||
|
|
||||||
gdk_subsurface_get_texture_rect (subsurface, bounds);
|
|
||||||
if (gdk_subsurface_get_background_rect (subsurface, &background))
|
|
||||||
graphene_rect_union (bounds, &background, bounds);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -47,68 +47,42 @@ struct _GdkSubsurface
|
|||||||
GdkSubsurface *sibling_below;
|
GdkSubsurface *sibling_below;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
GDK_TEXTURE_TRANSFORM_NORMAL,
|
|
||||||
GDK_TEXTURE_TRANSFORM_90,
|
|
||||||
GDK_TEXTURE_TRANSFORM_180,
|
|
||||||
GDK_TEXTURE_TRANSFORM_270,
|
|
||||||
GDK_TEXTURE_TRANSFORM_FLIPPED,
|
|
||||||
GDK_TEXTURE_TRANSFORM_FLIPPED_90,
|
|
||||||
GDK_TEXTURE_TRANSFORM_FLIPPED_180,
|
|
||||||
GDK_TEXTURE_TRANSFORM_FLIPPED_270,
|
|
||||||
} GdkTextureTransform;
|
|
||||||
|
|
||||||
struct _GdkSubsurfaceClass
|
struct _GdkSubsurfaceClass
|
||||||
{
|
{
|
||||||
GObjectClass parent_class;
|
GObjectClass parent_class;
|
||||||
|
|
||||||
gboolean (* attach) (GdkSubsurface *subsurface,
|
gboolean (* attach) (GdkSubsurface *subsurface,
|
||||||
GdkTexture *texture,
|
GdkTexture *texture,
|
||||||
const graphene_rect_t *source,
|
const graphene_rect_t *source,
|
||||||
const graphene_rect_t *dest,
|
const graphene_rect_t *dest,
|
||||||
GdkTextureTransform transform,
|
gboolean above,
|
||||||
const graphene_rect_t *bg,
|
GdkSubsurface *sibling);
|
||||||
gboolean above,
|
void (* detach) (GdkSubsurface *subsurface);
|
||||||
GdkSubsurface *sibling);
|
GdkTexture * (* get_texture) (GdkSubsurface *subsurface);
|
||||||
void (* detach) (GdkSubsurface *subsurface);
|
void (* get_source) (GdkSubsurface *subsurface,
|
||||||
GdkTexture * (* get_texture) (GdkSubsurface *subsurface);
|
graphene_rect_t *source);
|
||||||
void (* get_source_rect) (GdkSubsurface *subsurface,
|
void (* get_dest) (GdkSubsurface *subsurface,
|
||||||
graphene_rect_t *rect);
|
graphene_rect_t *dest);
|
||||||
void (* get_texture_rect) (GdkSubsurface *subsurface,
|
|
||||||
graphene_rect_t *rect);
|
|
||||||
GdkTextureTransform
|
|
||||||
(* get_transform) (GdkSubsurface *subsurface);
|
|
||||||
gboolean (* get_background_rect) (GdkSubsurface *subsurface,
|
|
||||||
graphene_rect_t *rect);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GType gdk_subsurface_get_type (void) G_GNUC_CONST;
|
GType gdk_subsurface_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
GdkSurface * gdk_subsurface_get_parent (GdkSubsurface *subsurface);
|
GdkSurface * gdk_subsurface_get_parent (GdkSubsurface *subsurface);
|
||||||
|
gboolean gdk_subsurface_attach (GdkSubsurface *subsurface,
|
||||||
|
GdkTexture *texture,
|
||||||
|
const graphene_rect_t *source,
|
||||||
|
const graphene_rect_t *dest,
|
||||||
|
gboolean above,
|
||||||
|
GdkSubsurface *sibling);
|
||||||
|
void gdk_subsurface_detach (GdkSubsurface *subsurface);
|
||||||
|
GdkTexture * gdk_subsurface_get_texture (GdkSubsurface *subsurface);
|
||||||
|
void gdk_subsurface_get_source (GdkSubsurface *subsurface,
|
||||||
|
graphene_rect_t *source);
|
||||||
|
void gdk_subsurface_get_dest (GdkSubsurface *subsurface,
|
||||||
|
graphene_rect_t *dest);
|
||||||
|
gboolean gdk_subsurface_is_above_parent (GdkSubsurface *subsurface);
|
||||||
|
|
||||||
gboolean gdk_subsurface_attach (GdkSubsurface *subsurface,
|
|
||||||
GdkTexture *texture,
|
|
||||||
const graphene_rect_t *source,
|
|
||||||
const graphene_rect_t *dest,
|
|
||||||
GdkTextureTransform transform,
|
|
||||||
const graphene_rect_t *background,
|
|
||||||
gboolean above,
|
|
||||||
GdkSubsurface *sibling);
|
|
||||||
void gdk_subsurface_detach (GdkSubsurface *subsurface);
|
|
||||||
GdkTexture * gdk_subsurface_get_texture (GdkSubsurface *subsurface);
|
|
||||||
void gdk_subsurface_get_source_rect (GdkSubsurface *subsurface,
|
|
||||||
graphene_rect_t *rect);
|
|
||||||
void gdk_subsurface_get_texture_rect (GdkSubsurface *subsurface,
|
|
||||||
graphene_rect_t *rect);
|
|
||||||
gboolean gdk_subsurface_is_above_parent (GdkSubsurface *subsurface);
|
|
||||||
GdkSubsurface * gdk_subsurface_get_sibling (GdkSubsurface *subsurface,
|
|
||||||
gboolean above);
|
|
||||||
GdkTextureTransform
|
|
||||||
gdk_subsurface_get_transform (GdkSubsurface *subsurface);
|
|
||||||
gboolean gdk_subsurface_get_background_rect (GdkSubsurface *subsurface,
|
|
||||||
graphene_rect_t *rect);
|
|
||||||
void gdk_subsurface_get_bounds (GdkSubsurface *subsurface,
|
|
||||||
graphene_rect_t *bounds);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|||||||
@@ -563,7 +563,7 @@ gdk_texture_new_from_bytes_internal (GBytes *bytes,
|
|||||||
{
|
{
|
||||||
if (gdk_is_png (bytes))
|
if (gdk_is_png (bytes))
|
||||||
{
|
{
|
||||||
return gdk_load_png (bytes, NULL, error);
|
return gdk_load_png (bytes, error);
|
||||||
}
|
}
|
||||||
else if (gdk_is_jpeg (bytes))
|
else if (gdk_is_jpeg (bytes))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,7 +29,6 @@
|
|||||||
#include "gdkdmabuffourccprivate.h"
|
#include "gdkdmabuffourccprivate.h"
|
||||||
#include "gdkdmabuftextureprivate.h"
|
#include "gdkdmabuftextureprivate.h"
|
||||||
#include "gdkdisplayprivate.h"
|
#include "gdkdisplayprivate.h"
|
||||||
#include "gdkprofilerprivate.h"
|
|
||||||
#include <glib/gi18n-lib.h>
|
#include <glib/gi18n-lib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
@@ -58,9 +57,6 @@ static const GdkDebugKey gsk_vulkan_feature_keys[] = {
|
|||||||
*
|
*
|
||||||
* Support for `GdkVulkanContext` is platform-specific and context creation
|
* Support for `GdkVulkanContext` is platform-specific and context creation
|
||||||
* can fail, returning %NULL context.
|
* can fail, returning %NULL context.
|
||||||
*
|
|
||||||
* Deprecated: 4.14: GTK does not expose any Vulkan internals. This
|
|
||||||
* struct is a leftover that was accidentally exposed.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct _GdkVulkanContextPrivate GdkVulkanContextPrivate;
|
typedef struct _GdkVulkanContextPrivate GdkVulkanContextPrivate;
|
||||||
@@ -632,7 +628,6 @@ gdk_vulkan_context_begin_frame (GdkDrawContext *draw_context,
|
|||||||
{
|
{
|
||||||
GdkVulkanContext *context = GDK_VULKAN_CONTEXT (draw_context);
|
GdkVulkanContext *context = GDK_VULKAN_CONTEXT (draw_context);
|
||||||
GdkVulkanContextPrivate *priv = gdk_vulkan_context_get_instance_private (context);
|
GdkVulkanContextPrivate *priv = gdk_vulkan_context_get_instance_private (context);
|
||||||
VkResult acquire_result;
|
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
if (depth != priv->current_format)
|
if (depth != priv->current_format)
|
||||||
@@ -654,29 +649,12 @@ gdk_vulkan_context_begin_frame (GdkDrawContext *draw_context,
|
|||||||
cairo_region_union (priv->regions[i], region);
|
cairo_region_union (priv->regions[i], region);
|
||||||
}
|
}
|
||||||
|
|
||||||
acquire_next_image:
|
GDK_VK_CHECK (vkAcquireNextImageKHR, gdk_vulkan_context_get_device (context),
|
||||||
acquire_result = GDK_VK_CHECK (vkAcquireNextImageKHR, gdk_vulkan_context_get_device (context),
|
priv->swapchain,
|
||||||
priv->swapchain,
|
UINT64_MAX,
|
||||||
UINT64_MAX,
|
priv->draw_semaphore,
|
||||||
priv->draw_semaphore,
|
VK_NULL_HANDLE,
|
||||||
VK_NULL_HANDLE,
|
&priv->draw_index);
|
||||||
&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;
|
|
||||||
}
|
|
||||||
|
|
||||||
cairo_region_union (region, priv->regions[priv->draw_index]);
|
cairo_region_union (region, priv->regions[priv->draw_index]);
|
||||||
}
|
}
|
||||||
@@ -1129,7 +1107,6 @@ gdk_display_load_pipeline_cache (GdkDisplay *display)
|
|||||||
static gboolean
|
static gboolean
|
||||||
gdk_vulkan_save_pipeline_cache (GdkDisplay *display)
|
gdk_vulkan_save_pipeline_cache (GdkDisplay *display)
|
||||||
{
|
{
|
||||||
G_GNUC_UNUSED gint64 begin_time = GDK_PROFILER_CURRENT_TIME;
|
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
VkDevice device;
|
VkDevice device;
|
||||||
VkPipelineCache cache;
|
VkPipelineCache cache;
|
||||||
@@ -1151,6 +1128,7 @@ gdk_vulkan_save_pipeline_cache (GdkDisplay *display)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
data = g_malloc (size);
|
data = g_malloc (size);
|
||||||
if (GDK_VK_CHECK (vkGetPipelineCacheData, device, cache, &size, data) != VK_SUCCESS)
|
if (GDK_VK_CHECK (vkGetPipelineCacheData, device, cache, &size, data) != VK_SUCCESS)
|
||||||
{
|
{
|
||||||
@@ -1170,7 +1148,7 @@ gdk_vulkan_save_pipeline_cache (GdkDisplay *display)
|
|||||||
|
|
||||||
file = gdk_vulkan_get_pipeline_cache_file (display);
|
file = gdk_vulkan_get_pipeline_cache_file (display);
|
||||||
|
|
||||||
GDK_DEBUG (VULKAN, "Saving pipeline cache of size %lu to %s", size, g_file_peek_path (file));
|
GDK_DEBUG (VULKAN, "Saving pipeline cache to %s", g_file_peek_path (file));
|
||||||
|
|
||||||
if (!g_file_replace_contents (file,
|
if (!g_file_replace_contents (file,
|
||||||
data,
|
data,
|
||||||
@@ -1212,15 +1190,10 @@ gdk_vulkan_save_pipeline_cache (GdkDisplay *display)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gdk_profiler_end_markf (begin_time,
|
|
||||||
"Save Vulkan pipeline cache", "%s size %lu",
|
|
||||||
g_file_peek_path (file), size);
|
|
||||||
|
|
||||||
g_object_unref (file);
|
g_object_unref (file);
|
||||||
g_free (data);
|
g_free (data);
|
||||||
g_free (display->vk_pipeline_cache_etag);
|
g_free (display->vk_pipeline_cache_etag);
|
||||||
display->vk_pipeline_cache_etag = etag;
|
display->vk_pipeline_cache_etag = etag;
|
||||||
display->vk_pipeline_cache_size = size;
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -1260,11 +1233,6 @@ gdk_display_create_pipeline_cache (GdkDisplay *display)
|
|||||||
},
|
},
|
||||||
NULL,
|
NULL,
|
||||||
&display->vk_pipeline_cache);
|
&display->vk_pipeline_cache);
|
||||||
GDK_DEBUG (VULKAN, "Creating empty pipeline cache");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
GDK_DEBUG (VULKAN, "Loading pipeline cache (%lu bytes)", display->vk_pipeline_cache_size);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1374,7 +1342,6 @@ static gboolean
|
|||||||
gdk_display_create_vulkan_device (GdkDisplay *display,
|
gdk_display_create_vulkan_device (GdkDisplay *display,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
|
|
||||||
uint32_t i, j, k;
|
uint32_t i, j, k;
|
||||||
const char *override;
|
const char *override;
|
||||||
gboolean list_devices;
|
gboolean list_devices;
|
||||||
@@ -1583,8 +1550,6 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
|
|||||||
"Hum, what? This should not happen.")));
|
"Hum, what? This should not happen.")));
|
||||||
}
|
}
|
||||||
|
|
||||||
gdk_profiler_end_mark (start_time, "Create Vulkan device", NULL);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1623,7 +1588,6 @@ static gboolean
|
|||||||
gdk_display_create_vulkan_instance (GdkDisplay *display,
|
gdk_display_create_vulkan_instance (GdkDisplay *display,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
|
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
GPtrArray *used_extensions;
|
GPtrArray *used_extensions;
|
||||||
GPtrArray *used_layers;
|
GPtrArray *used_layers;
|
||||||
@@ -1785,8 +1749,6 @@ gdk_display_create_vulkan_instance (GdkDisplay *display,
|
|||||||
|
|
||||||
display->vk_shader_modules = g_hash_table_new (g_str_hash, g_str_equal);
|
display->vk_shader_modules = g_hash_table_new (g_str_hash, g_str_equal);
|
||||||
|
|
||||||
gdk_profiler_end_mark (start_time, "Create Vulkan instance", NULL);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -130,15 +130,12 @@ png_simple_warning_callback (png_structp png,
|
|||||||
/* {{{ Public API */
|
/* {{{ Public API */
|
||||||
|
|
||||||
GdkTexture *
|
GdkTexture *
|
||||||
gdk_load_png (GBytes *bytes,
|
gdk_load_png (GBytes *bytes,
|
||||||
GHashTable *options,
|
GError **error)
|
||||||
GError **error)
|
|
||||||
{
|
{
|
||||||
png_io io;
|
png_io io;
|
||||||
png_struct *png = NULL;
|
png_struct *png = NULL;
|
||||||
png_info *info;
|
png_info *info;
|
||||||
png_textp text;
|
|
||||||
int num_texts;
|
|
||||||
guint width, height;
|
guint width, height;
|
||||||
gsize i, stride;
|
gsize i, stride;
|
||||||
int depth, color_type;
|
int depth, color_type;
|
||||||
@@ -300,17 +297,6 @@ gdk_load_png (GBytes *bytes,
|
|||||||
texture = gdk_memory_texture_new (width, height, format, out_bytes, stride);
|
texture = gdk_memory_texture_new (width, height, format, out_bytes, stride);
|
||||||
g_bytes_unref (out_bytes);
|
g_bytes_unref (out_bytes);
|
||||||
|
|
||||||
if (options && png_get_text (png, info, &text, &num_texts))
|
|
||||||
{
|
|
||||||
for (i = 0; i < num_texts; i++)
|
|
||||||
{
|
|
||||||
if (text->compression != -1)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
g_hash_table_insert (options, g_strdup (text->key), g_strdup (text->text));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_free (row_pointers);
|
g_free (row_pointers);
|
||||||
png_destroy_read_struct (&png, &info, NULL);
|
png_destroy_read_struct (&png, &info, NULL);
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
#define PNG_SIGNATURE "\x89PNG"
|
#define PNG_SIGNATURE "\x89PNG"
|
||||||
|
|
||||||
GdkTexture *gdk_load_png (GBytes *bytes,
|
GdkTexture *gdk_load_png (GBytes *bytes,
|
||||||
GHashTable *options,
|
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
GBytes *gdk_save_png (GdkTexture *texture);
|
GBytes *gdk_save_png (GdkTexture *texture);
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "gdkmacoscursor-private.h"
|
#include "gdkmacoscursor-private.h"
|
||||||
#include "gdkcursorprivate.h"
|
|
||||||
|
|
||||||
@interface NSCursor()
|
@interface NSCursor()
|
||||||
-(long long)_coreCursorType;
|
-(long long)_coreCursorType;
|
||||||
@@ -218,25 +217,11 @@ _gdk_macos_cursor_get_ns_cursor (GdkCursor *cursor)
|
|||||||
|
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
{
|
{
|
||||||
GdkTexture *texture;
|
GdkTexture *texture = gdk_cursor_create_texture (cursor, 1);
|
||||||
int hotspot_x, hotspot_y;
|
nscursor = create_cursor_from_texture (texture,
|
||||||
|
gdk_cursor_get_hotspot_x (cursor),
|
||||||
texture = gdk_cursor_get_texture (cursor);
|
gdk_cursor_get_hotspot_y (cursor));
|
||||||
hotspot_x = gdk_cursor_get_hotspot_x (cursor);
|
g_object_unref (texture);
|
||||||
hotspot_y = gdk_cursor_get_hotspot_y (cursor);
|
|
||||||
|
|
||||||
if (texture == NULL)
|
|
||||||
{
|
|
||||||
int size = 32; // FIXME
|
|
||||||
int width, height;
|
|
||||||
|
|
||||||
texture = gdk_cursor_get_texture_for_size (cursor, size, 1,
|
|
||||||
&width, &height,
|
|
||||||
&hotspot_x, &hotspot_y);
|
|
||||||
}
|
|
||||||
|
|
||||||
nscursor = create_cursor_from_texture (texture, hotspot_x, hotspot_y);
|
|
||||||
|
|
||||||
return nscursor;
|
return nscursor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -161,8 +161,7 @@ void _gdk_macos_display_send_event (GdkMacosDisp
|
|||||||
void _gdk_macos_display_warp_pointer (GdkMacosDisplay *self,
|
void _gdk_macos_display_warp_pointer (GdkMacosDisplay *self,
|
||||||
int x,
|
int x,
|
||||||
int y);
|
int y);
|
||||||
NSEvent *_gdk_macos_display_get_matching_nsevent (GdkEvent *event);
|
NSEvent *_gdk_macos_display_get_nsevent (GdkEvent *event);
|
||||||
NSEvent *_gdk_macos_display_get_exact_nsevent (GdkEvent *event);
|
|
||||||
NSEvent *_gdk_macos_display_get_last_nsevent (void);
|
NSEvent *_gdk_macos_display_get_last_nsevent (void);
|
||||||
GdkDrag *_gdk_macos_display_find_drag (GdkMacosDisplay *self,
|
GdkDrag *_gdk_macos_display_find_drag (GdkMacosDisplay *self,
|
||||||
NSInteger sequence_number);
|
NSInteger sequence_number);
|
||||||
|
|||||||
@@ -77,9 +77,6 @@ gdk_macos_display_get_setting (GdkDisplay *display,
|
|||||||
const char *setting,
|
const char *setting,
|
||||||
GValue *value)
|
GValue *value)
|
||||||
{
|
{
|
||||||
if (gdk_display_get_debug_flags (display) & GDK_DEBUG_DEFAULT_SETTINGS)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
return _gdk_macos_display_get_setting (GDK_MACOS_DISPLAY (display), setting, value);
|
return _gdk_macos_display_get_setting (GDK_MACOS_DISPLAY (display), setting, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -994,41 +991,17 @@ _gdk_macos_display_warp_pointer (GdkMacosDisplay *self,
|
|||||||
CGWarpMouseCursorPosition ((CGPoint) { x, y });
|
CGWarpMouseCursorPosition ((CGPoint) { x, y });
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find the matching `NSEvent` for an `GdkEvent`. This function
|
|
||||||
* return the `NSEvent`, also for rewritten `GdkEvent`'s.
|
|
||||||
*/
|
|
||||||
NSEvent *
|
NSEvent *
|
||||||
_gdk_macos_display_get_matching_nsevent (GdkEvent *event)
|
_gdk_macos_display_get_nsevent (GdkEvent *event)
|
||||||
{
|
{
|
||||||
for (GList *iter = event_map.head; iter; iter = iter->next)
|
for (const GList *iter = event_map.head; iter; iter = iter->next)
|
||||||
{
|
{
|
||||||
GdkToNSEventMap *map = iter->data;
|
const GdkToNSEventMap *map = iter->data;
|
||||||
|
|
||||||
if (map->gdk_event->event_type == event->event_type &&
|
if (map->gdk_event->event_type == event->event_type &&
|
||||||
map->gdk_event->device == event->device &&
|
map->gdk_event->device == event->device &&
|
||||||
map->gdk_event->time == event->time)
|
map->gdk_event->time == event->time)
|
||||||
{
|
return map->nsevent;
|
||||||
return map->nsevent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Find the matching `NSEvent` for the original `GdkEvent`.
|
|
||||||
* If an event was rewritten, it returns `NULL`.
|
|
||||||
*/
|
|
||||||
NSEvent *
|
|
||||||
_gdk_macos_display_get_exact_nsevent (GdkEvent *event)
|
|
||||||
{
|
|
||||||
for (GList *iter = event_map.head; iter; iter = iter->next)
|
|
||||||
{
|
|
||||||
GdkToNSEventMap *map = iter->data;
|
|
||||||
|
|
||||||
if (map->gdk_event == event)
|
|
||||||
{
|
|
||||||
return map->nsevent;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -738,7 +738,7 @@ gdk_macos_event_source_dispatch (GSource *source,
|
|||||||
|
|
||||||
if (!handled)
|
if (!handled)
|
||||||
{
|
{
|
||||||
NSEvent *nsevent = _gdk_macos_display_get_exact_nsevent (event);
|
NSEvent *nsevent = _gdk_macos_display_get_nsevent (event);
|
||||||
if (nsevent != NULL)
|
if (nsevent != NULL)
|
||||||
[NSApp sendEvent: nsevent];
|
[NSApp sendEvent: nsevent];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ gdk_macos_deps = [
|
|||||||
libgdk_c_args += ['-xobjective-c']
|
libgdk_c_args += ['-xobjective-c']
|
||||||
|
|
||||||
libgdk_macos = static_library('gdk-macos',
|
libgdk_macos = static_library('gdk-macos',
|
||||||
sources: [ gdk_macos_sources, gdk_gen_headers ],
|
gdk_macos_sources, gdkconfig, gdkenum_h,
|
||||||
include_directories: [ confinc, gdkinc, ],
|
include_directories: [ confinc, gdkinc, ],
|
||||||
c_args: [ libgdk_c_args, common_cflags, ],
|
c_args: [ libgdk_c_args, common_cflags, ],
|
||||||
link_with: [],
|
link_with: [],
|
||||||
|
|||||||
@@ -202,13 +202,7 @@ gdkwayland_inc = include_directories('wayland')
|
|||||||
wlinc = include_directories('.')
|
wlinc = include_directories('.')
|
||||||
win32rcinc = include_directories('win32/rc')
|
win32rcinc = include_directories('win32/rc')
|
||||||
|
|
||||||
gdk_gen_headers = [
|
gdk_gen_headers = [gdkenum_h, gdkmarshal_h, gdkconfig, gdkversionmacros_h, gdk_visibility_h]
|
||||||
gdkenum_h,
|
|
||||||
gdkmarshal_h,
|
|
||||||
gdkconfig,
|
|
||||||
gdkversionmacros_h,
|
|
||||||
gdk_visibility_h,
|
|
||||||
]
|
|
||||||
|
|
||||||
gdk_deps = [
|
gdk_deps = [
|
||||||
libm,
|
libm,
|
||||||
@@ -284,7 +278,7 @@ if gdk_backends.length() == 0
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
libgdk = static_library('gdk',
|
libgdk = static_library('gdk',
|
||||||
sources: [gdk_sources, gdk_backends_gen_headers, gdk_gen_headers],
|
sources: [gdk_sources, gdk_backends_gen_headers, gdkconfig],
|
||||||
dependencies: gdk_deps + [libgtk_css_dep],
|
dependencies: gdk_deps + [libgtk_css_dep],
|
||||||
link_with: [libgtk_css],
|
link_with: [libgtk_css],
|
||||||
include_directories: [confinc, gdkx11_inc, wlinc],
|
include_directories: [confinc, gdkx11_inc, wlinc],
|
||||||
@@ -296,7 +290,7 @@ libgdk = static_library('gdk',
|
|||||||
# list the dependencies and generated headers and such, for use in the
|
# list the dependencies and generated headers and such, for use in the
|
||||||
# "public" libgtk_dep used by internal executables.
|
# "public" libgtk_dep used by internal executables.
|
||||||
libgdk_dep = declare_dependency(
|
libgdk_dep = declare_dependency(
|
||||||
sources: ['gdk.h', gdk_gen_headers],
|
sources: ['gdk.h', gdkconfig, gdkenum_h],
|
||||||
include_directories: [confinc, gdkx11_inc, wlinc],
|
include_directories: [confinc, gdkx11_inc, wlinc],
|
||||||
dependencies: gdk_deps + [libgtk_css_dep],
|
dependencies: gdk_deps + [libgtk_css_dep],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -198,8 +198,17 @@ static void
|
|||||||
gdk_wayland_cairo_context_empty_frame (GdkDrawContext *draw_context)
|
gdk_wayland_cairo_context_empty_frame (GdkDrawContext *draw_context)
|
||||||
{
|
{
|
||||||
GdkSurface *surface = gdk_draw_context_get_surface (draw_context);
|
GdkSurface *surface = gdk_draw_context_get_surface (draw_context);
|
||||||
|
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||||
|
|
||||||
gdk_wayland_surface_handle_empty_frame (surface);
|
if (!impl->has_pending_subsurface_commits)
|
||||||
|
return;
|
||||||
|
|
||||||
|
gdk_wayland_surface_sync (surface);
|
||||||
|
gdk_wayland_surface_request_frame (surface);
|
||||||
|
|
||||||
|
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
|
||||||
|
gdk_wayland_surface_commit (surface);
|
||||||
|
gdk_wayland_surface_notify_committed (surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -35,6 +35,10 @@
|
|||||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||||
#include "cursor/wayland-cursor.h"
|
#include "cursor/wayland-cursor.h"
|
||||||
|
|
||||||
|
#include "gtk/gtksnapshot.h"
|
||||||
|
#include "gsk/gskrenderer.h"
|
||||||
|
#include "gsk/gskrendernodeprivate.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_wayland_cursor_remove_from_cache (gpointer data, GObject *cursor)
|
gdk_wayland_cursor_remove_from_cache (gpointer data, GObject *cursor)
|
||||||
{
|
{
|
||||||
@@ -79,7 +83,6 @@ static const struct {
|
|||||||
{ "move", "dnd-move" },
|
{ "move", "dnd-move" },
|
||||||
{ "no-drop", "dnd-none" },
|
{ "no-drop", "dnd-none" },
|
||||||
{ "dnd-ask", "dnd-copy" }, /* not CSS, but we want to guarantee it anyway */
|
{ "dnd-ask", "dnd-copy" }, /* not CSS, but we want to guarantee it anyway */
|
||||||
{ "dnd-move", "default" },
|
|
||||||
{ "not-allowed", "crossed_circle" },
|
{ "not-allowed", "crossed_circle" },
|
||||||
{ "grab", "hand2" },
|
{ "grab", "hand2" },
|
||||||
{ "grabbing", "hand2" },
|
{ "grabbing", "hand2" },
|
||||||
@@ -166,6 +169,7 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
|
|||||||
{
|
{
|
||||||
GdkTexture *texture;
|
GdkTexture *texture;
|
||||||
int desired_scale_factor;
|
int desired_scale_factor;
|
||||||
|
gboolean can_cache = TRUE;
|
||||||
|
|
||||||
desired_scale_factor = (int) ceil (desired_scale);
|
desired_scale_factor = (int) ceil (desired_scale);
|
||||||
|
|
||||||
@@ -217,13 +221,23 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
|
|||||||
}
|
}
|
||||||
else if (gdk_cursor_get_texture (cursor))
|
else if (gdk_cursor_get_texture (cursor))
|
||||||
{
|
{
|
||||||
cairo_surface_t *surface;
|
cairo_surface_t *surface = NULL;
|
||||||
struct wl_buffer *buffer;
|
struct wl_buffer *buffer;
|
||||||
|
|
||||||
texture = g_object_ref (gdk_cursor_get_texture (cursor));
|
texture = g_object_ref (gdk_cursor_get_texture (cursor));
|
||||||
|
|
||||||
from_texture:
|
from_texture:
|
||||||
surface = g_hash_table_lookup (display->cursor_surface_cache, cursor);
|
*width = gdk_texture_get_width (texture);
|
||||||
|
*height = gdk_texture_get_height (texture);
|
||||||
|
*scale = 1;
|
||||||
|
|
||||||
|
from_texture2:
|
||||||
|
*hotspot_x = gdk_cursor_get_hotspot_x (cursor);
|
||||||
|
*hotspot_y = gdk_cursor_get_hotspot_y (cursor);
|
||||||
|
|
||||||
|
if (can_cache)
|
||||||
|
surface = g_hash_table_lookup (display->cursor_surface_cache, cursor);
|
||||||
|
|
||||||
if (surface == NULL)
|
if (surface == NULL)
|
||||||
{
|
{
|
||||||
surface = gdk_wayland_display_create_shm_surface (display,
|
surface = gdk_wayland_display_create_shm_surface (display,
|
||||||
@@ -236,15 +250,13 @@ from_texture:
|
|||||||
cairo_image_surface_get_stride (surface));
|
cairo_image_surface_get_stride (surface));
|
||||||
cairo_surface_mark_dirty (surface);
|
cairo_surface_mark_dirty (surface);
|
||||||
|
|
||||||
g_object_weak_ref (G_OBJECT (cursor), gdk_wayland_cursor_remove_from_cache, display);
|
if (can_cache)
|
||||||
g_hash_table_insert (display->cursor_surface_cache, cursor, surface);
|
{
|
||||||
}
|
g_object_weak_ref (G_OBJECT (cursor), gdk_wayland_cursor_remove_from_cache, display);
|
||||||
|
|
||||||
*hotspot_x = gdk_cursor_get_hotspot_x (cursor);
|
g_hash_table_insert (display->cursor_surface_cache, cursor, surface);
|
||||||
*hotspot_y = gdk_cursor_get_hotspot_y (cursor);
|
}
|
||||||
*width = gdk_texture_get_width (texture);
|
}
|
||||||
*height = gdk_texture_get_height (texture);
|
|
||||||
*scale = 1;
|
|
||||||
|
|
||||||
cairo_surface_reference (surface);
|
cairo_surface_reference (surface);
|
||||||
buffer = _gdk_wayland_shm_surface_get_wl_buffer (surface);
|
buffer = _gdk_wayland_shm_surface_get_wl_buffer (surface);
|
||||||
@@ -256,41 +268,24 @@ from_texture:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
GdkPaintable *paintable;
|
||||||
|
|
||||||
|
paintable = gdk_cursor_get_paintable (cursor);
|
||||||
|
|
||||||
|
*width = gdk_paintable_get_intrinsic_width (paintable);
|
||||||
|
*height = gdk_paintable_get_intrinsic_height (paintable);
|
||||||
if (!use_viewporter)
|
if (!use_viewporter)
|
||||||
*scale = desired_scale_factor;
|
*scale = desired_scale_factor;
|
||||||
else
|
else
|
||||||
*scale = desired_scale;
|
*scale = desired_scale;
|
||||||
|
|
||||||
texture = gdk_cursor_get_texture_for_size (cursor,
|
texture = gdk_cursor_create_texture (cursor, *scale);
|
||||||
display->cursor_theme_size,
|
|
||||||
*scale,
|
|
||||||
width,
|
|
||||||
height,
|
|
||||||
hotspot_x,
|
|
||||||
hotspot_y);
|
|
||||||
|
|
||||||
if (texture)
|
can_cache = (gdk_paintable_get_flags (paintable) & GDK_PAINTABLE_STATIC_CONTENTS) != 0;
|
||||||
{
|
|
||||||
cairo_surface_t *surface;
|
|
||||||
struct wl_buffer *buffer;
|
|
||||||
|
|
||||||
surface = gdk_wayland_display_create_shm_surface (display,
|
can_cache = (gdk_paintable_get_flags (paintable) & GDK_PAINTABLE_STATIC_CONTENTS) != 0;
|
||||||
gdk_texture_get_width (texture),
|
|
||||||
gdk_texture_get_height (texture),
|
|
||||||
&GDK_FRACTIONAL_SCALE_INIT_INT (1));
|
|
||||||
|
|
||||||
gdk_texture_download (texture,
|
goto from_texture2;
|
||||||
cairo_image_surface_get_data (surface),
|
|
||||||
cairo_image_surface_get_stride (surface));
|
|
||||||
cairo_surface_mark_dirty (surface);
|
|
||||||
|
|
||||||
buffer = _gdk_wayland_shm_surface_get_wl_buffer (surface);
|
|
||||||
wl_buffer_add_listener (buffer, &buffer_listener, surface);
|
|
||||||
|
|
||||||
g_object_unref (texture);
|
|
||||||
|
|
||||||
return buffer;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gdk_cursor_get_fallback (cursor))
|
if (gdk_cursor_get_fallback (cursor))
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ struct _GdkWaylandPointerData {
|
|||||||
guint cursor_timeout_id;
|
guint cursor_timeout_id;
|
||||||
guint cursor_image_index;
|
guint cursor_image_index;
|
||||||
guint cursor_image_delay;
|
guint cursor_image_delay;
|
||||||
|
gulong cursor_invalidated_handler;
|
||||||
guint touchpad_event_sequence;
|
guint touchpad_event_sequence;
|
||||||
|
|
||||||
double current_output_scale;
|
double current_output_scale;
|
||||||
@@ -183,8 +184,6 @@ struct _GdkWaylandSeat
|
|||||||
GdkWaylandPointerData pointer_info;
|
GdkWaylandPointerData pointer_info;
|
||||||
GdkWaylandPointerData touch_info;
|
GdkWaylandPointerData touch_info;
|
||||||
|
|
||||||
uint32_t latest_touch_down_serial;
|
|
||||||
|
|
||||||
GdkModifierType key_modifiers;
|
GdkModifierType key_modifiers;
|
||||||
GdkSurface *keyboard_focus;
|
GdkSurface *keyboard_focus;
|
||||||
GdkSurface *grab_surface;
|
GdkSurface *grab_surface;
|
||||||
|
|||||||
@@ -58,11 +58,12 @@ gdk_wayland_device_set_surface_cursor (GdkDevice *device,
|
|||||||
{
|
{
|
||||||
if (!pointer->cursor_is_default)
|
if (!pointer->cursor_is_default)
|
||||||
{
|
{
|
||||||
|
gdk_wayland_seat_stop_cursor_animation (seat, pointer);
|
||||||
|
|
||||||
g_clear_object (&pointer->cursor);
|
g_clear_object (&pointer->cursor);
|
||||||
pointer->cursor = gdk_cursor_new_from_name ("default", NULL);
|
pointer->cursor = gdk_cursor_new_from_name ("default", NULL);
|
||||||
pointer->cursor_is_default = TRUE;
|
pointer->cursor_is_default = TRUE;
|
||||||
|
|
||||||
gdk_wayland_seat_stop_cursor_animation (seat, pointer);
|
|
||||||
gdk_wayland_device_update_surface_cursor (device);
|
gdk_wayland_device_update_surface_cursor (device);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -72,10 +73,11 @@ gdk_wayland_device_set_surface_cursor (GdkDevice *device,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
gdk_wayland_seat_stop_cursor_animation (seat, pointer);
|
||||||
|
|
||||||
g_set_object (&pointer->cursor, cursor);
|
g_set_object (&pointer->cursor, cursor);
|
||||||
pointer->cursor_is_default = FALSE;
|
pointer->cursor_is_default = FALSE;
|
||||||
|
|
||||||
gdk_wayland_seat_stop_cursor_animation (seat, pointer);
|
|
||||||
gdk_wayland_device_update_surface_cursor (device);
|
gdk_wayland_device_update_surface_cursor (device);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -265,20 +267,15 @@ gdk_wayland_device_update_surface_cursor (GdkDevice *device)
|
|||||||
guint next_image_index, next_image_delay;
|
guint next_image_index, next_image_delay;
|
||||||
gboolean retval = G_SOURCE_REMOVE;
|
gboolean retval = G_SOURCE_REMOVE;
|
||||||
GdkWaylandTabletData *tablet;
|
GdkWaylandTabletData *tablet;
|
||||||
gboolean use_viewport;
|
|
||||||
|
|
||||||
tablet = gdk_wayland_seat_find_tablet (seat, device);
|
tablet = gdk_wayland_seat_find_tablet (seat, device);
|
||||||
|
|
||||||
use_viewport = pointer->pointer_surface_viewport != NULL;
|
|
||||||
if (g_getenv ("NO_POINTER_VIEWPORT"))
|
|
||||||
use_viewport = FALSE;
|
|
||||||
|
|
||||||
if (pointer->cursor)
|
if (pointer->cursor)
|
||||||
{
|
{
|
||||||
buffer = _gdk_wayland_cursor_get_buffer (GDK_WAYLAND_DISPLAY (seat->display),
|
buffer = _gdk_wayland_cursor_get_buffer (GDK_WAYLAND_DISPLAY (seat->display),
|
||||||
pointer->cursor,
|
pointer->cursor,
|
||||||
pointer->current_output_scale,
|
pointer->current_output_scale,
|
||||||
use_viewport,
|
pointer->pointer_surface_viewport != NULL,
|
||||||
pointer->cursor_image_index,
|
pointer->cursor_image_index,
|
||||||
&x, &y, &w, &h, &scale);
|
&x, &y, &w, &h, &scale);
|
||||||
}
|
}
|
||||||
@@ -317,7 +314,7 @@ gdk_wayland_device_update_surface_cursor (GdkDevice *device)
|
|||||||
if (buffer)
|
if (buffer)
|
||||||
{
|
{
|
||||||
wl_surface_attach (pointer->pointer_surface, buffer, 0, 0);
|
wl_surface_attach (pointer->pointer_surface, buffer, 0, 0);
|
||||||
if (use_viewport)
|
if (pointer->pointer_surface_viewport)
|
||||||
{
|
{
|
||||||
wp_viewport_set_source (pointer->pointer_surface_viewport,
|
wp_viewport_set_source (pointer->pointer_surface_viewport,
|
||||||
wl_fixed_from_int (0),
|
wl_fixed_from_int (0),
|
||||||
@@ -337,6 +334,23 @@ gdk_wayland_device_update_surface_cursor (GdkDevice *device)
|
|||||||
wl_surface_commit (pointer->pointer_surface);
|
wl_surface_commit (pointer->pointer_surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GdkPaintable *paintable = gdk_cursor_get_paintable (pointer->cursor);
|
||||||
|
|
||||||
|
if (paintable)
|
||||||
|
{
|
||||||
|
if ((gdk_paintable_get_flags (paintable) & GDK_PAINTABLE_STATIC_CONTENTS) == 0)
|
||||||
|
{
|
||||||
|
if (pointer->cursor_invalidated_handler == 0)
|
||||||
|
{
|
||||||
|
pointer->cursor_invalidated_handler =
|
||||||
|
g_signal_connect_swapped (paintable, "invalidate-contents",
|
||||||
|
G_CALLBACK (gdk_wayland_device_update_surface_cursor), device);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return G_SOURCE_REMOVE;
|
||||||
|
}
|
||||||
|
|
||||||
next_image_index =
|
next_image_index =
|
||||||
_gdk_wayland_cursor_get_next_image_index (GDK_WAYLAND_DISPLAY (seat->display),
|
_gdk_wayland_cursor_get_next_image_index (GDK_WAYLAND_DISPLAY (seat->display),
|
||||||
pointer->cursor,
|
pointer->cursor,
|
||||||
|
|||||||
@@ -58,7 +58,6 @@
|
|||||||
#include <wayland/xdg-foreign-unstable-v2-client-protocol.h>
|
#include <wayland/xdg-foreign-unstable-v2-client-protocol.h>
|
||||||
#include <wayland/server-decoration-client-protocol.h>
|
#include <wayland/server-decoration-client-protocol.h>
|
||||||
#include "linux-dmabuf-unstable-v1-client-protocol.h"
|
#include "linux-dmabuf-unstable-v1-client-protocol.h"
|
||||||
#include "presentation-time-client-protocol.h"
|
|
||||||
|
|
||||||
#include "wm-button-layout-translation.h"
|
#include "wm-button-layout-translation.h"
|
||||||
|
|
||||||
@@ -105,9 +104,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland);
|
static void _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland);
|
||||||
static void _gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
|
|
||||||
const char *name,
|
|
||||||
int size);
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (GdkWaylandDisplay, gdk_wayland_display, GDK_TYPE_DISPLAY)
|
G_DEFINE_TYPE (GdkWaylandDisplay, gdk_wayland_display, GDK_TYPE_DISPLAY)
|
||||||
|
|
||||||
@@ -287,6 +283,93 @@ static const struct wl_shm_listener wl_shm_listener = {
|
|||||||
wl_shm_format
|
wl_shm_format
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
linux_dmabuf_done (void *data,
|
||||||
|
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1)
|
||||||
|
{
|
||||||
|
GDK_DEBUG (MISC, "dmabuf feedback done");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
linux_dmabuf_format_table (void *data,
|
||||||
|
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1,
|
||||||
|
int32_t fd,
|
||||||
|
uint32_t size)
|
||||||
|
{
|
||||||
|
GdkWaylandDisplay *display_wayland = data;
|
||||||
|
|
||||||
|
display_wayland->linux_dmabuf_n_formats = size / 16;
|
||||||
|
display_wayland->linux_dmabuf_formats = mmap (NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||||
|
|
||||||
|
GDK_DEBUG (MISC, "got dmabuf format table (%lu entries)", display_wayland->linux_dmabuf_n_formats);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
linux_dmabuf_main_device (void *data,
|
||||||
|
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1,
|
||||||
|
struct wl_array *device)
|
||||||
|
{
|
||||||
|
dev_t dev G_GNUC_UNUSED = *(dev_t *)device->data;
|
||||||
|
|
||||||
|
GDK_DEBUG (MISC, "got dmabuf main device: %u %u", major (dev), minor (dev));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
linux_dmabuf_tranche_done (void *data,
|
||||||
|
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1)
|
||||||
|
{
|
||||||
|
GDK_DEBUG (MISC, "dmabuf feedback tranche done");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
linux_dmabuf_tranche_target_device (void *data,
|
||||||
|
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1,
|
||||||
|
struct wl_array *device)
|
||||||
|
{
|
||||||
|
dev_t dev G_GNUC_UNUSED = *(dev_t *)device->data;
|
||||||
|
|
||||||
|
GDK_DEBUG (MISC, "got dmabuf tranche target device: %u %u", major (dev), minor (dev));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
linux_dmabuf_tranche_formats (void *data,
|
||||||
|
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1,
|
||||||
|
struct wl_array *indices)
|
||||||
|
{
|
||||||
|
GdkWaylandDisplay *display_wayland = data;
|
||||||
|
|
||||||
|
GDK_DEBUG (MISC, "got dmabuf tranche formats (%lu entries):", indices->size / sizeof (guint16));
|
||||||
|
guint16 *pos;
|
||||||
|
|
||||||
|
wl_array_for_each (pos, indices)
|
||||||
|
{
|
||||||
|
LinuxDmabufFormat *fmt G_GNUC_UNUSED = &display_wayland->linux_dmabuf_formats[*pos];
|
||||||
|
uint32_t f G_GNUC_UNUSED = fmt->fourcc;
|
||||||
|
uint64_t m G_GNUC_UNUSED = fmt->modifier;
|
||||||
|
GDK_DEBUG (MISC, " %.4s:%#" G_GINT64_MODIFIER "x", (char *) &f, m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
linux_dmabuf_tranche_flags (void *data,
|
||||||
|
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1,
|
||||||
|
uint32_t flags)
|
||||||
|
{
|
||||||
|
GDK_DEBUG (MISC,
|
||||||
|
"got dmabuf tranche flags: %s",
|
||||||
|
flags & ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_SCANOUT ? "scanout" : "");
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct zwp_linux_dmabuf_feedback_v1_listener linux_dmabuf_feedback_listener = {
|
||||||
|
linux_dmabuf_done,
|
||||||
|
linux_dmabuf_format_table,
|
||||||
|
linux_dmabuf_main_device,
|
||||||
|
linux_dmabuf_tranche_done,
|
||||||
|
linux_dmabuf_tranche_target_device,
|
||||||
|
linux_dmabuf_tranche_formats,
|
||||||
|
linux_dmabuf_tranche_flags,
|
||||||
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
server_decoration_manager_default_mode (void *data,
|
server_decoration_manager_default_mode (void *data,
|
||||||
struct org_kde_kwin_server_decoration_manager *manager,
|
struct org_kde_kwin_server_decoration_manager *manager,
|
||||||
@@ -353,7 +436,7 @@ gdk_registry_handle_global (void *data,
|
|||||||
{
|
{
|
||||||
display_wayland->compositor =
|
display_wayland->compositor =
|
||||||
wl_registry_bind (display_wayland->wl_registry, id,
|
wl_registry_bind (display_wayland->wl_registry, id,
|
||||||
&wl_compositor_interface, MIN (version, 6));
|
&wl_compositor_interface, MIN (version, 5));
|
||||||
}
|
}
|
||||||
else if (strcmp (interface, "wl_shm") == 0)
|
else if (strcmp (interface, "wl_shm") == 0)
|
||||||
{
|
{
|
||||||
@@ -363,14 +446,12 @@ gdk_registry_handle_global (void *data,
|
|||||||
}
|
}
|
||||||
else if (strcmp (interface, "zwp_linux_dmabuf_v1") == 0 && version >= 4)
|
else if (strcmp (interface, "zwp_linux_dmabuf_v1") == 0 && version >= 4)
|
||||||
{
|
{
|
||||||
struct zwp_linux_dmabuf_feedback_v1 *feedback;
|
|
||||||
|
|
||||||
display_wayland->linux_dmabuf =
|
display_wayland->linux_dmabuf =
|
||||||
wl_registry_bind (display_wayland->wl_registry, id, &zwp_linux_dmabuf_v1_interface, version);
|
wl_registry_bind (display_wayland->wl_registry, id, &zwp_linux_dmabuf_v1_interface, version);
|
||||||
feedback = zwp_linux_dmabuf_v1_get_default_feedback (display_wayland->linux_dmabuf);
|
display_wayland->linux_dmabuf_feedback =
|
||||||
display_wayland->dmabuf_formats_info = dmabuf_formats_info_new (GDK_DISPLAY (display_wayland),
|
zwp_linux_dmabuf_v1_get_default_feedback (display_wayland->linux_dmabuf);
|
||||||
"default",
|
zwp_linux_dmabuf_feedback_v1_add_listener (display_wayland->linux_dmabuf_feedback,
|
||||||
feedback);
|
&linux_dmabuf_feedback_listener, display_wayland);
|
||||||
_gdk_wayland_display_async_roundtrip (display_wayland);
|
_gdk_wayland_display_async_roundtrip (display_wayland);
|
||||||
}
|
}
|
||||||
else if (strcmp (interface, "xdg_wm_base") == 0)
|
else if (strcmp (interface, "xdg_wm_base") == 0)
|
||||||
@@ -517,20 +598,7 @@ gdk_registry_handle_global (void *data,
|
|||||||
wl_registry_bind (display_wayland->wl_registry, id,
|
wl_registry_bind (display_wayland->wl_registry, id,
|
||||||
&wp_viewporter_interface, 1);
|
&wp_viewporter_interface, 1);
|
||||||
}
|
}
|
||||||
else if (strcmp (interface, "wp_presentation") == 0)
|
|
||||||
{
|
|
||||||
display_wayland->presentation =
|
|
||||||
wl_registry_bind (display_wayland->wl_registry, id,
|
|
||||||
&wp_presentation_interface,
|
|
||||||
MIN (version, 1));
|
|
||||||
}
|
|
||||||
else if (strcmp (interface, wp_single_pixel_buffer_manager_v1_interface.name) == 0)
|
|
||||||
{
|
|
||||||
display_wayland->single_pixel_buffer =
|
|
||||||
wl_registry_bind (display_wayland->wl_registry, id,
|
|
||||||
&wp_single_pixel_buffer_manager_v1_interface,
|
|
||||||
MIN (version, 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
g_hash_table_insert (display_wayland->known_globals,
|
g_hash_table_insert (display_wayland->known_globals,
|
||||||
GUINT_TO_POINTER (id), g_strdup (interface));
|
GUINT_TO_POINTER (id), g_strdup (interface));
|
||||||
@@ -740,10 +808,10 @@ gdk_wayland_display_dispose (GObject *object)
|
|||||||
g_clear_pointer (&display_wayland->xdg_activation, xdg_activation_v1_destroy);
|
g_clear_pointer (&display_wayland->xdg_activation, xdg_activation_v1_destroy);
|
||||||
g_clear_pointer (&display_wayland->fractional_scale, wp_fractional_scale_manager_v1_destroy);
|
g_clear_pointer (&display_wayland->fractional_scale, wp_fractional_scale_manager_v1_destroy);
|
||||||
g_clear_pointer (&display_wayland->viewporter, wp_viewporter_destroy);
|
g_clear_pointer (&display_wayland->viewporter, wp_viewporter_destroy);
|
||||||
g_clear_pointer (&display_wayland->presentation, wp_presentation_destroy);
|
|
||||||
g_clear_pointer (&display_wayland->single_pixel_buffer, wp_single_pixel_buffer_manager_v1_destroy);
|
|
||||||
g_clear_pointer (&display_wayland->linux_dmabuf, zwp_linux_dmabuf_v1_destroy);
|
g_clear_pointer (&display_wayland->linux_dmabuf, zwp_linux_dmabuf_v1_destroy);
|
||||||
g_clear_pointer (&display_wayland->dmabuf_formats_info, dmabuf_formats_info_free);
|
g_clear_pointer (&display_wayland->linux_dmabuf_feedback, zwp_linux_dmabuf_feedback_v1_destroy);
|
||||||
|
if (display_wayland->linux_dmabuf_formats)
|
||||||
|
munmap (display_wayland->linux_dmabuf_formats, display_wayland->linux_dmabuf_n_formats * 16);
|
||||||
|
|
||||||
g_clear_pointer (&display_wayland->shm, wl_shm_destroy);
|
g_clear_pointer (&display_wayland->shm, wl_shm_destroy);
|
||||||
g_clear_pointer (&display_wayland->wl_registry, wl_registry_destroy);
|
g_clear_pointer (&display_wayland->wl_registry, wl_registry_destroy);
|
||||||
@@ -1045,7 +1113,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
|
|||||||
display_class->get_monitors = gdk_wayland_display_get_monitors;
|
display_class->get_monitors = gdk_wayland_display_get_monitors;
|
||||||
display_class->get_monitor_at_surface = gdk_wayland_display_get_monitor_at_surface;
|
display_class->get_monitor_at_surface = gdk_wayland_display_get_monitor_at_surface;
|
||||||
display_class->get_setting = gdk_wayland_display_get_setting;
|
display_class->get_setting = gdk_wayland_display_get_setting;
|
||||||
display_class->set_cursor_theme = _gdk_wayland_display_set_cursor_theme;
|
display_class->set_cursor_theme = gdk_wayland_display_set_cursor_theme;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1118,22 +1186,11 @@ get_cursor_theme (GdkWaylandDisplay *display_wayland,
|
|||||||
* @size: the size to use for cursors
|
* @size: the size to use for cursors
|
||||||
*
|
*
|
||||||
* Sets the cursor theme for the given @display.
|
* Sets the cursor theme for the given @display.
|
||||||
*
|
|
||||||
* Deprecated: 4.16: Use the cursor-related properties of
|
|
||||||
* [GtkSettings](../gtk4/class.Settings.html) to set the cursor theme
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
|
gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
|
||||||
const char *name,
|
const char *name,
|
||||||
int size)
|
int size)
|
||||||
{
|
|
||||||
_gdk_wayland_display_set_cursor_theme (display, name, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
|
|
||||||
const char *name,
|
|
||||||
int size)
|
|
||||||
{
|
{
|
||||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY(display);
|
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY(display);
|
||||||
struct wl_cursor_theme *theme;
|
struct wl_cursor_theme *theme;
|
||||||
@@ -1202,7 +1259,7 @@ _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland)
|
|||||||
else
|
else
|
||||||
name = "default";
|
name = "default";
|
||||||
|
|
||||||
_gdk_wayland_display_set_cursor_theme (GDK_DISPLAY (display_wayland), name, size);
|
gdk_wayland_display_set_cursor_theme (GDK_DISPLAY (display_wayland), name, size);
|
||||||
g_value_unset (&v);
|
g_value_unset (&v);
|
||||||
|
|
||||||
gdk_profiler_end_mark (before, "Wayland cursor theme load", NULL);
|
gdk_profiler_end_mark (before, "Wayland cursor theme load", NULL);
|
||||||
@@ -1738,7 +1795,6 @@ static TranslationEntry translations[] = {
|
|||||||
{ FALSE, "org.gnome.desktop.interface", "font-hinting", "gtk-xft-hinting", G_TYPE_NONE, { .i = 1 } },
|
{ FALSE, "org.gnome.desktop.interface", "font-hinting", "gtk-xft-hinting", G_TYPE_NONE, { .i = 1 } },
|
||||||
{ FALSE, "org.gnome.desktop.interface", "font-hinting", "gtk-xft-hintstyle", G_TYPE_NONE, { .i = 1 } },
|
{ FALSE, "org.gnome.desktop.interface", "font-hinting", "gtk-xft-hintstyle", G_TYPE_NONE, { .i = 1 } },
|
||||||
{ FALSE, "org.gnome.desktop.interface", "font-rgba-order", "gtk-xft-rgba", G_TYPE_NONE, { .i = 0 } },
|
{ FALSE, "org.gnome.desktop.interface", "font-rgba-order", "gtk-xft-rgba", G_TYPE_NONE, { .i = 0 } },
|
||||||
{ FALSE, "org.gnome.desktop.interface", "font-rendering", "gtk-font-rendering", G_TYPE_ENUM, { .i = 0 } },
|
|
||||||
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "antialiasing", "gtk-xft-antialias", G_TYPE_NONE, { .i = 1 } },
|
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "antialiasing", "gtk-xft-antialias", G_TYPE_NONE, { .i = 1 } },
|
||||||
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "hinting", "gtk-xft-hinting", G_TYPE_NONE, { .i = 1 } },
|
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "hinting", "gtk-xft-hinting", G_TYPE_NONE, { .i = 1 } },
|
||||||
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "hinting", "gtk-xft-hintstyle", G_TYPE_NONE, { .i = 1 } },
|
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "hinting", "gtk-xft-hintstyle", G_TYPE_NONE, { .i = 1 } },
|
||||||
@@ -1830,7 +1886,6 @@ apply_portal_setting (TranslationEntry *entry,
|
|||||||
entry->fallback.s = g_intern_string (g_variant_get_string (value, NULL));
|
entry->fallback.s = g_intern_string (g_variant_get_string (value, NULL));
|
||||||
break;
|
break;
|
||||||
case G_TYPE_INT:
|
case G_TYPE_INT:
|
||||||
case G_TYPE_ENUM:
|
|
||||||
entry->fallback.i = g_variant_get_int32 (value);
|
entry->fallback.i = g_variant_get_int32 (value);
|
||||||
break;
|
break;
|
||||||
case G_TYPE_BOOLEAN:
|
case G_TYPE_BOOLEAN:
|
||||||
@@ -1950,10 +2005,9 @@ init_settings (GdkDisplay *display)
|
|||||||
|
|
||||||
g_variant_get (ret, "(a{sa{sv}})", &iter);
|
g_variant_get (ret, "(a{sa{sv}})", &iter);
|
||||||
|
|
||||||
if (g_variant_iter_n_children (iter) == 0)
|
if (g_variant_n_children (ret) == 0)
|
||||||
{
|
{
|
||||||
g_debug ("Received no portal settings");
|
g_debug ("Received no portal settings");
|
||||||
g_clear_pointer (&iter, g_variant_iter_free);
|
|
||||||
g_clear_pointer (&ret, g_variant_unref);
|
g_clear_pointer (&ret, g_variant_unref);
|
||||||
|
|
||||||
goto fallback;
|
goto fallback;
|
||||||
@@ -2080,9 +2134,6 @@ set_value_from_entry (GdkDisplay *display,
|
|||||||
case G_TYPE_BOOLEAN:
|
case G_TYPE_BOOLEAN:
|
||||||
g_value_set_boolean (value, entry->fallback.b);
|
g_value_set_boolean (value, entry->fallback.b);
|
||||||
break;
|
break;
|
||||||
case G_TYPE_ENUM:
|
|
||||||
g_value_set_enum (value, entry->fallback.i);
|
|
||||||
break;
|
|
||||||
case G_TYPE_NONE:
|
case G_TYPE_NONE:
|
||||||
if (g_str_equal (entry->setting, "gtk-fontconfig-timestamp"))
|
if (g_str_equal (entry->setting, "gtk-fontconfig-timestamp"))
|
||||||
g_value_set_uint (value, (guint)entry->fallback.i);
|
g_value_set_uint (value, (guint)entry->fallback.i);
|
||||||
@@ -2133,11 +2184,6 @@ set_value_from_entry (GdkDisplay *display,
|
|||||||
? g_settings_get_boolean (settings, entry->key)
|
? g_settings_get_boolean (settings, entry->key)
|
||||||
: entry->fallback.b);
|
: entry->fallback.b);
|
||||||
break;
|
break;
|
||||||
case G_TYPE_ENUM:
|
|
||||||
g_value_set_enum (value, settings && entry->valid
|
|
||||||
? g_settings_get_enum (settings, entry->key)
|
|
||||||
: entry->fallback.i);
|
|
||||||
break;
|
|
||||||
case G_TYPE_NONE:
|
case G_TYPE_NONE:
|
||||||
if (g_str_equal (entry->setting, "gtk-fontconfig-timestamp"))
|
if (g_str_equal (entry->setting, "gtk-fontconfig-timestamp"))
|
||||||
g_value_set_uint (value, (guint)entry->fallback.i);
|
g_value_set_uint (value, (guint)entry->fallback.i);
|
||||||
|
|||||||
@@ -39,8 +39,6 @@
|
|||||||
#include <gdk/wayland/xdg-activation-v1-client-protocol.h>
|
#include <gdk/wayland/xdg-activation-v1-client-protocol.h>
|
||||||
#include <gdk/wayland/fractional-scale-v1-client-protocol.h>
|
#include <gdk/wayland/fractional-scale-v1-client-protocol.h>
|
||||||
#include <gdk/wayland/viewporter-client-protocol.h>
|
#include <gdk/wayland/viewporter-client-protocol.h>
|
||||||
#include <gdk/wayland/presentation-time-client-protocol.h>
|
|
||||||
#include <gdk/wayland/single-pixel-buffer-v1-client-protocol.h>
|
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <gdk/gdkkeys.h>
|
#include <gdk/gdkkeys.h>
|
||||||
@@ -49,7 +47,6 @@
|
|||||||
|
|
||||||
#include "gdkdisplayprivate.h"
|
#include "gdkdisplayprivate.h"
|
||||||
#include "gdkwaylanddevice.h"
|
#include "gdkwaylanddevice.h"
|
||||||
#include "gdkdmabuf-wayland-private.h"
|
|
||||||
#include "cursor/wayland-cursor.h"
|
#include "cursor/wayland-cursor.h"
|
||||||
|
|
||||||
#include <epoxy/egl.h>
|
#include <epoxy/egl.h>
|
||||||
@@ -74,6 +71,13 @@ typedef enum _GdkWaylandShellVariant
|
|||||||
GDK_WAYLAND_SHELL_VARIANT_ZXDG_SHELL_V6
|
GDK_WAYLAND_SHELL_VARIANT_ZXDG_SHELL_V6
|
||||||
} GdkWaylandShellVariant;
|
} GdkWaylandShellVariant;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint32_t fourcc;
|
||||||
|
uint32_t padding;
|
||||||
|
uint64_t modifier;
|
||||||
|
} LinuxDmabufFormat;
|
||||||
|
|
||||||
struct _GdkWaylandDisplay
|
struct _GdkWaylandDisplay
|
||||||
{
|
{
|
||||||
GdkDisplay parent_instance;
|
GdkDisplay parent_instance;
|
||||||
@@ -99,7 +103,9 @@ struct _GdkWaylandDisplay
|
|||||||
struct wl_compositor *compositor;
|
struct wl_compositor *compositor;
|
||||||
struct wl_shm *shm;
|
struct wl_shm *shm;
|
||||||
struct zwp_linux_dmabuf_v1 *linux_dmabuf;
|
struct zwp_linux_dmabuf_v1 *linux_dmabuf;
|
||||||
DmabufFormatsInfo *dmabuf_formats_info;
|
struct zwp_linux_dmabuf_feedback_v1 *linux_dmabuf_feedback;
|
||||||
|
gsize linux_dmabuf_n_formats;
|
||||||
|
LinuxDmabufFormat *linux_dmabuf_formats;
|
||||||
struct xdg_wm_base *xdg_wm_base;
|
struct xdg_wm_base *xdg_wm_base;
|
||||||
struct zxdg_shell_v6 *zxdg_shell_v6;
|
struct zxdg_shell_v6 *zxdg_shell_v6;
|
||||||
struct gtk_shell1 *gtk_shell;
|
struct gtk_shell1 *gtk_shell;
|
||||||
@@ -119,8 +125,6 @@ struct _GdkWaylandDisplay
|
|||||||
struct xdg_activation_v1 *xdg_activation;
|
struct xdg_activation_v1 *xdg_activation;
|
||||||
struct wp_fractional_scale_manager_v1 *fractional_scale;
|
struct wp_fractional_scale_manager_v1 *fractional_scale;
|
||||||
struct wp_viewporter *viewporter;
|
struct wp_viewporter *viewporter;
|
||||||
struct wp_presentation *presentation;
|
|
||||||
struct wp_single_pixel_buffer_manager_v1 *single_pixel_buffer;
|
|
||||||
|
|
||||||
GList *async_roundtrips;
|
GList *async_roundtrips;
|
||||||
|
|
||||||
|
|||||||
@@ -1,77 +0,0 @@
|
|||||||
/*
|
|
||||||
* gdkdmabuf-wayland.h
|
|
||||||
*
|
|
||||||
* Copyright 2023 Red Hat, Inc.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Library General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Library General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Library General Public
|
|
||||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <wayland-client.h>
|
|
||||||
#include <wayland-egl.h>
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
#include <gdk/gdkkeys.h>
|
|
||||||
#include <gdk/gdksurface.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint32_t fourcc;
|
|
||||||
uint32_t padding;
|
|
||||||
uint64_t modifier;
|
|
||||||
} DmabufFormat;
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
dev_t target_device;
|
|
||||||
guint32 flags;
|
|
||||||
gsize n_formats;
|
|
||||||
DmabufFormat *formats;
|
|
||||||
} DmabufTranche;
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
dev_t main_device;
|
|
||||||
GPtrArray *tranches;
|
|
||||||
} DmabufFormats;
|
|
||||||
|
|
||||||
typedef struct DmabufFormatsInfo DmabufFormatsInfo;
|
|
||||||
|
|
||||||
struct DmabufFormatsInfo
|
|
||||||
{
|
|
||||||
GdkDisplay *display;
|
|
||||||
char *name;
|
|
||||||
struct zwp_linux_dmabuf_feedback_v1 *feedback;
|
|
||||||
|
|
||||||
gsize n_dmabuf_formats;
|
|
||||||
DmabufFormat *dmabuf_format_table;
|
|
||||||
|
|
||||||
DmabufFormats *dmabuf_formats;
|
|
||||||
DmabufFormats *pending_dmabuf_formats;
|
|
||||||
DmabufTranche *pending_tranche;
|
|
||||||
};
|
|
||||||
|
|
||||||
DmabufFormatsInfo * dmabuf_formats_info_new (GdkDisplay *display,
|
|
||||||
const char *name,
|
|
||||||
struct zwp_linux_dmabuf_feedback_v1 *feedback);
|
|
||||||
|
|
||||||
void dmabuf_formats_info_free (DmabufFormatsInfo *info);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
@@ -1,241 +0,0 @@
|
|||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include "gdkdmabuf-wayland-private.h"
|
|
||||||
|
|
||||||
#include "gdkdebugprivate.h"
|
|
||||||
#include "gdkdmabufformatsprivate.h"
|
|
||||||
#include "gdkdmabufformatsbuilderprivate.h"
|
|
||||||
#include "gdkdmabufformatsprivate.h"
|
|
||||||
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <sys/mman.h>
|
|
||||||
#include <sys/sysmacros.h>
|
|
||||||
|
|
||||||
#include "linux-dmabuf-unstable-v1-client-protocol.h"
|
|
||||||
|
|
||||||
|
|
||||||
static DmabufTranche *
|
|
||||||
dmabuf_tranche_new (void)
|
|
||||||
{
|
|
||||||
return g_new0 (DmabufTranche, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
dmabuf_tranche_free (DmabufTranche *tranche)
|
|
||||||
{
|
|
||||||
g_free (tranche->formats);
|
|
||||||
g_free (tranche);
|
|
||||||
}
|
|
||||||
|
|
||||||
static DmabufFormats *
|
|
||||||
dmabuf_formats_new (void)
|
|
||||||
{
|
|
||||||
DmabufFormats *formats;
|
|
||||||
|
|
||||||
formats = g_new0 (DmabufFormats, 1);
|
|
||||||
formats->tranches = g_ptr_array_new_with_free_func ((GDestroyNotify) dmabuf_tranche_free);
|
|
||||||
|
|
||||||
return formats;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
dmabuf_formats_free (DmabufFormats *formats)
|
|
||||||
{
|
|
||||||
g_ptr_array_unref (formats->tranches);
|
|
||||||
g_free (formats);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
update_dmabuf_formats (DmabufFormatsInfo *info)
|
|
||||||
{
|
|
||||||
DmabufFormats *formats = info->dmabuf_formats;
|
|
||||||
|
|
||||||
GDK_DISPLAY_DEBUG (info->display, MISC,
|
|
||||||
"dmabuf format table (%lu entries)", info->n_dmabuf_formats);
|
|
||||||
GDK_DISPLAY_DEBUG (info->display, MISC,
|
|
||||||
"dmabuf main device: %u %u",
|
|
||||||
major (formats->main_device),
|
|
||||||
minor (formats->main_device));
|
|
||||||
|
|
||||||
for (gsize i = 0; i < formats->tranches->len; i++)
|
|
||||||
{
|
|
||||||
DmabufTranche *tranche = g_ptr_array_index (formats->tranches, i);
|
|
||||||
|
|
||||||
GDK_DISPLAY_DEBUG (info->display, MISC,
|
|
||||||
"dmabuf tranche target device: %u %u",
|
|
||||||
major (tranche->target_device),
|
|
||||||
minor (tranche->target_device));
|
|
||||||
|
|
||||||
GDK_DISPLAY_DEBUG (info->display, MISC,
|
|
||||||
"dmabuf%s tranche (%lu entries):",
|
|
||||||
tranche->flags & ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_SCANOUT ? " scanout" : "",
|
|
||||||
tranche->n_formats);
|
|
||||||
|
|
||||||
for (gsize j = 0; j < tranche->n_formats; j++)
|
|
||||||
{
|
|
||||||
GDK_DISPLAY_DEBUG (info->display, MISC,
|
|
||||||
" %.4s:%#" G_GINT64_MODIFIER "x",
|
|
||||||
(char *) &(tranche->formats[j].fourcc),
|
|
||||||
tranche->formats[j].modifier);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
linux_dmabuf_done (void *data,
|
|
||||||
struct zwp_linux_dmabuf_feedback_v1 *feedback)
|
|
||||||
{
|
|
||||||
DmabufFormatsInfo *info = data;
|
|
||||||
|
|
||||||
g_clear_pointer (&info->dmabuf_formats, dmabuf_formats_free);
|
|
||||||
|
|
||||||
info->dmabuf_formats = info->pending_dmabuf_formats;
|
|
||||||
info->pending_dmabuf_formats = NULL;
|
|
||||||
|
|
||||||
update_dmabuf_formats (info);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
linux_dmabuf_format_table (void *data,
|
|
||||||
struct zwp_linux_dmabuf_feedback_v1 *feedback,
|
|
||||||
int32_t fd,
|
|
||||||
uint32_t size)
|
|
||||||
{
|
|
||||||
DmabufFormatsInfo *info = data;
|
|
||||||
|
|
||||||
if (info->dmabuf_formats)
|
|
||||||
munmap (info->dmabuf_formats, sizeof (DmabufFormat) * info->n_dmabuf_formats);
|
|
||||||
|
|
||||||
info->n_dmabuf_formats = size / 16;
|
|
||||||
info->dmabuf_format_table = mmap (NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
linux_dmabuf_main_device (void *data,
|
|
||||||
struct zwp_linux_dmabuf_feedback_v1 *feedback,
|
|
||||||
struct wl_array *device)
|
|
||||||
{
|
|
||||||
DmabufFormatsInfo *info = data;
|
|
||||||
dev_t dev;
|
|
||||||
|
|
||||||
memcpy (&dev, device->data, sizeof (dev_t));
|
|
||||||
|
|
||||||
g_assert (info->pending_dmabuf_formats == NULL);
|
|
||||||
|
|
||||||
info->pending_dmabuf_formats = dmabuf_formats_new ();
|
|
||||||
info->pending_dmabuf_formats->main_device = dev;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
linux_dmabuf_tranche_done (void *data,
|
|
||||||
struct zwp_linux_dmabuf_feedback_v1 *feedback)
|
|
||||||
{
|
|
||||||
DmabufFormatsInfo *info = data;
|
|
||||||
|
|
||||||
g_ptr_array_add (info->pending_dmabuf_formats->tranches,
|
|
||||||
info->pending_tranche);
|
|
||||||
|
|
||||||
info->pending_tranche = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
linux_dmabuf_tranche_target_device (void *data,
|
|
||||||
struct zwp_linux_dmabuf_feedback_v1 *feedback,
|
|
||||||
struct wl_array *device)
|
|
||||||
{
|
|
||||||
DmabufFormatsInfo *info = data;
|
|
||||||
dev_t dev;
|
|
||||||
DmabufTranche *tranche;
|
|
||||||
|
|
||||||
memcpy (&dev, device->data, sizeof (dev_t));
|
|
||||||
|
|
||||||
g_assert (info->pending_tranche == NULL);
|
|
||||||
|
|
||||||
tranche = dmabuf_tranche_new ();
|
|
||||||
tranche->target_device = dev;
|
|
||||||
|
|
||||||
info->pending_tranche = tranche;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
linux_dmabuf_tranche_formats (void *data,
|
|
||||||
struct zwp_linux_dmabuf_feedback_v1 *feedback,
|
|
||||||
struct wl_array *indices)
|
|
||||||
{
|
|
||||||
DmabufFormatsInfo *info = data;
|
|
||||||
DmabufTranche *tranche;
|
|
||||||
int i;
|
|
||||||
guint16 *pos;
|
|
||||||
|
|
||||||
g_assert (info->pending_tranche != NULL);
|
|
||||||
tranche = info->pending_tranche;
|
|
||||||
|
|
||||||
tranche->n_formats = indices->size / sizeof (guint16);
|
|
||||||
tranche->formats = g_new (DmabufFormat, tranche->n_formats);
|
|
||||||
|
|
||||||
i = 0;
|
|
||||||
wl_array_for_each (pos, indices)
|
|
||||||
{
|
|
||||||
tranche->formats[i++] = info->dmabuf_format_table[*pos];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
linux_dmabuf_tranche_flags (void *data,
|
|
||||||
struct zwp_linux_dmabuf_feedback_v1 *feedback,
|
|
||||||
uint32_t flags)
|
|
||||||
{
|
|
||||||
DmabufFormatsInfo *info = data;
|
|
||||||
DmabufTranche *tranche;
|
|
||||||
|
|
||||||
g_assert (info->pending_tranche != NULL);
|
|
||||||
tranche = info->pending_tranche;
|
|
||||||
tranche->flags = flags;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct zwp_linux_dmabuf_feedback_v1_listener feedback_listener = {
|
|
||||||
linux_dmabuf_done,
|
|
||||||
linux_dmabuf_format_table,
|
|
||||||
linux_dmabuf_main_device,
|
|
||||||
linux_dmabuf_tranche_done,
|
|
||||||
linux_dmabuf_tranche_target_device,
|
|
||||||
linux_dmabuf_tranche_formats,
|
|
||||||
linux_dmabuf_tranche_flags,
|
|
||||||
};
|
|
||||||
|
|
||||||
DmabufFormatsInfo *
|
|
||||||
dmabuf_formats_info_new (GdkDisplay *display,
|
|
||||||
const char *name,
|
|
||||||
struct zwp_linux_dmabuf_feedback_v1 *feedback)
|
|
||||||
{
|
|
||||||
DmabufFormatsInfo *info;
|
|
||||||
|
|
||||||
info = g_new0 (DmabufFormatsInfo, 1);
|
|
||||||
|
|
||||||
info->display = display;
|
|
||||||
info->name = g_strdup (name);
|
|
||||||
info->feedback = feedback;
|
|
||||||
|
|
||||||
if (info->feedback)
|
|
||||||
zwp_linux_dmabuf_feedback_v1_add_listener (info->feedback,
|
|
||||||
&feedback_listener, info);
|
|
||||||
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
dmabuf_formats_info_free (DmabufFormatsInfo *info)
|
|
||||||
{
|
|
||||||
g_free (info->name);
|
|
||||||
g_clear_pointer (&info->feedback, zwp_linux_dmabuf_feedback_v1_destroy);
|
|
||||||
if (info->dmabuf_format_table)
|
|
||||||
{
|
|
||||||
munmap (info->dmabuf_format_table, info->n_dmabuf_formats * 16);
|
|
||||||
info->dmabuf_format_table = NULL;
|
|
||||||
}
|
|
||||||
g_clear_pointer (&info->dmabuf_formats, dmabuf_formats_free);
|
|
||||||
g_clear_pointer (&info->pending_dmabuf_formats, dmabuf_formats_free);
|
|
||||||
g_clear_pointer (&info->pending_tranche, dmabuf_tranche_free);
|
|
||||||
|
|
||||||
g_free (info);
|
|
||||||
}
|
|
||||||
@@ -88,7 +88,14 @@ gdk_wayland_gl_context_empty_frame (GdkDrawContext *draw_context)
|
|||||||
{
|
{
|
||||||
GdkSurface *surface = gdk_draw_context_get_surface (draw_context);
|
GdkSurface *surface = gdk_draw_context_get_surface (draw_context);
|
||||||
|
|
||||||
gdk_wayland_surface_handle_empty_frame (surface);
|
if (gdk_wayland_surface_needs_commit (surface))
|
||||||
|
{
|
||||||
|
gdk_wayland_surface_sync (surface);
|
||||||
|
gdk_wayland_surface_request_frame (surface);
|
||||||
|
|
||||||
|
gdk_wayland_surface_commit (surface);
|
||||||
|
gdk_wayland_surface_notify_committed (surface);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -34,7 +34,6 @@
|
|||||||
#include <gdk/wayland/gdkwayland.h>
|
#include <gdk/wayland/gdkwayland.h>
|
||||||
#include <gdk/wayland/gdkdisplay-wayland.h>
|
#include <gdk/wayland/gdkdisplay-wayland.h>
|
||||||
#include <gdk/wayland/gdkseat-wayland.h>
|
#include <gdk/wayland/gdkseat-wayland.h>
|
||||||
#include <gdk/wayland/gdkwaylandpresentationtime-private.h>
|
|
||||||
|
|
||||||
#include <xkbcommon/xkbcommon.h>
|
#include <xkbcommon/xkbcommon.h>
|
||||||
|
|
||||||
@@ -131,7 +130,7 @@ guint _gdk_wayland_cursor_get_next_image_index (GdkWaylandDisplay *display,
|
|||||||
guint *next_image_delay);
|
guint *next_image_delay);
|
||||||
|
|
||||||
void gdk_wayland_surface_sync (GdkSurface *surface);
|
void gdk_wayland_surface_sync (GdkSurface *surface);
|
||||||
void gdk_wayland_surface_handle_empty_frame (GdkSurface *surface);
|
gboolean gdk_wayland_surface_needs_commit (GdkSurface *surface);
|
||||||
void gdk_wayland_surface_commit (GdkSurface *surface);
|
void gdk_wayland_surface_commit (GdkSurface *surface);
|
||||||
void gdk_wayland_surface_notify_committed (GdkSurface *surface);
|
void gdk_wayland_surface_notify_committed (GdkSurface *surface);
|
||||||
void gdk_wayland_surface_request_frame (GdkSurface *surface);
|
void gdk_wayland_surface_request_frame (GdkSurface *surface);
|
||||||
|
|||||||
@@ -117,6 +117,15 @@ gdk_wayland_seat_stop_cursor_animation (GdkWaylandSeat *seat,
|
|||||||
}
|
}
|
||||||
|
|
||||||
pointer->cursor_image_index = 0;
|
pointer->cursor_image_index = 0;
|
||||||
|
|
||||||
|
if (pointer->cursor_invalidated_handler != 0)
|
||||||
|
{
|
||||||
|
GdkPaintable *paintable;
|
||||||
|
|
||||||
|
paintable = gdk_cursor_get_paintable (pointer->cursor);
|
||||||
|
g_signal_handler_disconnect (paintable, pointer->cursor_invalidated_handler);
|
||||||
|
pointer->cursor_invalidated_handler = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GdkWaylandTabletData *
|
GdkWaylandTabletData *
|
||||||
@@ -781,8 +790,8 @@ pointer_handle_motion (void *data,
|
|||||||
{
|
{
|
||||||
double x, y;
|
double x, y;
|
||||||
gdk_event_get_position (event, &x, &y);
|
gdk_event_get_position (event, &x, &y);
|
||||||
gdk_debug_message ("motion %f %f, seat %p state %d",
|
g_message ("motion %f %f, seat %p state %d",
|
||||||
x, y, seat, gdk_event_get_modifier_state (event));
|
x, y, seat, gdk_event_get_modifier_state (event));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wl_seat_get_version (seat->wl_seat) < WL_POINTER_HAS_FRAME)
|
if (wl_seat_get_version (seat->wl_seat) < WL_POINTER_HAS_FRAME)
|
||||||
@@ -1640,7 +1649,6 @@ touch_handle_down (void *data,
|
|||||||
touch->x = wl_fixed_to_double (x);
|
touch->x = wl_fixed_to_double (x);
|
||||||
touch->y = wl_fixed_to_double (y);
|
touch->y = wl_fixed_to_double (y);
|
||||||
touch->touch_down_serial = serial;
|
touch->touch_down_serial = serial;
|
||||||
seat->latest_touch_down_serial = serial;
|
|
||||||
|
|
||||||
event = gdk_touch_event_new (GDK_TOUCH_BEGIN,
|
event = gdk_touch_event_new (GDK_TOUCH_BEGIN,
|
||||||
GDK_SLOT_TO_EVENT_SEQUENCE (touch->id),
|
GDK_SLOT_TO_EVENT_SEQUENCE (touch->id),
|
||||||
@@ -1664,7 +1672,7 @@ touch_handle_down (void *data,
|
|||||||
{
|
{
|
||||||
double xx, yy;
|
double xx, yy;
|
||||||
gdk_event_get_position (event, &xx, &yy);
|
gdk_event_get_position (event, &xx, &yy);
|
||||||
gdk_debug_message ("touch begin %f %f", xx, yy);
|
g_message ("touch begin %f %f", xx, yy);
|
||||||
}
|
}
|
||||||
|
|
||||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||||
@@ -1699,7 +1707,7 @@ touch_handle_up (void *data,
|
|||||||
{
|
{
|
||||||
double x, y;
|
double x, y;
|
||||||
gdk_event_get_position (event, &x, &y);
|
gdk_event_get_position (event, &x, &y);
|
||||||
gdk_debug_message ("touch end %f %f", x, y);
|
g_message ("touch end %f %f", x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||||
@@ -1747,7 +1755,7 @@ touch_handle_motion (void *data,
|
|||||||
{
|
{
|
||||||
double xx, yy;
|
double xx, yy;
|
||||||
gdk_event_get_position (event, &xx, &yy);
|
gdk_event_get_position (event, &xx, &yy);
|
||||||
gdk_debug_message ("touch update %f %f", xx, yy);
|
g_message ("touch update %f %f", xx, yy);
|
||||||
}
|
}
|
||||||
|
|
||||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||||
@@ -1841,9 +1849,9 @@ emit_gesture_swipe_event (GdkWaylandSeat *seat,
|
|||||||
{
|
{
|
||||||
double x, y;
|
double x, y;
|
||||||
gdk_event_get_position (event, &x, &y);
|
gdk_event_get_position (event, &x, &y);
|
||||||
gdk_debug_message ("swipe event %d, coords: %f %f, seat %p state %d",
|
g_message ("swipe event %d, coords: %f %f, seat %p state %d",
|
||||||
gdk_event_get_event_type (event), x, y, seat,
|
gdk_event_get_event_type (event), x, y, seat,
|
||||||
gdk_event_get_modifier_state (event));
|
gdk_event_get_modifier_state (event));
|
||||||
}
|
}
|
||||||
|
|
||||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||||
@@ -1936,10 +1944,10 @@ emit_gesture_pinch_event (GdkWaylandSeat *seat,
|
|||||||
{
|
{
|
||||||
double x, y;
|
double x, y;
|
||||||
gdk_event_get_position (event, &x, &y);
|
gdk_event_get_position (event, &x, &y);
|
||||||
gdk_debug_message ("pinch event %d, coords: %f %f, seat %p state %d",
|
g_message ("pinch event %d, coords: %f %f, seat %p state %d",
|
||||||
gdk_event_get_event_type (event),
|
gdk_event_get_event_type (event),
|
||||||
x, y, seat,
|
x, y, seat,
|
||||||
gdk_event_get_modifier_state (event));
|
gdk_event_get_modifier_state (event));
|
||||||
}
|
}
|
||||||
|
|
||||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||||
@@ -2030,10 +2038,10 @@ emit_gesture_hold_event (GdkWaylandSeat *seat,
|
|||||||
{
|
{
|
||||||
double x, y;
|
double x, y;
|
||||||
gdk_event_get_position (event, &x, &y);
|
gdk_event_get_position (event, &x, &y);
|
||||||
gdk_debug_message ("hold event %d, coords: %f %f, seat %p state %d",
|
g_message ("hold event %d, coords: %f %f, seat %p state %d",
|
||||||
gdk_event_get_event_type (event),
|
gdk_event_get_event_type (event),
|
||||||
x, y, seat,
|
x, y, seat,
|
||||||
gdk_event_get_modifier_state (event));
|
gdk_event_get_modifier_state (event));
|
||||||
}
|
}
|
||||||
|
|
||||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||||
@@ -4243,7 +4251,7 @@ init_pointer_data (GdkWaylandPointerData *pointer_data,
|
|||||||
&pointer_surface_listener,
|
&pointer_surface_listener,
|
||||||
logical_device);
|
logical_device);
|
||||||
|
|
||||||
if (display_wayland->viewporter)
|
if (display_wayland->viewporter && g_getenv ("POINTER_USE_VIEWPORT"))
|
||||||
pointer_data->pointer_surface_viewport = wp_viewporter_get_viewport (display_wayland->viewporter, pointer_data->pointer_surface);
|
pointer_data->pointer_surface_viewport = wp_viewporter_get_viewport (display_wayland->viewporter, pointer_data->pointer_surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4394,24 +4402,15 @@ _gdk_wayland_seat_get_last_implicit_grab_serial (GdkWaylandSeat *seat,
|
|||||||
serial = tablet->pointer_info.press_serial;
|
serial = tablet->pointer_info.press_serial;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_hash_table_size (seat->touches) > 0)
|
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &touch))
|
||||||
{
|
{
|
||||||
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &touch))
|
if (touch->touch_down_serial > serial)
|
||||||
{
|
{
|
||||||
if (touch->touch_down_serial > serial)
|
if (sequence)
|
||||||
{
|
*sequence = GDK_SLOT_TO_EVENT_SEQUENCE (touch->id);
|
||||||
if (sequence)
|
serial = touch->touch_down_serial;
|
||||||
*sequence = GDK_SLOT_TO_EVENT_SEQUENCE (touch->id);
|
|
||||||
serial = touch->touch_down_serial;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (seat->latest_touch_down_serial > serial)
|
|
||||||
serial = seat->latest_touch_down_serial;
|
|
||||||
}
|
|
||||||
|
|
||||||
return serial;
|
return serial;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#include "gdksubsurfaceprivate.h"
|
#include "gdksubsurfaceprivate.h"
|
||||||
|
|
||||||
#include "wayland-client-protocol.h"
|
|
||||||
|
|
||||||
typedef struct _GdkWaylandSubsurface GdkWaylandSubsurface;
|
typedef struct _GdkWaylandSubsurface GdkWaylandSubsurface;
|
||||||
typedef struct _GdkWaylandSubsurfaceClass GdkWaylandSubsurfaceClass;
|
typedef struct _GdkWaylandSubsurfaceClass GdkWaylandSubsurfaceClass;
|
||||||
@@ -24,17 +23,10 @@ struct _GdkWaylandSubsurface
|
|||||||
GdkTexture *texture;
|
GdkTexture *texture;
|
||||||
cairo_rectangle_int_t dest;
|
cairo_rectangle_int_t dest;
|
||||||
graphene_rect_t source;
|
graphene_rect_t source;
|
||||||
enum wl_output_transform transform;
|
|
||||||
|
|
||||||
struct wl_region *opaque_region;
|
struct wl_region *opaque_region;
|
||||||
|
|
||||||
struct wl_callback *frame_callback;
|
struct wl_callback *frame_callback;
|
||||||
|
|
||||||
struct wl_surface *bg_surface;
|
|
||||||
struct wl_subsurface *bg_subsurface;
|
|
||||||
struct wp_viewport *bg_viewport;
|
|
||||||
cairo_rectangle_int_t bg_rect;
|
|
||||||
gboolean bg_attached;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GdkWaylandSubsurfaceClass
|
struct _GdkWaylandSubsurfaceClass
|
||||||
|
|||||||
@@ -25,8 +25,6 @@
|
|||||||
#include "gdkdmabuftextureprivate.h"
|
#include "gdkdmabuftextureprivate.h"
|
||||||
#include "gdksurface-wayland-private.h"
|
#include "gdksurface-wayland-private.h"
|
||||||
#include "gdksubsurfaceprivate.h"
|
#include "gdksubsurfaceprivate.h"
|
||||||
#include "gdkdebugprivate.h"
|
|
||||||
#include "gsk/gskrectprivate.h"
|
|
||||||
|
|
||||||
#include "linux-dmabuf-unstable-v1-client-protocol.h"
|
#include "linux-dmabuf-unstable-v1-client-protocol.h"
|
||||||
|
|
||||||
@@ -48,55 +46,11 @@ gdk_wayland_subsurface_finalize (GObject *object)
|
|||||||
g_clear_pointer (&self->viewport, wp_viewport_destroy);
|
g_clear_pointer (&self->viewport, wp_viewport_destroy);
|
||||||
g_clear_pointer (&self->subsurface, wl_subsurface_destroy);
|
g_clear_pointer (&self->subsurface, wl_subsurface_destroy);
|
||||||
g_clear_pointer (&self->surface, wl_surface_destroy);
|
g_clear_pointer (&self->surface, wl_surface_destroy);
|
||||||
g_clear_pointer (&self->bg_viewport, wp_viewport_destroy);
|
g_clear_pointer (&self->subsurface, wl_subsurface_destroy);
|
||||||
g_clear_pointer (&self->bg_subsurface, wl_subsurface_destroy);
|
|
||||||
g_clear_pointer (&self->bg_surface, wl_surface_destroy);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (gdk_wayland_subsurface_parent_class)->finalize (object);
|
G_OBJECT_CLASS (gdk_wayland_subsurface_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
shm_buffer_release (void *data,
|
|
||||||
struct wl_buffer *buffer)
|
|
||||||
{
|
|
||||||
cairo_surface_t *surface = data;
|
|
||||||
|
|
||||||
/* Note: the wl_buffer is destroyed as cairo user data */
|
|
||||||
cairo_surface_destroy (surface);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct wl_buffer_listener shm_buffer_listener = {
|
|
||||||
shm_buffer_release,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct wl_buffer *
|
|
||||||
get_shm_wl_buffer (GdkWaylandSubsurface *self,
|
|
||||||
GdkTexture *texture)
|
|
||||||
{
|
|
||||||
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (GDK_SUBSURFACE (self)->parent));
|
|
||||||
int width, height;
|
|
||||||
cairo_surface_t *surface;
|
|
||||||
GdkTextureDownloader *downloader;
|
|
||||||
struct wl_buffer *buffer;
|
|
||||||
|
|
||||||
width = gdk_texture_get_width (texture);
|
|
||||||
height = gdk_texture_get_height (texture);
|
|
||||||
surface = gdk_wayland_display_create_shm_surface (display, width, height, &GDK_FRACTIONAL_SCALE_INIT_INT (1));
|
|
||||||
|
|
||||||
downloader = gdk_texture_downloader_new (texture);
|
|
||||||
|
|
||||||
gdk_texture_downloader_download_into (downloader,
|
|
||||||
cairo_image_surface_get_data (surface),
|
|
||||||
cairo_image_surface_get_stride (surface));
|
|
||||||
|
|
||||||
gdk_texture_downloader_free (downloader);
|
|
||||||
|
|
||||||
buffer = _gdk_wayland_shm_surface_get_wl_buffer (surface);
|
|
||||||
wl_buffer_add_listener (buffer, &shm_buffer_listener, surface);
|
|
||||||
|
|
||||||
return buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dmabuf_buffer_release (void *data,
|
dmabuf_buffer_release (void *data,
|
||||||
struct wl_buffer *buffer)
|
struct wl_buffer *buffer)
|
||||||
@@ -143,8 +97,8 @@ static const struct zwp_linux_buffer_params_v1_listener params_listener = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static struct wl_buffer *
|
static struct wl_buffer *
|
||||||
get_dmabuf_wl_buffer (GdkWaylandSubsurface *self,
|
get_wl_buffer (GdkWaylandSubsurface *self,
|
||||||
GdkTexture *texture)
|
GdkTexture *texture)
|
||||||
{
|
{
|
||||||
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (GDK_SUBSURFACE (self)->parent));
|
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (GDK_SUBSURFACE (self)->parent));
|
||||||
const GdkDmabuf *dmabuf;
|
const GdkDmabuf *dmabuf;
|
||||||
@@ -195,138 +149,23 @@ get_dmabuf_wl_buffer (GdkWaylandSubsurface *self,
|
|||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct wl_buffer *
|
|
||||||
get_wl_buffer (GdkWaylandSubsurface *self,
|
|
||||||
GdkTexture *texture)
|
|
||||||
{
|
|
||||||
GdkDisplay *display = gdk_surface_get_display (GDK_SUBSURFACE (self)->parent);
|
|
||||||
struct wl_buffer *buffer = NULL;
|
|
||||||
|
|
||||||
if (GDK_IS_DMABUF_TEXTURE (texture))
|
|
||||||
buffer = get_dmabuf_wl_buffer (self, texture);
|
|
||||||
|
|
||||||
if (GDK_DISPLAY_DEBUG_CHECK (display, FORCE_OFFLOAD))
|
|
||||||
{
|
|
||||||
if (!buffer)
|
|
||||||
buffer = get_shm_wl_buffer (self, texture);
|
|
||||||
}
|
|
||||||
|
|
||||||
return buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
sp_buffer_release (void *data,
|
|
||||||
struct wl_buffer *buffer)
|
|
||||||
{
|
|
||||||
wl_buffer_destroy (buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct wl_buffer_listener sp_buffer_listener = {
|
|
||||||
sp_buffer_release,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct wl_buffer *
|
|
||||||
get_sp_buffer (GdkWaylandSubsurface *self)
|
|
||||||
{
|
|
||||||
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (GDK_SUBSURFACE (self)->parent));
|
|
||||||
struct wl_buffer *buffer = NULL;
|
|
||||||
|
|
||||||
if (display->single_pixel_buffer)
|
|
||||||
buffer = wp_single_pixel_buffer_manager_v1_create_u32_rgba_buffer (display->single_pixel_buffer,
|
|
||||||
0, 0, 0, 0xffffffffU);
|
|
||||||
|
|
||||||
if (buffer)
|
|
||||||
wl_buffer_add_listener (buffer, &sp_buffer_listener, self);
|
|
||||||
|
|
||||||
return buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline enum wl_output_transform
|
|
||||||
gdk_texture_transform_to_wl (GdkTextureTransform transform)
|
|
||||||
{
|
|
||||||
return (enum wl_output_transform) transform;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline GdkTextureTransform
|
|
||||||
wl_output_transform_to_gdk (enum wl_output_transform transform)
|
|
||||||
{
|
|
||||||
return (GdkTextureTransform) transform;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
ensure_bg_surface (GdkWaylandSubsurface *self)
|
|
||||||
{
|
|
||||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (GDK_SUBSURFACE (self)->parent);
|
|
||||||
GdkDisplay *display = gdk_surface_get_display (GDK_SUBSURFACE (self)->parent);
|
|
||||||
GdkWaylandDisplay *disp = GDK_WAYLAND_DISPLAY (display);
|
|
||||||
struct wl_region *region;
|
|
||||||
|
|
||||||
if (self->bg_surface)
|
|
||||||
return;
|
|
||||||
|
|
||||||
self->bg_surface = wl_compositor_create_surface (disp->compositor);
|
|
||||||
self->bg_subsurface = wl_subcompositor_get_subsurface (disp->subcompositor,
|
|
||||||
self->bg_surface,
|
|
||||||
impl->display_server.wl_surface);
|
|
||||||
self->bg_viewport = wp_viewporter_get_viewport (disp->viewporter, self->bg_surface);
|
|
||||||
|
|
||||||
/* We are opaque */
|
|
||||||
wl_surface_set_opaque_region (self->bg_surface, self->opaque_region);
|
|
||||||
|
|
||||||
/* No input, please */
|
|
||||||
region = wl_compositor_create_region (disp->compositor);
|
|
||||||
wl_surface_set_input_region (self->bg_surface, region);
|
|
||||||
wl_region_destroy (region);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline gboolean
|
|
||||||
scaled_rect_is_integral (const graphene_rect_t *rect,
|
|
||||||
float scale,
|
|
||||||
graphene_rect_t *device_rect)
|
|
||||||
{
|
|
||||||
cairo_rectangle_int_t device_int;
|
|
||||||
|
|
||||||
gsk_rect_scale (rect, scale, scale, device_rect);
|
|
||||||
|
|
||||||
device_int.x = device_rect->origin.x;
|
|
||||||
device_int.y = device_rect->origin.y;
|
|
||||||
device_int.width = device_rect->size.width;
|
|
||||||
device_int.height = device_rect->size.height;
|
|
||||||
|
|
||||||
return device_int.x == device_rect->origin.x &&
|
|
||||||
device_int.y == device_rect->origin.y &&
|
|
||||||
device_int.width == device_rect->size.width &&
|
|
||||||
device_int.height == device_rect->size.height;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
||||||
GdkTexture *texture,
|
GdkTexture *texture,
|
||||||
const graphene_rect_t *source,
|
const graphene_rect_t *source,
|
||||||
const graphene_rect_t *dest,
|
const graphene_rect_t *dest,
|
||||||
GdkTextureTransform transform,
|
|
||||||
const graphene_rect_t *background,
|
|
||||||
gboolean above,
|
gboolean above,
|
||||||
GdkSubsurface *sibling)
|
GdkSubsurface *sibling)
|
||||||
{
|
{
|
||||||
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
|
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
|
||||||
GdkWaylandSurface *parent = GDK_WAYLAND_SURFACE (sub->parent);
|
GdkWaylandSurface *parent = GDK_WAYLAND_SURFACE (sub->parent);
|
||||||
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (sub->parent));
|
|
||||||
struct wl_buffer *buffer = NULL;
|
struct wl_buffer *buffer = NULL;
|
||||||
gboolean result = FALSE;
|
gboolean result = FALSE;
|
||||||
GdkWaylandSubsurface *sib = sibling ? GDK_WAYLAND_SUBSURFACE (sibling) : NULL;
|
GdkWaylandSubsurface *sib = sibling ? GDK_WAYLAND_SUBSURFACE (sibling) : NULL;
|
||||||
gboolean will_be_above;
|
gboolean will_be_above;
|
||||||
double scale;
|
double scale;
|
||||||
graphene_rect_t device_rect;
|
graphene_rect_t device_rect;
|
||||||
gboolean has_background;
|
cairo_rectangle_int_t device_dest;
|
||||||
enum wl_output_transform tf;
|
|
||||||
gboolean dest_changed = FALSE;
|
|
||||||
gboolean source_changed = FALSE;
|
|
||||||
gboolean transform_changed = FALSE;
|
|
||||||
gboolean stacking_changed = FALSE;
|
|
||||||
gboolean needs_commit = FALSE;
|
|
||||||
gboolean background_changed = FALSE;
|
|
||||||
gboolean needs_bg_commit = FALSE;
|
|
||||||
|
|
||||||
if (sibling)
|
if (sibling)
|
||||||
will_be_above = sibling->above_parent;
|
will_be_above = sibling->above_parent;
|
||||||
@@ -339,133 +178,69 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self->dest.x = dest->origin.x;
|
||||||
|
self->dest.y = dest->origin.y;
|
||||||
|
self->dest.width = dest->size.width;
|
||||||
|
self->dest.height = dest->size.height;
|
||||||
|
|
||||||
|
self->source.origin.x = source->origin.x;
|
||||||
|
self->source.origin.y = source->origin.y;
|
||||||
|
self->source.size.width = source->size.width;
|
||||||
|
self->source.size.height = source->size.height;
|
||||||
|
|
||||||
|
scale = gdk_fractional_scale_to_double (&parent->scale);
|
||||||
|
|
||||||
|
device_rect.origin.x = dest->origin.x * scale;
|
||||||
|
device_rect.origin.y = dest->origin.y * scale;
|
||||||
|
device_rect.size.width = dest->size.width * scale;
|
||||||
|
device_rect.size.height = dest->size.height * scale;
|
||||||
|
|
||||||
|
device_dest.x = device_rect.origin.x;
|
||||||
|
device_dest.y = device_rect.origin.y;
|
||||||
|
device_dest.width = device_rect.size.width;
|
||||||
|
device_dest.height = device_rect.size.height;
|
||||||
|
|
||||||
if (self->dest.x != dest->origin.x ||
|
if (self->dest.x != dest->origin.x ||
|
||||||
self->dest.y != dest->origin.y ||
|
self->dest.y != dest->origin.y ||
|
||||||
self->dest.width != dest->size.width ||
|
self->dest.width != dest->size.width ||
|
||||||
self->dest.height != dest->size.height)
|
self->dest.height != dest->size.height)
|
||||||
{
|
|
||||||
self->dest.x = dest->origin.x;
|
|
||||||
self->dest.y = dest->origin.y;
|
|
||||||
self->dest.width = dest->size.width;
|
|
||||||
self->dest.height = dest->size.height;
|
|
||||||
dest_changed = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!gsk_rect_equal (&self->source, source))
|
|
||||||
{
|
|
||||||
self->source.origin.x = source->origin.x;
|
|
||||||
self->source.origin.y = source->origin.y;
|
|
||||||
self->source.size.width = source->size.width;
|
|
||||||
self->source.size.height = source->size.height;
|
|
||||||
source_changed = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
tf = gdk_texture_transform_to_wl (transform);
|
|
||||||
if (self->transform != tf)
|
|
||||||
{
|
|
||||||
self->transform = tf;
|
|
||||||
transform_changed = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sibling != gdk_subsurface_get_sibling (sub, above) ||
|
|
||||||
will_be_above != gdk_subsurface_is_above_parent (sub))
|
|
||||||
stacking_changed = TRUE;
|
|
||||||
|
|
||||||
if (self->texture == NULL)
|
|
||||||
{
|
|
||||||
dest_changed = TRUE;
|
|
||||||
source_changed = TRUE;
|
|
||||||
transform_changed = TRUE;
|
|
||||||
stacking_changed = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
scale = gdk_fractional_scale_to_double (&parent->scale);
|
|
||||||
|
|
||||||
if (background)
|
|
||||||
{
|
|
||||||
background_changed =
|
|
||||||
!self->bg_attached ||
|
|
||||||
self->bg_rect.x != background->origin.x ||
|
|
||||||
self->bg_rect.y != background->origin.y ||
|
|
||||||
self->bg_rect.width != background->size.width ||
|
|
||||||
self->bg_rect.height != background->size.height;
|
|
||||||
self->bg_rect.x = background->origin.x;
|
|
||||||
self->bg_rect.y = background->origin.y;
|
|
||||||
self->bg_rect.width = background->size.width;
|
|
||||||
self->bg_rect.height = background->size.height;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
background_changed = self->bg_attached;
|
|
||||||
self->bg_rect.x = 0;
|
|
||||||
self->bg_rect.y = 0;
|
|
||||||
self->bg_rect.width = 0;
|
|
||||||
self->bg_rect.height = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
has_background = self->bg_rect.width > 0 && self->bg_rect.height > 0;
|
|
||||||
|
|
||||||
if (has_background)
|
|
||||||
ensure_bg_surface (self);
|
|
||||||
|
|
||||||
if (!scaled_rect_is_integral (dest, 1, &device_rect))
|
|
||||||
{
|
{
|
||||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
||||||
"[%p] 🗙 Non-integral coordinates %g %g %g %g",
|
"Non-integer coordinates %g %g %g %g for %dx%d texture, hiding subsurface %p",
|
||||||
self,
|
|
||||||
dest->origin.x, dest->origin.y,
|
dest->origin.x, dest->origin.y,
|
||||||
dest->size.width, dest->size.height);
|
dest->size.width, dest->size.height,
|
||||||
}
|
|
||||||
else if (!scaled_rect_is_integral (dest, scale, &device_rect))
|
|
||||||
{
|
|
||||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
|
||||||
"[%p] 🗙 Non-integral device coordinates %g %g %g %g (scale %.2f)",
|
|
||||||
self,
|
|
||||||
device_rect.origin.x, device_rect.origin.y,
|
|
||||||
device_rect.size.width, device_rect.size.height,
|
|
||||||
scale);
|
|
||||||
}
|
|
||||||
else if (background && !scaled_rect_is_integral (background, 1, &device_rect))
|
|
||||||
{
|
|
||||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
|
||||||
"[%p] 🗙 Non-integral background coordinates %g %g %g %g",
|
|
||||||
self,
|
|
||||||
background->origin.x, background->origin.y,
|
|
||||||
background->size.width, background->size.height);
|
|
||||||
}
|
|
||||||
else if (background && !scaled_rect_is_integral (background, scale, &device_rect))
|
|
||||||
{
|
|
||||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
|
||||||
"[%p] 🗙 Non-integral background device coordinates %g %g %g %g (scale %.2f)",
|
|
||||||
self,
|
|
||||||
device_rect.origin.x, device_rect.origin.y,
|
|
||||||
device_rect.size.width, device_rect.size.height,
|
|
||||||
scale);
|
|
||||||
}
|
|
||||||
else if (!GDK_IS_DMABUF_TEXTURE (texture) &&
|
|
||||||
!GDK_DISPLAY_DEBUG_CHECK (gdk_surface_get_display (sub->parent), FORCE_OFFLOAD))
|
|
||||||
{
|
|
||||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
|
||||||
"[%p] 🗙 %s (%dx%d) is not a GdkDmabufTexture",
|
|
||||||
self,
|
|
||||||
G_OBJECT_TYPE_NAME (texture),
|
|
||||||
gdk_texture_get_width (texture),
|
gdk_texture_get_width (texture),
|
||||||
gdk_texture_get_height (texture));
|
gdk_texture_get_height (texture),
|
||||||
|
self);
|
||||||
|
}
|
||||||
|
else if (device_dest.x != device_rect.origin.x ||
|
||||||
|
device_dest.y != device_rect.origin.y ||
|
||||||
|
device_dest.width != device_rect.size.width ||
|
||||||
|
device_dest.height != device_rect.size.height)
|
||||||
|
{
|
||||||
|
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
||||||
|
"Non-integral device coordinates %g %g %g %g (fractional scale %.2f), hiding subsurface %p",
|
||||||
|
device_rect.origin.x, device_rect.origin.y,
|
||||||
|
device_rect.size.width, device_rect.size.width,
|
||||||
|
scale,
|
||||||
|
self);
|
||||||
|
}
|
||||||
|
else if (!GDK_IS_DMABUF_TEXTURE (texture))
|
||||||
|
{
|
||||||
|
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
||||||
|
"%dx%d %s is not a GdkDmabufTexture, hiding subsurface %p",
|
||||||
|
gdk_texture_get_width (texture),
|
||||||
|
gdk_texture_get_height (texture),
|
||||||
|
G_OBJECT_TYPE_NAME (texture),
|
||||||
|
self);
|
||||||
}
|
}
|
||||||
else if (!will_be_above &&
|
else if (!will_be_above &&
|
||||||
gdk_memory_format_alpha (gdk_texture_get_format (texture)) != GDK_MEMORY_ALPHA_OPAQUE &&
|
gdk_memory_format_alpha (gdk_texture_get_format (texture)) != GDK_MEMORY_ALPHA_OPAQUE)
|
||||||
!has_background)
|
|
||||||
{
|
{
|
||||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
||||||
"[%p] 🗙 Non-opaque texture (%dx%d) below",
|
"Cannot offload non-opaque %dx%d texture below, hiding subsurface %p",
|
||||||
self,
|
|
||||||
gdk_texture_get_width (texture),
|
gdk_texture_get_width (texture),
|
||||||
gdk_texture_get_height (texture));
|
gdk_texture_get_height (texture),
|
||||||
}
|
|
||||||
else if (has_background && !display->single_pixel_buffer)
|
|
||||||
{
|
|
||||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
|
||||||
"[%p] 🗙 Texture has background, but no single-pixel buffer support",
|
|
||||||
self);
|
self);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -494,13 +269,10 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
|||||||
}
|
}
|
||||||
|
|
||||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
||||||
"[%p] %s Attaching texture (%dx%d) at %d %d %d %d",
|
"Attached %dx%d texture to subsurface %p at %d %d %d %d",
|
||||||
self,
|
|
||||||
will_be_above
|
|
||||||
? (has_background ? "▲" : "△")
|
|
||||||
: (has_background ? "▼" : "▽"),
|
|
||||||
gdk_texture_get_width (texture),
|
gdk_texture_get_width (texture),
|
||||||
gdk_texture_get_height (texture),
|
gdk_texture_get_height (texture),
|
||||||
|
self,
|
||||||
self->dest.x, self->dest.y,
|
self->dest.x, self->dest.y,
|
||||||
self->dest.width, self->dest.height);
|
self->dest.width, self->dest.height);
|
||||||
result = TRUE;
|
result = TRUE;
|
||||||
@@ -508,53 +280,35 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
||||||
"[%p] 🗙 Failed to create wl_buffer",
|
"Compositor failed to create wl_buffer for %dx%d texture, hiding subsurface %p",
|
||||||
|
gdk_texture_get_width (texture),
|
||||||
|
gdk_texture_get_height (texture),
|
||||||
self);
|
self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (dest_changed)
|
|
||||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
|
||||||
"[%p] %s Moving texture (%dx%d) to %d %d %d %d",
|
|
||||||
self,
|
|
||||||
will_be_above
|
|
||||||
? (has_background ? "▲" : "△")
|
|
||||||
: (has_background ? "▼" : "▽"),
|
|
||||||
gdk_texture_get_width (texture),
|
|
||||||
gdk_texture_get_height (texture),
|
|
||||||
self->dest.x, self->dest.y,
|
|
||||||
self->dest.width, self->dest.height);
|
|
||||||
|
|
||||||
buffer = NULL;
|
buffer = NULL;
|
||||||
|
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
||||||
|
"Moved %dx%d texture in subsurface %p to %d %d %d %d",
|
||||||
|
gdk_texture_get_width (texture),
|
||||||
|
gdk_texture_get_height (texture),
|
||||||
|
self,
|
||||||
|
self->dest.x, self->dest.y,
|
||||||
|
self->dest.width, self->dest.height);
|
||||||
result = TRUE;
|
result = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
if (transform_changed)
|
wl_subsurface_set_position (self->subsurface, self->dest.x, self->dest.y);
|
||||||
{
|
wp_viewport_set_destination (self->viewport, self->dest.width, self->dest.height);
|
||||||
wl_surface_set_buffer_transform (self->surface, self->transform);
|
wp_viewport_set_source (self->viewport,
|
||||||
needs_commit = TRUE;
|
wl_fixed_from_double (self->source.origin.x),
|
||||||
}
|
wl_fixed_from_double (self->source.origin.y),
|
||||||
|
wl_fixed_from_double (self->source.size.width),
|
||||||
if (dest_changed)
|
wl_fixed_from_double (self->source.size.height));
|
||||||
{
|
|
||||||
wl_subsurface_set_position (self->subsurface, self->dest.x, self->dest.y);
|
|
||||||
wp_viewport_set_destination (self->viewport, self->dest.width, self->dest.height);
|
|
||||||
needs_commit = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (source_changed)
|
|
||||||
{
|
|
||||||
wp_viewport_set_source (self->viewport,
|
|
||||||
wl_fixed_from_double (self->source.origin.x),
|
|
||||||
wl_fixed_from_double (self->source.origin.y),
|
|
||||||
wl_fixed_from_double (self->source.size.width),
|
|
||||||
wl_fixed_from_double (self->source.size.height));
|
|
||||||
needs_commit = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (buffer)
|
if (buffer)
|
||||||
{
|
{
|
||||||
@@ -563,95 +317,39 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
|||||||
0, 0,
|
0, 0,
|
||||||
gdk_texture_get_width (texture),
|
gdk_texture_get_width (texture),
|
||||||
gdk_texture_get_height (texture));
|
gdk_texture_get_height (texture));
|
||||||
needs_commit = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (has_background)
|
|
||||||
{
|
|
||||||
if (background_changed)
|
|
||||||
{
|
|
||||||
wl_subsurface_set_position (self->bg_subsurface, self->bg_rect.x, self->bg_rect.y);
|
|
||||||
wp_viewport_set_destination (self->bg_viewport, self->bg_rect.width, self->bg_rect.height);
|
|
||||||
needs_bg_commit = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!self->bg_attached)
|
|
||||||
{
|
|
||||||
self->bg_attached = TRUE;
|
|
||||||
|
|
||||||
wp_viewport_set_source (self->bg_viewport,
|
|
||||||
wl_fixed_from_int (0),
|
|
||||||
wl_fixed_from_int (0),
|
|
||||||
wl_fixed_from_int (1),
|
|
||||||
wl_fixed_from_int (1));
|
|
||||||
wl_surface_attach (self->bg_surface, get_sp_buffer (self), 0, 0);
|
|
||||||
wl_surface_damage_buffer (self->bg_surface, 0, 0, 1, 1);
|
|
||||||
needs_bg_commit = TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (self->bg_attached)
|
|
||||||
{
|
|
||||||
self->bg_attached = FALSE;
|
|
||||||
wl_surface_attach (self->bg_surface, NULL, 0, 0);
|
|
||||||
needs_bg_commit = TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result = TRUE;
|
result = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (g_set_object (&self->texture, NULL))
|
g_set_object (&self->texture, NULL);
|
||||||
{
|
|
||||||
wl_surface_attach (self->surface, NULL, 0, 0);
|
|
||||||
needs_commit = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (self->bg_attached)
|
wl_surface_attach (self->surface, NULL, 0, 0);
|
||||||
{
|
|
||||||
self->bg_attached = FALSE;
|
|
||||||
wl_surface_attach (self->bg_surface, NULL, 0, 0);
|
|
||||||
needs_bg_commit = TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stacking_changed)
|
if (sib)
|
||||||
{
|
{
|
||||||
if (sib)
|
if (above)
|
||||||
{
|
wl_subsurface_place_above (self->subsurface, sib->surface);
|
||||||
if (above)
|
|
||||||
wl_subsurface_place_above (self->subsurface, sib->surface);
|
|
||||||
else
|
|
||||||
wl_subsurface_place_below (self->subsurface, sib->surface);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
wl_subsurface_place_below (self->subsurface, sib->surface);
|
||||||
if (above)
|
}
|
||||||
wl_subsurface_place_above (self->subsurface,
|
else
|
||||||
GDK_WAYLAND_SURFACE (sub->parent)->display_server.wl_surface);
|
{
|
||||||
else
|
if (above)
|
||||||
wl_subsurface_place_below (self->subsurface,
|
wl_subsurface_place_above (self->subsurface,
|
||||||
GDK_WAYLAND_SURFACE (sub->parent)->display_server.wl_surface);
|
GDK_WAYLAND_SURFACE (sub->parent)->display_server.wl_surface);
|
||||||
}
|
else
|
||||||
needs_commit = TRUE;
|
wl_subsurface_place_below (self->subsurface,
|
||||||
|
GDK_WAYLAND_SURFACE (sub->parent)->display_server.wl_surface);
|
||||||
if (self->bg_attached)
|
|
||||||
{
|
|
||||||
wl_subsurface_place_below (self->bg_subsurface, self->surface);
|
|
||||||
needs_bg_commit = TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (needs_commit)
|
wl_surface_commit (self->surface);
|
||||||
wl_surface_commit (self->surface);
|
|
||||||
|
|
||||||
if (needs_bg_commit)
|
((GdkWaylandSurface *)sub->parent)->has_pending_subsurface_commits = TRUE;
|
||||||
wl_surface_commit (self->bg_surface);
|
GDK_WAYLAND_SURFACE (sub->parent)->opaque_region_dirty = TRUE;
|
||||||
|
|
||||||
((GdkWaylandSurface *)sub->parent)->has_pending_subsurface_commits = needs_commit || needs_bg_commit;
|
|
||||||
GDK_WAYLAND_SURFACE (sub->parent)->opaque_region_dirty = stacking_changed || dest_changed || background_changed;
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -663,7 +361,7 @@ gdk_wayland_subsurface_detach (GdkSubsurface *sub)
|
|||||||
|
|
||||||
if (sub->parent == NULL)
|
if (sub->parent == NULL)
|
||||||
{
|
{
|
||||||
g_warning ("Can't detach from destroyed subsurface %p", self);
|
g_warning ("Can't draw to destroyed subsurface %p", self);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -672,13 +370,6 @@ gdk_wayland_subsurface_detach (GdkSubsurface *sub)
|
|||||||
wl_surface_set_opaque_region (self->surface, self->opaque_region);
|
wl_surface_set_opaque_region (self->surface, self->opaque_region);
|
||||||
wl_surface_commit (self->surface);
|
wl_surface_commit (self->surface);
|
||||||
|
|
||||||
if (self->bg_attached)
|
|
||||||
{
|
|
||||||
wl_surface_attach (self->bg_surface, NULL, 0, 0);
|
|
||||||
wl_surface_commit (self->bg_surface);
|
|
||||||
self->bg_attached = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
((GdkWaylandSurface *)sub->parent)->has_pending_subsurface_commits = TRUE;
|
((GdkWaylandSurface *)sub->parent)->has_pending_subsurface_commits = TRUE;
|
||||||
GDK_WAYLAND_SURFACE (sub->parent)->opaque_region_dirty = TRUE;
|
GDK_WAYLAND_SURFACE (sub->parent)->opaque_region_dirty = TRUE;
|
||||||
}
|
}
|
||||||
@@ -692,49 +383,27 @@ gdk_wayland_subsurface_get_texture (GdkSubsurface *sub)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_wayland_subsurface_get_texture_rect (GdkSubsurface *sub,
|
gdk_wayland_subsurface_get_dest (GdkSubsurface *sub,
|
||||||
graphene_rect_t *rect)
|
graphene_rect_t *dest)
|
||||||
{
|
{
|
||||||
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
|
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
|
||||||
|
|
||||||
rect->origin.x = self->dest.x;
|
dest->origin.x = self->dest.x;
|
||||||
rect->origin.y = self->dest.y;
|
dest->origin.y = self->dest.y;
|
||||||
rect->size.width = self->dest.width;
|
dest->size.width = self->dest.width;
|
||||||
rect->size.height = self->dest.height;
|
dest->size.height = self->dest.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_wayland_subsurface_get_source_rect (GdkSubsurface *sub,
|
gdk_wayland_subsurface_get_source (GdkSubsurface *sub,
|
||||||
graphene_rect_t *rect)
|
graphene_rect_t *source)
|
||||||
{
|
{
|
||||||
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
|
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
|
||||||
|
|
||||||
rect->origin.x = self->source.origin.x;
|
source->origin.x = self->source.origin.x;
|
||||||
rect->origin.y = self->source.origin.y;
|
source->origin.y = self->source.origin.y;
|
||||||
rect->size.width = self->source.size.width;
|
source->size.width = self->source.size.width;
|
||||||
rect->size.height = self->source.size.height;
|
source->size.height = self->source.size.height;
|
||||||
}
|
|
||||||
|
|
||||||
static GdkTextureTransform
|
|
||||||
gdk_wayland_subsurface_get_transform (GdkSubsurface *sub)
|
|
||||||
{
|
|
||||||
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
|
|
||||||
|
|
||||||
return wl_output_transform_to_gdk (self->transform);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
gdk_wayland_subsurface_get_background_rect (GdkSubsurface *sub,
|
|
||||||
graphene_rect_t *rect)
|
|
||||||
{
|
|
||||||
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
|
|
||||||
|
|
||||||
rect->origin.x = self->bg_rect.x;
|
|
||||||
rect->origin.y = self->bg_rect.y;
|
|
||||||
rect->size.width = self->bg_rect.width;
|
|
||||||
rect->size.height = self->bg_rect.height;
|
|
||||||
|
|
||||||
return rect->size.width > 0 && rect->size.height > 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -748,10 +417,8 @@ gdk_wayland_subsurface_class_init (GdkWaylandSubsurfaceClass *class)
|
|||||||
subsurface_class->attach = gdk_wayland_subsurface_attach;
|
subsurface_class->attach = gdk_wayland_subsurface_attach;
|
||||||
subsurface_class->detach = gdk_wayland_subsurface_detach;
|
subsurface_class->detach = gdk_wayland_subsurface_detach;
|
||||||
subsurface_class->get_texture = gdk_wayland_subsurface_get_texture;
|
subsurface_class->get_texture = gdk_wayland_subsurface_get_texture;
|
||||||
subsurface_class->get_source_rect = gdk_wayland_subsurface_get_source_rect;
|
subsurface_class->get_source = gdk_wayland_subsurface_get_source;
|
||||||
subsurface_class->get_texture_rect = gdk_wayland_subsurface_get_texture_rect;
|
subsurface_class->get_dest = gdk_wayland_subsurface_get_dest;
|
||||||
subsurface_class->get_transform = gdk_wayland_subsurface_get_transform;
|
|
||||||
subsurface_class->get_background_rect = gdk_wayland_subsurface_get_background_rect;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||