Compare commits

..

12 Commits

Author SHA1 Message Date
Benjamin Otte
4cbce9ca23 display: Remove unused x/y/w/h form create_surface() vfunc 2021-03-31 04:21:32 +02:00
Benjamin Otte
51e7335cb7 macos: Use GdkSurface's scale factor 2021-03-31 04:14:16 +02:00
Benjamin Otte
be0535b3db broadway: Use scale factor of GdkSurface 2021-03-31 04:14:16 +02:00
Benjamin Otte
80cc453071 x11: Use GdkSurface's scale factor 2021-03-31 04:14:16 +02:00
Benjamin Otte
180626b697 surface: Add a private struct
... and put the (so far unused) scale factor there.
2021-03-31 04:14:16 +02:00
Benjamin Otte
76b4fff03d surface: Make gdk_surface_update_size() update the size
Only if the size changed of course.

Return a boolean to the backend indicating if it actually did so.

For now, we always notify the draw contexts, because the backends still
update the width/height themselves before calling update_size().
2021-03-31 04:14:16 +02:00
Benjamin Otte
13b45fe270 surface: Pass width/height/scale to update_size()
This is preparation for letting gdk_surface_update_size() actually do
the size updating.
2021-03-31 04:14:16 +02:00
Benjamin Otte
f855c52892 surface: Remove generic invalidation calls
These invalidations happen with the wrong sizes and need to be redone
after compute_size() anyway, so don't do them there.

Also, the idle handler happens _after_ we've already rendered in the
frame callback and just causes an unneeded redraw.
2021-03-31 04:14:16 +02:00
Benjamin Otte
e3ebdd633a window: Don't map children twice
Children get mapped when chaining up to the parent, so no need to do it
again.
2021-03-31 04:14:16 +02:00
Benjamin Otte
22797965de window: present() the toplevel only once
It needs to be done before mapping the children so that the toplevel is
visible when the children want to show popovers.
2021-03-31 04:14:16 +02:00
Benjamin Otte
13bd8e0dc2 gstmedia: Properly detect stream metadata when preparing
We can look at the GstPlayerMediaInfo to get all the info we care about.
2021-03-31 04:14:16 +02:00
Benjamin Otte
fce1479988 build: Define if options should be enabled or disbaled
"auto" options are terrible because nobody knows if they should enable
them or not. So enable the ones that every release should use and
disable the ones that releases aren't expected to use.

Everybody is still free to override this in their config - either to
turn off stuff that's unsupported or not wanted for them or to enable
new and exciting experimental features - but we should not leave this to
the randomly existing environment that somebpody happens to build in.

Options should be a deliberate choice every time.
2021-03-31 04:14:16 +02:00
1658 changed files with 120605 additions and 139089 deletions

View File

@@ -7,7 +7,6 @@ stages:
- analysis
- docs
- flatpak
- publish
- deploy
.cache-paths: &cache-paths
@@ -25,8 +24,9 @@ variables:
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true"
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled"
MESON_TEST_TIMEOUT_MULTIPLIER: 3
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v34"
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v28"
FLATPAK_IMAGE: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master"
DOCS_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora-docs:v26"
.only-default:
only:
@@ -58,10 +58,8 @@ style-check-diff:
- "${CI_PROJECT_DIR}/_build/report*.xml"
- "${CI_PROJECT_DIR}/_build/report*.html"
- "${CI_PROJECT_DIR}/_build/testsuite/reftests/output/*/*.png"
- "${CI_PROJECT_DIR}/_build/testsuite/tools/output/*/*"
- "${CI_PROJECT_DIR}/_build/testsuite/gsk/compare/*/*/*.png"
- "${CI_PROJECT_DIR}/_build/testsuite/css/output/*/*.syscap"
- "${CI_PROJECT_DIR}/_build_hello/meson-logs"
cache:
key: "$CI_JOB_NAME"
paths:
@@ -79,16 +77,10 @@ fedora-x86_64:
variables:
EXTRA_MESON_FLAGS: "--buildtype=debug --default-library=both"
script:
- .gitlab-ci/show-info-linux.sh
- meson subprojects update
- mkdir _install
- meson --prefix=${CI_PROJECT_DIR}/_install
${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} ${BACKEND_FLAGS} ${FEATURE_FLAGS}
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} ${BACKEND_FLAGS} ${FEATURE_FLAGS}
_build
- meson compile -C _build
- meson install -C _build
- PKG_CONFIG_PATH=${CI_PROJECT_DIR}/_install/lib64/pkgconfig:${CI_PROJECT_DIR}/_install/share/pkgconfig meson setup _build_hello examples/hello
- meson compile -C _build_hello
- ninja -C _build
- .gitlab-ci/run-tests.sh _build x11
- .gitlab-ci/run-tests.sh _build wayland
- .gitlab-ci/run-tests.sh _build broadway
@@ -100,7 +92,6 @@ release-build:
variables:
EXTRA_MESON_FLAGS: "--buildtype=release"
script:
- .gitlab-ci/show-info-linux.sh
- meson subprojects update
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} ${BACKEND_FLAGS} ${FEATURE_FLAGS}
_build
@@ -115,7 +106,6 @@ installed-tests:
EXTRA_MESON_FLAGS: "--prefix=/usr --libdir=/usr/lib64 -Dinstall-tests=true"
G_TEST_ACCESSIBLE: 1
script:
- .gitlab-ci/show-info-linux.sh
- meson subprojects update
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} ${BACKEND_FLAGS} ${FEATURE_FLAGS}
_build
@@ -165,16 +155,13 @@ macos:
- macos
needs: []
before_script:
- bash .gitlab-ci/show-info-osx.sh
- bash .gitlab-ci/show-execution-environment.sh
- pip3 install --user meson==0.56
- pip3 install --user ninja
- export PATH=/Users/gitlabrunner/Library/Python/3.7/bin:$PATH
- export MESON_FORCE_BACKTRACE=1
script:
- meson -Dx11-backend=false
-Dbroadway-backend=true
-Dmacos-backend=true
-Dmedia-gstreamer=disabled
-Dintrospection=disabled
-Dcpp_std=c++11
-Dpixman:tests=disabled
@@ -185,22 +172,6 @@ macos:
paths:
- "${CI_PROJECT_DIR}/_build/meson-logs"
vs2017-x64:
extends: .only-default
# TODO: Uncomment this when ready to merge.
#only:
# - branches@GNOME/gtk
stage: build
tags:
- win32-ps
needs: []
script:
- .gitlab-ci/test-msvc.bat
artifacts:
when: always
paths:
- "${CI_PROJECT_DIR}/_build/meson-logs"
.flatpak-defaults:
image: $FLATPAK_IMAGE
stage: flatpak
@@ -312,7 +283,7 @@ asan-build:
allow_failure: true
reference:
image: $FEDORA_IMAGE
image: $DOCS_IMAGE
stage: docs
needs: []
variables:
@@ -338,11 +309,14 @@ reference:
paths:
- _reference
publish-docs:
stage: publish
pages:
stage: deploy
needs: ['reference']
script:
- "curl -X POST -F token=${PAGES_TRIGGER_TOKEN} -F ref=docs-gtk-org https://gitlab.gnome.org/api/v4/projects/665/trigger/pipeline"
- mv _reference/ public/
- cp .gitlab-ci/pages/* public/
artifacts:
paths:
- public
only:
refs:
- master
- master

View File

@@ -0,0 +1,89 @@
FROM fedora:33
RUN dnf -y install \
adwaita-icon-theme \
atk-devel \
at-spi2-atk-devel \
avahi-gobject-devel \
cairo-devel \
cairo-gobject-devel \
ccache \
clang \
clang-analyzer \
colord-devel \
cups-devel \
dbus-daemon \
dbus-x11 \
dejavu-sans-mono-fonts \
desktop-file-utils \
diffutils \
elfutils-libelf-devel \
fribidi-devel \
gcc \
gcc-c++ \
gdk-pixbuf2-devel \
gdk-pixbuf2-modules \
gettext \
git \
glib2-devel \
glib2-static \
glibc-devel \
glibc-headers \
gnome-desktop-testing \
gobject-introspection-devel \
graphene-devel \
gstreamer1-devel \
gstreamer1-plugins-good \
gstreamer1-plugins-bad-free-devel \
gstreamer1-plugins-base-devel \
gtk-doc \
hicolor-icon-theme \
iso-codes \
itstool \
json-glib-devel \
lcov \
libasan \
libattr-devel \
libcloudproviders-devel \
libepoxy-devel \
libffi-devel \
libmount-devel \
librsvg2 \
libselinux-devel \
libubsan \
libXcomposite-devel \
libXcursor-devel \
libXcursor-devel \
libXdamage-devel \
libXfixes-devel \
libXi-devel \
libXinerama-devel \
libxkbcommon-devel \
libXrandr-devel \
libXrender-devel \
libXtst-devel \
libxslt \
mesa-dri-drivers \
mesa-libEGL-devel \
mesa-libGLES-devel \
meson \
ninja-build \
pango-devel \
pcre-devel \
pcre-static \
python3 \
python3-jinja2 \
python3-pip \
python3-pygments \
python3-wheel \
redhat-rpm-config \
sassc \
systemtap-sdt-devel \
vulkan-devel \
wayland-devel \
wayland-protocols-devel \
weston \
weston-libs \
which \
xorg-x11-server-Xvfb \
&& dnf clean all

View File

@@ -0,0 +1,17 @@
FROM registry.gitlab.gnome.org/gnome/gtk/fedora-base:v28
RUN dnf -y install \
python3-jinja2 \
python3-markdown \
python3-pygments \
python3-toml \
python3-typogrify
ARG HOST_USER_ID=5555
ENV HOST_USER_ID ${HOST_USER_ID}
RUN useradd -u $HOST_USER_ID -ms /bin/bash user
USER user
WORKDIR /home/user
ENV LANG C.UTF-8

View File

@@ -1,100 +1,4 @@
FROM fedora:34
RUN dnf -y install \
adwaita-icon-theme \
atk-devel \
at-spi2-atk-devel \
avahi-gobject-devel \
cairo-devel \
cairo-gobject-devel \
ccache \
clang \
clang-analyzer \
clang-tools-extra \
colord-devel \
cups-devel \
dbus-daemon \
dbus-x11 \
dejavu-sans-mono-fonts \
desktop-file-utils \
diffutils \
elfutils-libelf-devel \
fribidi-devel \
gcc \
gcc-c++ \
gdk-pixbuf2-devel \
gdk-pixbuf2-modules \
gettext \
git \
glib2-devel \
glib2-static \
glibc-devel \
glibc-headers \
gnome-desktop-testing \
gobject-introspection-devel \
graphene-devel \
graphviz \
gstreamer1-devel \
gstreamer1-plugins-good \
gstreamer1-plugins-bad-free-devel \
gstreamer1-plugins-base-devel \
hicolor-icon-theme \
iso-codes \
itstool \
json-glib-devel \
lcov \
libasan \
libattr-devel \
libcloudproviders-devel \
libepoxy-devel \
libffi-devel \
libjpeg-turbo-devel \
libmount-devel \
libpng-devel \
librsvg2 \
libselinux-devel \
libtiff-devel \
libubsan \
libXcomposite-devel \
libXcursor-devel \
libXcursor-devel \
libXdamage-devel \
libXfixes-devel \
libXi-devel \
libXinerama-devel \
libxkbcommon-devel \
libXrandr-devel \
libXrender-devel \
libXtst-devel \
libxslt \
mesa-dri-drivers \
mesa-libEGL-devel \
mesa-libGLES-devel \
meson \
ninja-build \
pango-devel \
pcre-devel \
pcre-static \
python3 \
python3-gobject \
python3-jinja2 \
python3-markdown \
python3-pip \
python3-pygments \
python3-toml \
python3-typogrify \
python3-wheel \
redhat-rpm-config \
sassc \
systemtap-sdt-devel \
vulkan-devel \
wayland-devel \
wayland-protocols-devel \
weston \
weston-libs \
which \
xorg-x11-server-Xvfb \
&& dnf clean all
FROM registry.gitlab.gnome.org/gnome/gtk/fedora-base:v28
# Enable sudo for wheel users
RUN sed -i -e 's/# %wheel/%wheel/' -e '0,/%wheel/{s/%wheel/# %wheel/}' /etc/sudoers

View File

@@ -24,7 +24,6 @@ flatpak build ${builddir} meson \
-Dbuild-examples=false \
-Dintrospection=disabled \
-Ddemos=true \
-Dprofile=devel \
_flatpak_build
flatpak build ${builddir} ninja -C _flatpak_build install

View File

@@ -1,5 +0,0 @@
#! /bin/sh
. /etc/os-release
echo $PRETTY_NAME

View File

@@ -15,7 +15,7 @@ meson \
-Dx11-backend=true \
-Dwayland-backend=true \
-Dbroadway-backend=true \
-Dvulkan=enabled \
-Dvulkan=yes \
-Dprofiler=true \
--werror \
${EXTRA_MESON_FLAGS:-} \

View File

@@ -1,14 +0,0 @@
@echo on
:: vcvarsall.bat sets various env vars like PATH, INCLUDE, LIB, LIBPATH for the
:: specified build architecture
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x64
@echo on
:: FIXME: make warnings fatal
pip3 install --upgrade --user meson==0.56.2 || goto :error
meson -Dmedia-gstreamer=disabled _build || goto :error
ninja -C _build || goto :error
goto :EOF
:error
exit /b 1

View File

@@ -40,7 +40,7 @@ export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
# https://gitlab.gnome.org/GNOME/gtk/-/issues/2243
# https://gitlab.gnome.org/GNOME/gtk/-/issues/3002
if ! pkg-config --atleast-version=2.66.0 glib-2.0; then
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
@@ -48,7 +48,7 @@ if ! pkg-config --atleast-version=2.66.0 glib-2.0; then
fi
pkg-config --modversion glib-2.0
if ! pkg-config --atleast-version=1.49.1 pango; then
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

396
NEWS
View File

@@ -1,399 +1,3 @@
Overview of Changes
===================
* gsk:
- Drop the GL renderer in favor of NGL
* css:
- Add support for line-height
- Add support for text-transform
* GtkTextView:
- Add support for line height
- Add support for text transforms
* Build:
- Require Pango 1.49
Overview of Changes in 4.4.0
============================
* Input:
- Match IBus for display of Compose sequences
- Match IBus for handling of mismatches
- Handle Escape in Compose sequences
- Allow multiple dead keys
- Support 32bit keysyms
* GtkCheckButton:
- Activate when moving focus
* GtkLabel:
- Propertly ignore double underscores for mnemonics
* GtkPopoverMenu:
- Fix focus cycling
* GtkTextView:
- Improve word selection
- Fix block cursors on empty lines
* GdkToplevel:
- Support the gnome-shell titlebar gesture protocol
* GdkDropTarget:
- Allow creating drop targets in ui files
* gsk:
- Handle partial color fonts correctly
- Use harfbuzz for color font information
- Avoid pango for glyph cache rendering
- Shrink shadow extents
* Settings:
- Change the default for gtk-split-cursor to FALSE
* Demos:
- Small improvements to widget-factory
- gtk-demo: Improve the hypertext demo
- gtk-dem: Improve the clipboard demo
* X11:
- Set WM_CLASS on toplevels
* Wayland:
- Support wl_seat v7
* Windows:
- Drop the local DND protocol
- Avoid WGL if shaders don't work
- Use WinPointer API
* Translation updates:
Belarusian
Friulian
Hebrew
Khmer
Persian
Polish
Overview of Changes in 4.3.2
============================
* GtkToggleButton:
- Fix the actionable implementation
* GtkCheckButton:
- Fix the actionable implementation
- Cancel activation on when the pointer leaves
* GtkMenuButton:
- Make activatable again
- Add a way to have an icon + arrow
* GtkColorButton:
- Make activatable again
* GtkFontButton:
- Make activatable again
* GtkAppChooserButton:
- Make activatable again
* GtkColumnView:
- Fix double activation
* GtkLabel:
- Fix mnemonics without markup
* GtkTreeView:
- Clip header buttons
* GtkTextView:
- Add api to get the RTL and LTR contexts
- Fix some errors in text history grouping
* GtkText:
- Don't show placeholder text on top of entry text
- Add api to compute the cursor extents
- Fix y coordinates for text selection
* GtkFileChooser:
- Don't show Trash in the side bar
* GtkPopoverMenu:
- Add scrollbars to long menus
* GtkActionMuxer:
- Fix propagation of accel changes
* Introspection:
- Annotate all filename arguments
- Rename GtkMediaStream apis to avoid name collisions
- Rename GtkDropTarget properties to avoid name collisions
- Make GtkPasswordEntryBuffer introspectable
* Printing:
- Remove the Google Cloud Print backend
* Theme:
- Sync included icons with the Adwaita icon theme
* GSK:
- Avoid overflowing the vertex counter
- Handle negative scales correctly in the ngl renderer
* GDK:
- Cleanup and simplify OpenGL setup code
- Add a GdkDisplay::init_gl vfunc and gdk_display_prepare_gl() api
- Require EGL 1.4
- Fix EGL + NVidia
* Build:
- Enable gstreamer by default
- Disable Vulkan by default
- Remove the sassc option
- Remove options and checks for X11 extensions
* X11:
- Stop using XComposite
- Remove the Visual cache
* Wayland:
- Fix some DND corner cases
- Work with version 2 of pointer-gestures-v1
- Look for cursor themes in $HOME/.icons
* Windows:
- Fix SIGILL on x64 due to popcnt
- Fix popup placement
- Fix drag icon placement
- Clean up HiDPI and WGL support
- Default to WGL
* MacOs:
- Fix input method support
- Register known clipboard types for drop targets
- Add initial DND support
* Translation updates:
Brazilian Portuguese
Portuguese
Romanian
Turkish
Ukrainian
Overview of Changes in 4.3.1
============================
* GtkEmojiChooser:
- Update data from CLDR 39
- Load Emoji data for both language and territory
* GtkCalendar:
- Fix an off-by-one error in day numbers
* GtkListView:
- Add .activatable style class to activatable items
* GtkCheckButton:
- Don't allow unchecking grouped radio buttons
*GtkToggleButton:
- Fix mnemonic activation propagation
* GtkLabel:
- Make mnemonics work even when invisible
- Fix mnemonic activation propagation
* GtkMenuButton:
- Add a property to mark primary menus and make F10 work
* GtkApplication:
- Fix initial screensaver state async
* GtkEntry:
- Apply xalign to placeholder text (as it was in GTK 3)
* GtkSpinButton:
- Fix swipe gestures
* GtkStackSwitcher:
- Implement GtkOrientable (as it was in GTK 3)
- Fix a use-after-free problem with drag timeouts
* GtkFileChooser:
- Add support for (case-insensitive) suffix matches in GtkFileFilter
* GtkPasswordEntry:
- Make GtkPasswordEntryBuffer public, to make it easier
to write your own password entry widget
* Input:
- Fix interference between various obscure XKB features
(e.g. overlays) and Compose sequences
* Action support:
- Fix submenu-action handling
* Theme:
- Update icons from the Adwaita icon theme
- Fix icon names for GtkSwitch
- Fix switch-off icon
* GSK:
- Improve transformed offscreen rendering
- Add padding between cached glyphs
* Wayland:
- Fix monitor sizes in the presence of transforms
- Add a getter for the EGLDisplay
- Fix click-drag-release sequences for popovers
* X11:
- Support EGL for X11. Fall back to GLX if EGL isn't available
- Always fall back to GLX on NVidia
- Add a getter for the EGLDisplay
* Broadway:
- Add a setter for display scale
* Windows:
- Add a getter for the EGLDisplay
- Make GL work for media playback
* MacOS:
- Fix menubar appearance
* Tools:
- gtk4-builder-tool: Replace can-focus with focusable in 3-to-4 conversion
* Introspection:
- Add missing annotations in a few places (e.g. gtk_free_view_row_activated)
* Build:
- Only build one source file with -mf16c
- Fix devel styling for ci flatpak builds
- Generate appdata for demo flatpaks
* Docs:
- Numerous fixes and additions
* Translation updates:
Friulian
Nepali
Norwegian Bokmål
Ukrainian
Overview of Changes in 4.3.0
============================
* GtkVideo:
- Detect stream metadata when using gstreamer
* GtkFileChooser:
- Fix a crash
* GtkButton:
- Add back visual feedback for keynav activation
* GtkFontChooser:
- Fix initial font selection
* Text widgets:
- Replace squiggly error underlines by dotted lines
- Support translucent selections
* GtkTextView:
- Various improvements to rendering performance
* GtkScrolledWindow:
- Stop using scroll cursors
* GtkMenuButton:
- Make focus-on-click work
* GtkToggleButton:
- Make grouped buttons mutually exclusive
* GtkPasswordEntry:
- Use MADV_DONTDUMP for secure memory
* GtkListBox:
- Allow repeated selection extension for MULTIPLE
* Themes:
- Reorganize and rename included themes. The theme is now
called Default, with dark, hc and hc-dark variants.
Visually, the themes are unchanged.
- The theme variants are also available as standalone
themes called Default-dark, etc.
- The theme named Adwaita is moving to libadwaita
- Fix resize border sizing
- Fix solid-csd window decorations
* Input:
- Revert some Compose sequence changes (mainly around dead
acute and apostrophe)
- Consume all key events during preedit, to avoid unexpected
interactions
- Ignore more modifiers during preedit, to allow using 3rd and
5th level choosers
- Fix handling of cursor positions in non-ASCII preedit text
- Fix a problem with deferred focus setting
* GdkClipboard:
- Ensure strings are nul-terminated
* GSK:
- Improvements to the ngl renderer
- Fix offscreen rendering with transforms
- Fix downscaled textures
- Avoid huge intermediate textures
- Use fp16 for colors
- Optimize handling of underlines in text
- Fix corner cases of shadow rendering
- Reorganize shader resources
- Make shadow rendering match across renderers
* Accessibility:
- Various fixes to get Orca to speak (still a work in progress)
* Wayland:
- Improve font settings fallback
- Avoid unintentional rendering freezes with popovers
- Support the xdg_activation_v1 protocol
* X11:
- Don't beep on untrusted displays
- Don't crash when popovers are outside the workarea
* Windows:
- Fix using GL rendering with Mesa drivers
* Tools:
- Add support for copy/paste in gtk4-node-editor
- Make syntax highlighting work in the gtk4-demo flatpak
* Inspector:
- Enable the inspector by default, in all cases
- Show keyboard layouts
- Improve monitor information
* Translation updates:
Catalan
Chinese (Taiwan)
Dutch
Nepali
Polish
Swedish
Ukrainian
Overview of Changes in 4.2.0
============================

View File

@@ -10,12 +10,10 @@ GTK is a multi-platform toolkit for creating graphical user interfaces.
Offering a complete set of widgets, GTK is suitable for projects ranging
from small one-off projects to complete application suites.
GTK is a free and open-source software project. The licensing terms
for GTK, the GNU LGPL, allow it to be used by all developers, including those
developing proprietary software, without any license fees or royalties.
GTK is hosted by the GNOME project (thanks!) and used by a wide variety
of applications and projects.
GTK is free software and part of the GNU Project. However, the
licensing terms for GTK, the GNU LGPL, allow it to be used by all
developers, including those developing proprietary software, without any
license fees or royalties.
The official download location
@@ -38,13 +36,6 @@ Nightly documentation can be found at
- Gdk: https://gnome.pages.gitlab.gnome.org/gtk/gdk4/
- Gsk: https://gnome.pages.gitlab.gnome.org/gtk/gsk4/
Nightly flatpaks of our demos can be installed from the
[GNOME Nightly](https://wiki.gnome.org/Apps/Nightly) repository:
- `flatpak remote-add --if-not-exists gnome-nightly https://nightly.gnome.org/gnome-nightly.flatpakrepo`
- `flatpak install gnome-nightly org.gtk.Demo4`
- `flatpak install gnome-nightly org.gtk.WidgetFactory4`
- `flatpak install gnome-nightly org.gtk.IconBrowser4`
Building and installing
-----------------------
@@ -153,17 +144,14 @@ Contributing to GTK
Please, follow the [contribution guide](./CONTRIBUTING.md) to know how to
start contributing to GTK.
If you want to support GTK financially, please consider donating to
the GNOME project, which runs the infrastructure hosting GTK.
Release notes
-------------
The release notes for GTK are part of the migration guide in the API
reference. See:
- [3.x release notes](https://developer.gnome.org/gtk3/stable/gtk-migrating-2-to-3.html)
- [4.x release notes](https://docs.gtk.org/gtk4/migrating-3to4.html)
- [3.x release notes](https://developer.gnome.org/gtk3/unstable/gtk-migrating-2-to-3.html)
- [4.x release notes](https://developer.gnome.org/gtk4/unstable/gtk-migrating-3-to-4.html)
Licensing terms
---------------

View File

@@ -1,43 +0,0 @@
diff -ur lua-5.1.4/src/Makefile lua-5.1.4-new/src/Makefile
--- lua-5.1.4/src/Makefile 2008-01-19 20:37:58.000000000 +0100
+++ lua-5.1.4-new/src/Makefile 2012-02-23 18:26:43.000000000 +0100
@@ -23,6 +23,7 @@
PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
LUA_A= liblua.a
+LUA_SO= liblua.so
CORE_O= lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \
lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o \
lundump.o lvm.o lzio.o
@@ -36,7 +37,7 @@
LUAC_O= luac.o print.o
ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O)
-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
+ALL_T= $(LUA_A) $(LUA_SO) $(LUA_T) $(LUAC_T)
ALL_A= $(LUA_A)
default: $(PLAT)
@@ -51,6 +52,11 @@
$(AR) $@ $?
$(RANLIB) $@
+$(LUA_SO): $(CORE_O) $(LIB_O)
+ $(CC) -shared -ldl -Wl,-soname,$(LUA_SO).$(V) -o $@.$(R) $? -lm $(MYLDFLAGS)
+ ln -sf $(LUA_SO).$(R) $(LUA_SO).$(V)
+ ln -sf $(LUA_SO).$(R) $(LUA_SO)
+
$(LUA_T): $(LUA_O) $(LUA_A)
$(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
--- lua-5.1.4/Makefile 2008-08-12 02:40:48.000000000 +0200
+++ lua-5.1.4-new/Makefile 2012-02-23 19:06:32.000000000 +0100
@@ -53,7 +53,7 @@
all: $(PLAT)
$(PLATS) clean:
- cd src && $(MAKE) $@
+ cd src && $(MAKE) $@ V=$(V) R=$(R)
test: dummy
src/lua test/hello.lua

View File

@@ -93,77 +93,6 @@
}
]
},
{
"name": "boost",
"buildsystem": "simple",
"build-commands": [
"./bootstrap.sh --prefix=/app --with-libraries=date_time,filesystem,iostreams,locale,regex,system,thread,python,program_options,test,serialization",
"./b2 --build-type=minimal link=shared -j $FLATPAK_BUILDER_N_JOBS",
"./b2 --build-type=minimal link=shared install"
],
"sources": [
{
"type": "archive",
"url": "https://boostorg.jfrog.io/artifactory/main/release/1.69.0/source/boost_1_69_0.tar.bz2",
"sha256": "8f32d4617390d1c2d16f26a27ab60d97807b35440d45891fa340fc2648b04406"
}
]
},
{
"name": "lua-5.1",
"buildsystem": "simple",
"build-commands": [
"make -j $FLATPAK_BUILDER_N_JOBS CFLAGS=\"$CFLAGS -fPIC -DLUA_USE_LINUX\" linux",
"make INSTALL_TOP=$FLATPAK_DEST TO_LIB='liblua.a liblua.so.5.1.5' install",
"ln -sf liblua.so.5.1.5 $FLATPAK_DEST/lib/liblua.so",
"ln -sf liblua.so.5.1.5 $FLATPAK_DEST/lib/liblua.so.5.1",
"install -Dm0644 etc/lua.pc $FLATPAK_DEST/lib/pkgconfig/lua.pc",
"ln -sf lua.pc $FLATPAK_DEST/lib/pkgconfig/lua51.pc",
"ln -sf lua.pc $FLATPAK_DEST/lib/pkgconfig/lua5.1.pc",
"ln -sf lua.pc $FLATPAK_DEST/lib/pkgconfig/lua-5.1.pc"
],
"sources": [
{
"type": "archive",
"url": "https://www.lua.org/ftp/lua-5.1.5.tar.gz",
"sha256": "2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333"
},
{
"type": "patch",
"path": "lua-5.1.5-so.patch"
},
{
"type": "shell",
"commands": [
"sed -i \"s|/usr/local|$FLATPAK_DEST|\" etc/lua.pc src/luaconf.h"
]
}
],
"cleanup": [
"*.a",
"/bin",
"/include",
"/lib/pkgconfig",
"/man"
]
},
{
"name" : "highlight",
"buildsystem" : "simple",
"builddir" : true,
"build-commands" : [
"sed -i -e 's#^PREFIX = /usr#PREFIX = /app#' makefile",
"make",
"make install"
],
"sources" : [
{
"type" : "archive",
"url" : "http://www.andre-simon.de/zip/highlight-4.0.tar.bz2",
"sha256" : "f40dcba26e011a2c67df874f4d9b0238c2c6b065163ce8de3d8371b9dfce864d"
}
]
},
{
"name" : "gtk",
"buildsystem" : "meson",

View File

@@ -8,10 +8,10 @@ from pathlib import PurePath
stylesheets = [
'gtk/theme/Default/Default-light.css',
'gtk/theme/Default/Default-dark.css',
'gtk/theme/Default/Default-hc.css',
'gtk/theme/Default/Default-hc-dark.css',
'gtk/theme/Adwaita/Adwaita.css',
'gtk/theme/Adwaita/Adwaita-dark.css',
'gtk/theme/HighContrast/HighContrast.css',
'gtk/theme/HighContrast/HighContrast-dark.css',
]
references = [

View File

@@ -1,26 +0,0 @@
#!/usr/bin/env python3
import os
import subprocess
import sys
repodir = sys.argv[1]
profile = sys.argv[2]
sys.stdout.write("/* This file is auto-generated. Do not edit. */\n")
sys.stdout.write("#pragma once\n")
sys.stdout.write("\n")
sys.stdout.write(f"#define PROFILE \"{profile}\"\n")
short_sha = os.environ.get('CI_COMMIT_SHORT_SHA')
if short_sha is None:
cmd = ["git", "-C", repodir, "rev-parse", "--short", "HEAD"]
try:
with subprocess.Popen(cmd, stdout=subprocess.PIPE) as p:
short_sha = p.stdout.read().decode('utf-8').rstrip("\n")
except FileNotFoundError:
short_sha = ''
if profile != 'default':
short_sha = 'devel'
sys.stdout.write(f"#define VCS_TAG \"{short_sha}\"\n")

