Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 937ccf152b |
+3
-45
@@ -21,12 +21,12 @@ stages:
|
||||
|
||||
# Common variables
|
||||
variables:
|
||||
COMMON_MESON_FLAGS: "-Dwerror=true -Dglib:werror=false -Dpango:werror=false -Dgtk-doc:werror=false -Dwayland-protocols:werror=false -Dsysprof:werror=false -Dwayland:werror=false"
|
||||
COMMON_MESON_FLAGS: "-Dwerror=true -Dglib:werror=false -Dpango:werror=false -Dgtk-doc:werror=false -Dwayland-protocols:werror=false -Dsysprof:werror=false"
|
||||
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:v38"
|
||||
FLATPAK_IMAGE: "quay.io/gnome_infrastructure/gnome-runtime-images:gnome-master"
|
||||
FLATPAK_IMAGE: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master"
|
||||
|
||||
.only-default:
|
||||
only:
|
||||
@@ -58,7 +58,6 @@ style-check-diff:
|
||||
- "${CI_PROJECT_DIR}/_build/report*.xml"
|
||||
- "${CI_PROJECT_DIR}/_build/report*.html"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/reftests/output/*/*.png"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/reftests/output/*/*.node"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/tools/output/*/*"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/gsk/compare/*/*/*.png"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/css/output/*/*.syscap"
|
||||
@@ -109,29 +108,6 @@ release-build:
|
||||
- ninja -C _build
|
||||
- .gitlab-ci/run-tests.sh _build x11
|
||||
|
||||
fedora-mingw64:
|
||||
extends: .build-fedora-default
|
||||
stage: build
|
||||
needs: []
|
||||
before_script:
|
||||
- sudo dnf install -y
|
||||
mingw64-filesystem
|
||||
mingw64-gcc
|
||||
mingw64-binutils
|
||||
mingw64-cairo
|
||||
mingw64-gdk-pixbuf
|
||||
mingw64-gstreamer1-plugins-bad-free
|
||||
mingw64-glib2
|
||||
mingw64-libepoxy
|
||||
mingw64-pango
|
||||
# mingw64-graphene (rawhide)
|
||||
script:
|
||||
- .gitlab-ci/show-info-linux.sh
|
||||
- meson subprojects update
|
||||
- mkdir _build && cd _build
|
||||
- mingw64-meson -Dintrospection=disabled -Dgraphene:introspection=disabled
|
||||
- ninja
|
||||
|
||||
installed-tests:
|
||||
extends: .build-fedora-default
|
||||
stage: build
|
||||
@@ -196,7 +172,7 @@ macos:
|
||||
needs: []
|
||||
before_script:
|
||||
- bash .gitlab-ci/show-info-osx.sh
|
||||
- pip3 install --user meson==0.60.3
|
||||
- pip3 install --user meson==0.59
|
||||
- pip3 install --user ninja
|
||||
- export PATH=/Users/gitlabrunner/Library/Python/3.7/bin:$PATH
|
||||
- export MESON_FORCE_BACKTRACE=1
|
||||
@@ -292,18 +268,6 @@ flatpak-main:icon-browser:
|
||||
variables:
|
||||
APPID: org.gtk.IconBrowser4
|
||||
|
||||
flatpak-manual:node-editor:
|
||||
extends: .flatpak-manual
|
||||
needs: []
|
||||
variables:
|
||||
APPID: org.gtk.gtk4.NodeEditor
|
||||
|
||||
flatpak-main:node-editor:
|
||||
extends: .flatpak-main
|
||||
needs: []
|
||||
variables:
|
||||
APPID: org.gtk.gtk4.NodeEditor
|
||||
|
||||
# Publish the demo apps to the GNOME Nightly repo
|
||||
# https://wiki.gnome.org/Apps/Nightly
|
||||
# https://gitlab.gnome.org/GNOME/Initiatives/-/wikis/DevOps-with-Flatpak
|
||||
@@ -322,11 +286,6 @@ nightly icon-browser:
|
||||
dependencies: ['flatpak-main:icon-browser']
|
||||
needs: ['flatpak-main:icon-browser']
|
||||
|
||||
nightly node-editor:
|
||||
extends: '.publish_nightly'
|
||||
dependencies: ['flatpak-main:node-editor']
|
||||
needs: ['flatpak-main:node-editor']
|
||||
|
||||
static-scan:
|
||||
image: $FEDORA_IMAGE
|
||||
stage: analysis
|
||||
@@ -386,7 +345,6 @@ reference:
|
||||
- _reference
|
||||
|
||||
publish-docs:
|
||||
image: fedora:latest
|
||||
stage: publish
|
||||
needs: ['reference']
|
||||
script:
|
||||
|
||||
@@ -16,9 +16,10 @@ flatpak-builder \
|
||||
flatpak build ${builddir} meson \
|
||||
--prefix=/app \
|
||||
--libdir=/app/lib \
|
||||
--buildtype=debugoptimized \
|
||||
--buildtype=release \
|
||||
-Dx11-backend=true \
|
||||
-Dwayland-backend=true \
|
||||
-Dprint-backends=file \
|
||||
-Dbuild-tests=false \
|
||||
-Dbuild-examples=false \
|
||||
-Dintrospection=disabled \
|
||||
|
||||
@@ -185,8 +185,6 @@ ul.images li {
|
||||
<li><img alt="ref" src="{{ failure.image_data.ref }}" /></li>
|
||||
<li><img alt="out" src="{{ failure.image_data.out }}" /></li>
|
||||
<li><img alt="diff" src="{{ failure.image_data.diff }}" /></li>
|
||||
<li><a href="{{ failure.image_data.refnode }}">ref node</a></li>
|
||||
<li><a href="{{ failure.image_data.outnode }}">out node</a></li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
@@ -313,8 +311,6 @@ for line in args.infile:
|
||||
image_data = {
|
||||
'ref': os.path.join(args.reftest_output_dir, '{}.ref.png'.format(basename)),
|
||||
'out': os.path.join(args.reftest_output_dir, '{}.out.png'.format(basename)),
|
||||
'refnode': os.path.join(args.reftest_output_dir, '{}.ref.node'.format(basename)),
|
||||
'outnode': os.path.join(args.reftest_output_dir, '{}.out.node'.format(basename)),
|
||||
'diff': os.path.join(args.reftest_output_dir, '{}.diff.png'.format(basename)),
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliar
|
||||
@echo on
|
||||
|
||||
:: FIXME: make warnings fatal
|
||||
pip3 install --upgrade --user meson==0.60.3 || goto :error
|
||||
pip3 install --upgrade --user meson==0.59 || goto :error
|
||||
meson -Ddebug=false -Dmedia-gstreamer=disabled _build || goto :error
|
||||
ninja -C _build || goto :error
|
||||
|
||||
|
||||
@@ -38,6 +38,25 @@ mkdir -p _ccache
|
||||
export CCACHE_BASEDIR="$(pwd)"
|
||||
export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
|
||||
|
||||
# https://gitlab.gnome.org/GNOME/gtk/-/issues/2243
|
||||
# https://gitlab.gnome.org/GNOME/gtk/-/issues/3002
|
||||
|
||||
if ! pkg-config --atleast-version=2.66.0 glib-2.0; then
|
||||
git clone https://gitlab.gnome.org/GNOME/glib.git _glib
|
||||
meson setup _glib_build _glib
|
||||
meson compile -C _glib_build
|
||||
meson install -C _glib_build
|
||||
fi
|
||||
pkg-config --modversion glib-2.0
|
||||
|
||||
if ! pkg-config --atleast-version=1.50.0 pango; then
|
||||
git clone https://gitlab.gnome.org/GNOME/pango.git _pango
|
||||
meson setup _pango_build _pango
|
||||
meson compile -C _pango_build
|
||||
meson install -C _pango_build
|
||||
fi
|
||||
pkg-config --modversion pango
|
||||
|
||||
# Build
|
||||
ccache --zero-stats
|
||||
ccache --show-stats
|
||||
|
||||
@@ -1,232 +1,3 @@
|
||||
Overview of Changes in 4.8.0, 06-09-2022
|
||||
========================================
|
||||
|
||||
* GtkTreeView:
|
||||
- Fix a problem with scrolling animations
|
||||
- Fix some event handling problems
|
||||
- Drop unreachable code
|
||||
|
||||
* GtkText:
|
||||
- Respect the no-emoji input hint fully
|
||||
|
||||
* GtkEmojiChooser:
|
||||
- Fix arrow key navigation
|
||||
|
||||
* GtkFontChooser:
|
||||
- Improve the handling of OpenType font features
|
||||
|
||||
* GtkTreeListModel:
|
||||
- Fix handling of collapsed child nodes
|
||||
|
||||
* GtkInscription:
|
||||
- Fix accessible name
|
||||
|
||||
* Theme:
|
||||
- Fix placeholder text in HighContrast
|
||||
|
||||
* Increase the memory limit for the jpeg loader to 300M
|
||||
|
||||
* Miscellaneous memory leak fixes
|
||||
|
||||
* Wayland:
|
||||
- Refator handling of text protocol client updates
|
||||
|
||||
* Windows:
|
||||
- Support high-resolution scroll wheel events
|
||||
- Generate GdkWin32.gir
|
||||
- Implement color picking
|
||||
|
||||
* Translation updates
|
||||
Abkhazian
|
||||
Basque
|
||||
Brazilian Portuguese
|
||||
Bulgarian
|
||||
Catalan
|
||||
Chinese (China)
|
||||
Croatian
|
||||
Czech
|
||||
Danish
|
||||
Dutch
|
||||
Galician
|
||||
Georgian
|
||||
German
|
||||
Hungarian
|
||||
Icelandic
|
||||
Indonesian
|
||||
Korean
|
||||
Latvian
|
||||
Lithuanian
|
||||
Persian
|
||||
Polish
|
||||
Portuguese
|
||||
Russian
|
||||
Serbian
|
||||
Spanish
|
||||
Swedish
|
||||
Turkish
|
||||
Ukrainian
|
||||
|
||||
|
||||
Overview of Changes in 4.7.2, 10-08-2022
|
||||
========================================
|
||||
|
||||
* GtkTextView:
|
||||
- Fix child positioning with gutters
|
||||
|
||||
* GtkText:
|
||||
- Update placeholder visibility when necessary
|
||||
|
||||
* GtkPicture:
|
||||
- Add a content-fit property
|
||||
|
||||
* GtkPopover:
|
||||
- Fix a size allocation problem with the arrow
|
||||
|
||||
* GtkTreeView:
|
||||
- Fix a problem with DND
|
||||
|
||||
* GtkTreePopover:
|
||||
- Support scrolling
|
||||
|
||||
* GtkGridView:
|
||||
- Fix issues with rubberband selection
|
||||
|
||||
* GtkLabel:
|
||||
- Add a tabs property
|
||||
|
||||
* GtkSnapshot:
|
||||
- Make GtkSnapshot work from bindings
|
||||
|
||||
* GtkScrolledWindow:
|
||||
- Scroll at a reasonable speed
|
||||
|
||||
* GtkPaned:
|
||||
- Avoid an infinite loop
|
||||
|
||||
* GtkWindow:
|
||||
- Improve generation and handling of crossing events
|
||||
|
||||
* CSS:
|
||||
- Fix handling of certain transform values
|
||||
|
||||
* Media support:
|
||||
- Add audio support to the ffmpeg backend
|
||||
- Avoid oom with pathological jpeg images
|
||||
|
||||
* GDK:
|
||||
- Fix handling of touchpad hold events
|
||||
- Add support for hi-resolution scroll events
|
||||
|
||||
* X11:
|
||||
- Fix preferred action for DND
|
||||
|
||||
* Windows:
|
||||
- Fix DND
|
||||
|
||||
* List models:
|
||||
- Fix items-changed emission
|
||||
- Add more list model tests
|
||||
|
||||
* Demos:
|
||||
- Add a winning sound to game demos
|
||||
- Make app icons work uninstalled
|
||||
|
||||
* Translation updates:
|
||||
Abkhazian
|
||||
Basque
|
||||
Catalan
|
||||
Georgian
|
||||
German
|
||||
Indonesian
|
||||
Occitan
|
||||
Persian
|
||||
Portuguese
|
||||
Russian
|
||||
Spanish
|
||||
Ukrainian
|
||||
|
||||
|
||||
Overview of Changes in 4.7.1, 12-07-2022
|
||||
========================================
|
||||
|
||||
* GtkInscription:
|
||||
- A new label-like widget for use in list views
|
||||
|
||||
* GtkColorChooser:
|
||||
- Style improvements
|
||||
|
||||
* GtkFontChooser:
|
||||
- Improve support for OpenType features a bit
|
||||
|
||||
* GtkLabel:
|
||||
- Allow selectable labels to be activated via mnemonic
|
||||
|
||||
* GtkTextView:
|
||||
- Implement GetCharacterExtents for accessibility
|
||||
|
||||
* GtkStack:
|
||||
- Fix a poblem with stack page accessibility
|
||||
|
||||
* GtkListView:
|
||||
- Cull listitems that are out of view
|
||||
- Make all our list models implement ::n-items and
|
||||
::item-type properties
|
||||
|
||||
* Translations:
|
||||
- Stop translating property nicks and blurbs
|
||||
- Fix extracting translations from ui files
|
||||
|
||||
* Debugging:
|
||||
- Support GTK_DEBUG=invert-text-dir
|
||||
- Allow inspecting inspectors
|
||||
- Replace GTK_USE_PORTAL with GDK_DEBUG=portals
|
||||
- Improve responsiveness of the inspector
|
||||
|
||||
* CSS:
|
||||
- Allow fractional letterspacing
|
||||
|
||||
* Theme:
|
||||
- Improve legibility of selectable labels
|
||||
|
||||
* Demos:
|
||||
- Improve the font features demo
|
||||
- Add demos for GtkInscription
|
||||
|
||||
* Wayland:
|
||||
- Freeze popups when hidden
|
||||
- Only send smooth scroll events for tablet tools
|
||||
- Make scaled cursor image have the right size
|
||||
- Fix problems with the activation protocol
|
||||
- Don't force the HighContrast icon theme
|
||||
- Support xdg_toplevel.bounds
|
||||
|
||||
* X11:
|
||||
- Always update the shadoe size
|
||||
|
||||
* Windows:
|
||||
- Improve touchpad support by using DirectManipulation
|
||||
- Add more directories to the builtin hicolor icon theme
|
||||
|
||||
* Translation updates:
|
||||
Basque
|
||||
Catalan
|
||||
Chinese (China)
|
||||
Galician
|
||||
German
|
||||
Lithuanian
|
||||
Nepali
|
||||
Occitan
|
||||
Persian
|
||||
Polish
|
||||
Portuguese
|
||||
Russian
|
||||
Serbian
|
||||
Spanish
|
||||
Swedish
|
||||
Turkish
|
||||
Ukrainian
|
||||
|
||||
|
||||
Overview of Changes in 4.7.0, 07-05-2022
|
||||
========================================
|
||||
|
||||
|
||||
@@ -54,7 +54,8 @@
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dtests=false"
|
||||
"-Dtests=false",
|
||||
"-Dbenchmarks=false"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
@@ -104,8 +105,8 @@
|
||||
"sources": [
|
||||
{
|
||||
"type": "archive",
|
||||
"url": "https://boostorg.jfrog.io/artifactory/main/release/1.79.0/source/boost_1_79_0.tar.bz2",
|
||||
"sha256": "475d589d51a7f8b3ba2ba4eda022b170e562ca3b760ee922c146b6c65856ef39"
|
||||
"url": "https://boostorg.jfrog.io/artifactory/main/release/1.69.0/source/boost_1_69_0.tar.bz2",
|
||||
"sha256": "8f32d4617390d1c2d16f26a27ab60d97807b35440d45891fa340fc2648b04406"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -185,7 +186,7 @@
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dvulkan=disabled",
|
||||
"-Denable_vulkan=no",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Dprofile=devel"
|
||||
],
|
||||
|
||||
@@ -54,7 +54,8 @@
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dtests=false"
|
||||
"-Dtests=false",
|
||||
"-Dbenchmarks=false"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
@@ -114,7 +115,7 @@
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dvulkan=disabled",
|
||||
"-Denable_vulkan=no",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Dprofile=devel"
|
||||
],
|
||||
|
||||
@@ -54,7 +54,8 @@
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dtests=false"
|
||||
"-Dtests=false",
|
||||
"-Dbenchmarks=false"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
@@ -114,7 +115,7 @@
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dvulkan=disabled",
|
||||
"-Denable_vulkan=no",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Dprofile=devel"
|
||||
],
|
||||
|
||||
@@ -1,138 +0,0 @@
|
||||
{
|
||||
"app-id" : "org.gtk.gtk4.NodeEditor",
|
||||
"runtime" : "org.gnome.Platform",
|
||||
"runtime-version" : "master",
|
||||
"sdk" : "org.gnome.Sdk",
|
||||
"command" : "gtk4-node-editor",
|
||||
"tags" : [
|
||||
"devel",
|
||||
"development",
|
||||
"nightly"
|
||||
],
|
||||
"desktop-file-name-prefix" : "(Development) ",
|
||||
"finish-args" : [
|
||||
"--device=dri",
|
||||
"--share=ipc",
|
||||
"--socket=fallback-x11",
|
||||
"--socket=wayland",
|
||||
"--talk-name=org.gtk.vfs",
|
||||
"--talk-name=org.gtk.vfs.*"
|
||||
],
|
||||
"cleanup" : [
|
||||
"/include",
|
||||
"/lib/pkgconfig",
|
||||
"/share/pkgconfig",
|
||||
"/share/aclocal",
|
||||
"/man",
|
||||
"/share/man",
|
||||
"/share/gtk-doc",
|
||||
"*.la",
|
||||
".a",
|
||||
"/lib/girepository-1.0",
|
||||
"/share/gir-1.0",
|
||||
"/share/doc"
|
||||
],
|
||||
"modules" : [
|
||||
{
|
||||
"name" : "wayland",
|
||||
"buildsystem" : "meson",
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"-Ddocumentation=false"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
"type" : "git",
|
||||
"url" : "https://gitlab.freedesktop.org/wayland/wayland.git",
|
||||
"branch" : "main"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "graphene",
|
||||
"buildsystem" : "meson",
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dtests=false"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
"type" : "git",
|
||||
"url" : "https://github.com/ebassi/graphene.git"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"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" : "pango",
|
||||
"buildsystem" : "meson",
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
"type" : "git",
|
||||
"url" : "https://gitlab.gnome.org/GNOME/pango.git",
|
||||
"branch" : "main"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "gtk",
|
||||
"buildsystem" : "meson",
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dvulkan=disabled",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Dprofile=devel"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
"type" : "git",
|
||||
"url" : "https://gitlab.gnome.org/GNOME/gtk.git",
|
||||
"branch" : "main"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"build-options" : {
|
||||
"env" : {
|
||||
"DBUS_SESSION_BUS_ADDRESS" : "''",
|
||||
"GSK_RENDERER" : "opengl",
|
||||
"GDK_DEBUG" : "vulkan-disable",
|
||||
"G_ENABLE_DEBUG" : "true"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -361,11 +361,11 @@ save_cb (GtkWidget *button,
|
||||
}
|
||||
|
||||
static void
|
||||
constraint_editor_window_dispose (GObject *object)
|
||||
constraint_editor_window_finalize (GObject *object)
|
||||
{
|
||||
gtk_widget_dispose_template (GTK_WIDGET (object), CONSTRAINT_EDITOR_WINDOW_TYPE);
|
||||
//ConstraintEditorWindow *self = (ConstraintEditorWindow *)object;
|
||||
|
||||
G_OBJECT_CLASS (constraint_editor_window_parent_class)->dispose (object);
|
||||
G_OBJECT_CLASS (constraint_editor_window_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static int child_counter;
|
||||
@@ -497,7 +497,7 @@ constraint_editor_window_class_init (ConstraintEditorWindowClass *class)
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
||||
|
||||
object_class->dispose = constraint_editor_window_dispose;
|
||||
object_class->finalize = constraint_editor_window_finalize;
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class,
|
||||
"/org/gtk/gtk4/constraint-editor/constraint-editor-window.ui");
|
||||
|
||||
@@ -607,11 +607,10 @@ constraint_editor_dispose (GObject *object)
|
||||
{
|
||||
ConstraintEditor *self = (ConstraintEditor *)object;
|
||||
|
||||
g_clear_pointer (&self->grid, gtk_widget_unparent);
|
||||
g_clear_object (&self->model);
|
||||
g_clear_object (&self->constraint);
|
||||
|
||||
gtk_widget_dispose_template (GTK_WIDGET (object), CONSTRAINT_EDITOR_TYPE);
|
||||
|
||||
G_OBJECT_CLASS (constraint_editor_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
|
||||
@@ -294,10 +294,9 @@ guide_editor_dispose (GObject *object)
|
||||
{
|
||||
GuideEditor *self = (GuideEditor *)object;
|
||||
|
||||
g_clear_pointer (&self->grid, gtk_widget_unparent);
|
||||
g_clear_object (&self->guide);
|
||||
|
||||
gtk_widget_dispose_template (GTK_WIDGET (self), GUIDE_EDITOR_TYPE);
|
||||
|
||||
G_OBJECT_CLASS (guide_editor_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
|
||||
@@ -504,8 +504,6 @@ demo_application_window_dispose (GObject *object)
|
||||
|
||||
demo_application_window_store_state (window);
|
||||
|
||||
gtk_widget_dispose_template (GTK_WIDGET (window), demo_application_window_get_type ());
|
||||
|
||||
G_OBJECT_CLASS (demo_application_window_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
|
||||
@@ -341,13 +341,16 @@ do_clipboard (GtkWidget *do_widget)
|
||||
GtkWidget *button;
|
||||
|
||||
scope = gtk_builder_cscope_new ();
|
||||
gtk_builder_cscope_add_callback (scope, copy_button_clicked);
|
||||
gtk_builder_cscope_add_callback (scope, paste_button_clicked);
|
||||
gtk_builder_cscope_add_callback (scope, source_changed_cb);
|
||||
gtk_builder_cscope_add_callback (scope, text_changed_cb);
|
||||
gtk_builder_cscope_add_callback (scope, open_file_cb);
|
||||
gtk_builder_cscope_add_callback (scope, on_drop);
|
||||
gtk_builder_cscope_add_callback (scope, drag_prepare);
|
||||
gtk_builder_cscope_add_callback_symbols (GTK_BUILDER_CSCOPE (scope),
|
||||
"copy_button_clicked", G_CALLBACK (copy_button_clicked),
|
||||
"paste_button_clicked", G_CALLBACK (paste_button_clicked),
|
||||
"source_changed_cb", G_CALLBACK (source_changed_cb),
|
||||
"text_changed_cb", G_CALLBACK (text_changed_cb),
|
||||
"open_file_cb", G_CALLBACK (open_file_cb),
|
||||
"on_drop", G_CALLBACK (on_drop),
|
||||
"drag_prepare", G_CALLBACK (drag_prepare),
|
||||
NULL);
|
||||
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_set_scope (builder, scope);
|
||||
gtk_builder_add_from_resource (builder, "/clipboard/clipboard.ui", NULL);
|
||||
|
||||
@@ -329,7 +329,6 @@
|
||||
<file>pickers.c</file>
|
||||
<file>printing.c</file>
|
||||
<file>revealer.c</file>
|
||||
<file>read_more.c</file>
|
||||
<file>rotated_text.c</file>
|
||||
<file>scale.c</file>
|
||||
<file>search_entry.c</file>
|
||||
@@ -376,7 +375,7 @@
|
||||
<file>glarea-gles.vs.glsl</file>
|
||||
</gresource>
|
||||
<gresource prefix="/font_features">
|
||||
<file>font_features.ui</file>
|
||||
<file>font-features.ui</file>
|
||||
<file>fontplane.c</file>
|
||||
</gresource>
|
||||
<gresource prefix="/spinbutton">
|
||||
@@ -428,8 +427,6 @@
|
||||
<file>icons/16x16/emotes/face-laugh-symbolic.symbolic.png</file>
|
||||
<file>icons/16x16/status/battery-caution-charging-symbolic.symbolic.png</file>
|
||||
<file>icons/16x16/categories/applications-other.png</file>
|
||||
<file>icons/48x48/status/starred.png</file>
|
||||
<file alias="icons/scalable/apps/org.gtk.Demo4.svg">data/scalable/apps/org.gtk.Demo4.svg</file>
|
||||
</gresource>
|
||||
<gresource prefix="/org/gtk/Demo4/gtk">
|
||||
<file preprocess="xml-stripblanks">help-overlay.ui</file>
|
||||
|
||||
@@ -37,8 +37,7 @@ demo3_widget_dispose (GObject *object)
|
||||
Demo3Widget *self = DEMO3_WIDGET (object);
|
||||
|
||||
g_clear_object (&self->paintable);
|
||||
|
||||
gtk_widget_dispose_template (GTK_WIDGET (self), DEMO3_TYPE_WIDGET);
|
||||
g_clear_pointer (&self->menu, gtk_widget_unparent);
|
||||
|
||||
G_OBJECT_CLASS (demo3_widget_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
@@ -90,9 +90,12 @@ do_errorstates (GtkWidget *do_widget)
|
||||
toplevel = GTK_WIDGET (gtk_widget_get_root (do_widget));
|
||||
|
||||
scope = gtk_builder_cscope_new ();
|
||||
gtk_builder_cscope_add_callback (scope, validate_more_details);
|
||||
gtk_builder_cscope_add_callback (scope, mode_switch_state_set);
|
||||
gtk_builder_cscope_add_callback (scope, level_scale_value_changed);
|
||||
gtk_builder_cscope_add_callback_symbols (GTK_BUILDER_CSCOPE (scope),
|
||||
"validate_more_details", G_CALLBACK (validate_more_details),
|
||||
"mode_switch_state_set", G_CALLBACK (mode_switch_state_set),
|
||||
"level_scale_value_changed", G_CALLBACK (level_scale_value_changed),
|
||||
NULL);
|
||||
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_set_scope (builder, scope);
|
||||
gtk_builder_expose_object (builder, "toplevel", G_OBJECT (toplevel));
|
||||
|
||||
@@ -0,0 +1,190 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkWindow" id="window">
|
||||
<property name="default-width">600</property>
|
||||
<property name="default-height">500</property>
|
||||
<property name="title">Font Explorer</property>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar">
|
||||
<child>
|
||||
<object class="GtkButton" id="reset">
|
||||
<property name="receives-default">1</property>
|
||||
<property name="tooltip-text">Reset</property>
|
||||
<property name="icon-name">view-refresh-symbolic</property>
|
||||
<signal name="clicked" handler="font_features_reset_features" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<child>
|
||||
<object class="GtkViewport">
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="margin-start">10</property>
|
||||
<property name="margin-end">10</property>
|
||||
<property name="margin-top">10</property>
|
||||
<property name="margin-bottom">10</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkFontButton" id="font">
|
||||
<property name="receives-default">1</property>
|
||||
<property name="font">Sans 12</property>
|
||||
<property name="level">family|style|size|variations|features</property>
|
||||
<signal name="font-set" handler="font_features_font_changed" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkExpander">
|
||||
<child type="label">
|
||||
<object class="GtkLabel">
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Font Features</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"></attribute>
|
||||
</attributes>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="feature_list">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="script_lang">
|
||||
<property name="margin-top">10</property>
|
||||
<signal name="changed" handler="font_features_script_changed" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkCellRendererText"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkExpander">
|
||||
<child type="label">
|
||||
<object class="GtkLabel" id="variations_heading">
|
||||
<property name="label" translatable="yes">Font Variations</property>
|
||||
<property name="xalign">0</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"></attribute>
|
||||
</attributes>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid" id="variations_grid">
|
||||
<property name="column-spacing">10</property>
|
||||
<property name="row-spacing">10</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<style>
|
||||
<class name="view"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="hexpand">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
<property name="margin-start">20</property>
|
||||
<property name="margin-end">20</property>
|
||||
<property name="margin-top">20</property>
|
||||
<property name="margin-bottom">20</property>
|
||||
<property name="spacing">20</property>
|
||||
<child>
|
||||
<object class="GtkStack" id="stack">
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">label</property>
|
||||
<property name="child">
|
||||
<object class="GtkLabel" id="label">
|
||||
<property name="wrap">1</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="selectable">1</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">entry</property>
|
||||
<property name="child">
|
||||
<object class="GtkEntry" id="entry">
|
||||
<property name="text">Grumpy wizards make toxic brew for the evil Queen and Jack. A quick movement of the enemy will jeopardize six gunboats. The job of waxing linoleum frequently peeves chintzy kids. My girl wove six dozen plaid jackets before she quit. Twelve ziggurats quickly jumped a finch box.
|
||||
|
||||
Разъяренный чтец эгоистично бьёт пятью жердями шустрого фехтовальщика. Наш банк вчера же выплатил Ф.Я. Эйхгольду комиссию за ценные вещи. Эх, чужак, общий съём цен шляп (юфть) – вдрызг! В чащах юга жил бы цитрус? Да, но фальшивый экземпляр!
|
||||
|
||||
Τάχιστη αλώπηξ βαφής ψημένη γη, δρασκελίζει υπέρ νωθρού κυνός</property>
|
||||
<signal name="activate" handler="font_features_stop_edit"/>
|
||||
<property name="valign">start</property>
|
||||
<property name="width-chars">50</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="settings">
|
||||
<property name="wrap">1</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="valign">end</property>
|
||||
<property name="width-chars">50</property>
|
||||
<property name="max-width-chars">50</property>
|
||||
<property name="hexpand">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
<style>
|
||||
<class name="monospace"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="description">
|
||||
<property name="wrap">1</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="valign">end</property>
|
||||
<property name="width-chars">50</property>
|
||||
<property name="max-width-chars">50</property>
|
||||
<property name="hexpand">1</property>
|
||||
<style>
|
||||
<class name="monospace"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="edit_toggle">
|
||||
<property name="icon-name">document-edit-symbolic</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">end</property>
|
||||
<signal name="toggled" handler="font_features_toggle_edit"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
+264
-715
File diff suppressed because it is too large
Load Diff
@@ -1,454 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkAdjustment" id="size_adjustment">
|
||||
<property name="lower">7</property>
|
||||
<property name="upper">100</property>
|
||||
<property name="value">14</property>
|
||||
<property name="step_increment">0.5</property>
|
||||
<property name="page_increment">10</property>
|
||||
<signal name="value-changed" handler="basic_value_changed" object="size_entry" swapped="false"/>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="letterspacing_adjustment">
|
||||
<property name="lower">-1024</property>
|
||||
<property name="upper">8192</property>
|
||||
<property name="value">0</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">512</property>
|
||||
<signal name="value-changed" handler="basic_value_changed" object="letterspacing_entry" swapped="false"/>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="line_height_adjustment">
|
||||
<property name="lower">0.75</property>
|
||||
<property name="upper">2.5</property>
|
||||
<property name="value">1.0</property>
|
||||
<property name="step_increment">0.1</property>
|
||||
<property name="page_increment">1</property>
|
||||
<signal name="value-changed" handler="basic_value_changed" object="line_height_entry" swapped="false"/>
|
||||
</object>
|
||||
<object class="GtkWindow" id="window">
|
||||
<property name="default-width">600</property>
|
||||
<property name="default-height">500</property>
|
||||
<property name="title">Font Explorer</property>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar">
|
||||
<child>
|
||||
<object class="GtkButton" id="reset">
|
||||
<property name="receives-default">1</property>
|
||||
<property name="tooltip-text">Reset</property>
|
||||
<property name="icon-name">view-refresh-symbolic</property>
|
||||
<signal name="clicked" handler="font_features_reset_basic" swapped="no"/>
|
||||
<signal name="clicked" handler="font_features_reset_features" swapped="no"/>
|
||||
<signal name="clicked" handler="font_features_reset_variations" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<child>
|
||||
<object class="GtkViewport">
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="margin-start">10</property>
|
||||
<property name="margin-end">10</property>
|
||||
<property name="margin-top">10</property>
|
||||
<property name="margin-bottom">10</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkFontButton" id="font">
|
||||
<property name="receives-default">1</property>
|
||||
<property name="font">Sans 12</property>
|
||||
<property name="level">family|style</property>
|
||||
<signal name="font-set" handler="font_features_font_changed" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid">
|
||||
<property name="column-spacing">10</property>
|
||||
<property name="row-spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Size</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="valign">baseline</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScale" id="size_scale">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="width-request">100</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="adjustment">size_adjustment</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="size_entry">
|
||||
<property name="width-chars">4</property>
|
||||
<property name="max-width-chars">4</property>
|
||||
<property name="hexpand">0</property>
|
||||
<property name="valign">baseline</property>
|
||||
<signal name="activate" handler="basic_entry_activated"
|
||||
object="size_adjustment" swapped="false"/>
|
||||
<layout>
|
||||
<property name="column">2</property>
|
||||
<property name="row">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Letterspacing</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="valign">baseline</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScale">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="width-request">100</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="adjustment">letterspacing_adjustment</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="letterspacing_entry">
|
||||
<property name="width-chars">4</property>
|
||||
<property name="max-width-chars">4</property>
|
||||
<property name="hexpand">0</property>
|
||||
<property name="valign">baseline</property>
|
||||
<signal name="activate" handler="basic_entry_activated"
|
||||
object="letterspacing_adjustment" swapped="false"/>
|
||||
<layout>
|
||||
<property name="column">2</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Line Height</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="valign">baseline</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScale">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="width-request">100</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="adjustment">line_height_adjustment</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="line_height_entry">
|
||||
<property name="width-chars">4</property>
|
||||
<property name="max-width-chars">4</property>
|
||||
<property name="hexpand">0</property>
|
||||
<property name="valign">baseline</property>
|
||||
<signal name="activate" handler="basic_entry_activated"
|
||||
object="line_height_adjustment" swapped="false"/>
|
||||
<layout>
|
||||
<property name="column">2</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Foreground</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="valign">baseline</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkColorButton" id="foreground">
|
||||
<property name="valign">baseline</property>
|
||||
<property name="rgba">black</property>
|
||||
<signal name="notify::rgba" handler="color_set_cb"/>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Background</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="valign">baseline</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">4</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkColorButton" id="background">
|
||||
<property name="valign">baseline</property>
|
||||
<property name="rgba">white</property>
|
||||
<signal name="notify::rgba" handler="color_set_cb"/>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">4</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="icon-name">object-flip-vertical-symbolic</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<style>
|
||||
<class name="circular"/>
|
||||
</style>
|
||||
<signal name="clicked" handler="swap_colors"/>
|
||||
<layout>
|
||||
<property name="column">2</property>
|
||||
<property name="row">3</property>
|
||||
<property name="row-span">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkExpander">
|
||||
<child type="label">
|
||||
<object class="GtkLabel">
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">OpenType Features</property>
|
||||
<property name="margin-top">10</property>
|
||||
<property name="margin-bottom">10</property>
|
||||
<style>
|
||||
<class name="title-4"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="feature_list">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="script_lang">
|
||||
<property name="tooltip-text" translatable="yes">Language System</property>
|
||||
<property name="margin-top">10</property>
|
||||
<signal name="changed" handler="font_features_script_changed" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkCellRendererText"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkExpander">
|
||||
<child type="label">
|
||||
<object class="GtkLabel" id="variations_heading">
|
||||
<property name="label" translatable="yes">Variation Axes</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="margin-top">10</property>
|
||||
<property name="margin-bottom">10</property>
|
||||
<style>
|
||||
<class name="title-4"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid" id="variations_grid">
|
||||
<property name="column-spacing">10</property>
|
||||
<property name="row-spacing">10</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<style>
|
||||
<class name="view"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="hexpand">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
<property name="margin-start">20</property>
|
||||
<property name="margin-end">20</property>
|
||||
<property name="margin-top">20</property>
|
||||
<property name="margin-bottom">20</property>
|
||||
<property name="spacing">20</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="swin">
|
||||
<property name="hscrollbar-policy">automatic</property>
|
||||
<property name="vscrollbar-policy">automatic</property>
|
||||
<property name="propagate-natural-height">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
<style>
|
||||
<class name="font_features_background"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkStack" id="stack">
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">label</property>
|
||||
<property name="child">
|
||||
<object class="GtkLabel" id="label">
|
||||
<property name="wrap">1</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="selectable">1</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">entry</property>
|
||||
<property name="child">
|
||||
<object class="GtkTextView" id="entry">
|
||||
<property name="buffer">
|
||||
<object class="GtkTextBuffer">
|
||||
<property name="text">Grumpy wizards make toxic brew for the evil Queen and Jack. A quick movement of the enemy will jeopardize six gunboats. The job of waxing linoleum frequently peeves chintzy kids. My girl wove six dozen plaid jackets before she quit. Twelve ziggurats quickly jumped a finch box.
|
||||
|
||||
Разъяренный чтец эгоистично бьёт пятью жердями шустрого фехтовальщика. Наш банк вчера же выплатил Ф.Я. Эйхгольду комиссию за ценные вещи. Эх, чужак, общий съём цен шляп (юфть) – вдрызг! В чащах юга жил бы цитрус? Да, но фальшивый экземпляр!
|
||||
|
||||
Τάχιστη αλώπηξ βαφής ψημένη γη, δρασκελίζει υπέρ νωθρού κυνός</property>
|
||||
</object>
|
||||
</property>
|
||||
<property name="valign">fill</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="settings">
|
||||
<property name="wrap">1</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="valign">end</property>
|
||||
<property name="width-chars">50</property>
|
||||
<property name="max-width-chars">50</property>
|
||||
<property name="hexpand">1</property>
|
||||
<style>
|
||||
<class name="monospace"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Alphabet</property>
|
||||
<signal name="clicked" handler="set_text_alphabet"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Paragraph</property>
|
||||
<signal name="clicked" handler="set_text_paragraph"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="description">
|
||||
<property name="wrap">1</property>
|
||||
<property name="wrap-mode">char</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="valign">end</property>
|
||||
<property name="width-chars">50</property>
|
||||
<property name="max-width-chars">50</property>
|
||||
<property name="hexpand">1</property>
|
||||
<style>
|
||||
<class name="monospace"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<style>
|
||||
<class name="linked"/>
|
||||
</style>
|
||||
<property name="valign">end</property>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="plain_toggle">
|
||||
<property name="label" translatable="yes">Plain</property>
|
||||
<property name="active">1</property>
|
||||
<property name="valign">baseline</property>
|
||||
<signal name="toggled" handler="font_features_toggle_plain"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="waterfall_toggle">
|
||||
<property name="label" translatable="yes">Waterfall</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="group">plain_toggle</property>
|
||||
<signal name="toggled" handler="font_features_toggle_plain"/>
|
||||
<signal name="notify::active" handler="font_features_notify_waterfall"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="edit_toggle">
|
||||
<property name="group">waterfall_toggle</property>
|
||||
<property name="icon-name">document-edit-symbolic</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">end</property>
|
||||
<signal name="clicked" handler="font_features_toggle_edit"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
@@ -223,7 +223,6 @@ static void
|
||||
destroy_gear (struct gear *g)
|
||||
{
|
||||
g_free (g->strips);
|
||||
g_free (g->vertices);
|
||||
g_free (g);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ do_headerbar (GtkWidget *do_widget)
|
||||
{
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Welcome to the Hotel California");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Welcome to Facebook - Log in, sign up or learn more");
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
|
||||
@@ -31,7 +31,6 @@ do_headerbar (GtkWidget *do_widget)
|
||||
header = gtk_header_bar_new ();
|
||||
|
||||
button = gtk_button_new_from_icon_name ("mail-send-receive-symbolic");
|
||||
gtk_widget_set_tooltip_text (button, "Check out");
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.3 KiB |
@@ -66,9 +66,11 @@ do_links (GtkWidget *do_widget)
|
||||
"as hyperlinks, which can be clicked "
|
||||
"or activated via <a href=\"keynav\">keynav</a> "
|
||||
"and they work fine with other markup, like when "
|
||||
"linking to <a href=\"http://www.flathub.org/\"><b>"
|
||||
"<span letter_spacing=\"1024\" underline=\"none\" color=\"pink\" background=\"darkslategray\">Flathub</span>"
|
||||
"</b></a>.");
|
||||
"searching on <a href=\"http://www.google.com/\">"
|
||||
"<span color=\"#0266C8\">G</span><span color=\"#F90101\">o</span>"
|
||||
"<span color=\"#F2B50F\">o</span><span color=\"#0266C8\">g</span>"
|
||||
"<span color=\"#00933B\">l</span><span color=\"#F90101\">e</span>"
|
||||
"</a>.");
|
||||
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
|
||||
gtk_label_set_max_width_chars (GTK_LABEL (label), 40);
|
||||
gtk_label_set_wrap (GTK_LABEL (label), TRUE);
|
||||
|
||||
@@ -260,19 +260,12 @@ gtk_message_row_state_flags_changed (GtkWidget *widget,
|
||||
GTK_WIDGET_CLASS (gtk_message_row_parent_class)->state_flags_changed (widget, previous_state_flags);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_message_row_dispose (GObject *obj)
|
||||
{
|
||||
gtk_widget_dispose_template (GTK_WIDGET (obj), GTK_TYPE_MESSAGE_ROW);
|
||||
G_OBJECT_CLASS (gtk_message_row_parent_class)->dispose (obj);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_message_row_finalize (GObject *obj)
|
||||
{
|
||||
GtkMessageRowPrivate *priv = GTK_MESSAGE_ROW (obj)->priv;
|
||||
g_object_unref (priv->message);
|
||||
G_OBJECT_CLASS (gtk_message_row_parent_class)->finalize (obj);
|
||||
G_OBJECT_CLASS (gtk_message_row_parent_class)->finalize(obj);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -281,7 +274,6 @@ gtk_message_row_class_init (GtkMessageRowClass *klass)
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->dispose = gtk_message_row_dispose;
|
||||
object_class->finalize = gtk_message_row_finalize;
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/listbox/listbox.ui");
|
||||
|
||||
@@ -42,7 +42,8 @@ do_listbox_controls (GtkWidget *do_widget)
|
||||
GtkBuilder *builder;
|
||||
|
||||
scope = gtk_builder_cscope_new ();
|
||||
gtk_builder_cscope_add_callback (scope, row_activated);
|
||||
gtk_builder_cscope_add_callback_symbol (GTK_BUILDER_CSCOPE (scope),
|
||||
"row_activated", G_CALLBACK (row_activated));
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_set_scope (builder, scope);
|
||||
|
||||
|
||||
@@ -356,10 +356,10 @@ do_listview_settings (GtkWidget *do_widget)
|
||||
g_type_ensure (SETTINGS_TYPE_KEY);
|
||||
|
||||
scope = gtk_builder_cscope_new ();
|
||||
gtk_builder_cscope_add_callback (scope, search_enabled);
|
||||
gtk_builder_cscope_add_callback (scope, search_changed);
|
||||
gtk_builder_cscope_add_callback (scope, stop_search);
|
||||
gtk_builder_cscope_add_callback (scope, item_value_changed);
|
||||
gtk_builder_cscope_add_callback_symbol (GTK_BUILDER_CSCOPE (scope), "search_enabled", (GCallback)search_enabled);
|
||||
gtk_builder_cscope_add_callback_symbol (GTK_BUILDER_CSCOPE (scope), "search_changed", (GCallback)search_changed);
|
||||
gtk_builder_cscope_add_callback_symbol (GTK_BUILDER_CSCOPE (scope), "stop_search", (GCallback)stop_search);
|
||||
gtk_builder_cscope_add_callback_symbol (GTK_BUILDER_CSCOPE (scope), "item_value_changed", (GCallback)item_value_changed);
|
||||
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_set_scope (builder, scope);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Lists/Words
|
||||
* #Keywords: GtkListView, GtkFilterListModel, GtkInscription
|
||||
* #Keywords: GtkListView, GtkFilterListModel
|
||||
*
|
||||
* This demo shows filtering a long list - of words.
|
||||
*
|
||||
@@ -17,9 +17,10 @@ const char *factory_text =
|
||||
"<interface>\n"
|
||||
" <template class='GtkListItem'>\n"
|
||||
" <property name='child'>\n"
|
||||
" <object class='GtkInscription'>\n"
|
||||
" <object class='GtkLabel'>\n"
|
||||
" <property name='ellipsize'>end</property>\n"
|
||||
" <property name='xalign'>0</property>\n"
|
||||
" <binding name='text'>\n"
|
||||
" <binding name='label'>\n"
|
||||
" <lookup name='string' type='GtkStringObject'>\n"
|
||||
" <lookup name='item'>GtkListItem</lookup>\n"
|
||||
" </lookup>\n"
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
<lookup name="item">GtkListItem</lookup>
|
||||
</binding>
|
||||
<property name="child">
|
||||
<object class="GtkInscription">
|
||||
<property name="hexpand">1</property>
|
||||
<binding name="text">
|
||||
<object class="GtkLabel">
|
||||
<property name="halign">start</property>
|
||||
<binding name="label">
|
||||
<lookup name="title" type="GtkDemo">
|
||||
<lookup name="item">expander</lookup>
|
||||
</lookup>
|
||||
|
||||
@@ -73,7 +73,6 @@ demos = files([
|
||||
'peg_solitaire.c',
|
||||
'pickers.c',
|
||||
'printing.c',
|
||||
'read_more.c',
|
||||
'revealer.c',
|
||||
'rotated_text.c',
|
||||
'scale.c',
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* #Keywords: GtkColorChooser, GtkFontChooser, GtkApplicationChooser
|
||||
*
|
||||
* These widgets are mainly intended for use in preference dialogs.
|
||||
* They allow to select colors, fonts and applications.
|
||||
* They allow to select colors, fonts, directories and applications.
|
||||
*
|
||||
* This demo shows both the default appearance for these dialogs,
|
||||
* as well as some of the customizations that are possible.
|
||||
|
||||
@@ -1,239 +0,0 @@
|
||||
/* Read More
|
||||
* #Keywords: GtkInscription
|
||||
*
|
||||
* A simple implementation of a widget that can either
|
||||
* display a lot of text or just the first few lines with a
|
||||
* "Read More" button.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#define READ_TYPE_MORE (read_more_get_type ())
|
||||
G_DECLARE_FINAL_TYPE(ReadMore, read_more, READ, MORE, GtkWidget)
|
||||
|
||||
struct _ReadMore {
|
||||
GtkWidget parent_instance;
|
||||
|
||||
GtkWidget *label;
|
||||
GtkWidget *inscription;
|
||||
GtkWidget *box;
|
||||
gboolean show_more;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (ReadMore, read_more, GTK_TYPE_WIDGET)
|
||||
|
||||
static GtkSizeRequestMode
|
||||
read_more_get_request_mode (GtkWidget *widget)
|
||||
{
|
||||
return GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
|
||||
}
|
||||
|
||||
static void
|
||||
read_more_measure (GtkWidget *widget,
|
||||
GtkOrientation orientation,
|
||||
int for_size,
|
||||
int *minimum,
|
||||
int *natural,
|
||||
int *minimum_baseline,
|
||||
int *natural_baseline)
|
||||
{
|
||||
ReadMore *self = READ_MORE (widget);
|
||||
int label_min, label_nat, label_min_baseline, label_nat_baseline;
|
||||
int box_min, box_nat, box_min_baseline, box_nat_baseline;
|
||||
int min_check;
|
||||
|
||||
if (self->show_more)
|
||||
min_check = G_MAXINT;
|
||||
else if (for_size >= 0)
|
||||
gtk_widget_measure (self->box, 1 - orientation, -1, &min_check, NULL, NULL, NULL);
|
||||
else
|
||||
min_check = -1;
|
||||
|
||||
if (min_check > for_size)
|
||||
{
|
||||
gtk_widget_measure (self->label,
|
||||
orientation,
|
||||
for_size,
|
||||
minimum, natural,
|
||||
minimum_baseline, natural_baseline);
|
||||
return;
|
||||
}
|
||||
|
||||
else if (for_size >= 0)
|
||||
gtk_widget_measure (self->label, 1 - orientation, -1, &min_check, NULL, NULL, NULL);
|
||||
else
|
||||
min_check = -1;
|
||||
|
||||
if (min_check > for_size)
|
||||
{
|
||||
gtk_widget_measure (self->box,
|
||||
orientation,
|
||||
for_size,
|
||||
minimum, natural,
|
||||
minimum_baseline, natural_baseline);
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_widget_measure (self->label,
|
||||
orientation,
|
||||
for_size,
|
||||
&label_min, &label_nat,
|
||||
&label_min_baseline, &label_nat_baseline);
|
||||
gtk_widget_measure (self->box,
|
||||
orientation,
|
||||
for_size,
|
||||
&box_min, &box_nat,
|
||||
&box_min_baseline, &box_nat_baseline);
|
||||
|
||||
*minimum = MIN (label_min, box_min);
|
||||
*natural = MIN (label_nat, box_nat);
|
||||
|
||||
/* FIXME: Figure out baselines! */
|
||||
}
|
||||
|
||||
static void
|
||||
read_more_allocate (GtkWidget *widget,
|
||||
int width,
|
||||
int height,
|
||||
int baseline)
|
||||
{
|
||||
ReadMore *self = READ_MORE (widget);
|
||||
gboolean show_more;
|
||||
|
||||
if (self->show_more)
|
||||
{
|
||||
show_more = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
int needed;
|
||||
|
||||
/* check to see if we have enough space to show all text */
|
||||
gtk_widget_measure (self->label,
|
||||
GTK_ORIENTATION_VERTICAL,
|
||||
width,
|
||||
&needed, NULL, NULL, NULL);
|
||||
|
||||
show_more = needed <= height;
|
||||
}
|
||||
|
||||
gtk_widget_set_child_visible (self->label, show_more);
|
||||
gtk_widget_set_child_visible (self->box, !show_more);
|
||||
|
||||
if (show_more)
|
||||
gtk_widget_size_allocate (self->label, &(GtkAllocation) { 0, 0, width, height }, baseline);
|
||||
else
|
||||
gtk_widget_size_allocate (self->box, &(GtkAllocation) { 0, 0, width, height }, baseline);
|
||||
}
|
||||
|
||||
static void
|
||||
read_more_dispose (GObject *object)
|
||||
{
|
||||
ReadMore *self = READ_MORE (object);
|
||||
|
||||
g_clear_pointer (&self->label, gtk_widget_unparent);
|
||||
g_clear_pointer (&self->box, gtk_widget_unparent);
|
||||
|
||||
G_OBJECT_CLASS (read_more_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
read_more_class_init (ReadMoreClass *klass)
|
||||
{
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
widget_class->get_request_mode = read_more_get_request_mode;
|
||||
widget_class->measure = read_more_measure;
|
||||
widget_class->size_allocate = read_more_allocate;
|
||||
|
||||
object_class->dispose = read_more_dispose;
|
||||
}
|
||||
|
||||
static void
|
||||
read_more_clicked (GtkButton *button,
|
||||
ReadMore *self)
|
||||
{
|
||||
self->show_more = TRUE;
|
||||
gtk_widget_queue_resize (GTK_WIDGET (self));
|
||||
}
|
||||
|
||||
static void
|
||||
read_more_init (ReadMore *self)
|
||||
{
|
||||
GtkWidget *button;
|
||||
|
||||
self->label = gtk_label_new (NULL);
|
||||
gtk_label_set_xalign (GTK_LABEL (self->label), 0.0);
|
||||
gtk_label_set_yalign (GTK_LABEL (self->label), 0.0);
|
||||
gtk_label_set_wrap (GTK_LABEL (self->label), TRUE);
|
||||
gtk_label_set_width_chars (GTK_LABEL (self->label), 3);
|
||||
gtk_label_set_max_width_chars (GTK_LABEL (self->label), 30);
|
||||
gtk_widget_set_parent (self->label, GTK_WIDGET (self));
|
||||
|
||||
self->box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_widget_set_vexpand (self->box, FALSE);
|
||||
gtk_widget_set_parent (self->box, GTK_WIDGET (self));
|
||||
|
||||
self->inscription = gtk_inscription_new (NULL);
|
||||
gtk_inscription_set_xalign (GTK_INSCRIPTION (self->inscription), 0.0);
|
||||
gtk_inscription_set_yalign (GTK_INSCRIPTION (self->inscription), 0.0);
|
||||
gtk_inscription_set_min_lines (GTK_INSCRIPTION (self->inscription), 3);
|
||||
gtk_inscription_set_nat_chars (GTK_INSCRIPTION (self->inscription), 30);
|
||||
gtk_widget_set_vexpand (self->inscription, TRUE);
|
||||
gtk_box_append (GTK_BOX (self->box), self->inscription);
|
||||
|
||||
button = gtk_button_new_with_label ("Read More");
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (read_more_clicked), self);
|
||||
gtk_box_append (GTK_BOX (self->box), button);
|
||||
}
|
||||
|
||||
static void
|
||||
read_more_set_text (ReadMore *self,
|
||||
const char *text)
|
||||
{
|
||||
gtk_label_set_label (GTK_LABEL (self->label), text);
|
||||
gtk_inscription_set_text (GTK_INSCRIPTION (self->inscription), text);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
read_more_new (const char *text)
|
||||
{
|
||||
ReadMore *self = g_object_new (READ_TYPE_MORE, NULL);
|
||||
|
||||
read_more_set_text (self, text);
|
||||
|
||||
return GTK_WIDGET (self);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_read_more (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *readmore;
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Read More");
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
readmore = read_more_new (
|
||||
"I'd just like to interject for a moment. What you're referring to as Linux, is in fact, GNU/Linux, or as I've recently taken to calling it, GNU plus Linux. Linux is not an operating system unto itself, but rather another free component of a fully functioning GNU system made useful by the GNU corelibs, shell utilities and vital system components comprising a full OS as defined by POSIX.\n"
|
||||
"\n"
|
||||
"Many computer users run a modified version of the GNU system every day, without realizing it. Through a peculiar turn of events, the version of GNU which is widely used today is often called \"Linux\", and many of its users are not aware that it is basically the GNU system, developed by the GNU Project.\n"
|
||||
"\n"
|
||||
"There really is a Linux, and these people are using it, but it is just a part of the system they use. Linux is the kernel: the program in the system that allocates the machine's resources to the other programs that you run. The kernel is an essential part of an operating system, but useless by itself; it can only function in the context of a complete operating system. Linux is normally used in combination with the GNU operating system: the whole system is basically GNU with Linux added, or GNU/Linux. All the so-called \"Linux\" distributions are really distributions of GNU/Linux.");
|
||||
gtk_window_set_child (GTK_WINDOW (window), readmore);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show (window);
|
||||
else
|
||||
gtk_window_destroy (GTK_WINDOW (window));
|
||||
|
||||
return window;
|
||||
}
|
||||
@@ -5,7 +5,6 @@
|
||||
* small sliding puzzle game.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* Include the header for the puzzle piece */
|
||||
@@ -25,30 +24,6 @@ static guint height = 3;
|
||||
static guint pos_x;
|
||||
static guint pos_y;
|
||||
|
||||
static void
|
||||
ended (GObject *object)
|
||||
{
|
||||
g_object_unref (object);
|
||||
}
|
||||
|
||||
static void
|
||||
celebrate (gboolean win)
|
||||
{
|
||||
char *path;
|
||||
GtkMediaStream *stream;
|
||||
|
||||
if (win)
|
||||
path = g_build_filename (GTK_DATADIR, "sounds", "freedesktop", "stereo", "complete.oga", NULL);
|
||||
else
|
||||
path = g_build_filename (GTK_DATADIR, "sounds", "freedesktop", "stereo", "dialog-error.oga", NULL);
|
||||
stream = gtk_media_file_new_for_filename (path);
|
||||
gtk_media_stream_set_volume (stream, 1.0);
|
||||
gtk_media_stream_play (stream);
|
||||
|
||||
g_signal_connect (stream, "notify::ended", G_CALLBACK (ended), NULL);
|
||||
g_free (path);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
move_puzzle (GtkWidget *grid,
|
||||
int dx,
|
||||
@@ -182,8 +157,6 @@ check_solved (GtkWidget *grid)
|
||||
picture = gtk_grid_get_child_at (GTK_GRID (grid), pos_x, pos_y);
|
||||
gtk_picture_set_paintable (GTK_PICTURE (picture), piece);
|
||||
|
||||
celebrate (TRUE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -357,7 +330,7 @@ start_puzzle (GdkPaintable *paintable)
|
||||
x, y,
|
||||
width, height);
|
||||
picture = gtk_picture_new_for_paintable (piece);
|
||||
gtk_picture_set_content_fit (GTK_PICTURE (picture), GTK_CONTENT_FIT_FILL);
|
||||
gtk_picture_set_keep_aspect_ratio (GTK_PICTURE (picture), FALSE);
|
||||
gtk_grid_attach (GTK_GRID (grid),
|
||||
picture,
|
||||
x, y,
|
||||
|
||||
@@ -137,7 +137,7 @@ insert_text (GtkTextView *view)
|
||||
|
||||
icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (widget));
|
||||
icon = gtk_icon_theme_lookup_icon (icon_theme,
|
||||
"drive-harddisk",
|
||||
"face-cool",
|
||||
NULL,
|
||||
32, 1,
|
||||
gtk_widget_get_direction (widget),
|
||||
@@ -239,6 +239,8 @@ insert_text (GtkTextView *view)
|
||||
|
||||
gtk_text_buffer_insert (buffer, &iter, "The buffer can have images in it: ", -1);
|
||||
gtk_text_buffer_insert_paintable (buffer, &iter, GDK_PAINTABLE (icon));
|
||||
gtk_text_buffer_insert_paintable (buffer, &iter, GDK_PAINTABLE (icon));
|
||||
|
||||
gtk_text_buffer_insert_paintable (buffer, &iter, nuclear);
|
||||
|
||||
gtk_text_buffer_insert (buffer, &iter, " for example.\n\n", -1);
|
||||
@@ -439,12 +441,11 @@ attach_widgets (GtkTextView *text_view)
|
||||
{
|
||||
widget = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, NULL);
|
||||
gtk_range_set_range (GTK_RANGE (widget), 0, 100);
|
||||
gtk_widget_set_size_request (widget, 100, -1);
|
||||
gtk_widget_set_size_request (widget, 70, -1);
|
||||
}
|
||||
else if (i == 3)
|
||||
{
|
||||
widget = gtk_entry_new ();
|
||||
gtk_editable_set_width_chars (GTK_EDITABLE (widget), 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -409,14 +409,6 @@ icon_browser_window_init (IconBrowserWindow *win)
|
||||
g_signal_connect (win->context_model, "notify::selected", G_CALLBACK (selected_name_changed), win);
|
||||
}
|
||||
|
||||
static void
|
||||
icon_browser_window_dispose (GObject *object)
|
||||
{
|
||||
gtk_widget_dispose_template (GTK_WIDGET (object), ICON_BROWSER_WINDOW_TYPE);
|
||||
|
||||
G_OBJECT_CLASS (icon_browser_window_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
icon_browser_window_finalize (GObject *object)
|
||||
{
|
||||
@@ -432,7 +424,6 @@ icon_browser_window_class_init (IconBrowserWindowClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
|
||||
object_class->dispose = icon_browser_window_dispose;
|
||||
object_class->finalize = icon_browser_window_finalize;
|
||||
|
||||
g_type_ensure (IB_TYPE_ICON);
|
||||
|
||||
@@ -57,7 +57,6 @@ struct _NodeEditorWindow
|
||||
GtkWidget *testcase_cairo_checkbutton;
|
||||
GtkWidget *testcase_name_entry;
|
||||
GtkWidget *testcase_save_button;
|
||||
GtkWidget *scale_scale;
|
||||
|
||||
GtkWidget *renderer_listbox;
|
||||
GListStore *renderers;
|
||||
@@ -172,7 +171,6 @@ text_changed (GtkTextBuffer *buffer,
|
||||
GBytes *bytes;
|
||||
GtkTextIter iter;
|
||||
GtkTextIter start, end;
|
||||
float scale;
|
||||
|
||||
g_array_remove_range (self->errors, 0, self->errors->len);
|
||||
text = get_current_text (self->text_buffer);
|
||||
@@ -183,17 +181,6 @@ text_changed (GtkTextBuffer *buffer,
|
||||
|
||||
/* If this is too slow, go fix the parser performance */
|
||||
self->node = gsk_render_node_deserialize (bytes, deserialize_error_func, self);
|
||||
|
||||
scale = gtk_scale_button_get_value (GTK_SCALE_BUTTON (self->scale_scale));
|
||||
if (self->node && scale != 1.0)
|
||||
{
|
||||
GskRenderNode *node;
|
||||
|
||||
node = gsk_transform_node_new (self->node, gsk_transform_scale (NULL, scale, scale));
|
||||
gsk_render_node_unref (self->node);
|
||||
self->node = node;
|
||||
}
|
||||
|
||||
g_bytes_unref (bytes);
|
||||
if (self->node)
|
||||
{
|
||||
@@ -290,14 +277,6 @@ text_changed (GtkTextBuffer *buffer,
|
||||
&start, &end);
|
||||
}
|
||||
|
||||
static void
|
||||
scale_changed (GObject *object,
|
||||
GParamSpec *pspec,
|
||||
NodeEditorWindow *self)
|
||||
{
|
||||
text_changed (self->text_buffer, self);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
text_view_query_tooltip_cb (GtkWidget *widget,
|
||||
int x,
|
||||
@@ -873,14 +852,6 @@ dark_mode_cb (GtkToggleButton *button,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
node_editor_window_dispose (GObject *object)
|
||||
{
|
||||
gtk_widget_dispose_template (GTK_WIDGET (object), NODE_EDITOR_WINDOW_TYPE);
|
||||
|
||||
G_OBJECT_CLASS (node_editor_window_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
node_editor_window_finalize (GObject *object)
|
||||
{
|
||||
@@ -975,7 +946,6 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
||||
|
||||
object_class->dispose = node_editor_window_dispose;
|
||||
object_class->finalize = node_editor_window_finalize;
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class,
|
||||
@@ -992,7 +962,6 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
|
||||
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, testcase_cairo_checkbutton);
|
||||
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, testcase_name_entry);
|
||||
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, testcase_save_button);
|
||||
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, scale_scale);
|
||||
|
||||
gtk_widget_class_bind_template_callback (widget_class, text_view_query_tooltip_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, open_cb);
|
||||
@@ -1099,7 +1068,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);
|
||||
g_signal_connect (self->scale_scale, "notify::value", G_CALLBACK (scale_changed), self);
|
||||
gtk_text_view_set_buffer (GTK_TEXT_VIEW (self->text_view), self->text_buffer);
|
||||
|
||||
/* Default */
|
||||
|
||||
@@ -157,23 +157,6 @@
|
||||
<signal name="notify::active" handler="dark_mode_cb" swapped="0"/>
|
||||
</object>
|
||||
</child>
|
||||
<child type="end">
|
||||
<object class="GtkScaleButton" id="scale_scale">
|
||||
<property name="focus-on-click">0</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="adjustment">
|
||||
<object class="GtkAdjustment">
|
||||
<property name="lower">1</property>
|
||||
<property name="value">1</property>
|
||||
<property name="upper">10</property>
|
||||
<property name="step-increment">0.1</property>
|
||||
<property name="page-increment">0.5</property>
|
||||
</object>
|
||||
</property>
|
||||
<property name="icons">zoom-in-symbolic</property>
|
||||
<property name="tooltip-text" translatable="yes">Scale the image</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -216,6 +199,7 @@
|
||||
<child>
|
||||
<object class="GtkPicture" id="picture">
|
||||
<property name="can-shrink">0</property>
|
||||
<property name="keep-aspect-ratio">1</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<child>
|
||||
|
||||
@@ -13,8 +13,6 @@ Each node has its own `<node-name>` and supports a custom set of properties, eac
|
||||
|
||||
When serializing and the value of a property equals the default value, this value will not be serialized. Serialization aims to produce an output as small as possible.
|
||||
|
||||
To embed newlines in strings, use \A. To break a long string into multiple lines, escape the newline with a \.
|
||||
|
||||
# Nodes
|
||||
|
||||
### container
|
||||
@@ -137,23 +135,6 @@ Creates a node like `gsk_cross_fade_node_new()` with the given properties.
|
||||
|
||||
Creates a node like `gsk_debug_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.
|
||||
|
||||
### inset-shadow
|
||||
|
||||
| property | syntax | default | printed |
|
||||
@@ -305,3 +286,20 @@ representation for this texture is `url("data:image/png;base64,iVBORw0KGgoAAAANS
|
||||
| transform| `<transform>` | none | non-default |
|
||||
|
||||
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.
|
||||
|
||||
@@ -2081,24 +2081,26 @@ activate (GApplication *app)
|
||||
|
||||
builder = gtk_builder_new ();
|
||||
scope = gtk_builder_cscope_new ();
|
||||
gtk_builder_cscope_add_callback (scope, on_entry_icon_release);
|
||||
gtk_builder_cscope_add_callback (scope, on_scale_button_value_changed);
|
||||
gtk_builder_cscope_add_callback (scope, on_record_button_toggled);
|
||||
gtk_builder_cscope_add_callback (scope, on_page_combo_changed);
|
||||
gtk_builder_cscope_add_callback (scope, on_range_from_changed);
|
||||
gtk_builder_cscope_add_callback (scope, on_range_to_changed);
|
||||
gtk_builder_cscope_add_callback (scope, on_picture_drag_prepare);
|
||||
gtk_builder_cscope_add_callback (scope, on_picture_drop);
|
||||
gtk_builder_cscope_add_callback (scope, tab_close_cb);
|
||||
gtk_builder_cscope_add_callback (scope, increase_icon_size);
|
||||
gtk_builder_cscope_add_callback (scope, decrease_icon_size);
|
||||
gtk_builder_cscope_add_callback (scope, osd_frame_pressed);
|
||||
gtk_builder_cscope_add_callback (scope, age_entry_changed);
|
||||
gtk_builder_cscope_add_callback (scope, validate_more_details);
|
||||
gtk_builder_cscope_add_callback (scope, mode_switch_state_set);
|
||||
gtk_builder_cscope_add_callback (scope, level_scale_value_changed);
|
||||
gtk_builder_cscope_add_callback (scope, transition_speed_changed);
|
||||
gtk_builder_cscope_add_callback (scope, reset_icon_size);
|
||||
gtk_builder_cscope_add_callback_symbols (GTK_BUILDER_CSCOPE (scope),
|
||||
"on_entry_icon_release", (GCallback)on_entry_icon_release,
|
||||
"on_scale_button_value_changed", (GCallback)on_scale_button_value_changed,
|
||||
"on_record_button_toggled", (GCallback)on_record_button_toggled,
|
||||
"on_page_combo_changed", (GCallback)on_page_combo_changed,
|
||||
"on_range_from_changed", (GCallback)on_range_from_changed,
|
||||
"on_range_to_changed", (GCallback)on_range_to_changed,
|
||||
"on_picture_drag_prepare", (GCallback)on_picture_drag_prepare,
|
||||
"on_picture_drop", (GCallback)on_picture_drop,
|
||||
"tab_close_cb", (GCallback)tab_close_cb,
|
||||
"increase_icon_size", (GCallback)increase_icon_size,
|
||||
"decrease_icon_size", (GCallback)decrease_icon_size,
|
||||
"reset_icon_size", (GCallback)reset_icon_size,
|
||||
"osd_frame_pressed", (GCallback)osd_frame_pressed,
|
||||
"age_entry_changed", (GCallback)age_entry_changed,
|
||||
"validate_more_details", (GCallback)validate_more_details,
|
||||
"mode_switch_state_set", (GCallback)mode_switch_state_set,
|
||||
"level_scale_value_changed", (GCallback)level_scale_value_changed,
|
||||
"transition_speed_changed", (GCallback)transition_speed_changed,
|
||||
NULL);
|
||||
gtk_builder_set_scope (builder, scope);
|
||||
g_object_unref (scope);
|
||||
if (!gtk_builder_add_from_resource (builder, "/org/gtk/WidgetFactory4/widget-factory.ui", &error))
|
||||
|
||||
@@ -111,8 +111,6 @@
|
||||
<file>icons/scalable/status/weather-showers-symbolic.svg</file>
|
||||
<file>icons/scalable/status/weather-snow-symbolic.svg</file>
|
||||
|
||||
<file alias='icons/scalable/apps/org.gtk.WidgetFactory4.svg'>data/scalable/apps/org.gtk.WidgetFactory4.svg</file>
|
||||
|
||||
</gresource>
|
||||
<gresource prefix="/org/gtk/WidgetFactory4">
|
||||
<file>gtk-logo.webm</file>
|
||||
|
||||
@@ -1265,7 +1265,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<property name="child">
|
||||
<object class="GtkPicture">
|
||||
<property name="file">resource:///org/gtk/WidgetFactory4/sunset.jpg</property>
|
||||
<property name="content-fit">cover</property>
|
||||
<child>
|
||||
<object class="GtkDragSource">
|
||||
<signal name="prepare" handler="on_picture_drag_prepare" swapped="no"/>
|
||||
|
||||
@@ -5,7 +5,7 @@ repository_url = "https://gitlab.gnome.org/GNOME/gtk.git"
|
||||
website_url = "https://www.gtk.org"
|
||||
authors = "GTK Development Team"
|
||||
logo_url = "gtk-logo.svg"
|
||||
license = "LGPL-2.1-or-later"
|
||||
license = "GPL-2.1-or-later"
|
||||
description = "The GTK toolkit"
|
||||
devhelp = true
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ repository_url = "https://gitlab.gnome.org/GNOME/gtk.git"
|
||||
website_url = "https://www.gtk.org"
|
||||
authors = "GTK Development Team"
|
||||
logo_url = "gtk-logo.svg"
|
||||
license = "LGPL-2.1-or-later"
|
||||
license = "GPL-2.1-or-later"
|
||||
description = "The GTK toolkit"
|
||||
dependencies = ["Gdk-4.0"]
|
||||
devhelp = true
|
||||
|
||||
@@ -339,20 +339,6 @@ using and the GDK backend supports them:
|
||||
`vulkan`
|
||||
: Selects the Vulkan renderer
|
||||
|
||||
Note that on Windows, if one is running Nahimic 3 on a system with
|
||||
nVidia graphics, one needs to stop the "Nahimic service" or insert
|
||||
the GTK application into the Nahimic blacklist, as noted in
|
||||
https://www.nvidia.com/en-us/geforce/forums/game-ready-drivers/13/297952/nahimic-and-nvidia-drivers-conflict/2334568/, or use the cairo renderer (at the cost of being unable to use
|
||||
OpenGL features), or use GDK_DEBUG=gl-gles if you know that GLES
|
||||
support is enabled for the build.
|
||||
|
||||
This is a known issue, as the above link indicates, and affects quite
|
||||
a number of applications--sadly, since this issue lies within the
|
||||
nVidia graphics driver and/or the Nahimic 3 code, we are not able
|
||||
to rememdy this on the GTK side; the best bet before trying the above
|
||||
workarounds is to try to update your graphics drivers and Nahimic
|
||||
installation.
|
||||
|
||||
### `GTK_CSD`
|
||||
|
||||
The default value of this environment variable is `1`. If changed
|
||||
|
||||
@@ -189,7 +189,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
|
||||
message->pointer.state,
|
||||
message->scroll.dir == 0
|
||||
? GDK_SCROLL_UP
|
||||
: GDK_SCROLL_DOWN);
|
||||
: GDK_SCROLL_DOWN,
|
||||
FALSE);
|
||||
|
||||
node = _gdk_event_queue_append (display, event);
|
||||
_gdk_windowing_got_event (display, node, event, message->base.serial);
|
||||
|
||||
@@ -47,10 +47,6 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 67, 3)
|
||||
# define g_memdup2(mem,size) g_memdup((mem), (size))
|
||||
#endif
|
||||
|
||||
/* Forward declarations */
|
||||
static void gdk_broadway_surface_finalize (GObject *object);
|
||||
|
||||
|
||||
@@ -59,8 +59,4 @@ void gdk_source_set_static_name_by_id (guint tag,
|
||||
#define g_source_set_static_name(source, name) g_source_set_name ((source), (name))
|
||||
#endif
|
||||
|
||||
#ifndef I_
|
||||
#define I_(string) g_intern_static_string (string)
|
||||
#endif
|
||||
|
||||
#endif /* __GDK__PRIVATE_H__ */
|
||||
|
||||
@@ -117,7 +117,6 @@ static const GdkDebugKey gdk_debug_keys[] = {
|
||||
{ "selection", GDK_DEBUG_SELECTION, "Information about selections" },
|
||||
{ "clipboard", GDK_DEBUG_CLIPBOARD, "Information about clipboards" },
|
||||
{ "nograbs", GDK_DEBUG_NOGRABS, "Disable pointer and keyboard grabs (X11)" },
|
||||
{ "portals", GDK_DEBUG_PORTALS, "Force the use of portals" },
|
||||
{ "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support" },
|
||||
{ "gl-software", GDK_DEBUG_GL_SOFTWARE, "Force OpenGL software rendering" },
|
||||
{ "gl-texture-rect", GDK_DEBUG_GL_TEXTURE_RECT, "Use OpenGL texture rectangle extension" },
|
||||
@@ -361,13 +360,21 @@ gdk_running_in_sandbox (void)
|
||||
gboolean
|
||||
gdk_should_use_portal (void)
|
||||
{
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (NULL, PORTALS))
|
||||
return TRUE;
|
||||
static const char *use_portal = NULL;
|
||||
|
||||
if (gdk_running_in_sandbox ())
|
||||
return TRUE;
|
||||
if (G_UNLIKELY (use_portal == NULL))
|
||||
{
|
||||
if (gdk_running_in_sandbox ())
|
||||
use_portal = "1";
|
||||
else
|
||||
{
|
||||
use_portal = g_getenv ("GTK_USE_PORTAL");
|
||||
if (!use_portal)
|
||||
use_portal = "";
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return use_portal[0] == '1';
|
||||
}
|
||||
|
||||
PangoDirection
|
||||
|
||||
+1
-2
@@ -29,7 +29,6 @@
|
||||
#include "gdkintl.h"
|
||||
#include "gdkpipeiostreamprivate.h"
|
||||
#include "gdktexture.h"
|
||||
#include "gdk-private.h"
|
||||
|
||||
#include <gobject/gvaluecollector.h>
|
||||
|
||||
@@ -409,7 +408,7 @@ gdk_clipboard_class_init (GdkClipboardClass *class)
|
||||
* Emitted when the clipboard changes ownership.
|
||||
*/
|
||||
signals[CHANGED] =
|
||||
g_signal_new (I_("changed"),
|
||||
g_signal_new ("changed",
|
||||
G_TYPE_FROM_CLASS (class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GdkClipboardClass, changed),
|
||||
|
||||
+4
-50
@@ -184,7 +184,7 @@ gdk_content_formats_new_for_gtype (GType type)
|
||||
* @string: the string to parse
|
||||
*
|
||||
* Parses the given @string into `GdkContentFormats` and
|
||||
* returns the formats.
|
||||
* returns the formats.
|
||||
*
|
||||
* Strings printed via [method@Gdk.ContentFormats.to_string]
|
||||
* can be read in again successfully using this function.
|
||||
@@ -540,7 +540,7 @@ gdk_content_formats_get_gtypes (const GdkContentFormats *formats,
|
||||
|
||||
if (n_gtypes)
|
||||
*n_gtypes = formats->n_gtypes;
|
||||
|
||||
|
||||
return formats->gtypes;
|
||||
}
|
||||
|
||||
@@ -567,7 +567,7 @@ gdk_content_formats_get_mime_types (const GdkContentFormats *formats,
|
||||
|
||||
if (n_mime_types)
|
||||
*n_mime_types = formats->n_mime_types;
|
||||
|
||||
|
||||
return formats->mime_types;
|
||||
}
|
||||
|
||||
@@ -663,7 +663,7 @@ gdk_content_formats_builder_unref (GdkContentFormatsBuilder *builder)
|
||||
|
||||
if (builder->ref_count > 0)
|
||||
return;
|
||||
|
||||
|
||||
gdk_content_formats_builder_clear (builder);
|
||||
g_slice_free (GdkContentFormatsBuilder, builder);
|
||||
}
|
||||
@@ -862,50 +862,4 @@ gdk_file_list_get_files (GdkFileList *file_list)
|
||||
return g_slist_copy ((GSList *) file_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_file_list_new_from_list:
|
||||
* @files: (element-type GFile): a list of files
|
||||
*
|
||||
* Creates a new files list container from a singly linked list of
|
||||
* `GFile` instances.
|
||||
*
|
||||
* This function is meant to be used by language bindings
|
||||
*
|
||||
* Returns: (transfer full): the newly created files list
|
||||
*
|
||||
* Since: 4.8
|
||||
*/
|
||||
GdkFileList *
|
||||
gdk_file_list_new_from_list (GSList *files)
|
||||
{
|
||||
return gdk_file_list_copy (files);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_file_list_new_from_array:
|
||||
* @files: (array length=n_files): the files to add to the list
|
||||
* @n_files: the number of files in the array
|
||||
*
|
||||
* Creates a new `GdkFileList` for the given array of files.
|
||||
*
|
||||
* This function is meant to be used by language bindings.
|
||||
*
|
||||
* Returns: (transfer full): the newly create files list
|
||||
*
|
||||
* Since: 4.8
|
||||
*/
|
||||
GdkFileList *
|
||||
gdk_file_list_new_from_array (GFile **files,
|
||||
gsize n_files)
|
||||
{
|
||||
if (files == NULL || n_files == 0)
|
||||
return NULL;
|
||||
|
||||
GSList *res = NULL;
|
||||
for (gssize i = n_files - 1; i >= 0; i--)
|
||||
res = g_slist_prepend (res, g_object_ref (files[i]));
|
||||
|
||||
return (GdkFileList *) res;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
@@ -122,11 +122,6 @@ typedef struct _GdkFileList GdkFileList;
|
||||
|
||||
GDK_AVAILABLE_IN_4_6
|
||||
GSList * gdk_file_list_get_files (GdkFileList *file_list);
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
GdkFileList * gdk_file_list_new_from_list (GSList *files);
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
GdkFileList * gdk_file_list_new_from_array (GFile **files,
|
||||
gsize n_files);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "gdkclipboard.h"
|
||||
#include "gdkcontentformats.h"
|
||||
#include "gdkintl.h"
|
||||
#include "gdk-private.h"
|
||||
|
||||
/**
|
||||
* GdkContentProvider:
|
||||
@@ -198,7 +197,7 @@ gdk_content_provider_class_init (GdkContentProviderClass *class)
|
||||
* Emitted whenever the content provided by this provider has changed.
|
||||
*/
|
||||
signals[CONTENT_CHANGED] =
|
||||
g_signal_new (I_("content-changed"),
|
||||
g_signal_new ("content-changed",
|
||||
G_TYPE_FROM_CLASS (class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GdkContentProviderClass, content_changed),
|
||||
|
||||
+13
-14
@@ -38,20 +38,19 @@ typedef enum {
|
||||
GDK_DEBUG_CLIPBOARD = 1 << 10,
|
||||
/* flags below are influencing behavior */
|
||||
GDK_DEBUG_NOGRABS = 1 << 11,
|
||||
GDK_DEBUG_PORTALS = 1 << 12,
|
||||
GDK_DEBUG_GL_DISABLE = 1 << 13,
|
||||
GDK_DEBUG_GL_SOFTWARE = 1 << 14,
|
||||
GDK_DEBUG_GL_TEXTURE_RECT = 1 << 15,
|
||||
GDK_DEBUG_GL_LEGACY = 1 << 16,
|
||||
GDK_DEBUG_GL_GLES = 1 << 17,
|
||||
GDK_DEBUG_GL_DEBUG = 1 << 18,
|
||||
GDK_DEBUG_GL_EGL = 1 << 19,
|
||||
GDK_DEBUG_GL_GLX = 1 << 20,
|
||||
GDK_DEBUG_GL_WGL = 1 << 21,
|
||||
GDK_DEBUG_VULKAN_DISABLE = 1 << 22,
|
||||
GDK_DEBUG_VULKAN_VALIDATE = 1 << 23,
|
||||
GDK_DEBUG_DEFAULT_SETTINGS= 1 << 24,
|
||||
GDK_DEBUG_HIGH_DEPTH = 1 << 25,
|
||||
GDK_DEBUG_GL_DISABLE = 1 << 12,
|
||||
GDK_DEBUG_GL_SOFTWARE = 1 << 13,
|
||||
GDK_DEBUG_GL_TEXTURE_RECT = 1 << 14,
|
||||
GDK_DEBUG_GL_LEGACY = 1 << 15,
|
||||
GDK_DEBUG_GL_GLES = 1 << 16,
|
||||
GDK_DEBUG_GL_DEBUG = 1 << 17,
|
||||
GDK_DEBUG_GL_EGL = 1 << 18,
|
||||
GDK_DEBUG_GL_GLX = 1 << 19,
|
||||
GDK_DEBUG_GL_WGL = 1 << 20,
|
||||
GDK_DEBUG_VULKAN_DISABLE = 1 << 21,
|
||||
GDK_DEBUG_VULKAN_VALIDATE = 1 << 22,
|
||||
GDK_DEBUG_DEFAULT_SETTINGS= 1 << 23,
|
||||
GDK_DEBUG_HIGH_DEPTH = 1 << 24,
|
||||
} GdkDebugFlags;
|
||||
|
||||
extern guint _gdk_debug_flags;
|
||||
|
||||
+2
-7
@@ -66,15 +66,10 @@ typedef enum
|
||||
/**
|
||||
* GdkTimeCoord:
|
||||
* @time: The timestamp for this event
|
||||
* @flags: Flags indicating what axes are present, see [flags@Gdk.AxisFlags]
|
||||
* @axes: (array fixed-size=12): axis values, indexed by [enum@Gdk.AxisUse]
|
||||
* @flags: Flags indicating what axes are present
|
||||
* @axes: (array fixed-size=12): axis values
|
||||
*
|
||||
* A `GdkTimeCoord` stores a single event in a motion history.
|
||||
*
|
||||
* To check whether an axis is present, check whether the corresponding
|
||||
* flag from the [flags@Gdk.AxisFlags] enumeration is set in the @flags
|
||||
* To access individual axis values, use the values of the values of
|
||||
* the [enum@Gdk.AxisUse] enumerations as indices.
|
||||
*/
|
||||
struct _GdkTimeCoord
|
||||
{
|
||||
|
||||
+10
-67
@@ -920,6 +920,14 @@ gdk_event_get_pointer_emulated (GdkEvent *event)
|
||||
return tevent->pointer_emulated;
|
||||
}
|
||||
|
||||
case GDK_SCROLL:
|
||||
case GDK_SCROLL_SMOOTH:
|
||||
{
|
||||
GdkScrollEvent *sevent = (GdkScrollEvent *) event;
|
||||
|
||||
return sevent->pointer_emulated;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -2361,82 +2369,19 @@ gdk_scroll_event_new (GdkSurface *surface,
|
||||
|
||||
GdkEvent *
|
||||
gdk_scroll_event_new_discrete (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDeviceTool *tool,
|
||||
guint32 time,
|
||||
GdkModifierType state,
|
||||
GdkScrollDirection direction)
|
||||
{
|
||||
GdkScrollEvent *self = gdk_event_alloc (GDK_SCROLL, surface, device, time);
|
||||
double delta_x = 0, delta_y = 0;
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
case GDK_SCROLL_UP:
|
||||
delta_y = -1;
|
||||
break;
|
||||
case GDK_SCROLL_DOWN:
|
||||
delta_y = 1;
|
||||
break;
|
||||
case GDK_SCROLL_LEFT:
|
||||
delta_x = -1;
|
||||
break;
|
||||
case GDK_SCROLL_RIGHT:
|
||||
delta_x = 1;
|
||||
break;
|
||||
case GDK_SCROLL_SMOOTH:
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
|
||||
self->tool = tool != NULL ? g_object_ref (tool) : NULL;
|
||||
self->state = state;
|
||||
self->direction = direction;
|
||||
self->delta_x = delta_x;
|
||||
self->delta_y = delta_y;
|
||||
self->unit = GDK_SCROLL_UNIT_WHEEL;
|
||||
|
||||
return (GdkEvent *) self;
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gtk_scroll_event_new_value120:
|
||||
* @surface: the `GdkSurface` of the event
|
||||
* @device: the `GdkDevice` of the event
|
||||
* @tool: (nullable): the tool that generated to event
|
||||
* @time: the event serial
|
||||
* @state: Flags to indicate the state of modifier keys and mouse buttons
|
||||
* in events.
|
||||
* @direction: scroll direction.
|
||||
* @delta_x: delta on the X axis in the 120.0 scale
|
||||
* @delta_x: delta on the Y axis in the 120.0 scale
|
||||
*
|
||||
* Creates a new discrete GdkScrollEvent for high resolution mouse wheels.
|
||||
*
|
||||
* Both axes send data in fractions of 120 where each multiple of 120
|
||||
* amounts to one logical scroll event. Fractions of 120 indicate a wheel
|
||||
* movement less than one detent.
|
||||
*
|
||||
* Returns: the newly created scroll event
|
||||
*/
|
||||
GdkEvent *
|
||||
gdk_scroll_event_new_value120 (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDeviceTool *tool,
|
||||
guint32 time,
|
||||
GdkModifierType state,
|
||||
GdkScrollDirection direction,
|
||||
double delta_x,
|
||||
double delta_y)
|
||||
gboolean emulated)
|
||||
{
|
||||
GdkScrollEvent *self = gdk_event_alloc (GDK_SCROLL, surface, device, time);
|
||||
|
||||
self->tool = tool != NULL ? g_object_ref (tool) : NULL;
|
||||
self->state = state;
|
||||
self->direction = direction;
|
||||
self->delta_x = delta_x / 120.0;
|
||||
self->delta_y = delta_y / 120.0;
|
||||
self->pointer_emulated = emulated;
|
||||
self->unit = GDK_SCROLL_UNIT_WHEEL;
|
||||
|
||||
return (GdkEvent *) self;
|
||||
@@ -2676,7 +2621,6 @@ gdk_touchpad_event_new_pinch (GdkSurface *surface,
|
||||
|
||||
GdkEvent *
|
||||
gdk_touchpad_event_new_hold (GdkSurface *surface,
|
||||
GdkEventSequence *sequence,
|
||||
GdkDevice *device,
|
||||
guint32 time,
|
||||
GdkModifierType state,
|
||||
@@ -2689,7 +2633,6 @@ gdk_touchpad_event_new_hold (GdkSurface *surface,
|
||||
|
||||
self->state = state;
|
||||
self->phase = phase;
|
||||
self->sequence = sequence;
|
||||
self->x = x;
|
||||
self->y = y;
|
||||
self->n_fingers = n_fingers;
|
||||
|
||||
+4
-10
@@ -206,6 +206,8 @@ struct _GdkTouchEvent
|
||||
* %GDK_SCROLL_SMOOTH).
|
||||
* @delta_x: the x coordinate of the scroll delta
|
||||
* @delta_y: the y coordinate of the scroll delta
|
||||
* @pointer_emulated: whether the scroll event was the result of
|
||||
* a pointer emulation
|
||||
* @tool: a `GdkDeviceTool`
|
||||
* @history: (element-type GdkTimeCoord): array of times and deltas
|
||||
* for other scroll events that were compressed before delivering the
|
||||
@@ -229,6 +231,7 @@ struct _GdkScrollEvent
|
||||
GdkScrollDirection direction;
|
||||
double delta_x;
|
||||
double delta_y;
|
||||
gboolean pointer_emulated;
|
||||
gboolean is_stop;
|
||||
GdkDeviceTool *tool;
|
||||
GArray *history; /* <GdkTimeCoord> */
|
||||
@@ -489,20 +492,12 @@ GdkEvent * gdk_scroll_event_new (GdkSurface *surface,
|
||||
GdkScrollUnit unit);
|
||||
|
||||
GdkEvent * gdk_scroll_event_new_discrete (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDeviceTool *tool,
|
||||
guint32 time,
|
||||
GdkModifierType state,
|
||||
GdkScrollDirection direction);
|
||||
|
||||
GdkEvent * gdk_scroll_event_new_value120 (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDeviceTool *tool,
|
||||
guint32 time,
|
||||
GdkModifierType state,
|
||||
GdkScrollDirection direction,
|
||||
double delta_x,
|
||||
double delta_y);
|
||||
gboolean emulated);
|
||||
|
||||
GdkEvent * gdk_touch_event_new (GdkEventType type,
|
||||
GdkEventSequence *sequence,
|
||||
@@ -542,7 +537,6 @@ GdkEvent * gdk_touchpad_event_new_pinch (GdkSurface *surface,
|
||||
double angle_delta);
|
||||
|
||||
GdkEvent * gdk_touchpad_event_new_hold (GdkSurface *surface,
|
||||
GdkEventSequence *sequence,
|
||||
GdkDevice *device,
|
||||
guint32 time,
|
||||
GdkModifierType state,
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ typedef struct _GdkFrameClockClass GdkFrameClockClass;
|
||||
* @GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS: corresponds to GdkFrameClock::flush-events. Should not be handled by applications.
|
||||
* @GDK_FRAME_CLOCK_PHASE_BEFORE_PAINT: corresponds to GdkFrameClock::before-paint. Should not be handled by applications.
|
||||
* @GDK_FRAME_CLOCK_PHASE_UPDATE: corresponds to GdkFrameClock::update.
|
||||
* @GDK_FRAME_CLOCK_PHASE_LAYOUT: corresponds to GdkFrameClock::layout. Should not be handled by applications.
|
||||
* @GDK_FRAME_CLOCK_PHASE_LAYOUT: corresponds to GdkFrameClock::layout. Should not be handled by applicatiosn.
|
||||
* @GDK_FRAME_CLOCK_PHASE_PAINT: corresponds to GdkFrameClock::paint.
|
||||
* @GDK_FRAME_CLOCK_PHASE_RESUME_EVENTS: corresponds to GdkFrameClock::resume-events. Should not be handled by applications.
|
||||
* @GDK_FRAME_CLOCK_PHASE_AFTER_PAINT: corresponds to GdkFrameClock::after-paint. Should not be handled by applications.
|
||||
|
||||
@@ -373,9 +373,6 @@ gdk_frame_clock_flush_idle (void *data)
|
||||
else
|
||||
priv->phase = GDK_FRAME_CLOCK_PHASE_NONE;
|
||||
|
||||
g_clear_handle_id (&priv->paint_idle_id, g_source_remove);
|
||||
gdk_frame_clock_paint_idle (data);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
+238
-242
@@ -256,179 +256,181 @@ gdk_gl_context_get_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
#define N_EGL_ATTRS 16
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
static inline EGLenum
|
||||
gdk_api_to_egl_api (GdkGLAPI api)
|
||||
{
|
||||
switch (api)
|
||||
{
|
||||
case GDK_GL_API_GLES:
|
||||
return EGL_OPENGL_ES_API;
|
||||
case GDK_GL_API_GL:
|
||||
default:
|
||||
return EGL_OPENGL_API;
|
||||
}
|
||||
}
|
||||
#define N_EGL_ATTRS 16
|
||||
|
||||
static GdkGLAPI
|
||||
gdk_gl_context_create_egl_context (GdkGLContext *context,
|
||||
GdkGLAPI api,
|
||||
gboolean legacy)
|
||||
gdk_gl_context_real_realize (GdkGLContext *context,
|
||||
GError **error)
|
||||
{
|
||||
#ifdef HAVE_EGL
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
|
||||
GdkDisplay *display = gdk_gl_context_get_display (context);
|
||||
EGLDisplay egl_display = gdk_display_get_egl_display (display);
|
||||
GdkGLContext *share = gdk_display_get_gl_context (display);
|
||||
GdkGLContextPrivate *share_priv = gdk_gl_context_get_instance_private (share);
|
||||
EGLConfig egl_config;
|
||||
EGLContext ctx;
|
||||
EGLint context_attribs[N_EGL_ATTRS], i = 0, flags = 0;
|
||||
gboolean debug_bit, forward_bit;
|
||||
int min_major, min_minor, major = 0, minor = 0;
|
||||
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
|
||||
|
||||
if (!gdk_gl_context_is_api_allowed (context, api, NULL))
|
||||
return 0;
|
||||
|
||||
/* We will use the default version matching the context status
|
||||
* unless the user requested a version which makes sense */
|
||||
gdk_gl_context_get_matching_version (api, legacy,
|
||||
display->have_egl_win32_libangle,
|
||||
&min_major, &min_minor);
|
||||
gdk_gl_context_get_clipped_version (context,
|
||||
min_major, min_minor,
|
||||
&major, &minor);
|
||||
|
||||
if (!eglBindAPI (gdk_api_to_egl_api (api)))
|
||||
return 0;
|
||||
|
||||
debug_bit = gdk_gl_context_get_debug_enabled (context);
|
||||
forward_bit = gdk_gl_context_get_forward_compatible (context);
|
||||
|
||||
if (display->have_egl_no_config_context)
|
||||
egl_config = NULL;
|
||||
else
|
||||
egl_config = gdk_display_get_egl_config (display);
|
||||
|
||||
if (debug_bit)
|
||||
flags |= EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
|
||||
if (forward_bit)
|
||||
flags |= EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
|
||||
|
||||
if (api == GDK_GL_API_GL)
|
||||
if (egl_display)
|
||||
{
|
||||
/* We want a core profile, unless in legacy mode */
|
||||
context_attribs[i++] = EGL_CONTEXT_OPENGL_PROFILE_MASK;
|
||||
context_attribs[i++] = legacy
|
||||
? EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT
|
||||
: EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT;
|
||||
EGLConfig egl_config;
|
||||
GdkGLContext *share = gdk_display_get_gl_context (display);
|
||||
GdkGLContextPrivate *share_priv = gdk_gl_context_get_instance_private (share);
|
||||
EGLContext ctx;
|
||||
EGLint context_attribs[N_EGL_ATTRS];
|
||||
int major, minor, flags;
|
||||
gboolean debug_bit, forward_bit, legacy_bit;
|
||||
GdkGLAPI api;
|
||||
int i = 0;
|
||||
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
|
||||
|
||||
if (share != NULL)
|
||||
gdk_gl_context_get_required_version (share, &major, &minor);
|
||||
else
|
||||
gdk_gl_context_get_required_version (context, &major, &minor);
|
||||
|
||||
debug_bit = gdk_gl_context_get_debug_enabled (context);
|
||||
forward_bit = gdk_gl_context_get_forward_compatible (context);
|
||||
legacy_bit = GDK_DISPLAY_DEBUG_CHECK (display, GL_LEGACY) ||
|
||||
(share != NULL && gdk_gl_context_is_legacy (share));
|
||||
|
||||
if (display->have_egl_no_config_context)
|
||||
egl_config = NULL;
|
||||
else
|
||||
egl_config = gdk_display_get_egl_config (display);
|
||||
|
||||
flags = 0;
|
||||
|
||||
if (debug_bit)
|
||||
flags |= EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
|
||||
if (forward_bit)
|
||||
flags |= EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
|
||||
|
||||
if (gdk_gl_context_is_api_allowed (context, GDK_GL_API_GL, NULL) &&
|
||||
eglBindAPI (EGL_OPENGL_API))
|
||||
{
|
||||
/* We want a core profile, unless in legacy mode */
|
||||
context_attribs[i++] = EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR;
|
||||
context_attribs[i++] = legacy_bit
|
||||
? EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR
|
||||
: EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR;
|
||||
|
||||
/* Specify the version */
|
||||
context_attribs[i++] = EGL_CONTEXT_MAJOR_VERSION_KHR;
|
||||
context_attribs[i++] = legacy_bit ? 3 : major;
|
||||
context_attribs[i++] = EGL_CONTEXT_MINOR_VERSION_KHR;
|
||||
context_attribs[i++] = legacy_bit ? 0 : minor;
|
||||
api = GDK_GL_API_GL;
|
||||
}
|
||||
else if (gdk_gl_context_is_api_allowed (context, GDK_GL_API_GLES, NULL) &&
|
||||
eglBindAPI (EGL_OPENGL_ES_API))
|
||||
{
|
||||
context_attribs[i++] = EGL_CONTEXT_CLIENT_VERSION;
|
||||
if (major == 3)
|
||||
context_attribs[i++] = 3;
|
||||
else
|
||||
context_attribs[i++] = 2;
|
||||
api = GDK_GL_API_GLES;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_set_error_literal (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("The EGL implementation does not support any allowed APIs"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Specify the flags */
|
||||
context_attribs[i++] = EGL_CONTEXT_FLAGS_KHR;
|
||||
context_attribs[i++] = flags;
|
||||
|
||||
context_attribs[i++] = EGL_NONE;
|
||||
g_assert (i < N_EGL_ATTRS);
|
||||
|
||||
GDK_DISPLAY_NOTE (display, OPENGL,
|
||||
g_message ("Creating EGL context version %d.%d (debug:%s, forward:%s, legacy:%s, es:%s)",
|
||||
major, minor,
|
||||
debug_bit ? "yes" : "no",
|
||||
forward_bit ? "yes" : "no",
|
||||
legacy_bit ? "yes" : "no",
|
||||
api == GDK_GL_API_GLES ? "yes" : "no"));
|
||||
|
||||
ctx = eglCreateContext (egl_display,
|
||||
egl_config,
|
||||
share != NULL ? share_priv->egl_context
|
||||
: EGL_NO_CONTEXT,
|
||||
context_attribs);
|
||||
|
||||
/* If context creation failed without the ES bit, let's try again with it */
|
||||
if (ctx == NULL && gdk_gl_context_is_api_allowed (context, GDK_GL_API_GLES, NULL) && eglBindAPI (EGL_OPENGL_ES_API))
|
||||
{
|
||||
i = 0;
|
||||
context_attribs[i++] = EGL_CONTEXT_MAJOR_VERSION;
|
||||
context_attribs[i++] = 2;
|
||||
context_attribs[i++] = EGL_CONTEXT_MINOR_VERSION;
|
||||
context_attribs[i++] = 0;
|
||||
context_attribs[i++] = EGL_CONTEXT_FLAGS_KHR;
|
||||
context_attribs[i++] = flags & ~EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
|
||||
context_attribs[i++] = EGL_NONE;
|
||||
g_assert (i < N_EGL_ATTRS);
|
||||
|
||||
legacy_bit = FALSE;
|
||||
api = GDK_GL_API_GLES;
|
||||
|
||||
GDK_DISPLAY_NOTE (display, OPENGL,
|
||||
g_message ("eglCreateContext failed, switching to OpenGL ES"));
|
||||
ctx = eglCreateContext (egl_display,
|
||||
egl_config,
|
||||
share != NULL ? share_priv->egl_context
|
||||
: EGL_NO_CONTEXT,
|
||||
context_attribs);
|
||||
}
|
||||
|
||||
/* If context creation failed without the legacy bit, let's try again with it */
|
||||
if (ctx == NULL && gdk_gl_context_is_api_allowed (context, GDK_GL_API_GL, NULL) && eglBindAPI (EGL_OPENGL_API))
|
||||
{
|
||||
i = 0;
|
||||
context_attribs[i++] = EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR;
|
||||
context_attribs[i++] = EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR;
|
||||
context_attribs[i++] = EGL_CONTEXT_MAJOR_VERSION;
|
||||
context_attribs[i++] = 3;
|
||||
context_attribs[i++] = EGL_CONTEXT_MINOR_VERSION;
|
||||
context_attribs[i++] = 0;
|
||||
context_attribs[i++] = EGL_CONTEXT_FLAGS_KHR;
|
||||
context_attribs[i++] = flags & ~EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
|
||||
context_attribs[i++] = EGL_NONE;
|
||||
g_assert (i < N_EGL_ATTRS);
|
||||
|
||||
legacy_bit = TRUE;
|
||||
api = GDK_GL_API_GL;
|
||||
|
||||
GDK_DISPLAY_NOTE (display, OPENGL,
|
||||
g_message ("eglCreateContext failed, switching to legacy"));
|
||||
ctx = eglCreateContext (egl_display,
|
||||
egl_config,
|
||||
share != NULL ? share_priv->egl_context
|
||||
: EGL_NO_CONTEXT,
|
||||
context_attribs);
|
||||
}
|
||||
|
||||
if (ctx == NULL)
|
||||
{
|
||||
g_set_error_literal (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("Unable to create a GL context"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
GDK_DISPLAY_NOTE (display, OPENGL, g_message ("Created EGL context[%p]", ctx));
|
||||
|
||||
priv->egl_context = ctx;
|
||||
|
||||
gdk_gl_context_set_is_legacy (context, legacy_bit);
|
||||
|
||||
if (epoxy_has_egl_extension (egl_display, "EGL_KHR_swap_buffers_with_damage"))
|
||||
priv->eglSwapBuffersWithDamage = (gpointer)epoxy_eglGetProcAddress ("eglSwapBuffersWithDamageKHR");
|
||||
else if (epoxy_has_egl_extension (egl_display, "EGL_EXT_swap_buffers_with_damage"))
|
||||
priv->eglSwapBuffersWithDamage = (gpointer)epoxy_eglGetProcAddress ("eglSwapBuffersWithDamageEXT");
|
||||
|
||||
gdk_profiler_end_mark (start_time, "realize GdkWaylandGLContext", NULL);
|
||||
|
||||
return api;
|
||||
}
|
||||
|
||||
if (legacy || api == GDK_GL_API_GLES)
|
||||
flags &= ~EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
|
||||
|
||||
context_attribs[i++] = EGL_CONTEXT_MAJOR_VERSION;
|
||||
context_attribs[i++] = major;
|
||||
context_attribs[i++] = EGL_CONTEXT_MINOR_VERSION;
|
||||
context_attribs[i++] = minor;
|
||||
context_attribs[i++] = EGL_CONTEXT_FLAGS_KHR;
|
||||
context_attribs[i++] = flags;
|
||||
|
||||
context_attribs[i++] = EGL_NONE;
|
||||
g_assert (i < N_EGL_ATTRS);
|
||||
|
||||
GDK_DISPLAY_NOTE (display, OPENGL,
|
||||
g_message ("Creating EGL context version %d.%d (debug:%s, forward:%s, legacy:%s, es:%s)",
|
||||
major, minor,
|
||||
debug_bit ? "yes" : "no",
|
||||
forward_bit ? "yes" : "no",
|
||||
legacy ? "yes" : "no",
|
||||
api == GDK_GL_API_GLES ? "yes" : "no"));
|
||||
|
||||
ctx = eglCreateContext (egl_display,
|
||||
egl_config,
|
||||
share ? share_priv->egl_context : EGL_NO_CONTEXT,
|
||||
context_attribs);
|
||||
|
||||
if (ctx == NULL)
|
||||
return 0;
|
||||
|
||||
GDK_DISPLAY_NOTE (display, OPENGL, g_message ("Created EGL context[%p]", ctx));
|
||||
|
||||
priv->egl_context = ctx;
|
||||
gdk_gl_context_set_is_legacy (context, legacy);
|
||||
|
||||
if (epoxy_has_egl_extension (egl_display, "EGL_KHR_swap_buffers_with_damage"))
|
||||
priv->eglSwapBuffersWithDamage = (gpointer) epoxy_eglGetProcAddress ("eglSwapBuffersWithDamageKHR");
|
||||
else if (epoxy_has_egl_extension (egl_display, "EGL_EXT_swap_buffers_with_damage"))
|
||||
priv->eglSwapBuffersWithDamage = (gpointer) epoxy_eglGetProcAddress ("eglSwapBuffersWithDamageEXT");
|
||||
|
||||
gdk_profiler_end_mark (start_time, "realize GdkWaylandGLContext", NULL);
|
||||
|
||||
return api;
|
||||
}
|
||||
|
||||
static GdkGLAPI
|
||||
gdk_gl_context_realize_egl (GdkGLContext *context,
|
||||
GError **error)
|
||||
{
|
||||
GdkDisplay *display = gdk_gl_context_get_display (context);
|
||||
GdkGLContext *share = gdk_display_get_gl_context (display);
|
||||
GdkGLAPI api, preferred_api;
|
||||
gboolean prefer_legacy;
|
||||
|
||||
if (share && gdk_gl_context_is_api_allowed (context,
|
||||
gdk_gl_context_get_api (share),
|
||||
NULL))
|
||||
preferred_api = gdk_gl_context_get_api (share);
|
||||
else if (gdk_gl_context_is_api_allowed (context, GDK_GL_API_GL, NULL))
|
||||
preferred_api = GDK_GL_API_GL;
|
||||
else if (gdk_gl_context_is_api_allowed (context, GDK_GL_API_GLES, NULL))
|
||||
preferred_api = GDK_GL_API_GLES;
|
||||
else
|
||||
{
|
||||
g_set_error_literal (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("No GL API allowed."));
|
||||
return 0;
|
||||
}
|
||||
|
||||
prefer_legacy = (GDK_DISPLAY_DEBUG_CHECK (display, GL_LEGACY) ||
|
||||
(share != NULL && gdk_gl_context_is_legacy (share)));
|
||||
|
||||
if (preferred_api == GDK_GL_API_GL)
|
||||
{
|
||||
if ((api = gdk_gl_context_create_egl_context (context, GDK_GL_API_GL, prefer_legacy)) ||
|
||||
(api = gdk_gl_context_create_egl_context (context, GDK_GL_API_GLES, FALSE)) ||
|
||||
(api = gdk_gl_context_create_egl_context (context, GDK_GL_API_GL, TRUE)))
|
||||
return api;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((api = gdk_gl_context_create_egl_context (context, GDK_GL_API_GLES, FALSE)) ||
|
||||
(api = gdk_gl_context_create_egl_context (context, GDK_GL_API_GL, prefer_legacy)) ||
|
||||
(api = gdk_gl_context_create_egl_context (context, GDK_GL_API_GL, TRUE)))
|
||||
return api;
|
||||
}
|
||||
|
||||
g_set_error_literal (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("Unable to create a GL context"));
|
||||
return 0;
|
||||
}
|
||||
#endif /* HAVE_EGL */
|
||||
|
||||
static GdkGLAPI
|
||||
gdk_gl_context_default_realize (GdkGLContext *context,
|
||||
GError **error)
|
||||
{
|
||||
#ifdef HAVE_EGL
|
||||
GdkDisplay *display = gdk_gl_context_get_display (context);
|
||||
|
||||
if (gdk_display_get_egl_display (display))
|
||||
return gdk_gl_context_realize_egl (context, error);
|
||||
#endif
|
||||
|
||||
g_set_error_literal (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
@@ -665,7 +667,7 @@ gdk_gl_context_class_init (GdkGLContextClass *klass)
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GdkDrawContextClass *draw_context_class = GDK_DRAW_CONTEXT_CLASS (klass);
|
||||
|
||||
klass->realize = gdk_gl_context_default_realize;
|
||||
klass->realize = gdk_gl_context_real_realize;
|
||||
klass->get_damage = gdk_gl_context_real_get_damage;
|
||||
klass->is_shared = gdk_gl_context_real_is_shared;
|
||||
klass->make_current = gdk_gl_context_real_make_current;
|
||||
@@ -952,48 +954,6 @@ gdk_gl_context_get_forward_compatible (GdkGLContext *context)
|
||||
return priv->forward_compatible;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_gl_context_get_matching_version (GdkGLAPI api,
|
||||
gboolean legacy,
|
||||
gboolean win32_libangle,
|
||||
int *major,
|
||||
int *minor)
|
||||
{
|
||||
int maj, min;
|
||||
|
||||
if (api == GDK_GL_API_GL)
|
||||
{
|
||||
if (legacy)
|
||||
{
|
||||
maj = GDK_GL_MIN_GL_LEGACY_VERSION_MAJOR;
|
||||
min = GDK_GL_MIN_GL_LEGACY_VERSION_MINOR;
|
||||
}
|
||||
else
|
||||
{
|
||||
maj = GDK_GL_MIN_GL_VERSION_MAJOR;
|
||||
min = GDK_GL_MIN_GL_VERSION_MINOR;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (win32_libangle)
|
||||
{
|
||||
maj = GDK_GL_MIN_GLES_WIN32_ANGLE_VERSION_MAJOR;
|
||||
min = GDK_GL_MIN_GLES_WIN32_ANGLE_VERSION_MINOR;
|
||||
}
|
||||
else
|
||||
{
|
||||
maj = GDK_GL_MIN_GLES_VERSION_MAJOR;
|
||||
min = GDK_GL_MIN_GLES_VERSION_MINOR;
|
||||
}
|
||||
}
|
||||
|
||||
if (major != NULL)
|
||||
*major = maj;
|
||||
if (minor != NULL)
|
||||
*minor = min;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_context_set_required_version:
|
||||
* @context: a `GdkGLContext`
|
||||
@@ -1004,10 +964,7 @@ gdk_gl_context_get_matching_version (GdkGLAPI api,
|
||||
*
|
||||
* Setting @major and @minor to zero will use the default values.
|
||||
*
|
||||
* Setting @major and @minor lower than the minimum versions required
|
||||
* by GTK will result in the context choosing the minimum version.
|
||||
*
|
||||
* The @context must not be realized or made current prior to calling
|
||||
* The `GdkGLContext` must not be realized or made current prior to calling
|
||||
* this function.
|
||||
*/
|
||||
void
|
||||
@@ -1016,12 +973,44 @@ gdk_gl_context_set_required_version (GdkGLContext *context,
|
||||
int minor)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
|
||||
gboolean force_gles = FALSE;
|
||||
int version, min_ver;
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
GdkDisplay *display;
|
||||
#endif
|
||||
|
||||
g_return_if_fail (GDK_IS_GL_CONTEXT (context));
|
||||
g_return_if_fail (!gdk_gl_context_is_realized (context));
|
||||
|
||||
priv->major = major;
|
||||
priv->minor = minor;
|
||||
/* this will take care of the default */
|
||||
if (major == 0 && minor == 0)
|
||||
{
|
||||
priv->major = 0;
|
||||
priv->minor = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
version = (major * 100) + minor;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
|
||||
force_gles = GDK_DISPLAY_DEBUG_CHECK (display, GL_GLES);
|
||||
#endif
|
||||
/* Enforce a minimum context version number of 3.2 for desktop GL,
|
||||
* and 2.0 for GLES
|
||||
*/
|
||||
if (gdk_gl_context_get_use_es (context) || force_gles)
|
||||
min_ver = 200;
|
||||
else
|
||||
min_ver = 302;
|
||||
|
||||
if (version < min_ver)
|
||||
{
|
||||
g_warning ("gdk_gl_context_set_required_version - GL context versions less than 3.2 are not supported.");
|
||||
version = min_ver;
|
||||
}
|
||||
priv->major = version / 100;
|
||||
priv->minor = version % 100;
|
||||
}
|
||||
|
||||
gboolean
|
||||
@@ -1060,10 +1049,7 @@ gdk_gl_context_check_version (GdkGLContext *self,
|
||||
* @major: (out) (nullable): return location for the major version to request
|
||||
* @minor: (out) (nullable): return location for the minor version to request
|
||||
*
|
||||
* Retrieves required OpenGL version set as a requirement for the @context
|
||||
* realization. It will not change even if a greater OpenGL version is supported
|
||||
* and used after the @context is realized. See
|
||||
* [method@Gdk.GLContext.get_version] for the real version in use.
|
||||
* Retrieves required OpenGL version.
|
||||
*
|
||||
* See [method@Gdk.GLContext.set_required_version].
|
||||
*/
|
||||
@@ -1073,32 +1059,47 @@ gdk_gl_context_get_required_version (GdkGLContext *context,
|
||||
int *minor)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
|
||||
gboolean force_gles = FALSE;
|
||||
GdkDisplay *display;
|
||||
int default_major, default_minor;
|
||||
int maj, min;
|
||||
|
||||
g_return_if_fail (GDK_IS_GL_CONTEXT (context));
|
||||
|
||||
if (major != NULL)
|
||||
*major = priv->major;
|
||||
if (minor != NULL)
|
||||
*minor = priv->minor;
|
||||
}
|
||||
display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
|
||||
|
||||
void
|
||||
gdk_gl_context_get_clipped_version (GdkGLContext *context,
|
||||
int min_major,
|
||||
int min_minor,
|
||||
int *major,
|
||||
int *minor)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
|
||||
int maj = min_major, min = min_minor;
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
force_gles = GDK_DISPLAY_DEBUG_CHECK (display, GL_GLES);
|
||||
#endif
|
||||
|
||||
g_return_if_fail (GDK_IS_GL_CONTEXT (context));
|
||||
/* libANGLE on Windows at least requires GLES 3.0+ */
|
||||
if (display->have_egl_win32_libangle)
|
||||
force_gles = TRUE;
|
||||
|
||||
if (priv->major > maj || (priv->major == maj && priv->minor > min))
|
||||
/* Default fallback values for uninitialised contexts; we
|
||||
* enforce a context version number of 3.2 for desktop GL,
|
||||
* and 2.0 for GLES
|
||||
*/
|
||||
if (gdk_gl_context_get_use_es (context) || force_gles)
|
||||
{
|
||||
maj = priv->major;
|
||||
min = priv->minor;
|
||||
default_major = display->have_egl_win32_libangle ? 3 : 2;
|
||||
default_minor = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
default_major = 3;
|
||||
default_minor = 2;
|
||||
}
|
||||
|
||||
if (priv->major > 0)
|
||||
maj = priv->major;
|
||||
else
|
||||
maj = default_major;
|
||||
|
||||
if (priv->minor > 0)
|
||||
min = priv->minor;
|
||||
else
|
||||
min = default_minor;
|
||||
|
||||
if (major != NULL)
|
||||
*major = maj;
|
||||
@@ -1335,9 +1336,7 @@ gdk_gl_context_set_use_es (GdkGLContext *context,
|
||||
*
|
||||
* Checks whether the @context is using an OpenGL or OpenGL ES profile.
|
||||
*
|
||||
* Returns: %TRUE if the `GdkGLContext` is using an OpenGL ES profile;
|
||||
* %FALSE if other profile is in use of if the @context has not yet
|
||||
* been realized.
|
||||
* Returns: %TRUE if the `GdkGLContext` is using an OpenGL ES profile
|
||||
*/
|
||||
gboolean
|
||||
gdk_gl_context_get_use_es (GdkGLContext *context)
|
||||
@@ -1668,10 +1667,6 @@ gdk_gl_context_get_shared_context (GdkGLContext *context)
|
||||
* Retrieves the OpenGL version of the @context.
|
||||
*
|
||||
* The @context must be realized prior to calling this function.
|
||||
*
|
||||
* If the @context has never been made current, the version cannot
|
||||
* be known and it will return 0 for both @major and @minor.
|
||||
*
|
||||
*/
|
||||
void
|
||||
gdk_gl_context_get_version (GdkGLContext *context,
|
||||
@@ -1850,3 +1845,4 @@ gdk_gl_backend_use (GdkGLBackend backend_type)
|
||||
|
||||
g_assert (the_gl_backend_type == backend_type);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,22 +33,6 @@ G_BEGIN_DECLS
|
||||
#define GDK_EGL_MIN_VERSION_MAJOR (1)
|
||||
#define GDK_EGL_MIN_VERSION_MINOR (4)
|
||||
|
||||
/* Minimum OpenGL versions supported by GTK.
|
||||
* Backends should make sure to never create a context of a previous version.
|
||||
*
|
||||
* The macros refer to OpenGL; OpenGL with OPENGL_COMPATIBILITY_PROFILE_BIT as
|
||||
* OPENGL_PROFILE_MASK; OpenGL ES; and OpenGL ES win32 Angle implementation,
|
||||
* respectively
|
||||
*/
|
||||
#define GDK_GL_MIN_GL_VERSION_MAJOR (3)
|
||||
#define GDK_GL_MIN_GL_VERSION_MINOR (2)
|
||||
#define GDK_GL_MIN_GL_LEGACY_VERSION_MAJOR (3)
|
||||
#define GDK_GL_MIN_GL_LEGACY_VERSION_MINOR (0)
|
||||
#define GDK_GL_MIN_GLES_VERSION_MAJOR (2)
|
||||
#define GDK_GL_MIN_GLES_VERSION_MINOR (0)
|
||||
#define GDK_GL_MIN_GLES_WIN32_ANGLE_VERSION_MAJOR (3)
|
||||
#define GDK_GL_MIN_GLES_WIN32_ANGLE_VERSION_MINOR (0)
|
||||
|
||||
typedef enum {
|
||||
GDK_GL_NONE = 0,
|
||||
GDK_GL_EGL,
|
||||
@@ -133,16 +117,6 @@ gboolean gdk_gl_context_check_version (GdkGLContext
|
||||
int required_gl_minor,
|
||||
int required_gles_major,
|
||||
int required_gles_minor);
|
||||
void gdk_gl_context_get_clipped_version (GdkGLContext *context,
|
||||
int min_major,
|
||||
int min_minor,
|
||||
int *major,
|
||||
int *minor);
|
||||
void gdk_gl_context_get_matching_version (GdkGLAPI api,
|
||||
gboolean legacy,
|
||||
gboolean win32_libangle,
|
||||
int *major,
|
||||
int *minor);
|
||||
|
||||
gboolean gdk_gl_context_has_unpack_subimage (GdkGLContext *context);
|
||||
void gdk_gl_context_push_debug_group (GdkGLContext *context,
|
||||
|
||||
@@ -199,6 +199,22 @@ gdk_keymap_init (GdkKeymap *keymap)
|
||||
keymap->cache = g_hash_table_new (g_direct_hash, g_direct_equal);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_keymap_get_display:
|
||||
* @keymap: a `GdkKeymap`
|
||||
*
|
||||
* Retrieves the `GdkDisplay` associated to the @keymap.
|
||||
*
|
||||
* Returns: (transfer none): a `GdkDisplay`
|
||||
*/
|
||||
GdkDisplay *
|
||||
gdk_keymap_get_display (GdkKeymap *keymap)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_KEYMAP (keymap), NULL);
|
||||
|
||||
return keymap->display;
|
||||
}
|
||||
|
||||
/* Other key-handling stuff
|
||||
*/
|
||||
|
||||
|
||||
@@ -89,6 +89,8 @@ struct _GdkKeymap
|
||||
|
||||
GType gdk_keymap_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GdkDisplay * gdk_keymap_get_display (GdkKeymap *keymap);
|
||||
|
||||
guint gdk_keymap_lookup_key (GdkKeymap *keymap,
|
||||
const GdkKeymapKey *key);
|
||||
gboolean gdk_keymap_translate_keyboard_state (GdkKeymap *keymap,
|
||||
|
||||
+2
-3
@@ -22,7 +22,6 @@
|
||||
#include "gdkpaintable.h"
|
||||
|
||||
#include "gdksnapshotprivate.h"
|
||||
#include "gdk-private.h"
|
||||
|
||||
/* HACK: So we don't need to include any (not-yet-created) GSK or GTK headers */
|
||||
void gtk_snapshot_push_debug (GdkSnapshot *snapshot,
|
||||
@@ -171,7 +170,7 @@ gdk_paintable_default_init (GdkPaintableInterface *iface)
|
||||
* the icon theme for an icon changing.
|
||||
*/
|
||||
signals[INVALIDATE_CONTENTS] =
|
||||
g_signal_new (I_("invalidate-contents"),
|
||||
g_signal_new ("invalidate-contents",
|
||||
GDK_TYPE_PAINTABLE,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
@@ -195,7 +194,7 @@ gdk_paintable_default_init (GdkPaintableInterface *iface)
|
||||
* the contents of a toplevel surface being resized.
|
||||
*/
|
||||
signals[INVALIDATE_SIZE] =
|
||||
g_signal_new (I_("invalidate-size"),
|
||||
g_signal_new ("invalidate-size",
|
||||
GDK_TYPE_PAINTABLE,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
|
||||
@@ -75,8 +75,6 @@ gdk_io_pipe_unref (GdkIOPipe *pipe)
|
||||
|
||||
g_cond_clear (&pipe->cond);
|
||||
g_mutex_clear (&pipe->mutex);
|
||||
|
||||
g_slice_free (GdkIOPipe, pipe);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
+1
-2
@@ -24,7 +24,6 @@
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdkenumtypes.h"
|
||||
#include "gdkintl.h"
|
||||
#include "gdk-private.h"
|
||||
|
||||
#include <graphene-gobject.h>
|
||||
#include <math.h>
|
||||
@@ -248,7 +247,7 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
|
||||
* will result in an arbitrary size being used as a result.
|
||||
*/
|
||||
signals[COMPUTE_SIZE] =
|
||||
g_signal_new (I_("compute-size"),
|
||||
g_signal_new ("compute-size",
|
||||
GDK_TYPE_TOPLEVEL,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
|
||||
@@ -161,8 +161,6 @@ gdk_load_jpeg (GBytes *input_bytes,
|
||||
|
||||
jpeg_create_decompress (&info);
|
||||
|
||||
info.mem->max_memory_to_use = 300 * 1024 * 1024;
|
||||
|
||||
jpeg_mem_src (&info,
|
||||
g_bytes_get_data (input_bytes, NULL),
|
||||
g_bytes_get_size (input_bytes));
|
||||
@@ -274,7 +272,6 @@ gdk_save_jpeg (GdkTexture *texture)
|
||||
|
||||
info.err = jpeg_std_error (&err);
|
||||
jpeg_create_compress (&info);
|
||||
|
||||
info.image_width = width;
|
||||
info.image_height = height;
|
||||
info.input_components = 3;
|
||||
@@ -283,8 +280,6 @@ gdk_save_jpeg (GdkTexture *texture)
|
||||
jpeg_set_defaults (&info);
|
||||
jpeg_set_quality (&info, 75, TRUE);
|
||||
|
||||
info.mem->max_memory_to_use = 300 * 1024 * 1024;
|
||||
|
||||
jpeg_mem_dest (&info, &data, &size);
|
||||
|
||||
memtex = gdk_memory_texture_from_texture (texture,
|
||||
|
||||
@@ -184,8 +184,7 @@ gdk_load_png (GBytes *bytes,
|
||||
if (color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
png_set_palette_to_rgb (png);
|
||||
|
||||
if (color_type == PNG_COLOR_TYPE_GRAY ||
|
||||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||
if (color_type == PNG_COLOR_TYPE_GRAY)
|
||||
png_set_expand_gray_1_2_4_to_8 (png);
|
||||
|
||||
if (png_get_valid (png, info, PNG_INFO_tRNS))
|
||||
|
||||
@@ -700,7 +700,8 @@ fill_scroll_event (GdkMacosDisplay *self,
|
||||
NULL,
|
||||
get_time_from_ns_event (nsevent),
|
||||
state,
|
||||
direction);
|
||||
direction,
|
||||
FALSE);
|
||||
}
|
||||
|
||||
if (phase == NSEventPhaseEnded || phase == NSEventPhaseCancelled)
|
||||
|
||||
@@ -378,10 +378,7 @@ gdk_macos_gl_context_real_realize (GdkGLContext *context,
|
||||
|
||||
existing = CGLGetCurrentContext ();
|
||||
|
||||
gdk_gl_context_get_clipped_version (context,
|
||||
GDK_GL_MIN_GL_VERSION_MAJOR,
|
||||
GDK_GL_MIN_GL_VERSION_MINOR,
|
||||
&major, &minor);
|
||||
gdk_gl_context_get_required_version (context, &major, &minor);
|
||||
|
||||
display = gdk_gl_context_get_display (context);
|
||||
shared = gdk_display_get_gl_context (display);
|
||||
|
||||
@@ -200,51 +200,23 @@ wl_cursor_destroy(struct wl_cursor *cursor)
|
||||
}
|
||||
|
||||
static struct wl_cursor *
|
||||
wl_cursor_create_from_xcursor_images(struct wl_cursor_theme *theme,
|
||||
wl_cursor_create_from_xcursor_images(XcursorImages *images,
|
||||
struct wl_cursor_theme *theme,
|
||||
const char *name,
|
||||
unsigned int size,
|
||||
unsigned int scale)
|
||||
unsigned int load_size)
|
||||
{
|
||||
char *path;
|
||||
XcursorImages *images;
|
||||
struct cursor *cursor;
|
||||
struct cursor_image *image;
|
||||
int i, nbytes;
|
||||
unsigned int load_size;
|
||||
int load_scale = 1;
|
||||
|
||||
load_size = size * scale;
|
||||
|
||||
path = g_strconcat (theme->path, "/", name, NULL);
|
||||
images = xcursor_load_images (path, load_size);
|
||||
|
||||
if (!images)
|
||||
{
|
||||
g_free (path);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (images->images[0]->width != load_size ||
|
||||
images->images[0]->height != load_size)
|
||||
{
|
||||
xcursor_images_destroy (images);
|
||||
images = xcursor_load_images (path, size);
|
||||
load_scale = scale;
|
||||
}
|
||||
|
||||
g_free (path);
|
||||
int i, size;
|
||||
|
||||
cursor = malloc(sizeof *cursor);
|
||||
if (!cursor) {
|
||||
xcursor_images_destroy (images);
|
||||
if (!cursor)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cursor->cursor.images =
|
||||
malloc(images->nimage * sizeof cursor->cursor.images[0]);
|
||||
if (!cursor->cursor.images) {
|
||||
free(cursor);
|
||||
xcursor_images_destroy (images);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -260,37 +232,22 @@ wl_cursor_create_from_xcursor_images(struct wl_cursor_theme *theme,
|
||||
image->theme = theme;
|
||||
image->buffer = NULL;
|
||||
|
||||
image->image.width = images->images[i]->width * load_scale;
|
||||
image->image.height = images->images[i]->height * load_scale;
|
||||
image->image.hotspot_x = images->images[i]->xhot * load_scale;
|
||||
image->image.hotspot_y = images->images[i]->yhot * load_scale;
|
||||
image->image.width = images->images[i]->width;
|
||||
image->image.height = images->images[i]->height;
|
||||
image->image.hotspot_x = images->images[i]->xhot;
|
||||
image->image.hotspot_y = images->images[i]->yhot;
|
||||
image->image.delay = images->images[i]->delay;
|
||||
|
||||
nbytes = image->image.width * image->image.height * 4;
|
||||
image->offset = shm_pool_allocate(theme->pool, nbytes);
|
||||
size = image->image.width * image->image.height * 4;
|
||||
image->offset = shm_pool_allocate(theme->pool, size);
|
||||
if (image->offset < 0) {
|
||||
free(image);
|
||||
break;
|
||||
}
|
||||
|
||||
if (load_scale == 1) {
|
||||
/* copy pixels to shm pool */
|
||||
memcpy(theme->pool->data + image->offset,
|
||||
images->images[i]->pixels, nbytes);
|
||||
}
|
||||
else {
|
||||
/* scale image up while copying it */
|
||||
for (int y = 0; y < image->image.height; y++) {
|
||||
char *p = theme->pool->data + image->offset + y * image->image.width * 4;
|
||||
char *q = ((char *)images->images[i]->pixels) + (y / load_scale) * images->images[i]->width * 4;
|
||||
for (int x = 0; x < image->image.width; x++) {
|
||||
p[4 * x] = q[4 * (x/load_scale)];
|
||||
p[4 * x + 1] = q[4 * (x/load_scale) + 1];
|
||||
p[4 * x + 2] = q[4 * (x/load_scale) + 2];
|
||||
p[4 * x + 3] = q[4 * (x/load_scale) + 3];
|
||||
}
|
||||
}
|
||||
}
|
||||
/* copy pixels to shm pool */
|
||||
memcpy(theme->pool->data + image->offset,
|
||||
images->images[i]->pixels, size);
|
||||
cursor->total_delay += image->image.delay;
|
||||
cursor->cursor.images[i] = (struct wl_cursor_image *) image;
|
||||
}
|
||||
@@ -300,24 +257,27 @@ wl_cursor_create_from_xcursor_images(struct wl_cursor_theme *theme,
|
||||
free(cursor->cursor.name);
|
||||
free(cursor->cursor.images);
|
||||
free(cursor);
|
||||
xcursor_images_destroy (images);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
xcursor_images_destroy (images);
|
||||
|
||||
return &cursor->cursor;
|
||||
}
|
||||
|
||||
static void
|
||||
load_cursor(struct wl_cursor_theme *theme,
|
||||
const char *name,
|
||||
unsigned int size,
|
||||
unsigned int scale)
|
||||
load_cursor(struct wl_cursor_theme *theme, const char *name, unsigned int size)
|
||||
{
|
||||
XcursorImages *images;
|
||||
struct wl_cursor *cursor;
|
||||
char *path;
|
||||
|
||||
cursor = wl_cursor_create_from_xcursor_images(theme, name, size, scale);
|
||||
path = g_strconcat (theme->path, "/", name, NULL);
|
||||
images = xcursor_load_images (path, size);
|
||||
g_free (path);
|
||||
|
||||
if (!images)
|
||||
return;
|
||||
|
||||
cursor = wl_cursor_create_from_xcursor_images(images, theme, name, size);
|
||||
|
||||
if (cursor) {
|
||||
theme->cursor_count++;
|
||||
@@ -332,6 +292,8 @@ load_cursor(struct wl_cursor_theme *theme,
|
||||
theme->cursors[theme->cursor_count - 1] = cursor;
|
||||
}
|
||||
}
|
||||
|
||||
xcursor_images_destroy (images);
|
||||
}
|
||||
|
||||
/** Load a cursor theme to memory shared with the compositor
|
||||
@@ -411,7 +373,7 @@ wl_cursor_theme_get_cursor(struct wl_cursor_theme *theme,
|
||||
return theme->cursors[i];
|
||||
}
|
||||
|
||||
load_cursor (theme, name, theme->size, scale);
|
||||
load_cursor (theme, name, size);
|
||||
|
||||
if (i < theme->cursor_count) {
|
||||
if (size == theme->cursors[i]->size &&
|
||||
|
||||
@@ -59,17 +59,13 @@ gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context
|
||||
if (display->xdg_activation)
|
||||
{
|
||||
struct xdg_activation_token_v1 *token;
|
||||
struct wl_event_queue *event_queue;
|
||||
struct wl_surface *wl_surface = NULL;
|
||||
GdkWaylandSeat *seat;
|
||||
GdkSurface *focus_surface;
|
||||
AppLaunchData app_launch_data = { 0 };
|
||||
|
||||
event_queue = wl_display_create_queue (display->wl_display);
|
||||
|
||||
seat = GDK_WAYLAND_SEAT (gdk_display_get_default_seat (GDK_DISPLAY (display)));
|
||||
focus_surface = gdk_wayland_device_get_focus (gdk_seat_get_keyboard (GDK_SEAT (seat)));
|
||||
token = xdg_activation_v1_get_activation_token (display->xdg_activation);
|
||||
wl_proxy_set_queue ((struct wl_proxy *) token, event_queue);
|
||||
|
||||
xdg_activation_token_v1_add_listener (token,
|
||||
&token_listener,
|
||||
@@ -77,21 +73,16 @@ gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context
|
||||
xdg_activation_token_v1_set_serial (token,
|
||||
_gdk_wayland_seat_get_last_implicit_grab_serial (seat, NULL),
|
||||
gdk_wayland_seat_get_wl_seat (GDK_SEAT (seat)));
|
||||
|
||||
focus_surface = gdk_wayland_device_get_focus (gdk_seat_get_keyboard (GDK_SEAT (seat)));
|
||||
if (focus_surface)
|
||||
wl_surface = gdk_wayland_surface_get_wl_surface (focus_surface);
|
||||
if (wl_surface)
|
||||
xdg_activation_token_v1_set_surface (token, wl_surface);
|
||||
|
||||
xdg_activation_token_v1_set_surface (token,
|
||||
gdk_wayland_surface_get_wl_surface (focus_surface));
|
||||
xdg_activation_token_v1_commit (token);
|
||||
|
||||
while (app_launch_data.token == NULL)
|
||||
wl_display_dispatch_queue (display->wl_display, event_queue);
|
||||
wl_display_roundtrip (display->wl_display);
|
||||
|
||||
xdg_activation_token_v1_destroy (token);
|
||||
id = app_launch_data.token;
|
||||
wl_event_queue_destroy (event_queue);
|
||||
}
|
||||
else if (display->gtk_shell_version >= 3)
|
||||
{
|
||||
|
||||
@@ -178,7 +178,6 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
|
||||
if (c)
|
||||
{
|
||||
struct wl_cursor_image *image;
|
||||
int cursor_scale;
|
||||
|
||||
if (image_index >= c->image_count)
|
||||
{
|
||||
@@ -190,22 +189,12 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
|
||||
|
||||
image = c->images[image_index];
|
||||
|
||||
cursor_scale = desired_scale;
|
||||
if ((image->width % cursor_scale != 0) ||
|
||||
(image->height % cursor_scale != 0))
|
||||
{
|
||||
g_warning (G_STRLOC " cursor image size (%dx%d) not an integer"
|
||||
"multiple of scale (%d)", image->width, image->height,
|
||||
cursor_scale);
|
||||
cursor_scale = 1;
|
||||
}
|
||||
*hotspot_x = image->hotspot_x / desired_scale;
|
||||
*hotspot_y = image->hotspot_y / desired_scale;
|
||||
|
||||
*hotspot_x = image->hotspot_x / cursor_scale;
|
||||
*hotspot_y = image->hotspot_y / cursor_scale;
|
||||
|
||||
*width = image->width / cursor_scale;
|
||||
*height = image->height / cursor_scale;
|
||||
*scale = cursor_scale;
|
||||
*width = image->width / desired_scale;
|
||||
*height = image->height / desired_scale;
|
||||
*scale = desired_scale;
|
||||
|
||||
return wl_cursor_image_get_buffer (image);
|
||||
}
|
||||
@@ -215,7 +204,7 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
|
||||
cairo_surface_t *surface;
|
||||
struct wl_buffer *buffer;
|
||||
|
||||
texture = g_object_ref (gdk_cursor_get_texture (cursor));
|
||||
texture = gdk_cursor_get_texture (cursor);
|
||||
|
||||
from_texture:
|
||||
surface = g_hash_table_lookup (display->cursor_surface_cache, cursor);
|
||||
@@ -245,8 +234,6 @@ from_texture:
|
||||
buffer = _gdk_wayland_shm_surface_get_wl_buffer (surface);
|
||||
wl_buffer_add_listener (buffer, &buffer_listener, surface);
|
||||
|
||||
g_object_unref (texture);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ struct _GdkWaylandPointerFrameData
|
||||
|
||||
/* Specific to the scroll event */
|
||||
double delta_x, delta_y;
|
||||
int32_t value120_x, value120_y;
|
||||
int32_t discrete_x, discrete_y;
|
||||
gint8 is_scroll_stop;
|
||||
enum wl_pointer_axis_source source;
|
||||
};
|
||||
@@ -1383,54 +1383,21 @@ static GdkDevice * get_scroll_device (GdkWaylandSeat *seat,
|
||||
|
||||
static void
|
||||
flush_discrete_scroll_event (GdkWaylandSeat *seat,
|
||||
gint value120_x,
|
||||
gint value120_y)
|
||||
GdkScrollDirection direction)
|
||||
{
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
|
||||
GdkEvent *event = NULL;
|
||||
GdkEvent *event;
|
||||
GdkDevice *source;
|
||||
GdkScrollDirection direction;
|
||||
|
||||
if (value120_x > 0)
|
||||
direction = GDK_SCROLL_LEFT;
|
||||
else if (value120_x < 0)
|
||||
direction = GDK_SCROLL_RIGHT;
|
||||
else if (value120_y > 0)
|
||||
direction = GDK_SCROLL_DOWN;
|
||||
else
|
||||
direction = GDK_SCROLL_UP;
|
||||
|
||||
source = get_scroll_device (seat, seat->pointer_info.frame.source);
|
||||
event = gdk_scroll_event_new_discrete (seat->pointer_info.focus,
|
||||
source,
|
||||
NULL,
|
||||
seat->pointer_info.time,
|
||||
device_get_modifiers (seat->logical_pointer),
|
||||
direction,
|
||||
TRUE);
|
||||
|
||||
if (display_wayland->seat_version >= WL_POINTER_AXIS_VALUE120_SINCE_VERSION)
|
||||
{
|
||||
event = gdk_scroll_event_new_value120 (seat->pointer_info.focus,
|
||||
source,
|
||||
NULL,
|
||||
seat->pointer_info.time,
|
||||
device_get_modifiers (seat->logical_pointer),
|
||||
direction,
|
||||
value120_x,
|
||||
value120_y);
|
||||
}
|
||||
else
|
||||
{
|
||||
gint discrete_x = value120_x / 120;
|
||||
gint discrete_y = value120_y / 120;
|
||||
|
||||
if (discrete_x != 0 || discrete_y != 0)
|
||||
{
|
||||
event = gdk_scroll_event_new_discrete (seat->pointer_info.focus,
|
||||
source,
|
||||
NULL,
|
||||
seat->pointer_info.time,
|
||||
device_get_modifiers (seat->logical_pointer),
|
||||
direction);
|
||||
}
|
||||
}
|
||||
|
||||
if (event)
|
||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1461,13 +1428,22 @@ flush_scroll_event (GdkWaylandSeat *seat,
|
||||
{
|
||||
gboolean is_stop = FALSE;
|
||||
|
||||
if (pointer_frame->value120_x || pointer_frame->value120_y)
|
||||
if (pointer_frame->discrete_x || pointer_frame->discrete_y)
|
||||
{
|
||||
flush_discrete_scroll_event (seat,
|
||||
pointer_frame->value120_x,
|
||||
pointer_frame->value120_y);
|
||||
pointer_frame->value120_x = 0;
|
||||
pointer_frame->value120_y = 0;
|
||||
GdkScrollDirection direction;
|
||||
|
||||
if (pointer_frame->discrete_x > 0)
|
||||
direction = GDK_SCROLL_LEFT;
|
||||
else if (pointer_frame->discrete_x < 0)
|
||||
direction = GDK_SCROLL_RIGHT;
|
||||
else if (pointer_frame->discrete_y > 0)
|
||||
direction = GDK_SCROLL_DOWN;
|
||||
else
|
||||
direction = GDK_SCROLL_UP;
|
||||
|
||||
flush_discrete_scroll_event (seat, direction);
|
||||
pointer_frame->discrete_x = 0;
|
||||
pointer_frame->discrete_y = 0;
|
||||
}
|
||||
else if (pointer_frame->is_scroll_stop ||
|
||||
pointer_frame->delta_x != 0 ||
|
||||
@@ -1487,8 +1463,8 @@ flush_scroll_event (GdkWaylandSeat *seat,
|
||||
is_stop);
|
||||
}
|
||||
|
||||
pointer_frame->value120_x = 0;
|
||||
pointer_frame->value120_y = 0;
|
||||
pointer_frame->discrete_x = 0;
|
||||
pointer_frame->discrete_y = 0;
|
||||
pointer_frame->delta_x = 0;
|
||||
pointer_frame->delta_y = 0;
|
||||
pointer_frame->is_scroll_stop = FALSE;
|
||||
@@ -1539,6 +1515,8 @@ pointer_handle_enter (void *data,
|
||||
if (!GDK_IS_SURFACE (wl_surface_get_user_data (surface)))
|
||||
return;
|
||||
|
||||
_gdk_wayland_display_update_serial (display_wayland, serial);
|
||||
|
||||
seat->pointer_info.focus = wl_surface_get_user_data (surface);
|
||||
g_object_ref (seat->pointer_info.focus);
|
||||
|
||||
@@ -1580,9 +1558,16 @@ pointer_handle_leave (void *data,
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
|
||||
GdkDeviceGrabInfo *grab;
|
||||
|
||||
if (!surface)
|
||||
return;
|
||||
|
||||
if (!GDK_IS_SURFACE (wl_surface_get_user_data (surface)))
|
||||
return;
|
||||
|
||||
if (!seat->pointer_info.focus)
|
||||
return;
|
||||
|
||||
_gdk_wayland_display_update_serial (display_wayland, serial);
|
||||
grab = _gdk_display_get_last_device_grab (seat->display,
|
||||
seat->logical_pointer);
|
||||
|
||||
@@ -1682,6 +1667,8 @@ pointer_handle_button (void *data,
|
||||
if (!seat->pointer_info.focus)
|
||||
return;
|
||||
|
||||
_gdk_wayland_display_update_serial (display, serial);
|
||||
|
||||
switch (button)
|
||||
{
|
||||
case BTN_LEFT:
|
||||
@@ -1887,10 +1874,10 @@ pointer_handle_axis_discrete (void *data,
|
||||
switch (axis)
|
||||
{
|
||||
case WL_POINTER_AXIS_VERTICAL_SCROLL:
|
||||
pointer_frame->value120_y = value * 120;
|
||||
pointer_frame->discrete_y = value;
|
||||
break;
|
||||
case WL_POINTER_AXIS_HORIZONTAL_SCROLL:
|
||||
pointer_frame->value120_x = value * 120;
|
||||
pointer_frame->discrete_x = value;
|
||||
break;
|
||||
default:
|
||||
g_return_if_reached ();
|
||||
@@ -1901,35 +1888,6 @@ pointer_handle_axis_discrete (void *data,
|
||||
get_axis_name (axis), value, seat));
|
||||
}
|
||||
|
||||
static void
|
||||
pointer_handle_axis_value120 (void *data,
|
||||
struct wl_pointer *pointer,
|
||||
uint32_t axis,
|
||||
int32_t value)
|
||||
{
|
||||
GdkWaylandSeat *seat = data;
|
||||
GdkWaylandPointerFrameData *pointer_frame = &seat->pointer_info.frame;
|
||||
|
||||
if (!seat->pointer_info.focus)
|
||||
return;
|
||||
|
||||
switch (axis)
|
||||
{
|
||||
case WL_POINTER_AXIS_VERTICAL_SCROLL:
|
||||
pointer_frame->value120_y = value;
|
||||
break;
|
||||
case WL_POINTER_AXIS_HORIZONTAL_SCROLL:
|
||||
pointer_frame->value120_x = value;
|
||||
break;
|
||||
default:
|
||||
g_return_if_reached ();
|
||||
}
|
||||
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("value120 scroll, axis %s, value %d, seat %p",
|
||||
get_axis_name (axis), value, seat));
|
||||
}
|
||||
|
||||
static int
|
||||
get_active_layout (GdkKeymap *keymap)
|
||||
{
|
||||
@@ -2029,6 +1987,7 @@ keyboard_handle_enter (void *data,
|
||||
{
|
||||
GdkWaylandSeat *seat = data;
|
||||
GdkEvent *event;
|
||||
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
|
||||
|
||||
if (!surface)
|
||||
return;
|
||||
@@ -2036,6 +1995,8 @@ keyboard_handle_enter (void *data,
|
||||
if (!GDK_IS_SURFACE (wl_surface_get_user_data (surface)))
|
||||
return;
|
||||
|
||||
_gdk_wayland_display_update_serial (display, serial);
|
||||
|
||||
seat->keyboard_focus = wl_surface_get_user_data (surface);
|
||||
g_object_ref (seat->keyboard_focus);
|
||||
seat->repeat_key = 0;
|
||||
@@ -2061,6 +2022,7 @@ keyboard_handle_leave (void *data,
|
||||
{
|
||||
GdkWaylandSeat *seat = data;
|
||||
GdkEvent *event;
|
||||
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
|
||||
|
||||
if (!seat->keyboard_focus)
|
||||
return;
|
||||
@@ -2071,6 +2033,8 @@ keyboard_handle_leave (void *data,
|
||||
*/
|
||||
stop_key_repeat (seat);
|
||||
|
||||
_gdk_wayland_display_update_serial (display, serial);
|
||||
|
||||
event = gdk_focus_event_new (seat->keyboard_focus,
|
||||
seat->logical_keyboard,
|
||||
FALSE);
|
||||
@@ -2309,6 +2273,7 @@ keyboard_handle_key (void *data,
|
||||
uint32_t state_w)
|
||||
{
|
||||
GdkWaylandSeat *seat = data;
|
||||
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
|
||||
|
||||
if (!seat->keyboard_focus)
|
||||
return;
|
||||
@@ -2316,6 +2281,7 @@ keyboard_handle_key (void *data,
|
||||
seat->keyboard_time = time;
|
||||
seat->keyboard_key_serial = serial;
|
||||
seat->repeat_count = 0;
|
||||
_gdk_wayland_display_update_serial (display, serial);
|
||||
deliver_key_event (data, time, key + 8, state_w, FALSE);
|
||||
|
||||
}
|
||||
@@ -2505,9 +2471,12 @@ touch_handle_down (void *data,
|
||||
wl_fixed_t y)
|
||||
{
|
||||
GdkWaylandSeat *seat = data;
|
||||
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
|
||||
GdkWaylandTouchData *touch;
|
||||
GdkEvent *event;
|
||||
|
||||
_gdk_wayland_display_update_serial (display, serial);
|
||||
|
||||
if (!wl_surface)
|
||||
return;
|
||||
|
||||
@@ -2551,9 +2520,12 @@ touch_handle_up (void *data,
|
||||
int32_t id)
|
||||
{
|
||||
GdkWaylandSeat *seat = data;
|
||||
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
|
||||
GdkWaylandTouchData *touch;
|
||||
GdkEvent *event;
|
||||
|
||||
_gdk_wayland_display_update_serial (display, serial);
|
||||
|
||||
touch = gdk_wayland_seat_get_touch (seat, id);
|
||||
if (!touch)
|
||||
return;
|
||||
@@ -2733,6 +2705,9 @@ gesture_swipe_begin (void *data,
|
||||
uint32_t fingers)
|
||||
{
|
||||
GdkWaylandSeat *seat = data;
|
||||
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
|
||||
|
||||
_gdk_wayland_display_update_serial (display, serial);
|
||||
|
||||
emit_gesture_swipe_event (seat,
|
||||
GDK_TOUCHPAD_GESTURE_PHASE_BEGIN,
|
||||
@@ -2765,8 +2740,11 @@ gesture_swipe_end (void *data,
|
||||
int32_t cancelled)
|
||||
{
|
||||
GdkWaylandSeat *seat = data;
|
||||
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
|
||||
GdkTouchpadGesturePhase phase;
|
||||
|
||||
_gdk_wayland_display_update_serial (display, serial);
|
||||
|
||||
phase = (cancelled) ?
|
||||
GDK_TOUCHPAD_GESTURE_PHASE_CANCEL :
|
||||
GDK_TOUCHPAD_GESTURE_PHASE_END;
|
||||
@@ -2829,7 +2807,9 @@ gesture_pinch_begin (void *data,
|
||||
uint32_t fingers)
|
||||
{
|
||||
GdkWaylandSeat *seat = data;
|
||||
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
|
||||
|
||||
_gdk_wayland_display_update_serial (display, serial);
|
||||
emit_gesture_pinch_event (seat,
|
||||
GDK_TOUCHPAD_GESTURE_PHASE_BEGIN,
|
||||
time, fingers, 0, 0, 1, 0);
|
||||
@@ -2864,8 +2844,11 @@ gesture_pinch_end (void *data,
|
||||
int32_t cancelled)
|
||||
{
|
||||
GdkWaylandSeat *seat = data;
|
||||
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
|
||||
GdkTouchpadGesturePhase phase;
|
||||
|
||||
_gdk_wayland_display_update_serial (display, serial);
|
||||
|
||||
phase = (cancelled) ?
|
||||
GDK_TOUCHPAD_GESTURE_PHASE_CANCEL :
|
||||
GDK_TOUCHPAD_GESTURE_PHASE_END;
|
||||
@@ -2888,11 +2871,7 @@ emit_gesture_hold_event (GdkWaylandSeat *seat,
|
||||
|
||||
seat->pointer_info.time = _time;
|
||||
|
||||
if (phase == GDK_TOUCHPAD_GESTURE_PHASE_BEGIN)
|
||||
seat->pointer_info.touchpad_event_sequence++;
|
||||
|
||||
event = gdk_touchpad_event_new_hold (seat->pointer_info.focus,
|
||||
GDK_SLOT_TO_EVENT_SEQUENCE (seat->pointer_info.touchpad_event_sequence),
|
||||
seat->logical_pointer,
|
||||
_time,
|
||||
device_get_modifiers (seat->logical_pointer),
|
||||
@@ -2923,6 +2902,9 @@ gesture_hold_begin (void *data,
|
||||
uint32_t fingers)
|
||||
{
|
||||
GdkWaylandSeat *seat = data;
|
||||
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
|
||||
|
||||
_gdk_wayland_display_update_serial (display, serial);
|
||||
|
||||
emit_gesture_hold_event (seat,
|
||||
GDK_TOUCHPAD_GESTURE_PHASE_BEGIN,
|
||||
@@ -2938,8 +2920,11 @@ gesture_hold_end (void *data,
|
||||
int32_t cancelled)
|
||||
{
|
||||
GdkWaylandSeat *seat = data;
|
||||
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
|
||||
GdkTouchpadGesturePhase phase;
|
||||
|
||||
_gdk_wayland_display_update_serial (display, serial);
|
||||
|
||||
phase = (cancelled) ?
|
||||
GDK_TOUCHPAD_GESTURE_PHASE_CANCEL :
|
||||
GDK_TOUCHPAD_GESTURE_PHASE_END;
|
||||
@@ -3124,7 +3109,6 @@ static const struct wl_pointer_listener pointer_listener = {
|
||||
pointer_handle_axis_source,
|
||||
pointer_handle_axis_stop,
|
||||
pointer_handle_axis_discrete,
|
||||
pointer_handle_axis_value120,
|
||||
};
|
||||
|
||||
static const struct wl_keyboard_listener keyboard_listener = {
|
||||
@@ -3647,6 +3631,8 @@ tablet_tool_handle_proximity_in (void *data,
|
||||
{
|
||||
GdkWaylandTabletToolData *tool = data;
|
||||
GdkWaylandTabletData *tablet = zwp_tablet_v2_get_user_data (wp_tablet);
|
||||
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (tablet->seat);
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
|
||||
GdkSurface *surface;
|
||||
GdkEvent *event;
|
||||
|
||||
@@ -3663,6 +3649,7 @@ tablet_tool_handle_proximity_in (void *data,
|
||||
tool->current_tablet = tablet;
|
||||
tablet->current_tool = tool;
|
||||
|
||||
_gdk_wayland_display_update_serial (display_wayland, serial);
|
||||
tablet->pointer_info.enter_serial = serial;
|
||||
|
||||
tablet->pointer_info.focus = g_object_ref (surface);
|
||||
@@ -3683,9 +3670,9 @@ tablet_tool_handle_proximity_in (void *data,
|
||||
gdk_wayland_surface_get_wl_output (surface));
|
||||
pointer_surface_update_scale (tablet->logical_device);
|
||||
|
||||
GDK_SEAT_NOTE (tablet->seat, EVENTS,
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("proximity in, seat %p surface %p tool %d",
|
||||
tablet->seat, tablet->pointer_info.focus,
|
||||
seat, tablet->pointer_info.focus,
|
||||
gdk_device_tool_get_tool_type (tool->tool)));
|
||||
}
|
||||
|
||||
@@ -3762,10 +3749,13 @@ tablet_tool_handle_down (void *data,
|
||||
{
|
||||
GdkWaylandTabletToolData *tool = data;
|
||||
GdkWaylandTabletData *tablet = tool->current_tablet;
|
||||
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (tool->seat);
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
|
||||
|
||||
if (!tablet || !tablet->pointer_info.focus)
|
||||
return;
|
||||
|
||||
_gdk_wayland_display_update_serial (display_wayland, serial);
|
||||
tablet->pointer_info.press_serial = serial;
|
||||
|
||||
tablet_create_button_event_frame (tablet, GDK_BUTTON_PRESS, GDK_BUTTON_PRIMARY);
|
||||
@@ -4009,6 +3999,17 @@ tablet_tool_handle_wheel (void *data,
|
||||
GDK_SCROLL_UNIT_WHEEL);
|
||||
|
||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||
|
||||
/* Send discrete event */
|
||||
event = gdk_scroll_event_new_discrete (tablet->pointer_info.focus,
|
||||
tablet->stylus_device,
|
||||
tablet->current_tool->tool,
|
||||
tablet->pointer_info.time,
|
||||
device_get_modifiers (tablet->logical_device),
|
||||
clicks > 0 ? GDK_SCROLL_DOWN : GDK_SCROLL_UP,
|
||||
TRUE);
|
||||
|
||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -5316,13 +5317,15 @@ gdk_wayland_device_set_selection (GdkDevice *gdk_device,
|
||||
struct wl_data_source *source)
|
||||
{
|
||||
GdkWaylandSeat *seat;
|
||||
guint32 serial;
|
||||
GdkWaylandDisplay *display_wayland;
|
||||
|
||||
g_return_if_fail (GDK_IS_WAYLAND_DEVICE (gdk_device));
|
||||
|
||||
seat = GDK_WAYLAND_SEAT (gdk_device_get_seat (gdk_device));
|
||||
serial = _gdk_wayland_seat_get_implicit_grab_serial (GDK_SEAT (seat), NULL);
|
||||
wl_data_device_set_selection (seat->data_device, source, serial);
|
||||
display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
|
||||
|
||||
wl_data_device_set_selection (seat->data_device, source,
|
||||
_gdk_wayland_display_get_serial (display_wayland));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -145,6 +145,10 @@ zxdg_shell_v6_ping (void *data,
|
||||
struct zxdg_shell_v6 *xdg_shell,
|
||||
uint32_t serial)
|
||||
{
|
||||
GdkWaylandDisplay *display_wayland = data;
|
||||
|
||||
_gdk_wayland_display_update_serial (display_wayland, serial);
|
||||
|
||||
GDK_DISPLAY_NOTE (GDK_DISPLAY (data), EVENTS,
|
||||
g_message ("ping, shell %p, serial %u\n", xdg_shell, serial));
|
||||
|
||||
@@ -232,7 +236,7 @@ _gdk_wayland_display_add_seat (GdkWaylandDisplay *display_wayland,
|
||||
{
|
||||
struct wl_seat *seat;
|
||||
|
||||
display_wayland->seat_version = MIN (version, 8);
|
||||
display_wayland->seat_version = MIN (version, 7);
|
||||
seat = wl_registry_bind (display_wayland->wl_registry,
|
||||
id, &wl_seat_interface,
|
||||
display_wayland->seat_version);
|
||||
@@ -619,7 +623,7 @@ _gdk_wayland_display_open (const char *display_name)
|
||||
wl_registry_bind (display_wayland->wl_registry,
|
||||
display_wayland->xdg_wm_base_id,
|
||||
&xdg_wm_base_interface,
|
||||
MIN (display_wayland->xdg_wm_base_version, 4));
|
||||
MIN (display_wayland->xdg_wm_base_version, 3));
|
||||
xdg_wm_base_add_listener (display_wayland->xdg_wm_base,
|
||||
&xdg_wm_base_listener,
|
||||
display_wayland);
|
||||
@@ -1120,6 +1124,19 @@ _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland)
|
||||
|
||||
}
|
||||
|
||||
guint32
|
||||
_gdk_wayland_display_get_serial (GdkWaylandDisplay *display_wayland)
|
||||
{
|
||||
return display_wayland->serial;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_wayland_display_update_serial (GdkWaylandDisplay *display_wayland,
|
||||
guint32 serial)
|
||||
{
|
||||
display_wayland->serial = serial;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_wayland_display_get_wl_display: (skip)
|
||||
* @display: (type GdkWaylandDisplay): a `GdkDisplay`
|
||||
@@ -2152,7 +2169,8 @@ gdk_wayland_display_get_setting (GdkDisplay *display,
|
||||
{
|
||||
if (strcmp (name, "gtk-decoration-layout") == 0)
|
||||
set_decoration_layout_from_entry (display, entry, value);
|
||||
else if (strcmp (name, "gtk-theme-name") == 0)
|
||||
else if (strcmp (name, "gtk-theme-name") == 0 ||
|
||||
strcmp (name, "gtk-icon-theme-name") == 0)
|
||||
set_theme_from_entry (display, entry, value);
|
||||
else
|
||||
set_value_from_entry (display, entry, value);
|
||||
|
||||
@@ -84,6 +84,9 @@ struct _GdkWaylandDisplay
|
||||
/* Startup notification */
|
||||
char *startup_notification_id;
|
||||
|
||||
/* Most recent serial */
|
||||
guint32 serial;
|
||||
|
||||
uint32_t xdg_wm_base_id;
|
||||
int xdg_wm_base_version;
|
||||
uint32_t zxdg_shell_v6_id;
|
||||
|
||||
@@ -393,8 +393,8 @@ _gdk_wayland_surface_drag_begin (GdkSurface *surface,
|
||||
wl_data_device_start_drag (gdk_wayland_device_get_data_device (device),
|
||||
drag_wayland->data_source,
|
||||
gdk_wayland_surface_get_wl_surface (surface),
|
||||
drag_wayland->dnd_wl_surface,
|
||||
_gdk_wayland_seat_get_implicit_grab_serial (seat, NULL));
|
||||
drag_wayland->dnd_wl_surface,
|
||||
_gdk_wayland_display_get_serial (display_wayland));
|
||||
|
||||
cursor = gdk_drag_get_cursor (drag, gdk_drag_get_selected_action (drag));
|
||||
gdk_drag_set_cursor (drag, cursor);
|
||||
|
||||
@@ -263,8 +263,6 @@ gdk_wayland_primary_claim (GdkClipboard *clipboard,
|
||||
GdkWaylandDisplay *wdisplay = GDK_WAYLAND_DISPLAY (gdk_clipboard_get_display (clipboard));
|
||||
const char * const *mime_types;
|
||||
gsize i, n_mime_types;
|
||||
GdkSeat *seat;
|
||||
guint32 serial;
|
||||
|
||||
gdk_wayland_primary_discard_offer (cb);
|
||||
gdk_wayland_primary_discard_source (cb);
|
||||
@@ -278,11 +276,9 @@ gdk_wayland_primary_claim (GdkClipboard *clipboard,
|
||||
zwp_primary_selection_source_v1_offer (cb->source, mime_types[i]);
|
||||
}
|
||||
|
||||
seat = gdk_display_get_default_seat (GDK_DISPLAY (wdisplay));
|
||||
serial = _gdk_wayland_seat_get_implicit_grab_serial (seat, NULL);
|
||||
zwp_primary_selection_device_v1_set_selection (cb->primary_data_device,
|
||||
cb->source,
|
||||
serial);
|
||||
_gdk_wayland_display_get_serial (wdisplay));
|
||||
}
|
||||
|
||||
return GDK_CLIPBOARD_CLASS (gdk_wayland_primary_parent_class)->claim (clipboard, formats, local, content);
|
||||
|
||||
@@ -170,6 +170,10 @@ GdkMonitor *gdk_wayland_display_get_monitor_for_output (GdkDisplay *displa
|
||||
void _gdk_wayland_surface_set_grab_seat (GdkSurface *surface,
|
||||
GdkSeat *seat);
|
||||
|
||||
guint32 _gdk_wayland_display_get_serial (GdkWaylandDisplay *display_wayland);
|
||||
void _gdk_wayland_display_update_serial (GdkWaylandDisplay *display_wayland,
|
||||
guint32 serial);
|
||||
|
||||
cairo_surface_t * _gdk_wayland_display_create_shm_surface (GdkWaylandDisplay *display,
|
||||
int width,
|
||||
int height,
|
||||
|
||||
@@ -168,10 +168,6 @@ struct _GdkWaylandSurface
|
||||
|
||||
struct {
|
||||
GdkToplevelLayout *layout;
|
||||
|
||||
int bounds_width;
|
||||
int bounds_height;
|
||||
gboolean has_bounds;
|
||||
} toplevel;
|
||||
|
||||
struct {
|
||||
@@ -186,10 +182,6 @@ struct _GdkWaylandSurface
|
||||
int height;
|
||||
GdkToplevelState state;
|
||||
gboolean is_resizing;
|
||||
|
||||
int bounds_width;
|
||||
int bounds_height;
|
||||
gboolean has_bounds;
|
||||
} toplevel;
|
||||
|
||||
struct {
|
||||
@@ -1402,28 +1394,19 @@ configure_toplevel_geometry (GdkSurface *surface)
|
||||
{
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
GdkDisplay *display = gdk_surface_get_display (surface);
|
||||
GdkMonitor *monitor;
|
||||
GdkRectangle monitor_geometry;
|
||||
int bounds_width, bounds_height;
|
||||
GdkToplevelSize size;
|
||||
GdkToplevelLayout *layout;
|
||||
GdkGeometry geometry;
|
||||
GdkSurfaceHints mask;
|
||||
|
||||
if (impl->toplevel.has_bounds)
|
||||
{
|
||||
bounds_width = impl->toplevel.bounds_width;
|
||||
bounds_height = impl->toplevel.bounds_height;
|
||||
}
|
||||
else
|
||||
{
|
||||
GdkMonitor *monitor;
|
||||
GdkRectangle monitor_geometry;
|
||||
|
||||
monitor = g_list_model_get_item (gdk_display_get_monitors (display), 0);
|
||||
gdk_monitor_get_geometry (monitor, &monitor_geometry);
|
||||
bounds_width = monitor_geometry.width;
|
||||
bounds_height = monitor_geometry.height;
|
||||
g_object_unref (monitor);
|
||||
}
|
||||
monitor = g_list_model_get_item (gdk_display_get_monitors (display), 0);
|
||||
gdk_monitor_get_geometry (monitor, &monitor_geometry);
|
||||
g_object_unref (monitor);
|
||||
bounds_width = monitor_geometry.width;
|
||||
bounds_height = monitor_geometry.height;
|
||||
|
||||
gdk_toplevel_size_init (&size, bounds_width, bounds_height);
|
||||
gdk_toplevel_notify_compute_size (GDK_TOPLEVEL (surface), &size);
|
||||
@@ -1525,13 +1508,6 @@ gdk_wayland_surface_configure_toplevel (GdkSurface *surface)
|
||||
is_resizing = impl->pending.toplevel.is_resizing;
|
||||
impl->pending.toplevel.is_resizing = FALSE;
|
||||
|
||||
if (impl->pending.toplevel.has_bounds)
|
||||
{
|
||||
impl->toplevel.bounds_width = impl->pending.toplevel.bounds_width;
|
||||
impl->toplevel.bounds_height = impl->pending.toplevel.bounds_height;
|
||||
impl->toplevel.has_bounds = TRUE;
|
||||
}
|
||||
|
||||
fixed_size =
|
||||
new_state & (GDK_TOPLEVEL_STATE_MAXIMIZED |
|
||||
GDK_TOPLEVEL_STATE_FULLSCREEN |
|
||||
@@ -1871,24 +1847,9 @@ xdg_toplevel_close (void *data,
|
||||
gdk_wayland_surface_handle_close (surface);
|
||||
}
|
||||
|
||||
static void
|
||||
xdg_toplevel_configure_bounds (void *data,
|
||||
struct xdg_toplevel *xdg_toplevel,
|
||||
int32_t width,
|
||||
int32_t height)
|
||||
{
|
||||
GdkSurface *surface = GDK_SURFACE (data);
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
|
||||
impl->pending.toplevel.bounds_width = width;
|
||||
impl->pending.toplevel.bounds_height = height;
|
||||
impl->pending.toplevel.has_bounds = TRUE;
|
||||
}
|
||||
|
||||
static const struct xdg_toplevel_listener xdg_toplevel_listener = {
|
||||
xdg_toplevel_configure,
|
||||
xdg_toplevel_close,
|
||||
xdg_toplevel_configure_bounds,
|
||||
};
|
||||
|
||||
static void
|
||||
|
||||
@@ -105,7 +105,7 @@ gdk_device_win32_query_state (GdkDevice *device,
|
||||
hwndc = ChildWindowFromPoint (hwnd, point);
|
||||
|
||||
if (hwndc && hwndc != hwnd)
|
||||
*child_window = gdk_win32_handle_table_lookup_ (hwndc);
|
||||
*child_window = gdk_win32_handle_table_lookup (hwndc);
|
||||
else
|
||||
*child_window = NULL; /* Direct child unknown to gdk */
|
||||
}
|
||||
@@ -183,7 +183,7 @@ _gdk_device_win32_surface_at_position (GdkDevice *device,
|
||||
if (!PtInRect (&rect, client_pt))
|
||||
hwnd = NULL;
|
||||
|
||||
window = gdk_win32_handle_table_lookup_ (hwnd);
|
||||
window = gdk_win32_handle_table_lookup (hwnd);
|
||||
|
||||
if (window && (win_x || win_y))
|
||||
{
|
||||
|
||||
@@ -96,7 +96,7 @@ gdk_device_winpointer_query_state (GdkDevice *device,
|
||||
hwndc = ChildWindowFromPoint (hwnd, point);
|
||||
|
||||
if (hwndc && hwndc != hwnd)
|
||||
*child_window = gdk_win32_handle_table_lookup_ (hwndc);
|
||||
*child_window = gdk_win32_handle_table_lookup (hwndc);
|
||||
else
|
||||
*child_window = NULL; /* Direct child unknown to gdk */
|
||||
}
|
||||
@@ -160,7 +160,7 @@ gdk_device_winpointer_surface_at_position (GdkDevice *device,
|
||||
if (!PtInRect (&rect, client_pt))
|
||||
hwnd = NULL;
|
||||
|
||||
surface = gdk_win32_handle_table_lookup_ (hwnd);
|
||||
surface = gdk_win32_handle_table_lookup (hwnd);
|
||||
|
||||
if (surface && (win_x || win_y))
|
||||
{
|
||||
|
||||
@@ -104,7 +104,7 @@ gdk_device_wintab_query_state (GdkDevice *device,
|
||||
hwndc = ChildWindowFromPoint (hwnd, point);
|
||||
|
||||
if (hwndc && hwndc != hwnd)
|
||||
*child_window = gdk_win32_handle_table_lookup_ (hwndc);
|
||||
*child_window = gdk_win32_handle_table_lookup (hwndc);
|
||||
else
|
||||
*child_window = NULL; /* Direct child unknown to gdk */
|
||||
}
|
||||
|
||||
@@ -51,8 +51,8 @@ static int debug_indent = 0;
|
||||
/**
|
||||
* gdk_win32_display_add_filter:
|
||||
* @display: a `GdkWin32Display`
|
||||
* @function: (scope notified): filter callback
|
||||
* @data: (closure): data to pass to filter callback
|
||||
* @function: filter callback
|
||||
* @data: data to pass to filter callback
|
||||
*
|
||||
* Adds an event filter to @window, allowing you to intercept messages
|
||||
* before they reach GDK. This is a low-level operation and makes it
|
||||
@@ -136,8 +136,8 @@ _gdk_win32_message_filter_unref (GdkWin32Display *display,
|
||||
/**
|
||||
* gdk_win32_display_remove_filter:
|
||||
* @display: A `GdkWin32Display`
|
||||
* @function: (scope notified): previously-added filter function
|
||||
* @data: (closure): user data for previously-added filter function
|
||||
* @function: previously-added filter function
|
||||
* @data: user data for previously-added filter function
|
||||
*
|
||||
* Remove a filter previously added with gdk_win32_display_add_filter().
|
||||
*/
|
||||
@@ -1247,8 +1247,6 @@ gdk_win32_display_init_gl (GdkDisplay *display,
|
||||
* Retrieves the EGL display connection object for the given GDK display.
|
||||
*
|
||||
* Returns: (nullable): the EGL display
|
||||
*
|
||||
* Since: 4.4
|
||||
*/
|
||||
gpointer
|
||||
gdk_win32_display_get_egl_display (GdkDisplay *display)
|
||||
|
||||
+11
-23
@@ -142,6 +142,8 @@ struct _drop_target_context
|
||||
static void
|
||||
gdk_win32_drop_init (GdkWin32Drop *drop)
|
||||
{
|
||||
drop->droptarget_w32format_contentformat_map = g_array_new (FALSE, FALSE, sizeof (GdkWin32ContentFormatPair));
|
||||
|
||||
GDK_NOTE (DND, g_print ("gdk_win32_drop_init %p\n", drop));
|
||||
}
|
||||
|
||||
@@ -412,13 +414,9 @@ set_source_actions_helper (GdkDrop *drop,
|
||||
DWORD grfKeyState)
|
||||
{
|
||||
GdkDragAction user_action;
|
||||
GdkWin32Drop *drop_win32;
|
||||
|
||||
user_action = get_user_action (grfKeyState);
|
||||
|
||||
drop_win32 = GDK_WIN32_DROP (drop);
|
||||
drop_win32->actions = actions;
|
||||
|
||||
if (user_action != 0)
|
||||
gdk_drop_set_actions (drop, user_action);
|
||||
else
|
||||
@@ -473,7 +471,6 @@ idroptarget_dragenter (LPDROPTARGET This,
|
||||
GdkDragAction source_actions;
|
||||
GdkDragAction dest_actions;
|
||||
GdkContentFormats *formats;
|
||||
GArray *droptarget_w32format_contentformat_map;
|
||||
|
||||
GDK_NOTE (DND, g_print ("idroptarget_dragenter %p @ %ld : %ld"
|
||||
" for dest window 0x%p"
|
||||
@@ -494,8 +491,7 @@ idroptarget_dragenter (LPDROPTARGET This,
|
||||
|
||||
display = gdk_surface_get_display (ctx->surface);
|
||||
|
||||
droptarget_w32format_contentformat_map = g_array_new (FALSE, FALSE, sizeof (GdkWin32ContentFormatPair));
|
||||
formats = query_object_formats (pDataObj, droptarget_w32format_contentformat_map);
|
||||
formats = query_object_formats (pDataObj, NULL);
|
||||
drop = gdk_drop_new (display,
|
||||
gdk_seat_get_pointer (gdk_display_get_default_seat (display)),
|
||||
drag,
|
||||
@@ -503,7 +499,7 @@ idroptarget_dragenter (LPDROPTARGET This,
|
||||
ctx->surface,
|
||||
GDK_DRAG_PROTO_OLE2);
|
||||
drop_win32 = GDK_WIN32_DROP (drop);
|
||||
drop_win32->droptarget_w32format_contentformat_map = droptarget_w32format_contentformat_map;
|
||||
g_array_set_size (drop_win32->droptarget_w32format_contentformat_map, 0);
|
||||
gdk_content_formats_unref (formats);
|
||||
|
||||
ctx->drop = drop;
|
||||
@@ -524,7 +520,7 @@ idroptarget_dragenter (LPDROPTARGET This,
|
||||
drop_win32->last_key_state = grfKeyState;
|
||||
drop_win32->last_x = pt_x;
|
||||
drop_win32->last_y = pt_y;
|
||||
dest_actions = filter_actions (gdk_drop_get_actions (drop), source_actions);
|
||||
dest_actions = filter_actions (drop_win32->actions, source_actions);
|
||||
*pdwEffect_and_dwOKEffects = drop_effect_for_actions (dest_actions);
|
||||
|
||||
GDK_NOTE (DND, g_print ("idroptarget_dragenter returns S_OK with actions %s"
|
||||
@@ -558,7 +554,9 @@ idroptarget_dragover (LPDROPTARGET This,
|
||||
GdkDragAction source_actions;
|
||||
GdkDragAction dest_actions;
|
||||
|
||||
source_actions = actions_for_drop_effects (*pdwEffect_and_dwOKEffects);
|
||||
source_actions = set_source_actions_helper (ctx->drop,
|
||||
actions_for_drop_effects (*pdwEffect_and_dwOKEffects),
|
||||
grfKeyState);
|
||||
|
||||
GDK_NOTE (DND, g_print ("idroptarget_dragover %p @ %d : %d"
|
||||
" (raw %ld : %ld)"
|
||||
@@ -571,8 +569,7 @@ idroptarget_dragover (LPDROPTARGET This,
|
||||
|
||||
if (pt_x != drop_win32->last_x ||
|
||||
pt_y != drop_win32->last_y ||
|
||||
grfKeyState != drop_win32->last_key_state ||
|
||||
source_actions != drop_win32->actions)
|
||||
grfKeyState != drop_win32->last_key_state)
|
||||
{
|
||||
double x = 0.0;
|
||||
double y = 0.0;
|
||||
@@ -581,15 +578,13 @@ idroptarget_dragover (LPDROPTARGET This,
|
||||
x /= drop_win32->scale;
|
||||
y /= drop_win32->scale;
|
||||
|
||||
set_source_actions_helper (ctx->drop, source_actions, grfKeyState);
|
||||
|
||||
gdk_drop_emit_motion_event (ctx->drop, TRUE, x, y, GDK_CURRENT_TIME);
|
||||
drop_win32->last_key_state = grfKeyState;
|
||||
drop_win32->last_x = pt_x;
|
||||
drop_win32->last_y = pt_y;
|
||||
}
|
||||
|
||||
dest_actions = filter_actions (gdk_drop_get_actions (ctx->drop), source_actions);
|
||||
dest_actions = filter_actions (drop_win32->actions, source_actions);
|
||||
*pdwEffect_and_dwOKEffects = drop_effect_for_actions (dest_actions);
|
||||
|
||||
GDK_NOTE (DND, g_print ("idroptarget_dragover returns S_OK with actions %s"
|
||||
@@ -650,12 +645,8 @@ idroptarget_drop (LPDROPTARGET This,
|
||||
x /= drop_win32->scale;
|
||||
y /= drop_win32->scale;
|
||||
|
||||
gdk_drop_emit_motion_event (ctx->drop, TRUE, x, y, GDK_CURRENT_TIME);
|
||||
|
||||
gdk_drop_emit_drop_event (ctx->drop, TRUE, x, y, GDK_CURRENT_TIME);
|
||||
|
||||
gdk_drop_emit_leave_event (ctx->drop, TRUE, GDK_CURRENT_TIME);
|
||||
|
||||
while (!drop_win32->drop_finished)
|
||||
g_main_context_iteration (NULL, FALSE);
|
||||
|
||||
@@ -833,10 +824,7 @@ gdk_win32_drop_status (GdkDrop *drop,
|
||||
_gdk_win32_drag_action_to_string (gdk_drop_get_actions (drop)),
|
||||
_gdk_win32_drag_action_to_string (preferred)));
|
||||
|
||||
if (preferred != 0)
|
||||
actions = preferred;
|
||||
|
||||
gdk_drop_set_actions (drop, drop_win32->actions & actions);
|
||||
drop_win32->actions = actions;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
+33
-50
@@ -388,7 +388,7 @@ low_level_keyboard_proc (int code,
|
||||
if (kbd_focus_owner == NULL)
|
||||
break;
|
||||
|
||||
gdk_kbd_focus_owner = gdk_win32_handle_table_lookup_ (kbd_focus_owner);
|
||||
gdk_kbd_focus_owner = gdk_win32_handle_table_lookup (kbd_focus_owner);
|
||||
|
||||
if (gdk_kbd_focus_owner == NULL)
|
||||
break;
|
||||
@@ -618,7 +618,7 @@ find_window_for_mouse_event (GdkSurface* reported_window,
|
||||
ScreenToClient (hwnd, &client_pt);
|
||||
GetClientRect (hwnd, &rect);
|
||||
if (PtInRect (&rect, client_pt))
|
||||
event_surface = gdk_win32_handle_table_lookup_ (hwnd);
|
||||
event_surface = gdk_win32_handle_table_lookup (hwnd);
|
||||
}
|
||||
if (event_surface == NULL)
|
||||
event_surface = grab->surface;
|
||||
@@ -1433,42 +1433,35 @@ handle_nchittest (HWND hwnd,
|
||||
gint16 screen_y,
|
||||
int *ret_valp)
|
||||
{
|
||||
RECT rect;
|
||||
GdkWin32Surface *impl;
|
||||
RECT client_rect;
|
||||
POINT client_pt;
|
||||
|
||||
if (window == NULL)
|
||||
if (window == NULL || window->input_region == NULL)
|
||||
return FALSE;
|
||||
|
||||
/* If the window has no particular input pass-through region,
|
||||
* then we can simply let DefWindowProc() handle the message */
|
||||
if (window->input_region == NULL)
|
||||
/* If the window has decorations, DefWindowProc() will take
|
||||
* care of NCHITTEST.
|
||||
*/
|
||||
if (!_gdk_win32_surface_lacks_wm_decorations (window))
|
||||
return FALSE;
|
||||
|
||||
if (!GetClientRect (hwnd, &client_rect))
|
||||
return FALSE;
|
||||
|
||||
client_pt.x = screen_x;
|
||||
client_pt.y = screen_y;
|
||||
if (!ScreenToClient (hwnd, &client_pt))
|
||||
return FALSE;
|
||||
|
||||
/* Check whether the point lies within the client area */
|
||||
if (!PtInRect (&client_rect, client_pt))
|
||||
if (!GetWindowRect (hwnd, &rect))
|
||||
return FALSE;
|
||||
|
||||
impl = GDK_WIN32_SURFACE (window);
|
||||
rect.left = screen_x - rect.left;
|
||||
rect.top = screen_y - rect.top;
|
||||
|
||||
/* If the point lies inside the input region, return HTCLIENT,
|
||||
* otherwise return HTTRANSPARENT. */
|
||||
/* If it's inside the rect, return FALSE and let DefWindowProc() handle it */
|
||||
if (cairo_region_contains_point (window->input_region,
|
||||
client_pt.x / impl->surface_scale,
|
||||
client_pt.y / impl->surface_scale))
|
||||
*ret_valp = HTCLIENT;
|
||||
else
|
||||
*ret_valp = HTTRANSPARENT;
|
||||
rect.left / impl->surface_scale,
|
||||
rect.top / impl->surface_scale))
|
||||
return FALSE;
|
||||
|
||||
/* We handled the message, no need to call DefWindowProc() */
|
||||
/* Otherwise override DefWindowProc() and tell WM that the point is not
|
||||
* within the window
|
||||
*/
|
||||
*ret_valp = HTNOWHERE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1782,7 +1775,7 @@ gdk_event_translate (MSG *msg,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
window = gdk_win32_handle_table_lookup_ (msg->hwnd);
|
||||
window = gdk_win32_handle_table_lookup (msg->hwnd);
|
||||
|
||||
if (window == NULL)
|
||||
{
|
||||
@@ -2297,7 +2290,7 @@ gdk_event_translate (MSG *msg,
|
||||
ScreenToClient (hwnd, &client_pt);
|
||||
GetClientRect (hwnd, &rect);
|
||||
if (PtInRect (&rect, client_pt))
|
||||
new_window = gdk_win32_handle_table_lookup_ (hwnd);
|
||||
new_window = gdk_win32_handle_table_lookup (hwnd);
|
||||
}
|
||||
|
||||
synthesize_crossing_events (display,
|
||||
@@ -2438,7 +2431,7 @@ gdk_event_translate (MSG *msg,
|
||||
ScreenToClient (hwnd, &client_pt);
|
||||
GetClientRect (hwnd, &rect);
|
||||
if (PtInRect (&rect, client_pt))
|
||||
new_window = gdk_win32_handle_table_lookup_ (hwnd);
|
||||
new_window = gdk_win32_handle_table_lookup (hwnd);
|
||||
}
|
||||
|
||||
if (!ignore_leave)
|
||||
@@ -2676,7 +2669,6 @@ gdk_event_translate (MSG *msg,
|
||||
{
|
||||
int16_t scroll_x = 0;
|
||||
int16_t scroll_y = 0;
|
||||
GdkScrollDirection direction;
|
||||
|
||||
char classname[64];
|
||||
|
||||
@@ -2716,7 +2708,7 @@ gdk_event_translate (MSG *msg,
|
||||
|
||||
msg->hwnd = hwnd;
|
||||
|
||||
g_set_object (&window, gdk_win32_handle_table_lookup_ (hwnd));
|
||||
g_set_object (&window, gdk_win32_handle_table_lookup (hwnd));
|
||||
if (!window)
|
||||
break;
|
||||
|
||||
@@ -2728,24 +2720,15 @@ gdk_event_translate (MSG *msg,
|
||||
_gdk_device_virtual_set_active (_gdk_device_manager->core_pointer,
|
||||
_gdk_device_manager->system_pointer);
|
||||
|
||||
direction = 0;
|
||||
if (msg->message == WM_MOUSEWHEEL)
|
||||
direction = (((short) HIWORD (msg->wParam)) > 0)
|
||||
? GDK_SCROLL_UP
|
||||
: GDK_SCROLL_DOWN;
|
||||
else if (msg->message == WM_MOUSEHWHEEL)
|
||||
direction = (((short) HIWORD (msg->wParam)) > 0)
|
||||
? GDK_SCROLL_RIGHT
|
||||
: GDK_SCROLL_LEFT;
|
||||
|
||||
event = gdk_scroll_event_new_value120 (window,
|
||||
device_manager_win32->core_pointer,
|
||||
NULL,
|
||||
_gdk_win32_get_next_tick (msg->time),
|
||||
build_pointer_event_state (msg),
|
||||
direction,
|
||||
(double) scroll_x,
|
||||
(double) -scroll_y);
|
||||
event = gdk_scroll_event_new (window,
|
||||
device_manager_win32->core_pointer,
|
||||
NULL,
|
||||
_gdk_win32_get_next_tick (msg->time),
|
||||
build_pointer_event_state (msg),
|
||||
(double) scroll_x / (double) WHEEL_DELTA,
|
||||
(double) -scroll_y / (double) WHEEL_DELTA,
|
||||
FALSE,
|
||||
GDK_SCROLL_UNIT_WHEEL);
|
||||
|
||||
_gdk_win32_append_event (event);
|
||||
|
||||
@@ -3246,7 +3229,7 @@ gdk_event_translate (MSG *msg,
|
||||
{
|
||||
if (msg->lParam != 0)
|
||||
{
|
||||
GdkSurface *other_surface = gdk_win32_handle_table_lookup_ ((HWND) msg->lParam);
|
||||
GdkSurface *other_surface = gdk_win32_handle_table_lookup ((HWND) msg->lParam);
|
||||
if (other_surface != NULL &&
|
||||
(GDK_IS_POPUP (other_surface) || GDK_IS_DRAG_SURFACE (other_surface)))
|
||||
{
|
||||
|
||||
@@ -548,12 +548,17 @@ gdk_win32_gl_context_wgl_realize (GdkGLContext *context,
|
||||
* wglCreateContextAttribsARB() may only give us the GL context version
|
||||
* that we ask for here, and nothing more. So, improve things here by
|
||||
* asking for the GL version that is reported to us via epoxy_gl_version(),
|
||||
* rather than the default GL core 3.2 context.
|
||||
* rather than the default GL core 3.2 context. Save this up in our
|
||||
* GdkGLContext so that subsequent contexts that are shared with this
|
||||
* context are created likewise too.
|
||||
*/
|
||||
gdk_gl_context_get_clipped_version (context,
|
||||
display_win32->gl_version / 10,
|
||||
display_win32->gl_version % 10,
|
||||
&major, &minor);
|
||||
if (share != NULL)
|
||||
gdk_gl_context_get_required_version (share, &major, &minor);
|
||||
else
|
||||
{
|
||||
major = display_win32->gl_version / 10;
|
||||
minor = display_win32->gl_version % 10;
|
||||
}
|
||||
|
||||
if (surface != NULL)
|
||||
hdc = GDK_WIN32_SURFACE (surface)->hdc;
|
||||
@@ -621,6 +626,7 @@ gdk_win32_gl_context_wgl_realize (GdkGLContext *context,
|
||||
|
||||
/* Ensure that any other context is created with a legacy bit set */
|
||||
gdk_gl_context_set_is_legacy (context, legacy_bit);
|
||||
gdk_gl_context_set_required_version (context, major, minor);
|
||||
|
||||
return GDK_GL_API_GL;
|
||||
}
|
||||
|
||||
@@ -167,10 +167,8 @@ DManipEventHandler_OnContentUpdated (IDirectManipulationViewportEventHandler *se
|
||||
{
|
||||
case GESTURE_PAN:
|
||||
{
|
||||
GdkWin32Surface *surface_win32;
|
||||
GdkModifierType state;
|
||||
uint32_t time;
|
||||
int scale;
|
||||
float pan_x;
|
||||
float pan_y;
|
||||
GdkEvent *event;
|
||||
@@ -178,16 +176,14 @@ DManipEventHandler_OnContentUpdated (IDirectManipulationViewportEventHandler *se
|
||||
pan_x = transform[4];
|
||||
pan_y = transform[5];
|
||||
|
||||
surface_win32 = GDK_WIN32_SURFACE (self->surface);
|
||||
scale = surface_win32->surface_scale;
|
||||
state = util_get_modifier_state ();
|
||||
time = (uint32_t) GetMessageTime ();
|
||||
|
||||
event = gdk_scroll_event_new (self->surface,
|
||||
self->device,
|
||||
NULL, time, state,
|
||||
(self->pan_x - pan_x) / scale,
|
||||
(self->pan_y - pan_y) / scale,
|
||||
self->pan_x - pan_x,
|
||||
self->pan_y - pan_y,
|
||||
FALSE,
|
||||
GDK_SCROLL_UNIT_SURFACE);
|
||||
_gdk_win32_append_event (event);
|
||||
@@ -359,8 +355,6 @@ reset_viewport (IDirectManipulationViewport *viewport)
|
||||
hr = IDirectManipulationContent_SyncContentTransform (content, identity,
|
||||
G_N_ELEMENTS (identity));
|
||||
HR_CHECK (hr);
|
||||
|
||||
IUnknown_Release (content);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -441,12 +441,4 @@ typedef enum _GdkWin32ProcessorCheckType
|
||||
|
||||
gboolean _gdk_win32_check_processor (GdkWin32ProcessorCheckType check_type);
|
||||
|
||||
GdkPixbuf *gdk_win32_icon_to_pixbuf_libgtk_only (HICON hicon,
|
||||
double *x_hot,
|
||||
double *y_hot);
|
||||
HICON gdk_win32_pixbuf_to_hicon_libgtk_only (GdkPixbuf *pixbuf);
|
||||
void gdk_win32_set_modal_dialog_libgtk_only (HWND window);
|
||||
|
||||
gpointer gdk_win32_handle_table_lookup_ (HWND handle);
|
||||
|
||||
#endif /* __GDK_PRIVATE_WIN32_H__ */
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkprivate-win32.h"
|
||||
#include "gdkdisplay-win32.h"
|
||||
#include "gdkwin32.h"
|
||||
|
||||
static char *
|
||||
@@ -163,25 +162,6 @@ _gdk_win32_get_setting (const char *name,
|
||||
g_value_set_int (value, 1);
|
||||
return TRUE;
|
||||
}
|
||||
else if (strcmp ("gtk-xft-dpi", name) == 0)
|
||||
{
|
||||
GdkWin32Display *display = GDK_WIN32_DISPLAY (_gdk_display);
|
||||
|
||||
if (display->dpi_aware_type == PROCESS_SYSTEM_DPI_AWARE &&
|
||||
!display->has_fixed_scale)
|
||||
{
|
||||
int dpi = GetDeviceCaps (GetDC (NULL), LOGPIXELSX);
|
||||
if (dpi >= 96)
|
||||
{
|
||||
int xft_dpi = 1024 * dpi / display->surface_scale;
|
||||
g_value_set_int (value, xft_dpi);
|
||||
GDK_NOTE(MISC, g_print ("gdk_screen_get_setting(\"%s\") : %d\n", name, xft_dpi));
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
else if (strcmp ("gtk-xft-hintstyle", name) == 0)
|
||||
{
|
||||
g_value_set_static_string (value, "hintfull");
|
||||
@@ -240,19 +220,6 @@ _gdk_win32_get_setting (const char *name,
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else if (strcmp ("gtk-overlay-scrolling", name) == 0)
|
||||
{
|
||||
DWORD val = 0;
|
||||
DWORD sz = sizeof (val);
|
||||
LSTATUS ret = 0;
|
||||
|
||||
ret = RegGetValueW (HKEY_CURRENT_USER, L"Control Panel\\Accessibility", L"DynamicScrollbars", RRF_RT_DWORD, NULL, &val, &sz);
|
||||
if (ret == ERROR_SUCCESS)
|
||||
{
|
||||
g_value_set_boolean (value, val != 0);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -1180,11 +1180,6 @@ gdk_win32_surface_layout_popup (GdkSurface *surface,
|
||||
|
||||
monitor = gdk_surface_get_layout_monitor (surface, layout,
|
||||
gdk_win32_monitor_get_workarea);
|
||||
if (!monitor)
|
||||
{
|
||||
GdkDisplay *display = gdk_surface_get_display (surface);
|
||||
monitor = gdk_win32_display_get_primary_monitor (display);
|
||||
}
|
||||
gdk_win32_monitor_get_workarea (monitor, &bounds);
|
||||
|
||||
gdk_popup_layout_get_shadow_width (layout,
|
||||
@@ -1310,27 +1305,19 @@ gdk_win32_surface_raise (GdkSurface *window)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_win32_surface_set_urgency_hint:
|
||||
* @surface: (type GdkWin32Surface): a native `GdkSurface`.
|
||||
* @urgent: if %TRUE, flashes both the window and the taskbar button
|
||||
* continuously.
|
||||
*
|
||||
* Flashes the specified @surface.
|
||||
*/
|
||||
void
|
||||
gdk_win32_surface_set_urgency_hint (GdkSurface *surface,
|
||||
gdk_win32_surface_set_urgency_hint (GdkSurface *window,
|
||||
gboolean urgent)
|
||||
{
|
||||
FLASHWINFO flashwinfo;
|
||||
|
||||
g_return_if_fail (GDK_IS_WIN32_SURFACE (surface));
|
||||
g_return_if_fail (GDK_IS_SURFACE (window));
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (surface))
|
||||
if (GDK_SURFACE_DESTROYED (window))
|
||||
return;
|
||||
|
||||
flashwinfo.cbSize = sizeof (flashwinfo);
|
||||
flashwinfo.hwnd = GDK_SURFACE_HWND (surface);
|
||||
flashwinfo.hwnd = GDK_SURFACE_HWND (window);
|
||||
if (urgent)
|
||||
flashwinfo.dwFlags = FLASHW_ALL | FLASHW_TIMER;
|
||||
else
|
||||
@@ -4246,34 +4233,19 @@ gdk_win32_surface_focus (GdkSurface *window,
|
||||
SetFocus (GDK_SURFACE_HWND (window));
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_win32_surface_lookup_for_display:
|
||||
* @display: a %GdkDisplay
|
||||
* @anid: a HWND window handle
|
||||
*
|
||||
* Returns: (nullable): the %GdkSurface associated with the given @anid, or %NULL.
|
||||
*/
|
||||
GdkSurface *
|
||||
gdk_win32_surface_lookup_for_display (GdkDisplay *display,
|
||||
HWND anid)
|
||||
{
|
||||
g_return_val_if_fail (display == gdk_display_get_default (), NULL);
|
||||
|
||||
return (GdkSurface*) gdk_win32_handle_table_lookup_ (anid);
|
||||
return (GdkSurface*) gdk_win32_handle_table_lookup (anid);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_win32_surface_is_win32:
|
||||
* @surface: a `GdkSurface`
|
||||
*
|
||||
* Returns: %TRUE if the @surface is a win32 implemented surface.
|
||||
*
|
||||
* Deprecated: 4.8: Use `GDK_IS_WIN32_SURFACE` instead.
|
||||
*/
|
||||
gboolean
|
||||
gdk_win32_surface_is_win32 (GdkSurface *surface)
|
||||
gdk_win32_surface_is_win32 (GdkSurface *window)
|
||||
{
|
||||
return GDK_IS_WIN32_SURFACE (surface);
|
||||
return GDK_IS_WIN32_SURFACE (window);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -4307,19 +4279,11 @@ gdk_win32_surface_show_window_menu (GdkSurface *surface,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_win32_surface_get_impl_hwnd:
|
||||
* @surface: a `GdkSurface`
|
||||
*
|
||||
* Returns: the associated @surface HWND handle.
|
||||
*
|
||||
* Deprecated: 4.8: Use gdk_win32_surface_get_handle() instead.
|
||||
*/
|
||||
HWND
|
||||
gdk_win32_surface_get_impl_hwnd (GdkSurface *surface)
|
||||
gdk_win32_surface_get_impl_hwnd (GdkSurface *window)
|
||||
{
|
||||
if (GDK_IS_WIN32_SURFACE (surface))
|
||||
return GDK_SURFACE_HWND (surface);
|
||||
if (GDK_IS_WIN32_SURFACE (window))
|
||||
return GDK_SURFACE_HWND (window);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -4485,8 +4449,9 @@ static void
|
||||
gdk_win32_surface_set_input_region (GdkSurface *window,
|
||||
cairo_region_t *input_region)
|
||||
{
|
||||
/* Input region support is implemented by handling the
|
||||
* WM_NCHITTEST message. */
|
||||
/* Partial input shape support is implemented by handling the
|
||||
* NC_NCHITTEST message
|
||||
*/
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -4649,20 +4614,16 @@ gdk_win32_surface_class_init (GdkWin32SurfaceClass *klass)
|
||||
impl_class->compute_size = _gdk_win32_surface_compute_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_win32_surface_get_handle:
|
||||
* @surface: (type GdkWin32Surface): a native `GdkSurface`.
|
||||
*
|
||||
* Returns the HWND handle belonging to @surface.
|
||||
*
|
||||
* Returns: the associated HWND handle.
|
||||
*/
|
||||
HWND
|
||||
gdk_win32_surface_get_handle (GdkSurface *surface)
|
||||
HGDIOBJ
|
||||
gdk_win32_surface_get_handle (GdkSurface *window)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_WIN32_SURFACE (surface), NULL);
|
||||
if (!GDK_IS_WIN32_SURFACE (window))
|
||||
{
|
||||
g_warning (G_STRLOC " window is not a native Win32 window");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return GDK_SURFACE_HWND (surface);
|
||||
return GDK_SURFACE_HWND (window);
|
||||
}
|
||||
|
||||
#define LAST_PROP 1
|
||||
|
||||
@@ -70,7 +70,7 @@ gdk_win32_handle_table_remove (HANDLE handle)
|
||||
}
|
||||
|
||||
gpointer
|
||||
gdk_win32_handle_table_lookup_ (HWND handle)
|
||||
gdk_win32_handle_table_lookup (HWND handle)
|
||||
{
|
||||
gpointer data = NULL;
|
||||
|
||||
@@ -79,9 +79,3 @@ gdk_win32_handle_table_lookup_ (HWND handle)
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
gpointer
|
||||
gdk_win32_handle_table_lookup (HWND handle)
|
||||
{
|
||||
return gdk_win32_handle_table_lookup_ (handle);
|
||||
}
|
||||
|
||||
@@ -61,6 +61,12 @@ typedef struct _GdkWin32KeymapClass GdkWin32KeymapClass;
|
||||
|
||||
GType gdk_win32_keymap_get_type (void);
|
||||
|
||||
GdkWin32KeymapMatch gdk_win32_keymap_check_compose (GdkWin32Keymap *keymap,
|
||||
guint16 *compose_buffer,
|
||||
gsize compose_buffer_len,
|
||||
guint16 *output,
|
||||
gsize *output_len);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_WIN32_KEYMAP_H__ */
|
||||
|
||||
@@ -68,22 +68,37 @@ G_BEGIN_DECLS
|
||||
#define XBUTTON2 2
|
||||
#endif
|
||||
|
||||
GDK_DEPRECATED_IN_4_8_FOR(GDK_IS_WIN32_SURFACE)
|
||||
gboolean gdk_win32_surface_is_win32 (GdkSurface *surface);
|
||||
GDK_DEPRECATED_IN_4_8_FOR(gdk_win32_surface_get_handle)
|
||||
HWND gdk_win32_surface_get_impl_hwnd (GdkSurface *surface);
|
||||
/* Return true if the GdkSurface is a win32 implemented window */
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_win32_surface_is_win32 (GdkSurface *window);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
HWND gdk_win32_surface_get_impl_hwnd (GdkSurface *window);
|
||||
|
||||
GDK_DEPRECATED_IN_4_8
|
||||
/* Return the Gdk* for a particular HANDLE */
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gpointer gdk_win32_handle_table_lookup (HWND handle);
|
||||
|
||||
/* Translate from window to Windows handle */
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
HWND gdk_win32_surface_get_handle (GdkSurface *surface);
|
||||
HGDIOBJ gdk_win32_surface_get_handle (GdkSurface *window);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkSurface * gdk_win32_surface_lookup_for_display (GdkDisplay *display,
|
||||
HWND anid);
|
||||
|
||||
#if defined (INSIDE_GDK_WIN32) || defined (GTK_COMPILATION) || defined (GTK_COMPILATION)
|
||||
|
||||
/* For internal GTK use only */
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkPixbuf *gdk_win32_icon_to_pixbuf_libgtk_only (HICON hicon,
|
||||
double *x_hot,
|
||||
double *y_hot);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
HICON gdk_win32_pixbuf_to_hicon_libgtk_only (GdkPixbuf *pixbuf);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_win32_set_modal_dialog_libgtk_only (HWND window);
|
||||
|
||||
#endif
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_WIN32_MISC_H__ */
|
||||
|
||||
+13
-16
@@ -1,19 +1,6 @@
|
||||
gdk_win32_public_sources = files([
|
||||
'gdkcursor-win32.c',
|
||||
'gdkdisplay-win32.c',
|
||||
'gdkdisplaymanager-win32.c',
|
||||
'gdkdrag-win32.c',
|
||||
'gdkglcontext-win32.c',
|
||||
'gdkglcontext-win32-wgl.c',
|
||||
'gdkwin32id.c',
|
||||
'gdksurface-win32.c',
|
||||
'gdkevents-win32.c',
|
||||
'gdkmonitor-win32.c',
|
||||
'gdkscreen-win32.c',
|
||||
])
|
||||
|
||||
gdk_win32_sources = gdk_win32_public_sources + files([
|
||||
gdk_win32_sources = files([
|
||||
'gdkcairocontext-win32.c',
|
||||
'gdkcursor-win32.c',
|
||||
'gdkclipboard-win32.c',
|
||||
'gdkclipdrop-win32.c',
|
||||
'gdkdevicemanager-win32.c',
|
||||
@@ -21,7 +8,13 @@ gdk_win32_sources = gdk_win32_public_sources + files([
|
||||
'gdkdevice-win32.c',
|
||||
'gdkdevice-winpointer.c',
|
||||
'gdkdevice-wintab.c',
|
||||
'gdkdisplay-win32.c',
|
||||
'gdkdisplaymanager-win32.c',
|
||||
'gdkdrag-win32.c',
|
||||
'gdkdrop-win32.c',
|
||||
'gdkevents-win32.c',
|
||||
'gdkglcontext-win32.c',
|
||||
'gdkglcontext-win32-wgl.c',
|
||||
'gdkglobals-win32.c',
|
||||
'gdkhdataoutputstream-win32.c',
|
||||
'gdkinput-dmanipulation.c',
|
||||
@@ -31,11 +24,14 @@ gdk_win32_sources = gdk_win32_public_sources + files([
|
||||
'gdkkeys-win32-impl-wow64.c',
|
||||
'gdkwin32langnotification.c',
|
||||
'gdkmain-win32.c',
|
||||
'gdkmonitor-win32.c',
|
||||
'gdkproperty-win32.c',
|
||||
'gdkscreen-win32.c',
|
||||
'gdkvulkancontext-win32.c',
|
||||
'gdkwin32cursor.h',
|
||||
'gdkwin32display.h',
|
||||
'gdkwin32keys.h',
|
||||
'gdkwin32id.c',
|
||||
'gdksurface-win32.c',
|
||||
])
|
||||
|
||||
gdk_win32_public_headers = files([
|
||||
@@ -44,6 +40,7 @@ gdk_win32_public_headers = files([
|
||||
'gdkwin32displaymanager.h',
|
||||
'gdkwin32dnd.h',
|
||||
'gdkwin32glcontext.h',
|
||||
'gdkwin32keys.h',
|
||||
'gdkwin32misc.h',
|
||||
'gdkwin32monitor.h',
|
||||
'gdkwin32screen.h',
|
||||
|
||||
@@ -358,10 +358,10 @@ gdk_x11_clipboard_request_targets_got_stream (GObject *source,
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
else if (g_strcmp0 (type, "ATOM") != 0 || format != 32)
|
||||
else if (!g_str_equal (type, "ATOM") || format != 32)
|
||||
{
|
||||
GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("%s: Wrong reply type to TARGETS: type %s != ATOM or format %d != 32\n",
|
||||
cb->selection, type ? type : "NULL", format));
|
||||
cb->selection, type, format));
|
||||
g_input_stream_close (stream, NULL, NULL);
|
||||
g_object_unref (stream);
|
||||
g_object_unref (cb);
|
||||
|
||||
@@ -1655,7 +1655,8 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
NULL,
|
||||
xev->time,
|
||||
_gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group),
|
||||
direction);
|
||||
direction,
|
||||
FALSE);
|
||||
|
||||
}
|
||||
else
|
||||
@@ -1729,7 +1730,6 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
&xev->valuators, &delta_x, &delta_y))
|
||||
{
|
||||
GdkModifierType state;
|
||||
GdkScrollDirection direction;
|
||||
|
||||
GDK_DISPLAY_NOTE (display, EVENTS,
|
||||
g_message ("smooth scroll: \n\tdevice: %u\n\tsource device: %u\n\twindow %ld\n\tdeltas: %f %f",
|
||||
@@ -1738,36 +1738,28 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
|
||||
state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group);
|
||||
|
||||
if (delta_x > 0)
|
||||
direction = GDK_SCROLL_RIGHT;
|
||||
else if (delta_x < 0)
|
||||
direction = GDK_SCROLL_LEFT;
|
||||
else if (delta_y > 0)
|
||||
direction = GDK_SCROLL_DOWN;
|
||||
else
|
||||
direction = GDK_SCROLL_UP;
|
||||
|
||||
if (gdk_device_get_source (source_device) != GDK_SOURCE_TOUCHPAD &&
|
||||
((delta_x == 0.0 && ABS (delta_y) == 1.0) ||
|
||||
(ABS (delta_x) == 1.0 && delta_y == 0.0)))
|
||||
{
|
||||
GdkScrollDirection direction;
|
||||
|
||||
if (delta_x > 0)
|
||||
direction = GDK_SCROLL_RIGHT;
|
||||
else if (delta_x < 0)
|
||||
direction = GDK_SCROLL_LEFT;
|
||||
else if (delta_y > 0)
|
||||
direction = GDK_SCROLL_DOWN;
|
||||
else
|
||||
direction = GDK_SCROLL_UP;
|
||||
|
||||
event = gdk_scroll_event_new_discrete (surface,
|
||||
device,
|
||||
NULL,
|
||||
xev->time,
|
||||
state,
|
||||
direction);
|
||||
}
|
||||
else if (gdk_device_get_source (source_device) == GDK_SOURCE_MOUSE)
|
||||
{
|
||||
event = gdk_scroll_event_new_value120 (surface,
|
||||
device,
|
||||
NULL,
|
||||
xev->time,
|
||||
state,
|
||||
direction,
|
||||
delta_x * 120.0,
|
||||
delta_y * 120.0);
|
||||
FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+16
-12
@@ -361,9 +361,9 @@ gdk_x11_drop_update_actions (GdkX11Drop *drop_x11)
|
||||
if (!drop_x11->xdnd_have_actions)
|
||||
actions = drop_x11->suggested_action;
|
||||
else if (drop_x11->suggested_action & GDK_ACTION_ASK)
|
||||
actions = drop_x11->xdnd_actions | GDK_ACTION_ASK;
|
||||
else
|
||||
actions = drop_x11->xdnd_actions & GDK_ACTION_ALL;
|
||||
else
|
||||
actions = drop_x11->suggested_action;
|
||||
|
||||
gdk_drop_set_actions (GDK_DROP (drop_x11), actions);
|
||||
}
|
||||
@@ -769,18 +769,22 @@ gdk_x11_drop_status (GdkDrop *drop,
|
||||
|
||||
possible_actions = actions & gdk_drop_get_actions (drop);
|
||||
|
||||
if (preferred & possible_actions)
|
||||
suggested_action = preferred;
|
||||
else if (drop_x11->suggested_action & possible_actions)
|
||||
if (drop_x11->suggested_action != 0)
|
||||
suggested_action = drop_x11->suggested_action;
|
||||
else if (possible_actions & GDK_ACTION_COPY)
|
||||
suggested_action = GDK_ACTION_COPY;
|
||||
else if (possible_actions & GDK_ACTION_MOVE)
|
||||
suggested_action = GDK_ACTION_MOVE;
|
||||
else if (possible_actions & GDK_ACTION_ASK)
|
||||
suggested_action = GDK_ACTION_ASK;
|
||||
else
|
||||
suggested_action = 0;
|
||||
suggested_action = preferred & possible_actions;
|
||||
|
||||
if (suggested_action == 0 && possible_actions != 0)
|
||||
{
|
||||
if (possible_actions & GDK_ACTION_COPY)
|
||||
suggested_action = GDK_ACTION_COPY;
|
||||
else if (possible_actions & GDK_ACTION_MOVE)
|
||||
suggested_action = GDK_ACTION_MOVE;
|
||||
else if (possible_actions & GDK_ACTION_ASK)
|
||||
suggested_action = GDK_ACTION_ASK;
|
||||
else
|
||||
suggested_action = 0;
|
||||
}
|
||||
|
||||
xev.xclient.type = ClientMessage;
|
||||
xev.xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "XdndStatus");
|
||||
|
||||
+168
-143
@@ -213,7 +213,7 @@ gdk_x11_gl_context_glx_clear_current (GdkGLContext *context)
|
||||
static gboolean
|
||||
gdk_x11_gl_context_glx_make_current (GdkGLContext *context,
|
||||
gboolean surfaceless)
|
||||
|
||||
|
||||
{
|
||||
GdkX11GLContextGLX *self = GDK_X11_GL_CONTEXT_GLX (context);
|
||||
GdkDisplay *display = gdk_gl_context_get_display (context);
|
||||
@@ -302,6 +302,68 @@ gdk_x11_gl_context_glx_get_damage (GdkGLContext *context)
|
||||
return GDK_GL_CONTEXT_CLASS (gdk_x11_gl_context_glx_parent_class)->get_damage (context);
|
||||
}
|
||||
|
||||
static GLXContext
|
||||
create_gl3_context (GdkDisplay *display,
|
||||
GLXFBConfig config,
|
||||
GdkGLContext *share,
|
||||
int profile,
|
||||
int flags,
|
||||
int major,
|
||||
int minor)
|
||||
{
|
||||
int attrib_list[] = {
|
||||
GLX_CONTEXT_PROFILE_MASK_ARB, profile,
|
||||
GLX_CONTEXT_MAJOR_VERSION_ARB, major,
|
||||
GLX_CONTEXT_MINOR_VERSION_ARB, minor,
|
||||
GLX_CONTEXT_FLAGS_ARB, flags,
|
||||
None,
|
||||
};
|
||||
GLXContext res;
|
||||
|
||||
GdkX11GLContextGLX *share_glx = NULL;
|
||||
|
||||
if (share != NULL)
|
||||
share_glx = GDK_X11_GL_CONTEXT_GLX (share);
|
||||
|
||||
gdk_x11_display_error_trap_push (display);
|
||||
|
||||
res = glXCreateContextAttribsARB (gdk_x11_display_get_xdisplay (display),
|
||||
config,
|
||||
share_glx != NULL ? share_glx->glx_context : NULL,
|
||||
True,
|
||||
attrib_list);
|
||||
|
||||
if (gdk_x11_display_error_trap_pop (display))
|
||||
return NULL;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static GLXContext
|
||||
create_legacy_context (GdkDisplay *display,
|
||||
GLXFBConfig config,
|
||||
GdkGLContext *share)
|
||||
{
|
||||
GdkX11GLContextGLX *share_glx = NULL;
|
||||
GLXContext res;
|
||||
|
||||
if (share != NULL)
|
||||
share_glx = GDK_X11_GL_CONTEXT_GLX (share);
|
||||
|
||||
gdk_x11_display_error_trap_push (display);
|
||||
|
||||
res = glXCreateNewContext (gdk_x11_display_get_xdisplay (display),
|
||||
config,
|
||||
GLX_RGBA_TYPE,
|
||||
share_glx != NULL ? share_glx->glx_context : NULL,
|
||||
TRUE);
|
||||
|
||||
if (gdk_x11_display_error_trap_pop (display))
|
||||
return NULL;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
#ifdef HAVE_XDAMAGE
|
||||
static void
|
||||
bind_context_for_frame_fence (GdkX11GLContextGLX *self)
|
||||
@@ -445,111 +507,134 @@ on_surface_state_changed (GdkGLContext *context)
|
||||
*/
|
||||
finish_frame (context);
|
||||
}
|
||||
#endif /* HAVE_XDAMAGE */
|
||||
|
||||
#define N_GLX_ATTRS 16
|
||||
#endif
|
||||
|
||||
static GdkGLAPI
|
||||
gdk_x11_context_create_glx_context (GdkGLContext *context,
|
||||
GdkGLAPI api,
|
||||
gboolean legacy)
|
||||
gdk_x11_gl_context_glx_realize (GdkGLContext *context,
|
||||
GError **error)
|
||||
{
|
||||
GdkX11GLContextGLX *context_glx = GDK_X11_GL_CONTEXT_GLX (context);;
|
||||
GdkDisplay *display = gdk_gl_context_get_display (context);
|
||||
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
|
||||
Display *dpy = gdk_x11_display_get_xdisplay (display);
|
||||
GdkGLContext *share = gdk_display_get_gl_context (display);
|
||||
GdkX11GLContextGLX *share_glx = NULL;
|
||||
GdkSurface *surface = gdk_gl_context_get_surface (context);
|
||||
GLXContext ctx;
|
||||
int context_attribs[N_GLX_ATTRS], i = 0, flags = 0;
|
||||
int min_major, min_minor, major, minor;
|
||||
gboolean debug_bit, compat_bit;
|
||||
GdkX11Display *display_x11;
|
||||
GdkDisplay *display;
|
||||
GdkX11GLContextGLX *context_glx;
|
||||
Display *dpy;
|
||||
GdkSurface *surface;
|
||||
GdkGLContext *share;
|
||||
gboolean debug_bit, compat_bit, legacy_bit;
|
||||
int major, minor, flags;
|
||||
GdkGLAPI api = 0;
|
||||
|
||||
if (!gdk_gl_context_is_api_allowed (context, api, NULL))
|
||||
return 0;
|
||||
|
||||
if (api == GDK_GL_API_GLES && legacy)
|
||||
return 0;
|
||||
|
||||
/* We will use the default version matching the context status
|
||||
* unless the user requested a version which makes sense */
|
||||
gdk_gl_context_get_matching_version (api, legacy, 0,
|
||||
&min_major, &min_minor);
|
||||
gdk_gl_context_get_clipped_version (context, min_major, min_minor,
|
||||
&major, &minor);
|
||||
display = gdk_gl_context_get_display (context);
|
||||
dpy = gdk_x11_display_get_xdisplay (display);
|
||||
context_glx = GDK_X11_GL_CONTEXT_GLX (context);
|
||||
display_x11 = GDK_X11_DISPLAY (display);
|
||||
share = gdk_display_get_gl_context (display);
|
||||
surface = gdk_gl_context_get_surface (context);
|
||||
|
||||
gdk_gl_context_get_required_version (context, &major, &minor);
|
||||
debug_bit = gdk_gl_context_get_debug_enabled (context);
|
||||
compat_bit = gdk_gl_context_get_forward_compatible (context);
|
||||
|
||||
/* If there is no glXCreateContextAttribsARB() then we default to legacy */
|
||||
legacy_bit = !display_x11->has_glx_create_context || GDK_DISPLAY_DEBUG_CHECK (display, GL_LEGACY);
|
||||
|
||||
/* We cannot share legacy contexts with core profile ones, so the
|
||||
* shared context is the one that decides if we're going to create
|
||||
* a legacy context or not.
|
||||
*/
|
||||
if (share != NULL && gdk_gl_context_is_legacy (share))
|
||||
legacy_bit = TRUE;
|
||||
|
||||
flags = 0;
|
||||
if (debug_bit)
|
||||
flags |= GLX_CONTEXT_DEBUG_BIT_ARB;
|
||||
if (compat_bit)
|
||||
flags |= GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
|
||||
|
||||
context_attribs[i++] = GLX_CONTEXT_PROFILE_MASK_ARB;
|
||||
if (api == GDK_GL_API_GL)
|
||||
if (legacy)
|
||||
context_attribs[i++] = GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
|
||||
else
|
||||
context_attribs[i++] = GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
|
||||
else if (api == GDK_GL_API_GLES)
|
||||
context_attribs[i++] = GLX_CONTEXT_ES2_PROFILE_BIT_EXT;
|
||||
|
||||
context_attribs[i++] = GLX_CONTEXT_MAJOR_VERSION_ARB;
|
||||
context_attribs[i++] = major;
|
||||
context_attribs[i++] = GLX_CONTEXT_MINOR_VERSION_ARB;
|
||||
context_attribs[i++] = minor;
|
||||
context_attribs[i++] = GLX_CONTEXT_FLAGS_ARB;
|
||||
context_attribs[i++] = flags;
|
||||
|
||||
context_attribs[i++] = None;
|
||||
g_assert (i < N_GLX_ATTRS);
|
||||
|
||||
GDK_DISPLAY_NOTE (display, OPENGL,
|
||||
g_message ("Creating GLX context version %d.%d (debug:%s, forward:%s, legacy:%s, es:%s)",
|
||||
major, minor,
|
||||
debug_bit ? "yes" : "no",
|
||||
compat_bit ? "yes" : "no",
|
||||
legacy ? "yes" : "no",
|
||||
api == GDK_GL_API_GLES ? "yes" : "no"));
|
||||
g_message ("Creating GLX context (GL version:%d.%d, debug:%s, forward:%s, legacy:%s, GL:%s, GLES:%s)",
|
||||
major, minor,
|
||||
debug_bit ? "yes" : "no",
|
||||
compat_bit ? "yes" : "no",
|
||||
legacy_bit ? "yes" : "no",
|
||||
gdk_gl_context_is_api_allowed (context, GDK_GL_API_GL, NULL) ? "yes" : "no",
|
||||
gdk_gl_context_is_api_allowed (context, GDK_GL_API_GLES, NULL) ? "yes" : "no"));
|
||||
|
||||
if (share != NULL)
|
||||
share_glx = GDK_X11_GL_CONTEXT_GLX (share);
|
||||
|
||||
gdk_x11_display_error_trap_push (display);
|
||||
|
||||
/* If we don't have access to GLX_ARB_create_context_profile, then
|
||||
* we have to fall back to the old GLX 1.3 API.
|
||||
/* If we have access to GLX_ARB_create_context_profile then we can ask for
|
||||
* a compatibility profile; if we don't, then we have to fall back to the
|
||||
* old GLX 1.3 API.
|
||||
*/
|
||||
if (legacy && !display_x11->has_glx_create_context)
|
||||
ctx = glXCreateNewContext (gdk_x11_display_get_xdisplay (display),
|
||||
display_x11->glx_config,
|
||||
GLX_RGBA_TYPE,
|
||||
share_glx != NULL ? share_glx->glx_context : NULL,
|
||||
TRUE);
|
||||
|
||||
if (legacy_bit && !GDK_X11_DISPLAY (display)->has_glx_create_context)
|
||||
{
|
||||
GDK_DISPLAY_NOTE (display, OPENGL, g_message ("Creating legacy GL context on request"));
|
||||
/* do it below */
|
||||
}
|
||||
else
|
||||
ctx = glXCreateContextAttribsARB (gdk_x11_display_get_xdisplay (display),
|
||||
display_x11->glx_config,
|
||||
share_glx != NULL ? share_glx->glx_context : NULL,
|
||||
True,
|
||||
context_attribs);
|
||||
{
|
||||
if (gdk_gl_context_is_api_allowed (context, GDK_GL_API_GL, NULL))
|
||||
{
|
||||
int profile = legacy_bit ? GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB
|
||||
: GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
|
||||
|
||||
if (gdk_x11_display_error_trap_pop (display) || ctx == NULL)
|
||||
return 0;
|
||||
/* We need to tweak the version, otherwise we may end up requesting
|
||||
* a compatibility context with a minimum version of 3.2, which is
|
||||
* an error
|
||||
*/
|
||||
if (legacy_bit)
|
||||
{
|
||||
major = 3;
|
||||
minor = 0;
|
||||
}
|
||||
|
||||
GDK_DISPLAY_NOTE (display, OPENGL, g_message ("Creating GL3 context"));
|
||||
context_glx->glx_context = create_gl3_context (display,
|
||||
display_x11->glx_config,
|
||||
share,
|
||||
profile,
|
||||
flags, major, minor);
|
||||
api = GDK_GL_API_GL;
|
||||
}
|
||||
|
||||
if (context_glx->glx_context == NULL && !legacy_bit &&
|
||||
gdk_gl_context_is_api_allowed (context, GDK_GL_API_GLES, NULL))
|
||||
{
|
||||
GDK_DISPLAY_NOTE (display, OPENGL, g_message ("Creating GL3 GLES context"));
|
||||
context_glx->glx_context = create_gl3_context (display,
|
||||
display_x11->glx_config,
|
||||
share,
|
||||
GLX_CONTEXT_ES2_PROFILE_BIT_EXT,
|
||||
flags, major, minor);
|
||||
api = GDK_GL_API_GLES;
|
||||
}
|
||||
}
|
||||
|
||||
/* Fall back to legacy in case the GL3 context creation failed */
|
||||
if (context_glx->glx_context == NULL &&
|
||||
gdk_gl_context_is_api_allowed (context, GDK_GL_API_GL, NULL))
|
||||
{
|
||||
GDK_DISPLAY_NOTE (display, OPENGL, g_message ("Creating fallback legacy context"));
|
||||
context_glx->glx_context = create_legacy_context (display, display_x11->glx_config, share);
|
||||
legacy_bit = TRUE;
|
||||
api = GDK_GL_API_GL;
|
||||
}
|
||||
|
||||
if (context_glx->glx_context == NULL)
|
||||
{
|
||||
g_set_error_literal (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("Unable to create a GL context"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Ensure that any other context is created with a legacy bit set */
|
||||
gdk_gl_context_set_is_legacy (context, legacy_bit);
|
||||
|
||||
GDK_DISPLAY_NOTE (display, OPENGL,
|
||||
g_message ("Realized GLX context[%p], %s, version: %d.%d",
|
||||
context_glx->glx_context,
|
||||
glXIsDirect (dpy, context_glx->glx_context) ? "direct" : "indirect",
|
||||
display_x11->glx_version / 10,
|
||||
|
||||
display_x11->glx_version % 10));
|
||||
|
||||
context_glx->glx_context = ctx;
|
||||
gdk_gl_context_set_is_legacy (context, legacy);
|
||||
|
||||
#ifdef HAVE_XDAMAGE
|
||||
if (display_x11->have_damage &&
|
||||
display_x11->has_async_glx_swap_buffers)
|
||||
@@ -578,70 +663,10 @@ gdk_x11_context_create_glx_context (GdkGLContext *context,
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return api;
|
||||
}
|
||||
|
||||
static GdkGLAPI
|
||||
gdk_x11_gl_context_glx_realize (GdkGLContext *context,
|
||||
GError **error)
|
||||
{
|
||||
GdkDisplay *display = gdk_gl_context_get_display (context);
|
||||
GdkGLContext *share = gdk_display_get_gl_context (display);
|
||||
gboolean legacy;
|
||||
GdkGLAPI api, preferred_api;
|
||||
|
||||
if (share && gdk_gl_context_is_api_allowed (context,
|
||||
gdk_gl_context_get_api (share),
|
||||
NULL))
|
||||
preferred_api = gdk_gl_context_get_api (share);
|
||||
else if (gdk_gl_context_is_api_allowed (context, GDK_GL_API_GL, NULL))
|
||||
preferred_api = GDK_GL_API_GL;
|
||||
else if (gdk_gl_context_is_api_allowed (context, GDK_GL_API_GLES, NULL))
|
||||
preferred_api = GDK_GL_API_GLES;
|
||||
else
|
||||
{
|
||||
g_set_error_literal (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("No GL API allowed."));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* If there is no glXCreateContextAttribsARB() then we default to legacy */
|
||||
legacy = !GDK_X11_DISPLAY (display)->has_glx_create_context;
|
||||
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (display, GL_LEGACY))
|
||||
legacy = TRUE;
|
||||
|
||||
/* We cannot share legacy contexts with core profile ones, so the
|
||||
* shared context is the one that decides if we're going to create
|
||||
* a legacy context or not.
|
||||
*/
|
||||
if (share != NULL && gdk_gl_context_is_legacy (share))
|
||||
legacy = TRUE;
|
||||
|
||||
if (preferred_api == GDK_GL_API_GL)
|
||||
{
|
||||
if ((api = gdk_x11_context_create_glx_context (context, GDK_GL_API_GL, legacy)) ||
|
||||
(api = gdk_x11_context_create_glx_context (context, GDK_GL_API_GLES, legacy)) ||
|
||||
(api = gdk_x11_context_create_glx_context (context, GDK_GL_API_GL, TRUE)))
|
||||
return api;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((api = gdk_x11_context_create_glx_context (context, GDK_GL_API_GLES, FALSE)) ||
|
||||
(api = gdk_x11_context_create_glx_context (context, GDK_GL_API_GL, legacy)) ||
|
||||
(api = gdk_x11_context_create_glx_context (context, GDK_GL_API_GL, TRUE)))
|
||||
return api;
|
||||
}
|
||||
|
||||
g_set_error_literal (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("Unable to create a GL context"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
#undef N_GLX_ATTRS
|
||||
|
||||
static void
|
||||
gdk_x11_gl_context_glx_dispose (GObject *gobject)
|
||||
{
|
||||
@@ -795,7 +820,7 @@ gdk_x11_display_create_glx_config (GdkX11Display *self,
|
||||
XFree (visinfo);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (!visual_is_rgba (visinfo))
|
||||
{
|
||||
if (best_features < NO_ALPHA_VISUAL)
|
||||
@@ -869,7 +894,7 @@ gdk_x11_display_get_glx_version (GdkDisplay *display,
|
||||
|
||||
/*< private >
|
||||
* gdk_x11_display_init_glx:
|
||||
* @display_x11: an X11 display that has not been inited yet.
|
||||
* @display_x11: an X11 display that has not been inited yet.
|
||||
* @out_visual: set to the Visual to be used with the returned config
|
||||
* @out_depth: set to the depth to be used with the returned config
|
||||
* @error: Return location for error
|
||||
|
||||
@@ -280,7 +280,7 @@ compute_toplevel_size (GdkSurface *surface,
|
||||
gdk_toplevel_size_init (&size, bounds_width, bounds_height);
|
||||
gdk_toplevel_notify_compute_size (GDK_TOPLEVEL (surface), &size);
|
||||
|
||||
if (size.shadow.is_valid)
|
||||
if (size.shadow.is_valid && update_geometry)
|
||||
{
|
||||
update_shadow_size (surface,
|
||||
size.shadow.left,
|
||||
@@ -2793,19 +2793,14 @@ gdk_x11_surface_get_frame_extents (GdkSurface *surface,
|
||||
impl = GDK_X11_SURFACE (surface);
|
||||
|
||||
/* Refine our fallback answer a bit using local information */
|
||||
rect->x = impl->abs_x;
|
||||
rect->y = impl->abs_y;
|
||||
rect->width = surface->width;
|
||||
rect->height = surface->height;
|
||||
rect->x = impl->abs_x * impl->surface_scale;
|
||||
rect->y = impl->abs_y * impl->surface_scale;
|
||||
rect->width = surface->width * impl->surface_scale;
|
||||
rect->height = surface->height * impl->surface_scale;
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (surface) || impl->override_redirect)
|
||||
return;
|
||||
|
||||
rect->x *= impl->surface_scale;
|
||||
rect->y *= impl->surface_scale;
|
||||
rect->width *= impl->surface_scale;
|
||||
rect->height *= impl->surface_scale;
|
||||
|
||||
nvroots = 0;
|
||||
vroots = NULL;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user