Compare commits

..

1 Commits

Author SHA1 Message Date
Matthias Clasen
cd7c0f8ae9 Add a test for quick key events 2023-05-05 20:48:09 -04:00
713 changed files with 10284 additions and 34464 deletions

1
.gitignore vendored
View File

@@ -1,2 +1 @@
/subprojects/*/
.flatpak-builder/

View File

@@ -24,7 +24,7 @@ stages:
variables:
COMMON_MESON_FLAGS: "-Dwerror=true -Dcairo:werror=false -Dgi-docgen:werror=false -Dgraphene:werror=false -Dlibepoxy:werror=false -Dlibsass:werror=false -Dpango:werror=false -Dsassc:werror=false -Dgdk-pixbuf:werror=false -Dglib:werror=false -Dlibcloudproviders:werror=false -Dlibpng:werror=false -Dlibtiff:werror=false -Dsysprof:werror=false -Dwayland-protocols:werror=false -Dharfbuzz:werror=false -Dfreetype2:werror=false -Dfontconfig:werror=false -Dfribidi:werror=false -Dlibffi:werror=false -Dlibjpeg-turbo:werror=false -Dmutest:werror=false -Dpixman:werror=false -Dproxy-libintl:werror=false"
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true"
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled -Dbuild-testsuite=true -Dintrospection=enabled"
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:v46"
@@ -70,7 +70,6 @@ style-check-diff:
- "${CI_PROJECT_DIR}/_build/testsuite/tools/output/*/*"
- "${CI_PROJECT_DIR}/_build/testsuite/gsk/compare/*/*/*.png"
- "${CI_PROJECT_DIR}/_build/testsuite/css/output/*/*.syscap"
- "${CI_PROJECT_DIR}/_build/testsuite/headless/*/*.log"
- "${CI_PROJECT_DIR}/_build_hello/meson-logs"
cache:
key: "$CI_JOB_NAME"
@@ -83,27 +82,6 @@ fedora-x86_64:
needs: []
variables:
EXTRA_MESON_FLAGS: "--buildtype=debug --default-library=both"
script:
- .gitlab-ci/show-info-linux.sh
- export PATH="$HOME/.local/bin:$PATH"
- meson subprojects download
- meson subprojects update --reset
- meson setup
${COMMON_MESON_FLAGS}
${EXTRA_MESON_FLAGS}
${BACKEND_FLAGS}
${FEATURE_FLAGS}
_build
- meson compile -C _build
- .gitlab-ci/run-tests.sh _build wayland
- .gitlab-ci/run-tests.sh _build wayland_gles
release-build:
extends: .build-fedora-default
stage: build
needs: []
variables:
EXTRA_MESON_FLAGS: "--buildtype=release"
script:
- .gitlab-ci/show-info-linux.sh
- export PATH="$HOME/.local/bin:$PATH"
@@ -122,8 +100,11 @@ release-build:
- PKG_CONFIG_PATH=${CI_PROJECT_DIR}/_install/lib64/pkgconfig:${CI_PROJECT_DIR}/_install/share/pkgconfig meson setup _build_hello examples/hello
- LD_LIBRARY_PATH=${CI_PROJECT_DIR}/_install/lib64 meson compile -C _build_hello
- .gitlab-ci/run-tests.sh _build x11
- .gitlab-ci/run-tests.sh _build wayland
- .gitlab-ci/run-tests.sh _build wayland_gles
- .gitlab-ci/run-tests.sh _build broadway
fedora-clang:
release-build:
extends: .build-fedora-default
stage: build
needs: []
@@ -132,7 +113,6 @@ fedora-clang:
script:
- .gitlab-ci/show-info-linux.sh
- export PATH="$HOME/.local/bin:$PATH"
- export CC=clang
- meson subprojects download
- meson subprojects update --reset
- meson setup
@@ -142,6 +122,7 @@ fedora-clang:
${FEATURE_FLAGS}
_build
- meson compile -C _build
- .gitlab-ci/run-tests.sh _build x11
fedora-mingw64:
extends: .build-fedora-default
@@ -222,7 +203,7 @@ macos:
-Dcpp_std=c++11
-Dpixman:tests=disabled
-Dlibjpeg-turbo:simd=disabled
-Dbuild-demos=false
-Ddemos=false
-Dbuild-tests=false
-Dbuild-examples=false
-Dbuild-testsuite=false
@@ -369,8 +350,6 @@ static-scan:
- meson setup
${COMMON_MESON_FLAGS}
${EXTRA_MESON_FLAGS}
${BACKEND_FLAGS}
${FEATURE_FLAGS}
_scan_build
- ninja -C _scan_build scan-build
artifacts:
@@ -385,27 +364,17 @@ asan-build:
tags: [ asan ]
stage: analysis
needs: []
when: manual
variables:
script:
- export PATH="$HOME/.local/bin:$PATH"
- CC=clang meson setup
--buildtype=debugoptimized
-Db_sanitize=address
-Db_lundef=false
-Dbuild-demos=false
-Dbuild-tests=false
-Dbuild-examples=false
-Dintrospection=disabled
-Df16c=disabled
_build
- CC=clang meson setup --buildtype=debugoptimized -Db_sanitize=address -Db_lundef=false -Dintrospection=disabled -Df16c=disabled _build
- ninja -C _build
- .gitlab-ci/run-tests.sh _build wayland
- .gitlab-ci/run-tests.sh _build wayland_gles
- .gitlab-ci/run-tests.sh _build x11
artifacts:
when: always
paths:
- "${CI_PROJECT_DIR}/_build/meson-logs"
- _build/meson-logs
allow_failure: true
reference:
image: $FEDORA_IMAGE

View File

@@ -9,7 +9,7 @@ backend=$2
multiplier=${MESON_TEST_TIMEOUT_MULTIPLIER:-1}
# Ignore memory leaks lower in dependencies
export LSAN_OPTIONS=suppressions=$srcdir/lsan.supp:print_suppressions=0:detect_leaks=0:allocator_may_return_null=1
export LSAN_OPTIONS=suppressions=$srcdir/lsan.supp:print_suppressions=0:verbosity=1:log_threads=1
export G_SLICE=always-malloc
case "${backend}" in
@@ -69,6 +69,9 @@ case "${backend}" in
--no-suite=flaky \
--no-suite=gsk-compare-opengl
# don't let Broadway failures fail the run, for now
exit_code=0
kill ${server}
;;

121
NEWS
View File

