Compare commits
269 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ae0d0fcb61 | |||
| 8a704d75dc | |||
| 6b25a375fa | |||
| 21c53a1969 | |||
| ae2dd1d907 | |||
| f10c234361 | |||
| 3a650bff66 | |||
| e9f622b81f | |||
| a85ad2ce67 | |||
| 2af7e45860 | |||
| 2741e00210 | |||
| 495411e16d | |||
| 9880f9d16a | |||
| 5c1c22156c | |||
| d7e8c52d37 | |||
| c3d3e2d47b | |||
| 9c1049e710 | |||
| a1352a88ff | |||
| 8825917140 | |||
| ba8d4902b5 | |||
| 8f3d3ca587 | |||
| aeba1e08e8 | |||
| 9f47bfe193 | |||
| 43417e9e55 | |||
| bbb7446e93 | |||
| 6623baeb52 | |||
| d90b09f8c3 | |||
| bcae6271df | |||
| fc524ed346 | |||
| c80a0c0e85 | |||
| 7572f2ed87 | |||
| 54ec750238 | |||
| 5d78cf6546 | |||
| d329b00bda | |||
| ddf1ea9917 | |||
| 215f60e450 | |||
| 87070e0bdd | |||
| 19f51b5de2 | |||
| 2d8c112f08 | |||
| f1901081a6 | |||
| cf79ad4433 | |||
| d912628583 | |||
| f254ab700c | |||
| c7b62d89e3 | |||
| 46e3454eb7 | |||
| 7573a9d2a7 | |||
| d24d193301 | |||
| e61938793a | |||
| 2f584c16f0 | |||
| 2565a28e59 | |||
| 793a2b2a70 | |||
| 146223cd74 | |||
| d8e7f0a8a9 | |||
| a9adf7163f | |||
| 10825cdc72 | |||
| 3b105a637c | |||
| fdbc203690 | |||
| 26c583227e | |||
| 1ea0bebf15 | |||
| ca0e27ec9d | |||
| 5edf9fc449 | |||
| 534f11e317 | |||
| d8cffa9350 | |||
| 60dfa777f0 | |||
| d6fc0d6c94 | |||
| 4e71bd92aa | |||
| 8aec42244e | |||
| 6ff36977f4 | |||
| ed84ccdaca | |||
| d9ec27ab29 | |||
| ca744b925e | |||
| 53c63673e4 | |||
| 431458ed78 | |||
| 56cfef3544 | |||
| be897646b1 | |||
| e23358e09f | |||
| 833e1bdcf6 | |||
| 0091425729 | |||
| b1c2a1c015 | |||
| 31d03f9f26 | |||
| 3beaf0962c | |||
| 48e49b4c50 | |||
| 1d4f383ba5 | |||
| 8cb3e01eef | |||
| 42a0dcc7e4 | |||
| e9731fc99b | |||
| 2890557236 | |||
| 43a22bb350 | |||
| cd9c277820 | |||
| 42a12f1788 | |||
| 5f39820729 | |||
| c2a8620660 | |||
| 647d5e17c1 | |||
| d87b9ee4c5 | |||
| 70ba00ae53 | |||
| c4fb473d4b | |||
| b4fbd74f98 | |||
| 7fae0bc0de | |||
| 89b61eeec4 | |||
| e2492dd568 | |||
| ca000287fc | |||
| ff14fea672 | |||
| e121a5ca6f | |||
| e79851502c | |||
| 0132ab046b | |||
| c2ba1d69a1 | |||
| 847739aed7 | |||
| 4d66598f31 | |||
| 2ec1bd7248 | |||
| 646d1a8923 | |||
| 4a8a6e9f70 | |||
| 0a9d25c9e8 | |||
| 188677724c | |||
| 22cd3ea268 | |||
| 71a231b71d | |||
| 112fe06323 | |||
| 8bcb918de5 | |||
| 6f6293c38c | |||
| 1b885cc317 | |||
| 9dd83ab354 | |||
| 0bbc6f8932 | |||
| 1ad4c04b2a | |||
| 0bbe68db0b | |||
| b2a3a5e226 | |||
| 0434ad3bd9 | |||
| 9d3046f187 | |||
| 6b2c088a29 | |||
| 4efc736a6e | |||
| 2b0e3a5b1a | |||
| bac41ce644 | |||
| 2b0ad09423 | |||
| f5955feea1 | |||
| 853e8719c6 | |||
| 8d528350b9 | |||
| d51c92f54d | |||
| b9bd7124c0 | |||
| 14f67550d0 | |||
| ee6ef41e71 | |||
| fde3d2cd50 | |||
| 099955b0c0 | |||
| b530ade8c6 | |||
| 3a9234dadc | |||
| 3e27232028 | |||
| c2676ad785 | |||
| 4a1598dc2a | |||
| 5f70b00bea | |||
| 3377460fb8 | |||
| 05a0aca5ab | |||
| 9463e0f56c | |||
| 1c308431a6 | |||
| fb996f6e6d | |||
| edfd37dfe2 | |||
| 4bede73f62 | |||
| 0b59290bad | |||
| e8c7d0e5ec | |||
| 3fb06ca29d | |||
| 013401b594 | |||
| 484c4bdf22 | |||
| 133231e12b | |||
| ef2024736d | |||
| ed265f6a7e | |||
| 0152286fa0 | |||
| 4ef560d3b8 | |||
| 343472931d | |||
| 41b606b16d | |||
| f83c00c928 | |||
| f497cb2b6e | |||
| 2f8c0b7aec | |||
| d517b25ea3 | |||
| 37345670c8 | |||
| 89d993b6ec | |||
| 250a5c0dfd | |||
| af3ceb5755 | |||
| 982a696311 | |||
| e5f1e4545d | |||
| bf87a40b20 | |||
| 18b8baaf25 | |||
| 4c69192837 | |||
| c01be6cac7 | |||
| 8b4e7a638c | |||
| 59acec21d4 | |||
| 38f610f85e | |||
| 5393173afa | |||
| 951b448e90 | |||
| 51ad2a55a8 | |||
| e50209a535 | |||
| d6430995ad | |||
| 9b1026886b | |||
| cea15fc63e | |||
| f99fbab24f | |||
| 6acd4361ab | |||
| 05f488011a | |||
| ef7679235a | |||
| d65f9b298c | |||
| 5c9de08159 | |||
| f2a297f56d | |||
| a1d9cb8ad6 | |||
| 8da911db81 | |||
| 78f68d7992 | |||
| 8a190b200b | |||
| e72b4ae6e2 | |||
| 9f1f4850fe | |||
| 0b9e5e6db4 | |||
| 2cd5b4df1b | |||
| 57a070fc8d | |||
| ccc6b7165e | |||
| ff330668cf | |||
| 63f9e5453d | |||
| f849823a07 | |||
| 9a2d6d6d88 | |||
| 72c37d566c | |||
| 01c0d5e04b | |||
| 57dd88ee53 | |||
| 8c92c619de | |||
| 78d2002965 | |||
| 25c4acb6d2 | |||
| 0a3dac10c6 | |||
| c9afcd31c2 | |||
| 3565facdaf | |||
| 494cff94d6 | |||
| 17644b12a5 | |||
| 54ff5d8edd | |||
| b18320fe05 | |||
| 0ce60ad214 | |||
| 76642f2bf9 | |||
| fcac150641 | |||
| 4d13c61aaf | |||
| 09bab2b2df | |||
| b44f43e996 | |||
| 52fa641dff | |||
| a3ebc0329d | |||
| 8dc04d3fc8 | |||
| ba64e5588d | |||
| fcdcdb7e78 | |||
| 3d5789a66e | |||
| 59343e4efb | |||
| 41219ae489 | |||
| 7055250692 | |||
| 98f63d09c0 | |||
| 85b9a6f1b0 | |||
| 3353eac289 | |||
| cdc135f11d | |||
| 069ce48ac5 | |||
| 625c7c3d26 | |||
| 4ea2aac561 | |||
| e88e31dde2 | |||
| fb2e67638d | |||
| f11dd83ab5 | |||
| 92804b5b55 | |||
| 87e7ea6080 | |||
| b1945b38e8 | |||
| 13ca3187f2 | |||
| 18fd506360 | |||
| 9faf1a0377 | |||
| 1a9c03449e | |||
| aee214b09d | |||
| dc3003bc4d | |||
| 845f4b1536 | |||
| abbb3a2da6 | |||
| 1a93efecf3 | |||
| 440d56a44f | |||
| f10603e97d | |||
| 9a9257d7be | |||
| 5c10f2b4cd | |||
| ba6a618d44 | |||
| 5fbeea3870 | |||
| 27368a418a | |||
| 676cd1e673 | |||
| d6a4c65bfa |
@@ -1 +1,2 @@
|
||||
/subprojects/*/
|
||||
.flatpak-builder/
|
||||
|
||||
+26
-6
@@ -24,7 +24,7 @@ stages:
|
||||
variables:
|
||||
COMMON_MESON_FLAGS: "-Dwerror=true -Dcairo:werror=false -Dgi-docgen:werror=false -Dgraphene:werror=false -Dlibepoxy:werror=false -Dlibsass:werror=false -Dpango:werror=false -Dsassc:werror=false -Dgdk-pixbuf:werror=false -Dglib:werror=false -Dlibcloudproviders:werror=false -Dlibpng:werror=false -Dlibtiff:werror=false -Dsysprof:werror=false -Dwayland-protocols:werror=false -Dharfbuzz:werror=false -Dfreetype2:werror=false -Dfontconfig:werror=false -Dfribidi:werror=false -Dlibffi:werror=false -Dlibjpeg-turbo:werror=false -Dmutest:werror=false -Dpixman:werror=false -Dproxy-libintl:werror=false"
|
||||
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true"
|
||||
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled -Ddemos=false -Dbuild-examples=false -Dbuild-tests=false -Dbuild-testsuite=true"
|
||||
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled -Dbuild-testsuite=true -Dintrospection=enabled"
|
||||
MESON_TEST_TIMEOUT_MULTIPLIER: 3
|
||||
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v46"
|
||||
|
||||
@@ -83,6 +83,27 @@ fedora-x86_64:
|
||||
needs: []
|
||||
variables:
|
||||
EXTRA_MESON_FLAGS: "--buildtype=debug --default-library=both"
|
||||
script:
|
||||
- .gitlab-ci/show-info-linux.sh
|
||||
- export PATH="$HOME/.local/bin:$PATH"
|
||||
- meson subprojects download
|
||||
- meson subprojects update --reset
|
||||
- meson setup
|
||||
${COMMON_MESON_FLAGS}
|
||||
${EXTRA_MESON_FLAGS}
|
||||
${BACKEND_FLAGS}
|
||||
${FEATURE_FLAGS}
|
||||
_build
|
||||
- meson compile -C _build
|
||||
- .gitlab-ci/run-tests.sh _build wayland
|
||||
- .gitlab-ci/run-tests.sh _build wayland_gles
|
||||
|
||||
release-build:
|
||||
extends: .build-fedora-default
|
||||
stage: build
|
||||
needs: []
|
||||
variables:
|
||||
EXTRA_MESON_FLAGS: "--buildtype=release"
|
||||
script:
|
||||
- .gitlab-ci/show-info-linux.sh
|
||||
- export PATH="$HOME/.local/bin:$PATH"
|
||||
@@ -101,11 +122,8 @@ fedora-x86_64:
|
||||
- PKG_CONFIG_PATH=${CI_PROJECT_DIR}/_install/lib64/pkgconfig:${CI_PROJECT_DIR}/_install/share/pkgconfig meson setup _build_hello examples/hello
|
||||
- LD_LIBRARY_PATH=${CI_PROJECT_DIR}/_install/lib64 meson compile -C _build_hello
|
||||
- .gitlab-ci/run-tests.sh _build x11
|
||||
- .gitlab-ci/run-tests.sh _build wayland
|
||||
- .gitlab-ci/run-tests.sh _build wayland_gles
|
||||
- .gitlab-ci/run-tests.sh _build broadway
|
||||
|
||||
release-build:
|
||||
fedora-clang:
|
||||
extends: .build-fedora-default
|
||||
stage: build
|
||||
needs: []
|
||||
@@ -114,6 +132,7 @@ release-build:
|
||||
script:
|
||||
- .gitlab-ci/show-info-linux.sh
|
||||
- export PATH="$HOME/.local/bin:$PATH"
|
||||
- export CC=clang
|
||||
- meson subprojects download
|
||||
- meson subprojects update --reset
|
||||
- meson setup
|
||||
@@ -123,7 +142,6 @@ release-build:
|
||||
${FEATURE_FLAGS}
|
||||
_build
|
||||
- meson compile -C _build
|
||||
- .gitlab-ci/run-tests.sh _build x11
|
||||
|
||||
fedora-mingw64:
|
||||
extends: .build-fedora-default
|
||||
@@ -351,6 +369,8 @@ static-scan:
|
||||
- meson setup
|
||||
${COMMON_MESON_FLAGS}
|
||||
${EXTRA_MESON_FLAGS}
|
||||
${BACKEND_FLAGS}
|
||||
${FEATURE_FLAGS}
|
||||
_scan_build
|
||||
- ninja -C _scan_build scan-build
|
||||
artifacts:
|
||||
|
||||
@@ -69,9 +69,6 @@ case "${backend}" in
|
||||
--no-suite=flaky \
|
||||
--no-suite=gsk-compare-opengl
|
||||
|
||||
# don't let Broadway failures fail the run, for now
|
||||
exit_code=0
|
||||
|
||||
kill ${server}
|
||||
;;
|
||||
|
||||
|
||||
@@ -1,3 +1,56 @@
|
||||
Overview of Changes in 4.11.3, xx-xx-xxxx
|
||||
=========================================
|
||||
|
||||
* GtkGridView:
|
||||
- Respect css border-spacing
|
||||
- Don't leak the factories
|
||||
|
||||
* GtkListView:
|
||||
- Don't leak the factories
|
||||
|
||||
* GtkNotebook:
|
||||
- Make the pages model implement GtkSelectionModel
|
||||
|
||||
* GtkScrolledWindow:
|
||||
- Propagate child measure size whenever possible
|
||||
|
||||
* GtkPopoverMenu:
|
||||
- Avoid unnecessary left padding
|
||||
|
||||
* Css:
|
||||
- Add new binding-friendly css provider apis
|
||||
|
||||
* Theme:
|
||||
- Show focus in the shortcuts window
|
||||
|
||||
* Tests:
|
||||
- Improve test coverage
|
||||
|
||||
* Wayland:
|
||||
- Make exporting surface handles more flexible
|
||||
|
||||
* Build:
|
||||
- Some build options have been renamed:
|
||||
demos -> build-demos
|
||||
profile -> demo-profile
|
||||
The old names still work
|
||||
|
||||
* Deprecations:
|
||||
- gtk_css_provider_load_from_data
|
||||
- gdk_wayland_toplevel_unexport_handle
|
||||
- gdk_pixbuf_get_from_surface
|
||||
- gdk_pixbuf_get_from_texture
|
||||
- gtk_image_new_from_pixbuf
|
||||
- gtk_image_set_from_pixbuf
|
||||
- gtk_picture_new_for_pixbuf
|
||||
- gtk_picture_set_pixbuf
|
||||
|
||||
* Translation updates:
|
||||
Basque
|
||||
Catalan
|
||||
Russian
|
||||
|
||||
|
||||
Overview of Changes in 4.11.2, 09-05-2023
|
||||
=========================================
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@
|
||||
"--libdir=/app/lib",
|
||||
"-Dvulkan=disabled",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Dprofile=devel"
|
||||
"-Ddemo-profile=devel"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
"--libdir=/app/lib",
|
||||
"-Dvulkan=disabled",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Dprofile=devel"
|
||||
"-Ddemo-profile=devel"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
"--libdir=/app/lib",
|
||||
"-Dvulkan=disabled",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Dprofile=devel"
|
||||
"-Ddemo-profile=devel"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
"--libdir=/app/lib",
|
||||
"-Dvulkan=disabled",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Dprofile=devel"
|
||||
"-Ddemo-profile=devel"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
|
||||
@@ -50,7 +50,7 @@ update_css_for_blend_mode (GtkCssProvider *provider,
|
||||
blend_mode,
|
||||
blend_mode);
|
||||
|
||||
gtk_css_provider_load_from_data (provider, css, -1);
|
||||
gtk_css_provider_load_from_string (provider, css);
|
||||
|
||||
g_bytes_unref (bytes);
|
||||
g_free (css);
|
||||
|
||||
@@ -70,7 +70,7 @@ set_color (CanvasItem *item,
|
||||
css = g_strdup_printf ("#%s { background: %s; }", name, str);
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_data (provider, css, -1);
|
||||
gtk_css_provider_load_from_string (provider, css);
|
||||
gtk_style_context_add_provider_for_display (gtk_widget_get_display (item->label), GTK_STYLE_PROVIDER (provider), 700);
|
||||
item->provider = GTK_STYLE_PROVIDER (provider);
|
||||
|
||||
@@ -765,7 +765,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
g_string_append_printf (css, ".canvasitem.%s { background: %s; }\n", colors[i], colors[i]);
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_data (provider, css->str, css->len);
|
||||
gtk_css_provider_load_from_string (provider, css->str);
|
||||
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
||||
GTK_STYLE_PROVIDER (provider),
|
||||
800);
|
||||
|
||||
@@ -301,7 +301,7 @@ do_fishbowl (GtkWidget *do_widget)
|
||||
if (provider == NULL)
|
||||
{
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_data (provider, css, -1);
|
||||
gtk_css_provider_load_from_string (provider, css);
|
||||
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
||||
GTK_STYLE_PROVIDER (provider),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
|
||||
@@ -43,6 +43,7 @@ update_image (void)
|
||||
cairo_t *cr;
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkPixbuf *pixbuf2;
|
||||
GdkTexture *texture;
|
||||
cairo_font_options_t *fopt;
|
||||
cairo_hint_style_t hintstyle;
|
||||
cairo_hint_metrics_t hintmetrics;
|
||||
@@ -120,8 +121,17 @@ update_image (void)
|
||||
cairo_destroy (cr);
|
||||
g_object_unref (layout);
|
||||
|
||||
pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, cairo_image_surface_get_width (surface), cairo_image_surface_get_height (surface));
|
||||
pixbuf2 = gdk_pixbuf_scale_simple (pixbuf, gdk_pixbuf_get_width (pixbuf) * scale, gdk_pixbuf_get_height (pixbuf) * scale, GDK_INTERP_NEAREST);
|
||||
pixbuf = gdk_pixbuf_new_from_data (cairo_image_surface_get_data (surface),
|
||||
GDK_COLORSPACE_RGB, TRUE, 8,
|
||||
cairo_image_surface_get_width (surface),
|
||||
cairo_image_surface_get_height (surface),
|
||||
cairo_image_surface_get_stride (surface),
|
||||
NULL, NULL);
|
||||
|
||||
pixbuf2 = gdk_pixbuf_scale_simple (pixbuf,
|
||||
gdk_pixbuf_get_width (pixbuf) * scale,
|
||||
gdk_pixbuf_get_height (pixbuf) * scale,
|
||||
GDK_INTERP_NEAREST);
|
||||
|
||||
g_object_unref (pixbuf);
|
||||
cairo_surface_destroy (surface);
|
||||
@@ -278,14 +288,24 @@ retry:
|
||||
pango_layout_iter_free (iter);
|
||||
g_object_unref (layout);
|
||||
|
||||
pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, cairo_image_surface_get_width (surface), cairo_image_surface_get_height (surface));
|
||||
pixbuf2 = gdk_pixbuf_scale_simple (pixbuf, gdk_pixbuf_get_width (pixbuf) * scale, gdk_pixbuf_get_height (pixbuf) * scale, GDK_INTERP_NEAREST);
|
||||
pixbuf = gdk_pixbuf_new_from_data (cairo_image_surface_get_data (surface),
|
||||
GDK_COLORSPACE_RGB, TRUE, 8,
|
||||
cairo_image_surface_get_width (surface),
|
||||
cairo_image_surface_get_height (surface),
|
||||
cairo_image_surface_get_stride (surface),
|
||||
NULL, NULL);
|
||||
|
||||
pixbuf2 = gdk_pixbuf_scale_simple (pixbuf,
|
||||
gdk_pixbuf_get_width (pixbuf) * scale,
|
||||
gdk_pixbuf_get_height (pixbuf) * scale,
|
||||
GDK_INTERP_NEAREST);
|
||||
g_object_unref (pixbuf);
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
|
||||
gtk_picture_set_pixbuf (GTK_PICTURE (image), pixbuf2);
|
||||
|
||||
texture = gdk_texture_new_for_pixbuf (pixbuf2);
|
||||
gtk_picture_set_paintable (GTK_PICTURE (image), GDK_PAINTABLE (texture));
|
||||
g_object_unref (pixbuf2);
|
||||
g_object_unref (pixbuf2);
|
||||
}
|
||||
|
||||
|
||||
@@ -337,7 +337,7 @@ create_gltransition_window (GtkWidget *do_widget)
|
||||
1, 1, 1, 1);
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_data (provider, "button.small { padding: 0; }", -1);
|
||||
gtk_css_provider_load_from_string (provider, "button.small { padding: 0; }");
|
||||
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
||||
GTK_STYLE_PROVIDER (provider),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
|
||||
+10
-11
@@ -30,6 +30,7 @@ progressive_prepared_callback (GdkPixbufLoader *loader,
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GtkWidget *picture;
|
||||
GdkTexture *texture;
|
||||
|
||||
picture = GTK_WIDGET (data);
|
||||
|
||||
@@ -40,7 +41,9 @@ progressive_prepared_callback (GdkPixbufLoader *loader,
|
||||
*/
|
||||
gdk_pixbuf_fill (pixbuf, 0xaaaaaaff);
|
||||
|
||||
gtk_picture_set_pixbuf (GTK_PICTURE (picture), pixbuf);
|
||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
||||
gtk_picture_set_paintable (GTK_PICTURE (picture), GDK_PAINTABLE (texture));
|
||||
g_object_unref (texture);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -51,22 +54,18 @@ progressive_updated_callback (GdkPixbufLoader *loader,
|
||||
int height,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *picture;
|
||||
GdkPixbuf *pixbuf;
|
||||
GtkWidget *picture = GTK_WIDGET (data);
|
||||
GdkTexture *texture;
|
||||
|
||||
picture = GTK_WIDGET (data);
|
||||
|
||||
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
|
||||
gtk_picture_set_pixbuf (GTK_PICTURE (picture), NULL);
|
||||
gtk_picture_set_pixbuf (GTK_PICTURE (picture), pixbuf);
|
||||
texture = gdk_texture_new_for_pixbuf (gdk_pixbuf_loader_get_pixbuf (loader));
|
||||
gtk_picture_set_paintable (GTK_PICTURE (picture), GDK_PAINTABLE (texture));
|
||||
g_object_unref (texture);
|
||||
}
|
||||
|
||||
static int
|
||||
progressive_timeout (gpointer data)
|
||||
{
|
||||
GtkWidget *picture;
|
||||
|
||||
picture = GTK_WIDGET (data);
|
||||
GtkWidget *picture = GTK_WIDGET (data);
|
||||
|
||||
/* This shows off fully-paranoid error handling, so looks scary.
|
||||
* You could factor out the error handling code into a nice separate
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Lists/Settings v2
|
||||
/* Lists/Alternative Settings
|
||||
* #Keywords: GtkListHeaderFactory, GtkSectionModel
|
||||
*
|
||||
* This demo shows a settings viewer for GSettings.
|
||||
* This demo shows an alternative settings viewer for GSettings.
|
||||
*
|
||||
* It demonstrates how to implement support for sections with GtkListView.
|
||||
*
|
||||
* It also shows how to quickly flatten a large tree of items into a list
|
||||
* that can be filtered to find the itmes one is looking for.
|
||||
* that can be filtered to find the items one is looking for.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
@@ -367,7 +367,7 @@ do_listview_ucd (GtkWidget *do_widget)
|
||||
gtk_label_set_width_chars (GTK_LABEL (label), 2);
|
||||
gtk_widget_add_css_class (label, "enormous");
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_data (provider, "label.enormous { font-size: 80px; }", -1);
|
||||
gtk_css_provider_load_from_string (provider, "label.enormous { font-size: 80px; }");
|
||||
gtk_style_context_add_provider_for_display (gdk_display_get_default (), GTK_STYLE_PROVIDER (provider), 800);
|
||||
gtk_widget_set_hexpand (label, TRUE);
|
||||
gtk_box_append (GTK_BOX (box), label);
|
||||
|
||||
@@ -384,7 +384,7 @@ create_board (GtkWidget *window)
|
||||
"}";
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_data (provider, css, -1);
|
||||
gtk_css_provider_load_from_string (provider, css);
|
||||
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
||||
GTK_STYLE_PROVIDER (provider),
|
||||
800);
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
gen_demo_header = find_program('../build-aux/meson/gen-demo-header.py')
|
||||
demo_profile = get_option('profile')
|
||||
demo_profile = get_option('demo-profile')
|
||||
|
||||
demo_conf_h = declare_dependency(
|
||||
sources: custom_target('demo-header',
|
||||
|
||||
@@ -201,7 +201,7 @@ node_editor_application_startup (GApplication *app)
|
||||
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_data (provider, css, -1);
|
||||
gtk_css_provider_load_from_string (provider, css);
|
||||
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
||||
GTK_STYLE_PROVIDER (provider),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
|
||||
@@ -1701,6 +1701,13 @@ node_editor_window_init (NodeEditorWindow *self)
|
||||
" }\n"
|
||||
" transform: translate(0, 140);\n"
|
||||
"}", -1);
|
||||
|
||||
if (g_getenv ("GSK_RENDERER"))
|
||||
{
|
||||
char *new_title = g_strdup_printf ("GTK Node Editor - %s", g_getenv ("GSK_RENDERER"));
|
||||
gtk_window_set_title (GTK_WINDOW (self), new_title);
|
||||
g_free (new_title);
|
||||
}
|
||||
}
|
||||
|
||||
NodeEditorWindow *
|
||||
|
||||
@@ -1210,12 +1210,12 @@ typedef struct {
|
||||
static void
|
||||
add_background (GtkWidget *flowbox,
|
||||
const char *filename,
|
||||
GdkPixbuf *pixbuf,
|
||||
GdkTexture *texture,
|
||||
gboolean is_resource)
|
||||
{
|
||||
GtkWidget *child;
|
||||
|
||||
child = gtk_picture_new_for_pixbuf (pixbuf);
|
||||
child = gtk_picture_new_for_paintable (GDK_PAINTABLE (texture));
|
||||
gtk_widget_set_size_request (child, 110, 70);
|
||||
gtk_flow_box_insert (GTK_FLOW_BOX (flowbox), child, -1);
|
||||
child = gtk_widget_get_parent (child);
|
||||
@@ -1231,6 +1231,7 @@ background_loaded_cb (GObject *source,
|
||||
{
|
||||
BackgroundData *bd = data;
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkTexture *texture;
|
||||
GError *error = NULL;
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_stream_finish (res, &error);
|
||||
@@ -1241,8 +1242,11 @@ background_loaded_cb (GObject *source,
|
||||
return;
|
||||
}
|
||||
|
||||
add_background (bd->flowbox, bd->filename, pixbuf, FALSE);
|
||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
||||
add_background (bd->flowbox, bd->filename, texture, FALSE);
|
||||
|
||||
g_object_unref (texture);
|
||||
g_object_unref (pixbuf);
|
||||
g_free (bd->filename);
|
||||
g_free (bd);
|
||||
}
|
||||
@@ -1259,7 +1263,10 @@ populate_flowbox (GtkWidget *flowbox)
|
||||
GInputStream *stream;
|
||||
BackgroundData *bd;
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkTexture *texture;
|
||||
GtkWidget *child;
|
||||
guchar *data;
|
||||
GBytes *bytes;
|
||||
int i;
|
||||
const char *resources[] = {
|
||||
"sunset.jpg", "portland-rose.jpg", "beach.jpg", "nyc.jpg"
|
||||
@@ -1270,9 +1277,14 @@ populate_flowbox (GtkWidget *flowbox)
|
||||
|
||||
g_object_set_data (G_OBJECT (flowbox), "populated", GUINT_TO_POINTER (1));
|
||||
|
||||
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 110, 70);
|
||||
gdk_pixbuf_fill (pixbuf, 0xffffffff);
|
||||
child = gtk_picture_new_for_pixbuf (pixbuf);
|
||||
data = g_malloc (4 * 110 * 70);
|
||||
memset (data, 0xff, 4 * 110 * 70);
|
||||
bytes = g_bytes_new_take (data, 4 * 110 * 70);
|
||||
texture = gdk_memory_texture_new (110, 70, GDK_MEMORY_DEFAULT, bytes, 4 * 110);
|
||||
child = gtk_picture_new_for_paintable (GDK_PAINTABLE (texture));
|
||||
g_object_unref (texture);
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
gtk_widget_add_css_class (child, "frame");
|
||||
gtk_flow_box_insert (GTK_FLOW_BOX (flowbox), child, -1);
|
||||
|
||||
@@ -1280,7 +1292,10 @@ populate_flowbox (GtkWidget *flowbox)
|
||||
{
|
||||
filename = g_strconcat ("/org/gtk/WidgetFactory4/", resources[i], NULL);
|
||||
pixbuf = gdk_pixbuf_new_from_resource_at_scale (filename, 110, 110, TRUE, NULL);
|
||||
add_background (flowbox, filename, pixbuf, TRUE);
|
||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
||||
add_background (flowbox, filename, texture, TRUE);
|
||||
g_object_unref (texture);
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
|
||||
location = "/usr/share/backgrounds/gnome";
|
||||
|
||||
@@ -2244,20 +2244,24 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="spacing">6</property>
|
||||
<property name="valign">center</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="lockbox">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="spacing">6</property>
|
||||
<property name="valign">center</property>
|
||||
<child>
|
||||
<object class="GtkMenuButton" id="open_menubutton">
|
||||
<property name="halign">3</property>
|
||||
<property name="popover">open_popover</property>
|
||||
<property name="label">Open</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="record_button">
|
||||
<property name="halign">3</property>
|
||||
<property name="valign">center</property>
|
||||
<signal name="toggled" handler="on_record_button_toggled"/>
|
||||
<style>
|
||||
<class name="text-button"/>
|
||||
@@ -2267,16 +2271,19 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="spacing">6</property>
|
||||
<property name="valign">center</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="valign">4</property>
|
||||
<property name="icon-name">media-record-symbolic</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="valign">4</property>
|
||||
<property name="label">Record</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -2285,6 +2292,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="valign">center</property>
|
||||
<style>
|
||||
<class name="linked"/>
|
||||
</style>
|
||||
@@ -2292,12 +2300,14 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<object class="GtkToggleButton" id="grid_button">
|
||||
<property name="active">1</property>
|
||||
<property name="icon-name">view-grid-symbolic</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="list_button">
|
||||
<property name="group">grid_button</property>
|
||||
<property name="icon-name">view-list-symbolic</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -2305,6 +2315,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="circular_button">
|
||||
<property name="icon-name">emblem-system-symbolic</property>
|
||||
<property name="valign">center</property>
|
||||
<style>
|
||||
<class name="circular"/>
|
||||
</style>
|
||||
@@ -2313,12 +2324,15 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLockButton" id="lockbutton"/>
|
||||
<object class="GtkLockButton" id="lockbutton">
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuButton">
|
||||
<property name="icon-name">view-more-symbolic</property>
|
||||
<property name="menu-model">new_style_menu_model</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@@ -220,6 +220,6 @@ clipboard.cut, clipboard.copy, clipboard.paste
|
||||
selection.delete, selection.select-all
|
||||
: Selection operations on entries, text view and labels
|
||||
|
||||
color.select, color.customize:
|
||||
color.select, color.customize
|
||||
: Operate on colors in a `GtkColorChooserWidget`. These actions are
|
||||
unusual in that they have the non-trivial parameter type (dddd):
|
||||
unusual in that they have the non-trivial parameter type (dddd).
|
||||
|
||||
@@ -288,7 +288,7 @@ support.
|
||||
If you want to run the testsuite to ensure that your GTK build
|
||||
works, you should enable it with this option.
|
||||
|
||||
### `build-tests`, `build-examples`, `demos`
|
||||
### `build-tests`, `build-examples`, `build-demos`
|
||||
|
||||
By default, GTK will build quite a few tests, examples and demos.
|
||||
While these are useful on a developer system, they are not
|
||||
|
||||
@@ -68,7 +68,7 @@ in a selector, widget names must be prefixed with a # character.
|
||||
| E:focus-within | [CSS Selector Level 4](https://drafts.csswg.org/selectors/#focus-within-pseudo) | Set on all ancestors of the focus widget, unlike CSS |
|
||||
| E:focus-visible | [CSS Selector Level 4](https://drafts.csswg.org/selectors/#focus-within-pseudo) | Set on focus widget and all ancestors, unlike CSS |
|
||||
| E:disabled | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#UIstates) | Corresponds to GTK_STATE_FLAG_INSENSITIVE |
|
||||
| E:disabled | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#UIstates) | Corresponds to GTK_STATE_FLAG_CHECKED |
|
||||
| E:checked | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#UIstates) | Corresponds to GTK_STATE_FLAG_CHECKED |
|
||||
| E:indeterminate | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#indeterminate) | Corresponds to GTK_STATE_FLAG_INCONSISTENT |
|
||||
| E:backdrop, E:selected | | Corresponds to GTK_STATE_FLAG_BACKDROP, GTK_STATE_FLAG_SELECTED |
|
||||
| E:not(selector) | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#negation) | |
|
||||
|
||||
@@ -103,14 +103,15 @@ fields, but e.g. buttons can take the focus too.
|
||||
|
||||
Input widgets can be given the focus by clicking on them, but focus
|
||||
can also be moved around with certain key events (this is known as
|
||||
“keyboard navigation”). GTK reserves the <kbd>Tab</kbd> key to move the focus
|
||||
to the next location, and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move it back to the previous
|
||||
one. In addition many containers allow “directional navigation” with
|
||||
the arrow keys.
|
||||
“keyboard navigation”).
|
||||
GTK reserves the <kbd>Tab</kbd> key to move the focus to the next location,
|
||||
and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move it back to the previous one.
|
||||
In addition many containers allow “directional navigation” with the arrow keys.
|
||||
|
||||
Many widgets can be “activated” to trigger and action. E.g., you can
|
||||
activate a button or switch by clicking on them, but you can also
|
||||
activate them with the keyboard, by using the <kbd>Enter</kbd> or <kbd>␣</kbd> keys.
|
||||
Many widgets can be “activated” to trigger and action.
|
||||
E.g., you can activate a button or switch by clicking on them,
|
||||
but you can also activate them with the keyboard,
|
||||
by using the <kbd>Enter</kbd> or <kbd>Space</kbd> keys.
|
||||
|
||||
Apart from keyboard navigation, activation and directly typing into
|
||||
entries or text views, GTK widgets can use key events for activating
|
||||
@@ -121,15 +122,17 @@ GTK has traditionally supported different kinds of shortcuts:
|
||||
|
||||
- Accelerators are any other shortcuts that can be activated regardless
|
||||
of where the focus is, and typically trigger global actions, such as
|
||||
Ctrl-Q to quit an application.
|
||||
- Mnemonics are usually triggered using Alt as a modifier for a letter.
|
||||
<kbd>Ctrl</kbd>+<kbd>Q</kbd> to quit an application.
|
||||
- Mnemonics are usually triggered using <kbd>Alt</kbd>
|
||||
as a modifier for a letter.
|
||||
They are used in places where a label is associated with a control,
|
||||
and are indicated by underlining the letter in the label. As a special
|
||||
case, inside menus (i.e. inside `GtkPopoverMenu`), mnemonics can be
|
||||
triggered without the modifier.
|
||||
- Key bindings are specific to individual widgets, such as Ctrl-C or
|
||||
Ctrl-V in an entry copy to or paste from the clipboard. They are only
|
||||
triggered when the widget has focus.
|
||||
- Key bindings are specific to individual widgets,
|
||||
such as <kbd>Ctrl</kbd>+<kbd>C</kbd> or <kbd>Ctrl</kbd>+<kbd>V</kbd>
|
||||
in an entry copy to or paste from the clipboard.
|
||||
They are only triggered when the widget has focus.
|
||||
|
||||
GTK handles accelerators and mnemonics in a global scope, during the
|
||||
capture phase, and key bindings locally, during the target phase.
|
||||
@@ -208,4 +211,4 @@ sequence, so setting the state on one does transfer the state to
|
||||
the others. They also are mutually exclusive, within a widget
|
||||
where may be only one gesture group claiming a given sequence.
|
||||
If another gesture group claims later that same sequence, the
|
||||
first group will deny the sequence:
|
||||
first group will deny the sequence.
|
||||
|
||||
@@ -133,3 +133,9 @@ The function gtk_widget_get_allocation() is also going away. It does not have a
|
||||
replacement, but the previously mentioned alternatives can be used for it too.
|
||||
|
||||
The function gtk_widget_get_allocated_baseline() has been renamed to [method@Gtk.Widget.get_baseline].
|
||||
|
||||
## Stop using GdkPixbuf
|
||||
|
||||
GTK is moving away from GdkPixbuf as the primary API for transporting image data, in favor
|
||||
of GdkTexture. APIs that are accepting or returning GdkPixbufs are being replaced by equivalent
|
||||
APIs using GdkTexture or GdkPaintable objects.
|
||||
|
||||
@@ -196,6 +196,15 @@ The _data table_ style of list is a high density table, similar in style to a
|
||||
traditional treeview. Individual cells can be selectable and editable. Use
|
||||
the `.data-table` style class.
|
||||
|
||||
## Sections
|
||||
|
||||
List models can optionally group their items into **_sections_**, by implementing
|
||||
the `GtkSectionModel` interface. Both `GtkListView` and `GtkGridView` can
|
||||
display headers for sections, by installing a separate **_header factory_**.
|
||||
|
||||
Many GTK list models support section inherently, or they pass through the
|
||||
section of a model they are wrapping.
|
||||
|
||||
## Comparison to GtkTreeView
|
||||
|
||||
Developers familiar with `GtkTreeView` may wonder how this way of doing lists
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
A trivial example
|
||||
=================
|
||||
|
||||
This is a very minimal example of an app that can be built against GTK.
|
||||
We use this in CI to test that building against the installed GTK works.
|
||||
|
||||
That is why there is a standalone meson.build in this subdirectory.
|
||||
+2
-2
@@ -57,7 +57,7 @@ window_paste (GSimpleAction *action,
|
||||
{
|
||||
GtkWindow *window = GTK_WINDOW (user_data);
|
||||
GtkTextView *text = g_object_get_data ((GObject*)window, "plugman-text");
|
||||
|
||||
|
||||
gtk_text_buffer_paste_clipboard (gtk_text_view_get_buffer (text),
|
||||
gtk_widget_get_clipboard (GTK_WIDGET (text)),
|
||||
NULL,
|
||||
@@ -221,7 +221,7 @@ plugin_action (GAction *action,
|
||||
g_message ("Color: %s", g_action_get_name (action));
|
||||
|
||||
css_provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_data (css_provider, css_to_load, -1);
|
||||
gtk_css_provider_load_from_string (css_provider, css_to_load);
|
||||
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
||||
GTK_STYLE_PROVIDER (css_provider),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
|
||||
@@ -157,6 +157,9 @@ convert_no_alpha (guchar *dest_data,
|
||||
*
|
||||
* Returns: (nullable) (transfer full): A newly-created pixbuf with a
|
||||
* reference count of 1
|
||||
*
|
||||
* Deprecated: 4.12: Use [class@Gdk.Texture] and subclasses instead
|
||||
* cairo surfaces and pixbufs
|
||||
*/
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf_get_from_surface (cairo_surface_t *surface,
|
||||
@@ -234,6 +237,9 @@ pixbuf_texture_unref_cb (guchar *pixels,
|
||||
* to draw it on screen.
|
||||
*
|
||||
* Returns: (transfer full) (nullable): a new `GdkPixbuf`
|
||||
*
|
||||
* Deprecated: 4.12: Use [class@Gdk.Texture] and subclasses instead
|
||||
* cairo surfaces and pixbufs
|
||||
*/
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf_get_from_texture (GdkTexture *texture)
|
||||
@@ -33,13 +33,13 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_12
|
||||
GdkPixbuf *gdk_pixbuf_get_from_surface (cairo_surface_t *surface,
|
||||
int src_x,
|
||||
int src_y,
|
||||
int width,
|
||||
int height);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_12
|
||||
GdkPixbuf *gdk_pixbuf_get_from_texture (GdkTexture *texture);
|
||||
|
||||
G_END_DECLS
|
||||
@@ -0,0 +1,7 @@
|
||||
gdk_deprecated_sources = files([
|
||||
'gdkpixbuf.c',
|
||||
])
|
||||
|
||||
gdk_deprecated_headers = files([
|
||||
'gdkpixbuf.h',
|
||||
])
|
||||
@@ -61,7 +61,7 @@
|
||||
#include <gdk/gdkmonitor.h>
|
||||
#include <gdk/gdkpaintable.h>
|
||||
#include <gdk/gdkpango.h>
|
||||
#include <gdk/gdkpixbuf.h>
|
||||
#include <gdk/deprecated/gdkpixbuf.h>
|
||||
#include <gdk/gdkpopup.h>
|
||||
#include <gdk/gdkpopuplayout.h>
|
||||
#include <gdk/gdkrectangle.h>
|
||||
|
||||
+3
-38
@@ -17,7 +17,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkcairoprivate.h"
|
||||
#include "gdkcairo.h"
|
||||
|
||||
#include "gdkrgba.h"
|
||||
#include "gdktexture.h"
|
||||
@@ -90,7 +90,7 @@ gdk_cairo_region (cairo_t *cr,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
gdk_cairo_surface_paint_pixbuf (cairo_surface_t *surface,
|
||||
const GdkPixbuf *pixbuf)
|
||||
{
|
||||
@@ -171,7 +171,7 @@ gdk_cairo_set_source_pixbuf (cairo_t *cr,
|
||||
*
|
||||
* Returns: %TRUE if the extents fit in a `GdkRectangle`, %FALSE if not
|
||||
*/
|
||||
gboolean
|
||||
static gboolean
|
||||
_gdk_cairo_surface_extents (cairo_surface_t *surface,
|
||||
GdkRectangle *extents)
|
||||
{
|
||||
@@ -303,38 +303,3 @@ gdk_cairo_region_create_from_surface (cairo_surface_t *surface)
|
||||
|
||||
return region;
|
||||
}
|
||||
|
||||
cairo_region_t *
|
||||
gdk_cairo_region_from_clip (cairo_t *cr)
|
||||
{
|
||||
cairo_rectangle_list_t *rectangles;
|
||||
cairo_region_t *region;
|
||||
int i;
|
||||
|
||||
rectangles = cairo_copy_clip_rectangle_list (cr);
|
||||
|
||||
if (rectangles->status != CAIRO_STATUS_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
region = cairo_region_create ();
|
||||
for (i = 0; i < rectangles->num_rectangles; i++)
|
||||
{
|
||||
cairo_rectangle_int_t clip_rect;
|
||||
cairo_rectangle_t *rect;
|
||||
|
||||
rect = &rectangles->rectangles[i];
|
||||
|
||||
/* Here we assume clip rects are ints for direct targets, which
|
||||
is true for cairo */
|
||||
clip_rect.x = (int)rect->x;
|
||||
clip_rect.y = (int)rect->y;
|
||||
clip_rect.width = (int)rect->width;
|
||||
clip_rect.height = (int)rect->height;
|
||||
|
||||
cairo_region_union_rectangle (region, &clip_rect);
|
||||
}
|
||||
|
||||
cairo_rectangle_list_destroy (rectangles);
|
||||
|
||||
return region;
|
||||
}
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@
|
||||
#endif
|
||||
|
||||
#include <gdk/gdktypes.h>
|
||||
#include <gdk/gdkpixbuf.h>
|
||||
#include <gdk/deprecated/gdkpixbuf.h>
|
||||
#include <pango/pangocairo.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 2020 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "gdkcairo.h"
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <cairo.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
gboolean _gdk_cairo_surface_extents (cairo_surface_t *surface,
|
||||
GdkRectangle *extents);
|
||||
|
||||
void gdk_cairo_surface_paint_pixbuf (cairo_surface_t *surface,
|
||||
const GdkPixbuf *pixbuf);
|
||||
|
||||
cairo_region_t *gdk_cairo_region_from_clip (cairo_t *cr);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "gdkcontentserializer.h"
|
||||
|
||||
#include "gdkcontentformats.h"
|
||||
#include "gdkpixbuf.h"
|
||||
#include "deprecated/gdkpixbuf.h"
|
||||
#include "filetransferportalprivate.h"
|
||||
#include "gdktextureprivate.h"
|
||||
#include "gdkrgba.h"
|
||||
@@ -642,7 +642,9 @@ pixbuf_serializer (GdkContentSerializer *serializer)
|
||||
else if (G_VALUE_HOLDS (value, GDK_TYPE_TEXTURE))
|
||||
{
|
||||
GdkTexture *texture = g_value_get_object (value);
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
pixbuf = gdk_pixbuf_get_from_texture (texture);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -371,6 +371,12 @@ gdk_draw_context_begin_frame_full (GdkDrawContext *context,
|
||||
priv->surface->paint_context = g_object_ref (context);
|
||||
|
||||
GDK_DRAW_CONTEXT_GET_CLASS (context)->begin_frame (context, prefers_high_depth, priv->frame_region);
|
||||
|
||||
cairo_region_intersect_rectangle (priv->frame_region,
|
||||
&(cairo_rectangle_int_t) {
|
||||
0, 0,
|
||||
priv->surface->width, priv->surface->height
|
||||
});
|
||||
}
|
||||
|
||||
#ifdef HAVE_SYSPROF
|
||||
|
||||
+23
-23
@@ -466,29 +466,26 @@ gdk_gl_context_real_get_damage (GdkGLContext *context)
|
||||
eglQuerySurface (gdk_display_get_egl_display (display), egl_surface,
|
||||
EGL_BUFFER_AGE_EXT, &buffer_age);
|
||||
|
||||
switch (buffer_age)
|
||||
if (buffer_age > 0 && buffer_age <= GDK_GL_MAX_TRACKED_BUFFERS)
|
||||
{
|
||||
case 1:
|
||||
return cairo_region_create ();
|
||||
break;
|
||||
cairo_region_t *damage = cairo_region_create ();
|
||||
int i;
|
||||
|
||||
case 2:
|
||||
if (context->old_updated_area[0])
|
||||
return cairo_region_copy (context->old_updated_area[0]);
|
||||
break;
|
||||
for (i = 0; i < buffer_age - 1; i++)
|
||||
{
|
||||
if (context->old_updated_area[i] == NULL)
|
||||
{
|
||||
cairo_region_create_rectangle (&(GdkRectangle) {
|
||||
0, 0,
|
||||
gdk_surface_get_width (surface),
|
||||
gdk_surface_get_height (surface)
|
||||
});
|
||||
break;
|
||||
}
|
||||
cairo_region_union (damage, context->old_updated_area[i]);
|
||||
}
|
||||
|
||||
case 3:
|
||||
if (context->old_updated_area[0] &&
|
||||
context->old_updated_area[1])
|
||||
{
|
||||
cairo_region_t *damage = cairo_region_copy (context->old_updated_area[0]);
|
||||
cairo_region_union (damage, context->old_updated_area[1]);
|
||||
return damage;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
return damage;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -597,6 +594,7 @@ gdk_gl_context_real_begin_frame (GdkDrawContext *draw_context,
|
||||
cairo_region_t *damage;
|
||||
double scale;
|
||||
int ww, wh;
|
||||
int i;
|
||||
|
||||
surface = gdk_draw_context_get_surface (draw_context);
|
||||
scale = gdk_gl_context_get_scale (context);
|
||||
@@ -608,9 +606,11 @@ gdk_gl_context_real_begin_frame (GdkDrawContext *draw_context,
|
||||
|
||||
damage = GDK_GL_CONTEXT_GET_CLASS (context)->get_damage (context);
|
||||
|
||||
if (context->old_updated_area[1])
|
||||
cairo_region_destroy (context->old_updated_area[1]);
|
||||
context->old_updated_area[1] = context->old_updated_area[0];
|
||||
g_clear_pointer (&context->old_updated_area[GDK_GL_MAX_TRACKED_BUFFERS - 1], cairo_region_destroy);
|
||||
for (i = GDK_GL_MAX_TRACKED_BUFFERS - 1; i > 0; i--)
|
||||
{
|
||||
context->old_updated_area[i] = context->old_updated_area[i - 1];
|
||||
}
|
||||
context->old_updated_area[0] = cairo_region_copy (region);
|
||||
|
||||
cairo_region_union (region, damage);
|
||||
|
||||
@@ -34,6 +34,11 @@ typedef enum {
|
||||
GDK_GL_CGL
|
||||
} GdkGLBackend;
|
||||
|
||||
/* The maximum amount of buffers we track update regions for.
|
||||
* Note that this is equal to the max buffer age value we
|
||||
* can provide a damage region for */
|
||||
#define GDK_GL_MAX_TRACKED_BUFFERS 4
|
||||
|
||||
#define GDK_GL_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_GL_CONTEXT, GdkGLContextClass))
|
||||
#define GDK_IS_GL_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_GL_CONTEXT))
|
||||
#define GDK_GL_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_GL_CONTEXT, GdkGLContextClass))
|
||||
@@ -45,7 +50,7 @@ struct _GdkGLContext
|
||||
GdkDrawContext parent_instance;
|
||||
|
||||
/* We store the old drawn areas to support buffer-age optimizations */
|
||||
cairo_region_t *old_updated_area[2];
|
||||
cairo_region_t *old_updated_area[GDK_GL_MAX_TRACKED_BUFFERS];
|
||||
};
|
||||
|
||||
struct _GdkGLContextClass
|
||||
|
||||
+9
-1
@@ -171,13 +171,21 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
|
||||
Download *download = download_;
|
||||
GLenum gl_internal_format, gl_format, gl_type;
|
||||
int major, minor;
|
||||
unsigned int internal_texture_format, dummy;
|
||||
|
||||
expected_stride = texture->width * gdk_memory_format_bytes_per_pixel (download->format);
|
||||
gdk_gl_context_get_version (context, &major, &minor);
|
||||
|
||||
gdk_memory_format_gl_format (gdk_texture_get_format (texture),
|
||||
FALSE,
|
||||
major, minor,
|
||||
&internal_texture_format,
|
||||
&dummy, &dummy);
|
||||
|
||||
if (download->stride == expected_stride &&
|
||||
!gdk_gl_context_get_use_es (context) &&
|
||||
gdk_memory_format_gl_format (download->format, TRUE, major, minor, &gl_internal_format, &gl_format, &gl_type))
|
||||
gdk_memory_format_gl_format (download->format, FALSE, major, minor, &gl_internal_format, &gl_format, &gl_type) &&
|
||||
gl_internal_format == internal_texture_format)
|
||||
{
|
||||
glGetTexImage (GL_TEXTURE_2D,
|
||||
0,
|
||||
|
||||
@@ -600,6 +600,11 @@ gdk_memory_convert (guchar *dest_data,
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
src_desc->to_float (tmp, src_data, width);
|
||||
|
||||
/* Note: Converting from a premultiplied format to an opaque format is defined
|
||||
* to yield the same result as compositing over black, which works out to
|
||||
* using the premultiplied values, and just dropping alpha.
|
||||
*/
|
||||
if (src_desc->alpha == GDK_MEMORY_ALPHA_PREMULTIPLIED && dest_desc->alpha == GDK_MEMORY_ALPHA_STRAIGHT)
|
||||
unpremultiply (tmp, width);
|
||||
else if (src_desc->alpha == GDK_MEMORY_ALPHA_STRAIGHT && dest_desc->alpha != GDK_MEMORY_ALPHA_STRAIGHT)
|
||||
|
||||
+3
-1
@@ -170,7 +170,7 @@ parse_rgb_value (const char *str,
|
||||
*
|
||||
* The string can be either one of:
|
||||
*
|
||||
* - A standard name (Taken from the Css specification).
|
||||
* - A standard name (Taken from the CSS specification).
|
||||
* - A hexadecimal value in the form “\#rgb”, “\#rrggbb”,
|
||||
* “\#rrrgggbbb” or ”\#rrrrggggbbbb”
|
||||
* - A hexadecimal value in the form “\#rgba”, “\#rrggbbaa”,
|
||||
@@ -178,6 +178,8 @@ parse_rgb_value (const char *str,
|
||||
* - A RGB color in the form “rgb(r,g,b)” (In this case the color
|
||||
* will have full opacity)
|
||||
* - A RGBA color in the form “rgba(r,g,b,a)”
|
||||
* - A HSL color in the form "hsl(hue, saturation, lightness)"
|
||||
* - A HSLA color in the form "hsla(hue, saturation, lightness, alpha)"
|
||||
*
|
||||
* Where “r”, “g”, “b” and “a” are respectively the red, green,
|
||||
* blue and alpha color values. In the last two cases, “r”, “g”,
|
||||
|
||||
@@ -711,6 +711,8 @@ gdk_texture_set_diff (GdkTexture *self,
|
||||
GdkTexture *previous,
|
||||
cairo_region_t *diff)
|
||||
{
|
||||
g_assert (self->diff_to_previous == NULL);
|
||||
|
||||
self->previous_texture = previous;
|
||||
self->diff_to_previous = diff;
|
||||
g_atomic_pointer_set (&previous->next_texture, self);
|
||||
|
||||
@@ -225,17 +225,17 @@ gdk_texture_downloader_download_into (const GdkTextureDownloader *self,
|
||||
/**
|
||||
* gdk_texture_downloader_download_bytes:
|
||||
* @self: the downloader
|
||||
* @out_stride: (out): The stride of the resulting data in bytes.
|
||||
* @out_stride: (out): The stride of the resulting data in bytes
|
||||
*
|
||||
* Downloads the given texture pixels into a `GBytes`. The rowstride will
|
||||
* be stored in the stride value.
|
||||
*
|
||||
* This function will abort if it tries to download a large texture and
|
||||
* fails to allocate memory. If you think that may happen, you should
|
||||
* handle memory allocation yourself and use
|
||||
* gdk_texture_downloader_download_into() once allocation succeeded.
|
||||
* fails to allocate memory. If you think that may happen, you should handle
|
||||
* memory allocation yourself and use [method@Gdk.TextureDownloader.download_into]
|
||||
* once allocation succeeded.
|
||||
*
|
||||
* Returns: The downloaded pixels.
|
||||
* Returns: The downloaded pixels
|
||||
*
|
||||
* Since: 4.10
|
||||
**/
|
||||
|
||||
+7
-4
@@ -135,7 +135,8 @@ gdk_toplevel_default_export_handle_finish (GdkToplevel *toplevel,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_toplevel_default_unexport_handle (GdkToplevel *toplevel)
|
||||
gdk_toplevel_default_unexport_handle (GdkToplevel *toplevel,
|
||||
const char *handle)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -791,7 +792,7 @@ gdk_toplevel_export_handle (GdkToplevel *toplevel,
|
||||
* @result: the `GAsyncResult`
|
||||
* @error: return location for an error
|
||||
*
|
||||
* Finishes the [method@Gdk.Toplevel.export_handle] cal and
|
||||
* Finishes the [method@Gdk.Toplevel.export_handle] call and
|
||||
* returns the resulting handle.
|
||||
*
|
||||
* Returns: (nullable) (transfer full): the exported handle,
|
||||
@@ -810,6 +811,7 @@ gdk_toplevel_export_handle_finish (GdkToplevel *toplevel,
|
||||
/*< private >
|
||||
* gdk_toplevel_unexport_handle:
|
||||
* @toplevel: a `GdkToplevel`
|
||||
* @handle: the handle to unexport
|
||||
*
|
||||
* Destroys the handle that was obtained with [method@Gdk.Toplevel.export_handle].
|
||||
*
|
||||
@@ -819,7 +821,8 @@ gdk_toplevel_export_handle_finish (GdkToplevel *toplevel,
|
||||
* Since: 4.10
|
||||
*/
|
||||
void
|
||||
gdk_toplevel_unexport_handle (GdkToplevel *toplevel)
|
||||
gdk_toplevel_unexport_handle (GdkToplevel *toplevel,
|
||||
const char *handle)
|
||||
{
|
||||
GDK_TOPLEVEL_GET_IFACE (toplevel)->unexport_handle (toplevel);
|
||||
GDK_TOPLEVEL_GET_IFACE (toplevel)->unexport_handle (toplevel, handle);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,8 @@ struct _GdkToplevelInterface
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
void (* unexport_handle) (GdkToplevel *toplevel);
|
||||
void (* unexport_handle) (GdkToplevel *toplevel,
|
||||
const char *handle);
|
||||
};
|
||||
|
||||
typedef enum
|
||||
@@ -82,7 +83,8 @@ char *gdk_toplevel_export_handle_finish (GdkToplevel *toplevel,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
void gdk_toplevel_unexport_handle (GdkToplevel *toplevel);
|
||||
void gdk_toplevel_unexport_handle (GdkToplevel *toplevel,
|
||||
const char *handle);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
+4
-3
@@ -1,3 +1,5 @@
|
||||
subdir('deprecated')
|
||||
|
||||
gdk_public_sources = files([
|
||||
'gdk.c',
|
||||
'gdkapplaunchcontext.c',
|
||||
@@ -38,7 +40,6 @@ gdk_public_sources = files([
|
||||
'gdkmonitor.c',
|
||||
'gdkpaintable.c',
|
||||
'gdkpango.c',
|
||||
'gdkpixbuf.c',
|
||||
'gdkpipeiostream.c',
|
||||
'gdkrectangle.c',
|
||||
'gdkrgba.c',
|
||||
@@ -94,7 +95,6 @@ gdk_public_headers = files([
|
||||
'gdkmonitor.h',
|
||||
'gdkpaintable.h',
|
||||
'gdkpango.h',
|
||||
'gdkpixbuf.h',
|
||||
'gdkrectangle.h',
|
||||
'gdkrgba.h',
|
||||
'gdkseat.h',
|
||||
@@ -112,8 +112,9 @@ gdk_public_headers = files([
|
||||
'gdkdragsurface.h',
|
||||
])
|
||||
install_headers(gdk_public_headers, subdir: 'gtk-4.0/gdk/')
|
||||
install_headers(gdk_deprecated_headers, subdir: 'gtk-4.0/gdk/deprecated')
|
||||
|
||||
gdk_sources = gdk_public_sources
|
||||
gdk_sources = gdk_public_sources + gdk_deprecated_sources
|
||||
|
||||
gdk_private_h_sources = files([
|
||||
'gdkeventsprivate.h',
|
||||
|
||||
@@ -1148,7 +1148,10 @@ gdk_wayland_surface_destroy (GdkSurface *surface,
|
||||
|
||||
gdk_wayland_surface_hide_surface (surface);
|
||||
|
||||
gdk_wayland_surface_destroy_wl_surface (GDK_WAYLAND_SURFACE(surface));
|
||||
if (GDK_IS_TOPLEVEL (surface))
|
||||
gdk_wayland_toplevel_destroy (GDK_TOPLEVEL (surface));
|
||||
|
||||
gdk_wayland_surface_destroy_wl_surface (GDK_WAYLAND_SURFACE (surface));
|
||||
|
||||
frame_clock = gdk_surface_get_frame_clock (surface);
|
||||
g_signal_handlers_disconnect_by_func (frame_clock, on_frame_clock_before_paint, surface);
|
||||
|
||||
@@ -39,3 +39,4 @@ void gdk_wayland_toplevel_announce_ssd (GdkToplevel *toplevel);
|
||||
gboolean gdk_wayland_toplevel_inhibit_idle (GdkToplevel *toplevel);
|
||||
void gdk_wayland_toplevel_uninhibit_idle (GdkToplevel *toplevel);
|
||||
|
||||
void gdk_wayland_toplevel_destroy (GdkToplevel *toplevel);
|
||||
|
||||
@@ -54,11 +54,16 @@ static void gdk_wayland_toplevel_sync_parent (GdkWaylandToplevel *to
|
||||
static void gdk_wayland_toplevel_sync_parent_of_imported (GdkWaylandToplevel *toplevel);
|
||||
static void gdk_wayland_surface_create_xdg_toplevel (GdkWaylandToplevel *toplevel);
|
||||
static void gdk_wayland_toplevel_sync_title (GdkWaylandToplevel *toplevel);
|
||||
static gboolean gdk_wayland_toplevel_is_exported (GdkWaylandToplevel *toplevel);
|
||||
static void unset_transient_for_exported (GdkWaylandToplevel *toplevel);
|
||||
|
||||
/* {{{ GdkWaylandToplevel definition */
|
||||
|
||||
typedef struct {
|
||||
struct zxdg_exported_v1 *xdg_exported;
|
||||
struct zxdg_exported_v2 *xdg_exported_v2;
|
||||
char *handle;
|
||||
} GdkWaylandExported;
|
||||
|
||||
/**
|
||||
* GdkWaylandToplevel:
|
||||
*
|
||||
@@ -83,8 +88,7 @@ struct _GdkWaylandToplevel
|
||||
GdkWaylandToplevel *transient_for;
|
||||
|
||||
struct org_kde_kwin_server_decoration *server_decoration;
|
||||
struct zxdg_exported_v1 *xdg_exported;
|
||||
struct zxdg_exported_v2 *xdg_exported_v2;
|
||||
GList *exported;
|
||||
|
||||
struct {
|
||||
int width;
|
||||
@@ -102,12 +106,6 @@ struct _GdkWaylandToplevel
|
||||
gboolean size_is_fixed;
|
||||
} next_layout;
|
||||
|
||||
struct {
|
||||
GdkWaylandToplevelExported callback;
|
||||
gpointer user_data;
|
||||
GDestroyNotify destroy_func;
|
||||
} exported;
|
||||
|
||||
struct {
|
||||
gboolean was_set;
|
||||
|
||||
@@ -1280,9 +1278,6 @@ gdk_wayland_toplevel_finalize (GObject *object)
|
||||
|
||||
display_wayland->toplevels = g_list_remove (display_wayland->toplevels, self);
|
||||
|
||||
if (gdk_wayland_toplevel_is_exported (self))
|
||||
gdk_wayland_toplevel_unexport_handle (GDK_TOPLEVEL (self));
|
||||
|
||||
g_free (self->application.application_id);
|
||||
g_free (self->application.app_menu_path);
|
||||
g_free (self->application.menubar_path);
|
||||
@@ -1747,8 +1742,12 @@ xdg_exported_handle_v1 (void *data,
|
||||
struct zxdg_exported_v1 *zxdg_exported_v1,
|
||||
const char *handle)
|
||||
{
|
||||
g_task_return_pointer (G_TASK (data), g_strdup (handle), g_free);
|
||||
g_object_unref (data);
|
||||
GTask *task = G_TASK (data);
|
||||
GdkWaylandExported *exported = (GdkWaylandExported *)g_task_get_task_data (task);
|
||||
|
||||
exported->handle = g_strdup (handle);
|
||||
g_task_return_pointer (task, g_strdup (handle), g_free);
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
static const struct zxdg_exported_v1_listener xdg_exported_listener_v1 = {
|
||||
@@ -1760,8 +1759,12 @@ xdg_exported_handle_v2 (void *data,
|
||||
struct zxdg_exported_v2 *zxdg_exported_v2,
|
||||
const char *handle)
|
||||
{
|
||||
g_task_return_pointer (G_TASK (data), g_strdup (handle), g_free);
|
||||
g_object_unref (data);
|
||||
GTask *task = G_TASK (data);
|
||||
GdkWaylandExported *exported = (GdkWaylandExported *)g_task_get_task_data (task);
|
||||
|
||||
exported->handle = g_strdup (handle);
|
||||
g_task_return_pointer (task, g_strdup (handle), g_free);
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
static const struct zxdg_exported_v2_listener xdg_exported_listener_v2 = {
|
||||
@@ -1784,19 +1787,27 @@ gdk_wayland_toplevel_real_export_handle (GdkToplevel *toplevel,
|
||||
|
||||
if (display_wayland->xdg_exporter_v2)
|
||||
{
|
||||
wayland_toplevel->xdg_exported_v2 =
|
||||
GdkWaylandExported *exported = g_new0 (GdkWaylandExported, 1);
|
||||
exported->xdg_exported_v2 =
|
||||
zxdg_exporter_v2_export_toplevel (display_wayland->xdg_exporter_v2,
|
||||
gdk_wayland_surface_get_wl_surface (surface));
|
||||
zxdg_exported_v2_add_listener (wayland_toplevel->xdg_exported_v2,
|
||||
zxdg_exported_v2_add_listener (exported->xdg_exported_v2,
|
||||
&xdg_exported_listener_v2, task);
|
||||
|
||||
wayland_toplevel->exported = g_list_prepend (wayland_toplevel->exported, exported);
|
||||
g_task_set_task_data (task, exported, NULL);
|
||||
}
|
||||
else if (display_wayland->xdg_exporter)
|
||||
{
|
||||
wayland_toplevel->xdg_exported =
|
||||
GdkWaylandExported *exported = g_new0 (GdkWaylandExported, 1);
|
||||
exported->xdg_exported =
|
||||
zxdg_exporter_v1_export (display_wayland->xdg_exporter,
|
||||
gdk_wayland_surface_get_wl_surface (surface));
|
||||
zxdg_exported_v1_add_listener (wayland_toplevel->xdg_exported,
|
||||
zxdg_exported_v1_add_listener (exported->xdg_exported,
|
||||
&xdg_exported_listener_v1, task);
|
||||
|
||||
wayland_toplevel->exported = g_list_prepend (wayland_toplevel->exported, exported);
|
||||
g_task_set_task_data (task, exported, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1815,15 +1826,36 @@ gdk_wayland_toplevel_real_export_handle_finish (GdkToplevel *toplevel,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_toplevel_real_unexport_handle (GdkToplevel *toplevel)
|
||||
destroy_exported (GdkWaylandExported *exported)
|
||||
{
|
||||
g_clear_pointer (&exported->handle, g_free);
|
||||
g_clear_pointer (&exported->xdg_exported_v2, zxdg_exported_v2_destroy);
|
||||
g_clear_pointer (&exported->xdg_exported, zxdg_exported_v1_destroy);
|
||||
g_free (exported);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_toplevel_real_unexport_handle (GdkToplevel *toplevel,
|
||||
const char *handle)
|
||||
{
|
||||
GdkWaylandToplevel *wayland_toplevel = GDK_WAYLAND_TOPLEVEL (toplevel);
|
||||
|
||||
g_return_if_fail (GDK_IS_WAYLAND_TOPLEVEL (toplevel));
|
||||
g_return_if_fail (wayland_toplevel->xdg_exported_v2 || wayland_toplevel->xdg_exported);
|
||||
g_return_if_fail (handle != NULL);
|
||||
|
||||
g_clear_pointer (&wayland_toplevel->xdg_exported_v2, zxdg_exported_v2_destroy);
|
||||
g_clear_pointer (&wayland_toplevel->xdg_exported, zxdg_exported_v1_destroy);
|
||||
for (GList *l = wayland_toplevel->exported; l; l = l->next)
|
||||
{
|
||||
GdkWaylandExported *exported = l->data;
|
||||
|
||||
if (exported->handle && strcmp (exported->handle, handle) == 0)
|
||||
{
|
||||
wayland_toplevel->exported = g_list_delete_link (wayland_toplevel->exported, l);
|
||||
destroy_exported (exported);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
g_warn_if_reached ();
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -2255,6 +2287,32 @@ gdk_wayland_toplevel_set_dbus_properties (GdkToplevel *toplevel,
|
||||
maybe_set_gtk_surface_dbus_properties (wayland_toplevel);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_wayland_toplevel_destroy (GdkToplevel *toplevel)
|
||||
{
|
||||
GdkWaylandToplevel *self = GDK_WAYLAND_TOPLEVEL (toplevel);
|
||||
|
||||
while (self->exported)
|
||||
{
|
||||
GdkWaylandExported *exported = self->exported->data;
|
||||
self->exported = g_list_delete_link (self->exported, self->exported);
|
||||
if (exported->handle == NULL)
|
||||
{
|
||||
GTask *task;
|
||||
|
||||
if (exported->xdg_exported_v2)
|
||||
task = G_TASK (wl_proxy_get_user_data ((struct wl_proxy *) exported->xdg_exported_v2));
|
||||
else
|
||||
task = G_TASK (wl_proxy_get_user_data ((struct wl_proxy *) exported->xdg_exported));
|
||||
|
||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED, "Surface was destroyed");
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
destroy_exported (exported);
|
||||
}
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ Toplevel API */
|
||||
|
||||
@@ -2397,12 +2455,6 @@ gdk_wayland_toplevel_uninhibit_idle (GdkToplevel *toplevel)
|
||||
* marking surfaces as transient for out-of-process surfaces.
|
||||
*/
|
||||
|
||||
static gboolean
|
||||
gdk_wayland_toplevel_is_exported (GdkWaylandToplevel *toplevel)
|
||||
{
|
||||
return toplevel->xdg_exported != NULL || toplevel->xdg_exported_v2 != NULL;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
GdkWaylandToplevelExported callback;
|
||||
gpointer user_data;
|
||||
@@ -2450,6 +2502,12 @@ export_handle_done (GObject *source,
|
||||
* from another surface as transient for this one, see
|
||||
* [method@GdkWayland.WaylandToplevel.set_transient_for_exported].
|
||||
*
|
||||
* Before 4.12, this API could not safely be used multiple times,
|
||||
* since there was no reference counting for handles. Starting with
|
||||
* 4.12, every call to this function obtains a new handle, and every
|
||||
* call to [method@GdkWayland.WaylandToplevel.drop_exported_handle] drops
|
||||
* just the handle that it is given.
|
||||
*
|
||||
* Note that this API depends on an unstable Wayland protocol,
|
||||
* and thus may require changes in the future.
|
||||
*
|
||||
@@ -2486,15 +2544,53 @@ gdk_wayland_toplevel_export_handle (GdkToplevel *toplevel,
|
||||
* It is an error to call this function on a surface that
|
||||
* does not have a handle.
|
||||
*
|
||||
* Since 4.12, this function does nothing. Use
|
||||
* [method@GdkWayland.WaylandToplevel.drop_exported_handle] instead to drop a
|
||||
* handle that was obtained with [method@GdkWayland.WaylandToplevel.export_handle].
|
||||
*
|
||||
* Note that this API depends on an unstable Wayland protocol,
|
||||
* and thus may require changes in the future.
|
||||
*
|
||||
* Deprecated: 4.12: Use [method@GdkWayland.WaylandToplevel.drop_exported_handle]
|
||||
* instead, this function does nothing
|
||||
*/
|
||||
void
|
||||
gdk_wayland_toplevel_unexport_handle (GdkToplevel *toplevel)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_WAYLAND_TOPLEVEL (toplevel));
|
||||
GdkWaylandToplevel *wayland_toplevel = GDK_WAYLAND_TOPLEVEL (toplevel);
|
||||
|
||||
gdk_toplevel_unexport_handle (toplevel);
|
||||
if (wayland_toplevel->exported != NULL &&
|
||||
wayland_toplevel->exported->next == NULL)
|
||||
{
|
||||
GdkWaylandExported *exported = wayland_toplevel->exported->data;
|
||||
|
||||
if (exported->handle)
|
||||
{
|
||||
gdk_toplevel_unexport_handle (toplevel, exported->handle);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
g_warning ("Use gdk_wayland_toplevel_drop_exported_handle()");
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_wayland_toplevel_drop_exported_handle:
|
||||
* @toplevel: (type GdkWaylandToplevel): the `GdkToplevel` that was exported
|
||||
* @handle: the handle to drop
|
||||
*
|
||||
* Destroy a handle that was obtained with gdk_wayland_toplevel_export_handle().
|
||||
*
|
||||
* Note that this API depends on an unstable Wayland protocol,
|
||||
* and thus may require changes in the future.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
void
|
||||
gdk_wayland_toplevel_drop_exported_handle (GdkToplevel *toplevel,
|
||||
const char *handle)
|
||||
{
|
||||
gdk_toplevel_unexport_handle (toplevel, handle);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -52,9 +52,13 @@ gboolean gdk_wayland_toplevel_export_handle (GdkToplevel
|
||||
gpointer user_data,
|
||||
GDestroyNotify destroy_func);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_12_FOR(gdk_wayland_toplevel_drop_exported_handle)
|
||||
void gdk_wayland_toplevel_unexport_handle (GdkToplevel *toplevel);
|
||||
|
||||
GDK_AVAILABLE_IN_4_12
|
||||
void gdk_wayland_toplevel_drop_exported_handle (GdkToplevel *toplevel,
|
||||
const char *handle);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_wayland_toplevel_set_transient_for_exported (GdkToplevel *toplevel,
|
||||
const char *parent_handle_str);
|
||||
|
||||
@@ -292,6 +292,7 @@ _gdk_win32_display_init_monitors (GdkWin32Display *win32_display)
|
||||
if (!w32_ex_monitor->remove)
|
||||
continue;
|
||||
|
||||
w32_ex_monitor->hmonitor = NULL;
|
||||
g_list_store_remove (G_LIST_STORE (win32_display->monitors), i);
|
||||
gdk_monitor_invalidate (ex_monitor);
|
||||
}
|
||||
|
||||
@@ -443,9 +443,6 @@ populate_monitor_devices_from_display_config (GPtrArray *monitors)
|
||||
char *path, *path_lower;
|
||||
DISPLAYCONFIG_RATIONAL *refresh;
|
||||
|
||||
if ((dispconf_paths[path_index].flags & DISPLAYCONFIG_PATH_ACTIVE) == 0)
|
||||
continue;
|
||||
|
||||
tdn.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME;
|
||||
tdn.header.size = sizeof (tdn);
|
||||
tdn.header.adapterId = dispconf_paths[path_index].targetInfo.adapterId;
|
||||
@@ -481,6 +478,12 @@ populate_monitor_devices_from_display_config (GPtrArray *monitors)
|
||||
if (w32mon == NULL)
|
||||
continue;
|
||||
|
||||
if ((dispconf_paths[path_index].flags & DISPLAYCONFIG_PATH_ACTIVE) == 0)
|
||||
{
|
||||
w32mon->remove = TRUE;
|
||||
continue;
|
||||
}
|
||||
|
||||
mon = GDK_MONITOR (w32mon);
|
||||
|
||||
if (!tdn.flags.friendlyNameForced)
|
||||
@@ -598,6 +601,8 @@ enum_monitor (HMONITOR hmonitor,
|
||||
|
||||
if (w32mon == NULL)
|
||||
continue;
|
||||
|
||||
w32mon->hmonitor = hmonitor;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -35,6 +35,9 @@ struct _GdkWin32Monitor
|
||||
/* Device instance path (used to match GdkWin32Monitor to monitor device) */
|
||||
char *instance_path;
|
||||
|
||||
/* MOnitor handle (used to fullscreen windows on monitors) */
|
||||
HMONITOR hmonitor;
|
||||
|
||||
/* TRUE if monitor is made up by us
|
||||
* (this happens when system has logical monitors, but no physical ones).
|
||||
*/
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#include "gdkdisplay-win32.h"
|
||||
#include "gdkdevice-win32.h"
|
||||
#include "gdkcairocontext-win32.h"
|
||||
#include "gdkmonitor-win32.h"
|
||||
|
||||
#include <cairo-win32.h>
|
||||
#include <dwmapi.h>
|
||||
@@ -625,7 +626,8 @@ get_outer_rect (GdkSurface *window,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_surface_fullscreen (GdkSurface *window);
|
||||
gdk_win32_surface_fullscreen (GdkSurface *window,
|
||||
GdkMonitor *monitor);
|
||||
|
||||
static void
|
||||
show_window_internal (GdkSurface *window,
|
||||
@@ -789,11 +791,7 @@ show_window_internal (GdkSurface *window,
|
||||
}
|
||||
|
||||
|
||||
if (window->state & GDK_TOPLEVEL_STATE_FULLSCREEN)
|
||||
{
|
||||
gdk_win32_surface_fullscreen (window);
|
||||
}
|
||||
else if (window->state & GDK_TOPLEVEL_STATE_MAXIMIZED)
|
||||
if (window->state & GDK_TOPLEVEL_STATE_MAXIMIZED)
|
||||
{
|
||||
GtkShowWindow (window, SW_MAXIMIZE);
|
||||
}
|
||||
@@ -4008,11 +4006,12 @@ gdk_win32_surface_unmaximize (GdkSurface *surface)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_surface_fullscreen (GdkSurface *window)
|
||||
gdk_win32_surface_fullscreen (GdkSurface *window,
|
||||
GdkMonitor *monitor)
|
||||
{
|
||||
int x, y, width, height;
|
||||
FullscreenInfo *fi;
|
||||
HMONITOR monitor;
|
||||
HMONITOR hmonitor = NULL;
|
||||
MONITORINFO mi;
|
||||
|
||||
g_return_if_fail (GDK_IS_SURFACE (window));
|
||||
@@ -4025,9 +4024,14 @@ gdk_win32_surface_fullscreen (GdkSurface *window)
|
||||
{
|
||||
GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
|
||||
|
||||
monitor = MonitorFromWindow (GDK_SURFACE_HWND (window), MONITOR_DEFAULTTONEAREST);
|
||||
if (monitor && GDK_IS_WIN32_MONITOR (monitor))
|
||||
hmonitor = GDK_WIN32_MONITOR (monitor)->hmonitor;
|
||||
|
||||
if (!hmonitor)
|
||||
hmonitor = MonitorFromWindow (GDK_SURFACE_HWND (window), MONITOR_DEFAULTTONEAREST);
|
||||
|
||||
mi.cbSize = sizeof (mi);
|
||||
if (monitor && GetMonitorInfo (monitor, &mi))
|
||||
if (hmonitor && GetMonitorInfo (hmonitor, &mi))
|
||||
{
|
||||
x = mi.rcMonitor.left;
|
||||
y = mi.rcMonitor.top;
|
||||
@@ -4869,9 +4873,16 @@ gdk_win32_toplevel_present (GdkToplevel *toplevel,
|
||||
if (gdk_toplevel_layout_get_fullscreen (layout, &fullscreen))
|
||||
{
|
||||
if (fullscreen)
|
||||
gdk_win32_surface_fullscreen (surface);
|
||||
{
|
||||
GdkMonitor *monitor;
|
||||
|
||||
monitor = gdk_toplevel_layout_get_fullscreen_monitor (layout);
|
||||
gdk_win32_surface_fullscreen (surface, monitor);
|
||||
}
|
||||
else
|
||||
gdk_win32_surface_unfullscreen (surface);
|
||||
{
|
||||
gdk_win32_surface_unfullscreen (surface);
|
||||
}
|
||||
}
|
||||
|
||||
gdk_win32_surface_show (surface, FALSE);
|
||||
|
||||
@@ -3089,12 +3089,15 @@ G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
*/
|
||||
signals[XEVENT] =
|
||||
g_signal_new (g_intern_static_string ("xevent"),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GdkX11DisplayClass, xevent),
|
||||
G_STRUCT_OFFSET (GdkX11DisplayClass, xevent),
|
||||
gdk_boolean_handled_accumulator, NULL,
|
||||
_gdk_marshal_BOOLEAN__POINTER,
|
||||
G_TYPE_BOOLEAN, 1, G_TYPE_POINTER);
|
||||
g_signal_set_va_marshaller (signals[XEVENT],
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
_gdk_marshal_BOOLEAN__POINTERv);
|
||||
|
||||
_gdk_x11_surfaceing_init ();
|
||||
}
|
||||
|
||||
@@ -144,7 +144,8 @@ struct _GdkX11Display
|
||||
guint server_time_is_monotonic_time : 1;
|
||||
|
||||
/* GLX extensions we check */
|
||||
guint has_glx_swap_interval : 1;
|
||||
guint has_glx_sgi_swap_control : 1;
|
||||
guint has_glx_swap_control : 1;
|
||||
guint has_glx_create_context : 1;
|
||||
guint has_glx_texture_from_pixmap : 1;
|
||||
guint has_glx_video_sync : 1;
|
||||
|
||||
+45
-29
@@ -162,7 +162,7 @@ gdk_x11_gl_context_glx_end_frame (GdkDrawContext *draw_context,
|
||||
if (display_x11->has_glx_video_sync)
|
||||
glXGetVideoSyncSGI (&end_frame_counter);
|
||||
|
||||
if (self->do_frame_sync && !display_x11->has_glx_swap_interval)
|
||||
if (self->do_frame_sync && !display_x11->has_glx_sgi_swap_control && !display_x11->has_glx_swap_control)
|
||||
{
|
||||
glFinish ();
|
||||
|
||||
@@ -249,7 +249,7 @@ gdk_x11_gl_context_glx_make_current (GdkGLContext *context,
|
||||
if (!glXMakeContextCurrent (dpy, drawable, drawable, self->glx_context))
|
||||
return FALSE;
|
||||
|
||||
if (!surfaceless && GDK_X11_DISPLAY (display)->has_glx_swap_interval)
|
||||
if (!surfaceless)
|
||||
{
|
||||
/* If the WM is compositing there is no particular need to delay
|
||||
* the swap when drawing on the offscreen, rendering to the screen
|
||||
@@ -257,14 +257,35 @@ gdk_x11_gl_context_glx_make_current (GdkGLContext *context,
|
||||
* to the vblank. */
|
||||
do_frame_sync = ! gdk_display_is_composited (display);
|
||||
|
||||
if (do_frame_sync != self->do_frame_sync)
|
||||
if (GDK_X11_DISPLAY (display)->has_glx_swap_control)
|
||||
{
|
||||
self->do_frame_sync = do_frame_sync;
|
||||
if (do_frame_sync != self->do_frame_sync)
|
||||
{
|
||||
self->do_frame_sync = do_frame_sync;
|
||||
|
||||
if (do_frame_sync)
|
||||
glXSwapIntervalSGI (1);
|
||||
else
|
||||
glXSwapIntervalSGI (0);
|
||||
if (do_frame_sync)
|
||||
glXSwapIntervalEXT (dpy, drawable, 1);
|
||||
else
|
||||
glXSwapIntervalEXT (dpy, drawable, 0);
|
||||
}
|
||||
}
|
||||
else if (GDK_X11_DISPLAY (display)->has_glx_sgi_swap_control)
|
||||
{
|
||||
/* If the WM is compositing there is no particular need to delay
|
||||
* the swap when drawing on the offscreen, rendering to the screen
|
||||
* happens later anyway, and its up to the compositor to sync that
|
||||
* to the vblank. */
|
||||
do_frame_sync = ! gdk_display_is_composited (display);
|
||||
|
||||
if (do_frame_sync != self->do_frame_sync)
|
||||
{
|
||||
self->do_frame_sync = do_frame_sync;
|
||||
|
||||
if (do_frame_sync)
|
||||
glXSwapIntervalSGI (1);
|
||||
else
|
||||
glXSwapIntervalSGI (0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,29 +308,20 @@ gdk_x11_gl_context_glx_get_damage (GdkGLContext *context)
|
||||
glXQueryDrawable (dpy, gdk_x11_gl_context_glx_get_drawable (self),
|
||||
GLX_BACK_BUFFER_AGE_EXT, &buffer_age);
|
||||
|
||||
switch (buffer_age)
|
||||
if (buffer_age > 0 && buffer_age <= GDK_GL_MAX_TRACKED_BUFFERS)
|
||||
{
|
||||
case 1:
|
||||
return cairo_region_create ();
|
||||
break;
|
||||
cairo_region_t *damage = cairo_region_create ();
|
||||
int i;
|
||||
|
||||
case 2:
|
||||
if (context->old_updated_area[0])
|
||||
return cairo_region_copy (context->old_updated_area[0]);
|
||||
break;
|
||||
for (i = 0; i < buffer_age - 1; i++)
|
||||
{
|
||||
if (context->old_updated_area[i] == NULL)
|
||||
return GDK_GL_CONTEXT_CLASS (gdk_x11_gl_context_glx_parent_class)->get_damage (context);
|
||||
|
||||
case 3:
|
||||
if (context->old_updated_area[0] &&
|
||||
context->old_updated_area[1])
|
||||
{
|
||||
cairo_region_t *damage = cairo_region_copy (context->old_updated_area[0]);
|
||||
cairo_region_union (damage, context->old_updated_area[1]);
|
||||
return damage;
|
||||
}
|
||||
break;
|
||||
cairo_region_union (damage, context->old_updated_area[i]);
|
||||
}
|
||||
|
||||
default:
|
||||
;
|
||||
return damage;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -945,8 +957,10 @@ gdk_x11_display_init_glx (GdkX11Display *display_x11,
|
||||
epoxy_has_glx_extension (dpy, screen_num, "GLX_ARB_create_context_profile");
|
||||
display_x11->has_glx_create_es2_context =
|
||||
epoxy_has_glx_extension (dpy, screen_num, "GLX_EXT_create_context_es2_profile");
|
||||
display_x11->has_glx_swap_interval =
|
||||
display_x11->has_glx_sgi_swap_control =
|
||||
epoxy_has_glx_extension (dpy, screen_num, "GLX_SGI_swap_control");
|
||||
display_x11->has_glx_swap_control =
|
||||
epoxy_has_glx_extension (dpy, screen_num, "GLX_EXT_swap_control");
|
||||
display_x11->has_glx_texture_from_pixmap =
|
||||
epoxy_has_glx_extension (dpy, screen_num, "GLX_EXT_texture_from_pixmap");
|
||||
display_x11->has_glx_video_sync =
|
||||
@@ -1007,6 +1021,7 @@ gdk_x11_display_init_glx (GdkX11Display *display_x11,
|
||||
"\t* GLX_ARB_create_context_profile: %s\n"
|
||||
"\t* GLX_EXT_create_context_es2_profile: %s\n"
|
||||
"\t* GLX_SGI_swap_control: %s\n"
|
||||
"\t* GLX_EXT_swap_control: %s\n"
|
||||
"\t* GLX_EXT_texture_from_pixmap: %s\n"
|
||||
"\t* GLX_SGI_video_sync: %s\n"
|
||||
"\t* GLX_EXT_buffer_age: %s\n"
|
||||
@@ -1018,7 +1033,8 @@ gdk_x11_display_init_glx (GdkX11Display *display_x11,
|
||||
glXGetClientString (dpy, GLX_VENDOR),
|
||||
display_x11->has_glx_create_context ? "yes" : "no",
|
||||
display_x11->has_glx_create_es2_context ? "yes" : "no",
|
||||
display_x11->has_glx_swap_interval ? "yes" : "no",
|
||||
display_x11->has_glx_sgi_swap_control ? "yes" : "no",
|
||||
display_x11->has_glx_swap_control ? "yes" : "no",
|
||||
display_x11->has_glx_texture_from_pixmap ? "yes" : "no",
|
||||
display_x11->has_glx_video_sync ? "yes" : "no",
|
||||
display_x11->has_glx_buffer_age ? "yes" : "no",
|
||||
|
||||
@@ -5318,7 +5318,8 @@ gdk_x11_toplevel_export_handle_finish (GdkToplevel *toplevel,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_x11_toplevel_unexport_handle (GdkToplevel *toplevel)
|
||||
gdk_x11_toplevel_unexport_handle (GdkToplevel *toplevel,
|
||||
const char *handle)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
|
||||
G_DEFINE_TYPE (GskGLCommandQueue, gsk_gl_command_queue, G_TYPE_OBJECT)
|
||||
|
||||
#if 0
|
||||
G_GNUC_UNUSED static inline void
|
||||
print_uniform (GskGLUniformFormat format,
|
||||
guint array_count,
|
||||
@@ -231,6 +232,7 @@ gsk_gl_command_queue_capture_png (GskGLCommandQueue *self,
|
||||
gdk_texture_save_to_png (texture, filename);
|
||||
g_object_unref (texture);
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline gboolean
|
||||
will_ignore_batch (GskGLCommandQueue *self)
|
||||
@@ -577,7 +579,7 @@ discard_batch (GskGLCommandQueue *self)
|
||||
self->batches.len--;
|
||||
}
|
||||
|
||||
void
|
||||
gboolean
|
||||
gsk_gl_command_queue_begin_draw (GskGLCommandQueue *self,
|
||||
GskGLUniformProgram *program,
|
||||
guint width,
|
||||
@@ -594,7 +596,7 @@ gsk_gl_command_queue_begin_draw (GskGLCommandQueue *self,
|
||||
* of batches we can have in one frame.
|
||||
*/
|
||||
if (will_ignore_batch (self))
|
||||
return;
|
||||
return FALSE;
|
||||
|
||||
self->program_info = program;
|
||||
|
||||
@@ -615,6 +617,8 @@ gsk_gl_command_queue_begin_draw (GskGLCommandQueue *self,
|
||||
self->fbo_max = MAX (self->fbo_max, batch->draw.framebuffer);
|
||||
|
||||
self->in_draw = TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -719,6 +723,10 @@ gsk_gl_command_queue_split_draw (GskGLCommandQueue *self)
|
||||
|
||||
g_assert (GSK_IS_GL_COMMAND_QUEUE (self));
|
||||
g_assert (self->batches.len > 0);
|
||||
|
||||
if (will_ignore_batch (self))
|
||||
return;
|
||||
|
||||
g_assert (self->in_draw == TRUE);
|
||||
|
||||
program = self->program_info;
|
||||
@@ -1439,6 +1447,7 @@ gsk_gl_command_queue_create_framebuffer (GskGLCommandQueue *self)
|
||||
return fbo_id;
|
||||
}
|
||||
|
||||
|
||||
static GdkMemoryFormat
|
||||
memory_format_gl_format (GdkMemoryFormat data_format,
|
||||
gboolean use_es,
|
||||
@@ -1603,13 +1612,13 @@ gsk_gl_command_queue_upload_texture_chunks (GskGLCommandQueue *self,
|
||||
use_es = gdk_gl_context_get_use_es (self->context);
|
||||
gdk_gl_context_get_version (self->context, &major, &minor);
|
||||
data_format = gdk_texture_get_format (chunks[0].texture);
|
||||
memory_format_gl_format (data_format,
|
||||
use_es,
|
||||
major,
|
||||
minor,
|
||||
&gl_internalformat,
|
||||
&gl_format,
|
||||
&gl_type);
|
||||
data_format = memory_format_gl_format (data_format,
|
||||
use_es,
|
||||
major,
|
||||
minor,
|
||||
&gl_internalformat,
|
||||
&gl_format,
|
||||
&gl_type);
|
||||
|
||||
glTexImage2D (GL_TEXTURE_2D, 0, gl_internalformat, width, height, 0, gl_format, gl_type, NULL);
|
||||
|
||||
|
||||
@@ -331,7 +331,7 @@ void gsk_gl_command_queue_delete_program (GskGLCommandQueue
|
||||
void gsk_gl_command_queue_clear (GskGLCommandQueue *self,
|
||||
guint clear_bits,
|
||||
const graphene_rect_t *viewport);
|
||||
void gsk_gl_command_queue_begin_draw (GskGLCommandQueue *self,
|
||||
gboolean gsk_gl_command_queue_begin_draw (GskGLCommandQueue *self,
|
||||
GskGLUniformProgram *program_info,
|
||||
guint width,
|
||||
guint height);
|
||||
|
||||
@@ -124,7 +124,7 @@ gsk_gl_compiler_new (GskGLDriver *driver,
|
||||
self->driver = g_object_ref (driver);
|
||||
self->debug_shaders = !!debug_shaders;
|
||||
|
||||
context = gsk_gl_command_queue_get_context (self->driver->shared_command_queue);
|
||||
context = gsk_gl_driver_get_context (self->driver);
|
||||
|
||||
if (gdk_gl_context_get_use_es (context))
|
||||
{
|
||||
|
||||
+20
-9
@@ -264,23 +264,20 @@ gsk_gl_driver_dispose (GObject *object)
|
||||
g_clear_object (&self->command_queue);
|
||||
}
|
||||
|
||||
if (self->autorelease_framebuffers->len > 0)
|
||||
if (self->autorelease_framebuffers != NULL &&
|
||||
self->autorelease_framebuffers->len > 0)
|
||||
{
|
||||
glDeleteFramebuffers (self->autorelease_framebuffers->len,
|
||||
(GLuint *)(gpointer)self->autorelease_framebuffers->data);
|
||||
self->autorelease_framebuffers->len = 0;
|
||||
}
|
||||
|
||||
g_clear_pointer (&self->texture_pool, g_array_unref);
|
||||
|
||||
g_assert (!self->textures || g_hash_table_size (self->textures) == 0);
|
||||
g_assert (!self->texture_id_to_key || g_hash_table_size (self->texture_id_to_key) == 0);
|
||||
g_assert (!self->key_to_texture_id|| g_hash_table_size (self->key_to_texture_id) == 0);
|
||||
|
||||
g_clear_object (&self->glyphs_library);
|
||||
g_clear_object (&self->icons_library);
|
||||
g_clear_object (&self->shadows_library);
|
||||
|
||||
g_clear_pointer (&self->texture_pool, g_array_unref);
|
||||
|
||||
g_clear_pointer (&self->autorelease_framebuffers, g_array_unref);
|
||||
g_clear_pointer (&self->key_to_texture_id, g_hash_table_unref);
|
||||
g_clear_pointer (&self->textures, g_hash_table_unref);
|
||||
@@ -474,6 +471,19 @@ gsk_gl_driver_new (GskGLCommandQueue *command_queue,
|
||||
return g_steal_pointer (&self);
|
||||
}
|
||||
|
||||
static void
|
||||
free_driver (GskGLDriver *driver)
|
||||
{
|
||||
g_object_run_dispose (G_OBJECT (driver));
|
||||
g_object_unref (driver);
|
||||
}
|
||||
|
||||
static void
|
||||
display_closed (GdkDisplay *display)
|
||||
{
|
||||
g_object_set_data (G_OBJECT (display), "GSK_GL_DRIVER", NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gsk_gl_driver_for_display:
|
||||
* @display: A #GdkDisplay that is known to support GL
|
||||
@@ -519,7 +529,8 @@ gsk_gl_driver_for_display (GdkDisplay *display,
|
||||
g_object_set_data_full (G_OBJECT (display),
|
||||
"GSK_GL_DRIVER",
|
||||
g_object_ref (driver),
|
||||
g_object_unref);
|
||||
(GDestroyNotify) free_driver);
|
||||
g_signal_connect (display, "closed", G_CALLBACK (display_closed), NULL);
|
||||
|
||||
failure:
|
||||
g_clear_object (&command_queue);
|
||||
@@ -1120,7 +1131,7 @@ gsk_gl_driver_lookup_shader (GskGLDriver *self,
|
||||
return program;
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
#if 0
|
||||
void
|
||||
gsk_gl_driver_save_texture_to_png (GskGLDriver *driver,
|
||||
int texture_id,
|
||||
|
||||
@@ -175,7 +175,7 @@ GskGLProgram * gsk_gl_driver_lookup_shader (GskGLDriver *s
|
||||
GskGLShader *shader,
|
||||
GError **error);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
#if 0
|
||||
void gsk_gl_driver_save_texture_to_png (GskGLDriver *self,
|
||||
int texture_id,
|
||||
int width,
|
||||
|
||||
+957
-913
File diff suppressed because it is too large
Load Diff
@@ -88,7 +88,7 @@ gsk_gl_texture_library_real_compact (GskGLTextureLibrary *self,
|
||||
GskGLTextureAtlasEntry *entry;
|
||||
GHashTableIter iter;
|
||||
guint dropped = 0;
|
||||
guint atlased = 0;
|
||||
G_GNUC_UNUSED guint atlased = 0;
|
||||
|
||||
g_hash_table_iter_init (&iter, self->hash_table);
|
||||
while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&entry))
|
||||
|
||||
+13
-18
@@ -238,24 +238,6 @@ gsk_renderer_get_surface (GskRenderer *renderer)
|
||||
return priv->surface;
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gsk_renderer_get_root_node:
|
||||
* @renderer: a `GskRenderer`
|
||||
*
|
||||
* Retrieves the `GskRenderNode` used by @renderer.
|
||||
*
|
||||
* Returns: (transfer none) (nullable): a `GskRenderNode`
|
||||
*/
|
||||
GskRenderNode *
|
||||
gsk_renderer_get_root_node (GskRenderer *renderer)
|
||||
{
|
||||
GskRendererPrivate *priv = gsk_renderer_get_instance_private (renderer);
|
||||
|
||||
g_return_val_if_fail (GSK_IS_RENDERER (renderer), NULL);
|
||||
|
||||
return priv->root_node;
|
||||
}
|
||||
|
||||
/**
|
||||
* gsk_renderer_is_realized: (attributes org.gtk.Method.get_property=realized)
|
||||
* @renderer: a `GskRenderer`
|
||||
@@ -313,6 +295,11 @@ gsk_renderer_realize (GskRenderer *renderer,
|
||||
}
|
||||
|
||||
priv->is_realized = TRUE;
|
||||
|
||||
g_object_notify (G_OBJECT (renderer), "realized");
|
||||
if (surface)
|
||||
g_object_notify (G_OBJECT (renderer), "surface");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -326,17 +313,25 @@ void
|
||||
gsk_renderer_unrealize (GskRenderer *renderer)
|
||||
{
|
||||
GskRendererPrivate *priv = gsk_renderer_get_instance_private (renderer);
|
||||
gboolean has_surface;
|
||||
|
||||
g_return_if_fail (GSK_IS_RENDERER (renderer));
|
||||
|
||||
if (!priv->is_realized)
|
||||
return;
|
||||
|
||||
has_surface = priv->surface != NULL;
|
||||
|
||||
GSK_RENDERER_GET_CLASS (renderer)->unrealize (renderer);
|
||||
|
||||
g_clear_object (&priv->surface);
|
||||
g_clear_pointer (&priv->prev_node, gsk_render_node_unref);
|
||||
|
||||
priv->is_realized = FALSE;
|
||||
|
||||
g_object_notify (G_OBJECT (renderer), "realized");
|
||||
if (has_surface)
|
||||
g_object_notify (G_OBJECT (renderer), "surface");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -50,8 +50,6 @@ struct _GskRendererClass
|
||||
const cairo_region_t *invalid);
|
||||
};
|
||||
|
||||
GskRenderNode * gsk_renderer_get_root_node (GskRenderer *renderer);
|
||||
|
||||
GskProfiler * gsk_renderer_get_profiler (GskRenderer *renderer);
|
||||
|
||||
GskDebugFlags gsk_renderer_get_debug_flags (GskRenderer *renderer);
|
||||
|
||||
@@ -4413,6 +4413,11 @@ gsk_shadow_node_draw (GskRenderNode *node,
|
||||
pattern = cairo_pop_group (cr);
|
||||
cairo_restore (cr);
|
||||
|
||||
cairo_save (cr);
|
||||
/* clip so the blur area stays small */
|
||||
gsk_cairo_rectangle (cr, &node->bounds);
|
||||
cairo_clip (cr);
|
||||
|
||||
for (i = 0; i < self->n_shadows; i++)
|
||||
{
|
||||
GskShadow *shadow = &self->shadows[i];
|
||||
@@ -4434,6 +4439,7 @@ gsk_shadow_node_draw (GskRenderNode *node,
|
||||
|
||||
cairo_set_source (cr, pattern);
|
||||
cairo_paint (cr);
|
||||
cairo_restore (cr);
|
||||
|
||||
cairo_pattern_destroy (pattern);
|
||||
}
|
||||
|
||||
@@ -1081,20 +1081,21 @@ parse_declarations (GtkCssParser *parser,
|
||||
{
|
||||
if (gtk_css_parser_try_ident (parser, declarations[i].name))
|
||||
{
|
||||
if (parsed & (1 << i))
|
||||
{
|
||||
gtk_css_parser_warn_syntax (parser, "Variable \"%s\" defined multiple times", declarations[i].name);
|
||||
/* Unset, just to be sure */
|
||||
parsed &= ~(1 << i);
|
||||
if (declarations[i].clear_func)
|
||||
declarations[i].clear_func (declarations[i].result);
|
||||
}
|
||||
|
||||
if (!gtk_css_parser_try_token (parser, GTK_CSS_TOKEN_COLON))
|
||||
{
|
||||
gtk_css_parser_error_syntax (parser, "Expected ':' after variable declaration");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (parsed & (1 << i))
|
||||
{
|
||||
gtk_css_parser_warn_syntax (parser, "Variable \"%s\" defined multiple times", declarations[i].name);
|
||||
/* Unset, just to be sure */
|
||||
parsed &= ~(1 << i);
|
||||
if (declarations[i].clear_func)
|
||||
declarations[i].clear_func (declarations[i].result);
|
||||
}
|
||||
if (!declarations[i].parse_func (parser, context, declarations[i].result))
|
||||
{
|
||||
/* nothing to do */
|
||||
|
||||
@@ -106,7 +106,7 @@ gsk_vulkan_clip_intersect_rounded_rect (GskVulkanClip *dest,
|
||||
break;
|
||||
|
||||
case GSK_VULKAN_CLIP_NONE:
|
||||
dest->type = gsk_rounded_rect_is_circular (&dest->rect) ? GSK_VULKAN_CLIP_ROUNDED_CIRCULAR : GSK_VULKAN_CLIP_ROUNDED;
|
||||
dest->type = gsk_rounded_rect_is_circular (rounded) ? GSK_VULKAN_CLIP_ROUNDED_CIRCULAR : GSK_VULKAN_CLIP_ROUNDED;
|
||||
gsk_rounded_rect_init_copy (&dest->rect, rounded);
|
||||
break;
|
||||
|
||||
|
||||
@@ -450,7 +450,7 @@ gsk_vulkan_glyph_cache_begin_frame (GskVulkanGlyphCache *cache)
|
||||
GHashTableIter iter;
|
||||
GlyphCacheKey *key;
|
||||
GskVulkanCachedGlyph *value;
|
||||
guint dropped = 0;
|
||||
G_GNUC_UNUSED guint dropped = 0;
|
||||
|
||||
cache->timestamp++;
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ gsk_vulkan_render_pass_new (GdkVulkanContext *context,
|
||||
graphene_matrix_init_ortho (&self->p,
|
||||
viewport->origin.x, viewport->origin.x + viewport->size.width,
|
||||
viewport->origin.y, viewport->origin.y + viewport->size.height,
|
||||
ORTHO_NEAR_PLANE,
|
||||
2 * ORTHO_NEAR_PLANE - ORTHO_FAR_PLANE,
|
||||
ORTHO_FAR_PLANE);
|
||||
|
||||
if (signal_semaphore != VK_NULL_HANDLE) // this is a dependent pass
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
# FIXME: what's up with these?
|
||||
#gsk_private_vulkan_include_shaders = [
|
||||
# 'clip.frag.glsl',
|
||||
# 'clip.vert.glsl',
|
||||
# 'constants.glsl',
|
||||
# 'rounded-rect.glsl',
|
||||
#]
|
||||
gsk_private_vulkan_include_shaders = [
|
||||
'clip.frag.glsl',
|
||||
'clip.vert.glsl',
|
||||
'constants.glsl',
|
||||
'rounded-rect.glsl',
|
||||
]
|
||||
|
||||
gsk_private_vulkan_fragment_shaders = [
|
||||
'blendmode.frag',
|
||||
@@ -51,6 +50,7 @@ foreach shader: gsk_private_vulkan_shaders
|
||||
compiled_shader = custom_target(spv_shader,
|
||||
input: shader,
|
||||
output: spv_shader,
|
||||
depend_files: gsk_private_vulkan_include_shaders,
|
||||
command: [
|
||||
glslc,
|
||||
stage_arg,
|
||||
@@ -61,6 +61,7 @@ foreach shader: gsk_private_vulkan_shaders
|
||||
compiled_clip_shader = custom_target(clip_spv_shader,
|
||||
input: shader,
|
||||
output: clip_spv_shader,
|
||||
depend_files: gsk_private_vulkan_include_shaders,
|
||||
command: [
|
||||
glslc,
|
||||
stage_arg,
|
||||
@@ -71,6 +72,7 @@ foreach shader: gsk_private_vulkan_shaders
|
||||
compiled_clip_rounded_shader = custom_target(clip_rounded_spv_shader,
|
||||
input: shader,
|
||||
output: clip_rounded_spv_shader,
|
||||
depend_files: gsk_private_vulkan_include_shaders,
|
||||
command: [
|
||||
glslc,
|
||||
stage_arg,
|
||||
|
||||
@@ -31,6 +31,7 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
typedef struct {
|
||||
GtkWindow *parent;
|
||||
char *handle;
|
||||
GAppLaunchContext *context;
|
||||
char *uri;
|
||||
GTask *task;
|
||||
@@ -39,9 +40,10 @@ typedef struct {
|
||||
static void
|
||||
gtk_show_uri_data_free (GtkShowUriData *data)
|
||||
{
|
||||
if (data->parent)
|
||||
gtk_window_unexport_handle (data->parent);
|
||||
if (data->parent && data->handle)
|
||||
gtk_window_unexport_handle (data->parent, data->handle);
|
||||
g_clear_object (&data->parent);
|
||||
g_free (data->handle);
|
||||
g_clear_object (&data->context);
|
||||
g_free (data->uri);
|
||||
g_clear_object (&data->task);
|
||||
@@ -72,7 +74,10 @@ window_handle_exported (GtkWindow *window,
|
||||
GtkShowUriData *data = user_data;
|
||||
|
||||
if (handle)
|
||||
g_app_launch_context_setenv (data->context, "PARENT_WINDOW_ID", handle);
|
||||
{
|
||||
g_app_launch_context_setenv (data->context, "PARENT_WINDOW_ID", handle);
|
||||
data->handle = g_strdup (handle);
|
||||
}
|
||||
|
||||
g_app_info_launch_default_for_uri_async (data->uri,
|
||||
data->context,
|
||||
|
||||
@@ -17,11 +17,13 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include "gdkpixbufutilsprivate.h"
|
||||
#include "gdktextureutilsprivate.h"
|
||||
#include "gtkscalerprivate.h"
|
||||
|
||||
#include "gdk/gdktextureprivate.h"
|
||||
|
||||
/* {{{ Pixbuf helpers */
|
||||
|
||||
static GdkPixbuf *
|
||||
load_from_stream (GdkPixbufLoader *loader,
|
||||
GInputStream *stream,
|
||||
@@ -91,7 +93,7 @@ size_prepared_cb (GdkPixbufLoader *loader,
|
||||
* load the image at its original size times the
|
||||
* given scale.
|
||||
*/
|
||||
GdkPixbuf *
|
||||
static GdkPixbuf *
|
||||
_gdk_pixbuf_new_from_stream_scaled (GInputStream *stream,
|
||||
double scale,
|
||||
GCancellable *cancellable,
|
||||
@@ -145,7 +147,7 @@ size_prepared_cb2 (GdkPixbufLoader *loader,
|
||||
gdk_pixbuf_loader_set_size (loader, width, height);
|
||||
}
|
||||
|
||||
GdkPixbuf *
|
||||
static GdkPixbuf *
|
||||
_gdk_pixbuf_new_from_stream_at_scale (GInputStream *stream,
|
||||
int width,
|
||||
int height,
|
||||
@@ -172,44 +174,7 @@ _gdk_pixbuf_new_from_stream_at_scale (GInputStream *stream,
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
GdkPixbuf *
|
||||
_gdk_pixbuf_new_from_stream (GInputStream *stream,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
return _gdk_pixbuf_new_from_stream_scaled (stream, 0, cancellable, error);
|
||||
}
|
||||
|
||||
/* Like gdk_pixbuf_new_from_resource_at_scale, but
|
||||
* load the image at its original size times the
|
||||
* given scale.
|
||||
*/
|
||||
GdkPixbuf *
|
||||
_gdk_pixbuf_new_from_resource_scaled (const char *resource_path,
|
||||
double scale,
|
||||
GError **error)
|
||||
{
|
||||
GInputStream *stream;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
stream = g_resources_open_stream (resource_path, 0, error);
|
||||
if (stream == NULL)
|
||||
return NULL;
|
||||
|
||||
pixbuf = _gdk_pixbuf_new_from_stream_scaled (stream, scale, NULL, error);
|
||||
g_object_unref (stream);
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
GdkPixbuf *
|
||||
_gdk_pixbuf_new_from_resource (const char *resource_path,
|
||||
GError **error)
|
||||
{
|
||||
return _gdk_pixbuf_new_from_resource_scaled (resource_path, 0, error);
|
||||
}
|
||||
|
||||
GdkPixbuf *
|
||||
static GdkPixbuf *
|
||||
_gdk_pixbuf_new_from_resource_at_scale (const char *resource_path,
|
||||
int width,
|
||||
int height,
|
||||
@@ -227,9 +192,11 @@ _gdk_pixbuf_new_from_resource_at_scale (const char *resource_path,
|
||||
g_object_unref (stream);
|
||||
|
||||
return pixbuf;
|
||||
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ Symbolic processing */
|
||||
|
||||
static GdkPixbuf *
|
||||
load_symbolic_svg (const char *escaped_file_data,
|
||||
int width,
|
||||
@@ -335,19 +302,17 @@ gtk_make_symbolic_pixbuf_from_data (const char *file_data,
|
||||
char *escaped_file_data;
|
||||
|
||||
/* Fetch size from the original icon */
|
||||
{
|
||||
GInputStream *stream = g_memory_input_stream_new_from_data (file_data, file_len, NULL);
|
||||
GdkPixbuf *reference = gdk_pixbuf_new_from_stream (stream, NULL, error);
|
||||
GInputStream *stream = g_memory_input_stream_new_from_data (file_data, file_len, NULL);
|
||||
GdkPixbuf *reference = gdk_pixbuf_new_from_stream (stream, NULL, error);
|
||||
|
||||
g_object_unref (stream);
|
||||
g_object_unref (stream);
|
||||
|
||||
if (!reference)
|
||||
return NULL;
|
||||
if (!reference)
|
||||
return NULL;
|
||||
|
||||
icon_width = gdk_pixbuf_get_width (reference);
|
||||
icon_height = gdk_pixbuf_get_height (reference);
|
||||
g_object_unref (reference);
|
||||
}
|
||||
icon_width = gdk_pixbuf_get_width (reference);
|
||||
icon_height = gdk_pixbuf_get_height (reference);
|
||||
g_object_unref (reference);
|
||||
|
||||
escaped_file_data = g_base64_encode ((guchar *) file_data, file_len);
|
||||
icon_width_str = g_strdup_printf ("%d", icon_width);
|
||||
@@ -418,12 +383,12 @@ out:
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
GdkPixbuf *
|
||||
gtk_make_symbolic_pixbuf_from_resource (const char *path,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error)
|
||||
static GdkPixbuf *
|
||||
make_symbolic_pixbuf_from_resource (const char *path,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error)
|
||||
{
|
||||
GBytes *bytes;
|
||||
const char *data;
|
||||
@@ -443,12 +408,12 @@ gtk_make_symbolic_pixbuf_from_resource (const char *path,
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
GdkPixbuf *
|
||||
gtk_make_symbolic_pixbuf_from_path (const char *path,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error)
|
||||
static GdkPixbuf *
|
||||
make_symbolic_pixbuf_from_path (const char *path,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error)
|
||||
{
|
||||
char *data;
|
||||
gsize size;
|
||||
@@ -464,12 +429,12 @@ gtk_make_symbolic_pixbuf_from_path (const char *path,
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
GdkPixbuf *
|
||||
gtk_make_symbolic_pixbuf_from_file (GFile *file,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error)
|
||||
static GdkPixbuf *
|
||||
make_symbolic_pixbuf_from_file (GFile *file,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error)
|
||||
{
|
||||
char *data;
|
||||
gsize size;
|
||||
@@ -485,6 +450,91 @@ gtk_make_symbolic_pixbuf_from_file (GFile *file,
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ Texture API */
|
||||
|
||||
GdkTexture *
|
||||
gdk_texture_new_from_stream_at_scale (GInputStream *stream,
|
||||
int width,
|
||||
int height,
|
||||
gboolean aspect,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkTexture *texture = NULL;
|
||||
|
||||
pixbuf = _gdk_pixbuf_new_from_stream_at_scale (stream, width, height, aspect, cancellable, error);
|
||||
if (pixbuf)
|
||||
{
|
||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
GdkTexture *
|
||||
gdk_texture_new_from_stream (GInputStream *stream,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkTexture *texture = NULL;
|
||||
|
||||
pixbuf = _gdk_pixbuf_new_from_stream_scaled (stream, 0, cancellable, error);
|
||||
if (pixbuf)
|
||||
{
|
||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
GdkTexture *
|
||||
gdk_texture_new_from_resource_at_scale (const char *path,
|
||||
int width,
|
||||
int height,
|
||||
gboolean preserve_aspect,
|
||||
GError **error)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkTexture *texture = NULL;
|
||||
|
||||
pixbuf = _gdk_pixbuf_new_from_resource_at_scale (path, width, height, preserve_aspect, error);
|
||||
if (pixbuf)
|
||||
{
|
||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ Symbolic texture API */
|
||||
|
||||
GdkTexture *
|
||||
gdk_texture_new_from_path_symbolic (const char *path,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkTexture *texture = NULL;
|
||||
|
||||
pixbuf = make_symbolic_pixbuf_from_path (path, width, height, scale, error);
|
||||
if (pixbuf)
|
||||
{
|
||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
GdkTexture *
|
||||
gtk_load_symbolic_texture_from_resource (const char *path)
|
||||
{
|
||||
@@ -492,16 +542,16 @@ gtk_load_symbolic_texture_from_resource (const char *path)
|
||||
}
|
||||
|
||||
GdkTexture *
|
||||
gtk_make_symbolic_texture_from_resource (const char *path,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error)
|
||||
gdk_texture_new_from_resource_symbolic (const char *path,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkTexture *texture = NULL;
|
||||
|
||||
pixbuf = gtk_make_symbolic_pixbuf_from_resource (path, width, height, scale, error);
|
||||
pixbuf = make_symbolic_pixbuf_from_resource (path, width, height, scale, error);
|
||||
if (pixbuf)
|
||||
{
|
||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
||||
@@ -522,7 +572,7 @@ gtk_load_symbolic_texture_from_file (GFile *file)
|
||||
if (stream == NULL)
|
||||
return NULL;
|
||||
|
||||
pixbuf = _gdk_pixbuf_new_from_stream (stream, NULL, NULL);
|
||||
pixbuf = gdk_pixbuf_new_from_stream (stream, NULL, NULL);
|
||||
g_object_unref (stream);
|
||||
if (pixbuf == NULL)
|
||||
return NULL;
|
||||
@@ -534,22 +584,25 @@ gtk_load_symbolic_texture_from_file (GFile *file)
|
||||
}
|
||||
|
||||
GdkTexture *
|
||||
gtk_make_symbolic_texture_from_file (GFile *file,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error)
|
||||
gdk_texture_new_from_file_symbolic (GFile *file,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkTexture *texture;
|
||||
|
||||
pixbuf = gtk_make_symbolic_pixbuf_from_file (file, width, height, scale, error);
|
||||
pixbuf = make_symbolic_pixbuf_from_file (file, width, height, scale, error);
|
||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
||||
g_object_unref (pixbuf);
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ Scaled paintable API */
|
||||
|
||||
typedef struct {
|
||||
int scale_factor;
|
||||
} LoaderData;
|
||||
@@ -576,7 +629,7 @@ on_loader_size_prepared (GdkPixbufLoader *loader,
|
||||
height * loader_data->scale_factor);
|
||||
}
|
||||
|
||||
GdkPaintable *
|
||||
static GdkPaintable *
|
||||
gdk_paintable_new_from_bytes_scaled (GBytes *bytes,
|
||||
int scale_factor)
|
||||
{
|
||||
@@ -680,3 +733,7 @@ gdk_paintable_new_from_file_scaled (GFile *file,
|
||||
|
||||
return paintable;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* vim:set foldmethod=marker expandtab: */
|
||||
@@ -21,30 +21,6 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GdkPixbuf *_gdk_pixbuf_new_from_stream (GInputStream *stream,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
GdkPixbuf *_gdk_pixbuf_new_from_stream_at_scale (GInputStream *stream,
|
||||
int width,
|
||||
int height,
|
||||
gboolean aspect,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
GdkPixbuf *_gdk_pixbuf_new_from_stream_scaled (GInputStream *stream,
|
||||
double scale,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
GdkPixbuf *_gdk_pixbuf_new_from_resource (const char *resource_path,
|
||||
GError **error);
|
||||
GdkPixbuf *_gdk_pixbuf_new_from_resource_at_scale (const char *resource_path,
|
||||
int width,
|
||||
int height,
|
||||
gboolean preserve_aspect,
|
||||
GError **error);
|
||||
GdkPixbuf *_gdk_pixbuf_new_from_resource_scaled (const char *resource_path,
|
||||
double scale,
|
||||
GError **error);
|
||||
|
||||
GdkPixbuf *gtk_make_symbolic_pixbuf_from_data (const char *data,
|
||||
gsize len,
|
||||
int width,
|
||||
@@ -52,36 +28,41 @@ GdkPixbuf *gtk_make_symbolic_pixbuf_from_data (const char *data,
|
||||
double scale,
|
||||
const char *debug_output_to,
|
||||
GError **error);
|
||||
GdkPixbuf *gtk_make_symbolic_pixbuf_from_file (GFile *file,
|
||||
|
||||
GdkTexture *gdk_texture_new_from_stream (GInputStream *stream,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
GdkTexture *gdk_texture_new_from_stream_at_scale (GInputStream *stream,
|
||||
int width,
|
||||
int height,
|
||||
gboolean aspect,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
GdkTexture *gdk_texture_new_from_resource_at_scale (const char *path,
|
||||
int width,
|
||||
int height,
|
||||
gboolean aspect,
|
||||
GError **error);
|
||||
|
||||
GdkTexture *gdk_texture_new_from_path_symbolic (const char *path,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error);
|
||||
GdkPixbuf *gtk_make_symbolic_pixbuf_from_path (const char *path,
|
||||
GdkTexture *gdk_texture_new_from_file_symbolic (GFile *file,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error);
|
||||
GdkPixbuf *gtk_make_symbolic_pixbuf_from_resource (const char *path,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error);
|
||||
GdkTexture *gtk_load_symbolic_texture_from_file (GFile *file);
|
||||
GdkTexture *gtk_make_symbolic_texture_from_file (GFile *file,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error);
|
||||
GdkTexture *gtk_load_symbolic_texture_from_resource (const char *data);
|
||||
GdkTexture *gtk_make_symbolic_texture_from_resource (const char *path,
|
||||
GdkTexture *gdk_texture_new_from_resource_symbolic (const char *path,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error);
|
||||
|
||||
GdkPaintable *gdk_paintable_new_from_bytes_scaled (GBytes *bytes,
|
||||
int scale_factor);
|
||||
GdkTexture *gtk_load_symbolic_texture_from_file (GFile *file);
|
||||
GdkTexture *gtk_load_symbolic_texture_from_resource (const char *data);
|
||||
|
||||
GdkPaintable *gdk_paintable_new_from_path_scaled (const char *path,
|
||||
int scale_factor);
|
||||
GdkPaintable *gdk_paintable_new_from_resource_scaled (const char *path,
|
||||
@@ -90,4 +71,3 @@ GdkPaintable *gdk_paintable_new_from_file_scaled (GFile *file,
|
||||
int scale_factor);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -366,6 +366,9 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
|
||||
_gtk_boolean_handled_accumulator, NULL,
|
||||
_gtk_marshal_BOOLEAN__STRING,
|
||||
G_TYPE_BOOLEAN, 1, G_TYPE_STRING);
|
||||
g_signal_set_va_marshaller (signals[ACTIVATE_LINK],
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
_gtk_marshal_BOOLEAN__STRINGv);
|
||||
|
||||
/**
|
||||
* GtkAboutDialog:program-name: (attributes org.gtk.Property.get=gtk_about_dialog_get_program_name org.gtk.Property.set=gtk_about_dialog_set_program_name)
|
||||
|
||||
@@ -220,6 +220,7 @@ enum
|
||||
PROP_COLUMNS,
|
||||
PROP_ENABLE_RUBBERBAND,
|
||||
PROP_HADJUSTMENT,
|
||||
PROP_HEADER_FACTORY,
|
||||
PROP_HSCROLL_POLICY,
|
||||
PROP_MODEL,
|
||||
PROP_REORDERABLE,
|
||||
@@ -629,6 +630,10 @@ gtk_column_view_get_property (GObject *object,
|
||||
g_value_set_object (value, self->hadjustment);
|
||||
break;
|
||||
|
||||
case PROP_HEADER_FACTORY:
|
||||
g_value_set_object (value, gtk_column_view_get_header_factory (self));
|
||||
break;
|
||||
|
||||
case PROP_HSCROLL_POLICY:
|
||||
g_value_set_enum (value, gtk_scrollable_get_hscroll_policy (GTK_SCROLLABLE (self->listview)));
|
||||
break;
|
||||
@@ -712,6 +717,10 @@ gtk_column_view_set_property (GObject *object,
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_HEADER_FACTORY:
|
||||
gtk_column_view_set_header_factory (self, g_value_get_object (value));
|
||||
break;
|
||||
|
||||
case PROP_HSCROLL_POLICY:
|
||||
if (gtk_scrollable_get_hscroll_policy (GTK_SCROLLABLE (self->listview)) != g_value_get_enum (value))
|
||||
{
|
||||
@@ -911,6 +920,18 @@ gtk_column_view_class_init (GtkColumnViewClass *klass)
|
||||
GTK_LIST_TAB_ALL,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GtkColumnView:header-factory: (attributes org.gtk.Property.get=gtk_column_view_get_header_factory org.gtk.Property.set=gtk_column_view_set_header_factory)
|
||||
*
|
||||
* Factory for creating header widgets.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
properties[PROP_HEADER_FACTORY] =
|
||||
g_param_spec_object ("header-factory", NULL, NULL,
|
||||
GTK_TYPE_LIST_ITEM_FACTORY,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (gobject_class, N_PROPS, properties);
|
||||
|
||||
/**
|
||||
@@ -2107,3 +2128,49 @@ gtk_column_view_get_tab_behavior (GtkColumnView *self)
|
||||
return gtk_list_view_get_tab_behavior (self->listview);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_column_view_get_header_factory: (attributes org.gtk.Method.get_property=header-factory)
|
||||
* @self: a `GtkColumnView`
|
||||
*
|
||||
* Gets the factory that's currently used to populate section headers.
|
||||
*
|
||||
* Returns: (nullable) (transfer none): The factory in use
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
GtkListItemFactory *
|
||||
gtk_column_view_get_header_factory (GtkColumnView *self)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_COLUMN_VIEW (self), NULL);
|
||||
|
||||
return gtk_list_view_get_header_factory (self->listview);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_column_view_set_header_factory: (attributes org.gtk.Method.set_property=header-factory)
|
||||
* @self: a `GtkColumnView`
|
||||
* @factory: (nullable) (transfer none): the factory to use
|
||||
*
|
||||
* Sets the `GtkListItemFactory` to use for populating the
|
||||
* [class@Gtk.ListHeader] objects used in section headers.
|
||||
*
|
||||
* If this factory is set to %NULL, the list will not show
|
||||
* section headers.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
void
|
||||
gtk_column_view_set_header_factory (GtkColumnView *self,
|
||||
GtkListItemFactory *factory)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_COLUMN_VIEW (self));
|
||||
g_return_if_fail (factory == NULL || GTK_IS_LIST_ITEM_FACTORY (factory));
|
||||
|
||||
if (factory == gtk_list_view_get_header_factory (self->listview))
|
||||
return;
|
||||
|
||||
gtk_list_view_set_header_factory (self->listview, factory);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_HEADER_FACTORY]);
|
||||
}
|
||||
|
||||
|
||||
@@ -122,5 +122,13 @@ GDK_AVAILABLE_IN_4_12
|
||||
GtkListItemFactory *
|
||||
gtk_column_view_get_row_factory (GtkColumnView *self);
|
||||
|
||||
|
||||
GDK_AVAILABLE_IN_4_12
|
||||
void gtk_column_view_set_header_factory (GtkColumnView *self,
|
||||
GtkListItemFactory *factory);
|
||||
GDK_AVAILABLE_IN_4_12
|
||||
GtkListItemFactory *
|
||||
gtk_column_view_get_header_factory (GtkColumnView *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
+43
-10
@@ -88,7 +88,7 @@ gtk_css_value_corner_transition (GtkCssValue *start,
|
||||
|
||||
static void
|
||||
gtk_css_value_corner_print (const GtkCssValue *corner,
|
||||
GString *string)
|
||||
GString *string)
|
||||
{
|
||||
_gtk_css_value_print (corner->x, string);
|
||||
if (!_gtk_css_value_equal (corner->x, corner->y))
|
||||
@@ -109,16 +109,55 @@ static const GtkCssValueClass GTK_CSS_VALUE_CORNER = {
|
||||
gtk_css_value_corner_print
|
||||
};
|
||||
|
||||
static GtkCssValue corner_singletons[] = {
|
||||
{ >K_CSS_VALUE_CORNER, 1, TRUE, NULL, NULL },
|
||||
{ >K_CSS_VALUE_CORNER, 1, TRUE, NULL, NULL },
|
||||
{ >K_CSS_VALUE_CORNER, 1, TRUE, NULL, NULL },
|
||||
{ >K_CSS_VALUE_CORNER, 1, TRUE, NULL, NULL },
|
||||
{ >K_CSS_VALUE_CORNER, 1, TRUE, NULL, NULL },
|
||||
{ >K_CSS_VALUE_CORNER, 1, TRUE, NULL, NULL },
|
||||
{ >K_CSS_VALUE_CORNER, 1, TRUE, NULL, NULL },
|
||||
{ >K_CSS_VALUE_CORNER, 1, TRUE, NULL, NULL },
|
||||
};
|
||||
|
||||
static inline void
|
||||
initialize_corner_singletons (void)
|
||||
{
|
||||
static gboolean initialized = FALSE;
|
||||
|
||||
if (initialized)
|
||||
return;
|
||||
|
||||
for (unsigned int i = 0; i < G_N_ELEMENTS (corner_singletons); i++)
|
||||
{
|
||||
corner_singletons[i].x = gtk_css_dimension_value_new (i, GTK_CSS_PX);
|
||||
corner_singletons[i].y = gtk_css_value_ref (corner_singletons[i].x);
|
||||
}
|
||||
|
||||
initialized = TRUE;
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
_gtk_css_corner_value_new (GtkCssValue *x,
|
||||
GtkCssValue *y)
|
||||
{
|
||||
GtkCssValue *result;
|
||||
|
||||
if (_gtk_css_value_equal (x, y))
|
||||
if (x == y &&
|
||||
gtk_css_number_value_get_dimension (x) == GTK_CSS_DIMENSION_LENGTH)
|
||||
{
|
||||
_gtk_css_value_unref (y);
|
||||
return x;
|
||||
initialize_corner_singletons ();
|
||||
|
||||
for (unsigned int i = 0; i < G_N_ELEMENTS (corner_singletons); i++)
|
||||
{
|
||||
if (corner_singletons[i].x == x)
|
||||
{
|
||||
gtk_css_value_unref (x);
|
||||
gtk_css_value_unref (y);
|
||||
|
||||
return gtk_css_value_ref (&corner_singletons[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_CORNER);
|
||||
@@ -162,9 +201,6 @@ double
|
||||
_gtk_css_corner_value_get_x (const GtkCssValue *corner,
|
||||
double one_hundred_percent)
|
||||
{
|
||||
if (corner->class != >K_CSS_VALUE_CORNER)
|
||||
return _gtk_css_number_value_get (corner, one_hundred_percent);
|
||||
|
||||
g_return_val_if_fail (corner != NULL, 0.0);
|
||||
g_return_val_if_fail (corner->class == >K_CSS_VALUE_CORNER, 0.0);
|
||||
|
||||
@@ -175,9 +211,6 @@ double
|
||||
_gtk_css_corner_value_get_y (const GtkCssValue *corner,
|
||||
double one_hundred_percent)
|
||||
{
|
||||
if (corner->class != >K_CSS_VALUE_CORNER)
|
||||
return _gtk_css_number_value_get (corner, one_hundred_percent);
|
||||
|
||||
g_return_val_if_fail (corner != NULL, 0.0);
|
||||
g_return_val_if_fail (corner->class == >K_CSS_VALUE_CORNER, 0.0);
|
||||
|
||||
|
||||
@@ -75,7 +75,8 @@ gtk_css_value_font_features_equal (const GtkCssValue *value1,
|
||||
g_hash_table_iter_init (&iter, value1->features);
|
||||
while (g_hash_table_iter_next (&iter, &name, &val1))
|
||||
{
|
||||
val2 = g_hash_table_lookup (value2->features, name);
|
||||
if (!g_hash_table_lookup_extended (value2->features, name, NULL, &val2))
|
||||
return FALSE;
|
||||
|
||||
if (val1 != val2)
|
||||
return FALSE;
|
||||
@@ -106,11 +107,10 @@ gtk_css_value_font_features_transition (GtkCssValue *start,
|
||||
g_hash_table_iter_init (&iter, start->features);
|
||||
while (g_hash_table_iter_next (&iter, (gpointer *)&name, (gpointer *)&start_val))
|
||||
{
|
||||
end_val = g_hash_table_lookup (end->features, name);
|
||||
if (end_val == NULL)
|
||||
if (!g_hash_table_lookup_extended (end->features, name, NULL, &end_val))
|
||||
transition = start_val;
|
||||
else
|
||||
transition = progress > 0.5 ? start_val : end_val;
|
||||
transition = progress < 0.5 ? start_val : end_val;
|
||||
|
||||
gtk_css_font_features_value_add_feature (result, name, GPOINTER_TO_INT (transition));
|
||||
}
|
||||
@@ -118,8 +118,7 @@ gtk_css_value_font_features_transition (GtkCssValue *start,
|
||||
g_hash_table_iter_init (&iter, end->features);
|
||||
while (g_hash_table_iter_next (&iter, (gpointer *)&name, (gpointer *)&end_val))
|
||||
{
|
||||
start_val = g_hash_table_lookup (start->features, name);
|
||||
if (start_val != NULL)
|
||||
if (g_hash_table_lookup_extended (end->features, name, NULL, &start_val))
|
||||
continue;
|
||||
|
||||
gtk_css_font_features_value_add_feature (result, name, GPOINTER_TO_INT (end_val));
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "gtkcssimageprivate.h"
|
||||
#include "gtkcsspalettevalueprivate.h"
|
||||
#include "gtkcsscolorvalueprivate.h"
|
||||
#include "gdkpixbufutilsprivate.h"
|
||||
#include "gdktextureutilsprivate.h"
|
||||
|
||||
#include "gtkstyleproviderprivate.h"
|
||||
|
||||
@@ -110,7 +110,7 @@ gtk_css_image_recolor_load_texture (GtkCssImageRecolor *recolor,
|
||||
if (g_str_has_suffix (uri, ".symbolic.png"))
|
||||
recolor->texture = gtk_load_symbolic_texture_from_resource (resource_path);
|
||||
else
|
||||
recolor->texture = gtk_make_symbolic_texture_from_resource (resource_path, 0, 0, 1.0, NULL);
|
||||
recolor->texture = gdk_texture_new_from_resource_symbolic (resource_path, 0, 0, 1.0, NULL);
|
||||
|
||||
g_free (resource_path);
|
||||
}
|
||||
@@ -119,7 +119,7 @@ gtk_css_image_recolor_load_texture (GtkCssImageRecolor *recolor,
|
||||
if (g_str_has_suffix (uri, ".symbolic.png"))
|
||||
recolor->texture = gtk_load_symbolic_texture_from_file (recolor->file);
|
||||
else
|
||||
recolor->texture = gtk_make_symbolic_texture_from_file (recolor->file, 0, 0, 1.0, NULL);
|
||||
recolor->texture = gdk_texture_new_from_file_symbolic (recolor->file, 0, 0, 1.0, NULL);
|
||||
}
|
||||
|
||||
g_free (uri);
|
||||
|
||||
+1
-15
@@ -47,21 +47,7 @@ gtk_css_image_url_load_image (GtkCssImageUrl *url,
|
||||
return url->loaded_image;
|
||||
}
|
||||
|
||||
/* We special case resources here so we can use gdk_texture_new_from_resource. */
|
||||
if (g_file_has_uri_scheme (url->file, "resource"))
|
||||
{
|
||||
char *uri = g_file_get_uri (url->file);
|
||||
char *resource_path = g_uri_unescape_string (uri + strlen ("resource://"), NULL);
|
||||
|
||||
texture = gdk_texture_new_from_resource (resource_path);
|
||||
|
||||
g_free (resource_path);
|
||||
g_free (uri);
|
||||
}
|
||||
else
|
||||
{
|
||||
texture = gdk_texture_new_from_file (url->file, &local_error);
|
||||
}
|
||||
texture = gdk_texture_new_from_file (url->file, &local_error);
|
||||
|
||||
if (texture == NULL)
|
||||
{
|
||||
|
||||
@@ -64,7 +64,7 @@ gtk_css_value_initial_compute (GtkCssValue *value,
|
||||
case GTK_CSS_PROPERTY_FONT_FAMILY:
|
||||
settings = gtk_style_provider_get_settings (provider);
|
||||
if (settings && gtk_settings_get_font_family (settings) != NULL)
|
||||
return _gtk_css_string_value_new (gtk_settings_get_font_family (settings));
|
||||
return _gtk_css_array_value_new (_gtk_css_string_value_new (gtk_settings_get_font_family (settings)));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
+6
-6
@@ -564,13 +564,13 @@ gtk_css_node_class_init (GtkCssNodeClass *klass)
|
||||
|
||||
cssnode_signals[STYLE_CHANGED] =
|
||||
g_signal_new (I_("style-changed"),
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkCssNodeClass, style_changed),
|
||||
NULL, NULL,
|
||||
NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_POINTER);
|
||||
NULL, NULL,
|
||||
NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_POINTER);
|
||||
|
||||
cssnode_properties[PROP_CLASSES] =
|
||||
g_param_spec_boxed ("classes", NULL, NULL,
|
||||
|
||||
+11
-6
@@ -376,6 +376,9 @@ gtk_css_dimension_value_new (double value,
|
||||
{ >K_CSS_VALUE_NUMBER, 1, TRUE, TYPE_DIMENSION, {{ GTK_CSS_PX, 2 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, TRUE, TYPE_DIMENSION, {{ GTK_CSS_PX, 3 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, TRUE, TYPE_DIMENSION, {{ GTK_CSS_PX, 4 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, TRUE, TYPE_DIMENSION, {{ GTK_CSS_PX, 5 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, TRUE, TYPE_DIMENSION, {{ GTK_CSS_PX, 6 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, TRUE, TYPE_DIMENSION, {{ GTK_CSS_PX, 7 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, TRUE, TYPE_DIMENSION, {{ GTK_CSS_PX, 8 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, TRUE, TYPE_DIMENSION, {{ GTK_CSS_PX, 16 }} }, /* Icon size default */
|
||||
{ >K_CSS_VALUE_NUMBER, 1, TRUE, TYPE_DIMENSION, {{ GTK_CSS_PX, 32 }} },
|
||||
@@ -414,16 +417,18 @@ gtk_css_dimension_value_new (double value,
|
||||
value == 1 ||
|
||||
value == 2 ||
|
||||
value == 3 ||
|
||||
value == 4)
|
||||
value == 4 ||
|
||||
value == 5 ||
|
||||
value == 6 ||
|
||||
value == 7 ||
|
||||
value == 8)
|
||||
return _gtk_css_value_ref (&px_singletons[(int) value]);
|
||||
if (value == 8)
|
||||
return _gtk_css_value_ref (&px_singletons[5]);
|
||||
if (value == 16)
|
||||
return _gtk_css_value_ref (&px_singletons[6]);
|
||||
return _gtk_css_value_ref (&px_singletons[9]);
|
||||
if (value == 32)
|
||||
return _gtk_css_value_ref (&px_singletons[7]);
|
||||
return _gtk_css_value_ref (&px_singletons[10]);
|
||||
if (value == 64)
|
||||
return _gtk_css_value_ref (&px_singletons[8]);
|
||||
return _gtk_css_value_ref (&px_singletons[11]);
|
||||
|
||||
break;
|
||||
|
||||
|
||||
+57
-3
@@ -233,6 +233,9 @@ gtk_css_provider_class_init (GtkCssProviderClass *klass)
|
||||
NULL, NULL,
|
||||
_gtk_marshal_VOID__BOXED_BOXED,
|
||||
G_TYPE_NONE, 2, GTK_TYPE_CSS_SECTION, G_TYPE_ERROR);
|
||||
g_signal_set_va_marshaller (css_provider_signals[PARSING_ERROR],
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
_gtk_marshal_VOID__BOXED_BOXEDv);
|
||||
|
||||
object_class->finalize = gtk_css_provider_finalize;
|
||||
|
||||
@@ -1092,6 +1095,9 @@ gtk_css_provider_load_internal (GtkCssProvider *self,
|
||||
* Loads @data into @css_provider.
|
||||
*
|
||||
* This clears any previously loaded information.
|
||||
*
|
||||
* Deprecated: 4.12: Use [method@Gtk.CssProvider.load_from_string]
|
||||
* or [method@Gtk.CssProvider.load_from_bytes] instead
|
||||
*/
|
||||
void
|
||||
gtk_css_provider_load_from_data (GtkCssProvider *css_provider,
|
||||
@@ -1108,11 +1114,59 @@ gtk_css_provider_load_from_data (GtkCssProvider *css_provider,
|
||||
|
||||
bytes = g_bytes_new_static (data, length);
|
||||
|
||||
gtk_css_provider_load_from_bytes (css_provider, bytes);
|
||||
|
||||
g_bytes_unref (bytes);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_css_provider_load_from_string:
|
||||
* @css_provider: a `GtkCssProvider`
|
||||
* @string: the CSS to load
|
||||
*
|
||||
* Loads @string into @css_provider.
|
||||
*
|
||||
* This clears any previously loaded information.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
void
|
||||
gtk_css_provider_load_from_string (GtkCssProvider *css_provider,
|
||||
const char *string)
|
||||
{
|
||||
GBytes *bytes;
|
||||
|
||||
g_return_if_fail (GTK_IS_CSS_PROVIDER (css_provider));
|
||||
g_return_if_fail (string != NULL);
|
||||
|
||||
bytes = g_bytes_new_static (string, strlen (string));
|
||||
|
||||
gtk_css_provider_load_from_bytes (css_provider, bytes);
|
||||
|
||||
g_bytes_unref (bytes);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_css_provider_load_from_bytes:
|
||||
* @css_provider: a `GtkCssProvider`
|
||||
* @data: `GBytes` containing the data to load
|
||||
*
|
||||
* Loads @data into @css_provider.
|
||||
*
|
||||
* This clears any previously loaded information.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
void
|
||||
gtk_css_provider_load_from_bytes (GtkCssProvider *css_provider,
|
||||
GBytes *data)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_CSS_PROVIDER (css_provider));
|
||||
g_return_if_fail (data != NULL);
|
||||
|
||||
gtk_css_provider_reset (css_provider);
|
||||
|
||||
g_bytes_ref (bytes);
|
||||
gtk_css_provider_load_internal (css_provider, NULL, NULL, bytes);
|
||||
g_bytes_unref (bytes);
|
||||
gtk_css_provider_load_internal (css_provider, NULL, NULL, g_bytes_ref (data));
|
||||
|
||||
gtk_style_provider_changed (GTK_STYLE_PROVIDER (css_provider));
|
||||
}
|
||||
|
||||
@@ -45,10 +45,18 @@ GtkCssProvider * gtk_css_provider_new (void);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
char * gtk_css_provider_to_string (GtkCssProvider *provider);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_12_FOR(gtk_css_provider_load_from_string)
|
||||
void gtk_css_provider_load_from_data (GtkCssProvider *css_provider,
|
||||
const char *data,
|
||||
gssize length);
|
||||
GDK_AVAILABLE_IN_4_12
|
||||
void gtk_css_provider_load_from_string (GtkCssProvider *css_provider,
|
||||
const char *string);
|
||||
|
||||
GDK_AVAILABLE_IN_4_12
|
||||
void gtk_css_provider_load_from_bytes (GtkCssProvider *css_provider,
|
||||
GBytes *data);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_css_provider_load_from_file (GtkCssProvider *css_provider,
|
||||
GFile *file);
|
||||
|
||||
@@ -336,10 +336,10 @@ gtk_css_shadow_value_new_filter (const GtkCssValue *other)
|
||||
ShadowValue value;
|
||||
|
||||
value.inset = FALSE;
|
||||
value.hoffset = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
|
||||
value.voffset = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
|
||||
value.radius = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
|
||||
value.spread = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
|
||||
value.hoffset = _gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
value.voffset = _gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
value.radius = _gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
value.spread = _gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
value.color = gtk_css_value_ref (other->shadows[0].color);
|
||||
|
||||
return gtk_css_shadow_value_new (&value, 1, TRUE);
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "gtkborder.h"
|
||||
#include "gtktypes.h"
|
||||
#include "gtkcssvalueprivate.h"
|
||||
#include "gtkroundedboxprivate.h"
|
||||
#include "gtksnapshot.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -1095,25 +1095,29 @@ _gtk_css_style_property_init_properties (void)
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_BACKGROUND | GTK_CSS_AFFECTS_BORDER,
|
||||
border_corner_radius_value_parse,
|
||||
_gtk_css_number_value_new (0, GTK_CSS_PX));
|
||||
_gtk_css_corner_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX),
|
||||
_gtk_css_number_value_new (0, GTK_CSS_PX)));
|
||||
gtk_css_style_property_register ("border-top-right-radius",
|
||||
GTK_CSS_PROPERTY_BORDER_TOP_RIGHT_RADIUS,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_BACKGROUND | GTK_CSS_AFFECTS_BORDER,
|
||||
border_corner_radius_value_parse,
|
||||
_gtk_css_number_value_new (0, GTK_CSS_PX));
|
||||
_gtk_css_corner_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX),
|
||||
_gtk_css_number_value_new (0, GTK_CSS_PX)));
|
||||
gtk_css_style_property_register ("border-bottom-right-radius",
|
||||
GTK_CSS_PROPERTY_BORDER_BOTTOM_RIGHT_RADIUS,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_BACKGROUND | GTK_CSS_AFFECTS_BORDER,
|
||||
border_corner_radius_value_parse,
|
||||
_gtk_css_number_value_new (0, GTK_CSS_PX));
|
||||
_gtk_css_corner_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX),
|
||||
_gtk_css_number_value_new (0, GTK_CSS_PX)));
|
||||
gtk_css_style_property_register ("border-bottom-left-radius",
|
||||
GTK_CSS_PROPERTY_BORDER_BOTTOM_LEFT_RADIUS,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_BACKGROUND | GTK_CSS_AFFECTS_BORDER,
|
||||
border_corner_radius_value_parse,
|
||||
_gtk_css_number_value_new (0, GTK_CSS_PX));
|
||||
_gtk_css_corner_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX),
|
||||
_gtk_css_number_value_new (0, GTK_CSS_PX)));
|
||||
|
||||
gtk_css_style_property_register ("outline-style",
|
||||
GTK_CSS_PROPERTY_OUTLINE_STYLE,
|
||||
@@ -1133,7 +1137,6 @@ _gtk_css_style_property_init_properties (void)
|
||||
GTK_CSS_AFFECTS_OUTLINE,
|
||||
outline_parse,
|
||||
_gtk_css_number_value_new (0.0, GTK_CSS_PX));
|
||||
|
||||
gtk_css_style_property_register ("background-clip",
|
||||
GTK_CSS_PROPERTY_BACKGROUND_CLIP,
|
||||
0,
|
||||
|
||||
@@ -142,7 +142,7 @@ gtk_css_transform_init_identity (GtkCssTransform *transform,
|
||||
case GTK_CSS_TRANSFORM_ROTATE:
|
||||
transform->rotate.x = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
|
||||
transform->rotate.y = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
|
||||
transform->rotate.z = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
|
||||
transform->rotate.z = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
transform->rotate.angle = _gtk_css_number_value_new (0, GTK_CSS_DEG);
|
||||
break;
|
||||
case GTK_CSS_TRANSFORM_SCALE:
|
||||
|
||||
+13
-4
@@ -19,7 +19,7 @@
|
||||
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
||||
* file for a list of people on the GTK+ Team. See the ChangeLog
|
||||
* files for a list of changes. These files are distributed with
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
@@ -207,7 +207,7 @@ gtk_drag_source_set_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkDragSource *source = GTK_DRAG_SOURCE (object);
|
||||
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_CONTENT:
|
||||
@@ -378,9 +378,12 @@ gtk_drag_source_class_init (GtkDragSourceClass *class)
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkDragSourceClass, prepare),
|
||||
g_signal_accumulator_first_wins, NULL,
|
||||
NULL,
|
||||
_gtk_marshal_OBJECT__DOUBLE_DOUBLE,
|
||||
GDK_TYPE_CONTENT_PROVIDER, 2,
|
||||
G_TYPE_DOUBLE, G_TYPE_DOUBLE);
|
||||
g_signal_set_va_marshaller (signals[PREPARE],
|
||||
GTK_TYPE_DRAG_SOURCE,
|
||||
_gtk_marshal_OBJECT__DOUBLE_DOUBLEv);
|
||||
|
||||
/**
|
||||
* GtkDragSource::drag-begin:
|
||||
@@ -421,10 +424,13 @@ gtk_drag_source_class_init (GtkDragSourceClass *class)
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
NULL, NULL,
|
||||
NULL,
|
||||
_gtk_marshal_VOID__OBJECT_BOOLEAN,
|
||||
G_TYPE_NONE, 2,
|
||||
GDK_TYPE_DRAG,
|
||||
G_TYPE_BOOLEAN);
|
||||
g_signal_set_va_marshaller (signals[DRAG_END],
|
||||
GTK_TYPE_DRAG_SOURCE,
|
||||
_gtk_marshal_VOID__OBJECT_BOOLEANv);
|
||||
|
||||
/**
|
||||
* GtkDragSource::drag-cancel:
|
||||
@@ -450,6 +456,9 @@ gtk_drag_source_class_init (GtkDragSourceClass *class)
|
||||
G_TYPE_BOOLEAN, 2,
|
||||
GDK_TYPE_DRAG,
|
||||
GDK_TYPE_DRAG_CANCEL_REASON);
|
||||
g_signal_set_va_marshaller (signals[DRAG_CANCEL],
|
||||
G_TYPE_FROM_CLASS (class),
|
||||
_gtk_marshal_BOOLEAN__OBJECT_ENUMv);
|
||||
}
|
||||
|
||||
static GdkContentProvider *
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "config.h"
|
||||
#include "gtkdrawingarea.h"
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gdk/gdkmarshalers.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtksnapshot.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
@@ -320,11 +321,11 @@ gtk_drawing_area_class_init (GtkDrawingAreaClass *class)
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkDrawingAreaClass, resize),
|
||||
NULL, NULL,
|
||||
_gtk_marshal_VOID__INT_INT,
|
||||
_gdk_marshal_VOID__INT_INT,
|
||||
G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
|
||||
g_signal_set_va_marshaller (signals[RESIZE],
|
||||
G_TYPE_FROM_CLASS (class),
|
||||
_gtk_marshal_VOID__INT_INTv);
|
||||
_gdk_marshal_VOID__INT_INTv);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -275,7 +275,7 @@ gtk_drop_controller_motion_class_init (GtkDropControllerMotionClass *klass)
|
||||
GTK_TYPE_DROP_CONTROLLER_MOTION,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL,
|
||||
NULL,
|
||||
_gtk_marshal_VOID__DOUBLE_DOUBLE,
|
||||
G_TYPE_NONE, 2,
|
||||
G_TYPE_DOUBLE,
|
||||
G_TYPE_DOUBLE);
|
||||
|
||||
+17
-4
@@ -29,6 +29,7 @@
|
||||
#include "gtkdropprivate.h"
|
||||
#include "gtkeventcontrollerprivate.h"
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gdk/gdkmarshalers.h"
|
||||
#include "gtknative.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
@@ -754,9 +755,12 @@ gtk_drop_target_class_init (GtkDropTargetClass *class)
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkDropTargetClass, accept),
|
||||
g_signal_accumulator_first_wins, NULL,
|
||||
NULL,
|
||||
_gdk_marshal_BOOLEAN__OBJECT,
|
||||
G_TYPE_BOOLEAN, 1,
|
||||
GDK_TYPE_DROP);
|
||||
g_signal_set_va_marshaller (signals[ACCEPT],
|
||||
GTK_TYPE_DROP_TARGET,
|
||||
_gdk_marshal_BOOLEAN__OBJECTv);
|
||||
|
||||
/**
|
||||
* GtkDropTarget::enter:
|
||||
@@ -777,9 +781,12 @@ gtk_drop_target_class_init (GtkDropTargetClass *class)
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkDropTargetClass, enter),
|
||||
g_signal_accumulator_first_wins, NULL,
|
||||
NULL,
|
||||
_gtk_marshal_FLAGS__DOUBLE_DOUBLE,
|
||||
GDK_TYPE_DRAG_ACTION, 2,
|
||||
G_TYPE_DOUBLE, G_TYPE_DOUBLE);
|
||||
g_signal_set_va_marshaller (signals[ENTER],
|
||||
GTK_TYPE_DROP_TARGET,
|
||||
_gtk_marshal_FLAGS__DOUBLE_DOUBLEv);
|
||||
|
||||
/**
|
||||
* GtkDropTarget::motion:
|
||||
@@ -798,9 +805,12 @@ gtk_drop_target_class_init (GtkDropTargetClass *class)
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkDropTargetClass, motion),
|
||||
g_signal_accumulator_first_wins, NULL,
|
||||
NULL,
|
||||
_gtk_marshal_FLAGS__DOUBLE_DOUBLE,
|
||||
GDK_TYPE_DRAG_ACTION, 2,
|
||||
G_TYPE_DOUBLE, G_TYPE_DOUBLE);
|
||||
g_signal_set_va_marshaller (signals[MOTION],
|
||||
GTK_TYPE_DROP_TARGET,
|
||||
_gtk_marshal_FLAGS__DOUBLE_DOUBLEv);
|
||||
|
||||
/**
|
||||
* GtkDropTarget::leave:
|
||||
@@ -845,9 +855,12 @@ gtk_drop_target_class_init (GtkDropTargetClass *class)
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
g_signal_accumulator_first_wins, NULL,
|
||||
NULL,
|
||||
_gtk_marshal_BOOLEAN__BOXED_DOUBLE_DOUBLE,
|
||||
G_TYPE_BOOLEAN, 3,
|
||||
G_TYPE_VALUE, G_TYPE_DOUBLE, G_TYPE_DOUBLE);
|
||||
g_signal_set_va_marshaller (signals[DROP],
|
||||
GTK_TYPE_DROP_TARGET,
|
||||
_gtk_marshal_BOOLEAN__BOXED_DOUBLE_DOUBLEv);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "gtkdropprivate.h"
|
||||
#include "gtkeventcontrollerprivate.h"
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gdk/gdkmarshalers.h"
|
||||
#include "gtknative.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkprivate.h"
|
||||
@@ -149,13 +150,13 @@ make_action_unique (GdkDragAction actions)
|
||||
|
||||
if (actions & GDK_ACTION_MOVE)
|
||||
return GDK_ACTION_MOVE;
|
||||
|
||||
|
||||
if (actions & GDK_ACTION_LINK)
|
||||
return GDK_ACTION_LINK;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static GdkDragAction
|
||||
gtk_drop_target_async_drag_enter (GtkDropTargetAsync *self,
|
||||
GdkDrop *drop,
|
||||
@@ -165,7 +166,7 @@ gtk_drop_target_async_drag_enter (GtkDropTargetAsync *self,
|
||||
return make_action_unique (self->actions & gdk_drop_get_actions (drop));
|
||||
}
|
||||
|
||||
static GdkDragAction
|
||||
static GdkDragAction
|
||||
gtk_drop_target_async_drag_motion (GtkDropTargetAsync *self,
|
||||
GdkDrop *drop,
|
||||
double x,
|
||||
@@ -430,9 +431,12 @@ gtk_drop_target_async_class_init (GtkDropTargetAsyncClass *class)
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkDropTargetAsyncClass, accept),
|
||||
g_signal_accumulator_first_wins, NULL,
|
||||
NULL,
|
||||
_gdk_marshal_BOOLEAN__OBJECT,
|
||||
G_TYPE_BOOLEAN, 1,
|
||||
GDK_TYPE_DROP);
|
||||
g_signal_set_va_marshaller (signals[ACCEPT],
|
||||
GTK_TYPE_DROP_TARGET_ASYNC,
|
||||
_gdk_marshal_BOOLEAN__OBJECTv);
|
||||
|
||||
/**
|
||||
* GtkDropTargetAsync::drag-enter:
|
||||
@@ -453,9 +457,12 @@ gtk_drop_target_async_class_init (GtkDropTargetAsyncClass *class)
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkDropTargetAsyncClass, drag_enter),
|
||||
g_signal_accumulator_first_wins, NULL,
|
||||
NULL,
|
||||
_gtk_marshal_FLAGS__OBJECT_DOUBLE_DOUBLE,
|
||||
GDK_TYPE_DRAG_ACTION, 3,
|
||||
GDK_TYPE_DROP, G_TYPE_DOUBLE, G_TYPE_DOUBLE);
|
||||
g_signal_set_va_marshaller (signals[DRAG_ENTER],
|
||||
GTK_TYPE_DROP_TARGET_ASYNC,
|
||||
_gtk_marshal_FLAGS__OBJECT_DOUBLE_DOUBLEv);
|
||||
|
||||
/**
|
||||
* GtkDropTargetAsync::drag-motion:
|
||||
@@ -474,9 +481,12 @@ gtk_drop_target_async_class_init (GtkDropTargetAsyncClass *class)
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkDropTargetAsyncClass, drag_motion),
|
||||
g_signal_accumulator_first_wins, NULL,
|
||||
NULL,
|
||||
_gtk_marshal_FLAGS__OBJECT_DOUBLE_DOUBLE,
|
||||
GDK_TYPE_DRAG_ACTION, 3,
|
||||
GDK_TYPE_DROP, G_TYPE_DOUBLE, G_TYPE_DOUBLE);
|
||||
g_signal_set_va_marshaller (signals[DRAG_MOTION],
|
||||
GTK_TYPE_DROP_TARGET_ASYNC,
|
||||
_gtk_marshal_FLAGS__OBJECT_DOUBLE_DOUBLEv);
|
||||
|
||||
/**
|
||||
* GtkDropTargetAsync::drag-leave:
|
||||
@@ -528,9 +538,12 @@ gtk_drop_target_async_class_init (GtkDropTargetAsyncClass *class)
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
g_signal_accumulator_first_wins, NULL,
|
||||
NULL,
|
||||
_gtk_marshal_BOOLEAN__OBJECT_DOUBLE_DOUBLE,
|
||||
G_TYPE_BOOLEAN, 3,
|
||||
GDK_TYPE_DROP, G_TYPE_DOUBLE, G_TYPE_DOUBLE);
|
||||
g_signal_set_va_marshaller (signals[DROP],
|
||||
GTK_TYPE_DROP_TARGET_ASYNC,
|
||||
_gtk_marshal_BOOLEAN__OBJECT_DOUBLE_DOUBLEv);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -604,7 +617,7 @@ GdkContentFormats *
|
||||
gtk_drop_target_async_get_formats (GtkDropTargetAsync *self)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_DROP_TARGET_ASYNC (self), NULL);
|
||||
|
||||
|
||||
return self->formats;
|
||||
}
|
||||
|
||||
@@ -620,7 +633,7 @@ gtk_drop_target_async_set_actions (GtkDropTargetAsync *self,
|
||||
GdkDragAction actions)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_DROP_TARGET_ASYNC (self));
|
||||
|
||||
|
||||
if (self->actions == actions)
|
||||
return;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user