Compare commits

..

2 Commits

Author SHA1 Message Date
Alexander Mikhaylenko
41dcb14427 scrolledwindow: Support nested scrolling
While it's possible to scroll GtkScrolledWindow with touchscreen gestures,
currently it doesn't work for touchpad: GtkScrolledWindow never propagates
scroll events and if multiple scrolled windows are nested, only the inner
one will receive any events.

Since e9fe270e94, GtkScrolledWindow handles
only full scroll sequences, but still accepts any scroll sequence, causing
issues with nested scrolling.

Take another step and keep track of the sequence state, checking the
direction when a smooth scroll starts and only claiming the sequence if
the scrolled window can scroll in the direction of the current scrolling,
and otherwise denying it and ignoring any further events until it ends.

The check must be done on the bubble phase because if there are nested
scrolled windows that can scroll in the same direction, we want to pick
the inner one and not the outer one. The check also has to be done in the
scroll signal handler, since we don't have scroll deltas available in
scroll-begin. After we determine the direction and claim the sequence, we
can switch to the capture phase and proceed with scrolling as usual.

This also means that there are 3 states of the sequence state: a sequence
can be claimed, denied, or during the first invocation of the scroll signal
handler it's undecided. This neatly maps to GtkEventSequenceState, so we
can reuse it.
2020-12-15 21:21:49 +05:00
Alexander Mikhaylenko
29c49e085d tests: Add a nested scrolling test 2020-12-14 18:53:00 +05:00
866 changed files with 86040 additions and 118572 deletions

View File

@@ -24,7 +24,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:v28"
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v25"
FLATPAK_IMAGE: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master"
DOCS_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora-docs:v25"
@@ -43,7 +43,6 @@ style-check-diff:
- .gitlab-ci/run-style-check-diff.sh
.build-fedora-default:
extends: .only-default
image: $FEDORA_IMAGE
artifacts:
when: always
@@ -122,7 +121,6 @@ installed-tests:
.mingw-defaults:
extends: .only-default
stage: build
tags:
- win32-ps
@@ -146,32 +144,6 @@ msys2-mingw64:
MSYSTEM: "MINGW64"
CHERE_INVOKING: "yes"
macos:
extends: .only-default
only:
- branches@GNOME/gtk
stage: build
tags:
- macos
needs: []
before_script:
- bash .gitlab-ci/show-execution-environment.sh
- pip3 install --user meson==0.56
- pip3 install --user ninja
- export PATH=/Users/gitlabrunner/Library/Python/3.7/bin:$PATH
- export MESON_FORCE_BACKTRACE=1
script:
- meson -Dx11-backend=false
-Dintrospection=disabled
-Dcpp_std=c++11
-Dpixman:tests=disabled
_build
- ninja -C _build
artifacts:
when: always
paths:
- "${CI_PROJECT_DIR}/_build/meson-logs"
.flatpak-defaults:
image: $FLATPAK_IMAGE
stage: flatpak

View File

@@ -1,4 +1,4 @@
FROM fedora:33
FROM fedora:31
RUN dnf -y install \
adwaita-icon-theme \
@@ -65,8 +65,7 @@ RUN dnf -y install \
libxslt \
mesa-dri-drivers \
mesa-libEGL-devel \
mesa-libGLES-devel \
meson \
mesa-libwayland-egl-devel \
ninja-build \
pango-devel \
pcre-devel \
@@ -87,3 +86,6 @@ RUN dnf -y install \
which \
xorg-x11-server-Xvfb \
&& dnf clean all
RUN pip3 install meson==0.55.3

View File

@@ -1,4 +1,4 @@
FROM registry.gitlab.gnome.org/gnome/gtk/fedora-base:v28
FROM registry.gitlab.gnome.org/gnome/gtk/fedora-base:v25
# Enable sudo for wheel users
RUN sed -i -e 's/# %wheel/%wheel/' -e '0,/%wheel/{s/%wheel/# %wheel/}' /etc/sudoers

View File

@@ -8,8 +8,7 @@ builddir=$1
backend=$2
# Ignore memory leaks lower in dependencies
export LSAN_OPTIONS=suppressions=$srcdir/lsan.supp:print_suppressions=0
export G_SLICE=always-malloc
export LSAN_OPTIONS=suppressions=$srcdir/lsan.supp
case "${backend}" in
x11)

View File

@@ -1,8 +0,0 @@
#!/bin/bash
set -eux -o pipefail
xcodebuild -version || :
xcodebuild -showsdks || :
system_profiler SPSoftwareDataType || :

View File

@@ -1,13 +1,4 @@
<!--
Please, read the CONTRIBUTING.md guide on how to file a new issue.
https://gitlab.gnome.org/GNOME/gtk/-/blob/master/CONTRIBUTING.md
-->
## Steps to reproduce
<!--
Please, explain the sequence of actions necessary to reproduce the
bug
-->
1. ...
2. ...
@@ -41,8 +32,5 @@
## Additional information
<!--
- Screenshots or screen recordings are useful for visual errors
- Attaching a screenshot or a video without explaining the current
behavior and the actions necessary to reproduce the bug will lead
to the bug being closed
- Please report any warning or message printed on the terminal
-->

View File

@@ -1,14 +1,4 @@
<!--
Please, read the CONTRIBUTING.md guide on how to file a new issue.
https://gitlab.gnome.org/GNOME/gtk/-/blob/master/CONTRIBUTING.md
-->
## Steps to reproduce
<!--
Please, explain the sequence of actions necessary to reproduce the
crash
-->
1. ...
2. ...

