Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 406a32d825 | |||
| beabe8c33b | |||
| 90500519d6 | |||
| 06921674a9 | |||
| a91fa9a680 | |||
| ead40dc834 | |||
| 2be928b569 | |||
| 621ba6d67c | |||
| af929a8787 | |||
| ef986f4256 | |||
| ab36c275cf | |||
| 720327bc00 |
+56
-73
@@ -26,31 +26,25 @@ 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:v41"
|
||||
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v40"
|
||||
FLATPAK_IMAGE: "quay.io/gnome_infrastructure/gnome-runtime-images:gnome-master"
|
||||
|
||||
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
|
||||
.only-default:
|
||||
only:
|
||||
- branches
|
||||
except:
|
||||
- tags
|
||||
|
||||
style-check-diff:
|
||||
extends: .only-default
|
||||
image: $FEDORA_IMAGE
|
||||
stage: check
|
||||
when: manual
|
||||
allow_failure: true
|
||||
script:
|
||||
- .gitlab-ci/run-style-check-diff.sh
|
||||
|
||||
.build-fedora-default:
|
||||
extends: .only-default
|
||||
image: $FEDORA_IMAGE
|
||||
artifacts:
|
||||
when: always
|
||||
@@ -166,6 +160,7 @@ fedora-mingw64:
|
||||
- ninja -C _build
|
||||
|
||||
.mingw-defaults:
|
||||
extends: .only-default
|
||||
stage: build
|
||||
tags:
|
||||
- win32-ps
|
||||
@@ -197,8 +192,9 @@ msys2-mingw64:
|
||||
macos:
|
||||
# Sadly, this fails regularly, and its failure is never enlightening
|
||||
allow_failure: true
|
||||
rules:
|
||||
- if: $CI_PROJECT_NAMESPACE == "GNOME"
|
||||
extends: .only-default
|
||||
only:
|
||||
- branches@GNOME/gtk
|
||||
stage: build
|
||||
tags:
|
||||
- macos
|
||||
@@ -231,9 +227,10 @@ macos:
|
||||
- "${CI_PROJECT_DIR}/_build/meson-logs"
|
||||
|
||||
vs2017-x64:
|
||||
extends: .only-default
|
||||
# TODO: Uncomment this when ready to merge.
|
||||
# rules:
|
||||
# - if: $CI_PROJECT_NAMESPACE == "GNOME"
|
||||
#only:
|
||||
# - branches@GNOME/gtk
|
||||
stage: build
|
||||
tags:
|
||||
- win32-ps
|
||||
@@ -246,7 +243,7 @@ vs2017-x64:
|
||||
- "${CI_PROJECT_DIR}/_build/meson-logs"
|
||||
|
||||
.flatpak-defaults:
|
||||
image: "quay.io/gnome_infrastructure/gnome-runtime-images:gnome-master"
|
||||
image: $FLATPAK_IMAGE
|
||||
stage: flatpak
|
||||
allow_failure: true
|
||||
tags:
|
||||
@@ -256,67 +253,65 @@ 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}"
|
||||
|
||||
flatpak:demo:
|
||||
extends: '.flatpak-defaults'
|
||||
# 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
|
||||
needs: []
|
||||
variables:
|
||||
APPID: org.gtk.Demo4
|
||||
|
||||
flatpak:demo:aarch64:
|
||||
extends: '.flatpak-defaults'
|
||||
flatpak-main:demo:
|
||||
extends: .flatpak-main
|
||||
needs: []
|
||||
tags:
|
||||
- flatpak-aarch64
|
||||
variables:
|
||||
APPID: org.gtk.Demo4
|
||||
|
||||
flatpak:widget-factory:
|
||||
extends: '.flatpak-defaults'
|
||||
flatpak-manual:widget-factory:
|
||||
extends: .flatpak-manual
|
||||
needs: []
|
||||
variables:
|
||||
APPID: org.gtk.WidgetFactory4
|
||||
|
||||
flatpak:widget-factory:aarch64:
|
||||
extends: '.flatpak-defaults'
|
||||
flatpak-main:widget-factory:
|
||||
extends: .flatpak-main
|
||||
needs: []
|
||||
tags:
|
||||
- flatpak-aarch64
|
||||
variables:
|
||||
APPID: org.gtk.WidgetFactory4
|
||||
|
||||
flatpak:icon-browser:
|
||||
extends: '.flatpak-defaults'
|
||||
flatpak-manual:icon-browser:
|
||||
extends: .flatpak-manual
|
||||
needs: []
|
||||
variables:
|
||||
APPID: org.gtk.IconBrowser4
|
||||
|
||||
flatpak:icon-browser:aarch64:
|
||||
extends: '.flatpak-defaults'
|
||||
flatpak-main:icon-browser:
|
||||
extends: .flatpak-main
|
||||
needs: []
|
||||
tags:
|
||||
- flatpak-aarch64
|
||||
variables:
|
||||
APPID: org.gtk.IconBrowser4
|
||||
|
||||
flatpak:node-editor:
|
||||
extends: '.flatpak-defaults'
|
||||
flatpak-manual:node-editor:
|
||||
extends: .flatpak-manual
|
||||
needs: []
|
||||
variables:
|
||||
APPID: org.gtk.gtk4.NodeEditor
|
||||
|
||||
flatpak:node-editor:aarch64:
|
||||
extends: '.flatpak-defaults'
|
||||
flatpak-main:node-editor:
|
||||
extends: .flatpak-main
|
||||
needs: []
|
||||
tags:
|
||||
- flatpak-aarch64
|
||||
variables:
|
||||
APPID: org.gtk.gtk4.NodeEditor
|
||||
|
||||
@@ -325,35 +320,23 @@ flatpak:node-editor:aarch64:
|
||||
# https://gitlab.gnome.org/GNOME/Initiatives/-/wikis/DevOps-with-Flatpak
|
||||
nightly demo:
|
||||
extends: '.publish_nightly'
|
||||
needs: ['flatpak:demo']
|
||||
|
||||
nightly demo aarch64:
|
||||
extends: '.publish_nightly'
|
||||
needs: ['flatpak:demo:aarch64']
|
||||
dependencies: ['flatpak-main:demo']
|
||||
needs: ['flatpak-main:demo']
|
||||
|
||||
nightly factory:
|
||||
extends: '.publish_nightly'
|
||||
needs: ['flatpak:widget-factory']
|
||||
|
||||
nightly factory aarch64:
|
||||
extends: '.publish_nightly'
|
||||
needs: ['flatpak:widget-factory:aarch64']
|
||||
dependencies: ['flatpak-main:widget-factory']
|
||||
needs: ['flatpak-main:widget-factory']
|
||||
|
||||
nightly icon-browser:
|
||||
extends: '.publish_nightly'
|
||||
needs: ['flatpak:icon-browser']
|
||||
|
||||
nightly icon-browser aarch64:
|
||||
extends: '.publish_nightly'
|
||||
needs: ['flatpak:icon-browser:aarch64']
|
||||
dependencies: ['flatpak-main:icon-browser']
|
||||
needs: ['flatpak-main:icon-browser']
|
||||
|
||||
nightly node-editor:
|
||||
extends: '.publish_nightly'
|
||||
needs: ['flatpak:node-editor']
|
||||
|
||||
nightly node-editor aarch64:
|
||||
extends: '.publish_nightly'
|
||||
needs: ['flatpak:node-editor:aarch64']
|
||||
dependencies: ['flatpak-main:node-editor']
|
||||
needs: ['flatpak-main:node-editor']
|
||||
|
||||
static-scan:
|
||||
image: $FEDORA_IMAGE
|
||||
@@ -436,9 +419,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"
|
||||
rules:
|
||||
- if: $CI_COMMIT_REF_NAME == "main"
|
||||
only:
|
||||
refs:
|
||||
- main
|
||||
|
||||
@@ -82,7 +82,6 @@ RUN dnf -y install \
|
||||
python3-gobject \
|
||||
python3-jinja2 \
|
||||
python3-markdown \
|
||||
python3-packaging \
|
||||
python3-pip \
|
||||
python3-pygments \
|
||||
python3-typogrify \
|
||||
|
||||
@@ -20,7 +20,6 @@ flatpak build ${builddir} meson \
|
||||
-Dx11-backend=true \
|
||||
-Dwayland-backend=true \
|
||||
-Dbuild-tests=false \
|
||||
-Dbuild-testsuite=false \
|
||||
-Dbuild-examples=false \
|
||||
-Dintrospection=disabled \
|
||||
-Ddemos=true \
|
||||
|
||||
@@ -23,7 +23,6 @@ push=0
|
||||
list=0
|
||||
print_help=0
|
||||
no_login=0
|
||||
no_cache=0
|
||||
|
||||
while (($# > 0)); do
|
||||
case "${1%%=*}" in
|
||||
@@ -35,7 +34,6 @@ 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
|
||||
@@ -105,21 +103,11 @@ TAG="${REGISTRY}/gnome/gtk/${base}:${base_version}"
|
||||
|
||||
if [ $build == 1 ]; then
|
||||
echo -e "\e[1;32mBUILDING\e[0m: ${base} as ${TAG}"
|
||||
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
|
||||
|
||||
${CMD} build \
|
||||
${format} \
|
||||
--build-arg HOST_USER_ID="$UID" \
|
||||
--tag "${TAG}" \
|
||||
--file "${base}.Dockerfile" .
|
||||
exit $?
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,157 +1,8 @@
|
||||
Overview of Changes in 4.10.2, 21-04-2023
|
||||
=========================================
|
||||
|
||||
* Fixed issues:
|
||||
- Holding control to select multiple files broken in filechooser (#5669)
|
||||
- Inspector crash (#5681)
|
||||
- Listbase doesn't account for bottom padding in size_allocate_child (#5380)
|
||||
- Leaking AT contexts (#5690)
|
||||
- OpenGL / Windows: Crash when closing gtk4-widget-factory (#5685)
|
||||
- GTK apps crash on startup when setting cursor-size to 0 on Wayland (#5700)
|
||||
- Segmentation fault: gdk_wayland_toplevel_set_startup_id() needs to null-check
|
||||
display->xdg_activation before using it (#5701)
|
||||
- Possible use-after-free under gtk_scrolled_window_update_use_indicators() (#5684)
|
||||
- Wrong error message in `gtk_init` (#5704)
|
||||
- Segfault when scrolling after changing ListView model (#5763)
|
||||
- Bluetooth panel from the Settings app: clicking in the "Downloads" link
|
||||
no longer opens Nautilus (#5671)
|
||||
- Broadway docs or code is broken (#5662)
|
||||
- Disabled GtkPicture's are not properly themed (#5683)
|
||||
- Setting CSS padding to a GtkTextView gives the context menu an offset (#5695)
|
||||
- A11y: the Showing state is used only for windows (#5194)
|
||||
- Gtk4 expander: CSS nodes mismatch code vs. documentation (#5723)
|
||||
- Invoking gtk inspector on a folder results in a crash (#5729)
|
||||
- Double tap requires very precise touch input (#5580)
|
||||
- Name autocompletion dropdown in the GTK4 FileChooser's Save dialog gets
|
||||
stuck, creates artifacts, jumps around (#5743)
|
||||
- Links are not opened when xdg-desktop-portal OpenURI is not available (#5733)
|
||||
- GtkSnapshot generates no nodes appending whitespace-only layouts (#5747)
|
||||
|
||||
* Translation updates
|
||||
British English
|
||||
Bulgarian
|
||||
Chinese (China)
|
||||
French
|
||||
Indonesian
|
||||
Korean
|
||||
Russian
|
||||
Serbian
|
||||
Slovenian
|
||||
Turkish
|
||||
|
||||
|
||||
Overview of Changes in 4.10.1, 14-03-2023
|
||||
=========================================
|
||||
|
||||
* GtkFileChooser
|
||||
- Improve search performance
|
||||
- Be safe against pathless files
|
||||
- Fix memory leaks
|
||||
- Only show local files in recent files
|
||||
- Show most recent files first
|
||||
- Make files non-selectable in selet_folder mode
|
||||
|
||||
* GtkListView / GtkColumnView / GtkGridView
|
||||
- Fix scrolling problems
|
||||
- Support CSS border-spacing
|
||||
|
||||
* GtkComboBox
|
||||
- Fix a size allocation problem
|
||||
|
||||
* gtk
|
||||
- Size allocation fixes
|
||||
|
||||
* Accessibility
|
||||
- Miscellaneous property fixes and improvements
|
||||
|
||||
* Wayland
|
||||
- Fix an ordering problem in surface disposal
|
||||
|
||||
* Windows
|
||||
- Fix Visual Studio build with older GLib
|
||||
|
||||
* Translation updates
|
||||
Basque
|
||||
Bulgarian
|
||||
Catalan
|
||||
Czech
|
||||
Danish
|
||||
Finnish
|
||||
Friulian
|
||||
Galician
|
||||
Georgian
|
||||
Hungarian
|
||||
Lithuanian
|
||||
Polish
|
||||
Portuguese
|
||||
Swedish
|
||||
Turkish
|
||||
Ukrainian
|
||||
|
||||
|
||||
Overview of Changes in 4.10.0, 04-03-2023
|
||||
=========================================
|
||||
|
||||
* GtkTextView
|
||||
- Document hanging indentation
|
||||
|
||||
* GtkListView
|
||||
- Fix a size allocation problem
|
||||
|
||||
* GtkFileChooser
|
||||
- Fix paned behavior
|
||||
- Fix a crash
|
||||
|
||||
* GtkText
|
||||
- Fix various problems with undo
|
||||
|
||||
* Accessibility
|
||||
- Make some getters transfer-full
|
||||
- Allow setting accessible parents and siblings
|
||||
- Add a role for toggle buttons
|
||||
- Miscellaneous property fixes and improvements
|
||||
|
||||
* gtk
|
||||
- Improve the handling resize-during-size-allocate
|
||||
|
||||
* gdk
|
||||
- Introduce GdkTextureDownloader and use it
|
||||
- Make gdk_texture_get_format public
|
||||
|
||||
* gsk
|
||||
- Make mask nodes more versatile
|
||||
- Improve the GL implementation for texture scale nodes
|
||||
|
||||
* X11
|
||||
- Fix key handling during DND
|
||||
|
||||
* Tools
|
||||
- gtk-builder-tool: Try harder to handle templates
|
||||
- gtk-builder-tool: Prefer properties over <child>
|
||||
|
||||
* Translation updates
|
||||
Basque
|
||||
Belarusian
|
||||
Bulgarian
|
||||
Indonesian
|
||||
Galician
|
||||
Georgian
|
||||
German
|
||||
Hebrew
|
||||
Lithuanian
|
||||
Portuguese
|
||||
Spanish
|
||||
Swedish
|
||||
Turkish
|
||||
Ukrainian
|
||||
|
||||
|
||||
Overview of Changes in 4.9.4, 12-02-2023
|
||||
Overview of Changes in 4.9.4, xx-xx-xxxx
|
||||
========================================
|
||||
|
||||
* Printing:
|
||||
- Add a CPDB backend
|
||||
- Drop the lpr backend
|
||||
- Add a CPDB print backend
|
||||
|
||||
* GtkFileDialog:
|
||||
- Robustness fixes
|
||||
@@ -159,28 +10,20 @@ Overview of Changes in 4.9.4, 12-02-2023
|
||||
* GtkScaleButton:
|
||||
- Add an 'active' property
|
||||
|
||||
* GtkSearchEntry:
|
||||
- Add placeholder text
|
||||
|
||||
* Fix conflicting type names between gtk and gio
|
||||
|
||||
* Gsk:
|
||||
- Settable filtering for scaled textures
|
||||
- Add mask nodes
|
||||
- Some robustness and crash fixes
|
||||
|
||||
* Wayland:
|
||||
- Handle dispatch failing in more places
|
||||
|
||||
* Deprecations:
|
||||
- GtkVolumeButton
|
||||
|
||||
* Translation updates:
|
||||
Belarusian
|
||||
Chinese (Taiwan)
|
||||
Georgian
|
||||
Turkish
|
||||
Ukrainian
|
||||
|
||||
|
||||
Overview of Changes in 4.9.3, 04-02-2023
|
||||
|
||||
@@ -9,7 +9,7 @@ constraint_editor_sources = [
|
||||
|
||||
constraint_editor_resources = gnome.compile_resources('constraint_editor_resources',
|
||||
'constraint-editor.gresource.xml',
|
||||
source_dir: meson.current_source_dir(),
|
||||
source_dir: '.',
|
||||
)
|
||||
|
||||
executable('gtk4-constraint-editor',
|
||||
|
||||
+24
-164
@@ -5,8 +5,7 @@ enum
|
||||
{
|
||||
PROP_TEXTURE = 1,
|
||||
PROP_FILTER,
|
||||
PROP_SCALE,
|
||||
PROP_ANGLE,
|
||||
PROP_SCALE
|
||||
};
|
||||
|
||||
struct _Demo3Widget
|
||||
@@ -15,7 +14,6 @@ struct _Demo3Widget
|
||||
|
||||
GdkTexture *texture;
|
||||
float scale;
|
||||
float angle;
|
||||
GskScalingFilter filter;
|
||||
|
||||
GtkWidget *menu;
|
||||
@@ -28,85 +26,10 @@ struct _Demo3WidgetClass
|
||||
|
||||
G_DEFINE_TYPE (Demo3Widget, demo3_widget, GTK_TYPE_WIDGET)
|
||||
|
||||
static gboolean
|
||||
query_tooltip (GtkWidget *widget,
|
||||
int x,
|
||||
int y,
|
||||
gboolean keyboard_mode,
|
||||
GtkTooltip *tooltip,
|
||||
gpointer data)
|
||||
{
|
||||
Demo3Widget *self = DEMO3_WIDGET (widget);
|
||||
GtkWidget *grid;
|
||||
GtkWidget *label;
|
||||
char *s, *s2;
|
||||
const char *filter[] = { "Linear", "Nearest", "Trilinear" };
|
||||
int precision, l;
|
||||
|
||||
grid = gtk_grid_new ();
|
||||
gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
|
||||
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
|
||||
label = gtk_label_new ("Texture");
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
||||
gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1);
|
||||
s = g_strdup_printf ("%d\342\200\206\303\227\342\200\206%d",
|
||||
gdk_texture_get_width (self->texture),
|
||||
gdk_texture_get_height (self->texture));
|
||||
label = gtk_label_new (s);
|
||||
g_free (s);
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 1);
|
||||
gtk_grid_attach (GTK_GRID (grid), label, 1, 0, 1, 1);
|
||||
|
||||
label = gtk_label_new ("Rotation");
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
||||
gtk_grid_attach (GTK_GRID (grid), label, 0, 1, 1, 1);
|
||||
s = g_strdup_printf ("%.1f", self->angle);
|
||||
if (g_str_has_suffix (s, ".0"))
|
||||
s[strlen (s) - 2] = '\0';
|
||||
s2 = g_strconcat (s, "\302\260", NULL);
|
||||
label = gtk_label_new (s2);
|
||||
g_free (s2);
|
||||
g_free (s);
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 1);
|
||||
gtk_grid_attach (GTK_GRID (grid), label, 1, 1, 1, 1);
|
||||
|
||||
label = gtk_label_new ("Scale");
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
||||
gtk_grid_attach (GTK_GRID (grid), label, 0, 2, 1, 1);
|
||||
|
||||
precision = 1;
|
||||
do {
|
||||
s = g_strdup_printf ("%.*f", precision, self->scale);
|
||||
l = strlen (s) - 1;
|
||||
while (s[l] == '0')
|
||||
l--;
|
||||
if (s[l] == '.')
|
||||
s[l] = '\0';
|
||||
precision++;
|
||||
} while (strcmp (s, "0") == 0);
|
||||
|
||||
label = gtk_label_new (s);
|
||||
g_free (s);
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 1);
|
||||
gtk_grid_attach (GTK_GRID (grid), label, 1, 2, 1, 1);
|
||||
|
||||
label = gtk_label_new ("Filter");
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
||||
gtk_grid_attach (GTK_GRID (grid), label, 0, 3, 1, 1);
|
||||
label = gtk_label_new (filter[self->filter]);
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 1);
|
||||
gtk_grid_attach (GTK_GRID (grid), label, 1, 3, 1, 1);
|
||||
|
||||
gtk_tooltip_set_custom (tooltip, grid);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
demo3_widget_init (Demo3Widget *self)
|
||||
{
|
||||
self->scale = 1.f;
|
||||
self->angle = 0.f;
|
||||
self->filter = GSK_SCALING_FILTER_LINEAR;
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
}
|
||||
@@ -129,35 +52,26 @@ demo3_widget_snapshot (GtkWidget *widget,
|
||||
{
|
||||
Demo3Widget *self = DEMO3_WIDGET (widget);
|
||||
int x, y, width, height;
|
||||
double w, h, w2, h2;
|
||||
double w, h;
|
||||
GskRenderNode *node;
|
||||
|
||||
width = gtk_widget_get_width (widget);
|
||||
height = gtk_widget_get_height (widget);
|
||||
|
||||
w2 = w = self->scale * gdk_texture_get_width (self->texture);
|
||||
h2 = h = self->scale * gdk_texture_get_height (self->texture);
|
||||
w = self->scale * gdk_texture_get_width (self->texture);
|
||||
h = self->scale * gdk_texture_get_height (self->texture);
|
||||
|
||||
if (G_APPROX_VALUE (self->angle, 90.f, FLT_EPSILON) ||
|
||||
G_APPROX_VALUE (self->angle, 270.f, FLT_EPSILON))
|
||||
{
|
||||
double s = w2;
|
||||
w2 = h2;
|
||||
h2 = s;
|
||||
}
|
||||
|
||||
x = (width - ceil (w2)) / 2;
|
||||
y = (height - ceil (h2)) / 2;
|
||||
x = MAX (0, (width - ceil (w)) / 2);
|
||||
y = MAX (0, (height - ceil (h)) / 2);
|
||||
|
||||
gtk_snapshot_push_clip (snapshot, &GRAPHENE_RECT_INIT (0, 0, width, height));
|
||||
gtk_snapshot_save (snapshot);
|
||||
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x, y));
|
||||
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (w2 / 2, h2 / 2));
|
||||
gtk_snapshot_rotate (snapshot, self->angle);
|
||||
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (- w / 2, - h / 2));
|
||||
gtk_snapshot_append_scaled_texture (snapshot,
|
||||
self->texture,
|
||||
self->filter,
|
||||
&GRAPHENE_RECT_INIT (0, 0, w, h));
|
||||
node = gsk_texture_scale_node_new (self->texture,
|
||||
&GRAPHENE_RECT_INIT (0, 0, w, h),
|
||||
self->filter);
|
||||
gtk_snapshot_append_node (snapshot, node);
|
||||
gsk_render_node_unref (node);
|
||||
gtk_snapshot_restore (snapshot);
|
||||
gtk_snapshot_pop (snapshot);
|
||||
}
|
||||
@@ -172,26 +86,14 @@ demo3_widget_measure (GtkWidget *widget,
|
||||
int *natural_baseline)
|
||||
{
|
||||
Demo3Widget *self = DEMO3_WIDGET (widget);
|
||||
int width, height;
|
||||
int size;
|
||||
|
||||
width = gdk_texture_get_width (self->texture);
|
||||
height = gdk_texture_get_height (self->texture);
|
||||
|
||||
if (G_APPROX_VALUE (self->angle, 90.f, FLT_EPSILON) ||
|
||||
G_APPROX_VALUE (self->angle, 270.f, FLT_EPSILON))
|
||||
{
|
||||
int s = width;
|
||||
width = height;
|
||||
height = s;
|
||||
}
|
||||
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
size = width;
|
||||
size = gdk_texture_get_width (self->texture);
|
||||
else
|
||||
size = height;
|
||||
size = gdk_texture_get_height (self->texture);
|
||||
|
||||
*minimum = *natural = (int) ceil (self->scale * size);
|
||||
*minimum = *natural = self->scale * size;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -209,8 +111,6 @@ demo3_widget_size_allocate (GtkWidget *widget,
|
||||
gtk_popover_present (GTK_POPOVER (self->menu));
|
||||
}
|
||||
|
||||
static void update_actions (Demo3Widget *self);
|
||||
|
||||
static void
|
||||
demo3_widget_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
@@ -229,12 +129,6 @@ demo3_widget_set_property (GObject *object,
|
||||
|
||||
case PROP_SCALE:
|
||||
self->scale = g_value_get_float (value);
|
||||
update_actions (self);
|
||||
gtk_widget_queue_resize (GTK_WIDGET (object));
|
||||
break;
|
||||
|
||||
case PROP_ANGLE:
|
||||
self->angle = fmodf (g_value_get_float (value), 360.f);
|
||||
gtk_widget_queue_resize (GTK_WIDGET (object));
|
||||
break;
|
||||
|
||||
@@ -267,10 +161,6 @@ demo3_widget_get_property (GObject *object,
|
||||
g_value_set_float (value, self->scale);
|
||||
break;
|
||||
|
||||
case PROP_ANGLE:
|
||||
g_value_set_float (value, self->angle);
|
||||
break;
|
||||
|
||||
case PROP_FILTER:
|
||||
g_value_set_enum (value, self->filter);
|
||||
break;
|
||||
@@ -296,14 +186,6 @@ pressed_cb (GtkGestureClick *gesture,
|
||||
gtk_popover_popup (GTK_POPOVER (self->menu));
|
||||
}
|
||||
|
||||
static void
|
||||
update_actions (Demo3Widget *self)
|
||||
{
|
||||
gtk_widget_action_set_enabled (GTK_WIDGET (self), "zoom.in", self->scale < 1024.);
|
||||
gtk_widget_action_set_enabled (GTK_WIDGET (self), "zoom.out", self->scale > 1./1024.);
|
||||
gtk_widget_action_set_enabled (GTK_WIDGET (self), "zoom.reset", self->scale != 1.);
|
||||
}
|
||||
|
||||
static void
|
||||
zoom_cb (GtkWidget *widget,
|
||||
const char *action_name,
|
||||
@@ -313,30 +195,19 @@ zoom_cb (GtkWidget *widget,
|
||||
float scale;
|
||||
|
||||
if (g_str_equal (action_name, "zoom.in"))
|
||||
scale = MIN (1024., self->scale * M_SQRT2);
|
||||
scale = MIN (10, self->scale * M_SQRT2);
|
||||
else if (g_str_equal (action_name, "zoom.out"))
|
||||
scale = MAX (1./1024., self->scale / M_SQRT2);
|
||||
else if (g_str_equal (action_name, "zoom.reset"))
|
||||
scale = 1.0;
|
||||
scale = MAX (0.01, self->scale / M_SQRT2);
|
||||
else
|
||||
g_assert_not_reached ();
|
||||
scale = 1.0;
|
||||
|
||||
gtk_widget_action_set_enabled (widget, "zoom.in", scale < 10);
|
||||
gtk_widget_action_set_enabled (widget, "zoom.out", scale > 0.01);
|
||||
gtk_widget_action_set_enabled (widget, "zoom.reset", scale != 1);
|
||||
|
||||
g_object_set (widget, "scale", scale, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
rotate_cb (GtkWidget *widget,
|
||||
const char *action_name,
|
||||
GVariant *parameter)
|
||||
{
|
||||
Demo3Widget *self = DEMO3_WIDGET (widget);
|
||||
int angle;
|
||||
|
||||
g_variant_get (parameter, "i", &angle);
|
||||
|
||||
g_object_set (widget, "angle", fmodf (self->angle + angle, 360.f), NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
demo3_widget_class_init (Demo3WidgetClass *class)
|
||||
{
|
||||
@@ -358,12 +229,7 @@ demo3_widget_class_init (Demo3WidgetClass *class)
|
||||
|
||||
g_object_class_install_property (object_class, PROP_SCALE,
|
||||
g_param_spec_float ("scale", NULL, NULL,
|
||||
1./1024., 1024., 1.0,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_ANGLE,
|
||||
g_param_spec_float ("angle", NULL, NULL,
|
||||
0.0, 360.0, 0.0,
|
||||
0.0, 10.0, 1.0,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_FILTER,
|
||||
@@ -375,7 +241,6 @@ demo3_widget_class_init (Demo3WidgetClass *class)
|
||||
gtk_widget_class_install_action (widget_class, "zoom.in", NULL, zoom_cb);
|
||||
gtk_widget_class_install_action (widget_class, "zoom.out", NULL, zoom_cb);
|
||||
gtk_widget_class_install_action (widget_class, "zoom.reset", NULL, zoom_cb);
|
||||
gtk_widget_class_install_action (widget_class, "rotate", "i", rotate_cb);
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/menu/demo3widget.ui");
|
||||
gtk_widget_class_bind_template_child (widget_class, Demo3Widget, menu);
|
||||
@@ -390,12 +255,7 @@ demo3_widget_new (const char *resource)
|
||||
|
||||
texture = gdk_texture_new_from_resource (resource);
|
||||
|
||||
self = g_object_new (DEMO3_TYPE_WIDGET,
|
||||
"texture", texture,
|
||||
"has-tooltip", TRUE,
|
||||
NULL);
|
||||
|
||||
g_signal_connect (self, "query-tooltip", G_CALLBACK (query_tooltip), NULL);
|
||||
self = g_object_new (DEMO3_TYPE_WIDGET, "texture", texture, NULL);
|
||||
|
||||
g_object_unref (texture);
|
||||
|
||||
|
||||
@@ -12,11 +12,6 @@
|
||||
<attribute name="label">1∶1</attribute>
|
||||
<attribute name="action">zoom.reset</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label">Rotate</attribute>
|
||||
<attribute name="action">rotate</attribute>
|
||||
<attribute name="target" type="i">90</attribute>
|
||||
</item>
|
||||
</menu>
|
||||
<template class="Demo3Widget">
|
||||
<child>
|
||||
|
||||
@@ -2,19 +2,12 @@
|
||||
#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;
|
||||
};
|
||||
@@ -56,8 +49,6 @@ 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 };
|
||||
@@ -92,24 +83,16 @@ demo4_widget_dispose (GObject *object)
|
||||
}
|
||||
|
||||
static void
|
||||
demo4_widget_snapshot_content (GtkWidget *widget,
|
||||
GtkSnapshot *snapshot,
|
||||
GskMaskMode mode)
|
||||
demo4_widget_snapshot (GtkWidget *widget,
|
||||
GtkSnapshot *snapshot)
|
||||
{
|
||||
Demo4Widget *self = DEMO4_WIDGET (widget);
|
||||
int width, height, layout_width, layout_height;
|
||||
double scale;
|
||||
int width, height;
|
||||
|
||||
width = gtk_widget_get_width (widget);
|
||||
height = gtk_widget_get_height (widget);
|
||||
|
||||
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_push_mask (snapshot);
|
||||
gtk_snapshot_append_layout (snapshot, self->layout, &(GdkRGBA) { 0, 0, 0, 1 });
|
||||
gtk_snapshot_pop (snapshot);
|
||||
|
||||
@@ -122,84 +105,6 @@ demo4_widget_snapshot_content (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)
|
||||
{
|
||||
@@ -207,15 +112,8 @@ 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 *
|
||||
@@ -223,4 +121,3 @@ demo4_widget_new (void)
|
||||
{
|
||||
return g_object_new (DEMO4_TYPE_WIDGET, NULL);
|
||||
}
|
||||
|
||||
|
||||
+1
-12
@@ -356,10 +356,6 @@ canvas_item_start_editing (CanvasItem *item)
|
||||
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
double x, y;
|
||||
} Hotspot;
|
||||
|
||||
static GdkContentProvider *
|
||||
prepare (GtkDragSource *source,
|
||||
double x,
|
||||
@@ -367,7 +363,6 @@ 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);
|
||||
@@ -378,10 +373,6 @@ 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);
|
||||
}
|
||||
|
||||
@@ -392,14 +383,12 @@ 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, hotspot->x, hotspot->y);
|
||||
gtk_drag_source_set_icon (source, paintable, item->r, item->r);
|
||||
g_object_unref (paintable);
|
||||
|
||||
gtk_widget_set_opacity (GTK_WIDGET (item), 0.3);
|
||||
|
||||
+10
-12
@@ -48,16 +48,14 @@
|
||||
#define VERTICES_PER_TOOTH 34
|
||||
#define GEAR_VERTEX_STRIDE 6
|
||||
|
||||
static inline void
|
||||
_sincos (double x, double *_sin, double *_cos)
|
||||
#ifndef HAVE_SINCOS
|
||||
static void
|
||||
sincos (double x, double *_sin, double *_cos)
|
||||
{
|
||||
#ifdef HAVE_SINCOS
|
||||
sincos (x, _sin, _cos);
|
||||
#else
|
||||
*_sin = sin (x);
|
||||
*_cos = cos (x);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Struct describing the vertices in triangle strip
|
||||
@@ -309,11 +307,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);
|
||||
@@ -522,7 +520,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;
|
||||
|
||||
+5
-12
@@ -18,8 +18,7 @@ do_mask (GtkWidget *do_widget)
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *box;
|
||||
GtkWidget *demo;
|
||||
GtkWidget *scale;
|
||||
GtkWidget *widget;
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Mask Nodes");
|
||||
@@ -31,17 +30,11 @@ do_mask (GtkWidget *do_widget)
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_window_set_child (GTK_WINDOW (window), box);
|
||||
|
||||
demo = demo4_widget_new ();
|
||||
gtk_widget_set_hexpand (demo, TRUE);
|
||||
gtk_widget_set_vexpand (demo, TRUE);
|
||||
widget = demo4_widget_new ();
|
||||
gtk_widget_set_hexpand (widget, TRUE);
|
||||
gtk_widget_set_vexpand (widget, TRUE);
|
||||
|
||||
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);
|
||||
gtk_box_append (GTK_BOX (box), widget);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
||||
+14
-133
@@ -1,120 +1,18 @@
|
||||
/* Image Scaling
|
||||
* #Keywords: zoom, scale, filter, action, menu
|
||||
/* Menu
|
||||
* #Keywords: action, zoom
|
||||
*
|
||||
* Demonstrates how to add a context menu to a custom widget
|
||||
* and connect it with widget actions.
|
||||
*
|
||||
* The custom widget we create here is similar to a GtkPicture,
|
||||
* but allows setting a zoom level and filtering mode for the
|
||||
* displayed paintable.
|
||||
* but allows setting a zoom level for the displayed paintable.
|
||||
*
|
||||
* It also demonstrates how to add a context menu to a custom
|
||||
* widget and connect it with widget actions.
|
||||
*
|
||||
* The context menu has items to change the zoom level.
|
||||
* Our context menu has items to change the zoom level.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "demo3widget.h"
|
||||
|
||||
static void
|
||||
file_opened (GObject *source,
|
||||
GAsyncResult *result,
|
||||
void *data)
|
||||
{
|
||||
GFile *file;
|
||||
GError *error = NULL;
|
||||
GdkTexture *texture;
|
||||
|
||||
file = gtk_file_dialog_open_finish (GTK_FILE_DIALOG (source), result, &error);
|
||||
|
||||
if (!file)
|
||||
{
|
||||
g_print ("%s\n", error->message);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
texture = gdk_texture_new_from_file (file, &error);
|
||||
g_object_unref (file);
|
||||
if (!texture)
|
||||
{
|
||||
g_print ("%s\n", error->message);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
g_object_set (G_OBJECT (data), "texture", texture, NULL);
|
||||
g_object_unref (texture);
|
||||
}
|
||||
|
||||
static void
|
||||
open_file (GtkWidget *picker,
|
||||
GtkWidget *demo)
|
||||
{
|
||||
GtkWindow *parent = GTK_WINDOW (gtk_widget_get_root (picker));
|
||||
GtkFileDialog *dialog;
|
||||
GtkFileFilter *filter;
|
||||
GListStore *filters;
|
||||
|
||||
dialog = gtk_file_dialog_new ();
|
||||
|
||||
filter = gtk_file_filter_new ();
|
||||
gtk_file_filter_set_name (filter, "Images");
|
||||
gtk_file_filter_add_pixbuf_formats (filter);
|
||||
filters = g_list_store_new (GTK_TYPE_FILE_FILTER);
|
||||
g_list_store_append (filters, filter);
|
||||
g_object_unref (filter);
|
||||
|
||||
gtk_file_dialog_set_filters (dialog, G_LIST_MODEL (filters));
|
||||
g_object_unref (filters);
|
||||
|
||||
gtk_file_dialog_open (dialog, parent, NULL, file_opened, demo);
|
||||
|
||||
g_object_unref (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
rotate (GtkWidget *button,
|
||||
GtkWidget *demo)
|
||||
{
|
||||
float angle;
|
||||
|
||||
g_object_get (demo, "angle", &angle, NULL);
|
||||
|
||||
angle = fmodf (angle + 90.f, 360.f);
|
||||
|
||||
g_object_set (demo, "angle", angle, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
transform_to (GBinding *binding,
|
||||
const GValue *src,
|
||||
GValue *dest,
|
||||
gpointer user_data)
|
||||
{
|
||||
double from;
|
||||
float to;
|
||||
|
||||
from = g_value_get_double (src);
|
||||
to = (float) pow (2., from);
|
||||
g_value_set_float (dest, to);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
transform_from (GBinding *binding,
|
||||
const GValue *src,
|
||||
GValue *dest,
|
||||
gpointer user_data)
|
||||
{
|
||||
float to;
|
||||
double from;
|
||||
|
||||
to = g_value_get_float (src);
|
||||
from = log2 (to);
|
||||
g_value_set_double (dest, from);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_menu (GtkWidget *do_widget)
|
||||
@@ -129,10 +27,9 @@ do_menu (GtkWidget *do_widget)
|
||||
GtkWidget *widget;
|
||||
GtkWidget *scale;
|
||||
GtkWidget *dropdown;
|
||||
GtkWidget *button;
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Image Scaling");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Menu");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
@@ -151,35 +48,19 @@ do_menu (GtkWidget *do_widget)
|
||||
box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_box_append (GTK_BOX (box), box2);
|
||||
|
||||
button = gtk_button_new_from_icon_name ("document-open-symbolic");
|
||||
gtk_widget_set_tooltip_text (button, "Open File");
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (open_file), widget);
|
||||
gtk_box_append (GTK_BOX (box2), button);
|
||||
|
||||
button = gtk_button_new_from_icon_name ("object-rotate-right-symbolic");
|
||||
gtk_widget_set_tooltip_text (button, "Rotate");
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (rotate), widget);
|
||||
gtk_box_append (GTK_BOX (box2), button);
|
||||
|
||||
scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, -10., 10., 0.1);
|
||||
gtk_scale_add_mark (GTK_SCALE (scale), 0., GTK_POS_TOP, NULL);
|
||||
gtk_widget_set_tooltip_text (scale, "Zoom");
|
||||
gtk_range_set_value (GTK_RANGE (scale), 0.);
|
||||
scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0.01, 10.0, 0.1);
|
||||
gtk_range_set_value (GTK_RANGE (scale), 1.0);
|
||||
gtk_widget_set_hexpand (scale, TRUE);
|
||||
gtk_box_append (GTK_BOX (box2), scale);
|
||||
|
||||
dropdown = gtk_drop_down_new (G_LIST_MODEL (gtk_string_list_new ((const char *[]){ "Linear", "Nearest", "Trilinear", NULL })), NULL);
|
||||
gtk_widget_set_tooltip_text (dropdown, "Filter");
|
||||
gtk_box_append (GTK_BOX (box2), dropdown);
|
||||
|
||||
g_object_bind_property (dropdown, "selected", widget, "filter", G_BINDING_DEFAULT);
|
||||
|
||||
g_object_bind_property_full (gtk_range_get_adjustment (GTK_RANGE (scale)), "value",
|
||||
widget, "scale",
|
||||
G_BINDING_BIDIRECTIONAL,
|
||||
transform_to,
|
||||
transform_from,
|
||||
NULL, NULL);
|
||||
|
||||
g_object_bind_property (gtk_range_get_adjustment (GTK_RANGE (scale)), "value",
|
||||
widget, "scale",
|
||||
G_BINDING_BIDIRECTIONAL);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
||||
@@ -225,7 +225,7 @@ if not meson.is_cross_build() and build_machine.cpu_family() != 'arm' and build_
|
||||
else
|
||||
gtkdemo_resources = gnome.compile_resources('gtkdemo_resources',
|
||||
'demo.gresource.xml',
|
||||
source_dir: meson.current_source_dir()
|
||||
source_dir: '.',
|
||||
)
|
||||
endif
|
||||
|
||||
|
||||
@@ -13,13 +13,20 @@
|
||||
static GtkWidget *app_picker;
|
||||
|
||||
static void
|
||||
set_file (GFile *file,
|
||||
gpointer data)
|
||||
file_opened (GObject *source,
|
||||
GAsyncResult *result,
|
||||
void *data)
|
||||
{
|
||||
GFile *file;
|
||||
GError *error = NULL;
|
||||
char *name;
|
||||
|
||||
file = gtk_file_dialog_open_finish (GTK_FILE_DIALOG (source), result, &error);
|
||||
|
||||
if (!file)
|
||||
{
|
||||
g_print ("%s\n", error->message);
|
||||
g_error_free (error);
|
||||
gtk_widget_set_sensitive (app_picker, FALSE);
|
||||
g_object_set_data (G_OBJECT (app_picker), "file", NULL);
|
||||
return;
|
||||
@@ -33,25 +40,6 @@ set_file (GFile *file,
|
||||
g_object_set_data_full (G_OBJECT (app_picker), "file", g_object_ref (file), g_object_unref);
|
||||
}
|
||||
|
||||
static void
|
||||
file_opened (GObject *source,
|
||||
GAsyncResult *result,
|
||||
void *data)
|
||||
{
|
||||
GFile *file;
|
||||
GError *error = NULL;
|
||||
|
||||
file = gtk_file_dialog_open_finish (GTK_FILE_DIALOG (source), result, &error);
|
||||
|
||||
if (!file)
|
||||
{
|
||||
g_print ("%s\n", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
set_file (file, data);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
abort_mission (gpointer data)
|
||||
{
|
||||
@@ -142,28 +130,11 @@ launch_uri (GtkButton *picker)
|
||||
g_object_unref (launcher);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
on_drop (GtkDropTarget *target,
|
||||
const GValue *value,
|
||||
double x,
|
||||
double y,
|
||||
gpointer data)
|
||||
{
|
||||
if (G_VALUE_HOLDS (value, G_TYPE_FILE))
|
||||
{
|
||||
set_file (g_value_get_object (value), data);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_pickers (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
GtkWidget *table, *label, *picker, *button;
|
||||
GtkDropTarget *drop_target;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
@@ -208,13 +179,7 @@ do_pickers (GtkWidget *do_widget)
|
||||
|
||||
picker = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
||||
button = gtk_button_new_from_icon_name ("document-open-symbolic");
|
||||
|
||||
label = gtk_label_new ("None");
|
||||
|
||||
drop_target = gtk_drop_target_new (G_TYPE_FILE, GDK_ACTION_COPY);
|
||||
g_signal_connect (drop_target, "drop", G_CALLBACK (on_drop), label);
|
||||
gtk_widget_add_controller (button, GTK_EVENT_CONTROLLER (drop_target));
|
||||
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 0.);
|
||||
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_MIDDLE);
|
||||
gtk_widget_set_hexpand (label, TRUE);
|
||||
|
||||
@@ -22,7 +22,6 @@ show_shortcuts (GtkWidget *window,
|
||||
gtk_window_set_transient_for (GTK_WINDOW (overlay), GTK_WINDOW (window));
|
||||
g_object_set (overlay, "view-name", view, NULL);
|
||||
g_object_unref (builder);
|
||||
gtk_window_present (GTK_WINDOW (overlay));
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT void
|
||||
|
||||
@@ -8,7 +8,7 @@ iconbrowser_sources = [
|
||||
|
||||
iconbrowser_resources = gnome.compile_resources('iconbrowser_resources',
|
||||
'iconbrowser.gresource.xml',
|
||||
source_dir: meson.current_source_dir(),
|
||||
source_dir: '.',
|
||||
)
|
||||
|
||||
executable('gtk4-icon-browser',
|
||||
|
||||
@@ -7,7 +7,7 @@ node_editor_sources = [
|
||||
|
||||
node_editor_resources = gnome.compile_resources('node_editor_resources',
|
||||
'node-editor.gresource.xml',
|
||||
source_dir: meson.current_source_dir(),
|
||||
source_dir: '.',
|
||||
)
|
||||
|
||||
executable('gtk4-node-editor',
|
||||
|
||||
@@ -32,11 +32,6 @@
|
||||
#include "gsk/vulkan/gskvulkanrenderer.h"
|
||||
#endif
|
||||
|
||||
#include <cairo.h>
|
||||
#ifdef CAIRO_HAS_SVG_SURFACE
|
||||
#include <cairo-svg.h>
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gsize start_chars;
|
||||
@@ -648,34 +643,23 @@ save_cb (GtkWidget *button,
|
||||
g_object_unref (dialog);
|
||||
}
|
||||
|
||||
static GskRenderNode *
|
||||
create_node (NodeEditorWindow *self)
|
||||
static GdkTexture *
|
||||
create_texture (NodeEditorWindow *self)
|
||||
{
|
||||
GdkPaintable *paintable;
|
||||
GtkSnapshot *snapshot;
|
||||
GskRenderer *renderer;
|
||||
GskRenderNode *node;
|
||||
GdkTexture *texture;
|
||||
|
||||
paintable = gtk_picture_get_paintable (GTK_PICTURE (self->picture));
|
||||
if (paintable == NULL ||
|
||||
gdk_paintable_get_intrinsic_width (paintable) <= 0 ||
|
||||
gdk_paintable_get_intrinsic_height (paintable) <= 0)
|
||||
return NULL;
|
||||
|
||||
snapshot = gtk_snapshot_new ();
|
||||
gdk_paintable_snapshot (paintable, snapshot, gdk_paintable_get_intrinsic_width (paintable), gdk_paintable_get_intrinsic_height (paintable));
|
||||
node = gtk_snapshot_free_to_node (snapshot);
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
static GdkTexture *
|
||||
create_texture (NodeEditorWindow *self)
|
||||
{
|
||||
GskRenderer *renderer;
|
||||
GskRenderNode *node;
|
||||
GdkTexture *texture;
|
||||
|
||||
node = create_node (self);
|
||||
if (node == NULL)
|
||||
return NULL;
|
||||
|
||||
@@ -686,58 +670,6 @@ create_texture (NodeEditorWindow *self)
|
||||
return texture;
|
||||
}
|
||||
|
||||
#ifdef CAIRO_HAS_SVG_SURFACE
|
||||
static cairo_status_t
|
||||
cairo_serializer_write (gpointer user_data,
|
||||
const unsigned char *data,
|
||||
unsigned int length)
|
||||
{
|
||||
g_byte_array_append (user_data, data, length);
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static GBytes *
|
||||
create_svg (GskRenderNode *node,
|
||||
GError **error)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
cairo_t *cr;
|
||||
graphene_rect_t bounds;
|
||||
GByteArray *array;
|
||||
|
||||
gsk_render_node_get_bounds (node, &bounds);
|
||||
array = g_byte_array_new ();
|
||||
|
||||
surface = cairo_svg_surface_create_for_stream (cairo_serializer_write,
|
||||
array,
|
||||
bounds.size.width,
|
||||
bounds.size.height);
|
||||
cairo_svg_surface_set_document_unit (surface, CAIRO_SVG_UNIT_PX);
|
||||
cairo_surface_set_device_offset (surface, -bounds.origin.x, -bounds.origin.y);
|
||||
|
||||
cr = cairo_create (surface);
|
||||
gsk_render_node_draw (node, cr);
|
||||
cairo_destroy (cr);
|
||||
|
||||
cairo_surface_finish (surface);
|
||||
if (cairo_surface_status (surface) == CAIRO_STATUS_SUCCESS)
|
||||
{
|
||||
cairo_surface_destroy (surface);
|
||||
return g_byte_array_free_to_bytes (array);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_set_error (error,
|
||||
G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
"%s", cairo_status_to_string (cairo_surface_status (surface)));
|
||||
cairo_surface_destroy (surface);
|
||||
g_byte_array_unref (array);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static GdkTexture *
|
||||
create_cairo_texture (NodeEditorWindow *self)
|
||||
{
|
||||
@@ -770,140 +702,50 @@ create_cairo_texture (NodeEditorWindow *self)
|
||||
}
|
||||
|
||||
static void
|
||||
export_image_saved_cb (GObject *source,
|
||||
GAsyncResult *result,
|
||||
void *user_data)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!g_file_replace_contents_finish (G_FILE (source), result, NULL, &error))
|
||||
{
|
||||
GtkAlertDialog *alert;
|
||||
|
||||
alert = gtk_alert_dialog_new ("Exporting to image failed");
|
||||
gtk_alert_dialog_set_detail (alert, error->message);
|
||||
gtk_alert_dialog_show (alert, NULL);
|
||||
g_object_unref (alert);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
export_image_response_cb (GObject *source,
|
||||
export_image_response_cb (GObject *source,
|
||||
GAsyncResult *result,
|
||||
void *user_data)
|
||||
void *user_data)
|
||||
{
|
||||
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
|
||||
GskRenderNode *node = user_data;
|
||||
GdkTexture *texture = user_data;
|
||||
GFile *file;
|
||||
char *uri;
|
||||
GBytes *bytes;
|
||||
|
||||
file = gtk_file_dialog_save_finish (dialog, result, NULL);
|
||||
if (file == NULL)
|
||||
if (file)
|
||||
{
|
||||
gsk_render_node_unref (node);
|
||||
return;
|
||||
}
|
||||
|
||||
uri = g_file_get_uri (file);
|
||||
#ifdef CAIRO_HAS_SVG_SURFACE
|
||||
if (g_str_has_suffix (uri, "svg"))
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
bytes = create_svg (node, &error);
|
||||
if (bytes == NULL)
|
||||
if (!gdk_texture_save_to_png (texture, g_file_peek_path (file)))
|
||||
{
|
||||
GtkAlertDialog *alert;
|
||||
|
||||
alert = gtk_alert_dialog_new ("Exporting to image failed");
|
||||
gtk_alert_dialog_set_detail (alert, error->message);
|
||||
gtk_alert_dialog_show (alert, NULL);
|
||||
gtk_alert_dialog_show (alert, GTK_WINDOW (gtk_window_get_transient_for (GTK_WINDOW (dialog))));
|
||||
g_object_unref (alert);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
GdkTexture *texture;
|
||||
GskRenderer *renderer;
|
||||
|
||||
renderer = gsk_gl_renderer_new ();
|
||||
if (!gsk_renderer_realize (renderer, NULL, NULL))
|
||||
{
|
||||
g_object_unref (renderer);
|
||||
renderer = gsk_cairo_renderer_new ();
|
||||
if (!gsk_renderer_realize (renderer, NULL, NULL))
|
||||
{
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
texture = gsk_renderer_render_texture (renderer, node, NULL);
|
||||
gsk_renderer_unrealize (renderer);
|
||||
g_object_unref (renderer);
|
||||
|
||||
if (g_str_has_suffix (uri, "tiff"))
|
||||
bytes = gdk_texture_save_to_tiff_bytes (texture);
|
||||
else
|
||||
bytes = gdk_texture_save_to_png_bytes (texture);
|
||||
g_object_unref (texture);
|
||||
g_object_unref (file);
|
||||
}
|
||||
g_free (uri);
|
||||
|
||||
if (bytes)
|
||||
{
|
||||
g_file_replace_contents_bytes_async (file,
|
||||
bytes,
|
||||
NULL,
|
||||
FALSE,
|
||||
0,
|
||||
NULL,
|
||||
export_image_saved_cb,
|
||||
NULL);
|
||||
g_bytes_unref (bytes);
|
||||
}
|
||||
gsk_render_node_unref (node);
|
||||
g_object_unref (file);
|
||||
g_object_unref (texture);
|
||||
}
|
||||
|
||||
static void
|
||||
export_image_cb (GtkWidget *button,
|
||||
NodeEditorWindow *self)
|
||||
{
|
||||
GskRenderNode *node;
|
||||
GdkTexture *texture;
|
||||
GtkFileDialog *dialog;
|
||||
GtkFileFilter *filter;
|
||||
GListStore *filters;
|
||||
|
||||
node = create_node (self);
|
||||
if (node == NULL)
|
||||
texture = create_texture (self);
|
||||
if (texture == NULL)
|
||||
return;
|
||||
|
||||
filters = g_list_store_new (GTK_TYPE_FILE_FILTER);
|
||||
filter = gtk_file_filter_new ();
|
||||
gtk_file_filter_add_mime_type (filter, "image/png");
|
||||
g_list_store_append (filters, filter);
|
||||
g_object_unref (filter);
|
||||
filter = gtk_file_filter_new ();
|
||||
gtk_file_filter_add_mime_type (filter, "image/svg+xml");
|
||||
g_list_store_append (filters, filter);
|
||||
g_object_unref (filter);
|
||||
filter = gtk_file_filter_new ();
|
||||
gtk_file_filter_add_mime_type (filter, "image/tiff");
|
||||
g_list_store_append (filters, filter);
|
||||
g_object_unref (filter);
|
||||
|
||||
dialog = gtk_file_dialog_new ();
|
||||
gtk_file_dialog_set_title (dialog, "");
|
||||
gtk_file_dialog_set_initial_name (dialog, "example.png");
|
||||
gtk_file_dialog_set_filters (dialog, G_LIST_MODEL (filters));
|
||||
gtk_file_dialog_save (dialog,
|
||||
GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (button))),
|
||||
NULL,
|
||||
export_image_response_cb, node);
|
||||
g_object_unref (filters);
|
||||
export_image_response_cb, texture);
|
||||
g_object_unref (dialog);
|
||||
}
|
||||
|
||||
|
||||
@@ -178,16 +178,6 @@ 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 |
|
||||
|
||||
@@ -69,7 +69,7 @@ if not meson.is_cross_build() and build_machine.cpu_family() != 'arm' and build_
|
||||
else
|
||||
widgetfactory_resources = gnome.compile_resources('widgetfactory_resources',
|
||||
'widget-factory.gresource.xml',
|
||||
source_dir: meson.current_source_dir(),
|
||||
source_dir: '.',
|
||||
)
|
||||
endif
|
||||
|
||||
|
||||
@@ -239,14 +239,14 @@ control whether Vulkan should be used.
|
||||
### `media-gstreamer` and `media-ffmpeg`
|
||||
|
||||
By default, GTK will try to build the gstreamer backend for
|
||||
media playback support. These options can be used to explicitly
|
||||
media playback support. These option can be used to explicitly
|
||||
control which media backends should be built.
|
||||
|
||||
### `print-cups` and `print-cpdb`
|
||||
### `print-cups`
|
||||
|
||||
By default, GTK will try to build the cups and file print backends
|
||||
if their dependencies are found. These options can be used to
|
||||
explicitly control which print backends should be built.
|
||||
By default, GTK will try to build various print backends
|
||||
if their dependencies are found. This option can be used
|
||||
to explicitly control whether the cups print backend should be built.
|
||||
|
||||
### `cloudproviders`
|
||||
|
||||
|
||||
@@ -66,10 +66,6 @@ You can compile the program above with GCC using:
|
||||
gcc $( pkg-config --cflags gtk4 ) -o example-0 example-0.c $( pkg-config --libs gtk4 )
|
||||
```
|
||||
|
||||
**Note**: If the above compilation does not work due to an error regarding `G_APPLICATION_DEFAULT_FLAGS`
|
||||
this could be due to your OS providing an older version of GLib. For GLib versions older than 2.74 you
|
||||
will need to replace `G_APPLICATION_DEFAULT_FLAGS` with `G_APPLICATION_FLAGS_NONE` in this example, and
|
||||
others in this documentation.
|
||||
For more information on how to compile a GTK application, please
|
||||
refer to the [Compiling GTK Applications](compiling.html)
|
||||
section in this reference.
|
||||
|
||||
@@ -33,11 +33,6 @@ 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,50 +7,37 @@ the question you have, this list is a good place to start.
|
||||
|
||||
## General Questions
|
||||
|
||||
* How do I get started with GTK?
|
||||
1. 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
|
||||
This reference manual also contains a introductory
|
||||
(most of it about GTK 2.x and 3.x, but still somewhat applicable). 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.
|
||||
|
||||
* Where can I get help with GTK, submit a bug report, or make a feature request?
|
||||
2. Where can I get help with GTK, submit a bug report, or make a feature request?
|
||||
|
||||
See the [documentation](#gtk-resources) on this topic.
|
||||
|
||||
* How do I port from one GTK version to another?
|
||||
3. How do I port from one GTK version to another?
|
||||
|
||||
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
|
||||
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
|
||||
[file a bug report](https://gitlab.gnome.org/GNOME/gtk/issues/new) against the
|
||||
documentation.
|
||||
|
||||
* 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?
|
||||
4. 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
|
||||
@@ -59,7 +46,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.
|
||||
|
||||
* Why does my program leak memory, if I destroy a widget immediately
|
||||
5. Why does my program leak memory, if I destroy a widget immediately
|
||||
after creating it?
|
||||
|
||||
If `GtkFoo` isn't a toplevel window, then
|
||||
@@ -82,7 +69,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.
|
||||
|
||||
* How do I use GTK with threads?
|
||||
6. 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_).
|
||||
@@ -92,7 +79,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`.
|
||||
|
||||
* How do I internationalize a GTK program?
|
||||
7. 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
|
||||
@@ -147,7 +134,7 @@ the question you have, this list is a good place to start.
|
||||
|
||||
#define _(x) dgettext (GETTEXT_PACKAGE, x)
|
||||
|
||||
* How do I use non-ASCII characters in GTK programs ?
|
||||
8. 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
|
||||
@@ -230,7 +217,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.
|
||||
|
||||
* How do I use GTK with C++?
|
||||
9. 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
|
||||
@@ -255,23 +242,19 @@ the question you have, this list is a good place to start.
|
||||
|
||||
There are very few functions that require this cast, however.
|
||||
|
||||
* How do I use GTK with other non-C languages?
|
||||
10. 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).
|
||||
|
||||
* How do I load an image or animation from a file?
|
||||
11. How do I load an image or animation from a file?
|
||||
|
||||
To load an image file straight into a display widget, use
|
||||
[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].
|
||||
[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].
|
||||
|
||||
* 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].
|
||||
12. How do I draw text?
|
||||
|
||||
To draw a piece of text onto a cairo surface, use a Pango layout and
|
||||
[func@PangoCairo.show_layout].
|
||||
@@ -289,7 +272,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].
|
||||
|
||||
* How do I measure the size of a piece of text?
|
||||
13. 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:
|
||||
@@ -304,7 +287,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/).
|
||||
|
||||
* Why are types not registered if I use their `GTK_TYPE_BLAH` macro?
|
||||
14. 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
|
||||
@@ -315,14 +298,14 @@ the question you have, this list is a good place to start.
|
||||
|
||||
g_type_ensure (GTK_TYPE_BLAH);
|
||||
|
||||
* How do I create a transparent toplevel window?
|
||||
15. 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...
|
||||
|
||||
* ...for lists and trees?
|
||||
16. ...for lists and trees?
|
||||
|
||||
This question has different answers, depending on the size of the dataset
|
||||
and the required formatting flexibility.
|
||||
@@ -338,7 +321,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.
|
||||
|
||||
* ...for multi-line text display or editing?
|
||||
17. ...for multi-line text display or editing?
|
||||
|
||||
See the [text widget overview](#TextWidget) -- you should use the
|
||||
[class@Gtk.TextView] widget.
|
||||
@@ -347,7 +330,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].
|
||||
|
||||
* ...to display an image or animation?
|
||||
18. ...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.
|
||||
@@ -363,14 +346,17 @@ 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));
|
||||
|
||||
* ...for presenting a set of mutually-exclusive choices, where Windows
|
||||
19. ...for presenting a set of mutually-exclusive choices, where Windows
|
||||
would use a combo box?
|
||||
|
||||
With GTK, a [class@Gtk.DropDown] is the recommended widget to use for this use case.
|
||||
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].
|
||||
|
||||
## Questions about GtkWidget
|
||||
|
||||
* How do I change the color of a widget?
|
||||
20. 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
|
||||
@@ -378,7 +364,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].
|
||||
|
||||
* How do I change the font of a widget?
|
||||
21. 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():
|
||||
@@ -402,14 +388,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.
|
||||
|
||||
* How do I disable/ghost/desensitize a widget?
|
||||
22. How do I disable/ghost/desensitize a widget?
|
||||
|
||||
In GTK a disabled widget is termed _insensitive_.
|
||||
See [method@Gtk.Widget.set_sensitive].
|
||||
|
||||
## GtkTextView questions
|
||||
|
||||
* How do I get the contents of the entire text widget as a string?
|
||||
23. 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].
|
||||
@@ -424,14 +410,14 @@ the question you have, this list is a good place to start.
|
||||
/* use text */
|
||||
g_free (text);
|
||||
|
||||
* How do I make a text widget display its complete contents in a specific font?
|
||||
24. 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.
|
||||
|
||||
* How do I make a text view scroll to the end of the buffer automatically ?
|
||||
25. 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.
|
||||
@@ -446,21 +432,21 @@ the question you have, this list is a good place to start.
|
||||
|
||||
## GtkTreeView questions
|
||||
|
||||
* How do I associate some data with a row in the tree?
|
||||
26. 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).
|
||||
|
||||
* How do I put an image and some text in the same column?
|
||||
27. 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.
|
||||
|
||||
* I can set data easily on my [class@Gtk.TreeStore] or [class@Gtk.ListStore] models using
|
||||
28. 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]
|
||||
@@ -468,7 +454,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].
|
||||
|
||||
* How do I change the way that numbers are formatted by `GtkTreeView`?
|
||||
29. 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
|
||||
@@ -542,21 +528,19 @@ the question you have, this list is a good place to start.
|
||||
(gpointer)DOUBLE_COLUMN, NULL);
|
||||
}
|
||||
|
||||
* How do I hide the expander arrows in my tree view?
|
||||
30. 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
|
||||
|
||||
* How do I use cairo to draw in GTK applications?
|
||||
31. How do I use cairo to draw in GTK applications?
|
||||
|
||||
[class@Gtk.DrawingArea] is a ready-made widget for drawing with cairo.
|
||||
Use [method@Gtk.Snapshot.append_cairo] in your [vfunc@Gtk.Widget.snapshot] vfunc
|
||||
to obtain a cairo context and draw with that.
|
||||
|
||||
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
|
||||
32. 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
|
||||
@@ -567,7 +551,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].
|
||||
|
||||
* Can I use cairo to draw on a `GdkPixbuf`?
|
||||
33. Can I use cairo to draw on a `GdkPixbuf`?
|
||||
|
||||
No. The cairo image surface does not support the pixel format used by `GdkPixbuf`.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
app2_resources = gnome.compile_resources('exampleapp2_resources',
|
||||
'exampleapp.gresource.xml',
|
||||
source_dir: meson.current_source_dir())
|
||||
source_dir: '.')
|
||||
|
||||
executable('exampleapp2',
|
||||
'exampleapp.c', 'exampleappwin.c', 'main.c', app2_resources,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
app3_resources = gnome.compile_resources('exampleapp3_resources',
|
||||
'exampleapp.gresource.xml',
|
||||
source_dir: meson.current_source_dir())
|
||||
source_dir: '.')
|
||||
|
||||
executable('exampleapp3',
|
||||
'exampleapp.c', 'exampleappwin.c', 'main.c', app3_resources,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
app4_resources = gnome.compile_resources('exampleapp4_resources',
|
||||
'exampleapp.gresource.xml',
|
||||
source_dir: meson.current_source_dir())
|
||||
source_dir: '.')
|
||||
|
||||
executable('exampleapp4',
|
||||
'exampleapp.c', 'exampleappwin.c', 'main.c', app4_resources,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
app5_resources = gnome.compile_resources('exampleapp5_resources',
|
||||
'exampleapp.gresource.xml',
|
||||
source_dir: meson.current_source_dir())
|
||||
source_dir: '.')
|
||||
|
||||
app5_schemas = gnome.compile_schemas()
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
app6_resources = gnome.compile_resources('exampleapp6_resources',
|
||||
'exampleapp.gresource.xml',
|
||||
source_dir: meson.current_source_dir())
|
||||
source_dir: '.')
|
||||
|
||||
app6_schemas = gnome.compile_schemas()
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
app7_resources = gnome.compile_resources('exampleapp7_resources',
|
||||
'exampleapp.gresource.xml',
|
||||
source_dir: meson.current_source_dir())
|
||||
source_dir: '.')
|
||||
|
||||
app7_schemas = gnome.compile_schemas()
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
app8_resources = gnome.compile_resources('exampleapp8 resources',
|
||||
'exampleapp.gresource.xml',
|
||||
source_dir: meson.current_source_dir())
|
||||
source_dir: '.')
|
||||
|
||||
app8_schemas = gnome.compile_schemas()
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
app9_resources = gnome.compile_resources('exampleapp9_resources',
|
||||
'exampleapp.gresource.xml',
|
||||
source_dir: meson.current_source_dir())
|
||||
source_dir: '.')
|
||||
|
||||
app9_schemas = gnome.compile_schemas()
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
bp_resources = gnome.compile_resources('bloatpad_resources',
|
||||
'bloatpad.gresources.xml',
|
||||
source_dir: meson.current_source_dir())
|
||||
source_dir: '.')
|
||||
|
||||
executable('bloatpad', 'bloatpad.c', bp_resources, dependencies: libgtk_dep, c_args: common_cflags)
|
||||
|
||||
@@ -69,7 +69,6 @@
|
||||
#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>
|
||||
|
||||
@@ -60,11 +60,7 @@ GdkDebugFlags gdk_display_get_debug_flags (GdkDisplay *display);
|
||||
void gdk_display_set_debug_flags (GdkDisplay *display,
|
||||
GdkDebugFlags flags);
|
||||
|
||||
#ifdef GLIB_USING_SYSTEM_PRINTF
|
||||
#define gdk_debug_message(format, ...) fprintf (stderr, format "\n", ##__VA_ARGS__)
|
||||
#else
|
||||
#define gdk_debug_message(format, ...) g_fprintf (stderr, format "\n", ##__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
|
||||
|
||||
+2
-15
@@ -410,19 +410,12 @@ gdk_display_manager_open_display (GdkDisplayManager *manager,
|
||||
{
|
||||
const char *backend = backends[i];
|
||||
gboolean any = g_str_equal (backend, "*");
|
||||
gboolean found = FALSE;
|
||||
|
||||
if (!allow_any && !any && !strstr (allowed_backends, backend))
|
||||
{
|
||||
GDK_DEBUG (MISC, "Skipping %s backend", backend);
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
|
||||
for (j = 0; gdk_backends[j].name != NULL; j++)
|
||||
{
|
||||
if (g_str_equal (backend, gdk_backends[j].name))
|
||||
found = TRUE;
|
||||
|
||||
if ((any && allow_any) ||
|
||||
(any && strstr (allowed_backends, gdk_backends[j].name)) ||
|
||||
g_str_equal (backend, gdk_backends[j].name))
|
||||
@@ -430,15 +423,9 @@ gdk_display_manager_open_display (GdkDisplayManager *manager,
|
||||
GDK_DEBUG (MISC, "Trying %s backend", gdk_backends[j].name);
|
||||
display = gdk_backends[j].open_display (name);
|
||||
if (display)
|
||||
{
|
||||
GDK_DEBUG (MISC, "Using %s display %s", gdk_backends[j].name, gdk_display_get_name (display));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found && !display)
|
||||
g_warning ("No such backend: %s", backend);
|
||||
}
|
||||
|
||||
g_strfreev (backends);
|
||||
|
||||
+2
-2
@@ -48,7 +48,7 @@
|
||||
* for the synchronization being implemented, the clock will process a frame and
|
||||
* emit signals for each phase that has been requested. (See the signals of the
|
||||
* `GdkFrameClock` class for documentation of the phases.
|
||||
* %GDK_FRAME_CLOCK_PHASE_UPDATE and the [signal@Gdk.FrameClock::update] signal
|
||||
* %GDK_FRAME_CLOCK_PHASE_UPDATE and the [signal@GdkFrameClock::update] signal
|
||||
* are most interesting for application writers, and are used to update the
|
||||
* animations, using the frame time given by [method@Gdk.FrameClock.get_frame_time].
|
||||
*
|
||||
@@ -60,7 +60,7 @@
|
||||
* are called at a “similar” time get the same value. This means that
|
||||
* if different animations are timed by looking at the difference in
|
||||
* time between an initial value from [method@Gdk.FrameClock.get_frame_time]
|
||||
* and the value inside the [signal@Gdk.FrameClock::update] signal of the clock,
|
||||
* and the value inside the [signal@GdkFrameClock::update] signal of the clock,
|
||||
* they will stay exactly synchronized.
|
||||
*/
|
||||
|
||||
|
||||
+53
-1
@@ -24,6 +24,7 @@
|
||||
#include "gdkglcontextprivate.h"
|
||||
#include "gdkmemoryformatprivate.h"
|
||||
#include "gdkmemorytextureprivate.h"
|
||||
#include "gdktextureprivate.h"
|
||||
|
||||
#include <epoxy/gl.h>
|
||||
|
||||
@@ -38,6 +39,7 @@ struct _GdkGLTexture {
|
||||
|
||||
GdkGLContext *context;
|
||||
guint id;
|
||||
GLsync sync;
|
||||
|
||||
GdkTexture *saved;
|
||||
|
||||
@@ -63,6 +65,7 @@ drop_gl_resources (GdkGLTexture *self)
|
||||
|
||||
g_clear_object (&self->context);
|
||||
self->id = 0;
|
||||
self->sync = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -98,6 +101,10 @@ gdk_gl_texture_invoke_callback (gpointer data)
|
||||
context = gdk_display_get_gl_context (gdk_gl_context_get_display (invoke->self->context));
|
||||
|
||||
gdk_gl_context_make_current (context);
|
||||
|
||||
if (invoke->self->sync && context != invoke->self->context)
|
||||
glWaitSync (invoke->self->sync, 0, GL_TIMEOUT_IGNORED);
|
||||
|
||||
glBindTexture (GL_TEXTURE_2D, invoke->self->id);
|
||||
|
||||
invoke->func (invoke->self, context, invoke->data);
|
||||
@@ -335,7 +342,6 @@ gdk_gl_texture_determine_format (GdkGLTexture *self)
|
||||
switch (internal_format)
|
||||
{
|
||||
case GL_RGB8:
|
||||
case GL_RGB:
|
||||
texture->format = GDK_MEMORY_R8G8B8;
|
||||
break;
|
||||
|
||||
@@ -440,6 +446,46 @@ gdk_gl_texture_new (GdkGLContext *context,
|
||||
int height,
|
||||
GDestroyNotify destroy,
|
||||
gpointer data)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_GL_CONTEXT (context), NULL);
|
||||
g_return_val_if_fail (id != 0, NULL);
|
||||
g_return_val_if_fail (width > 0, NULL);
|
||||
g_return_val_if_fail (height > 0, NULL);
|
||||
|
||||
return gdk_gl_texture_new_with_sync (context, id, NULL, width, height, destroy, data);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_gl_texture_new_with_sync:
|
||||
* @context: a `GdkGLContext`
|
||||
* @id: the ID of a texture that was created with @context
|
||||
* @sync: (nullable): an optional GLsync object
|
||||
* @width: the nominal width of the texture
|
||||
* @height: the nominal height of the texture
|
||||
* @destroy: a destroy notify that will be called when the GL resources
|
||||
* are released
|
||||
* @data: data that gets passed to @destroy
|
||||
*
|
||||
* Creates a new texture for an existing GL texture.
|
||||
*
|
||||
* If @sync is given, consumers of the texture are required to wait on
|
||||
* it before attempting to use the GL texture.
|
||||
*
|
||||
* The GL texture and the sync object must stay alive unmodified until
|
||||
* @destroy is called, which will happen when the GdkTexture object is
|
||||
* finalized, or due to an explicit call of [method@Gdk.GLTexture.release].
|
||||
*
|
||||
* Return value: (transfer full) (type GdkGLTexture): A newly-created
|
||||
* `GdkTexture`
|
||||
*/
|
||||
GdkTexture *
|
||||
gdk_gl_texture_new_with_sync (GdkGLContext *context,
|
||||
guint id,
|
||||
gpointer sync,
|
||||
int width,
|
||||
int height,
|
||||
GDestroyNotify destroy,
|
||||
gpointer data)
|
||||
{
|
||||
GdkGLTexture *self;
|
||||
|
||||
@@ -455,6 +501,7 @@ gdk_gl_texture_new (GdkGLContext *context,
|
||||
|
||||
self->context = g_object_ref (context);
|
||||
self->id = id;
|
||||
self->sync = sync;
|
||||
self->destroy = destroy;
|
||||
self->data = data;
|
||||
|
||||
@@ -463,3 +510,8 @@ gdk_gl_texture_new (GdkGLContext *context,
|
||||
return GDK_TEXTURE (self);
|
||||
}
|
||||
|
||||
gpointer
|
||||
gdk_gl_texture_get_sync (GdkGLTexture *self)
|
||||
{
|
||||
return self->sync;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,16 @@ G_BEGIN_DECLS
|
||||
|
||||
GdkGLContext * gdk_gl_texture_get_context (GdkGLTexture *self);
|
||||
guint gdk_gl_texture_get_id (GdkGLTexture *self);
|
||||
gpointer gdk_gl_texture_get_sync (GdkGLTexture *self);
|
||||
|
||||
GDK_AVAILABLE_IN_4_10
|
||||
GdkTexture * gdk_gl_texture_new_with_sync (GdkGLContext *context,
|
||||
guint id,
|
||||
gpointer sync,
|
||||
int width,
|
||||
int height,
|
||||
GDestroyNotify destroy,
|
||||
gpointer data);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
+14
-10
@@ -178,10 +178,10 @@ gdk_memory_texture_new_subtexture (GdkMemoryTexture *source,
|
||||
GBytes *bytes;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_MEMORY_TEXTURE (source), NULL);
|
||||
g_return_val_if_fail (x >= 0 && x < GDK_TEXTURE (source)->width, NULL);
|
||||
g_return_val_if_fail (y >= 0 && y < GDK_TEXTURE (source)->height, NULL);
|
||||
g_return_val_if_fail (width > 0 && x + width <= GDK_TEXTURE (source)->width, NULL);
|
||||
g_return_val_if_fail (height > 0 && y + height <= GDK_TEXTURE (source)->height, NULL);
|
||||
g_return_val_if_fail (x >= 0 || x < GDK_TEXTURE (source)->width, NULL);
|
||||
g_return_val_if_fail (y >= 0 || y < GDK_TEXTURE (source)->height, NULL);
|
||||
g_return_val_if_fail (width > 0 || x + width <= GDK_TEXTURE (source)->width, NULL);
|
||||
g_return_val_if_fail (height > 0 || y + height <= GDK_TEXTURE (source)->height, NULL);
|
||||
|
||||
texture = GDK_TEXTURE (source);
|
||||
bpp = gdk_memory_format_bytes_per_pixel (texture->format);
|
||||
@@ -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 * texture->height);
|
||||
bytes = g_bytes_new_take (data, stride);
|
||||
result = gdk_memory_texture_new (texture->width,
|
||||
texture->height,
|
||||
format,
|
||||
@@ -233,11 +233,15 @@ gdk_memory_texture_from_texture (GdkTexture *texture,
|
||||
return GDK_MEMORY_TEXTURE (result);
|
||||
}
|
||||
|
||||
GBytes *
|
||||
gdk_memory_texture_get_bytes (GdkMemoryTexture *self,
|
||||
gsize *out_stride)
|
||||
const guchar *
|
||||
gdk_memory_texture_get_data (GdkMemoryTexture *self)
|
||||
{
|
||||
*out_stride = self->stride;
|
||||
return self->bytes;
|
||||
return g_bytes_get_data (self->bytes, NULL);
|
||||
}
|
||||
|
||||
gsize
|
||||
gdk_memory_texture_get_stride (GdkMemoryTexture *self)
|
||||
{
|
||||
return self->stride;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,8 +37,8 @@ GdkTexture * gdk_memory_texture_new_subtexture (GdkMemoryTexture *
|
||||
int width,
|
||||
int height);
|
||||
|
||||
GBytes * gdk_memory_texture_get_bytes (GdkMemoryTexture *self,
|
||||
gsize *out_stride);
|
||||
const guchar * gdk_memory_texture_get_data (GdkMemoryTexture *self);
|
||||
gsize gdk_memory_texture_get_stride (GdkMemoryTexture *self);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
+5
-5
@@ -50,7 +50,7 @@ void gtk_snapshot_pop (GdkSnapshot
|
||||
* to do, it is suggested that you scale your paintable ignoring any potential
|
||||
* aspect ratio.
|
||||
*
|
||||
* The contents that a `GdkPaintable` produces may depend on the [class@Gdk.Snapshot]
|
||||
* The contents that a `GdkPaintable` produces may depend on the [class@GdkSnapshot]
|
||||
* passed to it. For example, paintables may decide to use more detailed images
|
||||
* on higher resolution screens or when OpenGL is available. A `GdkPaintable`
|
||||
* will however always produce the same output for the same snapshot.
|
||||
@@ -58,7 +58,7 @@ void gtk_snapshot_pop (GdkSnapshot
|
||||
* A `GdkPaintable` may change its contents, meaning that it will now produce
|
||||
* a different output with the same snapshot. Once that happens, it will call
|
||||
* [method@Gdk.Paintable.invalidate_contents] which will emit the
|
||||
* [signal@Gdk.Paintable::invalidate-contents] signal. If a paintable is known
|
||||
* [signal@GdkPaintable::invalidate-contents] signal. If a paintable is known
|
||||
* to never change its contents, it will set the %GDK_PAINTABLE_STATIC_CONTENTS
|
||||
* flag. If a consumer cannot deal with changing contents, it may call
|
||||
* [method@Gdk.Paintable.get_current_image] which will return a static
|
||||
@@ -69,7 +69,7 @@ void gtk_snapshot_pop (GdkSnapshot
|
||||
* can use this information to layout thepaintable appropriately. Just like the
|
||||
* contents, the size of a paintable can change. A paintable will indicate this
|
||||
* by calling [method@Gdk.Paintable.invalidate_size] which will emit the
|
||||
* [signal@Gdk.Paintable::invalidate-size] signal. And just like for contents,
|
||||
* [signal@GdkPaintable::invalidate-size] signal. And just like for contents,
|
||||
* if a paintable is known to never change its size, it will set the
|
||||
* %GDK_PAINTABLE_STATIC_SIZE flag.
|
||||
*
|
||||
@@ -529,7 +529,7 @@ gdk_paintable_compute_concrete_size (GdkPaintable *paintable,
|
||||
* the missing dimension is calculated from the present
|
||||
* dimension and the intrinsic aspect ratio.
|
||||
* Otherwise, the missing dimension is taken from the default
|
||||
* object size.
|
||||
* object size.
|
||||
*/
|
||||
if (image_width)
|
||||
*concrete_width = image_width;
|
||||
@@ -559,7 +559,7 @@ gdk_paintable_compute_concrete_size (GdkPaintable *paintable,
|
||||
* dimensions, the missing dimension is taken from the object's intrinsic
|
||||
* dimensions.
|
||||
* Otherwise, the missing dimension of the concrete object size is taken
|
||||
* from the default object size.
|
||||
* from the default object size.
|
||||
*/
|
||||
if (specified_width)
|
||||
{
|
||||
|
||||
+3
-3
@@ -37,10 +37,10 @@ G_DECLARE_INTERFACE (GdkPaintable, gdk_paintable, GDK, PAINTABLE, GObject)
|
||||
/**
|
||||
* GdkPaintableFlags:
|
||||
* @GDK_PAINTABLE_STATIC_SIZE: The size is immutable.
|
||||
* The [signal@Gdk.Paintable::invalidate-size] signal will never be
|
||||
* The [signal@GdkPaintable::invalidate-size] signal will never be
|
||||
* emitted.
|
||||
* @GDK_PAINTABLE_STATIC_CONTENTS: The content is immutable.
|
||||
* The [signal@Gdk.Paintable::invalidate-contents] signal will never be
|
||||
* The [signal@GdkPaintable::invalidate-contents] signal will never be
|
||||
* emitted.
|
||||
*
|
||||
* Flags about a paintable object.
|
||||
@@ -97,7 +97,7 @@ struct _GdkPaintableInterface
|
||||
double height);
|
||||
/* get the current contents in an immutable form (optional) */
|
||||
GdkPaintable * (* get_current_image) (GdkPaintable *paintable);
|
||||
|
||||
|
||||
/* get flags for potential optimizations (optional) */
|
||||
GdkPaintableFlags (* get_flags) (GdkPaintable *paintable);
|
||||
/* preferred width of paintable or 0 if it has no width (optional) */
|
||||
|
||||
+12
-17
@@ -27,7 +27,7 @@
|
||||
#include "gdkmemoryformatprivate.h"
|
||||
#include "gdkmemorytextureprivate.h"
|
||||
#include "gdksurface.h"
|
||||
#include "gdktexturedownloaderprivate.h"
|
||||
#include "gdktextureprivate.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 bytes)
|
||||
gpointer texture)
|
||||
{
|
||||
g_bytes_unref (bytes);
|
||||
g_object_unref (texture);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -238,27 +238,22 @@ pixbuf_texture_unref_cb (guchar *pixels,
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf_get_from_texture (GdkTexture *texture)
|
||||
{
|
||||
GdkTextureDownloader downloader;
|
||||
GBytes *bytes;
|
||||
gsize stride;
|
||||
GdkMemoryTexture *memtex;
|
||||
gboolean alpha;
|
||||
|
||||
alpha = gdk_memory_format_alpha (gdk_texture_get_format (texture)) != GDK_MEMORY_ALPHA_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);
|
||||
memtex = gdk_memory_texture_from_texture (texture,
|
||||
alpha ? GDK_MEMORY_GDK_PIXBUF_ALPHA
|
||||
: GDK_MEMORY_GDK_PIXBUF_OPAQUE);
|
||||
|
||||
return gdk_pixbuf_new_from_data (g_bytes_get_data (bytes, NULL),
|
||||
return gdk_pixbuf_new_from_data (gdk_memory_texture_get_data (memtex),
|
||||
GDK_COLORSPACE_RGB,
|
||||
alpha,
|
||||
8,
|
||||
gdk_texture_get_width (texture),
|
||||
gdk_texture_get_height (texture),
|
||||
stride,
|
||||
gdk_texture_get_width (GDK_TEXTURE (memtex)),
|
||||
gdk_texture_get_height (GDK_TEXTURE (memtex)),
|
||||
gdk_memory_texture_get_stride (memtex),
|
||||
pixbuf_texture_unref_cb,
|
||||
bytes);
|
||||
memtex);
|
||||
}
|
||||
|
||||
+2
-2
@@ -31,7 +31,7 @@
|
||||
* The `GdkPopup` is positioned relative to its parent surface.
|
||||
*
|
||||
* `GdkPopup`s are typically used to implement menus and similar popups.
|
||||
* They can be modal, which is indicated by the [property@Gdk.Popup:autohide]
|
||||
* They can be modal, which is indicated by the [property@GdkPopup:autohide]
|
||||
* property.
|
||||
*/
|
||||
|
||||
@@ -113,7 +113,7 @@ gdk_popup_default_init (GdkPopupInterface *iface)
|
||||
* otherwise it will change position according to @layout.
|
||||
*
|
||||
* After calling this function, the result should be handled in response
|
||||
* to the [signal@Gdk.Surface::layout] signal being emitted. The resulting
|
||||
* to the [signal@GdkSurface::layout] signal being emitted. The resulting
|
||||
* popup position can be queried using [method@Gdk.Popup.get_position_x],
|
||||
* [method@Gdk.Popup.get_position_y], and the resulting size will be sent as
|
||||
* parameters in the layout signal. Use [method@Gdk.Popup.get_rect_anchor]
|
||||
|
||||
+1
-24
@@ -395,7 +395,7 @@ gdk_texture_new_for_pixbuf (GdkPixbuf *pixbuf)
|
||||
|
||||
bytes = g_bytes_new_with_free_func (gdk_pixbuf_get_pixels (pixbuf),
|
||||
gdk_pixbuf_get_height (pixbuf)
|
||||
* (gsize) gdk_pixbuf_get_rowstride (pixbuf),
|
||||
* gdk_pixbuf_get_rowstride (pixbuf),
|
||||
g_object_unref,
|
||||
g_object_ref (pixbuf));
|
||||
texture = gdk_memory_texture_new (gdk_pixbuf_get_width (pixbuf),
|
||||
@@ -722,9 +722,6 @@ 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,
|
||||
@@ -741,29 +738,9 @@ 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,7 +24,6 @@
|
||||
#endif
|
||||
|
||||
#include <gdk/gdkversionmacros.h>
|
||||
#include <gdk/gdkenums.h>
|
||||
#include <gdk/gdktypes.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
@@ -83,8 +82,6 @@ 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,
|
||||
|
||||
@@ -1,268 +0,0 @@
|
||||
/* 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);
|
||||
}
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
/* 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__ */
|
||||
@@ -1,41 +0,0 @@
|
||||
/* 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,6 +43,7 @@ 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,7 +77,6 @@ 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;
|
||||
|
||||
+8
-10
@@ -23,7 +23,7 @@
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gdktexture.h"
|
||||
#include "gdktexturedownloaderprivate.h"
|
||||
#include "gdkmemorytextureprivate.h"
|
||||
|
||||
#include "gdkprofilerprivate.h"
|
||||
|
||||
@@ -251,8 +251,7 @@ gdk_save_jpeg (GdkTexture *texture)
|
||||
guchar *data = NULL;
|
||||
gulong size = 0;
|
||||
guchar *input = NULL;
|
||||
GdkTextureDownloader downloader;
|
||||
GBytes *texbytes;
|
||||
GdkMemoryTexture *memtex = NULL;
|
||||
const guchar *texdata;
|
||||
gsize texstride;
|
||||
guchar *row;
|
||||
@@ -271,7 +270,7 @@ gdk_save_jpeg (GdkTexture *texture)
|
||||
free (data);
|
||||
g_free (input);
|
||||
jpeg_destroy_compress (&info);
|
||||
g_clear_pointer (&texbytes, g_bytes_unref);
|
||||
g_clear_object (&memtex);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -290,11 +289,10 @@ gdk_save_jpeg (GdkTexture *texture)
|
||||
|
||||
jpeg_mem_dest (&info, &data, &size);
|
||||
|
||||
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);
|
||||
memtex = gdk_memory_texture_from_texture (texture,
|
||||
GDK_MEMORY_R8G8B8);
|
||||
texdata = gdk_memory_texture_get_data (memtex);
|
||||
texstride = gdk_memory_texture_get_stride (memtex);
|
||||
|
||||
jpeg_start_compress (&info, TRUE);
|
||||
|
||||
@@ -306,7 +304,7 @@ gdk_save_jpeg (GdkTexture *texture)
|
||||
|
||||
jpeg_finish_compress (&info);
|
||||
|
||||
g_bytes_unref (texbytes);
|
||||
g_object_unref (memtex);
|
||||
g_free (input);
|
||||
jpeg_destroy_compress (&info);
|
||||
|
||||
|
||||
+11
-13
@@ -21,9 +21,10 @@
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gdkmemoryformatprivate.h"
|
||||
#include "gdkmemorytexture.h"
|
||||
#include "gdkmemorytextureprivate.h"
|
||||
#include "gdkprofilerprivate.h"
|
||||
#include "gdktexturedownloaderprivate.h"
|
||||
#include "gdktexture.h"
|
||||
#include "gdktextureprivate.h"
|
||||
#include "gsk/gl/fp16private.h"
|
||||
#include <png.h>
|
||||
#include <stdio.h>
|
||||
@@ -296,12 +297,11 @@ 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,15 +370,11 @@ gdk_save_png (GdkTexture *texture)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
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);
|
||||
memtex = gdk_memory_texture_from_texture (texture, format);
|
||||
|
||||
if (sigsetjmp (png_jmpbuf (png), 1))
|
||||
{
|
||||
g_bytes_unref (bytes);
|
||||
g_object_unref (memtex);
|
||||
g_free (io.data);
|
||||
png_destroy_read_struct (&png, &info, NULL);
|
||||
return NULL;
|
||||
@@ -398,6 +394,8 @@ 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);
|
||||
|
||||
@@ -405,7 +403,7 @@ gdk_save_png (GdkTexture *texture)
|
||||
|
||||
png_destroy_write_struct (&png, &info);
|
||||
|
||||
g_bytes_unref (bytes);
|
||||
g_object_unref (memtex);
|
||||
|
||||
return g_bytes_new_take (io.data, io.size);
|
||||
}
|
||||
|
||||
+11
-13
@@ -21,9 +21,10 @@
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gdkmemoryformatprivate.h"
|
||||
#include "gdkmemorytexture.h"
|
||||
#include "gdkmemorytextureprivate.h"
|
||||
#include "gdkprofilerprivate.h"
|
||||
#include "gdktexturedownloaderprivate.h"
|
||||
#include "gdktexture.h"
|
||||
#include "gdktextureprivate.h"
|
||||
|
||||
#include <tiffio.h>
|
||||
|
||||
@@ -259,12 +260,11 @@ GBytes *
|
||||
gdk_save_tiff (GdkTexture *texture)
|
||||
{
|
||||
TIFF *tif;
|
||||
int width, height;
|
||||
gsize stride;
|
||||
int width, height, stride;
|
||||
const guchar *line;
|
||||
const guchar *data;
|
||||
GBytes *bytes, *result = NULL;
|
||||
GdkTextureDownloader downloader;
|
||||
GBytes *result = NULL;
|
||||
GdkMemoryTexture *memtex;
|
||||
GdkMemoryFormat format;
|
||||
const FormatData *fdata = NULL;
|
||||
|
||||
@@ -292,11 +292,9 @@ gdk_save_tiff (GdkTexture *texture)
|
||||
TIFFSetField (tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
|
||||
TIFFSetField (tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
|
||||
|
||||
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);
|
||||
memtex = gdk_memory_texture_from_texture (texture, fdata->format);
|
||||
data = gdk_memory_texture_get_data (memtex);
|
||||
stride = gdk_memory_texture_get_stride (memtex);
|
||||
|
||||
line = (const guchar *)data;
|
||||
for (int y = 0; y < height; y++)
|
||||
@@ -304,7 +302,7 @@ gdk_save_tiff (GdkTexture *texture)
|
||||
if (TIFFWriteScanline (tif, (void *)line, y, 0) == -1)
|
||||
{
|
||||
TIFFClose (tif);
|
||||
g_bytes_unref (bytes);
|
||||
g_object_unref (memtex);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -316,7 +314,7 @@ gdk_save_tiff (GdkTexture *texture)
|
||||
|
||||
g_assert (result);
|
||||
|
||||
g_bytes_unref (bytes);
|
||||
g_object_unref (memtex);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
+1
-3
@@ -43,7 +43,6 @@ gdk_public_sources = files([
|
||||
'gdkseatdefault.c',
|
||||
'gdksnapshot.c',
|
||||
'gdktexture.c',
|
||||
'gdktexturedownloader.c',
|
||||
'gdkvulkancontext.c',
|
||||
'gdksurface.c',
|
||||
'gdkpopuplayout.c',
|
||||
@@ -96,7 +95,6 @@ gdk_public_headers = files([
|
||||
'gdkseat.h',
|
||||
'gdksnapshot.h',
|
||||
'gdktexture.h',
|
||||
'gdktexturedownloader.h',
|
||||
'gdktypes.h',
|
||||
'gdkvulkancontext.h',
|
||||
'gdksurface.h',
|
||||
@@ -131,7 +129,7 @@ gdk_gresource_xml = configure_file(output: 'gdk.gresource.xml',
|
||||
|
||||
gdkresources = gnome.compile_resources('gdkresources',
|
||||
gdk_gresource_xml,
|
||||
source_dir: meson.current_source_dir(),
|
||||
source_dir: '.',
|
||||
c_name: '_gdk',
|
||||
extra_args: '--manual-register',
|
||||
)
|
||||
|
||||
@@ -586,6 +586,13 @@ _gdk_wayland_display_open (const char *display_name)
|
||||
|
||||
GDK_DEBUG (MISC, "opening display %s", display_name ? display_name : "");
|
||||
|
||||
/* If this variable is unset then wayland initialisation will surely
|
||||
* fail, logging a fatal error in the process. Save ourselves from
|
||||
* that.
|
||||
*/
|
||||
if (g_getenv ("XDG_RUNTIME_DIR") == NULL)
|
||||
return NULL;
|
||||
|
||||
wl_log_set_handler_client (log_handler);
|
||||
|
||||
wl_display = wl_display_connect (display_name);
|
||||
@@ -1075,9 +1082,6 @@ gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
|
||||
g_assert (display_wayland);
|
||||
g_assert (display_wayland->shm);
|
||||
|
||||
if (size == 0)
|
||||
size = 24;
|
||||
|
||||
if (g_strcmp0 (name, display_wayland->cursor_theme_name) == 0 &&
|
||||
display_wayland->cursor_theme_size == size)
|
||||
return;
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
|
||||
#include "gdkdisplay-wayland.h"
|
||||
#include "gdksurface-wayland.h"
|
||||
#include "gdksurface-wayland-private.h"
|
||||
|
||||
#include "gdkwaylanddisplay.h"
|
||||
#include "gdkwaylandglcontext.h"
|
||||
@@ -61,20 +60,10 @@ 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;
|
||||
|
||||
impl->pending_buffer_offset_x = 0;
|
||||
impl->pending_buffer_offset_y = 0;
|
||||
|
||||
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);
|
||||
@@ -121,7 +110,7 @@ gdk_wayland_display_init_gl (GdkDisplay *display,
|
||||
{
|
||||
GdkWaylandDisplay *self = GDK_WAYLAND_DISPLAY (display);
|
||||
|
||||
if (!gdk_display_init_egl (display,
|
||||
if (!gdk_display_init_egl (display,
|
||||
EGL_PLATFORM_WAYLAND_EXT,
|
||||
self->wl_display,
|
||||
TRUE,
|
||||
|
||||
@@ -398,11 +398,7 @@ gdk_wayland_popup_handle_configure (GdkWaylandSurface *wayland_surface)
|
||||
g_warn_if_reached ();
|
||||
|
||||
if (wayland_popup->pending.has_repositioned_token)
|
||||
{
|
||||
wayland_popup->received_reposition_token =
|
||||
wayland_popup->pending.repositioned_token;
|
||||
wayland_popup->pending.has_repositioned_token = FALSE;
|
||||
}
|
||||
wayland_popup->received_reposition_token = wayland_popup->pending.repositioned_token;
|
||||
|
||||
switch (wayland_popup->state)
|
||||
{
|
||||
@@ -747,7 +743,9 @@ create_dynamic_positioner (GdkWaylandPopup *wayland_popup,
|
||||
GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
|
||||
GdkRectangle geometry;
|
||||
uint32_t constraint_adjustment = ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_NONE;
|
||||
GdkRectangle anchor_rect;
|
||||
const GdkRectangle *anchor_rect;
|
||||
int real_anchor_rect_x, real_anchor_rect_y;
|
||||
int anchor_rect_width, anchor_rect_height;
|
||||
int rect_anchor_dx;
|
||||
int rect_anchor_dy;
|
||||
GdkGravity rect_anchor;
|
||||
@@ -773,24 +771,12 @@ create_dynamic_positioner (GdkWaylandPopup *wayland_popup,
|
||||
|
||||
gdk_wayland_surface_get_window_geometry (surface->parent, &parent_geometry);
|
||||
|
||||
anchor_rect = *gdk_popup_layout_get_anchor_rect (layout);
|
||||
anchor_rect = gdk_popup_layout_get_anchor_rect (layout);
|
||||
real_anchor_rect_x = anchor_rect->x - parent_geometry.x;
|
||||
real_anchor_rect_y = anchor_rect->y - parent_geometry.y;
|
||||
|
||||
/* Wayland protocol requires that the anchor rect is specified
|
||||
* wrt. to the parent geometry, and that it is non-empty and
|
||||
* contained in the parent geometry.
|
||||
*/
|
||||
if (!gdk_rectangle_intersect (&parent_geometry, &anchor_rect, &anchor_rect))
|
||||
{
|
||||
anchor_rect.x = 0;
|
||||
anchor_rect.y = 0;
|
||||
anchor_rect.width = 1;
|
||||
anchor_rect.height = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
anchor_rect.x -= parent_geometry.x;
|
||||
anchor_rect.y -= parent_geometry.y;
|
||||
}
|
||||
anchor_rect_width = MAX (anchor_rect->width, 1);
|
||||
anchor_rect_height = MAX (anchor_rect->height, 1);
|
||||
|
||||
gdk_popup_layout_get_offset (layout, &rect_anchor_dx, &rect_anchor_dy);
|
||||
|
||||
@@ -811,10 +797,10 @@ create_dynamic_positioner (GdkWaylandPopup *wayland_popup,
|
||||
|
||||
xdg_positioner_set_size (positioner, geometry.width, geometry.height);
|
||||
xdg_positioner_set_anchor_rect (positioner,
|
||||
anchor_rect.x,
|
||||
anchor_rect.y,
|
||||
anchor_rect.width,
|
||||
anchor_rect.height);
|
||||
real_anchor_rect_x,
|
||||
real_anchor_rect_y,
|
||||
anchor_rect_width,
|
||||
anchor_rect_height);
|
||||
xdg_positioner_set_offset (positioner, rect_anchor_dx, rect_anchor_dy);
|
||||
|
||||
anchor = rect_anchor_to_anchor (rect_anchor);
|
||||
@@ -865,10 +851,10 @@ create_dynamic_positioner (GdkWaylandPopup *wayland_popup,
|
||||
|
||||
zxdg_positioner_v6_set_size (positioner, geometry.width, geometry.height);
|
||||
zxdg_positioner_v6_set_anchor_rect (positioner,
|
||||
anchor_rect.x,
|
||||
anchor_rect.y,
|
||||
anchor_rect.width,
|
||||
anchor_rect.height);
|
||||
real_anchor_rect_x,
|
||||
real_anchor_rect_y,
|
||||
anchor_rect_width,
|
||||
anchor_rect_height);
|
||||
zxdg_positioner_v6_set_offset (positioner,
|
||||
rect_anchor_dx,
|
||||
rect_anchor_dy);
|
||||
@@ -982,9 +968,6 @@ gdk_wayland_surface_create_xdg_popup (GdkWaylandPopup *wayland_popup,
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
wayland_popup->received_reposition_token = 0;
|
||||
wayland_popup->reposition_token = 0;
|
||||
|
||||
gdk_popup_layout_get_shadow_width (layout,
|
||||
&impl->shadow_left,
|
||||
&impl->shadow_right,
|
||||
|
||||
@@ -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 && scale_changed)
|
||||
if (impl->display_server.wl_surface)
|
||||
wl_surface_set_buffer_scale (impl->display_server.wl_surface, scale);
|
||||
|
||||
gdk_surface_invalidate_rect (surface, NULL);
|
||||
@@ -561,14 +561,8 @@ gdk_wayland_surface_attach_image (GdkSurface *surface,
|
||||
/* Attach this new buffer to the surface */
|
||||
wl_surface_attach (impl->display_server.wl_surface,
|
||||
_gdk_wayland_shm_surface_get_wl_buffer (cairo_surface),
|
||||
0, 0);
|
||||
|
||||
if ((impl->pending_buffer_offset_x || impl->pending_buffer_offset_y) &&
|
||||
wl_surface_get_version (impl->display_server.wl_surface) >=
|
||||
WL_SURFACE_OFFSET_SINCE_VERSION)
|
||||
wl_surface_offset (impl->display_server.wl_surface,
|
||||
impl->pending_buffer_offset_x,
|
||||
impl->pending_buffer_offset_y);
|
||||
impl->pending_buffer_offset_x,
|
||||
impl->pending_buffer_offset_y);
|
||||
impl->pending_buffer_offset_x = 0;
|
||||
impl->pending_buffer_offset_y = 0;
|
||||
|
||||
@@ -585,12 +579,33 @@ 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
|
||||
@@ -977,15 +992,6 @@ gdk_wayland_surface_hide_surface (GdkSurface *surface)
|
||||
impl->display_server.egl_window = NULL;
|
||||
}
|
||||
|
||||
impl->awaiting_frame = FALSE;
|
||||
if (impl->awaiting_frame_frozen)
|
||||
{
|
||||
impl->awaiting_frame_frozen = FALSE;
|
||||
gdk_surface_thaw_updates (surface);
|
||||
}
|
||||
|
||||
GDK_WAYLAND_SURFACE_GET_CLASS (impl)->hide_surface (impl);
|
||||
|
||||
if (impl->display_server.xdg_surface)
|
||||
{
|
||||
xdg_surface_destroy (impl->display_server.xdg_surface);
|
||||
@@ -1004,6 +1010,15 @@ gdk_wayland_surface_hide_surface (GdkSurface *surface)
|
||||
impl->initial_configure_received = FALSE;
|
||||
}
|
||||
|
||||
impl->awaiting_frame = FALSE;
|
||||
if (impl->awaiting_frame_frozen)
|
||||
{
|
||||
impl->awaiting_frame_frozen = FALSE;
|
||||
gdk_surface_thaw_updates (surface);
|
||||
}
|
||||
|
||||
GDK_WAYLAND_SURFACE_GET_CLASS (impl)->hide_surface (impl);
|
||||
|
||||
g_clear_pointer (&impl->display_server.wl_surface, wl_surface_destroy);
|
||||
|
||||
g_slist_free (impl->display_server.outputs);
|
||||
|
||||
@@ -991,7 +991,7 @@ gdk_wayland_toplevel_set_startup_id (GdkWaylandToplevel *toplevel,
|
||||
startup_id = free_me;
|
||||
}
|
||||
|
||||
if (display->xdg_activation && startup_id)
|
||||
if (startup_id)
|
||||
xdg_activation_v1_activate (display->xdg_activation,
|
||||
startup_id,
|
||||
surface->display_server.wl_surface);
|
||||
|
||||
@@ -1005,8 +1005,7 @@ gdk_win32_icon_to_pixbuf_libgtk_only (HICON hicon,
|
||||
} bmi;
|
||||
HDC hdc;
|
||||
uint8_t *pixels, *bits;
|
||||
int x, y, w, h;
|
||||
gsize rowstride;
|
||||
int rowstride, x, y, w, h;
|
||||
|
||||
if (!GDI_CALL (GetIconInfo, (hicon, &ii)))
|
||||
return NULL;
|
||||
@@ -1058,7 +1057,7 @@ gdk_win32_icon_to_pixbuf_libgtk_only (HICON hicon,
|
||||
no_alpha = FALSE;
|
||||
pixels += 4;
|
||||
}
|
||||
pixels += rowstride - w * 4;
|
||||
pixels += (w * 4 - rowstride);
|
||||
}
|
||||
|
||||
/* mask */
|
||||
@@ -1073,7 +1072,7 @@ gdk_win32_icon_to_pixbuf_libgtk_only (HICON hicon,
|
||||
pixels[3] = 255 - bits[(x + y * w) * 4];
|
||||
pixels += 4;
|
||||
}
|
||||
pixels += rowstride - w * 4;
|
||||
pixels += (w * 4 - rowstride);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1147,7 +1146,7 @@ gdk_win32_icon_to_pixbuf_libgtk_only (HICON hicon,
|
||||
xorp++;
|
||||
}
|
||||
}
|
||||
pixels += rowstride - w * 4;
|
||||
pixels += (w * 4 - rowstride);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
*
|
||||
* gdkglcontext-win32-wgl-private.c: Win32 specific OpenGL wrappers
|
||||
*
|
||||
* Copyright © 2023 Chun-wei Fan
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* These wrapper functions are used when we don't want to use the wgl*() core functions
|
||||
* that we acquire via libepoxy (such as when we are disposing the Gdk(W)GLContext from,
|
||||
* different threads, so for these calls, we are actually linking to the system's/ICD
|
||||
* opengl32.dll directly, so that we are guaranteed that the "right" versions of these
|
||||
* WGL calls are carried out. This must be a separate source file because we can't include
|
||||
* the system's GL/gl.h with epoxy/(w)gl.h together in a single source file. We should not
|
||||
* need to use these when we are creating/initializing a WGL context in GDK, since we should
|
||||
* be in the same thread at this point.
|
||||
*/
|
||||
|
||||
#define DONT_INCLUDE_LIBEPOXY
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <GL/gl.h>
|
||||
|
||||
#include "gdkglcontext-win32.h"
|
||||
|
||||
void
|
||||
gdk_win32_private_wglDeleteContext (HGLRC hglrc)
|
||||
{
|
||||
wglDeleteContext (hglrc);
|
||||
}
|
||||
|
||||
HGLRC
|
||||
gdk_win32_private_wglGetCurrentContext (void)
|
||||
{
|
||||
return wglGetCurrentContext ();
|
||||
}
|
||||
|
||||
BOOL
|
||||
gdk_win32_private_wglMakeCurrent (HDC hdc,
|
||||
HGLRC hglrc)
|
||||
{
|
||||
return wglMakeCurrent (hdc, hglrc);
|
||||
}
|
||||
@@ -60,12 +60,12 @@ gdk_win32_gl_context_wgl_dispose (GObject *gobject)
|
||||
|
||||
if (context_wgl->wgl_context != NULL)
|
||||
{
|
||||
if (gdk_win32_private_wglGetCurrentContext () == context_wgl->wgl_context)
|
||||
gdk_win32_private_wglMakeCurrent (NULL, NULL);
|
||||
if (wglGetCurrentContext () == context_wgl->wgl_context)
|
||||
wglMakeCurrent (NULL, NULL);
|
||||
|
||||
GDK_NOTE (OPENGL, g_print ("Destroying WGL context\n"));
|
||||
|
||||
gdk_win32_private_wglDeleteContext (context_wgl->wgl_context);
|
||||
wglDeleteContext (context_wgl->wgl_context);
|
||||
context_wgl->wgl_context = NULL;
|
||||
}
|
||||
|
||||
@@ -628,7 +628,7 @@ gdk_win32_gl_context_wgl_realize (GdkGLContext *context,
|
||||
static gboolean
|
||||
gdk_win32_gl_context_wgl_clear_current (GdkGLContext *context)
|
||||
{
|
||||
return gdk_win32_private_wglMakeCurrent (NULL, NULL);
|
||||
return wglMakeCurrent (NULL, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -636,7 +636,7 @@ gdk_win32_gl_context_wgl_is_current (GdkGLContext *context)
|
||||
{
|
||||
GdkWin32GLContextWGL *self = GDK_WIN32_GL_CONTEXT_WGL (context);
|
||||
|
||||
return self->wgl_context == gdk_win32_private_wglGetCurrentContext ();
|
||||
return self->wgl_context == wglGetCurrentContext ();
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -654,7 +654,7 @@ gdk_win32_gl_context_wgl_make_current (GdkGLContext *context,
|
||||
else
|
||||
hdc = GDK_WIN32_SURFACE (surface)->hdc;
|
||||
|
||||
if (!gdk_win32_private_wglMakeCurrent (hdc, context_wgl->wgl_context))
|
||||
if (!wglMakeCurrent (hdc, context_wgl->wgl_context))
|
||||
return FALSE;
|
||||
|
||||
if (!surfaceless && display_win32->hasWglEXTSwapControl)
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#ifndef __GDK_WIN32_GL_CONTEXT__
|
||||
#define __GDK_WIN32_GL_CONTEXT__
|
||||
|
||||
#ifndef DONT_INCLUDE_LIBEPOXY
|
||||
#include <epoxy/gl.h>
|
||||
#include <epoxy/wgl.h>
|
||||
|
||||
@@ -32,18 +31,9 @@
|
||||
#include "gdkglcontextprivate.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdksurface.h"
|
||||
#else
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
# include <GL/gl.h>
|
||||
|
||||
# include <glib.h>
|
||||
#endif
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#ifndef DONT_INCLUDE_LIBEPOXY
|
||||
|
||||
#define GDK_WIN32_GL_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WIN32_GL_CONTEXT, GdkWin32GLContextClass))
|
||||
#define GDK_WIN32_GL_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WIN32_GL_CONTEXT, GdkWin32GLContextClass))
|
||||
#define GDK_WIN32_IS_GL_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WIN32_GL_CONTEXT))
|
||||
@@ -88,13 +78,6 @@ GType gdk_win32_gl_context_egl_get_type (void) G_GNUC_CONST;
|
||||
void
|
||||
_gdk_win32_surface_invalidate_egl_framebuffer (GdkSurface *surface);
|
||||
|
||||
#endif /* !DONT_INCLUDE_LIBEPOXY */
|
||||
|
||||
HGLRC gdk_win32_private_wglGetCurrentContext (void);
|
||||
BOOL gdk_win32_private_wglMakeCurrent (HDC hdc,
|
||||
HGLRC hglrc);
|
||||
void gdk_win32_private_wglDeleteContext (HGLRC hglrc);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_WIN32_GL_CONTEXT__ */
|
||||
|
||||
@@ -23,7 +23,6 @@ gdk_win32_sources = gdk_win32_public_sources + files([
|
||||
'gdkdevice-wintab.c',
|
||||
'gdkdrop-win32.c',
|
||||
'gdkglobals-win32.c',
|
||||
'gdkglcontext-win32-wgl-private.c',
|
||||
'gdkhdataoutputstream-win32.c',
|
||||
'gdkinput-dmanipulation.c',
|
||||
'gdkinput-winpointer.c',
|
||||
@@ -60,7 +59,6 @@ endif
|
||||
gdk_win32_deps = [
|
||||
pangowin32_dep, # FIXME
|
||||
cc.find_library('hid'),
|
||||
cc.find_library('opengl32'),
|
||||
]
|
||||
|
||||
libgdk_win32 = static_library('gdk-win32',
|
||||
|
||||
@@ -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 | GDK_SEAT_CAPABILITY_KEYBOARD;
|
||||
capabilities = GDK_SEAT_CAPABILITY_ALL_POINTING;
|
||||
|
||||
cursor = gdk_drag_get_cursor (drag, x11_drag->current_action);
|
||||
g_set_object (&x11_drag->cursor, cursor);
|
||||
|
||||
@@ -1358,7 +1358,6 @@ gdk_x11_surface_destroy (GdkSurface *surface,
|
||||
|
||||
unhook_surface_changed (surface);
|
||||
disconnect_frame_clock (surface);
|
||||
g_clear_handle_id (&impl->compute_size_source_id, g_source_remove);
|
||||
|
||||
if (impl->cairo_surface)
|
||||
{
|
||||
|
||||
+18
-10
@@ -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>
|
||||
|
||||
@@ -403,6 +403,7 @@ gsk_gl_command_queue_dispose (GObject *object)
|
||||
gsk_gl_command_batches_clear (&self->batches);
|
||||
gsk_gl_command_binds_clear (&self->batch_binds);
|
||||
gsk_gl_command_uniforms_clear (&self->batch_uniforms);
|
||||
gsk_gl_syncs_clear (&self->syncs);
|
||||
|
||||
gsk_gl_buffer_destroy (&self->vertices);
|
||||
|
||||
@@ -425,6 +426,7 @@ gsk_gl_command_queue_init (GskGLCommandQueue *self)
|
||||
gsk_gl_command_batches_init (&self->batches, 128);
|
||||
gsk_gl_command_binds_init (&self->batch_binds, 1024);
|
||||
gsk_gl_command_uniforms_init (&self->batch_uniforms, 2048);
|
||||
gsk_gl_syncs_init (&self->syncs, 10);
|
||||
|
||||
gsk_gl_buffer_init (&self->vertices, GL_ARRAY_BUFFER, sizeof (GskGLDrawVertex));
|
||||
}
|
||||
@@ -1098,17 +1100,25 @@ gsk_gl_command_queue_execute (GskGLCommandQueue *self,
|
||||
if G_UNLIKELY (batch->draw.bind_count > 0)
|
||||
{
|
||||
const GskGLCommandBind *bind = &self->batch_binds.items[batch->draw.bind_offset];
|
||||
|
||||
for (guint i = 0; i < batch->draw.bind_count; i++)
|
||||
{
|
||||
if (textures[bind->texture] != bind->id)
|
||||
{
|
||||
GskGLSync *s;
|
||||
|
||||
if (active != bind->texture)
|
||||
{
|
||||
active = bind->texture;
|
||||
glActiveTexture (GL_TEXTURE0 + bind->texture);
|
||||
}
|
||||
|
||||
s = gsk_gl_syncs_get_sync (&self->syncs, bind->id);
|
||||
if (s && s->sync)
|
||||
{
|
||||
glWaitSync ((GLsync) s->sync, 0, GL_TIMEOUT_IGNORED);
|
||||
s->sync = NULL;
|
||||
}
|
||||
|
||||
glBindTexture (GL_TEXTURE_2D, bind->id);
|
||||
textures[bind->texture] = bind->id;
|
||||
}
|
||||
@@ -1236,6 +1246,7 @@ gsk_gl_command_queue_end_frame (GskGLCommandQueue *self)
|
||||
self->batches.len = 0;
|
||||
self->batch_binds.len = 0;
|
||||
self->batch_uniforms.len = 0;
|
||||
self->syncs.len = 0;
|
||||
self->n_uploads = 0;
|
||||
self->tail_batch_index = -1;
|
||||
self->in_frame = FALSE;
|
||||
@@ -1359,8 +1370,7 @@ gsk_gl_command_queue_do_upload_texture (GskGLCommandQueue *self,
|
||||
GdkGLContext *context;
|
||||
const guchar *data;
|
||||
gsize stride;
|
||||
GBytes *bytes;
|
||||
GdkTextureDownloader downloader;
|
||||
GdkMemoryTexture *memtex;
|
||||
GdkMemoryFormat data_format;
|
||||
int width, height;
|
||||
GLenum gl_internalformat;
|
||||
@@ -1395,11 +1405,9 @@ gsk_gl_command_queue_do_upload_texture (GskGLCommandQueue *self,
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
memtex = gdk_memory_texture_from_texture (texture, data_format);
|
||||
data = gdk_memory_texture_get_data (memtex);
|
||||
stride = gdk_memory_texture_get_stride (memtex);
|
||||
bpp = gdk_memory_format_bytes_per_pixel (data_format);
|
||||
|
||||
glPixelStorei (GL_UNPACK_ALIGNMENT, gdk_memory_format_alignment (data_format));
|
||||
@@ -1429,7 +1437,7 @@ gsk_gl_command_queue_do_upload_texture (GskGLCommandQueue *self,
|
||||
}
|
||||
glPixelStorei (GL_UNPACK_ALIGNMENT, 4);
|
||||
|
||||
g_bytes_unref (bytes);
|
||||
g_object_unref (memtex);
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
@@ -167,9 +167,15 @@ typedef union _GskGLCommandBatch
|
||||
|
||||
G_STATIC_ASSERT (sizeof (GskGLCommandBatch) == 32);
|
||||
|
||||
typedef struct _GskGLSync {
|
||||
guint id;
|
||||
gpointer sync;
|
||||
} GskGLSync;
|
||||
|
||||
DEFINE_INLINE_ARRAY (GskGLCommandBatches, gsk_gl_command_batches, GskGLCommandBatch)
|
||||
DEFINE_INLINE_ARRAY (GskGLCommandBinds, gsk_gl_command_binds, GskGLCommandBind)
|
||||
DEFINE_INLINE_ARRAY (GskGLCommandUniforms, gsk_gl_command_uniforms, GskGLCommandUniform)
|
||||
DEFINE_INLINE_ARRAY (GskGLSyncs, gsk_gl_syncs, GskGLSync)
|
||||
|
||||
struct _GskGLCommandQueue
|
||||
{
|
||||
@@ -225,6 +231,8 @@ struct _GskGLCommandQueue
|
||||
*/
|
||||
GskGLCommandUniforms batch_uniforms;
|
||||
|
||||
GskGLSyncs syncs;
|
||||
|
||||
/* Discovered max texture size when loading the command queue so that we
|
||||
* can either scale down or slice textures to fit within this size. Assumed
|
||||
* to be both height and width.
|
||||
@@ -354,6 +362,37 @@ gsk_gl_command_queue_bind_framebuffer (GskGLCommandQueue *self,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline GskGLSync *
|
||||
gsk_gl_syncs_get_sync (GskGLSyncs *syncs,
|
||||
guint id)
|
||||
{
|
||||
for (unsigned int i = 0; i < syncs->len; i++)
|
||||
{
|
||||
GskGLSync *sync = &syncs->items[i];
|
||||
if (sync->id == id)
|
||||
return sync;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline void
|
||||
gsk_gl_syncs_add_sync (GskGLSyncs *syncs,
|
||||
guint id,
|
||||
gpointer sync)
|
||||
{
|
||||
GskGLSync *s;
|
||||
|
||||
s = gsk_gl_syncs_get_sync (syncs, id);
|
||||
if (s)
|
||||
g_assert (s->sync == sync);
|
||||
else
|
||||
{
|
||||
s = gsk_gl_syncs_append (syncs);
|
||||
s->id = id;
|
||||
s->sync = sync;
|
||||
}
|
||||
}
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GSK_GL_COMMAND_QUEUE_PRIVATE_H__ */
|
||||
|
||||
+12
-6
@@ -35,6 +35,7 @@
|
||||
#include "gskgliconlibraryprivate.h"
|
||||
#include "gskglprogramprivate.h"
|
||||
#include "gskglshadowlibraryprivate.h"
|
||||
#include "gskgltextureprivate.h"
|
||||
#include "fp16private.h"
|
||||
|
||||
#include <gdk/gdkglcontextprivate.h>
|
||||
@@ -1328,6 +1329,7 @@ typedef struct _GskGLTextureState
|
||||
{
|
||||
GdkGLContext *context;
|
||||
GLuint texture_id;
|
||||
GLsync sync;
|
||||
} GskGLTextureState;
|
||||
|
||||
static void
|
||||
@@ -1340,6 +1342,7 @@ create_texture_from_texture_destroy (gpointer data)
|
||||
|
||||
gdk_gl_context_make_current (state->context);
|
||||
glDeleteTextures (1, &state->texture_id);
|
||||
glDeleteSync (state->sync);
|
||||
g_clear_object (&state->context);
|
||||
g_slice_free (GskGLTextureState, state);
|
||||
}
|
||||
@@ -1374,10 +1377,13 @@ gsk_gl_driver_create_gdk_texture (GskGLDriver *self,
|
||||
texture->texture_id = 0;
|
||||
gsk_gl_texture_free (texture);
|
||||
|
||||
return gdk_gl_texture_new (self->command_queue->context,
|
||||
texture_id,
|
||||
width,
|
||||
height,
|
||||
create_texture_from_texture_destroy,
|
||||
state);
|
||||
state->sync = glFenceSync (GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
||||
|
||||
return gdk_gl_texture_new_with_sync (self->command_queue->context,
|
||||
texture_id,
|
||||
state->sync,
|
||||
width,
|
||||
height,
|
||||
create_texture_from_texture_destroy,
|
||||
state);
|
||||
}
|
||||
|
||||
@@ -264,6 +264,27 @@ gsk_gl_program_set_uniform_texture (GskGLProgram *self,
|
||||
texture_slot);
|
||||
}
|
||||
|
||||
static inline void
|
||||
gsk_gl_program_set_uniform_texture_with_sync (GskGLProgram *self,
|
||||
guint key,
|
||||
guint stamp,
|
||||
GLenum texture_target,
|
||||
GLenum texture_slot,
|
||||
guint texture_id,
|
||||
gpointer sync)
|
||||
{
|
||||
gsk_gl_attachment_state_bind_texture (self->driver->command_queue->attachments,
|
||||
texture_target,
|
||||
texture_slot,
|
||||
texture_id);
|
||||
gsk_gl_uniform_state_set_texture (self->uniforms,
|
||||
self->program_info,
|
||||
key,
|
||||
stamp,
|
||||
texture_slot);
|
||||
gsk_gl_syncs_add_sync (&self->driver->command_queue->syncs, texture_id, sync);
|
||||
}
|
||||
|
||||
static inline void
|
||||
gsk_gl_program_set_uniform_matrix (GskGLProgram *self,
|
||||
guint key,
|
||||
|
||||
@@ -62,8 +62,7 @@ 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 (2, MASK_MODE, u_mode))
|
||||
GSK_GL_ADD_UNIFORM (1, MASK_SOURCE, u_mask))
|
||||
|
||||
GSK_GL_DEFINE_PROGRAM (outset_shadow,
|
||||
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("outset_shadow.glsl")),
|
||||
|
||||
+123
-121
@@ -190,6 +190,7 @@ typedef struct _GskGLRenderOffscreen
|
||||
|
||||
/* Return location for texture ID */
|
||||
guint texture_id;
|
||||
gpointer sync;
|
||||
|
||||
/* Whether to force creating a new texture, even if the
|
||||
* input already is a texture
|
||||
@@ -260,7 +261,6 @@ node_supports_2d_transform (const GskRenderNode *node)
|
||||
case GSK_OPACITY_NODE:
|
||||
case GSK_COLOR_MATRIX_NODE:
|
||||
case GSK_TEXTURE_NODE:
|
||||
case GSK_TEXTURE_SCALE_NODE:
|
||||
case GSK_CROSS_FADE_NODE:
|
||||
case GSK_LINEAR_GRADIENT_NODE:
|
||||
case GSK_REPEATING_LINEAR_GRADIENT_NODE:
|
||||
@@ -315,7 +315,6 @@ node_supports_transform (const GskRenderNode *node)
|
||||
case GSK_CAIRO_NODE:
|
||||
case GSK_BLEND_NODE:
|
||||
case GSK_BLUR_NODE:
|
||||
case GSK_MASK_NODE:
|
||||
return TRUE;
|
||||
|
||||
case GSK_SHADOW_NODE:
|
||||
@@ -874,21 +873,6 @@ gsk_gl_render_job_transform_bounds (GskGLRenderJob *job,
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
gsk_gl_render_job_untransform_bounds (GskGLRenderJob *job,
|
||||
const graphene_rect_t *rect,
|
||||
graphene_rect_t *out_rect)
|
||||
{
|
||||
GskTransform *transform;
|
||||
|
||||
transform = gsk_transform_invert (gsk_transform_ref (job->current_modelview->transform));
|
||||
|
||||
gsk_transform_transform_bounds (transform, rect, out_rect);
|
||||
|
||||
out_rect->origin.x -= job->offset_x;
|
||||
out_rect->origin.y -= job->offset_y;
|
||||
}
|
||||
|
||||
static inline void
|
||||
gsk_gl_render_job_transform_rounded_rect (GskGLRenderJob *job,
|
||||
const GskRoundedRect *rect,
|
||||
@@ -3295,8 +3279,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);
|
||||
@@ -3310,7 +3294,6 @@ 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.
|
||||
@@ -3341,9 +3324,6 @@ 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);
|
||||
}
|
||||
@@ -3518,12 +3498,17 @@ gsk_gl_render_job_upload_texture (GskGLRenderJob *job,
|
||||
int mag_filter,
|
||||
GskGLRenderOffscreen *offscreen)
|
||||
{
|
||||
GdkGLTexture *gl_texture = NULL;
|
||||
|
||||
if (GDK_IS_GL_TEXTURE (texture))
|
||||
gl_texture = (GdkGLTexture *) texture;
|
||||
|
||||
if (min_filter == GL_LINEAR &&
|
||||
mag_filter == GL_LINEAR &&
|
||||
gsk_gl_texture_library_can_cache ((GskGLTextureLibrary *)job->driver->icons_library,
|
||||
texture->width,
|
||||
texture->height) &&
|
||||
!GDK_IS_GL_TEXTURE (texture))
|
||||
!gl_texture)
|
||||
{
|
||||
const GskGLIconData *icon_data;
|
||||
|
||||
@@ -3535,6 +3520,9 @@ gsk_gl_render_job_upload_texture (GskGLRenderJob *job,
|
||||
{
|
||||
offscreen->texture_id = gsk_gl_driver_load_texture (job->driver, texture, min_filter, mag_filter);
|
||||
init_full_texture_region (offscreen);
|
||||
if (gl_texture && offscreen->texture_id == gdk_gl_texture_get_id (gl_texture) &&
|
||||
gdk_gl_texture_get_context (gl_texture) != gsk_gl_command_queue_get_context (job->command_queue))
|
||||
offscreen->sync = gdk_gl_texture_get_sync (gl_texture);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3556,11 +3544,12 @@ gsk_gl_render_job_visit_texture (GskGLRenderJob *job,
|
||||
g_assert (offscreen.was_offscreen == FALSE);
|
||||
|
||||
gsk_gl_render_job_begin_draw (job, CHOOSE_PROGRAM (job, blit));
|
||||
gsk_gl_program_set_uniform_texture (job->current_program,
|
||||
UNIFORM_SHARED_SOURCE, 0,
|
||||
GL_TEXTURE_2D,
|
||||
GL_TEXTURE0,
|
||||
offscreen.texture_id);
|
||||
gsk_gl_program_set_uniform_texture_with_sync (job->current_program,
|
||||
UNIFORM_SHARED_SOURCE, 0,
|
||||
GL_TEXTURE_2D,
|
||||
GL_TEXTURE0,
|
||||
offscreen.texture_id,
|
||||
offscreen.sync);
|
||||
gsk_gl_render_job_draw_offscreen (job, bounds, &offscreen);
|
||||
gsk_gl_render_job_end_draw (job);
|
||||
}
|
||||
@@ -3632,114 +3621,127 @@ gsk_gl_render_job_visit_texture_scale_node (GskGLRenderJob *job,
|
||||
int min_filter = min_filters[scaling_filter];
|
||||
int mag_filter = mag_filters[scaling_filter];
|
||||
int max_texture_size = job->command_queue->max_texture_size;
|
||||
graphene_rect_t clip_rect;
|
||||
GskGLRenderTarget *render_target;
|
||||
GskGLRenderOffscreen offscreen = {0};
|
||||
graphene_rect_t viewport;
|
||||
graphene_rect_t prev_viewport;
|
||||
graphene_matrix_t prev_projection;
|
||||
float prev_alpha;
|
||||
guint prev_fbo;
|
||||
guint texture_id;
|
||||
float u0, u1, v0, v1;
|
||||
GskTextureKey key;
|
||||
|
||||
gsk_gl_render_job_untransform_bounds (job, &job->current_clip->rect.bounds, &clip_rect);
|
||||
|
||||
if (!graphene_rect_intersection (bounds, &clip_rect, &clip_rect))
|
||||
return;
|
||||
|
||||
if G_UNLIKELY (clip_rect.size.width > max_texture_size ||
|
||||
clip_rect.size.height > max_texture_size)
|
||||
if (scaling_filter == GSK_SCALING_FILTER_LINEAR)
|
||||
{
|
||||
gsk_gl_render_job_visit_texture (job, texture, bounds);
|
||||
return;
|
||||
}
|
||||
|
||||
key.pointer = node;
|
||||
key.pointer_is_child = TRUE;
|
||||
key.parent_rect = clip_rect;
|
||||
key.scale_x = 1.;
|
||||
key.scale_y = 1.;
|
||||
key.filter = min_filter;
|
||||
|
||||
texture_id = gsk_gl_driver_lookup_texture (job->driver, &key);
|
||||
if (texture_id != 0)
|
||||
goto render_texture;
|
||||
|
||||
viewport = GRAPHENE_RECT_INIT (0, 0,
|
||||
clip_rect.size.width,
|
||||
clip_rect.size.height);
|
||||
|
||||
if (!gsk_gl_driver_create_render_target (job->driver,
|
||||
(int) ceilf (clip_rect.size.width),
|
||||
(int) ceilf (clip_rect.size.height),
|
||||
get_target_format (job, node),
|
||||
GL_LINEAR, GL_LINEAR,
|
||||
&render_target))
|
||||
if G_LIKELY (texture->width <= max_texture_size &&
|
||||
texture->height <= max_texture_size)
|
||||
{
|
||||
gsk_gl_render_job_visit_texture (job, texture, bounds);
|
||||
return;
|
||||
GskGLRenderTarget *render_target;
|
||||
GskGLRenderOffscreen offscreen = {0};
|
||||
graphene_rect_t viewport;
|
||||
graphene_rect_t prev_viewport;
|
||||
graphene_matrix_t prev_projection;
|
||||
float prev_alpha;
|
||||
guint prev_fbo;
|
||||
guint texture_id;
|
||||
|
||||
viewport = GRAPHENE_RECT_INIT (0, 0,
|
||||
bounds->size.width,
|
||||
bounds->size.height);
|
||||
|
||||
if (!gsk_gl_driver_create_render_target (job->driver,
|
||||
(int) ceilf (viewport.size.width),
|
||||
(int) ceilf (viewport.size.height),
|
||||
get_target_format (job, node),
|
||||
GL_LINEAR, GL_LINEAR,
|
||||
&render_target))
|
||||
{
|
||||
/* viewport is too big, slice the texture and try again */
|
||||
goto slice;
|
||||
}
|
||||
|
||||
gsk_gl_render_job_upload_texture (job, texture, min_filter, mag_filter, &offscreen);
|
||||
|
||||
g_assert (offscreen.texture_id);
|
||||
g_assert (offscreen.was_offscreen == FALSE);
|
||||
|
||||
gsk_gl_render_job_set_viewport (job, &viewport, &prev_viewport);
|
||||
gsk_gl_render_job_set_projection_from_rect (job, &viewport, &prev_projection);
|
||||
gsk_gl_render_job_set_modelview (job, NULL);
|
||||
prev_alpha = gsk_gl_render_job_set_alpha (job, 1.0f);
|
||||
gsk_gl_render_job_push_clip (job, &GSK_ROUNDED_RECT_INIT_FROM_RECT (viewport));
|
||||
|
||||
prev_fbo = gsk_gl_command_queue_bind_framebuffer (job->command_queue, render_target->framebuffer_id);
|
||||
gsk_gl_command_queue_clear (job->command_queue, 0, &viewport);
|
||||
|
||||
gsk_gl_render_job_begin_draw (job, CHOOSE_PROGRAM (job, blit));
|
||||
gsk_gl_program_set_uniform_texture (job->current_program,
|
||||
UNIFORM_SHARED_SOURCE, 0,
|
||||
GL_TEXTURE_2D,
|
||||
GL_TEXTURE0,
|
||||
offscreen.texture_id);
|
||||
gsk_gl_render_job_draw_offscreen (job, &viewport, &offscreen);
|
||||
gsk_gl_render_job_end_draw (job);
|
||||
|
||||
gsk_gl_render_job_pop_clip (job);
|
||||
gsk_gl_render_job_pop_modelview (job);
|
||||
gsk_gl_render_job_set_viewport (job, &prev_viewport, NULL);
|
||||
gsk_gl_render_job_set_projection (job, &prev_projection);
|
||||
gsk_gl_render_job_set_alpha (job, prev_alpha);
|
||||
gsk_gl_command_queue_bind_framebuffer (job->command_queue, prev_fbo);
|
||||
|
||||
texture_id = gsk_gl_driver_release_render_target (job->driver, render_target, FALSE);
|
||||
|
||||
gsk_gl_render_job_begin_draw (job, CHOOSE_PROGRAM (job, blit));
|
||||
gsk_gl_program_set_uniform_texture (job->current_program,
|
||||
UNIFORM_SHARED_SOURCE, 0,
|
||||
GL_TEXTURE_2D,
|
||||
GL_TEXTURE0,
|
||||
texture_id);
|
||||
gsk_gl_render_job_draw_offscreen_rect (job, bounds);
|
||||
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;
|
||||
float max_y = min_y + bounds->size.height;
|
||||
float scale_x = (max_x - min_x) / texture->width;
|
||||
float scale_y = (max_y - min_y) / texture->height;
|
||||
GskGLTextureSlice *slices = NULL;
|
||||
guint n_slices = 0;
|
||||
GdkGLContext *context = gsk_gl_driver_get_context (job->driver);
|
||||
guint rows, cols;
|
||||
|
||||
gsk_gl_render_job_upload_texture (job, texture, min_filter, mag_filter, &offscreen);
|
||||
/* Slice enough that neither the original texture nor the scaled texture
|
||||
* exceed the texture size limit
|
||||
*/
|
||||
cols = (int)(MAX (bounds->size.width, texture->width) / (max_texture_size / 4)) + 1;
|
||||
rows = (int)(MAX (bounds->size.height, texture->height) / (max_texture_size / 4)) + 1;
|
||||
|
||||
g_assert (offscreen.texture_id);
|
||||
g_assert (offscreen.was_offscreen == FALSE);
|
||||
gsk_gl_driver_slice_texture (job->driver, texture, GL_NEAREST, GL_NEAREST, cols, rows, &slices, &n_slices);
|
||||
|
||||
u0 = (clip_rect.origin.x - bounds->origin.x) / bounds->size.width;
|
||||
v0 = (clip_rect.origin.y - bounds->origin.y) / bounds->size.height;
|
||||
u1 = (clip_rect.origin.x + clip_rect.size.width - bounds->origin.x) / bounds->size.width;
|
||||
v1 = (clip_rect.origin.y + clip_rect.size.height - bounds->origin.y) / bounds->size.height;
|
||||
g_assert (slices != NULL);
|
||||
g_assert (n_slices > 0);
|
||||
|
||||
gsk_gl_render_job_set_viewport (job, &viewport, &prev_viewport);
|
||||
gsk_gl_render_job_set_projection_from_rect (job, &viewport, &prev_projection);
|
||||
gsk_gl_render_job_set_modelview (job, NULL);
|
||||
prev_alpha = gsk_gl_render_job_set_alpha (job, 1.0f);
|
||||
gsk_gl_render_job_push_clip (job, &GSK_ROUNDED_RECT_INIT_FROM_RECT (viewport));
|
||||
for (guint i = 0; i < n_slices; i ++)
|
||||
{
|
||||
const GskGLTextureSlice *slice = &slices[i];
|
||||
float x1, x2, y1, y2;
|
||||
GdkTexture *sub_texture;
|
||||
GskRenderNode *sub_node;
|
||||
|
||||
prev_fbo = gsk_gl_command_queue_bind_framebuffer (job->command_queue, render_target->framebuffer_id);
|
||||
gsk_gl_command_queue_clear (job->command_queue, 0, &viewport);
|
||||
x1 = min_x + (scale_x * slice->rect.x);
|
||||
x2 = x1 + (slice->rect.width * scale_x);
|
||||
y1 = min_y + (scale_y * slice->rect.y);
|
||||
y2 = y1 + (slice->rect.height * scale_y);
|
||||
|
||||
gsk_gl_render_job_begin_draw (job, CHOOSE_PROGRAM (job, blit));
|
||||
gsk_gl_program_set_uniform_texture (job->current_program,
|
||||
UNIFORM_SHARED_SOURCE, 0,
|
||||
GL_TEXTURE_2D,
|
||||
GL_TEXTURE0,
|
||||
offscreen.texture_id);
|
||||
gsk_gl_render_job_draw_coords (job,
|
||||
0, 0, clip_rect.size.width, clip_rect.size.height,
|
||||
u0, v0, u1, v1,
|
||||
(guint16[]) { FP16_ZERO, FP16_ZERO, FP16_ZERO, FP16_ZERO });
|
||||
gsk_gl_render_job_end_draw (job);
|
||||
sub_texture = gdk_gl_texture_new (context, slice->texture_id, slice->rect.width, slice->rect.height, NULL, NULL);
|
||||
|
||||
gsk_gl_render_job_pop_clip (job);
|
||||
gsk_gl_render_job_pop_modelview (job);
|
||||
gsk_gl_render_job_set_viewport (job, &prev_viewport, NULL);
|
||||
gsk_gl_render_job_set_projection (job, &prev_projection);
|
||||
gsk_gl_render_job_set_alpha (job, prev_alpha);
|
||||
gsk_gl_command_queue_bind_framebuffer (job->command_queue, prev_fbo);
|
||||
sub_node = gsk_texture_scale_node_new (sub_texture, &GRAPHENE_RECT_INIT (x1, y1, x2 - x1, y2 - y1), scaling_filter);
|
||||
|
||||
texture_id = gsk_gl_driver_release_render_target (job->driver, render_target, FALSE);
|
||||
|
||||
gsk_gl_driver_cache_texture (job->driver, &key, texture_id);
|
||||
|
||||
render_texture:
|
||||
gsk_gl_render_job_begin_draw (job, CHOOSE_PROGRAM (job, blit));
|
||||
gsk_gl_program_set_uniform_texture (job->current_program,
|
||||
UNIFORM_SHARED_SOURCE, 0,
|
||||
GL_TEXTURE_2D,
|
||||
GL_TEXTURE0,
|
||||
texture_id);
|
||||
gsk_gl_render_job_draw_coords (job,
|
||||
job->offset_x + clip_rect.origin.x,
|
||||
job->offset_y + clip_rect.origin.y,
|
||||
job->offset_x + clip_rect.origin.x + clip_rect.size.width,
|
||||
job->offset_y + clip_rect.origin.y + clip_rect.size.height,
|
||||
0, clip_rect.size.width / ceilf (clip_rect.size.width),
|
||||
clip_rect.size.height / ceilf (clip_rect.size.height), 0,
|
||||
(guint16[]){ FP16_ZERO, FP16_ZERO, FP16_ZERO, FP16_ZERO } );
|
||||
gsk_gl_render_job_end_draw (job);
|
||||
gsk_gl_render_job_visit_node (job, sub_node);
|
||||
gsk_render_node_unref (sub_node);
|
||||
g_object_unref (sub_texture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
||||
@@ -10,24 +10,10 @@ 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);
|
||||
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));
|
||||
gskSetOutputColor(vec4 (source * mask.a));
|
||||
}
|
||||
|
||||
+5
-25
@@ -35,6 +35,7 @@
|
||||
* @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
|
||||
@@ -45,13 +46,12 @@
|
||||
* @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,6 +67,7 @@ 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,
|
||||
@@ -77,13 +78,12 @@ 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_TEXTURE_SCALE_NODE,
|
||||
GSK_MASK_NODE
|
||||
GSK_GL_SHADER_NODE
|
||||
} GskRenderNodeType;
|
||||
|
||||
/**
|
||||
@@ -255,25 +255,5 @@ 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__ */
|
||||
|
||||
+1
-4
@@ -535,14 +535,11 @@ 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,
|
||||
GskMaskMode mask_mode);
|
||||
GskRenderNode *mask);
|
||||
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;
|
||||
|
||||
+57
-274
@@ -21,10 +21,8 @@
|
||||
#include "gskrendernodeprivate.h"
|
||||
|
||||
#include "gskcairoblurprivate.h"
|
||||
#include "gskcairorenderer.h"
|
||||
#include "gskdebugprivate.h"
|
||||
#include "gskdiffprivate.h"
|
||||
#include "gl/gskglrenderer.h"
|
||||
#include "gskrendererprivate.h"
|
||||
#include "gskroundedrectprivate.h"
|
||||
#include "gsktransformprivate.h"
|
||||
@@ -33,10 +31,6 @@
|
||||
#include "gdk/gdkmemoryformatprivate.h"
|
||||
#include "gdk/gdkprivate.h"
|
||||
|
||||
#include <cairo.h>
|
||||
#ifdef CAIRO_HAS_SVG_SURFACE
|
||||
#include <cairo-svg.h>
|
||||
#endif
|
||||
#include <hb-ot.h>
|
||||
|
||||
/* maximal number of rectangles we keep in a diff region before we throw
|
||||
@@ -64,16 +58,6 @@ rectangle_init_from_graphene (cairo_rectangle_int_t *cairo,
|
||||
cairo->height = ceilf (graphene->origin.y + graphene->size.height) - cairo->y;
|
||||
}
|
||||
|
||||
static void
|
||||
_graphene_rect_init_from_clip_extents (graphene_rect_t *rect,
|
||||
cairo_t *cr)
|
||||
{
|
||||
double x1c, y1c, x2c, y2c;
|
||||
|
||||
cairo_clip_extents (cr, &x1c, &y1c, &x2c, &y2c);
|
||||
graphene_rect_init (rect, x1c, y1c, x2c - x1c, y2c - y1c);
|
||||
}
|
||||
|
||||
/* {{{ GSK_COLOR_NODE */
|
||||
|
||||
/**
|
||||
@@ -1573,10 +1557,6 @@ gsk_texture_node_get_texture (const GskRenderNode *node)
|
||||
* Creates a `GskRenderNode` that will render the given
|
||||
* @texture into the area given by @bounds.
|
||||
*
|
||||
* Note that GSK applies linear filtering when textures are
|
||||
* scaled and transformed. See [class@Gsk.TextureScaleNode]
|
||||
* for a way to influence filtering.
|
||||
*
|
||||
* Returns: (transfer full) (type GskTextureNode): A new `GskRenderNode`
|
||||
*/
|
||||
GskRenderNode *
|
||||
@@ -1608,8 +1588,6 @@ gsk_texture_node_new (GdkTexture *texture,
|
||||
* GskTextureScaleNode:
|
||||
*
|
||||
* A render node for a `GdkTexture`.
|
||||
*
|
||||
* Since: 4.10
|
||||
*/
|
||||
struct _GskTextureScaleNode
|
||||
{
|
||||
@@ -1645,21 +1623,15 @@ gsk_texture_scale_node_draw (GskRenderNode *node,
|
||||
};
|
||||
cairo_t *cr2;
|
||||
cairo_surface_t *surface2;
|
||||
graphene_rect_t clip_rect;
|
||||
|
||||
/* Make sure we draw the minimum region by using the clip */
|
||||
gsk_cairo_rectangle (cr, &node->bounds);
|
||||
cairo_clip (cr);
|
||||
_graphene_rect_init_from_clip_extents (&clip_rect, cr);
|
||||
if (clip_rect.size.width <= 0 || clip_rect.size.height <= 0)
|
||||
return;
|
||||
|
||||
surface2 = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
|
||||
(int) ceilf (clip_rect.size.width),
|
||||
(int) ceilf (clip_rect.size.height));
|
||||
cairo_surface_set_device_offset (surface2, -clip_rect.origin.x, -clip_rect.origin.y);
|
||||
(int) ceilf (node->bounds.size.width),
|
||||
(int) ceilf (node->bounds.size.height));
|
||||
cr2 = cairo_create (surface2);
|
||||
|
||||
cairo_set_source_rgba (cr2, 0, 0, 0, 0);
|
||||
cairo_paint (cr2);
|
||||
|
||||
surface = gdk_texture_download_surface (self->texture);
|
||||
pattern = cairo_pattern_create_for_surface (surface);
|
||||
cairo_pattern_set_extend (pattern, CAIRO_EXTEND_PAD);
|
||||
@@ -1717,7 +1689,7 @@ gsk_texture_scale_node_diff (GskRenderNode *node1,
|
||||
|
||||
/**
|
||||
* gsk_texture_scale_node_get_texture:
|
||||
* @node: (type GskTextureScaleNode): a `GskRenderNode` of type %GSK_TEXTURE_SCALE_NODE
|
||||
* @node: (type GskTextureNode): a `GskRenderNode` of type %GSK_TEXTURE_SCALE_NODE
|
||||
*
|
||||
* Retrieves the `GdkTexture` used when creating this `GskRenderNode`.
|
||||
*
|
||||
@@ -1735,7 +1707,7 @@ gsk_texture_scale_node_get_texture (const GskRenderNode *node)
|
||||
|
||||
/**
|
||||
* gsk_texture_scale_node_get_filter:
|
||||
* @node: (type GskTextureScaleNode): a `GskRenderNode` of type %GSK_TEXTURE_SCALE_NODE
|
||||
* @node: (type GskTextureNode): a `GskRenderNode` of type %GSK_TEXTURE_SCALE_NODE
|
||||
*
|
||||
* Retrieves the `GskScalingFilter` used when creating this `GskRenderNode`.
|
||||
*
|
||||
@@ -1758,11 +1730,7 @@ gsk_texture_scale_node_get_filter (const GskRenderNode *node)
|
||||
* @filter: how to scale the texture
|
||||
*
|
||||
* Creates a node that scales the texture to the size given by the
|
||||
* bounds using the filter and then places it at the bounds' position.
|
||||
*
|
||||
* Note that further scaling and other transformations which are
|
||||
* applied to the node will apply linear filtering to the resulting
|
||||
* texture, as usual.
|
||||
* bounds and the filter and then places it at the bounds' position.
|
||||
*
|
||||
* This node is intended for tight control over scaling applied
|
||||
* to a texture, such as in image editors and requires the
|
||||
@@ -2102,15 +2070,15 @@ gsk_inset_shadow_node_draw (GskRenderNode *node,
|
||||
GskInsetShadowNode *self = (GskInsetShadowNode *) node;
|
||||
GskRoundedRect box, clip_box;
|
||||
int clip_radius;
|
||||
graphene_rect_t clip_rect;
|
||||
double x1c, y1c, x2c, y2c;
|
||||
double blur_radius;
|
||||
|
||||
/* We don't need to draw invisible shadows */
|
||||
if (gdk_rgba_is_clear (&self->color))
|
||||
return;
|
||||
|
||||
_graphene_rect_init_from_clip_extents (&clip_rect, cr);
|
||||
if (!gsk_rounded_rect_intersects_rect (&self->outline, &clip_rect))
|
||||
cairo_clip_extents (cr, &x1c, &y1c, &x2c, &y2c);
|
||||
if (!gsk_rounded_rect_intersects_rect (&self->outline, &GRAPHENE_RECT_INIT (x1c, y1c, x2c - x1c, y2c - y1c)))
|
||||
return;
|
||||
|
||||
blur_radius = self->blur_radius / 2;
|
||||
@@ -2398,7 +2366,7 @@ gsk_outset_shadow_node_draw (GskRenderNode *node,
|
||||
GskOutsetShadowNode *self = (GskOutsetShadowNode *) node;
|
||||
GskRoundedRect box, clip_box;
|
||||
int clip_radius;
|
||||
graphene_rect_t clip_rect;
|
||||
double x1c, y1c, x2c, y2c;
|
||||
float top, right, bottom, left;
|
||||
double blur_radius;
|
||||
|
||||
@@ -2406,8 +2374,8 @@ gsk_outset_shadow_node_draw (GskRenderNode *node,
|
||||
if (gdk_rgba_is_clear (&self->color))
|
||||
return;
|
||||
|
||||
_graphene_rect_init_from_clip_extents (&clip_rect, cr);
|
||||
if (!gsk_rounded_rect_intersects_rect (&self->outline, &clip_rect))
|
||||
cairo_clip_extents (cr, &x1c, &y1c, &x2c, &y2c);
|
||||
if (gsk_rounded_rect_contains_rect (&self->outline, &GRAPHENE_RECT_INIT (x1c, y1c, x2c - x1c, y2c - y1c)))
|
||||
return;
|
||||
|
||||
blur_radius = self->blur_radius / 2;
|
||||
@@ -3442,18 +3410,29 @@ gsk_color_matrix_node_finalize (GskRenderNode *node)
|
||||
}
|
||||
|
||||
static void
|
||||
apply_color_matrix_to_pattern (cairo_pattern_t *pattern,
|
||||
const graphene_matrix_t *color_matrix,
|
||||
const graphene_vec4_t *color_offset,
|
||||
gboolean multiply_alpha)
|
||||
gsk_color_matrix_node_draw (GskRenderNode *node,
|
||||
cairo_t *cr)
|
||||
{
|
||||
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);
|
||||
|
||||
@@ -3480,20 +3459,12 @@ apply_color_matrix_to_pattern (cairo_pattern_t *pattern,
|
||||
((pixel_data[x] >> 8) & 0xFF) / (255.0 * alpha),
|
||||
( pixel_data[x] & 0xFF) / (255.0 * alpha),
|
||||
alpha);
|
||||
graphene_matrix_transform_vec4 (color_matrix, &pixel, &pixel);
|
||||
graphene_matrix_transform_vec4 (&self->color_matrix, &pixel, &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);
|
||||
graphene_vec4_add (&pixel, &self->color_offset, &pixel);
|
||||
|
||||
alpha = graphene_vec4_get_w (&pixel);
|
||||
|
||||
if (alpha > 0.0)
|
||||
{
|
||||
alpha = MIN (alpha, 1.0);
|
||||
@@ -3512,28 +3483,6 @@ apply_color_matrix_to_pattern (cairo_pattern_t *pattern,
|
||||
|
||||
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);
|
||||
@@ -5253,7 +5202,6 @@ struct _GskMaskNode
|
||||
|
||||
GskRenderNode *mask;
|
||||
GskRenderNode *source;
|
||||
GskMaskMode mask_mode;
|
||||
};
|
||||
|
||||
static void
|
||||
@@ -5271,8 +5219,6 @@ 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);
|
||||
@@ -5282,41 +5228,6 @@ 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);
|
||||
}
|
||||
|
||||
@@ -5334,15 +5245,11 @@ gsk_mask_node_diff (GskRenderNode *node1,
|
||||
|
||||
/**
|
||||
* gsk_mask_node_new:
|
||||
* @source: The source node to be drawn
|
||||
* @mask: The node to be used as mask
|
||||
* @mask_mode: The mask mode to use
|
||||
* @source: The bottom node to be drawn
|
||||
* @mask: The node to be blended 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.
|
||||
* Creates a `GskRenderNode` that will use @blend_mode to blend the @top
|
||||
* node onto the @bottom node.
|
||||
*
|
||||
* Returns: (transfer full) (type GskMaskNode): A new `GskRenderNode`
|
||||
*
|
||||
@@ -5350,8 +5257,7 @@ gsk_mask_node_diff (GskRenderNode *node1,
|
||||
*/
|
||||
GskRenderNode *
|
||||
gsk_mask_node_new (GskRenderNode *source,
|
||||
GskRenderNode *mask,
|
||||
GskMaskMode mask_mode)
|
||||
GskRenderNode *mask)
|
||||
{
|
||||
GskMaskNode *self;
|
||||
|
||||
@@ -5361,18 +5267,15 @@ 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;
|
||||
|
||||
self->render_node.bounds = source->bounds;
|
||||
|
||||
self->render_node.prefers_high_depth = gsk_render_node_prefers_high_depth (source);
|
||||
graphene_rect_union (&source->bounds, &mask->bounds, &self->render_node.bounds);
|
||||
|
||||
return &self->render_node;
|
||||
}
|
||||
|
||||
/**
|
||||
* gsk_mask_node_get_source:
|
||||
* @node: (type GskMaskNode): a mask `GskRenderNode`
|
||||
* @node: (type GskBlendNode): a mask `GskRenderNode`
|
||||
*
|
||||
* Retrieves the source `GskRenderNode` child of the @node.
|
||||
*
|
||||
@@ -5392,7 +5295,7 @@ gsk_mask_node_get_source (const GskRenderNode *node)
|
||||
|
||||
/**
|
||||
* gsk_mask_node_get_mask:
|
||||
* @node: (type GskMaskNode): a mask `GskRenderNode`
|
||||
* @node: (type GskBlendNode): a mask `GskRenderNode`
|
||||
*
|
||||
* Retrieves the mask `GskRenderNode` child of the @node.
|
||||
*
|
||||
@@ -5410,24 +5313,6 @@ 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 */
|
||||
|
||||
@@ -6241,9 +6126,9 @@ gsk_render_node_init_types_once (void)
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_render_node_serialize_bytes_finish (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer serializer)
|
||||
gsk_render_node_content_serializer_finish (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer serializer)
|
||||
{
|
||||
GOutputStream *stream = G_OUTPUT_STREAM (source);
|
||||
GError *error = NULL;
|
||||
@@ -6254,109 +6139,10 @@ gsk_render_node_serialize_bytes_finish (GObject *source,
|
||||
gdk_content_serializer_return_success (serializer);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_render_node_serialize_bytes (GdkContentSerializer *serializer,
|
||||
GBytes *bytes)
|
||||
{
|
||||
GInputStream *input;
|
||||
|
||||
input = g_memory_input_stream_new_from_bytes (bytes);
|
||||
|
||||
g_output_stream_splice_async (gdk_content_serializer_get_output_stream (serializer),
|
||||
input,
|
||||
G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE,
|
||||
gdk_content_serializer_get_priority (serializer),
|
||||
gdk_content_serializer_get_cancellable (serializer),
|
||||
gsk_render_node_serialize_bytes_finish,
|
||||
serializer);
|
||||
g_object_unref (input);
|
||||
g_bytes_unref (bytes);
|
||||
}
|
||||
|
||||
#ifdef CAIRO_HAS_SVG_SURFACE
|
||||
static cairo_status_t
|
||||
gsk_render_node_cairo_serializer_write (gpointer user_data,
|
||||
const unsigned char *data,
|
||||
unsigned int length)
|
||||
{
|
||||
g_byte_array_append (user_data, data, length);
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_render_node_svg_serializer (GdkContentSerializer *serializer)
|
||||
{
|
||||
GskRenderNode *node;
|
||||
cairo_surface_t *surface;
|
||||
cairo_t *cr;
|
||||
graphene_rect_t bounds;
|
||||
GByteArray *array;
|
||||
|
||||
node = gsk_value_get_render_node (gdk_content_serializer_get_value (serializer));
|
||||
gsk_render_node_get_bounds (node, &bounds);
|
||||
array = g_byte_array_new ();
|
||||
|
||||
surface = cairo_svg_surface_create_for_stream (gsk_render_node_cairo_serializer_write,
|
||||
array,
|
||||
bounds.size.width,
|
||||
bounds.size.height);
|
||||
cairo_svg_surface_set_document_unit (surface, CAIRO_SVG_UNIT_PX);
|
||||
cairo_surface_set_device_offset (surface, -bounds.origin.x, -bounds.origin.y);
|
||||
|
||||
cr = cairo_create (surface);
|
||||
gsk_render_node_draw (node, cr);
|
||||
cairo_destroy (cr);
|
||||
|
||||
cairo_surface_finish (surface);
|
||||
if (cairo_surface_status (surface) == CAIRO_STATUS_SUCCESS)
|
||||
{
|
||||
gsk_render_node_serialize_bytes (serializer, g_byte_array_free_to_bytes (array));
|
||||
}
|
||||
else
|
||||
{
|
||||
GError *error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
cairo_status_to_string (cairo_surface_status (surface)));
|
||||
gdk_content_serializer_return_error (serializer, error);
|
||||
g_byte_array_unref (array);
|
||||
}
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
gsk_render_node_png_serializer (GdkContentSerializer *serializer)
|
||||
{
|
||||
GskRenderNode *node;
|
||||
GdkTexture *texture;
|
||||
GskRenderer *renderer;
|
||||
GBytes *bytes;
|
||||
|
||||
node = gsk_value_get_render_node (gdk_content_serializer_get_value (serializer));
|
||||
|
||||
renderer = gsk_gl_renderer_new ();
|
||||
if (!gsk_renderer_realize (renderer, NULL, NULL))
|
||||
{
|
||||
g_object_unref (renderer);
|
||||
renderer = gsk_cairo_renderer_new ();
|
||||
if (!gsk_renderer_realize (renderer, NULL, NULL))
|
||||
{
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
texture = gsk_renderer_render_texture (renderer, node, NULL);
|
||||
gsk_renderer_unrealize (renderer);
|
||||
g_object_unref (renderer);
|
||||
|
||||
bytes = gdk_texture_save_to_png_bytes (texture);
|
||||
g_object_unref (texture);
|
||||
|
||||
gsk_render_node_serialize_bytes (serializer, bytes);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_render_node_content_serializer (GdkContentSerializer *serializer)
|
||||
{
|
||||
GInputStream *input;
|
||||
const GValue *value;
|
||||
GskRenderNode *node;
|
||||
GBytes *bytes;
|
||||
@@ -6364,14 +6150,23 @@ gsk_render_node_content_serializer (GdkContentSerializer *serializer)
|
||||
value = gdk_content_serializer_get_value (serializer);
|
||||
node = gsk_value_get_render_node (value);
|
||||
bytes = gsk_render_node_serialize (node);
|
||||
input = g_memory_input_stream_new_from_bytes (bytes);
|
||||
|
||||
gsk_render_node_serialize_bytes (serializer, bytes);
|
||||
g_output_stream_splice_async (gdk_content_serializer_get_output_stream (serializer),
|
||||
input,
|
||||
G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE,
|
||||
gdk_content_serializer_get_priority (serializer),
|
||||
gdk_content_serializer_get_cancellable (serializer),
|
||||
gsk_render_node_content_serializer_finish,
|
||||
serializer);
|
||||
g_object_unref (input);
|
||||
g_bytes_unref (bytes);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_render_node_content_deserializer_finish (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer deserializer)
|
||||
GAsyncResult *result,
|
||||
gpointer deserializer)
|
||||
{
|
||||
GOutputStream *stream = G_OUTPUT_STREAM (source);
|
||||
GError *error = NULL;
|
||||
@@ -6435,18 +6230,6 @@ gsk_render_node_init_content_serializers (void)
|
||||
gsk_render_node_content_serializer,
|
||||
NULL,
|
||||
NULL);
|
||||
#ifdef CAIRO_HAS_SVG_SURFACE
|
||||
gdk_content_register_serializer (GSK_TYPE_RENDER_NODE,
|
||||
"image/svg+xml",
|
||||
gsk_render_node_svg_serializer,
|
||||
NULL,
|
||||
NULL);
|
||||
#endif
|
||||
gdk_content_register_serializer (GSK_TYPE_RENDER_NODE,
|
||||
"image/png",
|
||||
gsk_render_node_png_serializer,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
gdk_content_register_deserializer ("application/x-gtk-render-node",
|
||||
GSK_TYPE_RENDER_NODE,
|
||||
|
||||
+13
-91
@@ -128,10 +128,6 @@ parse_texture (GtkCssParser *parser,
|
||||
}
|
||||
else
|
||||
{
|
||||
g_set_error (&error,
|
||||
GTK_CSS_PARSER_ERROR,
|
||||
GTK_CSS_PARSER_ERROR_UNKNOWN_VALUE,
|
||||
"Failed to resolve URL");
|
||||
texture = NULL;
|
||||
}
|
||||
}
|
||||
@@ -233,19 +229,8 @@ parse_script (GtkCssParser *parser,
|
||||
GFile *file;
|
||||
|
||||
file = gtk_css_parser_resolve_url (parser, url);
|
||||
if (file)
|
||||
{
|
||||
bytes = g_file_load_bytes (file, NULL, NULL, &error);
|
||||
g_object_unref (file);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_set_error (&error,
|
||||
GTK_CSS_PARSER_ERROR,
|
||||
GTK_CSS_PARSER_ERROR_UNKNOWN_VALUE,
|
||||
"Failed to resolve URL");
|
||||
bytes = NULL;
|
||||
}
|
||||
bytes = g_file_load_bytes (file, NULL, NULL, &error);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
g_free (scheme);
|
||||
@@ -431,10 +416,7 @@ parse_string (GtkCssParser *parser,
|
||||
|
||||
token = gtk_css_parser_get_token (parser);
|
||||
if (!gtk_css_token_is (token, GTK_CSS_TOKEN_STRING))
|
||||
{
|
||||
gtk_css_parser_error_syntax (parser, "Expected a string");
|
||||
return FALSE;
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
s = g_strdup (gtk_css_token_get_string (token));
|
||||
gtk_css_parser_consume_token (parser);
|
||||
@@ -641,8 +623,6 @@ parse_scaling_filter (GtkCssParser *parser,
|
||||
}
|
||||
}
|
||||
|
||||
gtk_css_parser_error_syntax (parser, "Not a valid scaling filter.");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -669,18 +649,6 @@ 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)
|
||||
@@ -696,51 +664,6 @@ 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;
|
||||
}
|
||||
|
||||
@@ -1458,9 +1381,7 @@ 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 },
|
||||
};
|
||||
@@ -1472,7 +1393,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, mode);
|
||||
result = gsk_mask_node_new (source, mask);
|
||||
|
||||
gsk_render_node_unref (source);
|
||||
gsk_render_node_unref (mask);
|
||||
@@ -3182,13 +3103,21 @@ 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);
|
||||
g_string_append_printf (p->str, "mode: %s;\n", get_blend_mode_name (mode));
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
append_node_param (p, "bottom", gsk_blend_node_get_bottom_child (node));
|
||||
append_node_param (p, "top", gsk_blend_node_get_top_child (node));
|
||||
@@ -3199,15 +3128,8 @@ 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_MASK_NODE + 1)
|
||||
#define GSK_RENDER_NODE_TYPE_N_TYPES (GSK_GL_SHADER_NODE + 1)
|
||||
|
||||
extern GType gsk_render_node_types[];
|
||||
|
||||
|
||||
+1
-1
@@ -164,7 +164,7 @@ gskenum_h = gsk_enums[1]
|
||||
gskresources = gnome.compile_resources('gskresources',
|
||||
gsk_resources_xml,
|
||||
dependencies: gsk_private_vulkan_compiled_shaders_deps,
|
||||
source_dir: meson.current_source_dir(),
|
||||
source_dir: '.',
|
||||
c_name: '_gsk',
|
||||
extra_args: [ '--manual-register', ],
|
||||
)
|
||||
|
||||
@@ -158,12 +158,9 @@ component_handle_method (GDBusConnection *connection,
|
||||
}
|
||||
else
|
||||
{
|
||||
GtkATContext *context = gtk_accessible_get_at_context (GTK_ACCESSIBLE (child));
|
||||
GtkAtSpiContext *ctx = GTK_AT_SPI_CONTEXT (context);
|
||||
GtkAtSpiContext *ctx = GTK_AT_SPI_CONTEXT (gtk_accessible_get_at_context (GTK_ACCESSIBLE (child)));
|
||||
|
||||
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(@(so))", gtk_at_spi_context_to_ref (ctx)));
|
||||
|
||||
g_object_unref (context);
|
||||
}
|
||||
}
|
||||
else if (g_strcmp0 (method_name, "GetExtents") == 0)
|
||||
|
||||
+33
-112
@@ -203,7 +203,6 @@ collect_states (GtkAtSpiContext *self,
|
||||
|
||||
if (gtk_at_context_has_accessible_state (ctx, GTK_ACCESSIBLE_STATE_CHECKED))
|
||||
{
|
||||
set_atspi_state (&states, ATSPI_STATE_CHECKABLE);
|
||||
value = gtk_at_context_get_accessible_state (ctx, GTK_ACCESSIBLE_STATE_CHECKED);
|
||||
switch (gtk_tristate_accessible_value_get (value))
|
||||
{
|
||||
@@ -247,7 +246,7 @@ collect_states (GtkAtSpiContext *self,
|
||||
case GTK_ACCESSIBLE_INVALID_TRUE:
|
||||
case GTK_ACCESSIBLE_INVALID_GRAMMAR:
|
||||
case GTK_ACCESSIBLE_INVALID_SPELLING:
|
||||
set_atspi_state (&states, ATSPI_STATE_INVALID_ENTRY);
|
||||
set_atspi_state (&states, ATSPI_STATE_INVALID);
|
||||
break;
|
||||
case GTK_ACCESSIBLE_INVALID_FALSE:
|
||||
default:
|
||||
@@ -283,34 +282,6 @@ collect_states (GtkAtSpiContext *self,
|
||||
}
|
||||
}
|
||||
|
||||
if (gtk_at_context_has_accessible_property (ctx, GTK_ACCESSIBLE_PROPERTY_REQUIRED))
|
||||
{
|
||||
value = gtk_at_context_get_accessible_property (ctx, GTK_ACCESSIBLE_PROPERTY_REQUIRED);
|
||||
if (gtk_boolean_accessible_value_get (value))
|
||||
set_atspi_state (&states, ATSPI_STATE_REQUIRED);
|
||||
}
|
||||
|
||||
if (gtk_at_context_has_accessible_property (ctx, GTK_ACCESSIBLE_PROPERTY_MULTI_SELECTABLE))
|
||||
{
|
||||
value = gtk_at_context_get_accessible_property (ctx, GTK_ACCESSIBLE_PROPERTY_MULTI_SELECTABLE);
|
||||
if (gtk_boolean_accessible_value_get (value))
|
||||
set_atspi_state (&states, ATSPI_STATE_MULTISELECTABLE);
|
||||
}
|
||||
|
||||
if (gtk_at_context_has_accessible_property (ctx, GTK_ACCESSIBLE_PROPERTY_HAS_POPUP))
|
||||
{
|
||||
value = gtk_at_context_get_accessible_property (ctx, GTK_ACCESSIBLE_PROPERTY_HAS_POPUP);
|
||||
if (gtk_boolean_accessible_value_get (value))
|
||||
set_atspi_state (&states, ATSPI_STATE_HAS_POPUP);
|
||||
}
|
||||
|
||||
if (gtk_at_context_has_accessible_property (ctx, GTK_ACCESSIBLE_PROPERTY_AUTOCOMPLETE))
|
||||
{
|
||||
value = gtk_at_context_get_accessible_property (ctx, GTK_ACCESSIBLE_PROPERTY_AUTOCOMPLETE);
|
||||
if (gtk_autocomplete_accessible_value_get (value) != GTK_ACCESSIBLE_AUTOCOMPLETE_NONE)
|
||||
set_atspi_state (&states, ATSPI_STATE_SUPPORTS_AUTOCOMPLETION);
|
||||
}
|
||||
|
||||
g_variant_builder_add (builder, "u", (guint32) (states & 0xffffffff));
|
||||
g_variant_builder_add (builder, "u", (guint32) (states >> 32));
|
||||
}
|
||||
@@ -328,12 +299,11 @@ collect_relations (GtkAtSpiContext *self,
|
||||
{ GTK_ACCESSIBLE_RELATION_LABELLED_BY, ATSPI_RELATION_LABELLED_BY },
|
||||
{ GTK_ACCESSIBLE_RELATION_CONTROLS, ATSPI_RELATION_CONTROLLER_FOR },
|
||||
{ GTK_ACCESSIBLE_RELATION_DESCRIBED_BY, ATSPI_RELATION_DESCRIBED_BY },
|
||||
{ GTK_ACCESSIBLE_RELATION_DETAILS, ATSPI_RELATION_DETAILS },
|
||||
{ GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE, ATSPI_RELATION_ERROR_MESSAGE},
|
||||
{ GTK_ACCESSIBLE_RELATION_FLOW_TO, ATSPI_RELATION_FLOWS_TO},
|
||||
};
|
||||
GtkAccessibleValue *value;
|
||||
GList *list, *l;
|
||||
GtkATContext *target_ctx;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (map); i++)
|
||||
@@ -348,16 +318,13 @@ collect_relations (GtkAtSpiContext *self,
|
||||
|
||||
for (l = list; l; l = l->next)
|
||||
{
|
||||
GtkATContext *target_ctx =
|
||||
gtk_accessible_get_at_context (GTK_ACCESSIBLE (l->data));
|
||||
target_ctx = gtk_accessible_get_at_context (GTK_ACCESSIBLE (l->data));
|
||||
|
||||
/* Realize the ATContext of the target, so we can ask for its ref */
|
||||
gtk_at_context_realize (target_ctx);
|
||||
|
||||
g_variant_builder_add (&b, "@(so)",
|
||||
gtk_at_spi_context_to_ref (GTK_AT_SPI_CONTEXT (target_ctx)));
|
||||
|
||||
g_object_unref (target_ctx);
|
||||
}
|
||||
|
||||
g_variant_builder_add (builder, "(ua(so))", map[i].s, &b);
|
||||
@@ -369,17 +336,17 @@ static int
|
||||
get_index_in (GtkAccessible *parent,
|
||||
GtkAccessible *child)
|
||||
{
|
||||
GtkAccessible *candidate;
|
||||
guint res;
|
||||
|
||||
if (parent == NULL)
|
||||
return -1;
|
||||
|
||||
guint res = 0;
|
||||
GtkAccessible *candidate;
|
||||
res = 0;
|
||||
for (candidate = gtk_accessible_get_first_accessible_child (parent);
|
||||
candidate != NULL;
|
||||
candidate = gtk_accessible_get_next_accessible_sibling (candidate))
|
||||
{
|
||||
g_object_unref (candidate);
|
||||
|
||||
if (candidate == child)
|
||||
return res;
|
||||
|
||||
@@ -398,13 +365,7 @@ get_index_in_parent (GtkAccessible *accessible)
|
||||
GtkAccessible *parent = gtk_accessible_get_accessible_parent (accessible);
|
||||
|
||||
if (parent != NULL)
|
||||
{
|
||||
int res = get_index_in (parent, accessible);
|
||||
|
||||
g_object_unref (parent);
|
||||
|
||||
return res;
|
||||
}
|
||||
return get_index_in (parent, accessible);
|
||||
|
||||
return -1;
|
||||
}
|
||||
@@ -440,6 +401,7 @@ static GVariant *
|
||||
get_parent_context_ref (GtkAccessible *accessible)
|
||||
{
|
||||
GVariant *res = NULL;
|
||||
|
||||
GtkAccessible *parent = gtk_accessible_get_accessible_parent (accessible);
|
||||
|
||||
if (parent == NULL)
|
||||
@@ -448,19 +410,13 @@ get_parent_context_ref (GtkAccessible *accessible)
|
||||
GtkAtSpiContext *self = GTK_AT_SPI_CONTEXT (context);
|
||||
|
||||
res = gtk_at_spi_root_to_ref (self->root);
|
||||
|
||||
g_object_unref (context);
|
||||
}
|
||||
else
|
||||
{
|
||||
GtkATContext *parent_context = gtk_accessible_get_at_context (parent);
|
||||
|
||||
gtk_at_context_realize (parent_context);
|
||||
|
||||
res = gtk_at_spi_context_to_ref (GTK_AT_SPI_CONTEXT (parent_context));
|
||||
|
||||
g_object_unref (parent_context);
|
||||
g_object_unref (parent);
|
||||
}
|
||||
|
||||
if (res == NULL)
|
||||
@@ -541,32 +497,31 @@ handle_accessible_method (GDBusConnection *connection,
|
||||
{
|
||||
GtkATContext *context = NULL;
|
||||
GtkAccessible *accessible;
|
||||
GtkAccessible *child = NULL;
|
||||
int idx, presentable_idx;
|
||||
|
||||
g_variant_get (parameters, "(i)", &idx);
|
||||
|
||||
accessible = gtk_at_context_get_accessible (GTK_AT_CONTEXT (self));
|
||||
|
||||
presentable_idx = 0;
|
||||
GtkAccessible *child;
|
||||
|
||||
presentable_idx = 0;
|
||||
for (child = gtk_accessible_get_first_accessible_child (accessible);
|
||||
child != NULL;
|
||||
child = gtk_accessible_get_next_accessible_sibling (child))
|
||||
{
|
||||
g_object_unref (child);
|
||||
|
||||
if (!gtk_accessible_should_present (child))
|
||||
continue;
|
||||
continue;
|
||||
|
||||
if (presentable_idx == idx)
|
||||
break;
|
||||
presentable_idx++;
|
||||
|
||||
presentable_idx += 1;
|
||||
}
|
||||
|
||||
if (child != NULL)
|
||||
context = gtk_accessible_get_at_context (child);
|
||||
if (child)
|
||||
{
|
||||
context = gtk_accessible_get_at_context (child);
|
||||
}
|
||||
|
||||
if (context == NULL)
|
||||
{
|
||||
@@ -581,23 +536,20 @@ handle_accessible_method (GDBusConnection *connection,
|
||||
gtk_at_context_realize (context);
|
||||
|
||||
GVariant *ref = gtk_at_spi_context_to_ref (GTK_AT_SPI_CONTEXT (context));
|
||||
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(@(so))", ref));
|
||||
|
||||
g_object_unref (context);
|
||||
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(@(so))", ref));
|
||||
}
|
||||
else if (g_strcmp0 (method_name, "GetChildren") == 0)
|
||||
{
|
||||
GVariantBuilder builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE ("a(so)"));
|
||||
|
||||
GtkAccessible *accessible = gtk_at_context_get_accessible (GTK_AT_CONTEXT (self));
|
||||
GtkAccessible *child = NULL;
|
||||
|
||||
GtkAccessible *child;
|
||||
for (child = gtk_accessible_get_first_accessible_child (accessible);
|
||||
child != NULL;
|
||||
child = gtk_accessible_get_next_accessible_sibling (child))
|
||||
{
|
||||
g_object_unref (child);
|
||||
|
||||
{
|
||||
if (!gtk_accessible_should_present (child))
|
||||
continue;
|
||||
|
||||
@@ -610,8 +562,6 @@ handle_accessible_method (GDBusConnection *connection,
|
||||
|
||||
if (ref != NULL)
|
||||
g_variant_builder_add (&builder, "@(so)", ref);
|
||||
|
||||
g_object_unref (context);
|
||||
}
|
||||
|
||||
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(a(so))", &builder));
|
||||
@@ -791,13 +741,8 @@ emit_property_changed (GtkAtSpiContext *self,
|
||||
const char *name,
|
||||
GVariant *value)
|
||||
{
|
||||
GVariant *value_owned = g_variant_ref_sink (value);
|
||||
|
||||
if (self->connection == NULL)
|
||||
{
|
||||
g_variant_unref (value_owned);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
|
||||
g_dbus_connection_emit_signal (self->connection,
|
||||
NULL,
|
||||
@@ -805,9 +750,8 @@ emit_property_changed (GtkAtSpiContext *self,
|
||||
"org.a11y.atspi.Event.Object",
|
||||
"PropertyChange",
|
||||
g_variant_new ("(siiva{sv})",
|
||||
name, 0, 0, value_owned, NULL),
|
||||
name, 0, 0, value, NULL),
|
||||
NULL);
|
||||
g_variant_unref (value_owned);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -906,6 +850,8 @@ gtk_at_spi_context_state_change (GtkATContext *ctx,
|
||||
|
||||
if (changed_states & GTK_ACCESSIBLE_STATE_CHANGE_HIDDEN)
|
||||
{
|
||||
GtkAccessible *parent;
|
||||
GtkATContext *context;
|
||||
GtkAccessibleChildChange change;
|
||||
|
||||
value = gtk_accessible_attribute_set_get_value (states, GTK_ACCESSIBLE_STATE_HIDDEN);
|
||||
@@ -921,15 +867,10 @@ gtk_at_spi_context_state_change (GtkATContext *ctx,
|
||||
}
|
||||
else
|
||||
{
|
||||
GtkAccessible *parent =
|
||||
gtk_accessible_get_accessible_parent (accessible);
|
||||
GtkATContext *context =
|
||||
gtk_accessible_get_at_context (parent);
|
||||
parent = gtk_accessible_get_accessible_parent (accessible);
|
||||
|
||||
context = gtk_accessible_get_at_context (parent);
|
||||
gtk_at_context_child_changed (context, change, accessible);
|
||||
|
||||
g_object_unref (context);
|
||||
g_object_unref (parent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1096,18 +1037,10 @@ gtk_at_spi_context_state_change (GtkATContext *ctx,
|
||||
}
|
||||
|
||||
if (changed_properties & GTK_ACCESSIBLE_PROPERTY_CHANGE_DESCRIPTION)
|
||||
{
|
||||
char *label = gtk_at_context_get_description (GTK_AT_CONTEXT (self));
|
||||
GVariant *v = g_variant_new_take_string (label);
|
||||
emit_property_changed (self, "accessible-description", v);
|
||||
}
|
||||
|
||||
if (changed_properties & GTK_ACCESSIBLE_PROPERTY_CHANGE_VALUE_NOW)
|
||||
{
|
||||
value = gtk_accessible_attribute_set_get_value (properties, GTK_ACCESSIBLE_PROPERTY_VALUE_NOW);
|
||||
emit_property_changed (self,
|
||||
"accessible-value",
|
||||
g_variant_new_double (gtk_number_accessible_value_get (value)));
|
||||
char *label = gtk_at_context_get_description (GTK_AT_CONTEXT (self));
|
||||
GVariant *v = g_variant_new_take_string (label);
|
||||
emit_property_changed (self, "accessible-description", v);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1186,18 +1119,9 @@ gtk_at_spi_context_child_change (GtkATContext *ctx,
|
||||
int idx = 0;
|
||||
|
||||
if (parent == NULL)
|
||||
{
|
||||
idx = -1;
|
||||
}
|
||||
idx = -1;
|
||||
else if (parent == accessible)
|
||||
{
|
||||
idx = get_index_in (accessible, child);
|
||||
g_object_unref (parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_object_unref (parent);
|
||||
}
|
||||
idx = get_index_in (accessible, child);
|
||||
|
||||
if (change & GTK_ACCESSIBLE_CHILD_CHANGE_ADDED)
|
||||
emit_children_changed (self,
|
||||
@@ -1209,8 +1133,6 @@ gtk_at_spi_context_child_change (GtkATContext *ctx,
|
||||
GTK_AT_SPI_CONTEXT (child_context),
|
||||
idx,
|
||||
GTK_ACCESSIBLE_CHILD_STATE_REMOVED);
|
||||
|
||||
g_object_unref (child_context);
|
||||
}
|
||||
/* }}} */
|
||||
/* {{{ D-Bus Registration */
|
||||
@@ -1779,16 +1701,15 @@ gtk_at_spi_context_get_child_count (GtkAtSpiContext *self)
|
||||
int n_children = 0;
|
||||
|
||||
GtkAccessible *child = NULL;
|
||||
|
||||
for (child = gtk_accessible_get_first_accessible_child (accessible);
|
||||
child != NULL;
|
||||
child = gtk_accessible_get_next_accessible_sibling (child))
|
||||
{
|
||||
g_object_unref (child);
|
||||
|
||||
if (!gtk_accessible_should_present (child))
|
||||
continue;
|
||||
|
||||
n_children += 1;
|
||||
n_children++;
|
||||
}
|
||||
|
||||
return n_children;
|
||||
|
||||
@@ -225,10 +225,6 @@ typedef enum {
|
||||
ATSPI_RELATION_PARENT_WINDOW_OF,
|
||||
ATSPI_RELATION_DESCRIPTION_FOR,
|
||||
ATSPI_RELATION_DESCRIBED_BY,
|
||||
ATSPI_RELATION_DETAILS,
|
||||
ATSPI_RELATION_DETAILS_FOR,
|
||||
ATSPI_RELATION_ERROR_MESSAGE,
|
||||
ATSPI_RELATION_ERROR_FOR,
|
||||
ATSPI_RELATION_LAST_DEFINED,
|
||||
} AtspiRelationType;
|
||||
|
||||
|
||||
@@ -314,8 +314,6 @@ handle_accessible_method (GDBusConnection *connection,
|
||||
const char *path = gtk_at_spi_context_get_context_path (GTK_AT_SPI_CONTEXT (context));
|
||||
|
||||
g_dbus_method_invocation_return_value (invocation, g_variant_new ("((so))", name, path));
|
||||
|
||||
g_object_unref (context);
|
||||
}
|
||||
else if (g_strcmp0 (method_name, "GetChildren") == 0)
|
||||
{
|
||||
@@ -336,8 +334,6 @@ handle_accessible_method (GDBusConnection *connection,
|
||||
const char *path = gtk_at_spi_context_get_context_path (GTK_AT_SPI_CONTEXT (context));
|
||||
|
||||
g_variant_builder_add (&builder, "(so)", name, path);
|
||||
|
||||
g_object_unref (context);
|
||||
}
|
||||
|
||||
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(a(so))", &builder));
|
||||
@@ -457,8 +453,6 @@ gtk_at_spi_root_child_changed (GtkAtSpiRoot *self,
|
||||
GtkATContext *context = gtk_accessible_get_at_context (child);
|
||||
|
||||
window_ref = gtk_at_spi_context_to_ref (GTK_AT_SPI_CONTEXT (context));
|
||||
|
||||
g_object_unref (context);
|
||||
}
|
||||
|
||||
switch (change)
|
||||
|
||||
@@ -94,9 +94,7 @@ listbox_handle_method (GDBusConnection *connection,
|
||||
else
|
||||
{
|
||||
GtkATContext *ctx = gtk_accessible_get_at_context (GTK_ACCESSIBLE (counter.child));
|
||||
g_dbus_method_invocation_return_value (invocation,
|
||||
g_variant_new ("(@(so))", gtk_at_spi_context_to_ref (GTK_AT_SPI_CONTEXT (ctx))));
|
||||
g_object_unref (ctx);
|
||||
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(@(so))", gtk_at_spi_context_to_ref (GTK_AT_SPI_CONTEXT (ctx))));
|
||||
}
|
||||
}
|
||||
else if (g_strcmp0 (method_name, "SelectChild") == 0)
|
||||
@@ -273,8 +271,7 @@ listview_handle_method (GDBusConnection *connection,
|
||||
{
|
||||
GtkATContext *ctx = gtk_accessible_get_at_context (GTK_ACCESSIBLE (child));
|
||||
g_dbus_method_invocation_return_value (invocation,
|
||||
g_variant_new ("(@(so))", gtk_at_spi_context_to_ref (GTK_AT_SPI_CONTEXT (ctx))));
|
||||
g_object_unref (ctx);
|
||||
g_variant_new ("(@(so))", gtk_at_spi_context_to_ref (GTK_AT_SPI_CONTEXT (ctx))));
|
||||
}
|
||||
}
|
||||
else if (g_strcmp0 (method_name, "SelectChild") == 0)
|
||||
@@ -498,9 +495,7 @@ flowbox_handle_method (GDBusConnection *connection,
|
||||
else
|
||||
{
|
||||
GtkATContext *ctx = gtk_accessible_get_at_context (GTK_ACCESSIBLE (counter.child));
|
||||
g_dbus_method_invocation_return_value (invocation,
|
||||
g_variant_new ("(@(so))", gtk_at_spi_context_to_ref (GTK_AT_SPI_CONTEXT (ctx))));
|
||||
g_object_unref (ctx);
|
||||
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(@(so))", gtk_at_spi_context_to_ref (GTK_AT_SPI_CONTEXT (ctx))));
|
||||
}
|
||||
}
|
||||
else if (g_strcmp0 (method_name, "SelectChild") == 0)
|
||||
@@ -766,8 +761,7 @@ stackswitcher_handle_method (GDBusConnection *connection,
|
||||
{
|
||||
GtkATContext *ctx = gtk_accessible_get_at_context (GTK_ACCESSIBLE (child));
|
||||
g_dbus_method_invocation_return_value (invocation,
|
||||
g_variant_new ("(@(so))", gtk_at_spi_context_to_ref (GTK_AT_SPI_CONTEXT (ctx))));
|
||||
g_object_unref (ctx);
|
||||
g_variant_new ("(@(so))", gtk_at_spi_context_to_ref (GTK_AT_SPI_CONTEXT (ctx))));
|
||||
}
|
||||
}
|
||||
else if (g_strcmp0 (method_name, "SelectChild") == 0)
|
||||
@@ -897,8 +891,7 @@ notebook_handle_method (GDBusConnection *connection,
|
||||
{
|
||||
GtkATContext *ctx = gtk_accessible_get_at_context (GTK_ACCESSIBLE (child));
|
||||
g_dbus_method_invocation_return_value (invocation,
|
||||
g_variant_new ("(@(so))", gtk_at_spi_context_to_ref (GTK_AT_SPI_CONTEXT (ctx))));
|
||||
g_object_unref (ctx);
|
||||
g_variant_new ("(@(so))", gtk_at_spi_context_to_ref (GTK_AT_SPI_CONTEXT (ctx))));
|
||||
}
|
||||
}
|
||||
else if (g_strcmp0 (method_name, "SelectChild") == 0)
|
||||
|
||||
@@ -109,7 +109,7 @@ gtk_accessible_role_to_atspi_role (GtkAccessibleRole role)
|
||||
return ATSPI_ROLE_LABEL;
|
||||
|
||||
case GTK_ACCESSIBLE_ROLE_LANDMARK:
|
||||
return ATSPI_ROLE_LANDMARK;
|
||||
break;
|
||||
|
||||
case GTK_ACCESSIBLE_ROLE_LEGEND:
|
||||
return ATSPI_ROLE_LABEL;
|
||||
@@ -169,7 +169,7 @@ gtk_accessible_role_to_atspi_role (GtkAccessibleRole role)
|
||||
return ATSPI_ROLE_OPTION_PANE;
|
||||
|
||||
case GTK_ACCESSIBLE_ROLE_PRESENTATION:
|
||||
return ATSPI_ROLE_FILLER;
|
||||
return ATSPI_ROLE_SECTION;
|
||||
|
||||
case GTK_ACCESSIBLE_ROLE_PROGRESS_BAR:
|
||||
return ATSPI_ROLE_PROGRESS_BAR;
|
||||
@@ -205,7 +205,7 @@ gtk_accessible_role_to_atspi_role (GtkAccessibleRole role)
|
||||
return ATSPI_ROLE_ENTRY;
|
||||
|
||||
case GTK_ACCESSIBLE_ROLE_SECTION:
|
||||
return ATSPI_ROLE_SECTION;
|
||||
return ATSPI_ROLE_FILLER;
|
||||
|
||||
case GTK_ACCESSIBLE_ROLE_SECTION_HEAD:
|
||||
return ATSPI_ROLE_FILLER;
|
||||
@@ -273,8 +273,6 @@ gtk_accessible_role_to_atspi_role (GtkAccessibleRole role)
|
||||
case GTK_ACCESSIBLE_ROLE_WINDOW:
|
||||
return ATSPI_ROLE_FRAME;
|
||||
|
||||
case GTK_ACCESSIBLE_ROLE_TOGGLE_BUTTON:
|
||||
return ATSPI_ROLE_TOGGLE_BUTTON;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -60,16 +60,12 @@
|
||||
*
|
||||
* `GtkAssistant` has a single CSS node with the name window and style
|
||||
* class .assistant.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
|
||||
/**
|
||||
* GtkAssistantPage:
|
||||
*
|
||||
* `GtkAssistantPage` is an auxiliary object used by `GtkAssistant.
|
||||
*
|
||||
* Deprecated: 4.10: This object will be removed in GTK 5
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
@@ -279,8 +275,6 @@ gtk_assistant_page_class_init (GtkAssistantPageClass *class)
|
||||
* GtkAssistantPage:page-type:
|
||||
*
|
||||
* The type of the assistant page.
|
||||
*
|
||||
* Deprecated: 4.10: This object will be removed in GTK 5
|
||||
*/
|
||||
g_object_class_install_property (object_class,
|
||||
CHILD_PROP_PAGE_TYPE,
|
||||
@@ -293,8 +287,6 @@ gtk_assistant_page_class_init (GtkAssistantPageClass *class)
|
||||
* GtkAssistantPage:title:
|
||||
*
|
||||
* The title of the page.
|
||||
*
|
||||
* Deprecated: 4.10: This object will be removed in GTK 5
|
||||
*/
|
||||
g_object_class_install_property (object_class,
|
||||
CHILD_PROP_PAGE_TITLE,
|
||||
@@ -309,8 +301,6 @@ gtk_assistant_page_class_init (GtkAssistantPageClass *class)
|
||||
*
|
||||
* GTK uses this information to control the sensitivity
|
||||
* of the navigation buttons.
|
||||
*
|
||||
* Deprecated: 4.10: This object will be removed in GTK 5
|
||||
*/
|
||||
g_object_class_install_property (object_class,
|
||||
CHILD_PROP_PAGE_COMPLETE,
|
||||
@@ -322,8 +312,6 @@ gtk_assistant_page_class_init (GtkAssistantPageClass *class)
|
||||
* GtkAssistantPage:child:
|
||||
*
|
||||
* The child widget.
|
||||
*
|
||||
* Deprecated: 4.10: This object will be removed in GTK 5
|
||||
*/
|
||||
g_object_class_install_property (object_class,
|
||||
CHILD_PROP_CHILD,
|
||||
@@ -530,8 +518,6 @@ gtk_assistant_class_init (GtkAssistantClass *class)
|
||||
* @assistant: the `GtkAssistant`
|
||||
*
|
||||
* Emitted when then the cancel button is clicked.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
signals[CANCEL] =
|
||||
g_signal_new (I_("cancel"),
|
||||
@@ -552,8 +538,6 @@ gtk_assistant_class_init (GtkAssistantClass *class)
|
||||
*
|
||||
* A handler for this signal can do any preparations which are
|
||||
* necessary before showing @page.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
signals[PREPARE] =
|
||||
g_signal_new (I_("prepare"),
|
||||
@@ -579,8 +563,6 @@ gtk_assistant_class_init (GtkAssistantClass *class)
|
||||
* %GTK_ASSISTANT_PAGE_PROGRESS after the confirmation page and handle
|
||||
* this operation within the [signal@Gtk.Assistant::prepare] signal of
|
||||
* the progress page.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
signals[APPLY] =
|
||||
g_signal_new (I_("apply"),
|
||||
@@ -598,8 +580,6 @@ gtk_assistant_class_init (GtkAssistantClass *class)
|
||||
* Emitted either when the close button of a summary page is clicked,
|
||||
* or when the apply button in the last page in the flow (of type
|
||||
* %GTK_ASSISTANT_PAGE_CONFIRM) is clicked.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
signals[CLOSE] =
|
||||
g_signal_new (I_("close"),
|
||||
@@ -615,8 +595,6 @@ gtk_assistant_class_init (GtkAssistantClass *class)
|
||||
* @assistant: the `GtkAssistant`
|
||||
*
|
||||
* The action signal for the Escape binding.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
signals[ESCAPE] =
|
||||
g_signal_new_class_handler (I_("escape"),
|
||||
@@ -640,8 +618,6 @@ gtk_assistant_class_init (GtkAssistantClass *class)
|
||||
*
|
||||
* For technical reasons, this property is declared as an integer
|
||||
* property, but you should only set it to %TRUE or %FALSE.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_USE_HEADER_BAR,
|
||||
@@ -1459,8 +1435,6 @@ gtk_assistant_close_request (GtkWindow *window)
|
||||
* Creates a new `GtkAssistant`.
|
||||
*
|
||||
* Returns: a newly created `GtkAssistant`
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
GtkWidget*
|
||||
gtk_assistant_new (void)
|
||||
@@ -1481,8 +1455,6 @@ gtk_assistant_new (void)
|
||||
* Returns: The index (starting from 0) of the current
|
||||
* page in the @assistant, or -1 if the @assistant has no pages,
|
||||
* or no current page
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
int
|
||||
gtk_assistant_get_current_page (GtkAssistant *assistant)
|
||||
@@ -1508,8 +1480,6 @@ gtk_assistant_get_current_page (GtkAssistant *assistant)
|
||||
* Note that this will only be necessary in custom buttons,
|
||||
* as the @assistant flow can be set with
|
||||
* gtk_assistant_set_forward_page_func().
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
void
|
||||
gtk_assistant_set_current_page (GtkAssistant *assistant,
|
||||
@@ -1555,8 +1525,6 @@ gtk_assistant_set_current_page (GtkAssistant *assistant,
|
||||
*
|
||||
* This function is for use when creating pages of the
|
||||
* %GTK_ASSISTANT_PAGE_CUSTOM type.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
void
|
||||
gtk_assistant_next_page (GtkAssistant *assistant)
|
||||
@@ -1580,8 +1548,6 @@ gtk_assistant_next_page (GtkAssistant *assistant)
|
||||
*
|
||||
* This function is for use when creating pages of the
|
||||
* %GTK_ASSISTANT_PAGE_CUSTOM type.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
void
|
||||
gtk_assistant_previous_page (GtkAssistant *assistant)
|
||||
@@ -1615,8 +1581,6 @@ gtk_assistant_previous_page (GtkAssistant *assistant)
|
||||
* Returns the number of pages in the @assistant
|
||||
*
|
||||
* Returns: the number of pages in the @assistant
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
int
|
||||
gtk_assistant_get_n_pages (GtkAssistant *assistant)
|
||||
@@ -1636,8 +1600,6 @@ gtk_assistant_get_n_pages (GtkAssistant *assistant)
|
||||
*
|
||||
* Returns: (nullable) (transfer none): the child widget, or %NULL
|
||||
* if @page_num is out of bounds
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
GtkWidget*
|
||||
gtk_assistant_get_nth_page (GtkAssistant *assistant,
|
||||
@@ -1670,8 +1632,6 @@ gtk_assistant_get_nth_page (GtkAssistant *assistant,
|
||||
* Prepends a page to the @assistant.
|
||||
*
|
||||
* Returns: the index (starting at 0) of the inserted page
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
int
|
||||
gtk_assistant_prepend_page (GtkAssistant *assistant,
|
||||
@@ -1691,8 +1651,6 @@ gtk_assistant_prepend_page (GtkAssistant *assistant,
|
||||
* Appends a page to the @assistant.
|
||||
*
|
||||
* Returns: the index (starting at 0) of the inserted page
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
int
|
||||
gtk_assistant_append_page (GtkAssistant *assistant,
|
||||
@@ -1714,8 +1672,6 @@ gtk_assistant_append_page (GtkAssistant *assistant,
|
||||
* Inserts a page in the @assistant at a given position.
|
||||
*
|
||||
* Returns: the index (starting from 0) of the inserted page
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
int
|
||||
gtk_assistant_insert_page (GtkAssistant *assistant,
|
||||
@@ -1814,8 +1770,6 @@ gtk_assistant_add_page (GtkAssistant *assistant,
|
||||
* or -1 to remove the last page
|
||||
*
|
||||
* Removes the @page_num’s page from @assistant.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
void
|
||||
gtk_assistant_remove_page (GtkAssistant *assistant,
|
||||
@@ -1851,8 +1805,6 @@ gtk_assistant_remove_page (GtkAssistant *assistant,
|
||||
* Setting @page_func to %NULL will make the assistant to
|
||||
* use the default forward function, which just goes to the
|
||||
* next visible page.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
void
|
||||
gtk_assistant_set_forward_page_func (GtkAssistant *assistant,
|
||||
@@ -1901,8 +1853,6 @@ add_to_action_area (GtkAssistant *assistant,
|
||||
* @child: a `GtkWidget`
|
||||
*
|
||||
* Adds a widget to the action area of a `GtkAssistant`.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
void
|
||||
gtk_assistant_add_action_widget (GtkAssistant *assistant,
|
||||
@@ -1931,8 +1881,6 @@ gtk_assistant_add_action_widget (GtkAssistant *assistant,
|
||||
* @child: a `GtkWidget`
|
||||
*
|
||||
* Removes a widget from the action area of a `GtkAssistant`.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
void
|
||||
gtk_assistant_remove_action_widget (GtkAssistant *assistant,
|
||||
@@ -1962,8 +1910,6 @@ gtk_assistant_remove_action_widget (GtkAssistant *assistant,
|
||||
*
|
||||
* The title is displayed in the header area of the assistant
|
||||
* when @page is the current page.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
void
|
||||
gtk_assistant_set_page_title (GtkAssistant *assistant,
|
||||
@@ -1993,8 +1939,6 @@ gtk_assistant_set_page_title (GtkAssistant *assistant,
|
||||
* Gets the title for @page.
|
||||
*
|
||||
* Returns: the title for @page
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
const char *
|
||||
gtk_assistant_get_page_title (GtkAssistant *assistant,
|
||||
@@ -2024,8 +1968,6 @@ gtk_assistant_get_page_title (GtkAssistant *assistant,
|
||||
* Sets the page type for @page.
|
||||
*
|
||||
* The page type determines the page behavior in the @assistant.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
void
|
||||
gtk_assistant_set_page_type (GtkAssistant *assistant,
|
||||
@@ -2055,8 +1997,6 @@ gtk_assistant_set_page_type (GtkAssistant *assistant,
|
||||
* Gets the page type of @page.
|
||||
*
|
||||
* Returns: the page type of @page
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
GtkAssistantPageType
|
||||
gtk_assistant_get_page_type (GtkAssistant *assistant,
|
||||
@@ -2087,8 +2027,6 @@ gtk_assistant_get_page_type (GtkAssistant *assistant,
|
||||
*
|
||||
* This will make @assistant update the buttons state
|
||||
* to be able to continue the task.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
void
|
||||
gtk_assistant_set_page_complete (GtkAssistant *assistant,
|
||||
@@ -2118,8 +2056,6 @@ gtk_assistant_set_page_complete (GtkAssistant *assistant,
|
||||
* Gets whether @page is complete.
|
||||
*
|
||||
* Returns: %TRUE if @page is complete.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
gboolean
|
||||
gtk_assistant_get_page_complete (GtkAssistant *assistant,
|
||||
@@ -2153,8 +2089,6 @@ gtk_assistant_get_page_complete (GtkAssistant *assistant,
|
||||
* One situation where it can be necessary to call this
|
||||
* function is when changing a value on the current page
|
||||
* affects the future page flow of the assistant.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
void
|
||||
gtk_assistant_update_buttons_state (GtkAssistant *assistant)
|
||||
@@ -2178,8 +2112,6 @@ gtk_assistant_update_buttons_state (GtkAssistant *assistant)
|
||||
* or undone. For example, showing a progress page to track
|
||||
* a long-running, unreversible operation after the user has
|
||||
* clicked apply on a confirmation page.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
void
|
||||
gtk_assistant_commit (GtkAssistant *assistant)
|
||||
@@ -2257,8 +2189,6 @@ gtk_assistant_buildable_custom_finished (GtkBuildable *buildable,
|
||||
* Returns the `GtkAssistantPage` object for @child.
|
||||
*
|
||||
* Returns: (transfer none): the `GtkAssistantPage` for @child
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
GtkAssistantPage *
|
||||
gtk_assistant_get_page (GtkAssistant *assistant,
|
||||
@@ -2275,8 +2205,6 @@ gtk_assistant_get_page (GtkAssistant *assistant,
|
||||
* Returns the child to which @page belongs.
|
||||
*
|
||||
* Returns: (transfer none): the child to which @page belongs
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
GtkWidget *
|
||||
gtk_assistant_page_get_child (GtkAssistantPage *page)
|
||||
@@ -2388,8 +2316,6 @@ gtk_assistant_pages_new (GtkAssistant *assistant)
|
||||
* Gets a list model of the assistant pages.
|
||||
*
|
||||
* Returns: (transfer full) (attributes element-type=GtkAssistantPage): A list model of the pages.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
GListModel *
|
||||
gtk_assistant_get_pages (GtkAssistant *assistant)
|
||||
|
||||
@@ -235,7 +235,7 @@
|
||||
* button events, however some customized derived areas can be implemented
|
||||
* who are interested in handling other events. Handling an event can
|
||||
* trigger the [`signal@Gtk.CellArea::focus-changed`] signal to fire; as well
|
||||
* as [`signal@Gtk.CellArea::add-editable`] in the case that an editable cell
|
||||
* as [`signal@GtkCellArea::add-editable`] in the case that an editable cell
|
||||
* was clicked and needs to start editing. You can call
|
||||
* [method@Gtk.CellArea.stop_editing] at any time to cancel any cell editing
|
||||
* that is currently in progress.
|
||||
|
||||
@@ -995,11 +995,10 @@ gtk_cell_area_box_focus_changed (GtkCellArea *area,
|
||||
GParamSpec *pspec,
|
||||
GtkCellAreaBox *box)
|
||||
{
|
||||
GtkCellAreaBoxPrivate *priv = gtk_cell_area_box_get_instance_private (box);
|
||||
GtkCellRenderer *focus_cell = gtk_cell_area_get_focus_cell (area);
|
||||
GtkCellAreaBoxPrivate *priv = gtk_cell_area_box_get_instance_private (box);
|
||||
|
||||
if (focus_cell)
|
||||
priv->last_focus_cell = focus_cell;
|
||||
if (gtk_cell_area_get_focus_cell (area))
|
||||
priv->last_focus_cell = gtk_cell_area_get_focus_cell (area);
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
|
||||
@@ -34,8 +34,6 @@
|
||||
* same context which was used to request sizes for a given `GtkTreeModel`
|
||||
* row also be used for the same row when calling other `GtkCellArea` APIs
|
||||
* such as gtk_cell_area_render() and gtk_cell_area_event().
|
||||
*
|
||||
* Deprecated: 4.10: This object will be removed in GTK 5
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
@@ -109,8 +107,6 @@ gtk_cell_area_context_class_init (GtkCellAreaContextClass *class)
|
||||
* GtkCellAreaContext:area:
|
||||
*
|
||||
* The `GtkCellArea` this context was created by
|
||||
*
|
||||
* Deprecated: 4.10: This object will be removed in GTK 5
|
||||
*/
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_CELL_AREA,
|
||||
@@ -124,8 +120,6 @@ gtk_cell_area_context_class_init (GtkCellAreaContextClass *class)
|
||||
* The minimum width for the `GtkCellArea` in this context
|
||||
* for all `GtkTreeModel` rows that this context was requested
|
||||
* for using gtk_cell_area_get_preferred_width().
|
||||
*
|
||||
* Deprecated: 4.10: This object will be removed in GTK 5
|
||||
*/
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_MIN_WIDTH,
|
||||
@@ -139,8 +133,6 @@ gtk_cell_area_context_class_init (GtkCellAreaContextClass *class)
|
||||
* The natural width for the `GtkCellArea` in this context
|
||||
* for all `GtkTreeModel` rows that this context was requested
|
||||
* for using gtk_cell_area_get_preferred_width().
|
||||
*
|
||||
* Deprecated: 4.10: This object will be removed in GTK 5
|
||||
*/
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_NAT_WIDTH,
|
||||
@@ -154,8 +146,6 @@ gtk_cell_area_context_class_init (GtkCellAreaContextClass *class)
|
||||
* The minimum height for the `GtkCellArea` in this context
|
||||
* for all `GtkTreeModel` rows that this context was requested
|
||||
* for using gtk_cell_area_get_preferred_height().
|
||||
*
|
||||
* Deprecated: 4.10: This object will be removed in GTK 5
|
||||
*/
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_MIN_HEIGHT,
|
||||
@@ -169,8 +159,6 @@ gtk_cell_area_context_class_init (GtkCellAreaContextClass *class)
|
||||
* The natural height for the `GtkCellArea` in this context
|
||||
* for all `GtkTreeModel` rows that this context was requested
|
||||
* for using gtk_cell_area_get_preferred_height().
|
||||
*
|
||||
* Deprecated: 4.10: This object will be removed in GTK 5
|
||||
*/
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_NAT_HEIGHT,
|
||||
@@ -321,7 +309,7 @@ gtk_cell_area_context_real_allocate (GtkCellAreaContext *context,
|
||||
*
|
||||
* Returns: (transfer none): the `GtkCellArea` this context was created by.
|
||||
*
|
||||
* Deprecated: 4.10: This object will be removed in GTK 5
|
||||
* Deprecated: 4.10
|
||||
*/
|
||||
GtkCellArea *
|
||||
gtk_cell_area_context_get_area (GtkCellAreaContext *context)
|
||||
@@ -360,7 +348,7 @@ gtk_cell_area_context_get_area (GtkCellAreaContext *context)
|
||||
* of all the displayed row heights using
|
||||
* gtk_cell_area_get_preferred_height_for_width().
|
||||
*
|
||||
* Deprecated: 4.10: This object will be removed in GTK 5
|
||||
* Deprecated: 4.10
|
||||
*/
|
||||
void
|
||||
gtk_cell_area_context_reset (GtkCellAreaContext *context)
|
||||
@@ -389,7 +377,7 @@ gtk_cell_area_context_reset (GtkCellAreaContext *context)
|
||||
* rows. This is generally the case for `GtkTreeView` when
|
||||
* `GtkTreeView:fixed-height-mode` is enabled.
|
||||
*
|
||||
* Deprecated: 4.10: This object will be removed in GTK 5
|
||||
* Deprecated: 4.10
|
||||
*/
|
||||
void
|
||||
gtk_cell_area_context_allocate (GtkCellAreaContext *context,
|
||||
@@ -413,7 +401,7 @@ gtk_cell_area_context_allocate (GtkCellAreaContext *context,
|
||||
* After gtk_cell_area_context_reset() is called and/or before ever
|
||||
* requesting the size of a `GtkCellArea`, the returned values are 0.
|
||||
*
|
||||
* Deprecated: 4.10: This object will be removed in GTK 5
|
||||
* Deprecated: 4.10
|
||||
*/
|
||||
void
|
||||
gtk_cell_area_context_get_preferred_width (GtkCellAreaContext *context,
|
||||
@@ -443,7 +431,7 @@ gtk_cell_area_context_get_preferred_width (GtkCellAreaContext *context,
|
||||
* After gtk_cell_area_context_reset() is called and/or before ever
|
||||
* requesting the size of a `GtkCellArea`, the returned values are 0.
|
||||
*
|
||||
* Deprecated: 4.10: This object will be removed in GTK 5
|
||||
* Deprecated: 4.10
|
||||
*/
|
||||
void
|
||||
gtk_cell_area_context_get_preferred_height (GtkCellAreaContext *context,
|
||||
@@ -474,7 +462,7 @@ gtk_cell_area_context_get_preferred_height (GtkCellAreaContext *context,
|
||||
* After gtk_cell_area_context_reset() is called and/or before ever
|
||||
* requesting the size of a `GtkCellArea`, the returned values are -1.
|
||||
*
|
||||
* Deprecated: 4.10: This object will be removed in GTK 5
|
||||
* Deprecated: 4.10
|
||||
*/
|
||||
void
|
||||
gtk_cell_area_context_get_preferred_height_for_width (GtkCellAreaContext *context,
|
||||
@@ -504,7 +492,7 @@ gtk_cell_area_context_get_preferred_height_for_width (GtkCellAreaContext *contex
|
||||
* After gtk_cell_area_context_reset() is called and/or before ever
|
||||
* requesting the size of a `GtkCellArea`, the returned values are -1.
|
||||
*
|
||||
* Deprecated: 4.10: This object will be removed in GTK 5
|
||||
* Deprecated: 4.10
|
||||
*/
|
||||
void
|
||||
gtk_cell_area_context_get_preferred_width_for_height (GtkCellAreaContext *context,
|
||||
@@ -533,7 +521,7 @@ gtk_cell_area_context_get_preferred_width_for_height (GtkCellAreaContext *contex
|
||||
* context was recently reset with gtk_cell_area_context_reset(),
|
||||
* the returned value will be -1.
|
||||
*
|
||||
* Deprecated: 4.10: This object will be removed in GTK 5
|
||||
* Deprecated: 4.10
|
||||
*/
|
||||
void
|
||||
gtk_cell_area_context_get_allocation (GtkCellAreaContext *context,
|
||||
@@ -565,7 +553,7 @@ gtk_cell_area_context_get_allocation (GtkCellAreaContext *context,
|
||||
* progressively push the requested width over a series of
|
||||
* gtk_cell_area_get_preferred_width() requests.
|
||||
*
|
||||
* Deprecated: 4.10: This object will be removed in GTK 5
|
||||
* Deprecated: 4.10
|
||||
*/
|
||||
void
|
||||
gtk_cell_area_context_push_preferred_width (GtkCellAreaContext *context,
|
||||
@@ -609,7 +597,7 @@ gtk_cell_area_context_push_preferred_width (GtkCellAreaContext *context,
|
||||
* progressively push the requested height over a series of
|
||||
* gtk_cell_area_get_preferred_height() requests.
|
||||
*
|
||||
* Deprecated: 4.10: This object will be removed in GTK 5
|
||||
* Deprecated: 4.10
|
||||
*/
|
||||
void
|
||||
gtk_cell_area_context_push_preferred_height (GtkCellAreaContext *context,
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "gtkcellrendererpixbuf.h"
|
||||
|
||||
#include "gtkiconhelperprivate.h"
|
||||
#include "gtkicontheme.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtksnapshot.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
|
||||
@@ -366,6 +366,7 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
|
||||
{
|
||||
GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
|
||||
GtkComboBoxPrivate *priv = gtk_combo_box_get_instance_private (combo_box);
|
||||
int menu_width;
|
||||
|
||||
gtk_widget_size_allocate (priv->box,
|
||||
&(GtkAllocation) {
|
||||
@@ -373,8 +374,17 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
|
||||
width, height
|
||||
}, baseline);
|
||||
|
||||
gtk_widget_set_size_request (priv->popup_widget, width, -1);
|
||||
gtk_widget_queue_resize (priv->popup_widget);
|
||||
gtk_widget_set_size_request (priv->popup_widget, -1, -1);
|
||||
|
||||
if (priv->popup_fixed_width)
|
||||
gtk_widget_measure (priv->popup_widget, GTK_ORIENTATION_HORIZONTAL, -1,
|
||||
&menu_width, NULL, NULL, NULL);
|
||||
else
|
||||
gtk_widget_measure (priv->popup_widget, GTK_ORIENTATION_HORIZONTAL, -1,
|
||||
NULL, &menu_width, NULL, NULL);
|
||||
|
||||
gtk_widget_set_size_request (priv->popup_widget,
|
||||
MAX (width, menu_width), -1);
|
||||
|
||||
gtk_popover_present (GTK_POPOVER (priv->popup_widget));
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
* [class@Gtk.FontChooserWidget], [class@Gtk.FontChooserDialog] and
|
||||
* [class@Gtk.FontButton].
|
||||
*
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@Gtk.FontDialogButton]
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
|
||||
* instead
|
||||
*/
|
||||
|
||||
@@ -60,7 +60,7 @@ gtk_font_chooser_default_init (GtkFontChooserInterface *iface)
|
||||
*
|
||||
* The font description as a string, e.g. "Sans Italic 12".
|
||||
*
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@Gtk.FontDialogButton] instead
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton] instead
|
||||
*/
|
||||
g_object_interface_install_property
|
||||
(iface,
|
||||
@@ -73,7 +73,7 @@ gtk_font_chooser_default_init (GtkFontChooserInterface *iface)
|
||||
*
|
||||
* The font description as a `PangoFontDescription`.
|
||||
*
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@Gtk.FontDialogButton] instead
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton] instead
|
||||
*/
|
||||
g_object_interface_install_property
|
||||
(iface,
|
||||
@@ -86,7 +86,7 @@ gtk_font_chooser_default_init (GtkFontChooserInterface *iface)
|
||||
*
|
||||
* The string with which to preview the font.
|
||||
*
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@Gtk.FontDialogButton] instead
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton] instead
|
||||
*/
|
||||
g_object_interface_install_property
|
||||
(iface,
|
||||
@@ -99,7 +99,7 @@ gtk_font_chooser_default_init (GtkFontChooserInterface *iface)
|
||||
*
|
||||
* Whether to show an entry to change the preview text.
|
||||
*
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@Gtk.FontDialogButton] instead
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton] instead
|
||||
*/
|
||||
g_object_interface_install_property
|
||||
(iface,
|
||||
@@ -112,7 +112,7 @@ gtk_font_chooser_default_init (GtkFontChooserInterface *iface)
|
||||
*
|
||||
* The level of granularity to offer for selecting fonts.
|
||||
*
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@Gtk.FontDialogButton] instead
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton] instead
|
||||
*/
|
||||
g_object_interface_install_property
|
||||
(iface,
|
||||
@@ -131,7 +131,7 @@ gtk_font_chooser_default_init (GtkFontChooserInterface *iface)
|
||||
* The format of the string is compatible with
|
||||
* CSS and with Pango attributes.
|
||||
*
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@Gtk.FontDialogButton] instead
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton] instead
|
||||
*/
|
||||
g_object_interface_install_property
|
||||
(iface,
|
||||
@@ -144,7 +144,7 @@ gtk_font_chooser_default_init (GtkFontChooserInterface *iface)
|
||||
*
|
||||
* The language for which the font features were selected.
|
||||
*
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@Gtk.FontDialogButton] instead
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton] instead
|
||||
*/
|
||||
g_object_interface_install_property
|
||||
(iface,
|
||||
@@ -163,7 +163,7 @@ gtk_font_chooser_default_init (GtkFontChooserInterface *iface)
|
||||
* or an item is selected and the user presses one of the keys
|
||||
* Space, Shift+Space, Return or Enter.
|
||||
*
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@Gtk.FontDialogButton] instead
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton] instead
|
||||
*/
|
||||
chooser_signals[SIGNAL_FONT_ACTIVATED] =
|
||||
g_signal_new (I_("font-activated"),
|
||||
@@ -189,7 +189,7 @@ gtk_font_chooser_default_init (GtkFontChooserInterface *iface)
|
||||
* Returns: (nullable) (transfer none): A `PangoFontFamily` representing the
|
||||
* selected font family
|
||||
*
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@Gtk.FontDialogButton]
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
|
||||
* instead
|
||||
*/
|
||||
PangoFontFamily *
|
||||
@@ -212,7 +212,7 @@ gtk_font_chooser_get_font_family (GtkFontChooser *fontchooser)
|
||||
* Returns: (nullable) (transfer none): A `PangoFontFace` representing the
|
||||
* selected font group details
|
||||
*
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@Gtk.FontDialogButton]
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
|
||||
* instead
|
||||
*/
|
||||
PangoFontFace *
|
||||
@@ -232,7 +232,7 @@ gtk_font_chooser_get_font_face (GtkFontChooser *fontchooser)
|
||||
* Returns: A n integer representing the selected font size,
|
||||
* or -1 if no font size is selected.
|
||||
*
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@Gtk.FontDialogButton]
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
|
||||
* instead
|
||||
*/
|
||||
int
|
||||
@@ -261,7 +261,7 @@ gtk_font_chooser_get_font_size (GtkFontChooser *fontchooser)
|
||||
* Returns: (nullable) (transfer full): A string with the name
|
||||
* of the current font
|
||||
*
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@Gtk.FontDialogButton]
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
|
||||
* instead
|
||||
*/
|
||||
char *
|
||||
@@ -284,7 +284,7 @@ gtk_font_chooser_get_font (GtkFontChooser *fontchooser)
|
||||
*
|
||||
* Sets the currently-selected font.
|
||||
*
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@Gtk.FontDialogButton]
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
|
||||
* instead
|
||||
*/
|
||||
void
|
||||
@@ -315,7 +315,7 @@ gtk_font_chooser_set_font (GtkFontChooser *fontchooser,
|
||||
* Returns: (nullable) (transfer full): A `PangoFontDescription` for the
|
||||
* current font
|
||||
*
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@Gtk.FontDialogButton]
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
|
||||
* instead
|
||||
*/
|
||||
PangoFontDescription *
|
||||
@@ -337,7 +337,7 @@ gtk_font_chooser_get_font_desc (GtkFontChooser *fontchooser)
|
||||
*
|
||||
* Sets the currently-selected font from @font_desc.
|
||||
*
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@Gtk.FontDialogButton]
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
|
||||
* instead
|
||||
*/
|
||||
void
|
||||
@@ -358,7 +358,7 @@ gtk_font_chooser_set_font_desc (GtkFontChooser *fontchooser,
|
||||
*
|
||||
* Returns: (transfer full): the text displayed in the preview area
|
||||
*
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@Gtk.FontDialogButton]
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
|
||||
* instead
|
||||
*/
|
||||
char *
|
||||
@@ -382,7 +382,7 @@ gtk_font_chooser_get_preview_text (GtkFontChooser *fontchooser)
|
||||
*
|
||||
* The @text is used to show how the selected font looks.
|
||||
*
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@Gtk.FontDialogButton]
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
|
||||
* instead
|
||||
*/
|
||||
void
|
||||
@@ -403,7 +403,7 @@ gtk_font_chooser_set_preview_text (GtkFontChooser *fontchooser,
|
||||
*
|
||||
* Returns: %TRUE if the preview entry is shown or %FALSE if it is hidden.
|
||||
*
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@Gtk.FontDialogButton]
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
|
||||
* instead
|
||||
*/
|
||||
gboolean
|
||||
@@ -425,7 +425,7 @@ gtk_font_chooser_get_show_preview_entry (GtkFontChooser *fontchooser)
|
||||
*
|
||||
* Shows or hides the editable preview entry.
|
||||
*
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@Gtk.FontDialogButton]
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
|
||||
* instead
|
||||
*/
|
||||
void
|
||||
@@ -448,7 +448,7 @@ gtk_font_chooser_set_show_preview_entry (GtkFontChooser *fontchooser,
|
||||
* Adds a filter function that decides which fonts to display
|
||||
* in the font chooser.
|
||||
*
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@Gtk.FontDialogButton]
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
|
||||
* instead
|
||||
*/
|
||||
void
|
||||
@@ -505,7 +505,7 @@ _gtk_font_chooser_font_activated (GtkFontChooser *chooser,
|
||||
* pango_context_set_font_map (context, fontmap);
|
||||
* ```
|
||||
*
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@Gtk.FontDialogButton]
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
|
||||
* instead
|
||||
*/
|
||||
void
|
||||
@@ -528,7 +528,7 @@ gtk_font_chooser_set_font_map (GtkFontChooser *fontchooser,
|
||||
*
|
||||
* Returns: (nullable) (transfer full): a `PangoFontMap`
|
||||
*
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@Gtk.FontDialogButton]
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
|
||||
* instead
|
||||
*/
|
||||
PangoFontMap *
|
||||
@@ -551,7 +551,7 @@ gtk_font_chooser_get_font_map (GtkFontChooser *fontchooser)
|
||||
*
|
||||
* Sets the desired level of granularity for selecting fonts.
|
||||
*
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@Gtk.FontDialogButton]
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
|
||||
* instead
|
||||
*/
|
||||
void
|
||||
@@ -571,7 +571,7 @@ gtk_font_chooser_set_level (GtkFontChooser *fontchooser,
|
||||
*
|
||||
* Returns: the current granularity level
|
||||
*
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@Gtk.FontDialogButton]
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
|
||||
* instead
|
||||
*/
|
||||
GtkFontChooserLevel
|
||||
@@ -598,7 +598,7 @@ gtk_font_chooser_get_level (GtkFontChooser *fontchooser)
|
||||
*
|
||||
* Returns: the currently selected font features
|
||||
*
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@Gtk.FontDialogButton]
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
|
||||
* instead
|
||||
*/
|
||||
char *
|
||||
@@ -621,7 +621,7 @@ gtk_font_chooser_get_font_features (GtkFontChooser *fontchooser)
|
||||
*
|
||||
* Returns: the currently selected language
|
||||
*
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@Gtk.FontDialogButton]
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
|
||||
* instead
|
||||
*/
|
||||
char *
|
||||
@@ -643,7 +643,7 @@ gtk_font_chooser_get_language (GtkFontChooser *fontchooser)
|
||||
*
|
||||
* Sets the language to use for font features.
|
||||
*
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@Gtk.FontDialogButton]
|
||||
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
|
||||
* instead
|
||||
*/
|
||||
void
|
||||
|
||||
@@ -126,7 +126,7 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
* style class applied.
|
||||
*
|
||||
* Deprecated: 4.10: There is no replacement in GTK for an "info bar" widget;
|
||||
* you can use [class@Gtk.Revealer] with a [class@Gtk.Box] containing a
|
||||
* you can use [class@Gtk.Revealer] with a [class@GtkBox] containing a
|
||||
* [class@Gtk.Label] and an optional [class@Gtk.Button], according to
|
||||
* your application's design.
|
||||
*/
|
||||
|
||||
@@ -70,8 +70,6 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
* [property@Gtk.LockButton:tooltip-lock],
|
||||
* [property@Gtk.LockButton:tooltip-unlock] and
|
||||
* [property@Gtk.LockButton:tooltip-not-authorized] properties.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
|
||||
struct _GtkLockButton
|
||||
@@ -273,8 +271,6 @@ gtk_lock_button_class_init (GtkLockButtonClass *klass)
|
||||
* GtkLockButton:permission: (attributes org.gtk.Property.get=gtk_lock_button_get_permission org.gtk.Property.set=gtk_lock_button_set_permission)
|
||||
*
|
||||
* The `GPermission object controlling this button.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
g_object_class_install_property (gobject_class, PROP_PERMISSION,
|
||||
g_param_spec_object ("permission", NULL, NULL,
|
||||
@@ -286,8 +282,6 @@ gtk_lock_button_class_init (GtkLockButtonClass *klass)
|
||||
* GtkLockButton:text-lock:
|
||||
*
|
||||
* The text to display when prompting the user to lock.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
g_object_class_install_property (gobject_class, PROP_TEXT_LOCK,
|
||||
g_param_spec_string ("text-lock", NULL, NULL,
|
||||
@@ -300,8 +294,6 @@ gtk_lock_button_class_init (GtkLockButtonClass *klass)
|
||||
* GtkLockButton:text-unlock:
|
||||
*
|
||||
* The text to display when prompting the user to unlock.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
g_object_class_install_property (gobject_class, PROP_TEXT_UNLOCK,
|
||||
g_param_spec_string ("text-unlock", NULL, NULL,
|
||||
@@ -314,8 +306,6 @@ gtk_lock_button_class_init (GtkLockButtonClass *klass)
|
||||
* GtkLockButton:tooltip-lock:
|
||||
*
|
||||
* The tooltip to display when prompting the user to lock.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
g_object_class_install_property (gobject_class, PROP_TOOLTIP_LOCK,
|
||||
g_param_spec_string ("tooltip-lock", NULL, NULL,
|
||||
@@ -328,8 +318,6 @@ gtk_lock_button_class_init (GtkLockButtonClass *klass)
|
||||
* GtkLockButton:tooltip-unlock:
|
||||
*
|
||||
* The tooltip to display when prompting the user to unlock.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
g_object_class_install_property (gobject_class, PROP_TOOLTIP_UNLOCK,
|
||||
g_param_spec_string ("tooltip-unlock", NULL, NULL,
|
||||
@@ -342,8 +330,6 @@ gtk_lock_button_class_init (GtkLockButtonClass *klass)
|
||||
* GtkLockButton:tooltip-not-authorized:
|
||||
*
|
||||
* The tooltip to display when the user cannot obtain authorization.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
g_object_class_install_property (gobject_class, PROP_TOOLTIP_NOT_AUTHORIZED,
|
||||
g_param_spec_string ("tooltip-not-authorized", NULL, NULL,
|
||||
@@ -525,8 +511,6 @@ gtk_lock_button_clicked (GtkButton *widget)
|
||||
* Creates a new lock button which reflects the @permission.
|
||||
*
|
||||
* Returns: a new `GtkLockButton`
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
GtkWidget *
|
||||
gtk_lock_button_new (GPermission *permission)
|
||||
@@ -543,8 +527,6 @@ gtk_lock_button_new (GPermission *permission)
|
||||
* Obtains the `GPermission` object that controls @button.
|
||||
*
|
||||
* Returns: (transfer none) (nullable): the `GPermission` of @button
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
GPermission *
|
||||
gtk_lock_button_get_permission (GtkLockButton *button)
|
||||
@@ -560,8 +542,6 @@ gtk_lock_button_get_permission (GtkLockButton *button)
|
||||
* @permission: (nullable): a `GPermission` object
|
||||
*
|
||||
* Sets the `GPermission` object that controls @button.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
void
|
||||
gtk_lock_button_set_permission (GtkLockButton *button,
|
||||
|
||||
@@ -77,8 +77,6 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
* ## CSS node
|
||||
*
|
||||
* `GtkStatusbar` has a single CSS node with name `statusbar`.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
|
||||
typedef struct _GtkStatusbarMsg GtkStatusbarMsg;
|
||||
@@ -169,8 +167,6 @@ gtk_statusbar_class_init (GtkStatusbarClass *class)
|
||||
* @text: the message that was pushed
|
||||
*
|
||||
* Emitted whenever a new message gets pushed onto a statusbar's stack.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
statusbar_signals[SIGNAL_TEXT_PUSHED] =
|
||||
g_signal_new (I_("text-pushed"),
|
||||
@@ -190,8 +186,6 @@ gtk_statusbar_class_init (GtkStatusbarClass *class)
|
||||
* @text: the message that was just popped
|
||||
*
|
||||
* Emitted whenever a new message is popped off a statusbar's stack.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
statusbar_signals[SIGNAL_TEXT_POPPED] =
|
||||
g_signal_new (I_("text-popped"),
|
||||
@@ -231,8 +225,6 @@ gtk_statusbar_init (GtkStatusbar *statusbar)
|
||||
* Creates a new `GtkStatusbar` ready for messages.
|
||||
*
|
||||
* Returns: the new `GtkStatusbar`
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
GtkWidget*
|
||||
gtk_statusbar_new (void)
|
||||
@@ -265,8 +257,6 @@ gtk_statusbar_update (GtkStatusbar *statusbar,
|
||||
* Note that the description is not shown in the UI.
|
||||
*
|
||||
* Returns: an integer id
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
guint
|
||||
gtk_statusbar_get_context_id (GtkStatusbar *statusbar,
|
||||
@@ -327,8 +317,6 @@ gtk_statusbar_msg_free (GtkStatusbarMsg *msg)
|
||||
*
|
||||
* Returns: a message id that can be used with
|
||||
* [method@Gtk.Statusbar.remove].
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
guint
|
||||
gtk_statusbar_push (GtkStatusbar *statusbar,
|
||||
@@ -363,8 +351,6 @@ gtk_statusbar_push (GtkStatusbar *statusbar,
|
||||
* Note that this may not change the displayed message,
|
||||
* if the message at the top of the stack has a different
|
||||
* context id.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
void
|
||||
gtk_statusbar_pop (GtkStatusbar *statusbar,
|
||||
@@ -409,8 +395,6 @@ gtk_statusbar_pop (GtkStatusbar *statusbar,
|
||||
*
|
||||
* Forces the removal of a message from a statusbar’s stack.
|
||||
* The exact @context_id and @message_id must be specified.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
void
|
||||
gtk_statusbar_remove (GtkStatusbar *statusbar,
|
||||
@@ -459,8 +443,6 @@ gtk_statusbar_remove (GtkStatusbar *statusbar,
|
||||
*
|
||||
* Forces the removal of all messages from a statusbar's
|
||||
* stack with the exact @context_id.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
void
|
||||
gtk_statusbar_remove_all (GtkStatusbar *statusbar,
|
||||
@@ -517,8 +499,6 @@ gtk_statusbar_remove_all (GtkStatusbar *statusbar,
|
||||
* Retrieves the contents of the label in `GtkStatusbar`.
|
||||
*
|
||||
* Returns: (transfer none): the contents of the statusbar
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
const char *
|
||||
gtk_statusbar_get_message (GtkStatusbar *statusbar)
|
||||
|
||||
@@ -44,8 +44,6 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
* volume control.
|
||||
*
|
||||
* 
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
|
||||
typedef struct _GtkVolumeButtonClass GtkVolumeButtonClass;
|
||||
@@ -170,8 +168,6 @@ gtk_volume_button_class_init (GtkVolumeButtonClass *klass)
|
||||
*
|
||||
* Note that if the symbolic icons are not available in your installed
|
||||
* theme, then the normal (potentially colorful) icons will be used.
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SYMBOLIC,
|
||||
@@ -204,8 +200,6 @@ gtk_volume_button_init (GtkVolumeButton *button)
|
||||
* [class@Gtk.ScaleButton].
|
||||
*
|
||||
* Returns: a new `GtkVolumeButton`
|
||||
*
|
||||
* Deprecated: 4.10: This widget will be removed in GTK 5
|
||||
*/
|
||||
GtkWidget *
|
||||
gtk_volume_button_new (void)
|
||||
|
||||
@@ -284,8 +284,7 @@ extract_plane (GdkPixbuf *src,
|
||||
int to_plane)
|
||||
{
|
||||
guchar *src_data, *dst_data;
|
||||
int width, height;
|
||||
gsize src_stride, dst_stride;
|
||||
int width, height, src_stride, dst_stride;
|
||||
guchar *src_row, *dst_row;
|
||||
int x, y;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user