Compare commits

..

1 Commits

Author SHA1 Message Date
Matthias Clasen
6b87219df9 Extend debug var support
Make our debug variable parser handle key=value strings, provided
that a callback is provided for the key. This may be used in the
future to accept settings like

GDK_DEBUG=vsync=144fps
2024-01-22 21:08:46 -05:00
532 changed files with 23755 additions and 57183 deletions

View File

@@ -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

View File

@@ -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"

Binary file not shown.

View File

@@ -2,6 +2,8 @@ FROM fedora:39
RUN dnf -y install \
adwaita-icon-theme \
atk-devel \
at-spi2-atk-devel \
avahi-gobject-devel \
cairo-devel \
cairo-gobject-devel \
@@ -16,6 +18,7 @@ RUN dnf -y install \
dejavu-sans-mono-fonts \
desktop-file-utils \
diffutils \
docbook-style-xsl \
elfutils-libelf-devel \
expat-devel \
fribidi-devel \

View File

@@ -19,6 +19,7 @@ flatpak build ${builddir} meson \
--buildtype=debugoptimized \
-Dx11-backend=true \
-Dwayland-backend=true \
-Dvulkan=disabled \
-Dbuild-tests=false \
-Dbuild-testsuite=false \
-Dbuild-examples=false \

View File

@@ -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 || :

View File

@@ -34,8 +34,7 @@ pacman --noconfirm -S --needed \
mingw-w64-$MSYS2_ARCH-shared-mime-info \
mingw-w64-$MSYS2_ARCH-python-gobject \
mingw-w64-$MSYS2_ARCH-shaderc \
mingw-w64-$MSYS2_ARCH-vulkan \
mingw-w64-$MSYS2_ARCH-vulkan-headers
mingw-w64-$MSYS2_ARCH-vulkan
mkdir -p _ccache
export CCACHE_BASEDIR="$(pwd)"
@@ -45,7 +44,7 @@ export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
ccache --zero-stats
ccache --show-stats
export CCACHE_DISABLE=true
meson setup \
meson \
-Dx11-backend=false \
-Dwayland-backend=false \
-Dwin32-backend=true \

373
NEWS
View File

@@ -1,377 +1,6 @@
Overview of Changes in 4.15.0, xx-xx-xxxx
Overview of Changes in 4.13.6, xx-xx-xxxx
=========================================
Overview of Changes in 4.14.2, 03-04-2024
=========================================
* GtkScale:
- Improve positioning of values in some cases
* Theme:
- Make progress in entries visible
* Accessibility:
- Fix text insertion handling
* GDK:
- dnd: Use the default cursor durion motion
- dnd: Use a better cursor for indicating the move action
* GSK:
- gl: Handle offloads in offscreen context better
- Fix text rendering problems with some fonts
* Wayland:
- Tighten up some protocol version checks
- Use the presentation time protocol
- Fix a crash with subsurfaces
- Improve settings portal handling
* macOS:
- Fix up the app menu support
* Windows:
- Fix problems with minimization
- Fix build without fontconfig
* Debugging:
- Add font settings in the inspector
* Demos:
- Clean up the application demo
- Update cursor images for the cursor demo
* Translation updates:
Catalan
Czech
French
Georgian
Hebrew
Persian
Slovenian
Turkish
Ukrainian
Overview of Changes in 4.14.1, 16-03-2024
=========================================
* GtkTextView:
- Fix a mixup of cursor and anchor when retrieving surrounding text
in input methods
* Printing:
- Avoid accessing freed printers
* Accessibility:
- Fix memory leaks
* GDK:
- Rename the GDK_VULKAN_SKIP environment variable to GDK_VULKAN_DISABLE
- Add a GDK_GL_DISABLE environment variable
* GSK:
- Rename the GSK_GPU_SKIP environment variable to GSK_GPU_DISABLE
- Speed up handling of repeated ops, which should help for text
- Speed up the inner loop of text node conversion
- Drop the glyph-align optimization flag
- ngl: Avoid reusing frames while they are in use
- Fix flickering thumbnails in nautilus
- Speed up buffer handling in both ngl and Vulkan
* Demos:
- Skip demos using gl shaders when we're not using the gl renderer
* Build:
- Fix some ubsan warnings
- Avoid zink in ci since it spams stderr
* Translation updates:
Czech
German
Korean
Russian
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
=========================================

View File

@@ -125,7 +125,7 @@ version, for example `gtk-4-10`.
How to report bugs
------------------
Bugs should be reported on the [issues page](https://gitlab.gnome.org/GNOME/gtk/issues/).
Bugs should be reported on the [issues page](https://gitlab.gnome.org/GNOME/gtk/issues/new).
In the bug report please include:

View File

@@ -185,6 +185,7 @@
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized",
"-Ddemo-profile=devel"
],

View File

@@ -114,6 +114,7 @@
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized",
"-Ddemo-profile=devel"
],

View File

@@ -114,6 +114,7 @@
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized",
"-Ddemo-profile=devel"
],
@@ -130,6 +131,7 @@
"env" : {
"DBUS_SESSION_BUS_ADDRESS" : "''",
"GSK_RENDERER" : "opengl",
"GDK_DEBUG" : "vulkan-disable",
"G_ENABLE_DEBUG" : "true"
}
}

View File

@@ -114,6 +114,7 @@
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized",
"-Ddemo-profile=devel"
],
@@ -130,6 +131,7 @@
"env" : {
"DBUS_SESSION_BUS_ADDRESS" : "''",
"GSK_RENDERER" : "opengl",
"GDK_DEBUG" : "vulkan-disable",
"G_ENABLE_DEBUG" : "true"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -15,54 +15,12 @@ on_destroy (gpointer data)
window = NULL;
}
static GdkTexture *
cursor_callback (GdkCursor *cursor,
int cursor_size,
double scale,
int *width,
int *height,
int *hotspot_x,
int *hotspot_y,
gpointer data)
{
GdkPixbuf *pixbuf;
GdkTexture *texture;
GError *error = NULL;
int scaled_size;
scaled_size = ceil (cursor_size * scale);
pixbuf = gdk_pixbuf_new_from_resource_at_scale ("/cursors/images/gtk-logo.svg",
scaled_size, scaled_size,
TRUE,
&error);
if (!pixbuf)
{
g_print ("%s\n", error->message);
g_error_free (error);
return NULL;
}
texture = gdk_texture_new_for_pixbuf (pixbuf);
g_object_unref (pixbuf);
*width = cursor_size;
*height = cursor_size;
*hotspot_x = 18 * cursor_size / 32.0;
*hotspot_y = 2 * cursor_size / 32.0;
return texture;
}
GtkWidget *
do_cursors (GtkWidget *do_widget)
{
if (!window)
{
GtkBuilder *builder;
GtkWidget *logo_callback;
GdkCursor *cursor;
builder = gtk_builder_new_from_resource ("/cursors/cursors.ui");
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
@@ -71,10 +29,6 @@ do_cursors (GtkWidget *do_widget)
gtk_widget_get_display (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (on_destroy), NULL);
logo_callback = GTK_WIDGET (gtk_builder_get_object (builder, "logo_callback"));
cursor = gdk_cursor_new_from_callback (cursor_callback, NULL, NULL, NULL);
gtk_widget_set_cursor (logo_callback, cursor);
g_object_unref (cursor);
g_object_unref (builder);
}

File diff suppressed because it is too large Load Diff

View File

@@ -116,7 +116,6 @@
<file>w_resize_cursor.png</file>
<file>zoom_in_cursor.png</file>
<file>zoom_out_cursor.png</file>
<file>gtk-logo.svg</file>
</gresource>
<gresource prefix="/dnd">
<file>dnd.css</file>

View File

@@ -184,12 +184,6 @@ create_cogs (void)
return picture;
}
static gboolean
check_cogs (GtkFishbowl *fb)
{
return GSK_IS_GL_RENDERER (gtk_native_get_renderer (gtk_widget_get_native (GTK_WIDGET (fb))));
}
static void
mapped (GtkWidget *w)
{
@@ -224,41 +218,36 @@ create_graph (void)
static const struct {
const char *name;
GtkWidget * (* create_func) (void);
gboolean (* check) (GtkFishbowl *fb);
GtkWidget * (*create_func) (void);
} widget_types[] = {
{ "Icon", create_icon, NULL },
{ "Button", create_button, NULL },
{ "Blurbutton", create_blurred_button, NULL },
{ "Fontbutton", create_font_button, NULL },
{ "Levelbar", create_level_bar, NULL },
{ "Label", create_label, NULL },
{ "Spinner", create_spinner, NULL },
{ "Spinbutton", create_spinbutton, NULL },
{ "Video", create_video, NULL },
{ "Gears", create_gears, NULL },
{ "Switch", create_switch, NULL },
{ "Menubutton", create_menu_button, NULL },
{ "Shader", create_cogs, check_cogs },
{ "Tiger", create_tiger, NULL },
{ "Graph", create_graph, NULL },
{ "Icon", create_icon },
{ "Button", create_button },
{ "Blurbutton", create_blurred_button },
{ "Fontbutton", create_font_button },
{ "Levelbar", create_level_bar },
{ "Label", create_label },
{ "Spinner", create_spinner },
{ "Spinbutton", create_spinbutton },
{ "Video", create_video },
{ "Gears", create_gears },
{ "Switch", create_switch },
{ "Menubutton", create_menu_button },
{ "Shader", create_cogs },
{ "Tiger", create_tiger },
{ "Graph", create_graph },
};
static int selected_widget_type = -1;
static const int N_WIDGET_TYPES = G_N_ELEMENTS (widget_types);
static gboolean
static void
set_widget_type (GtkFishbowl *fishbowl,
int widget_type_index)
{
GtkWidget *window;
if (widget_type_index == selected_widget_type)
return TRUE;
if (widget_types[widget_type_index].check != NULL &&
!widget_types[widget_type_index].check (fishbowl))
return FALSE;
return;
selected_widget_type = widget_type_index;
@@ -268,8 +257,6 @@ set_widget_type (GtkFishbowl *fishbowl,
window = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (fishbowl)));
gtk_window_set_title (GTK_WINDOW (window),
widget_types[selected_widget_type].name);
return TRUE;
}
G_MODULE_EXPORT void
@@ -277,17 +264,14 @@ fishbowl_next_button_clicked_cb (GtkButton *source,
gpointer user_data)
{
GtkFishbowl *fishbowl = user_data;
int new_index = selected_widget_type;
int new_index;
do
{
if (new_index + 1 >= N_WIDGET_TYPES)
new_index = 0;
else
new_index = new_index + 1;
if (selected_widget_type + 1 >= N_WIDGET_TYPES)
new_index = 0;
else
new_index = selected_widget_type + 1;
}
while (!set_widget_type (fishbowl, new_index));
set_widget_type (fishbowl, new_index);
}
G_MODULE_EXPORT void
@@ -295,18 +279,14 @@ fishbowl_prev_button_clicked_cb (GtkButton *source,
gpointer user_data)
{
GtkFishbowl *fishbowl = user_data;
int new_index = selected_widget_type;
int new_index;
do
{
if (new_index - 1 < 0)
new_index = N_WIDGET_TYPES - 1;
else
new_index = new_index - 1;
if (selected_widget_type - 1 < 0)
new_index = N_WIDGET_TYPES - 1;
else
new_index = selected_widget_type - 1;
}
while (!set_widget_type (fishbowl, new_index));
set_widget_type (fishbowl, new_index);
}
G_MODULE_EXPORT void

