Compare commits
2 Commits
async-colo
...
maplistmod
Author | SHA1 | Date | |
---|---|---|---|
|
c6dbfc85e9 | ||
|
404f39551e |
@@ -4,7 +4,6 @@ AlwaysBreakAfterDefinitionReturnType: All
|
||||
BreakBeforeBinaryOperators: None
|
||||
BinPackParameters: false
|
||||
SpaceAfterCStyleCast: true
|
||||
PointerAlignment: Right
|
||||
# Our column limit is actually 80, but setting that results in clang-format
|
||||
# making a lot of dubious hanging-indent choices; disable it and assume the
|
||||
# developer will line wrap appropriately. clang-format will still check
|
||||
|
@@ -3,7 +3,6 @@ include:
|
||||
file: 'flatpak/flatpak_ci_initiative.yml'
|
||||
|
||||
stages:
|
||||
- check
|
||||
- build
|
||||
- analysis
|
||||
- docs
|
||||
@@ -22,12 +21,12 @@ stages:
|
||||
|
||||
# Common variables
|
||||
variables:
|
||||
COMMON_MESON_FLAGS: "-Dwerror=true -Dglib:werror=false -Dpango:werror=false -Dgtk-doc:werror=false -Dwayland-protocols:werror=false -Dsysprof:werror=false -Dwayland:werror=false"
|
||||
COMMON_MESON_FLAGS: "-Dwerror=true -Dglib:werror=false -Dpango:werror=false -Dgtk-doc:werror=false -Dwayland-protocols:werror=false -Dsysprof:werror=false"
|
||||
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true"
|
||||
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled"
|
||||
MESON_TEST_TIMEOUT_MULTIPLIER: 3
|
||||
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v38"
|
||||
FLATPAK_IMAGE: "quay.io/gnome_infrastructure/gnome-runtime-images:gnome-master"
|
||||
FLATPAK_IMAGE: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master"
|
||||
|
||||
.only-default:
|
||||
only:
|
||||
@@ -38,7 +37,7 @@ variables:
|
||||
style-check-diff:
|
||||
extends: .only-default
|
||||
image: $FEDORA_IMAGE
|
||||
stage: check
|
||||
stage: .pre
|
||||
allow_failure: true
|
||||
script:
|
||||
- .gitlab-ci/run-style-check-diff.sh
|
||||
@@ -110,29 +109,6 @@ release-build:
|
||||
- ninja -C _build
|
||||
- .gitlab-ci/run-tests.sh _build x11
|
||||
|
||||
fedora-mingw64:
|
||||
extends: .build-fedora-default
|
||||
stage: build
|
||||
needs: []
|
||||
before_script:
|
||||
- sudo dnf install -y
|
||||
mingw64-filesystem
|
||||
mingw64-gcc
|
||||
mingw64-binutils
|
||||
mingw64-cairo
|
||||
mingw64-gdk-pixbuf
|
||||
mingw64-gstreamer1-plugins-bad-free
|
||||
mingw64-glib2
|
||||
mingw64-libepoxy
|
||||
mingw64-pango
|
||||
# mingw64-graphene (rawhide)
|
||||
script:
|
||||
- .gitlab-ci/show-info-linux.sh
|
||||
- meson subprojects update
|
||||
- mkdir _build && cd _build
|
||||
- mingw64-meson -Dintrospection=disabled -Dgraphene:introspection=disabled
|
||||
- ninja
|
||||
|
||||
installed-tests:
|
||||
extends: .build-fedora-default
|
||||
stage: build
|
||||
@@ -192,7 +168,6 @@ macos:
|
||||
only:
|
||||
- branches@GNOME/gtk
|
||||
stage: build
|
||||
allow_failure: true
|
||||
tags:
|
||||
- macos
|
||||
needs: []
|
||||
@@ -294,18 +269,6 @@ flatpak-main:icon-browser:
|
||||
variables:
|
||||
APPID: org.gtk.IconBrowser4
|
||||
|
||||
flatpak-manual:node-editor:
|
||||
extends: .flatpak-manual
|
||||
needs: []
|
||||
variables:
|
||||
APPID: org.gtk.gtk4.NodeEditor
|
||||
|
||||
flatpak-main:node-editor:
|
||||
extends: .flatpak-main
|
||||
needs: []
|
||||
variables:
|
||||
APPID: org.gtk.gtk4.NodeEditor
|
||||
|
||||
# Publish the demo apps to the GNOME Nightly repo
|
||||
# https://wiki.gnome.org/Apps/Nightly
|
||||
# https://gitlab.gnome.org/GNOME/Initiatives/-/wikis/DevOps-with-Flatpak
|
||||
@@ -324,11 +287,6 @@ nightly icon-browser:
|
||||
dependencies: ['flatpak-main:icon-browser']
|
||||
needs: ['flatpak-main:icon-browser']
|
||||
|
||||
nightly node-editor:
|
||||
extends: '.publish_nightly'
|
||||
dependencies: ['flatpak-main:node-editor']
|
||||
needs: ['flatpak-main:node-editor']
|
||||
|
||||
static-scan:
|
||||
image: $FEDORA_IMAGE
|
||||
stage: analysis
|
||||
|
@@ -16,7 +16,7 @@ flatpak-builder \
|
||||
flatpak build ${builddir} meson \
|
||||
--prefix=/app \
|
||||
--libdir=/app/lib \
|
||||
--buildtype=debugoptimized \
|
||||
--buildtype=release \
|
||||
-Dx11-backend=true \
|
||||
-Dwayland-backend=true \
|
||||
-Dbuild-tests=false \
|
||||
|
@@ -2,43 +2,25 @@
|
||||
|
||||
set -e
|
||||
|
||||
ancestor_horizon=31 # days (one month)
|
||||
|
||||
# Recently, git is picky about directory ownership. Tell it not to worry.
|
||||
git config --global --add safe.directory "$PWD"
|
||||
|
||||
# We need to add a new remote for the upstream target branch, since this script
|
||||
# could be running in a personal fork of the repository which has out of date
|
||||
# branches.
|
||||
#
|
||||
# Limit the fetch to a certain date horizon to limit the amount of data we get.
|
||||
# If the branch was forked from origin/main before this horizon, it should
|
||||
# probably be rebased.
|
||||
if ! git ls-remote --exit-code upstream >/dev/null 2>&1 ; then
|
||||
# We need to add a new remote for the upstream main, since this script could
|
||||
# be running in a personal fork of the repository which has out of date branches.
|
||||
if [ "${CI_PROJECT_NAMESPACE}" != "GNOME" ]; then
|
||||
echo "Retrieving the current upstream repository from ${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}..."
|
||||
git remote add upstream https://gitlab.gnome.org/GNOME/gtk.git
|
||||
git fetch upstream
|
||||
ORIGIN="upstream"
|
||||
else
|
||||
echo "Reusing the existing repository on ${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}"
|
||||
ORIGIN="origin"
|
||||
fi
|
||||
|
||||
# Work out the newest common ancestor between the detached HEAD that this CI job
|
||||
# has checked out, and the upstream target branch (which will typically be
|
||||
# `upstream/main` or `upstream/glib-2-62`).
|
||||
# `${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}` or `${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}`
|
||||
# are only defined if we’re running in a merge request pipeline,
|
||||
# fall back to `${CI_DEFAULT_BRANCH}` or `${CI_COMMIT_BRANCH}` respectively
|
||||
# otherwise.
|
||||
|
||||
source_branch="${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:-${CI_COMMIT_BRANCH}}"
|
||||
target_branch="${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-${CI_DEFAULT_BRANCH}}"
|
||||
git fetch --shallow-since="$(date --date="${ancestor_horizon} days ago" +%Y-%m-%d)" origin "${source_branch}"
|
||||
git fetch --shallow-since="$(date --date="${ancestor_horizon} days ago" +%Y-%m-%d)" upstream "${target_branch}"
|
||||
|
||||
newest_common_ancestor_sha=$(git merge-base upstream/${target_branch} origin/${source_branch})
|
||||
if [ -z "${newest_common_ancestor_sha}" ]; then
|
||||
echo "Couldn’t find common ancestor with upstream main branch. This typically"
|
||||
echo "happens if you branched from main a long time ago. Please update"
|
||||
echo "your clone, rebase, and re-push your branch."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# `upstream/main` or `upstream/gtk-3-24`).
|
||||
#
|
||||
# `${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}` is only defined if we’re running in
|
||||
# a merge request pipeline; fall back to `${CI_DEFAULT_BRANCH}` otherwise.
|
||||
newest_common_ancestor_sha=$(diff --old-line-format='' --new-line-format='' <(git rev-list --first-parent "${ORIGIN}/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-${CI_DEFAULT_BRANCH}}") <(git rev-list --first-parent HEAD) | head -1)
|
||||
git diff -U0 --no-color "${newest_common_ancestor_sha}" | .gitlab-ci/clang-format-diff.py -binary "clang-format" -p1
|
||||
exit_status=$?
|
||||
|
||||
@@ -54,7 +36,7 @@ exit_status=$?
|
||||
echo ""
|
||||
echo "Note that clang-format output is advisory and cannot always match the"
|
||||
echo "GTK coding style, documented at:"
|
||||
echo " https://gitlab.gnome.org/GNOME/gtk/blob/main/docs/CODING-STYLE.md"
|
||||
echo " https://gitlab.gnome.org/GNOME/gtk/blob/main/docs/CODING-STYLE"
|
||||
echo "Warnings from this tool can be ignored in favour of the documented "
|
||||
echo "coding style, or in favour of matching the style of existing"
|
||||
echo "surrounding code."
|
||||
|
@@ -38,6 +38,25 @@ mkdir -p _ccache
|
||||
export CCACHE_BASEDIR="$(pwd)"
|
||||
export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
|
||||
|
||||
# https://gitlab.gnome.org/GNOME/gtk/-/issues/2243
|
||||
# https://gitlab.gnome.org/GNOME/gtk/-/issues/3002
|
||||
|
||||
if ! pkg-config --atleast-version=2.66.0 glib-2.0; then
|
||||
git clone https://gitlab.gnome.org/GNOME/glib.git _glib
|
||||
meson setup _glib_build _glib
|
||||
meson compile -C _glib_build
|
||||
meson install -C _glib_build
|
||||
fi
|
||||
pkg-config --modversion glib-2.0
|
||||
|
||||
if ! pkg-config --atleast-version=1.50.0 pango; then
|
||||
git clone https://gitlab.gnome.org/GNOME/pango.git _pango
|
||||
meson setup _pango_build _pango
|
||||
meson compile -C _pango_build
|
||||
meson install -C _pango_build
|
||||
fi
|
||||
pkg-config --modversion pango
|
||||
|
||||
# Build
|
||||
ccache --zero-stats
|
||||
ccache --show-stats
|
||||
|
227
NEWS
227
NEWS
@@ -1,230 +1,3 @@
|
||||
Overview of Changes in 4.9.1, dd-mm-yyyy
|
||||
========================================
|
||||
|
||||
Note that deprecations are an early outlook
|
||||
at changes that will appear in an eventual
|
||||
GTK 5 release, which is still far away.
|
||||
|
||||
* GtkTreeView, GtkIconView, GtkComboBox and
|
||||
auxiliary classes have been deprecated
|
||||
|
||||
* GtkEntryCompletion has been deprecated
|
||||
|
||||
* GtkStyleContext has been deprecated
|
||||
|
||||
* gtk_render_ and gtk_snapshot_render_ APIs
|
||||
have been deprecated
|
||||
|
||||
* GtkAppChooser widgets hae been deprecated
|
||||
|
||||
* GtkMountOperation:
|
||||
- Fix the dialog to look reasonable
|
||||
- Make it work under non-X11
|
||||
|
||||
* GtkStringSorter:
|
||||
- Support different collation methods
|
||||
|
||||
* Accessibility:
|
||||
- Introduce GtkAccessibleRange and implement it
|
||||
|
||||
* Debugging:
|
||||
- Unify formatting for debug output
|
||||
- Make make debug options available in
|
||||
non-debug builds
|
||||
|
||||
* Translation updates:
|
||||
Abkhazian
|
||||
Basque
|
||||
Bulgarian
|
||||
Croatian
|
||||
Friulian
|
||||
Georgian
|
||||
German
|
||||
Hungarian
|
||||
Russian
|
||||
Turkish
|
||||
|
||||
|
||||
Overview of Changes in 4.8.1, 16-09-2022
|
||||
========================================
|
||||
|
||||
* Input:
|
||||
- Fix problems with input method interactions that caused
|
||||
dead keys not to work
|
||||
- Accept single-key compose sequences (these are used with
|
||||
some keyboard layouts)
|
||||
|
||||
* GtkColumnView:
|
||||
- Flip column order in right-to-left context
|
||||
|
||||
* GtkGridView:
|
||||
- Fix problems with rubberbanding
|
||||
|
||||
* GtkFileChooser:
|
||||
- Fix positioning of popovers in the places view
|
||||
- Make ~ and . keyboard shortcuts work again
|
||||
|
||||
* gsk:
|
||||
- Make glyph upload more similar to icons
|
||||
|
||||
* Make file transfer via portals work, this fixes file
|
||||
copy/paste and dnd in flatpaks
|
||||
|
||||
* Translation updates:
|
||||
Catalan
|
||||
Chinese (China)
|
||||
Chinese (Taiwan)
|
||||
Latvian
|
||||
|
||||
|
||||
Overview of Changes in 4.8.0, 06-09-2022
|
||||
========================================
|
||||
|
||||
* GtkTreeView:
|
||||
- Fix a problem with scrolling animations
|
||||
- Fix some event handling problems
|
||||
- Drop unreachable code
|
||||
|
||||
* GtkText:
|
||||
- Respect the no-emoji input hint fully
|
||||
|
||||
* GtkEmojiChooser:
|
||||
- Fix arrow key navigation
|
||||
|
||||
* GtkFontChooser:
|
||||
- Improve the handling of OpenType font features
|
||||
|
||||
* GtkTreeListModel:
|
||||
- Fix handling of collapsed child nodes
|
||||
|
||||
* GtkInscription:
|
||||
- Fix accessible name
|
||||
|
||||
* Theme:
|
||||
- Fix placeholder text in HighContrast
|
||||
|
||||
* Increase the memory limit for the jpeg loader to 300M
|
||||
|
||||
* Miscellaneous memory leak fixes
|
||||
|
||||
* Wayland:
|
||||
- Refator handling of text protocol client updates
|
||||
|
||||
* Windows:
|
||||
- Support high-resolution scroll wheel events
|
||||
- Generate GdkWin32.gir
|
||||
- Implement color picking
|
||||
|
||||
* Translation updates
|
||||
Abkhazian
|
||||
Basque
|
||||
Brazilian Portuguese
|
||||
Bulgarian
|
||||
Catalan
|
||||
Chinese (China)
|
||||
Croatian
|
||||
Czech
|
||||
Danish
|
||||
Dutch
|
||||
Galician
|
||||
Georgian
|
||||
German
|
||||
Hungarian
|
||||
Icelandic
|
||||
Indonesian
|
||||
Korean
|
||||
Latvian
|
||||
Lithuanian
|
||||
Persian
|
||||
Polish
|
||||
Portuguese
|
||||
Russian
|
||||
Serbian
|
||||
Spanish
|
||||
Swedish
|
||||
Turkish
|
||||
Ukrainian
|
||||
|
||||
|
||||
Overview of Changes in 4.7.2, 10-08-2022
|
||||
========================================
|
||||
|
||||
* GtkTextView:
|
||||
- Fix child positioning with gutters
|
||||
|
||||
* GtkText:
|
||||
- Update placeholder visibility when necessary
|
||||
|
||||
* GtkPicture:
|
||||
- Add a content-fit property
|
||||
|
||||
* GtkPopover:
|
||||
- Fix a size allocation problem with the arrow
|
||||
|
||||
* GtkTreeView:
|
||||
- Fix a problem with DND
|
||||
|
||||
* GtkTreePopover:
|
||||
- Support scrolling
|
||||
|
||||
* GtkGridView:
|
||||
- Fix issues with rubberband selection
|
||||
|
||||
* GtkLabel:
|
||||
- Add a tabs property
|
||||
|
||||
* GtkSnapshot:
|
||||
- Make GtkSnapshot work from bindings
|
||||
|
||||
* GtkScrolledWindow:
|
||||
- Scroll at a reasonable speed
|
||||
|
||||
* GtkPaned:
|
||||
- Avoid an infinite loop
|
||||
|
||||
* GtkWindow:
|
||||
- Improve generation and handling of crossing events
|
||||
|
||||
* CSS:
|
||||
- Fix handling of certain transform values
|
||||
|
||||
* Media support:
|
||||
- Add audio support to the ffmpeg backend
|
||||
- Avoid oom with pathological jpeg images
|
||||
|
||||
* GDK:
|
||||
- Fix handling of touchpad hold events
|
||||
- Add support for hi-resolution scroll events
|
||||
|
||||
* X11:
|
||||
- Fix preferred action for DND
|
||||
|
||||
* Windows:
|
||||
- Fix DND
|
||||
|
||||
* List models:
|
||||
- Fix items-changed emission
|
||||
- Add more list model tests
|
||||
|
||||
* Demos:
|
||||
- Add a winning sound to game demos
|
||||
- Make app icons work uninstalled
|
||||
|
||||
* Translation updates:
|
||||
Abkhazian
|
||||
Basque
|
||||
Catalan
|
||||
Georgian
|
||||
German
|
||||
Indonesian
|
||||
Occitan
|
||||
Persian
|
||||
Portuguese
|
||||
Russian
|
||||
Spanish
|
||||
Ukrainian
|
||||
|
||||
|
||||
Overview of Changes in 4.7.1, 12-07-2022
|
||||
========================================
|
||||
|
||||
|
@@ -1,138 +0,0 @@
|
||||
{
|
||||
"app-id" : "org.gtk.gtk4.NodeEditor",
|
||||
"runtime" : "org.gnome.Platform",
|
||||
"runtime-version" : "master",
|
||||
"sdk" : "org.gnome.Sdk",
|
||||
"command" : "gtk4-node-editor",
|
||||
"tags" : [
|
||||
"devel",
|
||||
"development",
|
||||
"nightly"
|
||||
],
|
||||
"desktop-file-name-prefix" : "(Development) ",
|
||||
"finish-args" : [
|
||||
"--device=dri",
|
||||
"--share=ipc",
|
||||
"--socket=fallback-x11",
|
||||
"--socket=wayland",
|
||||
"--talk-name=org.gtk.vfs",
|
||||
"--talk-name=org.gtk.vfs.*"
|
||||
],
|
||||
"cleanup" : [
|
||||
"/include",
|
||||
"/lib/pkgconfig",
|
||||
"/share/pkgconfig",
|
||||
"/share/aclocal",
|
||||
"/man",
|
||||
"/share/man",
|
||||
"/share/gtk-doc",
|
||||
"*.la",
|
||||
".a",
|
||||
"/lib/girepository-1.0",
|
||||
"/share/gir-1.0",
|
||||
"/share/doc"
|
||||
],
|
||||
"modules" : [
|
||||
{
|
||||
"name" : "wayland",
|
||||
"buildsystem" : "meson",
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"-Ddocumentation=false"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
"type" : "git",
|
||||
"url" : "https://gitlab.freedesktop.org/wayland/wayland.git",
|
||||
"branch" : "main"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "graphene",
|
||||
"buildsystem" : "meson",
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dtests=false"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
"type" : "git",
|
||||
"url" : "https://github.com/ebassi/graphene.git"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "libsass",
|
||||
"buildsystem" : "meson",
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
"type" : "git",
|
||||
"url" : "https://github.com/lazka/libsass.git",
|
||||
"branch" : "meson"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "sassc",
|
||||
"buildsystem" : "meson",
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
"type" : "git",
|
||||
"url" : "https://github.com/lazka/sassc.git",
|
||||
"branch" : "meson"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "pango",
|
||||
"buildsystem" : "meson",
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
"type" : "git",
|
||||
"url" : "https://gitlab.gnome.org/GNOME/pango.git",
|
||||
"branch" : "main"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "gtk",
|
||||
"buildsystem" : "meson",
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dvulkan=disabled",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Dprofile=devel"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
"type" : "git",
|
||||
"url" : "https://gitlab.gnome.org/GNOME/gtk.git",
|
||||
"branch" : "main"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"build-options" : {
|
||||
"env" : {
|
||||
"DBUS_SESSION_BUS_ADDRESS" : "''",
|
||||
"GSK_RENDERER" : "opengl",
|
||||
"GDK_DEBUG" : "vulkan-disable",
|
||||
"G_ENABLE_DEBUG" : "true"
|
||||
}
|
||||
}
|
||||
}
|
45
build-aux/meson/post-install.py
Normal file
45
build-aux/meson/post-install.py
Normal file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
if 'DESTDIR' not in os.environ:
|
||||
gtk_api_version = sys.argv[1]
|
||||
gtk_abi_version = sys.argv[2]
|
||||
gtk_libdir = sys.argv[3]
|
||||
gtk_datadir = sys.argv[4]
|
||||
gtk_bindir = sys.argv[5]
|
||||
|
||||
gtk_moduledir = os.path.join(gtk_libdir, 'gtk-' + gtk_api_version, gtk_abi_version)
|
||||
gtk_printmodule_dir = os.path.join(gtk_moduledir, 'printbackends')
|
||||
gtk_mediamodule_dir = os.path.join(gtk_moduledir, 'media')
|
||||
|
||||
print('Compiling GSettings schemas...')
|
||||
glib_compile_schemas = subprocess.check_output(['pkg-config',
|
||||
'--variable=glib_compile_schemas',
|
||||
'gio-2.0']).strip()
|
||||
if not os.path.exists(glib_compile_schemas):
|
||||
# pkg-config variables only available since GLib 2.62.0.
|
||||
glib_compile_schemas = 'glib-compile-schemas'
|
||||
subprocess.call([glib_compile_schemas,
|
||||
os.path.join(gtk_datadir, 'glib-2.0', 'schemas')])
|
||||
|
||||
print('Updating icon cache...')
|
||||
update_icon_cache = os.path.join(gtk_bindir, 'gtk4-update-icon-cache')
|
||||
subprocess.call([update_icon_cache, '-q', '-t' ,'-f',
|
||||
os.path.join(gtk_datadir, 'icons', 'hicolor')])
|
||||
|
||||
print('Updating module cache for print backends...')
|
||||
os.makedirs(gtk_printmodule_dir, exist_ok=True)
|
||||
gio_querymodules = subprocess.check_output(['pkg-config',
|
||||
'--variable=gio_querymodules',
|
||||
'gio-2.0']).strip()
|
||||
if not os.path.exists(gio_querymodules):
|
||||
# pkg-config variables only available since GLib 2.62.0.
|
||||
gio_querymodules = 'gio-querymodules'
|
||||
subprocess.call([gio_querymodules, gtk_printmodule_dir])
|
||||
|
||||
print('Updating module cache for media backends...')
|
||||
os.makedirs(gtk_mediamodule_dir, exist_ok=True)
|
||||
subprocess.call([gio_querymodules, gtk_mediamodule_dir])
|
@@ -21,8 +21,6 @@
|
||||
|
||||
#include "constraint-editor.h"
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
struct _ConstraintEditor
|
||||
{
|
||||
GtkWidget parent_instance;
|
||||
|
@@ -21,8 +21,6 @@
|
||||
|
||||
#include "guide-editor.h"
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
struct _GuideEditor
|
||||
{
|
||||
GtkWidget parent_instance;
|
||||
|
@@ -11,8 +11,6 @@
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
enum
|
||||
{
|
||||
ICON_NAME_COL,
|
||||
|
@@ -1,16 +1,20 @@
|
||||
/* Theming/CSS Accordion
|
||||
*
|
||||
* A simple accordion demo written using CSS transitions and multiple backgrounds
|
||||
*
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static void
|
||||
destroy_provider (GtkWidget *window,
|
||||
GtkStyleProvider *provider)
|
||||
apply_css (GtkWidget *widget, GtkStyleProvider *provider)
|
||||
{
|
||||
gtk_style_context_remove_provider_for_display (gtk_widget_get_display (window), provider);
|
||||
GtkWidget *child;
|
||||
|
||||
gtk_style_context_add_provider (gtk_widget_get_style_context (widget), provider, G_MAXUINT);
|
||||
for (child = gtk_widget_get_first_child (widget);
|
||||
child != NULL;
|
||||
child = gtk_widget_get_next_sibling (child))
|
||||
apply_css (child, provider);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
@@ -20,8 +24,8 @@ do_css_accordion (GtkWidget *do_widget)
|
||||
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *container, *styled_box, *child;
|
||||
GtkCssProvider *provider;
|
||||
GtkWidget *container, *child;
|
||||
GtkStyleProvider *provider;
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_title (GTK_WINDOW (window), "CSS Accordion");
|
||||
@@ -29,13 +33,10 @@ do_css_accordion (GtkWidget *do_widget)
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 600, 300);
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
styled_box = gtk_frame_new (NULL);
|
||||
gtk_window_set_child (GTK_WINDOW (window), styled_box);
|
||||
gtk_widget_add_css_class (styled_box, "accordion");
|
||||
container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_widget_set_halign (container, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (container, GTK_ALIGN_CENTER);
|
||||
gtk_frame_set_child (GTK_FRAME (styled_box), container);
|
||||
gtk_window_set_child (GTK_WINDOW (window), container);
|
||||
|
||||
child = gtk_button_new_with_label ("This");
|
||||
gtk_box_append (GTK_BOX (container), child);
|
||||
@@ -55,16 +56,10 @@ do_css_accordion (GtkWidget *do_widget)
|
||||
child = gtk_button_new_with_label (":-)");
|
||||
gtk_box_append (GTK_BOX (container), child);
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_resource (provider, "/css_accordion/css_accordion.css");
|
||||
provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
|
||||
gtk_css_provider_load_from_resource (GTK_CSS_PROVIDER (provider), "/css_accordion/css_accordion.css");
|
||||
|
||||
gtk_style_context_add_provider_for_display (gtk_widget_get_display (window),
|
||||
GTK_STYLE_PROVIDER (provider),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (destroy_provider), provider);
|
||||
g_object_unref (provider);
|
||||
apply_css (window, provider);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
@@ -1,13 +1,13 @@
|
||||
.accordion, .accordion * {
|
||||
all: unset;
|
||||
@import url("resource://css_accordion/reset.css");
|
||||
|
||||
* {
|
||||
transition-property: color, background-color, border-color, background-image, padding, border-width;
|
||||
transition-duration: 1s;
|
||||
|
||||
font: 20px Cantarell;
|
||||
}
|
||||
|
||||
.accordion {
|
||||
window {
|
||||
background: linear-gradient(153deg, #151515, #151515 5px, transparent 5px) 0 0,
|
||||
linear-gradient(333deg, #151515, #151515 5px, transparent 5px) 10px 5px,
|
||||
linear-gradient(153deg, #222, #222 5px, transparent 5px) 0 5px,
|
||||
@@ -18,7 +18,7 @@
|
||||
background-size: 20px 20px;
|
||||
}
|
||||
|
||||
.accordion button {
|
||||
button {
|
||||
color: black;
|
||||
background-color: #bbb;
|
||||
border-style: solid;
|
||||
@@ -28,25 +28,25 @@
|
||||
padding: 12px 4px;
|
||||
}
|
||||
|
||||
.accordion button:first-child {
|
||||
button:first-child {
|
||||
border-radius: 5px 0 0 5px;
|
||||
}
|
||||
|
||||
.accordion button:last-child {
|
||||
button:last-child {
|
||||
border-radius: 0 5px 5px 0;
|
||||
border-width: 2px;
|
||||
}
|
||||
|
||||
.accordion button:hover {
|
||||
button:hover {
|
||||
padding: 12px 48px;
|
||||
background-color: #4870bc;
|
||||
}
|
||||
|
||||
.accordion button *:hover {
|
||||
button *:hover {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.accordion button:hover:active,
|
||||
.accordion button:active {
|
||||
button:hover:active,
|
||||
button:active {
|
||||
background-color: #993401;
|
||||
}
|
||||
|
@@ -6,8 +6,6 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
static void
|
||||
show_parsing_error (GtkCssProvider *provider,
|
||||
GtkCssSection *section,
|
||||
|
@@ -6,8 +6,6 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
static void
|
||||
show_parsing_error (GtkCssProvider *provider,
|
||||
GtkCssSection *section,
|
||||
|
@@ -7,8 +7,6 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
static void
|
||||
show_parsing_error (GtkCssProvider *provider,
|
||||
GtkCssSection *section,
|
||||
|
@@ -5,8 +5,6 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
static void
|
||||
show_parsing_error (GtkCssProvider *provider,
|
||||
GtkCssSection *section,
|
||||
|
@@ -24,6 +24,7 @@
|
||||
</gresource>
|
||||
<gresource prefix="/css_accordion">
|
||||
<file>css_accordion.css</file>
|
||||
<file>reset.css</file>
|
||||
</gresource>
|
||||
<gresource prefix="/css_basics">
|
||||
<file>css_basics.css</file>
|
||||
@@ -427,8 +428,6 @@
|
||||
<file>icons/16x16/emotes/face-laugh-symbolic.symbolic.png</file>
|
||||
<file>icons/16x16/status/battery-caution-charging-symbolic.symbolic.png</file>
|
||||
<file>icons/16x16/categories/applications-other.png</file>
|
||||
<file>icons/48x48/status/starred.png</file>
|
||||
<file alias="icons/scalable/apps/org.gtk.Demo4.svg">data/scalable/apps/org.gtk.Demo4.svg</file>
|
||||
</gresource>
|
||||
<gresource prefix="/org/gtk/Demo4/gtk">
|
||||
<file preprocess="xml-stripblanks">help-overlay.ui</file>
|
||||
|
@@ -11,7 +11,6 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
|
||||
G_DECLARE_FINAL_TYPE (CanvasItem, canvas_item, CANVAS, ITEM, GtkWidget)
|
||||
|
||||
struct _CanvasItem {
|
||||
@@ -25,9 +24,6 @@ struct _CanvasItem {
|
||||
double delta;
|
||||
|
||||
GtkWidget *editor;
|
||||
|
||||
GtkStyleProvider *provider;
|
||||
char *css_class;
|
||||
};
|
||||
|
||||
struct _CanvasItemClass {
|
||||
@@ -38,41 +34,32 @@ G_DEFINE_TYPE (CanvasItem, canvas_item, GTK_TYPE_WIDGET)
|
||||
|
||||
static int n_items = 0;
|
||||
|
||||
static void
|
||||
unstyle_item (CanvasItem *item)
|
||||
{
|
||||
if (item->provider)
|
||||
{
|
||||
gtk_style_context_remove_provider_for_display (gtk_widget_get_display (item->label), item->provider);
|
||||
g_clear_object (&item->provider);
|
||||
}
|
||||
|
||||
if (item->css_class)
|
||||
{
|
||||
gtk_widget_remove_css_class (item->label, item->css_class);
|
||||
g_clear_pointer (&item->css_class, g_free);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
set_color (CanvasItem *item,
|
||||
GdkRGBA *color)
|
||||
{
|
||||
char *css;
|
||||
char *str;
|
||||
GtkStyleContext *context;
|
||||
GtkCssProvider *provider;
|
||||
const char *name;
|
||||
|
||||
unstyle_item (item);
|
||||
const char *old_class;
|
||||
|
||||
str = gdk_rgba_to_string (color);
|
||||
name = gtk_widget_get_name (item->label);
|
||||
css = g_strdup_printf ("#%s { background: %s; }", name, str);
|
||||
css = g_strdup_printf ("* { background: %s; }", str);
|
||||
|
||||
context = gtk_widget_get_style_context (item->label);
|
||||
provider = g_object_get_data (G_OBJECT (context), "style-provider");
|
||||
if (provider)
|
||||
gtk_style_context_remove_provider (context, GTK_STYLE_PROVIDER (provider));
|
||||
|
||||
old_class = (const char *)g_object_get_data (G_OBJECT (item->label), "css-class");
|
||||
if (old_class)
|
||||
gtk_widget_remove_css_class (item->label, old_class);
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
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);
|
||||
gtk_style_context_add_provider (gtk_widget_get_style_context (item->label), GTK_STYLE_PROVIDER (provider), 800);
|
||||
g_object_set_data_full (G_OBJECT (context), "style-provider", provider, g_object_unref);
|
||||
|
||||
g_free (str);
|
||||
g_free (css);
|
||||
@@ -82,10 +69,21 @@ static void
|
||||
set_css (CanvasItem *item,
|
||||
const char *class)
|
||||
{
|
||||
unstyle_item (item);
|
||||
GtkStyleContext *context;
|
||||
GtkCssProvider *provider;
|
||||
const char *old_class;
|
||||
|
||||
context = gtk_widget_get_style_context (item->label);
|
||||
provider = g_object_get_data (G_OBJECT (context), "style-provider");
|
||||
if (provider)
|
||||
gtk_style_context_remove_provider (context, GTK_STYLE_PROVIDER (provider));
|
||||
|
||||
old_class = (const char *)g_object_get_data (G_OBJECT (item->label), "css-class");
|
||||
if (old_class)
|
||||
gtk_widget_remove_css_class (item->label, old_class);
|
||||
|
||||
g_object_set_data_full (G_OBJECT (item->label), "css-class", g_strdup (class), g_free);
|
||||
gtk_widget_add_css_class (item->label, class);
|
||||
item->css_class = g_strdup (class);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -724,7 +722,6 @@ do_dnd (GtkWidget *do_widget)
|
||||
int i;
|
||||
int x, y;
|
||||
GtkCssProvider *provider;
|
||||
GString *css;
|
||||
|
||||
button = gtk_color_button_new ();
|
||||
g_object_unref (g_object_ref_sink (button));
|
||||
@@ -736,18 +733,6 @@ do_dnd (GtkWidget *do_widget)
|
||||
800);
|
||||
g_object_unref (provider);
|
||||
|
||||
css = g_string_new ("");
|
||||
for (i = 0; colors[i]; i++)
|
||||
g_string_append_printf (css, ".canvasitem.%s { background: %s; }\n", colors[i], colors[i]);
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
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);
|
||||
g_object_unref (provider);
|
||||
g_string_free (css, TRUE);
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
|
@@ -14,8 +14,6 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int number;
|
||||
|
@@ -8,8 +8,6 @@
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
/* Creates a tree model containing the completions */
|
||||
static GtkTreeModel *
|
||||
create_completion_model (void)
|
||||
|
@@ -9,8 +9,6 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
enum {
|
||||
WIDTH_COLUMN,
|
||||
HEIGHT_COLUMN,
|
||||
|
@@ -21,75 +21,6 @@
|
||||
#include "script-names.h"
|
||||
#include "language-names.h"
|
||||
|
||||
/* {{{ ScriptLang object */
|
||||
|
||||
G_DECLARE_FINAL_TYPE (ScriptLang, script_lang, SCRIPT, LANG, GObject)
|
||||
|
||||
struct _ScriptLang
|
||||
{
|
||||
GObject parent;
|
||||
|
||||
char *langname;
|
||||
unsigned int script_index;
|
||||
unsigned int lang_index;
|
||||
hb_tag_t lang_tag;
|
||||
};
|
||||
|
||||
struct _ScriptLangClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (ScriptLang, script_lang, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
script_lang_init (ScriptLang *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
script_lang_finalize (GObject *object)
|
||||
{
|
||||
ScriptLang *self = SCRIPT_LANG (object);
|
||||
|
||||
g_free (self->langname);
|
||||
|
||||
G_OBJECT_CLASS (script_lang_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
script_lang_class_init (ScriptLangClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
|
||||
object_class->finalize = script_lang_finalize;
|
||||
}
|
||||
|
||||
static ScriptLang *
|
||||
script_lang_new (const char *langname,
|
||||
unsigned int script_index,
|
||||
unsigned int lang_index,
|
||||
hb_tag_t lang_tag)
|
||||
{
|
||||
ScriptLang *self;
|
||||
|
||||
self = g_object_new (script_lang_get_type (), NULL);
|
||||
|
||||
self->langname = g_strdup (langname);
|
||||
self->script_index = script_index;
|
||||
self->lang_index = lang_index;
|
||||
self->lang_tag = lang_tag;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static char *
|
||||
script_lang_get_langname (ScriptLang *self)
|
||||
{
|
||||
return g_strdup (self->langname);
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
#define MAKE_TAG(a,b,c,d) (unsigned int)(((a) << 24) | ((b) << 16) | ((c) << 8) | (d))
|
||||
|
||||
@@ -163,10 +94,6 @@ demo_free (gpointer data)
|
||||
g_clear_pointer (&demo->axes, g_hash_table_unref);
|
||||
g_clear_pointer (&demo->text, g_free);
|
||||
|
||||
gtk_style_context_remove_provider_for_display (gdk_display_get_default (),
|
||||
GTK_STYLE_PROVIDER (demo->provider));
|
||||
g_object_unref (demo->provider);
|
||||
|
||||
g_free (demo);
|
||||
}
|
||||
|
||||
@@ -544,6 +471,8 @@ update_display (void)
|
||||
GString *s;
|
||||
char *text;
|
||||
gboolean has_feature;
|
||||
GtkTreeIter iter;
|
||||
GtkTreeModel *model;
|
||||
PangoFontDescription *desc;
|
||||
GList *l;
|
||||
PangoAttrList *attrs;
|
||||
@@ -646,13 +575,14 @@ update_display (void)
|
||||
|
||||
features = g_string_free (s, FALSE);
|
||||
|
||||
if (gtk_drop_down_get_selected (GTK_DROP_DOWN (demo->script_lang)) != 0)
|
||||
if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (demo->script_lang), &iter))
|
||||
{
|
||||
ScriptLang *selected;
|
||||
hb_tag_t lang_tag;
|
||||
|
||||
selected = gtk_drop_down_get_selected_item (GTK_DROP_DOWN (demo->script_lang));
|
||||
model = gtk_combo_box_get_model (GTK_COMBO_BOX (demo->script_lang));
|
||||
gtk_tree_model_get (model, &iter, 3, &lang_tag, -1);
|
||||
|
||||
lang = pango_language_from_string (hb_language_to_string (hb_ot_tag_to_language (selected->lang_tag)));
|
||||
lang = pango_language_from_string (hb_language_to_string (hb_ot_tag_to_language (lang_tag)));
|
||||
}
|
||||
else
|
||||
lang = NULL;
|
||||
@@ -809,30 +739,40 @@ tag_pair_equal (gconstpointer a, gconstpointer b)
|
||||
return pair_a->script_tag == pair_b->script_tag && pair_a->lang_tag == pair_b->lang_tag;
|
||||
}
|
||||
|
||||
|
||||
static GtkOrdering
|
||||
script_sort (const void *item1,
|
||||
const void *item2,
|
||||
void *data)
|
||||
static int
|
||||
script_sort_func (GtkTreeModel *model,
|
||||
GtkTreeIter *a,
|
||||
GtkTreeIter *b,
|
||||
gpointer user_data)
|
||||
{
|
||||
ScriptLang *a = (ScriptLang *)item1;
|
||||
ScriptLang *b = (ScriptLang *)item2;
|
||||
char *sa, *sb;
|
||||
int ret;
|
||||
|
||||
return strcmp (a->langname, b->langname);
|
||||
gtk_tree_model_get (model, a, 0, &sa, -1);
|
||||
gtk_tree_model_get (model, b, 0, &sb, -1);
|
||||
|
||||
ret = strcmp (sa, sb);
|
||||
|
||||
g_free (sa);
|
||||
g_free (sb);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
update_script_combo (void)
|
||||
{
|
||||
GListStore *store;
|
||||
GtkSortListModel *sortmodel;
|
||||
GtkListStore *store;
|
||||
hb_font_t *hb_font;
|
||||
int i, j, k;
|
||||
PangoFont *pango_font;
|
||||
GHashTable *tags;
|
||||
GHashTableIter iter;
|
||||
TagPair *pair;
|
||||
char *lang;
|
||||
hb_tag_t active;
|
||||
GtkTreeIter active_iter;
|
||||
gboolean have_active = FALSE;
|
||||
|
||||
lang = gtk_font_chooser_get_language (GTK_FONT_CHOOSER (demo->font));
|
||||
|
||||
@@ -842,7 +782,7 @@ update_script_combo (void)
|
||||
|
||||
g_free (lang);
|
||||
|
||||
store = g_list_store_new (script_lang_get_type ());
|
||||
store = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT);
|
||||
|
||||
pango_font = get_pango_font ();
|
||||
hb_font = pango_font_get_hb_font (pango_font);
|
||||
@@ -866,19 +806,19 @@ update_script_combo (void)
|
||||
|
||||
hb_face = hb_font_get_face (hb_font);
|
||||
|
||||
for (guint i = 0; i < 2; i++)
|
||||
for (i= 0; i < 2; i++)
|
||||
{
|
||||
hb_tag_t scripts[80];
|
||||
unsigned int script_count = G_N_ELEMENTS (scripts);
|
||||
|
||||
hb_ot_layout_table_get_script_tags (hb_face, tables[i], 0, &script_count, scripts);
|
||||
for (guint j = 0; j < script_count; j++)
|
||||
for (j = 0; j < script_count; j++)
|
||||
{
|
||||
hb_tag_t languages[80];
|
||||
unsigned int language_count = G_N_ELEMENTS (languages);
|
||||
|
||||
hb_ot_layout_script_get_language_tags (hb_face, tables[i], j, 0, &language_count, languages);
|
||||
for (guint k = 0; k < language_count; k++)
|
||||
for (k = 0; k < language_count; k++)
|
||||
{
|
||||
pair = g_new (TagPair, 1);
|
||||
pair->script_tag = scripts[j];
|
||||
@@ -898,6 +838,7 @@ update_script_combo (void)
|
||||
{
|
||||
const char *langname;
|
||||
char langbuf[5];
|
||||
GtkTreeIter tree_iter;
|
||||
|
||||
if (pair->lang_tag == 0 && pair->script_tag == 0)
|
||||
langname = NC_("Language", "None");
|
||||
@@ -914,31 +855,31 @@ update_script_combo (void)
|
||||
}
|
||||
}
|
||||
|
||||
g_list_store_append (store, script_lang_new (langname,
|
||||
pair->script_index,
|
||||
pair->lang_index,
|
||||
pair->lang_tag));
|
||||
gtk_list_store_insert_with_values (store, &tree_iter, -1,
|
||||
0, langname,
|
||||
1, pair->script_index,
|
||||
2, pair->lang_index,
|
||||
3, pair->lang_tag,
|
||||
-1);
|
||||
if (pair->lang_tag == active)
|
||||
{
|
||||
have_active = TRUE;
|
||||
active_iter = tree_iter;
|
||||
}
|
||||
}
|
||||
|
||||
g_hash_table_destroy (tags);
|
||||
|
||||
sortmodel = gtk_sort_list_model_new (G_LIST_MODEL (store),
|
||||
GTK_SORTER (gtk_custom_sorter_new (script_sort, NULL, NULL)));
|
||||
gtk_drop_down_set_model (GTK_DROP_DOWN (demo->script_lang), G_LIST_MODEL (sortmodel));
|
||||
|
||||
for (guint i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (sortmodel)); i++)
|
||||
{
|
||||
ScriptLang *item = g_list_model_get_item (G_LIST_MODEL (sortmodel), i);
|
||||
g_object_unref (item);
|
||||
|
||||
if (item->lang_tag == active)
|
||||
{
|
||||
gtk_drop_down_set_selected (GTK_DROP_DOWN (demo->script_lang), i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
g_object_unref (sortmodel);
|
||||
gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (store),
|
||||
script_sort_func, NULL, NULL);
|
||||
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
|
||||
GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
|
||||
GTK_SORT_ASCENDING);
|
||||
gtk_combo_box_set_model (GTK_COMBO_BOX (demo->script_lang), GTK_TREE_MODEL (store));
|
||||
if (have_active)
|
||||
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (demo->script_lang), &active_iter);
|
||||
else
|
||||
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (demo->script_lang), 0);
|
||||
}
|
||||
|
||||
static char *
|
||||
@@ -963,19 +904,27 @@ static void
|
||||
update_features (void)
|
||||
{
|
||||
int i, j;
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
guint script_index, lang_index;
|
||||
hb_tag_t lang_tag;
|
||||
PangoFont *pango_font;
|
||||
hb_font_t *hb_font;
|
||||
GList *l;
|
||||
ScriptLang *selected;
|
||||
|
||||
/* set feature presence checks from the font features */
|
||||
|
||||
if (gtk_drop_down_get_selected (GTK_DROP_DOWN (demo->script_lang)) == 0)
|
||||
if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX (demo->script_lang), &iter))
|
||||
return;
|
||||
|
||||
selected = gtk_drop_down_get_selected_item (GTK_DROP_DOWN (demo->script_lang));
|
||||
model = gtk_combo_box_get_model (GTK_COMBO_BOX (demo->script_lang));
|
||||
gtk_tree_model_get (model, &iter,
|
||||
1, &script_index,
|
||||
2, &lang_index,
|
||||
3, &lang_tag,
|
||||
-1);
|
||||
|
||||
if (selected->lang_tag == 0) /* None is selected */
|
||||
if (lang_tag == 0) /* None is selected */
|
||||
{
|
||||
for (l = demo->feature_items; l; l = l->next)
|
||||
{
|
||||
@@ -1016,8 +965,8 @@ update_features (void)
|
||||
|
||||
hb_ot_layout_language_get_feature_tags (hb_face,
|
||||
tables[i],
|
||||
selected->script_index,
|
||||
selected->lang_index,
|
||||
script_index,
|
||||
lang_index,
|
||||
0,
|
||||
&count,
|
||||
features);
|
||||
@@ -1039,8 +988,8 @@ update_features (void)
|
||||
|
||||
hb_ot_layout_language_find_feature (hb_face,
|
||||
tables[i],
|
||||
selected->script_index,
|
||||
selected->lang_index,
|
||||
script_index,
|
||||
lang_index,
|
||||
features[j],
|
||||
&feature_index);
|
||||
|
||||
@@ -1372,9 +1321,10 @@ free_instance (gpointer data)
|
||||
}
|
||||
|
||||
static void
|
||||
add_instance (hb_face_t *face,
|
||||
unsigned int index,
|
||||
GtkStringList *strings)
|
||||
add_instance (hb_face_t *face,
|
||||
unsigned int index,
|
||||
GtkWidget *combo,
|
||||
int pos)
|
||||
{
|
||||
Instance *instance;
|
||||
hb_ot_name_id_t name_id;
|
||||
@@ -1390,20 +1340,20 @@ add_instance (hb_face_t *face,
|
||||
instance->index = index;
|
||||
|
||||
g_hash_table_add (demo->instances, instance);
|
||||
gtk_string_list_append (GTK_STRING_LIST (strings), instance->name);
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), instance->name);
|
||||
}
|
||||
|
||||
static void
|
||||
unset_instance (GtkAdjustment *adjustment)
|
||||
{
|
||||
if (demo->instance_combo)
|
||||
gtk_drop_down_set_selected (GTK_DROP_DOWN (demo->instance_combo), 0);
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (demo->instance_combo), 0);
|
||||
}
|
||||
|
||||
static void
|
||||
instance_changed (GtkDropDown *combo)
|
||||
instance_changed (GtkComboBox *combo)
|
||||
{
|
||||
const char *text;
|
||||
char *text;
|
||||
Instance *instance;
|
||||
Instance ikey;
|
||||
int i;
|
||||
@@ -1415,12 +1365,11 @@ instance_changed (GtkDropDown *combo)
|
||||
hb_font_t *hb_font;
|
||||
hb_face_t *hb_face;
|
||||
|
||||
text = gtk_string_list_get_string (GTK_STRING_LIST (gtk_drop_down_get_model (combo)),
|
||||
gtk_drop_down_get_selected (combo));
|
||||
text = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (combo));
|
||||
if (text[0] == '\0')
|
||||
goto out;
|
||||
|
||||
ikey.name = (char *) text;
|
||||
ikey.name = text;
|
||||
instance = g_hash_table_lookup (demo->instances, &ikey);
|
||||
if (!instance)
|
||||
{
|
||||
@@ -1461,6 +1410,7 @@ instance_changed (GtkDropDown *combo)
|
||||
}
|
||||
|
||||
out:
|
||||
g_free (text);
|
||||
g_clear_object (&pango_font);
|
||||
g_free (ai);
|
||||
g_free (coords);
|
||||
@@ -1570,7 +1520,6 @@ update_font_variations (void)
|
||||
{
|
||||
GtkWidget *label;
|
||||
GtkWidget *combo;
|
||||
GtkStringList *strings;
|
||||
|
||||
label = gtk_label_new ("Instance");
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
||||
@@ -1578,28 +1527,26 @@ update_font_variations (void)
|
||||
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);
|
||||
|
||||
combo = gtk_combo_box_text_new ();
|
||||
gtk_widget_set_halign (combo, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (combo, GTK_ALIGN_BASELINE);
|
||||
|
||||
gtk_string_list_append (strings, "");
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "");
|
||||
|
||||
for (i = 0; i < hb_ot_var_get_named_instance_count (hb_face); i++)
|
||||
add_instance (hb_face, i, strings);
|
||||
add_instance (hb_face, i, combo, i);
|
||||
|
||||
for (i = 0; i < hb_ot_var_get_named_instance_count (hb_face); i++)
|
||||
{
|
||||
if (matches_instance (hb_face, i, n_axes, design_coords))
|
||||
{
|
||||
gtk_drop_down_set_selected (GTK_DROP_DOWN (combo), i + 1);
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), i + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gtk_grid_attach (GTK_GRID (demo->variations_grid), combo, 1, -1, 3, 1);
|
||||
g_signal_connect (combo, "notify::selecte", G_CALLBACK (instance_changed), NULL);
|
||||
g_signal_connect (combo, "changed", G_CALLBACK (instance_changed), NULL);
|
||||
demo->instance_combo = combo;
|
||||
}
|
||||
|
||||
@@ -1746,7 +1693,6 @@ do_font_features (GtkWidget *do_widget)
|
||||
GtkBuilder *builder;
|
||||
GtkBuilderScope *scope;
|
||||
GtkEventController *controller;
|
||||
GtkExpression *expression;
|
||||
|
||||
builder = gtk_builder_new ();
|
||||
|
||||
@@ -1780,9 +1726,6 @@ do_font_features (GtkWidget *do_widget)
|
||||
demo->description = GTK_WIDGET (gtk_builder_get_object (builder, "description"));
|
||||
demo->font = GTK_WIDGET (gtk_builder_get_object (builder, "font"));
|
||||
demo->script_lang = GTK_WIDGET (gtk_builder_get_object (builder, "script_lang"));
|
||||
expression = gtk_cclosure_expression_new (G_TYPE_STRING, NULL, 0, NULL, G_CALLBACK (script_lang_get_langname), NULL, NULL);
|
||||
gtk_drop_down_set_expression (GTK_DROP_DOWN (demo->script_lang), expression);
|
||||
gtk_expression_unref (expression);
|
||||
demo->feature_list = GTK_WIDGET (gtk_builder_get_object (builder, "feature_list"));
|
||||
demo->stack = GTK_WIDGET (gtk_builder_get_object (builder, "stack"));
|
||||
demo->entry = GTK_WIDGET (gtk_builder_get_object (builder, "entry"));
|
||||
@@ -1801,8 +1744,8 @@ do_font_features (GtkWidget *do_widget)
|
||||
demo->swin = GTK_WIDGET (gtk_builder_get_object (builder, "swin"));
|
||||
|
||||
demo->provider = gtk_css_provider_new ();
|
||||
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
||||
GTK_STYLE_PROVIDER (demo->provider), 800);
|
||||
gtk_style_context_add_provider (gtk_widget_get_style_context (demo->swin),
|
||||
GTK_STYLE_PROVIDER (demo->provider), 800);
|
||||
|
||||
basic_value_changed (demo->size_adjustment, demo->size_entry);
|
||||
basic_value_changed (demo->letterspacing_adjustment, demo->letterspacing_entry);
|
||||
@@ -1880,5 +1823,3 @@ do_font_features (GtkWidget *do_widget)
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
/* vim:set foldmethod=marker expandtab: */
|
||||
|
65
demos/gtk-demo/font_features.c.rej
Normal file
65
demos/gtk-demo/font_features.c.rej
Normal file
@@ -0,0 +1,65 @@
|
||||
--- demos/gtk-demo/font_features.c
|
||||
+++ demos/gtk-demo/font_features.c
|
||||
@@ -434,7 +434,7 @@ static void
|
||||
update_display (void)
|
||||
{
|
||||
GString *s;
|
||||
- const char *text;
|
||||
+ char *text;
|
||||
gboolean has_feature;
|
||||
GtkTreeIter iter;
|
||||
GtkTreeModel *model;
|
||||
@@ -452,8 +452,12 @@ update_display (void)
|
||||
gboolean do_waterfall;
|
||||
GString *waterfall;
|
||||
char *palette;
|
||||
+ GtkTextBuffer *buffer;
|
||||
+ GtkTextIter start_iter, end_iter;
|
||||
|
||||
- text = gtk_editable_get_text (GTK_EDITABLE (demo->the_entry));
|
||||
+ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (demo->the_entry));
|
||||
+ gtk_text_buffer_get_bounds (buffer, &start_iter, &end_iter);
|
||||
+ text = gtk_text_buffer_get_text (buffer, &start_iter, &end_iter, FALSE);
|
||||
text_len = strlen (text);
|
||||
|
||||
do_waterfall = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (demo->waterfall_toggle));
|
||||
@@ -631,6 +635,8 @@ update_display (void)
|
||||
pango2_font_description_free (desc);
|
||||
g_free (features);
|
||||
pango2_attr_list_unref (attrs);
|
||||
+
|
||||
+ g_free (text);
|
||||
}
|
||||
|
||||
static Pango2Font *
|
||||
@@ -1603,8 +1609,12 @@ font_features_toggle_edit (void)
|
||||
{
|
||||
if (strcmp (gtk_stack_get_visible_child_name (GTK_STACK (demo->stack)), "entry") != 0)
|
||||
{
|
||||
+ GtkTextBuffer *buffer;
|
||||
+ GtkTextIter start, end;
|
||||
g_free (demo->text);
|
||||
- demo->text = g_strdup (gtk_editable_get_text (GTK_EDITABLE (demo->the_entry)));
|
||||
+ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (demo->the_entry));
|
||||
+ gtk_text_buffer_get_bounds (buffer, &start, &end);
|
||||
+ demo->text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (demo->stack), "entry");
|
||||
gtk_widget_grab_focus (demo->the_entry);
|
||||
gtk_adjustment_set_value (gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (demo->swin)), 0);
|
||||
@@ -1632,7 +1642,7 @@ entry_key_press (GtkEventController *controller,
|
||||
{
|
||||
if (keyval == GDK_KEY_Escape)
|
||||
{
|
||||
- gtk_editable_set_text (GTK_EDITABLE (entry), demo->text);
|
||||
+ gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (demo->the_entry)), demo->text, -1);
|
||||
return GDK_EVENT_STOP;
|
||||
}
|
||||
|
||||
@@ -1701,7 +1711,6 @@ do_font_features (GtkWidget *do_widget)
|
||||
basic_value_changed (demo->line_height_adjustment, demo->line_height_entry);
|
||||
|
||||
controller = gtk_event_controller_key_new ();
|
||||
- g_object_set_data_full (G_OBJECT (demo->the_entry), "controller", g_object_ref (controller), g_object_unref);
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (entry_key_press), demo->the_entry);
|
||||
gtk_widget_add_controller (demo->the_entry, controller);
|
||||
|
@@ -259,10 +259,16 @@
|
||||
<object class="GtkBox" id="feature_list">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkDropDown" id="script_lang">
|
||||
<object class="GtkComboBox" id="script_lang">
|
||||
<property name="tooltip-text" translatable="yes">Language System</property>
|
||||
<property name="margin-top">10</property>
|
||||
<signal name="notify::selected" handler="font_features_script_changed" swapped="no"/>
|
||||
<signal name="changed" handler="font_features_script_changed" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkCellRendererText"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
@@ -43,6 +43,7 @@ update_image (void)
|
||||
cairo_t *cr;
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkPixbuf *pixbuf2;
|
||||
const char *hint;
|
||||
cairo_font_options_t *fopt;
|
||||
cairo_hint_style_t hintstyle;
|
||||
cairo_hint_metrics_t hintmetrics;
|
||||
@@ -57,23 +58,18 @@ update_image (void)
|
||||
|
||||
fopt = cairo_font_options_copy (pango_cairo_context_get_font_options (context));
|
||||
|
||||
switch (gtk_drop_down_get_selected (GTK_DROP_DOWN (hinting)))
|
||||
hint = gtk_combo_box_get_active_id (GTK_COMBO_BOX (hinting));
|
||||
hintstyle = CAIRO_HINT_STYLE_DEFAULT;
|
||||
if (hint)
|
||||
{
|
||||
case 0:
|
||||
hintstyle = CAIRO_HINT_STYLE_NONE;
|
||||
break;
|
||||
case 1:
|
||||
hintstyle = CAIRO_HINT_STYLE_SLIGHT;
|
||||
break;
|
||||
case 2:
|
||||
hintstyle = CAIRO_HINT_STYLE_MEDIUM;
|
||||
break;
|
||||
case 3:
|
||||
hintstyle = CAIRO_HINT_STYLE_FULL;
|
||||
break;
|
||||
default:
|
||||
hintstyle = CAIRO_HINT_STYLE_DEFAULT;
|
||||
break;
|
||||
if (strcmp (hint, "none") == 0)
|
||||
hintstyle = CAIRO_HINT_STYLE_NONE;
|
||||
else if (strcmp (hint, "slight") == 0)
|
||||
hintstyle = CAIRO_HINT_STYLE_SLIGHT;
|
||||
else if (strcmp (hint, "medium") == 0)
|
||||
hintstyle = CAIRO_HINT_STYLE_MEDIUM;
|
||||
else if (strcmp (hint, "full") == 0)
|
||||
hintstyle = CAIRO_HINT_STYLE_FULL;
|
||||
}
|
||||
cairo_font_options_set_hint_style (fopt, hintstyle);
|
||||
|
||||
@@ -221,39 +217,30 @@ update_image (void)
|
||||
text = " ";
|
||||
|
||||
ch = g_utf8_get_char (text);
|
||||
str = g_string_new ("");
|
||||
layout = pango_layout_new (context);
|
||||
|
||||
retry:
|
||||
str = g_string_new ("");
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
g_string_append_unichar (str, ch);
|
||||
g_string_append_unichar (str, 0x200c);
|
||||
}
|
||||
|
||||
layout = pango_layout_new (context);
|
||||
pango_layout_set_font_description (layout, desc);
|
||||
pango_layout_set_text (layout, str->str, -1);
|
||||
g_string_free (str, TRUE);
|
||||
pango_layout_get_extents (layout, &ink, &logical);
|
||||
pango_extents_to_pixels (&logical, NULL);
|
||||
|
||||
iter = pango_layout_get_iter (layout);
|
||||
run = pango_layout_iter_get_run (iter);
|
||||
|
||||
if (run->glyphs->num_glyphs < 8)
|
||||
{
|
||||
/* not a good char to use */
|
||||
g_string_truncate (str, 0);
|
||||
ch = 'a';
|
||||
goto retry;
|
||||
}
|
||||
|
||||
g_string_free (str, TRUE);
|
||||
|
||||
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, logical.width * 3 / 2, 4*logical.height);
|
||||
cr = cairo_create (surface);
|
||||
cairo_set_source_rgb (cr, 1, 1, 1);
|
||||
cairo_paint (cr);
|
||||
|
||||
iter = pango_layout_get_iter (layout);
|
||||
run = pango_layout_iter_get_run (iter);
|
||||
|
||||
cairo_set_source_rgb (cr, 0, 0, 0);
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
@@ -422,7 +409,7 @@ do_fontrendering (GtkWidget *do_widget)
|
||||
g_signal_connect (down_button, "clicked", G_CALLBACK (scale_down), NULL);
|
||||
g_signal_connect (entry, "notify::text", G_CALLBACK (update_image), NULL);
|
||||
g_signal_connect (font_button, "notify::font-desc", G_CALLBACK (update_image), NULL);
|
||||
g_signal_connect (hinting, "notify::selected", G_CALLBACK (update_image), NULL);
|
||||
g_signal_connect (hinting, "notify::active", G_CALLBACK (update_image), NULL);
|
||||
g_signal_connect (anti_alias, "notify::active", G_CALLBACK (update_image), NULL);
|
||||
g_signal_connect (hint_metrics, "notify::active", G_CALLBACK (update_image), NULL);
|
||||
g_signal_connect (text_radio, "notify::active", G_CALLBACK (update_image), NULL);
|
||||
|
@@ -116,18 +116,15 @@
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkDropDown" id="hinting">
|
||||
<object class="GtkComboBoxText" id="hinting">
|
||||
<property name="active">0</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="model">
|
||||
<object class="GtkStringList">
|
||||
<items>
|
||||
<item translatable="yes">None</item>
|
||||
<item translatable="yes">Slight</item>
|
||||
<item translatable="yes">Medium</item>
|
||||
<item translatable="yes">Full</item>
|
||||
</items>
|
||||
</object>
|
||||
</property>
|
||||
<items>
|
||||
<item translatable="yes" id="none">None</item>
|
||||
<item translatable="yes" id="slight">Slight</item>
|
||||
<item translatable="yes" id="medium">Medium</item>
|
||||
<item translatable="yes" id="full">Full</item>
|
||||
</items>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
|
@@ -144,6 +144,7 @@ make_shader_stack (const char *name,
|
||||
GtkTextBuffer *buffer;
|
||||
GBytes *bytes;
|
||||
GtkEventController *controller;
|
||||
GtkCssProvider *provider;
|
||||
GdkPaintable *paintable;
|
||||
|
||||
stack = gtk_shader_stack_new ();
|
||||
@@ -234,6 +235,12 @@ make_shader_stack (const char *name,
|
||||
g_signal_connect (buffer, "changed", G_CALLBACK (text_changed), button);
|
||||
g_object_set_data (G_OBJECT (button), "the-stack", stack);
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (apply_text), buffer);
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_data (provider, "button.small { padding: 0; }", -1);
|
||||
gtk_style_context_add_provider (gtk_widget_get_style_context (button),
|
||||
GTK_STYLE_PROVIDER (provider),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
g_object_unref (provider);
|
||||
gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
|
||||
gtk_widget_add_css_class (button, "small");
|
||||
@@ -267,21 +274,11 @@ make_shader_stack (const char *name,
|
||||
return vbox;
|
||||
}
|
||||
|
||||
static void
|
||||
remove_provider (gpointer data)
|
||||
{
|
||||
GtkStyleProvider *provider = GTK_STYLE_PROVIDER (data);
|
||||
|
||||
gtk_style_context_remove_provider_for_display (gdk_display_get_default (), provider);
|
||||
g_object_unref (provider);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_gltransition_window (GtkWidget *do_widget)
|
||||
{
|
||||
GtkWidget *window, *headerbar, *scale, *outer_grid, *grid, *background;
|
||||
GdkPaintable *paintable;
|
||||
GtkCssProvider *provider;
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
|
||||
@@ -336,14 +333,6 @@ create_gltransition_window (GtkWidget *do_widget)
|
||||
make_shader_stack ("Kaleidoscope", "/gltransition/kaleidoscope.glsl", 3, scale),
|
||||
1, 1, 1, 1);
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
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);
|
||||
|
||||
g_object_set_data_full (G_OBJECT (window), "provider", provider, remove_provider);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
|
@@ -223,7 +223,6 @@ static void
|
||||
destroy_gear (struct gear *g)
|
||||
{
|
||||
g_free (g->strips);
|
||||
g_free (g->vertices);
|
||||
g_free (g);
|
||||
}
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 3.3 KiB |
@@ -9,8 +9,6 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <string.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
#define FOLDER_NAME "/iconview/gnome-fs-directory.png"
|
||||
|
@@ -8,8 +8,6 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <string.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
enum
|
||||
{
|
||||
COL_TEXT,
|
||||
|
@@ -7,8 +7,6 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
static GtkTreeModel *model = NULL;
|
||||
static guint timeout = 0;
|
||||
|
@@ -8,7 +8,6 @@
|
||||
* to implement rather different interaction behavior to a typical list.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
@@ -376,23 +375,6 @@ sweeper_game_init (SweeperGame *self)
|
||||
sweeper_game_new_game (self, 8, 8, 10);
|
||||
}
|
||||
|
||||
static void
|
||||
celebrate (gboolean win)
|
||||
{
|
||||
char *path;
|
||||
GtkMediaStream *stream;
|
||||
|
||||
if (win)
|
||||
path = g_build_filename (GTK_DATADIR, "sounds", "freedesktop", "stereo", "complete.oga", NULL);
|
||||
else
|
||||
path = g_build_filename (GTK_DATADIR, "sounds", "freedesktop", "stereo", "suspend-error.oga", NULL);
|
||||
stream = gtk_media_file_new_for_filename (path);
|
||||
gtk_media_stream_set_volume (stream, 1.0);
|
||||
gtk_media_stream_play (stream);
|
||||
g_signal_connect (stream, "notify::ended", G_CALLBACK (g_object_unref), NULL);
|
||||
g_free (path);
|
||||
}
|
||||
|
||||
static void
|
||||
sweeper_game_end (SweeperGame *self,
|
||||
gboolean win)
|
||||
@@ -401,9 +383,7 @@ sweeper_game_end (SweeperGame *self,
|
||||
{
|
||||
self->playing = FALSE;
|
||||
g_object_notify_by_pspec (G_OBJECT (self), game_properties[GAME_PROP_PLAYING]);
|
||||
celebrate (win);
|
||||
}
|
||||
|
||||
if (self->win != win)
|
||||
{
|
||||
self->win = win;
|
||||
|
@@ -422,10 +422,6 @@ do_listview_settings (GtkWidget *do_widget)
|
||||
gtk_column_view_column_set_sorter (name_column, sorter);
|
||||
g_object_unref (sorter);
|
||||
|
||||
sorter = GTK_SORTER (gtk_string_sorter_new (gtk_property_expression_new (SETTINGS_TYPE_KEY, NULL, "type")));
|
||||
gtk_column_view_column_set_sorter (type_column, sorter);
|
||||
g_object_unref (sorter);
|
||||
|
||||
g_object_unref (builder);
|
||||
}
|
||||
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#include "script-names.h"
|
||||
#include "unicode-names.h"
|
||||
|
||||
|
||||
#define UCD_TYPE_ITEM (ucd_item_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (UcdItem, ucd_item, UCD, ITEM, GObject)
|
||||
|
||||
@@ -337,15 +338,6 @@ create_ucd_view (GtkWidget *label)
|
||||
|
||||
static GtkWidget *window;
|
||||
|
||||
static void
|
||||
remove_provider (gpointer data)
|
||||
{
|
||||
GtkStyleProvider *provider = GTK_STYLE_PROVIDER (data);
|
||||
|
||||
gtk_style_context_remove_provider_for_display (gdk_display_get_default (), provider);
|
||||
g_object_unref (provider);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_listview_ucd (GtkWidget *do_widget)
|
||||
{
|
||||
@@ -368,7 +360,7 @@ do_listview_ucd (GtkWidget *do_widget)
|
||||
gtk_widget_add_css_class (label, "enormous");
|
||||
provider = gtk_css_provider_new ();
|
||||
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_style_context_add_provider (gtk_widget_get_style_context (label), GTK_STYLE_PROVIDER (provider), 800);
|
||||
gtk_widget_set_hexpand (label, TRUE);
|
||||
gtk_box_append (GTK_BOX (box), label);
|
||||
|
||||
@@ -378,8 +370,6 @@ do_listview_ucd (GtkWidget *do_widget)
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), listview);
|
||||
gtk_box_prepend (GTK_BOX (box), sw);
|
||||
gtk_window_set_child (GTK_WINDOW (window), box);
|
||||
|
||||
g_object_set_data_full (G_OBJECT (window), "provider", provider, remove_provider);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
@@ -8,7 +8,6 @@
|
||||
#include "config.h"
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
|
||||
/* Create an object for the pegs that get moved around in the game.
|
||||
*
|
||||
* We implement the GdkPaintable interface for them, so we can use GtkPicture
|
||||
@@ -120,6 +119,12 @@ solitaire_peg_new (void)
|
||||
|
||||
/*** Helper for finding a win ***/
|
||||
|
||||
static void
|
||||
ended (GObject *object)
|
||||
{
|
||||
g_object_unref (object);
|
||||
}
|
||||
|
||||
static void
|
||||
celebrate (gboolean win)
|
||||
{
|
||||
@@ -129,12 +134,12 @@ celebrate (gboolean win)
|
||||
if (win)
|
||||
path = g_build_filename (GTK_DATADIR, "sounds", "freedesktop", "stereo", "complete.oga", NULL);
|
||||
else
|
||||
path = g_build_filename (GTK_DATADIR, "sounds", "freedesktop", "stereo", "suspend-error.oga", NULL);
|
||||
path = g_build_filename (GTK_DATADIR, "sounds", "freedesktop", "stereo", "dialog-error.oga", NULL);
|
||||
stream = gtk_media_file_new_for_filename (path);
|
||||
gtk_media_stream_set_volume (stream, 1.0);
|
||||
gtk_media_stream_play (stream);
|
||||
|
||||
g_signal_connect (stream, "notify::ended", G_CALLBACK (g_object_unref), NULL);
|
||||
g_signal_connect (stream, "notify::ended", G_CALLBACK (ended), NULL);
|
||||
g_free (path);
|
||||
}
|
||||
|
||||
@@ -360,15 +365,6 @@ drop_drop (GtkDropTarget *target,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
remove_provider (gpointer data)
|
||||
{
|
||||
GtkStyleProvider *provider = GTK_STYLE_PROVIDER (data);
|
||||
|
||||
gtk_style_context_remove_provider_for_display (gdk_display_get_default (), provider);
|
||||
g_object_unref (provider);
|
||||
}
|
||||
|
||||
static void
|
||||
create_board (GtkWidget *window)
|
||||
{
|
||||
@@ -385,9 +381,6 @@ create_board (GtkWidget *window)
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
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);
|
||||
|
||||
grid = gtk_grid_new ();
|
||||
gtk_widget_set_halign (grid, GTK_ALIGN_CENTER);
|
||||
@@ -406,6 +399,9 @@ create_board (GtkWidget *window)
|
||||
continue;
|
||||
|
||||
image = gtk_image_new ();
|
||||
gtk_style_context_add_provider (gtk_widget_get_style_context (image),
|
||||
GTK_STYLE_PROVIDER (provider),
|
||||
800);
|
||||
gtk_widget_add_css_class (image, "solitaire-field");
|
||||
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
|
||||
if (x != 3 || y != 3)
|
||||
@@ -449,7 +445,7 @@ create_board (GtkWidget *window)
|
||||
}
|
||||
}
|
||||
|
||||
g_object_set_data_full (G_OBJECT (window), "provider", provider, remove_provider);
|
||||
g_object_unref (provider);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -123,14 +123,8 @@ do_pickers (GtkWidget *do_widget)
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_hexpand (label, TRUE);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
picker = gtk_app_chooser_button_new ("x-scheme-handler/mailto");
|
||||
gtk_app_chooser_button_set_show_dialog_item (GTK_APP_CHOOSER_BUTTON (picker), TRUE);
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
gtk_grid_attach (GTK_GRID (table), label, 0, 3, 1, 1);
|
||||
gtk_grid_attach (GTK_GRID (table), picker, 1, 3, 1, 1);
|
||||
}
|
||||
|
@@ -16,6 +16,7 @@ enum {
|
||||
NUM_PROPERTIES
|
||||
};
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
||||
static void
|
||||
pixbuf_paintable_snapshot (GdkPaintable *paintable,
|
||||
GdkSnapshot *snapshot,
|
||||
@@ -36,6 +37,7 @@ pixbuf_paintable_snapshot (GdkPaintable *paintable,
|
||||
|
||||
g_object_unref (texture);
|
||||
}
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
||||
|
||||
static int
|
||||
pixbuf_paintable_get_intrinsic_width (GdkPaintable *paintable)
|
||||
|
@@ -16,6 +16,24 @@
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* Convenience function to create a combo box holding a number of strings
|
||||
*/
|
||||
GtkWidget *
|
||||
create_combo_box (const char **strings)
|
||||
{
|
||||
GtkWidget *combo_box;
|
||||
const char **str;
|
||||
|
||||
combo_box = gtk_combo_box_text_new ();
|
||||
|
||||
for (str = strings; *str; str++)
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), *str);
|
||||
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 0);
|
||||
|
||||
return combo_box;
|
||||
}
|
||||
|
||||
static void
|
||||
add_row (GtkGrid *table,
|
||||
int row,
|
||||
@@ -23,7 +41,7 @@ add_row (GtkGrid *table,
|
||||
const char *label_text,
|
||||
const char **options)
|
||||
{
|
||||
GtkWidget *dropdown;
|
||||
GtkWidget *combo_box;
|
||||
GtkWidget *label;
|
||||
|
||||
label = gtk_label_new_with_mnemonic (label_text);
|
||||
@@ -32,12 +50,12 @@ add_row (GtkGrid *table,
|
||||
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);
|
||||
gtk_size_group_add_widget (size_group, dropdown);
|
||||
gtk_grid_attach (table, dropdown, 1, row, 1, 1);
|
||||
combo_box = create_combo_box (options);
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo_box);
|
||||
gtk_widget_set_halign (combo_box, GTK_ALIGN_END);
|
||||
gtk_widget_set_valign (combo_box, GTK_ALIGN_BASELINE);
|
||||
gtk_size_group_add_widget (size_group, combo_box);
|
||||
gtk_grid_attach (table, combo_box, 1, row, 1, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -5,7 +5,6 @@
|
||||
* small sliding puzzle game.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* Include the header for the puzzle piece */
|
||||
@@ -25,30 +24,6 @@ static guint height = 3;
|
||||
static guint pos_x;
|
||||
static guint pos_y;
|
||||
|
||||
static void
|
||||
ended (GObject *object)
|
||||
{
|
||||
g_object_unref (object);
|
||||
}
|
||||
|
||||
static void
|
||||
celebrate (gboolean win)
|
||||
{
|
||||
char *path;
|
||||
GtkMediaStream *stream;
|
||||
|
||||
if (win)
|
||||
path = g_build_filename (GTK_DATADIR, "sounds", "freedesktop", "stereo", "complete.oga", NULL);
|
||||
else
|
||||
path = g_build_filename (GTK_DATADIR, "sounds", "freedesktop", "stereo", "suspend-error.oga", NULL);
|
||||
stream = gtk_media_file_new_for_filename (path);
|
||||
gtk_media_stream_set_volume (stream, 1.0);
|
||||
gtk_media_stream_play (stream);
|
||||
|
||||
g_signal_connect (stream, "notify::ended", G_CALLBACK (ended), NULL);
|
||||
g_free (path);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
move_puzzle (GtkWidget *grid,
|
||||
int dx,
|
||||
@@ -182,8 +157,6 @@ check_solved (GtkWidget *grid)
|
||||
picture = gtk_grid_get_child_at (GTK_GRID (grid), pos_x, pos_y);
|
||||
gtk_picture_set_paintable (GTK_PICTURE (picture), piece);
|
||||
|
||||
celebrate (TRUE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -357,7 +330,7 @@ start_puzzle (GdkPaintable *paintable)
|
||||
x, y,
|
||||
width, height);
|
||||
picture = gtk_picture_new_for_paintable (piece);
|
||||
gtk_picture_set_content_fit (GTK_PICTURE (picture), GTK_CONTENT_FIT_FILL);
|
||||
gtk_picture_set_keep_aspect_ratio (GTK_PICTURE (picture), FALSE);
|
||||
gtk_grid_attach (GTK_GRID (grid),
|
||||
picture,
|
||||
x, y,
|
||||
|
@@ -11,7 +11,6 @@
|
||||
#include <stdlib.h> /* for exit() */
|
||||
#include "paintable.h"
|
||||
|
||||
|
||||
static void easter_egg_callback (GtkWidget *button, gpointer data);
|
||||
|
||||
static void
|
||||
@@ -430,11 +429,11 @@ attach_widgets (GtkTextView *text_view)
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
const char *options[] = {
|
||||
"Option 1", "Option 2", "Option 3", NULL
|
||||
};
|
||||
widget = gtk_combo_box_text_new ();
|
||||
|
||||
widget = gtk_drop_down_new_from_strings (options);
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Option 1");
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Option 2");
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Option 3");
|
||||
}
|
||||
else if (i == 2)
|
||||
{
|
||||
|
@@ -10,8 +10,6 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
/* TreeItem structure */
|
||||
typedef struct _TreeItem TreeItem;
|
||||
struct _TreeItem
|
||||
|
@@ -216,6 +216,7 @@
|
||||
<child>
|
||||
<object class="GtkPicture" id="picture">
|
||||
<property name="can-shrink">0</property>
|
||||
<property name="keep-aspect-ratio">1</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<child>
|
||||
|
@@ -13,8 +13,6 @@ Each node has its own `<node-name>` and supports a custom set of properties, eac
|
||||
|
||||
When serializing and the value of a property equals the default value, this value will not be serialized. Serialization aims to produce an output as small as possible.
|
||||
|
||||
To embed newlines in strings, use \A. To break a long string into multiple lines, escape the newline with a \.
|
||||
|
||||
# Nodes
|
||||
|
||||
### container
|
||||
@@ -137,23 +135,6 @@ Creates a node like `gsk_cross_fade_node_new()` with the given properties.
|
||||
|
||||
Creates a node like `gsk_debug_node_new()` with the given properties.
|
||||
|
||||
### glshader
|
||||
|
||||
| property | syntax | default | printed |
|
||||
| ---------- | ------------------ | ---------------------- | ----------- |
|
||||
| bounds | `<rect>` | 50 | always |
|
||||
| sourcecode | `<string>` | "" | always |
|
||||
| args | `<uniform values>` | none | non-default |
|
||||
| child1 | `<node>` | none | non-default |
|
||||
| child2 | `<node>` | none | non-default |
|
||||
| child3 | `<node>` | none | non-default |
|
||||
| child4 | `<node>` | none | non-default |
|
||||
|
||||
Creates a GLShader node. The `sourcecode` must be a GLSL fragment shader.
|
||||
The `args` must match the uniforms of simple types declared in that shader,
|
||||
in order and comma-separated. The `child` properties must match the sampler
|
||||
uniforms in the shader.
|
||||
|
||||
### inset-shadow
|
||||
|
||||
| property | syntax | default | printed |
|
||||
@@ -305,3 +286,20 @@ representation for this texture is `url("data:image/png;base64,iVBORw0KGgoAAAANS
|
||||
| transform| `<transform>` | none | non-default |
|
||||
|
||||
Creates a node like `gsk_transform_node_new()` with the given properties.
|
||||
|
||||
### glshader
|
||||
|
||||
| property | syntax | default | printed |
|
||||
| ---------- | ------------------ | ---------------------- | ----------- |
|
||||
| bounds | `<rect>` | 50 | always |
|
||||
| sourcecode | `<string>` | "" | always |
|
||||
| args | `<uniform values>` | none | non-default |
|
||||
| child1 | `<node>` | none | non-default |
|
||||
| child2 | `<node>` | none | non-default |
|
||||
| child3 | `<node>` | none | non-default |
|
||||
| child4 | `<node>` | none | non-default |
|
||||
|
||||
Creates a GLShader node. The `sourcecode` must be a GLSL fragment shader.
|
||||
The `args` must match the uniforms of simple types declared in that shader,
|
||||
in order and comma-separated. The `child` properties must match the sampler
|
||||
uniforms in the shader.
|
||||
|
@@ -213,31 +213,6 @@ activate_background (GSimpleAction *action,
|
||||
populate_flowbox (flowbox);
|
||||
}
|
||||
|
||||
static void
|
||||
file_chooser_response (GtkNativeDialog *self,
|
||||
int response)
|
||||
{
|
||||
gtk_native_dialog_destroy (self);
|
||||
}
|
||||
|
||||
static void
|
||||
activate_open_file (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkFileChooserNative *chooser;
|
||||
|
||||
chooser = gtk_file_chooser_native_new ("Open file",
|
||||
NULL,
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||
"Open",
|
||||
"Cancel");
|
||||
|
||||
g_signal_connect (chooser, "response", G_CALLBACK (file_chooser_response), NULL);
|
||||
|
||||
gtk_native_dialog_show (GTK_NATIVE_DIALOG (chooser));
|
||||
}
|
||||
|
||||
static void
|
||||
activate_open (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
@@ -664,7 +639,6 @@ on_record_button_toggled (GtkToggleButton *button,
|
||||
gtk_widget_add_css_class (GTK_WIDGET (button), "destructive-action");
|
||||
}
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
static void
|
||||
on_page_combo_changed (GtkComboBox *combo,
|
||||
gpointer user_data)
|
||||
@@ -706,7 +680,6 @@ on_page_combo_changed (GtkComboBox *combo,
|
||||
default:;
|
||||
}
|
||||
}
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
static void
|
||||
on_range_from_changed (GtkSpinButton *from)
|
||||
@@ -845,7 +818,6 @@ page_changed_cb (GtkWidget *stack, GParamSpec *pspec, gpointer data)
|
||||
}
|
||||
}
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
static void
|
||||
populate_model (GtkTreeStore *store)
|
||||
{
|
||||
@@ -963,7 +935,6 @@ row_separator_func (GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
|
||||
|
||||
return is_sep;
|
||||
}
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
static void
|
||||
update_title_header (GtkListBoxRow *row,
|
||||
@@ -1582,7 +1553,6 @@ osd_frame_pressed (GtkGestureClick *gesture,
|
||||
return GDK_EVENT_STOP;
|
||||
}
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
static gboolean
|
||||
page_combo_separator_func (GtkTreeModel *model,
|
||||
GtkTreeIter *iter,
|
||||
@@ -1597,7 +1567,6 @@ page_combo_separator_func (GtkTreeModel *model,
|
||||
|
||||
return res;
|
||||
}
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
static void
|
||||
toggle_format (GSimpleAction *action,
|
||||
@@ -1850,7 +1819,6 @@ update_buttons (GtkWidget *iv, GtkIconSize size)
|
||||
gtk_widget_set_sensitive (button, size != GTK_ICON_SIZE_INHERIT);
|
||||
}
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
static void
|
||||
increase_icon_size (GtkWidget *iv)
|
||||
{
|
||||
@@ -1901,7 +1869,6 @@ reset_icon_size (GtkWidget *iv)
|
||||
|
||||
gtk_widget_queue_resize (iv);
|
||||
}
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
static char *
|
||||
scale_format_value_blank (GtkScale *scale, double value, gpointer user_data)
|
||||
@@ -2278,12 +2245,10 @@ activate (GApplication *app)
|
||||
g_object_set_data (G_OBJECT (window), "selection_flowbox", widget2);
|
||||
g_signal_connect_swapped (widget, "clicked", G_CALLBACK (populate_flowbox), widget2);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
widget = (GtkWidget *)gtk_builder_get_object (builder, "charletree");
|
||||
populate_model ((GtkTreeStore *)gtk_tree_view_get_model (GTK_TREE_VIEW (widget)));
|
||||
gtk_tree_view_set_row_separator_func (GTK_TREE_VIEW (widget), row_separator_func, NULL, NULL);
|
||||
gtk_tree_view_expand_all (GTK_TREE_VIEW (widget));
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
widget = GTK_WIDGET (gtk_builder_get_object (builder, "munsell"));
|
||||
widget2 = GTK_WIDGET (gtk_builder_get_object (builder, "cchooser"));
|
||||
@@ -2291,7 +2256,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
populate_colors (widget, widget2);
|
||||
g_signal_connect (widget2, "notify::rgba", G_CALLBACK (rgba_changed), widget);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
widget = (GtkWidget *)gtk_builder_get_object (builder, "page_combo");
|
||||
gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (widget), page_combo_separator_func, NULL, NULL);
|
||||
widget2 = (GtkWidget *)gtk_builder_get_object (builder, "range_from_spin");
|
||||
@@ -2302,7 +2266,6 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
g_object_set_data (G_OBJECT (widget), "range_to_spin", widget3);
|
||||
g_object_set_data (G_OBJECT (widget2), "range_to_spin", widget3);
|
||||
g_object_set_data (G_OBJECT (widget), "print_button", widget4);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
widget2 = (GtkWidget *)gtk_builder_get_object (builder, "tooltextview");
|
||||
|
||||
@@ -2488,7 +2451,7 @@ main (int argc, char *argv[])
|
||||
{ "share", activate_action, NULL, NULL, NULL },
|
||||
{ "labels", activate_action, NULL, NULL, NULL },
|
||||
{ "new", activate_action, NULL, NULL, NULL },
|
||||
{ "open", activate_open_file, NULL, NULL, NULL },
|
||||
{ "open", activate_action, NULL, NULL, NULL },
|
||||
{ "open-in", activate_action, NULL, NULL, NULL },
|
||||
{ "open-tab", activate_action, NULL, NULL, NULL },
|
||||
{ "open-window", activate_action, NULL, NULL, NULL },
|
||||
|
@@ -111,8 +111,6 @@
|
||||
<file>icons/scalable/status/weather-showers-symbolic.svg</file>
|
||||
<file>icons/scalable/status/weather-snow-symbolic.svg</file>
|
||||
|
||||
<file alias='icons/scalable/apps/org.gtk.WidgetFactory4.svg'>data/scalable/apps/org.gtk.WidgetFactory4.svg</file>
|
||||
|
||||
</gresource>
|
||||
<gresource prefix="/org/gtk/WidgetFactory4">
|
||||
<file>gtk-logo.webm</file>
|
||||
|
@@ -1265,7 +1265,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<property name="child">
|
||||
<object class="GtkPicture">
|
||||
<property name="file">resource:///org/gtk/WidgetFactory4/sunset.jpg</property>
|
||||
<property name="content-fit">cover</property>
|
||||
<child>
|
||||
<object class="GtkDragSource">
|
||||
<signal name="prepare" handler="on_picture_drag_prepare" swapped="no"/>
|
||||
@@ -3345,12 +3344,10 @@ bad things might happen.</property>
|
||||
<attribute name="display-hint">circular-buttons</attribute>
|
||||
<item>
|
||||
<attribute name="verb-icon">printer-symbolic</attribute>
|
||||
<attribute name="label" translatable="yes">Print all the things!</attribute>
|
||||
<attribute name="action">win.print</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="verb-icon">emblem-shared-symbolic</attribute>
|
||||
<attribute name="label" translatable="yes">Share all the things!</attribute>
|
||||
<attribute name="action">app.share</attribute>
|
||||
</item>
|
||||
</section>
|
||||
@@ -3365,17 +3362,14 @@ bad things might happen.</property>
|
||||
<attribute name="label" translatable="yes">Edit</attribute>
|
||||
<item>
|
||||
<attribute name="verb-icon">edit-cut-symbolic</attribute>
|
||||
<attribute name="label" translatable="yes">Cut</attribute>
|
||||
<attribute name="action">app.cut</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="verb-icon">edit-copy-symbolic</attribute>
|
||||
<attribute name="label" translatable="yes">Copy</attribute>
|
||||
<attribute name="action">app.copy</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="verb-icon">edit-paste-symbolic</attribute>
|
||||
<attribute name="label" translatable="yes">Paste</attribute>
|
||||
<attribute name="action">app.paste</attribute>
|
||||
</item>
|
||||
</section>
|
||||
|
@@ -12,8 +12,8 @@ SYNOPSIS
|
||||
--------
|
||||
| **gtk4-builder-tool** <COMMAND> [OPTIONS...] <FILE>
|
||||
|
|
||||
| **gtk4-builder-tool** validate [OPTIONS...] <FILE>
|
||||
| **gtk4-builder-tool** enumerate [OPTIONS...] <FILE>
|
||||
| **gtk4-builder-tool** validate <FILE>
|
||||
| **gtk4-builder-tool** enumerate <FILE>
|
||||
| **gtk4-builder-tool** simplify [OPTIONS...] <FILE>
|
||||
| **gtk4-builder-tool** preview [OPTIONS...] <FILE>
|
||||
| **gtk4-builder-tool** screenshot [OPTIONS...] <FILE>
|
||||
@@ -33,20 +33,12 @@ Validation
|
||||
The ``validate`` command validates the given UI definition file and reports
|
||||
errors to ``stderr``.
|
||||
|
||||
``--deprecations``
|
||||
|
||||
Warn about uses of deprecated types in the UI definition file.
|
||||
|
||||
Enumeration
|
||||
^^^^^^^^^^^
|
||||
|
||||
The ``enumerate`` command prints all the named objects that are present in the UI
|
||||
The ``enumerate`` command lists all the named objects that are present in the UI
|
||||
definition file.
|
||||
|
||||
``--callbacks``
|
||||
|
||||
Print the names of callbacks as well.
|
||||
|
||||
Preview
|
||||
^^^^^^^
|
||||
|
||||
|
@@ -1,74 +0,0 @@
|
||||
Title: Preparing for GTK 5
|
||||
Slug: gtk-migrating-4-to-5
|
||||
|
||||
GTK 5 will be a major new version of GTK that breaks both API and
|
||||
ABI compared to GTK 4.x. GTK 5 does not exist yet, so we cannot
|
||||
be entirely sure what will be involved in a migration from GTK 4
|
||||
to GTK 5. But we can already give some preliminary hints about
|
||||
the likely changes, and how to prepare for them in code that is
|
||||
using GTK 4.
|
||||
|
||||
### Do not use deprecated symbols
|
||||
|
||||
As always, functions and types that are known to go away in the
|
||||
next major version of GTK are being marked as deprecated in GTK 4.
|
||||
|
||||
Removing the use of deprecated APIs is the most important step
|
||||
to prepare your code for the next major version of GTK. Often,
|
||||
deprecation notes will include hints about replacement APIs to
|
||||
help you with this.
|
||||
|
||||
Sometimes, it is helpful to have some background information about
|
||||
the motivation and goals of larger API changes.
|
||||
|
||||
## Cell renderers are going away
|
||||
|
||||
Cell renderers were introduced in GTK 2 to support rendering of
|
||||
"big data" UIs, in particular treeviews. Over the years, more
|
||||
"data-like" widgets have started to use them, and cell renderers
|
||||
have grown into a shadowy, alternative rendering infrastructure
|
||||
that duplicates much of what widgets do, while duplicating the
|
||||
code and adding their own dose of bugs.
|
||||
|
||||
In GTK 4, replacement widgets for GtkTreeView, GtkIconView and
|
||||
GtkComboBox have appeared: GtkListView, GtkColumnView, GtkGridView
|
||||
and GtkDropDown. For GTK 5, we will take the next step and remove
|
||||
all cell renderer-based widgets.
|
||||
|
||||
## Themed rendering APIs are going away
|
||||
|
||||
The old GTK 2 era rendering APIs for theme components like
|
||||
gtk_render_frame() or gtk_render_check() have not been used by
|
||||
GTK itself even in later GTK 3, but they have been kepy around
|
||||
for the benefit of "external drawing" users - applications that
|
||||
want their controls to look like GTK without using widgets.
|
||||
|
||||
Supporting this is increasingly getting in the way of making
|
||||
the GTK CSS machinery fast and correct. One notable problem is
|
||||
that temporary style changes (using gtk_style_context_save())
|
||||
is breaking animations. Therefore, these APIs will be going away
|
||||
in GTK 5, together with their more modern GtkSnapshot variants
|
||||
like gtk_snapshot_render_background() or gtk_snapshot_render_focus().
|
||||
|
||||
The best way to render parts of your widget using CSS styling
|
||||
is to use subwidgets. For example, to show a piece of text with
|
||||
fonts, effects and shadows according to the current CSS style,
|
||||
use a GtkLabel.
|
||||
|
||||
If you have a need for custom drawing that fits into the current
|
||||
(dark or light) theme, e.g. for rendering a graph, you can still
|
||||
get the current style foreground color, using
|
||||
[method@Gtk.Widget.get_style_color].
|
||||
|
||||
## Local stylesheets are going away
|
||||
|
||||
The cascading part of GTK's CSS implementation is complicated by
|
||||
the existence of local stylesheets (i.e. those added with
|
||||
gtk_style_context_add_provider()). And local stylesheets are
|
||||
unintuitive in that they do not apply to the whole subtree of
|
||||
widgets, but just to the one widget where the stylesheet was
|
||||
added.
|
||||
|
||||
GTK 5 will no longer provide this functionality. The recommendations
|
||||
is to use a global stylesheet (i.e. gtk_style_context_add_provider_for_display())
|
||||
and rely on style classes to make your CSS apply only where desired.
|
@@ -10,10 +10,6 @@ to determine paths to look for certain files. The [X11](#x11-envar),
|
||||
[Broadway](#broadway-envar) GDK backends use some additional
|
||||
environment variables.
|
||||
|
||||
Note that environment variables are generally used for debugging
|
||||
purposes. They are not guaranteed to be API stable, and should not
|
||||
be used for end-user configuration and customization.
|
||||
|
||||
### `GTK_DEBUG`
|
||||
|
||||
This variable can be set to a list of debug options, which cause GTK to
|
||||
@@ -79,9 +75,6 @@ A number of keys are influencing behavior instead of just logging:
|
||||
`snapshot`
|
||||
: Include debug render nodes in the generated snapshots
|
||||
|
||||
`invert-text-dir`
|
||||
: Invert the text direction, compared to the locale
|
||||
|
||||
The special value `all` can be used to turn on all debug options.
|
||||
The special value `help` can be used to obtain a list of all
|
||||
supported debug options.
|
||||
@@ -92,7 +85,8 @@ Specifies a list of directories to search when GTK is looking for
|
||||
dynamically loaded objects such as input method modules and print
|
||||
backends. If the path to the dynamically loaded object is given as
|
||||
an absolute path name, then GTK loads it directly. Otherwise, GTK
|
||||
goes in turn through the directories in `GTK_PATH`, followed
|
||||
goes in turn through the directories in `GTK_PATH`, followed by
|
||||
the directory `.gtk-4.0` in the user's home directory, followed
|
||||
by the system default directory, which is `libdir/gtk-4.0/modules`.
|
||||
(If `GTK_EXE_PREFIX` is defined, `libdir` is `$GTK_EXE_PREFIX/lib`.
|
||||
Otherwise it is the libdir specified when GTK was configured, usually
|
||||
@@ -211,33 +205,24 @@ A number of options affect behavior instead of logging:
|
||||
`gl-disable`
|
||||
: Disable OpenGL support
|
||||
|
||||
`gl-software`
|
||||
: Force OpenGL software rendering
|
||||
|
||||
`gl-texture-rect`
|
||||
: Use the OpenGL texture rectangle extension, if available
|
||||
|
||||
`gl-legacy`
|
||||
: Use a legacy OpenGL context
|
||||
|
||||
`gl-gles`
|
||||
: Use a GLES OpenGL context
|
||||
|
||||
`gl-egl`
|
||||
: Use an EGL context on X11 or Windows
|
||||
|
||||
`gl-glx`
|
||||
: Use GLX on X11
|
||||
|
||||
`gl-wgl`
|
||||
: Use WGL on Windows
|
||||
|
||||
`vulkan-disable`
|
||||
: Disable Vulkan support
|
||||
|
||||
`vulkan-validate`
|
||||
: Load the Vulkan validation layer, if available
|
||||
|
||||
`default-settings`
|
||||
: Force default values for xsettings
|
||||
|
||||
`high-depth`
|
||||
: Use high bit depth rendering if possible
|
||||
|
||||
The special value `all` can be used to turn on all debug options. The special
|
||||
value `help` can be used to obtain a list of all supported debug options.
|
||||
|
||||
@@ -354,20 +339,6 @@ using and the GDK backend supports them:
|
||||
`vulkan`
|
||||
: Selects the Vulkan renderer
|
||||
|
||||
Note that on Windows, if one is running Nahimic 3 on a system with
|
||||
nVidia graphics, one needs to stop the "Nahimic service" or insert
|
||||
the GTK application into the Nahimic blacklist, as noted in
|
||||
https://www.nvidia.com/en-us/geforce/forums/game-ready-drivers/13/297952/nahimic-and-nvidia-drivers-conflict/2334568/, or use the cairo renderer (at the cost of being unable to use
|
||||
OpenGL features), or use GDK_DEBUG=gl-gles if you know that GLES
|
||||
support is enabled for the build.
|
||||
|
||||
This is a known issue, as the above link indicates, and affects quite
|
||||
a number of applications--sadly, since this issue lies within the
|
||||
nVidia graphics driver and/or the Nahimic 3 code, we are not able
|
||||
to rememdy this on the GTK side; the best bet before trying the above
|
||||
workarounds is to try to update your graphics drivers and Nahimic
|
||||
installation.
|
||||
|
||||
### `GTK_CSD`
|
||||
|
||||
The default value of this environment variable is `1`. If changed
|
||||
|
@@ -1,13 +1,6 @@
|
||||
Title: Tree and List Widget Overview
|
||||
Slug: gtk-treeview
|
||||
|
||||
This document describes the `GtkTreeView` widget and auxiliary
|
||||
classes, like tree models and cell renderers. All of these have
|
||||
been deprecated and will be removed in GTK 5. Their replacements
|
||||
are described in the [List Widget Overview](section-list-widget.html).
|
||||
|
||||
## Introduction
|
||||
|
||||
To create a tree or list in GTK, use the `GtkTreeModel` interface in
|
||||
conjunction with the `GtkTreeView` widget. This widget is designed around
|
||||
a _Model/View/Controller_ design and consists of four major parts:
|
||||
|
@@ -7,7 +7,7 @@ the default.
|
||||
|
||||
More information about GTK on Windows, including detailed build
|
||||
instructions, binary downloads, etc, can be found
|
||||
[online](https://www.gtk.org/docs/installations/windows/).
|
||||
[online](https://wiki.gnome.org/Projects/GTK/Win32).
|
||||
|
||||
## Windows-specific environment variables
|
||||
|
||||
|
@@ -350,8 +350,7 @@ quit_activated (GSimpleAction *action,
|
||||
}
|
||||
|
||||
static void
|
||||
combo_changed (GtkDropDown *combo,
|
||||
GParamSpec *pspec,
|
||||
combo_changed (GtkComboBox *combo,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkDialog *dialog = user_data;
|
||||
@@ -360,7 +359,7 @@ combo_changed (GtkDropDown *combo,
|
||||
char **accels;
|
||||
char *str;
|
||||
|
||||
action = gtk_string_object_get_string (GTK_STRING_OBJECT (gtk_drop_down_get_selected_item (combo)));
|
||||
action = gtk_combo_box_get_active_id (combo);
|
||||
|
||||
if (!action)
|
||||
return;
|
||||
@@ -389,7 +388,7 @@ response (GtkDialog *dialog,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkEntry *entry = g_object_get_data (user_data, "entry");
|
||||
GtkDropDown *combo = g_object_get_data (user_data, "combo");
|
||||
GtkComboBox *combo = g_object_get_data (user_data, "combo");
|
||||
const char *action;
|
||||
const char *str;
|
||||
char **accels;
|
||||
@@ -400,7 +399,7 @@ response (GtkDialog *dialog,
|
||||
return;
|
||||
}
|
||||
|
||||
action = gtk_string_object_get_string (GTK_STRING_OBJECT (gtk_drop_down_get_selected_item (combo)));
|
||||
action = gtk_combo_box_get_active_id (combo);
|
||||
|
||||
if (!action)
|
||||
return;
|
||||
@@ -425,7 +424,6 @@ edit_accels (GSimpleAction *action,
|
||||
char **actions;
|
||||
GtkWidget *dialog;
|
||||
int i;
|
||||
GtkStringList *strings;
|
||||
|
||||
dialog = gtk_dialog_new_with_buttons ("Accelerators",
|
||||
NULL,
|
||||
@@ -437,8 +435,7 @@ edit_accels (GSimpleAction *action,
|
||||
gtk_window_set_application (GTK_WINDOW (dialog), app);
|
||||
actions = gtk_application_list_action_descriptions (app);
|
||||
|
||||
strings = gtk_string_list_new (NULL);
|
||||
combo = gtk_drop_down_new (G_LIST_MODEL (strings), NULL);
|
||||
combo = gtk_combo_box_text_new ();
|
||||
g_object_set (gtk_dialog_get_content_area (GTK_DIALOG (dialog)),
|
||||
"margin-top", 10,
|
||||
"margin-bottom", 10,
|
||||
@@ -449,8 +446,8 @@ edit_accels (GSimpleAction *action,
|
||||
|
||||
gtk_box_append (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), combo);
|
||||
for (i = 0; actions[i]; i++)
|
||||
gtk_string_list_append (strings, actions[i]);
|
||||
g_signal_connect (combo, "notify::selected", G_CALLBACK (combo_changed), dialog);
|
||||
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), actions[i], actions[i]);
|
||||
g_signal_connect (combo, "changed", G_CALLBACK (combo_changed), dialog);
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
gtk_widget_set_hexpand (entry, TRUE);
|
||||
@@ -461,7 +458,7 @@ edit_accels (GSimpleAction *action,
|
||||
g_object_set_data (G_OBJECT (dialog), "combo", combo);
|
||||
g_object_set_data (G_OBJECT (dialog), "entry", entry);
|
||||
|
||||
gtk_drop_down_set_selected (GTK_DROP_DOWN (combo), 0);
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
}
|
||||
|
@@ -13,7 +13,7 @@
|
||||
#include "gdkbroadway-server.h"
|
||||
|
||||
#include "gdkprivate-broadway.h"
|
||||
#include "gdkprivate.h"
|
||||
#include "gdk-private.h"
|
||||
|
||||
#include <gdk/gdktextureprivate.h>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#ifdef G_OS_WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gdkintl.h"
|
||||
|
||||
typedef struct BroadwayInput BroadwayInput;
|
||||
|
||||
|
@@ -84,7 +84,6 @@ gdk_broadway_device_query_state (GdkDevice *device,
|
||||
gint32 device_root_x, device_root_y;
|
||||
guint32 mouse_toplevel_id;
|
||||
guint32 mask32;
|
||||
int origin_x, origin_y;
|
||||
|
||||
if (gdk_device_get_source (device) != GDK_SOURCE_MOUSE)
|
||||
return;
|
||||
@@ -98,12 +97,10 @@ gdk_broadway_device_query_state (GdkDevice *device,
|
||||
&device_root_y,
|
||||
&mask32);
|
||||
|
||||
gdk_surface_get_origin (surface, &origin_x, &origin_y);
|
||||
|
||||
if (win_x)
|
||||
*win_x = device_root_x - origin_x;
|
||||
*win_x = device_root_x;
|
||||
if (win_y)
|
||||
*win_y = device_root_y - origin_y;
|
||||
*win_y = device_root_y;
|
||||
if (mask)
|
||||
*mask = mask32;
|
||||
}
|
||||
|
@@ -32,7 +32,7 @@
|
||||
#include "gdkdevice-broadway.h"
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include <gdk/gdktextureprivate.h>
|
||||
#include "gdkprivate.h"
|
||||
#include "gdk-private.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib/gprintf.h>
|
||||
@@ -213,7 +213,7 @@ _gdk_broadway_display_open (const char *display_name)
|
||||
broadway_display->server = _gdk_broadway_server_new (display, display_name, &error);
|
||||
if (broadway_display->server == NULL)
|
||||
{
|
||||
GDK_DEBUG (MISC, "Unable to init Broadway server: %s", error->message);
|
||||
GDK_NOTE (MISC, g_message ("Unable to init Broadway server: %s\n", error->message));
|
||||
g_error_free (error);
|
||||
return NULL;
|
||||
}
|
||||
|
@@ -262,8 +262,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
|
||||
message->key.state,
|
||||
FALSE,
|
||||
&translated,
|
||||
&translated,
|
||||
NULL);
|
||||
&translated);
|
||||
|
||||
node = _gdk_event_queue_append (display, event);
|
||||
_gdk_windowing_got_event (display, node, event, message->base.serial);
|
||||
|
@@ -47,10 +47,6 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 67, 3)
|
||||
# define g_memdup2(mem,size) g_memdup((mem), (size))
|
||||
#endif
|
||||
|
||||
/* Forward declarations */
|
||||
static void gdk_broadway_surface_finalize (GObject *object);
|
||||
|
||||
|
@@ -97,7 +97,7 @@ add_files (GDBusProxy *proxy,
|
||||
AddFileData *afd)
|
||||
{
|
||||
GUnixFDList *fd_list;
|
||||
GVariantBuilder fds, options;
|
||||
GVariantBuilder fds;
|
||||
int i;
|
||||
char *key;
|
||||
|
||||
@@ -146,10 +146,9 @@ add_files (GDBusProxy *proxy,
|
||||
|
||||
key = (char *)g_object_get_data (G_OBJECT (afd->task), "key");
|
||||
|
||||
g_variant_builder_init (&options, G_VARIANT_TYPE_VARDICT);
|
||||
g_dbus_proxy_call_with_unix_fd_list (proxy,
|
||||
"AddFiles",
|
||||
g_variant_new ("(saha{sv})", key, &fds, &options),
|
||||
g_variant_new ("(sah)", key, &fds),
|
||||
0, -1,
|
||||
fd_list,
|
||||
NULL,
|
||||
@@ -481,36 +480,20 @@ connection_closed (GDBusConnection *connection,
|
||||
}
|
||||
|
||||
static void
|
||||
finish_registration (void)
|
||||
got_proxy (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer data)
|
||||
{
|
||||
gdk_content_register_serializer (G_TYPE_FILE,
|
||||
"application/vnd.portal.filetransfer",
|
||||
portal_file_serializer,
|
||||
NULL,
|
||||
NULL);
|
||||
GError *error = NULL;
|
||||
|
||||
gdk_content_register_serializer (GDK_TYPE_FILE_LIST,
|
||||
"application/vnd.portal.filetransfer",
|
||||
portal_file_serializer,
|
||||
NULL,
|
||||
NULL);
|
||||
file_transfer_proxy = g_dbus_proxy_new_for_bus_finish (result, &error);
|
||||
if (!file_transfer_proxy)
|
||||
{
|
||||
g_message ("Failed to get file transfer portal: %s", error->message);
|
||||
g_clear_error (&error);
|
||||
return;
|
||||
}
|
||||
|
||||
gdk_content_register_deserializer ("application/vnd.portal.filetransfer",
|
||||
GDK_TYPE_FILE_LIST,
|
||||
portal_file_deserializer,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
gdk_content_register_deserializer ("application/vnd.portal.filetransfer",
|
||||
G_TYPE_FILE,
|
||||
portal_file_deserializer,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
/* FIXME: I missed up and used the wrong mime type here when
|
||||
* I implemented my own protocol. Keep these around for a while
|
||||
* so we can interoperate with existing flatpaks using GTK 4.6
|
||||
*/
|
||||
gdk_content_register_serializer (G_TYPE_FILE,
|
||||
"application/vnd.portal.files",
|
||||
portal_file_serializer,
|
||||
@@ -540,21 +523,6 @@ finish_registration (void)
|
||||
"closed", G_CALLBACK (connection_closed), NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
proxy_has_owner (GDBusProxy *proxy)
|
||||
{
|
||||
char *owner;
|
||||
|
||||
owner = g_dbus_proxy_get_name_owner (proxy);
|
||||
if (owner)
|
||||
{
|
||||
g_free (owner);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
file_transfer_portal_register (void)
|
||||
{
|
||||
@@ -563,8 +531,7 @@ file_transfer_portal_register (void)
|
||||
if (!called)
|
||||
{
|
||||
called = TRUE;
|
||||
|
||||
file_transfer_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
|
||||
g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
|
||||
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES
|
||||
| G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS
|
||||
| G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
|
||||
@@ -573,13 +540,8 @@ file_transfer_portal_register (void)
|
||||
"/org/freedesktop/portal/documents",
|
||||
"org.freedesktop.portal.FileTransfer",
|
||||
NULL,
|
||||
got_proxy,
|
||||
NULL);
|
||||
|
||||
if (file_transfer_proxy && !proxy_has_owner (file_transfer_proxy))
|
||||
g_clear_object (&file_transfer_proxy);
|
||||
|
||||
if (file_transfer_proxy)
|
||||
finish_registration ();
|
||||
}
|
||||
}
|
||||
|
||||
|
45
gdk/gdk-autocleanup.h
Normal file
45
gdk/gdk-autocleanup.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined (__GDK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gdk/gdk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __GI_SCANNER__
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkAppLaunchContext, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkClipboard, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkContentProvider, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkCursor, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDevice, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDisplay, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDisplayManager, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrag, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrawContext, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkFrameClock, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkGLContext, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkMonitor, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkSeat, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkPopupLayout, gdk_popup_layout_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkVulkanContext, g_object_unref)
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkContentFormats, gdk_content_formats_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkEvent, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkFrameTimings, gdk_frame_timings_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkRGBA, gdk_rgba_free)
|
||||
|
||||
#endif
|
@@ -59,8 +59,4 @@ void gdk_source_set_static_name_by_id (guint tag,
|
||||
#define g_source_set_static_name(source, name) g_source_set_name ((source), (name))
|
||||
#endif
|
||||
|
||||
#ifndef I_
|
||||
#define I_(string) g_intern_static_string (string)
|
||||
#endif
|
||||
|
||||
#endif /* __GDK__PRIVATE_H__ */
|
49
gdk/gdk.c
49
gdk/gdk.c
@@ -28,13 +28,12 @@
|
||||
|
||||
#include "gdkresources.h"
|
||||
|
||||
#include "gdkconstructorprivate.h"
|
||||
#include "gdkdebugprivate.h"
|
||||
#include "gdkconstructor.h"
|
||||
#include "gdkdebug.h"
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdkglcontextprivate.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gdkprivate.h"
|
||||
#include <glib/gprintf.h>
|
||||
#include "gdkintl.h"
|
||||
#include "gdk-private.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
@@ -117,17 +116,19 @@ static const GdkDebugKey gdk_debug_keys[] = {
|
||||
{ "vulkan", GDK_DEBUG_VULKAN, "Information about Vulkan" },
|
||||
{ "selection", GDK_DEBUG_SELECTION, "Information about selections" },
|
||||
{ "clipboard", GDK_DEBUG_CLIPBOARD, "Information about clipboards" },
|
||||
{ "nograbs", GDK_DEBUG_NOGRABS, "Disable pointer and keyboard grabs (X11)", TRUE },
|
||||
{ "portals", GDK_DEBUG_PORTALS, "Force the use of portals", TRUE },
|
||||
{ "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support", TRUE },
|
||||
{ "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL", TRUE },
|
||||
{ "gl-legacy", GDK_DEBUG_GL_LEGACY, "Use a legacy OpenGL context", TRUE },
|
||||
{ "gl-gles", GDK_DEBUG_GL_GLES, "Only allow OpenGL GLES API", TRUE },
|
||||
{ "gl-egl", GDK_DEBUG_GL_EGL, "Use EGL on X11 or Windows", TRUE },
|
||||
{ "gl-glx", GDK_DEBUG_GL_GLX, "Use GLX on X11", TRUE },
|
||||
{ "gl-wgl", GDK_DEBUG_GL_WGL, "Use WGL on Windows", TRUE },
|
||||
{ "vulkan-disable", GDK_DEBUG_VULKAN_DISABLE, "Disable Vulkan support", TRUE },
|
||||
{ "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer", TRUE },
|
||||
{ "nograbs", GDK_DEBUG_NOGRABS, "Disable pointer and keyboard grabs (X11)" },
|
||||
{ "portals", GDK_DEBUG_PORTALS, "Force the use of portals" },
|
||||
{ "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support" },
|
||||
{ "gl-software", GDK_DEBUG_GL_SOFTWARE, "Force OpenGL software rendering" },
|
||||
{ "gl-texture-rect", GDK_DEBUG_GL_TEXTURE_RECT, "Use OpenGL texture rectangle extension" },
|
||||
{ "gl-legacy", GDK_DEBUG_GL_LEGACY, "Use a legacy OpenGL context" },
|
||||
{ "gl-gles", GDK_DEBUG_GL_GLES, "Only allow OpenGL GLES API" },
|
||||
{ "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL" },
|
||||
{ "gl-egl", GDK_DEBUG_GL_EGL, "Use EGL on X11 or Windows" },
|
||||
{ "gl-glx", GDK_DEBUG_GL_GLX, "Use GLX on X11" },
|
||||
{ "gl-wgl", GDK_DEBUG_GL_WGL, "Use WGL on Windows" },
|
||||
{ "vulkan-disable", GDK_DEBUG_VULKAN_DISABLE, "Disable Vulkan support" },
|
||||
{ "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer" },
|
||||
{ "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 },
|
||||
};
|
||||
@@ -257,12 +258,16 @@ gdk_parse_debug_var (const char *variable,
|
||||
|
||||
fprintf (stderr, "Supported %s values:\n", variable);
|
||||
for (i = 0; i < nkeys; i++) {
|
||||
if (debug_enabled || keys[i].always_enabled)
|
||||
fprintf (stderr, " %s%*s%s\n", keys[i].key, (int)(max_width - strlen (keys[i].key)), " ", keys[i].help);
|
||||
fprintf (stderr, " %s%*s%s", keys[i].key, (int)(max_width - strlen (keys[i].key)), " ", keys[i].help);
|
||||
if (!debug_enabled && !keys[i].always_enabled)
|
||||
fprintf (stderr, " [unavailable]");
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
fprintf (stderr, " %s%*s%s\n", "all", max_width - 3, " ", "Enable all values");
|
||||
fprintf (stderr, " %s%*s%s\n", "help", max_width - 4, " ", "Print this help");
|
||||
fprintf (stderr, "\nMultiple values can be given, separated by : or space.\n");
|
||||
if (!debug_enabled)
|
||||
fprintf (stderr, "Values marked as [unavailable] are only accessible if GTK is built with G_ENABLE_DEBUG.\n");
|
||||
}
|
||||
|
||||
if (invert)
|
||||
@@ -293,11 +298,11 @@ gdk_pre_parse (void)
|
||||
G_N_ELEMENTS (gdk_debug_keys));
|
||||
|
||||
/* These are global */
|
||||
if (_gdk_debug_flags & GDK_DEBUG_GL_EGL)
|
||||
if (GDK_DEBUG_CHECK (GL_EGL))
|
||||
gdk_gl_backend_use (GDK_GL_EGL);
|
||||
else if (_gdk_debug_flags & GDK_DEBUG_GL_GLX)
|
||||
else if (GDK_DEBUG_CHECK (GL_GLX))
|
||||
gdk_gl_backend_use (GDK_GL_GLX);
|
||||
else if (_gdk_debug_flags & GDK_DEBUG_GL_WGL)
|
||||
else if (GDK_DEBUG_CHECK (GL_WGL))
|
||||
gdk_gl_backend_use (GDK_GL_WGL);
|
||||
|
||||
#ifndef G_HAS_CONSTRUCTORS
|
||||
@@ -356,7 +361,7 @@ gdk_running_in_sandbox (void)
|
||||
gboolean
|
||||
gdk_should_use_portal (void)
|
||||
{
|
||||
if (gdk_display_get_debug_flags (NULL) & GDK_DEBUG_PORTALS)
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (NULL, PORTALS))
|
||||
return TRUE;
|
||||
|
||||
if (gdk_running_in_sandbox ())
|
||||
|
@@ -76,6 +76,8 @@
|
||||
#include <gdk/gdkversionmacros.h>
|
||||
#include <gdk/gdkvulkancontext.h>
|
||||
|
||||
#include <gdk/gdk-autocleanup.h>
|
||||
|
||||
#undef __GDK_H_INSIDE__
|
||||
|
||||
#endif /* __GDK_H__ */
|
||||
|
@@ -22,7 +22,7 @@
|
||||
|
||||
#include "gdkapplaunchcontextprivate.h"
|
||||
#include "gdkdisplay.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gdkintl.h"
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -54,7 +54,6 @@ GDK_AVAILABLE_IN_ALL
|
||||
void gdk_app_launch_context_set_icon_name (GdkAppLaunchContext *context,
|
||||
const char *icon_name);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkAppLaunchContext, g_object_unref)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@@ -26,10 +26,9 @@
|
||||
#include "gdkcontentproviderprivate.h"
|
||||
#include "gdkcontentserializer.h"
|
||||
#include "gdkdisplay.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gdkintl.h"
|
||||
#include "gdkpipeiostreamprivate.h"
|
||||
#include "gdktexture.h"
|
||||
#include "gdkprivate.h"
|
||||
|
||||
#include <gobject/gvaluecollector.h>
|
||||
|
||||
@@ -409,7 +408,7 @@ gdk_clipboard_class_init (GdkClipboardClass *class)
|
||||
* Emitted when the clipboard changes ownership.
|
||||
*/
|
||||
signals[CHANGED] =
|
||||
g_signal_new (I_("changed"),
|
||||
g_signal_new ("changed",
|
||||
G_TYPE_FROM_CLASS (class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GdkClipboardClass, changed),
|
||||
|
@@ -120,8 +120,6 @@ GDK_AVAILABLE_IN_ALL
|
||||
void gdk_clipboard_set_texture (GdkClipboard *clipboard,
|
||||
GdkTexture *texture);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkClipboard, g_object_unref)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_CLIPBOARD_H__ */
|
||||
|
@@ -16,8 +16,6 @@ G_BEGIN_DECLS
|
||||
#mesondefine GDK_WINDOWING_WAYLAND
|
||||
#mesondefine GDK_WINDOWING_WIN32
|
||||
|
||||
#mesondefine GDK_RENDERING_CAIRO
|
||||
#mesondefine GDK_RENDERING_GL
|
||||
#mesondefine GDK_RENDERING_VULKAN
|
||||
|
||||
G_END_DECLS
|
||||
|
@@ -25,7 +25,6 @@
|
||||
#include "filetransferportalprivate.h"
|
||||
#include "gdktexture.h"
|
||||
#include "gdkrgbaprivate.h"
|
||||
#include "gdkprivate.h"
|
||||
#include "loaders/gdkpngprivate.h"
|
||||
#include "loaders/gdktiffprivate.h"
|
||||
|
||||
@@ -355,14 +354,12 @@ gdk_content_deserializer_return_success (GdkContentDeserializer *deserializer)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_CONTENT_DESERIALIZER (deserializer));
|
||||
g_return_if_fail (!deserializer->returned);
|
||||
guint source_id;
|
||||
|
||||
deserializer->returned = TRUE;
|
||||
source_id = g_idle_add_full (deserializer->priority,
|
||||
gdk_content_deserializer_emit_callback,
|
||||
deserializer,
|
||||
g_object_unref);
|
||||
gdk_source_set_static_name_by_id (source_id, "[gtk] gdk_content_deserializer_emit_callback");
|
||||
g_idle_add_full (deserializer->priority,
|
||||
gdk_content_deserializer_emit_callback,
|
||||
deserializer,
|
||||
g_object_unref);
|
||||
/* NB: the idle will destroy our reference */
|
||||
}
|
||||
|
||||
@@ -410,6 +407,8 @@ gdk_content_register_deserializer (const char *mime_type,
|
||||
g_return_if_fail (mime_type != NULL);
|
||||
g_return_if_fail (deserialize != NULL);
|
||||
|
||||
init ();
|
||||
|
||||
deserializer = g_slice_new0 (Deserializer);
|
||||
|
||||
deserializer->mime_type = g_intern_string (mime_type);
|
||||
|
@@ -184,7 +184,7 @@ gdk_content_formats_new_for_gtype (GType type)
|
||||
* @string: the string to parse
|
||||
*
|
||||
* Parses the given @string into `GdkContentFormats` and
|
||||
* returns the formats.
|
||||
* returns the formats.
|
||||
*
|
||||
* Strings printed via [method@Gdk.ContentFormats.to_string]
|
||||
* can be read in again successfully using this function.
|
||||
@@ -540,7 +540,7 @@ gdk_content_formats_get_gtypes (const GdkContentFormats *formats,
|
||||
|
||||
if (n_gtypes)
|
||||
*n_gtypes = formats->n_gtypes;
|
||||
|
||||
|
||||
return formats->gtypes;
|
||||
}
|
||||
|
||||
@@ -567,7 +567,7 @@ gdk_content_formats_get_mime_types (const GdkContentFormats *formats,
|
||||
|
||||
if (n_mime_types)
|
||||
*n_mime_types = formats->n_mime_types;
|
||||
|
||||
|
||||
return formats->mime_types;
|
||||
}
|
||||
|
||||
@@ -663,7 +663,7 @@ gdk_content_formats_builder_unref (GdkContentFormatsBuilder *builder)
|
||||
|
||||
if (builder->ref_count > 0)
|
||||
return;
|
||||
|
||||
|
||||
gdk_content_formats_builder_clear (builder);
|
||||
g_slice_free (GdkContentFormatsBuilder, builder);
|
||||
}
|
||||
@@ -862,50 +862,4 @@ gdk_file_list_get_files (GdkFileList *file_list)
|
||||
return g_slist_copy ((GSList *) file_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_file_list_new_from_list:
|
||||
* @files: (element-type GFile): a list of files
|
||||
*
|
||||
* Creates a new files list container from a singly linked list of
|
||||
* `GFile` instances.
|
||||
*
|
||||
* This function is meant to be used by language bindings
|
||||
*
|
||||
* Returns: (transfer full): the newly created files list
|
||||
*
|
||||
* Since: 4.8
|
||||
*/
|
||||
GdkFileList *
|
||||
gdk_file_list_new_from_list (GSList *files)
|
||||
{
|
||||
return gdk_file_list_copy (files);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_file_list_new_from_array:
|
||||
* @files: (array length=n_files): the files to add to the list
|
||||
* @n_files: the number of files in the array
|
||||
*
|
||||
* Creates a new `GdkFileList` for the given array of files.
|
||||
*
|
||||
* This function is meant to be used by language bindings.
|
||||
*
|
||||
* Returns: (transfer full): the newly create files list
|
||||
*
|
||||
* Since: 4.8
|
||||
*/
|
||||
GdkFileList *
|
||||
gdk_file_list_new_from_array (GFile **files,
|
||||
gsize n_files)
|
||||
{
|
||||
if (files == NULL || n_files == 0)
|
||||
return NULL;
|
||||
|
||||
GSList *res = NULL;
|
||||
for (gssize i = n_files - 1; i >= 0; i--)
|
||||
res = g_slist_prepend (res, g_object_ref (files[i]));
|
||||
|
||||
return (GdkFileList *) res;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
@@ -106,8 +106,6 @@ GDK_AVAILABLE_IN_ALL
|
||||
void gdk_content_formats_builder_add_gtype (GdkContentFormatsBuilder *builder,
|
||||
GType type);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkContentFormats, gdk_content_formats_unref)
|
||||
|
||||
/* dunno where else to put this */
|
||||
#define GDK_TYPE_FILE_LIST (gdk_file_list_get_type ())
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
@@ -124,11 +122,6 @@ typedef struct _GdkFileList GdkFileList;
|
||||
|
||||
GDK_AVAILABLE_IN_4_6
|
||||
GSList * gdk_file_list_get_files (GdkFileList *file_list);
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
GdkFileList * gdk_file_list_new_from_list (GSList *files);
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
GdkFileList * gdk_file_list_new_from_array (GFile **files,
|
||||
gsize n_files);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@@ -22,8 +22,7 @@
|
||||
|
||||
#include "gdkclipboard.h"
|
||||
#include "gdkcontentformats.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gdkprivate.h"
|
||||
#include "gdkintl.h"
|
||||
|
||||
/**
|
||||
* GdkContentProvider:
|
||||
@@ -198,7 +197,7 @@ gdk_content_provider_class_init (GdkContentProviderClass *class)
|
||||
* Emitted whenever the content provided by this provider has changed.
|
||||
*/
|
||||
signals[CONTENT_CHANGED] =
|
||||
g_signal_new (I_("content-changed"),
|
||||
g_signal_new ("content-changed",
|
||||
G_TYPE_FROM_CLASS (class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GdkContentProviderClass, content_changed),
|
||||
|
@@ -111,9 +111,6 @@ GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_content_provider_get_value (GdkContentProvider *provider,
|
||||
GValue *value,
|
||||
GError **error);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkContentProvider, g_object_unref)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_CONTENT_PROVIDER_H__ */
|
||||
|
@@ -24,10 +24,10 @@
|
||||
|
||||
#include "gdkcontentformats.h"
|
||||
#include "gdkcontentserializer.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gdkintl.h"
|
||||
#include "gdkcontentproviderimpl.h"
|
||||
|
||||
#include "gdkprivate.h"
|
||||
#include "gdk-private.h"
|
||||
|
||||
#define GDK_TYPE_CONTENT_PROVIDER_VALUE (gdk_content_provider_value_get_type ())
|
||||
#define GDK_CONTENT_PROVIDER_VALUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_CONTENT_PROVIDER_VALUE, GdkContentProviderValue))
|
||||
|
@@ -30,7 +30,6 @@
|
||||
#include "loaders/gdktiffprivate.h"
|
||||
#include "loaders/gdkjpegprivate.h"
|
||||
#include "gdkmemorytextureprivate.h"
|
||||
#include "gdkprivate.h"
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <string.h>
|
||||
@@ -361,14 +360,12 @@ gdk_content_serializer_return_success (GdkContentSerializer *serializer)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_CONTENT_SERIALIZER (serializer));
|
||||
g_return_if_fail (!serializer->returned);
|
||||
guint source_id;
|
||||
|
||||
serializer->returned = TRUE;
|
||||
source_id = g_idle_add_full (serializer->priority,
|
||||
gdk_content_serializer_emit_callback,
|
||||
serializer,
|
||||
g_object_unref);
|
||||
gdk_source_set_static_name_by_id (source_id, "[gtk] gdk_content_serializer_emit_callback");
|
||||
g_idle_add_full (serializer->priority,
|
||||
gdk_content_serializer_emit_callback,
|
||||
serializer,
|
||||
g_object_unref);
|
||||
/* NB: the idle will destroy our reference */
|
||||
}
|
||||
|
||||
@@ -416,6 +413,8 @@ gdk_content_register_serializer (GType type,
|
||||
g_return_if_fail (mime_type != NULL);
|
||||
g_return_if_fail (serialize != NULL);
|
||||
|
||||
init ();
|
||||
|
||||
serializer = g_slice_new0 (Serializer);
|
||||
|
||||
serializer->mime_type = g_intern_string (mime_type);
|
||||
@@ -879,7 +878,7 @@ file_text_serializer (GdkContentSerializer *serializer)
|
||||
g_string_append (str, path);
|
||||
g_free (path);
|
||||
if (l->next)
|
||||
g_string_append (str, "\n");
|
||||
g_string_append (str, " ");
|
||||
}
|
||||
path = g_string_free (str, FALSE);
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@
|
||||
#include "gdkcursor.h"
|
||||
#include "gdkcursorprivate.h"
|
||||
#include "gdktexture.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gdkintl.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <errno.h>
|
||||
|
@@ -64,7 +64,6 @@ int gdk_cursor_get_hotspot_x (GdkCursor *cursor);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
int gdk_cursor_get_hotspot_y (GdkCursor *cursor);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkCursor, g_object_unref)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@@ -21,7 +21,6 @@
|
||||
#include <glib.h>
|
||||
|
||||
#include "gdktypes.h"
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -41,6 +40,8 @@ typedef enum {
|
||||
GDK_DEBUG_NOGRABS = 1 << 11,
|
||||
GDK_DEBUG_PORTALS = 1 << 12,
|
||||
GDK_DEBUG_GL_DISABLE = 1 << 13,
|
||||
GDK_DEBUG_GL_SOFTWARE = 1 << 14,
|
||||
GDK_DEBUG_GL_TEXTURE_RECT = 1 << 15,
|
||||
GDK_DEBUG_GL_LEGACY = 1 << 16,
|
||||
GDK_DEBUG_GL_GLES = 1 << 17,
|
||||
GDK_DEBUG_GL_DEBUG = 1 << 18,
|
||||
@@ -59,27 +60,22 @@ GdkDebugFlags gdk_display_get_debug_flags (GdkDisplay *display);
|
||||
void gdk_display_set_debug_flags (GdkDisplay *display,
|
||||
GdkDebugFlags flags);
|
||||
|
||||
#define gdk_debug_message(format, ...) g_fprintf (stderr, format "\n", ##__VA_ARGS__)
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
|
||||
#define GDK_DISPLAY_DEBUG_CHECK(display,type) \
|
||||
G_UNLIKELY (gdk_display_get_debug_flags (display) & GDK_DEBUG_##type)
|
||||
|
||||
#define GDK_DISPLAY_DEBUG(display,type,...) \
|
||||
G_STMT_START { \
|
||||
#define GDK_DISPLAY_NOTE(display,type,action) G_STMT_START { \
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (display,type)) \
|
||||
gdk_debug_message (__VA_ARGS__); \
|
||||
} G_STMT_END
|
||||
{ action; }; } G_STMT_END
|
||||
|
||||
#else /* !G_ENABLE_DEBUG */
|
||||
|
||||
#define GDK_DISPLAY_DEBUG_CHECK(display,type) 0
|
||||
#define GDK_DISPLAY_DEBUG(display,type,...)
|
||||
#define GDK_DISPLAY_NOTE(display,type,action)
|
||||
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
#define GDK_DEBUG_CHECK(type) GDK_DISPLAY_DEBUG_CHECK (NULL,type)
|
||||
#define GDK_DEBUG(type,...) GDK_DISPLAY_DEBUG (NULL,type,__VA_ARGS__)
|
||||
#define GDK_NOTE(type,action) GDK_DISPLAY_NOTE (NULL,type,action)
|
||||
|
||||
#endif
|
@@ -22,7 +22,7 @@
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include "gdkdevicetool.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gdkintl.h"
|
||||
#include "gdkkeysprivate.h"
|
||||
|
||||
/**
|
||||
|
@@ -126,9 +126,6 @@ GdkSurface * gdk_device_get_surface_at_position (GdkDevice *device,
|
||||
|
||||
GDK_AVAILABLE_IN_4_2
|
||||
guint32 gdk_device_get_timestamp (GdkDevice *device);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDevice, g_object_unref)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_DEVICE_H__ */
|
||||
|
@@ -21,7 +21,7 @@
|
||||
|
||||
#include "gdkdevicetoolprivate.h"
|
||||
#include "gdkenumtypes.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gdkintl.h"
|
||||
|
||||
/**
|
||||
* GdkDeviceTool:
|
||||
|
@@ -24,8 +24,8 @@
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gdkprivate.h"
|
||||
#include "gdkintl.h"
|
||||
#include "gdk-private.h"
|
||||
|
||||
#include "gdkapplaunchcontext.h"
|
||||
#include "gdkclipboardprivate.h"
|
||||
@@ -1233,7 +1233,7 @@ gdk_display_init_gl (GdkDisplay *self)
|
||||
|
||||
before = GDK_PROFILER_CURRENT_TIME;
|
||||
|
||||
if (gdk_display_get_debug_flags (self) & GDK_DEBUG_GL_DISABLE)
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (self, GL_DISABLE))
|
||||
{
|
||||
g_set_error_literal (&priv->gl_error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
@@ -1729,31 +1729,28 @@ gdk_display_init_egl (GdkDisplay *self,
|
||||
if (priv->egl_config_high_depth == NULL)
|
||||
priv->egl_config_high_depth = priv->egl_config;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (self, OPENGL))
|
||||
{
|
||||
GDK_DISPLAY_NOTE (self, OPENGL, {
|
||||
char *ext = describe_extensions (priv->egl_display);
|
||||
char *std_cfg = describe_egl_config (priv->egl_display, priv->egl_config);
|
||||
char *hd_cfg = describe_egl_config (priv->egl_display, priv->egl_config_high_depth);
|
||||
gdk_debug_message ("EGL API version %d.%d found\n"
|
||||
" - Vendor: %s\n"
|
||||
" - Version: %s\n"
|
||||
" - Client APIs: %s\n"
|
||||
" - Extensions:\n"
|
||||
"\t%s\n"
|
||||
" - Selected fbconfig: %s\n"
|
||||
" high depth: %s",
|
||||
major, minor,
|
||||
eglQueryString (priv->egl_display, EGL_VENDOR),
|
||||
eglQueryString (priv->egl_display, EGL_VERSION),
|
||||
eglQueryString (priv->egl_display, EGL_CLIENT_APIS),
|
||||
ext, std_cfg,
|
||||
priv->egl_config_high_depth == priv->egl_config ? "none" : hd_cfg);
|
||||
g_message ("EGL API version %d.%d found\n"
|
||||
" - Vendor: %s\n"
|
||||
" - Version: %s\n"
|
||||
" - Client APIs: %s\n"
|
||||
" - Extensions:\n"
|
||||
"\t%s\n"
|
||||
" - Selected fbconfig: %s\n"
|
||||
" high depth: %s",
|
||||
major, minor,
|
||||
eglQueryString (priv->egl_display, EGL_VENDOR),
|
||||
eglQueryString (priv->egl_display, EGL_VERSION),
|
||||
eglQueryString (priv->egl_display, EGL_CLIENT_APIS),
|
||||
ext, std_cfg,
|
||||
priv->egl_config_high_depth == priv->egl_config ? "none" : hd_cfg);
|
||||
g_free (hd_cfg);
|
||||
g_free (std_cfg);
|
||||
g_free (ext);
|
||||
}
|
||||
#endif
|
||||
});
|
||||
|
||||
gdk_profiler_end_mark (start_time, "init EGL", NULL);
|
||||
|
||||
|
@@ -136,7 +136,7 @@ gboolean gdk_display_get_setting (GdkDisplay *display,
|
||||
const char *name,
|
||||
GValue *value);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDisplay, g_object_unref)
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@@ -28,7 +28,7 @@
|
||||
#include "gdkdisplaymanagerprivate.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkkeysprivate.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gdkintl.h"
|
||||
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
#include "x11/gdkx.h"
|
||||
@@ -420,7 +420,7 @@ gdk_display_manager_open_display (GdkDisplayManager *manager,
|
||||
(any && strstr (allowed_backends, gdk_backends[j].name)) ||
|
||||
g_str_equal (backend, gdk_backends[j].name))
|
||||
{
|
||||
GDK_DEBUG (MISC, "Trying %s backend", gdk_backends[j].name);
|
||||
GDK_NOTE (MISC, g_message ("Trying %s backend", gdk_backends[j].name));
|
||||
display = gdk_backends[j].open_display (name);
|
||||
if (display)
|
||||
break;
|
||||
|
@@ -34,6 +34,7 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define GDK_TYPE_DISPLAY_MANAGER (gdk_display_manager_get_type ())
|
||||
#define GDK_DISPLAY_MANAGER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DISPLAY_MANAGER, GdkDisplayManager))
|
||||
#define GDK_IS_DISPLAY_MANAGER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DISPLAY_MANAGER))
|
||||
@@ -57,7 +58,6 @@ GdkDisplay * gdk_display_manager_open_display (GdkDisplayManager *m
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_set_allowed_backends (const char *backends);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDisplayManager, g_object_unref)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@@ -22,7 +22,7 @@
|
||||
#include "gdksurface.h"
|
||||
#include "gdkcursor.h"
|
||||
#include "gdkmonitor.h"
|
||||
#include "gdkdebugprivate.h"
|
||||
#include "gdkdebug.h"
|
||||
#include "gdksurfaceprivate.h"
|
||||
#include "gdkkeysprivate.h"
|
||||
#include "gdkdeviceprivate.h"
|
||||
|
@@ -42,7 +42,7 @@
|
||||
#include "gdkdragprivate.h"
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdksurface.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gdkintl.h"
|
||||
#include "gdkcontentformats.h"
|
||||
#include "gdkcontentprovider.h"
|
||||
#include "gdkcontentserializer.h"
|
||||
|
@@ -99,8 +99,6 @@ GdkContentProvider *
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkSurface * gdk_drag_get_surface (GdkDrag *drag);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrag, g_object_unref)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_DND_H__ */
|
||||
|
@@ -19,9 +19,9 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkprivate.h"
|
||||
#include "gdk-private.h"
|
||||
#include "gdkdragsurfaceprivate.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gdkintl.h"
|
||||
|
||||
/**
|
||||
* GdkDragSurface:
|
||||
|
@@ -22,8 +22,8 @@
|
||||
|
||||
#include "gdkdrawcontextprivate.h"
|
||||
|
||||
#include "gdkdebugprivate.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gdkdebug.h"
|
||||
#include "gdkintl.h"
|
||||
#include "gdkprofilerprivate.h"
|
||||
#include "gdksurfaceprivate.h"
|
||||
|
||||
@@ -364,7 +364,7 @@ gdk_draw_context_begin_frame_full (GdkDrawContext *context,
|
||||
return;
|
||||
}
|
||||
|
||||
if (gdk_display_get_debug_flags (priv->display) & GDK_DEBUG_HIGH_DEPTH)
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (priv->display, HIGH_DEPTH))
|
||||
prefers_high_depth = TRUE;
|
||||
|
||||
priv->frame_region = cairo_region_copy (region);
|
||||
|
@@ -52,8 +52,6 @@ gboolean gdk_draw_context_is_in_frame (GdkDrawContext
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
const cairo_region_t * gdk_draw_context_get_frame_region (GdkDrawContext *context);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrawContext, g_object_unref)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_DRAW_CONTEXT__ */
|
||||
|
@@ -49,7 +49,7 @@
|
||||
#include "gdkdragprivate.h"
|
||||
#include "gdkenumtypes.h"
|
||||
#include "gdkeventsprivate.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gdkintl.h"
|
||||
#include "gdkpipeiostreamprivate.h"
|
||||
#include "gdksurface.h"
|
||||
|
||||
|
@@ -31,6 +31,8 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrop, g_object_unref)
|
||||
|
||||
#define GDK_TYPE_DROP (gdk_drop_get_type ())
|
||||
#define GDK_DROP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DROP, GdkDrop))
|
||||
#define GDK_IS_DROP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DROP))
|
||||
@@ -83,8 +85,6 @@ const GValue * gdk_drop_read_value_finish (GdkDrop
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrop, g_object_unref)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_DROP_H__ */
|
||||
|
41
gdk/gdkenumtypes.c.template
Normal file
41
gdk/gdkenumtypes.c.template
Normal file
@@ -0,0 +1,41 @@
|
||||
/*** BEGIN file-header ***/
|
||||
#include "config.h"
|
||||
#include "gdk.h"
|
||||
|
||||
/*** END file-header ***/
|
||||
|
||||
/*** BEGIN file-production ***/
|
||||
/* enumerations from "@basename@" */
|
||||
/*** END file-production ***/
|
||||
|
||||
/*** BEGIN value-header ***/
|
||||
GType
|
||||
@enum_name@_get_type (void)
|
||||
{
|
||||
static gsize g_define_type_id__volatile = 0;
|
||||
|
||||
if (g_once_init_enter (&g_define_type_id__volatile))
|
||||
{
|
||||
static const G@Type@Value values[] = {
|
||||
/*** END value-header ***/
|
||||
|
||||
/*** BEGIN value-production ***/
|
||||
{ @VALUENAME@, "@VALUENAME@", "@valuenick@" },
|
||||
/*** END value-production ***/
|
||||
|
||||
/*** BEGIN value-tail ***/
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
GType g_define_type_id =
|
||||
g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
|
||||
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
|
||||
}
|
||||
|
||||
return g_define_type_id__volatile;
|
||||
}
|
||||
|
||||
/*** END value-tail ***/
|
||||
|
||||
/*** BEGIN file-tail ***/
|
||||
/**/
|
||||
/*** END file-tail ***/
|
29
gdk/gdkenumtypes.h.template
Normal file
29
gdk/gdkenumtypes.h.template
Normal file
@@ -0,0 +1,29 @@
|
||||
/*** BEGIN file-header ***/
|
||||
#ifndef __GDK_ENUM_TYPES_H__
|
||||
#define __GDK_ENUM_TYPES_H__
|
||||
|
||||
#if !defined (__GDK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gdk/gdk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gdk/gdkversionmacros.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
/*** END file-header ***/
|
||||
|
||||
/*** BEGIN file-production ***/
|
||||
|
||||
/* enumerations from "@basename@" */
|
||||
/*** END file-production ***/
|
||||
|
||||
/*** BEGIN value-header ***/
|
||||
GDK_AVAILABLE_IN_ALL GType @enum_name@_get_type (void) G_GNUC_CONST;
|
||||
#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
|
||||
/*** END value-header ***/
|
||||
|
||||
/*** BEGIN file-tail ***/
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_ENUM_TYPES_H__ */
|
||||
/*** END file-tail ***/
|
148
gdk/gdkevents.c
148
gdk/gdkevents.c
@@ -28,10 +28,10 @@
|
||||
#include "gdkdragprivate.h"
|
||||
#include "gdkdropprivate.h"
|
||||
#include "gdkeventsprivate.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gdkintl.h"
|
||||
#include "gdkkeysprivate.h"
|
||||
#include "gdkkeysyms.h"
|
||||
#include "gdkprivate.h"
|
||||
#include "gdk-private.h"
|
||||
|
||||
#include <gobject/gvaluecollector.h>
|
||||
|
||||
@@ -402,15 +402,12 @@ gdk_event_alloc (GdkEventType event_type,
|
||||
|
||||
GdkEvent *event = (GdkEvent *) g_type_create_instance (gdk_event_types[event_type]);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DEBUG_CHECK (EVENTS))
|
||||
{
|
||||
char *str = g_enum_to_string (GDK_TYPE_EVENT_TYPE, event_type);
|
||||
gdk_debug_message ("Allocating a new %s for event type %s",
|
||||
g_type_name (gdk_event_types[event_type]), str);
|
||||
g_free (str);
|
||||
}
|
||||
#endif
|
||||
GDK_NOTE (EVENTS, {
|
||||
char *str = g_enum_to_string (GDK_TYPE_EVENT_TYPE, event_type);
|
||||
g_message ("Allocating a new %s for event type %s",
|
||||
g_type_name (gdk_event_types[event_type]), str);
|
||||
g_free (str);
|
||||
});
|
||||
|
||||
event->event_type = event_type;
|
||||
event->surface = surface != NULL ? g_object_ref (surface) : NULL;
|
||||
@@ -1517,16 +1514,6 @@ gdk_button_event_get_button (GdkEvent *event)
|
||||
* An event related to a key-based device.
|
||||
*/
|
||||
|
||||
static void
|
||||
gdk_key_event_finalize (GdkEvent *event)
|
||||
{
|
||||
GdkKeyEvent *self = (GdkKeyEvent *) event;
|
||||
|
||||
g_free (self->compose_sequence);
|
||||
|
||||
GDK_EVENT_SUPER (event)->finalize (event);
|
||||
}
|
||||
|
||||
static GdkModifierType
|
||||
gdk_key_event_get_state (GdkEvent *event)
|
||||
{
|
||||
@@ -1538,7 +1525,7 @@ gdk_key_event_get_state (GdkEvent *event)
|
||||
static const GdkEventTypeInfo gdk_key_event_info = {
|
||||
sizeof (GdkKeyEvent),
|
||||
NULL,
|
||||
gdk_key_event_finalize,
|
||||
NULL,
|
||||
gdk_key_event_get_state,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -1562,10 +1549,6 @@ GDK_DEFINE_EVENT_TYPE (GdkKeyEvent, gdk_key_event,
|
||||
* @is_modifier: whether the event is a modifiers only event
|
||||
* @translated: the translated key data for the given @state
|
||||
* @no_lock: the translated key data without the given @state
|
||||
* @compose_sequence: (transfer none) (nullable):
|
||||
* The compose sequence string, either partial or only the
|
||||
* final composed string, if that can be determined at event
|
||||
* creation time. Used by selected IM modules.
|
||||
*
|
||||
* Creates a new `GdkKeyEvent`.
|
||||
*
|
||||
@@ -1580,8 +1563,7 @@ gdk_key_event_new (GdkEventType type,
|
||||
GdkModifierType state,
|
||||
gboolean is_modifier,
|
||||
GdkTranslatedKey *translated,
|
||||
GdkTranslatedKey *no_lock,
|
||||
char *compose_sequence)
|
||||
GdkTranslatedKey *no_lock)
|
||||
{
|
||||
g_return_val_if_fail (type == GDK_KEY_PRESS ||
|
||||
type == GDK_KEY_RELEASE, NULL);
|
||||
@@ -1594,7 +1576,6 @@ gdk_key_event_new (GdkEventType type,
|
||||
self->key_is_modifier = is_modifier;
|
||||
self->translated[0] = *translated;
|
||||
self->translated[1] = *no_lock;
|
||||
self->compose_sequence = g_strdup (compose_sequence);
|
||||
|
||||
return event;
|
||||
}
|
||||
@@ -1625,26 +1606,6 @@ gdk_key_event_get_translated_key (GdkEvent *event,
|
||||
return &(self->translated[0]);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_key_event_get_compose_sequence:
|
||||
* @event: (type GdkKeyEvent): a key event
|
||||
*
|
||||
* Extracts the compose sequence string from a key event.
|
||||
*
|
||||
* Returns: (transfer none): the compose sequence string
|
||||
*/
|
||||
char *
|
||||
gdk_key_event_get_compose_sequence (GdkEvent *event)
|
||||
{
|
||||
GdkKeyEvent *self = (GdkKeyEvent *) event;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_EVENT (event), 0);
|
||||
g_return_val_if_fail (GDK_IS_EVENT_TYPE (event, GDK_KEY_PRESS) ||
|
||||
GDK_IS_EVENT_TYPE (event, GDK_KEY_RELEASE), FALSE);
|
||||
|
||||
return self->compose_sequence;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_key_event_get_keyval:
|
||||
* @event: (type GdkKeyEvent): a key event
|
||||
@@ -1812,7 +1773,7 @@ gdk_key_event_matches (GdkEvent *event,
|
||||
guint ev_keyval;
|
||||
int layout;
|
||||
int level;
|
||||
GdkModifierType ignored_modifiers;
|
||||
GdkModifierType consumed_modifiers;
|
||||
GdkModifierType shift_group_mask;
|
||||
gboolean group_mod_is_accel_mod = FALSE;
|
||||
const GdkModifierType mask = GDK_CONTROL_MASK |
|
||||
@@ -1831,23 +1792,7 @@ gdk_key_event_matches (GdkEvent *event,
|
||||
ev_keyval = self->translated[1].keyval;
|
||||
layout = self->translated[1].layout;
|
||||
level = self->translated[1].level;
|
||||
|
||||
/*
|
||||
* If a modifier is currently active (e.g. Shift is pressed) and was marked
|
||||
* as consumed, we ignore it for the purposes of matching shortcuts.
|
||||
* For example, when Ctrl+Shift+[plus/equals key] is translated into
|
||||
* Ctrl+plus on a keyboard where Shift+equals is the plus sign, we want
|
||||
* shortcuts for either <Control><Shift>plus or <Control>plus to match.
|
||||
* (See https://bugzilla.gnome.org/show_bug.cgi?id=100439)
|
||||
*
|
||||
* If a modifier is *not* currently active, the X11 backend can sometimes
|
||||
* mark it as consumed where the Wayland and Windows backends do not.
|
||||
* In this case, we still want to pay attention to its state.
|
||||
* For example, when Ctrl+x is translated into Ctrl+x, we only want to
|
||||
* trigger shortcuts for <Control>x, not for <Control><Shift>x.
|
||||
* (See https://gitlab.gnome.org/GNOME/gtk/-/issues/5095)
|
||||
*/
|
||||
ignored_modifiers = (self->translated[1].consumed & state);
|
||||
consumed_modifiers = self->translated[1].consumed;
|
||||
|
||||
/* if the group-toggling modifier is part of the default accel mod
|
||||
* mask, and it is active, disable it for matching
|
||||
@@ -1859,7 +1804,7 @@ gdk_key_event_matches (GdkEvent *event,
|
||||
if (mask & shift_group_mask)
|
||||
group_mod_is_accel_mod = TRUE;
|
||||
|
||||
if ((modifiers & ~ignored_modifiers & mask) == (state & ~ignored_modifiers & mask))
|
||||
if ((modifiers & ~consumed_modifiers & mask) == (state & ~consumed_modifiers & mask))
|
||||
{
|
||||
/* modifier match */
|
||||
GdkKeymapKey *keys;
|
||||
@@ -2423,75 +2368,10 @@ gdk_scroll_event_new_discrete (GdkSurface *surface,
|
||||
GdkScrollDirection direction)
|
||||
{
|
||||
GdkScrollEvent *self = gdk_event_alloc (GDK_SCROLL, surface, device, time);
|
||||
double delta_x = 0, delta_y = 0;
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
case GDK_SCROLL_UP:
|
||||
delta_y = -1;
|
||||
break;
|
||||
case GDK_SCROLL_DOWN:
|
||||
delta_y = 1;
|
||||
break;
|
||||
case GDK_SCROLL_LEFT:
|
||||
delta_x = -1;
|
||||
break;
|
||||
case GDK_SCROLL_RIGHT:
|
||||
delta_x = 1;
|
||||
break;
|
||||
case GDK_SCROLL_SMOOTH:
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
|
||||
self->tool = tool != NULL ? g_object_ref (tool) : NULL;
|
||||
self->state = state;
|
||||
self->direction = direction;
|
||||
self->delta_x = delta_x;
|
||||
self->delta_y = delta_y;
|
||||
self->unit = GDK_SCROLL_UNIT_WHEEL;
|
||||
|
||||
return (GdkEvent *) self;
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gtk_scroll_event_new_value120:
|
||||
* @surface: the `GdkSurface` of the event
|
||||
* @device: the `GdkDevice` of the event
|
||||
* @tool: (nullable): the tool that generated to event
|
||||
* @time: the event serial
|
||||
* @state: Flags to indicate the state of modifier keys and mouse buttons
|
||||
* in events.
|
||||
* @direction: scroll direction.
|
||||
* @delta_x: delta on the X axis in the 120.0 scale
|
||||
* @delta_x: delta on the Y axis in the 120.0 scale
|
||||
*
|
||||
* Creates a new discrete GdkScrollEvent for high resolution mouse wheels.
|
||||
*
|
||||
* Both axes send data in fractions of 120 where each multiple of 120
|
||||
* amounts to one logical scroll event. Fractions of 120 indicate a wheel
|
||||
* movement less than one detent.
|
||||
*
|
||||
* Returns: the newly created scroll event
|
||||
*/
|
||||
GdkEvent *
|
||||
gdk_scroll_event_new_value120 (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDeviceTool *tool,
|
||||
guint32 time,
|
||||
GdkModifierType state,
|
||||
GdkScrollDirection direction,
|
||||
double delta_x,
|
||||
double delta_y)
|
||||
{
|
||||
GdkScrollEvent *self = gdk_event_alloc (GDK_SCROLL, surface, device, time);
|
||||
|
||||
self->tool = tool != NULL ? g_object_ref (tool) : NULL;
|
||||
self->state = state;
|
||||
self->direction = direction;
|
||||
self->delta_x = delta_x / 120.0;
|
||||
self->delta_y = delta_y / 120.0;
|
||||
self->unit = GDK_SCROLL_UNIT_WHEEL;
|
||||
|
||||
return (GdkEvent *) self;
|
||||
@@ -2731,7 +2611,6 @@ gdk_touchpad_event_new_pinch (GdkSurface *surface,
|
||||
|
||||
GdkEvent *
|
||||
gdk_touchpad_event_new_hold (GdkSurface *surface,
|
||||
GdkEventSequence *sequence,
|
||||
GdkDevice *device,
|
||||
guint32 time,
|
||||
GdkModifierType state,
|
||||
@@ -2744,7 +2623,6 @@ gdk_touchpad_event_new_hold (GdkSurface *surface,
|
||||
|
||||
self->state = state;
|
||||
self->phase = phase;
|
||||
self->sequence = sequence;
|
||||
self->x = x;
|
||||
self->y = y;
|
||||
self->n_fingers = n_fingers;
|
||||
|
@@ -38,6 +38,7 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define GDK_TYPE_EVENT (gdk_event_get_type ())
|
||||
#define GDK_TYPE_EVENT_SEQUENCE (gdk_event_sequence_get_type ())
|
||||
|
||||
@@ -550,9 +551,6 @@ gboolean gdk_key_event_get_match (GdkEvent *event,
|
||||
guint *keyval,
|
||||
GdkModifierType *modifiers);
|
||||
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkEvent, gdk_event_unref)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_EVENTS_H__ */
|
||||
|
@@ -259,9 +259,6 @@ typedef struct {
|
||||
* @keycode: the raw code of the key that was pressed or released.
|
||||
* @translated: the result of translating @keycode. First with the full
|
||||
* @state, then while ignoring Caps Lock.
|
||||
* @compose_sequence: optional string for use by selected IM modules.
|
||||
* Contains either partial compose sequences or the final composed
|
||||
* string of the keystroke sequence.
|
||||
*
|
||||
* Describes a key press or key release event.
|
||||
*/
|
||||
@@ -273,7 +270,6 @@ struct _GdkKeyEvent
|
||||
guint32 keycode;
|
||||
gboolean key_is_modifier;
|
||||
GdkTranslatedKey translated[2];
|
||||
char *compose_sequence;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -474,8 +470,7 @@ GdkEvent * gdk_key_event_new (GdkEventType type,
|
||||
GdkModifierType modifiers,
|
||||
gboolean is_modifier,
|
||||
GdkTranslatedKey *translated,
|
||||
GdkTranslatedKey *no_lock,
|
||||
char *compose_sequence);
|
||||
GdkTranslatedKey *no_lock);
|
||||
|
||||
GdkEvent * gdk_focus_event_new (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
@@ -500,15 +495,6 @@ GdkEvent * gdk_scroll_event_new_discrete (GdkSurface *surface,
|
||||
GdkModifierType state,
|
||||
GdkScrollDirection direction);
|
||||
|
||||
GdkEvent * gdk_scroll_event_new_value120 (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDeviceTool *tool,
|
||||
guint32 time,
|
||||
GdkModifierType state,
|
||||
GdkScrollDirection direction,
|
||||
double delta_x,
|
||||
double delta_y);
|
||||
|
||||
GdkEvent * gdk_touch_event_new (GdkEventType type,
|
||||
GdkEventSequence *sequence,
|
||||
GdkSurface *surface,
|
||||
@@ -547,7 +533,6 @@ GdkEvent * gdk_touchpad_event_new_pinch (GdkSurface *surface,
|
||||
double angle_delta);
|
||||
|
||||
GdkEvent * gdk_touchpad_event_new_hold (GdkSurface *surface,
|
||||
GdkEventSequence *sequence,
|
||||
GdkDevice *device,
|
||||
guint32 time,
|
||||
GdkModifierType state,
|
||||
@@ -602,8 +587,6 @@ GdkEvent * gdk_grab_broken_event_new (GdkSurface *surface,
|
||||
GdkTranslatedKey * gdk_key_event_get_translated_key (GdkEvent *event,
|
||||
gboolean no_lock);
|
||||
|
||||
char * gdk_key_event_get_compose_sequence (GdkEvent *event);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
/* Following flag is set for events on the event queue during
|
||||
@@ -633,6 +616,7 @@ void _gdk_event_queue_flush (GdkDisplay *display);
|
||||
|
||||
double * gdk_event_dup_axes (GdkEvent *event);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_EVENTS_PRIVATE_H__ */
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user