Compare commits

..

25 Commits

Author SHA1 Message Date
Matthias Clasen
825b2a4139 wip: benchmarks 2020-07-12 20:54:46 -04:00
Matthias Clasen
8a23649d40 stringlist: Reuse objects
Keep a bitset of positions where the array contains
objects, and check those for reusable objects whenever
we need a new object.

We still keep the low-bit marking of string pointers,
so we can implement g_list_model_get_item without having
to consult the bitset.

In scrolling through the words demo, this keeps the
number of live string objects at ~200.
2020-07-12 20:52:48 -04:00
Matthias Clasen
bf367b219b stringlist: Use an array
A version of GtkStringList that uses a GPtrArray
to hold the strings / objects. We avoid a second
array by marking strings using a low bit of the
pointer.
2020-06-30 23:37:21 -04:00
Matthias Clasen
77435d31fa gtk-demo: Use a progressbar in the words demo
This looks better and a bit more polished.
2020-07-01 02:47:50 +02:00
Matthias Clasen
6edb8f096f gtk-demo: No selection in the words demo
This demo is about filtering, not about selection,
so use a GtkNoSelection.
2020-07-01 02:46:05 +02:00
Matthias Clasen
c4dfee8860 gtk-demo: Cosmetic fixes for the words demo
Set a window size, and don't put newlines in titles, left align and
ellipsize the label.
2020-07-01 02:46:05 +02:00
Benjamin Otte
8ac1e77c9a demo: Make words listview load async
And add an "Open" button (why are filechooser buttons such a catastrophe
that I can't make them smaller?).
2020-07-01 02:46:05 +02:00
Benjamin Otte
65ceb6c15a stringlist: Call splice() for adding items after construction
This has the benefit of actually allowing NULL to be passed.
2020-07-01 02:46:05 +02:00
Benjamin Otte
f70d10f6ac stringlist: Remove n_additions argument from gtk_string_list_splice()
char ** arrays are null-terminated everywhere, so make sure they are in
splice(), too.

Also fix the argument to be a const char * const * like in the
constructor.
2020-07-01 02:46:05 +02:00
Benjamin Otte
0bbd083d79 stringlist: Clarify docs for gtk_string_list_get_string()
Make sure it's obvious that it behaves like g_list_model_get_item() and
returns NULL for pos >= n_items.
2020-07-01 02:46:05 +02:00
Benjamin Otte
102d2986c6 stringlist: Make one constructor call the other
Simplifies code.
2020-07-01 02:46:05 +02:00
Benjamin Otte
c74201ca87 filterlistmodel: Look at type of change
This way we can avoid refiltering most of an already filtered list when
the change becomes more strict.
2020-07-01 02:46:05 +02:00
Benjamin Otte
b09019a5b4 gtk-demo: Add incremental filtering to words demo 2020-07-01 02:46:05 +02:00
Benjamin Otte
1dd08ad8db filterlistmodel: Add gtk_filter_list_model_get_pending()
This allows tracking if the model is busy filtering.
2020-07-01 02:46:05 +02:00
Benjamin Otte
eb0704855f filterlistmodel: Add incremental filtering 2020-07-01 02:46:05 +02:00
Benjamin Otte
c4c1d4a1b3 bitset: Add gtk_bitset_new_range()
It's a common use.
2020-07-01 02:46:05 +02:00
Benjamin Otte
e6756f605e stringlist: Make property not construct-only
Massively speeds up creation of long stringlists.
2020-07-01 02:46:05 +02:00
Benjamin Otte
1f4b8e089e filterlistmodel: Rewrite with bitset data structure
Bitsets are more powerful, less memory intensive and faster than the old
GtkRbTree version.
2020-07-01 02:46:05 +02:00
Benjamin Otte
c0e08db739 bitset: Add APIs needed for a filterlistmodel 2020-06-30 00:46:56 +02:00
Benjamin Otte
1c337d350d tests: Make testlistview be a list again
The grid conversion was for testing and should never have been
committed.
2020-06-30 00:46:56 +02:00
Benjamin Otte
81e675dfbf gtk-demo: Add a listview demo for filtering strings 2020-06-30 00:36:14 +02:00
Benjamin Otte
8556221429 stringlist: Take a const char const * argument
Sucks that we need to cast a char**, but otherwise we need to cast
{"foo", "bar", "baz" } arrays.
2020-06-30 00:36:14 +02:00
Benjamin Otte
1b4109a7fd scrolledwindow: Expand by default
Use gtk_scrolled_window_set_hexpand/vexpand(FALSE) to make the scrolled
window not expand.
2020-06-30 00:36:13 +02:00
Benjamin Otte
df0786be7a stringfilter: Don't crash if the expression returns "" 2020-06-30 00:36:13 +02:00
Benjamin Otte
3f545da08d a11y: Remove double initialization of variables 2020-06-30 00:36:13 +02:00
2483 changed files with 298553 additions and 282182 deletions

View File

@@ -1,7 +1,3 @@
include:
- project: 'gnome/citemplates'
file: 'flatpak/flatpak_ci_initiative.yml'
stages: stages:
- build - build
- analysis - analysis
@@ -20,13 +16,13 @@ stages:
# Common variables # Common variables
variables: variables:
COMMON_MESON_FLAGS: "-Dwerror=true -Dglib:werror=false -Dpango:werror=false -Dgtk-doc:werror=false -Dwayland-protocols:werror=false -Dsysprof:werror=false" COMMON_MESON_FLAGS: "--fatal-meson-warnings --werror"
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true" BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true -Dvulkan=yes"
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled" FEATURE_FLAGS: "-Dcloudproviders=true"
MESON_TEST_TIMEOUT_MULTIPLIER: 3 MESON_TEST_TIMEOUT_MULTIPLIER: 2
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v25" FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v17"
FLATPAK_IMAGE: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master" FLATPAK_IMAGE: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master"
DOCS_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora-docs:v25" DOCS_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora-docs:v19"
.only-default: .only-default:
only: only:
@@ -72,12 +68,11 @@ style-check-diff:
fedora-x86_64: fedora-x86_64:
extends: .build-fedora-default extends: .build-fedora-default
stage: build stage: build
needs: []
variables: variables:
EXTRA_MESON_FLAGS: "--buildtype=debug --default-library=both" EXTRA_MESON_FLAGS: "--buildtype=debug --default-library=both"
script: script:
- meson subprojects update
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} ${BACKEND_FLAGS} ${FEATURE_FLAGS} - meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} ${BACKEND_FLAGS} ${FEATURE_FLAGS}
-Dprofiler=true
_build _build
- ninja -C _build - ninja -C _build
- .gitlab-ci/run-tests.sh _build x11 - .gitlab-ci/run-tests.sh _build x11
@@ -87,39 +82,14 @@ fedora-x86_64:
release-build: release-build:
extends: .build-fedora-default extends: .build-fedora-default
stage: build stage: build
needs: []
variables: variables:
EXTRA_MESON_FLAGS: "--buildtype=release" EXTRA_MESON_FLAGS: "--buildtype=release"
script: script:
- meson subprojects update
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} ${BACKEND_FLAGS} ${FEATURE_FLAGS} - meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} ${BACKEND_FLAGS} ${FEATURE_FLAGS}
_build _build
- ninja -C _build - ninja -C _build
- .gitlab-ci/run-tests.sh _build x11 - .gitlab-ci/run-tests.sh _build x11
installed-tests:
extends: .build-fedora-default
stage: build
needs: []
variables:
EXTRA_MESON_FLAGS: "--prefix=/usr --libdir=/usr/lib64 -Dinstall-tests=true"
G_TEST_ACCESSIBLE: 1
script:
- meson subprojects update
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} ${BACKEND_FLAGS} ${FEATURE_FLAGS}
_build
- ninja -C _build
- sudo ninja -C _build install
- dbus-run-session xvfb-run -a -s "-screen 0 1024x768x24"
gnome-desktop-testing-runner
--report-directory=_build/installed-tests-report/failed/
--parallel=0
gtk-4.0
artifacts:
paths:
- "_build/installed-tests-report/"
.mingw-defaults: .mingw-defaults:
stage: build stage: build
tags: tags:
@@ -139,7 +109,6 @@ installed-tests:
msys2-mingw64: msys2-mingw64:
extends: .mingw-defaults extends: .mingw-defaults
needs: []
variables: variables:
MSYSTEM: "MINGW64" MSYSTEM: "MINGW64"
CHERE_INVOKING: "yes" CHERE_INVOKING: "yes"
@@ -153,7 +122,6 @@ msys2-mingw64:
artifacts: artifacts:
paths: paths:
- "${APPID}-dev.flatpak" - "${APPID}-dev.flatpak"
- 'repo.tar'
expire_in: 1 day expire_in: 1 day
script: script:
- bash -x ./.gitlab-ci/flatpak-build.sh "${APPID}" - bash -x ./.gitlab-ci/flatpak-build.sh "${APPID}"
@@ -171,62 +139,37 @@ msys2-mingw64:
flatpak-manual:demo: flatpak-manual:demo:
extends: .flatpak-manual extends: .flatpak-manual
needs: []
variables: variables:
APPID: org.gtk.Demo4 APPID: org.gtk.Demo4
flatpak-master:demo: flatpak-master:demo:
extends: .flatpak-master extends: .flatpak-master
needs: []
variables: variables:
APPID: org.gtk.Demo4 APPID: org.gtk.Demo4
flatpak-manual:widget-factory: flatpak-manual:widget-factory:
extends: .flatpak-manual extends: .flatpak-manual
needs: []
variables: variables:
APPID: org.gtk.WidgetFactory4 APPID: org.gtk.WidgetFactory4
flatpak-master:widget-factory: flatpak-master:widget-factory:
extends: .flatpak-master extends: .flatpak-master
needs: []
variables: variables:
APPID: org.gtk.WidgetFactory4 APPID: org.gtk.WidgetFactory4
flatpak-manual:icon-browser: flatpak-manual:icon-browser:
extends: .flatpak-manual extends: .flatpak-manual
needs: []
variables: variables:
APPID: org.gtk.IconBrowser4 APPID: org.gtk.IconBrowser4
flatpak-master:icon-browser: flatpak-master:icon-browser:
extends: .flatpak-master extends: .flatpak-master
needs: []
variables: variables:
APPID: org.gtk.IconBrowser4 APPID: org.gtk.IconBrowser4
# Publish the demo apps to the GNOME Nightly repo
# https://wiki.gnome.org/Apps/Nightly
# https://gitlab.gnome.org/GNOME/Initiatives/-/wikis/DevOps-with-Flatpak
nightly demo:
extends: '.publish_nightly'
dependencies: ['flatpak-master:demo']
needs: ['flatpak-master:demo']
nightly factory:
extends: '.publish_nightly'
dependencies: ['flatpak-master:widget-factory']
needs: ['flatpak-master:widget-factory']
nightly icon-browser:
extends: '.publish_nightly'
dependencies: ['flatpak-master:icon-browser']
needs: ['flatpak-master:icon-browser']
static-scan: static-scan:
image: $FEDORA_IMAGE image: $FEDORA_IMAGE
stage: analysis stage: analysis
needs: []
variables: variables:
EXTRA_MESON_FLAGS: "--buildtype=debug" EXTRA_MESON_FLAGS: "--buildtype=debug"
script: script:
@@ -237,27 +180,9 @@ static-scan:
- _scan_build/meson-logs - _scan_build/meson-logs
allow_failure: true allow_failure: true
# Run tests with the address sanitizer. We need to turn off introspection,
# since it is incompatible with asan
asan-build:
image: $FEDORA_IMAGE
tags: [ asan ]
stage: analysis
needs: []
variables:
script:
- CC=clang meson --buildtype=debugoptimized -Db_sanitize=address -Db_lundef=false -Dintrospection=disabled _build
- ninja -C _build
- .gitlab-ci/run-tests.sh _build wayland
artifacts:
paths:
- _build/meson-logs
allow_failure: true
reference: reference:
image: $DOCS_IMAGE image: $DOCS_IMAGE
stage: docs stage: docs
needs: []
variables: variables:
EXTRA_MESON_FLAGS: "--buildtype=release" EXTRA_MESON_FLAGS: "--buildtype=release"
script: script:
@@ -273,7 +198,6 @@ reference:
pages: pages:
stage: deploy stage: deploy
needs: ['reference']
script: script:
- mv _reference/ public/ - mv _reference/ public/
artifacts: artifacts:

View File

View File

@@ -35,13 +35,4 @@ branch, as well as their available versions.
- [ ] Add the new job to `.gitlab-ci.yml` referencing the image - [ ] Add the new job to `.gitlab-ci.yml` referencing the image
- [ ] Open a merge request with your changes and let it run - [ ] Open a merge request with your changes and let it run
### Checklist for Adding a new dependency to a CI image
Our images are layered, and the base (called fedora-base) contains
all the rpm payload. Therefore, adding a new dependency is a 2-step
process:
1. [ ] Build and upload fedora-base:$version+1
1. [ ] Build and upload fedora:$version+1 based on fedora-base:version+1
[registry]: https://gitlab.gnome.org/GNOME/gtk/container_registry [registry]: https://gitlab.gnome.org/GNOME/gtk/container_registry

View File

@@ -29,7 +29,6 @@ RUN dnf -y install \
glib2-static \ glib2-static \
glibc-devel \ glibc-devel \
glibc-headers \ glibc-headers \
gnome-desktop-testing \
gobject-introspection-devel \ gobject-introspection-devel \
graphene-devel \ graphene-devel \
gstreamer1-devel \ gstreamer1-devel \
@@ -42,15 +41,12 @@ RUN dnf -y install \
itstool \ itstool \
json-glib-devel \ json-glib-devel \
lcov \ lcov \
libasan \
libattr-devel \ libattr-devel \
libcloudproviders-devel \
libepoxy-devel \ libepoxy-devel \
libffi-devel \ libffi-devel \
libmount-devel \ libmount-devel \
librsvg2 \ librsvg2 \
libselinux-devel \ libselinux-devel \
libubsan \
libXcomposite-devel \ libXcomposite-devel \
libXcursor-devel \ libXcursor-devel \
libXcursor-devel \ libXcursor-devel \
@@ -77,6 +73,7 @@ RUN dnf -y install \
python3-wheel \ python3-wheel \
redhat-rpm-config \ redhat-rpm-config \
sassc \ sassc \
sysprof-devel \
systemtap-sdt-devel \ systemtap-sdt-devel \
vulkan-devel \ vulkan-devel \
wayland-devel \ wayland-devel \
@@ -87,5 +84,5 @@ RUN dnf -y install \
xorg-x11-server-Xvfb \ xorg-x11-server-Xvfb \
&& dnf clean all && dnf clean all
RUN pip3 install meson==0.55.3 RUN pip3 install meson==0.53.1

View File

@@ -1,4 +1,4 @@
FROM registry.gitlab.gnome.org/gnome/gtk/fedora-base:v25 FROM registry.gitlab.gnome.org/gnome/gtk/fedora-base:v19
RUN dnf -y install pandoc RUN dnf -y install pandoc

View File

@@ -1,11 +1,8 @@
FROM registry.gitlab.gnome.org/gnome/gtk/fedora-base:v25 FROM registry.gitlab.gnome.org/gnome/gtk/fedora-base:v19
# Enable sudo for wheel users
RUN sed -i -e 's/# %wheel/%wheel/' -e '0,/%wheel/{s/%wheel/# %wheel/}' /etc/sudoers
ARG HOST_USER_ID=5555 ARG HOST_USER_ID=5555
ENV HOST_USER_ID ${HOST_USER_ID} ENV HOST_USER_ID ${HOST_USER_ID}
RUN useradd -u $HOST_USER_ID -G wheel -ms /bin/bash user RUN useradd -u $HOST_USER_ID -ms /bin/bash user
USER user USER user
WORKDIR /home/user WORKDIR /home/user

View File

@@ -22,7 +22,7 @@ flatpak build ${builddir} meson \
-Dprint-backends=file \ -Dprint-backends=file \
-Dbuild-tests=false \ -Dbuild-tests=false \
-Dbuild-examples=false \ -Dbuild-examples=false \
-Dintrospection=disabled \ -Dintrospection=false \
-Ddemos=true \ -Ddemos=true \
_flatpak_build _flatpak_build
@@ -40,8 +40,3 @@ flatpak build-bundle \
${appid}-dev.flatpak \ ${appid}-dev.flatpak \
--runtime-repo=https://nightly.gnome.org/gnome-nightly.flatpakrepo \ --runtime-repo=https://nightly.gnome.org/gnome-nightly.flatpakrepo \
${appid} ${appid}
# to be consumed by the nightly publish jobs
if [[ $CI_COMMIT_BRANCH == master ]]; then
tar cf repo.tar ${repodir}
fi

View File

@@ -7,17 +7,14 @@ srcdir=$( pwd )
builddir=$1 builddir=$1
backend=$2 backend=$2
# Ignore memory leaks lower in dependencies
export LSAN_OPTIONS=suppressions=$srcdir/lsan.supp
case "${backend}" in case "${backend}" in
x11) x11)
xvfb-run -a -s "-screen 0 1024x768x24 -noreset" \ xvfb-run -a -s "-screen 0 1024x768x24" \
meson test -C ${builddir} \ meson test -C ${builddir} \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--print-errorlogs \ --print-errorlogs \
--setup=${backend} \ --setup=${backend} \
--suite=gtk \ --suite=gtk \
--no-suite=gtk:a11y \
--no-suite=gsk-compare-broadway --no-suite=gsk-compare-broadway
# Store the exit code for the CI run, but always # Store the exit code for the CI run, but always
@@ -33,10 +30,10 @@ case "${backend}" in
export WAYLAND_DISPLAY=wayland-5 export WAYLAND_DISPLAY=wayland-5
meson test -C ${builddir} \ meson test -C ${builddir} \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--print-errorlogs \ --print-errorlogs \
--setup=${backend} \ --setup=${backend} \
--suite=gtk \ --suite=gtk \
--no-suite=gtk:a11y \
--no-suite=gsk-compare-broadway --no-suite=gsk-compare-broadway
exit_code=$? exit_code=$?
@@ -51,10 +48,10 @@ case "${backend}" in
export BROADWAY_DISPLAY=:5 export BROADWAY_DISPLAY=:5
meson test -C ${builddir} \ meson test -C ${builddir} \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--print-errorlogs \ --print-errorlogs \
--setup=${backend} \ --setup=${backend} \
--suite=gtk \ --suite=gtk \
--no-suite=gtk:a11y \
--no-suite=gsk-compare-opengl --no-suite=gsk-compare-opengl
# don't let Broadway failures fail the run, for now # don't let Broadway failures fail the run, for now

View File

@@ -33,40 +33,30 @@ pacman --noconfirm -S --needed \
mingw-w64-$MSYS2_ARCH-gst-plugins-bad \ mingw-w64-$MSYS2_ARCH-gst-plugins-bad \
mingw-w64-$MSYS2_ARCH-shared-mime-info mingw-w64-$MSYS2_ARCH-shared-mime-info
# https://gitlab.gnome.org/GNOME/gtk/issues/2243
wget "https://gitlab.gnome.org/creiter/gitlab-ci-win32-runner-v2/raw/master/pango/mingw-w64-$MSYS2_ARCH-pango-git-1.44.7.90.ge48ae523-1-any.pkg.tar.zst"
pacman --noconfirm -U "mingw-w64-$MSYS2_ARCH-pango-git-1.44.7.90.ge48ae523-1-any.pkg.tar.zst"
# https://github.com/msys2/MINGW-packages/pull/6465
pacman --noconfirm -S --needed mingw-w64-$MSYS2_ARCH-brotli
mkdir -p _ccache mkdir -p _ccache
export CCACHE_BASEDIR="$(pwd)" export CCACHE_BASEDIR="$(pwd)"
export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache" export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
# https://gitlab.gnome.org/GNOME/gtk/-/issues/2243
# https://gitlab.gnome.org/GNOME/gtk/-/issues/3002
if ! pkg-config --atleast-version=2.65.0 glib-2.0; then
git clone https://gitlab.gnome.org/GNOME/glib.git _glib
meson setup _glib_build _glib
meson compile -C _glib_build
meson install -C _glib_build
fi
pkg-config --modversion glib-2.0
if ! pkg-config --atleast-version=1.47.0 pango; then
git clone https://gitlab.gnome.org/GNOME/pango.git _pango
meson setup _pango_build _pango
meson compile -C _pango_build
meson install -C _pango_build
fi
pkg-config --modversion pango
# Build # Build
ccache --zero-stats ccache --zero-stats
ccache --show-stats ccache --show-stats
export CCACHE_DISABLE=true export CCACHE_DISABLE=true
# FIXME: introspection disabled for now because of
# https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/340
meson \ meson \
-Dx11-backend=false \ -Dx11-backend=false \
-Dwayland-backend=false \ -Dwayland-backend=false \
-Dwin32-backend=true \ -Dwin32-backend=true \
-Dvulkan=disabled \ -Dvulkan=no \
-Dintrospection=enabled \ -Dintrospection=false \
-Dgtk:werror=true \ --werror \
_build _build
unset CCACHE_DISABLE unset CCACHE_DISABLE

30
AUTHORS
View File

@@ -1,5 +1,5 @@
Please do not mail any of the authors listed here Please do not mail any of the authors listed here
asking questions about this version of GTK. asking questions about this version of GTK+.
Original Authors Original Authors
---------------- ----------------
@@ -7,8 +7,8 @@ Peter Mattis <petm@xcf.berkeley.edu>
Spencer Kimball <spencer@xcf.berkeley.edu> Spencer Kimball <spencer@xcf.berkeley.edu>
Josh MacDonald <jmacd@xcf.berkeley.edu> Josh MacDonald <jmacd@xcf.berkeley.edu>
The Team that build GTK 2 (in alphabetical order) The GTK+ Team (in alphabetical order)
------------------------------------------------- -------------------------------------
Shawn T. Amundson <amundson@gtk.org> Shawn T. Amundson <amundson@gtk.org>
Jerome Bolliet <bolliet@gtk.org> Jerome Bolliet <bolliet@gtk.org>
Damon Chaplin <damon@gtk.org> Damon Chaplin <damon@gtk.org>
@@ -28,24 +28,11 @@ Jay Painter <jpaint@gtk.org>
Manish Singh <manish@gtk.org> Manish Singh <manish@gtk.org>
Owen Taylor <otaylor@gtk.org> Owen Taylor <otaylor@gtk.org>
The current team (GTK 3 and 4)
------------------------------
Jonas Ådahl <jadahl@gmail.com>
Tim Bäder <mail@baedert.org>
Emmanuele Bassi <ebassi@gnome.org>
Chun-wei Fan <fanchunwei@src.gnome.org>
Matthias Clasen <mclasen@redhat.com>
Carlos Garnacho <mrgarnacho@gmail.com>
Alexander Larsson <alexl@redhat.com>
Benjamin Otte <otte@gnome.org>
There are many others who have contributed patches; we thank them, There are many others who have contributed patches; we thank them,
GTK is much better because of them. GTK+ is much better because of them.
Over time, GTK has incorporated some pieces of software which Over time, GTK+ has incorporated some pieces of software which
started as independent projects. We list the original authors here: started as independent projects. We list the original authors here:
@@ -76,8 +63,3 @@ DirectFB backend
Denis Oliver Kropp Denis Oliver Kropp
Sven Neumann Sven Neumann
Mike Emmel Mike Emmel
gtkparasite
-----------
Christian Hammond

View File

@@ -56,12 +56,6 @@ If the issue includes a crash, you should also include:
0. the eventual warnings printed on the terminal 0. the eventual warnings printed on the terminal
0. a backtrace, obtained with tools such as GDB or LLDB 0. a backtrace, obtained with tools such as GDB or LLDB
It is fine to include screenshots of screen recordings to demonstrate
an issue that is best to understand visually, but please don't just
dump screen recordings without further details into issues. It is
essential that the problem is described in enough detail to reproduce
it without watching a video.
For small issues, such as: For small issues, such as:
- spelling/grammar fixes in the documentation - spelling/grammar fixes in the documentation

638
NEWS
View File

@@ -1,641 +1,3 @@
Overview of Changes in GTK 4.0
==============================
* Fix problems with synthetic motion events affecting frame rates
* Fix problems with implicit grabs affecting widget states
* Fix problems with zoom mode on scales getting stuck
* Fix submenu closing by outside clicks
* Rename GtkWindow:fullscreen to :fullscreened to help
language bindings
* Bump the soname. Stable GTK 4 releases use libgtk-4.0.so.1.xxxx.y
* Adwaita:
- Reduce hover transition effects in lists
- Special-case header buttons
* Demos:
- Remove NoDisplay from desktop files
- Autoplay the video in widget-factory
* Translation updates:
Catalan
Norwegian Bokmål
Polish
Spanish
Swedish
Romanian
Ukrainian
Overview of Changes in 3.99.5
=============================
* Accessibility:
- Map presentation role according to Core-AAM
- Use presentation role for spacers in list views
- Set proper roles, relations and descriptions on more widgets
- Expand the documentation
- Use a single GTK_A11Y environment variable and document it
- Serveral memory leak and crash fixes
- Initialize AT contexts lazily
- Improve the API for storing lists in relations
- Implement more of the Component interface
- Implement the Cache interface
- Implement ScrollSubstringTo for GtkTextView
* Introspection:
- Add many missing annotations to APIs
- In particular, nullability annotation fixes for rust
* Touch support:
- Fix issues with text handles
- Fix interaction between touch scrolling and focus
- Fix active state updates for touch events
- Allow pressing buttons with multiple fingers
* GtkScrolledWindow:
- Accumulate velocity with kinetic scrolling
* GtkSearchEntry:
- Use a better clear icon
* GtkTreeView:
- Remove the deprecated GtkCellRendererClass.get_size vfunc
* GtkBuilder:
- Be stricter about <requires>
- Make gtk-builder-tool simplify update <requires>
* GtkFileChooser:
- Remove GtkFileChooserButton
* GtkWindow:
- Replace gtk_window_get_size with gtk_window_get_default_size
- Add maximized and fullscreen properties
* Make the inspector available in non-debug builds
* CSS:
- Support conic gradients
* Adwaita:
- Round all window corners
- Round submenus
- Remove the 'chin' on menus
- Industrial style menuitems
- Improved tooltip styling
- Unified sidebar styles
- Dark prelight
- Don't backdrop labels
* GSK:
- Rename render node apis from peek to get
* Make GLES work in the absence of GL_ARB_timer_query
* Rework the way size allocation is integrated in the
frame cycle
* Wayland:
- Support gtk_shell1 version 3 (startup notification
and activation)
- Implmement minimization
* OS X:
- Mostly working GL renderer
- Search engine updates
- Fix rendering artifacts with hover transitions
- Fix kinetic scrolling deceleration
* Windows:
- Fix key event generation, making text input work
* Documentation:
- Add missing enumerations, symbols and types
- Lots of smaller fixes
* Demos:
- Make the constraints demo more useful
- Make search more obvious
- Add a suggestion entry demo
- Consistency improvements
- Use native file choosers
- Drop 'devel' styling
* Translation updates:
Belarusian
Catalan
Polish
Spanish
Swedish
Ukrainian
Overview of Changes in 3.99.4
=============================
* GtkColumnView:
- Improve column resizing
- Make double-click reset column widths
- Move header outside of scrollbars
* GtkSearchEntry:
- Add an icon
* GtkDropDown:
- Polish the appearance
* GtkColorChooser:
- Accessibility improvements
* GtkPopoverMenu:
- Add accessibility support
- Allow custom items. This adds new API:
gtk_popover_menu_add/remove_child
gtk_popover_menu_bar_add/remove_child
* GtkTextView:
- Fix rendering and positioning of anchored children
- Fix positioning of touch handles
* Constraints:
- Fix loading constraints from ui files
* Media support:
- Use cubic instead of linear volume
* Accessibility:
- Implement Component for all widgets
- Implement Text and EditableText for all editables
- Rework accessible name/description computation
- Add documentation for app and widget developers
- Handle HIDDEN state changes by adding/removing elements
- Support setting accessibility attributes in ui files
- Make window controls accessible
* Introspection:
- Add some missing annotations
* gdk:
- Deliver events on flush
- Drop the unused GdkPoint struct from the API
- Improve popup autohide behavior
* Demos:
- Add another constraints demo
- Tweak various demos to improve consistency
- Small accessibility improvements
* Tools:
- Improve gtk4-builder-tool handling of various
widgets when converting ui files from GTK 3
* Documentation:
- Use GtkApplication in all examples
- Improve and expand the widget gallery
* Testsuite:
- Improve coverage of GDK
- Improve coverage of gtk4-builder-tool
* Build:
- Fix the build with cups 2.2.12
- Make cloudprint support build without warnings
* Broadway:
- Support modifiers for scroll events
* Windows:
- Improve IME support
* OS X:
- Fix various input issues
- Make GtkGLArea work (with the cairo backend)
* Translation updates:
German
Polish
Overview of Changes in 3.99.3
=============================
* Accessibility:
- Add an initial AT-SPI backend
* GtkEmojiChooser:
- Allow inserting multiple Emoji by pressing Control
- Update Emoji data to Unicode 13 / CLDR 37
- Use translations
- The recent-emoji setting type changed. Call
gsettings reset org.gtk.gtk4.Settings.EmojiChooser recent-emoji
* GtkTextBuffer:
- Add boolean returns to some get_iter functions
* GtkScale:
- Change the default value of the :draw-value property
* GtkPopover:
- Avoid losing focus when popovers are close
* GtkColorChooser:
- Add color names back for accessibility
* Input methods:
- Add a 'private' input hint
* GL Renderer:
- Fix issues with texture caching
- Fix texture flipping problems
* Build:
- Use meson yield feature for some options
- Require gtk-doc 1.33
- Require sysprof 3.38
* Wayland:
- Clean up Wayland backend api, add annotations
- Generate introspection for Wayland backend api
* Windows:
- Fix modal window handling and window stacking
* MacOS:
- Fix the build
- Define GDK_WINDOWING_MACOS
- Fix various event handling issues
* Demos:
- Add another column view demo
- Add an svg paintable demo
* Translation updates
Czech
Lithuanian
Polish
Overview of Changes in GTK 3.99.2
=================================
* GtkButton:
- Check coordinates for button releases
* GtkColorChooser:
- Update the default palette
* GtkEntry:
- Fix issues with Emoji insertion
- Fix issues with dnd
- Set correct hotspot for dnd icon
* GtkFileChooser:
- Fix a crash
- Fix setting unlisted filters
* GtkFontChooser:
- Determine sample text based on font coverage (requires fontconfig)
- Allow filtering by language (requires fontconfig)
- Don't center the list
* GtkMenuButton:
- Always use the direction property for the arrow
* GtkPasswordEntry:
- Use non-pageable memory
- Add an ::activate signal
* GtkRevealer:
- Fix clipping issues in the swing transitions
* GtkScrolledWindow:
- Fix kinetic scrolling in X11
* GtkSearchEntry:
- Don't handle forwarded events twice
* GtkStack:
- Add gtk_stack_add_child
* GtkTextView:
- Fix dnd
- Improve undo state tracking
- Speed rendering in the presence of selections
- Make clickable links work again
- Fix handling of anchored children
* GtkVideo:
- Make autoplay work
* CSS:
- Allow more than 64 selectors per rule
- Avoid some allocation overhead
* Adwaita:
- Improve gesture graphics
- Tweak DND highlight color
- Add spacing to .navigation-sidebar
* GDK:
- Add gdk_frame_clock_get_fps
- GLES: Fix color channel mixup in textures
- GL: Reduce image copying for texture uploads
* GSK:
- Add radial gradient nodes
- Add GskGLShader and shader nodes
* GL renderer:
- Fix clipping with projective transforms
- Use linear interpolation for offscreen rendering
with non-axis-aligned transforms
- Fix texture caching to avoid size mismatches
- Avoid downloading GL textures when possible,
improving GtkGLArea performance
* Vulkan renderer:
- Fix swapchain creation
* Windows:
- Fix display of CSD windows
* Wayland
- Always ack configure to avoid jumping windows
- Use the primary-selection-unstable-v1 protocol
* API cleanups:
- Make filter and sorter constructors return exact types
- Rename GdkSurfaceState to GdkToplevelState
- Remove GdkWaylandSurface::committed
- Make Wayland backend api take GdkToplevel
- Drop gtk_widget_new
- Drop cairo_surface_upload_to_gl
- Drop gtk_scrolled_window_set_capture_button_press
- Drop gtk_column_view_column_new_with_factory
- Rename gtk_buildable_set_name to gtk_buildable_set_buildable_id
- Drop other GtkBuildable api
* Demos:
- Bug and crash fixes
- Cosmetic improvements for several demos
- Improve search in the sidebar
- Add a Shadertoy demo
- Add a OpenGL transitions demo
- Add an Emblem demo
- Add a demo for input validation and error states
- Add a demo for context menus
- Make gtk-demo demo itself
* Build:
- Fix Vulkan dependency checking
- Make sysprof truly optional
* Translation updates:
Basque
British English
Catalan
Croatian
Czech
Danish
French
Galician
German
Hebrew
Hungarian
Indonesian
Italian
Kazakh
Latvian
Lithuanian
Persian
Polish
Slovak
Slovenian
Spanish
Turkish
Ukrainian
Overview of Changes in GTK 3.99.1
=================================
* GtkGridLayout: Rename left-/top-attach to column/row
* Drop GtkAccelLabel - it is no longer used
* GtkTextView:
- Fix redraw issues with selections
- Make insert-emoji replace the selection
* GtkTreeView:
- Fix selection handling in cell editables
* GtkPopover:
- Allow setting popup offset
* GtkPlacesSidebar:
- Fix DND
* GtkTextview:
- Speed up gtk_text_buffer_insert_markup
* GtkFrame:
- Set GTK_OVERFLOW_HIDDEN
* GtkSpinButton:
- Fix spinning
* GtkFontChooser:
- Populate the list incrementally
* GtkButton: Simplify the button hierarchy; GtkRadioButton
is gone, GtkCheckButton and GtkToggleButton can be grouped
* list widgets:
- Change apis to make models explicitly GtkSelectionModel
- Simplify constructors
* CSS:
- Hexadecimal colors can now specify alpha
- Fix parsing of numbers in scientific notation
* Themes:
- Add and document highlevel list styles
- Drop the style class defines. Just use string literals
- Round the corners of frames
- Make circular buttons square
* GL renderer:
- Fix clipping with projective transforms
* Documentation:
- Refresh the widget gallery
- Add images for new widgets to the gallery
- Fix many cross-references
- Make sure tutorial examples are buildable
* Demos:
- Numerous crash- and bug fixes
- Improve about dialogs
- gtk4-demo: Modernize source highlighting
- gtk4-demo: Improve sidebar filtering
- gtk4-demo: Drop some outdated demos
- gtk4-demo: Polish a number of existing demos
- gtk4-demo: Add several new demos
- widget-factory: Show error states
* Tools:
- Make gtk4-builder-tool rewrite GtkBox
- Make gtk4-builder-tool rewrite radio buttons
- Rewrite the profiling support, drop support
for D-Bus profiler activation, use SYSPROF_TRACE_FD
* Printing:
- Fix build with cups < 2.3
* win32:
- Default to the GL renderer when we can
* Broadway:
- Fix handling of opaque colors
- Fix handling of debug nodes
- Prune clipped render nodes
* Wayland:
- Support newer schemas for settings
- Fix DND hotspot handling
- Disconnect on display close
* Translation updates:
Basque
Brazilian Portuguese
British English
Catalan
Chinese (China)
Croatian
Galician
German
Greek
Indonesian
Japanese
Kazakh
Korean
Lithuanian
Polish
Romanian
Slovenian
Spanish
Turkish
Ukrainian
Overview of Changes in GTK 3.99.0
=================================
* Remove the old accessibility implementation and
add the foundations for a new one that is based
on ARIA. The relevant widget api is GtkAccessible,
the backend implementations will use GtkATContext.
Currently, there is just a nascent test backend.
* Update the GTK headers to use char *, int, float and
double instead of the corresponding GLib types.
* Add GtkEditableLabel, a label that can be edited
* Add GtkBookmarkList, a list model for bookmarks
* Add GtkStringList, a list model for strings
* Add GtkBitset, and use it for representing selections
* GtkTreeView:
- Make cell editing work again
* GtkSpinButton:
- Make autosizing work again
* Printing:
- Use GtkDropDown in the print dialog
* GtkApplication
- Support opening files on OS X
* GtkFileChooser:
- Fix libcloudproviders support
- Turn GtkFileFilter into a GtkFilter
- Simplify the api
* GtkGridView, GtkListView:
- Improve scrolling behavior
- Autoscroll and autoexpand during DND
* GtkScrolledWindow:
- Make autoscrolling work again
* GtkFilterListModel:
- Add incremental filtering
- Add a boolean filter, GtkBoolFilter
* GtkSortListModel:
- Use timsort
- Add various tweaks that massively speed up sorting
- Add incremental sorting
* GtkWidget:
- Massively speed up action handling
* GtkEntry:
- Make entry completion work again
- Drop action support from GtkEntryCompletion
* Inspector:
- Improve list model support
- Add direct navigation between objects
- Show accessibility information
* GDK:
- Compress scroll events
- Keep a scroll history
- Clean up GdkDevice api
- Drop the master/slave device split
- Move axes to GdkDeviceTool
- Change monitor workarea to be per-backend API
- Improve frame clock accuracy
- Add a new macOS backend
- Add an ANGLE-based GLES renderer for Windows
* GSK:
- Use GL_ARB_framebuffer_object
* gtk-demo:
- Add incremental refill to the color grid
- Improve performance of the color grid
- Add an incrementally filtering word list
- Improve the sidebar
* Install print-editor as another demo
* Translation updates
Basque
Catalan
Chinese
Japanese
Kazakh
Lithuanian
Polish
Romanian
Spanish
Turkish
Ukrainian
Overview of Changes in GTK 3.98.5 Overview of Changes in GTK 3.98.5
================================= =================================

View File

@@ -1,7 +1,7 @@
GTK — The GTK toolkit GTK — The GTK toolkit
===================== =====================
[![Build status](https://gitlab.gnome.org/GNOME/gtk/badges/master/pipeline.svg)](https://gitlab.gnome.org/GNOME/gtk/-/commits/master) [![Build Status](https://gitlab.gnome.org/GNOME/gtk/badges/master/build.svg)](https://gitlab.gnome.org/GNOME/gtk/pipelines)
General information General information
------------------- -------------------
@@ -17,7 +17,7 @@ license fees or royalties.
The official download location The official download location
- https://download.gnome.org/sources/gtk/ - https://download.gnome.org/sources/gtk+
The official web site The official web site
@@ -49,13 +49,14 @@ In order to build GTK you will need:
You will also need various dependencies, based on the platform you are You will also need various dependencies, based on the platform you are
building for: building for:
- [GLib](https://download.gnome.org/sources/glib/) - [GLib](https://download.gnome.org/sources/glib)
- [GdkPixbuf](https://download.gnome.org/sources/gdk-pixbuf/) - [GdkPixbuf](https://download.gnome.org/sources/gdk-pixbuf)
- [GObject-Introspection](https://download.gnome.org/sources/gobject-introspection/) - [GObject-Introspection](https://download.gnome.org/sources/gobject-introspection)
- [Cairo](https://www.cairographics.org/) - [Cairo](https://www.cairographics.org)
- [Pango](https://download.gnome.org/sources/pango/) - [Pango](https://download.gnome.org/sources/pango)
- [Epoxy](https://github.com/anholt/libepoxy) - [Epoxy](https://github.com/anholt/libepoxy)
- [Graphene](https://github.com/ebassi/graphene) - [Graphene](https://github.com/ebassi/graphene)
- [ATK](https://download.gnome.org/sources/atk)
- [Xkb-common](https://github.com/xkbcommon/libxkbcommon) - [Xkb-common](https://github.com/xkbcommon/libxkbcommon)
If you are building the X11 backend, you will also need: If you are building the X11 backend, you will also need:
@@ -69,6 +70,7 @@ If you are building the X11 backend, you will also need:
- xcursor - xcursor
- xdamage - xdamage
- xcomposite - xcomposite
- [atk-bridge-2.0](https://download.gnome.org/sources/at-spi2-atk)
If you are building the Wayland backend, you will also need: If you are building the Wayland backend, you will also need:
@@ -98,7 +100,7 @@ And, finally, you can install GTK using:
$ sudo ninja install $ sudo ninja install
``` ```
Complete information about installing GTK and related libraries Complete information about installing GTK+ and related libraries
can be found in the file: can be found in the file:
``` ```
@@ -161,7 +163,3 @@ version 2.1 or, at your option, any later version, as published by the Free
Software Foundation. Software Foundation.
Please, see the [`COPYING`](./COPYING) file for further information. Please, see the [`COPYING`](./COPYING) file for further information.
GTK includes a small number of source files under the Apache license:
- A fork of the roaring bitmaps implementation in [gtk/roaring](./gtk/roaring)
- An adaptation of timsort from python in [gtk/timsort](./gtk/timsort)

View File

@@ -1,38 +1,29 @@
{ {
"app-id" : "org.gtk.Demo4", "app-id": "org.gtk.Demo4",
"runtime" : "org.gnome.Platform", "runtime": "org.gnome.Platform",
"runtime-version" : "master", "runtime-version": "master",
"sdk" : "org.gnome.Sdk", "sdk": "org.gnome.Sdk",
"command" : "gtk4-demo", "command": "gtk4-demo",
"tags" : [ "tags": ["devel", "development", "nightly"],
"devel", "desktop-file-name-prefix": "(Development) ",
"development", "finish-args": [
"nightly"
],
"desktop-file-name-prefix" : "(Development) ",
"finish-args" : [
"--device=dri", "--device=dri",
"--share=ipc", "--share=ipc",
"--socket=fallback-x11", "--socket=fallback-x11",
"--socket=wayland", "--socket=wayland",
"--talk-name=org.gtk.vfs", "--talk-name=org.gtk.vfs", "--talk-name=org.gtk.vfs.*"
"--talk-name=org.gtk.vfs.*"
], ],
"cleanup" : [ "cleanup": [
"/include", "/include",
"/lib/pkgconfig", "/lib/pkgconfig", "/share/pkgconfig",
"/share/pkgconfig",
"/share/aclocal", "/share/aclocal",
"/man", "/man", "/share/man", "/share/gtk-doc",
"/share/man", "*.la", ".a",
"/share/gtk-doc",
"*.la",
".a",
"/lib/girepository-1.0", "/lib/girepository-1.0",
"/share/gir-1.0", "/share/gir-1.0",
"/share/doc" "/share/doc"
], ],
"modules" : [ "modules": [
{ {
"name" : "wayland", "name" : "wayland",
"buildsystem" : "autotools", "buildsystem" : "autotools",
@@ -48,18 +39,18 @@
] ]
}, },
{ {
"name" : "graphene", "name": "graphene",
"buildsystem" : "meson", "buildsystem": "meson",
"builddir" : true, "builddir": true,
"config-opts" : [ "config-opts": [
"--libdir=/app/lib", "--libdir=/app/lib",
"-Dtests=false", "-Dtests=false",
"-Dbenchmarks=false" "-Dbenchmarks=false"
], ],
"sources" : [ "sources": [
{ {
"type" : "git", "type": "git",
"url" : "https://github.com/ebassi/graphene.git" "url": "https://github.com/ebassi/graphene.git"
} }
] ]
}, },
@@ -67,7 +58,7 @@
"name" : "libsass", "name" : "libsass",
"buildsystem" : "meson", "buildsystem" : "meson",
"builddir" : true, "builddir" : true,
"config-opts" : [ "config-opts": [
"--libdir=/app/lib" "--libdir=/app/lib"
], ],
"sources" : [ "sources" : [
@@ -82,7 +73,7 @@
"name" : "sassc", "name" : "sassc",
"buildsystem" : "meson", "buildsystem" : "meson",
"builddir" : true, "builddir" : true,
"config-opts" : [ "config-opts": [
"--libdir=/app/lib" "--libdir=/app/lib"
], ],
"sources" : [ "sources" : [
@@ -94,25 +85,18 @@
] ]
}, },
{ {
"name" : "gtk", "name": "gtk",
"buildsystem" : "meson", "buildsystem": "meson",
"builddir" : true, "builddir": true,
"config-opts" : [ "config-opts": [
"--libdir=/app/lib", "--libdir=/app/lib"
"-Denable_vulkan=no",
"-Dbuildtype=debugoptimized"
], ],
"sources" : [ "sources": [
{ {
"type" : "git", "type": "git",
"url" : "https://gitlab.gnome.org/GNOME/gtk.git" "url": "https://gitlab.gnome.org/GNOME/gtk.git"
} }
] ]
} }
], ]
"build-options" : {
"env" : {
"GSK_RENDERER" : "opengl"
}
}
} }

View File

@@ -1,38 +1,29 @@
{ {
"app-id" : "org.gtk.IconBrowser4", "app-id": "org.gtk.IconBrowser4",
"runtime" : "org.gnome.Platform", "runtime": "org.gnome.Platform",
"runtime-version" : "master", "runtime-version": "master",
"sdk" : "org.gnome.Sdk", "sdk": "org.gnome.Sdk",
"command" : "gtk4-icon-browser", "command": "gtk4-icon-browser",
"tags" : [ "tags": ["devel", "development", "nightly"],
"devel", "desktop-file-name-prefix": "(Development) ",
"development", "finish-args": [
"nightly"
],
"desktop-file-name-prefix" : "(Development) ",
"finish-args" : [
"--device=dri", "--device=dri",
"--share=ipc", "--share=ipc",
"--socket=fallback-x11", "--socket=fallback-x11",
"--socket=wayland", "--socket=wayland",
"--talk-name=org.gtk.vfs", "--talk-name=org.gtk.vfs", "--talk-name=org.gtk.vfs.*"
"--talk-name=org.gtk.vfs.*"
], ],
"cleanup" : [ "cleanup": [
"/include", "/include",
"/lib/pkgconfig", "/lib/pkgconfig", "/share/pkgconfig",
"/share/pkgconfig",
"/share/aclocal", "/share/aclocal",
"/man", "/man", "/share/man", "/share/gtk-doc",
"/share/man", "*.la", ".a",
"/share/gtk-doc",
"*.la",
".a",
"/lib/girepository-1.0", "/lib/girepository-1.0",
"/share/gir-1.0", "/share/gir-1.0",
"/share/doc" "/share/doc"
], ],
"modules" : [ "modules": [
{ {
"name" : "wayland", "name" : "wayland",
"buildsystem" : "autotools", "buildsystem" : "autotools",
@@ -48,18 +39,18 @@
] ]
}, },
{ {
"name" : "graphene", "name": "graphene",
"buildsystem" : "meson", "buildsystem": "meson",
"builddir" : true, "builddir": true,
"config-opts" : [ "config-opts": [
"--libdir=/app/lib", "--libdir=/app/lib",
"-Dtests=false", "-Dtests=false",
"-Dbenchmarks=false" "-Dbenchmarks=false"
], ],
"sources" : [ "sources": [
{ {
"type" : "git", "type": "git",
"url" : "https://github.com/ebassi/graphene.git" "url": "https://github.com/ebassi/graphene.git"
} }
] ]
}, },
@@ -67,7 +58,7 @@
"name" : "libsass", "name" : "libsass",
"buildsystem" : "meson", "buildsystem" : "meson",
"builddir" : true, "builddir" : true,
"config-opts" : [ "config-opts": [
"--libdir=/app/lib" "--libdir=/app/lib"
], ],
"sources" : [ "sources" : [
@@ -82,7 +73,7 @@
"name" : "sassc", "name" : "sassc",
"buildsystem" : "meson", "buildsystem" : "meson",
"builddir" : true, "builddir" : true,
"config-opts" : [ "config-opts": [
"--libdir=/app/lib" "--libdir=/app/lib"
], ],
"sources" : [ "sources" : [
@@ -94,24 +85,18 @@
] ]
}, },
{ {
"name" : "gtk", "name": "gtk",
"buildsystem" : "meson", "buildsystem": "meson",
"builddir" : true, "builddir": true,
"config-opts" : [ "config-opts": [
"--libdir=/app/lib", "--libdir=/app/lib"
"-Denable_vulkan=no",
"-Dbuildtype=debugoptimized"
], ],
"sources" : [ "sources": [
{ {
"type" : "git", "type": "git",
"url" : "https://gitlab.gnome.org/GNOME/gtk.git" "url": "https://gitlab.gnome.org/GNOME/gtk.git"
} }
] ]
} }
], ]
"build-options" : {
"env" : {
}
}
} }

View File

@@ -1,38 +1,29 @@
{ {
"app-id" : "org.gtk.WidgetFactory4", "app-id": "org.gtk.WidgetFactory4",
"runtime" : "org.gnome.Platform", "runtime": "org.gnome.Platform",
"runtime-version" : "master", "runtime-version": "master",
"sdk" : "org.gnome.Sdk", "sdk": "org.gnome.Sdk",
"command" : "gtk4-widget-factory", "command": "gtk4-widget-factory",
"tags" : [ "tags": ["devel", "development", "nightly"],
"devel", "desktop-file-name-prefix": "(Development) ",
"development", "finish-args": [
"nightly"
],
"desktop-file-name-prefix" : "(Development) ",
"finish-args" : [
"--device=dri", "--device=dri",
"--share=ipc", "--share=ipc",
"--socket=fallback-x11", "--socket=fallback-x11",
"--socket=wayland", "--socket=wayland",
"--talk-name=org.gtk.vfs", "--talk-name=org.gtk.vfs", "--talk-name=org.gtk.vfs.*"
"--talk-name=org.gtk.vfs.*"
], ],
"cleanup" : [ "cleanup": [
"/include", "/include",
"/lib/pkgconfig", "/lib/pkgconfig", "/share/pkgconfig",
"/share/pkgconfig",
"/share/aclocal", "/share/aclocal",
"/man", "/man", "/share/man", "/share/gtk-doc",
"/share/man", "*.la", ".a",
"/share/gtk-doc",
"*.la",
".a",
"/lib/girepository-1.0", "/lib/girepository-1.0",
"/share/gir-1.0", "/share/gir-1.0",
"/share/doc" "/share/doc"
], ],
"modules" : [ "modules": [
{ {
"name" : "wayland", "name" : "wayland",
"buildsystem" : "autotools", "buildsystem" : "autotools",
@@ -48,18 +39,18 @@
] ]
}, },
{ {
"name" : "graphene", "name": "graphene",
"buildsystem" : "meson", "buildsystem": "meson",
"builddir" : true, "builddir": true,
"config-opts" : [ "config-opts": [
"--libdir=/app/lib", "--libdir=/app/lib",
"-Dtests=false", "-Dtests=false",
"-Dbenchmarks=false" "-Dbenchmarks=false"
], ],
"sources" : [ "sources": [
{ {
"type" : "git", "type": "git",
"url" : "https://github.com/ebassi/graphene.git" "url": "https://github.com/ebassi/graphene.git"
} }
] ]
}, },
@@ -67,7 +58,7 @@
"name" : "libsass", "name" : "libsass",
"buildsystem" : "meson", "buildsystem" : "meson",
"builddir" : true, "builddir" : true,
"config-opts" : [ "config-opts": [
"--libdir=/app/lib" "--libdir=/app/lib"
], ],
"sources" : [ "sources" : [
@@ -82,7 +73,7 @@
"name" : "sassc", "name" : "sassc",
"buildsystem" : "meson", "buildsystem" : "meson",
"builddir" : true, "builddir" : true,
"config-opts" : [ "config-opts": [
"--libdir=/app/lib" "--libdir=/app/lib"
], ],
"sources" : [ "sources" : [
@@ -94,28 +85,18 @@
] ]
}, },
{ {
"name" : "gtk", "name": "gtk",
"buildsystem" : "meson", "buildsystem": "meson",
"builddir" : true, "builddir": true,
"config-opts" : [ "config-opts": [
"--libdir=/app/lib", "--libdir=/app/lib"
"-Denable_vulkan=no",
"-Dbuildtype=debugoptimized"
], ],
"sources" : [ "sources": [
{ {
"type" : "git", "type": "git",
"url" : "https://gitlab.gnome.org/GNOME/gtk.git" "url": "https://gitlab.gnome.org/GNOME/gtk.git"
} }
] ]
} }
], ]
"build-options" : {
"env" : {
"DBUS_SESSION_BUS_ADDRESS" : "''",
"GSK_RENDERER" : "opengl",
"GDK_DEBUG" : "vulkan-disable",
"G_ENABLE_DEBUG" : "true"
}
}
} }

View File

@@ -1,45 +1,31 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import os import os
import sys import sys
import subprocess import subprocess
if 'DESTDIR' not in os.environ: if 'DESTDIR' not in os.environ:
gtk_api_version = sys.argv[1] gtk_api_version = sys.argv[1]
gtk_abi_version = sys.argv[2] gtk_abi_version = sys.argv[2]
gtk_libdir = sys.argv[3] gtk_libdir = sys.argv[3]
gtk_datadir = sys.argv[4] gtk_datadir = sys.argv[4]
gtk_bindir = sys.argv[5]
gtk_moduledir = os.path.join(gtk_libdir, 'gtk-' + gtk_api_version, gtk_abi_version)
gtk_moduledir = os.path.join(gtk_libdir, 'gtk-' + gtk_api_version, gtk_abi_version) gtk_printmodule_dir = os.path.join(gtk_moduledir, 'printbackends')
gtk_printmodule_dir = os.path.join(gtk_moduledir, 'printbackends') gtk_immodule_dir = os.path.join(gtk_moduledir, 'immodules')
gtk_immodule_dir = os.path.join(gtk_moduledir, 'immodules')
print('Compiling GSettings schemas...')
print('Compiling GSettings schemas...') subprocess.call(['glib-compile-schemas',
glib_compile_schemas = subprocess.check_output(['pkg-config', os.path.join(gtk_datadir, 'glib-2.0', 'schemas')])
'--variable=glib_compile_schemas',
'gio-2.0']).strip() print('Updating icon cache...')
if not os.path.exists(glib_compile_schemas): subprocess.call(['gtk4-update-icon-cache', '-q', '-t' ,'-f',
# pkg-config variables only available since GLib 2.62.0. os.path.join(gtk_datadir, 'icons', 'hicolor')])
glib_compile_schemas = 'glib-compile-schemas'
subprocess.call([glib_compile_schemas, print('Updating module cache for print backends...')
os.path.join(gtk_datadir, 'glib-2.0', 'schemas')])
print('Updating icon cache...')
update_icon_cache = os.path.join(gtk_bindir, 'gtk4-update-icon-cache')
subprocess.call([update_icon_cache, '-q', '-t' ,'-f',
os.path.join(gtk_datadir, 'icons', 'hicolor')])
print('Updating module cache for print backends...')
os.makedirs(gtk_printmodule_dir, exist_ok=True) os.makedirs(gtk_printmodule_dir, exist_ok=True)
gio_querymodules = subprocess.check_output(['pkg-config', subprocess.call(['gio-querymodules', gtk_printmodule_dir])
'--variable=gio_querymodules',
'gio-2.0']).strip() print('Updating module cache for input methods...')
if not os.path.exists(gio_querymodules):
# pkg-config variables only available since GLib 2.62.0.
gio_querymodules = 'gio-querymodules'
subprocess.call([gio_querymodules, gtk_printmodule_dir])
print('Updating module cache for input methods...')
os.makedirs(gtk_immodule_dir, exist_ok=True) os.makedirs(gtk_immodule_dir, exist_ok=True)
subprocess.call([gio_querymodules, gtk_immodule_dir]) subprocess.call(['gio-querymodules', gtk_immodule_dir])

View File

@@ -1,9 +1,8 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* always defined to indicate that i18n is enabled */ /* always defined to indicate that i18n is enabled */
#define ENABLE_NLS 1 #define ENABLE_NLS 1
/* Use structured logging */
#define G_LOG_STRUCTURED 1
/* The prefix for our gettext translation domains. */ /* The prefix for our gettext translation domains. */
#mesondefine GETTEXT_PACKAGE #mesondefine GETTEXT_PACKAGE
@@ -70,9 +69,6 @@
/* Define to 1 if you have the `mkstemp' function. */ /* Define to 1 if you have the `mkstemp' function. */
#mesondefine HAVE_MKSTEMP #mesondefine HAVE_MKSTEMP
/* Define to 1 if you have the `mlock` function. */
#mesondefine HAVE_MLOCK
/* Define to 1 if you have a working `mmap' system call. */ /* Define to 1 if you have a working `mmap' system call. */
#mesondefine HAVE_MMAP #mesondefine HAVE_MMAP
@@ -107,7 +103,7 @@
#mesondefine HAVE_SYS_PARAM_H #mesondefine HAVE_SYS_PARAM_H
/* Have the sysprof-capture library */ /* Have the sysprof-capture library */
#mesondefine HAVE_SYSPROF #mesondefine HAVE_SYSPROF_CAPTURE
/* Define to 1 if you have the <sys/stat.h> header file. */ /* Define to 1 if you have the <sys/stat.h> header file. */
#mesondefine HAVE_SYS_STAT_H #mesondefine HAVE_SYS_STAT_H

View File

@@ -81,11 +81,11 @@ constraint_editor_application_activate (GApplication *app)
static void static void
constraint_editor_application_open (GApplication *app, constraint_editor_application_open (GApplication *app,
GFile **files, GFile **files,
int n_files, gint n_files,
const char *hint) const gchar *hint)
{ {
ConstraintEditorWindow *win; ConstraintEditorWindow *win;
int i; gint i;
for (i = 0; i < n_files; i++) for (i = 0; i < n_files; i++)
{ {

View File

@@ -36,7 +36,7 @@ struct _ConstraintEditorWindow
G_DEFINE_TYPE(ConstraintEditorWindow, constraint_editor_window, GTK_TYPE_APPLICATION_WINDOW); G_DEFINE_TYPE(ConstraintEditorWindow, constraint_editor_window, GTK_TYPE_APPLICATION_WINDOW);
static GtkConstraintTarget * static GtkConstraintTarget *
find_target (GListModel *model, find_target (GListModel *model,
GtkConstraintTarget *orig) GtkConstraintTarget *orig)
{ {
const char *name; const char *name;
@@ -163,30 +163,20 @@ constraint_editor_window_load (ConstraintEditorWindow *self,
GtkConstraint *clone; GtkConstraint *clone;
GtkConstraintTarget *target; GtkConstraintTarget *target;
GtkConstraintTarget *source; GtkConstraintTarget *source;
GtkConstraintAttribute source_attr;
item = g_list_model_get_item (list, i); item = g_list_model_get_item (list, i);
constraint = GTK_CONSTRAINT (item); constraint = GTK_CONSTRAINT (item);
target = gtk_constraint_get_target (constraint); target = gtk_constraint_get_target (constraint);
source = gtk_constraint_get_source (constraint); source = gtk_constraint_get_source (constraint);
source_attr = gtk_constraint_get_source_attribute (constraint); clone = gtk_constraint_new (find_target (constraint_view_get_model (CONSTRAINT_VIEW (self->view)), target),
if (source == NULL && source_attr == GTK_CONSTRAINT_ATTRIBUTE_NONE)
clone = gtk_constraint_new_constant (find_target (constraint_view_get_model (CONSTRAINT_VIEW (self->view)), target),
gtk_constraint_get_target_attribute (constraint), gtk_constraint_get_target_attribute (constraint),
gtk_constraint_get_relation (constraint), gtk_constraint_get_relation (constraint),
find_target (constraint_view_get_model (CONSTRAINT_VIEW (self->view)), source),
gtk_constraint_get_target_attribute (constraint),
gtk_constraint_get_multiplier (constraint),
gtk_constraint_get_constant (constraint), gtk_constraint_get_constant (constraint),
gtk_constraint_get_strength (constraint)); gtk_constraint_get_strength (constraint));
else
clone = gtk_constraint_new (find_target (constraint_view_get_model (CONSTRAINT_VIEW (self->view)), target),
gtk_constraint_get_target_attribute (constraint),
gtk_constraint_get_relation (constraint),
find_target (constraint_view_get_model (CONSTRAINT_VIEW (self->view)), source),
source_attr,
gtk_constraint_get_multiplier (constraint),
gtk_constraint_get_constant (constraint),
gtk_constraint_get_strength (constraint));
constraint_view_add_constraint (CONSTRAINT_VIEW (self->view), clone); constraint_view_add_constraint (CONSTRAINT_VIEW (self->view), clone);
@@ -203,7 +193,7 @@ constraint_editor_window_load (ConstraintEditorWindow *self,
static void static void
open_response_cb (GtkNativeDialog *dialog, open_response_cb (GtkNativeDialog *dialog,
int response, gint response,
ConstraintEditorWindow *self) ConstraintEditorWindow *self)
{ {
gtk_native_dialog_hide (dialog); gtk_native_dialog_hide (dialog);
@@ -295,7 +285,7 @@ serialize_model (GListModel *list)
static void static void
save_response_cb (GtkNativeDialog *dialog, save_response_cb (GtkNativeDialog *dialog,
int response, gint response,
ConstraintEditorWindow *self) ConstraintEditorWindow *self)
{ {
gtk_native_dialog_hide (dialog); gtk_native_dialog_hide (dialog);
@@ -310,7 +300,7 @@ save_response_cb (GtkNativeDialog *dialog,
model = constraint_view_get_model (CONSTRAINT_VIEW (self->view)); model = constraint_view_get_model (CONSTRAINT_VIEW (self->view));
text = serialize_model (model); text = serialize_model (model);
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog)); file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
g_file_replace_contents (file, text, strlen (text), g_file_replace_contents (file, text, -1,
NULL, FALSE, NULL, FALSE,
G_FILE_CREATE_NONE, G_FILE_CREATE_NONE,
NULL, NULL,

View File

@@ -1,11 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<interface> <interface>
<template class="ConstraintEditorWindow" parent="GtkApplicationWindow"> <template class="ConstraintEditorWindow" parent="GtkApplicationWindow">
<style>
<class name="devel"/>
</style>
<property name="title" translatable="yes">GTK Constraint Editor</property> <property name="title" translatable="yes">GTK Constraint Editor</property>
<property name="default-width">1024</property> <property name="default-width">1024</property>
<property name="default-height">768</property> <property name="default-height">768</property>
<child type="titlebar"> <child type="titlebar">
<object class="GtkHeaderBar" id="header"> <object class="GtkHeaderBar" id="header">
<property name="show-title-buttons">1</property>
<child type="start"> <child type="start">
<object class="GtkButton"> <object class="GtkButton">
<property name="icon-name">document-open-symbolic</property> <property name="icon-name">document-open-symbolic</property>

View File

@@ -142,9 +142,6 @@ get_target (GListModel *model,
{ {
int i; int i;
if (id == NULL)
return NULL;
if (strcmp ("super", id) == 0) if (strcmp ("super", id) == 0)
return NULL; return NULL;
@@ -215,22 +212,6 @@ get_relation_nick (GtkConstraintRelation relation)
return nick; return nick;
} }
static const char *
get_relation_display_name (GtkConstraintRelation relation)
{
switch (relation)
{
case GTK_CONSTRAINT_RELATION_LE:
return "";
case GTK_CONSTRAINT_RELATION_EQ:
return "=";
case GTK_CONSTRAINT_RELATION_GE:
return "";
default:
return "?";
}
}
static GtkConstraintStrength static GtkConstraintStrength
get_strength (const char *id) get_strength (const char *id)
{ {
@@ -350,7 +331,6 @@ source_attr_changed (ConstraintEditor *editor)
{ {
gtk_widget_set_sensitive (editor->source, TRUE); gtk_widget_set_sensitive (editor->source, TRUE);
gtk_widget_set_sensitive (editor->multiplier, TRUE); gtk_widget_set_sensitive (editor->multiplier, TRUE);
gtk_editable_set_text (GTK_EDITABLE (editor->multiplier), "1");
} }
} }
@@ -367,7 +347,7 @@ constraint_editor_constraint_to_string (GtkConstraint *constraint)
name = get_target_name (gtk_constraint_get_target (constraint)); name = get_target_name (gtk_constraint_get_target (constraint));
attr = get_attr_nick (gtk_constraint_get_target_attribute (constraint)); attr = get_attr_nick (gtk_constraint_get_target_attribute (constraint));
relation = get_relation_display_name (gtk_constraint_get_relation (constraint)); relation = get_relation_nick (gtk_constraint_get_relation (constraint));
if (name == NULL) if (name == NULL)
name = "[ ]"; name = "[ ]";
@@ -461,12 +441,8 @@ update_preview (ConstraintEditor *editor)
static void static void
update_button (ConstraintEditor *editor) update_button (ConstraintEditor *editor)
{ {
const char *target = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->target)); if (gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->target)) != NULL &&
const char *source = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->source)); gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->source)) != NULL)
const char *source_attr = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->source_attr));
if (target &&
(source || (source_attr && get_target_attr (source_attr) == GTK_CONSTRAINT_ATTRIBUTE_NONE)))
gtk_widget_set_sensitive (editor->button, TRUE); gtk_widget_set_sensitive (editor->button, TRUE);
else else
gtk_widget_set_sensitive (editor->button, FALSE); gtk_widget_set_sensitive (editor->button, FALSE);

View File

@@ -13,8 +13,8 @@
<object class="GtkLabel"> <object class="GtkLabel">
<property name="label">Target</property> <property name="label">Target</property>
<layout> <layout>
<property name="column">0</property> <property name="left-attach">0</property>
<property name="row">1</property> <property name="top-attach">1</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -23,8 +23,8 @@
<signal name="changed" handler="update_preview" swapped="yes"/> <signal name="changed" handler="update_preview" swapped="yes"/>
<signal name="changed" handler="update_button" swapped="yes"/> <signal name="changed" handler="update_button" swapped="yes"/>
<layout> <layout>
<property name="column">1</property> <property name="left-attach">1</property>
<property name="row">1</property> <property name="top-attach">1</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -32,8 +32,8 @@
<object class="GtkComboBoxText" id="target_attr"> <object class="GtkComboBoxText" id="target_attr">
<signal name="changed" handler="update_preview" swapped="yes"/> <signal name="changed" handler="update_preview" swapped="yes"/>
<layout> <layout>
<property name="column">2</property> <property name="left-attach">2</property>
<property name="row">1</property> <property name="top-attach">1</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -41,8 +41,8 @@
<object class="GtkLabel"> <object class="GtkLabel">
<property name="label">Relation</property> <property name="label">Relation</property>
<layout> <layout>
<property name="column">0</property> <property name="left-attach">0</property>
<property name="row">2</property> <property name="top-attach">2</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -50,8 +50,8 @@
<object class="GtkComboBoxText" id="relation"> <object class="GtkComboBoxText" id="relation">
<signal name="changed" handler="update_preview" swapped="yes"/> <signal name="changed" handler="update_preview" swapped="yes"/>
<layout> <layout>
<property name="column">1</property> <property name="left-attach">1</property>
<property name="row">2</property> <property name="top-attach">2</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -59,8 +59,8 @@
<object class="GtkLabel"> <object class="GtkLabel">
<property name="label">Source</property> <property name="label">Source</property>
<layout> <layout>
<property name="column">0</property> <property name="left-attach">0</property>
<property name="row">3</property> <property name="top-attach">3</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -69,8 +69,8 @@
<signal name="changed" handler="update_preview" swapped="yes"/> <signal name="changed" handler="update_preview" swapped="yes"/>
<signal name="changed" handler="update_button" swapped="yes"/> <signal name="changed" handler="update_button" swapped="yes"/>
<layout> <layout>
<property name="column">1</property> <property name="left-attach">1</property>
<property name="row">3</property> <property name="top-attach">3</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -78,10 +78,9 @@
<object class="GtkComboBoxText" id="source_attr"> <object class="GtkComboBoxText" id="source_attr">
<signal name="changed" handler="update_preview" swapped="yes"/> <signal name="changed" handler="update_preview" swapped="yes"/>
<signal name="changed" handler="source_attr_changed" swapped="yes"/> <signal name="changed" handler="source_attr_changed" swapped="yes"/>
<signal name="changed" handler="update_button" swapped="yes"/>
<layout> <layout>
<property name="column">2</property> <property name="left-attach">2</property>
<property name="row">3</property> <property name="top-attach">3</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -89,8 +88,8 @@
<object class="GtkLabel"> <object class="GtkLabel">
<property name="label">Multiplier</property> <property name="label">Multiplier</property>
<layout> <layout>
<property name="column">0</property> <property name="left-attach">0</property>
<property name="row">4</property> <property name="top-attach">4</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -98,8 +97,8 @@
<object class="GtkEntry" id="multiplier"> <object class="GtkEntry" id="multiplier">
<signal name="changed" handler="update_preview" swapped="yes"/> <signal name="changed" handler="update_preview" swapped="yes"/>
<layout> <layout>
<property name="column">1</property> <property name="left-attach">1</property>
<property name="row">4</property> <property name="top-attach">4</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -107,8 +106,8 @@
<object class="GtkLabel"> <object class="GtkLabel">
<property name="label">Constant</property> <property name="label">Constant</property>
<layout> <layout>
<property name="column">0</property> <property name="left-attach">0</property>
<property name="row">5</property> <property name="top-attach">5</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -116,8 +115,8 @@
<object class="GtkEntry" id="constant"> <object class="GtkEntry" id="constant">
<signal name="changed" handler="update_preview" swapped="yes"/> <signal name="changed" handler="update_preview" swapped="yes"/>
<layout> <layout>
<property name="column">1</property> <property name="left-attach">1</property>
<property name="row">5</property> <property name="top-attach">5</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -125,16 +124,16 @@
<object class="GtkLabel"> <object class="GtkLabel">
<property name="label">Strength</property> <property name="label">Strength</property>
<layout> <layout>
<property name="column">0</property> <property name="left-attach">0</property>
<property name="row">6</property> <property name="top-attach">6</property>
</layout> </layout>
</object> </object>
</child> </child>
<child> <child>
<object class="GtkComboBoxText" id="strength"> <object class="GtkComboBoxText" id="strength">
<layout> <layout>
<property name="column">1</property> <property name="left-attach">1</property>
<property name="row">6</property> <property name="top-attach">6</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -142,8 +141,8 @@
<object class="GtkLabel" id="preview"> <object class="GtkLabel" id="preview">
<property name="xalign">0</property> <property name="xalign">0</property>
<layout> <layout>
<property name="column">1</property> <property name="left-attach">1</property>
<property name="row">7</property> <property name="top-attach">7</property>
<property name="column-span">2</property> <property name="column-span">2</property>
</layout> </layout>
<attributes> <attributes>
@@ -156,8 +155,8 @@
<property name="label">Create</property> <property name="label">Create</property>
<signal name="clicked" handler="create_constraint"/> <signal name="clicked" handler="create_constraint"/>
<layout> <layout>
<property name="column">2</property> <property name="left-attach">2</property>
<property name="row">8</property> <property name="top-attach">8</property>
</layout> </layout>
</object> </object>
</child> </child>

View File

@@ -174,25 +174,28 @@ constraint_view_init (ConstraintView *self)
manager = gtk_constraint_layout_new (); manager = gtk_constraint_layout_new ();
gtk_widget_set_layout_manager (GTK_WIDGET (self), manager); gtk_widget_set_layout_manager (GTK_WIDGET (self), manager);
guides = gtk_constraint_layout_observe_guides (GTK_CONSTRAINT_LAYOUT (manager));
all_constraints = gtk_constraint_layout_observe_constraints (GTK_CONSTRAINT_LAYOUT (manager));
filter = GTK_FILTER (gtk_custom_filter_new (omit_internal, NULL, NULL));
constraints = (GListModel *)gtk_filter_list_model_new (all_constraints, filter);
all_children = gtk_widget_observe_children (GTK_WIDGET (self)); all_children = gtk_widget_observe_children (GTK_WIDGET (self));
filter = GTK_FILTER (gtk_custom_filter_new (omit_internal, NULL, NULL)); all_constraints = gtk_constraint_layout_observe_constraints (GTK_CONSTRAINT_LAYOUT (manager));
guides = gtk_constraint_layout_observe_guides (GTK_CONSTRAINT_LAYOUT (manager));
filter = gtk_custom_filter_new (omit_internal, NULL, NULL);
constraints = (GListModel *)gtk_filter_list_model_new (all_constraints, filter);
g_object_unref (filter);
filter = gtk_custom_filter_new (omit_internal, NULL, NULL);
children = (GListModel *)gtk_filter_list_model_new (all_children, filter); children = (GListModel *)gtk_filter_list_model_new (all_children, filter);
g_object_unref (filter);
list = g_list_store_new (G_TYPE_LIST_MODEL); list = g_list_store_new (G_TYPE_LIST_MODEL);
g_list_store_append (list, children); g_list_store_append (list, children);
g_list_store_append (list, guides); g_list_store_append (list, guides);
g_list_store_append (list, constraints); g_list_store_append (list, constraints);
self->model = G_LIST_MODEL (gtk_flatten_list_model_new (G_TYPE_OBJECT, G_LIST_MODEL (list)));
g_object_unref (children); g_object_unref (children);
g_object_unref (guides); g_object_unref (guides);
g_object_unref (constraints); g_object_unref (constraints);
g_object_unref (all_children);
g_object_unref (all_constraints);
g_object_unref (list);
self->model = G_LIST_MODEL (gtk_flatten_list_model_new (G_LIST_MODEL (list)));
controller = (GtkEventController *)gtk_gesture_drag_new (); controller = (GtkEventController *)gtk_gesture_drag_new ();
g_signal_connect (controller, "drag-begin", G_CALLBACK (drag_begin), self); g_signal_connect (controller, "drag-begin", G_CALLBACK (drag_begin), self);

View File

@@ -55,8 +55,8 @@
<object class="GtkLabel"> <object class="GtkLabel">
<property name="label">Name</property> <property name="label">Name</property>
<layout> <layout>
<property name="column">0</property> <property name="left-attach">0</property>
<property name="row">0</property> <property name="top-attach">0</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -64,8 +64,8 @@
<object class="GtkEntry" id="name"> <object class="GtkEntry" id="name">
<property name="max-width-chars">20</property> <property name="max-width-chars">20</property>
<layout> <layout>
<property name="column">1</property> <property name="left-attach">1</property>
<property name="row">0</property> <property name="top-attach">0</property>
<property name="column-span">2</property> <property name="column-span">2</property>
</layout> </layout>
</object> </object>
@@ -74,8 +74,8 @@
<object class="GtkLabel"> <object class="GtkLabel">
<property name="label">Min Size</property> <property name="label">Min Size</property>
<layout> <layout>
<property name="column">0</property> <property name="left-attach">0</property>
<property name="row">1</property> <property name="top-attach">1</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -84,8 +84,8 @@
<property name="adjustment">min_width_adj</property> <property name="adjustment">min_width_adj</property>
<property name="max-width-chars">5</property> <property name="max-width-chars">5</property>
<layout> <layout>
<property name="column">1</property> <property name="left-attach">1</property>
<property name="row">1</property> <property name="top-attach">1</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -94,8 +94,8 @@
<property name="adjustment">min_height_adj</property> <property name="adjustment">min_height_adj</property>
<property name="max-width-chars">5</property> <property name="max-width-chars">5</property>
<layout> <layout>
<property name="column">2</property> <property name="left-attach">2</property>
<property name="row">1</property> <property name="top-attach">1</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -103,8 +103,8 @@
<object class="GtkLabel"> <object class="GtkLabel">
<property name="label">Nat Size</property> <property name="label">Nat Size</property>
<layout> <layout>
<property name="column">0</property> <property name="left-attach">0</property>
<property name="row">2</property> <property name="top-attach">2</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -113,8 +113,8 @@
<property name="adjustment">nat_width_adj</property> <property name="adjustment">nat_width_adj</property>
<property name="max-width-chars">5</property> <property name="max-width-chars">5</property>
<layout> <layout>
<property name="column">1</property> <property name="left-attach">1</property>
<property name="row">2</property> <property name="top-attach">2</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -123,8 +123,8 @@
<property name="adjustment">nat_height_adj</property> <property name="adjustment">nat_height_adj</property>
<property name="max-width-chars">5</property> <property name="max-width-chars">5</property>
<layout> <layout>
<property name="column">2</property> <property name="left-attach">2</property>
<property name="row">2</property> <property name="top-attach">2</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -132,8 +132,8 @@
<object class="GtkLabel"> <object class="GtkLabel">
<property name="label">Max Size</property> <property name="label">Max Size</property>
<layout> <layout>
<property name="column">0</property> <property name="left-attach">0</property>
<property name="row">3</property> <property name="top-attach">3</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -142,8 +142,8 @@
<property name="adjustment">max_width_adj</property> <property name="adjustment">max_width_adj</property>
<property name="max-width-chars">5</property> <property name="max-width-chars">5</property>
<layout> <layout>
<property name="column">1</property> <property name="left-attach">1</property>
<property name="row">3</property> <property name="top-attach">3</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -152,8 +152,8 @@
<property name="adjustment">max_height_adj</property> <property name="adjustment">max_height_adj</property>
<property name="max-width-chars">5</property> <property name="max-width-chars">5</property>
<layout> <layout>
<property name="column">2</property> <property name="left-attach">2</property>
<property name="row">3</property> <property name="top-attach">3</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -161,16 +161,16 @@
<object class="GtkLabel"> <object class="GtkLabel">
<property name="label">Strength</property> <property name="label">Strength</property>
<layout> <layout>
<property name="column">0</property> <property name="left-attach">0</property>
<property name="row">4</property> <property name="top-attach">4</property>
</layout> </layout>
</object> </object>
</child> </child>
<child> <child>
<object class="GtkComboBoxText" id="strength"> <object class="GtkComboBoxText" id="strength">
<layout> <layout>
<property name="column">1</property> <property name="left-attach">1</property>
<property name="row">4</property> <property name="top-attach">4</property>
<property name="column-span">2</property> <property name="column-span">2</property>
</layout> </layout>
</object> </object>
@@ -180,8 +180,8 @@
<property name="label">Create</property> <property name="label">Create</property>
<signal name="clicked" handler="create_guide"/> <signal name="clicked" handler="create_guide"/>
<layout> <layout>
<property name="column">2</property> <property name="left-attach">2</property>
<property name="row">5</property> <property name="top-attach">5</property>
</layout> </layout>
</object> </object>
</child> </child>

View File

@@ -8,16 +8,14 @@ constraint_editor_sources = [
] ]
constraint_editor_resources = gnome.compile_resources('constraint_editor_resources', constraint_editor_resources = gnome.compile_resources('constraint_editor_resources',
'constraint-editor.gresource.xml', 'constraint-editor.gresource.xml',
source_dir: '.', source_dir: '.')
)
executable('gtk4-constraint-editor', executable('gtk4-constraint-editor',
sources: [ constraint_editor_sources, constraint_editor_resources, ], constraint_editor_sources, constraint_editor_resources,
c_args: common_cflags, c_args: common_cflags,
dependencies: libgtk_dep, dependencies: libgtk_dep,
include_directories: confinc, include_directories: confinc,
gui_app: true, gui_app: true,
link_args: extra_demo_ldflags, link_args: extra_demo_ldflags,
install: false, install: false)
)

View File

@@ -1,345 +0,0 @@
// Originally from: https://www.shadertoy.com/view/wsjBD3
// License CC0: A battered alien planet
// Been experimenting with space inspired shaders
#define PI 3.141592654
#define TAU (2.0*PI)
#define TOLERANCE 0.00001
#define MAX_ITER 65
#define MIN_DISTANCE 0.01
#define MAX_DISTANCE 9.0
const vec3 skyCol1 = vec3(0.35, 0.45, 0.6);
const vec3 skyCol2 = vec3(0.4, 0.7, 1.0);
const vec3 skyCol3 = pow(skyCol1, vec3(0.25));
const vec3 sunCol1 = vec3(1.0,0.6,0.4);
const vec3 sunCol2 = vec3(1.0,0.9,0.7);
const vec3 smallSunCol1 = vec3(1.0,0.5,0.25)*0.5;
const vec3 smallSunCol2 = vec3(1.0,0.5,0.25)*0.5;
const vec3 mountainColor = 1.0*sqrt(vec3(0.95, 0.65, 0.45));
const float cellWidth = 1.0;
const vec4 planet = vec4(80.0, -20.0, 100.0, 50.0)*1000.0;
void rot(inout vec2 p, float a) {
float c = cos(a);
float s = sin(a);
p = vec2(p.x*c + p.y*s, -p.x*s + p.y*c);
}
vec2 mod2(inout vec2 p, vec2 size) {
vec2 c = floor((p + size*0.5)/size);
p = mod(p + size*0.5,size) - size*0.5;
return c;
}
float circle(vec2 p, float r) {
return length(p) - r;
}
float egg(vec2 p, float ra, float rb) {
const float k = sqrt(3.0);
p.x = abs(p.x);
float r = ra - rb;
return ((p.y<0.0) ? length(vec2(p.x, p.y )) - r :
(k*(p.x+r)<p.y) ? length(vec2(p.x, p.y-k*r)) :
length(vec2(p.x+r,p.y )) - 2.0*r) - rb;
}
vec2 hash(vec2 p) {
p = vec2(dot (p, vec2 (127.1, 311.7)), dot (p, vec2 (269.5, 183.3)));
return -1. + 2.*fract (sin (p)*43758.5453123);
}
vec2 raySphere(vec3 ro, vec3 rd, vec4 sphere) {
vec3 center = sphere.xyz;
float radius = sphere.w;
vec3 m = ro - center.xyz;
float b = dot(m, rd);
float c = dot(m, m) - radius*radius;
if(c > 0.0 && b > 0.0) return vec2(-1.0, -1.0);
float discr = b * b - c;
if(discr < 0.0) return vec2(-1.0);
float normalMultiplier = 1.0;
float s = sqrt(discr);
float t0 = -b - s;
float t1 = -b + s;;
return vec2(t0, t1);
}
float noize1(vec2 p) {
vec2 n = mod2(p, vec2(cellWidth));
vec2 hh = hash(sqrt(2.0)*(n+1000.0));
hh.x *= hh.y;
float r = 0.225*cellWidth;
float d = circle(p, 2.0*r);
float h = hh.x*smoothstep(0.0, r, -d);
return h*0.25;
}
float noize2(vec2 p) {
vec2 n = mod2(p, vec2(cellWidth));
vec2 hh = hash(sqrt(2.0)*(n+1000.0));
hh.x *= hh.y;
rot(p, TAU*hh.y);
float r = 0.45*cellWidth;
// float d = circle(p, 1.0*r);
float d = egg(p, 0.75*r, 0.5*r*abs(hh.y));
float h = (hh.x)*smoothstep(0.0, r, -2.0*d);
return h*0.275;
}
float height(vec2 p, float dd, int mx) {
const float aa = 0.45;
const float ff = 2.03;
const float tt = 1.2;
const float oo = 3.93;
const float near = 0.25;
const float far = 0.65;
float a = 1.0;
float o = 0.2;
float s = 0.0;
float d = 0.0;
int i = 0;
for (; i < 4;++i) {
float nn = a*noize2(p);
s += nn;
d += abs(a);
p += o;
a *= aa;
p *= ff;
o *= oo;
rot(p, tt);
}
float lod = s/d;
float rdd = dd/MAX_DISTANCE;
mx = int(mix(float(4), float(mx), step(rdd, far)));
for (; i < mx; ++i) {
float nn = a*noize1(p);
s += nn;
d += abs(a);
p += o;
a *= aa;
p *= ff;
o *= oo;
rot(p, tt);
}
float hid = (s/d);
return mix(hid, lod, smoothstep(near, far, rdd));
}
float loheight(vec2 p, float d) {
return height(p, d, 0);
}
float height(vec2 p, float d) {
return height(p, d, 6);
}
float hiheight(vec2 p, float d) {
return height(p, d, 8);
}
vec3 normal(vec2 p, float d) {
vec2 eps = vec2(0.00125, 0.0);
vec3 n;
n.x = (hiheight(p - eps.xy, d) - hiheight(p + eps.xy, d));
n.y = 2.0*eps.x;
n.z = (hiheight(p - eps.yx, d) - hiheight(p + eps.yx, d));
return normalize(n);
}
const float stepLength[] = float[](0.9, 0.25);
float march(vec3 ro, vec3 rd, out int max_iter) {
float dt = 0.1;
float d = MIN_DISTANCE;
int currentStep = 0;
float lastd = d;
for (int i = 0; i < MAX_ITER; ++i)
{
vec3 p = ro + d*rd;
float h = height(p.xz, d);
if (d > MAX_DISTANCE) {
max_iter = i;
return MAX_DISTANCE;
}
float hd = p.y - h;
if (hd < TOLERANCE) {
++currentStep;
if (currentStep >= stepLength.length()) {
max_iter = i;
return d;
}
d = lastd;
continue;
}
float sl = stepLength[currentStep];
dt = max(hd, TOLERANCE)*sl + 0.0025*d;
lastd = d;
d += dt;
}
max_iter = MAX_ITER;
return MAX_DISTANCE;
}
vec3 sunDirection() {
return normalize(vec3(-0.5, 0.085, 1.0));
}
vec3 smallSunDirection() {
return normalize(vec3(-0.2, -0.05, 1.0));
}
float psin(float f) {
return 0.5 + 0.5*sin(f);
}
vec3 skyColor(vec3 ro, vec3 rd) {
vec3 sunDir = sunDirection();
vec3 smallSunDir = smallSunDirection();
float sunDot = max(dot(rd, sunDir), 0.0);
float smallSunDot = max(dot(rd, smallSunDir), 0.0);
float angle = atan(rd.y, length(rd.xz))*2.0/PI;
vec3 skyCol = mix(mix(skyCol1, skyCol2, max(0.0, angle)), skyCol3, clamp(-angle*2.0, 0.0, 1.0));
vec3 sunCol = 0.5*sunCol1*pow(sunDot, 20.0) + 8.0*sunCol2*pow(sunDot, 2000.0);
vec3 smallSunCol = 0.5*smallSunCol1*pow(smallSunDot, 200.0) + 8.0*smallSunCol2*pow(smallSunDot, 20000.0);
vec3 dust = pow(sunCol2*mountainColor, vec3(1.75))*smoothstep(0.05, -0.1, rd.y)*0.5;
vec2 si = raySphere(ro, rd, planet);
vec3 planetSurface = ro + si.x*rd;
vec3 planetNormal = normalize(planetSurface - planet.xyz);
float planetDiff = max(dot(planetNormal, sunDir), 0.0);
float planetBorder = max(dot(planetNormal, -rd), 0.0);
float planetLat = (planetSurface.x+planetSurface.y)*0.0005;
vec3 planetCol = mix(1.3*vec3(0.9, 0.8, 0.7), 0.3*vec3(0.9, 0.8, 0.7), pow(psin(planetLat+1.0)*psin(sqrt(2.0)*planetLat+2.0)*psin(sqrt(3.5)*planetLat+3.0), 0.5));
vec3 final = vec3(0.0);
final += step(0.0, si.x)*pow(planetDiff, 0.75)*planetCol*smoothstep(-0.075, 0.0, rd.y)*smoothstep(0.0, 0.1, planetBorder);
final += skyCol + sunCol + smallSunCol + dust;
return final;
}
vec3 getColor(vec3 ro, vec3 rd) {
int max_iter = 0;
vec3 skyCol = skyColor(ro, rd);
vec3 col = vec3(0);
float d = march(ro, rd, max_iter);
if (d < MAX_DISTANCE) {
vec3 sunDir = sunDirection();
vec3 osunDir = sunDir*vec3(-1.0, .0, -1.0);
vec3 p = ro + d*rd;
vec3 normal = normal(p.xz, d);
float amb = 0.2;
float dif1 = max(0.0, dot(sunDir, normal));
vec3 shd1 = sunCol2*mix(amb, 1.0, pow(dif1, 0.75));
float dif2 = max(0.0, dot(osunDir, normal));
vec3 shd2 = sunCol1*mix(amb, 1.0, pow(dif2, 0.75));
vec3 ref = reflect(rd, normal);
vec3 rcol = skyColor(p, ref);
col = mountainColor*amb*skyCol3;
col += mix(shd1, shd2, -0.5)*mountainColor;
float fre = max(dot(normal, -rd), 0.0);
fre = pow(1.0 - fre, 5.0);
col += rcol*fre*0.5;
col += (1.0*p.y);
col = tanh(col);
col = mix(col, skyCol, smoothstep(0.5*MAX_DISTANCE, 1.0*MAX_DISTANCE, d));
} else {
col = skyCol;
}
// col += vec3(1.1, 0.0, 0.0)* smoothstep(0.25, 1.0,(float(max_iter)/float(MAX_ITER)));
return col;
}
vec3 getSample1(vec2 p, float time) {
float off = 0.5*iTime;
vec3 ro = vec3(0.5, 1.0-0.25, -2.0 + off);
vec3 la = ro + vec3(0.0, -0.30, 2.0);
vec3 ww = normalize(la - ro);
vec3 uu = normalize(cross(vec3(0.0,1.0,0.0), ww));
vec3 vv = normalize(cross(ww, uu));
vec3 rd = normalize(p.x*uu + p.y*vv + 2.0*ww);
vec3 col = getColor(ro, rd) ;
return col;
}
vec3 getSample2(vec2 p, float time) {
p.y-=time*0.25;
float h = height(p, 0.0);
vec3 n = normal(p, 0.0);
vec3 lp = vec3(10.0, -1.2, 0.0);
vec3 ld = normalize(vec3(p.x, h, p.y)- lp);
float d = max(dot(ld, n), 0.0);
vec3 col = vec3(0.0);
col = vec3(1.0)*(h+0.1);
col += vec3(1.5)*pow(d, 0.75);
return col;
}
void mainImage(out vec4 fragColor, vec2 fragCoord) {
vec2 q = fragCoord.xy/iResolution.xy;
vec2 p = -1.0 + 2.0*q;
p.x *= iResolution.x/iResolution.y;
vec3 col = getSample1(p, iTime);
fragColor = vec4(col, 1.0);
}

View File

@@ -1,3 +1,4 @@
#include "config.h" #include "config.h"
#include <gtk/gtk.h> #include <gtk/gtk.h>
@@ -33,7 +34,7 @@ static void create_window (GApplication *app, const char *contents);
static void static void
show_action_dialog (GSimpleAction *action) show_action_dialog (GSimpleAction *action)
{ {
const char *name; const gchar *name;
GtkWidget *dialog; GtkWidget *dialog;
name = g_action_get_name (G_ACTION (action)); name = g_action_get_name (G_ACTION (action));
@@ -57,9 +58,9 @@ show_action_infobar (GSimpleAction *action,
gpointer data) gpointer data)
{ {
DemoApplicationWindow *window = data; DemoApplicationWindow *window = data;
char *text; gchar *text;
const char *name; const gchar *name;
const char *value; const gchar *value;
name = g_action_get_name (G_ACTION (action)); name = g_action_get_name (G_ACTION (action));
value = g_variant_get_string (parameter, NULL); value = g_variant_get_string (parameter, NULL);
@@ -91,7 +92,7 @@ activate_new (GSimpleAction *action,
static void static void
open_response_cb (GtkNativeDialog *dialog, open_response_cb (GtkNativeDialog *dialog,
int response_id, gint response_id,
gpointer user_data) gpointer user_data)
{ {
GtkFileChooserNative *native = user_data; GtkFileChooserNative *native = user_data;
@@ -184,7 +185,7 @@ activate_about (GSimpleAction *action,
{ {
GtkWidget *window = user_data; GtkWidget *window = user_data;
const char *authors[] = { const gchar *authors[] = {
"Peter Mattis", "Peter Mattis",
"Spencer Kimball", "Spencer Kimball",
"Josh MacDonald", "Josh MacDonald",
@@ -192,7 +193,7 @@ activate_about (GSimpleAction *action,
NULL NULL
}; };
const char *documentors[] = { const gchar *documentors[] = {
"Owen Taylor", "Owen Taylor",
"Tony Gale", "Tony Gale",
"Matthias Clasen <mclasen@redhat.com>", "Matthias Clasen <mclasen@redhat.com>",
@@ -243,9 +244,9 @@ static void
update_statusbar (GtkTextBuffer *buffer, update_statusbar (GtkTextBuffer *buffer,
DemoApplicationWindow *window) DemoApplicationWindow *window)
{ {
char *msg; gchar *msg;
int row, col; gint row, col;
int count; gint count;
GtkTextIter iter; GtkTextIter iter;
/* clear any previous message, underflow is allowed */ /* clear any previous message, underflow is allowed */
@@ -465,18 +466,18 @@ demo_application_window_size_allocate (GtkWidget *widget,
baseline); baseline);
if (!window->maximized && !window->fullscreen) if (!window->maximized && !window->fullscreen)
gtk_window_get_default_size (GTK_WINDOW (window), &window->width, &window->height); gtk_window_get_size (GTK_WINDOW (window), &window->width, &window->height);
} }
static void static void
surface_state_changed (GtkWidget *widget) surface_state_changed (GtkWidget *widget)
{ {
DemoApplicationWindow *window = (DemoApplicationWindow *)widget; DemoApplicationWindow *window = (DemoApplicationWindow *)widget;
GdkToplevelState new_state; GdkSurfaceState new_state;
new_state = gdk_toplevel_get_state (GDK_TOPLEVEL (gtk_native_get_surface (GTK_NATIVE (widget)))); new_state = gdk_toplevel_get_state (GDK_TOPLEVEL (gtk_native_get_surface (GTK_NATIVE (widget))));
window->maximized = (new_state & GDK_TOPLEVEL_STATE_MAXIMIZED) != 0; window->maximized = (new_state & GDK_SURFACE_STATE_MAXIMIZED) != 0;
window->fullscreen = (new_state & GDK_TOPLEVEL_STATE_FULLSCREEN) != 0; window->fullscreen = (new_state & GDK_SURFACE_STATE_FULLSCREEN) != 0;
} }
static void static void

View File

@@ -31,8 +31,8 @@
</object> </object>
</child> </child>
<layout> <layout>
<property name="column">0</property> <property name="left-attach">0</property>
<property name="row">0</property> <property name="top-attach">0</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -54,8 +54,8 @@
</object> </object>
</child> </child>
<layout> <layout>
<property name="column">0</property> <property name="left-attach">0</property>
<property name="row">1</property> <property name="top-attach">1</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -70,8 +70,8 @@
</object> </object>
</child> </child>
<layout> <layout>
<property name="column">0</property> <property name="left-attach">0</property>
<property name="row">2</property> <property name="top-attach">2</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -79,8 +79,8 @@
<object class="GtkStatusbar" id="status"> <object class="GtkStatusbar" id="status">
<property name="hexpand">1</property> <property name="hexpand">1</property>
<layout> <layout>
<property name="column">0</property> <property name="left-attach">0</property>
<property name="row">3</property> <property name="top-attach">3</property>
</layout> </layout>
</object> </object>
</child> </child>

View File

@@ -16,8 +16,8 @@ static GtkWidget *placeholder;
static void static void
on_name_appeared (GDBusConnection *connection, on_name_appeared (GDBusConnection *connection,
const char *name, const gchar *name,
const char *name_owner, const gchar *name_owner,
gpointer user_data) gpointer user_data)
{ {
name_seen = TRUE; name_seen = TRUE;
@@ -25,7 +25,7 @@ on_name_appeared (GDBusConnection *connection,
static void static void
on_name_vanished (GDBusConnection *connection, on_name_vanished (GDBusConnection *connection,
const char *name, const gchar *name,
gpointer user_data) gpointer user_data)
{ {
if (!name_seen) if (!name_seen)
@@ -55,7 +55,7 @@ do_application_demo (GtkWidget *toplevel)
if (placeholder == NULL) if (placeholder == NULL)
{ {
const char *command; const gchar *command;
GError *error = NULL; GError *error = NULL;
if (g_file_test ("./gtk4-demo-application" APP_EXTENSION, G_FILE_TEST_IS_EXECUTABLE)) if (g_file_test ("./gtk4-demo-application" APP_EXTENSION, G_FILE_TEST_IS_EXECUTABLE))

View File

@@ -1,8 +1,8 @@
/* Assistant /* Assistant
* *
* Demonstrates a sample multi-step assistant with GtkAssistant. Assistants * Demonstrates a sample multi-step assistant. Assistants are used to divide
* are used to divide an operation into several simpler sequential steps, * an operation into several simpler sequential steps, and to guide the user
* and to guide the user through these steps. * through these steps.
*/ */
#include <gtk/gtk.h> #include <gtk/gtk.h>
@@ -12,7 +12,7 @@ static GtkWidget *progress_bar = NULL;
static gboolean static gboolean
apply_changes_gradually (gpointer data) apply_changes_gradually (gpointer data)
{ {
double fraction; gdouble fraction;
/* Work, work, work... */ /* Work, work, work... */
fraction = gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (progress_bar)); fraction = gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (progress_bar));
@@ -47,8 +47,8 @@ on_assistant_close_cancel (GtkWidget *widget, gpointer data)
static void static void
on_assistant_prepare (GtkWidget *widget, GtkWidget *page, gpointer data) on_assistant_prepare (GtkWidget *widget, GtkWidget *page, gpointer data)
{ {
int current_page, n_pages; gint current_page, n_pages;
char *title; gchar *title;
current_page = gtk_assistant_get_current_page (GTK_ASSISTANT (widget)); current_page = gtk_assistant_get_current_page (GTK_ASSISTANT (widget));
n_pages = gtk_assistant_get_n_pages (GTK_ASSISTANT (widget)); n_pages = gtk_assistant_get_n_pages (GTK_ASSISTANT (widget));
@@ -70,8 +70,8 @@ on_entry_changed (GtkWidget *widget, gpointer data)
{ {
GtkAssistant *assistant = GTK_ASSISTANT (data); GtkAssistant *assistant = GTK_ASSISTANT (data);
GtkWidget *current_page; GtkWidget *current_page;
int page_number; gint page_number;
const char *text; const gchar *text;
page_number = gtk_assistant_get_current_page (assistant); page_number = gtk_assistant_get_current_page (assistant);
current_page = gtk_assistant_get_nth_page (assistant, page_number); current_page = gtk_assistant_get_nth_page (assistant, page_number);

View File

@@ -1,26 +0,0 @@
uniform float u_time;
void
mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec2 uv)
{
vec2 pos = (fragCoord.xy * 2.0 - resolution.xy)/ min (resolution.x, resolution.y) ;
float t0 = sin ((u_time + 0.00)*1.0);
float t1 = sin ((u_time + 0.30)*0.4);
float t2 = cos ((u_time + 0.23)*0.9);
float t3 = cos ((u_time + 0.41)*0.6);
float t4 = cos ((u_time + 0.11)*0.3);
vec2 p0 = vec2 (t1, t0) ;
vec2 p1 = vec2 (t2, t3) ;
vec2 p2 = vec2 (t4, t3) ;
float r = 1.0/distance (pos, p0);
float g = 1.0/distance (pos, p1);
float b = 1.0/distance (pos, p2);
float sum = r + g + b;
float alpha = 1.0 - pow (1.0/(sum), 40.0)*pow (10.0, 40.0*0.7);
fragColor = vec4 (r*0.5, g*0.5, b*0.5, 1.0) * alpha;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<interface> <interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkWindow" id="window"> <object class="GtkWindow" id="window">
<property name="resizable">0</property> <property name="resizable">0</property>
<property name="title">CSS Blend Modes</property> <property name="title">CSS Blend Modes</property>
@@ -7,10 +8,6 @@
<property name="default-height">300</property> <property name="default-height">300</property>
<child> <child>
<object class="GtkGrid"> <object class="GtkGrid">
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<property name="margin-top">12</property>
<property name="margin-bottom">12</property>
<property name="row-spacing">12</property> <property name="row-spacing">12</property>
<property name="column-spacing">12</property> <property name="column-spacing">12</property>
<child> <child>
@@ -21,8 +18,8 @@
<class name="dim-label"/> <class name="dim-label"/>
</style> </style>
<layout> <layout>
<property name="column">0</property> <property name="left-attach">0</property>
<property name="row">0</property> <property name="top-attach">0</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -32,8 +29,8 @@
<property name="has-frame">1</property> <property name="has-frame">1</property>
<property name="min-content-width">150</property> <property name="min-content-width">150</property>
<layout> <layout>
<property name="column">0</property> <property name="left-attach">0</property>
<property name="row">1</property> <property name="top-attach">1</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -43,8 +40,8 @@
<property name="hexpand">1</property> <property name="hexpand">1</property>
<property name="stack">stack</property> <property name="stack">stack</property>
<layout> <layout>
<property name="column">1</property> <property name="left-attach">1</property>
<property name="row">0</property> <property name="top-attach">0</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -70,8 +67,8 @@
<object class="GtkLabel"> <object class="GtkLabel">
<property name="label" translatable="yes">Duck</property> <property name="label" translatable="yes">Duck</property>
<layout> <layout>
<property name="column">0</property> <property name="left-attach">0</property>
<property name="row">0</property> <property name="top-attach">0</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -79,8 +76,8 @@
<object class="GtkLabel"> <object class="GtkLabel">
<property name="label" translatable="yes">Background</property> <property name="label" translatable="yes">Background</property>
<layout> <layout>
<property name="column">1</property> <property name="left-attach">1</property>
<property name="row">0</property> <property name="top-attach">0</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -90,8 +87,8 @@
<class name="duck"/> <class name="duck"/>
</style> </style>
<layout> <layout>
<property name="column">0</property> <property name="left-attach">0</property>
<property name="row">1</property> <property name="top-attach">1</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -101,8 +98,8 @@
<class name="gradient"/> <class name="gradient"/>
</style> </style>
<layout> <layout>
<property name="column">1</property> <property name="left-attach">1</property>
<property name="row">1</property> <property name="top-attach">1</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -111,8 +108,8 @@
<property name="label" translatable="yes"> <property name="label" translatable="yes">
Blended picture</property> Blended picture</property>
<layout> <layout>
<property name="column">0</property> <property name="left-attach">0</property>
<property name="row">2</property> <property name="top-attach">2</property>
<property name="column-span">2</property> <property name="column-span">2</property>
</layout> </layout>
</object> </object>
@@ -124,8 +121,8 @@ Blended picture</property>
<class name="blend0"/> <class name="blend0"/>
</style> </style>
<layout> <layout>
<property name="column">0</property> <property name="left-attach">0</property>
<property name="row">3</property> <property name="top-attach">3</property>
<property name="column-span">2</property> <property name="column-span">2</property>
</layout> </layout>
</object> </object>
@@ -149,8 +146,8 @@ Blended picture</property>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="label" translatable="yes">Red</property> <property name="label" translatable="yes">Red</property>
<layout> <layout>
<property name="column">0</property> <property name="left-attach">0</property>
<property name="row">0</property> <property name="top-attach">0</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -158,8 +155,8 @@ Blended picture</property>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="label" translatable="yes">Blue</property> <property name="label" translatable="yes">Blue</property>
<layout> <layout>
<property name="column">1</property> <property name="left-attach">1</property>
<property name="row">0</property> <property name="top-attach">0</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -169,8 +166,8 @@ Blended picture</property>
<class name="red"/> <class name="red"/>
</style> </style>
<layout> <layout>
<property name="column">0</property> <property name="left-attach">0</property>
<property name="row">1</property> <property name="top-attach">1</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -180,8 +177,8 @@ Blended picture</property>
<class name="blue"/> <class name="blue"/>
</style> </style>
<layout> <layout>
<property name="column">1</property> <property name="left-attach">1</property>
<property name="row">1</property> <property name="top-attach">1</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -190,8 +187,8 @@ Blended picture</property>
<property name="label" translatable="yes"> <property name="label" translatable="yes">
Blended picture</property> Blended picture</property>
<layout> <layout>
<property name="column">0</property> <property name="left-attach">0</property>
<property name="row">2</property> <property name="top-attach">2</property>
<property name="column-span">2</property> <property name="column-span">2</property>
</layout> </layout>
</object> </object>
@@ -203,8 +200,8 @@ Blended picture</property>
<class name="blend1"/> <class name="blend1"/>
</style> </style>
<layout> <layout>
<property name="column">0</property> <property name="left-attach">0</property>
<property name="row">3</property> <property name="top-attach">3</property>
<property name="column-span">2</property> <property name="column-span">2</property>
</layout> </layout>
</object> </object>
@@ -231,8 +228,8 @@ Blended picture</property>
<class name="cyan"/> <class name="cyan"/>
</style> </style>
<layout> <layout>
<property name="column">0</property> <property name="left-attach">0</property>
<property name="row">1</property> <property name="top-attach">1</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -242,8 +239,8 @@ Blended picture</property>
<class name="magenta"/> <class name="magenta"/>
</style> </style>
<layout> <layout>
<property name="column">1</property> <property name="left-attach">1</property>
<property name="row">1</property> <property name="top-attach">1</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -253,8 +250,8 @@ Blended picture</property>
<class name="yellow"/> <class name="yellow"/>
</style> </style>
<layout> <layout>
<property name="column">0</property> <property name="left-attach">0</property>
<property name="row">3</property> <property name="top-attach">3</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -265,8 +262,8 @@ Blended picture</property>
<class name="blend2"/> <class name="blend2"/>
</style> </style>
<layout> <layout>
<property name="column">1</property> <property name="left-attach">1</property>
<property name="row">3</property> <property name="top-attach">3</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -278,8 +275,8 @@ Blended picture</property>
<class name="dim-label"/> <class name="dim-label"/>
</style> </style>
<layout> <layout>
<property name="column">0</property> <property name="left-attach">0</property>
<property name="row">0</property> <property name="top-attach">0</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -291,8 +288,8 @@ Blended picture</property>
<class name="dim-label"/> <class name="dim-label"/>
</style> </style>
<layout> <layout>
<property name="column">1</property> <property name="left-attach">1</property>
<property name="row">0</property> <property name="top-attach">0</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -304,8 +301,8 @@ Blended picture</property>
<class name="dim-label"/> <class name="dim-label"/>
</style> </style>
<layout> <layout>
<property name="column">0</property> <property name="left-attach">0</property>
<property name="row">2</property> <property name="top-attach">2</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -317,8 +314,8 @@ Blended picture</property>
<attribute name="weight" value="bold"></attribute> <attribute name="weight" value="bold"></attribute>
</attributes> </attributes>
<layout> <layout>
<property name="column">1</property> <property name="left-attach">1</property>
<property name="row">2</property> <property name="top-attach">2</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -327,8 +324,8 @@ Blended picture</property>
</object> </object>
</child> </child>
<layout> <layout>
<property name="column">1</property> <property name="left-attach">1</property>
<property name="row">1</property> <property name="top-attach">1</property>
</layout> </layout>
</object> </object>
</child> </child>

View File

@@ -132,10 +132,10 @@ blur_overlay_child_update_style_classes (BlurOverlay *overlay,
gboolean is_left, is_right, is_top, is_bottom; gboolean is_left, is_right, is_top, is_bottom;
gboolean has_left, has_right, has_top, has_bottom; gboolean has_left, has_right, has_top, has_bottom;
has_left = gtk_widget_has_css_class (child, "left"); has_left = gtk_widget_has_css_class (child, GTK_STYLE_CLASS_LEFT);
has_right = gtk_widget_has_css_class (child, "right"); has_right = gtk_widget_has_css_class (child, GTK_STYLE_CLASS_RIGHT);
has_top = gtk_widget_has_css_class (child, "top"); has_top = gtk_widget_has_css_class (child, GTK_STYLE_CLASS_TOP);
has_bottom = gtk_widget_has_css_class (child, "bottom"); has_bottom = gtk_widget_has_css_class (child, GTK_STYLE_CLASS_BOTTOM);
is_left = is_right = is_top = is_bottom = FALSE; is_left = is_right = is_top = is_bottom = FALSE;
@@ -158,24 +158,24 @@ blur_overlay_child_update_style_classes (BlurOverlay *overlay,
is_bottom = (child_allocation->y + child_allocation->height == height); is_bottom = (child_allocation->y + child_allocation->height == height);
if (has_left && !is_left) if (has_left && !is_left)
gtk_widget_remove_css_class (child, "left"); gtk_widget_remove_css_class (child, GTK_STYLE_CLASS_LEFT);
else if (!has_left && is_left) else if (!has_left && is_left)
gtk_widget_add_css_class (child, "left"); gtk_widget_add_css_class (child, GTK_STYLE_CLASS_LEFT);
if (has_right && !is_right) if (has_right && !is_right)
gtk_widget_remove_css_class (child, "right"); gtk_widget_remove_css_class (child, GTK_STYLE_CLASS_RIGHT);
else if (!has_right && is_right) else if (!has_right && is_right)
gtk_widget_add_css_class (child, "right"); gtk_widget_add_css_class (child, GTK_STYLE_CLASS_RIGHT);
if (has_top && !is_top) if (has_top && !is_top)
gtk_widget_remove_css_class (child, "top"); gtk_widget_remove_css_class (child, GTK_STYLE_CLASS_TOP);
else if (!has_top && is_top) else if (!has_top && is_top)
gtk_widget_add_css_class (child, "top"); gtk_widget_add_css_class (child, GTK_STYLE_CLASS_TOP);
if (has_bottom && !is_bottom) if (has_bottom && !is_bottom)
gtk_widget_remove_css_class (child, "bottom"); gtk_widget_remove_css_class (child, GTK_STYLE_CLASS_BOTTOM);
else if (!has_bottom && is_bottom) else if (!has_bottom && is_bottom)
gtk_widget_add_css_class (child, "bottom"); gtk_widget_add_css_class (child, GTK_STYLE_CLASS_BOTTOM);
} }
static void static void

View File

@@ -1,8 +1,6 @@
/* Builder /* Builder
* #Keywords: GMenu, GtkPopoverMenuBar, GtkBuilder, GtkStatusBar, GtkShortcutController, toolbar
* *
* Demonstrates a traditional interface, loaded from a XML description, * Demonstrates an interface loaded from a XML description.
* and shows how to connect actions to the menu items and toolbar buttons.
*/ */
#include <gtk/gtk.h> #include <gtk/gtk.h>
@@ -23,38 +21,15 @@ about_activate (GSimpleAction *action,
gpointer user_data) gpointer user_data)
{ {
GtkWidget *window = user_data; GtkWidget *window = user_data;
GtkBuilder *builder;
GtkWidget *about_dlg; GtkWidget *about_dlg;
about_dlg = GTK_WIDGET (g_object_get_data (G_OBJECT (window), "about")); builder = g_object_get_data (G_OBJECT (window), "builder");
gtk_window_present (GTK_WINDOW (about_dlg)); about_dlg = GTK_WIDGET (gtk_builder_get_object (builder, "aboutdialog1"));
} gtk_window_set_transient_for (GTK_WINDOW (about_dlg), GTK_WINDOW (window));
gtk_window_set_hide_on_close (GTK_WINDOW (about_dlg), TRUE);
static void g_signal_connect (about_dlg, "response", G_CALLBACK (gtk_widget_hide), NULL);
remove_timeout (gpointer data) gtk_widget_show (about_dlg);
{
guint id = GPOINTER_TO_UINT (data);
g_source_remove (id);
}
static gboolean
pop_status (gpointer data)
{
gtk_statusbar_pop (GTK_STATUSBAR (data), 0);
g_object_set_data (G_OBJECT (data), "timeout", NULL);
return G_SOURCE_REMOVE;
}
static void
status_message (GtkStatusbar *status,
const char *text)
{
guint id;
gtk_statusbar_push (GTK_STATUSBAR (status), 0, text);
id = g_timeout_add (5000, pop_status, status);
g_object_set_data_full (G_OBJECT (status), "timeout", GUINT_TO_POINTER (id), remove_timeout);
} }
static void static void
@@ -62,10 +37,7 @@ help_activate (GSimpleAction *action,
GVariant *parameter, GVariant *parameter,
gpointer user_data) gpointer user_data)
{ {
GtkWidget *status; g_print ("Help not available\n");
status = GTK_WIDGET (g_object_get_data (G_OBJECT (user_data), "status"));
status_message (GTK_STATUSBAR (status), "Help not available");
} }
static void static void
@@ -73,13 +45,7 @@ not_implemented (GSimpleAction *action,
GVariant *parameter, GVariant *parameter,
gpointer user_data) gpointer user_data)
{ {
GtkWidget *status; g_print ("Action “%s” not implemented\n", g_action_get_name (G_ACTION (action)));
char *text;
text = g_strdup_printf ("Action “%s” not implemented", g_action_get_name (G_ACTION (action)));
status = GTK_WIDGET (g_object_get_data (G_OBJECT (user_data), "status"));
status_message (GTK_STATUSBAR (status), text);
g_free (text);
} }
static GActionEntry win_entries[] = { static GActionEntry win_entries[] = {
@@ -104,9 +70,6 @@ do_builder (GtkWidget *do_widget)
if (!window) if (!window)
{ {
GtkBuilder *builder; GtkBuilder *builder;
GtkWidget *about;
GtkWidget *status;
GtkEventController *controller;
builder = gtk_builder_new_from_resource ("/builder/demo.ui"); builder = gtk_builder_new_from_resource ("/builder/demo.ui");
@@ -120,50 +83,6 @@ do_builder (GtkWidget *do_widget)
window); window);
gtk_widget_insert_action_group (window, "win", actions); gtk_widget_insert_action_group (window, "win", actions);
controller = gtk_shortcut_controller_new ();
gtk_shortcut_controller_set_scope (GTK_SHORTCUT_CONTROLLER (controller),
GTK_SHORTCUT_SCOPE_GLOBAL);
gtk_widget_add_controller (window, controller);
gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller),
gtk_shortcut_new (gtk_keyval_trigger_new (GDK_KEY_n, GDK_CONTROL_MASK),
gtk_named_action_new ("win.new")));
gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller),
gtk_shortcut_new (gtk_keyval_trigger_new (GDK_KEY_o, GDK_CONTROL_MASK),
gtk_named_action_new ("win.open")));
gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller),
gtk_shortcut_new (gtk_keyval_trigger_new (GDK_KEY_s, GDK_CONTROL_MASK),
gtk_named_action_new ("win.save")));
gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller),
gtk_shortcut_new (gtk_keyval_trigger_new (GDK_KEY_s, GDK_CONTROL_MASK|GDK_SHIFT_MASK),
gtk_named_action_new ("win.save-as")));
gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller),
gtk_shortcut_new (gtk_keyval_trigger_new (GDK_KEY_q, GDK_CONTROL_MASK),
gtk_named_action_new ("win.quit")));
gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller),
gtk_shortcut_new (gtk_keyval_trigger_new (GDK_KEY_c, GDK_CONTROL_MASK),
gtk_named_action_new ("win.copy")));
gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller),
gtk_shortcut_new (gtk_keyval_trigger_new (GDK_KEY_x, GDK_CONTROL_MASK),
gtk_named_action_new ("win.cut")));
gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller),
gtk_shortcut_new (gtk_keyval_trigger_new (GDK_KEY_v, GDK_CONTROL_MASK),
gtk_named_action_new ("win.paste")));
gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller),
gtk_shortcut_new (gtk_keyval_trigger_new (GDK_KEY_F1, 0),
gtk_named_action_new ("win.help")));
gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller),
gtk_shortcut_new (gtk_keyval_trigger_new (GDK_KEY_F7, 0),
gtk_named_action_new ("win.about")));
about = GTK_WIDGET (gtk_builder_get_object (builder, "aboutdialog1"));
gtk_window_set_transient_for (GTK_WINDOW (about), GTK_WINDOW (window));
gtk_window_set_hide_on_close (GTK_WINDOW (about), TRUE);
g_object_set_data_full (G_OBJECT (window), "about",
about, (GDestroyNotify)gtk_window_destroy);
status = GTK_WIDGET (gtk_builder_get_object (builder, "statusbar1"));
g_object_set_data (G_OBJECT (window), "status", status);
g_object_unref (builder); g_object_unref (builder);
} }

View File

@@ -1,224 +0,0 @@
// Originally from: https://www.shadertoy.com/view/3ljyDD
// License CC0: Hexagonal tiling + cog wheels
// Nothing fancy, just hexagonal tiling + cog wheels
#define PI 3.141592654
#define TAU (2.0*PI)
#define MROT(a) mat2(cos(a), sin(a), -sin(a), cos(a))
float hash(in vec2 co) {
return fract(sin(dot(co.xy ,vec2(12.9898,58.233))) * 13758.5453);
}
float pcos(float a) {
return 0.5 + 0.5*cos(a);
}
void rot(inout vec2 p, float a) {
float c = cos(a);
float s = sin(a);
p = vec2(c*p.x + s*p.y, -s*p.x + c*p.y);
}
float modPolar(inout vec2 p, float repetitions) {
float angle = 2.0*PI/repetitions;
float a = atan(p.y, p.x) + angle/2.;
float r = length(p);
float c = floor(a/angle);
a = mod(a,angle) - angle/2.;
p = vec2(cos(a), sin(a))*r;
// For an odd number of repetitions, fix cell index of the cell in -x direction
// (cell index would be e.g. -5 and 5 in the two halves of the cell):
if (abs(c) >= (repetitions/2.0)) c = abs(c);
return c;
}
float pmin(float a, float b, float k) {
float h = clamp( 0.5+0.5*(b-a)/k, 0.0, 1.0 );
return mix( b, a, h ) - k*h*(1.0-h);
}
const vec2 sz = vec2(1.0, sqrt(3.0));
const vec2 hsz = 0.5*sz;
const float smallCount = 16.0;
vec2 hextile(inout vec2 p) {
// See Art of Code: Hexagonal Tiling Explained!
// https://www.youtube.com/watch?v=VmrIDyYiJBA
vec2 p1 = mod(p, sz)-hsz;
vec2 p2 = mod(p - hsz*1.0, sz)-hsz;
vec2 p3 = mix(p2, p1, vec2(length(p1) < length(p2)));
vec2 n = p3 - p;
p = p3;
return n;
}
float circle(vec2 p, float r) {
return length(p) - r;
}
float box(vec2 p, vec2 b) {
vec2 d = abs(p)-b;
return length(max(d,0.0)) + min(max(d.x,d.y),0.0);
}
float unevenCapsule(vec2 p, float r1, float r2, float h) {
p.x = abs(p.x);
float b = (r1-r2)/h;
float a = sqrt(1.0-b*b);
float k = dot(p,vec2(-b,a));
if( k < 0.0 ) return length(p) - r1;
if( k > a*h ) return length(p-vec2(0.0,h)) - r2;
return dot(p, vec2(a,b) ) - r1;
}
float cogwheel(vec2 p, float innerRadius, float outerRadius, float cogs, float holes) {
float cogWidth = 0.25*innerRadius*TAU/cogs;
float d0 = circle(p, innerRadius);
vec2 icp = p;
modPolar(icp, holes);
icp -= vec2(innerRadius*0.55, 0.0);
float d1 = circle(icp, innerRadius*0.25);
vec2 cp = p;
modPolar(cp, cogs);
cp -= vec2(innerRadius, 0.0);
float d2 = unevenCapsule(cp.yx, cogWidth, cogWidth*0.75, (outerRadius-innerRadius));
float d3 = circle(p, innerRadius*0.20);
float d = 1E6;
d = min(d, d0);
d = pmin(d, d2, 0.5*cogWidth);
d = min(d, d2);
d = max(d, -d1);
d = max(d, -d3);
return d;
}
float ccell1(vec2 p, float r) {
float d = 1E6;
const float bigCount = 60.0;
vec2 cp0 = p;
rot(cp0, -iTime*TAU/bigCount);
float d0 = cogwheel(cp0, 0.36, 0.38, bigCount, 5.0);
vec2 cp1 = p;
float nm = modPolar(cp1, 6.0);
cp1 -= vec2(0.5, 0.0);
rot(cp1, 0.2+TAU*nm/2.0 + iTime*TAU/smallCount);
float d1 = cogwheel(cp1, 0.11, 0.125, smallCount, 5.0);
d = min(d, d0);
d = min(d, d1);
return d;
}
float ccell2(vec2 p, float r) {
float d = 1E6;
vec2 cp0 = p;
float nm = modPolar(cp0, 6.0);
vec2 cp1 = cp0;
const float off = 0.275;
const float count = smallCount + 2.0;
cp0 -= vec2(off, 0.0);
rot(cp0, 0.+TAU*nm/2.0 - iTime*TAU/count);
float d0 = cogwheel(cp0, 0.09, 0.105, count, 5.0);
cp1 -= vec2(0.5, 0.0);
rot(cp1, 0.2+TAU*nm/2.0 + iTime*TAU/smallCount);
float d1 = cogwheel(cp1, 0.11, 0.125, smallCount, 5.0);
float l = length(p);
float d2 = l - (off+0.055);
float d3 = d2 + 0.020;;
vec2 tp0 = p;
modPolar(tp0, 60.0);
tp0.x -= off;
float d4 = box(tp0, vec2(0.0125, 0.005));
float ctime = -(iTime*0.05 + r)*TAU;
vec2 tp1 = p;
rot(tp1, ctime*12.0);
tp1.x -= 0.13;
float d5 = box(tp1, vec2(0.125, 0.005));
vec2 tp2 = p;
rot(tp2, ctime);
tp2.x -= 0.13*0.5;
float d6 = box(tp2, vec2(0.125*0.5, 0.0075));
float d7 = l - 0.025;
float d8 = l - 0.0125;
d = min(d, d0);
d = min(d, d1);
d = min(d, d2);
d = max(d, -d3);
d = min(d, d4);
d = min(d, d5);
d = min(d, d6);
d = min(d, d7);
d = max(d, -d8);
return d;
}
float df(vec2 p, float scale, inout vec2 nn) {
p /= scale;
nn = hextile(p);
nn = floor(nn + 0.5);
float r = hash(nn);
float d;;
if (r < 0.5) {
d = ccell1(p, r);
} else {
d = ccell2(p, r);
}
return d*scale;
}
vec3 postProcess(vec3 col, vec2 q) {
//col = saturate(col);
col=pow(clamp(col,0.0,1.0),vec3(0.75));
col=col*0.6+0.4*col*col*(3.0-2.0*col); // contrast
col=mix(col, vec3(dot(col, vec3(0.33))), -0.4); // satuation
col*=0.5+0.5*pow(19.0*q.x*q.y*(1.0-q.x)*(1.0-q.y),0.7); // vigneting
return col;
}
void mainImage(out vec4 fragColor, vec2 fragCoord) {
vec2 q = fragCoord/iResolution.xy;
vec2 p = -1.0 + 2.0*q;
p.x *= iResolution.x/iResolution.y;
float tm = iTime*0.1;
p += vec2(cos(tm), sin(tm*sqrt(0.5)));
float z = mix(0.5, 1.0, pcos(tm*sqrt(0.3)));
float aa = 4.0 / iResolution.y;
vec2 nn = vec2(0.0);
float d = df(p, z, nn);
vec3 col = vec3(160.0)/vec3(255.0);
vec3 baseCol = vec3(0.3);
vec4 logoCol = vec4(baseCol, 1.0)*smoothstep(-aa, 0.0, -d);
col = mix(col, logoCol.xyz, pow(logoCol.w, 8.0));
col += 0.4*pow(abs(sin(20.0*d)), 0.6);
col = postProcess(col, q);
fragColor = vec4(col, 1.0);
}

View File

@@ -1,226 +0,0 @@
uniform float iTime;
// Originally from: https://www.shadertoy.com/view/3ljyDD
// License CC0: Hexagonal tiling + cog wheels
// Nothing fancy, just hexagonal tiling + cog wheels
#define PI 3.141592654
#define TAU (2.0*PI)
#define MROT(a) mat2(cos(a), sin(a), -sin(a), cos(a))
float hash(in vec2 co) {
return fract(sin(dot(co.xy ,vec2(12.9898,58.233))) * 13758.5453);
}
float pcos(float a) {
return 0.5 + 0.5*cos(a);
}
void rot(inout vec2 p, float a) {
float c = cos(a);
float s = sin(a);
p = vec2(c*p.x + s*p.y, -s*p.x + c*p.y);
}
float modPolar(inout vec2 p, float repetitions) {
float angle = 2.0*PI/repetitions;
float a = atan(p.y, p.x) + angle/2.;
float r = length(p);
float c = floor(a/angle);
a = mod(a,angle) - angle/2.;
p = vec2(cos(a), sin(a))*r;
// For an odd number of repetitions, fix cell index of the cell in -x direction
// (cell index would be e.g. -5 and 5 in the two halves of the cell):
if (abs(c) >= (repetitions/2.0)) c = abs(c);
return c;
}
float pmin(float a, float b, float k) {
float h = clamp( 0.5+0.5*(b-a)/k, 0.0, 1.0 );
return mix( b, a, h ) - k*h*(1.0-h);
}
const vec2 sz = vec2(1.0, sqrt(3.0));
const vec2 hsz = 0.5*sz;
const float smallCount = 16.0;
vec2 hextile(inout vec2 p) {
// See Art of Code: Hexagonal Tiling Explained!
// https://www.youtube.com/watch?v=VmrIDyYiJBA
vec2 p1 = mod(p, sz)-hsz;
vec2 p2 = mod(p - hsz*1.0, sz)-hsz;
vec2 p3 = mix(p2, p1, vec2(length(p1) < length(p2)));
vec2 n = p3 - p;
p = p3;
return n;
}
float circle(vec2 p, float r) {
return length(p) - r;
}
float box(vec2 p, vec2 b) {
vec2 d = abs(p)-b;
return length(max(d,0.0)) + min(max(d.x,d.y),0.0);
}
float unevenCapsule(vec2 p, float r1, float r2, float h) {
p.x = abs(p.x);
float b = (r1-r2)/h;
float a = sqrt(1.0-b*b);
float k = dot(p,vec2(-b,a));
if( k < 0.0 ) return length(p) - r1;
if( k > a*h ) return length(p-vec2(0.0,h)) - r2;
return dot(p, vec2(a,b) ) - r1;
}
float cogwheel(vec2 p, float innerRadius, float outerRadius, float cogs, float holes) {
float cogWidth = 0.25*innerRadius*TAU/cogs;
float d0 = circle(p, innerRadius);
vec2 icp = p;
modPolar(icp, holes);
icp -= vec2(innerRadius*0.55, 0.0);
float d1 = circle(icp, innerRadius*0.25);
vec2 cp = p;
modPolar(cp, cogs);
cp -= vec2(innerRadius, 0.0);
float d2 = unevenCapsule(cp.yx, cogWidth, cogWidth*0.75, (outerRadius-innerRadius));
float d3 = circle(p, innerRadius*0.20);
float d = 1E6;
d = min(d, d0);
d = pmin(d, d2, 0.5*cogWidth);
d = min(d, d2);
d = max(d, -d1);
d = max(d, -d3);
return d;
}
float ccell1(vec2 p, float r) {
float d = 1E6;
const float bigCount = 60.0;
vec2 cp0 = p;
rot(cp0, -iTime*TAU/bigCount);
float d0 = cogwheel(cp0, 0.36, 0.38, bigCount, 5.0);
vec2 cp1 = p;
float nm = modPolar(cp1, 6.0);
cp1 -= vec2(0.5, 0.0);
rot(cp1, 0.2+TAU*nm/2.0 + iTime*TAU/smallCount);
float d1 = cogwheel(cp1, 0.11, 0.125, smallCount, 5.0);
d = min(d, d0);
d = min(d, d1);
return d;
}
float ccell2(vec2 p, float r) {
float d = 1E6;
vec2 cp0 = p;
float nm = modPolar(cp0, 6.0);
vec2 cp1 = cp0;
const float off = 0.275;
const float count = smallCount + 2.0;
cp0 -= vec2(off, 0.0);
rot(cp0, 0.+TAU*nm/2.0 - iTime*TAU/count);
float d0 = cogwheel(cp0, 0.09, 0.105, count, 5.0);
cp1 -= vec2(0.5, 0.0);
rot(cp1, 0.2+TAU*nm/2.0 + iTime*TAU/smallCount);
float d1 = cogwheel(cp1, 0.11, 0.125, smallCount, 5.0);
float l = length(p);
float d2 = l - (off+0.055);
float d3 = d2 + 0.020;;
vec2 tp0 = p;
modPolar(tp0, 60.0);
tp0.x -= off;
float d4 = box(tp0, vec2(0.0125, 0.005));
float ctime = -(iTime*0.05 + r)*TAU;
vec2 tp1 = p;
rot(tp1, ctime*12.0);
tp1.x -= 0.13;
float d5 = box(tp1, vec2(0.125, 0.005));
vec2 tp2 = p;
rot(tp2, ctime);
tp2.x -= 0.13*0.5;
float d6 = box(tp2, vec2(0.125*0.5, 0.0075));
float d7 = l - 0.025;
float d8 = l - 0.0125;
d = min(d, d0);
d = min(d, d1);
d = min(d, d2);
d = max(d, -d3);
d = min(d, d4);
d = min(d, d5);
d = min(d, d6);
d = min(d, d7);
d = max(d, -d8);
return d;
}
float df(vec2 p, float scale, inout vec2 nn) {
p /= scale;
nn = hextile(p);
nn = floor(nn + 0.5);
float r = hash(nn);
float d;;
if (r < 0.5) {
d = ccell1(p, r);
} else {
d = ccell2(p, r);
}
return d*scale;
}
vec3 postProcess(vec3 col, vec2 q) {
//col = saturate(col);
col=pow(clamp(col,0.0,1.0),vec3(0.75));
col=col*0.6+0.4*col*col*(3.0-2.0*col); // contrast
col=mix(col, vec3(dot(col, vec3(0.33))), -0.4); // satuation
col*=0.5+0.5*pow(19.0*q.x*q.y*(1.0-q.x)*(1.0-q.y),0.7); // vigneting
return col;
}
void mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec2 uv) {
vec2 q = fragCoord/resolution.xy;
vec2 p = -1.0 + 2.0*q;
p.x *= resolution.x/resolution.y;
float tm = iTime*0.1;
p += vec2(cos(tm), sin(tm*sqrt(0.5)));
float z = mix(0.5, 1.0, pcos(tm*sqrt(0.3)));
float aa = 4.0 / resolution.y;
vec2 nn = vec2(0.0);
float d = df(p, z, nn);
vec3 col = vec3(160.0)/vec3(255.0);
vec3 baseCol = vec3(0.3);
vec4 logoCol = vec4(baseCol, 1.0)*smoothstep(-aa, 0.0, -d);
col = mix(col, logoCol.xyz, pow(logoCol.w, 8.0));
col += 0.4*pow(abs(sin(20.0*d)), 0.6);
col = postProcess(col, q);
fragColor = vec4(col, 1.0);
}

View File

@@ -1,5 +1,4 @@
/* Combo Boxes /* Combo Boxes
* #Keywords: GtkCellRenderer
* *
* The GtkComboBox widget allows to select one option out of a list. * The GtkComboBox widget allows to select one option out of a list.
* The GtkComboBoxEntry additionally allows the user to enter a value * The GtkComboBoxEntry additionally allows the user to enter a value
@@ -39,7 +38,7 @@ create_icon_store (void)
GtkTreeIter iter; GtkTreeIter iter;
GtkListStore *store; GtkListStore *store;
int i; gint i;
store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING); store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
@@ -78,7 +77,7 @@ set_sensitive (GtkCellLayout *cell_layout,
gpointer data) gpointer data)
{ {
GtkTreePath *path; GtkTreePath *path;
int *indices; gint *indices;
gboolean sensitive; gboolean sensitive;
path = gtk_tree_model_get_path (tree_model, iter); path = gtk_tree_model_get_path (tree_model, iter);
@@ -176,7 +175,7 @@ create_capital_store (void)
GtkTreeIter iter, iter2; GtkTreeIter iter, iter2;
GtkTreeStore *store; GtkTreeStore *store;
int i; gint i;
store = gtk_tree_store_new (1, G_TYPE_STRING); store = gtk_tree_store_new (1, G_TYPE_STRING);

View File

@@ -1,16 +1,8 @@
/* Constraints/Simple Constraints /* Constraints/Simple
* #Keywords: GtkLayoutManager
* *
* GtkConstraintLayout provides a layout manager that uses relations * GtkConstraintLayout provides a layout manager that uses relations
* between widgets (also known as constraints) to compute the position * between widgets (also known as "constraints") to compute the position
* and size of each child. * and size of each child.
*
* In addition to child widgets, the constraints can involve spacer
* objects (also known as “guides”). This example has a guide between
* the two buttons in the top row.
*
* Try resizing the window to see how the constraints react to update
* the layout.
*/ */
#include <glib/gi18n.h> #include <glib/gi18n.h>
@@ -241,12 +233,15 @@ simple_grid_init (SimpleGrid *self)
self->button1 = gtk_button_new_with_label ("Child 1"); self->button1 = gtk_button_new_with_label ("Child 1");
gtk_widget_set_parent (self->button1, widget); gtk_widget_set_parent (self->button1, widget);
gtk_widget_set_name (self->button1, "button1");
self->button2 = gtk_button_new_with_label ("Child 2"); self->button2 = gtk_button_new_with_label ("Child 2");
gtk_widget_set_parent (self->button2, widget); gtk_widget_set_parent (self->button2, widget);
gtk_widget_set_name (self->button2, "button2");
self->button3 = gtk_button_new_with_label ("Child 3"); self->button3 = gtk_button_new_with_label ("Child 3");
gtk_widget_set_parent (self->button3, widget); gtk_widget_set_parent (self->button3, widget);
gtk_widget_set_name (self->button3, "button3");
GtkLayoutManager *manager = gtk_widget_get_layout_manager (GTK_WIDGET (self)); GtkLayoutManager *manager = gtk_widget_get_layout_manager (GTK_WIDGET (self));
build_constraints (self, GTK_CONSTRAINT_LAYOUT (manager)); build_constraints (self, GTK_CONSTRAINT_LAYOUT (manager));
@@ -259,12 +254,15 @@ do_constraints (GtkWidget *do_widget)
if (!window) if (!window)
{ {
GtkWidget *box, *grid; GtkWidget *header, *box, *grid, *button;
window = gtk_window_new (); window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget)); gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Simple Constraints"); gtk_window_set_title (GTK_WINDOW (window), "Constraints");
gtk_window_set_default_size (GTK_WINDOW (window), 260, -1);
header = gtk_header_bar_new ();
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), FALSE);
gtk_window_set_titlebar (GTK_WINDOW (window), header);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window); g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
@@ -274,6 +272,12 @@ do_constraints (GtkWidget *do_widget)
gtk_widget_set_hexpand (grid, TRUE); gtk_widget_set_hexpand (grid, TRUE);
gtk_widget_set_vexpand (grid, TRUE); gtk_widget_set_vexpand (grid, TRUE);
gtk_box_append (GTK_BOX (box), grid); gtk_box_append (GTK_BOX (box), grid);
button = gtk_button_new_with_label ("Close");
gtk_box_append (GTK_BOX (box), button);
gtk_widget_set_hexpand (grid, TRUE);
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_window_destroy), window);
} }
if (!gtk_widget_get_visible (window)) if (!gtk_widget_get_visible (window))

View File

@@ -1,7 +1,6 @@
/* Constraints/Interactive Constraints /* Constraints/Interactive
* #Keywords: GtkConstraintLayout
* *
* This example shows how constraints can be updated during user interaction. * Demonstrate how constraints can be updates during user interaction.
* The vertical edge between the buttons can be dragged with the mouse. * The vertical edge between the buttons can be dragged with the mouse.
*/ */
@@ -205,18 +204,21 @@ interactive_grid_init (InteractiveGrid *self)
} }
GtkWidget * GtkWidget *
do_constraints_interactive (GtkWidget *do_widget) do_constraints2 (GtkWidget *do_widget)
{ {
static GtkWidget *window; static GtkWidget *window;
if (!window) if (!window)
{ {
GtkWidget *box, *grid; GtkWidget *header, *box, *grid, *button;
window = gtk_window_new (); window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget)); gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Interactive Constraints"); gtk_window_set_title (GTK_WINDOW (window), "Constraints");
gtk_window_set_default_size (GTK_WINDOW (window), 260, -1);
header = gtk_header_bar_new ();
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), FALSE);
gtk_window_set_titlebar (GTK_WINDOW (window), header);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window); g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
@@ -226,6 +228,12 @@ do_constraints_interactive (GtkWidget *do_widget)
gtk_widget_set_hexpand (grid, TRUE); gtk_widget_set_hexpand (grid, TRUE);
gtk_widget_set_vexpand (grid, TRUE); gtk_widget_set_vexpand (grid, TRUE);
gtk_box_append (GTK_BOX (box), grid); gtk_box_append (GTK_BOX (box), grid);
button = gtk_button_new_with_label ("Close");
gtk_box_append (GTK_BOX (box), button);
gtk_widget_set_hexpand (grid, TRUE);
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_window_destroy), window);
} }
if (!gtk_widget_get_visible (window)) if (!gtk_widget_get_visible (window))

View File

@@ -2,10 +2,6 @@
* *
* GtkConstraintLayout allows defining constraints using a * GtkConstraintLayout allows defining constraints using a
* compact syntax called Visual Format Language, or VFL. * compact syntax called Visual Format Language, or VFL.
*
* A typical example of a VFL specification looks like this:
*
* H:|-[button1(==button2)]-12-[button2]-|
*/ */
#include <glib/gi18n.h> #include <glib/gi18n.h>
@@ -128,18 +124,21 @@ vfl_grid_init (VflGrid *self)
} }
GtkWidget * GtkWidget *
do_constraints_vfl (GtkWidget *do_widget) do_constraints3 (GtkWidget *do_widget)
{ {
static GtkWidget *window; static GtkWidget *window;
if (!window) if (!window)
{ {
GtkWidget *box, *grid; GtkWidget *header, *box, *grid, *button;
window = gtk_window_new (); window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget)); gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "ConstraintsVFL"); gtk_window_set_title (GTK_WINDOW (window), "Constraints");
gtk_window_set_default_size (GTK_WINDOW (window), 260, -1);
header = gtk_header_bar_new ();
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), FALSE);
gtk_window_set_titlebar (GTK_WINDOW (window), header);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window); g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
@@ -149,6 +148,12 @@ do_constraints_vfl (GtkWidget *do_widget)
gtk_widget_set_hexpand (grid, TRUE); gtk_widget_set_hexpand (grid, TRUE);
gtk_widget_set_vexpand (grid, TRUE); gtk_widget_set_vexpand (grid, TRUE);
gtk_box_append (GTK_BOX (box), grid); gtk_box_append (GTK_BOX (box), grid);
button = gtk_button_new_with_label ("Close");
gtk_box_append (GTK_BOX (box), button);
gtk_widget_set_hexpand (grid, TRUE);
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_window_destroy), window);
} }
if (!gtk_widget_get_visible (window)) if (!gtk_widget_get_visible (window))

View File

@@ -1,74 +0,0 @@
/* Constraints/Builder
*
* GtkConstraintLayouts can be created in .ui files, and constraints can
* be set up at that time as well, as this example demonstrates. It shows
* various ways to do spacing and sizing with constraints.
*
* Make the window wider to see the rows react differently
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
G_DECLARE_FINAL_TYPE (ConstraintsGrid, constraints_grid, CONSTRAINTS, GRID, GtkWidget)
struct _ConstraintsGrid
{
GtkWidget parent_instance;
};
G_DEFINE_TYPE (ConstraintsGrid, constraints_grid, GTK_TYPE_WIDGET)
static void
constraints_grid_init (ConstraintsGrid *grid)
{
}
static void
constraints_grid_dispose (GObject *object)
{
GtkWidget *widget = GTK_WIDGET (object);
GtkWidget *child;
while ((child = gtk_widget_get_first_child (widget)))
gtk_widget_unparent (child);
G_OBJECT_CLASS (constraints_grid_parent_class)->dispose (object);
}
static void
constraints_grid_class_init (ConstraintsGridClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->dispose = constraints_grid_dispose;
}
GtkWidget *
do_constraints_builder (GtkWidget *do_widget)
{
static GtkWidget *window;
if (!window)
{
GtkBuilder *builder;
g_type_ensure (constraints_grid_get_type ());
builder = gtk_builder_new_from_resource ("/constraints_builder/constraints_builder.ui");
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
g_object_unref (builder);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@@ -1,460 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow" id="window1">
<property name="title" translatable="yes">ConstraintsBuilder</property>
<property name="default-width">260</property>
<child>
<object class="ConstraintsGrid">
<property name="halign">fill</property>
<property name="valign">fill</property>
<property name="margin-top">10</property>
<property name="margin-bottom">10</property>
<property name="margin-start">10</property>
<property name="margin-end">10</property>
<property name="layout-manager">
<object class="GtkConstraintLayout">
<constraints>
<guide name="guide1" min-width="10" nat-width="200" strength="weak"/>
<guide name="guide2" min-width="10" nat-width="200" strength="weak"/>
<guide name="guide3" min-width="10" nat-width="200" strength="weak"/>
<guide name="guide4" min-width="10" nat-width="200" strength="weak"/>
<guide name="guide5" min-width="10" nat-width="200" strength="weak"/>
<guide name="guide6" min-width="10" nat-width="200" strength="weak"/>
<guide name="guide7" min-width="10" nat-width="200" strength="weak"/>
<guide name="guide8" min-width="10" nat-width="200" strength="weak"/>
<guide name="guide9" min-width="0" nat-width="200" strength="weak"/>
<guide name="guide10" min-width="0" nat-width="200" strength="weak"/>
<guide name="barrier1" min-height="10"/>
<guide name="barrier2" min-height="10"/>
<guide name="barrier3" min-height="10"/>
<guide name="barrier4" min-height="10"/>
<!-- Spread Chain -->
<constraint target="super" target-attribute="top"
relation="eq"
source="button1" source-attribute="top"
strength="required"/>
<constraint target="super" target-attribute="top"
relation="eq"
source="button2" source-attribute="top"
strength="required"/>
<constraint target="super" target-attribute="top"
relation="eq"
source="button3" source-attribute="top"
strength="required"/>
<constraint target="super" target-attribute="left"
relation="eq"
source="guide1" source-attribute="left"
strength="required"/>
<constraint target="button1" target-attribute="left"
relation="eq"
source="guide1" source-attribute="right"
strength="required"/>
<constraint target="guide2" target-attribute="left"
relation="eq"
source="button1" source-attribute="right"
strength="required"/>
<constraint target="button2" target-attribute="left"
relation="eq"
source="guide2" source-attribute="right"
strength="required"/>
<constraint target="guide3" target-attribute="left"
relation="eq"
source="button2" source-attribute="right"
strength="required"/>
<constraint target="button3" target-attribute="left"
relation="eq"
source="guide3" source-attribute="right"
strength="required"/>
<constraint target="guide4" target-attribute="left"
relation="eq"
source="button3" source-attribute="right"
strength="required"/>
<constraint target="super" target-attribute="right"
relation="eq"
source="guide4" source-attribute="right"
strength="required"/>
<constraint target="guide1" target-attribute="width"
relation="eq"
source="guide2" source-attribute="width"
strength="required"/>
<constraint target="guide2" target-attribute="width"
relation="eq"
source="guide3" source-attribute="width"
strength="required"/>
<constraint target="guide3" target-attribute="width"
relation="eq"
source="guide4" source-attribute="width"
strength="required"/>
<constraint target="button1" target-attribute="width"
relation="eq"
source="button2" source-attribute="width"
strength="required"/>
<constraint target="button2" target-attribute="width"
relation="eq"
source="button3" source-attribute="width"
strength="required"/>
<constraint target="button1" target-attribute="bottom"
relation="eq"
source="barrier1" source-attribute="top"
strength="required"/>
<constraint target="button2" target-attribute="bottom"
relation="eq"
source="barrier1" source-attribute="top"
strength="required"/>
<constraint target="button3" target-attribute="bottom"
relation="eq"
source="barrier1" source-attribute="top"
strength="required"/>
<!-- Spread Inside Chain -->
<constraint target="super" target-attribute="left"
relation="eq"
source="button4" source-attribute="left"
strength="required"/>
<constraint target="guide5" target-attribute="left"
relation="eq"
source="button4" source-attribute="right"
strength="required"/>
<constraint target="button5" target-attribute="left"
relation="eq"
source="guide5" source-attribute="right"
strength="required"/>
<constraint target="guide6" target-attribute="left"
relation="eq"
source="button5" source-attribute="right"
strength="required"/>
<constraint target="button6" target-attribute="left"
relation="eq"
source="guide6" source-attribute="right"
strength="required"/>
<constraint target="super" target-attribute="right"
relation="eq"
source="button6" source-attribute="right"
strength="required"/>
<constraint target="guide5" target-attribute="width"
relation="eq"
source="guide6" source-attribute="width"
strength="required"/>
<constraint target="button4" target-attribute="width"
relation="eq"
source="button5" source-attribute="width"
strength="required"/>
<constraint target="button5" target-attribute="width"
relation="eq"
source="button6" source-attribute="width"
strength="required"/>
<constraint target="button4" target-attribute="top"
relation="eq"
source="barrier1" source-attribute="bottom"
strength="required"/>
<constraint target="button5" target-attribute="top"
relation="eq"
source="barrier1" source-attribute="bottom"
strength="required"/>
<constraint target="button6" target-attribute="top"
relation="eq"
source="barrier1" source-attribute="bottom"
strength="required"/>
<constraint target="button4" target-attribute="bottom"
relation="eq"
source="barrier2" source-attribute="top"
strength="required"/>
<constraint target="button5" target-attribute="bottom"
relation="eq"
source="barrier2" source-attribute="top"
strength="required"/>
<constraint target="button6" target-attribute="bottom"
relation="eq"
source="barrier2" source-attribute="top"
strength="required"/>
<!-- Weighted Chain -->
<constraint target="super" target-attribute="left"
relation="eq"
source="button7" source-attribute="left"
strength="required"/>
<constraint target="button8" target-attribute="left"
relation="eq"
source="button7" source-attribute="right"
constant="10"
strength="required"/>
<constraint target="button9" target-attribute="left"
relation="eq"
source="button8" source-attribute="right"
constant="10"
strength="required"/>
<constraint target="super" target-attribute="right"
relation="eq"
source="button9" source-attribute="right"
strength="required"/>
<constraint target="button8" target-attribute="width"
relation="eq"
source="button7" source-attribute="width"
multiplier="2"
strength="required"/>
<constraint target="button9" target-attribute="width"
relation="eq"
source="button7" source-attribute="width"
multiplier="3"
strength="required"/>
<constraint target="button7" target-attribute="top"
relation="eq"
source="barrier2" source-attribute="bottom"
strength="required"/>
<constraint target="button8" target-attribute="top"
relation="eq"
source="barrier2" source-attribute="bottom"
strength="required"/>
<constraint target="button9" target-attribute="top"
relation="eq"
source="barrier2" source-attribute="bottom"
strength="required"/>
<constraint target="button7" target-attribute="bottom"
relation="eq"
source="barrier3" source-attribute="top"
strength="required"/>
<constraint target="button8" target-attribute="bottom"
relation="eq"
source="barrier3" source-attribute="top"
strength="required"/>
<constraint target="button9" target-attribute="bottom"
relation="eq"
source="barrier3" source-attribute="top"
strength="required"/>
<!-- Packed Chain -->
<constraint target="super" target-attribute="left"
relation="eq"
source="guide7" source-attribute="left"
strength="required"/>
<constraint target="button10" target-attribute="left"
relation="eq"
source="guide7" source-attribute="right"
strength="required"/>
<constraint target="button11" target-attribute="left"
relation="eq"
source="button10" source-attribute="right"
constant="10"
strength="required"/>
<constraint target="button12" target-attribute="left"
relation="eq"
source="button11" source-attribute="right"
constant="10"
strength="required"/>
<constraint target="guide8" target-attribute="left"
relation="eq"
source="button12" source-attribute="right"
strength="required"/>
<constraint target="super" target-attribute="right"
relation="eq"
source="guide8" source-attribute="right"
strength="required"/>
<constraint target="guide7" target-attribute="width"
relation="eq"
source="guide8" source-attribute="width"
strength="required"/>
<constraint target="button10" target-attribute="width"
relation="eq"
source="button11" source-attribute="width"
strength="required"/>
<constraint target="button11" target-attribute="width"
relation="eq"
source="button12" source-attribute="width"
strength="required"/>
<constraint target="button10" target-attribute="top"
relation="eq"
source="barrier3" source-attribute="bottom"
strength="required"/>
<constraint target="button11" target-attribute="top"
relation="eq"
source="barrier3" source-attribute="bottom"
strength="required"/>
<constraint target="button12" target-attribute="top"
relation="eq"
source="barrier3" source-attribute="bottom"
strength="required"/>
<constraint target="button10" target-attribute="bottom"
relation="eq"
source="barrier4" source-attribute="top"
strength="required"/>
<constraint target="button11" target-attribute="bottom"
relation="eq"
source="barrier4" source-attribute="top"
strength="required"/>
<constraint target="button12" target-attribute="bottom"
relation="eq"
source="barrier4" source-attribute="top"
strength="required"/>
<!-- Packed Chain with Bias -->
<constraint target="super" target-attribute="left"
relation="eq"
source="guide9" source-attribute="left"
strength="required"/>
<constraint target="button13" target-attribute="left"
relation="eq"
source="guide9" source-attribute="right"
constant="10"
strength="required"/>
<constraint target="button14" target-attribute="left"
relation="eq"
source="button13" source-attribute="right"
constant="10"
strength="required"/>
<constraint target="button15" target-attribute="left"
relation="eq"
source="button14" source-attribute="right"
constant="10"
strength="required"/>
<constraint target="guide10" target-attribute="left"
relation="eq"
source="button15" source-attribute="right"
constant="10"
strength="required"/>
<constraint target="super" target-attribute="right"
relation="eq"
source="guide10" source-attribute="right"
strength="required"/>
<constraint target="guide9" target-attribute="width"
relation="eq"
source="guide10" source-attribute="width"
multiplier="4"
strength="required"/>
<constraint target="button13" target-attribute="width"
relation="eq"
source="button14" source-attribute="width"
strength="required"/>
<constraint target="button14" target-attribute="width"
relation="eq"
source="button15" source-attribute="width"
strength="required"/>
<constraint target="button13" target-attribute="top"
relation="eq"
source="barrier4" source-attribute="bottom"
strength="required"/>
<constraint target="button14" target-attribute="top"
relation="eq"
source="barrier4" source-attribute="bottom"
strength="required"/>
<constraint target="button15" target-attribute="top"
relation="eq"
source="barrier4" source-attribute="bottom"
strength="required"/>
<constraint target="super" target-attribute="bottom"
relation="ge"
source="button13" source-attribute="bottom"
strength="required"/>
<constraint target="super" target-attribute="bottom"
relation="ge"
source="button14" source-attribute="bottom"
strength="required"/>
<constraint target="super" target-attribute="bottom"
relation="ge"
source="button15" source-attribute="bottom"
strength="required"/>
</constraints>
</object>
</property>
<child>
<object class="GtkButton" id="button1">
<property name="label">A</property>
</object>
</child>
<child>
<object class="GtkButton" id="button2">
<property name="label">B</property>
</object>
</child>
<child>
<object class="GtkButton" id="button3">
<property name="label">C</property>
</object>
</child>
<child>
<object class="GtkButton" id="button4">
<property name="label">A</property>
</object>
</child>
<child>
<object class="GtkButton" id="button5">
<property name="label">B</property>
</object>
</child>
<child>
<object class="GtkButton" id="button6">
<property name="label">C</property>
</object>
</child>
<child>
<object class="GtkButton" id="button7">
<property name="label">A</property>
</object>
</child>
<child>
<object class="GtkButton" id="button8">
<property name="label">B</property>
</object>
</child>
<child>
<object class="GtkButton" id="button9">
<property name="label">C</property>
</object>
</child>
<child>
<object class="GtkButton" id="button10">
<property name="label">A</property>
</object>
</child>
<child>
<object class="GtkButton" id="button11">
<property name="label">B</property>
</object>
</child>
<child>
<object class="GtkButton" id="button12">
<property name="label">C</property>
</object>
</child>
<child>
<object class="GtkButton" id="button13">
<property name="label">A</property>
</object>
</child>
<child>
<object class="GtkButton" id="button14">
<property name="label">B</property>
</object>
</child>
<child>
<object class="GtkButton" id="button15">
<property name="label">C</property>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -1,27 +0,0 @@
uniform float progress;
uniform sampler2D u_texture1;
uniform sampler2D u_texture2;
vec4 getFromColor (vec2 uv) {
return GskTexture(u_texture1, uv);
}
vec4 getToColor (vec2 uv) {
return GskTexture(u_texture2, uv);
}
// Source: https://gl-transitions.com/editor/crosswarp
// Author: Eke Péter <peterekepeter@gmail.com>
// License: MIT
vec4 transition(vec2 p) {
float x = progress;
x=smoothstep(.0,1.0,(x*2.0+p.x-1.0));
return mix(getFromColor((p-.5)*(1.-x)+.5), getToColor((p-.5)*x+.5), x);
}
void mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec2 uv)
{
fragColor = transition(uv);
}

View File

@@ -1,6 +1,7 @@
/* Theming/CSS Accordion /* Theming/CSS Accordion
* *
* A simple accordion demo written using CSS transitions and multiple backgrounds * A simple accordion demo written using CSS transitions and multiple backgrounds
*
*/ */
#include <gtk/gtk.h> #include <gtk/gtk.h>

View File

@@ -1,7 +1,8 @@
/* Theming/CSS Basics /* Theming/CSS Basics
* *
* GTK themes are written using CSS. Every widget is build of multiple items * Gtk themes are written using CSS. Every widget is build of multiple items
* that you can style very similarly to a regular website. * that you can style very similarly to a regular website.
*
*/ */
#include <gtk/gtk.h> #include <gtk/gtk.h>

View File

@@ -15,10 +15,6 @@
border: 1px solid; border: 1px solid;
} }
window {
background-color: white;
}
/* Make sure selections are visible */ /* Make sure selections are visible */
selection { selection {
background-color: darkGreen; background-color: darkGreen;

View File

@@ -38,14 +38,14 @@ struct {
#pragma GCC diagnostic ignored "-Wformat-nonliteral" #pragma GCC diagnostic ignored "-Wformat-nonliteral"
static void static void
update_css_for_blend_mode (GtkCssProvider *provider, update_css_for_blend_mode (GtkCssProvider *provider,
const char *blend_mode) const gchar *blend_mode)
{ {
GBytes *bytes; GBytes *bytes;
char *css; gchar *css;
bytes = g_resources_lookup_data ("/css_blendmodes/css_blendmodes.css", 0, NULL); bytes = g_resources_lookup_data ("/css_blendmodes/css_blendmodes.css", 0, NULL);
css = g_strdup_printf ((char *) g_bytes_get_data (bytes, NULL), css = g_strdup_printf ((gchar*) g_bytes_get_data (bytes, NULL),
blend_mode, blend_mode,
blend_mode, blend_mode,
blend_mode); blend_mode);
@@ -62,7 +62,7 @@ row_activated (GtkListBox *listbox,
GtkListBoxRow *row, GtkListBoxRow *row,
GtkCssProvider *provider) GtkCssProvider *provider)
{ {
const char *blend_mode; const gchar *blend_mode;
blend_mode = blend_modes[gtk_list_box_row_get_index (row)].id; blend_mode = blend_modes[gtk_list_box_row_get_index (row)].id;
@@ -75,7 +75,7 @@ setup_listbox (GtkBuilder *builder,
{ {
GtkWidget *normal_row; GtkWidget *normal_row;
GtkWidget *listbox; GtkWidget *listbox;
int i; gint i;
normal_row = NULL; normal_row = NULL;
listbox = gtk_list_box_new (); listbox = gtk_list_box_new ();

View File

@@ -1,7 +1,8 @@
/* Theming/Multiple Backgrounds /* Theming/Multiple Backgrounds
* *
* GTK themes are written using CSS. Every widget is build of multiple items * Gtk themes are written using CSS. Every widget is build of multiple items
* that you can style very similarly to a regular website. * that you can style very similarly to a regular website.
*
*/ */
#include <gtk/gtk.h> #include <gtk/gtk.h>

View File

@@ -1,7 +1,6 @@
/* Theming/Animated Backgrounds /* Theming/Animated Backgrounds
* *
* This demo is in honour of a classic Pixbufs demo. * This demo is done in honour of the Pixbufs demo further down.
*
* It is done exclusively with CSS as the background of the window. * It is done exclusively with CSS as the background of the window.
*/ */

View File

@@ -46,19 +46,19 @@
} }
@keyframes size-the-image { @keyframes size-the-image {
0% { background-size: 96px, 12px, 96px, 12px, 96px, 12px, 96px, 12px, auto; } 0% { background-size: 96px, 12px, 96px, 12px, 96px, 12px, 96px, 12px, auto }
100% { background-size: 12px, 96px, 12px, 96px, 12px, 96px, 12px, 96px, auto; } 100% { background-size: 12px, 96px, 12px, 96px, 12px, 96px, 12px, 96px, auto }
} }
window { window {
background-image: url("resource://css_pixbufs/images/apple-red.png"), background-image: url("resource://css_pixbufs/apple-red.png"),
url("resource://css_pixbufs/images/gnome-applets.png"), url("resource://css_pixbufs/gnome-applets.png"),
url("resource://css_pixbufs/images/gnome-calendar.png"), url("resource://css_pixbufs/gnome-calendar.png"),
url("resource://css_pixbufs/images/gnome-foot.png"), url("resource://css_pixbufs/gnome-foot.png"),
url("resource://css_pixbufs/images/gnome-gmush.png"), url("resource://css_pixbufs/gnome-gmush.png"),
url("resource://css_pixbufs/images/gnome-gimp.png"), url("resource://css_pixbufs/gnome-gimp.png"),
url("resource://css_pixbufs/images/gnome-gsame.png"), url("resource://css_pixbufs/gnome-gsame.png"),
url("resource://css_pixbufs/images/gnu-keys.png"), url("resource://css_pixbufs/gnu-keys.png"),
url("resource://css_pixbufs/background.jpg"); url("resource://css_pixbufs/background.jpg");
background-position: 50.00% 75.00%, 67.68% 67.68%, 75.00% 50.00%, 67.68% 32.32%, 50.00% 25.00%, 32.32% 32.32%, 25.00% 50.00%, 32.32% 67.68%, 0% 0%; background-position: 50.00% 75.00%, 67.68% 67.68%, 75.00% 50.00%, 67.68% 32.32%, 50.00% 25.00%, 32.32% 32.32%, 25.00% 50.00%, 32.32% 67.68%, 0% 0%;
background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, repeat; background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, repeat;

View File

@@ -106,7 +106,6 @@ do_css_shadows (GtkWidget *do_widget)
child = create_toolbar (); child = create_toolbar ();
gtk_paned_set_start_child (GTK_PANED (paned), child); gtk_paned_set_start_child (GTK_PANED (paned), child);
gtk_paned_set_resize_start_child (GTK_PANED (paned), FALSE);
text = gtk_text_buffer_new (NULL); text = gtk_text_buffer_new (NULL);
gtk_text_buffer_create_tag (text, gtk_text_buffer_create_tag (text,

View File

@@ -4,7 +4,7 @@
<property name="name">default</property> <property name="name">default</property>
</object> </object>
<object class="GdkCursor" id="default_cursor_image"> <object class="GdkCursor" id="default_cursor_image">
<property name="texture">resource:///cursors/images/default_cursor.png</property> <property name="texture">resource:///cursors/default_cursor.png</property>
<property name="hotspot-x">5</property> <property name="hotspot-x">5</property>
<property name="hotspot-y">5</property> <property name="hotspot-y">5</property>
</object> </object>
@@ -13,7 +13,7 @@
<property name="fallback">default_cursor_image</property> <property name="fallback">default_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="default_cursor_image_fallback"> <object class="GdkCursor" id="default_cursor_image_fallback">
<property name="texture">resource:///cursors/images/default_cursor.png</property> <property name="texture">resource:///cursors/default_cursor.png</property>
<property name="hotspot-x">5</property> <property name="hotspot-x">5</property>
<property name="hotspot-y">5</property> <property name="hotspot-y">5</property>
<property name="fallback">default_cursor</property> <property name="fallback">default_cursor</property>
@@ -22,21 +22,21 @@
<property name="name">none</property> <property name="name">none</property>
</object> </object>
<object class="GdkCursor" id="none_cursor_image"> <object class="GdkCursor" id="none_cursor_image">
<property name="texture">resource:///cursors/images/none_cursor.png</property> <property name="texture">resource:///cursors/none_cursor.png</property>
</object> </object>
<object class="GdkCursor" id="none_cursor_fallback"> <object class="GdkCursor" id="none_cursor_fallback">
<property name="name">none</property> <property name="name">none</property>
<property name="fallback">none_cursor_image</property> <property name="fallback">none_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="none_cursor_image_fallback"> <object class="GdkCursor" id="none_cursor_image_fallback">
<property name="texture">resource:///cursors/images/none_cursor.png</property> <property name="texture">resource:///cursors/none_cursor.png</property>
<property name="fallback">none_cursor</property> <property name="fallback">none_cursor</property>
</object> </object>
<object class="GdkCursor" id="gtk-logo_cursor"> <object class="GdkCursor" id="gtk-logo_cursor">
<property name="name">gtk-logo</property> <property name="name">gtk-logo</property>
</object> </object>
<object class="GdkCursor" id="gtk-logo_cursor_image"> <object class="GdkCursor" id="gtk-logo_cursor_image">
<property name="texture">resource:///cursors/images/gtk_logo_cursor.png</property> <property name="texture">resource:///cursors/gtk_logo_cursor.png</property>
<property name="hotspot-x">18</property> <property name="hotspot-x">18</property>
<property name="hotspot-y">2</property> <property name="hotspot-y">2</property>
</object> </object>
@@ -45,7 +45,7 @@
<property name="fallback">gtk-logo_cursor_image</property> <property name="fallback">gtk-logo_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="gtk-logo_cursor_image_fallback"> <object class="GdkCursor" id="gtk-logo_cursor_image_fallback">
<property name="texture">resource:///cursors/images/gtk_logo_cursor.png</property> <property name="texture">resource:///cursors/gtk_logo_cursor.png</property>
<property name="hotspot-x">18</property> <property name="hotspot-x">18</property>
<property name="hotspot-y">2</property> <property name="hotspot-y">2</property>
<property name="fallback">gtk-logo_cursor</property> <property name="fallback">gtk-logo_cursor</property>
@@ -54,7 +54,7 @@
<property name="name">context-menu</property> <property name="name">context-menu</property>
</object> </object>
<object class="GdkCursor" id="context-menu_cursor_image"> <object class="GdkCursor" id="context-menu_cursor_image">
<property name="texture">resource:///cursors/images/context_menu_cursor.png</property> <property name="texture">resource:///cursors/context_menu_cursor.png</property>
<property name="hotspot-x">5</property> <property name="hotspot-x">5</property>
<property name="hotspot-y">5</property> <property name="hotspot-y">5</property>
</object> </object>
@@ -63,7 +63,7 @@
<property name="fallback">context-menu_cursor_image</property> <property name="fallback">context-menu_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="context-menu_cursor_image_fallback"> <object class="GdkCursor" id="context-menu_cursor_image_fallback">
<property name="texture">resource:///cursors/images/context_menu_cursor.png</property> <property name="texture">resource:///cursors/context_menu_cursor.png</property>
<property name="hotspot-x">5</property> <property name="hotspot-x">5</property>
<property name="hotspot-y">5</property> <property name="hotspot-y">5</property>
<property name="fallback">context-menu_cursor</property> <property name="fallback">context-menu_cursor</property>
@@ -72,7 +72,7 @@
<property name="name">help</property> <property name="name">help</property>
</object> </object>
<object class="GdkCursor" id="help_cursor_image"> <object class="GdkCursor" id="help_cursor_image">
<property name="texture">resource:///cursors/images/help_cursor.png</property> <property name="texture">resource:///cursors/help_cursor.png</property>
<property name="hotspot-x">16</property> <property name="hotspot-x">16</property>
<property name="hotspot-y">27</property> <property name="hotspot-y">27</property>
</object> </object>
@@ -81,7 +81,7 @@
<property name="fallback">help_cursor_image</property> <property name="fallback">help_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="help_cursor_image_fallback"> <object class="GdkCursor" id="help_cursor_image_fallback">
<property name="texture">resource:///cursors/images/help_cursor.png</property> <property name="texture">resource:///cursors/help_cursor.png</property>
<property name="hotspot-x">16</property> <property name="hotspot-x">16</property>
<property name="hotspot-y">27</property> <property name="hotspot-y">27</property>
<property name="fallback">help_cursor</property> <property name="fallback">help_cursor</property>
@@ -90,7 +90,7 @@
<property name="name">pointer</property> <property name="name">pointer</property>
</object> </object>
<object class="GdkCursor" id="pointer_cursor_image"> <object class="GdkCursor" id="pointer_cursor_image">
<property name="texture">resource:///cursors/images/pointer_cursor.png</property> <property name="texture">resource:///cursors/pointer_cursor.png</property>
<property name="hotspot-x">14</property> <property name="hotspot-x">14</property>
<property name="hotspot-y">9</property> <property name="hotspot-y">9</property>
</object> </object>
@@ -99,7 +99,7 @@
<property name="fallback">pointer_cursor_image</property> <property name="fallback">pointer_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="pointer_cursor_image_fallback"> <object class="GdkCursor" id="pointer_cursor_image_fallback">
<property name="texture">resource:///cursors/images/pointer_cursor.png</property> <property name="texture">resource:///cursors/pointer_cursor.png</property>
<property name="hotspot-x">14</property> <property name="hotspot-x">14</property>
<property name="hotspot-y">9</property> <property name="hotspot-y">9</property>
<property name="fallback">pointer_cursor</property> <property name="fallback">pointer_cursor</property>
@@ -108,7 +108,7 @@
<property name="name">progress</property> <property name="name">progress</property>
</object> </object>
<object class="GdkCursor" id="progress_cursor_image"> <object class="GdkCursor" id="progress_cursor_image">
<property name="texture">resource:///cursors/images/progress_cursor.png</property> <property name="texture">resource:///cursors/progress_cursor.png</property>
<property name="hotspot-x">5</property> <property name="hotspot-x">5</property>
<property name="hotspot-y">4</property> <property name="hotspot-y">4</property>
</object> </object>
@@ -117,7 +117,7 @@
<property name="fallback">progress_cursor_image</property> <property name="fallback">progress_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="progress_cursor_image_fallback"> <object class="GdkCursor" id="progress_cursor_image_fallback">
<property name="texture">resource:///cursors/images/progress_cursor.png</property> <property name="texture">resource:///cursors/progress_cursor.png</property>
<property name="hotspot-x">5</property> <property name="hotspot-x">5</property>
<property name="hotspot-y">4</property> <property name="hotspot-y">4</property>
<property name="fallback">progress_cursor</property> <property name="fallback">progress_cursor</property>
@@ -126,7 +126,7 @@
<property name="name">wait</property> <property name="name">wait</property>
</object> </object>
<object class="GdkCursor" id="wait_cursor_image"> <object class="GdkCursor" id="wait_cursor_image">
<property name="texture">resource:///cursors/images/wait_cursor.png</property> <property name="texture">resource:///cursors/wait_cursor.png</property>
<property name="hotspot-x">11</property> <property name="hotspot-x">11</property>
<property name="hotspot-y">11</property> <property name="hotspot-y">11</property>
</object> </object>
@@ -135,7 +135,7 @@
<property name="fallback">wait_cursor_image</property> <property name="fallback">wait_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="wait_cursor_image_fallback"> <object class="GdkCursor" id="wait_cursor_image_fallback">
<property name="texture">resource:///cursors/images/wait_cursor.png</property> <property name="texture">resource:///cursors/wait_cursor.png</property>
<property name="hotspot-x">11</property> <property name="hotspot-x">11</property>
<property name="hotspot-y">11</property> <property name="hotspot-y">11</property>
<property name="fallback">wait_cursor</property> <property name="fallback">wait_cursor</property>
@@ -144,7 +144,7 @@
<property name="name">cell</property> <property name="name">cell</property>
</object> </object>
<object class="GdkCursor" id="cell_cursor_image"> <object class="GdkCursor" id="cell_cursor_image">
<property name="texture">resource:///cursors/images/cell_cursor.png</property> <property name="texture">resource:///cursors/cell_cursor.png</property>
<property name="hotspot-x">15</property> <property name="hotspot-x">15</property>
<property name="hotspot-y">15</property> <property name="hotspot-y">15</property>
</object> </object>
@@ -153,7 +153,7 @@
<property name="fallback">cell_cursor_image</property> <property name="fallback">cell_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="cell_cursor_image_fallback"> <object class="GdkCursor" id="cell_cursor_image_fallback">
<property name="texture">resource:///cursors/images/cell_cursor.png</property> <property name="texture">resource:///cursors/cell_cursor.png</property>
<property name="hotspot-x">15</property> <property name="hotspot-x">15</property>
<property name="hotspot-y">15</property> <property name="hotspot-y">15</property>
<property name="fallback">cell_cursor</property> <property name="fallback">cell_cursor</property>
@@ -162,7 +162,7 @@
<property name="name">crosshair</property> <property name="name">crosshair</property>
</object> </object>
<object class="GdkCursor" id="crosshair_cursor_image"> <object class="GdkCursor" id="crosshair_cursor_image">
<property name="texture">resource:///cursors/images/crosshair_cursor.png</property> <property name="texture">resource:///cursors/crosshair_cursor.png</property>
<property name="hotspot-x">15</property> <property name="hotspot-x">15</property>
<property name="hotspot-y">15</property> <property name="hotspot-y">15</property>
</object> </object>
@@ -171,7 +171,7 @@
<property name="fallback">crosshair_cursor_image</property> <property name="fallback">crosshair_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="crosshair_cursor_image_fallback"> <object class="GdkCursor" id="crosshair_cursor_image_fallback">
<property name="texture">resource:///cursors/images/crosshair_cursor.png</property> <property name="texture">resource:///cursors/crosshair_cursor.png</property>
<property name="hotspot-x">15</property> <property name="hotspot-x">15</property>
<property name="hotspot-y">15</property> <property name="hotspot-y">15</property>
<property name="fallback">crosshair_cursor</property> <property name="fallback">crosshair_cursor</property>
@@ -180,7 +180,7 @@
<property name="name">text</property> <property name="name">text</property>
</object> </object>
<object class="GdkCursor" id="text_cursor_image"> <object class="GdkCursor" id="text_cursor_image">
<property name="texture">resource:///cursors/images/text_cursor.png</property> <property name="texture">resource:///cursors/text_cursor.png</property>
<property name="hotspot-x">14</property> <property name="hotspot-x">14</property>
<property name="hotspot-y">15</property> <property name="hotspot-y">15</property>
</object> </object>
@@ -189,7 +189,7 @@
<property name="fallback">text_cursor_image</property> <property name="fallback">text_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="text_cursor_image_fallback"> <object class="GdkCursor" id="text_cursor_image_fallback">
<property name="texture">resource:///cursors/images/text_cursor.png</property> <property name="texture">resource:///cursors/text_cursor.png</property>
<property name="hotspot-x">14</property> <property name="hotspot-x">14</property>
<property name="hotspot-y">15</property> <property name="hotspot-y">15</property>
<property name="fallback">text_cursor</property> <property name="fallback">text_cursor</property>
@@ -198,7 +198,7 @@
<property name="name">vertical-text</property> <property name="name">vertical-text</property>
</object> </object>
<object class="GdkCursor" id="vertical-text_cursor_image"> <object class="GdkCursor" id="vertical-text_cursor_image">
<property name="texture">resource:///cursors/images/vertical_text_cursor.png</property> <property name="texture">resource:///cursors/vertical_text_cursor.png</property>
<property name="hotspot-x">16</property> <property name="hotspot-x">16</property>
<property name="hotspot-y">15</property> <property name="hotspot-y">15</property>
</object> </object>
@@ -207,7 +207,7 @@
<property name="fallback">vertical-text_cursor_image</property> <property name="fallback">vertical-text_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="vertical-text_cursor_image_fallback"> <object class="GdkCursor" id="vertical-text_cursor_image_fallback">
<property name="texture">resource:///cursors/images/vertical_text_cursor.png</property> <property name="texture">resource:///cursors/vertical_text_cursor.png</property>
<property name="hotspot-x">16</property> <property name="hotspot-x">16</property>
<property name="hotspot-y">15</property> <property name="hotspot-y">15</property>
<property name="fallback">vertical-text_cursor</property> <property name="fallback">vertical-text_cursor</property>
@@ -216,7 +216,7 @@
<property name="name">alias</property> <property name="name">alias</property>
</object> </object>
<object class="GdkCursor" id="alias_cursor_image"> <object class="GdkCursor" id="alias_cursor_image">
<property name="texture">resource:///cursors/images/alias_cursor.png</property> <property name="texture">resource:///cursors/alias_cursor.png</property>
<property name="hotspot-x">12</property> <property name="hotspot-x">12</property>
<property name="hotspot-y">11</property> <property name="hotspot-y">11</property>
</object> </object>
@@ -225,7 +225,7 @@
<property name="fallback">alias_cursor_image</property> <property name="fallback">alias_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="alias_cursor_image_fallback"> <object class="GdkCursor" id="alias_cursor_image_fallback">
<property name="texture">resource:///cursors/images/alias_cursor.png</property> <property name="texture">resource:///cursors/alias_cursor.png</property>
<property name="hotspot-x">12</property> <property name="hotspot-x">12</property>
<property name="hotspot-y">11</property> <property name="hotspot-y">11</property>
<property name="fallback">alias_cursor</property> <property name="fallback">alias_cursor</property>
@@ -234,7 +234,7 @@
<property name="name">copy</property> <property name="name">copy</property>
</object> </object>
<object class="GdkCursor" id="copy_cursor_image"> <object class="GdkCursor" id="copy_cursor_image">
<property name="texture">resource:///cursors/images/copy_cursor.png</property> <property name="texture">resource:///cursors/copy_cursor.png</property>
<property name="hotspot-x">12</property> <property name="hotspot-x">12</property>
<property name="hotspot-y">11</property> <property name="hotspot-y">11</property>
</object> </object>
@@ -243,7 +243,7 @@
<property name="fallback">copy_cursor_image</property> <property name="fallback">copy_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="copy_cursor_image_fallback"> <object class="GdkCursor" id="copy_cursor_image_fallback">
<property name="texture">resource:///cursors/images/copy_cursor.png</property> <property name="texture">resource:///cursors/copy_cursor.png</property>
<property name="hotspot-x">12</property> <property name="hotspot-x">12</property>
<property name="hotspot-y">11</property> <property name="hotspot-y">11</property>
<property name="fallback">copy_cursor</property> <property name="fallback">copy_cursor</property>
@@ -252,7 +252,7 @@
<property name="name">move</property> <property name="name">move</property>
</object> </object>
<object class="GdkCursor" id="move_cursor_image"> <object class="GdkCursor" id="move_cursor_image">
<property name="texture">resource:///cursors/images/move_cursor.png</property> <property name="texture">resource:///cursors/move_cursor.png</property>
<property name="hotspot-x">12</property> <property name="hotspot-x">12</property>
<property name="hotspot-y">11</property> <property name="hotspot-y">11</property>
</object> </object>
@@ -261,7 +261,7 @@
<property name="fallback">move_cursor_image</property> <property name="fallback">move_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="move_cursor_image_fallback"> <object class="GdkCursor" id="move_cursor_image_fallback">
<property name="texture">resource:///cursors/images/move_cursor.png</property> <property name="texture">resource:///cursors/move_cursor.png</property>
<property name="hotspot-x">12</property> <property name="hotspot-x">12</property>
<property name="hotspot-y">11</property> <property name="hotspot-y">11</property>
<property name="fallback">move_cursor</property> <property name="fallback">move_cursor</property>
@@ -270,7 +270,7 @@
<property name="name">no-drop</property> <property name="name">no-drop</property>
</object> </object>
<object class="GdkCursor" id="no-drop_cursor_image"> <object class="GdkCursor" id="no-drop_cursor_image">
<property name="texture">resource:///cursors/images/no_drop_cursor.png</property> <property name="texture">resource:///cursors/no_drop_cursor.png</property>
<property name="hotspot-x">12</property> <property name="hotspot-x">12</property>
<property name="hotspot-y">11</property> <property name="hotspot-y">11</property>
</object> </object>
@@ -279,7 +279,7 @@
<property name="fallback">no-drop_cursor_image</property> <property name="fallback">no-drop_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="no-drop_cursor_image_fallback"> <object class="GdkCursor" id="no-drop_cursor_image_fallback">
<property name="texture">resource:///cursors/images/no_drop_cursor.png</property> <property name="texture">resource:///cursors/no_drop_cursor.png</property>
<property name="hotspot-x">12</property> <property name="hotspot-x">12</property>
<property name="hotspot-y">11</property> <property name="hotspot-y">11</property>
<property name="fallback">no-drop_cursor</property> <property name="fallback">no-drop_cursor</property>
@@ -288,7 +288,7 @@
<property name="name">not-allowed</property> <property name="name">not-allowed</property>
</object> </object>
<object class="GdkCursor" id="not-allowed_cursor_image"> <object class="GdkCursor" id="not-allowed_cursor_image">
<property name="texture">resource:///cursors/images/not_allowed_cursor.png</property> <property name="texture">resource:///cursors/not_allowed_cursor.png</property>
<property name="hotspot-x">12</property> <property name="hotspot-x">12</property>
<property name="hotspot-y">11</property> <property name="hotspot-y">11</property>
</object> </object>
@@ -297,7 +297,7 @@
<property name="fallback">not-allowed_cursor_image</property> <property name="fallback">not-allowed_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="not-allowed_cursor_image_fallback"> <object class="GdkCursor" id="not-allowed_cursor_image_fallback">
<property name="texture">resource:///cursors/images/not_allowed_cursor.png</property> <property name="texture">resource:///cursors/not_allowed_cursor.png</property>
<property name="hotspot-x">12</property> <property name="hotspot-x">12</property>
<property name="hotspot-y">11</property> <property name="hotspot-y">11</property>
<property name="fallback">not-allowed_cursor</property> <property name="fallback">not-allowed_cursor</property>
@@ -306,7 +306,7 @@
<property name="name">grab</property> <property name="name">grab</property>
</object> </object>
<object class="GdkCursor" id="grab_cursor_image"> <object class="GdkCursor" id="grab_cursor_image">
<property name="texture">resource:///cursors/images/grab_cursor.png</property> <property name="texture">resource:///cursors/grab_cursor.png</property>
<property name="hotspot-x">10</property> <property name="hotspot-x">10</property>
<property name="hotspot-y">6</property> <property name="hotspot-y">6</property>
</object> </object>
@@ -315,7 +315,7 @@
<property name="fallback">grab_cursor_image</property> <property name="fallback">grab_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="grab_cursor_image_fallback"> <object class="GdkCursor" id="grab_cursor_image_fallback">
<property name="texture">resource:///cursors/images/grab_cursor.png</property> <property name="texture">resource:///cursors/grab_cursor.png</property>
<property name="hotspot-x">10</property> <property name="hotspot-x">10</property>
<property name="hotspot-y">6</property> <property name="hotspot-y">6</property>
<property name="fallback">grab_cursor</property> <property name="fallback">grab_cursor</property>
@@ -324,7 +324,7 @@
<property name="name">grabbing</property> <property name="name">grabbing</property>
</object> </object>
<object class="GdkCursor" id="grabbing_cursor_image"> <object class="GdkCursor" id="grabbing_cursor_image">
<property name="texture">resource:///cursors/images/grabbing_cursor.png</property> <property name="texture">resource:///cursors/grabbing_cursor.png</property>
<property name="hotspot-x">15</property> <property name="hotspot-x">15</property>
<property name="hotspot-y">14</property> <property name="hotspot-y">14</property>
</object> </object>
@@ -333,7 +333,7 @@
<property name="fallback">grabbing_cursor_image</property> <property name="fallback">grabbing_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="grabbing_cursor_image_fallback"> <object class="GdkCursor" id="grabbing_cursor_image_fallback">
<property name="texture">resource:///cursors/images/grabbing_cursor.png</property> <property name="texture">resource:///cursors/grabbing_cursor.png</property>
<property name="hotspot-x">15</property> <property name="hotspot-x">15</property>
<property name="hotspot-y">14</property> <property name="hotspot-y">14</property>
<property name="fallback">grabbing_cursor</property> <property name="fallback">grabbing_cursor</property>
@@ -342,7 +342,7 @@
<property name="name">all-scroll</property> <property name="name">all-scroll</property>
</object> </object>
<object class="GdkCursor" id="all-scroll_cursor_image"> <object class="GdkCursor" id="all-scroll_cursor_image">
<property name="texture">resource:///cursors/images/all_scroll_cursor.png</property> <property name="texture">resource:///cursors/all_scroll_cursor.png</property>
<property name="hotspot-x">15</property> <property name="hotspot-x">15</property>
<property name="hotspot-y">15</property> <property name="hotspot-y">15</property>
</object> </object>
@@ -351,7 +351,7 @@
<property name="fallback">all-scroll_cursor_image</property> <property name="fallback">all-scroll_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="all-scroll_cursor_image_fallback"> <object class="GdkCursor" id="all-scroll_cursor_image_fallback">
<property name="texture">resource:///cursors/images/all_scroll_cursor.png</property> <property name="texture">resource:///cursors/all_scroll_cursor.png</property>
<property name="hotspot-x">15</property> <property name="hotspot-x">15</property>
<property name="hotspot-y">15</property> <property name="hotspot-y">15</property>
<property name="fallback">all-scroll_cursor</property> <property name="fallback">all-scroll_cursor</property>
@@ -360,7 +360,7 @@
<property name="name">col-resize</property> <property name="name">col-resize</property>
</object> </object>
<object class="GdkCursor" id="col-resize_cursor_image"> <object class="GdkCursor" id="col-resize_cursor_image">
<property name="texture">resource:///cursors/images/col_resize_cursor.png</property> <property name="texture">resource:///cursors/col_resize_cursor.png</property>
<property name="hotspot-x">16</property> <property name="hotspot-x">16</property>
<property name="hotspot-y">15</property> <property name="hotspot-y">15</property>
</object> </object>
@@ -369,7 +369,7 @@
<property name="fallback">col-resize_cursor_image</property> <property name="fallback">col-resize_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="col-resize_cursor_image_fallback"> <object class="GdkCursor" id="col-resize_cursor_image_fallback">
<property name="texture">resource:///cursors/images/col_resize_cursor.png</property> <property name="texture">resource:///cursors/col_resize_cursor.png</property>
<property name="hotspot-x">16</property> <property name="hotspot-x">16</property>
<property name="hotspot-y">15</property> <property name="hotspot-y">15</property>
<property name="fallback">col-resize_cursor</property> <property name="fallback">col-resize_cursor</property>
@@ -378,7 +378,7 @@
<property name="name">row-resize</property> <property name="name">row-resize</property>
</object> </object>
<object class="GdkCursor" id="row-resize_cursor_image"> <object class="GdkCursor" id="row-resize_cursor_image">
<property name="texture">resource:///cursors/images/row_resize_cursor.png</property> <property name="texture">resource:///cursors/row_resize_cursor.png</property>
<property name="hotspot-x">15</property> <property name="hotspot-x">15</property>
<property name="hotspot-y">17</property> <property name="hotspot-y">17</property>
</object> </object>
@@ -387,7 +387,7 @@
<property name="fallback">row-resize_cursor_image</property> <property name="fallback">row-resize_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="row-resize_cursor_image_fallback"> <object class="GdkCursor" id="row-resize_cursor_image_fallback">
<property name="texture">resource:///cursors/images/row_resize_cursor.png</property> <property name="texture">resource:///cursors/row_resize_cursor.png</property>
<property name="hotspot-x">15</property> <property name="hotspot-x">15</property>
<property name="hotspot-y">17</property> <property name="hotspot-y">17</property>
<property name="fallback">row-resize_cursor</property> <property name="fallback">row-resize_cursor</property>
@@ -396,7 +396,7 @@
<property name="name">n-resize</property> <property name="name">n-resize</property>
</object> </object>
<object class="GdkCursor" id="n-resize_cursor_image"> <object class="GdkCursor" id="n-resize_cursor_image">
<property name="texture">resource:///cursors/images/n_resize_cursor.png</property> <property name="texture">resource:///cursors/n_resize_cursor.png</property>
<property name="hotspot-x">17</property> <property name="hotspot-x">17</property>
<property name="hotspot-y">7</property> <property name="hotspot-y">7</property>
</object> </object>
@@ -405,7 +405,7 @@
<property name="fallback">n-resize_cursor_image</property> <property name="fallback">n-resize_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="n-resize_cursor_image_fallback"> <object class="GdkCursor" id="n-resize_cursor_image_fallback">
<property name="texture">resource:///cursors/images/n_resize_cursor.png</property> <property name="texture">resource:///cursors/n_resize_cursor.png</property>
<property name="hotspot-x">17</property> <property name="hotspot-x">17</property>
<property name="hotspot-y">7</property> <property name="hotspot-y">7</property>
<property name="fallback">n-resize_cursor</property> <property name="fallback">n-resize_cursor</property>
@@ -414,7 +414,7 @@
<property name="name">e-resize</property> <property name="name">e-resize</property>
</object> </object>
<object class="GdkCursor" id="e-resize_cursor_image"> <object class="GdkCursor" id="e-resize_cursor_image">
<property name="texture">resource:///cursors/images/e_resize_cursor.png</property> <property name="texture">resource:///cursors/e_resize_cursor.png</property>
<property name="hotspot-x">25</property> <property name="hotspot-x">25</property>
<property name="hotspot-y">17</property> <property name="hotspot-y">17</property>
</object> </object>
@@ -423,7 +423,7 @@
<property name="fallback">e-resize_cursor_image</property> <property name="fallback">e-resize_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="e-resize_cursor_image_fallback"> <object class="GdkCursor" id="e-resize_cursor_image_fallback">
<property name="texture">resource:///cursors/images/e_resize_cursor.png</property> <property name="texture">resource:///cursors/e_resize_cursor.png</property>
<property name="hotspot-x">25</property> <property name="hotspot-x">25</property>
<property name="hotspot-y">17</property> <property name="hotspot-y">17</property>
<property name="fallback">e-resize_cursor</property> <property name="fallback">e-resize_cursor</property>
@@ -432,7 +432,7 @@
<property name="name">s-resize</property> <property name="name">s-resize</property>
</object> </object>
<object class="GdkCursor" id="s-resize_cursor_image"> <object class="GdkCursor" id="s-resize_cursor_image">
<property name="texture">resource:///cursors/images/s_resize_cursor.png</property> <property name="texture">resource:///cursors/s_resize_cursor.png</property>
<property name="hotspot-x">17</property> <property name="hotspot-x">17</property>
<property name="hotspot-y">23</property> <property name="hotspot-y">23</property>
</object> </object>
@@ -441,7 +441,7 @@
<property name="fallback">s-resize_cursor_image</property> <property name="fallback">s-resize_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="s-resize_cursor_image_fallback"> <object class="GdkCursor" id="s-resize_cursor_image_fallback">
<property name="texture">resource:///cursors/images/s_resize_cursor.png</property> <property name="texture">resource:///cursors/s_resize_cursor.png</property>
<property name="hotspot-x">17</property> <property name="hotspot-x">17</property>
<property name="hotspot-y">23</property> <property name="hotspot-y">23</property>
<property name="fallback">s-resize_cursor</property> <property name="fallback">s-resize_cursor</property>
@@ -450,7 +450,7 @@
<property name="name">w-resize</property> <property name="name">w-resize</property>
</object> </object>
<object class="GdkCursor" id="w-resize_cursor_image"> <object class="GdkCursor" id="w-resize_cursor_image">
<property name="texture">resource:///cursors/images/w_resize_cursor.png</property> <property name="texture">resource:///cursors/w_resize_cursor.png</property>
<property name="hotspot-x">8</property> <property name="hotspot-x">8</property>
<property name="hotspot-y">17</property> <property name="hotspot-y">17</property>
</object> </object>
@@ -459,7 +459,7 @@
<property name="fallback">w-resize_cursor_image</property> <property name="fallback">w-resize_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="w-resize_cursor_image_fallback"> <object class="GdkCursor" id="w-resize_cursor_image_fallback">
<property name="texture">resource:///cursors/images/w_resize_cursor.png</property> <property name="texture">resource:///cursors/w_resize_cursor.png</property>
<property name="hotspot-x">8</property> <property name="hotspot-x">8</property>
<property name="hotspot-y">17</property> <property name="hotspot-y">17</property>
<property name="fallback">w-resize_cursor</property> <property name="fallback">w-resize_cursor</property>
@@ -468,7 +468,7 @@
<property name="name">ne-resize</property> <property name="name">ne-resize</property>
</object> </object>
<object class="GdkCursor" id="ne-resize_cursor_image"> <object class="GdkCursor" id="ne-resize_cursor_image">
<property name="texture">resource:///cursors/images/ne_resize_cursor.png</property> <property name="texture">resource:///cursors/ne_resize_cursor.png</property>
<property name="hotspot-x">20</property> <property name="hotspot-x">20</property>
<property name="hotspot-y">13</property> <property name="hotspot-y">13</property>
</object> </object>
@@ -477,7 +477,7 @@
<property name="fallback">ne-resize_cursor_image</property> <property name="fallback">ne-resize_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="ne-resize_cursor_image_fallback"> <object class="GdkCursor" id="ne-resize_cursor_image_fallback">
<property name="texture">resource:///cursors/images/ne_resize_cursor.png</property> <property name="texture">resource:///cursors/ne_resize_cursor.png</property>
<property name="hotspot-x">20</property> <property name="hotspot-x">20</property>
<property name="hotspot-y">13</property> <property name="hotspot-y">13</property>
<property name="fallback">ne-resize_cursor</property> <property name="fallback">ne-resize_cursor</property>
@@ -486,7 +486,7 @@
<property name="name">nw-resize</property> <property name="name">nw-resize</property>
</object> </object>
<object class="GdkCursor" id="nw-resize_cursor_image"> <object class="GdkCursor" id="nw-resize_cursor_image">
<property name="texture">resource:///cursors/images/nw_resize_cursor.png</property> <property name="texture">resource:///cursors/nw_resize_cursor.png</property>
<property name="hotspot-x">13</property> <property name="hotspot-x">13</property>
<property name="hotspot-y">13</property> <property name="hotspot-y">13</property>
</object> </object>
@@ -495,7 +495,7 @@
<property name="fallback">nw-resize_cursor_image</property> <property name="fallback">nw-resize_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="nw-resize_cursor_image_fallback"> <object class="GdkCursor" id="nw-resize_cursor_image_fallback">
<property name="texture">resource:///cursors/images/nw_resize_cursor.png</property> <property name="texture">resource:///cursors/nw_resize_cursor.png</property>
<property name="hotspot-x">13</property> <property name="hotspot-x">13</property>
<property name="hotspot-y">13</property> <property name="hotspot-y">13</property>
<property name="fallback">nw-resize_cursor</property> <property name="fallback">nw-resize_cursor</property>
@@ -504,7 +504,7 @@
<property name="name">se-resize</property> <property name="name">se-resize</property>
</object> </object>
<object class="GdkCursor" id="se-resize_cursor_image"> <object class="GdkCursor" id="se-resize_cursor_image">
<property name="texture">resource:///cursors/images/se_resize_cursor.png</property> <property name="texture">resource:///cursors/se_resize_cursor.png</property>
<property name="hotspot-x">19</property> <property name="hotspot-x">19</property>
<property name="hotspot-y">19</property> <property name="hotspot-y">19</property>
</object> </object>
@@ -513,7 +513,7 @@
<property name="fallback">se-resize_cursor_image</property> <property name="fallback">se-resize_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="se-resize_cursor_image_fallback"> <object class="GdkCursor" id="se-resize_cursor_image_fallback">
<property name="texture">resource:///cursors/images/se_resize_cursor.png</property> <property name="texture">resource:///cursors/se_resize_cursor.png</property>
<property name="hotspot-x">19</property> <property name="hotspot-x">19</property>
<property name="hotspot-y">19</property> <property name="hotspot-y">19</property>
<property name="fallback">se-resize_cursor</property> <property name="fallback">se-resize_cursor</property>
@@ -522,7 +522,7 @@
<property name="name">sw-resize</property> <property name="name">sw-resize</property>
</object> </object>
<object class="GdkCursor" id="sw-resize_cursor_image"> <object class="GdkCursor" id="sw-resize_cursor_image">
<property name="texture">resource:///cursors/images/sw_resize_cursor.png</property> <property name="texture">resource:///cursors/sw_resize_cursor.png</property>
<property name="hotspot-x">13</property> <property name="hotspot-x">13</property>
<property name="hotspot-y">19</property> <property name="hotspot-y">19</property>
</object> </object>
@@ -531,7 +531,7 @@
<property name="fallback">sw-resize_cursor_image</property> <property name="fallback">sw-resize_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="sw-resize_cursor_image_fallback"> <object class="GdkCursor" id="sw-resize_cursor_image_fallback">
<property name="texture">resource:///cursors/images/sw_resize_cursor.png</property> <property name="texture">resource:///cursors/sw_resize_cursor.png</property>
<property name="hotspot-x">13</property> <property name="hotspot-x">13</property>
<property name="hotspot-y">19</property> <property name="hotspot-y">19</property>
<property name="fallback">sw-resize_cursor</property> <property name="fallback">sw-resize_cursor</property>
@@ -540,7 +540,7 @@
<property name="name">ew-resize</property> <property name="name">ew-resize</property>
</object> </object>
<object class="GdkCursor" id="ew-resize_cursor_image"> <object class="GdkCursor" id="ew-resize_cursor_image">
<property name="texture">resource:///cursors/images/ew_resize_cursor.png</property> <property name="texture">resource:///cursors/ew_resize_cursor.png</property>
<property name="hotspot-x">16</property> <property name="hotspot-x">16</property>
<property name="hotspot-y">15</property> <property name="hotspot-y">15</property>
</object> </object>
@@ -549,7 +549,7 @@
<property name="fallback">ew-resize_cursor_image</property> <property name="fallback">ew-resize_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="ew-resize_cursor_image_fallback"> <object class="GdkCursor" id="ew-resize_cursor_image_fallback">
<property name="texture">resource:///cursors/images/ew_resize_cursor.png</property> <property name="texture">resource:///cursors/ew_resize_cursor.png</property>
<property name="hotspot-x">16</property> <property name="hotspot-x">16</property>
<property name="hotspot-y">15</property> <property name="hotspot-y">15</property>
<property name="fallback">ew-resize_cursor</property> <property name="fallback">ew-resize_cursor</property>
@@ -558,7 +558,7 @@
<property name="name">ns-resize</property> <property name="name">ns-resize</property>
</object> </object>
<object class="GdkCursor" id="ns-resize_cursor_image"> <object class="GdkCursor" id="ns-resize_cursor_image">
<property name="texture">resource:///cursors/images/ns_resize_cursor.png</property> <property name="texture">resource:///cursors/ns_resize_cursor.png</property>
<property name="hotspot-x">15</property> <property name="hotspot-x">15</property>
<property name="hotspot-y">17</property> <property name="hotspot-y">17</property>
</object> </object>
@@ -567,7 +567,7 @@
<property name="fallback">ns-resize_cursor_image</property> <property name="fallback">ns-resize_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="ns-resize_cursor_image_fallback"> <object class="GdkCursor" id="ns-resize_cursor_image_fallback">
<property name="texture">resource:///cursors/images/ns_resize_cursor.png</property> <property name="texture">resource:///cursors/ns_resize_cursor.png</property>
<property name="hotspot-x">15</property> <property name="hotspot-x">15</property>
<property name="hotspot-y">17</property> <property name="hotspot-y">17</property>
<property name="fallback">ns-resize_cursor</property> <property name="fallback">ns-resize_cursor</property>
@@ -576,7 +576,7 @@
<property name="name">nesw-resize</property> <property name="name">nesw-resize</property>
</object> </object>
<object class="GdkCursor" id="nesw-resize_cursor_image"> <object class="GdkCursor" id="nesw-resize_cursor_image">
<property name="texture">resource:///cursors/images/nesw_resize_cursor.png</property> <property name="texture">resource:///cursors/nesw_resize_cursor.png</property>
<property name="hotspot-x">14</property> <property name="hotspot-x">14</property>
<property name="hotspot-y">14</property> <property name="hotspot-y">14</property>
</object> </object>
@@ -585,7 +585,7 @@
<property name="fallback">nesw-resize_cursor_image</property> <property name="fallback">nesw-resize_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="nesw-resize_cursor_image_fallback"> <object class="GdkCursor" id="nesw-resize_cursor_image_fallback">
<property name="texture">resource:///cursors/images/nesw_resize_cursor.png</property> <property name="texture">resource:///cursors/nesw_resize_cursor.png</property>
<property name="hotspot-x">14</property> <property name="hotspot-x">14</property>
<property name="hotspot-y">14</property> <property name="hotspot-y">14</property>
<property name="fallback">nesw-resize_cursor</property> <property name="fallback">nesw-resize_cursor</property>
@@ -594,7 +594,7 @@
<property name="name">nwse-resize</property> <property name="name">nwse-resize</property>
</object> </object>
<object class="GdkCursor" id="nwse-resize_cursor_image"> <object class="GdkCursor" id="nwse-resize_cursor_image">
<property name="texture">resource:///cursors/images/nwse_resize_cursor.png</property> <property name="texture">resource:///cursors/nwse_resize_cursor.png</property>
<property name="hotspot-x">14</property> <property name="hotspot-x">14</property>
<property name="hotspot-y">14</property> <property name="hotspot-y">14</property>
</object> </object>
@@ -603,7 +603,7 @@
<property name="fallback">nwse-resize_cursor_image</property> <property name="fallback">nwse-resize_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="nwse-resize_cursor_image_fallback"> <object class="GdkCursor" id="nwse-resize_cursor_image_fallback">
<property name="texture">resource:///cursors/images/nwse_resize_cursor.png</property> <property name="texture">resource:///cursors/nwse_resize_cursor.png</property>
<property name="hotspot-x">14</property> <property name="hotspot-x">14</property>
<property name="hotspot-y">14</property> <property name="hotspot-y">14</property>
<property name="fallback">nwse-resize_cursor</property> <property name="fallback">nwse-resize_cursor</property>
@@ -612,7 +612,7 @@
<property name="name">zoom-in</property> <property name="name">zoom-in</property>
</object> </object>
<object class="GdkCursor" id="zoom-in_cursor_image"> <object class="GdkCursor" id="zoom-in_cursor_image">
<property name="texture">resource:///cursors/images/zoom_in_cursor.png</property> <property name="texture">resource:///cursors/zoom_in_cursor.png</property>
<property name="hotspot-x">14</property> <property name="hotspot-x">14</property>
<property name="hotspot-y">13</property> <property name="hotspot-y">13</property>
</object> </object>
@@ -621,7 +621,7 @@
<property name="fallback">zoom-in_cursor_image</property> <property name="fallback">zoom-in_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="zoom-in_cursor_image_fallback"> <object class="GdkCursor" id="zoom-in_cursor_image_fallback">
<property name="texture">resource:///cursors/images/zoom_in_cursor.png</property> <property name="texture">resource:///cursors/zoom_in_cursor.png</property>
<property name="hotspot-x">14</property> <property name="hotspot-x">14</property>
<property name="hotspot-y">13</property> <property name="hotspot-y">13</property>
<property name="fallback">zoom-in_cursor</property> <property name="fallback">zoom-in_cursor</property>
@@ -630,7 +630,7 @@
<property name="name">zoom-out</property> <property name="name">zoom-out</property>
</object> </object>
<object class="GdkCursor" id="zoom-out_cursor_image"> <object class="GdkCursor" id="zoom-out_cursor_image">
<property name="texture">resource:///cursors/images/zoom_out_cursor.png</property> <property name="texture">resource:///cursors/zoom_out_cursor.png</property>
<property name="hotspot-x">14</property> <property name="hotspot-x">14</property>
<property name="hotspot-y">13</property> <property name="hotspot-y">13</property>
</object> </object>
@@ -639,7 +639,7 @@
<property name="fallback">zoom-out_cursor_image</property> <property name="fallback">zoom-out_cursor_image</property>
</object> </object>
<object class="GdkCursor" id="zoom-out_cursor_image_fallback"> <object class="GdkCursor" id="zoom-out_cursor_image_fallback">
<property name="texture">resource:///cursors/images/zoom_out_cursor.png</property> <property name="texture">resource:///cursors/zoom_out_cursor.png</property>
<property name="hotspot-x">14</property> <property name="hotspot-x">14</property>
<property name="hotspot-y">13</property> <property name="hotspot-y">13</property>
<property name="fallback">zoom-out_cursor</property> <property name="fallback">zoom-out_cursor</property>
@@ -682,7 +682,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/default_cursor.png</property> <property name="paintable">resource:///cursors/default_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -742,7 +742,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/none_cursor.png</property> <property name="paintable">resource:///cursors/none_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -802,7 +802,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/gtk_logo_cursor.png</property> <property name="paintable">resource:///cursors/gtk_logo_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -875,7 +875,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/context_menu_cursor.png</property> <property name="paintable">resource:///cursors/context_menu_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -935,7 +935,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/help_cursor.png</property> <property name="paintable">resource:///cursors/help_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -995,7 +995,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/pointer_cursor.png</property> <property name="paintable">resource:///cursors/pointer_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -1055,7 +1055,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/progress_cursor.png</property> <property name="paintable">resource:///cursors/progress_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -1115,7 +1115,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/wait_cursor.png</property> <property name="paintable">resource:///cursors/wait_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -1188,7 +1188,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/cell_cursor.png</property> <property name="paintable">resource:///cursors/cell_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -1248,7 +1248,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/crosshair_cursor.png</property> <property name="paintable">resource:///cursors/crosshair_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -1308,7 +1308,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/text_cursor.png</property> <property name="paintable">resource:///cursors/text_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -1368,7 +1368,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/vertical_text_cursor.png</property> <property name="paintable">resource:///cursors/vertical_text_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -1441,7 +1441,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/alias_cursor.png</property> <property name="paintable">resource:///cursors/alias_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -1501,7 +1501,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/copy_cursor.png</property> <property name="paintable">resource:///cursors/copy_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -1561,7 +1561,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/move_cursor.png</property> <property name="paintable">resource:///cursors/move_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -1621,7 +1621,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/no_drop_cursor.png</property> <property name="paintable">resource:///cursors/no_drop_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -1681,7 +1681,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/not_allowed_cursor.png</property> <property name="paintable">resource:///cursors/not_allowed_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -1741,7 +1741,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/grab_cursor.png</property> <property name="paintable">resource:///cursors/grab_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -1801,7 +1801,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/grabbing_cursor.png</property> <property name="paintable">resource:///cursors/grabbing_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -1874,7 +1874,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/all_scroll_cursor.png</property> <property name="paintable">resource:///cursors/all_scroll_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -1934,7 +1934,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/col_resize_cursor.png</property> <property name="paintable">resource:///cursors/col_resize_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -1994,7 +1994,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/row_resize_cursor.png</property> <property name="paintable">resource:///cursors/row_resize_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -2054,7 +2054,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/n_resize_cursor.png</property> <property name="paintable">resource:///cursors/n_resize_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -2114,7 +2114,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/e_resize_cursor.png</property> <property name="paintable">resource:///cursors/e_resize_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -2174,7 +2174,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/s_resize_cursor.png</property> <property name="paintable">resource:///cursors/s_resize_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -2234,7 +2234,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/w_resize_cursor.png</property> <property name="paintable">resource:///cursors/w_resize_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -2294,7 +2294,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/ne_resize_cursor.png</property> <property name="paintable">resource:///cursors/ne_resize_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -2354,7 +2354,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/nw_resize_cursor.png</property> <property name="paintable">resource:///cursors/nw_resize_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -2414,7 +2414,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/sw_resize_cursor.png</property> <property name="paintable">resource:///cursors/sw_resize_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -2474,7 +2474,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/se_resize_cursor.png</property> <property name="paintable">resource:///cursors/se_resize_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -2534,7 +2534,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/ew_resize_cursor.png</property> <property name="paintable">resource:///cursors/ew_resize_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -2594,7 +2594,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/ns_resize_cursor.png</property> <property name="paintable">resource:///cursors/ns_resize_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -2654,7 +2654,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/nesw_resize_cursor.png</property> <property name="paintable">resource:///cursors/nesw_resize_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -2714,7 +2714,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/nwse_resize_cursor.png</property> <property name="paintable">resource:///cursors/nwse_resize_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -2787,7 +2787,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/zoom_in_cursor.png</property> <property name="paintable">resource:///cursors/zoom_in_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>
@@ -2847,7 +2847,7 @@
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="paintable">resource:///cursors/images/zoom_out_cursor.png</property> <property name="paintable">resource:///cursors/zoom_out_cursor.png</property>
</object> </object>
</child> </child>
<child> <child>

View File

@@ -18,9 +18,6 @@
<file>demoimage.c</file> <file>demoimage.c</file>
<file>demoimage.h</file> <file>demoimage.h</file>
</gresource> </gresource>
<gresource prefix="/constraints_builder">
<file>constraints_builder.ui</file>
</gresource>
<gresource prefix="/css_accordion"> <gresource prefix="/css_accordion">
<file>css_accordion.css</file> <file>css_accordion.css</file>
<file>reset.css</file> <file>reset.css</file>
@@ -43,11 +40,6 @@
<file>cssview.css</file> <file>cssview.css</file>
<file>reset.css</file> <file>reset.css</file>
</gresource> </gresource>
<gresource prefix="/dropdown">
<file>suggestionentry.h</file>
<file>suggestionentry.c</file>
<file>suggestionentry.css</file>
</gresource>
<gresource prefix="/theming_style_classes"> <gresource prefix="/theming_style_classes">
<file>theming.ui</file> <file>theming.ui</file>
</gresource> </gresource>
@@ -59,8 +51,6 @@
<file>cssview.css</file> <file>cssview.css</file>
<file>reset.css</file> <file>reset.css</file>
<file>background.jpg</file> <file>background.jpg</file>
</gresource>
<gresource prefix="/css_pixbufs/images">
<file>apple-red.png</file> <file>apple-red.png</file>
<file>gnome-applets.png</file> <file>gnome-applets.png</file>
<file>gnome-calendar.png</file> <file>gnome-calendar.png</file>
@@ -77,8 +67,6 @@
</gresource> </gresource>
<gresource prefix="/cursors"> <gresource prefix="/cursors">
<file>cursors.ui</file> <file>cursors.ui</file>
</gresource>
<gresource prefix="/cursors/images">
<file>alias_cursor.png</file> <file>alias_cursor.png</file>
<file>all_scroll_cursor.png</file> <file>all_scroll_cursor.png</file>
<file>cell_cursor.png</file> <file>cell_cursor.png</file>
@@ -120,9 +108,6 @@
<gresource prefix="/dnd"> <gresource prefix="/dnd">
<file>dnd.css</file> <file>dnd.css</file>
</gresource> </gresource>
<gresource prefix="/errorstates">
<file>errorstates.ui</file>
</gresource>
<gresource prefix="/fishbowl"> <gresource prefix="/fishbowl">
<file>fishbowl.ui</file> <file>fishbowl.ui</file>
<file>gtkfishbowl.c</file> <file>gtkfishbowl.c</file>
@@ -132,30 +117,6 @@
<file>gtkgears.c</file> <file>gtkgears.c</file>
<file>gtkgears.h</file> <file>gtkgears.h</file>
</gresource> </gresource>
<gresource prefix="/shadertoy">
<file>gtkshadertoy.c</file>
<file>gtkshadertoy.h</file>
<file>alienplanet.glsl</file>
<file>mandelbrot.glsl</file>
<file>neon.glsl</file>
<file>cogs.glsl</file>
<file>glowingstars.glsl</file>
</gresource>
<gresource prefix="/gltransition">
<file>gtkshaderstack.c</file>
<file>gtkshaderstack.h</file>
<file>gtkshaderbin.h</file>
<file>gtkshaderbin.c</file>
<file>gskshaderpaintable.h</file>
<file>gskshaderpaintable.c</file>
<file>wind.glsl</file>
<file>radial.glsl</file>
<file>crosswarp.glsl</file>
<file>kaleidoscope.glsl</file>
<file>cogs2.glsl</file>
<file>ripple.glsl</file>
<file>background.glsl</file>
</gresource>
<gresource prefix="/iconscroll"> <gresource prefix="/iconscroll">
<file>iconscroll.ui</file> <file>iconscroll.ui</file>
</gresource> </gresource>
@@ -163,24 +124,6 @@
<file>gnome-fs-directory.png</file> <file>gnome-fs-directory.png</file>
<file>gnome-fs-regular.png</file> <file>gnome-fs-regular.png</file>
</gresource> </gresource>
<gresource prefix="/layoutmanager">
<file>demolayout.h</file>
<file>demolayout.c</file>
<file>demowidget.h</file>
<file>demowidget.c</file>
<file>demochild.h</file>
<file>demochild.c</file>
</gresource>
<gresource prefix="/layoutmanager2">
<file>demo2layout.h</file>
<file>demo2layout.c</file>
<file>demo2widget.h</file>
<file>demo2widget.c</file>
<file>four_point_transform.h</file>
<file>four_point_transform.c</file>
<file>singular_value_decomposition.h</file>
<file>singular_value_decomposition.c</file>
</gresource>
<gresource prefix="/listview_filebrowser"> <gresource prefix="/listview_filebrowser">
<file>listview_filebrowser.ui</file> <file>listview_filebrowser.ui</file>
<file>listview_filebrowser.css</file> <file>listview_filebrowser.css</file>
@@ -192,30 +135,11 @@
<gresource prefix="/listview_settings"> <gresource prefix="/listview_settings">
<file>listview_settings.ui</file> <file>listview_settings.ui</file>
</gresource> </gresource>
<gresource prefix="/listview_ucd_data/">
<file>ucdnames.data</file>
</gresource>
<gresource prefix="/listview_weather"> <gresource prefix="/listview_weather">
<file compressed="true">listview_weather.txt</file> <file compressed="true">listview_weather.txt</file>
</gresource> </gresource>
<gresource prefix="/listview_colors"> <gresource prefix="/listview_colors">
<file compressed="true">color.names.txt</file> <file compressed="true">color.names.txt</file>
<file>listview_colors.css</file>
</gresource>
<gresource prefix="/main">
<file>fontify.c</file>
<file>fontify.h</file>
<file>main.ui</file>
</gresource>
<gresource prefix="/menu">
<file>demo3widget.c</file>
<file>demo3widget.h</file>
<file>demo3widget.ui</file>
</gresource>
<gresource prefix="/paintable_svg">
<file>svgpaintable.h</file>
<file>svgpaintable.c</file>
<file>org.gtk.gtk4.NodeEditor.Devel.svg</file>
</gresource> </gresource>
<gresource prefix="/shortcuts"> <gresource prefix="/shortcuts">
<file>shortcuts.ui</file> <file>shortcuts.ui</file>
@@ -236,15 +160,20 @@
<file>revealer.ui</file> <file>revealer.ui</file>
</gresource> </gresource>
<gresource prefix="/images"> <gresource prefix="/images">
<file>pixbufpaintable.h</file>
<file>pixbufpaintable.c</file>
<file>alphatest.png</file> <file>alphatest.png</file>
<file>floppybuddy.gif</file> <file>floppybuddy.gif</file>
<file>gtk-logo.webm</file> <file>gtk-logo.webm</file>
<file alias="org.gtk.Demo4.svg">data/scalable/apps/org.gtk.Demo4.svg</file>
</gresource> </gresource>
<gresource prefix="/video-player"> <gresource prefix="/pixbufs">
<file>bbb.png</file> <file>apple-red.png</file>
<file>background.jpg</file>
<file>gnome-applets.png</file>
<file>gnome-calendar.png</file>
<file>gnome-foot.png</file>
<file>gnome-gmush.png</file>
<file>gnome-gimp.png</file>
<file>gnome-gsame.png</file>
<file>gnu-keys.png</file>
</gresource> </gresource>
<gresource prefix="/sources"> <gresource prefix="/sources">
<file>application_demo.c</file> <file>application_demo.c</file>
@@ -253,9 +182,8 @@
<file>clipboard.c</file> <file>clipboard.c</file>
<file>combobox.c</file> <file>combobox.c</file>
<file>constraints.c</file> <file>constraints.c</file>
<file>constraints_interactive.c</file> <file>constraints2.c</file>
<file>constraints_vfl.c</file> <file>constraints3.c</file>
<file>constraints_builder.c</file>
<file>css_accordion.c</file> <file>css_accordion.c</file>
<file>css_basics.c</file> <file>css_basics.c</file>
<file>css_blendmodes.c</file> <file>css_blendmodes.c</file>
@@ -270,7 +198,6 @@
<file>editable_cells.c</file> <file>editable_cells.c</file>
<file>entry_completion.c</file> <file>entry_completion.c</file>
<file>entry_undo.c</file> <file>entry_undo.c</file>
<file>errorstates.c</file>
<file>expander.c</file> <file>expander.c</file>
<file>filtermodel.c</file> <file>filtermodel.c</file>
<file>fishbowl.c</file> <file>fishbowl.c</file>
@@ -282,7 +209,6 @@
<file>gears.c</file> <file>gears.c</file>
<file>gestures.c</file> <file>gestures.c</file>
<file>glarea.c</file> <file>glarea.c</file>
<file>gltransition.c</file>
<file>headerbar.c</file> <file>headerbar.c</file>
<file>hypertext.c</file> <file>hypertext.c</file>
<file>iconscroll.c</file> <file>iconscroll.c</file>
@@ -290,44 +216,37 @@
<file>iconview_edit.c</file> <file>iconview_edit.c</file>
<file>images.c</file> <file>images.c</file>
<file>infobar.c</file> <file>infobar.c</file>
<file>layoutmanager.c</file>
<file>layoutmanager2.c</file>
<file>links.c</file> <file>links.c</file>
<file>listbox.c</file> <file>listbox.c</file>
<file>listbox_controls.c</file>
<file>listview_applauncher.c</file> <file>listview_applauncher.c</file>
<file>listview_colors.c</file> <file>listview_colors.c</file>
<file>listview_clocks.c</file> <file>listview_clocks.c</file>
<file>listview_filebrowser.c</file> <file>listview_filebrowser.c</file>
<file>listview_minesweeper.c</file> <file>listview_minesweeper.c</file>
<file>listview_settings.c</file> <file>listview_settings.c</file>
<file>listview_ucd.c</file>
<file>listview_weather.c</file> <file>listview_weather.c</file>
<file>listview_words.c</file> <file>listview_words.c</file>
<file>list_store.c</file> <file>list_store.c</file>
<file>main.c</file>
<file>markup.c</file> <file>markup.c</file>
<file>menu.c</file> <file>modelbutton.c</file>
<file>overlay.c</file> <file>overlay.c</file>
<file>overlay_decorative.c</file> <file>overlay2.c</file>
<file>paint.c</file> <file>paint.c</file>
<file>pagesetup.c</file> <file>pagesetup.c</file>
<file>paintable.c</file> <file>paintable.c</file>
<file>paintable_animated.c</file> <file>paintable_animated.c</file>
<file>paintable_emblem.c</file>
<file>paintable_mediastream.c</file> <file>paintable_mediastream.c</file>
<file>paintable_svg.c</file>
<file>panes.c</file> <file>panes.c</file>
<file>password_entry.c</file> <file>password_entry.c</file>
<file>peg_solitaire.c</file> <file>peg_solitaire.c</file>
<file>pickers.c</file> <file>pickers.c</file>
<file>pixbufs.c</file>
<file>printing.c</file> <file>printing.c</file>
<file>revealer.c</file> <file>revealer.c</file>
<file>rotated_text.c</file> <file>rotated_text.c</file>
<file>scale.c</file> <file>scale.c</file>
<file>search_entry.c</file> <file>search_entry.c</file>
<file>search_entry2.c</file> <file>search_entry2.c</file>
<file>shadertoy.c</file>
<file>shortcuts.c</file> <file>shortcuts.c</file>
<file>shortcut_triggers.c</file> <file>shortcut_triggers.c</file>
<file>sizegroup.c</file> <file>sizegroup.c</file>
@@ -359,9 +278,6 @@
<file>messages.txt</file> <file>messages.txt</file>
<file>apple-red.png</file> <file>apple-red.png</file>
</gresource> </gresource>
<gresource prefix="/listbox_controls">
<file>listbox_controls.ui</file>
</gresource>
<gresource prefix="/glarea"> <gresource prefix="/glarea">
<file>glarea-gl.fs.glsl</file> <file>glarea-gl.fs.glsl</file>
<file>glarea-gl.vs.glsl</file> <file>glarea-gl.vs.glsl</file>
@@ -393,6 +309,9 @@
<gresource prefix="/scale"> <gresource prefix="/scale">
<file>scale.ui</file> <file>scale.ui</file>
</gresource> </gresource>
<gresource prefix="/modelbutton">
<file>modelbutton.ui</file>
</gresource>
<gresource prefix="/tagged_entry"> <gresource prefix="/tagged_entry">
<file>demotaggedentry.c</file> <file>demotaggedentry.c</file>
<file>demotaggedentry.h</file> <file>demotaggedentry.h</file>

View File

@@ -29,24 +29,29 @@
<item> <item>
<attribute name="label" translatable="yes">_New</attribute> <attribute name="label" translatable="yes">_New</attribute>
<attribute name="action">win.new</attribute> <attribute name="action">win.new</attribute>
<attribute name="accel">&lt;Control&gt;n</attribute>
</item> </item>
<item> <item>
<attribute name="label" translatable="yes">_Open</attribute> <attribute name="label" translatable="yes">_Open</attribute>
<attribute name="action">win.open</attribute> <attribute name="action">win.open</attribute>
<attribute name="accel">&lt;Control&gt;o</attribute>
</item> </item>
<item> <item>
<attribute name="label" translatable="yes">_Save</attribute> <attribute name="label" translatable="yes">_Save</attribute>
<attribute name="action">win.save</attribute> <attribute name="action">win.save</attribute>
<attribute name="accel">&lt;Control&gt;s</attribute>
</item> </item>
<item> <item>
<attribute name="label" translatable="yes">Save _As</attribute> <attribute name="label" translatable="yes">Save _As</attribute>
<attribute name="action">win.save-as</attribute> <attribute name="action">win.save-as</attribute>
<attribute name="accel">&lt;Control&gt;q</attribute>
</item> </item>
</section> </section>
<section> <section>
<item> <item>
<attribute name="label" translatable="yes">_Quit</attribute> <attribute name="label" translatable="yes">_Quit</attribute>
<attribute name="action">win.quit</attribute> <attribute name="action">win.quit</attribute>
<attribute name="accel">&lt;Control&gt;&lt;Shift&gt;s</attribute>
</item> </item>
</section> </section>
</submenu> </submenu>
@@ -56,14 +61,17 @@
<item> <item>
<attribute name="label" translatable="yes">_Copy</attribute> <attribute name="label" translatable="yes">_Copy</attribute>
<attribute name="action">win.copy</attribute> <attribute name="action">win.copy</attribute>
<attribute name="accel">&lt;Control&gt;c</attribute>
</item> </item>
<item> <item>
<attribute name="label" translatable="yes">_Cut</attribute> <attribute name="label" translatable="yes">_Cut</attribute>
<attribute name="action">win.cut</attribute> <attribute name="action">win.cut</attribute>
<attribute name="accel">&lt;Control&gt;x</attribute>
</item> </item>
<item> <item>
<attribute name="label" translatable="yes">_Paste</attribute> <attribute name="label" translatable="yes">_Paste</attribute>
<attribute name="action">win.paste</attribute> <attribute name="action">win.paste</attribute>
<attribute name="accel">&lt;Control&gt;v</attribute>
</item> </item>
</section> </section>
</submenu> </submenu>
@@ -73,18 +81,23 @@
<item> <item>
<attribute name="label" translatable="yes">_Help</attribute> <attribute name="label" translatable="yes">_Help</attribute>
<attribute name="action">win.help</attribute> <attribute name="action">win.help</attribute>
<attribute name="accel">F1</attribute>
</item> </item>
<item> <item>
<attribute name="label" translatable="yes">_About</attribute> <attribute name="label" translatable="yes">_About</attribute>
<attribute name="action">win.about</attribute> <attribute name="action">win.about</attribute>
<attribute name="accel">F7</attribute>
</item> </item>
</section> </section>
</submenu> </submenu>
</menu> </menu>
<object class="GtkAboutDialog" id="aboutdialog1"> <object class="GtkAboutDialog" id="aboutdialog1">
<property name="program-name" translatable="yes">Builder demo</property> <property name="program-name" translatable="yes">Builder demo</property>
<property name="logo-icon-name" translatable="yes">org.gtk.Demo4</property> <property name="logo-icon-name" translatable="yes">gtk3-demo</property>
<property name="modal">True</property> <property name="modal">True</property>
<accessibility>
<relation target="window1" type="subwindow-of"/>
</accessibility>
</object> </object>
<object class="GtkWindow" id="window1"> <object class="GtkWindow" id="window1">
<property name="default-height">250</property> <property name="default-height">250</property>
@@ -96,24 +109,20 @@
<child> <child>
<object class="GtkPopoverMenuBar" id="menubar1"> <object class="GtkPopoverMenuBar" id="menubar1">
<property name="menu-model">menubar</property> <property name="menu-model">menubar</property>
<accessibility>
<property name="label">Main Menu</property>
</accessibility>
</object> </object>
</child> </child>
<child> <child>
<object class="GtkBox" id="toolbar1"> <object class="GtkBox" id="toolbar1">
<property name="accessible-role">toolbar</property> <child internal-child="accessible">
<property name="css-classes">toolbar</property> <object class="AtkObject" id="a11y-toolbar">
<accessibility> <property name="AtkObject::accessible-name">The toolbar</property>
<property name="label">Toolbar</property> </object>
</accessibility> </child>
<child> <child>
<object class="GtkButton"> <object class="GtkButton">
<property name="label" translatable="yes">New</property> <property name="label" translatable="yes">New</property>
<property name="tooltip-text" translatable="yes">Create a new file</property> <property name="tooltip-text" translatable="yes">Create a new file</property>
<property name="icon-name">document-new</property> <property name="icon-name">document-new</property>
<property name="action-name">win.new</property>
</object> </object>
</child> </child>
<child> <child>
@@ -121,7 +130,6 @@
<property name="label" translatable="yes">Open</property> <property name="label" translatable="yes">Open</property>
<property name="tooltip-text" translatable="yes">Open a file</property> <property name="tooltip-text" translatable="yes">Open a file</property>
<property name="icon-name">document-open</property> <property name="icon-name">document-open</property>
<property name="action-name">win.open</property>
</object> </object>
</child> </child>
<child> <child>
@@ -129,7 +137,6 @@
<property name="label" translatable="yes">Save</property> <property name="label" translatable="yes">Save</property>
<property name="tooltip-text" translatable="yes">Save a file</property> <property name="tooltip-text" translatable="yes">Save a file</property>
<property name="icon-name">document-save</property> <property name="icon-name">document-save</property>
<property name="action-name">win.save</property>
</object> </object>
</child> </child>
<child> <child>
@@ -140,7 +147,6 @@
<property name="label" translatable="yes">Copy</property> <property name="label" translatable="yes">Copy</property>
<property name="tooltip-text" translatable="yes">Copy selected object into the clipboard</property> <property name="tooltip-text" translatable="yes">Copy selected object into the clipboard</property>
<property name="icon-name">edit-copy</property> <property name="icon-name">edit-copy</property>
<property name="action-name">win.copy</property>
</object> </object>
</child> </child>
<child> <child>
@@ -148,7 +154,6 @@
<property name="label" translatable="yes">Cut</property> <property name="label" translatable="yes">Cut</property>
<property name="tooltip-text" translatable="yes">Cut selected object into the clipboard</property> <property name="tooltip-text" translatable="yes">Cut selected object into the clipboard</property>
<property name="icon-name">edit-cut</property> <property name="icon-name">edit-cut</property>
<property name="action-name">win.cut</property>
</object> </object>
</child> </child>
<child> <child>
@@ -156,7 +161,6 @@
<property name="label" translatable="yes">Paste</property> <property name="label" translatable="yes">Paste</property>
<property name="tooltip-text" translatable="yes">Paste object from the clipboard</property> <property name="tooltip-text" translatable="yes">Paste object from the clipboard</property>
<property name="icon-name">edit-paste</property> <property name="icon-name">edit-paste</property>
<property name="action-name">win.paste</property>
</object> </object>
</child> </child>
</object> </object>
@@ -170,6 +174,14 @@
<object class="GtkTreeView" id="treeview1"> <object class="GtkTreeView" id="treeview1">
<property name="model">liststore1</property> <property name="model">liststore1</property>
<property name="tooltip-column">3</property> <property name="tooltip-column">3</property>
<child internal-child="accessible">
<object class="AtkObject" id="a11y-treeview">
<property name="AtkObject::accessible-name">Name list</property>
<property name="AtkObject::accessible-description">
A list of person with name, surname and age columns
</property>
</object>
</child>
<child> <child>
<object class="GtkTreeViewColumn" id="column1"> <object class="GtkTreeViewColumn" id="column1">
<property name="title">Name</property> <property name="title">Name</property>

View File

@@ -1,204 +0,0 @@
#include "demo2layout.h"
#include "four_point_transform.h"
struct _Demo2Layout
{
GtkLayoutManager parent_instance;
float position;
float offset;
};
struct _Demo2LayoutClass
{
GtkLayoutManagerClass parent_class;
};
G_DEFINE_TYPE (Demo2Layout, demo2_layout, GTK_TYPE_LAYOUT_MANAGER)
static void
demo2_layout_measure (GtkLayoutManager *layout_manager,
GtkWidget *widget,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline)
{
GtkWidget *child;
int minimum_size = 0;
int natural_size = 0;
for (child = gtk_widget_get_first_child (widget);
child != NULL;
child = gtk_widget_get_next_sibling (child))
{
int child_min = 0, child_nat = 0;
if (!gtk_widget_should_layout (child))
continue;
gtk_widget_measure (child, orientation, -1,
&child_min, &child_nat,
NULL, NULL);
minimum_size = MAX (minimum_size, child_min);
natural_size = MAX (natural_size, child_nat);
}
*minimum = minimum_size;
*natural = 3 * natural_size;
}
#define RADIANS(angle) ((angle)*M_PI/180.0);
/* Spherical coordinates */
#define SX(r,t,p) ((r) * sin (t) * cos (p))
#define SZ(r,t,p) ((r) * sin (t) * sin (p))
#define SY(r,t,p) ((r) * cos (t))
static double
map_offset (double x)
{
x = fmod (x, 180.0);
if (x < 0.0)
x += 180.0;
return x;
}
static void
demo2_layout_allocate (GtkLayoutManager *layout_manager,
GtkWidget *widget,
int width,
int height,
int baseline)
{
GtkWidget *child;
GtkRequisition child_req;
int i, j, k;
float x0, y0;
float w, h;
graphene_point3d_t p1, p2, p3, p4;
graphene_point3d_t q1, q2, q3, q4;
double t_1, t_2, p_1, p_2;
double r;
graphene_matrix_t m;
GskTransform *transform;
double position = DEMO2_LAYOUT (layout_manager)->position;
double offset = DEMO2_LAYOUT (layout_manager)->offset;
/* for simplicity, assume all children are the same size */
gtk_widget_get_preferred_size (gtk_widget_get_first_child (widget), &child_req, NULL);
w = child_req.width;
h = child_req.height;
r = 300;
x0 = y0 = 300;
for (child = gtk_widget_get_first_child (widget), i = 0;
child != NULL;
child = gtk_widget_get_next_sibling (child), i++)
{
j = i / 36;
k = i % 36;
gtk_widget_set_child_visible (child, FALSE);
graphene_point3d_init (&p1, w, h, 1.);
graphene_point3d_init (&p2, w, 0., 1.);
graphene_point3d_init (&p3, 0., 0., 1.);
graphene_point3d_init (&p4, 0., h, 1.);
t_1 = RADIANS (map_offset (offset + 10 * j));
t_2 = RADIANS (map_offset (offset + 10 * (j + 1)));
p_1 = RADIANS (position + 10 * k);
p_2 = RADIANS (position + 10 * (k + 1));
if (t_2 < t_1)
continue;
if (SZ (r, t_1, p_1) > 0 ||
SZ (r, t_2, p_1) > 0 ||
SZ (r, t_1, p_2) > 0 ||
SZ (r, t_2, p_2) > 0)
continue;
gtk_widget_set_child_visible (child, TRUE);
graphene_point3d_init (&q1, x0 + SX (r, t_1, p_1), y0 + SY (r, t_1, p_1), SZ (r, t_1, p_1));
graphene_point3d_init (&q2, x0 + SX (r, t_2, p_1), y0 + SY (r, t_2, p_1), SZ (r, t_2, p_1));
graphene_point3d_init (&q3, x0 + SX (r, t_2, p_2), y0 + SY (r, t_2, p_2), SZ (r, t_2, p_2));
graphene_point3d_init (&q4, x0 + SX (r, t_1, p_2), y0 + SY (r, t_1, p_2), SZ (r, t_1, p_2));
/* Get a matrix that moves p1 -> q1, p2 -> q2, ... */
perspective_3d (&p1, &p2, &p3, &p4,
&q1, &q2, &q3, &q4,
&m);
transform = gsk_transform_matrix (NULL, &m);
/* Since our matrix was built for transforming points with z = 1,
* prepend a translation to the z = 1 plane.
*/
transform = gsk_transform_translate_3d (transform,
&GRAPHENE_POINT3D_INIT (0, 0, 1));
gtk_widget_allocate (child, w, h, -1, transform);
}
}
static GtkSizeRequestMode
demo2_layout_get_request_mode (GtkLayoutManager *layout_manager,
GtkWidget *widget)
{
return GTK_SIZE_REQUEST_CONSTANT_SIZE;
}
static void
demo2_layout_class_init (Demo2LayoutClass *klass)
{
GtkLayoutManagerClass *layout_class = GTK_LAYOUT_MANAGER_CLASS (klass);
layout_class->get_request_mode = demo2_layout_get_request_mode;
layout_class->measure = demo2_layout_measure;
layout_class->allocate = demo2_layout_allocate;
}
static void
demo2_layout_init (Demo2Layout *self)
{
}
GtkLayoutManager *
demo2_layout_new (void)
{
return g_object_new (DEMO2_TYPE_LAYOUT, NULL);
}
void
demo2_layout_set_position (Demo2Layout *layout,
float position)
{
layout->position = position;
}
float
demo2_layout_get_position (Demo2Layout *layout)
{
return layout->position;
}
void
demo2_layout_set_offset (Demo2Layout *layout,
float offset)
{
layout->offset = offset;
}
float
demo2_layout_get_offset (Demo2Layout *layout)
{
return layout->offset;
}

View File

@@ -1,16 +0,0 @@
#pragma once
#include <gtk/gtk.h>
#define DEMO2_TYPE_LAYOUT (demo2_layout_get_type ())
G_DECLARE_FINAL_TYPE (Demo2Layout, demo2_layout, DEMO2, LAYOUT, GtkLayoutManager)
GtkLayoutManager * demo2_layout_new (void);
void demo2_layout_set_position (Demo2Layout *layout,
float position);
float demo2_layout_get_position (Demo2Layout *layout);
void demo2_layout_set_offset (Demo2Layout *layout,
float offset);
float demo2_layout_get_offset (Demo2Layout *layout);

View File

@@ -1,172 +0,0 @@
#include "demo2widget.h"
#include "demo2layout.h"
struct _Demo2Widget
{
GtkWidget parent_instance;
gint64 start_time;
gint64 end_time;
float start_position;
float end_position;
float start_offset;
float end_offset;
gboolean animating;
};
struct _Demo2WidgetClass
{
GtkWidgetClass parent_class;
};
G_DEFINE_TYPE (Demo2Widget, demo2_widget, GTK_TYPE_WIDGET)
static void
demo2_widget_init (Demo2Widget *self)
{
gtk_widget_set_focusable (GTK_WIDGET (self), TRUE);
}
static void
demo2_widget_dispose (GObject *object)
{
GtkWidget *child;
while ((child = gtk_widget_get_first_child (GTK_WIDGET (object))))
gtk_widget_unparent (child);
G_OBJECT_CLASS (demo2_widget_parent_class)->dispose (object);
}
/* From clutter-easing.c, based on Robert Penner's
* infamous easing equations, MIT license.
*/
static double
ease_out_cubic (double t)
{
double p = t - 1;
return p * p * p + 1;
}
static gboolean
update_position (GtkWidget *widget,
GdkFrameClock *clock,
gpointer data)
{
Demo2Widget *self = DEMO2_WIDGET (widget);
Demo2Layout *layout = DEMO2_LAYOUT (gtk_widget_get_layout_manager (widget));
gint64 now;
double t;
now = gdk_frame_clock_get_frame_time (clock);
if (now >= self->end_time)
{
self->animating = FALSE;
return G_SOURCE_REMOVE;
}
t = (now - self->start_time) / (double) (self->end_time - self->start_time);
t = ease_out_cubic (t);
demo2_layout_set_position (layout, self->start_position + t * (self->end_position - self->start_position));
demo2_layout_set_offset (layout, self->start_offset + t * (self->end_offset - self->start_offset));
gtk_widget_queue_allocate (widget);
return G_SOURCE_CONTINUE;
}
static void
rotate_sphere (GtkWidget *widget,
const char *action,
GVariant *parameters)
{
Demo2Widget *self = DEMO2_WIDGET (widget);
Demo2Layout *layout = DEMO2_LAYOUT (gtk_widget_get_layout_manager (widget));
GtkOrientation orientation;
int direction;
g_variant_get (parameters, "(ii)", &orientation, &direction);
self->end_position = self->start_position = demo2_layout_get_position (layout);
self->end_offset = self->start_offset = demo2_layout_get_offset (layout);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
self->end_position += 10 * direction;
else
self->end_offset += 10 * direction;
self->start_time = g_get_monotonic_time ();
self->end_time = self->start_time + 0.5 * G_TIME_SPAN_SECOND;
if (!self->animating)
{
gtk_widget_add_tick_callback (widget, update_position, NULL, NULL);
self->animating = TRUE;
}
}
static void
demo2_widget_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
GtkWidget *child;
for (child = gtk_widget_get_first_child (widget);
child != NULL;
child = gtk_widget_get_next_sibling (child))
{
/* our layout manager sets this for children that are out of view */
if (!gtk_widget_get_child_visible (child))
continue;
gtk_widget_snapshot_child (widget, child, snapshot);
}
}
static void
demo2_widget_class_init (Demo2WidgetClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
object_class->dispose = demo2_widget_dispose;
widget_class->snapshot = demo2_widget_snapshot;
gtk_widget_class_install_action (widget_class, "rotate", "(ii)", rotate_sphere);
gtk_widget_class_add_binding_action (widget_class,
GDK_KEY_Left, 0,
"rotate",
"(ii)", GTK_ORIENTATION_HORIZONTAL, -1);
gtk_widget_class_add_binding_action (widget_class,
GDK_KEY_Right, 0,
"rotate",
"(ii)", GTK_ORIENTATION_HORIZONTAL, 1);
gtk_widget_class_add_binding_action (widget_class,
GDK_KEY_Up, 0,
"rotate",
"(ii)", GTK_ORIENTATION_VERTICAL, 1);
gtk_widget_class_add_binding_action (widget_class,
GDK_KEY_Down, 0,
"rotate",
"(ii)", GTK_ORIENTATION_VERTICAL, -1);
/* here is where we use our custom layout manager */
gtk_widget_class_set_layout_manager_type (widget_class, DEMO2_TYPE_LAYOUT);
}
GtkWidget *
demo2_widget_new (void)
{
return g_object_new (DEMO2_TYPE_WIDGET, NULL);
}
void
demo2_widget_add_child (Demo2Widget *self,
GtkWidget *child)
{
gtk_widget_set_parent (child, GTK_WIDGET (self));
}

View File

@@ -1,11 +0,0 @@
#pragma once
#include <gtk/gtk.h>
#define DEMO2_TYPE_WIDGET (demo2_widget_get_type ())
G_DECLARE_FINAL_TYPE (Demo2Widget, demo2_widget, DEMO2, WIDGET, GtkWidget)
GtkWidget * demo2_widget_new (void);
void demo2_widget_add_child (Demo2Widget *self,
GtkWidget *child);

View File

@@ -1,243 +0,0 @@
#include <math.h>
#include "demo3widget.h"
enum
{
PROP_PAINTABLE = 1,
PROP_SCALE
};
struct _Demo3Widget
{
GtkWidget parent_instance;
GdkPaintable *paintable;
float scale;
GtkWidget *menu;
};
struct _Demo3WidgetClass
{
GtkWidgetClass parent_class;
};
G_DEFINE_TYPE (Demo3Widget, demo3_widget, GTK_TYPE_WIDGET)
static void
demo3_widget_init (Demo3Widget *self)
{
self->scale = 1.f;
gtk_widget_init_template (GTK_WIDGET (self));
}
static void
demo3_widget_dispose (GObject *object)
{
Demo3Widget *self = DEMO3_WIDGET (object);
g_clear_object (&self->paintable);
g_clear_pointer (&self->menu, gtk_widget_unparent);
G_OBJECT_CLASS (demo3_widget_parent_class)->dispose (object);
}
static void
demo3_widget_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
Demo3Widget *self = DEMO3_WIDGET (widget);
int x, y, width, height;
double w, h;
width = gtk_widget_get_width (widget);
height = gtk_widget_get_height (widget);
w = self->scale * gdk_paintable_get_intrinsic_width (self->paintable);
h = self->scale * gdk_paintable_get_intrinsic_height (self->paintable);
x = MAX (0, (width - ceil (w)) / 2);
y = MAX (0, (height - ceil (h)) / 2);
gtk_snapshot_push_clip (snapshot, &GRAPHENE_RECT_INIT (0, 0, width, height));
gtk_snapshot_save (snapshot);
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x, y));
gdk_paintable_snapshot (self->paintable, snapshot, w, h);
gtk_snapshot_restore (snapshot);
gtk_snapshot_pop (snapshot);
}
static void
demo3_widget_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline)
{
Demo3Widget *self = DEMO3_WIDGET (widget);
int size;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
size = gdk_paintable_get_intrinsic_width (self->paintable);
else
size = gdk_paintable_get_intrinsic_height (self->paintable);
*minimum = *natural = self->scale * size;
}
static void
demo3_widget_size_allocate (GtkWidget *widget,
int width,
int height,
int baseline)
{
Demo3Widget *self = DEMO3_WIDGET (widget);
/* Since we are not using a layout manager (who would do this
* for us), we need to allocate a size for our menu by calling
* gtk_popover_present().
*/
gtk_popover_present (GTK_POPOVER (self->menu));
}
static void
demo3_widget_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
Demo3Widget *self = DEMO3_WIDGET (object);
switch (prop_id)
{
case PROP_PAINTABLE:
g_clear_object (&self->paintable);
self->paintable = g_value_dup_object (value);
gtk_widget_queue_resize (GTK_WIDGET (object));
break;
case PROP_SCALE:
self->scale = g_value_get_float (value);
gtk_widget_queue_resize (GTK_WIDGET (object));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
demo3_widget_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
Demo3Widget *self = DEMO3_WIDGET (object);
switch (prop_id)
{
case PROP_PAINTABLE:
g_value_set_object (value, self->paintable);
break;
case PROP_SCALE:
g_value_set_float (value, self->scale);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
pressed_cb (GtkGestureClick *gesture,
guint n_press,
double x,
double y,
Demo3Widget *self)
{
/* We are placing our menu at the point where
* the click happened, before popping it up.
*/
gtk_popover_set_pointing_to (GTK_POPOVER (self->menu),
&(const GdkRectangle){ x, y, 1, 1 });
gtk_popover_popup (GTK_POPOVER (self->menu));
}
static void
zoom_cb (GtkWidget *widget,
const char *action_name,
GVariant *parameter)
{
Demo3Widget *self = DEMO3_WIDGET (widget);
float scale;
if (g_str_equal (action_name, "zoom.in"))
scale = MIN (10, self->scale * M_SQRT2);
else if (g_str_equal (action_name, "zoom.out"))
scale = MAX (0.01, self->scale / M_SQRT2);
else
scale = 1.0;
gtk_widget_action_set_enabled (widget, "zoom.in", scale < 10);
gtk_widget_action_set_enabled (widget, "zoom.out", scale > 0.01);
gtk_widget_action_set_enabled (widget, "zoom.reset", scale != 1);
g_object_set (widget, "scale", scale, NULL);
}
static void
demo3_widget_class_init (Demo3WidgetClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
object_class->dispose = demo3_widget_dispose;
object_class->set_property = demo3_widget_set_property;
object_class->get_property = demo3_widget_get_property;
widget_class->snapshot = demo3_widget_snapshot;
widget_class->measure = demo3_widget_measure;
widget_class->size_allocate = demo3_widget_size_allocate;
g_object_class_install_property (object_class, PROP_PAINTABLE,
g_param_spec_object ("paintable", "Paintable", "Paintable",
GDK_TYPE_PAINTABLE,
G_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_SCALE,
g_param_spec_float ("scale", "Scale", "Scale",
0.0, 10.0, 1.0,
G_PARAM_READWRITE));
/* These are the actions that we are using in the menu */
gtk_widget_class_install_action (widget_class, "zoom.in", NULL, zoom_cb);
gtk_widget_class_install_action (widget_class, "zoom.out", NULL, zoom_cb);
gtk_widget_class_install_action (widget_class, "zoom.reset", NULL, zoom_cb);
gtk_widget_class_set_template_from_resource (widget_class, "/menu/demo3widget.ui");
gtk_widget_class_bind_template_child (widget_class, Demo3Widget, menu);
gtk_widget_class_bind_template_callback (widget_class, pressed_cb);
}
GtkWidget *
demo3_widget_new (const char *resource)
{
Demo3Widget *self;
GdkPixbuf *pixbuf;
GdkPaintable *paintable;
pixbuf = gdk_pixbuf_new_from_resource (resource, NULL);
paintable = GDK_PAINTABLE (gdk_texture_new_for_pixbuf (pixbuf));
self = g_object_new (DEMO3_TYPE_WIDGET, "paintable", paintable, NULL);
g_object_unref (pixbuf);
g_object_unref (paintable);
return GTK_WIDGET (self);
}

View File

@@ -1,8 +0,0 @@
#pragma once
#include <gtk/gtk.h>
#define DEMO3_TYPE_WIDGET (demo3_widget_get_type ())
G_DECLARE_FINAL_TYPE (Demo3Widget, demo3_widget, DEMO3, WIDGET, GtkWidget)
GtkWidget * demo3_widget_new (const char *resource);

View File

@@ -1,30 +0,0 @@
<interface>
<menu id="model">
<item>
<attribute name="label">Zoom Out</attribute>
<attribute name="action">zoom.out</attribute>
</item>
<item>
<attribute name="label">Zoom In</attribute>
<attribute name="action">zoom.in</attribute>
</item>
<item>
<attribute name="label">11</attribute>
<attribute name="action">zoom.reset</attribute>
</item>
</menu>
<template class="Demo3Widget">
<child>
<object class="GtkPopoverMenu" id="menu">
<property name="has-arrow">0</property>
<property name="menu-model">model</property>
</object>
</child>
<child>
<object class="GtkGestureClick">
<property name="button">3</property>
<signal name="pressed" handler="pressed_cb"/>
</object>
</child>
</template>
</interface>

View File

@@ -1,72 +0,0 @@
#include "demochild.h"
/* This is a trivial child widget just for demo purposes.
* It draws a 32x32 square in fixed color.
*/
struct _DemoChild
{
GtkWidget parent_instance;
GdkRGBA color;
};
struct _DemoChildClass
{
GtkWidgetClass parent_class;
};
G_DEFINE_TYPE (DemoChild, demo_child, GTK_TYPE_WIDGET)
static void
demo_child_init (DemoChild *self)
{
}
static void
demo_child_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
DemoChild *self = DEMO_CHILD (widget);
int width, height;
width = gtk_widget_get_width (widget);
height = gtk_widget_get_height (widget);
gtk_snapshot_append_color (snapshot, &self->color,
&GRAPHENE_RECT_INIT(0, 0, width, height));
}
static void
demo_child_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline)
{
*minimum = *natural = 32;
}
static void
demo_child_class_init (DemoChildClass *class)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
widget_class->snapshot = demo_child_snapshot;
widget_class->measure = demo_child_measure;
}
GtkWidget *
demo_child_new (const char *color)
{
DemoChild *self;
self = g_object_new (DEMO_TYPE_CHILD,
"tooltip-text", color,
NULL);
gdk_rgba_parse (&self->color, color);
return GTK_WIDGET (self);
}

View File

@@ -1,8 +0,0 @@
#pragma once
#include <gtk/gtk.h>
#define DEMO_TYPE_CHILD (demo_child_get_type ())
G_DECLARE_FINAL_TYPE (DemoChild, demo_child, DEMO, CHILD, GtkWidget)
GtkWidget * demo_child_new (const char *color);

View File

@@ -17,7 +17,7 @@ G_DEFINE_TYPE(DemoImage, demo_image, GTK_TYPE_WIDGET)
static GdkPaintable * static GdkPaintable *
get_image_paintable (GtkImage *image) get_image_paintable (GtkImage *image)
{ {
const char *icon_name; const gchar *icon_name;
GtkIconTheme *icon_theme; GtkIconTheme *icon_theme;
GtkIconPaintable *icon; GtkIconPaintable *icon;
@@ -47,38 +47,6 @@ get_image_paintable (GtkImage *image)
} }
} }
static void
update_drag_icon (DemoImage *demo,
GtkDragIcon *icon)
{
const char *icon_name;
GdkPaintable *paintable;
GtkWidget *image;
switch (gtk_image_get_storage_type (GTK_IMAGE (demo->image)))
{
case GTK_IMAGE_PAINTABLE:
paintable = gtk_image_get_paintable (GTK_IMAGE (demo->image));
image = gtk_image_new_from_paintable (paintable);
break;
case GTK_IMAGE_ICON_NAME:
icon_name = gtk_image_get_icon_name (GTK_IMAGE (demo->image));
image = gtk_image_new_from_icon_name (icon_name);
break;
case GTK_IMAGE_EMPTY:
case GTK_IMAGE_GICON:
default:
g_warning ("Image storage type %d not handled",
gtk_image_get_storage_type (GTK_IMAGE (demo->image)));
return;
}
gtk_image_set_pixel_size (GTK_IMAGE (image),
gtk_image_get_pixel_size (GTK_IMAGE (demo->image)));
gtk_drag_icon_set_child (icon, image);
}
static void static void
drag_begin (GtkDragSource *source, drag_begin (GtkDragSource *source,
GdkDrag *drag, GdkDrag *drag,
@@ -86,8 +54,14 @@ drag_begin (GtkDragSource *source,
{ {
GtkWidget *widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (source)); GtkWidget *widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (source));
DemoImage *demo = DEMO_IMAGE (widget); DemoImage *demo = DEMO_IMAGE (widget);
GdkPaintable *paintable;
update_drag_icon (demo, GTK_DRAG_ICON (gtk_drag_icon_get_for_drag (drag))); paintable = get_image_paintable (GTK_IMAGE (demo->image));
if (paintable)
{
gtk_drag_icon_set_from_paintable (drag, paintable, -2, -2);
g_object_unref (paintable);
}
} }
static GdkContentProvider * static GdkContentProvider *

View File

@@ -1,189 +0,0 @@
#include "demolayout.h"
struct _DemoLayout
{
GtkLayoutManager parent_instance;
float position;
int pos[16];
};
struct _DemoLayoutClass
{
GtkLayoutManagerClass parent_class;
};
G_DEFINE_TYPE (DemoLayout, demo_layout, GTK_TYPE_LAYOUT_MANAGER)
static void
demo_layout_measure (GtkLayoutManager *layout_manager,
GtkWidget *widget,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline)
{
GtkWidget *child;
int minimum_size = 0;
int natural_size = 0;
for (child = gtk_widget_get_first_child (widget);
child != NULL;
child = gtk_widget_get_next_sibling (child))
{
int child_min = 0, child_nat = 0;
if (!gtk_widget_should_layout (child))
continue;
gtk_widget_measure (child, orientation, -1,
&child_min, &child_nat,
NULL, NULL);
minimum_size = MAX (minimum_size, child_min);
natural_size = MAX (natural_size, child_nat);
}
/* A back-of-a-napkin calculation to reserve enough
* space for arranging 16 children in a circle.
*/
*minimum = 16 * minimum_size / G_PI + minimum_size;
*natural = 16 * natural_size / G_PI + natural_size;
}
static void
demo_layout_allocate (GtkLayoutManager *layout_manager,
GtkWidget *widget,
int width,
int height,
int baseline)
{
DemoLayout *self = DEMO_LAYOUT (layout_manager);
GtkWidget *child;
int i;
int child_width = 0;
int child_height = 0;
int x0, y0;
float r;
float t;
t = self->position;
for (child = gtk_widget_get_first_child (widget);
child != NULL;
child = gtk_widget_get_next_sibling (child))
{
GtkRequisition child_req;
if (!gtk_widget_should_layout (child))
continue;
gtk_widget_get_preferred_size (child, &child_req, NULL);
child_width = MAX (child_width, child_req.width);
child_height = MAX (child_height, child_req.height);
}
/* the center of our layout */
x0 = (width / 2);
y0 = (height / 2);
/* the radius for our circle of children */
r = 8 * child_width / G_PI;
for (child = gtk_widget_get_first_child (widget), i = 0;
child != NULL;
child = gtk_widget_get_next_sibling (child), i++)
{
GtkRequisition child_req;
float a = self->pos[i] * G_PI / 8;
int gx, gy;
int cx, cy;
int x, y;
if (!gtk_widget_should_layout (child))
continue;
gtk_widget_get_preferred_size (child, &child_req, NULL);
/* The grid position of child. */
gx = x0 + (i % 4 - 2) * child_width;
gy = y0 + (i / 4 - 2) * child_height;
/* The circle position of child. Note that we
* are adjusting the position by half the child size
* to place the center of child on a centered circle.
* This assumes that the children don't use align flags
* or uneven margins that would shift the center.
*/
cx = x0 + sin (a) * r - child_req.width / 2;
cy = y0 + cos (a) * r - child_req.height / 2;
/* we interpolate between the two layouts according to
* the position value that has been set on the layout.
*/
x = t * cx + (1 - t) * gx;
y = t * cy + (1 - t) * gy;
gtk_widget_size_allocate (child,
&(const GtkAllocation){ x, y, child_width, child_height},
-1);
}
}
static GtkSizeRequestMode
demo_layout_get_request_mode (GtkLayoutManager *layout_manager,
GtkWidget *widget)
{
return GTK_SIZE_REQUEST_CONSTANT_SIZE;
}
static void
demo_layout_class_init (DemoLayoutClass *klass)
{
GtkLayoutManagerClass *layout_class = GTK_LAYOUT_MANAGER_CLASS (klass);
layout_class->get_request_mode = demo_layout_get_request_mode;
layout_class->measure = demo_layout_measure;
layout_class->allocate = demo_layout_allocate;
}
static void
demo_layout_init (DemoLayout *self)
{
int i;
for (i = 0; i < 16; i++)
self->pos[i] = i;
}
GtkLayoutManager *
demo_layout_new (void)
{
return g_object_new (DEMO_TYPE_LAYOUT, NULL);
}
void
demo_layout_set_position (DemoLayout *layout,
float position)
{
layout->position = position;
}
/* Shuffle the circle positions of the children.
* Should be called when we are in the grid layout.
*/
void
demo_layout_shuffle (DemoLayout *layout)
{
int i, j, tmp;
for (i = 0; i < 16; i++)
{
j = g_random_int_range (0, i + 1);
tmp = layout->pos[i];
layout->pos[i] = layout->pos[j];
layout->pos[j] = tmp;
}
}

View File

@@ -1,13 +0,0 @@
#pragma once
#include <gtk/gtk.h>
#define DEMO_TYPE_LAYOUT (demo_layout_get_type ())
G_DECLARE_FINAL_TYPE (DemoLayout, demo_layout, DEMO, LAYOUT, GtkLayoutManager)
GtkLayoutManager * demo_layout_new (void);
void demo_layout_set_position (DemoLayout *layout,
float position);
void demo_layout_shuffle (DemoLayout *layout);

View File

@@ -23,12 +23,14 @@
#include "demotaggedentry.h" #include "demotaggedentry.h"
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <gtk/gtk-a11y.h>
struct _DemoTaggedEntry struct _DemoTaggedEntry
{ {
GtkWidget parent_instance; GtkWidget parent_instance;
GtkWidget *text; GtkWidget *box;
GtkWidget *entry;
}; };
struct _DemoTaggedEntryClass struct _DemoTaggedEntryClass
@@ -44,38 +46,28 @@ G_DEFINE_TYPE_WITH_CODE (DemoTaggedEntry, demo_tagged_entry, GTK_TYPE_WIDGET,
static void static void
demo_tagged_entry_init (DemoTaggedEntry *entry) demo_tagged_entry_init (DemoTaggedEntry *entry)
{ {
GtkCssProvider *provider; entry->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_set_parent (entry->box, GTK_WIDGET (entry));
entry->text = gtk_text_new (); entry->entry = gtk_text_new ();
gtk_widget_set_hexpand (entry->text, TRUE); gtk_widget_set_hexpand (entry->entry, TRUE);
gtk_widget_set_vexpand (entry->text, TRUE); gtk_widget_set_vexpand (entry->entry, TRUE);
gtk_widget_set_parent (entry->text, GTK_WIDGET (entry)); gtk_widget_set_hexpand (entry->box, FALSE);
gtk_widget_set_vexpand (entry->box, FALSE);
gtk_box_append (GTK_BOX (entry->box), entry->entry);
gtk_editable_init_delegate (GTK_EDITABLE (entry)); gtk_editable_init_delegate (GTK_EDITABLE (entry));
gtk_editable_set_width_chars (GTK_EDITABLE (entry->text), 6);
gtk_editable_set_max_width_chars (GTK_EDITABLE (entry->text), 6);
gtk_widget_add_css_class (GTK_WIDGET (entry), "tagged");
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_resource (provider, "/tagged_entry/tagstyle.css");
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
800);
g_object_unref (provider);
} }
static void static void
demo_tagged_entry_dispose (GObject *object) demo_tagged_entry_dispose (GObject *object)
{ {
DemoTaggedEntry *entry = DEMO_TAGGED_ENTRY (object); DemoTaggedEntry *entry = DEMO_TAGGED_ENTRY (object);
GtkWidget *child;
if (entry->text) if (entry->entry)
gtk_editable_finish_delegate (GTK_EDITABLE (entry)); gtk_editable_finish_delegate (GTK_EDITABLE (entry));
while ((child = gtk_widget_get_first_child (GTK_WIDGET (entry)))) g_clear_pointer (&entry->entry, gtk_widget_unparent);
gtk_widget_unparent (child); g_clear_pointer (&entry->box, gtk_widget_unparent);
entry->text = NULL;
G_OBJECT_CLASS (demo_tagged_entry_parent_class)->dispose (object); G_OBJECT_CLASS (demo_tagged_entry_parent_class)->dispose (object);
} }
@@ -109,7 +101,7 @@ demo_tagged_entry_grab_focus (GtkWidget *widget)
{ {
DemoTaggedEntry *entry = DEMO_TAGGED_ENTRY (widget); DemoTaggedEntry *entry = DEMO_TAGGED_ENTRY (widget);
return gtk_widget_grab_focus (entry->text); return gtk_widget_grab_focus (entry->entry);
} }
static void static void
@@ -126,15 +118,15 @@ demo_tagged_entry_class_init (DemoTaggedEntryClass *klass)
gtk_editable_install_properties (object_class, 1); gtk_editable_install_properties (object_class, 1);
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT); gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_ENTRY_ACCESSIBLE);
gtk_widget_class_set_css_name (widget_class, "entry"); gtk_widget_class_set_css_name (widget_class, "entry");
gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_TEXT_BOX);
} }
static GtkEditable * static GtkEditable *
demo_tagged_entry_get_delegate (GtkEditable *editable) demo_tagged_entry_get_delegate (GtkEditable *editable)
{ {
return GTK_EDITABLE (DEMO_TAGGED_ENTRY (editable)->text); return GTK_EDITABLE (DEMO_TAGGED_ENTRY (editable)->entry);
} }
static void static void
@@ -155,7 +147,7 @@ demo_tagged_entry_add_tag (DemoTaggedEntry *entry,
{ {
g_return_if_fail (DEMO_IS_TAGGED_ENTRY (entry)); g_return_if_fail (DEMO_IS_TAGGED_ENTRY (entry));
gtk_widget_set_parent (tag, GTK_WIDGET (entry)); gtk_box_append (GTK_BOX (entry->box), tag);
} }
void void
@@ -165,7 +157,10 @@ demo_tagged_entry_insert_tag_after (DemoTaggedEntry *entry,
{ {
g_return_if_fail (DEMO_IS_TAGGED_ENTRY (entry)); g_return_if_fail (DEMO_IS_TAGGED_ENTRY (entry));
gtk_widget_insert_after (tag, GTK_WIDGET (entry), sibling); if (sibling == NULL)
gtk_box_append (GTK_BOX (entry->box), tag);
else
gtk_box_insert_child_after (GTK_BOX (entry->box), tag, sibling);
} }
void void
@@ -174,7 +169,7 @@ demo_tagged_entry_remove_tag (DemoTaggedEntry *entry,
{ {
g_return_if_fail (DEMO_IS_TAGGED_ENTRY (entry)); g_return_if_fail (DEMO_IS_TAGGED_ENTRY (entry));
gtk_widget_unparent (tag); gtk_box_remove (GTK_BOX (entry->box), tag);
} }
struct _DemoTaggedEntryTag struct _DemoTaggedEntryTag
@@ -224,6 +219,7 @@ static void
demo_tagged_entry_tag_init (DemoTaggedEntryTag *tag) demo_tagged_entry_tag_init (DemoTaggedEntryTag *tag)
{ {
GtkGesture *gesture; GtkGesture *gesture;
GtkCssProvider *provider;
tag->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); tag->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_set_parent (tag->box, GTK_WIDGET (tag)); gtk_widget_set_parent (tag->box, GTK_WIDGET (tag));
@@ -233,6 +229,13 @@ demo_tagged_entry_tag_init (DemoTaggedEntryTag *tag)
gesture = gtk_gesture_click_new (); gesture = gtk_gesture_click_new ();
g_signal_connect (gesture, "released", G_CALLBACK (on_released), tag); g_signal_connect (gesture, "released", G_CALLBACK (on_released), tag);
gtk_widget_add_controller (GTK_WIDGET (tag), GTK_EVENT_CONTROLLER (gesture)); gtk_widget_add_controller (GTK_WIDGET (tag), GTK_EVENT_CONTROLLER (gesture));
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_resource (provider, "/tagged_entry/tagstyle.css");
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
800);
g_object_unref (provider);
} }
static void static void

View File

@@ -1,121 +0,0 @@
#include "demowidget.h"
#include "demolayout.h"
/* parent widget */
struct _DemoWidget
{
GtkWidget parent_instance;
gboolean backward; /* whether we go 0 -> 1 or 1 -> 0 */
gint64 start_time; /* time the transition started */
guint tick_id; /* our tick cb */
};
struct _DemoWidgetClass
{
GtkWidgetClass parent_class;
};
G_DEFINE_TYPE (DemoWidget, demo_widget, GTK_TYPE_WIDGET)
/* The widget is controlling the transition by calling
* demo_layout_set_position() in a tick callback.
*
* We take half a second to go from one layout to the other.
*/
#define DURATION (0.5 * G_TIME_SPAN_SECOND)
static gboolean
transition (GtkWidget *widget,
GdkFrameClock *frame_clock,
gpointer data)
{
DemoWidget *self = DEMO_WIDGET (widget);
DemoLayout *demo_layout = DEMO_LAYOUT (gtk_widget_get_layout_manager (widget));
gint64 now = g_get_monotonic_time ();
gtk_widget_queue_allocate (widget);
if (self->backward)
demo_layout_set_position (demo_layout, 1.0 - (now - self->start_time) / DURATION);
else
demo_layout_set_position (demo_layout, (now - self->start_time) / DURATION);
if (now - self->start_time >= DURATION)
{
self->backward = !self->backward;
demo_layout_set_position (demo_layout, self->backward ? 1.0 : 0.0);
/* keep things interesting by shuffling the positions */
if (!self->backward)
demo_layout_shuffle (demo_layout);
self->tick_id = 0;
return G_SOURCE_REMOVE;
}
return G_SOURCE_CONTINUE;
}
static void
clicked (GtkGestureClick *gesture,
guint n_press,
double x,
double y,
gpointer data)
{
DemoWidget *self = data;
if (self->tick_id != 0)
return;
self->start_time = g_get_monotonic_time ();
self->tick_id = gtk_widget_add_tick_callback (GTK_WIDGET (self), transition, NULL, NULL);
}
static void
demo_widget_init (DemoWidget *self)
{
GtkGesture *gesture;
gesture = gtk_gesture_click_new ();
g_signal_connect (gesture, "pressed", G_CALLBACK (clicked), self);
gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (gesture));
}
static void
demo_widget_dispose (GObject *object)
{
GtkWidget *child;
while ((child = gtk_widget_get_first_child (GTK_WIDGET (object))))
gtk_widget_unparent (child);
G_OBJECT_CLASS (demo_widget_parent_class)->dispose (object);
}
static void
demo_widget_class_init (DemoWidgetClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
object_class->dispose = demo_widget_dispose;
/* here is where we use our custom layout manager */
gtk_widget_class_set_layout_manager_type (widget_class, DEMO_TYPE_LAYOUT);
}
GtkWidget *
demo_widget_new (void)
{
return g_object_new (DEMO_TYPE_WIDGET, NULL);
}
void
demo_widget_add_child (DemoWidget *self,
GtkWidget *child)
{
gtk_widget_set_parent (child, GTK_WIDGET (self));
}

View File

@@ -1,11 +0,0 @@
#pragma once
#include <gtk/gtk.h>
#define DEMO_TYPE_WIDGET (demo_widget_get_type ())
G_DECLARE_FINAL_TYPE (DemoWidget, demo_widget, DEMO, WIDGET, GtkWidget)
GtkWidget * demo_widget_new (void);
void demo_widget_add_child (DemoWidget *self,
GtkWidget *child);

View File

@@ -1,5 +1,4 @@
/* Dialogs /* Dialogs
* #Keywords: GtkMessageDialog
* *
* Dialogs are used to pop up transient windows for information * Dialogs are used to pop up transient windows for information
* and user feedback. * and user feedback.
@@ -17,7 +16,7 @@ message_dialog_clicked (GtkButton *button,
gpointer user_data) gpointer user_data)
{ {
GtkWidget *dialog; GtkWidget *dialog;
static int i = 1; static gint i = 1;
dialog = gtk_message_dialog_new (GTK_WINDOW (window), dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,

View File

@@ -1,12 +1,8 @@
/* Drag-and-Drop /* Drag-and-Drop
* #Keywords: dnd, menu, popover, gesture
* *
* This demo shows dragging colors and widgets. * This demo shows dragging colors and widgets.
* The items in this demo can be moved, recolored * The items in this demo can be moved, recolored
* and rotated. * and rotated.
*
* The demo also has an example for creating a
* menu-like popover without using a menu model.
*/ */
#include <gtk/gtk.h> #include <gtk/gtk.h>
@@ -113,9 +109,12 @@ apply_transform (CanvasItem *item)
y = gtk_widget_get_allocated_height (item->label) / 2.0; y = gtk_widget_get_allocated_height (item->label) / 2.0;
item->r = sqrt (x*x + y*y); item->r = sqrt (x*x + y*y);
transform = gsk_transform_translate (NULL, &(graphene_point_t) { item->r, item->r }); transform = gsk_transform_translate (
transform = gsk_transform_rotate (transform, item->angle + item->delta); gsk_transform_rotate (
transform = gsk_transform_translate (transform, &(graphene_point_t) { -x, -y }); gsk_transform_translate (NULL,
&(graphene_point_t) { item->r, item->r }),
item->angle + item->delta),
&(graphene_point_t) { - x, - y });
gtk_fixed_set_child_transform (GTK_FIXED (item->fixed), item->label, transform); gtk_fixed_set_child_transform (GTK_FIXED (item->fixed), item->label, transform);
gsk_transform_unref (transform); gsk_transform_unref (transform);
@@ -154,30 +153,6 @@ click_done (GtkGesture *gesture)
gtk_widget_insert_after (item, canvas, last_child); gtk_widget_insert_after (item, canvas, last_child);
} }
static gboolean
theme_is_dark (void)
{
GtkSettings *settings;
char *theme;
gboolean prefer_dark;
gboolean dark;
settings = gtk_settings_get_default ();
g_object_get (settings,
"gtk-theme-name", &theme,
"gtk-application-prefer-dark-theme", &prefer_dark,
NULL);
if ((strcmp (theme, "Adwaita") == 0 && prefer_dark) || strcmp (theme, "HighContrastInverse") == 0)
dark = TRUE;
else
dark = FALSE;
g_free (theme);
return dark;
}
static void static void
canvas_item_init (CanvasItem *item) canvas_item_init (CanvasItem *item)
{ {
@@ -205,11 +180,7 @@ canvas_item_init (CanvasItem *item)
gtk_widget_set_name (item->label, id); gtk_widget_set_name (item->label, id);
g_free (id); g_free (id);
if (theme_is_dark ()) gdk_rgba_parse (&rgba, "yellow");
gdk_rgba_parse (&rgba, "blue");
else
gdk_rgba_parse (&rgba, "yellow");
set_color (item, &rgba); set_color (item, &rgba);
item->angle = 0; item->angle = 0;
@@ -567,6 +538,7 @@ canvas_new (void)
canvas = gtk_fixed_new (); canvas = gtk_fixed_new ();
gtk_widget_set_hexpand (canvas, TRUE); gtk_widget_set_hexpand (canvas, TRUE);
gtk_widget_set_vexpand (canvas, TRUE); gtk_widget_set_vexpand (canvas, TRUE);
gtk_widget_add_css_class (canvas, "frame");
source = gtk_drag_source_new (); source = gtk_drag_source_new ();
gtk_drag_source_set_actions (source, GDK_ACTION_MOVE); gtk_drag_source_set_actions (source, GDK_ACTION_MOVE);
@@ -625,83 +597,6 @@ css_button_new (const char *class)
return button; return button;
} }
typedef struct
{
GtkWidget parent_instance;
GdkRGBA color;
} ColorSwatch;
typedef struct
{
GtkWidgetClass parent_class;
} ColorSwatchClass;
G_DEFINE_TYPE (ColorSwatch, color_swatch, GTK_TYPE_WIDGET)
static GdkContentProvider *
color_swatch_drag_prepare (GtkDragSource *source,
double x,
double y,
ColorSwatch *swatch)
{
return gdk_content_provider_new_typed (GDK_TYPE_RGBA, &swatch->color);
}
static void
color_swatch_init (ColorSwatch *swatch)
{
GtkDragSource *source = gtk_drag_source_new ();
g_signal_connect (source, "prepare", G_CALLBACK (color_swatch_drag_prepare), swatch);
gtk_widget_add_controller (GTK_WIDGET (swatch), GTK_EVENT_CONTROLLER (source));
}
static void
color_swatch_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
ColorSwatch *swatch = (ColorSwatch *)widget;
float w = gtk_widget_get_width (widget);
float h = gtk_widget_get_height (widget);
gtk_snapshot_append_color (snapshot, &swatch->color,
&GRAPHENE_RECT_INIT(0, 0, w, h));
}
void
color_swatch_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
int *minimum_size,
int *natural_size,
int *minimum_baseline,
int *natural_baseline)
{
if (orientation == GTK_ORIENTATION_HORIZONTAL)
*minimum_size = *natural_size = 48;
else
*minimum_size = *natural_size = 32;
}
static void
color_swatch_class_init (ColorSwatchClass *class)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
widget_class->snapshot = color_swatch_snapshot;
widget_class->measure = color_swatch_measure;
gtk_widget_class_set_css_name (widget_class, "colorswatch");
}
static GtkWidget *
color_swatch_new (const char *color)
{
ColorSwatch *swatch = g_object_new (color_swatch_get_type (), NULL);
gdk_rgba_parse (&swatch->color, color);
return GTK_WIDGET (swatch);
}
static GtkWidget *window = NULL; static GtkWidget *window = NULL;
GtkWidget * GtkWidget *
@@ -764,8 +659,6 @@ do_dnd (GtkWidget *do_widget)
y += 100; y += 100;
} }
gtk_box_append (GTK_BOX (box), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL));
sw = gtk_scrolled_window_new (); sw = gtk_scrolled_window_new ();
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC,
@@ -777,7 +670,18 @@ do_dnd (GtkWidget *do_widget)
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), box3); gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), box3);
for (i = 0; colors[i]; i++) for (i = 0; colors[i]; i++)
gtk_box_append (GTK_BOX (box3), color_swatch_new (colors[i])); {
GdkRGBA rgba;
GtkWidget *swatch;
gdk_rgba_parse (&rgba, colors[i]);
swatch = g_object_new (g_type_from_name ("GtkColorSwatch"),
"rgba", &rgba,
"selectable", FALSE,
NULL);
gtk_box_append (GTK_BOX (box3), swatch);
}
gtk_box_append (GTK_BOX (box3), css_button_new ("rainbow1")); gtk_box_append (GTK_BOX (box3), css_button_new ("rainbow1"));
gtk_box_append (GTK_BOX (box3), css_button_new ("rainbow2")); gtk_box_append (GTK_BOX (box3), css_button_new ("rainbow2"));

View File

@@ -1,5 +1,4 @@
/* Drawing Area /* Drawing Area
* #Keywords: GtkDrawingArea
* *
* GtkDrawingArea is a blank area where you can draw custom displays * GtkDrawingArea is a blank area where you can draw custom displays
* of various kinds. * of various kinds.
@@ -65,8 +64,8 @@ scribble_draw (GtkDrawingArea *da,
/* Draw a rectangle on the screen */ /* Draw a rectangle on the screen */
static void static void
draw_brush (GtkWidget *widget, draw_brush (GtkWidget *widget,
double x, gdouble x,
double y) gdouble y)
{ {
GdkRectangle update_rect; GdkRectangle update_rect;
cairo_t *cr; cairo_t *cr;
@@ -311,7 +310,6 @@ do_drawingarea (GtkWidget *do_widget)
gtk_window_set_display (GTK_WINDOW (window), gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget)); gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Drawing Area"); gtk_window_set_title (GTK_WINDOW (window), "Drawing Area");
gtk_window_set_default_size (GTK_WINDOW (window), 250, -1);
g_signal_connect (window, "destroy", g_signal_connect (window, "destroy",
G_CALLBACK (close_window), NULL); G_CALLBACK (close_window), NULL);
@@ -326,8 +324,9 @@ do_drawingarea (GtkWidget *do_widget)
/* /*
* Create the groups area * Create the groups area
*/ */
label = gtk_label_new ("Knockout groups"); label = gtk_label_new (NULL);
gtk_widget_add_css_class (label, "heading"); gtk_label_set_markup (GTK_LABEL (label),
"<u>Knockout groups</u>");
gtk_box_append (GTK_BOX (vbox), label); gtk_box_append (GTK_BOX (vbox), label);
frame = gtk_frame_new (NULL); frame = gtk_frame_new (NULL);
@@ -344,8 +343,9 @@ do_drawingarea (GtkWidget *do_widget)
* Create the scribble area * Create the scribble area
*/ */
label = gtk_label_new ("Scribble area"); label = gtk_label_new (NULL);
gtk_widget_add_css_class (label, "heading"); gtk_label_set_markup (GTK_LABEL (label),
"<u>Scribble area</u>");
gtk_box_append (GTK_BOX (vbox), label); gtk_box_append (GTK_BOX (vbox), label);
frame = gtk_frame_new (NULL); frame = gtk_frame_new (NULL);

View File

@@ -1,16 +1,17 @@
/* Lists/Selections /* Drop Downs
* *
* 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
* displayed using widgets instead of cell renderers. * displayed using widgets instead of cell renderers.
* *
* This example also shows a custom widget that can replace * The examples here demonstrate how to use different kinds of
* GtkEntryCompletion or GtkComboBoxText. It is not currently * list models with GtkDropDown, how to use search and how to
* part of GTK. * display the selected item differently from the presentation
* in the popup.
*/ */
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "suggestionentry.h"
#define STRING_TYPE_HOLDER (string_holder_get_type ()) #define STRING_TYPE_HOLDER (string_holder_get_type ())
G_DECLARE_FINAL_TYPE (StringHolder, string_holder, STRING, HOLDER, GObject) G_DECLARE_FINAL_TYPE (StringHolder, string_holder, STRING, HOLDER, GObject)
@@ -64,22 +65,18 @@ strings_setup_item_single_line (GtkSignalListItemFactory *factory,
GtkListItem *item) GtkListItem *item)
{ {
GtkWidget *box, *image, *title; GtkWidget *box, *image, *title;
GtkWidget *checkmark;
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
image = gtk_image_new (); image = gtk_image_new ();
title = gtk_label_new (""); title = gtk_label_new ("");
gtk_label_set_xalign (GTK_LABEL (title), 0.0); gtk_label_set_xalign (GTK_LABEL (title), 0.0);
checkmark = gtk_image_new_from_icon_name ("object-select-symbolic");
gtk_box_append (GTK_BOX (box), image); gtk_box_append (GTK_BOX (box), image);
gtk_box_append (GTK_BOX (box), title); gtk_box_append (GTK_BOX (box), title);
gtk_box_append (GTK_BOX (box), checkmark);
g_object_set_data (G_OBJECT (item), "title", title); g_object_set_data (G_OBJECT (item), "title", title);
g_object_set_data (G_OBJECT (item), "image", image); g_object_set_data (G_OBJECT (item), "image", image);
g_object_set_data (G_OBJECT (item), "checkmark", checkmark);
gtk_list_item_set_child (item, box); gtk_list_item_set_child (item, box);
} }
@@ -89,15 +86,13 @@ strings_setup_item_full (GtkSignalListItemFactory *factory,
GtkListItem *item) GtkListItem *item)
{ {
GtkWidget *box, *box2, *image, *title, *description; GtkWidget *box, *box2, *image, *title, *description;
GtkWidget *checkmark;
image = gtk_image_new (); image = gtk_image_new ();
title = gtk_label_new (""); title = gtk_label_new ("");
gtk_label_set_xalign (GTK_LABEL (title), 0.0); gtk_label_set_xalign (GTK_LABEL (title), 0.0);
description = gtk_label_new (""); description = gtk_label_new ("");
gtk_label_set_xalign (GTK_LABEL (description), 0.0); gtk_label_set_xalign (GTK_LABEL (description), 0.0);
gtk_widget_add_css_class (description, "dim-label"); gtk_style_context_add_class (gtk_widget_get_style_context (description), "dim-label");
checkmark = gtk_image_new_from_icon_name ("object-select-symbolic");
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2); box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
@@ -106,48 +101,26 @@ strings_setup_item_full (GtkSignalListItemFactory *factory,
gtk_box_append (GTK_BOX (box), box2); gtk_box_append (GTK_BOX (box), box2);
gtk_box_append (GTK_BOX (box2), title); gtk_box_append (GTK_BOX (box2), title);
gtk_box_append (GTK_BOX (box2), description); gtk_box_append (GTK_BOX (box2), description);
gtk_box_append (GTK_BOX (box), checkmark);
g_object_set_data (G_OBJECT (item), "title", title); g_object_set_data (G_OBJECT (item), "title", title);
g_object_set_data (G_OBJECT (item), "image", image); g_object_set_data (G_OBJECT (item), "image", image);
g_object_set_data (G_OBJECT (item), "description", description); g_object_set_data (G_OBJECT (item), "description", description);
g_object_set_data (G_OBJECT (item), "checkmark", checkmark);
gtk_list_item_set_child (item, box); gtk_list_item_set_child (item, box);
} }
static void
selected_item_changed (GtkDropDown *dropdown,
GParamSpec *pspec,
GtkListItem *item)
{
GtkWidget *checkmark;
checkmark = g_object_get_data (G_OBJECT (item), "checkmark");
if (gtk_drop_down_get_selected_item (dropdown) == gtk_list_item_get_item (item))
gtk_widget_set_opacity (checkmark, 1.0);
else
gtk_widget_set_opacity (checkmark, 0.0);
}
static void static void
strings_bind_item (GtkSignalListItemFactory *factory, strings_bind_item (GtkSignalListItemFactory *factory,
GtkListItem *item, GtkListItem *item)
gpointer data)
{ {
GtkDropDown *dropdown = data;
GtkWidget *image, *title, *description; GtkWidget *image, *title, *description;
GtkWidget *checkmark;
StringHolder *holder; StringHolder *holder;
GtkWidget *popup;
holder = gtk_list_item_get_item (item); holder = gtk_list_item_get_item (item);
title = g_object_get_data (G_OBJECT (item), "title"); title = g_object_get_data (G_OBJECT (item), "title");
image = g_object_get_data (G_OBJECT (item), "image"); image = g_object_get_data (G_OBJECT (item), "image");
description = g_object_get_data (G_OBJECT (item), "description"); description = g_object_get_data (G_OBJECT (item), "description");
checkmark = g_object_get_data (G_OBJECT (item), "checkmark");
gtk_label_set_label (GTK_LABEL (title), holder->title); gtk_label_set_label (GTK_LABEL (title), holder->title);
if (image) if (image)
@@ -160,43 +133,19 @@ strings_bind_item (GtkSignalListItemFactory *factory,
gtk_label_set_label (GTK_LABEL (description), holder->description); gtk_label_set_label (GTK_LABEL (description), holder->description);
gtk_widget_set_visible (description , holder->description != NULL); gtk_widget_set_visible (description , holder->description != NULL);
} }
popup = gtk_widget_get_ancestor (title, GTK_TYPE_POPOVER);
if (popup && gtk_widget_is_ancestor (popup, GTK_WIDGET (dropdown)))
{
gtk_widget_show (checkmark);
g_signal_connect (dropdown, "notify::selected-item",
G_CALLBACK (selected_item_changed), item);
selected_item_changed (dropdown, NULL, item);
}
else
{
gtk_widget_hide (checkmark);
}
}
static void
strings_unbind_item (GtkSignalListItemFactory *factory,
GtkListItem *list_item,
gpointer data)
{
GtkDropDown *dropdown = data;
g_signal_handlers_disconnect_by_func (dropdown, selected_item_changed, list_item);
} }
static GtkListItemFactory * static GtkListItemFactory *
strings_factory_new (gpointer data, gboolean full) strings_factory_new (gboolean full)
{ {
GtkListItemFactory *factory; GtkListItemFactory *factory;
factory = gtk_signal_list_item_factory_new (); factory = gtk_signal_list_item_factory_new ();
if (full) if (full)
g_signal_connect (factory, "setup", G_CALLBACK (strings_setup_item_full), data); g_signal_connect (factory, "setup", G_CALLBACK (strings_setup_item_full), NULL);
else else
g_signal_connect (factory, "setup", G_CALLBACK (strings_setup_item_single_line), data); g_signal_connect (factory, "setup", G_CALLBACK (strings_setup_item_single_line), NULL);
g_signal_connect (factory, "bind", G_CALLBACK (strings_bind_item), data); g_signal_connect (factory, "bind", G_CALLBACK (strings_bind_item), NULL);
g_signal_connect (factory, "unbind", G_CALLBACK (strings_unbind_item), data);
return factory; return factory;
} }
@@ -237,22 +186,19 @@ drop_down_new_from_strings (const char *const *titles,
g_return_val_if_fail (descriptions == NULL || g_strv_length ((char **)icons) == g_strv_length ((char **)descriptions), NULL); g_return_val_if_fail (descriptions == NULL || g_strv_length ((char **)icons) == g_strv_length ((char **)descriptions), NULL);
model = strings_model_new (titles, icons, descriptions); model = strings_model_new (titles, icons, descriptions);
widget = g_object_new (GTK_TYPE_DROP_DOWN, factory = strings_factory_new (FALSE);
"model", model,
NULL);
g_object_unref (model);
factory = strings_factory_new (widget, FALSE);
if (icons != NULL || descriptions != NULL) if (icons != NULL || descriptions != NULL)
list_factory = strings_factory_new (widget, TRUE); list_factory = strings_factory_new (TRUE);
else else
list_factory = NULL; list_factory = NULL;
g_object_set (widget, widget = g_object_new (GTK_TYPE_DROP_DOWN,
"factory", factory, "model", model,
"list-factory", list_factory, "factory", factory,
NULL); "list-factory", list_factory,
NULL);
g_object_unref (model);
g_object_unref (factory); g_object_unref (factory);
if (list_factory) if (list_factory)
g_object_unref (list_factory); g_object_unref (list_factory);
@@ -272,110 +218,13 @@ get_title (gpointer item)
return g_strdup (STRING_HOLDER (item)->title); return g_strdup (STRING_HOLDER (item)->title);
} }
static char *
get_file_name (gpointer item)
{
return g_strdup (g_file_info_get_display_name (G_FILE_INFO (item)));
}
static void
setup_item (GtkSignalListItemFactory *factory,
GtkListItem *item)
{
GtkWidget *box;
GtkWidget *icon;
GtkWidget *label;
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
icon = gtk_image_new ();
label = gtk_label_new ("");
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_box_append (GTK_BOX (box), icon);
gtk_box_append (GTK_BOX (box), label);
gtk_list_item_set_child (item, box);
}
static void
bind_item (GtkSignalListItemFactory *factory,
GtkListItem *item)
{
MatchObject *match = MATCH_OBJECT (gtk_list_item_get_item (item));
GFileInfo *info = G_FILE_INFO (match_object_get_item (match));
GtkWidget *box = gtk_list_item_get_child (item);
GtkWidget *icon = gtk_widget_get_first_child (box);
GtkWidget *label = gtk_widget_get_last_child (box);
gtk_image_set_from_gicon (GTK_IMAGE (icon), g_file_info_get_icon (info));
gtk_label_set_label (GTK_LABEL (label), g_file_info_get_display_name (info));
}
static void
setup_highlight_item (GtkSignalListItemFactory *factory,
GtkListItem *item)
{
GtkWidget *label;
label = gtk_label_new ("");
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_list_item_set_child (item, label);
}
static void
bind_highlight_item (GtkSignalListItemFactory *factory,
GtkListItem *item)
{
MatchObject *obj;
GtkWidget *label;
PangoAttrList *attrs;
PangoAttribute *attr;
const char *str;
obj = MATCH_OBJECT (gtk_list_item_get_item (item));
label = gtk_list_item_get_child (item);
str = match_object_get_string (obj);
gtk_label_set_label (GTK_LABEL (label), str);
attrs = pango_attr_list_new ();
attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
attr->start_index = match_object_get_match_start (obj);
attr->end_index = match_object_get_match_end (obj);
pango_attr_list_insert (attrs, attr);
gtk_label_set_attributes (GTK_LABEL (label), attrs);
pango_attr_list_unref (attrs);
}
static void
match_func (MatchObject *obj,
const char *search,
gpointer user_data)
{
char *tmp1, *tmp2;
char *p;
tmp1 = g_utf8_normalize (match_object_get_string (obj), -1, G_NORMALIZE_ALL);
tmp2 = g_utf8_normalize (search, -1, G_NORMALIZE_ALL);
if ((p = strstr (tmp1, tmp2)) != NULL)
match_object_set_match (obj,
p - tmp1,
(p - tmp1) + g_utf8_strlen (search, -1),
1);
else
match_object_set_match (obj, 0, 0, 0);
g_free (tmp1);
g_free (tmp2);
}
GtkWidget * GtkWidget *
do_dropdown (GtkWidget *do_widget) do_dropdown (GtkWidget *do_widget)
{ {
static GtkWidget *window = NULL; static GtkWidget *window = NULL;
GtkWidget *button, *box, *spin, *check, *hbox, *label, *entry; GtkWidget *button, *box, *spin, *check;
GListModel *model; GListModel *model;
GtkExpression *expression; GtkExpression *expression;
GtkListItemFactory *factory;
const char * const times[] = { "1 minute", "2 minutes", "5 minutes", "20 minutes", NULL }; const char * const times[] = { "1 minute", "2 minutes", "5 minutes", "20 minutes", NULL };
const char * const many_times[] = { const char * const many_times[] = {
"1 minute", "2 minutes", "5 minutes", "10 minutes", "15 minutes", "20 minutes", "1 minute", "2 minutes", "5 minutes", "10 minutes", "15 minutes", "20 minutes",
@@ -388,51 +237,24 @@ do_dropdown (GtkWidget *do_widget)
const char * const device_descriptions[] = { const char * const device_descriptions[] = {
"Built-in Audio", "Built-in audio", "Thinkpad Tunderbolt 3 Dock USB Audio", "Thinkpad Tunderbolt 3 Dock USB Audio", NULL "Built-in Audio", "Built-in audio", "Thinkpad Tunderbolt 3 Dock USB Audio", "Thinkpad Tunderbolt 3 Dock USB Audio", NULL
}; };
char *cwd;
GFile *file;
GListModel *dir;
GtkStringList *strings;
if (!window) if (!window)
{ {
window = gtk_window_new (); window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window), gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget)); gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Selections"); gtk_window_set_title (GTK_WINDOW (window), "Drop Downs");
gtk_window_set_resizable (GTK_WINDOW (window), FALSE); gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window); g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 20);
gtk_widget_set_margin_start (hbox, 20);
gtk_widget_set_margin_end (hbox, 20);
gtk_widget_set_margin_top (hbox, 20);
gtk_widget_set_margin_bottom (hbox, 20);
gtk_window_set_child (GTK_WINDOW (window), hbox);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
gtk_box_append (GTK_BOX (hbox), box); gtk_widget_set_margin_start (box, 10);
gtk_widget_set_margin_end (box, 10);
gtk_widget_set_margin_top (box, 10);
gtk_widget_set_margin_bottom (box, 10);
gtk_window_set_child (GTK_WINDOW (window), box);
label = gtk_label_new ("Dropdowns"); button = gtk_drop_down_new ();
gtk_widget_add_css_class (label, "title-4");
gtk_box_append (GTK_BOX (box), label);
/* A basic dropdown */
button = drop_down_new_from_strings (times, NULL, NULL);
gtk_box_append (GTK_BOX (box), button);
/* A dropdown using an expression to obtain strings */
button = drop_down_new_from_strings (many_times, NULL, NULL);
gtk_drop_down_set_enable_search (GTK_DROP_DOWN (button), TRUE);
expression = gtk_cclosure_expression_new (G_TYPE_STRING, NULL,
0, NULL,
(GCallback)get_title,
NULL, NULL);
gtk_drop_down_set_expression (GTK_DROP_DOWN (button), expression);
gtk_expression_unref (expression);
gtk_box_append (GTK_BOX (box), button);
button = gtk_drop_down_new (NULL, NULL);
model = G_LIST_MODEL (pango_cairo_font_map_get_default ()); model = G_LIST_MODEL (pango_cairo_font_map_get_default ());
gtk_drop_down_set_model (GTK_DROP_DOWN (button), model); gtk_drop_down_set_model (GTK_DROP_DOWN (button), model);
@@ -448,118 +270,30 @@ do_dropdown (GtkWidget *do_widget)
spin = gtk_spin_button_new_with_range (-1, g_list_model_get_n_items (G_LIST_MODEL (model)), 1); spin = gtk_spin_button_new_with_range (-1, g_list_model_get_n_items (G_LIST_MODEL (model)), 1);
gtk_widget_set_halign (spin, GTK_ALIGN_START); gtk_widget_set_halign (spin, GTK_ALIGN_START);
gtk_widget_set_margin_start (spin, 20);
g_object_bind_property (button, "selected", spin, "value", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); g_object_bind_property (button, "selected", spin, "value", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
gtk_box_append (GTK_BOX (box), spin); gtk_box_append (GTK_BOX (box), spin);
check = gtk_check_button_new_with_label ("Enable search"); check = gtk_check_button_new_with_label ("Enable search");
gtk_widget_set_margin_start (check, 20);
g_object_bind_property (button, "enable-search", check, "active", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); g_object_bind_property (button, "enable-search", check, "active", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
gtk_box_append (GTK_BOX (box), check); gtk_box_append (GTK_BOX (box), check);
g_object_unref (model); g_object_unref (model);
/* A dropdown with a separate list factory */ button = drop_down_new_from_strings (times, NULL, NULL);
button = drop_down_new_from_strings (device_titles, device_icons, device_descriptions);
gtk_box_append (GTK_BOX (box), button); gtk_box_append (GTK_BOX (box), button);
gtk_box_append (GTK_BOX (hbox), gtk_separator_new (GTK_ORIENTATION_VERTICAL)); button = drop_down_new_from_strings (many_times, NULL, NULL);
gtk_drop_down_set_enable_search (GTK_DROP_DOWN (button), TRUE);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
gtk_box_append (GTK_BOX (hbox), box);
label = gtk_label_new ("Suggestions");
gtk_widget_add_css_class (label, "title-4");
gtk_box_append (GTK_BOX (box), label);
/* A basic suggestion entry */
entry = suggestion_entry_new ();
g_object_set (entry, "placeholder-text", "Words with T or G…", NULL);
strings = gtk_string_list_new ((const char *[]){
"GNOME",
"gnominious",
"Gnomonic projection",
"total",
"totally",
"toto",
"tottery",
"totterer",
"Totten trust",
"totipotent",
"totipotency",
"totemism",
"totem pole",
"Totara",
"totalizer",
"totalizator",
"totalitarianism",
"total parenteral nutrition",
"total hysterectomy",
"total eclipse",
"Totipresence",
"Totipalmi",
"Tomboy",
"zombie",
NULL});
suggestion_entry_set_model (SUGGESTION_ENTRY (entry), G_LIST_MODEL (strings));
g_object_unref (strings);
gtk_box_append (GTK_BOX (box), entry);
/* A suggestion entry using a custom model, and no filtering */
entry = suggestion_entry_new ();
cwd = g_get_current_dir ();
file = g_file_new_for_path (cwd);
dir = G_LIST_MODEL (gtk_directory_list_new ("standard::display-name,standard::content-type,standard::icon,standard::size", file));
suggestion_entry_set_model (SUGGESTION_ENTRY (entry), dir);
g_object_unref (dir);
g_object_unref (file);
g_free (cwd);
expression = gtk_cclosure_expression_new (G_TYPE_STRING, NULL, expression = gtk_cclosure_expression_new (G_TYPE_STRING, NULL,
0, NULL, 0, NULL,
(GCallback)get_file_name, (GCallback)get_title,
NULL, NULL); NULL, NULL);
suggestion_entry_set_expression (SUGGESTION_ENTRY (entry), expression); gtk_drop_down_set_expression (GTK_DROP_DOWN (button), expression);
gtk_expression_unref (expression); gtk_expression_unref (expression);
gtk_box_append (GTK_BOX (box), button);
factory = gtk_signal_list_item_factory_new (); button = drop_down_new_from_strings (device_titles, device_icons, device_descriptions);
g_signal_connect (factory, "setup", G_CALLBACK (setup_item), NULL); gtk_box_append (GTK_BOX (box), button);
g_signal_connect (factory, "bind", G_CALLBACK (bind_item), NULL);
suggestion_entry_set_factory (SUGGESTION_ENTRY (entry), factory);
g_object_unref (factory);
suggestion_entry_set_use_filter (SUGGESTION_ENTRY (entry), FALSE);
suggestion_entry_set_show_arrow (SUGGESTION_ENTRY (entry), TRUE);
gtk_box_append (GTK_BOX (box), entry);
/* A suggestion entry with match highlighting */
entry = suggestion_entry_new ();
g_object_set (entry, "placeholder-text", "Destination", NULL);
strings = gtk_string_list_new ((const char *[]){
"app-mockups",
"settings-mockups",
"os-mockups",
"software-mockups",
"mocktails",
NULL});
suggestion_entry_set_model (SUGGESTION_ENTRY (entry), G_LIST_MODEL (strings));
g_object_unref (strings);
gtk_box_append (GTK_BOX (box), entry);
suggestion_entry_set_match_func (SUGGESTION_ENTRY (entry), match_func, NULL, NULL);
factory = gtk_signal_list_item_factory_new ();
g_signal_connect (factory, "setup", G_CALLBACK (setup_highlight_item), NULL);
g_signal_connect (factory, "bind", G_CALLBACK (bind_highlight_item), NULL);
suggestion_entry_set_factory (SUGGESTION_ENTRY (entry), factory);
g_object_unref (factory);
} }
if (!gtk_widget_get_visible (window)) if (!gtk_widget_get_visible (window))

View File

@@ -16,9 +16,9 @@
typedef struct typedef struct
{ {
int number; gint number;
char *product; gchar *product;
int yummy; gint yummy;
} }
Item; Item;
@@ -74,7 +74,7 @@ add_items (void)
static GtkTreeModel * static GtkTreeModel *
create_items_model (void) create_items_model (void)
{ {
int i = 0; gint i = 0;
GtkListStore *model; GtkListStore *model;
GtkTreeIter iter; GtkTreeIter iter;
@@ -109,7 +109,7 @@ static GtkTreeModel *
create_numbers_model (void) create_numbers_model (void)
{ {
#define N_NUMBERS 10 #define N_NUMBERS 10
int i = 0; gint i = 0;
GtkListStore *model; GtkListStore *model;
GtkTreeIter iter; GtkTreeIter iter;
@@ -192,7 +192,7 @@ remove_item (GtkWidget *widget, gpointer data)
if (gtk_tree_selection_get_selected (selection, NULL, &iter)) if (gtk_tree_selection_get_selected (selection, NULL, &iter))
{ {
int i; gint i;
GtkTreePath *path; GtkTreePath *path;
path = gtk_tree_model_get_path (model, &iter); path = gtk_tree_model_get_path (model, &iter);
@@ -211,7 +211,7 @@ separator_row (GtkTreeModel *model,
gpointer data) gpointer data)
{ {
GtkTreePath *path; GtkTreePath *path;
int idx; gint idx;
path = gtk_tree_model_get_path (model, iter); path = gtk_tree_model_get_path (model, iter);
idx = gtk_tree_path_get_indices (path)[0]; idx = gtk_tree_path_get_indices (path)[0];
@@ -224,7 +224,7 @@ separator_row (GtkTreeModel *model,
static void static void
editing_started (GtkCellRenderer *cell, editing_started (GtkCellRenderer *cell,
GtkCellEditable *editable, GtkCellEditable *editable,
const char *path, const gchar *path,
gpointer data) gpointer data)
{ {
gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (editable), gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (editable),
@@ -233,15 +233,15 @@ editing_started (GtkCellRenderer *cell,
static void static void
cell_edited (GtkCellRendererText *cell, cell_edited (GtkCellRendererText *cell,
const char *path_string, const gchar *path_string,
const char *new_text, const gchar *new_text,
gpointer data) gpointer data)
{ {
GtkTreeModel *model = (GtkTreeModel *)data; GtkTreeModel *model = (GtkTreeModel *)data;
GtkTreePath *path = gtk_tree_path_new_from_string (path_string); GtkTreePath *path = gtk_tree_path_new_from_string (path_string);
GtkTreeIter iter; GtkTreeIter iter;
int column = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cell), "column")); gint column = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cell), "column"));
gtk_tree_model_get_iter (model, &iter, path); gtk_tree_model_get_iter (model, &iter, path);
@@ -249,7 +249,7 @@ cell_edited (GtkCellRendererText *cell,
{ {
case COLUMN_ITEM_NUMBER: case COLUMN_ITEM_NUMBER:
{ {
int i; gint i;
i = gtk_tree_path_get_indices (path)[0]; i = gtk_tree_path_get_indices (path)[0];
g_array_index (articles, Item, i).number = atoi (new_text); g_array_index (articles, Item, i).number = atoi (new_text);
@@ -261,8 +261,8 @@ cell_edited (GtkCellRendererText *cell,
case COLUMN_ITEM_PRODUCT: case COLUMN_ITEM_PRODUCT:
{ {
int i; gint i;
char *old_text; gchar *old_text;
gtk_tree_model_get (model, &iter, column, &old_text, -1); gtk_tree_model_get (model, &iter, column, &old_text, -1);
g_free (old_text); g_free (old_text);

View File

@@ -78,11 +78,11 @@ do_entry_completion (GtkWidget *do_widget)
gtk_window_set_resizable (GTK_WINDOW (window), FALSE); gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window); g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
gtk_widget_set_margin_start (vbox, 18); gtk_widget_set_margin_start (vbox, 5);
gtk_widget_set_margin_end (vbox, 18); gtk_widget_set_margin_end (vbox, 5);
gtk_widget_set_margin_top (vbox, 18); gtk_widget_set_margin_top (vbox, 5);
gtk_widget_set_margin_bottom (vbox, 18); gtk_widget_set_margin_bottom (vbox, 5);
gtk_window_set_child (GTK_WINDOW (window), vbox); gtk_window_set_child (GTK_WINDOW (window), vbox);
label = gtk_label_new (NULL); label = gtk_label_new (NULL);

View File

@@ -27,16 +27,16 @@ do_entry_undo (GtkWidget *do_widget)
gtk_window_set_resizable (GTK_WINDOW (window), FALSE); gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window); g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
gtk_widget_set_margin_start (vbox, 18); gtk_widget_set_margin_start (vbox, 5);
gtk_widget_set_margin_end (vbox, 18); gtk_widget_set_margin_end (vbox, 5);
gtk_widget_set_margin_top (vbox, 18); gtk_widget_set_margin_top (vbox, 5);
gtk_widget_set_margin_bottom (vbox, 18); gtk_widget_set_margin_bottom (vbox, 5);
gtk_window_set_child (GTK_WINDOW (window), vbox); gtk_window_set_child (GTK_WINDOW (window), vbox);
label = gtk_label_new (NULL); label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label), gtk_label_set_markup (GTK_LABEL (label),
"Use Control+z or Control+Shift+z to undo or redo changes"); "Use Primary+z or Primary+Shift+z to undo or redo changes");
gtk_box_append (GTK_BOX (vbox), label); gtk_box_append (GTK_BOX (vbox), label);
/* Create our entry */ /* Create our entry */

View File

@@ -1,124 +0,0 @@
/* Error States
*
* GtkLabel and GtkEntry can indicate errors if you set the .error
* style class on them.
*
* This examples shows how this can be used in a dialog for input validation.
*
* It also shows how pass callbacks and objects to GtkBuilder with
* GtkBuilderScope and gtk_builder_expose_object().
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
static void
validate_more_details (GtkEntry *entry,
GParamSpec *pspec,
GtkEntry *details)
{
if (strlen (gtk_editable_get_text (GTK_EDITABLE (entry))) > 0 &&
strlen (gtk_editable_get_text (GTK_EDITABLE (details))) == 0)
{
gtk_widget_set_tooltip_text (GTK_WIDGET (entry), "Must have details first");
gtk_widget_add_css_class (GTK_WIDGET (entry), "error");
}
else
{
gtk_widget_set_tooltip_text (GTK_WIDGET (entry), "");
gtk_widget_remove_css_class (GTK_WIDGET (entry), "error");
}
}
static gboolean
mode_switch_state_set (GtkSwitch *sw,
gboolean state,
GtkWidget *scale)
{
GtkWidget *label;
label = GTK_WIDGET (g_object_get_data (G_OBJECT (sw), "error_label"));
if (!state ||
(gtk_range_get_value (GTK_RANGE (scale)) > 50))
{
gtk_widget_hide (label);
gtk_switch_set_state (sw, state);
}
else
{
gtk_widget_show (label);
}
return TRUE;
}
static void
level_scale_value_changed (GtkRange *range,
GtkWidget *sw)
{
GtkWidget *label;
label = GTK_WIDGET (g_object_get_data (G_OBJECT (sw), "error_label"));
if (gtk_switch_get_active (GTK_SWITCH (sw)) &&
!gtk_switch_get_state (GTK_SWITCH (sw)) &&
(gtk_range_get_value (range) > 50))
{
gtk_widget_hide (label);
gtk_switch_set_state (GTK_SWITCH (sw), TRUE);
}
else if (gtk_switch_get_state (GTK_SWITCH (sw)) &&
(gtk_range_get_value (range) <= 50))
{
gtk_switch_set_state (GTK_SWITCH (sw), FALSE);
}
}
GtkWidget *
do_errorstates (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
if (!window)
{
GtkWidget *toplevel;
GtkBuilder *builder;
GtkBuilderScope *scope;
GtkWidget *sw, *label;
toplevel = GTK_WIDGET (gtk_widget_get_root (do_widget));
scope = gtk_builder_cscope_new ();
gtk_builder_cscope_add_callback_symbols (GTK_BUILDER_CSCOPE (scope),
"validate_more_details", G_CALLBACK (validate_more_details),
"mode_switch_state_set", G_CALLBACK (mode_switch_state_set),
"level_scale_value_changed", G_CALLBACK (level_scale_value_changed),
NULL);
builder = gtk_builder_new ();
gtk_builder_set_scope (builder, scope);
gtk_builder_expose_object (builder, "toplevel", G_OBJECT (toplevel));
gtk_builder_add_from_resource (builder, "/errorstates/errorstates.ui", NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "dialog"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
sw = GTK_WIDGET (gtk_builder_get_object (builder, "mode_switch"));
label = GTK_WIDGET (gtk_builder_get_object (builder, "error_label"));
g_object_set_data (G_OBJECT (sw), "error_label", label);
g_object_unref (builder);
g_object_unref (scope);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@@ -1,158 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkDialog" id="dialog">
<property name="transient-for">toplevel</property>
<property name="modal">1</property>
<property name="resizable">0</property>
<property name="use-header-bar">1</property>
<property name="title" translatable="yes">Error States</property>
<property name="hide-on-close">1</property>
<child internal-child="content_area">
<object class="GtkBox">
<child>
<object class="GtkGrid">
<property name="row-spacing">10</property>
<property name="column-spacing">10</property>
<property name="margin-start">20</property>
<property name="margin-end">20</property>
<property name="margin-top">20</property>
<property name="margin-bottom">20</property>
<child>
<object class="GtkLabel">
<property name="halign">end</property>
<property name="valign">baseline</property>
<property name="label">_Details</property>
<property name="use-underline">1</property>
<property name="mnemonic-widget">details_entry</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="column">0</property>
<property name="row">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkEntry" id="details_entry">
<property name="valign">baseline</property>
<signal name="notify::text" handler="validate_more_details" object="more_details_entry" swapped="yes"/>
<layout>
<property name="column">1</property>
<property name="row">0</property>
<property name="column-span">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="halign">end</property>
<property name="valign">baseline</property>
<property name="label">More D_etails</property>
<property name="use-underline">1</property>
<property name="mnemonic-widget">more_details_entry</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="column">0</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkEntry" id="more_details_entry">
<property name="valign">baseline</property>
<signal name="notify::text" handler="validate_more_details" object="details_entry" swapped="no"/>
<layout>
<property name="column">1</property>
<property name="row">1</property>
<property name="column-span">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="halign">end</property>
<property name="valign">baseline</property>
<property name="label">_Level</property>
<property name="use-underline">1</property>
<property name="mnemonic-widget">level_scale</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="column">0</property>
<property name="row">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkScale" id="level_scale">
<property name="valign">baseline</property>
<property name="draw-value">0</property>
<property name="adjustment">
<object class="GtkAdjustment">
<property name="upper">100</property>
<property name="lower">0</property>
<property name="value">50</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
</property>
<signal name="value-changed" handler="level_scale_value_changed" object="mode_switch" swapped="no"/>
<layout>
<property name="column">1</property>
<property name="row">2</property>
<property name="column-span">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="halign">end</property>
<property name="valign">baseline</property>
<property name="label">_Mode</property>
<property name="use-underline">1</property>
<property name="mnemonic-widget">mode_switch</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="column">0</property>
<property name="row">3</property>
</layout>
</object>
</child>
<child>
<object class="GtkSwitch" id="mode_switch">
<property name="halign">start</property>
<property name="valign">baseline</property>
<signal name="state-set" handler="mode_switch_state_set" object="level_scale" swapped="no"/>
<layout>
<property name="column">1</property>
<property name="row">3</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="error_label">
<property name="visible">0</property>
<property name="halign">start</property>
<property name="valign">baseline</property>
<property name="label">Level too low</property>
<style>
<class name="error"/>
</style>
<layout>
<property name="column">2</property>
<property name="row">3</property>
</layout>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -13,7 +13,7 @@
static GtkWidget *window = NULL; static GtkWidget *window = NULL;
static void static void
response_cb (GtkDialog *dialog, int response_id) response_cb (GtkDialog *dialog, gint response_id)
{ {
gtk_window_destroy (GTK_WINDOW (window)); gtk_window_destroy (GTK_WINDOW (window));
window = NULL; window = NULL;
@@ -35,10 +35,6 @@ do_expander (GtkWidget *do_widget)
GtkWidget *sw; GtkWidget *sw;
GtkWidget *tv; GtkWidget *tv;
GtkTextBuffer *buffer; GtkTextBuffer *buffer;
GtkTextIter start;
GtkTextIter end;
GtkTextTag *tag;
GdkPaintable *paintable;
if (!window) if (!window)
{ {
@@ -68,25 +64,12 @@ do_expander (GtkWidget *do_widget)
GTK_POLICY_NEVER, GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC); GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_propagate_natural_height (GTK_SCROLLED_WINDOW (sw), TRUE); gtk_scrolled_window_set_propagate_natural_height (GTK_SCROLLED_WINDOW (sw), TRUE);
gtk_widget_set_vexpand (sw, TRUE);
tv = gtk_text_view_new (); tv = gtk_text_view_new ();
g_object_set (tv,
"left-margin", 10,
"right-margin", 10,
"top-margin", 10,
"bottom-margin", 10,
NULL);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tv)); buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tv));
gtk_text_view_set_editable (GTK_TEXT_VIEW (tv), FALSE); gtk_text_view_set_editable (GTK_TEXT_VIEW (tv), FALSE);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (tv), FALSE);
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (tv), GTK_WRAP_WORD); gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (tv), GTK_WRAP_WORD);
gtk_text_view_set_pixels_above_lines (GTK_TEXT_VIEW (tv), 2); gtk_text_buffer_set_text (GTK_TEXT_BUFFER (buffer),
gtk_text_view_set_pixels_below_lines (GTK_TEXT_VIEW (tv), 2);
gtk_text_buffer_set_text (buffer,
"Finally, the full story with all details. " "Finally, the full story with all details. "
"And all the inside information, including " "And all the inside information, including "
"error codes, etc etc. Pages of information, " "error codes, etc etc. Pages of information, "
@@ -94,22 +77,7 @@ do_expander (GtkWidget *do_widget)
"or even resize the window - it works !\n" "or even resize the window - it works !\n"
"A second paragraph will contain even more " "A second paragraph will contain even more "
"innuendo, just to make you scroll down or " "innuendo, just to make you scroll down or "
"resize the window.\n" "resize the window. Do it already !", -1);
"Do it already!\n", -1);
gtk_text_buffer_get_end_iter (buffer, &start);
paintable = GDK_PAINTABLE (gdk_texture_new_from_resource ("/cursors/images/gtk_logo_cursor.png"));
gtk_text_buffer_insert_paintable (buffer, &start, paintable);
g_object_unref (paintable);
gtk_text_iter_backward_char (&start);
gtk_text_buffer_get_end_iter (buffer, &end);
tag = gtk_text_buffer_create_tag (buffer, NULL,
"pixels-above-lines", 200,
"justification", GTK_JUSTIFY_RIGHT,
NULL);
gtk_text_buffer_apply_tag (buffer, tag, &start, &end);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), tv); gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), tv);
gtk_expander_set_child (GTK_EXPANDER (expander), sw); gtk_expander_set_child (GTK_EXPANDER (expander), sw);
gtk_box_append (GTK_BOX (area), expander); gtk_box_append (GTK_BOX (area), expander);

View File

@@ -1,5 +1,4 @@
/* Tree View/Filter Model /* Tree View/Filter Model
* #Keywords: GtkTreeView
* *
* This example demonstrates how GtkTreeModelFilter can be used not * This example demonstrates how GtkTreeModelFilter can be used not
* just to show a subset of the rows, but also to compute columns * just to show a subset of the rows, but also to compute columns
@@ -23,8 +22,8 @@ format_number (GtkTreeViewColumn *col,
GtkTreeIter *iter, GtkTreeIter *iter,
gpointer data) gpointer data)
{ {
int num; gint num;
char *text; gchar *text;
gtk_tree_model_get (model, iter, GPOINTER_TO_INT (data), &num, -1); gtk_tree_model_get (model, iter, GPOINTER_TO_INT (data), &num, -1);
text = g_strdup_printf ("%d", num); text = g_strdup_printf ("%d", num);
@@ -36,11 +35,11 @@ static void
filter_modify_func (GtkTreeModel *model, filter_modify_func (GtkTreeModel *model,
GtkTreeIter *iter, GtkTreeIter *iter,
GValue *value, GValue *value,
int column, gint column,
gpointer data) gpointer data)
{ {
GtkTreeModelFilter *filter_model = GTK_TREE_MODEL_FILTER (model); GtkTreeModelFilter *filter_model = GTK_TREE_MODEL_FILTER (model);
int width, height; gint width, height;
GtkTreeModel *child_model; GtkTreeModel *child_model;
GtkTreeIter child_iter; GtkTreeIter child_iter;
@@ -76,7 +75,7 @@ visible_func (GtkTreeModel *model,
GtkTreeIter *iter, GtkTreeIter *iter,
gpointer data) gpointer data)
{ {
int width; gint width;
gtk_tree_model_get (model, iter, gtk_tree_model_get (model, iter,
WIDTH_COLUMN, &width, WIDTH_COLUMN, &width,

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<interface> <interface>
<requires lib="gtk+" version="3.16"/>
<object class="GtkListStore" id="liststore1"> <object class="GtkListStore" id="liststore1">
<columns> <columns>
<column type="gint"/> <column type="gint"/>
@@ -44,9 +45,12 @@
<attributes> <attributes>
<attribute name="weight" value="bold"></attribute> <attribute name="weight" value="bold"></attribute>
</attributes> </attributes>
<accessibility>
<relation type="label-for" target="treeview1"/>
</accessibility>
<layout> <layout>
<property name="column">0</property> <property name="left-attach">0</property>
<property name="row">0</property> <property name="top-attach">0</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -79,9 +83,12 @@
</child> </child>
</object> </object>
</child> </child>
<accessibility>
<relation type="labelled-by" target="label1"/>
</accessibility>
<layout> <layout>
<property name="column">0</property> <property name="left-attach">0</property>
<property name="row">1</property> <property name="top-attach">1</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -126,9 +133,12 @@
</child> </child>
</object> </object>
</child> </child>
<accessibility>
<relation type="labelled-by" target="label2"/>
</accessibility>
<layout> <layout>
<property name="column">1</property> <property name="left-attach">1</property>
<property name="row">1</property> <property name="top-attach">1</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -139,9 +149,12 @@
<attributes> <attributes>
<attribute name="weight" value="bold"></attribute> <attribute name="weight" value="bold"></attribute>
</attributes> </attributes>
<accessibility>
<relation type="label-for" target="treeview2"/>
</accessibility>
<layout> <layout>
<property name="column">1</property> <property name="left-attach">1</property>
<property name="row">0</property> <property name="top-attach">0</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -152,9 +165,12 @@
<attributes> <attributes>
<attribute name="weight" value="bold"></attribute> <attribute name="weight" value="bold"></attribute>
</attributes> </attributes>
<accessibility>
<relation type="label-for" target="treeview3"/>
</accessibility>
<layout> <layout>
<property name="column">0</property> <property name="left-attach">0</property>
<property name="row">2</property> <property name="top-attach">2</property>
</layout> </layout>
</object> </object>
</child> </child>
@@ -181,9 +197,12 @@
</child> </child>
</object> </object>
</child> </child>
<accessibility>
<relation type="labelled-by" target="label3"/>
</accessibility>
<layout> <layout>
<property name="column">0</property> <property name="left-attach">0</property>
<property name="row">3</property> <property name="top-attach">3</property>
</layout> </layout>
</object> </object>
</child> </child>

View File

@@ -9,7 +9,6 @@
#include "gtkfishbowl.h" #include "gtkfishbowl.h"
#include "gtkgears.h" #include "gtkgears.h"
#include "gskshaderpaintable.h"
const char *const css = const char *const css =
".blurred-button {" ".blurred-button {"
@@ -150,38 +149,6 @@ create_switch (void)
return w; return w;
} }
static gboolean
update_paintable (GtkWidget *widget,
GdkFrameClock *frame_clock,
gpointer user_data)
{
GskShaderPaintable *paintable;
gint64 frame_time;
paintable = GSK_SHADER_PAINTABLE (gtk_picture_get_paintable (GTK_PICTURE (widget)));
frame_time = gdk_frame_clock_get_frame_time (frame_clock);
gsk_shader_paintable_update_time (paintable, 0, frame_time);
return G_SOURCE_CONTINUE;
}
static GtkWidget *
create_cogs (void)
{
GtkWidget *picture;
static GskGLShader *cog_shader = NULL;
GdkPaintable *paintable;
if (cog_shader == NULL)
cog_shader = gsk_gl_shader_new_from_resource ("/gltransition/cogs2.glsl");
paintable = gsk_shader_paintable_new (g_object_ref (cog_shader), NULL);
picture = gtk_picture_new_for_paintable (paintable);
gtk_widget_set_size_request (picture, 150, 75);
gtk_widget_add_tick_callback (picture, update_paintable, NULL, NULL);
return picture;
}
static void static void
mapped (GtkWidget *w) mapped (GtkWidget *w)
{ {
@@ -218,7 +185,6 @@ static const struct {
{ "Gears", create_gears }, { "Gears", create_gears },
{ "Switch", create_switch }, { "Switch", create_switch },
{ "Menubutton", create_menu_button }, { "Menubutton", create_menu_button },
{ "Shader", create_cogs },
}; };
static int selected_widget_type = -1; static int selected_widget_type = -1;
@@ -243,7 +209,7 @@ set_widget_type (GtkFishbowl *fishbowl,
widget_types[selected_widget_type].name); widget_types[selected_widget_type].name);
} }
G_MODULE_EXPORT void void
fishbowl_next_button_clicked_cb (GtkButton *source, fishbowl_next_button_clicked_cb (GtkButton *source,
gpointer user_data) gpointer user_data)
{ {
@@ -258,7 +224,7 @@ fishbowl_next_button_clicked_cb (GtkButton *source,
set_widget_type (fishbowl, new_index); set_widget_type (fishbowl, new_index);
} }
G_MODULE_EXPORT void void
fishbowl_prev_button_clicked_cb (GtkButton *source, fishbowl_prev_button_clicked_cb (GtkButton *source,
gpointer user_data) gpointer user_data)
{ {
@@ -273,7 +239,7 @@ fishbowl_prev_button_clicked_cb (GtkButton *source,
set_widget_type (fishbowl, new_index); set_widget_type (fishbowl, new_index);
} }
G_MODULE_EXPORT void void
fishbowl_changes_toggled_cb (GtkToggleButton *button, fishbowl_changes_toggled_cb (GtkToggleButton *button,
gpointer user_data) gpointer user_data)
{ {
@@ -283,7 +249,7 @@ fishbowl_changes_toggled_cb (GtkToggleButton *button,
gtk_button_set_icon_name (GTK_BUTTON (button), "changes-allow"); gtk_button_set_icon_name (GTK_BUTTON (button), "changes-allow");
} }
G_MODULE_EXPORT char * char *
format_header_cb (GObject *object, format_header_cb (GObject *object,
guint count, guint count,
double fps) double fps)

View File

@@ -6,6 +6,7 @@
<property name="default-height">400</property> <property name="default-height">400</property>
<child type="titlebar"> <child type="titlebar">
<object class="GtkHeaderBar" id=""> <object class="GtkHeaderBar" id="">
<property name="show-title-buttons">1</property>
<child> <child>
<object class="GtkBox"> <object class="GtkBox">
<style> <style>
@@ -33,9 +34,6 @@
<lookup name="framerate">bowl</lookup> <lookup name="framerate">bowl</lookup>
</closure> </closure>
</binding> </binding>
<attributes>
<attribute name="font-features" value="tnum=1"/>
</attributes>
</object> </object>
</child> </child>
<child type="end"> <child type="end">

View File

@@ -1,5 +1,4 @@
/* Fixed Layout /* Fixed Layout
* #Keywords: GtkLayoutManager
* *
* GtkFixed is a container that allows placing and transforming * GtkFixed is a container that allows placing and transforming
* widgets manually. * widgets manually.

View File

@@ -29,7 +29,7 @@ draw_color (GtkDrawingArea *drawingarea,
} }
static GtkWidget * static GtkWidget *
color_swatch_new (const char *color) color_swatch_new (const gchar *color)
{ {
GtkWidget *button, *area; GtkWidget *button, *area;
@@ -48,7 +48,7 @@ do_flowbox (GtkWidget *do_widget)
{ {
static GtkWidget *window = NULL; static GtkWidget *window = NULL;
GtkWidget *scrolled, *flowbox; GtkWidget *scrolled, *flowbox;
const char *colors[] = { const gchar *colors[] = {
"AliceBlue", "AliceBlue",
"AntiqueWhite", "AntiqueWhite",
"AntiqueWhite1", "AntiqueWhite1",
@@ -716,7 +716,7 @@ do_flowbox (GtkWidget *do_widget)
"YellowGreen", "YellowGreen",
NULL NULL
}; };
int i; gint i;
if (!window) if (!window)
{ {

View File

@@ -1,11 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<interface> <interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkWindow" id="window"> <object class="GtkWindow" id="window">
<property name="default-width">600</property> <property name="default-width">600</property>
<property name="default-height">500</property> <property name="default-height">500</property>
<property name="title">Font Explorer</property> <property name="title">Font Explorer</property>
<child type="titlebar"> <child type="titlebar">
<object class="GtkHeaderBar"> <object class="GtkHeaderBar">
<property name="show-title-buttons">1</property>
<child> <child>
<object class="GtkButton" id="reset"> <object class="GtkButton" id="reset">
<property name="receives-default">1</property> <property name="receives-default">1</property>

View File

@@ -130,10 +130,6 @@ static const char *
get_feature_display_name (unsigned int tag) get_feature_display_name (unsigned int tag)
{ {
int i; int i;
static char buf[5] = { 0, };
if (tag == MAKE_TAG ('x', 'x', 'x', 'x'))
return _("Default");
for (i = 0; i < G_N_ELEMENTS (open_type_layout_features); i++) for (i = 0; i < G_N_ELEMENTS (open_type_layout_features); i++)
{ {
@@ -141,10 +137,7 @@ get_feature_display_name (unsigned int tag)
return g_dpgettext2 (NULL, "OpenType layout", open_type_layout_features[i].name); return g_dpgettext2 (NULL, "OpenType layout", open_type_layout_features[i].name);
} }
hb_tag_to_string (tag, buf); return NULL;
g_warning ("unknown OpenType layout feature tag: %s", buf);
return buf;
} }
static void update_display (void); static void update_display (void);
@@ -158,38 +151,26 @@ set_inconsistent (GtkCheckButton *button,
} }
static void static void
feat_pressed (GtkGestureClick *gesture, feat_clicked (GtkWidget *feat,
int n_press, gpointer data)
double x,
double y,
GtkWidget *feat)
{ {
const guint button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture)); g_signal_handlers_block_by_func (feat, feat_clicked, NULL);
if (button == GDK_BUTTON_PRIMARY) if (gtk_check_button_get_inconsistent (GTK_CHECK_BUTTON (feat)))
{ {
g_signal_handlers_block_by_func (feat, feat_pressed, NULL); set_inconsistent (GTK_CHECK_BUTTON (feat), FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (feat), TRUE);
if (gtk_check_button_get_inconsistent (GTK_CHECK_BUTTON (feat)))
{
set_inconsistent (GTK_CHECK_BUTTON (feat), FALSE);
gtk_check_button_set_active (GTK_CHECK_BUTTON (feat), TRUE);
}
g_signal_handlers_unblock_by_func (feat, feat_pressed, NULL);
} }
else if (button == GDK_BUTTON_SECONDARY) else if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (feat)))
{ {
gboolean inconsistent = gtk_check_button_get_inconsistent (GTK_CHECK_BUTTON (feat)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (feat), FALSE);
set_inconsistent (GTK_CHECK_BUTTON (feat), !inconsistent); }
else
{
set_inconsistent (GTK_CHECK_BUTTON (feat), TRUE);
} }
}
static void g_signal_handlers_unblock_by_func (feat, feat_clicked, NULL);
feat_toggled_cb (GtkCheckButton *check_button,
gpointer data)
{
set_inconsistent (check_button, FALSE);
} }
static void static void
@@ -220,7 +201,6 @@ add_check_group (GtkWidget *box,
unsigned int tag; unsigned int tag;
GtkWidget *feat; GtkWidget *feat;
FeatureItem *item; FeatureItem *item;
GtkGesture *gesture;
tag = hb_tag_from_string (tags[i], -1); tag = hb_tag_from_string (tags[i], -1);
@@ -229,12 +209,7 @@ add_check_group (GtkWidget *box,
g_signal_connect (feat, "notify::active", G_CALLBACK (update_display), NULL); g_signal_connect (feat, "notify::active", G_CALLBACK (update_display), NULL);
g_signal_connect (feat, "notify::inconsistent", G_CALLBACK (update_display), NULL); g_signal_connect (feat, "notify::inconsistent", G_CALLBACK (update_display), NULL);
g_signal_connect (feat, "toggled", G_CALLBACK (feat_toggled_cb), NULL); g_signal_connect (feat, "clicked", G_CALLBACK (feat_clicked), NULL);
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
g_signal_connect (gesture, "pressed", G_CALLBACK (feat_pressed), feat);
gtk_widget_add_controller (feat, GTK_EVENT_CONTROLLER (gesture));
gtk_box_append (GTK_BOX (group), feat); gtk_box_append (GTK_BOX (group), feat);
@@ -285,11 +260,10 @@ add_radio_group (GtkWidget *box,
tag = hb_tag_from_string (tags[i], -1); tag = hb_tag_from_string (tags[i], -1);
name = get_feature_display_name (tag); name = get_feature_display_name (tag);
feat = gtk_check_button_new_with_label (name ? name : _("Default")); feat = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (group_button),
name ? name : _("Default"));
if (group_button == NULL) if (group_button == NULL)
group_button = feat; group_button = feat;
else
gtk_check_button_set_group (GTK_CHECK_BUTTON (feat), GTK_CHECK_BUTTON (group_button));
g_signal_connect (feat, "notify::active", G_CALLBACK (update_display), NULL); g_signal_connect (feat, "notify::active", G_CALLBACK (update_display), NULL);
g_object_set_data (G_OBJECT (feat), "default", group_button); g_object_set_data (G_OBJECT (feat), "default", group_button);
@@ -321,7 +295,7 @@ update_display (void)
GList *l; GList *l;
PangoAttrList *attrs; PangoAttrList *attrs;
PangoAttribute *attr; PangoAttribute *attr;
int ins, bound; gint ins, bound;
guint start, end; guint start, end;
PangoLanguage *lang; PangoLanguage *lang;
char *font_desc; char *font_desc;
@@ -362,35 +336,32 @@ update_display (void)
if (!gtk_widget_is_sensitive (item->feat)) if (!gtk_widget_is_sensitive (item->feat))
continue; continue;
if (GTK_IS_CHECK_BUTTON (item->feat)) if (GTK_IS_RADIO_BUTTON (item->feat))
{ {
if (g_object_get_data (G_OBJECT (item->feat), "default")) if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (item->feat)) &&
strcmp (item->name, "xxxx") != 0)
{ {
if (gtk_check_button_get_active (GTK_CHECK_BUTTON (item->feat)) &&
strcmp (item->name, "xxxx") != 0)
{
if (has_feature)
g_string_append (s, ", ");
g_string_append (s, item->name);
g_string_append (s, " 1");
has_feature = TRUE;
}
}
else
{
if (gtk_check_button_get_inconsistent (GTK_CHECK_BUTTON (item->feat)))
continue;
if (has_feature) if (has_feature)
g_string_append (s, ", "); g_string_append (s, ", ");
g_string_append (s, item->name); g_string_append (s, item->name);
if (gtk_check_button_get_active (GTK_CHECK_BUTTON (item->feat))) g_string_append (s, " 1");
g_string_append (s, " 1");
else
g_string_append (s, " 0");
has_feature = TRUE; has_feature = TRUE;
} }
} }
else if (GTK_IS_CHECK_BUTTON (item->feat))
{
if (gtk_check_button_get_inconsistent (GTK_CHECK_BUTTON (item->feat)))
continue;
if (has_feature)
g_string_append (s, ", ");
g_string_append (s, item->name);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (item->feat)))
g_string_append (s, " 1");
else
g_string_append (s, " 0");
has_feature = TRUE;
}
} }
features = g_string_free (s, FALSE); features = g_string_free (s, FALSE);
@@ -508,7 +479,7 @@ update_script_combo (void)
{ {
GtkListStore *store; GtkListStore *store;
hb_font_t *hb_font; hb_font_t *hb_font;
int i, j, k; gint i, j, k;
PangoFont *pango_font; PangoFont *pango_font;
GHashTable *tags; GHashTable *tags;
GHashTableIter iter; GHashTableIter iter;
@@ -622,7 +593,7 @@ update_script_combo (void)
static void static void
update_features (void) update_features (void)
{ {
int i, j; gint i, j;
GtkTreeModel *model; GtkTreeModel *model;
GtkTreeIter iter; GtkTreeIter iter;
guint script_index, lang_index; guint script_index, lang_index;
@@ -636,7 +607,7 @@ update_features (void)
gtk_widget_hide (item->feat); gtk_widget_hide (item->feat);
gtk_widget_hide (gtk_widget_get_parent (item->feat)); gtk_widget_hide (gtk_widget_get_parent (item->feat));
if (strcmp (item->name, "xxxx") == 0) if (strcmp (item->name, "xxxx") == 0)
gtk_check_button_set_active (GTK_CHECK_BUTTON (item->feat), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item->feat), TRUE);
} }
/* set feature presence checks from the font features */ /* set feature presence checks from the font features */
@@ -690,17 +661,14 @@ update_features (void)
{ {
gtk_widget_show (item->feat); gtk_widget_show (item->feat);
gtk_widget_show (gtk_widget_get_parent (item->feat)); gtk_widget_show (gtk_widget_get_parent (item->feat));
if (GTK_IS_CHECK_BUTTON (item->feat)) if (GTK_IS_RADIO_BUTTON (item->feat))
{ {
GtkWidget *def = GTK_WIDGET (g_object_get_data (G_OBJECT (item->feat), "default")); GtkWidget *def = GTK_WIDGET (g_object_get_data (G_OBJECT (item->feat), "default"));
if (def) gtk_widget_show (def);
{ }
gtk_widget_show (def); else if (GTK_IS_CHECK_BUTTON (item->feat))
gtk_widget_show (gtk_widget_get_parent (def)); {
gtk_check_button_set_active (GTK_CHECK_BUTTON (def), TRUE); set_inconsistent (GTK_CHECK_BUTTON (item->feat), TRUE);
}
else
set_inconsistent (GTK_CHECK_BUTTON (item->feat), TRUE);
} }
} }
} }
@@ -722,14 +690,14 @@ update_features (void)
p = strstr (feat, buf); p = strstr (feat, buf);
if (p) if (p)
{ {
if (GTK_IS_CHECK_BUTTON (item->feat) && g_object_get_data (G_OBJECT (item->feat), "default")) if (GTK_IS_RADIO_BUTTON (item->feat))
{ {
gtk_check_button_set_active (GTK_CHECK_BUTTON (item->feat), p[6] == '1'); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item->feat), p[6] == '1');
} }
else if (GTK_IS_CHECK_BUTTON (item->feat)) else if (GTK_IS_CHECK_BUTTON (item->feat))
{ {
set_inconsistent (GTK_CHECK_BUTTON (item->feat), FALSE); set_inconsistent (GTK_CHECK_BUTTON (item->feat), FALSE);
gtk_check_button_set_active (GTK_CHECK_BUTTON (item->feat), p[6] == '1'); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item->feat), p[6] == '1');
} }
} }
} }
@@ -760,8 +728,8 @@ static void
entry_activated (GtkEntry *entry, entry_activated (GtkEntry *entry,
GtkAdjustment *adjustment) GtkAdjustment *adjustment)
{ {
double value; gdouble value;
char *err = NULL; gchar *err = NULL;
value = g_strtod (gtk_editable_get_text (GTK_EDITABLE (entry)), &err); value = g_strtod (gtk_editable_get_text (GTK_EDITABLE (entry)), &err);
if (err != NULL) if (err != NULL)
@@ -971,7 +939,7 @@ instance_changed (GtkComboBox *combo)
{ {
Axis *axis; Axis *axis;
Axis akey; Axis akey;
double value; gdouble value;
value = coords[ai[i].axis_index]; value = coords[ai[i].axis_index];
@@ -1068,6 +1036,7 @@ update_font_variations (void)
unsigned int length; unsigned int length;
int i; int i;
child = gtk_widget_get_first_child (variations_grid);
while ((child = gtk_widget_get_first_child (variations_grid))) while ((child = gtk_widget_get_first_child (variations_grid)))
gtk_grid_remove (GTK_GRID (variations_grid), child); gtk_grid_remove (GTK_GRID (variations_grid), child);
@@ -1165,15 +1134,15 @@ font_features_reset_features (void)
{ {
FeatureItem *item = l->data; FeatureItem *item = l->data;
if (GTK_IS_CHECK_BUTTON (item->feat)) if (GTK_IS_RADIO_BUTTON (item->feat))
{ {
if (strcmp (item->name, "xxxx") == 0) if (strcmp (item->name, "xxxx") == 0)
gtk_check_button_set_active (GTK_CHECK_BUTTON (item->feat), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item->feat), TRUE);
else }
{ else if (GTK_IS_CHECK_BUTTON (item->feat))
gtk_check_button_set_active (GTK_CHECK_BUTTON (item->feat), FALSE); {
set_inconsistent (GTK_CHECK_BUTTON (item->feat), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item->feat), FALSE);
} set_inconsistent (GTK_CHECK_BUTTON (item->feat), TRUE);
} }
} }
} }
@@ -1316,7 +1285,8 @@ do_font_features (GtkWidget *do_widget)
"palt", "palt",
"twid", "twid",
"qwid", NULL }); "qwid", NULL });
add_check_group (feature_list, _("Alternative Stylistic Sets"), (const char *[]){ "ss01", add_check_group (feature_list, _("Alternative Stylistic Sets"), (const char *[]){ "ss00",
"ss01",
"ss02", "ss02",
"ss03", "ss03",
"ss04", "ss04",

View File

@@ -1,574 +0,0 @@
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "config.h"
#include <gtk/gtk.h>
#include <glib/gstdio.h>
#ifdef HAVE_GIO_UNIX
#include <gio/gunixoutputstream.h>
#include <fcntl.h>
#endif
/* This is the guts of gtk_text_buffer_insert_markup,
* copied here so we can make an incremental version.
*/
static void
insert_tags_for_attributes (GtkTextBuffer *buffer,
PangoAttrIterator *iter,
GtkTextIter *start,
GtkTextIter *end)
{
GtkTextTagTable *table;
GSList *attrs, *l;
GtkTextTag *tag;
char name[256];
float fg_alpha, bg_alpha;
table = gtk_text_buffer_get_tag_table (buffer);
#define LANGUAGE_ATTR(attr_name) \
{ \
const char *language = pango_language_to_string (((PangoAttrLanguage*)attr)->value); \
g_snprintf (name, 256, "language=%s", language); \
tag = gtk_text_tag_table_lookup (table, name); \
if (!tag) \
{ \
tag = gtk_text_tag_new (name); \
g_object_set (tag, #attr_name, language, NULL); \
gtk_text_tag_table_add (table, tag); \
g_object_unref (tag); \
} \
gtk_text_buffer_apply_tag (buffer, tag, start, end); \
}
#define STRING_ATTR(attr_name) \
{ \
const char *string = ((PangoAttrString*)attr)->value; \
g_snprintf (name, 256, #attr_name "=%s", string); \
tag = gtk_text_tag_table_lookup (table, name); \
if (!tag) \
{ \
tag = gtk_text_tag_new (name); \
g_object_set (tag, #attr_name, string, NULL); \
gtk_text_tag_table_add (table, tag); \
g_object_unref (tag); \
} \
gtk_text_buffer_apply_tag (buffer, tag, start, end); \
}
#define INT_ATTR(attr_name) \
{ \
int value = ((PangoAttrInt*)attr)->value; \
g_snprintf (name, 256, #attr_name "=%d", value); \
tag = gtk_text_tag_table_lookup (table, name); \
if (!tag) \
{ \
tag = gtk_text_tag_new (name); \
g_object_set (tag, #attr_name, value, NULL); \
gtk_text_tag_table_add (table, tag); \
g_object_unref (tag); \
} \
gtk_text_buffer_apply_tag (buffer, tag, start, end); \
}
#define FONT_ATTR(attr_name) \
{ \
PangoFontDescription *desc = ((PangoAttrFontDesc*)attr)->desc; \
char *str = pango_font_description_to_string (desc); \
g_snprintf (name, 256, "font-desc=%s", str); \
g_free (str); \
tag = gtk_text_tag_table_lookup (table, name); \
if (!tag) \
{ \
tag = gtk_text_tag_new (name); \
g_object_set (tag, #attr_name, desc, NULL); \
gtk_text_tag_table_add (table, tag); \
g_object_unref (tag); \
} \
gtk_text_buffer_apply_tag (buffer, tag, start, end); \
}
#define FLOAT_ATTR(attr_name) \
{ \
float value = ((PangoAttrFloat*)attr)->value; \
g_snprintf (name, 256, #attr_name "=%g", value); \
tag = gtk_text_tag_table_lookup (table, name); \
if (!tag) \
{ \
tag = gtk_text_tag_new (name); \
g_object_set (tag, #attr_name, value, NULL); \
gtk_text_tag_table_add (table, tag); \
g_object_unref (tag); \
} \
gtk_text_buffer_apply_tag (buffer, tag, start, end); \
}
#define RGBA_ATTR(attr_name, alpha_value) \
{ \
PangoColor *color; \
GdkRGBA rgba; \
color = &((PangoAttrColor*)attr)->color; \
rgba.red = color->red / 65535.; \
rgba.green = color->green / 65535.; \
rgba.blue = color->blue / 65535.; \
rgba.alpha = alpha_value; \
char *str = gdk_rgba_to_string (&rgba); \
g_snprintf (name, 256, #attr_name "=%s", str); \
g_free (str); \
tag = gtk_text_tag_table_lookup (table, name); \
if (!tag) \
{ \
tag = gtk_text_tag_new (name); \
g_object_set (tag, #attr_name, &rgba, NULL); \
gtk_text_tag_table_add (table, tag); \
g_object_unref (tag); \
} \
gtk_text_buffer_apply_tag (buffer, tag, start, end); \
}
fg_alpha = bg_alpha = 1.;
attrs = pango_attr_iterator_get_attrs (iter);
for (l = attrs; l; l = l->next)
{
PangoAttribute *attr = l->data;
switch ((int)attr->klass->type)
{
case PANGO_ATTR_FOREGROUND_ALPHA:
fg_alpha = ((PangoAttrInt*)attr)->value / 65535.;
break;
case PANGO_ATTR_BACKGROUND_ALPHA:
bg_alpha = ((PangoAttrInt*)attr)->value / 65535.;
break;
default:
break;
}
}
for (l = attrs; l; l = l->next)
{
PangoAttribute *attr = l->data;
switch (attr->klass->type)
{
case PANGO_ATTR_LANGUAGE:
LANGUAGE_ATTR (language);
break;
case PANGO_ATTR_FAMILY:
STRING_ATTR (family);
break;
case PANGO_ATTR_STYLE:
INT_ATTR (style);
break;
case PANGO_ATTR_WEIGHT:
INT_ATTR (weight);
break;
case PANGO_ATTR_VARIANT:
INT_ATTR (variant);
break;
case PANGO_ATTR_STRETCH:
INT_ATTR (stretch);
break;
case PANGO_ATTR_SIZE:
INT_ATTR (size);
break;
case PANGO_ATTR_FONT_DESC:
FONT_ATTR (font-desc);
break;
case PANGO_ATTR_FOREGROUND:
RGBA_ATTR (foreground_rgba, fg_alpha);
break;
case PANGO_ATTR_BACKGROUND:
RGBA_ATTR (background_rgba, bg_alpha);
break;
case PANGO_ATTR_UNDERLINE:
INT_ATTR (underline);
break;
case PANGO_ATTR_UNDERLINE_COLOR:
RGBA_ATTR (underline_rgba, fg_alpha);
break;
case PANGO_ATTR_OVERLINE:
INT_ATTR (overline);
break;
case PANGO_ATTR_OVERLINE_COLOR:
RGBA_ATTR (overline_rgba, fg_alpha);
break;
case PANGO_ATTR_STRIKETHROUGH:
INT_ATTR (strikethrough);
break;
case PANGO_ATTR_STRIKETHROUGH_COLOR:
RGBA_ATTR (strikethrough_rgba, fg_alpha);
break;
case PANGO_ATTR_RISE:
INT_ATTR (rise);
break;
case PANGO_ATTR_SCALE:
FLOAT_ATTR (scale);
break;
case PANGO_ATTR_FALLBACK:
INT_ATTR (fallback);
break;
case PANGO_ATTR_LETTER_SPACING:
INT_ATTR (letter_spacing);
break;
case PANGO_ATTR_FONT_FEATURES:
STRING_ATTR (font_features);
break;
case PANGO_ATTR_ALLOW_BREAKS:
INT_ATTR (allow_breaks);
break;
case PANGO_ATTR_SHOW:
INT_ATTR (show_spaces);
break;
case PANGO_ATTR_INSERT_HYPHENS:
INT_ATTR (insert_hyphens);
break;
case PANGO_ATTR_SHAPE:
case PANGO_ATTR_ABSOLUTE_SIZE:
case PANGO_ATTR_GRAVITY:
case PANGO_ATTR_GRAVITY_HINT:
case PANGO_ATTR_FOREGROUND_ALPHA:
case PANGO_ATTR_BACKGROUND_ALPHA:
break;
case PANGO_ATTR_INVALID:
default:
g_assert_not_reached ();
break;
}
}
g_slist_free_full (attrs, (GDestroyNotify)pango_attribute_destroy);
#undef LANGUAGE_ATTR
#undef STRING_ATTR
#undef INT_ATTR
#undef FONT_ATTR
#undef FLOAT_ATTR
#undef RGBA_ATTR
}
typedef struct
{
GMarkupParseContext *parser;
char *markup;
gsize pos;
gsize len;
GtkTextBuffer *buffer;
GtkTextIter iter;
GtkTextMark *mark;
PangoAttrList *attributes;
char *text;
PangoAttrIterator *attr;
} MarkupData;
static void
free_markup_data (MarkupData *mdata)
{
g_free (mdata->markup);
g_clear_pointer (&mdata->parser, g_markup_parse_context_free);
gtk_text_buffer_delete_mark (mdata->buffer, mdata->mark);
g_clear_pointer (&mdata->attr, pango_attr_iterator_destroy);
g_clear_pointer (&mdata->attributes, pango_attr_list_unref);
g_free (mdata->text);
g_object_unref (mdata->buffer);
g_free (mdata);
}
static gboolean
insert_markup_idle (gpointer data)
{
MarkupData *mdata = data;
gint64 begin;
begin = g_get_monotonic_time ();
do
{
int start, end;
int start_offset;
GtkTextIter start_iter;
if (g_get_monotonic_time () - begin > G_TIME_SPAN_MILLISECOND)
{
g_idle_add (insert_markup_idle, data);
return G_SOURCE_REMOVE;
}
pango_attr_iterator_range (mdata->attr, &start, &end);
if (end == G_MAXINT) /* last chunk */
end = start - 1; /* resulting in -1 to be passed to _insert */
start_offset = gtk_text_iter_get_offset (&mdata->iter);
gtk_text_buffer_insert (mdata->buffer, &mdata->iter, mdata->text + start, end - start);
gtk_text_buffer_get_iter_at_offset (mdata->buffer, &start_iter, start_offset);
insert_tags_for_attributes (mdata->buffer, mdata->attr, &start_iter, &mdata->iter);
gtk_text_buffer_get_iter_at_mark (mdata->buffer, &mdata->iter, mdata->mark);
}
while (pango_attr_iterator_next (mdata->attr));
free_markup_data (mdata);
return G_SOURCE_REMOVE;
}
static gboolean
parse_markup_idle (gpointer data)
{
MarkupData *mdata = data;
gint64 begin;
GError *error = NULL;
begin = g_get_monotonic_time ();
do {
if (g_get_monotonic_time () - begin > G_TIME_SPAN_MILLISECOND)
{
g_idle_add (parse_markup_idle, data);
return G_SOURCE_REMOVE;
}
if (!g_markup_parse_context_parse (mdata->parser,
mdata->markup + mdata->pos,
MIN (4096, mdata->len - mdata->pos),
&error))
{
g_warning ("Invalid markup string: %s", error->message);
g_error_free (error);
free_markup_data (mdata);
return G_SOURCE_REMOVE;
}
mdata->pos += 4096;
} while (mdata->pos < mdata->len);
if (!pango_markup_parser_finish (mdata->parser,
&mdata->attributes,
&mdata->text,
NULL,
&error))
{
g_warning ("Invalid markup string: %s", error->message);
g_error_free (error);
free_markup_data (mdata);
return G_SOURCE_REMOVE;
}
if (!mdata->attributes)
{
gtk_text_buffer_insert (mdata->buffer, &mdata->iter, mdata->text, -1);
free_markup_data (mdata);
return G_SOURCE_REMOVE;
}
mdata->attr = pango_attr_list_get_iterator (mdata->attributes);
insert_markup_idle (data);
return G_SOURCE_REMOVE;
}
/* Takes a ref on @buffer while it is operating,
* and consumes @markup.
*/
static void
insert_markup (GtkTextBuffer *buffer,
GtkTextIter *iter,
char *markup,
int len)
{
MarkupData *data;
g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));
data = g_new0 (MarkupData, 1);
data->buffer = g_object_ref (buffer);
data->iter = *iter;
data->markup = markup;
data->len = len;
data->parser = pango_markup_parser_new (0);
data->pos = 0;
/* create mark with right gravity */
data->mark = gtk_text_buffer_create_mark (buffer, NULL, iter, FALSE);
parse_markup_idle (data);
}
static void
fontify_finish (GObject *source,
GAsyncResult *result,
gpointer data)
{
GSubprocess *subprocess = G_SUBPROCESS (source);
GtkTextBuffer *buffer = data;
GBytes *stdout_buf = NULL;
GBytes *stderr_buf = NULL;
GError *error = NULL;
if (!g_subprocess_communicate_finish (subprocess,
result,
&stdout_buf,
&stderr_buf,
&error))
{
g_clear_pointer (&stdout_buf, g_bytes_unref);
g_clear_pointer (&stderr_buf, g_bytes_unref);
g_warning ("%s", error->message);
g_clear_error (&error);
g_object_unref (subprocess);
g_object_unref (buffer);
return;
}
if (g_subprocess_get_exit_status (subprocess) != 0)
{
if (stderr_buf)
g_warning ("%s", (char *)g_bytes_get_data (stderr_buf, NULL));
g_clear_pointer (&stderr_buf, g_bytes_unref);
}
g_object_unref (subprocess);
g_clear_pointer (&stderr_buf, g_bytes_unref);
if (stdout_buf)
{
char *markup;
gsize len;
char *p;
GtkTextIter start;
gtk_text_buffer_set_text (buffer, "", 0);
/* highlight puts a span with font and size around its output,
* which we don't want.
*/
markup = g_bytes_unref_to_data (stdout_buf, &len);
for (p = markup + strlen ("<span "); *p != '>'; p++) *p = ' ';
gtk_text_buffer_get_start_iter (buffer, &start);
insert_markup (buffer, &start, markup, len);
}
g_object_unref (buffer);
}
void
fontify (const char *format,
GtkTextBuffer *source_buffer)
{
GSubprocess *subprocess;
char *format_arg;
GtkSettings *settings;
char *theme;
gboolean prefer_dark;
const char *style_arg;
char *text;
GtkTextIter start, end;
GBytes *bytes;
GError *error = NULL;
settings = gtk_settings_get_default ();
g_object_get (settings,
"gtk-theme-name", &theme,
"gtk-application-prefer-dark-theme", &prefer_dark,
NULL);
if (prefer_dark || strcmp (theme, "HighContrastInverse") == 0)
style_arg = "--style=edit-vim-dark";
else
style_arg = "--style=edit-kwrite";
g_free (theme);
format_arg = g_strconcat ("--syntax=", format, NULL);
subprocess = g_subprocess_new (G_SUBPROCESS_FLAGS_STDIN_PIPE |
G_SUBPROCESS_FLAGS_STDOUT_PIPE |
G_SUBPROCESS_FLAGS_STDERR_PIPE,
&error,
"highlight",
format_arg,
"--out-format=pango",
style_arg,
NULL);
g_free (format_arg);
if (!subprocess)
{
if (g_error_matches (error, G_SPAWN_ERROR, G_SPAWN_ERROR_NOENT))
{
static gboolean warned = FALSE;
if (!warned)
{
warned = TRUE;
g_message ("For syntax highlighting, install the “highlight” program");
}
}
else
g_warning ("%s", error->message);
g_clear_error (&error);
return;
}
gtk_text_buffer_get_bounds (source_buffer, &start, &end);
text = gtk_text_buffer_get_text (source_buffer, &start, &end, TRUE);
bytes = g_bytes_new_take (text, strlen (text));
#ifdef HAVE_GIO_UNIX
/* Work around https://gitlab.gnome.org/GNOME/glib/-/issues/2182 */
if (G_IS_UNIX_OUTPUT_STREAM (g_subprocess_get_stdin_pipe (subprocess)))
{
GOutputStream *stdin_pipe = g_subprocess_get_stdin_pipe (subprocess);
int fd = g_unix_output_stream_get_fd (G_UNIX_OUTPUT_STREAM (stdin_pipe));
fcntl (fd, F_SETFL, O_NONBLOCK);
}
#endif
g_subprocess_communicate_async (subprocess,
bytes,
NULL,
fontify_finish,
g_object_ref (source_buffer));
g_bytes_unref (bytes);
}

View File

@@ -1,6 +0,0 @@
#pragma once
#include <gtk/gtk.h>
void fontify (const char *format,
GtkTextBuffer *buffer);

View File

@@ -36,11 +36,11 @@ adjustment_get_normalized_value (GtkAdjustment *adj)
static void static void
val_to_xy (GtkFontPlane *plane, val_to_xy (GtkFontPlane *plane,
int *x, gint *x,
int *y) gint *y)
{ {
double u, v; gdouble u, v;
int width, height; gint width, height;
width = gtk_widget_get_allocated_width (GTK_WIDGET (plane)); width = gtk_widget_get_allocated_width (GTK_WIDGET (plane));
height = gtk_widget_get_allocated_height (GTK_WIDGET (plane)); height = gtk_widget_get_allocated_height (GTK_WIDGET (plane));
@@ -57,8 +57,8 @@ plane_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot) GtkSnapshot *snapshot)
{ {
GtkFontPlane *plane = GTK_FONT_PLANE (widget); GtkFontPlane *plane = GTK_FONT_PLANE (widget);
int x, y; gint x, y;
int width, height; gint width, height;
cairo_t *cr; cairo_t *cr;
val_to_xy (plane, &x, &y); val_to_xy (plane, &x, &y);
@@ -125,11 +125,11 @@ adjustment_set_normalized_value (GtkAdjustment *adj,
static void static void
update_value (GtkFontPlane *plane, update_value (GtkFontPlane *plane,
int x, gint x,
int y) gint y)
{ {
GtkWidget *widget = GTK_WIDGET (plane); GtkWidget *widget = GTK_WIDGET (plane);
double u, v; gdouble u, v;
u = CLAMP (x * (1.0 / gtk_widget_get_allocated_width (widget)), 0, 1); u = CLAMP (x * (1.0 / gtk_widget_get_allocated_width (widget)), 0, 1);
v = CLAMP (1 - y * (1.0 / gtk_widget_get_allocated_height (widget)), 0, 1); v = CLAMP (1 - y * (1.0 / gtk_widget_get_allocated_height (widget)), 0, 1);
@@ -142,8 +142,8 @@ update_value (GtkFontPlane *plane,
static void static void
plane_drag_gesture_begin (GtkGestureDrag *gesture, plane_drag_gesture_begin (GtkGestureDrag *gesture,
double start_x, gdouble start_x,
double start_y, gdouble start_y,
GtkFontPlane *plane) GtkFontPlane *plane)
{ {
guint button; guint button;
@@ -164,11 +164,11 @@ plane_drag_gesture_begin (GtkGestureDrag *gesture,
static void static void
plane_drag_gesture_update (GtkGestureDrag *gesture, plane_drag_gesture_update (GtkGestureDrag *gesture,
double offset_x, gdouble offset_x,
double offset_y, gdouble offset_y,
GtkFontPlane *plane) GtkFontPlane *plane)
{ {
double start_x, start_y; gdouble start_x, start_y;
gtk_gesture_drag_get_start_point (GTK_GESTURE_DRAG (gesture), gtk_gesture_drag_get_start_point (GTK_GESTURE_DRAG (gesture),
&start_x, &start_y); &start_x, &start_y);
@@ -177,8 +177,8 @@ plane_drag_gesture_update (GtkGestureDrag *gesture,
static void static void
plane_drag_gesture_end (GtkGestureDrag *gesture, plane_drag_gesture_end (GtkGestureDrag *gesture,
double offset_x, gdouble offset_x,
double offset_y, gdouble offset_y,
GtkFontPlane *plane) GtkFontPlane *plane)
{ {
set_cross_cursor (GTK_WIDGET (plane), FALSE); set_cross_cursor (GTK_WIDGET (plane), FALSE);

View File

@@ -1,4 +1,4 @@
/* Pango/Font Rendering /* Pango/Font rendering
* *
* Demonstrates various aspects of font rendering. * Demonstrates various aspects of font rendering.
*/ */
@@ -19,7 +19,13 @@ static GtkWidget *show_extents = NULL;
static PangoContext *context; static PangoContext *context;
static int scale = 9; static int scale = 10;
static void
on_destroy (gpointer data)
{
window = NULL;
}
static void static void
update_image (void) update_image (void)
@@ -59,7 +65,7 @@ update_image (void)
hintstyle = CAIRO_HINT_STYLE_DEFAULT; hintstyle = CAIRO_HINT_STYLE_DEFAULT;
cairo_font_options_set_hint_style (fopt, hintstyle); cairo_font_options_set_hint_style (fopt, hintstyle);
if (gtk_check_button_get_active (GTK_CHECK_BUTTON (hint_metrics))) if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (hint_metrics)))
hintmetrics = CAIRO_HINT_METRICS_ON; hintmetrics = CAIRO_HINT_METRICS_ON;
else else
hintmetrics = CAIRO_HINT_METRICS_OFF; hintmetrics = CAIRO_HINT_METRICS_OFF;
@@ -107,7 +113,7 @@ update_image (void)
cr = cairo_create (surface); cr = cairo_create (surface);
cairo_set_line_width (cr, 1); cairo_set_line_width (cr, 1);
if (gtk_check_button_get_active (GTK_CHECK_BUTTON (show_grid))) if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (show_grid)))
{ {
int i; int i;
cairo_set_source_rgba (cr, 0.2, 0, 0, 0.2); cairo_set_source_rgba (cr, 0.2, 0, 0, 0.2);
@@ -125,7 +131,7 @@ update_image (void)
} }
} }
if (gtk_check_button_get_active (GTK_CHECK_BUTTON (show_extents))) if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (show_extents)))
{ {
cairo_set_source_rgba (cr, 0, 0, 1, 1); cairo_set_source_rgba (cr, 0, 0, 1, 1);
@@ -245,7 +251,9 @@ do_fontrendering (GtkWidget *do_widget)
window = GTK_WIDGET (gtk_builder_get_object (builder, "window")); window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
gtk_window_set_display (GTK_WINDOW (window), gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget)); gtk_widget_get_display (do_widget));
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window); g_signal_connect (window, "destroy",
G_CALLBACK (on_destroy), NULL);
g_object_set_data_full (G_OBJECT (window), "builder", builder, g_object_unref);
font_button = GTK_WIDGET (gtk_builder_get_object (builder, "font_button")); font_button = GTK_WIDGET (gtk_builder_get_object (builder, "font_button"));
up_button = GTK_WIDGET (gtk_builder_get_object (builder, "up_button")); up_button = GTK_WIDGET (gtk_builder_get_object (builder, "up_button"));
down_button = GTK_WIDGET (gtk_builder_get_object (builder, "down_button")); down_button = GTK_WIDGET (gtk_builder_get_object (builder, "down_button"));
@@ -268,8 +276,6 @@ do_fontrendering (GtkWidget *do_widget)
g_signal_connect (show_extents, "notify::active", G_CALLBACK (update_image), NULL); g_signal_connect (show_extents, "notify::active", G_CALLBACK (update_image), NULL);
update_image (); update_image ();
g_object_unref (builder);
} }
if (!gtk_widget_get_visible (window)) if (!gtk_widget_get_visible (window))

View File

@@ -6,11 +6,164 @@
<property name="page-increment">4</property> <property name="page-increment">4</property>
</object> </object>
<object class="GtkWindow" id="window"> <object class="GtkWindow" id="window">
<property name="default-width">1080</property> <property name="default-width">600</property>
<property name="default-height">430</property> <property name="default-height">300</property>
<child type="titlebar"> <property name="title">Font rendering</property>
<object class="GtkHeaderBar"> <child>
<child type="title"> <object class="GtkGrid">
<property name="margin-top">10</property>
<property name="row-spacing">10</property>
<property name="column-spacing">10</property>
<child>
<object class="GtkLabel">
<property name="margin-start">10</property>
<property name="label">Text</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
<child>
<object class="GtkEntry" id="entry">
<property name="text">Fonts render</property>
<layout>
<property name="left-attach">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="margin-start">10</property>
<property name="label">Font</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkFontButton" id="font_button">
<layout>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Hinting</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="left-attach">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkComboBoxText" id="hinting">
<property name="active">0</property>
<property name="valign">center</property>
<items>
<item translatable="yes" id="none">None</item>
<item translatable="yes" id="slight">Slight</item>
<item translatable="yes" id="medium">Medium</item>
<item translatable="yes" id="full">Full</item>
</items>
<layout>
<property name="left-attach">3</property>
</layout>
</object>
</child>
<child>
<object class="GtkCheckButton" id="hint_metrics">
<child>
<object class="GtkLabel">
<property name="label">Hint Metrics</property>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
<layout>
<property name="left-attach">3</property>
<property name="top-attach">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkCheckButton" id="show_extents">
<property name="active">1</property>
<child>
<object class="GtkLabel">
<property name="label">Show Extents</property>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
<layout>
<property name="left-attach">4</property>
<property name="top-attach">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkCheckButton" id="show_grid">
<property name="active">1</property>
<child>
<object class="GtkLabel">
<property name="label">Show Grid</property>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
<layout>
<property name="left-attach">4</property>
<property name="top-attach">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkButton" id="up_button">
<property name="icon-name">list-add-symbolic</property>
<style>
<class name="circular"/>
</style>
<layout>
<property name="left-attach">5</property>
<property name="top-attach">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkButton" id="down_button">
<property name="icon-name">list-remove-symbolic</property>
<style>
<class name="circular"/>
</style>
<layout>
<property name="left-attach">5</property>
<property name="top-attach">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="hexpand">1</property>
<layout>
<property name="left-attach">6</property>
</layout>
</object>
</child>
<child>
<object class="GtkBox"> <object class="GtkBox">
<property name="halign">center</property> <property name="halign">center</property>
<property name="valign">center</property> <property name="valign">center</property>
@@ -18,170 +171,29 @@
<class name="linked"/> <class name="linked"/>
</style> </style>
<child> <child>
<object class="GtkToggleButton" id="text_radio"> <object class="GtkRadioButton" id="text_radio">
<property name="draw-indicator">0</property>
<property name="label">Text</property> <property name="label">Text</property>
<property name="active">1</property>
</object> </object>
</child> </child>
<child> <child>
<object class="GtkToggleButton" id="grid_radio"> <object class="GtkRadioButton" id="grid_radio">
<property name="draw-indicator">0</property>
<property name="label">Grid</property> <property name="label">Grid</property>
<property name="group">text_radio</property> <property name="group">text_radio</property>
</object> </object>
</child> </child>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
<property name="column-span">7</property>
</layout>
</object> </object>
</child> </child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkGrid">
<property name="halign">center</property>
<property name="margin-top">10</property>
<property name="margin-bottom">10</property>
<property name="row-spacing">10</property>
<property name="column-spacing">10</property>
<child>
<object class="GtkLabel">
<property name="margin-start">10</property>
<property name="label">Text</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="column">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkEntry" id="entry">
<property name="text">Fonts render</property>
<layout>
<property name="column">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="margin-start">10</property>
<property name="label">Font</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="column">1</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkFontButton" id="font_button">
<layout>
<property name="column">2</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Hinting</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="column">3</property>
</layout>
</object>
</child>
<child>
<object class="GtkComboBoxText" id="hinting">
<property name="active">0</property>
<property name="valign">center</property>
<items>
<item translatable="yes" id="none">None</item>
<item translatable="yes" id="slight">Slight</item>
<item translatable="yes" id="medium">Medium</item>
<item translatable="yes" id="full">Full</item>
</items>
<layout>
<property name="column">4</property>
</layout>
</object>
</child>
<child>
<object class="GtkCheckButton" id="hint_metrics">
<property name="label">Hint Metrics</property>
<layout>
<property name="column">4</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkCheckButton" id="show_extents">
<property name="label">Show Extents</property>
<property name="active">1</property>
<layout>
<property name="column">5</property>
<property name="row">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkCheckButton" id="show_grid">
<property name="active">1</property>
<property name="label">Show Grid</property>
<layout>
<property name="column">5</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkButton" id="up_button">
<property name="icon-name">list-add-symbolic</property>
<style>
<class name="circular"/>
</style>
<layout>
<property name="column">6</property>
<property name="row">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkButton" id="down_button">
<property name="icon-name">list-remove-symbolic</property>
<style>
<class name="circular"/>
</style>
<layout>
<property name="column">6</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="hexpand">1</property>
<layout>
<property name="column">7</property>
</layout>
</object>
</child>
</object>
</child>
<child>
<object class="GtkSeparator"/>
</child>
<child> <child>
<object class="GtkScrolledWindow"> <object class="GtkScrolledWindow">
<property name="propagate-natural-height">1</property> <property name="propagate-natural-height">1</property>
<property name="has-frame">1</property>
<property name="hexpand">1</property> <property name="hexpand">1</property>
<property name="vexpand">1</property> <property name="vexpand">1</property>
<child> <child>
@@ -191,6 +203,11 @@
<property name="can-shrink">0</property> <property name="can-shrink">0</property>
</object> </object>
</child> </child>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">4</property>
<property name="column-span">7</property>
</layout>
</object> </object>
</child> </child>
</object> </object>

View File

@@ -1,94 +0,0 @@
#include "four_point_transform.h"
#include "singular_value_decomposition.h"
/* Make a 4x4 matrix that maps
* e1 -> p1
* e2 -> p3
* e3 -> p3
* (1,1,1,0) -> p4
*/
static void
unit_to (graphene_point3d_t *p1,
graphene_point3d_t *p2,
graphene_point3d_t *p3,
graphene_point3d_t *p4,
graphene_matrix_t *m)
{
graphene_vec3_t v1, v2, v3, v4;
graphene_vec4_t vv1, vv2, vv3, vv4, p;
graphene_matrix_t u, s;
float v[16] = { 0., };
double A[16];
double U[16];
double S[4];
double V[16];
double B[4];
double x[4];
int i, j;
graphene_point3d_to_vec3 (p1, &v1);
graphene_point3d_to_vec3 (p2, &v2);
graphene_point3d_to_vec3 (p3, &v3);
graphene_point3d_to_vec3 (p4, &v4);
graphene_vec4_init_from_vec3 (&vv1, &v1, 1.);
graphene_vec4_init_from_vec3 (&vv2, &v2, 1.);
graphene_vec4_init_from_vec3 (&vv3, &v3, 1.);
graphene_vec4_init_from_vec3 (&vv4, &v4, 1.);
graphene_vec4_init (&p, 0., 0., 0., 1.);
graphene_matrix_init_from_vec4 (&u, &vv1, &vv2, &vv3, &p);
/* solve x * u = vv4 */
for (i = 0; i < 4; i++)
for (j = 0; j < 4; j++)
A[j * 4 + i] = graphene_matrix_get_value (&u, i, j);
B[0] = graphene_vec4_get_x (&vv4);
B[1] = graphene_vec4_get_y (&vv4);
B[2] = graphene_vec4_get_z (&vv4);
B[3] = graphene_vec4_get_w (&vv4);
singular_value_decomposition (A, 4, 4, U, S, V);
singular_value_decomposition_solve (U, S, V, 4, 4, B, x);
v[ 0] = x[0];
v[ 5] = x[1];
v[10] = x[2];
v[15] = 1;
graphene_matrix_init_from_float (&s, (const float *)&v);
graphene_matrix_multiply (&s, &u, m);
}
/* Compute a 4x4 matrix m that maps
* p1 -> q1
* p2 -> q2
* p3 -> q3
* p4 -> q4
*
* This is not in general possible, because projective
* transforms preserve coplanarity. But in the cases we
* care about here, both sets of points are always coplanar.
*/
void
perspective_3d (graphene_point3d_t *p1,
graphene_point3d_t *p2,
graphene_point3d_t *p3,
graphene_point3d_t *p4,
graphene_point3d_t *q1,
graphene_point3d_t *q2,
graphene_point3d_t *q3,
graphene_point3d_t *q4,
graphene_matrix_t *m)
{
graphene_matrix_t a, a_inv, b;
unit_to (p1, p2, p3, p4, &a);
unit_to (q1, q2, q3, q4, &b);
graphene_matrix_inverse (&a, &a_inv);
graphene_matrix_multiply (&a_inv, &b, m);
}

View File

@@ -1,13 +0,0 @@
#pragma once
#include <graphene.h>
void perspective_3d (graphene_point3d_t *p1,
graphene_point3d_t *p2,
graphene_point3d_t *p3,
graphene_point3d_t *p4,
graphene_point3d_t *q1,
graphene_point3d_t *q2,
graphene_point3d_t *q3,
graphene_point3d_t *q4,
graphene_matrix_t *m);

View File

@@ -6,22 +6,6 @@ import re
import os import os
from collections import * from collections import *
def add_quotes(s):
return "\"" + s.lower() + "\""
def wordify(s):
return s.strip().rstrip(".,;:")
def is_keyword(s):
if s == "GTK":
return False
elif s.startswith(("Gtk", "Gdk", "Pango")):
return True
elif s.startswith("G") and s[1].isupper():
return True
else:
return False
out_file = sys.argv[1] out_file = sys.argv[1]
in_files = sys.argv[2:] in_files = sys.argv[2:]
@@ -35,14 +19,13 @@ struct _DemoData
{ {
const char *name; const char *name;
const char *title; const char *title;
const char **keywords;
const char *filename; const char *filename;
GDoDemoFunc func; GDoDemoFunc func;
DemoData *children; DemoData *children;
}; };
""" """
# Demo = namedtuple('Demo', ['name', 'title', 'keywords', 'file', 'func']) # Demo = namedtuple('Demo', ['name', 'title', 'file', 'func'])
demos = [] demos = []
@@ -51,17 +34,14 @@ for demo_file in in_files:
demo_name = filename.replace(".c", "") demo_name = filename.replace(".c", "")
with open(demo_file, 'r', encoding='utf-8') as f: with open(demo_file, 'r', encoding='utf-8') as f:
title = f.readline().replace("/*", "").strip() title = f.readline().replace("/*", "").strip()
keywords = set()
line = f.readline().strip();
while not line.endswith('*/'):
if line.startswith("* #Keywords:"):
keywords = keywords.union(set(map(wordify, line.replace ("* #Keywords:", "").strip().split(","))))
else:
keywords = keywords.union(set(filter(is_keyword, map(wordify, line.replace ("* ", "").split()))))
line = f.readline().strip()
file_output += "GtkWidget *do_" + demo_name + " (GtkWidget *do_widget);\n" file_output += "GtkWidget *do_" + demo_name + " (GtkWidget *do_widget);\n"
demos.append((demo_name, title, keywords, filename, "do_" + demo_name, -1)) # demos += Demo(name = demo_name,
# title = title,
# file = demo_file,
# func = "do_" + title)
demos.append((demo_name, title, filename, "do_" + demo_name, -1))
# Generate a List of "Parent names" # Generate a List of "Parent names"
parents = [] parents = []
@@ -77,7 +57,7 @@ for demo in demos:
if not parent_name in parents: if not parent_name in parents:
parents.append(parent_name) parents.append(parent_name)
parent_ids.append(parent_index) parent_ids.append(parent_index)
demos.append(("NULL", parent_name, set(), "NULL", "NULL", parent_index)) demos.append(("NULL", parent_name, "NULL", "NULL", parent_index))
parent_index = parent_index + 1 parent_index = parent_index + 1
@@ -91,7 +71,8 @@ for parent in parents:
for child in demos: for child in demos:
if child[1].startswith(parent + "/"): if child[1].startswith(parent + "/"):
title = child[1][child[1].rfind('/') + 1:] title = child[1][child[1].rfind('/') + 1:]
file_output += " { \"" + child[0] + "\", \"" + title + "\", " + "(const char*[]) {" + ", ".join(list(map(add_quotes, child[2])) + ["NULL"]) + " }, \"" + child[3] + "\", " + child[4] + ", NULL },\n" file_output += " { \"" + child[0] + "\", \"" + title + "\", \"" + child[2] + "\", " + child[3] + ", NULL },\n"
file_output += " { NULL }\n};\n" file_output += " { NULL }\n};\n"
i = i + 1 i = i + 1
@@ -105,10 +86,9 @@ for demo in demos:
# Do not generate one of these for demos with a parent demo # Do not generate one of these for demos with a parent demo
if "/" not in demo[1]: if "/" not in demo[1]:
child_array = "NULL" child_array = "NULL"
name = demo[0] name = demo[0];
title = demo[1] title = demo[1];
keywords = demo[2] file = demo[2]
file = demo[3]
if name != "NULL": if name != "NULL":
name = "\"" + name + "\"" name = "\"" + name + "\""
if title != "NULL": if title != "NULL":
@@ -116,9 +96,9 @@ for demo in demos:
if file != "NULL": if file != "NULL":
file = "\"" + file + "\"" file = "\"" + file + "\""
if demo[5] != -1: if demo[4] != -1:
child_array = "child" + str(demo[5]) child_array = "child" + str(demo[4])
file_output += " { " + name + ", " + title + ", " + "(const char*[]) {" + ", ".join(list(map(add_quotes, keywords)) + ["NULL"]) + " }, " + file + ", " + demo[4] + ", " + child_array + " },\n" file_output += " { " + name + ", " + title + ", " + file + ", " + demo[3] + ", " + child_array + " },\n"
file_output += " { NULL }\n};\n" file_output += " { NULL }\n};\n"

View File

@@ -1,5 +1,4 @@
/* Gestures /* Gestures
* #Keywords: GtkGesture
* *
* Perform gestures on touchscreens and other input devices. This * Perform gestures on touchscreens and other input devices. This
* demo reacts to long presses and swipes from all devices, plus * demo reacts to long presses and swipes from all devices, plus
@@ -10,8 +9,8 @@
static GtkGesture *rotate = NULL; static GtkGesture *rotate = NULL;
static GtkGesture *zoom = NULL; static GtkGesture *zoom = NULL;
static double swipe_x = 0; static gdouble swipe_x = 0;
static double swipe_y = 0; static gdouble swipe_y = 0;
static gboolean long_pressed = FALSE; static gboolean long_pressed = FALSE;
static gboolean static gboolean
@@ -27,8 +26,8 @@ touchpad_swipe_gesture_begin (GtkGesture *gesture,
static void static void
swipe_gesture_swept (GtkGestureSwipe *gesture, swipe_gesture_swept (GtkGestureSwipe *gesture,
double velocity_x, gdouble velocity_x,
double velocity_y, gdouble velocity_y,
GtkWidget *widget) GtkWidget *widget)
{ {
swipe_x = velocity_x / 10; swipe_x = velocity_x / 10;
@@ -38,8 +37,8 @@ swipe_gesture_swept (GtkGestureSwipe *gesture,
static void static void
long_press_gesture_pressed (GtkGestureLongPress *gesture, long_press_gesture_pressed (GtkGestureLongPress *gesture,
double x, gdouble x,
double y, gdouble y,
GtkWidget *widget) GtkWidget *widget)
{ {
long_pressed = TRUE; long_pressed = TRUE;
@@ -57,8 +56,8 @@ long_press_gesture_end (GtkGesture *gesture,
static void static void
rotation_angle_changed (GtkGestureRotate *gesture, rotation_angle_changed (GtkGestureRotate *gesture,
double angle, gdouble angle,
double delta, gdouble delta,
GtkWidget *widget) GtkWidget *widget)
{ {
gtk_widget_queue_draw (widget); gtk_widget_queue_draw (widget);
@@ -66,7 +65,7 @@ rotation_angle_changed (GtkGestureRotate *gesture,
static void static void
zoom_scale_changed (GtkGestureZoom *gesture, zoom_scale_changed (GtkGestureZoom *gesture,
double scale, gdouble scale,
GtkWidget *widget) GtkWidget *widget)
{ {
gtk_widget_queue_draw (widget); gtk_widget_queue_draw (widget);
@@ -94,8 +93,8 @@ drawing_area_draw (GtkDrawingArea *area,
{ {
cairo_pattern_t *pat; cairo_pattern_t *pat;
cairo_matrix_t matrix; cairo_matrix_t matrix;
double angle, scale; gdouble angle, scale;
double x_center, y_center; gdouble x_center, y_center;
gtk_gesture_get_bounding_box_center (GTK_GESTURE (zoom), &x_center, &y_center); gtk_gesture_get_bounding_box_center (GTK_GESTURE (zoom), &x_center, &y_center);

View File

@@ -1,7 +1,7 @@
precision highp float; precision highp float;
void main() { void main() {
float lerpVal = gl_FragCoord.y / 500.0; float lerpVal = gl_FragCoord.y / 500.0f;
gl_FragColor = mix(vec4(1.0, 0.85, 0.35, 1.0), vec4(0.2, 0.2, 0.2, 1.0), lerpVal); gl_FragColor = mix(vec4(1.0f, 0.85f, 0.35f, 1.0f), vec4(0.2f, 0.2f, 0.2f, 1.0f), lerpVal);
} }

View File

@@ -406,7 +406,6 @@ create_glarea_window (GtkWidget *do_widget)
gl_area = gtk_gl_area_new (); gl_area = gtk_gl_area_new ();
gtk_widget_set_hexpand (gl_area, TRUE); gtk_widget_set_hexpand (gl_area, TRUE);
gtk_widget_set_vexpand (gl_area, TRUE); gtk_widget_set_vexpand (gl_area, TRUE);
gtk_widget_set_size_request (gl_area, 100, 200);
gtk_box_append (GTK_BOX (box), gl_area); gtk_box_append (GTK_BOX (box), gl_area);
/* We need to initialize and free GL resources, so we use /* We need to initialize and free GL resources, so we use

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