View File

@@ -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);

View File

@@ -1,138 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="128"
height="128"
id="svg6843"
sodipodi:version="0.32"
inkscape:version="0.92.4 5da689c313, 2019-01-14"
version="1.0"
sodipodi:docname="gtk-logo.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
inkscape:export-filename="/home/ebassi/Pictures/gtk-logo-256.png"
inkscape:export-xdpi="192"
inkscape:export-ydpi="192">
<defs
id="defs6845">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="-50 : 600 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="700 : 600 : 1"
inkscape:persp3d-origin="300 : 400 : 1"
id="perspective13" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:zoom="2.8284271"
inkscape:cx="69.874353"
inkscape:cy="64.313526"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:document-units="px"
inkscape:grid-bbox="true"
width="128px"
height="128px"
showguides="true"
inkscape:guide-bbox="true"
inkscape:window-width="1920"
inkscape:window-height="1016"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1">
<inkscape:grid
type="xygrid"
id="grid7947" />
</sodipodi:namedview>
<metadata
id="metadata6848">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
<dc:date />
<dc:creator>
<cc:Agent>
<dc:title />
</cc:Agent>
</dc:creator>
<dc:rights>
<cc:Agent>
<dc:title />
</cc:Agent>
</dc:rights>
<dc:publisher>
<cc:Agent>
<dc:title />
</cc:Agent>
</dc:publisher>
<dc:identifier />
<dc:source />
<dc:relation />
<dc:language />
<dc:subject>
<rdf:Bag />
</dc:subject>
<dc:coverage />
<dc:description />
<dc:contributor>
<cc:Agent>
<dc:title />
</cc:Agent>
</dc:contributor>
<cc:license
rdf:resource="" />
</cc:Work>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<path
sodipodi:nodetypes="ccccc"
id="path6976"
d="M 20.88413,30.82696 L 53.816977,55.527708 L 107.33282,39.060543 L 70.587303,17.177763 L 20.88413,30.82696 z"
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-dasharray:none;stroke-opacity:1;display:inline" />
<path
id="path6978"
d="M 22.94243,82.287118 L 20.88413,30.82696 L 53.816977,55.527708 L 53.816977,111.10486 L 22.94243,82.287118 z"
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-dasharray:none;stroke-opacity:1;display:inline" />
<path
id="path6980"
d="M 53.816977,111.10486 L 103.21619,90.5207 L 107.33282,39.060543 L 53.816977,55.527708 L 53.816977,111.10486 z"
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-dasharray:none;stroke-opacity:1;display:inline" />
<path
sodipodi:nodetypes="ccc"
id="path6982"
d="M 23.216626,81.319479 L 70.48573,67.361442 L 103.38422,90.444516"
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
sodipodi:nodetypes="cc"
id="path6984"
d="M 70.434539,17.875593 L 70.434539,66.984877"
style="opacity:1;fill:#babdb6;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 4.8 KiB

View File

@@ -456,33 +456,43 @@ gtk_fishbowl_do_update (GtkFishbowl *fishbowl)
{
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
GdkFrameClock *frame_clock;
GdkFrameTimings *end;
gint64 end_counter;
double fps, expected_fps;
GdkFrameTimings *start, *end;
gint64 start_counter, end_counter;
gint64 n_frames, expected_frames;
gint64 start_timestamp, end_timestamp;
gint64 interval;
frame_clock = gtk_widget_get_frame_clock (GTK_WIDGET (fishbowl));
if (frame_clock == NULL)
return;
fps = gdk_frame_clock_get_fps (frame_clock);
if (fps <= 0.0)
start_counter = gdk_frame_clock_get_history_start (frame_clock);
end_counter = gdk_frame_clock_get_frame_counter (frame_clock);
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))
end_counter--;
if (end_counter - start_counter < 4)
return;
priv->framerate = fps;
start_timestamp = gdk_frame_timings_get_presentation_time (start);
end_timestamp = gdk_frame_timings_get_presentation_time (end);
if (start_timestamp == 0 || end_timestamp == 0)
{
start_timestamp = gdk_frame_timings_get_frame_time (start);
end_timestamp = gdk_frame_timings_get_frame_time (end);
}
n_frames = end_counter - start_counter;
priv->framerate = ((double) n_frames) * G_USEC_PER_SEC / (end_timestamp - start_timestamp);
priv->framerate = ((int)(priv->framerate * 100))/100.0;
g_object_notify_by_pspec (G_OBJECT (fishbowl), props[PROP_FRAMERATE]);
if (!priv->benchmark)
return;
end_counter = gdk_frame_clock_get_frame_counter (frame_clock);
for (end = gdk_frame_clock_get_timings (frame_clock, end_counter);
end != NULL && !gdk_frame_timings_get_complete (end);
end = gdk_frame_clock_get_timings (frame_clock, end_counter))
end_counter--;
if (end == NULL)
return;
interval = gdk_frame_timings_get_refresh_interval (end);
if (interval == 0)
{
@@ -490,16 +500,16 @@ gtk_fishbowl_do_update (GtkFishbowl *fishbowl)
if (interval == 0)
return;
}
expected_fps = (double) G_USEC_PER_SEC / interval;
expected_frames = round ((double) (end_timestamp - start_timestamp) / interval);
if (fps > (expected_fps - 1))
if (n_frames >= expected_frames)
{
if (priv->last_benchmark_change > 0)
priv->last_benchmark_change *= 2;
else
priv->last_benchmark_change = 1;
}
else if (0.95 * fps < expected_fps)
else if (n_frames + 1 < expected_frames)
{
if (priv->last_benchmark_change < 0)
priv->last_benchmark_change--;

View File

@@ -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

View File

@@ -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);

View File

@@ -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

View File

