Compare commits

..

12 Commits

Author SHA1 Message Date
Matthias Clasen
4c5fc2db89 Add a test for CSS variables 2024-04-21 14:35:26 -04:00
Alice Mikhaylenko
9faeea801e tmp tests 2024-03-20 23:11:36 +04:00
Alice Mikhaylenko
26aecbb006 tmp: Add libadwaita styles 2024-03-20 23:11:36 +04:00
Alice Mikhaylenko
17ccb849b3 csskeyframes: Support variables 2024-03-20 23:11:36 +04:00
Alice Mikhaylenko
4a3894e820 cssanimation: Recompute values while playing
This will be necessary for supporting variables in animations.
2024-03-20 23:11:36 +04:00
Alice Mikhaylenko
156a7450be cssvalue: Pass an extra GtkCssVariableSet to compute()
This will be useful for supporting variables in @keyframes.
2024-03-20 23:11:35 +04:00
Alice Mikhaylenko
b7988d133d Implement basic support for CSS variables 2024-03-20 22:46:32 +04:00
Alice Mikhaylenko
1baaeeb048 cssvalue: Add contains_variables()
We'll need this to know which values to recompute for animations.
2024-03-20 22:46:32 +04:00
Alice Mikhaylenko
63f489dc64 csstokenizer: Add save() and restore()
We'll need that to check if property values contain variables.
2024-03-20 22:46:32 +04:00
Alice Mikhaylenko
3323f08c75 cssselector: Support :root
This is useful for defining global variables.
2024-03-20 22:46:32 +04:00
Alice Mikhaylenko
35060aae8d cssprovider: Copy bytes when loading
We'll need to keep accessing them later to compute values with variables,
so we can't avoid this anymore.
2024-03-20 22:46:32 +04:00
Alice Mikhaylenko
c6c13ded6a csstokenizer: Fix an out of bounds when reading an ident followed by EOG
TODO: Split this into a separate MR, it's a preexisting bug.
2024-03-20 22:46:32 +04:00
621 changed files with 18133 additions and 25511 deletions

View File

@@ -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

Binary file not shown.

View 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

View File

@@ -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 \

View File

@@ -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).

212
NEWS
View File

@@ -1,216 +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
- Support variables and custom properties
* Icontheme:
- Make symbolic svg loading more efficient
- Handle color-free symbolics more efficiently
* Accessibility:
- Make the gtk-demo sidebar search more accessible
- Stop emitting focus events
- Realize child contexts when necessary
* GDK:
- Support XDG_ACTIVATION_TOKEN
- dmabuf: Be more defensive when importing unknown formats to GL
- dmabuf: Use narrow range for YUV
- vulkan: Recreate swapchains when necessary or beneficial
* GSK:
- Improve logging for GDK_DEBUG=offload
- Improve logging for GSK_DEBUG=renderer
- gpu: Warn about inefficient texture import
- gpu: Handle tiny offscreens correctly
- vulkan: Add profiler marks in various places
- vulkan: Fix a problem with imported dmabufs showing up black
- cairo: Speed up mask nodes, since we use them for symbolic icons
* Wayland:
- Use wl_compositor version 6
* X11:
- Implement a missing method
* Build:
- Fix many ubsan warnings
* Debugging:
- Show more texture details in the recorder
* macOS:
- Fix problems with events handed back to the OS
- Respect GDK_DEBUG=default-settings
* Translation updates:
Korean
Portuguese
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
========================================= =========================================

View File

@@ -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:

View File