@@ -1,88 +1,4 @@
Overview of Changes in 4.11.4, xx-xx-xxxx
=========================================
Overview of Changes in 4.11.3, 05-06-2023
=========================================
* GtkGridView:
- Respect css border-spacing
- Don't leak the factories
* GtkListView:
- Don't leak the factories
* GtkColumnView:
- Support displaying sections
* GtkNotebook:
- Make the pages model implement GtkSelectionModel
* GtkScrolledWindow:
- Propagate child measure size whenever possible
* GtkPopoverMenu:
- Avoid unnecessary left padding
* GtkSearchEntry:
- Improve size allocation for the clear icon
* GtkBoxLayout:
- Fix a regression from recent baseline work
* CSS:
- Add new binding-friendly css provider apis
* Theme:
- Show focus in the shortcuts window
* GDK:
- Support grayscale and alpha texture formats for loading
and saving to png and tiff, and in GL
- Fix some regressions in GL context initialization
* GSK:
- Support grayscale and alpha texture formats in the GL renderer
- Support straight alpha textures in the GL renderer
- Many improvements to the experimental Vulkan renderer
* Wayland:
- Make exporting surface handles more flexible
* X11:
- Trap XRandr errors
- Stop using passive grabs during DND
* Windows:
- Many cleanups and simplifications
* Tests:
- Improve test coverage
* Build:
- Some build options have been renamed:
demos -> build-demos
profile -> demo-profile
The old names still work
* Deprecations:
- gtk_css_provider_load_from_data
- gdk_wayland_toplevel_unexport_handle
- gdk_pixbuf_get_from_surface
- gdk_pixbuf_get_from_texture
- gtk_image_new_from_pixbuf
- gtk_image_set_from_pixbuf
- gtk_picture_new_for_pixbuf
- gtk_picture_set_pixbuf
* Translation updates:
Basque
Catalan
Georgian
Russian
Turkish
Overview of Changes in 4.11.2, 09-05-2023
Overview of Changes in 4.11.2, xx-xx-xxxx
=========================================
* GtkGLArea:
@@ -91,12 +7,6 @@ Overview of Changes in 4.11.2, 09-05-2023
* GtkListBox:
- Fix a problem with gtk_list_box_remove_all
* Add the GtkSectionModel interface, and implement it in most
of our list models
* GtkListView:
- Support displaying sections
* GtkCenterBox:
- Add a shrink-center-last property
@@ -113,9 +23,6 @@ Overview of Changes in 4.11.2, 09-05-2023
- A few memory leak fixes
- Handle webdav in the pathbar
* GtkBox:
- Support baselines in vertical orientation with GtkBox:baseline-child
* Dialogs:
- Destroy windows promptly when the async callback finishes
- Detect absence of the OpenURI portal and fall back
@@ -126,22 +33,12 @@ Overview of Changes in 4.11.2, 09-05-2023
* Accessibility:
- Fix alert dialogs in the a11y tree
- Improve accessibility of GtkShortcutsWindow
* Layout:
- Some fixes to baseline alignment
- Separate GTK_ALIGN_BASELINE_CENTER and _FILL
* CSS:
- Fix a crash with color transitions
* GSK:
- Fix problems with negative scales
- Improve scaling of offscreens for (cross-fades, masks, blends)
* GL:
- Add GdkGLTextureBuilder, a more flexible api for creating textures
- Support setting update regions for GL textures
- Ensure that we work with GLES 2
* Vulkan:
@@ -152,37 +49,23 @@ Overview of Changes in 4.11.2, 09-05-2023
- Don't destroy wl_surfaces on hide
- Plug leaks of compositor-side resources
* X11:
- Fix artifacts in gnome-shell frame decorations
* Windows:
- Fix GL context initialization
* Inspector:
- Improve the action list
- Improve the accessibility pane
- Fix a crash
* Tools:
- gtk4-node-editor: Improve scaling
- gtk4-node-editor: Preserve aspect ratio of textures
- gtk4-node-editor: Add some smarter editing
- gtk4-demo: Make the stylus demo work with mice
* Deprecations:
- gtk_widget_get_allocated_width/height/baseline
- GTK_ALIGN_BASELINE
* Translation updates
Bulgarian
Chinese (China)
Friulian
Galician
Hebrew
Persian
Polish
Portuguese
`Russian
Russian
Turkish

View File

@@ -187,7 +187,7 @@
"--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized",
"-Ddemo-profile=devel"
"-Dprofile=devel"
],
"sources" : [
{

View File

@@ -116,7 +116,7 @@
"--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized",
"-Ddemo-profile=devel"
"-Dprofile=devel"
],
"sources" : [
{

View File

@@ -116,7 +116,7 @@
"--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized",
"-Ddemo-profile=devel"
"-Dprofile=devel"
],
"sources" : [
{

View File

@@ -116,7 +116,7 @@
"--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized",
"-Ddemo-profile=devel"
"-Dprofile=devel"
],
"sources" : [
{

View File

@@ -1,201 +0,0 @@
#!/usr/bin/env python3
#
# SPDX-FileCopyrightText: 2022 Collabora Inc.
# 2023 Emmanuele Bassi
#
# SPDX-License-Identifier: LGPL-2.1-or-later
#
# Original author: Xavier Claessens <xclaesse@gmail.com>
import argparse
import textwrap
from pathlib import Path
# Disable line length warnings as wrapping the C code templates would be hard
# flake8: noqa: E501
def gen_versions_macros(args, current_major_version, current_minor_version, current_micro_version):
with args.out_path.open("w", encoding="utf-8") as ofile, args.in_path.open(
"r", encoding="utf-8"
) as ifile:
for line in ifile.readlines():
if "@GDK_VERSIONS@" in line:
ofile.write(
textwrap.dedent(
f"""\
/**
* GDK_MAJOR_VERSION:
*
* The major version component of the library's version, e.g. "1" for "1.2.3".
*/
#define GDK_MAJOR_VERSION ({current_major_version})
/**
* GDK_MINOR_VERSION:
*
* The minor version component of the library's version, e.g. "2" for "1.2.3".
*/
#define GDK_MINOR_VERSION ({current_minor_version})
/**
* GDK_MICRO_VERSION:
*
* The micro version component of the library's version, e.g. "3" for "1.2.3".
*/
#define GDK_MICRO_VERSION ({current_micro_version})
"""
)
)
for minor in range(0, current_minor_version + 2, 2):
ofile.write(
textwrap.dedent(
f"""\
/**
* GDK_VERSION_{current_major_version}_{minor}:
*
* A macro that evaluates to the {current_major_version}.{minor} version of GTK, in a format
* that can be used by the C pre-processor.
*
* Since: {current_major_version}.{minor}
*/
#define GDK_VERSION_{current_major_version}_{minor} (G_ENCODE_VERSION ({current_major_version}, {minor}))
"""
)
)
else:
ofile.write(line)
def gen_visibility_macros(args, current_major_version, current_minor_version, current_micro_version):
"""
Generates a set of macros for each minor stable version of GTK
- GDK_DEPRECATED
- GDK_DEPRECATED_IN_…
- GDK_DEPRECATED_MACRO_IN_…
- GDK_DEPRECATED_ENUMERATOR_IN_…
- GDK_DEPRECATED_TYPE_IN_…
- GDK_AVAILABLE_IN_ALL
- GDK_AVAILABLE_IN_…
- GDK_AVAILABLE_STATIC_INLINE_IN_…
- GDK_AVAILABLE_MACRO_IN_…
- GDK_AVAILABLE_ENUMERATOR_IN_…
- GDK_AVAILABLE_TYPE_IN_…
- GDK_UNAVAILABLE(maj,min)
- GDK_UNAVAILABLE_STATIC_INLINE(maj,min)
"""
ns = args.namespace
with args.out_path.open("w", encoding="utf-8") as f:
f.write(
textwrap.dedent(
f"""\
#pragma once
#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined({ns}_STATIC_COMPILATION)
# define _{ns}_EXPORT __declspec(dllexport)
# define _{ns}_IMPORT __declspec(dllimport)
#elif __GNUC__ >= 4
# define _{ns}_EXPORT __attribute__((visibility("default")))
# define _{ns}_IMPORT
#else
# define _{ns}_EXPORT
# define _{ns}_IMPORT
#endif
#ifdef GTK_COMPILATION
# define _{ns}_API _{ns}_EXPORT
#else
# define _{ns}_API _{ns}_IMPORT
#endif
#define _{ns}_EXTERN _{ns}_API extern
#define {ns}_VAR _{ns}_EXTERN
#define {ns}_AVAILABLE_IN_ALL _{ns}_EXTERN
#ifdef GDK_DISABLE_DEPRECATION_WARNINGS
#define {ns}_DEPRECATED _{ns}_EXTERN
#define {ns}_DEPRECATED_FOR(f) _{ns}_EXTERN
#define {ns}_UNAVAILABLE(maj,min) _{ns}_EXTERN
#define {ns}_UNAVAILABLE_STATIC_INLINE(maj,min)
#else
#define {ns}_DEPRECATED G_DEPRECATED _{ns}_EXTERN
#define {ns}_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _{ns}_EXTERN
#define {ns}_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min) _{ns}_EXTERN
#define {ns}_UNAVAILABLE_STATIC_INLINE(maj,min) G_UNAVAILABLE(maj,min)
#endif
"""
)
)
for minor in range(0, current_minor_version + 2, 2):
f.write(
textwrap.dedent(
f"""
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_4_{minor}
#define {ns}_DEPRECATED_IN_{current_major_version}_{minor} {ns}_DEPRECATED
#define {ns}_DEPRECATED_IN_{current_major_version}_{minor}_FOR(f) {ns}_DEPRECATED_FOR (f)
#define {ns}_DEPRECATED_MACRO_IN_{current_major_version}_{minor} GDK_DEPRECATED_MACRO
#define {ns}_DEPRECATED_MACRO_IN_{current_major_version}_{minor}_FOR(f) GDK_DEPRECATED_MACRO_FOR (f)
#define {ns}_DEPRECATED_ENUMERATOR_IN_{current_major_version}_{minor} GDK_DEPRECATED_ENUMERATOR
#define {ns}_DEPRECATED_ENUMERATOR_IN_{current_major_version}_{minor}_FOR(f) GDK_DEPRECATED_ENUMERATOR_FOR (f)
#define {ns}_DEPRECATED_TYPE_IN_{current_major_version}_{minor} GDK_DEPRECATED_TYPE
#define {ns}_DEPRECATED_TYPE_IN_{current_major_version}_{minor}_FOR(f) GDK_DEPRECATED_TYPE_FOR (f)
#else
#define {ns}_DEPRECATED_IN_{current_major_version}_{minor} _{ns}_EXTERN
#define {ns}_DEPRECATED_IN_{current_major_version}_{minor}_FOR(f) _{ns}_EXTERN
#define {ns}_DEPRECATED_MACRO_IN_{current_major_version}_{minor}
#define {ns}_DEPRECATED_MACRO_IN_{current_major_version}_{minor}_FOR(f)
#define {ns}_DEPRECATED_ENUMERATOR_IN_{current_major_version}_{minor}
#define {ns}_DEPRECATED_ENUMERATOR_IN_{current_major_version}_{minor}_FOR(f)
#define {ns}_DEPRECATED_TYPE_IN_{current_major_version}_{minor}
#define {ns}_DEPRECATED_TYPE_IN_{current_major_version}_{minor}_FOR(f)
#endif
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_{current_major_version}_{minor}
#define {ns}_AVAILABLE_IN_{current_major_version}_{minor} {ns}_UNAVAILABLE ({current_major_version}, {minor})
#define {ns}_AVAILABLE_STATIC_INLINE_IN_{current_major_version}_{minor} GDK_UNAVAILABLE_STATIC_INLINE ({current_major_version}, {minor})
#define {ns}_AVAILABLE_MACRO_IN_{current_major_version}_{minor} GDK_UNAVAILABLE_MACRO ({current_major_version}, {minor})
#define {ns}_AVAILABLE_ENUMERATOR_IN_{current_major_version}_{minor} GDK_UNAVAILABLE_ENUMERATOR ({current_major_version}, {minor})
#define {ns}_AVAILABLE_TYPE_IN_{current_major_version}_{minor} GDK_UNAVAILABLE_TYPE ({current_major_version}, {minor})
#else
#define {ns}_AVAILABLE_IN_{current_major_version}_{minor} _{ns}_EXTERN
#define {ns}_AVAILABLE_STATIC_INLINE_IN_{current_major_version}_{minor}
#define {ns}_AVAILABLE_MACRO_IN_{current_major_version}_{minor}
#define {ns}_AVAILABLE_ENUMERATOR_IN_{current_major_version}_{minor}
#define {ns}_AVAILABLE_TYPE_IN_{current_major_version}_{minor}
#endif
"""
)
)
def main():
parser = argparse.ArgumentParser()
parser.add_argument("gtk_version", help="Current GLib version")
subparsers = parser.add_subparsers()
versions_parser = subparsers.add_parser(
"versions-macros", help="Generate versions macros"
)
versions_parser.add_argument("in_path", help="input file", type=Path)
versions_parser.add_argument("out_path", help="output file", type=Path)
versions_parser.set_defaults(func=gen_versions_macros)
visibility_parser = subparsers.add_parser(
"visibility-macros", help="Generate visibility macros"
)
visibility_parser.add_argument("namespace", help="Macro namespace")
visibility_parser.add_argument("out_path", help="output file", type=Path)
visibility_parser.set_defaults(func=gen_visibility_macros)
args = parser.parse_args()
version = [int(i) for i in args.gtk_version.split(".")]
args.func(args, version[0], version[1], version[2])
if __name__ == "__main__":
main()

View File

@@ -162,10 +162,6 @@ create_page4 (GtkWidget *assistant)
gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), progress_bar, GTK_ASSISTANT_PAGE_PROGRESS);
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), progress_bar, "Applying changes");
gtk_accessible_update_property (GTK_ACCESSIBLE (progress_bar),
GTK_ACCESSIBLE_PROPERTY_LABEL, "Applying changes",
-1);
/* This prevents the assistant window from being
* closed while we're "busy" applying changes.
*/

View File

@@ -116,8 +116,7 @@ effective_align (GtkAlign align,
return direction == GTK_TEXT_DIR_RTL ? GTK_ALIGN_START : GTK_ALIGN_END;
case GTK_ALIGN_FILL:
case GTK_ALIGN_CENTER:
case GTK_ALIGN_BASELINE_FILL:
case GTK_ALIGN_BASELINE_CENTER:
case GTK_ALIGN_BASELINE:
default:
return align;
}
@@ -259,8 +258,7 @@ blur_overlay_get_child_position (BlurOverlay *overlay,
case GTK_ALIGN_END:
alloc->x += width - alloc->width;
break;
case GTK_ALIGN_BASELINE_FILL:
case GTK_ALIGN_BASELINE_CENTER:
case GTK_ALIGN_BASELINE:
default:
g_assert_not_reached ();
break;
@@ -283,8 +281,7 @@ blur_overlay_get_child_position (BlurOverlay *overlay,
case GTK_ALIGN_END:
alloc->y += height - alloc->height;
break;
case GTK_ALIGN_BASELINE_FILL:
case GTK_ALIGN_BASELINE_CENTER:
case GTK_ALIGN_BASELINE:
default:
g_assert_not_reached ();
break;

View File

@@ -51,11 +51,15 @@ struct _BlurOverlayClass
GtkAllocation *allocation);
};
GDK_AVAILABLE_IN_ALL
GType blur_overlay_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GtkWidget *blur_overlay_new (void);
GDK_AVAILABLE_IN_ALL
void blur_overlay_add_overlay (BlurOverlay *overlay,
GtkWidget *widget,
double blur);
GDK_AVAILABLE_IN_ALL
void blur_overlay_set_child (BlurOverlay *overlay,
GtkWidget *widget);

View File

@@ -50,7 +50,7 @@ update_css_for_blend_mode (GtkCssProvider *provider,
blend_mode,
blend_mode);
gtk_css_provider_load_from_string (provider, css);
gtk_css_provider_load_from_data (provider, css, -1);
g_bytes_unref (bytes);
g_free (css);

View File

@@ -195,9 +195,6 @@
<gresource prefix="/listview_settings">
<file>listview_settings.ui</file>
</gresource>
<gresource prefix="/listview_settings2">
<file>listview_settings2.ui</file>
</gresource>
<gresource prefix="/listview_ucd_data/">
<file>ucdnames.data</file>
</gresource>
@@ -315,7 +312,6 @@
<file>listview_minesweeper.c</file>
<file>listview_selections.c</file>
<file>listview_settings.c</file>
<file>listview_settings2.c</file>
<file>listview_ucd.c</file>
<file>listview_weather.c</file>
<file>listview_words.c</file>

View File

@@ -70,7 +70,7 @@ set_color (CanvasItem *item,
css = g_strdup_printf ("#%s { background: %s; }", name, str);
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_string (provider, css);
gtk_css_provider_load_from_data (provider, css, -1);
gtk_style_context_add_provider_for_display (gtk_widget_get_display (item->label), GTK_STYLE_PROVIDER (provider), 700);
item->provider = GTK_STYLE_PROVIDER (provider);
@@ -765,7 +765,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
g_string_append_printf (css, ".canvasitem.%s { background: %s; }\n", colors[i], colors[i]);
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_string (provider, css->str);
gtk_css_provider_load_from_data (provider, css->str, css->len);
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
800);

View File

@@ -301,7 +301,7 @@ do_fishbowl (GtkWidget *do_widget)
if (provider == NULL)
{
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_string (provider, css);
gtk_css_provider_load_from_data (provider, css, -1);
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);

View File

@@ -1294,18 +1294,18 @@ add_axis (hb_face_t *hb_face,
axis_label = gtk_label_new (name);
gtk_widget_set_halign (axis_label, GTK_ALIGN_START);
gtk_widget_set_valign (axis_label, GTK_ALIGN_BASELINE_FILL);
gtk_widget_set_valign (axis_label, GTK_ALIGN_BASELINE);
gtk_grid_attach (GTK_GRID (demo->variations_grid), axis_label, 0, i, 1, 1);
adjustment = gtk_adjustment_new (value, ax->min_value, ax->max_value,
1.0, 10.0, 0.0);
axis_scale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, adjustment);
gtk_scale_add_mark (GTK_SCALE (axis_scale), ax->default_value, GTK_POS_TOP, NULL);
gtk_widget_set_valign (axis_scale, GTK_ALIGN_BASELINE_FILL);
gtk_widget_set_valign (axis_scale, GTK_ALIGN_BASELINE);
gtk_widget_set_hexpand (axis_scale, TRUE);
gtk_widget_set_size_request (axis_scale, 100, -1);
gtk_grid_attach (GTK_GRID (demo->variations_grid), axis_scale, 1, i, 1, 1);
axis_entry = gtk_entry_new ();
gtk_widget_set_valign (axis_entry, GTK_ALIGN_BASELINE_FILL);
gtk_widget_set_valign (axis_entry, GTK_ALIGN_BASELINE);
gtk_editable_set_width_chars (GTK_EDITABLE (axis_entry), 4);
gtk_editable_set_max_width_chars (GTK_EDITABLE (axis_entry), 4);
gtk_widget_set_hexpand (axis_entry, FALSE);
@@ -1562,14 +1562,14 @@ update_font_variations (void)
label = gtk_label_new ("Instance");
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE_FILL);
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
gtk_grid_attach (GTK_GRID (demo->variations_grid), label, 0, -1, 1, 1);
strings = gtk_string_list_new (NULL);
combo = gtk_drop_down_new (G_LIST_MODEL (strings), NULL);
gtk_widget_set_halign (combo, GTK_ALIGN_START);
gtk_widget_set_valign (combo, GTK_ALIGN_BASELINE_FILL);
gtk_widget_set_valign (combo, GTK_ALIGN_BASELINE);
gtk_string_list_append (strings, "");

View File

@@ -43,7 +43,6 @@ update_image (void)
cairo_t *cr;
GdkPixbuf *pixbuf;
GdkPixbuf *pixbuf2;
GdkTexture *texture;
cairo_font_options_t *fopt;
cairo_hint_style_t hintstyle;
cairo_hint_metrics_t hintmetrics;
@@ -121,17 +120,8 @@ update_image (void)
cairo_destroy (cr);
g_object_unref (layout);
pixbuf = gdk_pixbuf_new_from_data (cairo_image_surface_get_data (surface),
GDK_COLORSPACE_RGB, TRUE, 8,
cairo_image_surface_get_width (surface),
cairo_image_surface_get_height (surface),
cairo_image_surface_get_stride (surface),
NULL, NULL);
pixbuf2 = gdk_pixbuf_scale_simple (pixbuf,
gdk_pixbuf_get_width (pixbuf) * scale,
gdk_pixbuf_get_height (pixbuf) * scale,
GDK_INTERP_NEAREST);
pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, cairo_image_surface_get_width (surface), cairo_image_surface_get_height (surface));
pixbuf2 = gdk_pixbuf_scale_simple (pixbuf, gdk_pixbuf_get_width (pixbuf) * scale, gdk_pixbuf_get_height (pixbuf) * scale, GDK_INTERP_NEAREST);
g_object_unref (pixbuf);
cairo_surface_destroy (surface);
@@ -288,24 +278,14 @@ retry:
pango_layout_iter_free (iter);
g_object_unref (layout);
pixbuf = gdk_pixbuf_new_from_data (cairo_image_surface_get_data (surface),
GDK_COLORSPACE_RGB, TRUE, 8,
cairo_image_surface_get_width (surface),
cairo_image_surface_get_height (surface),
cairo_image_surface_get_stride (surface),
NULL, NULL);
pixbuf2 = gdk_pixbuf_scale_simple (pixbuf,
gdk_pixbuf_get_width (pixbuf) * scale,
gdk_pixbuf_get_height (pixbuf) * scale,
GDK_INTERP_NEAREST);
pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, cairo_image_surface_get_width (surface), cairo_image_surface_get_height (surface));
pixbuf2 = gdk_pixbuf_scale_simple (pixbuf, gdk_pixbuf_get_width (pixbuf) * scale, gdk_pixbuf_get_height (pixbuf) * scale, GDK_INTERP_NEAREST);
g_object_unref (pixbuf);
cairo_surface_destroy (surface);
}
texture = gdk_texture_new_for_pixbuf (pixbuf2);
gtk_picture_set_paintable (GTK_PICTURE (image), GDK_PAINTABLE (texture));
g_object_unref (pixbuf2);
gtk_picture_set_pixbuf (GTK_PICTURE (image), pixbuf2);
g_object_unref (pixbuf2);
}

View File

@@ -337,7 +337,7 @@ create_gltransition_window (GtkWidget *do_widget)
1, 1, 1, 1);
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_string (provider, "button.small { padding: 0; }");
gtk_css_provider_load_from_data (provider, "button.small { padding: 0; }", -1);
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);

View File

@@ -27,17 +27,24 @@ G_BEGIN_DECLS
#define GSK_TYPE_SHADER_PAINTABLE (gsk_shader_paintable_get_type ())
GDK_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (GskShaderPaintable, gsk_shader_paintable, GSK, SHADER_PAINTABLE, GObject)
GDK_AVAILABLE_IN_ALL
GdkPaintable * gsk_shader_paintable_new (GskGLShader *shader,
GBytes *data);
GDK_AVAILABLE_IN_ALL
GskGLShader * gsk_shader_paintable_get_shader (GskShaderPaintable *self);
GDK_AVAILABLE_IN_ALL
void gsk_shader_paintable_set_shader (GskShaderPaintable *self,
GskGLShader *shader);
GDK_AVAILABLE_IN_ALL
GBytes * gsk_shader_paintable_get_args (GskShaderPaintable *self);
GDK_AVAILABLE_IN_ALL
void gsk_shader_paintable_set_args (GskShaderPaintable *self,
GBytes *data);
GDK_AVAILABLE_IN_ALL
void gsk_shader_paintable_update_time (GskShaderPaintable *self,
int time_idx,
gint64 frame_time);

View File

@@ -370,7 +370,7 @@ do_iconscroll (GtkWidget *do_widget)
set_widget_type (0);
label = GTK_WIDGET (gtk_builder_get_object (builder, "fps_label"));
id = g_timeout_add_full (G_PRIORITY_HIGH, 500, update_fps, label, NULL);
id = g_timeout_add (500, update_fps, label);
g_object_set_data_full (G_OBJECT (label), "timeout",
GUINT_TO_POINTER (id), remove_timeout);

View File

@@ -30,7 +30,6 @@ progressive_prepared_callback (GdkPixbufLoader *loader,
{
GdkPixbuf *pixbuf;
GtkWidget *picture;
GdkTexture *texture;
picture = GTK_WIDGET (data);
@@ -41,9 +40,7 @@ progressive_prepared_callback (GdkPixbufLoader *loader,
*/
gdk_pixbuf_fill (pixbuf, 0xaaaaaaff);
texture = gdk_texture_new_for_pixbuf (pixbuf);
gtk_picture_set_paintable (GTK_PICTURE (picture), GDK_PAINTABLE (texture));
g_object_unref (texture);
gtk_picture_set_pixbuf (GTK_PICTURE (picture), pixbuf);
}
static void
@@ -54,18 +51,22 @@ progressive_updated_callback (GdkPixbufLoader *loader,
int height,
gpointer data)
{
GtkWidget *picture = GTK_WIDGET (data);
GdkTexture *texture;
GtkWidget *picture;
GdkPixbuf *pixbuf;
texture = gdk_texture_new_for_pixbuf (gdk_pixbuf_loader_get_pixbuf (loader));
gtk_picture_set_paintable (GTK_PICTURE (picture), GDK_PAINTABLE (texture));
g_object_unref (texture);
picture = GTK_WIDGET (data);
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
gtk_picture_set_pixbuf (GTK_PICTURE (picture), NULL);
gtk_picture_set_pixbuf (GTK_PICTURE (picture), pixbuf);
}
static int
progressive_timeout (gpointer data)
{
GtkWidget *picture = GTK_WIDGET (data);
GtkWidget *picture;
picture = GTK_WIDGET (data);
/* This shows off fully-paranoid error handling, so looks scary.
* You could factor out the error handling code into a nice separate

View File

@@ -49,7 +49,6 @@
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
<property name="mnemonic-widget">switch</property>
</object>
</child>
<child>
@@ -74,7 +73,6 @@
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
<property name="mnemonic-widget">check</property>
</object>
</child>
<child>
@@ -112,7 +110,6 @@
<property name="margin-start">10</property>
<property name="margin-end">10</property>
<property name="opacity">0</property>
<property name="accessible-role">status</property>
</object>
</child>
</object>
@@ -153,11 +150,10 @@
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
<property name="mnemonic-widget">scale</property>
</object>
</child>
<child>
<object class="GtkScale" id="scale">
<object class="GtkScale">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="draw-value">0</property>
@@ -189,11 +185,10 @@
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
<property name="mnemonic-widget">spin</property>
</object>
</child>
<child>
<object class="GtkSpinButton" id="spin">
<object class="GtkSpinButton">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="adjustment">
@@ -222,11 +217,10 @@
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
<property name="mnemonic-widget">dropdown</property>
</object>
</child>
<child>
<object class="GtkDropDown" id="dropdown">
<object class="GtkDropDown">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="model">
@@ -258,11 +252,10 @@
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
<property name="mnemonic-widget">entry</property>
</object>
</child>
<child>
<object class="GtkEntry" id="entry">
<object class="GtkEntry">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="placeholder-text">Type here…</property>

View File

@@ -368,38 +368,6 @@ match_func (MatchObject *obj,
g_free (tmp2);
}
static void
setup_header (GtkSignalListItemFactory *factory,
GObject *list_item,
gpointer data)
{
GtkListHeader *self = GTK_LIST_HEADER (list_item);
GtkWidget *child;
child = gtk_label_new ("");
gtk_label_set_xalign (GTK_LABEL (child), 0);
gtk_label_set_use_markup (GTK_LABEL (child), TRUE);
gtk_widget_set_margin_top (child, 10);
gtk_widget_set_margin_bottom (child, 10);
gtk_list_header_set_child (self, child);
}
static void
bind_header (GtkSignalListItemFactory *factory,
GObject *list_item,
gpointer data)
{
GtkListHeader *self = GTK_LIST_HEADER (list_item);
GtkWidget *child = gtk_list_header_get_child (self);
GObject *item = gtk_list_header_get_item (self);
if (strstr (gtk_string_object_get_string (GTK_STRING_OBJECT (item)), "hour"))
gtk_label_set_label (GTK_LABEL (child), "<big><b>Hours</b></big>");
else
gtk_label_set_label (GTK_LABEL (child), "<big><b>Minutes</b></big>");
}
GtkWidget *
do_listview_selections (GtkWidget *do_widget)
{
@@ -409,12 +377,10 @@ do_listview_selections (GtkWidget *do_widget)
GtkExpression *expression;
GtkListItemFactory *factory;
const char * const times[] = { "1 minute", "2 minutes", "5 minutes", "20 minutes", NULL };
const char * const minutes[] = {
const char * const many_times[] = {
"1 minute", "2 minutes", "5 minutes", "10 minutes", "15 minutes", "20 minutes",
"25 minutes", "30 minutes", "35 minutes", "40 minutes", "45 minutes", "50 minutes",
"55 minutes", NULL
};
const char * const hours[] = { "1 hour", "2 hours", "3 hours", "5 hours", "6 hours", "7 hours",
"55 minutes", "1 hour", "2 hours", "3 hours", "5 hours", "6 hours", "7 hours",
"8 hours", "9 hours", "10 hours", "11 hours", "12 hours", NULL
};
const char * const device_titles[] = { "Digital Output", "Headphones", "Digital Output", "Analog Output", NULL };
@@ -429,10 +395,6 @@ do_listview_selections (GtkWidget *do_widget)
if (!window)
{
GtkStringList *minutes_model, *hours_model;
GListStore *store;
GtkFlattenListModel *flat;
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
@@ -460,25 +422,14 @@ do_listview_selections (GtkWidget *do_widget)
gtk_box_append (GTK_BOX (box), button);
/* A dropdown using an expression to obtain strings */
minutes_model = gtk_string_list_new (minutes);
hours_model = gtk_string_list_new (hours);
store = g_list_store_new (G_TYPE_LIST_MODEL);
g_list_store_append (store, minutes_model);
g_list_store_append (store, hours_model);
g_object_unref (minutes_model);
g_object_unref (hours_model);
flat = gtk_flatten_list_model_new (G_LIST_MODEL (store));
button = drop_down_new_from_strings (many_times, NULL, NULL);
gtk_drop_down_set_enable_search (GTK_DROP_DOWN (button), TRUE);
expression = gtk_cclosure_expression_new (G_TYPE_STRING, NULL,
0, NULL,
(GCallback)get_title,
NULL, NULL);
button = gtk_drop_down_new (G_LIST_MODEL (flat), expression);
gtk_drop_down_set_enable_search (GTK_DROP_DOWN (button), TRUE);
factory = gtk_signal_list_item_factory_new ();
g_signal_connect (factory, "setup", G_CALLBACK (setup_header), NULL);
g_signal_connect (factory, "bind", G_CALLBACK (bind_header), NULL);
gtk_drop_down_set_header_factory (GTK_DROP_DOWN (button), factory);
g_object_unref (factory);
gtk_drop_down_set_expression (GTK_DROP_DOWN (button), expression);
gtk_expression_unref (expression);
gtk_box_append (GTK_BOX (box), button);
button = gtk_drop_down_new (NULL, NULL);

View File

@@ -14,7 +14,138 @@
#include <gtk/gtk.h>
#include "settings-key.h"
#include <stdlib.h>
/* Create an object that wraps GSettingsSchemaKey because that's a boxed type */
typedef struct _SettingsKey SettingsKey;
struct _SettingsKey
{
GObject parent_instance;
GSettings *settings;
GSettingsSchemaKey *key;
};
enum {
PROP_0,
PROP_NAME,
PROP_SUMMARY,
PROP_DESCRIPTION,
PROP_VALUE,
PROP_TYPE,
PROP_DEFAULT_VALUE,
N_PROPS
};
#define SETTINGS_TYPE_KEY (settings_key_get_type ())
G_DECLARE_FINAL_TYPE (SettingsKey, settings_key, SETTINGS, KEY, GObject);
G_DEFINE_TYPE (SettingsKey, settings_key, G_TYPE_OBJECT);
static GParamSpec *properties[N_PROPS] = { NULL, };
static void
settings_key_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
SettingsKey *self = SETTINGS_KEY (object);
switch (property_id)
{
case PROP_DESCRIPTION:
g_value_set_string (value, g_settings_schema_key_get_description (self->key));
break;
case PROP_NAME:
g_value_set_string (value, g_settings_schema_key_get_name (self->key));
break;
case PROP_SUMMARY:
g_value_set_string (value, g_settings_schema_key_get_summary (self->key));
break;
case PROP_VALUE:
{
GVariant *variant = g_settings_get_value (self->settings, g_settings_schema_key_get_name (self->key));
g_value_take_string (value, g_variant_print (variant, FALSE));
g_variant_unref (variant);
}
break;
case PROP_TYPE:
{
const GVariantType *type = g_settings_schema_key_get_value_type (self->key);
g_value_set_string (value, g_variant_type_peek_string (type));
}
break;
case PROP_DEFAULT_VALUE:
{
GVariant *variant = g_settings_schema_key_get_default_value (self->key);
g_value_take_string (value, g_variant_print (variant, FALSE));
g_variant_unref (variant);
}
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
settings_key_finalize (GObject *object)
{
SettingsKey *self = SETTINGS_KEY (object);
g_object_unref (self->settings);
g_settings_schema_key_unref (self->key);
G_OBJECT_CLASS (settings_key_parent_class)->finalize (object);
}
static void
settings_key_class_init (SettingsKeyClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = settings_key_finalize;
gobject_class->get_property = settings_key_get_property;
properties[PROP_DESCRIPTION] =
g_param_spec_string ("description", NULL, NULL, NULL, G_PARAM_READABLE);
properties[PROP_NAME] =
g_param_spec_string ("name", NULL, NULL, NULL, G_PARAM_READABLE);
properties[PROP_SUMMARY] =
g_param_spec_string ("summary", NULL, NULL, NULL, G_PARAM_READABLE);
properties[PROP_VALUE] =
g_param_spec_string ("value", NULL, NULL, NULL, G_PARAM_READABLE);
properties[PROP_TYPE] =
g_param_spec_string ("type", NULL, NULL, NULL, G_PARAM_READABLE);
properties[PROP_DEFAULT_VALUE] =
g_param_spec_string ("default-value", NULL, NULL, NULL, G_PARAM_READABLE);
g_object_class_install_properties (gobject_class, N_PROPS, properties);
}
static void
settings_key_init (SettingsKey *self)
{
}
static SettingsKey *
settings_key_new (GSettings *settings,
GSettingsSchemaKey *key)
{
SettingsKey *result = g_object_new (SETTINGS_TYPE_KEY, NULL);
result->settings = g_object_ref (settings);
result->key = g_settings_schema_key_ref (key);
return result;
}
static void
item_value_changed (GtkEditableLabel *label,
@@ -22,7 +153,6 @@ item_value_changed (GtkEditableLabel *label,
GtkColumnViewCell *cell)
{
SettingsKey *self;
GSettingsSchemaKey *key;
const char *text;
const GVariantType *type;
GVariant *variant;
@@ -33,10 +163,9 @@ item_value_changed (GtkEditableLabel *label,
text = gtk_editable_get_text (GTK_EDITABLE (label));
self = gtk_column_view_cell_get_item (cell);
key = settings_key_get_key (self);
type = g_settings_schema_key_get_value_type (key);
name = g_settings_schema_key_get_name (key);
type = g_settings_schema_key_get_value_type (self->key);
name = g_settings_schema_key_get_name (self->key);
variant = g_variant_parse (type, text, NULL, NULL, &error);
if (!variant)
@@ -46,13 +175,13 @@ item_value_changed (GtkEditableLabel *label,
goto revert;
}
if (!g_settings_schema_key_range_check (key, variant))
if (!g_settings_schema_key_range_check (self->key, variant))
{
g_warning ("Not a valid value for %s", name);
goto revert;
}
g_settings_set_value (settings_key_get_settings (self), name, variant);
g_settings_set_value (self->settings, name, variant);
g_variant_unref (variant);
return;

View File

@@ -1,230 +0,0 @@
/* Lists/Alternative Settings
* #Keywords: GtkListHeaderFactory, GtkSectionModel
*
* This demo shows an alternative settings viewer for GSettings.
*
* It demonstrates how to implement support for sections with GtkListView.
*
* It also shows how to quickly flatten a large tree of items into a list
* that can be filtered to find the items one is looking for.
*/
#include <gtk/gtk.h>
#include "settings-key.h"
static void
item_value_changed (GtkEditableLabel *label,
GParamSpec *pspec,
GtkColumnViewCell *cell)
{
SettingsKey *self;
GSettingsSchemaKey *key;
const char *text;
const GVariantType *type;
GVariant *variant;
GError *error = NULL;
const char *name;
char *value;
text = gtk_editable_get_text (GTK_EDITABLE (label));
self = gtk_column_view_cell_get_item (cell);
key = settings_key_get_key (self);
type = g_settings_schema_key_get_value_type (key);
name = g_settings_schema_key_get_name (key);
variant = g_variant_parse (type, text, NULL, NULL, &error);
if (!variant)
{
g_warning ("%s", error->message);
g_clear_error (&error);
goto revert;
}
if (!g_settings_schema_key_range_check (key, variant))
{
g_warning ("Not a valid value for %s", name);
goto revert;
}
g_settings_set_value (settings_key_get_settings (self), name, variant);
g_variant_unref (variant);
return;
revert:
gtk_widget_error_bell (GTK_WIDGET (label));
g_object_get (self, "value", &value, NULL);
gtk_editable_set_text (GTK_EDITABLE (label), value);
g_free (value);
}
static int
strvcmp (gconstpointer p1,
gconstpointer p2)
{
const char * const *s1 = p1;
const char * const *s2 = p2;
return strcmp (*s1, *s2);
}
static gpointer
map_settings_to_keys (gpointer item,
gpointer unused)
{
GSettings *settings = item;
GSettingsSchema *schema;
GListStore *store;
char **keys;
guint i;
g_object_get (settings, "settings-schema", &schema, NULL);
store = g_list_store_new (SETTINGS_TYPE_KEY);
keys = g_settings_schema_list_keys (schema);
for (i = 0; keys[i] != NULL; i++)
{
GSettingsSchemaKey *almost_there = g_settings_schema_get_key (schema, keys[i]);
SettingsKey *finally = settings_key_new (settings, almost_there);
g_list_store_append (store, finally);
g_object_unref (finally);
g_settings_schema_key_unref (almost_there);
}
g_strfreev (keys);
g_settings_schema_unref (schema);
g_object_unref (settings);
return store;
}
static GListModel *
create_settings_model (gpointer item,
gpointer unused)
{
GSettings *settings = item;
char **schemas;
GListStore *result;
guint i;
if (settings == NULL)
{
g_settings_schema_source_list_schemas (g_settings_schema_source_get_default (),
TRUE,
&schemas,
NULL);
}
else
{
schemas = g_settings_list_children (settings);
}
if (schemas == NULL || schemas[0] == NULL)
{
g_free (schemas);
return NULL;
}
qsort (schemas, g_strv_length (schemas), sizeof (char *), strvcmp);
result = g_list_store_new (G_TYPE_SETTINGS);
for (i = 0; schemas[i] != NULL; i++)
{
GSettings *child;
if (settings == NULL)
child = g_settings_new (schemas[i]);
else
child = g_settings_get_child (settings, schemas[i]);
g_list_store_append (result, child);
g_object_unref (child);
}
g_strfreev (schemas);
return G_LIST_MODEL (result);
}
static void
search_enabled (GtkSearchEntry *entry)
{
gtk_editable_set_text (GTK_EDITABLE (entry), "");
}
static void
stop_search (GtkSearchEntry *entry,
gpointer data)
{
gtk_editable_set_text (GTK_EDITABLE (entry), "");
}
static GtkWidget *window = NULL;
GtkWidget *
do_listview_settings2 (GtkWidget *do_widget)
{
if (window == NULL)
{
GtkListView *listview;
GListModel *model;
GtkTreeListModel *treemodel;
GtkNoSelection *selection;
GtkBuilderScope *scope;
GtkBuilder *builder;
GError *error = NULL;
GtkFilter *filter;
g_type_ensure (SETTINGS_TYPE_KEY);
scope = gtk_builder_cscope_new ();
gtk_builder_cscope_add_callback (scope, search_enabled);
gtk_builder_cscope_add_callback (scope, stop_search);
gtk_builder_cscope_add_callback (scope, settings_key_get_search_string);
gtk_builder_cscope_add_callback (scope, item_value_changed);
builder = gtk_builder_new ();
gtk_builder_set_scope (builder, scope);
g_object_unref (scope);
gtk_builder_add_from_resource (builder, "/listview_settings2/listview_settings2.ui", &error);
g_assert_no_error (error);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *) &window);
listview = GTK_LIST_VIEW (gtk_builder_get_object (builder, "listview"));
filter = GTK_FILTER (gtk_builder_get_object (builder, "filter"));
model = create_settings_model (NULL, NULL);
treemodel = gtk_tree_list_model_new (model,
TRUE,
TRUE,
create_settings_model,
NULL,
NULL);
model = G_LIST_MODEL (gtk_map_list_model_new (G_LIST_MODEL (treemodel), map_settings_to_keys, NULL, NULL));
model = G_LIST_MODEL (gtk_flatten_list_model_new (model));
model = G_LIST_MODEL (gtk_filter_list_model_new (model, g_object_ref (filter)));
selection = gtk_no_selection_new (model);
gtk_list_view_set_model (GTK_LIST_VIEW (listview), GTK_SELECTION_MODEL (selection));
g_object_unref (selection);
g_object_unref (builder);
}
if (!gtk_widget_get_visible (window))
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@@ -1,130 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkStringFilter" id="filter">
<property name="expression">
<closure type="gchararray" function="settings_key_get_search_string" />
</property>
<property name="search" bind-source="entry" bind-property="text" />
</object>
<object class="GtkWindow" id="window">
<property name="title" translatable="yes">Settings</property>
<property name="default-width">640</property>
<property name="default-height">480</property>
<child type="titlebar">
<object class="GtkHeaderBar">
<child type="end">
<object class="GtkToggleButton" id="search_button">
<property name="icon-name">system-search-symbolic</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkSearchBar">
<property name="search-mode-enabled" bind-source="search_button" bind-property="active" bind-flags="bidirectional"/>
<signal name="notify::search-mode-enabled" handler="search_enabled" object="entry"/>
<child>
<object class="GtkSearchEntry" id="entry">
<signal name="stop-search" handler="stop_search"/>
</object>
</child>
</object>
</child>
<child>
<object class="GtkScrolledWindow">
<child>
<object class="GtkListView" id="listview">
<property name="vexpand">1</property>
<style>
<class name="rich-list"/>
</style>
<property name="factory">
<object class="GtkBuilderListItemFactory">
<property name="bytes"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GtkListItem">
<property name="child">
<object class="GtkBox">
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<property name="xalign">0</property>
<binding name="label">
<lookup name="name" type="SettingsKey">
<lookup name="item">GtkListItem</lookup>
</lookup>
</binding>
</object>
</child>
<child>
<object class="GtkLabel">
<style>
<class name="dim-label"/>
</style>
<property name="xalign">0</property>
<property name="ellipsize">end</property>
<binding name="label">
<lookup name="summary" type="SettingsKey">
<lookup name="item">GtkListItem</lookup>
</lookup>
</binding>
</object>
</child>
</object>
</child>
<child>
<object class="GtkEntry">
<property name="hexpand">1</property>
<property name="halign">end</property>
<binding name="text">
<lookup name="value" type="SettingsKey">
<lookup name="item">GtkListItem</lookup>
</lookup>
</binding>
<signal name="notify::label" handler="item_value_changed"/>
</object>
</child>
</object>
</property>
</template>
</interface>
]]></property>
</object>
</property>
<property name="header-factory">
<object class="GtkBuilderListItemFactory">
<property name="bytes"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GtkListHeader">
<property name="child">
<object class="GtkLabel">
<property name="xalign">0</property>
<binding name="label">
<lookup name="schema" type="GSettings">
<lookup name="settings" type="SettingsKey">
<lookup name="item">GtkListHeader</lookup>
</lookup>
</lookup>
</binding>
</object>
</property>
</template>
</interface>
]]></property>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -367,7 +367,7 @@ do_listview_ucd (GtkWidget *do_widget)
gtk_label_set_width_chars (GTK_LABEL (label), 2);
gtk_widget_add_css_class (label, "enormous");
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_string (provider, "label.enormous { font-size: 80px; }");
gtk_css_provider_load_from_data (provider, "label.enormous { font-size: 80px; }", -1);
gtk_style_context_add_provider_for_display (gdk_display_get_default (), GTK_STYLE_PROVIDER (provider), 800);
gtk_widget_set_hexpand (label, TRUE);
gtk_box_append (GTK_BOX (box), label);

View File

@@ -10,8 +10,6 @@
<property name="child">
<object class="GtkInscription">
<property name="hexpand">1</property>
<property name="nat-chars">25</property>
<property name="text-overflow">ellipsize-end</property>
<binding name="text">
<lookup name="title" type="GtkDemo">
<lookup name="item">expander</lookup>

View File

@@ -18,6 +18,7 @@
#include <string.h>
#include "config.h"
#include <gtk/gtk.h>
#include <glib/gstdio.h>
@@ -267,9 +268,9 @@ activate_run (GSimpleAction *action,
}
static GtkWidget *
display_image (const char *format,
const char *resource,
GtkWidget *label)
display_image (const char *format,
const char *resource,
char **label)
{
GtkWidget *sw, *image;
@@ -279,17 +280,13 @@ display_image (const char *format,
sw = gtk_scrolled_window_new ();
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), image);
gtk_accessible_update_relation (GTK_ACCESSIBLE (image),
GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL,
-1);
return sw;
}
static GtkWidget *
display_images (const char *format,
const char *resource_dir,
GtkWidget *label)
display_images (const char *format,
const char *resource_dir,
char **label)
{
char **resources;
GtkWidget *grid;
@@ -314,15 +311,13 @@ display_images (const char *format,
{
char *resource_name;
GtkWidget *box;
GtkWidget *image_label;
resource_name = g_strconcat (resource_dir, "/", resources[i], NULL);
image_label = gtk_label_new (resources[i]);
widget = display_image (NULL, resource_name, image_label);
widget = display_image (NULL, resource_name, NULL);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_box_append (GTK_BOX (box), widget);
gtk_box_append (GTK_BOX (box), image_label);
gtk_box_append (GTK_BOX (box), gtk_label_new (resources[i]));
gtk_flow_box_insert (GTK_FLOW_BOX (grid), box, -1);
g_free (resource_name);
@@ -330,19 +325,15 @@ display_images (const char *format,
g_strfreev (resources);
gtk_label_set_label (GTK_LABEL (label), "Images");
gtk_accessible_update_relation (GTK_ACCESSIBLE (grid),
GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL,
-1);
*label = g_strdup ("Images");
return sw;
}
static GtkWidget *
display_text (const char *format,
const char *resource,
GtkWidget *label)
display_text (const char *format,
const char *resource,
char **label)
{
GtkTextBuffer *buffer;
GtkWidget *textview, *sw;
@@ -377,10 +368,6 @@ display_text (const char *format,
gtk_text_view_set_buffer (GTK_TEXT_VIEW (textview), buffer);
gtk_accessible_update_relation (GTK_ACCESSIBLE (textview),
GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL,
-1);
sw = gtk_scrolled_window_new ();
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
@@ -391,19 +378,15 @@ display_text (const char *format,
}
static GtkWidget *
display_video (const char *format,
const char *resource,
GtkWidget *label)
display_video (const char *format,
const char *resource,
char **label)
{
GtkWidget *video;
video = gtk_video_new_for_resource (resource);
gtk_video_set_loop (GTK_VIDEO (video), TRUE);
gtk_accessible_update_relation (GTK_ACCESSIBLE (video),
GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL,
-1);
return video;
}
@@ -425,9 +408,9 @@ display_nothing (const char *resource)
static struct {
const char *extension;
const char *format;
GtkWidget * (* display_func) (const char *format,
const char *resource,
GtkWidget *label);
GtkWidget * (* display_func) (const char *format,
const char *resource,
char **label);
} display_funcs[] = {
{ ".gif", NULL, display_image },
{ ".jpg", NULL, display_image },
@@ -450,6 +433,7 @@ add_data_tab (const char *demoname)
char **resources;
GtkWidget *widget, *label;
guint i, j;
char *label_string;
resource_dir = g_strconcat ("/", demoname, NULL);
resources = g_resources_enumerate_children (resource_dir, 0, NULL);
@@ -469,21 +453,23 @@ add_data_tab (const char *demoname)
break;
}
label = gtk_label_new (resources[i]);
label_string = NULL;
if (j < G_N_ELEMENTS (display_funcs))
widget = display_funcs[j].display_func (display_funcs[j].format,
resource_name,
label);
&label_string);
else
widget = display_nothing (resource_name);
label = gtk_label_new (label_string ? label_string : resources[i]);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), widget, label);
g_object_set (gtk_notebook_get_page (GTK_NOTEBOOK (notebook), widget),
"tab-expand", FALSE,
NULL);
g_free (resource_name);
g_free (label_string);
}
g_strfreev (resources);

View File

@@ -57,17 +57,14 @@
<object class="GtkBox">
<child>
<object class="GtkBox">
<property name="width-request">220</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkSearchBar" id="searchbar">
<accessibility>
<relation name="labelled-by">search-entry</relation>
</accessibility>
<property name="key-capture-widget">window</property>
<child>
<object class="GtkSearchEntry" id="search-entry">
<accessibility>
<property name="label" translatable="yes">Search</property>
<relation name="controls">listview</relation>
</accessibility>
</object>
@@ -79,15 +76,15 @@
<style>
<class name="sidebar"/>
</style>
<property name="width-request">120</property>
<property name="hscrollbar-policy">never</property>
<property name="propagate-natural-width">1</property>
<property name="min-content-width">150</property>
<property name="vexpand">1</property>
<child>
<object class="GtkListView" id="listview">
<style>
<class name="navigation-sidebar"/>
</style>
<property name="tab-behavior">item</property>
<property name="factory">
<object class="GtkBuilderListItemFactory">
<property name="resource">/ui/main-listitem.ui</property>

View File

@@ -57,7 +57,6 @@ demos = files([
'listview_minesweeper.c',
'listview_selections.c',
'listview_settings.c',
'listview_settings2.c',
'listview_ucd.c',
'listview_weather.c',
'listview_words.c',
@@ -132,7 +131,6 @@ extra_demo_sources = files([
'demo4widget.c',
'pixbufpaintable.c',
'script-names.c',
'settings-key.c',
'unicode-names.c',
'suggestionentry.c',
'language-names.c',
@@ -235,7 +233,8 @@ endif
demo_cflags = []
foreach flag: common_cflags
if flag not in ['-Werror=missing-prototypes', '-Wmissing-prototypes',
'-Werror=missing-declarations', '-Wmissing-declarations']
'-Werror=missing-declarations', '-Wmissing-declarations',
'-fvisibility=hidden']
demo_cflags += flag
endif
endforeach

View File

@@ -68,9 +68,6 @@ do_password_entry (GtkWidget *do_widget)
"placeholder-text", "Password",
"activates-default", TRUE,
NULL);
gtk_accessible_update_property (GTK_ACCESSIBLE (entry),
GTK_ACCESSIBLE_PROPERTY_LABEL, "Password",
-1);
g_signal_connect (entry, "notify::text", G_CALLBACK (update_button), NULL);
gtk_box_append (GTK_BOX (box), entry);
@@ -80,9 +77,6 @@ do_password_entry (GtkWidget *do_widget)
"placeholder-text", "Confirm",
"activates-default", TRUE,
NULL);
gtk_accessible_update_property (GTK_ACCESSIBLE (entry2),
GTK_ACCESSIBLE_PROPERTY_LABEL, "Confirm",
-1);
g_signal_connect (entry2, "notify::text", G_CALLBACK (update_button), NULL);
gtk_box_append (GTK_BOX (box), entry2);

View File

@@ -384,7 +384,7 @@ create_board (GtkWidget *window)
"}";
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_string (provider, css);
gtk_css_provider_load_from_data (provider, css, -1);
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
800);

View File

@@ -189,7 +189,6 @@ do_pickers (GtkWidget *do_widget)
gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1);
picker = gtk_color_dialog_button_new (gtk_color_dialog_new ());
gtk_label_set_mnemonic_widget (GTK_LABEL (label), picker);
gtk_grid_attach (GTK_GRID (table), picker, 1, 0, 1, 1);
label = gtk_label_new ("Font:");
@@ -199,7 +198,6 @@ do_pickers (GtkWidget *do_widget)
gtk_grid_attach (GTK_GRID (table), label, 0, 1, 1, 1);
picker = gtk_font_dialog_button_new (gtk_font_dialog_new ());
gtk_label_set_mnemonic_widget (GTK_LABEL (label), picker);
gtk_grid_attach (GTK_GRID (table), picker, 1, 1, 1, 1);
label = gtk_label_new ("File:");
@@ -210,9 +208,6 @@ do_pickers (GtkWidget *do_widget)
picker = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
button = gtk_button_new_from_icon_name ("document-open-symbolic");
gtk_accessible_update_property (GTK_ACCESSIBLE (button),
GTK_ACCESSIBLE_PROPERTY_LABEL, "Select File",
-1);
label = gtk_label_new ("None");
@@ -228,9 +223,6 @@ do_pickers (GtkWidget *do_widget)
gtk_box_append (GTK_BOX (picker), button);
app_picker = gtk_button_new_from_icon_name ("emblem-system-symbolic");
gtk_widget_set_halign (app_picker, GTK_ALIGN_END);
gtk_accessible_update_property (GTK_ACCESSIBLE (app_picker),
GTK_ACCESSIBLE_PROPERTY_LABEL, "Open File",
-1);
gtk_widget_set_sensitive (app_picker, FALSE);
g_signal_connect (app_picker, "clicked", G_CALLBACK (open_app), NULL);
gtk_box_append (GTK_BOX (picker), app_picker);

View File

@@ -1,165 +0,0 @@
#include "settings-key.h"
/* Create an object that wraps GSettingsSchemaKey because that's a boxed type */
struct _SettingsKey
{
GObject parent_instance;
GSettings *settings;
GSettingsSchemaKey *key;
};
enum {
PROP_0,
PROP_NAME,
PROP_SETTINGS,
PROP_SUMMARY,
PROP_DESCRIPTION,
PROP_VALUE,
PROP_TYPE,
PROP_DEFAULT_VALUE,
N_PROPS
};
G_DEFINE_TYPE (SettingsKey, settings_key, G_TYPE_OBJECT);
static GParamSpec *properties[N_PROPS] = { NULL, };
static void
settings_key_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
SettingsKey *self = SETTINGS_KEY (object);
switch (property_id)
{
case PROP_DESCRIPTION:
g_value_set_string (value, g_settings_schema_key_get_description (self->key));
break;
case PROP_NAME:
g_value_set_string (value, g_settings_schema_key_get_name (self->key));
break;
case PROP_SUMMARY:
g_value_set_string (value, g_settings_schema_key_get_summary (self->key));
break;
case PROP_VALUE:
{
GVariant *variant = g_settings_get_value (self->settings, g_settings_schema_key_get_name (self->key));
g_value_take_string (value, g_variant_print (variant, FALSE));
g_variant_unref (variant);
}
break;
case PROP_TYPE:
{
const GVariantType *type = g_settings_schema_key_get_value_type (self->key);
g_value_set_string (value, g_variant_type_peek_string (type));
}
break;
case PROP_DEFAULT_VALUE:
{
GVariant *variant = g_settings_schema_key_get_default_value (self->key);
g_value_take_string (value, g_variant_print (variant, FALSE));
g_variant_unref (variant);
}
break;
case PROP_SETTINGS:
g_value_set_object (value, self->settings);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
settings_key_finalize (GObject *object)
{
SettingsKey *self = SETTINGS_KEY (object);
g_object_unref (self->settings);
g_settings_schema_key_unref (self->key);
G_OBJECT_CLASS (settings_key_parent_class)->finalize (object);
}
static void
settings_key_class_init (SettingsKeyClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = settings_key_finalize;
gobject_class->get_property = settings_key_get_property;
properties[PROP_DESCRIPTION] =
g_param_spec_string ("description", NULL, NULL, NULL, G_PARAM_READABLE);
properties[PROP_NAME] =
g_param_spec_string ("name", NULL, NULL, NULL, G_PARAM_READABLE);
properties[PROP_SETTINGS] =
g_param_spec_object ("settings", NULL, NULL, G_TYPE_SETTINGS, G_PARAM_READABLE);
properties[PROP_SUMMARY] =
g_param_spec_string ("summary", NULL, NULL, NULL, G_PARAM_READABLE);
properties[PROP_VALUE] =
g_param_spec_string ("value", NULL, NULL, NULL, G_PARAM_READABLE);
properties[PROP_TYPE] =
g_param_spec_string ("type", NULL, NULL, NULL, G_PARAM_READABLE);
properties[PROP_DEFAULT_VALUE] =
g_param_spec_string ("default-value", NULL, NULL, NULL, G_PARAM_READABLE);
g_object_class_install_properties (gobject_class, N_PROPS, properties);
}
static void
settings_key_init (SettingsKey *self)
{
}
SettingsKey *
settings_key_new (GSettings *settings,
GSettingsSchemaKey *key)
{
SettingsKey *result = g_object_new (SETTINGS_TYPE_KEY, NULL);
result->settings = g_object_ref (settings);
result->key = g_settings_schema_key_ref (key);
return result;
}
GSettingsSchemaKey *
settings_key_get_key (SettingsKey *self)
{
return self->key;
}
GSettings *
settings_key_get_settings (SettingsKey *self)
{
return self->settings;
}
char *
settings_key_get_search_string (SettingsKey *self)
{
char *schema, *result;
g_object_get (self->settings, "schema-id", &schema, NULL);
result = g_strconcat (g_settings_schema_key_get_name (self->key), " ",
g_settings_schema_key_get_summary (self->key), " ",
schema,
NULL);
g_free (schema);
return result;
}

View File

@@ -1,17 +0,0 @@
#pragma once
#include <gtk/gtk.h>
#include <stdlib.h>
/* Create an object that wraps GSettingsSchemaKey because that's a boxed type */
typedef struct _SettingsKey SettingsKey;
#define SETTINGS_TYPE_KEY (settings_key_get_type ())
G_DECLARE_FINAL_TYPE (SettingsKey, settings_key, SETTINGS, KEY, GObject);
SettingsKey * settings_key_new (GSettings *settings,
GSettingsSchemaKey *key);
GSettingsSchemaKey * settings_key_get_key (SettingsKey *self);
GSettings * settings_key_get_settings (SettingsKey *self);
char * settings_key_get_search_string (SettingsKey *self);

View File

@@ -28,14 +28,14 @@ add_row (GtkGrid *table,
label = gtk_label_new_with_mnemonic (label_text);
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE_FILL);
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
gtk_widget_set_hexpand (label, TRUE);
gtk_grid_attach (table, label, 0, row, 1, 1);
dropdown = gtk_drop_down_new_from_strings (options);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), dropdown);
gtk_widget_set_halign (dropdown, GTK_ALIGN_END);
gtk_widget_set_valign (dropdown, GTK_ALIGN_BASELINE_FILL);
gtk_widget_set_valign (dropdown, GTK_ALIGN_BASELINE);
gtk_size_group_add_widget (size_group, dropdown);
gtk_grid_attach (table, dropdown, 1, row, 1, 1);
}

View File

@@ -1,5 +1,5 @@
gen_demo_header = find_program('../build-aux/meson/gen-demo-header.py')
demo_profile = get_option('demo-profile')
demo_profile = get_option('profile')
demo_conf_h = declare_dependency(
sources: custom_target('demo-header',

View File

@@ -201,7 +201,7 @@ node_editor_application_startup (GApplication *app)
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_string (provider, css);
gtk_css_provider_load_from_data (provider, css, -1);
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);

View File

@@ -1190,362 +1190,11 @@ node_editor_window_unrealize (GtkWidget *widget)
GTK_WIDGET_CLASS (node_editor_window_parent_class)->unrealize (widget);
}
typedef struct
{
NodeEditorWindow *self;
GtkTextIter start, end;
} Selection;
static void
color_cb (GObject *source,
GAsyncResult *result,
gpointer data)
{
GtkColorDialog *dialog = GTK_COLOR_DIALOG (source);
Selection *selection = data;
NodeEditorWindow *self = selection->self;
GdkRGBA *color;
char *text;
GError *error = NULL;
GtkTextBuffer *buffer;
color = gtk_color_dialog_choose_rgba_finish (dialog, result, &error);
if (!color)
{
g_print ("%s\n", error->message);
g_error_free (error);
g_free (selection);
return;
}
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self->text_view));
text = gdk_rgba_to_string (color);
gtk_text_buffer_delete (buffer, &selection->start, &selection->end);
gtk_text_buffer_insert (buffer, &selection->start, text, -1);
g_free (text);
gdk_rgba_free (color);
g_free (selection);
}
static void
font_cb (GObject *source,
GAsyncResult *result,
gpointer data)
{
GtkFontDialog *dialog = GTK_FONT_DIALOG (source);
Selection *selection = data;
NodeEditorWindow *self = selection->self;
GError *error = NULL;
PangoFontDescription *desc;
GtkTextBuffer *buffer;
char *text;
desc = gtk_font_dialog_choose_font_finish (dialog, result, &error);
if (!desc)
{
g_print ("%s\n", error->message);
g_error_free (error);
g_free (selection);
return;
}
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self->text_view));
text = pango_font_description_to_string (desc);
gtk_text_buffer_delete (buffer, &selection->start, &selection->end);
gtk_text_buffer_insert (buffer, &selection->start, text, -1);
g_free (text);
pango_font_description_free (desc);
g_free (selection);
}
static void
file_cb (GObject *source,
GAsyncResult *result,
gpointer data)
{
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
Selection *selection = data;
NodeEditorWindow *self = selection->self;
GError *error = NULL;
GFile *file;
GtkTextBuffer *buffer;
char *text;
file = gtk_file_dialog_open_finish (dialog, result, &error);
if (!file)
{
g_print ("%s\n", error->message);
g_error_free (error);
g_free (selection);
return;
}
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self->text_view));
text = g_file_get_uri (file);
gtk_text_buffer_delete (buffer, &selection->start, &selection->end);
gtk_text_buffer_insert (buffer, &selection->start, text, -1);
g_free (text);
g_object_unref (file);
g_free (selection);
}
static void
key_pressed (GtkEventControllerKey *controller,
unsigned int keyval,
unsigned int keycode,
GdkModifierType state,
gpointer data)
{
GtkWidget *dd = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (controller));
Selection *selection = data;
NodeEditorWindow *self = selection->self;
unsigned int selected;
GtkStringList *strings;
GtkTextBuffer *buffer;
const char *text;
if (keyval != GDK_KEY_Escape)
return;
strings = GTK_STRING_LIST (gtk_drop_down_get_model (GTK_DROP_DOWN (dd)));
selected = gtk_drop_down_get_selected (GTK_DROP_DOWN (dd));
text = gtk_string_list_get_string (strings, selected);
gtk_text_view_remove (GTK_TEXT_VIEW (self->text_view), dd);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self->text_view));
gtk_text_iter_backward_search (&selection->start, "mode:", 0, NULL, &selection->start, NULL);
gtk_text_iter_forward_search (&selection->start, ";", 0, &selection->end, NULL, NULL);
gtk_text_buffer_delete (buffer, &selection->start, &selection->end);
gtk_text_buffer_insert (buffer, &selection->start, " ", -1);
gtk_text_buffer_insert (buffer, &selection->start, text, -1);
}
static void
node_editor_window_edit (NodeEditorWindow *self,
GtkTextIter *iter)
{
GtkTextIter start, end;
GtkTextBuffer *buffer;
Selection *selection;
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self->text_view));
gtk_text_iter_set_line_offset (iter, 0);
if (gtk_text_iter_forward_search (iter, ";", 0, &end, NULL, NULL) &&
gtk_text_iter_forward_search (iter, "color:", 0, NULL, &start, &end))
{
GtkColorDialog *dialog;
GdkRGBA color;
char *text;
while (g_unichar_isspace (gtk_text_iter_get_char (&start)))
gtk_text_iter_forward_char (&start);
gtk_text_buffer_select_range (buffer, &start, &end);
text = gtk_text_buffer_get_text (buffer, &start, &end, TRUE);
gdk_rgba_parse (&color, text);
g_free (text);
selection = g_new0 (Selection, 1);
selection->self = self;
selection->start = start;
selection->end = end;
dialog = gtk_color_dialog_new ();
gtk_color_dialog_choose_rgba (dialog, GTK_WINDOW (self), &color, NULL, color_cb, selection);
}
else if (gtk_text_iter_forward_search (iter, ";", 0, &end, NULL, NULL) &&
gtk_text_iter_forward_search (iter, "font:", 0, NULL, &start, &end))
{
GtkFontDialog *dialog;
PangoFontDescription *desc;
char *text;
while (g_unichar_isspace (gtk_text_iter_get_char (&start)))
gtk_text_iter_forward_char (&start);
/* Skip the quotes */
gtk_text_iter_forward_char (&start);
gtk_text_iter_backward_char (&end);
gtk_text_buffer_select_range (buffer, &start, &end);
text = gtk_text_buffer_get_text (buffer, &start, &end, TRUE);
desc = pango_font_description_from_string (text);
g_free (text);
selection = g_new0 (Selection, 1);
selection->self = self;
selection->start = start;
selection->end = end;
dialog = gtk_font_dialog_new ();
gtk_font_dialog_choose_font (dialog, GTK_WINDOW (self), desc, NULL, font_cb, selection);
pango_font_description_free (desc);
}
else if (gtk_text_iter_forward_search (iter, ";", 0, &end, NULL, NULL) &&
gtk_text_iter_forward_search (iter, "mode:", 0, NULL, &start, &end))
{
/* Assume we have a blend node, for now */
GEnumClass *class;
GtkStringList *strings;
GtkWidget *dd;
GtkTextChildAnchor *anchor;
unsigned int selected = 0;
GtkEventController *key_controller;
gboolean is_blend_mode = FALSE;
char *text;
while (g_unichar_isspace (gtk_text_iter_get_char (&start)))
gtk_text_iter_forward_char (&start);
text = gtk_text_buffer_get_text (buffer, &start, &end, TRUE);
strings = gtk_string_list_new (NULL);
class = g_type_class_ref (GSK_TYPE_BLEND_MODE);
for (unsigned int i = 0; i < class->n_values; i++)
{
if (strcmp (class->values[i].value_nick, text) == 0)
is_blend_mode = TRUE;
}
g_type_class_unref (class);
if (is_blend_mode)
class = g_type_class_ref (GSK_TYPE_BLEND_MODE);
else
class = g_type_class_ref (GSK_TYPE_MASK_MODE);
for (unsigned int i = 0; i < class->n_values; i++)
{
if (i == 0 && is_blend_mode)
gtk_string_list_append (strings, "normal");
else
gtk_string_list_append (strings, class->values[i].value_nick);
if (strcmp (class->values[i].value_nick, text) == 0)
selected = i;
}
g_type_class_unref (class);
gtk_text_buffer_delete (buffer, &start, &end);
anchor = gtk_text_buffer_create_child_anchor (buffer, &start);
dd = gtk_drop_down_new (G_LIST_MODEL (strings), NULL);
gtk_drop_down_set_selected (GTK_DROP_DOWN (dd), selected);
gtk_text_view_add_child_at_anchor (GTK_TEXT_VIEW (self->text_view), dd, anchor);
selection = g_new0 (Selection, 1);
selection->self = self;
selection->start = start;
selection->end = end;
key_controller = gtk_event_controller_key_new ();
g_signal_connect (key_controller, "key-pressed", G_CALLBACK (key_pressed), selection);
gtk_widget_add_controller (dd, key_controller);
}
else if (gtk_text_iter_forward_search (iter, ";", 0, &end, NULL, NULL) &&
gtk_text_iter_forward_search (iter, "texture:", 0, NULL, &start, &end))
{
GtkFileDialog *dialog;
GtkTextIter skip;
char *text;
GFile *file;
while (g_unichar_isspace (gtk_text_iter_get_char (&start)))
gtk_text_iter_forward_char (&start);
skip = start;
gtk_text_iter_forward_chars (&skip, strlen ("url(\""));
text = gtk_text_iter_get_text (&start, &skip);
if (strcmp (text, "url(\"") != 0)
{
g_free (text);
return;
}
g_free (text);
start = skip;
skip = end;
gtk_text_iter_backward_chars (&skip, strlen ("\")"));
text = gtk_text_iter_get_text (&skip, &end);
if (strcmp (text, "\")") != 0)
{
g_free (text);
return;
}
g_free (text);
end = skip;
gtk_text_buffer_select_range (buffer, &start, &end);
text = gtk_text_buffer_get_text (buffer, &start, &end, TRUE);
file = g_file_new_for_uri (text);
g_free (text);
selection = g_new0 (Selection, 1);
selection->self = self;
selection->start = start;
selection->end = end;
dialog = gtk_file_dialog_new ();
gtk_file_dialog_set_initial_file (dialog, file);
gtk_file_dialog_open (dialog, GTK_WINDOW (self), NULL, file_cb, selection);
g_object_unref (file);
}
}
static void
click_gesture_pressed (GtkGestureClick *gesture,
int n_press,
double x,
double y,
NodeEditorWindow *self)
{
GtkTextIter iter;
int bx, by, trailing;
GdkModifierType state;
state = gtk_event_controller_get_current_event_state (GTK_EVENT_CONTROLLER (gesture));
if ((state & GDK_CONTROL_MASK) == 0)
return;
gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (self->text_view), GTK_TEXT_WINDOW_TEXT, x, y, &bx, &by);
gtk_text_view_get_iter_at_position (GTK_TEXT_VIEW (self->text_view), &iter, &trailing, bx, by);
node_editor_window_edit (self, &iter);
}
static void
edit_action_cb (GtkWidget *widget,
const char *action_name,
GVariant *parameter)
{
NodeEditorWindow *self = NODE_EDITOR_WINDOW (widget);
GtkTextBuffer *buffer;
GtkTextIter start, end;
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self->text_view));
gtk_text_buffer_get_selection_bounds (buffer, &start, &end);
node_editor_window_edit (self, &start);
}
static void
node_editor_window_class_init (NodeEditorWindowClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
GtkShortcutTrigger *trigger;
GtkShortcutAction *action;
GtkShortcut *shortcut;
object_class->dispose = node_editor_window_dispose;
object_class->finalize = node_editor_window_finalize;
@@ -1576,14 +1225,6 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
gtk_widget_class_bind_template_callback (widget_class, dark_mode_cb);
gtk_widget_class_bind_template_callback (widget_class, on_picture_drag_prepare_cb);
gtk_widget_class_bind_template_callback (widget_class, on_picture_drop_cb);
gtk_widget_class_bind_template_callback (widget_class, click_gesture_pressed);
gtk_widget_class_install_action (widget_class, "smart-edit", NULL, edit_action_cb);
trigger = gtk_keyval_trigger_new (GDK_KEY_e, GDK_CONTROL_MASK);
action = gtk_named_action_new ("smart-edit");
shortcut = gtk_shortcut_new (trigger, action);
gtk_widget_class_add_shortcut (widget_class, shortcut);
}
static GtkWidget *
@@ -1701,13 +1342,6 @@ node_editor_window_init (NodeEditorWindow *self)
" }\n"
" transform: translate(0, 140);\n"
"}", -1);
if (g_getenv ("GSK_RENDERER"))
{
char *new_title = g_strdup_printf ("GTK Node Editor - %s", g_getenv ("GSK_RENDERER"));
gtk_window_set_title (GTK_WINDOW (self), new_title);
g_free (new_title);
}
}
NodeEditorWindow *

View File

@@ -16,14 +16,6 @@
</item>
</section>
</menu>
<menu id="extra_menu">
<section>
<item>
<attribute name="label" translatable="yes">Assisted _Edit</attribute>
<attribute name="action">smart-edit</attribute>
</item>
</section>
</menu>
<object class="GtkPopover" id="testcase_popover">
<child>
@@ -203,17 +195,10 @@
<property name="right-margin">6</property>
<property name="bottom-margin">6</property>
<property name="has-tooltip">1</property>
<property name="extra-menu">extra_menu</property>
<signal name="query-tooltip" handler="text_view_query_tooltip_cb"/>
<style>
<class name="editor" />
</style>
<child>
<object class="GtkGestureClick">
<property name="button">1</property>
<signal name="pressed" handler="click_gesture_pressed"/>
</object>
</child>
</object>
</child>
</object>

View File

@@ -193,7 +193,7 @@ Creates a node like `gsk_linear_gradient_node_new()` with the given properties.
| property | syntax | default | printed |
| -------- | ---------------- | ---------------------- | ----------- |
| source | `<node>` | color { } | always |
| mode | `<mask-mode>` | alpha | non-default |
| mode | `<blend-mode>` | alpha | non-default |
| mask | `<node>` | color { } | always |
Creates a node like `gsk_mask_node_new()` with the given properties.

View File

@@ -1210,12 +1210,12 @@ typedef struct {
static void
add_background (GtkWidget *flowbox,
const char *filename,
GdkTexture *texture,
GdkPixbuf *pixbuf,
gboolean is_resource)
{
GtkWidget *child;
child = gtk_picture_new_for_paintable (GDK_PAINTABLE (texture));
child = gtk_picture_new_for_pixbuf (pixbuf);
gtk_widget_set_size_request (child, 110, 70);
gtk_flow_box_insert (GTK_FLOW_BOX (flowbox), child, -1);
child = gtk_widget_get_parent (child);
@@ -1231,7 +1231,6 @@ background_loaded_cb (GObject *source,
{
BackgroundData *bd = data;
GdkPixbuf *pixbuf;
GdkTexture *texture;
GError *error = NULL;
pixbuf = gdk_pixbuf_new_from_stream_finish (res, &error);
@@ -1242,11 +1241,8 @@ background_loaded_cb (GObject *source,
return;
}
texture = gdk_texture_new_for_pixbuf (pixbuf);
add_background (bd->flowbox, bd->filename, texture, FALSE);
add_background (bd->flowbox, bd->filename, pixbuf, FALSE);
g_object_unref (texture);
g_object_unref (pixbuf);
g_free (bd->filename);
g_free (bd);
}
@@ -1263,10 +1259,7 @@ populate_flowbox (GtkWidget *flowbox)
GInputStream *stream;
BackgroundData *bd;
GdkPixbuf *pixbuf;
GdkTexture *texture;
GtkWidget *child;
guchar *data;
GBytes *bytes;
int i;
const char *resources[] = {
"sunset.jpg", "portland-rose.jpg", "beach.jpg", "nyc.jpg"
@@ -1277,14 +1270,9 @@ populate_flowbox (GtkWidget *flowbox)
g_object_set_data (G_OBJECT (flowbox), "populated", GUINT_TO_POINTER (1));
data = g_malloc (4 * 110 * 70);
memset (data, 0xff, 4 * 110 * 70);
bytes = g_bytes_new_take (data, 4 * 110 * 70);
texture = gdk_memory_texture_new (110, 70, GDK_MEMORY_DEFAULT, bytes, 4 * 110);
child = gtk_picture_new_for_paintable (GDK_PAINTABLE (texture));
g_object_unref (texture);
g_bytes_unref (bytes);
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 110, 70);
gdk_pixbuf_fill (pixbuf, 0xffffffff);
child = gtk_picture_new_for_pixbuf (pixbuf);
gtk_widget_add_css_class (child, "frame");
gtk_flow_box_insert (GTK_FLOW_BOX (flowbox), child, -1);
@@ -1292,10 +1280,7 @@ populate_flowbox (GtkWidget *flowbox)
{
filename = g_strconcat ("/org/gtk/WidgetFactory4/", resources[i], NULL);
pixbuf = gdk_pixbuf_new_from_resource_at_scale (filename, 110, 110, TRUE, NULL);
texture = gdk_texture_new_for_pixbuf (pixbuf);
add_background (flowbox, filename, texture, TRUE);
g_object_unref (texture);
g_object_unref (pixbuf);
add_background (flowbox, filename, pixbuf, TRUE);
}
location = "/usr/share/backgrounds/gnome";

View File

@@ -2244,24 +2244,20 @@ microphone-sensitivity-medium-symbolic</property>
<child>
<object class="GtkBox">
<property name="spacing">6</property>
<property name="valign">center</property>
<child>
<object class="GtkBox" id="lockbox">
<property name="hexpand">1</property>
<property name="spacing">6</property>
<property name="valign">center</property>
<child>
<object class="GtkMenuButton" id="open_menubutton">
<property name="halign">3</property>
<property name="popover">open_popover</property>
<property name="label">Open</property>
<property name="valign">center</property>
</object>
</child>
<child>
<object class="GtkToggleButton" id="record_button">
<property name="halign">3</property>
<property name="valign">center</property>
<signal name="toggled" handler="on_record_button_toggled"/>
<style>
<class name="text-button"/>
@@ -2271,19 +2267,16 @@ microphone-sensitivity-medium-symbolic</property>
<child>
<object class="GtkBox">
<property name="spacing">6</property>
<property name="valign">center</property>
<child>
<object class="GtkImage">
<property name="valign">4</property>
<property name="icon-name">media-record-symbolic</property>
<property name="valign">center</property>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="valign">4</property>
<property name="label">Record</property>
<property name="valign">center</property>
</object>
</child>
</object>
@@ -2292,7 +2285,6 @@ microphone-sensitivity-medium-symbolic</property>
</child>
<child>
<object class="GtkBox">
<property name="valign">center</property>
<style>
<class name="linked"/>
</style>
@@ -2300,14 +2292,12 @@ microphone-sensitivity-medium-symbolic</property>
<object class="GtkToggleButton" id="grid_button">
<property name="active">1</property>
<property name="icon-name">view-grid-symbolic</property>
<property name="valign">center</property>
</object>
</child>
<child>
<object class="GtkToggleButton" id="list_button">
<property name="group">grid_button</property>
<property name="icon-name">view-list-symbolic</property>
<property name="valign">center</property>
</object>
</child>
</object>
@@ -2315,7 +2305,6 @@ microphone-sensitivity-medium-symbolic</property>
<child>
<object class="GtkButton" id="circular_button">
<property name="icon-name">emblem-system-symbolic</property>
<property name="valign">center</property>
<style>
<class name="circular"/>
</style>
@@ -2324,15 +2313,12 @@ microphone-sensitivity-medium-symbolic</property>
</object>
</child>
<child>
<object class="GtkLockButton" id="lockbutton">
<property name="valign">center</property>
</object>
<object class="GtkLockButton" id="lockbutton"/>
</child>
<child>
<object class="GtkMenuButton">
<property name="icon-name">view-more-symbolic</property>
<property name="menu-model">new_style_menu_model</property>
<property name="valign">center</property>
</object>
</child>
</object>

View File

@@ -220,6 +220,6 @@ clipboard.cut, clipboard.copy, clipboard.paste
selection.delete, selection.select-all
: Selection operations on entries, text view and labels
color.select, color.customize
color.select, color.customize:
: Operate on colors in a `GtkColorChooserWidget`. These actions are
unusual in that they have the non-trivial parameter type (dddd).
unusual in that they have the non-trivial parameter type (dddd):

View File

@@ -288,7 +288,7 @@ support.
If you want to run the testsuite to ensure that your GTK build
works, you should enable it with this option.
### `build-tests`, `build-examples`, `build-demos`
### `build-tests`, `build-examples`, `demos`
By default, GTK will build quite a few tests, examples and demos.
While these are useful on a developer system, they are not

View File

@@ -23,7 +23,7 @@ When it comes to rendering, GTK follows the CSS box model as far as practical.
The CSS stylesheet that is in use determines the sizes (and appearance) of the
margin, border and padding areas for each widget. The size of the content area
is determined by GTKs layout algorithm using each widgets [vfunc@Gtk.Widget.measure]
is determined by GTKs layout algorithm using each widgets [vfunc@Gtk.Widget.measure]
and [vfunc@Gtk.Widget.size_allocate] vfuncs.
You can learn more about the CSS box model by reading the
@@ -37,11 +37,11 @@ To learn more about where GTK CSS differs from CSS on the web, see the
The content area in the CSS box model is the region that the widget considers its own.
The origin of the widgets coordinate system is the top left corner of the content area,
and its size is the widgets size. The size can be queried with [method@Gtk.Widget.get_width]
The origin of the widgets coordinate system is the top left corner of the content area,
and its size is the widgets size. The size can be queried with [method@Gtk.Widget.get_width]
and [method@Gtk.Widget.get_height]. GTK allows general 3D transformations to position
widgets (although most of the time, the transformation will be a simple 2D translation).
The transform to go from one widgets coordinate system to another one can be obtained
The transform to go from one widgets coordinate system to another one can be obtained
with [method@Gtk.Widget.compute_transform].
In addition to a size, widgets can optionally have a **_baseline_** to position text on.
@@ -55,8 +55,8 @@ or [method@Gtk.Widget.compute_bounds]. These methods can fail (either because th
don't share a common ancestor, or because of a singular transformation), and callers need
to handle this eventuality.
Another area that is occasionally relevant are the widgets **_bounds_**, which is the area
that a widgets rendering is typically confined to (technically, widgets can draw outside
Another area that is occasionally relevant are the widgets **_bounds_**, which is the area
that a widgets rendering is typically confined to (technically, widgets can draw outside
of this area, unless clipping is enforced via the [property@Gtk.Widget:overflow] property).
In CSS terms, the bounds of a widget correspond to the border area.

View File

@@ -68,7 +68,7 @@ in a selector, widget names must be prefixed with a &num; character.
| E:focus-within | [CSS Selector Level 4](https://drafts.csswg.org/selectors/#focus-within-pseudo) | Set on all ancestors of the focus widget, unlike CSS |
| E:focus-visible | [CSS Selector Level 4](https://drafts.csswg.org/selectors/#focus-within-pseudo) | Set on focus widget and all ancestors, unlike CSS |
| E:disabled | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#UIstates) | Corresponds to GTK_STATE_FLAG_INSENSITIVE |
| E:checked | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#UIstates) | Corresponds to GTK_STATE_FLAG_CHECKED |
| E:disabled | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#UIstates) | Corresponds to GTK_STATE_FLAG_CHECKED |
| E:indeterminate | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#indeterminate) | Corresponds to GTK_STATE_FLAG_INCONSISTENT |
| E:backdrop, E:selected | | Corresponds to GTK_STATE_FLAG_BACKDROP, GTK_STATE_FLAG_SELECTED |
| E:not(selector) | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#negation) | |

View File

@@ -103,15 +103,14 @@ fields, but e.g. buttons can take the focus too.
Input widgets can be given the focus by clicking on them, but focus
can also be moved around with certain key events (this is known as
“keyboard navigation”).
GTK reserves the <kbd>Tab</kbd> key to move the focus to the next location,
and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move it back to the previous one.
In addition many containers allow “directional navigation” with the arrow keys.
“keyboard navigation”). GTK reserves the <kbd>Tab</kbd> key to move the focus
to the next location, and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move it back to the previous
one. In addition many containers allow “directional navigation” with
the arrow keys.
Many widgets can be “activated” to trigger and action.
E.g., you can activate a button or switch by clicking on them,
but you can also activate them with the keyboard,
by using the <kbd>Enter</kbd> or <kbd>Space</kbd> keys.
Many widgets can be “activated” to trigger and action. E.g., you can
activate a button or switch by clicking on them, but you can also
activate them with the keyboard, by using the <kbd>Enter</kbd> or <kbd></kbd> keys.
Apart from keyboard navigation, activation and directly typing into
entries or text views, GTK widgets can use key events for activating
@@ -122,17 +121,15 @@ GTK has traditionally supported different kinds of shortcuts:
- Accelerators are any other shortcuts that can be activated regardless
of where the focus is, and typically trigger global actions, such as
<kbd>Ctrl</kbd>+<kbd>Q</kbd> to quit an application.
- Mnemonics are usually triggered using <kbd>Alt</kbd>
as a modifier for a letter.
Ctrl-Q to quit an application.
- Mnemonics are usually triggered using Alt as a modifier for a letter.
They are used in places where a label is associated with a control,
and are indicated by underlining the letter in the label. As a special
case, inside menus (i.e. inside `GtkPopoverMenu`), mnemonics can be
triggered without the modifier.
- Key bindings are specific to individual widgets,
such as <kbd>Ctrl</kbd>+<kbd>C</kbd> or <kbd>Ctrl</kbd>+<kbd>V</kbd>
in an entry copy to or paste from the clipboard.
They are only triggered when the widget has focus.
- Key bindings are specific to individual widgets, such as Ctrl-C or
Ctrl-V in an entry copy to or paste from the clipboard. They are only
triggered when the widget has focus.
GTK handles accelerators and mnemonics in a global scope, during the
capture phase, and key bindings locally, during the target phase.
@@ -211,4 +208,4 @@ sequence, so setting the state on one does transfer the state to
the others. They also are mutually exclusive, within a widget
where may be only one gesture group claiming a given sequence.
If another gesture group claims later that same sequence, the
first group will deny the sequence.
first group will deny the sequence:

View File

@@ -133,9 +133,3 @@ The function gtk_widget_get_allocation() is also going away. It does not have a
replacement, but the previously mentioned alternatives can be used for it too.
The function gtk_widget_get_allocated_baseline() has been renamed to [method@Gtk.Widget.get_baseline].
## Stop using GdkPixbuf
GTK is moving away from GdkPixbuf as the primary API for transporting image data, in favor
of GdkTexture. APIs that are accepting or returning GdkPixbufs are being replaced by equivalent
APIs using GdkTexture or GdkPaintable objects.

View File

@@ -208,9 +208,6 @@ A number of options affect behavior instead of logging:
`nograbs`
: Turn off all pointer and keyboard grabs
`portals`
: Force the use of [portals](https://docs.flatpak.org/en/latest/portals.html)
`gl-disable`
: Disable OpenGL support

View File

@@ -204,17 +204,19 @@ you should ensure that:
readable and localised action performed when pressed; for instance "Copy",
"Paste", "Add layer", or "Remove"
GTK will try to fill in some information by using ancillary UI control properties,
for instance the accessible name will be taken from the label used by the UI control,
or from its tooltip, if the `GTK_ACCESSIBLE_PROPERTY_LABEL` property or the
`GTK_ACCESSIBLE_RELATION_LABELLED_BY` relation are unset. Similary for the accessible
description. Nevertheless, it is good practice and project hygiene to explicitly specify
the accessible properties, just like it's good practice to specify tooltips and style classes.
GTK will try to fill in some information by using ancillary UI control
properties, for instance the accessible label will be taken from the label or
placeholder text used by the UI control, or from its tooltip, if the
`GTK_ACCESSIBLE_PROPERTY_LABEL` property or the `GTK_ACCESSIBLE_RELATION_LABELLED_BY`
relation are unset. Nevertheless, it is good practice and project hygiene
to explicitly specify the accessible properties, just like it's good practice
to specify tooltips and style classes.
Application developers using GTK **should** ensure that their UI controls
are accessible as part of the development process. The GTK Inspector shows
the accessible attributes of each widget, and also provides an overlay that
can highlight accessibility issues.
are accessible as part of the development process. When using `GtkBuilder`
templates and UI definition files, GTK provides a validation tool that
verifies that each UI element has a valid role and properties; this tool can
be used as part of the application's test suite to avoid regressions.
## Implementations

View File

@@ -196,15 +196,6 @@ The _data table_ style of list is a high density table, similar in style to a
traditional treeview. Individual cells can be selectable and editable. Use
the `.data-table` style class.
## Sections
List models can optionally group their items into **_sections_**, by implementing
the `GtkSectionModel` interface. Both `GtkListView` and `GtkGridView` can
display headers for sections, by installing a separate **_header factory_**.
Many GTK list models support section inherently, or they pass through the
section of a model they are wrapping.
## Comparison to GtkTreeView
Developers familiar with `GtkTreeView` may wonder how this way of doing lists

View File

@@ -1,7 +0,0 @@
A trivial example
=================
This is a very minimal example of an app that can be built against GTK.
We use this in CI to test that building against the installed GTK works.
That is why there is a standalone meson.build in this subdirectory.

View File

@@ -57,7 +57,7 @@ window_paste (GSimpleAction *action,
{
GtkWindow *window = GTK_WINDOW (user_data);
GtkTextView *text = g_object_get_data ((GObject*)window, "plugman-text");
gtk_text_buffer_paste_clipboard (gtk_text_view_get_buffer (text),
gtk_widget_get_clipboard (GTK_WIDGET (text)),
NULL,
@@ -221,7 +221,7 @@ plugin_action (GAction *action,
g_message ("Color: %s", g_action_get_name (action));
css_provider = gtk_css_provider_new ();
gtk_css_provider_load_from_string (css_provider, css_to_load);
gtk_css_provider_load_from_data (css_provider, css_to_load, -1);
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (css_provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);

View File

@@ -1,7 +0,0 @@
gdk_deprecated_sources = files([
'gdkpixbuf.c',
])
gdk_deprecated_headers = files([
'gdkpixbuf.h',
])

View File

@@ -24,7 +24,7 @@
#include "config.h"
#include "version/gdkversionmacros.h"
#include "gdkversionmacros.h"
#include "gdkresources.h"
@@ -132,7 +132,6 @@ static const GdkDebugKey gdk_debug_keys[] = {
{ "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer", TRUE },
{ "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings", TRUE },
{ "high-depth", GDK_DEBUG_HIGH_DEPTH, "Use high bit depth rendering if possible", TRUE },
{ "no-vsync", GDK_DEBUG_NO_VSYNC, "Repaint instantly (uses 100% CPU with animations)", TRUE },
};

View File

@@ -61,7 +61,7 @@
#include <gdk/gdkmonitor.h>
#include <gdk/gdkpaintable.h>
#include <gdk/gdkpango.h>
#include <gdk/deprecated/gdkpixbuf.h>
#include <gdk/gdkpixbuf.h>
#include <gdk/gdkpopup.h>
#include <gdk/gdkpopuplayout.h>
#include <gdk/gdkrectangle.h>
@@ -75,7 +75,7 @@
#include <gdk/gdktoplevellayout.h>
#include <gdk/gdktoplevelsize.h>
#include <gdk/gdktypes.h>
#include <gdk/version/gdkversionmacros.h>
#include <gdk/gdkversionmacros.h>
#include <gdk/gdkvulkancontext.h>
#undef __GDK_H_INSIDE__

View File

@@ -24,6 +24,7 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@@ -1,5 +1,5 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2005 Red Hat, Inc.
* Copyright (C) 2005 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -17,10 +17,7 @@
#include "config.h"
#include "gdkcairo.h"
#include "gdkrgba.h"
#include "gdktexture.h"
#include "gdkcairoprivate.h"
#include <math.h>
@@ -90,7 +87,7 @@ gdk_cairo_region (cairo_t *cr,
}
}
static void
void
gdk_cairo_surface_paint_pixbuf (cairo_surface_t *surface,
const GdkPixbuf *pixbuf)
{
@@ -171,7 +168,7 @@ gdk_cairo_set_source_pixbuf (cairo_t *cr,
*
* Returns: %TRUE if the extents fit in a `GdkRectangle`, %FALSE if not
*/
static gboolean
gboolean
_gdk_cairo_surface_extents (cairo_surface_t *surface,
GdkRectangle *extents)
{
@@ -303,3 +300,38 @@ gdk_cairo_region_create_from_surface (cairo_surface_t *surface)
return region;
}
cairo_region_t *
gdk_cairo_region_from_clip (cairo_t *cr)
{
cairo_rectangle_list_t *rectangles;
cairo_region_t *region;
int i;
rectangles = cairo_copy_clip_rectangle_list (cr);
if (rectangles->status != CAIRO_STATUS_SUCCESS)
return NULL;
region = cairo_region_create ();
for (i = 0; i < rectangles->num_rectangles; i++)
{
cairo_rectangle_int_t clip_rect;
cairo_rectangle_t *rect;
rect = &rectangles->rectangles[i];
/* Here we assume clip rects are ints for direct targets, which
is true for cairo */
clip_rect.x = (int)rect->x;
clip_rect.y = (int)rect->y;
clip_rect.width = (int)rect->width;
clip_rect.height = (int)rect->height;
cairo_region_union_rectangle (region, &clip_rect);
}
cairo_rectangle_list_destroy (rectangles);
return region;
}

View File

@@ -1,5 +1,5 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2005 Red Hat, Inc.
* Copyright (C) 2005 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -21,8 +21,9 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdktypes.h>
#include <gdk/deprecated/gdkpixbuf.h>
#include <gdk/gdkversionmacros.h>
#include <gdk/gdkrgba.h>
#include <gdk/gdkpixbuf.h>
#include <pango/pangocairo.h>
G_BEGIN_DECLS

View File

@@ -24,8 +24,11 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
#include <cairo.h>
G_BEGIN_DECLS
#define GDK_TYPE_CAIRO_CONTEXT (gdk_cairo_context_get_type ())

View File

@@ -1,10 +1,10 @@
/*
* Copyright © 2023 Red Hat, Inc.
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2020 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* 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
@@ -13,20 +13,25 @@
*
* 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/>.
*
* Authors: Matthias Clasen <mclasen@redhat.com>
*/
#pragma once
#include "inspectoroverlay.h"
#include "gdkcairo.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <cairo.h>
G_BEGIN_DECLS
#define GTK_TYPE_A11Y_OVERLAY (gtk_a11y_overlay_get_type ())
G_DECLARE_FINAL_TYPE (GtkA11yOverlay, gtk_a11y_overlay, GTK, A11Y_OVERLAY, GtkInspectorOverlay)
gboolean _gdk_cairo_surface_extents (cairo_surface_t *surface,
GdkRectangle *extents);
void gdk_cairo_surface_paint_pixbuf (cairo_surface_t *surface,
const GdkPixbuf *pixbuf);
cairo_region_t *gdk_cairo_region_from_clip (cairo_t *cr);
GtkInspectorOverlay * gtk_a11y_overlay_new (void);
G_END_DECLS

View File

@@ -22,7 +22,10 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
#include <gio/gio.h>
G_BEGIN_DECLS

View File

@@ -21,6 +21,8 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@@ -645,9 +645,6 @@ gdk_content_formats_builder_clear (GdkContentFormatsBuilder *builder)
{
g_clear_pointer (&builder->gtypes, g_slist_free);
g_clear_pointer (&builder->mime_types, g_slist_free);
builder->n_gtypes = 0;
builder->n_mime_types = 0;
}
/**

View File

@@ -21,6 +21,8 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@@ -22,8 +22,10 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS
#define GDK_TYPE_CONTENT_PROVIDER (gdk_content_provider_get_type ())

View File

@@ -22,6 +22,7 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@@ -22,7 +22,7 @@
#include "gdkcontentserializer.h"
#include "gdkcontentformats.h"
#include "deprecated/gdkpixbuf.h"
#include "gdkpixbuf.h"
#include "filetransferportalprivate.h"
#include "gdktextureprivate.h"
#include "gdkrgba.h"
@@ -642,9 +642,7 @@ pixbuf_serializer (GdkContentSerializer *serializer)
else if (G_VALUE_HOLDS (value, GDK_TYPE_TEXTURE))
{
GdkTexture *texture = g_value_get_object (value);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
pixbuf = gdk_pixbuf_get_from_texture (texture);
G_GNUC_END_IGNORE_DEPRECATIONS
}
else
{

View File

@@ -21,6 +21,8 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@@ -28,6 +28,7 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@@ -52,7 +52,6 @@ typedef enum {
GDK_DEBUG_VULKAN_VALIDATE = 1 << 23,
GDK_DEBUG_DEFAULT_SETTINGS= 1 << 24,
GDK_DEBUG_HIGH_DEPTH = 1 << 25,
GDK_DEBUG_NO_VSYNC = 1 << 26,
} GdkDebugFlags;
extern guint _gdk_debug_flags;

View File

@@ -21,10 +21,12 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkdevicetool.h>
#include <gdk/gdkenums.h>
G_BEGIN_DECLS
#define GDK_TYPE_DEVICE (gdk_device_get_type ())

View File

@@ -23,6 +23,7 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@@ -21,7 +21,10 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkenums.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@@ -1,7 +1,7 @@
/* GDK - The GIMP Drawing Kit
* gdkdisplay.c
*
* Copyright 2001 Sun Microsystems Inc.
*
* Copyright 2001 Sun Microsystems Inc.
*
* Erwann Chenede <erwann.chenede@sun.com>
*
@@ -31,11 +31,10 @@
#include "gdkclipboardprivate.h"
#include "gdkdeviceprivate.h"
#include "gdkdisplaymanagerprivate.h"
#include "gdkeventsprivate.h"
#include "gdkframeclockidleprivate.h"
#include "gdkeventsprivate.h"
#include "gdkglcontextprivate.h"
#include "gdkmonitorprivate.h"
#include "gdkrectangle.h"
#ifdef HAVE_EGL
#include <epoxy/egl.h>
@@ -176,7 +175,7 @@ gdk_display_default_rate_egl_config (GdkDisplay *display,
return distance;
}
static GdkSeat *
gdk_display_real_get_default_seat (GdkDisplay *display)
{
@@ -383,9 +382,6 @@ gdk_display_dispose (GObject *object)
#endif
g_clear_error (&priv->gl_error);
for (GList *l = display->seats; l; l = l->next)
g_object_run_dispose (G_OBJECT (l->data));
G_OBJECT_CLASS (gdk_display_parent_class)->dispose (object);
}
@@ -422,10 +418,10 @@ gdk_display_close (GdkDisplay *display)
if (!display->closed)
{
display->closed = TRUE;
g_signal_emit (display, signals[CLOSED], 0, FALSE);
g_object_run_dispose (G_OBJECT (display));
g_object_unref (display);
}
}
@@ -812,7 +808,7 @@ _gdk_display_end_device_grab (GdkDisplay *display,
grab->implicit_ungrab = implicit;
return l->next == NULL;
}
return FALSE;
}
@@ -1272,7 +1268,7 @@ gdk_display_init_gl (GdkDisplay *self)
* Note that even if this function succeeds, creating a `GdkGLContext`
* may still fail.
*
* This function is idempotent. Calling it multiple times will just
* This function is idempotent. Calling it multiple times will just
* return the same value or error.
*
* You never need to call this function, GDK will call it automatically

View File

@@ -25,6 +25,7 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkevents.h>
#include <gdk/gdkseat.h>

View File

@@ -28,9 +28,10 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdktypes.h>
#include <gdk/gdkdevice.h>
#include <gdk/gdkenums.h>
#include <gdk/gdkevents.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@@ -23,6 +23,7 @@
#endif
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@@ -371,12 +371,6 @@ gdk_draw_context_begin_frame_full (GdkDrawContext *context,
priv->surface->paint_context = g_object_ref (context);
GDK_DRAW_CONTEXT_GET_CLASS (context)->begin_frame (context, prefers_high_depth, priv->frame_region);
cairo_region_intersect_rectangle (priv->frame_region,
&(cairo_rectangle_int_t) {
0, 0,
priv->surface->width, priv->surface->height
});
}
#ifdef HAVE_SYSPROF

View File

@@ -24,6 +24,7 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@@ -24,7 +24,9 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkenums.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@@ -30,8 +30,6 @@
#include <glib.h>
#include <gdk/version/gdkversionmacros.h>
G_BEGIN_DECLS
/**
@@ -308,20 +306,6 @@ typedef enum
* the alpha value. Since: 4.6
* @GDK_MEMORY_R32G32B32A32_FLOAT: 4 float values; for red, green, blue and
* alpha. Since: 4.6
* @GDK_MEMORY_G8A8_PREMULTIPLIED: 2 bytes; for grayscale, alpha. The color
* values are premultiplied with the alpha value. Since: 4.12
* @GDK_MEMORY_G8A8: 2 bytes; for grayscale, alpha. Since: 4.12
* @GDK_MEMORY_G8: One byte; for grayscale. The data is opaque.
* Since: 4.12
* @GDK_MEMORY_G16A16_PREMULTIPLIED: 2 guint16 values; for grayscale, alpha.
* The color values are premultiplied with the alpha value. Since: 4.12
* @GDK_MEMORY_G16A16: 2 guint16 values; for grayscale, alpha. Since: 4.12
* @GDK_MEMORY_G16: One guint16 value; for grayscale. The data is opaque.
* Since: 4.12
* @GDK_MEMORY_A8: One byte; for alpha.
* Since: 4.12
* @GDK_MEMORY_A16: One guint16 value; for alpha.
* Since: 4.12
* @GDK_MEMORY_N_FORMATS: The number of formats. This value will change as
* more formats get added, so do not rely on its concrete integer.
*
@@ -356,16 +340,9 @@ typedef enum {
GDK_MEMORY_R32G32B32_FLOAT,
GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED,
GDK_MEMORY_R32G32B32A32_FLOAT,
GDK_MEMORY_G8A8_PREMULTIPLIED GDK_AVAILABLE_ENUMERATOR_IN_4_12,
GDK_MEMORY_G8A8 GDK_AVAILABLE_ENUMERATOR_IN_4_12,
GDK_MEMORY_G8 GDK_AVAILABLE_ENUMERATOR_IN_4_12,
GDK_MEMORY_G16A16_PREMULTIPLIED GDK_AVAILABLE_ENUMERATOR_IN_4_12,
GDK_MEMORY_G16A16 GDK_AVAILABLE_ENUMERATOR_IN_4_12,
GDK_MEMORY_G16 GDK_AVAILABLE_ENUMERATOR_IN_4_12,
GDK_MEMORY_A8 GDK_AVAILABLE_ENUMERATOR_IN_4_12,
GDK_MEMORY_A16 GDK_AVAILABLE_ENUMERATOR_IN_4_12,
GDK_MEMORY_N_FORMATS
} GdkMemoryFormat;
G_END_DECLS

View File

@@ -28,10 +28,12 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdktypes.h>
#include <gdk/gdkdevice.h>
#include <gdk/gdkdevicetool.h>
#include <gdk/gdkdrag.h>
#include <gdk/gdkenums.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@@ -79,7 +79,7 @@ static guint signals[LAST_SIGNAL];
static guint fps_counter;
#define FRAME_HISTORY_MAX_LENGTH 128
#define FRAME_HISTORY_MAX_LENGTH 16
struct _GdkFrameClockPrivate
{

View File

@@ -275,80 +275,58 @@ gdk_frame_clock_idle_get_frame_time (GdkFrameClock *clock)
return new_smoothed_time;
}
static inline gboolean
gdk_frame_clock_idle_is_frozen (GdkFrameClockIdle *self)
{
GdkFrameClockIdlePrivate *priv = self->priv;
if (GDK_DEBUG_CHECK (NO_VSYNC))
return FALSE;
return priv->freeze_count > 0;
}
static inline gboolean
should_run_flush_idle (GdkFrameClockIdle *self)
{
GdkFrameClockIdlePrivate *priv = self->priv;
return !gdk_frame_clock_idle_is_frozen (self) &&
(priv->requested & GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS) != 0;
}
#define RUN_FLUSH_IDLE(priv) \
((priv)->freeze_count == 0 && \
((priv)->requested & GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS) != 0)
/* The reason why we track updating_count separately here and don't
* just add GDK_FRAME_CLOCK_PHASE_UPDATE into ->request on every frame
* is so that we can avoid doing one more frame when an animation
* is cancelled.
*/
static inline gboolean
should_run_paint_idle (GdkFrameClockIdle *self)
{
GdkFrameClockIdlePrivate *priv = self->priv;
return !gdk_frame_clock_idle_is_frozen (self) &&
((priv->requested & ~GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS) != 0 ||
priv->updating_count > 0);
}
#define RUN_PAINT_IDLE(priv) \
((priv)->freeze_count == 0 && \
(((priv)->requested & ~GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS) != 0 || \
(priv)->updating_count > 0))
static void
maybe_start_idle (GdkFrameClockIdle *self,
gboolean caused_by_thaw)
maybe_start_idle (GdkFrameClockIdle *clock_idle,
gboolean caused_by_thaw)
{
GdkFrameClockIdlePrivate *priv = self->priv;
GdkFrameClockIdlePrivate *priv = clock_idle->priv;
if (should_run_flush_idle (self) || should_run_paint_idle (self))
if (RUN_FLUSH_IDLE (priv) || RUN_PAINT_IDLE (priv))
{
guint min_interval = 0;
if (priv->min_next_frame_time != 0 &&
!GDK_DEBUG_CHECK (NO_VSYNC))
if (priv->min_next_frame_time != 0)
{
gint64 now = g_get_monotonic_time ();
gint64 min_interval_us = MAX (priv->min_next_frame_time, now) - now;
min_interval = (min_interval_us + 500) / 1000;
}
if (priv->flush_idle_id == 0 && should_run_flush_idle (self))
if (priv->flush_idle_id == 0 && RUN_FLUSH_IDLE (priv))
{
GSource *source;
priv->flush_idle_id = g_timeout_add_full (GDK_PRIORITY_EVENTS + 1,
min_interval,
gdk_frame_clock_flush_idle,
g_object_ref (self),
g_object_ref (clock_idle),
(GDestroyNotify) g_object_unref);
source = g_main_context_find_source_by_id (NULL, priv->flush_idle_id);
g_source_set_static_name (source, "[gtk] gdk_frame_clock_flush_idle");
}
if (!priv->in_paint_idle &&
priv->paint_idle_id == 0 && should_run_paint_idle (self))
priv->paint_idle_id == 0 && RUN_PAINT_IDLE (priv))
{
priv->paint_is_thaw = caused_by_thaw;
priv->paint_idle_id = g_timeout_add_full (GDK_PRIORITY_REDRAW,
min_interval,
gdk_frame_clock_paint_idle,
g_object_ref (self),
g_object_ref (clock_idle),
(GDestroyNotify) g_object_unref);
gdk_source_set_static_name_by_id (priv->paint_idle_id, "[gtk] gdk_frame_clock_paint_idle");
}
@@ -356,17 +334,17 @@ maybe_start_idle (GdkFrameClockIdle *self,
}
static void
maybe_stop_idle (GdkFrameClockIdle *self)
maybe_stop_idle (GdkFrameClockIdle *clock_idle)
{
GdkFrameClockIdlePrivate *priv = self->priv;
GdkFrameClockIdlePrivate *priv = clock_idle->priv;
if (priv->flush_idle_id != 0 && !should_run_flush_idle (self))
if (priv->flush_idle_id != 0 && !RUN_FLUSH_IDLE (priv))
{
g_source_remove (priv->flush_idle_id);
priv->flush_idle_id = 0;
}
if (priv->paint_idle_id != 0 && !should_run_paint_idle (self))
if (priv->paint_idle_id != 0 && !RUN_PAINT_IDLE (priv))
{
g_source_remove (priv->paint_idle_id);
priv->paint_idle_id = 0;
@@ -454,7 +432,7 @@ gdk_frame_clock_paint_idle (void *data)
break;
case GDK_FRAME_CLOCK_PHASE_NONE:
case GDK_FRAME_CLOCK_PHASE_BEFORE_PAINT:
if (!gdk_frame_clock_idle_is_frozen (clock_idle))
if (priv->freeze_count == 0)
{
gint64 frame_interval = FRAME_INTERVAL;
GdkFrameTimings *prev_timings = gdk_frame_clock_get_current_timings (clock);
@@ -570,7 +548,7 @@ gdk_frame_clock_paint_idle (void *data)
G_GNUC_FALLTHROUGH;
case GDK_FRAME_CLOCK_PHASE_UPDATE:
if (!gdk_frame_clock_idle_is_frozen (clock_idle))
if (priv->freeze_count == 0)
{
if ((priv->requested & GDK_FRAME_CLOCK_PHASE_UPDATE) != 0 ||
priv->updating_count > 0)
@@ -582,7 +560,7 @@ gdk_frame_clock_paint_idle (void *data)
G_GNUC_FALLTHROUGH;
case GDK_FRAME_CLOCK_PHASE_LAYOUT:
if (!gdk_frame_clock_idle_is_frozen (clock_idle))
if (priv->freeze_count == 0)
{
int iter;
#ifdef G_ENABLE_DEBUG
@@ -602,8 +580,7 @@ gdk_frame_clock_paint_idle (void *data)
*/
iter = 0;
while ((priv->requested & GDK_FRAME_CLOCK_PHASE_LAYOUT) &&
!gdk_frame_clock_idle_is_frozen (clock_idle) &&
iter++ < 4)
priv->freeze_count == 0 && iter++ < 4)
{
priv->requested &= ~GDK_FRAME_CLOCK_PHASE_LAYOUT;
_gdk_frame_clock_emit_layout (clock);
@@ -614,7 +591,7 @@ gdk_frame_clock_paint_idle (void *data)
G_GNUC_FALLTHROUGH;
case GDK_FRAME_CLOCK_PHASE_PAINT:
if (!gdk_frame_clock_idle_is_frozen (clock_idle))
if (priv->freeze_count == 0)
{
#ifdef G_ENABLE_DEBUG
if (GDK_DEBUG_CHECK (FRAMES))
@@ -635,7 +612,7 @@ gdk_frame_clock_paint_idle (void *data)
G_GNUC_FALLTHROUGH;
case GDK_FRAME_CLOCK_PHASE_AFTER_PAINT:
if (!gdk_frame_clock_idle_is_frozen (clock_idle))
if (priv->freeze_count == 0)
{
priv->requested &= ~GDK_FRAME_CLOCK_PHASE_AFTER_PAINT;
_gdk_frame_clock_emit_after_paint (clock);
@@ -664,7 +641,7 @@ gdk_frame_clock_paint_idle (void *data)
_gdk_frame_clock_emit_resume_events (clock);
}
if (!gdk_frame_clock_idle_is_frozen (clock_idle))
if (priv->freeze_count == 0)
priv->phase = GDK_FRAME_CLOCK_PHASE_NONE;
priv->in_paint_idle = FALSE;
@@ -673,7 +650,7 @@ gdk_frame_clock_paint_idle (void *data)
* update as soon as the backend unthrottles (if there is work to do),
* otherwise we need to figure when the next frame should be.
*/
if (!gdk_frame_clock_idle_is_frozen (clock_idle))
if (priv->freeze_count == 0)
{
/*
* If we don't receive "frame drawn" events, smooth_cycle_start will simply be advanced in constant increments of
@@ -691,7 +668,7 @@ gdk_frame_clock_paint_idle (void *data)
maybe_start_idle (clock_idle, FALSE);
}
if (!gdk_frame_clock_idle_is_frozen (clock_idle))
if (priv->freeze_count == 0)
priv->sleep_serial = get_sleep_serial ();
gdk_profiler_end_mark (before, "frameclock cycle", NULL);
@@ -765,7 +742,7 @@ gdk_frame_clock_idle_freeze (GdkFrameClock *clock)
GdkFrameClockIdle *clock_idle = GDK_FRAME_CLOCK_IDLE (clock);
GdkFrameClockIdlePrivate *priv = clock_idle->priv;
if (!gdk_frame_clock_idle_is_frozen (clock_idle))
if (priv->freeze_count == 0)
{
if (GDK_PROFILER_IS_RUNNING)
priv->freeze_time = g_get_monotonic_time ();
@@ -784,7 +761,7 @@ gdk_frame_clock_idle_thaw (GdkFrameClock *clock)
g_return_if_fail (priv->freeze_count > 0);
priv->freeze_count--;
if (!gdk_frame_clock_idle_is_frozen (clock_idle))
if (priv->freeze_count == 0)
{
maybe_start_idle (clock_idle, TRUE);
/* If nothing is requested so we didn't start an idle, we need
@@ -798,7 +775,7 @@ gdk_frame_clock_idle_thaw (GdkFrameClock *clock)
if (GDK_PROFILER_IS_RUNNING)
{
if (gdk_frame_clock_idle_is_frozen (clock_idle))
if (priv->freeze_time != 0)
{
gdk_profiler_end_mark (priv->freeze_time * 1000, "frameclock frozen", NULL);
priv->freeze_time = 0;

View File

@@ -21,7 +21,8 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdktypes.h>
#include <glib-object.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@@ -173,8 +173,12 @@ static GPrivate thread_current_context = G_PRIVATE_INIT (unref_unmasked);
static void
gdk_gl_context_clear_old_updated_area (GdkGLContext *context)
{
for (unsigned int i = 0; i < GDK_GL_MAX_TRACKED_BUFFERS; i++)
g_clear_pointer (&context->old_updated_area[i], cairo_region_destroy);
int i;
for (i = 0; i < 2; i++)
{
g_clear_pointer (&context->old_updated_area[i], cairo_region_destroy);
}
}
static void
@@ -462,26 +466,29 @@ gdk_gl_context_real_get_damage (GdkGLContext *context)
eglQuerySurface (gdk_display_get_egl_display (display), egl_surface,
EGL_BUFFER_AGE_EXT, &buffer_age);
if (buffer_age > 0 && buffer_age <= GDK_GL_MAX_TRACKED_BUFFERS)
switch (buffer_age)
{
cairo_region_t *damage = cairo_region_create ();
int i;
case 1:
return cairo_region_create ();
break;
for (i = 0; i < buffer_age - 1; i++)
{
if (context->old_updated_area[i] == NULL)
{
cairo_region_create_rectangle (&(GdkRectangle) {
0, 0,
gdk_surface_get_width (surface),
gdk_surface_get_height (surface)
});
break;
}
cairo_region_union (damage, context->old_updated_area[i]);
}
case 2:
if (context->old_updated_area[0])
return cairo_region_copy (context->old_updated_area[0]);
break;
return damage;
case 3:
if (context->old_updated_area[0] &&
context->old_updated_area[1])
{
cairo_region_t *damage = cairo_region_copy (context->old_updated_area[0]);
cairo_region_union (damage, context->old_updated_area[1]);
return damage;
}
break;
default:
;
}
}
#endif
@@ -590,7 +597,6 @@ gdk_gl_context_real_begin_frame (GdkDrawContext *draw_context,
cairo_region_t *damage;
double scale;
int ww, wh;
int i;
surface = gdk_draw_context_get_surface (draw_context);
scale = gdk_gl_context_get_scale (context);
@@ -602,11 +608,9 @@ gdk_gl_context_real_begin_frame (GdkDrawContext *draw_context,
damage = GDK_GL_CONTEXT_GET_CLASS (context)->get_damage (context);
g_clear_pointer (&context->old_updated_area[GDK_GL_MAX_TRACKED_BUFFERS - 1], cairo_region_destroy);
for (i = GDK_GL_MAX_TRACKED_BUFFERS - 1; i > 0; i--)
{
context->old_updated_area[i] = context->old_updated_area[i - 1];
}
if (context->old_updated_area[1])
cairo_region_destroy (context->old_updated_area[1]);
context->old_updated_area[1] = context->old_updated_area[0];
context->old_updated_area[0] = cairo_region_copy (region);
cairo_region_union (region, damage);

View File

@@ -1,7 +1,7 @@
/* GDK - The GIMP Drawing Kit
*
* gdkglcontext.h: GL context abstraction
*
*
* Copyright © 2014 Emmanuele Bassi
*
* This library is free software; you can redistribute it and/or
@@ -24,7 +24,9 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkenums.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@@ -34,11 +34,6 @@ typedef enum {
GDK_GL_CGL
} GdkGLBackend;
/* The maximum amount of buffers we track update regions for.
* Note that this is equal to the max buffer age value we
* can provide a damage region for */
#define GDK_GL_MAX_TRACKED_BUFFERS 4
#define GDK_GL_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_GL_CONTEXT, GdkGLContextClass))
#define GDK_IS_GL_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_GL_CONTEXT))
#define GDK_GL_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_GL_CONTEXT, GdkGLContextClass))
@@ -50,7 +45,7 @@ struct _GdkGLContext
GdkDrawContext parent_instance;
/* We store the old drawn areas to support buffer-age optimizations */
cairo_region_t *old_updated_area[GDK_GL_MAX_TRACKED_BUFFERS];
cairo_region_t *old_updated_area[2];
};
struct _GdkGLContextClass

View File

@@ -138,7 +138,6 @@ static gboolean
gdk_gl_texture_find_format (gboolean use_es,
guint gl_major,
guint gl_minor,
GdkMemoryAlpha alpha,
GLint gl_format,
GLint gl_type,
GdkMemoryFormat *out_format)
@@ -148,12 +147,8 @@ gdk_gl_texture_find_format (gboolean use_es,
for (format = 0; format < GDK_MEMORY_N_FORMATS; format++)
{
GLenum q_internal_format, q_format, q_type;
GLint q_swizzle[4];
if (gdk_memory_format_alpha (format) != alpha)
continue;
if (!gdk_memory_format_gl_format (format, use_es, gl_major, gl_minor, &q_internal_format, &q_format, &q_type, &q_swizzle))
if (!gdk_memory_format_gl_format (format, use_es, gl_major, gl_minor, &q_internal_format, &q_format, &q_type))
continue;
if (q_format != gl_format || q_type != gl_type)
@@ -172,57 +167,23 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
gpointer download_)
{
GdkTexture *texture = GDK_TEXTURE (self);
GdkMemoryFormat format;
gsize expected_stride;
Download *download = download_;
GLenum gl_internal_format, gl_format, gl_type;
GLint gl_swizzle[4];
int major, minor;
format = gdk_texture_get_format (texture),
expected_stride = texture->width * gdk_memory_format_bytes_per_pixel (download->format);
gdk_gl_context_get_version (context, &major, &minor);
if (!gdk_gl_context_get_use_es (context) &&
gdk_memory_format_gl_format (format,
FALSE,
major, minor,
&gl_internal_format,
&gl_format, &gl_type, &gl_swizzle))
if (download->stride == expected_stride &&
!gdk_gl_context_get_use_es (context) &&
gdk_memory_format_gl_format (download->format, TRUE, major, minor, &gl_internal_format, &gl_format, &gl_type))
{
if (download->stride == expected_stride &&
download->format == format)
{
glGetTexImage (GL_TEXTURE_2D,
0,
gl_format,
gl_type,
download->data);
}
else
{
gsize stride = texture->width * gdk_memory_format_bytes_per_pixel (format);
guchar *pixels = g_malloc_n (stride, texture->height);
glPixelStorei (GL_PACK_ALIGNMENT, 1);
glGetTexImage (GL_TEXTURE_2D,
0,
gl_format,
gl_type,
pixels);
gdk_memory_convert (download->data,
download->stride,
download->format,
pixels,
stride,
format,
texture->width,
texture->height);
g_free (pixels);
}
glGetTexImage (GL_TEXTURE_2D,
0,
gl_format,
gl_type,
download->data);
}
else
{
@@ -235,26 +196,17 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, self->id, 0);
if (gdk_gl_context_check_version (context, "4.3", "3.1"))
{
gdk_gl_context_get_version (context, &major, &minor);
glGetFramebufferParameteriv (GL_FRAMEBUFFER, GL_IMPLEMENTATION_COLOR_READ_FORMAT, &gl_read_format);
glGetFramebufferParameteriv (GL_FRAMEBUFFER, GL_IMPLEMENTATION_COLOR_READ_TYPE, &gl_read_type);
if (!gdk_gl_texture_find_format (TRUE, major, minor, gdk_memory_format_alpha (format), gl_read_format, gl_read_type, &actual_format))
{
gl_read_format = GL_RGBA;
gl_read_type = GL_UNSIGNED_BYTE;
if (gdk_memory_format_alpha (format) == GDK_MEMORY_ALPHA_PREMULTIPLIED)
actual_format = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED; /* pray */
else
actual_format = GDK_MEMORY_R8G8B8A8;
}
if (!gdk_gl_texture_find_format (gdk_gl_context_get_use_es (context), major, minor, gl_read_format, gl_read_type, &actual_format))
actual_format = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED; /* pray */
}
else
{
gl_read_format = GL_RGBA;
gl_read_type = GL_UNSIGNED_BYTE;
if (gdk_memory_format_alpha (format) == GDK_MEMORY_ALPHA_PREMULTIPLIED)
actual_format = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED; /* pray */
else
actual_format = GDK_MEMORY_R8G8B8A8;
actual_format = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED;
}
if (download->format == actual_format &&
@@ -269,95 +221,19 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
else
{
gsize actual_bpp = gdk_memory_format_bytes_per_pixel (actual_format);
gsize stride = actual_bpp * texture->width;
guchar *pixels = g_malloc_n (stride, texture->height);
guchar *pixels = g_malloc_n (texture->width * actual_bpp, texture->height);
glPixelStorei (GL_PACK_ALIGNMENT, 1);
glReadPixels (0, 0,
texture->width, texture->height,
gl_read_format,
gl_read_type,
pixels);
/* Fix up gles inadequacies */
if (gl_read_format == GL_RGBA &&
gl_read_type == GL_UNSIGNED_BYTE &&
(format == GDK_MEMORY_G8A8 ||
format == GDK_MEMORY_G8A8_PREMULTIPLIED ||
format == GDK_MEMORY_G8 ||
format == GDK_MEMORY_A8))
{
for (unsigned int y = 0; y < texture->height; y++)
{
for (unsigned int x = 0; x < texture->width; x++)
{
guchar *data = &pixels[y * stride + x * actual_bpp];
if (format == GDK_MEMORY_G8A8 ||
format == GDK_MEMORY_G8A8_PREMULTIPLIED)
{
data[3] = data[1];
data[1] = data[0];
data[2] = data[0];
}
else if (format == GDK_MEMORY_G8)
{
data[1] = data[0];
data[2] = data[0];
data[3] = 0xff;
}
else if (format == GDK_MEMORY_A8)
{
data[3] = data[0];
data[0] = 0;
data[1] = 0;
data[2] = 0;
}
}
}
}
if (gl_read_format == GL_RGBA &&
gl_read_type == GL_UNSIGNED_SHORT &&
(format == GDK_MEMORY_G16A16 ||
format == GDK_MEMORY_G16A16_PREMULTIPLIED ||
format == GDK_MEMORY_G16 ||
format == GDK_MEMORY_A16))
{
for (unsigned int y = 0; y < texture->height; y++)
{
for (unsigned int x = 0; x < texture->width; x++)
{
guint16 *data = (guint16 *) &pixels[y * stride + x * actual_bpp];
if (format == GDK_MEMORY_G16A16 ||
format == GDK_MEMORY_G16A16_PREMULTIPLIED)
{
data[3] = data[1];
data[1] = data[0];
data[2] = data[0];
}
else if (format == GDK_MEMORY_G16)
{
data[1] = data[0];
data[2] = data[0];
data[3] = 0xffff;
}
else if (format == GDK_MEMORY_A16)
{
data[3] = data[0];
data[0] = 0;
data[1] = 0;
data[2] = 0;
}
}
}
}
gdk_memory_convert (download->data,
download->stride,
download->format,
pixels,
stride,
texture->width * actual_bpp,
actual_format,
texture->width,
texture->height);
@@ -462,7 +338,6 @@ gdk_gl_texture_new_from_builder (GdkGLTextureBuilder *builder,
gpointer data)
{
GdkGLTexture *self;
GdkTexture *update_texture;
self = g_object_new (GDK_TYPE_GL_TEXTURE,
"width", gdk_gl_texture_builder_get_width (builder),
@@ -478,22 +353,6 @@ gdk_gl_texture_new_from_builder (GdkGLTextureBuilder *builder,
self->destroy = destroy;
self->data = data;
update_texture = gdk_gl_texture_builder_get_update_texture (builder);
if (update_texture)
{
cairo_region_t *update_region = gdk_gl_texture_builder_get_update_region (builder);
if (update_region)
{
update_region = cairo_region_copy (update_region);
cairo_region_intersect_rectangle (update_region,
&(cairo_rectangle_int_t) {
0, 0,
update_texture->width, update_texture->height
});
gdk_texture_set_diff (GDK_TEXTURE (self), update_texture, update_region);
}
}
return GDK_TEXTURE (self);
}

View File

@@ -22,7 +22,6 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdktypes.h>
#include <gdk/gdkglcontext.h>
#include <gdk/gdktexture.h>

View File

@@ -25,8 +25,6 @@
#include "gdkglcontext.h"
#include "gdkgltextureprivate.h"
#include <cairo-gobject.h>
struct _GdkGLTextureBuilder
{
GObject parent_instance;
@@ -38,9 +36,6 @@ struct _GdkGLTextureBuilder
GdkMemoryFormat format;
gboolean has_mipmap;
gpointer sync;
GdkTexture *update_texture;
cairo_region_t *update_region;
};
struct _GdkGLTextureBuilderClass
@@ -75,8 +70,6 @@ enum
PROP_HEIGHT,
PROP_ID,
PROP_SYNC,
PROP_UPDATE_REGION,
PROP_UPDATE_TEXTURE,
PROP_WIDTH,
N_PROPS
@@ -93,9 +86,6 @@ gdk_gl_texture_builder_dispose (GObject *object)
g_clear_object (&self->context);
g_clear_object (&self->update_texture);
g_clear_pointer (&self->update_region, cairo_region_destroy);
G_OBJECT_CLASS (gdk_gl_texture_builder_parent_class)->dispose (object);
}
@@ -133,14 +123,6 @@ gdk_gl_texture_builder_get_property (GObject *object,
g_value_set_pointer (value, self->sync);
break;
case PROP_UPDATE_REGION:
g_value_set_boxed (value, self->update_region);
break;
case PROP_UPDATE_TEXTURE:
g_value_set_object (value, self->update_texture);
break;
case PROP_WIDTH:
g_value_set_int (value, self->width);
break;
@@ -185,14 +167,6 @@ gdk_gl_texture_builder_set_property (GObject *object,
gdk_gl_texture_builder_set_sync (self, g_value_get_pointer (value));
break;
case PROP_UPDATE_REGION:
gdk_gl_texture_builder_set_update_region (self, g_value_get_boxed (value));
break;
case PROP_UPDATE_TEXTURE:
gdk_gl_texture_builder_set_update_texture (self, g_value_get_object (value));
break;
case PROP_WIDTH:
gdk_gl_texture_builder_set_width (self, g_value_get_int (value));
break;
@@ -286,30 +260,6 @@ gdk_gl_texture_builder_class_init (GdkGLTextureBuilderClass *klass)
g_param_spec_pointer ("sync", NULL, NULL,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
/**
* GdkGLTextureBuilder:update-region: (attributes org.gdk.Property.get=gdk_gl_texture_builder_get_update_region org.gdk.Property.set=gdk_gl_texture_builder_set_update_region)
*
* The update region for [property@Gdk.GLTextureBuilder:update-texture].
*
* Since: 4.12
*/
properties[PROP_UPDATE_REGION] =
g_param_spec_boxed ("update-region", NULL, NULL,
CAIRO_GOBJECT_TYPE_REGION,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
/**
* GdkGLTextureBuilder:update-texture: (attributes org.gdk.Property.get=gdk_gl_texture_builder_get_update_texture org.gdk.Property.set=gdk_gl_texture_builder_set_update_texture)
*
* The texture [property@Gdk.GLTextureBuilder:update-region] is an update for.
*
* Since: 4.12
*/
properties[PROP_UPDATE_TEXTURE] =
g_param_spec_object ("update-texture", NULL, NULL,
GDK_TYPE_TEXTURE,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
/**
* GdkGLTextureBuilder:width: (attributes org.gdk.Property.get=gdk_gl_texture_builder_get_width org.gdk.Property.set=gdk_gl_texture_builder_set_width)
*
@@ -321,7 +271,6 @@ gdk_gl_texture_builder_class_init (GdkGLTextureBuilderClass *klass)
g_param_spec_int ("width", NULL, NULL,
G_MININT, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (gobject_class, N_PROPS, properties);
}
@@ -644,18 +593,10 @@ gdk_gl_texture_builder_get_format (GdkGLTextureBuilder *self)
* The format is the preferred format the texture data should be downloaded to. The
* format must be supported by the GL version of [property@Gdk.GLTextureBuilder:context].
*
* GDK's texture download code assumes that the format corresponds to the storage
* parameters of the GL texture in an obvious way. For example, a format of
* `GDK_MEMORY_R16G16B16A16_PREMULTIPLIED` is expected to be stored as `GL_RGBA16`
* texture, and `GDK_MEMORY_G8A8` is expected to be stored as `GL_RG8` texture.
*
* Setting the right format is particularly useful when using high bit depth textures
* to preserve the bit depth, to set the correct value for unpremultiplied textures
* and to make sure opaque textures are treated as such.
*
* Non-RGBA textures need to have swizzling parameters set up properly to be usable
* in GSK's shaders.
*
* Since: 4.12
*/
void
@@ -672,102 +613,6 @@ gdk_gl_texture_builder_set_format (GdkGLTextureBuilder *self,
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_FORMAT]);
}
/**
* gdk_gl_texture_builder_get_update_texture: (attributes org.gdk.Method.get_property=update_texture)
* @self: a `GdkGLTextureBuilder`
*
* Gets the texture previously set via gdk_gl_texture_builder_set_update_texture() or
* %NULL if none was set.
*
* Returns: (transfer none) (nullable): The texture
*
* Since: 4.12
*/
GdkTexture *
gdk_gl_texture_builder_get_update_texture (GdkGLTextureBuilder *self)
{
g_return_val_if_fail (GDK_IS_GL_TEXTURE_BUILDER (self), NULL);
return self->update_texture;
}
/**
* gdk_gl_texture_builder_set_update_texture: (attributes org.gdk.Method.set_property=update_texture)
* @self: a `GdkGLTextureBuilder`
* @texture: (nullable): the texture to update
*
* Sets the texture to be updated by this texture. See
* [method@Gdk.GLTextureBuilder.set_update_region] for an explanation.
*
* Since: 4.12
*/
void
gdk_gl_texture_builder_set_update_texture (GdkGLTextureBuilder *self,
GdkTexture *texture)
{
g_return_if_fail (GDK_IS_GL_TEXTURE_BUILDER (self));
g_return_if_fail (texture == NULL || GDK_IS_TEXTURE (texture));
if (!g_set_object (&self->update_texture, texture))
return;
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_UPDATE_TEXTURE]);
}
/**
* gdk_gl_texture_builder_get_update_region: (attributes org.gdk.Method.get_property=update_region)
* @self: a `GdkGLTextureBuilder`
*
* Gets the region previously set via gdk_gl_texture_builder_set_update_region() or
* %NULL if none was set.
*
* Returns: (transfer none) (nullable): The region
*
* Since: 4.12
*/
cairo_region_t *
gdk_gl_texture_builder_get_update_region (GdkGLTextureBuilder *self)
{
g_return_val_if_fail (GDK_IS_GL_TEXTURE_BUILDER (self), NULL);
return self->update_region;
}
/**
* gdk_gl_texture_builder_set_update_region: (attributes org.gdk.Method.set_property=update_region)
* @self: a `GdkGLTextureBuilder`
* @region: (nullable): the region to update
*
* Sets the region to be updated by this texture. Together with
* [property@Gdk.GLTextureBuilder:update-texture] this describes an
* update of a previous texture.
*
* When rendering animations of large textures, it is possible that
* consecutive textures are only updating contents in parts of the texture.
* It is then possible to describe this update via these two properties,
* so that GTK can avoid rerendering parts that did not change.
*
* An example would be a screen recording where only the mouse pointer moves.
*
* Since: 4.12
*/
void
gdk_gl_texture_builder_set_update_region (GdkGLTextureBuilder *self,
cairo_region_t *region)
{
g_return_if_fail (GDK_IS_GL_TEXTURE_BUILDER (self));
if (self->update_region == region)
return;
g_clear_pointer (&self->update_region, cairo_region_destroy);
if (region)
self->update_region = cairo_region_reference (region);
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_UPDATE_REGION]);
}
/**
* gdk_gl_texture_builder_build:
* @self: a `GdkGLTextureBuilder`

View File

@@ -23,7 +23,9 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkenums.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS
@@ -76,18 +78,6 @@ GDK_AVAILABLE_IN_4_12
void gdk_gl_texture_builder_set_sync (GdkGLTextureBuilder *self,
gpointer sync);
GDK_AVAILABLE_IN_4_12
GdkTexture * gdk_gl_texture_builder_get_update_texture (GdkGLTextureBuilder *self) G_GNUC_PURE;
GDK_AVAILABLE_IN_4_12
void gdk_gl_texture_builder_set_update_texture (GdkGLTextureBuilder *self,
GdkTexture *texture);
GDK_AVAILABLE_IN_4_12
cairo_region_t * gdk_gl_texture_builder_get_update_region (GdkGLTextureBuilder *self) G_GNUC_PURE;
GDK_AVAILABLE_IN_4_12
void gdk_gl_texture_builder_set_update_region (GdkGLTextureBuilder *self,
cairo_region_t *region);
GDK_AVAILABLE_IN_4_12
GdkTexture * gdk_gl_texture_builder_build (GdkGLTextureBuilder *self,
GDestroyNotify destroy,

View File

@@ -28,6 +28,7 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@@ -60,36 +60,6 @@ name ## _from_float (guchar *dest_data, \
} \
}
#define TYPED_GRAY_FUNCS(name, T, G, A, bpp, scale) \
static void \
name ## _to_float (float *dest, \
const guchar *src_data, \
gsize n) \
{ \
for (gsize i = 0; i < n; i++) \
{ \
T *src = (T *) (src_data + i * bpp); \
if (G >= 0) dest[0] = (float) src[G] / scale; else dest[0] = 1.0; \
dest[1] = dest[2] = dest[0]; \
if (A >= 0) dest[3] = (float) src[A] / scale; else dest[3] = 1.0; \
dest += 4; \
} \
} \
\
static void \
name ## _from_float (guchar *dest_data, \
const float *src, \
gsize n) \
{ \
for (gsize i = 0; i < n; i++) \
{ \
T *dest = (T *) (dest_data + i * bpp); \
if (G >= 0) dest[G] = CLAMP ((src[0] + src[1] + src[2]) * scale / 3.f + 0.5, 0, scale); \
if (A >= 0) dest[A] = CLAMP (src[3] * scale + 0.5, 0, scale); \
src += 4; \
} \
}
TYPED_FUNCS (b8g8r8a8_premultiplied, guchar, 2, 1, 0, 3, 4, 255)
TYPED_FUNCS (a8r8g8b8_premultiplied, guchar, 1, 2, 3, 0, 4, 255)
TYPED_FUNCS (r8g8b8a8_premultiplied, guchar, 0, 1, 2, 3, 4, 255)
@@ -102,15 +72,6 @@ TYPED_FUNCS (b8g8r8, guchar, 2, 1, 0, -1, 3, 255)
TYPED_FUNCS (r16g16b16, guint16, 0, 1, 2, -1, 6, 65535)
TYPED_FUNCS (r16g16b16a16, guint16, 0, 1, 2, 3, 8, 65535)
TYPED_GRAY_FUNCS (g8a8_premultiplied, guchar, 0, 1, 2, 255)
TYPED_GRAY_FUNCS (g8a8, guchar, 0, 1, 2, 255)
TYPED_GRAY_FUNCS (g8, guchar, 0, -1, 1, 255)
TYPED_GRAY_FUNCS (a8, guchar, -1, 0, 1, 255)
TYPED_GRAY_FUNCS (g16a16_premultiplied, guint16, 0, 1, 4, 65535)
TYPED_GRAY_FUNCS (g16a16, guint16, 0, 1, 4, 65535)
TYPED_GRAY_FUNCS (g16, guint16, 0, -1, 2, 65535)
TYPED_GRAY_FUNCS (a16, guint16, -1, 0, 2, 65535)
static void
r16g16b16_float_to_float (float *dest,
const guchar *src_data,
@@ -269,7 +230,6 @@ struct _GdkMemoryFormatDescription
guint internal_format;
guint format;
guint type;
GLint swizzle[4];
} gl;
/* no premultiplication going on here */
void (* to_float) (float *, const guchar*, gsize);
@@ -291,7 +251,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
G_ALIGNOF (guchar),
FALSE,
{ 0, 0, G_MAXUINT, G_MAXUINT },
{ GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
{ GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE },
b8g8r8a8_premultiplied_to_float,
b8g8r8a8_premultiplied_from_float,
},
@@ -301,7 +261,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
G_ALIGNOF (guchar),
FALSE,
{ 0, 0, G_MAXUINT, G_MAXUINT },
{ GL_RGBA8, GL_BGRA, GDK_GL_UNSIGNED_BYTE_FLIPPED, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
{ GL_RGBA8, GL_BGRA, GDK_GL_UNSIGNED_BYTE_FLIPPED },
a8r8g8b8_premultiplied_to_float,
a8r8g8b8_premultiplied_from_float,
},
@@ -311,7 +271,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
G_ALIGNOF (guchar),
FALSE,
{ 0, 0, 0, 0 },
{ GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
{ GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE },
r8g8b8a8_premultiplied_to_float,
r8g8b8a8_premultiplied_from_float,
},
@@ -321,7 +281,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
G_ALIGNOF (guchar),
FALSE,
{ 0, 0, G_MAXUINT, G_MAXUINT },
{ GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
{ GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE },
b8g8r8a8_to_float,
b8g8r8a8_from_float,
},
@@ -331,7 +291,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
G_ALIGNOF (guchar),
FALSE,
{ 0, 0, G_MAXUINT, G_MAXUINT },
{ GL_RGBA8, GL_RGBA, GDK_GL_UNSIGNED_BYTE_FLIPPED, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
{ GL_RGBA8, GL_RGBA, GDK_GL_UNSIGNED_BYTE_FLIPPED },
a8r8g8b8_to_float,
a8r8g8b8_from_float,
},
@@ -341,7 +301,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
G_ALIGNOF (guchar),
FALSE,
{ 0, 0, 0, 0 },
{ GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
{ GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE },
r8g8b8a8_to_float,
r8g8b8a8_from_float,
},
@@ -351,7 +311,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
G_ALIGNOF (guchar),
FALSE,
{ 0, 0, G_MAXUINT, G_MAXUINT },
{ GL_RGBA8, GL_BGRA, GDK_GL_UNSIGNED_BYTE_FLIPPED, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
{ GL_RGBA8, GL_BGRA, GDK_GL_UNSIGNED_BYTE_FLIPPED },
a8b8g8r8_to_float,
a8b8g8r8_from_float,
},
@@ -361,7 +321,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
G_ALIGNOF (guchar),
FALSE,
{ 0, 0, 0, 0 },
{ GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
{ GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE },
r8g8b8_to_float,
r8g8b8_from_float,
},
@@ -371,7 +331,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
G_ALIGNOF (guchar),
FALSE,
{ 0, 0, G_MAXUINT, G_MAXUINT },
{ GL_RGB8, GL_BGR, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
{ GL_RGB8, GL_BGR, GL_UNSIGNED_BYTE },
b8g8r8_to_float,
b8g8r8_from_float,
},
@@ -381,7 +341,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
G_ALIGNOF (guint16),
TRUE,
{ 0, 0, 3, 0 },
{ GL_RGB16, GL_RGB, GL_UNSIGNED_SHORT, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
{ GL_RGB16, GL_RGB, GL_UNSIGNED_SHORT },
r16g16b16_to_float,
r16g16b16_from_float,
},
@@ -391,7 +351,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
G_ALIGNOF (guint16),
TRUE,
{ 0, 0, 3, 0 },
{ GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
{ GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT },
r16g16b16a16_to_float,
r16g16b16a16_from_float,
},
@@ -401,7 +361,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
G_ALIGNOF (guint16),
TRUE,
{ 0, 0, 3, 0 },
{ GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
{ GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT },
r16g16b16a16_to_float,
r16g16b16a16_from_float,
},
@@ -411,7 +371,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
G_ALIGNOF (guint16),
TRUE,
{ 0, 0, 3, 0 },
{ GL_RGB16F, GL_RGB, GL_HALF_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
{ GL_RGB16F, GL_RGB, GL_HALF_FLOAT },
r16g16b16_float_to_float,
r16g16b16_float_from_float,
},
@@ -421,7 +381,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
G_ALIGNOF (guint16),
TRUE,
{ 0, 0, 3, 0 },
{ GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
{ GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT },
r16g16b16a16_float_to_float,
r16g16b16a16_float_from_float,
},
@@ -431,7 +391,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
G_ALIGNOF (guint16),
TRUE,
{ 0, 0, 3, 0 },
{ GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
{ GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT },
r16g16b16a16_float_to_float,
r16g16b16a16_float_from_float,
},
@@ -441,7 +401,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
G_ALIGNOF (float),
TRUE,
{ 0, 0, 3, 0 },
{ GL_RGB32F, GL_RGB, GL_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
{ GL_RGB32F, GL_RGB, GL_FLOAT },
r32g32b32_float_to_float,
r32g32b32_float_from_float,
},
@@ -451,7 +411,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
G_ALIGNOF (float),
TRUE,
{ 0, 0, 3, 0 },
{ GL_RGBA32F, GL_RGBA, GL_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
{ GL_RGBA32F, GL_RGBA, GL_FLOAT },
r32g32b32a32_float_to_float,
r32g32b32a32_float_from_float,
},
@@ -461,89 +421,9 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
G_ALIGNOF (float),
TRUE,
{ 0, 0, 3, 0 },
{ GL_RGBA32F, GL_RGBA, GL_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
{ GL_RGBA32F, GL_RGBA, GL_FLOAT },
r32g32b32a32_float_to_float,
r32g32b32a32_float_from_float,
},
[GDK_MEMORY_G8A8_PREMULTIPLIED] = {
GDK_MEMORY_ALPHA_PREMULTIPLIED,
2,
G_ALIGNOF (guchar),
FALSE,
{ 0, 0, 3, 0 },
{ GL_RG8, GL_RG, GL_UNSIGNED_BYTE, { GL_RED, GL_RED, GL_RED, GL_GREEN } },
g8a8_premultiplied_to_float,
g8a8_premultiplied_from_float,
},
[GDK_MEMORY_G8A8] = {
GDK_MEMORY_ALPHA_STRAIGHT,
2,
G_ALIGNOF (guchar),
FALSE,
{ 0, 0, 3, 0 },
{ GL_RG8, GL_RG, GL_UNSIGNED_BYTE, { GL_RED, GL_RED, GL_RED, GL_GREEN } },
g8a8_to_float,
g8a8_from_float,
},
[GDK_MEMORY_G8] = {
GDK_MEMORY_ALPHA_OPAQUE,
1,
G_ALIGNOF (guchar),
FALSE,
{ 0, 0, 3, 0 },
{ GL_R8, GL_RED, GL_UNSIGNED_BYTE, { GL_RED, GL_RED, GL_RED, GL_ONE } },
g8_to_float,
g8_from_float,
},
[GDK_MEMORY_G16A16_PREMULTIPLIED] = {
GDK_MEMORY_ALPHA_PREMULTIPLIED,
4,
G_ALIGNOF (guint16),
TRUE,
{ 0, 0, 3, 0 },
{ GL_RG16, GL_RG, GL_UNSIGNED_SHORT, { GL_RED, GL_RED, GL_RED, GL_GREEN } },
g16a16_premultiplied_to_float,
g16a16_premultiplied_from_float,
},
[GDK_MEMORY_G16A16] = {
GDK_MEMORY_ALPHA_STRAIGHT,
4,
G_ALIGNOF (guint16),
TRUE,
{ 0, 0, 3, 0 },
{ GL_RG16, GL_RG, GL_UNSIGNED_SHORT, { GL_RED, GL_RED, GL_RED, GL_GREEN } },
g16a16_to_float,
g16a16_from_float,
},
[GDK_MEMORY_G16] = {
GDK_MEMORY_ALPHA_OPAQUE,
2,
G_ALIGNOF (guint16),
TRUE,
{ 0, 0, 3, 0 },
{ GL_R16, GL_RED, GL_UNSIGNED_SHORT, { GL_RED, GL_RED, GL_RED, GL_ONE } },
g16_to_float,
g16_from_float,
},
[GDK_MEMORY_A8] = {
GDK_MEMORY_ALPHA_STRAIGHT,
1,
G_ALIGNOF (guchar),
FALSE,
{ 0, 0, 3, 0 },
{ GL_R8, GL_RED, GL_UNSIGNED_BYTE, { GL_ONE, GL_ONE, GL_ONE, GL_RED } },
a8_to_float,
a8_from_float,
},
[GDK_MEMORY_A16] = {
GDK_MEMORY_ALPHA_STRAIGHT,
2,
G_ALIGNOF (guint16),
TRUE,
{ 0, 0, 3, 0 },
{ GL_R16, GL_RED, GL_UNSIGNED_SHORT, { GL_ONE, GL_ONE, GL_ONE, GL_RED } },
a16_to_float,
a16_from_float,
}
};
@@ -592,13 +472,14 @@ gdk_memory_format_gl_format (GdkMemoryFormat format,
guint gl_minor,
guint *out_internal_format,
guint *out_format,
guint *out_type,
GLint (*out_swizzle)[4])
guint *out_type)
{
*out_internal_format = memory_formats[format].gl.internal_format;
*out_format = memory_formats[format].gl.format;
*out_type = memory_formats[format].gl.type;
memcpy (out_swizzle, &memory_formats[format].gl.swizzle, sizeof(GLint) * 4);
if (memory_formats[format].alpha == GDK_MEMORY_ALPHA_STRAIGHT)
return FALSE;
if (gles)
{

View File

@@ -21,8 +21,6 @@
#include "gdkenums.h"
#include <epoxy/gl.h>
G_BEGIN_DECLS
typedef enum {
@@ -41,8 +39,7 @@ gboolean gdk_memory_format_gl_format (GdkMemoryFormat
guint gl_minor,
guint *out_internal_format,
guint *out_format,
guint *out_type,
GLint (*out_gizzle)[4]);
guint *out_type);
void gdk_memory_convert (guchar *dest_data,
gsize dest_stride,

View File

@@ -23,7 +23,7 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdktypes.h>
#include <gdk/gdkenums.h>
#include <gdk/gdktexture.h>
G_BEGIN_DECLS

Some files were not shown because too many files have changed in this diff Show More