Compare commits
1 Commits
shader-too
...
ebassi/fla
Author | SHA1 | Date | |
---|---|---|---|
|
0fa41887f1 |
@@ -1,4 +1,4 @@
|
|||||||
# See https://www.apertis.org/policies/coding_conventions/#code-formatting
|
# See https://wiki.apertis.org/Guidelines/Coding_conventions#Code_formatting
|
||||||
BasedOnStyle: GNU
|
BasedOnStyle: GNU
|
||||||
AlwaysBreakAfterDefinitionReturnType: All
|
AlwaysBreakAfterDefinitionReturnType: All
|
||||||
BreakBeforeBinaryOperators: None
|
BreakBeforeBinaryOperators: None
|
||||||
|
@@ -78,7 +78,6 @@ style-check-diff:
|
|||||||
- "${CI_PROJECT_DIR}/_build/testsuite/reftests/output/*/*.node"
|
- "${CI_PROJECT_DIR}/_build/testsuite/reftests/output/*/*.node"
|
||||||
- "${CI_PROJECT_DIR}/_build/testsuite/tools/output/*/*"
|
- "${CI_PROJECT_DIR}/_build/testsuite/tools/output/*/*"
|
||||||
- "${CI_PROJECT_DIR}/_build/testsuite/gsk/compare/*/*/*.png"
|
- "${CI_PROJECT_DIR}/_build/testsuite/gsk/compare/*/*/*.png"
|
||||||
- "${CI_PROJECT_DIR}/_build/testsuite/gsk/compare/*/*/*.node"
|
|
||||||
- "${CI_PROJECT_DIR}/_build/testsuite/css/output/*/*.syscap"
|
- "${CI_PROJECT_DIR}/_build/testsuite/css/output/*/*.syscap"
|
||||||
- "${CI_PROJECT_DIR}/_build/testsuite/headless/*/*.log"
|
- "${CI_PROJECT_DIR}/_build/testsuite/headless/*/*.log"
|
||||||
- "${CI_PROJECT_DIR}/_build_hello/meson-logs"
|
- "${CI_PROJECT_DIR}/_build_hello/meson-logs"
|
||||||
@@ -210,54 +209,51 @@ msys2-mingw64:
|
|||||||
paths:
|
paths:
|
||||||
- "${CI_PROJECT_DIR}/_build/gtkdll.tar.gz"
|
- "${CI_PROJECT_DIR}/_build/gtkdll.tar.gz"
|
||||||
|
|
||||||
macos:
|
macos-x86_64:
|
||||||
rules:
|
rules:
|
||||||
# Do not run in forks as the runner is not available there.
|
# Do not run in forks as the runner is not available there.
|
||||||
# (except for dehesselle who maintains the runner)
|
- if: $CI_PROJECT_NAMESPACE == "GNOME"
|
||||||
- if: $CI_PROJECT_NAMESPACE != "GNOME" && $CI_PROJECT_NAMESPACE != "dehesselle"
|
|
||||||
when: never
|
|
||||||
- if: $RUNNER == "macosintel"
|
|
||||||
variables:
|
|
||||||
SDKROOT: /opt/sdks/MacOSX10.13.4.sdk
|
|
||||||
NINJA_PKG: $CI_API_V4_URL/projects/30745/packages/generic/ninja_macos/v1.11.1.1+9/ninja-1.11.1.1-cp38-cp38-macosx_11_0_x86_64.whl
|
|
||||||
when: manual
|
|
||||||
allow_failure: true
|
|
||||||
- if: $RUNNER == "macosarm"
|
|
||||||
variables:
|
|
||||||
SDKROOT: /opt/sdks/MacOSX11.3.sdk
|
|
||||||
NINJA_PKG: ninja==1.11.1.1
|
|
||||||
stage: build
|
stage: build
|
||||||
parallel:
|
|
||||||
matrix:
|
|
||||||
- RUNNER: [ "macosintel", "macosarm" ]
|
|
||||||
tags:
|
tags:
|
||||||
- ${RUNNER}
|
- macosintel
|
||||||
needs: []
|
needs: []
|
||||||
variables:
|
variables:
|
||||||
EXTRA_MESON_FLAGS: ""
|
MESON_FORCE_BACKTRACKE: 1
|
||||||
BACKEND_FLAGS: "-Dx11-backend=false -Dbroadway-backend=true"
|
|
||||||
FEATURE_FLAGS: "-Dmedia-gstreamer=disabled -Dintrospection=enabled -Dgobject-introspection:werror=false"
|
|
||||||
TMPDIR: /Users/Shared/work/tmp
|
TMPDIR: /Users/Shared/work/tmp
|
||||||
|
SDKROOT: /opt/sdks/MacOSX10.13.4.sdk
|
||||||
PIP_CACHE_DIR: /Users/Shared/build/cache
|
PIP_CACHE_DIR: /Users/Shared/build/cache
|
||||||
PIPENV_CACHE_DIR: $PIP_CACHE_DIR
|
PIPENV_CACHE_DIR: $PIP_CACHE_DIR
|
||||||
PYTHONPYCACHEPREFIX: $PIP_CACHE_DIR
|
PYTHONPYCACHEPREFIX: $PIP_CACHE_DIR
|
||||||
|
EXTRA_MESON_FLAGS: "-Dgobject-introspection:werror=false"
|
||||||
before_script:
|
before_script:
|
||||||
- .gitlab-ci/show-info-macos.sh
|
# Not using ccache on purpose as it accelerates the build so much that it
|
||||||
- python3 -m venv .venv
|
# can trigger race conditions in the gobject-introspection subproject.
|
||||||
# Building the introspection feature requires pkg-config and bison.
|
- bash .gitlab-ci/show-info-osx.sh
|
||||||
- curl -L $CI_API_V4_URL/projects/30437/packages/generic/pkgconfig/v0.29.2+10/pkg-config-0.29.2+10_$(uname -m).tar.xz | tar -C .venv -xJ
|
- /opt/macports/bin/python3.10 -m venv .venv
|
||||||
- curl -L $CI_API_V4_URL/projects/30438/packages/generic/bison/v3.8.2+3/bison-3.8.2+3_$(uname -m).tar.xz | tar -C .venv -xJ
|
- ln -s /opt/cmake/CMake.app/Contents/bin/cmake .venv/bin
|
||||||
|
- ln -s /opt/pkg-config/bin/pkg-config .venv/bin
|
||||||
|
- ln -s /opt/bison/bin/bison .venv/bin
|
||||||
- source .venv/bin/activate
|
- source .venv/bin/activate
|
||||||
- pip3 install meson==1.3.2 $NINJA_PKG
|
- pip3 install meson==1.2.0
|
||||||
# We're not setting up ccache here on purpose as it accelerates the build
|
- pip3 install ninja==1.11.1
|
||||||
# so much that it triggers race conditions in the gobject-introspection
|
- pip3 install /Users/Shared/build/pkgs/PyGObject-3.44.0-cp310-cp310-macosx_10_13_x86_64.whl
|
||||||
# subproject.
|
/Users/Shared/build/pkgs/pycairo-1.23.0-cp310-cp310-macosx_10_13_x86_64.whl
|
||||||
script:
|
script:
|
||||||
- meson setup
|
- meson setup
|
||||||
${COMMON_MESON_FLAGS}
|
${COMMON_MESON_FLAGS}
|
||||||
${EXTRA_MESON_FLAGS}
|
${EXTRA_MESON_FLAGS}
|
||||||
${BACKEND_FLAGS}
|
-Dx11-backend=false
|
||||||
${FEATURE_FLAGS}
|
-Dbroadway-backend=true
|
||||||
|
-Dmacos-backend=true
|
||||||
|
-Dmedia-gstreamer=disabled
|
||||||
|
-Dintrospection=enabled
|
||||||
|
-Dcpp_std=c++11
|
||||||
|
-Dpixman:tests=disabled
|
||||||
|
-Dlibjpeg-turbo:simd=disabled
|
||||||
|
-Dbuild-demos=false
|
||||||
|
-Dbuild-tests=false
|
||||||
|
-Dbuild-examples=false
|
||||||
|
-Dbuild-testsuite=false
|
||||||
_build
|
_build
|
||||||
- meson compile -C _build
|
- meson compile -C _build
|
||||||
artifacts:
|
artifacts:
|
||||||
@@ -432,6 +428,13 @@ asan-build:
|
|||||||
_build
|
_build
|
||||||
- ninja -C _build
|
- ninja -C _build
|
||||||
- .gitlab-ci/run-tests.sh _build wayland gtk
|
- .gitlab-ci/run-tests.sh _build wayland gtk
|
||||||
|
artifacts:
|
||||||
|
when: always
|
||||||
|
reports:
|
||||||
|
junit:
|
||||||
|
- "${CI_PROJECT_DIR}/_build/report-wayland.xml"
|
||||||
|
paths:
|
||||||
|
- "${CI_PROJECT_DIR}/_build/meson-logs"
|
||||||
|
|
||||||
reference:
|
reference:
|
||||||
image: $FEDORA_IMAGE
|
image: $FEDORA_IMAGE
|
||||||
@@ -445,8 +448,9 @@ reference:
|
|||||||
--force-fallback-for=gdk-pixbuf,pango
|
--force-fallback-for=gdk-pixbuf,pango
|
||||||
-Dintrospection=enabled
|
-Dintrospection=enabled
|
||||||
-Ddocumentation=true
|
-Ddocumentation=true
|
||||||
|
-Dgtk_doc=true
|
||||||
-Dgdk-pixbuf:gtk_doc=true
|
-Dgdk-pixbuf:gtk_doc=true
|
||||||
-Dpango:documentation=true
|
-Dpango:gtk_doc=true
|
||||||
-Dbuild-demos=false
|
-Dbuild-demos=false
|
||||||
-Dbuild-examples=false
|
-Dbuild-examples=false
|
||||||
-Dbuild-tests=false
|
-Dbuild-tests=false
|
||||||
@@ -480,4 +484,3 @@ publish-docs:
|
|||||||
- "curl -X POST -F token=${PAGES_TRIGGER_TOKEN} -F ref=docs-gtk-org https://gitlab.gnome.org/api/v4/projects/665/trigger/pipeline"
|
- "curl -X POST -F token=${PAGES_TRIGGER_TOKEN} -F ref=docs-gtk-org https://gitlab.gnome.org/api/v4/projects/665/trigger/pipeline"
|
||||||
rules:
|
rules:
|
||||||
- if: $CI_COMMIT_REF_NAME == "main"
|
- if: $CI_COMMIT_REF_NAME == "main"
|
||||||
|
|
||||||
|
BIN
.gitlab-ci/.fedora.Dockerfile.swp
Normal file
@@ -2,6 +2,8 @@ FROM fedora:39
|
|||||||
|
|
||||||
RUN dnf -y install \
|
RUN dnf -y install \
|
||||||
adwaita-icon-theme \
|
adwaita-icon-theme \
|
||||||
|
atk-devel \
|
||||||
|
at-spi2-atk-devel \
|
||||||
avahi-gobject-devel \
|
avahi-gobject-devel \
|
||||||
cairo-devel \
|
cairo-devel \
|
||||||
cairo-gobject-devel \
|
cairo-gobject-devel \
|
||||||
@@ -16,6 +18,7 @@ RUN dnf -y install \
|
|||||||
dejavu-sans-mono-fonts \
|
dejavu-sans-mono-fonts \
|
||||||
desktop-file-utils \
|
desktop-file-utils \
|
||||||
diffutils \
|
diffutils \
|
||||||
|
docbook-style-xsl \
|
||||||
elfutils-libelf-devel \
|
elfutils-libelf-devel \
|
||||||
expat-devel \
|
expat-devel \
|
||||||
fribidi-devel \
|
fribidi-devel \
|
||||||
|
@@ -24,10 +24,10 @@ flatpak build ${builddir} meson \
|
|||||||
-Dbuild-examples=false \
|
-Dbuild-examples=false \
|
||||||
-Dintrospection=disabled \
|
-Dintrospection=disabled \
|
||||||
-Dbuild-demos=true \
|
-Dbuild-demos=true \
|
||||||
-Dprofile=devel \
|
-Ddemo-profile=devel \
|
||||||
_flatpak_build
|
_flatpak_build
|
||||||
|
|
||||||
flatpak build --env=CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA ${builddir} ninja -C _flatpak_build install
|
flatpak build ${builddir} ninja -C _flatpak_build install
|
||||||
|
|
||||||
flatpak-builder \
|
flatpak-builder \
|
||||||
--user --disable-rofiles-fuse \
|
--user --disable-rofiles-fuse \
|
||||||
|
@@ -3,11 +3,6 @@
|
|||||||
set -eux -o pipefail
|
set -eux -o pipefail
|
||||||
|
|
||||||
xcodebuild -version || :
|
xcodebuild -version || :
|
||||||
|
xcodebuild -showsdks || :
|
||||||
if [ -z "$SDKROOT" ]; then
|
|
||||||
xcodebuild -showsdks || :
|
|
||||||
else
|
|
||||||
echo "SDKROOT = $SDKROOT"
|
|
||||||
fi
|
|
||||||
|
|
||||||
system_profiler SPSoftwareDataType || :
|
system_profiler SPSoftwareDataType || :
|
@@ -34,8 +34,7 @@ pacman --noconfirm -S --needed \
|
|||||||
mingw-w64-$MSYS2_ARCH-shared-mime-info \
|
mingw-w64-$MSYS2_ARCH-shared-mime-info \
|
||||||
mingw-w64-$MSYS2_ARCH-python-gobject \
|
mingw-w64-$MSYS2_ARCH-python-gobject \
|
||||||
mingw-w64-$MSYS2_ARCH-shaderc \
|
mingw-w64-$MSYS2_ARCH-shaderc \
|
||||||
mingw-w64-$MSYS2_ARCH-vulkan \
|
mingw-w64-$MSYS2_ARCH-vulkan
|
||||||
mingw-w64-$MSYS2_ARCH-vulkan-headers
|
|
||||||
|
|
||||||
mkdir -p _ccache
|
mkdir -p _ccache
|
||||||
export CCACHE_BASEDIR="$(pwd)"
|
export CCACHE_BASEDIR="$(pwd)"
|
||||||
@@ -45,7 +44,7 @@ export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
|
|||||||
ccache --zero-stats
|
ccache --zero-stats
|
||||||
ccache --show-stats
|
ccache --show-stats
|
||||||
export CCACHE_DISABLE=true
|
export CCACHE_DISABLE=true
|
||||||
meson setup \
|
meson \
|
||||||
-Dx11-backend=false \
|
-Dx11-backend=false \
|
||||||
-Dwayland-backend=false \
|
-Dwayland-backend=false \
|
||||||
-Dwin32-backend=true \
|
-Dwin32-backend=true \
|
||||||
|
@@ -35,7 +35,7 @@ The issue tracker is meant to be used for actionable issues only.
|
|||||||
|
|
||||||
You should not open a new issue for security related questions.
|
You should not open a new issue for security related questions.
|
||||||
|
|
||||||
When in doubt, follow the process for [GNOME security issues](https://security.gnome.org/).
|
When in doubt, follow [security](https://security.gnome.org/).
|
||||||
|
|
||||||
### Bug reports
|
### Bug reports
|
||||||
|
|
||||||
@@ -144,28 +144,33 @@ $ git clone https://gitlab.gnome.org/yourusername/gtk.git
|
|||||||
$ cd gtk
|
$ cd gtk
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Note**: if you plan to push changes to back to the main repository and
|
||||||
|
have a GNOME account, you can skip the fork, and use the following instead:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ git clone git@gitlab.gnome.org:GNOME/gtk.git
|
||||||
|
$ cd gtk
|
||||||
|
```
|
||||||
|
|
||||||
To compile the Git version of GTK on your system, you will need to
|
To compile the Git version of GTK on your system, you will need to
|
||||||
configure your build using Meson:
|
configure your build using Meson:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ meson setup _builddir .
|
$ meson _builddir .
|
||||||
$ meson compile -C _builddir
|
$ cd _builddir
|
||||||
|
$ ninja
|
||||||
```
|
```
|
||||||
|
|
||||||
Typically, you should work on your own branch:
|
Typically, you should work on your own branch:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ git switch -C your-branch
|
$ git checkout -b your-branch
|
||||||
```
|
```
|
||||||
|
|
||||||
Once you've finished working on the bug fix or feature, push the branch
|
Once you've finished working on the bug fix or feature, push the branch
|
||||||
to the Git repository and open a new merge request, to let the GTK
|
to the Git repository and open a new merge request, to let the GTK
|
||||||
maintainers review your contribution.
|
maintainers review your contribution.
|
||||||
|
|
||||||
**Important**: Do **not** attach a diff or a patch file to a GitLab issue.
|
|
||||||
Patches cannot be reviewed, and do not not go through the CI pipeline. If
|
|
||||||
you wish to submit your changes to GTK, always use a merge request.
|
|
||||||
|
|
||||||
### Code reviews
|
### Code reviews
|
||||||
|
|
||||||
Each contribution is reviewed by the core developers of the GTK project.
|
Each contribution is reviewed by the core developers of the GTK project.
|
||||||
@@ -208,7 +213,7 @@ Closes #1234
|
|||||||
`git commit -a --author "Joe Coder <joe@coder.org>"` and `--signoff`.
|
`git commit -a --author "Joe Coder <joe@coder.org>"` and `--signoff`.
|
||||||
|
|
||||||
- If your commit is addressing an issue, use the
|
- If your commit is addressing an issue, use the
|
||||||
[GitLab syntax](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
|
[GitLab syntax](https://docs.gitlab.com/ce/user/project/issues/automatic_issue_closing.html)
|
||||||
to automatically close the issue when merging the commit with the upstream
|
to automatically close the issue when merging the commit with the upstream
|
||||||
repository:
|
repository:
|
||||||
|
|
||||||
@@ -257,4 +262,4 @@ people committing to GTK to follow a few rules:
|
|||||||
|
|
||||||
If you have been contributing to GTK for a while and you don't have commit
|
If you have been contributing to GTK for a while and you don't have commit
|
||||||
access to the repository, you may ask to obtain it following the [GNOME account
|
access to the repository, you may ask to obtain it following the [GNOME account
|
||||||
process](https://handbook.gnome.org/infrastructure/developer-access.html).
|
process](https://wiki.gnome.org/AccountsTeam/NewAccounts).
|
||||||
|
478
NEWS
@@ -1,482 +1,6 @@
|
|||||||
Overview of Changes in 4.15.1, xx-xx-xxxx
|
Overview of Changes in 4.13.6, xx-xx-xxxx
|
||||||
=========================================
|
=========================================
|
||||||
|
|
||||||
Overview of Changes in 4.15.0, 21-04-2024
|
|
||||||
=========================================
|
|
||||||
|
|
||||||
This release changes the default GSK renderer to be Vulkan, on
|
|
||||||
Wayland. Other platforms still use ngl.
|
|
||||||
|
|
||||||
The intent of this change is to get wider testing and verify that
|
|
||||||
Vulkan drivers are good enough for us to rely on. If significant
|
|
||||||
problems show up, we will revert this change for 4.16.
|
|
||||||
|
|
||||||
You can still override the renderer choice using the GSK_RENDERER
|
|
||||||
environment variable.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
This release also changes font rendering settings by introducing
|
|
||||||
a new high-level gtk-font-rendering settings which gives GTK more
|
|
||||||
freedom to decide on font rendering.
|
|
||||||
|
|
||||||
You can still use the low-level font-related settings by changing
|
|
||||||
the new property to 'manual'.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
* GtkColumnView:
|
|
||||||
- Fix infinite loops in dispose
|
|
||||||
- Fix problems with weak ref cycles in GtkExpression
|
|
||||||
|
|
||||||
* GtkListView:
|
|
||||||
* GtkShortcutManager:
|
|
||||||
- Track the propagation phase of added controllers
|
|
||||||
|
|
||||||
* GtkGLArea:
|
|
||||||
- Produce dmabuf textures, so graphics offload is possible
|
|
||||||
|
|
||||||
* GtkTextView:
|
|
||||||
- Support text shadows
|
|
||||||
|
|
||||||
* GtkGraphicsOffload:
|
|
||||||
- Add a black-background property
|
|
||||||
|
|
||||||
* Settings:
|
|
||||||
- Add a new gtk-font-rendering setting
|
|
||||||
|
|
||||||
* Accessibility:
|
|
||||||
- Add support for GetRangeExtents to GtkAccessibleText
|
|
||||||
- Add support for GetOffsetAtPoint to GtkAccessibleText
|
|
||||||
- Implement GtkAccessibleRange for scrollbars
|
|
||||||
|
|
||||||
* GDK:
|
|
||||||
- Add a callback-based cursor API
|
|
||||||
|
|
||||||
* GSK:
|
|
||||||
- Use the Vulkan renderer by default
|
|
||||||
- Avoid an infinite recursion with offscreens in some cases
|
|
||||||
- Optimize graphics offload to make it more likely that compositors
|
|
||||||
can use direct scanout
|
|
||||||
|
|
||||||
* X11:
|
|
||||||
- Fix some confusing debug messages
|
|
||||||
- Drop a no-longer-relevant optimization that was interfering with
|
|
||||||
getting the current window manager capabilities
|
|
||||||
|
|
||||||
* macOS:
|
|
||||||
- Implement the color picker for macOS 10.15+
|
|
||||||
|
|
||||||
* Debugging:
|
|
||||||
- Snow monitor resolution in the inspector
|
|
||||||
|
|
||||||
* Demos:
|
|
||||||
- Use graphics offload in the shadertoy demo
|
|
||||||
- Show more reliable fps numbers in the fishbowl demo
|
|
||||||
|
|
||||||
* Tools:
|
|
||||||
- Support generating pdf in gtk4-rendernode-tool
|
|
||||||
|
|
||||||
* Build:
|
|
||||||
- Require pango 1.52
|
|
||||||
- Require cairo 1.18
|
|
||||||
- Add a missing dependency that was causing build failures
|
|
||||||
- Drop deprecated build options:
|
|
||||||
gtk_doc -> documentation
|
|
||||||
update_screenshots -> screenshots
|
|
||||||
demo-profile -> profile
|
|
||||||
demos -> build-demos
|
|
||||||
|
|
||||||
* Deprecations:
|
|
||||||
- gdk_widget_set/get_font_options
|
|
||||||
- gdk_wayland/x11_display_set_cursor_theme
|
|
||||||
|
|
||||||
* Translation updates:
|
|
||||||
Basque
|
|
||||||
Brazilian Portuguese
|
|
||||||
British English
|
|
||||||
Chinese (China)
|
|
||||||
Hebrew
|
|
||||||
Kabyle
|
|
||||||
Persian
|
|
||||||
Polish
|
|
||||||
Russian
|
|
||||||
Slovenian
|
|
||||||
Swedish
|
|
||||||
Turkish
|
|
||||||
|
|
||||||
|
|
||||||
Overview of Changes in 4.14.2, 03-04-2024
|
|
||||||
=========================================
|
|
||||||
|
|
||||||
* GtkScale:
|
|
||||||
- Improve positioning of values in some cases
|
|
||||||
|
|
||||||
* Theme:
|
|
||||||
- Make progress in entries visible
|
|
||||||
|
|
||||||
* Accessibility:
|
|
||||||
- Fix text insertion handling
|
|
||||||
|
|
||||||
* GDK:
|
|
||||||
- dnd: Use the default cursor durion motion
|
|
||||||
- dnd: Use a better cursor for indicating the move action
|
|
||||||
|
|
||||||
* GSK:
|
|
||||||
- gl: Handle offloads in offscreen context better
|
|
||||||
- Fix text rendering problems with some fonts
|
|
||||||
|
|
||||||
* Wayland:
|
|
||||||
- Tighten up some protocol version checks
|
|
||||||
- Use the presentation time protocol
|
|
||||||
- Fix a crash with subsurfaces
|
|
||||||
- Improve settings portal handling
|
|
||||||
|
|
||||||
* macOS:
|
|
||||||
- Fix up the app menu support
|
|
||||||
|
|
||||||
* Windows:
|
|
||||||
- Fix problems with minimization
|
|
||||||
- Fix build without fontconfig
|
|
||||||
|
|
||||||
* Debugging:
|
|
||||||
- Add font settings in the inspector
|
|
||||||
|
|
||||||
* Demos:
|
|
||||||
- Clean up the application demo
|
|
||||||
- Update cursor images for the cursor demo
|
|
||||||
|
|
||||||
* Translation updates:
|
|
||||||
Catalan
|
|
||||||
Czech
|
|
||||||
French
|
|
||||||
Georgian
|
|
||||||
Hebrew
|
|
||||||
Persian
|
|
||||||
Slovenian
|
|
||||||
Turkish
|
|
||||||
Ukrainian
|
|
||||||
|
|
||||||
|
|
||||||
Overview of Changes in 4.14.1, 16-03-2024
|
|
||||||
=========================================
|
|
||||||
|
|
||||||
* GtkTextView:
|
|
||||||
- Fix a mixup of cursor and anchor when retrieving surrounding text
|
|
||||||
in input methods
|
|
||||||
|
|
||||||
* Printing:
|
|
||||||
- Avoid accessing freed printers
|
|
||||||
|
|
||||||
* Accessibility:
|
|
||||||
- Fix memory leaks
|
|
||||||
|
|
||||||
* GDK:
|
|
||||||
- Rename the GDK_VULKAN_SKIP environment variable to GDK_VULKAN_DISABLE
|
|
||||||
- Add a GDK_GL_DISABLE environment variable
|
|
||||||
|
|
||||||
* GSK:
|
|
||||||
- Rename the GSK_GPU_SKIP environment variable to GSK_GPU_DISABLE
|
|
||||||
- Speed up handling of repeated ops, which should help for text
|
|
||||||
- Speed up the inner loop of text node conversion
|
|
||||||
- Drop the glyph-align optimization flag
|
|
||||||
- ngl: Avoid reusing frames while they are in use
|
|
||||||
- Fix flickering thumbnails in nautilus
|
|
||||||
- Speed up buffer handling in both ngl and Vulkan
|
|
||||||
|
|
||||||
* Demos:
|
|
||||||
- Skip demos using gl shaders when we're not using the gl renderer
|
|
||||||
|
|
||||||
* Build:
|
|
||||||
- Fix some ubsan warnings
|
|
||||||
- Avoid zink in ci since it spams stderr
|
|
||||||
|
|
||||||
* Translation updates:
|
|
||||||
Czech
|
|
||||||
German
|
|
||||||
Korean
|
|
||||||
Russian
|
|
||||||
|
|
||||||
|
|
||||||
Overview of Changes in 4.14.0, 12-03-2024
|
|
||||||
=========================================
|
|
||||||
|
|
||||||
Note: The new renderers and dmabuf support are using graphics drivers
|
|
||||||
in different ways than the old gl renderer, and trigger new driver bugs,
|
|
||||||
(see for example https://gitlab.gnome.org/GNOME/gtk/-/issues/6418 and
|
|
||||||
https://gitlab.gnome.org/GNOME/gtk/-/issues/6388). Therefore, it is
|
|
||||||
recommended to use the latest mesa release (24.x) with the new renderers.
|
|
||||||
|
|
||||||
* GtkTextView:
|
|
||||||
- Don't snapshot children twice
|
|
||||||
- Don't blink the cursor when hidden
|
|
||||||
|
|
||||||
* GtkEmojiChooser:
|
|
||||||
- Fix presentation selector handling
|
|
||||||
|
|
||||||
* GtkSnapshot:
|
|
||||||
- Fix wrong nodes with transformed shadows
|
|
||||||
|
|
||||||
* GtkIMContext:
|
|
||||||
- Make gtk_im_context_activate_osk public
|
|
||||||
|
|
||||||
* Accessibility:
|
|
||||||
- Implement get_contents_at for all our text widgets
|
|
||||||
- Add GtkAccessibleText.get_default_attributes
|
|
||||||
|
|
||||||
* GSK:
|
|
||||||
- Don't fall back to cairo for software rendering. gl+llvmpipe is better
|
|
||||||
- Round vertical glyph position to a device pixel position if the font is hinted
|
|
||||||
- Fix problems with clip handling
|
|
||||||
- Make vulkan and ngl match their font handling
|
|
||||||
- Fix some corner-cases with offloading and clips
|
|
||||||
- Fix problem with rendering of missing glyphs in hinted fonts
|
|
||||||
|
|
||||||
* MacOs:
|
|
||||||
- Implement cursor-from-texture
|
|
||||||
|
|
||||||
* Translation updates:
|
|
||||||
Basque
|
|
||||||
British English
|
|
||||||
French
|
|
||||||
Indonesian
|
|
||||||
Kazakh
|
|
||||||
Latvian
|
|
||||||
Lithuanian
|
|
||||||
Norwegian Bokmål
|
|
||||||
Slovenian
|
|
||||||
Spanish
|
|
||||||
Turkish
|
|
||||||
|
|
||||||
|
|
||||||
Overview of Changes in 4.13.9, 02-03-2024
|
|
||||||
=========================================
|
|
||||||
|
|
||||||
* GtkEditable:
|
|
||||||
- Fix preconditions to be not too strict
|
|
||||||
|
|
||||||
* GtkEmojiChooser:
|
|
||||||
- Support search in the locale as well as in English
|
|
||||||
|
|
||||||
* GtkIconTheme:
|
|
||||||
- Make gtk_icon_paintable_new_for_file support symbolics
|
|
||||||
|
|
||||||
* GtkVideo:
|
|
||||||
- Fix a problem with cursor handling that could lead to crashes
|
|
||||||
|
|
||||||
* Accessibility:
|
|
||||||
- Fix GetCharacterAtOffset implementation
|
|
||||||
- Add a Terminal role
|
|
||||||
- Make TextCaretMoved match gtk3
|
|
||||||
- Support multiple levels of GtkEditable delegates
|
|
||||||
|
|
||||||
* GSK:
|
|
||||||
- Make the node parser more flexible for text nodes
|
|
||||||
- Change the way font scaling is handled to avoid clipping
|
|
||||||
- Fix handling of missing glyphs in the new renderers
|
|
||||||
|
|
||||||
* X11:
|
|
||||||
- Don't claim to support shadows without a compositor
|
|
||||||
|
|
||||||
* Wayland:
|
|
||||||
- Fix handling of output scales
|
|
||||||
|
|
||||||
* Tools:
|
|
||||||
- Add a compare command to gtk4-rendernode-tool
|
|
||||||
|
|
||||||
* Build:
|
|
||||||
- Fix some ubsan complaints
|
|
||||||
|
|
||||||
* Translation updates:
|
|
||||||
Basque
|
|
||||||
British English
|
|
||||||
Catalan
|
|
||||||
Finnish
|
|
||||||
Galician
|
|
||||||
Georgian
|
|
||||||
Hebrew
|
|
||||||
Indonesian
|
|
||||||
Kazakh
|
|
||||||
Latvian
|
|
||||||
Lithuanian
|
|
||||||
Persian
|
|
||||||
Polish
|
|
||||||
Russian
|
|
||||||
Slovenian
|
|
||||||
Spanish
|
|
||||||
Turkish
|
|
||||||
Ukrainian
|
|
||||||
|
|
||||||
|
|
||||||
Overview of Changes in 4.13.8, 20-02-2024
|
|
||||||
=========================================
|
|
||||||
|
|
||||||
* Accessibility:
|
|
||||||
- Add a GtkAccessibleText interface for allowing 3rd party
|
|
||||||
text widgets (notably vte) to be accessible
|
|
||||||
- Avoid duplicate accessible descriptions
|
|
||||||
- Fix GetAccessibleAtPoint
|
|
||||||
|
|
||||||
* GSK:
|
|
||||||
- Avoid offscreens for disjoint containers
|
|
||||||
- Don't use the gpu renderers with llvmpipe
|
|
||||||
- Fix various rendering issues found by tests
|
|
||||||
- Allow unnormalized node bounds again
|
|
||||||
- Fix a broken case of rounded-rect intersection
|
|
||||||
- Fix handling of external textures in gpu renderers
|
|
||||||
- Make gpu renderers work with WGL on Windows
|
|
||||||
|
|
||||||
* build:
|
|
||||||
- Allow building without dmabuf support on (old) Linux
|
|
||||||
|
|
||||||
* X11:
|
|
||||||
- Fix monitor enter/leave signals
|
|
||||||
|
|
||||||
* Translation updates:
|
|
||||||
Basque
|
|
||||||
Brazilian Portuguese
|
|
||||||
Catalan
|
|
||||||
Czech
|
|
||||||
Galician
|
|
||||||
Georgian
|
|
||||||
Hebrew
|
|
||||||
Lithuanian
|
|
||||||
Persian
|
|
||||||
Russian
|
|
||||||
Turkish
|
|
||||||
Ukrainian
|
|
||||||
|
|
||||||
|
|
||||||
Overview of Changes in 4.13.7, 11-02-2024
|
|
||||||
=========================================
|
|
||||||
|
|
||||||
* GtkFileChooser:
|
|
||||||
- Speed up opening
|
|
||||||
|
|
||||||
* GtkCalendar:
|
|
||||||
- Add some missing setters and getters
|
|
||||||
|
|
||||||
* Accessibility:
|
|
||||||
- Add socket support for webkit accessibility
|
|
||||||
- Implement AT-SPI text for GtkText
|
|
||||||
- Implement AT-SPI component generically
|
|
||||||
- Add an announce API
|
|
||||||
|
|
||||||
* GSK:
|
|
||||||
- Make the ngl renderer work on macOS
|
|
||||||
- Fix a crash in the vulkan renderer
|
|
||||||
- Make nodeparser allow aliases for fonts again
|
|
||||||
- Implement cache eviction for glyph and texture caches
|
|
||||||
- Fix ngl shaders to work on GL < 4.0
|
|
||||||
- Require GL 3.3 for the ngl renderer
|
|
||||||
- Fix problems with scaled shadows
|
|
||||||
- Fix problems with holes for underlaid subsurfaces
|
|
||||||
- Improve handling of scales and glyph cache efficiency
|
|
||||||
|
|
||||||
* Media:
|
|
||||||
- Support dmabufs in the gstreamer backend. This allows
|
|
||||||
zero-copy video playback on Wayland when paired with
|
|
||||||
hardware video decoding
|
|
||||||
- Drop the experimental ffmpeg backend. It hasn't been
|
|
||||||
building for a year
|
|
||||||
|
|
||||||
* Wayland:
|
|
||||||
- Commit empty frames if and double-buffered state is pending
|
|
||||||
- Fix monitor size information when using mutter without
|
|
||||||
the scale-monitor-framebuffer setting
|
|
||||||
- Clear the current tablet on tab leave, fixing a crash
|
|
||||||
|
|
||||||
* macOS:
|
|
||||||
- Propagate unhandled input events back to the OS
|
|
||||||
|
|
||||||
* Tools:
|
|
||||||
- Make the crash handling in gtk4-node-editor more robust
|
|
||||||
|
|
||||||
* Translation updates
|
|
||||||
Galician
|
|
||||||
Georgian
|
|
||||||
Occitan
|
|
||||||
Turkish
|
|
||||||
|
|
||||||
|
|
||||||
Overview of Changes in 4.13.6, 25-01-2024
|
|
||||||
=========================================
|
|
||||||
|
|
||||||
This release changes the ngl renderer to be the default renderer.
|
|
||||||
|
|
||||||
The intent of this change is to get wider testing and verify that
|
|
||||||
the new renderers are production-ready. If significant problems
|
|
||||||
show up, we will revert this change for 4.14.
|
|
||||||
|
|
||||||
You can still override the renderer choice using the GSK_RENDERER
|
|
||||||
environment variable.
|
|
||||||
|
|
||||||
Since ngl can handle fractional scaling much better than the old gl
|
|
||||||
renderer, we allow fractional scaling by default with gl now. If you
|
|
||||||
are using the old gl renderer (e.g. because your system is limited to
|
|
||||||
GLES2), you can disable fractional scaling by setting the GDK_DEBUG
|
|
||||||
environment variable to include the gl-no-fractional key.
|
|
||||||
|
|
||||||
* GtkColumnView:
|
|
||||||
- Fix infinite loops in dispose
|
|
||||||
- Fix problems with weak ref cycles in GtkExpression
|
|
||||||
|
|
||||||
* GtkListView:
|
|
||||||
- Fix some corner cases with sections during insertions and deletions
|
|
||||||
- Don't double-recycle widgets
|
|
||||||
|
|
||||||
* GtkStack:
|
|
||||||
- Add automatic cleanup for GtkStackPage
|
|
||||||
|
|
||||||
* GDK:
|
|
||||||
- Use standard cursor names for drag cursors
|
|
||||||
- Enable fractional scaling with gl by default
|
|
||||||
|
|
||||||
* GSK:
|
|
||||||
- Many fixes and improvements to the unified renderers:
|
|
||||||
- Fix text rendering with the uber shader
|
|
||||||
- Fix rounding issues with fractional scales
|
|
||||||
- Fix some memory leaks
|
|
||||||
- Many text rendering fixes
|
|
||||||
- Implement subpixel positioning for glyphs
|
|
||||||
- Support custom fonts in node files
|
|
||||||
- Add tests for font rendering
|
|
||||||
- Fix drawing of repeat nodes
|
|
||||||
- Implement subpixels positioning
|
|
||||||
- Evict stale textures, glyphs and atlases from the cache
|
|
||||||
- Some fixes and improvements to the GL renderer:
|
|
||||||
- Fix problems with GLES on Nvidia
|
|
||||||
- Avoid a crash in the mask demo
|
|
||||||
- Respect opacity of the first child node in containers
|
|
||||||
- Some fixes and improvements to the fallback renderer:
|
|
||||||
- Fix drawing of repeat nodes
|
|
||||||
- Make ngl the default renderer
|
|
||||||
|
|
||||||
* Wayland:
|
|
||||||
- Fix problems with tablet cursors
|
|
||||||
- Fix problems without seats
|
|
||||||
|
|
||||||
* Accessibility:
|
|
||||||
- Respect a separate "show-status-shapes setting
|
|
||||||
- Fix change notification for accessible names on some widgets
|
|
||||||
|
|
||||||
* Inspector:
|
|
||||||
- Show the git commit in devel builds
|
|
||||||
|
|
||||||
* Tools:
|
|
||||||
- Make gtk4-node-editor autosave its contents
|
|
||||||
- Add a benchmark command to gtk4-rendernode-tool
|
|
||||||
|
|
||||||
* Translation updates:
|
|
||||||
French
|
|
||||||
Galician
|
|
||||||
Georgian
|
|
||||||
Occitan
|
|
||||||
Persian
|
|
||||||
Russian
|
|
||||||
Vietnamese
|
|
||||||
|
|
||||||
|
|
||||||
Overview of Changes in 4.13.5, 07-01-2024
|
Overview of Changes in 4.13.5, 07-01-2024
|
||||||
=========================================
|
=========================================
|
||||||
|
|
||||||
|
@@ -125,7 +125,7 @@ version, for example `gtk-4-10`.
|
|||||||
How to report bugs
|
How to report bugs
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
Bugs should be reported on the [issues page](https://gitlab.gnome.org/GNOME/gtk/issues/).
|
Bugs should be reported on the [issues page](https://gitlab.gnome.org/GNOME/gtk/issues/new).
|
||||||
|
|
||||||
In the bug report please include:
|
In the bug report please include:
|
||||||
|
|
||||||
|
@@ -63,6 +63,38 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "shaderc",
|
||||||
|
"buildsystem": "cmake-ninja",
|
||||||
|
"builddir": true,
|
||||||
|
"config-opts": [
|
||||||
|
"-DSHADERC_SKIP_COPYRIGHT_CHECK=ON",
|
||||||
|
"-DSHADERC_SKIP_EXAMPLES=ON",
|
||||||
|
"-DSHADERC_SKIP_TESTS=ON"
|
||||||
|
],
|
||||||
|
"cleanup": [ "/bin", "/lib/cmake", "/lib/pkgconfig", "/include" ],
|
||||||
|
"post-install": [
|
||||||
|
"install -D /lib/$(gcc --print-multiarch)/libSPIRV*.so /app/lib"
|
||||||
|
],
|
||||||
|
"sources": [
|
||||||
|
{
|
||||||
|
"type": "archive",
|
||||||
|
"archive-type": "tar",
|
||||||
|
"url": "https://api.github.com/repos/google/shaderc/tarball/refs/tags/v2021.3",
|
||||||
|
"sha256": "b7e54b23a83343d5e2da836d8833ae0db11926141955edf845e35d4dc1eb88d1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"commands": [
|
||||||
|
"sed -i 's|SPIRV/GlslangToSpv.h|glslang/SPIRV/GlslangToSpv.h|' libshaderc_util/src/compiler.cc",
|
||||||
|
"sed -i 's|add_subdirectory(third_party)||' CMakeLists.txt",
|
||||||
|
"sed -i 's|add_custom_target(build-version|set(NOT_USE|' CMakeLists.txt",
|
||||||
|
"LIB=/lib/$(gcc --print-multiarch)\nVER_MATCH=\"[0-9]+\\.[^\\. ]+\"\nSHADERC=$(grep -m1 -oP \"^v$VER_MATCH\" CHANGES)\nSPIRV=v$(grep -oP \"(?<=Version:.)$VER_MATCH\" $LIB/pkgconfig/SPIRV-Tools-shared.pc)\nGLSLANG=v$(realpath $LIB/libglslang.so | grep -oP \"(?<=so.)$VER_MATCH\")\ncat <<- EOF > glslc/src/build-version.inc\n \"shaderc $SHADERC\"\n \"spirv-tools $SPIRV\"\n \"glslang $GLSLANG\"\nEOF",
|
||||||
|
"cat glslc/src/build-version.inc"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name" : "libsass",
|
"name" : "libsass",
|
||||||
"buildsystem" : "meson",
|
"buildsystem" : "meson",
|
||||||
@@ -186,7 +218,7 @@
|
|||||||
"config-opts" : [
|
"config-opts" : [
|
||||||
"--libdir=/app/lib",
|
"--libdir=/app/lib",
|
||||||
"-Dbuildtype=debugoptimized",
|
"-Dbuildtype=debugoptimized",
|
||||||
"-Dprofile=devel"
|
"-Ddemo-profile=devel"
|
||||||
],
|
],
|
||||||
"sources" : [
|
"sources" : [
|
||||||
{
|
{
|
||||||
@@ -199,7 +231,6 @@
|
|||||||
],
|
],
|
||||||
"build-options" : {
|
"build-options" : {
|
||||||
"env" : {
|
"env" : {
|
||||||
"GSK_RENDERER" : "opengl"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -115,7 +115,7 @@
|
|||||||
"config-opts" : [
|
"config-opts" : [
|
||||||
"--libdir=/app/lib",
|
"--libdir=/app/lib",
|
||||||
"-Dbuildtype=debugoptimized",
|
"-Dbuildtype=debugoptimized",
|
||||||
"-Dprofile=devel"
|
"-Ddemo-profile=devel"
|
||||||
],
|
],
|
||||||
"sources" : [
|
"sources" : [
|
||||||
{
|
{
|
||||||
|
@@ -115,7 +115,7 @@
|
|||||||
"config-opts" : [
|
"config-opts" : [
|
||||||
"--libdir=/app/lib",
|
"--libdir=/app/lib",
|
||||||
"-Dbuildtype=debugoptimized",
|
"-Dbuildtype=debugoptimized",
|
||||||
"-Dprofile=devel"
|
"-Ddemo-profile=devel"
|
||||||
],
|
],
|
||||||
"sources" : [
|
"sources" : [
|
||||||
{
|
{
|
||||||
@@ -129,7 +129,6 @@
|
|||||||
"build-options" : {
|
"build-options" : {
|
||||||
"env" : {
|
"env" : {
|
||||||
"DBUS_SESSION_BUS_ADDRESS" : "''",
|
"DBUS_SESSION_BUS_ADDRESS" : "''",
|
||||||
"GSK_RENDERER" : "opengl",
|
|
||||||
"G_ENABLE_DEBUG" : "true"
|
"G_ENABLE_DEBUG" : "true"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -115,7 +115,7 @@
|
|||||||
"config-opts" : [
|
"config-opts" : [
|
||||||
"--libdir=/app/lib",
|
"--libdir=/app/lib",
|
||||||
"-Dbuildtype=debugoptimized",
|
"-Dbuildtype=debugoptimized",
|
||||||
"-Dprofile=devel"
|
"-Ddemo-profile=devel"
|
||||||
],
|
],
|
||||||
"sources" : [
|
"sources" : [
|
||||||
{
|
{
|
||||||
@@ -129,7 +129,6 @@
|
|||||||
"build-options" : {
|
"build-options" : {
|
||||||
"env" : {
|
"env" : {
|
||||||
"DBUS_SESSION_BUS_ADDRESS" : "''",
|
"DBUS_SESSION_BUS_ADDRESS" : "''",
|
||||||
"GSK_RENDERER" : "opengl",
|
|
||||||
"G_ENABLE_DEBUG" : "true"
|
"G_ENABLE_DEBUG" : "true"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
@@ -15,54 +15,12 @@ on_destroy (gpointer data)
|
|||||||
window = NULL;
|
window = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GdkTexture *
|
|
||||||
cursor_callback (GdkCursor *cursor,
|
|
||||||
int cursor_size,
|
|
||||||
double scale,
|
|
||||||
int *width,
|
|
||||||
int *height,
|
|
||||||
int *hotspot_x,
|
|
||||||
int *hotspot_y,
|
|
||||||
gpointer data)
|
|
||||||
{
|
|
||||||
GdkPixbuf *pixbuf;
|
|
||||||
GdkTexture *texture;
|
|
||||||
GError *error = NULL;
|
|
||||||
int scaled_size;
|
|
||||||
|
|
||||||
scaled_size = ceil (cursor_size * scale);
|
|
||||||
|
|
||||||
pixbuf = gdk_pixbuf_new_from_resource_at_scale ("/cursors/images/gtk-logo.svg",
|
|
||||||
scaled_size, scaled_size,
|
|
||||||
TRUE,
|
|
||||||
&error);
|
|
||||||
if (!pixbuf)
|
|
||||||
{
|
|
||||||
g_print ("%s\n", error->message);
|
|
||||||
g_error_free (error);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
|
||||||
|
|
||||||
g_object_unref (pixbuf);
|
|
||||||
|
|
||||||
*width = cursor_size;
|
|
||||||
*height = cursor_size;
|
|
||||||
*hotspot_x = 18 * cursor_size / 32.0;
|
|
||||||
*hotspot_y = 2 * cursor_size / 32.0;
|
|
||||||
|
|
||||||
return texture;
|
|
||||||
}
|
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
do_cursors (GtkWidget *do_widget)
|
do_cursors (GtkWidget *do_widget)
|
||||||
{
|
{
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
GtkBuilder *builder;
|
GtkBuilder *builder;
|
||||||
GtkWidget *logo_callback;
|
|
||||||
GdkCursor *cursor;
|
|
||||||
|
|
||||||
builder = gtk_builder_new_from_resource ("/cursors/cursors.ui");
|
builder = gtk_builder_new_from_resource ("/cursors/cursors.ui");
|
||||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
||||||
@@ -71,10 +29,6 @@ do_cursors (GtkWidget *do_widget)
|
|||||||
gtk_widget_get_display (do_widget));
|
gtk_widget_get_display (do_widget));
|
||||||
g_signal_connect (window, "destroy",
|
g_signal_connect (window, "destroy",
|
||||||
G_CALLBACK (on_destroy), NULL);
|
G_CALLBACK (on_destroy), NULL);
|
||||||
logo_callback = GTK_WIDGET (gtk_builder_get_object (builder, "logo_callback"));
|
|
||||||
cursor = gdk_cursor_new_from_callback (cursor_callback, NULL, NULL, NULL);
|
|
||||||
gtk_widget_set_cursor (logo_callback, cursor);
|
|
||||||
g_object_unref (cursor);
|
|
||||||
g_object_unref (builder);
|
g_object_unref (builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -116,7 +116,6 @@
|
|||||||
<file>w_resize_cursor.png</file>
|
<file>w_resize_cursor.png</file>
|
||||||
<file>zoom_in_cursor.png</file>
|
<file>zoom_in_cursor.png</file>
|
||||||
<file>zoom_out_cursor.png</file>
|
<file>zoom_out_cursor.png</file>
|
||||||
<file>gtk-logo.svg</file>
|
|
||||||
</gresource>
|
</gresource>
|
||||||
<gresource prefix="/dnd">
|
<gresource prefix="/dnd">
|
||||||
<file>dnd.css</file>
|
<file>dnd.css</file>
|
||||||
|
@@ -184,12 +184,6 @@ create_cogs (void)
|
|||||||
return picture;
|
return picture;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
check_cogs (GtkFishbowl *fb)
|
|
||||||
{
|
|
||||||
return GSK_IS_GL_RENDERER (gtk_native_get_renderer (gtk_widget_get_native (GTK_WIDGET (fb))));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mapped (GtkWidget *w)
|
mapped (GtkWidget *w)
|
||||||
{
|
{
|
||||||
@@ -224,41 +218,36 @@ create_graph (void)
|
|||||||
|
|
||||||
static const struct {
|
static const struct {
|
||||||
const char *name;
|
const char *name;
|
||||||
GtkWidget * (* create_func) (void);
|
GtkWidget * (*create_func) (void);
|
||||||
gboolean (* check) (GtkFishbowl *fb);
|
|
||||||
} widget_types[] = {
|
} widget_types[] = {
|
||||||
{ "Icon", create_icon, NULL },
|
{ "Icon", create_icon },
|
||||||
{ "Button", create_button, NULL },
|
{ "Button", create_button },
|
||||||
{ "Blurbutton", create_blurred_button, NULL },
|
{ "Blurbutton", create_blurred_button },
|
||||||
{ "Fontbutton", create_font_button, NULL },
|
{ "Fontbutton", create_font_button },
|
||||||
{ "Levelbar", create_level_bar, NULL },
|
{ "Levelbar", create_level_bar },
|
||||||
{ "Label", create_label, NULL },
|
{ "Label", create_label },
|
||||||
{ "Spinner", create_spinner, NULL },
|
{ "Spinner", create_spinner },
|
||||||
{ "Spinbutton", create_spinbutton, NULL },
|
{ "Spinbutton", create_spinbutton },
|
||||||
{ "Video", create_video, NULL },
|
{ "Video", create_video },
|
||||||
{ "Gears", create_gears, NULL },
|
{ "Gears", create_gears },
|
||||||
{ "Switch", create_switch, NULL },
|
{ "Switch", create_switch },
|
||||||
{ "Menubutton", create_menu_button, NULL },
|
{ "Menubutton", create_menu_button },
|
||||||
{ "Shader", create_cogs, check_cogs },
|
{ "Shader", create_cogs },
|
||||||
{ "Tiger", create_tiger, NULL },
|
{ "Tiger", create_tiger },
|
||||||
{ "Graph", create_graph, NULL },
|
{ "Graph", create_graph },
|
||||||
};
|
};
|
||||||
|
|
||||||
static int selected_widget_type = -1;
|
static int selected_widget_type = -1;
|
||||||
static const int N_WIDGET_TYPES = G_N_ELEMENTS (widget_types);
|
static const int N_WIDGET_TYPES = G_N_ELEMENTS (widget_types);
|
||||||
|
|
||||||
static gboolean
|
static void
|
||||||
set_widget_type (GtkFishbowl *fishbowl,
|
set_widget_type (GtkFishbowl *fishbowl,
|
||||||
int widget_type_index)
|
int widget_type_index)
|
||||||
{
|
{
|
||||||
GtkWidget *window;
|
GtkWidget *window;
|
||||||
|
|
||||||
if (widget_type_index == selected_widget_type)
|
if (widget_type_index == selected_widget_type)
|
||||||
return TRUE;
|
return;
|
||||||
|
|
||||||
if (widget_types[widget_type_index].check != NULL &&
|
|
||||||
!widget_types[widget_type_index].check (fishbowl))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
selected_widget_type = widget_type_index;
|
selected_widget_type = widget_type_index;
|
||||||
|
|
||||||
@@ -268,8 +257,6 @@ set_widget_type (GtkFishbowl *fishbowl,
|
|||||||
window = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (fishbowl)));
|
window = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (fishbowl)));
|
||||||
gtk_window_set_title (GTK_WINDOW (window),
|
gtk_window_set_title (GTK_WINDOW (window),
|
||||||
widget_types[selected_widget_type].name);
|
widget_types[selected_widget_type].name);
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
G_MODULE_EXPORT void
|
G_MODULE_EXPORT void
|
||||||
@@ -277,17 +264,14 @@ fishbowl_next_button_clicked_cb (GtkButton *source,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GtkFishbowl *fishbowl = user_data;
|
GtkFishbowl *fishbowl = user_data;
|
||||||
int new_index = selected_widget_type;
|
int new_index;
|
||||||
|
|
||||||
do
|
if (selected_widget_type + 1 >= N_WIDGET_TYPES)
|
||||||
{
|
new_index = 0;
|
||||||
if (new_index + 1 >= N_WIDGET_TYPES)
|
else
|
||||||
new_index = 0;
|
new_index = selected_widget_type + 1;
|
||||||
else
|
|
||||||
new_index = new_index + 1;
|
|
||||||
|
|
||||||
}
|
set_widget_type (fishbowl, new_index);
|
||||||
while (!set_widget_type (fishbowl, new_index));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
G_MODULE_EXPORT void
|
G_MODULE_EXPORT void
|
||||||
@@ -295,18 +279,14 @@ fishbowl_prev_button_clicked_cb (GtkButton *source,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GtkFishbowl *fishbowl = user_data;
|
GtkFishbowl *fishbowl = user_data;
|
||||||
int new_index = selected_widget_type;
|
int new_index;
|
||||||
|
|
||||||
do
|
if (selected_widget_type - 1 < 0)
|
||||||
{
|
new_index = N_WIDGET_TYPES - 1;
|
||||||
if (new_index - 1 < 0)
|
else
|
||||||
new_index = N_WIDGET_TYPES - 1;
|
new_index = selected_widget_type - 1;
|
||||||
else
|
|
||||||
new_index = new_index - 1;
|
|
||||||
|
|
||||||
}
|
set_widget_type (fishbowl, new_index);
|
||||||
|
|
||||||
while (!set_widget_type (fishbowl, new_index));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
G_MODULE_EXPORT void
|
G_MODULE_EXPORT void
|
||||||
|
@@ -600,8 +600,8 @@ update_display (void)
|
|||||||
if (s->len > 0)
|
if (s->len > 0)
|
||||||
{
|
{
|
||||||
pango_font_description_set_variations (desc, s->str);
|
pango_font_description_set_variations (desc, s->str);
|
||||||
|
g_string_free (s, TRUE);
|
||||||
}
|
}
|
||||||
g_string_free (s, TRUE);
|
|
||||||
|
|
||||||
font_desc = pango_font_description_to_string (desc);
|
font_desc = pango_font_description_to_string (desc);
|
||||||
|
|
||||||
|
@@ -1,138 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
||||||
|
|
||||||
<svg
|
|
||||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
||||||
xmlns:cc="http://creativecommons.org/ns#"
|
|
||||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
||||||
xmlns:svg="http://www.w3.org/2000/svg"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
||||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
||||||
width="128"
|
|
||||||
height="128"
|
|
||||||
id="svg6843"
|
|
||||||
sodipodi:version="0.32"
|
|
||||||
inkscape:version="0.92.4 5da689c313, 2019-01-14"
|
|
||||||
version="1.0"
|
|
||||||
sodipodi:docname="gtk-logo.svg"
|
|
||||||
inkscape:output_extension="org.inkscape.output.svg.inkscape"
|
|
||||||
inkscape:export-filename="/home/ebassi/Pictures/gtk-logo-256.png"
|
|
||||||
inkscape:export-xdpi="192"
|
|
||||||
inkscape:export-ydpi="192">
|
|
||||||
<defs
|
|
||||||
id="defs6845">
|
|
||||||
<inkscape:perspective
|
|
||||||
sodipodi:type="inkscape:persp3d"
|
|
||||||
inkscape:vp_x="-50 : 600 : 1"
|
|
||||||
inkscape:vp_y="0 : 1000 : 0"
|
|
||||||
inkscape:vp_z="700 : 600 : 1"
|
|
||||||
inkscape:persp3d-origin="300 : 400 : 1"
|
|
||||||
id="perspective13" />
|
|
||||||
</defs>
|
|
||||||
<sodipodi:namedview
|
|
||||||
id="base"
|
|
||||||
pagecolor="#ffffff"
|
|
||||||
bordercolor="#666666"
|
|
||||||
borderopacity="1.0"
|
|
||||||
inkscape:pageopacity="0"
|
|
||||||
inkscape:pageshadow="2"
|
|
||||||
inkscape:zoom="2.8284271"
|
|
||||||
inkscape:cx="69.874353"
|
|
||||||
inkscape:cy="64.313526"
|
|
||||||
inkscape:current-layer="layer1"
|
|
||||||
showgrid="false"
|
|
||||||
inkscape:document-units="px"
|
|
||||||
inkscape:grid-bbox="true"
|
|
||||||
width="128px"
|
|
||||||
height="128px"
|
|
||||||
showguides="true"
|
|
||||||
inkscape:guide-bbox="true"
|
|
||||||
inkscape:window-width="1920"
|
|
||||||
inkscape:window-height="1016"
|
|
||||||
inkscape:window-x="0"
|
|
||||||
inkscape:window-y="27"
|
|
||||||
inkscape:window-maximized="1">
|
|
||||||
<inkscape:grid
|
|
||||||
type="xygrid"
|
|
||||||
id="grid7947" />
|
|
||||||
</sodipodi:namedview>
|
|
||||||
<metadata
|
|
||||||
id="metadata6848">
|
|
||||||
<rdf:RDF>
|
|
||||||
<cc:Work
|
|
||||||
rdf:about="">
|
|
||||||
<dc:format>image/svg+xml</dc:format>
|
|
||||||
<dc:type
|
|
||||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
|
||||||
<dc:title />
|
|
||||||
<dc:date />
|
|
||||||
<dc:creator>
|
|
||||||
<cc:Agent>
|
|
||||||
<dc:title />
|
|
||||||
</cc:Agent>
|
|
||||||
</dc:creator>
|
|
||||||
<dc:rights>
|
|
||||||
<cc:Agent>
|
|
||||||
<dc:title />
|
|
||||||
</cc:Agent>
|
|
||||||
</dc:rights>
|
|
||||||
<dc:publisher>
|
|
||||||
<cc:Agent>
|
|
||||||
<dc:title />
|
|
||||||
</cc:Agent>
|
|
||||||
</dc:publisher>
|
|
||||||
<dc:identifier />
|
|
||||||
<dc:source />
|
|
||||||
<dc:relation />
|
|
||||||
<dc:language />
|
|
||||||
<dc:subject>
|
|
||||||
<rdf:Bag />
|
|
||||||
</dc:subject>
|
|
||||||
<dc:coverage />
|
|
||||||
<dc:description />
|
|
||||||
<dc:contributor>
|
|
||||||
<cc:Agent>
|
|
||||||
<dc:title />
|
|
||||||
</cc:Agent>
|
|
||||||
</dc:contributor>
|
|
||||||
<cc:license
|
|
||||||
rdf:resource="" />
|
|
||||||
</cc:Work>
|
|
||||||
<cc:Work
|
|
||||||
rdf:about="">
|
|
||||||
<dc:format>image/svg+xml</dc:format>
|
|
||||||
<dc:type
|
|
||||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
|
||||||
</cc:Work>
|
|
||||||
</rdf:RDF>
|
|
||||||
</metadata>
|
|
||||||
<g
|
|
||||||
id="layer1"
|
|
||||||
inkscape:label="Layer 1"
|
|
||||||
inkscape:groupmode="layer">
|
|
||||||
<path
|
|
||||||
sodipodi:nodetypes="ccccc"
|
|
||||||
id="path6976"
|
|
||||||
d="M 20.88413,30.82696 L 53.816977,55.527708 L 107.33282,39.060543 L 70.587303,17.177763 L 20.88413,30.82696 z"
|
|
||||||
style="fill:#729fcf;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:2.12364459;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline" />
|
|
||||||
<path
|
|
||||||
id="path6978"
|
|
||||||
d="M 22.94243,82.287118 L 20.88413,30.82696 L 53.816977,55.527708 L 53.816977,111.10486 L 22.94243,82.287118 z"
|
|
||||||
style="fill:#e40000;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:2.12364459;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline" />
|
|
||||||
<path
|
|
||||||
id="path6980"
|
|
||||||
d="M 53.816977,111.10486 L 103.21619,90.5207 L 107.33282,39.060543 L 53.816977,55.527708 L 53.816977,111.10486 z"
|
|
||||||
style="fill:#7fe719;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:2.12364459;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline" />
|
|
||||||
<path
|
|
||||||
sodipodi:nodetypes="ccc"
|
|
||||||
id="path6982"
|
|
||||||
d="M 23.216626,81.319479 L 70.48573,67.361442 L 103.38422,90.444516"
|
|
||||||
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
|
||||||
<path
|
|
||||||
sodipodi:nodetypes="cc"
|
|
||||||
id="path6984"
|
|
||||||
d="M 70.434539,17.875593 L 70.434539,66.984877"
|
|
||||||
style="opacity:1;fill:#babdb6;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 4.8 KiB |
@@ -456,33 +456,43 @@ gtk_fishbowl_do_update (GtkFishbowl *fishbowl)
|
|||||||
{
|
{
|
||||||
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
||||||
GdkFrameClock *frame_clock;
|
GdkFrameClock *frame_clock;
|
||||||
GdkFrameTimings *end;
|
GdkFrameTimings *start, *end;
|
||||||
gint64 end_counter;
|
gint64 start_counter, end_counter;
|
||||||
double fps, expected_fps;
|
gint64 n_frames, expected_frames;
|
||||||
|
gint64 start_timestamp, end_timestamp;
|
||||||
gint64 interval;
|
gint64 interval;
|
||||||
|
|
||||||
frame_clock = gtk_widget_get_frame_clock (GTK_WIDGET (fishbowl));
|
frame_clock = gtk_widget_get_frame_clock (GTK_WIDGET (fishbowl));
|
||||||
if (frame_clock == NULL)
|
if (frame_clock == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fps = gdk_frame_clock_get_fps (frame_clock);
|
start_counter = gdk_frame_clock_get_history_start (frame_clock);
|
||||||
if (fps <= 0.0)
|
end_counter = gdk_frame_clock_get_frame_counter (frame_clock);
|
||||||
|
start = gdk_frame_clock_get_timings (frame_clock, start_counter);
|
||||||
|
for (end = gdk_frame_clock_get_timings (frame_clock, end_counter);
|
||||||
|
end_counter > start_counter && end != NULL && !gdk_frame_timings_get_complete (end);
|
||||||
|
end = gdk_frame_clock_get_timings (frame_clock, end_counter))
|
||||||
|
end_counter--;
|
||||||
|
if (end_counter - start_counter < 4)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
priv->framerate = fps;
|
start_timestamp = gdk_frame_timings_get_presentation_time (start);
|
||||||
|
end_timestamp = gdk_frame_timings_get_presentation_time (end);
|
||||||
|
if (start_timestamp == 0 || end_timestamp == 0)
|
||||||
|
{
|
||||||
|
start_timestamp = gdk_frame_timings_get_frame_time (start);
|
||||||
|
end_timestamp = gdk_frame_timings_get_frame_time (end);
|
||||||
|
}
|
||||||
|
|
||||||
|
n_frames = end_counter - start_counter;
|
||||||
|
priv->framerate = ((double) n_frames) * G_USEC_PER_SEC / (end_timestamp - start_timestamp);
|
||||||
|
priv->framerate = ((int)(priv->framerate * 100))/100.0;
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (fishbowl), props[PROP_FRAMERATE]);
|
g_object_notify_by_pspec (G_OBJECT (fishbowl), props[PROP_FRAMERATE]);
|
||||||
|
|
||||||
if (!priv->benchmark)
|
if (!priv->benchmark)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
end_counter = gdk_frame_clock_get_frame_counter (frame_clock);
|
|
||||||
for (end = gdk_frame_clock_get_timings (frame_clock, end_counter);
|
|
||||||
end != NULL && !gdk_frame_timings_get_complete (end);
|
|
||||||
end = gdk_frame_clock_get_timings (frame_clock, end_counter))
|
|
||||||
end_counter--;
|
|
||||||
if (end == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
interval = gdk_frame_timings_get_refresh_interval (end);
|
interval = gdk_frame_timings_get_refresh_interval (end);
|
||||||
if (interval == 0)
|
if (interval == 0)
|
||||||
{
|
{
|
||||||
@@ -490,16 +500,16 @@ gtk_fishbowl_do_update (GtkFishbowl *fishbowl)
|
|||||||
if (interval == 0)
|
if (interval == 0)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
expected_fps = (double) G_USEC_PER_SEC / interval;
|
expected_frames = round ((double) (end_timestamp - start_timestamp) / interval);
|
||||||
|
|
||||||
if (fps > (expected_fps - 1))
|
if (n_frames >= expected_frames)
|
||||||
{
|
{
|
||||||
if (priv->last_benchmark_change > 0)
|
if (priv->last_benchmark_change > 0)
|
||||||
priv->last_benchmark_change *= 2;
|
priv->last_benchmark_change *= 2;
|
||||||
else
|
else
|
||||||
priv->last_benchmark_change = 1;
|
priv->last_benchmark_change = 1;
|
||||||
}
|
}
|
||||||
else if (0.95 * fps < expected_fps)
|
else if (n_frames + 1 < expected_frames)
|
||||||
{
|
{
|
||||||
if (priv->last_benchmark_change < 0)
|
if (priv->last_benchmark_change < 0)
|
||||||
priv->last_benchmark_change--;
|
priv->last_benchmark_change--;
|
||||||
|
@@ -116,9 +116,7 @@ static gboolean gtk_shadertoy_tick (GtkWidget *widget,
|
|||||||
GtkWidget *
|
GtkWidget *
|
||||||
gtk_shadertoy_new (void)
|
gtk_shadertoy_new (void)
|
||||||
{
|
{
|
||||||
return g_object_new (gtk_shadertoy_get_type (),
|
return g_object_new (gtk_shadertoy_get_type (), NULL);
|
||||||
"allowed-apis", GDK_GL_API_GL,
|
|
||||||
NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@@ -354,7 +354,6 @@ do_images (GtkWidget *do_widget)
|
|||||||
gicon = g_themed_icon_new_with_default_fallbacks ("battery-caution-charging-symbolic");
|
gicon = g_themed_icon_new_with_default_fallbacks ("battery-caution-charging-symbolic");
|
||||||
image = gtk_image_new_from_gicon (gicon);
|
image = gtk_image_new_from_gicon (gicon);
|
||||||
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
|
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
|
||||||
g_object_unref (gicon);
|
|
||||||
|
|
||||||
gtk_frame_set_child (GTK_FRAME (frame), image);
|
gtk_frame_set_child (GTK_FRAME (frame), image);
|
||||||
|
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
/* Lists/Selections
|
/* Lists/Selections
|
||||||
* #Keywords: suggestion, completion
|
|
||||||
*
|
*
|
||||||
* The GtkDropDown widget is a modern alternative to GtkComboBox.
|
* The GtkDropDown widget is a modern alternative to GtkComboBox.
|
||||||
* It uses list models instead of tree models, and the content is
|
* It uses list models instead of tree models, and the content is
|
||||||
|
@@ -20,12 +20,11 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <glib/gstdio.h>
|
#include <glib/gstdio.h>
|
||||||
#include <glib/gi18n.h>
|
|
||||||
|
|
||||||
#include "demos.h"
|
#include "demos.h"
|
||||||
#include "fontify.h"
|
#include "fontify.h"
|
||||||
|
|
||||||
#include "profile_conf.h"
|
#include "demo_conf.h"
|
||||||
|
|
||||||
static GtkWidget *info_view;
|
static GtkWidget *info_view;
|
||||||
static GtkWidget *source_view;
|
static GtkWidget *source_view;
|
||||||
@@ -828,25 +827,13 @@ demo_search_changed_cb (GtkSearchEntry *entry,
|
|||||||
gtk_filter_changed (filter, GTK_FILTER_CHANGE_DIFFERENT);
|
gtk_filter_changed (filter, GTK_FILTER_CHANGE_DIFFERENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
demo_can_run (GtkWidget *window,
|
|
||||||
const char *name)
|
|
||||||
{
|
|
||||||
if (name != NULL && strcmp (name, "gltransition") == 0)
|
|
||||||
return GSK_IS_GL_RENDERER (gtk_native_get_renderer (GTK_NATIVE (window)));
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GListModel *
|
static GListModel *
|
||||||
create_demo_model (GtkWidget *window)
|
create_demo_model (void)
|
||||||
{
|
{
|
||||||
GListStore *store = g_list_store_new (GTK_TYPE_DEMO);
|
GListStore *store = g_list_store_new (GTK_TYPE_DEMO);
|
||||||
DemoData *demo = gtk_demos;
|
DemoData *demo = gtk_demos;
|
||||||
GtkDemo *d;
|
GtkDemo *d;
|
||||||
|
|
||||||
gtk_widget_realize (window);
|
|
||||||
|
|
||||||
d = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
|
d = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
|
||||||
d->name = "main";
|
d->name = "main";
|
||||||
d->title = "GTK Demo";
|
d->title = "GTK Demo";
|
||||||
@@ -858,20 +845,16 @@ create_demo_model (GtkWidget *window)
|
|||||||
|
|
||||||
while (demo->title)
|
while (demo->title)
|
||||||
{
|
{
|
||||||
DemoData *children = demo->children;
|
d = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
|
||||||
|
DemoData *children = demo->children;
|
||||||
|
|
||||||
if (demo_can_run (window, demo->name))
|
d->name = demo->name;
|
||||||
{
|
d->title = demo->title;
|
||||||
d = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
|
d->keywords = demo->keywords;
|
||||||
|
d->filename = demo->filename;
|
||||||
|
d->func = demo->func;
|
||||||
|
|
||||||
d->name = demo->name;
|
g_list_store_append (store, d);
|
||||||
d->title = demo->title;
|
|
||||||
d->keywords = demo->keywords;
|
|
||||||
d->filename = demo->filename;
|
|
||||||
d->func = demo->func;
|
|
||||||
|
|
||||||
g_list_store_append (store, d);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (children)
|
if (children)
|
||||||
{
|
{
|
||||||
@@ -879,19 +862,15 @@ create_demo_model (GtkWidget *window)
|
|||||||
|
|
||||||
while (children->title)
|
while (children->title)
|
||||||
{
|
{
|
||||||
if (demo_can_run (window, children->name))
|
GtkDemo *child = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
|
||||||
{
|
|
||||||
GtkDemo *child = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
|
|
||||||
|
|
||||||
child->name = children->name;
|
child->name = children->name;
|
||||||
child->title = children->title;
|
child->title = children->title;
|
||||||
child->keywords = children->keywords;
|
child->keywords = children->keywords;
|
||||||
child->filename = children->filename;
|
child->filename = children->filename;
|
||||||
child->func = children->func;
|
child->func = children->func;
|
||||||
|
|
||||||
g_list_store_append (G_LIST_STORE (d->children_model), child);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
g_list_store_append (G_LIST_STORE (d->children_model), child);
|
||||||
children++;
|
children++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -924,34 +903,6 @@ clear_search (GtkSearchBar *bar)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
search_results_update (GObject *filter_model,
|
|
||||||
GParamSpec *pspec,
|
|
||||||
GtkEntry *entry)
|
|
||||||
{
|
|
||||||
gsize n_items = g_list_model_get_n_items (G_LIST_MODEL (filter_model));
|
|
||||||
|
|
||||||
if (strlen (gtk_editable_get_text (GTK_EDITABLE (entry))) > 0)
|
|
||||||
{
|
|
||||||
char *text;
|
|
||||||
|
|
||||||
if (n_items > 0)
|
|
||||||
text = g_strdup_printf (ngettext ("%ld search result", "%ld search results", n_items), n_items);
|
|
||||||
else
|
|
||||||
text = g_strdup (_("No search results"));
|
|
||||||
|
|
||||||
gtk_accessible_update_property (GTK_ACCESSIBLE (entry),
|
|
||||||
GTK_ACCESSIBLE_PROPERTY_DESCRIPTION, text,
|
|
||||||
-1);
|
|
||||||
|
|
||||||
g_free (text);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gtk_accessible_reset_property (GTK_ACCESSIBLE (entry), GTK_ACCESSIBLE_PROPERTY_DESCRIPTION);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
activate (GApplication *app)
|
activate (GApplication *app)
|
||||||
{
|
{
|
||||||
@@ -985,7 +936,7 @@ activate (GApplication *app)
|
|||||||
search_bar = GTK_WIDGET (gtk_builder_get_object (builder, "searchbar"));
|
search_bar = GTK_WIDGET (gtk_builder_get_object (builder, "searchbar"));
|
||||||
g_signal_connect (search_bar, "notify::search-mode-enabled", G_CALLBACK (clear_search), NULL);
|
g_signal_connect (search_bar, "notify::search-mode-enabled", G_CALLBACK (clear_search), NULL);
|
||||||
|
|
||||||
listmodel = create_demo_model (window);
|
listmodel = create_demo_model ();
|
||||||
treemodel = gtk_tree_list_model_new (G_LIST_MODEL (listmodel),
|
treemodel = gtk_tree_list_model_new (G_LIST_MODEL (listmodel),
|
||||||
FALSE,
|
FALSE,
|
||||||
TRUE,
|
TRUE,
|
||||||
@@ -999,7 +950,6 @@ activate (GApplication *app)
|
|||||||
|
|
||||||
search_entry = GTK_WIDGET (gtk_builder_get_object (builder, "search-entry"));
|
search_entry = GTK_WIDGET (gtk_builder_get_object (builder, "search-entry"));
|
||||||
g_signal_connect (search_entry, "search-changed", G_CALLBACK (demo_search_changed_cb), filter);
|
g_signal_connect (search_entry, "search-changed", G_CALLBACK (demo_search_changed_cb), filter);
|
||||||
g_signal_connect (filter_model, "notify::n-items", G_CALLBACK (search_results_update), search_entry);
|
|
||||||
|
|
||||||
selection = gtk_single_selection_new (G_LIST_MODEL (filter_model));
|
selection = gtk_single_selection_new (G_LIST_MODEL (filter_model));
|
||||||
g_signal_connect (selection, "notify::selected-item", G_CALLBACK (selection_cb), NULL);
|
g_signal_connect (selection, "notify::selected-item", G_CALLBACK (selection_cb), NULL);
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
<interface>
|
<interface>
|
||||||
<menu id="menubar">
|
<menu id="menubar">
|
||||||
<submenu>
|
<submenu>
|
||||||
<attribute name="label" translatable="yes">_File</attribute>
|
<attribute name="label" translatable="yes">_Application</attribute>
|
||||||
<section>
|
<section>
|
||||||
<item>
|
<item>
|
||||||
<attribute name="label" translatable="yes">_New</attribute>
|
<attribute name="label" translatable="yes">_New</attribute>
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
</section>
|
</section>
|
||||||
</submenu>
|
</submenu>
|
||||||
<submenu>
|
<submenu>
|
||||||
<attribute name="label" translatable="yes">_Preferences</attribute>
|
<attribute name="label" translatable="yes">_File</attribute>
|
||||||
<section>
|
<section>
|
||||||
<item>
|
<item>
|
||||||
<attribute name="label" translatable="yes">_Prefer Dark Theme</attribute>
|
<attribute name="label" translatable="yes">_Prefer Dark Theme</attribute>
|
||||||
|
@@ -236,7 +236,7 @@ foreach flag: common_cflags
|
|||||||
endif
|
endif
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
gtkdemo_deps += [ profile_conf_h ]
|
gtkdemo_deps += [ demo_conf_h ]
|
||||||
|
|
||||||
executable('gtk4-demo',
|
executable('gtk4-demo',
|
||||||
sources: [demos, demos_h, extra_demo_sources, gtkdemo_resources],
|
sources: [demos, demos_h, extra_demo_sources, gtkdemo_resources],
|
||||||
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
@@ -338,7 +338,7 @@ do_path_maze (GtkWidget *do_widget)
|
|||||||
GskPath *path;
|
GskPath *path;
|
||||||
|
|
||||||
window = gtk_window_new ();
|
window = gtk_window_new ();
|
||||||
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
|
||||||
gtk_window_set_title (GTK_WINDOW (window), "Follow the maze with the mouse");
|
gtk_window_set_title (GTK_WINDOW (window), "Follow the maze with the mouse");
|
||||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
@@ -120,7 +120,7 @@ create_shadertoy_window (GtkWidget *do_widget)
|
|||||||
gtk_box_append (GTK_BOX (box), aspect);
|
gtk_box_append (GTK_BOX (box), aspect);
|
||||||
|
|
||||||
shadertoy = new_shadertoy ("/shadertoy/alienplanet.glsl");
|
shadertoy = new_shadertoy ("/shadertoy/alienplanet.glsl");
|
||||||
gtk_aspect_frame_set_child (GTK_ASPECT_FRAME (aspect), gtk_graphics_offload_new (shadertoy));
|
gtk_aspect_frame_set_child (GTK_ASPECT_FRAME (aspect), shadertoy);
|
||||||
|
|
||||||
sw = gtk_scrolled_window_new ();
|
sw = gtk_scrolled_window_new ();
|
||||||
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (sw), 250);
|
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (sw), 250);
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
#include "iconbrowserapp.h"
|
#include "iconbrowserapp.h"
|
||||||
#include "iconbrowserwin.h"
|
#include "iconbrowserwin.h"
|
||||||
|
|
||||||
#include "profile_conf.h"
|
#include "demo_conf.h"
|
||||||
|
|
||||||
struct _IconBrowserApp
|
struct _IconBrowserApp
|
||||||
{
|
{
|
||||||
|
@@ -14,7 +14,7 @@ iconbrowser_resources = gnome.compile_resources('iconbrowser_resources',
|
|||||||
executable('gtk4-icon-browser',
|
executable('gtk4-icon-browser',
|
||||||
sources: [iconbrowser_sources, iconbrowser_resources],
|
sources: [iconbrowser_sources, iconbrowser_resources],
|
||||||
c_args: common_cflags,
|
c_args: common_cflags,
|
||||||
dependencies: [ libgtk_dep, profile_conf_h ],
|
dependencies: [ libgtk_dep, demo_conf_h ],
|
||||||
include_directories: confinc,
|
include_directories: confinc,
|
||||||
win_subsystem: 'windows',
|
win_subsystem: 'windows',
|
||||||
link_args: extra_demo_ldflags,
|
link_args: extra_demo_ldflags,
|
||||||
|
@@ -1,3 +1,16 @@
|
|||||||
|
gen_demo_header = find_program('../build-aux/meson/gen-demo-header.py')
|
||||||
|
demo_profile = get_option('demo-profile')
|
||||||
|
|
||||||
|
demo_conf_h = declare_dependency(
|
||||||
|
sources: custom_target('demo-header',
|
||||||
|
command: [gen_demo_header, meson.project_source_root(), demo_profile],
|
||||||
|
capture: true,
|
||||||
|
output: 'demo_conf.h',
|
||||||
|
build_by_default: true,
|
||||||
|
build_always_stale: true,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
# appdata
|
# appdata
|
||||||
|
|
||||||
appdata_config = configuration_data()
|
appdata_config = configuration_data()
|
||||||
|
@@ -12,7 +12,7 @@ node_editor_resources = gnome.compile_resources('node_editor_resources',
|
|||||||
|
|
||||||
executable('gtk4-node-editor',
|
executable('gtk4-node-editor',
|
||||||
sources: [node_editor_sources, node_editor_resources],
|
sources: [node_editor_sources, node_editor_resources],
|
||||||
dependencies: [ libgtk_dep, profile_conf_h ],
|
dependencies: [ libgtk_dep, demo_conf_h ],
|
||||||
include_directories: confinc,
|
include_directories: confinc,
|
||||||
c_args: common_cflags,
|
c_args: common_cflags,
|
||||||
win_subsystem: 'windows',
|
win_subsystem: 'windows',
|
||||||
|
@@ -19,13 +19,15 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <glib/gstdio.h>
|
#ifdef HAVE_PANGOFT
|
||||||
|
#include <pango/pangofc-fontmap.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "node-editor-application.h"
|
#include "node-editor-application.h"
|
||||||
|
|
||||||
#include "node-editor-window.h"
|
#include "node-editor-window.h"
|
||||||
|
|
||||||
#include "profile_conf.h"
|
#include "demo_conf.h"
|
||||||
|
|
||||||
static const char *css =
|
static const char *css =
|
||||||
"textview.editor {"
|
"textview.editor {"
|
||||||
@@ -47,11 +49,47 @@ struct _NodeEditorApplicationClass
|
|||||||
GtkApplicationClass parent_class;
|
GtkApplicationClass parent_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE(NodeEditorApplication, node_editor_application, GTK_TYPE_APPLICATION);
|
G_DEFINE_TYPE (NodeEditorApplication, node_editor_application, GTK_TYPE_APPLICATION);
|
||||||
|
|
||||||
|
static void
|
||||||
|
maybe_add_test_fonts (void)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_PANGOFT
|
||||||
|
const char *subdir = "testsuite/gsk/fonts";
|
||||||
|
const char *source_dir;
|
||||||
|
char *dir;
|
||||||
|
|
||||||
|
source_dir = g_getenv ("GTK_SOURCE_DIR");
|
||||||
|
|
||||||
|
if (source_dir)
|
||||||
|
{
|
||||||
|
char *abs_source_dir = g_canonicalize_filename (source_dir, NULL);
|
||||||
|
dir = g_canonicalize_filename (subdir, abs_source_dir);
|
||||||
|
g_free (abs_source_dir);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char *current_dir = g_get_current_dir ();
|
||||||
|
dir = g_canonicalize_filename (subdir, current_dir);
|
||||||
|
g_free (current_dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_file_test (dir, G_FILE_TEST_EXISTS))
|
||||||
|
{
|
||||||
|
FcConfig *config;
|
||||||
|
|
||||||
|
config = FcConfigGetCurrent ();
|
||||||
|
FcConfigAppFontAddDir (config, (const FcChar8 *) dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free (dir);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
node_editor_application_init (NodeEditorApplication *app)
|
node_editor_application_init (NodeEditorApplication *app)
|
||||||
{
|
{
|
||||||
|
maybe_add_test_fonts ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -249,63 +287,11 @@ node_editor_application_class_init (NodeEditorApplicationClass *class)
|
|||||||
application_class->open = node_editor_application_open;
|
application_class->open = node_editor_application_open;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
print_version (void)
|
|
||||||
{
|
|
||||||
g_print ("gtk4-node-editor %s%s%s\n",
|
|
||||||
PACKAGE_VERSION,
|
|
||||||
g_strcmp0 (PROFILE, "devel") == 0 ? "-" : "",
|
|
||||||
g_strcmp0 (PROFILE, "devel") == 0 ? VCS_TAG : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
local_options (GApplication *app,
|
|
||||||
GVariantDict *options,
|
|
||||||
gpointer data)
|
|
||||||
{
|
|
||||||
gboolean version = FALSE;
|
|
||||||
gboolean reset = FALSE;
|
|
||||||
|
|
||||||
g_variant_dict_lookup (options, "version", "b", &version);
|
|
||||||
|
|
||||||
if (version)
|
|
||||||
{
|
|
||||||
print_version ();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_variant_dict_lookup (options, "reset", "b", &reset);
|
|
||||||
|
|
||||||
if (reset)
|
|
||||||
{
|
|
||||||
char *path;
|
|
||||||
|
|
||||||
path = get_autosave_path ("-unsafe");
|
|
||||||
g_remove (path);
|
|
||||||
g_free (path);
|
|
||||||
path = get_autosave_path (NULL);
|
|
||||||
g_remove (path);
|
|
||||||
g_free (path);
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
NodeEditorApplication *
|
NodeEditorApplication *
|
||||||
node_editor_application_new (void)
|
node_editor_application_new (void)
|
||||||
{
|
{
|
||||||
NodeEditorApplication *app;
|
return g_object_new (NODE_EDITOR_APPLICATION_TYPE,
|
||||||
|
"application-id", "org.gtk.gtk4.NodeEditor",
|
||||||
app = g_object_new (NODE_EDITOR_APPLICATION_TYPE,
|
"flags", G_APPLICATION_HANDLES_OPEN,
|
||||||
"application-id", "org.gtk.gtk4.NodeEditor",
|
NULL);
|
||||||
"flags", G_APPLICATION_HANDLES_OPEN,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
g_application_add_main_option (G_APPLICATION (app), "version", 0, 0,G_OPTION_ARG_NONE, "Show program version", NULL);
|
|
||||||
g_application_add_main_option (G_APPLICATION (app), "reset", 0, 0,G_OPTION_ARG_NONE, "Remove autosave content", NULL);
|
|
||||||
|
|
||||||
g_signal_connect (app, "handle-local-options", G_CALLBACK (local_options), NULL);
|
|
||||||
|
|
||||||
return app;
|
|
||||||
}
|
}
|
||||||
|
@@ -28,8 +28,6 @@
|
|||||||
#include "gsk/broadway/gskbroadwayrenderer.h"
|
#include "gsk/broadway/gskbroadwayrenderer.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <glib/gstdio.h>
|
|
||||||
|
|
||||||
#include <cairo.h>
|
#include <cairo.h>
|
||||||
#ifdef CAIRO_HAS_SVG_SURFACE
|
#ifdef CAIRO_HAS_SVG_SURFACE
|
||||||
#include <cairo-svg.h>
|
#include <cairo-svg.h>
|
||||||
@@ -57,7 +55,6 @@ struct _NodeEditorWindow
|
|||||||
GtkWidget *testcase_name_entry;
|
GtkWidget *testcase_name_entry;
|
||||||
GtkWidget *testcase_save_button;
|
GtkWidget *testcase_save_button;
|
||||||
GtkWidget *scale_scale;
|
GtkWidget *scale_scale;
|
||||||
GtkWidget *crash_warning;
|
|
||||||
|
|
||||||
GtkWidget *renderer_listbox;
|
GtkWidget *renderer_listbox;
|
||||||
GListStore *renderers;
|
GListStore *renderers;
|
||||||
@@ -67,10 +64,6 @@ struct _NodeEditorWindow
|
|||||||
GFileMonitor *file_monitor;
|
GFileMonitor *file_monitor;
|
||||||
|
|
||||||
GArray *errors;
|
GArray *errors;
|
||||||
|
|
||||||
gboolean auto_reload;
|
|
||||||
gboolean mark_as_safe_pending;
|
|
||||||
gulong after_paint_handler;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _NodeEditorWindowClass
|
struct _NodeEditorWindowClass
|
||||||
@@ -78,13 +71,6 @@ struct _NodeEditorWindowClass
|
|||||||
GtkApplicationWindowClass parent_class;
|
GtkApplicationWindowClass parent_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
|
||||||
PROP_AUTO_RELOAD = 1,
|
|
||||||
NUM_PROPERTIES
|
|
||||||
};
|
|
||||||
|
|
||||||
static GParamSpec *properties[NUM_PROPERTIES] = { NULL, };
|
|
||||||
|
|
||||||
G_DEFINE_TYPE(NodeEditorWindow, node_editor_window, GTK_TYPE_APPLICATION_WINDOW);
|
G_DEFINE_TYPE(NodeEditorWindow, node_editor_window, GTK_TYPE_APPLICATION_WINDOW);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -177,121 +163,19 @@ text_iter_skip_whitespace_backward (GtkTextIter *iter)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
highlight_text (NodeEditorWindow *self)
|
text_changed (GtkTextBuffer *buffer,
|
||||||
{
|
NodeEditorWindow *self)
|
||||||
GtkTextIter iter;
|
|
||||||
GtkTextIter start, end;
|
|
||||||
|
|
||||||
gtk_text_buffer_get_start_iter (self->text_buffer, &iter);
|
|
||||||
|
|
||||||
while (!gtk_text_iter_is_end (&iter))
|
|
||||||
{
|
|
||||||
gunichar c = gtk_text_iter_get_char (&iter);
|
|
||||||
|
|
||||||
if (c == '{')
|
|
||||||
{
|
|
||||||
GtkTextIter word_end = iter;
|
|
||||||
GtkTextIter word_start;
|
|
||||||
|
|
||||||
gtk_text_iter_backward_char (&word_end);
|
|
||||||
text_iter_skip_whitespace_backward (&word_end);
|
|
||||||
|
|
||||||
word_start = word_end;
|
|
||||||
gtk_text_iter_backward_word_start (&word_start);
|
|
||||||
text_iter_skip_alpha_backward (&word_start);
|
|
||||||
|
|
||||||
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "nodename", &word_start, &word_end);
|
|
||||||
}
|
|
||||||
else if (c == ':')
|
|
||||||
{
|
|
||||||
GtkTextIter word_end = iter;
|
|
||||||
GtkTextIter word_start;
|
|
||||||
|
|
||||||
gtk_text_iter_backward_char (&word_end);
|
|
||||||
text_iter_skip_whitespace_backward (&word_end);
|
|
||||||
|
|
||||||
word_start = word_end;
|
|
||||||
gtk_text_iter_backward_word_start (&word_start);
|
|
||||||
text_iter_skip_alpha_backward (&word_start);
|
|
||||||
|
|
||||||
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "propname", &word_start, &word_end);
|
|
||||||
}
|
|
||||||
else if (c == '"')
|
|
||||||
{
|
|
||||||
GtkTextIter string_start = iter;
|
|
||||||
GtkTextIter string_end = iter;
|
|
||||||
|
|
||||||
gtk_text_iter_forward_char (&iter);
|
|
||||||
while (!gtk_text_iter_is_end (&iter))
|
|
||||||
{
|
|
||||||
c = gtk_text_iter_get_char (&iter);
|
|
||||||
|
|
||||||
if (c == '"')
|
|
||||||
{
|
|
||||||
gtk_text_iter_forward_char (&iter);
|
|
||||||
string_end = iter;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_text_iter_forward_char (&iter);
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "string", &string_start, &string_end);
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_text_iter_forward_char (&iter);
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_text_buffer_get_bounds (self->text_buffer, &start, &end);
|
|
||||||
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "no-hyphens", &start, &end);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
mark_autosave_as_unsafe (void)
|
|
||||||
{
|
|
||||||
char *path1 = NULL;
|
|
||||||
char *path2 = NULL;
|
|
||||||
|
|
||||||
path1 = get_autosave_path ("-unsafe");
|
|
||||||
path2 = get_autosave_path (NULL);
|
|
||||||
|
|
||||||
g_rename (path2, path1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
mark_autosave_as_safe (void)
|
|
||||||
{
|
|
||||||
char *path1 = NULL;
|
|
||||||
char *path2 = NULL;
|
|
||||||
|
|
||||||
path1 = get_autosave_path ("-unsafe");
|
|
||||||
path2 = get_autosave_path (NULL);
|
|
||||||
|
|
||||||
g_rename (path1, path2);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
after_paint (GdkFrameClock *clock,
|
|
||||||
NodeEditorWindow *self)
|
|
||||||
{
|
|
||||||
if (self->mark_as_safe_pending)
|
|
||||||
{
|
|
||||||
self->mark_as_safe_pending = FALSE;
|
|
||||||
mark_autosave_as_safe ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
reload (NodeEditorWindow *self)
|
|
||||||
{
|
{
|
||||||
char *text;
|
char *text;
|
||||||
GBytes *bytes;
|
GBytes *bytes;
|
||||||
|
GtkTextIter iter;
|
||||||
|
GtkTextIter start, end;
|
||||||
float scale;
|
float scale;
|
||||||
GskRenderNode *big_node;
|
GskRenderNode *big_node;
|
||||||
|
|
||||||
mark_autosave_as_unsafe ();
|
g_array_remove_range (self->errors, 0, self->errors->len);
|
||||||
|
|
||||||
text = get_current_text (self->text_buffer);
|
text = get_current_text (self->text_buffer);
|
||||||
|
text_buffer_remove_all_tags (self->text_buffer);
|
||||||
bytes = g_bytes_new_take (text, strlen (text));
|
bytes = g_bytes_new_take (text, strlen (text));
|
||||||
|
|
||||||
g_clear_pointer (&self->node, gsk_render_node_unref);
|
g_clear_pointer (&self->node, gsk_render_node_unref);
|
||||||
@@ -353,20 +237,72 @@ reload (NodeEditorWindow *self)
|
|||||||
|
|
||||||
g_clear_pointer (&big_node, gsk_render_node_unref);
|
g_clear_pointer (&big_node, gsk_render_node_unref);
|
||||||
|
|
||||||
self->mark_as_safe_pending = TRUE;
|
gtk_text_buffer_get_start_iter (self->text_buffer, &iter);
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
while (!gtk_text_iter_is_end (&iter))
|
||||||
text_changed (GtkTextBuffer *buffer,
|
{
|
||||||
NodeEditorWindow *self)
|
gunichar c = gtk_text_iter_get_char (&iter);
|
||||||
{
|
|
||||||
g_array_remove_range (self->errors, 0, self->errors->len);
|
|
||||||
text_buffer_remove_all_tags (self->text_buffer);
|
|
||||||
|
|
||||||
if (self->auto_reload)
|
if (c == '{')
|
||||||
reload (self);
|
{
|
||||||
|
GtkTextIter word_end = iter;
|
||||||
|
GtkTextIter word_start;
|
||||||
|
|
||||||
highlight_text (self);
|
gtk_text_iter_backward_char (&word_end);
|
||||||
|
text_iter_skip_whitespace_backward (&word_end);
|
||||||
|
|
||||||
|
word_start = word_end;
|
||||||
|
gtk_text_iter_backward_word_start (&word_start);
|
||||||
|
text_iter_skip_alpha_backward (&word_start);
|
||||||
|
|
||||||
|
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "nodename",
|
||||||
|
&word_start, &word_end);
|
||||||
|
}
|
||||||
|
else if (c == ':')
|
||||||
|
{
|
||||||
|
GtkTextIter word_end = iter;
|
||||||
|
GtkTextIter word_start;
|
||||||
|
|
||||||
|
gtk_text_iter_backward_char (&word_end);
|
||||||
|
text_iter_skip_whitespace_backward (&word_end);
|
||||||
|
|
||||||
|
word_start = word_end;
|
||||||
|
gtk_text_iter_backward_word_start (&word_start);
|
||||||
|
text_iter_skip_alpha_backward (&word_start);
|
||||||
|
|
||||||
|
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "propname",
|
||||||
|
&word_start, &word_end);
|
||||||
|
}
|
||||||
|
else if (c == '"')
|
||||||
|
{
|
||||||
|
GtkTextIter string_start = iter;
|
||||||
|
GtkTextIter string_end = iter;
|
||||||
|
|
||||||
|
gtk_text_iter_forward_char (&iter);
|
||||||
|
while (!gtk_text_iter_is_end (&iter))
|
||||||
|
{
|
||||||
|
c = gtk_text_iter_get_char (&iter);
|
||||||
|
|
||||||
|
if (c == '"')
|
||||||
|
{
|
||||||
|
gtk_text_iter_forward_char (&iter);
|
||||||
|
string_end = iter;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_text_iter_forward_char (&iter);
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "string",
|
||||||
|
&string_start, &string_end);
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_text_iter_forward_char (&iter);
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_text_buffer_get_bounds (self->text_buffer, &start, &end);
|
||||||
|
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "no-hyphens",
|
||||||
|
&start, &end);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1209,7 +1145,6 @@ static void
|
|||||||
node_editor_window_realize (GtkWidget *widget)
|
node_editor_window_realize (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
NodeEditorWindow *self = NODE_EDITOR_WINDOW (widget);
|
NodeEditorWindow *self = NODE_EDITOR_WINDOW (widget);
|
||||||
GdkFrameClock *frameclock;
|
|
||||||
|
|
||||||
GTK_WIDGET_CLASS (node_editor_window_parent_class)->realize (widget);
|
GTK_WIDGET_CLASS (node_editor_window_parent_class)->realize (widget);
|
||||||
|
|
||||||
@@ -1237,24 +1172,14 @@ node_editor_window_realize (GtkWidget *widget)
|
|||||||
node_editor_window_add_renderer (self,
|
node_editor_window_add_renderer (self,
|
||||||
gsk_cairo_renderer_new (),
|
gsk_cairo_renderer_new (),
|
||||||
"Cairo");
|
"Cairo");
|
||||||
|
|
||||||
frameclock = gtk_widget_get_frame_clock (widget);
|
|
||||||
self->after_paint_handler = g_signal_connect (frameclock, "after-paint",
|
|
||||||
G_CALLBACK (after_paint), self);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
node_editor_window_unrealize (GtkWidget *widget)
|
node_editor_window_unrealize (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
NodeEditorWindow *self = NODE_EDITOR_WINDOW (widget);
|
NodeEditorWindow *self = NODE_EDITOR_WINDOW (widget);
|
||||||
GdkFrameClock *frameclock;
|
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
frameclock = gtk_widget_get_frame_clock (widget);
|
|
||||||
g_signal_handler_disconnect (frameclock, self->after_paint_handler);
|
|
||||||
self->after_paint_handler = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (self->renderers)); i ++)
|
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (self->renderers)); i ++)
|
||||||
{
|
{
|
||||||
gpointer item = g_list_model_get_item (G_LIST_MODEL (self->renderers), i);
|
gpointer item = g_list_model_get_item (G_LIST_MODEL (self->renderers), i);
|
||||||
@@ -1615,62 +1540,6 @@ edit_action_cb (GtkWidget *widget,
|
|||||||
node_editor_window_edit (self, &start);
|
node_editor_window_edit (self, &start);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
node_editor_window_set_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
const GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
NodeEditorWindow *self = NODE_EDITOR_WINDOW (object);
|
|
||||||
|
|
||||||
switch (prop_id)
|
|
||||||
{
|
|
||||||
case PROP_AUTO_RELOAD:
|
|
||||||
{
|
|
||||||
gboolean auto_reload = g_value_get_boolean (value);
|
|
||||||
if (self->auto_reload != auto_reload)
|
|
||||||
{
|
|
||||||
self->auto_reload = auto_reload;
|
|
||||||
|
|
||||||
if (self->auto_reload)
|
|
||||||
reload (self);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
node_editor_window_get_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
NodeEditorWindow *self = NODE_EDITOR_WINDOW (object);
|
|
||||||
|
|
||||||
switch (prop_id)
|
|
||||||
{
|
|
||||||
case PROP_AUTO_RELOAD:
|
|
||||||
g_value_set_boolean (value, self->auto_reload);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
close_crash_warning (GtkButton *button,
|
|
||||||
NodeEditorWindow *self)
|
|
||||||
{
|
|
||||||
gtk_revealer_set_reveal_child (GTK_REVEALER (self->crash_warning), FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
node_editor_window_class_init (NodeEditorWindowClass *class)
|
node_editor_window_class_init (NodeEditorWindowClass *class)
|
||||||
{
|
{
|
||||||
@@ -1682,8 +1551,6 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
|
|||||||
|
|
||||||
object_class->dispose = node_editor_window_dispose;
|
object_class->dispose = node_editor_window_dispose;
|
||||||
object_class->finalize = node_editor_window_finalize;
|
object_class->finalize = node_editor_window_finalize;
|
||||||
object_class->set_property = node_editor_window_set_property;
|
|
||||||
object_class->get_property = node_editor_window_get_property;
|
|
||||||
|
|
||||||
gtk_widget_class_set_template_from_resource (widget_class,
|
gtk_widget_class_set_template_from_resource (widget_class,
|
||||||
"/org/gtk/gtk4/node-editor/node-editor-window.ui");
|
"/org/gtk/gtk4/node-editor/node-editor-window.ui");
|
||||||
@@ -1691,12 +1558,6 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
|
|||||||
widget_class->realize = node_editor_window_realize;
|
widget_class->realize = node_editor_window_realize;
|
||||||
widget_class->unrealize = node_editor_window_unrealize;
|
widget_class->unrealize = node_editor_window_unrealize;
|
||||||
|
|
||||||
properties[PROP_AUTO_RELOAD] = g_param_spec_boolean ("auto-reload", NULL, NULL,
|
|
||||||
TRUE,
|
|
||||||
G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_STATIC_NAME);
|
|
||||||
|
|
||||||
g_object_class_install_properties (object_class, NUM_PROPERTIES, properties);
|
|
||||||
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, text_view);
|
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, text_view);
|
||||||
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, picture);
|
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, picture);
|
||||||
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, renderer_listbox);
|
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, renderer_listbox);
|
||||||
@@ -1706,7 +1567,6 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
|
|||||||
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, testcase_name_entry);
|
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, testcase_name_entry);
|
||||||
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, testcase_save_button);
|
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, testcase_save_button);
|
||||||
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, scale_scale);
|
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, scale_scale);
|
||||||
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, crash_warning);
|
|
||||||
|
|
||||||
gtk_widget_class_bind_template_callback (widget_class, text_view_query_tooltip_cb);
|
gtk_widget_class_bind_template_callback (widget_class, text_view_query_tooltip_cb);
|
||||||
gtk_widget_class_bind_template_callback (widget_class, open_cb);
|
gtk_widget_class_bind_template_callback (widget_class, open_cb);
|
||||||
@@ -1719,7 +1579,6 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
|
|||||||
gtk_widget_class_bind_template_callback (widget_class, on_picture_drag_prepare_cb);
|
gtk_widget_class_bind_template_callback (widget_class, on_picture_drag_prepare_cb);
|
||||||
gtk_widget_class_bind_template_callback (widget_class, on_picture_drop_cb);
|
gtk_widget_class_bind_template_callback (widget_class, on_picture_drop_cb);
|
||||||
gtk_widget_class_bind_template_callback (widget_class, click_gesture_pressed);
|
gtk_widget_class_bind_template_callback (widget_class, click_gesture_pressed);
|
||||||
gtk_widget_class_bind_template_callback (widget_class, close_crash_warning);
|
|
||||||
|
|
||||||
gtk_widget_class_install_action (widget_class, "smart-edit", NULL, edit_action_cb);
|
gtk_widget_class_install_action (widget_class, "smart-edit", NULL, edit_action_cb);
|
||||||
|
|
||||||
@@ -1771,98 +1630,11 @@ static GActionEntry win_entries[] = {
|
|||||||
{ "open", window_open, NULL, NULL, NULL },
|
{ "open", window_open, NULL, NULL, NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
char *
|
|
||||||
get_autosave_path (const char *suffix)
|
|
||||||
{
|
|
||||||
char *path;
|
|
||||||
char *name;
|
|
||||||
|
|
||||||
name = g_strconcat ("autosave", suffix, NULL);
|
|
||||||
path = g_build_filename (g_get_user_cache_dir (), "gtk4-node-editor", name, NULL);
|
|
||||||
g_free (name);
|
|
||||||
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
set_initial_text (NodeEditorWindow *self)
|
|
||||||
{
|
|
||||||
char *path, *path1;
|
|
||||||
char *initial_text;
|
|
||||||
gsize len;
|
|
||||||
|
|
||||||
path = get_autosave_path (NULL);
|
|
||||||
path1 = get_autosave_path ("-unsafe");
|
|
||||||
|
|
||||||
if (g_file_get_contents (path1, &initial_text, &len, NULL))
|
|
||||||
{
|
|
||||||
self->auto_reload = FALSE;
|
|
||||||
gtk_revealer_set_reveal_child (GTK_REVEALER (self->crash_warning), TRUE);
|
|
||||||
|
|
||||||
gtk_text_buffer_set_text (self->text_buffer, initial_text, len);
|
|
||||||
g_free (initial_text);
|
|
||||||
}
|
|
||||||
else if (g_file_get_contents (path, &initial_text, &len, NULL))
|
|
||||||
{
|
|
||||||
gtk_text_buffer_set_text (self->text_buffer, initial_text, len);
|
|
||||||
g_free (initial_text);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Default */
|
|
||||||
gtk_text_buffer_set_text (self->text_buffer,
|
|
||||||
"shadow {\n"
|
|
||||||
" child: texture {\n"
|
|
||||||
" bounds: 0 0 128 128;\n"
|
|
||||||
" texture: url(\"resource:///org/gtk/gtk4/node-editor/icons/apps/org.gtk.gtk4.NodeEditor.svg\");\n"
|
|
||||||
" }\n"
|
|
||||||
" shadows: rgba(0,0,0,0.5) 0 1 12;\n"
|
|
||||||
"}\n"
|
|
||||||
"\n"
|
|
||||||
"transform {\n"
|
|
||||||
" child: text {\n"
|
|
||||||
" color: rgb(46,52,54);\n"
|
|
||||||
" font: \"Cantarell Bold 11\";\n"
|
|
||||||
" glyphs: \"GTK Node Editor\";\n"
|
|
||||||
" offset: 8 14.418;\n"
|
|
||||||
" }\n"
|
|
||||||
" transform: translate(0, 140);\n"
|
|
||||||
"}", -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_free (path);
|
|
||||||
g_free (path1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
autosave_contents (NodeEditorWindow *self)
|
|
||||||
{
|
|
||||||
char *path = NULL;
|
|
||||||
char *dir = NULL;
|
|
||||||
char *contents;
|
|
||||||
GtkTextIter start, end;
|
|
||||||
|
|
||||||
gtk_text_buffer_get_bounds (self->text_buffer, &start, &end);
|
|
||||||
contents = gtk_text_buffer_get_text (self->text_buffer, &start, &end, TRUE);
|
|
||||||
path = get_autosave_path ("-unsafe");
|
|
||||||
dir = g_path_get_dirname (path);
|
|
||||||
g_mkdir_with_parents (dir, 0755);
|
|
||||||
g_file_set_contents (path, contents, -1, NULL);
|
|
||||||
|
|
||||||
g_free (dir);
|
|
||||||
g_free (path);
|
|
||||||
g_free (contents);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
node_editor_window_init (NodeEditorWindow *self)
|
node_editor_window_init (NodeEditorWindow *self)
|
||||||
{
|
{
|
||||||
GAction *action;
|
|
||||||
|
|
||||||
gtk_widget_init_template (GTK_WIDGET (self));
|
gtk_widget_init_template (GTK_WIDGET (self));
|
||||||
|
|
||||||
self->auto_reload = TRUE;
|
|
||||||
|
|
||||||
self->renderers = g_list_store_new (GDK_TYPE_PAINTABLE);
|
self->renderers = g_list_store_new (GDK_TYPE_PAINTABLE);
|
||||||
gtk_list_box_bind_model (GTK_LIST_BOX (self->renderer_listbox),
|
gtk_list_box_bind_model (GTK_LIST_BOX (self->renderer_listbox),
|
||||||
G_LIST_MODEL (self->renderers),
|
G_LIST_MODEL (self->renderers),
|
||||||
@@ -1875,10 +1647,6 @@ node_editor_window_init (NodeEditorWindow *self)
|
|||||||
|
|
||||||
g_action_map_add_action_entries (G_ACTION_MAP (self), win_entries, G_N_ELEMENTS (win_entries), self);
|
g_action_map_add_action_entries (G_ACTION_MAP (self), win_entries, G_N_ELEMENTS (win_entries), self);
|
||||||
|
|
||||||
action = G_ACTION (g_property_action_new ("auto-reload", self, "auto-reload"));
|
|
||||||
g_action_map_add_action (G_ACTION_MAP (self), action);
|
|
||||||
g_object_unref (action);
|
|
||||||
|
|
||||||
self->tag_table = gtk_text_tag_table_new ();
|
self->tag_table = gtk_text_tag_table_new ();
|
||||||
gtk_text_tag_table_add (self->tag_table,
|
gtk_text_tag_table_add (self->tag_table,
|
||||||
g_object_new (GTK_TYPE_TEXT_TAG,
|
g_object_new (GTK_TYPE_TEXT_TAG,
|
||||||
@@ -1916,9 +1684,25 @@ node_editor_window_init (NodeEditorWindow *self)
|
|||||||
g_signal_connect (self->scale_scale, "notify::value", G_CALLBACK (scale_changed), self);
|
g_signal_connect (self->scale_scale, "notify::value", G_CALLBACK (scale_changed), self);
|
||||||
gtk_text_view_set_buffer (GTK_TEXT_VIEW (self->text_view), self->text_buffer);
|
gtk_text_view_set_buffer (GTK_TEXT_VIEW (self->text_view), self->text_buffer);
|
||||||
|
|
||||||
set_initial_text (self);
|
/* Default */
|
||||||
|
gtk_text_buffer_set_text (self->text_buffer,
|
||||||
g_signal_connect_swapped (self->text_buffer, "changed", G_CALLBACK (autosave_contents), self);
|
"shadow {\n"
|
||||||
|
" child: texture {\n"
|
||||||
|
" bounds: 0 0 128 128;\n"
|
||||||
|
" texture: url(\"resource:///org/gtk/gtk4/node-editor/icons/apps/org.gtk.gtk4.NodeEditor.svg\");\n"
|
||||||
|
" }\n"
|
||||||
|
" shadows: rgba(0,0,0,0.5) 0 1 12;\n"
|
||||||
|
"}\n"
|
||||||
|
"\n"
|
||||||
|
"transform {\n"
|
||||||
|
" child: text {\n"
|
||||||
|
" color: rgb(46,52,54);\n"
|
||||||
|
" font: \"Cantarell Bold 11\";\n"
|
||||||
|
" glyphs: \"GTK Node Editor\";\n"
|
||||||
|
" offset: 8 14.418;\n"
|
||||||
|
" }\n"
|
||||||
|
" transform: translate(0, 140);\n"
|
||||||
|
"}", -1);
|
||||||
|
|
||||||
if (g_getenv ("GSK_RENDERER"))
|
if (g_getenv ("GSK_RENDERER"))
|
||||||
{
|
{
|
||||||
|
@@ -37,5 +37,3 @@ NodeEditorWindow * node_editor_window_new (NodeEditorApplication
|
|||||||
|
|
||||||
gboolean node_editor_window_load (NodeEditorWindow *self,
|
gboolean node_editor_window_load (NodeEditorWindow *self,
|
||||||
GFile *file);
|
GFile *file);
|
||||||
|
|
||||||
char * get_autosave_path (const char *suffix);
|
|
||||||
|
@@ -2,10 +2,6 @@
|
|||||||
<interface>
|
<interface>
|
||||||
<menu id="gear_menu">
|
<menu id="gear_menu">
|
||||||
<section>
|
<section>
|
||||||
<item>
|
|
||||||
<attribute name="label" translatable="yes">_Reload automatically</attribute>
|
|
||||||
<attribute name="action">win.auto-reload</attribute>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<attribute name="label" translatable="yes">_Help</attribute>
|
<attribute name="label" translatable="yes">_Help</attribute>
|
||||||
<attribute name="action">app.help</attribute>
|
<attribute name="action">app.help</attribute>
|
||||||
@@ -28,6 +24,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</section>
|
</section>
|
||||||
</menu>
|
</menu>
|
||||||
|
|
||||||
<object class="GtkPopover" id="testcase_popover">
|
<object class="GtkPopover" id="testcase_popover">
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkGrid">
|
<object class="GtkGrid">
|
||||||
@@ -42,7 +39,7 @@
|
|||||||
<object class="GtkEntry" id="testcase_name_entry">
|
<object class="GtkEntry" id="testcase_name_entry">
|
||||||
<property name="hexpand">1</property>
|
<property name="hexpand">1</property>
|
||||||
<property name="activates-default">1</property>
|
<property name="activates-default">1</property>
|
||||||
<signal name="notify::text" handler="testcase_name_entry_changed_cb"/>
|
<signal name="notify::text" handler="testcase_name_entry_changed_cb" />
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
@@ -55,6 +52,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel">
|
<object class="GtkLabel">
|
||||||
<property name="wrap">1</property>
|
<property name="wrap">1</property>
|
||||||
@@ -68,6 +66,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="testcase_error_label">
|
<object class="GtkLabel" id="testcase_error_label">
|
||||||
<property name="wrap">1</property>
|
<property name="wrap">1</property>
|
||||||
@@ -79,6 +78,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="testcase_save_button">
|
<object class="GtkButton" id="testcase_save_button">
|
||||||
<property name="label">Save</property>
|
<property name="label">Save</property>
|
||||||
@@ -86,9 +86,9 @@
|
|||||||
<property name="halign">end</property>
|
<property name="halign">end</property>
|
||||||
<property name="receives-default">1</property>
|
<property name="receives-default">1</property>
|
||||||
<property name="sensitive">0</property>
|
<property name="sensitive">0</property>
|
||||||
<signal name="clicked" handler="testcase_save_clicked_cb"/>
|
<signal name="clicked" handler="testcase_save_clicked_cb" />
|
||||||
<style>
|
<style>
|
||||||
<class name="suggested-action"/>
|
<class name="suggested-action" />
|
||||||
</style>
|
</style>
|
||||||
<layout>
|
<layout>
|
||||||
<property name="row">4</property>
|
<property name="row">4</property>
|
||||||
@@ -100,6 +100,7 @@
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
|
||||||
<template class="NodeEditorWindow" parent="GtkApplicationWindow">
|
<template class="NodeEditorWindow" parent="GtkApplicationWindow">
|
||||||
<property name="title" translatable="yes">GTK Node Editor</property>
|
<property name="title" translatable="yes">GTK Node Editor</property>
|
||||||
<property name="default-width">1024</property>
|
<property name="default-width">1024</property>
|
||||||
@@ -184,129 +185,83 @@
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkOverlay">
|
<object class="GtkPaned">
|
||||||
<child type="overlay">
|
<property name="shrink-start-child">false</property>
|
||||||
<object class="GtkRevealer" id="crash_warning">
|
<property name="shrink-end-child">false</property>
|
||||||
<property name="transition-type">slide-down</property>
|
<property name="position">400</property>
|
||||||
<property name="halign">center</property>
|
<property name="start-child">
|
||||||
<property name="valign">start</property>
|
<object class="GtkScrolledWindow">
|
||||||
<property name="child">
|
<property name="hscrollbar-policy">never</property>
|
||||||
<object class="GtkFrame">
|
<property name="hexpand">1</property>
|
||||||
|
<property name="vexpand">1</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkTextView" id="text_view">
|
||||||
|
<property name="wrap-mode">word</property>
|
||||||
|
<property name="monospace">1</property>
|
||||||
|
<property name="top-margin">6</property>
|
||||||
|
<property name="left-margin">6</property>
|
||||||
|
<property name="right-margin">6</property>
|
||||||
|
<property name="bottom-margin">6</property>
|
||||||
|
<property name="has-tooltip">1</property>
|
||||||
|
<property name="extra-menu">extra_menu</property>
|
||||||
|
<signal name="query-tooltip" handler="text_view_query_tooltip_cb"/>
|
||||||
<style>
|
<style>
|
||||||
<class name="app-notification"/>
|
<class name="editor" />
|
||||||
</style>
|
</style>
|
||||||
<property name="child">
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkGestureClick">
|
||||||
<property name="orientation">vertical</property>
|
<property name="button">1</property>
|
||||||
<property name="spacing">20</property>
|
<signal name="pressed" handler="click_gesture_pressed"/>
|
||||||
<property name="margin-start">10</property>
|
|
||||||
<property name="margin-end">10</property>
|
|
||||||
<property name="margin-top">10</property>
|
|
||||||
<property name="margin-bottom">10</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkLabel">
|
|
||||||
<property name="hexpand">1</property>
|
|
||||||
<property name="halign">1</property>
|
|
||||||
<property name="label" translatable="1">The application may have crashed.
|
|
||||||
As a precaution, auto-loading has been turned off.
|
|
||||||
You can turn it back on in the menu.
|
|
||||||
</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkButton">
|
|
||||||
<property name="valign">3</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<property name="label" translatable="1">_Close</property>
|
|
||||||
<signal name="clicked" handler="close_crash_warning"/>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
</property>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</property>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</property>
|
||||||
<property name="child">
|
<property name="end-child">
|
||||||
<object class="GtkPaned">
|
<object class="GtkBox">
|
||||||
<property name="shrink-start-child">false</property>
|
<child>
|
||||||
<property name="shrink-end-child">false</property>
|
|
||||||
<property name="position">400</property>
|
|
||||||
<property name="start-child">
|
|
||||||
<object class="GtkScrolledWindow">
|
<object class="GtkScrolledWindow">
|
||||||
<property name="hscrollbar-policy">never</property>
|
|
||||||
<property name="hexpand">1</property>
|
<property name="hexpand">1</property>
|
||||||
<property name="vexpand">1</property>
|
<property name="vexpand">1</property>
|
||||||
|
<property name="min-content-height">100</property>
|
||||||
|
<property name="min-content-width">100</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkTextView" id="text_view">
|
<object class="GtkViewport">
|
||||||
<property name="wrap-mode">word</property>
|
|
||||||
<property name="monospace">1</property>
|
|
||||||
<property name="top-margin">6</property>
|
|
||||||
<property name="left-margin">6</property>
|
|
||||||
<property name="right-margin">6</property>
|
|
||||||
<property name="bottom-margin">6</property>
|
|
||||||
<property name="has-tooltip">1</property>
|
|
||||||
<property name="extra-menu">extra_menu</property>
|
|
||||||
<signal name="query-tooltip" handler="text_view_query_tooltip_cb"/>
|
|
||||||
<style>
|
|
||||||
<class name="editor"/>
|
|
||||||
</style>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkGestureClick">
|
<object class="GtkPicture" id="picture">
|
||||||
<property name="button">1</property>
|
<property name="can-shrink">0</property>
|
||||||
<signal name="pressed" handler="click_gesture_pressed"/>
|
<property name="halign">center</property>
|
||||||
</object>
|
<property name="valign">center</property>
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</property>
|
|
||||||
<property name="end-child">
|
|
||||||
<object class="GtkBox">
|
|
||||||
<child>
|
|
||||||
<object class="GtkScrolledWindow">
|
|
||||||
<property name="hexpand">1</property>
|
|
||||||
<property name="vexpand">1</property>
|
|
||||||
<property name="min-content-height">100</property>
|
|
||||||
<property name="min-content-width">100</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkViewport">
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkPicture" id="picture">
|
<object class="GtkDragSource">
|
||||||
<property name="can-shrink">0</property>
|
|
||||||
<property name="halign">center</property>
|
|
||||||
<property name="valign">center</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkDragSource">
|
|
||||||
<property name="actions">copy</property>
|
|
||||||
<signal name="prepare" handler="on_picture_drag_prepare_cb" swapped="no"/>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkDropTargetAsync">
|
|
||||||
<property name="actions">copy</property>
|
<property name="actions">copy</property>
|
||||||
<property name="formats">application/x-gtk-render-node</property>
|
<signal name="prepare" handler="on_picture_drag_prepare_cb" swapped="no"/>
|
||||||
<signal name="drop" handler="on_picture_drop_cb" swapped="no"/>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkScrolledWindow">
|
|
||||||
<property name="hscrollbar-policy">never</property>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkListBox" id="renderer_listbox">
|
<object class="GtkDropTargetAsync">
|
||||||
<property name="selection-mode">none</property>
|
<property name="actions">copy</property>
|
||||||
|
<property name="formats">application/x-gtk-render-node</property>
|
||||||
|
<signal name="drop" handler="on_picture_drop_cb" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</property>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkScrolledWindow">
|
||||||
|
<property name="hscrollbar-policy">never</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkListBox" id="renderer_listbox">
|
||||||
|
<property name="selection-mode">none</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</property>
|
</property>
|
||||||
</object>
|
</object>
|
||||||
|
@@ -322,44 +322,27 @@ stroke bounds of the path.
|
|||||||
|
|
||||||
### text
|
### text
|
||||||
|
|
||||||
| property | syntax | default | printed |
|
| property | syntax | default | printed |
|
||||||
| ------------ | ------------------- | ------------------- | ----------- |
|
| -------- | ---------------- | ---------------------- | ----------- |
|
||||||
| color | `<color>` | black | non-default |
|
| color | `<color>` | black | non-default |
|
||||||
| font | `<string>` `<url>`? | "Cantarell 15px" | always |
|
| font | `<string>` | "Cantarell 11" | always |
|
||||||
| glyphs | `<glyphs>` | "Hello" | always |
|
| glyphs | `<glyphs>` | "Hello" | always |
|
||||||
| offset | `<point>` | 0 0 | non-default |
|
| offset | `<point>` | 0 0 | non-default |
|
||||||
| hint-style | `<hint style>` | slight | non-default |
|
|
||||||
| antialias | `<antialias>` | gray | non-default |
|
|
||||||
|
|
||||||
Creates a node like `gsk_text_node_new()` with the given properties.
|
Creates a node like `gsk_text_node_new()` with the given properties.
|
||||||
|
|
||||||
If a url is specified for the font, it must point to a font file for the
|
|
||||||
font that is specified in the string. It can be either a data url containing
|
|
||||||
a base64-encoded font file, or a regular url that points to a font file.
|
|
||||||
|
|
||||||
Glyphs can be specified as an ASCII string, or as a comma-separated list of
|
|
||||||
their glyph IDs. Optionally, the advance width, x and y offsets and flags can
|
|
||||||
be specified as well, like this: 40 10 0 0 color.
|
|
||||||
|
|
||||||
If the given font does not exist or the given glyphs are invalid for the given
|
If the given font does not exist or the given glyphs are invalid for the given
|
||||||
font, an error node will be returned.
|
font, an error node will be returned.
|
||||||
|
|
||||||
Possible values for hint-style are none, slight or full.
|
|
||||||
Possible value for antialias are none or gray.
|
|
||||||
|
|
||||||
### texture
|
### texture
|
||||||
|
|
||||||
| property | syntax | default | printed |
|
| property | syntax | default | printed |
|
||||||
| -------- | ------------------- | ---------------------- | ----------- |
|
| -------- | ---------------- | ---------------------- | ----------- |
|
||||||
| bounds | `<rect>` | 50 | always |
|
| bounds | `<rect>` | 50 | always |
|
||||||
| texture | `<string>`?`<url>`? | *see below* | always |
|
| texture | `<url>` | *see below* | always |
|
||||||
|
|
||||||
Creates a node like `gsk_texture_node_new()` with the given properties.
|
Creates a node like `gsk_texture_node_new()` with the given properties.
|
||||||
|
|
||||||
If a string is specified for the texture, it will be used as a name for the text.
|
|
||||||
Textures can be reused by specifying the name of a previously used texture. In
|
|
||||||
that case, the url can be omitted.
|
|
||||||
|
|
||||||
The default texture is a 10x10 checkerboard with the top left and bottom right
|
The default texture is a 10x10 checkerboard with the top left and bottom right
|
||||||
5x5 being in the color #FF00CC and the other part being transparent. A possible
|
5x5 being in the color #FF00CC and the other part being transparent. A possible
|
||||||
representation for this texture is `url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABmJLR0QA/wD/AP+gvaeTAAAAKUlEQVQYlWP8z3DmPwMaYGQwYUQXY0IXwAUGUCGGoxkYGBiweXAoeAYAz44F3e3U1xUAAAAASUVORK5CYII=")
|
representation for this texture is `url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABmJLR0QA/wD/AP+gvaeTAAAAKUlEQVQYlWP8z3DmPwMaYGQwYUQXY0IXwAUGUCGGoxkYGBiweXAoeAYAz44F3e3U1xUAAAAASUVORK5CYII=")
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
executable('gtk4-print-editor',
|
executable('gtk4-print-editor',
|
||||||
sources: ['print-editor.c'],
|
sources: ['print-editor.c'],
|
||||||
c_args: common_cflags,
|
c_args: common_cflags,
|
||||||
dependencies: [ libgtk_dep, profile_conf_h ],
|
dependencies: [ libgtk_dep, demo_conf_h ],
|
||||||
include_directories: confinc,
|
include_directories: confinc,
|
||||||
win_subsystem: 'windows',
|
win_subsystem: 'windows',
|
||||||
link_args: extra_demo_ldflags,
|
link_args: extra_demo_ldflags,
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include "profile_conf.h"
|
#include "demo_conf.h"
|
||||||
|
|
||||||
static GtkWidget *main_window;
|
static GtkWidget *main_window;
|
||||||
static GFile *filename = NULL;
|
static GFile *filename = NULL;
|
||||||
|
@@ -66,7 +66,7 @@ endif
|
|||||||
executable('gtk4-widget-factory',
|
executable('gtk4-widget-factory',
|
||||||
sources: ['widget-factory.c', widgetfactory_resources],
|
sources: ['widget-factory.c', widgetfactory_resources],
|
||||||
c_args: common_cflags,
|
c_args: common_cflags,
|
||||||
dependencies: [ libgtk_dep, profile_conf_h ],
|
dependencies: [ libgtk_dep, demo_conf_h ],
|
||||||
include_directories: confinc,
|
include_directories: confinc,
|
||||||
win_subsystem: 'windows',
|
win_subsystem: 'windows',
|
||||||
link_args: extra_demo_ldflags,
|
link_args: extra_demo_ldflags,
|
||||||
|
@@ -25,7 +25,7 @@
|
|||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include "profile_conf.h"
|
#include "demo_conf.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
change_dark_state (GSimpleAction *action,
|
change_dark_state (GSimpleAction *action,
|
||||||
|
@@ -69,9 +69,9 @@ Image:
|
|||||||
4 CARD32 IMAGE_DATA_OFFSET
|
4 CARD32 IMAGE_DATA_OFFSET
|
||||||
|
|
||||||
ICON_FLAGS
|
ICON_FLAGS
|
||||||
HAS_SUFFIX_XPM 1
|
HAS_SUFFIX_PNG 1
|
||||||
HAS_SUFFIX_SVG 2
|
HAS_SUFFIX_XPM 2
|
||||||
HAS_SUFFIX_PNG 4
|
HAS_SUFFIX_SVG 4
|
||||||
HAS_ICON_FILE 8
|
HAS_ICON_FILE 8
|
||||||
|
|
||||||
ImageData:
|
ImageData:
|
||||||
|
@@ -5,11 +5,8 @@ Title: Cairo interaction
|
|||||||
[Cairo](http://cairographics.org) is a graphics library that supports vector
|
[Cairo](http://cairographics.org) is a graphics library that supports vector
|
||||||
graphics and image compositing that can be used with GTK.
|
graphics and image compositing that can be used with GTK.
|
||||||
|
|
||||||
GDK does not wrap the Cairo API and it is not possible to use cairo directly
|
GDK does not wrap the Cairo API; instead it allows to create Cairo
|
||||||
to draw on a [class@Gdk.Surface]. You can either use a
|
drawing contexts which can be used to draw on [class@Gdk.Surface]s.
|
||||||
[GtkDrawingArea](../gtk4/class.DrawingArea.html) widget or
|
|
||||||
[gtk_snapshot_append_cairo](../gtk4/func.Snapshot.append_cairo.html)
|
|
||||||
for drawing with cairo in a GTK4 application.
|
|
||||||
|
|
||||||
Additional functions allow use [struct@Gdk.Rectangle]s with Cairo
|
Additional functions allow use [struct@Gdk.Rectangle]s with Cairo
|
||||||
and to use [struct@Gdk.RGBA], `GdkPixbuf`, and [class@Gdk.Surface]
|
and to use [struct@Gdk.RGBA], `GdkPixbuf`, and [class@Gdk.Surface]
|
||||||
|
@@ -25,8 +25,6 @@ base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/"
|
|||||||
|
|
||||||
[extra]
|
[extra]
|
||||||
content_images = [
|
content_images = [
|
||||||
"../images/favicon.svg",
|
|
||||||
"../images/favicon-192x192.png",
|
|
||||||
"images/gtk-logo.svg",
|
"images/gtk-logo.svg",
|
||||||
]
|
]
|
||||||
urlmap_file = "urlmap.js"
|
urlmap_file = "urlmap.js"
|
||||||
|
@@ -24,8 +24,6 @@ base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/"
|
|||||||
|
|
||||||
[extra]
|
[extra]
|
||||||
content_images = [
|
content_images = [
|
||||||
"../images/favicon.svg",
|
|
||||||
"../images/favicon-192x192.png",
|
|
||||||
"images/gtk-logo.svg",
|
"images/gtk-logo.svg",
|
||||||
]
|
]
|
||||||
urlmap_file = "urlmap.js"
|
urlmap_file = "urlmap.js"
|
||||||
|
@@ -67,8 +67,6 @@ content_files = [
|
|||||||
"macos.md",
|
"macos.md",
|
||||||
]
|
]
|
||||||
content_images = [
|
content_images = [
|
||||||
"../images/favicon.svg",
|
|
||||||
"../images/favicon-192x192.png",
|
|
||||||
"images/gtk-logo.svg",
|
"images/gtk-logo.svg",
|
||||||
"images/rotated-text.png",
|
"images/rotated-text.png",
|
||||||
"images/default_cursor.png",
|
"images/default_cursor.png",
|
||||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
@@ -36,8 +36,6 @@ content_files = [
|
|||||||
"paths.md",
|
"paths.md",
|
||||||
]
|
]
|
||||||
content_images = [
|
content_images = [
|
||||||
"../images/favicon.svg",
|
|
||||||
"../images/favicon-192x192.png",
|
|
||||||
"gtk-logo.svg",
|
"gtk-logo.svg",
|
||||||
"images/arc-dark.png",
|
"images/arc-dark.png",
|
||||||
"images/arc-light.png",
|
"images/arc-light.png",
|
||||||
|
@@ -38,13 +38,13 @@ can run the build, using Ninja:
|
|||||||
|
|
||||||
```
|
```
|
||||||
cd builddir
|
cd builddir
|
||||||
meson compile
|
ninja
|
||||||
meson install
|
ninja install
|
||||||
```
|
```
|
||||||
|
|
||||||
If you don't have permission to write to the directory you are
|
If you don't have permission to write to the directory you are
|
||||||
installing in, you may have to change to root temporarily before
|
installing in, you may have to change to root temporarily before
|
||||||
running `meson install`.
|
running `ninja install`.
|
||||||
|
|
||||||
Several environment variables are useful to pass to set before
|
Several environment variables are useful to pass to set before
|
||||||
running *meson*. `CPPFLAGS` contains options to pass to the C
|
running *meson*. `CPPFLAGS` contains options to pass to the C
|
||||||
@@ -112,10 +112,10 @@ responsible for controlling the debugging features of GTK with
|
|||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
Before you can compile GTK, you need to have various other tools and
|
Before you can compile the GTK widget toolkit, you need to have
|
||||||
libraries installed on your system. Dependencies of GTK have their own
|
various other tools and libraries installed on your
|
||||||
build systems, so you will need to refer to their own installation
|
system. Dependencies of GTK have their own build systems, so
|
||||||
instructions.
|
you will need to refer to their own installation instructions.
|
||||||
|
|
||||||
A particular important tool used by GTK to find its dependencies
|
A particular important tool used by GTK to find its dependencies
|
||||||
is `pkg-config`.
|
is `pkg-config`.
|
||||||
@@ -156,8 +156,8 @@ Other libraries are maintained separately.
|
|||||||
the development environment for these libraries that your
|
the development environment for these libraries that your
|
||||||
operating system vendor provides.
|
operating system vendor provides.
|
||||||
- The [fontconfig](https://www.freedesktop.org/wiki/Software/fontconfig/)
|
- The [fontconfig](https://www.freedesktop.org/wiki/Software/fontconfig/)
|
||||||
library provides Pango with a standard way of locating fonts and matching
|
library provides Pango with a standard way of locating
|
||||||
them against font names.
|
fonts and matching them against font names.
|
||||||
- [Cairo](https://www.cairographics.org) is a graphics library that
|
- [Cairo](https://www.cairographics.org) is a graphics library that
|
||||||
supports vector graphics and image compositing. Both Pango and GTK
|
supports vector graphics and image compositing. Both Pango and GTK
|
||||||
use Cairo for drawing. Note that we also need the auxiliary cairo-gobject
|
use Cairo for drawing. Note that we also need the auxiliary cairo-gobject
|
||||||
@@ -220,12 +220,13 @@ meson configure builddir
|
|||||||
|
|
||||||
### `x11-backend`, `win32-backend`, `broadway-backend`, `wayland-backend` and `macos-backend`
|
### `x11-backend`, `win32-backend`, `broadway-backend`, `wayland-backend` and `macos-backend`
|
||||||
|
|
||||||
Enable specific backends for GDK. If none of these options are given, the
|
Enable specific backends for GDK. If none of these options
|
||||||
Wayland backend will be enabled by default, if the platform is Linux; the
|
are given, the Wayland backend will be enabled by default,
|
||||||
X11 backend will also be enabled by default, unless the platform is Windows,
|
if the platform is Linux; the X11 backend will also be enabled
|
||||||
in which case the default is win32, or the platform is macOS, in which case
|
by default, unless the platform is Windows, in which case the
|
||||||
the default is macOS. If any backend is explicitly enabled or disabled, no
|
default is win32, or the platform is macOS, in which case the
|
||||||
other platform will be enabled automatically.
|
default is macOS. If any backend is explicitly enabled or disabled,
|
||||||
|
no other platform will be enabled automatically.
|
||||||
|
|
||||||
### `vulkan`
|
### `vulkan`
|
||||||
|
|
||||||
@@ -233,7 +234,7 @@ By default, GTK will try to build with support for the Vulkan graphics
|
|||||||
API in addition to cairo and OpenGL. This option can be used to explicitly
|
API in addition to cairo and OpenGL. This option can be used to explicitly
|
||||||
control whether Vulkan should be used.
|
control whether Vulkan should be used.
|
||||||
|
|
||||||
### `media-gstreamer`
|
### `media-gstreamer` and `media-ffmpeg`
|
||||||
|
|
||||||
By default, GTK will try to build the gstreamer backend for
|
By default, GTK will try to build the gstreamer backend for
|
||||||
media playback support. These options can be used to explicitly
|
media playback support. These options can be used to explicitly
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
Title: CSS in GTK
|
Title: CSS in GTK
|
||||||
Slug: css
|
Slug: css
|
||||||
|
|
||||||
This chapter describes how GTK uses CSS for styling and layout.
|
This chapter describes how GTK uses CSS for styling and layout.
|
||||||
It is not meant to be an explanation of CSS from first principles,
|
It is not meant to be an explanation of CSS from first principles,
|
||||||
but focuses on listing supported CSS features and differences
|
but focuses on listing supported CSS features and differences
|
||||||
between Web CSS and GTK.
|
between Web CSS and GTK.
|
||||||
@@ -74,7 +74,6 @@ in a selector, widget names must be prefixed with a # character.
|
|||||||
| E:not(selector) | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#negation) | |
|
| E:not(selector) | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#negation) | |
|
||||||
| E:dir(ltr), E:dir(rtl) | [CSS Selector Level 4](https://drafts.csswg.org/selectors/#the-dir-pseudo) | |
|
| E:dir(ltr), E:dir(rtl) | [CSS Selector Level 4](https://drafts.csswg.org/selectors/#the-dir-pseudo) | |
|
||||||
| E:drop(active) | [CSS Selector Level 4](https://drafts.csswg.org/selectors/#drag-pseudos) | |
|
| E:drop(active) | [CSS Selector Level 4](https://drafts.csswg.org/selectors/#drag-pseudos) | |
|
||||||
| E:root | [CSS Selector Level 3](https://www.w3.org/TR/selectors-3/#root-pseudo) | |
|
|
||||||
| E F | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#descendent-combinators) | |
|
| E F | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#descendent-combinators) | |
|
||||||
| E > F | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#child-combinators) | |
|
| E > F | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#child-combinators) | |
|
||||||
| E ~ F | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#general-sibling-combinators) | |
|
| E ~ F | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#general-sibling-combinators) | |
|
||||||
|
@@ -8,10 +8,6 @@ gtk4-broadwayd
|
|||||||
The Broadway display server
|
The Broadway display server
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
:Version: GTK
|
|
||||||
:Manual section: 1
|
|
||||||
:Manual group: GTK commands
|
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
| **gtk4-broadwayd** [OPTIONS...] <DISPLAY>
|
| **gtk4-broadwayd** [OPTIONS...] <DISPLAY>
|
||||||
|
@@ -8,10 +8,6 @@ gtk4-builder-tool
|
|||||||
GtkBuilder File Utility
|
GtkBuilder File Utility
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
:Version: GTK
|
|
||||||
:Manual section: 1
|
|
||||||
:Manual group: GTK commands
|
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
| **gtk4-builder-tool** <COMMAND> [OPTIONS...] <FILE>
|
| **gtk4-builder-tool** <COMMAND> [OPTIONS...] <FILE>
|
||||||
|
@@ -8,9 +8,6 @@ gtk4-demo-application
|
|||||||
Demonstrate GtkApplication
|
Demonstrate GtkApplication
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
:Version: GTK
|
|
||||||
:Manual section: 1
|
|
||||||
:Manual group: GTK commands
|
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
|
@@ -8,10 +8,6 @@ gtk4-demo
|
|||||||
Demonstrate GTK widgets
|
Demonstrate GTK widgets
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
:Version: GTK
|
|
||||||
:Manual section: 1
|
|
||||||
:Manual group: GTK commands
|
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
@@ -8,10 +8,6 @@ gtk4-encode-symbolic-svg
|
|||||||
Symbolic icon conversion utility
|
Symbolic icon conversion utility
|
||||||
--------------------------------
|
--------------------------------
|
||||||
|
|
||||||
:Version: GTK
|
|
||||||
:Manual section: 1
|
|
||||||
:Manual group: GTK commands
|
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
@@ -8,10 +8,6 @@ gtk4-icon-browser
|
|||||||
List themed icons
|
List themed icons
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
:Version: GTK
|
|
||||||
:Manual section: 1
|
|
||||||
:Manual group: GTK commands
|
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
@@ -8,10 +8,6 @@ gtk4-launch
|
|||||||
Launch an application
|
Launch an application
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
:Version: GTK
|
|
||||||
:Manual section: 1
|
|
||||||
:Manual group: GTK commands
|
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
@@ -8,10 +8,6 @@ gtk4-node-editor
|
|||||||
Editor render nodes
|
Editor render nodes
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
:Version: GTK
|
|
||||||
:Manual section: 1
|
|
||||||
:Manual group: GTK commands
|
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
|
|
||||||
@@ -34,14 +30,6 @@ OPTIONS
|
|||||||
|
|
||||||
Show the application help.
|
Show the application help.
|
||||||
|
|
||||||
``--version``
|
|
||||||
|
|
||||||
Show the program version.
|
|
||||||
|
|
||||||
``--reset``
|
|
||||||
|
|
||||||
Don't restore autosaved content and remove autosave files.
|
|
||||||
|
|
||||||
ENVIRONMENT
|
ENVIRONMENT
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
|
@@ -8,10 +8,6 @@ gtk4-path-tool
|
|||||||
GskPath Utility
|
GskPath Utility
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
:Version: GTK
|
|
||||||
:Manual section: 1
|
|
||||||
:Manual group: GTK commands
|
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
| **gtk4-path-tool** <COMMAND> [OPTIONS...] <PATH>
|
| **gtk4-path-tool** <COMMAND> [OPTIONS...] <PATH>
|
||||||
|
@@ -8,10 +8,6 @@ gtk4-query-settings
|
|||||||
Print name and value of GTK settings
|
Print name and value of GTK settings
|
||||||
------------------------------------
|
------------------------------------
|
||||||
|
|
||||||
:Version: GTK
|
|
||||||
:Manual section: 1
|
|
||||||
:Manual group: GTK commands
|
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
@@ -8,19 +8,13 @@ gtk4-rendernode-tool
|
|||||||
GskRenderNode Utility
|
GskRenderNode Utility
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
:Version: GTK
|
|
||||||
:Manual section: 1
|
|
||||||
:Manual group: GTK commands
|
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
| **gtk4-rendernode-tool** <COMMAND> [OPTIONS...] <FILE>
|
| **gtk4-rendernode-tool** <COMMAND> [OPTIONS...] <FILE>
|
||||||
|
|
|
|
||||||
| **gtk4-rendernode-tool** benchmark [OPTIONS...] <FILE>
|
|
||||||
| **gtk4-rendernode-tool** compare [OPTIONS...] <FILE1> <FILE2>
|
|
||||||
| **gtk4-rendernode-tool** info [OPTIONS...] <FILE>
|
| **gtk4-rendernode-tool** info [OPTIONS...] <FILE>
|
||||||
| **gtk4-rendernode-tool** render [OPTIONS...] <FILE> [<FILE>]
|
|
||||||
| **gtk4-rendernode-tool** show [OPTIONS...] <FILE>
|
| **gtk4-rendernode-tool** show [OPTIONS...] <FILE>
|
||||||
|
| **gtk4-rendernode-tool** render [OPTIONS...] <FILE> [<FILE>]
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
-----------
|
-----------
|
||||||
@@ -49,53 +43,10 @@ without any titlebar.
|
|||||||
Rendering
|
Rendering
|
||||||
^^^^^^^^^
|
^^^^^^^^^
|
||||||
|
|
||||||
The ``render`` command saves a rendering of the rendernode as a png, tiff or svg
|
The ``render`` command saves a rendering of the rendernode as a png or tiff image.
|
||||||
image or as pdf document. The name of the file to write can be specified as a second
|
The name of the file to write can be specified as a second FILE argument.
|
||||||
FILE argument.
|
|
||||||
|
|
||||||
``--renderer=RENDERER``
|
``--renderer=RENDERER``
|
||||||
|
|
||||||
Use the given renderer. Use ``--renderer=help`` to get a information
|
Use the given renderer. Use ``--renderer=help`` to get a information
|
||||||
about possible values for the ``RENDERER``.
|
about poassible values for the ``RENDERER``.
|
||||||
|
|
||||||
Benchmark
|
|
||||||
^^^^^^^^^
|
|
||||||
|
|
||||||
The ``benchmark`` command benchmarks rendering of a node with the existing renderers
|
|
||||||
and prints the runtimes.
|
|
||||||
|
|
||||||
``--renderer=RENDERER``
|
|
||||||
|
|
||||||
Add the given renderer. This argument can be passed multiple times to test multiple
|
|
||||||
renderers. By default, all major GTK renderers are run.
|
|
||||||
|
|
||||||
``--runs=RUNS``
|
|
||||||
|
|
||||||
Number of times to render the node on each renderer. By default, this is 3 times.
|
|
||||||
Keep in mind that the first run is often used to populate caches and might be
|
|
||||||
significantly slower.
|
|
||||||
|
|
||||||
``--no-download``
|
|
||||||
|
|
||||||
Do not attempt to download the result. This may cause the measurement to not include
|
|
||||||
the execution of the commands on the GPU. It can be useful to use this flag to test
|
|
||||||
command submission performance.
|
|
||||||
|
|
||||||
Compare
|
|
||||||
^^^^^^^
|
|
||||||
|
|
||||||
The ``compare`` command compares the rendering of a node with a reference image,
|
|
||||||
or the renderings of two nodes, or two images. If any differences are found, the
|
|
||||||
exit code is 1. If the images are identical, it is 0.
|
|
||||||
|
|
||||||
``--renderer=RENDERER``
|
|
||||||
|
|
||||||
Use the given renderer.
|
|
||||||
|
|
||||||
``--output=FILE``
|
|
||||||
|
|
||||||
Save the differences as a png image in ``FILE``.
|
|
||||||
|
|
||||||
``--quiet``
|
|
||||||
|
|
||||||
Don't write results to stdout.
|
|
||||||
|
@@ -8,10 +8,6 @@ gtk4-update-icon-cache
|
|||||||
Icon theme caching utility
|
Icon theme caching utility
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
:Version: GTK
|
|
||||||
:Manual section: 1
|
|
||||||
:Manual group: GTK commands
|
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
@@ -8,10 +8,6 @@ gtk4-widget-factory
|
|||||||
Showcase GTK widgets and styles
|
Showcase GTK widgets and styles
|
||||||
-------------------------------
|
-------------------------------
|
||||||
|
|
||||||
:Version: GTK
|
|
||||||
:Manual section: 1
|
|
||||||
:Manual group: GTK commands
|
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
@@ -85,8 +85,6 @@ content_files = [
|
|||||||
"visual_index.md",
|
"visual_index.md",
|
||||||
]
|
]
|
||||||
content_images = [
|
content_images = [
|
||||||
"../images/favicon.svg",
|
|
||||||
"../images/favicon-192x192.png",
|
|
||||||
"images/aboutdialog.png",
|
"images/aboutdialog.png",
|
||||||
"images/action-bar.png",
|
"images/action-bar.png",
|
||||||
"images/appchooserbutton.png",
|
"images/appchooserbutton.png",
|
||||||
|
@@ -80,7 +80,7 @@ if get_option('man-pages') and rst2man.found()
|
|||||||
[ 'gtk4-path-tool', '1', ],
|
[ 'gtk4-path-tool', '1', ],
|
||||||
]
|
]
|
||||||
|
|
||||||
if get_option('build-demos')
|
if get_option('demos')
|
||||||
rst_files += [
|
rst_files += [
|
||||||
[ 'gtk4-demo', '1', ],
|
[ 'gtk4-demo', '1', ],
|
||||||
[ 'gtk4-demo-application', '1', ],
|
[ 'gtk4-demo-application', '1', ],
|
||||||
|
@@ -28,9 +28,6 @@ GTK depends on the following libraries:
|
|||||||
- **OpenGL**: OpenGL is the premier environment for developing portable,
|
- **OpenGL**: OpenGL is the premier environment for developing portable,
|
||||||
interactive 2D and 3D graphics applications. More information available
|
interactive 2D and 3D graphics applications. More information available
|
||||||
on the [Khronos website][opengl].
|
on the [Khronos website][opengl].
|
||||||
- **Vulkan**: Vulkan is the a newer graphics API, that can be considered
|
|
||||||
the successor of OpenGL. More information available on the
|
|
||||||
[Khronos website][vulkan].
|
|
||||||
- **Pango**: Pango is a library for internationalized text handling. It
|
- **Pango**: Pango is a library for internationalized text handling. It
|
||||||
centers around the `PangoLayout` object, representing a paragraph of
|
centers around the `PangoLayout` object, representing a paragraph of
|
||||||
text. Pango provides the engine for `GtkTextView`, `GtkLabel`,
|
text. Pango provides the engine for `GtkTextView`, `GtkLabel`,
|
||||||
@@ -58,12 +55,11 @@ GTK is divided into three parts:
|
|||||||
storage types for efficient use in GUI applications, and much more.
|
storage types for efficient use in GUI applications, and much more.
|
||||||
|
|
||||||
[gnu-lgpl]: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
|
[gnu-lgpl]: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
|
||||||
[glib]: https://docs.gtk.org/glib/
|
[glib]: https://developer.gnome.org/glib/stable/
|
||||||
[gobject]: https://docs.gtk.org/gobject/
|
[gobject]: https://developer.gnome.org/gobject/stable/
|
||||||
[gio]: https://docs.gtk.org/gio/
|
[gio]: https://developer.gnome.org/gio/stable/
|
||||||
[cairo]: https://www.cairographics.org/manual/
|
[cairo]: https://www.cairographics.org/manual/
|
||||||
[opengl]: https://www.opengl.org/about/
|
[opengl]: https://www.opengl.org/about/
|
||||||
[vulkan]: https://www.vulkan.org/
|
[pango]: https://pango.gnome.org/
|
||||||
[pango]: https://docs.gtk.org/pango/
|
[gdkpixbuf]: https://developer.gnome.org/gdk-pixbuf/stable/
|
||||||
[gdkpixbuf]: https://docs.gtk.org/gdk-pixbuf/
|
|
||||||
[graphene]: https://ebassi.github.io/graphene/
|
[graphene]: https://ebassi.github.io/graphene/
|
||||||
|
@@ -27,7 +27,7 @@ the question you have, this list is a good place to start.
|
|||||||
Every major version of GTK comes with a [migration guide](#migrating). You may also
|
Every major version of GTK comes with a [migration guide](#migrating). You may also
|
||||||
find useful information in the documentation for specific widgets and functions. If
|
find useful information in the documentation for specific widgets and functions. If
|
||||||
you have a question not covered in the manual, feel free to ask, and please
|
you have a question not covered in the manual, feel free to ask, and please
|
||||||
[file a bug report](https://gitlab.gnome.org/GNOME/gtk/issues/) against the
|
[file a bug report](https://gitlab.gnome.org/GNOME/gtk/issues/new) against the
|
||||||
documentation.
|
documentation.
|
||||||
|
|
||||||
* Should I maintain parallel versions of my UI in GTK x and GTK y?
|
* Should I maintain parallel versions of my UI in GTK x and GTK y?
|
||||||
@@ -54,7 +54,7 @@ the question you have, this list is a good place to start.
|
|||||||
For strings returned from functions, they will be declared "const" if they should
|
For strings returned from functions, they will be declared "const" if they should
|
||||||
not be freed. Non-const strings should be freed with `g_free()`. Arrays follow the
|
not be freed. Non-const strings should be freed with `g_free()`. Arrays follow the
|
||||||
same rule. If you find an undocumented exception to the rules, please
|
same rule. If you find an undocumented exception to the rules, please
|
||||||
[file a bug report.](https://gitlab.gnome.org/GNOME/gtk/issues/).
|
[file a bug report.](https://gitlab.gnome.org/GNOME/gtk/issues/new).
|
||||||
|
|
||||||
The transfer annotations for gobject-introspection that are part of the
|
The transfer annotations for gobject-introspection that are part of the
|
||||||
documentation can provide useful hints for memory handling semantics as well.
|
documentation can provide useful hints for memory handling semantics as well.
|
||||||
|
@@ -4,7 +4,7 @@ Slug: gtk-resources
|
|||||||
## Opening a bug or feature request
|
## Opening a bug or feature request
|
||||||
|
|
||||||
If you encounter a bug, misfeature, or missing feature in GTK, please
|
If you encounter a bug, misfeature, or missing feature in GTK, please
|
||||||
file a bug report on our [GitLab project](https://gitlab.gnome.org/GNOME/gtk/issues/).
|
file a bug report on our [GitLab project](https://gitlab.gnome.org/GNOME/gtk/issues/new).
|
||||||
You should also file issues if the documentation is out of date with the
|
You should also file issues if the documentation is out of date with the
|
||||||
existing API, or unclear.
|
existing API, or unclear.
|
||||||
|
|
||||||
|
@@ -126,8 +126,8 @@ available on the system.
|
|||||||
### `GTK_MEDIA`
|
### `GTK_MEDIA`
|
||||||
|
|
||||||
Specifies what backend to load for [class@Gtk.MediaFile]. The possible values
|
Specifies what backend to load for [class@Gtk.MediaFile]. The possible values
|
||||||
depend on what options GTK was built with, and can include 'gstreamer'
|
depend on what options GTK was built with, and can include 'gstreamer',
|
||||||
and 'none'. If set to 'none', media playback will be unavailable.
|
'ffmpeg' and 'none'. If set to 'none', media playback will be unavailable.
|
||||||
The special value 'help' can be used to obtain a list of all supported
|
The special value 'help' can be used to obtain a list of all supported
|
||||||
media backends.
|
media backends.
|
||||||
|
|
||||||
@@ -217,15 +217,11 @@ A number of options affect behavior instead of logging:
|
|||||||
`no-portals`
|
`no-portals`
|
||||||
: Disable use of [portals](https://docs.flatpak.org/en/latest/portals.html)
|
: Disable use of [portals](https://docs.flatpak.org/en/latest/portals.html)
|
||||||
|
|
||||||
`force-offload`
|
|
||||||
: Force graphics offload for all textures, even when slower. This allows
|
|
||||||
to debug offloading in the absence of dmabufs.
|
|
||||||
|
|
||||||
`gl-disable`
|
`gl-disable`
|
||||||
: Disable OpenGL support
|
: Disable OpenGL support
|
||||||
|
|
||||||
`gl-no-fractional`
|
`gl-fractional`
|
||||||
: Disable fractional scaling for OpenGL.
|
: Enable fractional scaling for OpenGL. This is experimental
|
||||||
|
|
||||||
`gl-debug`
|
`gl-debug`
|
||||||
: Insert debugging information in OpenGL
|
: Insert debugging information in OpenGL
|
||||||
@@ -282,11 +278,14 @@ are only available when GTK has been configured with `-Ddebug=true`.
|
|||||||
: OpenGL renderer information
|
: OpenGL renderer information
|
||||||
|
|
||||||
`vulkan`
|
`vulkan`
|
||||||
: Check Vulkan errors
|
: Vulkan renderer information
|
||||||
|
|
||||||
`shaders`
|
`shaders`
|
||||||
: Information about shaders
|
: Information about shaders
|
||||||
|
|
||||||
|
`surface`
|
||||||
|
: Information about surfaces
|
||||||
|
|
||||||
`fallback`
|
`fallback`
|
||||||
: Information about fallback usage in renderers
|
: Information about fallback usage in renderers
|
||||||
|
|
||||||
@@ -304,6 +303,9 @@ A number of options affect behavior instead of logging:
|
|||||||
`full-redraw`
|
`full-redraw`
|
||||||
: Force full redraws
|
: Force full redraws
|
||||||
|
|
||||||
|
`sync`
|
||||||
|
: Sync after each frame
|
||||||
|
|
||||||
`staging`
|
`staging`
|
||||||
: Use a staging image for texture upload (Vulkan only)
|
: Use a staging image for texture upload (Vulkan only)
|
||||||
|
|
||||||
@@ -345,28 +347,6 @@ a `*`, which means: try all remaining backends. The special value
|
|||||||
backends. For more information about selecting backends,
|
backends. For more information about selecting backends,
|
||||||
see the [func@Gdk.DisplayManager.get] function.
|
see the [func@Gdk.DisplayManager.get] function.
|
||||||
|
|
||||||
### `GDK_GL_DISABLE`
|
|
||||||
|
|
||||||
This variable can be set to a list of values, which cause GDK to
|
|
||||||
disable extension features of the OpenGL support.
|
|
||||||
Note that these features may already be disabled if the GL driver
|
|
||||||
does not support them.
|
|
||||||
|
|
||||||
`debug`
|
|
||||||
: GL_KHR_debug
|
|
||||||
|
|
||||||
`unpack-subimage`
|
|
||||||
:GL_EXT_unpack_subimage
|
|
||||||
|
|
||||||
`half-float`
|
|
||||||
:GL_OES_vertex_half_float
|
|
||||||
|
|
||||||
`sync`
|
|
||||||
:GL_ARB_sync
|
|
||||||
|
|
||||||
`base-instance`
|
|
||||||
:GL_EXT_base_instance
|
|
||||||
|
|
||||||
### `GDK_VULKAN_DEVICE`
|
### `GDK_VULKAN_DEVICE`
|
||||||
|
|
||||||
This variable can be set to the index of a Vulkan device to override
|
This variable can be set to the index of a Vulkan device to override
|
||||||
@@ -374,10 +354,10 @@ the default selection of the device that is used for Vulkan rendering.
|
|||||||
The special value `list` can be used to obtain a list of all Vulkan
|
The special value `list` can be used to obtain a list of all Vulkan
|
||||||
devices.
|
devices.
|
||||||
|
|
||||||
### `GDK_VULKAN_DISABLE`
|
### `GDK_VULKAN_SKIP`
|
||||||
|
|
||||||
This variable can be set to a list of values, which cause GDK to
|
This variable can be set to a list of values, which cause GDK to
|
||||||
disable features of the Vulkan support.
|
disable features of the Vulkan support.
|
||||||
Note that these features may already be disabled if the Vulkan driver
|
Note that these features may already be disabled if the Vulkan driver
|
||||||
does not support them.
|
does not support them.
|
||||||
|
|
||||||
@@ -435,26 +415,21 @@ using and the GDK backend supports them:
|
|||||||
`vulkan`
|
`vulkan`
|
||||||
: Selects the Vulkan renderer
|
: 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.
|
||||||
|
|
||||||
::: note
|
This is a known issue, as the above link indicates, and affects quite
|
||||||
If you are running the Nahimic 3 service on a Windows system with
|
a number of applications--sadly, since this issue lies within the
|
||||||
nVidia graphics, you need to perform one of the following:
|
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.
|
||||||
|
|
||||||
- stop the "Nahimic service"
|
### `GSK_GPU_SKIP`
|
||||||
- insert the GTK application into the Nahimic blocklist, as noted in the
|
|
||||||
[nVidia forums](https://www.nvidia.com/en-us/geforce/forums/game-ready-drivers/13/297952/nahimic-and-nvidia-drivers-conflict/2334568/)
|
|
||||||
- use the cairo renderer (at the cost of being unable to use OpenGL features)
|
|
||||||
- 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.
|
|
||||||
|
|
||||||
|
|
||||||
### `GSK_GPU_DISABLE`
|
|
||||||
|
|
||||||
This variable can be set to a list of values, which cause GSK to
|
This variable can be set to a list of values, which cause GSK to
|
||||||
disable certain optimizations of the "ngl" and "vulkan" renderer.
|
disable certain optimizations of the "ngl" and "vulkan" renderer.
|
||||||
@@ -474,22 +449,18 @@ disable certain optimizations of the "ngl" and "vulkan" renderer.
|
|||||||
`mipmap`
|
`mipmap`
|
||||||
: Avoid creating mipmaps
|
: Avoid creating mipmaps
|
||||||
|
|
||||||
|
`gl-baseinstance`
|
||||||
|
: Assume no ARB/EXT_base_instance support
|
||||||
|
|
||||||
The special value `all` can be used to turn on all values. The special
|
The special value `all` can be used to turn on all values. The special
|
||||||
value `help` can be used to obtain a list of all supported values.
|
value `help` can be used to obtain a list of all supported values.
|
||||||
|
|
||||||
### `GSK_CACHE_TIMEOUT`
|
|
||||||
|
|
||||||
Overrides the timeout for cache GC in the "ngl" and "vulkan" renderers.
|
|
||||||
The value can be -1 to disable GC entirely, 0 to force GC to happen
|
|
||||||
before every frame, or a positive number to do GC in a timeout every
|
|
||||||
n seconds. The default timeout is 15 seconds.
|
|
||||||
|
|
||||||
### `GSK_MAX_TEXTURE_SIZE`
|
### `GSK_MAX_TEXTURE_SIZE`
|
||||||
|
|
||||||
Limit texture size to the minimum of this value and the OpenGL limit for
|
Limit texture size to the minimum of this value and the OpenGL limit
|
||||||
texture sizes in the "gl" renderer. This can be used to debug issues with
|
for texture sizes. This can be used to debug issues with texture slicing
|
||||||
texture slicing on systems where the OpenGL texture size limit would
|
on systems where the OpenGL texture size limit would otherwise make
|
||||||
otherwise make texture slicing difficult to test.
|
texture slicing difficult to test.
|
||||||
|
|
||||||
### `GTK_CSD`
|
### `GTK_CSD`
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 12 KiB |
@@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
||||||
<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.0" width="88.572334" height="96.050743" id="svg6843">
|
|
||||||
<defs id="defs6845"/>
|
|
||||||
<g transform="translate(-19.822308,-16.115941)" id="layer1">
|
|
||||||
<path d="M 20.88413,30.82696 53.816977,55.527708 107.33282,39.060543 70.587303,17.177763 20.88413,30.82696 z" id="path6976" style="fill:#729fcf;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:2.12364459;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"/>
|
|
||||||
<path d="m 22.94243,82.287118 -2.0583,-51.460158 32.932847,24.700748 0,55.577152 L 22.94243,82.287118 z" id="path6978" style="fill:#e40000;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:2.12364459;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"/>
|
|
||||||
<path d="m 53.816977,111.10486 49.399213,-20.58416 4.11663,-51.460157 -53.515843,16.467165 0,55.577152 z" id="path6980" style="fill:#7fe719;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:2.12364459;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"/>
|
|
||||||
<path d="M 23.216626,81.319479 70.48573,67.361442 103.38422,90.444516" id="path6982" style="fill:none;stroke:#ffffff;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"/>
|
|
||||||
<path d="m 70.434539,17.875593 0,49.109284" id="path6984" style="fill:#babdb6;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"/>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 1.8 KiB |
@@ -91,31 +91,6 @@ const GDK_META_MASK = 1 << 28;
|
|||||||
|
|
||||||
var useDataUrls = window.location.search.includes("datauri");
|
var useDataUrls = window.location.search.includes("datauri");
|
||||||
|
|
||||||
/* check if we are on Android and using Chrome */
|
|
||||||
var isAndroidChrome = false;
|
|
||||||
{
|
|
||||||
var ua = navigator.userAgent.toLowerCase();
|
|
||||||
if (ua.indexOf("android") > -1 && ua.indexOf("chrom") > -1) {
|
|
||||||
isAndroidChrome = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* check for the passive option for Event listener */
|
|
||||||
let passiveSupported = false;
|
|
||||||
try {
|
|
||||||
const options = {
|
|
||||||
get passive() { // This function will be called when the browser
|
|
||||||
// attempts to access the passive property.
|
|
||||||
passiveSupported = true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
window.addEventListener("test", null, options);
|
|
||||||
window.removeEventListener("test", null, options);
|
|
||||||
} catch(err) {
|
|
||||||
passiveSupported = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This base64code is based on https://github.com/beatgammit/base64-js/blob/master/index.js which is MIT licensed */
|
/* This base64code is based on https://github.com/beatgammit/base64-js/blob/master/index.js which is MIT licensed */
|
||||||
|
|
||||||
var b64_lookup = [];
|
var b64_lookup = [];
|
||||||
@@ -240,32 +215,11 @@ function logStackTrace(len) {
|
|||||||
log(callstack[i]);
|
log(callstack[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Helper functions for touch identifier to make it unique on Android */
|
|
||||||
var globalTouchIdentifier = Math.round(Date.now() / 1000);
|
|
||||||
function touchIdentifierStart(tId)
|
|
||||||
{
|
|
||||||
if (isAndroidChrome) {
|
|
||||||
if (tId == 0) {
|
|
||||||
return ++globalTouchIdentifier;
|
|
||||||
}
|
|
||||||
return globalTouchIdentifier + tId;
|
|
||||||
}
|
|
||||||
return tId;
|
|
||||||
}
|
|
||||||
function touchIdentifier(tId)
|
|
||||||
{
|
|
||||||
if (isAndroidChrome) {
|
|
||||||
return globalTouchIdentifier + tId;
|
|
||||||
}
|
|
||||||
return tId;
|
|
||||||
}
|
|
||||||
|
|
||||||
var grab = new Object();
|
var grab = new Object();
|
||||||
grab.surface = null;
|
grab.surface = null;
|
||||||
grab.ownerEvents = false;
|
grab.ownerEvents = false;
|
||||||
grab.implicit = false;
|
grab.implicit = false;
|
||||||
var keyDownList = [];
|
var keyDownList = [];
|
||||||
var inputList = [];
|
|
||||||
var lastSerial = 0;
|
var lastSerial = 0;
|
||||||
var lastX = 0;
|
var lastX = 0;
|
||||||
var lastY = 0;
|
var lastY = 0;
|
||||||
@@ -1033,14 +987,7 @@ function handleDisplayCommands(display_commands)
|
|||||||
break;
|
break;
|
||||||
case DISPLAY_OP_DELETE_SURFACE:
|
case DISPLAY_OP_DELETE_SURFACE:
|
||||||
var id = cmd[1];
|
var id = cmd[1];
|
||||||
if (id == surfaceWithMouse) {
|
delete surfaces[id];
|
||||||
surfaceWithMouse = 0;
|
|
||||||
}
|
|
||||||
if (id == realSurfaceWithMouse) {
|
|
||||||
realSurfaceWithMouse = 0;
|
|
||||||
firstTouchDownId = null;
|
|
||||||
}
|
|
||||||
delete surfaces[id];
|
|
||||||
break;
|
break;
|
||||||
case DISPLAY_OP_CHANGE_TEXTURE:
|
case DISPLAY_OP_CHANGE_TEXTURE:
|
||||||
var image = cmd[1];
|
var image = cmd[1];
|
||||||
@@ -1424,14 +1371,8 @@ function getEffectiveEventTarget (id) {
|
|||||||
function updateKeyboardStatus() {
|
function updateKeyboardStatus() {
|
||||||
if (fakeInput != null && showKeyboardChanged) {
|
if (fakeInput != null && showKeyboardChanged) {
|
||||||
showKeyboardChanged = false;
|
showKeyboardChanged = false;
|
||||||
if (showKeyboard) {
|
if (showKeyboard)
|
||||||
if (isAndroidChrome) {
|
|
||||||
fakeInput.blur();
|
|
||||||
fakeInput.value = ' '.repeat(80); // TODO: Should be exchange with broadway server
|
|
||||||
// to bring real value here.
|
|
||||||
}
|
|
||||||
fakeInput.focus();
|
fakeInput.focus();
|
||||||
}
|
|
||||||
else
|
else
|
||||||
fakeInput.blur();
|
fakeInput.blur();
|
||||||
}
|
}
|
||||||
@@ -2983,19 +2924,6 @@ function pushKeyEvent(fev) {
|
|||||||
keyDownList.push(fev);
|
keyDownList.push(fev);
|
||||||
}
|
}
|
||||||
|
|
||||||
function copyInputEvent(ev) {
|
|
||||||
var members = ['inputType', 'data'], i, obj = {};
|
|
||||||
for (i = 0; i < members.length; i++) {
|
|
||||||
if (typeof ev[members[i]] !== "undefined")
|
|
||||||
obj[members[i]] = ev[members[i]];
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
function pushInputEvent(fev) {
|
|
||||||
inputList.push(fev);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getKeyEvent(keyCode, pop) {
|
function getKeyEvent(keyCode, pop) {
|
||||||
var i, fev = null;
|
var i, fev = null;
|
||||||
for (i = keyDownList.length-1; i >= 0; i--) {
|
for (i = keyDownList.length-1; i >= 0; i--) {
|
||||||
@@ -3094,29 +3022,6 @@ function handleKeyUp(e) {
|
|||||||
keysym = fev.keysym;
|
keysym = fev.keysym;
|
||||||
else {
|
else {
|
||||||
//log("Key event (keyCode = " + ev.keyCode + ") not found on keyDownList");
|
//log("Key event (keyCode = " + ev.keyCode + ") not found on keyDownList");
|
||||||
if (isAndroidChrome && (ev.keyCode == 229)) {
|
|
||||||
var i, fev = null, len = inputList.length, str;
|
|
||||||
for (i = 0; i < len; i++) {
|
|
||||||
fev = inputList[i];
|
|
||||||
switch(fev.inputType) {
|
|
||||||
case "deleteContentBackward":
|
|
||||||
sendInput(BROADWAY_EVENT_KEY_PRESS, [65288, lastState]);
|
|
||||||
sendInput(BROADWAY_EVENT_KEY_RELEASE, [65288, lastState]);
|
|
||||||
break;
|
|
||||||
case "insertText":
|
|
||||||
if (fev.data !== undefined) {
|
|
||||||
for (let sym of fev.data) {
|
|
||||||
sendInput(BROADWAY_EVENT_KEY_PRESS, [sym.codePointAt(0), lastState]);
|
|
||||||
sendInput(BROADWAY_EVENT_KEY_RELEASE, [sym.codePointAt(0), lastState]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
inputList.splice(0, len);
|
|
||||||
}
|
|
||||||
keysym = 0;
|
keysym = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3125,16 +3030,6 @@ function handleKeyUp(e) {
|
|||||||
return cancelEvent(ev);
|
return cancelEvent(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleInput (e) {
|
|
||||||
var fev = null, ev = (e ? e : window.event), keysym = null, suppress = false;
|
|
||||||
|
|
||||||
fev = copyInputEvent(ev);
|
|
||||||
pushInputEvent(fev);
|
|
||||||
|
|
||||||
// Stop keypress events just in case
|
|
||||||
return cancelEvent(ev);
|
|
||||||
}
|
|
||||||
|
|
||||||
function onKeyDown (ev) {
|
function onKeyDown (ev) {
|
||||||
updateForEvent(ev);
|
updateForEvent(ev);
|
||||||
return handleKeyDown(ev);
|
return handleKeyDown(ev);
|
||||||
@@ -3150,11 +3045,6 @@ function onKeyUp (ev) {
|
|||||||
return handleKeyUp(ev);
|
return handleKeyUp(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onInput (ev) {
|
|
||||||
updateForEvent(ev);
|
|
||||||
return handleInput(ev);
|
|
||||||
}
|
|
||||||
|
|
||||||
function cancelEvent(ev)
|
function cancelEvent(ev)
|
||||||
{
|
{
|
||||||
ev = ev ? ev : window.event;
|
ev = ev ? ev : window.event;
|
||||||
@@ -3186,14 +3076,13 @@ function onMouseWheel(ev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onTouchStart(ev) {
|
function onTouchStart(ev) {
|
||||||
ev.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
updateKeyboardStatus();
|
updateKeyboardStatus();
|
||||||
updateForEvent(ev);
|
updateForEvent(ev);
|
||||||
|
|
||||||
for (var i = 0; i < ev.changedTouches.length; i++) {
|
for (var i = 0; i < ev.changedTouches.length; i++) {
|
||||||
var touch = ev.changedTouches.item(i);
|
var touch = ev.changedTouches.item(i);
|
||||||
var touchId = touchIdentifierStart(touch.identifier);
|
|
||||||
|
|
||||||
var origId = getSurfaceId(touch);
|
var origId = getSurfaceId(touch);
|
||||||
var id = getEffectiveEventTarget (origId);
|
var id = getEffectiveEventTarget (origId);
|
||||||
@@ -3201,7 +3090,7 @@ function onTouchStart(ev) {
|
|||||||
var isEmulated = 0;
|
var isEmulated = 0;
|
||||||
|
|
||||||
if (firstTouchDownId == null) {
|
if (firstTouchDownId == null) {
|
||||||
firstTouchDownId = touchId;
|
firstTouchDownId = touch.identifier;
|
||||||
isEmulated = 1;
|
isEmulated = 1;
|
||||||
|
|
||||||
if (realSurfaceWithMouse != origId || id != surfaceWithMouse) {
|
if (realSurfaceWithMouse != origId || id != surfaceWithMouse) {
|
||||||
@@ -3216,54 +3105,52 @@ function onTouchStart(ev) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sendInput (BROADWAY_EVENT_TOUCH, [0, id, touchId, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
|
sendInput (BROADWAY_EVENT_TOUCH, [0, id, touch.identifier, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onTouchMove(ev) {
|
function onTouchMove(ev) {
|
||||||
ev.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
updateKeyboardStatus();
|
updateKeyboardStatus();
|
||||||
updateForEvent(ev);
|
updateForEvent(ev);
|
||||||
|
|
||||||
for (var i = 0; i < ev.changedTouches.length; i++) {
|
for (var i = 0; i < ev.changedTouches.length; i++) {
|
||||||
var touch = ev.changedTouches.item(i);
|
var touch = ev.changedTouches.item(i);
|
||||||
var touchId = touchIdentifier(touch.identifier);
|
|
||||||
|
|
||||||
var origId = getSurfaceId(touch);
|
var origId = getSurfaceId(touch);
|
||||||
var id = getEffectiveEventTarget (origId);
|
var id = getEffectiveEventTarget (origId);
|
||||||
var pos = getPositionsFromEvent(touch, id);
|
var pos = getPositionsFromEvent(touch, id);
|
||||||
|
|
||||||
var isEmulated = 0;
|
var isEmulated = 0;
|
||||||
if (firstTouchDownId == touchId) {
|
if (firstTouchDownId == touch.identifier) {
|
||||||
isEmulated = 1;
|
isEmulated = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
sendInput (BROADWAY_EVENT_TOUCH, [1, id, touchId, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
|
sendInput (BROADWAY_EVENT_TOUCH, [1, id, touch.identifier, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onTouchEnd(ev) {
|
function onTouchEnd(ev) {
|
||||||
ev.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
updateKeyboardStatus();
|
updateKeyboardStatus();
|
||||||
updateForEvent(ev);
|
updateForEvent(ev);
|
||||||
|
|
||||||
for (var i = 0; i < ev.changedTouches.length; i++) {
|
for (var i = 0; i < ev.changedTouches.length; i++) {
|
||||||
var touch = ev.changedTouches.item(i);
|
var touch = ev.changedTouches.item(i);
|
||||||
var touchId = touchIdentifier(touch.identifier);
|
|
||||||
|
|
||||||
var origId = getSurfaceId(touch);
|
var origId = getSurfaceId(touch);
|
||||||
var id = getEffectiveEventTarget (origId);
|
var id = getEffectiveEventTarget (origId);
|
||||||
var pos = getPositionsFromEvent(touch, id);
|
var pos = getPositionsFromEvent(touch, id);
|
||||||
|
|
||||||
var isEmulated = 0;
|
var isEmulated = 0;
|
||||||
if (firstTouchDownId == touchId) {
|
if (firstTouchDownId == touch.identifier) {
|
||||||
isEmulated = 1;
|
isEmulated = 1;
|
||||||
firstTouchDownId = null;
|
firstTouchDownId = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
sendInput (BROADWAY_EVENT_TOUCH, [2, id, touchId, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
|
sendInput (BROADWAY_EVENT_TOUCH, [2, id, touch.identifier, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3280,11 +3167,11 @@ function setupDocument(document)
|
|||||||
document.onkeyup = onKeyUp;
|
document.onkeyup = onKeyUp;
|
||||||
|
|
||||||
if (document.addEventListener) {
|
if (document.addEventListener) {
|
||||||
document.addEventListener('DOMMouseScroll', onMouseWheel, passiveSupported ? { passive: false, capture: false } : false);
|
document.addEventListener('DOMMouseScroll', onMouseWheel, false);
|
||||||
document.addEventListener('mousewheel', onMouseWheel, passiveSupported ? { passive: false, capture: false } : false);
|
document.addEventListener('mousewheel', onMouseWheel, false);
|
||||||
document.addEventListener('touchstart', onTouchStart, passiveSupported ? { passive: false, capture: false } : false);
|
document.addEventListener('touchstart', onTouchStart, false);
|
||||||
document.addEventListener('touchmove', onTouchMove, passiveSupported ? { passive: false, capture: false } : false);
|
document.addEventListener('touchmove', onTouchMove, false);
|
||||||
document.addEventListener('touchend', onTouchEnd, passiveSupported ? { passive: false, capture: false } : false);
|
document.addEventListener('touchend', onTouchEnd, false);
|
||||||
} else if (document.attachEvent) {
|
} else if (document.attachEvent) {
|
||||||
element.attachEvent("onmousewheel", onMouseWheel);
|
element.attachEvent("onmousewheel", onMouseWheel);
|
||||||
}
|
}
|
||||||
@@ -3350,14 +3237,12 @@ function connect()
|
|||||||
};
|
};
|
||||||
|
|
||||||
var iOS = /(iPad|iPhone|iPod)/g.test( navigator.userAgent );
|
var iOS = /(iPad|iPhone|iPod)/g.test( navigator.userAgent );
|
||||||
if (iOS || isAndroidChrome) {
|
if (iOS) {
|
||||||
fakeInput = document.createElement("input");
|
fakeInput = document.createElement("input");
|
||||||
fakeInput.type = "text";
|
fakeInput.type = "text";
|
||||||
fakeInput.style.position = "absolute";
|
fakeInput.style.position = "absolute";
|
||||||
fakeInput.style.left = "-1000px";
|
fakeInput.style.left = "-1000px";
|
||||||
fakeInput.style.top = "-1000px";
|
fakeInput.style.top = "-1000px";
|
||||||
document.body.appendChild(fakeInput);
|
document.body.appendChild(fakeInput);
|
||||||
if (isAndroidChrome)
|
|
||||||
fakeInput.addEventListener('input', onInput, passiveSupported ? { passive: false, capture: false } : false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -52,7 +52,8 @@ broadwayjs_h = custom_target('broadwayjs.h',
|
|||||||
)
|
)
|
||||||
|
|
||||||
libgdk_broadway = static_library('gdk-broadway',
|
libgdk_broadway = static_library('gdk-broadway',
|
||||||
sources: [ clienthtml_h, broadwayjs_h, gdk_broadway_sources, gdk_gen_headers ],
|
clienthtml_h, broadwayjs_h,
|
||||||
|
gdk_broadway_sources, gdkconfig, gdkenum_h,
|
||||||
include_directories: [confinc, gdkinc],
|
include_directories: [confinc, gdkinc],
|
||||||
c_args: [
|
c_args: [
|
||||||
'-DGTK_COMPILATION',
|
'-DGTK_COMPILATION',
|
||||||
|
69
gdk/gdk.c
@@ -122,9 +122,8 @@ static const GdkDebugKey gdk_debug_keys[] = {
|
|||||||
|
|
||||||
{ "portals", GDK_DEBUG_PORTALS, "Force use of portals" },
|
{ "portals", GDK_DEBUG_PORTALS, "Force use of portals" },
|
||||||
{ "no-portals", GDK_DEBUG_NO_PORTALS, "Disable use of portals" },
|
{ "no-portals", GDK_DEBUG_NO_PORTALS, "Disable use of portals" },
|
||||||
{ "force-offload", GDK_DEBUG_FORCE_OFFLOAD, "Force graphics offload for all textures" },
|
|
||||||
{ "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support" },
|
{ "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support" },
|
||||||
{ "gl-no-fractional", GDK_DEBUG_GL_NO_FRACTIONAL, "Disable fractional scaling for OpenGL" },
|
{ "gl-fractional", GDK_DEBUG_GL_FRACTIONAL, "Enable fractional scaling for OpenGL (experimental)" },
|
||||||
{ "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL" },
|
{ "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL" },
|
||||||
{ "gl-disable-gl", GDK_DEBUG_GL_DISABLE_GL, "Only allow OpenGL GLES API" },
|
{ "gl-disable-gl", GDK_DEBUG_GL_DISABLE_GL, "Only allow OpenGL GLES API" },
|
||||||
{ "gl-disable-gles", GDK_DEBUG_GL_DISABLE_GLES, "Don't allow OpenGL GLES API" },
|
{ "gl-disable-gles", GDK_DEBUG_GL_DISABLE_GLES, "Don't allow OpenGL GLES API" },
|
||||||
@@ -143,50 +142,31 @@ static const GdkDebugKey gdk_debug_keys[] = {
|
|||||||
|
|
||||||
#ifdef G_HAS_CONSTRUCTORS
|
#ifdef G_HAS_CONSTRUCTORS
|
||||||
#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
|
#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
|
||||||
#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(stash_and_unset_environment)
|
#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(stash_desktop_startup_notification_id)
|
||||||
#endif
|
#endif
|
||||||
G_DEFINE_CONSTRUCTOR(stash_and_unset_environment)
|
G_DEFINE_CONSTRUCTOR(stash_desktop_startup_notification_id)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static char *startup_notification_id = NULL;
|
static char *startup_notification_id = NULL;
|
||||||
static char *xdg_activation_token = NULL;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
stash_and_unset_environment (void)
|
stash_desktop_startup_notification_id (void)
|
||||||
{
|
{
|
||||||
/* Copies environment variables and unsets them so they won't be inherited by
|
const char *desktop_startup_id;
|
||||||
* child processes and confuse things.
|
|
||||||
*
|
|
||||||
* Changing environment variables can be racy so we try to do this as early as
|
|
||||||
* possible in the program flow and before any printing that might involve
|
|
||||||
* environment variables.
|
|
||||||
*/
|
|
||||||
struct {
|
|
||||||
const char *key;
|
|
||||||
char **dst;
|
|
||||||
} vars[] = {
|
|
||||||
{ "DESKTOP_STARTUP_ID", &startup_notification_id },
|
|
||||||
{ "XDG_ACTIVATION_TOKEN", &xdg_activation_token },
|
|
||||||
};
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (vars); i++)
|
desktop_startup_id = g_getenv ("DESKTOP_STARTUP_ID");
|
||||||
*vars[i].dst = g_strdup (g_getenv (vars[i].key));
|
if (desktop_startup_id && *desktop_startup_id != '\0')
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (vars); i++)
|
|
||||||
g_unsetenv (vars[i].key);
|
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (vars); i++)
|
|
||||||
{
|
{
|
||||||
if (*vars[i].dst == NULL)
|
if (!g_utf8_validate (desktop_startup_id, -1, NULL))
|
||||||
continue;
|
g_warning ("DESKTOP_STARTUP_ID contains invalid UTF-8");
|
||||||
|
else
|
||||||
if (!g_utf8_validate (*vars[i].dst, -1, NULL))
|
startup_notification_id = g_strdup (desktop_startup_id);
|
||||||
{
|
|
||||||
g_warning ("%s contains invalid UTF-8", vars[i].key);
|
|
||||||
g_clear_pointer (vars[i].dst, g_free);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Clear the environment variable so it won't be inherited by
|
||||||
|
* child processes and confuse things.
|
||||||
|
*/
|
||||||
|
g_unsetenv ("DESKTOP_STARTUP_ID");
|
||||||
}
|
}
|
||||||
|
|
||||||
static gpointer
|
static gpointer
|
||||||
@@ -242,6 +222,7 @@ gdk_parse_debug_var (const char *variable,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
char *val = g_strndup (p, q - p);
|
||||||
for (i = 0; i < nkeys; i++)
|
for (i = 0; i < nkeys; i++)
|
||||||
{
|
{
|
||||||
if (strlen (keys[i].key) == q - p &&
|
if (strlen (keys[i].key) == q - p &&
|
||||||
@@ -252,7 +233,8 @@ gdk_parse_debug_var (const char *variable,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i == nkeys)
|
if (i == nkeys)
|
||||||
fprintf (stderr, "Unrecognized value \"%.*s\". Try %s=help\n", (int) (q - p), p, variable);
|
fprintf (stderr, "Unrecognized value \"%s\". Try %s=help\n", val, variable);
|
||||||
|
g_free (val);
|
||||||
}
|
}
|
||||||
|
|
||||||
p = q;
|
p = q;
|
||||||
@@ -311,7 +293,7 @@ gdk_pre_parse (void)
|
|||||||
gdk_gl_backend_use (GDK_GL_WGL);
|
gdk_gl_backend_use (GDK_GL_WGL);
|
||||||
|
|
||||||
#ifndef G_HAS_CONSTRUCTORS
|
#ifndef G_HAS_CONSTRUCTORS
|
||||||
stash_and_unset_environment ();
|
stash_desktop_startup_notification_id ();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -345,20 +327,15 @@ gdk_display_open_default (void)
|
|||||||
/*< private >
|
/*< private >
|
||||||
* gdk_get_startup_notification_id:
|
* gdk_get_startup_notification_id:
|
||||||
*
|
*
|
||||||
* Returns the original value of the XDG_ACTIVATION_TOKEN environment
|
* Returns the original value of the DESKTOP_STARTUP_ID environment
|
||||||
* variable if it was defined and valid, otherwise it returns the original
|
* variable if it was defined and valid, or %NULL otherwise.
|
||||||
* value of the DESKTOP_STARTUP_ID environment variable if it was defined
|
|
||||||
* and valid, or %NULL if neither of them were defined and valid.
|
|
||||||
*
|
*
|
||||||
* Returns: (nullable) (transfer none): the original value of the
|
* Returns: (nullable) (transfer none): the original value of the
|
||||||
* XDG_ACTIVATION_TOKEN or DESKTOP_STARTUP_ID environment variable
|
* DESKTOP_STARTUP_ID environment variable
|
||||||
*/
|
*/
|
||||||
const char *
|
const char *
|
||||||
gdk_get_startup_notification_id (void)
|
gdk_get_startup_notification_id (void)
|
||||||
{
|
{
|
||||||
if (xdg_activation_token)
|
|
||||||
return xdg_activation_token;
|
|
||||||
|
|
||||||
return startup_notification_id;
|
return startup_notification_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -156,9 +156,6 @@ gdk_cursor_finalize (GObject *object)
|
|||||||
g_clear_object (&cursor->texture);
|
g_clear_object (&cursor->texture);
|
||||||
g_clear_object (&cursor->fallback);
|
g_clear_object (&cursor->fallback);
|
||||||
|
|
||||||
if (cursor->destroy)
|
|
||||||
cursor->destroy (cursor->data);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (gdk_cursor_parent_class)->finalize (object);
|
G_OBJECT_CLASS (gdk_cursor_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,11 +253,6 @@ gdk_cursor_hash (gconstpointer pointer)
|
|||||||
hash ^= g_str_hash (cursor->name);
|
hash ^= g_str_hash (cursor->name);
|
||||||
else if (cursor->texture)
|
else if (cursor->texture)
|
||||||
hash ^= g_direct_hash (cursor->texture);
|
hash ^= g_direct_hash (cursor->texture);
|
||||||
else if (cursor->callback)
|
|
||||||
{
|
|
||||||
hash ^= g_direct_hash (cursor->callback);
|
|
||||||
hash ^= g_direct_hash (cursor->data);
|
|
||||||
}
|
|
||||||
|
|
||||||
hash ^= (cursor->hotspot_x << 8) | cursor->hotspot_y;
|
hash ^= (cursor->hotspot_x << 8) | cursor->hotspot_y;
|
||||||
|
|
||||||
@@ -289,10 +281,6 @@ gdk_cursor_equal (gconstpointer a,
|
|||||||
ca->hotspot_y != cb->hotspot_y)
|
ca->hotspot_y != cb->hotspot_y)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (ca->callback != cb->callback ||
|
|
||||||
ca->data != cb->data)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,45 +355,6 @@ gdk_cursor_new_from_texture (GdkTexture *texture,
|
|||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* gdk_cursor_new_from_callback:
|
|
||||||
* @callback: the `GdkCursorGetTextureCallback`
|
|
||||||
* @data: data to pass to @callback
|
|
||||||
* @destroy: destroy notify for @data
|
|
||||||
* @fallback: (nullable): the `GdkCursor` to fall back to when
|
|
||||||
* this one cannot be supported
|
|
||||||
*
|
|
||||||
* Creates a new callback-based cursor object.
|
|
||||||
*
|
|
||||||
* Cursors of this kind produce textures for the cursor
|
|
||||||
* image on demand, when the @callback is called.
|
|
||||||
*
|
|
||||||
* Returns: (nullable): a new `GdkCursor`
|
|
||||||
*
|
|
||||||
* Since: 4.16
|
|
||||||
*/
|
|
||||||
GdkCursor *
|
|
||||||
gdk_cursor_new_from_callback (GdkCursorGetTextureCallback callback,
|
|
||||||
gpointer data,
|
|
||||||
GDestroyNotify destroy,
|
|
||||||
GdkCursor *fallback)
|
|
||||||
{
|
|
||||||
GdkCursor *cursor;
|
|
||||||
|
|
||||||
g_return_val_if_fail (callback != NULL, NULL);
|
|
||||||
g_return_val_if_fail (fallback == NULL || GDK_IS_CURSOR (fallback), NULL);
|
|
||||||
|
|
||||||
cursor = g_object_new (GDK_TYPE_CURSOR,
|
|
||||||
"fallback", fallback,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
cursor->callback = callback;
|
|
||||||
cursor->data = data;
|
|
||||||
cursor->destroy = destroy;
|
|
||||||
|
|
||||||
return cursor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gdk_cursor_get_fallback: (attributes org.gtk.Method.get_property=fallback)
|
* gdk_cursor_get_fallback: (attributes org.gtk.Method.get_property=fallback)
|
||||||
* @cursor: a `GdkCursor`
|
* @cursor: a `GdkCursor`
|
||||||
@@ -510,22 +459,3 @@ gdk_cursor_get_hotspot_y (GdkCursor *cursor)
|
|||||||
|
|
||||||
return cursor->hotspot_y;
|
return cursor->hotspot_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
GdkTexture *
|
|
||||||
gdk_cursor_get_texture_for_size (GdkCursor *cursor,
|
|
||||||
int cursor_size,
|
|
||||||
double scale,
|
|
||||||
int *width,
|
|
||||||
int *height,
|
|
||||||
int *hotspot_x,
|
|
||||||
int *hotspot_y)
|
|
||||||
{
|
|
||||||
if (cursor->callback == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return cursor->callback (cursor,
|
|
||||||
cursor_size, scale,
|
|
||||||
width, height,
|
|
||||||
hotspot_x, hotspot_y,
|
|
||||||
cursor->data);
|
|
||||||
}
|
|
||||||
|
@@ -51,52 +51,6 @@ GDK_AVAILABLE_IN_ALL
|
|||||||
GdkCursor* gdk_cursor_new_from_name (const char *name,
|
GdkCursor* gdk_cursor_new_from_name (const char *name,
|
||||||
GdkCursor *fallback);
|
GdkCursor *fallback);
|
||||||
|
|
||||||
/**
|
|
||||||
* GdkCursorGetTestureCallback:
|
|
||||||
* @cursor: the `GdkCursor`
|
|
||||||
* @cursor_size: the nominal cursor size, in application pixels
|
|
||||||
* @scale: the device scale
|
|
||||||
* @width: (out): return location for the actual cursor width,
|
|
||||||
* in application pixels
|
|
||||||
* @height: (out): return location for the actual cursor height,
|
|
||||||
* in application pixels
|
|
||||||
* @hotspot_x: (out): return location for the hotspot X position,
|
|
||||||
* in application pixels
|
|
||||||
* @hotspot_y: (out): return location for the hotspot Y position,
|
|
||||||
* in application pixels
|
|
||||||
* @data: User data for the callback
|
|
||||||
*
|
|
||||||
* The type of callback used by a dynamic `GdkCursor` to generate
|
|
||||||
* a texture for the cursor image at the given @cursor_size
|
|
||||||
* and @scale.
|
|
||||||
*
|
|
||||||
* The actual cursor size in application pixels may be different
|
|
||||||
* from @cursor_size x @cursor_size, and will be returned in
|
|
||||||
* @width, @height. The returned texture should have a size that
|
|
||||||
* corresponds to the actual cursor size, in device pixels (i.e.
|
|
||||||
* application pixels, multiplied by @scale).
|
|
||||||
*
|
|
||||||
* This function may fail and return `NULL`, in which case
|
|
||||||
* the fallback cursor will be used.
|
|
||||||
*
|
|
||||||
* Returns: (nullable) (transfer full): the cursor image, or
|
|
||||||
* `NULL` if none could be produced.
|
|
||||||
*/
|
|
||||||
typedef GdkTexture * (* GdkCursorGetTextureCallback) (GdkCursor *cursor,
|
|
||||||
int cursor_size,
|
|
||||||
double scale,
|
|
||||||
int *width,
|
|
||||||
int *height,
|
|
||||||
int *hotspot_x,
|
|
||||||
int *hotspot_y,
|
|
||||||
gpointer data);
|
|
||||||
|
|
||||||
GDK_AVAILABLE_IN_4_16
|
|
||||||
GdkCursor * gdk_cursor_new_from_callback (GdkCursorGetTextureCallback callback,
|
|
||||||
gpointer data,
|
|
||||||
GDestroyNotify destroy,
|
|
||||||
GdkCursor *fallback);
|
|
||||||
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GdkCursor * gdk_cursor_get_fallback (GdkCursor *cursor);
|
GdkCursor * gdk_cursor_get_fallback (GdkCursor *cursor);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
@@ -44,10 +44,6 @@ struct _GdkCursor
|
|||||||
GdkTexture *texture;
|
GdkTexture *texture;
|
||||||
int hotspot_x;
|
int hotspot_x;
|
||||||
int hotspot_y;
|
int hotspot_y;
|
||||||
|
|
||||||
GdkCursorGetTextureCallback callback;
|
|
||||||
gpointer data;
|
|
||||||
GDestroyNotify destroy;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GdkCursorClass
|
struct _GdkCursorClass
|
||||||
@@ -59,13 +55,5 @@ guint gdk_cursor_hash (gconstpointer
|
|||||||
gboolean gdk_cursor_equal (gconstpointer a,
|
gboolean gdk_cursor_equal (gconstpointer a,
|
||||||
gconstpointer b);
|
gconstpointer b);
|
||||||
|
|
||||||
GdkTexture * gdk_cursor_get_texture_for_size (GdkCursor *cursor,
|
|
||||||
int cursor_size,
|
|
||||||
double scale,
|
|
||||||
int *width,
|
|
||||||
int *height,
|
|
||||||
int *hotspot_x,
|
|
||||||
int *hotspot_y);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@@ -43,8 +43,8 @@ typedef enum {
|
|||||||
GDK_DEBUG_PORTALS = 1 << 14,
|
GDK_DEBUG_PORTALS = 1 << 14,
|
||||||
GDK_DEBUG_NO_PORTALS = 1 << 15,
|
GDK_DEBUG_NO_PORTALS = 1 << 15,
|
||||||
GDK_DEBUG_GL_DISABLE = 1 << 16,
|
GDK_DEBUG_GL_DISABLE = 1 << 16,
|
||||||
GDK_DEBUG_GL_NO_FRACTIONAL= 1 << 17,
|
GDK_DEBUG_GL_FRACTIONAL = 1 << 17,
|
||||||
GDK_DEBUG_FORCE_OFFLOAD = 1 << 18,
|
|
||||||
GDK_DEBUG_GL_DISABLE_GL = 1 << 19,
|
GDK_DEBUG_GL_DISABLE_GL = 1 << 19,
|
||||||
GDK_DEBUG_GL_DISABLE_GLES = 1 << 20,
|
GDK_DEBUG_GL_DISABLE_GLES = 1 << 20,
|
||||||
GDK_DEBUG_GL_PREFER_GL = 1 << 21,
|
GDK_DEBUG_GL_PREFER_GL = 1 << 21,
|
||||||
|
@@ -289,8 +289,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
|
|||||||
*/
|
*/
|
||||||
device_props[PROP_MODIFIER_STATE] =
|
device_props[PROP_MODIFIER_STATE] =
|
||||||
g_param_spec_flags ("modifier-state", NULL, NULL,
|
g_param_spec_flags ("modifier-state", NULL, NULL,
|
||||||
GDK_TYPE_MODIFIER_TYPE,
|
GDK_TYPE_MODIFIER_TYPE, 0,
|
||||||
GDK_NO_MODIFIER_MASK,
|
|
||||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
g_object_class_install_properties (object_class, LAST_PROP, device_props);
|
g_object_class_install_properties (object_class, LAST_PROP, device_props);
|
||||||
|
@@ -77,7 +77,6 @@ enum
|
|||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_COMPOSITED,
|
PROP_COMPOSITED,
|
||||||
PROP_RGBA,
|
PROP_RGBA,
|
||||||
PROP_SHADOW_WIDTH,
|
|
||||||
PROP_INPUT_SHAPES,
|
PROP_INPUT_SHAPES,
|
||||||
PROP_DMABUF_FORMATS,
|
PROP_DMABUF_FORMATS,
|
||||||
LAST_PROP
|
LAST_PROP
|
||||||
@@ -112,7 +111,6 @@ struct _GdkDisplayPrivate {
|
|||||||
|
|
||||||
guint rgba : 1;
|
guint rgba : 1;
|
||||||
guint composited : 1;
|
guint composited : 1;
|
||||||
guint shadow_width: 1;
|
|
||||||
guint input_shapes : 1;
|
guint input_shapes : 1;
|
||||||
|
|
||||||
GdkDebugFlags debug_flags;
|
GdkDebugFlags debug_flags;
|
||||||
@@ -146,10 +144,6 @@ gdk_display_get_property (GObject *object,
|
|||||||
g_value_set_boolean (value, gdk_display_is_rgba (display));
|
g_value_set_boolean (value, gdk_display_is_rgba (display));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_SHADOW_WIDTH:
|
|
||||||
g_value_set_boolean (value, gdk_display_supports_shadow_width (display));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PROP_INPUT_SHAPES:
|
case PROP_INPUT_SHAPES:
|
||||||
g_value_set_boolean (value, gdk_display_supports_input_shapes (display));
|
g_value_set_boolean (value, gdk_display_supports_input_shapes (display));
|
||||||
break;
|
break;
|
||||||
@@ -249,18 +243,6 @@ gdk_display_class_init (GdkDisplayClass *class)
|
|||||||
TRUE,
|
TRUE,
|
||||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
/**
|
|
||||||
* GdkDisplay:shadow-width: (attributes org.gtk.Property.get=gdk_display_supports_shadow_width)
|
|
||||||
*
|
|
||||||
* %TRUE if the display supports extensible frames.
|
|
||||||
*
|
|
||||||
* Since: 4.14
|
|
||||||
*/
|
|
||||||
props[PROP_SHADOW_WIDTH] =
|
|
||||||
g_param_spec_boolean ("shadow-width", NULL, NULL,
|
|
||||||
TRUE,
|
|
||||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GdkDisplay:input-shapes: (attributes org.gtk.Property.get=gdk_display_supports_input_shapes)
|
* GdkDisplay:input-shapes: (attributes org.gtk.Property.get=gdk_display_supports_input_shapes)
|
||||||
*
|
*
|
||||||
@@ -272,7 +254,7 @@ gdk_display_class_init (GdkDisplayClass *class)
|
|||||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GdkDisplay:dmabuf-formats: (attributes org.gtk.Property.get=gdk_display_get_dmabuf_formats)
|
* GdkDisplay:dmabuf-formats:
|
||||||
*
|
*
|
||||||
* The dma-buf formats that are supported on this display
|
* The dma-buf formats that are supported on this display
|
||||||
*
|
*
|
||||||
@@ -409,7 +391,6 @@ gdk_display_init (GdkDisplay *display)
|
|||||||
|
|
||||||
priv->composited = TRUE;
|
priv->composited = TRUE;
|
||||||
priv->rgba = TRUE;
|
priv->rgba = TRUE;
|
||||||
priv->shadow_width = TRUE;
|
|
||||||
priv->input_shapes = TRUE;
|
priv->input_shapes = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1382,7 +1363,7 @@ gdk_display_init_gl (GdkDisplay *self)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
gdk_profiler_end_mark (before2, "Realize OpenGL context", NULL);
|
gdk_profiler_end_mark (before2, "realize OpenGL context", NULL);
|
||||||
|
|
||||||
/* Only assign after realize, so GdkGLContext::realize() can use
|
/* Only assign after realize, so GdkGLContext::realize() can use
|
||||||
* gdk_display_get_gl_context() == NULL to differentiate between
|
* gdk_display_get_gl_context() == NULL to differentiate between
|
||||||
@@ -1392,7 +1373,7 @@ gdk_display_init_gl (GdkDisplay *self)
|
|||||||
|
|
||||||
gdk_gl_backend_use (GDK_GL_CONTEXT_GET_CLASS (context)->backend_type);
|
gdk_gl_backend_use (GDK_GL_CONTEXT_GET_CLASS (context)->backend_type);
|
||||||
|
|
||||||
gdk_profiler_end_mark (before, "Init OpenGL", NULL);
|
gdk_profiler_end_mark (before, "initialize OpenGL", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1538,7 +1519,6 @@ describe_egl_config (EGLDisplay egl_display,
|
|||||||
EGLConfig egl_config)
|
EGLConfig egl_config)
|
||||||
{
|
{
|
||||||
EGLint red, green, blue, alpha, type;
|
EGLint red, green, blue, alpha, type;
|
||||||
EGLint depth, stencil;
|
|
||||||
|
|
||||||
if (egl_config == NULL)
|
if (egl_config == NULL)
|
||||||
return g_strdup ("-");
|
return g_strdup ("-");
|
||||||
@@ -1557,16 +1537,7 @@ describe_egl_config (EGLDisplay egl_display,
|
|||||||
else
|
else
|
||||||
type = EGL_COLOR_COMPONENT_TYPE_FIXED_EXT;
|
type = EGL_COLOR_COMPONENT_TYPE_FIXED_EXT;
|
||||||
|
|
||||||
if (!eglGetConfigAttrib (egl_display, egl_config, EGL_DEPTH_SIZE, &depth))
|
return g_strdup_printf ("R%dG%dB%dA%d%s", red, green, blue, alpha, type == EGL_COLOR_COMPONENT_TYPE_FIXED_EXT ? "" : " float");
|
||||||
depth = 0;
|
|
||||||
|
|
||||||
if (!eglGetConfigAttrib (egl_display, egl_config, EGL_STENCIL_SIZE, &stencil))
|
|
||||||
stencil = 0;
|
|
||||||
|
|
||||||
return g_strdup_printf ("R%dG%dB%dA%d%s, depth %d, stencil %d", red, green, blue, alpha,
|
|
||||||
type == EGL_COLOR_COMPONENT_TYPE_FIXED_EXT ? "" : " float",
|
|
||||||
depth,
|
|
||||||
stencil);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gpointer
|
gpointer
|
||||||
@@ -1797,6 +1768,7 @@ gdk_display_init_egl (GdkDisplay *self,
|
|||||||
{
|
{
|
||||||
GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
|
GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
|
||||||
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
|
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
|
||||||
|
G_GNUC_UNUSED gint64 start_time2;
|
||||||
int major, minor;
|
int major, minor;
|
||||||
|
|
||||||
if (!gdk_gl_backend_can_be_used (GDK_GL_EGL, error))
|
if (!gdk_gl_backend_can_be_used (GDK_GL_EGL, error))
|
||||||
@@ -1823,6 +1795,7 @@ gdk_display_init_egl (GdkDisplay *self,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
start_time2 = GDK_PROFILER_CURRENT_TIME;
|
||||||
if (!eglInitialize (priv->egl_display, &major, &minor))
|
if (!eglInitialize (priv->egl_display, &major, &minor))
|
||||||
{
|
{
|
||||||
priv->egl_display = NULL;
|
priv->egl_display = NULL;
|
||||||
@@ -1831,6 +1804,7 @@ gdk_display_init_egl (GdkDisplay *self,
|
|||||||
_("Could not initialize EGL display"));
|
_("Could not initialize EGL display"));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
gdk_profiler_end_mark (start_time2, "eglInitialize", NULL);
|
||||||
|
|
||||||
if (major < GDK_EGL_MIN_VERSION_MAJOR ||
|
if (major < GDK_EGL_MIN_VERSION_MAJOR ||
|
||||||
(major == GDK_EGL_MIN_VERSION_MAJOR && minor < GDK_EGL_MIN_VERSION_MINOR))
|
(major == GDK_EGL_MIN_VERSION_MAJOR && minor < GDK_EGL_MIN_VERSION_MINOR))
|
||||||
@@ -1920,7 +1894,7 @@ gdk_display_init_egl (GdkDisplay *self,
|
|||||||
g_free (ext);
|
g_free (ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
gdk_profiler_end_mark (start_time, "Init EGL", NULL);
|
gdk_profiler_end_mark (start_time, "init EGL", NULL);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -2047,12 +2021,9 @@ gdk_display_get_dmabuf_formats (GdkDisplay *display)
|
|||||||
GdkDebugFlags
|
GdkDebugFlags
|
||||||
gdk_display_get_debug_flags (GdkDisplay *display)
|
gdk_display_get_debug_flags (GdkDisplay *display)
|
||||||
{
|
{
|
||||||
if (display == NULL)
|
|
||||||
return _gdk_debug_flags;
|
|
||||||
|
|
||||||
GdkDisplayPrivate *priv = gdk_display_get_instance_private (display);
|
GdkDisplayPrivate *priv = gdk_display_get_instance_private (display);
|
||||||
|
|
||||||
return priv->debug_flags;
|
return display ? priv->debug_flags : _gdk_debug_flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -2154,46 +2125,6 @@ gdk_display_set_rgba (GdkDisplay *display,
|
|||||||
g_object_notify_by_pspec (G_OBJECT (display), props[PROP_RGBA]);
|
g_object_notify_by_pspec (G_OBJECT (display), props[PROP_RGBA]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* gdk_display_supports_shadow_width: (attributes org.gtk.Method.get_property=shadow-width)
|
|
||||||
* @display: a `GdkDisplay`
|
|
||||||
*
|
|
||||||
* Returns whether it's possible for a surface to draw outside of the window area.
|
|
||||||
*
|
|
||||||
* If %TRUE is returned the application decides if it wants to draw shadows.
|
|
||||||
* If %FALSE is returned, the compositor decides if it wants to draw shadows.
|
|
||||||
*
|
|
||||||
* Returns: %TRUE if surfaces can draw shadows or
|
|
||||||
* %FALSE if the display does not support this functionality.
|
|
||||||
*
|
|
||||||
* Since: 4.14
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
gdk_display_supports_shadow_width (GdkDisplay *display)
|
|
||||||
{
|
|
||||||
GdkDisplayPrivate *priv = gdk_display_get_instance_private (display);
|
|
||||||
|
|
||||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
|
|
||||||
|
|
||||||
return priv->shadow_width;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
gdk_display_set_shadow_width (GdkDisplay *display,
|
|
||||||
gboolean shadow_width)
|
|
||||||
{
|
|
||||||
GdkDisplayPrivate *priv = gdk_display_get_instance_private (display);
|
|
||||||
|
|
||||||
g_return_if_fail (GDK_IS_DISPLAY (display));
|
|
||||||
|
|
||||||
if (priv->shadow_width == shadow_width)
|
|
||||||
return;
|
|
||||||
|
|
||||||
priv->shadow_width = shadow_width;
|
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (display), props[PROP_SHADOW_WIDTH]);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
device_removed_cb (GdkSeat *seat,
|
device_removed_cb (GdkSeat *seat,
|
||||||
GdkDevice *device,
|
GdkDevice *device,
|
||||||
|
@@ -63,8 +63,6 @@ GDK_AVAILABLE_IN_ALL
|
|||||||
gboolean gdk_display_is_composited (GdkDisplay *display);
|
gboolean gdk_display_is_composited (GdkDisplay *display);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
gboolean gdk_display_is_rgba (GdkDisplay *display);
|
gboolean gdk_display_is_rgba (GdkDisplay *display);
|
||||||
GDK_AVAILABLE_IN_4_14
|
|
||||||
gboolean gdk_display_supports_shadow_width (GdkDisplay *display);
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
gboolean gdk_display_supports_input_shapes (GdkDisplay *display);
|
gboolean gdk_display_supports_input_shapes (GdkDisplay *display);
|
||||||
|
|
||||||
|
@@ -257,8 +257,6 @@ void gdk_display_set_composited (GdkDisplay *display
|
|||||||
gboolean composited);
|
gboolean composited);
|
||||||
void gdk_display_set_input_shapes (GdkDisplay *display,
|
void gdk_display_set_input_shapes (GdkDisplay *display,
|
||||||
gboolean input_shapes);
|
gboolean input_shapes);
|
||||||
void gdk_display_set_shadow_width (GdkDisplay *display,
|
|
||||||
gboolean shadow_width);
|
|
||||||
|
|
||||||
void gdk_display_add_seat (GdkDisplay *display,
|
void gdk_display_add_seat (GdkDisplay *display,
|
||||||
GdkSeat *seat);
|
GdkSeat *seat);
|
||||||
|
@@ -144,8 +144,8 @@ struct _YUVCoefficients
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* multiplied by 65536 */
|
/* multiplied by 65536 */
|
||||||
static const YUVCoefficients itu601_narrow = { 104597, -25675, -53279, 132201 };
|
//static const YUVCoefficients itu601_narrow = { 104597, -25675, -53279, 132201 };
|
||||||
//static const YUVCoefficients itu601_wide = { 74711, -25864, -38050, 133176 };
|
static const YUVCoefficients itu601_wide = { 74711, -25864, -38050, 133176 };
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
get_uv_values (const YUVCoefficients *coeffs,
|
get_uv_values (const YUVCoefficients *coeffs,
|
||||||
@@ -229,7 +229,7 @@ download_nv12 (guchar *dst_data,
|
|||||||
int r, g, b;
|
int r, g, b;
|
||||||
gsize xs, ys;
|
gsize xs, ys;
|
||||||
|
|
||||||
get_uv_values (&itu601_narrow, uv_data[x / X_SUB * 2 + U], uv_data[x / X_SUB * 2 + V], &r, &g, &b);
|
get_uv_values (&itu601_wide, uv_data[x / X_SUB * 2 + U], uv_data[x / X_SUB * 2 + V], &r, &g, &b);
|
||||||
|
|
||||||
for (ys = 0; ys < Y_SUB && y + ys < height; ys++)
|
for (ys = 0; ys < Y_SUB && y + ys < height; ys++)
|
||||||
for (xs = 0; xs < X_SUB && x + xs < width; xs++)
|
for (xs = 0; xs < X_SUB && x + xs < width; xs++)
|
||||||
@@ -309,7 +309,7 @@ download_yuv_3 (guchar *dst_data,
|
|||||||
int r, g, b;
|
int r, g, b;
|
||||||
gsize xs, ys;
|
gsize xs, ys;
|
||||||
|
|
||||||
get_uv_values (&itu601_narrow, u_data[x / X_SUB], v_data[x / X_SUB], &r, &g, &b);
|
get_uv_values (&itu601_wide, u_data[x / X_SUB], v_data[x / X_SUB], &r, &g, &b);
|
||||||
|
|
||||||
for (ys = 0; ys < Y_SUB && y + ys < height; ys++)
|
for (ys = 0; ys < Y_SUB && y + ys < height; ys++)
|
||||||
for (xs = 0; xs < X_SUB && x + xs < width; xs++)
|
for (xs = 0; xs < X_SUB && x + xs < width; xs++)
|
||||||
@@ -365,7 +365,7 @@ download_yuyv (guchar *dst_data,
|
|||||||
{
|
{
|
||||||
int r, g, b;
|
int r, g, b;
|
||||||
|
|
||||||
get_uv_values (&itu601_narrow, src_data[2 * x + U], src_data[2 * x + V], &r, &g, &b);
|
get_uv_values (&itu601_wide, src_data[2 * x + U], src_data[2 * x + V], &r, &g, &b);
|
||||||
set_rgb_values (&dst_data[3 * x], src_data[2 * x + Y1], r, g, b);
|
set_rgb_values (&dst_data[3 * x], src_data[2 * x + Y1], r, g, b);
|
||||||
if (x + 1 < width)
|
if (x + 1 < width)
|
||||||
set_rgb_values (&dst_data[3 * (x + 1)], src_data[2 * x + Y2], r, g, b);
|
set_rgb_values (&dst_data[3 * (x + 1)], src_data[2 * x + Y2], r, g, b);
|
||||||
@@ -2329,42 +2329,18 @@ gdk_dmabuf_sanitize (GdkDmabuf *dest,
|
|||||||
* @dmabuf: a sanitized GdkDmabuf
|
* @dmabuf: a sanitized GdkDmabuf
|
||||||
*
|
*
|
||||||
* A dmabuf is considered disjoint if it uses more than
|
* A dmabuf is considered disjoint if it uses more than
|
||||||
* 1 inode.
|
* 1 file descriptor.
|
||||||
* Multiple file descriptors may exist when the creator
|
|
||||||
* of the dmabuf just dup()ed once for every plane...
|
|
||||||
*
|
*
|
||||||
* Returns: %TRUE if the dmabuf is disjoint
|
* Returns: %TRUE if the dmabuf is disjoint
|
||||||
**/
|
**/
|
||||||
gboolean
|
gboolean
|
||||||
gdk_dmabuf_is_disjoint (const GdkDmabuf *dmabuf)
|
gdk_dmabuf_is_disjoint (const GdkDmabuf *dmabuf)
|
||||||
{
|
{
|
||||||
struct stat first_stat;
|
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
/* First, do a fast check */
|
|
||||||
|
|
||||||
for (i = 1; i < dmabuf->n_planes; i++)
|
for (i = 1; i < dmabuf->n_planes; i++)
|
||||||
{
|
{
|
||||||
if (dmabuf->planes[0].fd != dmabuf->planes[i].fd)
|
if (dmabuf->planes[0].fd != dmabuf->planes[i].fd)
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i == dmabuf->n_planes)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* We have different fds, do the fancy check instead */
|
|
||||||
|
|
||||||
if (fstat (dmabuf->planes[0].fd, &first_stat) != 0)
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
for (i = 1; i < dmabuf->n_planes; i++)
|
|
||||||
{
|
|
||||||
struct stat plane_stat;
|
|
||||||
|
|
||||||
if (fstat (dmabuf->planes[0].fd, &plane_stat) != 0)
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
if (first_stat.st_ino != plane_stat.st_ino)
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -154,7 +154,6 @@ gdk_dmabuf_get_egl_downloader (GdkDisplay *display,
|
|||||||
gboolean retval = FALSE;
|
gboolean retval = FALSE;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GskRenderer *renderer;
|
GskRenderer *renderer;
|
||||||
GdkGLContext *previous;
|
|
||||||
|
|
||||||
g_assert (display->egl_dmabuf_formats == NULL);
|
g_assert (display->egl_dmabuf_formats == NULL);
|
||||||
g_assert (display->egl_external_formats == NULL);
|
g_assert (display->egl_external_formats == NULL);
|
||||||
@@ -162,7 +161,6 @@ gdk_dmabuf_get_egl_downloader (GdkDisplay *display,
|
|||||||
if (!gdk_display_prepare_gl (display, NULL))
|
if (!gdk_display_prepare_gl (display, NULL))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
previous = gdk_gl_context_get_current ();
|
|
||||||
formats = gdk_dmabuf_formats_builder_new ();
|
formats = gdk_dmabuf_formats_builder_new ();
|
||||||
external = gdk_dmabuf_formats_builder_new ();
|
external = gdk_dmabuf_formats_builder_new ();
|
||||||
|
|
||||||
@@ -174,11 +172,7 @@ gdk_dmabuf_get_egl_downloader (GdkDisplay *display,
|
|||||||
gdk_dmabuf_formats_builder_add_formats (builder, display->egl_dmabuf_formats);
|
gdk_dmabuf_formats_builder_add_formats (builder, display->egl_dmabuf_formats);
|
||||||
|
|
||||||
if (!retval)
|
if (!retval)
|
||||||
{
|
return NULL;
|
||||||
if (previous)
|
|
||||||
gdk_gl_context_make_current (previous);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
renderer = gsk_gl_renderer_new ();
|
renderer = gsk_gl_renderer_new ();
|
||||||
|
|
||||||
@@ -187,15 +181,10 @@ gdk_dmabuf_get_egl_downloader (GdkDisplay *display,
|
|||||||
g_warning ("Failed to realize GL renderer: %s", error->message);
|
g_warning ("Failed to realize GL renderer: %s", error->message);
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
g_object_unref (renderer);
|
g_object_unref (renderer);
|
||||||
if (previous)
|
|
||||||
gdk_gl_context_make_current (previous);
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (previous)
|
|
||||||
gdk_gl_context_make_current (previous);
|
|
||||||
|
|
||||||
return GDK_DMABUF_DOWNLOADER (renderer);
|
return GDK_DMABUF_DOWNLOADER (renderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,7 +228,7 @@ gdk_dmabuf_egl_create_image (GdkDisplay *display,
|
|||||||
attribs[i++] = EGL_YUV_COLOR_SPACE_HINT_EXT;
|
attribs[i++] = EGL_YUV_COLOR_SPACE_HINT_EXT;
|
||||||
attribs[i++] = EGL_ITU_REC601_EXT;
|
attribs[i++] = EGL_ITU_REC601_EXT;
|
||||||
attribs[i++] = EGL_SAMPLE_RANGE_HINT_EXT;
|
attribs[i++] = EGL_SAMPLE_RANGE_HINT_EXT;
|
||||||
attribs[i++] = EGL_YUV_NARROW_RANGE_EXT;
|
attribs[i++] = EGL_YUV_FULL_RANGE_EXT;
|
||||||
|
|
||||||
#define ADD_PLANE(plane) \
|
#define ADD_PLANE(plane) \
|
||||||
{ \
|
{ \
|
||||||
@@ -265,7 +254,6 @@ gdk_dmabuf_egl_create_image (GdkDisplay *display,
|
|||||||
if (dmabuf->n_planes > 3) ADD_PLANE (3);
|
if (dmabuf->n_planes > 3) ADD_PLANE (3);
|
||||||
|
|
||||||
attribs[i++] = EGL_NONE;
|
attribs[i++] = EGL_NONE;
|
||||||
g_assert (i < G_N_ELEMENTS (attribs));
|
|
||||||
|
|
||||||
image = eglCreateImageKHR (egl_display,
|
image = eglCreateImageKHR (egl_display,
|
||||||
EGL_NO_CONTEXT,
|
EGL_NO_CONTEXT,
|
||||||
|
@@ -217,41 +217,3 @@ gdk_dmabuf_formats_peek_formats (GdkDmabufFormats *self)
|
|||||||
{
|
{
|
||||||
return self->formats;
|
return self->formats;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* gdk_dmabuf_formats_equal:
|
|
||||||
* @formats1: (nullable): a `GdkDmabufFormats`
|
|
||||||
* @formats2: (nullable): another `GdkDmabufFormats`
|
|
||||||
*
|
|
||||||
* Returns whether @formats1 and @formats2 contain the
|
|
||||||
* same dmabuf formats, in the same order.
|
|
||||||
*
|
|
||||||
* Returns: `TRUE` if @formats1 and @formats2 are equal
|
|
||||||
*
|
|
||||||
* Since: 4.14
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
gdk_dmabuf_formats_equal (const GdkDmabufFormats *formats1,
|
|
||||||
const GdkDmabufFormats *formats2)
|
|
||||||
{
|
|
||||||
if (formats1 == formats2)
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
if (formats1 == NULL || formats2 == NULL)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (formats1->n_formats != formats2->n_formats)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
for (gsize i = 0; i < formats1->n_formats; i++)
|
|
||||||
{
|
|
||||||
GdkDmabufFormat *f1 = &formats1->formats[i];
|
|
||||||
GdkDmabufFormat *f2 = &formats2->formats[i];
|
|
||||||
|
|
||||||
if (f1->fourcc != f2->fourcc ||
|
|
||||||
f1->modifier != f2->modifier)
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
@@ -51,8 +51,4 @@ gboolean gdk_dmabuf_formats_contains (GdkDmabufFormats *formats
|
|||||||
guint32 fourcc,
|
guint32 fourcc,
|
||||||
guint64 modifier) G_GNUC_PURE;
|
guint64 modifier) G_GNUC_PURE;
|
||||||
|
|
||||||
GDK_AVAILABLE_IN_4_14
|
|
||||||
gboolean gdk_dmabuf_formats_equal (const GdkDmabufFormats *formats1,
|
|
||||||
const GdkDmabufFormats *formats2);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "config.h"
|
#ifdef HAVE_DMABUF
|
||||||
#ifdef HAVE_DRM_FOURCC_H
|
|
||||||
#include <drm_fourcc.h>
|
#include <drm_fourcc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -25,7 +25,6 @@
|
|||||||
#include "gdkdmabufformatsbuilderprivate.h"
|
#include "gdkdmabufformatsbuilderprivate.h"
|
||||||
#include "gdkdmabuffourccprivate.h"
|
#include "gdkdmabuffourccprivate.h"
|
||||||
#include "gdkdmabufprivate.h"
|
#include "gdkdmabufprivate.h"
|
||||||
#include "gdkdmabuftexturebuilderprivate.h"
|
|
||||||
#include "gdktextureprivate.h"
|
#include "gdktextureprivate.h"
|
||||||
#include <gdk/gdkglcontext.h>
|
#include <gdk/gdkglcontext.h>
|
||||||
#include <gdk/gdkgltexturebuilder.h>
|
#include <gdk/gdkgltexturebuilder.h>
|
||||||
@@ -34,7 +33,7 @@
|
|||||||
/**
|
/**
|
||||||
* GdkDmabufTexture:
|
* GdkDmabufTexture:
|
||||||
*
|
*
|
||||||
* A `GdkTexture` representing a DMA buffer.
|
* A `GdkTexture` representing a dma-buf object.
|
||||||
*
|
*
|
||||||
* To create a `GdkDmabufTexture`, use the auxiliary
|
* To create a `GdkDmabufTexture`, use the auxiliary
|
||||||
* [class@Gdk.DmabufTextureBuilder] object.
|
* [class@Gdk.DmabufTextureBuilder] object.
|
||||||
@@ -72,10 +71,7 @@ gdk_dmabuf_texture_dispose (GObject *object)
|
|||||||
GdkDmabufTexture *self = GDK_DMABUF_TEXTURE (object);
|
GdkDmabufTexture *self = GDK_DMABUF_TEXTURE (object);
|
||||||
|
|
||||||
if (self->destroy)
|
if (self->destroy)
|
||||||
{
|
self->destroy (self->data);
|
||||||
self->destroy (self->data);
|
|
||||||
self->destroy = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_clear_object (&self->downloader);
|
g_clear_object (&self->downloader);
|
||||||
g_clear_object (&self->display);
|
g_clear_object (&self->display);
|
||||||
|
@@ -25,7 +25,6 @@
|
|||||||
#include "gdkdisplay.h"
|
#include "gdkdisplay.h"
|
||||||
#include "gdkenumtypes.h"
|
#include "gdkenumtypes.h"
|
||||||
#include "gdkdmabuftextureprivate.h"
|
#include "gdkdmabuftextureprivate.h"
|
||||||
#include "gdkdmabuftexturebuilderprivate.h"
|
|
||||||
|
|
||||||
#include <cairo-gobject.h>
|
#include <cairo-gobject.h>
|
||||||
|
|
||||||
@@ -949,20 +948,22 @@ gdk_dmabuf_texture_builder_set_update_region (GdkDmabufTextureBuilder *self,
|
|||||||
*
|
*
|
||||||
* Builds a new `GdkTexture` with the values set up in the builder.
|
* Builds a new `GdkTexture` with the values set up in the builder.
|
||||||
*
|
*
|
||||||
* It is a programming error to call this function if any mandatory property has not been set.
|
* It is a programming error to call this function if any mandatory
|
||||||
|
* property has not been set.
|
||||||
*
|
*
|
||||||
* Not all formats defined in the `drm_fourcc.h` header are supported. You can use
|
* If the dmabuf is not supported by GTK, %NULL will be returned and @error will be set.
|
||||||
* [method@Gdk.Display.get_dmabuf_formats] to get a list of supported formats. If the
|
|
||||||
* format is not supported by GTK, %NULL will be returned and @error will be set.
|
|
||||||
*
|
*
|
||||||
* The `destroy` function gets called when the returned texture gets released.
|
* The `destroy` function gets called when the returned texture gets released.
|
||||||
*
|
*
|
||||||
|
* It is possible to call this function multiple times to create multiple textures,
|
||||||
|
* possibly with changing properties in between.
|
||||||
|
*
|
||||||
* It is the responsibility of the caller to keep the file descriptors for the planes
|
* It is the responsibility of the caller to keep the file descriptors for the planes
|
||||||
* open until the created texture is no longer used, and close them afterwards (possibly
|
* open until the created texture is no longer used, and close them afterwards (possibly
|
||||||
* using the @destroy notify).
|
* using the @destroy notify).
|
||||||
*
|
*
|
||||||
* It is possible to call this function multiple times to create multiple textures,
|
* Not all formats defined in the `drm_fourcc.h` header are supported. You can use
|
||||||
* possibly with changing properties in between.
|
* [method@Gdk.Display.get_dmabuf_formats] to get a list of supported formats.
|
||||||
*
|
*
|
||||||
* Returns: (transfer full) (nullable): a newly built `GdkTexture` or `NULL`
|
* Returns: (transfer full) (nullable): a newly built `GdkTexture` or `NULL`
|
||||||
* if the format is not supported
|
* if the format is not supported
|
||||||
@@ -1003,19 +1004,3 @@ gdk_dmabuf_texture_builder_get_dmabuf (GdkDmabufTextureBuilder *self)
|
|||||||
{
|
{
|
||||||
return &self->dmabuf;
|
return &self->dmabuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
gdk_dmabuf_texture_builder_set_dmabuf (GdkDmabufTextureBuilder *self,
|
|
||||||
const GdkDmabuf *dmabuf)
|
|
||||||
{
|
|
||||||
gdk_dmabuf_texture_builder_set_fourcc (self, dmabuf->fourcc);
|
|
||||||
gdk_dmabuf_texture_builder_set_modifier (self, dmabuf->modifier);
|
|
||||||
gdk_dmabuf_texture_builder_set_n_planes (self, dmabuf->n_planes);
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < dmabuf->n_planes; i++)
|
|
||||||
{
|
|
||||||
gdk_dmabuf_texture_builder_set_fd (self, i, dmabuf->planes[i].fd);
|
|
||||||
gdk_dmabuf_texture_builder_set_stride (self, i, dmabuf->planes[i].stride);
|
|
||||||
gdk_dmabuf_texture_builder_set_offset (self, i, dmabuf->planes[i].offset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|