Compare commits
3 Commits
inline-vec
...
gpu-text-r
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
34990b6dc2 | ||
|
|
8d74defbc1 | ||
|
|
fe95da256b |
@@ -1,4 +1,4 @@
|
||||
# See https://www.apertis.org/policies/coding_conventions/#code-formatting
|
||||
# See https://wiki.apertis.org/Guidelines/Coding_conventions#Code_formatting
|
||||
BasedOnStyle: GNU
|
||||
AlwaysBreakAfterDefinitionReturnType: All
|
||||
BreakBeforeBinaryOperators: None
|
||||
|
||||
@@ -78,7 +78,6 @@ style-check-diff:
|
||||
- "${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/gsk/compare/*/*/*.node"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/css/output/*/*.syscap"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/headless/*/*.log"
|
||||
- "${CI_PROJECT_DIR}/_build_hello/meson-logs"
|
||||
@@ -210,54 +209,51 @@ msys2-mingw64:
|
||||
paths:
|
||||
- "${CI_PROJECT_DIR}/_build/gtkdll.tar.gz"
|
||||
|
||||
macos:
|
||||
macos-x86_64:
|
||||
rules:
|
||||
# Do not run in forks as the runner is not available there.
|
||||
# (except for dehesselle who maintains the runner)
|
||||
- if: $CI_PROJECT_NAMESPACE != "GNOME" && $CI_PROJECT_NAMESPACE != "dehesselle"
|
||||
when: never
|
||||
- if: $RUNNER == "macosintel"
|
||||
variables:
|
||||
SDKROOT: /opt/sdks/MacOSX10.13.4.sdk
|
||||
NINJA_PKG: $CI_API_V4_URL/projects/30745/packages/generic/ninja_macos/v1.11.1.1+9/ninja-1.11.1.1-cp38-cp38-macosx_11_0_x86_64.whl
|
||||
when: manual
|
||||
allow_failure: true
|
||||
- if: $RUNNER == "macosarm"
|
||||
variables:
|
||||
SDKROOT: /opt/sdks/MacOSX11.3.sdk
|
||||
NINJA_PKG: ninja==1.11.1.1
|
||||
- if: $CI_PROJECT_NAMESPACE == "GNOME"
|
||||
stage: build
|
||||
parallel:
|
||||
matrix:
|
||||
- RUNNER: [ "macosintel", "macosarm" ]
|
||||
tags:
|
||||
- ${RUNNER}
|
||||
- macosintel
|
||||
needs: []
|
||||
variables:
|
||||
EXTRA_MESON_FLAGS: ""
|
||||
BACKEND_FLAGS: "-Dx11-backend=false -Dbroadway-backend=true"
|
||||
FEATURE_FLAGS: "-Dmedia-gstreamer=disabled -Dintrospection=enabled -Dgobject-introspection:werror=false"
|
||||
MESON_FORCE_BACKTRACKE: 1
|
||||
TMPDIR: /Users/Shared/work/tmp
|
||||
SDKROOT: /opt/sdks/MacOSX10.13.4.sdk
|
||||
PIP_CACHE_DIR: /Users/Shared/build/cache
|
||||
PIPENV_CACHE_DIR: $PIP_CACHE_DIR
|
||||
PYTHONPYCACHEPREFIX: $PIP_CACHE_DIR
|
||||
EXTRA_MESON_FLAGS: "-Dgobject-introspection:werror=false"
|
||||
before_script:
|
||||
- .gitlab-ci/show-info-macos.sh
|
||||
- python3 -m venv .venv
|
||||
# Building the introspection feature requires pkg-config and bison.
|
||||
- curl -L $CI_API_V4_URL/projects/30437/packages/generic/pkgconfig/v0.29.2+10/pkg-config-0.29.2+10_$(uname -m).tar.xz | tar -C .venv -xJ
|
||||
- curl -L $CI_API_V4_URL/projects/30438/packages/generic/bison/v3.8.2+3/bison-3.8.2+3_$(uname -m).tar.xz | tar -C .venv -xJ
|
||||
# Not using ccache on purpose as it accelerates the build so much that it
|
||||
# can trigger race conditions in the gobject-introspection subproject.
|
||||
- bash .gitlab-ci/show-info-osx.sh
|
||||
- /opt/macports/bin/python3.10 -m venv .venv
|
||||
- ln -s /opt/cmake/CMake.app/Contents/bin/cmake .venv/bin
|
||||
- ln -s /opt/pkg-config/bin/pkg-config .venv/bin
|
||||
- ln -s /opt/bison/bin/bison .venv/bin
|
||||
- source .venv/bin/activate
|
||||
- pip3 install meson==1.3.2 $NINJA_PKG
|
||||
# We're not setting up ccache here on purpose as it accelerates the build
|
||||
# so much that it triggers race conditions in the gobject-introspection
|
||||
# subproject.
|
||||
- pip3 install meson==1.2.0
|
||||
- pip3 install ninja==1.11.1
|
||||
- pip3 install /Users/Shared/build/pkgs/PyGObject-3.44.0-cp310-cp310-macosx_10_13_x86_64.whl
|
||||
/Users/Shared/build/pkgs/pycairo-1.23.0-cp310-cp310-macosx_10_13_x86_64.whl
|
||||
script:
|
||||
- meson setup
|
||||
${COMMON_MESON_FLAGS}
|
||||
${EXTRA_MESON_FLAGS}
|
||||
${BACKEND_FLAGS}
|
||||
${FEATURE_FLAGS}
|
||||
-Dx11-backend=false
|
||||
-Dbroadway-backend=true
|
||||
-Dmacos-backend=true
|
||||
-Dmedia-gstreamer=disabled
|
||||
-Dintrospection=enabled
|
||||
-Dcpp_std=c++11
|
||||
-Dpixman:tests=disabled
|
||||
-Dlibjpeg-turbo:simd=disabled
|
||||
-Dbuild-demos=false
|
||||
-Dbuild-tests=false
|
||||
-Dbuild-examples=false
|
||||
-Dbuild-testsuite=false
|
||||
_build
|
||||
- meson compile -C _build
|
||||
artifacts:
|
||||
@@ -432,6 +428,13 @@ asan-build:
|
||||
_build
|
||||
- ninja -C _build
|
||||
- .gitlab-ci/run-tests.sh _build wayland gtk
|
||||
artifacts:
|
||||
when: always
|
||||
reports:
|
||||
junit:
|
||||
- "${CI_PROJECT_DIR}/_build/report-wayland.xml"
|
||||
paths:
|
||||
- "${CI_PROJECT_DIR}/_build/meson-logs"
|
||||
|
||||
reference:
|
||||
image: $FEDORA_IMAGE
|
||||
@@ -481,4 +484,3 @@ publish-docs:
|
||||
- "curl -X POST -F token=${PAGES_TRIGGER_TOKEN} -F ref=docs-gtk-org https://gitlab.gnome.org/api/v4/projects/665/trigger/pipeline"
|
||||
rules:
|
||||
- if: $CI_COMMIT_REF_NAME == "main"
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ flatpak build ${builddir} meson \
|
||||
--buildtype=debugoptimized \
|
||||
-Dx11-backend=true \
|
||||
-Dwayland-backend=true \
|
||||
-Dvulkan=disabled \
|
||||
-Dbuild-tests=false \
|
||||
-Dbuild-testsuite=false \
|
||||
-Dbuild-examples=false \
|
||||
@@ -28,7 +27,7 @@ flatpak build ${builddir} meson \
|
||||
-Ddemo-profile=devel \
|
||||
_flatpak_build
|
||||
|
||||
flatpak build --env=CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA ${builddir} ninja -C _flatpak_build install
|
||||
flatpak build ${builddir} ninja -C _flatpak_build install
|
||||
|
||||
flatpak-builder \
|
||||
--user --disable-rofiles-fuse \
|
||||
|
||||
@@ -3,11 +3,6 @@
|
||||
set -eux -o pipefail
|
||||
|
||||
xcodebuild -version || :
|
||||
|
||||
if [ -z "$SDKROOT" ]; then
|
||||
xcodebuild -showsdks || :
|
||||
else
|
||||
echo "SDKROOT = $SDKROOT"
|
||||
fi
|
||||
xcodebuild -showsdks || :
|
||||
|
||||
system_profiler SPSoftwareDataType || :
|
||||
@@ -213,7 +213,7 @@ Closes #1234
|
||||
`git commit -a --author "Joe Coder <joe@coder.org>"` and `--signoff`.
|
||||
|
||||
- If your commit is addressing an issue, use the
|
||||
[GitLab syntax](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
|
||||
[GitLab syntax](https://docs.gitlab.com/ce/user/project/issues/automatic_issue_closing.html)
|
||||
to automatically close the issue when merging the commit with the upstream
|
||||
repository:
|
||||
|
||||
|
||||
282
NEWS
282
NEWS
@@ -1,286 +1,6 @@
|
||||
Overview of Changes in 4.14.1, xx-xx-xxxx
|
||||
Overview of Changes in 4.13.6, xx-xx-xxxx
|
||||
=========================================
|
||||
|
||||
|
||||
Overview of Changes in 4.14.0, 12-03-2024
|
||||
=========================================
|
||||
|
||||
Note: The new renderers and dmabuf support are using graphics drivers
|
||||
in different ways than the old gl renderer, and trigger new driver bugs,
|
||||
(see for example https://gitlab.gnome.org/GNOME/gtk/-/issues/6418 and
|
||||
https://gitlab.gnome.org/GNOME/gtk/-/issues/6388). Therefore, it is
|
||||
recommended to use the latest mesa release (24.x) with the new renderers.
|
||||
|
||||
* GtkTextView:
|
||||
- Don't snapshot children twice
|
||||
- Don't blink the cursor when hidden
|
||||
|
||||
* GtkEmojiChooser:
|
||||
- Fix presentation selector handling
|
||||
|
||||
* GtkSnapshot:
|
||||
- Fix wrong nodes with transformed shadows
|
||||
|
||||
* GtkIMContext:
|
||||
- Make gtk_im_context_activate_osk public
|
||||
|
||||
* Accessibility:
|
||||
- Implement get_contents_at for all our text widgets
|
||||
- Add GtkAccessibleText.get_default_attributes
|
||||
|
||||
* GSK:
|
||||
- Don't fall back to cairo for software rendering. gl+llvmpipe is better
|
||||
- Round vertical glyph position to a device pixel position if the font is hinted
|
||||
- Fix problems with clip handling
|
||||
- Make vulkan and ngl match their font handling
|
||||
- Fix some corner-cases with offloading and clips
|
||||
- Fix problem with rendering of missing glyphs in hinted fonts
|
||||
|
||||
* MacOs:
|
||||
- Implement cursor-from-texture
|
||||
|
||||
* Translation updates:
|
||||
Basque
|
||||
British English
|
||||
French
|
||||
Indonesian
|
||||
Kazakh
|
||||
Latvian
|
||||
Lithuanian
|
||||
Norwegian Bokmål
|
||||
Slovenian
|
||||
Spanish
|
||||
Turkish
|
||||
|
||||
|
||||
Overview of Changes in 4.13.9, 02-03-2024
|
||||
=========================================
|
||||
|
||||
* GtkEditable:
|
||||
- Fix preconditions to be not too strict
|
||||
|
||||
* GtkEmojiChooser:
|
||||
- Support search in the locale as well as in English
|
||||
|
||||
* GtkIconTheme:
|
||||
- Make gtk_icon_paintable_new_for_file support symbolics
|
||||
|
||||
* GtkVideo:
|
||||
- Fix a problem with cursor handling that could lead to crashes
|
||||
|
||||
* Accessibility:
|
||||
- Fix GetCharacterAtOffset implementation
|
||||
- Add a Terminal role
|
||||
- Make TextCaretMoved match gtk3
|
||||
- Support multiple levels of GtkEditable delegates
|
||||
|
||||
* GSK:
|
||||
- Make the node parser more flexible for text nodes
|
||||
- Change the way font scaling is handled to avoid clipping
|
||||
- Fix handling of missing glyphs in the new renderers
|
||||
|
||||
* X11:
|
||||
- Don't claim to support shadows without a compositor
|
||||
|
||||
* Wayland:
|
||||
- Fix handling of output scales
|
||||
|
||||
* Tools:
|
||||
- Add a compare command to gtk4-rendernode-tool
|
||||
|
||||
* Build:
|
||||
- Fix some ubsan complaints
|
||||
|
||||
* Translation updates:
|
||||
Basque
|
||||
British English
|
||||
Catalan
|
||||
Finnish
|
||||
Galician
|
||||
Georgian
|
||||
Hebrew
|
||||
Indonesian
|
||||
Kazakh
|
||||
Latvian
|
||||
Lithuanian
|
||||
Persian
|
||||
Polish
|
||||
Russian
|
||||
Slovenian
|
||||
Spanish
|
||||
Turkish
|
||||
Ukrainian
|
||||
|
||||
|
||||
Overview of Changes in 4.13.8, 20-02-2024
|
||||
=========================================
|
||||
|
||||
* Accessibility:
|
||||
- Add a GtkAccessibleText interface for allowing 3rd party
|
||||
text widgets (notably vte) to be accessible
|
||||
- Avoid duplicate accessible descriptions
|
||||
- Fix GetAccessibleAtPoint
|
||||
|
||||
* GSK:
|
||||
- Avoid offscreens for disjoint containers
|
||||
- Don't use the gpu renderers with llvmpipe
|
||||
- Fix various rendering issues found by tests
|
||||
- Allow unnormalized node bounds again
|
||||
- Fix a broken case of rounded-rect intersection
|
||||
- Fix handling of external textures in gpu renderers
|
||||
- Make gpu renderers work with WGL on Windows
|
||||
|
||||
* build:
|
||||
- Allow building without dmabuf support on (old) Linux
|
||||
|
||||
* X11:
|
||||
- Fix monitor enter/leave signals
|
||||
|
||||
* Translation updates:
|
||||
Basque
|
||||
Brazilian Portuguese
|
||||
Catalan
|
||||
Czech
|
||||
Galician
|
||||
Georgian
|
||||
Hebrew
|
||||
Lithuanian
|
||||
Persian
|
||||
Russian
|
||||
Turkish
|
||||
Ukrainian
|
||||
|
||||
|
||||
Overview of Changes in 4.13.7, 11-02-2024
|
||||
=========================================
|
||||
|
||||
* GtkFileChooser:
|
||||
- Speed up opening
|
||||
|
||||
* GtkCalendar:
|
||||
- Add some missing setters and getters
|
||||
|
||||
* Accessibility:
|
||||
- Add socket support for webkit accessibility
|
||||
- Implement AT-SPI text for GtkText
|
||||
- Implement AT-SPI component generically
|
||||
- Add an announce API
|
||||
|
||||
* GSK:
|
||||
- Make the ngl renderer work on macOS
|
||||
- Fix a crash in the vulkan renderer
|
||||
- Make nodeparser allow aliases for fonts again
|
||||
- Implement cache eviction for glyph and texture caches
|
||||
- Fix ngl shaders to work on GL < 4.0
|
||||
- Require GL 3.3 for the ngl renderer
|
||||
- Fix problems with scaled shadows
|
||||
- Fix problems with holes for underlaid subsurfaces
|
||||
- Improve handling of scales and glyph cache efficiency
|
||||
|
||||
* Media:
|
||||
- Support dmabufs in the gstreamer backend. This allows
|
||||
zero-copy video playback on Wayland when paired with
|
||||
hardware video decoding
|
||||
- Drop the experimental ffmpeg backend. It hasn't been
|
||||
building for a year
|
||||
|
||||
* Wayland:
|
||||
- Commit empty frames if and double-buffered state is pending
|
||||
- Fix monitor size information when using mutter without
|
||||
the scale-monitor-framebuffer setting
|
||||
- Clear the current tablet on tab leave, fixing a crash
|
||||
|
||||
* macOS:
|
||||
- Propagate unhandled input events back to the OS
|
||||
|
||||
* Tools:
|
||||
- Make the crash handling in gtk4-node-editor more robust
|
||||
|
||||
* Translation updates
|
||||
Galician
|
||||
Georgian
|
||||
Occitan
|
||||
Turkish
|
||||
|
||||
|
||||
Overview of Changes in 4.13.6, 25-01-2024
|
||||
=========================================
|
||||
|
||||
This release changes the ngl renderer to be the default renderer.
|
||||
|
||||
The intent of this change is to get wider testing and verify that
|
||||
the new renderers are production-ready. If significant problems
|
||||
show up, we will revert this change for 4.14.
|
||||
|
||||
You can still override the renderer choice using the GSK_RENDERER
|
||||
environment variable.
|
||||
|
||||
Since ngl can handle fractional scaling much better than the old gl
|
||||
renderer, we allow fractional scaling by default with gl now. If you
|
||||
are using the old gl renderer (e.g. because your system is limited to
|
||||
GLES2), you can disable fractional scaling by setting the GDK_DEBUG
|
||||
environment variable to include the gl-no-fractional key.
|
||||
|
||||
* GtkColumnView:
|
||||
- Fix infinite loops in dispose
|
||||
- Fix problems with weak ref cycles in GtkExpression
|
||||
|
||||
* GtkListView:
|
||||
- Fix some corner cases with sections during insertions and deletions
|
||||
- Don't double-recycle widgets
|
||||
|
||||
* GtkStack:
|
||||
- Add automatic cleanup for GtkStackPage
|
||||
|
||||
* GDK:
|
||||
- Use standard cursor names for drag cursors
|
||||
- Enable fractional scaling with gl by default
|
||||
|
||||
* GSK:
|
||||
- Many fixes and improvements to the unified renderers:
|
||||
- Fix text rendering with the uber shader
|
||||
- Fix rounding issues with fractional scales
|
||||
- Fix some memory leaks
|
||||
- Many text rendering fixes
|
||||
- Implement subpixel positioning for glyphs
|
||||
- Support custom fonts in node files
|
||||
- Add tests for font rendering
|
||||
- Fix drawing of repeat nodes
|
||||
- Implement subpixels positioning
|
||||
- Evict stale textures, glyphs and atlases from the cache
|
||||
- Some fixes and improvements to the GL renderer:
|
||||
- Fix problems with GLES on Nvidia
|
||||
- Avoid a crash in the mask demo
|
||||
- Respect opacity of the first child node in containers
|
||||
- Some fixes and improvements to the fallback renderer:
|
||||
- Fix drawing of repeat nodes
|
||||
- Make ngl the default renderer
|
||||
|
||||
* Wayland:
|
||||
- Fix problems with tablet cursors
|
||||
- Fix problems without seats
|
||||
|
||||
* Accessibility:
|
||||
- Respect a separate "show-status-shapes setting
|
||||
- Fix change notification for accessible names on some widgets
|
||||
|
||||
* Inspector:
|
||||
- Show the git commit in devel builds
|
||||
|
||||
* Tools:
|
||||
- Make gtk4-node-editor autosave its contents
|
||||
- Add a benchmark command to gtk4-rendernode-tool
|
||||
|
||||
* Translation updates:
|
||||
French
|
||||
Galician
|
||||
Georgian
|
||||
Occitan
|
||||
Persian
|
||||
Russian
|
||||
Vietnamese
|
||||
|
||||
|
||||
Overview of Changes in 4.13.5, 07-01-2024
|
||||
=========================================
|
||||
|
||||
|
||||
@@ -185,7 +185,6 @@
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dvulkan=disabled",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Ddemo-profile=devel"
|
||||
],
|
||||
@@ -200,7 +199,6 @@
|
||||
],
|
||||
"build-options" : {
|
||||
"env" : {
|
||||
"GSK_RENDERER" : "opengl"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +114,6 @@
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dvulkan=disabled",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Ddemo-profile=devel"
|
||||
],
|
||||
|
||||
@@ -114,7 +114,6 @@
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dvulkan=disabled",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Ddemo-profile=devel"
|
||||
],
|
||||
@@ -130,8 +129,6 @@
|
||||
"build-options" : {
|
||||
"env" : {
|
||||
"DBUS_SESSION_BUS_ADDRESS" : "''",
|
||||
"GSK_RENDERER" : "opengl",
|
||||
"GDK_DEBUG" : "vulkan-disable",
|
||||
"G_ENABLE_DEBUG" : "true"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +114,6 @@
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dvulkan=disabled",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Ddemo-profile=devel"
|
||||
],
|
||||
@@ -130,8 +129,6 @@
|
||||
"build-options" : {
|
||||
"env" : {
|
||||
"DBUS_SESSION_BUS_ADDRESS" : "''",
|
||||
"GSK_RENDERER" : "opengl",
|
||||
"GDK_DEBUG" : "vulkan-disable",
|
||||
"G_ENABLE_DEBUG" : "true"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -600,8 +600,8 @@ update_display (void)
|
||||
if (s->len > 0)
|
||||
{
|
||||
pango_font_description_set_variations (desc, s->str);
|
||||
g_string_free (s, TRUE);
|
||||
}
|
||||
g_string_free (s, TRUE);
|
||||
|
||||
font_desc = pango_font_description_to_string (desc);
|
||||
|
||||
|
||||
@@ -116,9 +116,7 @@ static gboolean gtk_shadertoy_tick (GtkWidget *widget,
|
||||
GtkWidget *
|
||||
gtk_shadertoy_new (void)
|
||||
{
|
||||
return g_object_new (gtk_shadertoy_get_type (),
|
||||
"allowed-apis", GDK_GL_API_GL,
|
||||
NULL);
|
||||
return g_object_new (gtk_shadertoy_get_type (), NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -354,7 +354,6 @@ do_images (GtkWidget *do_widget)
|
||||
gicon = g_themed_icon_new_with_default_fallbacks ("battery-caution-charging-symbolic");
|
||||
image = gtk_image_new_from_gicon (gicon);
|
||||
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
|
||||
g_object_unref (gicon);
|
||||
|
||||
gtk_frame_set_child (GTK_FRAME (frame), image);
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/* Lists/Selections
|
||||
* #Keywords: suggestion, completion
|
||||
*
|
||||
* The GtkDropDown widget is a modern alternative to GtkComboBox.
|
||||
* It uses list models instead of tree models, and the content is
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "demos.h"
|
||||
#include "fontify.h"
|
||||
|
||||
#include "profile_conf.h"
|
||||
#include "demo_conf.h"
|
||||
|
||||
static GtkWidget *info_view;
|
||||
static GtkWidget *source_view;
|
||||
|
||||
@@ -236,7 +236,7 @@ foreach flag: common_cflags
|
||||
endif
|
||||
endforeach
|
||||
|
||||
gtkdemo_deps += [ profile_conf_h ]
|
||||
gtkdemo_deps += [ demo_conf_h ]
|
||||
|
||||
executable('gtk4-demo',
|
||||
sources: [demos, demos_h, extra_demo_sources, gtkdemo_resources],
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "iconbrowserapp.h"
|
||||
#include "iconbrowserwin.h"
|
||||
|
||||
#include "profile_conf.h"
|
||||
#include "demo_conf.h"
|
||||
|
||||
struct _IconBrowserApp
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ iconbrowser_resources = gnome.compile_resources('iconbrowser_resources',
|
||||
executable('gtk4-icon-browser',
|
||||
sources: [iconbrowser_sources, iconbrowser_resources],
|
||||
c_args: common_cflags,
|
||||
dependencies: [ libgtk_dep, profile_conf_h ],
|
||||
dependencies: [ libgtk_dep, demo_conf_h ],
|
||||
include_directories: confinc,
|
||||
win_subsystem: 'windows',
|
||||
link_args: extra_demo_ldflags,
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
gen_demo_header = find_program('../build-aux/meson/gen-demo-header.py')
|
||||
demo_profile = get_option('demo-profile')
|
||||
|
||||
demo_conf_h = declare_dependency(
|
||||
sources: custom_target('demo-header',
|
||||
command: [gen_demo_header, meson.project_source_root(), demo_profile],
|
||||
capture: true,
|
||||
output: 'demo_conf.h',
|
||||
build_by_default: true,
|
||||
build_always_stale: true,
|
||||
)
|
||||
)
|
||||
|
||||
# appdata
|
||||
|
||||
appdata_config = configuration_data()
|
||||
|
||||
@@ -12,7 +12,7 @@ node_editor_resources = gnome.compile_resources('node_editor_resources',
|
||||
|
||||
executable('gtk4-node-editor',
|
||||
sources: [node_editor_sources, node_editor_resources],
|
||||
dependencies: [ libgtk_dep, profile_conf_h ],
|
||||
dependencies: [ libgtk_dep, demo_conf_h ],
|
||||
include_directories: confinc,
|
||||
c_args: common_cflags,
|
||||
win_subsystem: 'windows',
|
||||
|
||||
@@ -19,13 +19,15 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib/gstdio.h>
|
||||
#ifdef HAVE_PANGOFT
|
||||
#include <pango/pangofc-fontmap.h>
|
||||
#endif
|
||||
|
||||
#include "node-editor-application.h"
|
||||
|
||||
#include "node-editor-window.h"
|
||||
|
||||
#include "profile_conf.h"
|
||||
#include "demo_conf.h"
|
||||
|
||||
static const char *css =
|
||||
"textview.editor {"
|
||||
@@ -47,11 +49,47 @@ struct _NodeEditorApplicationClass
|
||||
GtkApplicationClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(NodeEditorApplication, node_editor_application, GTK_TYPE_APPLICATION);
|
||||
G_DEFINE_TYPE (NodeEditorApplication, node_editor_application, GTK_TYPE_APPLICATION);
|
||||
|
||||
static void
|
||||
maybe_add_test_fonts (void)
|
||||
{
|
||||
#ifdef HAVE_PANGOFT
|
||||
const char *subdir = "testsuite/gsk/fonts";
|
||||
const char *source_dir;
|
||||
char *dir;
|
||||
|
||||
source_dir = g_getenv ("GTK_SOURCE_DIR");
|
||||
|
||||
if (source_dir)
|
||||
{
|
||||
char *abs_source_dir = g_canonicalize_filename (source_dir, NULL);
|
||||
dir = g_canonicalize_filename (subdir, abs_source_dir);
|
||||
g_free (abs_source_dir);
|
||||
}
|
||||
else
|
||||
{
|
||||
char *current_dir = g_get_current_dir ();
|
||||
dir = g_canonicalize_filename (subdir, current_dir);
|
||||
g_free (current_dir);
|
||||
}
|
||||
|
||||
if (g_file_test (dir, G_FILE_TEST_EXISTS))
|
||||
{
|
||||
FcConfig *config;
|
||||
|
||||
config = FcConfigGetCurrent ();
|
||||
FcConfigAppFontAddDir (config, (const FcChar8 *) dir);
|
||||
}
|
||||
|
||||
g_free (dir);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
node_editor_application_init (NodeEditorApplication *app)
|
||||
{
|
||||
maybe_add_test_fonts ();
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -249,63 +287,11 @@ node_editor_application_class_init (NodeEditorApplicationClass *class)
|
||||
application_class->open = node_editor_application_open;
|
||||
}
|
||||
|
||||
static void
|
||||
print_version (void)
|
||||
{
|
||||
g_print ("gtk4-node-editor %s%s%s\n",
|
||||
PACKAGE_VERSION,
|
||||
g_strcmp0 (PROFILE, "devel") == 0 ? "-" : "",
|
||||
g_strcmp0 (PROFILE, "devel") == 0 ? VCS_TAG : "");
|
||||
}
|
||||
|
||||
static int
|
||||
local_options (GApplication *app,
|
||||
GVariantDict *options,
|
||||
gpointer data)
|
||||
{
|
||||
gboolean version = FALSE;
|
||||
gboolean reset = FALSE;
|
||||
|
||||
g_variant_dict_lookup (options, "version", "b", &version);
|
||||
|
||||
if (version)
|
||||
{
|
||||
print_version ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
g_variant_dict_lookup (options, "reset", "b", &reset);
|
||||
|
||||
if (reset)
|
||||
{
|
||||
char *path;
|
||||
|
||||
path = get_autosave_path ("-unsafe");
|
||||
g_remove (path);
|
||||
g_free (path);
|
||||
path = get_autosave_path (NULL);
|
||||
g_remove (path);
|
||||
g_free (path);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
NodeEditorApplication *
|
||||
node_editor_application_new (void)
|
||||
{
|
||||
NodeEditorApplication *app;
|
||||
|
||||
app = g_object_new (NODE_EDITOR_APPLICATION_TYPE,
|
||||
"application-id", "org.gtk.gtk4.NodeEditor",
|
||||
"flags", G_APPLICATION_HANDLES_OPEN,
|
||||
NULL);
|
||||
|
||||
g_application_add_main_option (G_APPLICATION (app), "version", 0, 0,G_OPTION_ARG_NONE, "Show program version", NULL);
|
||||
g_application_add_main_option (G_APPLICATION (app), "reset", 0, 0,G_OPTION_ARG_NONE, "Remove autosave content", NULL);
|
||||
|
||||
g_signal_connect (app, "handle-local-options", G_CALLBACK (local_options), NULL);
|
||||
|
||||
return app;
|
||||
return g_object_new (NODE_EDITOR_APPLICATION_TYPE,
|
||||
"application-id", "org.gtk.gtk4.NodeEditor",
|
||||
"flags", G_APPLICATION_HANDLES_OPEN,
|
||||
NULL);
|
||||
}
|
||||
|
||||
@@ -28,8 +28,6 @@
|
||||
#include "gsk/broadway/gskbroadwayrenderer.h"
|
||||
#endif
|
||||
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
#include <cairo.h>
|
||||
#ifdef CAIRO_HAS_SVG_SURFACE
|
||||
#include <cairo-svg.h>
|
||||
@@ -57,7 +55,6 @@ struct _NodeEditorWindow
|
||||
GtkWidget *testcase_name_entry;
|
||||
GtkWidget *testcase_save_button;
|
||||
GtkWidget *scale_scale;
|
||||
GtkWidget *crash_warning;
|
||||
|
||||
GtkWidget *renderer_listbox;
|
||||
GListStore *renderers;
|
||||
@@ -67,10 +64,6 @@ struct _NodeEditorWindow
|
||||
GFileMonitor *file_monitor;
|
||||
|
||||
GArray *errors;
|
||||
|
||||
gboolean auto_reload;
|
||||
gboolean mark_as_safe_pending;
|
||||
gulong after_paint_handler;
|
||||
};
|
||||
|
||||
struct _NodeEditorWindowClass
|
||||
@@ -78,13 +71,6 @@ struct _NodeEditorWindowClass
|
||||
GtkApplicationWindowClass parent_class;
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_AUTO_RELOAD = 1,
|
||||
NUM_PROPERTIES
|
||||
};
|
||||
|
||||
static GParamSpec *properties[NUM_PROPERTIES] = { NULL, };
|
||||
|
||||
G_DEFINE_TYPE(NodeEditorWindow, node_editor_window, GTK_TYPE_APPLICATION_WINDOW);
|
||||
|
||||
static void
|
||||
@@ -177,121 +163,19 @@ text_iter_skip_whitespace_backward (GtkTextIter *iter)
|
||||
}
|
||||
|
||||
static void
|
||||
highlight_text (NodeEditorWindow *self)
|
||||
{
|
||||
GtkTextIter iter;
|
||||
GtkTextIter start, end;
|
||||
|
||||
gtk_text_buffer_get_start_iter (self->text_buffer, &iter);
|
||||
|
||||
while (!gtk_text_iter_is_end (&iter))
|
||||
{
|
||||
gunichar c = gtk_text_iter_get_char (&iter);
|
||||
|
||||
if (c == '{')
|
||||
{
|
||||
GtkTextIter word_end = iter;
|
||||
GtkTextIter word_start;
|
||||
|
||||
gtk_text_iter_backward_char (&word_end);
|
||||
text_iter_skip_whitespace_backward (&word_end);
|
||||
|
||||
word_start = word_end;
|
||||
gtk_text_iter_backward_word_start (&word_start);
|
||||
text_iter_skip_alpha_backward (&word_start);
|
||||
|
||||
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "nodename", &word_start, &word_end);
|
||||
}
|
||||
else if (c == ':')
|
||||
{
|
||||
GtkTextIter word_end = iter;
|
||||
GtkTextIter word_start;
|
||||
|
||||
gtk_text_iter_backward_char (&word_end);
|
||||
text_iter_skip_whitespace_backward (&word_end);
|
||||
|
||||
word_start = word_end;
|
||||
gtk_text_iter_backward_word_start (&word_start);
|
||||
text_iter_skip_alpha_backward (&word_start);
|
||||
|
||||
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "propname", &word_start, &word_end);
|
||||
}
|
||||
else if (c == '"')
|
||||
{
|
||||
GtkTextIter string_start = iter;
|
||||
GtkTextIter string_end = iter;
|
||||
|
||||
gtk_text_iter_forward_char (&iter);
|
||||
while (!gtk_text_iter_is_end (&iter))
|
||||
{
|
||||
c = gtk_text_iter_get_char (&iter);
|
||||
|
||||
if (c == '"')
|
||||
{
|
||||
gtk_text_iter_forward_char (&iter);
|
||||
string_end = iter;
|
||||
break;
|
||||
}
|
||||
|
||||
gtk_text_iter_forward_char (&iter);
|
||||
}
|
||||
|
||||
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "string", &string_start, &string_end);
|
||||
}
|
||||
|
||||
gtk_text_iter_forward_char (&iter);
|
||||
}
|
||||
|
||||
gtk_text_buffer_get_bounds (self->text_buffer, &start, &end);
|
||||
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "no-hyphens", &start, &end);
|
||||
}
|
||||
|
||||
static void
|
||||
mark_autosave_as_unsafe (void)
|
||||
{
|
||||
char *path1 = NULL;
|
||||
char *path2 = NULL;
|
||||
|
||||
path1 = get_autosave_path ("-unsafe");
|
||||
path2 = get_autosave_path (NULL);
|
||||
|
||||
g_rename (path2, path1);
|
||||
}
|
||||
|
||||
static void
|
||||
mark_autosave_as_safe (void)
|
||||
{
|
||||
char *path1 = NULL;
|
||||
char *path2 = NULL;
|
||||
|
||||
path1 = get_autosave_path ("-unsafe");
|
||||
path2 = get_autosave_path (NULL);
|
||||
|
||||
g_rename (path1, path2);
|
||||
}
|
||||
|
||||
static void
|
||||
after_paint (GdkFrameClock *clock,
|
||||
NodeEditorWindow *self)
|
||||
{
|
||||
if (self->mark_as_safe_pending)
|
||||
{
|
||||
self->mark_as_safe_pending = FALSE;
|
||||
mark_autosave_as_safe ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
reload (NodeEditorWindow *self)
|
||||
text_changed (GtkTextBuffer *buffer,
|
||||
NodeEditorWindow *self)
|
||||
{
|
||||
char *text;
|
||||
GBytes *bytes;
|
||||
GtkTextIter iter;
|
||||
GtkTextIter start, end;
|
||||
float scale;
|
||||
GskRenderNode *big_node;
|
||||
|
||||
mark_autosave_as_unsafe ();
|
||||
|
||||
g_array_remove_range (self->errors, 0, self->errors->len);
|
||||
text = get_current_text (self->text_buffer);
|
||||
text_buffer_remove_all_tags (self->text_buffer);
|
||||
bytes = g_bytes_new_take (text, strlen (text));
|
||||
|
||||
g_clear_pointer (&self->node, gsk_render_node_unref);
|
||||
@@ -353,20 +237,72 @@ reload (NodeEditorWindow *self)
|
||||
|
||||
g_clear_pointer (&big_node, gsk_render_node_unref);
|
||||
|
||||
self->mark_as_safe_pending = TRUE;
|
||||
}
|
||||
gtk_text_buffer_get_start_iter (self->text_buffer, &iter);
|
||||
|
||||
static void
|
||||
text_changed (GtkTextBuffer *buffer,
|
||||
NodeEditorWindow *self)
|
||||
{
|
||||
g_array_remove_range (self->errors, 0, self->errors->len);
|
||||
text_buffer_remove_all_tags (self->text_buffer);
|
||||
while (!gtk_text_iter_is_end (&iter))
|
||||
{
|
||||
gunichar c = gtk_text_iter_get_char (&iter);
|
||||
|
||||
if (self->auto_reload)
|
||||
reload (self);
|
||||
if (c == '{')
|
||||
{
|
||||
GtkTextIter word_end = iter;
|
||||
GtkTextIter word_start;
|
||||
|
||||
highlight_text (self);
|
||||
gtk_text_iter_backward_char (&word_end);
|
||||
text_iter_skip_whitespace_backward (&word_end);
|
||||
|
||||
word_start = word_end;
|
||||
gtk_text_iter_backward_word_start (&word_start);
|
||||
text_iter_skip_alpha_backward (&word_start);
|
||||
|
||||
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "nodename",
|
||||
&word_start, &word_end);
|
||||
}
|
||||
else if (c == ':')
|
||||
{
|
||||
GtkTextIter word_end = iter;
|
||||
GtkTextIter word_start;
|
||||
|
||||
gtk_text_iter_backward_char (&word_end);
|
||||
text_iter_skip_whitespace_backward (&word_end);
|
||||
|
||||
word_start = word_end;
|
||||
gtk_text_iter_backward_word_start (&word_start);
|
||||
text_iter_skip_alpha_backward (&word_start);
|
||||
|
||||
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "propname",
|
||||
&word_start, &word_end);
|
||||
}
|
||||
else if (c == '"')
|
||||
{
|
||||
GtkTextIter string_start = iter;
|
||||
GtkTextIter string_end = iter;
|
||||
|
||||
gtk_text_iter_forward_char (&iter);
|
||||
while (!gtk_text_iter_is_end (&iter))
|
||||
{
|
||||
c = gtk_text_iter_get_char (&iter);
|
||||
|
||||
if (c == '"')
|
||||
{
|
||||
gtk_text_iter_forward_char (&iter);
|
||||
string_end = iter;
|
||||
break;
|
||||
}
|
||||
|
||||
gtk_text_iter_forward_char (&iter);
|
||||
}
|
||||
|
||||
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "string",
|
||||
&string_start, &string_end);
|
||||
}
|
||||
|
||||
gtk_text_iter_forward_char (&iter);
|
||||
}
|
||||
|
||||
gtk_text_buffer_get_bounds (self->text_buffer, &start, &end);
|
||||
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "no-hyphens",
|
||||
&start, &end);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1209,7 +1145,6 @@ static void
|
||||
node_editor_window_realize (GtkWidget *widget)
|
||||
{
|
||||
NodeEditorWindow *self = NODE_EDITOR_WINDOW (widget);
|
||||
GdkFrameClock *frameclock;
|
||||
|
||||
GTK_WIDGET_CLASS (node_editor_window_parent_class)->realize (widget);
|
||||
|
||||
@@ -1237,24 +1172,14 @@ node_editor_window_realize (GtkWidget *widget)
|
||||
node_editor_window_add_renderer (self,
|
||||
gsk_cairo_renderer_new (),
|
||||
"Cairo");
|
||||
|
||||
frameclock = gtk_widget_get_frame_clock (widget);
|
||||
self->after_paint_handler = g_signal_connect (frameclock, "after-paint",
|
||||
G_CALLBACK (after_paint), self);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
node_editor_window_unrealize (GtkWidget *widget)
|
||||
{
|
||||
NodeEditorWindow *self = NODE_EDITOR_WINDOW (widget);
|
||||
GdkFrameClock *frameclock;
|
||||
guint i;
|
||||
|
||||
frameclock = gtk_widget_get_frame_clock (widget);
|
||||
g_signal_handler_disconnect (frameclock, self->after_paint_handler);
|
||||
self->after_paint_handler = 0;
|
||||
|
||||
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (self->renderers)); i ++)
|
||||
{
|
||||
gpointer item = g_list_model_get_item (G_LIST_MODEL (self->renderers), i);
|
||||
@@ -1615,62 +1540,6 @@ edit_action_cb (GtkWidget *widget,
|
||||
node_editor_window_edit (self, &start);
|
||||
}
|
||||
|
||||
static void
|
||||
node_editor_window_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
NodeEditorWindow *self = NODE_EDITOR_WINDOW (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_AUTO_RELOAD:
|
||||
{
|
||||
gboolean auto_reload = g_value_get_boolean (value);
|
||||
if (self->auto_reload != auto_reload)
|
||||
{
|
||||
self->auto_reload = auto_reload;
|
||||
|
||||
if (self->auto_reload)
|
||||
reload (self);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
node_editor_window_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
NodeEditorWindow *self = NODE_EDITOR_WINDOW (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_AUTO_RELOAD:
|
||||
g_value_set_boolean (value, self->auto_reload);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
close_crash_warning (GtkButton *button,
|
||||
NodeEditorWindow *self)
|
||||
{
|
||||
gtk_revealer_set_reveal_child (GTK_REVEALER (self->crash_warning), FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
node_editor_window_class_init (NodeEditorWindowClass *class)
|
||||
{
|
||||
@@ -1682,8 +1551,6 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
|
||||
|
||||
object_class->dispose = node_editor_window_dispose;
|
||||
object_class->finalize = node_editor_window_finalize;
|
||||
object_class->set_property = node_editor_window_set_property;
|
||||
object_class->get_property = node_editor_window_get_property;
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class,
|
||||
"/org/gtk/gtk4/node-editor/node-editor-window.ui");
|
||||
@@ -1691,12 +1558,6 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
|
||||
widget_class->realize = node_editor_window_realize;
|
||||
widget_class->unrealize = node_editor_window_unrealize;
|
||||
|
||||
properties[PROP_AUTO_RELOAD] = g_param_spec_boolean ("auto-reload", NULL, NULL,
|
||||
TRUE,
|
||||
G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_STATIC_NAME);
|
||||
|
||||
g_object_class_install_properties (object_class, NUM_PROPERTIES, properties);
|
||||
|
||||
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, text_view);
|
||||
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, picture);
|
||||
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, renderer_listbox);
|
||||
@@ -1706,7 +1567,6 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
|
||||
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_child (widget_class, NodeEditorWindow, crash_warning);
|
||||
|
||||
gtk_widget_class_bind_template_callback (widget_class, text_view_query_tooltip_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, open_cb);
|
||||
@@ -1719,7 +1579,6 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
|
||||
gtk_widget_class_bind_template_callback (widget_class, on_picture_drag_prepare_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, on_picture_drop_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, click_gesture_pressed);
|
||||
gtk_widget_class_bind_template_callback (widget_class, close_crash_warning);
|
||||
|
||||
gtk_widget_class_install_action (widget_class, "smart-edit", NULL, edit_action_cb);
|
||||
|
||||
@@ -1771,98 +1630,11 @@ static GActionEntry win_entries[] = {
|
||||
{ "open", window_open, NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
char *
|
||||
get_autosave_path (const char *suffix)
|
||||
{
|
||||
char *path;
|
||||
char *name;
|
||||
|
||||
name = g_strconcat ("autosave", suffix, NULL);
|
||||
path = g_build_filename (g_get_user_cache_dir (), "gtk4-node-editor", name, NULL);
|
||||
g_free (name);
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
static void
|
||||
set_initial_text (NodeEditorWindow *self)
|
||||
{
|
||||
char *path, *path1;
|
||||
char *initial_text;
|
||||
gsize len;
|
||||
|
||||
path = get_autosave_path (NULL);
|
||||
path1 = get_autosave_path ("-unsafe");
|
||||
|
||||
if (g_file_get_contents (path1, &initial_text, &len, NULL))
|
||||
{
|
||||
self->auto_reload = FALSE;
|
||||
gtk_revealer_set_reveal_child (GTK_REVEALER (self->crash_warning), TRUE);
|
||||
|
||||
gtk_text_buffer_set_text (self->text_buffer, initial_text, len);
|
||||
g_free (initial_text);
|
||||
}
|
||||
else if (g_file_get_contents (path, &initial_text, &len, NULL))
|
||||
{
|
||||
gtk_text_buffer_set_text (self->text_buffer, initial_text, len);
|
||||
g_free (initial_text);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Default */
|
||||
gtk_text_buffer_set_text (self->text_buffer,
|
||||
"shadow {\n"
|
||||
" child: texture {\n"
|
||||
" bounds: 0 0 128 128;\n"
|
||||
" texture: url(\"resource:///org/gtk/gtk4/node-editor/icons/apps/org.gtk.gtk4.NodeEditor.svg\");\n"
|
||||
" }\n"
|
||||
" shadows: rgba(0,0,0,0.5) 0 1 12;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"transform {\n"
|
||||
" child: text {\n"
|
||||
" color: rgb(46,52,54);\n"
|
||||
" font: \"Cantarell Bold 11\";\n"
|
||||
" glyphs: \"GTK Node Editor\";\n"
|
||||
" offset: 8 14.418;\n"
|
||||
" }\n"
|
||||
" transform: translate(0, 140);\n"
|
||||
"}", -1);
|
||||
}
|
||||
|
||||
g_free (path);
|
||||
g_free (path1);
|
||||
}
|
||||
|
||||
static void
|
||||
autosave_contents (NodeEditorWindow *self)
|
||||
{
|
||||
char *path = NULL;
|
||||
char *dir = NULL;
|
||||
char *contents;
|
||||
GtkTextIter start, end;
|
||||
|
||||
gtk_text_buffer_get_bounds (self->text_buffer, &start, &end);
|
||||
contents = gtk_text_buffer_get_text (self->text_buffer, &start, &end, TRUE);
|
||||
path = get_autosave_path ("-unsafe");
|
||||
dir = g_path_get_dirname (path);
|
||||
g_mkdir_with_parents (dir, 0755);
|
||||
g_file_set_contents (path, contents, -1, NULL);
|
||||
|
||||
g_free (dir);
|
||||
g_free (path);
|
||||
g_free (contents);
|
||||
}
|
||||
|
||||
static void
|
||||
node_editor_window_init (NodeEditorWindow *self)
|
||||
{
|
||||
GAction *action;
|
||||
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
|
||||
self->auto_reload = TRUE;
|
||||
|
||||
self->renderers = g_list_store_new (GDK_TYPE_PAINTABLE);
|
||||
gtk_list_box_bind_model (GTK_LIST_BOX (self->renderer_listbox),
|
||||
G_LIST_MODEL (self->renderers),
|
||||
@@ -1875,10 +1647,6 @@ node_editor_window_init (NodeEditorWindow *self)
|
||||
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (self), win_entries, G_N_ELEMENTS (win_entries), self);
|
||||
|
||||
action = G_ACTION (g_property_action_new ("auto-reload", self, "auto-reload"));
|
||||
g_action_map_add_action (G_ACTION_MAP (self), action);
|
||||
g_object_unref (action);
|
||||
|
||||
self->tag_table = gtk_text_tag_table_new ();
|
||||
gtk_text_tag_table_add (self->tag_table,
|
||||
g_object_new (GTK_TYPE_TEXT_TAG,
|
||||
@@ -1916,9 +1684,25 @@ node_editor_window_init (NodeEditorWindow *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);
|
||||
|
||||
set_initial_text (self);
|
||||
|
||||
g_signal_connect_swapped (self->text_buffer, "changed", G_CALLBACK (autosave_contents), self);
|
||||
/* Default */
|
||||
gtk_text_buffer_set_text (self->text_buffer,
|
||||
"shadow {\n"
|
||||
" child: texture {\n"
|
||||
" bounds: 0 0 128 128;\n"
|
||||
" texture: url(\"resource:///org/gtk/gtk4/node-editor/icons/apps/org.gtk.gtk4.NodeEditor.svg\");\n"
|
||||
" }\n"
|
||||
" shadows: rgba(0,0,0,0.5) 0 1 12;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"transform {\n"
|
||||
" child: text {\n"
|
||||
" color: rgb(46,52,54);\n"
|
||||
" font: \"Cantarell Bold 11\";\n"
|
||||
" glyphs: \"GTK Node Editor\";\n"
|
||||
" offset: 8 14.418;\n"
|
||||
" }\n"
|
||||
" transform: translate(0, 140);\n"
|
||||
"}", -1);
|
||||
|
||||
if (g_getenv ("GSK_RENDERER"))
|
||||
{
|
||||
|
||||
@@ -37,5 +37,3 @@ NodeEditorWindow * node_editor_window_new (NodeEditorApplication
|
||||
|
||||
gboolean node_editor_window_load (NodeEditorWindow *self,
|
||||
GFile *file);
|
||||
|
||||
char * get_autosave_path (const char *suffix);
|
||||
|
||||
@@ -2,10 +2,6 @@
|
||||
<interface>
|
||||
<menu id="gear_menu">
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Reload automatically</attribute>
|
||||
<attribute name="action">win.auto-reload</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Help</attribute>
|
||||
<attribute name="action">app.help</attribute>
|
||||
@@ -28,6 +24,7 @@
|
||||
</item>
|
||||
</section>
|
||||
</menu>
|
||||
|
||||
<object class="GtkPopover" id="testcase_popover">
|
||||
<child>
|
||||
<object class="GtkGrid">
|
||||
@@ -42,7 +39,7 @@
|
||||
<object class="GtkEntry" id="testcase_name_entry">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="activates-default">1</property>
|
||||
<signal name="notify::text" handler="testcase_name_entry_changed_cb"/>
|
||||
<signal name="notify::text" handler="testcase_name_entry_changed_cb" />
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -55,6 +52,7 @@
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="wrap">1</property>
|
||||
@@ -68,6 +66,7 @@
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkLabel" id="testcase_error_label">
|
||||
<property name="wrap">1</property>
|
||||
@@ -79,6 +78,7 @@
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkButton" id="testcase_save_button">
|
||||
<property name="label">Save</property>
|
||||
@@ -86,9 +86,9 @@
|
||||
<property name="halign">end</property>
|
||||
<property name="receives-default">1</property>
|
||||
<property name="sensitive">0</property>
|
||||
<signal name="clicked" handler="testcase_save_clicked_cb"/>
|
||||
<signal name="clicked" handler="testcase_save_clicked_cb" />
|
||||
<style>
|
||||
<class name="suggested-action"/>
|
||||
<class name="suggested-action" />
|
||||
</style>
|
||||
<layout>
|
||||
<property name="row">4</property>
|
||||
@@ -100,6 +100,7 @@
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
<template class="NodeEditorWindow" parent="GtkApplicationWindow">
|
||||
<property name="title" translatable="yes">GTK Node Editor</property>
|
||||
<property name="default-width">1024</property>
|
||||
@@ -184,129 +185,83 @@
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkOverlay">
|
||||
<child type="overlay">
|
||||
<object class="GtkRevealer" id="crash_warning">
|
||||
<property name="transition-type">slide-down</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="child">
|
||||
<object class="GtkFrame">
|
||||
<object class="GtkPaned">
|
||||
<property name="shrink-start-child">false</property>
|
||||
<property name="shrink-end-child">false</property>
|
||||
<property name="position">400</property>
|
||||
<property name="start-child">
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<property name="hexpand">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
<child>
|
||||
<object class="GtkTextView" id="text_view">
|
||||
<property name="wrap-mode">word</property>
|
||||
<property name="monospace">1</property>
|
||||
<property name="top-margin">6</property>
|
||||
<property name="left-margin">6</property>
|
||||
<property name="right-margin">6</property>
|
||||
<property name="bottom-margin">6</property>
|
||||
<property name="has-tooltip">1</property>
|
||||
<property name="extra-menu">extra_menu</property>
|
||||
<signal name="query-tooltip" handler="text_view_query_tooltip_cb"/>
|
||||
<style>
|
||||
<class name="app-notification"/>
|
||||
<class name="editor" />
|
||||
</style>
|
||||
<property name="child">
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">20</property>
|
||||
<property name="margin-start">10</property>
|
||||
<property name="margin-end">10</property>
|
||||
<property name="margin-top">10</property>
|
||||
<property name="margin-bottom">10</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="halign">1</property>
|
||||
<property name="label" translatable="1">The application may have crashed.
|
||||
As a precaution, auto-loading has been turned off.
|
||||
You can turn it back on in the menu.
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="valign">3</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="label" translatable="1">_Close</property>
|
||||
<signal name="clicked" handler="close_crash_warning"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGestureClick">
|
||||
<property name="button">1</property>
|
||||
<signal name="pressed" handler="click_gesture_pressed"/>
|
||||
</object>
|
||||
</property>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<property name="child">
|
||||
<object class="GtkPaned">
|
||||
<property name="shrink-start-child">false</property>
|
||||
<property name="shrink-end-child">false</property>
|
||||
<property name="position">400</property>
|
||||
<property name="start-child">
|
||||
</property>
|
||||
<property name="end-child">
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<property name="hexpand">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
<property name="min-content-height">100</property>
|
||||
<property name="min-content-width">100</property>
|
||||
<child>
|
||||
<object class="GtkTextView" id="text_view">
|
||||
<property name="wrap-mode">word</property>
|
||||
<property name="monospace">1</property>
|
||||
<property name="top-margin">6</property>
|
||||
<property name="left-margin">6</property>
|
||||
<property name="right-margin">6</property>
|
||||
<property name="bottom-margin">6</property>
|
||||
<property name="has-tooltip">1</property>
|
||||
<property name="extra-menu">extra_menu</property>
|
||||
<signal name="query-tooltip" handler="text_view_query_tooltip_cb"/>
|
||||
<style>
|
||||
<class name="editor"/>
|
||||
</style>
|
||||
<object class="GtkViewport">
|
||||
<child>
|
||||
<object class="GtkGestureClick">
|
||||
<property name="button">1</property>
|
||||
<signal name="pressed" handler="click_gesture_pressed"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
<property name="end-child">
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
<property name="min-content-height">100</property>
|
||||
<property name="min-content-width">100</property>
|
||||
<child>
|
||||
<object class="GtkViewport">
|
||||
<object class="GtkPicture" id="picture">
|
||||
<property name="can-shrink">0</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<child>
|
||||
<object class="GtkPicture" id="picture">
|
||||
<property name="can-shrink">0</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<child>
|
||||
<object class="GtkDragSource">
|
||||
<property name="actions">copy</property>
|
||||
<signal name="prepare" handler="on_picture_drag_prepare_cb" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkDropTargetAsync">
|
||||
<object class="GtkDragSource">
|
||||
<property name="actions">copy</property>
|
||||
<property name="formats">application/x-gtk-render-node</property>
|
||||
<signal name="drop" handler="on_picture_drop_cb" swapped="no"/>
|
||||
<signal name="prepare" handler="on_picture_drag_prepare_cb" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<child>
|
||||
<object class="GtkListBox" id="renderer_listbox">
|
||||
<property name="selection-mode">none</property>
|
||||
<object class="GtkDropTargetAsync">
|
||||
<property name="actions">copy</property>
|
||||
<property name="formats">application/x-gtk-render-node</property>
|
||||
<signal name="drop" handler="on_picture_drop_cb" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<child>
|
||||
<object class="GtkListBox" id="renderer_listbox">
|
||||
<property name="selection-mode">none</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
@@ -322,44 +322,27 @@ stroke bounds of the path.
|
||||
|
||||
### text
|
||||
|
||||
| property | syntax | default | printed |
|
||||
| ------------ | ------------------- | ------------------- | ----------- |
|
||||
| color | `<color>` | black | non-default |
|
||||
| font | `<string>` `<url>`? | "Cantarell 15px" | always |
|
||||
| glyphs | `<glyphs>` | "Hello" | always |
|
||||
| offset | `<point>` | 0 0 | non-default |
|
||||
| hint-style | `<hint style>` | slight | non-default |
|
||||
| antialias | `<antialias>` | gray | non-default |
|
||||
| property | syntax | default | printed |
|
||||
| -------- | ---------------- | ---------------------- | ----------- |
|
||||
| color | `<color>` | black | non-default |
|
||||
| font | `<string>` | "Cantarell 11" | always |
|
||||
| glyphs | `<glyphs>` | "Hello" | always |
|
||||
| offset | `<point>` | 0 0 | non-default |
|
||||
|
||||
Creates a node like `gsk_text_node_new()` with the given properties.
|
||||
|
||||
If a url is specified for the font, it must point to a font file for the
|
||||
font that is specified in the string. It can be either a data url containing
|
||||
a base64-encoded font file, or a regular url that points to a font file.
|
||||
|
||||
Glyphs can be specified as an ASCII string, or as a comma-separated list of
|
||||
their glyph IDs. Optionally, the advance width, x and y offsets and flags can
|
||||
be specified as well, like this: 40 10 0 0 color.
|
||||
|
||||
If the given font does not exist or the given glyphs are invalid for the given
|
||||
font, an error node will be returned.
|
||||
|
||||
Possible values for hint-style are none, slight or full.
|
||||
Possible value for antialias are none or gray.
|
||||
|
||||
### texture
|
||||
|
||||
| property | syntax | default | printed |
|
||||
| -------- | ------------------- | ---------------------- | ----------- |
|
||||
| bounds | `<rect>` | 50 | always |
|
||||
| texture | `<string>`?`<url>`? | *see below* | always |
|
||||
| property | syntax | default | printed |
|
||||
| -------- | ---------------- | ---------------------- | ----------- |
|
||||
| bounds | `<rect>` | 50 | always |
|
||||
| texture | `<url>` | *see below* | always |
|
||||
|
||||
Creates a node like `gsk_texture_node_new()` with the given properties.
|
||||
|
||||
If a string is specified for the texture, it will be used as a name for the text.
|
||||
Textures can be reused by specifying the name of a previously used texture. In
|
||||
that case, the url can be omitted.
|
||||
|
||||
The default texture is a 10x10 checkerboard with the top left and bottom right
|
||||
5x5 being in the color #FF00CC and the other part being transparent. A possible
|
||||
representation for this texture is `url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABmJLR0QA/wD/AP+gvaeTAAAAKUlEQVQYlWP8z3DmPwMaYGQwYUQXY0IXwAUGUCGGoxkYGBiweXAoeAYAz44F3e3U1xUAAAAASUVORK5CYII=")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
executable('gtk4-print-editor',
|
||||
sources: ['print-editor.c'],
|
||||
c_args: common_cflags,
|
||||
dependencies: [ libgtk_dep, profile_conf_h ],
|
||||
dependencies: [ libgtk_dep, demo_conf_h ],
|
||||
include_directories: confinc,
|
||||
win_subsystem: 'windows',
|
||||
link_args: extra_demo_ldflags,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "profile_conf.h"
|
||||
#include "demo_conf.h"
|
||||
|
||||
static GtkWidget *main_window;
|
||||
static GFile *filename = NULL;
|
||||
|
||||
@@ -66,7 +66,7 @@ endif
|
||||
executable('gtk4-widget-factory',
|
||||
sources: ['widget-factory.c', widgetfactory_resources],
|
||||
c_args: common_cflags,
|
||||
dependencies: [ libgtk_dep, profile_conf_h ],
|
||||
dependencies: [ libgtk_dep, demo_conf_h ],
|
||||
include_directories: confinc,
|
||||
win_subsystem: 'windows',
|
||||
link_args: extra_demo_ldflags,
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "profile_conf.h"
|
||||
#include "demo_conf.h"
|
||||
|
||||
static void
|
||||
change_dark_state (GSimpleAction *action,
|
||||
|
||||
@@ -69,9 +69,9 @@ Image:
|
||||
4 CARD32 IMAGE_DATA_OFFSET
|
||||
|
||||
ICON_FLAGS
|
||||
HAS_SUFFIX_XPM 1
|
||||
HAS_SUFFIX_SVG 2
|
||||
HAS_SUFFIX_PNG 4
|
||||
HAS_SUFFIX_PNG 1
|
||||
HAS_SUFFIX_XPM 2
|
||||
HAS_SUFFIX_SVG 4
|
||||
HAS_ICON_FILE 8
|
||||
|
||||
ImageData:
|
||||
|
||||
@@ -25,8 +25,6 @@ base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/"
|
||||
|
||||
[extra]
|
||||
content_images = [
|
||||
"../images/favicon.svg",
|
||||
"../images/favicon-192x192.png",
|
||||
"images/gtk-logo.svg",
|
||||
]
|
||||
urlmap_file = "urlmap.js"
|
||||
|
||||
@@ -24,8 +24,6 @@ base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/"
|
||||
|
||||
[extra]
|
||||
content_images = [
|
||||
"../images/favicon.svg",
|
||||
"../images/favicon-192x192.png",
|
||||
"images/gtk-logo.svg",
|
||||
]
|
||||
urlmap_file = "urlmap.js"
|
||||
|
||||
@@ -67,8 +67,6 @@ content_files = [
|
||||
"macos.md",
|
||||
]
|
||||
content_images = [
|
||||
"../images/favicon.svg",
|
||||
"../images/favicon-192x192.png",
|
||||
"images/gtk-logo.svg",
|
||||
"images/rotated-text.png",
|
||||
"images/default_cursor.png",
|
||||
|
||||
@@ -36,8 +36,6 @@ content_files = [
|
||||
"paths.md",
|
||||
]
|
||||
content_images = [
|
||||
"../images/favicon.svg",
|
||||
"../images/favicon-192x192.png",
|
||||
"gtk-logo.svg",
|
||||
"images/arc-dark.png",
|
||||
"images/arc-light.png",
|
||||
|
||||
@@ -234,7 +234,7 @@ By default, GTK will try to build with support for the Vulkan graphics
|
||||
API in addition to cairo and OpenGL. This option can be used to explicitly
|
||||
control whether Vulkan should be used.
|
||||
|
||||
### `media-gstreamer`
|
||||
### `media-gstreamer` and `media-ffmpeg`
|
||||
|
||||
By default, GTK will try to build the gstreamer backend for
|
||||
media playback support. These options can be used to explicitly
|
||||
|
||||
@@ -30,14 +30,6 @@ OPTIONS
|
||||
|
||||
Show the application help.
|
||||
|
||||
``--version``
|
||||
|
||||
Show the program version.
|
||||
|
||||
``--reset``
|
||||
|
||||
Don't restore autosaved content and remove autosave files.
|
||||
|
||||
ENVIRONMENT
|
||||
-----------
|
||||
|
||||
|
||||
@@ -12,11 +12,9 @@ SYNOPSIS
|
||||
--------
|
||||
| **gtk4-rendernode-tool** <COMMAND> [OPTIONS...] <FILE>
|
||||
|
|
||||
| **gtk4-rendernode-tool** benchmark [OPTIONS...] <FILE>
|
||||
| **gtk4-rendernode-tool** compare [OPTIONS...] <FILE1> <FILE2>
|
||||
| **gtk4-rendernode-tool** info [OPTIONS...] <FILE>
|
||||
| **gtk4-rendernode-tool** render [OPTIONS...] <FILE> [<FILE>]
|
||||
| **gtk4-rendernode-tool** show [OPTIONS...] <FILE>
|
||||
| **gtk4-rendernode-tool** render [OPTIONS...] <FILE> [<FILE>]
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
@@ -52,45 +50,3 @@ The name of the file to write can be specified as a second FILE argument.
|
||||
|
||||
Use the given renderer. Use ``--renderer=help`` to get a information
|
||||
about poassible values for the ``RENDERER``.
|
||||
|
||||
Benchmark
|
||||
^^^^^^^^^
|
||||
|
||||
The ``benchmark`` command benchmarks rendering of a node with the existing renderers
|
||||
and prints the runtimes.
|
||||
|
||||
``--renderer=RENDERER``
|
||||
|
||||
Add the given renderer. This argument can be passed multiple times to test multiple
|
||||
renderers. By default, all major GTK renderers are run.
|
||||
|
||||
``--runs=RUNS``
|
||||
|
||||
Number of times to render the node on each renderer. By default, this is 3 times.
|
||||
Keep in mind that the first run is often used to populate caches and might be
|
||||
significantly slower.
|
||||
|
||||
``--no-download``
|
||||
|
||||
Do not attempt to download the result. This may cause the measurement to not include
|
||||
the execution of the commands on the GPU. It can be useful to use this flag to test
|
||||
command submission performance.
|
||||
|
||||
Compare
|
||||
^^^^^^^
|
||||
|
||||
The ``compare`` command compares the rendering of a node with a reference image,
|
||||
or the renderings of two nodes, or two images. If any differences are found, the
|
||||
exit code is 1. If the images are identical, it is 0.
|
||||
|
||||
``--renderer=RENDERER``
|
||||
|
||||
Use the given renderer.
|
||||
|
||||
``--output=FILE``
|
||||
|
||||
Save the differences as a png image in ``FILE``.
|
||||
|
||||
``--quiet``
|
||||
|
||||
Don't write results to stdout.`
|
||||
|
||||
@@ -85,8 +85,6 @@ content_files = [
|
||||
"visual_index.md",
|
||||
]
|
||||
content_images = [
|
||||
"../images/favicon.svg",
|
||||
"../images/favicon-192x192.png",
|
||||
"images/aboutdialog.png",
|
||||
"images/action-bar.png",
|
||||
"images/appchooserbutton.png",
|
||||
|
||||
@@ -126,8 +126,8 @@ available on the system.
|
||||
### `GTK_MEDIA`
|
||||
|
||||
Specifies what backend to load for [class@Gtk.MediaFile]. The possible values
|
||||
depend on what options GTK was built with, and can include 'gstreamer'
|
||||
and 'none'. If set to 'none', media playback will be unavailable.
|
||||
depend on what options GTK was built with, and can include 'gstreamer',
|
||||
'ffmpeg' and 'none'. If set to 'none', media playback will be unavailable.
|
||||
The special value 'help' can be used to obtain a list of all supported
|
||||
media backends.
|
||||
|
||||
@@ -220,8 +220,8 @@ A number of options affect behavior instead of logging:
|
||||
`gl-disable`
|
||||
: Disable OpenGL support
|
||||
|
||||
`gl-no-fractional`
|
||||
: Disable fractional scaling for OpenGL.
|
||||
`gl-fractional`
|
||||
: Enable fractional scaling for OpenGL. This is experimental
|
||||
|
||||
`gl-debug`
|
||||
: Insert debugging information in OpenGL
|
||||
@@ -357,7 +357,7 @@ devices.
|
||||
### `GDK_VULKAN_SKIP`
|
||||
|
||||
This variable can be set to a list of values, which cause GDK to
|
||||
disable features of the Vulkan support.
|
||||
disable features of the Vulkan support.
|
||||
Note that these features may already be disabled if the Vulkan driver
|
||||
does not support them.
|
||||
|
||||
@@ -415,24 +415,19 @@ 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.
|
||||
|
||||
::: note
|
||||
If you are running the Nahimic 3 service on a Windows system with
|
||||
nVidia graphics, you need to perform one of the following:
|
||||
|
||||
- stop the "Nahimic service"
|
||||
- insert the GTK application into the Nahimic blocklist, as noted in the
|
||||
[nVidia forums](https://www.nvidia.com/en-us/geforce/forums/game-ready-drivers/13/297952/nahimic-and-nvidia-drivers-conflict/2334568/)
|
||||
- use the cairo renderer (at the cost of being unable to use OpenGL features)
|
||||
- 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.
|
||||
|
||||
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.
|
||||
|
||||
### `GSK_GPU_SKIP`
|
||||
|
||||
@@ -460,13 +455,6 @@ disable certain optimizations of the "ngl" and "vulkan" renderer.
|
||||
The special value `all` can be used to turn on all values. The special
|
||||
value `help` can be used to obtain a list of all supported values.
|
||||
|
||||
### `GSK_CACHE_TIMEOUT`
|
||||
|
||||
Overrides the timeout for cache GC in the "ngl" and "vulkan" renderers.
|
||||
The value can be -1 to disable GC entirely, 0 to force GC to happen
|
||||
before every frame, or a positive number to do GC in a timeout every
|
||||
n seconds. The default timeout is 15 seconds.
|
||||
|
||||
### `GSK_MAX_TEXTURE_SIZE`
|
||||
|
||||
Limit texture size to the minimum of this value and the OpenGL limit
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB |
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.0" width="88.572334" height="96.050743" id="svg6843">
|
||||
<defs id="defs6845"/>
|
||||
<g transform="translate(-19.822308,-16.115941)" id="layer1">
|
||||
<path d="M 20.88413,30.82696 53.816977,55.527708 107.33282,39.060543 70.587303,17.177763 20.88413,30.82696 z" id="path6976" style="fill:#729fcf;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:2.12364459;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"/>
|
||||
<path d="m 22.94243,82.287118 -2.0583,-51.460158 32.932847,24.700748 0,55.577152 L 22.94243,82.287118 z" id="path6978" style="fill:#e40000;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:2.12364459;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"/>
|
||||
<path d="m 53.816977,111.10486 49.399213,-20.58416 4.11663,-51.460157 -53.515843,16.467165 0,55.577152 z" id="path6980" style="fill:#7fe719;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:2.12364459;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"/>
|
||||
<path d="M 23.216626,81.319479 70.48573,67.361442 103.38422,90.444516" id="path6982" style="fill:none;stroke:#ffffff;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"/>
|
||||
<path d="m 70.434539,17.875593 0,49.109284" id="path6984" style="fill:#babdb6;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.8 KiB |
@@ -123,7 +123,7 @@ static const GdkDebugKey gdk_debug_keys[] = {
|
||||
{ "portals", GDK_DEBUG_PORTALS, "Force use of portals" },
|
||||
{ "no-portals", GDK_DEBUG_NO_PORTALS, "Disable use of portals" },
|
||||
{ "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support" },
|
||||
{ "gl-no-fractional", GDK_DEBUG_GL_NO_FRACTIONAL, "Disable fractional scaling for OpenGL" },
|
||||
{ "gl-fractional", GDK_DEBUG_GL_FRACTIONAL, "Enable fractional scaling for OpenGL (experimental)" },
|
||||
{ "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL" },
|
||||
{ "gl-disable-gl", GDK_DEBUG_GL_DISABLE_GL, "Only allow OpenGL GLES API" },
|
||||
{ "gl-disable-gles", GDK_DEBUG_GL_DISABLE_GLES, "Don't allow OpenGL GLES API" },
|
||||
@@ -222,6 +222,7 @@ gdk_parse_debug_var (const char *variable,
|
||||
}
|
||||
else
|
||||
{
|
||||
char *val = g_strndup (p, q - p);
|
||||
for (i = 0; i < nkeys; i++)
|
||||
{
|
||||
if (strlen (keys[i].key) == q - p &&
|
||||
@@ -232,7 +233,8 @@ gdk_parse_debug_var (const char *variable,
|
||||
}
|
||||
}
|
||||
if (i == nkeys)
|
||||
fprintf (stderr, "Unrecognized value \"%.*s\". Try %s=help\n", (int) (q - p), p, variable);
|
||||
fprintf (stderr, "Unrecognized value \"%s\". Try %s=help\n", val, variable);
|
||||
g_free (val);
|
||||
}
|
||||
|
||||
p = q;
|
||||
|
||||
@@ -43,7 +43,7 @@ typedef enum {
|
||||
GDK_DEBUG_PORTALS = 1 << 14,
|
||||
GDK_DEBUG_NO_PORTALS = 1 << 15,
|
||||
GDK_DEBUG_GL_DISABLE = 1 << 16,
|
||||
GDK_DEBUG_GL_NO_FRACTIONAL= 1 << 17,
|
||||
GDK_DEBUG_GL_FRACTIONAL = 1 << 17,
|
||||
|
||||
GDK_DEBUG_GL_DISABLE_GL = 1 << 19,
|
||||
GDK_DEBUG_GL_DISABLE_GLES = 1 << 20,
|
||||
|
||||
@@ -289,8 +289,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
|
||||
*/
|
||||
device_props[PROP_MODIFIER_STATE] =
|
||||
g_param_spec_flags ("modifier-state", NULL, NULL,
|
||||
GDK_TYPE_MODIFIER_TYPE,
|
||||
GDK_NO_MODIFIER_MASK,
|
||||
GDK_TYPE_MODIFIER_TYPE, 0,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, LAST_PROP, device_props);
|
||||
|
||||
@@ -77,7 +77,6 @@ enum
|
||||
PROP_0,
|
||||
PROP_COMPOSITED,
|
||||
PROP_RGBA,
|
||||
PROP_SHADOW_WIDTH,
|
||||
PROP_INPUT_SHAPES,
|
||||
PROP_DMABUF_FORMATS,
|
||||
LAST_PROP
|
||||
@@ -112,7 +111,6 @@ struct _GdkDisplayPrivate {
|
||||
|
||||
guint rgba : 1;
|
||||
guint composited : 1;
|
||||
guint shadow_width: 1;
|
||||
guint input_shapes : 1;
|
||||
|
||||
GdkDebugFlags debug_flags;
|
||||
@@ -146,10 +144,6 @@ gdk_display_get_property (GObject *object,
|
||||
g_value_set_boolean (value, gdk_display_is_rgba (display));
|
||||
break;
|
||||
|
||||
case PROP_SHADOW_WIDTH:
|
||||
g_value_set_boolean (value, gdk_display_supports_shadow_width (display));
|
||||
break;
|
||||
|
||||
case PROP_INPUT_SHAPES:
|
||||
g_value_set_boolean (value, gdk_display_supports_input_shapes (display));
|
||||
break;
|
||||
@@ -249,18 +243,6 @@ gdk_display_class_init (GdkDisplayClass *class)
|
||||
TRUE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDisplay:shadow-width: (attributes org.gtk.Property.get=gdk_display_supports_shadow_width)
|
||||
*
|
||||
* %TRUE if the display supports extensible frames.
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
props[PROP_SHADOW_WIDTH] =
|
||||
g_param_spec_boolean ("shadow-width", NULL, NULL,
|
||||
TRUE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDisplay:input-shapes: (attributes org.gtk.Property.get=gdk_display_supports_input_shapes)
|
||||
*
|
||||
@@ -272,7 +254,7 @@ gdk_display_class_init (GdkDisplayClass *class)
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDisplay:dmabuf-formats: (attributes org.gtk.Property.get=gdk_display_get_dmabuf_formats)
|
||||
* GdkDisplay:dmabuf-formats:
|
||||
*
|
||||
* The dma-buf formats that are supported on this display
|
||||
*
|
||||
@@ -409,7 +391,6 @@ gdk_display_init (GdkDisplay *display)
|
||||
|
||||
priv->composited = TRUE;
|
||||
priv->rgba = TRUE;
|
||||
priv->shadow_width = TRUE;
|
||||
priv->input_shapes = TRUE;
|
||||
}
|
||||
|
||||
@@ -1382,7 +1363,7 @@ gdk_display_init_gl (GdkDisplay *self)
|
||||
return;
|
||||
}
|
||||
|
||||
gdk_profiler_end_mark (before2, "Realize OpenGL context", NULL);
|
||||
gdk_profiler_end_mark (before2, "realize OpenGL context", NULL);
|
||||
|
||||
/* Only assign after realize, so GdkGLContext::realize() can use
|
||||
* gdk_display_get_gl_context() == NULL to differentiate between
|
||||
@@ -1392,7 +1373,7 @@ gdk_display_init_gl (GdkDisplay *self)
|
||||
|
||||
gdk_gl_backend_use (GDK_GL_CONTEXT_GET_CLASS (context)->backend_type);
|
||||
|
||||
gdk_profiler_end_mark (before, "Init OpenGL", NULL);
|
||||
gdk_profiler_end_mark (before, "initialize OpenGL", NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1787,6 +1768,7 @@ gdk_display_init_egl (GdkDisplay *self,
|
||||
{
|
||||
GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
|
||||
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
|
||||
G_GNUC_UNUSED gint64 start_time2;
|
||||
int major, minor;
|
||||
|
||||
if (!gdk_gl_backend_can_be_used (GDK_GL_EGL, error))
|
||||
@@ -1813,6 +1795,7 @@ gdk_display_init_egl (GdkDisplay *self,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
start_time2 = GDK_PROFILER_CURRENT_TIME;
|
||||
if (!eglInitialize (priv->egl_display, &major, &minor))
|
||||
{
|
||||
priv->egl_display = NULL;
|
||||
@@ -1821,6 +1804,7 @@ gdk_display_init_egl (GdkDisplay *self,
|
||||
_("Could not initialize EGL display"));
|
||||
return FALSE;
|
||||
}
|
||||
gdk_profiler_end_mark (start_time2, "eglInitialize", NULL);
|
||||
|
||||
if (major < GDK_EGL_MIN_VERSION_MAJOR ||
|
||||
(major == GDK_EGL_MIN_VERSION_MAJOR && minor < GDK_EGL_MIN_VERSION_MINOR))
|
||||
@@ -1910,7 +1894,7 @@ gdk_display_init_egl (GdkDisplay *self,
|
||||
g_free (ext);
|
||||
}
|
||||
|
||||
gdk_profiler_end_mark (start_time, "Init EGL", NULL);
|
||||
gdk_profiler_end_mark (start_time, "init EGL", NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -2037,12 +2021,9 @@ gdk_display_get_dmabuf_formats (GdkDisplay *display)
|
||||
GdkDebugFlags
|
||||
gdk_display_get_debug_flags (GdkDisplay *display)
|
||||
{
|
||||
if (display == NULL)
|
||||
return _gdk_debug_flags;
|
||||
|
||||
GdkDisplayPrivate *priv = gdk_display_get_instance_private (display);
|
||||
|
||||
return priv->debug_flags;
|
||||
return display ? priv->debug_flags : _gdk_debug_flags;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2144,46 +2125,6 @@ gdk_display_set_rgba (GdkDisplay *display,
|
||||
g_object_notify_by_pspec (G_OBJECT (display), props[PROP_RGBA]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_display_supports_shadow_width: (attributes org.gtk.Method.get_property=shadow-width)
|
||||
* @display: a `GdkDisplay`
|
||||
*
|
||||
* Returns whether it's possible for a surface to draw outside of the window area.
|
||||
*
|
||||
* If %TRUE is returned the application decides if it wants to draw shadows.
|
||||
* If %FALSE is returned, the compositor decides if it wants to draw shadows.
|
||||
*
|
||||
* Returns: %TRUE if surfaces can draw shadows or
|
||||
* %FALSE if the display does not support this functionality.
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
gboolean
|
||||
gdk_display_supports_shadow_width (GdkDisplay *display)
|
||||
{
|
||||
GdkDisplayPrivate *priv = gdk_display_get_instance_private (display);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
|
||||
|
||||
return priv->shadow_width;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_display_set_shadow_width (GdkDisplay *display,
|
||||
gboolean shadow_width)
|
||||
{
|
||||
GdkDisplayPrivate *priv = gdk_display_get_instance_private (display);
|
||||
|
||||
g_return_if_fail (GDK_IS_DISPLAY (display));
|
||||
|
||||
if (priv->shadow_width == shadow_width)
|
||||
return;
|
||||
|
||||
priv->shadow_width = shadow_width;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (display), props[PROP_SHADOW_WIDTH]);
|
||||
}
|
||||
|
||||
static void
|
||||
device_removed_cb (GdkSeat *seat,
|
||||
GdkDevice *device,
|
||||
|
||||
@@ -63,8 +63,6 @@ GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_display_is_composited (GdkDisplay *display);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_display_is_rgba (GdkDisplay *display);
|
||||
GDK_AVAILABLE_IN_4_14
|
||||
gboolean gdk_display_supports_shadow_width (GdkDisplay *display);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_display_supports_input_shapes (GdkDisplay *display);
|
||||
|
||||
|
||||
@@ -257,8 +257,6 @@ void gdk_display_set_composited (GdkDisplay *display
|
||||
gboolean composited);
|
||||
void gdk_display_set_input_shapes (GdkDisplay *display,
|
||||
gboolean input_shapes);
|
||||
void gdk_display_set_shadow_width (GdkDisplay *display,
|
||||
gboolean shadow_width);
|
||||
|
||||
void gdk_display_add_seat (GdkDisplay *display,
|
||||
GdkSeat *seat);
|
||||
|
||||
@@ -2329,42 +2329,18 @@ gdk_dmabuf_sanitize (GdkDmabuf *dest,
|
||||
* @dmabuf: a sanitized GdkDmabuf
|
||||
*
|
||||
* A dmabuf is considered disjoint if it uses more than
|
||||
* 1 inode.
|
||||
* Multiple file descriptors may exist when the creator
|
||||
* of the dmabuf just dup()ed once for every plane...
|
||||
* 1 file descriptor.
|
||||
*
|
||||
* Returns: %TRUE if the dmabuf is disjoint
|
||||
**/
|
||||
gboolean
|
||||
gdk_dmabuf_is_disjoint (const GdkDmabuf *dmabuf)
|
||||
{
|
||||
struct stat first_stat;
|
||||
unsigned i;
|
||||
|
||||
/* First, do a fast check */
|
||||
|
||||
for (i = 1; i < dmabuf->n_planes; i++)
|
||||
{
|
||||
if (dmabuf->planes[0].fd != dmabuf->planes[i].fd)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == dmabuf->n_planes)
|
||||
return FALSE;
|
||||
|
||||
/* We have different fds, do the fancy check instead */
|
||||
|
||||
if (fstat (dmabuf->planes[0].fd, &first_stat) != 0)
|
||||
return TRUE;
|
||||
|
||||
for (i = 1; i < dmabuf->n_planes; i++)
|
||||
{
|
||||
struct stat plane_stat;
|
||||
|
||||
if (fstat (dmabuf->planes[0].fd, &plane_stat) != 0)
|
||||
return TRUE;
|
||||
|
||||
if (first_stat.st_ino != plane_stat.st_ino)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +154,6 @@ gdk_dmabuf_get_egl_downloader (GdkDisplay *display,
|
||||
gboolean retval = FALSE;
|
||||
GError *error = NULL;
|
||||
GskRenderer *renderer;
|
||||
GdkGLContext *previous;
|
||||
|
||||
g_assert (display->egl_dmabuf_formats == NULL);
|
||||
g_assert (display->egl_external_formats == NULL);
|
||||
@@ -162,7 +161,6 @@ gdk_dmabuf_get_egl_downloader (GdkDisplay *display,
|
||||
if (!gdk_display_prepare_gl (display, NULL))
|
||||
return NULL;
|
||||
|
||||
previous = gdk_gl_context_get_current ();
|
||||
formats = gdk_dmabuf_formats_builder_new ();
|
||||
external = gdk_dmabuf_formats_builder_new ();
|
||||
|
||||
@@ -174,11 +172,7 @@ gdk_dmabuf_get_egl_downloader (GdkDisplay *display,
|
||||
gdk_dmabuf_formats_builder_add_formats (builder, display->egl_dmabuf_formats);
|
||||
|
||||
if (!retval)
|
||||
{
|
||||
if (previous)
|
||||
gdk_gl_context_make_current (previous);
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
|
||||
renderer = gsk_gl_renderer_new ();
|
||||
|
||||
@@ -187,15 +181,10 @@ gdk_dmabuf_get_egl_downloader (GdkDisplay *display,
|
||||
g_warning ("Failed to realize GL renderer: %s", error->message);
|
||||
g_error_free (error);
|
||||
g_object_unref (renderer);
|
||||
if (previous)
|
||||
gdk_gl_context_make_current (previous);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (previous)
|
||||
gdk_gl_context_make_current (previous);
|
||||
|
||||
return GDK_DMABUF_DOWNLOADER (renderer);
|
||||
}
|
||||
|
||||
|
||||
@@ -217,41 +217,3 @@ gdk_dmabuf_formats_peek_formats (GdkDmabufFormats *self)
|
||||
{
|
||||
return self->formats;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_formats_equal:
|
||||
* @formats1: (nullable): a `GdkDmabufFormats`
|
||||
* @formats2: (nullable): another `GdkDmabufFormats`
|
||||
*
|
||||
* Returns whether @formats1 and @formats2 contain the
|
||||
* same dmabuf formats, in the same order.
|
||||
*
|
||||
* Returns: `TRUE` if @formats1 and @formats2 are equal
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
gboolean
|
||||
gdk_dmabuf_formats_equal (const GdkDmabufFormats *formats1,
|
||||
const GdkDmabufFormats *formats2)
|
||||
{
|
||||
if (formats1 == formats2)
|
||||
return TRUE;
|
||||
|
||||
if (formats1 == NULL || formats2 == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (formats1->n_formats != formats2->n_formats)
|
||||
return FALSE;
|
||||
|
||||
for (gsize i = 0; i < formats1->n_formats; i++)
|
||||
{
|
||||
GdkDmabufFormat *f1 = &formats1->formats[i];
|
||||
GdkDmabufFormat *f2 = &formats2->formats[i];
|
||||
|
||||
if (f1->fourcc != f2->fourcc ||
|
||||
f1->modifier != f2->modifier)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -51,8 +51,4 @@ gboolean gdk_dmabuf_formats_contains (GdkDmabufFormats *formats
|
||||
guint32 fourcc,
|
||||
guint64 modifier) G_GNUC_PURE;
|
||||
|
||||
GDK_AVAILABLE_IN_4_14
|
||||
gboolean gdk_dmabuf_formats_equal (const GdkDmabufFormats *formats1,
|
||||
const GdkDmabufFormats *formats2);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "config.h"
|
||||
#ifdef HAVE_DRM_FOURCC_H
|
||||
#ifdef HAVE_DMABUF
|
||||
#include <drm_fourcc.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
/**
|
||||
* GdkDmabufTexture:
|
||||
*
|
||||
* A `GdkTexture` representing a DMA buffer.
|
||||
* A `GdkTexture` representing a dma-buf object.
|
||||
*
|
||||
* To create a `GdkDmabufTexture`, use the auxiliary
|
||||
* [class@Gdk.DmabufTextureBuilder] object.
|
||||
|
||||
@@ -56,10 +56,10 @@ static struct {
|
||||
GdkCursor *cursor;
|
||||
} drag_cursors[] = {
|
||||
{ GDK_ACTION_ASK, "dnd-ask", NULL },
|
||||
{ GDK_ACTION_COPY, "copy", NULL },
|
||||
{ GDK_ACTION_MOVE, "move", NULL },
|
||||
{ GDK_ACTION_LINK, "alias", NULL },
|
||||
{ 0, "no-drop", NULL },
|
||||
{ GDK_ACTION_COPY, "dnd-copy", NULL },
|
||||
{ GDK_ACTION_MOVE, "dnd-move", NULL },
|
||||
{ GDK_ACTION_LINK, "dnd-link", NULL },
|
||||
{ 0, "dnd-none", NULL },
|
||||
};
|
||||
|
||||
enum {
|
||||
|
||||
219
gdk/gdkenums.h
219
gdk/gdkenums.h
@@ -309,202 +309,67 @@ typedef enum
|
||||
* The color values are premultiplied with the alpha value.
|
||||
* @GDK_MEMORY_R8G8B8A8_PREMULTIPLIED: 4 bytes; for red, green, blue, alpha
|
||||
* The color values are premultiplied with the alpha value.
|
||||
* @GDK_MEMORY_A8B8G8R8_PREMULTIPLIED: 4 bytes; for alpha, blue, green, red,
|
||||
* The color values are premultiplied with the alpha value. Since 4.14
|
||||
* @GDK_MEMORY_B8G8R8A8: 4 bytes; for blue, green, red, alpha.
|
||||
* @GDK_MEMORY_A8R8G8B8: 4 bytes; for alpha, red, green, blue.
|
||||
* @GDK_MEMORY_R8G8B8A8: 4 bytes; for red, green, blue, alpha.
|
||||
* @GDK_MEMORY_A8B8G8R8: 4 bytes; for alpha, blue, green, red.
|
||||
* @GDK_MEMORY_B8G8R8X8: 4 bytes; for blue, green, red, unused. Since 4.14
|
||||
* @GDK_MEMORY_X8R8G8B8: 4 bytes; for unused, red, green, blue. Since 4.14
|
||||
* @GDK_MEMORY_R8G8B8X8: 4 bytes; for red, green, blue, unused. Since 4.14
|
||||
* @GDK_MEMORY_X8B8G8R8: 4 bytes; for unused, blue, green, red. Since 4.14
|
||||
* @GDK_MEMORY_R8G8B8: 3 bytes; for red, green, blue. The data is opaque.
|
||||
* @GDK_MEMORY_B8G8R8: 3 bytes; for blue, green, red. The data is opaque.
|
||||
* @GDK_MEMORY_R16G16B16: 3 guint16 values; for red, green, blue. Since: 4.6
|
||||
* @GDK_MEMORY_R16G16B16A16_PREMULTIPLIED: 4 guint16 values; for red, green,
|
||||
* blue, alpha. The color values are premultiplied with the alpha value.
|
||||
* Since: 4.6
|
||||
* @GDK_MEMORY_R16G16B16A16: 4 guint16 values; for red, green, blue, alpha.
|
||||
* Since: 4.6
|
||||
* @GDK_MEMORY_R16G16B16_FLOAT: 3 half-float values; for red, green, blue.
|
||||
* The data is opaque. Since: 4.6
|
||||
* @GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED: 4 half-float values; for
|
||||
* red, green, blue and alpha. The color values are premultiplied with
|
||||
* the alpha value. Since: 4.6
|
||||
* @GDK_MEMORY_R16G16B16A16_FLOAT: 4 half-float values; for red, green,
|
||||
* blue and alpha. Since: 4.6
|
||||
* @GDK_MEMORY_B32G32R32_FLOAT: 3 float values; for blue, green, red.
|
||||
* The data is opaque. Since: 4.6
|
||||
* @GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED: 4 float values; for
|
||||
* red, green, blue and alpha. The color values are premultiplied with
|
||||
* the alpha value. Since: 4.6
|
||||
* @GDK_MEMORY_R32G32B32A32_FLOAT: 4 float values; for red, green, blue and
|
||||
* alpha. Since: 4.6
|
||||
* @GDK_MEMORY_G8A8_PREMULTIPLIED: 2 bytes; for grayscale, alpha. The color
|
||||
* values are premultiplied with the alpha value. Since: 4.12
|
||||
* @GDK_MEMORY_G8A8: 2 bytes; for grayscale, alpha. Since: 4.12
|
||||
* @GDK_MEMORY_G8: One byte; for grayscale. The data is opaque.
|
||||
* Since: 4.12
|
||||
* @GDK_MEMORY_G16A16_PREMULTIPLIED: 2 guint16 values; for grayscale, alpha.
|
||||
* The color values are premultiplied with the alpha value. Since: 4.12
|
||||
* @GDK_MEMORY_G16A16: 2 guint16 values; for grayscale, alpha. Since: 4.12
|
||||
* @GDK_MEMORY_G16: One guint16 value; for grayscale. The data is opaque.
|
||||
* Since: 4.12
|
||||
* @GDK_MEMORY_A8: One byte; for alpha.
|
||||
* Since: 4.12
|
||||
* @GDK_MEMORY_A16: One guint16 value; for alpha.
|
||||
* Since: 4.12
|
||||
* @GDK_MEMORY_N_FORMATS: The number of formats. This value will change as
|
||||
* more formats get added, so do not rely on its concrete integer.
|
||||
* @GDK_MEMORY_R32G32B32_FLOAT: 3 float values; for red, green, blue.
|
||||
*
|
||||
* `GdkMemoryFormat` describes formats that image data can have in memory.
|
||||
*
|
||||
* It describes formats by listing the contents of the memory passed to it.
|
||||
* So `GDK_MEMORY_A8R8G8B8` will be 1 byte (8 bits) of alpha, followed by a
|
||||
* So GDK_MEMORY_A8R8G8B8 will be 1 byte (8 bits) of alpha, followed by a
|
||||
* byte each of red, green and blue. It is not endian-dependent, so
|
||||
* `CAIRO_FORMAT_ARGB32` is represented by different `GdkMemoryFormats`
|
||||
* CAIRO_FORMAT_ARGB32 is represented by different `GdkMemoryFormats`
|
||||
* on architectures with different endiannesses.
|
||||
*
|
||||
* Its naming is modelled after
|
||||
* [VkFormat](https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VkFormat)
|
||||
* for details).
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_A8B8G8R8_PREMULTIPLIED:
|
||||
*
|
||||
* 4 bytes; for alpha, blue, green, red, The color values are premultiplied with
|
||||
* the alpha value.
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_B8G8R8X8:
|
||||
*
|
||||
* 4 bytes; for blue, green, red, unused.
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_X8R8G8B8:
|
||||
*
|
||||
* 4 bytes; for unused, red, green, blue.
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_R8G8B8X8:
|
||||
*
|
||||
* 4 bytes; for red, green, blue, unused.
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_X8B8G8R8:
|
||||
*
|
||||
* 4 bytes; for unused, blue, green, red.
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_R16G16B16:
|
||||
*
|
||||
* 3 guint16 values; for red, green, blue.
|
||||
*
|
||||
* Since: 4.6
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_R16G16B16A16_PREMULTIPLIED:
|
||||
*
|
||||
* 4 guint16 values; for red, green, blue, alpha. The color values are
|
||||
* premultiplied with the alpha value.
|
||||
*
|
||||
* Since: 4.6
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_R16G16B16A16:
|
||||
*
|
||||
* 4 guint16 values; for red, green, blue, alpha.
|
||||
*
|
||||
* Since: 4.6
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_R16G16B16_FLOAT:
|
||||
*
|
||||
* 3 half-float values; for red, green, blue. The data is opaque.
|
||||
*
|
||||
* Since: 4.6
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED:
|
||||
*
|
||||
* 4 half-float values; for red, green, blue and alpha. The color values are
|
||||
* premultiplied with the alpha value.
|
||||
*
|
||||
* Since: 4.6
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_R16G16B16A16_FLOAT:
|
||||
*
|
||||
* 4 half-float values; for red, green, blue and alpha.
|
||||
*
|
||||
* Since: 4.6
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_B32G32R32_FLOAT:
|
||||
*
|
||||
* 3 float values; for blue, green, red. The data is opaque.
|
||||
*
|
||||
* Since: 4.6
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED:
|
||||
*
|
||||
* 4 float values; for red, green, blue and alpha. The color values are
|
||||
* premultiplied with the alpha value.
|
||||
*
|
||||
* Since: 4.6
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_R32G32B32A32_FLOAT:
|
||||
*
|
||||
* 4 float values; for red, green, blue and alpha.
|
||||
*
|
||||
* Since: 4.6
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_G8A8_PREMULTIPLIED:
|
||||
*
|
||||
* 2 bytes; for grayscale, alpha. The color values are premultiplied with the
|
||||
* alpha value.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_G8A8:
|
||||
*
|
||||
* 2 bytes; for grayscale, alpha.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_G8:
|
||||
*
|
||||
* One byte; for grayscale. The data is opaque.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_G16A16_PREMULTIPLIED:
|
||||
*
|
||||
* 2 guint16 values; for grayscale, alpha. The color values are premultiplied
|
||||
* with the alpha value.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_G16A16:
|
||||
*
|
||||
* 2 guint16 values; for grayscale, alpha.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_G16:
|
||||
*
|
||||
* One guint16 value; for grayscale. The data is opaque.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_A8:
|
||||
*
|
||||
* One byte; for alpha.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_A16:
|
||||
*
|
||||
* One guint16 value; for alpha.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_A16_FLOAT:
|
||||
*
|
||||
* One half-float value; for alpha.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_A32_FLOAT:
|
||||
*
|
||||
* One float value; for alpha.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
typedef enum {
|
||||
GDK_MEMORY_B8G8R8A8_PREMULTIPLIED,
|
||||
GDK_MEMORY_A8R8G8B8_PREMULTIPLIED,
|
||||
|
||||
@@ -477,18 +477,18 @@ check_event_sanity (GdkEvent *event)
|
||||
}
|
||||
#endif
|
||||
|
||||
gboolean
|
||||
void
|
||||
_gdk_event_emit (GdkEvent *event)
|
||||
{
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (!check_event_sanity (event))
|
||||
return FALSE;
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (gdk_drag_handle_source_event (event))
|
||||
return TRUE;
|
||||
return;
|
||||
|
||||
return gdk_surface_handle_event (event);
|
||||
gdk_surface_handle_event (event);
|
||||
}
|
||||
|
||||
/*********************************************
|
||||
|
||||
@@ -619,16 +619,16 @@ typedef enum
|
||||
|
||||
GdkEvent* _gdk_event_unqueue (GdkDisplay *display);
|
||||
|
||||
gboolean _gdk_event_emit (GdkEvent *event);
|
||||
GList* _gdk_event_queue_find_first (GdkDisplay *display);
|
||||
void _gdk_event_queue_remove_link (GdkDisplay *display,
|
||||
GList *node);
|
||||
GList* _gdk_event_queue_append (GdkDisplay *display,
|
||||
GdkEvent *event);
|
||||
void _gdk_event_emit (GdkEvent *event);
|
||||
GList* _gdk_event_queue_find_first (GdkDisplay *display);
|
||||
void _gdk_event_queue_remove_link (GdkDisplay *display,
|
||||
GList *node);
|
||||
GList* _gdk_event_queue_append (GdkDisplay *display,
|
||||
GdkEvent *event);
|
||||
|
||||
void _gdk_event_queue_handle_motion_compression (GdkDisplay *display);
|
||||
void gdk_event_queue_handle_scroll_compression (GdkDisplay *display);
|
||||
void _gdk_event_queue_flush (GdkDisplay *display);
|
||||
void _gdk_event_queue_handle_motion_compression (GdkDisplay *display);
|
||||
void gdk_event_queue_handle_scroll_compression (GdkDisplay *display);
|
||||
void _gdk_event_queue_flush (GdkDisplay *display);
|
||||
|
||||
double * gdk_event_dup_axes (GdkEvent *event);
|
||||
|
||||
|
||||
@@ -79,23 +79,14 @@ static guint signals[LAST_SIGNAL];
|
||||
|
||||
static guint fps_counter;
|
||||
|
||||
/* 60Hz plus some extra for monotonic time inaccuracy */
|
||||
#define FRAME_HISTORY_DEFAULT_LENGTH 64
|
||||
|
||||
#define frame_timings_unref(x) gdk_frame_timings_unref((GdkFrameTimings *) (x))
|
||||
|
||||
#define GDK_ARRAY_NAME timings
|
||||
#define GDK_ARRAY_TYPE_NAME Timings
|
||||
#define GDK_ARRAY_ELEMENT_TYPE GdkFrameTimings *
|
||||
#define GDK_ARRAY_PREALLOC FRAME_HISTORY_DEFAULT_LENGTH
|
||||
#define GDK_ARRAY_FREE_FUNC frame_timings_unref
|
||||
#include "gdk/gdkarrayimpl.c"
|
||||
#define FRAME_HISTORY_MAX_LENGTH 128
|
||||
|
||||
struct _GdkFrameClockPrivate
|
||||
{
|
||||
gint64 frame_counter;
|
||||
int n_timings;
|
||||
int current;
|
||||
Timings timings;
|
||||
GdkFrameTimings *timings[FRAME_HISTORY_MAX_LENGTH];
|
||||
int n_freeze_inhibitors;
|
||||
};
|
||||
|
||||
@@ -108,8 +99,11 @@ static void
|
||||
gdk_frame_clock_finalize (GObject *object)
|
||||
{
|
||||
GdkFrameClockPrivate *priv = GDK_FRAME_CLOCK (object)->priv;
|
||||
int i;
|
||||
|
||||
timings_clear (&priv->timings);
|
||||
for (i = 0; i < FRAME_HISTORY_MAX_LENGTH; i++)
|
||||
if (priv->timings[i] != 0)
|
||||
gdk_frame_timings_unref (priv->timings[i]);
|
||||
|
||||
G_OBJECT_CLASS (gdk_frame_clock_parent_class)->finalize (object);
|
||||
}
|
||||
@@ -263,8 +257,7 @@ gdk_frame_clock_init (GdkFrameClock *clock)
|
||||
clock->priv = priv = gdk_frame_clock_get_instance_private (clock);
|
||||
|
||||
priv->frame_counter = -1;
|
||||
priv->current = 0;
|
||||
timings_init (&priv->timings);
|
||||
priv->current = FRAME_HISTORY_MAX_LENGTH - 1;
|
||||
|
||||
if (fps_counter == 0)
|
||||
fps_counter = gdk_profiler_define_counter ("fps", "Frames per Second");
|
||||
@@ -423,7 +416,7 @@ gdk_frame_clock_get_frame_counter (GdkFrameClock *frame_clock)
|
||||
static inline gint64
|
||||
_gdk_frame_clock_get_history_start (GdkFrameClock *frame_clock)
|
||||
{
|
||||
return frame_clock->priv->frame_counter + 1 - timings_get_size (&frame_clock->priv->timings);
|
||||
return frame_clock->priv->frame_counter + 1 - frame_clock->priv->n_timings;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -452,44 +445,31 @@ gdk_frame_clock_get_history_start (GdkFrameClock *frame_clock)
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_frame_clock_begin_frame (GdkFrameClock *frame_clock,
|
||||
gint64 monotonic_time)
|
||||
_gdk_frame_clock_begin_frame (GdkFrameClock *frame_clock)
|
||||
{
|
||||
GdkFrameClockPrivate *priv;
|
||||
|
||||
g_return_if_fail (GDK_IS_FRAME_CLOCK (frame_clock));
|
||||
|
||||
priv = frame_clock->priv;
|
||||
|
||||
priv->frame_counter++;
|
||||
priv->current = (priv->current + 1) % FRAME_HISTORY_MAX_LENGTH;
|
||||
|
||||
if (G_UNLIKELY (timings_get_size (&priv->timings) == 0))
|
||||
timings_append (&priv->timings, _gdk_frame_timings_new (priv->frame_counter));
|
||||
/* Try to steal the previous frame timing instead of discarding
|
||||
* and allocating a new one.
|
||||
*/
|
||||
if G_LIKELY (priv->n_timings == FRAME_HISTORY_MAX_LENGTH &&
|
||||
_gdk_frame_timings_steal (priv->timings[priv->current],
|
||||
priv->frame_counter))
|
||||
return;
|
||||
|
||||
if (priv->n_timings < FRAME_HISTORY_MAX_LENGTH)
|
||||
priv->n_timings++;
|
||||
else
|
||||
{
|
||||
GdkFrameTimings *timings;
|
||||
gdk_frame_timings_unref (priv->timings[priv->current]);
|
||||
|
||||
priv->current = (priv->current + 1) % timings_get_size (&priv->timings);
|
||||
|
||||
timings = timings_get (&priv->timings, priv->current);
|
||||
|
||||
if (timings->frame_time + G_USEC_PER_SEC > monotonic_time)
|
||||
{
|
||||
/* Keep the timings, not a second old yet */
|
||||
timings = _gdk_frame_timings_new (priv->frame_counter);
|
||||
timings_splice (&priv->timings, priv->current, 0, FALSE, &timings, 1);
|
||||
}
|
||||
else if (_gdk_frame_timings_steal (timings, priv->frame_counter))
|
||||
{
|
||||
/* Stole the previous frame timing instead of discarding
|
||||
* and allocating a new one, so nothing to do
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
timings = _gdk_frame_timings_new (priv->frame_counter);
|
||||
timings_splice (&priv->timings, priv->current, 1, FALSE, &timings, 1);
|
||||
}
|
||||
}
|
||||
priv->timings[priv->current] = _gdk_frame_timings_new (priv->frame_counter);
|
||||
}
|
||||
|
||||
static inline GdkFrameTimings *
|
||||
@@ -497,21 +477,17 @@ _gdk_frame_clock_get_timings (GdkFrameClock *frame_clock,
|
||||
gint64 frame_counter)
|
||||
{
|
||||
GdkFrameClockPrivate *priv = frame_clock->priv;
|
||||
gsize size, pos;
|
||||
int pos;
|
||||
|
||||
if (frame_counter > priv->frame_counter)
|
||||
return NULL;
|
||||
|
||||
size = timings_get_size (&priv->timings);
|
||||
if (G_UNLIKELY (size == 0))
|
||||
if (frame_counter <= priv->frame_counter - priv->n_timings)
|
||||
return NULL;
|
||||
|
||||
if (priv->frame_counter - frame_counter >= size)
|
||||
return NULL;
|
||||
pos = (priv->current - (priv->frame_counter - frame_counter) + FRAME_HISTORY_MAX_LENGTH) % FRAME_HISTORY_MAX_LENGTH;
|
||||
|
||||
pos = (priv->current - (priv->frame_counter - frame_counter) + size) % size;
|
||||
|
||||
return timings_get (&priv->timings, pos);
|
||||
return priv->timings[pos];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -711,7 +687,7 @@ _gdk_frame_clock_emit_update (GdkFrameClock *frame_clock)
|
||||
|
||||
g_signal_emit (frame_clock, signals[UPDATE], 0);
|
||||
|
||||
gdk_profiler_end_mark (before, "Frameclock update", NULL);
|
||||
gdk_profiler_end_mark (before, "frameclock update", NULL);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -723,7 +699,7 @@ _gdk_frame_clock_emit_layout (GdkFrameClock *frame_clock)
|
||||
|
||||
g_signal_emit (frame_clock, signals[LAYOUT], 0);
|
||||
|
||||
gdk_profiler_end_mark (before, "Frameclock layout", NULL);
|
||||
gdk_profiler_end_mark (before, "frameclock layout", NULL);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -735,7 +711,7 @@ _gdk_frame_clock_emit_paint (GdkFrameClock *frame_clock)
|
||||
|
||||
g_signal_emit (frame_clock, signals[PAINT], 0);
|
||||
|
||||
gdk_profiler_end_mark (before, "Frameclock paint", NULL);
|
||||
gdk_profiler_end_mark (before, "frameclock paint", NULL);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -803,10 +779,7 @@ gdk_frame_clock_get_fps (GdkFrameClock *frame_clock)
|
||||
|
||||
start_counter = _gdk_frame_clock_get_history_start (frame_clock);
|
||||
end_counter = _gdk_frame_clock_get_frame_counter (frame_clock);
|
||||
for (start = _gdk_frame_clock_get_timings (frame_clock, start_counter);
|
||||
end_counter > start_counter && start != NULL && !gdk_frame_timings_get_complete (start);
|
||||
start = _gdk_frame_clock_get_timings (frame_clock, start_counter))
|
||||
start_counter++;
|
||||
start = _gdk_frame_clock_get_timings (frame_clock, start_counter);
|
||||
for (end = _gdk_frame_clock_get_timings (frame_clock, end_counter);
|
||||
end_counter > start_counter && end != NULL && !gdk_frame_timings_get_complete (end);
|
||||
end = _gdk_frame_clock_get_timings (frame_clock, end_counter))
|
||||
@@ -838,12 +811,12 @@ _gdk_frame_clock_add_timings_to_profiler (GdkFrameClock *clock,
|
||||
{
|
||||
if (timings->drawn_time != 0)
|
||||
{
|
||||
gdk_profiler_add_mark (1000 * timings->drawn_time, 0, "Drawn window", NULL);
|
||||
gdk_profiler_add_mark (1000 * timings->drawn_time, 0, "drawn window", NULL);
|
||||
}
|
||||
|
||||
if (timings->presentation_time != 0)
|
||||
{
|
||||
gdk_profiler_add_mark (1000 * timings->presentation_time, 0, "Presented window", NULL);
|
||||
gdk_profiler_add_mark (1000 * timings->presentation_time, 0, "presented window", NULL);
|
||||
}
|
||||
|
||||
gdk_profiler_set_counter (fps_counter, gdk_frame_clock_get_fps (clock));
|
||||
|
||||
@@ -192,13 +192,6 @@ compute_smooth_frame_time (GdkFrameClock *clock,
|
||||
* and new_frame_time >= old_frame_time. */
|
||||
frames_passed = (new_frame_time - smoothed_frame_time_base + frame_interval / 2) / frame_interval;
|
||||
|
||||
if (frames_passed > 1)
|
||||
gdk_profiler_add_markf ((smoothed_frame_time_base - (frame_interval * (frames_passed-1))) * 1000L,
|
||||
frame_interval * (frames_passed-1) * 1000L,
|
||||
"Dropped Frames",
|
||||
"%u frames may have been dropped",
|
||||
frames_passed-1);
|
||||
|
||||
/* We use an approximately whole number of frames in the future from
|
||||
* last smoothed frame time. This way we avoid minor jitter in the
|
||||
* frame times making the animation speed uneven, but still animate
|
||||
@@ -555,7 +548,7 @@ gdk_frame_clock_paint_idle (void *data)
|
||||
priv->smoothed_frame_time_period = frame_interval;
|
||||
priv->smoothed_frame_time_reported = priv->smoothed_frame_time_base;
|
||||
|
||||
_gdk_frame_clock_begin_frame (clock, priv->frame_time);
|
||||
_gdk_frame_clock_begin_frame (clock);
|
||||
/* Note "current" is different now so timings != prev_timings */
|
||||
timings = gdk_frame_clock_get_current_timings (clock);
|
||||
|
||||
@@ -701,7 +694,7 @@ gdk_frame_clock_paint_idle (void *data)
|
||||
if (!gdk_frame_clock_idle_is_frozen (clock_idle))
|
||||
priv->sleep_serial = get_sleep_serial ();
|
||||
|
||||
gdk_profiler_end_mark (before, "Frameclock cycle", NULL);
|
||||
gdk_profiler_end_mark (before, "frameclock cycle", NULL);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -106,8 +106,7 @@ struct _GdkFrameTimings
|
||||
void _gdk_frame_clock_inhibit_freeze (GdkFrameClock *clock);
|
||||
void _gdk_frame_clock_uninhibit_freeze (GdkFrameClock *clock);
|
||||
|
||||
void _gdk_frame_clock_begin_frame (GdkFrameClock *clock,
|
||||
gint64 monotonic_time);
|
||||
void _gdk_frame_clock_begin_frame (GdkFrameClock *clock);
|
||||
void _gdk_frame_clock_debug_print_timings (GdkFrameClock *clock,
|
||||
GdkFrameTimings *timings);
|
||||
void _gdk_frame_clock_add_timings_to_profiler (GdkFrameClock *frame_clock,
|
||||
|
||||
@@ -79,7 +79,6 @@
|
||||
#include "gdkdebugprivate.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkdmabufeglprivate.h"
|
||||
#include "gdkdmabuffourccprivate.h"
|
||||
#include "gdkmemoryformatprivate.h"
|
||||
#include "gdkmemorytextureprivate.h"
|
||||
#include "gdkprofilerprivate.h"
|
||||
@@ -99,6 +98,10 @@
|
||||
#include <epoxy/egl.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DMABUF
|
||||
#include <drm_fourcc.h>
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#define DEFAULT_ALLOWED_APIS GDK_GL_API_GL | GDK_GL_API_GLES
|
||||
@@ -383,7 +386,7 @@ gdk_gl_context_create_egl_context (GdkGLContext *context,
|
||||
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, "Create EGL context", NULL);
|
||||
gdk_profiler_end_mark (start_time, "realize GdkWaylandGLContext", NULL);
|
||||
|
||||
return api;
|
||||
}
|
||||
@@ -590,7 +593,7 @@ gdk_gl_context_get_scale (GdkGLContext *self)
|
||||
scale = gdk_surface_get_scale (surface);
|
||||
|
||||
display = gdk_gl_context_get_display (self);
|
||||
if (gdk_display_get_debug_flags (display) & GDK_DEBUG_GL_NO_FRACTIONAL)
|
||||
if (!(gdk_display_get_debug_flags (display) & GDK_DEBUG_GL_FRACTIONAL))
|
||||
scale = ceil (scale);
|
||||
|
||||
return scale;
|
||||
@@ -658,7 +661,6 @@ gdk_gl_context_real_end_frame (GdkDrawContext *draw_context,
|
||||
GdkSurface *surface = gdk_gl_context_get_surface (context);
|
||||
GdkDisplay *display = gdk_surface_get_display (surface);
|
||||
EGLSurface egl_surface;
|
||||
G_GNUC_UNUSED gint64 begin_time = GDK_PROFILER_CURRENT_TIME;
|
||||
|
||||
if (priv->egl_context == NULL)
|
||||
return;
|
||||
@@ -667,6 +669,8 @@ gdk_gl_context_real_end_frame (GdkDrawContext *draw_context,
|
||||
|
||||
egl_surface = gdk_surface_get_egl_surface (surface);
|
||||
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "EGL", "swap buffers");
|
||||
|
||||
if (priv->eglSwapBuffersWithDamage)
|
||||
{
|
||||
EGLint stack_rects[4 * 4]; /* 4 rects */
|
||||
@@ -697,8 +701,6 @@ gdk_gl_context_real_end_frame (GdkDrawContext *draw_context,
|
||||
else
|
||||
eglSwapBuffers (gdk_display_get_egl_display (display), egl_surface);
|
||||
#endif
|
||||
|
||||
gdk_profiler_add_mark (begin_time, GDK_PROFILER_CURRENT_TIME - begin_time, "EGL swap buffers", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1716,7 +1718,7 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
|
||||
}
|
||||
|
||||
priv->has_half_float = gdk_gl_context_check_version (context, "3.0", "3.0") ||
|
||||
epoxy_has_gl_extension ("GL_OES_vertex_half_float");
|
||||
epoxy_has_gl_extension ("OES_vertex_half_float");
|
||||
|
||||
priv->has_sync = gdk_gl_context_check_version (context, "3.2", "3.0") ||
|
||||
epoxy_has_gl_extension ("GL_ARB_sync") ||
|
||||
@@ -2040,6 +2042,15 @@ gdk_gl_context_has_sync (GdkGLContext *self)
|
||||
return priv->has_sync;
|
||||
}
|
||||
|
||||
/* Return if GL_BGRA works with glTexImage2D */
|
||||
gboolean
|
||||
gdk_gl_context_has_bgra (GdkGLContext *self)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self);
|
||||
|
||||
return priv->has_bgra;
|
||||
}
|
||||
|
||||
/* Return if glGenVertexArrays, glBindVertexArray and glDeleteVertexArrays
|
||||
* can be used
|
||||
*/
|
||||
|
||||
@@ -171,6 +171,8 @@ gboolean gdk_gl_context_has_vertex_half_float (GdkGLContext
|
||||
|
||||
gboolean gdk_gl_context_has_sync (GdkGLContext *self) G_GNUC_PURE;
|
||||
|
||||
gboolean gdk_gl_context_has_bgra (GdkGLContext *self) G_GNUC_PURE;
|
||||
|
||||
gboolean gdk_gl_context_has_vertex_arrays (GdkGLContext *self) G_GNUC_PURE;
|
||||
|
||||
double gdk_gl_context_get_scale (GdkGLContext *self);
|
||||
|
||||
@@ -161,12 +161,7 @@ gdk_gl_texture_find_format (GdkGLContext *context,
|
||||
if (!(gdk_gl_context_get_format_flags (context, format) & GDK_GL_FORMAT_RENDERABLE))
|
||||
continue;
|
||||
|
||||
gdk_memory_format_gl_format (format,
|
||||
gdk_gl_context_get_use_es (context),
|
||||
&q_internal_format,
|
||||
&q_format,
|
||||
&q_type,
|
||||
q_swizzle);
|
||||
gdk_memory_format_gl_format (format, &q_internal_format, &q_format, &q_type, q_swizzle);
|
||||
|
||||
if (q_format != gl_format || q_type != gl_type)
|
||||
continue;
|
||||
@@ -198,7 +193,6 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
|
||||
((gdk_gl_context_get_format_flags (context, format) & GDK_GL_FORMAT_USABLE) == GDK_GL_FORMAT_USABLE))
|
||||
{
|
||||
gdk_memory_format_gl_format (format,
|
||||
gdk_gl_context_get_use_es (context),
|
||||
&gl_internal_format,
|
||||
&gl_format, &gl_type, gl_swizzle);
|
||||
if (download->stride == expected_stride &&
|
||||
@@ -261,7 +255,6 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
|
||||
actual_format = gdk_memory_format_get_straight (actual_format);
|
||||
|
||||
gdk_memory_format_gl_format (actual_format,
|
||||
gdk_gl_context_get_use_es (context),
|
||||
&gl_internal_format,
|
||||
&gl_read_format, &gl_read_type, gl_swizzle);
|
||||
}
|
||||
@@ -273,7 +266,6 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
|
||||
actual_format = gdk_memory_format_get_straight (actual_format);
|
||||
|
||||
gdk_memory_format_gl_format (actual_format,
|
||||
gdk_gl_context_get_use_es (context),
|
||||
&gl_internal_format,
|
||||
&gl_read_format, &gl_read_type, gl_swizzle);
|
||||
}
|
||||
|
||||
@@ -335,8 +335,7 @@ struct _GdkMemoryFormatDescription
|
||||
GdkMemoryDepth depth;
|
||||
const GdkMemoryFormat *fallbacks;
|
||||
struct {
|
||||
GLint internal_gl_format;
|
||||
GLint internal_gles_format;
|
||||
GLint internal_format;
|
||||
GLenum format;
|
||||
GLenum type;
|
||||
GLint swizzle[4];
|
||||
@@ -376,8 +375,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_BGRA,
|
||||
.internal_format = GL_RGBA8,
|
||||
.format = GL_BGRA,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -404,8 +402,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.internal_format = GL_RGBA8,
|
||||
.format = GL_BGRA,
|
||||
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -432,8 +429,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.internal_format = GL_RGBA8,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -459,8 +455,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.internal_format = GL_RGBA8,
|
||||
.format = GL_RGBA,
|
||||
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -487,8 +482,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_BGRA,
|
||||
.internal_format = GL_RGBA8,
|
||||
.format = GL_BGRA,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -515,8 +509,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.internal_format = GL_RGBA8,
|
||||
.format = GL_BGRA,
|
||||
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -543,8 +536,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.internal_format = GL_RGBA8,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -570,8 +562,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.internal_format = GL_RGBA8,
|
||||
.format = GL_RGBA,
|
||||
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -599,8 +590,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_BGRA,
|
||||
.internal_format = GL_RGBA8,
|
||||
.format = GL_BGRA,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ONE },
|
||||
@@ -628,8 +618,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.internal_format = GL_RGBA8,
|
||||
.format = GL_BGRA,
|
||||
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ONE },
|
||||
@@ -657,8 +646,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.internal_format = GL_RGBA8,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ONE },
|
||||
@@ -685,8 +673,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.internal_format = GL_RGBA8,
|
||||
.format = GL_RGBA,
|
||||
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ONE },
|
||||
@@ -714,8 +701,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGB8,
|
||||
.internal_gles_format = GL_RGB8,
|
||||
.internal_format = GL_RGB8,
|
||||
.format = GL_RGB,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -742,8 +728,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGB8,
|
||||
.internal_gles_format = GL_RGB8,
|
||||
.internal_format = GL_RGB8,
|
||||
.format = GL_BGR,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -774,8 +759,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGB16,
|
||||
.internal_gles_format = GL_RGB16,
|
||||
.internal_format = GL_RGB16,
|
||||
.format = GL_RGB,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -804,8 +788,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA16,
|
||||
.internal_gles_format = GL_RGBA16,
|
||||
.internal_format = GL_RGBA16,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -834,8 +817,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA16,
|
||||
.internal_gles_format = GL_RGBA16,
|
||||
.internal_format = GL_RGBA16,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -864,8 +846,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGB16F,
|
||||
.internal_gles_format = GL_RGB16F,
|
||||
.internal_format = GL_RGB16F,
|
||||
.format = GL_RGB,
|
||||
.type = GL_HALF_FLOAT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -893,8 +874,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA16F,
|
||||
.internal_gles_format = GL_RGBA16F,
|
||||
.internal_format = GL_RGBA16F,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_HALF_FLOAT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -922,8 +902,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA16F,
|
||||
.internal_gles_format = GL_RGBA16F,
|
||||
.internal_format = GL_RGBA16F,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_HALF_FLOAT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -952,8 +931,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGB32F,
|
||||
.internal_gles_format = GL_RGB32F,
|
||||
.internal_format = GL_RGB32F,
|
||||
.format = GL_RGB,
|
||||
.type = GL_FLOAT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -981,8 +959,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA32F,
|
||||
.internal_gles_format = GL_RGBA32F,
|
||||
.internal_format = GL_RGBA32F,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_FLOAT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -1010,8 +987,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA32F,
|
||||
.internal_gles_format = GL_RGBA32F,
|
||||
.internal_format = GL_RGBA32F,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_FLOAT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -1038,8 +1014,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RG8,
|
||||
.internal_gles_format = GL_RG8,
|
||||
.internal_format = GL_RG8,
|
||||
.format = GL_RG,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_GREEN },
|
||||
@@ -1066,8 +1041,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RG8,
|
||||
.internal_gles_format = GL_RG8,
|
||||
.internal_format = GL_RG8,
|
||||
.format = GL_RG,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_GREEN },
|
||||
@@ -1094,8 +1068,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_gl_format = GL_R8,
|
||||
.internal_gles_format = GL_R8,
|
||||
.internal_format = GL_R8,
|
||||
.format = GL_RED,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_ONE },
|
||||
@@ -1125,8 +1098,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RG16,
|
||||
.internal_gles_format = GL_RG16,
|
||||
.internal_format = GL_RG16,
|
||||
.format = GL_RG,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_GREEN },
|
||||
@@ -1156,8 +1128,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RG16,
|
||||
.internal_gles_format = GL_RG16,
|
||||
.internal_format = GL_RG16,
|
||||
.format = GL_RG,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_GREEN },
|
||||
@@ -1187,8 +1158,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_gl_format = GL_R16,
|
||||
.internal_gles_format = GL_R16,
|
||||
.internal_format = GL_R16,
|
||||
.format = GL_RED,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_ONE },
|
||||
@@ -1215,8 +1185,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_gl_format = GL_R8,
|
||||
.internal_gles_format = GL_R8,
|
||||
.internal_format = GL_R8,
|
||||
.format = GL_RED,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_RED },
|
||||
@@ -1246,8 +1215,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_gl_format = GL_R16,
|
||||
.internal_gles_format = GL_R16,
|
||||
.internal_format = GL_R16,
|
||||
.format = GL_RED,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_RED },
|
||||
@@ -1276,8 +1244,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_gl_format = GL_R16F,
|
||||
.internal_gles_format = GL_R16F,
|
||||
.internal_format = GL_R16F,
|
||||
.format = GL_RED,
|
||||
.type = GL_HALF_FLOAT,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_RED },
|
||||
@@ -1306,8 +1273,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_gl_format = GL_R32F,
|
||||
.internal_gles_format = GL_R32F,
|
||||
.internal_format = GL_R32F,
|
||||
.format = GL_RED,
|
||||
.type = GL_FLOAT,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_RED },
|
||||
@@ -1507,16 +1473,12 @@ gdk_memory_depth_get_alpha_format (GdkMemoryDepth depth)
|
||||
|
||||
void
|
||||
gdk_memory_format_gl_format (GdkMemoryFormat format,
|
||||
gboolean gles,
|
||||
GLint *out_internal_format,
|
||||
GLenum *out_format,
|
||||
GLenum *out_type,
|
||||
GLint out_swizzle[4])
|
||||
{
|
||||
if (gles)
|
||||
*out_internal_format = memory_formats[format].gl.internal_gles_format;
|
||||
else
|
||||
*out_internal_format = memory_formats[format].gl.internal_gl_format;
|
||||
*out_internal_format = memory_formats[format].gl.internal_format;
|
||||
*out_format = memory_formats[format].gl.format;
|
||||
*out_type = memory_formats[format].gl.type;
|
||||
memcpy (out_swizzle, memory_formats[format].gl.swizzle, sizeof(GLint) * 4);
|
||||
@@ -1525,7 +1487,6 @@ gdk_memory_format_gl_format (GdkMemoryFormat format,
|
||||
/*
|
||||
* gdk_memory_format_gl_rgba_format:
|
||||
* @format: The format to query
|
||||
* @gles: TRUE for GLES, FALSE for GL
|
||||
* @out_actual_format: The actual RGBA format
|
||||
* @out_internal_format: the GL internal format
|
||||
* @out_format: the GL format
|
||||
@@ -1543,7 +1504,6 @@ gdk_memory_format_gl_format (GdkMemoryFormat format,
|
||||
**/
|
||||
gboolean
|
||||
gdk_memory_format_gl_rgba_format (GdkMemoryFormat format,
|
||||
gboolean gles,
|
||||
GdkMemoryFormat *out_actual_format,
|
||||
GLint *out_internal_format,
|
||||
GLenum *out_format,
|
||||
@@ -1556,10 +1516,7 @@ gdk_memory_format_gl_rgba_format (GdkMemoryFormat format,
|
||||
return FALSE;
|
||||
|
||||
*out_actual_format = actual;
|
||||
if (gles)
|
||||
*out_internal_format = memory_formats[actual].gl.internal_gles_format;
|
||||
else
|
||||
*out_internal_format = memory_formats[actual].gl.internal_gl_format;
|
||||
*out_internal_format = memory_formats[actual].gl.internal_format;
|
||||
*out_format = memory_formats[actual].gl.format;
|
||||
*out_type = memory_formats[actual].gl.type;
|
||||
memcpy (out_swizzle, memory_formats[format].gl.rgba_swizzle, sizeof(GLint) * 4);
|
||||
|
||||
@@ -55,13 +55,11 @@ GdkMemoryDepth gdk_memory_depth_merge (GdkMemoryDepth
|
||||
GdkMemoryFormat gdk_memory_depth_get_format (GdkMemoryDepth depth) G_GNUC_CONST;
|
||||
GdkMemoryFormat gdk_memory_depth_get_alpha_format (GdkMemoryDepth depth) G_GNUC_CONST;
|
||||
void gdk_memory_format_gl_format (GdkMemoryFormat format,
|
||||
gboolean gles,
|
||||
GLint *out_internal_format,
|
||||
GLenum *out_format,
|
||||
GLenum *out_type,
|
||||
GLint out_swizzle[4]);
|
||||
gboolean gdk_memory_format_gl_rgba_format (GdkMemoryFormat format,
|
||||
gboolean gles,
|
||||
GdkMemoryFormat *out_actual_format,
|
||||
GLint *out_internal_format,
|
||||
GLenum *out_format,
|
||||
|
||||
@@ -26,8 +26,6 @@
|
||||
#include "gdkenumtypes.h"
|
||||
#include "gdkrectangle.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
/**
|
||||
* GdkMonitor:
|
||||
*
|
||||
@@ -48,7 +46,6 @@ enum {
|
||||
PROP_MODEL,
|
||||
PROP_CONNECTOR,
|
||||
PROP_SCALE_FACTOR,
|
||||
PROP_SCALE,
|
||||
PROP_GEOMETRY,
|
||||
PROP_WIDTH_MM,
|
||||
PROP_HEIGHT_MM,
|
||||
@@ -73,8 +70,6 @@ static void
|
||||
gdk_monitor_init (GdkMonitor *monitor)
|
||||
{
|
||||
monitor->scale_factor = 1;
|
||||
monitor->scale = 1.0;
|
||||
monitor->scale_set = FALSE;
|
||||
monitor->valid = TRUE;
|
||||
}
|
||||
|
||||
@@ -112,10 +107,6 @@ gdk_monitor_get_property (GObject *object,
|
||||
g_value_set_int (value, monitor->scale_factor);
|
||||
break;
|
||||
|
||||
case PROP_SCALE:
|
||||
g_value_set_double (value, monitor->scale);
|
||||
break;
|
||||
|
||||
case PROP_GEOMETRY:
|
||||
g_value_set_boxed (value, &monitor->geometry);
|
||||
break;
|
||||
@@ -242,28 +233,13 @@ gdk_monitor_class_init (GdkMonitorClass *class)
|
||||
* GdkMonitor:scale-factor: (attributes org.gtk.Property.get=gdk_monitor_get_scale_factor)
|
||||
*
|
||||
* The scale factor.
|
||||
*
|
||||
* The scale factor is the next larger integer,
|
||||
* compared to [property@Gdk.Surface:scale].
|
||||
*/
|
||||
props[PROP_SCALE_FACTOR] =
|
||||
g_param_spec_int ("scale-factor", NULL, NULL,
|
||||
1, G_MAXINT,
|
||||
0, G_MAXINT,
|
||||
1,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkMonitor:scale: (attributes org.gtk.Property.get=gdk_monitor_get_scale)
|
||||
*
|
||||
* The scale of the monitor.
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
props[PROP_SCALE] =
|
||||
g_param_spec_double ("scale", NULL, NULL,
|
||||
1., G_MAXDOUBLE, 1.,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkMonitor:geometry: (attributes org.gtk.Property.get=gdk_monitor_get_geometry)
|
||||
*
|
||||
@@ -370,7 +346,7 @@ gdk_monitor_get_display (GdkMonitor *monitor)
|
||||
* display coordinate space.
|
||||
*
|
||||
* The returned geometry is in ”application pixels”, not in
|
||||
* ”device pixels” (see [method@Gdk.Monitor.get_scale]).
|
||||
* ”device pixels” (see [method@Gdk.Monitor.get_scale_factor]).
|
||||
*/
|
||||
void
|
||||
gdk_monitor_get_geometry (GdkMonitor *monitor,
|
||||
@@ -496,29 +472,6 @@ gdk_monitor_get_scale_factor (GdkMonitor *monitor)
|
||||
return monitor->scale_factor;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_monitor_get_scale: (attributes org.gtk.Method.get_property=scale)
|
||||
* @monitor: a `GdkMonitor`
|
||||
*
|
||||
* Gets the internal scale factor that maps from monitor coordinates
|
||||
* to device pixels.
|
||||
*
|
||||
* This can be used if you want to create pixel based data for a
|
||||
* particular monitor, but most of the time you’re drawing to a surface
|
||||
* where it is better to use [method@Gdk.Surface.get_scale] instead.
|
||||
*
|
||||
* Returns: the scale
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
double
|
||||
gdk_monitor_get_scale (GdkMonitor *monitor)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_MONITOR (monitor), 1.);
|
||||
|
||||
return monitor->scale;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_monitor_get_refresh_rate: (attributes org.gtk.Method.get_property=refresh-rate)
|
||||
* @monitor: a `GdkMonitor`
|
||||
@@ -630,37 +583,12 @@ void
|
||||
gdk_monitor_set_scale_factor (GdkMonitor *monitor,
|
||||
int scale_factor)
|
||||
{
|
||||
g_return_if_fail (scale_factor >= 1);
|
||||
|
||||
if (monitor->scale_set)
|
||||
return;
|
||||
|
||||
if (monitor->scale_factor == scale_factor)
|
||||
return;
|
||||
|
||||
monitor->scale_factor = scale_factor;
|
||||
monitor->scale = scale_factor;
|
||||
|
||||
g_object_notify (G_OBJECT (monitor), "scale-factor");
|
||||
g_object_notify (G_OBJECT (monitor), "scale");
|
||||
}
|
||||
|
||||
void
|
||||
gdk_monitor_set_scale (GdkMonitor *monitor,
|
||||
double scale)
|
||||
{
|
||||
g_return_if_fail (scale >= 1.);
|
||||
|
||||
monitor->scale_set = TRUE;
|
||||
|
||||
if (monitor->scale == scale)
|
||||
return;
|
||||
|
||||
monitor->scale = scale;
|
||||
monitor->scale_factor = (int) ceil (scale);
|
||||
|
||||
g_object_notify (G_OBJECT (monitor), "scale");
|
||||
g_object_notify (G_OBJECT (monitor), "scale-factor");
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -77,8 +77,6 @@ GDK_AVAILABLE_IN_ALL
|
||||
const char * gdk_monitor_get_connector (GdkMonitor *monitor);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
int gdk_monitor_get_scale_factor (GdkMonitor *monitor);
|
||||
GDK_AVAILABLE_IN_4_14
|
||||
double gdk_monitor_get_scale (GdkMonitor *monitor);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
int gdk_monitor_get_refresh_rate (GdkMonitor *monitor);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
||||
@@ -44,8 +44,6 @@ struct _GdkMonitor {
|
||||
int refresh_rate;
|
||||
GdkSubpixelLayout subpixel_layout;
|
||||
gboolean valid;
|
||||
double scale;
|
||||
gboolean scale_set;
|
||||
};
|
||||
|
||||
struct _GdkMonitorClass {
|
||||
@@ -66,9 +64,7 @@ void gdk_monitor_set_physical_size (GdkMonitor *monitor,
|
||||
int width_mm,
|
||||
int height_mm);
|
||||
void gdk_monitor_set_scale_factor (GdkMonitor *monitor,
|
||||
int scale_factor);
|
||||
void gdk_monitor_set_scale (GdkMonitor *monitor,
|
||||
double scale);
|
||||
int scale);
|
||||
void gdk_monitor_set_refresh_rate (GdkMonitor *monitor,
|
||||
int refresh_rate);
|
||||
void gdk_monitor_set_subpixel_layout (GdkMonitor *monitor,
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include "version/gdkversionmacros.h"
|
||||
#include "gdkframeclockprivate.h"
|
||||
|
||||
#define CATEGORY "GTK"
|
||||
|
||||
gboolean
|
||||
gdk_profiler_is_running (void)
|
||||
@@ -51,7 +50,7 @@ void
|
||||
const char *message)
|
||||
{
|
||||
#ifdef HAVE_SYSPROF
|
||||
sysprof_collector_mark (begin_time, duration, CATEGORY, name, message);
|
||||
sysprof_collector_mark (begin_time, duration, "gtk", name, message);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -61,7 +60,7 @@ void
|
||||
const char *message)
|
||||
{
|
||||
#ifdef HAVE_SYSPROF
|
||||
sysprof_collector_mark (begin_time, GDK_PROFILER_CURRENT_TIME - begin_time, CATEGORY, name, message);
|
||||
sysprof_collector_mark (begin_time, GDK_PROFILER_CURRENT_TIME - begin_time, "gtk", name, message);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -75,7 +74,7 @@ void
|
||||
#ifdef HAVE_SYSPROF
|
||||
va_list args;
|
||||
va_start (args, message_format);
|
||||
sysprof_collector_mark_vprintf (begin_time, duration, CATEGORY, name, message_format, args);
|
||||
sysprof_collector_mark_vprintf (begin_time, duration, "gtk", name, message_format, args);
|
||||
va_end (args);
|
||||
#endif /* HAVE_SYSPROF */
|
||||
}
|
||||
@@ -89,7 +88,7 @@ void
|
||||
#ifdef HAVE_SYSPROF
|
||||
va_list args;
|
||||
va_start (args, message_format);
|
||||
sysprof_collector_mark_vprintf (begin_time, GDK_PROFILER_CURRENT_TIME - begin_time, CATEGORY, name, message_format, args);
|
||||
sysprof_collector_mark_vprintf (begin_time, GDK_PROFILER_CURRENT_TIME - begin_time, "gtk", name, message_format, args);
|
||||
va_end (args);
|
||||
#endif /* HAVE_SYSPROF */
|
||||
}
|
||||
@@ -104,7 +103,7 @@ guint
|
||||
counter.id = sysprof_collector_request_counters (1);
|
||||
counter.type = SYSPROF_CAPTURE_COUNTER_DOUBLE;
|
||||
counter.value.vdbl = 0.0;
|
||||
g_strlcpy (counter.category, CATEGORY, sizeof counter.category);
|
||||
g_strlcpy (counter.category, "gtk", sizeof counter.category);
|
||||
g_strlcpy (counter.name, name, sizeof counter.name);
|
||||
g_strlcpy (counter.description, description, sizeof counter.name);
|
||||
|
||||
@@ -126,7 +125,7 @@ guint
|
||||
counter.id = sysprof_collector_request_counters (1);
|
||||
counter.type = SYSPROF_CAPTURE_COUNTER_INT64;
|
||||
counter.value.v64 = 0;
|
||||
g_strlcpy (counter.category, CATEGORY, sizeof counter.category);
|
||||
g_strlcpy (counter.category, "gtk", sizeof counter.category);
|
||||
g_strlcpy (counter.name, name, sizeof counter.name);
|
||||
g_strlcpy (counter.description, description, sizeof counter.name);
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "gdksubsurfaceprivate.h"
|
||||
#include "gdksurfaceprivate.h"
|
||||
#include "gdktexture.h"
|
||||
#include "gsk/gskrectprivate.h"
|
||||
|
||||
G_DEFINE_TYPE (GdkSubsurface, gdk_subsurface, G_TYPE_OBJECT)
|
||||
|
||||
@@ -56,106 +55,19 @@ gdk_subsurface_get_parent (GdkSubsurface *subsurface)
|
||||
return subsurface->parent;
|
||||
}
|
||||
|
||||
static void
|
||||
remove_subsurface (GdkSubsurface *subsurface)
|
||||
{
|
||||
GdkSurface *parent = subsurface->parent;
|
||||
|
||||
if (parent->subsurfaces_above == subsurface)
|
||||
parent->subsurfaces_above = subsurface->sibling_above;
|
||||
if (parent->subsurfaces_below == subsurface)
|
||||
parent->subsurfaces_below = subsurface->sibling_below;
|
||||
|
||||
if (subsurface->sibling_above)
|
||||
subsurface->sibling_above->sibling_below = subsurface->sibling_below;
|
||||
if (subsurface->sibling_below)
|
||||
subsurface->sibling_below->sibling_above = subsurface->sibling_above;
|
||||
|
||||
subsurface->sibling_above = NULL;
|
||||
subsurface->sibling_below = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
insert_subsurface (GdkSubsurface *subsurface,
|
||||
gboolean above,
|
||||
GdkSubsurface *sibling)
|
||||
{
|
||||
GdkSurface *parent = subsurface->parent;
|
||||
|
||||
subsurface->above_parent = sibling->above_parent;
|
||||
|
||||
if (above)
|
||||
{
|
||||
subsurface->sibling_above = sibling->sibling_above;
|
||||
sibling->sibling_above = subsurface;
|
||||
subsurface->sibling_below = sibling;
|
||||
if (subsurface->sibling_above)
|
||||
subsurface->sibling_above->sibling_below = subsurface;
|
||||
|
||||
if (parent->subsurfaces_below == sibling)
|
||||
parent->subsurfaces_below = subsurface;
|
||||
}
|
||||
else
|
||||
{
|
||||
subsurface->sibling_below = sibling->sibling_below;
|
||||
sibling->sibling_below = subsurface;
|
||||
subsurface->sibling_above = sibling;
|
||||
if (subsurface->sibling_below)
|
||||
subsurface->sibling_below->sibling_above = subsurface;
|
||||
|
||||
if (parent->subsurfaces_above == sibling)
|
||||
parent->subsurfaces_above = subsurface;
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_subsurface_attach (GdkSubsurface *subsurface,
|
||||
GdkTexture *texture,
|
||||
const graphene_rect_t *source,
|
||||
const graphene_rect_t *dest,
|
||||
const graphene_rect_t *rect,
|
||||
gboolean above,
|
||||
GdkSubsurface *sibling)
|
||||
{
|
||||
GdkSurface *parent = subsurface->parent;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), FALSE);
|
||||
g_return_val_if_fail (GDK_IS_TEXTURE (texture), FALSE);
|
||||
g_return_val_if_fail (source != NULL &&
|
||||
gsk_rect_contains_rect (&GRAPHENE_RECT_INIT (0, 0,
|
||||
gdk_texture_get_width (texture),
|
||||
gdk_texture_get_height (texture)),
|
||||
source), FALSE);
|
||||
g_return_val_if_fail (dest != NULL, FALSE);
|
||||
g_return_val_if_fail (sibling != subsurface, FALSE);
|
||||
g_return_val_if_fail (rect != NULL, FALSE);
|
||||
g_return_val_if_fail (sibling == NULL || GDK_IS_SUBSURFACE (sibling), FALSE);
|
||||
g_return_val_if_fail (sibling == NULL || sibling->parent == subsurface->parent, FALSE);
|
||||
|
||||
remove_subsurface (subsurface);
|
||||
|
||||
if (sibling)
|
||||
{
|
||||
insert_subsurface (subsurface, above, sibling);
|
||||
}
|
||||
else
|
||||
{
|
||||
sibling = above ? parent->subsurfaces_above : parent->subsurfaces_below;
|
||||
|
||||
if (sibling)
|
||||
{
|
||||
insert_subsurface (subsurface, !above, sibling);
|
||||
}
|
||||
else
|
||||
{
|
||||
subsurface->above_parent = above;
|
||||
|
||||
if (above)
|
||||
parent->subsurfaces_above = subsurface;
|
||||
else
|
||||
parent->subsurfaces_below = subsurface;
|
||||
}
|
||||
}
|
||||
|
||||
return GDK_SUBSURFACE_GET_CLASS (subsurface)->attach (subsurface, texture, source, dest, above, sibling);
|
||||
return GDK_SUBSURFACE_GET_CLASS (subsurface)->attach (subsurface, texture, rect, above, sibling);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -163,8 +75,6 @@ gdk_subsurface_detach (GdkSubsurface *subsurface)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_SUBSURFACE (subsurface));
|
||||
|
||||
remove_subsurface (subsurface);
|
||||
|
||||
GDK_SUBSURFACE_GET_CLASS (subsurface)->detach (subsurface);
|
||||
}
|
||||
|
||||
@@ -177,23 +87,13 @@ gdk_subsurface_get_texture (GdkSubsurface *subsurface)
|
||||
}
|
||||
|
||||
void
|
||||
gdk_subsurface_get_source (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *source)
|
||||
gdk_subsurface_get_rect (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *rect)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_SUBSURFACE (subsurface));
|
||||
g_return_if_fail (source != NULL);
|
||||
g_return_if_fail (rect != NULL);
|
||||
|
||||
GDK_SUBSURFACE_GET_CLASS (subsurface)->get_source (subsurface, source);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_subsurface_get_dest (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *dest)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_SUBSURFACE (subsurface));
|
||||
g_return_if_fail (dest != NULL);
|
||||
|
||||
GDK_SUBSURFACE_GET_CLASS (subsurface)->get_dest (subsurface, dest);
|
||||
GDK_SUBSURFACE_GET_CLASS (subsurface)->get_rect (subsurface, rect);
|
||||
}
|
||||
|
||||
gboolean
|
||||
@@ -201,5 +101,5 @@ gdk_subsurface_is_above_parent (GdkSubsurface *subsurface)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), TRUE);
|
||||
|
||||
return subsurface->above_parent;
|
||||
return GDK_SUBSURFACE_GET_CLASS (subsurface)->is_above_parent (subsurface);
|
||||
}
|
||||
|
||||
@@ -41,10 +41,6 @@ struct _GdkSubsurface
|
||||
GdkSurface *parent;
|
||||
|
||||
int ref_count;
|
||||
|
||||
gboolean above_parent;
|
||||
GdkSubsurface *sibling_above;
|
||||
GdkSubsurface *sibling_below;
|
||||
};
|
||||
|
||||
|
||||
@@ -54,16 +50,14 @@ struct _GdkSubsurfaceClass
|
||||
|
||||
gboolean (* attach) (GdkSubsurface *subsurface,
|
||||
GdkTexture *texture,
|
||||
const graphene_rect_t *source,
|
||||
const graphene_rect_t *dest,
|
||||
const graphene_rect_t *rect,
|
||||
gboolean above,
|
||||
GdkSubsurface *sibling);
|
||||
void (* detach) (GdkSubsurface *subsurface);
|
||||
GdkTexture * (* get_texture) (GdkSubsurface *subsurface);
|
||||
void (* get_source) (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *source);
|
||||
void (* get_dest) (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *dest);
|
||||
void (* get_rect) (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *rect);
|
||||
gboolean (* is_above_parent) (GdkSubsurface *subsurface);
|
||||
};
|
||||
|
||||
GType gdk_subsurface_get_type (void) G_GNUC_CONST;
|
||||
@@ -71,16 +65,13 @@ GType gdk_subsurface_get_type (void) G_GNUC_CONST;
|
||||
GdkSurface * gdk_subsurface_get_parent (GdkSubsurface *subsurface);
|
||||
gboolean gdk_subsurface_attach (GdkSubsurface *subsurface,
|
||||
GdkTexture *texture,
|
||||
const graphene_rect_t *source,
|
||||
const graphene_rect_t *dest,
|
||||
const graphene_rect_t *rect,
|
||||
gboolean above,
|
||||
GdkSubsurface *sibling);
|
||||
void gdk_subsurface_detach (GdkSubsurface *subsurface);
|
||||
GdkTexture * gdk_subsurface_get_texture (GdkSubsurface *subsurface);
|
||||
void gdk_subsurface_get_source (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *source);
|
||||
void gdk_subsurface_get_dest (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *dest);
|
||||
void gdk_subsurface_get_rect (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *rect);
|
||||
gboolean gdk_subsurface_is_above_parent (GdkSubsurface *subsurface);
|
||||
|
||||
|
||||
|
||||
@@ -2839,7 +2839,7 @@ add_event_mark (GdkEvent *event,
|
||||
class = g_type_class_ref (GDK_TYPE_EVENT_TYPE);
|
||||
value = g_enum_get_value (class, event_type);
|
||||
g_type_class_unref (class);
|
||||
kind = value ? value->value_nick : "Event";
|
||||
kind = value ? value->value_nick : "event";
|
||||
|
||||
switch ((int) event_type)
|
||||
{
|
||||
@@ -2909,7 +2909,7 @@ add_event_mark (GdkEvent *event,
|
||||
break;
|
||||
}
|
||||
|
||||
gdk_profiler_add_mark (time, end_time - time, "Event", message ? message : kind);
|
||||
gdk_profiler_add_mark (time, end_time - time, "event", message ? message : kind);
|
||||
|
||||
g_free (message);
|
||||
#endif
|
||||
|
||||
@@ -99,12 +99,6 @@ struct _GdkSurface
|
||||
GdkSeat *current_shortcuts_inhibited_seat;
|
||||
|
||||
GPtrArray *subsurfaces;
|
||||
|
||||
/* We keep the subsurfaces above and below the surface in two linked
|
||||
* lists, which start here.
|
||||
*/
|
||||
GdkSubsurface *subsurfaces_above;
|
||||
GdkSubsurface *subsurfaces_below;
|
||||
};
|
||||
|
||||
struct _GdkSurfaceClass
|
||||
@@ -351,6 +345,8 @@ void gdk_surface_request_motion (GdkSurface *surface);
|
||||
gboolean gdk_surface_supports_edge_constraints (GdkSurface *surface);
|
||||
|
||||
GdkSubsurface * gdk_surface_create_subsurface (GdkSurface *surface);
|
||||
void gdk_surface_destroy_subsurface (GdkSurface *surface,
|
||||
GdkSubsurface *subsurface);
|
||||
gsize gdk_surface_get_n_subsurfaces (GdkSurface *surface);
|
||||
GdkSubsurface * gdk_surface_get_subsurface (GdkSurface *surface,
|
||||
gsize idx);
|
||||
|
||||
@@ -142,9 +142,6 @@ gdk_toplevel_size_set_min_size (GdkToplevelSize *size,
|
||||
* The shadow width corresponds to the part of the computed surface size
|
||||
* that would consist of the shadow margin surrounding the window, would
|
||||
* there be any.
|
||||
*
|
||||
* Shadow width should only be set if
|
||||
* [method@Gtk.Display.supports_shadow_width] is %TRUE.
|
||||
*/
|
||||
void
|
||||
gdk_toplevel_size_set_shadow_width (GdkToplevelSize *size,
|
||||
|
||||
@@ -260,11 +260,6 @@ gdk_vulkan_strerror (VkResult result)
|
||||
case VK_ERROR_INCOMPATIBLE_SHADER_BINARY_EXT:
|
||||
return "The provided binary shader code is not compatible with this device. (VK_ERROR_INCOMPATIBLE_SHADER_BINARY_EXT)";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 274
|
||||
case VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR:
|
||||
return "The specified Video Std parameters do not adhere to the syntactic or semantic requirements of the used video compression standard or implementation";
|
||||
#endif
|
||||
|
||||
case VK_RESULT_MAX_ENUM:
|
||||
default:
|
||||
return "Unknown Vulkan error.";
|
||||
@@ -598,8 +593,7 @@ physical_device_check_features (VkPhysicalDevice device,
|
||||
v12_features.shaderStorageBufferArrayNonUniformIndexing)
|
||||
*out_features |= GDK_VULKAN_FEATURE_NONUNIFORM_INDEXING;
|
||||
|
||||
if (ycbcr_features.samplerYcbcrConversion ||
|
||||
physical_device_supports_extension (device, VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME))
|
||||
if (ycbcr_features.samplerYcbcrConversion)
|
||||
*out_features |= GDK_VULKAN_FEATURE_YCBCR;
|
||||
|
||||
if (physical_device_supports_extension (device, VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME) &&
|
||||
@@ -1472,27 +1466,13 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_SWAPCHAIN_EXTENSION_NAME);
|
||||
if (features & GDK_VULKAN_FEATURE_DESCRIPTOR_INDEXING)
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME);
|
||||
if (features & GDK_VULKAN_FEATURE_YCBCR)
|
||||
{
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME);
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_MAINTENANCE_1_EXTENSION_NAME);
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_BIND_MEMORY_2_EXTENSION_NAME);
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME);
|
||||
}
|
||||
if (features & GDK_VULKAN_FEATURE_DMABUF)
|
||||
{
|
||||
g_assert (features & GDK_VULKAN_FEATURE_YCBCR);
|
||||
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME);
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME);
|
||||
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME);
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME);
|
||||
}
|
||||
if (features & (GDK_VULKAN_FEATURE_SEMAPHORE_IMPORT | GDK_VULKAN_FEATURE_SEMAPHORE_EXPORT))
|
||||
{
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME);
|
||||
}
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME);
|
||||
if (features & GDK_VULKAN_FEATURE_INCREMENTAL_PRESENT)
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME);
|
||||
|
||||
@@ -1633,12 +1613,6 @@ gdk_display_create_vulkan_instance (GdkDisplay *display,
|
||||
g_ptr_array_add (used_extensions, (gpointer) VK_EXT_DEBUG_REPORT_EXTENSION_NAME);
|
||||
have_debug_report = TRUE;
|
||||
}
|
||||
if (g_str_equal (extensions[i].extensionName, VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME))
|
||||
g_ptr_array_add (used_extensions, (gpointer) VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME);
|
||||
if (g_str_equal (extensions[i].extensionName, VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME))
|
||||
g_ptr_array_add (used_extensions, (gpointer) VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME);
|
||||
if (g_str_equal (extensions[i].extensionName, VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME))
|
||||
g_ptr_array_add (used_extensions, (gpointer) VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME);
|
||||
}
|
||||
|
||||
uint32_t n_layers;
|
||||
|
||||
@@ -237,7 +237,7 @@ gdk_load_jpeg (GBytes *input_bytes,
|
||||
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
gdk_profiler_end_mark (before, "Load jpeg", NULL);
|
||||
gdk_profiler_end_mark (before, "jpeg load", NULL);
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
@@ -304,7 +304,7 @@ gdk_load_png (GBytes *bytes,
|
||||
{
|
||||
gint64 end = GDK_PROFILER_CURRENT_TIME;
|
||||
if (end - before > 500000)
|
||||
gdk_profiler_add_mark (before, end - before, "Load png", NULL);
|
||||
gdk_profiler_add_mark (before, end - before, "png load", NULL);
|
||||
}
|
||||
|
||||
return texture;
|
||||
|
||||
@@ -504,7 +504,7 @@ gdk_load_tiff (GBytes *input_bytes,
|
||||
{
|
||||
gint64 end = GDK_PROFILER_CURRENT_TIME;
|
||||
if (end - before > 500000)
|
||||
gdk_profiler_add_mark (before, end - before, "Load tiff", NULL);
|
||||
gdk_profiler_add_mark (before, end - before, "tiff load", NULL);
|
||||
}
|
||||
|
||||
return texture;
|
||||
|
||||
@@ -214,6 +214,22 @@ typedef NSString *CALayerContentsGravity;
|
||||
}
|
||||
}
|
||||
|
||||
-(void)setFrame:(NSRect)frame display:(BOOL)display
|
||||
{
|
||||
NSRect contentRect = [self contentRectForFrameRect:frame];
|
||||
GdkSurface *surface = GDK_SURFACE (gdk_surface);
|
||||
gboolean maximized = (surface->state & GDK_TOPLEVEL_STATE_MAXIMIZED) != 0;
|
||||
|
||||
if (maximized && !inMaximizeTransition && !NSEqualRects (lastMaximizedFrame, frame))
|
||||
{
|
||||
gdk_synthesize_surface_state (surface, GDK_TOPLEVEL_STATE_MAXIMIZED, 0);
|
||||
_gdk_surface_update_size (surface);
|
||||
}
|
||||
|
||||
[super setFrame:frame display:display];
|
||||
[[self contentView] setFrame:NSMakeRect (0, 0, contentRect.size.width, contentRect.size.height)];
|
||||
}
|
||||
|
||||
-(id)initWithContentRect:(NSRect)contentRect
|
||||
styleMask:(NSWindowStyleMask)styleMask
|
||||
backing:(NSBackingStoreType)backingType
|
||||
@@ -371,23 +387,19 @@ typedef NSString *CALayerContentsGravity;
|
||||
|
||||
-(void)windowDidMove:(NSNotification *)notification
|
||||
{
|
||||
if ([self isZoomed])
|
||||
gdk_synthesize_surface_state (GDK_SURFACE (gdk_surface), 0, GDK_TOPLEVEL_STATE_MAXIMIZED);
|
||||
else
|
||||
gdk_synthesize_surface_state (GDK_SURFACE (gdk_surface), GDK_TOPLEVEL_STATE_MAXIMIZED, 0);
|
||||
|
||||
_gdk_macos_surface_configure ([self gdkSurface]);
|
||||
}
|
||||
|
||||
-(void)windowDidResize:(NSNotification *)notification
|
||||
{
|
||||
[self windowDidMove: notification];
|
||||
_gdk_macos_surface_configure (gdk_surface);
|
||||
|
||||
/* If we're using server-side decorations, this notification is coming
|
||||
* in from a display-side change. We need to request a layout in
|
||||
* addition to the configure event.
|
||||
*/
|
||||
if (GDK_IS_MACOS_TOPLEVEL_SURFACE (gdk_surface))
|
||||
if (GDK_IS_MACOS_TOPLEVEL_SURFACE (gdk_surface) &&
|
||||
GDK_MACOS_TOPLEVEL_SURFACE (gdk_surface)->decorated)
|
||||
gdk_surface_request_layout (GDK_SURFACE (gdk_surface));
|
||||
}
|
||||
|
||||
@@ -402,6 +414,7 @@ typedef NSString *CALayerContentsGravity;
|
||||
|
||||
-(void)beginManualMove
|
||||
{
|
||||
gboolean maximized = GDK_SURFACE (gdk_surface)->state & GDK_TOPLEVEL_STATE_MAXIMIZED;
|
||||
NSPoint initialMoveLocation;
|
||||
GdkPoint point;
|
||||
GdkMonitor *monitor;
|
||||
@@ -420,6 +433,13 @@ typedef NSString *CALayerContentsGravity;
|
||||
|
||||
initialMoveLocation = [NSEvent mouseLocation];
|
||||
|
||||
if (maximized)
|
||||
[self setFrame:NSMakeRect (initialMoveLocation.x - (int)lastUnmaximizedFrame.size.width/2,
|
||||
initialMoveLocation.y,
|
||||
lastUnmaximizedFrame.size.width,
|
||||
lastUnmaximizedFrame.size.height)
|
||||
display:YES];
|
||||
|
||||
_gdk_macos_display_from_display_coords ([self gdkDisplay],
|
||||
initialMoveLocation.x,
|
||||
initialMoveLocation.y,
|
||||
@@ -762,11 +782,43 @@ typedef NSString *CALayerContentsGravity;
|
||||
return rect;
|
||||
}
|
||||
|
||||
/* Implementing this method avoids new windows move around the screen. */
|
||||
-(NSRect)windowWillUseStandardFrame:(NSWindow *)nsWindow
|
||||
defaultFrame:(NSRect)newFrame
|
||||
{
|
||||
return newFrame;
|
||||
NSRect screenFrame = [[self screen] visibleFrame];
|
||||
GdkMacosSurface *surface = gdk_surface;
|
||||
gboolean maximized = GDK_SURFACE (surface)->state & GDK_TOPLEVEL_STATE_MAXIMIZED;
|
||||
|
||||
if (!maximized)
|
||||
return screenFrame;
|
||||
else
|
||||
return lastUnmaximizedFrame;
|
||||
}
|
||||
|
||||
-(BOOL)windowShouldZoom:(NSWindow *)nsWindow
|
||||
toFrame:(NSRect)newFrame
|
||||
{
|
||||
GdkMacosSurface *surface = gdk_surface;
|
||||
GdkToplevelState state = GDK_SURFACE (surface)->state;
|
||||
|
||||
if (state & GDK_TOPLEVEL_STATE_MAXIMIZED)
|
||||
{
|
||||
lastMaximizedFrame = newFrame;
|
||||
}
|
||||
else
|
||||
{
|
||||
lastUnmaximizedFrame = [nsWindow frame];
|
||||
gdk_synthesize_surface_state (GDK_SURFACE (gdk_surface), 0, GDK_TOPLEVEL_STATE_MAXIMIZED);
|
||||
}
|
||||
|
||||
inMaximizeTransition = YES;
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
-(void)windowDidEndLiveResize:(NSNotification *)aNotification
|
||||
{
|
||||
inMaximizeTransition = NO;
|
||||
}
|
||||
|
||||
-(NSSize)window:(NSWindow *)window willUseFullScreenContentSize:(NSSize)proposedSize
|
||||
@@ -823,21 +875,12 @@ typedef NSString *CALayerContentsGravity;
|
||||
{
|
||||
NSWindowStyleMask style_mask = [self styleMask];
|
||||
|
||||
if (decorated)
|
||||
{
|
||||
style_mask &= ~NSWindowStyleMaskFullSizeContentView;
|
||||
[self setTitleVisibility:NSWindowTitleVisible];
|
||||
}
|
||||
else
|
||||
{
|
||||
style_mask |= NSWindowStyleMaskFullSizeContentView;
|
||||
[self setTitleVisibility:NSWindowTitleHidden];
|
||||
}
|
||||
[self setHasShadow:decorated];
|
||||
|
||||
[self setTitlebarAppearsTransparent:!decorated];
|
||||
[[self standardWindowButton:NSWindowCloseButton] setHidden:!decorated];
|
||||
[[self standardWindowButton:NSWindowMiniaturizeButton] setHidden:!decorated];
|
||||
[[self standardWindowButton:NSWindowZoomButton] setHidden:!decorated];
|
||||
if (decorated)
|
||||
style_mask |= NSWindowStyleMaskTitled;
|
||||
else
|
||||
style_mask &= ~NSWindowStyleMaskTitled;
|
||||
|
||||
[self setStyleMask:style_mask];
|
||||
}
|
||||
|
||||
@@ -49,7 +49,10 @@
|
||||
|
||||
EdgeSnapping snapping;
|
||||
|
||||
NSRect lastUnmaximizedFrame;
|
||||
NSRect lastMaximizedFrame;
|
||||
NSRect lastUnfullscreenFrame;
|
||||
BOOL inMaximizeTransition;
|
||||
BOOL inFullscreenTransition;
|
||||
}
|
||||
|
||||
|
||||
@@ -271,11 +271,6 @@ _gdk_macos_cairo_context_end_frame (GdkDrawContext *draw_context,
|
||||
[CATransaction commit];
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_macos_cairo_context_empty_frame (GdkDrawContext *draw_context)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_macos_cairo_context_surface_resized (GdkDrawContext *draw_context)
|
||||
{
|
||||
@@ -292,7 +287,6 @@ _gdk_macos_cairo_context_class_init (GdkMacosCairoContextClass *klass)
|
||||
|
||||
draw_context_class->begin_frame = _gdk_macos_cairo_context_begin_frame;
|
||||
draw_context_class->end_frame = _gdk_macos_cairo_context_end_frame;
|
||||
draw_context_class->empty_frame = _gdk_macos_cairo_context_empty_frame;
|
||||
draw_context_class->surface_resized = _gdk_macos_cairo_context_surface_resized;
|
||||
|
||||
cairo_context_class->cairo_create = _gdk_macos_cairo_context_cairo_create;
|
||||
|
||||
@@ -151,57 +151,6 @@ create_blank_cursor (void)
|
||||
return nscursor;
|
||||
}
|
||||
|
||||
static NSCursor *
|
||||
create_cursor_from_texture (GdkTexture *texture,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
guint32 width;
|
||||
guint32 height;
|
||||
guchar *pixels;
|
||||
gsize stride;
|
||||
GdkTextureDownloader *downloader;
|
||||
NSCursor *nscursor;
|
||||
NSBitmapImageRep *nsbitmap;
|
||||
NSImage *nsimage;
|
||||
|
||||
if (texture == NULL)
|
||||
return create_blank_cursor ();
|
||||
|
||||
width = gdk_texture_get_width (texture);
|
||||
height = gdk_texture_get_height (texture);
|
||||
|
||||
nsbitmap = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
|
||||
pixelsWide:width
|
||||
pixelsHigh:height
|
||||
bitsPerSample:8
|
||||
samplesPerPixel:4
|
||||
hasAlpha:YES
|
||||
isPlanar:NO
|
||||
colorSpaceName:NSDeviceRGBColorSpace
|
||||
bytesPerRow:0
|
||||
bitsPerPixel:0];
|
||||
pixels = [nsbitmap bitmapData];
|
||||
stride = [nsbitmap bytesPerRow];
|
||||
|
||||
downloader = gdk_texture_downloader_new (texture);
|
||||
gdk_texture_downloader_set_format (downloader, GDK_MEMORY_R8G8B8A8_PREMULTIPLIED);
|
||||
gdk_texture_downloader_download_into (downloader,
|
||||
pixels,
|
||||
stride);
|
||||
gdk_texture_downloader_free (downloader);
|
||||
|
||||
nsimage = [[NSImage alloc] init];
|
||||
[nsimage addRepresentation:nsbitmap];
|
||||
[nsimage setSize:NSMakeSize(width, height)];
|
||||
[nsbitmap release];
|
||||
|
||||
nscursor = [[NSCursor alloc] initWithImage:nsimage
|
||||
hotSpot:NSMakePoint(x, y)];
|
||||
[nsimage release];
|
||||
return nscursor;
|
||||
}
|
||||
|
||||
NSCursor *
|
||||
_gdk_macos_cursor_get_ns_cursor (GdkCursor *cursor)
|
||||
{
|
||||
@@ -212,17 +161,7 @@ _gdk_macos_cursor_get_ns_cursor (GdkCursor *cursor)
|
||||
g_return_val_if_fail (!cursor || GDK_IS_CURSOR (cursor), NULL);
|
||||
|
||||
if (cursor != NULL)
|
||||
{
|
||||
name = gdk_cursor_get_name (cursor);
|
||||
|
||||
if (name == NULL)
|
||||
{
|
||||
nscursor = create_cursor_from_texture (gdk_cursor_get_texture (cursor),
|
||||
gdk_cursor_get_hotspot_x (cursor),
|
||||
gdk_cursor_get_hotspot_y (cursor));
|
||||
return nscursor;
|
||||
}
|
||||
}
|
||||
name = gdk_cursor_get_name (cursor);
|
||||
|
||||
if (name == NULL)
|
||||
goto load_cursor;
|
||||
|
||||
@@ -625,7 +625,6 @@ gdk_macos_display_init (GdkMacosDisplay *self)
|
||||
gdk_display_set_composited (GDK_DISPLAY (self), TRUE);
|
||||
gdk_display_set_input_shapes (GDK_DISPLAY (self), FALSE);
|
||||
gdk_display_set_rgba (GDK_DISPLAY (self), TRUE);
|
||||
gdk_display_set_shadow_width (GDK_DISPLAY (self), FALSE);
|
||||
}
|
||||
|
||||
GdkDisplay *
|
||||
|
||||
@@ -734,14 +734,7 @@ gdk_macos_event_source_dispatch (GSource *source,
|
||||
|
||||
if (event)
|
||||
{
|
||||
gboolean handled = _gdk_event_emit (event);
|
||||
|
||||
if (!handled)
|
||||
{
|
||||
NSEvent *nsevent = _gdk_macos_display_get_nsevent (event);
|
||||
if (nsevent != NULL)
|
||||
[NSApp sendEvent: nsevent];
|
||||
}
|
||||
_gdk_event_emit (event);
|
||||
|
||||
gdk_event_unref (event);
|
||||
}
|
||||
|
||||
@@ -545,11 +545,6 @@ gdk_macos_gl_context_end_frame (GdkDrawContext *context,
|
||||
[CATransaction commit];
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_macos_gl_context_empty_frame (GdkDrawContext *draw_context)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_macos_gl_context_surface_resized (GdkDrawContext *draw_context)
|
||||
{
|
||||
@@ -672,7 +667,6 @@ gdk_macos_gl_context_class_init (GdkMacosGLContextClass *klass)
|
||||
|
||||
draw_context_class->begin_frame = gdk_macos_gl_context_begin_frame;
|
||||
draw_context_class->end_frame = gdk_macos_gl_context_end_frame;
|
||||
draw_context_class->empty_frame = gdk_macos_gl_context_empty_frame;
|
||||
draw_context_class->surface_resized = gdk_macos_gl_context_surface_resized;
|
||||
|
||||
gl_class->get_damage = gdk_macos_gl_context_get_damage;
|
||||
|
||||
@@ -96,26 +96,37 @@ _gdk_macos_toplevel_surface_unminimize (GdkMacosToplevelSurface *self)
|
||||
[window deminiaturize:window];
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_gdk_macos_toplevel_surface_compute_size (GdkSurface *surface)
|
||||
static void
|
||||
_gdk_macos_toplevel_surface_present (GdkToplevel *toplevel,
|
||||
GdkToplevelLayout *layout)
|
||||
{
|
||||
GdkMacosToplevelSurface *self = (GdkMacosToplevelSurface *)surface;
|
||||
GdkMacosSurface *macos_surface = (GdkMacosSurface *)surface;
|
||||
GdkToplevelSize size;
|
||||
GdkDisplay *display;
|
||||
GdkSurface *surface = GDK_SURFACE (toplevel);
|
||||
GdkMacosToplevelSurface *self = (GdkMacosToplevelSurface *)toplevel;
|
||||
NSWindow *nswindow = _gdk_macos_surface_get_native (GDK_MACOS_SURFACE (self));
|
||||
GdkDisplay *display = gdk_surface_get_display (surface);
|
||||
GdkMonitor *monitor;
|
||||
GdkToplevelSize size;
|
||||
int bounds_width, bounds_height;
|
||||
int width, height;
|
||||
GdkGeometry geometry;
|
||||
GdkSurfaceHints mask;
|
||||
NSWindowStyleMask style_mask;
|
||||
gboolean maximize;
|
||||
gboolean fullscreen;
|
||||
|
||||
g_assert (GDK_IS_MACOS_TOPLEVEL_SURFACE (self));
|
||||
g_assert (GDK_IS_MACOS_WINDOW (nswindow));
|
||||
|
||||
if (!GDK_MACOS_SURFACE (surface)->geometry_dirty)
|
||||
return FALSE;
|
||||
if (layout != self->layout)
|
||||
{
|
||||
g_clear_pointer (&self->layout, gdk_toplevel_layout_unref);
|
||||
self->layout = gdk_toplevel_layout_copy (layout);
|
||||
}
|
||||
|
||||
GDK_MACOS_SURFACE (surface)->geometry_dirty = FALSE;
|
||||
_gdk_macos_toplevel_surface_attach_to_parent (self);
|
||||
|
||||
style_mask = [nswindow styleMask];
|
||||
|
||||
display = gdk_surface_get_display (surface);
|
||||
monitor = gdk_display_get_monitor_at_surface (display, surface);
|
||||
|
||||
if (monitor)
|
||||
@@ -133,127 +144,58 @@ _gdk_macos_toplevel_surface_compute_size (GdkSurface *surface)
|
||||
}
|
||||
|
||||
gdk_toplevel_size_init (&size, bounds_width, bounds_height);
|
||||
gdk_toplevel_notify_compute_size (GDK_TOPLEVEL (surface), &size);
|
||||
|
||||
gdk_toplevel_notify_compute_size (toplevel, &size);
|
||||
g_warn_if_fail (size.width > 0);
|
||||
g_warn_if_fail (size.height > 0);
|
||||
width = size.width;
|
||||
height = size.height;
|
||||
|
||||
if (self->layout != NULL &&
|
||||
gdk_toplevel_layout_get_resizable (self->layout))
|
||||
if (gdk_toplevel_layout_get_resizable (layout))
|
||||
{
|
||||
geometry.min_width = size.min_width;
|
||||
geometry.min_height = size.min_height;
|
||||
mask = GDK_HINT_MIN_SIZE;
|
||||
|
||||
/* Only set 'Resizable' mask to get native resize zones if the window is
|
||||
* titled, otherwise we do this internally for CSD and do not need
|
||||
* NSWindow to do it for us. Additionally, it can mess things up when
|
||||
* doing a window resize since it can cause mouseDown to get passed
|
||||
* through to the next window.
|
||||
*/
|
||||
if ((style_mask & NSWindowStyleMaskTitled) != 0)
|
||||
style_mask |= NSWindowStyleMaskResizable;
|
||||
else
|
||||
style_mask &= ~NSWindowStyleMaskResizable;
|
||||
}
|
||||
else
|
||||
{
|
||||
geometry.max_width = geometry.min_width = size.width;
|
||||
geometry.max_height = geometry.min_height = size.height;
|
||||
geometry.max_width = geometry.min_width = width;
|
||||
geometry.max_height = geometry.min_height = height;
|
||||
mask = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE;
|
||||
|
||||
style_mask &= ~NSWindowStyleMaskResizable;
|
||||
}
|
||||
|
||||
if (style_mask != [nswindow styleMask])
|
||||
[nswindow setStyleMask:style_mask];
|
||||
|
||||
if (size.shadow.is_valid)
|
||||
_gdk_macos_surface_set_shadow (macos_surface,
|
||||
_gdk_macos_surface_set_shadow (GDK_MACOS_SURFACE (surface),
|
||||
size.shadow.top,
|
||||
size.shadow.right,
|
||||
size.shadow.bottom,
|
||||
size.shadow.left);
|
||||
|
||||
_gdk_macos_surface_set_geometry_hints (macos_surface, &geometry, mask);
|
||||
_gdk_macos_surface_set_geometry_hints (GDK_MACOS_SURFACE (self), &geometry, mask);
|
||||
gdk_surface_constrain_size (&geometry, mask, width, height, &width, &height);
|
||||
|
||||
if (surface->state & (GDK_TOPLEVEL_STATE_FULLSCREEN |
|
||||
GDK_TOPLEVEL_STATE_MAXIMIZED |
|
||||
GDK_TOPLEVEL_STATE_TILED |
|
||||
GDK_TOPLEVEL_STATE_TOP_TILED |
|
||||
GDK_TOPLEVEL_STATE_RIGHT_TILED |
|
||||
GDK_TOPLEVEL_STATE_BOTTOM_TILED |
|
||||
GDK_TOPLEVEL_STATE_LEFT_TILED |
|
||||
GDK_TOPLEVEL_STATE_MINIMIZED) ||
|
||||
[macos_surface->window inLiveResize])
|
||||
return FALSE;
|
||||
GDK_DEBUG (MISC, "Resizing \"%s\" to %dx%d",
|
||||
GDK_MACOS_SURFACE (self)->title ?
|
||||
GDK_MACOS_SURFACE (self)->title :
|
||||
"untitled",
|
||||
width, height);
|
||||
|
||||
/* If we delayed a user resize until the beginning of the frame,
|
||||
* apply it now so we can start processing updates for it.
|
||||
*/
|
||||
if (macos_surface->next_layout.width > 0 &&
|
||||
macos_surface->next_layout.height > 0)
|
||||
{
|
||||
int root_x = macos_surface->next_layout.root_x;
|
||||
int root_y = macos_surface->next_layout.root_y;
|
||||
int width = macos_surface->next_layout.width;
|
||||
int height = macos_surface->next_layout.height;
|
||||
|
||||
gdk_surface_constrain_size (&geometry, mask,
|
||||
width, height,
|
||||
&width, &height);
|
||||
|
||||
macos_surface->next_layout.width = 0;
|
||||
macos_surface->next_layout.height = 0;
|
||||
|
||||
_gdk_macos_surface_move_resize (macos_surface,
|
||||
root_x, root_y,
|
||||
width, height);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gdk_surface_constrain_size (&geometry, mask,
|
||||
size.width, size.height,
|
||||
&size.width, &size.height);
|
||||
|
||||
if ((size.width != self->last_computed_width ||
|
||||
size.height != self->last_computed_height) &&
|
||||
(size.width != surface->width ||
|
||||
size.height != surface->height))
|
||||
{
|
||||
self->last_computed_width = size.width;
|
||||
self->last_computed_height = size.height;
|
||||
|
||||
_gdk_macos_surface_resize (macos_surface, size.width, size.height);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_macos_toplevel_surface_present (GdkToplevel *toplevel,
|
||||
GdkToplevelLayout *layout)
|
||||
{
|
||||
GdkSurface *surface = GDK_SURFACE (toplevel);
|
||||
GdkMacosToplevelSurface *self = (GdkMacosToplevelSurface *)toplevel;
|
||||
NSWindow *nswindow = _gdk_macos_surface_get_native (GDK_MACOS_SURFACE (self));
|
||||
GdkDisplay *display = gdk_surface_get_display (surface);
|
||||
NSWindowStyleMask style_mask;
|
||||
gboolean maximize;
|
||||
gboolean fullscreen;
|
||||
|
||||
g_assert (GDK_IS_MACOS_TOPLEVEL_SURFACE (self));
|
||||
g_assert (GDK_IS_MACOS_WINDOW (nswindow));
|
||||
|
||||
if (layout != self->layout)
|
||||
{
|
||||
g_clear_pointer (&self->layout, gdk_toplevel_layout_unref);
|
||||
self->layout = gdk_toplevel_layout_copy (layout);
|
||||
}
|
||||
|
||||
_gdk_macos_toplevel_surface_attach_to_parent (self);
|
||||
_gdk_macos_toplevel_surface_compute_size (surface);
|
||||
|
||||
/* Only set 'Resizable' mask to get native resize zones if the window is
|
||||
* titled, otherwise we do this internally for CSD and do not need
|
||||
* NSWindow to do it for us. Additionally, it can mess things up when
|
||||
* doing a window resize since it can cause mouseDown to get passed
|
||||
* through to the next window.
|
||||
*/
|
||||
style_mask = [nswindow styleMask];
|
||||
if (gdk_toplevel_layout_get_resizable (layout) &&
|
||||
(style_mask & NSWindowStyleMaskTitled) != 0)
|
||||
style_mask |= NSWindowStyleMaskResizable;
|
||||
else
|
||||
style_mask &= ~NSWindowStyleMaskResizable;
|
||||
|
||||
if (style_mask != [nswindow styleMask])
|
||||
[nswindow setStyleMask:style_mask];
|
||||
_gdk_macos_surface_resize (GDK_MACOS_SURFACE (self), width, height);
|
||||
|
||||
/* Maximized state */
|
||||
if (gdk_toplevel_layout_get_maximized (layout, &maximize))
|
||||
@@ -436,6 +378,125 @@ _gdk_macos_toplevel_surface_hide (GdkSurface *surface)
|
||||
GDK_SURFACE_CLASS (_gdk_macos_toplevel_surface_parent_class)->hide (surface);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_gdk_macos_toplevel_surface_compute_size (GdkSurface *surface)
|
||||
{
|
||||
GdkMacosToplevelSurface *self = (GdkMacosToplevelSurface *)surface;
|
||||
GdkMacosSurface *macos_surface = (GdkMacosSurface *)surface;
|
||||
GdkToplevelSize size;
|
||||
GdkDisplay *display;
|
||||
GdkMonitor *monitor;
|
||||
int bounds_width, bounds_height;
|
||||
GdkGeometry geometry;
|
||||
GdkSurfaceHints mask;
|
||||
|
||||
g_assert (GDK_IS_MACOS_TOPLEVEL_SURFACE (self));
|
||||
|
||||
if (!GDK_MACOS_SURFACE (surface)->geometry_dirty)
|
||||
return FALSE;
|
||||
|
||||
GDK_MACOS_SURFACE (surface)->geometry_dirty = FALSE;
|
||||
|
||||
display = gdk_surface_get_display (surface);
|
||||
monitor = gdk_display_get_monitor_at_surface (display, surface);
|
||||
|
||||
if (monitor)
|
||||
{
|
||||
GdkRectangle workarea;
|
||||
|
||||
gdk_macos_monitor_get_workarea (monitor, &workarea);
|
||||
bounds_width = workarea.width;
|
||||
bounds_height = workarea.height;
|
||||
}
|
||||
else
|
||||
{
|
||||
bounds_width = G_MAXINT;
|
||||
bounds_height = G_MAXINT;
|
||||
}
|
||||
|
||||
gdk_toplevel_size_init (&size, bounds_width, bounds_height);
|
||||
gdk_toplevel_notify_compute_size (GDK_TOPLEVEL (surface), &size);
|
||||
|
||||
g_warn_if_fail (size.width > 0);
|
||||
g_warn_if_fail (size.height > 0);
|
||||
|
||||
if (self->layout != NULL &&
|
||||
gdk_toplevel_layout_get_resizable (self->layout))
|
||||
{
|
||||
geometry.min_width = size.min_width;
|
||||
geometry.min_height = size.min_height;
|
||||
mask = GDK_HINT_MIN_SIZE;
|
||||
}
|
||||
else
|
||||
{
|
||||
geometry.max_width = geometry.min_width = size.width;
|
||||
geometry.max_height = geometry.min_height = size.height;
|
||||
mask = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE;
|
||||
}
|
||||
|
||||
if (size.shadow.is_valid)
|
||||
_gdk_macos_surface_set_shadow (macos_surface,
|
||||
size.shadow.top,
|
||||
size.shadow.right,
|
||||
size.shadow.bottom,
|
||||
size.shadow.left);
|
||||
|
||||
_gdk_macos_surface_set_geometry_hints (macos_surface, &geometry, mask);
|
||||
|
||||
if (surface->state & (GDK_TOPLEVEL_STATE_FULLSCREEN |
|
||||
GDK_TOPLEVEL_STATE_MAXIMIZED |
|
||||
GDK_TOPLEVEL_STATE_TILED |
|
||||
GDK_TOPLEVEL_STATE_TOP_TILED |
|
||||
GDK_TOPLEVEL_STATE_RIGHT_TILED |
|
||||
GDK_TOPLEVEL_STATE_BOTTOM_TILED |
|
||||
GDK_TOPLEVEL_STATE_LEFT_TILED |
|
||||
GDK_TOPLEVEL_STATE_MINIMIZED) ||
|
||||
[macos_surface->window inLiveResize])
|
||||
return FALSE;
|
||||
|
||||
/* If we delayed a user resize until the beginning of the frame,
|
||||
* apply it now so we can start processing updates for it.
|
||||
*/
|
||||
if (macos_surface->next_layout.width > 0 &&
|
||||
macos_surface->next_layout.height > 0)
|
||||
{
|
||||
int root_x = macos_surface->next_layout.root_x;
|
||||
int root_y = macos_surface->next_layout.root_y;
|
||||
int width = macos_surface->next_layout.width;
|
||||
int height = macos_surface->next_layout.height;
|
||||
|
||||
gdk_surface_constrain_size (&geometry, mask,
|
||||
width, height,
|
||||
&width, &height);
|
||||
|
||||
macos_surface->next_layout.width = 0;
|
||||
macos_surface->next_layout.height = 0;
|
||||
|
||||
_gdk_macos_surface_move_resize (macos_surface,
|
||||
root_x, root_y,
|
||||
width, height);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gdk_surface_constrain_size (&geometry, mask,
|
||||
size.width, size.height,
|
||||
&size.width, &size.height);
|
||||
|
||||
if ((size.width != self->last_computed_width ||
|
||||
size.height != self->last_computed_height) &&
|
||||
(size.width != surface->width ||
|
||||
size.height != surface->height))
|
||||
{
|
||||
self->last_computed_width = size.width;
|
||||
self->last_computed_height = size.height;
|
||||
|
||||
_gdk_macos_surface_resize (macos_surface, size.width, size.height);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_macos_toplevel_surface_request_layout (GdkSurface *surface)
|
||||
{
|
||||
|
||||
@@ -219,7 +219,7 @@ gdk_deps = [
|
||||
platform_gio_dep,
|
||||
pangocairo_dep,
|
||||
vulkan_dep,
|
||||
libdrm_dep,
|
||||
dmabuf_dep,
|
||||
png_dep,
|
||||
tiff_dep,
|
||||
jpeg_dep,
|
||||
|
||||
@@ -266,10 +266,10 @@ _XcursorReadUInt (XcursorFile *file, XcursorUInt *u)
|
||||
|
||||
if ((*file->read) (file, bytes, 4) != 4)
|
||||
return XcursorFalse;
|
||||
*u = ((((unsigned int)(bytes[0])) << 0) |
|
||||
(((unsigned int)(bytes[1])) << 8) |
|
||||
(((unsigned int)(bytes[2])) << 16) |
|
||||
(((unsigned int)(bytes[3])) << 24));
|
||||
*u = ((bytes[0] << 0) |
|
||||
(bytes[1] << 8) |
|
||||
(bytes[2] << 16) |
|
||||
(bytes[3] << 24));
|
||||
return XcursorTrue;
|
||||
}
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@ gdk_wayland_cairo_context_end_frame (GdkDrawContext *draw_context,
|
||||
gdk_wayland_surface_attach_image (surface, self->paint_surface, painted);
|
||||
gdk_wayland_surface_request_frame (surface);
|
||||
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "wayland", "surface commit");
|
||||
gdk_wayland_surface_commit (surface);
|
||||
gdk_wayland_surface_notify_committed (surface);
|
||||
|
||||
@@ -206,7 +206,7 @@ gdk_wayland_cairo_context_empty_frame (GdkDrawContext *draw_context)
|
||||
gdk_wayland_surface_sync (surface);
|
||||
gdk_wayland_surface_request_frame (surface);
|
||||
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "wayland", "surface commit");
|
||||
gdk_wayland_surface_commit (surface);
|
||||
gdk_wayland_surface_notify_committed (surface);
|
||||
}
|
||||
|
||||
@@ -1253,7 +1253,7 @@ _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland)
|
||||
gdk_wayland_display_set_cursor_theme (GDK_DISPLAY (display_wayland), name, size);
|
||||
g_value_unset (&v);
|
||||
|
||||
gdk_profiler_end_mark (before, "Wayland cursor theme load", NULL);
|
||||
gdk_profiler_end_mark (before, "wayland", "load cursor theme");
|
||||
|
||||
}
|
||||
|
||||
@@ -1795,8 +1795,7 @@ static TranslationEntry translations[] = {
|
||||
{ FALSE, "org.gnome.desktop.wm.preferences", "action-middle-click-titlebar", "gtk-titlebar-middle-click", G_TYPE_STRING, { .s = "none" } },
|
||||
{ FALSE, "org.gnome.desktop.wm.preferences", "action-right-click-titlebar", "gtk-titlebar-right-click", G_TYPE_STRING, { .s = "menu" } },
|
||||
{ FALSE, "org.gnome.desktop.a11y", "always-show-text-caret", "gtk-keynav-use-caret", G_TYPE_BOOLEAN, { .b = FALSE } },
|
||||
{ FALSE, "org.gnome.desktop.a11y.interface", "high-contrast", "high-contrast", G_TYPE_NONE, { .b = FALSE } },
|
||||
{ FALSE, "org.gnome.desktop.a11y.interface", "show-status-shapes", "gtk-show-status-shapes", G_TYPE_BOOLEAN, { .b = FALSE } },
|
||||
{ FALSE, "org.gnome.desktop.a11y.interface", "high-contrast", "high-contast", G_TYPE_NONE, { .b = FALSE } },
|
||||
/* Note, this setting doesn't exist, the portal and gsd fake it */
|
||||
{ FALSE, "org.gnome.fontconfig", "serial", "gtk-fontconfig-timestamp", G_TYPE_NONE, { .i = 0 } },
|
||||
};
|
||||
@@ -2430,49 +2429,15 @@ apply_monitor_change (GdkWaylandMonitor *monitor)
|
||||
{
|
||||
GDK_DEBUG (MISC, "monitor %d changed position %d %d, size %d %d",
|
||||
monitor->id,
|
||||
monitor->output_geometry.x, monitor->output_geometry.y,
|
||||
monitor->output_geometry.width, monitor->output_geometry.height);
|
||||
monitor->x, monitor->y,
|
||||
monitor->width, monitor->height);
|
||||
|
||||
GdkRectangle logical_geometry;
|
||||
gboolean needs_scaling = FALSE;
|
||||
double scale;
|
||||
|
||||
if (monitor_has_xdg_output (monitor) &&
|
||||
monitor->xdg_output_geometry.width != 0 &&
|
||||
monitor->xdg_output_geometry.height != 0)
|
||||
{
|
||||
logical_geometry = monitor->xdg_output_geometry;
|
||||
needs_scaling = logical_geometry.width == monitor->output_geometry.width &&
|
||||
logical_geometry.height == monitor->output_geometry.height;
|
||||
}
|
||||
else
|
||||
{
|
||||
logical_geometry = monitor->output_geometry;
|
||||
needs_scaling = TRUE;
|
||||
}
|
||||
|
||||
if (needs_scaling)
|
||||
{
|
||||
int scale_factor = gdk_monitor_get_scale_factor (GDK_MONITOR (monitor));
|
||||
|
||||
logical_geometry.y /= scale_factor;
|
||||
logical_geometry.x /= scale_factor;
|
||||
logical_geometry.width /= scale_factor;
|
||||
logical_geometry.height /= scale_factor;
|
||||
|
||||
scale = scale_factor;
|
||||
}
|
||||
else
|
||||
{
|
||||
scale = MAX (monitor->output_geometry.width / (double) logical_geometry.width,
|
||||
monitor->output_geometry.height / (double) logical_geometry.height);
|
||||
}
|
||||
|
||||
gdk_monitor_set_geometry (GDK_MONITOR (monitor), &logical_geometry);
|
||||
gdk_monitor_set_geometry (GDK_MONITOR (monitor),
|
||||
&(GdkRectangle) {
|
||||
monitor->x, monitor->y,
|
||||
monitor->width, monitor->height });
|
||||
gdk_monitor_set_connector (GDK_MONITOR (monitor), monitor->name);
|
||||
gdk_monitor_set_description (GDK_MONITOR (monitor), monitor->description);
|
||||
gdk_monitor_set_scale (GDK_MONITOR (monitor), scale);
|
||||
|
||||
monitor->wl_output_done = FALSE;
|
||||
monitor->xdg_output_done = FALSE;
|
||||
|
||||
@@ -2490,8 +2455,8 @@ xdg_output_handle_logical_position (void *data,
|
||||
GDK_DEBUG (MISC, "handle logical position xdg-output %d, position %d %d",
|
||||
monitor->id, x, y);
|
||||
|
||||
monitor->xdg_output_geometry.x = x;
|
||||
monitor->xdg_output_geometry.y = y;
|
||||
monitor->x = x;
|
||||
monitor->y = y;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2505,8 +2470,8 @@ xdg_output_handle_logical_size (void *data,
|
||||
GDK_DEBUG (MISC, "handle logical size xdg-output %d, size %d %d",
|
||||
monitor->id, width, height);
|
||||
|
||||
monitor->xdg_output_geometry.width = width;
|
||||
monitor->xdg_output_geometry.height = height;
|
||||
monitor->width = width;
|
||||
monitor->height = height;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2592,8 +2557,8 @@ output_handle_geometry (void *data,
|
||||
make, model,
|
||||
transform_to_string (transform));
|
||||
|
||||
monitor->output_geometry.x = x;
|
||||
monitor->output_geometry.y = y;
|
||||
monitor->x = x;
|
||||
monitor->y = y;
|
||||
|
||||
switch (transform)
|
||||
{
|
||||
@@ -2637,12 +2602,28 @@ output_handle_scale (void *data,
|
||||
int32_t scale)
|
||||
{
|
||||
GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)data;
|
||||
GdkRectangle previous_geometry;
|
||||
int previous_scale;
|
||||
int width;
|
||||
int height;
|
||||
|
||||
GDK_DEBUG (MISC, "handle scale output %d, scale %d", monitor->id, scale);
|
||||
|
||||
gdk_monitor_get_geometry (GDK_MONITOR (monitor), &previous_geometry);
|
||||
previous_scale = gdk_monitor_get_scale_factor (GDK_MONITOR (monitor));
|
||||
|
||||
/* Set the scale from wl_output protocol, regardless of xdg-output support */
|
||||
gdk_monitor_set_scale_factor (GDK_MONITOR (monitor), scale);
|
||||
|
||||
if (monitor_has_xdg_output (monitor))
|
||||
return;
|
||||
|
||||
width = previous_geometry.width * previous_scale;
|
||||
height = previous_geometry.height * previous_scale;
|
||||
|
||||
monitor->width = width / scale;
|
||||
monitor->height = height / scale;
|
||||
|
||||
if (should_update_monitor (monitor))
|
||||
apply_monitor_change (monitor);
|
||||
}
|
||||
@@ -2656,6 +2637,7 @@ output_handle_mode (void *data,
|
||||
int refresh)
|
||||
{
|
||||
GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)data;
|
||||
int scale;
|
||||
|
||||
GDK_DEBUG (MISC, "handle mode output %d, size %d %d, rate %d",
|
||||
monitor->id, width, height, refresh);
|
||||
@@ -2663,8 +2645,9 @@ output_handle_mode (void *data,
|
||||
if ((flags & WL_OUTPUT_MODE_CURRENT) == 0)
|
||||
return;
|
||||
|
||||
monitor->output_geometry.width = width;
|
||||
monitor->output_geometry.height = height;
|
||||
scale = gdk_monitor_get_scale_factor (GDK_MONITOR (monitor));
|
||||
monitor->width = width / scale;
|
||||
monitor->height = height / scale;
|
||||
gdk_monitor_set_refresh_rate (GDK_MONITOR (monitor), refresh);
|
||||
|
||||
if (should_update_monitor (monitor) || !monitor_has_xdg_output (monitor))
|
||||
|
||||
@@ -87,8 +87,9 @@ static void
|
||||
gdk_wayland_gl_context_empty_frame (GdkDrawContext *draw_context)
|
||||
{
|
||||
GdkSurface *surface = gdk_draw_context_get_surface (draw_context);
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
|
||||
if (gdk_wayland_surface_needs_commit (surface))
|
||||
if (impl->has_pending_subsurface_commits)
|
||||
{
|
||||
gdk_wayland_surface_sync (surface);
|
||||
gdk_wayland_surface_request_frame (surface);
|
||||
|
||||
@@ -31,10 +31,11 @@ struct _GdkWaylandMonitor {
|
||||
gboolean added;
|
||||
|
||||
struct zxdg_output_v1 *xdg_output;
|
||||
/* Raw wl_output data */
|
||||
GdkRectangle output_geometry;
|
||||
/* Raw xdg_output data */
|
||||
GdkRectangle xdg_output_geometry;
|
||||
/* Size and position, can be either from wl_output or xdg_output */
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
int32_t width;
|
||||
int32_t height;
|
||||
char *name;
|
||||
char *description;
|
||||
gboolean wl_output_done;
|
||||
|
||||
@@ -1012,7 +1012,7 @@ gdk_wayland_surface_create_xdg_popup (GdkWaylandPopup *wayland_popup,
|
||||
}
|
||||
}
|
||||
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "wayland", "surface commit");
|
||||
wl_surface_commit (impl->display_server.wl_surface);
|
||||
|
||||
if (GDK_IS_POPUP (surface))
|
||||
|
||||
@@ -129,7 +129,6 @@ guint _gdk_wayland_cursor_get_next_image_index (GdkWaylandDisplay *display,
|
||||
guint *next_image_delay);
|
||||
|
||||
void gdk_wayland_surface_sync (GdkSurface *surface);
|
||||
gboolean gdk_wayland_surface_needs_commit (GdkSurface *surface);
|
||||
void gdk_wayland_surface_commit (GdkSurface *surface);
|
||||
void gdk_wayland_surface_notify_committed (GdkSurface *surface);
|
||||
void gdk_wayland_surface_request_frame (GdkSurface *surface);
|
||||
|
||||
@@ -3629,10 +3629,7 @@ tablet_pad_handle_leave (void *data,
|
||||
wp_tablet_pad, surface);
|
||||
|
||||
if (pad->current_tablet)
|
||||
{
|
||||
pad->current_tablet->pads = g_list_remove (pad->current_tablet->pads, pad);
|
||||
pad->current_tablet = NULL;
|
||||
}
|
||||
pad->current_tablet->pads = g_list_remove (pad->current_tablet->pads, pad);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -22,11 +22,12 @@ struct _GdkWaylandSubsurface
|
||||
|
||||
GdkTexture *texture;
|
||||
cairo_rectangle_int_t dest;
|
||||
graphene_rect_t source;
|
||||
|
||||
struct wl_region *opaque_region;
|
||||
|
||||
struct wl_callback *frame_callback;
|
||||
|
||||
gboolean above_parent;
|
||||
};
|
||||
|
||||
struct _GdkWaylandSubsurfaceClass
|
||||
|
||||
@@ -152,8 +152,7 @@ get_wl_buffer (GdkWaylandSubsurface *self,
|
||||
static gboolean
|
||||
gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
||||
GdkTexture *texture,
|
||||
const graphene_rect_t *source,
|
||||
const graphene_rect_t *dest,
|
||||
const graphene_rect_t *rect,
|
||||
gboolean above,
|
||||
GdkSubsurface *sibling)
|
||||
{
|
||||
@@ -167,8 +166,8 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
||||
graphene_rect_t device_rect;
|
||||
cairo_rectangle_int_t device_dest;
|
||||
|
||||
if (sibling)
|
||||
will_be_above = sibling->above_parent;
|
||||
if (sib)
|
||||
will_be_above = sib->above_parent;
|
||||
else
|
||||
will_be_above = above;
|
||||
|
||||
@@ -178,37 +177,30 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
self->dest.x = dest->origin.x;
|
||||
self->dest.y = dest->origin.y;
|
||||
self->dest.width = dest->size.width;
|
||||
self->dest.height = dest->size.height;
|
||||
|
||||
self->source.origin.x = source->origin.x;
|
||||
self->source.origin.y = source->origin.y;
|
||||
self->source.size.width = source->size.width;
|
||||
self->source.size.height = source->size.height;
|
||||
self->dest.x = rect->origin.x;
|
||||
self->dest.y = rect->origin.y;
|
||||
self->dest.width = rect->size.width;
|
||||
self->dest.height = rect->size.height;
|
||||
|
||||
scale = gdk_fractional_scale_to_double (&parent->scale);
|
||||
|
||||
device_rect.origin.x = dest->origin.x * scale;
|
||||
device_rect.origin.y = dest->origin.y * scale;
|
||||
device_rect.size.width = dest->size.width * scale;
|
||||
device_rect.size.height = dest->size.height * scale;
|
||||
|
||||
device_rect.origin.x = rect->origin.x * scale;
|
||||
device_rect.origin.y = rect->origin.y * scale;
|
||||
device_rect.size.width = rect->size.width * scale;
|
||||
device_rect.size.height = rect->size.height * scale;
|
||||
device_dest.x = device_rect.origin.x;
|
||||
device_dest.y = device_rect.origin.y;
|
||||
device_dest.width = device_rect.size.width;
|
||||
device_dest.height = device_rect.size.height;
|
||||
|
||||
if (self->dest.x != dest->origin.x ||
|
||||
self->dest.y != dest->origin.y ||
|
||||
self->dest.width != dest->size.width ||
|
||||
self->dest.height != dest->size.height)
|
||||
if (self->dest.x != rect->origin.x ||
|
||||
self->dest.y != rect->origin.y ||
|
||||
self->dest.width != rect->size.width ||
|
||||
self->dest.height != rect->size.height)
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
||||
"Non-integer coordinates %g %g %g %g for %dx%d texture, hiding subsurface %p",
|
||||
dest->origin.x, dest->origin.y,
|
||||
dest->size.width, dest->size.height,
|
||||
rect->origin.x, rect->origin.y,
|
||||
rect->size.width, rect->size.height,
|
||||
gdk_texture_get_width (texture),
|
||||
gdk_texture_get_height (texture),
|
||||
self);
|
||||
@@ -304,11 +296,6 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
||||
{
|
||||
wl_subsurface_set_position (self->subsurface, self->dest.x, self->dest.y);
|
||||
wp_viewport_set_destination (self->viewport, self->dest.width, self->dest.height);
|
||||
wp_viewport_set_source (self->viewport,
|
||||
wl_fixed_from_double (self->source.origin.x),
|
||||
wl_fixed_from_double (self->source.origin.y),
|
||||
wl_fixed_from_double (self->source.size.width),
|
||||
wl_fixed_from_double (self->source.size.height));
|
||||
|
||||
if (buffer)
|
||||
{
|
||||
@@ -335,6 +322,8 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
||||
wl_subsurface_place_above (self->subsurface, sib->surface);
|
||||
else
|
||||
wl_subsurface_place_below (self->subsurface, sib->surface);
|
||||
|
||||
self->above_parent = sib->above_parent;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -344,6 +333,7 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
||||
else
|
||||
wl_subsurface_place_below (self->subsurface,
|
||||
GDK_WAYLAND_SURFACE (sub->parent)->display_server.wl_surface);
|
||||
self->above_parent = above;
|
||||
}
|
||||
|
||||
wl_surface_commit (self->surface);
|
||||
@@ -383,27 +373,23 @@ gdk_wayland_subsurface_get_texture (GdkSubsurface *sub)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_subsurface_get_dest (GdkSubsurface *sub,
|
||||
graphene_rect_t *dest)
|
||||
gdk_wayland_subsurface_get_rect (GdkSubsurface *sub,
|
||||
graphene_rect_t *rect)
|
||||
{
|
||||
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
|
||||
|
||||
dest->origin.x = self->dest.x;
|
||||
dest->origin.y = self->dest.y;
|
||||
dest->size.width = self->dest.width;
|
||||
dest->size.height = self->dest.height;
|
||||
rect->origin.x = self->dest.x;
|
||||
rect->origin.y = self->dest.y;
|
||||
rect->size.width = self->dest.width;
|
||||
rect->size.height = self->dest.height;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_subsurface_get_source (GdkSubsurface *sub,
|
||||
graphene_rect_t *source)
|
||||
static gboolean
|
||||
gdk_wayland_subsurface_is_above_parent (GdkSubsurface *sub)
|
||||
{
|
||||
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
|
||||
GdkWaylandSubsurface *self = (GdkWaylandSubsurface *)sub;
|
||||
|
||||
source->origin.x = self->source.origin.x;
|
||||
source->origin.y = self->source.origin.y;
|
||||
source->size.width = self->source.size.width;
|
||||
source->size.height = self->source.size.height;
|
||||
return self->above_parent;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -417,8 +403,8 @@ gdk_wayland_subsurface_class_init (GdkWaylandSubsurfaceClass *class)
|
||||
subsurface_class->attach = gdk_wayland_subsurface_attach;
|
||||
subsurface_class->detach = gdk_wayland_subsurface_detach;
|
||||
subsurface_class->get_texture = gdk_wayland_subsurface_get_texture;
|
||||
subsurface_class->get_source = gdk_wayland_subsurface_get_source;
|
||||
subsurface_class->get_dest = gdk_wayland_subsurface_get_dest;
|
||||
subsurface_class->get_rect = gdk_wayland_subsurface_get_rect;
|
||||
subsurface_class->is_above_parent = gdk_wayland_subsurface_is_above_parent;
|
||||
};
|
||||
|
||||
static void
|
||||
@@ -492,6 +478,8 @@ gdk_wayland_surface_create_subsurface (GdkSurface *surface)
|
||||
wl_region_add (sub->opaque_region, 0, 0, G_MAXINT, G_MAXINT);
|
||||
wl_surface_set_opaque_region (sub->surface, sub->opaque_region);
|
||||
|
||||
sub->above_parent = TRUE;
|
||||
|
||||
GDK_DISPLAY_DEBUG (display, OFFLOAD, "Subsurface %p of surface %p created", sub, impl);
|
||||
|
||||
return GDK_SUBSURFACE (sub);
|
||||
|
||||
@@ -199,25 +199,19 @@ get_egl_window_size (GdkSurface *surface,
|
||||
GdkDisplay *display = gdk_surface_get_display (surface);
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (display, GL_NO_FRACTIONAL))
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (display, GL_FRACTIONAL))
|
||||
{
|
||||
*width = surface->width * gdk_fractional_scale_to_int (&impl->scale);
|
||||
*height = surface->height * gdk_fractional_scale_to_int (&impl->scale);
|
||||
GDK_DISPLAY_DEBUG (display, OPENGL, "Using fractional scale %g for EGL window", gdk_fractional_scale_to_double (&impl->scale));
|
||||
|
||||
GDK_DISPLAY_DEBUG (display, OPENGL, "Using integer scale %d for EGL window (%d %d => %d %d)",
|
||||
gdk_fractional_scale_to_int (&impl->scale),
|
||||
surface->width, surface->height,
|
||||
*width, *height);
|
||||
*width = gdk_fractional_scale_scale (&impl->scale, surface->width),
|
||||
*height = gdk_fractional_scale_scale (&impl->scale, surface->height);
|
||||
}
|
||||
else
|
||||
{
|
||||
*width = gdk_fractional_scale_scale (&impl->scale, surface->width),
|
||||
*height = gdk_fractional_scale_scale (&impl->scale, surface->height);
|
||||
GDK_DISPLAY_DEBUG (display, OPENGL, "Using integer scale %d for EGL window", gdk_fractional_scale_to_int (&impl->scale));
|
||||
|
||||
GDK_DISPLAY_DEBUG (display, OPENGL, "Using fractional scale %g for EGL window (%d %d => %d %d)",
|
||||
gdk_fractional_scale_to_double (&impl->scale),
|
||||
surface->width, surface->height,
|
||||
*width, *height);
|
||||
*width = surface->width * gdk_fractional_scale_to_int (&impl->scale);
|
||||
*height = surface->height * gdk_fractional_scale_to_int (&impl->scale);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -280,7 +274,7 @@ gdk_wayland_surface_frame_callback (GdkSurface *surface,
|
||||
GdkFrameClock *clock = gdk_surface_get_frame_clock (surface);
|
||||
GdkFrameTimings *timings;
|
||||
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland frame event", NULL);
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "wayland", "frame event");
|
||||
GDK_DISPLAY_DEBUG (GDK_DISPLAY (display_wayland), EVENTS, "frame %p", surface);
|
||||
|
||||
g_clear_pointer (&impl->frame_callback, wl_callback_destroy);
|
||||
@@ -652,12 +646,9 @@ gdk_wayland_surface_sync_opaque_region (GdkSurface *surface)
|
||||
cairo_region_t *region = cairo_region_copy (impl->opaque_region);
|
||||
for (gsize i = 0; i < gdk_surface_get_n_subsurfaces (surface); i++)
|
||||
{
|
||||
GdkSubsurface *subsurface = gdk_surface_get_subsurface (surface, i);
|
||||
GdkWaylandSubsurface *sub = (GdkWaylandSubsurface *) subsurface;
|
||||
|
||||
if (subsurface->above_parent)
|
||||
GdkWaylandSubsurface *sub = (GdkWaylandSubsurface *)gdk_surface_get_subsurface (surface, i);
|
||||
if (sub->above_parent)
|
||||
continue;
|
||||
|
||||
if (sub->texture != NULL)
|
||||
cairo_region_subtract_rectangle (region, &sub->dest);
|
||||
}
|
||||
@@ -755,18 +746,6 @@ gdk_wayland_surface_sync (GdkSurface *surface)
|
||||
gdk_wayland_surface_sync_viewport (surface);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_wayland_surface_needs_commit (GdkSurface *surface)
|
||||
{
|
||||
GdkWaylandSurface *self = GDK_WAYLAND_SURFACE (surface);
|
||||
|
||||
return self->has_pending_subsurface_commits ||
|
||||
self->opaque_region_dirty ||
|
||||
self->input_region_dirty ||
|
||||
self->buffer_scale_dirty ||
|
||||
self->viewport_dirty;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_surface_fractional_scale_preferred_scale_cb (void *data,
|
||||
struct wp_fractional_scale_v1 *fractional_scale,
|
||||
|
||||
@@ -458,49 +458,6 @@ gdk_wayland_toplevel_compute_size (GdkSurface *surface)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
has_per_edge_tiling_info (GdkToplevelState state)
|
||||
{
|
||||
return state & (GDK_TOPLEVEL_STATE_TOP_TILED |
|
||||
GDK_TOPLEVEL_STATE_RIGHT_TILED |
|
||||
GDK_TOPLEVEL_STATE_BOTTOM_TILED |
|
||||
GDK_TOPLEVEL_STATE_LEFT_TILED);
|
||||
}
|
||||
|
||||
static GdkToplevelState
|
||||
infer_edge_constraints (GdkToplevelState state)
|
||||
{
|
||||
if (state & (GDK_TOPLEVEL_STATE_MAXIMIZED | GDK_TOPLEVEL_STATE_FULLSCREEN))
|
||||
return state;
|
||||
|
||||
if (!(state & GDK_TOPLEVEL_STATE_TILED) || !has_per_edge_tiling_info (state))
|
||||
return state |
|
||||
GDK_TOPLEVEL_STATE_TOP_RESIZABLE |
|
||||
GDK_TOPLEVEL_STATE_RIGHT_RESIZABLE |
|
||||
GDK_TOPLEVEL_STATE_BOTTOM_RESIZABLE |
|
||||
GDK_TOPLEVEL_STATE_LEFT_RESIZABLE;
|
||||
|
||||
if (!(state & GDK_TOPLEVEL_STATE_TOP_TILED))
|
||||
state |= GDK_TOPLEVEL_STATE_TOP_RESIZABLE;
|
||||
if (!(state & GDK_TOPLEVEL_STATE_RIGHT_TILED))
|
||||
state |= GDK_TOPLEVEL_STATE_RIGHT_RESIZABLE;
|
||||
if (!(state & GDK_TOPLEVEL_STATE_BOTTOM_TILED))
|
||||
state |= GDK_TOPLEVEL_STATE_BOTTOM_RESIZABLE;
|
||||
if (!(state & GDK_TOPLEVEL_STATE_LEFT_TILED))
|
||||
state |= GDK_TOPLEVEL_STATE_LEFT_RESIZABLE;
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
supports_native_edge_constraints (GdkWaylandToplevel*toplevel)
|
||||
{
|
||||
struct gtk_surface1 *gtk_surface = toplevel->display_server.gtk_surface;
|
||||
if (!gtk_surface)
|
||||
return FALSE;
|
||||
return gtk_surface1_get_version (gtk_surface) >= GTK_SURFACE1_CONFIGURE_EDGES_SINCE_VERSION;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_toplevel_handle_configure (GdkWaylandSurface *wayland_surface)
|
||||
{
|
||||
@@ -518,9 +475,6 @@ gdk_wayland_toplevel_handle_configure (GdkWaylandSurface *wayland_surface)
|
||||
new_state = wayland_toplevel->pending.state;
|
||||
wayland_toplevel->pending.state = 0;
|
||||
|
||||
if (!supports_native_edge_constraints (wayland_toplevel))
|
||||
new_state = infer_edge_constraints (new_state);
|
||||
|
||||
is_resizing = wayland_toplevel->pending.is_resizing;
|
||||
wayland_toplevel->pending.is_resizing = FALSE;
|
||||
|
||||
@@ -876,7 +830,7 @@ gdk_wayland_surface_create_xdg_toplevel (GdkWaylandToplevel *wayland_toplevel)
|
||||
maybe_set_gtk_surface_dbus_properties (wayland_toplevel);
|
||||
maybe_set_gtk_surface_modal (wayland_toplevel);
|
||||
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "wayland", "surface commit");
|
||||
wl_surface_commit (wayland_surface->display_server.wl_surface);
|
||||
}
|
||||
|
||||
@@ -2019,10 +1973,8 @@ gdk_wayland_toplevel_titlebar_gesture (GdkToplevel *toplevel,
|
||||
return FALSE;
|
||||
|
||||
seat = gdk_display_get_default_seat (surface->display);
|
||||
if (!seat)
|
||||
return FALSE;
|
||||
|
||||
wl_seat = gdk_wayland_seat_get_wl_seat (seat);
|
||||
|
||||
serial = _gdk_wayland_seat_get_last_implicit_grab_serial (GDK_WAYLAND_SEAT (seat), NULL);
|
||||
|
||||
gtk_surface1_titlebar_gesture (wayland_toplevel->display_server.gtk_surface,
|
||||
@@ -2036,7 +1988,13 @@ gdk_wayland_toplevel_titlebar_gesture (GdkToplevel *toplevel,
|
||||
static gboolean
|
||||
gdk_wayland_toplevel_supports_edge_constraints (GdkToplevel *toplevel)
|
||||
{
|
||||
return TRUE;
|
||||
GdkWaylandToplevel *wayland_toplevel = GDK_WAYLAND_TOPLEVEL (toplevel);
|
||||
struct gtk_surface1 *gtk_surface = wayland_toplevel->display_server.gtk_surface;
|
||||
|
||||
if (!gtk_surface)
|
||||
return FALSE;
|
||||
|
||||
return gtk_surface1_get_version (gtk_surface) >= GTK_SURFACE1_CONFIGURE_EDGES_SINCE_VERSION;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2197,14 +2155,15 @@ gdk_wayland_toplevel_focus (GdkToplevel *toplevel,
|
||||
GdkWaylandSurface *wayland_surface = GDK_WAYLAND_SURFACE (toplevel);
|
||||
GdkDisplay *display = gdk_surface_get_display (surface);
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||
GdkWaylandSeat *seat =
|
||||
GDK_WAYLAND_SEAT (gdk_display_get_default_seat (display));
|
||||
gchar *startup_id = NULL;
|
||||
|
||||
startup_id = g_steal_pointer (&display_wayland->startup_notification_id);
|
||||
|
||||
if (seat && display_wayland->xdg_activation)
|
||||
if (display_wayland->xdg_activation)
|
||||
{
|
||||
GdkWaylandSeat *seat =
|
||||
GDK_WAYLAND_SEAT (gdk_display_get_default_seat (display));
|
||||
|
||||
/* If the focus request does not have a startup ID associated, get a
|
||||
* new token to activate the window.
|
||||
*/
|
||||
@@ -2707,7 +2666,7 @@ gdk_wayland_toplevel_set_transient_for_exported (GdkToplevel *toplevel,
|
||||
g_return_val_if_fail (GDK_IS_WAYLAND_TOPLEVEL (toplevel), FALSE);
|
||||
g_return_val_if_fail (GDK_IS_WAYLAND_DISPLAY (display), FALSE);
|
||||
|
||||
if (!display_wayland->xdg_importer && !display_wayland->xdg_importer_v2)
|
||||
if (!display_wayland->xdg_importer)
|
||||
{
|
||||
g_warning ("Server is missing xdg_foreign support");
|
||||
return FALSE;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user