Compare commits
116 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 49e93f6ee4 | |||
| 4ec2234537 | |||
| 5a3755b233 | |||
| cad5771a66 | |||
| 378f1421f0 | |||
| a209a73c69 | |||
| 624458df9d | |||
| fbfbaa484d | |||
| 3de10847b9 | |||
| 8be601da4f | |||
| 07b9a6fb75 | |||
| 5105d607de | |||
| a9f03be588 | |||
| d67bdb96ad | |||
| c8f4535ed2 | |||
| 21cbf98942 | |||
| 300540f6b8 | |||
| 323ba14dde | |||
| aaee1ee5bd | |||
| 70a711882c | |||
| 5717b95cad | |||
| 1b0f324be5 | |||
| ca93512106 | |||
| fbd4f06ee2 | |||
| d553f6941d | |||
| 2173b7ccaa | |||
| ca6642deed | |||
| be6a4722c0 | |||
| 3b3b63062d | |||
| 7ec90abf24 | |||
| ec49a912aa | |||
| ae94417f80 | |||
| 24a6803958 | |||
| 4073371416 | |||
| e5a391c0b9 | |||
| 6cb612ac15 | |||
| 9f64202a60 | |||
| 19c362f638 | |||
| e51fa8b65b | |||
| 06d3bbafaf | |||
| da8a1f4683 | |||
| ad7d9bc409 | |||
| 94cde8d702 | |||
| ec7b1f7208 | |||
| 864fbf89cd | |||
| b8e928d703 | |||
| 0b4d41698b | |||
| a9eca60b84 | |||
| 53c3f497f1 | |||
| 3183a21347 | |||
| 07f090f947 | |||
| ad111087cc | |||
| 5092581be8 | |||
| b261f7f533 | |||
| 779f9e5071 | |||
| b07d9d1912 | |||
| 7b4692bcb0 | |||
| f0a2b6f165 | |||
| 2dc6efd9ce | |||
| 1f4adb60bb | |||
| f507dd4962 | |||
| 1bdb368e8b | |||
| aec4bfcf3b | |||
| 7e18c2849b | |||
| 351abadee7 | |||
| 951db28f71 | |||
| 40e7a265a7 | |||
| 9a539cec57 | |||
| 724cf6bd70 | |||
| 5e4b43dcce | |||
| fa43282695 | |||
| 662c251cd0 | |||
| 0d97d03fc1 | |||
| cb0aaf0b2c | |||
| 0eb791eaaa | |||
| 073c836f96 | |||
| 0a0a03d913 | |||
| d43724f5fc | |||
| abf3cdb187 | |||
| cca5de3c7f | |||
| 774696011d | |||
| c9f54ca371 | |||
| ce0123ea58 | |||
| b30af72125 | |||
| eb45b8083a | |||
| f05d801e28 | |||
| 4afec951c7 | |||
| 51ed1442a2 | |||
| 01ff6c1c22 | |||
| 73f3ea9511 | |||
| f1311dc053 | |||
| a252aadadf | |||
| 300670dad4 | |||
| 44c95d3c96 | |||
| d566771262 | |||
| 5f72b51105 | |||
| e0afd22c84 | |||
| 869ab1cd1b | |||
| 730593fab5 | |||
| d0798c9526 | |||
| e6dfb8732a | |||
| 453ef8c7e1 | |||
| 819595d1a9 | |||
| 306276b689 | |||
| bb15a7ef46 | |||
| cd0fe13dae | |||
| 3dcea74e85 | |||
| 537c2f6c7a | |||
| 72379f64e9 | |||
| 4532c3020b | |||
| b60bd8a73d | |||
| 37f12e4bf9 | |||
| 272a40a01a | |||
| ff45145eac | |||
| d2755e0385 | |||
| 0cb3555a65 |
+73
-56
@@ -26,25 +26,31 @@ variables:
|
||||
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true"
|
||||
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled -Ddemos=false -Dbuild-examples=false -Dbuild-tests=false -Dbuild-testsuite=true"
|
||||
MESON_TEST_TIMEOUT_MULTIPLIER: 3
|
||||
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v40"
|
||||
FLATPAK_IMAGE: "quay.io/gnome_infrastructure/gnome-runtime-images:gnome-master"
|
||||
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v41"
|
||||
|
||||
.only-default:
|
||||
only:
|
||||
- branches
|
||||
except:
|
||||
- tags
|
||||
workflow:
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG
|
||||
- if: $CI_COMMIT_BRANCH
|
||||
|
||||
default:
|
||||
retry:
|
||||
max: 2
|
||||
when:
|
||||
- 'runner_system_failure'
|
||||
- 'stuck_or_timeout_failure'
|
||||
- 'scheduler_failure'
|
||||
- 'api_failure'
|
||||
interruptible: true
|
||||
|
||||
style-check-diff:
|
||||
extends: .only-default
|
||||
image: $FEDORA_IMAGE
|
||||
stage: check
|
||||
allow_failure: true
|
||||
when: manual
|
||||
script:
|
||||
- .gitlab-ci/run-style-check-diff.sh
|
||||
|
||||
.build-fedora-default:
|
||||
extends: .only-default
|
||||
image: $FEDORA_IMAGE
|
||||
artifacts:
|
||||
when: always
|
||||
@@ -160,7 +166,6 @@ fedora-mingw64:
|
||||
- ninja -C _build
|
||||
|
||||
.mingw-defaults:
|
||||
extends: .only-default
|
||||
stage: build
|
||||
tags:
|
||||
- win32-ps
|
||||
@@ -192,9 +197,8 @@ msys2-mingw64:
|
||||
macos:
|
||||
# Sadly, this fails regularly, and its failure is never enlightening
|
||||
allow_failure: true
|
||||
extends: .only-default
|
||||
only:
|
||||
- branches@GNOME/gtk
|
||||
rules:
|
||||
- if: $CI_PROJECT_NAMESPACE == "GNOME"
|
||||
stage: build
|
||||
tags:
|
||||
- macos
|
||||
@@ -227,10 +231,9 @@ macos:
|
||||
- "${CI_PROJECT_DIR}/_build/meson-logs"
|
||||
|
||||
vs2017-x64:
|
||||
extends: .only-default
|
||||
# TODO: Uncomment this when ready to merge.
|
||||
#only:
|
||||
# - branches@GNOME/gtk
|
||||
# rules:
|
||||
# - if: $CI_PROJECT_NAMESPACE == "GNOME"
|
||||
stage: build
|
||||
tags:
|
||||
- win32-ps
|
||||
@@ -243,7 +246,7 @@ vs2017-x64:
|
||||
- "${CI_PROJECT_DIR}/_build/meson-logs"
|
||||
|
||||
.flatpak-defaults:
|
||||
image: $FLATPAK_IMAGE
|
||||
image: "quay.io/gnome_infrastructure/gnome-runtime-images:gnome-master"
|
||||
stage: flatpak
|
||||
allow_failure: true
|
||||
tags:
|
||||
@@ -253,65 +256,67 @@ vs2017-x64:
|
||||
- "${APPID}-dev.flatpak"
|
||||
- 'repo.tar'
|
||||
expire_in: 1 day
|
||||
rules:
|
||||
# Only build Flatpak bundles automatically on main
|
||||
- if: $CI_COMMIT_BRANCH == "main"
|
||||
- if: $CI_COMMIT_BRANCH != "main"
|
||||
when: "manual"
|
||||
script:
|
||||
- bash -x ./.gitlab-ci/flatpak-build.sh "${APPID}"
|
||||
|
||||
# Manual jobs, for branches and MRs
|
||||
.flatpak-manual:
|
||||
extends: .flatpak-defaults
|
||||
when: manual
|
||||
|
||||
# Only build Flatpak bundles automatically on main
|
||||
.flatpak-main:
|
||||
extends: .flatpak-defaults
|
||||
only:
|
||||
- main
|
||||
|
||||
flatpak-manual:demo:
|
||||
extends: .flatpak-manual
|
||||
flatpak:demo:
|
||||
extends: '.flatpak-defaults'
|
||||
needs: []
|
||||
variables:
|
||||
APPID: org.gtk.Demo4
|
||||
|
||||
flatpak-main:demo:
|
||||
extends: .flatpak-main
|
||||
flatpak:demo:aarch64:
|
||||
extends: '.flatpak-defaults'
|
||||
needs: []
|
||||
tags:
|
||||
- flatpak-aarch64
|
||||
variables:
|
||||
APPID: org.gtk.Demo4
|
||||
|
||||
flatpak-manual:widget-factory:
|
||||
extends: .flatpak-manual
|
||||
flatpak:widget-factory:
|
||||
extends: '.flatpak-defaults'
|
||||
needs: []
|
||||
variables:
|
||||
APPID: org.gtk.WidgetFactory4
|
||||
|
||||
flatpak-main:widget-factory:
|
||||
extends: .flatpak-main
|
||||
flatpak:widget-factory:aarch64:
|
||||
extends: '.flatpak-defaults'
|
||||
needs: []
|
||||
tags:
|
||||
- flatpak-aarch64
|
||||
variables:
|
||||
APPID: org.gtk.WidgetFactory4
|
||||
|
||||
flatpak-manual:icon-browser:
|
||||
extends: .flatpak-manual
|
||||
flatpak:icon-browser:
|
||||
extends: '.flatpak-defaults'
|
||||
needs: []
|
||||
variables:
|
||||
APPID: org.gtk.IconBrowser4
|
||||
|
||||
flatpak-main:icon-browser:
|
||||
extends: .flatpak-main
|
||||
flatpak:icon-browser:aarch64:
|
||||
extends: '.flatpak-defaults'
|
||||
needs: []
|
||||
tags:
|
||||
- flatpak-aarch64
|
||||
variables:
|
||||
APPID: org.gtk.IconBrowser4
|
||||
|
||||
flatpak-manual:node-editor:
|
||||
extends: .flatpak-manual
|
||||
flatpak:node-editor:
|
||||
extends: '.flatpak-defaults'
|
||||
needs: []
|
||||
variables:
|
||||
APPID: org.gtk.gtk4.NodeEditor
|
||||
|
||||
flatpak-main:node-editor:
|
||||
extends: .flatpak-main
|
||||
flatpak:node-editor:aarch64:
|
||||
extends: '.flatpak-defaults'
|
||||
needs: []
|
||||
tags:
|
||||
- flatpak-aarch64
|
||||
variables:
|
||||
APPID: org.gtk.gtk4.NodeEditor
|
||||
|
||||
@@ -320,23 +325,35 @@ flatpak-main:node-editor:
|
||||
# https://gitlab.gnome.org/GNOME/Initiatives/-/wikis/DevOps-with-Flatpak
|
||||
nightly demo:
|
||||
extends: '.publish_nightly'
|
||||
dependencies: ['flatpak-main:demo']
|
||||
needs: ['flatpak-main:demo']
|
||||
needs: ['flatpak:demo']
|
||||
|
||||
nightly demo aarch64:
|
||||
extends: '.publish_nightly'
|
||||
needs: ['flatpak:demo:aarch64']
|
||||
|
||||
nightly factory:
|
||||
extends: '.publish_nightly'
|
||||
dependencies: ['flatpak-main:widget-factory']
|
||||
needs: ['flatpak-main:widget-factory']
|
||||
needs: ['flatpak:widget-factory']
|
||||
|
||||
nightly factory aarch64:
|
||||
extends: '.publish_nightly'
|
||||
needs: ['flatpak:widget-factory:aarch64']
|
||||
|
||||
nightly icon-browser:
|
||||
extends: '.publish_nightly'
|
||||
dependencies: ['flatpak-main:icon-browser']
|
||||
needs: ['flatpak-main:icon-browser']
|
||||
needs: ['flatpak:icon-browser']
|
||||
|
||||
nightly icon-browser aarch64:
|
||||
extends: '.publish_nightly'
|
||||
needs: ['flatpak:icon-browser:aarch64']
|
||||
|
||||
nightly node-editor:
|
||||
extends: '.publish_nightly'
|
||||
dependencies: ['flatpak-main:node-editor']
|
||||
needs: ['flatpak-main:node-editor']
|
||||
needs: ['flatpak:node-editor']
|
||||
|
||||
nightly node-editor aarch64:
|
||||
extends: '.publish_nightly'
|
||||
needs: ['flatpak:node-editor:aarch64']
|
||||
|
||||
static-scan:
|
||||
image: $FEDORA_IMAGE
|
||||
@@ -419,9 +436,9 @@ reference:
|
||||
publish-docs:
|
||||
image: fedora:latest
|
||||
stage: publish
|
||||
interruptible: false
|
||||
needs: ['reference']
|
||||
script:
|
||||
- "curl -X POST -F token=${PAGES_TRIGGER_TOKEN} -F ref=docs-gtk-org https://gitlab.gnome.org/api/v4/projects/665/trigger/pipeline"
|
||||
only:
|
||||
refs:
|
||||
- main
|
||||
rules:
|
||||
- if: $CI_COMMIT_REF_NAME == "main"
|
||||
|
||||
@@ -82,6 +82,7 @@ RUN dnf -y install \
|
||||
python3-gobject \
|
||||
python3-jinja2 \
|
||||
python3-markdown \
|
||||
python3-packaging \
|
||||
python3-pip \
|
||||
python3-pygments \
|
||||
python3-typogrify \
|
||||
|
||||
@@ -23,6 +23,7 @@ push=0
|
||||
list=0
|
||||
print_help=0
|
||||
no_login=0
|
||||
no_cache=0
|
||||
|
||||
while (($# > 0)); do
|
||||
case "${1%%=*}" in
|
||||
@@ -34,6 +35,7 @@ while (($# > 0)); do
|
||||
--base|-b) read_arg base "$@" || shift;;
|
||||
--version|-v) read_arg base_version "$@" || shift;;
|
||||
--no-login) no_login=1;;
|
||||
--no-cache) no_cache=1;;
|
||||
*) echo -e "\e[1;31mERROR\e[0m: Unknown option '$1'"; exit 1;;
|
||||
esac
|
||||
shift
|
||||
@@ -103,11 +105,21 @@ TAG="${REGISTRY}/gnome/gtk/${base}:${base_version}"
|
||||
|
||||
if [ $build == 1 ]; then
|
||||
echo -e "\e[1;32mBUILDING\e[0m: ${base} as ${TAG}"
|
||||
${CMD} build \
|
||||
${format} \
|
||||
--build-arg HOST_USER_ID="$UID" \
|
||||
--tag "${TAG}" \
|
||||
--file "${base}.Dockerfile" .
|
||||
if [ $no_cache == 0 ]; then
|
||||
${CMD} build \
|
||||
${format} \
|
||||
--build-arg HOST_USER_ID="$UID" \
|
||||
--tag "${TAG}" \
|
||||
--file "${base}.Dockerfile" .
|
||||
else
|
||||
${CMD} build \
|
||||
${format} \
|
||||
--no-cache \
|
||||
--build-arg HOST_USER_ID="$UID" \
|
||||
--tag "${TAG}" \
|
||||
--file "${base}.Dockerfile" .
|
||||
fi
|
||||
|
||||
exit $?
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
Overview of Changes in 4.9.5, xx-xx-xxxx
|
||||
========================================
|
||||
|
||||
Overview of Changes in 4.9.4, 12-02-2023
|
||||
========================================
|
||||
|
||||
|
||||
@@ -2,12 +2,19 @@
|
||||
#include "demo4widget.h"
|
||||
#include "hsla.h"
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_PROGRESS,
|
||||
};
|
||||
|
||||
struct _Demo4Widget
|
||||
{
|
||||
GtkWidget parent_instance;
|
||||
PangoLayout *layout;
|
||||
GskColorStop stops[8];
|
||||
gsize n_stops;
|
||||
double progress;
|
||||
|
||||
guint tick;
|
||||
};
|
||||
@@ -49,6 +56,8 @@ demo4_widget_init (Demo4Widget *self)
|
||||
{
|
||||
PangoFontDescription *desc;
|
||||
|
||||
self->progress = 0.5;
|
||||
|
||||
self->n_stops = 8;
|
||||
self->stops[0].offset = 0;
|
||||
self->stops[0].color = (GdkRGBA) { 1, 0, 0, 1 };
|
||||
@@ -83,16 +92,24 @@ demo4_widget_dispose (GObject *object)
|
||||
}
|
||||
|
||||
static void
|
||||
demo4_widget_snapshot (GtkWidget *widget,
|
||||
GtkSnapshot *snapshot)
|
||||
demo4_widget_snapshot_content (GtkWidget *widget,
|
||||
GtkSnapshot *snapshot,
|
||||
GskMaskMode mode)
|
||||
{
|
||||
Demo4Widget *self = DEMO4_WIDGET (widget);
|
||||
int width, height;
|
||||
int width, height, layout_width, layout_height;
|
||||
double scale;
|
||||
|
||||
width = gtk_widget_get_width (widget);
|
||||
height = gtk_widget_get_height (widget);
|
||||
|
||||
gtk_snapshot_push_mask (snapshot);
|
||||
gtk_snapshot_push_mask (snapshot, mode);
|
||||
pango_layout_get_pixel_size (self->layout, &layout_width, &layout_height);
|
||||
scale = MIN ((double) width / layout_width, (double) height / layout_height);
|
||||
gtk_snapshot_translate (snapshot,
|
||||
&GRAPHENE_POINT_INIT ((width - scale * layout_width) / 2,
|
||||
(height - scale * layout_height) / 2));
|
||||
gtk_snapshot_scale (snapshot, scale, scale);
|
||||
gtk_snapshot_append_layout (snapshot, self->layout, &(GdkRGBA) { 0, 0, 0, 1 });
|
||||
gtk_snapshot_pop (snapshot);
|
||||
|
||||
@@ -105,6 +122,84 @@ demo4_widget_snapshot (GtkWidget *widget,
|
||||
gtk_snapshot_pop (snapshot);
|
||||
}
|
||||
|
||||
static void
|
||||
demo4_widget_snapshot (GtkWidget *widget,
|
||||
GtkSnapshot *snapshot)
|
||||
{
|
||||
Demo4Widget *self = DEMO4_WIDGET (widget);
|
||||
int width, height;
|
||||
|
||||
width = gtk_widget_get_width (widget);
|
||||
height = gtk_widget_get_height (widget);
|
||||
|
||||
gtk_snapshot_push_mask (snapshot, GSK_MASK_MODE_INVERTED_LUMINANCE);
|
||||
gtk_snapshot_append_linear_gradient (snapshot,
|
||||
&GRAPHENE_RECT_INIT (0, 0, width, height),
|
||||
&GRAPHENE_POINT_INIT (0, 0),
|
||||
&GRAPHENE_POINT_INIT (width, 0),
|
||||
(GskColorStop[2]) {
|
||||
{ MAX (0.0, self->progress - 5.0 / width), { 1, 1, 1, 1 } },
|
||||
{ MIN (1.0, self->progress + 5.0 / width), { 0, 0, 0, 1 } }
|
||||
}, 2);
|
||||
gtk_snapshot_pop (snapshot);
|
||||
demo4_widget_snapshot_content (widget, snapshot, GSK_MASK_MODE_INVERTED_ALPHA);
|
||||
gtk_snapshot_pop (snapshot);
|
||||
|
||||
gtk_snapshot_push_mask (snapshot, GSK_MASK_MODE_LUMINANCE);
|
||||
gtk_snapshot_append_linear_gradient (snapshot,
|
||||
&GRAPHENE_RECT_INIT (0, 0, width, height),
|
||||
&GRAPHENE_POINT_INIT (0, 0),
|
||||
&GRAPHENE_POINT_INIT (width, 0),
|
||||
(GskColorStop[2]) {
|
||||
{ MAX (0.0, self->progress - 5.0 / width), { 1, 1, 1, 1 } },
|
||||
{ MIN (1.0, self->progress + 5.0 / width), { 0, 0, 0, 1 } }
|
||||
}, 2);
|
||||
gtk_snapshot_pop (snapshot);
|
||||
demo4_widget_snapshot_content (widget, snapshot, GSK_MASK_MODE_ALPHA);
|
||||
gtk_snapshot_pop (snapshot);
|
||||
}
|
||||
|
||||
static void
|
||||
demo4_widget_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
Demo4Widget *self = DEMO4_WIDGET (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_PROGRESS:
|
||||
self->progress = g_value_get_double (value);
|
||||
gtk_widget_queue_draw (GTK_WIDGET (object));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
demo4_widget_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
Demo4Widget *self = DEMO4_WIDGET (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_PROGRESS:
|
||||
g_value_set_double (value, self->progress);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
demo4_widget_class_init (Demo4WidgetClass *class)
|
||||
{
|
||||
@@ -112,8 +207,15 @@ demo4_widget_class_init (Demo4WidgetClass *class)
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
||||
|
||||
object_class->dispose = demo4_widget_dispose;
|
||||
object_class->get_property = demo4_widget_get_property;
|
||||
object_class->set_property = demo4_widget_set_property;
|
||||
|
||||
widget_class->snapshot = demo4_widget_snapshot;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_PROGRESS,
|
||||
g_param_spec_double ("progress", NULL, NULL,
|
||||
0.0, 1.0, 0.5,
|
||||
G_PARAM_READWRITE));
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
@@ -121,3 +223,4 @@ demo4_widget_new (void)
|
||||
{
|
||||
return g_object_new (DEMO4_TYPE_WIDGET, NULL);
|
||||
}
|
||||
|
||||
|
||||
+12
-1
@@ -356,6 +356,10 @@ canvas_item_start_editing (CanvasItem *item)
|
||||
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
double x, y;
|
||||
} Hotspot;
|
||||
|
||||
static GdkContentProvider *
|
||||
prepare (GtkDragSource *source,
|
||||
double x,
|
||||
@@ -363,6 +367,7 @@ prepare (GtkDragSource *source,
|
||||
{
|
||||
GtkWidget *canvas;
|
||||
GtkWidget *item;
|
||||
Hotspot *hotspot;
|
||||
|
||||
canvas = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (source));
|
||||
item = gtk_widget_pick (canvas, x, y, GTK_PICK_DEFAULT);
|
||||
@@ -373,6 +378,10 @@ prepare (GtkDragSource *source,
|
||||
|
||||
g_object_set_data (G_OBJECT (canvas), "dragged-item", item);
|
||||
|
||||
hotspot = g_new (Hotspot, 1);
|
||||
gtk_widget_translate_coordinates (canvas, item, x, y, &hotspot->x, &hotspot->y);
|
||||
g_object_set_data_full (G_OBJECT (canvas), "hotspot", hotspot, g_free);
|
||||
|
||||
return gdk_content_provider_new_typed (GTK_TYPE_WIDGET, item);
|
||||
}
|
||||
|
||||
@@ -383,12 +392,14 @@ drag_begin (GtkDragSource *source,
|
||||
GtkWidget *canvas;
|
||||
CanvasItem *item;
|
||||
GdkPaintable *paintable;
|
||||
Hotspot *hotspot;
|
||||
|
||||
canvas = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (source));
|
||||
item = CANVAS_ITEM (g_object_get_data (G_OBJECT (canvas), "dragged-item"));
|
||||
hotspot = (Hotspot *) g_object_get_data (G_OBJECT (canvas), "hotspot");
|
||||
|
||||
paintable = canvas_item_get_drag_icon (item);
|
||||
gtk_drag_source_set_icon (source, paintable, item->r, item->r);
|
||||
gtk_drag_source_set_icon (source, paintable, hotspot->x, hotspot->y);
|
||||
g_object_unref (paintable);
|
||||
|
||||
gtk_widget_set_opacity (GTK_WIDGET (item), 0.3);
|
||||
|
||||
+12
-10
@@ -48,14 +48,16 @@
|
||||
#define VERTICES_PER_TOOTH 34
|
||||
#define GEAR_VERTEX_STRIDE 6
|
||||
|
||||
#ifndef HAVE_SINCOS
|
||||
static void
|
||||
sincos (double x, double *_sin, double *_cos)
|
||||
static inline void
|
||||
_sincos (double x, double *_sin, double *_cos)
|
||||
{
|
||||
#ifdef HAVE_SINCOS
|
||||
sincos (x, _sin, _cos);
|
||||
#else
|
||||
*_sin = sin (x);
|
||||
*_cos = cos (x);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Struct describing the vertices in triangle strip
|
||||
@@ -307,11 +309,11 @@ create_gear (GLfloat inner_radius,
|
||||
struct point p[7];
|
||||
|
||||
/* Calculate needed sin/cos for various angles */
|
||||
sincos(i * 2.0 * G_PI / teeth + da * 0, &s[0], &c[0]);
|
||||
sincos(i * 2.0 * M_PI / teeth + da * 1, &s[1], &c[1]);
|
||||
sincos(i * 2.0 * M_PI / teeth + da * 2, &s[2], &c[2]);
|
||||
sincos(i * 2.0 * M_PI / teeth + da * 3, &s[3], &c[3]);
|
||||
sincos(i * 2.0 * M_PI / teeth + da * 4, &s[4], &c[4]);
|
||||
_sincos(i * 2.0 * G_PI / teeth + da * 0, &s[0], &c[0]);
|
||||
_sincos(i * 2.0 * M_PI / teeth + da * 1, &s[1], &c[1]);
|
||||
_sincos(i * 2.0 * M_PI / teeth + da * 2, &s[2], &c[2]);
|
||||
_sincos(i * 2.0 * M_PI / teeth + da * 3, &s[3], &c[3]);
|
||||
_sincos(i * 2.0 * M_PI / teeth + da * 4, &s[4], &c[4]);
|
||||
|
||||
GEAR_POINT(p[0], r2, 1);
|
||||
GEAR_POINT(p[1], r2, 2);
|
||||
@@ -520,7 +522,7 @@ void perspective(GLfloat *m, GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloa
|
||||
identity(tmp);
|
||||
|
||||
deltaZ = zFar - zNear;
|
||||
sincos(radians, &sine, &cosine);
|
||||
_sincos(radians, &sine, &cosine);
|
||||
|
||||
if ((deltaZ == 0) || (sine == 0) || (aspect == 0))
|
||||
return;
|
||||
|
||||
+12
-5
@@ -18,7 +18,8 @@ do_mask (GtkWidget *do_widget)
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *box;
|
||||
GtkWidget *widget;
|
||||
GtkWidget *demo;
|
||||
GtkWidget *scale;
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Mask Nodes");
|
||||
@@ -30,11 +31,17 @@ do_mask (GtkWidget *do_widget)
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_window_set_child (GTK_WINDOW (window), box);
|
||||
|
||||
widget = demo4_widget_new ();
|
||||
gtk_widget_set_hexpand (widget, TRUE);
|
||||
gtk_widget_set_vexpand (widget, TRUE);
|
||||
demo = demo4_widget_new ();
|
||||
gtk_widget_set_hexpand (demo, TRUE);
|
||||
gtk_widget_set_vexpand (demo, TRUE);
|
||||
|
||||
gtk_box_append (GTK_BOX (box), widget);
|
||||
gtk_box_append (GTK_BOX (box), demo);
|
||||
|
||||
scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 1, 0.1);
|
||||
gtk_range_set_value (GTK_RANGE (scale), 0.5);
|
||||
g_object_bind_property (gtk_range_get_adjustment (GTK_RANGE (scale)), "value", demo, "progress", 0);
|
||||
|
||||
gtk_box_append (GTK_BOX (box), scale);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
||||
@@ -178,6 +178,16 @@ Creates a node like `gsk_inset_shadow_node_new()` with the given properties.
|
||||
|
||||
Creates a node like `gsk_linear_gradient_node_new()` with the given properties.
|
||||
|
||||
### mask
|
||||
|
||||
| property | syntax | default | printed |
|
||||
| -------- | ---------------- | ---------------------- | ----------- |
|
||||
| source | `<node>` | color { } | always |
|
||||
| mode | `<blend-mode>` | alpha | non-default |
|
||||
| mask | `<node>` | color { } | always |
|
||||
|
||||
Creates a node like `gsk_mask_node_new()` with the given properties.
|
||||
|
||||
### opacity
|
||||
|
||||
| property | syntax | default | printed |
|
||||
|
||||
@@ -33,6 +33,11 @@ Validation
|
||||
The ``validate`` command validates the given UI definition file and reports
|
||||
errors to ``stderr``.
|
||||
|
||||
Note that there are limitations to the validation that can be done for templates,
|
||||
since they are closely tied to the class_init function they are used in.
|
||||
If your UI file uses types from third-party libraries, it may help to add those
|
||||
libraries to the `LD_PRELOAD` environment variable.
|
||||
|
||||
``--deprecations``
|
||||
|
||||
Warn about uses of deprecated types in the UI definition file.
|
||||
|
||||
@@ -7,37 +7,50 @@ the question you have, this list is a good place to start.
|
||||
|
||||
## General Questions
|
||||
|
||||
1. How do I get started with GTK?
|
||||
* How do I get started with GTK?
|
||||
|
||||
The GTK [website](https://www.gtk.org) offers some
|
||||
[tutorials](https://www.gtk.org/documentation.php) and other documentation
|
||||
(most of it about GTK 2.x and 3.x, but still somewhat applicable). This
|
||||
reference manual also contains a introductory
|
||||
This reference manual also contains a introductory
|
||||
[Getting Started](#gtk-getting-started) part.
|
||||
|
||||
More documentation ranging from whitepapers to online books can be found at
|
||||
the [GNOME developer's site](https://developer.gnome.org). After studying these
|
||||
materials you should be well prepared to come back to this reference manual for details.
|
||||
|
||||
2. Where can I get help with GTK, submit a bug report, or make a feature request?
|
||||
* Where can I get help with GTK, submit a bug report, or make a feature request?
|
||||
|
||||
See the [documentation](#gtk-resources) on this topic.
|
||||
|
||||
3. How do I port from one GTK version to another?
|
||||
* How do I port from one GTK version to another?
|
||||
|
||||
See the [migration guide](#migrating). You may also find useful information in
|
||||
the documentation for specific widgets and functions. If you have a question not
|
||||
covered in the manual, feel free to ask, and please
|
||||
Every major version of GTK comes with a [migration guide](#migrating). You may also
|
||||
find useful information in the documentation for specific widgets and functions. If
|
||||
you have a question not covered in the manual, feel free to ask, and please
|
||||
[file a bug report](https://gitlab.gnome.org/GNOME/gtk/issues/new) against the
|
||||
documentation.
|
||||
|
||||
4. How does memory management work in GTK? Should I free data returned from functions?
|
||||
* Should I maintain parallel versions of my UI in GTK x and GTK y?
|
||||
|
||||
At the end of the day, that is up to you.
|
||||
|
||||
Our experience is that it is a lot of work, and usually not a good idea.
|
||||
|
||||
If you are not ready to make the jump to the next major version of GTK,
|
||||
it is perfectly fine to stick with the stable release. We maintain them
|
||||
for that reason.
|
||||
|
||||
* How does memory management work in GTK? Should I free data returned from functions?
|
||||
|
||||
See the documentation for `GObject` and `GInitiallyUnowned`. For `GObject` note
|
||||
specifically `g_object_ref()` and `g_object_unref()`. `GInitiallyUnowned` is a
|
||||
subclass of `GObject` so the same points apply, except that it has a "floating"
|
||||
state (explained in its documentation).
|
||||
|
||||
In a widget tree, each container owns a reference to its children. The root
|
||||
object (typically a `GtkWindow`) is owned by GTK. GTK will drop its reference
|
||||
when you call [method@Gtk.Window.destroy].
|
||||
|
||||
For strings returned from functions, they will be declared "const" if they should
|
||||
not be freed. Non-const strings should be freed with `g_free()`. Arrays follow the
|
||||
same rule. If you find an undocumented exception to the rules, please
|
||||
@@ -46,7 +59,7 @@ the question you have, this list is a good place to start.
|
||||
The transfer annotations for gobject-introspection that are part of the
|
||||
documentation can provide useful hints for memory handling semantics as well.
|
||||
|
||||
5. Why does my program leak memory, if I destroy a widget immediately
|
||||
* Why does my program leak memory, if I destroy a widget immediately
|
||||
after creating it?
|
||||
|
||||
If `GtkFoo` isn't a toplevel window, then
|
||||
@@ -69,7 +82,7 @@ the question you have, this list is a good place to start.
|
||||
the initial floating reference and you don't have to worry about reference
|
||||
counting at all ... just remove the widget from the container to get rid of it.
|
||||
|
||||
6. How do I use GTK with threads?
|
||||
* How do I use GTK with threads?
|
||||
|
||||
GTK requires that all GTK API calls are made from the same thread in which
|
||||
the `GtkApplication` was created, or `gtk_init()` was called (the _main thread_).
|
||||
@@ -79,7 +92,7 @@ the question you have, this list is a good place to start.
|
||||
the results back to the main thread using `g_idle_add()` or `GAsyncQueue`. GIO
|
||||
offers useful tools for such an approach such as `GTask`.
|
||||
|
||||
7. How do I internationalize a GTK program?
|
||||
* How do I internationalize a GTK program?
|
||||
|
||||
Most people use [GNU gettext](https://www.gnu.org/software/gettext/),
|
||||
already required in order to install GLib. On a UNIX or Linux system with
|
||||
@@ -134,7 +147,7 @@ the question you have, this list is a good place to start.
|
||||
|
||||
#define _(x) dgettext (GETTEXT_PACKAGE, x)
|
||||
|
||||
8. How do I use non-ASCII characters in GTK programs ?
|
||||
* How do I use non-ASCII characters in GTK programs ?
|
||||
|
||||
GTK uses [Unicode](http://www.unicode.org) (more exactly UTF-8) for all text.
|
||||
UTF-8 encodes each Unicode codepoint as a sequence of one to six bytes and
|
||||
@@ -217,7 +230,7 @@ the question you have, this list is a good place to start.
|
||||
to call bind_textdomain_codeset() to ensure that translated strings
|
||||
are returned in UTF-8 encoding.
|
||||
|
||||
9. How do I use GTK with C++?
|
||||
* How do I use GTK with C++?
|
||||
|
||||
There are two ways to approach this. The GTK header files use the subset
|
||||
of C that's also valid C++, so you can simply use the normal GTK API
|
||||
@@ -242,19 +255,23 @@ the question you have, this list is a good place to start.
|
||||
|
||||
There are very few functions that require this cast, however.
|
||||
|
||||
10. How do I use GTK with other non-C languages?
|
||||
* How do I use GTK with other non-C languages?
|
||||
|
||||
See the list of [language bindings](https://www.gtk.org/language-bindings.php)
|
||||
on the GTK [website](https://www.gtk.org).
|
||||
|
||||
11. How do I load an image or animation from a file?
|
||||
* How do I load an image or animation from a file?
|
||||
|
||||
To load an image file straight into a display widget, use
|
||||
[ctor@Gtk.Image.new_from_file]. To load an image for another purpose, use
|
||||
[ctor@Gdk.Texture.new_from_file]. To load a video from a file, use
|
||||
[ctor@Gtk.MediaFile.new_for_file].
|
||||
[ctor@Gtk.Picture.new_for_file] or [ctor@GTk.Picture.new_for_filename].
|
||||
To load an image for another purpose, use [ctor@Gdk.Texture.new_from_file].
|
||||
To load a video from a file, use [ctor@Gtk.MediaFile.new_for_file].
|
||||
|
||||
12. How do I draw text?
|
||||
* How do I draw text?
|
||||
|
||||
If you just want to put text into your user interface somewhere, it is
|
||||
usually easiest to just use one of ready-made widgets for this purpose,
|
||||
such as [class@Gtk.Label].
|
||||
|
||||
To draw a piece of text onto a cairo surface, use a Pango layout and
|
||||
[func@PangoCairo.show_layout].
|
||||
@@ -272,7 +289,7 @@ the question you have, this list is a good place to start.
|
||||
To draw a piece of text in a widget [vfunc@Gtk.Widget.snapshot] implementation,
|
||||
use [method@Gtk.Snapshot.append_layout].
|
||||
|
||||
13. How do I measure the size of a piece of text?
|
||||
* How do I measure the size of a piece of text?
|
||||
|
||||
To obtain the size of a piece of text, use a Pango layout and
|
||||
[method@Pango.Layout.get_pixel_size], using code like the following:
|
||||
@@ -287,7 +304,7 @@ the question you have, this list is a good place to start.
|
||||
See also the [Layout Objects](https://developer.gnome.org/pango/stable/pango-Layout-Objects.html)
|
||||
section of the [Pango documentation](https://developer.gnome.org/pango/stable/).
|
||||
|
||||
14. Why are types not registered if I use their `GTK_TYPE_BLAH` macro?
|
||||
* Why are types not registered if I use their `GTK_TYPE_BLAH` macro?
|
||||
|
||||
The %GTK_TYPE_BLAH macros are defined as calls to gtk_blah_get_type(), and
|
||||
the `_get_type()` functions are declared as %G_GNUC_CONST which allows the
|
||||
@@ -298,14 +315,14 @@ the question you have, this list is a good place to start.
|
||||
|
||||
g_type_ensure (GTK_TYPE_BLAH);
|
||||
|
||||
15. How do I create a transparent toplevel window?
|
||||
* How do I create a transparent toplevel window?
|
||||
|
||||
Any toplevel window can be transparent. It is just a matter of setting a
|
||||
transparent background in the CSS style for it.
|
||||
|
||||
## Which widget should I use...
|
||||
|
||||
16. ...for lists and trees?
|
||||
* ...for lists and trees?
|
||||
|
||||
This question has different answers, depending on the size of the dataset
|
||||
and the required formatting flexibility.
|
||||
@@ -321,7 +338,7 @@ the question you have, this list is a good place to start.
|
||||
and widgetry inside the list, then you probably want to use a [class@Gtk.ListBox],
|
||||
which uses regular widgets for display.
|
||||
|
||||
17. ...for multi-line text display or editing?
|
||||
* ...for multi-line text display or editing?
|
||||
|
||||
See the [text widget overview](#TextWidget) -- you should use the
|
||||
[class@Gtk.TextView] widget.
|
||||
@@ -330,7 +347,7 @@ the question you have, this list is a good place to start.
|
||||
of course. It can be made selectable with [method@Gtk.Label.set_selectable]. For a
|
||||
single-line text entry, see [class@Gtk.Entry].
|
||||
|
||||
18. ...to display an image or animation?
|
||||
* ...to display an image or animation?
|
||||
|
||||
GTK has two widgets that are dedicated to displaying images. [class@Gtk.Image], for
|
||||
small, fixed-size icons and [class@Gtk.Picture] for content images.
|
||||
@@ -346,17 +363,14 @@ the question you have, this list is a good place to start.
|
||||
mediafile = gtk_media_file_new_for_filename ("example.webm");
|
||||
picture = gtk_picture_new_for_paintable (GDK_PAINTABLE (mediafile));
|
||||
|
||||
19. ...for presenting a set of mutually-exclusive choices, where Windows
|
||||
* ...for presenting a set of mutually-exclusive choices, where Windows
|
||||
would use a combo box?
|
||||
|
||||
With GTK, a [class@Gtk.ComboBox] is the recommended widget to use for this use case.
|
||||
If you need an editable text entry, use the [property@Gtk.ComboBox:has-entry] property.
|
||||
|
||||
A newer alternative is [class@Gtk.DropDown].
|
||||
With GTK, a [class@Gtk.DropDown] is the recommended widget to use for this use case.
|
||||
|
||||
## Questions about GtkWidget
|
||||
|
||||
20. How do I change the color of a widget?
|
||||
* How do I change the color of a widget?
|
||||
|
||||
The background color of a widget is determined by the CSS style that applies
|
||||
to it. To change that, you can set style classes on the widget, and provide
|
||||
@@ -364,7 +378,7 @@ the question you have, this list is a good place to start.
|
||||
[method@Gtk.CssProvider.load_from_file] and its variants.
|
||||
See [method@Gtk.StyleContext.add_provider].
|
||||
|
||||
21. How do I change the font of a widget?
|
||||
* How do I change the font of a widget?
|
||||
|
||||
If you want to make the text of a label larger, you can use
|
||||
gtk_label_set_markup():
|
||||
@@ -388,14 +402,14 @@ the question you have, this list is a good place to start.
|
||||
of this approach is that users can then override the font you have chosen.
|
||||
See the `GtkStyleContext` documentation for more discussion.
|
||||
|
||||
22. How do I disable/ghost/desensitize a widget?
|
||||
* How do I disable/ghost/desensitize a widget?
|
||||
|
||||
In GTK a disabled widget is termed _insensitive_.
|
||||
See [method@Gtk.Widget.set_sensitive].
|
||||
|
||||
## GtkTextView questions
|
||||
|
||||
23. How do I get the contents of the entire text widget as a string?
|
||||
* How do I get the contents of the entire text widget as a string?
|
||||
|
||||
See [method@Gtk.TextBuffer.get_bounds] and [method@Gtk.TextBuffer.get_text]
|
||||
or [method@Gtk.TextIter.get_text].
|
||||
@@ -410,14 +424,14 @@ the question you have, this list is a good place to start.
|
||||
/* use text */
|
||||
g_free (text);
|
||||
|
||||
24. How do I make a text widget display its complete contents in a specific font?
|
||||
* How do I make a text widget display its complete contents in a specific font?
|
||||
|
||||
If you use [method@Gtk.TextBuffer.insert_with_tags] with appropriate tags to
|
||||
select the font, the inserted text will have the desired appearance, but
|
||||
text typed in by the user before or after the tagged block will appear in
|
||||
the default style.
|
||||
|
||||
25. How do I make a text view scroll to the end of the buffer automatically ?
|
||||
* How do I make a text view scroll to the end of the buffer automatically ?
|
||||
|
||||
A good way to keep a text buffer scrolled to the end is to place a
|
||||
[mark](#GtkTextMark) at the end of the buffer, and give it right gravity.
|
||||
@@ -432,21 +446,21 @@ the question you have, this list is a good place to start.
|
||||
|
||||
## GtkTreeView questions
|
||||
|
||||
26. How do I associate some data with a row in the tree?
|
||||
* How do I associate some data with a row in the tree?
|
||||
|
||||
Remember that the [iface@Gtk.TreeModel] columns don't necessarily have to be
|
||||
displayed. So you can put non-user-visible data in your model just
|
||||
like any other data, and retrieve it with [method@Gtk.TreeModel.get].
|
||||
See the [tree widget overview](#TreeWidget).
|
||||
|
||||
27. How do I put an image and some text in the same column?
|
||||
* How do I put an image and some text in the same column?
|
||||
|
||||
You can pack more than one [class@Gtk.CellRenderer] into a single [class@Gtk.TreeViewColumn]
|
||||
using [method@Gtk.TreeViewColumn.pack_start] or [method@Gtk.TreeViewColumn.pack_end].
|
||||
So pack both a [class@Gtk.CellRendererPixbuf] and a [class@Gtk.CellRendererText] into the
|
||||
column.
|
||||
|
||||
28. I can set data easily on my [class@Gtk.TreeStore] or [class@Gtk.ListStore] models using
|
||||
* I can set data easily on my [class@Gtk.TreeStore] or [class@Gtk.ListStore] models using
|
||||
[method@Gtk.ListStore.set] and [method@Gtk.TreeStore.set], but can't read it back?
|
||||
|
||||
Both the [class@Gtk.TreeStore] and the [class@Gtk.ListStore] implement the [iface@Gtk.TreeModel]
|
||||
@@ -454,7 +468,7 @@ the question you have, this list is a good place to start.
|
||||
implements. The easiest way to read a set of data back is to use
|
||||
[method@Gtk.TreeModel.get].
|
||||
|
||||
29. How do I change the way that numbers are formatted by `GtkTreeView`?
|
||||
* How do I change the way that numbers are formatted by `GtkTreeView`?
|
||||
|
||||
Use [method@Gtk.TreeView.insert_column_with_data_func] or
|
||||
[method@Gtk.TreeViewColumn.set_cell_data_func] and do the conversion
|
||||
@@ -528,19 +542,21 @@ the question you have, this list is a good place to start.
|
||||
(gpointer)DOUBLE_COLUMN, NULL);
|
||||
}
|
||||
|
||||
30. How do I hide the expander arrows in my tree view?
|
||||
* How do I hide the expander arrows in my tree view?
|
||||
|
||||
Set the expander-column property of the tree view to a hidden column.
|
||||
See [method@Gtk.TreeView.set_expander_column] and [method@Gtk.TreeViewColumn.set_visible].
|
||||
|
||||
## Using cairo with GTK
|
||||
|
||||
31. How do I use cairo to draw in GTK applications?
|
||||
* How do I use cairo to draw in GTK applications?
|
||||
|
||||
Use [method@Gtk.Snapshot.append_cairo] in your [vfunc@Gtk.Widget.snapshot] vfunc
|
||||
to obtain a cairo context and draw with that.
|
||||
[class@Gtk.DrawingArea] is a ready-made widget for drawing with cairo.
|
||||
|
||||
32. Can I improve the performance of my application by using another backend
|
||||
If you implement a custom widget, use [method@Gtk.Snapshot.append_cairo]
|
||||
in your [vfunc@Gtk.Widget.snapshot] vfunc to obtain a cairo context and draw with that.
|
||||
|
||||
* Can I improve the performance of my application by using another backend
|
||||
of cairo (such as GL)?
|
||||
|
||||
No. Most drawing in GTK is not done via cairo anymore (but instead
|
||||
@@ -551,7 +567,7 @@ the question you have, this list is a good place to start.
|
||||
|
||||
If you are interested in using GL for your own drawing, see [class@Gtk.GLArea].
|
||||
|
||||
33. Can I use cairo to draw on a `GdkPixbuf`?
|
||||
* Can I use cairo to draw on a `GdkPixbuf`?
|
||||
|
||||
No. The cairo image surface does not support the pixel format used by `GdkPixbuf`.
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
#include <gdk/gdksnapshot.h>
|
||||
#include <gdk/gdksurface.h>
|
||||
#include <gdk/gdktexture.h>
|
||||
#include <gdk/gdktexturedownloader.h>
|
||||
#include <gdk/gdktoplevel.h>
|
||||
#include <gdk/gdktoplevellayout.h>
|
||||
#include <gdk/gdktoplevelsize.h>
|
||||
|
||||
@@ -584,6 +584,8 @@ gdk_frame_clock_paint_idle (void *data)
|
||||
{
|
||||
priv->requested &= ~GDK_FRAME_CLOCK_PHASE_LAYOUT;
|
||||
_gdk_frame_clock_emit_layout (clock);
|
||||
if (priv->requested & GDK_FRAME_CLOCK_PHASE_LAYOUT)
|
||||
g_print ("looping in layout %d\n", iter);
|
||||
}
|
||||
if (iter == 5)
|
||||
g_warning ("gdk-frame-clock: layout continuously requested, giving up after 4 tries");
|
||||
@@ -809,3 +811,12 @@ _gdk_frame_clock_idle_new (void)
|
||||
|
||||
return GDK_FRAME_CLOCK (clock);
|
||||
}
|
||||
|
||||
GdkFrameClockPhase
|
||||
gdk_frame_clock_get_current_phase (GdkFrameClock *clock)
|
||||
{
|
||||
GdkFrameClockIdle *clock_idle = GDK_FRAME_CLOCK_IDLE (clock);
|
||||
GdkFrameClockIdlePrivate *priv = clock_idle->priv;
|
||||
|
||||
return priv->phase;
|
||||
}
|
||||
|
||||
@@ -127,6 +127,8 @@ void _gdk_frame_clock_emit_paint (GdkFrameClock *frame_clock);
|
||||
void _gdk_frame_clock_emit_after_paint (GdkFrameClock *frame_clock);
|
||||
void _gdk_frame_clock_emit_resume_events (GdkFrameClock *frame_clock);
|
||||
|
||||
GdkFrameClockPhase gdk_frame_clock_get_current_phase (GdkFrameClock *frame_clock);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_FRAME_CLOCK_PRIVATE_H__ */
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "gdkglcontextprivate.h"
|
||||
#include "gdkmemoryformatprivate.h"
|
||||
#include "gdkmemorytextureprivate.h"
|
||||
#include "gdktextureprivate.h"
|
||||
|
||||
#include <epoxy/gl.h>
|
||||
|
||||
|
||||
+6
-10
@@ -222,7 +222,7 @@ gdk_memory_texture_from_texture (GdkTexture *texture,
|
||||
data = g_malloc_n (stride, texture->height);
|
||||
|
||||
gdk_texture_do_download (texture, format, data, stride);
|
||||
bytes = g_bytes_new_take (data, stride);
|
||||
bytes = g_bytes_new_take (data, stride * texture->height);
|
||||
result = gdk_memory_texture_new (texture->width,
|
||||
texture->height,
|
||||
format,
|
||||
@@ -233,15 +233,11 @@ gdk_memory_texture_from_texture (GdkTexture *texture,
|
||||
return GDK_MEMORY_TEXTURE (result);
|
||||
}
|
||||
|
||||
const guchar *
|
||||
gdk_memory_texture_get_data (GdkMemoryTexture *self)
|
||||
GBytes *
|
||||
gdk_memory_texture_get_bytes (GdkMemoryTexture *self,
|
||||
gsize *out_stride)
|
||||
{
|
||||
return g_bytes_get_data (self->bytes, NULL);
|
||||
}
|
||||
|
||||
gsize
|
||||
gdk_memory_texture_get_stride (GdkMemoryTexture *self)
|
||||
{
|
||||
return self->stride;
|
||||
*out_stride = self->stride;
|
||||
return self->bytes;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,8 +37,8 @@ GdkTexture * gdk_memory_texture_new_subtexture (GdkMemoryTexture *
|
||||
int width,
|
||||
int height);
|
||||
|
||||
const guchar * gdk_memory_texture_get_data (GdkMemoryTexture *self);
|
||||
gsize gdk_memory_texture_get_stride (GdkMemoryTexture *self);
|
||||
GBytes * gdk_memory_texture_get_bytes (GdkMemoryTexture *self,
|
||||
gsize *out_stride);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
+17
-12
@@ -27,7 +27,7 @@
|
||||
#include "gdkmemoryformatprivate.h"
|
||||
#include "gdkmemorytextureprivate.h"
|
||||
#include "gdksurface.h"
|
||||
#include "gdktextureprivate.h"
|
||||
#include "gdktexturedownloaderprivate.h"
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
@@ -218,9 +218,9 @@ gdk_pixbuf_get_from_surface (cairo_surface_t *surface,
|
||||
|
||||
static void
|
||||
pixbuf_texture_unref_cb (guchar *pixels,
|
||||
gpointer texture)
|
||||
gpointer bytes)
|
||||
{
|
||||
g_object_unref (texture);
|
||||
g_bytes_unref (bytes);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -238,22 +238,27 @@ pixbuf_texture_unref_cb (guchar *pixels,
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf_get_from_texture (GdkTexture *texture)
|
||||
{
|
||||
GdkMemoryTexture *memtex;
|
||||
GdkTextureDownloader downloader;
|
||||
GBytes *bytes;
|
||||
gsize stride;
|
||||
gboolean alpha;
|
||||
|
||||
alpha = gdk_memory_format_alpha (gdk_texture_get_format (texture)) != GDK_MEMORY_ALPHA_OPAQUE;
|
||||
|
||||
memtex = gdk_memory_texture_from_texture (texture,
|
||||
alpha ? GDK_MEMORY_GDK_PIXBUF_ALPHA
|
||||
: GDK_MEMORY_GDK_PIXBUF_OPAQUE);
|
||||
gdk_texture_downloader_init (&downloader, texture);
|
||||
gdk_texture_downloader_set_format (&downloader,
|
||||
alpha ? GDK_MEMORY_GDK_PIXBUF_ALPHA
|
||||
: GDK_MEMORY_GDK_PIXBUF_OPAQUE);
|
||||
bytes = gdk_texture_downloader_download_bytes (&downloader, &stride);
|
||||
gdk_texture_downloader_finish (&downloader);
|
||||
|
||||
return gdk_pixbuf_new_from_data (gdk_memory_texture_get_data (memtex),
|
||||
return gdk_pixbuf_new_from_data (g_bytes_get_data (bytes, NULL),
|
||||
GDK_COLORSPACE_RGB,
|
||||
alpha,
|
||||
8,
|
||||
gdk_texture_get_width (GDK_TEXTURE (memtex)),
|
||||
gdk_texture_get_height (GDK_TEXTURE (memtex)),
|
||||
gdk_memory_texture_get_stride (memtex),
|
||||
gdk_texture_get_width (texture),
|
||||
gdk_texture_get_height (texture),
|
||||
stride,
|
||||
pixbuf_texture_unref_cb,
|
||||
memtex);
|
||||
bytes);
|
||||
}
|
||||
|
||||
@@ -722,6 +722,9 @@ gdk_texture_download_surface (GdkTexture *texture)
|
||||
* cairo_image_surface_get_stride (surface));
|
||||
* cairo_surface_mark_dirty (surface);
|
||||
* ```
|
||||
*
|
||||
* For more flexible download capabilites, see
|
||||
* [struct@Gdk.TextureDownloader].
|
||||
*/
|
||||
void
|
||||
gdk_texture_download (GdkTexture *texture,
|
||||
@@ -738,9 +741,29 @@ gdk_texture_download (GdkTexture *texture,
|
||||
stride);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_texture_get_format:
|
||||
* @self: a GdkTexture
|
||||
*
|
||||
* Gets the memory format most closely associated with the data of
|
||||
* the texture.
|
||||
*
|
||||
* Note that it may not be an exact match for texture data
|
||||
* stored on the GPU or with compression.
|
||||
*
|
||||
* The format can give an indication about the bit depth and opacity
|
||||
* of the texture and is useful to determine the best format for
|
||||
* downloading the texture.
|
||||
*
|
||||
* Returns: the preferred format for the texture's data
|
||||
*
|
||||
* Since: 4.10
|
||||
**/
|
||||
GdkMemoryFormat
|
||||
gdk_texture_get_format (GdkTexture *self)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_TEXTURE (self), GDK_MEMORY_DEFAULT);
|
||||
|
||||
return self->format;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#endif
|
||||
|
||||
#include <gdk/gdkversionmacros.h>
|
||||
#include <gdk/gdkenums.h>
|
||||
#include <gdk/gdktypes.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
@@ -82,6 +83,8 @@ GDK_AVAILABLE_IN_ALL
|
||||
int gdk_texture_get_width (GdkTexture *texture) G_GNUC_PURE;
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
int gdk_texture_get_height (GdkTexture *texture) G_GNUC_PURE;
|
||||
GDK_AVAILABLE_IN_4_10
|
||||
GdkMemoryFormat gdk_texture_get_format (GdkTexture *self) G_GNUC_PURE;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_texture_download (GdkTexture *texture,
|
||||
|
||||
@@ -0,0 +1,268 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 2023 Benjamin Otte
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* GdkTextureDownloader:
|
||||
*
|
||||
* The `GdkTextureDownloader` is used to download the contents of a
|
||||
* [class@Gdk.Texture].
|
||||
*
|
||||
* It is intended to be created as a short-term object for a single download,
|
||||
* but can be used for multipe downloads of different textures or with different
|
||||
* settings.
|
||||
*
|
||||
* `GdkTextureDownloader` can be used to convert data between different formats.
|
||||
* Create a `GdkTexture` for the existing format and then download it in a
|
||||
* different format.
|
||||
*
|
||||
* Since: 4.10
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdktexturedownloaderprivate.h"
|
||||
|
||||
#include "gdkmemoryformatprivate.h"
|
||||
#include "gdkmemorytextureprivate.h"
|
||||
#include "gdktextureprivate.h"
|
||||
|
||||
G_DEFINE_BOXED_TYPE (GdkTextureDownloader, gdk_texture_downloader,
|
||||
gdk_texture_downloader_copy,
|
||||
gdk_texture_downloader_free)
|
||||
|
||||
|
||||
void
|
||||
gdk_texture_downloader_init (GdkTextureDownloader *self,
|
||||
GdkTexture *texture)
|
||||
{
|
||||
self->texture = g_object_ref (texture);
|
||||
self->format = GDK_MEMORY_DEFAULT;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_texture_downloader_finish (GdkTextureDownloader *self)
|
||||
{
|
||||
g_object_unref (self->texture);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_texture_downloader_new:
|
||||
* @texture: texture to download
|
||||
*
|
||||
* Creates a new texture downloader for @texture.
|
||||
*
|
||||
* Returns: A new texture downloader
|
||||
*
|
||||
* Since: 4.10
|
||||
**/
|
||||
GdkTextureDownloader *
|
||||
gdk_texture_downloader_new (GdkTexture *texture)
|
||||
{
|
||||
GdkTextureDownloader *self;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_TEXTURE (texture), NULL);
|
||||
|
||||
self = g_slice_new (GdkTextureDownloader);
|
||||
gdk_texture_downloader_init (self, texture);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_texture_downloader_copy:
|
||||
* @self: the downloader to copy
|
||||
*
|
||||
* Creates a copy of the downloader.
|
||||
*
|
||||
* This function is meant for language bindings.
|
||||
*
|
||||
* Returns: A copy of the downloader
|
||||
*
|
||||
* Since: 4.10
|
||||
**/
|
||||
GdkTextureDownloader *
|
||||
gdk_texture_downloader_copy (const GdkTextureDownloader *self)
|
||||
{
|
||||
GdkTextureDownloader *copy;
|
||||
|
||||
g_return_val_if_fail (self != NULL, NULL);
|
||||
|
||||
copy = gdk_texture_downloader_new (self->texture);
|
||||
gdk_texture_downloader_set_format (copy, self->format);
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_texture_downloader_free:
|
||||
* @self: texture downloader to free
|
||||
*
|
||||
* Frees the given downloader and all its associated resources.
|
||||
*
|
||||
* Since: 4.10
|
||||
**/
|
||||
void
|
||||
gdk_texture_downloader_free (GdkTextureDownloader *self)
|
||||
{
|
||||
g_return_if_fail (self != NULL);
|
||||
|
||||
gdk_texture_downloader_finish (self);
|
||||
g_slice_free (GdkTextureDownloader, self);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_texture_downloader_set_texture:
|
||||
* @self: a texture downloader
|
||||
* @texture: the new texture to download
|
||||
*
|
||||
* Changes the texture the downloader will download.
|
||||
*
|
||||
* Since: 4.10
|
||||
**/
|
||||
void
|
||||
gdk_texture_downloader_set_texture (GdkTextureDownloader *self,
|
||||
GdkTexture *texture)
|
||||
{
|
||||
g_return_if_fail (self != NULL);
|
||||
g_return_if_fail (GDK_IS_TEXTURE (texture));
|
||||
|
||||
g_set_object (&self->texture, texture);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_texture_downloader_get_texture:
|
||||
* @self: a texture downloader
|
||||
*
|
||||
* Gets the texture that the downloader will download.
|
||||
*
|
||||
* Returns: (transfer none): The texture to download
|
||||
*
|
||||
* Since: 4.10
|
||||
**/
|
||||
GdkTexture *
|
||||
gdk_texture_downloader_get_texture (const GdkTextureDownloader *self)
|
||||
{
|
||||
g_return_val_if_fail (self != NULL, NULL);
|
||||
|
||||
return self->texture;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_texture_downloader_set_format:
|
||||
* @self: a texture downloader
|
||||
* @format: the format to use
|
||||
*
|
||||
* Sets the format the downloader will download.
|
||||
*
|
||||
* By default, GDK_MEMORY_DEFAULT is set.
|
||||
*
|
||||
* Since: 4.10
|
||||
*/
|
||||
void
|
||||
gdk_texture_downloader_set_format (GdkTextureDownloader *self,
|
||||
GdkMemoryFormat format)
|
||||
{
|
||||
g_return_if_fail (self != NULL);
|
||||
|
||||
self->format = format;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_texture_downloader_get_format:
|
||||
* @self: a texture downloader
|
||||
*
|
||||
* Gets the format that the data will be downloaded in.
|
||||
*
|
||||
* Returns: The format of the download
|
||||
*
|
||||
* Since: 4.10
|
||||
**/
|
||||
GdkMemoryFormat
|
||||
gdk_texture_downloader_get_format (const GdkTextureDownloader *self)
|
||||
{
|
||||
g_return_val_if_fail (self != NULL, GDK_MEMORY_DEFAULT);
|
||||
|
||||
return self->format;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_texture_downloader_download_into:
|
||||
* @self: a texture downloader
|
||||
* @data: (array): pointer to enough memory to be filled with the
|
||||
* downloaded data of the texture
|
||||
* @stride: rowstride in bytes
|
||||
*
|
||||
* Downloads the @texture into local memory.
|
||||
*
|
||||
* Since: 4.10
|
||||
**/
|
||||
void
|
||||
gdk_texture_downloader_download_into (const GdkTextureDownloader *self,
|
||||
guchar *data,
|
||||
gsize stride)
|
||||
{
|
||||
g_return_if_fail (self != NULL);
|
||||
g_return_if_fail (data != NULL);
|
||||
g_return_if_fail (stride >= gdk_texture_get_width (self->texture) * gdk_memory_format_bytes_per_pixel (self->format));
|
||||
|
||||
gdk_texture_do_download (self->texture, self->format, data, stride);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_texture_downloader_download_bytes:
|
||||
* @self: the downloader
|
||||
* @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.
|
||||
*
|
||||
* Returns: The downloaded pixels.
|
||||
*
|
||||
* Since: 4.10
|
||||
**/
|
||||
GBytes *
|
||||
gdk_texture_downloader_download_bytes (const GdkTextureDownloader *self,
|
||||
gsize *out_stride)
|
||||
{
|
||||
guchar *data;
|
||||
gsize stride;
|
||||
|
||||
g_return_val_if_fail (self != NULL, NULL);
|
||||
g_return_val_if_fail (out_stride != NULL, NULL);
|
||||
|
||||
if (GDK_IS_MEMORY_TEXTURE (self->texture) &&
|
||||
gdk_texture_get_format (self->texture) == self->format)
|
||||
{
|
||||
GdkMemoryTexture *memtex = GDK_MEMORY_TEXTURE (self->texture);
|
||||
|
||||
return g_bytes_ref (gdk_memory_texture_get_bytes (memtex, out_stride));
|
||||
}
|
||||
|
||||
stride = self->texture->width * gdk_memory_format_bytes_per_pixel (self->format);
|
||||
data = g_malloc_n (stride, self->texture->height);
|
||||
|
||||
gdk_texture_do_download (self->texture, self->format, data, stride);
|
||||
|
||||
*out_stride = stride;
|
||||
return g_bytes_new_take (data, stride * self->texture->height);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 2023 Benjamin Otte
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_TEXTURE_DOWNLOADER_H__
|
||||
#define __GTK_TEXTURE_DOWNLOADER_H__
|
||||
|
||||
#if !defined (__GDK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gdk/gdk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
|
||||
#include <gdk/gdkversionmacros.h>
|
||||
#include <gdk/gdkenums.h>
|
||||
#include <gdk/gdktypes.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GDK_TYPE_TEXTURE_DOWNLOADER (gdk_texture_downloader_get_type ())
|
||||
|
||||
GDK_AVAILABLE_IN_4_10
|
||||
GType gdk_texture_downloader_get_type (void) G_GNUC_CONST;
|
||||
GDK_AVAILABLE_IN_4_10
|
||||
GdkTextureDownloader * gdk_texture_downloader_new (GdkTexture *texture);
|
||||
|
||||
GDK_AVAILABLE_IN_4_10
|
||||
GdkTextureDownloader * gdk_texture_downloader_copy (const GdkTextureDownloader *self);
|
||||
GDK_AVAILABLE_IN_4_10
|
||||
void gdk_texture_downloader_free (GdkTextureDownloader *self);
|
||||
|
||||
|
||||
GDK_AVAILABLE_IN_4_10
|
||||
void gdk_texture_downloader_set_texture (GdkTextureDownloader *self,
|
||||
GdkTexture *texture);
|
||||
GDK_AVAILABLE_IN_4_10
|
||||
GdkTexture * gdk_texture_downloader_get_texture (const GdkTextureDownloader *self);
|
||||
GDK_AVAILABLE_IN_4_10
|
||||
void gdk_texture_downloader_set_format (GdkTextureDownloader *self,
|
||||
GdkMemoryFormat format);
|
||||
GDK_AVAILABLE_IN_4_10
|
||||
GdkMemoryFormat gdk_texture_downloader_get_format (const GdkTextureDownloader *self);
|
||||
|
||||
|
||||
GDK_AVAILABLE_IN_4_10
|
||||
void gdk_texture_downloader_download_into (const GdkTextureDownloader *self,
|
||||
guchar *data,
|
||||
gsize stride);
|
||||
GDK_AVAILABLE_IN_4_10
|
||||
GBytes * gdk_texture_downloader_download_bytes (const GdkTextureDownloader *self,
|
||||
gsize *out_stride);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkTextureDownloader, gdk_texture_downloader_free)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_TEXTURE_DOWNLOADER_H__ */
|
||||
@@ -0,0 +1,41 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
*
|
||||
* Copyright (C) 2023 Benjamin Otte
|
||||
*
|
||||
* 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.1 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/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __GTK_TEXTURE_DOWNLOADER_PRIVATE_H__
|
||||
#define __GTK_TEXTURE_DOWNLOADER_PRIVATE_H__
|
||||
|
||||
#include "gdktexturedownloader.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
struct _GdkTextureDownloader
|
||||
{
|
||||
/*< private >*/
|
||||
GdkTexture *texture;
|
||||
GdkMemoryFormat format;
|
||||
};
|
||||
|
||||
void gdk_texture_downloader_init (GdkTextureDownloader *self,
|
||||
GdkTexture *texture);
|
||||
void gdk_texture_downloader_finish (GdkTextureDownloader *self);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_TEXTURE_DOWNLOADER_PRIVATE_H__ */
|
||||
@@ -43,7 +43,6 @@ void gdk_texture_do_download (GdkTexture
|
||||
GdkMemoryFormat format,
|
||||
guchar *data,
|
||||
gsize stride);
|
||||
GdkMemoryFormat gdk_texture_get_format (GdkTexture *self);
|
||||
gboolean gdk_texture_set_render_data (GdkTexture *self,
|
||||
gpointer key,
|
||||
gpointer data,
|
||||
|
||||
@@ -77,6 +77,7 @@ typedef struct _GdkContentFormats GdkContentFormats;
|
||||
typedef struct _GdkContentProvider GdkContentProvider;
|
||||
typedef struct _GdkCursor GdkCursor;
|
||||
typedef struct _GdkTexture GdkTexture;
|
||||
typedef struct _GdkTextureDownloader GdkTextureDownloader;
|
||||
typedef struct _GdkDevice GdkDevice;
|
||||
typedef struct _GdkDrag GdkDrag;
|
||||
typedef struct _GdkDrop GdkDrop;
|
||||
|
||||
+10
-8
@@ -23,7 +23,7 @@
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gdktexture.h"
|
||||
#include "gdkmemorytextureprivate.h"
|
||||
#include "gdktexturedownloaderprivate.h"
|
||||
|
||||
#include "gdkprofilerprivate.h"
|
||||
|
||||
@@ -251,7 +251,8 @@ gdk_save_jpeg (GdkTexture *texture)
|
||||
guchar *data = NULL;
|
||||
gulong size = 0;
|
||||
guchar *input = NULL;
|
||||
GdkMemoryTexture *memtex = NULL;
|
||||
GdkTextureDownloader downloader;
|
||||
GBytes *texbytes;
|
||||
const guchar *texdata;
|
||||
gsize texstride;
|
||||
guchar *row;
|
||||
@@ -270,7 +271,7 @@ gdk_save_jpeg (GdkTexture *texture)
|
||||
free (data);
|
||||
g_free (input);
|
||||
jpeg_destroy_compress (&info);
|
||||
g_clear_object (&memtex);
|
||||
g_clear_pointer (&texbytes, g_bytes_unref);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -289,10 +290,11 @@ gdk_save_jpeg (GdkTexture *texture)
|
||||
|
||||
jpeg_mem_dest (&info, &data, &size);
|
||||
|
||||
memtex = gdk_memory_texture_from_texture (texture,
|
||||
GDK_MEMORY_R8G8B8);
|
||||
texdata = gdk_memory_texture_get_data (memtex);
|
||||
texstride = gdk_memory_texture_get_stride (memtex);
|
||||
gdk_texture_downloader_init (&downloader, texture);
|
||||
gdk_texture_downloader_set_format (&downloader, GDK_MEMORY_R8G8B8);
|
||||
texbytes = gdk_texture_downloader_download_bytes (&downloader, &texstride);
|
||||
gdk_texture_downloader_finish (&downloader);
|
||||
texdata = g_bytes_get_data (texbytes, NULL);
|
||||
|
||||
jpeg_start_compress (&info, TRUE);
|
||||
|
||||
@@ -304,7 +306,7 @@ gdk_save_jpeg (GdkTexture *texture)
|
||||
|
||||
jpeg_finish_compress (&info);
|
||||
|
||||
g_object_unref (memtex);
|
||||
g_bytes_unref (texbytes);
|
||||
g_free (input);
|
||||
jpeg_destroy_compress (&info);
|
||||
|
||||
|
||||
+13
-11
@@ -21,10 +21,9 @@
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gdkmemoryformatprivate.h"
|
||||
#include "gdkmemorytextureprivate.h"
|
||||
#include "gdkmemorytexture.h"
|
||||
#include "gdkprofilerprivate.h"
|
||||
#include "gdktexture.h"
|
||||
#include "gdktextureprivate.h"
|
||||
#include "gdktexturedownloaderprivate.h"
|
||||
#include "gsk/gl/fp16private.h"
|
||||
#include <png.h>
|
||||
#include <stdio.h>
|
||||
@@ -297,11 +296,12 @@ gdk_save_png (GdkTexture *texture)
|
||||
png_info *info;
|
||||
png_io io = { NULL, 0, 0 };
|
||||
int width, height;
|
||||
int y;
|
||||
GdkMemoryFormat format;
|
||||
GdkTextureDownloader downloader;
|
||||
GBytes *bytes;
|
||||
gsize stride;
|
||||
const guchar *data;
|
||||
int y;
|
||||
GdkMemoryTexture *memtex;
|
||||
GdkMemoryFormat format;
|
||||
int png_format;
|
||||
int depth;
|
||||
|
||||
@@ -370,11 +370,15 @@ gdk_save_png (GdkTexture *texture)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memtex = gdk_memory_texture_from_texture (texture, format);
|
||||
gdk_texture_downloader_init (&downloader, texture);
|
||||
gdk_texture_downloader_set_format (&downloader, format);
|
||||
bytes = gdk_texture_downloader_download_bytes (&downloader, &stride);
|
||||
gdk_texture_downloader_finish (&downloader);
|
||||
data = g_bytes_get_data (bytes, NULL);
|
||||
|
||||
if (sigsetjmp (png_jmpbuf (png), 1))
|
||||
{
|
||||
g_object_unref (memtex);
|
||||
g_bytes_unref (bytes);
|
||||
g_free (io.data);
|
||||
png_destroy_read_struct (&png, &info, NULL);
|
||||
return NULL;
|
||||
@@ -394,8 +398,6 @@ gdk_save_png (GdkTexture *texture)
|
||||
png_set_swap (png);
|
||||
#endif
|
||||
|
||||
data = gdk_memory_texture_get_data (memtex);
|
||||
stride = gdk_memory_texture_get_stride (memtex);
|
||||
for (y = 0; y < height; y++)
|
||||
png_write_row (png, data + y * stride);
|
||||
|
||||
@@ -403,7 +405,7 @@ gdk_save_png (GdkTexture *texture)
|
||||
|
||||
png_destroy_write_struct (&png, &info);
|
||||
|
||||
g_object_unref (memtex);
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
return g_bytes_new_take (io.data, io.size);
|
||||
}
|
||||
|
||||
+13
-11
@@ -21,10 +21,9 @@
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gdkmemoryformatprivate.h"
|
||||
#include "gdkmemorytextureprivate.h"
|
||||
#include "gdkmemorytexture.h"
|
||||
#include "gdkprofilerprivate.h"
|
||||
#include "gdktexture.h"
|
||||
#include "gdktextureprivate.h"
|
||||
#include "gdktexturedownloaderprivate.h"
|
||||
|
||||
#include <tiffio.h>
|
||||
|
||||
@@ -260,11 +259,12 @@ GBytes *
|
||||
gdk_save_tiff (GdkTexture *texture)
|
||||
{
|
||||
TIFF *tif;
|
||||
int width, height, stride;
|
||||
int width, height;
|
||||
gsize stride;
|
||||
const guchar *line;
|
||||
const guchar *data;
|
||||
GBytes *result = NULL;
|
||||
GdkMemoryTexture *memtex;
|
||||
GBytes *bytes, *result = NULL;
|
||||
GdkTextureDownloader downloader;
|
||||
GdkMemoryFormat format;
|
||||
const FormatData *fdata = NULL;
|
||||
|
||||
@@ -292,9 +292,11 @@ gdk_save_tiff (GdkTexture *texture)
|
||||
TIFFSetField (tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
|
||||
TIFFSetField (tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
|
||||
|
||||
memtex = gdk_memory_texture_from_texture (texture, fdata->format);
|
||||
data = gdk_memory_texture_get_data (memtex);
|
||||
stride = gdk_memory_texture_get_stride (memtex);
|
||||
gdk_texture_downloader_init (&downloader, texture);
|
||||
gdk_texture_downloader_set_format (&downloader, fdata->format);
|
||||
bytes = gdk_texture_downloader_download_bytes (&downloader, &stride);
|
||||
gdk_texture_downloader_finish (&downloader);
|
||||
data = g_bytes_get_data (bytes, NULL);
|
||||
|
||||
line = (const guchar *)data;
|
||||
for (int y = 0; y < height; y++)
|
||||
@@ -302,7 +304,7 @@ gdk_save_tiff (GdkTexture *texture)
|
||||
if (TIFFWriteScanline (tif, (void *)line, y, 0) == -1)
|
||||
{
|
||||
TIFFClose (tif);
|
||||
g_object_unref (memtex);
|
||||
g_bytes_unref (bytes);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -314,7 +316,7 @@ gdk_save_tiff (GdkTexture *texture)
|
||||
|
||||
g_assert (result);
|
||||
|
||||
g_object_unref (memtex);
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ gdk_public_sources = files([
|
||||
'gdkseatdefault.c',
|
||||
'gdksnapshot.c',
|
||||
'gdktexture.c',
|
||||
'gdktexturedownloader.c',
|
||||
'gdkvulkancontext.c',
|
||||
'gdksurface.c',
|
||||
'gdkpopuplayout.c',
|
||||
@@ -95,6 +96,7 @@ gdk_public_headers = files([
|
||||
'gdkseat.h',
|
||||
'gdksnapshot.h',
|
||||
'gdktexture.h',
|
||||
'gdktexturedownloader.h',
|
||||
'gdktypes.h',
|
||||
'gdkvulkancontext.h',
|
||||
'gdksurface.h',
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#include "gdkdisplay-wayland.h"
|
||||
#include "gdksurface-wayland.h"
|
||||
#include "gdksurface-wayland-private.h"
|
||||
|
||||
#include "gdkwaylanddisplay.h"
|
||||
#include "gdkwaylandglcontext.h"
|
||||
@@ -60,10 +61,17 @@ gdk_wayland_gl_context_end_frame (GdkDrawContext *draw_context,
|
||||
cairo_region_t *painted)
|
||||
{
|
||||
GdkSurface *surface = gdk_draw_context_get_surface (draw_context);
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
int dx = impl->pending_buffer_offset_x;
|
||||
int dy = impl->pending_buffer_offset_y;
|
||||
|
||||
gdk_wayland_surface_sync (surface);
|
||||
gdk_wayland_surface_request_frame (surface);
|
||||
|
||||
if (wl_surface_get_version (impl->display_server.wl_surface) >=
|
||||
WL_SURFACE_OFFSET_SINCE_VERSION)
|
||||
wl_surface_offset (impl->display_server.wl_surface, dx, dy);
|
||||
|
||||
GDK_DRAW_CONTEXT_CLASS (gdk_wayland_gl_context_parent_class)->end_frame (draw_context, painted);
|
||||
|
||||
gdk_wayland_surface_notify_committed (surface);
|
||||
|
||||
@@ -229,7 +229,7 @@ gdk_wayland_surface_update_size (GdkSurface *surface,
|
||||
|
||||
if (impl->display_server.egl_window)
|
||||
wl_egl_window_resize (impl->display_server.egl_window, width * scale, height * scale, 0, 0);
|
||||
if (impl->display_server.wl_surface)
|
||||
if (impl->display_server.wl_surface && scale_changed)
|
||||
wl_surface_set_buffer_scale (impl->display_server.wl_surface, scale);
|
||||
|
||||
gdk_surface_invalidate_rect (surface, NULL);
|
||||
@@ -579,33 +579,12 @@ gdk_wayland_surface_attach_image (GdkSurface *surface,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_surface_sync_offset (GdkSurface *surface)
|
||||
{
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
|
||||
if (wl_surface_get_version (impl->display_server.wl_surface) <
|
||||
WL_SURFACE_OFFSET_SINCE_VERSION)
|
||||
return;
|
||||
|
||||
if (impl->pending_buffer_offset_x == 0 &&
|
||||
impl->pending_buffer_offset_y == 0)
|
||||
return;
|
||||
|
||||
wl_surface_offset (impl->display_server.wl_surface,
|
||||
impl->pending_buffer_offset_x,
|
||||
impl->pending_buffer_offset_y);
|
||||
impl->pending_buffer_offset_x = 0;
|
||||
impl->pending_buffer_offset_y = 0;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_wayland_surface_sync (GdkSurface *surface)
|
||||
{
|
||||
gdk_wayland_surface_sync_shadow (surface);
|
||||
gdk_wayland_surface_sync_opaque_region (surface);
|
||||
gdk_wayland_surface_sync_input_region (surface);
|
||||
gdk_wayland_surface_sync_offset (surface);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
||||
@@ -1912,7 +1912,7 @@ drag_grab (GdkDrag *drag)
|
||||
root = GDK_DISPLAY_XROOTWIN (display);
|
||||
seat = gdk_device_get_seat (gdk_drag_get_device (drag));
|
||||
|
||||
capabilities = GDK_SEAT_CAPABILITY_ALL_POINTING;
|
||||
capabilities = GDK_SEAT_CAPABILITY_ALL_POINTING | GDK_SEAT_CAPABILITY_KEYBOARD;
|
||||
|
||||
cursor = gdk_drag_get_cursor (drag, x11_drag->current_action);
|
||||
g_set_object (&x11_drag->cursor, cursor);
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
|
||||
#include <gdk/gdkglcontextprivate.h>
|
||||
#include <gdk/gdkmemoryformatprivate.h>
|
||||
#include <gdk/gdkmemorytextureprivate.h>
|
||||
#include <gdk/gdkprofilerprivate.h>
|
||||
#include <gdk/gdktexturedownloaderprivate.h>
|
||||
#include <gsk/gskdebugprivate.h>
|
||||
#include <gsk/gskroundedrectprivate.h>
|
||||
|
||||
@@ -1359,7 +1359,8 @@ gsk_gl_command_queue_do_upload_texture (GskGLCommandQueue *self,
|
||||
GdkGLContext *context;
|
||||
const guchar *data;
|
||||
gsize stride;
|
||||
GdkMemoryTexture *memtex;
|
||||
GBytes *bytes;
|
||||
GdkTextureDownloader downloader;
|
||||
GdkMemoryFormat data_format;
|
||||
int width, height;
|
||||
GLenum gl_internalformat;
|
||||
@@ -1394,9 +1395,11 @@ gsk_gl_command_queue_do_upload_texture (GskGLCommandQueue *self,
|
||||
}
|
||||
}
|
||||
|
||||
memtex = gdk_memory_texture_from_texture (texture, data_format);
|
||||
data = gdk_memory_texture_get_data (memtex);
|
||||
stride = gdk_memory_texture_get_stride (memtex);
|
||||
gdk_texture_downloader_init (&downloader, texture);
|
||||
gdk_texture_downloader_set_format (&downloader, data_format);
|
||||
bytes = gdk_texture_downloader_download_bytes (&downloader, &stride);
|
||||
gdk_texture_downloader_finish (&downloader);
|
||||
data = g_bytes_get_data (bytes, NULL);
|
||||
bpp = gdk_memory_format_bytes_per_pixel (data_format);
|
||||
|
||||
glPixelStorei (GL_UNPACK_ALIGNMENT, gdk_memory_format_alignment (data_format));
|
||||
@@ -1426,7 +1429,7 @@ gsk_gl_command_queue_do_upload_texture (GskGLCommandQueue *self,
|
||||
}
|
||||
glPixelStorei (GL_UNPACK_ALIGNMENT, 4);
|
||||
|
||||
g_object_unref (memtex);
|
||||
g_bytes_unref (bytes);
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "gskgliconlibraryprivate.h"
|
||||
#include "gskglprogramprivate.h"
|
||||
#include "gskglshadowlibraryprivate.h"
|
||||
#include "gskgltextureprivate.h"
|
||||
#include "fp16private.h"
|
||||
|
||||
#include <gdk/gdkglcontextprivate.h>
|
||||
|
||||
@@ -62,7 +62,8 @@ GSK_GL_DEFINE_PROGRAM (linear_gradient,
|
||||
|
||||
GSK_GL_DEFINE_PROGRAM (mask,
|
||||
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("mask.glsl")),
|
||||
GSK_GL_ADD_UNIFORM (1, MASK_SOURCE, u_mask))
|
||||
GSK_GL_ADD_UNIFORM (1, MASK_SOURCE, u_mask)
|
||||
GSK_GL_ADD_UNIFORM (2, MASK_MODE, u_mode))
|
||||
|
||||
GSK_GL_DEFINE_PROGRAM (outset_shadow,
|
||||
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("outset_shadow.glsl")),
|
||||
|
||||
@@ -3278,8 +3278,8 @@ gsk_gl_render_job_visit_blend_node (GskGLRenderJob *job,
|
||||
}
|
||||
|
||||
static inline void
|
||||
gsk_gl_render_job_visit_mask_node (GskGLRenderJob *job,
|
||||
const GskRenderNode *node)
|
||||
gsk_gl_render_job_visit_mask_node (GskGLRenderJob *job,
|
||||
const GskRenderNode *node)
|
||||
{
|
||||
const GskRenderNode *source = gsk_mask_node_get_source (node);
|
||||
const GskRenderNode *mask = gsk_mask_node_get_mask (node);
|
||||
@@ -3293,6 +3293,7 @@ gsk_gl_render_job_visit_mask_node (GskGLRenderJob *job,
|
||||
mask_offscreen.bounds = &node->bounds;
|
||||
mask_offscreen.force_offscreen = TRUE;
|
||||
mask_offscreen.reset_clip = TRUE;
|
||||
mask_offscreen.do_not_cache = TRUE;
|
||||
|
||||
/* TODO: We create 2 textures here as big as the mask node, but both
|
||||
* nodes might be a lot smaller than that.
|
||||
@@ -3323,6 +3324,9 @@ gsk_gl_render_job_visit_mask_node (GskGLRenderJob *job,
|
||||
GL_TEXTURE_2D,
|
||||
GL_TEXTURE1,
|
||||
mask_offscreen.texture_id);
|
||||
gsk_gl_program_set_uniform1i (job->current_program,
|
||||
UNIFORM_MASK_MODE, 0,
|
||||
gsk_mask_node_get_mask_mode (node));
|
||||
gsk_gl_render_job_draw_offscreen_rect (job, &node->bounds);
|
||||
gsk_gl_render_job_end_draw (job);
|
||||
}
|
||||
@@ -3687,8 +3691,8 @@ gsk_gl_render_job_visit_texture_scale_node (GskGLRenderJob *job,
|
||||
gsk_gl_render_job_end_draw (job);
|
||||
}
|
||||
else
|
||||
{
|
||||
slice:
|
||||
{
|
||||
float min_x = bounds->origin.x;
|
||||
float min_y = bounds->origin.y;
|
||||
float max_x = min_x + bounds->size.width;
|
||||
|
||||
@@ -10,10 +10,24 @@ void main() {
|
||||
// FRAGMENT_SHADER:
|
||||
// mask.glsl
|
||||
|
||||
uniform int u_mode;
|
||||
uniform sampler2D u_mask;
|
||||
|
||||
void main() {
|
||||
vec4 source = GskTexture(u_source, vUv);
|
||||
vec4 mask = GskTexture(u_mask, vUv);
|
||||
gskSetOutputColor(vec4 (source * mask.a));
|
||||
float mask_value;
|
||||
|
||||
if (u_mode == 0)
|
||||
mask_value = mask.a;
|
||||
else if (u_mode == 1)
|
||||
mask_value = 1.0 - mask.a;
|
||||
else if (u_mode == 2)
|
||||
mask_value = (0.2126 * mask.r + 0.7152 * mask.g + 0.0722 * mask.b) * mask.a;
|
||||
else if (u_mode == 3)
|
||||
mask_value = 1.0 - (0.2126 * mask.r + 0.7152 * mask.g + 0.0722 * mask.b) * mask.a;
|
||||
else
|
||||
mask_value = 0.0;
|
||||
|
||||
gskSetOutputColor(vec4 (source * mask_value));
|
||||
}
|
||||
|
||||
+25
-5
@@ -35,7 +35,6 @@
|
||||
* @GSK_CONIC_GRADIENT_NODE: A node drawing a conic gradient
|
||||
* @GSK_BORDER_NODE: A node stroking a border around an area
|
||||
* @GSK_TEXTURE_NODE: A node drawing a `GdkTexture`
|
||||
* @GSK_TEXTURE_SCALE_NODE: A node drawing a `GdkTexture` scaled and filtered
|
||||
* @GSK_INSET_SHADOW_NODE: A node drawing an inset shadow
|
||||
* @GSK_OUTSET_SHADOW_NODE: A node drawing an outset shadow
|
||||
* @GSK_TRANSFORM_NODE: A node that renders its child after applying a matrix transform
|
||||
@@ -46,12 +45,13 @@
|
||||
* @GSK_ROUNDED_CLIP_NODE: A node that clips its child to a rounded rectangle
|
||||
* @GSK_SHADOW_NODE: A node that draws a shadow below its child
|
||||
* @GSK_BLEND_NODE: A node that blends two children together
|
||||
* @GSK_MASK_NODE: A node that masks one child with another
|
||||
* @GSK_CROSS_FADE_NODE: A node that cross-fades between two children
|
||||
* @GSK_TEXT_NODE: A node containing a glyph string
|
||||
* @GSK_BLUR_NODE: A node that applies a blur
|
||||
* @GSK_DEBUG_NODE: Debug information that does not affect the rendering
|
||||
* @GSK_GL_SHADER_NODE: A node that uses OpenGL fragment shaders to render
|
||||
* @GSK_TEXTURE_SCALE_NODE: A node drawing a `GdkTexture` scaled and filtered (Since: 4.10)
|
||||
* @GSK_MASK_NODE: A node that masks one child with another (Since: 4.10)
|
||||
|
||||
* The type of a node determines what the node is rendering.
|
||||
*/
|
||||
@@ -67,7 +67,6 @@ typedef enum {
|
||||
GSK_CONIC_GRADIENT_NODE,
|
||||
GSK_BORDER_NODE,
|
||||
GSK_TEXTURE_NODE,
|
||||
GSK_TEXTURE_SCALE_NODE,
|
||||
GSK_INSET_SHADOW_NODE,
|
||||
GSK_OUTSET_SHADOW_NODE,
|
||||
GSK_TRANSFORM_NODE,
|
||||
@@ -78,12 +77,13 @@ typedef enum {
|
||||
GSK_ROUNDED_CLIP_NODE,
|
||||
GSK_SHADOW_NODE,
|
||||
GSK_BLEND_NODE,
|
||||
GSK_MASK_NODE,
|
||||
GSK_CROSS_FADE_NODE,
|
||||
GSK_TEXT_NODE,
|
||||
GSK_BLUR_NODE,
|
||||
GSK_DEBUG_NODE,
|
||||
GSK_GL_SHADER_NODE
|
||||
GSK_GL_SHADER_NODE,
|
||||
GSK_TEXTURE_SCALE_NODE,
|
||||
GSK_MASK_NODE
|
||||
} GskRenderNodeType;
|
||||
|
||||
/**
|
||||
@@ -255,5 +255,25 @@ typedef enum
|
||||
GSK_GL_UNIFORM_TYPE_VEC4,
|
||||
} GskGLUniformType;
|
||||
|
||||
/**
|
||||
* GskMaskMode:
|
||||
* @GSK_MASK_MODE_ALPHA: Use the alpha channel of the mask
|
||||
* @GSK_MASK_MODE_INVERTED_ALPHA: Use the inverted alpha channel of the mask
|
||||
* @GSK_MASK_MODE_LUMINANCE: Use the luminance of the mask,
|
||||
* multiplied by mask alpha
|
||||
* @GSK_MASK_MODE_INVERTED_LUMINANCE: Use the inverted luminance of the mask,
|
||||
* multiplied by mask alpha
|
||||
*
|
||||
* The mask modes available for mask nodes.
|
||||
*
|
||||
* Since: 4.10
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GSK_MASK_MODE_ALPHA,
|
||||
GSK_MASK_MODE_INVERTED_ALPHA,
|
||||
GSK_MASK_MODE_LUMINANCE,
|
||||
GSK_MASK_MODE_INVERTED_LUMINANCE
|
||||
} GskMaskMode;
|
||||
|
||||
#endif /* __GSK_TYPES_H__ */
|
||||
|
||||
+4
-1
@@ -535,11 +535,14 @@ GDK_AVAILABLE_IN_4_10
|
||||
GType gsk_mask_node_get_type (void) G_GNUC_CONST;
|
||||
GDK_AVAILABLE_IN_4_10
|
||||
GskRenderNode * gsk_mask_node_new (GskRenderNode *source,
|
||||
GskRenderNode *mask);
|
||||
GskRenderNode *mask,
|
||||
GskMaskMode mask_mode);
|
||||
GDK_AVAILABLE_IN_4_10
|
||||
GskRenderNode * gsk_mask_node_get_source (const GskRenderNode *node);
|
||||
GDK_AVAILABLE_IN_4_10
|
||||
GskRenderNode * gsk_mask_node_get_mask (const GskRenderNode *node);
|
||||
GDK_AVAILABLE_IN_4_10
|
||||
GskMaskMode gsk_mask_node_get_mask_mode (const GskRenderNode *node);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gsk_gl_shader_node_get_type (void) G_GNUC_CONST;
|
||||
|
||||
+114
-29
@@ -1588,6 +1588,8 @@ gsk_texture_node_new (GdkTexture *texture,
|
||||
* GskTextureScaleNode:
|
||||
*
|
||||
* A render node for a `GdkTexture`.
|
||||
*
|
||||
* Since: 4.10
|
||||
*/
|
||||
struct _GskTextureScaleNode
|
||||
{
|
||||
@@ -1689,7 +1691,7 @@ gsk_texture_scale_node_diff (GskRenderNode *node1,
|
||||
|
||||
/**
|
||||
* gsk_texture_scale_node_get_texture:
|
||||
* @node: (type GskTextureNode): a `GskRenderNode` of type %GSK_TEXTURE_SCALE_NODE
|
||||
* @node: (type GskTextureScaleNode): a `GskRenderNode` of type %GSK_TEXTURE_SCALE_NODE
|
||||
*
|
||||
* Retrieves the `GdkTexture` used when creating this `GskRenderNode`.
|
||||
*
|
||||
@@ -1707,7 +1709,7 @@ gsk_texture_scale_node_get_texture (const GskRenderNode *node)
|
||||
|
||||
/**
|
||||
* gsk_texture_scale_node_get_filter:
|
||||
* @node: (type GskTextureNode): a `GskRenderNode` of type %GSK_TEXTURE_SCALE_NODE
|
||||
* @node: (type GskTextureScaleNode): a `GskRenderNode` of type %GSK_TEXTURE_SCALE_NODE
|
||||
*
|
||||
* Retrieves the `GskScalingFilter` used when creating this `GskRenderNode`.
|
||||
*
|
||||
@@ -3410,29 +3412,18 @@ gsk_color_matrix_node_finalize (GskRenderNode *node)
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_color_matrix_node_draw (GskRenderNode *node,
|
||||
cairo_t *cr)
|
||||
apply_color_matrix_to_pattern (cairo_pattern_t *pattern,
|
||||
const graphene_matrix_t *color_matrix,
|
||||
const graphene_vec4_t *color_offset,
|
||||
gboolean multiply_alpha)
|
||||
{
|
||||
GskColorMatrixNode *self = (GskColorMatrixNode *) node;
|
||||
cairo_pattern_t *pattern;
|
||||
cairo_surface_t *surface, *image_surface;
|
||||
graphene_vec4_t pixel;
|
||||
guint32* pixel_data;
|
||||
guchar *data;
|
||||
gsize x, y, width, height, stride;
|
||||
float alpha;
|
||||
graphene_vec4_t pixel;
|
||||
guint32* pixel_data;
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
/* clip so the push_group() creates a smaller surface */
|
||||
gsk_cairo_rectangle (cr, &node->bounds);
|
||||
cairo_clip (cr);
|
||||
|
||||
cairo_push_group (cr);
|
||||
|
||||
gsk_render_node_draw (self->child, cr);
|
||||
|
||||
pattern = cairo_pop_group (cr);
|
||||
cairo_pattern_get_surface (pattern, &surface);
|
||||
image_surface = cairo_surface_map_to_image (surface, NULL);
|
||||
|
||||
@@ -3459,12 +3450,20 @@ gsk_color_matrix_node_draw (GskRenderNode *node,
|
||||
((pixel_data[x] >> 8) & 0xFF) / (255.0 * alpha),
|
||||
( pixel_data[x] & 0xFF) / (255.0 * alpha),
|
||||
alpha);
|
||||
graphene_matrix_transform_vec4 (&self->color_matrix, &pixel, &pixel);
|
||||
graphene_matrix_transform_vec4 (color_matrix, &pixel, &pixel);
|
||||
}
|
||||
|
||||
graphene_vec4_add (&pixel, &self->color_offset, &pixel);
|
||||
if (multiply_alpha)
|
||||
graphene_vec4_init (&pixel,
|
||||
graphene_vec4_get_x (&pixel),
|
||||
graphene_vec4_get_y (&pixel),
|
||||
graphene_vec4_get_z (&pixel),
|
||||
alpha * graphene_vec4_get_w (&pixel));
|
||||
|
||||
graphene_vec4_add (&pixel, color_offset, &pixel);
|
||||
|
||||
alpha = graphene_vec4_get_w (&pixel);
|
||||
|
||||
if (alpha > 0.0)
|
||||
{
|
||||
alpha = MIN (alpha, 1.0);
|
||||
@@ -3483,6 +3482,28 @@ gsk_color_matrix_node_draw (GskRenderNode *node,
|
||||
|
||||
cairo_surface_mark_dirty (image_surface);
|
||||
cairo_surface_unmap_image (surface, image_surface);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_color_matrix_node_draw (GskRenderNode *node,
|
||||
cairo_t *cr)
|
||||
{
|
||||
GskColorMatrixNode *self = (GskColorMatrixNode *) node;
|
||||
cairo_pattern_t *pattern;
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
/* clip so the push_group() creates a smaller surface */
|
||||
gsk_cairo_rectangle (cr, &node->bounds);
|
||||
cairo_clip (cr);
|
||||
|
||||
cairo_push_group (cr);
|
||||
|
||||
gsk_render_node_draw (self->child, cr);
|
||||
|
||||
pattern = cairo_pop_group (cr);
|
||||
|
||||
apply_color_matrix_to_pattern (pattern, &self->color_matrix, &self->color_offset, FALSE);
|
||||
|
||||
cairo_set_source (cr, pattern);
|
||||
cairo_paint (cr);
|
||||
@@ -5202,6 +5223,7 @@ struct _GskMaskNode
|
||||
|
||||
GskRenderNode *mask;
|
||||
GskRenderNode *source;
|
||||
GskMaskMode mask_mode;
|
||||
};
|
||||
|
||||
static void
|
||||
@@ -5219,6 +5241,8 @@ gsk_mask_node_draw (GskRenderNode *node,
|
||||
{
|
||||
GskMaskNode *self = (GskMaskNode *) node;
|
||||
cairo_pattern_t *mask_pattern;
|
||||
graphene_matrix_t color_matrix;
|
||||
graphene_vec4_t color_offset;
|
||||
|
||||
cairo_push_group (cr);
|
||||
gsk_render_node_draw (self->source, cr);
|
||||
@@ -5228,6 +5252,41 @@ gsk_mask_node_draw (GskRenderNode *node,
|
||||
gsk_render_node_draw (self->mask, cr);
|
||||
mask_pattern = cairo_pop_group (cr);
|
||||
|
||||
switch (self->mask_mode)
|
||||
{
|
||||
case GSK_MASK_MODE_ALPHA:
|
||||
break;
|
||||
case GSK_MASK_MODE_INVERTED_ALPHA:
|
||||
graphene_matrix_init_from_float (&color_matrix, (float[]){ 1, 0, 0, 0,
|
||||
0, 1, 0, 0,
|
||||
0, 0, 1, 0,
|
||||
0, 0, 0, -1 });
|
||||
graphene_vec4_init (&color_offset, 0, 0, 0, 1);
|
||||
apply_color_matrix_to_pattern (mask_pattern, &color_matrix, &color_offset, FALSE);
|
||||
break;
|
||||
case GSK_MASK_MODE_LUMINANCE:
|
||||
graphene_matrix_init_from_float (&color_matrix, (float[]){ 1, 0, 0, 0.2126,
|
||||
0, 1, 0, 0.7152,
|
||||
0, 0, 1, 0.0722,
|
||||
0, 0, 0, 0 });
|
||||
graphene_vec4_init (&color_offset, 0, 0, 0, 0);
|
||||
apply_color_matrix_to_pattern (mask_pattern, &color_matrix, &color_offset, TRUE);
|
||||
break;
|
||||
case GSK_MASK_MODE_INVERTED_LUMINANCE:
|
||||
graphene_matrix_init_from_float (&color_matrix, (float[]){ 1, 0, 0, -0.2126,
|
||||
0, 1, 0, -0.7152,
|
||||
0, 0, 1, -0.0722,
|
||||
0, 0, 0, 0 });
|
||||
graphene_vec4_init (&color_offset, 0, 0, 0, 1);
|
||||
apply_color_matrix_to_pattern (mask_pattern, &color_matrix, &color_offset, TRUE);
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
gsk_cairo_rectangle (cr, &node->bounds);
|
||||
cairo_clip (cr);
|
||||
|
||||
cairo_mask (cr, mask_pattern);
|
||||
}
|
||||
|
||||
@@ -5245,11 +5304,15 @@ gsk_mask_node_diff (GskRenderNode *node1,
|
||||
|
||||
/**
|
||||
* gsk_mask_node_new:
|
||||
* @source: The bottom node to be drawn
|
||||
* @mask: The node to be blended onto the @bottom node
|
||||
* @source: The source node to be drawn
|
||||
* @mask: The node to be used as mask
|
||||
* @mask_mode: The mask mode to use
|
||||
*
|
||||
* Creates a `GskRenderNode` that will use @blend_mode to blend the @top
|
||||
* node onto the @bottom node.
|
||||
* Creates a `GskRenderNode` that will mask a given node by another.
|
||||
*
|
||||
* The @mask_mode determines how the 'mask values' are derived from
|
||||
* the colors of the @mask. Applying the mask consists of multiplying
|
||||
* the 'mask value' with the alpha of the source.
|
||||
*
|
||||
* Returns: (transfer full) (type GskMaskNode): A new `GskRenderNode`
|
||||
*
|
||||
@@ -5257,7 +5320,8 @@ gsk_mask_node_diff (GskRenderNode *node1,
|
||||
*/
|
||||
GskRenderNode *
|
||||
gsk_mask_node_new (GskRenderNode *source,
|
||||
GskRenderNode *mask)
|
||||
GskRenderNode *mask,
|
||||
GskMaskMode mask_mode)
|
||||
{
|
||||
GskMaskNode *self;
|
||||
|
||||
@@ -5267,15 +5331,18 @@ gsk_mask_node_new (GskRenderNode *source,
|
||||
self = gsk_render_node_alloc (GSK_MASK_NODE);
|
||||
self->source = gsk_render_node_ref (source);
|
||||
self->mask = gsk_render_node_ref (mask);
|
||||
self->mask_mode = mask_mode;
|
||||
|
||||
graphene_rect_union (&source->bounds, &mask->bounds, &self->render_node.bounds);
|
||||
self->render_node.bounds = source->bounds;
|
||||
|
||||
self->render_node.prefers_high_depth = gsk_render_node_prefers_high_depth (source);
|
||||
|
||||
return &self->render_node;
|
||||
}
|
||||
|
||||
/**
|
||||
* gsk_mask_node_get_source:
|
||||
* @node: (type GskBlendNode): a mask `GskRenderNode`
|
||||
* @node: (type GskMaskNode): a mask `GskRenderNode`
|
||||
*
|
||||
* Retrieves the source `GskRenderNode` child of the @node.
|
||||
*
|
||||
@@ -5295,7 +5362,7 @@ gsk_mask_node_get_source (const GskRenderNode *node)
|
||||
|
||||
/**
|
||||
* gsk_mask_node_get_mask:
|
||||
* @node: (type GskBlendNode): a mask `GskRenderNode`
|
||||
* @node: (type GskMaskNode): a mask `GskRenderNode`
|
||||
*
|
||||
* Retrieves the mask `GskRenderNode` child of the @node.
|
||||
*
|
||||
@@ -5313,6 +5380,24 @@ gsk_mask_node_get_mask (const GskRenderNode *node)
|
||||
return self->mask;
|
||||
}
|
||||
|
||||
/**
|
||||
* gsk_mask_node_get_mask_mode:
|
||||
* @node: (type GskMaskNode): a blending `GskRenderNode`
|
||||
*
|
||||
* Retrieves the mask mode used by @node.
|
||||
*
|
||||
* Returns: the mask mode
|
||||
*
|
||||
* Since: 4.10
|
||||
*/
|
||||
GskMaskMode
|
||||
gsk_mask_node_get_mask_mode (const GskRenderNode *node)
|
||||
{
|
||||
const GskMaskNode *self = (const GskMaskNode *) node;
|
||||
|
||||
return self->mask_mode;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ GSK_DEBUG_NODE */
|
||||
|
||||
|
||||
+70
-10
@@ -623,6 +623,8 @@ parse_scaling_filter (GtkCssParser *parser,
|
||||
}
|
||||
}
|
||||
|
||||
gtk_css_parser_error_syntax (parser, "Not a valid scaling filter.");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -649,6 +651,18 @@ static const struct
|
||||
{ GSK_BLEND_MODE_LUMINOSITY, "luminosity" }
|
||||
};
|
||||
|
||||
static const char *
|
||||
get_blend_mode_name (GskBlendMode mode)
|
||||
{
|
||||
for (unsigned int i = 0; i < G_N_ELEMENTS (blend_modes); i++)
|
||||
{
|
||||
if (blend_modes[i].mode == mode)
|
||||
return blend_modes[i].name;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
parse_blend_mode (GtkCssParser *parser,
|
||||
gpointer out_mode)
|
||||
@@ -664,6 +678,51 @@ parse_blend_mode (GtkCssParser *parser,
|
||||
}
|
||||
}
|
||||
|
||||
gtk_css_parser_error_syntax (parser, "Not a valid blend mode.");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static const struct
|
||||
{
|
||||
GskMaskMode mode;
|
||||
const char *name;
|
||||
} mask_modes[] = {
|
||||
{ GSK_MASK_MODE_ALPHA, "alpha" },
|
||||
{ GSK_MASK_MODE_INVERTED_ALPHA, "inverted-alpha" },
|
||||
{ GSK_MASK_MODE_LUMINANCE, "luminance" },
|
||||
{ GSK_MASK_MODE_INVERTED_LUMINANCE, "inverted-luminance" },
|
||||
};
|
||||
|
||||
static const char *
|
||||
get_mask_mode_name (GskMaskMode mode)
|
||||
{
|
||||
for (unsigned int i = 0; i < G_N_ELEMENTS (mask_modes); i++)
|
||||
{
|
||||
if (mask_modes[i].mode == mode)
|
||||
return mask_modes[i].name;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
parse_mask_mode (GtkCssParser *parser,
|
||||
gpointer out_mode)
|
||||
{
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (mask_modes); i++)
|
||||
{
|
||||
if (gtk_css_parser_try_ident (parser, mask_modes[i].name))
|
||||
{
|
||||
*(GskMaskMode *) out_mode = mask_modes[i].mode;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
gtk_css_parser_error_syntax (parser, "Not a valid mask mode.");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -1381,7 +1440,9 @@ parse_mask_node (GtkCssParser *parser)
|
||||
{
|
||||
GskRenderNode *source = NULL;
|
||||
GskRenderNode *mask = NULL;
|
||||
GskMaskMode mode = GSK_MASK_MODE_ALPHA;
|
||||
const Declaration declarations[] = {
|
||||
{ "mode", parse_mask_mode, NULL, &mode },
|
||||
{ "source", parse_node, clear_node, &source },
|
||||
{ "mask", parse_node, clear_node, &mask },
|
||||
};
|
||||
@@ -1393,7 +1454,7 @@ parse_mask_node (GtkCssParser *parser)
|
||||
if (mask == NULL)
|
||||
mask = gsk_color_node_new (&GDK_RGBA("AAFF00"), &GRAPHENE_RECT_INIT (0, 0, 50, 50));
|
||||
|
||||
result = gsk_mask_node_new (source, mask);
|
||||
result = gsk_mask_node_new (source, mask, mode);
|
||||
|
||||
gsk_render_node_unref (source);
|
||||
gsk_render_node_unref (mask);
|
||||
@@ -3103,21 +3164,13 @@ render_node_print (Printer *p,
|
||||
case GSK_BLEND_NODE:
|
||||
{
|
||||
GskBlendMode mode = gsk_blend_node_get_blend_mode (node);
|
||||
guint i;
|
||||
|
||||
start_node (p, "blend");
|
||||
|
||||
if (mode != GSK_BLEND_MODE_DEFAULT)
|
||||
{
|
||||
_indent (p);
|
||||
for (i = 0; i < G_N_ELEMENTS (blend_modes); i++)
|
||||
{
|
||||
if (blend_modes[i].mode == mode)
|
||||
{
|
||||
g_string_append_printf (p->str, "mode: %s;\n", blend_modes[i].name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
g_string_append_printf (p->str, "mode: %s;\n", get_blend_mode_name (mode));
|
||||
}
|
||||
append_node_param (p, "bottom", gsk_blend_node_get_bottom_child (node));
|
||||
append_node_param (p, "top", gsk_blend_node_get_top_child (node));
|
||||
@@ -3128,8 +3181,15 @@ render_node_print (Printer *p,
|
||||
|
||||
case GSK_MASK_NODE:
|
||||
{
|
||||
GskMaskMode mode = gsk_mask_node_get_mask_mode (node);
|
||||
|
||||
start_node (p, "mask");
|
||||
|
||||
if (mode != GSK_MASK_MODE_ALPHA)
|
||||
{
|
||||
_indent (p);
|
||||
g_string_append_printf (p->str, "mode: %s;\n", get_mask_mode_name (mode));
|
||||
}
|
||||
append_node_param (p, "source", gsk_mask_node_get_source (node));
|
||||
append_node_param (p, "mask", gsk_mask_node_get_mask (node));
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ typedef struct _GskRenderNodeClass GskRenderNodeClass;
|
||||
* We don't add an "n-types" value to avoid having to handle
|
||||
* it in every single switch.
|
||||
*/
|
||||
#define GSK_RENDER_NODE_TYPE_N_TYPES (GSK_GL_SHADER_NODE + 1)
|
||||
#define GSK_RENDER_NODE_TYPE_N_TYPES (GSK_MASK_NODE + 1)
|
||||
|
||||
extern GType gsk_render_node_types[];
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "gtkcellrendererpixbuf.h"
|
||||
|
||||
#include "gtkiconhelperprivate.h"
|
||||
#include "gtkicontheme.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtksnapshot.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
|
||||
@@ -36,22 +36,15 @@
|
||||
#include "gtkbutton.h"
|
||||
#include "gtkgrid.h"
|
||||
#include "gtkbox.h"
|
||||
#include "gtkicontheme.h"
|
||||
#include "gtkimage.h"
|
||||
#include "gtklabel.h"
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gtkstack.h"
|
||||
#include "gtkorientable.h"
|
||||
#include "gtkscrolledwindow.h"
|
||||
#include "gtktextview.h"
|
||||
#include "gtkmain.h"
|
||||
#include "gtktogglebutton.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkstack.h"
|
||||
#include "gtkstackswitcher.h"
|
||||
#include "gtksettings.h"
|
||||
#include "gtkurilauncher.h"
|
||||
#include "gtkheaderbar.h"
|
||||
#include "gtkprivate.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gtkeventcontrollermotion.h"
|
||||
|
||||
+93
-2
@@ -45,6 +45,11 @@
|
||||
* [vfunc@Gtk.Accessible.get_next_accessible_sibling] virtual functions.
|
||||
* Note that you can not create a top-level accessible object as of now,
|
||||
* which means that you must always have a parent accessible object.
|
||||
* Also note that when an accessible object does not correspond to a widget,
|
||||
* and it has children, whose implementation you don't control,
|
||||
* it is necessary to ensure the correct shape of the a11y tree
|
||||
* by calling [method@Gtk.Accessible.set_accessible_parent] and
|
||||
* updating the sibling by [method@Gtk.Accessible.update_next_accessible_sibling].
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
@@ -89,6 +94,8 @@ gtk_accessible_default_init (GtkAccessibleInterface *iface)
|
||||
* Retrieves the `GtkATContext` for the given `GtkAccessible`.
|
||||
*
|
||||
* Returns: (transfer none): the `GtkATContext`
|
||||
*
|
||||
* Since: 4.10
|
||||
*/
|
||||
GtkATContext *
|
||||
gtk_accessible_get_at_context (GtkAccessible *self)
|
||||
@@ -115,7 +122,85 @@ gtk_accessible_get_accessible_parent (GtkAccessible *self)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_ACCESSIBLE (self), NULL);
|
||||
|
||||
return GTK_ACCESSIBLE_GET_IFACE (self)->get_accessible_parent (self);
|
||||
GtkATContext *context;
|
||||
GtkAccessible *parent = NULL;
|
||||
|
||||
context = gtk_accessible_get_at_context (self);
|
||||
if (context != NULL)
|
||||
parent = gtk_at_context_get_accessible_parent (context);
|
||||
|
||||
if (parent != NULL)
|
||||
return parent;
|
||||
else
|
||||
return GTK_ACCESSIBLE_GET_IFACE (self)->get_accessible_parent (self);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_accessible_set_accessible_parent:
|
||||
* @self: an accessible object
|
||||
* @parent: (nullable): the parent accessible object
|
||||
* @next_sibling: (nullable): the sibling accessible object
|
||||
*
|
||||
* Sets the parent and sibling of an accessible object.
|
||||
*
|
||||
* This function is meant to be used by accessible implementations that are
|
||||
* not part of the widget hierarchy, and but act as a logical bridge between
|
||||
* widgets. For instance, if a widget creates an object that holds metadata
|
||||
* for each child, and you want that object to implement the `GtkAccessible`
|
||||
* interface, you will use this function to ensure that the parent of each
|
||||
* child widget is the metadata object, and the parent of each metadata
|
||||
* object is the container widget.
|
||||
*
|
||||
* Since: 4.10
|
||||
*/
|
||||
void
|
||||
gtk_accessible_set_accessible_parent (GtkAccessible *self,
|
||||
GtkAccessible *parent,
|
||||
GtkAccessible *next_sibling)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_ACCESSIBLE (self));
|
||||
g_return_if_fail (parent == NULL || GTK_IS_ACCESSIBLE (parent));
|
||||
g_return_if_fail (next_sibling == NULL || GTK_IS_ACCESSIBLE (parent));
|
||||
GtkATContext *context;
|
||||
|
||||
context = gtk_accessible_get_at_context (self);
|
||||
if (context != NULL)
|
||||
{
|
||||
gtk_at_context_set_accessible_parent (context, parent);
|
||||
gtk_at_context_set_next_accessible_sibling (context, next_sibling);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_accessible_update_next_accessible_sibling:
|
||||
* @self: a `GtkAccessible`
|
||||
* @new_sibling: (nullable): the new next accessible sibling to set
|
||||
*
|
||||
* Updates the next accessible sibling of @self.
|
||||
* That might be useful when a new child of a custom `GtkAccessible`
|
||||
* is created, and it needs to be linked to a previous child.
|
||||
*
|
||||
* Since: 4.10
|
||||
*/
|
||||
void
|
||||
gtk_accessible_update_next_accessible_sibling (GtkAccessible *self,
|
||||
GtkAccessible *new_sibling)
|
||||
{
|
||||
GtkATContext *context;
|
||||
|
||||
g_return_if_fail (GTK_IS_ACCESSIBLE (self));
|
||||
|
||||
context = gtk_accessible_get_at_context (self);
|
||||
if (!context)
|
||||
return;
|
||||
|
||||
if (gtk_at_context_get_accessible_parent (context) == NULL)
|
||||
{
|
||||
g_critical ("Failed to update next accessible sibling: no parent accessible set for this accessible");
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_at_context_set_next_accessible_sibling (context, new_sibling);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -151,7 +236,13 @@ gtk_accessible_get_next_accessible_sibling (GtkAccessible *self)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_ACCESSIBLE (self), NULL);
|
||||
|
||||
return GTK_ACCESSIBLE_GET_IFACE (self)->get_next_accessible_sibling (self);
|
||||
GtkATContext *context;
|
||||
|
||||
context = gtk_accessible_get_at_context (self);
|
||||
if (context != NULL && gtk_at_context_get_accessible_parent (context) != NULL)
|
||||
return gtk_at_context_get_next_accessible_sibling (context);
|
||||
else
|
||||
return GTK_ACCESSIBLE_GET_IFACE (self)->get_next_accessible_sibling (self);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -164,11 +164,20 @@ gboolean gtk_accessible_get_platform_state (GtkAccessible *self,
|
||||
GDK_AVAILABLE_IN_4_10
|
||||
GtkAccessible * gtk_accessible_get_accessible_parent (GtkAccessible *self);
|
||||
|
||||
GDK_AVAILABLE_IN_4_10
|
||||
void gtk_accessible_set_accessible_parent (GtkAccessible *self,
|
||||
GtkAccessible *parent,
|
||||
GtkAccessible *next_sibling);
|
||||
|
||||
GDK_AVAILABLE_IN_4_10
|
||||
GtkAccessible * gtk_accessible_get_first_accessible_child (GtkAccessible *self);
|
||||
|
||||
GDK_AVAILABLE_IN_4_10
|
||||
GtkAccessible * gtk_accessible_get_next_accessible_sibling (GtkAccessible *self);
|
||||
GDK_AVAILABLE_IN_4_10
|
||||
void gtk_accessible_update_next_accessible_sibling (GtkAccessible *self,
|
||||
GtkAccessible *new_sibling);
|
||||
|
||||
|
||||
GDK_AVAILABLE_IN_4_10
|
||||
gboolean gtk_accessible_get_bounds (GtkAccessible *self,
|
||||
|
||||
@@ -23,10 +23,6 @@
|
||||
#include "gtkapplication.h"
|
||||
#include "gdkprofilerprivate.h"
|
||||
|
||||
#ifdef G_OS_UNIX
|
||||
#include <gio/gunixfdlist.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
@@ -36,10 +32,8 @@
|
||||
#include "gtkapplicationprivate.h"
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gtkmain.h"
|
||||
#include "gtkrecentmanager.h"
|
||||
#include "gtkicontheme.h"
|
||||
#include "gtkbuilder.h"
|
||||
#include "gtkshortcutswindow.h"
|
||||
#include "gtkprivate.h"
|
||||
|
||||
/* NB: please do not add backend-specific GDK headers here. This should
|
||||
|
||||
@@ -24,16 +24,11 @@
|
||||
#include "gtkapplicationprivate.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "gtkwindowprivate.h"
|
||||
#include "gtkheaderbar.h"
|
||||
#include "gtkpopovermenubar.h"
|
||||
#include "gtksettings.h"
|
||||
#include "gtkshortcutswindowprivate.h"
|
||||
#include "gtktooltipprivate.h"
|
||||
|
||||
#if defined(HAVE_GIO_UNIX) && !defined(__APPLE__)
|
||||
#include <gio/gdesktopappinfo.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* GtkApplicationWindow:
|
||||
*
|
||||
|
||||
@@ -447,6 +447,70 @@ gtk_at_context_get_accessible_role (GtkATContext *self)
|
||||
return self->accessible_role;
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gtk_at_context_get_accessible_parent:
|
||||
* @self: a `GtkAtContext`
|
||||
*
|
||||
* Retrieves the parent accessible object of the given `GtkAtContext`.
|
||||
*
|
||||
* Returns: (nullable) (transfer none): the parent accessible object, or `NULL` if not set.
|
||||
*/
|
||||
GtkAccessible *
|
||||
gtk_at_context_get_accessible_parent (GtkATContext *self)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_AT_CONTEXT (self), NULL);
|
||||
|
||||
return self->accessible_parent;
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gtk_at_context_set_accessible_parent:
|
||||
* @self: a `GtkAtContext`
|
||||
* @parent: the parent `GtkAccessible` to set
|
||||
*
|
||||
* Sets the parent accessible object of the given `GtkAtContext`.
|
||||
*/
|
||||
void
|
||||
gtk_at_context_set_accessible_parent (GtkATContext *self,
|
||||
GtkAccessible *parent)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_AT_CONTEXT (self));
|
||||
|
||||
g_set_object (&self->accessible_parent, parent);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gtk_at_context_get_next_accessible_sibling:
|
||||
* @self: a `GtkAtContext`
|
||||
*
|
||||
* Retrieves the next accessible sibling of the given `GtkAtContext`.
|
||||
*
|
||||
* Returns: (nullable) (transfer none): the next accessible sibling.
|
||||
*/
|
||||
GtkAccessible *
|
||||
gtk_at_context_get_next_accessible_sibling (GtkATContext *self)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_AT_CONTEXT (self), NULL);
|
||||
|
||||
return self->next_accessible_sibling;
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gtk_at_context_set_next_accessible_sibling:
|
||||
* @self: a `GtkAtContext`
|
||||
* @sibling: (nullable): the next accessible sibling
|
||||
*
|
||||
* Sets the next accessible sibling object of the given `GtkAtContext`.
|
||||
*/
|
||||
void
|
||||
gtk_at_context_set_next_accessible_sibling (GtkATContext *self,
|
||||
GtkAccessible *sibling)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_AT_CONTEXT (self));
|
||||
|
||||
g_set_object (&self->next_accessible_sibling, sibling);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gtk_at_context_set_display:
|
||||
* @self: a `GtkATContext`
|
||||
|
||||
@@ -87,6 +87,8 @@ struct _GtkATContext
|
||||
|
||||
GtkAccessibleRole accessible_role;
|
||||
GtkAccessible *accessible;
|
||||
GtkAccessible *accessible_parent;
|
||||
GtkAccessible *next_accessible_sibling;
|
||||
GdkDisplay *display;
|
||||
|
||||
GtkAccessibleAttributeSet *states;
|
||||
@@ -179,4 +181,15 @@ const char * gtk_accessible_property_get_attribute_name (GtkAccessiblePr
|
||||
const char * gtk_accessible_relation_get_attribute_name (GtkAccessibleRelation relation);
|
||||
const char * gtk_accessible_state_get_attribute_name (GtkAccessibleState state);
|
||||
|
||||
GtkAccessible *
|
||||
gtk_at_context_get_accessible_parent (GtkATContext *self);
|
||||
void
|
||||
gtk_at_context_set_accessible_parent (GtkATContext *self,
|
||||
GtkAccessible *parent);
|
||||
GtkAccessible *
|
||||
gtk_at_context_get_next_accessible_sibling (GtkATContext *self);
|
||||
void
|
||||
gtk_at_context_set_next_accessible_sibling (GtkATContext *self,
|
||||
GtkAccessible *sibling);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -67,7 +67,6 @@
|
||||
#include "gtkorientable.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtksizerequest.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
|
||||
|
||||
|
||||
@@ -216,13 +216,10 @@
|
||||
#include "gtkdebug.h"
|
||||
#include "gtkexpression.h"
|
||||
#include "gtkmain.h"
|
||||
#include "gtkicontheme.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkshortcutactionprivate.h"
|
||||
#include "gtkshortcuttrigger.h"
|
||||
#include "gtktestutils.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkicontheme.h"
|
||||
#include "gtkiconthemeprivate.h"
|
||||
#include "gtkdebug.h"
|
||||
|
||||
|
||||
+1
-6
@@ -69,7 +69,6 @@
|
||||
#include "gtkbinlayout.h"
|
||||
#include "gtkimage.h"
|
||||
#include "gtklabel.h"
|
||||
#include "gtkmain.h"
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
@@ -639,7 +638,7 @@ gtk_button_new_with_label (const char *label)
|
||||
|
||||
/**
|
||||
* gtk_button_new_from_icon_name:
|
||||
* @icon_name: (nullable): an icon name
|
||||
* @icon_name: an icon name
|
||||
*
|
||||
* Creates a new button containing an icon from the current icon theme.
|
||||
*
|
||||
@@ -969,10 +968,6 @@ gtk_button_set_icon_name (GtkButton *button,
|
||||
gtk_image_set_from_icon_name (GTK_IMAGE (priv->child), icon_name);
|
||||
}
|
||||
|
||||
gtk_accessible_update_relation (GTK_ACCESSIBLE (button),
|
||||
GTK_ACCESSIBLE_RELATION_LABELLED_BY, priv->child, NULL,
|
||||
-1);
|
||||
|
||||
gtk_button_set_child_type (button, ICON_CHILD);
|
||||
g_object_notify_by_pspec (G_OBJECT (button), props[PROP_ICON_NAME]);
|
||||
}
|
||||
|
||||
@@ -114,7 +114,6 @@
|
||||
#include "gtkeventcontrollerfocus.h"
|
||||
#include "gtkdragsource.h"
|
||||
#include "gtknative.h"
|
||||
#include "gtkicontheme.h"
|
||||
#include "gtkdragicon.h"
|
||||
#include "gtkbutton.h"
|
||||
#include "gtkbox.h"
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include "gtkactionhelperprivate.h"
|
||||
#include "gtkboxlayout.h"
|
||||
#include "gtkbuiltiniconprivate.h"
|
||||
#include "gtkcssnumbervalueprivate.h"
|
||||
#include "gtkgestureclick.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gtklabel.h"
|
||||
@@ -37,7 +36,6 @@
|
||||
#include "gtkshortcuttrigger.h"
|
||||
#include "gtkcssnodeprivate.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "gtkmodelbuttonprivate.h"
|
||||
|
||||
/**
|
||||
* GtkCheckButton:
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include "gtkgesturelongpress.h"
|
||||
#include "gtkgestureclick.h"
|
||||
#include "gtkgesturesingle.h"
|
||||
#include "gtkicontheme.h"
|
||||
#include "gtkimage.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gtkmain.h"
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "gtkcssimageprivate.h"
|
||||
#include "gtkcsspalettevalueprivate.h"
|
||||
#include "gtkcsscolorvalueprivate.h"
|
||||
#include "gtkiconthemeprivate.h"
|
||||
#include "gdkpixbufutilsprivate.h"
|
||||
|
||||
#include "gtkstyleproviderprivate.h"
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "gtkdragicon.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gtkicontheme.h"
|
||||
#include "gtkpicture.h"
|
||||
#include "gtksettingsprivate.h"
|
||||
#include "gtkgesturesingle.h"
|
||||
|
||||
@@ -32,8 +32,6 @@
|
||||
|
||||
#include "gtkaccessibleprivate.h"
|
||||
#include "gtkadjustment.h"
|
||||
#include "gtkbox.h"
|
||||
#include "gtkbutton.h"
|
||||
#include "deprecated/gtkcelleditable.h"
|
||||
#include "gtkdebug.h"
|
||||
#include "gtkeditable.h"
|
||||
@@ -41,25 +39,19 @@
|
||||
#include "gtkemojicompletion.h"
|
||||
#include "gtkentrybuffer.h"
|
||||
#include "gtkgesturedrag.h"
|
||||
#include "gtkimageprivate.h"
|
||||
#include "gtkimcontextsimple.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gtklabel.h"
|
||||
#include "gtkmain.h"
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gtkpangoprivate.h"
|
||||
#include "gtkpopover.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkprogressbar.h"
|
||||
#include "gtksettings.h"
|
||||
#include "gtksnapshot.h"
|
||||
#include "gtktextprivate.h"
|
||||
#include "gtktexthandleprivate.h"
|
||||
#include "gtktextutilprivate.h"
|
||||
#include "gtktooltip.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "gtkwindow.h"
|
||||
#include "gtknative.h"
|
||||
#include "gtkgestureclick.h"
|
||||
#include "gtkdragsourceprivate.h"
|
||||
|
||||
@@ -60,10 +60,8 @@
|
||||
#include "gtksizegroup.h"
|
||||
#include "gtksizerequest.h"
|
||||
#include "gtkstack.h"
|
||||
#include "gtktooltip.h"
|
||||
#include "gtkbox.h"
|
||||
#include "gtkcheckbutton.h"
|
||||
#include "gtkwindowgroup.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gtkfilelauncher.h"
|
||||
#include "gtkmain.h"
|
||||
@@ -71,8 +69,6 @@
|
||||
#include "gtkpopover.h"
|
||||
#include "gtkrevealer.h"
|
||||
#include "gtkspinner.h"
|
||||
#include "gtkseparator.h"
|
||||
#include "gtkmodelbuttonprivate.h"
|
||||
#include "gtkeventcontrollerkey.h"
|
||||
#include "gtkdebug.h"
|
||||
#include "gtkfilechoosererrorstackprivate.h"
|
||||
@@ -86,7 +82,6 @@
|
||||
#include "gtkshortcuttrigger.h"
|
||||
#include "gtkshortcutaction.h"
|
||||
#include "gtkshortcut.h"
|
||||
#include "gtkstringlist.h"
|
||||
#include "gtkfilterlistmodel.h"
|
||||
#include "gtkcustomfilter.h"
|
||||
#include "gtkcustomsorter.h"
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include "deprecated/gtkfontchooserwidget.h"
|
||||
#include "gtkfontchooserwidgetprivate.h"
|
||||
#include "gtkfontchooserutils.h"
|
||||
#include "gtkbox.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gtkbuildable.h"
|
||||
#include "gtkprivate.h"
|
||||
|
||||
@@ -919,6 +919,7 @@ gtk_font_chooser_widget_class_init (GtkFontChooserWidgetClass *klass)
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkFontChooserWidget, selection);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkFontChooserWidget, custom_filter);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkFontChooserWidget, user_filter);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkFontChooserWidget, multi_filter);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkFontChooserWidget, preview);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkFontChooserWidget, preview2);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkFontChooserWidget, size_label);
|
||||
|
||||
@@ -223,8 +223,8 @@ gtk_gesture_drag_new (void)
|
||||
/**
|
||||
* gtk_gesture_drag_get_start_point:
|
||||
* @gesture: a `GtkGesture`
|
||||
* @x: (out) (nullable): X coordinate for the drag start point
|
||||
* @y: (out) (nullable): Y coordinate for the drag start point
|
||||
* @x: (out) (optional): X coordinate for the drag start point
|
||||
* @y: (out) (optional): Y coordinate for the drag start point
|
||||
*
|
||||
* Gets the point where the drag started.
|
||||
*
|
||||
@@ -263,8 +263,8 @@ gtk_gesture_drag_get_start_point (GtkGestureDrag *gesture,
|
||||
/**
|
||||
* gtk_gesture_drag_get_offset:
|
||||
* @gesture: a `GtkGesture`
|
||||
* @x: (out) (nullable): X offset for the current point
|
||||
* @y: (out) (nullable): Y offset for the current point
|
||||
* @x: (out) (optional): X offset for the current point
|
||||
* @y: (out) (optional): Y offset for the current point
|
||||
*
|
||||
* Gets the offset from the start point.
|
||||
*
|
||||
|
||||
@@ -26,9 +26,7 @@
|
||||
#include "gtkbuildable.h"
|
||||
#include "gtkcenterbox.h"
|
||||
#include "gtklabel.h"
|
||||
#include "gtknative.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtksizerequest.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "gtkwindowcontrols.h"
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include "gtkimageprivate.h"
|
||||
|
||||
#include "gtkiconhelperprivate.h"
|
||||
#include "gtkicontheme.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtksnapshot.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
|
||||
+3
-3
@@ -606,9 +606,9 @@ gtk_list_view_size_allocate (GtkWidget *widget,
|
||||
}
|
||||
|
||||
/* step 1: determine width of the list */
|
||||
gtk_widget_measure (widget, opposite_orientation,
|
||||
-1,
|
||||
&min, &nat, NULL, NULL);
|
||||
gtk_list_view_measure_across (widget, opposite_orientation,
|
||||
-1,
|
||||
&min, &nat);
|
||||
self->list_width = orientation == GTK_ORIENTATION_VERTICAL ? width : height;
|
||||
if (opposite_scroll_policy == GTK_SCROLL_MINIMUM)
|
||||
self->list_width = MAX (min, self->list_width);
|
||||
|
||||
@@ -52,7 +52,6 @@
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
#include "gtkbox.h"
|
||||
#include "gtkdebug.h"
|
||||
#include "gtkdropprivate.h"
|
||||
#include "gtkmain.h"
|
||||
@@ -60,7 +59,6 @@
|
||||
#include "gtkmodulesprivate.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkrecentmanager.h"
|
||||
#include "gtksettingsprivate.h"
|
||||
#include "gtktooltipprivate.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "gtkwindowprivate.h"
|
||||
|
||||
@@ -150,6 +150,7 @@ enum
|
||||
PROP_HAS_FRAME,
|
||||
PROP_PRIMARY,
|
||||
PROP_CHILD,
|
||||
PROP_ACTIVE,
|
||||
LAST_PROP
|
||||
};
|
||||
|
||||
@@ -208,6 +209,9 @@ gtk_menu_button_set_property (GObject *object,
|
||||
case PROP_CHILD:
|
||||
gtk_menu_button_set_child (self, g_value_get_object (value));
|
||||
break;
|
||||
case PROP_ACTIVE:
|
||||
gtk_menu_button_set_active (self, g_value_get_boolean (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
}
|
||||
@@ -253,6 +257,9 @@ gtk_menu_button_get_property (GObject *object,
|
||||
case PROP_CHILD:
|
||||
g_value_set_object (value, gtk_menu_button_get_child (self));
|
||||
break;
|
||||
case PROP_ACTIVE:
|
||||
g_value_set_boolean (value, gtk_menu_button_get_active (self));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
}
|
||||
@@ -314,6 +321,8 @@ gtk_menu_button_toggled (GtkMenuButton *self)
|
||||
GTK_ACCESSIBLE_STATE_EXPANDED);
|
||||
}
|
||||
}
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), menu_button_props[PROP_ACTIVE]);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -513,6 +522,18 @@ gtk_menu_button_class_init (GtkMenuButtonClass *klass)
|
||||
GTK_TYPE_WIDGET,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GtkMenuButton:active: (attributes org.gtk.Property.get=gtk_menu_button_get_active org.gtk.Property.set=gtk_menu_button_set_active)
|
||||
*
|
||||
* Whether the menu button is active.
|
||||
*
|
||||
* Since: 4.10
|
||||
*/
|
||||
menu_button_props[PROP_ACTIVE] =
|
||||
g_param_spec_boolean ("active", NULL, NULL,
|
||||
FALSE,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
g_object_class_install_properties (gobject_class, LAST_PROP, menu_button_props);
|
||||
|
||||
/**
|
||||
@@ -1499,3 +1520,45 @@ gtk_menu_button_get_child (GtkMenuButton *menu_button)
|
||||
|
||||
return menu_button->child;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_menu_button_set_active: (attributes org.gtk.Method.set_property=active)
|
||||
* @menu_button: a `GtkMenuButton`
|
||||
* @active: whether the menu button is active
|
||||
*
|
||||
* Sets whether menu button acts is active.
|
||||
*
|
||||
* Since: 4.10
|
||||
*/
|
||||
void
|
||||
gtk_menu_button_set_active (GtkMenuButton *menu_button,
|
||||
gboolean active)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_MENU_BUTTON (menu_button));
|
||||
|
||||
if (active == gtk_menu_button_get_active (menu_button))
|
||||
return;
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (menu_button->button),
|
||||
active);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (menu_button), menu_button_props[PROP_ACTIVE]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_menu_button_get_active: (attributes org.gtk.Method.get_property=active)
|
||||
* @menu_button: a `GtkMenuButton`
|
||||
*
|
||||
* Returns whether the menu button is active.
|
||||
*
|
||||
* Returns: TRUE if the button is active
|
||||
*
|
||||
* Since: 4.10
|
||||
*/
|
||||
gboolean
|
||||
gtk_menu_button_get_active (GtkMenuButton *menu_button)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_MENU_BUTTON (menu_button), FALSE);
|
||||
|
||||
return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (menu_button->button));
|
||||
}
|
||||
|
||||
@@ -127,6 +127,12 @@ void gtk_menu_button_set_child (GtkMenuButton *menu_button,
|
||||
GDK_AVAILABLE_IN_4_6
|
||||
GtkWidget * gtk_menu_button_get_child (GtkMenuButton *menu_button);
|
||||
|
||||
GDK_AVAILABLE_IN_4_10
|
||||
void gtk_menu_button_set_active (GtkMenuButton *menu_button,
|
||||
gboolean active);
|
||||
GDK_AVAILABLE_IN_4_10
|
||||
gboolean gtk_menu_button_get_active (GtkMenuButton *menu_button);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkMenuButton, g_object_unref)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include <gio/gio.h>
|
||||
#include "x11/gdkx.h"
|
||||
#include <X11/Xatom.h>
|
||||
#include <gtk/gtkicontheme.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
/* for the kill(2) system call and errno - POSIX.1-2001 and later */
|
||||
|
||||
@@ -27,8 +27,6 @@
|
||||
#include "gtkeditable.h"
|
||||
#include "gtkeventcontrollerkey.h"
|
||||
#include "gtkgestureclick.h"
|
||||
#include "gtkbox.h"
|
||||
#include "gtkimage.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gtkpasswordentrybuffer.h"
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "gtkbinlayout.h"
|
||||
#include "gtkbox.h"
|
||||
#include "gtkdragsource.h"
|
||||
#include "gtkicontheme.h"
|
||||
#include "gtkimage.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gtklabel.h"
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include "gdk/gdkkeysyms.h"
|
||||
#include "gtkbookmarksmanagerprivate.h"
|
||||
#include "gtkfilechooserutils.h"
|
||||
#include "gtkicontheme.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gtkmain.h"
|
||||
#include "gtkmarshalers.h"
|
||||
|
||||
+2
-2
@@ -2484,8 +2484,8 @@ gtk_popover_set_offset (GtkPopover *popover,
|
||||
/**
|
||||
* gtk_popover_get_offset:
|
||||
* @popover: a `GtkPopover`
|
||||
* @x_offset: (out) (nullable): a location for the x_offset
|
||||
* @y_offset: (out) (nullable): a location for the y_offset
|
||||
* @x_offset: (out) (optional): a location for the x_offset
|
||||
* @y_offset: (out) (optional): a location for the y_offset
|
||||
*
|
||||
* Gets the offset previous set with [method@Gtk.Popover.set_offset()].
|
||||
*/
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include "gtkbuildable.h"
|
||||
#include "gtkbuilderprivate.h"
|
||||
#include "gtkgizmoprivate.h"
|
||||
#include "gtkicontheme.h"
|
||||
#include "gtklabel.h"
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gtkorientable.h"
|
||||
|
||||
@@ -261,6 +261,8 @@ gtk_scale_button_class_init (GtkScaleButtonClass *klass)
|
||||
* GtkScaleButton:active: (attributes org.gtk.Property.get=gtk_scale_button_get_active)
|
||||
*
|
||||
* If the scale button should be pressed in.
|
||||
*
|
||||
* Since: 4.10
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ACTIVE,
|
||||
|
||||
@@ -623,7 +623,7 @@ gtk_search_entry_init (GtkSearchEntry *entry)
|
||||
"accessible-role", GTK_ACCESSIBLE_ROLE_PRESENTATION,
|
||||
"icon-name", "edit-clear-symbolic",
|
||||
NULL);
|
||||
gtk_widget_set_tooltip_text (entry->icon, _("Clear entry"));
|
||||
gtk_widget_set_tooltip_text (entry->icon, _("Clear Entry"));
|
||||
gtk_widget_set_parent (entry->icon, GTK_WIDGET (entry));
|
||||
gtk_widget_set_child_visible (entry->icon, FALSE);
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined(HAVE_MLOCK)
|
||||
#if defined(HAVE_SYS_MMAN_H)
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
@@ -229,7 +229,7 @@ pool_alloc (void)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef HAVE_MMAP
|
||||
#if defined(HAVE_MMAP) && defined(HAVE_GETPAGESIZE)
|
||||
/* A pool with an available item */
|
||||
Pool *pool = NULL;
|
||||
|
||||
@@ -916,7 +916,7 @@ sec_acquire_pages (size_t *sz,
|
||||
g_assert (*sz);
|
||||
g_assert (during_tag);
|
||||
|
||||
#if defined(HAVE_MLOCK) && defined(HAVE_MMAP)
|
||||
#if defined(HAVE_MLOCK) && defined(HAVE_MMAP) && defined(HAVE_GETPAGESIZE)
|
||||
/* Make sure sz is a multiple of the page size */
|
||||
unsigned long pgsize = getpagesize ();
|
||||
|
||||
@@ -1000,7 +1000,7 @@ sec_release_pages (void *pages, size_t sz)
|
||||
{
|
||||
g_assert (pages);
|
||||
|
||||
#if defined(HAVE_MLOCK)
|
||||
#if defined(HAVE_MLOCK) && defined(HAVE_GETPAGESIZE)
|
||||
g_assert (sz % getpagesize () == 0);
|
||||
|
||||
if (munlock (pages, sz) < 0 && gtk_secure_warnings)
|
||||
|
||||
+8
-2
@@ -122,6 +122,7 @@ struct _GtkSnapshotState {
|
||||
char *message;
|
||||
} debug;
|
||||
struct {
|
||||
GskMaskMode mask_mode;
|
||||
GskRenderNode *mask_node;
|
||||
} mask;
|
||||
} data;
|
||||
@@ -1258,7 +1259,7 @@ gtk_snapshot_collect_mask_source (GtkSnapshot *snapshot,
|
||||
if (source_child == NULL || mask_child == NULL)
|
||||
return NULL;
|
||||
|
||||
mask_node = gsk_mask_node_new (source_child, mask_child);
|
||||
mask_node = gsk_mask_node_new (source_child, mask_child, state->data.mask.mask_mode);
|
||||
|
||||
gsk_render_node_unref (source_child);
|
||||
gsk_render_node_unref (mask_child);
|
||||
@@ -1290,9 +1291,11 @@ gtk_snapshot_collect_mask_mask (GtkSnapshot *snapshot,
|
||||
/**
|
||||
* gtk_snapshot_push_mask:
|
||||
* @snapshot: a #GtkSnapshot
|
||||
* @mask_mode: mask mode to use
|
||||
*
|
||||
* Until the first call to [method@Gtk.Snapshot.pop], the
|
||||
* mask image for the mask operation will be recorded.
|
||||
*
|
||||
* After that call, the source image will be recorded until
|
||||
* the second call to [method@Gtk.Snapshot.pop].
|
||||
*
|
||||
@@ -1301,7 +1304,8 @@ gtk_snapshot_collect_mask_mask (GtkSnapshot *snapshot,
|
||||
* Since: 4.10
|
||||
*/
|
||||
void
|
||||
gtk_snapshot_push_mask (GtkSnapshot *snapshot)
|
||||
gtk_snapshot_push_mask (GtkSnapshot *snapshot,
|
||||
GskMaskMode mask_mode)
|
||||
{
|
||||
GtkSnapshotState *current_state = gtk_snapshot_get_current_state (snapshot);
|
||||
GtkSnapshotState *source_state;
|
||||
@@ -1311,6 +1315,8 @@ gtk_snapshot_push_mask (GtkSnapshot *snapshot)
|
||||
gtk_snapshot_collect_mask_source,
|
||||
gtk_snapshot_clear_mask_source);
|
||||
|
||||
source_state->data.mask.mask_mode = mask_mode;
|
||||
|
||||
gtk_snapshot_push_state (snapshot,
|
||||
source_state->transform,
|
||||
gtk_snapshot_collect_mask_mask,
|
||||
|
||||
+2
-1
@@ -96,7 +96,8 @@ GDK_AVAILABLE_IN_ALL
|
||||
void gtk_snapshot_push_blend (GtkSnapshot *snapshot,
|
||||
GskBlendMode blend_mode);
|
||||
GDK_AVAILABLE_IN_4_10
|
||||
void gtk_snapshot_push_mask (GtkSnapshot *snapshot);
|
||||
void gtk_snapshot_push_mask (GtkSnapshot *snapshot,
|
||||
GskMaskMode mask_mode);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_snapshot_push_cross_fade (GtkSnapshot *snapshot,
|
||||
|
||||
@@ -34,12 +34,10 @@
|
||||
#include "gtkaccessibleprivate.h"
|
||||
#include "gtkaccessiblerange.h"
|
||||
#include "gtkadjustment.h"
|
||||
#include "gtkbox.h"
|
||||
#include "gtkbutton.h"
|
||||
#include "gtkbuttonprivate.h"
|
||||
#include "gtkeditable.h"
|
||||
#include "deprecated/gtkcelleditable.h"
|
||||
#include "gtkimage.h"
|
||||
#include "gtktext.h"
|
||||
#include "gtkeventcontrollerkey.h"
|
||||
#include "gtkeventcontrollerfocus.h"
|
||||
@@ -47,7 +45,6 @@
|
||||
#include "gtkeventcontrollerscroll.h"
|
||||
#include "gtkgestureclick.h"
|
||||
#include "gtkgestureswipe.h"
|
||||
#include "gtkicontheme.h"
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gtkorientable.h"
|
||||
#include "gtkprivate.h"
|
||||
|
||||
@@ -410,6 +410,9 @@ gtk_stack_page_set_property (GObject *object,
|
||||
{
|
||||
case CHILD_PROP_CHILD:
|
||||
g_set_object (&info->widget, g_value_get_object (value));
|
||||
gtk_accessible_set_accessible_parent (GTK_ACCESSIBLE (info->widget),
|
||||
GTK_ACCESSIBLE (info),
|
||||
NULL);
|
||||
break;
|
||||
|
||||
case CHILD_PROP_NAME:
|
||||
|
||||
+6
-1
@@ -485,7 +485,12 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
|
||||
/**
|
||||
* GtkTextTag:indent:
|
||||
*
|
||||
* Amount to indent the paragraph, in pixels.
|
||||
* Amount to indent the paragraph, in pixels.
|
||||
*
|
||||
* A negative value of indent will produce a hanging indentation.
|
||||
* That is, the first line will have the full width, and subsequent
|
||||
* lines will be indented by the absolute value of indent.
|
||||
*
|
||||
*/
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_INDENT,
|
||||
|
||||
+10
-4
@@ -998,6 +998,11 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
|
||||
* GtkTextView:indent: (attributes org.gtk.Property.get=gtk_text_view_get_indent org.gtk.Property.set=gtk_text_view_set_indent)
|
||||
*
|
||||
* Amount to indent the paragraph, in pixels.
|
||||
*
|
||||
* A negative value of indent will produce a hanging indentation.
|
||||
* That is, the first line will have the full width, and subsequent
|
||||
* lines will be indented by the absolute value of indent.
|
||||
*
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_INDENT,
|
||||
@@ -4684,10 +4689,6 @@ gtk_text_view_size_allocate (GtkWidget *widget,
|
||||
}
|
||||
g_object_unref (layout);
|
||||
|
||||
/* The GTK resize loop processes all the pending exposes right
|
||||
* after doing the resize stuff, so the idle sizer won't have a
|
||||
* chance to run. So we do the work here.
|
||||
*/
|
||||
gtk_text_view_flush_first_validate (text_view);
|
||||
|
||||
chooser = g_object_get_data (G_OBJECT (text_view), "gtk-emoji-chooser");
|
||||
@@ -4871,6 +4872,8 @@ gtk_text_view_invalidate (GtkTextView *text_view)
|
||||
DV (g_print (G_STRLOC": adding incremental validate idle %d\n",
|
||||
priv->incremental_validate_idle));
|
||||
}
|
||||
|
||||
gtk_widget_queue_allocate (GTK_WIDGET (text_view));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -5838,6 +5841,9 @@ gtk_text_view_paint (GtkWidget *widget,
|
||||
g_return_if_fail (priv->xoffset >= - priv->left_padding);
|
||||
g_return_if_fail (priv->yoffset >= - priv->top_margin);
|
||||
|
||||
if (priv->first_validate_idle != 0)
|
||||
g_critical ("textview: paint with unfinished validation\n");
|
||||
|
||||
while (priv->first_validate_idle != 0)
|
||||
{
|
||||
DV (g_print (G_STRLOC": first_validate_idle: %d\n",
|
||||
|
||||
+11
-6
@@ -42,10 +42,6 @@
|
||||
#include "gtkcssnumbervalueprivate.h"
|
||||
#include "gtkcsswidgetnodeprivate.h"
|
||||
#include "gtkdebug.h"
|
||||
#include "gtkgesturedrag.h"
|
||||
#include "gtkgestureprivate.h"
|
||||
#include "gtkgesturesingle.h"
|
||||
#include "gtkgestureswipe.h"
|
||||
#include "gtkgestureprivate.h"
|
||||
#include "gtklayoutmanagerprivate.h"
|
||||
#include "gtkmain.h"
|
||||
@@ -70,7 +66,6 @@
|
||||
#include "gtktooltipprivate.h"
|
||||
#include "gsktransformprivate.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkversion.h"
|
||||
#include "gtkwidgetpaintableprivate.h"
|
||||
#include "gtkwindowgroup.h"
|
||||
#include "gtkwindowprivate.h"
|
||||
@@ -80,6 +75,7 @@
|
||||
|
||||
#include "gdk/gdkeventsprivate.h"
|
||||
#include "gdk/gdkprofilerprivate.h"
|
||||
#include "gdk/gdkframeclockprivate.h"
|
||||
#include "gsk/gskdebugprivate.h"
|
||||
#include "gsk/gskrendererprivate.h"
|
||||
|
||||
@@ -10576,6 +10572,14 @@ static void
|
||||
gtk_widget_set_alloc_needed (GtkWidget *widget)
|
||||
{
|
||||
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
|
||||
GdkFrameClock *frame_clock = gtk_widget_get_frame_clock (widget);
|
||||
|
||||
if (frame_clock != NULL &&
|
||||
gdk_frame_clock_get_current_phase (frame_clock) == GDK_FRAME_CLOCK_PHASE_PAINT)
|
||||
{
|
||||
g_warning ("%s %p set alloc-needed during PAINT\n",
|
||||
G_OBJECT_TYPE_NAME (widget), widget);
|
||||
}
|
||||
|
||||
priv->alloc_needed = TRUE;
|
||||
|
||||
@@ -12598,7 +12602,8 @@ gtk_widget_class_add_action (GtkWidgetClass *widget_class,
|
||||
* actions to be added for all instances of this class.
|
||||
*
|
||||
* Actions installed by this function are stateless. The only state
|
||||
* they have is whether they are enabled or not.
|
||||
* they have is whether they are enabled or not (which can be changed with
|
||||
* [method@Gtk.Widget.action_set_enabled]).
|
||||
*/
|
||||
void
|
||||
gtk_widget_class_install_action (GtkWidgetClass *widget_class,
|
||||
|
||||
@@ -27,15 +27,10 @@
|
||||
#include "gtkwindowprivate.h"
|
||||
|
||||
#include "gtkaccessibleprivate.h"
|
||||
#include "gtkaccelgroupprivate.h"
|
||||
#include "gtkactionable.h"
|
||||
#include "gtkapplicationprivate.h"
|
||||
#include "gtkbox.h"
|
||||
#include "gtkbuildable.h"
|
||||
#include "gtkbuilderprivate.h"
|
||||
#include "gtkcheckbutton.h"
|
||||
#include "gtkcsscornervalueprivate.h"
|
||||
#include "gtkcsscolorvalueprivate.h"
|
||||
#include "gtkcssshadowvalueprivate.h"
|
||||
#include "gtkdroptargetasync.h"
|
||||
#include "gtkeventcontrollerlegacy.h"
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
#include "gtkwindowhandle.h"
|
||||
|
||||
#include "gtkactionmuxerprivate.h"
|
||||
#include "gtkbinlayout.h"
|
||||
#include "gtkbox.h"
|
||||
#include "gtkbuildable.h"
|
||||
|
||||
@@ -1140,6 +1140,12 @@ populate_render_node_properties (GListStore *store,
|
||||
break;
|
||||
|
||||
case GSK_MASK_NODE:
|
||||
{
|
||||
GskMaskMode mode = gsk_mask_node_get_mask_mode (node);
|
||||
tmp = g_enum_to_string (GSK_TYPE_MASK_MODE, mode);
|
||||
add_text_row (store, "Mask mode", tmp);
|
||||
g_free (tmp);
|
||||
}
|
||||
break;
|
||||
|
||||
case GSK_BLUR_NODE:
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<property name="shrink-start-child">0</property>
|
||||
<property name="resize-start-child">0</property>
|
||||
<property name="vexpand">1</property>
|
||||
<child>
|
||||
<property name="start-child">
|
||||
<object class="GtkPlacesSidebar" id="places_sidebar">
|
||||
<property name="show-other-locations">1</property>
|
||||
<property name="show-trash">0</property>
|
||||
@@ -25,8 +25,8 @@
|
||||
<signal name="show-error-message" handler="places_sidebar_show_error_message_cb" swapped="no"/>
|
||||
<signal name="show-other-locations-with-flags" handler="places_sidebar_show_other_locations_with_flags_cb" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
</property>
|
||||
<property name="end-child">
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">1</property>
|
||||
<child>
|
||||
@@ -526,7 +526,7 @@
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
+17
-16
@@ -1,5 +1,5 @@
|
||||
project('gtk', 'c',
|
||||
version: '4.9.4',
|
||||
version: '4.9.5',
|
||||
default_options: [
|
||||
'buildtype=debugoptimized',
|
||||
'warning_level=1',
|
||||
@@ -187,23 +187,28 @@ endforeach
|
||||
libm = cc.find_library('m', required: false)
|
||||
|
||||
check_functions = [
|
||||
'dcgettext',
|
||||
'getpagesize',
|
||||
'getresuid',
|
||||
'lstat',
|
||||
'madvise',
|
||||
'memfd_create',
|
||||
'mkostemp',
|
||||
'mlock',
|
||||
'mmap',
|
||||
'posix_fallocate',
|
||||
'_lock_file',
|
||||
'flockfile',
|
||||
'mkstemp',
|
||||
'mallinfo2',
|
||||
'sincos',
|
||||
'sincosf',
|
||||
]
|
||||
|
||||
foreach func : check_functions
|
||||
if cc.has_function(func, dependencies: libm)
|
||||
if cc.has_function(func,
|
||||
args: '-D_GNU_SOURCE',
|
||||
prefix:
|
||||
'#include <stdlib.h>\n' +
|
||||
'#include <unistd.h>\n' +
|
||||
'#include <sys/mman.h>\n' +
|
||||
'#include <fcntl.h>\n' +
|
||||
'#include <math.h>',
|
||||
dependencies: libm)
|
||||
cdata.set('HAVE_' + func.underscorify().to_upper(), 1)
|
||||
endif
|
||||
endforeach
|
||||
@@ -230,14 +235,6 @@ if cc.compiles(uint128_t_src, name : '__uint128_t available')
|
||||
cdata.set('HAVE_UINT128_T', 1)
|
||||
endif
|
||||
|
||||
# Check for mlock and madvise
|
||||
if cc.has_function('mlock', prefix: '#include <sys/mman.h>')
|
||||
cdata.set('HAVE_MLOCK', 1)
|
||||
endif
|
||||
if cc.has_function('madvise', prefix: '#include <sys/mman.h>')
|
||||
cdata.set('HAVE_MADVISE', 1)
|
||||
endif
|
||||
|
||||
# Disable deprecation checks for all libraries we depend on on stable branches.
|
||||
# This is so newer versions of those libraries don't cause more warnings with
|
||||
# a stable GTK version.
|
||||
@@ -740,6 +737,10 @@ subdir('gtk/css')
|
||||
subdir('gdk')
|
||||
subdir('gsk')
|
||||
subdir('gtk')
|
||||
if os_unix
|
||||
cpdb_dep = dependency('cpdb-frontend', version : '>=2.0', required: get_option('print-cpdb'))
|
||||
cups_dep = dependency('cups', version : '>=2.0', required: get_option('print-cups'))
|
||||
endif
|
||||
subdir('modules')
|
||||
if get_option('demos')
|
||||
subdir('demos')
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
|
||||
#include <glib.h>
|
||||
#include <sys/random.h>
|
||||
|
||||
#include "gtkprintbackendutils.h"
|
||||
|
||||
@@ -114,15 +113,13 @@ random_string (int n)
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
"0123456789";
|
||||
|
||||
char *str = g_new0 (char, n+1);
|
||||
getrandom (str, n, 0);
|
||||
for (int i=0; i<n; i++)
|
||||
char *str = g_new0 (char, n + 1);
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
int rand = str[i] + 128;
|
||||
int idx = rand % ((int) sizeof charset);
|
||||
int idx = g_random_int_range (0, strlen (charset));
|
||||
str[i] = charset[idx];
|
||||
}
|
||||
str[n] = '\0';
|
||||
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,9 +10,6 @@ printbackends_args = [
|
||||
'-DGTK_PRINT_BACKEND_ENABLE_UNSUPPORTED',
|
||||
] + common_cflags
|
||||
|
||||
cpdb_dep = dependency('cpdb-frontend', version : '>=1.0', required: get_option('print-cpdb'))
|
||||
cups_dep = dependency('cups', version : '>=2.0', required: get_option('print-cups'))
|
||||
|
||||
# Use cpdb backend if present and enabled.
|
||||
# If not, use cups if present.
|
||||
|
||||
|
||||
@@ -1215,7 +1215,7 @@ msgid ""
|
||||
"See the <a href=\"%s\">%s</a> for details."
|
||||
msgstr ""
|
||||
"Праграма распаўсюджваецца без аніякіх гарантый.\n"
|
||||
"Падрабязнасці глядзіце тут: <a href=«%s»>%s</a>."
|
||||
"Падрабязнасці глядзіце тут: <a href=\"%s\">%s</a>."
|
||||
|
||||
#. This is the text that should appear next to menu accelerators
|
||||
#. * that use the shift key. If the text on this key isn't typically
|
||||
|
||||
@@ -11,8 +11,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: gtk\n"
|
||||
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/gtk/-/issues/\n"
|
||||
"POT-Creation-Date: 2023-02-12 12:21+0000\n"
|
||||
"PO-Revision-Date: 2023-02-12 13:28+0100\n"
|
||||
"POT-Creation-Date: 2023-02-18 21:10+0000\n"
|
||||
"PO-Revision-Date: 2023-02-19 06:46+0100\n"
|
||||
"Last-Translator: Ekaterine Papava <papava.e@gtu.ge>\n"
|
||||
"Language-Team: Georgian <http://mail.gnome.org/mailman/listinfo/gnome-ge-"
|
||||
"list>\n"
|
||||
@@ -100,7 +100,7 @@ msgstr "EGL ეკრანის ინიციალიზაციის შ
|
||||
#: gdk/gdkdisplay.c:1694
|
||||
#, c-format
|
||||
msgid "EGL version %d.%d is too old. GTK requires %d.%d"
|
||||
msgstr ""
|
||||
msgstr "EGL-ის ვერსია %d.%d ძალიან ძველია. GTK-ს ესაჭიროება %d.%d"
|
||||
|
||||
#: gdk/gdkdrop.c:130
|
||||
msgid "Drag’n’drop from other applications is not supported."
|
||||
@@ -530,35 +530,35 @@ msgstr "JPEG გამოსახულების ფაილის კი
|
||||
msgid "Unsupported JPEG colorspace (%d)"
|
||||
msgstr "მხარდაუჭერელი JPEG ფერთა სივრცე (%d)"
|
||||
|
||||
#: gdk/loaders/gdkjpeg.c:203 gdk/loaders/gdkpng.c:266 gdk/loaders/gdktiff.c:453
|
||||
#: gdk/loaders/gdkjpeg.c:203 gdk/loaders/gdkpng.c:265 gdk/loaders/gdktiff.c:455
|
||||
#, c-format
|
||||
msgid "Not enough memory for image size %ux%u"
|
||||
msgstr "არასაკმარისი მეხსიერება გამოსახულების ჩასატვირთად %ux%u"
|
||||
|
||||
#: gdk/loaders/gdkpng.c:119
|
||||
#: gdk/loaders/gdkpng.c:118
|
||||
#, c-format
|
||||
msgid "Error reading png (%s)"
|
||||
msgstr "PNG-ის წაკითხვის შეცდომა (%s)"
|
||||
|
||||
#: gdk/loaders/gdkpng.c:217
|
||||
#: gdk/loaders/gdkpng.c:216
|
||||
#, c-format
|
||||
msgid "Unsupported depth %u in png image"
|
||||
msgstr "PNG გამოსახულების მხარდაუჭერელი ფერთა სიღრმე %u"
|
||||
|
||||
#: gdk/loaders/gdkpng.c:247
|
||||
#: gdk/loaders/gdkpng.c:246
|
||||
#, c-format
|
||||
msgid "Unsupported color type %u in png image"
|
||||
msgstr "PNG გამოსახულების ფერების მხარდაუჭერელი ტიპი %u"
|
||||
|
||||
#: gdk/loaders/gdktiff.c:340
|
||||
#: gdk/loaders/gdktiff.c:342
|
||||
msgid "Failed to load RGB data from TIFF file"
|
||||
msgstr "RGB მონაცემების ჩატვირთვა TIFF ფაილიდან ვერ შედგა"
|
||||
|
||||
#: gdk/loaders/gdktiff.c:383
|
||||
#: gdk/loaders/gdktiff.c:385
|
||||
msgid "Could not load TIFF data"
|
||||
msgstr "TIFF-ის მონაცემების ჩატვირთვის შეცდომა"
|
||||
|
||||
#: gdk/loaders/gdktiff.c:465
|
||||
#: gdk/loaders/gdktiff.c:467
|
||||
#, c-format
|
||||
msgid "Reading data failed at row %d"
|
||||
msgstr "მონაცემების კითხვის შეცდომა %d-ე ხაზზე"
|
||||
@@ -800,7 +800,7 @@ msgstr "GLX-ის კონფიგურაციები მიუწვდ
|
||||
|
||||
#: gdk/x11/gdkglcontext-glx.c:842
|
||||
msgid "No GLX configuration with required features found"
|
||||
msgstr ""
|
||||
msgstr "მოთხოვნილი ფუნქციების მქონე GLX-ის კონფიგურაცია ნაპოვნი არაა"
|
||||
|
||||
#: gdk/x11/gdkglcontext-glx.c:916
|
||||
msgid "GLX is not supported"
|
||||
@@ -1086,15 +1086,15 @@ msgctxt "font"
|
||||
msgid "None"
|
||||
msgstr "არცერთი"
|
||||
|
||||
#: gtk/deprecated/gtklockbutton.c:288 gtk/ui/gtklockbutton.ui:20
|
||||
#: gtk/deprecated/gtklockbutton.c:294 gtk/ui/gtklockbutton.ui:20
|
||||
msgid "Lock"
|
||||
msgstr "ჩაკეტვა"
|
||||
|
||||
#: gtk/deprecated/gtklockbutton.c:300 gtk/ui/gtklockbutton.ui:26
|
||||
#: gtk/deprecated/gtklockbutton.c:308 gtk/ui/gtklockbutton.ui:26
|
||||
msgid "Unlock"
|
||||
msgstr "განბლოკვა"
|
||||
|
||||
#: gtk/deprecated/gtklockbutton.c:312
|
||||
#: gtk/deprecated/gtklockbutton.c:322
|
||||
msgid ""
|
||||
"Dialog is unlocked.\n"
|
||||
"Click to prevent further changes"
|
||||
@@ -1102,7 +1102,7 @@ msgstr ""
|
||||
"ფანჯარა განბლოკილია.\n"
|
||||
"მეტი ცვლილების შეტანის ასაკრძალად დააწკაპუნეთ"
|
||||
|
||||
#: gtk/deprecated/gtklockbutton.c:324
|
||||
#: gtk/deprecated/gtklockbutton.c:336
|
||||
msgid ""
|
||||
"Dialog is locked.\n"
|
||||
"Click to make changes"
|
||||
@@ -1110,7 +1110,7 @@ msgstr ""
|
||||
"ფანჯარა დაბლოკილია.\n"
|
||||
"ცვლილებების შესატანად დააწკაპუნეთ"
|
||||
|
||||
#: gtk/deprecated/gtklockbutton.c:336
|
||||
#: gtk/deprecated/gtklockbutton.c:350
|
||||
msgid ""
|
||||
"System policy prevents changes.\n"
|
||||
"Contact your system administrator"
|
||||
@@ -1122,6 +1122,25 @@ msgstr ""
|
||||
msgid "Could not show link"
|
||||
msgstr "ბმულის ჩვენების შეცდომა"
|
||||
|
||||
#: gtk/deprecated/gtkvolumebutton.c:236
|
||||
msgid "Muted"
|
||||
msgstr "ხმა გამორთული"
|
||||
|
||||
#: gtk/deprecated/gtkvolumebutton.c:240
|
||||
msgid "Full Volume"
|
||||
msgstr "სრული ხმა"
|
||||
|
||||
#. Translators: this is the percentage of the current volume,
|
||||
#. * as used in the tooltip, eg. "49 %".
|
||||
#. * Translate the "%d" to "%Id" if you want to use localised digits,
|
||||
#. * or otherwise translate the "%d" to "%d".
|
||||
#.
|
||||
#: gtk/deprecated/gtkvolumebutton.c:253
|
||||
#, c-format
|
||||
msgctxt "volume percentage"
|
||||
msgid "%d %%"
|
||||
msgstr "%d %%"
|
||||
|
||||
#: gtk/gtkaboutdialog.c:126 gtk/ui/gtkaboutdialog.ui:163
|
||||
msgid "License"
|
||||
msgstr "ლიცენზია"
|
||||
@@ -2273,7 +2292,7 @@ msgid "If you delete an item, it will be permanently lost."
|
||||
msgstr "თუ წაშლით ელემენტს, ის სამუდამოდ დაიკარგება."
|
||||
|
||||
#: gtk/gtkfilechooserwidget.c:1168 gtk/gtkfilechooserwidget.c:1796
|
||||
#: gtk/gtklabel.c:5658 gtk/gtktext.c:6087 gtk/gtktextview.c:8994
|
||||
#: gtk/gtklabel.c:5658 gtk/gtktext.c:6087 gtk/gtktextview.c:8999
|
||||
msgid "_Delete"
|
||||
msgstr "წაშლა"
|
||||
|
||||
@@ -2511,70 +2530,70 @@ msgstr "აირჩიეთ საქაღალდე"
|
||||
msgid "Change Font Features"
|
||||
msgstr "ფონტის თვისებების შეცვლა"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:1546
|
||||
#: gtk/gtkfontchooserwidget.c:1547
|
||||
msgctxt "Font variation axis"
|
||||
msgid "Width"
|
||||
msgstr "სიგანე"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:1547
|
||||
#: gtk/gtkfontchooserwidget.c:1548
|
||||
msgctxt "Font variation axis"
|
||||
msgid "Weight"
|
||||
msgstr "სიმძიმე"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:1548
|
||||
#: gtk/gtkfontchooserwidget.c:1549
|
||||
msgctxt "Font variation axis"
|
||||
msgid "Italic"
|
||||
msgstr "დახრილი"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:1549
|
||||
#: gtk/gtkfontchooserwidget.c:1550
|
||||
msgctxt "Font variation axis"
|
||||
msgid "Slant"
|
||||
msgstr "დაცერება"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:1550
|
||||
#: gtk/gtkfontchooserwidget.c:1551
|
||||
msgctxt "Font variation axis"
|
||||
msgid "Optical Size"
|
||||
msgstr "ოპტიკური ზომა"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:2102
|
||||
#: gtk/gtkfontchooserwidget.c:2103
|
||||
msgctxt "Font feature value"
|
||||
msgid "Default"
|
||||
msgstr "ნაგულისხმები"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:2119
|
||||
#: gtk/gtkfontchooserwidget.c:2120
|
||||
msgctxt "Font feature value"
|
||||
msgid "Enable"
|
||||
msgstr "ჩართვა"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:2447
|
||||
#: gtk/gtkfontchooserwidget.c:2448
|
||||
msgid "Default"
|
||||
msgstr "ნაგულისხმები"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:2509
|
||||
#: gtk/gtkfontchooserwidget.c:2510
|
||||
msgid "Ligatures"
|
||||
msgstr "ლიგატურები"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:2510
|
||||
#: gtk/gtkfontchooserwidget.c:2511
|
||||
msgid "Letter Case"
|
||||
msgstr "დიდი თუ პატარა სიმბოლოები"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:2511
|
||||
#: gtk/gtkfontchooserwidget.c:2512
|
||||
msgid "Number Case"
|
||||
msgstr "დიდი თუ პატარა ციფრები"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:2512
|
||||
#: gtk/gtkfontchooserwidget.c:2513
|
||||
msgid "Number Spacing"
|
||||
msgstr "ციფრებს შორის დაცილება"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:2513
|
||||
#: gtk/gtkfontchooserwidget.c:2514
|
||||
msgid "Fractions"
|
||||
msgstr "ფრაქციები"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:2514
|
||||
#: gtk/gtkfontchooserwidget.c:2515
|
||||
msgid "Style Variations"
|
||||
msgstr "სტილის ვარიაციები"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:2516
|
||||
#: gtk/gtkfontchooserwidget.c:2517
|
||||
msgid "Character Variations"
|
||||
msgstr "სიმბოლოების ვარიანტები"
|
||||
|
||||
@@ -2582,19 +2601,19 @@ msgstr "სიმბოლოების ვარიანტები"
|
||||
msgid "OpenGL context creation failed"
|
||||
msgstr "OpenGL-ის კონტექსტის შექმნის შეცდომა"
|
||||
|
||||
#: gtk/gtklabel.c:5655 gtk/gtktext.c:6075 gtk/gtktextview.c:8982
|
||||
#: gtk/gtklabel.c:5655 gtk/gtktext.c:6075 gtk/gtktextview.c:8987
|
||||
msgid "Cu_t"
|
||||
msgstr "ამოჭრა"
|
||||
|
||||
#: gtk/gtklabel.c:5656 gtk/gtktext.c:6079 gtk/gtktextview.c:8986
|
||||
#: gtk/gtklabel.c:5656 gtk/gtktext.c:6079 gtk/gtktextview.c:8991
|
||||
msgid "_Copy"
|
||||
msgstr "ასლი"
|
||||
|
||||
#: gtk/gtklabel.c:5657 gtk/gtktext.c:6083 gtk/gtktextview.c:8990
|
||||
#: gtk/gtklabel.c:5657 gtk/gtktext.c:6083 gtk/gtktextview.c:8995
|
||||
msgid "_Paste"
|
||||
msgstr "ჩასმა"
|
||||
|
||||
#: gtk/gtklabel.c:5663 gtk/gtktext.c:6096 gtk/gtktextview.c:9015
|
||||
#: gtk/gtklabel.c:5663 gtk/gtktext.c:6096 gtk/gtktextview.c:9020
|
||||
msgid "Select _All"
|
||||
msgstr "ყველაფრის _მონიშვნა"
|
||||
|
||||
@@ -3443,7 +3462,7 @@ msgid "No registered application with name “%s” for item with URI “%s” f
|
||||
msgstr ""
|
||||
|
||||
#: gtk/gtksearchentry.c:626
|
||||
msgid "Clear entry"
|
||||
msgid "Clear Entry"
|
||||
msgstr "ჩანაწერის გასუფთავება"
|
||||
|
||||
#. Translators: This string is used to mark left/right variants of modifier
|
||||
@@ -3532,15 +3551,15 @@ msgctxt "accessibility"
|
||||
msgid "Sidebar"
|
||||
msgstr "გვერდითა ზოლი"
|
||||
|
||||
#: gtk/gtktext.c:6101 gtk/gtktextview.c:9020
|
||||
#: gtk/gtktext.c:6101 gtk/gtktextview.c:9025
|
||||
msgid "Insert _Emoji"
|
||||
msgstr "ემოჯის _ჩასმა"
|
||||
|
||||
#: gtk/gtktextview.c:9002
|
||||
#: gtk/gtktextview.c:9007
|
||||
msgid "_Undo"
|
||||
msgstr "_დაბრუნება"
|
||||
|
||||
#: gtk/gtktextview.c:9006
|
||||
#: gtk/gtktextview.c:9011
|
||||
msgid "_Redo"
|
||||
msgstr "_გამეორება"
|
||||
|
||||
@@ -3548,25 +3567,6 @@ msgstr "_გამეორება"
|
||||
msgid "Expand"
|
||||
msgstr "გაფართოება"
|
||||
|
||||
#: gtk/gtkvolumebutton.c:228
|
||||
msgid "Muted"
|
||||
msgstr "ხმა გამორთული"
|
||||
|
||||
#: gtk/gtkvolumebutton.c:232
|
||||
msgid "Full Volume"
|
||||
msgstr "სრული ხმა"
|
||||
|
||||
#. Translators: this is the percentage of the current volume,
|
||||
#. * as used in the tooltip, eg. "49 %".
|
||||
#. * Translate the "%d" to "%Id" if you want to use localised digits,
|
||||
#. * or otherwise translate the "%d" to "%d".
|
||||
#.
|
||||
#: gtk/gtkvolumebutton.c:245
|
||||
#, c-format
|
||||
msgctxt "volume percentage"
|
||||
msgid "%d %%"
|
||||
msgstr "%d %%"
|
||||
|
||||
#: gtk/gtkwindow.c:6144
|
||||
#, c-format
|
||||
msgid "Do you want to use GTK Inspector?"
|
||||
@@ -4074,7 +4074,7 @@ msgstr "წყარო:"
|
||||
msgid "Defined At"
|
||||
msgstr "აღწერის წერტილი"
|
||||
|
||||
#: gtk/inspector/recorder.c:1849
|
||||
#: gtk/inspector/recorder.c:1865
|
||||
#, c-format
|
||||
msgid "Saving RenderNode failed"
|
||||
msgstr "RenderNode-ის შენახვის შეცდომა"
|
||||
@@ -6273,7 +6273,7 @@ msgstr "ასლები:"
|
||||
|
||||
#: gtk/ui/gtkprintunixdialog.ui:325
|
||||
msgid "C_ollate"
|
||||
msgstr ""
|
||||
msgstr "_შედარება"
|
||||
|
||||
#: gtk/ui/gtkprintunixdialog.ui:336
|
||||
msgid "_Reverse"
|
||||
@@ -7021,18 +7021,6 @@ msgstr "ფაილი"
|
||||
msgid "_Output format"
|
||||
msgstr "_გამოტანის ფორმატი"
|
||||
|
||||
#: modules/printbackends/gtkprintbackendlpr.c:375
|
||||
msgid "Print to LPR"
|
||||
msgstr "ბეჭდვა - LPR"
|
||||
|
||||
#: modules/printbackends/gtkprintbackendlpr.c:404
|
||||
msgid "Pages Per Sheet"
|
||||
msgstr "გვერდები ფურცელზე"
|
||||
|
||||
#: modules/printbackends/gtkprintbackendlpr.c:410
|
||||
msgid "Command Line"
|
||||
msgstr "ბრძანების სტრიქონი"
|
||||
|
||||
#. TRANSLATORS: when we're running an old CUPS, and
|
||||
#. * it hasn't registered the device with colord
|
||||
#: modules/printbackends/gtkprintercups.c:272
|
||||
@@ -7354,6 +7342,15 @@ msgid ""
|
||||
"If you really want to create an icon cache here, use --ignore-theme-index.\n"
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "Print to LPR"
|
||||
#~ msgstr "ბეჭდვა - LPR"
|
||||
|
||||
#~ msgid "Pages Per Sheet"
|
||||
#~ msgstr "გვერდები ფურცელზე"
|
||||
|
||||
#~ msgid "Command Line"
|
||||
#~ msgstr "ბრძანების სტრიქონი"
|
||||
|
||||
#~ msgid "Other application…"
|
||||
#~ msgstr "სხვა პროგრამა…"
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user