281
config.h.meson Normal file
View File

@@ -0,0 +1,281 @@
/* always defined to indicate that i18n is enabled */
#define ENABLE_NLS 1
/* Use structured logging */
#define G_LOG_STRUCTURED 1
/* The prefix for our gettext translation domains. */
#mesondefine GETTEXT_PACKAGE
/* Disable deprecation warnings from glib */
#mesondefine GLIB_DISABLE_DEPRECATION_WARNINGS
/* Define the location where the catalogs will be installed */
#mesondefine GTK_LOCALEDIR
/* Define to 1 if you have the `bind_textdomain_codeset' function. */
#mesondefine HAVE_BIND_TEXTDOMAIN_CODESET
/* Have the cloudproviders library */
#mesondefine HAVE_CLOUDPROVIDERS
/* define if we have colord */
#mesondefine HAVE_COLORD
/* Define to 1 if you have the <crt_externs.h> header file. */
#mesondefine HAVE_CRT_EXTERNS_H
/* Define to 1 if you have the `dcgettext' function. */
#mesondefine HAVE_DCGETTEXT
/* Define to 1 if you have the <dlfcn.h> header file. */
#mesondefine HAVE_DLFCN_H
/* Have the ffmpeg library */
#mesondefine HAVE_FFMPEG
/* Define to 1 if you have the <ftw.h> header file. */
#mesondefine HAVE_FTW_H
/* Define to 1 if you have the `getpagesize' function. */
#mesondefine HAVE_GETPAGESIZE
/* Define to 1 if you have the `getresuid' function. */
#mesondefine HAVE_GETRESUID
/* Define if gio-unix is available */
#mesondefine HAVE_GIO_UNIX
/* Define if GStreamer support is available */
#mesondefine HAVE_GSTREAMER
/* Define to 1 if you have the <inttypes.h> header file. */
#mesondefine HAVE_INTTYPES_H
/* Define to 1 if the system has the type `IPrintDialogCallback'. */
#mesondefine HAVE_IPRINTDIALOGCALLBACK
/* Define to 1 if you have the <locale.h> header file. */
#mesondefine HAVE_LOCALE_H
/* Define to 1 if you have the `lstat' function. */
#mesondefine HAVE_LSTAT
/* Define to 1 if you have the `mallinfo' function. */
#mesondefine HAVE_MALLINFO
/* Define to 1 if you have the <memory.h> header file. */
#mesondefine HAVE_MEMORY_H
/* Define to 1 if you have the `mkstemp' function. */
#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. */
#mesondefine HAVE_MMAP
/* Define to 1 if you have the `posix_fallocate' function. */
#mesondefine HAVE_POSIX_FALLOCATE
/* Have the Xrandr extension library */
#mesondefine HAVE_RANDR
/* Have the Xrandr 1.5 extension library */
#mesondefine HAVE_RANDR15
/* Define to 1 if you have the `sincos' function. */
#mesondefine HAVE_SINCOS
/* Define to 1 if you have the <stdint.h> header file. */
#mesondefine HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#mesondefine HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#mesondefine HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#mesondefine HAVE_STRING_H
/* Define to 1 if you have the <sys/mman.h> header file. */
#mesondefine HAVE_SYS_MMAN_H
/* Define to 1 if you have the <sys/param.h> header file. */
#mesondefine HAVE_SYS_PARAM_H
/* Have the sysprof-capture library */
#mesondefine HAVE_SYSPROF
/* Define to 1 if you have the <sys/stat.h> header file. */
#mesondefine HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/time.h> header file. */
#mesondefine HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#mesondefine HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#mesondefine HAVE_UNISTD_H
/* Have the XCOMPOSITE X extension */
#mesondefine HAVE_XCOMPOSITE
/* Have the Xcursor library */
#mesondefine HAVE_XCURSOR
/* Have the XDAMAGE X extension */
#mesondefine HAVE_XDAMAGE
/* Have the XFIXES X extension */
#mesondefine HAVE_XFIXES
/* Define to 1 if XFree Xinerama is available */
#mesondefine HAVE_XFREE_XINERAMA
/* Have XGenericEvent */
#mesondefine HAVE_XGENERICEVENTS
/* Define to use XKB extension */
#mesondefine HAVE_XKB
/* Have the SYNC extension library */
#mesondefine HAVE_XSYNC
/* Define to 1 if you have the `_lock_file' function */
#mesondefine HAVE__LOCK_FILE
/* Define to 1 if you have the `flockfile' function */
#mesondefine HAVE_FLOCKFILE
/* Define if _NL_MEASUREMENT_MEASUREMENT is available */
#mesondefine HAVE__NL_MEASUREMENT_MEASUREMENT
/* Define if _NL_PAPER_HEIGHT is available */
#mesondefine HAVE__NL_PAPER_HEIGHT
/* Define if _NL_PAPER_WIDTH is available */
#mesondefine HAVE__NL_PAPER_WIDTH
/* Define if _NL_TIME_FIRST_WEEKDAY is available */
#mesondefine HAVE__NL_TIME_FIRST_WEEKDAY
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#mesondefine LT_OBJDIR
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
#mesondefine NO_MINUS_C_MINUS_O
/* Define to the address where bug reports for this package should be sent. */
#mesondefine PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#mesondefine PACKAGE_NAME
/* Define to the full name and version of this package. */
#mesondefine PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#mesondefine PACKAGE_TARNAME
/* Define to the home page for this package. */
#mesondefine PACKAGE_URL
/* Define to the version of this package. */
#mesondefine PACKAGE_VERSION
/* Use NSBundle functions to determine load paths for libraries, translations,
etc. */
#mesondefine QUARTZ_RELOCATION
/* Define to 1 if you have the ANSI C header files. */
#mesondefine STDC_HEADERS
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
/* Define to 1 if XInput 2.2 is available */
#mesondefine XINPUT_2_2
/* Define to 1 if the X Window System is missing or not being used. */
#mesondefine X_DISPLAY_MISSING
/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
#mesondefine _FILE_OFFSET_BITS
/* defines how to decorate public symbols while building */
#mesondefine _GDK_EXTERN
/* Define for large files, on AIX-style hosts. */
#mesondefine _LARGE_FILES
/* Define to 1 if on MINIX. */
#mesondefine _MINIX
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
#mesondefine _POSIX_1_SOURCE
/* Define to 1 if you need to in order for `stat' and other things to work. */
#mesondefine _POSIX_SOURCE
/* Define to `int' if <sys/types.h> doesn't define. */
#mesondefine gid_t
/* Define to `int' if <sys/types.h> doesn't define. */
#mesondefine uid_t
/* Define to 1 if linux/memfd.h exists */
#mesondefine HAVE_LINUX_MEMFD_H
#mesondefine HAVE_LINUX_INPUT_H
#mesondefine HAVE_DEV_EVDEV_INPUT_H
#mesondefine GTK_SYSCONFDIR
#mesondefine GTK_LOCALEDIR
#mesondefine GTK_DATADIR
#mesondefine GTK_LIBDIR
#mesondefine GTK_PRINT_BACKENDS
#mesondefine HAVE_CAIRO_SCRIPT_INTERPRETER
#mesondefine HAVE_HARFBUZZ
#mesondefine HAVE_PANGOFT
#mesondefine ISO_CODES_PREFIX
/* Define if tracker3 is available */
#mesondefine HAVE_TRACKER3

View File

@@ -321,7 +321,6 @@
<file>paintable_emblem.c</file>
<file>paintable_mediastream.c</file>
<file>paintable_svg.c</file>
<file>paintable_symbolic.c</file>
<file>panes.c</file>
<file>password_entry.c</file>
<file>peg_solitaire.c</file>

View File