@@ -827,25 +827,13 @@ demo_search_changed_cb (GtkSearchEntry *entry,
gtk_filter_changed (filter, GTK_FILTER_CHANGE_DIFFERENT);
}
static gboolean
demo_can_run (GtkWidget *window,
const char *name)
{
if (name != NULL && strcmp (name, "gltransition") == 0)
return GSK_IS_GL_RENDERER (gtk_native_get_renderer (GTK_NATIVE (window)));
return TRUE;
}
static GListModel *
create_demo_model (GtkWidget *window)
create_demo_model (void)
{
GListStore *store = g_list_store_new (GTK_TYPE_DEMO);
DemoData *demo = gtk_demos;
GtkDemo *d;
gtk_widget_realize (window);
d = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
d->name = "main";
d->title = "GTK Demo";
@@ -857,20 +845,16 @@ create_demo_model (GtkWidget *window)
while (demo->title)
{
DemoData *children = demo->children;
d = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
DemoData *children = demo->children;
if (demo_can_run (window, demo->name))
{
d = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
d->name = demo->name;
d->title = demo->title;
d->keywords = demo->keywords;
d->filename = demo->filename;
d->func = demo->func;
d->name = demo->name;
d->title = demo->title;
d->keywords = demo->keywords;
d->filename = demo->filename;
d->func = demo->func;
g_list_store_append (store, d);
}
g_list_store_append (store, d);
if (children)
{
@@ -878,19 +862,15 @@ create_demo_model (GtkWidget *window)
while (children->title)
{
if (demo_can_run (window, children->name))
{
GtkDemo *child = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
GtkDemo *child = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
child->name = children->name;
child->title = children->title;
child->keywords = children->keywords;
child->filename = children->filename;
child->func = children->func;
g_list_store_append (G_LIST_STORE (d->children_model), child);
}
child->name = children->name;
child->title = children->title;
child->keywords = children->keywords;
child->filename = children->filename;
child->func = children->func;
g_list_store_append (G_LIST_STORE (d->children_model), child);
children++;
}
}
@@ -956,7 +936,7 @@ activate (GApplication *app)
search_bar = GTK_WIDGET (gtk_builder_get_object (builder, "searchbar"));
g_signal_connect (search_bar, "notify::search-mode-enabled", G_CALLBACK (clear_search), NULL);
listmodel = create_demo_model (window);
listmodel = create_demo_model ();
treemodel = gtk_tree_list_model_new (G_LIST_MODEL (listmodel),
FALSE,
TRUE,

View File

@@ -2,7 +2,7 @@
<interface>
<menu id="menubar">
<submenu>
<attribute name="label" translatable="yes">_File</attribute>
<attribute name="label" translatable="yes">_Application</attribute>
<section>
<item>
<attribute name="label" translatable="yes">_New</attribute>
@@ -33,7 +33,7 @@
</section>
</submenu>
<submenu>
<attribute name="label" translatable="yes">_Preferences</attribute>
<attribute name="label" translatable="yes">_File</attribute>
<section>
<item>
<attribute name="label" translatable="yes">_Prefer Dark Theme</attribute>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -338,7 +338,7 @@ do_path_maze (GtkWidget *do_widget)
GskPath *path;
window = gtk_window_new ();
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
gtk_window_set_title (GTK_WINDOW (window), "Follow the maze with the mouse");
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -120,7 +120,7 @@ create_shadertoy_window (GtkWidget *do_widget)
gtk_box_append (GTK_BOX (box), aspect);
shadertoy = new_shadertoy ("/shadertoy/alienplanet.glsl");
gtk_aspect_frame_set_child (GTK_ASPECT_FRAME (aspect), gtk_graphics_offload_new (shadertoy));
gtk_aspect_frame_set_child (GTK_ASPECT_FRAME (aspect), shadertoy);
sw = gtk_scrolled_window_new ();
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (sw), 250);

View File

@@ -68,9 +68,8 @@ struct _NodeEditorWindow
GArray *errors;
guint update_timeout;
gboolean auto_reload;
gboolean mark_as_safe_pending;
gulong after_paint_handler;
};
struct _NodeEditorWindowClass
@@ -246,41 +245,6 @@ highlight_text (NodeEditorWindow *self)
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)
{
@@ -289,8 +253,6 @@ reload (NodeEditorWindow *self)
float scale;
GskRenderNode *big_node;
mark_autosave_as_unsafe ();
text = get_current_text (self->text_buffer);
bytes = g_bytes_new_take (text, strlen (text));
@@ -352,8 +314,6 @@ reload (NodeEditorWindow *self)
}
g_clear_pointer (&big_node, gsk_render_node_unref);
self->mark_as_safe_pending = TRUE;
}
static void
@@ -1165,6 +1125,9 @@ node_editor_window_finalize (GObject *object)
{
NodeEditorWindow *self = (NodeEditorWindow *)object;
if (self->update_timeout)
g_source_remove (self->update_timeout);
g_array_free (self->errors, TRUE);
g_clear_pointer (&self->node, gsk_render_node_unref);
@@ -1209,7 +1172,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 +1199,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,6 +1567,23 @@ edit_action_cb (GtkWidget *widget,
node_editor_window_edit (self, &start);
}
static void
node_editor_window_map (GtkWidget *widget)
{
char *path;
GTK_WIDGET_CLASS (node_editor_window_parent_class)->map (widget);
path = get_autosave_path (NULL);
if (g_file_test (path, G_FILE_TEST_EXISTS))
{
g_free (path);
return;
}
g_free (path);
}
static void
node_editor_window_set_property (GObject *object,
guint prop_id,
@@ -1691,6 +1660,8 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
widget_class->realize = node_editor_window_realize;
widget_class->unrealize = node_editor_window_unrealize;
widget_class->map = node_editor_window_map;
properties[PROP_AUTO_RELOAD] = g_param_spec_boolean ("auto-reload", NULL, NULL,
TRUE,
G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_STATIC_NAME);
@@ -1794,16 +1765,16 @@ set_initial_text (NodeEditorWindow *self)
path = get_autosave_path (NULL);
path1 = get_autosave_path ("-unsafe");
if (g_file_get_contents (path1, &initial_text, &len, NULL))
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 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);
}
@@ -1854,6 +1825,41 @@ autosave_contents (NodeEditorWindow *self)
g_free (contents);
}
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 gboolean
update_timeout_cb (gpointer data)
{
NodeEditorWindow *self = data;
self->update_timeout = 0;
mark_autosave_as_safe ();
return G_SOURCE_REMOVE;
}
static void
initiate_autosave (NodeEditorWindow *self)
{
autosave_contents (self);
if (self->update_timeout != 0)
g_source_remove (self->update_timeout);
self->update_timeout = g_timeout_add (100, update_timeout_cb, self);
}
static void
node_editor_window_init (NodeEditorWindow *self)
{
@@ -1918,7 +1924,7 @@ node_editor_window_init (NodeEditorWindow *self)
set_initial_text (self);
g_signal_connect_swapped (self->text_buffer, "changed", G_CALLBACK (autosave_contents), self);
g_signal_connect_swapped (self->text_buffer, "changed", G_CALLBACK (initiate_autosave), self);
if (g_getenv ("GSK_RENDERER"))
{

View File

@@ -10,6 +10,10 @@
<attribute name="label" translatable="yes">_Help</attribute>
<attribute name="action">app.help</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Help</attribute>
<attribute name="action">app.help</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Inspector</attribute>
<attribute name="action">app.inspector</attribute>
@@ -209,7 +213,6 @@
<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>

View File

@@ -322,14 +322,12 @@ 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>` `<url>`? | "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.
@@ -338,15 +336,12 @@ 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
their glyph ID and advance width. Optionally, 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 |

View File

@@ -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:

View File

@@ -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"

View File

@@ -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"

View File

@@ -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",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -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",

View File

@@ -38,13 +38,13 @@ can run the build, using Ninja:
```
cd builddir
meson compile
meson install
ninja
ninja install
```
If you don't have permission to write to the directory you are
installing in, you may have to change to root temporarily before
running `meson install`.
running `ninja install`.
Several environment variables are useful to pass to set before
running *meson*. `CPPFLAGS` contains options to pass to the C
@@ -112,10 +112,10 @@ responsible for controlling the debugging features of GTK with
## Dependencies
Before you can compile GTK, you need to have various other tools and
libraries installed on your system. Dependencies of GTK have their own
build systems, so you will need to refer to their own installation
instructions.
Before you can compile the GTK widget toolkit, you need to have
various other tools and libraries installed on your
system. Dependencies of GTK have their own build systems, so
you will need to refer to their own installation instructions.
A particular important tool used by GTK to find its dependencies
is `pkg-config`.
@@ -156,8 +156,8 @@ Other libraries are maintained separately.
the development environment for these libraries that your
operating system vendor provides.
- The [fontconfig](https://www.freedesktop.org/wiki/Software/fontconfig/)
library provides Pango with a standard way of locating fonts and matching
them against font names.
library provides Pango with a standard way of locating
fonts and matching them against font names.
- [Cairo](https://www.cairographics.org) is a graphics library that
supports vector graphics and image compositing. Both Pango and GTK
use Cairo for drawing. Note that we also need the auxiliary cairo-gobject
@@ -220,12 +220,13 @@ meson configure builddir
### `x11-backend`, `win32-backend`, `broadway-backend`, `wayland-backend` and `macos-backend`
Enable specific backends for GDK. If none of these options are given, the
Wayland backend will be enabled by default, if the platform is Linux; the
X11 backend will also be enabled by default, unless the platform is Windows,
in which case the default is win32, or the platform is macOS, in which case
the default is macOS. If any backend is explicitly enabled or disabled, no
other platform will be enabled automatically.
Enable specific backends for GDK. If none of these options
are given, the Wayland backend will be enabled by default,
if the platform is Linux; the X11 backend will also be enabled
by default, unless the platform is Windows, in which case the
default is win32, or the platform is macOS, in which case the
default is macOS. If any backend is explicitly enabled or disabled,
no other platform will be enabled automatically.
### `vulkan`
@@ -233,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

View File

@@ -1,7 +1,7 @@
Title: CSS in GTK
Slug: css
This chapter describes how GTK uses CSS for styling and layout.
This chapter describes how GTK uses CSS for styling and layout.
It is not meant to be an explanation of CSS from first principles,
but focuses on listing supported CSS features and differences
between Web CSS and GTK.

View File

@@ -13,7 +13,6 @@ 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>
@@ -76,21 +75,7 @@ and prints the runtimes.
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.`

View File

@@ -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",

View File

@@ -28,9 +28,6 @@ GTK depends on the following libraries:
- **OpenGL**: OpenGL is the premier environment for developing portable,
interactive 2D and 3D graphics applications. More information available
on the [Khronos website][opengl].
- **Vulkan**: Vulkan is the a newer graphics API, that can be considered
the successor of OpenGL. More information available on the
[Khronos website][vulkan].
- **Pango**: Pango is a library for internationalized text handling. It
centers around the `PangoLayout` object, representing a paragraph of
text. Pango provides the engine for `GtkTextView`, `GtkLabel`,
@@ -63,7 +60,6 @@ GTK is divided into three parts:
[gio]: https://developer.gnome.org/gio/stable/
[cairo]: https://www.cairographics.org/manual/
[opengl]: https://www.opengl.org/about/
[vulkan]: https://www.vulkan.org/
[pango]: https://pango.gnome.org/
[gdkpixbuf]: https://developer.gnome.org/gdk-pixbuf/stable/
[graphene]: https://ebassi.github.io/graphene/

View File

@@ -27,7 +27,7 @@ the question you have, this list is a good place to start.
Every major version of GTK comes with a [migration guide](#migrating). You may also
find useful information in the documentation for specific widgets and functions. If
you have a question not covered in the manual, feel free to ask, and please
[file a bug report](https://gitlab.gnome.org/GNOME/gtk/issues/) against the
[file a bug report](https://gitlab.gnome.org/GNOME/gtk/issues/new) against the
documentation.
* Should I maintain parallel versions of my UI in GTK x and GTK y?
@@ -54,7 +54,7 @@ the question you have, this list is a good place to start.
For strings returned from functions, they will be declared "const" if they should
not be freed. Non-const strings should be freed with `g_free()`. Arrays follow the
same rule. If you find an undocumented exception to the rules, please
[file a bug report.](https://gitlab.gnome.org/GNOME/gtk/issues/).
[file a bug report.](https://gitlab.gnome.org/GNOME/gtk/issues/new).
The transfer annotations for gobject-introspection that are part of the
documentation can provide useful hints for memory handling semantics as well.

View File

@@ -4,7 +4,7 @@ Slug: gtk-resources
## Opening a bug or feature request
If you encounter a bug, misfeature, or missing feature in GTK, please
file a bug report on our [GitLab project](https://gitlab.gnome.org/GNOME/gtk/issues/).
file a bug report on our [GitLab project](https://gitlab.gnome.org/GNOME/gtk/issues/new).
You should also file issues if the documentation is out of date with the
existing API, or unclear.

View File

@@ -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
@@ -278,11 +278,14 @@ are only available when GTK has been configured with `-Ddebug=true`.
: OpenGL renderer information
`vulkan`
: Check Vulkan errors
: Vulkan renderer information
`shaders`
: Information about shaders
`surface`
: Information about surfaces
`fallback`
: Information about fallback usage in renderers
@@ -300,6 +303,9 @@ A number of options affect behavior instead of logging:
`full-redraw`
: Force full redraws
`sync`
: Sync after each frame
`staging`
: Use a staging image for texture upload (Vulkan only)
@@ -341,28 +347,6 @@ a `*`, which means: try all remaining backends. The special value
backends. For more information about selecting backends,
see the [func@Gdk.DisplayManager.get] function.
### `GDK_GL_DISABLE`
This variable can be set to a list of values, which cause GDK to
disable extension features of the OpenGL support.
Note that these features may already be disabled if the GL driver
does not support them.
`debug`
: GL_KHR_debug
`unpack-subimage`
:GL_EXT_unpack_subimage
`half-float`
:GL_OES_vertex_half_float
`sync`
:GL_ARB_sync
`base-instance`
:GL_EXT_base_instance
### `GDK_VULKAN_DEVICE`
This variable can be set to the index of a Vulkan device to override
@@ -370,7 +354,7 @@ the default selection of the device that is used for Vulkan rendering.
The special value `list` can be used to obtain a list of all Vulkan
devices.
### `GDK_VULKAN_DISABLE`
### `GDK_VULKAN_SKIP`
This variable can be set to a list of values, which cause GDK to
disable features of the Vulkan support.
@@ -450,7 +434,7 @@ using and the GDK backend supports them:
installation.
### `GSK_GPU_DISABLE`
### `GSK_GPU_SKIP`
This variable can be set to a list of values, which cause GSK to
disable certain optimizations of the "ngl" and "vulkan" renderer.
@@ -470,22 +454,18 @@ disable certain optimizations of the "ngl" and "vulkan" renderer.
`mipmap`
: Avoid creating mipmaps
`gl-baseinstance`
: Assume no ARB/EXT_base_instance support
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 for
texture sizes in the "gl" renderer. This can be used to debug issues with
texture slicing on systems where the OpenGL texture size limit would
otherwise make texture slicing difficult to test.
Limit texture size to the minimum of this value and the OpenGL limit
for texture sizes. This can be used to debug issues with texture slicing
on systems where the OpenGL texture size limit would otherwise make
texture slicing difficult to test.
### `GTK_CSD`

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -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

View File

@@ -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" },
@@ -193,8 +193,7 @@ gdk_parse_debug_var (const char *variable,
guint i;
guint result = 0;
const char *string;
const char *p;
const char *q;
const char *p, *q, *s;
gboolean invert;
gboolean help;
@@ -222,17 +221,42 @@ gdk_parse_debug_var (const char *variable,
}
else
{
s = strchr (p, '=');
if (!s || s > q)
s = q;
for (i = 0; i < nkeys; i++)
{
if (strlen (keys[i].key) == q - p &&
g_ascii_strncasecmp (keys[i].key, p, q - p) == 0)
if (strlen (keys[i].key) == s - p &&
g_ascii_strncasecmp (keys[i].key, p, s - p) == 0)
{
result |= keys[i].value;
break;
if (s == q)
{
if (keys[i].callback)
{
if (!keys[i].callback (&keys[i], NULL))
fprintf (stderr, "Setting value \"%.*s\" failed.", (int)(q - p), p);
}
else
result |= keys[i].value;
break;
}
else if (keys[i].callback)
{
char *val;
val = g_strndup (s + 1, q - (s + 1));
if (!keys[i].callback (&keys[i], val))
fprintf (stderr, "Setting value \"%.*s\" failed.", (int)(q - p), p);
g_free (val);
break;
}
}
}
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", (int)(q - p), p, variable);
}
p = q;
@@ -244,13 +268,26 @@ gdk_parse_debug_var (const char *variable,
{
int max_width = 4;
for (i = 0; i < nkeys; i++)
max_width = MAX (max_width, strlen (keys[i].key));
{
int width = strlen (keys[i].key);
if (keys[i].callback)
width += strlen ("=VALUE");
max_width = MAX (max_width, width);
}
max_width += 4;
fprintf (stderr, "Supported %s values:\n", variable);
for (i = 0; i < nkeys; i++) {
fprintf (stderr, " %s%*s%s\n", keys[i].key, (int)(max_width - strlen (keys[i].key)), " ", keys[i].help);
}
for (i = 0; i < nkeys; i++)
{
int width = strlen (keys[i].key);
if (keys[i].callback)
width += strlen ("=VALUE");
fprintf (stderr, " %s%s%*s%s\n",
keys[i].key,
keys[i].callback ? "=VALUE" : "",
(int)(max_width - width), " ",
keys[i].help);
}
fprintf (stderr, " %s%*s%s\n", "all", max_width - 3, " ", "Enable all values. Other given values are subtracted");
fprintf (stderr, " %s%*s%s\n", "help", max_width - 4, " ", "Print this help");
fprintf (stderr, "\nMultiple values can be given, separated by : or space.\n");

View File

@@ -156,9 +156,6 @@ gdk_cursor_finalize (GObject *object)
g_clear_object (&cursor->texture);
g_clear_object (&cursor->fallback);
if (cursor->destroy)
cursor->destroy (cursor->data);
G_OBJECT_CLASS (gdk_cursor_parent_class)->finalize (object);
}
@@ -256,11 +253,6 @@ gdk_cursor_hash (gconstpointer pointer)
hash ^= g_str_hash (cursor->name);
else if (cursor->texture)
hash ^= g_direct_hash (cursor->texture);
else if (cursor->callback)
{
hash ^= g_direct_hash (cursor->callback);
hash ^= g_direct_hash (cursor->data);
}
hash ^= (cursor->hotspot_x << 8) | cursor->hotspot_y;
@@ -289,10 +281,6 @@ gdk_cursor_equal (gconstpointer a,
ca->hotspot_y != cb->hotspot_y)
return FALSE;
if (ca->callback != cb->callback ||
ca->data != cb->data)
return FALSE;
return TRUE;
}
@@ -367,45 +355,6 @@ gdk_cursor_new_from_texture (GdkTexture *texture,
NULL);
}
/**
* gdk_cursor_new_from_callback:
* @callback: the `GdkCursorGetTextureCallback`
* @data: data to pass to @callback
* @destroy: destroy notify for @data
* @fallback: (nullable): the `GdkCursor` to fall back to when
* this one cannot be supported
*
* Creates a new callback-based cursor object.
*
* Cursors of this kind produce textures for the cursor
* image on demand, when the @callback is called.
*
* Returns: (nullable): a new `GdkCursor`
*
* Since: 4.16
*/
GdkCursor *
gdk_cursor_new_from_callback (GdkCursorGetTextureCallback callback,
gpointer data,
GDestroyNotify destroy,
GdkCursor *fallback)
{
GdkCursor *cursor;
g_return_val_if_fail (callback != NULL, NULL);
g_return_val_if_fail (fallback == NULL || GDK_IS_CURSOR (fallback), NULL);
cursor = g_object_new (GDK_TYPE_CURSOR,
"fallback", fallback,
NULL);
cursor->callback = callback;
cursor->data = data;
cursor->destroy = destroy;
return cursor;
}
/**
* gdk_cursor_get_fallback: (attributes org.gtk.Method.get_property=fallback)
* @cursor: a `GdkCursor`
@@ -510,22 +459,3 @@ gdk_cursor_get_hotspot_y (GdkCursor *cursor)
return cursor->hotspot_y;
}
GdkTexture *
gdk_cursor_get_texture_for_size (GdkCursor *cursor,
int cursor_size,
double scale,
int *width,
int *height,
int *hotspot_x,
int *hotspot_y)
{
if (cursor->callback == NULL)
return NULL;
return cursor->callback (cursor,
cursor_size, scale,
width, height,
hotspot_x, hotspot_y,
cursor->data);
}

View File

@@ -51,52 +51,6 @@ GDK_AVAILABLE_IN_ALL
GdkCursor* gdk_cursor_new_from_name (const char *name,
GdkCursor *fallback);
/**
* GdkCursorGetTestureCallback:
* @cursor: the `GdkCursor`
* @cursor_size: the nominal cursor size, in application pixels
* @scale: the device scale
* @width: (out): return location for the actual cursor width,
* in application pixels
* @height: (out): return location for the actual cursor height,
* in application pixels
* @hotspot_x: (out): return location for the hotspot X position,
* in application pixels
* @hotspot_y: (out): return location for the hotspot Y position,
* in application pixels
* @data: User data for the callback
*
* The type of callback used by a dynamic `GdkCursor` to generate
* a texture for the cursor image at the given @cursor_size
* and @scale.
*
* The actual cursor size in application pixels may be different
* from @cursor_size x @cursor_size, and will be returned in
* @width, @height. The returned texture should have a size that
* corresponds to the actual cursor size, in device pixels (i.e.
* application pixels, multiplied by @scale).
*
* This function may fail and return `NULL`, in which case
* the fallback cursor will be used.
*
* Returns: (nullable) (transfer full): the cursor image, or
* `NULL` if none could be produced.
*/
typedef GdkTexture * (* GdkCursorGetTextureCallback) (GdkCursor *cursor,
int cursor_size,
double scale,
int *width,
int *height,
int *hotspot_x,
int *hotspot_y,
gpointer data);
GDK_AVAILABLE_IN_4_16
GdkCursor * gdk_cursor_new_from_callback (GdkCursorGetTextureCallback callback,
gpointer data,
GDestroyNotify destroy,
GdkCursor *fallback);
GDK_AVAILABLE_IN_ALL
GdkCursor * gdk_cursor_get_fallback (GdkCursor *cursor);
GDK_AVAILABLE_IN_ALL

View File

@@ -44,10 +44,6 @@ struct _GdkCursor
GdkTexture *texture;
int hotspot_x;
int hotspot_y;
GdkCursorGetTextureCallback callback;
gpointer data;
GDestroyNotify destroy;
};
struct _GdkCursorClass
@@ -59,13 +55,5 @@ guint gdk_cursor_hash (gconstpointer
gboolean gdk_cursor_equal (gconstpointer a,
gconstpointer b);
GdkTexture * gdk_cursor_get_texture_for_size (GdkCursor *cursor,
int cursor_size,
double scale,
int *width,
int *height,
int *hotspot_x,
int *hotspot_y);
G_END_DECLS

View File

@@ -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,
@@ -97,14 +97,17 @@ gdk_debug_message (const char *format, ...)
#define GDK_DEBUG_CHECK(type) GDK_DISPLAY_DEBUG_CHECK (NULL,type)
#define GDK_DEBUG(type,...) GDK_DISPLAY_DEBUG (NULL,type,__VA_ARGS__)
typedef struct
typedef struct _GdkDebugKey GdkDebugKey;
struct _GdkDebugKey
{
const char *key;
guint value;
const char *help;
} GdkDebugKey;
gboolean (* callback) (const GdkDebugKey *key,
const char *value);
};
guint gdk_parse_debug_var (const char *variable,
const GdkDebugKey *keys,
guint nkeys);

View File

@@ -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;
}
@@ -1538,7 +1519,6 @@ describe_egl_config (EGLDisplay egl_display,
EGLConfig egl_config)
{
EGLint red, green, blue, alpha, type;
EGLint depth, stencil;
if (egl_config == NULL)
return g_strdup ("-");
@@ -1557,16 +1537,7 @@ describe_egl_config (EGLDisplay egl_display,
else
type = EGL_COLOR_COMPONENT_TYPE_FIXED_EXT;
if (!eglGetConfigAttrib (egl_display, egl_config, EGL_DEPTH_SIZE, &depth))
depth = 0;
if (!eglGetConfigAttrib (egl_display, egl_config, EGL_STENCIL_SIZE, &stencil))
stencil = 0;
return g_strdup_printf ("R%dG%dB%dA%d%s, depth %d, stencil %d", red, green, blue, alpha,
type == EGL_COLOR_COMPONENT_TYPE_FIXED_EXT ? "" : " float",
depth,
stencil);
return g_strdup_printf ("R%dG%dB%dA%d%s", red, green, blue, alpha, type == EGL_COLOR_COMPONENT_TYPE_FIXED_EXT ? "" : " float");
}
gpointer
@@ -2047,12 +2018,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
@@ -2154,46 +2122,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,

View File

@@ -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);

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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);
}

View File

@@ -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;
}

View File

@@ -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

View File

@@ -1,7 +1,6 @@
#pragma once
#include "config.h"
#ifdef HAVE_DRM_FOURCC_H
#ifdef HAVE_DMABUF
#include <drm_fourcc.h>
#endif

View File

@@ -25,7 +25,6 @@
#include "gdkdmabufformatsbuilderprivate.h"
#include "gdkdmabuffourccprivate.h"
#include "gdkdmabufprivate.h"
#include "gdkdmabuftexturebuilderprivate.h"
#include "gdktextureprivate.h"
#include <gdk/gdkglcontext.h>
#include <gdk/gdkgltexturebuilder.h>
@@ -34,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.

View File

@@ -25,7 +25,6 @@
#include "gdkdisplay.h"
#include "gdkenumtypes.h"
#include "gdkdmabuftextureprivate.h"
#include "gdkdmabuftexturebuilderprivate.h"
#include <cairo-gobject.h>
@@ -949,20 +948,22 @@ gdk_dmabuf_texture_builder_set_update_region (GdkDmabufTextureBuilder *self,
*
* Builds a new `GdkTexture` with the values set up in the builder.
*
* It is a programming error to call this function if any mandatory property has not been set.
* It is a programming error to call this function if any mandatory
* property has not been set.
*
* Not all formats defined in the `drm_fourcc.h` header are supported. You can use
* [method@Gdk.Display.get_dmabuf_formats] to get a list of supported formats. If the
* format is not supported by GTK, %NULL will be returned and @error will be set.
* If the dmabuf is not supported by GTK, %NULL will be returned and @error will be set.
*
* The `destroy` function gets called when the returned texture gets released.
*
* It is possible to call this function multiple times to create multiple textures,
* possibly with changing properties in between.
*
* It is the responsibility of the caller to keep the file descriptors for the planes
* open until the created texture is no longer used, and close them afterwards (possibly
* using the @destroy notify).
*
* It is possible to call this function multiple times to create multiple textures,
* possibly with changing properties in between.
* Not all formats defined in the `drm_fourcc.h` header are supported. You can use
* [method@Gdk.Display.get_dmabuf_formats] to get a list of supported formats.
*
* Returns: (transfer full) (nullable): a newly built `GdkTexture` or `NULL`
* if the format is not supported
@@ -1003,19 +1004,3 @@ gdk_dmabuf_texture_builder_get_dmabuf (GdkDmabufTextureBuilder *self)
{
return &self->dmabuf;
}
void
gdk_dmabuf_texture_builder_set_dmabuf (GdkDmabufTextureBuilder *self,
const GdkDmabuf *dmabuf)
{
gdk_dmabuf_texture_builder_set_fourcc (self, dmabuf->fourcc);
gdk_dmabuf_texture_builder_set_modifier (self, dmabuf->modifier);
gdk_dmabuf_texture_builder_set_n_planes (self, dmabuf->n_planes);
for (unsigned int i = 0; i < dmabuf->n_planes; i++)
{
gdk_dmabuf_texture_builder_set_fd (self, i, dmabuf->planes[i].fd);
gdk_dmabuf_texture_builder_set_stride (self, i, dmabuf->planes[i].stride);
gdk_dmabuf_texture_builder_set_offset (self, i, dmabuf->planes[i].offset);
}
}

View File

@@ -1,14 +0,0 @@
#pragma once
#include "gdkdmabuftexturebuilder.h"
#include "gdkdmabufprivate.h"
G_BEGIN_DECLS
const GdkDmabuf * gdk_dmabuf_texture_builder_get_dmabuf (GdkDmabufTextureBuilder *builder);
void gdk_dmabuf_texture_builder_set_dmabuf (GdkDmabufTextureBuilder *builder,
const GdkDmabuf *dmabuf);
G_END_DECLS

View File

@@ -7,6 +7,8 @@
G_BEGIN_DECLS
const GdkDmabuf * gdk_dmabuf_texture_builder_get_dmabuf (GdkDmabufTextureBuilder *builder);
GdkTexture * gdk_dmabuf_texture_new_from_builder (GdkDmabufTextureBuilder *builder,
GDestroyNotify destroy,
gpointer data,

View File

@@ -50,6 +50,18 @@
#include "gdkenumtypes.h"
#include "gdkeventsprivate.h"
static struct {
GdkDragAction action;
const char *name;
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 },
};
enum {
PROP_0,
PROP_CONTENT,
@@ -774,20 +786,6 @@ gdk_drag_handle_source_event (GdkEvent *event)
return FALSE;
}
static struct {
GdkDragAction action;
const char *name;
GdkCursor *cursor;
} drag_cursors[] = {
{ 0, "default", NULL },
{ GDK_ACTION_ASK, "dnd-ask", NULL },
{ GDK_ACTION_COPY, "copy", NULL },
{ GDK_ACTION_MOVE, "dnd-move", NULL }, /* Not using move here, since move is stuck using
* a mismatched visual metaphor in Adwaita
*/
{ GDK_ACTION_LINK, "alias", NULL },
};
GdkCursor *
gdk_drag_get_cursor (GdkDrag *drag,
GdkDragAction action)

View File

@@ -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,

View File

@@ -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);
}
/*********************************************

View File

@@ -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);

View File

@@ -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 1000
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];
}
/**
@@ -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))

View File

@@ -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);

View File

@@ -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,

View File

@@ -125,7 +125,7 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
* the GL_UNPACK_ROW_LENGTH support
*/
if (gdk_gl_context_get_use_es (paint_context) &&
!(version >= 300 || gdk_gl_context_has_feature (paint_context, GDK_GL_FEATURE_UNPACK_SUBIMAGE)))
!(version >= 300 || gdk_gl_context_has_unpack_subimage (paint_context)))
return;
/* TODO: avoid reading back non-required data due to dest clip */

View File

@@ -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,19 +98,14 @@
#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
static const GdkDebugKey gdk_gl_feature_keys[] = {
{ "debug", GDK_GL_FEATURE_DEBUG, "GL_KHR_debug" },
{ "unpack-subimage", GDK_GL_FEATURE_UNPACK_SUBIMAGE, "GL_EXT_unpack_subimage" },
{ "half-float", GDK_GL_FEATURE_VERTEX_HALF_FLOAT, "GL_OES_vertex_half_float" },
{ "sync", GDK_GL_FEATURE_SYNC, "GL_ARB_sync" },
{ "base-instance", GDK_GL_FEATURE_BASE_INSTANCE, "GL_ARB_base_instance" },
{ "buffer-storage", GDK_GL_FEATURE_BUFFER_STORAGE, "GL_EXT_buffer_storage" },
};
typedef struct _GdkGLContextPrivate GdkGLContextPrivate;
struct _GdkGLContextPrivate
@@ -121,9 +115,13 @@ struct _GdkGLContextPrivate
GdkGLMemoryFlags memory_flags[GDK_MEMORY_N_FORMATS];
GdkGLFeatures features;
guint has_khr_debug : 1;
guint use_khr_debug : 1;
guint has_half_float : 1;
guint has_sync : 1;
guint has_unpack_subimage : 1;
guint has_debug_output : 1;
guint has_bgra : 1;
guint extensions_checked : 1;
guint debug_enabled : 1;
guint forward_compatible : 1;
@@ -295,7 +293,7 @@ gdk_gl_context_create_egl_context (GdkGLContext *context,
GdkDisplay *display = gdk_gl_context_get_display (context);
EGLDisplay egl_display = gdk_display_get_egl_display (display);
GdkGLContext *share = gdk_display_get_gl_context (display);
GdkGLContextPrivate *share_priv = share ? gdk_gl_context_get_instance_private (share) : NULL;
GdkGLContextPrivate *share_priv = gdk_gl_context_get_instance_private (share);
EGLConfig egl_config;
EGLContext ctx;
EGLint context_attribs[N_EGL_ATTRS], i = 0, flags = 0;
@@ -595,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;
@@ -663,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;
@@ -672,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", NULL);
if (priv->eglSwapBuffersWithDamage)
{
EGLint stack_rects[4 * 4]; /* 4 rects */
@@ -702,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
@@ -903,12 +900,11 @@ gdk_gl_context_label_object_printf (GdkGLContext *context,
gboolean
gdk_gl_context_has_feature (GdkGLContext *self,
GdkGLFeatures feature)
gdk_gl_context_has_unpack_subimage (GdkGLContext *context)
{
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self);
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
return (priv->features & feature) == feature;
return priv->has_unpack_subimage;
}
static gboolean
@@ -1670,53 +1666,10 @@ gdk_gl_version_init_epoxy (GdkGLVersion *version)
*version = GDK_GL_VERSION_INIT (epoxy_version / 10, epoxy_version % 10);
}
static GdkGLFeatures
gdk_gl_context_check_features (GdkGLContext *context)
{
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
GdkGLFeatures features = 0;
if (gdk_gl_context_get_use_es (context))
{
if (gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 0)) ||
epoxy_has_gl_extension ("GL_EXT_unpack_subimage"))
features |= GDK_GL_FEATURE_UNPACK_SUBIMAGE;
}
else
{
features |= GDK_GL_FEATURE_UNPACK_SUBIMAGE;
}
if (epoxy_has_gl_extension ("GL_KHR_debug"))
features |= GDK_GL_FEATURE_DEBUG;
if (gdk_gl_context_check_version (context, "3.0", "3.0") ||
epoxy_has_gl_extension ("GL_OES_vertex_half_float"))
features |= GDK_GL_FEATURE_VERTEX_HALF_FLOAT;
if (gdk_gl_context_check_version (context, "3.2", "3.0") ||
epoxy_has_gl_extension ("GL_ARB_sync") ||
epoxy_has_gl_extension ("GL_APPLE_sync"))
features |= GDK_GL_FEATURE_SYNC;
if (gdk_gl_context_check_version (context, "4.2", "9.9") ||
epoxy_has_gl_extension ("GL_EXT_base_instance") ||
epoxy_has_gl_extension ("GL_ARB_base_instance"))
features |= GDK_GL_FEATURE_BASE_INSTANCE;
if (gdk_gl_context_check_version (context, "4.4", "9.9") ||
epoxy_has_gl_extension ("GL_EXT_buffer_storage") ||
epoxy_has_gl_extension ("GL_ARB_buffer_storage"))
features |= GDK_GL_FEATURE_BUFFER_STORAGE;
return features;
}
static void
gdk_gl_context_check_extensions (GdkGLContext *context)
{
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
GdkGLFeatures supported_features, disabled_features;
gboolean gl_debug = FALSE;
GdkDisplay *display;
@@ -1734,54 +1687,69 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
if (priv->has_debug_output && gl_debug)
{
gdk_gl_context_make_current (context);
glEnable (GL_DEBUG_OUTPUT);
glEnable (GL_DEBUG_OUTPUT_SYNCHRONOUS);
glDebugMessageCallback (gl_debug_message_callback, NULL);
}
/* If we asked for a core profile, but didn't get one, we're in legacy mode */
if (!gdk_gl_context_get_use_es (context) &&
!gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 2)))
priv->is_legacy = TRUE;
if (gdk_gl_context_get_use_es (context))
{
priv->has_unpack_subimage = gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 0)) ||
epoxy_has_gl_extension ("GL_EXT_unpack_subimage");
priv->has_khr_debug = epoxy_has_gl_extension ("GL_KHR_debug");
priv->has_bgra = epoxy_has_gl_extension ("GL_EXT_texture_format_BGRA8888");
}
else
{
priv->has_unpack_subimage = TRUE;
priv->has_khr_debug = epoxy_has_gl_extension ("GL_KHR_debug");
priv->has_bgra = TRUE;
supported_features = gdk_gl_context_check_features (context);
disabled_features = gdk_parse_debug_var ("GDK_GL_DISABLE",
gdk_gl_feature_keys,
G_N_ELEMENTS (gdk_gl_feature_keys));
/* We asked for a core profile, but we didn't get one, so we're in legacy mode */
if (!gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 2)))
priv->is_legacy = TRUE;
}
priv->features = supported_features & ~disabled_features;
gdk_gl_context_init_memory_flags (context);
if ((priv->features & GDK_GL_FEATURE_DEBUG) && gl_debug)
if (priv->has_khr_debug && gl_debug)
{
priv->use_khr_debug = TRUE;
glGetIntegerv (GL_MAX_LABEL_LENGTH, &priv->max_debug_label_length);
}
if (GDK_DISPLAY_DEBUG_CHECK (display, OPENGL))
{
int i, max_texture_size;
glGetIntegerv (GL_MAX_TEXTURE_SIZE, &max_texture_size);
gdk_debug_message ("%s version: %d.%d (%s)\n"
"* GLSL version: %s\n"
"* Max texture size: %d\n",
gdk_gl_context_get_use_es (context) ? "OpenGL ES" : "OpenGL",
gdk_gl_version_get_major (&priv->gl_version), gdk_gl_version_get_minor (&priv->gl_version),
priv->is_legacy ? "legacy" : "core",
glGetString (GL_SHADING_LANGUAGE_VERSION),
max_texture_size);
gdk_debug_message ("Enabled features (use GDK_GL_DISABLE env var to disable):");
for (i = 0; i < G_N_ELEMENTS (gdk_gl_feature_keys); i++)
{
gdk_debug_message (" %s: %s",
gdk_gl_feature_keys[i].key,
(priv->features & gdk_gl_feature_keys[i].value) ? "YES" :
((disabled_features & gdk_gl_feature_keys[i].value) ? "disabled via env var" :
(((supported_features & gdk_gl_feature_keys[i].value) == 0) ? "not supported" :
"Hum, what? This should not happen.")));
}
}
priv->has_half_float = gdk_gl_context_check_version (context, "3.0", "3.0") ||
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") ||
epoxy_has_gl_extension ("GL_APPLE_sync");
gdk_gl_context_init_memory_flags (context);
{
int max_texture_size;
glGetIntegerv (GL_MAX_TEXTURE_SIZE, &max_texture_size);
GDK_DISPLAY_DEBUG (gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context)), OPENGL,
"%s version: %d.%d (%s)\n"
"* GLSL version: %s\n"
"* Max texture size: %d\n"
"* Extensions checked:\n"
" - GL_KHR_debug: %s\n"
" - GL_EXT_unpack_subimage: %s\n"
" - half float: %s\n"
" - sync: %s\n"
" - bgra: %s",
gdk_gl_context_get_use_es (context) ? "OpenGL ES" : "OpenGL",
gdk_gl_version_get_major (&priv->gl_version), gdk_gl_version_get_minor (&priv->gl_version),
priv->is_legacy ? "legacy" : "core",
glGetString (GL_SHADING_LANGUAGE_VERSION),
max_texture_size,
priv->has_khr_debug ? "yes" : "no",
priv->has_unpack_subimage ? "yes" : "no",
priv->has_half_float ? "yes" : "no",
priv->has_sync ? "yes" : "no",
priv->has_bgra ? "yes" : "no");
}
priv->extensions_checked = TRUE;
}
@@ -2050,6 +2018,30 @@ gdk_gl_context_get_format_flags (GdkGLContext *self,
return priv->memory_flags[format];
}
gboolean
gdk_gl_context_has_debug (GdkGLContext *self)
{
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self);
return priv->debug_enabled || priv->use_khr_debug;
}
gboolean
gdk_gl_context_has_vertex_half_float (GdkGLContext *self)
{
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self);
return priv->has_half_float;
}
gboolean
gdk_gl_context_has_sync (GdkGLContext *self)
{
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self);
return priv->has_sync;
}
/* Return if glGenVertexArrays, glBindVertexArray and glDeleteVertexArrays
* can be used
*/

