Compare commits
184 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 | |||
| 9b1026886b |
@@ -1 +1,2 @@
|
|||||||
/subprojects/*/
|
/subprojects/*/
|
||||||
|
.flatpak-builder/
|
||||||
|
|||||||
+21
-1
@@ -24,7 +24,7 @@ stages:
|
|||||||
variables:
|
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"
|
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"
|
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true"
|
||||||
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled -Dbuild-demos=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
|
MESON_TEST_TIMEOUT_MULTIPLIER: 3
|
||||||
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v46"
|
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v46"
|
||||||
|
|
||||||
@@ -123,6 +123,26 @@ release-build:
|
|||||||
- LD_LIBRARY_PATH=${CI_PROJECT_DIR}/_install/lib64 meson compile -C _build_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 x11
|
||||||
|
|
||||||
|
fedora-clang:
|
||||||
|
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"
|
||||||
|
- export CC=clang
|
||||||
|
- meson subprojects download
|
||||||
|
- meson subprojects update --reset
|
||||||
|
- meson setup
|
||||||
|
${COMMON_MESON_FLAGS}
|
||||||
|
${EXTRA_MESON_FLAGS}
|
||||||
|
${BACKEND_FLAGS}
|
||||||
|
${FEATURE_FLAGS}
|
||||||
|
_build
|
||||||
|
- meson compile -C _build
|
||||||
|
|
||||||
fedora-mingw64:
|
fedora-mingw64:
|
||||||
extends: .build-fedora-default
|
extends: .build-fedora-default
|
||||||
stage: build
|
stage: build
|
||||||
|
|||||||
@@ -1,6 +1,56 @@
|
|||||||
Overview of Changes in 4.11.3, xx-xx-xxxx
|
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
|
Overview of Changes in 4.11.2, 09-05-2023
|
||||||
=========================================
|
=========================================
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ update_image (void)
|
|||||||
cairo_t *cr;
|
cairo_t *cr;
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
GdkPixbuf *pixbuf2;
|
GdkPixbuf *pixbuf2;
|
||||||
|
GdkTexture *texture;
|
||||||
cairo_font_options_t *fopt;
|
cairo_font_options_t *fopt;
|
||||||
cairo_hint_style_t hintstyle;
|
cairo_hint_style_t hintstyle;
|
||||||
cairo_hint_metrics_t hintmetrics;
|
cairo_hint_metrics_t hintmetrics;
|
||||||
@@ -120,8 +121,17 @@ update_image (void)
|
|||||||
cairo_destroy (cr);
|
cairo_destroy (cr);
|
||||||
g_object_unref (layout);
|
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));
|
pixbuf = gdk_pixbuf_new_from_data (cairo_image_surface_get_data (surface),
|
||||||
pixbuf2 = gdk_pixbuf_scale_simple (pixbuf, gdk_pixbuf_get_width (pixbuf) * scale, gdk_pixbuf_get_height (pixbuf) * scale, GDK_INTERP_NEAREST);
|
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);
|
g_object_unref (pixbuf);
|
||||||
cairo_surface_destroy (surface);
|
cairo_surface_destroy (surface);
|
||||||
@@ -278,14 +288,24 @@ retry:
|
|||||||
pango_layout_iter_free (iter);
|
pango_layout_iter_free (iter);
|
||||||
g_object_unref (layout);
|
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));
|
pixbuf = gdk_pixbuf_new_from_data (cairo_image_surface_get_data (surface),
|
||||||
pixbuf2 = gdk_pixbuf_scale_simple (pixbuf, gdk_pixbuf_get_width (pixbuf) * scale, gdk_pixbuf_get_height (pixbuf) * scale, GDK_INTERP_NEAREST);
|
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);
|
g_object_unref (pixbuf);
|
||||||
cairo_surface_destroy (surface);
|
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);
|
g_object_unref (pixbuf2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
-11
@@ -30,6 +30,7 @@ progressive_prepared_callback (GdkPixbufLoader *loader,
|
|||||||
{
|
{
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
GtkWidget *picture;
|
GtkWidget *picture;
|
||||||
|
GdkTexture *texture;
|
||||||
|
|
||||||
picture = GTK_WIDGET (data);
|
picture = GTK_WIDGET (data);
|
||||||
|
|
||||||
@@ -40,7 +41,9 @@ progressive_prepared_callback (GdkPixbufLoader *loader,
|
|||||||
*/
|
*/
|
||||||
gdk_pixbuf_fill (pixbuf, 0xaaaaaaff);
|
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
|
static void
|
||||||
@@ -51,22 +54,18 @@ progressive_updated_callback (GdkPixbufLoader *loader,
|
|||||||
int height,
|
int height,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GtkWidget *picture;
|
GtkWidget *picture = GTK_WIDGET (data);
|
||||||
GdkPixbuf *pixbuf;
|
GdkTexture *texture;
|
||||||
|
|
||||||
picture = GTK_WIDGET (data);
|
texture = gdk_texture_new_for_pixbuf (gdk_pixbuf_loader_get_pixbuf (loader));
|
||||||
|
gtk_picture_set_paintable (GTK_PICTURE (picture), GDK_PAINTABLE (texture));
|
||||||
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
|
g_object_unref (texture);
|
||||||
gtk_picture_set_pixbuf (GTK_PICTURE (picture), NULL);
|
|
||||||
gtk_picture_set_pixbuf (GTK_PICTURE (picture), pixbuf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
progressive_timeout (gpointer data)
|
progressive_timeout (gpointer data)
|
||||||
{
|
{
|
||||||
GtkWidget *picture;
|
GtkWidget *picture = GTK_WIDGET (data);
|
||||||
|
|
||||||
picture = GTK_WIDGET (data);
|
|
||||||
|
|
||||||
/* This shows off fully-paranoid error handling, so looks scary.
|
/* This shows off fully-paranoid error handling, so looks scary.
|
||||||
* You could factor out the error handling code into a nice separate
|
* You could factor out the error handling code into a nice separate
|
||||||
|
|||||||
@@ -1701,6 +1701,13 @@ node_editor_window_init (NodeEditorWindow *self)
|
|||||||
" }\n"
|
" }\n"
|
||||||
" transform: translate(0, 140);\n"
|
" transform: translate(0, 140);\n"
|
||||||
"}", -1);
|
"}", -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 *
|
NodeEditorWindow *
|
||||||
|
|||||||
@@ -1210,12 +1210,12 @@ typedef struct {
|
|||||||
static void
|
static void
|
||||||
add_background (GtkWidget *flowbox,
|
add_background (GtkWidget *flowbox,
|
||||||
const char *filename,
|
const char *filename,
|
||||||
GdkPixbuf *pixbuf,
|
GdkTexture *texture,
|
||||||
gboolean is_resource)
|
gboolean is_resource)
|
||||||
{
|
{
|
||||||
GtkWidget *child;
|
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_widget_set_size_request (child, 110, 70);
|
||||||
gtk_flow_box_insert (GTK_FLOW_BOX (flowbox), child, -1);
|
gtk_flow_box_insert (GTK_FLOW_BOX (flowbox), child, -1);
|
||||||
child = gtk_widget_get_parent (child);
|
child = gtk_widget_get_parent (child);
|
||||||
@@ -1231,6 +1231,7 @@ background_loaded_cb (GObject *source,
|
|||||||
{
|
{
|
||||||
BackgroundData *bd = data;
|
BackgroundData *bd = data;
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
|
GdkTexture *texture;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
pixbuf = gdk_pixbuf_new_from_stream_finish (res, &error);
|
pixbuf = gdk_pixbuf_new_from_stream_finish (res, &error);
|
||||||
@@ -1241,8 +1242,11 @@ background_loaded_cb (GObject *source,
|
|||||||
return;
|
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->filename);
|
||||||
g_free (bd);
|
g_free (bd);
|
||||||
}
|
}
|
||||||
@@ -1259,7 +1263,10 @@ populate_flowbox (GtkWidget *flowbox)
|
|||||||
GInputStream *stream;
|
GInputStream *stream;
|
||||||
BackgroundData *bd;
|
BackgroundData *bd;
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
|
GdkTexture *texture;
|
||||||
GtkWidget *child;
|
GtkWidget *child;
|
||||||
|
guchar *data;
|
||||||
|
GBytes *bytes;
|
||||||
int i;
|
int i;
|
||||||
const char *resources[] = {
|
const char *resources[] = {
|
||||||
"sunset.jpg", "portland-rose.jpg", "beach.jpg", "nyc.jpg"
|
"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));
|
g_object_set_data (G_OBJECT (flowbox), "populated", GUINT_TO_POINTER (1));
|
||||||
|
|
||||||
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 110, 70);
|
data = g_malloc (4 * 110 * 70);
|
||||||
gdk_pixbuf_fill (pixbuf, 0xffffffff);
|
memset (data, 0xff, 4 * 110 * 70);
|
||||||
child = gtk_picture_new_for_pixbuf (pixbuf);
|
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_widget_add_css_class (child, "frame");
|
||||||
gtk_flow_box_insert (GTK_FLOW_BOX (flowbox), child, -1);
|
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);
|
filename = g_strconcat ("/org/gtk/WidgetFactory4/", resources[i], NULL);
|
||||||
pixbuf = gdk_pixbuf_new_from_resource_at_scale (filename, 110, 110, TRUE, 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";
|
location = "/usr/share/backgrounds/gnome";
|
||||||
|
|||||||
@@ -2244,20 +2244,24 @@ microphone-sensitivity-medium-symbolic</property>
|
|||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkBox">
|
||||||
<property name="spacing">6</property>
|
<property name="spacing">6</property>
|
||||||
|
<property name="valign">center</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox" id="lockbox">
|
<object class="GtkBox" id="lockbox">
|
||||||
<property name="hexpand">1</property>
|
<property name="hexpand">1</property>
|
||||||
<property name="spacing">6</property>
|
<property name="spacing">6</property>
|
||||||
|
<property name="valign">center</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkMenuButton" id="open_menubutton">
|
<object class="GtkMenuButton" id="open_menubutton">
|
||||||
<property name="halign">3</property>
|
<property name="halign">3</property>
|
||||||
<property name="popover">open_popover</property>
|
<property name="popover">open_popover</property>
|
||||||
<property name="label">Open</property>
|
<property name="label">Open</property>
|
||||||
|
<property name="valign">center</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkToggleButton" id="record_button">
|
<object class="GtkToggleButton" id="record_button">
|
||||||
<property name="halign">3</property>
|
<property name="halign">3</property>
|
||||||
|
<property name="valign">center</property>
|
||||||
<signal name="toggled" handler="on_record_button_toggled"/>
|
<signal name="toggled" handler="on_record_button_toggled"/>
|
||||||
<style>
|
<style>
|
||||||
<class name="text-button"/>
|
<class name="text-button"/>
|
||||||
@@ -2267,16 +2271,19 @@ microphone-sensitivity-medium-symbolic</property>
|
|||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkBox">
|
||||||
<property name="spacing">6</property>
|
<property name="spacing">6</property>
|
||||||
|
<property name="valign">center</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkImage">
|
<object class="GtkImage">
|
||||||
<property name="valign">4</property>
|
<property name="valign">4</property>
|
||||||
<property name="icon-name">media-record-symbolic</property>
|
<property name="icon-name">media-record-symbolic</property>
|
||||||
|
<property name="valign">center</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel">
|
<object class="GtkLabel">
|
||||||
<property name="valign">4</property>
|
<property name="valign">4</property>
|
||||||
<property name="label">Record</property>
|
<property name="label">Record</property>
|
||||||
|
<property name="valign">center</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
@@ -2285,6 +2292,7 @@ microphone-sensitivity-medium-symbolic</property>
|
|||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkBox">
|
||||||
|
<property name="valign">center</property>
|
||||||
<style>
|
<style>
|
||||||
<class name="linked"/>
|
<class name="linked"/>
|
||||||
</style>
|
</style>
|
||||||
@@ -2292,12 +2300,14 @@ microphone-sensitivity-medium-symbolic</property>
|
|||||||
<object class="GtkToggleButton" id="grid_button">
|
<object class="GtkToggleButton" id="grid_button">
|
||||||
<property name="active">1</property>
|
<property name="active">1</property>
|
||||||
<property name="icon-name">view-grid-symbolic</property>
|
<property name="icon-name">view-grid-symbolic</property>
|
||||||
|
<property name="valign">center</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkToggleButton" id="list_button">
|
<object class="GtkToggleButton" id="list_button">
|
||||||
<property name="group">grid_button</property>
|
<property name="group">grid_button</property>
|
||||||
<property name="icon-name">view-list-symbolic</property>
|
<property name="icon-name">view-list-symbolic</property>
|
||||||
|
<property name="valign">center</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
@@ -2305,6 +2315,7 @@ microphone-sensitivity-medium-symbolic</property>
|
|||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="circular_button">
|
<object class="GtkButton" id="circular_button">
|
||||||
<property name="icon-name">emblem-system-symbolic</property>
|
<property name="icon-name">emblem-system-symbolic</property>
|
||||||
|
<property name="valign">center</property>
|
||||||
<style>
|
<style>
|
||||||
<class name="circular"/>
|
<class name="circular"/>
|
||||||
</style>
|
</style>
|
||||||
@@ -2313,12 +2324,15 @@ microphone-sensitivity-medium-symbolic</property>
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLockButton" id="lockbutton"/>
|
<object class="GtkLockButton" id="lockbutton">
|
||||||
|
<property name="valign">center</property>
|
||||||
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkMenuButton">
|
<object class="GtkMenuButton">
|
||||||
<property name="icon-name">view-more-symbolic</property>
|
<property name="icon-name">view-more-symbolic</property>
|
||||||
<property name="menu-model">new_style_menu_model</property>
|
<property name="menu-model">new_style_menu_model</property>
|
||||||
|
<property name="valign">center</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
|||||||
@@ -220,6 +220,6 @@ clipboard.cut, clipboard.copy, clipboard.paste
|
|||||||
selection.delete, selection.select-all
|
selection.delete, selection.select-all
|
||||||
: Selection operations on entries, text view and labels
|
: 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
|
: 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).
|
||||||
|
|||||||
@@ -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-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: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_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: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: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) | |
|
| 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
|
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
|
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
|
“keyboard navigation”).
|
||||||
to the next location, and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move it back to the previous
|
GTK reserves the <kbd>Tab</kbd> key to move the focus to the next location,
|
||||||
one. In addition many containers allow “directional navigation” with
|
and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move it back to the previous one.
|
||||||
the arrow keys.
|
In addition many containers allow “directional navigation” with the arrow keys.
|
||||||
|
|
||||||
Many widgets can be “activated” to trigger and action. E.g., you can
|
Many widgets can be “activated” to trigger and action.
|
||||||
activate a button or switch by clicking on them, but you can also
|
E.g., you can activate a button or switch by clicking on them,
|
||||||
activate them with the keyboard, by using the <kbd>Enter</kbd> or <kbd>␣</kbd> keys.
|
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
|
Apart from keyboard navigation, activation and directly typing into
|
||||||
entries or text views, GTK widgets can use key events for activating
|
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
|
- Accelerators are any other shortcuts that can be activated regardless
|
||||||
of where the focus is, and typically trigger global actions, such as
|
of where the focus is, and typically trigger global actions, such as
|
||||||
Ctrl-Q to quit an application.
|
<kbd>Ctrl</kbd>+<kbd>Q</kbd> to quit an application.
|
||||||
- Mnemonics are usually triggered using Alt as a modifier for a letter.
|
- 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,
|
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
|
and are indicated by underlining the letter in the label. As a special
|
||||||
case, inside menus (i.e. inside `GtkPopoverMenu`), mnemonics can be
|
case, inside menus (i.e. inside `GtkPopoverMenu`), mnemonics can be
|
||||||
triggered without the modifier.
|
triggered without the modifier.
|
||||||
- Key bindings are specific to individual widgets, such as Ctrl-C or
|
- Key bindings are specific to individual widgets,
|
||||||
Ctrl-V in an entry copy to or paste from the clipboard. They are only
|
such as <kbd>Ctrl</kbd>+<kbd>C</kbd> or <kbd>Ctrl</kbd>+<kbd>V</kbd>
|
||||||
triggered when the widget has focus.
|
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
|
GTK handles accelerators and mnemonics in a global scope, during the
|
||||||
capture phase, and key bindings locally, during the target phase.
|
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
|
the others. They also are mutually exclusive, within a widget
|
||||||
where may be only one gesture group claiming a given sequence.
|
where may be only one gesture group claiming a given sequence.
|
||||||
If another gesture group claims later that same sequence, the
|
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.
|
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].
|
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
|
traditional treeview. Individual cells can be selectable and editable. Use
|
||||||
the `.data-table` style class.
|
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
|
## Comparison to GtkTreeView
|
||||||
|
|
||||||
Developers familiar with `GtkTreeView` may wonder how this way of doing lists
|
Developers familiar with `GtkTreeView` may wonder how this way of doing lists
|
||||||
|
|||||||
+2
-2
@@ -57,7 +57,7 @@ window_paste (GSimpleAction *action,
|
|||||||
{
|
{
|
||||||
GtkWindow *window = GTK_WINDOW (user_data);
|
GtkWindow *window = GTK_WINDOW (user_data);
|
||||||
GtkTextView *text = g_object_get_data ((GObject*)window, "plugman-text");
|
GtkTextView *text = g_object_get_data ((GObject*)window, "plugman-text");
|
||||||
|
|
||||||
gtk_text_buffer_paste_clipboard (gtk_text_view_get_buffer (text),
|
gtk_text_buffer_paste_clipboard (gtk_text_view_get_buffer (text),
|
||||||
gtk_widget_get_clipboard (GTK_WIDGET (text)),
|
gtk_widget_get_clipboard (GTK_WIDGET (text)),
|
||||||
NULL,
|
NULL,
|
||||||
@@ -221,7 +221,7 @@ plugin_action (GAction *action,
|
|||||||
g_message ("Color: %s", g_action_get_name (action));
|
g_message ("Color: %s", g_action_get_name (action));
|
||||||
|
|
||||||
css_provider = gtk_css_provider_new ();
|
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_context_add_provider_for_display (gdk_display_get_default (),
|
||||||
GTK_STYLE_PROVIDER (css_provider),
|
GTK_STYLE_PROVIDER (css_provider),
|
||||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
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
|
* Returns: (nullable) (transfer full): A newly-created pixbuf with a
|
||||||
* reference count of 1
|
* reference count of 1
|
||||||
|
*
|
||||||
|
* Deprecated: 4.12: Use [class@Gdk.Texture] and subclasses instead
|
||||||
|
* cairo surfaces and pixbufs
|
||||||
*/
|
*/
|
||||||
GdkPixbuf *
|
GdkPixbuf *
|
||||||
gdk_pixbuf_get_from_surface (cairo_surface_t *surface,
|
gdk_pixbuf_get_from_surface (cairo_surface_t *surface,
|
||||||
@@ -234,6 +237,9 @@ pixbuf_texture_unref_cb (guchar *pixels,
|
|||||||
* to draw it on screen.
|
* to draw it on screen.
|
||||||
*
|
*
|
||||||
* Returns: (transfer full) (nullable): a new `GdkPixbuf`
|
* Returns: (transfer full) (nullable): a new `GdkPixbuf`
|
||||||
|
*
|
||||||
|
* Deprecated: 4.12: Use [class@Gdk.Texture] and subclasses instead
|
||||||
|
* cairo surfaces and pixbufs
|
||||||
*/
|
*/
|
||||||
GdkPixbuf *
|
GdkPixbuf *
|
||||||
gdk_pixbuf_get_from_texture (GdkTexture *texture)
|
gdk_pixbuf_get_from_texture (GdkTexture *texture)
|
||||||
@@ -33,13 +33,13 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_DEPRECATED_IN_4_12
|
||||||
GdkPixbuf *gdk_pixbuf_get_from_surface (cairo_surface_t *surface,
|
GdkPixbuf *gdk_pixbuf_get_from_surface (cairo_surface_t *surface,
|
||||||
int src_x,
|
int src_x,
|
||||||
int src_y,
|
int src_y,
|
||||||
int width,
|
int width,
|
||||||
int height);
|
int height);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_DEPRECATED_IN_4_12
|
||||||
GdkPixbuf *gdk_pixbuf_get_from_texture (GdkTexture *texture);
|
GdkPixbuf *gdk_pixbuf_get_from_texture (GdkTexture *texture);
|
||||||
|
|
||||||
G_END_DECLS
|
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/gdkmonitor.h>
|
||||||
#include <gdk/gdkpaintable.h>
|
#include <gdk/gdkpaintable.h>
|
||||||
#include <gdk/gdkpango.h>
|
#include <gdk/gdkpango.h>
|
||||||
#include <gdk/gdkpixbuf.h>
|
#include <gdk/deprecated/gdkpixbuf.h>
|
||||||
#include <gdk/gdkpopup.h>
|
#include <gdk/gdkpopup.h>
|
||||||
#include <gdk/gdkpopuplayout.h>
|
#include <gdk/gdkpopuplayout.h>
|
||||||
#include <gdk/gdkrectangle.h>
|
#include <gdk/gdkrectangle.h>
|
||||||
|
|||||||
+3
-38
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "gdkcairoprivate.h"
|
#include "gdkcairo.h"
|
||||||
|
|
||||||
#include "gdkrgba.h"
|
#include "gdkrgba.h"
|
||||||
#include "gdktexture.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,
|
gdk_cairo_surface_paint_pixbuf (cairo_surface_t *surface,
|
||||||
const GdkPixbuf *pixbuf)
|
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
|
* Returns: %TRUE if the extents fit in a `GdkRectangle`, %FALSE if not
|
||||||
*/
|
*/
|
||||||
gboolean
|
static gboolean
|
||||||
_gdk_cairo_surface_extents (cairo_surface_t *surface,
|
_gdk_cairo_surface_extents (cairo_surface_t *surface,
|
||||||
GdkRectangle *extents)
|
GdkRectangle *extents)
|
||||||
{
|
{
|
||||||
@@ -303,38 +303,3 @@ gdk_cairo_region_create_from_surface (cairo_surface_t *surface)
|
|||||||
|
|
||||||
return region;
|
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
|
#endif
|
||||||
|
|
||||||
#include <gdk/gdktypes.h>
|
#include <gdk/gdktypes.h>
|
||||||
#include <gdk/gdkpixbuf.h>
|
#include <gdk/deprecated/gdkpixbuf.h>
|
||||||
#include <pango/pangocairo.h>
|
#include <pango/pangocairo.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
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 "gdkcontentserializer.h"
|
||||||
|
|
||||||
#include "gdkcontentformats.h"
|
#include "gdkcontentformats.h"
|
||||||
#include "gdkpixbuf.h"
|
#include "deprecated/gdkpixbuf.h"
|
||||||
#include "filetransferportalprivate.h"
|
#include "filetransferportalprivate.h"
|
||||||
#include "gdktextureprivate.h"
|
#include "gdktextureprivate.h"
|
||||||
#include "gdkrgba.h"
|
#include "gdkrgba.h"
|
||||||
@@ -642,7 +642,9 @@ pixbuf_serializer (GdkContentSerializer *serializer)
|
|||||||
else if (G_VALUE_HOLDS (value, GDK_TYPE_TEXTURE))
|
else if (G_VALUE_HOLDS (value, GDK_TYPE_TEXTURE))
|
||||||
{
|
{
|
||||||
GdkTexture *texture = g_value_get_object (value);
|
GdkTexture *texture = g_value_get_object (value);
|
||||||
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||||
pixbuf = gdk_pixbuf_get_from_texture (texture);
|
pixbuf = gdk_pixbuf_get_from_texture (texture);
|
||||||
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -371,6 +371,12 @@ gdk_draw_context_begin_frame_full (GdkDrawContext *context,
|
|||||||
priv->surface->paint_context = g_object_ref (context);
|
priv->surface->paint_context = g_object_ref (context);
|
||||||
|
|
||||||
GDK_DRAW_CONTEXT_GET_CLASS (context)->begin_frame (context, prefers_high_depth, priv->frame_region);
|
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
|
#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,
|
eglQuerySurface (gdk_display_get_egl_display (display), egl_surface,
|
||||||
EGL_BUFFER_AGE_EXT, &buffer_age);
|
EGL_BUFFER_AGE_EXT, &buffer_age);
|
||||||
|
|
||||||
switch (buffer_age)
|
if (buffer_age > 0 && buffer_age <= GDK_GL_MAX_TRACKED_BUFFERS)
|
||||||
{
|
{
|
||||||
case 1:
|
cairo_region_t *damage = cairo_region_create ();
|
||||||
return cairo_region_create ();
|
int i;
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
for (i = 0; i < buffer_age - 1; i++)
|
||||||
if (context->old_updated_area[0])
|
{
|
||||||
return cairo_region_copy (context->old_updated_area[0]);
|
if (context->old_updated_area[i] == NULL)
|
||||||
break;
|
{
|
||||||
|
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:
|
return damage;
|
||||||
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:
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -597,6 +594,7 @@ gdk_gl_context_real_begin_frame (GdkDrawContext *draw_context,
|
|||||||
cairo_region_t *damage;
|
cairo_region_t *damage;
|
||||||
double scale;
|
double scale;
|
||||||
int ww, wh;
|
int ww, wh;
|
||||||
|
int i;
|
||||||
|
|
||||||
surface = gdk_draw_context_get_surface (draw_context);
|
surface = gdk_draw_context_get_surface (draw_context);
|
||||||
scale = gdk_gl_context_get_scale (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);
|
damage = GDK_GL_CONTEXT_GET_CLASS (context)->get_damage (context);
|
||||||
|
|
||||||
if (context->old_updated_area[1])
|
g_clear_pointer (&context->old_updated_area[GDK_GL_MAX_TRACKED_BUFFERS - 1], cairo_region_destroy);
|
||||||
cairo_region_destroy (context->old_updated_area[1]);
|
for (i = GDK_GL_MAX_TRACKED_BUFFERS - 1; i > 0; i--)
|
||||||
context->old_updated_area[1] = context->old_updated_area[0];
|
{
|
||||||
|
context->old_updated_area[i] = context->old_updated_area[i - 1];
|
||||||
|
}
|
||||||
context->old_updated_area[0] = cairo_region_copy (region);
|
context->old_updated_area[0] = cairo_region_copy (region);
|
||||||
|
|
||||||
cairo_region_union (region, damage);
|
cairo_region_union (region, damage);
|
||||||
|
|||||||
@@ -34,6 +34,11 @@ typedef enum {
|
|||||||
GDK_GL_CGL
|
GDK_GL_CGL
|
||||||
} GdkGLBackend;
|
} 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_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_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))
|
#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;
|
GdkDrawContext parent_instance;
|
||||||
|
|
||||||
/* We store the old drawn areas to support buffer-age optimizations */
|
/* 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
|
struct _GdkGLContextClass
|
||||||
|
|||||||
+9
-1
@@ -171,13 +171,21 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
|
|||||||
Download *download = download_;
|
Download *download = download_;
|
||||||
GLenum gl_internal_format, gl_format, gl_type;
|
GLenum gl_internal_format, gl_format, gl_type;
|
||||||
int major, minor;
|
int major, minor;
|
||||||
|
unsigned int internal_texture_format, dummy;
|
||||||
|
|
||||||
expected_stride = texture->width * gdk_memory_format_bytes_per_pixel (download->format);
|
expected_stride = texture->width * gdk_memory_format_bytes_per_pixel (download->format);
|
||||||
gdk_gl_context_get_version (context, &major, &minor);
|
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 &&
|
if (download->stride == expected_stride &&
|
||||||
!gdk_gl_context_get_use_es (context) &&
|
!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,
|
glGetTexImage (GL_TEXTURE_2D,
|
||||||
0,
|
0,
|
||||||
|
|||||||
@@ -600,6 +600,11 @@ gdk_memory_convert (guchar *dest_data,
|
|||||||
for (y = 0; y < height; y++)
|
for (y = 0; y < height; y++)
|
||||||
{
|
{
|
||||||
src_desc->to_float (tmp, src_data, width);
|
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)
|
if (src_desc->alpha == GDK_MEMORY_ALPHA_PREMULTIPLIED && dest_desc->alpha == GDK_MEMORY_ALPHA_STRAIGHT)
|
||||||
unpremultiply (tmp, width);
|
unpremultiply (tmp, width);
|
||||||
else if (src_desc->alpha == GDK_MEMORY_ALPHA_STRAIGHT && dest_desc->alpha != GDK_MEMORY_ALPHA_STRAIGHT)
|
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:
|
* 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”,
|
* - A hexadecimal value in the form “\#rgb”, “\#rrggbb”,
|
||||||
* “\#rrrgggbbb” or ”\#rrrrggggbbbb”
|
* “\#rrrgggbbb” or ”\#rrrrggggbbbb”
|
||||||
* - A hexadecimal value in the form “\#rgba”, “\#rrggbbaa”,
|
* - 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
|
* - A RGB color in the form “rgb(r,g,b)” (In this case the color
|
||||||
* will have full opacity)
|
* will have full opacity)
|
||||||
* - A RGBA color in the form “rgba(r,g,b,a)”
|
* - 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,
|
* Where “r”, “g”, “b” and “a” are respectively the red, green,
|
||||||
* blue and alpha color values. In the last two cases, “r”, “g”,
|
* blue and alpha color values. In the last two cases, “r”, “g”,
|
||||||
|
|||||||
@@ -225,17 +225,17 @@ gdk_texture_downloader_download_into (const GdkTextureDownloader *self,
|
|||||||
/**
|
/**
|
||||||
* gdk_texture_downloader_download_bytes:
|
* gdk_texture_downloader_download_bytes:
|
||||||
* @self: the downloader
|
* @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
|
* Downloads the given texture pixels into a `GBytes`. The rowstride will
|
||||||
* be stored in the stride value.
|
* be stored in the stride value.
|
||||||
*
|
*
|
||||||
* This function will abort if it tries to download a large texture and
|
* 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
|
* fails to allocate memory. If you think that may happen, you should handle
|
||||||
* handle memory allocation yourself and use
|
* memory allocation yourself and use [method@Gdk.TextureDownloader.download_into]
|
||||||
* gdk_texture_downloader_download_into() once allocation succeeded.
|
* once allocation succeeded.
|
||||||
*
|
*
|
||||||
* Returns: The downloaded pixels.
|
* Returns: The downloaded pixels
|
||||||
*
|
*
|
||||||
* Since: 4.10
|
* Since: 4.10
|
||||||
**/
|
**/
|
||||||
|
|||||||
+7
-4
@@ -135,7 +135,8 @@ gdk_toplevel_default_export_handle_finish (GdkToplevel *toplevel,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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`
|
* @result: the `GAsyncResult`
|
||||||
* @error: return location for an error
|
* @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 the resulting handle.
|
||||||
*
|
*
|
||||||
* Returns: (nullable) (transfer full): the exported handle,
|
* Returns: (nullable) (transfer full): the exported handle,
|
||||||
@@ -810,6 +811,7 @@ gdk_toplevel_export_handle_finish (GdkToplevel *toplevel,
|
|||||||
/*< private >
|
/*< private >
|
||||||
* gdk_toplevel_unexport_handle:
|
* gdk_toplevel_unexport_handle:
|
||||||
* @toplevel: a `GdkToplevel`
|
* @toplevel: a `GdkToplevel`
|
||||||
|
* @handle: the handle to unexport
|
||||||
*
|
*
|
||||||
* Destroys the handle that was obtained with [method@Gdk.Toplevel.export_handle].
|
* 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
|
* Since: 4.10
|
||||||
*/
|
*/
|
||||||
void
|
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,
|
GAsyncResult *result,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
void (* unexport_handle) (GdkToplevel *toplevel);
|
void (* unexport_handle) (GdkToplevel *toplevel,
|
||||||
|
const char *handle);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
@@ -82,7 +83,8 @@ char *gdk_toplevel_export_handle_finish (GdkToplevel *toplevel,
|
|||||||
GAsyncResult *result,
|
GAsyncResult *result,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
void gdk_toplevel_unexport_handle (GdkToplevel *toplevel);
|
void gdk_toplevel_unexport_handle (GdkToplevel *toplevel,
|
||||||
|
const char *handle);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|||||||
+4
-3
@@ -1,3 +1,5 @@
|
|||||||
|
subdir('deprecated')
|
||||||
|
|
||||||
gdk_public_sources = files([
|
gdk_public_sources = files([
|
||||||
'gdk.c',
|
'gdk.c',
|
||||||
'gdkapplaunchcontext.c',
|
'gdkapplaunchcontext.c',
|
||||||
@@ -38,7 +40,6 @@ gdk_public_sources = files([
|
|||||||
'gdkmonitor.c',
|
'gdkmonitor.c',
|
||||||
'gdkpaintable.c',
|
'gdkpaintable.c',
|
||||||
'gdkpango.c',
|
'gdkpango.c',
|
||||||
'gdkpixbuf.c',
|
|
||||||
'gdkpipeiostream.c',
|
'gdkpipeiostream.c',
|
||||||
'gdkrectangle.c',
|
'gdkrectangle.c',
|
||||||
'gdkrgba.c',
|
'gdkrgba.c',
|
||||||
@@ -94,7 +95,6 @@ gdk_public_headers = files([
|
|||||||
'gdkmonitor.h',
|
'gdkmonitor.h',
|
||||||
'gdkpaintable.h',
|
'gdkpaintable.h',
|
||||||
'gdkpango.h',
|
'gdkpango.h',
|
||||||
'gdkpixbuf.h',
|
|
||||||
'gdkrectangle.h',
|
'gdkrectangle.h',
|
||||||
'gdkrgba.h',
|
'gdkrgba.h',
|
||||||
'gdkseat.h',
|
'gdkseat.h',
|
||||||
@@ -112,8 +112,9 @@ gdk_public_headers = files([
|
|||||||
'gdkdragsurface.h',
|
'gdkdragsurface.h',
|
||||||
])
|
])
|
||||||
install_headers(gdk_public_headers, subdir: 'gtk-4.0/gdk/')
|
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([
|
gdk_private_h_sources = files([
|
||||||
'gdkeventsprivate.h',
|
'gdkeventsprivate.h',
|
||||||
|
|||||||
@@ -1148,7 +1148,10 @@ gdk_wayland_surface_destroy (GdkSurface *surface,
|
|||||||
|
|
||||||
gdk_wayland_surface_hide_surface (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);
|
frame_clock = gdk_surface_get_frame_clock (surface);
|
||||||
g_signal_handlers_disconnect_by_func (frame_clock, on_frame_clock_before_paint, 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);
|
gboolean gdk_wayland_toplevel_inhibit_idle (GdkToplevel *toplevel);
|
||||||
void gdk_wayland_toplevel_uninhibit_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_toplevel_sync_parent_of_imported (GdkWaylandToplevel *toplevel);
|
||||||
static void gdk_wayland_surface_create_xdg_toplevel (GdkWaylandToplevel *toplevel);
|
static void gdk_wayland_surface_create_xdg_toplevel (GdkWaylandToplevel *toplevel);
|
||||||
static void gdk_wayland_toplevel_sync_title (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);
|
static void unset_transient_for_exported (GdkWaylandToplevel *toplevel);
|
||||||
|
|
||||||
/* {{{ GdkWaylandToplevel definition */
|
/* {{{ GdkWaylandToplevel definition */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
struct zxdg_exported_v1 *xdg_exported;
|
||||||
|
struct zxdg_exported_v2 *xdg_exported_v2;
|
||||||
|
char *handle;
|
||||||
|
} GdkWaylandExported;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GdkWaylandToplevel:
|
* GdkWaylandToplevel:
|
||||||
*
|
*
|
||||||
@@ -83,8 +88,7 @@ struct _GdkWaylandToplevel
|
|||||||
GdkWaylandToplevel *transient_for;
|
GdkWaylandToplevel *transient_for;
|
||||||
|
|
||||||
struct org_kde_kwin_server_decoration *server_decoration;
|
struct org_kde_kwin_server_decoration *server_decoration;
|
||||||
struct zxdg_exported_v1 *xdg_exported;
|
GList *exported;
|
||||||
struct zxdg_exported_v2 *xdg_exported_v2;
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
int width;
|
int width;
|
||||||
@@ -102,12 +106,6 @@ struct _GdkWaylandToplevel
|
|||||||
gboolean size_is_fixed;
|
gboolean size_is_fixed;
|
||||||
} next_layout;
|
} next_layout;
|
||||||
|
|
||||||
struct {
|
|
||||||
GdkWaylandToplevelExported callback;
|
|
||||||
gpointer user_data;
|
|
||||||
GDestroyNotify destroy_func;
|
|
||||||
} exported;
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
gboolean was_set;
|
gboolean was_set;
|
||||||
|
|
||||||
@@ -1280,9 +1278,6 @@ gdk_wayland_toplevel_finalize (GObject *object)
|
|||||||
|
|
||||||
display_wayland->toplevels = g_list_remove (display_wayland->toplevels, self);
|
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.application_id);
|
||||||
g_free (self->application.app_menu_path);
|
g_free (self->application.app_menu_path);
|
||||||
g_free (self->application.menubar_path);
|
g_free (self->application.menubar_path);
|
||||||
@@ -1747,8 +1742,12 @@ xdg_exported_handle_v1 (void *data,
|
|||||||
struct zxdg_exported_v1 *zxdg_exported_v1,
|
struct zxdg_exported_v1 *zxdg_exported_v1,
|
||||||
const char *handle)
|
const char *handle)
|
||||||
{
|
{
|
||||||
g_task_return_pointer (G_TASK (data), g_strdup (handle), g_free);
|
GTask *task = G_TASK (data);
|
||||||
g_object_unref (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 = {
|
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,
|
struct zxdg_exported_v2 *zxdg_exported_v2,
|
||||||
const char *handle)
|
const char *handle)
|
||||||
{
|
{
|
||||||
g_task_return_pointer (G_TASK (data), g_strdup (handle), g_free);
|
GTask *task = G_TASK (data);
|
||||||
g_object_unref (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 = {
|
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)
|
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,
|
zxdg_exporter_v2_export_toplevel (display_wayland->xdg_exporter_v2,
|
||||||
gdk_wayland_surface_get_wl_surface (surface));
|
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);
|
&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)
|
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,
|
zxdg_exporter_v1_export (display_wayland->xdg_exporter,
|
||||||
gdk_wayland_surface_get_wl_surface (surface));
|
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);
|
&xdg_exported_listener_v1, task);
|
||||||
|
|
||||||
|
wayland_toplevel->exported = g_list_prepend (wayland_toplevel->exported, exported);
|
||||||
|
g_task_set_task_data (task, exported, NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1815,15 +1826,36 @@ gdk_wayland_toplevel_real_export_handle_finish (GdkToplevel *toplevel,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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);
|
GdkWaylandToplevel *wayland_toplevel = GDK_WAYLAND_TOPLEVEL (toplevel);
|
||||||
|
|
||||||
g_return_if_fail (GDK_IS_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);
|
for (GList *l = wayland_toplevel->exported; l; l = l->next)
|
||||||
g_clear_pointer (&wayland_toplevel->xdg_exported, zxdg_exported_v1_destroy);
|
{
|
||||||
|
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
|
static gboolean
|
||||||
@@ -2255,6 +2287,32 @@ gdk_wayland_toplevel_set_dbus_properties (GdkToplevel *toplevel,
|
|||||||
maybe_set_gtk_surface_dbus_properties (wayland_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 */
|
/* {{{ Toplevel API */
|
||||||
|
|
||||||
@@ -2397,12 +2455,6 @@ gdk_wayland_toplevel_uninhibit_idle (GdkToplevel *toplevel)
|
|||||||
* marking surfaces as transient for out-of-process surfaces.
|
* 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 {
|
typedef struct {
|
||||||
GdkWaylandToplevelExported callback;
|
GdkWaylandToplevelExported callback;
|
||||||
gpointer user_data;
|
gpointer user_data;
|
||||||
@@ -2450,6 +2502,12 @@ export_handle_done (GObject *source,
|
|||||||
* from another surface as transient for this one, see
|
* from another surface as transient for this one, see
|
||||||
* [method@GdkWayland.WaylandToplevel.set_transient_for_exported].
|
* [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,
|
* Note that this API depends on an unstable Wayland protocol,
|
||||||
* and thus may require changes in the future.
|
* 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
|
* It is an error to call this function on a surface that
|
||||||
* does not have a handle.
|
* 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,
|
* Note that this API depends on an unstable Wayland protocol,
|
||||||
* and thus may require changes in the future.
|
* and thus may require changes in the future.
|
||||||
|
*
|
||||||
|
* Deprecated: 4.12: Use [method@GdkWayland.WaylandToplevel.drop_exported_handle]
|
||||||
|
* instead, this function does nothing
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gdk_wayland_toplevel_unexport_handle (GdkToplevel *toplevel)
|
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
|
static void
|
||||||
|
|||||||
@@ -52,9 +52,13 @@ gboolean gdk_wayland_toplevel_export_handle (GdkToplevel
|
|||||||
gpointer user_data,
|
gpointer user_data,
|
||||||
GDestroyNotify destroy_func);
|
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);
|
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
|
GDK_AVAILABLE_IN_ALL
|
||||||
gboolean gdk_wayland_toplevel_set_transient_for_exported (GdkToplevel *toplevel,
|
gboolean gdk_wayland_toplevel_set_transient_for_exported (GdkToplevel *toplevel,
|
||||||
const char *parent_handle_str);
|
const char *parent_handle_str);
|
||||||
|
|||||||
@@ -292,6 +292,7 @@ _gdk_win32_display_init_monitors (GdkWin32Display *win32_display)
|
|||||||
if (!w32_ex_monitor->remove)
|
if (!w32_ex_monitor->remove)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
w32_ex_monitor->hmonitor = NULL;
|
||||||
g_list_store_remove (G_LIST_STORE (win32_display->monitors), i);
|
g_list_store_remove (G_LIST_STORE (win32_display->monitors), i);
|
||||||
gdk_monitor_invalidate (ex_monitor);
|
gdk_monitor_invalidate (ex_monitor);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -443,9 +443,6 @@ populate_monitor_devices_from_display_config (GPtrArray *monitors)
|
|||||||
char *path, *path_lower;
|
char *path, *path_lower;
|
||||||
DISPLAYCONFIG_RATIONAL *refresh;
|
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.type = DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME;
|
||||||
tdn.header.size = sizeof (tdn);
|
tdn.header.size = sizeof (tdn);
|
||||||
tdn.header.adapterId = dispconf_paths[path_index].targetInfo.adapterId;
|
tdn.header.adapterId = dispconf_paths[path_index].targetInfo.adapterId;
|
||||||
@@ -481,6 +478,12 @@ populate_monitor_devices_from_display_config (GPtrArray *monitors)
|
|||||||
if (w32mon == NULL)
|
if (w32mon == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if ((dispconf_paths[path_index].flags & DISPLAYCONFIG_PATH_ACTIVE) == 0)
|
||||||
|
{
|
||||||
|
w32mon->remove = TRUE;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
mon = GDK_MONITOR (w32mon);
|
mon = GDK_MONITOR (w32mon);
|
||||||
|
|
||||||
if (!tdn.flags.friendlyNameForced)
|
if (!tdn.flags.friendlyNameForced)
|
||||||
@@ -598,6 +601,8 @@ enum_monitor (HMONITOR hmonitor,
|
|||||||
|
|
||||||
if (w32mon == NULL)
|
if (w32mon == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
w32mon->hmonitor = hmonitor;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ struct _GdkWin32Monitor
|
|||||||
/* Device instance path (used to match GdkWin32Monitor to monitor device) */
|
/* Device instance path (used to match GdkWin32Monitor to monitor device) */
|
||||||
char *instance_path;
|
char *instance_path;
|
||||||
|
|
||||||
|
/* MOnitor handle (used to fullscreen windows on monitors) */
|
||||||
|
HMONITOR hmonitor;
|
||||||
|
|
||||||
/* TRUE if monitor is made up by us
|
/* TRUE if monitor is made up by us
|
||||||
* (this happens when system has logical monitors, but no physical ones).
|
* (this happens when system has logical monitors, but no physical ones).
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -50,6 +50,7 @@
|
|||||||
#include "gdkdisplay-win32.h"
|
#include "gdkdisplay-win32.h"
|
||||||
#include "gdkdevice-win32.h"
|
#include "gdkdevice-win32.h"
|
||||||
#include "gdkcairocontext-win32.h"
|
#include "gdkcairocontext-win32.h"
|
||||||
|
#include "gdkmonitor-win32.h"
|
||||||
|
|
||||||
#include <cairo-win32.h>
|
#include <cairo-win32.h>
|
||||||
#include <dwmapi.h>
|
#include <dwmapi.h>
|
||||||
@@ -625,7 +626,8 @@ get_outer_rect (GdkSurface *window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_win32_surface_fullscreen (GdkSurface *window);
|
gdk_win32_surface_fullscreen (GdkSurface *window,
|
||||||
|
GdkMonitor *monitor);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
show_window_internal (GdkSurface *window,
|
show_window_internal (GdkSurface *window,
|
||||||
@@ -789,11 +791,7 @@ show_window_internal (GdkSurface *window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (window->state & GDK_TOPLEVEL_STATE_FULLSCREEN)
|
if (window->state & GDK_TOPLEVEL_STATE_MAXIMIZED)
|
||||||
{
|
|
||||||
gdk_win32_surface_fullscreen (window);
|
|
||||||
}
|
|
||||||
else if (window->state & GDK_TOPLEVEL_STATE_MAXIMIZED)
|
|
||||||
{
|
{
|
||||||
GtkShowWindow (window, SW_MAXIMIZE);
|
GtkShowWindow (window, SW_MAXIMIZE);
|
||||||
}
|
}
|
||||||
@@ -4008,11 +4006,12 @@ gdk_win32_surface_unmaximize (GdkSurface *surface)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_win32_surface_fullscreen (GdkSurface *window)
|
gdk_win32_surface_fullscreen (GdkSurface *window,
|
||||||
|
GdkMonitor *monitor)
|
||||||
{
|
{
|
||||||
int x, y, width, height;
|
int x, y, width, height;
|
||||||
FullscreenInfo *fi;
|
FullscreenInfo *fi;
|
||||||
HMONITOR monitor;
|
HMONITOR hmonitor = NULL;
|
||||||
MONITORINFO mi;
|
MONITORINFO mi;
|
||||||
|
|
||||||
g_return_if_fail (GDK_IS_SURFACE (window));
|
g_return_if_fail (GDK_IS_SURFACE (window));
|
||||||
@@ -4025,9 +4024,14 @@ gdk_win32_surface_fullscreen (GdkSurface *window)
|
|||||||
{
|
{
|
||||||
GdkWin32Surface *impl = GDK_WIN32_SURFACE (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);
|
mi.cbSize = sizeof (mi);
|
||||||
if (monitor && GetMonitorInfo (monitor, &mi))
|
if (hmonitor && GetMonitorInfo (hmonitor, &mi))
|
||||||
{
|
{
|
||||||
x = mi.rcMonitor.left;
|
x = mi.rcMonitor.left;
|
||||||
y = mi.rcMonitor.top;
|
y = mi.rcMonitor.top;
|
||||||
@@ -4869,9 +4873,16 @@ gdk_win32_toplevel_present (GdkToplevel *toplevel,
|
|||||||
if (gdk_toplevel_layout_get_fullscreen (layout, &fullscreen))
|
if (gdk_toplevel_layout_get_fullscreen (layout, &fullscreen))
|
||||||
{
|
{
|
||||||
if (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
|
else
|
||||||
gdk_win32_surface_unfullscreen (surface);
|
{
|
||||||
|
gdk_win32_surface_unfullscreen (surface);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gdk_win32_surface_show (surface, FALSE);
|
gdk_win32_surface_show (surface, FALSE);
|
||||||
|
|||||||
@@ -144,7 +144,8 @@ struct _GdkX11Display
|
|||||||
guint server_time_is_monotonic_time : 1;
|
guint server_time_is_monotonic_time : 1;
|
||||||
|
|
||||||
/* GLX extensions we check */
|
/* 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_create_context : 1;
|
||||||
guint has_glx_texture_from_pixmap : 1;
|
guint has_glx_texture_from_pixmap : 1;
|
||||||
guint has_glx_video_sync : 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)
|
if (display_x11->has_glx_video_sync)
|
||||||
glXGetVideoSyncSGI (&end_frame_counter);
|
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 ();
|
glFinish ();
|
||||||
|
|
||||||
@@ -249,7 +249,7 @@ gdk_x11_gl_context_glx_make_current (GdkGLContext *context,
|
|||||||
if (!glXMakeContextCurrent (dpy, drawable, drawable, self->glx_context))
|
if (!glXMakeContextCurrent (dpy, drawable, drawable, self->glx_context))
|
||||||
return FALSE;
|
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
|
/* If the WM is compositing there is no particular need to delay
|
||||||
* the swap when drawing on the offscreen, rendering to the screen
|
* 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. */
|
* to the vblank. */
|
||||||
do_frame_sync = ! gdk_display_is_composited (display);
|
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)
|
if (do_frame_sync)
|
||||||
glXSwapIntervalSGI (1);
|
glXSwapIntervalEXT (dpy, drawable, 1);
|
||||||
else
|
else
|
||||||
glXSwapIntervalSGI (0);
|
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),
|
glXQueryDrawable (dpy, gdk_x11_gl_context_glx_get_drawable (self),
|
||||||
GLX_BACK_BUFFER_AGE_EXT, &buffer_age);
|
GLX_BACK_BUFFER_AGE_EXT, &buffer_age);
|
||||||
|
|
||||||
switch (buffer_age)
|
if (buffer_age > 0 && buffer_age <= GDK_GL_MAX_TRACKED_BUFFERS)
|
||||||
{
|
{
|
||||||
case 1:
|
cairo_region_t *damage = cairo_region_create ();
|
||||||
return cairo_region_create ();
|
int i;
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
for (i = 0; i < buffer_age - 1; i++)
|
||||||
if (context->old_updated_area[0])
|
{
|
||||||
return cairo_region_copy (context->old_updated_area[0]);
|
if (context->old_updated_area[i] == NULL)
|
||||||
break;
|
return GDK_GL_CONTEXT_CLASS (gdk_x11_gl_context_glx_parent_class)->get_damage (context);
|
||||||
|
|
||||||
case 3:
|
cairo_region_union (damage, context->old_updated_area[i]);
|
||||||
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;
|
||||||
;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -945,8 +957,10 @@ gdk_x11_display_init_glx (GdkX11Display *display_x11,
|
|||||||
epoxy_has_glx_extension (dpy, screen_num, "GLX_ARB_create_context_profile");
|
epoxy_has_glx_extension (dpy, screen_num, "GLX_ARB_create_context_profile");
|
||||||
display_x11->has_glx_create_es2_context =
|
display_x11->has_glx_create_es2_context =
|
||||||
epoxy_has_glx_extension (dpy, screen_num, "GLX_EXT_create_context_es2_profile");
|
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");
|
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 =
|
display_x11->has_glx_texture_from_pixmap =
|
||||||
epoxy_has_glx_extension (dpy, screen_num, "GLX_EXT_texture_from_pixmap");
|
epoxy_has_glx_extension (dpy, screen_num, "GLX_EXT_texture_from_pixmap");
|
||||||
display_x11->has_glx_video_sync =
|
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_ARB_create_context_profile: %s\n"
|
||||||
"\t* GLX_EXT_create_context_es2_profile: %s\n"
|
"\t* GLX_EXT_create_context_es2_profile: %s\n"
|
||||||
"\t* GLX_SGI_swap_control: %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_EXT_texture_from_pixmap: %s\n"
|
||||||
"\t* GLX_SGI_video_sync: %s\n"
|
"\t* GLX_SGI_video_sync: %s\n"
|
||||||
"\t* GLX_EXT_buffer_age: %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),
|
glXGetClientString (dpy, GLX_VENDOR),
|
||||||
display_x11->has_glx_create_context ? "yes" : "no",
|
display_x11->has_glx_create_context ? "yes" : "no",
|
||||||
display_x11->has_glx_create_es2_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_texture_from_pixmap ? "yes" : "no",
|
||||||
display_x11->has_glx_video_sync ? "yes" : "no",
|
display_x11->has_glx_video_sync ? "yes" : "no",
|
||||||
display_x11->has_glx_buffer_age ? "yes" : "no",
|
display_x11->has_glx_buffer_age ? "yes" : "no",
|
||||||
|
|||||||
@@ -5318,7 +5318,8 @@ gdk_x11_toplevel_export_handle_finish (GdkToplevel *toplevel,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_x11_toplevel_unexport_handle (GdkToplevel *toplevel)
|
gdk_x11_toplevel_unexport_handle (GdkToplevel *toplevel,
|
||||||
|
const char *handle)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -579,7 +579,7 @@ discard_batch (GskGLCommandQueue *self)
|
|||||||
self->batches.len--;
|
self->batches.len--;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
gboolean
|
||||||
gsk_gl_command_queue_begin_draw (GskGLCommandQueue *self,
|
gsk_gl_command_queue_begin_draw (GskGLCommandQueue *self,
|
||||||
GskGLUniformProgram *program,
|
GskGLUniformProgram *program,
|
||||||
guint width,
|
guint width,
|
||||||
@@ -596,7 +596,7 @@ gsk_gl_command_queue_begin_draw (GskGLCommandQueue *self,
|
|||||||
* of batches we can have in one frame.
|
* of batches we can have in one frame.
|
||||||
*/
|
*/
|
||||||
if (will_ignore_batch (self))
|
if (will_ignore_batch (self))
|
||||||
return;
|
return FALSE;
|
||||||
|
|
||||||
self->program_info = program;
|
self->program_info = program;
|
||||||
|
|
||||||
@@ -617,6 +617,8 @@ gsk_gl_command_queue_begin_draw (GskGLCommandQueue *self,
|
|||||||
self->fbo_max = MAX (self->fbo_max, batch->draw.framebuffer);
|
self->fbo_max = MAX (self->fbo_max, batch->draw.framebuffer);
|
||||||
|
|
||||||
self->in_draw = TRUE;
|
self->in_draw = TRUE;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -721,6 +723,10 @@ gsk_gl_command_queue_split_draw (GskGLCommandQueue *self)
|
|||||||
|
|
||||||
g_assert (GSK_IS_GL_COMMAND_QUEUE (self));
|
g_assert (GSK_IS_GL_COMMAND_QUEUE (self));
|
||||||
g_assert (self->batches.len > 0);
|
g_assert (self->batches.len > 0);
|
||||||
|
|
||||||
|
if (will_ignore_batch (self))
|
||||||
|
return;
|
||||||
|
|
||||||
g_assert (self->in_draw == TRUE);
|
g_assert (self->in_draw == TRUE);
|
||||||
|
|
||||||
program = self->program_info;
|
program = self->program_info;
|
||||||
@@ -1441,6 +1447,7 @@ gsk_gl_command_queue_create_framebuffer (GskGLCommandQueue *self)
|
|||||||
return fbo_id;
|
return fbo_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static GdkMemoryFormat
|
static GdkMemoryFormat
|
||||||
memory_format_gl_format (GdkMemoryFormat data_format,
|
memory_format_gl_format (GdkMemoryFormat data_format,
|
||||||
gboolean use_es,
|
gboolean use_es,
|
||||||
@@ -1605,13 +1612,13 @@ gsk_gl_command_queue_upload_texture_chunks (GskGLCommandQueue *self,
|
|||||||
use_es = gdk_gl_context_get_use_es (self->context);
|
use_es = gdk_gl_context_get_use_es (self->context);
|
||||||
gdk_gl_context_get_version (self->context, &major, &minor);
|
gdk_gl_context_get_version (self->context, &major, &minor);
|
||||||
data_format = gdk_texture_get_format (chunks[0].texture);
|
data_format = gdk_texture_get_format (chunks[0].texture);
|
||||||
memory_format_gl_format (data_format,
|
data_format = memory_format_gl_format (data_format,
|
||||||
use_es,
|
use_es,
|
||||||
major,
|
major,
|
||||||
minor,
|
minor,
|
||||||
&gl_internalformat,
|
&gl_internalformat,
|
||||||
&gl_format,
|
&gl_format,
|
||||||
&gl_type);
|
&gl_type);
|
||||||
|
|
||||||
glTexImage2D (GL_TEXTURE_2D, 0, gl_internalformat, width, height, 0, gl_format, gl_type, NULL);
|
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,
|
void gsk_gl_command_queue_clear (GskGLCommandQueue *self,
|
||||||
guint clear_bits,
|
guint clear_bits,
|
||||||
const graphene_rect_t *viewport);
|
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,
|
GskGLUniformProgram *program_info,
|
||||||
guint width,
|
guint width,
|
||||||
guint height);
|
guint height);
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ gsk_gl_compiler_new (GskGLDriver *driver,
|
|||||||
self->driver = g_object_ref (driver);
|
self->driver = g_object_ref (driver);
|
||||||
self->debug_shaders = !!debug_shaders;
|
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))
|
if (gdk_gl_context_get_use_es (context))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1131,7 +1131,7 @@ gsk_gl_driver_lookup_shader (GskGLDriver *self,
|
|||||||
return program;
|
return program;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef G_ENABLE_DEBUG
|
#if 0
|
||||||
void
|
void
|
||||||
gsk_gl_driver_save_texture_to_png (GskGLDriver *driver,
|
gsk_gl_driver_save_texture_to_png (GskGLDriver *driver,
|
||||||
int texture_id,
|
int texture_id,
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ GskGLProgram * gsk_gl_driver_lookup_shader (GskGLDriver *s
|
|||||||
GskGLShader *shader,
|
GskGLShader *shader,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
#ifdef G_ENABLE_DEBUG
|
#if 0
|
||||||
void gsk_gl_driver_save_texture_to_png (GskGLDriver *self,
|
void gsk_gl_driver_save_texture_to_png (GskGLDriver *self,
|
||||||
int texture_id,
|
int texture_id,
|
||||||
int width,
|
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;
|
GskGLTextureAtlasEntry *entry;
|
||||||
GHashTableIter iter;
|
GHashTableIter iter;
|
||||||
guint dropped = 0;
|
guint dropped = 0;
|
||||||
guint atlased = 0;
|
G_GNUC_UNUSED guint atlased = 0;
|
||||||
|
|
||||||
g_hash_table_iter_init (&iter, self->hash_table);
|
g_hash_table_iter_init (&iter, self->hash_table);
|
||||||
while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&entry))
|
while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&entry))
|
||||||
|
|||||||
@@ -4413,6 +4413,11 @@ gsk_shadow_node_draw (GskRenderNode *node,
|
|||||||
pattern = cairo_pop_group (cr);
|
pattern = cairo_pop_group (cr);
|
||||||
cairo_restore (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++)
|
for (i = 0; i < self->n_shadows; i++)
|
||||||
{
|
{
|
||||||
GskShadow *shadow = &self->shadows[i];
|
GskShadow *shadow = &self->shadows[i];
|
||||||
@@ -4434,6 +4439,7 @@ gsk_shadow_node_draw (GskRenderNode *node,
|
|||||||
|
|
||||||
cairo_set_source (cr, pattern);
|
cairo_set_source (cr, pattern);
|
||||||
cairo_paint (cr);
|
cairo_paint (cr);
|
||||||
|
cairo_restore (cr);
|
||||||
|
|
||||||
cairo_pattern_destroy (pattern);
|
cairo_pattern_destroy (pattern);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1081,20 +1081,21 @@ parse_declarations (GtkCssParser *parser,
|
|||||||
{
|
{
|
||||||
if (gtk_css_parser_try_ident (parser, declarations[i].name))
|
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))
|
if (!gtk_css_parser_try_token (parser, GTK_CSS_TOKEN_COLON))
|
||||||
{
|
{
|
||||||
gtk_css_parser_error_syntax (parser, "Expected ':' after variable declaration");
|
gtk_css_parser_error_syntax (parser, "Expected ':' after variable declaration");
|
||||||
}
|
}
|
||||||
else
|
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))
|
if (!declarations[i].parse_func (parser, context, declarations[i].result))
|
||||||
{
|
{
|
||||||
/* nothing to do */
|
/* nothing to do */
|
||||||
|
|||||||
@@ -689,230 +689,6 @@ gsk_rounded_rect_intersect_with_rect (const GskRoundedRect *self,
|
|||||||
return GSK_INTERSECTION_NONEMPTY;
|
return GSK_INTERSECTION_NONEMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
|
||||||
rect_corner (const graphene_rect_t *r,
|
|
||||||
unsigned int i,
|
|
||||||
graphene_point_t *p)
|
|
||||||
{
|
|
||||||
switch (i)
|
|
||||||
{
|
|
||||||
case GSK_CORNER_TOP_LEFT:
|
|
||||||
graphene_rect_get_top_left (r, p);
|
|
||||||
break;
|
|
||||||
case GSK_CORNER_TOP_RIGHT:
|
|
||||||
graphene_rect_get_top_right (r, p);
|
|
||||||
break;
|
|
||||||
case GSK_CORNER_BOTTOM_RIGHT:
|
|
||||||
graphene_rect_get_bottom_right (r, p);
|
|
||||||
break;
|
|
||||||
case GSK_CORNER_BOTTOM_LEFT:
|
|
||||||
graphene_rect_get_bottom_left (r, p);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
g_assert_not_reached ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
corner_rect (const GskRoundedRect *s,
|
|
||||||
unsigned int i,
|
|
||||||
graphene_rect_t *r)
|
|
||||||
{
|
|
||||||
switch (i)
|
|
||||||
{
|
|
||||||
case GSK_CORNER_TOP_LEFT:
|
|
||||||
graphene_rect_init (r,
|
|
||||||
s->bounds.origin.x,
|
|
||||||
s->bounds.origin.y,
|
|
||||||
s->corner[i].width,
|
|
||||||
s->corner[i].height);
|
|
||||||
break;
|
|
||||||
case GSK_CORNER_TOP_RIGHT:
|
|
||||||
graphene_rect_init (r,
|
|
||||||
s->bounds.origin.x + s->bounds.size.width - s->corner[i].width,
|
|
||||||
s->bounds.origin.y,
|
|
||||||
s->corner[i].width,
|
|
||||||
s->corner[i].height);
|
|
||||||
break;
|
|
||||||
case GSK_CORNER_BOTTOM_RIGHT:
|
|
||||||
graphene_rect_init (r,
|
|
||||||
s->bounds.origin.x + s->bounds.size.width - s->corner[i].width,
|
|
||||||
s->bounds.origin.y + s->bounds.size.height - s->corner[i].height,
|
|
||||||
s->corner[i].width,
|
|
||||||
s->corner[i].height);
|
|
||||||
break;
|
|
||||||
case GSK_CORNER_BOTTOM_LEFT:
|
|
||||||
graphene_rect_init (r,
|
|
||||||
s->bounds.origin.x,
|
|
||||||
s->bounds.origin.y + s->bounds.size.height - s->corner[i].height,
|
|
||||||
s->corner[i].width,
|
|
||||||
s->corner[i].height);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
g_assert_not_reached ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline gboolean
|
|
||||||
point_in_interior (const graphene_point_t *p,
|
|
||||||
const graphene_rect_t *r)
|
|
||||||
{
|
|
||||||
if (graphene_rect_contains_point (r, p))
|
|
||||||
{
|
|
||||||
if (p->x > r->origin.x && p->x < r->origin.x + r->size.width)
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
if (p->y > r->origin.y && p->y < r->origin.y + r->size.height)
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
GskRoundedRectIntersection
|
|
||||||
gsk_rounded_rect_intersect (const GskRoundedRect *self,
|
|
||||||
const GskRoundedRect *other,
|
|
||||||
GskRoundedRect *result)
|
|
||||||
{
|
|
||||||
if (!graphene_rect_intersection (&self->bounds, &other->bounds, &result->bounds))
|
|
||||||
return GSK_INTERSECTION_EMPTY;
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < 4; i++)
|
|
||||||
{
|
|
||||||
graphene_point_t p, p1, p2;
|
|
||||||
|
|
||||||
rect_corner (&self->bounds, i, &p1);
|
|
||||||
rect_corner (&other->bounds, i, &p2);
|
|
||||||
rect_corner (&result->bounds, i, &p);
|
|
||||||
|
|
||||||
if (graphene_point_equal (&p, &p1))
|
|
||||||
{
|
|
||||||
if (graphene_point_equal (&p, &p2))
|
|
||||||
{
|
|
||||||
graphene_rect_t c;
|
|
||||||
graphene_rect_t d;
|
|
||||||
|
|
||||||
corner_rect (self, i, &c);
|
|
||||||
corner_rect (other, i, &d);
|
|
||||||
|
|
||||||
/* corners coincide */
|
|
||||||
if (graphene_rect_contains_rect (&c, &d))
|
|
||||||
{
|
|
||||||
graphene_point_t q1, q2;
|
|
||||||
|
|
||||||
rect_corner (&c, (i + 1) % 4, &q1);
|
|
||||||
rect_corner (&c, (i + 3) % 4, &q2);
|
|
||||||
|
|
||||||
if (gsk_rounded_rect_contains_point (other, &q1) &&
|
|
||||||
gsk_rounded_rect_contains_point (other, &q2))
|
|
||||||
result->corner[i] = self->corner[i];
|
|
||||||
else
|
|
||||||
return GSK_INTERSECTION_NOT_REPRESENTABLE;
|
|
||||||
}
|
|
||||||
else if (graphene_rect_contains_rect (&d, &c))
|
|
||||||
{
|
|
||||||
graphene_point_t q1, q2;
|
|
||||||
|
|
||||||
rect_corner (&d, (i + 1) % 4, &q1);
|
|
||||||
rect_corner (&d, (i + 3) % 4, &q2);
|
|
||||||
|
|
||||||
if (gsk_rounded_rect_contains_point (self, &q1) &&
|
|
||||||
gsk_rounded_rect_contains_point (self, &q2))
|
|
||||||
result->corner[i] = other->corner[i];
|
|
||||||
else
|
|
||||||
return GSK_INTERSECTION_NOT_REPRESENTABLE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return GSK_INTERSECTION_NOT_REPRESENTABLE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
graphene_rect_t c;
|
|
||||||
graphene_point_t q1, q2;
|
|
||||||
|
|
||||||
corner_rect (self, i, &c);
|
|
||||||
|
|
||||||
rect_corner (&c, (i + 1) % 4, &q1);
|
|
||||||
rect_corner (&c, (i + 3) % 4, &q2);
|
|
||||||
|
|
||||||
if (gsk_rounded_rect_contains_point (other, &q1) &&
|
|
||||||
gsk_rounded_rect_contains_point (other, &q2))
|
|
||||||
{
|
|
||||||
if (gsk_rounded_rect_contains_point (other, &p))
|
|
||||||
result->corner[i] = self->corner[i];
|
|
||||||
else
|
|
||||||
#if 1
|
|
||||||
return GSK_INTERSECTION_NEEDS_QUARTIC;
|
|
||||||
#else
|
|
||||||
if (/* no intersection for i */)
|
|
||||||
result->corner[i] = self->corner[i];
|
|
||||||
else
|
|
||||||
return GSK_INTERSECTION_NOT_REPRESENTABLE;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return GSK_INTERSECTION_NOT_REPRESENTABLE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (graphene_point_equal (&p, &p2))
|
|
||||||
{
|
|
||||||
graphene_rect_t d;
|
|
||||||
graphene_point_t q1, q2;
|
|
||||||
|
|
||||||
corner_rect (other, i, &d);
|
|
||||||
|
|
||||||
rect_corner (&d, (i + 1) % 4, &q1);
|
|
||||||
rect_corner (&d, (i + 3) % 4, &q2);
|
|
||||||
|
|
||||||
if (gsk_rounded_rect_contains_point (self, &q1) &&
|
|
||||||
gsk_rounded_rect_contains_point (self, &q2))
|
|
||||||
{
|
|
||||||
if (gsk_rounded_rect_contains_point (self, &p))
|
|
||||||
result->corner[i] = other->corner[i];
|
|
||||||
else
|
|
||||||
#if 1
|
|
||||||
return GSK_INTERSECTION_NEEDS_QUARTIC;
|
|
||||||
#else
|
|
||||||
if (/* no intersection for i */
|
|
||||||
result->corner[i] = other->corner[i];
|
|
||||||
else
|
|
||||||
return GSK_INTERSECTION_NOT_REPRESENTABLE;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return GSK_INTERSECTION_NOT_REPRESENTABLE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
graphene_rect_t c, d;
|
|
||||||
|
|
||||||
corner_rect (self, (i + 2) % 4, &c);
|
|
||||||
if (graphene_rect_contains_point (&c, &p) &&
|
|
||||||
!gsk_rounded_rect_contains_point (self, &p))
|
|
||||||
return GSK_INTERSECTION_EMPTY;
|
|
||||||
|
|
||||||
corner_rect (other, (i + 2) % 4, &d);
|
|
||||||
if (graphene_rect_contains_point (&d, &p) &&
|
|
||||||
!gsk_rounded_rect_contains_point (other, &p))
|
|
||||||
return GSK_INTERSECTION_EMPTY;
|
|
||||||
|
|
||||||
for (unsigned int j = 0; j < 4; j++)
|
|
||||||
{
|
|
||||||
corner_rect (self, j, &c);
|
|
||||||
corner_rect (other, j, &d);
|
|
||||||
|
|
||||||
if (point_in_interior (&p, &c) ||
|
|
||||||
point_in_interior (&p, &d))
|
|
||||||
return GSK_INTERSECTION_NOT_REPRESENTABLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
result->corner[i] = (graphene_size_t) { 0, 0 };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return GSK_INTERSECTION_NONEMPTY;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
append_arc (cairo_t *cr, double angle1, double angle2, gboolean negative)
|
append_arc (cairo_t *cr, double angle1, double angle2, gboolean negative)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,17 +37,13 @@ char * gsk_rounded_rect_to_string (const GskRounde
|
|||||||
typedef enum {
|
typedef enum {
|
||||||
GSK_INTERSECTION_EMPTY,
|
GSK_INTERSECTION_EMPTY,
|
||||||
GSK_INTERSECTION_NONEMPTY,
|
GSK_INTERSECTION_NONEMPTY,
|
||||||
GSK_INTERSECTION_NOT_REPRESENTABLE,
|
GSK_INTERSECTION_NOT_REPRESENTABLE
|
||||||
GSK_INTERSECTION_NEEDS_QUARTIC
|
|
||||||
} GskRoundedRectIntersection;
|
} GskRoundedRectIntersection;
|
||||||
|
|
||||||
GskRoundedRectIntersection gsk_rounded_rect_intersect_with_rect (const GskRoundedRect *self,
|
GskRoundedRectIntersection gsk_rounded_rect_intersect_with_rect (const GskRoundedRect *self,
|
||||||
const graphene_rect_t *rect,
|
const graphene_rect_t *rect,
|
||||||
GskRoundedRect *result) G_GNUC_PURE;
|
GskRoundedRect *result) G_GNUC_PURE;
|
||||||
|
|
||||||
GskRoundedRectIntersection gsk_rounded_rect_intersect (const GskRoundedRect *self,
|
|
||||||
const GskRoundedRect *other,
|
|
||||||
GskRoundedRect *result) G_GNUC_PURE;
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ gsk_vulkan_clip_intersect_rounded_rect (GskVulkanClip *dest,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case GSK_VULKAN_CLIP_NONE:
|
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);
|
gsk_rounded_rect_init_copy (&dest->rect, rounded);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -450,7 +450,7 @@ gsk_vulkan_glyph_cache_begin_frame (GskVulkanGlyphCache *cache)
|
|||||||
GHashTableIter iter;
|
GHashTableIter iter;
|
||||||
GlyphCacheKey *key;
|
GlyphCacheKey *key;
|
||||||
GskVulkanCachedGlyph *value;
|
GskVulkanCachedGlyph *value;
|
||||||
guint dropped = 0;
|
G_GNUC_UNUSED guint dropped = 0;
|
||||||
|
|
||||||
cache->timestamp++;
|
cache->timestamp++;
|
||||||
|
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ gsk_vulkan_render_pass_new (GdkVulkanContext *context,
|
|||||||
graphene_matrix_init_ortho (&self->p,
|
graphene_matrix_init_ortho (&self->p,
|
||||||
viewport->origin.x, viewport->origin.x + viewport->size.width,
|
viewport->origin.x, viewport->origin.x + viewport->size.width,
|
||||||
viewport->origin.y, viewport->origin.y + viewport->size.height,
|
viewport->origin.y, viewport->origin.y + viewport->size.height,
|
||||||
ORTHO_NEAR_PLANE,
|
2 * ORTHO_NEAR_PLANE - ORTHO_FAR_PLANE,
|
||||||
ORTHO_FAR_PLANE);
|
ORTHO_FAR_PLANE);
|
||||||
|
|
||||||
if (signal_semaphore != VK_NULL_HANDLE) // this is a dependent pass
|
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 = [
|
||||||
#gsk_private_vulkan_include_shaders = [
|
'clip.frag.glsl',
|
||||||
# 'clip.frag.glsl',
|
'clip.vert.glsl',
|
||||||
# 'clip.vert.glsl',
|
'constants.glsl',
|
||||||
# 'constants.glsl',
|
'rounded-rect.glsl',
|
||||||
# 'rounded-rect.glsl',
|
]
|
||||||
#]
|
|
||||||
|
|
||||||
gsk_private_vulkan_fragment_shaders = [
|
gsk_private_vulkan_fragment_shaders = [
|
||||||
'blendmode.frag',
|
'blendmode.frag',
|
||||||
@@ -51,6 +50,7 @@ foreach shader: gsk_private_vulkan_shaders
|
|||||||
compiled_shader = custom_target(spv_shader,
|
compiled_shader = custom_target(spv_shader,
|
||||||
input: shader,
|
input: shader,
|
||||||
output: spv_shader,
|
output: spv_shader,
|
||||||
|
depend_files: gsk_private_vulkan_include_shaders,
|
||||||
command: [
|
command: [
|
||||||
glslc,
|
glslc,
|
||||||
stage_arg,
|
stage_arg,
|
||||||
@@ -61,6 +61,7 @@ foreach shader: gsk_private_vulkan_shaders
|
|||||||
compiled_clip_shader = custom_target(clip_spv_shader,
|
compiled_clip_shader = custom_target(clip_spv_shader,
|
||||||
input: shader,
|
input: shader,
|
||||||
output: clip_spv_shader,
|
output: clip_spv_shader,
|
||||||
|
depend_files: gsk_private_vulkan_include_shaders,
|
||||||
command: [
|
command: [
|
||||||
glslc,
|
glslc,
|
||||||
stage_arg,
|
stage_arg,
|
||||||
@@ -71,6 +72,7 @@ foreach shader: gsk_private_vulkan_shaders
|
|||||||
compiled_clip_rounded_shader = custom_target(clip_rounded_spv_shader,
|
compiled_clip_rounded_shader = custom_target(clip_rounded_spv_shader,
|
||||||
input: shader,
|
input: shader,
|
||||||
output: clip_rounded_spv_shader,
|
output: clip_rounded_spv_shader,
|
||||||
|
depend_files: gsk_private_vulkan_include_shaders,
|
||||||
command: [
|
command: [
|
||||||
glslc,
|
glslc,
|
||||||
stage_arg,
|
stage_arg,
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
GtkWindow *parent;
|
GtkWindow *parent;
|
||||||
|
char *handle;
|
||||||
GAppLaunchContext *context;
|
GAppLaunchContext *context;
|
||||||
char *uri;
|
char *uri;
|
||||||
GTask *task;
|
GTask *task;
|
||||||
@@ -39,9 +40,10 @@ typedef struct {
|
|||||||
static void
|
static void
|
||||||
gtk_show_uri_data_free (GtkShowUriData *data)
|
gtk_show_uri_data_free (GtkShowUriData *data)
|
||||||
{
|
{
|
||||||
if (data->parent)
|
if (data->parent && data->handle)
|
||||||
gtk_window_unexport_handle (data->parent);
|
gtk_window_unexport_handle (data->parent, data->handle);
|
||||||
g_clear_object (&data->parent);
|
g_clear_object (&data->parent);
|
||||||
|
g_free (data->handle);
|
||||||
g_clear_object (&data->context);
|
g_clear_object (&data->context);
|
||||||
g_free (data->uri);
|
g_free (data->uri);
|
||||||
g_clear_object (&data->task);
|
g_clear_object (&data->task);
|
||||||
@@ -72,7 +74,10 @@ window_handle_exported (GtkWindow *window,
|
|||||||
GtkShowUriData *data = user_data;
|
GtkShowUriData *data = user_data;
|
||||||
|
|
||||||
if (handle)
|
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,
|
g_app_info_launch_default_for_uri_async (data->uri,
|
||||||
data->context,
|
data->context,
|
||||||
|
|||||||
@@ -17,11 +17,13 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <gdk/gdk.h>
|
#include <gdk/gdk.h>
|
||||||
#include "gdkpixbufutilsprivate.h"
|
#include "gdktextureutilsprivate.h"
|
||||||
#include "gtkscalerprivate.h"
|
#include "gtkscalerprivate.h"
|
||||||
|
|
||||||
#include "gdk/gdktextureprivate.h"
|
#include "gdk/gdktextureprivate.h"
|
||||||
|
|
||||||
|
/* {{{ Pixbuf helpers */
|
||||||
|
|
||||||
static GdkPixbuf *
|
static GdkPixbuf *
|
||||||
load_from_stream (GdkPixbufLoader *loader,
|
load_from_stream (GdkPixbufLoader *loader,
|
||||||
GInputStream *stream,
|
GInputStream *stream,
|
||||||
@@ -91,7 +93,7 @@ size_prepared_cb (GdkPixbufLoader *loader,
|
|||||||
* load the image at its original size times the
|
* load the image at its original size times the
|
||||||
* given scale.
|
* given scale.
|
||||||
*/
|
*/
|
||||||
GdkPixbuf *
|
static GdkPixbuf *
|
||||||
_gdk_pixbuf_new_from_stream_scaled (GInputStream *stream,
|
_gdk_pixbuf_new_from_stream_scaled (GInputStream *stream,
|
||||||
double scale,
|
double scale,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
@@ -145,7 +147,7 @@ size_prepared_cb2 (GdkPixbufLoader *loader,
|
|||||||
gdk_pixbuf_loader_set_size (loader, width, height);
|
gdk_pixbuf_loader_set_size (loader, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
GdkPixbuf *
|
static GdkPixbuf *
|
||||||
_gdk_pixbuf_new_from_stream_at_scale (GInputStream *stream,
|
_gdk_pixbuf_new_from_stream_at_scale (GInputStream *stream,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
@@ -172,44 +174,7 @@ _gdk_pixbuf_new_from_stream_at_scale (GInputStream *stream,
|
|||||||
return pixbuf;
|
return pixbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
GdkPixbuf *
|
static 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 *
|
|
||||||
_gdk_pixbuf_new_from_resource_at_scale (const char *resource_path,
|
_gdk_pixbuf_new_from_resource_at_scale (const char *resource_path,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
@@ -227,9 +192,11 @@ _gdk_pixbuf_new_from_resource_at_scale (const char *resource_path,
|
|||||||
g_object_unref (stream);
|
g_object_unref (stream);
|
||||||
|
|
||||||
return pixbuf;
|
return pixbuf;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* }}} */
|
||||||
|
/* {{{ Symbolic processing */
|
||||||
|
|
||||||
static GdkPixbuf *
|
static GdkPixbuf *
|
||||||
load_symbolic_svg (const char *escaped_file_data,
|
load_symbolic_svg (const char *escaped_file_data,
|
||||||
int width,
|
int width,
|
||||||
@@ -335,19 +302,17 @@ gtk_make_symbolic_pixbuf_from_data (const char *file_data,
|
|||||||
char *escaped_file_data;
|
char *escaped_file_data;
|
||||||
|
|
||||||
/* Fetch size from the original icon */
|
/* Fetch size from the original icon */
|
||||||
{
|
GInputStream *stream = g_memory_input_stream_new_from_data (file_data, file_len, NULL);
|
||||||
GInputStream *stream = g_memory_input_stream_new_from_data (file_data, file_len, NULL);
|
GdkPixbuf *reference = gdk_pixbuf_new_from_stream (stream, NULL, error);
|
||||||
GdkPixbuf *reference = gdk_pixbuf_new_from_stream (stream, NULL, error);
|
|
||||||
|
|
||||||
g_object_unref (stream);
|
g_object_unref (stream);
|
||||||
|
|
||||||
if (!reference)
|
if (!reference)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
icon_width = gdk_pixbuf_get_width (reference);
|
icon_width = gdk_pixbuf_get_width (reference);
|
||||||
icon_height = gdk_pixbuf_get_height (reference);
|
icon_height = gdk_pixbuf_get_height (reference);
|
||||||
g_object_unref (reference);
|
g_object_unref (reference);
|
||||||
}
|
|
||||||
|
|
||||||
escaped_file_data = g_base64_encode ((guchar *) file_data, file_len);
|
escaped_file_data = g_base64_encode ((guchar *) file_data, file_len);
|
||||||
icon_width_str = g_strdup_printf ("%d", icon_width);
|
icon_width_str = g_strdup_printf ("%d", icon_width);
|
||||||
@@ -418,12 +383,12 @@ out:
|
|||||||
return pixbuf;
|
return pixbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
GdkPixbuf *
|
static GdkPixbuf *
|
||||||
gtk_make_symbolic_pixbuf_from_resource (const char *path,
|
make_symbolic_pixbuf_from_resource (const char *path,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
double scale,
|
double scale,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GBytes *bytes;
|
GBytes *bytes;
|
||||||
const char *data;
|
const char *data;
|
||||||
@@ -443,12 +408,12 @@ gtk_make_symbolic_pixbuf_from_resource (const char *path,
|
|||||||
return pixbuf;
|
return pixbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
GdkPixbuf *
|
static GdkPixbuf *
|
||||||
gtk_make_symbolic_pixbuf_from_path (const char *path,
|
make_symbolic_pixbuf_from_path (const char *path,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
double scale,
|
double scale,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
char *data;
|
char *data;
|
||||||
gsize size;
|
gsize size;
|
||||||
@@ -464,12 +429,12 @@ gtk_make_symbolic_pixbuf_from_path (const char *path,
|
|||||||
return pixbuf;
|
return pixbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
GdkPixbuf *
|
static GdkPixbuf *
|
||||||
gtk_make_symbolic_pixbuf_from_file (GFile *file,
|
make_symbolic_pixbuf_from_file (GFile *file,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
double scale,
|
double scale,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
char *data;
|
char *data;
|
||||||
gsize size;
|
gsize size;
|
||||||
@@ -485,6 +450,91 @@ gtk_make_symbolic_pixbuf_from_file (GFile *file,
|
|||||||
return pixbuf;
|
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 *
|
GdkTexture *
|
||||||
gtk_load_symbolic_texture_from_resource (const char *path)
|
gtk_load_symbolic_texture_from_resource (const char *path)
|
||||||
{
|
{
|
||||||
@@ -492,16 +542,16 @@ gtk_load_symbolic_texture_from_resource (const char *path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GdkTexture *
|
GdkTexture *
|
||||||
gtk_make_symbolic_texture_from_resource (const char *path,
|
gdk_texture_new_from_resource_symbolic (const char *path,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
double scale,
|
double scale,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
GdkTexture *texture = NULL;
|
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)
|
if (pixbuf)
|
||||||
{
|
{
|
||||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
||||||
@@ -522,7 +572,7 @@ gtk_load_symbolic_texture_from_file (GFile *file)
|
|||||||
if (stream == NULL)
|
if (stream == NULL)
|
||||||
return 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);
|
g_object_unref (stream);
|
||||||
if (pixbuf == NULL)
|
if (pixbuf == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -534,22 +584,25 @@ gtk_load_symbolic_texture_from_file (GFile *file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GdkTexture *
|
GdkTexture *
|
||||||
gtk_make_symbolic_texture_from_file (GFile *file,
|
gdk_texture_new_from_file_symbolic (GFile *file,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
double scale,
|
double scale,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
GdkTexture *texture;
|
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);
|
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
||||||
g_object_unref (pixbuf);
|
g_object_unref (pixbuf);
|
||||||
|
|
||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* }}} */
|
||||||
|
/* {{{ Scaled paintable API */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int scale_factor;
|
int scale_factor;
|
||||||
} LoaderData;
|
} LoaderData;
|
||||||
@@ -576,7 +629,7 @@ on_loader_size_prepared (GdkPixbufLoader *loader,
|
|||||||
height * loader_data->scale_factor);
|
height * loader_data->scale_factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
GdkPaintable *
|
static GdkPaintable *
|
||||||
gdk_paintable_new_from_bytes_scaled (GBytes *bytes,
|
gdk_paintable_new_from_bytes_scaled (GBytes *bytes,
|
||||||
int scale_factor)
|
int scale_factor)
|
||||||
{
|
{
|
||||||
@@ -680,3 +733,7 @@ gdk_paintable_new_from_file_scaled (GFile *file,
|
|||||||
|
|
||||||
return paintable;
|
return paintable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* }}} */
|
||||||
|
|
||||||
|
/* vim:set foldmethod=marker expandtab: */
|
||||||
@@ -21,30 +21,6 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
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,
|
GdkPixbuf *gtk_make_symbolic_pixbuf_from_data (const char *data,
|
||||||
gsize len,
|
gsize len,
|
||||||
int width,
|
int width,
|
||||||
@@ -52,36 +28,41 @@ GdkPixbuf *gtk_make_symbolic_pixbuf_from_data (const char *data,
|
|||||||
double scale,
|
double scale,
|
||||||
const char *debug_output_to,
|
const char *debug_output_to,
|
||||||
GError **error);
|
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 width,
|
||||||
int height,
|
int height,
|
||||||
double scale,
|
double scale,
|
||||||
GError **error);
|
GError **error);
|
||||||
GdkPixbuf *gtk_make_symbolic_pixbuf_from_path (const char *path,
|
GdkTexture *gdk_texture_new_from_file_symbolic (GFile *file,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
double scale,
|
double scale,
|
||||||
GError **error);
|
GError **error);
|
||||||
GdkPixbuf *gtk_make_symbolic_pixbuf_from_resource (const char *path,
|
GdkTexture *gdk_texture_new_from_resource_symbolic (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,
|
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
double scale,
|
double scale,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
GdkPaintable *gdk_paintable_new_from_bytes_scaled (GBytes *bytes,
|
GdkTexture *gtk_load_symbolic_texture_from_file (GFile *file);
|
||||||
int scale_factor);
|
GdkTexture *gtk_load_symbolic_texture_from_resource (const char *data);
|
||||||
|
|
||||||
GdkPaintable *gdk_paintable_new_from_path_scaled (const char *path,
|
GdkPaintable *gdk_paintable_new_from_path_scaled (const char *path,
|
||||||
int scale_factor);
|
int scale_factor);
|
||||||
GdkPaintable *gdk_paintable_new_from_resource_scaled (const char *path,
|
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);
|
int scale_factor);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
@@ -220,6 +220,7 @@ enum
|
|||||||
PROP_COLUMNS,
|
PROP_COLUMNS,
|
||||||
PROP_ENABLE_RUBBERBAND,
|
PROP_ENABLE_RUBBERBAND,
|
||||||
PROP_HADJUSTMENT,
|
PROP_HADJUSTMENT,
|
||||||
|
PROP_HEADER_FACTORY,
|
||||||
PROP_HSCROLL_POLICY,
|
PROP_HSCROLL_POLICY,
|
||||||
PROP_MODEL,
|
PROP_MODEL,
|
||||||
PROP_REORDERABLE,
|
PROP_REORDERABLE,
|
||||||
@@ -629,6 +630,10 @@ gtk_column_view_get_property (GObject *object,
|
|||||||
g_value_set_object (value, self->hadjustment);
|
g_value_set_object (value, self->hadjustment);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_HEADER_FACTORY:
|
||||||
|
g_value_set_object (value, gtk_column_view_get_header_factory (self));
|
||||||
|
break;
|
||||||
|
|
||||||
case PROP_HSCROLL_POLICY:
|
case PROP_HSCROLL_POLICY:
|
||||||
g_value_set_enum (value, gtk_scrollable_get_hscroll_policy (GTK_SCROLLABLE (self->listview)));
|
g_value_set_enum (value, gtk_scrollable_get_hscroll_policy (GTK_SCROLLABLE (self->listview)));
|
||||||
break;
|
break;
|
||||||
@@ -712,6 +717,10 @@ gtk_column_view_set_property (GObject *object,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_HEADER_FACTORY:
|
||||||
|
gtk_column_view_set_header_factory (self, g_value_get_object (value));
|
||||||
|
break;
|
||||||
|
|
||||||
case PROP_HSCROLL_POLICY:
|
case PROP_HSCROLL_POLICY:
|
||||||
if (gtk_scrollable_get_hscroll_policy (GTK_SCROLLABLE (self->listview)) != g_value_get_enum (value))
|
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,
|
GTK_LIST_TAB_ALL,
|
||||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
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);
|
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);
|
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 *
|
GtkListItemFactory *
|
||||||
gtk_column_view_get_row_factory (GtkColumnView *self);
|
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
|
G_END_DECLS
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#include "gtkcssimageprivate.h"
|
#include "gtkcssimageprivate.h"
|
||||||
#include "gtkcsspalettevalueprivate.h"
|
#include "gtkcsspalettevalueprivate.h"
|
||||||
#include "gtkcsscolorvalueprivate.h"
|
#include "gtkcsscolorvalueprivate.h"
|
||||||
#include "gdkpixbufutilsprivate.h"
|
#include "gdktextureutilsprivate.h"
|
||||||
|
|
||||||
#include "gtkstyleproviderprivate.h"
|
#include "gtkstyleproviderprivate.h"
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ gtk_css_image_recolor_load_texture (GtkCssImageRecolor *recolor,
|
|||||||
if (g_str_has_suffix (uri, ".symbolic.png"))
|
if (g_str_has_suffix (uri, ".symbolic.png"))
|
||||||
recolor->texture = gtk_load_symbolic_texture_from_resource (resource_path);
|
recolor->texture = gtk_load_symbolic_texture_from_resource (resource_path);
|
||||||
else
|
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);
|
g_free (resource_path);
|
||||||
}
|
}
|
||||||
@@ -119,7 +119,7 @@ gtk_css_image_recolor_load_texture (GtkCssImageRecolor *recolor,
|
|||||||
if (g_str_has_suffix (uri, ".symbolic.png"))
|
if (g_str_has_suffix (uri, ".symbolic.png"))
|
||||||
recolor->texture = gtk_load_symbolic_texture_from_file (recolor->file);
|
recolor->texture = gtk_load_symbolic_texture_from_file (recolor->file);
|
||||||
else
|
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);
|
g_free (uri);
|
||||||
|
|||||||
+1
-15
@@ -47,21 +47,7 @@ gtk_css_image_url_load_image (GtkCssImageUrl *url,
|
|||||||
return url->loaded_image;
|
return url->loaded_image;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We special case resources here so we can use gdk_texture_new_from_resource. */
|
texture = gdk_texture_new_from_file (url->file, &local_error);
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (texture == NULL)
|
if (texture == NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,7 +28,6 @@
|
|||||||
#include "gtkborder.h"
|
#include "gtkborder.h"
|
||||||
#include "gtktypes.h"
|
#include "gtktypes.h"
|
||||||
#include "gtkcssvalueprivate.h"
|
#include "gtkcssvalueprivate.h"
|
||||||
#include "gtkroundedboxprivate.h"
|
|
||||||
#include "gtksnapshot.h"
|
#include "gtksnapshot.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|||||||
+4
-4
@@ -19,7 +19,7 @@
|
|||||||
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
* 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
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
||||||
* files for a list of changes. These files are distributed with
|
* 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"
|
#include "config.h"
|
||||||
@@ -207,7 +207,7 @@ gtk_drag_source_set_property (GObject *object,
|
|||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
GtkDragSource *source = GTK_DRAG_SOURCE (object);
|
GtkDragSource *source = GTK_DRAG_SOURCE (object);
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_CONTENT:
|
case PROP_CONTENT:
|
||||||
@@ -424,13 +424,13 @@ gtk_drag_source_class_init (GtkDragSourceClass *class)
|
|||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
0,
|
0,
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
_gtk_marshal_OBJECT__BOOLEAN,
|
_gtk_marshal_VOID__OBJECT_BOOLEAN,
|
||||||
G_TYPE_NONE, 2,
|
G_TYPE_NONE, 2,
|
||||||
GDK_TYPE_DRAG,
|
GDK_TYPE_DRAG,
|
||||||
G_TYPE_BOOLEAN);
|
G_TYPE_BOOLEAN);
|
||||||
g_signal_set_va_marshaller (signals[DRAG_END],
|
g_signal_set_va_marshaller (signals[DRAG_END],
|
||||||
GTK_TYPE_DRAG_SOURCE,
|
GTK_TYPE_DRAG_SOURCE,
|
||||||
_gtk_marshal_OBJECT__BOOLEANv);
|
_gtk_marshal_VOID__OBJECT_BOOLEANv);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GtkDragSource::drag-cancel:
|
* GtkDragSource::drag-cancel:
|
||||||
|
|||||||
@@ -150,13 +150,13 @@ make_action_unique (GdkDragAction actions)
|
|||||||
|
|
||||||
if (actions & GDK_ACTION_MOVE)
|
if (actions & GDK_ACTION_MOVE)
|
||||||
return GDK_ACTION_MOVE;
|
return GDK_ACTION_MOVE;
|
||||||
|
|
||||||
if (actions & GDK_ACTION_LINK)
|
if (actions & GDK_ACTION_LINK)
|
||||||
return GDK_ACTION_LINK;
|
return GDK_ACTION_LINK;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GdkDragAction
|
static GdkDragAction
|
||||||
gtk_drop_target_async_drag_enter (GtkDropTargetAsync *self,
|
gtk_drop_target_async_drag_enter (GtkDropTargetAsync *self,
|
||||||
GdkDrop *drop,
|
GdkDrop *drop,
|
||||||
@@ -166,7 +166,7 @@ gtk_drop_target_async_drag_enter (GtkDropTargetAsync *self,
|
|||||||
return make_action_unique (self->actions & gdk_drop_get_actions (drop));
|
return make_action_unique (self->actions & gdk_drop_get_actions (drop));
|
||||||
}
|
}
|
||||||
|
|
||||||
static GdkDragAction
|
static GdkDragAction
|
||||||
gtk_drop_target_async_drag_motion (GtkDropTargetAsync *self,
|
gtk_drop_target_async_drag_motion (GtkDropTargetAsync *self,
|
||||||
GdkDrop *drop,
|
GdkDrop *drop,
|
||||||
double x,
|
double x,
|
||||||
@@ -457,12 +457,12 @@ gtk_drop_target_async_class_init (GtkDropTargetAsyncClass *class)
|
|||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (GtkDropTargetAsyncClass, drag_enter),
|
G_STRUCT_OFFSET (GtkDropTargetAsyncClass, drag_enter),
|
||||||
g_signal_accumulator_first_wins, NULL,
|
g_signal_accumulator_first_wins, NULL,
|
||||||
_gtk_marshal_ENUM__OBJECT_DOUBLE_DOUBLE,
|
_gtk_marshal_FLAGS__OBJECT_DOUBLE_DOUBLE,
|
||||||
GDK_TYPE_DRAG_ACTION, 3,
|
GDK_TYPE_DRAG_ACTION, 3,
|
||||||
GDK_TYPE_DROP, G_TYPE_DOUBLE, G_TYPE_DOUBLE);
|
GDK_TYPE_DROP, G_TYPE_DOUBLE, G_TYPE_DOUBLE);
|
||||||
g_signal_set_va_marshaller (signals[DRAG_ENTER],
|
g_signal_set_va_marshaller (signals[DRAG_ENTER],
|
||||||
GTK_TYPE_DROP_TARGET_ASYNC,
|
GTK_TYPE_DROP_TARGET_ASYNC,
|
||||||
_gtk_marshal_ENUM__OBJECT_DOUBLE_DOUBLEv);
|
_gtk_marshal_FLAGS__OBJECT_DOUBLE_DOUBLEv);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GtkDropTargetAsync::drag-motion:
|
* GtkDropTargetAsync::drag-motion:
|
||||||
@@ -481,12 +481,12 @@ gtk_drop_target_async_class_init (GtkDropTargetAsyncClass *class)
|
|||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (GtkDropTargetAsyncClass, drag_motion),
|
G_STRUCT_OFFSET (GtkDropTargetAsyncClass, drag_motion),
|
||||||
g_signal_accumulator_first_wins, NULL,
|
g_signal_accumulator_first_wins, NULL,
|
||||||
_gtk_marshal_ENUM__OBJECT_DOUBLE_DOUBLE,
|
_gtk_marshal_FLAGS__OBJECT_DOUBLE_DOUBLE,
|
||||||
GDK_TYPE_DRAG_ACTION, 3,
|
GDK_TYPE_DRAG_ACTION, 3,
|
||||||
GDK_TYPE_DROP, G_TYPE_DOUBLE, G_TYPE_DOUBLE);
|
GDK_TYPE_DROP, G_TYPE_DOUBLE, G_TYPE_DOUBLE);
|
||||||
g_signal_set_va_marshaller (signals[DRAG_MOTION],
|
g_signal_set_va_marshaller (signals[DRAG_MOTION],
|
||||||
GTK_TYPE_DROP_TARGET_ASYNC,
|
GTK_TYPE_DROP_TARGET_ASYNC,
|
||||||
_gtk_marshal_ENUM__OBJECT_DOUBLE_DOUBLEv);
|
_gtk_marshal_FLAGS__OBJECT_DOUBLE_DOUBLEv);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GtkDropTargetAsync::drag-leave:
|
* GtkDropTargetAsync::drag-leave:
|
||||||
@@ -617,7 +617,7 @@ GdkContentFormats *
|
|||||||
gtk_drop_target_async_get_formats (GtkDropTargetAsync *self)
|
gtk_drop_target_async_get_formats (GtkDropTargetAsync *self)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GTK_IS_DROP_TARGET_ASYNC (self), NULL);
|
g_return_val_if_fail (GTK_IS_DROP_TARGET_ASYNC (self), NULL);
|
||||||
|
|
||||||
return self->formats;
|
return self->formats;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -633,7 +633,7 @@ gtk_drop_target_async_set_actions (GtkDropTargetAsync *self,
|
|||||||
GdkDragAction actions)
|
GdkDragAction actions)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_DROP_TARGET_ASYNC (self));
|
g_return_if_fail (GTK_IS_DROP_TARGET_ASYNC (self));
|
||||||
|
|
||||||
if (self->actions == actions)
|
if (self->actions == actions)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
+6
-5
@@ -69,9 +69,9 @@ typedef enum
|
|||||||
GTK_ALIGN_START,
|
GTK_ALIGN_START,
|
||||||
GTK_ALIGN_END,
|
GTK_ALIGN_END,
|
||||||
GTK_ALIGN_CENTER,
|
GTK_ALIGN_CENTER,
|
||||||
GTK_ALIGN_BASELINE_FILL,
|
GTK_ALIGN_BASELINE_FILL GDK_AVAILABLE_ENUMERATOR_IN_4_12,
|
||||||
GTK_ALIGN_BASELINE GDK_DEPRECATED_ENUMERATOR_IN_4_12_FOR(GTK_ALIGN_BASELINE_FILL) = GTK_ALIGN_BASELINE_FILL,
|
GTK_ALIGN_BASELINE GDK_DEPRECATED_ENUMERATOR_IN_4_12_FOR(GTK_ALIGN_BASELINE_FILL) = GTK_ALIGN_BASELINE_FILL,
|
||||||
GTK_ALIGN_BASELINE_CENTER,
|
GTK_ALIGN_BASELINE_CENTER GDK_AVAILABLE_ENUMERATOR_IN_4_12,
|
||||||
} GtkAlign;
|
} GtkAlign;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1422,7 +1422,7 @@ typedef enum {
|
|||||||
GTK_ACCESSIBLE_ROLE_TREE_ITEM,
|
GTK_ACCESSIBLE_ROLE_TREE_ITEM,
|
||||||
GTK_ACCESSIBLE_ROLE_WIDGET,
|
GTK_ACCESSIBLE_ROLE_WIDGET,
|
||||||
GTK_ACCESSIBLE_ROLE_WINDOW,
|
GTK_ACCESSIBLE_ROLE_WINDOW,
|
||||||
GTK_ACCESSIBLE_ROLE_TOGGLE_BUTTON
|
GTK_ACCESSIBLE_ROLE_TOGGLE_BUTTON GDK_AVAILABLE_ENUMERATOR_IN_4_10
|
||||||
} GtkAccessibleRole;
|
} GtkAccessibleRole;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1449,7 +1449,8 @@ typedef enum {
|
|||||||
* @GTK_ACCESSIBLE_STATE_SELECTED: A “selected” state; set when a widget
|
* @GTK_ACCESSIBLE_STATE_SELECTED: A “selected” state; set when a widget
|
||||||
* is selected. Value type: boolean or undefined
|
* is selected. Value type: boolean or undefined
|
||||||
* @GTK_ACCESSIBLE_STATE_VISITED: Indicates that a widget with the
|
* @GTK_ACCESSIBLE_STATE_VISITED: Indicates that a widget with the
|
||||||
* GTK_ACCESSIBLE_ROLE_LINK has been visited. Value type: boolean. Since: 4.12
|
* GTK_ACCESSIBLE_ROLE_LINK has been visited. Value type: boolean.
|
||||||
|
* Since: 4.12
|
||||||
*
|
*
|
||||||
* The possible accessible states of a [iface@Accessible].
|
* The possible accessible states of a [iface@Accessible].
|
||||||
*/
|
*/
|
||||||
@@ -1462,7 +1463,7 @@ typedef enum {
|
|||||||
GTK_ACCESSIBLE_STATE_INVALID,
|
GTK_ACCESSIBLE_STATE_INVALID,
|
||||||
GTK_ACCESSIBLE_STATE_PRESSED,
|
GTK_ACCESSIBLE_STATE_PRESSED,
|
||||||
GTK_ACCESSIBLE_STATE_SELECTED,
|
GTK_ACCESSIBLE_STATE_SELECTED,
|
||||||
GTK_ACCESSIBLE_STATE_VISITED
|
GTK_ACCESSIBLE_STATE_VISITED GDK_AVAILABLE_ENUMERATOR_IN_4_12
|
||||||
} GtkAccessibleState;
|
} GtkAccessibleState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -410,16 +410,22 @@ gtk_event_controller_scroll_handle_event (GtkEventController *controller,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ABS (scroll->cur_dx) >= 1)
|
if (ABS (scroll->cur_dx) >= 0.5)
|
||||||
{
|
{
|
||||||
steps = trunc (scroll->cur_dx);
|
steps = trunc (scroll->cur_dx);
|
||||||
|
if (steps == 0)
|
||||||
|
steps = (scroll->cur_dx > 0) ? 1 : -1;
|
||||||
|
|
||||||
scroll->cur_dx -= steps;
|
scroll->cur_dx -= steps;
|
||||||
dx = steps;
|
dx = steps;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ABS (scroll->cur_dy) >= 1)
|
if (ABS (scroll->cur_dy) >= 0.5)
|
||||||
{
|
{
|
||||||
steps = trunc (scroll->cur_dy);
|
steps = trunc (scroll->cur_dy);
|
||||||
|
if (steps == 0)
|
||||||
|
steps = (scroll->cur_dy > 0) ? 1 : -1;
|
||||||
|
|
||||||
scroll->cur_dy -= steps;
|
scroll->cur_dy -= steps;
|
||||||
dy = steps;
|
dy = steps;
|
||||||
}
|
}
|
||||||
@@ -459,16 +465,22 @@ gtk_event_controller_scroll_handle_event (GtkEventController *controller,
|
|||||||
scroll->cur_dy += dy;
|
scroll->cur_dy += dy;
|
||||||
dx = dy = 0;
|
dx = dy = 0;
|
||||||
|
|
||||||
if (ABS (scroll->cur_dx) >= 1)
|
if (ABS (scroll->cur_dx) >= 0.5)
|
||||||
{
|
{
|
||||||
steps = trunc (scroll->cur_dx);
|
steps = trunc (scroll->cur_dx);
|
||||||
|
if (steps == 0)
|
||||||
|
steps = (scroll->cur_dx > 0) ? 1 : -1;
|
||||||
|
|
||||||
scroll->cur_dx -= steps;
|
scroll->cur_dx -= steps;
|
||||||
dx = steps;
|
dx = steps;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ABS (scroll->cur_dy) >= 1)
|
if (ABS (scroll->cur_dy) >= 0.5)
|
||||||
{
|
{
|
||||||
steps = trunc (scroll->cur_dy);
|
steps = trunc (scroll->cur_dy);
|
||||||
|
if (steps == 0)
|
||||||
|
steps = (scroll->cur_dy > 0) ? 1 : -1;
|
||||||
|
|
||||||
scroll->cur_dy -= steps;
|
scroll->cur_dy -= steps;
|
||||||
dy = steps;
|
dy = steps;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -40,7 +40,7 @@
|
|||||||
* expanded widget yourself, such as when you want to actually create
|
* expanded widget yourself, such as when you want to actually create
|
||||||
* the widget at expansion time. In this case, create a `GtkExpander`
|
* the widget at expansion time. In this case, create a `GtkExpander`
|
||||||
* but do not add a child to it. The expander widget has an
|
* but do not add a child to it. The expander widget has an
|
||||||
* [property@Gtk.Expander:expanded[ property which can be used to
|
* [property@Gtk.Expander:expanded] property which can be used to
|
||||||
* monitor its expansion state. You should watch this property with
|
* monitor its expansion state. You should watch this property with
|
||||||
* a signal connection as follows:
|
* a signal connection as follows:
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ typedef struct {
|
|||||||
|
|
||||||
const char *method_name;
|
const char *method_name;
|
||||||
|
|
||||||
|
char *exported_handle;
|
||||||
GtkWindow *exported_window;
|
GtkWindow *exported_window;
|
||||||
PortalErrorHandler error_handler;
|
PortalErrorHandler error_handler;
|
||||||
} FilechooserPortalData;
|
} FilechooserPortalData;
|
||||||
@@ -79,7 +80,11 @@ filechooser_portal_data_clear (FilechooserPortalData *data)
|
|||||||
|
|
||||||
if (data->exported_window)
|
if (data->exported_window)
|
||||||
{
|
{
|
||||||
gtk_window_unexport_handle (data->exported_window);
|
if (data->exported_handle)
|
||||||
|
{
|
||||||
|
gtk_window_unexport_handle (data->exported_window, data->exported_handle);
|
||||||
|
g_clear_pointer (&data->exported_handle, g_free);
|
||||||
|
}
|
||||||
g_clear_object (&data->exported_window);
|
g_clear_object (&data->exported_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -460,6 +465,7 @@ window_handle_exported (GtkWindow *window,
|
|||||||
gtk_grab_add (GTK_WIDGET (data->grab_widget));
|
gtk_grab_add (GTK_WIDGET (data->grab_widget));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data->exported_handle = g_strdup (handle_str);
|
||||||
show_portal_file_chooser (self, handle_str);
|
show_portal_file_chooser (self, handle_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -580,7 +580,10 @@ gtk_file_chooser_widget_finalize (GObject *object)
|
|||||||
stop_loading_and_clear_list_model (impl, FALSE);
|
stop_loading_and_clear_list_model (impl, FALSE);
|
||||||
search_clear_model (impl, FALSE);
|
search_clear_model (impl, FALSE);
|
||||||
recent_clear_model (impl, FALSE);
|
recent_clear_model (impl, FALSE);
|
||||||
|
g_clear_object (&impl->recent_model);
|
||||||
|
g_clear_object (&impl->search_model);
|
||||||
g_clear_object (&impl->model_for_search);
|
g_clear_object (&impl->model_for_search);
|
||||||
|
g_clear_object (&impl->browse_files_model);
|
||||||
|
|
||||||
g_clear_object (&impl->selection_model);
|
g_clear_object (&impl->selection_model);
|
||||||
g_clear_object (&impl->sort_model);
|
g_clear_object (&impl->sort_model);
|
||||||
@@ -3961,6 +3964,7 @@ set_list_model (GtkFileChooserWidget *impl,
|
|||||||
|
|
||||||
set_busy_cursor (impl, TRUE);
|
set_busy_cursor (impl, TRUE);
|
||||||
|
|
||||||
|
g_clear_object (&impl->browse_files_model);
|
||||||
impl->browse_files_model =
|
impl->browse_files_model =
|
||||||
_gtk_file_system_model_new_for_directory (impl->current_folder, MODEL_ATTRIBUTES);
|
_gtk_file_system_model_new_for_directory (impl->current_folder, MODEL_ATTRIBUTES);
|
||||||
|
|
||||||
|
|||||||
+13
-14
@@ -229,9 +229,9 @@ open_done (GObject *source,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
show_folder_done (GObject *source,
|
show_item_done (GObject *source,
|
||||||
GAsyncResult *result,
|
GAsyncResult *result,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GDBusConnection *bus = G_DBUS_CONNECTION (source);
|
GDBusConnection *bus = G_DBUS_CONNECTION (source);
|
||||||
GTask *task = G_TASK (data);
|
GTask *task = G_TASK (data);
|
||||||
@@ -261,11 +261,10 @@ show_folder_done (GObject *source,
|
|||||||
#define FILE_MANAGER_DBUS_PATH "/org/freedesktop/FileManager1"
|
#define FILE_MANAGER_DBUS_PATH "/org/freedesktop/FileManager1"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
show_folder (GtkWindow *parent,
|
show_item (GtkWindow *parent,
|
||||||
const char *uri,
|
const char *uri,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GTask *task)
|
||||||
gpointer user_data)
|
|
||||||
{
|
{
|
||||||
GDBusConnection *bus;
|
GDBusConnection *bus;
|
||||||
GVariantBuilder uris_builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE_STRING_ARRAY);
|
GVariantBuilder uris_builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE_STRING_ARRAY);
|
||||||
@@ -274,10 +273,10 @@ show_folder (GtkWindow *parent,
|
|||||||
|
|
||||||
if (!bus)
|
if (!bus)
|
||||||
{
|
{
|
||||||
g_task_return_new_error (G_TASK (user_data),
|
g_task_return_new_error (task,
|
||||||
GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_FAILED,
|
GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_FAILED,
|
||||||
"Session bus not available");
|
"Session bus not available");
|
||||||
g_object_unref (G_TASK (user_data));
|
g_object_unref (task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,14 +286,14 @@ show_folder (GtkWindow *parent,
|
|||||||
FILE_MANAGER_DBUS_NAME,
|
FILE_MANAGER_DBUS_NAME,
|
||||||
FILE_MANAGER_DBUS_PATH,
|
FILE_MANAGER_DBUS_PATH,
|
||||||
FILE_MANAGER_DBUS_IFACE,
|
FILE_MANAGER_DBUS_IFACE,
|
||||||
"ShowFolders",
|
"ShowItems",
|
||||||
g_variant_new ("(ass)", &uris_builder, ""),
|
g_variant_new ("(ass)", &uris_builder, ""),
|
||||||
NULL, /* ignore returned type */
|
NULL, /* ignore returned type */
|
||||||
G_DBUS_CALL_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
cancellable,
|
cancellable,
|
||||||
show_folder_done,
|
show_item_done,
|
||||||
user_data);
|
task);
|
||||||
}
|
}
|
||||||
|
|
||||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||||
@@ -470,7 +469,7 @@ gtk_file_launcher_open_containing_folder (GtkFileLauncher *self,
|
|||||||
{
|
{
|
||||||
char *uri = g_file_get_uri (self->file);
|
char *uri = g_file_get_uri (self->file);
|
||||||
|
|
||||||
show_folder (parent, uri, cancellable, show_folder_done, task);
|
show_item (parent, uri, cancellable, task);
|
||||||
|
|
||||||
g_free (uri);
|
g_free (uri);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -747,7 +747,9 @@ gtk_file_system_model_monitor_change (GFileMonitor * monitor,
|
|||||||
case G_FILE_MONITOR_EVENT_CREATED:
|
case G_FILE_MONITOR_EVENT_CREATED:
|
||||||
case G_FILE_MONITOR_EVENT_CHANGED:
|
case G_FILE_MONITOR_EVENT_CHANGED:
|
||||||
case G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED:
|
case G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED:
|
||||||
/* We can treat all of these the same way */
|
if (g_file_equal (file, model->dir))
|
||||||
|
return;
|
||||||
|
/* We can treat all children the same way */
|
||||||
g_file_query_info_async (file,
|
g_file_query_info_async (file,
|
||||||
model->attributes,
|
model->attributes,
|
||||||
G_FILE_QUERY_INFO_NONE,
|
G_FILE_QUERY_INFO_NONE,
|
||||||
|
|||||||
@@ -34,9 +34,11 @@
|
|||||||
* It hides some elements from the other model according to
|
* It hides some elements from the other model according to
|
||||||
* criteria given by a `GtkFilter`.
|
* criteria given by a `GtkFilter`.
|
||||||
*
|
*
|
||||||
* The model can be set up to do incremental searching, so that
|
* The model can be set up to do incremental filtering, so that
|
||||||
* filtering long lists doesn't block the UI. See
|
* filtering long lists doesn't block the UI. See
|
||||||
* [method@Gtk.FilterListModel.set_incremental] for details.
|
* [method@Gtk.FilterListModel.set_incremental] for details.
|
||||||
|
*
|
||||||
|
* `GtkFilterListModel` passes through sections from the underlying model.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@@ -188,6 +190,39 @@ gtk_filter_list_model_get_section (GtkSectionModel *model,
|
|||||||
*out_end = *out_start + gtk_bitset_get_size_in_range (self->matches, start, end - 1);
|
*out_end = *out_start + gtk_bitset_get_size_in_range (self->matches, start, end - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_filter_list_model_sections_changed_cb (GtkSectionModel *model,
|
||||||
|
unsigned int position,
|
||||||
|
unsigned int n_items,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
GtkFilterListModel *self = GTK_FILTER_LIST_MODEL (user_data);
|
||||||
|
unsigned int start, end;
|
||||||
|
|
||||||
|
switch (self->strictness)
|
||||||
|
{
|
||||||
|
case GTK_FILTER_MATCH_NONE:
|
||||||
|
return;
|
||||||
|
|
||||||
|
case GTK_FILTER_MATCH_ALL:
|
||||||
|
gtk_section_model_sections_changed (GTK_SECTION_MODEL (self), position, n_items);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GTK_FILTER_MATCH_SOME:
|
||||||
|
if (position > 0)
|
||||||
|
start = gtk_bitset_get_size_in_range (self->matches, 0, position - 1);
|
||||||
|
else
|
||||||
|
start = 0;
|
||||||
|
end = gtk_bitset_get_size_in_range (self->matches, 0, position + n_items - 1);
|
||||||
|
if (end - start > 0)
|
||||||
|
gtk_section_model_sections_changed (GTK_SECTION_MODEL (self), start, end - start);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
g_assert_not_reached ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_filter_list_model_section_model_init (GtkSectionModelInterface *iface)
|
gtk_filter_list_model_section_model_init (GtkSectionModelInterface *iface)
|
||||||
{
|
{
|
||||||
@@ -463,6 +498,7 @@ gtk_filter_list_model_clear_model (GtkFilterListModel *self)
|
|||||||
|
|
||||||
gtk_filter_list_model_stop_filtering (self);
|
gtk_filter_list_model_stop_filtering (self);
|
||||||
g_signal_handlers_disconnect_by_func (self->model, gtk_filter_list_model_items_changed_cb, self);
|
g_signal_handlers_disconnect_by_func (self->model, gtk_filter_list_model_items_changed_cb, self);
|
||||||
|
g_signal_handlers_disconnect_by_func (self->model, gtk_filter_list_model_sections_changed_cb, self);
|
||||||
g_clear_object (&self->model);
|
g_clear_object (&self->model);
|
||||||
if (self->matches)
|
if (self->matches)
|
||||||
gtk_bitset_remove_all (self->matches);
|
gtk_bitset_remove_all (self->matches);
|
||||||
@@ -827,6 +863,8 @@ gtk_filter_list_model_set_model (GtkFilterListModel *self,
|
|||||||
{
|
{
|
||||||
self->model = g_object_ref (model);
|
self->model = g_object_ref (model);
|
||||||
g_signal_connect (model, "items-changed", G_CALLBACK (gtk_filter_list_model_items_changed_cb), self);
|
g_signal_connect (model, "items-changed", G_CALLBACK (gtk_filter_list_model_items_changed_cb), self);
|
||||||
|
if (GTK_IS_SECTION_MODEL (model))
|
||||||
|
g_signal_connect (model, "sections-changed", G_CALLBACK (gtk_filter_list_model_sections_changed_cb), self);
|
||||||
if (removed == 0)
|
if (removed == 0)
|
||||||
{
|
{
|
||||||
self->strictness = GTK_FILTER_MATCH_NONE;
|
self->strictness = GTK_FILTER_MATCH_NONE;
|
||||||
|
|||||||
@@ -29,8 +29,8 @@
|
|||||||
*
|
*
|
||||||
* `GtkFlattenListModel` is a list model that concatenates other list models.
|
* `GtkFlattenListModel` is a list model that concatenates other list models.
|
||||||
*
|
*
|
||||||
* `GtkFlattenListModel` takes a list model containing list models,
|
* `GtkFlattenListModel` takes a list model containing list models, and flattens
|
||||||
* and flattens it into a single model.
|
* it into a single model. Each list model becomes a section in the single model.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|||||||
+17
-13
@@ -657,7 +657,7 @@ gtk_grid_view_measure_list (GtkWidget *widget,
|
|||||||
gtk_grid_view_measure_column_size (self, &col_min, &col_nat);
|
gtk_grid_view_measure_column_size (self, &col_min, &col_nat);
|
||||||
for_size = MAX (for_size, col_min * (int) self->min_columns);
|
for_size = MAX (for_size, col_min * (int) self->min_columns);
|
||||||
n_columns = gtk_grid_view_compute_n_columns (self, for_size, xspacing, col_min, col_nat);
|
n_columns = gtk_grid_view_compute_n_columns (self, for_size, xspacing, col_min, col_nat);
|
||||||
column_size = for_size / n_columns;
|
column_size = (for_size + xspacing) / n_columns - xspacing;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
row_height = 0;
|
row_height = 0;
|
||||||
@@ -756,8 +756,10 @@ gtk_grid_view_size_allocate (GtkWidget *widget,
|
|||||||
min_row_height = ceil ((double) height / GTK_GRID_VIEW_MAX_VISIBLE_ROWS);
|
min_row_height = ceil ((double) height / GTK_GRID_VIEW_MAX_VISIBLE_ROWS);
|
||||||
gtk_list_base_get_border_spacing (GTK_LIST_BASE (self), &xspacing, &yspacing);
|
gtk_list_base_get_border_spacing (GTK_LIST_BASE (self), &xspacing, &yspacing);
|
||||||
|
|
||||||
|
gtk_list_item_manager_gc_tiles (self->item_manager);
|
||||||
|
|
||||||
/* step 0: exit early if list is empty */
|
/* step 0: exit early if list is empty */
|
||||||
tile = gtk_list_tile_gc (self->item_manager, gtk_list_item_manager_get_first (self->item_manager));
|
tile = gtk_list_item_manager_get_first (self->item_manager);
|
||||||
if (tile == NULL)
|
if (tile == NULL)
|
||||||
{
|
{
|
||||||
gtk_list_base_allocate (GTK_LIST_BASE (self));
|
gtk_list_base_allocate (GTK_LIST_BASE (self));
|
||||||
@@ -770,15 +772,13 @@ gtk_grid_view_size_allocate (GtkWidget *widget,
|
|||||||
orientation == GTK_ORIENTATION_VERTICAL ? width : height,
|
orientation == GTK_ORIENTATION_VERTICAL ? width : height,
|
||||||
xspacing,
|
xspacing,
|
||||||
col_min, col_nat);
|
col_min, col_nat);
|
||||||
self->column_width = (orientation == GTK_ORIENTATION_VERTICAL ? width : height) / self->n_columns;
|
self->column_width = ((orientation == GTK_ORIENTATION_VERTICAL ? width : height) + xspacing) / self->n_columns - xspacing;
|
||||||
self->column_width = MAX (self->column_width, col_min);
|
self->column_width = MAX (self->column_width, col_min);
|
||||||
|
|
||||||
/* step 2: determine height of known rows */
|
/* step 2: determine height of known rows */
|
||||||
heights = g_array_new (FALSE, FALSE, sizeof (int));
|
heights = g_array_new (FALSE, FALSE, sizeof (int));
|
||||||
|
|
||||||
for (;
|
while (tile != NULL)
|
||||||
tile != NULL;
|
|
||||||
tile = gtk_list_tile_gc (self->item_manager, tile))
|
|
||||||
{
|
{
|
||||||
/* if it's a multirow tile, handle it here */
|
/* if it's a multirow tile, handle it here */
|
||||||
if (tile->n_items > 1 && tile->n_items >= self->n_columns)
|
if (tile->n_items > 1 && tile->n_items >= self->n_columns)
|
||||||
@@ -795,7 +795,7 @@ gtk_grid_view_size_allocate (GtkWidget *widget,
|
|||||||
|
|
||||||
for (i = 0, start = tile;
|
for (i = 0, start = tile;
|
||||||
i < self->n_columns && tile != NULL;
|
i < self->n_columns && tile != NULL;
|
||||||
tile = gtk_list_tile_gc (self->item_manager, gtk_rb_tree_node_get_next (tile)))
|
tile = gtk_rb_tree_node_get_next (tile))
|
||||||
{
|
{
|
||||||
if (tile->widget)
|
if (tile->widget)
|
||||||
{
|
{
|
||||||
@@ -883,16 +883,16 @@ gtk_grid_view_size_allocate (GtkWidget *widget,
|
|||||||
/* Add a filler tile for empty space in the bottom right */
|
/* Add a filler tile for empty space in the bottom right */
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
{
|
{
|
||||||
GtkListTile *filler;
|
GtkListTile *footer = gtk_list_item_manager_get_last (self->item_manager);
|
||||||
tile = gtk_list_item_manager_get_last (self->item_manager);
|
g_assert (gtk_list_tile_is_footer (footer));
|
||||||
filler = gtk_list_tile_append_filler (self->item_manager, tile);
|
tile = gtk_rb_tree_node_get_previous (footer);
|
||||||
gtk_list_tile_set_area_position (self->item_manager,
|
gtk_list_tile_set_area_position (self->item_manager,
|
||||||
filler,
|
footer,
|
||||||
column_start (self, xspacing, i),
|
column_start (self, xspacing, i),
|
||||||
y);
|
y);
|
||||||
gtk_list_tile_set_area_size (self->item_manager,
|
gtk_list_tile_set_area_size (self->item_manager,
|
||||||
filler,
|
footer,
|
||||||
column_end (self, xspacing, self->n_columns - 1) - filler->area.x,
|
column_end (self, xspacing, self->n_columns - 1) - footer->area.x,
|
||||||
tile->area.height);
|
tile->area.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -951,6 +951,8 @@ gtk_grid_view_dispose (GObject *object)
|
|||||||
|
|
||||||
self->item_manager = NULL;
|
self->item_manager = NULL;
|
||||||
|
|
||||||
|
g_clear_object (&self->factory);
|
||||||
|
|
||||||
G_OBJECT_CLASS (gtk_grid_view_parent_class)->dispose (object);
|
G_OBJECT_CLASS (gtk_grid_view_parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1335,6 +1337,8 @@ gtk_grid_view_set_factory (GtkGridView *self,
|
|||||||
if (!g_set_object (&self->factory, factory))
|
if (!g_set_object (&self->factory, factory))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
gtk_grid_view_update_factories (self);
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_FACTORY]);
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_FACTORY]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <gdk-pixbuf/gdk-pixdata.h>
|
#include <gdk-pixbuf/gdk-pixdata.h>
|
||||||
|
|
||||||
|
#if defined(G_ENABLE_DEBUG) || defined(BUILD_TOOLS)
|
||||||
|
|
||||||
#define VERBOSE(x)
|
#define VERBOSE(x)
|
||||||
|
|
||||||
@@ -401,3 +402,4 @@ gtk_icon_cache_validate (CacheInfo *info)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
+14
-40
@@ -51,7 +51,7 @@
|
|||||||
#include "gtkstyleproviderprivate.h"
|
#include "gtkstyleproviderprivate.h"
|
||||||
#include "gtksymbolicpaintable.h"
|
#include "gtksymbolicpaintable.h"
|
||||||
#include "gtkwidgetprivate.h"
|
#include "gtkwidgetprivate.h"
|
||||||
#include "gdkpixbufutilsprivate.h"
|
#include "gdktextureutilsprivate.h"
|
||||||
#include "gdk/gdktextureprivate.h"
|
#include "gdk/gdktextureprivate.h"
|
||||||
#include "gdk/gdkprofilerprivate.h"
|
#include "gdk/gdkprofilerprivate.h"
|
||||||
|
|
||||||
@@ -3747,22 +3747,15 @@ icon_ensure_texture__locked (GtkIconPaintable *icon,
|
|||||||
{
|
{
|
||||||
if (icon->is_svg)
|
if (icon->is_svg)
|
||||||
{
|
{
|
||||||
GdkPixbuf *source_pixbuf;
|
|
||||||
|
|
||||||
if (gtk_icon_paintable_is_symbolic (icon))
|
if (gtk_icon_paintable_is_symbolic (icon))
|
||||||
source_pixbuf = gtk_make_symbolic_pixbuf_from_resource (icon->filename,
|
icon->texture = gdk_texture_new_from_resource_symbolic (icon->filename,
|
||||||
pixel_size, pixel_size,
|
pixel_size, pixel_size,
|
||||||
icon->desired_scale,
|
icon->desired_scale,
|
||||||
&load_error);
|
&load_error);
|
||||||
else
|
else
|
||||||
source_pixbuf = _gdk_pixbuf_new_from_resource_at_scale (icon->filename,
|
icon->texture = gdk_texture_new_from_resource_at_scale (icon->filename,
|
||||||
pixel_size, pixel_size,
|
pixel_size, pixel_size,
|
||||||
TRUE, &load_error);
|
TRUE, &load_error);
|
||||||
if (source_pixbuf)
|
|
||||||
{
|
|
||||||
icon->texture = gdk_texture_new_for_pixbuf (source_pixbuf);
|
|
||||||
g_object_unref (source_pixbuf);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
icon->texture = gdk_texture_new_from_resource (icon->filename);
|
icon->texture = gdk_texture_new_from_resource (icon->filename);
|
||||||
@@ -3771,10 +3764,8 @@ icon_ensure_texture__locked (GtkIconPaintable *icon,
|
|||||||
{
|
{
|
||||||
if (icon->is_svg)
|
if (icon->is_svg)
|
||||||
{
|
{
|
||||||
GdkPixbuf *source_pixbuf;
|
|
||||||
|
|
||||||
if (gtk_icon_paintable_is_symbolic (icon))
|
if (gtk_icon_paintable_is_symbolic (icon))
|
||||||
source_pixbuf = gtk_make_symbolic_pixbuf_from_path (icon->filename,
|
icon->texture = gdk_texture_new_from_path_symbolic (icon->filename,
|
||||||
pixel_size, pixel_size,
|
pixel_size, pixel_size,
|
||||||
icon->desired_scale,
|
icon->desired_scale,
|
||||||
&load_error);
|
&load_error);
|
||||||
@@ -3783,22 +3774,16 @@ icon_ensure_texture__locked (GtkIconPaintable *icon,
|
|||||||
GFile *file = g_file_new_for_path (icon->filename);
|
GFile *file = g_file_new_for_path (icon->filename);
|
||||||
GInputStream *stream = G_INPUT_STREAM (g_file_read (file, NULL, &load_error));
|
GInputStream *stream = G_INPUT_STREAM (g_file_read (file, NULL, &load_error));
|
||||||
|
|
||||||
g_object_unref (file);
|
|
||||||
if (stream)
|
if (stream)
|
||||||
{
|
{
|
||||||
source_pixbuf = _gdk_pixbuf_new_from_stream_at_scale (stream,
|
icon->texture = gdk_texture_new_from_stream_at_scale (stream,
|
||||||
pixel_size, pixel_size,
|
pixel_size, pixel_size,
|
||||||
TRUE, NULL,
|
TRUE, NULL,
|
||||||
&load_error);
|
&load_error);
|
||||||
g_object_unref (stream);
|
g_object_unref (stream);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
source_pixbuf = NULL;
|
g_object_unref (file);
|
||||||
}
|
|
||||||
if (source_pixbuf)
|
|
||||||
{
|
|
||||||
icon->texture = gdk_texture_new_for_pixbuf (source_pixbuf);
|
|
||||||
g_object_unref (source_pixbuf);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -3809,35 +3794,24 @@ icon_ensure_texture__locked (GtkIconPaintable *icon,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
GInputStream *stream;
|
GInputStream *stream;
|
||||||
GdkPixbuf *source_pixbuf;
|
|
||||||
|
|
||||||
g_assert (icon->loadable);
|
g_assert (icon->loadable);
|
||||||
|
|
||||||
stream = g_loadable_icon_load (icon->loadable,
|
stream = g_loadable_icon_load (icon->loadable, pixel_size, NULL, NULL, &load_error);
|
||||||
pixel_size,
|
|
||||||
NULL, NULL,
|
|
||||||
&load_error);
|
|
||||||
if (stream)
|
if (stream)
|
||||||
{
|
{
|
||||||
/* SVG icons are a special case - we just immediately scale them
|
/* SVG icons are a special case - we just immediately scale them
|
||||||
* to the desired size
|
* to the desired size
|
||||||
*/
|
*/
|
||||||
if (icon->is_svg)
|
if (icon->is_svg)
|
||||||
{
|
icon->texture = gdk_texture_new_from_stream_at_scale (stream,
|
||||||
source_pixbuf = _gdk_pixbuf_new_from_stream_at_scale (stream,
|
pixel_size, pixel_size,
|
||||||
pixel_size, pixel_size,
|
TRUE, NULL,
|
||||||
TRUE, NULL,
|
&load_error);
|
||||||
&load_error);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
source_pixbuf = _gdk_pixbuf_new_from_stream (stream,
|
icon->texture = gdk_texture_new_from_stream (stream, NULL, &load_error);
|
||||||
NULL, &load_error);
|
|
||||||
g_object_unref (stream);
|
g_object_unref (stream);
|
||||||
if (source_pixbuf)
|
|
||||||
{
|
|
||||||
icon->texture = gdk_texture_new_for_pixbuf (source_pixbuf);
|
|
||||||
g_object_unref (source_pixbuf);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+8
-1
@@ -31,7 +31,7 @@
|
|||||||
#include "gtksnapshot.h"
|
#include "gtksnapshot.h"
|
||||||
#include "gtktypebuiltins.h"
|
#include "gtktypebuiltins.h"
|
||||||
#include "gtkwidgetprivate.h"
|
#include "gtkwidgetprivate.h"
|
||||||
#include "gdkpixbufutilsprivate.h"
|
#include "gdktextureutilsprivate.h"
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -475,6 +475,9 @@ gtk_image_new_from_resource (const char *resource_path)
|
|||||||
* want that, you should use [ctor@Gtk.Image.new_from_icon_name].
|
* want that, you should use [ctor@Gtk.Image.new_from_icon_name].
|
||||||
*
|
*
|
||||||
* Returns: a new `GtkImage`
|
* Returns: a new `GtkImage`
|
||||||
|
*
|
||||||
|
* Deprecated: 4.12: Use [ctor@Gtk.Image.new_from_paintable] and
|
||||||
|
* [ctor@Gdk.Texture.new_for_pixbuf] instead
|
||||||
*/
|
*/
|
||||||
GtkWidget*
|
GtkWidget*
|
||||||
gtk_image_new_from_pixbuf (GdkPixbuf *pixbuf)
|
gtk_image_new_from_pixbuf (GdkPixbuf *pixbuf)
|
||||||
@@ -483,7 +486,9 @@ gtk_image_new_from_pixbuf (GdkPixbuf *pixbuf)
|
|||||||
|
|
||||||
image = g_object_new (GTK_TYPE_IMAGE, NULL);
|
image = g_object_new (GTK_TYPE_IMAGE, NULL);
|
||||||
|
|
||||||
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||||
gtk_image_set_from_pixbuf (image, pixbuf);
|
gtk_image_set_from_pixbuf (image, pixbuf);
|
||||||
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
|
|
||||||
return GTK_WIDGET (image);
|
return GTK_WIDGET (image);
|
||||||
}
|
}
|
||||||
@@ -711,6 +716,8 @@ gtk_image_set_from_resource (GtkImage *image,
|
|||||||
* Note: This is a helper for [method@Gtk.Image.set_from_paintable],
|
* Note: This is a helper for [method@Gtk.Image.set_from_paintable],
|
||||||
* and you can't get back the exact pixbuf once this is called,
|
* and you can't get back the exact pixbuf once this is called,
|
||||||
* only a paintable.
|
* only a paintable.
|
||||||
|
*
|
||||||
|
* Deprecated: 4.12: Use [method@Gtk.Image.set_from_paintable] instead
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gtk_image_set_from_pixbuf (GtkImage *image,
|
gtk_image_set_from_pixbuf (GtkImage *image,
|
||||||
|
|||||||
+2
-2
@@ -74,7 +74,7 @@ GDK_AVAILABLE_IN_ALL
|
|||||||
GtkWidget* gtk_image_new_from_file (const char *filename);
|
GtkWidget* gtk_image_new_from_file (const char *filename);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GtkWidget* gtk_image_new_from_resource (const char *resource_path);
|
GtkWidget* gtk_image_new_from_resource (const char *resource_path);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_DEPRECATED_IN_4_12_FOR(gtk_image_new_from_paintable)
|
||||||
GtkWidget* gtk_image_new_from_pixbuf (GdkPixbuf *pixbuf);
|
GtkWidget* gtk_image_new_from_pixbuf (GdkPixbuf *pixbuf);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GtkWidget* gtk_image_new_from_paintable (GdkPaintable *paintable);
|
GtkWidget* gtk_image_new_from_paintable (GdkPaintable *paintable);
|
||||||
@@ -91,7 +91,7 @@ void gtk_image_set_from_file (GtkImage *image,
|
|||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
void gtk_image_set_from_resource (GtkImage *image,
|
void gtk_image_set_from_resource (GtkImage *image,
|
||||||
const char *resource_path);
|
const char *resource_path);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_DEPRECATED_IN_4_12_FOR(gtk_image_set_from_paintable)
|
||||||
void gtk_image_set_from_pixbuf (GtkImage *image,
|
void gtk_image_set_from_pixbuf (GtkImage *image,
|
||||||
GdkPixbuf *pixbuf);
|
GdkPixbuf *pixbuf);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
|||||||
+113
-70
@@ -198,7 +198,6 @@ gtk_list_item_manager_augment_node (GtkRbTree *tree,
|
|||||||
aug->has_footer = TRUE;
|
aug->has_footer = TRUE;
|
||||||
break;
|
break;
|
||||||
case GTK_LIST_TILE_ITEM:
|
case GTK_LIST_TILE_ITEM:
|
||||||
case GTK_LIST_TILE_FILLER:
|
|
||||||
case GTK_LIST_TILE_REMOVED:
|
case GTK_LIST_TILE_REMOVED:
|
||||||
aug->has_header = FALSE;
|
aug->has_header = FALSE;
|
||||||
aug->has_footer = FALSE;
|
aug->has_footer = FALSE;
|
||||||
@@ -569,8 +568,7 @@ gtk_list_tile_get_tile_at (GtkListItemManager *self,
|
|||||||
* If multiple tiles have the same distance, the one closest to the start
|
* If multiple tiles have the same distance, the one closest to the start
|
||||||
* will be returned.
|
* will be returned.
|
||||||
*
|
*
|
||||||
* Returns: (nullable): The tile nearest to (x, y) or NULL if there are no
|
* Returns: (nullable): The tile nearest to (x, y) or NULL if there are no tiles
|
||||||
* tile
|
|
||||||
**/
|
**/
|
||||||
GtkListTile *
|
GtkListTile *
|
||||||
gtk_list_item_manager_get_nearest_tile (GtkListItemManager *self,
|
gtk_list_item_manager_get_nearest_tile (GtkListItemManager *self,
|
||||||
@@ -597,7 +595,7 @@ gtk_list_tile_get_position (GtkListItemManager *self,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pos = 0;
|
pos = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (parent = gtk_rb_tree_node_get_parent (tile);
|
for (parent = gtk_rb_tree_node_get_parent (tile);
|
||||||
@@ -633,7 +631,7 @@ static GtkListTile *
|
|||||||
gtk_list_tile_get_next_skip (GtkListTile *tile)
|
gtk_list_tile_get_next_skip (GtkListTile *tile)
|
||||||
{
|
{
|
||||||
for (tile = gtk_rb_tree_node_get_next (tile);
|
for (tile = gtk_rb_tree_node_get_next (tile);
|
||||||
tile && (tile->type == GTK_LIST_TILE_FILLER || tile->type == GTK_LIST_TILE_REMOVED);
|
tile && tile->type == GTK_LIST_TILE_REMOVED;
|
||||||
tile = gtk_rb_tree_node_get_next (tile))
|
tile = gtk_rb_tree_node_get_next (tile))
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@@ -644,7 +642,7 @@ static GtkListTile *
|
|||||||
gtk_list_tile_get_previous_skip (GtkListTile *tile)
|
gtk_list_tile_get_previous_skip (GtkListTile *tile)
|
||||||
{
|
{
|
||||||
for (tile = gtk_rb_tree_node_get_previous (tile);
|
for (tile = gtk_rb_tree_node_get_previous (tile);
|
||||||
tile && (tile->type == GTK_LIST_TILE_FILLER || tile->type == GTK_LIST_TILE_REMOVED);
|
tile && tile->type == GTK_LIST_TILE_REMOVED;
|
||||||
tile = gtk_rb_tree_node_get_previous (tile))
|
tile = gtk_rb_tree_node_get_previous (tile))
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@@ -715,6 +713,7 @@ static void
|
|||||||
gtk_list_tile_set_type (GtkListTile *tile,
|
gtk_list_tile_set_type (GtkListTile *tile,
|
||||||
GtkListTileType type)
|
GtkListTileType type)
|
||||||
{
|
{
|
||||||
|
g_assert (tile != NULL);
|
||||||
if (tile->type == type)
|
if (tile->type == type)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -845,7 +844,8 @@ gtk_list_item_manager_remove_items (GtkListItemManager *self,
|
|||||||
if (offset)
|
if (offset)
|
||||||
tile = gtk_list_item_manager_ensure_split (self, tile, offset);
|
tile = gtk_list_item_manager_ensure_split (self, tile, offset);
|
||||||
header = gtk_list_tile_get_previous_skip (tile);
|
header = gtk_list_tile_get_previous_skip (tile);
|
||||||
if (header->type != GTK_LIST_TILE_HEADER && header->type != GTK_LIST_TILE_UNMATCHED_HEADER)
|
if (header != NULL &&
|
||||||
|
(header->type != GTK_LIST_TILE_HEADER && header->type != GTK_LIST_TILE_UNMATCHED_HEADER))
|
||||||
header = NULL;
|
header = NULL;
|
||||||
|
|
||||||
while (n_items > 0)
|
while (n_items > 0)
|
||||||
@@ -883,7 +883,6 @@ gtk_list_item_manager_remove_items (GtkListItemManager *self,
|
|||||||
gtk_list_tile_set_type (tile, GTK_LIST_TILE_REMOVED);
|
gtk_list_tile_set_type (tile, GTK_LIST_TILE_REMOVED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GTK_LIST_TILE_FILLER:
|
|
||||||
case GTK_LIST_TILE_REMOVED:
|
case GTK_LIST_TILE_REMOVED:
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
@@ -911,7 +910,7 @@ gtk_list_item_manager_add_items (GtkListItemManager *self,
|
|||||||
GtkListItemChange *change,
|
GtkListItemChange *change,
|
||||||
guint position,
|
guint position,
|
||||||
guint n_items)
|
guint n_items)
|
||||||
{
|
{
|
||||||
GtkListTile *tile;
|
GtkListTile *tile;
|
||||||
guint offset;
|
guint offset;
|
||||||
gboolean has_sections;
|
gboolean has_sections;
|
||||||
@@ -926,7 +925,7 @@ gtk_list_item_manager_add_items (GtkListItemManager *self,
|
|||||||
{
|
{
|
||||||
/* at end of list, pick the footer */
|
/* at end of list, pick the footer */
|
||||||
for (tile = gtk_rb_tree_get_last (self->items);
|
for (tile = gtk_rb_tree_get_last (self->items);
|
||||||
tile && (tile->type == GTK_LIST_TILE_REMOVED || tile->type == GTK_LIST_TILE_FILLER);
|
tile && tile->type == GTK_LIST_TILE_REMOVED;
|
||||||
tile = gtk_rb_tree_node_get_previous (tile))
|
tile = gtk_rb_tree_node_get_previous (tile))
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@@ -952,7 +951,7 @@ gtk_list_item_manager_add_items (GtkListItemManager *self,
|
|||||||
}
|
}
|
||||||
if (offset)
|
if (offset)
|
||||||
tile = gtk_list_item_manager_ensure_split (self, tile, offset);
|
tile = gtk_list_item_manager_ensure_split (self, tile, offset);
|
||||||
|
|
||||||
tile = gtk_rb_tree_insert_before (self->items, tile);
|
tile = gtk_rb_tree_insert_before (self->items, tile);
|
||||||
tile->type = GTK_LIST_TILE_ITEM;
|
tile->type = GTK_LIST_TILE_ITEM;
|
||||||
tile->n_items = n_items;
|
tile->n_items = n_items;
|
||||||
@@ -962,7 +961,7 @@ gtk_list_item_manager_add_items (GtkListItemManager *self,
|
|||||||
{
|
{
|
||||||
GtkListTile *section = gtk_list_tile_get_previous_skip (tile);
|
GtkListTile *section = gtk_list_tile_get_previous_skip (tile);
|
||||||
|
|
||||||
if (section->type == GTK_LIST_TILE_HEADER)
|
if (section != NULL && section->type == GTK_LIST_TILE_HEADER)
|
||||||
{
|
{
|
||||||
gtk_list_item_change_clear_header (change, §ion->widget);
|
gtk_list_item_change_clear_header (change, §ion->widget);
|
||||||
gtk_list_tile_set_type (section,
|
gtk_list_tile_set_type (section,
|
||||||
@@ -1000,11 +999,13 @@ gtk_list_item_manager_merge_list_items (GtkListItemManager *self,
|
|||||||
* Splits the given tile into two tiles. The original
|
* Splits the given tile into two tiles. The original
|
||||||
* tile will remain with @n_items items, the remaining
|
* tile will remain with @n_items items, the remaining
|
||||||
* items will be given to the new tile, which will be
|
* items will be given to the new tile, which will be
|
||||||
* nserted after the tile.
|
* inserted after the tile.
|
||||||
*
|
*
|
||||||
* It is not valid for either tile to have 0 items after
|
* It is not valid for either tile to have 0 items after
|
||||||
* the split.
|
* the split.
|
||||||
*
|
*
|
||||||
|
* This function does not update the tiles' areas.
|
||||||
|
*
|
||||||
* Returns: The new tile
|
* Returns: The new tile
|
||||||
**/
|
**/
|
||||||
GtkListTile *
|
GtkListTile *
|
||||||
@@ -1027,34 +1028,6 @@ gtk_list_tile_split (GtkListItemManager *self,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* gtk_list_tile_append_filler:
|
|
||||||
* @self: the listitemmanager
|
|
||||||
* @previous: tile to append to
|
|
||||||
*
|
|
||||||
* Appends a filler tile.
|
|
||||||
*
|
|
||||||
* Filler tiles don't refer to any items or header and exist
|
|
||||||
* just to take up space, so that finding items by position gets
|
|
||||||
* easier.
|
|
||||||
*
|
|
||||||
* They ave a special garbage-collection behavior, see
|
|
||||||
* gtk_list_tile_gc().
|
|
||||||
*
|
|
||||||
* Returns: The new filler tile
|
|
||||||
**/
|
|
||||||
GtkListTile *
|
|
||||||
gtk_list_tile_append_filler (GtkListItemManager *self,
|
|
||||||
GtkListTile *previous)
|
|
||||||
{
|
|
||||||
GtkListTile *result;
|
|
||||||
|
|
||||||
result = gtk_rb_tree_insert_after (self->items, previous);
|
|
||||||
result->type = GTK_LIST_TILE_FILLER;
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* gtk_list_tile_gc:
|
* gtk_list_tile_gc:
|
||||||
* @self: the listitemmanager
|
* @self: the listitemmanager
|
||||||
@@ -1066,13 +1039,9 @@ gtk_list_tile_append_filler (GtkListItemManager *self,
|
|||||||
*
|
*
|
||||||
* Note that this only looks forward, but never backward.
|
* Note that this only looks forward, but never backward.
|
||||||
*
|
*
|
||||||
* A special case here are filler tiles. They only get
|
|
||||||
* collected, when they are explicitly passed in, but never
|
|
||||||
* otherwise.
|
|
||||||
*
|
|
||||||
* Returns: The next tile or NULL if everything was gc'ed
|
* Returns: The next tile or NULL if everything was gc'ed
|
||||||
**/
|
**/
|
||||||
GtkListTile *
|
static GtkListTile *
|
||||||
gtk_list_tile_gc (GtkListItemManager *self,
|
gtk_list_tile_gc (GtkListItemManager *self,
|
||||||
GtkListTile *tile)
|
GtkListTile *tile)
|
||||||
{
|
{
|
||||||
@@ -1081,13 +1050,6 @@ gtk_list_tile_gc (GtkListItemManager *self,
|
|||||||
if (tile == NULL)
|
if (tile == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (tile->type == GTK_LIST_TILE_FILLER)
|
|
||||||
{
|
|
||||||
next = gtk_rb_tree_node_get_next (tile);
|
|
||||||
gtk_rb_tree_remove (self->items, tile);
|
|
||||||
tile = next;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (tile)
|
while (tile)
|
||||||
{
|
{
|
||||||
next = gtk_rb_tree_node_get_next (tile);
|
next = gtk_rb_tree_node_get_next (tile);
|
||||||
@@ -1111,7 +1073,6 @@ gtk_list_tile_gc (GtkListItemManager *self,
|
|||||||
case GTK_LIST_TILE_FOOTER:
|
case GTK_LIST_TILE_FOOTER:
|
||||||
case GTK_LIST_TILE_UNMATCHED_HEADER:
|
case GTK_LIST_TILE_UNMATCHED_HEADER:
|
||||||
case GTK_LIST_TILE_UNMATCHED_FOOTER:
|
case GTK_LIST_TILE_UNMATCHED_FOOTER:
|
||||||
case GTK_LIST_TILE_FILLER:
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GTK_LIST_TILE_REMOVED:
|
case GTK_LIST_TILE_REMOVED:
|
||||||
@@ -1130,6 +1091,27 @@ gtk_list_tile_gc (GtkListItemManager *self,
|
|||||||
return tile;
|
return tile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gtk_list_item_manager_gc_tiles:
|
||||||
|
* @self: the listitemmanager
|
||||||
|
*
|
||||||
|
* Removes all tiles of type GTK_LIST_TILE_REMOVED
|
||||||
|
* and merges item tiles as much as possible.
|
||||||
|
*
|
||||||
|
* This function does not update the tiles' areas.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gtk_list_item_manager_gc_tiles (GtkListItemManager *self)
|
||||||
|
{
|
||||||
|
GtkListTile *tile;
|
||||||
|
|
||||||
|
for (tile = gtk_list_tile_gc (self, gtk_list_item_manager_get_first (self));
|
||||||
|
tile != NULL;
|
||||||
|
tile = gtk_list_tile_gc (self, gtk_rb_tree_node_get_next (tile)))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_list_item_manager_release_items (GtkListItemManager *self,
|
gtk_list_item_manager_release_items (GtkListItemManager *self,
|
||||||
GtkListItemChange *change)
|
GtkListItemChange *change)
|
||||||
@@ -1178,7 +1160,6 @@ gtk_list_item_manager_release_items (GtkListItemManager *self,
|
|||||||
deleted_section = TRUE;
|
deleted_section = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GTK_LIST_TILE_FILLER:
|
|
||||||
case GTK_LIST_TILE_REMOVED:
|
case GTK_LIST_TILE_REMOVED:
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
@@ -1207,7 +1188,7 @@ gtk_list_item_manager_insert_section (GtkListItemManager *self,
|
|||||||
{
|
{
|
||||||
GtkListTile *tile, *footer, *header;
|
GtkListTile *tile, *footer, *header;
|
||||||
guint offset;
|
guint offset;
|
||||||
|
|
||||||
tile = gtk_list_item_manager_get_nth (self, pos, &offset);
|
tile = gtk_list_item_manager_get_nth (self, pos, &offset);
|
||||||
if (tile == NULL)
|
if (tile == NULL)
|
||||||
{
|
{
|
||||||
@@ -1225,7 +1206,8 @@ gtk_list_item_manager_insert_section (GtkListItemManager *self,
|
|||||||
tile = gtk_list_item_manager_ensure_split (self, tile, offset);
|
tile = gtk_list_item_manager_ensure_split (self, tile, offset);
|
||||||
|
|
||||||
header = gtk_list_tile_get_previous_skip (tile);
|
header = gtk_list_tile_get_previous_skip (tile);
|
||||||
if (header->type == GTK_LIST_TILE_HEADER || header->type == GTK_LIST_TILE_UNMATCHED_HEADER)
|
if (header != NULL &&
|
||||||
|
(header->type == GTK_LIST_TILE_HEADER || header->type == GTK_LIST_TILE_UNMATCHED_HEADER))
|
||||||
{
|
{
|
||||||
if (header_type == GTK_LIST_TILE_HEADER)
|
if (header_type == GTK_LIST_TILE_HEADER)
|
||||||
gtk_list_tile_set_type (header, header_type);
|
gtk_list_tile_set_type (header, header_type);
|
||||||
@@ -1257,7 +1239,7 @@ gtk_list_tile_find_widget_before (GtkListTile *tile)
|
|||||||
for (other = gtk_rb_tree_node_get_previous (tile);
|
for (other = gtk_rb_tree_node_get_previous (tile);
|
||||||
other;
|
other;
|
||||||
other = gtk_rb_tree_node_get_previous (other))
|
other = gtk_rb_tree_node_get_previous (other))
|
||||||
{
|
{
|
||||||
if (other->widget)
|
if (other->widget)
|
||||||
return other->widget;
|
return other->widget;
|
||||||
}
|
}
|
||||||
@@ -1411,7 +1393,6 @@ gtk_list_item_manager_ensure_items (GtkListItemManager *self,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case GTK_LIST_TILE_UNMATCHED_FOOTER:
|
case GTK_LIST_TILE_UNMATCHED_FOOTER:
|
||||||
case GTK_LIST_TILE_FILLER:
|
|
||||||
case GTK_LIST_TILE_REMOVED:
|
case GTK_LIST_TILE_REMOVED:
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
@@ -1460,7 +1441,7 @@ gtk_list_item_manager_model_items_changed_cb (GListModel *model,
|
|||||||
GtkListTile *tile, *new_tile;
|
GtkListTile *tile, *new_tile;
|
||||||
GtkWidget *insert_after;
|
GtkWidget *insert_after;
|
||||||
guint i, offset;
|
guint i, offset;
|
||||||
|
|
||||||
tile = gtk_list_item_manager_get_nth (self, position, &offset);
|
tile = gtk_list_item_manager_get_nth (self, position, &offset);
|
||||||
for (new_tile = tile ? gtk_rb_tree_node_get_previous (tile) : gtk_rb_tree_get_last (self->items);
|
for (new_tile = tile ? gtk_rb_tree_node_get_previous (tile) : gtk_rb_tree_get_last (self->items);
|
||||||
new_tile && new_tile->widget == NULL;
|
new_tile && new_tile->widget == NULL;
|
||||||
@@ -1576,7 +1557,7 @@ gtk_list_item_manager_model_items_changed_cb (GListModel *model,
|
|||||||
GtkListItemTracker *tracker = l->data;
|
GtkListItemTracker *tracker = l->data;
|
||||||
GtkListTile *tile;
|
GtkListTile *tile;
|
||||||
|
|
||||||
if (tracker->widget != NULL ||
|
if (tracker->widget != NULL ||
|
||||||
tracker->position == GTK_INVALID_LIST_POSITION)
|
tracker->position == GTK_INVALID_LIST_POSITION)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1591,6 +1572,67 @@ gtk_list_item_manager_model_items_changed_cb (GListModel *model,
|
|||||||
gtk_widget_queue_resize (self->widget);
|
gtk_widget_queue_resize (self->widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_list_item_manager_model_sections_changed_cb (GListModel *model,
|
||||||
|
guint position,
|
||||||
|
guint n_items,
|
||||||
|
GtkListItemManager *self)
|
||||||
|
{
|
||||||
|
GtkListItemChange change;
|
||||||
|
GtkListTile *tile, *header;
|
||||||
|
guint offset;
|
||||||
|
|
||||||
|
if (!gtk_list_item_manager_has_sections (self))
|
||||||
|
return;
|
||||||
|
|
||||||
|
gtk_list_item_change_init (&change);
|
||||||
|
|
||||||
|
tile = gtk_list_item_manager_get_nth (self, position, &offset);
|
||||||
|
header = gtk_list_tile_get_header (self, tile);
|
||||||
|
gtk_list_item_change_clear_header (&change, &header->widget);
|
||||||
|
gtk_list_tile_set_type (header, GTK_LIST_TILE_UNMATCHED_HEADER);
|
||||||
|
|
||||||
|
n_items -= MIN (n_items, position - offset);
|
||||||
|
while (n_items > 0)
|
||||||
|
{
|
||||||
|
switch (tile->type)
|
||||||
|
{
|
||||||
|
case GTK_LIST_TILE_HEADER:
|
||||||
|
case GTK_LIST_TILE_UNMATCHED_HEADER:
|
||||||
|
gtk_list_item_change_clear_header (&change, &tile->widget);
|
||||||
|
gtk_list_tile_set_type (tile, GTK_LIST_TILE_REMOVED);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GTK_LIST_TILE_FOOTER:
|
||||||
|
case GTK_LIST_TILE_UNMATCHED_FOOTER:
|
||||||
|
gtk_list_tile_set_type (tile, GTK_LIST_TILE_REMOVED);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GTK_LIST_TILE_ITEM:
|
||||||
|
n_items -= MIN (n_items, tile->n_items);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GTK_LIST_TILE_REMOVED:
|
||||||
|
default:
|
||||||
|
g_assert_not_reached ();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
tile = gtk_list_tile_get_next_skip (tile);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!gtk_list_tile_is_footer (tile))
|
||||||
|
tile = gtk_list_tile_get_footer (self, tile);
|
||||||
|
|
||||||
|
gtk_list_tile_set_type (tile, GTK_LIST_TILE_UNMATCHED_FOOTER);
|
||||||
|
|
||||||
|
gtk_list_item_manager_ensure_items (self, &change, G_MAXUINT, 0);
|
||||||
|
|
||||||
|
gtk_list_item_change_finish (&change);
|
||||||
|
|
||||||
|
gtk_widget_queue_resize (GTK_WIDGET (self->widget));
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_list_item_manager_model_selection_changed_cb (GListModel *model,
|
gtk_list_item_manager_model_selection_changed_cb (GListModel *model,
|
||||||
guint position,
|
guint position,
|
||||||
@@ -1631,7 +1673,6 @@ static void
|
|||||||
gtk_list_item_manager_clear_model (GtkListItemManager *self)
|
gtk_list_item_manager_clear_model (GtkListItemManager *self)
|
||||||
{
|
{
|
||||||
GtkListItemChange change;
|
GtkListItemChange change;
|
||||||
GtkListTile *tile;
|
|
||||||
GSList *l;
|
GSList *l;
|
||||||
|
|
||||||
if (self->model == NULL)
|
if (self->model == NULL)
|
||||||
@@ -1651,15 +1692,13 @@ gtk_list_item_manager_clear_model (GtkListItemManager *self)
|
|||||||
g_signal_handlers_disconnect_by_func (self->model,
|
g_signal_handlers_disconnect_by_func (self->model,
|
||||||
gtk_list_item_manager_model_items_changed_cb,
|
gtk_list_item_manager_model_items_changed_cb,
|
||||||
self);
|
self);
|
||||||
|
g_signal_handlers_disconnect_by_func (self->model,
|
||||||
|
gtk_list_item_manager_model_sections_changed_cb,
|
||||||
|
self);
|
||||||
g_clear_object (&self->model);
|
g_clear_object (&self->model);
|
||||||
|
|
||||||
/* really empty the tiles */
|
gtk_list_item_manager_gc_tiles (self);
|
||||||
for (tile = gtk_list_tile_gc (self, gtk_list_item_manager_get_first (self));
|
|
||||||
tile;
|
|
||||||
tile = gtk_list_tile_gc (self, tile))
|
|
||||||
{
|
|
||||||
g_assert (tile->type == GTK_LIST_TILE_FILLER);
|
|
||||||
}
|
|
||||||
g_assert (gtk_rb_tree_get_root (self->items) == NULL);
|
g_assert (gtk_rb_tree_get_root (self->items) == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1714,6 +1753,11 @@ gtk_list_item_manager_set_model (GtkListItemManager *self,
|
|||||||
"selection-changed",
|
"selection-changed",
|
||||||
G_CALLBACK (gtk_list_item_manager_model_selection_changed_cb),
|
G_CALLBACK (gtk_list_item_manager_model_selection_changed_cb),
|
||||||
self);
|
self);
|
||||||
|
if (GTK_IS_SECTION_MODEL (model))
|
||||||
|
g_signal_connect (model,
|
||||||
|
"sections-changed",
|
||||||
|
G_CALLBACK (gtk_list_item_manager_model_sections_changed_cb),
|
||||||
|
self);
|
||||||
|
|
||||||
gtk_list_item_change_init (&change);
|
gtk_list_item_change_init (&change);
|
||||||
gtk_list_item_manager_add_items (self, &change, 0, g_list_model_get_n_items (G_LIST_MODEL (model)));
|
gtk_list_item_manager_add_items (self, &change, 0, g_list_model_get_n_items (G_LIST_MODEL (model)));
|
||||||
@@ -1772,7 +1816,6 @@ gtk_list_item_manager_set_has_sections (GtkListItemManager *self,
|
|||||||
footer = tile;
|
footer = tile;
|
||||||
break;
|
break;
|
||||||
case GTK_LIST_TILE_ITEM:
|
case GTK_LIST_TILE_ITEM:
|
||||||
case GTK_LIST_TILE_FILLER:
|
|
||||||
case GTK_LIST_TILE_REMOVED:
|
case GTK_LIST_TILE_REMOVED:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ typedef enum
|
|||||||
GTK_LIST_TILE_FOOTER,
|
GTK_LIST_TILE_FOOTER,
|
||||||
GTK_LIST_TILE_UNMATCHED_HEADER,
|
GTK_LIST_TILE_UNMATCHED_HEADER,
|
||||||
GTK_LIST_TILE_UNMATCHED_FOOTER,
|
GTK_LIST_TILE_UNMATCHED_FOOTER,
|
||||||
GTK_LIST_TILE_FILLER,
|
|
||||||
GTK_LIST_TILE_REMOVED,
|
GTK_LIST_TILE_REMOVED,
|
||||||
} GtkListTileType;
|
} GtkListTileType;
|
||||||
|
|
||||||
@@ -60,7 +59,7 @@ struct _GtkListTile
|
|||||||
GtkListTileType type;
|
GtkListTileType type;
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
guint n_items;
|
guint n_items;
|
||||||
/* area occupied by tile. May be empty if tile has no allcoation */
|
/* area occupied by tile. May be empty if tile has no allocation */
|
||||||
cairo_rectangle_int_t area;
|
cairo_rectangle_int_t area;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -95,7 +94,19 @@ gpointer gtk_list_item_manager_get_nth (GtkListItemMana
|
|||||||
GtkListTile * gtk_list_item_manager_get_nearest_tile (GtkListItemManager *self,
|
GtkListTile * gtk_list_item_manager_get_nearest_tile (GtkListItemManager *self,
|
||||||
int x,
|
int x,
|
||||||
int y);
|
int y);
|
||||||
|
void gtk_list_item_manager_gc_tiles (GtkListItemManager *self);
|
||||||
|
|
||||||
|
static inline gboolean
|
||||||
|
gtk_list_tile_is_header (GtkListTile *tile)
|
||||||
|
{
|
||||||
|
return tile->type == GTK_LIST_TILE_HEADER || tile->type == GTK_LIST_TILE_UNMATCHED_HEADER;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline gboolean
|
||||||
|
gtk_list_tile_is_footer (GtkListTile *tile)
|
||||||
|
{
|
||||||
|
return tile->type == GTK_LIST_TILE_FOOTER || tile->type == GTK_LIST_TILE_UNMATCHED_FOOTER;
|
||||||
|
}
|
||||||
|
|
||||||
guint gtk_list_tile_get_position (GtkListItemManager *self,
|
guint gtk_list_tile_get_position (GtkListItemManager *self,
|
||||||
GtkListTile *tile);
|
GtkListTile *tile);
|
||||||
@@ -116,10 +127,6 @@ void gtk_list_tile_set_area_size (GtkListItemMana
|
|||||||
GtkListTile * gtk_list_tile_split (GtkListItemManager *self,
|
GtkListTile * gtk_list_tile_split (GtkListItemManager *self,
|
||||||
GtkListTile *tile,
|
GtkListTile *tile,
|
||||||
guint n_items);
|
guint n_items);
|
||||||
GtkListTile * gtk_list_tile_append_filler (GtkListItemManager *self,
|
|
||||||
GtkListTile *previous);
|
|
||||||
GtkListTile * gtk_list_tile_gc (GtkListItemManager *self,
|
|
||||||
GtkListTile *tile);
|
|
||||||
|
|
||||||
void gtk_list_item_manager_set_model (GtkListItemManager *self,
|
void gtk_list_item_manager_set_model (GtkListItemManager *self,
|
||||||
GtkSelectionModel *model);
|
GtkSelectionModel *model);
|
||||||
|
|||||||
+7
-3
@@ -235,7 +235,6 @@ gtk_list_view_update_factories_with (GtkListView *self,
|
|||||||
case GTK_LIST_TILE_UNMATCHED_HEADER:
|
case GTK_LIST_TILE_UNMATCHED_HEADER:
|
||||||
case GTK_LIST_TILE_FOOTER:
|
case GTK_LIST_TILE_FOOTER:
|
||||||
case GTK_LIST_TILE_UNMATCHED_FOOTER:
|
case GTK_LIST_TILE_UNMATCHED_FOOTER:
|
||||||
case GTK_LIST_TILE_FILLER:
|
|
||||||
case GTK_LIST_TILE_REMOVED:
|
case GTK_LIST_TILE_REMOVED:
|
||||||
g_assert (tile->widget == NULL);
|
g_assert (tile->widget == NULL);
|
||||||
break;
|
break;
|
||||||
@@ -609,8 +608,10 @@ gtk_list_view_size_allocate (GtkWidget *widget,
|
|||||||
opposite_scroll_policy = gtk_list_base_get_scroll_policy (GTK_LIST_BASE (self), opposite_orientation);
|
opposite_scroll_policy = gtk_list_base_get_scroll_policy (GTK_LIST_BASE (self), opposite_orientation);
|
||||||
gtk_list_base_get_border_spacing (GTK_LIST_BASE (self), NULL, &spacing);
|
gtk_list_base_get_border_spacing (GTK_LIST_BASE (self), NULL, &spacing);
|
||||||
|
|
||||||
|
gtk_list_item_manager_gc_tiles (self->item_manager);
|
||||||
|
|
||||||
/* step 0: exit early if list is empty */
|
/* step 0: exit early if list is empty */
|
||||||
tile = gtk_list_tile_gc (self->item_manager, gtk_list_item_manager_get_first (self->item_manager));
|
tile = gtk_list_item_manager_get_first (self->item_manager);
|
||||||
if (tile == NULL)
|
if (tile == NULL)
|
||||||
{
|
{
|
||||||
gtk_list_base_allocate (GTK_LIST_BASE (self));
|
gtk_list_base_allocate (GTK_LIST_BASE (self));
|
||||||
@@ -632,7 +633,7 @@ gtk_list_view_size_allocate (GtkWidget *widget,
|
|||||||
|
|
||||||
for (;
|
for (;
|
||||||
tile != NULL;
|
tile != NULL;
|
||||||
tile = gtk_list_tile_gc (self->item_manager, gtk_rb_tree_node_get_next (tile)))
|
tile = gtk_rb_tree_node_get_next (tile))
|
||||||
{
|
{
|
||||||
if (tile->widget == NULL)
|
if (tile->widget == NULL)
|
||||||
continue;
|
continue;
|
||||||
@@ -726,6 +727,9 @@ gtk_list_view_dispose (GObject *object)
|
|||||||
|
|
||||||
self->item_manager = NULL;
|
self->item_manager = NULL;
|
||||||
|
|
||||||
|
g_clear_object (&self->factory);
|
||||||
|
g_clear_object (&self->header_factory);
|
||||||
|
|
||||||
G_OBJECT_CLASS (gtk_list_view_parent_class)->dispose (object);
|
G_OBJECT_CLASS (gtk_list_view_parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,12 +42,11 @@ BOOLEAN:OBJECT,OBJECT,OBJECT
|
|||||||
BOOLEAN:STRING
|
BOOLEAN:STRING
|
||||||
BOOLEAN:UINT,UINT,FLAGS
|
BOOLEAN:UINT,UINT,FLAGS
|
||||||
BOOLEAN:VOID
|
BOOLEAN:VOID
|
||||||
ENUM:OBJECT,DOUBLE,DOUBLE
|
FLAGS:OBJECT,DOUBLE,DOUBLE
|
||||||
FLAGS:DOUBLE,DOUBLE
|
FLAGS:DOUBLE,DOUBLE
|
||||||
INT:INT
|
INT:INT
|
||||||
INT:OBJECT,OBJECT,POINTER
|
INT:OBJECT,OBJECT,POINTER
|
||||||
INT:POINTER
|
INT:POINTER
|
||||||
OBJECT:BOOLEAN
|
|
||||||
OBJECT:DOUBLE,DOUBLE
|
OBJECT:DOUBLE,DOUBLE
|
||||||
OBJECT:OBJECT
|
OBJECT:OBJECT
|
||||||
OBJECT:VOID
|
OBJECT:VOID
|
||||||
|
|||||||
+6
-3
@@ -1094,6 +1094,7 @@ gtk_menu_button_get_icon_name (GtkMenuButton *menu_button)
|
|||||||
* gtk_menu_button_set_always_show_arrow: (attributes org.gtk.Method.set_property=always-show-arrow)
|
* gtk_menu_button_set_always_show_arrow: (attributes org.gtk.Method.set_property=always-show-arrow)
|
||||||
* @menu_button: a `GtkMenuButton`
|
* @menu_button: a `GtkMenuButton`
|
||||||
* @always_show_arrow: whether to show a dropdown arrow even when using an icon
|
* @always_show_arrow: whether to show a dropdown arrow even when using an icon
|
||||||
|
* or a custom child
|
||||||
*
|
*
|
||||||
* Sets whether to show a dropdown arrow even when using an icon or a custom
|
* Sets whether to show a dropdown arrow even when using an icon or a custom
|
||||||
* child.
|
* child.
|
||||||
@@ -1122,9 +1123,11 @@ gtk_menu_button_set_always_show_arrow (GtkMenuButton *menu_button,
|
|||||||
* gtk_menu_button_get_always_show_arrow: (attributes org.gtk.Method.get_property=always-show-arrow)
|
* gtk_menu_button_get_always_show_arrow: (attributes org.gtk.Method.get_property=always-show-arrow)
|
||||||
* @menu_button: a `GtkMenuButton`
|
* @menu_button: a `GtkMenuButton`
|
||||||
*
|
*
|
||||||
* Gets whether to show a dropdown arrow even when using an icon.
|
* Gets whether to show a dropdown arrow even when using an icon or a custom
|
||||||
|
* child.
|
||||||
*
|
*
|
||||||
* Returns: whether to show a dropdown arrow even when using an icon
|
* Returns: whether to show a dropdown arrow even when using an icon or a custom
|
||||||
|
* child.
|
||||||
*
|
*
|
||||||
* Since: 4.4
|
* Since: 4.4
|
||||||
*/
|
*/
|
||||||
@@ -1554,7 +1557,7 @@ gtk_menu_button_get_child (GtkMenuButton *menu_button)
|
|||||||
* @menu_button: a `GtkMenuButton`
|
* @menu_button: a `GtkMenuButton`
|
||||||
* @active: whether the menu button is active
|
* @active: whether the menu button is active
|
||||||
*
|
*
|
||||||
* Sets whether menu button acts is active.
|
* Sets whether the menu button is active.
|
||||||
*
|
*
|
||||||
* Since: 4.10
|
* Since: 4.10
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -664,7 +664,7 @@ gtk_menu_section_box_new_section (GtkMenuTrackerItem *item,
|
|||||||
gtk_orientable_set_orientation (GTK_ORIENTABLE (box->item_box), GTK_ORIENTATION_HORIZONTAL);
|
gtk_orientable_set_orientation (GTK_ORIENTABLE (box->item_box), GTK_ORIENTATION_HORIZONTAL);
|
||||||
gtk_widget_add_css_class (GTK_WIDGET (box->item_box), "inline-buttons");
|
gtk_widget_add_css_class (GTK_WIDGET (box->item_box), "inline-buttons");
|
||||||
|
|
||||||
spacer = gtk_builtin_icon_new ("none");
|
spacer = gtk_gizmo_new ("none", NULL, NULL, NULL,NULL, NULL, NULL);
|
||||||
gtk_box_append (GTK_BOX (box->item_box), spacer);
|
gtk_box_append (GTK_BOX (box->item_box), spacer);
|
||||||
gtk_size_group_add_widget (box->indicators, spacer);
|
gtk_size_group_add_widget (box->indicators, spacer);
|
||||||
|
|
||||||
|
|||||||
@@ -291,6 +291,17 @@ gtk_multi_selection_items_changed_cb (GListModel *model,
|
|||||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_ITEMS]);
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_ITEMS]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_multi_selection_sections_changed_cb (GtkSectionModel *model,
|
||||||
|
unsigned int position,
|
||||||
|
unsigned int n_items,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
GtkMultiSelection *self = GTK_MULTI_SELECTION (user_data);
|
||||||
|
|
||||||
|
gtk_section_model_sections_changed (GTK_SECTION_MODEL (self), position, n_items);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_multi_selection_clear_model (GtkMultiSelection *self)
|
gtk_multi_selection_clear_model (GtkMultiSelection *self)
|
||||||
{
|
{
|
||||||
@@ -300,6 +311,9 @@ gtk_multi_selection_clear_model (GtkMultiSelection *self)
|
|||||||
g_signal_handlers_disconnect_by_func (self->model,
|
g_signal_handlers_disconnect_by_func (self->model,
|
||||||
gtk_multi_selection_items_changed_cb,
|
gtk_multi_selection_items_changed_cb,
|
||||||
self);
|
self);
|
||||||
|
g_signal_handlers_disconnect_by_func (self->model,
|
||||||
|
gtk_multi_selection_sections_changed_cb,
|
||||||
|
self);
|
||||||
g_clear_object (&self->model);
|
g_clear_object (&self->model);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -490,6 +504,9 @@ gtk_multi_selection_set_model (GtkMultiSelection *self,
|
|||||||
"items-changed",
|
"items-changed",
|
||||||
G_CALLBACK (gtk_multi_selection_items_changed_cb),
|
G_CALLBACK (gtk_multi_selection_items_changed_cb),
|
||||||
self);
|
self);
|
||||||
|
if (GTK_IS_SECTION_MODEL (self->model))
|
||||||
|
g_signal_connect (self->model, "sections-changed",
|
||||||
|
G_CALLBACK (gtk_multi_selection_sections_changed_cb), self);
|
||||||
gtk_multi_selection_items_changed_cb (self->model,
|
gtk_multi_selection_items_changed_cb (self->model,
|
||||||
0,
|
0,
|
||||||
n_items_before,
|
n_items_before,
|
||||||
|
|||||||
+20
-1
@@ -33,6 +33,8 @@
|
|||||||
*
|
*
|
||||||
* This model is meant to be used as a simple wrapper around a `GListModel`
|
* This model is meant to be used as a simple wrapper around a `GListModel`
|
||||||
* when a `GtkSelectionModel` is required.
|
* when a `GtkSelectionModel` is required.
|
||||||
|
*
|
||||||
|
* `GtkNoSelection` passes through sections from the underlying model.
|
||||||
*/
|
*/
|
||||||
struct _GtkNoSelection
|
struct _GtkNoSelection
|
||||||
{
|
{
|
||||||
@@ -152,15 +154,29 @@ gtk_no_selection_items_changed_cb (GListModel *model,
|
|||||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_ITEMS]);
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_ITEMS]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_no_selection_sections_changed_cb (GtkSectionModel *model,
|
||||||
|
unsigned int position,
|
||||||
|
unsigned int n_items,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
GtkNoSelection *self = GTK_NO_SELECTION (user_data);
|
||||||
|
|
||||||
|
gtk_section_model_sections_changed (GTK_SECTION_MODEL (self), position, n_items);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_no_selection_clear_model (GtkNoSelection *self)
|
gtk_no_selection_clear_model (GtkNoSelection *self)
|
||||||
{
|
{
|
||||||
if (self->model == NULL)
|
if (self->model == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_signal_handlers_disconnect_by_func (self->model,
|
g_signal_handlers_disconnect_by_func (self->model,
|
||||||
gtk_no_selection_items_changed_cb,
|
gtk_no_selection_items_changed_cb,
|
||||||
self);
|
self);
|
||||||
|
g_signal_handlers_disconnect_by_func (self->model,
|
||||||
|
gtk_no_selection_sections_changed_cb,
|
||||||
|
self);
|
||||||
g_clear_object (&self->model);
|
g_clear_object (&self->model);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -345,6 +361,9 @@ gtk_no_selection_set_model (GtkNoSelection *self,
|
|||||||
self->model = g_object_ref (model);
|
self->model = g_object_ref (model);
|
||||||
g_signal_connect (self->model, "items-changed",
|
g_signal_connect (self->model, "items-changed",
|
||||||
G_CALLBACK (gtk_no_selection_items_changed_cb), self);
|
G_CALLBACK (gtk_no_selection_items_changed_cb), self);
|
||||||
|
if (GTK_IS_SECTION_MODEL (self->model))
|
||||||
|
g_signal_connect (self->model, "sections-changed",
|
||||||
|
G_CALLBACK (gtk_no_selection_sections_changed_cb), self);
|
||||||
n_items_after = g_list_model_get_n_items (self->model);
|
n_items_after = g_list_model_get_n_items (self->model);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
+49
-5
@@ -46,6 +46,7 @@
|
|||||||
#include "gtkorientable.h"
|
#include "gtkorientable.h"
|
||||||
#include "gtksizerequest.h"
|
#include "gtksizerequest.h"
|
||||||
#include "gtkprivate.h"
|
#include "gtkprivate.h"
|
||||||
|
#include "gtkselectionmodel.h"
|
||||||
#include "gtkstack.h"
|
#include "gtkstack.h"
|
||||||
#include "gtktypebuiltins.h"
|
#include "gtktypebuiltins.h"
|
||||||
#include "gtkwidgetprivate.h"
|
#include "gtkwidgetprivate.h"
|
||||||
@@ -1172,7 +1173,7 @@ gtk_notebook_class_init (GtkNotebookClass *class)
|
|||||||
*
|
*
|
||||||
* A selection model with the pages.
|
* A selection model with the pages.
|
||||||
*/
|
*/
|
||||||
properties[PROP_PAGES] =
|
properties[PROP_PAGES] =
|
||||||
g_param_spec_object ("pages", NULL, NULL,
|
g_param_spec_object ("pages", NULL, NULL,
|
||||||
G_TYPE_LIST_MODEL,
|
G_TYPE_LIST_MODEL,
|
||||||
GTK_PARAM_READABLE);
|
GTK_PARAM_READABLE);
|
||||||
@@ -1358,7 +1359,7 @@ gtk_notebook_class_init (GtkNotebookClass *class)
|
|||||||
/**
|
/**
|
||||||
* GtkNotebook|menu.popup:
|
* GtkNotebook|menu.popup:
|
||||||
*
|
*
|
||||||
* Opens the context menu.
|
* Opens the context menu.
|
||||||
*/
|
*/
|
||||||
gtk_widget_class_install_action (widget_class, "menu.popup", NULL, gtk_notebook_popup_menu);
|
gtk_widget_class_install_action (widget_class, "menu.popup", NULL, gtk_notebook_popup_menu);
|
||||||
|
|
||||||
@@ -1827,7 +1828,7 @@ gtk_notebook_reorder_tab (GtkNotebook *notebook,
|
|||||||
page_num = reorder_tab (notebook, child->next, notebook->focus_tab);
|
page_num = reorder_tab (notebook, child->next, notebook->focus_tab);
|
||||||
else
|
else
|
||||||
page_num = reorder_tab (notebook, child, notebook->focus_tab);
|
page_num = reorder_tab (notebook, child, notebook->focus_tab);
|
||||||
|
|
||||||
gtk_notebook_child_reordered (notebook, notebook->focus_tab->data);
|
gtk_notebook_child_reordered (notebook, notebook->focus_tab->data);
|
||||||
for (element = notebook->children, i = 0; element; element = element->next, i++)
|
for (element = notebook->children, i = 0; element; element = element->next, i++)
|
||||||
{
|
{
|
||||||
@@ -7131,7 +7132,7 @@ gtk_notebook_get_page (GtkNotebook *notebook,
|
|||||||
list = gtk_notebook_find_child (notebook, child);
|
list = gtk_notebook_find_child (notebook, child);
|
||||||
if (list != NULL)
|
if (list != NULL)
|
||||||
page = list->data;
|
page = list->data;
|
||||||
|
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7197,8 +7198,51 @@ gtk_notebook_pages_list_model_init (GListModelInterface *iface)
|
|||||||
iface->get_n_items = gtk_notebook_pages_get_n_items;
|
iface->get_n_items = gtk_notebook_pages_get_n_items;
|
||||||
iface->get_item = gtk_notebook_pages_get_item;
|
iface->get_item = gtk_notebook_pages_get_item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gtk_notebook_pages_is_selected (GtkSelectionModel *model,
|
||||||
|
guint position)
|
||||||
|
{
|
||||||
|
GtkNotebookPages *pages = GTK_NOTEBOOK_PAGES (model);
|
||||||
|
GtkNotebookPage *page;
|
||||||
|
|
||||||
|
page = g_list_nth_data (pages->notebook->children, position);
|
||||||
|
if (page == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return page == pages->notebook->cur_page;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gtk_notebook_pages_select_item (GtkSelectionModel *model,
|
||||||
|
guint position,
|
||||||
|
gboolean exclusive)
|
||||||
|
{
|
||||||
|
GtkNotebookPages *pages = GTK_NOTEBOOK_PAGES (model);
|
||||||
|
GtkNotebookPage *page;
|
||||||
|
|
||||||
|
page = g_list_nth_data (pages->notebook->children, position);
|
||||||
|
if (page == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (page == pages->notebook->cur_page)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
gtk_notebook_switch_page (pages->notebook, page);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_notebook_pages_selection_model_init (GtkSelectionModelInterface *iface)
|
||||||
|
{
|
||||||
|
iface->is_selected = gtk_notebook_pages_is_selected;
|
||||||
|
iface->select_item = gtk_notebook_pages_select_item;
|
||||||
|
}
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (GtkNotebookPages, gtk_notebook_pages, G_TYPE_OBJECT,
|
G_DEFINE_TYPE_WITH_CODE (GtkNotebookPages, gtk_notebook_pages, G_TYPE_OBJECT,
|
||||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, gtk_notebook_pages_list_model_init))
|
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, gtk_notebook_pages_list_model_init)
|
||||||
|
G_IMPLEMENT_INTERFACE (GTK_TYPE_SELECTION_MODEL, gtk_notebook_pages_selection_model_init))
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_notebook_pages_init (GtkNotebookPages *pages)
|
gtk_notebook_pages_init (GtkNotebookPages *pages)
|
||||||
|
|||||||
@@ -334,8 +334,8 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
|||||||
|
|
||||||
static GtkOrdering
|
static GtkOrdering
|
||||||
gtk_numeric_sorter_compare (GtkSorter *sorter,
|
gtk_numeric_sorter_compare (GtkSorter *sorter,
|
||||||
gpointer item1,
|
gpointer item1,
|
||||||
gpointer item2)
|
gpointer item2)
|
||||||
{
|
{
|
||||||
GtkNumericSorter *self = GTK_NUMERIC_SORTER (sorter);
|
GtkNumericSorter *self = GTK_NUMERIC_SORTER (sorter);
|
||||||
GValue value1 = G_VALUE_INIT;
|
GValue value1 = G_VALUE_INIT;
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ enum {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
GtkWindow *parent;
|
GtkWindow *parent;
|
||||||
|
char *parent_handle;
|
||||||
GFile *file;
|
GFile *file;
|
||||||
char *uri;
|
char *uri;
|
||||||
gboolean open_folder;
|
gboolean open_folder;
|
||||||
@@ -128,8 +129,9 @@ open_uri_data_free (OpenUriData *data)
|
|||||||
g_clear_object (&data->connection);
|
g_clear_object (&data->connection);
|
||||||
if (data->cancel_handler)
|
if (data->cancel_handler)
|
||||||
g_signal_handler_disconnect (data->cancellable, data->cancel_handler);
|
g_signal_handler_disconnect (data->cancellable, data->cancel_handler);
|
||||||
if (data->parent)
|
if (data->parent && data->parent_handle)
|
||||||
gtk_window_unexport_handle (data->parent);
|
gtk_window_unexport_handle (data->parent, data->parent_handle);
|
||||||
|
g_free (data->parent_handle);
|
||||||
g_clear_object (&data->parent);
|
g_clear_object (&data->parent);
|
||||||
g_clear_object (&data->file);
|
g_clear_object (&data->file);
|
||||||
g_free (data->uri);
|
g_free (data->uri);
|
||||||
@@ -426,6 +428,8 @@ window_handle_exported (GtkWindow *window,
|
|||||||
GAppLaunchContext *context;
|
GAppLaunchContext *context;
|
||||||
char *activation_token = NULL;
|
char *activation_token = NULL;
|
||||||
|
|
||||||
|
data->parent_handle = g_strdup (handle);
|
||||||
|
|
||||||
if (window)
|
if (window)
|
||||||
display = gtk_widget_get_display (GTK_WIDGET (window));
|
display = gtk_widget_get_display (GTK_WIDGET (window));
|
||||||
else
|
else
|
||||||
|
|||||||
+11
-1
@@ -873,8 +873,18 @@ gtk_path_bar_get_mount_callback (GObject *source,
|
|||||||
{
|
{
|
||||||
GFile *file = G_FILE (source);
|
GFile *file = G_FILE (source);
|
||||||
struct SetFileInfo *file_info = data;
|
struct SetFileInfo *file_info = data;
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
file_info->mount = g_file_find_enclosing_mount_finish (file, result, NULL);
|
file_info->mount = g_file_find_enclosing_mount_finish (file, result,
|
||||||
|
&error);
|
||||||
|
|
||||||
|
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
|
||||||
|
{
|
||||||
|
gtk_path_bar_set_file_finish (file_info, FALSE);
|
||||||
|
g_clear_error (&error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
g_clear_error (&error);
|
||||||
|
|
||||||
if (file_info->mount)
|
if (file_info->mount)
|
||||||
file_info->root_file = g_mount_get_root (file_info->mount);
|
file_info->root_file = g_mount_get_root (file_info->mount);
|
||||||
|
|||||||
+6
-1
@@ -28,7 +28,7 @@
|
|||||||
#include "gtksnapshot.h"
|
#include "gtksnapshot.h"
|
||||||
#include "gtktypebuiltins.h"
|
#include "gtktypebuiltins.h"
|
||||||
#include "gtkwidgetprivate.h"
|
#include "gtkwidgetprivate.h"
|
||||||
#include "gdkpixbufutilsprivate.h"
|
#include "gdktextureutilsprivate.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GtkPicture:
|
* GtkPicture:
|
||||||
@@ -525,6 +525,9 @@ gtk_picture_new_for_paintable (GdkPaintable *paintable)
|
|||||||
* The pixbuf must not be modified after passing it to this function.
|
* The pixbuf must not be modified after passing it to this function.
|
||||||
*
|
*
|
||||||
* Returns: a new `GtkPicture`
|
* Returns: a new `GtkPicture`
|
||||||
|
*
|
||||||
|
* Deprecated: 4.12: Use [ctor@Gtk.Picture.new_for_paintable] and
|
||||||
|
* [ctor@Gdk.Texture.new_for_pixbuf] instead
|
||||||
*/
|
*/
|
||||||
GtkWidget*
|
GtkWidget*
|
||||||
gtk_picture_new_for_pixbuf (GdkPixbuf *pixbuf)
|
gtk_picture_new_for_pixbuf (GdkPixbuf *pixbuf)
|
||||||
@@ -779,6 +782,8 @@ gtk_picture_set_resource (GtkPicture *self,
|
|||||||
* See [ctor@Gtk.Picture.new_for_pixbuf] for details.
|
* See [ctor@Gtk.Picture.new_for_pixbuf] for details.
|
||||||
*
|
*
|
||||||
* This is a utility function that calls [method@Gtk.Picture.set_paintable].
|
* This is a utility function that calls [method@Gtk.Picture.set_paintable].
|
||||||
|
*
|
||||||
|
* Deprecated: 4.12: Use [method@Gtk.Picture.set_paintable] instead
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gtk_picture_set_pixbuf (GtkPicture *self,
|
gtk_picture_set_pixbuf (GtkPicture *self,
|
||||||
|
|||||||
+2
-2
@@ -39,7 +39,7 @@ GDK_AVAILABLE_IN_ALL
|
|||||||
GtkWidget* gtk_picture_new (void);
|
GtkWidget* gtk_picture_new (void);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GtkWidget* gtk_picture_new_for_paintable (GdkPaintable *paintable);
|
GtkWidget* gtk_picture_new_for_paintable (GdkPaintable *paintable);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_DEPRECATED_IN_4_12_FOR(gtk_pixbuf_new_for_paintable)
|
||||||
GtkWidget* gtk_picture_new_for_pixbuf (GdkPixbuf *pixbuf);
|
GtkWidget* gtk_picture_new_for_pixbuf (GdkPixbuf *pixbuf);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GtkWidget* gtk_picture_new_for_file (GFile *file);
|
GtkWidget* gtk_picture_new_for_file (GFile *file);
|
||||||
@@ -64,7 +64,7 @@ void gtk_picture_set_filename (GtkPicture
|
|||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
void gtk_picture_set_resource (GtkPicture *self,
|
void gtk_picture_set_resource (GtkPicture *self,
|
||||||
const char *resource_path);
|
const char *resource_path);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_DEPRECATED_IN_4_12_FOR(gtk_picture_set_paintable)
|
||||||
void gtk_picture_set_pixbuf (GtkPicture *self,
|
void gtk_picture_set_pixbuf (GtkPicture *self,
|
||||||
GdkPixbuf *pixbuf);
|
GdkPixbuf *pixbuf);
|
||||||
|
|
||||||
|
|||||||
+9
-8
@@ -483,6 +483,7 @@ create_popup_layout (GtkPopover *popover)
|
|||||||
GdkPopupLayout *layout;
|
GdkPopupLayout *layout;
|
||||||
GtkCssStyle *style;
|
GtkCssStyle *style;
|
||||||
GtkBorder shadow_width;
|
GtkBorder shadow_width;
|
||||||
|
gboolean ltr = gtk_widget_get_direction (GTK_WIDGET (popover)) != GTK_TEXT_DIR_RTL;
|
||||||
|
|
||||||
compute_surface_pointing_to (popover, &rect);
|
compute_surface_pointing_to (popover, &rect);
|
||||||
|
|
||||||
@@ -545,13 +546,13 @@ create_popup_layout (GtkPopover *popover)
|
|||||||
switch (gtk_widget_get_halign (GTK_WIDGET (popover)))
|
switch (gtk_widget_get_halign (GTK_WIDGET (popover)))
|
||||||
{
|
{
|
||||||
case GTK_ALIGN_START:
|
case GTK_ALIGN_START:
|
||||||
parent_anchor = GDK_GRAVITY_NORTH_WEST;
|
parent_anchor = ltr ? GDK_GRAVITY_NORTH_WEST : GDK_GRAVITY_NORTH_EAST;
|
||||||
surface_anchor = GDK_GRAVITY_SOUTH_WEST;
|
surface_anchor = ltr ? GDK_GRAVITY_SOUTH_WEST : GDK_GRAVITY_SOUTH_EAST;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GTK_ALIGN_END:
|
case GTK_ALIGN_END:
|
||||||
parent_anchor = GDK_GRAVITY_NORTH_EAST;
|
parent_anchor = ltr ? GDK_GRAVITY_NORTH_EAST : GDK_GRAVITY_NORTH_WEST;
|
||||||
surface_anchor = GDK_GRAVITY_SOUTH_EAST;
|
surface_anchor = ltr ? GDK_GRAVITY_SOUTH_EAST : GDK_GRAVITY_SOUTH_WEST;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GTK_ALIGN_FILL:
|
case GTK_ALIGN_FILL:
|
||||||
@@ -570,13 +571,13 @@ create_popup_layout (GtkPopover *popover)
|
|||||||
switch (gtk_widget_get_halign (GTK_WIDGET (popover)))
|
switch (gtk_widget_get_halign (GTK_WIDGET (popover)))
|
||||||
{
|
{
|
||||||
case GTK_ALIGN_START:
|
case GTK_ALIGN_START:
|
||||||
parent_anchor = GDK_GRAVITY_SOUTH_WEST;
|
parent_anchor = ltr ? GDK_GRAVITY_SOUTH_WEST : GDK_GRAVITY_SOUTH_EAST;
|
||||||
surface_anchor = GDK_GRAVITY_NORTH_WEST;
|
surface_anchor = ltr ? GDK_GRAVITY_NORTH_WEST : GDK_GRAVITY_NORTH_EAST;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GTK_ALIGN_END:
|
case GTK_ALIGN_END:
|
||||||
parent_anchor = GDK_GRAVITY_SOUTH_EAST;
|
parent_anchor = ltr ? GDK_GRAVITY_SOUTH_EAST : GDK_GRAVITY_SOUTH_WEST;
|
||||||
surface_anchor = GDK_GRAVITY_NORTH_EAST;
|
surface_anchor = ltr ? GDK_GRAVITY_NORTH_EAST : GDK_GRAVITY_NORTH_WEST;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GTK_ALIGN_FILL:
|
case GTK_ALIGN_FILL:
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ typedef struct {
|
|||||||
GtkPrintOperationResult result;
|
GtkPrintOperationResult result;
|
||||||
GtkPrintOperationPrintFunc print_cb;
|
GtkPrintOperationPrintFunc print_cb;
|
||||||
GtkWindow *parent;
|
GtkWindow *parent;
|
||||||
|
char *handle;
|
||||||
GMainLoop *loop;
|
GMainLoop *loop;
|
||||||
guint32 token;
|
guint32 token;
|
||||||
GDestroyNotify destroy;
|
GDestroyNotify destroy;
|
||||||
@@ -62,8 +63,9 @@ portal_data_free (gpointer data)
|
|||||||
{
|
{
|
||||||
PortalData *portal = data;
|
PortalData *portal = data;
|
||||||
|
|
||||||
if (portal->parent)
|
if (portal->parent && portal->handle)
|
||||||
gtk_window_unexport_handle (portal->parent);
|
gtk_window_unexport_handle (portal->parent, portal->handle);
|
||||||
|
g_free (portal->handle);
|
||||||
g_object_unref (portal->op);
|
g_object_unref (portal->op);
|
||||||
g_object_unref (portal->proxy);
|
g_object_unref (portal->proxy);
|
||||||
if (portal->loop)
|
if (portal->loop)
|
||||||
@@ -547,6 +549,8 @@ window_handle_exported (GtkWindow *window,
|
|||||||
{
|
{
|
||||||
PortalData *portal = user_data;
|
PortalData *portal = user_data;
|
||||||
|
|
||||||
|
portal->handle = g_strdup (handle_str);
|
||||||
|
|
||||||
g_dbus_proxy_call (portal->proxy,
|
g_dbus_proxy_call (portal->proxy,
|
||||||
"PreparePrint",
|
"PreparePrint",
|
||||||
g_variant_new ("(ss@a{sv}@a{sv}@a{sv})",
|
g_variant_new ("(ss@a{sv}@a{sv}@a{sv})",
|
||||||
|
|||||||
@@ -329,7 +329,7 @@ gtk_property_lookup_list_model_get_property (GObject *object,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_PROPERTY:
|
case PROP_PROPERTY:
|
||||||
g_value_set_object (value, self->property);
|
g_value_set_string (value, self->property);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -408,7 +408,7 @@ gtk_property_lookup_list_model_class_init (GtkPropertyLookupListModelClass *klas
|
|||||||
*/
|
*/
|
||||||
properties[PROP_OBJECT] =
|
properties[PROP_OBJECT] =
|
||||||
g_param_spec_object ("object", NULL, NULL,
|
g_param_spec_object ("object", NULL, NULL,
|
||||||
G_TYPE_LIST_MODEL,
|
G_TYPE_OBJECT,
|
||||||
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
||||||
|
|
||||||
g_object_class_install_properties (object_class, NUM_PROPERTIES, properties);
|
g_object_class_install_properties (object_class, NUM_PROPERTIES, properties);
|
||||||
@@ -417,6 +417,7 @@ gtk_property_lookup_list_model_class_init (GtkPropertyLookupListModelClass *klas
|
|||||||
static void
|
static void
|
||||||
gtk_property_lookup_list_model_init (GtkPropertyLookupListModel *self)
|
gtk_property_lookup_list_model_init (GtkPropertyLookupListModel *self)
|
||||||
{
|
{
|
||||||
|
self->item_type = G_TYPE_OBJECT;
|
||||||
self->items = g_ptr_array_new ();
|
self->items = g_ptr_array_new ();
|
||||||
/* add sentinel */
|
/* add sentinel */
|
||||||
g_ptr_array_add (self->items, NULL);
|
g_ptr_array_add (self->items, NULL);
|
||||||
|
|||||||
@@ -1431,6 +1431,7 @@ gtk_recent_manager_clamp_to_age (GtkRecentManager *manager,
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_strfreev (uris);
|
g_strfreev (uris);
|
||||||
|
g_date_time_unref (now);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -2180,13 +2181,16 @@ gtk_recent_info_get_uri_display (GtkRecentInfo *info)
|
|||||||
int
|
int
|
||||||
gtk_recent_info_get_age (GtkRecentInfo *info)
|
gtk_recent_info_get_age (GtkRecentInfo *info)
|
||||||
{
|
{
|
||||||
|
int diff;
|
||||||
GDateTime *now;
|
GDateTime *now;
|
||||||
|
|
||||||
g_return_val_if_fail (info != NULL, -1);
|
g_return_val_if_fail (info != NULL, -1);
|
||||||
|
|
||||||
now = g_date_time_new_now_utc ();
|
now = g_date_time_new_now_utc ();
|
||||||
|
diff = (int) (g_date_time_difference (now, info->modified) / (double)G_TIME_SPAN_DAY);
|
||||||
|
|
||||||
return (int) (g_date_time_difference (now, info->modified) / (double)G_TIME_SPAN_DAY);
|
g_date_time_unref (now);
|
||||||
|
return diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user