9291
NEWS

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -17,7 +17,7 @@ license fees or royalties.
The official download location
- https://download.gnome.org/sources/gtk/
- https://download.gnome.org/sources/gtk+
The official web site
@@ -49,11 +49,11 @@ In order to build GTK you will need:
You will also need various dependencies, based on the platform you are
building for:
- [GLib](https://download.gnome.org/sources/glib/)
- [GdkPixbuf](https://download.gnome.org/sources/gdk-pixbuf/)
- [GObject-Introspection](https://download.gnome.org/sources/gobject-introspection/)
- [Cairo](https://www.cairographics.org/)
- [Pango](https://download.gnome.org/sources/pango/)
- [GLib](https://download.gnome.org/sources/glib)
- [GdkPixbuf](https://download.gnome.org/sources/gdk-pixbuf)
- [GObject-Introspection](https://download.gnome.org/sources/gobject-introspection)
- [Cairo](https://www.cairographics.org)
- [Pango](https://download.gnome.org/sources/pango)
- [Epoxy](https://github.com/anholt/libepoxy)
- [Graphene](https://github.com/ebassi/graphene)
- [Xkb-common](https://github.com/xkbcommon/libxkbcommon)

View File

@@ -63,6 +63,36 @@
}
]
},
{
"name" : "libsass",
"buildsystem" : "meson",
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib"
],
"sources" : [
{
"type" : "git",
"url" : "https://github.com/lazka/libsass.git",
"branch" : "meson"
}
]
},
{
"name" : "sassc",
"buildsystem" : "meson",
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib"
],
"sources" : [
{
"type" : "git",
"url" : "https://github.com/lazka/sassc.git",
"branch" : "meson"
}
]
},
{
"name" : "gtk",
"buildsystem" : "meson",
@@ -70,9 +100,7 @@
"config-opts" : [
"--libdir=/app/lib",
"-Denable_vulkan=no",
"-Dsassc=disabled",
"-Dbuildtype=debugoptimized",
"-Dprofile=devel"
"-Dbuildtype=debugoptimized"
],
"sources" : [
{

View File

@@ -63,6 +63,36 @@
}
]
},
{
"name" : "libsass",
"buildsystem" : "meson",
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib"
],
"sources" : [
{
"type" : "git",
"url" : "https://github.com/lazka/libsass.git",
"branch" : "meson"
}
]
},
{
"name" : "sassc",
"buildsystem" : "meson",
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib"
],
"sources" : [
{
"type" : "git",
"url" : "https://github.com/lazka/sassc.git",
"branch" : "meson"
}
]
},
{
"name" : "gtk",
"buildsystem" : "meson",
@@ -70,9 +100,7 @@
"config-opts" : [
"--libdir=/app/lib",
"-Denable_vulkan=no",
"-Dsassc=disabled",
"-Dbuildtype=debugoptimized",
"-Dprofile=devel"
"-Dbuildtype=debugoptimized"
],
"sources" : [
{

View File

@@ -63,6 +63,36 @@
}
]
},
{
"name" : "libsass",
"buildsystem" : "meson",
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib"
],
"sources" : [
{
"type" : "git",
"url" : "https://github.com/lazka/libsass.git",
"branch" : "meson"
}
]
},
{
"name" : "sassc",
"buildsystem" : "meson",
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib"
],
"sources" : [
{
"type" : "git",
"url" : "https://github.com/lazka/sassc.git",
"branch" : "meson"
}
]
},
{
"name" : "gtk",
"buildsystem" : "meson",
@@ -70,9 +100,7 @@
"config-opts" : [
"--libdir=/app/lib",
"-Denable_vulkan=no",
"-Dsassc=disabled",
"-Dbuildtype=debugoptimized",
"-Dprofile=devel"
"-Dbuildtype=debugoptimized"
],
"sources" : [
{

View File

@@ -1,19 +0,0 @@
#!/usr/bin/env python3
import os
from pathlib import PurePath
import subprocess
stylesheets = [ 'gtk/theme/Adwaita/Adwaita.css',
'gtk/theme/Adwaita/Adwaita-dark.css',
'gtk/theme/HighContrast/HighContrast.css',
'gtk/theme/HighContrast/HighContrast-dark.css' ]
sourceroot = os.environ.get('MESON_SOURCE_ROOT')
distroot = os.environ.get('MESON_DIST_ROOT')
for stylesheet in stylesheets:
stylesheet_path = PurePath(stylesheet)
src = PurePath(sourceroot, stylesheet_path.with_suffix('.scss'))
dst = PurePath(distroot, stylesheet_path)
subprocess.call(['sassc', '-a', '-M', '-t', 'compact', src, dst])

View File

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

View File

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

View File

@@ -98,9 +98,6 @@ create_page1 (GtkWidget *assistant)
gtk_box_append (GTK_BOX (box), label);
entry = gtk_entry_new ();
gtk_accessible_update_relation (GTK_ACCESSIBLE (entry),
GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL,
-1);
gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
gtk_widget_set_valign (entry, GTK_ALIGN_CENTER);
gtk_box_append (GTK_BOX (box), entry);

View File

@@ -20,7 +20,7 @@ mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec2 uv)
float b = 1.0/distance (pos, p2);
float sum = r + g + b;
float alpha = 1.0 - pow (1.0/(sum), 40.0)*pow (10.0, 40.0*0.7);
float alpha = 1.0 - pow (1.0/(sum), 40)*pow (10.0, 40*0.7);
fragColor = vec4 (r*0.5, g*0.5, b*0.5, 1.0) * alpha;
}

View File

@@ -177,7 +177,7 @@ float ccell2(vec2 p, float r) {
float df(vec2 p, float scale, inout vec2 nn) {
p /= scale;
nn = hextile(p);
nn = floor(nn + 0.5);
nn = round(nn);
float r = hash(nn);
float d;;

View File

@@ -179,7 +179,7 @@ float ccell2(vec2 p, float r) {
float df(vec2 p, float scale, inout vec2 nn) {
p /= scale;
nn = hextile(p);
nn = floor(nn + 0.5);
nn = round(nn);
float r = hash(nn);
float d;;

View File

@@ -119,12 +119,13 @@ create_label (void)
static GtkWidget *
create_video (void)
{
GtkWidget *w = gtk_video_new ();
GtkMediaStream *stream = gtk_media_file_new_for_resource ("/images/gtk-logo.webm");
GtkWidget *w = gtk_picture_new_for_paintable (GDK_PAINTABLE (stream));
gtk_widget_set_size_request (w, 64, 64);
gtk_video_set_loop (GTK_VIDEO (w), TRUE);
gtk_video_set_autoplay (GTK_VIDEO (w), TRUE);
gtk_video_set_resource (GTK_VIDEO (w), "/images/gtk-logo.webm");
gtk_media_stream_set_loop (stream, TRUE);
gtk_media_stream_play (stream);
g_object_unref (stream);
return w;
}

View File

@@ -787,8 +787,6 @@ gtk_gears_realize (GtkWidget *widget)
glLinkProgram(program);
glGetProgramInfoLog(program, sizeof msg, NULL, msg);
g_debug ("program info: %s\n", msg);
glDetachShader (program, v);
glDetachShader (program, f);
glDeleteShader (v);
glDeleteShader (f);

View File

@@ -39,7 +39,7 @@ create_application_list (void)
}
/* This is the function we use for setting up new listitems to display.
* We add just an #GtkImage and a #GtkLabel here to display the application's
* We add just an #GtkImage and a #GtkKabel here to display the application's
* icon and name, as this is just a simple demo.
*/
static void

View File

@@ -25,8 +25,6 @@
#include "demos.h"
#include "fontify.h"
#include "demo_conf.h"
static GtkWidget *info_view;
static GtkWidget *source_view;
@@ -198,20 +196,16 @@ activate_about (GSimpleAction *action,
gtk_get_micro_version ());
g_string_append_printf (s, "\nA link can appear here: <http://www.gtk.org>");
version = g_strdup_printf ("%s%s%s\nRunning against GTK %d.%d.%d",
version = g_strdup_printf ("%s\nRunning against GTK %d.%d.%d",
PACKAGE_VERSION,
g_strcmp0 (PROFILE, "devel") == 0 ? "-" : "",
g_strcmp0 (PROFILE, "devel") == 0 ? VCS_TAG : "",
gtk_get_major_version (),
gtk_get_minor_version (),
gtk_get_micro_version ());
gtk_show_about_dialog (GTK_WINDOW (gtk_application_get_active_window (app)),
"program-name", g_strcmp0 (PROFILE, "devel") == 0
? "GTK Demo (Development)"
: "GTK Demo",
"program-name", "GTK Demo",
"version", version,
"copyright", "©1997—2021 The GTK Team",
"copyright", "©1997—2020 The GTK Team",
"license-type", GTK_LICENSE_LGPL_2_1,
"website", "http://www.gtk.org",
"comments", "Program to demonstrate GTK widgets",
@@ -907,9 +901,6 @@ activate (GApplication *app)
window = (GtkWidget *)gtk_builder_get_object (builder, "window");
gtk_application_add_window (GTK_APPLICATION (app), GTK_WINDOW (window));
if (g_strcmp0 (PROFILE, "devel") == 0)
gtk_widget_add_css_class (window, "devel");
action = g_simple_action_new ("run", NULL);
g_signal_connect (action, "activate", G_CALLBACK (activate_run), window);
g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (action));
@@ -1052,10 +1043,10 @@ out:
static void
print_version (void)
{
g_print ("gtk4-demo %s%s%s\n",
PACKAGE_VERSION,
g_strcmp0 (PROFILE, "devel") == 0 ? "-" : "",
g_strcmp0 (PROFILE, "devel") == 0 ? VCS_TAG : "");
g_print ("gtk4-demo %d.%d.%d\n",
gtk_get_major_version (),
gtk_get_minor_version (),
gtk_get_micro_version ());
}
static int

View File

@@ -53,30 +53,31 @@
<child>
<object class="GtkBox">
<child>
<object class="GtkBox">
<property name="width-request">220</property>
<property name="orientation">vertical</property>
<object class="GtkScrolledWindow">
<style>
<class name="sidebar"/>
</style>
<property name="width-request">120</property>
<property name="hscrollbar-policy">never</property>
<property name="min-content-width">150</property>
<child>
<object class="GtkSearchBar" id="searchbar">
<property name="key-capture-widget">window</property>
<object class="GtkBox">
<property name="width-request">220</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkSearchEntry" id="search-entry">
<accessibility>
<relation name="controls">listview</relation>
</accessibility>
<object class="GtkSearchBar" id="searchbar">
<property name="key-capture-widget">window</property>
<child>
<object class="GtkSearchEntry" id="search-entry">
<accessibility>
<relation name="controls">listview</relation>
</accessibility>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkScrolledWindow">
<style>
<class name="sidebar"/>
</style>
<property name="width-request">120</property>
<property name="hscrollbar-policy">never</property>
<property name="min-content-width">150</property>
<property name="vexpand">1</property>
<child>
<object class="GtkListView" id="listview">
<style>
@@ -93,6 +94,7 @@
</accessibility>
</object>
</child>
</object>
</child>
</object>

View File

@@ -100,33 +100,31 @@ demos = files([
gtkdemo_deps = [ libgtk_dep, ]
extra_demo_sources = files([
'main.c',
'fontify.c',
'gtkfishbowl.c',
'fontplane.c',
'gtkgears.c',
'gtkshaderbin.c',
'gtkshadertoy.c',
'gtkshaderstack.c',
'gskshaderpaintable.c',
'puzzlepiece.c',
'bluroverlay.c',
'demoimage.c',
'demotaggedentry.c',
'demochild.c',
'demolayout.c',
'demowidget.c',
'demo2layout.c',
'singular_value_decomposition.c',
'four_point_transform.c',
'demo2widget.c',
'demo3widget.c',
'pixbufpaintable.c',
'script-names.c',
'unicode-names.c',
'suggestionentry.c',
])
extra_demo_sources = files(['main.c',
'fontify.c',
'gtkfishbowl.c',
'fontplane.c',
'gtkgears.c',
'gtkshaderbin.c',
'gtkshadertoy.c',
'gtkshaderstack.c',
'gskshaderpaintable.c',
'puzzlepiece.c',
'bluroverlay.c',
'demoimage.c',
'demotaggedentry.c',
'demochild.c',
'demolayout.c',
'demowidget.c',
'demo2layout.c',
'singular_value_decomposition.c',
'four_point_transform.c',
'demo2widget.c',
'demo3widget.c',
'pixbufpaintable.c',
'script-names.c',
'unicode-names.c',
'suggestionentry.c'])
if harfbuzz_dep.found() and pangoft_dep.found()
demos += files(['font_features.c'])
@@ -149,17 +147,14 @@ endif
gtkdemo_args = [ '-DGDK_DISABLE_DEPRECATED', '-DGTK_DISABLE_DEPRECATED', ]
demos_h = custom_target('gtk4 demo header',
output: 'demos.h',
input: demos,
command: [ find_program('geninclude.py'), '@OUTPUT@', '@INPUT@' ],
)
output: 'demos.h',
input: demos,
command: [ find_program('geninclude.py'), '@OUTPUT@', '@INPUT@' ])
gtkdemo_resources = gnome.compile_resources('gtkdemo_resources',
'demo.gresource.xml',
source_dir: '.',
)
'demo.gresource.xml',
source_dir: '.')
# Use a subset of compiler flags
demo_cflags = []
foreach flag: common_cflags
if flag not in ['-Werror=missing-prototypes', '-Werror=missing-declarations', '-fvisibility=hidden']
@@ -167,33 +162,31 @@ foreach flag: common_cflags
endif
endforeach
gtkdemo_deps += [ demo_conf_h ]
executable('gtk4-demo',
sources: [demos, demos_h, extra_demo_sources, gtkdemo_resources],
c_args: gtkdemo_args + demo_cflags,
dependencies: gtkdemo_deps,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true,
)
demos, demos_h, extra_demo_sources, gtkdemo_resources,
c_args: gtkdemo_args + demo_cflags,
dependencies: gtkdemo_deps,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true)
executable('gtk4-demo-application',
sources: ['application.c', gtkdemo_resources],
c_args: gtkdemo_args + common_cflags,
dependencies: gtkdemo_deps,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true,
)
'application.c', gtkdemo_resources,
c_args: gtkdemo_args + common_cflags,
dependencies: gtkdemo_deps,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true)
# icons
icontheme_dir = join_paths(gtk_datadir, 'icons/hicolor')
foreach size: ['scalable', 'symbolic']
install_subdir('data/' + size, install_dir: icontheme_dir)
install_subdir('data/' + size,
install_dir: icontheme_dir
)
endforeach
# desktop file

View File

@@ -31,7 +31,7 @@ void mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec
float propagation_length = time * wave_speed;
float t = (propagation_length - distance_from_center) / wave_length;
float offset_magnitude = 0.0;
float offset_magnitude = 0;
if (t > 0.0)
offset_magnitude = decay(wave_height * sin(t * 2.0 * PI), t);

View File

@@ -4,8 +4,6 @@
#include "iconbrowserapp.h"
#include "iconbrowserwin.h"
#include "demo_conf.h"
struct _IconBrowserApp
{
GtkApplication parent;
@@ -77,25 +75,21 @@ about_activated (GSimpleAction *action,
gtk_get_minor_version (),
gtk_get_micro_version ());
g_string_append_printf (s, "\nIcon theme\n\t%s", icon_theme);
version = g_strdup_printf ("%s%s%s\nRunning against GTK %d.%d.%d",
version = g_strdup_printf ("%s\nRunning against GTK %d.%d.%d",
PACKAGE_VERSION,
g_strcmp0 (PROFILE, "devel") == 0 ? "-" : "",
g_strcmp0 (PROFILE, "devel") == 0 ? VCS_TAG : "",
gtk_get_major_version (),
gtk_get_minor_version (),
gtk_get_micro_version ());
gtk_show_about_dialog (GTK_WINDOW (gtk_application_get_active_window (app)),
"program-name", g_strcmp0 (PROFILE, "devel") == 0
? "GTK Icon Browser (Development)"
: "GTK Icon Browser",
"program-name", "GTK Icon Browser",
"version", version,
"copyright", "©1997—2021 The GTK Team",
"copyright", "©1997—2020 The GTK Team",
"license-type", GTK_LICENSE_LGPL_2_1,
"website", "http://www.gtk.org",
"comments", "Program to browse themed icons",
"authors", authors,
"logo-icon-name", "org.gtk.IconBrowser4",
"logo-icon-name", "org.gtk.Demo4",
"title", "About GTK Icon Browser",
"system-information", s->str,
NULL);
@@ -135,10 +129,6 @@ icon_browser_app_activate (GApplication *app)
IconBrowserWindow *win;
win = icon_browser_window_new (ICON_BROWSER_APP (app));
if (g_strcmp0 (PROFILE, "devel") == 0)
gtk_widget_add_css_class (GTK_WIDGET (win), "devel");
gtk_window_present (GTK_WINDOW (win));
}

View File

@@ -279,31 +279,11 @@ drag_prepare_texture (GtkDragSource *source,
GtkWidget *widget)
{
GdkPaintable *paintable = get_image_paintable (GTK_IMAGE (widget));
GtkSnapshot *snapshot;
double width, height;
GskRenderNode *node;
GskRenderer *renderer;
GdkTexture *texture;
GdkContentProvider *ret;
if (!GDK_IS_PAINTABLE (paintable))
return NULL;
snapshot = gtk_snapshot_new ();
width = gdk_paintable_get_intrinsic_width (paintable);
height = gdk_paintable_get_intrinsic_height (paintable);
gdk_paintable_snapshot (paintable, snapshot, width, height);
node = gtk_snapshot_free_to_node (snapshot);
renderer = gtk_native_get_renderer (gtk_widget_get_native (widget));
texture = gsk_renderer_render_texture (renderer, node, &GRAPHENE_RECT_INIT (0, 0, width, height));
ret = gdk_content_provider_new_typed (GDK_TYPE_TEXTURE, texture);
g_object_unref (texture);
gsk_render_node_unref (node);
return ret;
return gdk_content_provider_new_typed (GDK_TYPE_PAINTABLE, paintable);
}
static GdkContentProvider *

View File

@@ -7,25 +7,25 @@ iconbrowser_sources = [
]
iconbrowser_resources = gnome.compile_resources('iconbrowser_resources',
'iconbrowser.gresource.xml',
source_dir: '.',
)
'iconbrowser.gresource.xml',
source_dir: '.')
executable('gtk4-icon-browser',
sources: [iconbrowser_sources, iconbrowser_resources],
c_args: common_cflags,
dependencies: [ libgtk_dep, demo_conf_h ],
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true,
)
iconbrowser_sources, iconbrowser_resources,
c_args: common_cflags,
dependencies: libgtk_dep,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true)
# icons
icontheme_dir = join_paths(gtk_datadir, 'icons/hicolor')
foreach size: ['scalable', 'symbolic']
install_subdir('data/' + size, install_dir: icontheme_dir)
install_subdir('data/' + size,
install_dir: icontheme_dir
)
endforeach
# desktop file

View File

@@ -1,19 +1,3 @@
demo_conf = configuration_data()
demo_conf.set_quoted('PROFILE', get_option('profile'))
demo_conf.set_quoted('VCS_TAG', '@VCS_TAG@')
demo_conf_h = declare_dependency(
sources: vcs_tag(
command: [ 'git', 'rev-parse', '--short', 'HEAD' ],
fallback: get_option('profile') != 'default' ? 'devel' : '',
input: configure_file(
output: 'demo_conf.h.in',
configuration: demo_conf
),
output: 'demo_conf.h'
)
)
subdir('constraint-editor')
subdir('gtk-demo')
subdir('icon-browser')

View File

@@ -13,7 +13,6 @@
<property name="right-margin">20</property>
<property name="top-margin">20</property>
<property name="bottom-margin">20</property>
<property name="monospace">1</property>
<property name="buffer">
<object class="GtkTextBuffer" id="buffer"/>
</property>

View File

@@ -6,25 +6,25 @@ node_editor_sources = [
]
node_editor_resources = gnome.compile_resources('node_editor_resources',
'node-editor.gresource.xml',
source_dir: '.',
)
'node-editor.gresource.xml',
source_dir: '.')
executable('gtk4-node-editor',
sources: [node_editor_sources, node_editor_resources],
dependencies: [ libgtk_dep, demo_conf_h ],
include_directories: confinc,
c_args: [
'-DNODE_EDITOR_SOURCE_DIR="@0@/../../testsuite/gsk/compare/"'.format(meson.current_source_dir())
] + common_cflags,
gui_app: true,
link_args: extra_demo_ldflags,
install: false,
)
node_editor_sources, node_editor_resources,
dependencies: libgtk_dep,
include_directories: confinc,
c_args: [
'-DNODE_EDITOR_SOURCE_DIR="@0@/../../testsuite/gsk/compare/"'.format(meson.current_source_dir())
] + common_cflags,
gui_app: true,
link_args: extra_demo_ldflags,
install: false)
# icons, don't install them until we decide to install gtk4-node-editor
#icontheme_dir = join_paths(gtk_datadir, 'icons/hicolor')
#foreach size: ['scalable', 'symbolic']
# install_subdir('data/' + size, install_dir: icontheme_dir)
# install_subdir('data/' + size,
# install_dir: icontheme_dir
# )
#endforeach

View File

@@ -23,8 +23,6 @@
#include "node-editor-window.h"
#include "demo_conf.h"
static const char *css =
"textview.editor {"
" color: rgb(192, 197, 206);"
@@ -96,26 +94,22 @@ activate_about (GSimpleAction *action,
g_string_append_printf (s, "\nRenderer\n\t%s", renderer);
version = g_strdup_printf ("%s%s%s\nRunning against GTK %d.%d.%d",
version = g_strdup_printf ("%s\nRunning against GTK %d.%d.%d",
PACKAGE_VERSION,
g_strcmp0 (PROFILE, "devel") == 0 ? "-" : "",
g_strcmp0 (PROFILE, "devel") == 0 ? VCS_TAG : "",
gtk_get_major_version (),
gtk_get_minor_version (),
gtk_get_micro_version ());
dialog = g_object_new (GTK_TYPE_ABOUT_DIALOG,
"transient-for", gtk_application_get_active_window (app),
"program-name", g_strcmp0 (PROFILE, "devel") == 0
? "GTK Node Editor (Development)"
: "GTK Node Editor",
"program-name", "GTK Node Editor",
"version", version,
"copyright", "©2019—2021 The GTK Team",
"copyright", "©2019—2020 The GTK Team",
"license-type", GTK_LICENSE_LGPL_2_1,
"website", "http://www.gtk.org",
"comments", "Program to test GTK rendering",
"authors", (const char *[]){ "Benjamin Otte", "Timm Bäder", NULL},
"logo-icon-name", "org.gtk.gtk4.NodeEditor",
"logo-icon-name", "org.gtk.gtk4.NodeEditor.Devel",
"title", "About GTK Node Editor",
"system-information", s->str,
NULL);
@@ -213,10 +207,6 @@ node_editor_application_activate (GApplication *app)
NodeEditorWindow *win;
win = node_editor_window_new (NODE_EDITOR_APPLICATION (app));
if (g_strcmp0 (PROFILE, "devel") == 0)
gtk_widget_add_css_class (GTK_WIDGET (win), "devel");
gtk_window_present (GTK_WINDOW (win));
}

View File

@@ -25,7 +25,6 @@
#include "gsk/gskrendernodeparserprivate.h"
#include "gsk/gl/gskglrenderer.h"
#include "gsk/ngl/gsknglrenderer.h"
#ifdef GDK_WINDOWING_BROADWAY
#include "gsk/broadway/gskbroadwayrenderer.h"
#endif
@@ -701,16 +700,6 @@ out:
g_free (source_dir);
}
static void
dark_mode_cb (GtkToggleButton *button,
GParamSpec *pspec,
NodeEditorWindow *self)
{
g_object_set (gtk_widget_get_settings (GTK_WIDGET (self)),
"gtk-application-prefer-dark-theme", gtk_toggle_button_get_active (button),
NULL);
}
static void
node_editor_window_finalize (GObject *object)
{
@@ -763,9 +752,6 @@ node_editor_window_realize (GtkWidget *widget)
node_editor_window_add_renderer (self,
gsk_gl_renderer_new (),
"OpenGL");
node_editor_window_add_renderer (self,
gsk_ngl_renderer_new (),
"NGL");
#ifdef GDK_RENDERING_VULKAN
node_editor_window_add_renderer (self,
gsk_vulkan_renderer_new (),
@@ -828,7 +814,6 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
gtk_widget_class_bind_template_callback (widget_class, export_image_cb);
gtk_widget_class_bind_template_callback (widget_class, testcase_save_clicked_cb);
gtk_widget_class_bind_template_callback (widget_class, testcase_name_entry_changed_cb);
gtk_widget_class_bind_template_callback (widget_class, dark_mode_cb);
}
static GtkWidget *
@@ -925,26 +910,6 @@ node_editor_window_init (NodeEditorWindow *self)
self->text_buffer = gtk_text_buffer_new (self->tag_table);
g_signal_connect (self->text_buffer, "changed", G_CALLBACK (text_changed), self);
gtk_text_view_set_buffer (GTK_TEXT_VIEW (self->text_view), self->text_buffer);
/* Default */
gtk_text_buffer_set_text (self->text_buffer,
"shadow {\n"
" child: texture {\n"
" bounds: 0 0 128 128;\n"
" texture: url(\"resource:///org/gtk/gtk4/node-editor/icons/apps/org.gtk.gtk4.NodeEditor.svg\");\n"
" }\n"
" shadows: rgba(0,0,0,0.5) 0 1 12;\n"
"}\n"
"\n"
"transform {\n"
" child: text {\n"
" color: rgb(46,52,54);\n"
" font: \"Cantarell Bold 11\";\n"
" glyphs: \"GTK Node Editor\";\n"
" offset: 8 14.418;\n"
" }\n"
" transform: translate(0, 140);\n"
"}", -1);
}
NodeEditorWindow *

View File

@@ -139,15 +139,6 @@
<property name="icon-name">open-menu-symbolic</property>
</object>
</child>
<child type="end">
<object class="GtkToggleButton" id="dark_bg_button">
<property name="valign">center</property>
<property name="has-frame">0</property>
<property name="icon-name">display-brightness-symbolic</property>
<property name="tooltip-text" translatable="yes">Use a dark background</property>
<signal name="notify::active" handler="dark_mode_cb" swapped="0"/>
</object>
</child>
</object>
</child>
<child>

View File

@@ -4,6 +4,6 @@
<file preprocess="xml-stripblanks">node-editor-window.ui</file>
<file preprocess="xml-stripblanks">help-window.ui</file>
<file>node-format.md</file>
<file alias='icons/apps/org.gtk.gtk4.NodeEditor.svg'>data/scalable/apps/org.gtk.gtk4.NodeEditor.svg</file>
<file alias='icons/apps/org.gtk.gtk4.NodeEditor.Devel.svg'>data/scalable/apps/org.gtk.gtk4.NodeEditor.Devel.svg</file>
</gresource>
</gresources>

View File

@@ -23,7 +23,7 @@ The **container** node is a special node that allows specifying a list of child
| property | syntax | default | printed |
| -------- | ---------------- | ---------------------- | ----------- |
| bottom | `<node>` | color { } | always |
| bottom | `<node>` | color { color: #AF0; } | always |
| mode | `<blend-mode>` | normal | non-default |
| top | `<node>` | color { } | always |
@@ -48,22 +48,7 @@ Creates a node like `gsk_blur_node_new()` with the given properties.
Creates a node like `gsk_border_node_new()` with the given properties.
For the color and width properties, the values follow the typical CSS order
of top, right, bottom, left. If the last/left value isn't given, the 2nd/right
value is used. If the 3rd/bottom value isn't given, the 1st/top value is used.
And if the 2nd/right value also isn't given, the 1st/top value is used for
every 4 values.
### cairo
| property | syntax | default | printed |
| -------- | ---------------- | ---------------------- | ----------- |
| bounds | `<rect>` | none | always |
| pixels | `<url>` | none | non-default |
| script | `<url>` | none | non-default |
The pixels are a base64-encoded data url of png data. The script is
a base64-encoded data url of a cairo script.
For the color and width properties, the values follow the typical CSS order of top, right, bottom, left. If the last/left value isn't given, the 2nd/right value is used. If the 3rd/bottom value isn't given, the 1st/top value is used. And if the 2nd/right value also isn't given, the 1st/top value is used for every 4 values.
### clip
@@ -74,9 +59,7 @@ a base64-encoded data url of a cairo script.
Creates a node like `gsk_clip_node_new()` with the given properties.
As an extension, this node allows specifying a rounded rectangle for the
clip property. If that rectangle is indeed rounded, a node like
`gsk_rounded_clip_node_new()` will be created instead.
As an extension, this node allows specifying a rounded rectangle for the clip property. If that rectangle is indeed rounded, a node like `gsk_rounded_clip_node_new()` will be created instead.
### color
@@ -87,8 +70,7 @@ clip property. If that rectangle is indeed rounded, a node like
Creates a node like `gsk_color_node_new()` with the given properties.
The color is chosen as an error pink so it is visible while also reminding
people to change it.
The color is chosen as an error pink so it is visible while also reminding people to change it.
### color-matrix
@@ -100,21 +82,7 @@ people to change it.
Creates a node like `gsk_color_matrix_node_new()` with the given properties.
The matrix property accepts a <transform> for compatibility purposes, but you
should be aware that the allowed values are meant to be used on 3D transformations,
so their naming might appear awkward. However, it is always possible to use the
matrix3d() production to specify all 16 values individually.
### conic-gradient
| property | syntax | default | printed |
| -------- | ---------------- | ---------------------- | ----------- |
| bounds | `<rect>` | 50 | always |
| center | `<point>` | 25, 25 | always |
| rotation | `<number>` | 0 | always |
| stops | `<color-stop>` | 0 #AF0, 1 #F0C | always |
Creates a node like `gsk_conic_gradient_node_new()` with the given properties.
The matrix property accepts a <transform> for compatibility purposes, but you should be aware that the allowed values are meant to be used on 3D transformations, so their naming might appear awkward. However, it is always possible to use the matrix3d() production to specify all 16 values individually.
### cross-fade
@@ -122,7 +90,7 @@ Creates a node like `gsk_conic_gradient_node_new()` with the given properties.
| -------- | ---------------- | ---------------------- | ----------- |
| end | `<node>` | color { } | always |
| mode | `<number>` | 0.5 | non-default |
| start | `<node>` | color { } | always |
| start | `<node>` | color { color: #AF0; } | always |
Creates a node like `gsk_cross_fade_node_new()` with the given properties.
@@ -153,8 +121,8 @@ Creates a node like `gsk_inset_shadow_node_new()` with the given properties.
| property | syntax | default | printed |
| -------- | ---------------- | ---------------------- | ----------- |
| bounds | `<rect>` | 50 | always |
| start | `<point>` | 0 0 | always |
| end | `<point>` | 0 50 | always |
| start | `<point>` | 0 0 | always |
| stops | `<color-stop>` | 0 #AF0, 1 #F0C | always |
Creates a node like `gsk_linear_gradient_node_new()` with the given properties.
@@ -181,57 +149,16 @@ Creates a node like `gsk_transform_node_new()` with the given properties.
Creates a node like `gsk_outset_shadow_node_new()` with the given properties.
### radial-gradient
| property | syntax | default | printed |
| -------- | ---------------- | ---------------------- | ----------- |
| bounds | `<rect>` | 50 | always |
| center | `<point>` | 25 25 | always |
| hradius | `<number>` | 25 | always |
| vradius | `<number>` | 25 | always |
| start | `<number>` | 0 | always |
| end | `<number>` | 1 | always |
| stops | `<color-stop>` | 0 #AF0, 1 #F0C | always |
Creates a node like `gsk_radial_gradient_node_new()` with the given properties.
### repeat
| property | syntax | default | printed |
| ----------- | ---------------- | ---------------------- | ----------- |
| bounds | `<rect>` | *bounds of child node* | non-default |
| child | `<node>` | color { } | always |
| child-bounds| `<rect>` | *bounds of child node* | non-default |
| property | syntax | default | printed |
| -------- | ---------------- | ---------------------- | ----------- |
| bounds | `<rect>` | *bounds of child node* | non-default |
| child | `<node>` | color { } | always |
| child-bounds| `<rect>` | *bounds of child node* | non-default |
Creates a node like `gsk_repeat_node_new()` with the given properties.
### repeating-linear-gradient
| property | syntax | default | printed |
| -------- | ---------------- | ---------------------- | ----------- |
| bounds | `<rect>` | 50 | always |
| start | `<point>` | 0 0 | always |
| end | `<point>` | 0 50 | always |
| stops | `<color-stop>` | 0 #AF0, 1 #F0C | always |
Creates a node like `gsk_repeating_linear_gradient_node_new()` with the given
properties.
### repeating radial-gradient
| property | syntax | default | printed |
| -------- | ---------------- | ---------------------- | ----------- |
| bounds | `<rect>` | 50 | always |
| center | `<point>` | 25 25 | always |
| hradius | `<number>` | 25 | always |
| vradius | `<number>` | 25 | always |
| start | `<number>` | 0 | always |
| end | `<number>` | 1 | always |
| stops | `<color-stop>` | 0 #AF0, 1 #F0C | always |
Creates a node like `gsk_repeating_radial_gradient_node_new()` with the given
properties.
### rounded-clip
| property | syntax | default | printed |
@@ -261,8 +188,7 @@ Creates a node like `gsk_shadow_node_new()` with the given properties.
Creates a node like `gsk_text_node_new()` with the given properties.
If the given font does not exist or the given glyphs are invalid for the given
font, an error node will be returned.
If the given font does not exist or the given glyphs are invalid for the given font, an error node will be returned.
### texture
@@ -273,9 +199,7 @@ font, an error node will be returned.
Creates a node like `gsk_texture_node_new()` with the given properties.
The default texture is a 10x10 checkerboard with the top left and bottom right
5x5 being in the color #FF00CC and the other part being transparent. A possible
representation for this texture is `url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABmJLR0QA/wD/AP+gvaeTAAAAKUlEQVQYlWP8z3DmPwMaYGQwYUQXY0IXwAUGUCGGoxkYGBiweXAoeAYAz44F3e3U1xUAAAAASUVORK5CYII=")
The default texture is a 10x10 checkerboard with the top left and bottom right 5x5 being in the color #FF00CC and the other part being transparent. A possible representation for this texture is `url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABmJLR0QA/wD/AP+gvaeTAAAAKUlEQVQYlWP8z3DmPwMaYGQwYUQXY0IXwAUGUCGGoxkYGBiweXAoeAYAz44F3e3U1xUAAAAASUVORK5CYII=")
`.
### transform
@@ -287,19 +211,3 @@ representation for this texture is `url("data:image/png;base64,iVBORw0KGgoAAAANS
Creates a node like `gsk_transform_node_new()` with the given properties.
### glshader
| property | syntax | default | printed |
| ---------- | ------------------ | ---------------------- | ----------- |
| bounds | `<rect>` | 50 | always |
| sourcecode | `<string>` | "" | always |
| args | `<uniform values>` | none | non-default |
| child1 | `<node>` | none | non-default |
| child2 | `<node>` | none | non-default |
| child3 | `<node>` | none | non-default |
| child4 | `<node>` | none | non-default |
Creates a GLShader node. The `sourcecode` must be a GLSL fragment shader.
The `args` must match the uniforms of simple types declared in that shader,
in order and comma-separated. The `child` properties must match the sampler
uniforms in the shader.

View File

@@ -1,12 +1,11 @@
executable('gtk4-print-editor',
sources: ['print-editor.c'],
c_args: common_cflags,
dependencies: [ libgtk_dep, demo_conf_h ],
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true,
)
['print-editor.c'],
c_args: common_cflags,
dependencies: libgtk_dep,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true)
# desktop file
install_data('org.gtk.PrintEditor4.desktop', install_dir: gtk_applicationsdir)
@@ -18,5 +17,7 @@ install_data('org.gtk.PrintEditor4.appdata.xml', install_dir: gtk_appdatadir)
icontheme_dir = join_paths(gtk_datadir, 'icons/hicolor')
foreach size: ['scalable', 'symbolic']
install_subdir('data/' + size, install_dir: icontheme_dir)
install_subdir('data/' + size,
install_dir: icontheme_dir
)
endforeach

View File

@@ -2,7 +2,7 @@
Name=Print Editor
Comment=A simple editor demonstrating GTK printing
Exec=gtk4-print-editor %f
Icon=org.gtk.PrintEditor4
Icon=org.gtk.PrintEditor4.Devel
Terminal=false
Type=Application
StartupNotify=true

View File

@@ -4,8 +4,6 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "demo_conf.h"
static GtkWidget *main_window;
static GFile *filename = NULL;
static GtkPageSetup *page_setup = NULL;
@@ -643,26 +641,22 @@ activate_about (GSimpleAction *action,
g_strfreev (backends);
g_free (setting);
version = g_strdup_printf ("%s%s%s\nRunning against GTK %d.%d.%d",
version = g_strdup_printf ("%s\nRunning against GTK %d.%d.%d",
PACKAGE_VERSION,
g_strcmp0 (PROFILE, "devel") == 0 ? "-" : "",
g_strcmp0 (PROFILE, "devel") == 0 ? VCS_TAG : "",
gtk_get_major_version (),
gtk_get_minor_version (),
gtk_get_micro_version ());
dialog = g_object_new (GTK_TYPE_ABOUT_DIALOG,
"transient-for", main_window,
"program-name", g_strcmp0 (PROFILE, "devel") == 0
? "GTK Print Editor (Development)"
: "GTK Print Editor",
"program-name", "GTK Print Editor",
"version", version,
"copyright", "© 2006-2021 Red Hat, Inc",
"copyright", "© 2006-2020 Red Hat, Inc",
"license-type", GTK_LICENSE_LGPL_2_1,
"website", "http://www.gtk.org",
"comments", "Program to demonstrate GTK printing",
"authors", authors,
"logo-icon-name", "org.gtk.PrintEditor4",
"logo-icon-name", "org.gtk.PrintEditor4.Devel",
"title", "About GTK Print Editor",
"system-information", sysinfo->str,
NULL);
@@ -813,10 +807,6 @@ activate (GApplication *app)
GtkWidget *contents;
main_window = gtk_application_window_new (GTK_APPLICATION (app));
if (g_strcmp0 (PROFILE, "devel") == 0)
gtk_widget_add_css_class (GTK_WIDGET (main_window), "devel");
gtk_window_set_icon_name (GTK_WINDOW (main_window), "text-editor");
gtk_window_set_default_size (GTK_WINDOW (main_window), 400, 600);
gtk_application_window_set_show_menubar (GTK_APPLICATION_WINDOW (main_window), TRUE);

View File

@@ -1,19 +1,17 @@
# demos/widget-factory
widgetfactory_resources = gnome.compile_resources('widgetfactory_resources',
'widget-factory.gresource.xml',
source_dir: '.',
)
'widget-factory.gresource.xml',
source_dir: '.')
executable('gtk4-widget-factory',
sources: ['widget-factory.c', widgetfactory_resources],
c_args: common_cflags,
dependencies: [ libgtk_dep, demo_conf_h ],
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true,
)
'widget-factory.c', widgetfactory_resources,
c_args: common_cflags,
dependencies: libgtk_dep,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true)
# desktop file
install_data('org.gtk.WidgetFactory4.desktop', install_dir: gtk_applicationsdir)
@@ -22,7 +20,9 @@ install_data('org.gtk.WidgetFactory4.desktop', install_dir: gtk_applicationsdir)
icontheme_dir = join_paths(gtk_datadir, 'icons/hicolor')
foreach size: ['scalable', 'symbolic']
install_subdir('data/' + size, install_dir: icontheme_dir)
install_subdir('data/' + size,
install_dir: icontheme_dir
)
endforeach
# appdata

View File

@@ -25,8 +25,6 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "demo_conf.h"
static void
change_dark_state (GSimpleAction *action,
GVariant *state,
@@ -302,10 +300,8 @@ activate_about (GSimpleAction *action,
gtk_get_micro_version ());
g_string_append_printf (s, "\nA link can appear here: <http://www.gtk.org>");
version = g_strdup_printf ("%s%s%s\nRunning against GTK %d.%d.%d",
version = g_strdup_printf ("%s\nRunning against GTK %d.%d.%d",
PACKAGE_VERSION,
g_strcmp0 (PROFILE, "devel") == 0 ? "-" : "",
g_strcmp0 (PROFILE, "devel") == 0 ? VCS_TAG : "",
gtk_get_major_version (),
gtk_get_minor_version (),
gtk_get_micro_version ());
@@ -313,11 +309,9 @@ activate_about (GSimpleAction *action,
dialog = g_object_new (GTK_TYPE_ABOUT_DIALOG,
"transient-for", gtk_application_get_active_window (app),
"modal", TRUE,
"program-name", g_strcmp0 (PROFILE, "devel") == 0
? "GTK Widget Factory (Development)"
: "GTK Widget Factory",
"program-name", "GTK Widget Factory",
"version", version,
"copyright", "©1997—2021 The GTK Team",
"copyright", "©1997—2020 The GTK Team",
"license-type", GTK_LICENSE_LGPL_2_1,
"website", "http://www.gtk.org",
"comments", "Program to demonstrate GTK themes and widgets",
@@ -2071,10 +2065,6 @@ activate (GApplication *app)
}
window = (GtkWindow *)gtk_builder_get_object (builder, "window");
if (g_strcmp0 (PROFILE, "devel") == 0)
gtk_widget_add_css_class (GTK_WIDGET (window), "devel");
gtk_application_add_window (GTK_APPLICATION (app), window);
g_action_map_add_action_entries (G_ACTION_MAP (window),
win_entries, G_N_ELEMENTS (win_entries),
@@ -2329,10 +2319,10 @@ activate (GApplication *app)
static void
print_version (void)
{
g_print ("gtk4-widget-factory %s%s%s\n",
PACKAGE_VERSION,
g_strcmp0 (PROFILE, "devel") == 0 ? "-" : "",
g_strcmp0 (PROFILE, "devel") == 0 ? VCS_TAG : "");
g_print ("gtk4-widget-factory %d.%d.%d\n",
gtk_get_major_version (),
gtk_get_minor_version (),
gtk_get_micro_version ());
}
static int

View File

@@ -3298,6 +3298,7 @@ bad things might happen.</property>
</object>
</child>
</object>
<object class="GtkSizeGroup" id="basement-indicators"/>
<menu id="new_style_menu_model">
<section>
<attribute name="display-hint">circular-buttons</attribute>

View File

@@ -75,10 +75,6 @@
<title>Index of all symbols</title>
<xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
</index>
<index id="api-index-4-2" role="4.2">
<title>Index of new symbols in 4.2</title>
<xi:include href="xml/api-index-4.2.xml"><xi:fallback /></xi:include>
</index>
<index id="api-index-deprecated" role="deprecated">
<title>Index of deprecated symbols</title>
<xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include>

View File

@@ -1,3 +1,4 @@
<INCLUDE>gdk/gdk.h</INCLUDE>
<SECTION>
@@ -28,9 +29,8 @@ GDK_TYPE_GRAB_STATUS
GDK_TYPE_STATUS
GdkStatus
GDKVAR
GDK_EXTERN_VAR
_GDK_EXTERN
GDK_DECLARE_INTERNAL_TYPE
GDK_VERSION_3_92
GDK_VERSION_3_94
gdk_axis_use_get_type
gdk_byte_order_get_type
gdk_crossing_mode_get_type
@@ -196,7 +196,6 @@ gdk_surface_create_cairo_context
<SUBSECTION>
gdk_surface_queue_render
gdk_surface_get_frame_clock
gdk_surface_request_layout
<SUBSECTION>
gdk_surface_set_cursor
@@ -375,7 +374,6 @@ gdk_device_tool_get_hardware_id
gdk_device_tool_get_axes
<SUBSECTION Standard>
GDK_TYPE_AXIS_FLAGS
GDK_TYPE_AXIS_USE
GDK_TYPE_EXTENSION_MODE
GDK_TYPE_INPUT_MODE
@@ -448,7 +446,6 @@ gdk_seat_capabilities_get_type
<FILE>events</FILE>
GdkEvent
GdkEventType
GdkKeymapKey
GdkKeyMatch
GdkTouchpadGesturePhase
GdkScrollDirection
@@ -484,14 +481,10 @@ gdk_event_get_axis
gdk_event_get_history
gdk_event_get_pointer_emulated
gdk_event_triggers_context_menu
GdkButtonEvent
gdk_button_event_get_button
GdkScrollEvent
gdk_scroll_event_get_direction
gdk_scroll_event_get_deltas
gdk_scroll_event_is_stop
GdkMotionEvent
GdkKeyEvent
gdk_key_event_get_keyval
gdk_key_event_get_keycode
gdk_key_event_get_consumed_modifiers
@@ -500,31 +493,23 @@ gdk_key_event_get_level
gdk_key_event_is_modifier
gdk_key_event_matches
gdk_key_event_get_match
GdkFocusEvent
gdk_focus_event_get_in
gdk_touch_event_get_emulating_pointer
GdkCrossingEvent
gdk_crossing_event_get_mode
gdk_crossing_event_get_detail
gdk_crossing_event_get_focus
GdkGrabBrokenEvent
gdk_grab_broken_event_get_grab_surface
gdk_grab_broken_event_get_implicit
GdkDeleteEvent
GdkDNDEvent
gdk_dnd_event_get_drop
GdkTouchEvent
GdkTouchpadEvent
gdk_configure_event_get_size
gdk_touchpad_event_get_gesture_phase
gdk_touchpad_event_get_n_fingers
gdk_touchpad_event_get_deltas
gdk_touchpad_event_get_pinch_angle_delta
gdk_touchpad_event_get_pinch_scale
GdkPadEvent
gdk_pad_event_get_axis_value
gdk_pad_event_get_button
gdk_pad_event_get_group_mode
GdkProximityEvent
<SUBSECTION>
gdk_events_get_angle
@@ -532,7 +517,6 @@ gdk_events_get_center
gdk_events_get_distance
<SUBSECTION Standard>
GDK_EVENT
GDK_TYPE_EVENT
GDK_TYPE_EVENT_MASK
GDK_TYPE_EVENT_TYPE
@@ -540,20 +524,6 @@ GDK_TYPE_CROSSING_MODE
GDK_TYPE_SCROLL_DIRECTION
GDK_TYPE_NOTIFY_TYPE
GDK_IS_EVENT
GDK_IS_EVENT_TYPE
GDK_TYPE_BUTTON_EVENT
GDK_TYPE_CROSSING_EVENT
GDK_TYPE_DELETE_EVENT
GDK_TYPE_DND_EVENT
GDK_TYPE_FOCUS_EVENT
GDK_TYPE_GRAB_BROKEN_EVENT
GDK_TYPE_KEY_EVENT
GDK_TYPE_MOTION_EVENT
GDK_TYPE_PAD_EVENT
GDK_TYPE_PROXIMITY_EVENT
GDK_TYPE_SCROLL_EVENT
GDK_TYPE_TOUCH_EVENT
GDK_TYPE_TOUCHPAD_EVENT
gdk_event_get_type
gdk_event_sequence_get_type
@@ -627,8 +597,6 @@ gdk_popup_layout_set_anchor_hints
gdk_popup_layout_get_anchor_hints
gdk_popup_layout_set_offset
gdk_popup_layout_get_offset
gdk_popup_layout_set_shadow_width
gdk_popup_layout_get_shadow_width
<SUBSECTION Standard>
GDK_TYPE_POPUP_LAYOUT
gdk_popup_layout_get_type
@@ -677,7 +645,6 @@ GdkToplevelSize
gdk_toplevel_size_get_bounds
gdk_toplevel_size_set_size
gdk_toplevel_size_set_min_size
gdk_toplevel_size_set_shadow_width
<SUBSECTION Standard>
GDK_TYPE_TOPLEVEL_SIZE
gdk_toplevel_size_get_type
@@ -1205,10 +1172,6 @@ GdkCairoContext
gdk_cairo_context_cairo_create
<SUBSECTION Standard>
GDK_CAIRO_CONTEXT
GDK_IS_CAIRO_CONTEXT
GDK_TYPE_CAIRO_CONTEXT
GDK_CAIRO_ERROR
gdk_cairo_context_get_type
</SECTION>
@@ -1228,11 +1191,6 @@ gdk_vulkan_context_get_queue
gdk_vulkan_context_get_queue_family_index
<SUBSECTION Standard>
GDK_VULKAN_CONTEXT
GDK_IS_VULKAN_CONTEXT
GDK_TYPE_VULKAN_CONTEXT
GDK_RENDERING_VULKAN
GDK_VULKAN_ERROR
gdk_vulkan_context_get_type
gdk_vulkan_error_quark
gdk_vulkan_strerror

View File

@@ -45,13 +45,10 @@ private_headers = [
'gdktoplevelprivate.h',
'gdktoplevelsizeprivate.h',
'gdkvulkancontextprivate.h',
'filetransferportalprivate.h',
'gdkconstructor.h',
'keyname-table.h',
# gdk/x11
'gdkasync.h',
'gdkcairocontext-x11.h',
'gdkclipboard-x11.h',
'gdkdevice-xi2-private.h',
@@ -146,9 +143,6 @@ images = [
'images/nwse_resize_cursor.png',
'images/zoom_in_cursor.png',
'images/zoom_out_cursor.png',
'images/popup-anchors.png',
'images/popup-flip.png',
'images/popup-slide.png',
]
src_dir = [ gdkinc ]
@@ -165,26 +159,25 @@ if get_option('gtk_doc')
configure_file(input: 'version.xml.in', output: 'version.xml', configuration: version_conf)
gnome.gtkdoc('gdk4',
mode: 'none',
main_xml: 'gdk4-docs.xml',
src_dir: src_dir,
dependencies: libgtk_dep,
gobject_typesfile: join_paths(meson.current_source_dir(), 'gdk4.types'),
scan_args: [
'--ignore-decorators=_GDK_EXTERN|G_GNUC_WARN_UNUSED_RESULT',
'--ignore-headers=' + ' '.join(private_headers),
],
mkdb_args: [
'--ignore-files=' + ' '.join(private_headers),
],
fixxref_args: [
'--html-dir=@0@'.format(docpath),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')),
'--extra-dir=@0@'.format(cairo_docpath),
],
html_assets: images,
install: true,
)
mode: 'none',
main_xml: 'gdk4-docs.xml',
src_dir: src_dir,
dependencies: libgtk_dep,
gobject_typesfile: join_paths(meson.current_source_dir(), 'gdk4.types'),
scan_args: [
'--ignore-decorators=_GDK_EXTERN|G_GNUC_WARN_UNUSED_RESULT',
'--ignore-headers=' + ' '.join(private_headers),
],
mkdb_args: [
'--ignore-files=' + ' '.join(private_headers),
],
fixxref_args: [
'--html-dir=@0@'.format(docpath),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')),
'--extra-dir=@0@'.format(cairo_docpath),
],
html_assets: images,
install: true)
endif

View File

@@ -20,40 +20,6 @@ GSK_TYPE_RENDERER
GskRendererClass
gsk_renderer_get_type
GSK_TYPE_SCALING_FILTER
GSK_BROADWAY_RENDERER
GSK_BROADWAY_RENDERER_CLASS
GSK_BROADWAY_RENDERER_GET_CLASS
GSK_IS_BROADWAY_RENDERER
GSK_IS_BROADWAY_RENDERER_CLASS
GSK_TYPE_BROADWAY_RENDERER
GskBroadwayRenderer
GskBroadwayRendererClass
GSK_CAIRO_RENDERER
GSK_CAIRO_RENDERER_CLASS
GSK_CAIRO_RENDERER_GET_CLASS
GSK_IS_CAIRO_RENDERER
GSK_IS_CAIRO_RENDERER_CLASS
GSK_TYPE_CAIRO_RENDERER
GskCairoRenderer
GskCairoRendererClass
GSK_GL_RENDERER
GSK_GL_RENDERER_CLASS
GSK_GL_RENDERER_GET_CLASS
GSK_IS_GL_RENDERER
GSK_IS_GL_RENDERER_CLASS
GSK_TYPE_GL_RENDERER
GskGLRenderer
GskGLRendererClass
gsk_gl_renderer_get_type
GSK_VULKAN_RENDERER
GSK_VULKAN_RENDERER_CLASS
GSK_VULKAN_RENDERER_GET_CLASS
GSK_IS_VULKAN_RENDERER
GSK_IS_VULKAN_RENDERER_CLASS
GSK_TYPE_VULKAN_RENDERER
GskVulkanRenderer
GskVulkanRendererClass
gsk_vulkan_renderer_get_type
</SECTION>
<SECTION>
@@ -66,7 +32,6 @@ GskCairoNode
GskClipNode
GskColorMatrixNode
GskColorNode
GskConicGradientNode
GskContainerNode
GskCrossFadeNode
GskDebugNode
@@ -91,29 +56,25 @@ gsk_render_node_get_node_type
gsk_render_node_draw
GskSerializationError
GskParseErrorFunc
GskParseLocation
gsk_render_node_serialize
gsk_render_node_deserialize
gsk_render_node_write_to_file
GskScalingFilter
gsk_render_node_get_bounds
<SUBSECTION>
<SUBSECTION Nodes>
gsk_color_node_new
gsk_color_node_get_color
gsk_texture_node_new
gsk_texture_node_get_texture
<SUBSECTION>
GskColorStop
gsk_linear_gradient_node_new
gsk_repeating_linear_gradient_node_new
gsk_linear_gradient_node_get_start
gsk_linear_gradient_node_get_end
gsk_linear_gradient_node_get_n_color_stops
gsk_linear_gradient_node_get_color_stops
<SUBSECTION>
gsk_repeating_linear_gradient_node_new
gsk_radial_gradient_node_new
gsk_repeating_radial_gradient_node_new
gsk_radial_gradient_node_get_n_color_stops
gsk_radial_gradient_node_get_color_stops
gsk_radial_gradient_node_get_start
@@ -121,18 +82,16 @@ gsk_radial_gradient_node_get_end
gsk_radial_gradient_node_get_hradius
gsk_radial_gradient_node_get_vradius
gsk_radial_gradient_node_get_center
<SUBSECTION>
gsk_repeating_radial_gradient_node_new
gsk_conic_gradient_node_new
gsk_conic_gradient_node_get_n_color_stops
gsk_conic_gradient_node_get_color_stops
gsk_conic_gradient_node_get_center
gsk_conic_gradient_node_get_rotation
<SUBSECTION>
gsk_border_node_new
gsk_border_node_get_outline
gsk_border_node_get_widths
gsk_border_node_get_colors
<SUBSECTION>
gsk_inset_shadow_node_new
gsk_inset_shadow_node_get_outline
gsk_inset_shadow_node_get_color
@@ -140,7 +99,6 @@ gsk_inset_shadow_node_get_dx
gsk_inset_shadow_node_get_dy
gsk_inset_shadow_node_get_spread
gsk_inset_shadow_node_get_blur_radius
<SUBSECTION>
gsk_outset_shadow_node_new
gsk_outset_shadow_node_get_outline
gsk_outset_shadow_node_get_color
@@ -148,57 +106,45 @@ gsk_outset_shadow_node_get_dx
gsk_outset_shadow_node_get_dy
gsk_outset_shadow_node_get_spread
gsk_outset_shadow_node_get_blur_radius
<SUBSECTION>
gsk_cairo_node_new
gsk_cairo_node_get_draw_context
gsk_cairo_node_get_surface
<SUBSECTION>
gsk_container_node_new
gsk_container_node_get_n_children
gsk_container_node_get_child
<SUBSECTION>
gsk_transform_node_new
gsk_transform_node_get_child
gsk_transform_node_get_transform
<SUBSECTION>
gsk_opacity_node_new
gsk_opacity_node_get_child
gsk_opacity_node_get_opacity
<SUBSECTION>
gsk_color_matrix_node_new
gsk_color_matrix_node_get_child
gsk_color_matrix_node_get_color_matrix
gsk_color_matrix_node_get_color_offset
<SUBSECTION>
gsk_repeat_node_new
gsk_repeat_node_get_child
gsk_repeat_node_get_child_bounds
<SUBSECTION>
gsk_clip_node_new
gsk_clip_node_get_child
gsk_clip_node_get_clip
<SUBSECTION>
gsk_rounded_clip_node_new
gsk_rounded_clip_node_get_child
gsk_rounded_clip_node_get_clip
<SUBSECTION>
GskShadow
gsk_shadow_node_new
gsk_shadow_node_get_shadow
gsk_shadow_node_get_n_shadows
gsk_shadow_node_get_child
<SUBSECTION>
GskBlendMode
gsk_blend_node_new
gsk_blend_node_get_bottom_child
gsk_blend_node_get_top_child
gsk_blend_node_get_blend_mode
<SUBSECTION>
gsk_cross_fade_node_new
gsk_cross_fade_node_get_start_child
gsk_cross_fade_node_get_end_child
gsk_cross_fade_node_get_progress
<SUBSECTION>
gsk_text_node_new
gsk_text_node_get_font
gsk_text_node_get_glyphs
@@ -206,15 +152,12 @@ gsk_text_node_get_color
gsk_text_node_has_color_glyphs
gsk_text_node_get_num_glyphs
gsk_text_node_get_offset
<SUBSECTION>
gsk_blur_node_new
gsk_blur_node_get_child
gsk_blur_node_get_radius
<SUBSECTION>
gsk_debug_node_new
gsk_debug_node_get_child
gsk_debug_node_get_message
<SUBSECTION>
gsk_gl_shader_node_new
gsk_gl_shader_node_get_n_children
gsk_gl_shader_node_get_child
@@ -232,17 +175,13 @@ GSK_TYPE_CLIP_NODE
GSK_TYPE_COLOR_MATRIX_NODE
GSK_TYPE_COLOR_NODE
GSK_TYPE_CONTAINER_NODE
GSK_TYPE_CONIC_GRADIENT_NODE
GSK_TYPE_CROSS_FADE_NODE
GSK_TYPE_DEBUG_NODE
GSK_TYPE_GL_SHADER_NODE
GSK_TYPE_INSET_SHADOW_NODE
GSK_TYPE_LINEAR_GRADIENT_NODE
GSK_TYPE_OPACITY_NODE
GSK_TYPE_OUTSET_SHADOW_NODE
GSK_TYPE_RADIAL_GRADIENT_NODE
GSK_TYPE_REPEATING_LINEAR_GRADIENT_NODE
GSK_TYPE_REPEATING_RADIAL_GRADIENT_NODE
GSK_TYPE_REPEAT_NODE
GSK_TYPE_ROUNDED_CLIP_NODE
GSK_TYPE_SHADOW_NODE
@@ -250,7 +189,6 @@ GSK_TYPE_TEXT_NODE
GSK_TYPE_TEXTURE_NODE
GSK_TYPE_TRANSFORM_NODE
GSK_TYPE_GLSHADER_NODE
GSK_TYPE_RENDER_NODE_TYPE
GskRenderNodeClass
gsk_blend_node_get_type
gsk_blur_node_get_type
@@ -261,25 +199,22 @@ gsk_cairo_renderer_get_type
gsk_clip_node_get_type
gsk_color_matrix_node_get_type
gsk_color_node_get_type
gsk_conic_gradient_node_get_type
gsk_container_node_get_type
gsk_cross_fade_node_get_type
gsk_debug_node_get_type
gsk_gl_shader_node_get_type
gsk_inset_shadow_node_get_type
gsk_linear_gradient_node_get_type
gsk_opacity_node_get_type
gsk_outset_shadow_node_get_type
gsk_radial_gradient_node_get_type
gsk_render_node_get_type
gsk_repeating_linear_gradient_node_get_type
gsk_repeating_radial_gradient_node_get_type
gsk_repeat_node_get_type
gsk_rounded_clip_node_get_type
gsk_shadow_node_get_type
gsk_text_node_get_type
gsk_texture_node_get_type
gsk_transform_node_get_type
gsk_gl_shader_node_get_type
GSK_TYPE_BLEND_MODE
<SUBSECTION Standard>
gsk_serialization_error_quark
@@ -302,8 +237,6 @@ gsk_rounded_rect_is_rectilinear
gsk_rounded_rect_contains_point
gsk_rounded_rect_contains_rect
gsk_rounded_rect_intersects_rect
<SUBSECTION Standard>
GSK_TYPE_CORNER
</SECTION>
<SECTION>
@@ -353,12 +286,10 @@ gsk_gl_shader_new_from_bytes
gsk_gl_shader_new_from_resource
gsk_gl_shader_compile
gsk_gl_shader_get_source
gsk_gl_shader_get_resource
gsk_gl_shader_get_n_textures
gsk_gl_shader_get_n_uniforms
gsk_gl_shader_get_uniform_name
gsk_gl_shader_find_uniform_by_name
GskGLUniformType
gsk_gl_shader_get_uniform_type
gsk_gl_shader_get_uniform_offset
gsk_gl_shader_get_args_size
@@ -390,10 +321,4 @@ gsk_shader_args_builder_set_bool
gsk_shader_args_builder_set_vec2
gsk_shader_args_builder_set_vec3
gsk_shader_args_builder_set_vec4
<SUBSECTION Private>
GSK_TYPE_GL_SHADER
GSK_TYPE_GL_UNIFORM_TYPE
GSK_TYPE_SHADER_ARGS_BUILDER
gsk_shader_args_builder_get_type
</SECTION>

View File

@@ -1,48 +1,27 @@
private_headers = [
'gsk-autocleanup.h',
'gskcairoblurprivate.h',
'gskcairorendererprivate.h',
'gskdebugprivate.h',
'gskdiffprivate.h',
'gskglshaderprivate.h',
'gskgldriverprivate.h',
'gskglprofilerprivate.h',
'gskglrendererprivate.h',
'gskprivate.h',
'gskprofilerprivate.h',
'gskrendererprivate.h',
'gskrendernodeprivate.h',
'gskrendernodeparserprivate.h',
'gskroundedrectprivate.h',
'gskshaderbuilderprivate.h',
'gsktextureprivate.h',
'gsktransformprivate.h',
# gsk/gl
'glutilsprivate.h',
'gskgldriverprivate.h',
'gskglglyphcacheprivate.h',
'gskgliconcacheprivate.h',
'gskglimageprivate.h',
'gskglnodesampleprivate.h',
'gskglprofilerprivate.h',
'gskglrendererprivate.h',
'gskglrenderopsprivate.h',
'gskglshaderbuilderprivate.h',
'gskglshadowcacheprivate.h',
'gskgltextureatlasprivate.h',
'opbuffer.h',
'stb_rect_pack.h',
# gsk/vulkan
'gskvulkanblendmodepipelineprivate.h',
'gskvulkanblurpipelineprivate.h',
'gskvulkanblendpipelineprivate.h',
'gskvulkanborderpipelineprivate.h',
'gskvulkanboxshadowpipelineprivate.h',
'gskvulkanbufferprivate.h',
'gskvulkanclipprivate.h',
'gskvulkancolorpipelineprivate.h',
'gskvulkancolortextpipelineprivate.h',
'gskvulkancommandpoolprivate.h',
'gskvulkancrossfadepipelineprivate.h',
'gskvulkaneffectpipelineprivate.h',
'gskvulkanglyphcacheprivate.h',
'gskvulkanimageprivate.h',
'gskvulkanlineargradientpipelineprivate.h',
'gskvulkanmemoryprivate.h',
@@ -52,8 +31,6 @@ private_headers = [
'gskvulkanrenderpassprivate.h',
'gskvulkanrenderprivate.h',
'gskvulkanshaderprivate.h',
'gskvulkantextpipelineprivate.h',
'gskvulkantexturepipelineprivate.h',
]
images = [
@@ -63,29 +40,25 @@ if get_option('gtk_doc')
configure_file(input: 'version.xml.in', output: 'version.xml', configuration: version_conf)
gnome.gtkdoc('gsk4',
mode: 'none',
main_xml: 'gsk4-docs.xml',
src_dir: [
gskinc,
],
dependencies: libgtk_dep,
gobject_typesfile: join_paths(meson.current_source_dir(), 'gsk4.types'),
scan_args: [
'--ignore-decorators=_GDK_EXTERN',
'--ignore-headers=' + ' '.join(private_headers),
],
mkdb_args: [
'--ignore-files=' + ' '.join(private_headers),
],
fixxref_args: [
'--html-dir=@0@'.format(docpath),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')),
'--extra-dir=@0@'.format(cairo_docpath),
'--extra-dir=../gdk',
],
html_assets: images,
install: true,
)
mode: 'none',
main_xml: 'gsk4-docs.xml',
src_dir: [
gskinc,
],
dependencies: libgtk_dep,
gobject_typesfile: join_paths(meson.current_source_dir(), 'gsk4.types'),
scan_args: [
'--ignore-decorators=_GDK_EXTERN',
'--ignore-headers=' + ' '.join(private_headers),
],
fixxref_args: [
'--html-dir=@0@'.format(docpath),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')),
'--extra-dir=@0@'.format(cairo_docpath),
'--extra-dir=../gdk',
],
html_assets: images,
install: true)
endif

View File

@@ -18,9 +18,9 @@ Length
Percentage
: %, calc()
Angle
: deg, grad, turn, calc()
: deg | grad | turn, calc()
Time
: s, ms, calc()
: s | ms, calc()
Length values with the em or ex units are resolved using the font
size value, unless they occur in setting the font-size itself, in
@@ -32,7 +32,7 @@ not quite the same as the CSS definition of rem.
The calc() notation adds considerable expressive power. There are limits
on what types can be combined in such an expression (e.g. it does not make
sense to add a number and a time). For the full details, see the
[CSS3 Values and Units](https://www.w3.org/TR/css3-values/#calc-notation)
[CSS3 VAlues and Units](https://www.w3.org/TR/css3-values/#calc-notation)
spec.
A common pattern among shorthand properties (called 'four sides') is one
@@ -151,7 +151,7 @@ done with
|caret-color|[CSS Basic User Interface Level 3](https://www.w3.org/TR/css3-ui/#caret-color) | CSS allows an auto value |
|-gtk-secondary-caret-color|[Color](https://www.w3.org/TR/css-color-3/#valuea-def-color) | used for the secondary caret in bidirectional text |
|letter-spacing| [CSS Text Level 3](https://www.w3.org/TR/css3-text/#letter-spacing) | |
|text-decoration-line| [CSS Text Decoration Level 3](https://www.w3.org/TR/css-text-decor-3/#text-decoration-line-property) | |
|text-decoration-line| [CSS Text Decoration Level 3](https://www.w3.org/TR/css-text-decor-3/#text-decoration-line-property) | CSS allows overline |
|text-decoration-color| [CSS Text Decoration Level 3](https://www.w3.org/TR/css-text-decor-3/#text-decoration-color-property) | |
|text-decoration-style| [CSS Text Decoration Level 3](https://www.w3.org/TR/css-text-decor-3/#text-decoration-style-property) | CSS allows dashed and dotted |
|text-shadow| [CSS Text Decoration Level 3](https://www.w3.org/TR/css-text-decor-3/#text-shadow-property) | |
@@ -159,12 +159,11 @@ done with
|-gtk-icon-source| [Image](https://www.w3.org/TR/css-backgrounds-3/#typedef-image), `builtin` or `none` | used for builtin icons in buttons and expanders |
|-gtk-icon-size| [Length](https://www.w3.org/TR/css3-values/#length-value) | size used for builtin icons in buttons and expanders |
|-gtk-icon-style| `requested`, `regular` or `symbolic` | preferred style for application-loaded icons |
|-gtk-icon-transform| [Transform list](https://www.w3.org/TR/css-transforms-1/#typedef-transform-list) or `none` | applied to builtin and application-loaded icons |
|-gtk-icon-transform| [Transform list](https://drafts.csswg.org/css-transforms-1/#typedef-transform-list) or `none` | applied to builtin and application-loaded icons |
|-gtk-icon-palette| Color palette, as explained above | used to recolor symbolic icons |
|-gtk-icon-shadow| [Shadow](https://www.w3.org/TR/css-backgrounds-3/#typedef-shadow) or `none` | applied to builtin and application-loaded icons |
|-gtk-icon-filter| [Filter value list](https://www.w3.org/TR/filter-effects-1/#typedef-filter-value-list) or `none` | applied to builtin and application-loaded icons |
|transform| [CSS Transforms Level 1](https://www.w3.org/TR/css-transforms-1/#transform-property) | |
|transform-origin| [CSS Transforms Level 1](https://www.w3.org/TR/css-transforms-1/#transform-origin-property) | CSS allows specifying a z component|
|transform| [CSS Transforms Level 2](https://drafts.csswg.org/css-transforms-2/) | |
|min-width| [CSS Box Model Level 3](https://www.w3.org/TR/css3-box/#min-width) | CSS allows percentages |
|min-height| [CSS Box Model Level 3](https://www.w3.org/TR/css3-box/#min-height) | CSS allows percentages |
|margin-top| [CSS Box Model Level 3](https://www.w3.org/TR/css3-box/#margin-top) | CSS allows percentages or auto |
@@ -218,7 +217,7 @@ done with
|background-size| [CSS Backgrounds and Borders Level 3](https://www.w3.org/TR/css3-background/#background-size) | |
|background-position| [CSS Backgrounds and Borders Level 3](https://www.w3.org/TR/css3-background/#background-position) | |
|background-repeat| [CSS Backgrounds and Borders Level 3](https://www.w3.org/TR/css3-background/#background-repeat) | |
|background-image| [CSS Backgrounds and Borders Level 3](https://www.w3.org/TR/css3-background/#background-image) | not supported: urls without quotes |
|background-image| [CSS Backgrounds and Borders Level 3](https://www.w3.org/TR/css3-background/#background-image) | not supported: urls without quotes, colors in crossfades |
|box-shadow| [CSS Backgrounds and Borders Level 3](https://www.w3.org/TR/css3-background/#box-shadow) | |
|background-blend-mode| [CSS Compositing and Blending Level 1](https://www.w3.org/TR/compositing-1/#propdef-background-blend-mode) | only affects multiple backgrounds |
|background| [CSS Backgrounds and Borders Level 3](https://www.w3.org/TR/css3-background/#background) | |
@@ -236,4 +235,4 @@ done with
|animation-delay| [CSS Animations Level 1](https://www.w3.org/TR/css3-animations/#animation-delay) | |
|animation-fill-mode| [CSS Animations Level 1](https://www.w3.org/TR/css3-animations/#animation-fill-mode) | |
|animation| [CSS Animations Level 1](https://www.w3.org/TR/css3-animations/#animation) | |
|border-spacing| [CSS Table Level 3](https://www.w3.org/TR/css-tables-3/#border-spacing-property) | respected by GtkBoxLayout, GtkGridLayout, GtkCenterLayout |
|border-spacing| [CSS Table Level 3](https://www.w3.org/TR/css-tables-3/#border-spacing-property) | respected by GtkBox and GtkGrid |

View File

@@ -343,19 +343,20 @@ Many widgets, like buttons, do all their drawing themselves. You just tell
them the label you want to see, and they figure out what font to use, draw
the button outline and focus rectangle, etc. Sometimes, it is necessary to
do some custom drawing. In that case, a GtkDrawingArea might be the right
widget to use. It offers a canvas on which you can draw by setting its
draw function.
widget to use. It offers a canvas on which you can draw by connecting to
the ::draw signal.
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 gtk_widget_queue_draw(). GTK takes
care of most of the details by providing a ready-to-use cairo context to the
draw function.
cause part or all of the widget to be redrawn, by calling
gtk_widget_queue_draw() or its variants. GTK takes care of most of the
details by providing a ready-to-use cairo context to the ::draw signal
handler.
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.
The following example shows a ::draw signal handler. It is a bit more
complicated than the previous examples, since it also demonstrates
input event handling by means of event controllers.
![Drawing](drawing.png)

View File

@@ -41,41 +41,35 @@
<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>Commands</title>
<para>The following commands are understood:</para>
<variablelist>
<varlistentry>
<term><option>validate</option></term>
<listitem><para>Validates the .ui file and report errors to stderr.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>simplify</option></term>
<listitem><para>Simplifies the .ui file by removing properties that
are set to their default values and write the resulting XML to stdout,
or back to the input file.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>enumerate</option></term>
<listitem><para>Lists all the named objects that are created in the .ui file.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>preview</option></term>
<listitem><para>Preview the .ui file. This command accepts options
to specify the ID of an object and a .css file to use.</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1><title>Simplify Options</title>

View File

@@ -61,13 +61,6 @@
<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>

View File

@@ -618,14 +618,6 @@ GtkBuildable
GtkBuildableIface
GtkBuildableParser
gtk_buildable_get_buildable_id
<SUBSECTION Parser>
gtk_buildable_parse_context_get_element
gtk_buildable_parse_context_get_element_stack
gtk_buildable_parse_context_get_position
gtk_buildable_parse_context_pop
gtk_buildable_parse_context_push
<SUBSECTION Standard>
GTK_BUILDABLE
GTK_IS_BUILDABLE
@@ -843,8 +835,6 @@ gtk_combo_box_get_active_id
gtk_combo_box_set_active_id
gtk_combo_box_get_model
gtk_combo_box_set_model
gtk_combo_box_popup
gtk_combo_box_popup_for_device
gtk_combo_box_popdown
gtk_combo_box_get_row_separator_func
gtk_combo_box_set_row_separator_func
@@ -1011,6 +1001,7 @@ gtk_editable_label_get_type
<FILE>gtktext</FILE>
<TITLE>GtkText</TITLE>
GtkText
GtkTextClass
gtk_text_new
gtk_text_new_with_buffer
gtk_text_set_buffer
@@ -1831,6 +1822,7 @@ GtkIMContextSimple
gtk_im_context_simple_new
gtk_im_context_simple_add_table
gtk_im_context_simple_add_compose_file
GTK_MAX_COMPOSE_LEN
<SUBSECTION Standard>
GTK_IM_CONTEXT_SIMPLE
GTK_IS_IM_CONTEXT_SIMPLE
@@ -2765,6 +2757,7 @@ gtk_sort_list_model_get_type
GtkSpinButton
GtkSpinButtonUpdatePolicy
GtkSpinType
gtk_spin_button_configure
gtk_spin_button_new
gtk_spin_button_new_with_range
gtk_spin_button_set_adjustment
@@ -2788,7 +2781,6 @@ gtk_spin_button_set_snap_to_ticks
gtk_spin_button_get_snap_to_ticks
gtk_spin_button_set_climb_rate
gtk_spin_button_get_climb_rate
gtk_spin_button_configure
gtk_spin_button_spin
gtk_spin_button_update
GTK_INPUT_ERROR
@@ -2837,7 +2829,6 @@ gtk_statusbar_push
gtk_statusbar_pop
gtk_statusbar_remove
gtk_statusbar_remove_all
gtk_statusbar_get_message
<SUBSECTION Standard>
GTK_STATUSBAR
GTK_IS_STATUSBAR
@@ -2972,8 +2963,6 @@ GTK_TEXT_BUFFER_GET_CLASS
gtk_text_buffer_get_type
<SUBSECTION Private>
GtkTextBufferPrivate
gtk_text_byte_begins_utf8_char
gtk_text_unknown_char_utf8_gtk_tests_only
</SECTION>
<SECTION>
@@ -4013,10 +4002,6 @@ gtk_cell_renderer_get_padding
gtk_cell_renderer_set_padding
gtk_cell_renderer_get_state
gtk_cell_renderer_is_activatable
gtk_cell_renderer_get_is_expanded
gtk_cell_renderer_get_is_expander
gtk_cell_renderer_set_is_expanded
gtk_cell_renderer_set_is_expander
<SUBSECTION Width-for-height>
gtk_cell_renderer_get_preferred_height
@@ -4301,7 +4286,6 @@ gtk_snapshot_push_shadow
gtk_snapshot_push_debug
gtk_snapshot_push_gl_shader
gtk_snapshot_pop
gtk_snapshot_gl_shader_pop_texture
gtk_snapshot_save
gtk_snapshot_restore
gtk_snapshot_transform
@@ -4324,9 +4308,6 @@ gtk_snapshot_append_conic_gradient
gtk_snapshot_append_border
gtk_snapshot_append_inset_shadow
gtk_snapshot_append_outset_shadow
gtk_snapshot_append_radial_gradient
gtk_snapshot_append_repeating_radial_gradient
gtk_snapshot_render_insertion_cursor
gtk_snapshot_render_background
gtk_snapshot_render_frame
gtk_snapshot_render_focus
@@ -4461,7 +4442,6 @@ gtk_widget_get_focusable
gtk_widget_set_focusable
gtk_widget_get_focus_on_click
gtk_widget_set_focus_on_click
gtk_widget_get_focus_child
gtk_widget_set_focus_child
gtk_widget_get_can_target
gtk_widget_set_can_target
@@ -4667,6 +4647,7 @@ GTK_WINDOW_GET_CLASS
<SUBSECTION Private>
GtkWindowPrivate
gtk_window_get_type
GtkWindowGeometryInfo
gtk_window_remove_embedded_xid
gtk_window_add_embedded_xid
GtkWindowKeysForeachFunc
@@ -5124,34 +5105,6 @@ GTK_PRINTER_GET_CLASS
<SUBSECTION Private>
GtkPrinterPrivate
gtk_printer_get_type
GtkPrinterOption
gtk_printer_option_allocate_choices
gtk_printer_option_choices_from_array
gtk_printer_option_clear_has_conflict
gtk_printer_option_get_activates_default
gtk_printer_option_get_type
gtk_printer_option_has_choice
gtk_printer_option_new
gtk_printer_option_set
gtk_printer_option_set_activates_default
gtk_printer_option_set_add
gtk_printer_option_set_boolean
gtk_printer_option_set_clear_conflicts
gtk_printer_option_set_foreach
gtk_printer_option_set_foreach_in_group
gtk_printer_option_set_get_groups
gtk_printer_option_set_get_type
gtk_printer_option_set_has_conflict
gtk_printer_option_set_lookup
gtk_printer_option_set_new
gtk_printer_option_set_remove
GtkPrinterOptionWidget
gtk_printer_option_widget_get_external_label
gtk_printer_option_widget_get_type
gtk_printer_option_widget_get_value
gtk_printer_option_widget_has_external_label
gtk_printer_option_widget_new
gtk_printer_option_widget_set_source
</SECTION>
@@ -5344,7 +5297,6 @@ GtkCustomPaperUnixDialogClass
<SUBSECTION Private>
gtk_paper_size_get_type
gtk_custom_paper_unix_dialog_get_type
gtk_print_load_custom_papers
GtkCustomPaperUnixDialogPrivate
</SECTION>
@@ -5500,20 +5452,6 @@ gtk_test_init
gtk_test_list_all_types
gtk_test_register_all_types
gtk_test_widget_wait_for_draw
<SUBSECTION Accessibility>
gtk_test_accessible_assert_property
gtk_test_accessible_assert_relation
gtk_test_accessible_assert_role
gtk_test_accessible_assert_state
gtk_test_accessible_check_property
gtk_test_accessible_check_relation
gtk_test_accessible_check_state
gtk_test_accessible_has_property
gtk_test_accessible_has_relation
gtk_test_accessible_has_role
gtk_test_accessible_has_state
<SECTION Private>
gtk_test_accessible_assertion_message_role
</SECTION>
<SECTION>
@@ -6193,8 +6131,6 @@ gtk_popover_get_offset
gtk_popover_set_default_widget
gtk_popover_set_cascade_popdown
gtk_popover_get_cascade_popdown
gtk_popover_get_mnemonics_visible
gtk_popover_set_mnemonics_visible
<SUBSECTION Standard>
GTK_TYPE_POPOVER
GTK_IS_POPOVER
@@ -7038,8 +6974,6 @@ gtk_native_get_for_surface
gtk_native_get_surface
gtk_native_get_renderer
gtk_native_get_surface_transform
gtk_native_realize
gtk_native_unrealize
<SUBSECTION Private>
gtk_native_get_type
@@ -7580,9 +7514,6 @@ gtk_accessible_reset_property
gtk_accessible_update_relation
gtk_accessible_update_relation_value
gtk_accessible_reset_relation
gtk_accessible_property_init_value
gtk_accessible_relation_init_value
gtk_accessible_state_init_value
<SUBSECTION Standard>
GTK_TYPE_ACCESSIBLE

View File

@@ -19,8 +19,8 @@ gtk_assistant_page_get_type
gtk_at_context_get_type
gtk_bin_layout_get_type
gtk_bitset_get_type
gtk_expression_get_type
gtk_bookmark_list_get_type
gtk_bool_filter_get_type
gtk_box_get_type
gtk_box_layout_get_type
gtk_buildable_get_type
@@ -46,7 +46,6 @@ gtk_cell_renderer_spinner_get_type
gtk_cell_renderer_text_get_type
gtk_cell_renderer_toggle_get_type
gtk_cell_view_get_type
gtk_center_box_get_type
gtk_center_layout_get_type
gtk_check_button_get_type
gtk_closure_expression_get_type
@@ -66,16 +65,14 @@ gtk_constraint_target_get_type
gtk_css_provider_get_type
gtk_custom_filter_get_type
gtk_custom_sorter_get_type
gtk_custom_layout_get_type
gtk_dialog_get_type
gtk_directory_list_get_type
gtk_drag_icon_get_type
gtk_drag_source_get_type
gtk_drawing_area_get_type
gtk_drop_controller_motion_get_type
gtk_drop_down_get_type
gtk_drop_target_async_get_type
gtk_drop_target_get_type
gtk_drop_target_async_get_type
gtk_drop_down_get_type
gtk_editable_get_type
gtk_editable_label_get_type
gtk_emoji_chooser_get_type
@@ -90,7 +87,6 @@ gtk_event_controller_motion_get_type
gtk_event_controller_scroll_get_type
gtk_every_filter_get_type
gtk_expander_get_type
gtk_expression_get_type
gtk_file_chooser_dialog_get_type
gtk_file_chooser_get_type
gtk_file_chooser_native_get_type
@@ -254,7 +250,6 @@ gtk_video_get_type
gtk_viewport_get_type
gtk_volume_button_get_type
gtk_widget_get_type
gtk_widget_paintable_get_type
gtk_window_get_type
gtk_window_controls_get_type
gtk_window_group_get_type

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 126 KiB

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

View File

@@ -119,18 +119,21 @@ around or to activate a widget that does not currently have the focus.
GTK has traditionally supported different kinds of shortcuts:
- Accelerators are any other shortcuts that can be activated regardless
of where the focus is, and typically trigger global actions, such as
Ctrl-Q to quit an application.
- Mnemonics are usually triggered using Alt as a modifier for a letter.
They are used in places where a label is associated with a control,
and are indicated by underlining the letter in the label. As a special
case, inside menus (i.e. inside #GtkPopoverMenu), mnemonics can be
triggered without the modifier.
- Key bindings are specific to individual widgets, such as Ctrl-C or
Ctrl-V in an entry copy to or paste from the clipboard. They are only
triggered when the widget has focus.
Accelerators
: Accelerators are any other shortcuts that can be activated regardless
of where the focus is, and typically trigger global actions, such as
Ctrl-Q to quit an application.
Mnmemonics
: Mnemonics are usually triggered using Alt as a modifier for a letter.
They are used in places where a label is associated with a control,
and are indicated by underlining the letter in the label. As a special
case, inside menus (i.e. inside #GtkPopoverMenu), mnemonics can be
triggered without the modifier.
Key bindings
: Key bindings are specific to individual widgets, such as Ctrl-C or
Ctrl-V in an entry copy to or paste from the clipboard. They are only
triggered when the widget has focus.
GTK handles accelerators and mnemonics in a global scope, during the
capture phase, and key bindings locally, during the target phase.

View File

@@ -20,19 +20,13 @@ private_headers = [
'gtkbindingsprivate.h',
'gtkbitmaskprivateimpl.h',
'gtkbitmaskprivate.h',
'gtkbuildableprivate.h',
'gtkbuilderprivate.h',
'gtkbuilderscopeprivate.h',
'gtkbuiltiniconprivate.h',
'gtkbuttonprivate.h',
'gtkcellareaboxcontextprivate.h',
'gtkcheckbuttonprivate.h',
'gtkcolorchooserprivate.h',
'gtkcoloreditorprivate.h',
'gtkcolorpickerkwinprivate.h',
'gtkcolorpickerportalprivate.h',
'gtkcolorpickerprivate.h',
'gtkcolorpickershellprivate.h',
'gtkcolorplaneprivate.h',
'gtkcolorscaleprivate.h',
'gtkcolorswatchprivate.h',
@@ -44,7 +38,6 @@ private_headers = [
'gtkcolumnviewsorterprivate.h',
'gtkcolumnviewtitleprivate.h',
'gtkcomboboxprivate.h',
'gtkcomposetable.h',
'gtkconstraintexpressionprivate.h',
'gtkconstraintguideprivate.h',
'gtkconstraintlayoutprivate.h',
@@ -52,7 +45,6 @@ private_headers = [
'gtkconstraintsolverprivate.h',
'gtkconstrainttypesprivate.h',
'gtkconstraintvflparserprivate.h',
'gtkcountingbloomfilterprivate.h',
'gtkcssanimatedstyleprivate.h',
'gtkcssanimationprivate.h',
'gtkcssarrayvalueprivate.h',
@@ -63,7 +55,6 @@ private_headers = [
'gtkcsscalcvalueprivate.h',
'gtkcsscolorvalueprivate.h',
'gtkcsscornervalueprivate.h',
'gtkcssdataurlprivate.h',
'gtkcssdimensionvalueprivate.h',
'gtkcssdynamicprivate.h',
'gtkcsseasevalueprivate.h',
@@ -72,7 +63,6 @@ private_headers = [
'gtkcssfontfeaturesvalueprivate.h',
'gtkcssfontvariationsvalueprivate.h',
'gtkcssiconthemevalueprivate.h',
'gtkcssimageconicprivate.h',
'gtkcssimagecrossfadeprivate.h',
'gtkcssimagefallbackprivate.h',
'gtkcssimageiconthemeprivate.h',
@@ -89,7 +79,6 @@ private_headers = [
'gtkcssinheritvalueprivate.h',
'gtkcssinitialvalueprivate.h',
'gtkcsskeyframesprivate.h',
'gtkcsslocationprivate.h',
'gtkcsslookupprivate.h',
'gtkcssmatcherprivate.h',
'gtkcssnodedeclarationprivate.h',
@@ -105,7 +94,6 @@ private_headers = [
'gtkcssrgbavalueprivate.h',
'gtkcsssectionprivate.h',
'gtkcssselectorprivate.h',
'gtkcssserializerprivate.h',
'gtkcssshadowsvalueprivate.h',
'gtkcssshadowvalueprivate.h',
'gtkcssshorthandpropertyprivate.h',
@@ -114,7 +102,6 @@ private_headers = [
'gtkcssstylechangeprivate.h',
'gtkcssstyleprivate.h',
'gtkcssstylepropertyprivate.h',
'gtkcsstokenizerprivate.h',
'gtkcsstransformvalueprivate.h',
'gtkcsstransientnodeprivate.h',
'gtkcsstransitionprivate.h',
@@ -124,9 +111,6 @@ private_headers = [
'gtkcsswidgetnodeprivate.h',
'gtkcsswin32sizevalueprivate.h',
'gtkdialogprivate.h',
'gtkdragdestprivate.h',
'gtkdropprivate.h',
'gtkemojicompletion.h',
'gtkentryprivate.h',
'gtkeventcontrollerlegacyprivate.h',
'gtkeventcontrollerprivate.h',
@@ -135,7 +119,6 @@ private_headers = [
'gtkfilechooserprivate.h',
'gtkfilechooserwidgetprivate.h',
'gtkfilefilterprivate.h',
'gtkflowboxprivate.h',
'gtkfontchooserprivate.h',
'gtkfontchooserwidgetprivate.h',
'gtkgesturedragprivate.h',
@@ -159,25 +142,16 @@ private_headers = [
'gtkiconviewprivate.h',
'gtkimagedefinitionprivate.h',
'gtkimageprivate.h',
'gtkimcontextbroadway.h',
'gtkimcontextime.h',
'gtkimcontextquartz.h',
'gtkimcontextsimpleprivate.h',
'gtkimcontextsimpleseqs.h',
'gtkimcontextwayland.h',
'gtkimmoduleprivate.h',
'gtkimmodule.h',
'gtkintl.h',
'gtkistringprivate.h',
'gtkkineticscrollingprivate.h',
'gtklabelprivate.h',
'gtklayoutmanagerprivate.h',
'gtklistbaseprivate.h',
'gtklistitemprivate.h',
'gtklistitemfactoryprivate.h',
'gtklistitemmanagerprivate.h',
'gtklistitemwidgetprivate.h',
'gtklistlistmodelprivate.h',
'gtklockbuttonprivate.h',
'gtkmagnifierprivate.h',
'gtkmediafileprivate.h',
@@ -185,33 +159,22 @@ private_headers = [
'gtkmenusectionboxprivate.h',
'gtkmenutrackeritemprivate.h',
'gtkmenutrackerprivate.h',
'gtkmodelbuttonprivate.h',
'gtkmodulesprivate.h',
'gtkmountoperationprivate.h',
'gtknativedialogprivate.h',
'gtknativeprivate.h',
'gtknomediafileprivate.h',
'gtkpango.h',
'gtkpasswordentrybufferprivate.h',
'gtkpasswordentryprivate.h',
'gtkpathbar.h',
'gdkpixbufutilsprivate.h',
'gtkplacessidebarprivate.h',
'gtkplacesviewprivate.h',
'gtkplacesviewrowprivate.h',
'gtkpointerfocusprivate.h',
'gtkpopcountprivate.h',
'gtkpopovermenubarprivate.h',
'gtkpopovermenuprivate.h',
'gtkpopoverprivate.h',
'gtkprintbackendprivate.h',
'gtkprinterprivate.h',
'gtkprintoperation-portal.h',
'gtkprintoperation-private.h',
'gtkprintutils.h',
'gtkprivate.h',
'gtkprogresstrackerprivate.h',
'gtkpropertylookuplistmodelprivate.h',
'gtkquery.h',
'gtkrangeprivate.h',
'gtkrbtreeprivate.h',
@@ -219,7 +182,6 @@ private_headers = [
'gtkrenderborderprivate.h',
'gtkrendericonprivate.h',
'gtkrendernodepaintableprivate.h',
'gtkrootprivate.h',
'gtkroundedboxprivate.h',
'gtkscalerprivate.h',
'gtksearchengine.h',
@@ -227,27 +189,19 @@ private_headers = [
'gtksearchenginequartz.h',
'gtksearchenginetracker3.h',
'gtksearchentryprivate.h',
'gtksecurememoryprivate.h',
'gtksettingsprivate.h',
'gtkshortcutactionprivate.h',
'gtkshortcutcontrollerprivate.h',
'gtkshortcutmanagerprivate.h',
'gtkshortcutsshortcutprivate.h',
'gtkshortcutswindowprivate.h',
'gtksidebarrowprivate.h',
'gtksizegroup-private.h',
'gtksizerequestcacheprivate.h',
'gtksnapshotprivate.h',
'gtksorterprivate.h',
'gtksortkeysprivate.h',
'gtkspinbuttonprivate.h',
'gtkstyleanimationprivate.h',
'gtkstylecascadeprivate.h',
'gtkstylecontextprivate.h',
'gtkstylepropertyprivate.h',
'gtkstyleproviderprivate.h',
'gtktestatcontextprivate.h',
'gtktextattributes.h',
'gtktextbufferprivate.h',
'gtktextchildprivate.h',
'gtktextdisplayprivate.h',
@@ -257,17 +211,12 @@ private_headers = [
'gtktextlayoutprivate.h',
'gtktextlinedisplaycacheprivate.h',
'gtktextmarkprivate.h',
'gtktextprivate.h',
'gtktextsegment.h',
'gtktexttagprivate.h',
'gtktextutil.h',
'gtktextviewchildprivate.h',
'gtktextviewprivate.h',
'gtktogglebuttonprivate.h',
'gtktoolbarprivate.h',
'gtktooltipprivate.h',
'gtktooltipwindowprivate.h',
'gtktreedatalist.h',
'gtktreepopoverprivate.h',
'gtktreeprivate.h',
'gtktreerbtreeprivate.h',
@@ -279,20 +228,14 @@ private_headers = [
'gtkwin32themeprivate.h',
'gtkwindowprivate.h',
'gsettings-mapping.h',
'gskpango.h',
'gtkdbusgenerated.h',
'imm-extra.h',
'language-names.h',
'open-type-layout.h',
'script-names.h',
'text-input-unstable-v3-client-protocol.h',
'a11y',
'inspector',
'roaring',
'timsort',
'tools',
]
images = [
@@ -413,6 +356,10 @@ images = [
'images/password-entry.png',
'images/picture.png',
'images/popover.png',
'images/popup-anchors.png',
'images/popup-at.svg',
'images/popup-flip.png',
'images/popup-slide.png',
'images/printdialog.png',
'images/progressbar.png',
'images/right-center.png',
@@ -513,46 +460,44 @@ if get_option('gtk_doc')
expand_md_targets = []
foreach t : expand_content_md_files
expand_md_targets += custom_target(t,
input: [ t ],
output: [ fs.replace_suffix(t, '.xml') ],
command: [ expand_md, '@INPUT@', '@OUTPUT@'],
)
input: [ t ],
output: [ fs.replace_suffix(t, '.xml') ],
command: [ expand_md, '@INPUT@', '@OUTPUT@'])
endforeach
gnome.gtkdoc('gtk4',
mode: 'none',
main_xml: 'gtk4-docs.xml',
src_dir: [
gtkinc,
],
dependencies: libgtk_dep,
gobject_typesfile: configure_file(
input: 'gtk4.types.in',
output: 'gtk4.types',
configuration: types_conf,
),
scan_args: [
'--ignore-decorators=_GDK_EXTERN|G_GNUC_WARN_UNUSED_RESULT',
'--ignore-headers=' + ' '.join(private_headers),
],
mkdb_args: [
'--default-includes=gtk/gtk.h',
'--ignore-files=' + ' '.join(private_headers),
],
fixxref_args: [
'--html-dir=@0@'.format(docpath),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')),
'--extra-dir=@0@'.format(cairo_docpath),
'--extra-dir=@0@'.format(gdkpixbuf_docpath),
'--extra-dir=../gdk',
'--extra-dir=../gsk',
],
content_files: content_files + expand_md_targets,
html_assets: images,
install: true,
)
mode: 'none',
main_xml: 'gtk4-docs.xml',
src_dir: [
gtkinc,
],
dependencies: libgtk_dep,
gobject_typesfile: configure_file(
input: 'gtk4.types.in',
output: 'gtk4.types',
configuration: types_conf,
),
scan_args: [
'--ignore-decorators=_GDK_EXTERN|G_GNUC_WARN_UNUSED_RESULT',
'--ignore-headers=' + ' '.join(private_headers),
],
mkdb_args: [
'--default-includes=gtk/gtk.h',
'--ignore-files=' + ' '.join(private_headers),
],
fixxref_args: [
'--html-dir=@0@'.format(docpath),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')),
'--extra-dir=@0@'.format(cairo_docpath),
'--extra-dir=@0@'.format(gdkpixbuf_docpath),
'--extra-dir=../gdk',
'--extra-dir=../gsk',
],
content_files: content_files + expand_md_targets,
html_assets: images,
install: true)
endif
xsltproc = find_program('xsltproc', required: false)
@@ -587,17 +532,16 @@ if get_option('man-pages') and xsltproc.found()
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: [
xsltproc,
xlstproc_flags,
'-o', '@OUTPUT@',
'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
'@INPUT@',
],
install: true,
install_dir: join_paths(get_option('mandir'), 'man@0@'.format(man_section)),
)
input: '@0@.xml'.format(man_name),
output: '@0@.@1@'.format(man_name, man_section),
command: [
xsltproc,
xlstproc_flags,
'-o', '@OUTPUT@',
'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
'@INPUT@',
],
install: true,
install_dir: join_paths(get_option('mandir'), 'man@0@'.format(man_section)))
endforeach
endif

View File

@@ -135,7 +135,7 @@ These functions are not supported in GTK 4. Instead, either use
backend-specific APIs, or render your widgets using
#GtkWidgetClass.snapshot() (once you are using GTK 4).
### Stop using GtkButton's image-related API
Stop using GtkButton's image-related API
The functions and properties related to automatically add a GtkImage
to a GtkButton, and using a GtkSetting to control its visibility, are
@@ -165,11 +165,11 @@ for this change.
| ::key-release-event | #GtkEventControllerKey |
| ::enter-notify-event | #GtkEventControllerMotion |
| ::leave-notify-event | #GtkEventControllerMotion |
| ::configure-event | - |
| ::configure-event | replaced by #GdkSurface::layout |
| ::focus-in-event | #GtkEventControllerFocus |
| ::focus-out-event | #GtkEventControllerFocus |
| ::map-event | - |
| ::unmap-event | - |
| ::map-event | replaced by #GdkSurface:mapped |
| ::unmap-event | replaced by #GdkSurface:mapped |
| ::property-notify-event | replaced by #GdkClipboard |
| ::selection-clear-event | replaced by #GdkClipboard |
| ::selection-request-event | replaced by #GdkClipboard |
@@ -178,17 +178,10 @@ for this change.
| ::proximity-in-event | #GtkGestureStylus |
| ::proximity-out-event | #GtkGestureStylus |
| ::visibility-notify-event | - |
| ::window-state-event | - |
| ::window-state-event | replaced by #GdkToplevel:state |
| ::damage-event | - |
| ::grab-broken-event | - |
Event signals which are not directly related to input have to be dealt
with on a one-by-one basis. If you were using ::configure-event and
::window-state-event to save window state, you should use property
notification for corresponding GtkWindow properties, such as
#GtkWindow:default-width, #GtkWindow:default-height, #GtkWindow:maximized
or #GtkWindow:fullscreened.
### Set a proper application ID
In GTK 4 we want the application's #GApplication 'application-id'
@@ -271,6 +264,14 @@ therefore can no longer be used to break reference cycles. A typical sign
of a reference cycle involving a toplevel window is when closing the window
does not make the application quit.
A good rule to follow is: If you set a widget pointer with
gtk_widget_class_bind_template_child() in class_init(), you need to
unparent it in dispose(). The slight complication here is that you need
to respect the widget hierarchy while doing so. Ie if you set both `field1`
and `field2`, but `field1` is an ancestor of `field2`, then you only need
to unparent `field1` — doing so will remove the the entire subtree below
`field1`, including `field2`.
### Stop using GdkScreen
The GdkScreen object has been removed in GTK 4. Most of its APIs already
@@ -406,7 +407,7 @@ and gdk_keymap_get_entries_for_keyval().
GTK 3 has the idea that use of modifiers may differ between different
platforms, and has a #GdkModifierIntent api to let platforms provide
hint about how modifiers are expected to be used. It also promoted
the use of `<Primary>` instead of `<Control>` to specify accelerators that
the use of <Primary> instead of <Control> to specify accelerators that
adapt to platform conventions.
In GTK 4, the meaning of modifiers has been fixed, and backends are
@@ -425,88 +426,13 @@ GDK_CONTROL_MASK|GDK_ALT_MASK
: Prevent text input
Consequently, #GdkModifierIntent and related APIs have been removed,
and `<Control>` is preferred over `<Primary>` in accelerators.
and <Control> is preferred over <Primary> in accelerators.
A related change is that GTK 4 no longer supports the use of archaic
X11 'real' modifiers with the names Mod1,..., Mod5, and %GDK_MOD1_MASK
has been renamed to %GDK_ALT_MASK.
### Replace GtkClipboard with GdkClipboard
The `GtkClipboard` API has been removed, and replaced by #GdkClipboard.
There is not direct 1:1 mapping between the old an the new API, so it cannot
be a mechanical replacement; the new API is based on object types and #GValue
like object properties, instead of opaque identifiers, so it should be easier
to use.
For instance, the example below copies the contents of an entry into the
clipboard:
```
static void
copy_text (GtkWidget *widget)
{
GtkEditable *editable = GTK_EDITABLE (widget);
// Initialize a GValue with the contents of the widget
GValue value = G_VALUE_INIT;
g_value_init (&value, G_TYPE_STRING);
g_value_set_string (&value, gtk_editable_get_text (editable));
// Store the value in the clipboard object
GdkClipboard *clipboard = gtk_widget_get_clipboard (widget);
gdk_clipboard_set_value (clipboard, &value);
g_value_unset (&value);
}
```
whereas the example below pastes the contents into the entry:
```
static void
paste_text (GtkWidget *widget)
{
GtkEditable *editable = GTK_EDITABLE (widget);
// Initialize a GValue to receive text
GValue value = G_VALUE_INIT;
g_value_init (&value, G_TYPE_STRING);
// Get the content provider for the clipboard, and ask it for text
GdkClipboard *clipboard = gtk_widget_get_clipboard (widget);
GdkContentProvider *provider = gdk_clipboard_get_content (clipboard);
// If the content provider does not contain text, we are not interested
if (!gdk_content_provider_get_value (provider, &value, NULL))
return;
const char *str = g_value_get_string (&value);
gtk_editable_set_text (editable, str);
g_value_unset (&value);
}
```
The convenience API for specific target types in `GtkClipboard` has been
replaced by their corresponding GType:
| GtkClipboard | GType |
| ----------------------------------- | ---------------------- |
| `gtk_clipboard_request_text()` | `G_TYPE_STRING` |
| `gtk_clipboard_request_rich_text()` | `GTK_TYPE_TEXT_BUFFER` |
| `gtk_clipboard_request_image()` | `GDK_TYPE_PIXBUF` |
| `gtk_clipboard_request_uris()` |` GDK_TYPE_FILE_LIST` |
**Note**: Support for rich text serialization across different processes
for #GtkTextBuffer is not available any more.
If you are copying the contents of an image, it is recommended to use
GDK_TYPE_PAINTABLE instead of GDK_TYPE_PIXBUF, to minimize the amount of
potential copies.
### Stop using `gtk_get_current_...` APIs
### Stop using gtk_get_current_... APIs
The function gtk_get_current_event() and its variants have been
replaced by equivalent event controller APIs:
@@ -522,25 +448,6 @@ option. You should always review the resulting changes.
The <requires> tag now supports for the 'lib' attribute the
'gtk' value only, instead of the 'gtk+' one previously.
### Adapt to GtkBuilder API changes
gtk_builder_connect_signals() no longer exists. Instead, signals are
always connected automatically. If you need to add user data to your
signals, gtk_builder_set_current_object() must be called. An important
caveat is that you have to do this before loading any XML. This means if
you need to use gtk_builder_set_current_object(), you can no longer use
gtk_builder_new_from_file(), gtk_builder_new_from_resource(), or
gtk_builder_new_from_string(). Instead, you must use vanilla gtk_builder_new(),
then call gtk_builder_set_current_object(), then load the XML using
gtk_builder_add_from_file(), gtk_builder_add_from_resource(), or
gtk_builder_add_from_string(). You must check the return value for
failure and manually abort with g_error() if something went wrong.
You only have to worry about this if you were previously using
gtk_builder_connect_signals(). If you are using templates, then
gtk_widget_init_template() will call gtk_builder_set_current_object()
for you, so templates work like before.
### Adapt to event controller API changes
A few changes to the event controller and #GtkGesture APIs
@@ -551,23 +458,6 @@ Another is that #GtkGestureMultiPress has been renamed to #GtkGestureClick,
and has lost its area property. A #GtkEventControllerFocus has been
split off from #GtkEventcontrollerKey.
In GTK 3, #GtkEventController:widget was a construct-only property, so
a #GtkWidget was provided whenever constructing a #GtkEventController.
In GTK 4, #GtkEventController:widget is now read-only. Use
gtk_widget_add_controller() to add an event controller to a widget.
In GTK 3, widgets did not own their event controllers, and event
controllers did not own their widgets, so developers were responsible
for manually keeping event controllers alive for the lifetime of their
associated widgets. In GTK 4, widgets own their event controllers.
gtk_widget_add_controller() takes ownership of the event controller, so
there is no longer any need to store a reference to the event controller
after it has been added to a widget.
Although not normally needed, an event controller could be removed from
a widget in GTK 3 by destroying the event controller with g_object_unref().
In GTK 4, you must use gtk_widget_remove_controller().
### Focus handling changes
The semantics of the #GtkWidget:can-focus property have changed.
@@ -861,8 +751,7 @@ to get it.
The ::size-allocate signal has been removed, since it is easy
to misuse. If you need to learn about sizing changes of custom
drawing widgets, use the #GtkDrawingArea::resize or #GtkGLArea::resize
signals. If you want to track the size of toplevel windows, use
property notification for #GtkWindow:default-width and #GtkWindow:default-height.
signals.
### Switch to GtkWidget's children APIs
@@ -1079,11 +968,6 @@ that wants to override the default handling, you can provide an
implementation of the default.activate action in your widgets' action
groups.
### Stop using gtk_widget_grab_default()
The function gtk_widget_grab_default() has been removed. If you need
to mark a widget as default, use gtk_window_set_default_widget() directly.
### Stop setting ::has-default and ::has-focus in .ui files
The special handling for the ::has-default and ::has-focus properties
@@ -1178,7 +1062,7 @@ to start a drag manually, call gdk_drag_begin().
The ::drag-data-get signal has been replaced by the #GtkDragSource::prepare
signal, which returns a #GdkContentProvider for the drag operation.
The destination-side Drag-and-Drop API in GTK 4 have also been changed
The destination-side Drag-and-Drop apis in GTK 4 have also been changed
to use an event controller, #GtkDropTarget. Instead of calling
gtk_drag_dest_set() and connecting to #GtkWidget signals, you create
a #GtkDropTarget object, attach it to the widget with
@@ -1265,19 +1149,6 @@ pointer coordinates as inout arguments any more, but as normal in ones.
See: gtk_tree_view_get_tooltip_context(), gtk_icon_view_get_tooltip_context()
### Stop using GtkFileChooserButton
The `GtkFileChooserButton` widget was removed, due to its shortcomings in
the user interaction. You can replace it with a simple #GtkButton that
shows a #GtkFileChooserNative dialog when clicked; once the file selection
has completed, you can update the label of the #GtkButton with the selected
file.
### Adapt to changed GtkSettings properties
In GTK 3 the #GtkSettings:gtk-cursor-aspect-ratio property of #GtkSettings was
a float. In GTK 4 this has been changed to a double.
## Changes to consider after the switch
GTK 4 has a number of new features that you may want to take

View File

@@ -97,11 +97,11 @@ the question you have, this list is a good place to start.
#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
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
string to actually fetch the translation. `_()` both marks the string for
translation and actually translates it. The `C_()` macro (C stands for
string to actually fetch the translation. _() both marks the string for
translation and actually translates it. The C_() macro (C stands for
context) adds an additional context to the string that is marked for
translation, which can help to disambiguate short strings that might
need different translations in different parts of your program.
@@ -190,7 +190,7 @@ the question you have, this list is a good place to start.
encode string literals in UTF-8 by using octal or hexadecimal escapes
like `\212` or `\xa8` to encode each byte. This is portable, but
modifying the escaped strings is not very convenient. Be careful when
mixing hexadecimal escapes with ordinary text; `"\xa8abcd"` is a string
mixing hexadecimal escapes with ordinary text; `"\xa8abcd" is a string
of length 1 !
- Runtime conversion

View File

@@ -0,0 +1,293 @@
#include <gtk/gtk.h>
#include "exampleapp.h"
#include "exampleappwin.h"
struct _ExampleAppWindow
{
GtkApplicationWindow parent;
GSettings *settings;
GtkWidget *stack;
GtkWidget *search;
GtkWidget *searchbar;
GtkWidget *searchentry;
GtkWidget *gears;
GtkWidget *sidebar;
GtkWidget *words;
GtkWidget *lines;
GtkWidget *lines_label;
};
G_DEFINE_TYPE (ExampleAppWindow, example_app_window, GTK_TYPE_APPLICATION_WINDOW)
static void
search_text_changed (GtkEntry *entry,
ExampleAppWindow *win)
{
const char *text;
GtkWidget *tab;
GtkWidget *view;
GtkTextBuffer *buffer;
GtkTextIter start, match_start, match_end;
text = gtk_editable_get_text (GTK_EDITABLE (entry));
if (text[0] == '\0')
return;
tab = gtk_stack_get_visible_child (GTK_STACK (win->stack));
view = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (tab));
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
/* Very simple-minded search implementation */
gtk_text_buffer_get_start_iter (buffer, &start);
if (gtk_text_iter_forward_search (&start, text, GTK_TEXT_SEARCH_CASE_INSENSITIVE,
&match_start, &match_end, NULL))
{
gtk_text_buffer_select_range (buffer, &match_start, &match_end);
gtk_text_view_scroll_to_iter (GTK_TEXT_VIEW (view), &match_start,
0.0, FALSE, 0.0, 0.0);
}
}
static void
find_word (GtkButton *button,
ExampleAppWindow *win)
{
const char *word;
word = gtk_button_get_label (button);
gtk_editable_set_text (GTK_EDITABLE (win->searchentry), word);
}
static void
update_words (ExampleAppWindow *win)
{
GHashTable *strings;
GHashTableIter iter;
GtkWidget *tab, *view, *row;
GtkTextBuffer *buffer;
GtkTextIter start, end;
char *word, *key;
GtkWidget *child;
tab = gtk_stack_get_visible_child (GTK_STACK (win->stack));
if (tab == NULL)
return;
view = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (tab));
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
strings = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
gtk_text_buffer_get_start_iter (buffer, &start);
while (!gtk_text_iter_is_end (&start))
{
while (!gtk_text_iter_starts_word (&start))
{
if (!gtk_text_iter_forward_char (&start))
goto done;
}
end = start;
if (!gtk_text_iter_forward_word_end (&end))
goto done;
word = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
g_hash_table_add (strings, g_utf8_strdown (word, -1));
g_free (word);
start = end;
}
done:
while ((child = gtk_widget_get_first_child (win->words)))
gtk_list_box_remove (GTK_LIST_BOX (win->words), child);
g_hash_table_iter_init (&iter, strings);
while (g_hash_table_iter_next (&iter, (gpointer *)&key, NULL))
{
row = gtk_button_new_with_label (key);
g_signal_connect (row, "clicked",
G_CALLBACK (find_word), win);
gtk_box_append (GTK_BOX (win->words), row);
}
g_hash_table_unref (strings);
}
static void
update_lines (ExampleAppWindow *win)
{
GtkWidget *tab, *view;
GtkTextBuffer *buffer;
int count;
char *lines;
tab = gtk_stack_get_visible_child (GTK_STACK (win->stack));
if (tab == NULL)
return;
view = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (tab));
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
count = gtk_text_buffer_get_line_count (buffer);
lines = g_strdup_printf ("%d", count);
gtk_label_set_text (GTK_LABEL (win->lines), lines);
g_free (lines);
}
static void
visible_child_changed (GObject *stack,
GParamSpec *pspec,
ExampleAppWindow *win)
{
if (gtk_widget_in_destruction (GTK_WIDGET (stack)))
return;
gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (win->searchbar), FALSE);
update_words (win);
update_lines (win);
}
static void
words_changed (GObject *sidebar,
GParamSpec *pspec,
ExampleAppWindow *win)
{
update_words (win);
}
static void
example_app_window_init (ExampleAppWindow *win)
{
GtkBuilder *builder;
GMenuModel *menu;
GAction *action;
gtk_widget_init_template (GTK_WIDGET (win));
win->settings = g_settings_new ("org.gtk.exampleapp");
g_settings_bind (win->settings, "transition",
win->stack, "transition-type",
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (win->settings, "show-words",
win->sidebar, "reveal-child",
G_SETTINGS_BIND_DEFAULT);
g_object_bind_property (win->search, "active",
win->searchbar, "search-mode-enabled",
G_BINDING_BIDIRECTIONAL);
g_signal_connect (win->sidebar, "notify::reveal-child",
G_CALLBACK (words_changed), win);
builder = gtk_builder_new_from_resource ("/org/gtk/exampleapp/gears-menu.ui");
menu = G_MENU_MODEL (gtk_builder_get_object (builder, "menu"));
gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (win->gears), menu);
g_object_unref (builder);
action = g_settings_create_action (win->settings, "show-words");
g_action_map_add_action (G_ACTION_MAP (win), action);
g_object_unref (action);
action = (GAction*) g_property_action_new ("show-lines", win->lines, "visible");
g_action_map_add_action (G_ACTION_MAP (win), action);
g_object_unref (action);
g_object_bind_property (win->lines, "visible",
win->lines_label, "visible",
G_BINDING_DEFAULT);
g_object_set (gtk_settings_get_default (), "gtk-shell-shows-app-menu", FALSE, NULL);
gtk_application_window_set_show_menubar (GTK_APPLICATION_WINDOW (win), TRUE);
}
static void
example_app_window_dispose (GObject *object)
{
ExampleAppWindow *win;
win = EXAMPLE_APP_WINDOW (object);
g_clear_object (&win->settings);
G_OBJECT_CLASS (example_app_window_parent_class)->dispose (object);
}
static void
example_app_window_class_init (ExampleAppWindowClass *class)
{
G_OBJECT_CLASS (class)->dispose = example_app_window_dispose;
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
"/org/gtk/exampleapp/window.ui");
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, stack);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, search);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, searchbar);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, searchentry);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, gears);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, words);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, sidebar);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, lines);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, lines_label);
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), search_text_changed);
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), visible_child_changed);
}
ExampleAppWindow *
example_app_window_new (ExampleApp *app)
{
return g_object_new (EXAMPLE_APP_WINDOW_TYPE, "application", app, NULL);
}
void
example_app_window_open (ExampleAppWindow *win,
GFile *file)
{
char *basename;
GtkWidget *scrolled, *view;
char *contents;
gsize length;
GtkTextBuffer *buffer;
GtkTextTag *tag;
GtkTextIter start_iter, end_iter;
basename = g_file_get_basename (file);
scrolled = gtk_scrolled_window_new ();
gtk_widget_set_hexpand (scrolled, TRUE);
gtk_widget_set_vexpand (scrolled, TRUE);
view = gtk_text_view_new ();
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), view);
gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
if (g_file_load_contents (file, NULL, &contents, &length, NULL, NULL))
{
gtk_text_buffer_set_text (buffer, contents, length);
g_free (contents);
}
tag = gtk_text_buffer_create_tag (buffer, NULL, NULL);
g_settings_bind (win->settings, "font",
tag, "font",
G_SETTINGS_BIND_DEFAULT);
gtk_text_buffer_get_start_iter (buffer, &start_iter);
gtk_text_buffer_get_end_iter (buffer, &end_iter);
gtk_text_buffer_apply_tag (buffer, tag, &start_iter, &end_iter);
g_free (basename);
gtk_widget_set_sensitive (win->search, TRUE);
update_words (win);
update_lines (win);
}

View File

@@ -36,10 +36,6 @@
#include <string.h>
#endif
#if !GLIB_CHECK_VERSION (2, 67, 3)
# define g_memdup2(mem,size) g_memdup((mem), (size))
#endif
typedef struct {
int id;
guint32 tag;
@@ -609,7 +605,7 @@ update_future_pointer_info (BroadwayServer *server, BroadwayInputPointerMsg *dat
static void
queue_input_message (BroadwayServer *server, BroadwayInputMsg *msg)
{
server->input_messages = g_list_append (server->input_messages, g_memdup2 (msg, sizeof (BroadwayInputMsg)));
server->input_messages = g_list_append (server->input_messages, g_memdup (msg, sizeof (BroadwayInputMsg)));
}
static void

View File

@@ -13,8 +13,6 @@
#include "gdkbroadway-server.h"
#include "gdkprivate-broadway.h"
#include "gdk-private.h"
#include <gdk/gdktextureprivate.h>
#include <glib.h>
@@ -247,7 +245,7 @@ parse_all_input (GdkBroadwayServer *server)
if (p + size > end)
break;
reply = g_memdup2 (p, size);
reply = g_memdup (p, size);
p += size;
server->incoming = g_list_append (server->incoming, reply);

View File

@@ -41,7 +41,6 @@
#include "gdksurfaceprivate.h"
#include "gdktextureprivate.h"
#include "gdktoplevelprivate.h"
#include "gdk-private.h"
#include <graphene.h>
#include <stdlib.h>
@@ -1026,7 +1025,7 @@ _gdk_broadway_moveresize_handle_event (GdkDisplay *display,
*mv_resize->moveresize_pending_event = *event;
else
mv_resize->moveresize_pending_event =
g_memdup2 (event, sizeof (BroadwayInputMsg));
g_memdup (event, sizeof (BroadwayInputMsg));
break;
}
@@ -1044,7 +1043,7 @@ _gdk_broadway_moveresize_handle_event (GdkDisplay *display,
*mv_resize->moveresize_pending_event = *event;
else
mv_resize->moveresize_pending_event =
g_memdup2 (event, sizeof (BroadwayInputMsg));
g_memdup (event, sizeof (BroadwayInputMsg));
break;
}
@@ -1543,7 +1542,6 @@ gdk_broadway_toplevel_present (GdkToplevel *toplevel,
int width, height;
GdkGeometry geometry;
GdkSurfaceHints mask;
gboolean maximize;
gdk_broadway_surface_unminimize (surface);
@@ -1585,13 +1583,10 @@ gdk_broadway_toplevel_present (GdkToplevel *toplevel,
gdk_surface_constrain_size (&geometry, mask, width, height, &width, &height);
gdk_broadway_surface_toplevel_resize (surface, width, height);
if (gdk_toplevel_layout_get_maximized (layout, &maximize))
{
if (maximize)
gdk_broadway_surface_maximize (surface);
else
gdk_broadway_surface_unmaximize (surface);
}
if (gdk_toplevel_layout_get_maximized (layout))
gdk_broadway_surface_maximize (surface);
else
gdk_broadway_surface_unmaximize (surface);
if (size.shadow.is_valid)
{

View File

@@ -59,25 +59,17 @@ libgdk_broadway = static_library('gdk-broadway',
'-DGTK_COMPILATION',
'-DG_LOG_DOMAIN="Gdk"',
] + common_cflags,
dependencies: [gdk_deps, gdk_broadway_deps],
)
link_args: common_ldflags,
dependencies: [gdk_deps, gdk_broadway_deps])
# gtk4-broadwayd
broadwayd_syslib = os_win32 ? find_library('ws2_32') : shmlib
executable('gtk4-broadwayd',
sources: [
clienthtml_h,
broadwayjs_h,
gdkconfig,
gdkenum_h,
'broadwayd.c',
'broadway-server.c',
'broadway-output.c',
],
clienthtml_h, broadwayjs_h, gdkconfig, gdkenum_h,
'broadwayd.c', 'broadway-server.c', 'broadway-output.c',
include_directories: [confinc, gdkinc, include_directories('.')],
c_args: ['-DGTK_COMPILATION', '-DG_LOG_DOMAIN="Gdk"', ],
dependencies: [ broadwayd_syslib, gdk_deps ],
install: true,
)
dependencies : [broadwayd_syslib, gdk_deps],
install : true)

View File

@@ -49,12 +49,4 @@ guint gdk_parse_debug_var (const char *variable,
const GdkDebugKey *keys,
guint nkeys);
/* Backward compatibility shim, to avoid bumping up the minimum
* required version of GLib; most of our uses of g_memdup() are
* safe, and those that aren't have been fixed
*/
#if !GLIB_CHECK_VERSION (2, 67, 3)
# define g_memdup2(mem,size) g_memdup((mem),(size))
#endif
#endif /* __GDK__PRIVATE_H__ */

View File

@@ -173,7 +173,7 @@ stash_desktop_startup_notification_id (void)
if (!g_utf8_validate (desktop_startup_id, -1, NULL))
g_warning ("DESKTOP_STARTUP_ID contains invalid UTF-8");
else
startup_notification_id = g_strdup (desktop_startup_id);
startup_notification_id = g_strdup (desktop_startup_id ? desktop_startup_id : "");
}
/* Clear the environment variable so it won't be inherited by

View File

@@ -182,7 +182,6 @@ G_GNUC_UNUSED static inline void
gdk_array(splice) (GdkArray *self,
gsize pos,
gsize removed,
gboolean stolen,
_T_ *additions,
gsize added)
{
@@ -193,9 +192,8 @@ gdk_array(splice) (GdkArray *self,
g_assert (pos + removed <= size);
remaining = size - pos - removed;
if (!stolen)
gdk_array(free_elements) (gdk_array(index) (self, pos),
gdk_array(index) (self, pos + removed));
gdk_array(free_elements) (gdk_array(index) (self, pos),
gdk_array(index) (self, pos + removed));
gdk_array(reserve) (self, size - removed + added);
@@ -227,9 +225,9 @@ gdk_array(set_size) (GdkArray *self,
{
gsize old_size = gdk_array(get_size) (self);
if (new_size > old_size)
gdk_array(splice) (self, old_size, 0, FALSE, NULL, new_size - old_size);
gdk_array(splice) (self, old_size, 0, NULL, new_size - old_size);
else
gdk_array(splice) (self, new_size, old_size - new_size, FALSE, NULL, 0);
gdk_array(splice) (self, new_size, old_size - new_size, NULL, 0);
}
G_GNUC_UNUSED static void
@@ -243,7 +241,6 @@ gdk_array(append) (GdkArray *self,
gdk_array(splice) (self,
gdk_array(get_size) (self),
0,
FALSE,
#ifdef GDK_ARRAY_BY_VALUE
value,
#else

View File

@@ -27,8 +27,6 @@
#include "gdkintl.h"
#include "gdkcontentproviderimpl.h"
#include "gdk-private.h"
#define GDK_TYPE_CONTENT_PROVIDER_VALUE (gdk_content_provider_value_get_type ())
#define GDK_CONTENT_PROVIDER_VALUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_CONTENT_PROVIDER_VALUE, GdkContentProviderValue))
#define GDK_IS_CONTENT_PROVIDER_VALUE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_CONTENT_PROVIDER_VALUE))
@@ -428,7 +426,7 @@ gdk_content_provider_new_union (GdkContentProvider **providers,
result = g_object_new (GDK_TYPE_CONTENT_PROVIDER_UNION, NULL);
result->n_providers = n_providers;
result->providers = g_memdup2 (providers, sizeof (GdkContentProvider *) * n_providers);
result->providers = g_memdup (providers, sizeof (GdkContentProvider *) * n_providers);
for (i = 0; i < n_providers; i++)
{

View File

@@ -611,7 +611,17 @@ _gdk_device_set_associated_device (GdkDevice *device,
g_return_if_fail (GDK_IS_DEVICE (device));
g_return_if_fail (associated == NULL || GDK_IS_DEVICE (associated));
g_set_object (&device->associated, associated);
if (device->associated == associated)
return;
if (device->associated)
{
g_object_unref (device->associated);
device->associated = NULL;
}
if (associated)
device->associated = g_object_ref (associated);
}
/*

View File

@@ -280,7 +280,7 @@ gdk_draw_context_get_surface (GdkDrawContext *context)
* implementation must use gdk_draw_context_get_frame_region() to query the
* region that must be drawn.
*
* When using GTK, the widget system automatically places calls to
* When using GTK+, the widget system automatically places calls to
* gdk_draw_context_begin_frame() and gdk_draw_context_end_frame() via the
* use of #GskRenderers, so application code does not need to call these
* functions explicitly.

View File

@@ -12,7 +12,7 @@
GType
@enum_name@_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
static volatile gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{

View File

@@ -210,7 +210,7 @@ gdk_event_init (GdkEvent *self)
GType
gdk_event_get_type (void)
{
static gsize event_type__volatile;
static volatile gsize event_type__volatile;
if (g_once_init_enter (&event_type__volatile))
{
@@ -332,7 +332,7 @@ gdk_event_type_register_static (const char *type_name,
info.base_finalize = NULL;
info.class_init = gdk_event_generic_class_init;
info.class_finalize = NULL;
info.class_data = g_memdup2 (type_info, sizeof (GdkEventTypeInfo));
info.class_data = g_memdup (type_info, sizeof (GdkEventTypeInfo));
info.instance_size = type_info->instance_size;
info.n_preallocs = 0;
@@ -374,7 +374,7 @@ static GType gdk_event_types[GDK_EVENT_LAST];
GType \
type_name ## _get_type (void) \
{ \
static gsize gdk_define_event_type_id__volatile; \
static volatile gsize gdk_define_event_type_id__volatile; \
if (g_once_init_enter (&gdk_define_event_type_id__volatile)) \
{ \
GType gdk_define_event_type_id = \
@@ -452,7 +452,7 @@ gdk_event_init_types_once (void)
void
gdk_event_init_types (void)
{
static gsize event_types__volatile;
static volatile gsize event_types__volatile;
if (g_once_init_enter (&event_types__volatile))
{
@@ -1138,22 +1138,6 @@ gdk_event_get_axes (GdkEvent *event,
return GDK_EVENT_GET_CLASS (event)->get_axes (event, axes, n_axes);
}
double *
gdk_event_dup_axes (GdkEvent *event)
{
double *axes;
guint n_axes;
if (gdk_event_get_axes (event, &axes, &n_axes))
{
double *axes_copy = g_memdup2 (axes, n_axes * sizeof (double));
return axes_copy;
}
return NULL;
}
/**
* gdk_event_get_event_type:
* @event: a #GdkEvent
@@ -1330,12 +1314,6 @@ gdk_event_get_position (GdkEvent *event,
/* {{{ GdkButtonEvent */
/**
* GdkButtonEvent:
*
* An event related to a button on a pointer device/
*/
static void
gdk_button_event_finalize (GdkEvent *event)
{
@@ -1460,12 +1438,6 @@ gdk_button_event_get_button (GdkEvent *event)
/* {{{ GdkKeyEvent */
/**
* GdkKeyEvent:
*
* An event related to a key-based device.
*/
static GdkModifierType
gdk_key_event_get_state (GdkEvent *event)
{
@@ -1847,12 +1819,6 @@ gdk_key_event_get_match (GdkEvent *event,
/* {{{ GdkTouchEvent */
/**
* GdkTouchEvent:
*
* An event related to a touch-based device.
*/
static void
gdk_touch_event_finalize (GdkEvent *event)
{
@@ -1984,12 +1950,6 @@ gdk_touch_event_get_emulating_pointer (GdkEvent *event)
/* {{{ GdkCrossingEvent */
/**
* GdkCrossingEvent:
*
* An event caused by a pointing device moving between surfaces.
*/
static void
gdk_crossing_event_finalize (GdkEvent *event)
{
@@ -2128,12 +2088,6 @@ gdk_crossing_event_get_detail (GdkEvent *event)
/* {{{ GdkDeleteEvent */
/**
* GdkDeleteEvent:
*
* An event related to closing a top-level surface.
*/
static const GdkEventTypeInfo gdk_delete_event_info = {
sizeof (GdkDeleteEvent),
NULL,
@@ -2159,12 +2113,6 @@ gdk_delete_event_new (GdkSurface *surface)
/* {{{ GdkFocusEvent */
/**
* GdkFocusEvent:
*
* An event related to a focus change.
*/
static const GdkEventTypeInfo gdk_focus_event_info = {
sizeof (GdkFocusEvent),
NULL,
@@ -2216,12 +2164,6 @@ gdk_focus_event_get_in (GdkEvent *event)
/* {{{ GdkScrollEvent */
/**
* GdkScrollEvent:
*
* An event related to a scrolling motion.
*/
static void
gdk_scroll_event_finalize (GdkEvent *event)
{
@@ -2379,12 +2321,6 @@ gdk_scroll_event_is_stop (GdkEvent *event)
/* {{{ GdkTouchpadEvent */
/**
* GdkTouchpadEvent:
*
* An event related to a touchpad device.
*/
static GdkModifierType
gdk_touchpad_event_get_state (GdkEvent *event)
{
@@ -2581,12 +2517,6 @@ gdk_touchpad_event_get_pinch_scale (GdkEvent *event)
/* {{{ GdkPadEvent */
/**
* GdkPadEvent:
*
* An event related to a pad-based device.
*/
static const GdkEventTypeInfo gdk_pad_event_info = {
sizeof (GdkPadEvent),
NULL,
@@ -2755,12 +2685,6 @@ gdk_pad_event_get_group_mode (GdkEvent *event,
/* {{{ GdkMotionEvent */
/**
* GdkMotionEvent:
*
* An event related to a pointer or touch device motion.
*/
static void
gdk_motion_event_finalize (GdkEvent *event)
{
@@ -2915,12 +2839,6 @@ gdk_event_get_history (GdkEvent *event,
/* {{{ GdkProximityEvent */
/**
* GdkProximityEvent:
*
* An event related to the proximity of a tool to a device.
*/
static void
gdk_proximity_event_finalize (GdkEvent *event)
{
@@ -2978,12 +2896,6 @@ gdk_proximity_event_new (GdkEventType type,
/* {{{ GdkDNDEvent */
/**
* GdkDNDEvent:
*
* An event related to drag and drop operations.
*/
static void
gdk_dnd_event_finalize (GdkEvent *event)
{
@@ -3084,12 +2996,6 @@ gdk_dnd_event_get_drop (GdkEvent *event)
/* {{{ GdkGrabBrokenEvent */
/**
* GdkGrabBrokenEvent:
*
* An event related to a broken windowing system grab.
*/
static const GdkEventTypeInfo gdk_grab_broken_event_info = {
sizeof (GdkGrabBrokenEvent),
NULL,

View File

@@ -476,6 +476,10 @@ GdkEvent * gdk_focus_event_new (GdkSurface *surface,
GdkDevice *device,
gboolean focus_in);
GdkEvent * gdk_configure_event_new (GdkSurface *surface,
int width,
int height);
GdkEvent * gdk_delete_event_new (GdkSurface *surface);
GdkEvent * gdk_scroll_event_new (GdkSurface *surface,
@@ -603,8 +607,6 @@ void _gdk_event_queue_handle_motion_compression (GdkDisplay *display);
void gdk_event_queue_handle_scroll_compression (GdkDisplay *display);
void _gdk_event_queue_flush (GdkDisplay *display);
double * gdk_event_dup_axes (GdkEvent *event);
G_END_DECLS

View File

@@ -107,9 +107,6 @@ make_program (GdkGLContextProgram *program,
glLinkProgram (program->program);
glDetachShader (program->program, vertex_shader);
glDetachShader (program->program, fragment_shader);
glDeleteShader (vertex_shader);
glDeleteShader (fragment_shader);

View File

@@ -271,12 +271,6 @@ gdk_gl_context_upload_texture (GdkGLContext *context,
gl_type = GL_UNSIGNED_BYTE;
bpp = 3;
}
else if (data_format == GDK_MEMORY_B8G8R8)
{
gl_format = GL_BGR;
gl_type = GL_UNSIGNED_BYTE;
bpp = 3;
}
else /* Fall-back, convert to cairo-surface-format */
{
copy = g_malloc (width * height * 4);

View File

@@ -202,7 +202,6 @@ gdk_pixbuf_get_from_surface (cairo_surface_t *surface,
if (cairo_surface_status (surface) || dest == NULL)
{
cairo_surface_destroy (surface);
g_clear_object (&dest);
return NULL;
}

View File

@@ -30,37 +30,6 @@
* Popups are positioned relative to their parent surface.
* The GdkPopupLayout struct contains information that is
* necessary to do so.
*
* The positioning requires a negotiation with the windowing system,
* since it depends on external constraints, such as the position of
* the parent surface, and the screen dimensions.
*
* The basic ingredients are a rectangle on the parent surface,
* and the anchor on both that rectangle and the popup. The anchors
* specify a side or corner to place next to each other.
*
* ![Popup anchors](popup-anchors.png)
*
* For cases where placing the anchors next to each other would make
* the popup extend offscreen, the layout includes some hints for how
* to resolve this problem. The hints may suggest to flip the anchor
* position to the other side, or to 'slide' the popup along a side,
* or to resize it.
*
* ![Flipping popups](popup-flip.png)
*
* ![Sliding popups](popup-slide.png)
*
* These hints may be combined.
*
* Ultimatively, it is up to the windowing system to determine the position
* and size of the popup. You can learn about the result by calling
* gdk_popup_get_position_x(), gdk_popup_get_position_y(),
* gdk_popup_get_rect_anchor() and gdk_popup_get_surface_anchor() after the
* popup has been presented. This can be used to adjust the rendering. For
* example, GtkPopover changes its arrow position accordingly. But you have
* to be careful avoid changing the size of the popover, or it has to be
* presented again.
*/
struct _GdkPopupLayout
@@ -74,10 +43,6 @@ struct _GdkPopupLayout
GdkAnchorHints anchor_hints;
int dx;
int dy;
int shadow_left;
int shadow_right;
int shadow_top;
int shadow_bottom;
};
G_DEFINE_BOXED_TYPE (GdkPopupLayout, gdk_popup_layout,
@@ -169,10 +134,6 @@ gdk_popup_layout_copy (GdkPopupLayout *layout)
new_layout->anchor_hints = layout->anchor_hints;
new_layout->dx = layout->dx;
new_layout->dy = layout->dy;
new_layout->shadow_left = layout->shadow_left;
new_layout->shadow_right = layout->shadow_right;
new_layout->shadow_top = layout->shadow_top;
new_layout->shadow_bottom = layout->shadow_bottom;
return new_layout;
}
@@ -199,11 +160,7 @@ gdk_popup_layout_equal (GdkPopupLayout *layout,
layout->surface_anchor == other->surface_anchor &&
layout->anchor_hints == other->anchor_hints &&
layout->dx == other->dx &&
layout->dy == other->dy &&
layout->shadow_left == other->shadow_left &&
layout->shadow_right == other->shadow_right &&
layout->shadow_top == other->shadow_top &&
layout->shadow_bottom == other->shadow_bottom);
layout->dy == other->dy);
}
/**
@@ -358,59 +315,3 @@ gdk_popup_layout_get_offset (GdkPopupLayout *layout,
if (dy)
*dy = layout->dy;
}
/**
* gdk_popup_layout_set_shadow_width:
* @layout: a #GdkPopupLayout
* @left: width of the left part of the shadow
* @right: width of the right part of the shadow
* @top: height of the top part of the shadow
* @bottom: height of the bottom part of the shadow
*
* The shadow width corresponds to the part of the computed surface size
* that would consist of the shadow margin surrounding the window, would
* there be any.
*
* Since: 4.2
*/
void
gdk_popup_layout_set_shadow_width (GdkPopupLayout *layout,
int left,
int right,
int top,
int bottom)
{
layout->shadow_left = left;
layout->shadow_right = right;
layout->shadow_top = top;
layout->shadow_bottom = bottom;
}
/**
* gdk_popup_layout_get_shadow_width:
* @layout: a #GdkPopupLayout
* @left: (out): return location for the left shadow width
* @right: (out): return location for the right shadow width
* @top: (out): return location for the top shadow width
* @bottom: (out): return location for the bottom shadow width
*
* Obtains the shadow widths of this layout.
*
* Since: 4.2
*/
void
gdk_popup_layout_get_shadow_width (GdkPopupLayout *layout,
int *left,
int *right,
int *top,
int *bottom)
{
if (left)
*left = layout->shadow_left;
if (right)
*right = layout->shadow_right;
if (top)
*top = layout->shadow_top;
if (bottom)
*bottom = layout->shadow_bottom;
}

View File

@@ -137,20 +137,6 @@ void gdk_popup_layout_get_offset (GdkPopupLayout
int *dx,
int *dy);
GDK_AVAILABLE_IN_4_2
void gdk_popup_layout_set_shadow_width (GdkPopupLayout *layout,
int left,
int right,
int top,
int bottom);
GDK_AVAILABLE_IN_4_2
void gdk_popup_layout_get_shadow_width (GdkPopupLayout *layout,
int *left,
int *right,
int *top,
int *bottom);
G_END_DECLS
#endif /* __GDK_POPUP_LAYOUT_H__ */

View File

@@ -73,23 +73,23 @@ void gdk_profiler_set_int_counter (guint id,
gint64 value);
#ifndef HAVE_SYSPROF
#define gdk_profiler_add_mark(b, d, n, m) G_STMT_START {} G_STMT_END
#define gdk_profiler_end_mark(b, n, m) G_STMT_START {} G_STMT_END
#define gdk_profiler_add_mark(b, d, n, m)
#define gdk_profiler_end_mark(b, n, m)
/* Optimise the whole call out */
#if defined(G_HAVE_ISO_VARARGS)
#define gdk_profiler_add_markf(b, d, n, m, ...) G_STMT_START {} G_STMT_END
#define gdk_profiler_end_markf(b, n, m, ...) G_STMT_START {} G_STMT_END
#define gdk_profiler_add_markf(b, d, n, m, ...)
#define gdk_profiler_end_markf(b, n, m, ...)
#elif defined(G_HAVE_GNUC_VARARGS)
#define gdk_profiler_add_markf(b, d, n, m...) G_STMT_START {} G_STMT_END
#define gdk_profiler_end_markf(b, n, m...) G_STMT_START {} G_STMT_END
#define gdk_profiler_add_markf(b, d, n, m...)
#define gdk_profiler_end_markf(b, n, m...)
#else
/* no varargs macro support; the call will have to be optimised out by the compiler */
#endif
#define gdk_profiler_define_counter(n, d) 0
#define gdk_profiler_define_int_counter(n, d) 0
#define gdk_profiler_set_counter(i, v) G_STMT_START {} G_STMT_END
#define gdk_profiler_set_int_counter(i, v) G_STMT_START {} G_STMT_END
#define gdk_profiler_set_counter(i, v)
#define gdk_profiler_set_int_counter(i, v)
#endif
G_END_DECLS

View File

@@ -436,10 +436,9 @@ gdk_seat_tool_removed (GdkSeat *seat,
}
GdkDeviceTool *
gdk_seat_get_tool (GdkSeat *seat,
guint64 serial,
guint64 hw_id,
GdkDeviceToolType type)
gdk_seat_get_tool (GdkSeat *seat,
guint64 serial,
guint64 hw_id)
{
GdkDeviceTool *match = NULL;
GList *tools, *l;
@@ -450,7 +449,7 @@ gdk_seat_get_tool (GdkSeat *seat,
{
GdkDeviceTool *tool = l->data;
if (tool->serial == serial && tool->hw_id == hw_id && tool->type == type)
if (tool->serial == serial && tool->hw_id == hw_id)
{
match = tool;
break;

View File

@@ -49,7 +49,7 @@ struct _GdkSeatDefaultPrivate
G_DEFINE_TYPE_WITH_PRIVATE (GdkSeatDefault, gdk_seat_default, GDK_TYPE_SEAT)
static void
gdk_seat_default_dispose (GObject *object)
gdk_seat_dispose (GObject *object)
{
GdkSeatDefault *seat = GDK_SEAT_DEFAULT (object);
GdkSeatDefaultPrivate *priv = gdk_seat_default_get_instance_private (seat);
@@ -79,7 +79,11 @@ gdk_seat_default_dispose (GObject *object)
g_object_unref (l->data);
}
g_clear_pointer (&priv->tools, g_ptr_array_unref);
if (priv->tools)
{
g_ptr_array_unref (priv->tools);
priv->tools = NULL;
}
g_list_free (priv->physical_pointers);
g_list_free (priv->physical_keyboards);
@@ -303,7 +307,7 @@ gdk_seat_default_class_init (GdkSeatDefaultClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GdkSeatClass *seat_class = GDK_SEAT_CLASS (klass);
object_class->dispose = gdk_seat_default_dispose;
object_class->dispose = gdk_seat_dispose;
seat_class->get_capabilities = gdk_seat_default_get_capabilities;
@@ -438,7 +442,7 @@ gdk_seat_default_remove_tool (GdkSeatDefault *seat,
priv = gdk_seat_default_get_instance_private (seat);
if (tool != gdk_seat_get_tool (GDK_SEAT (seat), tool->serial, tool->hw_id, tool->type))
if (tool != gdk_seat_get_tool (GDK_SEAT (seat), tool->serial, tool->hw_id))
return;
g_signal_emit_by_name (seat, "tool-removed", tool);

View File

@@ -75,10 +75,9 @@ void gdk_seat_tool_removed (GdkSeat *seat,
GdkDeviceTool *tool);
GdkDeviceTool *
gdk_seat_get_tool (GdkSeat *seat,
guint64 serial,
guint64 hw_id,
GdkDeviceToolType type);
gdk_seat_get_tool (GdkSeat *seat,
guint64 serial,
guint64 hw_id);
GdkGrabStatus gdk_seat_grab (GdkSeat *seat,
GdkSurface *surface,

View File

@@ -92,7 +92,6 @@ enum {
PROP_MAPPED,
PROP_WIDTH,
PROP_HEIGHT,
PROP_SCALE_FACTOR,
LAST_PROP
};
@@ -552,13 +551,6 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
0, G_MAXINT, 0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
properties[PROP_SCALE_FACTOR] =
g_param_spec_int ("scale-factor",
P_("Scale factor"),
P_("Scale factor"),
1, G_MAXINT, 1,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, LAST_PROP, properties);
/**
@@ -790,10 +782,6 @@ gdk_surface_get_property (GObject *object,
g_value_set_int (value, surface->height);
break;
case PROP_SCALE_FACTOR:
g_value_set_int (value, gdk_surface_get_scale_factor (surface));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -1368,13 +1356,6 @@ gdk_surface_layout_on_clock (GdkFrameClock *clock,
g_signal_emit (surface, signals[LAYOUT], 0, surface->width, surface->height);
}
/**
* gdk_surface_request_layout:
* @surface: a #GdkSurface
*
* Request a %GDK_FRAME_CLOCK_PHASE_LAYOUT from the surface's
* frame clock. See gdk_frame_clock_request_phase().
*/
void
gdk_surface_request_layout (GdkSurface *surface)
{
@@ -2557,7 +2538,8 @@ gdk_surface_get_frame_clock (GdkSurface *surface)
* value can be used to determine whether to use a pixel resource
* with higher resolution data.
*
* The scale of a surface may change during runtime.
* The scale of a surface may change during runtime, if this happens
* a configure event will be sent to the toplevel surface.
*
* Returns: the scale factor
*/
@@ -2960,8 +2942,8 @@ gdk_surface_request_motion (GdkSurface *surface)
* gdk_surface_translate_coordinates:
* @from: the origin surface
* @to: the target surface
* @x: (inout): coordinates to translate
* @y: (inout): coordinates to translate
* @x: coordinates to translate
* @y: coordinates to translate
*
* Translates the given coordinates from being
* relative to the @from surface to being relative
@@ -2980,18 +2962,9 @@ gdk_surface_translate_coordinates (GdkSurface *from,
double *x,
double *y)
{
double in_x, in_y, out_x, out_y;
int x1, y1, x2, y2;
GdkSurface *f, *t;
g_return_val_if_fail (GDK_IS_SURFACE (from), FALSE);
g_return_val_if_fail (GDK_IS_SURFACE (to), FALSE);
g_return_val_if_fail (x != NULL, FALSE);
g_return_val_if_fail (y != NULL, FALSE);
in_x = *x;
in_y = *y;
x1 = 0;
y1 = 0;
f = from;
@@ -3015,11 +2988,8 @@ gdk_surface_translate_coordinates (GdkSurface *from,
if (f != t)
return FALSE;
out_x = in_x + (x1 - x2);
out_y = in_y + (y1 - y2);
*x = out_x;
*y = out_y;
*x += x1 - x2;
*y += y1 - y2;
return TRUE;
}

View File

@@ -316,9 +316,9 @@ gdk_texture_new_for_pixbuf (GdkPixbuf *pixbuf)
* @resource_path: the path of the resource file
*
* Creates a new texture by loading an image from a resource.
* The file format is detected automatically.
* The supported formats are PNG and JPEG, though more formats might be
* available.
* The file format is detected automatically, and can be any
* format that is supported by the gdk-pixbuf library, such as
* JPEG or PNG.
*
* It is a fatal error if @resource_path does not specify a valid
* image resource and the program will abort if that happens.
@@ -352,9 +352,9 @@ gdk_texture_new_from_resource (const char *resource_path)
* @error: Return location for an error
*
* Creates a new texture by loading an image from a file.
* The file format is detected automatically.
* The supported formats are PNG and JPEG, though more formats might be
* available.
* The file format is detected automatically, and can be any
* format that is supported by the gdk-pixbuf library, such as
* JPEG or PNG.
*
* If %NULL is returned, then @error will be set.
*

View File

@@ -40,10 +40,7 @@ struct _GdkToplevelLayout
grefcount ref_count;
guint resizable : 1;
guint maximized_valid : 1;
guint maximized : 1;
guint fullscreen_valid : 1;
guint fullscreen : 1;
GdkMonitor *fullscreen_monitor;
};
@@ -73,9 +70,7 @@ gdk_toplevel_layout_new (void)
layout = g_new0 (GdkToplevelLayout, 1);
g_ref_count_init (&layout->ref_count);
layout->resizable = TRUE;
layout->maximized_valid = FALSE;
layout->maximized = FALSE;
layout->fullscreen_valid = FALSE;
layout->fullscreen = FALSE;
layout->fullscreen_monitor = NULL;
@@ -130,9 +125,7 @@ gdk_toplevel_layout_copy (GdkToplevelLayout *layout)
g_ref_count_init (&new_layout->ref_count);
new_layout->resizable = layout->resizable;
new_layout->maximized_valid = layout->maximized_valid;
new_layout->maximized = layout->maximized;
new_layout->fullscreen_valid = layout->fullscreen_valid;
new_layout->fullscreen = layout->fullscreen;
if (layout->fullscreen_monitor)
new_layout->fullscreen_monitor = g_object_ref (layout->fullscreen_monitor);
@@ -158,9 +151,7 @@ gdk_toplevel_layout_equal (GdkToplevelLayout *layout,
g_return_val_if_fail (other, FALSE);
return layout->resizable == other->resizable &&
layout->maximized_valid == other->maximized_valid &&
layout->maximized == other->maximized &&
layout->fullscreen_valid == other->fullscreen_valid &&
layout->fullscreen == other->fullscreen &&
layout->fullscreen_monitor == other->fullscreen_monitor;
}
@@ -207,32 +198,22 @@ void
gdk_toplevel_layout_set_maximized (GdkToplevelLayout *layout,
gboolean maximized)
{
layout->maximized_valid = TRUE;
layout->maximized = maximized;
}
/**
* gdk_toplevel_layout_get_maximized:
* @layout: a #GdkToplevelLayout
* @maximized: (out): set to %TRUE if the toplevel should be maximized
*
* If the layout specifies whether to the toplevel should go maximized,
* the value pointed to by @maximized is set to %TRUE if it should go
* fullscreen, or %FALSE, if it should go unmaximized.
* Returns whether the layout should present the
* surface as maximized.
*
* Returns: whether the @layout specifies the maximized state for the toplevel
* Returns: %TRUE if the layout is maximized
*/
gboolean
gdk_toplevel_layout_get_maximized (GdkToplevelLayout *layout,
gboolean *maximized)
gdk_toplevel_layout_get_maximized (GdkToplevelLayout *layout)
{
if (layout->maximized_valid)
{
*maximized = layout->maximized;
return TRUE;
}
return FALSE;
return layout->maximized;
}
/**
@@ -249,7 +230,6 @@ gdk_toplevel_layout_set_fullscreen (GdkToplevelLayout *layout,
gboolean fullscreen,
GdkMonitor *monitor)
{
layout->fullscreen_valid = TRUE;
layout->fullscreen = fullscreen;
if (monitor)
layout->fullscreen_monitor = g_object_ref (monitor);
@@ -258,25 +238,16 @@ gdk_toplevel_layout_set_fullscreen (GdkToplevelLayout *layout,
/**
* gdk_toplevel_layout_get_fullscreen:
* @layout: a #GdkToplevelLayout
* @fullscreen: (out): location to store whether the toplevel should be fullscreen
*
* If the layout specifies whether to the toplevel should go fullscreen,
* the value pointed to by @fullscreen is set to %TRUE if it should go
* fullscreen, or %FALSE, if it should go unfullscreen.
* Returns whether the layout should cause the surface
* to be fullscreen when presented.
*
* Returns: whether the @layout specifies the fullscreen state for the toplevel
* Returns: %TRUE if @layout is fullscreen
*/
gboolean
gdk_toplevel_layout_get_fullscreen (GdkToplevelLayout *layout,
gboolean *fullscreen)
gdk_toplevel_layout_get_fullscreen (GdkToplevelLayout *layout)
{
if (layout->fullscreen_valid)
{
*fullscreen = layout->fullscreen;
return TRUE;
}
return FALSE;
return layout->fullscreen;
}
/**

View File

@@ -66,12 +66,10 @@ void gdk_toplevel_layout_set_fullscreen (GdkToplevelLayout *l
GdkMonitor *monitor);
GDK_AVAILABLE_IN_ALL
gboolean gdk_toplevel_layout_get_maximized (GdkToplevelLayout *layout,
gboolean *maximized);
gboolean gdk_toplevel_layout_get_maximized (GdkToplevelLayout *layout);
GDK_AVAILABLE_IN_ALL
gboolean gdk_toplevel_layout_get_fullscreen (GdkToplevelLayout *layout,
gboolean *fullscreen);
gboolean gdk_toplevel_layout_get_fullscreen (GdkToplevelLayout *layout);
GDK_AVAILABLE_IN_ALL
GdkMonitor * gdk_toplevel_layout_get_fullscreen_monitor (GdkToplevelLayout *layout);

View File

@@ -149,6 +149,12 @@ gdk_toplevel_size_validate (GdkToplevelSize *size)
{
int geometry_width, geometry_height;
if (size->min_width > size->bounds_width ||
size->min_height > size->bounds_height)
g_warning ("GdkToplevelSize: min_size (%d, %d) exceeds bounds (%d, %d)",
size->min_width, size->min_height,
size->bounds_width, size->bounds_height);
geometry_width = size->width;
geometry_height = size->height;
if (size->shadow.is_valid)
@@ -156,4 +162,15 @@ gdk_toplevel_size_validate (GdkToplevelSize *size)
geometry_width -= size->shadow.left + size->shadow.right;
geometry_height -= size->shadow.top + size->shadow.bottom;
}
if (geometry_width > size->bounds_width ||
geometry_height > size->bounds_height)
g_warning ("GdkToplevelSize: geometry size (%d, %d) exceeds bounds (%d, %d)",
size->width, size->height,
size->bounds_width, size->bounds_height);
if (size->min_width > size->width ||
size->min_height > size->height)
g_warning ("GdkToplevelSize: min_size (%d, %d) exceeds size (%d, %d)",
size->min_width, size->min_height,
size->width, size->height);
}

View File

@@ -99,6 +99,7 @@ typedef struct _GdkAppLaunchContext GdkAppLaunchContext;
typedef struct _GdkSeat GdkSeat;
typedef struct _GdkSnapshot GdkSnapshot;
typedef struct _GdkDrawingContext GdkDrawingContext;
typedef struct _GdkDrawContext GdkDrawContext;
typedef struct _GdkCairoContext GdkCairoContext;
typedef struct _GdkGLContext GdkGLContext;

View File

@@ -24,25 +24,8 @@
#include <glib.h>
/**
* GDK_MAJOR_VERSION:
*
* The major version component of the library's version, e.g. "1" for "1.2.3".
*/
#define GDK_MAJOR_VERSION (@GTK_MAJOR_VERSION@)
/**
* GDK_MINOR_VERSION:
*
* The minor version component of the library's version, e.g. "2" for "1.2.3".
*/
#define GDK_MINOR_VERSION (@GTK_MINOR_VERSION@)
/**
* GDK_MICRO_VERSION:
*
* The micro version component of the library's version, e.g. "3" for "1.2.3".
*/
#define GDK_MICRO_VERSION (@GTK_MICRO_VERSION@)
#ifndef _GDK_EXTERN
@@ -78,14 +61,6 @@
*/
#define GDK_VERSION_4_0 (G_ENCODE_VERSION (4, 0))
/**
* GDK_VERSION_4_2:
*
* A macro that evaluates to the 4.2 version of GDK, in a format
* that can be used by the C pre-processor.
*/
#define GDK_VERSION_4_2 (G_ENCODE_VERSION (4, 2))
/* evaluates to the current stable version; for development cycles,
* this means the next stable target, with a hard backstop to the
@@ -183,19 +158,4 @@
# define GDK_DEPRECATED_IN_4_0_FOR(f) _GDK_EXTERN
#endif
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_4_2
# define GDK_AVAILABLE_IN_4_2 GDK_UNAVAILABLE(4, 2)
#else
# define GDK_AVAILABLE_IN_4_2 _GDK_EXTERN
#endif
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_4_2
# define GDK_DEPRECATED_IN_4_2 GDK_DEPRECATED
# define GDK_DEPRECATED_IN_4_2_FOR(f) GDK_DEPRECATED_FOR(f)
#else
# define GDK_DEPRECATED_IN_4_2 _GDK_EXTERN
# define GDK_DEPRECATED_IN_4_2_FOR(f) _GDK_EXTERN
#endif
#endif /* __GDK_VERSION_MACROS_H__ */

View File

@@ -210,10 +210,8 @@ gdk_vulkan_strerror (VkResult result)
return "An unknown error has occurred; either the application has provided invalid input, or an implementation failure has occurred.";
#endif
#if VK_HEADER_VERSION >= 135
#if VK_HEADER_VERSION < 162
case VK_ERROR_INCOMPATIBLE_VERSION_KHR:
return "This error was removed by the Vulkan gods.";
#endif
return "Acceleration structure serialized with version as the version information is not compatible with device.";
case VK_THREAD_IDLE_KHR:
return "A deferred operation is not complete but there is currently no work for this thread to do at the time of this call.";
case VK_THREAD_DONE_KHR:

View File

@@ -38,10 +38,6 @@
#include "gdkmonitorprivate.h"
#include "gdksurfaceprivate.h"
#ifndef AVAILABLE_MAC_OS_X_VERSION_10_15_AND_LATER
typedef NSString *CALayerContentsGravity;
#endif
@implementation GdkMacosWindow
-(BOOL)windowShouldClose:(id)sender
@@ -470,7 +466,7 @@ typedef NSString *CALayerContentsGravity;
inTrackManualResize = YES;
mouse_location = convert_nspoint_to_screen (self, [self mouseLocationOutsideOfEventStream]);
mouse_location = [self convertPointToScreen:[self mouseLocationOutsideOfEventStream]];
mdx = initialResizeLocation.x - mouse_location.x;
mdy = initialResizeLocation.y - mouse_location.y;
@@ -592,7 +588,7 @@ typedef NSString *CALayerContentsGravity;
}
initialResizeFrame = [self frame];
initialResizeLocation = convert_nspoint_to_screen (self, [self mouseLocationOutsideOfEventStream]);
initialResizeLocation = [self convertPointToScreen:[self mouseLocationOutsideOfEventStream]];
}
-(NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender

View File

@@ -27,10 +27,6 @@
G_BEGIN_DECLS
#ifndef AVAILABLE_MAC_OS_X_VERSION_10_13_AND_LATER
typedef NSString *NSPasteboardType;
#endif
#define GDK_TYPE_MACOS_CLIPBOARD (_gdk_macos_clipboard_get_type())
G_DECLARE_FINAL_TYPE (GdkMacosClipboard, _gdk_macos_clipboard, GDK, MACOS_CLIPBOARD, GdkClipboard)

View File

@@ -23,7 +23,6 @@
#include "gdkmacosclipboard-private.h"
#include "gdkmacosutils-private.h"
#include "gdk-private.h"
struct _GdkMacosClipboard
{
@@ -41,56 +40,8 @@ typedef struct
guint done : 1;
} WriteRequest;
enum {
TYPE_STRING,
TYPE_PBOARD,
TYPE_URL,
TYPE_FILE_URL,
TYPE_COLOR,
TYPE_TIFF,
TYPE_PNG,
TYPE_LAST
};
#define PTYPE(k) (get_pasteboard_type(TYPE_##k))
static NSPasteboardType pasteboard_types[TYPE_LAST];
G_DEFINE_TYPE (GdkMacosClipboard, _gdk_macos_clipboard, GDK_TYPE_CLIPBOARD)
static NSPasteboardType
get_pasteboard_type (int type)
{
static gsize initialized = FALSE;
g_assert (type >= 0);
g_assert (type < TYPE_LAST);
if (g_once_init_enter (&initialized))
{
pasteboard_types[TYPE_PNG] = NSPasteboardTypePNG;
pasteboard_types[TYPE_STRING] = NSPasteboardTypeString;
pasteboard_types[TYPE_TIFF] = NSPasteboardTypeTIFF;
pasteboard_types[TYPE_COLOR] = NSPasteboardTypeColor;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
pasteboard_types[TYPE_PBOARD] = NSStringPboardType;
G_GNUC_END_IGNORE_DEPRECATIONS
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_13_AND_LATER
pasteboard_types[TYPE_URL] = NSPasteboardTypeURL;
pasteboard_types[TYPE_FILE_URL] = NSPasteboardTypeFileURL;
#else
pasteboard_types[TYPE_URL] = [[NSString alloc] initWithUTF8String:"public.url"];
pasteboard_types[TYPE_FILE_URL] = [[NSString alloc] initWithUTF8String:"public.file-url"];
#endif
g_once_init_leave (&initialized, TRUE);
}
return pasteboard_types[type];
}
static void
write_request_free (WriteRequest *wr)
{
@@ -105,17 +56,17 @@ _gdk_macos_clipboard_from_ns_type (NSPasteboardType type)
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
if ([type isEqualToString:PTYPE(STRING)] ||
[type isEqualToString:PTYPE(PBOARD)])
if ([type isEqualToString:NSPasteboardTypeString] ||
[type isEqualToString:NSStringPboardType])
return g_intern_string ("text/plain;charset=utf-8");
else if ([type isEqualToString:PTYPE(URL)] ||
[type isEqualToString:PTYPE(FILE_URL)])
else if ([type isEqualToString:NSPasteboardTypeURL] ||
[type isEqualToString:NSPasteboardTypeFileURL])
return g_intern_string ("text/uri-list");
else if ([type isEqualToString:PTYPE(COLOR)])
else if ([type isEqualToString:NSPasteboardTypeColor])
return g_intern_string ("application/x-color");
else if ([type isEqualToString:PTYPE(TIFF)])
else if ([type isEqualToString:NSPasteboardTypeTIFF])
return g_intern_string ("image/tiff");
else if ([type isEqualToString:PTYPE(PNG)])
else if ([type isEqualToString:NSPasteboardTypePNG])
return g_intern_string ("image/png");
G_GNUC_END_IGNORE_DEPRECATIONS;
@@ -132,25 +83,25 @@ _gdk_macos_clipboard_to_ns_type (const char *mime_type,
if (g_strcmp0 (mime_type, "text/plain;charset=utf-8") == 0)
{
return PTYPE(STRING);
return NSPasteboardTypeString;
}
else if (g_strcmp0 (mime_type, "text/uri-list") == 0)
{
if (alternate)
*alternate = PTYPE(URL);
return PTYPE(FILE_URL);
*alternate = NSPasteboardTypeURL;
return NSPasteboardTypeFileURL;
}
else if (g_strcmp0 (mime_type, "application/x-color") == 0)
{
return PTYPE(COLOR);
return NSPasteboardTypeColor;
}
else if (g_strcmp0 (mime_type, "image/tiff") == 0)
{
return PTYPE(TIFF);
return NSPasteboardTypeTIFF;
}
else if (g_strcmp0 (mime_type, "image/png") == 0)
{
return PTYPE(PNG);
return NSPasteboardTypePNG;
}
return nil;
@@ -214,7 +165,7 @@ create_stream_from_nsdata (NSData *data)
const guint8 *bytes = [data bytes];
gsize len = [data length];
return g_memory_input_stream_new_from_data (g_memdup2 (bytes, len), len, g_free);
return g_memory_input_stream_new_from_data (g_memdup (bytes, len), len, g_free);
}
static void
@@ -269,7 +220,7 @@ _gdk_macos_clipboard_read_async (GdkClipboard *clipboard,
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
if ([[self->pasteboard types] containsObject:PTYPE(FILE_URL)])
if ([[self->pasteboard types] containsObject:NSPasteboardTypeFileURL])
{
GString *str = g_string_new (NULL);
NSArray *files = [self->pasteboard propertyListForType:NSFilenamesPboardType];
@@ -310,18 +261,18 @@ _gdk_macos_clipboard_read_async (GdkClipboard *clipboard,
color[2] = 0xffff * [nscolor blueComponent];
color[3] = 0xffff * [nscolor alphaComponent];
stream = g_memory_input_stream_new_from_data (g_memdup2 (&color, sizeof color),
stream = g_memory_input_stream_new_from_data (g_memdup (&color, sizeof color),
sizeof color,
g_free);
}
else if (strcmp (mime_type, "image/tiff") == 0)
{
NSData *data = [self->pasteboard dataForType:PTYPE(TIFF)];
NSData *data = [self->pasteboard dataForType:NSPasteboardTypeTIFF];
stream = create_stream_from_nsdata (data);
}
else if (strcmp (mime_type, "image/png") == 0)
{
NSData *data = [self->pasteboard dataForType:PTYPE(PNG)];
NSData *data = [self->pasteboard dataForType:NSPasteboardTypePNG];
stream = create_stream_from_nsdata (data);
}

View File

@@ -28,7 +28,6 @@
#include "gdkmacosdisplay-private.h"
#include "gdkmacoskeymap-private.h"
#include "gdkmacossurface-private.h"
#include "gdkmacosseat-private.h"
#define GDK_MOD2_MASK (1 << 4)
#define GRIP_WIDTH 15
@@ -206,9 +205,6 @@ fill_button_event (GdkMacosDisplay *display,
GdkSeat *seat;
GdkEventType type;
GdkModifierType state;
GdkDevice *pointer = NULL;
GdkDeviceTool *tool = NULL;
double *axes = NULL;
g_assert (GDK_IS_MACOS_DISPLAY (display));
g_assert (GDK_IS_MACOS_SURFACE (surface));
@@ -245,22 +241,16 @@ fill_button_event (GdkMacosDisplay *display,
y < 0 || y > GDK_SURFACE (surface)->height))
return NULL;
if (([nsevent subtype] == NSEventSubtypeTabletPoint) &&
_gdk_macos_seat_get_tablet (GDK_MACOS_SEAT (seat), &pointer, &tool))
axes = _gdk_macos_seat_get_tablet_axes_from_nsevent (GDK_MACOS_SEAT (seat), nsevent);
else
pointer = gdk_seat_get_pointer (seat);
return gdk_button_event_new (type,
GDK_SURFACE (surface),
pointer,
tool,
gdk_seat_get_pointer (seat),
NULL,
get_time_from_ns_event (nsevent),
state,
get_mouse_button_from_ns_event (nsevent),
x,
y,
axes);
NULL);
}
static GdkEvent *
@@ -567,9 +557,6 @@ fill_motion_event (GdkMacosDisplay *display,
{
GdkSeat *seat;
GdkModifierType state;
GdkDevice *pointer = NULL;
GdkDeviceTool *tool = NULL;
double *axes = NULL;
g_assert (GDK_IS_MACOS_SURFACE (surface));
g_assert (nsevent != NULL);
@@ -579,20 +566,14 @@ fill_motion_event (GdkMacosDisplay *display,
state = get_keyboard_modifiers_from_ns_event (nsevent) |
_gdk_macos_display_get_current_mouse_modifiers (display);
if (([nsevent subtype] == NSEventSubtypeTabletPoint) &&
_gdk_macos_seat_get_tablet (GDK_MACOS_SEAT (seat), &pointer, &tool))
axes = _gdk_macos_seat_get_tablet_axes_from_nsevent (GDK_MACOS_SEAT (seat), nsevent);
else
pointer = gdk_seat_get_pointer (seat);
return gdk_motion_event_new (GDK_SURFACE (surface),
pointer,
tool,
gdk_seat_get_pointer (seat),
NULL,
get_time_from_ns_event (nsevent),
state,
x,
y,
axes);
NULL);
}
static GdkEvent *
@@ -719,7 +700,7 @@ get_surface_point_from_screen_point (GdkSurface *surface,
NSPoint point;
nswindow = _gdk_macos_surface_get_native (GDK_MACOS_SURFACE (surface));
point = convert_nspoint_from_screen (nswindow, screen_point);
point = [nswindow convertPointFromScreen:screen_point];
*x = point.x;
*y = surface->height - point.y;
@@ -781,7 +762,7 @@ get_surface_from_ns_event (GdkMacosDisplay *self,
GdkSurface *surface = NULL;
NSWindow *nswindow = [nsevent window];
if (GDK_IS_MACOS_WINDOW (nswindow))
if (nswindow)
{
GdkMacosBaseView *view;
NSPoint point, view_point;
@@ -840,7 +821,7 @@ get_surface_from_ns_event (GdkMacosDisplay *self,
}
else
{
*screen_point = convert_nspoint_to_screen ([nsevent window], point);
*screen_point = [(GdkMacosWindow *)[nsevent window] convertPointToScreen:point];
*x = point.x;
*y = surface->height - point.y;
}
@@ -993,11 +974,11 @@ find_surface_for_ns_event (GdkMacosDisplay *self,
g_assert (x != NULL);
g_assert (y != NULL);
view = (GdkMacosBaseView *)[[nsevent window] contentView];
if (!(surface = get_surface_from_ns_event (self, nsevent, &point, x, y)))
return NULL;
view = (GdkMacosBaseView *)[GDK_MACOS_SURFACE (surface)->window contentView];
_gdk_macos_display_from_display_coords (self, point.x, point.y, &x_tmp, &y_tmp);
switch ((int)[nsevent type])
@@ -1070,23 +1051,6 @@ _gdk_macos_display_translate (GdkMacosDisplay *self,
return NULL;
}
/* We need to register the proximity event from any point on the screen
* to properly register the devices
* FIXME: is there a better way to detect if a tablet has been plugged?
*/
if (event_type == NSEventTypeTabletProximity)
{
GdkSeat *seat = gdk_display_get_default_seat (GDK_DISPLAY (self));
_gdk_macos_seat_handle_tablet_tool_event (GDK_MACOS_SEAT (seat), nsevent);
/* FIXME: we might want to cache this proximity event and propagate it
* but proximity events in gdk work at a window level while on macos
* works at a screen level. For now we just skip them.
*/
return NULL;
}
if (!(surface = find_surface_for_ns_event (self, nsevent, &x, &y)))
return NULL;

View File

@@ -547,20 +547,6 @@ _gdk_macos_display_surface_resigned_key (GdkMacosDisplay *self,
_gdk_macos_display_clear_sorting (self);
}
/* Raises a transient window.
*/
static void
raise_transient (GdkMacosSurface *surface)
{
GdkMacosSurface *parent_surface = GDK_MACOS_SURFACE (GDK_SURFACE (surface)->transient_for);
NSWindow *parent = _gdk_macos_surface_get_native (parent_surface);
NSWindow *window = _gdk_macos_surface_get_native (surface);
[parent removeChildWindow:window];
[parent addChildWindow:window ordered:NSWindowAbove];
}
void
_gdk_macos_display_surface_became_main (GdkMacosDisplay *self,
GdkMacosSurface *surface)
@@ -573,9 +559,6 @@ _gdk_macos_display_surface_became_main (GdkMacosDisplay *self,
g_queue_push_head_link (&self->main_surfaces, &surface->main);
if (GDK_SURFACE (surface)->transient_for)
raise_transient (surface);
_gdk_macos_display_clear_sorting (self);
}

View File

@@ -45,6 +45,7 @@ struct _GdkMacosGLContext
NSView *dummy_view;
cairo_region_t *damage;
cairo_rectangle_int_t flush_rect;
guint is_attached : 1;
guint needs_resize : 1;

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