View File

@@ -27,15 +27,6 @@
G_BEGIN_DECLS
typedef enum {
GDK_GL_FEATURE_DEBUG = 1 << 0,
GDK_GL_FEATURE_UNPACK_SUBIMAGE = 1 << 1,
GDK_GL_FEATURE_VERTEX_HALF_FLOAT = 1 << 2,
GDK_GL_FEATURE_SYNC = 1 << 3,
GDK_GL_FEATURE_BASE_INSTANCE = 1 << 4,
GDK_GL_FEATURE_BUFFER_STORAGE = 1 << 5,
} GdkGLFeatures;
typedef enum {
GDK_GL_NONE = 0,
GDK_GL_EGL,
@@ -151,6 +142,7 @@ void gdk_gl_context_get_matching_version (GdkGLContext
gboolean legacy,
GdkGLVersion *out_version);
gboolean gdk_gl_context_has_unpack_subimage (GdkGLContext *context);
void gdk_gl_context_push_debug_group (GdkGLContext *context,
const char *message);
void gdk_gl_context_push_debug_group_printf (GdkGLContext *context,
@@ -171,11 +163,14 @@ const char * gdk_gl_context_get_glsl_version_string (GdkGLContext
GdkGLMemoryFlags gdk_gl_context_get_format_flags (GdkGLContext *self,
GdkMemoryFormat format) G_GNUC_PURE;
gboolean gdk_gl_context_has_feature (GdkGLContext *self,
GdkGLFeatures feature) G_GNUC_PURE;
gboolean gdk_gl_context_has_debug (GdkGLContext *self) G_GNUC_PURE;
gboolean gdk_gl_context_use_es_bgra (GdkGLContext *context);
gboolean gdk_gl_context_has_vertex_half_float (GdkGLContext *self) G_GNUC_PURE;
gboolean gdk_gl_context_has_sync (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);

View File

@@ -494,7 +494,7 @@ gdk_gl_texture_new_from_builder (GdkGLTextureBuilder *builder,
self->id = gdk_gl_texture_builder_get_id (builder);
GDK_TEXTURE (self)->format = gdk_gl_texture_builder_get_format (builder);
self->has_mipmap = gdk_gl_texture_builder_get_has_mipmap (builder);
if (gdk_gl_context_has_feature (self->context, GDK_GL_FEATURE_SYNC))
if (gdk_gl_context_has_sync (self->context))
self->sync = gdk_gl_texture_builder_get_sync (builder);
self->destroy = destroy;
self->data = data;

View File

@@ -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 youre 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

View File

@@ -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

View File

@@ -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,

View File

@@ -59,7 +59,7 @@ typedef enum {
* @get_current_image: return a `GdkPaintable` that does not change over
* time. This means the `GDK_PAINTABLE_STATIC_SIZE` and
* `GDK_PAINTABLE_STATIC_CONTENTS` flag are set.
* @get_flags: Get the flags for this instance. See [flags@Gdk.PaintableFlags]
* @get_flags: Get the flags for this instance. See [enum@Gdk.PaintableFlags]
* for details.
* @get_intrinsic_width: The preferred width for this object to be
* snapshot at or 0 if none. This is purely a hint. The object must still

View File

@@ -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,108 +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,
GdkTextureTransform transform,
gboolean lightbox,
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, transform, lightbox, above, sibling);
return GDK_SUBSURFACE_GET_CLASS (subsurface)->attach (subsurface, texture, rect, above, sibling);
}
void
@@ -165,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);
}
@@ -179,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
@@ -203,21 +101,5 @@ gdk_subsurface_is_above_parent (GdkSubsurface *subsurface)
{
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), TRUE);
return subsurface->above_parent;
}
GdkTextureTransform
gdk_subsurface_get_transform (GdkSubsurface *subsurface)
{
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), GDK_TEXTURE_TRANSFORM_NORMAL);
return GDK_SUBSURFACE_GET_CLASS (subsurface)->get_transform (subsurface);
}
gboolean
gdk_subsurface_get_lightbox (GdkSubsurface *subsurface)
{
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), FALSE);
return GDK_SUBSURFACE_GET_CLASS (subsurface)->get_lightbox (subsurface);
return GDK_SUBSURFACE_GET_CLASS (subsurface)->is_above_parent (subsurface);
}

