Compare commits
250 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0f2bce941a | |||
| 0a7fb26909 | |||
| 444d5fa500 | |||
| c380d17621 | |||
| 686d18dfc2 | |||
| 0a1702ae99 | |||
| 0016fea36b | |||
| 7ef46293aa | |||
| 6b59c138b2 | |||
| c8c895d160 | |||
| acbd7f212e | |||
| f2a2889153 | |||
| a4ae215309 | |||
| fa16ba12cf | |||
| ec2421b187 | |||
| 1fce2b1e06 | |||
| 38bf843de8 | |||
| 7b8a5235d4 | |||
| 3c9b3ead6f | |||
| 1549ec5f9b | |||
| 4339e8e464 | |||
| 39f4d5ccf7 | |||
| 957fa87fce | |||
| e8bdd46d8d | |||
| d03b27b441 | |||
| f4cbe26af3 | |||
| 24af4b48cc | |||
| 1c8caf745f | |||
| 395d80f131 | |||
| 74229572e7 | |||
| cbb3d3f177 | |||
| 8861d0eb53 | |||
| a23bc894e9 | |||
| 156e25b6aa | |||
| 96f6787a3e | |||
| cc665f29ea | |||
| 8d2047c824 | |||
| a79da8b655 | |||
| f29c7e76f5 | |||
| 29867e7ae1 | |||
| 876b439d4a | |||
| 4f6d7c69a1 | |||
| 2bf2635635 | |||
| 67ed09f5ae | |||
| 1c72f46eed | |||
| f5e7a1d4cc | |||
| 0f61c52593 | |||
| a4bae6a62d | |||
| d141ac5adf | |||
| 894a4bda85 | |||
| 2b88505ca4 | |||
| ef8c835762 | |||
| 50115d70c6 | |||
| 1a058a41c9 | |||
| be4f6ff3da | |||
| 4fcf899852 | |||
| 371e860184 | |||
| bce1e0bfdd | |||
| 468d2cb7f2 | |||
| b520a5ceda | |||
| e6bc82cff5 | |||
| d021aa7bd2 | |||
| 3dc3d03a08 | |||
| 788bd575d6 | |||
| 94a2dc4c47 | |||
| 169a7f83e6 | |||
| 703494c7fa | |||
| d642072603 | |||
| ab7a4f64cb | |||
| 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/*/
|
||||
.flatpak-builder/
|
||||
|
||||
+21
-1
@@ -24,7 +24,7 @@ stages:
|
||||
variables:
|
||||
COMMON_MESON_FLAGS: "-Dwerror=true -Dcairo:werror=false -Dgi-docgen:werror=false -Dgraphene:werror=false -Dlibepoxy:werror=false -Dlibsass:werror=false -Dpango:werror=false -Dsassc:werror=false -Dgdk-pixbuf:werror=false -Dglib:werror=false -Dlibcloudproviders:werror=false -Dlibpng:werror=false -Dlibtiff:werror=false -Dsysprof:werror=false -Dwayland-protocols:werror=false -Dharfbuzz:werror=false -Dfreetype2:werror=false -Dfontconfig:werror=false -Dfribidi:werror=false -Dlibffi:werror=false -Dlibjpeg-turbo:werror=false -Dmutest:werror=false -Dpixman:werror=false -Dproxy-libintl:werror=false"
|
||||
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true"
|
||||
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled -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
|
||||
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
|
||||
- .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:
|
||||
extends: .build-fedora-default
|
||||
stage: build
|
||||
|
||||
@@ -1,6 +1,64 @@
|
||||
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
|
||||
|
||||
* GtkColumnView:
|
||||
- Support displaying sections
|
||||
|
||||
* 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
|
||||
|
||||
* GDK:
|
||||
- Support grayscale texture and alpha texture formats
|
||||
for loading and saving to png and tiff, and in GL
|
||||
|
||||
* 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
|
||||
Turkish
|
||||
|
||||
|
||||
Overview of Changes in 4.11.2, 09-05-2023
|
||||
=========================================
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ update_image (void)
|
||||
cairo_t *cr;
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkPixbuf *pixbuf2;
|
||||
GdkTexture *texture;
|
||||
cairo_font_options_t *fopt;
|
||||
cairo_hint_style_t hintstyle;
|
||||
cairo_hint_metrics_t hintmetrics;
|
||||
@@ -120,8 +121,17 @@ update_image (void)
|
||||
cairo_destroy (cr);
|
||||
g_object_unref (layout);
|
||||
|
||||
pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, cairo_image_surface_get_width (surface), cairo_image_surface_get_height (surface));
|
||||
pixbuf2 = gdk_pixbuf_scale_simple (pixbuf, gdk_pixbuf_get_width (pixbuf) * scale, gdk_pixbuf_get_height (pixbuf) * scale, GDK_INTERP_NEAREST);
|
||||
pixbuf = gdk_pixbuf_new_from_data (cairo_image_surface_get_data (surface),
|
||||
GDK_COLORSPACE_RGB, TRUE, 8,
|
||||
cairo_image_surface_get_width (surface),
|
||||
cairo_image_surface_get_height (surface),
|
||||
cairo_image_surface_get_stride (surface),
|
||||
NULL, NULL);
|
||||
|
||||
pixbuf2 = gdk_pixbuf_scale_simple (pixbuf,
|
||||
gdk_pixbuf_get_width (pixbuf) * scale,
|
||||
gdk_pixbuf_get_height (pixbuf) * scale,
|
||||
GDK_INTERP_NEAREST);
|
||||
|
||||
g_object_unref (pixbuf);
|
||||
cairo_surface_destroy (surface);
|
||||
@@ -278,14 +288,24 @@ retry:
|
||||
pango_layout_iter_free (iter);
|
||||
g_object_unref (layout);
|
||||
|
||||
pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, cairo_image_surface_get_width (surface), cairo_image_surface_get_height (surface));
|
||||
pixbuf2 = gdk_pixbuf_scale_simple (pixbuf, gdk_pixbuf_get_width (pixbuf) * scale, gdk_pixbuf_get_height (pixbuf) * scale, GDK_INTERP_NEAREST);
|
||||
pixbuf = gdk_pixbuf_new_from_data (cairo_image_surface_get_data (surface),
|
||||
GDK_COLORSPACE_RGB, TRUE, 8,
|
||||
cairo_image_surface_get_width (surface),
|
||||
cairo_image_surface_get_height (surface),
|
||||
cairo_image_surface_get_stride (surface),
|
||||
NULL, NULL);
|
||||
|
||||
pixbuf2 = gdk_pixbuf_scale_simple (pixbuf,
|
||||
gdk_pixbuf_get_width (pixbuf) * scale,
|
||||
gdk_pixbuf_get_height (pixbuf) * scale,
|
||||
GDK_INTERP_NEAREST);
|
||||
g_object_unref (pixbuf);
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
|
||||
gtk_picture_set_pixbuf (GTK_PICTURE (image), pixbuf2);
|
||||
|
||||
texture = gdk_texture_new_for_pixbuf (pixbuf2);
|
||||
gtk_picture_set_paintable (GTK_PICTURE (image), GDK_PAINTABLE (texture));
|
||||
g_object_unref (pixbuf2);
|
||||
g_object_unref (pixbuf2);
|
||||
}
|
||||
|
||||
|
||||
+10
-11
@@ -30,6 +30,7 @@ progressive_prepared_callback (GdkPixbufLoader *loader,
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GtkWidget *picture;
|
||||
GdkTexture *texture;
|
||||
|
||||
picture = GTK_WIDGET (data);
|
||||
|
||||
@@ -40,7 +41,9 @@ progressive_prepared_callback (GdkPixbufLoader *loader,
|
||||
*/
|
||||
gdk_pixbuf_fill (pixbuf, 0xaaaaaaff);
|
||||
|
||||
gtk_picture_set_pixbuf (GTK_PICTURE (picture), pixbuf);
|
||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
||||
gtk_picture_set_paintable (GTK_PICTURE (picture), GDK_PAINTABLE (texture));
|
||||
g_object_unref (texture);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -51,22 +54,18 @@ progressive_updated_callback (GdkPixbufLoader *loader,
|
||||
int height,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *picture;
|
||||
GdkPixbuf *pixbuf;
|
||||
GtkWidget *picture = GTK_WIDGET (data);
|
||||
GdkTexture *texture;
|
||||
|
||||
picture = GTK_WIDGET (data);
|
||||
|
||||
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
|
||||
gtk_picture_set_pixbuf (GTK_PICTURE (picture), NULL);
|
||||
gtk_picture_set_pixbuf (GTK_PICTURE (picture), pixbuf);
|
||||
texture = gdk_texture_new_for_pixbuf (gdk_pixbuf_loader_get_pixbuf (loader));
|
||||
gtk_picture_set_paintable (GTK_PICTURE (picture), GDK_PAINTABLE (texture));
|
||||
g_object_unref (texture);
|
||||
}
|
||||
|
||||
static int
|
||||
progressive_timeout (gpointer data)
|
||||
{
|
||||
GtkWidget *picture;
|
||||
|
||||
picture = GTK_WIDGET (data);
|
||||
GtkWidget *picture = GTK_WIDGET (data);
|
||||
|
||||
/* This shows off fully-paranoid error handling, so looks scary.
|
||||
* You could factor out the error handling code into a nice separate
|
||||
|
||||
@@ -1701,6 +1701,13 @@ node_editor_window_init (NodeEditorWindow *self)
|
||||
" }\n"
|
||||
" transform: translate(0, 140);\n"
|
||||
"}", -1);
|
||||
|
||||
if (g_getenv ("GSK_RENDERER"))
|
||||
{
|
||||
char *new_title = g_strdup_printf ("GTK Node Editor - %s", g_getenv ("GSK_RENDERER"));
|
||||
gtk_window_set_title (GTK_WINDOW (self), new_title);
|
||||
g_free (new_title);
|
||||
}
|
||||
}
|
||||
|
||||
NodeEditorWindow *
|
||||
|
||||
@@ -1210,12 +1210,12 @@ typedef struct {
|
||||
static void
|
||||
add_background (GtkWidget *flowbox,
|
||||
const char *filename,
|
||||
GdkPixbuf *pixbuf,
|
||||
GdkTexture *texture,
|
||||
gboolean is_resource)
|
||||
{
|
||||
GtkWidget *child;
|
||||
|
||||
child = gtk_picture_new_for_pixbuf (pixbuf);
|
||||
child = gtk_picture_new_for_paintable (GDK_PAINTABLE (texture));
|
||||
gtk_widget_set_size_request (child, 110, 70);
|
||||
gtk_flow_box_insert (GTK_FLOW_BOX (flowbox), child, -1);
|
||||
child = gtk_widget_get_parent (child);
|
||||
@@ -1231,6 +1231,7 @@ background_loaded_cb (GObject *source,
|
||||
{
|
||||
BackgroundData *bd = data;
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkTexture *texture;
|
||||
GError *error = NULL;
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_stream_finish (res, &error);
|
||||
@@ -1241,8 +1242,11 @@ background_loaded_cb (GObject *source,
|
||||
return;
|
||||
}
|
||||
|
||||
add_background (bd->flowbox, bd->filename, pixbuf, FALSE);
|
||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
||||
add_background (bd->flowbox, bd->filename, texture, FALSE);
|
||||
|
||||
g_object_unref (texture);
|
||||
g_object_unref (pixbuf);
|
||||
g_free (bd->filename);
|
||||
g_free (bd);
|
||||
}
|
||||
@@ -1259,7 +1263,10 @@ populate_flowbox (GtkWidget *flowbox)
|
||||
GInputStream *stream;
|
||||
BackgroundData *bd;
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkTexture *texture;
|
||||
GtkWidget *child;
|
||||
guchar *data;
|
||||
GBytes *bytes;
|
||||
int i;
|
||||
const char *resources[] = {
|
||||
"sunset.jpg", "portland-rose.jpg", "beach.jpg", "nyc.jpg"
|
||||
@@ -1270,9 +1277,14 @@ populate_flowbox (GtkWidget *flowbox)
|
||||
|
||||
g_object_set_data (G_OBJECT (flowbox), "populated", GUINT_TO_POINTER (1));
|
||||
|
||||
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 110, 70);
|
||||
gdk_pixbuf_fill (pixbuf, 0xffffffff);
|
||||
child = gtk_picture_new_for_pixbuf (pixbuf);
|
||||
data = g_malloc (4 * 110 * 70);
|
||||
memset (data, 0xff, 4 * 110 * 70);
|
||||
bytes = g_bytes_new_take (data, 4 * 110 * 70);
|
||||
texture = gdk_memory_texture_new (110, 70, GDK_MEMORY_DEFAULT, bytes, 4 * 110);
|
||||
child = gtk_picture_new_for_paintable (GDK_PAINTABLE (texture));
|
||||
g_object_unref (texture);
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
gtk_widget_add_css_class (child, "frame");
|
||||
gtk_flow_box_insert (GTK_FLOW_BOX (flowbox), child, -1);
|
||||
|
||||
@@ -1280,7 +1292,10 @@ populate_flowbox (GtkWidget *flowbox)
|
||||
{
|
||||
filename = g_strconcat ("/org/gtk/WidgetFactory4/", resources[i], NULL);
|
||||
pixbuf = gdk_pixbuf_new_from_resource_at_scale (filename, 110, 110, TRUE, NULL);
|
||||
add_background (flowbox, filename, pixbuf, TRUE);
|
||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
||||
add_background (flowbox, filename, texture, TRUE);
|
||||
g_object_unref (texture);
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
|
||||
location = "/usr/share/backgrounds/gnome";
|
||||
|
||||
@@ -2244,20 +2244,24 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="spacing">6</property>
|
||||
<property name="valign">center</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="lockbox">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="spacing">6</property>
|
||||
<property name="valign">center</property>
|
||||
<child>
|
||||
<object class="GtkMenuButton" id="open_menubutton">
|
||||
<property name="halign">3</property>
|
||||
<property name="popover">open_popover</property>
|
||||
<property name="label">Open</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="record_button">
|
||||
<property name="halign">3</property>
|
||||
<property name="valign">center</property>
|
||||
<signal name="toggled" handler="on_record_button_toggled"/>
|
||||
<style>
|
||||
<class name="text-button"/>
|
||||
@@ -2267,16 +2271,19 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="spacing">6</property>
|
||||
<property name="valign">center</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="valign">4</property>
|
||||
<property name="icon-name">media-record-symbolic</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="valign">4</property>
|
||||
<property name="label">Record</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -2285,6 +2292,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="valign">center</property>
|
||||
<style>
|
||||
<class name="linked"/>
|
||||
</style>
|
||||
@@ -2292,12 +2300,14 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<object class="GtkToggleButton" id="grid_button">
|
||||
<property name="active">1</property>
|
||||
<property name="icon-name">view-grid-symbolic</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="list_button">
|
||||
<property name="group">grid_button</property>
|
||||
<property name="icon-name">view-list-symbolic</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -2305,6 +2315,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="circular_button">
|
||||
<property name="icon-name">emblem-system-symbolic</property>
|
||||
<property name="valign">center</property>
|
||||
<style>
|
||||
<class name="circular"/>
|
||||
</style>
|
||||
@@ -2313,12 +2324,15 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLockButton" id="lockbutton"/>
|
||||
<object class="GtkLockButton" id="lockbutton">
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuButton">
|
||||
<property name="icon-name">view-more-symbolic</property>
|
||||
<property name="menu-model">new_style_menu_model</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@@ -220,6 +220,6 @@ clipboard.cut, clipboard.copy, clipboard.paste
|
||||
selection.delete, selection.select-all
|
||||
: Selection operations on entries, text view and labels
|
||||
|
||||
color.select, color.customize:
|
||||
color.select, color.customize
|
||||
: Operate on colors in a `GtkColorChooserWidget`. These actions are
|
||||
unusual in that they have the non-trivial parameter type (dddd):
|
||||
unusual in that they have the non-trivial parameter type (dddd).
|
||||
|
||||
@@ -68,7 +68,7 @@ in a selector, widget names must be prefixed with a # character.
|
||||
| E:focus-within | [CSS Selector Level 4](https://drafts.csswg.org/selectors/#focus-within-pseudo) | Set on all ancestors of the focus widget, unlike CSS |
|
||||
| E:focus-visible | [CSS Selector Level 4](https://drafts.csswg.org/selectors/#focus-within-pseudo) | Set on focus widget and all ancestors, unlike CSS |
|
||||
| E:disabled | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#UIstates) | Corresponds to GTK_STATE_FLAG_INSENSITIVE |
|
||||
| E:disabled | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#UIstates) | Corresponds to GTK_STATE_FLAG_CHECKED |
|
||||
| E:checked | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#UIstates) | Corresponds to GTK_STATE_FLAG_CHECKED |
|
||||
| E:indeterminate | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#indeterminate) | Corresponds to GTK_STATE_FLAG_INCONSISTENT |
|
||||
| E:backdrop, E:selected | | Corresponds to GTK_STATE_FLAG_BACKDROP, GTK_STATE_FLAG_SELECTED |
|
||||
| E:not(selector) | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#negation) | |
|
||||
|
||||
@@ -103,14 +103,15 @@ fields, but e.g. buttons can take the focus too.
|
||||
|
||||
Input widgets can be given the focus by clicking on them, but focus
|
||||
can also be moved around with certain key events (this is known as
|
||||
“keyboard navigation”). GTK reserves the <kbd>Tab</kbd> key to move the focus
|
||||
to the next location, and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move it back to the previous
|
||||
one. In addition many containers allow “directional navigation” with
|
||||
the arrow keys.
|
||||
“keyboard navigation”).
|
||||
GTK reserves the <kbd>Tab</kbd> key to move the focus to the next location,
|
||||
and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move it back to the previous one.
|
||||
In addition many containers allow “directional navigation” with the arrow keys.
|
||||
|
||||
Many widgets can be “activated” to trigger and action. E.g., you can
|
||||
activate a button or switch by clicking on them, but you can also
|
||||
activate them with the keyboard, by using the <kbd>Enter</kbd> or <kbd>␣</kbd> keys.
|
||||
Many widgets can be “activated” to trigger and action.
|
||||
E.g., you can activate a button or switch by clicking on them,
|
||||
but you can also activate them with the keyboard,
|
||||
by using the <kbd>Enter</kbd> or <kbd>Space</kbd> keys.
|
||||
|
||||
Apart from keyboard navigation, activation and directly typing into
|
||||
entries or text views, GTK widgets can use key events for activating
|
||||
@@ -121,15 +122,17 @@ GTK has traditionally supported different kinds of shortcuts:
|
||||
|
||||
- Accelerators are any other shortcuts that can be activated regardless
|
||||
of where the focus is, and typically trigger global actions, such as
|
||||
Ctrl-Q to quit an application.
|
||||
- Mnemonics are usually triggered using Alt as a modifier for a letter.
|
||||
<kbd>Ctrl</kbd>+<kbd>Q</kbd> to quit an application.
|
||||
- Mnemonics are usually triggered using <kbd>Alt</kbd>
|
||||
as a modifier for a letter.
|
||||
They are used in places where a label is associated with a control,
|
||||
and are indicated by underlining the letter in the label. As a special
|
||||
case, inside menus (i.e. inside `GtkPopoverMenu`), mnemonics can be
|
||||
triggered without the modifier.
|
||||
- Key bindings are specific to individual widgets, such as Ctrl-C or
|
||||
Ctrl-V in an entry copy to or paste from the clipboard. They are only
|
||||
triggered when the widget has focus.
|
||||
- Key bindings are specific to individual widgets,
|
||||
such as <kbd>Ctrl</kbd>+<kbd>C</kbd> or <kbd>Ctrl</kbd>+<kbd>V</kbd>
|
||||
in an entry copy to or paste from the clipboard.
|
||||
They are only triggered when the widget has focus.
|
||||
|
||||
GTK handles accelerators and mnemonics in a global scope, during the
|
||||
capture phase, and key bindings locally, during the target phase.
|
||||
@@ -208,4 +211,4 @@ sequence, so setting the state on one does transfer the state to
|
||||
the others. They also are mutually exclusive, within a widget
|
||||
where may be only one gesture group claiming a given sequence.
|
||||
If another gesture group claims later that same sequence, the
|
||||
first group will deny the sequence:
|
||||
first group will deny the sequence.
|
||||
|
||||
@@ -133,3 +133,9 @@ The function gtk_widget_get_allocation() is also going away. It does not have a
|
||||
replacement, but the previously mentioned alternatives can be used for it too.
|
||||
|
||||
The function gtk_widget_get_allocated_baseline() has been renamed to [method@Gtk.Widget.get_baseline].
|
||||
|
||||
## Stop using GdkPixbuf
|
||||
|
||||
GTK is moving away from GdkPixbuf as the primary API for transporting image data, in favor
|
||||
of GdkTexture. APIs that are accepting or returning GdkPixbufs are being replaced by equivalent
|
||||
APIs using GdkTexture or GdkPaintable objects.
|
||||
|
||||
@@ -196,6 +196,15 @@ The _data table_ style of list is a high density table, similar in style to a
|
||||
traditional treeview. Individual cells can be selectable and editable. Use
|
||||
the `.data-table` style class.
|
||||
|
||||
## Sections
|
||||
|
||||
List models can optionally group their items into **_sections_**, by implementing
|
||||
the `GtkSectionModel` interface. Both `GtkListView` and `GtkGridView` can
|
||||
display headers for sections, by installing a separate **_header factory_**.
|
||||
|
||||
Many GTK list models support section inherently, or they pass through the
|
||||
section of a model they are wrapping.
|
||||
|
||||
## Comparison to GtkTreeView
|
||||
|
||||
Developers familiar with `GtkTreeView` may wonder how this way of doing lists
|
||||
|
||||
+2
-2
@@ -57,7 +57,7 @@ window_paste (GSimpleAction *action,
|
||||
{
|
||||
GtkWindow *window = GTK_WINDOW (user_data);
|
||||
GtkTextView *text = g_object_get_data ((GObject*)window, "plugman-text");
|
||||
|
||||
|
||||
gtk_text_buffer_paste_clipboard (gtk_text_view_get_buffer (text),
|
||||
gtk_widget_get_clipboard (GTK_WIDGET (text)),
|
||||
NULL,
|
||||
@@ -221,7 +221,7 @@ plugin_action (GAction *action,
|
||||
g_message ("Color: %s", g_action_get_name (action));
|
||||
|
||||
css_provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_data (css_provider, css_to_load, -1);
|
||||
gtk_css_provider_load_from_string (css_provider, css_to_load);
|
||||
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
||||
GTK_STYLE_PROVIDER (css_provider),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
|
||||
@@ -157,6 +157,9 @@ convert_no_alpha (guchar *dest_data,
|
||||
*
|
||||
* Returns: (nullable) (transfer full): A newly-created pixbuf with a
|
||||
* reference count of 1
|
||||
*
|
||||
* Deprecated: 4.12: Use [class@Gdk.Texture] and subclasses instead
|
||||
* cairo surfaces and pixbufs
|
||||
*/
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf_get_from_surface (cairo_surface_t *surface,
|
||||
@@ -234,6 +237,9 @@ pixbuf_texture_unref_cb (guchar *pixels,
|
||||
* to draw it on screen.
|
||||
*
|
||||
* Returns: (transfer full) (nullable): a new `GdkPixbuf`
|
||||
*
|
||||
* Deprecated: 4.12: Use [class@Gdk.Texture] and subclasses instead
|
||||
* cairo surfaces and pixbufs
|
||||
*/
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf_get_from_texture (GdkTexture *texture)
|
||||
@@ -33,13 +33,13 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_12
|
||||
GdkPixbuf *gdk_pixbuf_get_from_surface (cairo_surface_t *surface,
|
||||
int src_x,
|
||||
int src_y,
|
||||
int width,
|
||||
int height);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_12
|
||||
GdkPixbuf *gdk_pixbuf_get_from_texture (GdkTexture *texture);
|
||||
|
||||
G_END_DECLS
|
||||
@@ -0,0 +1,7 @@
|
||||
gdk_deprecated_sources = files([
|
||||
'gdkpixbuf.c',
|
||||
])
|
||||
|
||||
gdk_deprecated_headers = files([
|
||||
'gdkpixbuf.h',
|
||||
])
|
||||
@@ -61,7 +61,7 @@
|
||||
#include <gdk/gdkmonitor.h>
|
||||
#include <gdk/gdkpaintable.h>
|
||||
#include <gdk/gdkpango.h>
|
||||
#include <gdk/gdkpixbuf.h>
|
||||
#include <gdk/deprecated/gdkpixbuf.h>
|
||||
#include <gdk/gdkpopup.h>
|
||||
#include <gdk/gdkpopuplayout.h>
|
||||
#include <gdk/gdkrectangle.h>
|
||||
|
||||
+3
-38
@@ -17,7 +17,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkcairoprivate.h"
|
||||
#include "gdkcairo.h"
|
||||
|
||||
#include "gdkrgba.h"
|
||||
#include "gdktexture.h"
|
||||
@@ -90,7 +90,7 @@ gdk_cairo_region (cairo_t *cr,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
gdk_cairo_surface_paint_pixbuf (cairo_surface_t *surface,
|
||||
const GdkPixbuf *pixbuf)
|
||||
{
|
||||
@@ -171,7 +171,7 @@ gdk_cairo_set_source_pixbuf (cairo_t *cr,
|
||||
*
|
||||
* Returns: %TRUE if the extents fit in a `GdkRectangle`, %FALSE if not
|
||||
*/
|
||||
gboolean
|
||||
static gboolean
|
||||
_gdk_cairo_surface_extents (cairo_surface_t *surface,
|
||||
GdkRectangle *extents)
|
||||
{
|
||||
@@ -303,38 +303,3 @@ gdk_cairo_region_create_from_surface (cairo_surface_t *surface)
|
||||
|
||||
return region;
|
||||
}
|
||||
|
||||
cairo_region_t *
|
||||
gdk_cairo_region_from_clip (cairo_t *cr)
|
||||
{
|
||||
cairo_rectangle_list_t *rectangles;
|
||||
cairo_region_t *region;
|
||||
int i;
|
||||
|
||||
rectangles = cairo_copy_clip_rectangle_list (cr);
|
||||
|
||||
if (rectangles->status != CAIRO_STATUS_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
region = cairo_region_create ();
|
||||
for (i = 0; i < rectangles->num_rectangles; i++)
|
||||
{
|
||||
cairo_rectangle_int_t clip_rect;
|
||||
cairo_rectangle_t *rect;
|
||||
|
||||
rect = &rectangles->rectangles[i];
|
||||
|
||||
/* Here we assume clip rects are ints for direct targets, which
|
||||
is true for cairo */
|
||||
clip_rect.x = (int)rect->x;
|
||||
clip_rect.y = (int)rect->y;
|
||||
clip_rect.width = (int)rect->width;
|
||||
clip_rect.height = (int)rect->height;
|
||||
|
||||
cairo_region_union_rectangle (region, &clip_rect);
|
||||
}
|
||||
|
||||
cairo_rectangle_list_destroy (rectangles);
|
||||
|
||||
return region;
|
||||
}
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@
|
||||
#endif
|
||||
|
||||
#include <gdk/gdktypes.h>
|
||||
#include <gdk/gdkpixbuf.h>
|
||||
#include <gdk/deprecated/gdkpixbuf.h>
|
||||
#include <pango/pangocairo.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 2020 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "gdkcairo.h"
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <cairo.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
gboolean _gdk_cairo_surface_extents (cairo_surface_t *surface,
|
||||
GdkRectangle *extents);
|
||||
|
||||
void gdk_cairo_surface_paint_pixbuf (cairo_surface_t *surface,
|
||||
const GdkPixbuf *pixbuf);
|
||||
|
||||
cairo_region_t *gdk_cairo_region_from_clip (cairo_t *cr);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "gdkcontentserializer.h"
|
||||
|
||||
#include "gdkcontentformats.h"
|
||||
#include "gdkpixbuf.h"
|
||||
#include "deprecated/gdkpixbuf.h"
|
||||
#include "filetransferportalprivate.h"
|
||||
#include "gdktextureprivate.h"
|
||||
#include "gdkrgba.h"
|
||||
@@ -642,7 +642,9 @@ pixbuf_serializer (GdkContentSerializer *serializer)
|
||||
else if (G_VALUE_HOLDS (value, GDK_TYPE_TEXTURE))
|
||||
{
|
||||
GdkTexture *texture = g_value_get_object (value);
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
pixbuf = gdk_pixbuf_get_from_texture (texture);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -371,6 +371,12 @@ gdk_draw_context_begin_frame_full (GdkDrawContext *context,
|
||||
priv->surface->paint_context = g_object_ref (context);
|
||||
|
||||
GDK_DRAW_CONTEXT_GET_CLASS (context)->begin_frame (context, prefers_high_depth, priv->frame_region);
|
||||
|
||||
cairo_region_intersect_rectangle (priv->frame_region,
|
||||
&(cairo_rectangle_int_t) {
|
||||
0, 0,
|
||||
priv->surface->width, priv->surface->height
|
||||
});
|
||||
}
|
||||
|
||||
#ifdef HAVE_SYSPROF
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include <gdk/version/gdkversionmacros.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
@@ -306,6 +308,20 @@ typedef enum
|
||||
* the alpha value. Since: 4.6
|
||||
* @GDK_MEMORY_R32G32B32A32_FLOAT: 4 float values; for red, green, blue and
|
||||
* alpha. Since: 4.6
|
||||
* @GDK_MEMORY_G8A8_PREMULTIPLIED: 2 bytes; for grayscale, alpha. The color
|
||||
* values are premultiplied with the alpha value. Since: 4.12
|
||||
* @GDK_MEMORY_G8A8: 2 bytes; for grayscale, alpha. Since: 4.12
|
||||
* @GDK_MEMORY_G8: One byte; for grayscale. The data is opaque.
|
||||
* Since: 4.12
|
||||
* @GDK_MEMORY_G16A16_PREMULTIPLIED: 2 guint16 values; for grayscale, alpha.
|
||||
* The color values are premultiplied with the alpha value. Since: 4.12
|
||||
* @GDK_MEMORY_G16A16: 2 guint16 values; for grayscale, alpha. Since: 4.12
|
||||
* @GDK_MEMORY_G16: One guint16 value; for grayscale. The data is opaque.
|
||||
* Since: 4.12
|
||||
* @GDK_MEMORY_A8: One byte; for alpha.
|
||||
* Since: 4.12
|
||||
* @GDK_MEMORY_A16: One guint16 value; for alpha.
|
||||
* Since: 4.12
|
||||
* @GDK_MEMORY_N_FORMATS: The number of formats. This value will change as
|
||||
* more formats get added, so do not rely on its concrete integer.
|
||||
*
|
||||
@@ -340,6 +356,14 @@ typedef enum {
|
||||
GDK_MEMORY_R32G32B32_FLOAT,
|
||||
GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED,
|
||||
GDK_MEMORY_R32G32B32A32_FLOAT,
|
||||
GDK_MEMORY_G8A8_PREMULTIPLIED GDK_AVAILABLE_ENUMERATOR_IN_4_12,
|
||||
GDK_MEMORY_G8A8 GDK_AVAILABLE_ENUMERATOR_IN_4_12,
|
||||
GDK_MEMORY_G8 GDK_AVAILABLE_ENUMERATOR_IN_4_12,
|
||||
GDK_MEMORY_G16A16_PREMULTIPLIED GDK_AVAILABLE_ENUMERATOR_IN_4_12,
|
||||
GDK_MEMORY_G16A16 GDK_AVAILABLE_ENUMERATOR_IN_4_12,
|
||||
GDK_MEMORY_G16 GDK_AVAILABLE_ENUMERATOR_IN_4_12,
|
||||
GDK_MEMORY_A8 GDK_AVAILABLE_ENUMERATOR_IN_4_12,
|
||||
GDK_MEMORY_A16 GDK_AVAILABLE_ENUMERATOR_IN_4_12,
|
||||
|
||||
GDK_MEMORY_N_FORMATS
|
||||
} GdkMemoryFormat;
|
||||
|
||||
+23
-23
@@ -466,29 +466,26 @@ gdk_gl_context_real_get_damage (GdkGLContext *context)
|
||||
eglQuerySurface (gdk_display_get_egl_display (display), egl_surface,
|
||||
EGL_BUFFER_AGE_EXT, &buffer_age);
|
||||
|
||||
switch (buffer_age)
|
||||
if (buffer_age > 0 && buffer_age <= GDK_GL_MAX_TRACKED_BUFFERS)
|
||||
{
|
||||
case 1:
|
||||
return cairo_region_create ();
|
||||
break;
|
||||
cairo_region_t *damage = cairo_region_create ();
|
||||
int i;
|
||||
|
||||
case 2:
|
||||
if (context->old_updated_area[0])
|
||||
return cairo_region_copy (context->old_updated_area[0]);
|
||||
break;
|
||||
for (i = 0; i < buffer_age - 1; i++)
|
||||
{
|
||||
if (context->old_updated_area[i] == NULL)
|
||||
{
|
||||
cairo_region_create_rectangle (&(GdkRectangle) {
|
||||
0, 0,
|
||||
gdk_surface_get_width (surface),
|
||||
gdk_surface_get_height (surface)
|
||||
});
|
||||
break;
|
||||
}
|
||||
cairo_region_union (damage, context->old_updated_area[i]);
|
||||
}
|
||||
|
||||
case 3:
|
||||
if (context->old_updated_area[0] &&
|
||||
context->old_updated_area[1])
|
||||
{
|
||||
cairo_region_t *damage = cairo_region_copy (context->old_updated_area[0]);
|
||||
cairo_region_union (damage, context->old_updated_area[1]);
|
||||
return damage;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
return damage;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -597,6 +594,7 @@ gdk_gl_context_real_begin_frame (GdkDrawContext *draw_context,
|
||||
cairo_region_t *damage;
|
||||
double scale;
|
||||
int ww, wh;
|
||||
int i;
|
||||
|
||||
surface = gdk_draw_context_get_surface (draw_context);
|
||||
scale = gdk_gl_context_get_scale (context);
|
||||
@@ -608,9 +606,11 @@ gdk_gl_context_real_begin_frame (GdkDrawContext *draw_context,
|
||||
|
||||
damage = GDK_GL_CONTEXT_GET_CLASS (context)->get_damage (context);
|
||||
|
||||
if (context->old_updated_area[1])
|
||||
cairo_region_destroy (context->old_updated_area[1]);
|
||||
context->old_updated_area[1] = context->old_updated_area[0];
|
||||
g_clear_pointer (&context->old_updated_area[GDK_GL_MAX_TRACKED_BUFFERS - 1], cairo_region_destroy);
|
||||
for (i = GDK_GL_MAX_TRACKED_BUFFERS - 1; i > 0; i--)
|
||||
{
|
||||
context->old_updated_area[i] = context->old_updated_area[i - 1];
|
||||
}
|
||||
context->old_updated_area[0] = cairo_region_copy (region);
|
||||
|
||||
cairo_region_union (region, damage);
|
||||
|
||||
@@ -34,6 +34,11 @@ typedef enum {
|
||||
GDK_GL_CGL
|
||||
} GdkGLBackend;
|
||||
|
||||
/* The maximum amount of buffers we track update regions for.
|
||||
* Note that this is equal to the max buffer age value we
|
||||
* can provide a damage region for */
|
||||
#define GDK_GL_MAX_TRACKED_BUFFERS 4
|
||||
|
||||
#define GDK_GL_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_GL_CONTEXT, GdkGLContextClass))
|
||||
#define GDK_IS_GL_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_GL_CONTEXT))
|
||||
#define GDK_GL_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_GL_CONTEXT, GdkGLContextClass))
|
||||
@@ -45,7 +50,7 @@ struct _GdkGLContext
|
||||
GdkDrawContext parent_instance;
|
||||
|
||||
/* We store the old drawn areas to support buffer-age optimizations */
|
||||
cairo_region_t *old_updated_area[2];
|
||||
cairo_region_t *old_updated_area[GDK_GL_MAX_TRACKED_BUFFERS];
|
||||
};
|
||||
|
||||
struct _GdkGLContextClass
|
||||
|
||||
+139
-15
@@ -138,6 +138,7 @@ static gboolean
|
||||
gdk_gl_texture_find_format (gboolean use_es,
|
||||
guint gl_major,
|
||||
guint gl_minor,
|
||||
GdkMemoryAlpha alpha,
|
||||
GLint gl_format,
|
||||
GLint gl_type,
|
||||
GdkMemoryFormat *out_format)
|
||||
@@ -147,8 +148,12 @@ gdk_gl_texture_find_format (gboolean use_es,
|
||||
for (format = 0; format < GDK_MEMORY_N_FORMATS; format++)
|
||||
{
|
||||
GLenum q_internal_format, q_format, q_type;
|
||||
GLint q_swizzle[4];
|
||||
|
||||
if (!gdk_memory_format_gl_format (format, use_es, gl_major, gl_minor, &q_internal_format, &q_format, &q_type))
|
||||
if (gdk_memory_format_alpha (format) != alpha)
|
||||
continue;
|
||||
|
||||
if (!gdk_memory_format_gl_format (format, use_es, gl_major, gl_minor, &q_internal_format, &q_format, &q_type, &q_swizzle))
|
||||
continue;
|
||||
|
||||
if (q_format != gl_format || q_type != gl_type)
|
||||
@@ -167,23 +172,57 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
|
||||
gpointer download_)
|
||||
{
|
||||
GdkTexture *texture = GDK_TEXTURE (self);
|
||||
GdkMemoryFormat format;
|
||||
gsize expected_stride;
|
||||
Download *download = download_;
|
||||
GLenum gl_internal_format, gl_format, gl_type;
|
||||
GLint gl_swizzle[4];
|
||||
int major, minor;
|
||||
|
||||
format = gdk_texture_get_format (texture),
|
||||
expected_stride = texture->width * gdk_memory_format_bytes_per_pixel (download->format);
|
||||
gdk_gl_context_get_version (context, &major, &minor);
|
||||
|
||||
if (download->stride == expected_stride &&
|
||||
!gdk_gl_context_get_use_es (context) &&
|
||||
gdk_memory_format_gl_format (download->format, TRUE, major, minor, &gl_internal_format, &gl_format, &gl_type))
|
||||
if (!gdk_gl_context_get_use_es (context) &&
|
||||
gdk_memory_format_gl_format (format,
|
||||
FALSE,
|
||||
major, minor,
|
||||
&gl_internal_format,
|
||||
&gl_format, &gl_type, &gl_swizzle))
|
||||
{
|
||||
glGetTexImage (GL_TEXTURE_2D,
|
||||
0,
|
||||
gl_format,
|
||||
gl_type,
|
||||
download->data);
|
||||
if (download->stride == expected_stride &&
|
||||
download->format == format)
|
||||
{
|
||||
glGetTexImage (GL_TEXTURE_2D,
|
||||
0,
|
||||
gl_format,
|
||||
gl_type,
|
||||
download->data);
|
||||
}
|
||||
else
|
||||
{
|
||||
gsize stride = texture->width * gdk_memory_format_bytes_per_pixel (format);
|
||||
guchar *pixels = g_malloc_n (stride, texture->height);
|
||||
|
||||
glPixelStorei (GL_PACK_ALIGNMENT, 1);
|
||||
glGetTexImage (GL_TEXTURE_2D,
|
||||
0,
|
||||
gl_format,
|
||||
gl_type,
|
||||
pixels);
|
||||
|
||||
gdk_memory_convert (download->data,
|
||||
download->stride,
|
||||
download->format,
|
||||
pixels,
|
||||
stride,
|
||||
format,
|
||||
texture->width,
|
||||
texture->height);
|
||||
|
||||
g_free (pixels);
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -196,17 +235,26 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
|
||||
glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, self->id, 0);
|
||||
if (gdk_gl_context_check_version (context, "4.3", "3.1"))
|
||||
{
|
||||
gdk_gl_context_get_version (context, &major, &minor);
|
||||
glGetFramebufferParameteriv (GL_FRAMEBUFFER, GL_IMPLEMENTATION_COLOR_READ_FORMAT, &gl_read_format);
|
||||
glGetFramebufferParameteriv (GL_FRAMEBUFFER, GL_IMPLEMENTATION_COLOR_READ_TYPE, &gl_read_type);
|
||||
if (!gdk_gl_texture_find_format (gdk_gl_context_get_use_es (context), major, minor, gl_read_format, gl_read_type, &actual_format))
|
||||
actual_format = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED; /* pray */
|
||||
if (!gdk_gl_texture_find_format (TRUE, major, minor, gdk_memory_format_alpha (format), gl_read_format, gl_read_type, &actual_format))
|
||||
{
|
||||
gl_read_format = GL_RGBA;
|
||||
gl_read_type = GL_UNSIGNED_BYTE;
|
||||
if (gdk_memory_format_alpha (format) == GDK_MEMORY_ALPHA_PREMULTIPLIED)
|
||||
actual_format = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED; /* pray */
|
||||
else
|
||||
actual_format = GDK_MEMORY_R8G8B8A8;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gl_read_format = GL_RGBA;
|
||||
gl_read_type = GL_UNSIGNED_BYTE;
|
||||
actual_format = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED;
|
||||
if (gdk_memory_format_alpha (format) == GDK_MEMORY_ALPHA_PREMULTIPLIED)
|
||||
actual_format = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED; /* pray */
|
||||
else
|
||||
actual_format = GDK_MEMORY_R8G8B8A8;
|
||||
}
|
||||
|
||||
if (download->format == actual_format &&
|
||||
@@ -221,19 +269,95 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
|
||||
else
|
||||
{
|
||||
gsize actual_bpp = gdk_memory_format_bytes_per_pixel (actual_format);
|
||||
guchar *pixels = g_malloc_n (texture->width * actual_bpp, texture->height);
|
||||
gsize stride = actual_bpp * texture->width;
|
||||
guchar *pixels = g_malloc_n (stride, texture->height);
|
||||
|
||||
glPixelStorei (GL_PACK_ALIGNMENT, 1);
|
||||
glReadPixels (0, 0,
|
||||
texture->width, texture->height,
|
||||
gl_read_format,
|
||||
gl_read_type,
|
||||
pixels);
|
||||
|
||||
/* Fix up gles inadequacies */
|
||||
|
||||
if (gl_read_format == GL_RGBA &&
|
||||
gl_read_type == GL_UNSIGNED_BYTE &&
|
||||
(format == GDK_MEMORY_G8A8 ||
|
||||
format == GDK_MEMORY_G8A8_PREMULTIPLIED ||
|
||||
format == GDK_MEMORY_G8 ||
|
||||
format == GDK_MEMORY_A8))
|
||||
{
|
||||
for (unsigned int y = 0; y < texture->height; y++)
|
||||
{
|
||||
for (unsigned int x = 0; x < texture->width; x++)
|
||||
{
|
||||
guchar *data = &pixels[y * stride + x * actual_bpp];
|
||||
if (format == GDK_MEMORY_G8A8 ||
|
||||
format == GDK_MEMORY_G8A8_PREMULTIPLIED)
|
||||
{
|
||||
data[3] = data[1];
|
||||
data[1] = data[0];
|
||||
data[2] = data[0];
|
||||
}
|
||||
else if (format == GDK_MEMORY_G8)
|
||||
{
|
||||
data[1] = data[0];
|
||||
data[2] = data[0];
|
||||
data[3] = 0xff;
|
||||
}
|
||||
else if (format == GDK_MEMORY_A8)
|
||||
{
|
||||
data[3] = data[0];
|
||||
data[0] = 0;
|
||||
data[1] = 0;
|
||||
data[2] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (gl_read_format == GL_RGBA &&
|
||||
gl_read_type == GL_UNSIGNED_SHORT &&
|
||||
(format == GDK_MEMORY_G16A16 ||
|
||||
format == GDK_MEMORY_G16A16_PREMULTIPLIED ||
|
||||
format == GDK_MEMORY_G16 ||
|
||||
format == GDK_MEMORY_A16))
|
||||
{
|
||||
for (unsigned int y = 0; y < texture->height; y++)
|
||||
{
|
||||
for (unsigned int x = 0; x < texture->width; x++)
|
||||
{
|
||||
guint16 *data = (guint16 *) &pixels[y * stride + x * actual_bpp];
|
||||
if (format == GDK_MEMORY_G16A16 ||
|
||||
format == GDK_MEMORY_G16A16_PREMULTIPLIED)
|
||||
{
|
||||
data[3] = data[1];
|
||||
data[1] = data[0];
|
||||
data[2] = data[0];
|
||||
}
|
||||
else if (format == GDK_MEMORY_G16)
|
||||
{
|
||||
data[1] = data[0];
|
||||
data[2] = data[0];
|
||||
data[3] = 0xffff;
|
||||
}
|
||||
else if (format == GDK_MEMORY_A16)
|
||||
{
|
||||
data[3] = data[0];
|
||||
data[0] = 0;
|
||||
data[1] = 0;
|
||||
data[2] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gdk_memory_convert (download->data,
|
||||
download->stride,
|
||||
download->format,
|
||||
pixels,
|
||||
texture->width * actual_bpp,
|
||||
stride,
|
||||
actual_format,
|
||||
texture->width,
|
||||
texture->height);
|
||||
|
||||
@@ -644,10 +644,18 @@ gdk_gl_texture_builder_get_format (GdkGLTextureBuilder *self)
|
||||
* The format is the preferred format the texture data should be downloaded to. The
|
||||
* format must be supported by the GL version of [property@Gdk.GLTextureBuilder:context].
|
||||
*
|
||||
* GDK's texture download code assumes that the format corresponds to the storage
|
||||
* parameters of the GL texture in an obvious way. For example, a format of
|
||||
* `GDK_MEMORY_R16G16B16A16_PREMULTIPLIED` is expected to be stored as `GL_RGBA16`
|
||||
* texture, and `GDK_MEMORY_G8A8` is expected to be stored as `GL_RG8` texture.
|
||||
*
|
||||
* Setting the right format is particularly useful when using high bit depth textures
|
||||
* to preserve the bit depth, to set the correct value for unpremultiplied textures
|
||||
* and to make sure opaque textures are treated as such.
|
||||
*
|
||||
* Non-RGBA textures need to have swizzling parameters set up properly to be usable
|
||||
* in GSK's shaders.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
void
|
||||
|
||||
+141
-22
@@ -60,6 +60,36 @@ name ## _from_float (guchar *dest_data, \
|
||||
} \
|
||||
}
|
||||
|
||||
#define TYPED_GRAY_FUNCS(name, T, G, A, bpp, scale) \
|
||||
static void \
|
||||
name ## _to_float (float *dest, \
|
||||
const guchar *src_data, \
|
||||
gsize n) \
|
||||
{ \
|
||||
for (gsize i = 0; i < n; i++) \
|
||||
{ \
|
||||
T *src = (T *) (src_data + i * bpp); \
|
||||
if (G >= 0) dest[0] = (float) src[G] / scale; else dest[0] = 1.0; \
|
||||
dest[1] = dest[2] = dest[0]; \
|
||||
if (A >= 0) dest[3] = (float) src[A] / scale; else dest[3] = 1.0; \
|
||||
dest += 4; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
static void \
|
||||
name ## _from_float (guchar *dest_data, \
|
||||
const float *src, \
|
||||
gsize n) \
|
||||
{ \
|
||||
for (gsize i = 0; i < n; i++) \
|
||||
{ \
|
||||
T *dest = (T *) (dest_data + i * bpp); \
|
||||
if (G >= 0) dest[G] = CLAMP ((src[0] + src[1] + src[2]) * scale / 3.f + 0.5, 0, scale); \
|
||||
if (A >= 0) dest[A] = CLAMP (src[3] * scale + 0.5, 0, scale); \
|
||||
src += 4; \
|
||||
} \
|
||||
}
|
||||
|
||||
TYPED_FUNCS (b8g8r8a8_premultiplied, guchar, 2, 1, 0, 3, 4, 255)
|
||||
TYPED_FUNCS (a8r8g8b8_premultiplied, guchar, 1, 2, 3, 0, 4, 255)
|
||||
TYPED_FUNCS (r8g8b8a8_premultiplied, guchar, 0, 1, 2, 3, 4, 255)
|
||||
@@ -72,6 +102,15 @@ TYPED_FUNCS (b8g8r8, guchar, 2, 1, 0, -1, 3, 255)
|
||||
TYPED_FUNCS (r16g16b16, guint16, 0, 1, 2, -1, 6, 65535)
|
||||
TYPED_FUNCS (r16g16b16a16, guint16, 0, 1, 2, 3, 8, 65535)
|
||||
|
||||
TYPED_GRAY_FUNCS (g8a8_premultiplied, guchar, 0, 1, 2, 255)
|
||||
TYPED_GRAY_FUNCS (g8a8, guchar, 0, 1, 2, 255)
|
||||
TYPED_GRAY_FUNCS (g8, guchar, 0, -1, 1, 255)
|
||||
TYPED_GRAY_FUNCS (a8, guchar, -1, 0, 1, 255)
|
||||
TYPED_GRAY_FUNCS (g16a16_premultiplied, guint16, 0, 1, 4, 65535)
|
||||
TYPED_GRAY_FUNCS (g16a16, guint16, 0, 1, 4, 65535)
|
||||
TYPED_GRAY_FUNCS (g16, guint16, 0, -1, 2, 65535)
|
||||
TYPED_GRAY_FUNCS (a16, guint16, -1, 0, 2, 65535)
|
||||
|
||||
static void
|
||||
r16g16b16_float_to_float (float *dest,
|
||||
const guchar *src_data,
|
||||
@@ -230,6 +269,7 @@ struct _GdkMemoryFormatDescription
|
||||
guint internal_format;
|
||||
guint format;
|
||||
guint type;
|
||||
GLint swizzle[4];
|
||||
} gl;
|
||||
/* no premultiplication going on here */
|
||||
void (* to_float) (float *, const guchar*, gsize);
|
||||
@@ -251,7 +291,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
||||
G_ALIGNOF (guchar),
|
||||
FALSE,
|
||||
{ 0, 0, G_MAXUINT, G_MAXUINT },
|
||||
{ GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE },
|
||||
{ GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
|
||||
b8g8r8a8_premultiplied_to_float,
|
||||
b8g8r8a8_premultiplied_from_float,
|
||||
},
|
||||
@@ -261,7 +301,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
||||
G_ALIGNOF (guchar),
|
||||
FALSE,
|
||||
{ 0, 0, G_MAXUINT, G_MAXUINT },
|
||||
{ GL_RGBA8, GL_BGRA, GDK_GL_UNSIGNED_BYTE_FLIPPED },
|
||||
{ GL_RGBA8, GL_BGRA, GDK_GL_UNSIGNED_BYTE_FLIPPED, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
|
||||
a8r8g8b8_premultiplied_to_float,
|
||||
a8r8g8b8_premultiplied_from_float,
|
||||
},
|
||||
@@ -271,7 +311,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
||||
G_ALIGNOF (guchar),
|
||||
FALSE,
|
||||
{ 0, 0, 0, 0 },
|
||||
{ GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE },
|
||||
{ GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
|
||||
r8g8b8a8_premultiplied_to_float,
|
||||
r8g8b8a8_premultiplied_from_float,
|
||||
},
|
||||
@@ -281,7 +321,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
||||
G_ALIGNOF (guchar),
|
||||
FALSE,
|
||||
{ 0, 0, G_MAXUINT, G_MAXUINT },
|
||||
{ GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE },
|
||||
{ GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
|
||||
b8g8r8a8_to_float,
|
||||
b8g8r8a8_from_float,
|
||||
},
|
||||
@@ -291,7 +331,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
||||
G_ALIGNOF (guchar),
|
||||
FALSE,
|
||||
{ 0, 0, G_MAXUINT, G_MAXUINT },
|
||||
{ GL_RGBA8, GL_RGBA, GDK_GL_UNSIGNED_BYTE_FLIPPED },
|
||||
{ GL_RGBA8, GL_RGBA, GDK_GL_UNSIGNED_BYTE_FLIPPED, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
|
||||
a8r8g8b8_to_float,
|
||||
a8r8g8b8_from_float,
|
||||
},
|
||||
@@ -301,7 +341,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
||||
G_ALIGNOF (guchar),
|
||||
FALSE,
|
||||
{ 0, 0, 0, 0 },
|
||||
{ GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE },
|
||||
{ GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
|
||||
r8g8b8a8_to_float,
|
||||
r8g8b8a8_from_float,
|
||||
},
|
||||
@@ -311,7 +351,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
||||
G_ALIGNOF (guchar),
|
||||
FALSE,
|
||||
{ 0, 0, G_MAXUINT, G_MAXUINT },
|
||||
{ GL_RGBA8, GL_BGRA, GDK_GL_UNSIGNED_BYTE_FLIPPED },
|
||||
{ GL_RGBA8, GL_BGRA, GDK_GL_UNSIGNED_BYTE_FLIPPED, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
|
||||
a8b8g8r8_to_float,
|
||||
a8b8g8r8_from_float,
|
||||
},
|
||||
@@ -321,7 +361,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
||||
G_ALIGNOF (guchar),
|
||||
FALSE,
|
||||
{ 0, 0, 0, 0 },
|
||||
{ GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE },
|
||||
{ GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
|
||||
r8g8b8_to_float,
|
||||
r8g8b8_from_float,
|
||||
},
|
||||
@@ -331,7 +371,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
||||
G_ALIGNOF (guchar),
|
||||
FALSE,
|
||||
{ 0, 0, G_MAXUINT, G_MAXUINT },
|
||||
{ GL_RGB8, GL_BGR, GL_UNSIGNED_BYTE },
|
||||
{ GL_RGB8, GL_BGR, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
|
||||
b8g8r8_to_float,
|
||||
b8g8r8_from_float,
|
||||
},
|
||||
@@ -341,7 +381,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
||||
G_ALIGNOF (guint16),
|
||||
TRUE,
|
||||
{ 0, 0, 3, 0 },
|
||||
{ GL_RGB16, GL_RGB, GL_UNSIGNED_SHORT },
|
||||
{ GL_RGB16, GL_RGB, GL_UNSIGNED_SHORT, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
|
||||
r16g16b16_to_float,
|
||||
r16g16b16_from_float,
|
||||
},
|
||||
@@ -351,7 +391,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
||||
G_ALIGNOF (guint16),
|
||||
TRUE,
|
||||
{ 0, 0, 3, 0 },
|
||||
{ GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT },
|
||||
{ GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
|
||||
r16g16b16a16_to_float,
|
||||
r16g16b16a16_from_float,
|
||||
},
|
||||
@@ -361,7 +401,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
||||
G_ALIGNOF (guint16),
|
||||
TRUE,
|
||||
{ 0, 0, 3, 0 },
|
||||
{ GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT },
|
||||
{ GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
|
||||
r16g16b16a16_to_float,
|
||||
r16g16b16a16_from_float,
|
||||
},
|
||||
@@ -371,7 +411,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
||||
G_ALIGNOF (guint16),
|
||||
TRUE,
|
||||
{ 0, 0, 3, 0 },
|
||||
{ GL_RGB16F, GL_RGB, GL_HALF_FLOAT },
|
||||
{ GL_RGB16F, GL_RGB, GL_HALF_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
|
||||
r16g16b16_float_to_float,
|
||||
r16g16b16_float_from_float,
|
||||
},
|
||||
@@ -381,7 +421,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
||||
G_ALIGNOF (guint16),
|
||||
TRUE,
|
||||
{ 0, 0, 3, 0 },
|
||||
{ GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT },
|
||||
{ GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
|
||||
r16g16b16a16_float_to_float,
|
||||
r16g16b16a16_float_from_float,
|
||||
},
|
||||
@@ -391,7 +431,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
||||
G_ALIGNOF (guint16),
|
||||
TRUE,
|
||||
{ 0, 0, 3, 0 },
|
||||
{ GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT },
|
||||
{ GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
|
||||
r16g16b16a16_float_to_float,
|
||||
r16g16b16a16_float_from_float,
|
||||
},
|
||||
@@ -401,7 +441,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
||||
G_ALIGNOF (float),
|
||||
TRUE,
|
||||
{ 0, 0, 3, 0 },
|
||||
{ GL_RGB32F, GL_RGB, GL_FLOAT },
|
||||
{ GL_RGB32F, GL_RGB, GL_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
|
||||
r32g32b32_float_to_float,
|
||||
r32g32b32_float_from_float,
|
||||
},
|
||||
@@ -411,7 +451,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
||||
G_ALIGNOF (float),
|
||||
TRUE,
|
||||
{ 0, 0, 3, 0 },
|
||||
{ GL_RGBA32F, GL_RGBA, GL_FLOAT },
|
||||
{ GL_RGBA32F, GL_RGBA, GL_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
|
||||
r32g32b32a32_float_to_float,
|
||||
r32g32b32a32_float_from_float,
|
||||
},
|
||||
@@ -421,9 +461,89 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
||||
G_ALIGNOF (float),
|
||||
TRUE,
|
||||
{ 0, 0, 3, 0 },
|
||||
{ GL_RGBA32F, GL_RGBA, GL_FLOAT },
|
||||
{ GL_RGBA32F, GL_RGBA, GL_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
|
||||
r32g32b32a32_float_to_float,
|
||||
r32g32b32a32_float_from_float,
|
||||
},
|
||||
[GDK_MEMORY_G8A8_PREMULTIPLIED] = {
|
||||
GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
2,
|
||||
G_ALIGNOF (guchar),
|
||||
FALSE,
|
||||
{ 0, 0, 3, 0 },
|
||||
{ GL_RG8, GL_RG, GL_UNSIGNED_BYTE, { GL_RED, GL_RED, GL_RED, GL_GREEN } },
|
||||
g8a8_premultiplied_to_float,
|
||||
g8a8_premultiplied_from_float,
|
||||
},
|
||||
[GDK_MEMORY_G8A8] = {
|
||||
GDK_MEMORY_ALPHA_STRAIGHT,
|
||||
2,
|
||||
G_ALIGNOF (guchar),
|
||||
FALSE,
|
||||
{ 0, 0, 3, 0 },
|
||||
{ GL_RG8, GL_RG, GL_UNSIGNED_BYTE, { GL_RED, GL_RED, GL_RED, GL_GREEN } },
|
||||
g8a8_to_float,
|
||||
g8a8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_G8] = {
|
||||
GDK_MEMORY_ALPHA_OPAQUE,
|
||||
1,
|
||||
G_ALIGNOF (guchar),
|
||||
FALSE,
|
||||
{ 0, 0, 3, 0 },
|
||||
{ GL_R8, GL_RED, GL_UNSIGNED_BYTE, { GL_RED, GL_RED, GL_RED, GL_ONE } },
|
||||
g8_to_float,
|
||||
g8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_G16A16_PREMULTIPLIED] = {
|
||||
GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
4,
|
||||
G_ALIGNOF (guint16),
|
||||
TRUE,
|
||||
{ 0, 0, 3, 0 },
|
||||
{ GL_RG16, GL_RG, GL_UNSIGNED_SHORT, { GL_RED, GL_RED, GL_RED, GL_GREEN } },
|
||||
g16a16_premultiplied_to_float,
|
||||
g16a16_premultiplied_from_float,
|
||||
},
|
||||
[GDK_MEMORY_G16A16] = {
|
||||
GDK_MEMORY_ALPHA_STRAIGHT,
|
||||
4,
|
||||
G_ALIGNOF (guint16),
|
||||
TRUE,
|
||||
{ 0, 0, 3, 0 },
|
||||
{ GL_RG16, GL_RG, GL_UNSIGNED_SHORT, { GL_RED, GL_RED, GL_RED, GL_GREEN } },
|
||||
g16a16_to_float,
|
||||
g16a16_from_float,
|
||||
},
|
||||
[GDK_MEMORY_G16] = {
|
||||
GDK_MEMORY_ALPHA_OPAQUE,
|
||||
2,
|
||||
G_ALIGNOF (guint16),
|
||||
TRUE,
|
||||
{ 0, 0, 3, 0 },
|
||||
{ GL_R16, GL_RED, GL_UNSIGNED_SHORT, { GL_RED, GL_RED, GL_RED, GL_ONE } },
|
||||
g16_to_float,
|
||||
g16_from_float,
|
||||
},
|
||||
[GDK_MEMORY_A8] = {
|
||||
GDK_MEMORY_ALPHA_STRAIGHT,
|
||||
1,
|
||||
G_ALIGNOF (guchar),
|
||||
FALSE,
|
||||
{ 0, 0, 3, 0 },
|
||||
{ GL_R8, GL_RED, GL_UNSIGNED_BYTE, { GL_ONE, GL_ONE, GL_ONE, GL_RED } },
|
||||
a8_to_float,
|
||||
a8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_A16] = {
|
||||
GDK_MEMORY_ALPHA_STRAIGHT,
|
||||
2,
|
||||
G_ALIGNOF (guint16),
|
||||
TRUE,
|
||||
{ 0, 0, 3, 0 },
|
||||
{ GL_R16, GL_RED, GL_UNSIGNED_SHORT, { GL_ONE, GL_ONE, GL_ONE, GL_RED } },
|
||||
a16_to_float,
|
||||
a16_from_float,
|
||||
}
|
||||
};
|
||||
|
||||
@@ -472,14 +592,13 @@ gdk_memory_format_gl_format (GdkMemoryFormat format,
|
||||
guint gl_minor,
|
||||
guint *out_internal_format,
|
||||
guint *out_format,
|
||||
guint *out_type)
|
||||
guint *out_type,
|
||||
GLint (*out_swizzle)[4])
|
||||
{
|
||||
*out_internal_format = memory_formats[format].gl.internal_format;
|
||||
*out_format = memory_formats[format].gl.format;
|
||||
*out_type = memory_formats[format].gl.type;
|
||||
|
||||
if (memory_formats[format].alpha == GDK_MEMORY_ALPHA_STRAIGHT)
|
||||
return FALSE;
|
||||
memcpy (out_swizzle, &memory_formats[format].gl.swizzle, sizeof(GLint) * 4);
|
||||
|
||||
if (gles)
|
||||
{
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
#include "gdkenums.h"
|
||||
|
||||
#include <epoxy/gl.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef enum {
|
||||
@@ -39,7 +41,8 @@ gboolean gdk_memory_format_gl_format (GdkMemoryFormat
|
||||
guint gl_minor,
|
||||
guint *out_internal_format,
|
||||
guint *out_format,
|
||||
guint *out_type);
|
||||
guint *out_type,
|
||||
GLint (*out_gizzle)[4]);
|
||||
|
||||
void gdk_memory_convert (guchar *dest_data,
|
||||
gsize dest_stride,
|
||||
|
||||
+3
-1
@@ -170,7 +170,7 @@ parse_rgb_value (const char *str,
|
||||
*
|
||||
* The string can be either one of:
|
||||
*
|
||||
* - A standard name (Taken from the Css specification).
|
||||
* - A standard name (Taken from the CSS specification).
|
||||
* - A hexadecimal value in the form “\#rgb”, “\#rrggbb”,
|
||||
* “\#rrrgggbbb” or ”\#rrrrggggbbbb”
|
||||
* - A hexadecimal value in the form “\#rgba”, “\#rrggbbaa”,
|
||||
@@ -178,6 +178,8 @@ parse_rgb_value (const char *str,
|
||||
* - A RGB color in the form “rgb(r,g,b)” (In this case the color
|
||||
* will have full opacity)
|
||||
* - A RGBA color in the form “rgba(r,g,b,a)”
|
||||
* - A HSL color in the form "hsl(hue, saturation, lightness)"
|
||||
* - A HSLA color in the form "hsla(hue, saturation, lightness, alpha)"
|
||||
*
|
||||
* Where “r”, “g”, “b” and “a” are respectively the red, green,
|
||||
* blue and alpha color values. In the last two cases, “r”, “g”,
|
||||
|
||||
@@ -225,17 +225,17 @@ gdk_texture_downloader_download_into (const GdkTextureDownloader *self,
|
||||
/**
|
||||
* gdk_texture_downloader_download_bytes:
|
||||
* @self: the downloader
|
||||
* @out_stride: (out): The stride of the resulting data in bytes.
|
||||
* @out_stride: (out): The stride of the resulting data in bytes
|
||||
*
|
||||
* Downloads the given texture pixels into a `GBytes`. The rowstride will
|
||||
* be stored in the stride value.
|
||||
*
|
||||
* This function will abort if it tries to download a large texture and
|
||||
* fails to allocate memory. If you think that may happen, you should
|
||||
* handle memory allocation yourself and use
|
||||
* gdk_texture_downloader_download_into() once allocation succeeded.
|
||||
* fails to allocate memory. If you think that may happen, you should handle
|
||||
* memory allocation yourself and use [method@Gdk.TextureDownloader.download_into]
|
||||
* once allocation succeeded.
|
||||
*
|
||||
* Returns: The downloaded pixels.
|
||||
* Returns: The downloaded pixels
|
||||
*
|
||||
* Since: 4.10
|
||||
**/
|
||||
|
||||
+7
-4
@@ -135,7 +135,8 @@ gdk_toplevel_default_export_handle_finish (GdkToplevel *toplevel,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_toplevel_default_unexport_handle (GdkToplevel *toplevel)
|
||||
gdk_toplevel_default_unexport_handle (GdkToplevel *toplevel,
|
||||
const char *handle)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -791,7 +792,7 @@ gdk_toplevel_export_handle (GdkToplevel *toplevel,
|
||||
* @result: the `GAsyncResult`
|
||||
* @error: return location for an error
|
||||
*
|
||||
* Finishes the [method@Gdk.Toplevel.export_handle] cal and
|
||||
* Finishes the [method@Gdk.Toplevel.export_handle] call and
|
||||
* returns the resulting handle.
|
||||
*
|
||||
* Returns: (nullable) (transfer full): the exported handle,
|
||||
@@ -810,6 +811,7 @@ gdk_toplevel_export_handle_finish (GdkToplevel *toplevel,
|
||||
/*< private >
|
||||
* gdk_toplevel_unexport_handle:
|
||||
* @toplevel: a `GdkToplevel`
|
||||
* @handle: the handle to unexport
|
||||
*
|
||||
* Destroys the handle that was obtained with [method@Gdk.Toplevel.export_handle].
|
||||
*
|
||||
@@ -819,7 +821,8 @@ gdk_toplevel_export_handle_finish (GdkToplevel *toplevel,
|
||||
* Since: 4.10
|
||||
*/
|
||||
void
|
||||
gdk_toplevel_unexport_handle (GdkToplevel *toplevel)
|
||||
gdk_toplevel_unexport_handle (GdkToplevel *toplevel,
|
||||
const char *handle)
|
||||
{
|
||||
GDK_TOPLEVEL_GET_IFACE (toplevel)->unexport_handle (toplevel);
|
||||
GDK_TOPLEVEL_GET_IFACE (toplevel)->unexport_handle (toplevel, handle);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,8 @@ struct _GdkToplevelInterface
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
void (* unexport_handle) (GdkToplevel *toplevel);
|
||||
void (* unexport_handle) (GdkToplevel *toplevel,
|
||||
const char *handle);
|
||||
};
|
||||
|
||||
typedef enum
|
||||
@@ -82,7 +83,8 @@ char *gdk_toplevel_export_handle_finish (GdkToplevel *toplevel,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
void gdk_toplevel_unexport_handle (GdkToplevel *toplevel);
|
||||
void gdk_toplevel_unexport_handle (GdkToplevel *toplevel,
|
||||
const char *handle);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
+49
-6
@@ -183,8 +183,7 @@ gdk_load_png (GBytes *bytes,
|
||||
if (color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
png_set_palette_to_rgb (png);
|
||||
|
||||
if (color_type == PNG_COLOR_TYPE_GRAY ||
|
||||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||
if (color_type == PNG_COLOR_TYPE_GRAY)
|
||||
png_set_expand_gray_1_2_4_to_8 (png);
|
||||
|
||||
if (png_get_valid (png, info, PNG_INFO_tRNS))
|
||||
@@ -193,10 +192,6 @@ gdk_load_png (GBytes *bytes,
|
||||
if (depth < 8)
|
||||
png_set_packing (png);
|
||||
|
||||
if (color_type == PNG_COLOR_TYPE_GRAY ||
|
||||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||
png_set_gray_to_rgb (png);
|
||||
|
||||
if (interlace != PNG_INTERLACE_NONE)
|
||||
png_set_interlace_handling (png);
|
||||
|
||||
@@ -239,6 +234,26 @@ gdk_load_png (GBytes *bytes,
|
||||
format = GDK_MEMORY_R16G16B16;
|
||||
}
|
||||
break;
|
||||
case PNG_COLOR_TYPE_GRAY:
|
||||
if (depth == 8)
|
||||
{
|
||||
format = GDK_MEMORY_G8;
|
||||
}
|
||||
else if (depth == 16)
|
||||
{
|
||||
format = GDK_MEMORY_G16;
|
||||
}
|
||||
break;
|
||||
case PNG_COLOR_TYPE_GRAY_ALPHA:
|
||||
if (depth == 8)
|
||||
{
|
||||
format = GDK_MEMORY_G8A8;
|
||||
}
|
||||
else if (depth == 16)
|
||||
{
|
||||
format = GDK_MEMORY_G16A16;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
png_destroy_read_struct (&png, &info, NULL);
|
||||
g_set_error (error,
|
||||
@@ -349,6 +364,34 @@ gdk_save_png (GdkTexture *texture)
|
||||
depth = 16;
|
||||
break;
|
||||
|
||||
case GDK_MEMORY_G8:
|
||||
format = GDK_MEMORY_G8;
|
||||
png_format = PNG_COLOR_TYPE_GRAY;
|
||||
depth = 8;
|
||||
break;
|
||||
|
||||
case GDK_MEMORY_G8A8_PREMULTIPLIED:
|
||||
case GDK_MEMORY_G8A8:
|
||||
case GDK_MEMORY_A8:
|
||||
format = GDK_MEMORY_G8A8;
|
||||
png_format = PNG_COLOR_TYPE_GRAY_ALPHA;
|
||||
depth = 8;
|
||||
break;
|
||||
|
||||
case GDK_MEMORY_G16:
|
||||
format = GDK_MEMORY_G16;
|
||||
png_format = PNG_COLOR_TYPE_GRAY;
|
||||
depth = 16;
|
||||
break;
|
||||
|
||||
case GDK_MEMORY_G16A16_PREMULTIPLIED:
|
||||
case GDK_MEMORY_G16A16:
|
||||
case GDK_MEMORY_A16:
|
||||
format = GDK_MEMORY_G16A16;
|
||||
png_format = PNG_COLOR_TYPE_GRAY_ALPHA;
|
||||
depth = 16;
|
||||
break;
|
||||
|
||||
case GDK_MEMORY_N_FORMATS:
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
|
||||
+32
-22
@@ -229,27 +229,36 @@ struct _FormatData {
|
||||
guint16 samples_per_pixel;
|
||||
guint16 sample_format;
|
||||
guint16 alpha_samples;
|
||||
guint16 photometric;
|
||||
};
|
||||
|
||||
static const FormatData format_data[] = {
|
||||
[GDK_MEMORY_B8G8R8A8_PREMULTIPLIED] = { GDK_MEMORY_R8G8B8A8_PREMULTIPLIED, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_ASSOCALPHA },
|
||||
[GDK_MEMORY_A8R8G8B8_PREMULTIPLIED] = { GDK_MEMORY_R8G8B8A8_PREMULTIPLIED, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_ASSOCALPHA },
|
||||
[GDK_MEMORY_R8G8B8A8_PREMULTIPLIED] = { GDK_MEMORY_R8G8B8A8_PREMULTIPLIED, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_ASSOCALPHA },
|
||||
[GDK_MEMORY_B8G8R8A8] = { GDK_MEMORY_R8G8B8A8, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA },
|
||||
[GDK_MEMORY_A8R8G8B8] = { GDK_MEMORY_R8G8B8A8, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA },
|
||||
[GDK_MEMORY_R8G8B8A8] = { GDK_MEMORY_R8G8B8A8, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA },
|
||||
[GDK_MEMORY_A8B8G8R8] = { GDK_MEMORY_R8G8B8A8, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA },
|
||||
[GDK_MEMORY_R8G8B8] = { GDK_MEMORY_R8G8B8, 8, 3, SAMPLEFORMAT_UINT, 0 },
|
||||
[GDK_MEMORY_B8G8R8] = { GDK_MEMORY_R8G8B8, 8, 3, SAMPLEFORMAT_UINT, 0 },
|
||||
[GDK_MEMORY_R16G16B16] = { GDK_MEMORY_R16G16B16, 16, 3, SAMPLEFORMAT_UINT, 0 },
|
||||
[GDK_MEMORY_R16G16B16A16_PREMULTIPLIED] = { GDK_MEMORY_R16G16B16A16_PREMULTIPLIED, 16, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_ASSOCALPHA },
|
||||
[GDK_MEMORY_R16G16B16A16] = { GDK_MEMORY_R16G16B16A16, 16, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA },
|
||||
[GDK_MEMORY_R16G16B16_FLOAT] = { GDK_MEMORY_R16G16B16_FLOAT, 16, 3, SAMPLEFORMAT_IEEEFP, 0 },
|
||||
[GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED] = { GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED, 16, 4, SAMPLEFORMAT_IEEEFP, EXTRASAMPLE_ASSOCALPHA },
|
||||
[GDK_MEMORY_R16G16B16A16_FLOAT] = { GDK_MEMORY_R16G16B16A16_FLOAT, 16, 4, SAMPLEFORMAT_IEEEFP, EXTRASAMPLE_UNASSALPHA },
|
||||
[GDK_MEMORY_R32G32B32_FLOAT] = { GDK_MEMORY_R32G32B32_FLOAT, 32, 3, SAMPLEFORMAT_IEEEFP, 0 },
|
||||
[GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED] = { GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED, 32, 4, SAMPLEFORMAT_IEEEFP, EXTRASAMPLE_ASSOCALPHA },
|
||||
[GDK_MEMORY_R32G32B32A32_FLOAT] = { GDK_MEMORY_R32G32B32A32_FLOAT, 32, 4, SAMPLEFORMAT_IEEEFP, EXTRASAMPLE_UNASSALPHA },
|
||||
[GDK_MEMORY_B8G8R8A8_PREMULTIPLIED] = { GDK_MEMORY_R8G8B8A8_PREMULTIPLIED, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_ASSOCALPHA, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_A8R8G8B8_PREMULTIPLIED] = { GDK_MEMORY_R8G8B8A8_PREMULTIPLIED, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_ASSOCALPHA, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_R8G8B8A8_PREMULTIPLIED] = { GDK_MEMORY_R8G8B8A8_PREMULTIPLIED, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_ASSOCALPHA, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_B8G8R8A8] = { GDK_MEMORY_R8G8B8A8, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_A8R8G8B8] = { GDK_MEMORY_R8G8B8A8, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_R8G8B8A8] = { GDK_MEMORY_R8G8B8A8, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_A8B8G8R8] = { GDK_MEMORY_R8G8B8A8, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_R8G8B8] = { GDK_MEMORY_R8G8B8, 8, 3, SAMPLEFORMAT_UINT, 0, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_B8G8R8] = { GDK_MEMORY_R8G8B8, 8, 3, SAMPLEFORMAT_UINT, 0, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_R16G16B16] = { GDK_MEMORY_R16G16B16, 16, 3, SAMPLEFORMAT_UINT, 0, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_R16G16B16A16_PREMULTIPLIED] = { GDK_MEMORY_R16G16B16A16_PREMULTIPLIED, 16, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_ASSOCALPHA, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_R16G16B16A16] = { GDK_MEMORY_R16G16B16A16, 16, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_R16G16B16_FLOAT] = { GDK_MEMORY_R16G16B16_FLOAT, 16, 3, SAMPLEFORMAT_IEEEFP, 0, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED] = { GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED, 16, 4, SAMPLEFORMAT_IEEEFP, EXTRASAMPLE_ASSOCALPHA, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_R16G16B16A16_FLOAT] = { GDK_MEMORY_R16G16B16A16_FLOAT, 16, 4, SAMPLEFORMAT_IEEEFP, EXTRASAMPLE_UNASSALPHA, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_R32G32B32_FLOAT] = { GDK_MEMORY_R32G32B32_FLOAT, 32, 3, SAMPLEFORMAT_IEEEFP, 0, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED] = { GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED, 32, 4, SAMPLEFORMAT_IEEEFP, EXTRASAMPLE_ASSOCALPHA, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_R32G32B32A32_FLOAT] = { GDK_MEMORY_R32G32B32A32_FLOAT, 32, 4, SAMPLEFORMAT_IEEEFP, EXTRASAMPLE_UNASSALPHA, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_G8A8_PREMULTIPLIED] = { GDK_MEMORY_G8A8_PREMULTIPLIED, 8, 2, SAMPLEFORMAT_UINT, EXTRASAMPLE_ASSOCALPHA, PHOTOMETRIC_MINISBLACK },
|
||||
[GDK_MEMORY_G8A8] = { GDK_MEMORY_G8A8, 8, 2, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA, PHOTOMETRIC_MINISBLACK },
|
||||
[GDK_MEMORY_G8] = { GDK_MEMORY_G8, 8, 1, SAMPLEFORMAT_UINT, 0, PHOTOMETRIC_MINISBLACK },
|
||||
[GDK_MEMORY_G16A16_PREMULTIPLIED] = { GDK_MEMORY_G16A16_PREMULTIPLIED, 16, 2, SAMPLEFORMAT_UINT, EXTRASAMPLE_ASSOCALPHA, PHOTOMETRIC_MINISBLACK },
|
||||
[GDK_MEMORY_G16A16] = { GDK_MEMORY_G16A16, 16, 2, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA, PHOTOMETRIC_MINISBLACK },
|
||||
[GDK_MEMORY_G16] = { GDK_MEMORY_G16, 16, 1, SAMPLEFORMAT_UINT, 0, PHOTOMETRIC_MINISBLACK },
|
||||
[GDK_MEMORY_A8] = { GDK_MEMORY_G8A8, 8, 2, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA, PHOTOMETRIC_MINISBLACK },
|
||||
[GDK_MEMORY_A16] = { GDK_MEMORY_G16A16, 16, 2, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA, PHOTOMETRIC_MINISBLACK },
|
||||
};
|
||||
|
||||
/* if this fails, somebody forgot to add formats above */
|
||||
@@ -289,7 +298,7 @@ gdk_save_tiff (GdkTexture *texture)
|
||||
if (fdata->alpha_samples)
|
||||
TIFFSetField (tif, TIFFTAG_EXTRASAMPLES, 1, &fdata->alpha_samples);
|
||||
|
||||
TIFFSetField (tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
|
||||
TIFFSetField (tif, TIFFTAG_PHOTOMETRIC, fdata->photometric);
|
||||
TIFFSetField (tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
|
||||
|
||||
gdk_texture_downloader_init (&downloader, texture);
|
||||
@@ -397,7 +406,7 @@ gdk_load_tiff (GBytes *input_bytes,
|
||||
TIFFGetFieldDefaulted (tif, TIFFTAG_IMAGEWIDTH, &width);
|
||||
TIFFGetFieldDefaulted (tif, TIFFTAG_IMAGELENGTH, &height);
|
||||
|
||||
if (samples_per_pixel == 4)
|
||||
if (samples_per_pixel == 2 || samples_per_pixel == 4)
|
||||
{
|
||||
guint16 extra;
|
||||
guint16 *extra_types;
|
||||
@@ -426,14 +435,15 @@ gdk_load_tiff (GBytes *input_bytes,
|
||||
if (format_data[format].sample_format == sample_format &&
|
||||
format_data[format].bits_per_sample == bits_per_sample &&
|
||||
format_data[format].samples_per_pixel == samples_per_pixel &&
|
||||
format_data[format].alpha_samples == alpha_samples)
|
||||
format_data[format].alpha_samples == alpha_samples &&
|
||||
format_data[format].photometric == photometric)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (format == G_N_ELEMENTS(format_data) ||
|
||||
photometric != PHOTOMETRIC_RGB ||
|
||||
(photometric != PHOTOMETRIC_RGB && photometric != PHOTOMETRIC_MINISBLACK) ||
|
||||
planarconfig != PLANARCONFIG_CONTIG ||
|
||||
TIFFIsTiled (tif) ||
|
||||
orientation != ORIENTATION_TOPLEFT)
|
||||
|
||||
@@ -344,14 +344,14 @@ create_pixel_format (GdkGLVersion *version,
|
||||
if (gdk_gl_version_get_major (version) >= 4)
|
||||
{
|
||||
attrs[1] = (CGLPixelFormatAttribute)kCGLOGLPVersion_GL4_Core;
|
||||
if (CGLChoosePixelFormat (attrs, &format, &n_format))
|
||||
if (CHECK (error, CGLChoosePixelFormat (attrs, &format, &n_format)))
|
||||
return g_steal_pointer (&format);
|
||||
}
|
||||
|
||||
if (gdk_gl_version_greater_equal (version, &GDK_GL_MIN_GL_VERSION))
|
||||
{
|
||||
attrs[1] = (CGLPixelFormatAttribute)kCGLOGLPVersion_GL3_Core;
|
||||
if (CGLChoosePixelFormat (attrs, &format, &n_format))
|
||||
if (CHECK (error, CGLChoosePixelFormat (attrs, &format, &n_format)))
|
||||
return g_steal_pointer (&format);
|
||||
}
|
||||
|
||||
@@ -396,7 +396,7 @@ gdk_macos_gl_context_real_realize (GdkGLContext *context,
|
||||
gdk_gl_context_get_matching_version (context,
|
||||
GDK_GL_API_GL,
|
||||
FALSE,
|
||||
&version);
|
||||
&min_version);
|
||||
|
||||
display = gdk_gl_context_get_display (context);
|
||||
shared = gdk_display_get_gl_context (display);
|
||||
|
||||
+4
-3
@@ -1,3 +1,5 @@
|
||||
subdir('deprecated')
|
||||
|
||||
gdk_public_sources = files([
|
||||
'gdk.c',
|
||||
'gdkapplaunchcontext.c',
|
||||
@@ -38,7 +40,6 @@ gdk_public_sources = files([
|
||||
'gdkmonitor.c',
|
||||
'gdkpaintable.c',
|
||||
'gdkpango.c',
|
||||
'gdkpixbuf.c',
|
||||
'gdkpipeiostream.c',
|
||||
'gdkrectangle.c',
|
||||
'gdkrgba.c',
|
||||
@@ -94,7 +95,6 @@ gdk_public_headers = files([
|
||||
'gdkmonitor.h',
|
||||
'gdkpaintable.h',
|
||||
'gdkpango.h',
|
||||
'gdkpixbuf.h',
|
||||
'gdkrectangle.h',
|
||||
'gdkrgba.h',
|
||||
'gdkseat.h',
|
||||
@@ -112,8 +112,9 @@ gdk_public_headers = files([
|
||||
'gdkdragsurface.h',
|
||||
])
|
||||
install_headers(gdk_public_headers, subdir: 'gtk-4.0/gdk/')
|
||||
install_headers(gdk_deprecated_headers, subdir: 'gtk-4.0/gdk/deprecated')
|
||||
|
||||
gdk_sources = gdk_public_sources
|
||||
gdk_sources = gdk_public_sources + gdk_deprecated_sources
|
||||
|
||||
gdk_private_h_sources = files([
|
||||
'gdkeventsprivate.h',
|
||||
|
||||
@@ -1148,7 +1148,10 @@ gdk_wayland_surface_destroy (GdkSurface *surface,
|
||||
|
||||
gdk_wayland_surface_hide_surface (surface);
|
||||
|
||||
gdk_wayland_surface_destroy_wl_surface (GDK_WAYLAND_SURFACE(surface));
|
||||
if (GDK_IS_TOPLEVEL (surface))
|
||||
gdk_wayland_toplevel_destroy (GDK_TOPLEVEL (surface));
|
||||
|
||||
gdk_wayland_surface_destroy_wl_surface (GDK_WAYLAND_SURFACE (surface));
|
||||
|
||||
frame_clock = gdk_surface_get_frame_clock (surface);
|
||||
g_signal_handlers_disconnect_by_func (frame_clock, on_frame_clock_before_paint, surface);
|
||||
|
||||
@@ -39,3 +39,4 @@ void gdk_wayland_toplevel_announce_ssd (GdkToplevel *toplevel);
|
||||
gboolean gdk_wayland_toplevel_inhibit_idle (GdkToplevel *toplevel);
|
||||
void gdk_wayland_toplevel_uninhibit_idle (GdkToplevel *toplevel);
|
||||
|
||||
void gdk_wayland_toplevel_destroy (GdkToplevel *toplevel);
|
||||
|
||||
@@ -54,11 +54,16 @@ static void gdk_wayland_toplevel_sync_parent (GdkWaylandToplevel *to
|
||||
static void gdk_wayland_toplevel_sync_parent_of_imported (GdkWaylandToplevel *toplevel);
|
||||
static void gdk_wayland_surface_create_xdg_toplevel (GdkWaylandToplevel *toplevel);
|
||||
static void gdk_wayland_toplevel_sync_title (GdkWaylandToplevel *toplevel);
|
||||
static gboolean gdk_wayland_toplevel_is_exported (GdkWaylandToplevel *toplevel);
|
||||
static void unset_transient_for_exported (GdkWaylandToplevel *toplevel);
|
||||
|
||||
/* {{{ GdkWaylandToplevel definition */
|
||||
|
||||
typedef struct {
|
||||
struct zxdg_exported_v1 *xdg_exported;
|
||||
struct zxdg_exported_v2 *xdg_exported_v2;
|
||||
char *handle;
|
||||
} GdkWaylandExported;
|
||||
|
||||
/**
|
||||
* GdkWaylandToplevel:
|
||||
*
|
||||
@@ -83,8 +88,7 @@ struct _GdkWaylandToplevel
|
||||
GdkWaylandToplevel *transient_for;
|
||||
|
||||
struct org_kde_kwin_server_decoration *server_decoration;
|
||||
struct zxdg_exported_v1 *xdg_exported;
|
||||
struct zxdg_exported_v2 *xdg_exported_v2;
|
||||
GList *exported;
|
||||
|
||||
struct {
|
||||
int width;
|
||||
@@ -102,12 +106,6 @@ struct _GdkWaylandToplevel
|
||||
gboolean size_is_fixed;
|
||||
} next_layout;
|
||||
|
||||
struct {
|
||||
GdkWaylandToplevelExported callback;
|
||||
gpointer user_data;
|
||||
GDestroyNotify destroy_func;
|
||||
} exported;
|
||||
|
||||
struct {
|
||||
gboolean was_set;
|
||||
|
||||
@@ -1280,9 +1278,6 @@ gdk_wayland_toplevel_finalize (GObject *object)
|
||||
|
||||
display_wayland->toplevels = g_list_remove (display_wayland->toplevels, self);
|
||||
|
||||
if (gdk_wayland_toplevel_is_exported (self))
|
||||
gdk_wayland_toplevel_unexport_handle (GDK_TOPLEVEL (self));
|
||||
|
||||
g_free (self->application.application_id);
|
||||
g_free (self->application.app_menu_path);
|
||||
g_free (self->application.menubar_path);
|
||||
@@ -1747,8 +1742,12 @@ xdg_exported_handle_v1 (void *data,
|
||||
struct zxdg_exported_v1 *zxdg_exported_v1,
|
||||
const char *handle)
|
||||
{
|
||||
g_task_return_pointer (G_TASK (data), g_strdup (handle), g_free);
|
||||
g_object_unref (data);
|
||||
GTask *task = G_TASK (data);
|
||||
GdkWaylandExported *exported = (GdkWaylandExported *)g_task_get_task_data (task);
|
||||
|
||||
exported->handle = g_strdup (handle);
|
||||
g_task_return_pointer (task, g_strdup (handle), g_free);
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
static const struct zxdg_exported_v1_listener xdg_exported_listener_v1 = {
|
||||
@@ -1760,8 +1759,12 @@ xdg_exported_handle_v2 (void *data,
|
||||
struct zxdg_exported_v2 *zxdg_exported_v2,
|
||||
const char *handle)
|
||||
{
|
||||
g_task_return_pointer (G_TASK (data), g_strdup (handle), g_free);
|
||||
g_object_unref (data);
|
||||
GTask *task = G_TASK (data);
|
||||
GdkWaylandExported *exported = (GdkWaylandExported *)g_task_get_task_data (task);
|
||||
|
||||
exported->handle = g_strdup (handle);
|
||||
g_task_return_pointer (task, g_strdup (handle), g_free);
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
static const struct zxdg_exported_v2_listener xdg_exported_listener_v2 = {
|
||||
@@ -1784,19 +1787,27 @@ gdk_wayland_toplevel_real_export_handle (GdkToplevel *toplevel,
|
||||
|
||||
if (display_wayland->xdg_exporter_v2)
|
||||
{
|
||||
wayland_toplevel->xdg_exported_v2 =
|
||||
GdkWaylandExported *exported = g_new0 (GdkWaylandExported, 1);
|
||||
exported->xdg_exported_v2 =
|
||||
zxdg_exporter_v2_export_toplevel (display_wayland->xdg_exporter_v2,
|
||||
gdk_wayland_surface_get_wl_surface (surface));
|
||||
zxdg_exported_v2_add_listener (wayland_toplevel->xdg_exported_v2,
|
||||
zxdg_exported_v2_add_listener (exported->xdg_exported_v2,
|
||||
&xdg_exported_listener_v2, task);
|
||||
|
||||
wayland_toplevel->exported = g_list_prepend (wayland_toplevel->exported, exported);
|
||||
g_task_set_task_data (task, exported, NULL);
|
||||
}
|
||||
else if (display_wayland->xdg_exporter)
|
||||
{
|
||||
wayland_toplevel->xdg_exported =
|
||||
GdkWaylandExported *exported = g_new0 (GdkWaylandExported, 1);
|
||||
exported->xdg_exported =
|
||||
zxdg_exporter_v1_export (display_wayland->xdg_exporter,
|
||||
gdk_wayland_surface_get_wl_surface (surface));
|
||||
zxdg_exported_v1_add_listener (wayland_toplevel->xdg_exported,
|
||||
zxdg_exported_v1_add_listener (exported->xdg_exported,
|
||||
&xdg_exported_listener_v1, task);
|
||||
|
||||
wayland_toplevel->exported = g_list_prepend (wayland_toplevel->exported, exported);
|
||||
g_task_set_task_data (task, exported, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1815,15 +1826,36 @@ gdk_wayland_toplevel_real_export_handle_finish (GdkToplevel *toplevel,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_toplevel_real_unexport_handle (GdkToplevel *toplevel)
|
||||
destroy_exported (GdkWaylandExported *exported)
|
||||
{
|
||||
g_clear_pointer (&exported->handle, g_free);
|
||||
g_clear_pointer (&exported->xdg_exported_v2, zxdg_exported_v2_destroy);
|
||||
g_clear_pointer (&exported->xdg_exported, zxdg_exported_v1_destroy);
|
||||
g_free (exported);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_toplevel_real_unexport_handle (GdkToplevel *toplevel,
|
||||
const char *handle)
|
||||
{
|
||||
GdkWaylandToplevel *wayland_toplevel = GDK_WAYLAND_TOPLEVEL (toplevel);
|
||||
|
||||
g_return_if_fail (GDK_IS_WAYLAND_TOPLEVEL (toplevel));
|
||||
g_return_if_fail (wayland_toplevel->xdg_exported_v2 || wayland_toplevel->xdg_exported);
|
||||
g_return_if_fail (handle != NULL);
|
||||
|
||||
g_clear_pointer (&wayland_toplevel->xdg_exported_v2, zxdg_exported_v2_destroy);
|
||||
g_clear_pointer (&wayland_toplevel->xdg_exported, zxdg_exported_v1_destroy);
|
||||
for (GList *l = wayland_toplevel->exported; l; l = l->next)
|
||||
{
|
||||
GdkWaylandExported *exported = l->data;
|
||||
|
||||
if (exported->handle && strcmp (exported->handle, handle) == 0)
|
||||
{
|
||||
wayland_toplevel->exported = g_list_delete_link (wayland_toplevel->exported, l);
|
||||
destroy_exported (exported);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
g_warn_if_reached ();
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -2255,6 +2287,32 @@ gdk_wayland_toplevel_set_dbus_properties (GdkToplevel *toplevel,
|
||||
maybe_set_gtk_surface_dbus_properties (wayland_toplevel);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_wayland_toplevel_destroy (GdkToplevel *toplevel)
|
||||
{
|
||||
GdkWaylandToplevel *self = GDK_WAYLAND_TOPLEVEL (toplevel);
|
||||
|
||||
while (self->exported)
|
||||
{
|
||||
GdkWaylandExported *exported = self->exported->data;
|
||||
self->exported = g_list_delete_link (self->exported, self->exported);
|
||||
if (exported->handle == NULL)
|
||||
{
|
||||
GTask *task;
|
||||
|
||||
if (exported->xdg_exported_v2)
|
||||
task = G_TASK (wl_proxy_get_user_data ((struct wl_proxy *) exported->xdg_exported_v2));
|
||||
else
|
||||
task = G_TASK (wl_proxy_get_user_data ((struct wl_proxy *) exported->xdg_exported));
|
||||
|
||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED, "Surface was destroyed");
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
destroy_exported (exported);
|
||||
}
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ Toplevel API */
|
||||
|
||||
@@ -2397,12 +2455,6 @@ gdk_wayland_toplevel_uninhibit_idle (GdkToplevel *toplevel)
|
||||
* marking surfaces as transient for out-of-process surfaces.
|
||||
*/
|
||||
|
||||
static gboolean
|
||||
gdk_wayland_toplevel_is_exported (GdkWaylandToplevel *toplevel)
|
||||
{
|
||||
return toplevel->xdg_exported != NULL || toplevel->xdg_exported_v2 != NULL;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
GdkWaylandToplevelExported callback;
|
||||
gpointer user_data;
|
||||
@@ -2450,6 +2502,12 @@ export_handle_done (GObject *source,
|
||||
* from another surface as transient for this one, see
|
||||
* [method@GdkWayland.WaylandToplevel.set_transient_for_exported].
|
||||
*
|
||||
* Before 4.12, this API could not safely be used multiple times,
|
||||
* since there was no reference counting for handles. Starting with
|
||||
* 4.12, every call to this function obtains a new handle, and every
|
||||
* call to [method@GdkWayland.WaylandToplevel.drop_exported_handle] drops
|
||||
* just the handle that it is given.
|
||||
*
|
||||
* Note that this API depends on an unstable Wayland protocol,
|
||||
* and thus may require changes in the future.
|
||||
*
|
||||
@@ -2486,15 +2544,53 @@ gdk_wayland_toplevel_export_handle (GdkToplevel *toplevel,
|
||||
* It is an error to call this function on a surface that
|
||||
* does not have a handle.
|
||||
*
|
||||
* Since 4.12, this function does nothing. Use
|
||||
* [method@GdkWayland.WaylandToplevel.drop_exported_handle] instead to drop a
|
||||
* handle that was obtained with [method@GdkWayland.WaylandToplevel.export_handle].
|
||||
*
|
||||
* Note that this API depends on an unstable Wayland protocol,
|
||||
* and thus may require changes in the future.
|
||||
*
|
||||
* Deprecated: 4.12: Use [method@GdkWayland.WaylandToplevel.drop_exported_handle]
|
||||
* instead, this function does nothing
|
||||
*/
|
||||
void
|
||||
gdk_wayland_toplevel_unexport_handle (GdkToplevel *toplevel)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_WAYLAND_TOPLEVEL (toplevel));
|
||||
GdkWaylandToplevel *wayland_toplevel = GDK_WAYLAND_TOPLEVEL (toplevel);
|
||||
|
||||
gdk_toplevel_unexport_handle (toplevel);
|
||||
if (wayland_toplevel->exported != NULL &&
|
||||
wayland_toplevel->exported->next == NULL)
|
||||
{
|
||||
GdkWaylandExported *exported = wayland_toplevel->exported->data;
|
||||
|
||||
if (exported->handle)
|
||||
{
|
||||
gdk_toplevel_unexport_handle (toplevel, exported->handle);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
g_warning ("Use gdk_wayland_toplevel_drop_exported_handle()");
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_wayland_toplevel_drop_exported_handle:
|
||||
* @toplevel: (type GdkWaylandToplevel): the `GdkToplevel` that was exported
|
||||
* @handle: the handle to drop
|
||||
*
|
||||
* Destroy a handle that was obtained with gdk_wayland_toplevel_export_handle().
|
||||
*
|
||||
* Note that this API depends on an unstable Wayland protocol,
|
||||
* and thus may require changes in the future.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
void
|
||||
gdk_wayland_toplevel_drop_exported_handle (GdkToplevel *toplevel,
|
||||
const char *handle)
|
||||
{
|
||||
gdk_toplevel_unexport_handle (toplevel, handle);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -52,9 +52,13 @@ gboolean gdk_wayland_toplevel_export_handle (GdkToplevel
|
||||
gpointer user_data,
|
||||
GDestroyNotify destroy_func);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_12_FOR(gdk_wayland_toplevel_drop_exported_handle)
|
||||
void gdk_wayland_toplevel_unexport_handle (GdkToplevel *toplevel);
|
||||
|
||||
GDK_AVAILABLE_IN_4_12
|
||||
void gdk_wayland_toplevel_drop_exported_handle (GdkToplevel *toplevel,
|
||||
const char *handle);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_wayland_toplevel_set_transient_for_exported (GdkToplevel *toplevel,
|
||||
const char *parent_handle_str);
|
||||
|
||||
@@ -1436,7 +1436,7 @@ register_clipboard_notification ()
|
||||
|
||||
wclass.lpszClassName = "GdkClipboardNotification";
|
||||
wclass.lpfnWndProc = _clipboard_window_procedure;
|
||||
wclass.hInstance = _gdk_dll_hinstance;
|
||||
wclass.hInstance = this_module ();
|
||||
wclass.cbWndExtra = sizeof (GdkWin32ClipboardThread *);
|
||||
|
||||
klass = RegisterClass (&wclass);
|
||||
@@ -1446,7 +1446,7 @@ register_clipboard_notification ()
|
||||
clipboard_thread_data->clipboard_window = CreateWindow (MAKEINTRESOURCE (klass),
|
||||
NULL, WS_POPUP,
|
||||
0, 0, 0, 0, NULL, NULL,
|
||||
_gdk_dll_hinstance, NULL);
|
||||
this_module (), NULL);
|
||||
|
||||
if (clipboard_thread_data->clipboard_window == NULL)
|
||||
goto failed;
|
||||
@@ -1471,7 +1471,7 @@ register_clipboard_notification ()
|
||||
|
||||
failed:
|
||||
g_critical ("Failed to install clipboard viewer");
|
||||
UnregisterClass (MAKEINTRESOURCE (klass), _gdk_dll_hinstance);
|
||||
UnregisterClass (MAKEINTRESOURCE (klass), this_module ());
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -417,13 +417,12 @@ hcursor_from_x_cursor (int i,
|
||||
#undef SET_BIT
|
||||
#undef RESET_BIT
|
||||
|
||||
rv = CreateCursor (_gdk_app_hmodule, cursors[i].hotx, cursors[i].hoty,
|
||||
rv = CreateCursor (NULL, cursors[i].hotx, cursors[i].hoty,
|
||||
w, h, and_plane, xor_plane);
|
||||
}
|
||||
else
|
||||
{
|
||||
rv = CreateCursor (_gdk_app_hmodule, 0, 0,
|
||||
w, h, and_plane, xor_plane);
|
||||
rv = CreateCursor (NULL, 0, 0, w, h, and_plane, xor_plane);
|
||||
}
|
||||
|
||||
if (rv == NULL)
|
||||
@@ -466,7 +465,7 @@ win32_cursor_create_win32hcursor (GdkWin32Display *display,
|
||||
break;
|
||||
case GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_THIS:
|
||||
result = gdk_win32_hcursor_new (display,
|
||||
LoadImageA (_gdk_app_hmodule,
|
||||
LoadImageA (GetModuleHandle (NULL),
|
||||
(const char *) cursor->resource_name,
|
||||
IMAGE_CURSOR,
|
||||
cursor->width,
|
||||
@@ -476,7 +475,7 @@ win32_cursor_create_win32hcursor (GdkWin32Display *display,
|
||||
break;
|
||||
case GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_GTK:
|
||||
result = gdk_win32_hcursor_new (display,
|
||||
LoadImageA (_gdk_dll_hinstance,
|
||||
LoadImageA (this_module (),
|
||||
(const char *) cursor->resource_name,
|
||||
IMAGE_CURSOR,
|
||||
cursor->width,
|
||||
@@ -858,9 +857,7 @@ create_blank_win32hcursor (GdkWin32Display *display)
|
||||
xor_plane = g_malloc ((w/8) * h);
|
||||
memset (xor_plane, 0, (w/8) * h);
|
||||
|
||||
rv = CreateCursor (_gdk_app_hmodule, 0, 0,
|
||||
w, h, and_plane, xor_plane);
|
||||
|
||||
rv = CreateCursor (NULL, 0, 0, w, h, and_plane, xor_plane);
|
||||
if (rv == NULL)
|
||||
WIN32_API_FAILED ("CreateCursor");
|
||||
|
||||
@@ -871,6 +868,7 @@ static GdkWin32HCursor *
|
||||
gdk_win32hcursor_create_for_name (GdkWin32Display *display,
|
||||
const char *name)
|
||||
{
|
||||
const HINSTANCE hinstance = GetModuleHandle (NULL);
|
||||
GdkWin32HCursor *win32hcursor = NULL;
|
||||
|
||||
/* Blank cursor case */
|
||||
@@ -885,7 +883,7 @@ gdk_win32hcursor_create_for_name (GdkWin32Display *display,
|
||||
/* Allow to load named cursor resources linked into the executable.
|
||||
* Cursors obtained with LoadCursor() cannot be destroyed.
|
||||
*/
|
||||
return gdk_win32_hcursor_new (display, LoadCursor (_gdk_app_hmodule, name), FALSE);
|
||||
return gdk_win32_hcursor_new (display, LoadCursor (hinstance, name), FALSE);
|
||||
}
|
||||
|
||||
static HICON
|
||||
@@ -1452,27 +1450,6 @@ pixbuf_to_hicon (GdkPixbuf *pixbuf,
|
||||
return icon;
|
||||
}
|
||||
|
||||
HICON
|
||||
_gdk_win32_texture_to_hicon (GdkTexture *texture)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
GdkPixbuf *pixbuf;
|
||||
int width, height;
|
||||
HICON icon;
|
||||
|
||||
surface = gdk_texture_download_surface (texture);
|
||||
width = cairo_image_surface_get_width (surface);
|
||||
height = cairo_image_surface_get_height (surface);
|
||||
|
||||
pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, width, height);
|
||||
|
||||
icon = pixbuf_to_hicon (pixbuf, TRUE, 0, 0);
|
||||
|
||||
g_object_unref (pixbuf);
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_win32_display_get_win32hcursor:
|
||||
* @display: (type GdkWin32Display): a `GdkDisplay`
|
||||
|
||||
@@ -292,6 +292,7 @@ _gdk_win32_display_init_monitors (GdkWin32Display *win32_display)
|
||||
if (!w32_ex_monitor->remove)
|
||||
continue;
|
||||
|
||||
w32_ex_monitor->hmonitor = NULL;
|
||||
g_list_store_remove (G_LIST_STORE (win32_display->monitors), i);
|
||||
gdk_monitor_invalidate (ex_monitor);
|
||||
}
|
||||
@@ -480,7 +481,7 @@ register_display_change_notification (GdkDisplay *display)
|
||||
|
||||
wclass.lpszClassName = "GdkDisplayChange";
|
||||
wclass.lpfnWndProc = display_change_window_procedure;
|
||||
wclass.hInstance = _gdk_app_hmodule;
|
||||
wclass.hInstance = this_module ();
|
||||
wclass.style = CS_OWNDC;
|
||||
|
||||
klass = RegisterClass (&wclass);
|
||||
@@ -489,10 +490,10 @@ register_display_change_notification (GdkDisplay *display)
|
||||
display_win32->hwnd = CreateWindow (MAKEINTRESOURCE (klass),
|
||||
NULL, WS_POPUP,
|
||||
0, 0, 0, 0, NULL, NULL,
|
||||
_gdk_app_hmodule, NULL);
|
||||
this_module (), NULL);
|
||||
if (!display_win32->hwnd)
|
||||
{
|
||||
UnregisterClass (MAKEINTRESOURCE (klass), _gdk_app_hmodule);
|
||||
UnregisterClass (MAKEINTRESOURCE (klass), this_module ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -413,8 +413,7 @@ set_up_low_level_keyboard_hook (void)
|
||||
|
||||
hook_handle = SetWindowsHookEx (WH_KEYBOARD_LL,
|
||||
(HOOKPROC) low_level_keyboard_proc,
|
||||
_gdk_dll_hinstance,
|
||||
0);
|
||||
this_module (), 0);
|
||||
|
||||
if (hook_handle != NULL)
|
||||
keyboard_hook = hook_handle;
|
||||
|
||||
@@ -261,7 +261,7 @@ create_dummy_gl_window (void)
|
||||
|
||||
wclass.lpszClassName = "GdkGLDummyWindow";
|
||||
wclass.lpfnWndProc = DefWindowProc;
|
||||
wclass.hInstance = _gdk_app_hmodule;
|
||||
wclass.hInstance = this_module ();
|
||||
wclass.style = CS_OWNDC;
|
||||
|
||||
klass = RegisterClass (&wclass);
|
||||
@@ -270,10 +270,10 @@ create_dummy_gl_window (void)
|
||||
hwnd = CreateWindow (MAKEINTRESOURCE (klass),
|
||||
NULL, WS_POPUP,
|
||||
0, 0, 0, 0, NULL, NULL,
|
||||
_gdk_app_hmodule, NULL);
|
||||
this_module (), NULL);
|
||||
if (!hwnd)
|
||||
{
|
||||
UnregisterClass (MAKEINTRESOURCE (klass), _gdk_app_hmodule);
|
||||
UnregisterClass (MAKEINTRESOURCE (klass), this_module ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,10 +30,6 @@
|
||||
GdkDisplay *_gdk_display = NULL;
|
||||
GdkDeviceManagerWin32 *_gdk_device_manager = NULL;
|
||||
|
||||
HDC _gdk_display_hdc;
|
||||
HINSTANCE _gdk_dll_hinstance;
|
||||
HINSTANCE _gdk_app_hmodule;
|
||||
|
||||
int _gdk_input_ignore_core;
|
||||
|
||||
HKL _gdk_input_locale;
|
||||
|
||||
@@ -1003,7 +1003,7 @@ winpointer_notif_window_create (void)
|
||||
wndclassex.cbSize = sizeof (wndclassex);
|
||||
wndclassex.lpszClassName = L"GdkWin32WinpointerNotificationsWindowClass";
|
||||
wndclassex.lpfnWndProc = winpointer_notifications_window_procedure;
|
||||
wndclassex.hInstance = _gdk_dll_hinstance;
|
||||
wndclassex.hInstance = this_module ();
|
||||
|
||||
if ((notifications_window_class = RegisterClassExW (&wndclassex)) == 0)
|
||||
{
|
||||
@@ -1018,7 +1018,7 @@ winpointer_notif_window_create (void)
|
||||
0, 0, 0, 0,
|
||||
HWND_MESSAGE,
|
||||
NULL,
|
||||
_gdk_dll_hinstance,
|
||||
this_module (),
|
||||
NULL)))
|
||||
{
|
||||
WIN32_API_FAILED ("CreateWindowExW");
|
||||
|
||||
@@ -576,19 +576,6 @@ gdk_mod_mask_to_mod_bits (GdkModifierType mod_mask)
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/* keypad decimal mark depends on active keyboard layout
|
||||
* return current decimal mark as unicode character
|
||||
*/
|
||||
guint32
|
||||
_gdk_win32_keymap_get_decimal_mark (GdkWin32Keymap *keymap)
|
||||
{
|
||||
guint32 c = MapVirtualKeyW (VK_DECIMAL, MAPVK_VK_TO_CHAR);
|
||||
if (!c)
|
||||
c = (guint32) '.';
|
||||
return c;
|
||||
}
|
||||
|
||||
static void
|
||||
update_keymap (GdkWin32Keymap *keymap)
|
||||
{
|
||||
|
||||
+56
-190
@@ -45,9 +45,6 @@
|
||||
#include <wintab.h>
|
||||
#include <imm.h>
|
||||
|
||||
/* for CFSTR_SHELLIDLIST */
|
||||
#include <shlobj.h>
|
||||
|
||||
static gboolean gdk_synchronize = FALSE;
|
||||
|
||||
/* Whether GDK initialized COM */
|
||||
@@ -66,8 +63,6 @@ _gdk_win32_surfaceing_init (void)
|
||||
if (gdk_synchronize)
|
||||
GdiSetBatchLimit (1);
|
||||
|
||||
_gdk_app_hmodule = GetModuleHandle (NULL);
|
||||
_gdk_display_hdc = CreateDC ("DISPLAY", NULL, NULL, NULL);
|
||||
_gdk_input_locale = GetKeyboardLayout (0);
|
||||
_gdk_win32_keymap_set_active_layout (win32_keymap, _gdk_input_locale);
|
||||
|
||||
@@ -187,135 +182,6 @@ static_printf (const char *format,
|
||||
return retval;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_win32_print_paletteentries (const PALETTEENTRY *pep,
|
||||
const int nentries)
|
||||
{
|
||||
char buf[20];
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nentries; i++)
|
||||
g_print (" %3d %02x: %02x %02x %02x%s\n",
|
||||
i, i,
|
||||
pep[i].peRed, pep[i].peGreen, pep[i].peBlue,
|
||||
(pep[i].peFlags == 0 ? "" :
|
||||
(pep[i].peFlags == PC_EXPLICIT ? " PC_EXPLICIT" :
|
||||
(pep[i].peFlags == PC_NOCOLLAPSE ? " PC_NOCOLLAPSE" :
|
||||
(pep[i].peFlags == PC_RESERVED ? " PC_RESERVED" :
|
||||
(g_sprintf (buf, " %d", pep[i].peFlags), buf))))));
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_win32_print_system_palette (void)
|
||||
{
|
||||
PALETTEENTRY *pe;
|
||||
int k;
|
||||
|
||||
k = GetSystemPaletteEntries (_gdk_display_hdc, 0, 0, NULL);
|
||||
pe = g_new (PALETTEENTRY, k);
|
||||
k = GetSystemPaletteEntries (_gdk_display_hdc, 0, k, pe);
|
||||
|
||||
if (!k)
|
||||
g_print ("GetSystemPaletteEntries failed: %s\n",
|
||||
g_win32_error_message (GetLastError ()));
|
||||
else
|
||||
{
|
||||
g_print ("System palette: %d entries\n", k);
|
||||
_gdk_win32_print_paletteentries (pe, k);
|
||||
}
|
||||
g_free (pe);
|
||||
}
|
||||
|
||||
static int
|
||||
palette_size (HPALETTE hpal)
|
||||
{
|
||||
WORD npal = 0;
|
||||
|
||||
if (!GetObject (hpal, sizeof (npal), &npal))
|
||||
WIN32_GDI_FAILED ("GetObject (HPALETTE)");
|
||||
|
||||
return npal;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_win32_print_hpalette (HPALETTE hpal)
|
||||
{
|
||||
PALETTEENTRY *pe;
|
||||
int n, npal;
|
||||
|
||||
npal = palette_size (hpal);
|
||||
pe = g_new (PALETTEENTRY, npal);
|
||||
n = GetPaletteEntries (hpal, 0, npal, pe);
|
||||
|
||||
if (!n)
|
||||
g_print ("HPALETTE %p: GetPaletteEntries failed: %s\n",
|
||||
hpal, g_win32_error_message (GetLastError ()));
|
||||
else
|
||||
{
|
||||
g_print ("HPALETTE %p: %d (%d) entries\n", hpal, n, npal);
|
||||
_gdk_win32_print_paletteentries (pe, n);
|
||||
}
|
||||
g_free (pe);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_win32_print_dc (HDC hdc)
|
||||
{
|
||||
HGDIOBJ obj;
|
||||
LOGBRUSH logbrush;
|
||||
EXTLOGPEN extlogpen;
|
||||
HRGN hrgn;
|
||||
RECT rect;
|
||||
int flag;
|
||||
|
||||
g_print ("%p:\n", hdc);
|
||||
obj = GetCurrentObject (hdc, OBJ_BRUSH);
|
||||
GetObject (obj, sizeof (LOGBRUSH), &logbrush);
|
||||
g_print ("brush: %s color=%06lx hatch=%p\n",
|
||||
_gdk_win32_lbstyle_to_string (logbrush.lbStyle),
|
||||
logbrush.lbColor, (gpointer) logbrush.lbHatch);
|
||||
obj = GetCurrentObject (hdc, OBJ_PEN);
|
||||
GetObject (obj, sizeof (EXTLOGPEN), &extlogpen);
|
||||
g_print ("pen: %s %s %s %s w=%d %s\n",
|
||||
_gdk_win32_pstype_to_string (extlogpen.elpPenStyle),
|
||||
_gdk_win32_psstyle_to_string (extlogpen.elpPenStyle),
|
||||
_gdk_win32_psendcap_to_string (extlogpen.elpPenStyle),
|
||||
_gdk_win32_psjoin_to_string (extlogpen.elpPenStyle),
|
||||
(int) extlogpen.elpWidth,
|
||||
_gdk_win32_lbstyle_to_string (extlogpen.elpBrushStyle));
|
||||
g_print ("rop2: %s textcolor=%06lx\n",
|
||||
_gdk_win32_rop2_to_string (GetROP2 (hdc)),
|
||||
GetTextColor (hdc));
|
||||
hrgn = CreateRectRgn (0, 0, 0, 0);
|
||||
if ((flag = GetClipRgn (hdc, hrgn)) == -1)
|
||||
WIN32_API_FAILED ("GetClipRgn");
|
||||
else if (flag == 0)
|
||||
g_print ("no clip region\n");
|
||||
else if (flag == 1)
|
||||
{
|
||||
GetRgnBox (hrgn, &rect);
|
||||
g_print ("clip region: %p bbox: %s\n",
|
||||
hrgn, _gdk_win32_rect_to_string (&rect));
|
||||
}
|
||||
DeleteObject (hrgn);
|
||||
}
|
||||
|
||||
char *
|
||||
_gdk_win32_drag_protocol_to_string (GdkDragProtocol protocol)
|
||||
{
|
||||
switch (protocol)
|
||||
{
|
||||
#define CASE(x) case GDK_DRAG_PROTO_##x: return #x
|
||||
CASE (NONE);
|
||||
CASE (WIN32_DROPFILES);
|
||||
CASE (OLE2);
|
||||
#undef CASE
|
||||
default: return static_printf ("illegal_%d", protocol);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *
|
||||
_gdk_win32_surface_state_to_string (GdkToplevelState state)
|
||||
{
|
||||
@@ -478,7 +344,7 @@ _gdk_win32_drag_action_to_string (GdkDragAction actions)
|
||||
return static_printf ("%s", buf);
|
||||
}
|
||||
|
||||
char *
|
||||
static char *
|
||||
_gdk_win32_rop2_to_string (int rop2)
|
||||
{
|
||||
switch (rop2)
|
||||
@@ -507,7 +373,7 @@ _gdk_win32_rop2_to_string (int rop2)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *
|
||||
static char *
|
||||
_gdk_win32_lbstyle_to_string (UINT brush_style)
|
||||
{
|
||||
switch (brush_style)
|
||||
@@ -526,7 +392,7 @@ _gdk_win32_lbstyle_to_string (UINT brush_style)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *
|
||||
static char *
|
||||
_gdk_win32_pstype_to_string (DWORD pen_style)
|
||||
{
|
||||
switch (pen_style & PS_TYPE_MASK)
|
||||
@@ -539,7 +405,7 @@ _gdk_win32_pstype_to_string (DWORD pen_style)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *
|
||||
static char *
|
||||
_gdk_win32_psstyle_to_string (DWORD pen_style)
|
||||
{
|
||||
switch (pen_style & PS_STYLE_MASK)
|
||||
@@ -561,7 +427,7 @@ _gdk_win32_psstyle_to_string (DWORD pen_style)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *
|
||||
static char *
|
||||
_gdk_win32_psendcap_to_string (DWORD pen_style)
|
||||
{
|
||||
switch (pen_style & PS_ENDCAP_MASK)
|
||||
@@ -577,7 +443,7 @@ _gdk_win32_psendcap_to_string (DWORD pen_style)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *
|
||||
static char *
|
||||
_gdk_win32_psjoin_to_string (DWORD pen_style)
|
||||
{
|
||||
switch (pen_style & PS_JOIN_MASK)
|
||||
@@ -593,6 +459,56 @@ _gdk_win32_psjoin_to_string (DWORD pen_style)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_win32_print_dc (HDC hdc)
|
||||
{
|
||||
HGDIOBJ obj;
|
||||
LOGBRUSH logbrush;
|
||||
EXTLOGPEN extlogpen;
|
||||
HRGN hrgn;
|
||||
RECT rect;
|
||||
int flag;
|
||||
|
||||
g_print ("%p:\n", hdc);
|
||||
|
||||
obj = GetCurrentObject (hdc, OBJ_BRUSH);
|
||||
GetObject (obj, sizeof (LOGBRUSH), &logbrush);
|
||||
|
||||
g_print ("brush: %s color=%06lx hatch=%p\n",
|
||||
_gdk_win32_lbstyle_to_string (logbrush.lbStyle),
|
||||
logbrush.lbColor, (gpointer) logbrush.lbHatch);
|
||||
|
||||
obj = GetCurrentObject (hdc, OBJ_PEN);
|
||||
GetObject (obj, sizeof (EXTLOGPEN), &extlogpen);
|
||||
|
||||
g_print ("pen: %s %s %s %s w=%d %s\n",
|
||||
_gdk_win32_pstype_to_string (extlogpen.elpPenStyle),
|
||||
_gdk_win32_psstyle_to_string (extlogpen.elpPenStyle),
|
||||
_gdk_win32_psendcap_to_string (extlogpen.elpPenStyle),
|
||||
_gdk_win32_psjoin_to_string (extlogpen.elpPenStyle),
|
||||
(int) extlogpen.elpWidth,
|
||||
_gdk_win32_lbstyle_to_string (extlogpen.elpBrushStyle));
|
||||
|
||||
g_print ("rop2: %s textcolor=%06lx\n",
|
||||
_gdk_win32_rop2_to_string (GetROP2 (hdc)),
|
||||
GetTextColor (hdc));
|
||||
|
||||
hrgn = CreateRectRgn (0, 0, 0, 0);
|
||||
|
||||
if ((flag = GetClipRgn (hdc, hrgn)) == -1)
|
||||
WIN32_API_FAILED ("GetClipRgn");
|
||||
else if (flag == 0)
|
||||
g_print ("no clip region\n");
|
||||
else if (flag == 1)
|
||||
{
|
||||
GetRgnBox (hrgn, &rect);
|
||||
g_print ("clip region: %p bbox: %s\n",
|
||||
hrgn, _gdk_win32_rect_to_string (&rect));
|
||||
}
|
||||
|
||||
DeleteObject (hrgn);
|
||||
}
|
||||
|
||||
char *
|
||||
_gdk_win32_message_to_string (UINT msg)
|
||||
{
|
||||
@@ -893,26 +809,6 @@ _gdk_win32_cf_to_string (UINT format)
|
||||
}
|
||||
}
|
||||
|
||||
char *
|
||||
_gdk_win32_data_to_string (const guchar *data,
|
||||
int nbytes)
|
||||
{
|
||||
GString *s = g_string_new ("");
|
||||
int i;
|
||||
char *retval;
|
||||
|
||||
for (i = 0; i < nbytes; i++)
|
||||
if (data[i] >=' ' && data[i] <= '~')
|
||||
g_string_append_printf (s, "%c ", data[i]);
|
||||
else
|
||||
g_string_append_printf (s, "%02X ", data[i]);
|
||||
|
||||
retval = static_printf ("%s", s->str);
|
||||
g_string_free (s, TRUE);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
char *
|
||||
_gdk_win32_rect_to_string (const RECT *rect)
|
||||
{
|
||||
@@ -921,34 +817,4 @@ _gdk_win32_rect_to_string (const RECT *rect)
|
||||
rect->left, rect->top);
|
||||
}
|
||||
|
||||
char *
|
||||
_gdk_win32_gdkrectangle_to_string (const GdkRectangle *rect)
|
||||
{
|
||||
return static_printf ("%dx%d@%+d%+d",
|
||||
rect->width, rect->height,
|
||||
rect->x, rect->y);
|
||||
}
|
||||
|
||||
char *
|
||||
_gdk_win32_cairo_region_to_string (const cairo_region_t *rgn)
|
||||
{
|
||||
cairo_rectangle_int_t extents;
|
||||
cairo_region_get_extents (rgn, &extents);
|
||||
return static_printf ("%dx%d@%+d%+d",
|
||||
extents.width, extents.height,
|
||||
extents.x, extents.y);
|
||||
}
|
||||
|
||||
char *
|
||||
_gdk_win32_surface_description (GdkSurface *d)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SURFACE (d), NULL);
|
||||
|
||||
return static_printf ("%s:%p:%dx%d",
|
||||
G_OBJECT_TYPE_NAME (d),
|
||||
GDK_SURFACE_HWND (d),
|
||||
gdk_surface_get_width (GDK_SURFACE (d)),
|
||||
gdk_surface_get_height (GDK_SURFACE (d)));
|
||||
}
|
||||
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
@@ -443,9 +443,6 @@ populate_monitor_devices_from_display_config (GPtrArray *monitors)
|
||||
char *path, *path_lower;
|
||||
DISPLAYCONFIG_RATIONAL *refresh;
|
||||
|
||||
if ((dispconf_paths[path_index].flags & DISPLAYCONFIG_PATH_ACTIVE) == 0)
|
||||
continue;
|
||||
|
||||
tdn.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME;
|
||||
tdn.header.size = sizeof (tdn);
|
||||
tdn.header.adapterId = dispconf_paths[path_index].targetInfo.adapterId;
|
||||
@@ -481,6 +478,12 @@ populate_monitor_devices_from_display_config (GPtrArray *monitors)
|
||||
if (w32mon == NULL)
|
||||
continue;
|
||||
|
||||
if ((dispconf_paths[path_index].flags & DISPLAYCONFIG_PATH_ACTIVE) == 0)
|
||||
{
|
||||
w32mon->remove = TRUE;
|
||||
continue;
|
||||
}
|
||||
|
||||
mon = GDK_MONITOR (w32mon);
|
||||
|
||||
if (!tdn.flags.friendlyNameForced)
|
||||
@@ -598,6 +601,8 @@ enum_monitor (HMONITOR hmonitor,
|
||||
|
||||
if (w32mon == NULL)
|
||||
continue;
|
||||
|
||||
w32mon->hmonitor = hmonitor;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -35,6 +35,9 @@ struct _GdkWin32Monitor
|
||||
/* Device instance path (used to match GdkWin32Monitor to monitor device) */
|
||||
char *instance_path;
|
||||
|
||||
/* MOnitor handle (used to fullscreen windows on monitors) */
|
||||
HMONITOR hmonitor;
|
||||
|
||||
/* TRUE if monitor is made up by us
|
||||
* (this happens when system has logical monitors, but no physical ones).
|
||||
*/
|
||||
|
||||
+10
-157
@@ -15,15 +15,10 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
||||
* file for a list of people on the GTK+ Team. See the ChangeLog
|
||||
* files for a list of changes. These files are distributed with
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gdk/gdkcursorprivate.h>
|
||||
#include <gdk/gdkdebugprivate.h>
|
||||
#include <gdk/win32/gdksurface-win32.h>
|
||||
@@ -32,10 +27,6 @@
|
||||
#include <gdk/win32/gdkwin32keys.h>
|
||||
#include <gdk/win32/gdkdevicemanager-win32.h>
|
||||
#include <gdk/win32/gdkclipdrop-win32.h>
|
||||
//#include <gdk/win32/gdkselection-win32.h>
|
||||
|
||||
|
||||
#include "config.h"
|
||||
|
||||
|
||||
/* Old debug macros */
|
||||
@@ -54,62 +45,6 @@
|
||||
|
||||
#endif
|
||||
|
||||
/* Make up for some minor w32api or MSVC6 header lossage */
|
||||
|
||||
#ifndef PS_JOIN_MASK
|
||||
#define PS_JOIN_MASK (PS_JOIN_BEVEL|PS_JOIN_MITER|PS_JOIN_ROUND)
|
||||
#endif
|
||||
|
||||
#ifndef FS_VIETNAMESE
|
||||
#define FS_VIETNAMESE 0x100
|
||||
#endif
|
||||
|
||||
#ifndef WM_GETOBJECT
|
||||
#define WM_GETOBJECT 0x3D
|
||||
#endif
|
||||
#ifndef WM_NCXBUTTONDOWN
|
||||
#define WM_NCXBUTTONDOWN 0xAB
|
||||
#endif
|
||||
#ifndef WM_NCXBUTTONUP
|
||||
#define WM_NCXBUTTONUP 0xAC
|
||||
#endif
|
||||
#ifndef WM_NCXBUTTONDBLCLK
|
||||
#define WM_NCXBUTTONDBLCLK 0xAD
|
||||
#endif
|
||||
#ifndef WM_CHANGEUISTATE
|
||||
#define WM_CHANGEUISTATE 0x127
|
||||
#endif
|
||||
#ifndef WM_UPDATEUISTATE
|
||||
#define WM_UPDATEUISTATE 0x128
|
||||
#endif
|
||||
#ifndef WM_QUERYUISTATE
|
||||
#define WM_QUERYUISTATE 0x129
|
||||
#endif
|
||||
#ifndef WM_XBUTTONDOWN
|
||||
#define WM_XBUTTONDOWN 0x20B
|
||||
#endif
|
||||
#ifndef WM_XBUTTONUP
|
||||
#define WM_XBUTTONUP 0x20C
|
||||
#endif
|
||||
#ifndef WM_XBUTTONDBLCLK
|
||||
#define WM_XBUTTONDBLCLK 0x20D
|
||||
#endif
|
||||
#ifndef WM_NCMOUSEHOVER
|
||||
#define WM_NCMOUSEHOVER 0x2A0
|
||||
#endif
|
||||
#ifndef WM_NCMOUSELEAVE
|
||||
#define WM_NCMOUSELEAVE 0x2A2
|
||||
#endif
|
||||
#ifndef WM_APPCOMMAND
|
||||
#define WM_APPCOMMAND 0x319
|
||||
#endif
|
||||
#ifndef WM_MOUSEHWHEEL
|
||||
#define WM_MOUSEHWHEEL 0x20E
|
||||
#endif
|
||||
#ifndef WM_DPICHANGED
|
||||
#define WM_DPICHANGED 0x02E0
|
||||
#endif
|
||||
|
||||
/* According to
|
||||
* http://blog.airesoft.co.uk/2009/11/wm_messages/
|
||||
* this is the actual internal name MS uses for this undocumented message.
|
||||
@@ -122,11 +57,6 @@
|
||||
#define WM_SYSMENU 0x313
|
||||
#endif
|
||||
|
||||
#ifndef CF_DIBV5
|
||||
#define CF_DIBV5 17
|
||||
#endif
|
||||
|
||||
|
||||
/* Define some combinations of GdkDebugFlags */
|
||||
#define GDK_DEBUG_EVENTS_OR_INPUT (GDK_DEBUG_EVENTS|GDK_DEBUG_INPUT)
|
||||
#define GDK_DEBUG_MISC_OR_EVENTS (GDK_DEBUG_MISC|GDK_DEBUG_EVENTS)
|
||||
@@ -140,22 +70,6 @@ GdkWin32Screen *GDK_SURFACE_SCREEN(GObject *win);
|
||||
*/
|
||||
#define SWP_NOZORDER_SPECIFIED HWND_TOP
|
||||
|
||||
typedef struct _GdkWin32SingleFont GdkWin32SingleFont;
|
||||
|
||||
struct _GdkWin32SingleFont
|
||||
{
|
||||
HFONT hfont;
|
||||
UINT charset;
|
||||
UINT codepage;
|
||||
FONTSIGNATURE fs;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
GDK_WIN32_PE_STATIC,
|
||||
GDK_WIN32_PE_AVAILABLE,
|
||||
GDK_WIN32_PE_INUSE
|
||||
} GdkWin32PalEntryState;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GDK_DRAG_PROTO_NONE = 0,
|
||||
@@ -163,51 +77,23 @@ typedef enum
|
||||
GDK_DRAG_PROTO_OLE2,
|
||||
} GdkDragProtocol;
|
||||
|
||||
GType _gdk_gc_win32_get_type (void);
|
||||
|
||||
gulong _gdk_win32_get_next_tick (gulong suggested_tick);
|
||||
|
||||
BOOL _gdk_win32_get_cursor_pos (LPPOINT lpPoint);
|
||||
|
||||
void _gdk_surface_init_position (GdkSurface *window);
|
||||
void _gdk_surface_move_resize_child (GdkSurface *window,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
gboolean _gdk_win32_surface_enable_transparency (GdkSurface *window);
|
||||
|
||||
|
||||
/* GdkSurfaceImpl methods */
|
||||
void _gdk_win32_surface_scroll (GdkSurface *window,
|
||||
int dx,
|
||||
int dy);
|
||||
void _gdk_win32_surface_move_region (GdkSurface *window,
|
||||
const cairo_region_t *region,
|
||||
int dx,
|
||||
int dy);
|
||||
|
||||
|
||||
void _gdk_win32_selection_init (void);
|
||||
void _gdk_win32_dnd_exit (void);
|
||||
|
||||
void gdk_win32_handle_table_insert (HANDLE *handle,
|
||||
gpointer data);
|
||||
void gdk_win32_handle_table_remove (HANDLE handle);
|
||||
|
||||
HRGN _gdk_win32_cairo_region_to_hrgn (const cairo_region_t *region,
|
||||
int x_origin,
|
||||
int y_origin);
|
||||
|
||||
cairo_region_t *_gdk_win32_hrgn_to_region (HRGN hrgn,
|
||||
guint scale);
|
||||
|
||||
void _gdk_win32_adjust_client_rect (GdkSurface *window,
|
||||
RECT *RECT);
|
||||
|
||||
void _gdk_selection_property_delete (GdkSurface *);
|
||||
|
||||
void _gdk_push_modal_window (GdkSurface *window);
|
||||
void _gdk_remove_modal_window (GdkSurface *window);
|
||||
GdkSurface *_gdk_modal_current (void);
|
||||
@@ -217,41 +103,22 @@ gboolean gdk_win32_ensure_com (void);
|
||||
gboolean gdk_win32_ensure_ole (void);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
void _gdk_win32_print_paletteentries (const PALETTEENTRY *pep,
|
||||
const int nentries);
|
||||
void _gdk_win32_print_system_palette (void);
|
||||
void _gdk_win32_print_hpalette (HPALETTE hpal);
|
||||
void _gdk_win32_print_dc (HDC hdc);
|
||||
|
||||
char *_gdk_win32_drag_protocol_to_string (GdkDragProtocol protocol);
|
||||
char *_gdk_win32_surface_state_to_string (GdkToplevelState state);
|
||||
char *_gdk_win32_surface_style_to_string (LONG style);
|
||||
char *_gdk_win32_surface_exstyle_to_string (LONG style);
|
||||
char *_gdk_win32_surface_pos_bits_to_string (UINT flags);
|
||||
char *_gdk_win32_drag_action_to_string (GdkDragAction actions);
|
||||
char *_gdk_win32_surface_description (GdkSurface *d);
|
||||
|
||||
char *_gdk_win32_rop2_to_string (int rop2);
|
||||
char *_gdk_win32_lbstyle_to_string (UINT brush_style);
|
||||
char *_gdk_win32_pstype_to_string (DWORD pen_style);
|
||||
char *_gdk_win32_psstyle_to_string (DWORD pen_style);
|
||||
char *_gdk_win32_psendcap_to_string (DWORD pen_style);
|
||||
char *_gdk_win32_psjoin_to_string (DWORD pen_style);
|
||||
char *_gdk_win32_message_to_string (UINT msg);
|
||||
char *_gdk_win32_key_to_string (LONG lParam);
|
||||
char *_gdk_win32_cf_to_string (UINT format);
|
||||
char *_gdk_win32_data_to_string (const guchar*data,
|
||||
int nbytes);
|
||||
char *_gdk_win32_rect_to_string (const RECT *rect);
|
||||
|
||||
char *_gdk_win32_gdkrectangle_to_string (const GdkRectangle *rect);
|
||||
char *_gdk_win32_cairo_region_to_string (const cairo_region_t *box);
|
||||
|
||||
void _gdk_win32_print_event (GdkEvent *event);
|
||||
|
||||
#endif
|
||||
|
||||
char *_gdk_win32_last_error_string (void);
|
||||
void _gdk_win32_api_failed (const char *where,
|
||||
const char *api);
|
||||
void _gdk_other_api_failed (const char *where,
|
||||
@@ -284,10 +151,6 @@ extern GdkDisplay *_gdk_display;
|
||||
|
||||
extern GdkDeviceManagerWin32 *_gdk_device_manager;
|
||||
|
||||
extern HDC _gdk_display_hdc;
|
||||
extern HINSTANCE _gdk_dll_hinstance;
|
||||
extern HINSTANCE _gdk_app_hmodule;
|
||||
|
||||
extern int _gdk_input_ignore_core;
|
||||
|
||||
/* These are thread specific, but GDK/win32 works OK only when invoked
|
||||
@@ -304,8 +167,6 @@ extern GdkWin32Clipdrop *_win32_clipdrop;
|
||||
/* Used to identify the main thread */
|
||||
extern GThread *_win32_main_thread;
|
||||
|
||||
void _gdk_win32_dnd_do_dragdrop (void);
|
||||
|
||||
typedef enum {
|
||||
GDK_WIN32_MODAL_OP_NONE = 0x0,
|
||||
GDK_WIN32_MODAL_OP_SIZE = 0x1 << 0,
|
||||
@@ -324,16 +185,9 @@ extern HWND _modal_move_resize_window;
|
||||
void _gdk_win32_begin_modal_call (GdkWin32ModalOpKind kind);
|
||||
void _gdk_win32_end_modal_call (GdkWin32ModalOpKind kind);
|
||||
|
||||
/* Convert a pixbuf to an HICON (or HCURSOR). Supports alpha under
|
||||
* Windows XP, thresholds alpha otherwise.
|
||||
*/
|
||||
HICON _gdk_win32_texture_to_hicon (GdkTexture *texture);
|
||||
|
||||
void _gdk_win32_display_init_cursors (GdkWin32Display *display);
|
||||
void _gdk_win32_display_finalize_cursors (GdkWin32Display *display);
|
||||
void _gdk_win32_display_update_cursors (GdkWin32Display *display);
|
||||
GdkCursor *_gdk_win32_display_get_cursor_for_name (GdkDisplay *display, const char * cursor_name);
|
||||
GdkCursor *gdk_win32_display_cursor_from_hcursor (GdkDisplay *display, HCURSOR hcursor);
|
||||
|
||||
typedef struct _Win32CursorTheme Win32CursorTheme;
|
||||
|
||||
@@ -367,9 +221,6 @@ Win32Cursor * win32_cursor_theme_get_cursor (Win32CursorTheme *theme,
|
||||
void win32_cursor_theme_destroy (Win32CursorTheme *theme);
|
||||
Win32CursorTheme *_gdk_win32_display_get_cursor_theme (GdkWin32Display *win32_display);
|
||||
|
||||
/* GdkDisplay member functions */
|
||||
GList *_gdk_win32_display_list_devices (GdkDisplay *dpy);
|
||||
|
||||
gboolean _gdk_win32_display_has_pending (GdkDisplay *display);
|
||||
void _gdk_win32_display_queue_events (GdkDisplay *display);
|
||||
|
||||
@@ -395,16 +246,11 @@ GdkDrag *_gdk_win32_surface_drag_begin (GdkSurface *window,
|
||||
/* Stray GdkWin32Screen members */
|
||||
gboolean _gdk_win32_get_setting (const char *name, GValue *value);
|
||||
void _gdk_win32_screen_on_displaychange_event (GdkWin32Screen *screen);
|
||||
GdkSurface *gdk_win32_screen_get_root_window (GdkWin32Screen *screen);
|
||||
GdkSurface *gdk_win32_display_get_root_window (GdkDisplay *display);
|
||||
|
||||
/* Distributed display manager implementation */
|
||||
GdkDisplay *_gdk_win32_display_open (const char *display_name);
|
||||
void _gdk_win32_append_event (GdkEvent *event);
|
||||
|
||||
|
||||
guint32 _gdk_win32_keymap_get_decimal_mark (GdkWin32Keymap *keymap);
|
||||
|
||||
void _gdk_win32_surface_handle_aerosnap (GdkSurface *window,
|
||||
GdkWin32AeroSnapCombo combo);
|
||||
|
||||
@@ -449,8 +295,15 @@ gboolean _gdk_win32_check_processor (GdkWin32ProcessorCheckType check_type);
|
||||
GdkPixbuf *gdk_win32_icon_to_pixbuf_libgtk_only (HICON hicon,
|
||||
double *x_hot,
|
||||
double *y_hot);
|
||||
HICON gdk_win32_pixbuf_to_hicon_libgtk_only (GdkPixbuf *pixbuf);
|
||||
void gdk_win32_set_modal_dialog_libgtk_only (HWND window);
|
||||
|
||||
gpointer gdk_win32_handle_table_lookup_ (HWND handle);
|
||||
|
||||
extern IMAGE_DOS_HEADER __ImageBase;
|
||||
|
||||
static inline HMODULE
|
||||
this_module (void)
|
||||
{
|
||||
return (HMODULE) &__ImageBase;
|
||||
}
|
||||
|
||||
|
||||
@@ -113,7 +113,15 @@ _gdk_win32_get_setting (const char *name,
|
||||
}
|
||||
else if (strcmp ("gtk-font-name", name) == 0)
|
||||
{
|
||||
char *font_name = _get_system_font_name (_gdk_display_hdc);
|
||||
char *font_name = NULL;
|
||||
HDC hdc = NULL;
|
||||
|
||||
if ((hdc = GetDC (HWND_DESKTOP)) != NULL)
|
||||
{
|
||||
font_name = _get_system_font_name (hdc);
|
||||
ReleaseDC (HWND_DESKTOP, hdc);
|
||||
hdc = NULL;
|
||||
}
|
||||
|
||||
if (font_name)
|
||||
{
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#include "gdkdisplay-win32.h"
|
||||
#include "gdkdevice-win32.h"
|
||||
#include "gdkcairocontext-win32.h"
|
||||
#include "gdkmonitor-win32.h"
|
||||
|
||||
#include <cairo-win32.h>
|
||||
#include <dwmapi.h>
|
||||
@@ -338,7 +339,7 @@ RegisterGdkClass (GType wtype)
|
||||
wcl.lpfnWndProc = _gdk_win32_surface_procedure;
|
||||
wcl.cbClsExtra = 0;
|
||||
wcl.cbWndExtra = 0;
|
||||
wcl.hInstance = _gdk_dll_hinstance;
|
||||
wcl.hInstance = this_module ();
|
||||
wcl.hIcon = 0;
|
||||
wcl.hIconSm = 0;
|
||||
|
||||
@@ -355,7 +356,7 @@ RegisterGdkClass (GType wtype)
|
||||
if (0 == hAppIcon && 0 == hAppIconSm)
|
||||
{
|
||||
// fallback : load icon from GTK DLL
|
||||
if (0 != GetModuleFileName (_gdk_dll_hinstance, sLoc, MAX_PATH))
|
||||
if (0 != GetModuleFileName (this_module (), sLoc, MAX_PATH))
|
||||
{
|
||||
ExtractIconEx (sLoc, 0, &hAppIcon, &hAppIconSm, 1);
|
||||
}
|
||||
@@ -492,7 +493,7 @@ gdk_win32_surface_constructed (GObject *object)
|
||||
CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
owner,
|
||||
NULL,
|
||||
_gdk_dll_hinstance,
|
||||
this_module (),
|
||||
surface);
|
||||
if (impl->handle == NULL)
|
||||
{
|
||||
@@ -625,7 +626,8 @@ get_outer_rect (GdkSurface *window,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_surface_fullscreen (GdkSurface *window);
|
||||
gdk_win32_surface_fullscreen (GdkSurface *window,
|
||||
GdkMonitor *monitor);
|
||||
|
||||
static void
|
||||
show_window_internal (GdkSurface *window,
|
||||
@@ -789,11 +791,7 @@ show_window_internal (GdkSurface *window,
|
||||
}
|
||||
|
||||
|
||||
if (window->state & GDK_TOPLEVEL_STATE_FULLSCREEN)
|
||||
{
|
||||
gdk_win32_surface_fullscreen (window);
|
||||
}
|
||||
else if (window->state & GDK_TOPLEVEL_STATE_MAXIMIZED)
|
||||
if (window->state & GDK_TOPLEVEL_STATE_MAXIMIZED)
|
||||
{
|
||||
GtkShowWindow (window, SW_MAXIMIZE);
|
||||
}
|
||||
@@ -2406,7 +2404,7 @@ RegisterGdkDumbClass ()
|
||||
wcl.lpfnWndProc = DefWindowProcW;
|
||||
wcl.cbClsExtra = 0;
|
||||
wcl.cbWndExtra = 0;
|
||||
wcl.hInstance = _gdk_dll_hinstance;
|
||||
wcl.hInstance = this_module ();
|
||||
wcl.hIcon = 0;
|
||||
wcl.hIconSm = 0;
|
||||
wcl.lpszMenuName = NULL;
|
||||
@@ -2447,7 +2445,7 @@ ensure_snap_indicator_exists (GdkW32DragMoveResizeContext *context)
|
||||
0, 0,
|
||||
NULL,
|
||||
NULL,
|
||||
_gdk_dll_hinstance,
|
||||
this_module (),
|
||||
NULL);
|
||||
|
||||
context->shape_indicator = handle;
|
||||
@@ -4008,11 +4006,12 @@ gdk_win32_surface_unmaximize (GdkSurface *surface)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_surface_fullscreen (GdkSurface *window)
|
||||
gdk_win32_surface_fullscreen (GdkSurface *window,
|
||||
GdkMonitor *monitor)
|
||||
{
|
||||
int x, y, width, height;
|
||||
FullscreenInfo *fi;
|
||||
HMONITOR monitor;
|
||||
HMONITOR hmonitor = NULL;
|
||||
MONITORINFO mi;
|
||||
|
||||
g_return_if_fail (GDK_IS_SURFACE (window));
|
||||
@@ -4025,9 +4024,14 @@ gdk_win32_surface_fullscreen (GdkSurface *window)
|
||||
{
|
||||
GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
|
||||
|
||||
monitor = MonitorFromWindow (GDK_SURFACE_HWND (window), MONITOR_DEFAULTTONEAREST);
|
||||
if (monitor && GDK_IS_WIN32_MONITOR (monitor))
|
||||
hmonitor = GDK_WIN32_MONITOR (monitor)->hmonitor;
|
||||
|
||||
if (!hmonitor)
|
||||
hmonitor = MonitorFromWindow (GDK_SURFACE_HWND (window), MONITOR_DEFAULTTONEAREST);
|
||||
|
||||
mi.cbSize = sizeof (mi);
|
||||
if (monitor && GetMonitorInfo (monitor, &mi))
|
||||
if (hmonitor && GetMonitorInfo (hmonitor, &mi))
|
||||
{
|
||||
x = mi.rcMonitor.left;
|
||||
y = mi.rcMonitor.top;
|
||||
@@ -4869,9 +4873,16 @@ gdk_win32_toplevel_present (GdkToplevel *toplevel,
|
||||
if (gdk_toplevel_layout_get_fullscreen (layout, &fullscreen))
|
||||
{
|
||||
if (fullscreen)
|
||||
gdk_win32_surface_fullscreen (surface);
|
||||
{
|
||||
GdkMonitor *monitor;
|
||||
|
||||
monitor = gdk_toplevel_layout_get_fullscreen_monitor (layout);
|
||||
gdk_win32_surface_fullscreen (surface, monitor);
|
||||
}
|
||||
else
|
||||
gdk_win32_surface_unfullscreen (surface);
|
||||
{
|
||||
gdk_win32_surface_unfullscreen (surface);
|
||||
}
|
||||
}
|
||||
|
||||
gdk_win32_surface_show (surface, FALSE);
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
#include "gdkprivate-win32.h"
|
||||
#include "gdkwin32misc.h"
|
||||
|
||||
extern HINSTANCE _gdk_dll_hinstance;
|
||||
|
||||
G_DEFINE_TYPE (GdkWin32VulkanContext, gdk_win32_vulkan_context, GDK_TYPE_VULKAN_CONTEXT)
|
||||
|
||||
static VkResult
|
||||
@@ -47,7 +45,7 @@ gdk_win32_vulkan_context_create_surface (GdkVulkanContext *context,
|
||||
info.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR;
|
||||
info.pNext = NULL;
|
||||
info.flags = 0;
|
||||
info.hinstance = _gdk_dll_hinstance;
|
||||
info.hinstance = this_module ();
|
||||
info.hwnd = GDK_SURFACE_HWND (window);
|
||||
|
||||
/* This is necessary so that Vulkan sees the Window.
|
||||
|
||||
@@ -144,7 +144,8 @@ struct _GdkX11Display
|
||||
guint server_time_is_monotonic_time : 1;
|
||||
|
||||
/* GLX extensions we check */
|
||||
guint has_glx_swap_interval : 1;
|
||||
guint has_glx_sgi_swap_control : 1;
|
||||
guint has_glx_swap_control : 1;
|
||||
guint has_glx_create_context : 1;
|
||||
guint has_glx_texture_from_pixmap : 1;
|
||||
guint has_glx_video_sync : 1;
|
||||
|
||||
+1
-204
@@ -134,35 +134,6 @@ struct _GdkX11DragClass
|
||||
GdkDragClass parent_class;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
int keysym;
|
||||
int modifiers;
|
||||
} GrabKey;
|
||||
|
||||
static GrabKey grab_keys[] = {
|
||||
{ XK_Escape, 0 },
|
||||
{ XK_space, 0 },
|
||||
{ XK_KP_Space, 0 },
|
||||
{ XK_Return, 0 },
|
||||
{ XK_KP_Enter, 0 },
|
||||
{ XK_Up, 0 },
|
||||
{ XK_Up, Mod1Mask },
|
||||
{ XK_Down, 0 },
|
||||
{ XK_Down, Mod1Mask },
|
||||
{ XK_Left, 0 },
|
||||
{ XK_Left, Mod1Mask },
|
||||
{ XK_Right, 0 },
|
||||
{ XK_Right, Mod1Mask },
|
||||
{ XK_KP_Up, 0 },
|
||||
{ XK_KP_Up, Mod1Mask },
|
||||
{ XK_KP_Down, 0 },
|
||||
{ XK_KP_Down, Mod1Mask },
|
||||
{ XK_KP_Left, 0 },
|
||||
{ XK_KP_Left, Mod1Mask },
|
||||
{ XK_KP_Right, 0 },
|
||||
{ XK_KP_Right, Mod1Mask }
|
||||
};
|
||||
|
||||
/* Forward declarations */
|
||||
|
||||
static GdkSurfaceCache *gdk_surface_cache_ref (GdkSurfaceCache *cache);
|
||||
@@ -1861,20 +1832,15 @@ drag_grab (GdkDrag *drag)
|
||||
{
|
||||
GdkX11Drag *x11_drag = GDK_X11_DRAG (drag);
|
||||
GdkSeatCapabilities capabilities;
|
||||
GdkDisplay *display;
|
||||
Window root;
|
||||
GdkSeat *seat;
|
||||
int keycode, i;
|
||||
GdkCursor *cursor;
|
||||
|
||||
if (!x11_drag->ipc_surface)
|
||||
return FALSE;
|
||||
|
||||
display = gdk_drag_get_display (drag);
|
||||
root = GDK_DISPLAY_XROOTWIN (display);
|
||||
seat = gdk_device_get_seat (gdk_drag_get_device (drag));
|
||||
|
||||
capabilities = GDK_SEAT_CAPABILITY_ALL_POINTING | GDK_SEAT_CAPABILITY_KEYBOARD;
|
||||
capabilities = GDK_SEAT_CAPABILITY_ALL_POINTING;
|
||||
|
||||
cursor = gdk_drag_get_cursor (drag, x11_drag->current_action);
|
||||
g_set_object (&x11_drag->cursor, cursor);
|
||||
@@ -1886,46 +1852,6 @@ drag_grab (GdkDrag *drag)
|
||||
|
||||
g_set_object (&x11_drag->grab_seat, seat);
|
||||
|
||||
gdk_x11_display_error_trap_push (display);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (grab_keys); ++i)
|
||||
{
|
||||
int deviceid = gdk_x11_device_get_id (gdk_seat_get_keyboard (seat));
|
||||
unsigned char mask[XIMaskLen(XI_LASTEVENT)];
|
||||
XIGrabModifiers mods;
|
||||
XIEventMask evmask;
|
||||
int num_mods;
|
||||
|
||||
keycode = XKeysymToKeycode (GDK_DISPLAY_XDISPLAY (display),
|
||||
grab_keys[i].keysym);
|
||||
if (keycode == NoSymbol)
|
||||
continue;
|
||||
|
||||
memset (mask, 0, sizeof (mask));
|
||||
XISetMask (mask, XI_KeyPress);
|
||||
XISetMask (mask, XI_KeyRelease);
|
||||
|
||||
evmask.deviceid = deviceid;
|
||||
evmask.mask_len = sizeof (mask);
|
||||
evmask.mask = mask;
|
||||
|
||||
num_mods = 1;
|
||||
mods.modifiers = grab_keys[i].modifiers;
|
||||
|
||||
XIGrabKeycode (GDK_DISPLAY_XDISPLAY (display),
|
||||
deviceid,
|
||||
keycode,
|
||||
root,
|
||||
GrabModeAsync,
|
||||
GrabModeAsync,
|
||||
False,
|
||||
&evmask,
|
||||
num_mods,
|
||||
&mods);
|
||||
}
|
||||
|
||||
gdk_x11_display_error_trap_pop_ignored (display);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1933,41 +1859,13 @@ static void
|
||||
drag_ungrab (GdkDrag *drag)
|
||||
{
|
||||
GdkX11Drag *x11_drag = GDK_X11_DRAG (drag);
|
||||
GdkDisplay *display;
|
||||
GdkDevice *keyboard;
|
||||
Window root;
|
||||
int keycode, i;
|
||||
|
||||
if (!x11_drag->grab_seat)
|
||||
return;
|
||||
|
||||
gdk_seat_ungrab (x11_drag->grab_seat);
|
||||
|
||||
display = gdk_drag_get_display (drag);
|
||||
keyboard = gdk_seat_get_keyboard (x11_drag->grab_seat);
|
||||
root = GDK_DISPLAY_XROOTWIN (display);
|
||||
g_clear_object (&x11_drag->grab_seat);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (grab_keys); ++i)
|
||||
{
|
||||
XIGrabModifiers mods;
|
||||
int num_mods;
|
||||
|
||||
keycode = XKeysymToKeycode (GDK_DISPLAY_XDISPLAY (display),
|
||||
grab_keys[i].keysym);
|
||||
if (keycode == NoSymbol)
|
||||
continue;
|
||||
|
||||
num_mods = 1;
|
||||
mods.modifiers = grab_keys[i].modifiers;
|
||||
|
||||
XIUngrabKeycode (GDK_DISPLAY_XDISPLAY (display),
|
||||
gdk_x11_device_get_id (keyboard),
|
||||
keycode,
|
||||
root,
|
||||
num_mods,
|
||||
&mods);
|
||||
}
|
||||
}
|
||||
|
||||
GdkDrag *
|
||||
@@ -2191,103 +2089,6 @@ gdk_dnd_handle_motion_event (GdkDrag *drag,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_dnd_handle_key_event (GdkDrag *drag,
|
||||
GdkEvent *event)
|
||||
{
|
||||
GdkX11Drag *x11_drag = GDK_X11_DRAG (drag);
|
||||
GdkModifierType state;
|
||||
GdkDevice *pointer;
|
||||
GdkSeat *seat;
|
||||
int dx, dy;
|
||||
|
||||
dx = dy = 0;
|
||||
state = gdk_event_get_modifier_state (event);
|
||||
seat = gdk_event_get_seat (event);
|
||||
pointer = gdk_seat_get_pointer (seat);
|
||||
|
||||
if (event->event_type == GDK_KEY_PRESS)
|
||||
{
|
||||
guint keyval = gdk_key_event_get_keyval (event);
|
||||
|
||||
switch (keyval)
|
||||
{
|
||||
case GDK_KEY_Escape:
|
||||
gdk_drag_cancel (drag, GDK_DRAG_CANCEL_USER_CANCELLED);
|
||||
return TRUE;
|
||||
|
||||
case GDK_KEY_space:
|
||||
case GDK_KEY_Return:
|
||||
case GDK_KEY_ISO_Enter:
|
||||
case GDK_KEY_KP_Enter:
|
||||
case GDK_KEY_KP_Space:
|
||||
if ((gdk_drag_get_selected_action (drag) != 0) &&
|
||||
(x11_drag->proxy_xid != None))
|
||||
{
|
||||
g_signal_emit_by_name (drag, "drop-performed");
|
||||
}
|
||||
else
|
||||
gdk_drag_cancel (drag, GDK_DRAG_CANCEL_NO_TARGET);
|
||||
|
||||
return TRUE;
|
||||
|
||||
case GDK_KEY_Up:
|
||||
case GDK_KEY_KP_Up:
|
||||
dy = (state & GDK_ALT_MASK) ? -BIG_STEP : -SMALL_STEP;
|
||||
break;
|
||||
|
||||
case GDK_KEY_Down:
|
||||
case GDK_KEY_KP_Down:
|
||||
dy = (state & GDK_ALT_MASK) ? BIG_STEP : SMALL_STEP;
|
||||
break;
|
||||
|
||||
case GDK_KEY_Left:
|
||||
case GDK_KEY_KP_Left:
|
||||
dx = (state & GDK_ALT_MASK) ? -BIG_STEP : -SMALL_STEP;
|
||||
break;
|
||||
|
||||
case GDK_KEY_Right:
|
||||
case GDK_KEY_KP_Right:
|
||||
dx = (state & GDK_ALT_MASK) ? BIG_STEP : SMALL_STEP;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* The state is not yet updated in the event, so we need
|
||||
* to query it here. We could use XGetModifierMapping, but
|
||||
* that would be overkill.
|
||||
*/
|
||||
gdk_x11_device_xi2_query_state (pointer, NULL, NULL, NULL, &state);
|
||||
|
||||
if (dx != 0 || dy != 0)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
Display *xdisplay;
|
||||
GdkX11Screen *screen;
|
||||
Window dest;
|
||||
|
||||
x11_drag->last_x += dx;
|
||||
x11_drag->last_y += dy;
|
||||
|
||||
display = gdk_event_get_display ((GdkEvent *)event);
|
||||
xdisplay = GDK_DISPLAY_XDISPLAY (display);
|
||||
screen = GDK_X11_DISPLAY (display)->screen;
|
||||
dest = GDK_SCREEN_XROOTWIN (screen);
|
||||
|
||||
XWarpPointer (xdisplay, None, dest, 0, 0, 0, 0,
|
||||
round (x11_drag->last_x * screen->surface_scale),
|
||||
round (x11_drag->last_y * screen->surface_scale));
|
||||
}
|
||||
|
||||
gdk_drag_update (drag, x11_drag->last_x, x11_drag->last_y, state,
|
||||
gdk_event_get_time (event));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_dnd_handle_grab_broken_event (GdkDrag *drag,
|
||||
GdkEvent *event)
|
||||
@@ -2354,10 +2155,6 @@ gdk_x11_drag_handle_event (GdkDrag *drag,
|
||||
case GDK_BUTTON_RELEASE:
|
||||
return gdk_dnd_handle_button_event (drag, event);
|
||||
|
||||
case GDK_KEY_PRESS:
|
||||
case GDK_KEY_RELEASE:
|
||||
return gdk_dnd_handle_key_event (drag, event);
|
||||
|
||||
case GDK_GRAB_BROKEN:
|
||||
return gdk_dnd_handle_grab_broken_event (drag, event);
|
||||
|
||||
|
||||
+57
-44
@@ -162,7 +162,7 @@ gdk_x11_gl_context_glx_end_frame (GdkDrawContext *draw_context,
|
||||
if (display_x11->has_glx_video_sync)
|
||||
glXGetVideoSyncSGI (&end_frame_counter);
|
||||
|
||||
if (self->do_frame_sync && !display_x11->has_glx_swap_interval)
|
||||
if (self->do_frame_sync && !display_x11->has_glx_sgi_swap_control && !display_x11->has_glx_swap_control)
|
||||
{
|
||||
glFinish ();
|
||||
|
||||
@@ -249,7 +249,7 @@ gdk_x11_gl_context_glx_make_current (GdkGLContext *context,
|
||||
if (!glXMakeContextCurrent (dpy, drawable, drawable, self->glx_context))
|
||||
return FALSE;
|
||||
|
||||
if (!surfaceless && GDK_X11_DISPLAY (display)->has_glx_swap_interval)
|
||||
if (!surfaceless)
|
||||
{
|
||||
/* If the WM is compositing there is no particular need to delay
|
||||
* the swap when drawing on the offscreen, rendering to the screen
|
||||
@@ -257,14 +257,35 @@ gdk_x11_gl_context_glx_make_current (GdkGLContext *context,
|
||||
* to the vblank. */
|
||||
do_frame_sync = ! gdk_display_is_composited (display);
|
||||
|
||||
if (do_frame_sync != self->do_frame_sync)
|
||||
if (GDK_X11_DISPLAY (display)->has_glx_swap_control)
|
||||
{
|
||||
self->do_frame_sync = do_frame_sync;
|
||||
if (do_frame_sync != self->do_frame_sync)
|
||||
{
|
||||
self->do_frame_sync = do_frame_sync;
|
||||
|
||||
if (do_frame_sync)
|
||||
glXSwapIntervalSGI (1);
|
||||
else
|
||||
glXSwapIntervalSGI (0);
|
||||
if (do_frame_sync)
|
||||
glXSwapIntervalEXT (dpy, drawable, 1);
|
||||
else
|
||||
glXSwapIntervalEXT (dpy, drawable, 0);
|
||||
}
|
||||
}
|
||||
else if (GDK_X11_DISPLAY (display)->has_glx_sgi_swap_control)
|
||||
{
|
||||
/* If the WM is compositing there is no particular need to delay
|
||||
* the swap when drawing on the offscreen, rendering to the screen
|
||||
* happens later anyway, and its up to the compositor to sync that
|
||||
* to the vblank. */
|
||||
do_frame_sync = ! gdk_display_is_composited (display);
|
||||
|
||||
if (do_frame_sync != self->do_frame_sync)
|
||||
{
|
||||
self->do_frame_sync = do_frame_sync;
|
||||
|
||||
if (do_frame_sync)
|
||||
glXSwapIntervalSGI (1);
|
||||
else
|
||||
glXSwapIntervalSGI (0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,29 +308,20 @@ gdk_x11_gl_context_glx_get_damage (GdkGLContext *context)
|
||||
glXQueryDrawable (dpy, gdk_x11_gl_context_glx_get_drawable (self),
|
||||
GLX_BACK_BUFFER_AGE_EXT, &buffer_age);
|
||||
|
||||
switch (buffer_age)
|
||||
if (buffer_age > 0 && buffer_age <= GDK_GL_MAX_TRACKED_BUFFERS)
|
||||
{
|
||||
case 1:
|
||||
return cairo_region_create ();
|
||||
break;
|
||||
cairo_region_t *damage = cairo_region_create ();
|
||||
int i;
|
||||
|
||||
case 2:
|
||||
if (context->old_updated_area[0])
|
||||
return cairo_region_copy (context->old_updated_area[0]);
|
||||
break;
|
||||
for (i = 0; i < buffer_age - 1; i++)
|
||||
{
|
||||
if (context->old_updated_area[i] == NULL)
|
||||
return GDK_GL_CONTEXT_CLASS (gdk_x11_gl_context_glx_parent_class)->get_damage (context);
|
||||
|
||||
case 3:
|
||||
if (context->old_updated_area[0] &&
|
||||
context->old_updated_area[1])
|
||||
{
|
||||
cairo_region_t *damage = cairo_region_copy (context->old_updated_area[0]);
|
||||
cairo_region_union (damage, context->old_updated_area[1]);
|
||||
return damage;
|
||||
}
|
||||
break;
|
||||
cairo_region_union (damage, context->old_updated_area[i]);
|
||||
}
|
||||
|
||||
default:
|
||||
;
|
||||
return damage;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -531,14 +543,14 @@ gdk_x11_context_create_glx_context (GdkGLContext *context,
|
||||
if (share != NULL)
|
||||
share_glx = GDK_X11_GL_CONTEXT_GLX (share);
|
||||
|
||||
gdk_x11_display_error_trap_push (display);
|
||||
|
||||
supported_versions = gdk_gl_versions_get_for_api (api);
|
||||
for (j = 0; gdk_gl_version_greater_equal (&supported_versions[j], &version); j++)
|
||||
{
|
||||
context_attribs [major_idx] = gdk_gl_version_get_major (&supported_versions[j]);
|
||||
context_attribs [minor_idx] = gdk_gl_version_get_minor (&supported_versions[j]);
|
||||
|
||||
gdk_x11_display_error_trap_push (display);
|
||||
|
||||
/* If we don't have access to GLX_ARB_create_context_profile, then
|
||||
* we have to fall back to the old GLX 1.3 API.
|
||||
*/
|
||||
@@ -556,22 +568,19 @@ gdk_x11_context_create_glx_context (GdkGLContext *context,
|
||||
True,
|
||||
context_attribs);
|
||||
|
||||
if (ctx)
|
||||
if (ctx == NULL)
|
||||
{
|
||||
gdk_x11_display_error_trap_pop_ignored (display);
|
||||
}
|
||||
else if (gdk_x11_display_error_trap_pop (display))
|
||||
{
|
||||
glXDestroyContext (dpy, ctx);
|
||||
ctx = NULL;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if (ctx == NULL)
|
||||
{
|
||||
gdk_x11_display_error_trap_pop_ignored (display);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (gdk_x11_display_error_trap_pop (display))
|
||||
{
|
||||
glXDestroyContext (dpy, ctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
GDK_DISPLAY_DEBUG (display, OPENGL,
|
||||
"Realized GLX context[%p], %s, version: %d.%d",
|
||||
context_glx->glx_context,
|
||||
@@ -945,8 +954,10 @@ gdk_x11_display_init_glx (GdkX11Display *display_x11,
|
||||
epoxy_has_glx_extension (dpy, screen_num, "GLX_ARB_create_context_profile");
|
||||
display_x11->has_glx_create_es2_context =
|
||||
epoxy_has_glx_extension (dpy, screen_num, "GLX_EXT_create_context_es2_profile");
|
||||
display_x11->has_glx_swap_interval =
|
||||
display_x11->has_glx_sgi_swap_control =
|
||||
epoxy_has_glx_extension (dpy, screen_num, "GLX_SGI_swap_control");
|
||||
display_x11->has_glx_swap_control =
|
||||
epoxy_has_glx_extension (dpy, screen_num, "GLX_EXT_swap_control");
|
||||
display_x11->has_glx_texture_from_pixmap =
|
||||
epoxy_has_glx_extension (dpy, screen_num, "GLX_EXT_texture_from_pixmap");
|
||||
display_x11->has_glx_video_sync =
|
||||
@@ -1007,6 +1018,7 @@ gdk_x11_display_init_glx (GdkX11Display *display_x11,
|
||||
"\t* GLX_ARB_create_context_profile: %s\n"
|
||||
"\t* GLX_EXT_create_context_es2_profile: %s\n"
|
||||
"\t* GLX_SGI_swap_control: %s\n"
|
||||
"\t* GLX_EXT_swap_control: %s\n"
|
||||
"\t* GLX_EXT_texture_from_pixmap: %s\n"
|
||||
"\t* GLX_SGI_video_sync: %s\n"
|
||||
"\t* GLX_EXT_buffer_age: %s\n"
|
||||
@@ -1018,7 +1030,8 @@ gdk_x11_display_init_glx (GdkX11Display *display_x11,
|
||||
glXGetClientString (dpy, GLX_VENDOR),
|
||||
display_x11->has_glx_create_context ? "yes" : "no",
|
||||
display_x11->has_glx_create_es2_context ? "yes" : "no",
|
||||
display_x11->has_glx_swap_interval ? "yes" : "no",
|
||||
display_x11->has_glx_sgi_swap_control ? "yes" : "no",
|
||||
display_x11->has_glx_swap_control ? "yes" : "no",
|
||||
display_x11->has_glx_texture_from_pixmap ? "yes" : "no",
|
||||
display_x11->has_glx_video_sync ? "yes" : "no",
|
||||
display_x11->has_glx_buffer_age ? "yes" : "no",
|
||||
|
||||
+19
-3
@@ -685,8 +685,13 @@ init_randr13 (GdkX11Screen *x11_screen)
|
||||
for (i = 0; i < resources->noutput; ++i)
|
||||
{
|
||||
RROutput output = resources->outputs[i];
|
||||
XRROutputInfo *output_info =
|
||||
XRRGetOutputInfo (x11_screen->xdisplay, resources, output);
|
||||
XRROutputInfo *output_info;
|
||||
|
||||
gdk_x11_display_error_trap_push (display);
|
||||
output_info = XRRGetOutputInfo (x11_screen->xdisplay, resources, output);
|
||||
|
||||
if (gdk_x11_display_error_trap_pop (display))
|
||||
continue;
|
||||
|
||||
if (output_info->connection == RR_Disconnected)
|
||||
{
|
||||
@@ -697,13 +702,22 @@ init_randr13 (GdkX11Screen *x11_screen)
|
||||
if (output_info->crtc)
|
||||
{
|
||||
GdkX11Monitor *monitor;
|
||||
XRRCrtcInfo *crtc = XRRGetCrtcInfo (x11_screen->xdisplay, resources, output_info->crtc);
|
||||
XRRCrtcInfo *crtc;
|
||||
char *name;
|
||||
GdkRectangle geometry;
|
||||
GdkRectangle newgeo;
|
||||
int j;
|
||||
int refresh_rate = 0;
|
||||
|
||||
gdk_x11_display_error_trap_push (display);
|
||||
crtc = XRRGetCrtcInfo (x11_screen->xdisplay, resources, output_info->crtc);
|
||||
|
||||
if (gdk_x11_display_error_trap_pop (display))
|
||||
{
|
||||
XRRFreeOutputInfo (output_info);
|
||||
continue;
|
||||
}
|
||||
|
||||
for (j = 0; j < resources->nmode; j++)
|
||||
{
|
||||
XRRModeInfo *xmode = &resources->modes[j];
|
||||
@@ -775,8 +789,10 @@ init_randr13 (GdkX11Screen *x11_screen)
|
||||
}
|
||||
|
||||
x11_display->primary_monitor = 0;
|
||||
gdk_x11_display_error_trap_push (display);
|
||||
primary_output = XRRGetOutputPrimary (x11_screen->xdisplay,
|
||||
x11_screen->xroot_window);
|
||||
gdk_x11_display_error_trap_pop_ignored (display);
|
||||
|
||||
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (x11_display->monitors)); i++)
|
||||
{
|
||||
|
||||
@@ -89,7 +89,7 @@ gdk_x11_selection_input_stream_fill_buffer (GdkX11SelectionInputStream *stream,
|
||||
if (size == 0)
|
||||
{
|
||||
/* EOF marker, put it back */
|
||||
g_async_queue_push_front_unlocked (priv->chunks, bytes);
|
||||
g_async_queue_push_front_unlocked (priv->chunks, g_steal_pointer (&bytes));
|
||||
break;
|
||||
}
|
||||
else if (size > count)
|
||||
@@ -107,7 +107,7 @@ gdk_x11_selection_input_stream_fill_buffer (GdkX11SelectionInputStream *stream,
|
||||
memcpy (buffer, g_bytes_get_data (bytes, NULL), size);
|
||||
}
|
||||
|
||||
g_bytes_unref (bytes);
|
||||
g_bytes_unref (g_steal_pointer (&bytes));
|
||||
result += size;
|
||||
if (buffer)
|
||||
buffer += size;
|
||||
@@ -165,9 +165,7 @@ gdk_x11_selection_input_stream_complete (GdkX11SelectionInputStream *stream)
|
||||
GDK_X11_DISPLAY (priv->display)->streams = g_slist_remove (GDK_X11_DISPLAY (priv->display)->streams, stream);
|
||||
g_signal_handlers_disconnect_by_func (priv->display,
|
||||
gdk_x11_selection_input_stream_xevent,
|
||||
stream);
|
||||
|
||||
g_object_unref (stream);
|
||||
g_steal_pointer (&stream));
|
||||
}
|
||||
|
||||
static gssize
|
||||
@@ -416,7 +414,7 @@ gdk_x11_selection_input_stream_xevent (GdkDisplay *display,
|
||||
"%s:%s: got PropertyNotify erroring out of INCR",
|
||||
priv->selection, priv->target);
|
||||
/* error, should we signal one? */
|
||||
gdk_x11_selection_input_stream_complete (stream);
|
||||
g_clear_pointer (&stream, gdk_x11_selection_input_stream_complete);
|
||||
}
|
||||
else if (g_bytes_get_size (bytes) == 0 || type == None)
|
||||
{
|
||||
@@ -424,7 +422,7 @@ gdk_x11_selection_input_stream_xevent (GdkDisplay *display,
|
||||
"%s:%s: got PropertyNotify ending INCR",
|
||||
priv->selection, priv->target);
|
||||
g_bytes_unref (bytes);
|
||||
gdk_x11_selection_input_stream_complete (stream);
|
||||
g_clear_pointer (&stream, gdk_x11_selection_input_stream_complete);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -467,7 +465,7 @@ gdk_x11_selection_input_stream_xevent (GdkDisplay *display,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_NOT_FOUND,
|
||||
_("Format %s not supported"), priv->target);
|
||||
gdk_x11_selection_input_stream_complete (stream);
|
||||
g_clear_pointer (&stream, gdk_x11_selection_input_stream_complete);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -478,7 +476,7 @@ gdk_x11_selection_input_stream_xevent (GdkDisplay *display,
|
||||
|
||||
if (bytes == NULL)
|
||||
{
|
||||
gdk_x11_selection_input_stream_complete (stream);
|
||||
g_clear_pointer (&stream, gdk_x11_selection_input_stream_complete);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -500,7 +498,7 @@ gdk_x11_selection_input_stream_xevent (GdkDisplay *display,
|
||||
g_bytes_get_size (bytes));
|
||||
g_async_queue_push (priv->chunks, bytes);
|
||||
|
||||
gdk_x11_selection_input_stream_complete (stream);
|
||||
g_clear_pointer (&stream, gdk_x11_selection_input_stream_complete);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -541,7 +539,10 @@ gdk_x11_selection_input_stream_new_async (GdkDisplay *display,
|
||||
priv->property = g_strdup_printf ("GDK_SELECTION_%p", stream);
|
||||
priv->xproperty = gdk_x11_get_xatom_by_name_for_display (display, priv->property);
|
||||
|
||||
g_signal_connect (display, "xevent", G_CALLBACK (gdk_x11_selection_input_stream_xevent), stream);
|
||||
g_signal_connect_data (display, "xevent",
|
||||
G_CALLBACK (gdk_x11_selection_input_stream_xevent),
|
||||
g_steal_pointer (&stream),
|
||||
(GClosureNotify) g_object_unref, 0);
|
||||
|
||||
XConvertSelection (GDK_DISPLAY_XDISPLAY (display),
|
||||
priv->xselection,
|
||||
@@ -577,7 +578,6 @@ gdk_x11_selection_input_stream_new_finish (GAsyncResult *result,
|
||||
*type = priv->type;
|
||||
if (format)
|
||||
*format = priv->format;
|
||||
g_object_ref (stream);
|
||||
}
|
||||
|
||||
return G_INPUT_STREAM (stream);
|
||||
|
||||
@@ -5318,7 +5318,8 @@ gdk_x11_toplevel_export_handle_finish (GdkToplevel *toplevel,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_x11_toplevel_unexport_handle (GdkToplevel *toplevel)
|
||||
gdk_x11_toplevel_unexport_handle (GdkToplevel *toplevel,
|
||||
const char *handle)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
+42
-14
@@ -579,7 +579,7 @@ discard_batch (GskGLCommandQueue *self)
|
||||
self->batches.len--;
|
||||
}
|
||||
|
||||
void
|
||||
gboolean
|
||||
gsk_gl_command_queue_begin_draw (GskGLCommandQueue *self,
|
||||
GskGLUniformProgram *program,
|
||||
guint width,
|
||||
@@ -596,7 +596,7 @@ gsk_gl_command_queue_begin_draw (GskGLCommandQueue *self,
|
||||
* of batches we can have in one frame.
|
||||
*/
|
||||
if (will_ignore_batch (self))
|
||||
return;
|
||||
return FALSE;
|
||||
|
||||
self->program_info = program;
|
||||
|
||||
@@ -617,6 +617,8 @@ gsk_gl_command_queue_begin_draw (GskGLCommandQueue *self,
|
||||
self->fbo_max = MAX (self->fbo_max, batch->draw.framebuffer);
|
||||
|
||||
self->in_draw = TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -721,6 +723,10 @@ gsk_gl_command_queue_split_draw (GskGLCommandQueue *self)
|
||||
|
||||
g_assert (GSK_IS_GL_COMMAND_QUEUE (self));
|
||||
g_assert (self->batches.len > 0);
|
||||
|
||||
if (will_ignore_batch (self))
|
||||
return;
|
||||
|
||||
g_assert (self->in_draw == TRUE);
|
||||
|
||||
program = self->program_info;
|
||||
@@ -1441,6 +1447,7 @@ gsk_gl_command_queue_create_framebuffer (GskGLCommandQueue *self)
|
||||
return fbo_id;
|
||||
}
|
||||
|
||||
|
||||
static GdkMemoryFormat
|
||||
memory_format_gl_format (GdkMemoryFormat data_format,
|
||||
gboolean use_es,
|
||||
@@ -1448,7 +1455,8 @@ memory_format_gl_format (GdkMemoryFormat data_format,
|
||||
guint minor,
|
||||
guint *gl_internalformat,
|
||||
guint *gl_format,
|
||||
guint *gl_type)
|
||||
guint *gl_type,
|
||||
GLint (*gl_swizzle)[4])
|
||||
{
|
||||
if (gdk_memory_format_gl_format (data_format,
|
||||
use_es,
|
||||
@@ -1456,7 +1464,9 @@ memory_format_gl_format (GdkMemoryFormat data_format,
|
||||
minor,
|
||||
gl_internalformat,
|
||||
gl_format,
|
||||
gl_type))
|
||||
gl_type,
|
||||
gl_swizzle) &&
|
||||
gdk_memory_format_alpha (data_format) != GDK_MEMORY_ALPHA_STRAIGHT)
|
||||
return data_format;
|
||||
|
||||
if (gdk_memory_format_prefers_high_depth (data_format))
|
||||
@@ -1468,7 +1478,8 @@ memory_format_gl_format (GdkMemoryFormat data_format,
|
||||
minor,
|
||||
gl_internalformat,
|
||||
gl_format,
|
||||
gl_type))
|
||||
gl_type,
|
||||
gl_swizzle))
|
||||
return data_format;
|
||||
}
|
||||
|
||||
@@ -1479,7 +1490,8 @@ memory_format_gl_format (GdkMemoryFormat data_format,
|
||||
minor,
|
||||
gl_internalformat,
|
||||
gl_format,
|
||||
gl_type))
|
||||
gl_type,
|
||||
gl_swizzle))
|
||||
{
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
@@ -1502,6 +1514,7 @@ gsk_gl_command_queue_do_upload_texture_chunk (GskGLCommandQueue *self,
|
||||
GLenum gl_internalformat;
|
||||
GLenum gl_format;
|
||||
GLenum gl_type;
|
||||
GLint gl_swizzle[4];
|
||||
gsize bpp;
|
||||
gboolean use_es;
|
||||
int major, minor;
|
||||
@@ -1518,7 +1531,8 @@ gsk_gl_command_queue_do_upload_texture_chunk (GskGLCommandQueue *self,
|
||||
minor,
|
||||
&gl_internalformat,
|
||||
&gl_format,
|
||||
&gl_type);
|
||||
&gl_type,
|
||||
&gl_swizzle);
|
||||
|
||||
gdk_texture_downloader_init (&downloader, texture);
|
||||
gdk_texture_downloader_set_format (&downloader, data_format);
|
||||
@@ -1553,6 +1567,18 @@ gsk_gl_command_queue_do_upload_texture_chunk (GskGLCommandQueue *self,
|
||||
|
||||
glPixelStorei (GL_UNPACK_ALIGNMENT, 4);
|
||||
|
||||
/* Only apply swizzle if really needed, might not even be
|
||||
* supported if default values are set
|
||||
*/
|
||||
if (gl_swizzle[0] != GL_RED || gl_swizzle[1] != GL_GREEN || gl_swizzle[2] != GL_BLUE)
|
||||
{
|
||||
/* Set each channel independently since GLES 3.0 doesn't support the iv method */
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, gl_swizzle[0]);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G, gl_swizzle[1]);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, gl_swizzle[2]);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, gl_swizzle[3]);
|
||||
}
|
||||
|
||||
g_bytes_unref (bytes);
|
||||
}
|
||||
|
||||
@@ -1567,6 +1593,7 @@ gsk_gl_command_queue_upload_texture_chunks (GskGLCommandQueue *self,
|
||||
GLenum gl_internalformat;
|
||||
GLenum gl_format;
|
||||
GLenum gl_type;
|
||||
GLint gl_swizzle[4];
|
||||
gboolean use_es;
|
||||
int texture_id;
|
||||
int major, minor;
|
||||
@@ -1605,13 +1632,14 @@ gsk_gl_command_queue_upload_texture_chunks (GskGLCommandQueue *self,
|
||||
use_es = gdk_gl_context_get_use_es (self->context);
|
||||
gdk_gl_context_get_version (self->context, &major, &minor);
|
||||
data_format = gdk_texture_get_format (chunks[0].texture);
|
||||
memory_format_gl_format (data_format,
|
||||
use_es,
|
||||
major,
|
||||
minor,
|
||||
&gl_internalformat,
|
||||
&gl_format,
|
||||
&gl_type);
|
||||
data_format = memory_format_gl_format (data_format,
|
||||
use_es,
|
||||
major,
|
||||
minor,
|
||||
&gl_internalformat,
|
||||
&gl_format,
|
||||
&gl_type,
|
||||
&gl_swizzle);
|
||||
|
||||
glTexImage2D (GL_TEXTURE_2D, 0, gl_internalformat, width, height, 0, gl_format, gl_type, NULL);
|
||||
|
||||
|
||||
@@ -331,7 +331,7 @@ void gsk_gl_command_queue_delete_program (GskGLCommandQueue
|
||||
void gsk_gl_command_queue_clear (GskGLCommandQueue *self,
|
||||
guint clear_bits,
|
||||
const graphene_rect_t *viewport);
|
||||
void gsk_gl_command_queue_begin_draw (GskGLCommandQueue *self,
|
||||
gboolean gsk_gl_command_queue_begin_draw (GskGLCommandQueue *self,
|
||||
GskGLUniformProgram *program_info,
|
||||
guint width,
|
||||
guint height);
|
||||
|
||||
@@ -124,7 +124,7 @@ gsk_gl_compiler_new (GskGLDriver *driver,
|
||||
self->driver = g_object_ref (driver);
|
||||
self->debug_shaders = !!debug_shaders;
|
||||
|
||||
context = gsk_gl_command_queue_get_context (self->driver->shared_command_queue);
|
||||
context = gsk_gl_driver_get_context (self->driver);
|
||||
|
||||
if (gdk_gl_context_get_use_es (context))
|
||||
{
|
||||
|
||||
@@ -761,7 +761,8 @@ gsk_gl_driver_load_texture (GskGLDriver *self,
|
||||
GdkGLContext *texture_context = gdk_gl_texture_get_context (gl_texture);
|
||||
|
||||
if (gdk_gl_context_is_shared (context, texture_context) &&
|
||||
(!ensure_mipmap || gdk_gl_texture_has_mipmap (gl_texture)))
|
||||
(!ensure_mipmap || gdk_gl_texture_has_mipmap (gl_texture)) &&
|
||||
gdk_memory_format_alpha (gdk_texture_get_format (texture)) != GDK_MEMORY_ALPHA_STRAIGHT)
|
||||
{
|
||||
/* A GL texture from the same GL context is a simple task... */
|
||||
return gdk_gl_texture_get_id (gl_texture);
|
||||
@@ -1131,7 +1132,7 @@ gsk_gl_driver_lookup_shader (GskGLDriver *self,
|
||||
return program;
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
#if 0
|
||||
void
|
||||
gsk_gl_driver_save_texture_to_png (GskGLDriver *driver,
|
||||
int texture_id,
|
||||
|
||||
@@ -175,7 +175,7 @@ GskGLProgram * gsk_gl_driver_lookup_shader (GskGLDriver *s
|
||||
GskGLShader *shader,
|
||||
GError **error);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
#if 0
|
||||
void gsk_gl_driver_save_texture_to_png (GskGLDriver *self,
|
||||
int texture_id,
|
||||
int width,
|
||||
|
||||
+957
-913
File diff suppressed because it is too large
Load Diff
@@ -88,7 +88,7 @@ gsk_gl_texture_library_real_compact (GskGLTextureLibrary *self,
|
||||
GskGLTextureAtlasEntry *entry;
|
||||
GHashTableIter iter;
|
||||
guint dropped = 0;
|
||||
guint atlased = 0;
|
||||
G_GNUC_UNUSED guint atlased = 0;
|
||||
|
||||
g_hash_table_iter_init (&iter, self->hash_table);
|
||||
while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&entry))
|
||||
|
||||
@@ -4413,6 +4413,11 @@ gsk_shadow_node_draw (GskRenderNode *node,
|
||||
pattern = cairo_pop_group (cr);
|
||||
cairo_restore (cr);
|
||||
|
||||
cairo_save (cr);
|
||||
/* clip so the blur area stays small */
|
||||
gsk_cairo_rectangle (cr, &node->bounds);
|
||||
cairo_clip (cr);
|
||||
|
||||
for (i = 0; i < self->n_shadows; i++)
|
||||
{
|
||||
GskShadow *shadow = &self->shadows[i];
|
||||
@@ -4434,6 +4439,7 @@ gsk_shadow_node_draw (GskRenderNode *node,
|
||||
|
||||
cairo_set_source (cr, pattern);
|
||||
cairo_paint (cr);
|
||||
cairo_restore (cr);
|
||||
|
||||
cairo_pattern_destroy (pattern);
|
||||
}
|
||||
|
||||
@@ -1081,20 +1081,21 @@ parse_declarations (GtkCssParser *parser,
|
||||
{
|
||||
if (gtk_css_parser_try_ident (parser, declarations[i].name))
|
||||
{
|
||||
if (parsed & (1 << i))
|
||||
{
|
||||
gtk_css_parser_warn_syntax (parser, "Variable \"%s\" defined multiple times", declarations[i].name);
|
||||
/* Unset, just to be sure */
|
||||
parsed &= ~(1 << i);
|
||||
if (declarations[i].clear_func)
|
||||
declarations[i].clear_func (declarations[i].result);
|
||||
}
|
||||
|
||||
if (!gtk_css_parser_try_token (parser, GTK_CSS_TOKEN_COLON))
|
||||
{
|
||||
gtk_css_parser_error_syntax (parser, "Expected ':' after variable declaration");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (parsed & (1 << i))
|
||||
{
|
||||
gtk_css_parser_warn_syntax (parser, "Variable \"%s\" defined multiple times", declarations[i].name);
|
||||
/* Unset, just to be sure */
|
||||
parsed &= ~(1 << i);
|
||||
if (declarations[i].clear_func)
|
||||
declarations[i].clear_func (declarations[i].result);
|
||||
}
|
||||
if (!declarations[i].parse_func (parser, context, declarations[i].result))
|
||||
{
|
||||
/* nothing to do */
|
||||
@@ -2891,6 +2892,14 @@ append_texture_param (Printer *p,
|
||||
case GDK_MEMORY_R16G16B16:
|
||||
case GDK_MEMORY_R16G16B16A16_PREMULTIPLIED:
|
||||
case GDK_MEMORY_R16G16B16A16:
|
||||
case GDK_MEMORY_G8A8_PREMULTIPLIED:
|
||||
case GDK_MEMORY_G8A8:
|
||||
case GDK_MEMORY_G8:
|
||||
case GDK_MEMORY_G16A16_PREMULTIPLIED:
|
||||
case GDK_MEMORY_G16A16:
|
||||
case GDK_MEMORY_G16:
|
||||
case GDK_MEMORY_A8:
|
||||
case GDK_MEMORY_A16:
|
||||
bytes = gdk_texture_save_to_png_bytes (texture);
|
||||
g_string_append (p->str, "url(\"data:image/png;base64,");
|
||||
break;
|
||||
|
||||
@@ -106,7 +106,7 @@ gsk_vulkan_clip_intersect_rounded_rect (GskVulkanClip *dest,
|
||||
break;
|
||||
|
||||
case GSK_VULKAN_CLIP_NONE:
|
||||
dest->type = gsk_rounded_rect_is_circular (&dest->rect) ? GSK_VULKAN_CLIP_ROUNDED_CIRCULAR : GSK_VULKAN_CLIP_ROUNDED;
|
||||
dest->type = gsk_rounded_rect_is_circular (rounded) ? GSK_VULKAN_CLIP_ROUNDED_CIRCULAR : GSK_VULKAN_CLIP_ROUNDED;
|
||||
gsk_rounded_rect_init_copy (&dest->rect, rounded);
|
||||
break;
|
||||
|
||||
|
||||
@@ -450,7 +450,7 @@ gsk_vulkan_glyph_cache_begin_frame (GskVulkanGlyphCache *cache)
|
||||
GHashTableIter iter;
|
||||
GlyphCacheKey *key;
|
||||
GskVulkanCachedGlyph *value;
|
||||
guint dropped = 0;
|
||||
G_GNUC_UNUSED guint dropped = 0;
|
||||
|
||||
cache->timestamp++;
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ gsk_vulkan_render_pass_new (GdkVulkanContext *context,
|
||||
graphene_matrix_init_ortho (&self->p,
|
||||
viewport->origin.x, viewport->origin.x + viewport->size.width,
|
||||
viewport->origin.y, viewport->origin.y + viewport->size.height,
|
||||
ORTHO_NEAR_PLANE,
|
||||
2 * ORTHO_NEAR_PLANE - ORTHO_FAR_PLANE,
|
||||
ORTHO_FAR_PLANE);
|
||||
|
||||
if (signal_semaphore != VK_NULL_HANDLE) // this is a dependent pass
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
# FIXME: what's up with these?
|
||||
#gsk_private_vulkan_include_shaders = [
|
||||
# 'clip.frag.glsl',
|
||||
# 'clip.vert.glsl',
|
||||
# 'constants.glsl',
|
||||
# 'rounded-rect.glsl',
|
||||
#]
|
||||
gsk_private_vulkan_include_shaders = [
|
||||
'clip.frag.glsl',
|
||||
'clip.vert.glsl',
|
||||
'constants.glsl',
|
||||
'rounded-rect.glsl',
|
||||
]
|
||||
|
||||
gsk_private_vulkan_fragment_shaders = [
|
||||
'blendmode.frag',
|
||||
@@ -51,6 +50,7 @@ foreach shader: gsk_private_vulkan_shaders
|
||||
compiled_shader = custom_target(spv_shader,
|
||||
input: shader,
|
||||
output: spv_shader,
|
||||
depend_files: gsk_private_vulkan_include_shaders,
|
||||
command: [
|
||||
glslc,
|
||||
stage_arg,
|
||||
@@ -61,6 +61,7 @@ foreach shader: gsk_private_vulkan_shaders
|
||||
compiled_clip_shader = custom_target(clip_spv_shader,
|
||||
input: shader,
|
||||
output: clip_spv_shader,
|
||||
depend_files: gsk_private_vulkan_include_shaders,
|
||||
command: [
|
||||
glslc,
|
||||
stage_arg,
|
||||
@@ -71,6 +72,7 @@ foreach shader: gsk_private_vulkan_shaders
|
||||
compiled_clip_rounded_shader = custom_target(clip_rounded_spv_shader,
|
||||
input: shader,
|
||||
output: clip_rounded_spv_shader,
|
||||
depend_files: gsk_private_vulkan_include_shaders,
|
||||
command: [
|
||||
glslc,
|
||||
stage_arg,
|
||||
|
||||
@@ -31,6 +31,7 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
typedef struct {
|
||||
GtkWindow *parent;
|
||||
char *handle;
|
||||
GAppLaunchContext *context;
|
||||
char *uri;
|
||||
GTask *task;
|
||||
@@ -39,9 +40,10 @@ typedef struct {
|
||||
static void
|
||||
gtk_show_uri_data_free (GtkShowUriData *data)
|
||||
{
|
||||
if (data->parent)
|
||||
gtk_window_unexport_handle (data->parent);
|
||||
if (data->parent && data->handle)
|
||||
gtk_window_unexport_handle (data->parent, data->handle);
|
||||
g_clear_object (&data->parent);
|
||||
g_free (data->handle);
|
||||
g_clear_object (&data->context);
|
||||
g_free (data->uri);
|
||||
g_clear_object (&data->task);
|
||||
@@ -72,7 +74,10 @@ window_handle_exported (GtkWindow *window,
|
||||
GtkShowUriData *data = user_data;
|
||||
|
||||
if (handle)
|
||||
g_app_launch_context_setenv (data->context, "PARENT_WINDOW_ID", handle);
|
||||
{
|
||||
g_app_launch_context_setenv (data->context, "PARENT_WINDOW_ID", handle);
|
||||
data->handle = g_strdup (handle);
|
||||
}
|
||||
|
||||
g_app_info_launch_default_for_uri_async (data->uri,
|
||||
data->context,
|
||||
|
||||
@@ -17,11 +17,13 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include "gdkpixbufutilsprivate.h"
|
||||
#include "gdktextureutilsprivate.h"
|
||||
#include "gtkscalerprivate.h"
|
||||
|
||||
#include "gdk/gdktextureprivate.h"
|
||||
|
||||
/* {{{ Pixbuf helpers */
|
||||
|
||||
static GdkPixbuf *
|
||||
load_from_stream (GdkPixbufLoader *loader,
|
||||
GInputStream *stream,
|
||||
@@ -91,7 +93,7 @@ size_prepared_cb (GdkPixbufLoader *loader,
|
||||
* load the image at its original size times the
|
||||
* given scale.
|
||||
*/
|
||||
GdkPixbuf *
|
||||
static GdkPixbuf *
|
||||
_gdk_pixbuf_new_from_stream_scaled (GInputStream *stream,
|
||||
double scale,
|
||||
GCancellable *cancellable,
|
||||
@@ -145,7 +147,7 @@ size_prepared_cb2 (GdkPixbufLoader *loader,
|
||||
gdk_pixbuf_loader_set_size (loader, width, height);
|
||||
}
|
||||
|
||||
GdkPixbuf *
|
||||
static GdkPixbuf *
|
||||
_gdk_pixbuf_new_from_stream_at_scale (GInputStream *stream,
|
||||
int width,
|
||||
int height,
|
||||
@@ -172,44 +174,7 @@ _gdk_pixbuf_new_from_stream_at_scale (GInputStream *stream,
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
GdkPixbuf *
|
||||
_gdk_pixbuf_new_from_stream (GInputStream *stream,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
return _gdk_pixbuf_new_from_stream_scaled (stream, 0, cancellable, error);
|
||||
}
|
||||
|
||||
/* Like gdk_pixbuf_new_from_resource_at_scale, but
|
||||
* load the image at its original size times the
|
||||
* given scale.
|
||||
*/
|
||||
GdkPixbuf *
|
||||
_gdk_pixbuf_new_from_resource_scaled (const char *resource_path,
|
||||
double scale,
|
||||
GError **error)
|
||||
{
|
||||
GInputStream *stream;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
stream = g_resources_open_stream (resource_path, 0, error);
|
||||
if (stream == NULL)
|
||||
return NULL;
|
||||
|
||||
pixbuf = _gdk_pixbuf_new_from_stream_scaled (stream, scale, NULL, error);
|
||||
g_object_unref (stream);
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
GdkPixbuf *
|
||||
_gdk_pixbuf_new_from_resource (const char *resource_path,
|
||||
GError **error)
|
||||
{
|
||||
return _gdk_pixbuf_new_from_resource_scaled (resource_path, 0, error);
|
||||
}
|
||||
|
||||
GdkPixbuf *
|
||||
static GdkPixbuf *
|
||||
_gdk_pixbuf_new_from_resource_at_scale (const char *resource_path,
|
||||
int width,
|
||||
int height,
|
||||
@@ -227,9 +192,11 @@ _gdk_pixbuf_new_from_resource_at_scale (const char *resource_path,
|
||||
g_object_unref (stream);
|
||||
|
||||
return pixbuf;
|
||||
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ Symbolic processing */
|
||||
|
||||
static GdkPixbuf *
|
||||
load_symbolic_svg (const char *escaped_file_data,
|
||||
int width,
|
||||
@@ -335,19 +302,17 @@ gtk_make_symbolic_pixbuf_from_data (const char *file_data,
|
||||
char *escaped_file_data;
|
||||
|
||||
/* Fetch size from the original icon */
|
||||
{
|
||||
GInputStream *stream = g_memory_input_stream_new_from_data (file_data, file_len, NULL);
|
||||
GdkPixbuf *reference = gdk_pixbuf_new_from_stream (stream, NULL, error);
|
||||
GInputStream *stream = g_memory_input_stream_new_from_data (file_data, file_len, NULL);
|
||||
GdkPixbuf *reference = gdk_pixbuf_new_from_stream (stream, NULL, error);
|
||||
|
||||
g_object_unref (stream);
|
||||
g_object_unref (stream);
|
||||
|
||||
if (!reference)
|
||||
return NULL;
|
||||
if (!reference)
|
||||
return NULL;
|
||||
|
||||
icon_width = gdk_pixbuf_get_width (reference);
|
||||
icon_height = gdk_pixbuf_get_height (reference);
|
||||
g_object_unref (reference);
|
||||
}
|
||||
icon_width = gdk_pixbuf_get_width (reference);
|
||||
icon_height = gdk_pixbuf_get_height (reference);
|
||||
g_object_unref (reference);
|
||||
|
||||
escaped_file_data = g_base64_encode ((guchar *) file_data, file_len);
|
||||
icon_width_str = g_strdup_printf ("%d", icon_width);
|
||||
@@ -418,12 +383,12 @@ out:
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
GdkPixbuf *
|
||||
gtk_make_symbolic_pixbuf_from_resource (const char *path,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error)
|
||||
static GdkPixbuf *
|
||||
make_symbolic_pixbuf_from_resource (const char *path,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error)
|
||||
{
|
||||
GBytes *bytes;
|
||||
const char *data;
|
||||
@@ -443,12 +408,12 @@ gtk_make_symbolic_pixbuf_from_resource (const char *path,
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
GdkPixbuf *
|
||||
gtk_make_symbolic_pixbuf_from_path (const char *path,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error)
|
||||
static GdkPixbuf *
|
||||
make_symbolic_pixbuf_from_path (const char *path,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error)
|
||||
{
|
||||
char *data;
|
||||
gsize size;
|
||||
@@ -464,12 +429,12 @@ gtk_make_symbolic_pixbuf_from_path (const char *path,
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
GdkPixbuf *
|
||||
gtk_make_symbolic_pixbuf_from_file (GFile *file,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error)
|
||||
static GdkPixbuf *
|
||||
make_symbolic_pixbuf_from_file (GFile *file,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error)
|
||||
{
|
||||
char *data;
|
||||
gsize size;
|
||||
@@ -485,6 +450,91 @@ gtk_make_symbolic_pixbuf_from_file (GFile *file,
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ Texture API */
|
||||
|
||||
GdkTexture *
|
||||
gdk_texture_new_from_stream_at_scale (GInputStream *stream,
|
||||
int width,
|
||||
int height,
|
||||
gboolean aspect,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkTexture *texture = NULL;
|
||||
|
||||
pixbuf = _gdk_pixbuf_new_from_stream_at_scale (stream, width, height, aspect, cancellable, error);
|
||||
if (pixbuf)
|
||||
{
|
||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
GdkTexture *
|
||||
gdk_texture_new_from_stream (GInputStream *stream,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkTexture *texture = NULL;
|
||||
|
||||
pixbuf = _gdk_pixbuf_new_from_stream_scaled (stream, 0, cancellable, error);
|
||||
if (pixbuf)
|
||||
{
|
||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
GdkTexture *
|
||||
gdk_texture_new_from_resource_at_scale (const char *path,
|
||||
int width,
|
||||
int height,
|
||||
gboolean preserve_aspect,
|
||||
GError **error)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkTexture *texture = NULL;
|
||||
|
||||
pixbuf = _gdk_pixbuf_new_from_resource_at_scale (path, width, height, preserve_aspect, error);
|
||||
if (pixbuf)
|
||||
{
|
||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ Symbolic texture API */
|
||||
|
||||
GdkTexture *
|
||||
gdk_texture_new_from_path_symbolic (const char *path,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkTexture *texture = NULL;
|
||||
|
||||
pixbuf = make_symbolic_pixbuf_from_path (path, width, height, scale, error);
|
||||
if (pixbuf)
|
||||
{
|
||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
GdkTexture *
|
||||
gtk_load_symbolic_texture_from_resource (const char *path)
|
||||
{
|
||||
@@ -492,16 +542,16 @@ gtk_load_symbolic_texture_from_resource (const char *path)
|
||||
}
|
||||
|
||||
GdkTexture *
|
||||
gtk_make_symbolic_texture_from_resource (const char *path,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error)
|
||||
gdk_texture_new_from_resource_symbolic (const char *path,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkTexture *texture = NULL;
|
||||
|
||||
pixbuf = gtk_make_symbolic_pixbuf_from_resource (path, width, height, scale, error);
|
||||
pixbuf = make_symbolic_pixbuf_from_resource (path, width, height, scale, error);
|
||||
if (pixbuf)
|
||||
{
|
||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
||||
@@ -522,7 +572,7 @@ gtk_load_symbolic_texture_from_file (GFile *file)
|
||||
if (stream == NULL)
|
||||
return NULL;
|
||||
|
||||
pixbuf = _gdk_pixbuf_new_from_stream (stream, NULL, NULL);
|
||||
pixbuf = gdk_pixbuf_new_from_stream (stream, NULL, NULL);
|
||||
g_object_unref (stream);
|
||||
if (pixbuf == NULL)
|
||||
return NULL;
|
||||
@@ -534,22 +584,25 @@ gtk_load_symbolic_texture_from_file (GFile *file)
|
||||
}
|
||||
|
||||
GdkTexture *
|
||||
gtk_make_symbolic_texture_from_file (GFile *file,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error)
|
||||
gdk_texture_new_from_file_symbolic (GFile *file,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkTexture *texture;
|
||||
|
||||
pixbuf = gtk_make_symbolic_pixbuf_from_file (file, width, height, scale, error);
|
||||
pixbuf = make_symbolic_pixbuf_from_file (file, width, height, scale, error);
|
||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
||||
g_object_unref (pixbuf);
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ Scaled paintable API */
|
||||
|
||||
typedef struct {
|
||||
int scale_factor;
|
||||
} LoaderData;
|
||||
@@ -576,7 +629,7 @@ on_loader_size_prepared (GdkPixbufLoader *loader,
|
||||
height * loader_data->scale_factor);
|
||||
}
|
||||
|
||||
GdkPaintable *
|
||||
static GdkPaintable *
|
||||
gdk_paintable_new_from_bytes_scaled (GBytes *bytes,
|
||||
int scale_factor)
|
||||
{
|
||||
@@ -680,3 +733,7 @@ gdk_paintable_new_from_file_scaled (GFile *file,
|
||||
|
||||
return paintable;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* vim:set foldmethod=marker expandtab: */
|
||||
@@ -21,30 +21,6 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GdkPixbuf *_gdk_pixbuf_new_from_stream (GInputStream *stream,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
GdkPixbuf *_gdk_pixbuf_new_from_stream_at_scale (GInputStream *stream,
|
||||
int width,
|
||||
int height,
|
||||
gboolean aspect,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
GdkPixbuf *_gdk_pixbuf_new_from_stream_scaled (GInputStream *stream,
|
||||
double scale,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
GdkPixbuf *_gdk_pixbuf_new_from_resource (const char *resource_path,
|
||||
GError **error);
|
||||
GdkPixbuf *_gdk_pixbuf_new_from_resource_at_scale (const char *resource_path,
|
||||
int width,
|
||||
int height,
|
||||
gboolean preserve_aspect,
|
||||
GError **error);
|
||||
GdkPixbuf *_gdk_pixbuf_new_from_resource_scaled (const char *resource_path,
|
||||
double scale,
|
||||
GError **error);
|
||||
|
||||
GdkPixbuf *gtk_make_symbolic_pixbuf_from_data (const char *data,
|
||||
gsize len,
|
||||
int width,
|
||||
@@ -52,36 +28,41 @@ GdkPixbuf *gtk_make_symbolic_pixbuf_from_data (const char *data,
|
||||
double scale,
|
||||
const char *debug_output_to,
|
||||
GError **error);
|
||||
GdkPixbuf *gtk_make_symbolic_pixbuf_from_file (GFile *file,
|
||||
|
||||
GdkTexture *gdk_texture_new_from_stream (GInputStream *stream,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
GdkTexture *gdk_texture_new_from_stream_at_scale (GInputStream *stream,
|
||||
int width,
|
||||
int height,
|
||||
gboolean aspect,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
GdkTexture *gdk_texture_new_from_resource_at_scale (const char *path,
|
||||
int width,
|
||||
int height,
|
||||
gboolean aspect,
|
||||
GError **error);
|
||||
|
||||
GdkTexture *gdk_texture_new_from_path_symbolic (const char *path,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error);
|
||||
GdkPixbuf *gtk_make_symbolic_pixbuf_from_path (const char *path,
|
||||
GdkTexture *gdk_texture_new_from_file_symbolic (GFile *file,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error);
|
||||
GdkPixbuf *gtk_make_symbolic_pixbuf_from_resource (const char *path,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error);
|
||||
GdkTexture *gtk_load_symbolic_texture_from_file (GFile *file);
|
||||
GdkTexture *gtk_make_symbolic_texture_from_file (GFile *file,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error);
|
||||
GdkTexture *gtk_load_symbolic_texture_from_resource (const char *data);
|
||||
GdkTexture *gtk_make_symbolic_texture_from_resource (const char *path,
|
||||
GdkTexture *gdk_texture_new_from_resource_symbolic (const char *path,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error);
|
||||
|
||||
GdkPaintable *gdk_paintable_new_from_bytes_scaled (GBytes *bytes,
|
||||
int scale_factor);
|
||||
GdkTexture *gtk_load_symbolic_texture_from_file (GFile *file);
|
||||
GdkTexture *gtk_load_symbolic_texture_from_resource (const char *data);
|
||||
|
||||
GdkPaintable *gdk_paintable_new_from_path_scaled (const char *path,
|
||||
int scale_factor);
|
||||
GdkPaintable *gdk_paintable_new_from_resource_scaled (const char *path,
|
||||
@@ -90,4 +71,3 @@ GdkPaintable *gdk_paintable_new_from_file_scaled (GFile *file,
|
||||
int scale_factor);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -32,4 +32,4 @@ VS_VERSION_INFO VERSIONINFO
|
||||
END
|
||||
END
|
||||
|
||||
ISOLATIONAWARE_MANIFEST_RESOURCE_ID RT_MANIFEST libgtk4.manifest
|
||||
ISOLATIONAWARE_MANIFEST_RESOURCE_ID RT_MANIFEST libgtk.manifest
|
||||
|
||||
@@ -325,6 +325,9 @@ gtk_action_muxer_get_group (GtkActionMuxer *muxer,
|
||||
{
|
||||
Group *group;
|
||||
|
||||
if (!muxer->groups)
|
||||
return NULL;
|
||||
|
||||
group = g_hash_table_lookup (muxer->groups, group_name);
|
||||
if (group)
|
||||
return group->group;
|
||||
@@ -452,7 +455,7 @@ notify_observers_added (GtkActionMuxer *muxer,
|
||||
|
||||
gtk_action_observable_register_observer (GTK_ACTION_OBSERVABLE (parent), action_name, GTK_ACTION_OBSERVER (muxer));
|
||||
|
||||
if (!action_muxer_query_action (parent, action_name,
|
||||
if (!action_muxer_query_action (muxer, action_name,
|
||||
&enabled, ¶meter_type,
|
||||
NULL, NULL, &state,
|
||||
TRUE))
|
||||
|
||||
+6
-1
@@ -323,6 +323,7 @@ gtk_box_layout_compute_opposite_size (GtkBoxLayout *self,
|
||||
int largest_min_above = -1, largest_min_below = -1;
|
||||
int largest_nat_above = -1, largest_nat_below = -1;
|
||||
gboolean have_baseline = FALSE;
|
||||
gboolean align_baseline = FALSE;
|
||||
|
||||
for (child = gtk_widget_get_first_child (widget);
|
||||
child != NULL;
|
||||
@@ -350,6 +351,10 @@ gtk_box_layout_compute_opposite_size (GtkBoxLayout *self,
|
||||
if (child_min_baseline > -1)
|
||||
{
|
||||
have_baseline = TRUE;
|
||||
if (gtk_widget_get_valign (child) == GTK_ALIGN_BASELINE_FILL ||
|
||||
gtk_widget_get_valign (child) == GTK_ALIGN_BASELINE_CENTER)
|
||||
align_baseline = TRUE;
|
||||
|
||||
largest_min_above = MAX (largest_min_above, child_min_baseline);
|
||||
largest_min_below = MAX (largest_min_below, child_min - child_min_baseline);
|
||||
largest_nat_above = MAX (largest_nat_above, child_nat_baseline);
|
||||
@@ -358,7 +363,7 @@ gtk_box_layout_compute_opposite_size (GtkBoxLayout *self,
|
||||
}
|
||||
}
|
||||
|
||||
if (self->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
if (self->orientation == GTK_ORIENTATION_HORIZONTAL && align_baseline)
|
||||
{
|
||||
largest_min = MAX (largest_min, largest_min_above + largest_min_below);
|
||||
largest_nat = MAX (largest_nat, largest_nat_above + largest_nat_below);
|
||||
|
||||
@@ -220,6 +220,7 @@ enum
|
||||
PROP_COLUMNS,
|
||||
PROP_ENABLE_RUBBERBAND,
|
||||
PROP_HADJUSTMENT,
|
||||
PROP_HEADER_FACTORY,
|
||||
PROP_HSCROLL_POLICY,
|
||||
PROP_MODEL,
|
||||
PROP_REORDERABLE,
|
||||
@@ -629,6 +630,10 @@ gtk_column_view_get_property (GObject *object,
|
||||
g_value_set_object (value, self->hadjustment);
|
||||
break;
|
||||
|
||||
case PROP_HEADER_FACTORY:
|
||||
g_value_set_object (value, gtk_column_view_get_header_factory (self));
|
||||
break;
|
||||
|
||||
case PROP_HSCROLL_POLICY:
|
||||
g_value_set_enum (value, gtk_scrollable_get_hscroll_policy (GTK_SCROLLABLE (self->listview)));
|
||||
break;
|
||||
@@ -712,6 +717,10 @@ gtk_column_view_set_property (GObject *object,
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_HEADER_FACTORY:
|
||||
gtk_column_view_set_header_factory (self, g_value_get_object (value));
|
||||
break;
|
||||
|
||||
case PROP_HSCROLL_POLICY:
|
||||
if (gtk_scrollable_get_hscroll_policy (GTK_SCROLLABLE (self->listview)) != g_value_get_enum (value))
|
||||
{
|
||||
@@ -911,6 +920,18 @@ gtk_column_view_class_init (GtkColumnViewClass *klass)
|
||||
GTK_LIST_TAB_ALL,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GtkColumnView:header-factory: (attributes org.gtk.Property.get=gtk_column_view_get_header_factory org.gtk.Property.set=gtk_column_view_set_header_factory)
|
||||
*
|
||||
* Factory for creating header widgets.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
properties[PROP_HEADER_FACTORY] =
|
||||
g_param_spec_object ("header-factory", NULL, NULL,
|
||||
GTK_TYPE_LIST_ITEM_FACTORY,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (gobject_class, N_PROPS, properties);
|
||||
|
||||
/**
|
||||
@@ -2107,3 +2128,49 @@ gtk_column_view_get_tab_behavior (GtkColumnView *self)
|
||||
return gtk_list_view_get_tab_behavior (self->listview);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_column_view_get_header_factory: (attributes org.gtk.Method.get_property=header-factory)
|
||||
* @self: a `GtkColumnView`
|
||||
*
|
||||
* Gets the factory that's currently used to populate section headers.
|
||||
*
|
||||
* Returns: (nullable) (transfer none): The factory in use
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
GtkListItemFactory *
|
||||
gtk_column_view_get_header_factory (GtkColumnView *self)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_COLUMN_VIEW (self), NULL);
|
||||
|
||||
return gtk_list_view_get_header_factory (self->listview);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_column_view_set_header_factory: (attributes org.gtk.Method.set_property=header-factory)
|
||||
* @self: a `GtkColumnView`
|
||||
* @factory: (nullable) (transfer none): the factory to use
|
||||
*
|
||||
* Sets the `GtkListItemFactory` to use for populating the
|
||||
* [class@Gtk.ListHeader] objects used in section headers.
|
||||
*
|
||||
* If this factory is set to %NULL, the list will not show
|
||||
* section headers.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
void
|
||||
gtk_column_view_set_header_factory (GtkColumnView *self,
|
||||
GtkListItemFactory *factory)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_COLUMN_VIEW (self));
|
||||
g_return_if_fail (factory == NULL || GTK_IS_LIST_ITEM_FACTORY (factory));
|
||||
|
||||
if (factory == gtk_list_view_get_header_factory (self->listview))
|
||||
return;
|
||||
|
||||
gtk_list_view_set_header_factory (self->listview, factory);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_HEADER_FACTORY]);
|
||||
}
|
||||
|
||||
|
||||
@@ -122,5 +122,13 @@ GDK_AVAILABLE_IN_4_12
|
||||
GtkListItemFactory *
|
||||
gtk_column_view_get_row_factory (GtkColumnView *self);
|
||||
|
||||
|
||||
GDK_AVAILABLE_IN_4_12
|
||||
void gtk_column_view_set_header_factory (GtkColumnView *self,
|
||||
GtkListItemFactory *factory);
|
||||
GDK_AVAILABLE_IN_4_12
|
||||
GtkListItemFactory *
|
||||
gtk_column_view_get_header_factory (GtkColumnView *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "gtkcssimageprivate.h"
|
||||
#include "gtkcsspalettevalueprivate.h"
|
||||
#include "gtkcsscolorvalueprivate.h"
|
||||
#include "gdkpixbufutilsprivate.h"
|
||||
#include "gdktextureutilsprivate.h"
|
||||
|
||||
#include "gtkstyleproviderprivate.h"
|
||||
|
||||
@@ -110,7 +110,7 @@ gtk_css_image_recolor_load_texture (GtkCssImageRecolor *recolor,
|
||||
if (g_str_has_suffix (uri, ".symbolic.png"))
|
||||
recolor->texture = gtk_load_symbolic_texture_from_resource (resource_path);
|
||||
else
|
||||
recolor->texture = gtk_make_symbolic_texture_from_resource (resource_path, 0, 0, 1.0, NULL);
|
||||
recolor->texture = gdk_texture_new_from_resource_symbolic (resource_path, 0, 0, 1.0, NULL);
|
||||
|
||||
g_free (resource_path);
|
||||
}
|
||||
@@ -119,7 +119,7 @@ gtk_css_image_recolor_load_texture (GtkCssImageRecolor *recolor,
|
||||
if (g_str_has_suffix (uri, ".symbolic.png"))
|
||||
recolor->texture = gtk_load_symbolic_texture_from_file (recolor->file);
|
||||
else
|
||||
recolor->texture = gtk_make_symbolic_texture_from_file (recolor->file, 0, 0, 1.0, NULL);
|
||||
recolor->texture = gdk_texture_new_from_file_symbolic (recolor->file, 0, 0, 1.0, NULL);
|
||||
}
|
||||
|
||||
g_free (uri);
|
||||
|
||||
+1
-15
@@ -47,21 +47,7 @@ gtk_css_image_url_load_image (GtkCssImageUrl *url,
|
||||
return url->loaded_image;
|
||||
}
|
||||
|
||||
/* We special case resources here so we can use gdk_texture_new_from_resource. */
|
||||
if (g_file_has_uri_scheme (url->file, "resource"))
|
||||
{
|
||||
char *uri = g_file_get_uri (url->file);
|
||||
char *resource_path = g_uri_unescape_string (uri + strlen ("resource://"), NULL);
|
||||
|
||||
texture = gdk_texture_new_from_resource (resource_path);
|
||||
|
||||
g_free (resource_path);
|
||||
g_free (uri);
|
||||
}
|
||||
else
|
||||
{
|
||||
texture = gdk_texture_new_from_file (url->file, &local_error);
|
||||
}
|
||||
texture = gdk_texture_new_from_file (url->file, &local_error);
|
||||
|
||||
if (texture == NULL)
|
||||
{
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "gtkborder.h"
|
||||
#include "gtktypes.h"
|
||||
#include "gtkcssvalueprivate.h"
|
||||
#include "gtkroundedboxprivate.h"
|
||||
#include "gtksnapshot.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
+4
-4
@@ -19,7 +19,7 @@
|
||||
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
||||
* file for a list of people on the GTK+ Team. See the ChangeLog
|
||||
* files for a list of changes. These files are distributed with
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
@@ -207,7 +207,7 @@ gtk_drag_source_set_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkDragSource *source = GTK_DRAG_SOURCE (object);
|
||||
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_CONTENT:
|
||||
@@ -424,13 +424,13 @@ gtk_drag_source_class_init (GtkDragSourceClass *class)
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
NULL, NULL,
|
||||
_gtk_marshal_OBJECT__BOOLEAN,
|
||||
_gtk_marshal_VOID__OBJECT_BOOLEAN,
|
||||
G_TYPE_NONE, 2,
|
||||
GDK_TYPE_DRAG,
|
||||
G_TYPE_BOOLEAN);
|
||||
g_signal_set_va_marshaller (signals[DRAG_END],
|
||||
GTK_TYPE_DRAG_SOURCE,
|
||||
_gtk_marshal_OBJECT__BOOLEANv);
|
||||
_gtk_marshal_VOID__OBJECT_BOOLEANv);
|
||||
|
||||
/**
|
||||
* GtkDragSource::drag-cancel:
|
||||
|
||||
@@ -150,13 +150,13 @@ make_action_unique (GdkDragAction actions)
|
||||
|
||||
if (actions & GDK_ACTION_MOVE)
|
||||
return GDK_ACTION_MOVE;
|
||||
|
||||
|
||||
if (actions & GDK_ACTION_LINK)
|
||||
return GDK_ACTION_LINK;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static GdkDragAction
|
||||
gtk_drop_target_async_drag_enter (GtkDropTargetAsync *self,
|
||||
GdkDrop *drop,
|
||||
@@ -166,7 +166,7 @@ gtk_drop_target_async_drag_enter (GtkDropTargetAsync *self,
|
||||
return make_action_unique (self->actions & gdk_drop_get_actions (drop));
|
||||
}
|
||||
|
||||
static GdkDragAction
|
||||
static GdkDragAction
|
||||
gtk_drop_target_async_drag_motion (GtkDropTargetAsync *self,
|
||||
GdkDrop *drop,
|
||||
double x,
|
||||
@@ -457,12 +457,12 @@ gtk_drop_target_async_class_init (GtkDropTargetAsyncClass *class)
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkDropTargetAsyncClass, drag_enter),
|
||||
g_signal_accumulator_first_wins, NULL,
|
||||
_gtk_marshal_ENUM__OBJECT_DOUBLE_DOUBLE,
|
||||
_gtk_marshal_FLAGS__OBJECT_DOUBLE_DOUBLE,
|
||||
GDK_TYPE_DRAG_ACTION, 3,
|
||||
GDK_TYPE_DROP, G_TYPE_DOUBLE, G_TYPE_DOUBLE);
|
||||
g_signal_set_va_marshaller (signals[DRAG_ENTER],
|
||||
GTK_TYPE_DROP_TARGET_ASYNC,
|
||||
_gtk_marshal_ENUM__OBJECT_DOUBLE_DOUBLEv);
|
||||
_gtk_marshal_FLAGS__OBJECT_DOUBLE_DOUBLEv);
|
||||
|
||||
/**
|
||||
* GtkDropTargetAsync::drag-motion:
|
||||
@@ -481,12 +481,12 @@ gtk_drop_target_async_class_init (GtkDropTargetAsyncClass *class)
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkDropTargetAsyncClass, drag_motion),
|
||||
g_signal_accumulator_first_wins, NULL,
|
||||
_gtk_marshal_ENUM__OBJECT_DOUBLE_DOUBLE,
|
||||
_gtk_marshal_FLAGS__OBJECT_DOUBLE_DOUBLE,
|
||||
GDK_TYPE_DRAG_ACTION, 3,
|
||||
GDK_TYPE_DROP, G_TYPE_DOUBLE, G_TYPE_DOUBLE);
|
||||
g_signal_set_va_marshaller (signals[DRAG_MOTION],
|
||||
GTK_TYPE_DROP_TARGET_ASYNC,
|
||||
_gtk_marshal_ENUM__OBJECT_DOUBLE_DOUBLEv);
|
||||
_gtk_marshal_FLAGS__OBJECT_DOUBLE_DOUBLEv);
|
||||
|
||||
/**
|
||||
* GtkDropTargetAsync::drag-leave:
|
||||
@@ -617,7 +617,7 @@ GdkContentFormats *
|
||||
gtk_drop_target_async_get_formats (GtkDropTargetAsync *self)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_DROP_TARGET_ASYNC (self), NULL);
|
||||
|
||||
|
||||
return self->formats;
|
||||
}
|
||||
|
||||
@@ -633,7 +633,7 @@ gtk_drop_target_async_set_actions (GtkDropTargetAsync *self,
|
||||
GdkDragAction actions)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_DROP_TARGET_ASYNC (self));
|
||||
|
||||
|
||||
if (self->actions == actions)
|
||||
return;
|
||||
|
||||
|
||||
+6
-5
@@ -69,9 +69,9 @@ typedef enum
|
||||
GTK_ALIGN_START,
|
||||
GTK_ALIGN_END,
|
||||
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_CENTER,
|
||||
GTK_ALIGN_BASELINE_CENTER GDK_AVAILABLE_ENUMERATOR_IN_4_12,
|
||||
} GtkAlign;
|
||||
|
||||
/**
|
||||
@@ -1422,7 +1422,7 @@ typedef enum {
|
||||
GTK_ACCESSIBLE_ROLE_TREE_ITEM,
|
||||
GTK_ACCESSIBLE_ROLE_WIDGET,
|
||||
GTK_ACCESSIBLE_ROLE_WINDOW,
|
||||
GTK_ACCESSIBLE_ROLE_TOGGLE_BUTTON
|
||||
GTK_ACCESSIBLE_ROLE_TOGGLE_BUTTON GDK_AVAILABLE_ENUMERATOR_IN_4_10
|
||||
} GtkAccessibleRole;
|
||||
|
||||
/**
|
||||
@@ -1449,7 +1449,8 @@ typedef enum {
|
||||
* @GTK_ACCESSIBLE_STATE_SELECTED: A “selected” state; set when a widget
|
||||
* is selected. Value type: boolean or undefined
|
||||
* @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].
|
||||
*/
|
||||
@@ -1462,7 +1463,7 @@ typedef enum {
|
||||
GTK_ACCESSIBLE_STATE_INVALID,
|
||||
GTK_ACCESSIBLE_STATE_PRESSED,
|
||||
GTK_ACCESSIBLE_STATE_SELECTED,
|
||||
GTK_ACCESSIBLE_STATE_VISITED
|
||||
GTK_ACCESSIBLE_STATE_VISITED GDK_AVAILABLE_ENUMERATOR_IN_4_12
|
||||
} GtkAccessibleState;
|
||||
|
||||
/**
|
||||
|
||||
@@ -410,16 +410,22 @@ gtk_event_controller_scroll_handle_event (GtkEventController *controller,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ABS (scroll->cur_dx) >= 1)
|
||||
if (ABS (scroll->cur_dx) >= 0.5)
|
||||
{
|
||||
steps = trunc (scroll->cur_dx);
|
||||
if (steps == 0)
|
||||
steps = (scroll->cur_dx > 0) ? 1 : -1;
|
||||
|
||||
scroll->cur_dx -= steps;
|
||||
dx = steps;
|
||||
}
|
||||
|
||||
if (ABS (scroll->cur_dy) >= 1)
|
||||
if (ABS (scroll->cur_dy) >= 0.5)
|
||||
{
|
||||
steps = trunc (scroll->cur_dy);
|
||||
if (steps == 0)
|
||||
steps = (scroll->cur_dy > 0) ? 1 : -1;
|
||||
|
||||
scroll->cur_dy -= steps;
|
||||
dy = steps;
|
||||
}
|
||||
@@ -459,16 +465,22 @@ gtk_event_controller_scroll_handle_event (GtkEventController *controller,
|
||||
scroll->cur_dy += dy;
|
||||
dx = dy = 0;
|
||||
|
||||
if (ABS (scroll->cur_dx) >= 1)
|
||||
if (ABS (scroll->cur_dx) >= 0.5)
|
||||
{
|
||||
steps = trunc (scroll->cur_dx);
|
||||
if (steps == 0)
|
||||
steps = (scroll->cur_dx > 0) ? 1 : -1;
|
||||
|
||||
scroll->cur_dx -= steps;
|
||||
dx = steps;
|
||||
}
|
||||
|
||||
if (ABS (scroll->cur_dy) >= 1)
|
||||
if (ABS (scroll->cur_dy) >= 0.5)
|
||||
{
|
||||
steps = trunc (scroll->cur_dy);
|
||||
if (steps == 0)
|
||||
steps = (scroll->cur_dy > 0) ? 1 : -1;
|
||||
|
||||
scroll->cur_dy -= steps;
|
||||
dy = steps;
|
||||
}
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@
|
||||
* expanded widget yourself, such as when you want to actually create
|
||||
* the widget at expansion time. In this case, create a `GtkExpander`
|
||||
* 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
|
||||
* a signal connection as follows:
|
||||
*
|
||||
|
||||
@@ -52,6 +52,7 @@ typedef struct {
|
||||
|
||||
const char *method_name;
|
||||
|
||||
char *exported_handle;
|
||||
GtkWindow *exported_window;
|
||||
PortalErrorHandler error_handler;
|
||||
} FilechooserPortalData;
|
||||
@@ -79,7 +80,11 @@ filechooser_portal_data_clear (FilechooserPortalData *data)
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -460,6 +465,7 @@ window_handle_exported (GtkWindow *window,
|
||||
gtk_grab_add (GTK_WIDGET (data->grab_widget));
|
||||
}
|
||||
|
||||
data->exported_handle = g_strdup (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);
|
||||
search_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->browse_files_model);
|
||||
|
||||
g_clear_object (&impl->selection_model);
|
||||
g_clear_object (&impl->sort_model);
|
||||
@@ -3961,6 +3964,7 @@ set_list_model (GtkFileChooserWidget *impl,
|
||||
|
||||
set_busy_cursor (impl, TRUE);
|
||||
|
||||
g_clear_object (&impl->browse_files_model);
|
||||
impl->browse_files_model =
|
||||
_gtk_file_system_model_new_for_directory (impl->current_folder, MODEL_ATTRIBUTES);
|
||||
|
||||
|
||||
+13
-14
@@ -229,9 +229,9 @@ open_done (GObject *source,
|
||||
#endif
|
||||
|
||||
static void
|
||||
show_folder_done (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer data)
|
||||
show_item_done (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer data)
|
||||
{
|
||||
GDBusConnection *bus = G_DBUS_CONNECTION (source);
|
||||
GTask *task = G_TASK (data);
|
||||
@@ -261,11 +261,10 @@ show_folder_done (GObject *source,
|
||||
#define FILE_MANAGER_DBUS_PATH "/org/freedesktop/FileManager1"
|
||||
|
||||
static void
|
||||
show_folder (GtkWindow *parent,
|
||||
const char *uri,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
show_item (GtkWindow *parent,
|
||||
const char *uri,
|
||||
GCancellable *cancellable,
|
||||
GTask *task)
|
||||
{
|
||||
GDBusConnection *bus;
|
||||
GVariantBuilder uris_builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE_STRING_ARRAY);
|
||||
@@ -274,10 +273,10 @@ show_folder (GtkWindow *parent,
|
||||
|
||||
if (!bus)
|
||||
{
|
||||
g_task_return_new_error (G_TASK (user_data),
|
||||
g_task_return_new_error (task,
|
||||
GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_FAILED,
|
||||
"Session bus not available");
|
||||
g_object_unref (G_TASK (user_data));
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -287,14 +286,14 @@ show_folder (GtkWindow *parent,
|
||||
FILE_MANAGER_DBUS_NAME,
|
||||
FILE_MANAGER_DBUS_PATH,
|
||||
FILE_MANAGER_DBUS_IFACE,
|
||||
"ShowFolders",
|
||||
"ShowItems",
|
||||
g_variant_new ("(ass)", &uris_builder, ""),
|
||||
NULL, /* ignore returned type */
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
-1,
|
||||
cancellable,
|
||||
show_folder_done,
|
||||
user_data);
|
||||
show_item_done,
|
||||
task);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
show_folder (parent, uri, cancellable, show_folder_done, task);
|
||||
show_item (parent, uri, cancellable, task);
|
||||
|
||||
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_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,
|
||||
model->attributes,
|
||||
G_FILE_QUERY_INFO_NONE,
|
||||
|
||||
+316
-2
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "gtkbitset.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkselectionmodel.h"
|
||||
#include "gtksectionmodelprivate.h"
|
||||
|
||||
/**
|
||||
@@ -34,11 +35,17 @@
|
||||
* It hides some elements from the other model according to
|
||||
* 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
|
||||
* [method@Gtk.FilterListModel.set_incremental] for details.
|
||||
*
|
||||
* `GtkFilterListModel` passes through sections from the underlying model.
|
||||
*
|
||||
* Since 4.12, `GtkFilterListModel` also implements `GtkSelectionModel`
|
||||
* and passes through selections from the underlying model. Any changes
|
||||
* to the selection that are done through the filter model will cause
|
||||
* filtered-out items to be unselected.
|
||||
*/
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_FILTER,
|
||||
@@ -136,6 +143,240 @@ gtk_filter_list_model_model_init (GListModelInterface *iface)
|
||||
iface->get_item = gtk_filter_list_model_get_item;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_filter_list_model_is_selected (GtkSelectionModel *model,
|
||||
guint position)
|
||||
{
|
||||
GtkFilterListModel *self = GTK_FILTER_LIST_MODEL (model);
|
||||
guint unfiltered;
|
||||
|
||||
if (!GTK_IS_SELECTION_MODEL (self->model))
|
||||
return FALSE;
|
||||
|
||||
switch (self->strictness)
|
||||
{
|
||||
case GTK_FILTER_MATCH_NONE:
|
||||
return FALSE;
|
||||
|
||||
case GTK_FILTER_MATCH_ALL:
|
||||
unfiltered = position;
|
||||
break;
|
||||
|
||||
case GTK_FILTER_MATCH_SOME:
|
||||
unfiltered = gtk_bitset_get_nth (self->matches, position);
|
||||
if (unfiltered == 0 && position >= gtk_bitset_get_size (self->matches))
|
||||
return FALSE;
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
return gtk_selection_model_is_selected (GTK_SELECTION_MODEL (self->model), unfiltered);
|
||||
}
|
||||
|
||||
static GtkBitset *
|
||||
gtk_filter_list_model_get_selection_in_range (GtkSelectionModel *model,
|
||||
guint pos,
|
||||
guint n_items)
|
||||
{
|
||||
GtkFilterListModel *self = GTK_FILTER_LIST_MODEL (model);
|
||||
|
||||
if (!GTK_IS_SELECTION_MODEL (self->model))
|
||||
return gtk_bitset_new_empty ();
|
||||
|
||||
switch (self->strictness)
|
||||
{
|
||||
case GTK_FILTER_MATCH_NONE:
|
||||
return gtk_bitset_new_empty ();
|
||||
|
||||
case GTK_FILTER_MATCH_ALL:
|
||||
return gtk_selection_model_get_selection_in_range (GTK_SELECTION_MODEL (self->model),
|
||||
pos,
|
||||
n_items);
|
||||
|
||||
case GTK_FILTER_MATCH_SOME:
|
||||
{
|
||||
GtkBitset *result;
|
||||
GtkBitset *selected;
|
||||
unsigned int last;
|
||||
unsigned int start, end;
|
||||
|
||||
if (pos >= gtk_bitset_get_size (self->matches))
|
||||
return gtk_bitset_new_empty ();
|
||||
|
||||
last = MIN (pos + n_items, gtk_bitset_get_size (self->matches));
|
||||
|
||||
start = gtk_bitset_get_nth (self->matches, pos);
|
||||
end = gtk_bitset_get_nth (self->matches, last - 1);
|
||||
|
||||
selected = gtk_selection_model_get_selection_in_range (GTK_SELECTION_MODEL (self->model),
|
||||
start, end - start + 1);
|
||||
|
||||
result = gtk_bitset_new_empty ();
|
||||
|
||||
for (unsigned int i = pos; i < last; i++)
|
||||
{
|
||||
if (gtk_bitset_contains (selected, gtk_bitset_get_nth (self->matches, i)))
|
||||
gtk_bitset_add (result, i);
|
||||
}
|
||||
|
||||
gtk_bitset_unref (selected);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_filter_list_model_select_item (GtkSelectionModel *model,
|
||||
guint position,
|
||||
gboolean unselect_rest)
|
||||
{
|
||||
GtkFilterListModel *self = GTK_FILTER_LIST_MODEL (model);
|
||||
unsigned int unfiltered;
|
||||
|
||||
if (!GTK_IS_SELECTION_MODEL (self->model))
|
||||
return TRUE;
|
||||
|
||||
switch (self->strictness)
|
||||
{
|
||||
case GTK_FILTER_MATCH_NONE:
|
||||
return TRUE;
|
||||
|
||||
case GTK_FILTER_MATCH_ALL:
|
||||
unfiltered = position;
|
||||
break;
|
||||
|
||||
case GTK_FILTER_MATCH_SOME:
|
||||
unfiltered = gtk_bitset_get_nth (self->matches, position);
|
||||
if (unfiltered == 0 && position >= gtk_bitset_get_size (self->matches))
|
||||
return TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
return gtk_selection_model_select_item (GTK_SELECTION_MODEL (self->model),
|
||||
unfiltered,
|
||||
unselect_rest);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_filter_list_model_unselect_item (GtkSelectionModel *model,
|
||||
guint position)
|
||||
{
|
||||
GtkFilterListModel *self = GTK_FILTER_LIST_MODEL (model);
|
||||
unsigned int unfiltered;
|
||||
|
||||
if (!GTK_IS_SELECTION_MODEL (self->model))
|
||||
return TRUE;
|
||||
|
||||
switch (self->strictness)
|
||||
{
|
||||
case GTK_FILTER_MATCH_NONE:
|
||||
return TRUE;
|
||||
|
||||
case GTK_FILTER_MATCH_ALL:
|
||||
unfiltered = position;
|
||||
break;
|
||||
|
||||
case GTK_FILTER_MATCH_SOME:
|
||||
unfiltered = gtk_bitset_get_nth (self->matches, position);
|
||||
if (unfiltered == 0 && position >= gtk_bitset_get_size (self->matches))
|
||||
return TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
return gtk_selection_model_unselect_item (GTK_SELECTION_MODEL (self->model),
|
||||
unfiltered);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_filter_list_model_set_selection (GtkSelectionModel *model,
|
||||
GtkBitset *selected,
|
||||
GtkBitset *mask)
|
||||
{
|
||||
GtkFilterListModel *self = GTK_FILTER_LIST_MODEL (model);
|
||||
|
||||
if (!GTK_IS_SELECTION_MODEL (self->model))
|
||||
return TRUE;
|
||||
|
||||
switch (self->strictness)
|
||||
{
|
||||
case GTK_FILTER_MATCH_NONE:
|
||||
return TRUE;
|
||||
|
||||
case GTK_FILTER_MATCH_ALL:
|
||||
return gtk_selection_model_set_selection (GTK_SELECTION_MODEL (self->model),
|
||||
selected,
|
||||
mask);
|
||||
|
||||
case GTK_FILTER_MATCH_SOME:
|
||||
{
|
||||
GtkBitset *selected2;
|
||||
GtkBitset *mask2;
|
||||
GtkBitset *unmatched;
|
||||
GtkBitsetIter iter;
|
||||
unsigned int unfiltered;
|
||||
gboolean ret;
|
||||
|
||||
selected2 = gtk_bitset_new_empty ();
|
||||
mask2 = gtk_bitset_new_empty ();
|
||||
|
||||
if (gtk_bitset_iter_init_first (&iter, self->matches, &unfiltered))
|
||||
{
|
||||
unsigned int i = 0;
|
||||
do
|
||||
{
|
||||
if (gtk_bitset_contains (selected, i))
|
||||
gtk_bitset_add (selected2, unfiltered);
|
||||
|
||||
if (gtk_bitset_contains (mask, i))
|
||||
gtk_bitset_add (mask2, unfiltered);
|
||||
|
||||
i++;
|
||||
}
|
||||
while (gtk_bitset_iter_next (&iter, &unfiltered));
|
||||
}
|
||||
|
||||
unmatched = gtk_bitset_new_range (0, g_list_model_get_n_items (self->model));
|
||||
gtk_bitset_subtract (unmatched, self->matches);
|
||||
gtk_bitset_union (mask2, unmatched);
|
||||
|
||||
ret = gtk_selection_model_set_selection (GTK_SELECTION_MODEL (self->model),
|
||||
selected2,
|
||||
mask2);
|
||||
|
||||
gtk_bitset_unref (unmatched);
|
||||
gtk_bitset_unref (selected2);
|
||||
gtk_bitset_unref (mask2);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_filter_list_model_selection_model_init (GtkSelectionModelInterface *iface)
|
||||
{
|
||||
iface->is_selected = gtk_filter_list_model_is_selected;
|
||||
iface->select_item = gtk_filter_list_model_select_item;
|
||||
iface->unselect_item = gtk_filter_list_model_unselect_item;
|
||||
iface->get_selection_in_range = gtk_filter_list_model_get_selection_in_range;
|
||||
iface->set_selection = gtk_filter_list_model_set_selection;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_filter_list_model_get_section (GtkSectionModel *model,
|
||||
guint position,
|
||||
@@ -188,6 +429,72 @@ gtk_filter_list_model_get_section (GtkSectionModel *model,
|
||||
*out_end = *out_start + gtk_bitset_get_size_in_range (self->matches, start, end - 1);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_filter_list_model_selection_changed_cb (GtkSelectionModel *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_selection_model_selection_changed (GTK_SELECTION_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_selection_model_selection_changed (GTK_SELECTION_MODEL (self), start, end - start);
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
gtk_filter_list_model_section_model_init (GtkSectionModelInterface *iface)
|
||||
{
|
||||
@@ -196,6 +503,7 @@ gtk_filter_list_model_section_model_init (GtkSectionModelInterface *iface)
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkFilterListModel, gtk_filter_list_model, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, gtk_filter_list_model_model_init)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_SELECTION_MODEL, gtk_filter_list_model_selection_model_init)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_SECTION_MODEL, gtk_filter_list_model_section_model_init))
|
||||
|
||||
static gboolean
|
||||
@@ -463,6 +771,8 @@ gtk_filter_list_model_clear_model (GtkFilterListModel *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_selection_changed_cb, self);
|
||||
g_signal_handlers_disconnect_by_func (self->model, gtk_filter_list_model_sections_changed_cb, self);
|
||||
g_clear_object (&self->model);
|
||||
if (self->matches)
|
||||
gtk_bitset_remove_all (self->matches);
|
||||
@@ -827,6 +1137,10 @@ gtk_filter_list_model_set_model (GtkFilterListModel *self,
|
||||
{
|
||||
self->model = g_object_ref (model);
|
||||
g_signal_connect (model, "items-changed", G_CALLBACK (gtk_filter_list_model_items_changed_cb), self);
|
||||
if (GTK_IS_SELECTION_MODEL (model))
|
||||
g_signal_connect (model, "selection-changed", G_CALLBACK (gtk_filter_list_model_selection_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)
|
||||
{
|
||||
self->strictness = GTK_FILTER_MATCH_NONE;
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
*
|
||||
* `GtkFlattenListModel` is a list model that concatenates other list models.
|
||||
*
|
||||
* `GtkFlattenListModel` takes a list model containing list models,
|
||||
* and flattens it into a single model.
|
||||
* `GtkFlattenListModel` takes a list model containing list models, and flattens
|
||||
* it into a single model. Each list model becomes a section in the single model.
|
||||
*/
|
||||
|
||||
enum {
|
||||
|
||||
@@ -1162,7 +1162,7 @@ update_fontlist (GtkFontChooserWidget *self)
|
||||
model = G_LIST_MODEL (gtk_slice_list_model_new (model, 0, 20));
|
||||
gtk_widget_add_tick_callback (GTK_WIDGET (self), add_to_fontlist, g_object_ref (model), g_object_unref);
|
||||
|
||||
gtk_filter_list_model_set_model (self->filter_model, model);
|
||||
gtk_single_selection_set_model (self->selection, model);
|
||||
g_object_unref (model);
|
||||
}
|
||||
|
||||
|
||||
+17
-13
@@ -657,7 +657,7 @@ gtk_grid_view_measure_list (GtkWidget *widget,
|
||||
gtk_grid_view_measure_column_size (self, &col_min, &col_nat);
|
||||
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);
|
||||
column_size = for_size / n_columns;
|
||||
column_size = (for_size + xspacing) / n_columns - xspacing;
|
||||
|
||||
i = 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);
|
||||
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 */
|
||||
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)
|
||||
{
|
||||
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,
|
||||
xspacing,
|
||||
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);
|
||||
|
||||
/* step 2: determine height of known rows */
|
||||
heights = g_array_new (FALSE, FALSE, sizeof (int));
|
||||
|
||||
for (;
|
||||
tile != NULL;
|
||||
tile = gtk_list_tile_gc (self->item_manager, tile))
|
||||
while (tile != NULL)
|
||||
{
|
||||
/* if it's a multirow tile, handle it here */
|
||||
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;
|
||||
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)
|
||||
{
|
||||
@@ -883,16 +883,16 @@ gtk_grid_view_size_allocate (GtkWidget *widget,
|
||||
/* Add a filler tile for empty space in the bottom right */
|
||||
if (i > 0)
|
||||
{
|
||||
GtkListTile *filler;
|
||||
tile = gtk_list_item_manager_get_last (self->item_manager);
|
||||
filler = gtk_list_tile_append_filler (self->item_manager, tile);
|
||||
GtkListTile *footer = gtk_list_item_manager_get_last (self->item_manager);
|
||||
g_assert (gtk_list_tile_is_footer (footer));
|
||||
tile = gtk_rb_tree_node_get_previous (footer);
|
||||
gtk_list_tile_set_area_position (self->item_manager,
|
||||
filler,
|
||||
footer,
|
||||
column_start (self, xspacing, i),
|
||||
y);
|
||||
gtk_list_tile_set_area_size (self->item_manager,
|
||||
filler,
|
||||
column_end (self, xspacing, self->n_columns - 1) - filler->area.x,
|
||||
footer,
|
||||
column_end (self, xspacing, self->n_columns - 1) - footer->area.x,
|
||||
tile->area.height);
|
||||
}
|
||||
|
||||
@@ -951,6 +951,8 @@ gtk_grid_view_dispose (GObject *object)
|
||||
|
||||
self->item_manager = NULL;
|
||||
|
||||
g_clear_object (&self->factory);
|
||||
|
||||
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))
|
||||
return;
|
||||
|
||||
gtk_grid_view_update_factories (self);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_FACTORY]);
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user