@@ -100,11 +100,7 @@ prepare_drag (GtkDragSource *source,
DemoImage *demo = DEMO_IMAGE (widget);
GdkPaintable *paintable = get_image_paintable (GTK_IMAGE (demo->image));
/* Textures can be serialized, paintables can't, so special case the textures */
if (GDK_IS_TEXTURE (paintable))
return gdk_content_provider_new_typed (GDK_TYPE_TEXTURE, paintable);
else
return gdk_content_provider_new_typed (GDK_TYPE_PAINTABLE, paintable);
return gdk_content_provider_new_typed (GDK_TYPE_PAINTABLE, paintable);
}
static gboolean
@@ -133,11 +129,7 @@ copy_image (GtkWidget *widget,
GdkPaintable *paintable = get_image_paintable (GTK_IMAGE (demo->image));
GValue value = G_VALUE_INIT;
/* Textures can be serialized, paintables can't, so special case the textures */
if (GDK_IS_TEXTURE (paintable))
g_value_init (&value, GDK_TYPE_TEXTURE);
else
g_value_init (&value, GDK_TYPE_PAINTABLE);
g_value_init (&value, GDK_TYPE_PAINTABLE);
g_value_set_object (&value, paintable);
gdk_clipboard_set_value (clipboard, &value);
g_value_unset (&value);
@@ -146,46 +138,24 @@ copy_image (GtkWidget *widget,
g_object_unref (paintable);
}
static void
paste_image_cb (GObject *source,
GAsyncResult *result,
gpointer data)
{
GdkClipboard *clipboard = GDK_CLIPBOARD (source);
DemoImage *demo = DEMO_IMAGE (data);
const GValue *value;
value = gdk_clipboard_read_value_finish (clipboard, result, NULL);
if (value == NULL)
{
gtk_widget_error_bell (GTK_WIDGET (demo));
g_object_unref (demo);
return;
}
gtk_image_set_from_paintable (GTK_IMAGE (demo->image), g_value_get_object (value));
g_object_unref (demo);
}
static void
paste_image (GtkWidget *widget,
const char *action_name,
GVariant *parameter)
{
GdkClipboard *clipboard = gtk_widget_get_clipboard (widget);
GType type;
DemoImage *demo = DEMO_IMAGE (widget);
GdkContentProvider *content = gdk_clipboard_get_content (clipboard);
GValue value = G_VALUE_INIT;
GdkPaintable *paintable;
if (gdk_content_formats_contain_gtype (gdk_clipboard_get_formats (clipboard), GDK_TYPE_TEXTURE))
type = GDK_TYPE_TEXTURE;
else
type = GDK_TYPE_PAINTABLE;
g_value_init (&value, GDK_TYPE_PAINTABLE);
if (!gdk_content_provider_get_value (content, &value, NULL))
return;
gdk_clipboard_read_value_async (clipboard,
type,
G_PRIORITY_DEFAULT,
NULL,
paste_image_cb,
g_object_ref (widget));
paintable = GDK_PAINTABLE (g_value_get_object (&value));
gtk_image_set_from_paintable (GTK_IMAGE (demo->image), paintable);
g_value_unset (&value);
}
static void

View File

@@ -13,13 +13,13 @@
</style>
<child>
<object class="GtkButton">
<property name="icon-name">go-previous-symbolic</property>
<property name="icon-name">pan-start-symbolic</property>
<signal name="clicked" handler="fishbowl_prev_button_clicked_cb" object="bowl" swapped="no"/>
</object>
</child>
<child>
<object class="GtkButton">
<property name="icon-name">go-next-symbolic</property>
<property name="icon-name">pan-end-symbolic</property>
<signal name="clicked" handler="fishbowl_next_button_clicked_cb" object="bowl" swapped="no"/>
</object>
</child>

View File

@@ -10,8 +10,12 @@
<object class="GtkButton" id="reset">
<property name="receives-default">1</property>
<property name="tooltip-text">Reset</property>
<property name="icon-name">view-refresh-symbolic</property>
<signal name="clicked" handler="font_features_reset_features" swapped="no"/>
<child>
<object class="GtkImage">
<property name="icon-name">view-refresh-symbolic</property>
</object>
</child>
</object>
</child>
</object>

View File

@@ -1136,7 +1136,7 @@ done:
g_free (design_coords);
}
G_MODULE_EXPORT void
void
font_features_font_changed (void)
{
update_script_combo ();
@@ -1144,14 +1144,14 @@ font_features_font_changed (void)
update_font_variations ();
}
G_MODULE_EXPORT void
void
font_features_script_changed (void)
{
update_features ();
update_display ();
}
G_MODULE_EXPORT void
void
font_features_reset_features (void)
{
GList *l;
@@ -1197,7 +1197,7 @@ switch_to_label (void)
update_display ();
}
G_MODULE_EXPORT void
void
font_features_toggle_edit (void)
{
if (strcmp (gtk_stack_get_visible_child_name (GTK_STACK (stack)), "label") == 0)
@@ -1206,7 +1206,7 @@ font_features_toggle_edit (void)
switch_to_label ();
}
G_MODULE_EXPORT void
void
font_features_stop_edit (void)
{
g_signal_emit_by_name (edit_toggle, "clicked");

View File

@@ -131,19 +131,6 @@ insert_tags_for_attributes (GtkTextBuffer *buffer,
gtk_text_buffer_apply_tag (buffer, tag, start, end); \
}
#define VOID_ATTR(attr_name) \
{ \
tag = gtk_text_tag_table_lookup (table, #attr_name); \
if (!tag) \
{ \
tag = gtk_text_tag_new (#attr_name); \
g_object_set (tag, #attr_name, TRUE, 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);
@@ -268,29 +255,6 @@ insert_tags_for_attributes (GtkTextBuffer *buffer,
INT_ATTR (insert_hyphens);
break;
case PANGO_ATTR_LINE_HEIGHT:
FLOAT_ATTR (line_height);
break;
case PANGO_ATTR_ABSOLUTE_LINE_HEIGHT:
break;
case PANGO_ATTR_WORD:
VOID_ATTR (word);
break;
case PANGO_ATTR_SENTENCE:
VOID_ATTR (sentence);
break;
case PANGO_ATTR_BASELINE_SHIFT:
INT_ATTR (baseline_shift);
break;
case PANGO_ATTR_FONT_SCALE:
INT_ATTR (font_scale);
break;
case PANGO_ATTR_SHAPE:
case PANGO_ATTR_ABSOLUTE_SIZE:
case PANGO_ATTR_GRAVITY:
@@ -299,10 +263,6 @@ insert_tags_for_attributes (GtkTextBuffer *buffer,
case PANGO_ATTR_BACKGROUND_ALPHA:
break;
case PANGO_ATTR_TEXT_TRANSFORM:
INT_ATTR (text_transform);
break;
case PANGO_ATTR_INVALID:
default:
g_assert_not_reached ();

View File

@@ -1,11 +1,6 @@
/* Pango/Font Rendering
*
* Demonstrates various aspects of font rendering,
* such as hinting, antialiasing and grid alignment.
*
* The demo lets you explore font rendering options
* interactively to get a feeling for they affect the
* shape and positioning of the glyphs.
* Demonstrates various aspects of font rendering.
*/
#include <gtk/gtk.h>
@@ -15,21 +10,16 @@ static GtkWidget *font_button = NULL;
static GtkWidget *entry = NULL;
static GtkWidget *image = NULL;
static GtkWidget *hinting = NULL;
static GtkWidget *anti_alias = NULL;
static GtkWidget *hint_metrics = NULL;
static GtkWidget *up_button = NULL;
static GtkWidget *down_button = NULL;
static GtkWidget *text_radio = NULL;
static GtkWidget *show_grid = NULL;
static GtkWidget *show_extents = NULL;
static GtkWidget *show_pixels = NULL;
static GtkWidget *show_outlines = NULL;
static PangoContext *context;
static int scale = 7;
static double pixel_alpha = 1.0;
static double outline_alpha = 0.0;
static int scale = 9;
static void
update_image (void)
@@ -37,7 +27,7 @@ update_image (void)
const char *text;
PangoFontDescription *desc;
PangoLayout *layout;
PangoRectangle ink, logical;
PangoRectangle ink, pink, logical;
int baseline;
cairo_surface_t *surface;
cairo_t *cr;
@@ -47,8 +37,6 @@ update_image (void)
cairo_font_options_t *fopt;
cairo_hint_style_t hintstyle;
cairo_hint_metrics_t hintmetrics;
cairo_antialias_t antialias;
cairo_path_t *path;
if (!context)
context = gtk_widget_create_pango_context (image);
@@ -77,13 +65,6 @@ update_image (void)
hintmetrics = CAIRO_HINT_METRICS_OFF;
cairo_font_options_set_hint_metrics (fopt, hintmetrics);
if (gtk_check_button_get_active (GTK_CHECK_BUTTON (anti_alias)))
antialias = CAIRO_ANTIALIAS_GRAY;
else
antialias = CAIRO_ANTIALIAS_NONE;
cairo_font_options_set_antialias (fopt, antialias);
pango_context_set_round_glyph_positions (context, hintmetrics == CAIRO_HINT_METRICS_ON);
pango_cairo_context_set_font_options (context, fopt);
cairo_font_options_destroy (fopt);
pango_context_changed (context);
@@ -94,6 +75,7 @@ update_image (void)
pango_layout_set_font_description (layout, desc);
pango_layout_set_text (layout, text, -1);
pango_layout_get_extents (layout, &ink, &logical);
pink = ink;
baseline = pango_layout_get_baseline (layout);
pango_extents_to_pixels (&ink, NULL);
@@ -103,14 +85,10 @@ update_image (void)
cairo_set_source_rgb (cr, 1, 1, 1);
cairo_paint (cr);
cairo_set_source_rgba (cr, 0, 0, 0, pixel_alpha);
cairo_set_source_rgb (cr, 0, 0, 0);
cairo_move_to (cr, 10, 10);
pango_cairo_show_layout (cr, layout);
pango_cairo_layout_path (cr, layout);
path = cairo_copy_path (cr);
cairo_destroy (cr);
g_object_unref (layout);
@@ -149,7 +127,7 @@ update_image (void)
if (gtk_check_button_get_active (GTK_CHECK_BUTTON (show_extents)))
{
cairo_set_source_rgb (cr, 0, 0, 1);
cairo_set_source_rgba (cr, 0, 0, 1, 1);
cairo_rectangle (cr,
scale * (10 + pango_units_to_double (logical.x)) - 0.5,
@@ -162,45 +140,17 @@ update_image (void)
cairo_line_to (cr, scale * (10 + pango_units_to_double (logical.x + logical.width)) + 1,
scale * (10 + pango_units_to_double (baseline)) - 0.5);
cairo_stroke (cr);
cairo_set_source_rgb (cr, 1, 0, 0);
cairo_set_source_rgba (cr, 1, 0, 0, 1);
cairo_rectangle (cr,
scale * (10 + ink.x) - 0.5,
scale * (10 + ink.y) - 0.5,
scale * ink.width + 1,
scale * ink.height + 1);
scale * (10 + pango_units_to_double (pink.x)) + 0.5,
scale * (10 + pango_units_to_double (pink.y)) + 0.5,
scale * pango_units_to_double (pink.width) - 1,
scale * pango_units_to_double (pink.height) - 1);
cairo_stroke (cr);
}
for (int i = 0; i < path->num_data; i += path->data[i].header.length)
{
cairo_path_data_t *data = &path->data[i];
switch (data->header.type)
{
case CAIRO_PATH_CURVE_TO:
data[3].point.x *= scale; data[3].point.y *= scale;
data[2].point.x *= scale; data[2].point.y *= scale;
data[1].point.x *= scale; data[1].point.y *= scale;
break;
case CAIRO_PATH_LINE_TO:
case CAIRO_PATH_MOVE_TO:
data[1].point.x *= scale; data[1].point.y *= scale;
break;
case CAIRO_PATH_CLOSE_PATH:
break;
default:
g_assert_not_reached ();
}
}
cairo_set_source_rgba (cr, 0, 0, 0, outline_alpha);
cairo_move_to (cr, scale * 20 - 0.5, scale * 20 - 0.5);
cairo_append_path (cr, path);
cairo_stroke (cr);
cairo_surface_destroy (surface);
cairo_destroy (cr);
cairo_path_destroy (path);
}
else
{
@@ -208,26 +158,10 @@ update_image (void)
PangoLayoutRun *run;
PangoGlyphInfo *g;
int i, j;
GString *str;
gunichar ch;
if (*text == '\0')
text = " ";
ch = g_utf8_get_char (text);
str = g_string_new ("");
for (i = 0; i < 4; i++)
{
g_string_append_unichar (str, ch);
g_string_append_unichar (str, 0x200c);
}
layout = pango_layout_new (context);
pango_layout_set_font_description (layout, desc);
pango_layout_set_text (layout, str->str, -1);
g_string_free (str, TRUE);
pango_layout_set_text (layout, "aaaa", -1);
pango_layout_get_extents (layout, &ink, &logical);
pango_extents_to_pixels (&logical, NULL);
@@ -242,7 +176,7 @@ update_image (void)
cairo_set_source_rgb (cr, 0, 0, 0);
for (i = 0; i < 4; i++)
{
g = &(run->glyphs->glyphs[2*i]);
g = &(run->glyphs->glyphs[i]);
g->geometry.width = PANGO_UNITS_ROUND (g->geometry.width * 3 / 2);
}
@@ -250,7 +184,7 @@ update_image (void)
{
for (i = 0; i < 4; i++)
{
g = &(run->glyphs->glyphs[2*i]);
g = &(run->glyphs->glyphs[i]);
g->geometry.x_offset = i * (PANGO_SCALE / 4);
g->geometry.y_offset = j * (PANGO_SCALE / 4);
}
@@ -269,6 +203,7 @@ update_image (void)
cairo_surface_destroy (surface);
}
gtk_picture_set_pixbuf (GTK_PICTURE (image), pixbuf2);
g_object_unref (pixbuf2);
@@ -276,78 +211,6 @@ update_image (void)
pango_font_description_free (desc);
}
static gboolean fading = FALSE;
static double start_pixel_alpha;
static double end_pixel_alpha;
static double start_outline_alpha;
static double end_outline_alpha;
static gint64 start_time;
static gint64 end_time;
static double
ease_out_cubic (double t)
{
double p = t - 1;
return p * p * p + 1;
}
static gboolean
change_alpha (GtkWidget *widget,
GdkFrameClock *clock,
gpointer user_data)
{
gint64 now = g_get_monotonic_time ();
double t;
t = ease_out_cubic ((now - start_time) / (double) (end_time - start_time));
pixel_alpha = start_pixel_alpha + (end_pixel_alpha - start_pixel_alpha) * t;
outline_alpha = start_outline_alpha + (end_outline_alpha - start_outline_alpha) * t;
update_image ();
if (now >= end_time)
{
fading = FALSE;
return G_SOURCE_REMOVE;
}
return G_SOURCE_CONTINUE;
}
static void
start_alpha_fade (void)
{
gboolean pixels;
gboolean outlines;
if (fading)
return;
pixels = gtk_check_button_get_active (GTK_CHECK_BUTTON (show_pixels));
outlines = gtk_check_button_get_active (GTK_CHECK_BUTTON (show_outlines));
start_pixel_alpha = pixel_alpha;
if (pixels && outlines)
end_pixel_alpha = 0.5;
else if (pixels)
end_pixel_alpha = 1;
else
end_pixel_alpha = 0;
start_outline_alpha = outline_alpha;
if (outlines)
end_outline_alpha = 1.0;
else
end_outline_alpha = 0.0;
start_time = g_get_monotonic_time ();
end_time = start_time + G_TIME_SPAN_SECOND / 2;
fading = TRUE;
gtk_widget_add_tick_callback (window, change_alpha, NULL, NULL);
}
static void
update_buttons (void)
{
@@ -355,26 +218,20 @@ update_buttons (void)
gtk_widget_set_sensitive (down_button, scale > 1);
}
static gboolean
scale_up (GtkWidget *widget,
GVariant *args,
gpointer user_data)
static void
scale_up (void)
{
scale += 1;
update_buttons ();
update_image ();
return TRUE;
}
static gboolean
scale_down (GtkWidget *widget,
GVariant *args,
gpointer user_data)
static void
scale_down (void)
{
scale -= 1;
update_buttons ();
update_image ();
return TRUE;
}
GtkWidget *
@@ -395,26 +252,20 @@ do_fontrendering (GtkWidget *do_widget)
entry = GTK_WIDGET (gtk_builder_get_object (builder, "entry"));
image = GTK_WIDGET (gtk_builder_get_object (builder, "image"));
hinting = GTK_WIDGET (gtk_builder_get_object (builder, "hinting"));
anti_alias = GTK_WIDGET (gtk_builder_get_object (builder, "antialias"));
hint_metrics = GTK_WIDGET (gtk_builder_get_object (builder, "hint_metrics"));
text_radio = GTK_WIDGET (gtk_builder_get_object (builder, "text_radio"));
show_grid = GTK_WIDGET (gtk_builder_get_object (builder, "show_grid"));
show_extents = GTK_WIDGET (gtk_builder_get_object (builder, "show_extents"));
show_pixels = GTK_WIDGET (gtk_builder_get_object (builder, "show_pixels"));
show_outlines = GTK_WIDGET (gtk_builder_get_object (builder, "show_outlines"));
g_signal_connect (up_button, "clicked", G_CALLBACK (scale_up), NULL);
g_signal_connect (down_button, "clicked", G_CALLBACK (scale_down), NULL);
g_signal_connect (entry, "notify::text", G_CALLBACK (update_image), NULL);
g_signal_connect (font_button, "notify::font-desc", G_CALLBACK (update_image), NULL);
g_signal_connect (hinting, "notify::active", G_CALLBACK (update_image), NULL);
g_signal_connect (anti_alias, "notify::active", G_CALLBACK (update_image), NULL);
g_signal_connect (hint_metrics, "notify::active", G_CALLBACK (update_image), NULL);
g_signal_connect (text_radio, "notify::active", G_CALLBACK (update_image), NULL);
g_signal_connect (show_grid, "notify::active", G_CALLBACK (update_image), NULL);
g_signal_connect (show_extents, "notify::active", G_CALLBACK (update_image), NULL);
g_signal_connect (show_pixels, "notify::active", G_CALLBACK (start_alpha_fade), NULL);
g_signal_connect (show_outlines, "notify::active", G_CALLBACK (start_alpha_fade), NULL);
update_image ();

View File

@@ -1,8 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkAdjustment" id="scale_adj">
<property name="upper">24</property>
<property name="step-increment">1</property>
<property name="page-increment">4</property>
</object>
<object class="GtkWindow" id="window">
<property name="default-width">1024</property>
<property name="default-height">768</property>
<property name="default-width">1080</property>
<property name="default-height">430</property>
<child type="titlebar">
<object class="GtkHeaderBar">
<child type="title">
@@ -82,119 +87,69 @@
</object>
</child>
<child>
<object class="GtkCheckButton" id="show_pixels">
<property name="label">Show _Pixels</property>
<property name="use-underline">1</property>
<property name="active">1</property>
<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>
<property name="row">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkCheckButton" id="show_outlines">
<property name="label">Show _Outline</property>
<property name="use-underline">1</property>
<layout>
<property name="column">3</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkBox">
<property name="spacing">6</property>
<child>
<object class="GtkLabel">
<property name="label">_Hinting</property>
<property name="use-underline">1</property>
<property name="mnemonic-widget">hinting</property>
<style>
<class name="dim-label"/>
</style>
</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>
</object>
</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>
<property name="column-span">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkCheckButton" id="antialias">
<property name="label">_Antialias</property>
<property name="use-underline">1</property>
<property name="active">1</property>
<layout>
<property name="column">4</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkCheckButton" id="hint_metrics">
<property name="label">Hint _Metrics</property>
<property name="use-underline">1</property>
<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="GtkCheckButton" id="show_extents">
<property name="label">Show _Extents</property>
<property name="use-underline">1</property>
<layout>
<property name="column">6</property>
<property name="row">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkCheckButton" id="show_grid">
<property name="label">Show _Grid</property>
<property name="use-underline">1</property>
<layout>
<property name="column">6</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkButton" id="up_button">
<property name="icon-name">list-add-symbolic</property>
<property name="halign">center</property>
<property name="valign">center</property>
<style>
<class name="circular"/>
</style>
<child>
<object class="GtkShortcutController">
<property name="scope">managed</property>
<child>
<object class="GtkShortcut">
<property name="trigger">&lt;Control&gt;plus</property>
<property name="action">activate</property>
</object>
</child>
</object>
</child>
<layout>
<property name="column">7</property>
<property name="column">6</property>
<property name="row">0</property>
</layout>
</object>
@@ -202,24 +157,11 @@
<child>
<object class="GtkButton" id="down_button">
<property name="icon-name">list-remove-symbolic</property>
<property name="halign">center</property>
<property name="valign">center</property>
<style>
<class name="circular"/>
</style>
<child>
<object class="GtkShortcutController">
<property name="scope">managed</property>
<child>
<object class="GtkShortcut">
<property name="trigger">&lt;Control&gt;minus</property>
<property name="action">activate</property>
</object>
</child>
</object>
</child>
<layout>
<property name="column">7</property>
<property name="column">6</property>
<property name="row">1</property>
</layout>
</object>
@@ -228,7 +170,7 @@
<object class="GtkLabel">
<property name="hexpand">1</property>
<layout>
<property name="column">8</property>
<property name="column">7</property>
</layout>
</object>
</child>

View File

@@ -23,10 +23,13 @@
#include "gskshaderpaintable.h"
/**
* GskShaderPaintable:
* SECTION:gskshaderpaintable
* @Short_description: Drawing with shaders
* @Title: GskShaderPaintable
* @see_also: #GdkPaintable
*
* `GskShaderPaintable` is an implementation of the `GdkPaintable` interface
* that uses a `GskGLShader` to create pixels.
* GskShaderPaintable is an implementation of the #GdkPaintable interface
* that uses a #GskGLShader to create pixels.
*
* You can set the uniform data that the shader needs for rendering
* using gsk_shader_paintable_set_args(). This function can
@@ -35,7 +38,7 @@
*
* Commonly, time is passed to shaders as a float uniform containing
* the elapsed time in seconds. The convenience API
* gsk_shader_paintable_update_time() can be called from a `GtkTickCallback`
* gsk_shader_paintable_update_time() can be called from a #GtkTickCallback
* to update the time based on the frame time of the frame clock.
*/
@@ -183,7 +186,7 @@ gsk_shader_paintable_init (GskShaderPaintable *self)
* pixels. The shader must not require input textures.
* If @data is %NULL, all uniform values are set to zero.
*
* Returns: (transfer full): a new `GskShaderPaintable`
* Returns: (transfer full): a new #GskShaderPaintable
*/
GdkPaintable *
gsk_shader_paintable_new (GskGLShader *shader,
@@ -212,8 +215,8 @@ gsk_shader_paintable_new (GskGLShader *shader,
/**
* gsk_shader_paintable_set_shader:
* @self: a `GskShaderPaintable`
* @shader: the `GskGLShader` to use
* @self: a #GskShaderPaintable
* @shader: the #GskGLShader to use
*
* Sets the shader that the paintable will use
* to create pixels. The shader must not require
@@ -238,11 +241,11 @@ gsk_shader_paintable_set_shader (GskShaderPaintable *self,
/**
* gsk_shader_paintable_get_shader:
* @self: a `GskShaderPaintable`
* @self: a #GskShaderPaintable
*
* Returns the shader that the paintable is using.
*
* Returns: (transfer none): the `GskGLShader` that is used
* Returns: (transfer none): the #GskGLShader that is used
*/
GskGLShader *
gsk_shader_paintable_get_shader (GskShaderPaintable *self)
@@ -254,12 +257,12 @@ gsk_shader_paintable_get_shader (GskShaderPaintable *self)
/**
* gsk_shader_paintable_set_args:
* @self: a `GskShaderPaintable`
* @self: a #GskShaderPaintable
* @data: Data block with uniform data for the shader
*
* Sets the uniform data that will be passed to the
* shader when rendering. The @data will typically
* be produced by a `GskUniformDataBuilder`.
* be produced by a #GskUniformDataBuilder.
*
* Note that the @data should be considered immutable
* after it has been passed to this function.
@@ -281,7 +284,7 @@ gsk_shader_paintable_set_args (GskShaderPaintable *self,
/**
* gsk_shader_paintable_get_args:
* @self: a `GskShaderPaintable`
* @self: a #GskShaderPaintable
*
* Returns the uniform data set with
* gsk_shader_paintable_get_args().
@@ -298,9 +301,9 @@ gsk_shader_paintable_get_args (GskShaderPaintable *self)
/**
* gsk_shader_paintable_update_time:
* @self: a `GskShaderPaintable`
* @self: a #GskShaderPaintable
* @time_idx: the index of the uniform for time in seconds as float
* @frame_time: the current frame time, as returned by `GdkFrameClock`
* @frame_time: the current frame time, as returned by #GdkFrameClock
*
* This function is a convenience wrapper for
* gsk_shader_paintable_set_args() that leaves all
@@ -308,7 +311,7 @@ gsk_shader_paintable_get_args (GskShaderPaintable *self)
* index @time_idx, which will be set to the elapsed time
* in seconds, since the first call to this function.
*
* This function is usually called from a `GtkTickCallback`.
* This function is usually called from a #GtkTickCallback.
*/
void
gsk_shader_paintable_update_time (GskShaderPaintable *self,

View File

@@ -74,9 +74,9 @@ gtk_fishbowl_init (GtkFishbowl *fishbowl)
/**
* gtk_fishbowl_new:
*
* Creates a new `GtkFishbowl`.
* Creates a new #GtkFishbowl.
*
* Returns: a new `GtkFishbowl`.
* Returns: a new #GtkFishbowl.
*/
GtkWidget*
gtk_fishbowl_new (void)

View File

@@ -163,8 +163,8 @@ drag_update_cb (GtkGestureDrag *drag,
static void
drag_end_cb (GtkGestureDrag *drag,
double dx,
double dy,
gdouble dx,
gdouble dy,
gpointer user_data)
{
GtkShadertoy *shadertoy = GTK_SHADERTOY (user_data);

View File

@@ -18,6 +18,8 @@ do_headerbar (GtkWidget *do_widget)
GtkWidget *header;
GtkWidget *button;
GtkWidget *box;
GtkWidget *image;
GIcon *icon;
if (!window)
{
@@ -30,14 +32,20 @@ do_headerbar (GtkWidget *do_widget)
header = gtk_header_bar_new ();
button = gtk_button_new_from_icon_name ("mail-send-receive-symbolic");
button = gtk_button_new ();
icon = g_themed_icon_new ("mail-send-receive-symbolic");
image = gtk_image_new_from_gicon (icon);
g_object_unref (icon);
gtk_button_set_child (GTK_BUTTON (button), image);
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_add_css_class (box, "linked");
button = gtk_button_new_from_icon_name ("go-previous-symbolic");
button = gtk_button_new ();
gtk_button_set_child (GTK_BUTTON (button), gtk_image_new_from_icon_name ("pan-start-symbolic"));
gtk_box_append (GTK_BOX (box), button);
button = gtk_button_new_from_icon_name ("go-next-symbolic");
button = gtk_button_new ();
gtk_button_set_child (GTK_BUTTON (button), gtk_image_new_from_icon_name ("pan-end-symbolic"));
gtk_box_append (GTK_BOX (box), button);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), box);

View File

@@ -61,26 +61,12 @@ show_page (GtkTextView *text_view,
int page)
{
GtkTextBuffer *buffer;
GtkTextIter iter, start;
GtkTextMark *mark;
GtkTextIter iter;
GtkWidget *child;
GtkTextChildAnchor *anchor;
GtkEventController *controller;
GtkTextTag *bold, *mono, *nobreaks;
buffer = gtk_text_view_get_buffer (text_view);
bold = gtk_text_buffer_create_tag (buffer, NULL,
"weight", PANGO_WEIGHT_BOLD,
"scale", PANGO_SCALE_X_LARGE,
NULL);
mono = gtk_text_buffer_create_tag (buffer, NULL,
"family", "monospace",
NULL);
nobreaks = gtk_text_buffer_create_tag (buffer, NULL,
"allow-breaks", FALSE,
NULL);
gtk_text_buffer_set_text (buffer, "", 0);
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0);
gtk_text_buffer_begin_irreversible_action (buffer);
@@ -118,22 +104,17 @@ show_page (GtkTextView *text_view,
}
else if (page == 2)
{
mark = gtk_text_buffer_create_mark (buffer, "mark", &iter, TRUE);
GtkTextTag *tag;
gtk_text_buffer_insert_with_tags (buffer, &iter, "tag", -1, bold, NULL);
gtk_text_buffer_insert (buffer, &iter, " /", -1);
gtk_text_buffer_get_iter_at_mark (buffer, &start, mark);
gtk_text_buffer_apply_tag (buffer, nobreaks, &start, &iter);
gtk_text_buffer_insert (buffer, &iter, " ", -1);
gtk_text_buffer_move_mark (buffer, mark, &iter);
gtk_text_buffer_insert_with_tags (buffer, &iter, "tag", -1, mono, NULL);
gtk_text_buffer_insert (buffer, &iter, " /", -1);
gtk_text_buffer_get_iter_at_mark (buffer, &start, mark);
gtk_text_buffer_apply_tag (buffer, nobreaks, &start, &iter);
gtk_text_buffer_insert (buffer, &iter, " ", -1);
tag = gtk_text_buffer_create_tag (buffer, NULL,
"weight", PANGO_WEIGHT_BOLD,
"scale", PANGO_SCALE_X_LARGE,
NULL);
gtk_text_buffer_insert_with_tags (buffer, &iter, "tag", -1, tag, NULL);
tag = gtk_text_buffer_create_tag (buffer, NULL,
"family", "monospace",
NULL);
gtk_text_buffer_insert_with_tags (buffer, &iter, " /tag/ ", -1, tag, NULL);
anchor = gtk_text_buffer_create_child_anchor (buffer, &iter);
child = gtk_image_new_from_icon_name ("audio-volume-high-symbolic");
@@ -151,26 +132,20 @@ show_page (GtkTextView *text_view,
"behavior of mouse and key presses, “lock” a range of text so the "
"user can't edit it, or countless other things.\n", -1);
insert_link (buffer, &iter, "Go back", 1);
gtk_text_buffer_delete_mark (buffer, mark);
}
else if (page == 3)
{
mark = gtk_text_buffer_create_mark (buffer, "mark", &iter, TRUE);
GtkTextTag *tag;
gtk_text_buffer_insert_with_tags (buffer, &iter, "hypertext", -1, bold, NULL);
gtk_text_buffer_insert (buffer, &iter, " /", -1);
gtk_text_buffer_get_iter_at_mark (buffer, &start, mark);
gtk_text_buffer_apply_tag (buffer, nobreaks, &start, &iter);
gtk_text_buffer_insert (buffer, &iter, " ", -1);
gtk_text_buffer_move_mark (buffer, mark, &iter);
gtk_text_buffer_insert_with_tags (buffer, &iter, "ˈhaɪ pərˌtɛkst", -1, mono, NULL);
gtk_text_buffer_insert (buffer, &iter, " /", -1);
gtk_text_buffer_get_iter_at_mark (buffer, &start, mark);
gtk_text_buffer_apply_tag (buffer, nobreaks, &start, &iter);
gtk_text_buffer_insert (buffer, &iter, " ", -1);
tag = gtk_text_buffer_create_tag (buffer, NULL,
"weight", PANGO_WEIGHT_BOLD,
"scale", PANGO_SCALE_X_LARGE,
NULL);
gtk_text_buffer_insert_with_tags (buffer, &iter, "hypertext", -1, tag, NULL);
tag = gtk_text_buffer_create_tag (buffer, NULL,
"family", "monospace",
NULL);
gtk_text_buffer_insert_with_tags (buffer, &iter, " /ˈhaɪ pərˌtɛkst/ ", -1, tag, NULL);
anchor = gtk_text_buffer_create_child_anchor (buffer, &iter);
child = gtk_image_new_from_icon_name ("audio-volume-high-symbolic");
@@ -184,8 +159,6 @@ show_page (GtkTextView *text_view,
"Machine-readable text that is not sequential but is organized "
"so that related items of information are connected.\n", -1);
insert_link (buffer, &iter, "Go back", 1);
gtk_text_buffer_delete_mark (buffer, mark);
}
gtk_text_buffer_end_irreversible_action (buffer);
}
@@ -385,7 +358,7 @@ do_hypertext (GtkWidget *do_widget)
sw = gtk_scrolled_window_new ();
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_window_set_child (GTK_WINDOW (window), sw);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view);

View File

@@ -116,25 +116,20 @@ populate_emoji_text (void)
GtkWidget *textview;
GtkTextBuffer *buffer;
GString *s;
GtkTextIter iter;
s = g_string_sized_new (500 * 30 * 4);
s = g_string_sized_new (1000 * 30 * 4);
for (int i = 0; i < 500; i++)
for (int i = 0; i < 1000; i++)
{
if (i % 2)
g_string_append (s, "<span underline=\"single\" underline_color=\"red\">x</span>");
g_string_append (s, "x");
for (int j = 0; j < 30; j++)
{
g_string_append (s, "💓");
g_string_append (s, "<span underline=\"single\" underline_color=\"red\">x</span>");
}
g_string_append (s, "💓x");
g_string_append (s, "\n");
}
buffer = gtk_text_buffer_new (NULL);
gtk_text_buffer_get_start_iter (buffer, &iter);
gtk_text_buffer_insert_markup (buffer, &iter, s->str, s->len);
gtk_text_buffer_set_text (buffer, s->str, s->len);
g_string_free (s, TRUE);

View File

@@ -13,13 +13,13 @@
</style>
<child>
<object class="GtkButton">
<property name="icon-name">go-previous-symbolic</property>
<property name="icon-name">pan-start-symbolic</property>
<signal name="clicked" handler="iconscroll_prev_clicked_cb"/>
</object>
</child>
<child>
<object class="GtkButton">
<property name="icon-name">go-next-symbolic</property>
<property name="icon-name">pan-end-symbolic</property>
<signal name="clicked" handler="iconscroll_next_clicked_cb"/>
</object>
</child>

View File

@@ -8,7 +8,7 @@
#include <stdlib.h>
#include <string.h>
static GdkTexture *avatar_texture_other;
static GdkPixbuf *avatar_pixbuf_other;
static GtkWidget *window = NULL;
#define GTK_TYPE_MESSAGE (gtk_message_get_type ())
@@ -196,9 +196,12 @@ gtk_message_row_update (GtkMessageRow *row)
gtk_button_set_label (GTK_BUTTON (priv->resent_by_button), priv->message->resent_by);
if (strcmp (priv->message->sender_nick, "@GTKtoolkit") == 0)
gtk_image_set_from_icon_name (priv->avatar_image, "org.gtk.Demo4");
{
gtk_image_set_from_icon_name (priv->avatar_image, "org.gtk.Demo4");
gtk_image_set_icon_size (priv->avatar_image, GTK_ICON_SIZE_LARGE);
}
else
gtk_image_set_from_paintable (priv->avatar_image, GDK_PAINTABLE (avatar_texture_other));
gtk_image_set_from_pixbuf (priv->avatar_image, avatar_pixbuf_other);
}
@@ -341,7 +344,7 @@ do_listbox (GtkWidget *do_widget)
if (!window)
{
avatar_texture_other = gdk_texture_new_from_resource ("/listbox/apple-red.png");
avatar_pixbuf_other = gdk_pixbuf_new_from_resource_at_scale ("/listbox/apple-red.png", 32, 32, FALSE, NULL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),

View File

@@ -25,7 +25,6 @@
<property name="margin-start">8</property>
<property name="margin-end">8</property>
<property name="icon-name">image-missing</property>
<property name="icon-size">large</property>
<layout>
<property name="column">0</property>
<property name="row">0</property>

View File

@@ -8,8 +8,8 @@
#include <gtk/gtk.h>
/* This is the function that creates the GListModel that we need.
* GTK list widgets need a GListModel to display, as models support change
/* This is the function that creates the #GListModel that we need.
* GTK list widgets need a #GListModel to display, as models support change
* notifications.
* Unfortunately various older APIs do not provide list models, so we create
* our own.
@@ -20,10 +20,10 @@ create_application_list (void)
GListStore *store;
GList *apps, *l;
/* We use a GListStore here, which is a simple array-like list implementation
/* We use a #GListStore here, which is a simple array-like list implementation
* for manual management.
* List models need to know what type of data they provide, so we need to
* provide the type here. As we want to do a list of applications, GAppInfo
* provide the type here. As we want to do a list of applications, #GAppInfo
* is the object we provide.
*/
store = g_list_store_new (G_TYPE_APP_INFO);
@@ -39,7 +39,7 @@ create_application_list (void)
}
/* This is the function we use for setting up new listitems to display.
* We add just an GtkImage and a GtkLabel here to display the application's
* We add just an #GtkImage and a #GtkLabel here to display the application's
* icon and name, as this is just a simple demo.
*/
static void
@@ -61,8 +61,8 @@ setup_listitem_cb (GtkListItemFactory *factory,
/* Here we need to prepare the listitem for displaying its item. We get the
* listitem already set up from the previous function, so we can reuse the
* GtkImage widget we set up above.
* We get the item - which we know is a GAppInfo because it comes out of
* #GtkImage widget we set up above.
* We get the item - which we know is a #GAppInfo because it comes out of
* the model we set up above, grab its icon and display it.
*/
static void
@@ -85,7 +85,7 @@ bind_listitem_cb (GtkListItemFactory *factory,
* the listitem, but this is simple code, so the default implementations are
* enough. If we had connected signals, this step would have been necessary.
*
* The GtkSignalListItemFactory documentation contains more information about
* The #GtkSignalListItemFactory documentation contains more information about
* this step.
*/
@@ -108,8 +108,8 @@ activate_cb (GtkListView *list,
app_info = g_list_model_get_item (G_LIST_MODEL (gtk_list_view_get_model (list)), position);
/* Prepare the context for launching the application and launch it. This
* code is explained in detail in the documentation for GdkAppLaunchContext
* and GAppInfo.
* code is explained in detail in the documentation for #GdkAppLaunchContext
* and #GAppInfo.
*/
context = gdk_display_get_app_launch_context (gtk_widget_get_display (GTK_WIDGET (list)));
if (!g_app_info_launch (app_info,
@@ -155,13 +155,13 @@ do_listview_applauncher (GtkWidget *do_widget)
gtk_window_set_title (GTK_WINDOW (window), "Application Launcher");
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *) &window);
/* The GtkListitemFactory is what is used to create GtkListItems
/* The #GtkListitemFactory is what is used to create #GtkListItems
* to display the data from the model. So it is absolutely necessary
* to create one.
* We will use a GtkSignalListItemFactory because it is the simplest
* We will use a #GtkSignalListItemFactory because it is the simplest
* one to use. Different ones are available for different use cases.
* The most powerful one is GtkBuilderListItemFactory which uses
* GtkBuilder .ui files, so it requires little code.
* The most powerful one is #GtkBuilderListItemFactory which uses
* #GtkBuilder .ui files, so it requires little code.
*/
factory = gtk_signal_list_item_factory_new ();
g_signal_connect (factory, "setup", G_CALLBACK (setup_listitem_cb), NULL);
@@ -184,7 +184,7 @@ do_listview_applauncher (GtkWidget *do_widget)
*/
g_signal_connect (list, "activate", G_CALLBACK (activate_cb), NULL);
/* List widgets should always be contained in a GtkScrolledWindow,
/* List widgets should always be contained in a #GtkScrolledWindow,
* because otherwise they might get too large or they might not
* be scrollable.
*/

View File

@@ -34,7 +34,6 @@ enum {
};
#define FILE_BROWSER_TYPE_VIEW (file_browser_view_get_type ())
G_MODULE_EXPORT
G_DECLARE_FINAL_TYPE (FileBrowserView, file_browser_view, FILE_BROWSER, VIEW, GObject);
G_DEFINE_TYPE (FileBrowserView, file_browser_view, G_TYPE_OBJECT);
@@ -160,7 +159,7 @@ static void file_browser_view_init (FileBrowserView *self)
{
}
G_MODULE_EXPORT char *
char *
filebrowser_get_display_name (GObject *object,
GFileInfo *info)
{
@@ -170,7 +169,7 @@ filebrowser_get_display_name (GObject *object,
return g_strdup (g_file_info_get_attribute_string (info, "standard::display-name"));
}
G_MODULE_EXPORT char *
char *
filebrowser_get_content_type (GObject *object,
GFileInfo *info)
{
@@ -180,7 +179,7 @@ filebrowser_get_content_type (GObject *object,
return g_strdup (g_file_info_get_attribute_string (info, "standard::content-type"));
}
G_MODULE_EXPORT char *
char *
filebrowser_get_size (GObject *object,
GFileInfo *info)
{
@@ -190,7 +189,7 @@ filebrowser_get_size (GObject *object,
return g_format_size (g_file_info_get_attribute_uint64 (info, "standard::size"));
}
G_MODULE_EXPORT GIcon *
GIcon *
filebrowser_get_icon (GObject *object,
GFileInfo *info)
{
@@ -207,7 +206,7 @@ filebrowser_get_icon (GObject *object,
return icon;
}
G_MODULE_EXPORT void
void
filebrowser_up_clicked_cb (GtkButton *button,
GtkDirectoryList *list)
{
@@ -220,7 +219,7 @@ filebrowser_up_clicked_cb (GtkButton *button,
gtk_directory_list_set_file (list, file);
}
G_MODULE_EXPORT void
void
filebrowser_view_activated_cb (GtkGridView *view,
guint pos,
GtkDirectoryList *list)

View File

@@ -751,6 +751,7 @@ demo_filter_by_name (gpointer item,
gpointer user_data)
{
GtkTreeListRow *row = item;
GtkFilterListModel *model = user_data;
GListModel *children;
GtkDemo *demo;
guint i, n;
@@ -761,7 +762,7 @@ demo_filter_by_name (gpointer item,
return TRUE;
g_assert (GTK_IS_TREE_LIST_ROW (row));
g_assert (GTK_IS_FILTER_LIST_MODEL (user_data));
g_assert (GTK_IS_FILTER_LIST_MODEL (model));
/* Show a row if itself of any parent matches */
for (parent = row; parent; parent = gtk_tree_list_row_get_parent (parent))

View File

@@ -25,7 +25,6 @@
<object class="GtkButton">
<property name="valign">center</property>
<property name="action-name">win.run</property>
<property name="focus-on-click">0</property>
<property name="label" translatable="yes">Run</property>
</object>
</child>
@@ -33,7 +32,6 @@
<object class="GtkToggleButton">
<property name="icon-name">edit-find-symbolic</property>
<property name="valign">center</property>
<property name="focus-on-click">0</property>
<property name="active" bind-source="searchbar" bind-property="search-mode-enabled" bind-flags="bidirectional|sync-create"/>
<accessibility>
<property name="label" translatable="yes">Search</property>
@@ -43,7 +41,6 @@
<child type="end">
<object class="GtkMenuButton" id="gear_menu_button">
<property name="valign">center</property>
<property name="focus-on-click">0</property>
<property name="menu-model">gear_menu</property>
<property name="icon-name">open-menu-symbolic</property>
<accessibility>

View File

@@ -58,7 +58,7 @@ do_markup (GtkWidget *do_widget)
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), 600, 680);
gtk_window_set_default_size (GTK_WINDOW (window), 450, 450);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
stack = gtk_stack_new ();

View File

@@ -1,9 +1,5 @@
Text sizes: <span size="xx-small">tiny </span><span size="x-small">very small </span><span size="small">small </span><span size="medium">normal </span><span size="large">large </span><span size="x-large">very large </span><span size="xx-large">huge</span>
Text styles: <span style="normal">Normal</span> <span style="italic">Italic</span> <span style="oblique">Olique</span>
Text weights: <span weight="thin">thin</span> <span weight="light">light</span> <span weight="normal">normal</span> <span weight="bold">bold</span> <span weight="ultraheavy">ultraheavy</span>
Text sizes: <span size="xx-small">tiny</span> <span size="x-small">very small</span> <span size="small">small</span> <span size="medium">normal</span> <span size="large">large</span> <span size="x-large">very large</span> <span size="xx-large">huge</span>
Text <span color="gray">c<span color="green">o</span>l<span color="tomato">o</span>rs</span> and <span background="pink">backgrounds</span>
@@ -19,12 +15,6 @@ OpenType font features: <span font_desc="sans regular" font_features="dlig=0">fe
Shortcuts: <tt>Monospace</tt> <b>Bold</b> <i>Italic</i> <big>Big</big> <small>Small</small> <u>Underlined</u> <s>Strikethrough</s> Super<sup>script</sup> Sub<sub>script</sub>
hy­phen­ation al­go­rithm is a <span allow_breaks="false" style="italic">set of rules</span>, espe­ci­ally one co­di­fied for im­ple­men­tation in a com­pu­ter pro­gram, that de­ci­des at which points a word can be bro­ken over two lines with a hy­phen. For ex­am­ple, a hy­phen­ation al­go­rithm might de­cide that im­peach­ment can be broken as impeach‧ment or im‧peachment but not impe‧achment.
<span allow_breaks="false">A</span> hy­phen­ation al­go­rithm is a set of rules, espe­ci­ally one co­di­fied for im­ple­men­tation in a com­pu­ter pro­gram, that de­ci­des at which points a word can be bro­ken over two lines with a hy­phen. For ex­am­ple, a hy­phen­ation al­go­rithm might de­cide that im­peach­ment can be broken as <span allow_breaks="false">impeach‧ment</span> or <span allow_breaks="false">im‧peachment</span> but not <span allow_breaks="false">impe‧achment.</span>
<span insert_hyphens="false">one/two three/four five/six seven/eight nine/ten</span>
<span line_height='1.33'>Line height: This is an example of widely spaced text. It was achieved by setting the line-height factor to 1.33. You can set the line-height factor to any value between 0 and 10.
Note that the line height affects the spacing between paragraphs as well as between the wrapped lines inside a paragraph.</span>
Transforms: <span text_transform='uppercase'>straße</span> <span text_transform='capitalize'>up, up and away</span>

View File

@@ -21,10 +21,8 @@ do_menu (GtkWidget *do_widget)
if (!window)
{
GtkWidget *box;
GtkWidget *sw;
GtkWidget *widget;
GtkWidget *scale;
window = gtk_window_new ();
gtk_window_set_title (GTK_WINDOW (window), "Menu");
@@ -33,23 +31,11 @@ do_menu (GtkWidget *do_widget)
gtk_widget_get_display (do_widget));
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_window_set_child (GTK_WINDOW (window), box);
sw = gtk_scrolled_window_new ();
gtk_widget_set_vexpand (sw, TRUE);
gtk_box_append (GTK_BOX (box), sw);
gtk_window_set_child (GTK_WINDOW (window), sw);
widget = demo3_widget_new ("/transparent/portland-rose.jpg");
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), widget);
scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0.01, 10.0, 0.1);
gtk_range_set_value (GTK_RANGE (scale), 1.0);
gtk_box_append (GTK_BOX (box), scale);
g_object_bind_property (gtk_range_get_adjustment (GTK_RANGE (scale)), "value",
widget, "scale",
G_BINDING_BIDIRECTIONAL);
}
if (!gtk_widget_get_visible (window))

View File

@@ -67,7 +67,6 @@ demos = files([
'paintable_animated.c',
'paintable_emblem.c',
'paintable_mediastream.c',
'paintable_symbolic.c',
'panes.c',
'password_entry.c',
'peg_solitaire.c',
@@ -206,9 +205,4 @@ install_data('org.gtk.Demo4.gschema.xml', install_dir: gtk_schemasdir)
gnome.compile_schemas()
# appdata
configure_file(
input: 'org.gtk.Demo4.appdata.xml.in',
output: 'org.gtk.Demo4.appdata.xml',
configuration: appdata_config,
install_dir: gtk_appdatadir
)
install_data('org.gtk.Demo4.appdata.xml', install_dir: gtk_appdatadir)

View File

@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<id>org.gtk.Demo4</id>
<launchable type="desktop-id">org.gtk.Demo4.desktop</launchable>
<id>org.gtk.Demo4.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>LGPL-2.1-or-later</project_license>
<project_license>LGPL-2.0+</project_license>
<name>GTK Demo</name>
<summary>Program to demonstrate GTK functions</summary>
<description>
@@ -31,11 +30,15 @@
<translation type="gettext">gtk-4.0</translation>
<update_contact>matthias.clasen_at_gmail.com</update_contact>
<developer_name>Matthias Clasen and others</developer_name>
<content_rating type="oars-1.1"/>
<releases>
<release version="@BUILD_VERSION@" date="@BUILD_DATE@">
<release version="3.99.0" date="2020-07-30">
<description>
<p>A new build of GTK.</p>
<p>A new developers snapshot towards GTK 4.0.</p>
</description>
</release>
<release version="3.94.0" date="2018-06-25">
<description>
<p>A new developers snapshot towards GTK 4.0.</p>
</description>
</release>
</releases>

View File

@@ -45,27 +45,26 @@ struct _GtkNuclearIconClass
* so that it can be called from all the other demos, too.
*/
void
gtk_nuclear_snapshot (GtkSnapshot *snapshot,
const GdkRGBA *foreground,
const GdkRGBA *background,
double width,
double height,
double rotation)
gtk_nuclear_snapshot (GtkSnapshot *snapshot,
double width,
double height,
double rotation,
gboolean draw_background)
{
#define RADIUS 0.3
cairo_t *cr;
double size;
gtk_snapshot_append_color (snapshot,
background,
&GRAPHENE_RECT_INIT (0, 0, width, height));
if (draw_background)
gtk_snapshot_append_color (snapshot,
&(GdkRGBA) { 0.9, 0.75, 0.15, 1.0 },
&GRAPHENE_RECT_INIT (0, 0, width, height));
size = MIN (width, height);
cr = gtk_snapshot_append_cairo (snapshot,
&GRAPHENE_RECT_INIT ((width - size) / 2.0,
(height - size) / 2.0,
size, size));
gdk_cairo_set_source_rgba (cr, foreground);
cairo_translate (cr, width / 2.0, height / 2.0);
cairo_scale (cr, size, size);
cairo_rotate (cr, rotation);
@@ -95,10 +94,9 @@ gtk_nuclear_icon_snapshot (GdkPaintable *paintable,
*/
gtk_nuclear_snapshot (snapshot,
&(GdkRGBA) { 0, 0, 0, 1 }, /* black */
&(GdkRGBA) { 0.9, 0.75, 0.15, 1.0 }, /* yellow */
width, height,
nuclear->rotation);
nuclear->rotation,
TRUE);
}
static GdkPaintableFlags

View File

@@ -4,11 +4,10 @@
#include <gtk/gtk.h>
void gtk_nuclear_snapshot (GtkSnapshot *snapshot,
const GdkRGBA *foreground,
const GdkRGBA *background,
double width,
double height,
double rotation);
double rotation,
gboolean draw_background);
GdkPaintable * gtk_nuclear_icon_new (double rotation);
GdkPaintable * gtk_nuclear_animation_new (gboolean draw_background);

View File

@@ -65,12 +65,9 @@ gtk_nuclear_animation_snapshot (GdkPaintable *paintable,
/* We call the function from the previous example here. */
gtk_nuclear_snapshot (snapshot,
&(GdkRGBA) { 0, 0, 0, 1 }, /* black */
nuclear->draw_background
? &(GdkRGBA) { 0.9, 0.75, 0.15, 1.0 } /* yellow */
: &(GdkRGBA) { 0, 0, 0, 0 }, /* transparent */
width, height,
2 * G_PI * nuclear->progress / MAX_PROGRESS);
2 * G_PI * nuclear->progress / MAX_PROGRESS,
nuclear->draw_background);
}
static GdkPaintable *

View File

@@ -73,10 +73,9 @@ gtk_nuclear_media_stream_snapshot (GdkPaintable *paintable,
/* We call the function from the previous example here. */
gtk_nuclear_snapshot (snapshot,
&(GdkRGBA) { 0, 0, 0, 1 }, /* black */
&(GdkRGBA) { 0.9, 0.75, 0.15, 1.0 }, /* yellow */
width, height,
2 * G_PI * nuclear->progress / DURATION);
2 * G_PI * nuclear->progress / DURATION,
TRUE);
}
static GdkPaintable *
@@ -151,7 +150,7 @@ gtk_nuclear_media_stream_step (gpointer data)
* call our pause function to pause the stream.
*/
if (nuclear->progress >= DURATION)
gtk_media_stream_stream_ended (GTK_MEDIA_STREAM (nuclear));
gtk_media_stream_ended (GTK_MEDIA_STREAM (nuclear));
/* The timeout function is removed by the pause function,
* so we can just always return this value.
@@ -268,11 +267,11 @@ gtk_nuclear_media_stream_init (GtkNuclearMediaStream *nuclear)
* However, media streams need to tell GTK once they are initialized,
* so we do that here.
*/
gtk_media_stream_stream_prepared (GTK_MEDIA_STREAM (nuclear),
FALSE,
TRUE,
TRUE,
DURATION);
gtk_media_stream_prepared (GTK_MEDIA_STREAM (nuclear),
FALSE,
TRUE,
TRUE,
DURATION);
}
/* And finally, we add the simple constructor we declared in the header. */

View File

@@ -1,208 +0,0 @@
/* Paintable/Symbolic Paintable
*
* GdkPaintables can be made to follow the theme's colors. GTK calls
* icons that do this symbolic icons, paintables that want to have
* the same effect can implement the GtkSymbolicPaintable interface.
*
* We will adapt the original paintable example by adding the ability
* to recolor the paintable based on the symbolic colors.
*/
#include <gtk/gtk.h>
#include "paintable.h"
static GtkWidget *window = NULL;
/* First, add the boilerplate for the object itself.
* This part would normally go in the header.
*/
#define GTK_TYPE_NUCLEAR_SYMBOLIC (gtk_nuclear_symbolic_get_type ())
G_DECLARE_FINAL_TYPE (GtkNuclearSymbolic, gtk_nuclear_symbolic, GTK, NUCLEAR_SYMBOLIC, GObject)
/* Declare a few warning levels, so we can pick colors based on them */
typedef enum
{
WARNING_NONE,
WARNING_ALERT,
WARNING_EMERGENCY
} WarningLevel;
/* Declare the struct. */
struct _GtkNuclearSymbolic
{
GObject parent_instance;
WarningLevel warning_level;
};
struct _GtkNuclearSymbolicClass
{
GObjectClass parent_class;
};
/* Add a function to draw the nuclear icon in the given colors */
static void
gtk_nuclear_symbolic_snapshot_symbolic (GtkSymbolicPaintable *paintable,
GdkSnapshot *snapshot,
double width,
double height,
const GdkRGBA *colors,
gsize n_colors)
{
GtkNuclearSymbolic *self = GTK_NUCLEAR_SYMBOLIC (paintable);
static const GdkRGBA transparent = { 0, };
const GdkRGBA *bg_color;
/* select the right background color from the warning level */
switch (self->warning_level)
{
case WARNING_NONE:
bg_color = &transparent;
break;
case WARNING_ALERT:
bg_color = &colors[GTK_SYMBOLIC_COLOR_WARNING];
break;
case WARNING_EMERGENCY:
bg_color = &colors[GTK_SYMBOLIC_COLOR_ERROR];
break;
default:
/* This should never happen, but we better do defensive coding
* with this critical icon */
g_assert_not_reached ();
bg_color = &transparent;
break;
}
/* Draw the icon with the selected warning color */
gtk_nuclear_snapshot (snapshot,
&colors[GTK_SYMBOLIC_COLOR_FOREGROUND],
bg_color,
width, height,
0);
}
static void
gtk_nuclear_symbolic_symbolic_paintable_init (GtkSymbolicPaintableInterface *iface)
{
iface->snapshot_symbolic = gtk_nuclear_symbolic_snapshot_symbolic;
}
/* We need to implement the functionality required by the GdkPaintable interface */
static void
gtk_nuclear_symbolic_snapshot (GdkPaintable *paintable,
GdkSnapshot *snapshot,
double width,
double height)
{
/* Calling this function without passing a color is a neat trick
* to make GTK use default colors and otherwise forward the call
* to the snapshotting function above.
*/
gtk_symbolic_paintable_snapshot_symbolic (GTK_SYMBOLIC_PAINTABLE (paintable),
snapshot,
width, height,
NULL, 0);
}
static GdkPaintableFlags
gtk_nuclear_symbolic_get_flags (GdkPaintable *paintable)
{
/* This image has a static size, but the contents may change:
* We draw different things when the warning level changes.
*/
return GDK_PAINTABLE_STATIC_SIZE;
}
static void
gtk_nuclear_symbolic_paintable_init (GdkPaintableInterface *iface)
{
iface->snapshot = gtk_nuclear_symbolic_snapshot;
iface->get_flags = gtk_nuclear_symbolic_get_flags;
}
/* When defining the GType, we need to implement bot the GdkPaintable
* and the GtkSymbolicPaintable interface */
G_DEFINE_TYPE_WITH_CODE (GtkNuclearSymbolic, gtk_nuclear_symbolic, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (GDK_TYPE_PAINTABLE,
gtk_nuclear_symbolic_paintable_init)
G_IMPLEMENT_INTERFACE (GTK_TYPE_SYMBOLIC_PAINTABLE,
gtk_nuclear_symbolic_symbolic_paintable_init))
static void
gtk_nuclear_symbolic_class_init (GtkNuclearSymbolicClass *klass)
{
}
static void
gtk_nuclear_symbolic_init (GtkNuclearSymbolic *nuclear)
{
}
/* And finally, we add the simple constructor we declared in the header. */
GdkPaintable *
gtk_nuclear_symbolic_new (void)
{
return g_object_new (GTK_TYPE_NUCLEAR_SYMBOLIC, NULL);
}
/* Add some fun feature to the button */
static void
nuclear_button_clicked (GtkButton *button,
GtkNuclearSymbolic *nuclear)
{
if (nuclear->warning_level >= WARNING_EMERGENCY)
{
/* On maximum warning level, reset the warning */
nuclear->warning_level = WARNING_NONE;
/* And sometimes (but not always to confuse people)
* close the window.
*/
if (g_random_boolean ())
gtk_window_close (GTK_WINDOW (window));
}
else
{
/* Otherwise just increase the warning level */
nuclear->warning_level++;
}
/* Don't forget to emit the signal causing the paintable to redraw.
* Changing the warning level changes the background color after all.
*/
gdk_paintable_invalidate_contents (GDK_PAINTABLE (nuclear));
}
GtkWidget *
do_paintable_symbolic (GtkWidget *do_widget)
{
GdkPaintable *nuclear;
GtkWidget *image, *button;
if (!window)
{
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Don't click!");
gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
button = gtk_button_new ();
gtk_window_set_child (GTK_WINDOW (window), button);
nuclear = gtk_nuclear_symbolic_new ();
image = gtk_image_new_from_paintable (nuclear);
gtk_button_set_child (GTK_BUTTON (button), image);
g_signal_connect (button, "clicked", G_CALLBACK (nuclear_button_clicked), nuclear);
g_object_unref (nuclear);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@@ -1,7 +1,7 @@
/* Peg Solitaire
* #Keywords: GtkGridView, game
*
* This demo demonstrates how to use drag-and-drop to implement peg solitaire.
* This demo demonstrates how to use drag'n'drop to implement peg solitaire.
*
*/
@@ -98,7 +98,7 @@ solitaire_peg_init (SolitairePeg *peg)
/* Add a little setter for the peg's position.
* We want to track those so that we can check for legal moves
* during drag-and-drop operations.
* during drag'n'drop operations.
*/
static void
solitaire_peg_set_position (SolitairePeg *peg,

View File

@@ -25,43 +25,43 @@ show_shortcuts (GtkWidget *window,
g_object_unref (builder);
}
G_MODULE_EXPORT void
void
shortcuts_builder_shortcuts (GtkWidget *window)
{
show_shortcuts (window, "shortcuts-builder", NULL);
}
G_MODULE_EXPORT void
void
shortcuts_gedit_shortcuts (GtkWidget *window)
{
show_shortcuts (window, "shortcuts-gedit", NULL);
}
G_MODULE_EXPORT void
void
shortcuts_clocks_shortcuts (GtkWidget *window)
{
show_shortcuts (window, "shortcuts-clocks", NULL);
}
G_MODULE_EXPORT void
void
shortcuts_clocks_shortcuts_stopwatch (GtkWidget *window)
{
show_shortcuts (window, "shortcuts-clocks", "stopwatch");
}
G_MODULE_EXPORT void
void
shortcuts_boxes_shortcuts (GtkWidget *window)
{
show_shortcuts (window, "shortcuts-boxes", NULL);
}
G_MODULE_EXPORT void
void
shortcuts_boxes_shortcuts_wizard (GtkWidget *window)
{
show_shortcuts (window, "shortcuts-boxes", "wizard");
}
G_MODULE_EXPORT void
void
shortcuts_boxes_shortcuts_display (GtkWidget *window)
{
show_shortcuts (window, "shortcuts-boxes", "display");

View File

@@ -2,7 +2,6 @@
#include <float.h>
#include <math.h>
#include <glib.h>
#include <assert.h>
/* See Golub and Reinsch,
* "Handbook for Automatic Computation vol II - Linear Algebra",
@@ -40,9 +39,6 @@ householder_reduction (double *A,
double *pu, *pui, *pv, *pvi;
double half_norm_squared;
assert (nrows >= 2);
assert (ncols >= 2);
memcpy (U, A, sizeof (double) * nrows * ncols);
diagonal[0] = 0.0;
@@ -209,9 +205,6 @@ givens_reduction (int nrows,
int rotation_test;
int iteration_count;
assert (nrows >= 2);
assert (ncols >= 2);
for (i = 0, x = 0.0; i < ncols; i++)
{
y = fabs (diagonal[i]) + fabs (superdiagonal[i]);
@@ -349,9 +342,6 @@ sort_singular_values (int nrows,
double temp;
double *p1, *p2;
assert (nrows >= 2);
assert (ncols >= 2);
for (i = 0; i < ncols - 1; i++)
{
max_index = i;
@@ -443,12 +433,9 @@ singular_value_decomposition_solve (double *U,
double d;
double tolerance;
assert (nrows >= 2);
assert (ncols >= 2);
tolerance = DBL_EPSILON * S[0] * (double) ncols;
for (i = 0, pv = V; i < ncols; i++, pv += ncols)
for ( i = 0, pv = V; i < ncols; i++, pv += ncols)
{
x[i] = 0.0;
for (j = 0; j < ncols; j++)

View File

@@ -12,7 +12,7 @@
#include <math.h>
#include <stdlib.h>
G_MODULE_EXPORT int
int
spinbutton_hex_spin_input (GtkSpinButton *spin_button,
double *new_val)
{
@@ -29,7 +29,7 @@ spinbutton_hex_spin_input (GtkSpinButton *spin_button,
return TRUE;
}
G_MODULE_EXPORT int
int
spinbutton_hex_spin_output (GtkSpinButton *spin_button)
{
GtkAdjustment *adjustment;
@@ -49,7 +49,7 @@ spinbutton_hex_spin_output (GtkSpinButton *spin_button)
return TRUE;
}
G_MODULE_EXPORT int
int
spinbutton_time_spin_input (GtkSpinButton *spin_button,
double *new_val)
{
@@ -88,7 +88,7 @@ spinbutton_time_spin_input (GtkSpinButton *spin_button,
return TRUE;
}
G_MODULE_EXPORT int
int
spinbutton_time_spin_output (GtkSpinButton *spin_button)
{
GtkAdjustment *adjustment;
@@ -122,7 +122,7 @@ static const char *month[12] = {
"December"
};
G_MODULE_EXPORT int
int
spinbutton_month_spin_input (GtkSpinButton *spin_button,
double *new_val)
{
@@ -151,7 +151,7 @@ spinbutton_month_spin_input (GtkSpinButton *spin_button,
return TRUE;
}
G_MODULE_EXPORT int
int
spinbutton_month_spin_output (GtkSpinButton *spin_button)
{
GtkAdjustment *adjustment;

View File

@@ -32,10 +32,5 @@ endforeach
install_data('org.gtk.IconBrowser4.desktop', install_dir: gtk_applicationsdir)
# appdata
configure_file(
input: 'org.gtk.IconBrowser4.appdata.xml.in',
output: 'org.gtk.IconBrowser4.appdata.xml',
configuration: appdata_config,
install_dir: gtk_appdatadir
)
install_data('org.gtk.IconBrowser4.appdata.xml', install_dir: gtk_appdatadir)

View File

@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<id>org.gtk.IconBrowser4</id>
<launchable type="desktop-id">org.gtk.IconBrowser4.desktop</launchable>
<id>org.gtk.IconBrowser4.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>LGPL-2.1-or-later</project_license>
<project_license>LGPL-2.0+</project_license>
<name>GTK Icon Browser</name>
<summary>Program to browse themed icons</summary>
<description>
@@ -30,11 +29,15 @@
<translation type="gettext">gtk-4.0</translation>
<update_contact>matthias.clasen_at_gmail.com</update_contact>
<developer_name>Matthias Clasen and others</developer_name>
<content_rating type="oars-1.1"/>
<releases>
<release version="@BUILD_VERSION@" date="@BUILD_DATE@">
<release version="3.99.0" date="2020-07-30">
<description>
<p>A new build of GTK.</p>
<p>A new developers snapshot towards GTK 4.0.</p>
</description>
</release>
<release version="3.94.0" date="2018-06-25">
<description>
<p>A new developers snapshot towards GTK 4.0.</p>
</description>
</release>
</releases>

View File

@@ -25,14 +25,12 @@
</style>
<child>
<object class="GtkToggleButton" id="normal_radio">
<property name="focus-on-click">0</property>
<property name="label" translatable="yes">Normal</property>
<property name="active">1</property>
</object>
</child>
<child>
<object class="GtkToggleButton" id="symbolic_radio">
<property name="focus-on-click">0</property>
<property name="label" translatable="yes">Symbolic</property>
<property name="group">normal_radio</property>
<signal name="notify::active" handler="symbolic_toggled" swapped="yes" after="yes"/>
@@ -42,7 +40,6 @@
</child>
<child type="end">
<object class="GtkMenuButton" id="gear_menu_button">
<property name="focus-on-click">0</property>
<property name="valign">center</property>
<property name="menu-model">gear_menu</property>
<property name="icon-name">open-menu-symbolic</property>
@@ -50,7 +47,6 @@
</child>
<child type="end">
<object class="GtkToggleButton" id="search">
<property name="focus-on-click">0</property>
<style>
<class name="image-button"/>
</style>

View File

@@ -1,31 +1,19 @@
gen_demo_header = find_program('../build-aux/meson/gen-demo-header.py')
demo_profile = get_option('profile')
demo_conf = configuration_data()
demo_conf.set_quoted('PROFILE', get_option('profile'))
demo_conf.set_quoted('VCS_TAG', '@VCS_TAG@')
demo_conf_h = declare_dependency(
sources: custom_target('demo-header',
command: [gen_demo_header, meson.source_root(), demo_profile],
capture: true,
output: 'demo_conf.h',
build_by_default: true,
build_always_stale: true,
)
sources: vcs_tag(
command: [ 'git', 'rev-parse', '--short', 'HEAD' ],
fallback: get_option('profile') != 'default' ? 'devel' : '',
input: configure_file(
output: 'demo_conf.h.in',
configuration: demo_conf
),
output: 'demo_conf.h'
)
)
# appdata
today = 'unknown'
date = find_program('date',
required: false)
if date.found()
r = run_command(date, '-I')
if r.returncode() == 0
today = r.stdout().strip()
endif
endif
appdata_config = configuration_data()
appdata_config.set('BUILD_VERSION', meson.project_version())
appdata_config.set('BUILD_DATE', today)
subdir('constraint-editor')
subdir('gtk-demo')
subdir('icon-browser')

View File

@@ -2,8 +2,8 @@
<interface>
<object class="GtkWindow" id="window">
<property name="title" translatable="yes">Help</property>
<property name="default-width">920</property>
<property name="default-height">600</property>
<property name="default-width">720</property>
<property name="default-height">520</property>
<child>
<object class="GtkScrolledWindow">
<child>

View File

@@ -24,6 +24,7 @@
#include "gtkrendererpaintableprivate.h"
#include "gsk/gskrendernodeparserprivate.h"
#include "gsk/gl/gskglrenderer.h"
#include "gsk/ngl/gsknglrenderer.h"
#ifdef GDK_WINDOWING_BROADWAY
#include "gsk/broadway/gskbroadwayrenderer.h"
@@ -60,7 +61,7 @@ struct _NodeEditorWindow
GtkWidget *renderer_listbox;
GListStore *renderers;
GskRenderNode *node;
GdkPaintable *paintable;
GFileMonitor *file_monitor;
@@ -167,6 +168,7 @@ static void
text_changed (GtkTextBuffer *buffer,
NodeEditorWindow *self)
{
GskRenderNode *node;
char *text;
GBytes *bytes;
GtkTextIter iter;
@@ -177,12 +179,10 @@ text_changed (GtkTextBuffer *buffer,
text_buffer_remove_all_tags (self->text_buffer);
bytes = g_bytes_new_take (text, strlen (text));
g_clear_pointer (&self->node, gsk_render_node_unref);
/* If this is too slow, go fix the parser performance */
self->node = gsk_render_node_deserialize (bytes, deserialize_error_func, self);
node = gsk_render_node_deserialize (bytes, deserialize_error_func, self);
g_bytes_unref (bytes);
if (self->node)
if (node)
{
/* XXX: Is this code necessary or can we have API to turn nodes into paintables? */
GtkSnapshot *snapshot;
@@ -191,9 +191,10 @@ text_changed (GtkTextBuffer *buffer,
guint i;
snapshot = gtk_snapshot_new ();
gsk_render_node_get_bounds (self->node, &bounds);
gsk_render_node_get_bounds (node, &bounds);
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (- bounds.origin.x, - bounds.origin.y));
gtk_snapshot_append_node (snapshot, self->node);
gtk_snapshot_append_node (snapshot, node);
gsk_render_node_unref (node);
paintable = gtk_snapshot_free_to_paintable (snapshot, &bounds.size);
gtk_picture_set_paintable (GTK_PICTURE (self->picture), paintable);
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (self->renderers)); i++)
@@ -337,9 +338,15 @@ text_view_query_tooltip_cb (GtkWidget *widget,
}
static gboolean
load_bytes (NodeEditorWindow *self,
GBytes *bytes)
load_file_contents (NodeEditorWindow *self,
GFile *file)
{
GBytes *bytes;
bytes = g_file_load_bytes (file, NULL, NULL, NULL);
if (bytes == NULL)
return FALSE;
if (!g_utf8_validate (g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes), NULL))
{
g_bytes_unref (bytes);
@@ -355,105 +362,6 @@ load_bytes (NodeEditorWindow *self,
return TRUE;
}
static gboolean
load_file_contents (NodeEditorWindow *self,
GFile *file)
{
GBytes *bytes;
bytes = g_file_load_bytes (file, NULL, NULL, NULL);
if (bytes == NULL)
return FALSE;
return load_bytes (self, bytes);
}
static GdkContentProvider *
on_picture_drag_prepare_cb (GtkDragSource *source,
double x,
double y,
NodeEditorWindow *self)
{
if (self->node == NULL)
return NULL;
return gdk_content_provider_new_typed (GSK_TYPE_RENDER_NODE, self->node);
}
static void
on_picture_drop_read_done_cb (GObject *source,
GAsyncResult *res,
gpointer data)
{
NodeEditorWindow *self = data;
GOutputStream *stream = G_OUTPUT_STREAM (source);
GdkDrop *drop = g_object_get_data (source, "drop");
GdkDragAction action = 0;
GBytes *bytes;
if (g_output_stream_splice_finish (stream, res, NULL) >= 0)
{
bytes = g_memory_output_stream_steal_as_bytes (G_MEMORY_OUTPUT_STREAM (stream));
if (load_bytes (self, bytes))
action = GDK_ACTION_COPY;
}
g_object_unref (self);
gdk_drop_finish (drop, action);
g_object_unref (drop);
return;
}
static void
on_picture_drop_read_cb (GObject *source,
GAsyncResult *res,
gpointer data)
{
NodeEditorWindow *self = data;
GdkDrop *drop = GDK_DROP (source);
GInputStream *input;
GOutputStream *output;
input = gdk_drop_read_finish (drop, res, NULL, NULL);
if (input == NULL)
{
g_object_unref (self);
gdk_drop_finish (drop, 0);
return;
}
output = g_memory_output_stream_new_resizable ();
g_object_set_data (G_OBJECT (output), "drop", drop);
g_object_ref (drop);
g_output_stream_splice_async (output,
input,
G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE | G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET,
G_PRIORITY_DEFAULT,
NULL,
on_picture_drop_read_done_cb,
self);
g_object_unref (output);
g_object_unref (input);
}
static gboolean
on_picture_drop_cb (GtkDropTargetAsync *dest,
GdkDrop *drop,
double x,
double y,
NodeEditorWindow *self)
{
gdk_drop_read_async (drop,
(const char *[2]) { "application/x-gtk-render-node", NULL },
G_PRIORITY_DEFAULT,
NULL,
on_picture_drop_read_cb,
g_object_ref (self));
return TRUE;
}
static void
file_changed_cb (GFileMonitor *monitor,
GFile *file,
@@ -727,24 +635,6 @@ export_image_cb (GtkWidget *button,
gtk_widget_show (dialog);
}
static void
clip_image_cb (GtkWidget *button,
NodeEditorWindow *self)
{
GdkTexture *texture;
GdkClipboard *clipboard;
texture = create_texture (self);
if (texture == NULL)
return;
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (self));
gdk_clipboard_set_texture (clipboard, texture);
g_object_unref (texture);
}
static void
testcase_name_entry_changed_cb (GtkWidget *button,
GParamSpec *pspec,
@@ -828,7 +718,6 @@ node_editor_window_finalize (GObject *object)
g_array_free (self->errors, TRUE);
g_clear_pointer (&self->node, gsk_render_node_unref);
g_clear_object (&self->renderers);
G_OBJECT_CLASS (node_editor_window_parent_class)->finalize (object);
@@ -872,8 +761,11 @@ node_editor_window_realize (GtkWidget *widget)
"Default");
#endif
node_editor_window_add_renderer (self,
gsk_ngl_renderer_new (),
gsk_gl_renderer_new (),
"OpenGL");
node_editor_window_add_renderer (self,
gsk_ngl_renderer_new (),
"NGL");
#ifdef GDK_RENDERING_VULKAN
node_editor_window_add_renderer (self,
gsk_vulkan_renderer_new (),
@@ -934,12 +826,9 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
gtk_widget_class_bind_template_callback (widget_class, open_cb);
gtk_widget_class_bind_template_callback (widget_class, save_cb);
gtk_widget_class_bind_template_callback (widget_class, export_image_cb);
gtk_widget_class_bind_template_callback (widget_class, clip_image_cb);
gtk_widget_class_bind_template_callback (widget_class, testcase_save_clicked_cb);
gtk_widget_class_bind_template_callback (widget_class, testcase_name_entry_changed_cb);
gtk_widget_class_bind_template_callback (widget_class, dark_mode_cb);
gtk_widget_class_bind_template_callback (widget_class, on_picture_drag_prepare_cb);
gtk_widget_class_bind_template_callback (widget_class, on_picture_drop_cb);
}
static GtkWidget *

View File

@@ -102,7 +102,6 @@
<object class="GtkHeaderBar" id="header">
<child type="start">
<object class="GtkButton">
<property name="focus-on-click">0</property>
<property name="icon-name">document-open-symbolic</property>
<property name="tooltip-text">Open node file</property>
<signal name="clicked" handler="open_cb"/>
@@ -110,7 +109,6 @@
</child>
<child type="start">
<object class="GtkButton">
<property name="focus-on-click">0</property>
<property name="icon-name">document-save-symbolic</property>
<property name="tooltip-text">Save to node file</property>
<signal name="clicked" handler="save_cb"/>
@@ -118,30 +116,24 @@
</child>
<child type="start">
<object class="GtkButton">
<property name="focus-on-click">0</property>
<property name="icon-name">insert-image-symbolic</property>
<property name="tooltip-text">Export to image</property>
<signal name="clicked" handler="export_image_cb"/>
</object>
</child>
<child type="start">
<object class="GtkButton">
<property name="focus-on-click">0</property>
<property name="icon-name">edit-copy-symbolic</property>
<property name="tooltip-text">Copy image to clipboard</property>
<signal name="clicked" handler="clip_image_cb"/>
<object class="GtkSeparator">
<property name="orientation">vertical</property>
</object>
</child>
<child type="start">
<object class="GtkMenuButton">
<property name="focus-on-click">0</property>
<property name="label">Save Testcase</property>
<property name="popover">testcase_popover</property>
</object>
</child>
<child type="end">
<object class="GtkMenuButton" id="gear_menu_button">
<property name="focus-on-click">0</property>
<property name="valign">center</property>
<property name="menu-model">gear_menu</property>
<property name="icon-name">open-menu-symbolic</property>
@@ -149,7 +141,6 @@
</child>
<child type="end">
<object class="GtkToggleButton" id="dark_bg_button">
<property name="focus-on-click">0</property>
<property name="valign">center</property>
<property name="has-frame">0</property>
<property name="icon-name">display-brightness-symbolic</property>
@@ -198,22 +189,8 @@
<child>
<object class="GtkPicture" id="picture">
<property name="can-shrink">0</property>
<property name="keep-aspect-ratio">1</property>
<property name="halign">center</property>
<property name="valign">center</property>
<child>
<object class="GtkDragSource">
<property name="actions">copy</property>
<signal name="prepare" handler="on_picture_drag_prepare_cb" swapped="no"/>
</object>
</child>
</object>
</child>
<child>
<object class="GtkDropTargetAsync">
<property name="actions">copy</property>
<property name="formats">application/x-gtk-render-node</property>
<signal name="drop" handler="on_picture_drop_cb" swapped="no"/>
</object>
</child>
</object>

View File

@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<id>org.gtk.PrintEditor4</id>
<launchable type="desktop-id">org.gtk.PrintEditor4.desktop</launchable>
<id>org.gtk.PrintEditor4.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>LGPL-2.1-or-later</project_license>
<project_license>LGPL-2.0+</project_license>
<name>GTK Print Editor</name>
<summary>Program to demonstrate GTK printing</summary>
<description>
@@ -25,7 +24,6 @@
<translation type="gettext">gtk-4.0</translation>
<update_contact>matthias.clasen_at_gmail.com</update_contact>
<developer_name>Matthias Clasen and others</developer_name>
<content_rating type="oars-1.1"/>
<releases>
<release version="3.99.0" date="2020-07-30">
<description>

View File

@@ -159,7 +159,7 @@ save_file (GFile *save_filename)
error = NULL;
g_file_replace_contents (save_filename,
text, strlen (text),
text, -1,
NULL, FALSE,
G_FILE_CREATE_NONE,
NULL,
@@ -721,6 +721,7 @@ static const char ui_info[] =
" <item>"
" <attribute name='label'>_New</attribute>"
" <attribute name='action'>app.new</attribute>"
" <attribute name='accel'>&lt;Primary&gt;n</attribute>"
" </item>"
" <item>"
" <attribute name='label'>_Open</attribute>"
@@ -729,10 +730,12 @@ static const char ui_info[] =
" <item>"
" <attribute name='label'>_Save</attribute>"
" <attribute name='action'>app.save</attribute>"
" <attribute name='accel'>&lt;Primary&gt;s</attribute>"
" </item>"
" <item>"
" <attribute name='label'>Save _As...</attribute>"
" <attribute name='action'>app.save-as</attribute>"
" <attribute name='accel'>&lt;Primary&gt;s</attribute>"
" </item>"
" </section>"
" <section>"
@@ -753,6 +756,7 @@ static const char ui_info[] =
" <item>"
" <attribute name='label'>_Quit</attribute>"
" <attribute name='action'>app.quit</attribute>"
" <attribute name='accel'>&lt;Primary&gt;q</attribute>"
" </item>"
" </section>"
" </submenu>"
@@ -762,6 +766,7 @@ static const char ui_info[] =
" <item>"
" <attribute name='label'>_About Print Editor</attribute>"
" <attribute name='action'>app.about</attribute>"
" <attribute name='accel'>&lt;Primary&gt;a</attribute>"
" </item>"
" </section>"
" </submenu>"
@@ -789,15 +794,6 @@ startup (GApplication *app)
{
GtkBuilder *builder;
GMenuModel *menubar;
struct {
const char *action_and_target;
const char *accelerators[2];
} accels[] = {
{ "app.new", { "<Control>n", NULL } },
{ "app.quit", { "<Control>q", NULL } },
{ "app.save", { "<Control>s", NULL } },
{ "app.about", { "<Control>a", NULL } },
};
builder = gtk_builder_new ();
gtk_builder_add_from_string (builder, ui_info, -1, NULL);
@@ -806,9 +802,6 @@ startup (GApplication *app)
gtk_application_set_menubar (GTK_APPLICATION (app), menubar);
for (int i = 0; i < G_N_ELEMENTS (accels); i++)
gtk_application_set_accels_for_action (GTK_APPLICATION (app), accels[i].action_and_target, accels[i].accelerators);
g_object_unref (builder);
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

View File

@@ -26,9 +26,4 @@ foreach size: ['scalable', 'symbolic']
endforeach
# appdata
configure_file(
input: 'org.gtk.WidgetFactory4.appdata.xml.in',
output: 'org.gtk.WidgetFactory4.appdata.xml',
configuration: appdata_config,
install_dir: gtk_appdatadir
)
install_data('org.gtk.WidgetFactory4.appdata.xml', install_dir: gtk_appdatadir)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

View File

@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<id>org.gtk.WidgetFactory4</id>
<launchable type="desktop-id">org.gtk.WidgetFactory4.desktop</launchable>
<id>org.gtk.WidgetFactory4.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>LGPL-2.1-or-later</project_license>
<project_license>LGPL-2.0+</project_license>
<name>GTK Widget Factory</name>
<summary>Program to demonstrate GTK functions</summary>
<description>
@@ -32,11 +31,15 @@
<translation type="gettext">gtk-4.0</translation>
<update_contact>matthias.clasen_at_gmail.com</update_contact>
<developer_name>Matthias Clasen and others</developer_name>
<content_rating type="oars-1.1"/>
<releases>
<release version="@BUILD_VERSION@" date="@BUILD_DATE@">
<release version="3.99.0" date="2020-07-30">
<description>
<p>A new build of GTK.</p>
<p>A new developers snapshot towards GTK 4.0.</p>
</description>
</release>
<release version="3.94.0" date="2018-06-25">
<description>
<p>A new developers snapshot towards GTK 4.0.</p>
</description>
</release>
</releases>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 2.0 MiB

View File

@@ -50,19 +50,32 @@ change_theme_state (GSimpleAction *action,
GtkSettings *settings = gtk_settings_get_default ();
const char *s;
const char *theme;
gboolean prefer_dark = FALSE;
g_simple_action_set_state (action, state);
s = g_variant_get_string (state, NULL);
if (strcmp (s, "default") == 0)
theme = "Default";
else if (strcmp (s, "dark") == 0)
theme = "Default-dark";
else if (strcmp (s, "hc") == 0)
theme = "Default-hc";
else if (strcmp (s, "hc-dark") == 0)
theme = "Default-hc-dark";
if (strcmp (s, "adwaita") == 0)
{
theme = "Adwaita";
prefer_dark = FALSE;
}
else if (strcmp (s, "adwaita-dark") == 0)
{
theme = "Adwaita";
prefer_dark = TRUE;
}
else if (strcmp (s, "highcontrast") == 0)
{
theme = "HighContrast";
prefer_dark = FALSE;
}
else if (strcmp (s, "highcontrast-inverse") == 0)
{
theme = "HighContrastInverse";
prefer_dark = FALSE;
}
else if (strcmp (s, "current") == 0)
{
gtk_settings_reset_property (settings, "gtk-theme-name");
@@ -74,7 +87,7 @@ change_theme_state (GSimpleAction *action,
g_object_set (G_OBJECT (settings),
"gtk-theme-name", theme,
"gtk-application-prefer-dark-theme", FALSE,
"gtk-application-prefer-dark-theme", prefer_dark,
NULL);
}
@@ -696,37 +709,6 @@ on_range_to_changed (GtkSpinButton *to)
gtk_spin_button_set_value (from, v2);
}
static GdkContentProvider *
on_picture_drag_prepare (GtkDragSource *source,
double x,
double y,
gpointer unused)
{
GtkWidget *picture;
picture = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (source));
return gdk_content_provider_new_typed (GDK_TYPE_TEXTURE, gtk_picture_get_paintable (GTK_PICTURE (picture)));
}
static gboolean
on_picture_drop (GtkDropTarget *dest,
const GValue *value,
double x,
double y,
gpointer unused)
{
GtkWidget *picture;
GdkPaintable *paintable;
picture = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (dest));
paintable = g_value_get_object (value);
gtk_picture_set_paintable (GTK_PICTURE (picture), paintable);
return TRUE;
}
static void
info_bar_response (GtkWidget *infobar, int response_id)
{
@@ -1213,7 +1195,7 @@ populate_flowbox (GtkWidget *flowbox)
GtkWidget *child;
int i;
const char *resources[] = {
"sunset.jpg", "portland-rose.jpg", "beach.jpg", "nyc.jpg"
"sunset.jpg", "snowy.jpg", "portland-rose.jpg"
};
if (GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (flowbox), "populated")))
@@ -1904,7 +1886,6 @@ set_up_context_popover (GtkWidget *widget,
gtk_widget_set_parent (popover, widget);
gtk_popover_set_has_arrow (GTK_POPOVER (popover), FALSE);
gesture = gtk_gesture_click_new ();
gtk_event_controller_set_name (GTK_EVENT_CONTROLLER (gesture), "widget-factory-context-click");
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
g_signal_connect (gesture, "pressed", G_CALLBACK (clicked_cb), popover);
gtk_widget_add_controller (widget, GTK_EVENT_CONTROLLER (gesture));
@@ -2028,7 +2009,6 @@ activate (GApplication *app)
const char *accelerators[2];
} accels[] = {
{ "app.about", { "F1", NULL } },
{ "app.shortcuts", { "<Control>question", NULL } },
{ "app.quit", { "<Control>q", NULL } },
{ "app.open-in", { "<Control>n", NULL } },
{ "win.dark", { "<Control>d", NULL } },
@@ -2071,8 +2051,6 @@ activate (GApplication *app)
"on_page_combo_changed", (GCallback)on_page_combo_changed,
"on_range_from_changed", (GCallback)on_range_from_changed,
"on_range_to_changed", (GCallback)on_range_to_changed,
"on_picture_drag_prepare", (GCallback)on_picture_drag_prepare,
"on_picture_drop", (GCallback)on_picture_drop,
"tab_close_cb", (GCallback)tab_close_cb,
"increase_icon_size", (GCallback)increase_icon_size,
"decrease_icon_size", (GCallback)decrease_icon_size,

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gtk/WidgetFactory4">
<file alias='widget-factory.ui'>widget-factory.uic</file>
<file preprocess="xml-stripblanks">widget-factory.ui</file>
</gresource>
<gresource prefix="/org/gtk/WidgetFactory4">
<file>widget-factory.css</file>
@@ -115,8 +115,7 @@
<gresource prefix="/org/gtk/WidgetFactory4">
<file>gtk-logo.webm</file>
<file>sunset.jpg</file>
<file>snowy.jpg</file>
<file>portland-rose.jpg</file>
<file>nyc.jpg</file>
<file>beach.jpg</file>
</gresource>
</gresources>

View File

@@ -15,24 +15,24 @@
<attribute name="target">current</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Default</attribute>
<attribute name="label" translatable="yes">Adwaita</attribute>
<attribute name="action">win.theme</attribute>
<attribute name="target">default</attribute>
<attribute name="target">adwaita</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Dark</attribute>
<attribute name="label" translatable="yes">Adwaita dark</attribute>
<attribute name="action">win.theme</attribute>
<attribute name="target">dark</attribute>
<attribute name="target">adwaita-dark</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Highcontrast</attribute>
<attribute name="label" translatable="yes">High contrast</attribute>
<attribute name="action">win.theme</attribute>
<attribute name="target">hc</attribute>
<attribute name="target">highcontrast</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Highcontrast inverse</attribute>
<attribute name="label" translatable="yes">High contrast inverse</attribute>
<attribute name="action">win.theme</attribute>
<attribute name="target">hc-dark</attribute>
<attribute name="target">highcontrast-inverse</attribute>
</item>
</section>
</submenu>
@@ -438,7 +438,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child type="end">
<object class="GtkMenuButton" id="gear_menu_button">
<property name="valign">center</property>
<property name="focus-on-click">0</property>
<property name="popover">
<object class="GtkPopoverMenu" id="gear_menu">
<property name="menu-model">gear_menu_model</property>
@@ -1051,9 +1050,22 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="spacing">10</property>
<property name="hexpand">1</property>
<child>
<object class="GtkFrame">
<object class="GtkFrame" id="frame1">
<property name="valign">start</property>
<child type="label">
<object class="GtkLabel" id="label1">
<property name="label" translatable="yes">&lt;b&gt;Video&lt;/b&gt;</property>
<property name="use-markup">1</property>
</object>
</child>
<child>
<object class="GtkVideo">
<property name="halign">center</property>
<property name="valign">center</property>
<property name="margin-start">6</property>
<property name="margin-end">6</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<property name="autoplay">1</property>
<property name="loop">1</property>
<property name="file">resource:///org/gtk/WidgetFactory4/gtk-logo.webm</property>
@@ -1062,78 +1074,66 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</object>
</child>
<child>
<object class="GtkFrame">
<child type="label">
<object class="GtkLabel" id="label1">
<property name="label" translatable="yes">&lt;b&gt;Text Styles&lt;/b&gt;</property>
<property name="use-markup">1</property>
</object>
</child>
<object class="GtkScrolledWindow">
<property name="vexpand">1</property>
<property name="hscrollbar-policy">never</property>
<property name="vscrollbar-policy">automatic</property>
<child>
<object class="GtkScrolledWindow">
<property name="vexpand">1</property>
<property name="hscrollbar-policy">never</property>
<property name="vscrollbar-policy">automatic</property>
<property name="propagate-natural-height">1</property>
<property name="propagate-natural-width">1</property>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">10</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">10</property>
<child>
<object class="GtkLabel">
<property name="label">Large Title</property>
<style><class name="large-title"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Title 1</property>
<style><class name="title-1"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Title 2</property>
<style><class name="title-2"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Title 3</property>
<style><class name="title-3"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Title 4</property>
<style><class name="title-4"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Heading</property>
<style><class name="heading"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Body</property>
<style><class name="body"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Caption Heading</property>
<style><class name="caption-heading"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Caption</property>
<style><class name="caption"/></style>
</object>
</child>
<object class="GtkLabel">
<property name="label">Large Title</property>
<style><class name="large-title"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Title 1</property>
<style><class name="title-1"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Title 2</property>
<style><class name="title-2"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Title 3</property>
<style><class name="title-3"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Title 4</property>
<style><class name="title-4"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Heading</property>
<style><class name="heading"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Body</property>
<style><class name="body"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Caption Heading</property>
<style><class name="caption-heading"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Caption</property>
<style><class name="caption"/></style>
</object>
</child>
</object>
@@ -1250,21 +1250,8 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkNotebookPage">
<property name="child">
<object class="GtkPicture">
<property name="file">resource:///org/gtk/WidgetFactory4/sunset.jpg</property>
<child>
<object class="GtkDragSource">
<property name="actions">copy</property>
<signal name="prepare" handler="on_picture_drag_prepare" swapped="no"/>
</object>
</child>
<child>
<object class="GtkDropTarget">
<property name="actions">copy</property>
<property name="formats">GdkTexture</property>
<signal name="drop" handler="on_picture_drop" swapped="no"/>
</object>
</child>
<object class="GtkBox" id="box6">
<property name="orientation">vertical</property>
</object>
</property>
<property name="tab">
@@ -1277,21 +1264,8 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkNotebookPage">
<property name="child">
<object class="GtkPicture">
<property name="file">resource:///org/gtk/WidgetFactory4/nyc.jpg</property>
<child>
<object class="GtkDragSource">
<property name="actions">copy</property>
<signal name="prepare" handler="on_picture_drag_prepare" swapped="no"/>
</object>
</child>
<child>
<object class="GtkDropTarget">
<property name="actions">copy</property>
<property name="formats">GdkTexture</property>
<signal name="drop" handler="on_picture_drop" swapped="no"/>
</object>
</child>
<object class="GtkBox" id="box7">
<property name="orientation">vertical</property>
</object>
</property>
<property name="tab">
@@ -1303,22 +1277,10 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
<child>
<object class="GtkNotebookPage">
<property name="position">2</property>
<property name="child">
<object class="GtkPicture">
<property name="file">resource:///org/gtk/WidgetFactory4/beach.jpg</property>
<child>
<object class="GtkDragSource">
<property name="actions">copy</property>
<signal name="prepare" handler="on_picture_drag_prepare" swapped="no"/>
</object>
</child>
<child>
<object class="GtkDropTarget">
<property name="actions">copy</property>
<property name="formats">GdkTexture</property>
<signal name="drop" handler="on_picture_drop" swapped="no"/>
</object>
</child>
<object class="GtkBox" id="box8">
<property name="orientation">vertical</property>
</object>
</property>
<property name="tab">
@@ -1336,7 +1298,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkNotebookPage">
<property name="child">
<object class="GtkBox" id="box8">
<object class="GtkBox" id="box9">
<property name="orientation">vertical</property>
</object>
</property>
@@ -2643,12 +2605,12 @@ microphone-sensitivity-medium-symbolic</property>
</style>
<child>
<object class="GtkButton">
<property name="icon-name">go-previous-symbolic</property>
<property name="icon-name">pan-start-symbolic</property>
</object>
</child>
<child>
<object class="GtkButton">
<property name="icon-name">go-next-symbolic</property>
<property name="icon-name">pan-end-symbolic</property>
</object>
</child>
</object>
@@ -2939,7 +2901,7 @@ bad things might happen.</property>
<action-widgets>
<action-widget response="cancel">cancel_info_dialog</action-widget>
<action-widget response="ok" default="true">doit_info_dialog</action-widget>
<action-widget response="ok">doit_info_dialog</action-widget>
</action-widgets>
</object>
<object class="GtkDialog" id="action_dialog">

View File

@@ -13,7 +13,7 @@ devhelp = true
[dependencies."GObject-2.0"]
name = "GObject"
description = "The base type system library"
docs_url = "https://docs.gtk.org/gobject/"
docs_url = "https://developer.gnome.org/gobject/stable"
[theme]
name = "basic"
@@ -21,9 +21,3 @@ show_index_summary = true
[source-location]
base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/master/"
[extra]
content_images = [
"images/gtk-logo.svg",
]
urlmap_file = "urlmap.js"

View File

@@ -13,7 +13,7 @@ devhelp = true
[dependencies."GObject-2.0"]
name = "GObject"
description = "The base type system library"
docs_url = "https://docs.gtk.org/gobject/"
docs_url = "https://developer.gnome.org/gobject/stable"
[theme]
name = "basic"
@@ -21,9 +21,3 @@ show_index_summary = true
[source-location]
base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/master/"
[extra]
content_images = [
"images/gtk-logo.svg",
]
urlmap_file = "urlmap.js"

View File

@@ -5,7 +5,7 @@ repository_url = "https://gitlab.gnome.org/GNOME/gtk.git"
website_url = "https://www.gtk.org"
authors = "GTK Development Team"
logo_url = "gtk-logo.svg"
license = "LGPL-2.1-or-later"
license = "GPL-2.1-or-later"
description = "The GTK toolkit"
dependencies = [ "GObject-2.0", "cairo-1.0", "Pango-1.0", "GdkWayland-4.0", "GdkX11-4.0" ]
devhelp = true
@@ -14,7 +14,7 @@ search_index = true
[dependencies."GObject-2.0"]
name = "GObject"
description = "The base type system library"
docs_url = "https://docs.gtk.org/gobject/"
docs_url = "https://developer.gnome.org/gobject/stable"
[dependencies."cairo-1.0"]
name = "Cairo"
@@ -24,17 +24,17 @@ search_index = true
[dependencies."Pango-1.0"]
name = "Pango"
description = "Text shaping and rendering"
docs_url = "https://docs.gtk.org/Pango/"
docs_url = "https://developer.gnome.org/pango/stable"
[dependencies."GdkWayland-4.0"]
name = "GdkWayland"
description = "GDK Wayland Backend"
docs_url = "https://docs.gtk.org/gdk4-wayland/"
docs_url = "https://gnome.pages.gitlab.gnome.org/gtk/gdk4-wayland/"
[dependencies."GdkX11-4.0"]
name = "GdkX11"
description = "GDK X11 Backend"
docs_url = "https://docs.gtk.org/gdk4-x11/"
docs_url = "https://gnome.pages.gitlab.gnome.org/gtk/gdk4-x11/"
[theme]
name = "basic"

View File

@@ -3,7 +3,7 @@ Title: Key Values
## Functions for manipulating keyboard codes
Key values are the codes which are sent whenever a key is pressed or released.
They are included in the data contained in a key press or release `GdkEvent`.
They are included in the data contained in a key press or release #GdkEvent.
The complete list of key values can be found in the `gdk/gdkkeysyms.h` header
file.
@@ -28,8 +28,8 @@ At the lowest level, physical keys on the keyboard are represented by
numeric keycodes, and GDK knows how to translate these keycodes into
key values according to the configured keyboard layout and the current
state of the keyboard. In the GDK api, the mapping from keycodes to key
values is available via [method@Gdk.Display.map_keycode], and the reverse
mapping is available via [method@Gdk.Display.map_keyval]. The results of
values is available via [`method@Gdk.Display.map_keycode`], and the reverse
mapping is available via [`method@Gdk.Display.map_keyval`]. The results of
these functions are returned in [struct@Gdk.KeymapKey] structures.
You can think of a [struct@Gdk.KeymapKey] as a representation of a symbol
@@ -45,7 +45,7 @@ information:
or the “!” symbol. The letter keys are considered to have a lowercase
letter at level 0, and an uppercase letter at level 1, though normally
only the uppercase letter is printed on the key
1. third, the [struct@Gdk.KeymapKey] contains a group; groups are not used on
1. third, the #GdkKeymapKey contains a group; groups are not used on
standard US keyboards, but are used in many other countries. On a
keyboard with groups, there can be 3 or 4 symbols printed on a single
key. The group indicates movement in a horizontal direction. Usually

View File

@@ -1,15 +1,11 @@
expand_content_md_files = [
]
if get_option('gtk_doc')
gdk4_toml = configure_file(
input: 'gdk4.toml.in',
output: 'gdk4.toml',
configuration: toml_conf,
install: true,
install_dir: docs_dir / 'gdk4',
)
gdk4_toml = configure_file(input: 'gdk4.toml.in', output: 'gdk4.toml', configuration: toml_conf)
gdk4x11_toml = configure_file(input: 'gdk4-x11.toml.in', output: 'gdk4-x11.toml', configuration: toml_conf)
gdk4wayland_toml = configure_file(input: 'gdk4-wayland.toml.in', output: 'gdk4-wayland.toml', configuration: toml_conf)
if get_option('gtk_doc')
custom_target('gdk4-doc',
input: [ gdk4_toml, gdk_gir[0] ],
output: 'gdk4',
@@ -17,7 +13,6 @@ if get_option('gtk_doc')
gidocgen,
'generate',
'--quiet',
'--fatal-warnings',
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
'--config=@INPUT0@',
'--output-dir=@OUTPUT@',
@@ -32,14 +27,6 @@ if get_option('gtk_doc')
)
if x11_enabled
gdk4x11_toml = configure_file(
input: 'gdk4-x11.toml.in',
output: 'gdk4-x11.toml',
configuration: toml_conf,
install: true,
install_dir: docs_dir / 'gdk4-x11',
)
custom_target('gdk4-x11-doc',
input: [ gdk4x11_toml, gdk_x11_gir[0] ],
output: 'gdk4-x11',
@@ -47,7 +34,6 @@ if get_option('gtk_doc')
gidocgen,
'generate',
'--quiet',
'--fatal-warnings',
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
'--config=@INPUT0@',
'--output-dir=@OUTPUT@',
@@ -64,14 +50,6 @@ if get_option('gtk_doc')
endif
if wayland_enabled
gdk4wayland_toml = configure_file(
input: 'gdk4-wayland.toml.in',
output: 'gdk4-wayland.toml',
configuration: toml_conf,
install: true,
install_dir: docs_dir / 'gdk4-wayland',
)
custom_target('gdk4-wayland-doc',
input: [ gdk4wayland_toml, gdk_wayland_gir[0] ],
output: 'gdk4-wayland',
@@ -79,7 +57,6 @@ if get_option('gtk_doc')
gidocgen,
'generate',
'--quiet',
'--fatal-warnings',
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
'--config=@INPUT0@',
'--output-dir=@OUTPUT@',

View File

@@ -3,14 +3,11 @@
// A map between namespaces and base URLs for their online documentation
baseURLs = [
[ 'GLib', 'https://docs.gtk.org/glib/' ],
[ 'GObject', 'https://docs.gtk.org/gobject/' ],
[ 'Gio', 'https://docs.gtk.org/gio/' ],
[ 'Gdk', 'https://docs.gtk.org/gdk4/' ],
[ 'GdkWayland', 'https://docs.gtk.org/gdk4-wayland/' ],
[ 'GdkX11', 'https://docs.gtk.org/gdk4-x11/' ],
[ 'Gsk', 'https://docs.gtk.org/gsk4/' ],
[ 'Gtk', 'https://docs.gtk.org/gtk4/' ],
[ 'Pango', 'https://docs.gtk.org/Pango/' ],
[ 'PangoCairo', 'https://docs.gtk.org/PangoCairo/' ],
[ 'Gdk', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4/' ],
[ 'GdkWayland', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4-wayland/' ],
[ 'GdkX11', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4-x11/' ],
[ 'Gsk', 'https://gnome.pages.gitlab.gnome.org/gtk/gsk4/' ],
[ 'Gtk', 'https://gnome.pages.gitlab.gnome.org/gtk/gtk4/' ],
[ 'Pango', 'https://gnome.pages/gitlab.gnome.org/pango/pango/' ],
[ 'PangoCairo', 'https://gnome.pages.gitlab.gnome.org/pango/pangocairo/' ],
]

View File

@@ -5,7 +5,7 @@ repository_url = "https://gitlab.gnome.org/GNOME/gtk.git"
website_url = "https://www.gtk.org"
authors = "GTK Development Team"
logo_url = "gtk-logo.svg"
license = "LGPL-2.1-or-later"
license = "GPL-2.1-or-later"
description = "The GTK toolkit"
dependencies = [ "GObject-2.0", "Graphene-1.0", "Pango-1.0", "Gdk-4.0" ]
devhelp = true
@@ -14,22 +14,22 @@ search_index = true
[dependencies."GObject-2.0"]
name = "GObject"
description = "The base type system library"
docs_url = "https://docs.gtk.org/gobject/"
docs_url = "https://developer.gnome.org/gobject/stable"
[dependencies."Graphene-1.0"]
name = "Graphene"
description = "A thin layer of mathematical types for 3D libraries"
docs_url = "https://ebassi.github.io/graphene/docs/"
docs_url = "https://ebassi.github.io/graphene/docs"
[dependencies."Pango-1.0"]
name = "Pango"
description = "Text shaping and rendering"
docs_url = "https://docs.gtk.org/Pango/"
docs_url = "https://developer.gnome.org/pango/stable"
[dependencies."Gdk-4.0"]
name = "GDK"
description = "The GTK windowing system abstraction"
docs_url = "https://docs.gtk.org/gdk4/"
docs_url = "https://gnome.pages.gitlab.gnome.org/gtk/gdk4/"
[theme]
name = "basic"

View File

@@ -1,12 +1,6 @@
if get_option('gtk_doc')
gsk4_toml = configure_file(
input: 'gsk4.toml.in',
output: 'gsk4.toml',
configuration: toml_conf,
install: true,
install_dir: docs_dir / 'gsk4',
)
gsk4_toml = configure_file(input: 'gsk4.toml.in', output: 'gsk4.toml', configuration: toml_conf)
if get_option('gtk_doc')
custom_target('gsk4-doc',
input: [ gsk4_toml, gsk_gir[0] ],
output: 'gsk4',
@@ -14,7 +8,6 @@ if get_option('gtk_doc')
gidocgen,
'generate',
'--quiet',
'--fatal-warnings',
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
'--config=@INPUT0@',
'--output-dir=@OUTPUT@',

View File

@@ -3,14 +3,11 @@
// A map between namespaces and base URLs for their online documentation
baseURLs = [
[ 'GLib', 'https://docs.gtk.org/glib/' ],
[ 'GObject', 'https://docs.gtk.org/gobject/' ],
[ 'Gio', 'https://docs.gtk.org/gio/' ],
[ 'Gdk', 'https://docs.gtk.org/gdk4/' ],
[ 'GdkWayland', 'https://docs.gtk.org/gdk4-wayland/' ],
[ 'GdkX11', 'https://docs.gtk.org/gdk4-x11/' ],
[ 'Gsk', 'https://docs.gtk.org/gsk4/' ],
[ 'Gtk', 'https://docs.gtk.org/gtk4/' ],
[ 'Pango', 'https://docs.gtk.org/Pango/' ],
[ 'PangoCairo', 'https://docs.gtk.org/PangoCairo/' ],
[ 'Gdk', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4/' ],
[ 'GdkWayland', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4-wayland/' ],
[ 'GdkX11', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4-x11/' ],
[ 'Gsk', 'https://gnome.pages.gitlab.gnome.org/gtk/gsk4/' ],
[ 'Gtk', 'https://gnome.pages.gitlab.gnome.org/gtk/gtk4/' ],
[ 'Pango', 'https://gnome.pages/gitlab.gnome.org/pango/pango/' ],
[ 'PangoCairo', 'https://gnome.pages.gitlab.gnome.org/pango/pangocairo/' ],
]

View File

@@ -3,29 +3,27 @@ Slug: broadway
## Using GTK with Broadway
The GDK Broadway backend provides support for displaying GTK applications in
a web browser, using HTML5 and web sockets.
The GDK Broadway backend provides support for displaying GTK
applications in a web browser, using HTML5 and web sockets. To run
your application in this way, select the Broadway backend by setting
`GDK_BACKEND=broadway`. Then you can make your application appear in
a web browser by pointing it at `http://127.0.0.1:8080`. Note that
you need to enable web sockets in your web browser.
To run your application in this way, select the Broadway backend by setting
`GDK_BACKEND=broadway`. Then you can make your application appear in a web
browser by pointing it at `http://127.0.0.1:8080`. Note that you need to
enable web sockets in your web browser.
You can choose a different port from the default 8080 by setting
the `BROADWAY_DISPLAY` environment variable to the port that you
want to use.
You can choose a different port from the default 8080 by setting the
`BROADWAY_DISPLAY` environment variable to the port that you want to use.
It is also possible to use multiple GTK applications in the same web browser
window, by using the Broadway server, `gtk4-broadwayd`, that ships with GTK.
To start the Broadway server use:
It is also possible to use multiple GTK applications in the same
web browser window, by using the Broadway server, `broadwayd`, that
ships with GTK. To use broadwayd, start it like this:
```
gtk4-broadwayd :5
broadwayd :5
```
Then point your web browser at `http://127.0.0.1:8085`.
Once the Broadway server is running, you can start your applications like
this:
Start your applications like this:
```
GDK_BACKEND=broadway BROADWAY_DISPLAY=:5 gtk4-demo
@@ -33,13 +31,9 @@ GDK_BACKEND=broadway BROADWAY_DISPLAY=:5 gtk4-demo
## Broadway-specific environment variables
### `BROADWAY_DISPLAY`
### BROADWAY\_DISPLAY
Specifies the Broadway display number. The default display is 0.
The display number determines the port to use when connecting to a Broadway
application via the following formula:
```
port = 8080 + display
```
The display number determines the port to use when connecting
to a Broadway application via the following formula:
`port = 8080 + display`

View File

@@ -76,16 +76,12 @@ and in some cases a number as arguments.
`lighter(Color)`
: produces a brigher variant of Color
`darker(Color)`
: produces a darker variant of Color
`shade(Color, Number)`
: changes the lightness of Color. The number ranges from 0 for black to 2 for white.
`alpha(Color, Number)`
: replaces the alpha value of color with number (between 0 and 1)
`mix(Color1, Color2, Number)`
: interpolates between the two colors
@@ -162,8 +158,6 @@ done with
|caret-color|[CSS Basic User Interface Level 3](https://www.w3.org/TR/css3-ui/#caret-color) | CSS allows an auto value |
|-gtk-secondary-caret-color|[Color](https://www.w3.org/TR/css-color-3/#valuea-def-color) | used for the secondary caret in bidirectional text |
|letter-spacing| [CSS Text Level 3](https://www.w3.org/TR/css3-text/#letter-spacing) | |
|text-transform| [CSS Text Level 3](https://www.w3.org/TR/css-text-3/#text-transform-property) | CSS allows full-width and full-size-kana. Since 4.6 |
|line-height| [CSS Inline Layout Level 3](https://www.w3.org/TR/css-inline-3/#line-height-property) | Since 4.6 |
|text-decoration-line| [CSS Text Decoration Level 3](https://www.w3.org/TR/css-text-decor-3/#text-decoration-line-property) | |
|text-decoration-color| [CSS Text Decoration Level 3](https://www.w3.org/TR/css-text-decor-3/#text-decoration-color-property) | |
|text-decoration-style| [CSS Text Decoration Level 3](https://www.w3.org/TR/css-text-decor-3/#text-decoration-style-property) | CSS allows dashed and dotted |

View File

@@ -1,54 +0,0 @@
Title: Drag-and-Drop in GTK
Drag-and-Drop (DND) is a user interaction pattern where users drag a UI element
from one place to another, either inside a single application or between
different application windows.
When the element is 'dropped', data is transferred from the source to the
destination, according to the drag action that is negotiated between both
sides. Most commonly, that is a _copy_, but it can also be a _move_ or a
_link_, depending on the kind of data and how the drag operation has been
set up.
This chapter gives an overview over how Drag-and-Drop is handled with event
controllers in GTK.
## Drag sources
To make data available via DND, you create a [class@Gtk.DragSource]. Drag sources
are event controllers, which initiate a Drag-and-Drop operation when the user clicks
and drags the widget.
A drag source can be set up ahead of time, with the desired drag action(s) and the data
to be transferred. But it is also possible to provide the data when a drag operation
is about to begin, by connecting to the [signal@Gtk.DragSource::prepare] signal.
The GtkDragSource emits the [signal@Gtk.DragSource::drag-begin] signal when the DND
operation starts, and the [signal@Gtk.DragSource::drag-end] signal when it is done.
But it is not normally necessary to handle these signals. One case in which a ::drag-end
handler is necessary is to implement `GDK_ACTION_MOVE`.
## Drop targets
To receive data via DND, you create a [class@Gtk.DropTarget], and tell it what kind of
data to accept. You need to connect to the [signal@Gtk.DropTarget::drop] signal to receive
the data when a DND operation occurs.
While a DND operation is ongoing, GTK provides updates when the pointer moves over
the widget to which the drop target is associated. The [signal@Gtk.DropTarget::enter],
[signal@Gtk.DropTarget::leave] and [signal@Gtk.DropTarget::motion] signals get emitted
for this purpose.
GtkDropTarget provides a simple API, and only provides the data when it has been completely
transferred. If you need to handle the data transfer yourself (for example to provide progress
information during the transfer), you can use the more complicated [class@Gtk.DropTargetAsync].
## Other considerations
It is sometimes necessary to update the UI of the destination while a DND operation is ongoing,
say to scroll or expand a view, or to switch pages. Typically, such UI changes are triggered
by hovering over the widget in question.
[class@Gtk.DropControllerMotion] is an event controller that can help with implementing such
behaviors. It is very similar to [class@Gtk.EventControllerMotion], but provides events during
a DND operation.

View File

@@ -106,7 +106,7 @@ The call to [ctor@Gtk.ApplicationWindow.new] will create a new
window will have a frame, a title bar, and window controls depending on the
platform.
A window title is set using [method@Gtk.Window.set_title]. This function
A window title is set using [`method@Gtk.Window.set_title`]. This function
takes a `GtkWindow` pointer and a string as input. As our `window` pointer
is a `GtkWidget` pointer, we need to cast it to `GtkWindow`; instead of
casting `window` via a typical C cast like `(GtkWindow*)`, `window` can be
@@ -115,7 +115,7 @@ pointer is an instance of the `GtkWindow` class, before casting, and emit a
warning if the check fails. More information about this convention can be
found [here](https://developer.gnome.org/gobject/stable/gtype-conventions.html).
Finally the window size is set using [method@Gtk.Window.set_default_size]
Finally the window size is set using [`method@Gtk.Window.set_default_size`]
and the window is then shown by GTK via [method@Gtk.Widget.show].
When you close the window, by (for example) pressing the X button, the
@@ -161,19 +161,19 @@ activate (GtkApplication *app,
{
GtkWidget *window;
GtkWidget *button;
GtkWidget *box;
window = gtk_application_window_new (app);
gtk_window_set_title (GTK_WINDOW (window), "Window");
gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
button = gtk_button_new_with_label ("Hello World");
gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_window_set_child (GTK_WINDOW (window), box);
button = gtk_button_new_with_label ("Hello World");
g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window);
gtk_window_set_child (GTK_WINDOW (window), button);
gtk_box_append (GTK_BOX (box), button);
gtk_widget_show (window);
}
@@ -212,10 +212,10 @@ The `GtkBox` widget is created with [ctor@Gtk.Box.new], which takes a
this box will contain can either be laid out horizontally or vertically.
This does not matter in this particular case, as we are dealing with only
one button. After initializing box with the newly created `GtkBox`, the code
adds the box widget to the window widget using [method@Gtk.Window.set_child].
adds the box widget to the window widget using [`method@Gtk.Window.set_child`].
Next the `button` variable is initialized in similar manner.
[ctor@Gtk.Button.new_with_label] is called which returns a
[`ctor@Gtk.Button.new_with_label`] is called which returns a
[class@Gtk.Button] to be stored in `button`. Afterwards `button` is added to
our `box`.
@@ -353,7 +353,7 @@ draw function.
The contents of a widget often need to be partially or fully redrawn, e.g.
when another window is moved and uncovers part of the widget, or when the
window containing it is resized. It is also possible to explicitly cause a
widget to be redrawn, by calling [method@Gtk.Widget.queue_draw]. GTK takes
widget to be redrawn, by calling [`method@Gtk.Widget.queue_draw`]. GTK takes
care of most of the details by providing a ready-to-use cairo context to the
draw function.
@@ -690,16 +690,16 @@ gcc $( pkg-config --cflags gtk4 ) -o example-3 example-3.c $( pkg-config --libs
Note that `GtkBuilder` can also be used to construct objects that are
not widgets, such as tree models, adjustments, etc. That is the reason
the method we use here is called [method@Gtk.Builder.get_object] and returns
the method we use here is called [`method@Gtk.Builder.get_object`] and returns
a `GObject` instead of a `GtkWidget`.
Normally, you would pass a full path to [method@Gtk.Builder.add_from_file] to
Normally, you would pass a full path to [`method@Gtk.Builder.add_from_file`] to
make the execution of your program independent of the current directory.
A common location to install UI descriptions and similar data is
`/usr/share/appname`.
It is also possible to embed the UI description in the source code as a
string and use [method@Gtk.Builder.add_from_string] to load it. But keeping the
string and use [`method@Gtk.Builder.add_from_string`] to load it. But keeping the
UI description in a separate file has several advantages: It is then possible
to make minor adjustments to the UI without recompiling your program, and,
more importantly, graphical UI editors such as [Glade](http://glade.gnome.org)
@@ -985,7 +985,7 @@ glib-compile-resources exampleapp.gresource.xml --target=resources.c --generate-
```
The gnome module of the [Meson build system](https://mesonbuild.com)
provides the [gnome.compile_resources()](https://mesonbuild.com/Gnome-module.html#gnomecompile_resources)
provides the [`gnome.compile_resources()`](https://mesonbuild.com/Gnome-module.html#gnomecompile_resources)
method for this task.
Our application now looks like this:
@@ -1081,7 +1081,7 @@ tell it to display information about our stack.
The stack switcher gets all its information it needs to display tabs from
the stack that it belongs to. Here, we are passing the label to show for
each file as the last argument to the [method@Gtk.Stack.add_titled]
each file as the last argument to the [`method@Gtk.Stack.add_titled`]
function.
Our application is beginning to take shape:
@@ -1221,7 +1221,7 @@ Before we can make use of this schema in our application, we need to compile
it into the binary form that GSettings expects. GIO provides
[macros](https://developer.gnome.org/gio/2.36/ch31s06.html) to do this in
autotools-based projects, and the gnome module of the Meson build system
provides the [gnome.compile_schemas()](https://mesonbuild.com/Gnome-module.html#gnomecompile_schemas)
provides the [`gnome.compile_schemas()`](https://mesonbuild.com/Gnome-module.html#gnomecompile_schemas)
method for this task.
Next, we need to connect our settings to the widgets that they are supposed

View File

@@ -46,8 +46,7 @@ display, unless specified otherwise.
<para>
<command>gtk4-launch</command> takes at least one argument, the name of
the application to launch. The name should match application desktop file name,
as residing in the applications subdirectories of the XDG data directories, with
or without the '.desktop' suffix.
as residing in /usr/share/application, with or without the '.desktop' suffix.
</para>
<para>
If called with more than one argument, the rest of them besides the application
@@ -72,14 +71,4 @@ application.
</variablelist>
</refsect1>
<refsect1><title>Environment</title>
<para>Some environment variables affect the behavior of <command>gtk4-launch</command>.</para>
<variablelist>
<varlistentry>
<term><option>XDG_DATA_HOME</option>, <option>XDG_DATA_DIRS</option></term>
<listitem><para>The environment variables specifying the XDG dta directories.</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
</refentry>

View File

@@ -5,7 +5,7 @@ repository_url = "https://gitlab.gnome.org/GNOME/gtk.git"
website_url = "https://www.gtk.org"
authors = "GTK Development Team"
logo_url = "gtk-logo.svg"
license = "LGPL-2.1-or-later"
license = "GPL-2.1-or-later"
description = "The GTK toolkit"
dependencies = [ "GObject-2.0", "Graphene-1.0", "Pango-1.0", "Gdk-4.0", "Gsk-4.0" ]
devhelp = true
@@ -14,7 +14,7 @@ search_index = true
[dependencies."GObject-2.0"]
name = "GObject"
description = "The base type system library"
docs_url = "https://docs.gtk.org/gobject/"
docs_url = "https://developer.gnome.org/gobject/stable"
[dependencies."Graphene-1.0"]
name = "Graphene"
@@ -24,17 +24,17 @@ search_index = true
[dependencies."Pango-1.0"]
name = "Pango"
description = "Text shaping and rendering"
docs_url = "https://docs.gtk.org/Pango/"
docs_url = "https://developer.gnome.org/pango/stable"
[dependencies."Gdk-4.0"]
name = "GDK"
description = "The GTK windowing system abstraction"
docs_url = "https://docs.gtk.org/gdk4/"
docs_url = "https://gnome.pages.gitlab.gnome.org/gtk/gdk4/"
[dependencies."Gsk-4.0"]
name = "GSK"
description = "The GTK rendering abstraction"
docs_url = "https://docs.gtk.org/gsk4/"
docs_url = "https://gnome.pages.gitlab.gnome.org/gtk/gsk4/"
[theme]
name = "basic"
@@ -57,7 +57,6 @@ content_files = [
"initialization.md",
"actions.md",
"input-handling.md",
"drag-and-drop.md",
"drawing-model.md",
"css-overview.md",
"css-properties.md",

View File

@@ -7,7 +7,7 @@ Title: Initialization
Before using GTK, you need to initialize it using [func@Gtk.init]; this
connects to the windowing system, sets up the locale and performs other
initialization tasks. [func@Gtk.init] exits the application if errors occur;
to avoid this, you can use [func@Gtk.init_check], which allows you to recover
to avoid this, you can use [`func@Gtk.init_check`], which allows you to recover
from a failed GTK initialization; for instance, you might start up your
application in text mode instead.

View File

@@ -137,14 +137,6 @@ capture phase, and key bindings locally, during the target phase.
Under the hood, all shortcuts are represented as instances of `GtkShortcut`,
and they are managed by `GtkShortcutController`.
## Text input
When actual text input is needed (i.e. not just keyboard shortcuts),
input method support can be added to a widget by connecting an input
method context and listening to its `::commit` signal. To create a new
input method context, use gtk_im_multicontext_new(), to provide it with
input, use gtk_event_controller_key_set_im_context().
## Event controllers and gestures
Event controllers are standalone objects that can perform

View File

@@ -27,15 +27,9 @@ expand_content_md_files = [
'visual_index.md'
]
if get_option('gtk_doc')
gtk4_toml = configure_file(
input: 'gtk4.toml.in',
output: 'gtk4.toml',
configuration: toml_conf,
install: true,
install_dir: docs_dir / 'gtk4',
)
gtk4_toml = configure_file(input: 'gtk4.toml.in', output: 'gtk4.toml', configuration: toml_conf)
if get_option('gtk_doc')
custom_target('gtk4-doc',
input: [ gtk4_toml, gtk_gir[0] ],
output: 'gtk4',
@@ -43,7 +37,6 @@ if get_option('gtk_doc')
gidocgen,
'generate',
'--quiet',
'--fatal-warnings',
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
'--config=@INPUT0@',
'--output-dir=@OUTPUT@',
@@ -77,21 +70,16 @@ if get_option('man-pages') and xsltproc.found()
man_files = [
[ 'gtk4-broadwayd', '1', ],
[ 'gtk4-builder-tool', '1', ],
[ 'gtk4-demo', '1', ],
[ 'gtk4-demo-application', '1', ],
[ 'gtk4-encode-symbolic-svg', '1', ],
[ 'gtk4-icon-browser', '1', ],
[ 'gtk4-launch', '1', ],
[ 'gtk4-query-settings', '1', ],
[ 'gtk4-update-icon-cache', '1', ],
[ 'gtk4-widget-factory', '1', ],
]
if get_option('demos')
man_files += [
[ 'gtk4-demo', '1', ],
[ 'gtk4-demo-application', '1', ],
[ 'gtk4-widget-factory', '1', ],
[ 'gtk4-icon-browser', '1', ],
]
endif
foreach man: man_files
man_name = man.get(0)
man_section = man.get(1, '1')

File diff suppressed because it is too large Load Diff

View File

@@ -33,13 +33,13 @@ the question you have, this list is a good place to start.
4. How does memory management work in GTK? Should I free data returned from functions?
See the documentation for `GObject` and `GInitiallyUnowned`. For `GObject` note
specifically `g_object_ref()` and `g_object_unref()`. `GInitiallyUnowned` is a
subclass of `GObject` so the same points apply, except that it has a "floating"
See the documentation for #GObject and #GInitiallyUnowned. For #GObject note
specifically g_object_ref() and g_object_unref(). #GInitiallyUnowned is a
subclass of #GObject so the same points apply, except that it has a "floating"
state (explained in its documentation).
For strings returned from functions, they will be declared "const" if they should
not be freed. Non-const strings should be freed with `g_free()`. Arrays follow the
not be freed. Non-const strings should be freed with g_free(). Arrays follow the
same rule. If you find an undocumented exception to the rules, please
[file a bug report.](https://gitlab.gnome.org/GNOME/gtk/issues/new).
@@ -47,7 +47,7 @@ the question you have, this list is a good place to start.
documentation can provide useful hints for memory handling semantics as well.
5. Why does my program leak memory, if I destroy a widget immediately
after creating it?
after creating it ?
If `GtkFoo` isn't a toplevel window, then
@@ -60,7 +60,7 @@ the question you have, this list is a good place to start.
want standard reference counting, not floating reference counting.
To get this, you must acquire a reference to the widget and drop the
floating reference (_ref and sink_ in `GObject` parlance) after creating it:
floating reference (_ref and sink_ in GObject parlance) after creating it:
foo = gtk_foo_new ();
g_object_ref_sink (foo);
@@ -72,12 +72,12 @@ the question you have, this list is a good place to start.
6. How do I use GTK with threads?
GTK requires that all GTK API calls are made from the same thread in which
the `GtkApplication` was created, or `gtk_init()` was called (the _main thread_).
the #GtkApplication was created, or gtk_init() was called (the _main thread_).
If you want to take advantage of multi-threading in a GTK application,
it is usually best to send long-running tasks to worker threads, and feed
the results back to the main thread using `g_idle_add()` or `GAsyncQueue`. GIO
offers useful tools for such an approach such as `GTask`.
the results back to the main thread using g_idle_add() or #GAsyncQueue. GIO
offers useful tools for such an approach such as #GTask.
7. How do I internationalize a GTK program?
@@ -239,7 +239,7 @@ the question you have, this list is a good place to start.
gdk_surface_set_events (gdk_surface,
(GdkEventMask) GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
There are very few functions that require this cast, however.
10. How do I use GTK with other non-C languages?
@@ -250,14 +250,14 @@ the question you have, this list is a good place to start.
11. How do I load an image or animation from a file?
To load an image file straight into a display widget, use
[ctor@Gtk.Image.new_from_file]. To load an image for another purpose, use
[ctor@Gdk.Texture.new_from_file]. To load a video from a file, use
[ctor@Gtk.MediaFile.new_for_file].
gtk_image_new_from_file(). To load an image for another purpose, use
gdk_texture_new_from_file(). To load a video from a file, use
gtk_media_file_new_for_file().
12. How do I draw text?
To draw a piece of text onto a cairo surface, use a Pango layout and
[func@PangoCairo.show_layout].
pango_cairo_show_layout().
layout = gtk_widget_create_pango_layout (widget, text);
fontdesc = pango_font_description_from_string ("Luxi Mono 12");
@@ -265,17 +265,17 @@ the question you have, this list is a good place to start.
pango_cairo_show_layout (cr, layout);
pango_font_description_free (fontdesc);
g_object_unref (layout);
See also the [Cairo Rendering](https://developer.gnome.org/pango/stable/pango-Cairo-Rendering.html)
section of the [Pango documentation](https://developer.gnome.org/pango/stable/).
To draw a piece of text in a widget [vfunc@Gtk.Widget.snapshot] implementation,
use [method@Gtk.Snapshot.append_layout].
To draw a piece of text in a widget snapshot() implementation, use
gtk_snapshot_append_layout().
13. How do I measure the size of a piece of text?
To obtain the size of a piece of text, use a Pango layout and
[method@Pango.Layout.get_pixel_size], using code like the following:
pango_layout_get_pixel_size(), using code like the following:
layout = gtk_widget_create_pango_layout (widget, text);
fontdesc = pango_font_description_from_string ("Luxi Mono 12");
@@ -294,7 +294,7 @@ the question you have, this list is a good place to start.
compiler to optimize the call away if it appears that the value is not
being used.
GLib provides the `g_type_ensure()` function to work around this problem.
GLib provides the g_type_ensure() function to work around this problem.
g_type_ensure (GTK_TYPE_BLAH);
@@ -311,34 +311,34 @@ the question you have, this list is a good place to start.
and the required formatting flexibility.
If you want to display a large amount of data in a uniform way, your best
option is a [class@Gtk.TreeView] widget. See the [tree widget overview](#TreeWidget).
option is a #GtkTreeView widget. See the [tree widget overview](#TreeWidget).
A list is just a tree with no branches, so the treeview widget is used for
lists as well.
If you want to display a small amount of items, but need flexible formatting
and widgetry inside the list, then you probably want to use a [class@Gtk.ListBox],
and widgetry inside the list, then you probably want to use a #GtkListBox,
which uses regular widgets for display.
17. ...for multi-line text display or editing?
See the [text widget overview](#TextWidget) -- you should use the
[class@Gtk.TextView] widget.
#GtkTextView widget.
If you only have a small amount of text, [class@Gtk.Label] may also be appropriate
of course. It can be made selectable with [method@Gtk.Label.set_selectable]. For a
single-line text entry, see [class@Gtk.Entry].
If you only have a small amount of text, #GtkLabel may also be appropriate
of course. It can be made selectable with gtk_label_set_selectable(). For a
single-line text entry, see #GtkEntry.
18. ...to display an image or animation?
GTK has two widgets that are dedicated to displaying images. [class@Gtk.Image], for
small, fixed-size icons and [class@Gtk.Picture] for content images.
GTK has two widgets that are dedicated to displaying images. #GtkImage, for
small, fixed-size icons and #GtkPicture for content images.
Both can display images in just about any format GTK understands.
You can also use [class@Gtk.DrawingArea] if you need to do something more complex,
You can also use #GtkDrawingArea if you need to do something more complex,
such as draw text or graphics over the top of the image.
Both [class@Gtk.Image] and [class@Gtk.Picture] can display animations and videos as well.
To show an webm file, load it with the [class@Gtk.MediaFile] API and then use
Both GtkImage and GtkPicture can display animations and videos as well.
To show an webm file, load it with the GtkMediaFile API and then use
it as a paintable:
mediafile = gtk_media_file_new_for_filename ("example.webm");
@@ -347,10 +347,8 @@ the question you have, this list is a good place to start.
19. ...for presenting a set of mutually-exclusive choices, where Windows
would use a combo box?
With GTK, a [class@Gtk.ComboBox] is the recommended widget to use for this use case.
If you need an editable text entry, use the [property@Gtk.ComboBox:has-entry] property.
A newer alternative is [class@Gtk.DropDown].
With GTK, a #GtkComboBox is the recommended widget to use for this use case.
If you need an editable text entry, use the #GtkComboBox:has-entry property.
## Questions about GtkWidget
@@ -359,8 +357,8 @@ the question you have, this list is a good place to start.
The background color of a widget is determined by the CSS style that applies
to it. To change that, you can set style classes on the widget, and provide
custom CSS to change the appearance. Such CSS can be loaded with
[method@Gtk.CssProvider.load_from_file] and its variants.
See [method@Gtk.StyleContext.add_provider].
gtk_css_provider_load_from_file() and its variants.
See gtk_style_context_add_provider().
21. How do I change the font of a widget?
@@ -370,7 +368,7 @@ the question you have, this list is a good place to start.
gtk_label_set_markup (label, "<big>big tex</big>");
This is preferred for many apps because it's a relative size to the
user's chosen font size. See `g_markup_escape_text()` if you are
user's chosen font size. See g_markup_escape_text() if you are
constructing such strings on the fly.
You can also change the font of a widget by putting
@@ -379,24 +377,24 @@ the question you have, this list is a good place to start.
font: Sans 30;
}
in a CSS file, loading it with [method@Gtk.CssProvider.load_from_file], and
adding the provider with [func@Gtk.StyleContext.add_provider_for_display].
in a CSS file, loading it with gtk_css_provider_load_from_file(), and
adding the provider with gtk_style_context_add_provider_for_display().
To associate this style information with your widget, set a style class
on the widget using [method@Gtk.Widget.add_css_class]. The advantage
on its #GtkStyleContext using gtk_style_context_add_class(). The advantage
of this approach is that users can then override the font you have chosen.
See the `GtkStyleContext` documentation for more discussion.
See the #GtkStyleContext documentation for more discussion.
22. How do I disable/ghost/desensitize a widget?
In GTK a disabled widget is termed _insensitive_.
See [method@Gtk.Widget.set_sensitive].
See gtk_widget_set_sensitive().
## GtkTextView questions
23. How do I get the contents of the entire text widget as a string?
See [method@Gtk.TextBuffer.get_bounds] and [method@Gtk.TextBuffer.get_text]
or [method@Gtk.TextIter.get_text].
See gtk_text_buffer_get_bounds() and gtk_text_buffer_get_text()
or gtk_text_iter_get_text().
GtkTextIter start, end;
GtkTextBuffer *buffer;
@@ -407,10 +405,10 @@ the question you have, this list is a good place to start.
text = gtk_text_iter_get_text (&start, &end);
/* use text */
g_free (text);
24. How do I make a text widget display its complete contents in a specific font?
If you use [method@Gtk.TextBuffer.insert_with_tags] with appropriate tags to
If you use gtk_text_buffer_insert_with_tags() with appropriate tags to
select the font, the inserted text will have the desired appearance, but
text typed in by the user before or after the tagged block will appear in
the default style.
@@ -423,40 +421,40 @@ the question you have, this list is a good place to start.
*before*, keeping the mark at the end.
To ensure that the end of the buffer remains visible, use
[method@Gtk.TextView.scroll_to_mark] to scroll to the mark after
gtk_text_view_scroll_to_mark() to scroll to the mark after
inserting new text.
The gtk4-demo application contains an example of this technique.
The gtk-demo application contains an example of this technique.
## GtkTreeView questions
26. How do I associate some data with a row in the tree?
Remember that the [class@Gtk.TreeModel] columns don't necessarily have to be
Remember that the #GtkTreeModel columns don't necessarily have to be
displayed. So you can put non-user-visible data in your model just
like any other data, and retrieve it with [method@Gtk.TreeModel.get].
See the [tree widget overview](#TreeWidget).
like any other data, and retrieve it with gtk_tree_model_get().
See the [tree widget overview](#TreeWidget).
27. How do I put an image and some text in the same column?
You can pack more than one [class@Gtk.CellRenderer] into a single [class@Gtk.TreeViewColumn]
using [method@Gtk.TreeViewColumn.pack_start] or [method@Gtk.TreeViewColumn.pack_end].
So pack both a [class@Gtk.CellRendererPixbuf] and a [class@Gtk.CellRendererText] into the
You can pack more than one #GtkCellRenderer into a single #GtkTreeViewColumn
using gtk_tree_view_column_pack_start() or gtk_tree_view_column_pack_end().
So pack both a #GtkCellRendererPixbuf and a #GtkCellRendererText into the
column.
28. I can set data easily on my [class@Gtk.TreeStore] or [class@Gtk.ListStore] models using
[method@Gtk.ListStore.set] and [method@Gtk.TreeStore.set], but can't read it back?
28. I can set data easily on my #GtkTreeStore or #GtkListStore models using
gtk_list_store_set() and gtk_tree_store_set(), but can't read it back?
Both the [class@Gtk.TreeStore] and the [class@Gtk.ListStore] implement the [class@Gtk.TreeModel]
Both the #GtkTreeStore and the #GtkListStore implement the #GtkTreeModel
interface. As a consequence, you can use any function this interface
implements. The easiest way to read a set of data back is to use
[method@Gtk.TreeModel.get].
gtk_tree_model_get().
29. How do I change the way that numbers are formatted by `GtkTreeView`?
29. How do I change the way that numbers are formatted by #GtkTreeView?
Use [method@Gtk.TreeView.insert_column_with_data_func] or
[method@Gtk.TreeViewColumn.set_cell_data_func] and do the conversion
from number to string yourself (with, say, `g_strdup_printf()`).
Use gtk_tree_view_insert_column_with_data_func() or
gtk_tree_view_column_set_cell_data_func() and do the conversion
from number to string yourself (with, say, g_strdup_printf()).
The following example demonstrates this:
@@ -529,29 +527,29 @@ the question you have, this list is a good place to start.
30. How do I hide the expander arrows in my tree view?
Set the expander-column property of the tree view to a hidden column.
See [method@Gtk.TreeView.set_expander_column] and [method@Gtk.TreeViewColumn.set_visible].
See gtk_tree_view_set_expander_column() and gtk_tree_view_column_set_visible().
## Using cairo with GTK
31. How do I use cairo to draw in GTK applications?
Use [method@Gtk.Snapshot.append_cairo] in your [vfunc@Gtk.Widget.snapshot] vfunc
Use gtk_snapshot_append_cairo() in your #GtkWidgetClass.snapshot() vfunc
to obtain a cairo context and draw with that.
32. Can I improve the performance of my application by using another backend
of cairo (such as GL)?
No. Most drawing in GTK is not done via cairo anymore (but instead
by the GL or Vulkan renderers of GSK).
If you use cairo for drawing your own widgets, [method@Gtk.Snapshot.append_cairo]
If you use cairo for drawing your own widgets, gtk_snapshot_append_cairo()
will choose the most appropriate surface type for you.
If you are interested in using GL for your own drawing, see [class@Gtk.GLArea].
If you are interested in using GL for your own drawing, see #GtkGLArea.
33. Can I use cairo to draw on a `GdkPixbuf`?
33. Can I use cairo to draw on a #GdkPixbuf?
No. The cairo image surface does not support the pixel format used by `GdkPixbuf`.
No. The cairo image surface does not support the pixel format used by GdkPixbuf.
If you need to get cairo drawing into a format that can be displayed efficiently
by GTK, you may want to use an image surface and [ctor@Gdk.MemoryTexture.new].
by GTK, you may want to use an image surface and gdk_memory_texture_new().

View File

@@ -22,26 +22,20 @@ are only available when GTK has been configured with `-Ddebug=true`.
`builder`
: GtkBuilder support
`builder-objects`
: Unused GtkBuilder objects
`geometry`
: Size allocation
`icontheme`
: Icon themes
`iconfallback`
: Information about icon fallback
`keybindings`
: Keyboard shortcuts
: Keybindings
`modules`
: Modules and extensions
: Loading of modules
`printing`
: Printing
: Printing support
`size-request`
: Size requests
@@ -52,15 +46,6 @@ are only available when GTK has been configured with `-Ddebug=true`.
`tree`
: Tree widget internals
`constraints`
: Constraints and the constraint solver
`layout`
: Layout managers
`acccessibility`
: Accessibility state changs
A number of keys are influencing behavior instead of just logging:
`interactive`
@@ -72,6 +57,15 @@ A number of keys are influencing behavior instead of just logging:
`touchscreen`
: Pretend the pointer is a touchscreen device
`updates`
: Visual feedback about window updates
`resize`
: Highlight resizing widgets
`layout`
: Show layout borders
`snapshot`
: Include debug render nodes in the generated snapshots
@@ -330,14 +324,8 @@ using and the GDK backend supports them:
`cairo`
: Selects the fallback Cairo renderer
`opengl`
: Selects the default OpenGL renderer
`gl`
: Selects the "gl" OpenGL renderer
`ngl`
: Selects the "ngl" OpenGL renderer
: Selects the default OpenGL renderer
`vulkan`
: Selects the Vulkan renderer

View File

@@ -8,7 +8,7 @@ an application's user interface elements. Assistive technology (AT)
applications, like Orca, convey this information to users with disabilities,
or reduced abilities, to help them use the application.
Standard GTK controls implement the `GtkAccessible` interface and are thus
Standard GTK controls implement the #GtkAccessible interface and are thus
accessible to ATs by default. This means that if you use GTK controls such
as `GtkButton`, `GtkEntry`, or `GtkListView`, you only need to supply
application-specific details when the defaults values are incomplete. You
@@ -103,39 +103,39 @@ for instance:
- a toggle button will change its %GTK_ACCESSIBLE_STATE_CHECKED state every
time it is toggled, either by the user or programmatically
- setting the mnemonic widget on a `GtkLabel` will update the
- setting the mnemonic widget on a #GtkLabel will update the
%GTK_ACCESSIBLE_RELATION_LABELLED_BY relation on the widget with a
reference to the label
- changing the `GtkAdjustment` instance on a `GtkScrollbar` will change the
- changing the #GtkAdjustment instance on a #GtkScrollbar will change the
%GTK_ACCESSIBLE_PROPERTY_VALUE_MAX, %GTK_ACCESSIBLE_PROPERTY_VALUE_MIN,
and %GTK_ACCESSIBLE_PROPERTY_VALUE_NOW properties with the upper, lower,
and value properties of the `GtkAdjustment`
and value properties of the #GtkAdjustment
See the [WAI-ARIA](https://www.w3.org/WAI/PF/aria/appendices#quickref) list
of attributes for additional information.
#### List of accessible states
Each state name is part of the `GtkAccessibleState` enumeration.
Each state name is part of the #GtkAccessibleState enumeration.
| State name | ARIA attribute | Value type | Notes |
|------------|----------------|------------|-------|
| %GTK_ACCESSIBLE_STATE_BUSY | “aria-busy” | boolean |
| %GTK_ACCESSIBLE_STATE_CHECKED | “aria-checked” | `GtkAccessibleTristate` | Indicates the current state of a [class@Gtk.CheckButton] |
| %GTK_ACCESSIBLE_STATE_CHECKED | “aria-checked” | #GtkAccessibleTristate | Indicates the current state of a [class@Gtk.CheckButton] |
| %GTK_ACCESSIBLE_STATE_DISABLED | “aria-disabled” | boolean | Corresponds to the [property@Gtk.Widget:sensitive] property on [class@Gtk.Widget] |
| %GTK_ACCESSIBLE_STATE_EXPANDED | “aria-expanded” | boolean or undefined | Corresponds to the [property@Gtk.Expander:expanded] property on [class@Gtk.Expander] |
| %GTK_ACCESSIBLE_STATE_HIDDEN | “aria-hidden” | boolean | Corresponds to the [property@Gtk.Widget:visible] property on [class@Gtk.Widget] |
| %GTK_ACCESSIBLE_STATE_INVALID | “aria-invalid” | `GtkAccessibleInvalidState` | Set when a widget is showing an error |
| %GTK_ACCESSIBLE_STATE_PRESSED | “aria-pressed” | `GtkAccessibleTristate` | Indicates the current state of a [class@Gtk.ToggleButton] |
| %GTK_ACCESSIBLE_STATE_INVALID | “aria-invalid” | #GtkAccessibleInvalidState | Set when a widget is showing an error |
| %GTK_ACCESSIBLE_STATE_PRESSED | “aria-pressed” | #GtkAccessibleTristate | Indicates the current state of a [class@Gtk.ToggleButton] |
| %GTK_ACCESSIBLE_STATE_SELECTED | “aria-selected” | boolean or undefined | Set when a widget is selected |
#### List of accessible properties
Each property name is part of the `GtkAccessibleProperty` enumeration.
Each property name is part of the #GtkAccessibleProperty enumeration.
| State name | ARIA attribute | Value type |
|------------|----------------|------------|
| %GTK_ACCESSIBLE_PROPERTY_AUTOCOMPLETE | “aria-autocomplete” | `GtkAccessibleAutocomplete` |
| %GTK_ACCESSIBLE_PROPERTY_AUTOCOMPLETE | “aria-autocomplete” | #GtkAccessibleAutocomplete |
| %GTK_ACCESSIBLE_PROPERTY_DESCRIPTION | “aria-description” | translatable string |
| %GTK_ACCESSIBLE_PROPERTY_HAS_POPUP | “aria-haspopup” | boolean |
| %GTK_ACCESSIBLE_PROPERTY_KEY_SHORTCUTS | “aria-keyshortcuts” | string |
@@ -144,12 +144,12 @@ Each property name is part of the `GtkAccessibleProperty` enumeration.
| %GTK_ACCESSIBLE_PROPERTY_MODAL | “aria-modal” | boolean |
| %GTK_ACCESSIBLE_PROPERTY_MULTI_LINE | “aria-multiline” | boolean |
| %GTK_ACCESSIBLE_PROPERTY_MULTI_SELECTABLE | “aria-multiselectable” | boolean |
| %GTK_ACCESSIBLE_PROPERTY_ORIENTATION | “aria-orientation” | `GtkOrientation` |
| %GTK_ACCESSIBLE_PROPERTY_ORIENTATION | “aria-orientation” | #GtkOrientation |
| %GTK_ACCESSIBLE_PROPERTY_PLACEHOLDER | “aria-placeholder” | translatable string |
| %GTK_ACCESSIBLE_PROPERTY_READ_ONLY | “aria-readonly” | boolean |
| %GTK_ACCESSIBLE_PROPERTY_REQUIRED | “aria-required” | boolean |
| %GTK_ACCESSIBLE_PROPERTY_ROLE_DESCRIPTION | “aria-roledescription” | translatable string |
| %GTK_ACCESSIBLE_PROPERTY_SORT | “aria-sort” | `GtkAccessibleSort` |
| %GTK_ACCESSIBLE_PROPERTY_SORT | “aria-sort” | #GtkAccessibleSort |
| %GTK_ACCESSIBLE_PROPERTY_VALUE_MAX | “aria-valuemax” | double |
| %GTK_ACCESSIBLE_PROPERTY_VALUE_MIN | “aria-valuemin” | double |
| %GTK_ACCESSIBLE_PROPERTY_VALUE_NOW | “aria-valuenow” | double |
@@ -157,22 +157,22 @@ Each property name is part of the `GtkAccessibleProperty` enumeration.
#### List of accessible relations
Each relation name is part of the `GtkAccessibleRelation` enumeration.
Each relation name is part of the #GtkAccessibleRelation enumeration.
| State name | ARIA attribute | Value type |
|------------|----------------|------------|
| %GTK_ACCESSIBLE_RELATION_ACTIVE_DESCENDANT | “aria-activedescendant” | `GtkAccessible` |
| %GTK_ACCESSIBLE_RELATION_ACTIVE_DESCENDANT | “aria-activedescendant” | #GtkAccessible |
| %GTK_ACCESSIBLE_RELATION_COL_COUNT | “aria-colcount” | integer |
| %GTK_ACCESSIBLE_RELATION_COL_INDEX | “aria-colindex” | integer |
| %GTK_ACCESSIBLE_RELATION_COL_INDEX_TEXT | “aria-colindextext” | translatable string |
| %GTK_ACCESSIBLE_RELATION_COL_SPAN | “aria-colspan” | integer |
| %GTK_ACCESSIBLE_RELATION_CONTROLS | “aria-controls” | a list of `GtkAccessible` |
| %GTK_ACCESSIBLE_RELATION_DESCRIBED_BY | “aria-describedby” | a list of `GtkAccessible` |
| %GTK_ACCESSIBLE_RELATION_DETAILS | “aria-details” | a list of `GtkAccessible` |
| %GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE | “aria-errormessage” | `GtkAccessible` |
| %GTK_ACCESSIBLE_RELATION_FLOW_TO | “aria-flowto” | a list of `GtkAccessible` |
| %GTK_ACCESSIBLE_RELATION_LABELLED_BY | “aria-labelledby” | a list of `GtkAccessible` |
| %GTK_ACCESSIBLE_RELATION_OWNS | “aria-owns” | a list of `GtkAccessible` |
| %GTK_ACCESSIBLE_RELATION_CONTROLS | “aria-controls” | a list of #GtkAccessible |
| %GTK_ACCESSIBLE_RELATION_DESCRIBED_BY | “aria-describedby” | a list of #GtkAccessible |
| %GTK_ACCESSIBLE_RELATION_DETAILS | “aria-details” | a list of #GtkAccessible |
| %GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE | “aria-errormessage” | #GtkAccessible |
| %GTK_ACCESSIBLE_RELATION_FLOW_TO | “aria-flowto” | a list of #GtkAccessible |
| %GTK_ACCESSIBLE_RELATION_LABELLED_BY | “aria-labelledby” | a list of #GtkAccessible |
| %GTK_ACCESSIBLE_RELATION_OWNS | “aria-owns” | a list of #GtkAccessible |
| %GTK_ACCESSIBLE_RELATION_POS_IN_SET | “aria-posinset” | integer |
| %GTK_ACCESSIBLE_RELATION_ROW_COUNT | “aria-rowcount” | integer |
| %GTK_ACCESSIBLE_RELATION_ROW_INDEX | “aria-rowindex” | integer |
@@ -219,11 +219,11 @@ be used as part of the application's test suite to avoid regressions.
## Implementations
Each UI control implements the `GtkAccessible` interface to allow widget and
Each UI control implements the #GtkAccessible interface to allow widget and
application developers to specify the roles, state, and relations between UI
controls. This API is purely descriptive.
Each `GtkAccessible` implementation must provide a `GtkATContext` instance,
Each `GtkAccessible` implementation must provide a #GtkATContext instance,
which acts as a proxy to the specific platform's accessibility API:
* AT-SPI on Linux/BSD
@@ -256,7 +256,7 @@ is a promise that the widget being created will provide the same keyboard
interactions expected for a button. An accessible role of a button will not
turn automatically any widget into a `GtkButton`; but if your widget behaves
like a button, using the %GTK_ACCESSIBLE_ROLE_BUTTON will allow any
assistive technology to handle it like they would a `GtkButton`.
assistive technology to handle it like they would a #GtkButton.
### Attributes can both hide and enhance
@@ -308,7 +308,7 @@ interface.
A "presentation" role should not be confused with the
%GTK_ACCESSIBLE_STATE_HIDDEN state; the "hidden" state is transient, and is
typically controlled by showing and hiding a widget using the `GtkWidget`
typically controlled by showing and hiding a widget using the #GtkWidget
API.
## Design patterns and custom widgets
@@ -322,7 +322,7 @@ as well.
A button is a widget that enables users to trigger an action. While it is
recommended you use `GtkButton` for anything that looks and behaves like a
button, it is possible to apply a button behavior to UI elements like images
by using a `GtkGestureClick` gesture. When doing so, you should:
by using a #GtkGestureClick gesture. When doing so, you should:
- Give your widget the role %GTK_ACCESSIBLE_ROLE_BUTTON
- Install an action with no parameters, which will activate the widget
@@ -336,7 +336,7 @@ in the same way as a `GtkSpinButton` or `GtkSearchEntry`.
### Tab-based UI
If you make a tab-based interface, you should consider using `GtkStack`
If you make a tab-based interface, you should consider using #GtkStack
as the core, and just make a custom tab widget to control the active
stack page. When doing so, the following extra steps will ensure that
your tabs are accessible in the same way as `GtkStackSwitcher` or `GtkNotebook`:
@@ -344,7 +344,7 @@ your tabs are accessible in the same way as `GtkStackSwitcher` or `GtkNotebook`:
- Give your tab container the role %GTK_ACCESSIBLE_ROLE_TAB_LIST
- Give your tab widgets the role %GTK_ACCESSIBLE_ROLE_TAB
- Set up the %GTK_ACCESSIBLE_RELATION_CONTROLS relation between each
tab and the `GtkStackPage` object for its page
tab and the #GtkStackPage object for its page
- Set the %GTK_ACCESSIBLE_PROPERTY_SELECTED property on each tab, with
the active tab getting the value %TRUE, all others %FALSE
@@ -357,7 +357,7 @@ or add a `activate-tab` action on each tab.
### Value controls
A value control (ie a widget that controls a one-dimensional quantity
that can be represented by a `GtkAdjustment`) can be represented to
that can be represented by a #GtkAdjustment) can be represented to
accessible technologies by setting the %GTK_ACCESSIBLE_PROPERTY_VALUE_MIN,
%GTK_ACCESSIBLE_PROPERTY_VALUE_MAX, and %GTK_ACCESSIBLE_PROPERTY_VALUE_NOW
properties.

View File

@@ -24,25 +24,25 @@ you should be aware of what they refer to. These are often generic terms that
have a specific meaning in this context.
**_Views_** or **_list widgets_** are the widgets that hold and manage the lists.
Examples of these widgets would be `GtkListView` or `GtkGridView`.
Examples of these widgets would be #GtkListView or #GtkGridView.
Views display data from a **_model_**. A model is a `GListModel` and models can
Views display data from a **_model_**. A model is a #GListModel and models can
be provided in 3 ways or combinations thereof:
* Many list models implementations already exist. There are models that provide
specific data, like `GtkDirectoryList`. And there are models like `GListStore`
specific data, like #GtkDirectoryList. And there are models like #GListStore
that allow building lists manually.
* Wrapping list models like `GtkFilterListModel` or `GtkSortListModel`
* Wrapping list models like #GtkFilterListModel or #GtkSortListModel
modify, adapt or combine other models.
* Last but not least, developers are encouraged to create their own `GListModel`
* Last but not least, developers are encouraged to create their own #GListModel
implementations. The interface is kept deliberately small to make this easy.
The same model can be used in multiple different views and wrapped with
multiple different models at once.
The elements in a model are called **_items_**. All items are `GObjects`.
The elements in a model are called **_items_**. All items are #GObjects.
Every item in a model has a **_position_** which is the unsigned integer that
describes where in the model the item is located. The first item in a model is
@@ -56,11 +56,11 @@ with models. Oftentimes some things are really hard to do one way but very easy
the other way.
The other important part of a view is a **_factory_**. Each factory is
a `GtkListItemFactory` implementation that takes care of mapping the items
a #GtkListItemFactory implementation that takes care of mapping the items
of the model to widgets that can be shown in the view.
The way factories do this is by creating a **_listitem_** for each item that
is currently in use. Listitems are always `GtkListItem` objects. They are only
is currently in use. Listitems are always #GtkListItem objects. They are only
ever created by GTK and provide information about what item they are meant
to display.
@@ -71,28 +71,28 @@ for the data displayed, the programming language and development environment
is an important task that can simplify setting up the view tremendously.
Views support selections via a **_selection model_**. A selection model is an
implementation of the `GtkSelectionModel` interface on top of the `GListModel`
implementation of the #GtkSelectionModel interface on top of the #GListModel
interface that allows marking each item in a model as either selected or not
selected. Just like regular models, this can be implemented either by
implementing `GtkSelectionModel` directly or by wrapping a model with one of
the GTK models provided for this purposes, such as `GtkNoSelection`
or `GtkSingleSelection`.
implementing #GtkSelectionModel directly or by wrapping a model with one of
the GTK models provided for this purposes, such as #GtkNoSelection
or #GtkSingleSelection.
The behavior of selection models - ie which items they allow selecting and
what effect this has on other items - is completely up to the selection model.
As such, single-selections, multi-selections or sharing selection state between
different selection models and/or views is possible. The selection state of an
item is exposed in the listitem via the `GtkListItem:selected` property.
item is exposed in the listitem via the #GtkListItem:selected property.
Views and listitems also support activation. Activation means that double
clicking or pressing enter while inside a focused row will cause the view
to emit and activation signal such as `GtkListView::activate`. This provides
to emit and activation signal such as #GtkListView::activate. This provides
an easy way to set up lists, but can also be turned off on listitems if undesired.
Both selections and activation are supported among other things via widget
[actions](#actions-overview). This allows developers to add widgets to their
lists that cause selections to change or to trigger activation via
the `GtkActionable` interface. For a list of all supported actions see the
the #GtkActionable interface. For a list of all supported actions see the
relevant documentation.
## Behind the scenes
@@ -114,8 +114,8 @@ new position at any time causing any state to be lost.
Another important requirement for views is that they need to know which items
are not visible so they can be recycled. Views achieve that by implementing
the `GtkScrollable` interface and expecting to be placed directly into
a `GtkScrolledWindow`.
the #GtkScrollable interface and expecting to be placed directly into
a #GtkScrolledWindow.
Of course, if you are only using models with few items, this is not important
and you can treat views like any other widget. But if you use large lists and
@@ -128,8 +128,8 @@ tradeoffs of those and experiment with them.
GTK offers a wide variety of wrapping models which change or supplement an
existing model (or models) in some way. But when it comes to storing your
actual data, there are only a few ready-made choices available: `GListStore`
and `GtkStringList`.
actual data, there are only a few ready-made choices available: #GListStore
and #GtkStringList.
GListStore is backed by a balanced tree and has performance characteristics
that are expected for that data structure. It works reasonably well for dataset
@@ -143,7 +143,7 @@ place where you would otherwise use `char*[]` and works best if the dataset
is not very dynamic.
If these models don't fit your use case or scalability requirements, you
should make a custom `GListModel`. It is a small interface and not very hard
should make a custom #GListModel. It is a small interface and not very hard
to implement.
For asymptotic performance comparisons between tree- and array-based
@@ -152,23 +152,23 @@ implementations, see this
## Displaying trees
While `GtkTreeView` provided built-in support for trees, the list widgets, and
in particular `GListModel` do not. This was a design choice because the common
While #GtkTreeView provided built-in support for trees, the list widgets, and
in particular #GListModel do not. This was a design choice because the common
use case is displaying lists and not trees and it greatly simplifies the API
interface provided.
However, GTK provides functionality to make trees look and behave like lists
for the people who still want to display lists. This is achieved by using
the `GtkTreeListModel` model to flatten a tree into a list. The `GtkTreeExpander`
the #GtkTreeListModel model to flatten a tree into a list. The #GtkTreeExpander
widget can then be used inside a listitem to allow users to expand and collapse
rows and provide a similar experience to `GtkTreeView`.
rows and provide a similar experience to #GtkTreeView.
Developers should refer to those objects' API reference for more discussion
on the topic.
## List styles
One of the advantages of the new list widgets over `GtkTreeViews` and cell
One of the advantages of the new list widgets over #GtkTreeViews and cell
renderers is that they are fully themable using GTK CSS. This provides a
lot of flexibility. The themes that ship with GTK provide a few predefined
list styles that can be used in many situations:
@@ -192,7 +192,7 @@ style class.
## Comparison to GtkTreeView
Developers familiar with `GtkTreeView` may wonder how this way of doing lists
Developers familiar with #GtkTreeView may wonder how this way of doing lists
compares to the way they know. This section will try to outline the similarities
and differences between the two.
@@ -200,26 +200,26 @@ This new approach tries to provide roughly the same functionality as the old
approach but often uses a very different approach to achieve these goals.
The main difference and one of the primary reasons for this new development is
that items can be displayed using regular widgets and `GtkCellRenderer` is no
that items can be displayed using regular widgets and #GtkCellRenderer is no
longer necessary. This allows all benefits that widgets provide, such as complex
layout and animating widgets and not only makes cell renderers obsolete, but
also `GtkCellArea`.
also #GtkCellArea.
The other big difference is the massive change to the data model. `GtkTreeModel`
was a rather complex interface for a tree data structure and `GListModel` was
The other big difference is the massive change to the data model. #GtkTreeModel
was a rather complex interface for a tree data structure and #GListModel was
deliberately designed to be a simple data structure for lists only. (See
[above](#displaying-trees)) for how to still do trees with this new model.)
Another big change is that the new model allows for bulk changes via
the `GListModel:items-changed` signal while `GtkTreeModel` only allows a single
the #GListModel:items-changed signal while #GtkTreeModel only allows a single
item to change at once. The goal here is of course to encourage implementation
of custom list models.
Another consequence of the new model is that it is now easily possible to
refer to the contents of a row in the model directly by keeping the item,
while `GtkTreeRowReference` was a very slow mechanism to achieve the same.
while #GtkTreeRowReference was a very slow mechanism to achieve the same.
And because the items are real objects, developers can make them emit change
signals causing listitems and their children to update, which wasn't possible
with `GtkTreeModel`.
with #GtkTreeModel.
The selection handling is also different. While selections used to be managed
via custom code in each widget, selection state is now meant to be managed by
@@ -229,24 +229,24 @@ specialized requirements.
Finally here's a quick list of equivalent functionality to look for when
transitioning code for easy lookup:
| Old | New |
| -------------------- | ------------------------------------ |
| `GtkTreeModel` | `GListModel` |
| `GtkTreePath` | `guint` position, `GtkTreeListRow` |
| `GtkTreeIter` | `guint` position |
| `GtkTreeRowReference`| `GObject` item |
| `GtkListStore` | `GListStore` |
| `GtkTreeStore` | `GtkTreeListModel`, `GtkTreeExpander`|
| `GtkTreeSelection` | `GtkSelectionModel` |
| `GtkTreeViewColumn` | `GtkColumnView` |
| `GtkTreeView` | `GtkListView`, `GtkColumnView` |
| `GtkCellView` | `GtkListItemWidget` |
| `GtkComboBox` | `GtkDropDown` |
| `GtkIconView` | `GtkGridView` |
| `GtkTreeSortable` | `GtkColumnView` |
| `GtkTreeModelSort` | `GtkSortListModel` |
| `GtkTreeModelFilter` | `GtkFilterListModel` |
| `GtkCellLayout` | `GtkListItemFactory` |
| `GtkCellArea` | `GtkWidget` |
| `GtkCellRenderer` | `GtkWidget` |
| Old | New |
| ------------------- | ----------------------------------- |
| #GtkTreeModel | #GListModel |
| #GtkTreePath | #guint position, #GtkTreeListRow |
| #GtkTreeIter | #guint position |
| #GtkTreeRowReference | #GObject item |
| #GtkListStore | #GListStore |
| #GtkTreeStore | #GtkTreeListModel, #GtkTreeExpander |
| #GtkTreeSelection | #GtkSelectionModel |
| #GtkTreeViewColumn | #GtkColumnView |
| #GtkTreeView | #GtkListView, #GtkColumnView |
| #GtkCellView | #GtkListItemWidget |
| #GtkComboBox | #GtkDropDown |
| #GtkIconView | #GtkGridView |
| #GtkTreeSortable | #GtkColumnView |
| #GtkTreeModelSort | #GtkSortListModel |
| #GtkTreeModelFilter | #GtkFilterListModel |
| #GtkCellLayout | #GtkListItemFactory |
| #GtkCellArea | #GtkWidget |
| #GtkCellRenderer | #GtkWidget |

View File

@@ -2,15 +2,15 @@ Title: Text Widget Overview
Slug: gtk-textview
GTK has an extremely powerful framework for multiline text editing. The
primary objects involved in the process are `GtkTextBuffer`, which represents the
text being edited, and `GtkTextView`, a widget which can display a `GtkTextBuffer`.
primary objects involved in the process are #GtkTextBuffer, which represents the
text being edited, and #GtkTextView, a widget which can display a #GtkTextBuffer.
Each buffer can be displayed by any number of views.
One of the important things to remember about text in GTK is that it's in
the UTF-8 encoding. This means that one character can be encoded as multiple
bytes. Character counts are usually referred to as _offsets_, while byte
counts are called _indexes_. If you confuse these two, things will work fine
with ASCII, but as soon as your buffer contains multibyte characters, bad
with ASCII, but as soon as your buffer contains multibyte characters, bad
things will happen.
Text in a buffer can be marked with _tags_. A tag is an attribute that can
@@ -19,10 +19,10 @@ and make the text inside the tag bold. However, the tag concept is more
general than that; tags don't have to affect appearance. They can instead
affect the behavior of mouse and key presses, "lock" a range of text so the
user can't edit it, or countless other things. A tag is represented by a
`GtkTextTag` object. One `GtkTextTag` can be applied to any number of text
#GtkTextTag object. One #GtkTextTag can be applied to any number of text
ranges in any number of buffers.
Each tag is stored in a `GtkTextTagTable`. A tag table defines a set of
Each tag is stored in a #GtkTextTagTable. A tag table defines a set of
tags that can be used together. Each buffer has one tag table associated with
it; only tags from that tag table can be used with the buffer. A single tag
table can be shared between multiple buffers, however.
@@ -32,36 +32,36 @@ your tag that makes things bold "bold"), but they can also be anonymous (which
is convenient if you're creating tags on-the-fly).
Most text manipulation is accomplished with _iterators_, represented by a
`GtkTextIter`. An iterator represents a position between two characters in
the text buffer. `GtkTextIter` is a struct designed to be allocated on the
#GtkTextIter. An iterator represents a position between two characters in
the text buffer. #GtkTextIter is a struct designed to be allocated on the
stack; it's guaranteed to be copiable by value and never contain any
heap-allocated data. Iterators are not valid indefinitely; whenever the
buffer is modified in a way that affects the number of characters in the
buffer, all outstanding iterators become invalid. (Note that deleting 5
characters and then reinserting 5 still invalidates iterators, though you
end up with the same number of characters you pass through a state with a
characters and then reinserting 5 still invalidates iterators, though you
end up with the same number of characters you pass through a state with a
different number).
Because of this, iterators can't be used to preserve positions across buffer
modifications. To preserve a position, the `GtkTextMark` object is ideal. You
can think of a mark as an invisible cursor or insertion point; it floats in
the buffer, saving a position. If the text surrounding the mark is deleted,
the mark remains in the position the text once occupied; if text is inserted
at the mark, the mark ends up either to the left or to the right of the new
modifications. To preserve a position, the #GtkTextMark object is ideal. You
can think of a mark as an invisible cursor or insertion point; it floats in
the buffer, saving a position. If the text surrounding the mark is deleted,
the mark remains in the position the text once occupied; if text is inserted
at the mark, the mark ends up either to the left or to the right of the new
text, depending on its _gravity_. The standard text cursor in left-to-right
languages is a mark with right gravity, because it stays to the right of
inserted text.
Like tags, marks can be either named or anonymous. There are two marks
built-in to `GtkTextBuffer`; these are named "insert" and "selection_bound"
built-in to #GtkTextBuffer; these are named "insert" and "selection_bound"
and refer to the insertion point and the boundary of the selection which
is not the insertion point, respectively. If no text is selected, these
two marks will be in the same position. You can manipulate what is selected
and where the cursor appears by moving these marks around.
If you want to place the cursor in response to a user action, be sure to use
gtk_text_buffer_place_cursor(), which moves both at once without causing a
temporary selection (moving one then the other temporarily selects the range in
gtk_text_buffer_place_cursor(), which moves both at once without causing a
temporary selection (moving one then the other temporarily selects the range in
between the old and new positions).
Text buffers always contain at least one line, but may be empty (that
@@ -69,7 +69,7 @@ is, buffers can contain zero characters). The last line in the text
buffer never ends in a line separator (such as newline); the other
lines in the buffer always end in a line separator. Line separators
count as characters when computing character counts and character
offsets. Note that some Unicode line separators are represented with
offsets. Note that some Unicode line separators are represented with
multiple bytes in UTF-8, and the two-character sequence "\r\n" is also
considered a line separator.
@@ -83,7 +83,7 @@ gtk_text_buffer_end_irreversible_action().
## Simple Example
The simplest usage of `GtkTextView` might look like this:
The simplest usage of #GtkTextView might look like this:
``` {.c}
GtkWidget *view;
@@ -101,17 +101,17 @@ gtk_text_buffer_set_text (buffer, "Hello, this is some text", -1);
*/
```
In many cases it's also convenient to first create the buffer with
gtk_text_buffer_new(), then create a widget for that buffer with
gtk_text_view_new_with_buffer(). Or you can change the buffer the widget
In many cases it's also convenient to first create the buffer with
gtk_text_buffer_new(), then create a widget for that buffer with
gtk_text_view_new_with_buffer(). Or you can change the buffer the widget
displays after the widget is created with gtk_text_view_set_buffer().
## Example of Changing Text Attributes
The way to affect text attributes in `GtkTextView` is to
The way to affect text attributes in #GtkTextView is to
apply tags that change the attributes for a region of text.
For text features that come from the theme such as font and
foreground color use CSS to override their default values.
For text features that come from the theme &mdash; such as font and
foreground color -- use CSS to override their default values.
```
GtkWidget *view;
@@ -148,11 +148,11 @@ gtk_text_view_set_left_margin (GTK_TEXT_VIEW (view), 30);
/* Use a tag to change the color for just one part of the widget */
tag = gtk_text_buffer_create_tag (buffer, "blue_foreground",
"foreground", "blue",
NULL);
NULL);
gtk_text_buffer_get_iter_at_offset (buffer, &amp;start, 7);
gtk_text_buffer_get_iter_at_offset (buffer, &amp;end, 12);
gtk_text_buffer_apply_tag (buffer, tag, &amp;start, &amp;end);
```
The `gtk4-demo` application that comes with
GTK contains more example code for `GtkTextView`.
GTK contains more example code for #GtkTextView.

View File

@@ -1,8 +1,8 @@
Title: Tree and List Widget Overview
Slug: gtk-treeview
To create a tree or list in GTK, use the `GtkTreeModel` interface in
conjunction with the `GtkTreeView` widget. This widget is designed around
To create a tree or list in GTK, use the #GtkTreeModel interface in
conjunction with the #GtkTreeView widget. This widget is designed around
a _Model/View/Controller_ design and consists of four major parts:
- The tree view widget (GtkTreeView)
@@ -25,9 +25,9 @@ it be rendered as a checkbox?
## Creating a model
GTK provides two simple models that can be used: the `GtkListStore`
and the `GtkTreeStore`. `GtkListStore` is used to model list widgets,
while the `GtkTreeStore` models trees. It is possible to develop a new
GTK provides two simple models that can be used: the #GtkListStore
and the #GtkTreeStore. GtkListStore is used to model list widgets,
while the GtkTreeStore models trees. It is possible to develop a new
type of model, but the existing models should be satisfactory for all
but the most specialized of situations. Creating the model is quite
@@ -59,7 +59,7 @@ GtkTreeStore *store = gtk_tree_store_new (N_COLUMNS, /* Total number of co
Adding data to the model is done using gtk_tree_store_set() or
gtk_list_store_set(), depending upon which sort of model was
created. To do this, a `GtkTreeIter` must be acquired. The iterator
created. To do this, a #GtkTreeIter must be acquired. The iterator
points to the location where data will be added.
Once an iterator has been acquired, gtk_tree_store_set() is used to
@@ -119,8 +119,8 @@ gtk_tree_store_set (store, &iter2,
While there are several different models to choose from, there is
only one view widget to deal with. It works with either the list
or the tree store. Setting up a `GtkTreeView` is not a difficult
matter. It needs a `GtkTreeModel` to know where to retrieve its data
or the tree store. Setting up a #GtkTreeView is not a difficult
matter. It needs a #GtkTreeModel to know where to retrieve its data
from.
``` {.c}
@@ -131,16 +131,16 @@ tree = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
## Columns and cell renderers
Once the `GtkTreeView` widget has a model, it will need to know how
Once the #GtkTreeView widget has a model, it will need to know how
to display the model. It does this with columns and cell renderers.
Cell renderers are used to draw the data in the tree model in a
way. There are a number of cell renderers that come with GTK,
including the `GtkCellRendererText`, `GtkCellRendererPixbuf` and
the `GtkCellRendererToggle`. It is relatively easy to write a
including the #GtkCellRendererText, #GtkCellRendererPixbuf and
the #GtkCellRendererToggle. It is relatively easy to write a
custom renderer.
A `GtkTreeViewColumn` is the object that `GtkTreeView` uses to organize
A #GtkTreeViewColumn is the object that GtkTreeView uses to organize
the vertical columns in the tree view. It needs to know the name of
the column to label for the user, what type of cell renderer to use,
and which piece of data to retrieve from the model for a given row.
@@ -166,7 +166,7 @@ created and columns are added to it.
Most applications will need to not only deal with displaying data,
but also receiving input events from users. To do this, simply get
a reference to a selection object and connect to the
`GtkTreeSelection::changed` signal.
#GtkTreeSelection::changed signal.
``` {.c}
/* Prototype for selection handler callback */
@@ -205,11 +205,11 @@ tree_selection_changed_cb (GtkTreeSelection *selection, gpointer data)
## Simple Example
Here is a simple example of using a `GtkTreeView` widget in context
Here is a simple example of using a #GtkTreeView widget in context
of the other widgets. It simply creates a simple model and view,
and puts them together. Note that the model is never populated
with data that is left as an exercise for the reader.
More information can be found on this in the `GtkTreeModel` section.
with data &mdash; that is left as an exercise for the reader.
More information can be found on this in the #GtkTreeModel section.
``` {.c}
enum

View File

@@ -3,14 +3,11 @@
// A map between namespaces and base URLs for their online documentation
baseURLs = [
[ 'GLib', 'https://docs.gtk.org/glib/' ],
[ 'GObject', 'https://docs.gtk.org/gobject/' ],
[ 'Gio', 'https://docs.gtk.org/gio/' ],
[ 'Gdk', 'https://docs.gtk.org/gdk4/' ],
[ 'GdkWayland', 'https://docs.gtk.org/gdk4-wayland/' ],
[ 'GdkX11', 'https://docs.gtk.org/gdk4-x11/' ],
[ 'Gsk', 'https://docs.gtk.org/gsk4/' ],
[ 'Gtk', 'https://docs.gtk.org/gtk4/' ],
[ 'Pango', 'https://docs.gtk.org/Pango/' ],
[ 'PangoCairo', 'https://docs.gtk.org/PangoCairo/' ],
[ 'Gdk', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4/' ],
[ 'GdkWayland', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4-wayland/' ],
[ 'GdkX11', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4-x11/' ],
[ 'Gsk', 'https://gnome.pages.gitlab.gnome.org/gtk/gsk4/' ],
[ 'Gtk', 'https://gnome.pages.gitlab.gnome.org/gtk/gtk4/' ],
[ 'Pango', 'https://gnome.pages/gitlab.gnome.org/pango/pango/' ],
[ 'PangoCairo', 'https://gnome.pages.gitlab.gnome.org/pango/pangocairo/' ],
]

View File

@@ -1,7 +1,5 @@
Title: Widget Gallery
<style>p { display: flex; flex-flow: row wrap; }</style>
## Display widgets
[![label](label.png)](class.Label.html)

View File

@@ -18,8 +18,3 @@ or wayland-1.
### XDG_RUNTIME_DIR
Used to locate the Wayland socket to use.
## Wayland-specific APIs
See the [documentation](https://docs.gtk.org/gdk4-wayland/) for
Wayland-specific GDK APIs.

View File

@@ -14,19 +14,14 @@ instructions, binary downloads, etc, can be found
The Win32 GDK backend can be influenced with some additional environment
variables.
### GDK_WIN32_TABLET_INPUT_API
### GDK_IGNORE_WINTAB
If this variable is set, it determines the API that GTK uses for tablet support.
The possible values are:
If this variable is set, GTK doesn't use the Wintab API for tablet support.
`none`
: Disables tablet support
### GDK_USE_WINTAB
`wintab`
: Use the Wintab API
`winpointer`
: Use the Windows Pointer Input Stack API. This is the default.
If this variable is set, GTK uses the Wintab API for tablet support.
This is the default.
## Windows-specific handling of cursors

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