View File

@@ -41,22 +41,8 @@ struct _GdkSubsurface
GdkSurface *parent;
int ref_count;
gboolean above_parent;
GdkSubsurface *sibling_above;
GdkSubsurface *sibling_below;
};
typedef enum {
GDK_TEXTURE_TRANSFORM_NORMAL,
GDK_TEXTURE_TRANSFORM_90,
GDK_TEXTURE_TRANSFORM_180,
GDK_TEXTURE_TRANSFORM_270,
GDK_TEXTURE_TRANSFORM_FLIPPED,
GDK_TEXTURE_TRANSFORM_FLIPPED_90,
GDK_TEXTURE_TRANSFORM_FLIPPED_180,
GDK_TEXTURE_TRANSFORM_FLIPPED_270,
} GdkTextureTransform;
struct _GdkSubsurfaceClass
{
@@ -64,45 +50,29 @@ struct _GdkSubsurfaceClass
gboolean (* attach) (GdkSubsurface *subsurface,
GdkTexture *texture,
const graphene_rect_t *source,
const graphene_rect_t *dest,
GdkTextureTransform transform,
gboolean lightbox,
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);
GdkTextureTransform
(* get_transform) (GdkSubsurface *subsurface);
gboolean (* get_lightbox) (GdkSubsurface *subsurface);
void (* get_rect) (GdkSubsurface *subsurface,
graphene_rect_t *rect);
gboolean (* is_above_parent) (GdkSubsurface *subsurface);
};
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,
GdkTextureTransform transform,
gboolean lightbox,
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);
GdkTextureTransform
gdk_subsurface_get_transform (GdkSubsurface *subsurface);
gboolean gdk_subsurface_get_lightbox (GdkSubsurface *subsurface);
G_END_DECLS