@@ -185,8 +185,9 @@
"builddir" : true, "builddir" : true,
"config-opts" : [ "config-opts" : [
"--libdir=/app/lib", "--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized", "-Dbuildtype=debugoptimized",
"-Dprofile=devel" "-Ddemo-profile=devel"
], ],
"sources" : [ "sources" : [
{ {

View File

@@ -114,8 +114,9 @@
"builddir" : true, "builddir" : true,
"config-opts" : [ "config-opts" : [
"--libdir=/app/lib", "--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized", "-Dbuildtype=debugoptimized",
"-Dprofile=devel" "-Ddemo-profile=devel"
], ],
"sources" : [ "sources" : [
{ {

View File

@@ -114,8 +114,9 @@
"builddir" : true, "builddir" : true,
"config-opts" : [ "config-opts" : [
"--libdir=/app/lib", "--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized", "-Dbuildtype=debugoptimized",
"-Dprofile=devel" "-Ddemo-profile=devel"
], ],
"sources" : [ "sources" : [
{ {
@@ -130,6 +131,7 @@
"env" : { "env" : {
"DBUS_SESSION_BUS_ADDRESS" : "''", "DBUS_SESSION_BUS_ADDRESS" : "''",
"GSK_RENDERER" : "opengl", "GSK_RENDERER" : "opengl",
"GDK_DEBUG" : "vulkan-disable",
"G_ENABLE_DEBUG" : "true" "G_ENABLE_DEBUG" : "true"
} }
} }

View File

@@ -114,8 +114,9 @@
"builddir" : true, "builddir" : true,
"config-opts" : [ "config-opts" : [
"--libdir=/app/lib", "--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized", "-Dbuildtype=debugoptimized",
"-Dprofile=devel" "-Ddemo-profile=devel"
], ],
"sources" : [ "sources" : [
{ {
@@ -130,6 +131,7 @@
"env" : { "env" : {
"DBUS_SESSION_BUS_ADDRESS" : "''", "DBUS_SESSION_BUS_ADDRESS" : "''",
"GSK_RENDERER" : "opengl", "GSK_RENDERER" : "opengl",
"GDK_DEBUG" : "vulkan-disable",
"G_ENABLE_DEBUG" : "true" "G_ENABLE_DEBUG" : "true"
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -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);
} }

File diff suppressed because it is too large Load Diff

View File

@@ -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>

View 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;
} }

View File

@@ -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

View File

@@ -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--;

View File

@@ -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);

View File

@@ -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);

View File

@@ -2,7 +2,7 @@
<interface> <interface>
<menu id="menubar"> <menu id="menubar">
<submenu> <submenu>
<attribute name="label" translatable="yes">_File</attribute> <attribute name="label" translatable="yes">_Application</attribute>
<section> <section>
<item> <item>
<attribute name="label" translatable="yes">_New</attribute> <attribute name="label" translatable="yes">_New</attribute>
@@ -33,7 +33,7 @@
</section> </section>
</submenu> </submenu>
<submenu> <submenu>
<attribute name="label" translatable="yes">_Preferences</attribute> <attribute name="label" translatable="yes">_File</attribute>
<section> <section>
<item> <item>
<attribute name="label" translatable="yes">_Prefer Dark Theme</attribute> <attribute name="label" translatable="yes">_Prefer Dark Theme</attribute>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -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);

View File

@@ -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

View File

@@ -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]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -74,7 +74,6 @@ in a selector, widget names must be prefixed with a &num; 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) | |

View File

@@ -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.

View File

@@ -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>

View File

@@ -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>

View File

@@ -8,9 +8,6 @@ gtk4-demo-application
Demonstrate GtkApplication Demonstrate GtkApplication
-------------------------- --------------------------
:Version: GTK
:Manual section: 1
:Manual group: GTK commands
SYNOPSIS SYNOPSIS
-------- --------

View File

@@ -8,10 +8,6 @@ gtk4-demo
Demonstrate GTK widgets Demonstrate GTK widgets
----------------------- -----------------------
:Version: GTK
:Manual section: 1
:Manual group: GTK commands
SYNOPSIS SYNOPSIS
-------- --------

View File

@@ -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
-------- --------

View File

@@ -8,10 +8,6 @@ gtk4-icon-browser
List themed icons List themed icons
----------------- -----------------
:Version: GTK
:Manual section: 1
:Manual group: GTK commands
SYNOPSIS SYNOPSIS
-------- --------

View File

@@ -8,10 +8,6 @@ gtk4-launch
Launch an application Launch an application
--------------------- ---------------------
:Version: GTK
:Manual section: 1
:Manual group: GTK commands
SYNOPSIS SYNOPSIS
-------- --------

View File

@@ -8,10 +8,6 @@ gtk4-node-editor
Editor render nodes Editor render nodes
----------------- -----------------
:Version: GTK
:Manual section: 1
:Manual group: GTK commands
SYNOPSIS SYNOPSIS
-------- --------

View File

@@ -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>

View File

@@ -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
-------- --------

View File

@@ -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.`

View File

@@ -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
-------- --------

View File

@@ -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
-------- --------

View File

@@ -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', ],

View File

@@ -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/

View File

@@ -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.

View File

@@ -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.

View File

@@ -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

View File

@@ -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">

View File

@@ -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);
} }
} }

View File

@@ -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',

View File

@@ -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;
} }

View File

@@ -41,10 +41,8 @@ G_BEGIN_DECLS
#ifdef GDK_ARRAY_NULL_TERMINATED #ifdef GDK_ARRAY_NULL_TERMINATED
#define GDK_ARRAY_REAL_SIZE(_size) ((_size) + 1) #define GDK_ARRAY_REAL_SIZE(_size) ((_size) + 1)
#define GDK_ARRAY_MAX_SIZE (G_MAXSIZE / sizeof (_T_) - 1)
#else #else
#define GDK_ARRAY_REAL_SIZE(_size) (_size) #define GDK_ARRAY_REAL_SIZE(_size) (_size)
#define GDK_ARRAY_MAX_SIZE (G_MAXSIZE / sizeof (_T_))
#endif #endif
/* make this readable */ /* make this readable */
@@ -179,23 +177,18 @@ G_GNUC_UNUSED static inline void
gdk_array(reserve) (GdkArray *self, gdk_array(reserve) (GdkArray *self,
gsize n) gsize n)
{ {
gsize new_capacity, size, capacity; gsize new_size, size;
if (G_UNLIKELY (n > GDK_ARRAY_MAX_SIZE)) if (n <= gdk_array(get_capacity) (self))
g_error ("requesting array size of %zu, but maximum size is %zu", n, GDK_ARRAY_MAX_SIZE); return;
capacity = gdk_array(get_capacity) (self);
if (n <= capacity)
return;
size = gdk_array(get_size) (self); size = gdk_array(get_size) (self);
/* capacity * 2 can overflow, that's why we MAX() */ new_size = ((gsize) 1) << g_bit_storage (MAX (GDK_ARRAY_REAL_SIZE (n), 16) - 1);
new_capacity = MAX (GDK_ARRAY_REAL_SIZE (n), capacity * 2);
#ifdef GDK_ARRAY_PREALLOC #ifdef GDK_ARRAY_PREALLOC
if (self->start == self->preallocated) if (self->start == self->preallocated)
{ {
self->start = g_new (_T_, new_capacity); self->start = g_new (_T_, new_size);
memcpy (self->start, self->preallocated, sizeof (_T_) * GDK_ARRAY_REAL_SIZE (size)); memcpy (self->start, self->preallocated, sizeof (_T_) * GDK_ARRAY_REAL_SIZE (size));
} }
else else
@@ -203,15 +196,15 @@ gdk_array(reserve) (GdkArray *self,
#ifdef GDK_ARRAY_NULL_TERMINATED #ifdef GDK_ARRAY_NULL_TERMINATED
if (self->start == NULL) if (self->start == NULL)
{ {
self->start = g_new (_T_, new_capacity); self->start = g_new (_T_, new_size);
*self->start = *(_T_[1]) { 0 }; *self->start = *(_T_[1]) { 0 };
} }
else else
#endif #endif
self->start = g_renew (_T_, self->start, new_capacity); self->start = g_renew (_T_, self->start, new_size);
self->end = self->start + size; self->end = self->start + size;
self->end_allocation = self->start + new_capacity; self->end_allocation = self->start + new_size;
#ifdef GDK_ARRAY_NULL_TERMINATED #ifdef GDK_ARRAY_NULL_TERMINATED
self->end_allocation--; self->end_allocation--;
#endif #endif
@@ -319,7 +312,6 @@ gdk_array(get) (const GdkArray *self,
#undef gdk_array_paste #undef gdk_array_paste
#undef gdk_array #undef gdk_array
#undef GDK_ARRAY_REAL_SIZE #undef GDK_ARRAY_REAL_SIZE
#undef GDK_ARRAY_MAX_SIZE
#undef GDK_ARRAY_BY_VALUE #undef GDK_ARRAY_BY_VALUE
#undef GDK_ARRAY_ELEMENT_TYPE #undef GDK_ARRAY_ELEMENT_TYPE

View File

@@ -156,9 +156,6 @@ gdk_cursor_finalize (GObject *object)
g_clear_object (&cursor->texture); g_clear_object (&cursor->texture);
g_clear_object (&cursor->fallback); g_clear_object (&cursor->fallback);
if (cursor->destroy)
cursor->destroy (cursor->data);
G_OBJECT_CLASS (gdk_cursor_parent_class)->finalize (object); G_OBJECT_CLASS (gdk_cursor_parent_class)->finalize (object);
} }
@@ -256,11 +253,6 @@ 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)
{
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;
@@ -289,10 +281,6 @@ gdk_cursor_equal (gconstpointer a,
ca->hotspot_y != cb->hotspot_y) ca->hotspot_y != cb->hotspot_y)
return FALSE; return FALSE;
if (ca->callback != cb->callback ||
ca->data != cb->data)
return FALSE;
return TRUE; return TRUE;
} }
@@ -367,45 +355,6 @@ gdk_cursor_new_from_texture (GdkTexture *texture,
NULL); NULL);
} }
/**
* gdk_cursor_new_from_callback:
* @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 callback-based cursor object.
*
* Cursors of this kind 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_from_callback (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_get_fallback: (attributes org.gtk.Method.get_property=fallback) * gdk_cursor_get_fallback: (attributes org.gtk.Method.get_property=fallback)
* @cursor: a `GdkCursor` * @cursor: a `GdkCursor`
@@ -510,22 +459,3 @@ gdk_cursor_get_hotspot_y (GdkCursor *cursor)
return cursor->hotspot_y; return cursor->hotspot_y;
} }
GdkTexture *
gdk_cursor_get_texture_for_size (GdkCursor *cursor,
int cursor_size,
double scale,
int *width,
int *height,
int *hotspot_x,
int *hotspot_y)
{
if (cursor->callback == NULL)
return NULL;
return cursor->callback (cursor,
cursor_size, scale,
width, height,
hotspot_x, hotspot_y,
cursor->data);
}

View File

@@ -51,52 +51,6 @@ 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);
/**
* 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 (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,
int cursor_size,
double scale,
int *width,
int *height,
int *hotspot_x,
int *hotspot_y,
gpointer data);
GDK_AVAILABLE_IN_4_16
GdkCursor * gdk_cursor_new_from_callback (GdkCursorGetTextureCallback callback,
gpointer data,
GDestroyNotify destroy,
GdkCursor *fallback);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
GdkCursor * gdk_cursor_get_fallback (GdkCursor *cursor); GdkCursor * gdk_cursor_get_fallback (GdkCursor *cursor);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL

View File

@@ -44,10 +44,6 @@ struct _GdkCursor
GdkTexture *texture; GdkTexture *texture;
int hotspot_x; int hotspot_x;
int hotspot_y; int hotspot_y;
GdkCursorGetTextureCallback callback;
gpointer data;
GDestroyNotify destroy;
}; };
struct _GdkCursorClass struct _GdkCursorClass
@@ -59,13 +55,5 @@ 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,
int cursor_size,
double scale,
int *width,
int *height,
int *hotspot_x,
int *hotspot_y);
G_END_DECLS G_END_DECLS

View File

@@ -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,

View File

@@ -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

View File

@@ -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);

View File

@@ -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,

View File

@@ -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);

View File

@@ -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);
}
}

View File

@@ -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

View File

@@ -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,

View File

@@ -50,6 +50,18 @@
#include "gdkenumtypes.h" #include "gdkenumtypes.h"
#include "gdkeventsprivate.h" #include "gdkeventsprivate.h"
static struct {
GdkDragAction action;
const char *name;
GdkCursor *cursor;
} drag_cursors[] = {
{ GDK_ACTION_ASK, "dnd-ask", NULL },
{ GDK_ACTION_COPY, "copy", NULL },
{ GDK_ACTION_MOVE, "move", NULL },
{ GDK_ACTION_LINK, "alias", NULL },
{ 0, "no-drop", NULL },
};
enum { enum {
PROP_0, PROP_0,
PROP_CONTENT, PROP_CONTENT,
@@ -774,20 +786,6 @@ gdk_drag_handle_source_event (GdkEvent *event)
return FALSE; return FALSE;
} }
static struct {
GdkDragAction action;
const char *name;
GdkCursor *cursor;
} drag_cursors[] = {
{ 0, "default", NULL },
{ GDK_ACTION_ASK, "dnd-ask", NULL },
{ GDK_ACTION_COPY, "copy", NULL },
{ GDK_ACTION_MOVE, "dnd-move", NULL }, /* Not using move here, since move is stuck using
* a mismatched visual metaphor in Adwaita
*/
{ GDK_ACTION_LINK, "alias", NULL },
};
GdkCursor * GdkCursor *
gdk_drag_get_cursor (GdkDrag *drag, gdk_drag_get_cursor (GdkDrag *drag,
GdkDragAction action) GdkDragAction action)

View File

@@ -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

View File

@@ -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

View File

@@ -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));
}

View File

@@ -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

View File

@@ -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

View File

@@ -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;
} }
/** /**

View File

@@ -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

View File

@@ -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);
}

View File

@@ -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

View File

@@ -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))
{ {

View File

@@ -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;
@@ -607,8 +603,7 @@ physical_device_check_features (VkPhysicalDevice device)
features |= GDK_VULKAN_FEATURE_YCBCR; features |= GDK_VULKAN_FEATURE_YCBCR;
if (physical_device_supports_extension (device, VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME) && if (physical_device_supports_extension (device, VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME) &&
physical_device_supports_extension (device, VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME) && physical_device_supports_extension (device, VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME))
physical_device_supports_extension (device, VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME))
features |= GDK_VULKAN_FEATURE_DMABUF; features |= GDK_VULKAN_FEATURE_DMABUF;
if (physical_device_supports_extension (device, VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME)) if (physical_device_supports_extension (device, VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME))
@@ -633,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)
@@ -655,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]);
} }
@@ -1130,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;
@@ -1152,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)
{ {
@@ -1171,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,
@@ -1213,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;
} }
@@ -1261,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);
} }
} }
@@ -1375,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;
@@ -1518,7 +1484,6 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME); g_ptr_array_add (device_extensions, (gpointer) VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME);
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME); g_ptr_array_add (device_extensions, (gpointer) VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME);
g_ptr_array_add (device_extensions, (gpointer) VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME);
g_ptr_array_add (device_extensions, (gpointer) VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME); g_ptr_array_add (device_extensions, (gpointer) VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME);
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME); g_ptr_array_add (device_extensions, (gpointer) VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME);
@@ -1585,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;
} }
} }
@@ -1625,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;
@@ -1787,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;
} }

View File

@@ -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);

View File

@@ -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);

View File

@@ -296,6 +296,10 @@ typedef NSString *CALayerContentsGravity;
GdkMonitor *monitor; GdkMonitor *monitor;
GdkRectangle geometry; GdkRectangle geometry;
GdkRectangle workarea; GdkRectangle workarea;
int shadow_top = 0;
int shadow_left = 0;
int shadow_right = 0;
int shadow_bottom = 0;
GdkRectangle window_gdk; GdkRectangle window_gdk;
GdkPoint pointer_position; GdkPoint pointer_position;
GdkPoint new_origin; GdkPoint new_origin;
@@ -303,6 +307,13 @@ typedef NSString *CALayerContentsGravity;
if (!inManualMove) if (!inManualMove)
return NO; return NO;
/* Get our shadow so we can adjust the window position sans-shadow */
_gdk_macos_surface_get_shadow (gdk_surface,
&shadow_top,
&shadow_right,
&shadow_bottom,
&shadow_left);
windowFrame = [self frame]; windowFrame = [self frame];
currentLocation = [NSEvent mouseLocation]; currentLocation = [NSEvent mouseLocation];
@@ -328,9 +339,21 @@ typedef NSString *CALayerContentsGravity;
window_gdk.width = windowFrame.size.width; window_gdk.width = windowFrame.size.width;
window_gdk.height = windowFrame.size.height; window_gdk.height = windowFrame.size.height;
/* Subtract our shadowin from the window */
window_gdk.x += shadow_left;
window_gdk.y += shadow_top;
window_gdk.width = window_gdk.width - shadow_left - shadow_right;
window_gdk.height = window_gdk.height - shadow_top - shadow_bottom;
/* Now place things on the monitor */ /* Now place things on the monitor */
_edge_snapping_motion (&self->snapping, &pointer_position, &window_gdk); _edge_snapping_motion (&self->snapping, &pointer_position, &window_gdk);
/* And add our shadow back to the frame */
window_gdk.x -= shadow_left;
window_gdk.y -= shadow_top;
window_gdk.width += shadow_left + shadow_right;
window_gdk.height += shadow_top + shadow_bottom;
/* Convert to quartz coordinates */ /* Convert to quartz coordinates */
_gdk_macos_display_to_display_coords ([self gdkDisplay], _gdk_macos_display_to_display_coords ([self gdkDisplay],
window_gdk.x, window_gdk.x,
@@ -714,11 +737,17 @@ typedef NSString *CALayerContentsGravity;
-(NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen -(NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen
{ {
GdkMacosSurface *surface = gdk_surface;
NSRect rect; NSRect rect;
int shadow_top;
/* Allow the window to move up "shadow_top" more than normally allowed
* by the default impl. This makes it possible to move windows with
* client side shadow right up to the screen's menu bar. */
_gdk_macos_surface_get_shadow (surface, &shadow_top, NULL, NULL, NULL);
rect = [super constrainFrameRect:frameRect toScreen:screen]; rect = [super constrainFrameRect:frameRect toScreen:screen];
if (frameRect.origin.y > rect.origin.y) if (frameRect.origin.y > rect.origin.y)
rect.origin.y = MIN (frameRect.origin.y, rect.origin.y); rect.origin.y = MIN (frameRect.origin.y, rect.origin.y + shadow_top);
return rect; return rect;
} }

View File

@@ -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,9 @@ _gdk_macos_cursor_get_ns_cursor (GdkCursor *cursor)
if (name == NULL) if (name == NULL)
{ {
GdkTexture *texture; nscursor = create_cursor_from_texture (gdk_cursor_get_texture (cursor),
int hotspot_x, hotspot_y; gdk_cursor_get_hotspot_x (cursor),
gdk_cursor_get_hotspot_y (cursor));
texture = gdk_cursor_get_texture (cursor);
hotspot_x = gdk_cursor_get_hotspot_x (cursor);
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;
} }
} }

View File

@@ -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);

View File

@@ -47,20 +47,20 @@ _gdk_macos_display_position_toplevel_with_parent (GdkMacosDisplay *self,
/* Try to center on top of the parent but also try to make the whole thing /* Try to center on top of the parent but also try to make the whole thing
* visible in case that lands us under the topbar/panel/etc. * visible in case that lands us under the topbar/panel/etc.
*/ */
parent_rect.x = parent->root_x; parent_rect.x = parent->root_x + parent->shadow_left;
parent_rect.y = parent->root_y; parent_rect.y = parent->root_y + parent->shadow_top;
parent_rect.width = GDK_SURFACE (parent)->width; parent_rect.width = GDK_SURFACE (parent)->width - parent->shadow_left - parent->shadow_right;
parent_rect.height = GDK_SURFACE (parent)->height; parent_rect.height = GDK_SURFACE (parent)->height - parent->shadow_top - parent->shadow_bottom;
surface_rect.width = GDK_SURFACE (surface)->width; surface_rect.width = GDK_SURFACE (surface)->width - surface->shadow_left - surface->shadow_right;
surface_rect.height = GDK_SURFACE (surface)->height; surface_rect.height = GDK_SURFACE (surface)->height - surface->shadow_top - surface->shadow_bottom;
surface_rect.x = parent_rect.x + ((parent_rect.width - surface_rect.width) / 2); surface_rect.x = parent_rect.x + ((parent_rect.width - surface_rect.width) / 2);
surface_rect.y = parent_rect.y + ((parent_rect.height - surface_rect.height) / 2); surface_rect.y = parent_rect.y + ((parent_rect.height - surface_rect.height) / 2);
_gdk_macos_monitor_clamp (GDK_MACOS_MONITOR (monitor), &surface_rect); _gdk_macos_monitor_clamp (GDK_MACOS_MONITOR (monitor), &surface_rect);
*x = surface_rect.x; *x = surface_rect.x - surface->shadow_left;
*y = surface_rect.y; *y = surface_rect.y - surface->shadow_top;
} }
static inline gboolean static inline gboolean
@@ -99,15 +99,15 @@ _gdk_macos_display_position_toplevel (GdkMacosDisplay *self,
gdk_macos_monitor_get_workarea (monitor, &workarea); gdk_macos_monitor_get_workarea (monitor, &workarea);
/* First place at top-left of current monitor */ /* First place at top-left of current monitor */
surface_rect.width = GDK_SURFACE (surface)->width; surface_rect.width = GDK_SURFACE (surface)->width - surface->shadow_left - surface->shadow_right;
surface_rect.height = GDK_SURFACE (surface)->height; surface_rect.height = GDK_SURFACE (surface)->height - surface->shadow_top - surface->shadow_bottom;
surface_rect.x = workarea.x + ((workarea.width - surface_rect.width) / 2); surface_rect.x = workarea.x + ((workarea.width - surface_rect.width) / 2);
surface_rect.y = workarea.y + ((workarea.height - surface_rect.height) / 2); surface_rect.y = workarea.y + ((workarea.height - surface_rect.height) / 2);
_gdk_macos_monitor_clamp (GDK_MACOS_MONITOR (surface->best_monitor), &surface_rect); _gdk_macos_monitor_clamp (GDK_MACOS_MONITOR (surface->best_monitor), &surface_rect);
*x = surface_rect.x; *x = surface_rect.x - surface->shadow_left;
*y = surface_rect.y; *y = surface_rect.y - surface->shadow_top;
/* Try to see if there are any other surfaces at this origin and if so, /* Try to see if there are any other surfaces at this origin and if so,
* adjust until we get something better. * adjust until we get something better.
@@ -119,11 +119,11 @@ _gdk_macos_display_position_toplevel (GdkMacosDisplay *self,
*y += WARP_OFFSET_Y; *y += WARP_OFFSET_Y;
/* If we reached the bottom right, just bail and try the workspace origin */ /* If we reached the bottom right, just bail and try the workspace origin */
if (*x + WARP_OFFSET_X > workarea.x + workarea.width || if (*x + surface->shadow_left + WARP_OFFSET_X > workarea.x + workarea.width ||
*y + WARP_OFFSET_Y > workarea.y + workarea.height) *y + surface->shadow_top + WARP_OFFSET_Y > workarea.y + workarea.height)
{ {
*x = workarea.x; *x = workarea.x - surface->shadow_left;
*y = workarea.y; *y = workarea.y - surface->shadow_top;
return; return;
} }
} }

View File

@@ -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;

View File

@@ -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];
} }

View File

@@ -68,10 +68,19 @@ gdk_macos_popup_surface_layout (GdkMacosPopupSurface *self,
monitor = _gdk_macos_surface_get_best_monitor (GDK_MACOS_SURFACE (self)); monitor = _gdk_macos_surface_get_best_monitor (GDK_MACOS_SURFACE (self));
gdk_macos_monitor_get_workarea (monitor, &bounds); gdk_macos_monitor_get_workarea (monitor, &bounds);
gdk_popup_layout_get_shadow_width (layout,
&self->parent_instance.shadow_left,
&self->parent_instance.shadow_right,
&self->parent_instance.shadow_top,
&self->parent_instance.shadow_bottom);
gdk_surface_layout_popup_helper (GDK_SURFACE (self), gdk_surface_layout_popup_helper (GDK_SURFACE (self),
width, width,
height, height,
0, 0, 0, 0, /* shadow-left/right/top/bottom */ self->parent_instance.shadow_left,
self->parent_instance.shadow_right,
self->parent_instance.shadow_top,
self->parent_instance.shadow_bottom,
monitor, monitor,
&bounds, &bounds,
self->layout, self->layout,

View File

@@ -61,6 +61,11 @@ struct _GdkMacosSurface
int height; int height;
} next_layout; } next_layout;
int shadow_top;
int shadow_right;
int shadow_bottom;
int shadow_left;
cairo_rectangle_int_t next_frame; cairo_rectangle_int_t next_frame;
gint64 pending_frame_counter; gint64 pending_frame_counter;
@@ -86,6 +91,16 @@ CGDirectDisplayID _gdk_macos_surface_get_screen_id (GdkMacosSurface
const char *_gdk_macos_surface_get_title (GdkMacosSurface *self); const char *_gdk_macos_surface_get_title (GdkMacosSurface *self);
void _gdk_macos_surface_set_title (GdkMacosSurface *self, void _gdk_macos_surface_set_title (GdkMacosSurface *self,
const char *title); const char *title);
void _gdk_macos_surface_get_shadow (GdkMacosSurface *self,
int *top,
int *right,
int *bottom,
int *left);
void _gdk_macos_surface_set_shadow (GdkMacosSurface *self,
int top,
int right,
int bottom,
int left);
gboolean _gdk_macos_surface_is_opaque (GdkMacosSurface *self); gboolean _gdk_macos_surface_is_opaque (GdkMacosSurface *self);
NSView *_gdk_macos_surface_get_view (GdkMacosSurface *self); NSView *_gdk_macos_surface_get_view (GdkMacosSurface *self);
gboolean _gdk_macos_surface_get_modal_hint (GdkMacosSurface *self); gboolean _gdk_macos_surface_get_modal_hint (GdkMacosSurface *self);

View File

@@ -236,6 +236,32 @@ gdk_macos_surface_get_scale (GdkSurface *surface)
return [self->window backingScaleFactor]; return [self->window backingScaleFactor];
} }
void
_gdk_macos_surface_set_shadow (GdkMacosSurface *surface,
int top,
int right,
int bottom,
int left)
{
GdkMacosSurface *self = (GdkMacosSurface *)surface;
g_assert (GDK_IS_MACOS_SURFACE (self));
if (self->shadow_top == top &&
self->shadow_right == right &&
self->shadow_bottom == bottom &&
self->shadow_left == left)
return;
self->shadow_top = top;
self->shadow_right = right;
self->shadow_bottom = bottom;
self->shadow_left = left;
if (top || right || bottom || left)
[self->window setHasShadow:NO];
}
static void static void
gdk_macos_surface_begin_frame (GdkMacosSurface *self) gdk_macos_surface_begin_frame (GdkMacosSurface *self)
{ {
@@ -553,6 +579,29 @@ gdk_macos_surface_init (GdkMacosSurface *self)
self->monitors = g_ptr_array_new_with_free_func (g_object_unref); self->monitors = g_ptr_array_new_with_free_func (g_object_unref);
} }
void
_gdk_macos_surface_get_shadow (GdkMacosSurface *self,
int *top,
int *right,
int *bottom,
int *left)
{
g_return_if_fail (GDK_IS_MACOS_SURFACE (self));
if (top)
*top = self->shadow_top;
if (left)
*left = self->shadow_left;
if (bottom)
*bottom = self->shadow_bottom;
if (right)
*right = self->shadow_right;
}
gboolean gboolean
_gdk_macos_surface_is_opaque (GdkMacosSurface *self) _gdk_macos_surface_is_opaque (GdkMacosSurface *self)
{ {
@@ -1048,12 +1097,16 @@ _gdk_macos_surface_monitor_changed (GdkMacosSurface *self)
g_set_object (&child->best_monitor, best); g_set_object (&child->best_monitor, best);
area.x = self->root_x + GDK_SURFACE (child)->x; area.x = self->root_x + GDK_SURFACE (child)->x + child->shadow_left;
area.y = self->root_y + GDK_SURFACE (child)->y; area.y = self->root_y + GDK_SURFACE (child)->y + child->shadow_top;
area.width = GDK_SURFACE (child)->width; area.width = GDK_SURFACE (child)->width - child->shadow_left - child->shadow_right;
area.height = GDK_SURFACE (child)->height; area.height = GDK_SURFACE (child)->height - child->shadow_top - child->shadow_bottom;
_gdk_macos_monitor_clamp (GDK_MACOS_MONITOR (best), &area); _gdk_macos_monitor_clamp (GDK_MACOS_MONITOR (best), &area);
area.x -= child->shadow_left;
area.y -= child->shadow_top;
_gdk_macos_surface_move (child, area.x, area.y); _gdk_macos_surface_move (child, area.x, area.y);
gdk_surface_invalidate_rect (GDK_SURFACE (child), NULL); gdk_surface_invalidate_rect (GDK_SURFACE (child), NULL);
} }

View File

@@ -152,6 +152,13 @@ _gdk_macos_toplevel_surface_compute_size (GdkSurface *surface)
mask = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE; mask = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE;
} }
if (size.shadow.is_valid)
_gdk_macos_surface_set_shadow (macos_surface,
size.shadow.top,
size.shadow.right,
size.shadow.bottom,
size.shadow.left);
_gdk_macos_surface_set_geometry_hints (macos_surface, &geometry, mask); _gdk_macos_surface_set_geometry_hints (macos_surface, &geometry, mask);
if (surface->state & (GDK_TOPLEVEL_STATE_FULLSCREEN | if (surface->state & (GDK_TOPLEVEL_STATE_FULLSCREEN |

View File

@@ -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: [],

View File

@@ -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],
) )

View File

@@ -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

View File

@@ -79,7 +79,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" },
@@ -155,39 +154,31 @@ static const struct wl_buffer_listener buffer_listener = {
struct wl_buffer * struct wl_buffer *
_gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display, _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
GdkCursor *cursor, GdkCursor *cursor,
double desired_scale, guint desired_scale,
gboolean use_viewporter,
guint image_index, guint image_index,
int *hotspot_x, int *hotspot_x,
int *hotspot_y, int *hotspot_y,
int *width, int *width,
int *height, int *height,
double *scale) int *scale)
{ {
GdkTexture *texture; GdkTexture *texture;
if (gdk_cursor_get_name (cursor)) if (gdk_cursor_get_name (cursor))
{ {
struct wl_cursor *c; struct wl_cursor *c;
int scale_factor;
if (g_str_equal (gdk_cursor_get_name (cursor), "none")) if (g_str_equal (gdk_cursor_get_name (cursor), "none"))
{ goto none;
*hotspot_x = *hotspot_y = 0;
*width = *height = 0;
*scale = 1;
return NULL;
}
scale_factor = (int) ceil (desired_scale);
c = gdk_wayland_cursor_load_for_name (display, c = gdk_wayland_cursor_load_for_name (display,
display->cursor_theme, _gdk_wayland_display_get_cursor_theme (display),
scale_factor, desired_scale,
gdk_cursor_get_name (cursor)); gdk_cursor_get_name (cursor));
if (c && c->image_count > 0) if (c && c->image_count > 0)
{ {
struct wl_cursor_image *image; struct wl_cursor_image *image;
int cursor_scale;
if (image_index >= c->image_count) if (image_index >= c->image_count)
{ {
@@ -199,27 +190,27 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
image = c->images[image_index]; image = c->images[image_index];
*width = display->cursor_theme_size; cursor_scale = desired_scale;
*height = display->cursor_theme_size; if ((image->width % cursor_scale != 0) ||
*scale = image->width / (double) *width; (image->height % cursor_scale != 0))
*hotspot_x = image->hotspot_x / scale_factor;
*hotspot_y = image->hotspot_y / scale_factor;
if (*scale != scale_factor && !use_viewporter)
{ {
g_warning (G_STRLOC " cursor image size (%d) not an integer " g_warning (G_STRLOC " cursor image size (%dx%d) not an integer "
"multiple of theme size (%d)", image->width, *width); "multiple of scale (%d)", image->width, image->height,
*width = image->width; cursor_scale);
*height = image->height; cursor_scale = 1;
*hotspot_x = image->hotspot_x;
*hotspot_y = image->hotspot_y;
*scale = 1;
} }
*hotspot_x = image->hotspot_x / cursor_scale;
*hotspot_y = image->hotspot_y / cursor_scale;
*width = image->width / cursor_scale;
*height = image->height / cursor_scale;
*scale = cursor_scale;
return wl_cursor_image_get_buffer (image); return wl_cursor_image_get_buffer (image);
} }
} }
else if (gdk_cursor_get_texture (cursor)) else
{ {
cairo_surface_t *surface; cairo_surface_t *surface;
struct wl_buffer *buffer; struct wl_buffer *buffer;
@@ -258,63 +249,29 @@ from_texture:
return buffer; return buffer;
} }
else
{
if (!use_viewporter)
*scale = ceil (desired_scale);
else
*scale = desired_scale;
texture = gdk_cursor_get_texture_for_size (cursor,
display->cursor_theme_size,
*scale,
width,
height,
hotspot_x,
hotspot_y);
if (texture)
{
cairo_surface_t *surface;
struct wl_buffer *buffer;
surface = gdk_wayland_display_create_shm_surface (display,
gdk_texture_get_width (texture),
gdk_texture_get_height (texture),
&GDK_FRACTIONAL_SCALE_INIT_INT (1));
gdk_texture_download (texture,
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))
{ return _gdk_wayland_cursor_get_buffer (display,
return _gdk_wayland_cursor_get_buffer (display, gdk_cursor_get_fallback (cursor),
gdk_cursor_get_fallback (cursor), desired_scale,
desired_scale, image_index,
use_viewporter, hotspot_x, hotspot_y,
image_index, width, height,
hotspot_x, hotspot_y, scale);
width, height,
scale);
}
else else
{ {
texture = gdk_texture_new_from_resource ("/org/gtk/libgdk/cursor/default"); texture = gdk_texture_new_from_resource ("/org/gtk/libgdk/cursor/default");
goto from_texture; goto from_texture;
} }
g_assert_not_reached (); none:
*hotspot_x = 0;
*hotspot_y = 0;
*width = 0;
*height = 0;
*scale = 1;
return NULL;
} }
guint guint

View File

@@ -62,7 +62,6 @@ struct _GdkWaylandPointerData {
uint32_t grab_time; uint32_t grab_time;
struct wl_surface *pointer_surface; struct wl_surface *pointer_surface;
struct wp_viewport *pointer_surface_viewport;
guint cursor_is_default: 1; guint cursor_is_default: 1;
GdkCursor *cursor; GdkCursor *cursor;
guint cursor_timeout_id; guint cursor_timeout_id;
@@ -70,7 +69,7 @@ struct _GdkWaylandPointerData {
guint cursor_image_delay; guint cursor_image_delay;
guint touchpad_event_sequence; guint touchpad_event_sequence;
double current_output_scale; guint current_output_scale;
GSList *pointer_surface_outputs; GSList *pointer_surface_outputs;
/* Accumulated event data for a pointer frame */ /* Accumulated event data for a pointer frame */
@@ -183,8 +182,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;

View File

@@ -260,25 +260,18 @@ gdk_wayland_device_update_surface_cursor (GdkDevice *device)
GdkWaylandPointerData *pointer = GdkWaylandPointerData *pointer =
gdk_wayland_device_get_pointer (wayland_device); gdk_wayland_device_get_pointer (wayland_device);
struct wl_buffer *buffer; struct wl_buffer *buffer;
int x, y, w, h; int x, y, w, h, scale;
double scale;
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->cursor_image_index, pointer->cursor_image_index,
&x, &y, &w, &h, &scale); &x, &y, &w, &h, &scale);
} }
@@ -317,17 +310,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) wl_surface_set_buffer_scale (pointer->pointer_surface, scale);
{
wp_viewport_set_source (pointer->pointer_surface_viewport,
wl_fixed_from_int (0),
wl_fixed_from_int (0),
wl_fixed_from_double (w * scale),
wl_fixed_from_double (h * scale));
wp_viewport_set_destination (pointer->pointer_surface_viewport, w, h);
}
else if (wl_surface_get_version (pointer->pointer_surface) >= WL_SURFACE_SET_BUFFER_SCALE_SINCE_VERSION)
wl_surface_set_buffer_scale (pointer->pointer_surface, scale);
wl_surface_damage (pointer->pointer_surface, 0, 0, w, h); wl_surface_damage (pointer->pointer_surface, 0, 0, w, h);
wl_surface_commit (pointer->pointer_surface); wl_surface_commit (pointer->pointer_surface);
} }

View File

@@ -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"
@@ -96,6 +95,7 @@
#define GTK_SHELL1_VERSION 5 #define GTK_SHELL1_VERSION 5
#define OUTPUT_VERSION_WITH_DONE 2 #define OUTPUT_VERSION_WITH_DONE 2
#define NO_XDG_OUTPUT_DONE_SINCE_VERSION 3 #define NO_XDG_OUTPUT_DONE_SINCE_VERSION 3
#define XDG_ACTIVATION_VERSION 1
#define OUTPUT_VERSION 3 #define OUTPUT_VERSION 3
#ifdef HAVE_TOPLEVEL_STATE_SUSPENDED #ifdef HAVE_TOPLEVEL_STATE_SUSPENDED
@@ -105,9 +105,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 +284,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 +437,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 +447,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)
@@ -503,35 +585,25 @@ gdk_registry_handle_global (void *data,
{ {
display_wayland->xdg_activation = display_wayland->xdg_activation =
wl_registry_bind (display_wayland->wl_registry, id, wl_registry_bind (display_wayland->wl_registry, id,
&xdg_activation_v1_interface, 1); &xdg_activation_v1_interface,
MIN (version, XDG_ACTIVATION_VERSION));
} }
else if (strcmp (interface, "wp_fractional_scale_manager_v1") == 0) else if (strcmp (interface, "wp_fractional_scale_manager_v1") == 0)
{ {
display_wayland->fractional_scale = display_wayland->fractional_scale =
wl_registry_bind (display_wayland->wl_registry, id, wl_registry_bind (display_wayland->wl_registry, id,
&wp_fractional_scale_manager_v1_interface, 1); &wp_fractional_scale_manager_v1_interface,
MIN (version, 1));
} }
else if (strcmp (interface, "wp_viewporter") == 0) else if (strcmp (interface, "wp_viewporter") == 0)
{ {
display_wayland->viewporter = display_wayland->viewporter =
wl_registry_bind (display_wayland->wl_registry, id, wl_registry_bind (display_wayland->wl_registry, id,
&wp_viewporter_interface, 1); &wp_viewporter_interface,
}
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)); 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));
} }
@@ -628,8 +700,7 @@ _gdk_wayland_display_open (const char *display_name)
process_on_globals_closures (display_wayland); process_on_globals_closures (display_wayland);
/* Wait for initializing to complete. This means waiting for all /* Wait for initializing to complete. This means waiting for all
* asynchronous roundtrips that were triggered during initial roundtrip. * asynchronous roundtrips that were triggered during initial roundtrip. */
*/
while (display_wayland->async_roundtrips != NULL) while (display_wayland->async_roundtrips != NULL)
{ {
if (wl_display_dispatch (display_wayland->wl_display) < 0) if (wl_display_dispatch (display_wayland->wl_display) < 0)
@@ -639,18 +710,6 @@ _gdk_wayland_display_open (const char *display_name)
} }
} }
/* Check that we got all the required globals */
if (display_wayland->compositor == NULL ||
display_wayland->shm == NULL ||
display_wayland->data_device_manager == NULL)
{
g_warning ("The Wayland compositor does not provide one or more of the required interfaces, "
"not using Wayland display");
g_object_unref (display);
return NULL;
}
if (display_wayland->xdg_wm_base_id) if (display_wayland->xdg_wm_base_id)
{ {
display_wayland->shell_variant = GDK_WAYLAND_SHELL_VARIANT_XDG_SHELL; display_wayland->shell_variant = GDK_WAYLAND_SHELL_VARIANT_XDG_SHELL;
@@ -740,10 +799,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 +1104,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 +1177,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 +1250,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 +1786,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 +1877,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 +1996,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 +2125,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 +2175,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);

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