Compare commits
4 Commits
fixed-item
...
text-rende
Author | SHA1 | Date | |
---|---|---|---|
|
ce09db1401 | ||
|
ed96414483 | ||
|
e6de8a1746 | ||
|
db1fc454ee |
@@ -1,32 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2021 The GTK Authors
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.[ch]]
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
# For the legacy tabs which still exist in the code:
|
||||
tab_width = 8
|
||||
|
||||
[*.ui]
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
|
||||
[*.xml]
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
|
||||
[meson.build]
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
|
||||
[*.md]
|
||||
max_line_length = 80
|
@@ -25,7 +25,7 @@ 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:v35"
|
||||
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v33"
|
||||
FLATPAK_IMAGE: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master"
|
||||
|
||||
.only-default:
|
||||
@@ -91,7 +91,6 @@ fedora-x86_64:
|
||||
- meson compile -C _build_hello
|
||||
- .gitlab-ci/run-tests.sh _build x11
|
||||
- .gitlab-ci/run-tests.sh _build wayland
|
||||
- .gitlab-ci/run-tests.sh _build waylandgles
|
||||
- .gitlab-ci/run-tests.sh _build broadway
|
||||
|
||||
release-build:
|
||||
|
@@ -53,7 +53,6 @@ RUN dnf -y install \
|
||||
libpng-devel \
|
||||
librsvg2 \
|
||||
libselinux-devel \
|
||||
libtiff-devel \
|
||||
libubsan \
|
||||
libXcomposite-devel \
|
||||
libXcursor-devel \
|
||||
@@ -76,7 +75,6 @@ RUN dnf -y install \
|
||||
pcre-devel \
|
||||
pcre-static \
|
||||
python3 \
|
||||
python3-docutils \
|
||||
python3-gobject \
|
||||
python3-jinja2 \
|
||||
python3-markdown \
|
||||
|
@@ -44,24 +44,6 @@ case "${backend}" in
|
||||
kill ${compositor}
|
||||
;;
|
||||
|
||||
waylandgles)
|
||||
export XDG_RUNTIME_DIR="$(mktemp -p $(pwd) -d xdg-runtime-XXXXXX)"
|
||||
|
||||
weston --backend=headless-backend.so --socket=wayland-6 --idle-time=0 &
|
||||
compositor=$!
|
||||
export WAYLAND_DISPLAY=wayland-6
|
||||
|
||||
meson test -C ${builddir} \
|
||||
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
|
||||
--print-errorlogs \
|
||||
--setup=${backend} \
|
||||
--suite=gtk \
|
||||
--no-suite=gsk-compare-broadway
|
||||
|
||||
exit_code=$?
|
||||
kill ${compositor}
|
||||
;;
|
||||
|
||||
broadway)
|
||||
export XDG_RUNTIME_DIR="$(mktemp -p $(pwd) -d xdg-runtime-XXXXXX)"
|
||||
|
||||
@@ -80,12 +62,6 @@ case "${backend}" in
|
||||
exit_code=0
|
||||
kill ${server}
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Failed to add ${backend} to .gitlab-ci/run-tests.sh"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
cd ${builddir}
|
||||
|
@@ -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.3 pango; then
|
||||
if ! pkg-config --atleast-version=1.49.1 pango; then
|
||||
git clone https://gitlab.gnome.org/GNOME/pango.git _pango
|
||||
meson setup _pango_build _pango
|
||||
meson compile -C _pango_build
|
||||
|
112
NEWS
112
NEWS
@@ -1,127 +1,19 @@
|
||||
Overview of Changes in 4.5.0
|
||||
============================
|
||||
Overview of Changes
|
||||
===================
|
||||
|
||||
* gsk:
|
||||
- Drop the GL renderer in favor of NGL
|
||||
- Rename NGL to GL
|
||||
- Fix some coordinate overflow issues
|
||||
- Reimplement texture upload and download for better
|
||||
support of image formats and color spaces
|
||||
- New api:
|
||||
gsk_transform_skew
|
||||
gsk_transform_to_2d_components
|
||||
|
||||
* gdk:
|
||||
- Support HSL in gdk_rgba_parse
|
||||
- Use libpng, libjpeg and libtiff directly when loading
|
||||
textures, and support more image formats (including 16bit
|
||||
and float formats)
|
||||
- New apis:
|
||||
gdk_texture_new_from_bytes
|
||||
gdk_texture_new_from_filename
|
||||
gdk_texture_download_float
|
||||
gdk_texture_save_to_png_bytes
|
||||
gdk_texture_save_to_tiff
|
||||
gdk_texture_save_to_tiff_bytes
|
||||
gdk_display_create_gl_context
|
||||
- Implement GIcon and GLoadableIcon in GdkTexture
|
||||
- Move EGL initialization to the frontend
|
||||
- Use configless EGL contexts, if supported
|
||||
- Use >8bit pixel formats, if supported and requested
|
||||
|
||||
* css:
|
||||
- Add support for line-height
|
||||
- Add support for text-transform
|
||||
|
||||
* theme:
|
||||
- Fixes for buttons in toolbars
|
||||
|
||||
* input:
|
||||
- Update compose sequences from libX11 1.7.2
|
||||
- Accept replacement string longer than 20 characters
|
||||
|
||||
* text:
|
||||
- Implement sloped caret drawing
|
||||
- Add a gtk-hint-font-metrics setting to switch
|
||||
font rendering to be more similar to GTK3
|
||||
|
||||
* GtkTextView:
|
||||
- Add support for line height
|
||||
- Add support for text transforms
|
||||
- Misc fixes for css->pango attribute translations
|
||||
- Invalidate pango contexts when font settings change
|
||||
- Improve undo grouping when overwriting
|
||||
|
||||
* GtkListView:
|
||||
- Make tree indentation more flexible with
|
||||
GtkTreeExpander:indent-for-icon
|
||||
|
||||
* GtkMenuButton:
|
||||
- Support custom children
|
||||
|
||||
* GtkFlowBox:
|
||||
- Add prepend and append
|
||||
|
||||
* GtkCalendar:
|
||||
- Fix handling of weeks starting on Monday
|
||||
|
||||
* GtkWindow:
|
||||
- Add a titlebar property
|
||||
|
||||
* GtkDropDown:
|
||||
- Add a show-arrow property
|
||||
|
||||
* GtkPopoverMenu:
|
||||
- Support a use-markup attribute in menu models
|
||||
|
||||
* Add GtkSymbolicPaintable
|
||||
|
||||
* Tools:
|
||||
- Support DND in gtk4-node-editor and the inspector's recorder
|
||||
|
||||
* Demos:
|
||||
- Improve the font rendering demo
|
||||
|
||||
* Build:
|
||||
- Require Pango 1.49
|
||||
- Require libpng, libtiff and libjpeg
|
||||
- Speed up handling of resources during build
|
||||
|
||||
* X11:
|
||||
- Support touchpad gestures with XInput 2.4
|
||||
|
||||
* Windows:
|
||||
- Fix DND coordinates
|
||||
|
||||
* Translation updates:
|
||||
Basque
|
||||
Brazilian Portuguese
|
||||
Catalan
|
||||
Chinese (China)
|
||||
Croatian
|
||||
Czech
|
||||
Dutch
|
||||
Finnish
|
||||
French
|
||||
Galician
|
||||
German
|
||||
Hebrew
|
||||
Hungarian
|
||||
Icelandic
|
||||
Indonesian
|
||||
Kazakh
|
||||
Korean
|
||||
Latvian
|
||||
Lithuanian
|
||||
Persian
|
||||
Portuguese
|
||||
Romanian
|
||||
Serbian
|
||||
Slovak
|
||||
Spanish
|
||||
Swedish
|
||||
Turkish
|
||||
Ukrainian
|
||||
|
||||
|
||||
Overview of Changes in 4.4.0
|
||||
|
15
README.md
15
README.md
@@ -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
|
||||
|
||||
@@ -114,7 +112,7 @@ can be found in the file:
|
||||
docs/reference/gtk/html/gtk-building.html
|
||||
```
|
||||
|
||||
Or [online](https://docs.gtk.org/gtk4/building.html)
|
||||
Or [online](https://developer.gnome.org/gtk4/stable/gtk-building.html)
|
||||
|
||||
How to report bugs
|
||||
------------------
|
||||
@@ -153,9 +151,6 @@ 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
|
||||
-------------
|
||||
|
||||
|
286
config.h.meson
Normal file
286
config.h.meson
Normal file
@@ -0,0 +1,286 @@
|
||||
/* 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 a working `madvise' system call. */
|
||||
#mesondefine HAVE_MADVISE
|
||||
|
||||
/* 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 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
|
||||
|
||||
#mesondefine HAVE_F16C
|
||||
|
||||
/* Does the OS support GDesktopAppInfo? */
|
||||
#mesondefine HAVE_DESKTOPAPPINFO
|
@@ -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>
|
||||
@@ -22,14 +17,10 @@ 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 +28,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;
|
||||
@@ -48,7 +39,6 @@ update_image (void)
|
||||
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);
|
||||
@@ -59,18 +49,16 @@ update_image (void)
|
||||
fopt = cairo_font_options_copy (pango_cairo_context_get_font_options (context));
|
||||
|
||||
hint = gtk_combo_box_get_active_id (GTK_COMBO_BOX (hinting));
|
||||
hintstyle = CAIRO_HINT_STYLE_DEFAULT;
|
||||
if (hint)
|
||||
{
|
||||
if (strcmp (hint, "none") == 0)
|
||||
hintstyle = CAIRO_HINT_STYLE_NONE;
|
||||
else if (strcmp (hint, "slight") == 0)
|
||||
hintstyle = CAIRO_HINT_STYLE_SLIGHT;
|
||||
else if (strcmp (hint, "medium") == 0)
|
||||
hintstyle = CAIRO_HINT_STYLE_MEDIUM;
|
||||
else if (strcmp (hint, "full") == 0)
|
||||
hintstyle = CAIRO_HINT_STYLE_FULL;
|
||||
}
|
||||
if (strcmp (hint, "none") == 0)
|
||||
hintstyle = CAIRO_HINT_STYLE_NONE;
|
||||
else if (strcmp (hint, "slight") == 0)
|
||||
hintstyle = CAIRO_HINT_STYLE_SLIGHT;
|
||||
else if (strcmp (hint, "medium") == 0)
|
||||
hintstyle = CAIRO_HINT_STYLE_MEDIUM;
|
||||
else if (strcmp (hint, "full") == 0)
|
||||
hintstyle = CAIRO_HINT_STYLE_FULL;
|
||||
else
|
||||
hintstyle = CAIRO_HINT_STYLE_DEFAULT;
|
||||
cairo_font_options_set_hint_style (fopt, hintstyle);
|
||||
|
||||
if (gtk_check_button_get_active (GTK_CHECK_BUTTON (hint_metrics)))
|
||||
@@ -96,6 +84,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);
|
||||
@@ -105,14 +94,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);
|
||||
|
||||
@@ -151,7 +136,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,
|
||||
@@ -164,45 +149,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
|
||||
{
|
||||
@@ -210,26 +167,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);
|
||||
|
||||
@@ -244,7 +185,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);
|
||||
}
|
||||
|
||||
@@ -252,7 +193,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);
|
||||
}
|
||||
@@ -271,6 +212,7 @@ update_image (void)
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
|
||||
|
||||
gtk_picture_set_pixbuf (GTK_PICTURE (image), pixbuf2);
|
||||
|
||||
g_object_unref (pixbuf2);
|
||||
@@ -278,78 +220,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)
|
||||
{
|
||||
@@ -357,26 +227,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 *
|
||||
@@ -402,8 +266,6 @@ do_fontrendering (GtkWidget *do_widget)
|
||||
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);
|
||||
@@ -415,8 +277,6 @@ do_fontrendering (GtkWidget *do_widget)
|
||||
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 ();
|
||||
|
||||
|
@@ -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,62 +87,44 @@
|
||||
</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>
|
||||
<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>
|
||||
<property name="label">Antialias</property>
|
||||
<layout>
|
||||
<property name="column">3</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="hinting">
|
||||
<property name="active">0</property>
|
||||
<property name="valign">center</property>
|
||||
<items>
|
||||
<item translatable="yes" id="none">None</item>
|
||||
<item translatable="yes" id="slight">Slight</item>
|
||||
<item translatable="yes" id="medium">Medium</item>
|
||||
<item translatable="yes" id="full">Full</item>
|
||||
</items>
|
||||
<layout>
|
||||
<property name="column">4</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="hint_metrics">
|
||||
<property name="label">Hint Metrics</property>
|
||||
<layout>
|
||||
<property name="column">4</property>
|
||||
<property name="row">1</property>
|
||||
@@ -145,56 +132,33 @@
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="hint_metrics">
|
||||
<property name="label">Hint _Metrics</property>
|
||||
<property name="use-underline">1</property>
|
||||
<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"><Control>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 +166,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"><Control>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 +179,7 @@
|
||||
<object class="GtkLabel">
|
||||
<property name="hexpand">1</property>
|
||||
<layout>
|
||||
<property name="column">8</property>
|
||||
<property name="column">7</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
|
@@ -874,8 +874,8 @@ gtk_gears_tick (GtkWidget *widget,
|
||||
{
|
||||
GtkGears *gears = GTK_GEARS (widget);
|
||||
GtkGearsPrivate *priv = gtk_gears_get_instance_private (gears);
|
||||
GdkFrameTimings *previous_timings;
|
||||
gint64 previous_frame_time;
|
||||
GdkFrameTimings *timings, *previous_timings;
|
||||
gint64 previous_frame_time = 0;
|
||||
gint64 frame_time;
|
||||
gint64 history_start, history_len;
|
||||
gint64 frame;
|
||||
@@ -915,6 +915,12 @@ gtk_gears_tick (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
timings = gdk_frame_clock_get_current_timings (frame_clock);
|
||||
previous_timings = gdk_frame_clock_get_timings (frame_clock,
|
||||
gdk_frame_timings_get_frame_counter (timings) - 1);
|
||||
if (previous_timings != NULL)
|
||||
previous_frame_time = gdk_frame_timings_get_frame_time (previous_timings);
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
|
@@ -94,12 +94,13 @@ show_page (GtkTextView *text_view,
|
||||
gtk_text_buffer_insert (buffer, &iter, " can easily be realized with ", -1);
|
||||
insert_link (buffer, &iter, "tags", 2);
|
||||
gtk_text_buffer_insert (buffer, &iter, ".\n", -1);
|
||||
gtk_text_buffer_insert (buffer, &iter, "Of course you can also embed Emoji 😋, ", -1);
|
||||
gtk_text_buffer_insert (buffer, &iter, "icons ", -1);
|
||||
gtk_text_buffer_insert (buffer, &iter,
|
||||
"Of course you can also embed Emoji 😋, "
|
||||
"icons ", -1);
|
||||
|
||||
theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (text_view)));
|
||||
icon = gtk_icon_theme_lookup_icon (theme,
|
||||
"eye-not-looking-symbolic",
|
||||
"microphone-sensitivity-high-symbolic",
|
||||
NULL,
|
||||
16,
|
||||
1,
|
||||
|
@@ -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),
|
||||
|
@@ -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>
|
||||
|
@@ -177,15 +177,6 @@ file_open_cb (GtkWidget *button,
|
||||
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
|
||||
}
|
||||
|
||||
static void
|
||||
listview_activate_cb (GtkListView *listview,
|
||||
guint pos,
|
||||
gpointer unused)
|
||||
{
|
||||
gtk_fixed_item_selection_set_selected_position (GTK_FIXED_ITEM_SELECTION (gtk_list_view_get_model (listview)),
|
||||
pos);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_listview_words (GtkWidget *do_widget)
|
||||
{
|
||||
@@ -194,7 +185,6 @@ do_listview_words (GtkWidget *do_widget)
|
||||
GtkWidget *header, *listview, *sw, *vbox, *search_entry, *open_button, *overlay;
|
||||
GtkFilterListModel *filter_model;
|
||||
GtkStringList *stringlist;
|
||||
GtkFixedItemSelection *selection;
|
||||
GtkFilter *filter;
|
||||
GFile *file;
|
||||
|
||||
@@ -251,15 +241,11 @@ do_listview_words (GtkWidget *do_widget)
|
||||
gtk_widget_set_vexpand (sw, TRUE);
|
||||
gtk_overlay_set_child (GTK_OVERLAY (overlay), sw);
|
||||
|
||||
selection = gtk_fixed_item_selection_new (G_LIST_MODEL (filter_model));
|
||||
|
||||
listview = gtk_list_view_new (
|
||||
GTK_SELECTION_MODEL (selection),
|
||||
GTK_SELECTION_MODEL (gtk_no_selection_new (G_LIST_MODEL (filter_model))),
|
||||
gtk_builder_list_item_factory_new_from_bytes (NULL,
|
||||
g_bytes_new_static (factory_text, strlen (factory_text))));
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), listview);
|
||||
gtk_list_view_set_single_click_activate (GTK_LIST_VIEW (listview), TRUE);
|
||||
g_signal_connect (listview, "activate", G_CALLBACK (listview_activate_cb), NULL);
|
||||
|
||||
g_signal_connect (filter_model, "items-changed", G_CALLBACK (update_title_cb), progress);
|
||||
g_signal_connect (filter_model, "notify::pending", G_CALLBACK (update_title_cb), progress);
|
||||
|
@@ -156,74 +156,10 @@ demos_h = custom_target('gtk4 demo header',
|
||||
command: [ find_program('geninclude.py'), '@OUTPUT@', '@INPUT@' ],
|
||||
)
|
||||
|
||||
objcopy_supports_add_symbol = false
|
||||
objcopy = find_program('objcopy', required : false)
|
||||
if objcopy.found()
|
||||
objcopy_supports_add_symbol = run_command(objcopy, '--help').stdout().contains('--add-symbol')
|
||||
endif
|
||||
|
||||
ld = find_program('ld', required : false)
|
||||
|
||||
if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_add_symbol and ld.found()
|
||||
glib_compile_resources = find_program('glib-compile-resources')
|
||||
|
||||
# Create the resource blob
|
||||
gtkdemo_gresource = custom_target('gtkdemo.gresource',
|
||||
input : 'demo.gresource.xml',
|
||||
output : 'gtkdemo.gresource',
|
||||
depfile : 'gtkdemo.gresource.d',
|
||||
command : [glib_compile_resources,
|
||||
'--generate',
|
||||
'--target=@OUTPUT@',
|
||||
'--dependency-file=@DEPFILE@',
|
||||
'--sourcedir=' + meson.current_source_dir(),
|
||||
'--sourcedir=' + meson.current_build_dir(),
|
||||
'@INPUT@'])
|
||||
|
||||
# Create resource data file
|
||||
gtkdemo_resources_c = custom_target('gtkdemo_resources.c',
|
||||
input : 'demo.gresource.xml',
|
||||
output : 'gtkdemo_resources.c',
|
||||
depfile : 'gtkdemo_resources.c.d',
|
||||
command : [glib_compile_resources,
|
||||
'--generate-source',
|
||||
'--target=@OUTPUT@',
|
||||
'--dependency-file=@DEPFILE@',
|
||||
'--sourcedir=' + meson.current_source_dir(),
|
||||
'--sourcedir=' + meson.current_build_dir(),
|
||||
'--external-data',
|
||||
'--c-name', '_g_binary_gtkdemo',
|
||||
'@INPUT@'])
|
||||
|
||||
# Create object file containing resource data
|
||||
gtkdemo_resources_binary = custom_target('gtkdemo_resources.o',
|
||||
input : gtkdemo_gresource,
|
||||
output : 'gtkdemo_resources.o',
|
||||
command : [ld,
|
||||
'-r',
|
||||
'-b','binary',
|
||||
'@INPUT@',
|
||||
'-o','@OUTPUT@'])
|
||||
|
||||
# Rename symbol to match the one in the C file
|
||||
gtkdemo_resources_o = custom_target('gtkdemo_resources2.o',
|
||||
input : gtkdemo_resources_binary,
|
||||
output : 'gtkdemo_resources2.o',
|
||||
command : [objcopy,
|
||||
'--add-symbol','_g_binary_gtkdemo_resource_data=.data:0',
|
||||
'@INPUT@',
|
||||
'@OUTPUT@'])
|
||||
|
||||
gtkdemo_resources = [
|
||||
gtkdemo_resources_c,
|
||||
gtkdemo_resources_o,
|
||||
]
|
||||
else
|
||||
gtkdemo_resources = gnome.compile_resources('gtkdemo_resources',
|
||||
'demo.gresource.xml',
|
||||
source_dir: '.',
|
||||
)
|
||||
endif
|
||||
gtkdemo_resources = gnome.compile_resources('gtkdemo_resources',
|
||||
'demo.gresource.xml',
|
||||
source_dir: '.',
|
||||
)
|
||||
|
||||
# Use a subset of compiler flags
|
||||
demo_cflags = []
|
||||
|
@@ -33,7 +33,7 @@
|
||||
<developer_name>Matthias Clasen and others</developer_name>
|
||||
<content_rating type="oars-1.1"/>
|
||||
<releases>
|
||||
<release version="@BUILD_VERSION@">
|
||||
<release version="@BUILD_VERSION@" date="@BUILD_DATE@">
|
||||
<description>
|
||||
<p>A new build of GTK.</p>
|
||||
</description>
|
||||
|
@@ -32,7 +32,7 @@
|
||||
<developer_name>Matthias Clasen and others</developer_name>
|
||||
<content_rating type="oars-1.1"/>
|
||||
<releases>
|
||||
<release version="@BUILD_VERSION@">
|
||||
<release version="@BUILD_VERSION@" date="@BUILD_DATE@">
|
||||
<description>
|
||||
<p>A new build of GTK.</p>
|
||||
</description>
|
||||
|
@@ -12,9 +12,19 @@ demo_conf_h = declare_dependency(
|
||||
)
|
||||
|
||||
# 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')
|
||||
|
@@ -24,7 +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"
|
||||
#endif
|
||||
@@ -646,6 +646,7 @@ create_cairo_texture (NodeEditorWindow *self)
|
||||
GskRenderer *renderer;
|
||||
GskRenderNode *node;
|
||||
GdkTexture *texture;
|
||||
GdkSurface *surface;
|
||||
|
||||
paintable = gtk_picture_get_paintable (GTK_PICTURE (self->picture));
|
||||
if (paintable == NULL ||
|
||||
@@ -658,8 +659,9 @@ create_cairo_texture (NodeEditorWindow *self)
|
||||
if (node == NULL)
|
||||
return NULL;
|
||||
|
||||
surface = gtk_native_get_surface (gtk_widget_get_native (GTK_WIDGET (self)));
|
||||
renderer = gsk_cairo_renderer_new ();
|
||||
gsk_renderer_realize (renderer, NULL, NULL);
|
||||
gsk_renderer_realize (renderer, surface, NULL);
|
||||
|
||||
texture = gsk_renderer_render_texture (renderer, node, NULL);
|
||||
gsk_render_node_unref (node);
|
||||
@@ -837,18 +839,16 @@ node_editor_window_add_renderer (NodeEditorWindow *self,
|
||||
GskRenderer *renderer,
|
||||
const char *description)
|
||||
{
|
||||
GdkSurface *surface;
|
||||
GdkPaintable *paintable;
|
||||
|
||||
if (!gsk_renderer_realize (renderer, NULL, NULL))
|
||||
{
|
||||
GdkSurface *surface = gtk_native_get_surface (GTK_NATIVE (self));
|
||||
g_assert (surface != NULL);
|
||||
surface = gtk_native_get_surface (GTK_NATIVE (self));
|
||||
g_assert (surface != NULL);
|
||||
|
||||
if (!gsk_renderer_realize (renderer, surface, NULL))
|
||||
{
|
||||
g_object_unref (renderer);
|
||||
return;
|
||||
}
|
||||
if (renderer != NULL && !gsk_renderer_realize (renderer, surface, NULL))
|
||||
{
|
||||
g_object_unref (renderer);
|
||||
return;
|
||||
}
|
||||
|
||||
paintable = gtk_renderer_paintable_new (renderer, gtk_picture_get_paintable (GTK_PICTURE (self->picture)));
|
||||
@@ -872,7 +872,7 @@ node_editor_window_realize (GtkWidget *widget)
|
||||
"Default");
|
||||
#endif
|
||||
node_editor_window_add_renderer (self,
|
||||
gsk_gl_renderer_new (),
|
||||
gsk_ngl_renderer_new (),
|
||||
"OpenGL");
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
node_editor_window_add_renderer (self,
|
||||
|
@@ -198,7 +198,6 @@
|
||||
<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>
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 94 KiB After Width: | Height: | Size: 3.2 MiB |
Binary file not shown.
@@ -1,73 +1,9 @@
|
||||
# demos/widget-factory
|
||||
|
||||
objcopy_supports_add_symbol = false
|
||||
objcopy = find_program('objcopy', required : false)
|
||||
if objcopy.found()
|
||||
objcopy_supports_add_symbol = run_command(objcopy, '--help').stdout().contains('--add-symbol')
|
||||
endif
|
||||
|
||||
ld = find_program('ld', required : false)
|
||||
|
||||
if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_add_symbol and ld.found()
|
||||
glib_compile_resources = find_program('glib-compile-resources')
|
||||
|
||||
# Create the resource blob
|
||||
widgetfactory_gresource = custom_target('widgetfactory.gresource',
|
||||
input : 'widget-factory.gresource.xml',
|
||||
output : 'widgetfactory.gresource',
|
||||
depfile: 'widgetfactory.gresource.d',
|
||||
command : [glib_compile_resources,
|
||||
'--generate',
|
||||
'--target=@OUTPUT@',
|
||||
'--dependency-file=@DEPFILE@',
|
||||
'--sourcedir=' + meson.current_source_dir(),
|
||||
'--sourcedir=' + meson.current_build_dir(),
|
||||
'@INPUT@'])
|
||||
|
||||
# Create resource data file
|
||||
widgetfactory_resources_c = custom_target('widgetfactory_resources.c',
|
||||
input : 'widget-factory.gresource.xml',
|
||||
output : 'widgetfactory_resources.c',
|
||||
depfile: 'widgetfactory_resources.c.d',
|
||||
command : [glib_compile_resources,
|
||||
'--generate-source',
|
||||
'--target=@OUTPUT@',
|
||||
'--dependency-file=@DEPFILE@',
|
||||
'--sourcedir=' + meson.current_source_dir(),
|
||||
'--sourcedir=' + meson.current_build_dir(),
|
||||
'--external-data',
|
||||
'--c-name', '_g_binary_widgetfactory',
|
||||
'@INPUT@'])
|
||||
|
||||
# Create object file containing resource data
|
||||
widgetfactory_resources_binary = custom_target('widgetfactory_resources.o',
|
||||
input : widgetfactory_gresource,
|
||||
output : 'widgetfactory_resources.o',
|
||||
command : [ld,
|
||||
'-r',
|
||||
'-b','binary',
|
||||
'@INPUT@',
|
||||
'-o','@OUTPUT@'])
|
||||
|
||||
# Rename symbol to match the one in the C file
|
||||
widgetfactory_resources_o = custom_target('widgetfactory_resources2.o',
|
||||
input : widgetfactory_resources_binary,
|
||||
output : 'widgetfactory_resources2.o',
|
||||
command : [objcopy,
|
||||
'--add-symbol','_g_binary_widgetfactory_resource_data=.data:0',
|
||||
'@INPUT@',
|
||||
'@OUTPUT@'])
|
||||
|
||||
widgetfactory_resources = [
|
||||
widgetfactory_resources_c,
|
||||
widgetfactory_resources_o,
|
||||
]
|
||||
else
|
||||
widgetfactory_resources = gnome.compile_resources('widgetfactory_resources',
|
||||
'widget-factory.gresource.xml',
|
||||
source_dir: '.',
|
||||
)
|
||||
endif
|
||||
widgetfactory_resources = gnome.compile_resources('widgetfactory_resources',
|
||||
'widget-factory.gresource.xml',
|
||||
source_dir: '.',
|
||||
)
|
||||
|
||||
executable('gtk4-widget-factory',
|
||||
sources: ['widget-factory.c', widgetfactory_resources],
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 2.4 MiB |
@@ -34,7 +34,7 @@
|
||||
<developer_name>Matthias Clasen and others</developer_name>
|
||||
<content_rating type="oars-1.1"/>
|
||||
<releases>
|
||||
<release version="@BUILD_VERSION@">
|
||||
<release version="@BUILD_VERSION@" date="@BUILD_DATE@">
|
||||
<description>
|
||||
<p>A new build of GTK.</p>
|
||||
</description>
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 2.0 MiB |
File diff suppressed because it is too large
Load Diff
@@ -33,7 +33,7 @@ calls to different backends, and error out on unsupported windowing systems:
|
||||
else
|
||||
#endif
|
||||
#ifdef GDK_WINDOWING_WAYLAND
|
||||
if (GDK_IS_WAYLAND_DISPLAY (display))
|
||||
if (GTK_IS_WAYLAND_DISPLAY (display))
|
||||
{
|
||||
// make Wayland-specific calls here
|
||||
}
|
||||
|
@@ -16,10 +16,12 @@ if get_option('gtk_doc')
|
||||
command: [
|
||||
gidocgen,
|
||||
'generate',
|
||||
gidocgen_common_args,
|
||||
'--quiet',
|
||||
'--fatal-warnings',
|
||||
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
|
||||
'--config=@INPUT0@',
|
||||
'--output-dir=@OUTPUT@',
|
||||
'--no-namespace-dir',
|
||||
'--content-dir=@0@'.format(meson.current_source_dir()),
|
||||
'@INPUT1@',
|
||||
],
|
||||
@@ -44,10 +46,12 @@ if get_option('gtk_doc')
|
||||
command: [
|
||||
gidocgen,
|
||||
'generate',
|
||||
gidocgen_common_args,
|
||||
'--quiet',
|
||||
'--fatal-warnings',
|
||||
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
|
||||
'--config=@INPUT0@',
|
||||
'--output-dir=@OUTPUT@',
|
||||
'--no-namespace-dir',
|
||||
'--content-dir=@0@'.format(meson.current_source_dir()),
|
||||
'@INPUT1@',
|
||||
],
|
||||
@@ -74,10 +78,12 @@ if get_option('gtk_doc')
|
||||
command: [
|
||||
gidocgen,
|
||||
'generate',
|
||||
gidocgen_common_args,
|
||||
'--quiet',
|
||||
'--fatal-warnings',
|
||||
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
|
||||
'--config=@INPUT0@',
|
||||
'--output-dir=@OUTPUT@',
|
||||
'--no-namespace-dir',
|
||||
'--content-dir=@0@'.format(meson.current_source_dir()),
|
||||
'@INPUT1@',
|
||||
],
|
||||
|
@@ -13,5 +13,4 @@ baseURLs = [
|
||||
[ 'Gtk', 'https://docs.gtk.org/gtk4/' ],
|
||||
[ 'Pango', 'https://docs.gtk.org/Pango/' ],
|
||||
[ 'PangoCairo', 'https://docs.gtk.org/PangoCairo/' ],
|
||||
[ 'GdkPixbuf', 'https://docs.gtk.org/gdk-pixbuf/' ],
|
||||
]
|
||||
|
@@ -23,7 +23,7 @@ calls to different backends, and error out on unsupported windowing systems:
|
||||
#endif
|
||||
|
||||
#ifdef GDK_WINDOWING_WAYLAND
|
||||
if (GDK_IS_WAYLAND_DISPLAY (display))
|
||||
if (GTK_IS_WAYLAND_DISPLAY (display))
|
||||
{
|
||||
// make Wayland-specific calls here
|
||||
}
|
||||
|
@@ -29,7 +29,7 @@ calls to different backends, and error out on unsupported windowing systems:
|
||||
else
|
||||
#endif
|
||||
#ifdef GDK_WINDOWING_WAYLAND
|
||||
if (GDK_IS_WAYLAND_DISPLAY (display))
|
||||
if (GTK_IS_WAYLAND_DISPLAY (display))
|
||||
{
|
||||
// make Wayland-specific calls here
|
||||
}
|
||||
|
@@ -13,10 +13,12 @@ if get_option('gtk_doc')
|
||||
command: [
|
||||
gidocgen,
|
||||
'generate',
|
||||
gidocgen_common_args,
|
||||
'--quiet',
|
||||
'--fatal-warnings',
|
||||
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
|
||||
'--config=@INPUT0@',
|
||||
'--output-dir=@OUTPUT@',
|
||||
'--no-namespace-dir',
|
||||
'--content-dir=@0@'.format(meson.current_source_dir()),
|
||||
'@INPUT1@',
|
||||
],
|
||||
|
@@ -13,5 +13,4 @@ baseURLs = [
|
||||
[ 'Gtk', 'https://docs.gtk.org/gtk4/' ],
|
||||
[ 'Pango', 'https://docs.gtk.org/Pango/' ],
|
||||
[ 'PangoCairo', 'https://docs.gtk.org/PangoCairo/' ],
|
||||
[ 'GdkPixbuf', 'https://docs.gtk.org/gdk-pixbuf/' ],
|
||||
]
|
||||
|
@@ -3,13 +3,13 @@ Slug: gtk-getting-started
|
||||
|
||||
GTK is a [widget toolkit](http://en.wikipedia.org/wiki/Widget_toolkit).
|
||||
Each user interface created by GTK consists of widgets. This is implemented
|
||||
in C using [class@GObject.Object], an object-oriented framework for C. Widgets
|
||||
in C using [GObject](#gobject), an object-oriented framework for C. Widgets
|
||||
are organized in a hierarchy. The window widget is the main container.
|
||||
The user interface is then built by adding buttons, drop-down menus, input
|
||||
fields, and other widgets to the window. If you are creating complex user
|
||||
interfaces it is recommended to use GtkBuilder and its GTK-specific markup
|
||||
description language, instead of assembling the interface manually. You can
|
||||
also use a visual user interface editor, like [Glade](https://glade.gnome.org/).
|
||||
also use a visual user interface editor, like [glade](https://glade.gnome.org/).
|
||||
|
||||
GTK is event-driven. The toolkit listens for events such as a click
|
||||
on a button, and passes the event to your application.
|
||||
@@ -17,7 +17,7 @@ on a button, and passes the event to your application.
|
||||
This chapter contains some tutorial information to get you started with
|
||||
GTK programming. It assumes that you have GTK, its dependencies and a C
|
||||
compiler installed and ready to use. If you need to build GTK itself first,
|
||||
refer to the [Compiling the GTK libraries](building.html) section in this
|
||||
refer to the [Compiling the GTK libraries](#gtk-compiling) section in this
|
||||
reference.
|
||||
|
||||
## Basics
|
||||
@@ -68,7 +68,7 @@ gcc $( pkg-config --cflags gtk4 ) -o example-0 example-0.c $( pkg-config --libs
|
||||
```
|
||||
|
||||
For more information on how to compile a GTK application, please
|
||||
refer to the [Compiling GTK Applications](compiling.html)
|
||||
refer to the [Compiling GTK Applications](#gtk-compiling)
|
||||
section in this reference.
|
||||
|
||||
All GTK applications will, of course, include `gtk/gtk.h`, which declares
|
||||
@@ -106,16 +106,16 @@ 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
|
||||
cast using the macro `GTK_WINDOW()`. `GTK_WINDOW()` will check if the
|
||||
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 [in the GObject documentation](https://docs.gtk.org/gobject/concepts.html#conventions).
|
||||
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,24 +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);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_widget_set_halign (box, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (box, GTK_ALIGN_CENTER);
|
||||
|
||||
gtk_window_set_child (GTK_WINDOW (window), box);
|
||||
|
||||
button = gtk_button_new_with_label ("Hello World");
|
||||
gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
|
||||
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);
|
||||
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window);
|
||||
|
||||
gtk_box_append (GTK_BOX (box), button);
|
||||
gtk_window_set_child (GTK_WINDOW (window), button);
|
||||
|
||||
gtk_widget_show (window);
|
||||
}
|
||||
@@ -217,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`.
|
||||
|
||||
@@ -246,8 +241,8 @@ More information about creating buttons can be found
|
||||
[here](https://wiki.gnome.org/HowDoI/Buttons).
|
||||
|
||||
The rest of the code in `example-1.c` is identical to `example-0.c`. The next
|
||||
section will elaborate further on how to add several [class@Gtk.Widget]s to your
|
||||
GTK application.
|
||||
section will elaborate further on how to add several GtkWidgets to your GTK
|
||||
application.
|
||||
|
||||
## Packing
|
||||
|
||||
@@ -256,18 +251,10 @@ a window. When you do so, it becomes important to control how each widget is
|
||||
positioned and sized. This is where packing comes in.
|
||||
|
||||
GTK comes with a large variety of _layout containers_ whose purpose it
|
||||
is to control the layout of the child widgets that are added to them, like:
|
||||
is to control the layout of the child widgets that are added to them.
|
||||
See [Layout containers](#LayoutContainers) for an overview.
|
||||
|
||||
- [class@Gtk.Box]
|
||||
- [class@Gtk.Grid]
|
||||
- [class@Gtk.Revealer]
|
||||
- [class@Gtk.Stack]
|
||||
- [class@Gtk.Overlay]
|
||||
- [class@Gtk.Paned]
|
||||
- [class@Gtk.Expander]
|
||||
- [class@Gtk.Fixed]
|
||||
|
||||
The following example shows how the [class@Gtk.Grid] container lets you
|
||||
The following example shows how the GtkGrid container lets you
|
||||
arrange several buttons:
|
||||
|
||||

|
||||
@@ -366,11 +353,11 @@ 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.
|
||||
|
||||
The following example shows how to use a draw function with [class@Gtk.DrawingArea].
|
||||
The following example shows how to use a draw function with GtkDrawingArea.
|
||||
It is a bit more complicated than the previous examples, since it also
|
||||
demonstrates input event handling with event controllers.
|
||||
|
||||
@@ -415,9 +402,9 @@ resize_cb (GtkWidget *widget,
|
||||
if (gtk_native_get_surface (gtk_widget_get_native (widget)))
|
||||
{
|
||||
surface = gdk_surface_create_similar_surface (gtk_native_get_surface (gtk_widget_get_native (widget)),
|
||||
CAIRO_CONTENT_COLOR,
|
||||
gtk_widget_get_width (widget),
|
||||
gtk_widget_get_height (widget));
|
||||
CAIRO_CONTENT_COLOR,
|
||||
gtk_widget_get_width (widget),
|
||||
gtk_widget_get_height (widget));
|
||||
|
||||
/* Initialize the surface to white */
|
||||
clear_surface ();
|
||||
@@ -703,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 a `GObject` instead of a `GtkWidget`.
|
||||
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)
|
||||
@@ -775,17 +762,17 @@ main (int argc, char *argv[])
|
||||
```
|
||||
|
||||
All the application logic is in the application class, which is a subclass of
|
||||
`GtkApplication`. Our example does not yet have any interesting functionality.
|
||||
GtkApplication. Our example does not yet have any interesting functionality.
|
||||
All it does is open a window when it is activated without arguments, and open
|
||||
the files it is given, if it is started with arguments.
|
||||
|
||||
To handle these two cases, we override the `activate()` vfunc, which gets
|
||||
To handle these two cases, we override the activate() vfunc, which gets
|
||||
called when the application is launched without commandline arguments, and
|
||||
the `open()` virtual function, which gets called when the application is
|
||||
launched with commandline arguments.
|
||||
|
||||
To learn more about `GApplication` entry points, consult the GIO
|
||||
[documentation](https://docs.gtk.org/gio/class.Application.html).
|
||||
[documentation](https://developer.gnome.org/gio/stable/GApplication.html#GApplication.description).
|
||||
|
||||
```c
|
||||
#include <gtk/gtk.h>
|
||||
@@ -854,8 +841,8 @@ example_app_new (void)
|
||||
```
|
||||
|
||||
Another important class that is part of the application support in GTK is
|
||||
[class@Gtk.ApplicationWindow]. It is typically subclassed as well. Our
|
||||
subclass does not do anything yet, so we will just get an empty window.
|
||||
`GtkApplicationWindow`. It is typically subclassed as well. Our subclass does
|
||||
not do anything yet, so we will just get an empty window.
|
||||
|
||||
```c
|
||||
#include <gtk/gtk.h>
|
||||
@@ -920,10 +907,10 @@ and it accepts files as commandline arguments.
|
||||
|
||||
### Populating the window
|
||||
|
||||
In this step, we use a `GtkBuilder` template to associate a
|
||||
`GtkBuilder` ui file with our application window class.
|
||||
In this step, we use a GtkBuilder template to associate a
|
||||
GtkBuilder ui file with our application window class.
|
||||
|
||||
Our simple ui file gives the window a title, and puts a `GtkStack`
|
||||
Our simple ui file gives the window a title, and puts a GtkStack
|
||||
widget as the main content.
|
||||
|
||||
```xml
|
||||
@@ -947,9 +934,9 @@ widget as the main content.
|
||||
|
||||
To make use of this file in our application, we revisit our
|
||||
`GtkApplicationWindow` subclass, and call
|
||||
[`method@Gtk.WidgetClass.set_template_from_resource`] from the class init
|
||||
`gtk_widget_class_set_template_from_resource()` from the class init
|
||||
function to set the ui file as template for this class. We also
|
||||
add a call to [`method@Gtk.Widget.init_template`] in the instance init
|
||||
add a call to `gtk_widget_init_template()` in the instance init
|
||||
function to instantiate the template for each instance of our
|
||||
class.
|
||||
|
||||
@@ -976,7 +963,7 @@ example_app_window_class_init (ExampleAppWindowClass *class)
|
||||
|
||||
You may have noticed that we used the `_from_resource()` variant of the function
|
||||
that sets a template. Now we need to use
|
||||
[GLib's resource functionality](https://docs.gtk.org/gio/struct.Resource.html)
|
||||
[GLib's resource functionality](https://developer.gnome.org/gio/stable/GResource.html)
|
||||
to include the ui file in the binary. This is commonly done by listing all resources
|
||||
in a `.gresource.xml` file, such as this:
|
||||
|
||||
@@ -998,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:
|
||||
@@ -1014,7 +1001,7 @@ To this end, we add a member to the struct of our application window subclass
|
||||
and keep a reference to the `GtkStack` there. The first member of the struct
|
||||
should be the parent type from which the class is derived. Here,
|
||||
`ExampleAppWindow` is derived from `GtkApplicationWindow`. The
|
||||
[`func@Gtk.widget_class_bind_template_child`] function arranges things so that after
|
||||
`gtk_widget_class_bind_template_child()` function arranges things so that after
|
||||
instantiating the template, the `stack` member of the struct will point to the
|
||||
widget of the same name from the template.
|
||||
|
||||
@@ -1094,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:
|
||||
@@ -1134,7 +1121,7 @@ resulting menu model with the menu button that we've added to the headerbar.
|
||||
Since menus work by activating GActions, we also have to add a suitable set
|
||||
of actions to our application.
|
||||
|
||||
Adding the actions is best done in the `startup()` vfunc, which is guaranteed
|
||||
Adding the actions is best done in the startup() vfunc, which is guaranteed
|
||||
to be called once for each primary application instance:
|
||||
|
||||
```c
|
||||
@@ -1192,7 +1179,7 @@ example_app_class_init (ExampleAppClass *class)
|
||||
|
||||
Our preferences menu item does not do anything yet, but the Quit menu item
|
||||
is fully functional. Note that it can also be activated by the usual Ctrl-Q
|
||||
shortcut. The shortcut was added with [`method@Gtk.Application.set_accels_for_action`].
|
||||
shortcut. The shortcut was added with `gtk_application_set_accels_for_action()`.
|
||||
|
||||
The application menu looks like this:
|
||||
|
||||
@@ -1204,7 +1191,7 @@ A typical application will have a some preferences that should be remembered
|
||||
from one run to the next. Even for our simple example application, we may
|
||||
want to change the font that is used for the content.
|
||||
|
||||
We are going to use [class@Gio.Settings] to store our preferences. `GSettings` requires
|
||||
We are going to use `GSettings` to store our preferences. `GSettings` requires
|
||||
a schema that describes our settings:
|
||||
|
||||
```xml
|
||||
@@ -1231,9 +1218,10 @@ a schema that describes our settings:
|
||||
```
|
||||
|
||||
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 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)
|
||||
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)
|
||||
method for this task.
|
||||
|
||||
Next, we need to connect our settings to the widgets that they are supposed
|
||||
@@ -1693,8 +1681,7 @@ What our application looks like now:
|
||||
Widgets and other objects have many useful properties.
|
||||
|
||||
Here we show some ways to use them in new and flexible ways, by wrapping
|
||||
them in actions with [class@Gio.PropertyAction] or by binding them with
|
||||
[class@GObject.Binding].
|
||||
them in actions with `GPropertyAction` or by binding them with `GBinding`.
|
||||
|
||||
To set this up, we add two labels to the header bar in our window template,
|
||||
named `lines_label` and `lines`, and bind them to struct members in the
|
||||
|
@@ -1,57 +0,0 @@
|
||||
.. _gtk4-broadwayd(1):
|
||||
|
||||
==============
|
||||
gtk4-broadwayd
|
||||
==============
|
||||
|
||||
---------------------------
|
||||
The Broadway display server
|
||||
---------------------------
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
| **gtk4-broadwayd** [OPTIONS...] <DISPLAY>
|
||||
| **gtk4-broadwayd** --port=PORT --address=ADDRESS <DISPLAY>
|
||||
| **gtk4-broadwayd** --unixaddress=ADDRESS <DISPLAY>
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
``gtk4-broadwayd`` is a display server for the Broadway GDK backend. It allows
|
||||
multiple GTK applications to display their windows in the same web browser, by
|
||||
connecting to gtk4-broadwayd.
|
||||
|
||||
When using gtk4-broadwayd, specify the display number to use, prefixed with a
|
||||
colon, similar to X. The default display number is 0.
|
||||
|
||||
::
|
||||
|
||||
gtk4-broadwayd :5
|
||||
|
||||
|
||||
Then point your web browser at ``http://127.0.0.1:8085``.
|
||||
|
||||
Start your applications like this:
|
||||
|
||||
::
|
||||
|
||||
GDK_BACKEND=broadway BROADWAY_DISPLAY=:5 gtk4-demo
|
||||
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
|
||||
``--port PORT``
|
||||
|
||||
Use the given ``PORT`` for the HTTP connection, instead of the default ``8080 + (DISPLAY - 1)``.
|
||||
|
||||
``--address ADDRESS``
|
||||
|
||||
Use the given ``address`` for the HTTP connection, instead of the default ``http://127.0.0.1``.
|
||||
|
||||
``--unixsocket ADDRESS``
|
||||
|
||||
Use the given ``address`` as the unix domain socket address. This option
|
||||
overrides ``--address`` and ``--port``, and it is available only on Unix-like
|
||||
systems.
|
84
docs/reference/gtk/gtk4-broadwayd.xml
Normal file
84
docs/reference/gtk/gtk4-broadwayd.xml
Normal file
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="gtk4-broadwayd">
|
||||
|
||||
<refentryinfo>
|
||||
<title>gtk4-broadwayd</title>
|
||||
<productname>GTK</productname>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Alexander</firstname>
|
||||
<surname>Larsson</surname>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>gtk4-broadwayd</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo class="manual">User Commands</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>gtk4-broadwayd</refname>
|
||||
<refpurpose>Broadway display server</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>gtk4-broadwayd</command>
|
||||
<arg choice="opt">--port <replaceable>PORT</replaceable></arg>
|
||||
<arg choice="opt">--address <replaceable>ADDRESS</replaceable></arg>
|
||||
<arg choice="opt">--unixsocket <replaceable>ADDRESS</replaceable></arg>
|
||||
<arg choice="opt"><replaceable>:DISPLAY</replaceable></arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1><title>Description</title>
|
||||
<para>
|
||||
<command>gtk4-broadwayd</command> is a display server for the Broadway
|
||||
GDK backend. It allows multiple GTK applications to display their
|
||||
windows in the same web browser, by connecting to gtk4-broadwayd.
|
||||
</para>
|
||||
<para>
|
||||
When using gtk4-broadwayd, specify the display number to use, prefixed
|
||||
with a colon, similar to X. The default display number is 0.
|
||||
<programlisting>
|
||||
gtk4-broadwayd :5
|
||||
</programlisting>
|
||||
Then point your web browser at <literal>http://127.0.0.1:8085</literal>.
|
||||
Start your applications like this:
|
||||
<programlisting>
|
||||
GDK_BACKEND=broadway BROADWAY_DISPLAY=:5 gtk4-demo
|
||||
</programlisting>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1><title>Options</title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>--port</term>
|
||||
<listitem><para>Use <replaceable>PORT</replaceable> as the HTTP
|
||||
port, instead of the default 8080 + (<replaceable>DISPLAY</replaceable> - 1).
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>--address</term>
|
||||
<listitem><para>Use <replaceable>ADDRESS</replaceable> as the HTTP
|
||||
address, instead of the default <literal>http://127.0.0.1:<replaceable>PORT</replaceable></literal>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>--unixsocket</term>
|
||||
<listitem><para>Use <replaceable>ADDRESS</replaceable> as the unix domain socket
|
||||
address. This option overrides <literal>--address</literal> and <literal>--port</literal>.
|
||||
It is available only on Unix-like systems.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
@@ -1,85 +0,0 @@
|
||||
.. _gtk4-builder-tool(1):
|
||||
|
||||
=================
|
||||
gtk4-builder-tool
|
||||
=================
|
||||
|
||||
-----------------------
|
||||
GtkBuilder File Utility
|
||||
-----------------------
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
| **gtk4-builder-tool** <COMMAND> [OPTIONS...] <FILE>
|
||||
|
|
||||
| **gtk4-builder-tool** validate <FILE>
|
||||
| **gtk4-builder-tool** enumerate <FILE>
|
||||
| **gtk4-builder-tool** simplify [OPTIONS...] <FILE>
|
||||
| **gtk4-builder-tool** preview [OPTIONS...] <FILE>
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
``gtk4-builder-tool`` can perform various operations on GtkBuilder UI definition
|
||||
files.
|
||||
|
||||
COMMANDS
|
||||
--------
|
||||
|
||||
Validation
|
||||
^^^^^^^^^^
|
||||
|
||||
The ``validate`` command validates the given UI definition file and reports
|
||||
errors to ``stderr``.
|
||||
|
||||
Enumeration
|
||||
^^^^^^^^^^^
|
||||
|
||||
The ``enumerate`` command lists all the named objects that are present in the UI
|
||||
definition file.
|
||||
|
||||
Preview
|
||||
^^^^^^^
|
||||
|
||||
The ``preview`` command displays the UI dfinition file.
|
||||
|
||||
This command accepts options to specify the ID of the toplevel object and a CSS
|
||||
file to use.
|
||||
|
||||
``--id=ID``
|
||||
|
||||
The ID of the object to preview. If not specified, gtk4-builder-tool will
|
||||
choose a suitable object on its own.
|
||||
|
||||
``--css=FILE``
|
||||
|
||||
Load style information from the given CSS file.
|
||||
|
||||
Simplification
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
The ``simplify`` command simplifies the UI definition file by removing
|
||||
properties that are set to their default values and writes the resulting XML to
|
||||
the standard output, or back to the input file.
|
||||
|
||||
When the ``--3to4`` option is specified, the ``simplify`` command interprets the
|
||||
input as a GTK 3 UI definuition file and attempts to convert it to GTK 4
|
||||
equivalents. It performs various conversions, such as renaming properties,
|
||||
translating child properties to layout properties, rewriting the setup for
|
||||
GtkNotebook, GtkStack, GtkAssistant or changing toolbars into boxes.
|
||||
|
||||
You should always test the modified UI definition files produced by
|
||||
gtk4-builder-tool before using them in production.
|
||||
|
||||
Note in particular that the conversion done with ``--3to4`` is meant as a
|
||||
starting point for a port from GTK 3 to GTK 4. It is expected that you will have
|
||||
to do manual fixups after the initial conversion.
|
||||
|
||||
``--replace``
|
||||
|
||||
Write the content back to the UI definition file instead of using the standard
|
||||
output.
|
||||
|
||||
``--3to4``
|
||||
|
||||
Transform a GTK 3 UI definition file to the equivalent GTK 4 definitions.
|
110
docs/reference/gtk/gtk4-builder-tool.xml
Normal file
110
docs/reference/gtk/gtk4-builder-tool.xml
Normal file
@@ -0,0 +1,110 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="gtk4-builder-tool">
|
||||
|
||||
<refentryinfo>
|
||||
<title>gtk4-builder-tool</title>
|
||||
<productname>GTK</productname>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Matthias</firstname>
|
||||
<surname>Clasen</surname>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>gtk4-builder-tool</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo class="manual">User Commands</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>gtk4-builder-tool</refname>
|
||||
<refpurpose>GtkBuilder file utility</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>gtk4-builder-tool</command>
|
||||
<arg choice="opt"><replaceable>COMMAND</replaceable></arg>
|
||||
<arg choice="opt" rep="repeat"><replaceable>OPTION</replaceable></arg>
|
||||
<arg choice="plain"><replaceable>FILE</replaceable></arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1><title>Description</title>
|
||||
<para>
|
||||
<command>gtk4-builder-tool</command> can perform various operations
|
||||
on GtkBuilder .ui files.
|
||||
</para>
|
||||
<para>
|
||||
The <option>validate</option> command validates the .ui file and reports
|
||||
errors to stderr.
|
||||
</para>
|
||||
<para>
|
||||
The <option>enumerate</option> command lists all the named objects that
|
||||
are created in the .ui file.
|
||||
</para>
|
||||
<para>
|
||||
The <option>preview</option> command displays the .ui file. This command
|
||||
accepts options to specify the ID of the toplevel object and a .css file
|
||||
to use.
|
||||
</para>
|
||||
<para>
|
||||
The <option>simplify</option> command simplifies the .ui file by removing
|
||||
properties that are set to their default values and writes the resulting XML
|
||||
to stdout, or back to the input file.
|
||||
</para>
|
||||
<para>
|
||||
When the <option>--3to4</option> is specified, <option>simplify</option>
|
||||
interprets the input as a GTK 3 ui file and attempts to convert it to GTK 4
|
||||
equivalents. It performs various conversions, such as renaming properties,
|
||||
translating child properties to layout properties, rewriting the setup for
|
||||
GtkNotebook, GtkStack, GtkAssistant or changing toolbars into boxes.
|
||||
</para>
|
||||
<para>
|
||||
You should always test the modified .ui files produced by gtk4-builder-tool
|
||||
before using them in production.
|
||||
</para>
|
||||
<para>
|
||||
Note in particular that the conversion
|
||||
done with <option>--3to4</option> is meant as a starting point for a port
|
||||
from GTK 3 to GTK 4. It is expected that you will have to do manual fixups
|
||||
after the initial conversion.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1><title>Simplify Options</title>
|
||||
<para>The <option>simplify</option> command accepts the following options:</para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><option>--replace</option></term>
|
||||
<listitem><para>Write the content back to the .ui file instead of stdout.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>--3to4</option></term>
|
||||
<listitem><para>Transform a GTK 3 ui file to GTK 4</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
<refsect1><title>Preview Options</title>
|
||||
<para>The <option>preview</option> command accepts the following options:</para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><option>--id=<arg choice="plain">ID</arg></option></term>
|
||||
<listitem><para>The ID of the object to preview. If not specified,
|
||||
gtk4-builder-tool will choose a suitable object on its own.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>--css=<arg choice="plain">FILE</arg></option></term>
|
||||
<listitem><para>Load style information from the given .css file.</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
@@ -1,22 +0,0 @@
|
||||
.. _gtk4-demo-application(1):
|
||||
|
||||
=====================
|
||||
gtk4-demo-application
|
||||
=====================
|
||||
|
||||
--------------------------
|
||||
Demonstrate GtkApplication
|
||||
--------------------------
|
||||
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
| **gtk4-demo-application**
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
``gtk4-demo-application`` is an example application used by ``gtk4-demo``.
|
||||
|
||||
There is no need to call it manually.
|
44
docs/reference/gtk/gtk4-demo-application.xml
Normal file
44
docs/reference/gtk/gtk4-demo-application.xml
Normal file
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="gtk4-demo-application">
|
||||
|
||||
<refentryinfo>
|
||||
<title>gtk4-demo-application</title>
|
||||
<productname>GTK</productname>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Matthias</firstname>
|
||||
<surname>Clasen</surname>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>gtk4-demo-application</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo class="manual">User Commands</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>gtk4-demo-application</refname>
|
||||
<refpurpose>Demonstrate GtkApplication</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>gtk4-demo-application</command>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1><title>Description</title>
|
||||
<para>
|
||||
<command>gtk4-demo-application</command> is an example application
|
||||
used by <command>gtk4-demo</command>. There is no need to call it
|
||||
manually.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
@@ -1,48 +0,0 @@
|
||||
.. _gtk4-demo(1):
|
||||
|
||||
=========
|
||||
gtk4-demo
|
||||
=========
|
||||
|
||||
-----------------------
|
||||
Demonstrate GTK widgets
|
||||
-----------------------
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
| **gtk4-demo** [OPTIONS...]
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
``gtk4-demo`` is a collection of examples.
|
||||
|
||||
Its purpose is to demonstrate many GTK widgets in a form that is useful to
|
||||
application developers.
|
||||
|
||||
The application shows the source code for each example, as well as other used
|
||||
resources, such as UI description files and image assets.
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
|
||||
``-h, --help``
|
||||
|
||||
Show help options.
|
||||
|
||||
``--version``
|
||||
|
||||
Show program version.
|
||||
|
||||
``--list``
|
||||
|
||||
List available examples.
|
||||
|
||||
``--run EXAMPLE``
|
||||
|
||||
Run the named example. Use ``--list`` to see the available examples.
|
||||
|
||||
``--autoquit``
|
||||
|
||||
Quit after a short timeout. This is intended for use with ``--run``, e.g. when profiling.
|
81
docs/reference/gtk/gtk4-demo.xml
Normal file
81
docs/reference/gtk/gtk4-demo.xml
Normal file
@@ -0,0 +1,81 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="gtk4-demo">
|
||||
|
||||
<refentryinfo>
|
||||
<title>gtk4-demo</title>
|
||||
<productname>GTK</productname>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Matthias</firstname>
|
||||
<surname>Clasen</surname>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>gtk4-demo</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo class="manual">User Commands</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>gtk4-demo</refname>
|
||||
<refpurpose>Demonstrate GTK widgets</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>gtk4-demo</command>
|
||||
<arg choice="opt">--help</arg>
|
||||
<arg choice="opt">--version</arg>
|
||||
<arg choice="opt">--list</arg>
|
||||
<arg choice="opt">--run <replaceable>EXAMPLE</replaceable></arg>
|
||||
<arg choice="opt">--autoquit</arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1><title>Description</title>
|
||||
<para>
|
||||
<command>gtk4-demo</command> is a collection of examples.
|
||||
Its purpose is to demonstrate many GTK widgets in a form
|
||||
that is useful to application developers.
|
||||
</para>
|
||||
<para>
|
||||
The application shows the source code for each example, as well as
|
||||
other used resources, such as ui files and icons.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1><title>Options</title>
|
||||
<para>The following options are understood:</para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><option>-h</option>, <option>--help</option></term>
|
||||
<listitem><para>Show help options</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>--version</option></term>
|
||||
<listitem><para>Show program version</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>--list</option></term>
|
||||
<listitem><para>List available examples.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>-run <replaceable>EXAMPLE</replaceable></option></term>
|
||||
<listitem><para>Run the named example. Use <option>--list</option> to
|
||||
see the available examples.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>--autoquit</option></term>
|
||||
<listitem><para>Quit after a short timeout. This is intended for use
|
||||
with <option>--run</option>, e.g. when profiling.</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
@@ -1,40 +0,0 @@
|
||||
.. _gtk4-encode-symbolic-svg(1):
|
||||
|
||||
========================
|
||||
gtk4-encode-symbolic-svg
|
||||
========================
|
||||
|
||||
--------------------------------
|
||||
Symbolic icon conversion utility
|
||||
--------------------------------
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
| **gtk4-encode-symbolic-svg** [OPTIONS...] <PATH> <WIDTH>x<HEIGHT>
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
``gtk4-encode-symbolic-svg`` converts symbolic SVG icons into specially prepared
|
||||
PNG files. GTK can load and recolor these PNGs, just like original SVGs, but
|
||||
loading them is much faster.
|
||||
|
||||
``PATH`` is the name of a symbolic SVG file, ``WIDTH`` x ``HEIGHT`` are the
|
||||
desired dimensions for the generated PNG file.
|
||||
|
||||
To distinguish them from ordinary PNGs, the generated files have the extension
|
||||
``.symbolic.png``.
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
|
||||
``-o, --output DIRECTORY``
|
||||
|
||||
Write png files to ``DIRECTORY`` instead of the current working directory.
|
||||
|
||||
``--debug``
|
||||
|
||||
Generate PNG files of the various channels during the conversion. If these
|
||||
files are not monochrome green, they are often helpful in pinpointing the
|
||||
problematic parts of the source SVG.
|
74
docs/reference/gtk/gtk4-encode-symbolic-svg.xml
Normal file
74
docs/reference/gtk/gtk4-encode-symbolic-svg.xml
Normal file
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="gtk4-encode-symbolic-svg">
|
||||
|
||||
<refentryinfo>
|
||||
<title>gtk4-encode-symbolic-svg</title>
|
||||
<productname>GTK</productname>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Alexander</firstname>
|
||||
<surname>Larsson</surname>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>gtk4-encode-symbolic-svg</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo class="manual">User Commands</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>gtk4-encode-symbolic-svg</refname>
|
||||
<refpurpose>Symbolic icon conversion utility</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>gtk4-encode-symbolic-svg</command>
|
||||
<arg choice="opt">OPTION...</arg>
|
||||
<arg choice="plain"><replaceable>PATH</replaceable></arg>
|
||||
<arg choice="plain"><replaceable>WIDTH</replaceable>x<replaceable>HEIGHT</replaceable></arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1><title>Description</title>
|
||||
<para>
|
||||
<command>gtk4-encode-symbolic-svg</command> converts symbolic svg icons into
|
||||
specially prepared png files. GTK can load and recolor these pngs, just like
|
||||
original svgs, but loading them is much faster.
|
||||
</para>
|
||||
<para>
|
||||
<replaceable>PATH</replaceable> is the name of a symbolic svg file,
|
||||
<replaceable>WIDTH</replaceable>x<replaceable>HEIGHT</replaceable> are the
|
||||
desired dimensions for the generated png file.
|
||||
</para>
|
||||
<para>
|
||||
To distinguish them from ordinary pngs, the generated files have the extension
|
||||
<filename>.symbolic.png</filename>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1><title>Options</title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>-o <replaceable>DIRECTORY</replaceable></term>
|
||||
<term>--output <replaceable>DIRECTORY</replaceable></term>
|
||||
<listitem><para>Write png files to <replaceable>DIRECTORY</replaceable>
|
||||
instead of the current working directory.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>--debug</term>
|
||||
<listitem><para>Generate png files of the various channels during
|
||||
the conversion. If these files are not monochrome green, they
|
||||
are often helpful in pinpointing the problematic parts of
|
||||
the source svg.</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
@@ -1,28 +0,0 @@
|
||||
.. _gtk4-icon-browser(1):
|
||||
|
||||
=================
|
||||
gtk4-icon-browser
|
||||
=================
|
||||
|
||||
-----------------
|
||||
List themed icons
|
||||
-----------------
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
| **gtk4-icon-browser** [OPTIONS...]
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
``gtk4-icon-browser`` is a utility to explore the icons in the current icon
|
||||
theme. It shows icons in various sizes, their symbolic variants where available,
|
||||
as well as a description of the icon and its context.
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
|
||||
``-h, --help``
|
||||
|
||||
Show the application help.
|
55
docs/reference/gtk/gtk4-icon-browser.xml
Normal file
55
docs/reference/gtk/gtk4-icon-browser.xml
Normal file
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="gtk4-icon-browser">
|
||||
|
||||
<refentryinfo>
|
||||
<title>gtk4-icon-browser</title>
|
||||
<productname>GTK</productname>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Matthias</firstname>
|
||||
<surname>Clasen</surname>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>gtk4-icon-browser</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo class="manual">User Commands</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>gtk4-icon-browser</refname>
|
||||
<refpurpose>List themed icons</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>gtk4-icon-browser</command>
|
||||
<arg choice="opt">--help</arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1><title>Description</title>
|
||||
<para>
|
||||
<command>gtk4-icon-browser</command> is a utility to explore the icons
|
||||
in the current icon theme. It shows icons in various sizes, their symbolic
|
||||
variants where available, as well as a description of the icon and its context.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1><title>Options</title>
|
||||
<para>The following options are understood:</para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><option>-h</option>, <option>--help</option></term>
|
||||
<listitem><para>Show help options</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
@@ -1,50 +0,0 @@
|
||||
.. _gtk4-launch(1):
|
||||
|
||||
===========
|
||||
gtk4-launch
|
||||
===========
|
||||
|
||||
---------------------
|
||||
Launch an application
|
||||
---------------------
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
| **gtk4-launch** [OPTIONS...] <APPLICATION> [URI...]
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
``gtk4-launch`` launches an application using the given name. The application is
|
||||
started with proper startup notification on a default display, unless specified
|
||||
otherwise.
|
||||
|
||||
``gtk4-launch`` 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.
|
||||
|
||||
If called with more than one argument, the rest of them besides the application
|
||||
name are considered URI locations and are passed as arguments to the launched
|
||||
application.
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
|
||||
``-?, -h, --help``
|
||||
|
||||
Print the command's help and exit.
|
||||
|
||||
``--version``
|
||||
|
||||
Print the command's version and exit.
|
||||
|
||||
ENVIRONMENT
|
||||
-----------
|
||||
|
||||
Some environment variables affect the behavior of ``gtk4-launch``:
|
||||
|
||||
``XDG_DATA_HOME, XDG_DATA_DIRS``
|
||||
|
||||
The environment variables specifying the XDG data directories.
|
85
docs/reference/gtk/gtk4-launch.xml
Normal file
85
docs/reference/gtk/gtk4-launch.xml
Normal file
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="gtk4-launch">
|
||||
|
||||
<refentryinfo>
|
||||
<title>gtk4-launch</title>
|
||||
<productname>GTK</productname>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Tomáš</firstname>
|
||||
<surname>Bžatek</surname>
|
||||
<email>tbzatek@redhat.com</email>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>gtk4-launch</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo class="manual">User Commands</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>gtk4-launch</refname>
|
||||
<refpurpose>Launch an application</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>gtk4-launch</command>
|
||||
<arg choice="opt" rep="repeat">OPTION</arg>
|
||||
<arg choice="plain">APPLICATION</arg>
|
||||
<arg choice="opt" rep="repeat">URI</arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1><title>Description</title>
|
||||
<para>
|
||||
<command>gtk4-launch</command> launches an application using the given name.
|
||||
The application is started with proper startup notification on a default
|
||||
display, unless specified otherwise.
|
||||
</para>
|
||||
<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.
|
||||
</para>
|
||||
<para>
|
||||
If called with more than one argument, the rest of them besides the application
|
||||
name are considered URI locations and are passed as arguments to the launched
|
||||
application.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1><title>Options</title>
|
||||
<para>The following options are understood:</para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><option>-?</option>, <option>--help</option></term>
|
||||
<listitem><para>Prints a short help text and exits.</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><option>--version</option></term>
|
||||
<listitem><para>Prints the program version and exits.</para></listitem>
|
||||
</varlistentry>
|
||||
</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>
|
@@ -1,21 +0,0 @@
|
||||
.. _gtk4-query-settings(1):
|
||||
|
||||
===================
|
||||
gtk4-query-settings
|
||||
===================
|
||||
|
||||
------------------------------------
|
||||
Print name and value of GTK settings
|
||||
------------------------------------
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
| **gtk4-query-settings** [PATTERN]
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
``gtk4-query-settings`` prints both name and value of all properties available
|
||||
in the ``GtkSettings`` class. Optionally, you can filter which properties to
|
||||
list by specifying a ``PATTERN``.
|
45
docs/reference/gtk/gtk4-query-settings.xml
Normal file
45
docs/reference/gtk/gtk4-query-settings.xml
Normal file
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="gtk4-query-settings">
|
||||
|
||||
<refentryinfo>
|
||||
<title>gtk4-query-settings</title>
|
||||
<productname>GTK</productname>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Timm</firstname>
|
||||
<surname>Bäder</surname>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>gtk4-query-settings</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo class="manual">User Commands</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>gtk4-query-settings</refname>
|
||||
<refpurpose>Utility to print name and value of all GtkSettings properties</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>gtk4-query-settings</command>
|
||||
<arg choice="opt"><replaceable>PATTERN</replaceable></arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1><title>Description</title>
|
||||
<para>
|
||||
<command>gtk4-query-settings</command> prints both name and value of all properties
|
||||
available in the GtkSettings class. Optionally, you can filter which properties
|
||||
to list by specifying a PATTERN.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
@@ -1,65 +0,0 @@
|
||||
.. _gtk4-update-icon-cache(1):
|
||||
|
||||
======================
|
||||
gtk4-update-icon-cache
|
||||
======================
|
||||
|
||||
--------------------------
|
||||
Icon theme caching utility
|
||||
--------------------------
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
| **gtk4-update-icon-cache** [OPTIONS...] <PATH>
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
``gtk4-update-icon-cache`` creates ``mmap(2)``-able cache files for icon themes.
|
||||
|
||||
It expects to be given the ``PATH`` to an icon theme directory containing an
|
||||
``index.theme``, e.g. ``/usr/share/icons/hicolor``, and writes a
|
||||
``icon-theme.cache`` containing cached information about the icons in the
|
||||
directory tree below the given directory.
|
||||
|
||||
GTK can use the cache files created by ``gtk4-update-icon-cache`` to avoid a lot
|
||||
of system call and disk seek overhead when the application starts. Since the
|
||||
format of the cache files allows them to be shared across multiple processes,
|
||||
for instance using the POSIX ``mmap(2)`` system call, the overall memory
|
||||
consumption is reduced as well.
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
|
||||
``-f, --force``
|
||||
|
||||
Overwrite an existing cache file even if it appears to be up-to-date.
|
||||
|
||||
``-t, --ignore-theme-index``
|
||||
|
||||
Don't check for the existence of ``index.theme`` in the icon theme directory.
|
||||
Without this option, ``gtk4-update-icon-cache`` refuses to create an icon
|
||||
cache in a directory which does not appear to be the toplevel directory of an
|
||||
icon theme.
|
||||
|
||||
``-i, --index-only``
|
||||
|
||||
Don't include image data in the cache.
|
||||
|
||||
``--include-image-data``
|
||||
|
||||
Include image data in the cache.
|
||||
|
||||
``-c, --source <NAME>``
|
||||
|
||||
Output a C header file declaring a constant ``NAME`` with the contents of the
|
||||
icon cache.
|
||||
|
||||
``-q, --quiet``
|
||||
|
||||
Turn off verbose output.
|
||||
|
||||
``-v, --validate``
|
||||
|
||||
Validate existing icon cache.
|
123
docs/reference/gtk/gtk4-update-icon-cache.xml
Normal file
123
docs/reference/gtk/gtk4-update-icon-cache.xml
Normal file
@@ -0,0 +1,123 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="gtk4-update-icon-cache">
|
||||
|
||||
<refentryinfo>
|
||||
<title>gtk4-update-icon-cache</title>
|
||||
<productname>GTK</productname>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Matthias</firstname>
|
||||
<surname>Clasen</surname>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>gtk4-update-icon-cache</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo class="manual">User Commands</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>gtk4-update-icon-cache</refname>
|
||||
<refpurpose>Icon theme caching utility</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>gtk4-update-icon-cache</command>
|
||||
<arg choice="opt">--force</arg>
|
||||
<arg choice="opt">--ignore-theme-index</arg>
|
||||
<group>
|
||||
<arg choice="plain">--index-only</arg>
|
||||
<arg choice="plain">--include-image-data</arg>
|
||||
</group>
|
||||
<arg choice="opt">--source <arg choice="plain"><replaceable>NAME</replaceable></arg></arg>
|
||||
<arg choice="opt">--quiet</arg>
|
||||
<arg choice="opt">--validate</arg>
|
||||
<arg choice="plain"><replaceable>PATH</replaceable></arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1><title>Description</title>
|
||||
<para>
|
||||
<command>gtk4-update-icon-cache</command> creates mmapable cache
|
||||
files for icon themes.
|
||||
</para>
|
||||
<para>
|
||||
It expects to be given the <replaceable>PATH</replaceable> to an icon theme
|
||||
directory containing an <filename>index.theme</filename>, e.g.
|
||||
<filename>/usr/share/icons/hicolor</filename>, and writes a
|
||||
<filename>icon-theme.cache</filename> containing cached information about
|
||||
the icons in the directory tree below the given directory.
|
||||
</para>
|
||||
<para>
|
||||
GTK can use the cache files created by <command>gtk4-update-icon-cache</command>
|
||||
to avoid a lot of system call and disk seek overhead when the application
|
||||
starts. Since the format of the cache files allows them to be shared across
|
||||
multiple processes, for instance using the POSIX <command>mmap()</command> system
|
||||
call, the overall memory consumption is reduced as well.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1><title>Options</title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>--force</term>
|
||||
<term>-f</term>
|
||||
<listitem><para>Overwrite an existing cache file even if it appears to be
|
||||
up-to-date.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>--ignore-theme-index</term>
|
||||
<term>-t</term>
|
||||
<listitem><para>Don't check for the existence of <filename>index.theme</filename>
|
||||
in the icon theme directory. Without this option, <command>gtk4-update-icon-cache</command>
|
||||
refuses to create an icon cache in a directory which does not appear to
|
||||
be the toplevel directory of an icon theme.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>--index-only</term>
|
||||
<term>-i</term>
|
||||
<listitem><para>Don't include image data in the cache.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>--include-image-data</term>
|
||||
<listitem><para>Include image data in the cache.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>--source</term>
|
||||
<term>-c</term>
|
||||
<listitem><para>Output a C header file declaring a constant
|
||||
<replaceable>NAME</replaceable> with the contents of the icon
|
||||
cache.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>--quiet</term>
|
||||
<term>-q</term>
|
||||
<listitem><para>Turn off verbose output.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>--validate</term>
|
||||
<term>-v</term>
|
||||
<listitem><para>Validate existing icon cache.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
@@ -1,34 +0,0 @@
|
||||
.. _gtk4-widget-factory(1):
|
||||
|
||||
===================
|
||||
gtk4-widget-factory
|
||||
===================
|
||||
|
||||
-------------------------------
|
||||
Showcase GTK widgets and styles
|
||||
-------------------------------
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
| **gtk4-widget-factory** [OPTIONS...]
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
``gtk4-widget-factory`` is a collection of examples.
|
||||
|
||||
Its purpose is to demonstrate many GTK widgets in a form that is useful to GTK theme developers.
|
||||
|
||||
The application shows widgets in different, typical combinations and states.
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
|
||||
``-h, --help``
|
||||
|
||||
Show the application help.
|
||||
|
||||
``--version``
|
||||
|
||||
Show the application version.
|
63
docs/reference/gtk/gtk4-widget-factory.xml
Normal file
63
docs/reference/gtk/gtk4-widget-factory.xml
Normal file
@@ -0,0 +1,63 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="gtk4-widget-factory">
|
||||
|
||||
<refentryinfo>
|
||||
<title>gtk4-widget-factory</title>
|
||||
<productname>GTK</productname>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Matthias</firstname>
|
||||
<surname>Clasen</surname>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>gtk4-widget-factory</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo class="manual">User Commands</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>gtk4-widget-factory</refname>
|
||||
<refpurpose>Demonstrate GTK widgets</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>gtk4-widget-factory</command>
|
||||
<arg choice="opt">--help</arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1><title>Description</title>
|
||||
<para>
|
||||
<command>gtk4-widget-factory</command> is a collection of examples.
|
||||
Its purpose is to demonstrate many GTK widgets in a form
|
||||
that is useful to GTK theme developers.
|
||||
</para>
|
||||
<para>
|
||||
The application shows widgets in different, typical combinations
|
||||
and states.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1><title>Options</title>
|
||||
<para>The following options are understood:</para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><option>-h</option>, <option>--help</option></term>
|
||||
<listitem><para>Show help options</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>--version</option></term>
|
||||
<listitem><para>Show program version</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
@@ -42,10 +42,12 @@ if get_option('gtk_doc')
|
||||
command: [
|
||||
gidocgen,
|
||||
'generate',
|
||||
gidocgen_common_args,
|
||||
'--quiet',
|
||||
'--fatal-warnings',
|
||||
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
|
||||
'--config=@INPUT0@',
|
||||
'--output-dir=@OUTPUT@',
|
||||
'--no-namespace-dir',
|
||||
'--content-dir=@0@'.format(meson.current_source_dir()),
|
||||
'@INPUT1@',
|
||||
],
|
||||
@@ -57,15 +59,24 @@ if get_option('gtk_doc')
|
||||
)
|
||||
endif
|
||||
|
||||
rst2man = find_program('rst2man', required: false)
|
||||
if get_option('man-pages') and not rst2man.found()
|
||||
error('No rst2man found, but man pages were explicitly enabled')
|
||||
xsltproc = find_program('xsltproc', required: false)
|
||||
if get_option('man-pages') and not xsltproc.found()
|
||||
error('No xsltproc found, but man pages were explicitly enabled')
|
||||
endif
|
||||
|
||||
if get_option('man-pages') and rst2man.found()
|
||||
rst_files = [
|
||||
[ 'gtk4-broadwayd', '1' ],
|
||||
[ 'gtk4-builder-tool', '1' ],
|
||||
if get_option('man-pages') and xsltproc.found()
|
||||
xlstproc_flags = [
|
||||
'--nonet',
|
||||
'--stringparam', 'man.output.quietly', '1',
|
||||
'--stringparam', 'funcsynopsis.style', 'ansi',
|
||||
'--stringparam', 'man.th.extra1.suppress', '1',
|
||||
'--stringparam', 'man.authors.section.enabled', '0',
|
||||
'--stringparam', 'man.copyright.section.enabled', '0',
|
||||
]
|
||||
|
||||
man_files = [
|
||||
[ 'gtk4-broadwayd', '1', ],
|
||||
[ 'gtk4-builder-tool', '1', ],
|
||||
[ 'gtk4-encode-symbolic-svg', '1', ],
|
||||
[ 'gtk4-launch', '1', ],
|
||||
[ 'gtk4-query-settings', '1', ],
|
||||
@@ -73,7 +84,7 @@ if get_option('man-pages') and rst2man.found()
|
||||
]
|
||||
|
||||
if get_option('demos')
|
||||
rst_files += [
|
||||
man_files += [
|
||||
[ 'gtk4-demo', '1', ],
|
||||
[ 'gtk4-demo-application', '1', ],
|
||||
[ 'gtk4-widget-factory', '1', ],
|
||||
@@ -81,25 +92,21 @@ if get_option('man-pages') and rst2man.found()
|
||||
]
|
||||
endif
|
||||
|
||||
rst2man_flags = [
|
||||
'--syntax-highlight=none',
|
||||
]
|
||||
|
||||
foreach rst: rst_files
|
||||
man_name = rst[0]
|
||||
man_section = rst.get(1, '1')
|
||||
|
||||
custom_target('man-@0@'.format(man_name),
|
||||
input: '@0@.rst'.format(man_name),
|
||||
foreach man: man_files
|
||||
man_name = man.get(0)
|
||||
man_section = man.get(1, '1')
|
||||
custom_target('@0@.@1@'.format(man_name, man_section),
|
||||
input: '@0@.xml'.format(man_name),
|
||||
output: '@0@.@1@'.format(man_name, man_section),
|
||||
command: [
|
||||
rst2man,
|
||||
rst2man_flags,
|
||||
xsltproc,
|
||||
xlstproc_flags,
|
||||
'-o', '@OUTPUT@',
|
||||
'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
|
||||
'@INPUT@',
|
||||
],
|
||||
capture: true,
|
||||
install: true,
|
||||
install_dir: get_option('mandir') / 'man@0@'.format(man_section),
|
||||
install_dir: join_paths(get_option('mandir'), 'man@0@'.format(man_section)),
|
||||
)
|
||||
endforeach
|
||||
endif
|
||||
|
@@ -315,7 +315,7 @@ have been added to `GdkDisplay`.
|
||||
|
||||
The root window is an X11-centric concept that is no longer exposed in the
|
||||
backend-neutral GDK API. If you need to interact with the X11 root window,
|
||||
you can use [`method@GdkX11.Display.get_xrootwindow`] to get its XID.
|
||||
you can use [method@GdkX11.Display.get_xrootwindow] to get its XID.
|
||||
|
||||
### Stop using `GdkVisual`
|
||||
|
||||
@@ -333,9 +333,9 @@ had replacements in GTK 3 and were deprecated in favor of `GdkSeat`.
|
||||
|
||||
In GTK 4, the two roles of a standalone toplevel window and of a popup that
|
||||
is placed relative to a parent window have been separated out into two
|
||||
interfaces, [iface@Gdk.Toplevel] and [iface@Gdk.Popup]. Surfaces
|
||||
implementing these interfaces are created with [`ctor@Gdk.Surface.new_toplevel`]
|
||||
and [`ctor@Gdk.Surface.new_popup`], respectively, and they are presented on
|
||||
interfaces, [class@Gdk.Toplevel] and [class@Gdk.Popup]. Surfaces
|
||||
implementing these interfaces are created with [ctor@Gdk.Surface.new_toplevel]
|
||||
and [ctor@Gdk.Surface.new_popup], respectively, and they are presented on
|
||||
screen using [method@Gdk.Toplevel.present] and [method@Gdk.Popup.present].
|
||||
The `present()` functions take parameters in the form of an auxiliary layout
|
||||
struct, [struct@Gdk.PopupLayout] or [struct@Gdk.ToplevelLayout].
|
||||
@@ -362,9 +362,9 @@ windows, you you will have to use Xlib apis.
|
||||
|
||||
A number of minor API cleanups have happened in `GdkSurface`
|
||||
as well. For example, `gdk_surface_input_shape_combine_region()`
|
||||
has been renamed to [`method@Gdk.Surface.set_input_region`], and
|
||||
has been renamed to [method@Gdk.Surface.set_input_region], and
|
||||
`gdk_surface_begin_resize_drag()` has been renamed to
|
||||
[`method@Gdk.Toplevel.begin_resize`].
|
||||
[method@Gdk.Toplevel.begin_resize].
|
||||
|
||||
### The "iconified" window state has been renamed to "minimized"
|
||||
|
||||
@@ -388,7 +388,7 @@ have accessors that you will have to use.
|
||||
|
||||
Event compression is always enabled in GTK 4, for both motion and
|
||||
scroll events. If you need to see the uncoalesced motion or scroll
|
||||
history, use [`method@Gdk.Event.get_history`] on the latest event.
|
||||
history, use [method@Gdk.Event.get_history] on the latest event.
|
||||
|
||||
### Stop using grabs
|
||||
|
||||
@@ -668,21 +668,18 @@ box children as necessary.
|
||||
### Adapt to `GtkWindow` API changes
|
||||
|
||||
Following the `GdkSurface` changes, a number of `GtkWindow` APIs that were
|
||||
X11-specific have been removed. This includes `gtk_window_set_position()`,
|
||||
`gtk_window_set_geometry_hints()`, `gtk_window_set_gravity()`,
|
||||
`gtk_window_move()`, `gtk_window_parse_geometry()`,
|
||||
X11-specific have been removed. This includes `gtk_window_set_geometry_hints()`,
|
||||
`gtk_window_set_gravity()`, `gtk_window_move()`, `gtk_window_parse_geometry()`,
|
||||
`gtk_window_set_keep_above()`, `gtk_window_set_keep_below()`,
|
||||
`gtk_window_begin_resize_drag()`, `gtk_window_begin_move_drag()`.
|
||||
Most likely, you should just stop using them. In some cases, you can
|
||||
fall back to using the underlying `GdkToplevel` APIs (for example,
|
||||
[`method@Gdk.Toplevel.begin_resize`]); alternatively, you will need to get
|
||||
the native windowing system surface from the `GtkWindow` and call platform
|
||||
specific API.
|
||||
[method@Gdk.Toplevel.begin_resize]).
|
||||
|
||||
The APIs for controlling `GtkWindow` size have changed to be better aligned
|
||||
with the way size changes are integrated in the frame cycle. `gtk_window_resize()`
|
||||
and `gtk_window_get_size()` have been removed. Instead, use
|
||||
[`method@Gtk.Window.set_default_size`] and [`method@Gtk.Window.get_default_size`].
|
||||
[method@Gtk.Window.set_default_size] and [method@Gtk.Window.get_default_size].
|
||||
|
||||
### Adapt to `GtkHeaderBar` and `GtkActionBar` API changes
|
||||
|
||||
@@ -1054,7 +1051,7 @@ Observing widget contents and widget size is now done by using the
|
||||
|
||||
### Monitor handling has changed
|
||||
|
||||
Instead of a monitor number, [class@Gdk.Monitor] is now used throughout.
|
||||
Instead of a monitor number, [class@Gdk.Monitor] is now used throughout.
|
||||
[method@Gdk.Display.get_monitors] returns the list of monitors that can be queried
|
||||
or observed for monitors to pass to APIs like [method@Gtk.Window.fullscreen_on_monitor].
|
||||
|
||||
@@ -1335,18 +1332,6 @@ pointer coordinates as inout arguments any more, but as normal in ones.
|
||||
|
||||
See: [method@Gtk.TreeView.get_tooltip_context], [method@Gtk.IconView.get_tooltip_context]
|
||||
|
||||
### Adapt to GtkPopover changes
|
||||
|
||||
In GTK 3, a `GtkPopover` could be attached to any widget, using the `relative-to`
|
||||
property. This is no longer possible in GTK 4. The parent widget has to be aware
|
||||
of its popover children, and manage their size allocation. Therefore, only widgets
|
||||
with dedicated popover support can have them, such as [class@Gtk.MenuButton] or
|
||||
[class@Gtk.PopoverMenuBar].
|
||||
|
||||
If you want to make a custom widget that has an attached popover, you need to call
|
||||
[method@Gtk.Popover.present] in your [vfunc@Gtk.Widget.size_allocate] vfunc, in order
|
||||
to update the positioning of the popover.
|
||||
|
||||
### Stop using GtkFileChooserButton
|
||||
|
||||
The `GtkFileChooserButton` widget was removed, due to its shortcomings in
|
||||
|
101
docs/reference/gtk/overview.xml
Normal file
101
docs/reference/gtk/overview.xml
Normal file
@@ -0,0 +1,101 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE partintro PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<partintro>
|
||||
<para>
|
||||
GTK is a library for creating graphical user interfaces. It
|
||||
works on many UNIX-like platforms, Windows, and OS X.
|
||||
GTK is released under the GNU Library General Public License
|
||||
(GNU LGPL), which allows for flexible licensing of client
|
||||
applications. GTK has a C-based object-oriented architecture that
|
||||
allows for maximum flexibility. Bindings for many other languages have
|
||||
been written, including C++, Objective-C, Guile/Scheme, Perl, Python,
|
||||
TOM, Ada95, Free Pascal, and Eiffel. The GTK library itself contains
|
||||
<firstterm>widgets</firstterm>, that is, GUI components such as GtkButton
|
||||
or GtkTextView.
|
||||
|
||||
</para>
|
||||
<para>
|
||||
GTK depends on the following libraries:
|
||||
<variablelist>
|
||||
|
||||
<varlistentry>
|
||||
<term>GLib</term>
|
||||
<listitem><para>
|
||||
A general-purpose utility library, not specific to graphical user interfaces.
|
||||
GLib provides many useful data types, macros, type conversions,
|
||||
string utilities, file utilities, a main loop abstraction, and so on.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>GObject</term>
|
||||
<listitem><para>A library that provides a type system, a collection of
|
||||
fundamental types including an object type, a signal system.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>GIO</term>
|
||||
<listitem><para>A modern, easy-to-use VFS API including abstractions for
|
||||
files, drives, volumes, stream IO, as well as network programming and
|
||||
DBus communication.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>cairo</term>
|
||||
<listitem><para>Cairo is a 2D graphics library with support for multiple
|
||||
output devices.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>Pango</term>
|
||||
<listitem><para>
|
||||
Pango is a library for internationalized text handling. It centers
|
||||
around the PangoLayout object, representing a paragraph of text.
|
||||
Pango provides the engine for GtkTextView, GtkLabel, GtkEntry, and
|
||||
other widgets that display text.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>GdkPixbuf</term>
|
||||
<listitem><para>
|
||||
This is a small library which allows you to create GdkPixbuf
|
||||
("pixel buffer") objects from image data or image files.
|
||||
Use a GdkPixbuf in combination with GtkImage to display images.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>graphene</term>
|
||||
<listitem><para>
|
||||
This is a small library which provides vector and matrix datatypes
|
||||
and operations. graphene provides optimized implementations using
|
||||
various SIMD instruction sets such as SSE.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>GDK</term>
|
||||
<listitem><para>
|
||||
GDK is the abstraction layer that allows GTK to support multiple
|
||||
windowing systems. GDK provides window system facilities on Wayland,
|
||||
X11, Windows, and OS X.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>GSK</term>
|
||||
<listitem><para>
|
||||
GSK is a library for creating a scene graph from render nodes,
|
||||
and rendering it using different rendering APIs. GSK provides renderers
|
||||
for OpenGL, Vulkan and cairo.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</partintro>
|
@@ -14,7 +14,7 @@ the question you have, this list is a good place to start.
|
||||
(most of it about GTK 2.x and 3.x, but still somewhat applicable). This
|
||||
reference manual also contains a introductory
|
||||
[Getting Started](#gtk-getting-started) part.
|
||||
|
||||
|
||||
More documentation ranging from whitepapers to online books can be found at
|
||||
the [GNOME developer's site](https://developer.gnome.org). After studying these
|
||||
materials you should be well prepared to come back to this reference manual for details.
|
||||
@@ -93,11 +93,11 @@ the question you have, this list is a good place to start.
|
||||
|
||||
`gi18n.h` provides the following shorthand macros for convenience.
|
||||
Conventionally, people define macros as follows for convenience:
|
||||
|
||||
|
||||
#define _(x) gettext (x)
|
||||
#define N_(x) x
|
||||
#define C_(ctx,x) pgettext (ctx, x)
|
||||
|
||||
|
||||
You use `N_()` (N stands for no-op) to mark a string for translation in
|
||||
a location where a function call to gettext() is not allowed, such as
|
||||
in an array initializer. You eventually have to call gettext() on the
|
||||
@@ -205,14 +205,14 @@ the question you have, this list is a good place to start.
|
||||
Here is an example showing the three approaches using the copyright
|
||||
sign © which has Unicode and ISO-8859-1 codepoint 169 and is represented
|
||||
in UTF-8 by the two bytes 194, 169, or `"\302\251"` as a string literal:
|
||||
|
||||
|
||||
g_print ("direct UTF-8: ©");
|
||||
g_print ("escaped UTF-8: \302\251");
|
||||
text = g_convert ("runtime conversion: ©", -1,
|
||||
"ISO-8859-1", "UTF-8", NULL, NULL, NULL);
|
||||
g_print (text);
|
||||
g_free (text);
|
||||
|
||||
|
||||
If you are using gettext() to localize your application, you need
|
||||
to call bind_textdomain_codeset() to ensure that translated strings
|
||||
are returned in UTF-8 encoding.
|
||||
@@ -432,10 +432,10 @@ the question you have, this list is a good place to start.
|
||||
|
||||
26. How do I associate some data with a row in the tree?
|
||||
|
||||
Remember that the [iface@Gtk.TreeModel] columns don't necessarily have to be
|
||||
Remember that the [class@Gtk.TreeModel] 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).
|
||||
See the [tree widget overview](#TreeWidget).
|
||||
|
||||
27. How do I put an image and some text in the same column?
|
||||
|
||||
@@ -447,7 +447,7 @@ the question you have, this list is a good place to start.
|
||||
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?
|
||||
|
||||
Both the [class@Gtk.TreeStore] and the [class@Gtk.ListStore] implement the [iface@Gtk.TreeModel]
|
||||
Both the [class@Gtk.TreeStore] and the [class@Gtk.ListStore] implement the [class@Gtk.TreeModel]
|
||||
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].
|
||||
|
@@ -13,5 +13,4 @@ baseURLs = [
|
||||
[ 'Gtk', 'https://docs.gtk.org/gtk4/' ],
|
||||
[ 'Pango', 'https://docs.gtk.org/Pango/' ],
|
||||
[ 'PangoCairo', 'https://docs.gtk.org/PangoCairo/' ],
|
||||
[ 'GdkPixbuf', 'https://docs.gtk.org/gdk-pixbuf/' ],
|
||||
]
|
||||
|
@@ -3,15 +3,6 @@ toml_conf.set('version', meson.project_version())
|
||||
|
||||
gidocgen = find_program('gi-docgen', required: get_option('gtk_doc'))
|
||||
|
||||
gidocgen_common_args = [
|
||||
'--quiet',
|
||||
'--no-namespace-dir',
|
||||
]
|
||||
|
||||
if get_option('werror')
|
||||
gidocgen_common_args += ['--fatal-warnings']
|
||||
endif
|
||||
|
||||
docs_dir = gtk_datadir / 'doc'
|
||||
|
||||
if get_option('gtk_doc') and not build_gir
|
||||
|
@@ -603,8 +603,8 @@ bloat_pad_startup (GApplication *application)
|
||||
g_object_unref (icon);
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
icon = G_ICON (gdk_texture_new_from_resource ("/org/gtk/libgtk/icons/16x16/actions/folder-new.png"));
|
||||
item = g_menu_item_new ("Texture", NULL);
|
||||
icon = G_ICON (gdk_pixbuf_new_from_resource ("/org/gtk/libgtk/icons/16x16/actions/folder-new.png", NULL));
|
||||
item = g_menu_item_new ("Pixbuf", NULL);
|
||||
g_menu_item_set_icon (item, icon);
|
||||
g_menu_append_item (menu, item);
|
||||
g_object_unref (item);
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#include <glib.h>
|
||||
#include <glib/gprintf.h>
|
||||
#include "gdktypes.h"
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include "gdkinternals.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
@@ -609,46 +609,56 @@ open_shared_memory (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
int fd;
|
||||
gsize size;
|
||||
} PngData;
|
||||
|
||||
static cairo_status_t
|
||||
write_png_cb (void *closure,
|
||||
const guchar *data,
|
||||
unsigned int length)
|
||||
{
|
||||
PngData *png_data = closure;
|
||||
int fd = png_data->fd;
|
||||
|
||||
while (length)
|
||||
{
|
||||
gssize ret = write (fd, data, length);
|
||||
|
||||
if (ret <= 0)
|
||||
return CAIRO_STATUS_WRITE_ERROR;
|
||||
|
||||
png_data->size += ret;
|
||||
length -= ret;
|
||||
data += ret;
|
||||
}
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
guint32
|
||||
gdk_broadway_server_upload_texture (GdkBroadwayServer *server,
|
||||
GdkTexture *texture)
|
||||
{
|
||||
guint32 id;
|
||||
cairo_surface_t *surface = gdk_texture_download_surface (texture);
|
||||
BroadwayRequestUploadTexture msg;
|
||||
GBytes *bytes;
|
||||
const guchar *data;
|
||||
gsize size;
|
||||
int fd;
|
||||
|
||||
bytes = gdk_texture_save_to_png_bytes (texture);
|
||||
fd = open_shared_memory ();
|
||||
data = g_bytes_get_data (bytes, &size);
|
||||
PngData data;
|
||||
|
||||
id = server->next_texture_id++;
|
||||
|
||||
data.fd = open_shared_memory ();
|
||||
data.size = 0;
|
||||
cairo_surface_write_to_png_stream (surface, write_png_cb, &data);
|
||||
|
||||
msg.id = id;
|
||||
msg.offset = 0;
|
||||
msg.size = 0;
|
||||
|
||||
while (msg.size < size)
|
||||
{
|
||||
gssize ret = write (fd, data + msg.size, size - msg.size);
|
||||
|
||||
if (ret <= 0)
|
||||
{
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
||||
msg.size += ret;
|
||||
}
|
||||
|
||||
g_bytes_unref (bytes);
|
||||
msg.size = data.size;
|
||||
|
||||
/* This passes ownership of fd */
|
||||
gdk_broadway_server_send_fd_message (server, msg,
|
||||
BROADWAY_REQUEST_UPLOAD_TEXTURE, fd);
|
||||
BROADWAY_REQUEST_UPLOAD_TEXTURE, data.fd);
|
||||
|
||||
return id;
|
||||
}
|
||||
|
@@ -2,10 +2,8 @@
|
||||
#define __GDK_BROADWAY_SERVER__
|
||||
|
||||
#include <gdk/gdktypes.h>
|
||||
|
||||
#include "gdkdeviceprivate.h"
|
||||
|
||||
#include "broadway-protocol.h"
|
||||
#include "gdkinternals.h"
|
||||
|
||||
typedef struct _GdkBroadwayServer GdkBroadwayServer;
|
||||
typedef struct _GdkBroadwayServerClass GdkBroadwayServerClass;
|
||||
|
@@ -34,7 +34,6 @@ gdk_broadway_cairo_context_dispose (GObject *object)
|
||||
|
||||
static void
|
||||
gdk_broadway_cairo_context_begin_frame (GdkDrawContext *draw_context,
|
||||
gboolean prefers_high_depth,
|
||||
cairo_region_t *region)
|
||||
{
|
||||
GdkBroadwayCairoContext *self = GDK_BROADWAY_CAIRO_CONTEXT (draw_context);
|
||||
|
@@ -30,6 +30,7 @@
|
||||
#include "gdkmonitor-broadway.h"
|
||||
#include "gdkseatdefaultprivate.h"
|
||||
#include "gdkdevice-broadway.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include <gdk/gdktextureprivate.h>
|
||||
#include "gdk-private.h"
|
||||
@@ -213,7 +214,7 @@ _gdk_broadway_display_open (const char *display_name)
|
||||
broadway_display->server = _gdk_broadway_server_new (display, display_name, &error);
|
||||
if (broadway_display->server == NULL)
|
||||
{
|
||||
GDK_NOTE (MISC, g_message ("Unable to init Broadway server: %s\n", error->message));
|
||||
g_printerr ("Unable to init Broadway server: %s\n", error->message);
|
||||
g_error_free (error);
|
||||
return NULL;
|
||||
}
|
||||
|
@@ -27,6 +27,7 @@
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkkeys.h"
|
||||
#include "gdksurface.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkbroadway-server.h"
|
||||
#include "gdkmonitorprivate.h"
|
||||
|
||||
|
@@ -28,6 +28,7 @@
|
||||
|
||||
#include "gdksurfaceprivate.h"
|
||||
#include "gdkprivate-broadway.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkdisplay-broadway.h"
|
||||
|
||||
#include <string.h>
|
||||
|
@@ -34,7 +34,6 @@ gdk_broadway_draw_context_dispose (GObject *object)
|
||||
|
||||
static void
|
||||
gdk_broadway_draw_context_begin_frame (GdkDrawContext *draw_context,
|
||||
gboolean prefers_high_depth,
|
||||
cairo_region_t *region)
|
||||
{
|
||||
GdkBroadwayDrawContext *self = GDK_BROADWAY_DRAW_CONTEXT (draw_context);
|
||||
|
@@ -19,9 +19,8 @@
|
||||
|
||||
#include "gdkeventsource.h"
|
||||
|
||||
#include "gdkeventsprivate.h"
|
||||
#include "gdkframeclockprivate.h"
|
||||
#include "gdksurfaceprivate.h"
|
||||
#include "gdkframeclockprivate.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkprivate-broadway.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkdisplay-broadway.h"
|
||||
#include "gdkkeysprivate.h"
|
||||
#include "gdkkeysyms.h"
|
||||
|
@@ -30,6 +30,7 @@
|
||||
#define __GDK_PRIVATE_BROADWAY_H__
|
||||
|
||||
#include <gdk/gdkcursor.h>
|
||||
#include <gdk/gdkinternals.h>
|
||||
#include "gdksurface-broadway.h"
|
||||
#include "gdkdisplay-broadway.h"
|
||||
#include "gdkdrawcontext-broadway.h"
|
||||
|
@@ -35,12 +35,13 @@
|
||||
#include "gdkdragsurfaceprivate.h"
|
||||
#include "gdkeventsource.h"
|
||||
#include "gdkframeclockidleprivate.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkpopupprivate.h"
|
||||
#include "gdkprivate-broadway.h"
|
||||
#include "gdkseatprivate.h"
|
||||
#include "gdksurfaceprivate.h"
|
||||
#include "gdktextureprivate.h"
|
||||
#include "gdktoplevelprivate.h"
|
||||
#include "gdk-private.h"
|
||||
|
||||
#include <graphene.h>
|
||||
#include <stdlib.h>
|
||||
|
@@ -27,6 +27,7 @@
|
||||
|
||||
#include <gdk/gdksurfaceprivate.h>
|
||||
#include "gdkbroadwaysurface.h"
|
||||
#include "gdkinternals.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
@@ -64,7 +64,7 @@ libgdk_broadway = static_library('gdk-broadway',
|
||||
|
||||
# gtk4-broadwayd
|
||||
|
||||
broadwayd_syslib = os_win32 ? cc.find_library('ws2_32') : shmlib
|
||||
broadwayd_syslib = os_win32 ? find_library('ws2_32') : shmlib
|
||||
|
||||
executable('gtk4-broadwayd',
|
||||
sources: [
|
||||
|
@@ -1,7 +1,8 @@
|
||||
#ifndef __GDK__PRIVATE_H__
|
||||
#define __GDK__PRIVATE_H__
|
||||
|
||||
#include "gdk/gdktypes.h"
|
||||
#include <gdk/gdk.h>
|
||||
#include "gdk/gdkinternals.h"
|
||||
|
||||
/* Private API for use in GTK+ */
|
||||
|
||||
@@ -28,10 +29,14 @@ gboolean gdk_should_use_portal (void);
|
||||
|
||||
const char * gdk_get_startup_notification_id (void);
|
||||
|
||||
PangoDirection gdk_unichar_direction (gunichar ch) G_GNUC_CONST;
|
||||
PangoDirection gdk_unichar_direction (gunichar ch);
|
||||
PangoDirection gdk_find_base_dir (const char *text,
|
||||
int len);
|
||||
|
||||
void gdk_surface_set_widget (GdkSurface *surface,
|
||||
gpointer widget);
|
||||
gpointer gdk_surface_get_widget (GdkSurface *surface);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *key;
|
||||
|
25
gdk/gdk.c
25
gdk/gdk.c
@@ -26,15 +26,19 @@
|
||||
|
||||
#include "gdkversionmacros.h"
|
||||
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkintl.h"
|
||||
|
||||
#include "gdkresources.h"
|
||||
|
||||
#include "gdkconstructor.h"
|
||||
#include "gdkdebug.h"
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdkglcontextprivate.h"
|
||||
#include "gdkintl.h"
|
||||
#include "gdk-private.h"
|
||||
|
||||
#include "gdkconstructor.h"
|
||||
|
||||
#ifndef HAVE_XCONVERTCASE
|
||||
#include "gdkkeysyms.h"
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
@@ -121,7 +125,7 @@ static const GdkDebugKey gdk_debug_keys[] = {
|
||||
{ "gl-software", GDK_DEBUG_GL_SOFTWARE, "Force OpenGL software rendering" },
|
||||
{ "gl-texture-rect", GDK_DEBUG_GL_TEXTURE_RECT, "Use OpenGL texture rectangle extension" },
|
||||
{ "gl-legacy", GDK_DEBUG_GL_LEGACY, "Use a legacy OpenGL context" },
|
||||
{ "gl-gles", GDK_DEBUG_GL_GLES, "Only allow OpenGL GLES API" },
|
||||
{ "gl-gles", GDK_DEBUG_GL_GLES, "Use a GLES OpenGL context" },
|
||||
{ "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL" },
|
||||
{ "gl-egl", GDK_DEBUG_GL_EGL, "Use EGL on X11 or Windows" },
|
||||
{ "gl-glx", GDK_DEBUG_GL_GLX, "Use GLX on X11" },
|
||||
@@ -129,7 +133,6 @@ static const GdkDebugKey gdk_debug_keys[] = {
|
||||
{ "vulkan-disable", GDK_DEBUG_VULKAN_DISABLE, "Disable Vulkan support" },
|
||||
{ "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer" },
|
||||
{ "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings", TRUE },
|
||||
{ "high-depth", GDK_DEBUG_HIGH_DEPTH, "Use high bit depth rendering if possible", TRUE },
|
||||
};
|
||||
|
||||
|
||||
@@ -296,14 +299,6 @@ gdk_pre_parse (void)
|
||||
gdk_debug_keys,
|
||||
G_N_ELEMENTS (gdk_debug_keys));
|
||||
|
||||
/* These are global */
|
||||
if (GDK_DEBUG_CHECK (GL_EGL))
|
||||
gdk_gl_backend_use (GDK_GL_EGL);
|
||||
else if (GDK_DEBUG_CHECK (GL_GLX))
|
||||
gdk_gl_backend_use (GDK_GL_GLX);
|
||||
else if (GDK_DEBUG_CHECK (GL_WGL))
|
||||
gdk_gl_backend_use (GDK_GL_WGL);
|
||||
|
||||
#ifndef G_HAS_CONSTRUCTORS
|
||||
stash_desktop_startup_notification_id ();
|
||||
#endif
|
||||
|
@@ -47,7 +47,6 @@
|
||||
#include <gdk/gdkdragsurface.h>
|
||||
#include <gdk/gdkdrawcontext.h>
|
||||
#include <gdk/gdkdrop.h>
|
||||
#include <gdk/gdkenums.h>
|
||||
#include <gdk/gdkenumtypes.h>
|
||||
#include <gdk/gdkevents.h>
|
||||
#include <gdk/gdkframeclock.h>
|
||||
|
@@ -32,7 +32,7 @@ G_BEGIN_DECLS
|
||||
|
||||
#define GDK_TYPE_APP_LAUNCH_CONTEXT (gdk_app_launch_context_get_type ())
|
||||
#define GDK_APP_LAUNCH_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_APP_LAUNCH_CONTEXT, GdkAppLaunchContext))
|
||||
#define GDK_IS_APP_LAUNCH_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_APP_LAUNCH_CONTEXT))
|
||||
#define GDK_IS_APP_LAUNCH_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_APP_LAUNCH_CONTEXT))
|
||||
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
@@ -17,7 +17,9 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkcairoprivate.h"
|
||||
#include "gdkcairo.h"
|
||||
|
||||
#include "gdkinternals.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
@@ -91,7 +93,11 @@ void
|
||||
gdk_cairo_surface_paint_pixbuf (cairo_surface_t *surface,
|
||||
const GdkPixbuf *pixbuf)
|
||||
{
|
||||
GdkTexture *texture;
|
||||
int width, height;
|
||||
guchar *gdk_pixels, *cairo_pixels;
|
||||
int gdk_rowstride, cairo_stride;
|
||||
int n_channels;
|
||||
int j;
|
||||
|
||||
if (cairo_surface_status (surface) != CAIRO_STATUS_SUCCESS)
|
||||
return;
|
||||
@@ -107,11 +113,71 @@ gdk_cairo_surface_paint_pixbuf (cairo_surface_t *surface,
|
||||
|
||||
cairo_surface_flush (surface);
|
||||
|
||||
texture = gdk_texture_new_for_pixbuf (GDK_PIXBUF (pixbuf));
|
||||
gdk_texture_download (texture,
|
||||
cairo_image_surface_get_data (surface),
|
||||
cairo_image_surface_get_stride (surface));
|
||||
g_object_unref (texture);
|
||||
width = gdk_pixbuf_get_width (pixbuf);
|
||||
height = gdk_pixbuf_get_height (pixbuf);
|
||||
gdk_pixels = gdk_pixbuf_get_pixels (pixbuf);
|
||||
gdk_rowstride = gdk_pixbuf_get_rowstride (pixbuf);
|
||||
n_channels = gdk_pixbuf_get_n_channels (pixbuf);
|
||||
cairo_stride = cairo_image_surface_get_stride (surface);
|
||||
cairo_pixels = cairo_image_surface_get_data (surface);
|
||||
|
||||
for (j = height; j; j--)
|
||||
{
|
||||
guchar *p = gdk_pixels;
|
||||
guchar *q = cairo_pixels;
|
||||
|
||||
if (n_channels == 3)
|
||||
{
|
||||
guchar *end = p + 3 * width;
|
||||
|
||||
while (p < end)
|
||||
{
|
||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
q[0] = p[2];
|
||||
q[1] = p[1];
|
||||
q[2] = p[0];
|
||||
q[3] = 0xFF;
|
||||
#else
|
||||
q[0] = 0xFF;
|
||||
q[1] = p[0];
|
||||
q[2] = p[1];
|
||||
q[3] = p[2];
|
||||
#endif
|
||||
p += 3;
|
||||
q += 4;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
guchar *end = p + 4 * width;
|
||||
guint t1,t2,t3;
|
||||
|
||||
#define MULT(d,c,a,t) G_STMT_START { t = c * a + 0x80; d = ((t >> 8) + t) >> 8; } G_STMT_END
|
||||
|
||||
while (p < end)
|
||||
{
|
||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
MULT(q[0], p[2], p[3], t1);
|
||||
MULT(q[1], p[1], p[3], t2);
|
||||
MULT(q[2], p[0], p[3], t3);
|
||||
q[3] = p[3];
|
||||
#else
|
||||
q[0] = p[3];
|
||||
MULT(q[1], p[0], p[3], t1);
|
||||
MULT(q[2], p[1], p[3], t2);
|
||||
MULT(q[3], p[2], p[3], t3);
|
||||
#endif
|
||||
|
||||
p += 4;
|
||||
q += 4;
|
||||
}
|
||||
|
||||
#undef MULT
|
||||
}
|
||||
|
||||
gdk_pixels += gdk_rowstride;
|
||||
cairo_pixels += cairo_stride;
|
||||
}
|
||||
|
||||
cairo_surface_mark_dirty (surface);
|
||||
}
|
||||
|
@@ -50,7 +50,7 @@ cairo_region_t *
|
||||
gdk_cairo_region_create_from_surface
|
||||
(cairo_surface_t *surface);
|
||||
|
||||
GDK_DEPRECATED_IN_4_6_FOR(gdk_gl_texture_new)
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_cairo_draw_from_gl (cairo_t *cr,
|
||||
GdkSurface *surface,
|
||||
int source,
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#include "gdkcairocontextprivate.h"
|
||||
|
||||
#include "gdkcairo.h"
|
||||
#include "gdkinternals.h"
|
||||
|
||||
/**
|
||||
* GdkCairoContext:
|
||||
|
@@ -18,8 +18,6 @@
|
||||
#ifndef __GDK_CAIRO_PRIVATE_H__
|
||||
#define __GDK_CAIRO_PRIVATE_H__
|
||||
|
||||
#include "gdkcairo.h"
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <cairo.h>
|
||||
|
||||
|
@@ -1253,14 +1253,14 @@ gdk_clipboard_set_content (GdkClipboard *clipboard,
|
||||
* @...: value contents conforming to @type
|
||||
*
|
||||
* Sets the clipboard to contain the value collected from the given varargs.
|
||||
*
|
||||
*
|
||||
* Values should be passed the same way they are passed to other value
|
||||
* collecting APIs, such as [`method@GObject.Object.set`] or
|
||||
* [`func@GObject.signal_emit`].
|
||||
* [`id@g_signal_emit`].
|
||||
*
|
||||
* ```c
|
||||
* gdk_clipboard_set (clipboard, GTK_TYPE_STRING, "Hello World");
|
||||
*
|
||||
*
|
||||
* gdk_clipboard_set (clipboard, GDK_TYPE_TEXTURE, some_texture);
|
||||
* ```
|
||||
*/
|
||||
|
@@ -25,8 +25,6 @@
|
||||
#include "filetransferportalprivate.h"
|
||||
#include "gdktexture.h"
|
||||
#include "gdkrgbaprivate.h"
|
||||
#include "loaders/gdkpngprivate.h"
|
||||
#include "loaders/gdktiffprivate.h"
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
@@ -657,56 +655,6 @@ pixbuf_deserializer (GdkContentDeserializer *deserializer)
|
||||
deserializer);
|
||||
}
|
||||
|
||||
static void
|
||||
texture_deserializer_finish (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer deserializer)
|
||||
{
|
||||
GOutputStream *stream = G_OUTPUT_STREAM (source);
|
||||
GBytes *bytes;
|
||||
GError *error = NULL;
|
||||
GdkTexture *texture = NULL;
|
||||
gssize written;
|
||||
|
||||
written = g_output_stream_splice_finish (stream, result, &error);
|
||||
if (written < 0)
|
||||
{
|
||||
gdk_content_deserializer_return_error (deserializer, error);
|
||||
return;
|
||||
}
|
||||
|
||||
bytes = g_memory_output_stream_steal_as_bytes (G_MEMORY_OUTPUT_STREAM (stream));
|
||||
|
||||
texture = gdk_texture_new_from_bytes (bytes, &error);
|
||||
g_bytes_unref (bytes);
|
||||
if (texture == NULL)
|
||||
{
|
||||
gdk_content_deserializer_return_error (deserializer, error);
|
||||
return;
|
||||
}
|
||||
|
||||
g_value_take_object (gdk_content_deserializer_get_value (deserializer), texture);
|
||||
gdk_content_deserializer_return_success (deserializer);
|
||||
}
|
||||
|
||||
static void
|
||||
texture_deserializer (GdkContentDeserializer *deserializer)
|
||||
{
|
||||
GOutputStream *output;
|
||||
|
||||
output = g_memory_output_stream_new_resizable ();
|
||||
|
||||
g_output_stream_splice_async (output,
|
||||
gdk_content_deserializer_get_input_stream (deserializer),
|
||||
G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE
|
||||
| G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET,
|
||||
gdk_content_deserializer_get_priority (deserializer),
|
||||
gdk_content_deserializer_get_cancellable (deserializer),
|
||||
texture_deserializer_finish,
|
||||
deserializer);
|
||||
g_object_unref (output);
|
||||
}
|
||||
|
||||
static void
|
||||
string_deserializer_finish (GObject *source,
|
||||
GAsyncResult *result,
|
||||
@@ -915,71 +863,48 @@ init (void)
|
||||
|
||||
initialized = TRUE;
|
||||
|
||||
gdk_content_register_deserializer ("image/png",
|
||||
GDK_TYPE_TEXTURE,
|
||||
texture_deserializer,
|
||||
NULL,
|
||||
NULL);
|
||||
gdk_content_register_deserializer ("image/tiff",
|
||||
GDK_TYPE_TEXTURE,
|
||||
texture_deserializer,
|
||||
NULL,
|
||||
NULL);
|
||||
gdk_content_register_deserializer ("image/jpeg",
|
||||
GDK_TYPE_TEXTURE,
|
||||
texture_deserializer,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
|
||||
formats = gdk_pixbuf_get_formats ();
|
||||
|
||||
/* Make sure png comes first */
|
||||
for (f = formats; f; f = f->next)
|
||||
{
|
||||
GdkPixbufFormat *fmt = f->data;
|
||||
char *name;
|
||||
|
||||
char *name;
|
||||
|
||||
name = gdk_pixbuf_format_get_name (fmt);
|
||||
if (g_str_equal (name, "png"))
|
||||
{
|
||||
formats = g_slist_delete_link (formats, f);
|
||||
formats = g_slist_prepend (formats, fmt);
|
||||
{
|
||||
formats = g_slist_delete_link (formats, f);
|
||||
formats = g_slist_prepend (formats, fmt);
|
||||
|
||||
g_free (name);
|
||||
break;
|
||||
}
|
||||
g_free (name);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
g_free (name);
|
||||
}
|
||||
}
|
||||
|
||||
for (f = formats; f; f = f->next)
|
||||
{
|
||||
GdkPixbufFormat *fmt = f->data;
|
||||
char **mimes, **m;
|
||||
char *name;
|
||||
|
||||
name = gdk_pixbuf_format_get_name (fmt);
|
||||
mimes = gdk_pixbuf_format_get_mime_types (fmt);
|
||||
for (m = mimes; *m; m++)
|
||||
{
|
||||
/* Turning pngs, jpegs and tiffs into textures is handled above */
|
||||
if (!g_str_equal (name, "png") &&
|
||||
!g_str_equal (name, "jpeg") &&
|
||||
!g_str_equal (name, "tiff"))
|
||||
gdk_content_register_deserializer (*m,
|
||||
GDK_TYPE_TEXTURE,
|
||||
pixbuf_deserializer,
|
||||
NULL,
|
||||
NULL);
|
||||
{
|
||||
gdk_content_register_deserializer (*m,
|
||||
GDK_TYPE_TEXTURE,
|
||||
pixbuf_deserializer,
|
||||
NULL,
|
||||
NULL);
|
||||
gdk_content_register_deserializer (*m,
|
||||
GDK_TYPE_PIXBUF,
|
||||
pixbuf_deserializer,
|
||||
NULL,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
g_strfreev (mimes);
|
||||
g_free (name);
|
||||
}
|
||||
|
||||
g_slist_free (formats);
|
||||
@@ -1008,13 +933,11 @@ init (void)
|
||||
if (!g_get_charset (&charset))
|
||||
{
|
||||
char *mime = g_strdup_printf ("text/plain;charset=%s", charset);
|
||||
|
||||
gdk_content_register_deserializer (mime,
|
||||
G_TYPE_STRING,
|
||||
string_deserializer,
|
||||
(gpointer) charset,
|
||||
g_free);
|
||||
g_free (mime);
|
||||
}
|
||||
gdk_content_register_deserializer ("text/plain",
|
||||
G_TYPE_STRING,
|
||||
|
@@ -808,13 +808,8 @@ gdk_content_formats_builder_add_mime_type (GdkContentFormatsBuilder *builder,
|
||||
builder->n_mime_types++;
|
||||
}
|
||||
|
||||
/* {{{ GdkFileList */
|
||||
|
||||
/* We're using GdkFileList* and GSList* interchangeably, counting on the
|
||||
* fact that we're just passing around gpointers; the only reason why we
|
||||
* have a GdkFileList opaque type is for language bindings, because they
|
||||
* can have no idea what a GSList of GFiles is.
|
||||
*/
|
||||
/* G_DEFINE_BOXED wants this */
|
||||
typedef gpointer GdkFileList;
|
||||
|
||||
static gpointer
|
||||
gdk_file_list_copy (gpointer list)
|
||||
@@ -829,23 +824,3 @@ gdk_file_list_free (gpointer list)
|
||||
}
|
||||
|
||||
G_DEFINE_BOXED_TYPE (GdkFileList, gdk_file_list, gdk_file_list_copy, gdk_file_list_free)
|
||||
|
||||
/**
|
||||
* gdk_file_list_get_files:
|
||||
* @file_list: the file list
|
||||
*
|
||||
* Retrieves the list of files inside a `GdkFileList`.
|
||||
*
|
||||
* This function is meant for language bindings.
|
||||
*
|
||||
* Returns: (transfer container) (element-type GFile): the files inside the list
|
||||
*
|
||||
* Since: 4.6
|
||||
*/
|
||||
GSList *
|
||||
gdk_file_list_get_files (GdkFileList *file_list)
|
||||
{
|
||||
return g_slist_copy ((GSList *) file_list);
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
@@ -109,19 +109,8 @@ void gdk_content_formats_builder_add_gtype (GdkContentForma
|
||||
/* dunno where else to put this */
|
||||
#define GDK_TYPE_FILE_LIST (gdk_file_list_get_type ())
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gdk_file_list_get_type (void) G_GNUC_CONST;
|
||||
GType gdk_file_list_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/**
|
||||
* GdkFileList:
|
||||
*
|
||||
* An opaque type representing a list of files.
|
||||
*
|
||||
* Since: 4.6
|
||||
*/
|
||||
typedef struct _GdkFileList GdkFileList;
|
||||
|
||||
GDK_AVAILABLE_IN_4_6
|
||||
GSList * gdk_file_list_get_files (GdkFileList *file_list);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@@ -26,10 +26,6 @@
|
||||
#include "filetransferportalprivate.h"
|
||||
#include "gdktextureprivate.h"
|
||||
#include "gdkrgba.h"
|
||||
#include "loaders/gdkpngprivate.h"
|
||||
#include "loaders/gdktiffprivate.h"
|
||||
#include "loaders/gdkjpegprivate.h"
|
||||
#include "gdkmemorytextureprivate.h"
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <string.h>
|
||||
@@ -610,7 +606,6 @@ gdk_content_serialize_finish (GAsyncResult *result,
|
||||
|
||||
/*** SERIALIZERS ***/
|
||||
|
||||
|
||||
static void
|
||||
pixbuf_serializer_finish (GObject *source,
|
||||
GAsyncResult *res,
|
||||
@@ -641,7 +636,11 @@ pixbuf_serializer (GdkContentSerializer *serializer)
|
||||
else if (G_VALUE_HOLDS (value, GDK_TYPE_TEXTURE))
|
||||
{
|
||||
GdkTexture *texture = g_value_get_object (value);
|
||||
pixbuf = gdk_pixbuf_get_from_texture (texture);
|
||||
cairo_surface_t *surface = gdk_texture_download_surface (texture);
|
||||
pixbuf = gdk_pixbuf_get_from_surface (surface,
|
||||
0, 0,
|
||||
gdk_texture_get_width (texture), gdk_texture_get_height (texture));
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -659,77 +658,6 @@ pixbuf_serializer (GdkContentSerializer *serializer)
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
|
||||
static void
|
||||
texture_serializer_finish (GObject *source,
|
||||
GAsyncResult *res,
|
||||
gpointer user_data)
|
||||
{
|
||||
GdkContentSerializer *serializer = GDK_CONTENT_SERIALIZER (source);
|
||||
GError *error = NULL;
|
||||
|
||||
if (!g_task_propagate_boolean (G_TASK (res), &error))
|
||||
gdk_content_serializer_return_error (serializer, error);
|
||||
else
|
||||
gdk_content_serializer_return_success (serializer);
|
||||
}
|
||||
|
||||
static void
|
||||
serialize_texture_in_thread (GTask *task,
|
||||
gpointer source_object,
|
||||
gpointer task_data,
|
||||
GCancellable *cancellable)
|
||||
{
|
||||
GdkContentSerializer *serializer = source_object;
|
||||
const GValue *value;
|
||||
GdkTexture *texture;
|
||||
GBytes *bytes = NULL;
|
||||
GError *error = NULL;
|
||||
gboolean result = FALSE;
|
||||
GInputStream *input;
|
||||
gssize spliced;
|
||||
|
||||
value = gdk_content_serializer_get_value (serializer);
|
||||
texture = g_value_get_object (value);
|
||||
|
||||
if (strcmp (gdk_content_serializer_get_mime_type (serializer), "image/png") == 0)
|
||||
bytes = gdk_save_png (texture);
|
||||
else if (strcmp (gdk_content_serializer_get_mime_type (serializer), "image/tiff") == 0)
|
||||
bytes = gdk_save_tiff (texture);
|
||||
else if (strcmp (gdk_content_serializer_get_mime_type (serializer), "image/jpeg") == 0)
|
||||
bytes = gdk_save_jpeg (texture);
|
||||
else
|
||||
g_assert_not_reached ();
|
||||
|
||||
input = g_memory_input_stream_new_from_bytes (bytes);
|
||||
spliced = g_output_stream_splice (gdk_content_serializer_get_output_stream (serializer),
|
||||
input,
|
||||
G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE,
|
||||
gdk_content_serializer_get_cancellable (serializer),
|
||||
&error);
|
||||
g_object_unref (input);
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
result = spliced != -1;
|
||||
|
||||
if (result)
|
||||
g_task_return_boolean (task, result);
|
||||
else
|
||||
g_task_return_error (task, error);
|
||||
}
|
||||
|
||||
static void
|
||||
texture_serializer (GdkContentSerializer *serializer)
|
||||
{
|
||||
GTask *task;
|
||||
|
||||
task = g_task_new (serializer,
|
||||
gdk_content_serializer_get_cancellable (serializer),
|
||||
texture_serializer_finish,
|
||||
NULL);
|
||||
g_task_run_in_thread (task, serialize_texture_in_thread);
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
static void
|
||||
string_serializer_finish (GObject *source,
|
||||
GAsyncResult *result,
|
||||
@@ -949,72 +877,51 @@ init (void)
|
||||
|
||||
initialized = TRUE;
|
||||
|
||||
gdk_content_register_serializer (GDK_TYPE_TEXTURE,
|
||||
"image/png",
|
||||
texture_serializer,
|
||||
NULL, NULL);
|
||||
|
||||
gdk_content_register_serializer (GDK_TYPE_TEXTURE,
|
||||
"image/tiff",
|
||||
texture_serializer,
|
||||
NULL, NULL);
|
||||
|
||||
gdk_content_register_serializer (GDK_TYPE_TEXTURE,
|
||||
"image/jpeg",
|
||||
texture_serializer,
|
||||
NULL, NULL);
|
||||
|
||||
formats = gdk_pixbuf_get_formats ();
|
||||
|
||||
/* Make sure png comes first */
|
||||
for (f = formats; f; f = f->next)
|
||||
{
|
||||
GdkPixbufFormat *fmt = f->data;
|
||||
char *name;
|
||||
|
||||
char *name;
|
||||
|
||||
name = gdk_pixbuf_format_get_name (fmt);
|
||||
if (g_str_equal (name, "png"))
|
||||
{
|
||||
formats = g_slist_delete_link (formats, f);
|
||||
formats = g_slist_prepend (formats, fmt);
|
||||
{
|
||||
formats = g_slist_delete_link (formats, f);
|
||||
formats = g_slist_prepend (formats, fmt);
|
||||
|
||||
g_free (name);
|
||||
break;
|
||||
}
|
||||
g_free (name);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
g_free (name);
|
||||
}
|
||||
}
|
||||
|
||||
for (f = formats; f; f = f->next)
|
||||
{
|
||||
GdkPixbufFormat *fmt = f->data;
|
||||
char **mimes, **m;
|
||||
char *name;
|
||||
|
||||
if (!gdk_pixbuf_format_is_writable (fmt))
|
||||
continue;
|
||||
continue;
|
||||
|
||||
name = gdk_pixbuf_format_get_name (fmt);
|
||||
mimes = gdk_pixbuf_format_get_mime_types (fmt);
|
||||
for (m = mimes; *m; m++)
|
||||
{
|
||||
/* Turning textures into pngs, tiffs or jpegs is handled above */
|
||||
if (!g_str_equal (name, "png") &&
|
||||
!g_str_equal (name, "tiff") &&
|
||||
!g_str_equal (name, "jpeg"))
|
||||
gdk_content_register_serializer (GDK_TYPE_TEXTURE,
|
||||
*m,
|
||||
pixbuf_serializer,
|
||||
gdk_pixbuf_format_get_name (fmt),
|
||||
g_free);
|
||||
{
|
||||
gdk_content_register_serializer (GDK_TYPE_TEXTURE,
|
||||
*m,
|
||||
pixbuf_serializer,
|
||||
gdk_pixbuf_format_get_name (fmt),
|
||||
g_free);
|
||||
gdk_content_register_serializer (GDK_TYPE_PIXBUF,
|
||||
*m,
|
||||
pixbuf_serializer,
|
||||
gdk_pixbuf_format_get_name (fmt),
|
||||
g_free);
|
||||
}
|
||||
}
|
||||
g_strfreev (mimes);
|
||||
g_free (name);
|
||||
}
|
||||
|
||||
g_slist_free (formats);
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#include "gdkcursorprivate.h"
|
||||
#include "gdktexture.h"
|
||||
#include "gdkintl.h"
|
||||
#include "gdkinternals.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <errno.h>
|
||||
|
@@ -18,12 +18,9 @@
|
||||
#ifndef __GDK_DEBUG_H__
|
||||
#define __GDK_DEBUG_H__
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include "gdktypes.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
typedef enum {
|
||||
GDK_DEBUG_MISC = 1 << 0,
|
||||
GDK_DEBUG_EVENTS = 1 << 1,
|
||||
@@ -50,7 +47,6 @@ typedef enum {
|
||||
GDK_DEBUG_VULKAN_DISABLE = 1 << 21,
|
||||
GDK_DEBUG_VULKAN_VALIDATE = 1 << 22,
|
||||
GDK_DEBUG_DEFAULT_SETTINGS= 1 << 23,
|
||||
GDK_DEBUG_HIGH_DEPTH = 1 << 24,
|
||||
} GdkDebugFlags;
|
||||
|
||||
extern guint _gdk_debug_flags;
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include "gdkdevicetool.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkintl.h"
|
||||
#include "gdkkeysprivate.h"
|
||||
|
||||
@@ -330,7 +331,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
|
||||
* GdkDevice::changed:
|
||||
* @device: the `GdkDevice`
|
||||
*
|
||||
* Emitted either when the number of either axes or keys changes.
|
||||
* Emitted either when the the number of either axes or keys changes.
|
||||
*
|
||||
* On X11 this will normally happen when the physical device
|
||||
* routing events through the logical device changes (for
|
||||
|
@@ -25,7 +25,6 @@
|
||||
#include <gdk/gdkversionmacros.h>
|
||||
#include <gdk/gdktypes.h>
|
||||
#include <gdk/gdkdevicetool.h>
|
||||
#include <gdk/gdkenums.h>
|
||||
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
@@ -20,7 +20,7 @@
|
||||
#include <math.h>
|
||||
|
||||
#include "gdkdevicetoolprivate.h"
|
||||
#include "gdkenumtypes.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkintl.h"
|
||||
|
||||
/**
|
||||
|
@@ -22,9 +22,8 @@
|
||||
#error "Only <gdk/gdk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gdk/gdkenums.h>
|
||||
#include <gdk/gdktypes.h>
|
||||
#include <gdk/gdkversionmacros.h>
|
||||
#include <gdk/gdktypes.h>
|
||||
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
487
gdk/gdkdisplay.c
487
gdk/gdkdisplay.c
@@ -27,20 +27,16 @@
|
||||
#include "gdkintl.h"
|
||||
#include "gdk-private.h"
|
||||
|
||||
#include "gdkapplaunchcontext.h"
|
||||
#include "gdkclipboardprivate.h"
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include "gdkdisplaymanagerprivate.h"
|
||||
#include "gdkframeclockidleprivate.h"
|
||||
#include "gdkeventsprivate.h"
|
||||
#include "gdkglcontextprivate.h"
|
||||
#include "gdkevents.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkmonitorprivate.h"
|
||||
#include "gdkframeclockidleprivate.h"
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
#include <epoxy/egl.h>
|
||||
#endif
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <glib.h>
|
||||
|
||||
/**
|
||||
* GdkDisplay:
|
||||
@@ -91,12 +87,6 @@ struct _GdkDisplayPrivate {
|
||||
GdkGLContext *gl_context;
|
||||
GError *gl_error;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
EGLDisplay egl_display;
|
||||
EGLConfig egl_config;
|
||||
EGLConfig egl_config_high_depth;
|
||||
#endif
|
||||
|
||||
guint rgba : 1;
|
||||
guint composited : 1;
|
||||
guint input_shapes : 1;
|
||||
@@ -156,26 +146,6 @@ gdk_display_default_init_gl (GdkDisplay *display,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static guint
|
||||
gdk_display_default_rate_egl_config (GdkDisplay *display,
|
||||
gpointer egl_display,
|
||||
gpointer config)
|
||||
{
|
||||
guint distance = 0;
|
||||
#ifdef HAVE_EGL
|
||||
int tmp;
|
||||
|
||||
if (!eglGetConfigAttrib (egl_display, config, EGL_SAMPLE_BUFFERS, &tmp) || tmp != 0)
|
||||
distance += 0x20000;
|
||||
|
||||
if (!eglGetConfigAttrib (egl_display, config, EGL_DEPTH_SIZE, &tmp) || tmp != 0 ||
|
||||
!eglGetConfigAttrib (egl_display, config, EGL_STENCIL_SIZE, &tmp) || tmp != 0)
|
||||
distance += 0x10000;
|
||||
#endif
|
||||
|
||||
return distance;
|
||||
}
|
||||
|
||||
static GdkSeat *
|
||||
gdk_display_real_get_default_seat (GdkDisplay *display)
|
||||
{
|
||||
@@ -203,7 +173,6 @@ gdk_display_class_init (GdkDisplayClass *class)
|
||||
class->make_default = gdk_display_real_make_default;
|
||||
class->get_app_launch_context = gdk_display_real_get_app_launch_context;
|
||||
class->init_gl = gdk_display_default_init_gl;
|
||||
class->rate_egl_config = gdk_display_default_rate_egl_config;
|
||||
class->get_default_seat = gdk_display_real_get_default_seat;
|
||||
class->opened = gdk_display_real_opened;
|
||||
|
||||
@@ -383,9 +352,6 @@ gdk_display_dispose (GObject *object)
|
||||
g_queue_clear (&display->queued_events);
|
||||
|
||||
g_clear_object (&priv->gl_context);
|
||||
#ifdef HAVE_EGL
|
||||
g_clear_pointer (&priv->egl_display, eglTerminate);
|
||||
#endif
|
||||
g_clear_error (&priv->gl_error);
|
||||
|
||||
G_OBJECT_CLASS (gdk_display_parent_class)->dispose (object);
|
||||
@@ -1267,8 +1233,6 @@ gdk_display_init_gl (GdkDisplay *self)
|
||||
*/
|
||||
priv->gl_context = context;
|
||||
|
||||
gdk_gl_backend_use (GDK_GL_CONTEXT_GET_CLASS (context)->backend_type);
|
||||
|
||||
gdk_profiler_end_mark (before, "initialize OpenGL", NULL);
|
||||
}
|
||||
|
||||
@@ -1325,38 +1289,6 @@ gdk_display_prepare_gl (GdkDisplay *self,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_display_create_gl_context:
|
||||
* @self: a `GdkDisplay`
|
||||
* @error: return location for an error
|
||||
*
|
||||
* Creates a new `GdkGLContext` for the `GdkDisplay`.
|
||||
*
|
||||
* The context is disconnected from any particular surface or surface
|
||||
* and cannot be used to draw to any surface. It can only be used to
|
||||
* draw to non-surface framebuffers like textures.
|
||||
*
|
||||
* If the creation of the `GdkGLContext` failed, @error will be set.
|
||||
* Before using the returned `GdkGLContext`, you will need to
|
||||
* call [method@Gdk.GLContext.make_current] or [method@Gdk.GLContext.realize].
|
||||
*
|
||||
* Returns: (transfer full): the newly created `GdkGLContext`
|
||||
*
|
||||
* Since: 4.6
|
||||
*/
|
||||
GdkGLContext *
|
||||
gdk_display_create_gl_context (GdkDisplay *self,
|
||||
GError **error)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (self), NULL);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||
|
||||
if (!gdk_display_prepare_gl (self, error))
|
||||
return NULL;
|
||||
|
||||
return gdk_gl_context_new (self, NULL);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_display_get_gl_context:
|
||||
* @self: the `GdkDisplay`
|
||||
@@ -1378,417 +1310,6 @@ gdk_display_get_gl_context (GdkDisplay *self)
|
||||
return priv->gl_context;
|
||||
}
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
static int
|
||||
strvcmp (gconstpointer p1,
|
||||
gconstpointer p2)
|
||||
{
|
||||
const char * const *s1 = p1;
|
||||
const char * const *s2 = p2;
|
||||
|
||||
return strcmp (*s1, *s2);
|
||||
}
|
||||
|
||||
static char *
|
||||
describe_extensions (EGLDisplay egl_display)
|
||||
{
|
||||
const char *extensions;
|
||||
char **exts;
|
||||
char *ext;
|
||||
|
||||
extensions = eglQueryString (egl_display, EGL_EXTENSIONS);
|
||||
|
||||
exts = g_strsplit (extensions, " ", -1);
|
||||
qsort (exts, g_strv_length (exts), sizeof (char *), strvcmp);
|
||||
|
||||
ext = g_strjoinv ("\n\t", exts);
|
||||
if (ext[0] == '\n')
|
||||
ext[0] = ' ';
|
||||
|
||||
g_strfreev (exts);
|
||||
|
||||
return g_strstrip (ext);
|
||||
}
|
||||
|
||||
static char *
|
||||
describe_egl_config (EGLDisplay egl_display,
|
||||
EGLConfig egl_config)
|
||||
{
|
||||
EGLint red, green, blue, alpha, type;
|
||||
|
||||
if (egl_config == NULL)
|
||||
return g_strdup ("-");
|
||||
|
||||
if (!eglGetConfigAttrib (egl_display, egl_config, EGL_RED_SIZE, &red) ||
|
||||
!eglGetConfigAttrib (egl_display, egl_config, EGL_GREEN_SIZE, &green) ||
|
||||
!eglGetConfigAttrib (egl_display, egl_config, EGL_BLUE_SIZE, &blue) ||
|
||||
!eglGetConfigAttrib (egl_display, egl_config, EGL_ALPHA_SIZE, &alpha))
|
||||
return g_strdup ("Unknown");
|
||||
|
||||
if (epoxy_has_egl_extension (egl_display, "EGL_EXT_pixel_format_float"))
|
||||
{
|
||||
if (!eglGetConfigAttrib (egl_display, egl_config, EGL_COLOR_COMPONENT_TYPE_EXT, &type))
|
||||
type = EGL_COLOR_COMPONENT_TYPE_FIXED_EXT;
|
||||
}
|
||||
else
|
||||
type = EGL_COLOR_COMPONENT_TYPE_FIXED_EXT;
|
||||
|
||||
return g_strdup_printf ("R%dG%dB%dA%d%s", red, green, blue, alpha, type == EGL_COLOR_COMPONENT_TYPE_FIXED_EXT ? "" : " float");
|
||||
}
|
||||
#endif
|
||||
|
||||
/*<private>
|
||||
* gdk_display_get_egl_display:
|
||||
* @self: a display
|
||||
*
|
||||
* Retrieves the EGL display connection object for the given GDK display.
|
||||
*
|
||||
* This function returns `NULL` if GL is not supported or GDK is using
|
||||
* a different OpenGL framework than EGL.
|
||||
*
|
||||
* Returns: (nullable): the EGL display object
|
||||
*/
|
||||
gpointer
|
||||
gdk_display_get_egl_display (GdkDisplay *self)
|
||||
{
|
||||
GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (self), NULL);
|
||||
|
||||
if (!priv->egl_display &&
|
||||
!gdk_display_prepare_gl (self, NULL))
|
||||
return NULL;
|
||||
|
||||
return priv->egl_display;
|
||||
}
|
||||
|
||||
gpointer
|
||||
gdk_display_get_egl_config (GdkDisplay *self)
|
||||
{
|
||||
GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
|
||||
|
||||
return priv->egl_config;
|
||||
}
|
||||
|
||||
gpointer
|
||||
gdk_display_get_egl_config_high_depth (GdkDisplay *self)
|
||||
{
|
||||
GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
|
||||
|
||||
return priv->egl_config_high_depth;
|
||||
}
|
||||
|
||||
static EGLDisplay
|
||||
gdk_display_create_egl_display (EGLenum platform,
|
||||
gpointer native_display)
|
||||
{
|
||||
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
|
||||
EGLDisplay egl_display = NULL;
|
||||
|
||||
if (epoxy_has_egl_extension (NULL, "EGL_KHR_platform_base"))
|
||||
{
|
||||
PFNEGLGETPLATFORMDISPLAYPROC getPlatformDisplay =
|
||||
(void *) eglGetProcAddress ("eglGetPlatformDisplay");
|
||||
|
||||
if (getPlatformDisplay != NULL)
|
||||
egl_display = getPlatformDisplay (platform, native_display, NULL);
|
||||
if (egl_display != NULL)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (epoxy_has_egl_extension (NULL, "EGL_EXT_platform_base"))
|
||||
{
|
||||
PFNEGLGETPLATFORMDISPLAYEXTPROC getPlatformDisplay =
|
||||
(void *) eglGetProcAddress ("eglGetPlatformDisplayEXT");
|
||||
|
||||
if (getPlatformDisplay != NULL)
|
||||
egl_display = getPlatformDisplay (platform, native_display, NULL);
|
||||
if (egl_display != NULL)
|
||||
goto out;
|
||||
}
|
||||
|
||||
egl_display = eglGetDisplay ((EGLNativeDisplayType) native_display);
|
||||
|
||||
out:
|
||||
gdk_profiler_end_mark (start_time, "Create EGL display", NULL);
|
||||
|
||||
return egl_display;
|
||||
}
|
||||
|
||||
#define MAX_EGL_ATTRS 30
|
||||
|
||||
typedef enum {
|
||||
GDK_EGL_CONFIG_PERFECT = (1 << 0),
|
||||
GDK_EGL_CONFIG_HDR = (1 << 1),
|
||||
} GdkEGLConfigCreateFlags;
|
||||
|
||||
static EGLConfig
|
||||
gdk_display_create_egl_config (GdkDisplay *self,
|
||||
GdkEGLConfigCreateFlags flags,
|
||||
GError **error)
|
||||
{
|
||||
GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
|
||||
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
|
||||
EGLint attrs[MAX_EGL_ATTRS];
|
||||
EGLConfig *configs;
|
||||
EGLint count, alloced;
|
||||
EGLConfig best_config;
|
||||
guint best_score;
|
||||
|
||||
int i = 0;
|
||||
|
||||
attrs[i++] = EGL_SURFACE_TYPE;
|
||||
attrs[i++] = EGL_WINDOW_BIT;
|
||||
|
||||
attrs[i++] = EGL_COLOR_BUFFER_TYPE;
|
||||
attrs[i++] = EGL_RGB_BUFFER;
|
||||
|
||||
attrs[i++] = EGL_RED_SIZE;
|
||||
attrs[i++] = (flags & GDK_EGL_CONFIG_HDR) ? 9 : 8;
|
||||
attrs[i++] = EGL_GREEN_SIZE;
|
||||
attrs[i++] = (flags & GDK_EGL_CONFIG_HDR) ? 9 : 8;
|
||||
attrs[i++] = EGL_BLUE_SIZE;
|
||||
attrs[i++] = (flags & GDK_EGL_CONFIG_HDR) ? 9 : 8;
|
||||
attrs[i++] = EGL_ALPHA_SIZE;
|
||||
attrs[i++] = 8;
|
||||
|
||||
if (flags & GDK_EGL_CONFIG_HDR &&
|
||||
self->have_egl_pixel_format_float)
|
||||
{
|
||||
attrs[i++] = EGL_COLOR_COMPONENT_TYPE_EXT;
|
||||
attrs[i++] = EGL_DONT_CARE;
|
||||
}
|
||||
|
||||
attrs[i++] = EGL_NONE;
|
||||
g_assert (i < MAX_EGL_ATTRS);
|
||||
|
||||
if (!eglChooseConfig (priv->egl_display, attrs, NULL, -1, &alloced) || alloced == 0)
|
||||
{
|
||||
g_set_error_literal (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("No EGL configuration available"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
configs = g_new (EGLConfig, alloced);
|
||||
if (!eglChooseConfig (priv->egl_display, attrs, configs, alloced, &count))
|
||||
{
|
||||
g_set_error_literal (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("Failed to get EGL configurations"));
|
||||
return NULL;
|
||||
}
|
||||
g_warn_if_fail (alloced == count);
|
||||
|
||||
best_score = G_MAXUINT;
|
||||
best_config = NULL;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
guint score = GDK_DISPLAY_GET_CLASS (self)->rate_egl_config (self, priv->egl_display, configs[i]);
|
||||
|
||||
if (score < best_score)
|
||||
{
|
||||
best_score = score;
|
||||
best_config = configs[i];
|
||||
}
|
||||
|
||||
if (score == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
g_free (configs);
|
||||
|
||||
gdk_profiler_end_mark (start_time, "Create EGL config", NULL);
|
||||
|
||||
if (best_score == G_MAXUINT)
|
||||
{
|
||||
g_set_error_literal (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("No EGL configuration with required features found"));
|
||||
return NULL;
|
||||
}
|
||||
else if ((flags & GDK_EGL_CONFIG_PERFECT) && best_score != 0)
|
||||
{
|
||||
g_set_error_literal (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("No perfect EGL configuration found"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return best_config;
|
||||
}
|
||||
|
||||
#undef MAX_EGL_ATTRS
|
||||
|
||||
static gboolean
|
||||
gdk_display_check_egl_extensions (EGLDisplay egl_display,
|
||||
const char **extensions,
|
||||
GError **error)
|
||||
{
|
||||
GString *missing = NULL;
|
||||
gsize i, n_missing;
|
||||
|
||||
n_missing = 0;
|
||||
|
||||
for (i = 0; extensions[i] != NULL; i++)
|
||||
{
|
||||
if (!epoxy_has_egl_extension (egl_display, extensions[i]))
|
||||
{
|
||||
if (missing == NULL)
|
||||
{
|
||||
missing = g_string_new (extensions[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_string_append (missing, ", ");
|
||||
g_string_append (missing, extensions[i]);
|
||||
}
|
||||
n_missing++;
|
||||
}
|
||||
}
|
||||
|
||||
if (n_missing)
|
||||
{
|
||||
g_set_error (error, GDK_GL_ERROR, GDK_GL_ERROR_UNSUPPORTED_PROFILE,
|
||||
/* translators: Arguments are the number of missing extensions
|
||||
* followed by a comma-separated list of their names */
|
||||
g_dngettext (GETTEXT_PACKAGE,
|
||||
"EGL implementation is missing extension %2$s",
|
||||
"EGL implementation is missing %d extensions: %s",
|
||||
n_missing),
|
||||
(int) n_missing, missing->str);
|
||||
|
||||
g_string_free (missing, TRUE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_display_init_egl (GdkDisplay *self,
|
||||
int platform,
|
||||
gpointer native_display,
|
||||
gboolean allow_any,
|
||||
GError **error)
|
||||
{
|
||||
GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
|
||||
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
|
||||
G_GNUC_UNUSED gint64 start_time2;
|
||||
int major, minor;
|
||||
|
||||
if (!gdk_gl_backend_can_be_used (GDK_GL_EGL, error))
|
||||
return FALSE;
|
||||
|
||||
if (!epoxy_has_egl ())
|
||||
{
|
||||
gboolean sandboxed = gdk_running_in_sandbox ();
|
||||
|
||||
g_set_error_literal (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
sandboxed ? _("libEGL not available in this sandbox")
|
||||
: _("libEGL not available"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
priv->egl_display = gdk_display_create_egl_display (platform, native_display);
|
||||
|
||||
if (priv->egl_display == NULL)
|
||||
{
|
||||
g_set_error_literal (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("Failed to create EGL display"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
start_time2 = GDK_PROFILER_CURRENT_TIME;
|
||||
if (!eglInitialize (priv->egl_display, &major, &minor))
|
||||
{
|
||||
priv->egl_display = NULL;
|
||||
g_set_error_literal (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("Could not initialize EGL display"));
|
||||
return FALSE;
|
||||
}
|
||||
gdk_profiler_end_mark (start_time2, "eglInitialize", NULL);
|
||||
|
||||
if (major < GDK_EGL_MIN_VERSION_MAJOR ||
|
||||
(major == GDK_EGL_MIN_VERSION_MAJOR && minor < GDK_EGL_MIN_VERSION_MINOR))
|
||||
{
|
||||
g_clear_pointer (&priv->egl_display, eglTerminate);
|
||||
g_set_error (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("EGL version %d.%d is too old. GTK requires %d.%d"),
|
||||
major, minor, GDK_EGL_MIN_VERSION_MAJOR, GDK_EGL_MIN_VERSION_MINOR);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!gdk_display_check_egl_extensions (priv->egl_display,
|
||||
(const char *[]) {
|
||||
"EGL_KHR_create_context",
|
||||
"EGL_KHR_surfaceless_context",
|
||||
NULL
|
||||
},
|
||||
error))
|
||||
{
|
||||
g_clear_pointer (&priv->egl_display, eglTerminate);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
priv->egl_config = gdk_display_create_egl_config (self,
|
||||
allow_any ? 0 : GDK_EGL_CONFIG_PERFECT,
|
||||
error);
|
||||
if (priv->egl_config == NULL)
|
||||
{
|
||||
g_clear_pointer (&priv->egl_display, eglTerminate);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
self->have_egl_buffer_age =
|
||||
epoxy_has_egl_extension (priv->egl_display, "EGL_EXT_buffer_age");
|
||||
self->have_egl_swap_buffers_with_damage =
|
||||
epoxy_has_egl_extension (priv->egl_display, "EGL_EXT_swap_buffers_with_damage");
|
||||
self->have_egl_no_config_context =
|
||||
epoxy_has_egl_extension (priv->egl_display, "EGL_KHR_no_config_context");
|
||||
self->have_egl_pixel_format_float =
|
||||
epoxy_has_egl_extension (priv->egl_display, "EGL_EXT_pixel_format_float");
|
||||
|
||||
if (self->have_egl_no_config_context)
|
||||
priv->egl_config_high_depth = gdk_display_create_egl_config (self,
|
||||
GDK_EGL_CONFIG_HDR,
|
||||
error);
|
||||
if (priv->egl_config_high_depth == NULL)
|
||||
priv->egl_config_high_depth = priv->egl_config;
|
||||
|
||||
GDK_DISPLAY_NOTE (self, OPENGL, {
|
||||
char *ext = describe_extensions (priv->egl_display);
|
||||
char *std_cfg = describe_egl_config (priv->egl_display, priv->egl_config);
|
||||
char *hd_cfg = describe_egl_config (priv->egl_display, priv->egl_config_high_depth);
|
||||
g_message ("EGL API version %d.%d found\n"
|
||||
" - Vendor: %s\n"
|
||||
" - Version: %s\n"
|
||||
" - Client APIs: %s\n"
|
||||
" - Extensions:\n"
|
||||
"\t%s\n"
|
||||
" - Selected fbconfig: %s\n"
|
||||
" high depth: %s",
|
||||
major, minor,
|
||||
eglQueryString (priv->egl_display, EGL_VENDOR),
|
||||
eglQueryString (priv->egl_display, EGL_VERSION),
|
||||
eglQueryString (priv->egl_display, EGL_CLIENT_APIS),
|
||||
ext, std_cfg,
|
||||
priv->egl_config_high_depth == priv->egl_config ? "none" : hd_cfg);
|
||||
g_free (hd_cfg);
|
||||
g_free (std_cfg);
|
||||
g_free (ext);
|
||||
});
|
||||
|
||||
gdk_profiler_end_mark (start_time, "init EGL", NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
GdkDebugFlags
|
||||
gdk_display_get_debug_flags (GdkDisplay *display)
|
||||
{
|
||||
|
@@ -71,9 +71,6 @@ gboolean gdk_display_supports_input_shapes (GdkDisplay *display);
|
||||
GDK_AVAILABLE_IN_4_4
|
||||
gboolean gdk_display_prepare_gl (GdkDisplay *self,
|
||||
GError **error);
|
||||
GDK_AVAILABLE_IN_4_6
|
||||
GdkGLContext *gdk_display_create_gl_context(GdkDisplay *self,
|
||||
GError **error);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDisplay *gdk_display_get_default (void);
|
||||
|
@@ -27,6 +27,7 @@
|
||||
#include "gdkconfig.h"
|
||||
#include "gdkdisplaymanagerprivate.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkkeysprivate.h"
|
||||
#include "gdkintl.h"
|
||||
|
||||
|
@@ -92,8 +92,6 @@ struct _GdkDisplay
|
||||
guint double_click_time; /* Maximum time between clicks in msecs */
|
||||
guint double_click_distance; /* Maximum distance between clicks in pixels */
|
||||
|
||||
GList *seats;
|
||||
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
VkInstance vk_instance;
|
||||
VkDebugReportCallbackEXT vk_debug_callback;
|
||||
@@ -105,11 +103,7 @@ struct _GdkDisplay
|
||||
guint vulkan_refcount;
|
||||
#endif /* GDK_RENDERING_VULKAN */
|
||||
|
||||
/* egl info */
|
||||
guint have_egl_buffer_age : 1;
|
||||
guint have_egl_swap_buffers_with_damage : 1;
|
||||
guint have_egl_no_config_context : 1;
|
||||
guint have_egl_pixel_format_float : 1;
|
||||
GList *seats;
|
||||
};
|
||||
|
||||
struct _GdkDisplayClass
|
||||
@@ -146,15 +140,10 @@ struct _GdkDisplayClass
|
||||
|
||||
GdkKeymap * (*get_keymap) (GdkDisplay *display);
|
||||
|
||||
GdkGLContext * (* init_gl) (GdkDisplay *display,
|
||||
GdkGLContext * (*init_gl) (GdkDisplay *display,
|
||||
GError **error);
|
||||
/* Returns the distance from a perfect score EGL config.
|
||||
* GDK chooses the one with the *LOWEST* score */
|
||||
guint (* rate_egl_config) (GdkDisplay *display,
|
||||
gpointer egl_display,
|
||||
gpointer egl_config);
|
||||
|
||||
GdkSeat * (*get_default_seat) (GdkDisplay *display);
|
||||
GdkSeat * (*get_default_seat) (GdkDisplay *display);
|
||||
|
||||
GListModel * (*get_monitors) (GdkDisplay *self);
|
||||
GdkMonitor * (*get_monitor_at_surface) (GdkDisplay *display,
|
||||
@@ -219,16 +208,6 @@ GdkSurface * gdk_display_create_surface (GdkDisplay *display
|
||||
|
||||
GdkGLContext * gdk_display_get_gl_context (GdkDisplay *display);
|
||||
|
||||
gboolean gdk_display_init_egl (GdkDisplay *display,
|
||||
int /*EGLenum*/ platform,
|
||||
gpointer native_display,
|
||||
gboolean allow_any,
|
||||
GError **error);
|
||||
gpointer gdk_display_get_egl_display (GdkDisplay *display);
|
||||
gpointer gdk_display_get_egl_config (GdkDisplay *display);
|
||||
gpointer gdk_display_get_egl_config_high_depth
|
||||
(GdkDisplay *display);
|
||||
|
||||
void gdk_display_set_rgba (GdkDisplay *display,
|
||||
gboolean rgba);
|
||||
void gdk_display_set_composited (GdkDisplay *display,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user