View File

@@ -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);

View File

@@ -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,

View File

@@ -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.";
@@ -552,8 +547,9 @@ physical_device_supports_extension (VkPhysicalDevice device,
return FALSE;
}
static GdkVulkanFeatures
physical_device_check_features (VkPhysicalDevice device)
static gboolean
physical_device_check_features (VkPhysicalDevice device,
GdkVulkanFeatures *out_features)
{
VkPhysicalDeviceVulkan12Features v12_features = {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES,
@@ -562,16 +558,15 @@ physical_device_check_features (VkPhysicalDevice device)
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES,
.pNext = &v12_features
};
VkPhysicalDeviceFeatures2 v10_features = {
VkPhysicalDeviceFeatures2 features = {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2,
.pNext = &ycbcr_features
};
VkExternalSemaphoreProperties semaphore_props = {
.sType = VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES,
};
GdkVulkanFeatures features;
vkGetPhysicalDeviceFeatures2 (device, &v10_features);
vkGetPhysicalDeviceFeatures2 (device, &features);
vkGetPhysicalDeviceExternalSemaphoreProperties (device,
&(VkPhysicalDeviceExternalSemaphoreInfo) {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO,
@@ -579,46 +574,45 @@ physical_device_check_features (VkPhysicalDevice device)
},
&semaphore_props);
features = 0;
*out_features = 0;
if (v10_features.features.shaderUniformBufferArrayDynamicIndexing &&
v10_features.features.shaderSampledImageArrayDynamicIndexing)
features |= GDK_VULKAN_FEATURE_DYNAMIC_INDEXING;
if (features.features.shaderUniformBufferArrayDynamicIndexing &&
features.features.shaderSampledImageArrayDynamicIndexing)
*out_features |= GDK_VULKAN_FEATURE_DYNAMIC_INDEXING;
if (v12_features.descriptorIndexing &&
v12_features.descriptorBindingPartiallyBound &&
v12_features.descriptorBindingVariableDescriptorCount &&
v12_features.descriptorBindingSampledImageUpdateAfterBind &&
v12_features.descriptorBindingStorageBufferUpdateAfterBind)
features |= GDK_VULKAN_FEATURE_DESCRIPTOR_INDEXING;
*out_features |= GDK_VULKAN_FEATURE_DESCRIPTOR_INDEXING;
else if (physical_device_supports_extension (device, VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME))
features |= GDK_VULKAN_FEATURE_DESCRIPTOR_INDEXING;
*out_features |= GDK_VULKAN_FEATURE_DESCRIPTOR_INDEXING;
if (v12_features.shaderSampledImageArrayNonUniformIndexing &&
v12_features.shaderStorageBufferArrayNonUniformIndexing)
features |= GDK_VULKAN_FEATURE_NONUNIFORM_INDEXING;
*out_features |= GDK_VULKAN_FEATURE_NONUNIFORM_INDEXING;
if (ycbcr_features.samplerYcbcrConversion ||
physical_device_supports_extension (device, VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME))
features |= GDK_VULKAN_FEATURE_YCBCR;
if (ycbcr_features.samplerYcbcrConversion)
*out_features |= GDK_VULKAN_FEATURE_YCBCR;
if (physical_device_supports_extension (device, VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME) &&
physical_device_supports_extension (device, VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME))
features |= GDK_VULKAN_FEATURE_DMABUF;
*out_features |= GDK_VULKAN_FEATURE_DMABUF;
if (physical_device_supports_extension (device, VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME))
{
if (semaphore_props.externalSemaphoreFeatures & VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT)
features |= GDK_VULKAN_FEATURE_SEMAPHORE_EXPORT;
*out_features |= GDK_VULKAN_FEATURE_SEMAPHORE_EXPORT;
if (semaphore_props.externalSemaphoreFeatures & VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT)
features |= GDK_VULKAN_FEATURE_SEMAPHORE_IMPORT;
*out_features |= GDK_VULKAN_FEATURE_SEMAPHORE_IMPORT;
}
if (physical_device_supports_extension (device, VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME))
features |= GDK_VULKAN_FEATURE_INCREMENTAL_PRESENT;
*out_features |= GDK_VULKAN_FEATURE_INCREMENTAL_PRESENT;
return features;
return TRUE;
}
static void
@@ -1366,7 +1360,7 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
first = 0;
last = n_devices;
skip_features = gdk_parse_debug_var ("GDK_VULKAN_DISABLE",
skip_features = gdk_parse_debug_var ("GDK_VULKAN_SKIP",
gsk_vulkan_feature_keys,
G_N_ELEMENTS (gsk_vulkan_feature_keys));
@@ -1454,7 +1448,8 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
GdkVulkanFeatures features, device_features;
uint32_t n_queue_props;
device_features = physical_device_check_features (devices[i]);
if (!physical_device_check_features (devices[i], &device_features))
continue;
features = device_features & ~skip_features;
@@ -1471,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);
@@ -1539,7 +1520,7 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
display->vk_queue_family_index = j;
display->vulkan_features = features;
GDK_DISPLAY_DEBUG (display, VULKAN, "Enabled features (use GDK_VULKAN_DISABLE env var to disable):");
GDK_DISPLAY_DEBUG (display, VULKAN, "Enabled features (use GDK_VULKAN_SKIP env var to disable):");
for (i = 0; i < G_N_ELEMENTS (gsk_vulkan_feature_keys); i++)
{
GDK_DISPLAY_DEBUG (display, VULKAN, " %s: %s",
@@ -1632,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;

View File

@@ -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
@@ -296,6 +312,10 @@ typedef NSString *CALayerContentsGravity;
GdkMonitor *monitor;
GdkRectangle geometry;
GdkRectangle workarea;
int shadow_top = 0;
int shadow_left = 0;
int shadow_right = 0;
int shadow_bottom = 0;
GdkRectangle window_gdk;
GdkPoint pointer_position;
GdkPoint new_origin;
@@ -303,6 +323,13 @@ typedef NSString *CALayerContentsGravity;
if (!inManualMove)
return NO;
/* Get our shadow so we can adjust the window position sans-shadow */
_gdk_macos_surface_get_shadow (gdk_surface,
&shadow_top,
&shadow_right,
&shadow_bottom,
&shadow_left);
windowFrame = [self frame];
currentLocation = [NSEvent mouseLocation];
@@ -328,9 +355,21 @@ typedef NSString *CALayerContentsGravity;
window_gdk.width = windowFrame.size.width;
window_gdk.height = windowFrame.size.height;
/* Subtract our shadowin from the window */
window_gdk.x += shadow_left;
window_gdk.y += shadow_top;
window_gdk.width = window_gdk.width - shadow_left - shadow_right;
window_gdk.height = window_gdk.height - shadow_top - shadow_bottom;
/* Now place things on the monitor */
_edge_snapping_motion (&self->snapping, &pointer_position, &window_gdk);
/* And add our shadow back to the frame */
window_gdk.x -= shadow_left;
window_gdk.y -= shadow_top;
window_gdk.width += shadow_left + shadow_right;
window_gdk.height += shadow_top + shadow_bottom;
/* Convert to quartz coordinates */
_gdk_macos_display_to_display_coords ([self gdkDisplay],
window_gdk.x,
@@ -348,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));
}
@@ -379,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;
@@ -397,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,
@@ -692,16 +735,26 @@ typedef NSString *CALayerContentsGravity;
-(void)setStyleMask:(NSWindowStyleMask)styleMask
{
gboolean was_fullscreen;
gboolean is_fullscreen;
gboolean was_opaque;
gboolean is_opaque;
was_fullscreen = (([self styleMask] & NSWindowStyleMaskFullScreen) != 0);
was_opaque = (([self styleMask] & NSWindowStyleMaskTitled) != 0);
[super setStyleMask:styleMask];
is_fullscreen = (([self styleMask] & NSWindowStyleMaskFullScreen) != 0);
is_opaque = (([self styleMask] & NSWindowStyleMaskTitled) != 0);
_gdk_macos_surface_update_fullscreen_state (gdk_surface);
if (was_fullscreen != is_fullscreen)
{
if (was_fullscreen)
[self setFrame:lastUnfullscreenFrame display:NO];
_gdk_macos_surface_update_fullscreen_state (gdk_surface);
}
if (was_opaque != is_opaque)
{
@@ -714,20 +767,58 @@ typedef NSString *CALayerContentsGravity;
-(NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen
{
GdkMacosSurface *surface = gdk_surface;
NSRect rect;
int shadow_top;
/* Allow the window to move up "shadow_top" more than normally allowed
* by the default impl. This makes it possible to move windows with
* client side shadow right up to the screen's menu bar. */
_gdk_macos_surface_get_shadow (surface, &shadow_top, NULL, NULL, NULL);
rect = [super constrainFrameRect:frameRect toScreen:screen];
if (frameRect.origin.y > rect.origin.y)
rect.origin.y = MIN (frameRect.origin.y, rect.origin.y);
rect.origin.y = MIN (frameRect.origin.y, rect.origin.y + shadow_top);
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
@@ -738,6 +829,7 @@ typedef NSString *CALayerContentsGravity;
-(void)windowWillEnterFullScreen:(NSNotification *)aNotification
{
inFullscreenTransition = YES;
lastUnfullscreenFrame = [self frame];
}
-(void)windowDidEnterFullScreen:(NSNotification *)aNotification
@@ -783,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];
}

View File

@@ -49,6 +49,10 @@
EdgeSnapping snapping;
NSRect lastUnmaximizedFrame;
NSRect lastMaximizedFrame;
NSRect lastUnfullscreenFrame;
BOOL inMaximizeTransition;
BOOL inFullscreenTransition;
}

View File

@@ -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;

View File

@@ -22,7 +22,6 @@
#include <string.h>
#include "gdkmacoscursor-private.h"
#include "gdkcursorprivate.h"
@interface NSCursor()
-(long long)_coreCursorType;
@@ -152,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)
{
@@ -213,33 +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)
{
GdkTexture *texture;
int hotspot_x, hotspot_y;
texture = gdk_cursor_get_texture (cursor);
hotspot_x = gdk_cursor_get_hotspot_x (cursor);
hotspot_y = gdk_cursor_get_hotspot_y (cursor);
if (texture == NULL)
{
int size = 32; // FIXME
int width, height;
texture = gdk_cursor_get_texture_for_size (cursor, size, 1,
&width, &height,
&hotspot_x, &hotspot_y);
}
nscursor = create_cursor_from_texture (texture, hotspot_x, hotspot_y);
return nscursor;
}
}
name = gdk_cursor_get_name (cursor);
if (name == NULL)
goto load_cursor;

View File

@@ -47,20 +47,20 @@ _gdk_macos_display_position_toplevel_with_parent (GdkMacosDisplay *self,
/* Try to center on top of the parent but also try to make the whole thing
* visible in case that lands us under the topbar/panel/etc.
*/
parent_rect.x = parent->root_x;
parent_rect.y = parent->root_y;
parent_rect.width = GDK_SURFACE (parent)->width;
parent_rect.height = GDK_SURFACE (parent)->height;
parent_rect.x = parent->root_x + parent->shadow_left;
parent_rect.y = parent->root_y + parent->shadow_top;
parent_rect.width = GDK_SURFACE (parent)->width - parent->shadow_left - parent->shadow_right;
parent_rect.height = GDK_SURFACE (parent)->height - parent->shadow_top - parent->shadow_bottom;
surface_rect.width = GDK_SURFACE (surface)->width;
surface_rect.height = GDK_SURFACE (surface)->height;
surface_rect.width = GDK_SURFACE (surface)->width - surface->shadow_left - surface->shadow_right;
surface_rect.height = GDK_SURFACE (surface)->height - surface->shadow_top - surface->shadow_bottom;
surface_rect.x = parent_rect.x + ((parent_rect.width - surface_rect.width) / 2);
surface_rect.y = parent_rect.y + ((parent_rect.height - surface_rect.height) / 2);
_gdk_macos_monitor_clamp (GDK_MACOS_MONITOR (monitor), &surface_rect);
*x = surface_rect.x;
*y = surface_rect.y;
*x = surface_rect.x - surface->shadow_left;
*y = surface_rect.y - surface->shadow_top;
}
static inline gboolean
@@ -99,15 +99,15 @@ _gdk_macos_display_position_toplevel (GdkMacosDisplay *self,
gdk_macos_monitor_get_workarea (monitor, &workarea);
/* First place at top-left of current monitor */
surface_rect.width = GDK_SURFACE (surface)->width;
surface_rect.height = GDK_SURFACE (surface)->height;
surface_rect.width = GDK_SURFACE (surface)->width - surface->shadow_left - surface->shadow_right;
surface_rect.height = GDK_SURFACE (surface)->height - surface->shadow_top - surface->shadow_bottom;
surface_rect.x = workarea.x + ((workarea.width - surface_rect.width) / 2);
surface_rect.y = workarea.y + ((workarea.height - surface_rect.height) / 2);
_gdk_macos_monitor_clamp (GDK_MACOS_MONITOR (surface->best_monitor), &surface_rect);
*x = surface_rect.x;
*y = surface_rect.y;
*x = surface_rect.x - surface->shadow_left;
*y = surface_rect.y - surface->shadow_top;
/* Try to see if there are any other surfaces at this origin and if so,
* adjust until we get something better.
@@ -119,11 +119,11 @@ _gdk_macos_display_position_toplevel (GdkMacosDisplay *self,
*y += WARP_OFFSET_Y;
/* If we reached the bottom right, just bail and try the workspace origin */
if (*x + WARP_OFFSET_X > workarea.x + workarea.width ||
*y + WARP_OFFSET_Y > workarea.y + workarea.height)
if (*x + surface->shadow_left + WARP_OFFSET_X > workarea.x + workarea.width ||
*y + surface->shadow_top + WARP_OFFSET_Y > workarea.y + workarea.height)
{
*x = workarea.x;
*y = workarea.y;
*x = workarea.x - surface->shadow_left;
*y = workarea.y - surface->shadow_top;
return;
}
}

View File

@@ -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 *
@@ -998,9 +997,7 @@ _gdk_macos_display_get_nsevent (GdkEvent *event)
{
const GdkToNSEventMap *map = iter->data;
if (map->gdk_event->event_type == event->event_type &&
map->gdk_event->device == event->device &&
map->gdk_event->time == event->time)
if (map->gdk_event == event)
return map->nsevent;
}

View File

@@ -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);
}

View File

@@ -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;

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