Compare commits

..

27 Commits

Author SHA1 Message Date
Matthias Clasen
91e19bc36d jpeg: Set errors 2021-09-13 21:08:39 -04:00
Matthias Clasen
30d21ef791 png: loader set error 2021-09-13 21:08:34 -04:00
Matthias Clasen
57b419ebb1 texture: Add error enum 2021-09-13 21:08:27 -04:00
Matthias Clasen
9d303723b0 rendernodeparser: Avoid gdk_texture_new_for_pixbuf
We can just use gdk_texture_new_from_bytes here now.

Update affected test output.
2021-09-13 21:08:21 -04:00
Benjamin Otte
08bd1129ad !fixup gdk_pixbuf_save_to_png_bytes() documentation 2021-09-14 02:46:39 +02:00
Benjamin Otte
0cb0fc8317 testsuite: Add png and tiff methods
We encode the texture to a PNG or TIFF and then decode it again.
2021-09-14 02:46:39 +02:00
Benjamin Otte
874a3837d9 texture: Add gdk_texture_save_to_tiff_bytes() 2021-09-14 02:46:39 +02:00
Benjamin Otte
31fc5a5a54 !fixup tiff save can't fail 2021-09-14 02:46:39 +02:00
Benjamin Otte
40d81f5959 !fixup can't fail 2021-09-14 02:46:39 +02:00
Benjamin Otte
4fad97d8ab Redo tiff load/save without streams
Less code.
2021-09-14 02:46:39 +02:00
Julian Sparber
f1a8c95ca4 stack: Dispose children before emitting items-changed
This makes sure that the `GListModel` returned by
`gtk_stack_get_pages()` actually has the items removed before
`items-changed` is emitted.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4255
2021-09-14 02:46:39 +02:00
Matthias Clasen
65a1804f05 rendernodeparser: Use gdk_texture_save_to_png_bytes
Avoid cairo, and use our own api for saving png data.

Update affected test output.
2021-09-13 16:39:09 -04:00
Matthias Clasen
92873e62ed Add tests for the jpeg loader 2021-09-13 15:15:20 -04:00
Matthias Clasen
0f7c33f894 Load jpegs without gdk-pixbuf
Use our own loader for jpeg files.
2021-09-13 15:15:20 -04:00
Matthias Clasen
6a83d38e7b Add code to load jpegs
This lets us avoid gdk-pixbuf for loading
textures from the common image formats.

As a consequence, we are now linking against libjpeg.
2021-09-13 15:15:20 -04:00
Matthias Clasen
f89be80562 Add contentserializer tests for textures 2021-09-13 15:15:20 -04:00
Matthias Clasen
b66fa84161 Use our own loaders for content (de)serialization
Use our own loader to (de)serialiaze textures
to and from png and tiff.

We still fall back to gdk-pixbuf for handling all
the other image formats, and for pixbufs.
2021-09-13 15:15:20 -04:00
Matthias Clasen
ee7f2f9702 Add gdk_texture_save_to_tiff
This is a companion to gdk_texture_save_to_png, using
the tiff format, which will let us avoid lossy conversion
of HDR data, since we can store floating point data.
2021-09-13 15:15:20 -04:00
Matthias Clasen
900011808a Add tests for the tiff loader 2021-09-13 15:15:20 -04:00
Matthias Clasen
b8ee9873f3 Load tiffs without gdk-pixbuf
This will let us load floating point data, in
the future.
2021-09-13 15:15:20 -04:00
Matthias Clasen
0c9faea358 Add code to load and save tiff files
Add support for the tiff format, which is flexible
enough to handle all our memory texture formats
without loss.

As a consequence, we are now linking against libtiff.
2021-09-13 15:15:20 -04:00
Matthias Clasen
2568611a8c Add gdk_texture_save_to_png_bytes
Just expose what we already have available
internally, so e.g. tests can use it without
static linking.
2021-09-13 15:15:20 -04:00
Matthias Clasen
4c64111b5b Add tests for the png loader 2021-09-13 15:15:20 -04:00
Matthias Clasen
4f18a34dfa Save pngs without cairo
Use our own loader for pngs, which will allow
us to save e.g. 16-bit data in the future.
2021-09-13 15:15:20 -04:00
Matthias Clasen
bc0d315e6c Load pngs without gdk-pixbuf
Use our own loader for pngs, which will allow
us to get e.g. 16-bit data in the future.
2021-09-13 15:15:20 -04:00
Matthias Clasen
13d72eed2d Add code to load and save pngs
Using libpng instead of the lowest-common-denominator
gdk-pixbuf loader. This will allow us to load >8bit data,
and apply gamma and color correction in the future.
For now, this still just provides RGBA8 data.

As a consequence, we are now linking against libpng.
2021-09-13 15:15:20 -04:00
Matthias Clasen
7bafbeffcf Add gdk_texture_new_from_bytes
Add this new api, and make gdk_texture_new_from_file
a wrapper around it.
2021-09-13 14:03:15 -04:00
606 changed files with 32173 additions and 37341 deletions

View File

@@ -1,32 +0,0 @@
# SPDX-FileCopyrightText: 2021 The GTK Authors
# SPDX-License-Identifier: CC0-1.0
root = true
[*]
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
[*.[ch]]
indent_size = 2
indent_style = space
insert_final_newline = true
# For the legacy tabs which still exist in the code:
tab_width = 8
[*.ui]
indent_size = 2
indent_style = space
insert_final_newline = true
[*.xml]
indent_size = 2
indent_style = space
[meson.build]
indent_size = 2
indent_style = space
[*.md]
max_line_length = 80

View File

@@ -25,7 +25,7 @@ variables:
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true"
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled"
MESON_TEST_TIMEOUT_MULTIPLIER: 3
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v35"
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v33"
FLATPAK_IMAGE: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master"
.only-default:
@@ -91,7 +91,6 @@ fedora-x86_64:
- meson compile -C _build_hello
- .gitlab-ci/run-tests.sh _build x11
- .gitlab-ci/run-tests.sh _build wayland
- .gitlab-ci/run-tests.sh _build waylandgles
- .gitlab-ci/run-tests.sh _build broadway
release-build:

View File

@@ -53,7 +53,6 @@ RUN dnf -y install \
libpng-devel \
librsvg2 \
libselinux-devel \
libtiff-devel \
libubsan \
libXcomposite-devel \
libXcursor-devel \
@@ -76,7 +75,6 @@ RUN dnf -y install \
pcre-devel \
pcre-static \
python3 \
python3-docutils \
python3-gobject \
python3-jinja2 \
python3-markdown \

View File

@@ -44,24 +44,6 @@ case "${backend}" in
kill ${compositor}
;;
waylandgles)
export XDG_RUNTIME_DIR="$(mktemp -p $(pwd) -d xdg-runtime-XXXXXX)"
weston --backend=headless-backend.so --socket=wayland-6 --idle-time=0 &
compositor=$!
export WAYLAND_DISPLAY=wayland-6
meson test -C ${builddir} \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--print-errorlogs \
--setup=${backend} \
--suite=gtk \
--no-suite=gsk-compare-broadway
exit_code=$?
kill ${compositor}
;;
broadway)
export XDG_RUNTIME_DIR="$(mktemp -p $(pwd) -d xdg-runtime-XXXXXX)"
@@ -80,12 +62,6 @@ case "${backend}" in
exit_code=0
kill ${server}
;;
*)
echo "Failed to add ${backend} to .gitlab-ci/run-tests.sh"
exit 1
;;
esac
cd ${builddir}

112
NEWS
View File

@@ -1,127 +1,19 @@
Overview of Changes in 4.5.0
============================
Overview of Changes
===================
* gsk:
- Drop the GL renderer in favor of NGL
- Rename NGL to GL
- Fix some coordinate overflow issues
- Reimplement texture upload and download for better
support of image formats and color spaces
- New api:
gsk_transform_skew
gsk_transform_to_2d_components
* gdk:
- Support HSL in gdk_rgba_parse
- Use libpng, libjpeg and libtiff directly when loading
textures, and support more image formats (including 16bit
and float formats)
- New apis:
gdk_texture_new_from_bytes
gdk_texture_new_from_filename
gdk_texture_download_float
gdk_texture_save_to_png_bytes
gdk_texture_save_to_tiff
gdk_texture_save_to_tiff_bytes
gdk_display_create_gl_context
- Implement GIcon and GLoadableIcon in GdkTexture
- Move EGL initialization to the frontend
- Use configless EGL contexts, if supported
- Use >8bit pixel formats, if supported and requested
* css:
- Add support for line-height
- Add support for text-transform
* theme:
- Fixes for buttons in toolbars
* input:
- Update compose sequences from libX11 1.7.2
- Accept replacement string longer than 20 characters
* text:
- Implement sloped caret drawing
- Add a gtk-hint-font-metrics setting to switch
font rendering to be more similar to GTK3
* GtkTextView:
- Add support for line height
- Add support for text transforms
- Misc fixes for css->pango attribute translations
- Invalidate pango contexts when font settings change
- Improve undo grouping when overwriting
* GtkListView:
- Make tree indentation more flexible with
GtkTreeExpander:indent-for-icon
* GtkMenuButton:
- Support custom children
* GtkFlowBox:
- Add prepend and append
* GtkCalendar:
- Fix handling of weeks starting on Monday
* GtkWindow:
- Add a titlebar property
* GtkDropDown:
- Add a show-arrow property
* GtkPopoverMenu:
- Support a use-markup attribute in menu models
* Add GtkSymbolicPaintable
* Tools:
- Support DND in gtk4-node-editor and the inspector's recorder
* Demos:
- Improve the font rendering demo
* Build:
- Require Pango 1.49
- Require libpng, libtiff and libjpeg
- Speed up handling of resources during build
* X11:
- Support touchpad gestures with XInput 2.4
* Windows:
- Fix DND coordinates
* Translation updates:
Basque
Brazilian Portuguese
Catalan
Chinese (China)
Croatian
Czech
Dutch
Finnish
French
Galician
German
Hebrew
Hungarian
Icelandic
Indonesian
Kazakh
Korean
Latvian
Lithuanian
Persian
Portuguese
Romanian
Serbian
Slovak
Spanish
Swedish
Turkish
Ukrainian
Overview of Changes in 4.4.0

View File

@@ -10,12 +10,10 @@ GTK is a multi-platform toolkit for creating graphical user interfaces.
Offering a complete set of widgets, GTK is suitable for projects ranging
from small one-off projects to complete application suites.
GTK is a free and open-source software project. The licensing terms
for GTK, the GNU LGPL, allow it to be used by all developers, including those
developing proprietary software, without any license fees or royalties.
GTK is hosted by the GNOME project (thanks!) and used by a wide variety
of applications and projects.
GTK is free software and part of the GNU Project. However, the
licensing terms for GTK, the GNU LGPL, allow it to be used by all
developers, including those developing proprietary software, without any
license fees or royalties.
The official download location
@@ -114,7 +112,7 @@ can be found in the file:
docs/reference/gtk/html/gtk-building.html
```
Or [online](https://docs.gtk.org/gtk4/building.html)
Or [online](https://developer.gnome.org/gtk4/stable/gtk-building.html)
How to report bugs
------------------
@@ -153,9 +151,6 @@ Contributing to GTK
Please, follow the [contribution guide](./CONTRIBUTING.md) to know how to
start contributing to GTK.
If you want to support GTK financially, please consider donating to
the GNOME project, which runs the infrastructure hosting GTK.
Release notes
-------------

View File

@@ -37,7 +37,7 @@ update_image (void)
const char *text;
PangoFontDescription *desc;
PangoLayout *layout;
PangoRectangle ink, logical;
PangoRectangle ink, pink, logical;
int baseline;
cairo_surface_t *surface;
cairo_t *cr;
@@ -59,18 +59,16 @@ update_image (void)
fopt = cairo_font_options_copy (pango_cairo_context_get_font_options (context));
hint = gtk_combo_box_get_active_id (GTK_COMBO_BOX (hinting));
hintstyle = CAIRO_HINT_STYLE_DEFAULT;
if (hint)
{
if (strcmp (hint, "none") == 0)
hintstyle = CAIRO_HINT_STYLE_NONE;
else if (strcmp (hint, "slight") == 0)
hintstyle = CAIRO_HINT_STYLE_SLIGHT;
else if (strcmp (hint, "medium") == 0)
hintstyle = CAIRO_HINT_STYLE_MEDIUM;
else if (strcmp (hint, "full") == 0)
hintstyle = CAIRO_HINT_STYLE_FULL;
}
if (strcmp (hint, "none") == 0)
hintstyle = CAIRO_HINT_STYLE_NONE;
else if (strcmp (hint, "slight") == 0)
hintstyle = CAIRO_HINT_STYLE_SLIGHT;
else if (strcmp (hint, "medium") == 0)
hintstyle = CAIRO_HINT_STYLE_MEDIUM;
else if (strcmp (hint, "full") == 0)
hintstyle = CAIRO_HINT_STYLE_FULL;
else
hintstyle = CAIRO_HINT_STYLE_DEFAULT;
cairo_font_options_set_hint_style (fopt, hintstyle);
if (gtk_check_button_get_active (GTK_CHECK_BUTTON (hint_metrics)))
@@ -96,6 +94,7 @@ update_image (void)
pango_layout_set_font_description (layout, desc);
pango_layout_set_text (layout, text, -1);
pango_layout_get_extents (layout, &ink, &logical);
pink = ink;
baseline = pango_layout_get_baseline (layout);
pango_extents_to_pixels (&ink, NULL);
@@ -166,10 +165,10 @@ update_image (void)
cairo_stroke (cr);
cairo_set_source_rgb (cr, 1, 0, 0);
cairo_rectangle (cr,
scale * (10 + ink.x) - 0.5,
scale * (10 + ink.y) - 0.5,
scale * ink.width + 1,
scale * ink.height + 1);
scale * (10 + pango_units_to_double (pink.x)) + 0.5,
scale * (10 + pango_units_to_double (pink.y)) + 0.5,
scale * pango_units_to_double (pink.width) - 1,
scale * pango_units_to_double (pink.height) - 1);
cairo_stroke (cr);
}
@@ -194,7 +193,7 @@ update_image (void)
}
}
cairo_set_source_rgba (cr, 0, 0, 0, outline_alpha);
cairo_set_source_rgba (cr, 0, 0, 1, outline_alpha);
cairo_move_to (cr, scale * 20 - 0.5, scale * 20 - 0.5);
cairo_append_path (cr, path);
cairo_stroke (cr);

View File

@@ -177,8 +177,6 @@
<child>
<object class="GtkButton" id="up_button">
<property name="icon-name">list-add-symbolic</property>
<property name="halign">center</property>
<property name="valign">center</property>
<style>
<class name="circular"/>
</style>
@@ -202,8 +200,6 @@
<child>
<object class="GtkButton" id="down_button">
<property name="icon-name">list-remove-symbolic</property>
<property name="halign">center</property>
<property name="valign">center</property>
<style>
<class name="circular"/>
</style>

View File

@@ -874,8 +874,8 @@ gtk_gears_tick (GtkWidget *widget,
{
GtkGears *gears = GTK_GEARS (widget);
GtkGearsPrivate *priv = gtk_gears_get_instance_private (gears);
GdkFrameTimings *previous_timings;
gint64 previous_frame_time;
GdkFrameTimings *timings, *previous_timings;
gint64 previous_frame_time = 0;
gint64 frame_time;
gint64 history_start, history_len;
gint64 frame;
@@ -915,6 +915,12 @@ gtk_gears_tick (GtkWidget *widget,
}
}
timings = gdk_frame_clock_get_current_timings (frame_clock);
previous_timings = gdk_frame_clock_get_timings (frame_clock,
gdk_frame_timings_get_frame_counter (timings) - 1);
if (previous_timings != NULL)
previous_frame_time = gdk_frame_timings_get_frame_time (previous_timings);
return G_SOURCE_CONTINUE;
}

View File

@@ -94,12 +94,13 @@ show_page (GtkTextView *text_view,
gtk_text_buffer_insert (buffer, &iter, " can easily be realized with ", -1);
insert_link (buffer, &iter, "tags", 2);
gtk_text_buffer_insert (buffer, &iter, ".\n", -1);
gtk_text_buffer_insert (buffer, &iter, "Of course you can also embed Emoji 😋, ", -1);
gtk_text_buffer_insert (buffer, &iter, "icons ", -1);
gtk_text_buffer_insert (buffer, &iter,
"Of course you can also embed Emoji 😋, "
"icons ", -1);
theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (text_view)));
icon = gtk_icon_theme_lookup_icon (theme,
"eye-not-looking-symbolic",
"microphone-sensitivity-high-symbolic",
NULL,
16,
1,

View File

@@ -8,7 +8,7 @@
#include <stdlib.h>
#include <string.h>
static GdkTexture *avatar_texture_other;
static GdkPixbuf *avatar_pixbuf_other;
static GtkWidget *window = NULL;
#define GTK_TYPE_MESSAGE (gtk_message_get_type ())
@@ -196,9 +196,12 @@ gtk_message_row_update (GtkMessageRow *row)
gtk_button_set_label (GTK_BUTTON (priv->resent_by_button), priv->message->resent_by);
if (strcmp (priv->message->sender_nick, "@GTKtoolkit") == 0)
gtk_image_set_from_icon_name (priv->avatar_image, "org.gtk.Demo4");
{
gtk_image_set_from_icon_name (priv->avatar_image, "org.gtk.Demo4");
gtk_image_set_icon_size (priv->avatar_image, GTK_ICON_SIZE_LARGE);
}
else
gtk_image_set_from_paintable (priv->avatar_image, GDK_PAINTABLE (avatar_texture_other));
gtk_image_set_from_pixbuf (priv->avatar_image, avatar_pixbuf_other);
}
@@ -341,7 +344,7 @@ do_listbox (GtkWidget *do_widget)
if (!window)
{
avatar_texture_other = gdk_texture_new_from_resource ("/listbox/apple-red.png");
avatar_pixbuf_other = gdk_pixbuf_new_from_resource_at_scale ("/listbox/apple-red.png", 32, 32, FALSE, NULL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),

View File

@@ -25,7 +25,6 @@
<property name="margin-start">8</property>
<property name="margin-end">8</property>
<property name="icon-name">image-missing</property>
<property name="icon-size">large</property>
<layout>
<property name="column">0</property>
<property name="row">0</property>

View File

@@ -156,74 +156,10 @@ demos_h = custom_target('gtk4 demo header',
command: [ find_program('geninclude.py'), '@OUTPUT@', '@INPUT@' ],
)
objcopy_supports_add_symbol = false
objcopy = find_program('objcopy', required : false)
if objcopy.found()
objcopy_supports_add_symbol = run_command(objcopy, '--help').stdout().contains('--add-symbol')
endif
ld = find_program('ld', required : false)
if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_add_symbol and ld.found()
glib_compile_resources = find_program('glib-compile-resources')
# Create the resource blob
gtkdemo_gresource = custom_target('gtkdemo.gresource',
input : 'demo.gresource.xml',
output : 'gtkdemo.gresource',
depfile : 'gtkdemo.gresource.d',
command : [glib_compile_resources,
'--generate',
'--target=@OUTPUT@',
'--dependency-file=@DEPFILE@',
'--sourcedir=' + meson.current_source_dir(),
'--sourcedir=' + meson.current_build_dir(),
'@INPUT@'])
# Create resource data file
gtkdemo_resources_c = custom_target('gtkdemo_resources.c',
input : 'demo.gresource.xml',
output : 'gtkdemo_resources.c',
depfile : 'gtkdemo_resources.c.d',
command : [glib_compile_resources,
'--generate-source',
'--target=@OUTPUT@',
'--dependency-file=@DEPFILE@',
'--sourcedir=' + meson.current_source_dir(),
'--sourcedir=' + meson.current_build_dir(),
'--external-data',
'--c-name', '_g_binary_gtkdemo',
'@INPUT@'])
# Create object file containing resource data
gtkdemo_resources_binary = custom_target('gtkdemo_resources.o',
input : gtkdemo_gresource,
output : 'gtkdemo_resources.o',
command : [ld,
'-r',
'-b','binary',
'@INPUT@',
'-o','@OUTPUT@'])
# Rename symbol to match the one in the C file
gtkdemo_resources_o = custom_target('gtkdemo_resources2.o',
input : gtkdemo_resources_binary,
output : 'gtkdemo_resources2.o',
command : [objcopy,
'--add-symbol','_g_binary_gtkdemo_resource_data=.data:0',
'@INPUT@',
'@OUTPUT@'])
gtkdemo_resources = [
gtkdemo_resources_c,
gtkdemo_resources_o,
]
else
gtkdemo_resources = gnome.compile_resources('gtkdemo_resources',
'demo.gresource.xml',
source_dir: '.',
)
endif
gtkdemo_resources = gnome.compile_resources('gtkdemo_resources',
'demo.gresource.xml',
source_dir: '.',
)
# Use a subset of compiler flags
demo_cflags = []

View File

@@ -33,7 +33,7 @@
<developer_name>Matthias Clasen and others</developer_name>
<content_rating type="oars-1.1"/>
<releases>
<release version="@BUILD_VERSION@">
<release version="@BUILD_VERSION@" date="@BUILD_DATE@">
<description>
<p>A new build of GTK.</p>
</description>

View File

@@ -32,7 +32,7 @@
<developer_name>Matthias Clasen and others</developer_name>
<content_rating type="oars-1.1"/>
<releases>
<release version="@BUILD_VERSION@">
<release version="@BUILD_VERSION@" date="@BUILD_DATE@">
<description>
<p>A new build of GTK.</p>
</description>

View File

@@ -12,9 +12,19 @@ demo_conf_h = declare_dependency(
)
# appdata
today = 'unknown'
date = find_program('date',
required: false)
if date.found()
r = run_command(date, '-I')
if r.returncode() == 0
today = r.stdout().strip()
endif
endif
appdata_config = configuration_data()
appdata_config.set('BUILD_VERSION', meson.project_version())
appdata_config.set('BUILD_DATE', today)
subdir('constraint-editor')
subdir('gtk-demo')

View File

@@ -24,7 +24,7 @@
#include "gtkrendererpaintableprivate.h"
#include "gsk/gskrendernodeparserprivate.h"
#include "gsk/gl/gskglrenderer.h"
#include "gsk/ngl/gsknglrenderer.h"
#ifdef GDK_WINDOWING_BROADWAY
#include "gsk/broadway/gskbroadwayrenderer.h"
#endif
@@ -646,6 +646,7 @@ create_cairo_texture (NodeEditorWindow *self)
GskRenderer *renderer;
GskRenderNode *node;
GdkTexture *texture;
GdkSurface *surface;
paintable = gtk_picture_get_paintable (GTK_PICTURE (self->picture));
if (paintable == NULL ||
@@ -658,8 +659,9 @@ create_cairo_texture (NodeEditorWindow *self)
if (node == NULL)
return NULL;
surface = gtk_native_get_surface (gtk_widget_get_native (GTK_WIDGET (self)));
renderer = gsk_cairo_renderer_new ();
gsk_renderer_realize (renderer, NULL, NULL);
gsk_renderer_realize (renderer, surface, NULL);
texture = gsk_renderer_render_texture (renderer, node, NULL);
gsk_render_node_unref (node);
@@ -837,18 +839,16 @@ node_editor_window_add_renderer (NodeEditorWindow *self,
GskRenderer *renderer,
const char *description)
{
GdkSurface *surface;
GdkPaintable *paintable;
if (!gsk_renderer_realize (renderer, NULL, NULL))
{
GdkSurface *surface = gtk_native_get_surface (GTK_NATIVE (self));
g_assert (surface != NULL);
surface = gtk_native_get_surface (GTK_NATIVE (self));
g_assert (surface != NULL);
if (!gsk_renderer_realize (renderer, surface, NULL))
{
g_object_unref (renderer);
return;
}
if (renderer != NULL && !gsk_renderer_realize (renderer, surface, NULL))
{
g_object_unref (renderer);
return;
}
paintable = gtk_renderer_paintable_new (renderer, gtk_picture_get_paintable (GTK_PICTURE (self->picture)));
@@ -872,7 +872,7 @@ node_editor_window_realize (GtkWidget *widget)
"Default");
#endif
node_editor_window_add_renderer (self,
gsk_gl_renderer_new (),
gsk_ngl_renderer_new (),
"OpenGL");
#ifdef GDK_RENDERING_VULKAN
node_editor_window_add_renderer (self,

View File

@@ -198,7 +198,6 @@
<child>
<object class="GtkPicture" id="picture">
<property name="can-shrink">0</property>
<property name="keep-aspect-ratio">1</property>
<property name="halign">center</property>
<property name="valign">center</property>
<child>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 3.2 MiB

Binary file not shown.

View File

@@ -1,73 +1,9 @@
# demos/widget-factory
objcopy_supports_add_symbol = false
objcopy = find_program('objcopy', required : false)
if objcopy.found()
objcopy_supports_add_symbol = run_command(objcopy, '--help').stdout().contains('--add-symbol')
endif
ld = find_program('ld', required : false)
if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_add_symbol and ld.found()
glib_compile_resources = find_program('glib-compile-resources')
# Create the resource blob
widgetfactory_gresource = custom_target('widgetfactory.gresource',
input : 'widget-factory.gresource.xml',
output : 'widgetfactory.gresource',
depfile: 'widgetfactory.gresource.d',
command : [glib_compile_resources,
'--generate',
'--target=@OUTPUT@',
'--dependency-file=@DEPFILE@',
'--sourcedir=' + meson.current_source_dir(),
'--sourcedir=' + meson.current_build_dir(),
'@INPUT@'])
# Create resource data file
widgetfactory_resources_c = custom_target('widgetfactory_resources.c',
input : 'widget-factory.gresource.xml',
output : 'widgetfactory_resources.c',
depfile: 'widgetfactory_resources.c.d',
command : [glib_compile_resources,
'--generate-source',
'--target=@OUTPUT@',
'--dependency-file=@DEPFILE@',
'--sourcedir=' + meson.current_source_dir(),
'--sourcedir=' + meson.current_build_dir(),
'--external-data',
'--c-name', '_g_binary_widgetfactory',
'@INPUT@'])
# Create object file containing resource data
widgetfactory_resources_binary = custom_target('widgetfactory_resources.o',
input : widgetfactory_gresource,
output : 'widgetfactory_resources.o',
command : [ld,
'-r',
'-b','binary',
'@INPUT@',
'-o','@OUTPUT@'])
# Rename symbol to match the one in the C file
widgetfactory_resources_o = custom_target('widgetfactory_resources2.o',
input : widgetfactory_resources_binary,
output : 'widgetfactory_resources2.o',
command : [objcopy,
'--add-symbol','_g_binary_widgetfactory_resource_data=.data:0',
'@INPUT@',
'@OUTPUT@'])
widgetfactory_resources = [
widgetfactory_resources_c,
widgetfactory_resources_o,
]
else
widgetfactory_resources = gnome.compile_resources('widgetfactory_resources',
'widget-factory.gresource.xml',
source_dir: '.',
)
endif
widgetfactory_resources = gnome.compile_resources('widgetfactory_resources',
'widget-factory.gresource.xml',
source_dir: '.',
)
executable('gtk4-widget-factory',
sources: ['widget-factory.c', widgetfactory_resources],

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 2.4 MiB

View File

@@ -34,7 +34,7 @@
<developer_name>Matthias Clasen and others</developer_name>
<content_rating type="oars-1.1"/>
<releases>
<release version="@BUILD_VERSION@">
<release version="@BUILD_VERSION@" date="@BUILD_DATE@">
<description>
<p>A new build of GTK.</p>
</description>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 2.0 MiB

File diff suppressed because it is too large Load Diff

View File

@@ -16,10 +16,12 @@ if get_option('gtk_doc')
command: [
gidocgen,
'generate',
gidocgen_common_args,
'--quiet',
'--fatal-warnings',
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
'--config=@INPUT0@',
'--output-dir=@OUTPUT@',
'--no-namespace-dir',
'--content-dir=@0@'.format(meson.current_source_dir()),
'@INPUT1@',
],
@@ -44,10 +46,12 @@ if get_option('gtk_doc')
command: [
gidocgen,
'generate',
gidocgen_common_args,
'--quiet',
'--fatal-warnings',
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
'--config=@INPUT0@',
'--output-dir=@OUTPUT@',
'--no-namespace-dir',
'--content-dir=@0@'.format(meson.current_source_dir()),
'@INPUT1@',
],
@@ -74,10 +78,12 @@ if get_option('gtk_doc')
command: [
gidocgen,
'generate',
gidocgen_common_args,
'--quiet',
'--fatal-warnings',
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
'--config=@INPUT0@',
'--output-dir=@OUTPUT@',
'--no-namespace-dir',
'--content-dir=@0@'.format(meson.current_source_dir()),
'@INPUT1@',
],

View File

@@ -13,5 +13,4 @@ baseURLs = [
[ 'Gtk', 'https://docs.gtk.org/gtk4/' ],
[ 'Pango', 'https://docs.gtk.org/Pango/' ],
[ 'PangoCairo', 'https://docs.gtk.org/PangoCairo/' ],
[ 'GdkPixbuf', 'https://docs.gtk.org/gdk-pixbuf/' ],
]

View File

@@ -13,10 +13,12 @@ if get_option('gtk_doc')
command: [
gidocgen,
'generate',
gidocgen_common_args,
'--quiet',
'--fatal-warnings',
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
'--config=@INPUT0@',
'--output-dir=@OUTPUT@',
'--no-namespace-dir',
'--content-dir=@0@'.format(meson.current_source_dir()),
'@INPUT1@',
],

View File

@@ -13,5 +13,4 @@ baseURLs = [
[ 'Gtk', 'https://docs.gtk.org/gtk4/' ],
[ 'Pango', 'https://docs.gtk.org/Pango/' ],
[ 'PangoCairo', 'https://docs.gtk.org/PangoCairo/' ],
[ 'GdkPixbuf', 'https://docs.gtk.org/gdk-pixbuf/' ],
]

View File

@@ -3,13 +3,13 @@ Slug: gtk-getting-started
GTK is a [widget toolkit](http://en.wikipedia.org/wiki/Widget_toolkit).
Each user interface created by GTK consists of widgets. This is implemented
in C using [class@GObject.Object], an object-oriented framework for C. Widgets
in C using [GObject](#gobject), an object-oriented framework for C. Widgets
are organized in a hierarchy. The window widget is the main container.
The user interface is then built by adding buttons, drop-down menus, input
fields, and other widgets to the window. If you are creating complex user
interfaces it is recommended to use GtkBuilder and its GTK-specific markup
description language, instead of assembling the interface manually. You can
also use a visual user interface editor, like [Glade](https://glade.gnome.org/).
also use a visual user interface editor, like [glade](https://glade.gnome.org/).
GTK is event-driven. The toolkit listens for events such as a click
on a button, and passes the event to your application.
@@ -17,7 +17,7 @@ on a button, and passes the event to your application.
This chapter contains some tutorial information to get you started with
GTK programming. It assumes that you have GTK, its dependencies and a C
compiler installed and ready to use. If you need to build GTK itself first,
refer to the [Compiling the GTK libraries](building.html) section in this
refer to the [Compiling the GTK libraries](#gtk-compiling) section in this
reference.
## Basics
@@ -68,7 +68,7 @@ gcc $( pkg-config --cflags gtk4 ) -o example-0 example-0.c $( pkg-config --libs
```
For more information on how to compile a GTK application, please
refer to the [Compiling GTK Applications](compiling.html)
refer to the [Compiling GTK Applications](#gtk-compiling)
section in this reference.
All GTK applications will, of course, include `gtk/gtk.h`, which declares
@@ -106,16 +106,16 @@ The call to [ctor@Gtk.ApplicationWindow.new] will create a new
window will have a frame, a title bar, and window controls depending on the
platform.
A window title is set using [`method@Gtk.Window.set_title`]. This function
A window title is set using [method@Gtk.Window.set_title]. This function
takes a `GtkWindow` pointer and a string as input. As our `window` pointer
is a `GtkWidget` pointer, we need to cast it to `GtkWindow`; instead of
casting `window` via a typical C cast like `(GtkWindow*)`, `window` can be
cast using the macro `GTK_WINDOW()`. `GTK_WINDOW()` will check if the
pointer is an instance of the `GtkWindow` class, before casting, and emit a
warning if the check fails. More information about this convention can be
found [in the GObject documentation](https://docs.gtk.org/gobject/concepts.html#conventions).
found [here](https://developer.gnome.org/gobject/stable/gtype-conventions.html).
Finally the window size is set using [`method@Gtk.Window.set_default_size`]
Finally the window size is set using [method@Gtk.Window.set_default_size]
and the window is then shown by GTK via [method@Gtk.Widget.show].
When you close the window, by (for example) pressing the X button, the
@@ -161,24 +161,19 @@ activate (GtkApplication *app,
{
GtkWidget *window;
GtkWidget *button;
GtkWidget *box;
window = gtk_application_window_new (app);
gtk_window_set_title (GTK_WINDOW (window), "Window");
gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_halign (box, GTK_ALIGN_CENTER);
gtk_widget_set_valign (box, GTK_ALIGN_CENTER);
gtk_window_set_child (GTK_WINDOW (window), box);
button = gtk_button_new_with_label ("Hello World");
gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window);
gtk_box_append (GTK_BOX (box), button);
gtk_window_set_child (GTK_WINDOW (window), button);
gtk_widget_show (window);
}
@@ -217,10 +212,10 @@ The `GtkBox` widget is created with [ctor@Gtk.Box.new], which takes a
this box will contain can either be laid out horizontally or vertically.
This does not matter in this particular case, as we are dealing with only
one button. After initializing box with the newly created `GtkBox`, the code
adds the box widget to the window widget using [`method@Gtk.Window.set_child`].
adds the box widget to the window widget using [method@Gtk.Window.set_child].
Next the `button` variable is initialized in similar manner.
[`ctor@Gtk.Button.new_with_label`] is called which returns a
[ctor@Gtk.Button.new_with_label] is called which returns a
[class@Gtk.Button] to be stored in `button`. Afterwards `button` is added to
our `box`.
@@ -246,8 +241,8 @@ More information about creating buttons can be found
[here](https://wiki.gnome.org/HowDoI/Buttons).
The rest of the code in `example-1.c` is identical to `example-0.c`. The next
section will elaborate further on how to add several [class@Gtk.Widget]s to your
GTK application.
section will elaborate further on how to add several GtkWidgets to your GTK
application.
## Packing
@@ -256,18 +251,10 @@ a window. When you do so, it becomes important to control how each widget is
positioned and sized. This is where packing comes in.
GTK comes with a large variety of _layout containers_ whose purpose it
is to control the layout of the child widgets that are added to them, like:
is to control the layout of the child widgets that are added to them.
See [Layout containers](#LayoutContainers) for an overview.
- [class@Gtk.Box]
- [class@Gtk.Grid]
- [class@Gtk.Revealer]
- [class@Gtk.Stack]
- [class@Gtk.Overlay]
- [class@Gtk.Paned]
- [class@Gtk.Expander]
- [class@Gtk.Fixed]
The following example shows how the [class@Gtk.Grid] container lets you
The following example shows how the GtkGrid container lets you
arrange several buttons:
![Grid packing](grid-packing.png)
@@ -366,11 +353,11 @@ draw function.
The contents of a widget often need to be partially or fully redrawn, e.g.
when another window is moved and uncovers part of the widget, or when the
window containing it is resized. It is also possible to explicitly cause a
widget to be redrawn, by calling [`method@Gtk.Widget.queue_draw`]. GTK takes
widget to be redrawn, by calling [method@Gtk.Widget.queue_draw]. GTK takes
care of most of the details by providing a ready-to-use cairo context to the
draw function.
The following example shows how to use a draw function with [class@Gtk.DrawingArea].
The following example shows how to use a draw function with GtkDrawingArea.
It is a bit more complicated than the previous examples, since it also
demonstrates input event handling with event controllers.
@@ -415,9 +402,9 @@ resize_cb (GtkWidget *widget,
if (gtk_native_get_surface (gtk_widget_get_native (widget)))
{
surface = gdk_surface_create_similar_surface (gtk_native_get_surface (gtk_widget_get_native (widget)),
CAIRO_CONTENT_COLOR,
gtk_widget_get_width (widget),
gtk_widget_get_height (widget));
CAIRO_CONTENT_COLOR,
gtk_widget_get_width (widget),
gtk_widget_get_height (widget));
/* Initialize the surface to white */
clear_surface ();
@@ -703,16 +690,16 @@ gcc $( pkg-config --cflags gtk4 ) -o example-3 example-3.c $( pkg-config --libs
Note that `GtkBuilder` can also be used to construct objects that are
not widgets, such as tree models, adjustments, etc. That is the reason
the method we use here is called [`method@Gtk.Builder.get_object`] and
returns a `GObject` instead of a `GtkWidget`.
the method we use here is called [method@Gtk.Builder.get_object] and returns
a `GObject` instead of a `GtkWidget`.
Normally, you would pass a full path to [`method@Gtk.Builder.add_from_file`] to
Normally, you would pass a full path to [method@Gtk.Builder.add_from_file] to
make the execution of your program independent of the current directory.
A common location to install UI descriptions and similar data is
`/usr/share/appname`.
It is also possible to embed the UI description in the source code as a
string and use [`method@Gtk.Builder.add_from_string`] to load it. But keeping the
string and use [method@Gtk.Builder.add_from_string] to load it. But keeping the
UI description in a separate file has several advantages: It is then possible
to make minor adjustments to the UI without recompiling your program, and,
more importantly, graphical UI editors such as [Glade](http://glade.gnome.org)
@@ -775,17 +762,17 @@ main (int argc, char *argv[])
```
All the application logic is in the application class, which is a subclass of
`GtkApplication`. Our example does not yet have any interesting functionality.
GtkApplication. Our example does not yet have any interesting functionality.
All it does is open a window when it is activated without arguments, and open
the files it is given, if it is started with arguments.
To handle these two cases, we override the `activate()` vfunc, which gets
To handle these two cases, we override the activate() vfunc, which gets
called when the application is launched without commandline arguments, and
the `open()` virtual function, which gets called when the application is
launched with commandline arguments.
To learn more about `GApplication` entry points, consult the GIO
[documentation](https://docs.gtk.org/gio/class.Application.html).
[documentation](https://developer.gnome.org/gio/stable/GApplication.html#GApplication.description).
```c
#include <gtk/gtk.h>
@@ -854,8 +841,8 @@ example_app_new (void)
```
Another important class that is part of the application support in GTK is
[class@Gtk.ApplicationWindow]. It is typically subclassed as well. Our
subclass does not do anything yet, so we will just get an empty window.
`GtkApplicationWindow`. It is typically subclassed as well. Our subclass does
not do anything yet, so we will just get an empty window.
```c
#include <gtk/gtk.h>
@@ -920,10 +907,10 @@ and it accepts files as commandline arguments.
### Populating the window
In this step, we use a `GtkBuilder` template to associate a
`GtkBuilder` ui file with our application window class.
In this step, we use a GtkBuilder template to associate a
GtkBuilder ui file with our application window class.
Our simple ui file gives the window a title, and puts a `GtkStack`
Our simple ui file gives the window a title, and puts a GtkStack
widget as the main content.
```xml
@@ -947,9 +934,9 @@ widget as the main content.
To make use of this file in our application, we revisit our
`GtkApplicationWindow` subclass, and call
[`method@Gtk.WidgetClass.set_template_from_resource`] from the class init
`gtk_widget_class_set_template_from_resource()` from the class init
function to set the ui file as template for this class. We also
add a call to [`method@Gtk.Widget.init_template`] in the instance init
add a call to `gtk_widget_init_template()` in the instance init
function to instantiate the template for each instance of our
class.
@@ -976,7 +963,7 @@ example_app_window_class_init (ExampleAppWindowClass *class)
You may have noticed that we used the `_from_resource()` variant of the function
that sets a template. Now we need to use
[GLib's resource functionality](https://docs.gtk.org/gio/struct.Resource.html)
[GLib's resource functionality](https://developer.gnome.org/gio/stable/GResource.html)
to include the ui file in the binary. This is commonly done by listing all resources
in a `.gresource.xml` file, such as this:
@@ -998,7 +985,7 @@ glib-compile-resources exampleapp.gresource.xml --target=resources.c --generate-
```
The gnome module of the [Meson build system](https://mesonbuild.com)
provides the [`gnome.compile_resources()`](https://mesonbuild.com/Gnome-module.html#gnomecompile_resources)
provides the [gnome.compile_resources()](https://mesonbuild.com/Gnome-module.html#gnomecompile_resources)
method for this task.
Our application now looks like this:
@@ -1014,7 +1001,7 @@ To this end, we add a member to the struct of our application window subclass
and keep a reference to the `GtkStack` there. The first member of the struct
should be the parent type from which the class is derived. Here,
`ExampleAppWindow` is derived from `GtkApplicationWindow`. The
[`func@Gtk.widget_class_bind_template_child`] function arranges things so that after
`gtk_widget_class_bind_template_child()` function arranges things so that after
instantiating the template, the `stack` member of the struct will point to the
widget of the same name from the template.
@@ -1094,7 +1081,7 @@ tell it to display information about our stack.
The stack switcher gets all its information it needs to display tabs from
the stack that it belongs to. Here, we are passing the label to show for
each file as the last argument to the [`method@Gtk.Stack.add_titled`]
each file as the last argument to the [method@Gtk.Stack.add_titled]
function.
Our application is beginning to take shape:
@@ -1134,7 +1121,7 @@ resulting menu model with the menu button that we've added to the headerbar.
Since menus work by activating GActions, we also have to add a suitable set
of actions to our application.
Adding the actions is best done in the `startup()` vfunc, which is guaranteed
Adding the actions is best done in the startup() vfunc, which is guaranteed
to be called once for each primary application instance:
```c
@@ -1192,7 +1179,7 @@ example_app_class_init (ExampleAppClass *class)
Our preferences menu item does not do anything yet, but the Quit menu item
is fully functional. Note that it can also be activated by the usual Ctrl-Q
shortcut. The shortcut was added with [`method@Gtk.Application.set_accels_for_action`].
shortcut. The shortcut was added with `gtk_application_set_accels_for_action()`.
The application menu looks like this:
@@ -1204,7 +1191,7 @@ A typical application will have a some preferences that should be remembered
from one run to the next. Even for our simple example application, we may
want to change the font that is used for the content.
We are going to use [class@Gio.Settings] to store our preferences. `GSettings` requires
We are going to use `GSettings` to store our preferences. `GSettings` requires
a schema that describes our settings:
```xml
@@ -1231,9 +1218,10 @@ a schema that describes our settings:
```
Before we can make use of this schema in our application, we need to compile
it into the binary form that GSettings expects. GIO provides macros to do
this in Autotools-based projects, and the gnome module of the Meson build
system provides the [`gnome.compile_schemas()`](https://mesonbuild.com/Gnome-module.html#gnomecompile_schemas)
it into the binary form that GSettings expects. GIO provides
[macros](https://developer.gnome.org/gio/2.36/ch31s06.html) to do this in
autotools-based projects, and the gnome module of the Meson build system
provides the [gnome.compile_schemas()](https://mesonbuild.com/Gnome-module.html#gnomecompile_schemas)
method for this task.
Next, we need to connect our settings to the widgets that they are supposed
@@ -1693,8 +1681,7 @@ What our application looks like now:
Widgets and other objects have many useful properties.
Here we show some ways to use them in new and flexible ways, by wrapping
them in actions with [class@Gio.PropertyAction] or by binding them with
[class@GObject.Binding].
them in actions with `GPropertyAction` or by binding them with `GBinding`.
To set this up, we add two labels to the header bar in our window template,
named `lines_label` and `lines`, and bind them to struct members in the

View File

@@ -1,57 +0,0 @@
.. _gtk4-broadwayd(1):
==============
gtk4-broadwayd
==============
---------------------------
The Broadway display server
---------------------------
SYNOPSIS
--------
| **gtk4-broadwayd** [OPTIONS...] <DISPLAY>
| **gtk4-broadwayd** --port=PORT --address=ADDRESS <DISPLAY>
| **gtk4-broadwayd** --unixaddress=ADDRESS <DISPLAY>
DESCRIPTION
-----------
``gtk4-broadwayd`` is a display server for the Broadway GDK backend. It allows
multiple GTK applications to display their windows in the same web browser, by
connecting to gtk4-broadwayd.
When using gtk4-broadwayd, specify the display number to use, prefixed with a
colon, similar to X. The default display number is 0.
::
gtk4-broadwayd :5
Then point your web browser at ``http://127.0.0.1:8085``.
Start your applications like this:
::
GDK_BACKEND=broadway BROADWAY_DISPLAY=:5 gtk4-demo
OPTIONS
-------
``--port PORT``
Use the given ``PORT`` for the HTTP connection, instead of the default ``8080 + (DISPLAY - 1)``.
``--address ADDRESS``
Use the given ``address`` for the HTTP connection, instead of the default ``http://127.0.0.1``.
``--unixsocket ADDRESS``
Use the given ``address`` as the unix domain socket address. This option
overrides ``--address`` and ``--port``, and it is available only on Unix-like
systems.

View File

@@ -0,0 +1,84 @@
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<refentry id="gtk4-broadwayd">
<refentryinfo>
<title>gtk4-broadwayd</title>
<productname>GTK</productname>
<authorgroup>
<author>
<contrib>Developer</contrib>
<firstname>Alexander</firstname>
<surname>Larsson</surname>
</author>
</authorgroup>
</refentryinfo>
<refmeta>
<refentrytitle>gtk4-broadwayd</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="manual">User Commands</refmiscinfo>
</refmeta>
<refnamediv>
<refname>gtk4-broadwayd</refname>
<refpurpose>Broadway display server</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>gtk4-broadwayd</command>
<arg choice="opt">--port <replaceable>PORT</replaceable></arg>
<arg choice="opt">--address <replaceable>ADDRESS</replaceable></arg>
<arg choice="opt">--unixsocket <replaceable>ADDRESS</replaceable></arg>
<arg choice="opt"><replaceable>:DISPLAY</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>
<para>
<command>gtk4-broadwayd</command> is a display server for the Broadway
GDK backend. It allows multiple GTK applications to display their
windows in the same web browser, by connecting to gtk4-broadwayd.
</para>
<para>
When using gtk4-broadwayd, specify the display number to use, prefixed
with a colon, similar to X. The default display number is 0.
<programlisting>
gtk4-broadwayd :5
</programlisting>
Then point your web browser at <literal>http://127.0.0.1:8085</literal>.
Start your applications like this:
<programlisting>
GDK_BACKEND=broadway BROADWAY_DISPLAY=:5 gtk4-demo
</programlisting>
</para>
</refsect1>
<refsect1><title>Options</title>
<variablelist>
<varlistentry>
<term>--port</term>
<listitem><para>Use <replaceable>PORT</replaceable> as the HTTP
port, instead of the default 8080 + (<replaceable>DISPLAY</replaceable> - 1).
</para></listitem>
</varlistentry>
<varlistentry>
<term>--address</term>
<listitem><para>Use <replaceable>ADDRESS</replaceable> as the HTTP
address, instead of the default <literal>http://127.0.0.1:<replaceable>PORT</replaceable></literal>.
</para></listitem>
</varlistentry>
<varlistentry>
<term>--unixsocket</term>
<listitem><para>Use <replaceable>ADDRESS</replaceable> as the unix domain socket
address. This option overrides <literal>--address</literal> and <literal>--port</literal>.
It is available only on Unix-like systems.
</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
</refentry>

View File

@@ -1,85 +0,0 @@
.. _gtk4-builder-tool(1):
=================
gtk4-builder-tool
=================
-----------------------
GtkBuilder File Utility
-----------------------
SYNOPSIS
--------
| **gtk4-builder-tool** <COMMAND> [OPTIONS...] <FILE>
|
| **gtk4-builder-tool** validate <FILE>
| **gtk4-builder-tool** enumerate <FILE>
| **gtk4-builder-tool** simplify [OPTIONS...] <FILE>
| **gtk4-builder-tool** preview [OPTIONS...] <FILE>
DESCRIPTION
-----------
``gtk4-builder-tool`` can perform various operations on GtkBuilder UI definition
files.
COMMANDS
--------
Validation
^^^^^^^^^^
The ``validate`` command validates the given UI definition file and reports
errors to ``stderr``.
Enumeration
^^^^^^^^^^^
The ``enumerate`` command lists all the named objects that are present in the UI
definition file.
Preview
^^^^^^^
The ``preview`` command displays the UI dfinition file.
This command accepts options to specify the ID of the toplevel object and a CSS
file to use.
``--id=ID``
The ID of the object to preview. If not specified, gtk4-builder-tool will
choose a suitable object on its own.
``--css=FILE``
Load style information from the given CSS file.
Simplification
^^^^^^^^^^^^^^
The ``simplify`` command simplifies the UI definition file by removing
properties that are set to their default values and writes the resulting XML to
the standard output, or back to the input file.
When the ``--3to4`` option is specified, the ``simplify`` command interprets the
input as a GTK 3 UI definuition file and attempts to convert it to GTK 4
equivalents. It performs various conversions, such as renaming properties,
translating child properties to layout properties, rewriting the setup for
GtkNotebook, GtkStack, GtkAssistant or changing toolbars into boxes.
You should always test the modified UI definition files produced by
gtk4-builder-tool before using them in production.
Note in particular that the conversion done with ``--3to4`` is meant as a
starting point for a port from GTK 3 to GTK 4. It is expected that you will have
to do manual fixups after the initial conversion.
``--replace``
Write the content back to the UI definition file instead of using the standard
output.
``--3to4``
Transform a GTK 3 UI definition file to the equivalent GTK 4 definitions.

View File

@@ -0,0 +1,110 @@
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<refentry id="gtk4-builder-tool">
<refentryinfo>
<title>gtk4-builder-tool</title>
<productname>GTK</productname>
<authorgroup>
<author>
<contrib>Developer</contrib>
<firstname>Matthias</firstname>
<surname>Clasen</surname>
</author>
</authorgroup>
</refentryinfo>
<refmeta>
<refentrytitle>gtk4-builder-tool</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="manual">User Commands</refmiscinfo>
</refmeta>
<refnamediv>
<refname>gtk4-builder-tool</refname>
<refpurpose>GtkBuilder file utility</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>gtk4-builder-tool</command>
<arg choice="opt"><replaceable>COMMAND</replaceable></arg>
<arg choice="opt" rep="repeat"><replaceable>OPTION</replaceable></arg>
<arg choice="plain"><replaceable>FILE</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>
<para>
<command>gtk4-builder-tool</command> can perform various operations
on GtkBuilder .ui files.
</para>
<para>
The <option>validate</option> command validates the .ui file and reports
errors to stderr.
</para>
<para>
The <option>enumerate</option> command lists all the named objects that
are created in the .ui file.
</para>
<para>
The <option>preview</option> command displays the .ui file. This command
accepts options to specify the ID of the toplevel object and a .css file
to use.
</para>
<para>
The <option>simplify</option> command simplifies the .ui file by removing
properties that are set to their default values and writes the resulting XML
to stdout, or back to the input file.
</para>
<para>
When the <option>--3to4</option> is specified, <option>simplify</option>
interprets the input as a GTK 3 ui file and attempts to convert it to GTK 4
equivalents. It performs various conversions, such as renaming properties,
translating child properties to layout properties, rewriting the setup for
GtkNotebook, GtkStack, GtkAssistant or changing toolbars into boxes.
</para>
<para>
You should always test the modified .ui files produced by gtk4-builder-tool
before using them in production.
</para>
<para>
Note in particular that the conversion
done with <option>--3to4</option> is meant as a starting point for a port
from GTK 3 to GTK 4. It is expected that you will have to do manual fixups
after the initial conversion.
</para>
</refsect1>
<refsect1><title>Simplify Options</title>
<para>The <option>simplify</option> command accepts the following options:</para>
<variablelist>
<varlistentry>
<term><option>--replace</option></term>
<listitem><para>Write the content back to the .ui file instead of stdout.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--3to4</option></term>
<listitem><para>Transform a GTK 3 ui file to GTK 4</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1><title>Preview Options</title>
<para>The <option>preview</option> command accepts the following options:</para>
<variablelist>
<varlistentry>
<term><option>--id=<arg choice="plain">ID</arg></option></term>
<listitem><para>The ID of the object to preview. If not specified,
gtk4-builder-tool will choose a suitable object on its own.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--css=<arg choice="plain">FILE</arg></option></term>
<listitem><para>Load style information from the given .css file.</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
</refentry>

View File

@@ -1,22 +0,0 @@
.. _gtk4-demo-application(1):
=====================
gtk4-demo-application
=====================
--------------------------
Demonstrate GtkApplication
--------------------------
SYNOPSIS
--------
| **gtk4-demo-application**
DESCRIPTION
-----------
``gtk4-demo-application`` is an example application used by ``gtk4-demo``.
There is no need to call it manually.

View File

@@ -0,0 +1,44 @@
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<refentry id="gtk4-demo-application">
<refentryinfo>
<title>gtk4-demo-application</title>
<productname>GTK</productname>
<authorgroup>
<author>
<contrib>Developer</contrib>
<firstname>Matthias</firstname>
<surname>Clasen</surname>
</author>
</authorgroup>
</refentryinfo>
<refmeta>
<refentrytitle>gtk4-demo-application</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="manual">User Commands</refmiscinfo>
</refmeta>
<refnamediv>
<refname>gtk4-demo-application</refname>
<refpurpose>Demonstrate GtkApplication</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>gtk4-demo-application</command>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>
<para>
<command>gtk4-demo-application</command> is an example application
used by <command>gtk4-demo</command>. There is no need to call it
manually.
</para>
</refsect1>
</refentry>

View File

@@ -1,48 +0,0 @@
.. _gtk4-demo(1):
=========
gtk4-demo
=========
-----------------------
Demonstrate GTK widgets
-----------------------
SYNOPSIS
--------
| **gtk4-demo** [OPTIONS...]
DESCRIPTION
-----------
``gtk4-demo`` is a collection of examples.
Its purpose is to demonstrate many GTK widgets in a form that is useful to
application developers.
The application shows the source code for each example, as well as other used
resources, such as UI description files and image assets.
OPTIONS
-------
``-h, --help``
Show help options.
``--version``
Show program version.
``--list``
List available examples.
``--run EXAMPLE``
Run the named example. Use ``--list`` to see the available examples.
``--autoquit``
Quit after a short timeout. This is intended for use with ``--run``, e.g. when profiling.

View File

@@ -0,0 +1,81 @@
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<refentry id="gtk4-demo">
<refentryinfo>
<title>gtk4-demo</title>
<productname>GTK</productname>
<authorgroup>
<author>
<contrib>Developer</contrib>
<firstname>Matthias</firstname>
<surname>Clasen</surname>
</author>
</authorgroup>
</refentryinfo>
<refmeta>
<refentrytitle>gtk4-demo</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="manual">User Commands</refmiscinfo>
</refmeta>
<refnamediv>
<refname>gtk4-demo</refname>
<refpurpose>Demonstrate GTK widgets</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>gtk4-demo</command>
<arg choice="opt">--help</arg>
<arg choice="opt">--version</arg>
<arg choice="opt">--list</arg>
<arg choice="opt">--run <replaceable>EXAMPLE</replaceable></arg>
<arg choice="opt">--autoquit</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>
<para>
<command>gtk4-demo</command> is a collection of examples.
Its purpose is to demonstrate many GTK widgets in a form
that is useful to application developers.
</para>
<para>
The application shows the source code for each example, as well as
other used resources, such as ui files and icons.
</para>
</refsect1>
<refsect1><title>Options</title>
<para>The following options are understood:</para>
<variablelist>
<varlistentry>
<term><option>-h</option>, <option>--help</option></term>
<listitem><para>Show help options</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--version</option></term>
<listitem><para>Show program version</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--list</option></term>
<listitem><para>List available examples.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-run <replaceable>EXAMPLE</replaceable></option></term>
<listitem><para>Run the named example. Use <option>--list</option> to
see the available examples.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--autoquit</option></term>
<listitem><para>Quit after a short timeout. This is intended for use
with <option>--run</option>, e.g. when profiling.</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
</refentry>

View File

@@ -1,40 +0,0 @@
.. _gtk4-encode-symbolic-svg(1):
========================
gtk4-encode-symbolic-svg
========================
--------------------------------
Symbolic icon conversion utility
--------------------------------
SYNOPSIS
--------
| **gtk4-encode-symbolic-svg** [OPTIONS...] <PATH> <WIDTH>x<HEIGHT>
DESCRIPTION
-----------
``gtk4-encode-symbolic-svg`` converts symbolic SVG icons into specially prepared
PNG files. GTK can load and recolor these PNGs, just like original SVGs, but
loading them is much faster.
``PATH`` is the name of a symbolic SVG file, ``WIDTH`` x ``HEIGHT`` are the
desired dimensions for the generated PNG file.
To distinguish them from ordinary PNGs, the generated files have the extension
``.symbolic.png``.
OPTIONS
-------
``-o, --output DIRECTORY``
Write png files to ``DIRECTORY`` instead of the current working directory.
``--debug``
Generate PNG files of the various channels during the conversion. If these
files are not monochrome green, they are often helpful in pinpointing the
problematic parts of the source SVG.

View File

@@ -0,0 +1,74 @@
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<refentry id="gtk4-encode-symbolic-svg">
<refentryinfo>
<title>gtk4-encode-symbolic-svg</title>
<productname>GTK</productname>
<authorgroup>
<author>
<contrib>Developer</contrib>
<firstname>Alexander</firstname>
<surname>Larsson</surname>
</author>
</authorgroup>
</refentryinfo>
<refmeta>
<refentrytitle>gtk4-encode-symbolic-svg</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="manual">User Commands</refmiscinfo>
</refmeta>
<refnamediv>
<refname>gtk4-encode-symbolic-svg</refname>
<refpurpose>Symbolic icon conversion utility</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>gtk4-encode-symbolic-svg</command>
<arg choice="opt">OPTION...</arg>
<arg choice="plain"><replaceable>PATH</replaceable></arg>
<arg choice="plain"><replaceable>WIDTH</replaceable>x<replaceable>HEIGHT</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>
<para>
<command>gtk4-encode-symbolic-svg</command> converts symbolic svg icons into
specially prepared png files. GTK can load and recolor these pngs, just like
original svgs, but loading them is much faster.
</para>
<para>
<replaceable>PATH</replaceable> is the name of a symbolic svg file,
<replaceable>WIDTH</replaceable>x<replaceable>HEIGHT</replaceable> are the
desired dimensions for the generated png file.
</para>
<para>
To distinguish them from ordinary pngs, the generated files have the extension
<filename>.symbolic.png</filename>.
</para>
</refsect1>
<refsect1><title>Options</title>
<variablelist>
<varlistentry>
<term>-o <replaceable>DIRECTORY</replaceable></term>
<term>--output <replaceable>DIRECTORY</replaceable></term>
<listitem><para>Write png files to <replaceable>DIRECTORY</replaceable>
instead of the current working directory.</para></listitem>
</varlistentry>
<varlistentry>
<term>--debug</term>
<listitem><para>Generate png files of the various channels during
the conversion. If these files are not monochrome green, they
are often helpful in pinpointing the problematic parts of
the source svg.</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
</refentry>

View File

@@ -1,28 +0,0 @@
.. _gtk4-icon-browser(1):
=================
gtk4-icon-browser
=================
-----------------
List themed icons
-----------------
SYNOPSIS
--------
| **gtk4-icon-browser** [OPTIONS...]
DESCRIPTION
-----------
``gtk4-icon-browser`` is a utility to explore the icons in the current icon
theme. It shows icons in various sizes, their symbolic variants where available,
as well as a description of the icon and its context.
OPTIONS
-------
``-h, --help``
Show the application help.

View File

@@ -0,0 +1,55 @@
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<refentry id="gtk4-icon-browser">
<refentryinfo>
<title>gtk4-icon-browser</title>
<productname>GTK</productname>
<authorgroup>
<author>
<contrib>Developer</contrib>
<firstname>Matthias</firstname>
<surname>Clasen</surname>
</author>
</authorgroup>
</refentryinfo>
<refmeta>
<refentrytitle>gtk4-icon-browser</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="manual">User Commands</refmiscinfo>
</refmeta>
<refnamediv>
<refname>gtk4-icon-browser</refname>
<refpurpose>List themed icons</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>gtk4-icon-browser</command>
<arg choice="opt">--help</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>
<para>
<command>gtk4-icon-browser</command> is a utility to explore the icons
in the current icon theme. It shows icons in various sizes, their symbolic
variants where available, as well as a description of the icon and its context.
</para>
</refsect1>
<refsect1><title>Options</title>
<para>The following options are understood:</para>
<variablelist>
<varlistentry>
<term><option>-h</option>, <option>--help</option></term>
<listitem><para>Show help options</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
</refentry>

View File

@@ -1,50 +0,0 @@
.. _gtk4-launch(1):
===========
gtk4-launch
===========
---------------------
Launch an application
---------------------
SYNOPSIS
--------
| **gtk4-launch** [OPTIONS...] <APPLICATION> [URI...]
DESCRIPTION
-----------
``gtk4-launch`` launches an application using the given name. The application is
started with proper startup notification on a default display, unless specified
otherwise.
``gtk4-launch`` takes at least one argument, the name of the application to
launch. The name should match application desktop file name, as residing in the
applications subdirectories of the XDG data directories, with or without the
``.desktop`` suffix.
If called with more than one argument, the rest of them besides the application
name are considered URI locations and are passed as arguments to the launched
application.
OPTIONS
-------
``-?, -h, --help``
Print the command's help and exit.
``--version``
Print the command's version and exit.
ENVIRONMENT
-----------
Some environment variables affect the behavior of ``gtk4-launch``:
``XDG_DATA_HOME, XDG_DATA_DIRS``
The environment variables specifying the XDG data directories.

View File

@@ -0,0 +1,85 @@
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<refentry id="gtk4-launch">
<refentryinfo>
<title>gtk4-launch</title>
<productname>GTK</productname>
<authorgroup>
<author>
<contrib>Developer</contrib>
<firstname>Tomáš</firstname>
<surname>Bžatek</surname>
<email>tbzatek@redhat.com</email>
</author>
</authorgroup>
</refentryinfo>
<refmeta>
<refentrytitle>gtk4-launch</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="manual">User Commands</refmiscinfo>
</refmeta>
<refnamediv>
<refname>gtk4-launch</refname>
<refpurpose>Launch an application</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>gtk4-launch</command>
<arg choice="opt" rep="repeat">OPTION</arg>
<arg choice="plain">APPLICATION</arg>
<arg choice="opt" rep="repeat">URI</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>
<para>
<command>gtk4-launch</command> launches an application using the given name.
The application is started with proper startup notification on a default
display, unless specified otherwise.
</para>
<para>
<command>gtk4-launch</command> takes at least one argument, the name of
the application to launch. The name should match application desktop file name,
as residing in the applications subdirectories of the XDG data directories, with
or without the '.desktop' suffix.
</para>
<para>
If called with more than one argument, the rest of them besides the application
name are considered URI locations and are passed as arguments to the launched
application.
</para>
</refsect1>
<refsect1><title>Options</title>
<para>The following options are understood:</para>
<variablelist>
<varlistentry>
<term><option>-?</option>, <option>--help</option></term>
<listitem><para>Prints a short help text and exits.</para></listitem>
</varlistentry>
</variablelist>
<variablelist>
<varlistentry>
<term><option>--version</option></term>
<listitem><para>Prints the program version and exits.</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1><title>Environment</title>
<para>Some environment variables affect the behavior of <command>gtk4-launch</command>.</para>
<variablelist>
<varlistentry>
<term><option>XDG_DATA_HOME</option>, <option>XDG_DATA_DIRS</option></term>
<listitem><para>The environment variables specifying the XDG dta directories.</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
</refentry>

View File

@@ -1,21 +0,0 @@
.. _gtk4-query-settings(1):
===================
gtk4-query-settings
===================
------------------------------------
Print name and value of GTK settings
------------------------------------
SYNOPSIS
--------
| **gtk4-query-settings** [PATTERN]
DESCRIPTION
-----------
``gtk4-query-settings`` prints both name and value of all properties available
in the ``GtkSettings`` class. Optionally, you can filter which properties to
list by specifying a ``PATTERN``.

View File

@@ -0,0 +1,45 @@
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<refentry id="gtk4-query-settings">
<refentryinfo>
<title>gtk4-query-settings</title>
<productname>GTK</productname>
<authorgroup>
<author>
<contrib>Developer</contrib>
<firstname>Timm</firstname>
<surname>Bäder</surname>
</author>
</authorgroup>
</refentryinfo>
<refmeta>
<refentrytitle>gtk4-query-settings</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="manual">User Commands</refmiscinfo>
</refmeta>
<refnamediv>
<refname>gtk4-query-settings</refname>
<refpurpose>Utility to print name and value of all GtkSettings properties</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>gtk4-query-settings</command>
<arg choice="opt"><replaceable>PATTERN</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>
<para>
<command>gtk4-query-settings</command> prints both name and value of all properties
available in the GtkSettings class. Optionally, you can filter which properties
to list by specifying a PATTERN.
</para>
</refsect1>
</refentry>

View File

@@ -1,65 +0,0 @@
.. _gtk4-update-icon-cache(1):
======================
gtk4-update-icon-cache
======================
--------------------------
Icon theme caching utility
--------------------------
SYNOPSIS
--------
| **gtk4-update-icon-cache** [OPTIONS...] <PATH>
DESCRIPTION
-----------
``gtk4-update-icon-cache`` creates ``mmap(2)``-able cache files for icon themes.
It expects to be given the ``PATH`` to an icon theme directory containing an
``index.theme``, e.g. ``/usr/share/icons/hicolor``, and writes a
``icon-theme.cache`` containing cached information about the icons in the
directory tree below the given directory.
GTK can use the cache files created by ``gtk4-update-icon-cache`` to avoid a lot
of system call and disk seek overhead when the application starts. Since the
format of the cache files allows them to be shared across multiple processes,
for instance using the POSIX ``mmap(2)`` system call, the overall memory
consumption is reduced as well.
OPTIONS
-------
``-f, --force``
Overwrite an existing cache file even if it appears to be up-to-date.
``-t, --ignore-theme-index``
Don't check for the existence of ``index.theme`` in the icon theme directory.
Without this option, ``gtk4-update-icon-cache`` refuses to create an icon
cache in a directory which does not appear to be the toplevel directory of an
icon theme.
``-i, --index-only``
Don't include image data in the cache.
``--include-image-data``
Include image data in the cache.
``-c, --source <NAME>``
Output a C header file declaring a constant ``NAME`` with the contents of the
icon cache.
``-q, --quiet``
Turn off verbose output.
``-v, --validate``
Validate existing icon cache.

View File

@@ -0,0 +1,123 @@
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<refentry id="gtk4-update-icon-cache">
<refentryinfo>
<title>gtk4-update-icon-cache</title>
<productname>GTK</productname>
<authorgroup>
<author>
<contrib>Developer</contrib>
<firstname>Matthias</firstname>
<surname>Clasen</surname>
</author>
</authorgroup>
</refentryinfo>
<refmeta>
<refentrytitle>gtk4-update-icon-cache</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="manual">User Commands</refmiscinfo>
</refmeta>
<refnamediv>
<refname>gtk4-update-icon-cache</refname>
<refpurpose>Icon theme caching utility</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>gtk4-update-icon-cache</command>
<arg choice="opt">--force</arg>
<arg choice="opt">--ignore-theme-index</arg>
<group>
<arg choice="plain">--index-only</arg>
<arg choice="plain">--include-image-data</arg>
</group>
<arg choice="opt">--source <arg choice="plain"><replaceable>NAME</replaceable></arg></arg>
<arg choice="opt">--quiet</arg>
<arg choice="opt">--validate</arg>
<arg choice="plain"><replaceable>PATH</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>
<para>
<command>gtk4-update-icon-cache</command> creates mmapable cache
files for icon themes.
</para>
<para>
It expects to be given the <replaceable>PATH</replaceable> to an icon theme
directory containing an <filename>index.theme</filename>, e.g.
<filename>/usr/share/icons/hicolor</filename>, and writes a
<filename>icon-theme.cache</filename> containing cached information about
the icons in the directory tree below the given directory.
</para>
<para>
GTK can use the cache files created by <command>gtk4-update-icon-cache</command>
to avoid a lot of system call and disk seek overhead when the application
starts. Since the format of the cache files allows them to be shared across
multiple processes, for instance using the POSIX <command>mmap()</command> system
call, the overall memory consumption is reduced as well.
</para>
</refsect1>
<refsect1><title>Options</title>
<variablelist>
<varlistentry>
<term>--force</term>
<term>-f</term>
<listitem><para>Overwrite an existing cache file even if it appears to be
up-to-date.</para></listitem>
</varlistentry>
<varlistentry>
<term>--ignore-theme-index</term>
<term>-t</term>
<listitem><para>Don't check for the existence of <filename>index.theme</filename>
in the icon theme directory. Without this option, <command>gtk4-update-icon-cache</command>
refuses to create an icon cache in a directory which does not appear to
be the toplevel directory of an icon theme.
</para></listitem>
</varlistentry>
<varlistentry>
<term>--index-only</term>
<term>-i</term>
<listitem><para>Don't include image data in the cache.
</para></listitem>
</varlistentry>
<varlistentry>
<term>--include-image-data</term>
<listitem><para>Include image data in the cache.
</para></listitem>
</varlistentry>
<varlistentry>
<term>--source</term>
<term>-c</term>
<listitem><para>Output a C header file declaring a constant
<replaceable>NAME</replaceable> with the contents of the icon
cache.</para></listitem>
</varlistentry>
<varlistentry>
<term>--quiet</term>
<term>-q</term>
<listitem><para>Turn off verbose output.
</para></listitem>
</varlistentry>
<varlistentry>
<term>--validate</term>
<term>-v</term>
<listitem><para>Validate existing icon cache.
</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
</refentry>

View File

@@ -1,34 +0,0 @@
.. _gtk4-widget-factory(1):
===================
gtk4-widget-factory
===================
-------------------------------
Showcase GTK widgets and styles
-------------------------------
SYNOPSIS
--------
| **gtk4-widget-factory** [OPTIONS...]
DESCRIPTION
-----------
``gtk4-widget-factory`` is a collection of examples.
Its purpose is to demonstrate many GTK widgets in a form that is useful to GTK theme developers.
The application shows widgets in different, typical combinations and states.
OPTIONS
-------
``-h, --help``
Show the application help.
``--version``
Show the application version.

View File

@@ -0,0 +1,63 @@
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<refentry id="gtk4-widget-factory">
<refentryinfo>
<title>gtk4-widget-factory</title>
<productname>GTK</productname>
<authorgroup>
<author>
<contrib>Developer</contrib>
<firstname>Matthias</firstname>
<surname>Clasen</surname>
</author>
</authorgroup>
</refentryinfo>
<refmeta>
<refentrytitle>gtk4-widget-factory</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="manual">User Commands</refmiscinfo>
</refmeta>
<refnamediv>
<refname>gtk4-widget-factory</refname>
<refpurpose>Demonstrate GTK widgets</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>gtk4-widget-factory</command>
<arg choice="opt">--help</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>
<para>
<command>gtk4-widget-factory</command> is a collection of examples.
Its purpose is to demonstrate many GTK widgets in a form
that is useful to GTK theme developers.
</para>
<para>
The application shows widgets in different, typical combinations
and states.
</para>
</refsect1>
<refsect1><title>Options</title>
<para>The following options are understood:</para>
<variablelist>
<varlistentry>
<term><option>-h</option>, <option>--help</option></term>
<listitem><para>Show help options</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--version</option></term>
<listitem><para>Show program version</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
</refentry>

View File

@@ -42,10 +42,12 @@ if get_option('gtk_doc')
command: [
gidocgen,
'generate',
gidocgen_common_args,
'--quiet',
'--fatal-warnings',
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
'--config=@INPUT0@',
'--output-dir=@OUTPUT@',
'--no-namespace-dir',
'--content-dir=@0@'.format(meson.current_source_dir()),
'@INPUT1@',
],
@@ -57,15 +59,24 @@ if get_option('gtk_doc')
)
endif
rst2man = find_program('rst2man', required: false)
if get_option('man-pages') and not rst2man.found()
error('No rst2man found, but man pages were explicitly enabled')
xsltproc = find_program('xsltproc', required: false)
if get_option('man-pages') and not xsltproc.found()
error('No xsltproc found, but man pages were explicitly enabled')
endif
if get_option('man-pages') and rst2man.found()
rst_files = [
[ 'gtk4-broadwayd', '1' ],
[ 'gtk4-builder-tool', '1' ],
if get_option('man-pages') and xsltproc.found()
xlstproc_flags = [
'--nonet',
'--stringparam', 'man.output.quietly', '1',
'--stringparam', 'funcsynopsis.style', 'ansi',
'--stringparam', 'man.th.extra1.suppress', '1',
'--stringparam', 'man.authors.section.enabled', '0',
'--stringparam', 'man.copyright.section.enabled', '0',
]
man_files = [
[ 'gtk4-broadwayd', '1', ],
[ 'gtk4-builder-tool', '1', ],
[ 'gtk4-encode-symbolic-svg', '1', ],
[ 'gtk4-launch', '1', ],
[ 'gtk4-query-settings', '1', ],
@@ -73,7 +84,7 @@ if get_option('man-pages') and rst2man.found()
]
if get_option('demos')
rst_files += [
man_files += [
[ 'gtk4-demo', '1', ],
[ 'gtk4-demo-application', '1', ],
[ 'gtk4-widget-factory', '1', ],
@@ -81,25 +92,21 @@ if get_option('man-pages') and rst2man.found()
]
endif
rst2man_flags = [
'--syntax-highlight=none',
]
foreach rst: rst_files
man_name = rst[0]
man_section = rst.get(1, '1')
custom_target('man-@0@'.format(man_name),
input: '@0@.rst'.format(man_name),
foreach man: man_files
man_name = man.get(0)
man_section = man.get(1, '1')
custom_target('@0@.@1@'.format(man_name, man_section),
input: '@0@.xml'.format(man_name),
output: '@0@.@1@'.format(man_name, man_section),
command: [
rst2man,
rst2man_flags,
xsltproc,
xlstproc_flags,
'-o', '@OUTPUT@',
'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
'@INPUT@',
],
capture: true,
install: true,
install_dir: get_option('mandir') / 'man@0@'.format(man_section),
install_dir: join_paths(get_option('mandir'), 'man@0@'.format(man_section)),
)
endforeach
endif

View File

@@ -668,21 +668,18 @@ box children as necessary.
### Adapt to `GtkWindow` API changes
Following the `GdkSurface` changes, a number of `GtkWindow` APIs that were
X11-specific have been removed. This includes `gtk_window_set_position()`,
`gtk_window_set_geometry_hints()`, `gtk_window_set_gravity()`,
`gtk_window_move()`, `gtk_window_parse_geometry()`,
X11-specific have been removed. This includes `gtk_window_set_geometry_hints()`,
`gtk_window_set_gravity()`, `gtk_window_move()`, `gtk_window_parse_geometry()`,
`gtk_window_set_keep_above()`, `gtk_window_set_keep_below()`,
`gtk_window_begin_resize_drag()`, `gtk_window_begin_move_drag()`.
Most likely, you should just stop using them. In some cases, you can
fall back to using the underlying `GdkToplevel` APIs (for example,
[`method@Gdk.Toplevel.begin_resize`]); alternatively, you will need to get
the native windowing system surface from the `GtkWindow` and call platform
specific API.
[method@Gdk.Toplevel.begin_resize]).
The APIs for controlling `GtkWindow` size have changed to be better aligned
with the way size changes are integrated in the frame cycle. `gtk_window_resize()`
and `gtk_window_get_size()` have been removed. Instead, use
[`method@Gtk.Window.set_default_size`] and [`method@Gtk.Window.get_default_size`].
[method@Gtk.Window.set_default_size] and [method@Gtk.Window.get_default_size].
### Adapt to `GtkHeaderBar` and `GtkActionBar` API changes
@@ -1335,18 +1332,6 @@ pointer coordinates as inout arguments any more, but as normal in ones.
See: [method@Gtk.TreeView.get_tooltip_context], [method@Gtk.IconView.get_tooltip_context]
### Adapt to GtkPopover changes
In GTK 3, a `GtkPopover` could be attached to any widget, using the `relative-to`
property. This is no longer possible in GTK 4. The parent widget has to be aware
of its popover children, and manage their size allocation. Therefore, only widgets
with dedicated popover support can have them, such as [class@Gtk.MenuButton] or
[class@Gtk.PopoverMenuBar].
If you want to make a custom widget that has an attached popover, you need to call
[method@Gtk.Popover.present] in your [vfunc@Gtk.Widget.size_allocate] vfunc, in order
to update the positioning of the popover.
### Stop using GtkFileChooserButton
The `GtkFileChooserButton` widget was removed, due to its shortcomings in

View File

@@ -0,0 +1,101 @@
<?xml version="1.0"?>
<!DOCTYPE partintro PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<partintro>
<para>
GTK is a library for creating graphical user interfaces. It
works on many UNIX-like platforms, Windows, and OS X.
GTK is released under the GNU Library General Public License
(GNU LGPL), which allows for flexible licensing of client
applications. GTK has a C-based object-oriented architecture that
allows for maximum flexibility. Bindings for many other languages have
been written, including C++, Objective-C, Guile/Scheme, Perl, Python,
TOM, Ada95, Free Pascal, and Eiffel. The GTK library itself contains
<firstterm>widgets</firstterm>, that is, GUI components such as GtkButton
or GtkTextView.
</para>
<para>
GTK depends on the following libraries:
<variablelist>
<varlistentry>
<term>GLib</term>
<listitem><para>
A general-purpose utility library, not specific to graphical user interfaces.
GLib provides many useful data types, macros, type conversions,
string utilities, file utilities, a main loop abstraction, and so on.
</para></listitem>
</varlistentry>
<varlistentry>
<term>GObject</term>
<listitem><para>A library that provides a type system, a collection of
fundamental types including an object type, a signal system.
</para></listitem>
</varlistentry>
<varlistentry>
<term>GIO</term>
<listitem><para>A modern, easy-to-use VFS API including abstractions for
files, drives, volumes, stream IO, as well as network programming and
DBus communication.
</para></listitem>
</varlistentry>
<varlistentry>
<term>cairo</term>
<listitem><para>Cairo is a 2D graphics library with support for multiple
output devices.
</para></listitem>
</varlistentry>
<varlistentry>
<term>Pango</term>
<listitem><para>
Pango is a library for internationalized text handling. It centers
around the PangoLayout object, representing a paragraph of text.
Pango provides the engine for GtkTextView, GtkLabel, GtkEntry, and
other widgets that display text.
</para></listitem>
</varlistentry>
<varlistentry>
<term>GdkPixbuf</term>
<listitem><para>
This is a small library which allows you to create GdkPixbuf
("pixel buffer") objects from image data or image files.
Use a GdkPixbuf in combination with GtkImage to display images.
</para></listitem>
</varlistentry>
<varlistentry>
<term>graphene</term>
<listitem><para>
This is a small library which provides vector and matrix datatypes
and operations. graphene provides optimized implementations using
various SIMD instruction sets such as SSE.
</para></listitem>
</varlistentry>
<varlistentry>
<term>GDK</term>
<listitem><para>
GDK is the abstraction layer that allows GTK to support multiple
windowing systems. GDK provides window system facilities on Wayland,
X11, Windows, and OS X.
</para></listitem>
</varlistentry>
<varlistentry>
<term>GSK</term>
<listitem><para>
GSK is a library for creating a scene graph from render nodes,
and rendering it using different rendering APIs. GSK provides renderers
for OpenGL, Vulkan and cairo.
</para></listitem>
</varlistentry>
</variablelist>
</para>
</partintro>

View File

@@ -13,5 +13,4 @@ baseURLs = [
[ 'Gtk', 'https://docs.gtk.org/gtk4/' ],
[ 'Pango', 'https://docs.gtk.org/Pango/' ],
[ 'PangoCairo', 'https://docs.gtk.org/PangoCairo/' ],
[ 'GdkPixbuf', 'https://docs.gtk.org/gdk-pixbuf/' ],
]

View File

@@ -3,15 +3,6 @@ toml_conf.set('version', meson.project_version())
gidocgen = find_program('gi-docgen', required: get_option('gtk_doc'))
gidocgen_common_args = [
'--quiet',
'--no-namespace-dir',
]
if get_option('werror')
gidocgen_common_args += ['--fatal-warnings']
endif
docs_dir = gtk_datadir / 'doc'
if get_option('gtk_doc') and not build_gir

View File

@@ -603,8 +603,8 @@ bloat_pad_startup (GApplication *application)
g_object_unref (icon);
g_bytes_unref (bytes);
icon = G_ICON (gdk_texture_new_from_resource ("/org/gtk/libgtk/icons/16x16/actions/folder-new.png"));
item = g_menu_item_new ("Texture", NULL);
icon = G_ICON (gdk_pixbuf_new_from_resource ("/org/gtk/libgtk/icons/16x16/actions/folder-new.png", NULL));
item = g_menu_item_new ("Pixbuf", NULL);
g_menu_item_set_icon (item, icon);
g_menu_append_item (menu, item);
g_object_unref (item);

View File

@@ -7,7 +7,7 @@
#include <glib.h>
#include <glib/gprintf.h>
#include "gdktypes.h"
#include "gdkdeviceprivate.h"
#include "gdkinternals.h"
#include <stdlib.h>
#include <string.h>
#include <errno.h>

View File

@@ -609,46 +609,56 @@ open_shared_memory (void)
return ret;
}
typedef struct {
int fd;
gsize size;
} PngData;
static cairo_status_t
write_png_cb (void *closure,
const guchar *data,
unsigned int length)
{
PngData *png_data = closure;
int fd = png_data->fd;
while (length)
{
gssize ret = write (fd, data, length);
if (ret <= 0)
return CAIRO_STATUS_WRITE_ERROR;
png_data->size += ret;
length -= ret;
data += ret;
}
return CAIRO_STATUS_SUCCESS;
}
guint32
gdk_broadway_server_upload_texture (GdkBroadwayServer *server,
GdkTexture *texture)
{
guint32 id;
cairo_surface_t *surface = gdk_texture_download_surface (texture);
BroadwayRequestUploadTexture msg;
GBytes *bytes;
const guchar *data;
gsize size;
int fd;
bytes = gdk_texture_save_to_png_bytes (texture);
fd = open_shared_memory ();
data = g_bytes_get_data (bytes, &size);
PngData data;
id = server->next_texture_id++;
data.fd = open_shared_memory ();
data.size = 0;
cairo_surface_write_to_png_stream (surface, write_png_cb, &data);
msg.id = id;
msg.offset = 0;
msg.size = 0;
while (msg.size < size)
{
gssize ret = write (fd, data + msg.size, size - msg.size);
if (ret <= 0)
{
if (errno == EINTR)
continue;
break;
}
msg.size += ret;
}
g_bytes_unref (bytes);
msg.size = data.size;
/* This passes ownership of fd */
gdk_broadway_server_send_fd_message (server, msg,
BROADWAY_REQUEST_UPLOAD_TEXTURE, fd);
BROADWAY_REQUEST_UPLOAD_TEXTURE, data.fd);
return id;
}

View File

@@ -2,10 +2,8 @@
#define __GDK_BROADWAY_SERVER__
#include <gdk/gdktypes.h>
#include "gdkdeviceprivate.h"
#include "broadway-protocol.h"
#include "gdkinternals.h"
typedef struct _GdkBroadwayServer GdkBroadwayServer;
typedef struct _GdkBroadwayServerClass GdkBroadwayServerClass;

View File

@@ -34,7 +34,6 @@ gdk_broadway_cairo_context_dispose (GObject *object)
static void
gdk_broadway_cairo_context_begin_frame (GdkDrawContext *draw_context,
gboolean prefers_high_depth,
cairo_region_t *region)
{
GdkBroadwayCairoContext *self = GDK_BROADWAY_CAIRO_CONTEXT (draw_context);

View File

@@ -30,6 +30,7 @@
#include "gdkmonitor-broadway.h"
#include "gdkseatdefaultprivate.h"
#include "gdkdevice-broadway.h"
#include "gdkinternals.h"
#include "gdkdeviceprivate.h"
#include <gdk/gdktextureprivate.h>
#include "gdk-private.h"
@@ -213,7 +214,7 @@ _gdk_broadway_display_open (const char *display_name)
broadway_display->server = _gdk_broadway_server_new (display, display_name, &error);
if (broadway_display->server == NULL)
{
GDK_NOTE (MISC, g_message ("Unable to init Broadway server: %s\n", error->message));
g_printerr ("Unable to init Broadway server: %s\n", error->message);
g_error_free (error);
return NULL;
}

View File

@@ -27,6 +27,7 @@
#include "gdkdisplayprivate.h"
#include "gdkkeys.h"
#include "gdksurface.h"
#include "gdkinternals.h"
#include "gdkbroadway-server.h"
#include "gdkmonitorprivate.h"

View File

@@ -28,6 +28,7 @@
#include "gdksurfaceprivate.h"
#include "gdkprivate-broadway.h"
#include "gdkinternals.h"
#include "gdkdisplay-broadway.h"
#include <string.h>

View File

@@ -34,7 +34,6 @@ gdk_broadway_draw_context_dispose (GObject *object)
static void
gdk_broadway_draw_context_begin_frame (GdkDrawContext *draw_context,
gboolean prefers_high_depth,
cairo_region_t *region)
{
GdkBroadwayDrawContext *self = GDK_BROADWAY_DRAW_CONTEXT (draw_context);

View File

@@ -19,9 +19,8 @@
#include "gdkeventsource.h"
#include "gdkeventsprivate.h"
#include "gdkframeclockprivate.h"
#include "gdksurfaceprivate.h"
#include "gdkframeclockprivate.h"
#include <stdlib.h>

View File

@@ -25,6 +25,7 @@
#include "config.h"
#include "gdkprivate-broadway.h"
#include "gdkinternals.h"
#include "gdkdisplay-broadway.h"
#include "gdkkeysprivate.h"
#include "gdkkeysyms.h"

View File

@@ -30,6 +30,7 @@
#define __GDK_PRIVATE_BROADWAY_H__
#include <gdk/gdkcursor.h>
#include <gdk/gdkinternals.h>
#include "gdksurface-broadway.h"
#include "gdkdisplay-broadway.h"
#include "gdkdrawcontext-broadway.h"

View File

@@ -35,12 +35,13 @@
#include "gdkdragsurfaceprivate.h"
#include "gdkeventsource.h"
#include "gdkframeclockidleprivate.h"
#include "gdkinternals.h"
#include "gdkpopupprivate.h"
#include "gdkprivate-broadway.h"
#include "gdkseatprivate.h"
#include "gdksurfaceprivate.h"
#include "gdktextureprivate.h"
#include "gdktoplevelprivate.h"
#include "gdk-private.h"
#include <graphene.h>
#include <stdlib.h>

View File

@@ -27,6 +27,7 @@
#include <gdk/gdksurfaceprivate.h>
#include "gdkbroadwaysurface.h"
#include "gdkinternals.h"
G_BEGIN_DECLS

View File

@@ -64,7 +64,7 @@ libgdk_broadway = static_library('gdk-broadway',
# gtk4-broadwayd
broadwayd_syslib = os_win32 ? cc.find_library('ws2_32') : shmlib
broadwayd_syslib = os_win32 ? find_library('ws2_32') : shmlib
executable('gtk4-broadwayd',
sources: [

View File

@@ -1,7 +1,8 @@
#ifndef __GDK__PRIVATE_H__
#define __GDK__PRIVATE_H__
#include "gdk/gdktypes.h"
#include <gdk/gdk.h>
#include "gdk/gdkinternals.h"
/* Private API for use in GTK+ */
@@ -28,10 +29,14 @@ gboolean gdk_should_use_portal (void);
const char * gdk_get_startup_notification_id (void);
PangoDirection gdk_unichar_direction (gunichar ch) G_GNUC_CONST;
PangoDirection gdk_unichar_direction (gunichar ch);
PangoDirection gdk_find_base_dir (const char *text,
int len);
void gdk_surface_set_widget (GdkSurface *surface,
gpointer widget);
gpointer gdk_surface_get_widget (GdkSurface *surface);
typedef struct
{
const char *key;

View File

@@ -26,15 +26,19 @@
#include "gdkversionmacros.h"
#include "gdkinternals.h"
#include "gdkintl.h"
#include "gdkresources.h"
#include "gdkconstructor.h"
#include "gdkdebug.h"
#include "gdkdisplay.h"
#include "gdkglcontextprivate.h"
#include "gdkintl.h"
#include "gdk-private.h"
#include "gdkconstructor.h"
#ifndef HAVE_XCONVERTCASE
#include "gdkkeysyms.h"
#endif
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -121,7 +125,7 @@ static const GdkDebugKey gdk_debug_keys[] = {
{ "gl-software", GDK_DEBUG_GL_SOFTWARE, "Force OpenGL software rendering" },
{ "gl-texture-rect", GDK_DEBUG_GL_TEXTURE_RECT, "Use OpenGL texture rectangle extension" },
{ "gl-legacy", GDK_DEBUG_GL_LEGACY, "Use a legacy OpenGL context" },
{ "gl-gles", GDK_DEBUG_GL_GLES, "Only allow OpenGL GLES API" },
{ "gl-gles", GDK_DEBUG_GL_GLES, "Use a GLES OpenGL context" },
{ "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL" },
{ "gl-egl", GDK_DEBUG_GL_EGL, "Use EGL on X11 or Windows" },
{ "gl-glx", GDK_DEBUG_GL_GLX, "Use GLX on X11" },
@@ -129,7 +133,6 @@ static const GdkDebugKey gdk_debug_keys[] = {
{ "vulkan-disable", GDK_DEBUG_VULKAN_DISABLE, "Disable Vulkan support" },
{ "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer" },
{ "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings", TRUE },
{ "high-depth", GDK_DEBUG_HIGH_DEPTH, "Use high bit depth rendering if possible", TRUE },
};
@@ -296,14 +299,6 @@ gdk_pre_parse (void)
gdk_debug_keys,
G_N_ELEMENTS (gdk_debug_keys));
/* These are global */
if (GDK_DEBUG_CHECK (GL_EGL))
gdk_gl_backend_use (GDK_GL_EGL);
else if (GDK_DEBUG_CHECK (GL_GLX))
gdk_gl_backend_use (GDK_GL_GLX);
else if (GDK_DEBUG_CHECK (GL_WGL))
gdk_gl_backend_use (GDK_GL_WGL);
#ifndef G_HAS_CONSTRUCTORS
stash_desktop_startup_notification_id ();
#endif

View File

@@ -47,7 +47,6 @@
#include <gdk/gdkdragsurface.h>
#include <gdk/gdkdrawcontext.h>
#include <gdk/gdkdrop.h>
#include <gdk/gdkenums.h>
#include <gdk/gdkenumtypes.h>
#include <gdk/gdkevents.h>
#include <gdk/gdkframeclock.h>

View File

@@ -32,7 +32,7 @@ G_BEGIN_DECLS
#define GDK_TYPE_APP_LAUNCH_CONTEXT (gdk_app_launch_context_get_type ())
#define GDK_APP_LAUNCH_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_APP_LAUNCH_CONTEXT, GdkAppLaunchContext))
#define GDK_IS_APP_LAUNCH_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_APP_LAUNCH_CONTEXT))
#define GDK_IS_APP_LAUNCH_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_APP_LAUNCH_CONTEXT))
GDK_AVAILABLE_IN_ALL

View File

@@ -17,7 +17,9 @@
#include "config.h"
#include "gdkcairoprivate.h"
#include "gdkcairo.h"
#include "gdkinternals.h"
#include <math.h>
@@ -91,7 +93,11 @@ void
gdk_cairo_surface_paint_pixbuf (cairo_surface_t *surface,
const GdkPixbuf *pixbuf)
{
GdkTexture *texture;
int width, height;
guchar *gdk_pixels, *cairo_pixels;
int gdk_rowstride, cairo_stride;
int n_channels;
int j;
if (cairo_surface_status (surface) != CAIRO_STATUS_SUCCESS)
return;
@@ -107,11 +113,71 @@ gdk_cairo_surface_paint_pixbuf (cairo_surface_t *surface,
cairo_surface_flush (surface);
texture = gdk_texture_new_for_pixbuf (GDK_PIXBUF (pixbuf));
gdk_texture_download (texture,
cairo_image_surface_get_data (surface),
cairo_image_surface_get_stride (surface));
g_object_unref (texture);
width = gdk_pixbuf_get_width (pixbuf);
height = gdk_pixbuf_get_height (pixbuf);
gdk_pixels = gdk_pixbuf_get_pixels (pixbuf);
gdk_rowstride = gdk_pixbuf_get_rowstride (pixbuf);
n_channels = gdk_pixbuf_get_n_channels (pixbuf);
cairo_stride = cairo_image_surface_get_stride (surface);
cairo_pixels = cairo_image_surface_get_data (surface);
for (j = height; j; j--)
{
guchar *p = gdk_pixels;
guchar *q = cairo_pixels;
if (n_channels == 3)
{
guchar *end = p + 3 * width;
while (p < end)
{
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
q[0] = p[2];
q[1] = p[1];
q[2] = p[0];
q[3] = 0xFF;
#else
q[0] = 0xFF;
q[1] = p[0];
q[2] = p[1];
q[3] = p[2];
#endif
p += 3;
q += 4;
}
}
else
{
guchar *end = p + 4 * width;
guint t1,t2,t3;
#define MULT(d,c,a,t) G_STMT_START { t = c * a + 0x80; d = ((t >> 8) + t) >> 8; } G_STMT_END
while (p < end)
{
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
MULT(q[0], p[2], p[3], t1);
MULT(q[1], p[1], p[3], t2);
MULT(q[2], p[0], p[3], t3);
q[3] = p[3];
#else
q[0] = p[3];
MULT(q[1], p[0], p[3], t1);
MULT(q[2], p[1], p[3], t2);
MULT(q[3], p[2], p[3], t3);
#endif
p += 4;
q += 4;
}
#undef MULT
}
gdk_pixels += gdk_rowstride;
cairo_pixels += cairo_stride;
}
cairo_surface_mark_dirty (surface);
}

View File

@@ -25,6 +25,7 @@
#include "gdkcairocontextprivate.h"
#include "gdkcairo.h"
#include "gdkinternals.h"
/**
* GdkCairoContext:

View File

@@ -18,8 +18,6 @@
#ifndef __GDK_CAIRO_PRIVATE_H__
#define __GDK_CAIRO_PRIVATE_H__
#include "gdkcairo.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <cairo.h>

View File

@@ -1253,14 +1253,14 @@ gdk_clipboard_set_content (GdkClipboard *clipboard,
* @...: value contents conforming to @type
*
* Sets the clipboard to contain the value collected from the given varargs.
*
*
* Values should be passed the same way they are passed to other value
* collecting APIs, such as [`method@GObject.Object.set`] or
* [`func@GObject.signal_emit`].
* [`id@g_signal_emit`].
*
* ```c
* gdk_clipboard_set (clipboard, GTK_TYPE_STRING, "Hello World");
*
*
* gdk_clipboard_set (clipboard, GDK_TYPE_TEXTURE, some_texture);
* ```
*/

View File

@@ -659,52 +659,84 @@ pixbuf_deserializer (GdkContentDeserializer *deserializer)
static void
texture_deserializer_finish (GObject *source,
GAsyncResult *result,
gpointer deserializer)
GAsyncResult *res,
gpointer data)
{
GOutputStream *stream = G_OUTPUT_STREAM (source);
GBytes *bytes;
GdkContentDeserializer *deserializer = GDK_CONTENT_DESERIALIZER (source);
GdkTexture *texture;
GValue *value;
GError *error = NULL;
GdkTexture *texture = NULL;
gssize written;
written = g_output_stream_splice_finish (stream, result, &error);
if (written < 0)
{
gdk_content_deserializer_return_error (deserializer, error);
return;
}
bytes = g_memory_output_stream_steal_as_bytes (G_MEMORY_OUTPUT_STREAM (stream));
texture = gdk_texture_new_from_bytes (bytes, &error);
g_bytes_unref (bytes);
texture = g_task_propagate_pointer (G_TASK (res), &error);
if (texture == NULL)
{
gdk_content_deserializer_return_error (deserializer, error);
return;
}
g_value_take_object (gdk_content_deserializer_get_value (deserializer), texture);
value = gdk_content_deserializer_get_value (deserializer);
g_value_take_object (value, texture);
gdk_content_deserializer_return_success (deserializer);
}
static GBytes *
read_all_data (GInputStream *source,
GError **error)
{
GOutputStream *output;
gssize size;
GBytes *bytes;
output = g_memory_output_stream_new (NULL, 0, g_realloc, g_free);
size = g_output_stream_splice (output, source, 0, NULL, error);
if (size == -1)
{
g_object_unref (output);
return NULL;
}
g_output_stream_close (output, NULL, NULL);
bytes = g_memory_output_stream_steal_as_bytes (G_MEMORY_OUTPUT_STREAM (output));
g_object_unref (output);
return bytes;
}
static void
deserialize_texture_in_thread (GTask *task,
gpointer source_object,
gpointer task_data,
GCancellable *cancellable)
{
GdkContentDeserializer *deserializer = source_object;
GBytes *bytes;
GError *error = NULL;
GdkTexture *texture = NULL;
bytes = read_all_data (gdk_content_deserializer_get_input_stream (deserializer), &error);
if (bytes)
{
texture = gdk_texture_new_from_bytes (bytes, &error);
g_bytes_unref (bytes);
}
if (texture)
g_task_return_pointer (task, texture, g_object_unref);
else
g_task_return_error (task, error);
}
static void
texture_deserializer (GdkContentDeserializer *deserializer)
{
GOutputStream *output;
GTask *task;
output = g_memory_output_stream_new_resizable ();
g_output_stream_splice_async (output,
gdk_content_deserializer_get_input_stream (deserializer),
G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE
| G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET,
gdk_content_deserializer_get_priority (deserializer),
gdk_content_deserializer_get_cancellable (deserializer),
texture_deserializer_finish,
deserializer);
g_object_unref (output);
task = g_task_new (deserializer,
gdk_content_deserializer_get_cancellable (deserializer),
texture_deserializer_finish,
NULL);
g_task_run_in_thread (task, deserialize_texture_in_thread);
g_object_unref (task);
}
static void
@@ -920,17 +952,12 @@ init (void)
texture_deserializer,
NULL,
NULL);
gdk_content_register_deserializer ("image/tiff",
GDK_TYPE_TEXTURE,
texture_deserializer,
NULL,
NULL);
gdk_content_register_deserializer ("image/jpeg",
GDK_TYPE_TEXTURE,
texture_deserializer,
NULL,
NULL);
formats = gdk_pixbuf_get_formats ();
@@ -963,9 +990,8 @@ init (void)
mimes = gdk_pixbuf_format_get_mime_types (fmt);
for (m = mimes; *m; m++)
{
/* Turning pngs, jpegs and tiffs into textures is handled above */
/* Turning pngs and tiffs into textures is handled above */
if (!g_str_equal (name, "png") &&
!g_str_equal (name, "jpeg") &&
!g_str_equal (name, "tiff"))
gdk_content_register_deserializer (*m,
GDK_TYPE_TEXTURE,
@@ -1008,13 +1034,11 @@ init (void)
if (!g_get_charset (&charset))
{
char *mime = g_strdup_printf ("text/plain;charset=%s", charset);
gdk_content_register_deserializer (mime,
G_TYPE_STRING,
string_deserializer,
(gpointer) charset,
g_free);
g_free (mime);
}
gdk_content_register_deserializer ("text/plain",
G_TYPE_STRING,

View File

@@ -808,13 +808,8 @@ gdk_content_formats_builder_add_mime_type (GdkContentFormatsBuilder *builder,
builder->n_mime_types++;
}
/* {{{ GdkFileList */
/* We're using GdkFileList* and GSList* interchangeably, counting on the
* fact that we're just passing around gpointers; the only reason why we
* have a GdkFileList opaque type is for language bindings, because they
* can have no idea what a GSList of GFiles is.
*/
/* G_DEFINE_BOXED wants this */
typedef gpointer GdkFileList;
static gpointer
gdk_file_list_copy (gpointer list)
@@ -829,23 +824,3 @@ gdk_file_list_free (gpointer list)
}
G_DEFINE_BOXED_TYPE (GdkFileList, gdk_file_list, gdk_file_list_copy, gdk_file_list_free)
/**
* gdk_file_list_get_files:
* @file_list: the file list
*
* Retrieves the list of files inside a `GdkFileList`.
*
* This function is meant for language bindings.
*
* Returns: (transfer container) (element-type GFile): the files inside the list
*
* Since: 4.6
*/
GSList *
gdk_file_list_get_files (GdkFileList *file_list)
{
return g_slist_copy ((GSList *) file_list);
}
/* }}} */

View File

@@ -109,19 +109,8 @@ void gdk_content_formats_builder_add_gtype (GdkContentForma
/* dunno where else to put this */
#define GDK_TYPE_FILE_LIST (gdk_file_list_get_type ())
GDK_AVAILABLE_IN_ALL
GType gdk_file_list_get_type (void) G_GNUC_CONST;
GType gdk_file_list_get_type (void) G_GNUC_CONST;
/**
* GdkFileList:
*
* An opaque type representing a list of files.
*
* Since: 4.6
*/
typedef struct _GdkFileList GdkFileList;
GDK_AVAILABLE_IN_4_6
GSList * gdk_file_list_get_files (GdkFileList *file_list);
G_END_DECLS

View File

@@ -28,7 +28,6 @@
#include "gdkrgba.h"
#include "loaders/gdkpngprivate.h"
#include "loaders/gdktiffprivate.h"
#include "loaders/gdkjpegprivate.h"
#include "gdkmemorytextureprivate.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
@@ -641,7 +640,11 @@ pixbuf_serializer (GdkContentSerializer *serializer)
else if (G_VALUE_HOLDS (value, GDK_TYPE_TEXTURE))
{
GdkTexture *texture = g_value_get_object (value);
pixbuf = gdk_pixbuf_get_from_texture (texture);
cairo_surface_t *surface = gdk_texture_download_surface (texture);
pixbuf = gdk_pixbuf_get_from_surface (surface,
0, 0,
gdk_texture_get_width (texture), gdk_texture_get_height (texture));
cairo_surface_destroy (surface);
}
else
{
@@ -685,8 +688,6 @@ serialize_texture_in_thread (GTask *task,
GBytes *bytes = NULL;
GError *error = NULL;
gboolean result = FALSE;
GInputStream *input;
gssize spliced;
value = gdk_content_serializer_get_value (serializer);
texture = g_value_get_object (value);
@@ -695,21 +696,28 @@ serialize_texture_in_thread (GTask *task,
bytes = gdk_save_png (texture);
else if (strcmp (gdk_content_serializer_get_mime_type (serializer), "image/tiff") == 0)
bytes = gdk_save_tiff (texture);
else if (strcmp (gdk_content_serializer_get_mime_type (serializer), "image/jpeg") == 0)
bytes = gdk_save_jpeg (texture);
else
g_assert_not_reached ();
input = g_memory_input_stream_new_from_bytes (bytes);
spliced = g_output_stream_splice (gdk_content_serializer_get_output_stream (serializer),
input,
G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE,
gdk_content_serializer_get_cancellable (serializer),
&error);
g_object_unref (input);
g_bytes_unref (bytes);
if (bytes)
{
GInputStream *input = g_memory_input_stream_new_from_bytes (bytes);
gssize spliced;
result = spliced != -1;
spliced = g_output_stream_splice (gdk_content_serializer_get_output_stream (serializer),
input,
G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE,
gdk_content_serializer_get_cancellable (serializer),
&error);
g_object_unref (input);
g_bytes_unref (bytes);
result = spliced != -1;
}
else
g_set_error_literal (&error,
G_IO_ERROR, G_IO_ERROR_FAILED,
"Saving png failed");
if (result)
g_task_return_boolean (task, result);
@@ -959,11 +967,6 @@ init (void)
texture_serializer,
NULL, NULL);
gdk_content_register_serializer (GDK_TYPE_TEXTURE,
"image/jpeg",
texture_serializer,
NULL, NULL);
formats = gdk_pixbuf_get_formats ();
/* Make sure png comes first */
@@ -998,10 +1001,9 @@ init (void)
mimes = gdk_pixbuf_format_get_mime_types (fmt);
for (m = mimes; *m; m++)
{
/* Turning textures into pngs, tiffs or jpegs is handled above */
/* Turning textures into pngs or tiffs is handled above */
if (!g_str_equal (name, "png") &&
!g_str_equal (name, "tiff") &&
!g_str_equal (name, "jpeg"))
!g_str_equal (name, "tiff"))
gdk_content_register_serializer (GDK_TYPE_TEXTURE,
*m,
pixbuf_serializer,

View File

@@ -31,6 +31,7 @@
#include "gdkcursorprivate.h"
#include "gdktexture.h"
#include "gdkintl.h"
#include "gdkinternals.h"
#include <math.h>
#include <errno.h>

View File

@@ -18,12 +18,9 @@
#ifndef __GDK_DEBUG_H__
#define __GDK_DEBUG_H__
#include <glib.h>
#include "gdktypes.h"
G_BEGIN_DECLS
typedef enum {
GDK_DEBUG_MISC = 1 << 0,
GDK_DEBUG_EVENTS = 1 << 1,
@@ -50,7 +47,6 @@ typedef enum {
GDK_DEBUG_VULKAN_DISABLE = 1 << 21,
GDK_DEBUG_VULKAN_VALIDATE = 1 << 22,
GDK_DEBUG_DEFAULT_SETTINGS= 1 << 23,
GDK_DEBUG_HIGH_DEPTH = 1 << 24,
} GdkDebugFlags;
extern guint _gdk_debug_flags;

View File

@@ -22,6 +22,7 @@
#include "gdkdeviceprivate.h"
#include "gdkdevicetool.h"
#include "gdkdisplayprivate.h"
#include "gdkinternals.h"
#include "gdkintl.h"
#include "gdkkeysprivate.h"
@@ -330,7 +331,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
* GdkDevice::changed:
* @device: the `GdkDevice`
*
* Emitted either when the number of either axes or keys changes.
* Emitted either when the the number of either axes or keys changes.
*
* On X11 this will normally happen when the physical device
* routing events through the logical device changes (for

View File

@@ -25,7 +25,6 @@
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkdevicetool.h>
#include <gdk/gdkenums.h>
G_BEGIN_DECLS

View File

@@ -20,7 +20,7 @@
#include <math.h>
#include "gdkdevicetoolprivate.h"
#include "gdkenumtypes.h"
#include "gdkinternals.h"
#include "gdkintl.h"
/**

View File

@@ -22,9 +22,8 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkenums.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@@ -27,20 +27,16 @@
#include "gdkintl.h"
#include "gdk-private.h"
#include "gdkapplaunchcontext.h"
#include "gdkclipboardprivate.h"
#include "gdkdeviceprivate.h"
#include "gdkdisplaymanagerprivate.h"
#include "gdkframeclockidleprivate.h"
#include "gdkeventsprivate.h"
#include "gdkglcontextprivate.h"
#include "gdkevents.h"
#include "gdkinternals.h"
#include "gdkmonitorprivate.h"
#include "gdkframeclockidleprivate.h"
#ifdef HAVE_EGL
#include <epoxy/egl.h>
#endif
#include <math.h>
#include <stdlib.h>
#include <glib.h>
/**
* GdkDisplay:
@@ -91,12 +87,6 @@ struct _GdkDisplayPrivate {
GdkGLContext *gl_context;
GError *gl_error;
#ifdef HAVE_EGL
EGLDisplay egl_display;
EGLConfig egl_config;
EGLConfig egl_config_high_depth;
#endif
guint rgba : 1;
guint composited : 1;
guint input_shapes : 1;
@@ -156,26 +146,6 @@ gdk_display_default_init_gl (GdkDisplay *display,
return NULL;
}
static guint
gdk_display_default_rate_egl_config (GdkDisplay *display,
gpointer egl_display,
gpointer config)
{
guint distance = 0;
#ifdef HAVE_EGL
int tmp;
if (!eglGetConfigAttrib (egl_display, config, EGL_SAMPLE_BUFFERS, &tmp) || tmp != 0)
distance += 0x20000;
if (!eglGetConfigAttrib (egl_display, config, EGL_DEPTH_SIZE, &tmp) || tmp != 0 ||
!eglGetConfigAttrib (egl_display, config, EGL_STENCIL_SIZE, &tmp) || tmp != 0)
distance += 0x10000;
#endif
return distance;
}
static GdkSeat *
gdk_display_real_get_default_seat (GdkDisplay *display)
{
@@ -203,7 +173,6 @@ gdk_display_class_init (GdkDisplayClass *class)
class->make_default = gdk_display_real_make_default;
class->get_app_launch_context = gdk_display_real_get_app_launch_context;
class->init_gl = gdk_display_default_init_gl;
class->rate_egl_config = gdk_display_default_rate_egl_config;
class->get_default_seat = gdk_display_real_get_default_seat;
class->opened = gdk_display_real_opened;
@@ -383,9 +352,6 @@ gdk_display_dispose (GObject *object)
g_queue_clear (&display->queued_events);
g_clear_object (&priv->gl_context);
#ifdef HAVE_EGL
g_clear_pointer (&priv->egl_display, eglTerminate);
#endif
g_clear_error (&priv->gl_error);
G_OBJECT_CLASS (gdk_display_parent_class)->dispose (object);
@@ -1267,8 +1233,6 @@ gdk_display_init_gl (GdkDisplay *self)
*/
priv->gl_context = context;
gdk_gl_backend_use (GDK_GL_CONTEXT_GET_CLASS (context)->backend_type);
gdk_profiler_end_mark (before, "initialize OpenGL", NULL);
}
@@ -1325,38 +1289,6 @@ gdk_display_prepare_gl (GdkDisplay *self,
}
}
/**
* gdk_display_create_gl_context:
* @self: a `GdkDisplay`
* @error: return location for an error
*
* Creates a new `GdkGLContext` for the `GdkDisplay`.
*
* The context is disconnected from any particular surface or surface
* and cannot be used to draw to any surface. It can only be used to
* draw to non-surface framebuffers like textures.
*
* If the creation of the `GdkGLContext` failed, @error will be set.
* Before using the returned `GdkGLContext`, you will need to
* call [method@Gdk.GLContext.make_current] or [method@Gdk.GLContext.realize].
*
* Returns: (transfer full): the newly created `GdkGLContext`
*
* Since: 4.6
*/
GdkGLContext *
gdk_display_create_gl_context (GdkDisplay *self,
GError **error)
{
g_return_val_if_fail (GDK_IS_DISPLAY (self), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
if (!gdk_display_prepare_gl (self, error))
return NULL;
return gdk_gl_context_new (self, NULL);
}
/*< private >
* gdk_display_get_gl_context:
* @self: the `GdkDisplay`
@@ -1378,417 +1310,6 @@ gdk_display_get_gl_context (GdkDisplay *self)
return priv->gl_context;
}
#ifdef HAVE_EGL
#ifdef G_ENABLE_DEBUG
static int
strvcmp (gconstpointer p1,
gconstpointer p2)
{
const char * const *s1 = p1;
const char * const *s2 = p2;
return strcmp (*s1, *s2);
}
static char *
describe_extensions (EGLDisplay egl_display)
{
const char *extensions;
char **exts;
char *ext;
extensions = eglQueryString (egl_display, EGL_EXTENSIONS);
exts = g_strsplit (extensions, " ", -1);
qsort (exts, g_strv_length (exts), sizeof (char *), strvcmp);
ext = g_strjoinv ("\n\t", exts);
if (ext[0] == '\n')
ext[0] = ' ';
g_strfreev (exts);
return g_strstrip (ext);
}
static char *
describe_egl_config (EGLDisplay egl_display,
EGLConfig egl_config)
{
EGLint red, green, blue, alpha, type;
if (egl_config == NULL)
return g_strdup ("-");
if (!eglGetConfigAttrib (egl_display, egl_config, EGL_RED_SIZE, &red) ||
!eglGetConfigAttrib (egl_display, egl_config, EGL_GREEN_SIZE, &green) ||
!eglGetConfigAttrib (egl_display, egl_config, EGL_BLUE_SIZE, &blue) ||
!eglGetConfigAttrib (egl_display, egl_config, EGL_ALPHA_SIZE, &alpha))
return g_strdup ("Unknown");
if (epoxy_has_egl_extension (egl_display, "EGL_EXT_pixel_format_float"))
{
if (!eglGetConfigAttrib (egl_display, egl_config, EGL_COLOR_COMPONENT_TYPE_EXT, &type))
type = EGL_COLOR_COMPONENT_TYPE_FIXED_EXT;
}
else
type = EGL_COLOR_COMPONENT_TYPE_FIXED_EXT;
return g_strdup_printf ("R%dG%dB%dA%d%s", red, green, blue, alpha, type == EGL_COLOR_COMPONENT_TYPE_FIXED_EXT ? "" : " float");
}
#endif
/*<private>
* gdk_display_get_egl_display:
* @self: a display
*
* Retrieves the EGL display connection object for the given GDK display.
*
* This function returns `NULL` if GL is not supported or GDK is using
* a different OpenGL framework than EGL.
*
* Returns: (nullable): the EGL display object
*/
gpointer
gdk_display_get_egl_display (GdkDisplay *self)
{
GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
g_return_val_if_fail (GDK_IS_DISPLAY (self), NULL);
if (!priv->egl_display &&
!gdk_display_prepare_gl (self, NULL))
return NULL;
return priv->egl_display;
}
gpointer
gdk_display_get_egl_config (GdkDisplay *self)
{
GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
return priv->egl_config;
}
gpointer
gdk_display_get_egl_config_high_depth (GdkDisplay *self)
{
GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
return priv->egl_config_high_depth;
}
static EGLDisplay
gdk_display_create_egl_display (EGLenum platform,
gpointer native_display)
{
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
EGLDisplay egl_display = NULL;
if (epoxy_has_egl_extension (NULL, "EGL_KHR_platform_base"))
{
PFNEGLGETPLATFORMDISPLAYPROC getPlatformDisplay =
(void *) eglGetProcAddress ("eglGetPlatformDisplay");
if (getPlatformDisplay != NULL)
egl_display = getPlatformDisplay (platform, native_display, NULL);
if (egl_display != NULL)
goto out;
}
if (epoxy_has_egl_extension (NULL, "EGL_EXT_platform_base"))
{
PFNEGLGETPLATFORMDISPLAYEXTPROC getPlatformDisplay =
(void *) eglGetProcAddress ("eglGetPlatformDisplayEXT");
if (getPlatformDisplay != NULL)
egl_display = getPlatformDisplay (platform, native_display, NULL);
if (egl_display != NULL)
goto out;
}
egl_display = eglGetDisplay ((EGLNativeDisplayType) native_display);
out:
gdk_profiler_end_mark (start_time, "Create EGL display", NULL);
return egl_display;
}
#define MAX_EGL_ATTRS 30
typedef enum {
GDK_EGL_CONFIG_PERFECT = (1 << 0),
GDK_EGL_CONFIG_HDR = (1 << 1),
} GdkEGLConfigCreateFlags;
static EGLConfig
gdk_display_create_egl_config (GdkDisplay *self,
GdkEGLConfigCreateFlags flags,
GError **error)
{
GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
EGLint attrs[MAX_EGL_ATTRS];
EGLConfig *configs;
EGLint count, alloced;
EGLConfig best_config;
guint best_score;
int i = 0;
attrs[i++] = EGL_SURFACE_TYPE;
attrs[i++] = EGL_WINDOW_BIT;
attrs[i++] = EGL_COLOR_BUFFER_TYPE;
attrs[i++] = EGL_RGB_BUFFER;
attrs[i++] = EGL_RED_SIZE;
attrs[i++] = (flags & GDK_EGL_CONFIG_HDR) ? 9 : 8;
attrs[i++] = EGL_GREEN_SIZE;
attrs[i++] = (flags & GDK_EGL_CONFIG_HDR) ? 9 : 8;
attrs[i++] = EGL_BLUE_SIZE;
attrs[i++] = (flags & GDK_EGL_CONFIG_HDR) ? 9 : 8;
attrs[i++] = EGL_ALPHA_SIZE;
attrs[i++] = 8;
if (flags & GDK_EGL_CONFIG_HDR &&
self->have_egl_pixel_format_float)
{
attrs[i++] = EGL_COLOR_COMPONENT_TYPE_EXT;
attrs[i++] = EGL_DONT_CARE;
}
attrs[i++] = EGL_NONE;
g_assert (i < MAX_EGL_ATTRS);
if (!eglChooseConfig (priv->egl_display, attrs, NULL, -1, &alloced) || alloced == 0)
{
g_set_error_literal (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
_("No EGL configuration available"));
return NULL;
}
configs = g_new (EGLConfig, alloced);
if (!eglChooseConfig (priv->egl_display, attrs, configs, alloced, &count))
{
g_set_error_literal (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
_("Failed to get EGL configurations"));
return NULL;
}
g_warn_if_fail (alloced == count);
best_score = G_MAXUINT;
best_config = NULL;
for (i = 0; i < count; i++)
{
guint score = GDK_DISPLAY_GET_CLASS (self)->rate_egl_config (self, priv->egl_display, configs[i]);
if (score < best_score)
{
best_score = score;
best_config = configs[i];
}
if (score == 0)
break;
}
g_free (configs);
gdk_profiler_end_mark (start_time, "Create EGL config", NULL);
if (best_score == G_MAXUINT)
{
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
_("No EGL configuration with required features found"));
return NULL;
}
else if ((flags & GDK_EGL_CONFIG_PERFECT) && best_score != 0)
{
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
_("No perfect EGL configuration found"));
return NULL;
}
return best_config;
}
#undef MAX_EGL_ATTRS
static gboolean
gdk_display_check_egl_extensions (EGLDisplay egl_display,
const char **extensions,
GError **error)
{
GString *missing = NULL;
gsize i, n_missing;
n_missing = 0;
for (i = 0; extensions[i] != NULL; i++)
{
if (!epoxy_has_egl_extension (egl_display, extensions[i]))
{
if (missing == NULL)
{
missing = g_string_new (extensions[i]);
}
else
{
g_string_append (missing, ", ");
g_string_append (missing, extensions[i]);
}
n_missing++;
}
}
if (n_missing)
{
g_set_error (error, GDK_GL_ERROR, GDK_GL_ERROR_UNSUPPORTED_PROFILE,
/* translators: Arguments are the number of missing extensions
* followed by a comma-separated list of their names */
g_dngettext (GETTEXT_PACKAGE,
"EGL implementation is missing extension %2$s",
"EGL implementation is missing %d extensions: %s",
n_missing),
(int) n_missing, missing->str);
g_string_free (missing, TRUE);
return FALSE;
}
return TRUE;
}
gboolean
gdk_display_init_egl (GdkDisplay *self,
int platform,
gpointer native_display,
gboolean allow_any,
GError **error)
{
GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
G_GNUC_UNUSED gint64 start_time2;
int major, minor;
if (!gdk_gl_backend_can_be_used (GDK_GL_EGL, error))
return FALSE;
if (!epoxy_has_egl ())
{
gboolean sandboxed = gdk_running_in_sandbox ();
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
sandboxed ? _("libEGL not available in this sandbox")
: _("libEGL not available"));
return FALSE;
}
priv->egl_display = gdk_display_create_egl_display (platform, native_display);
if (priv->egl_display == NULL)
{
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
_("Failed to create EGL display"));
return FALSE;
}
start_time2 = GDK_PROFILER_CURRENT_TIME;
if (!eglInitialize (priv->egl_display, &major, &minor))
{
priv->egl_display = NULL;
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
_("Could not initialize EGL display"));
return FALSE;
}
gdk_profiler_end_mark (start_time2, "eglInitialize", NULL);
if (major < GDK_EGL_MIN_VERSION_MAJOR ||
(major == GDK_EGL_MIN_VERSION_MAJOR && minor < GDK_EGL_MIN_VERSION_MINOR))
{
g_clear_pointer (&priv->egl_display, eglTerminate);
g_set_error (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
_("EGL version %d.%d is too old. GTK requires %d.%d"),
major, minor, GDK_EGL_MIN_VERSION_MAJOR, GDK_EGL_MIN_VERSION_MINOR);
return FALSE;
}
if (!gdk_display_check_egl_extensions (priv->egl_display,
(const char *[]) {
"EGL_KHR_create_context",
"EGL_KHR_surfaceless_context",
NULL
},
error))
{
g_clear_pointer (&priv->egl_display, eglTerminate);
return FALSE;
}
priv->egl_config = gdk_display_create_egl_config (self,
allow_any ? 0 : GDK_EGL_CONFIG_PERFECT,
error);
if (priv->egl_config == NULL)
{
g_clear_pointer (&priv->egl_display, eglTerminate);
return FALSE;
}
self->have_egl_buffer_age =
epoxy_has_egl_extension (priv->egl_display, "EGL_EXT_buffer_age");
self->have_egl_swap_buffers_with_damage =
epoxy_has_egl_extension (priv->egl_display, "EGL_EXT_swap_buffers_with_damage");
self->have_egl_no_config_context =
epoxy_has_egl_extension (priv->egl_display, "EGL_KHR_no_config_context");
self->have_egl_pixel_format_float =
epoxy_has_egl_extension (priv->egl_display, "EGL_EXT_pixel_format_float");
if (self->have_egl_no_config_context)
priv->egl_config_high_depth = gdk_display_create_egl_config (self,
GDK_EGL_CONFIG_HDR,
error);
if (priv->egl_config_high_depth == NULL)
priv->egl_config_high_depth = priv->egl_config;
GDK_DISPLAY_NOTE (self, OPENGL, {
char *ext = describe_extensions (priv->egl_display);
char *std_cfg = describe_egl_config (priv->egl_display, priv->egl_config);
char *hd_cfg = describe_egl_config (priv->egl_display, priv->egl_config_high_depth);
g_message ("EGL API version %d.%d found\n"
" - Vendor: %s\n"
" - Version: %s\n"
" - Client APIs: %s\n"
" - Extensions:\n"
"\t%s\n"
" - Selected fbconfig: %s\n"
" high depth: %s",
major, minor,
eglQueryString (priv->egl_display, EGL_VENDOR),
eglQueryString (priv->egl_display, EGL_VERSION),
eglQueryString (priv->egl_display, EGL_CLIENT_APIS),
ext, std_cfg,
priv->egl_config_high_depth == priv->egl_config ? "none" : hd_cfg);
g_free (hd_cfg);
g_free (std_cfg);
g_free (ext);
});
gdk_profiler_end_mark (start_time, "init EGL", NULL);
return TRUE;
}
#endif
GdkDebugFlags
gdk_display_get_debug_flags (GdkDisplay *display)
{

View File

@@ -71,9 +71,6 @@ gboolean gdk_display_supports_input_shapes (GdkDisplay *display);
GDK_AVAILABLE_IN_4_4
gboolean gdk_display_prepare_gl (GdkDisplay *self,
GError **error);
GDK_AVAILABLE_IN_4_6
GdkGLContext *gdk_display_create_gl_context(GdkDisplay *self,
GError **error);
GDK_AVAILABLE_IN_ALL
GdkDisplay *gdk_display_get_default (void);

View File

@@ -27,6 +27,7 @@
#include "gdkconfig.h"
#include "gdkdisplaymanagerprivate.h"
#include "gdkdisplayprivate.h"
#include "gdkinternals.h"
#include "gdkkeysprivate.h"
#include "gdkintl.h"

View File

@@ -92,8 +92,6 @@ struct _GdkDisplay
guint double_click_time; /* Maximum time between clicks in msecs */
guint double_click_distance; /* Maximum distance between clicks in pixels */
GList *seats;
#ifdef GDK_RENDERING_VULKAN
VkInstance vk_instance;
VkDebugReportCallbackEXT vk_debug_callback;
@@ -105,11 +103,7 @@ struct _GdkDisplay
guint vulkan_refcount;
#endif /* GDK_RENDERING_VULKAN */
/* egl info */
guint have_egl_buffer_age : 1;
guint have_egl_swap_buffers_with_damage : 1;
guint have_egl_no_config_context : 1;
guint have_egl_pixel_format_float : 1;
GList *seats;
};
struct _GdkDisplayClass
@@ -146,15 +140,10 @@ struct _GdkDisplayClass
GdkKeymap * (*get_keymap) (GdkDisplay *display);
GdkGLContext * (* init_gl) (GdkDisplay *display,
GdkGLContext * (*init_gl) (GdkDisplay *display,
GError **error);
/* Returns the distance from a perfect score EGL config.
* GDK chooses the one with the *LOWEST* score */
guint (* rate_egl_config) (GdkDisplay *display,
gpointer egl_display,
gpointer egl_config);
GdkSeat * (*get_default_seat) (GdkDisplay *display);
GdkSeat * (*get_default_seat) (GdkDisplay *display);
GListModel * (*get_monitors) (GdkDisplay *self);
GdkMonitor * (*get_monitor_at_surface) (GdkDisplay *display,
@@ -219,16 +208,6 @@ GdkSurface * gdk_display_create_surface (GdkDisplay *display
GdkGLContext * gdk_display_get_gl_context (GdkDisplay *display);
gboolean gdk_display_init_egl (GdkDisplay *display,
int /*EGLenum*/ platform,
gpointer native_display,
gboolean allow_any,
GError **error);
gpointer gdk_display_get_egl_display (GdkDisplay *display);
gpointer gdk_display_get_egl_config (GdkDisplay *display);
gpointer gdk_display_get_egl_config_high_depth
(GdkDisplay *display);
void gdk_display_set_rgba (GdkDisplay *display,
gboolean rgba);
void gdk_display_set_composited (GdkDisplay *display,

View File

@@ -29,10 +29,9 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkdevice.h>
#include <gdk/gdkenums.h>
#include <gdk/gdkevents.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkdevice.h>
#include <gdk/gdkevents.h>
G_BEGIN_DECLS
@@ -70,7 +69,7 @@ GDK_AVAILABLE_IN_ALL
GdkDragAction gdk_drag_get_selected_action (GdkDrag *drag);
GDK_AVAILABLE_IN_ALL
gboolean gdk_drag_action_is_unique (GdkDragAction action) G_GNUC_CONST;
gboolean gdk_drag_action_is_unique (GdkDragAction action);
GDK_AVAILABLE_IN_ALL
GdkDrag * gdk_drag_begin (GdkSurface *surface,

View File

@@ -22,10 +22,9 @@
#include "gdkdrawcontextprivate.h"
#include "gdkdebug.h"
#include "gdkinternals.h"
#include "gdkintl.h"
#include "gdkprofilerprivate.h"
#include "gdksurfaceprivate.h"
/**
* GdkDrawContext:
@@ -276,8 +275,7 @@ gdk_draw_context_get_surface (GdkDrawContext *context)
/**
* gdk_draw_context_begin_frame:
* @context: the `GdkDrawContext` used to draw the frame. The context must
* have a surface.
* @context: the `GdkDrawContext` used to draw the frame
* @region: minimum region that should be drawn
*
* Indicates that you are beginning the process of redrawing @region
@@ -312,41 +310,8 @@ gdk_draw_context_begin_frame (GdkDrawContext *context,
GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context);
g_return_if_fail (GDK_IS_DRAW_CONTEXT (context));
g_return_if_fail (priv->surface != NULL);
g_return_if_fail (region != NULL);
gdk_draw_context_begin_frame_full (context, FALSE, region);
}
/*
* @prefers_high_depth: %TRUE to request a higher bit depth
*
* If high depth is preferred, GDK will see about providing a rendering target
* that supports higher bit depth than 8 bits per channel. Typically this means
* a target supporting 16bit floating point pixels, but that is not guaranteed.
*
* This is only a request and if the GDK backend does not support HDR rendering
* or does not consider it worthwhile, it may choose to not honor the request.
* It may also choose to provide high depth even if it was not requested.
* Typically the steps undertaken by a backend are:
* 1. Check if high depth is supported by this drawing backend.
* 2. Check if the compositor supports high depth.
* 3. Check if the compositor prefers regular bit depth. This is usually the case
* when the attached monitors do not support high depth content or when the
* system is resource constrained.
* In either of those cases, the context will usually choose to not honor the request.
*
* The rendering code must be able to deal with content in any bit depth, no matter
* the preference. The prefers_high_depth argument is only a hint and GDK is free
* to choose.
*/
void
gdk_draw_context_begin_frame_full (GdkDrawContext *context,
gboolean prefers_high_depth,
const cairo_region_t *region)
{
GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context);
if (GDK_SURFACE_DESTROYED (priv->surface))
return;
@@ -368,13 +333,10 @@ gdk_draw_context_begin_frame_full (GdkDrawContext *context,
return;
}
if (GDK_DISPLAY_DEBUG_CHECK (priv->display, HIGH_DEPTH))
prefers_high_depth = TRUE;
priv->frame_region = cairo_region_copy (region);
priv->surface->paint_context = g_object_ref (context);
GDK_DRAW_CONTEXT_GET_CLASS (context)->begin_frame (context, prefers_high_depth, priv->frame_region);
GDK_DRAW_CONTEXT_GET_CLASS (context)->begin_frame (context, priv->frame_region);
}
#ifdef HAVE_SYSPROF
@@ -415,7 +377,6 @@ gdk_draw_context_end_frame (GdkDrawContext *context)
GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context);
g_return_if_fail (GDK_IS_DRAW_CONTEXT (context));
g_return_if_fail (priv->surface != NULL);
if (GDK_SURFACE_DESTROYED (priv->surface))
return;

View File

@@ -41,7 +41,6 @@ struct _GdkDrawContextClass
GObjectClass parent_class;
void (* begin_frame) (GdkDrawContext *context,
gboolean prefers_high_depth,
cairo_region_t *update_area);
void (* end_frame) (GdkDrawContext *context,
cairo_region_t *painted);
@@ -50,9 +49,6 @@ struct _GdkDrawContextClass
void gdk_draw_context_surface_resized (GdkDrawContext *context);
void gdk_draw_context_begin_frame_full (GdkDrawContext *context,
gboolean prefers_high_depth,
const cairo_region_t *region);
G_END_DECLS
#endif /* __GDK__DRAW_CONTEXT_PRIVATE__ */

View File

@@ -46,9 +46,9 @@
#include "gdkcontentserializer.h"
#include "gdkcursor.h"
#include "gdkdisplay.h"
#include "gdkdragprivate.h"
#include "gdkenumtypes.h"
#include "gdkeventsprivate.h"
#include "gdkinternals.h"
#include "gdkintl.h"
#include "gdkpipeiostreamprivate.h"
#include "gdksurface.h"

View File

@@ -25,7 +25,6 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkenums.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>

View File

@@ -1,336 +0,0 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_ENUMS_H__
#define __GDK_ENUMS_H__
#if !defined (__GDK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <glib.h>
G_BEGIN_DECLS
/* Currently, these are the same values numerically as in the
* X protocol. If you change that, gdksurface-x11.c/gdk_surface_set_geometry_hints()
* will need fixing.
*/
/**
* GdkGravity:
* @GDK_GRAVITY_NORTH_WEST: the reference point is at the top left corner.
* @GDK_GRAVITY_NORTH: the reference point is in the middle of the top edge.
* @GDK_GRAVITY_NORTH_EAST: the reference point is at the top right corner.
* @GDK_GRAVITY_WEST: the reference point is at the middle of the left edge.
* @GDK_GRAVITY_CENTER: the reference point is at the center of the surface.
* @GDK_GRAVITY_EAST: the reference point is at the middle of the right edge.
* @GDK_GRAVITY_SOUTH_WEST: the reference point is at the lower left corner.
* @GDK_GRAVITY_SOUTH: the reference point is at the middle of the lower edge.
* @GDK_GRAVITY_SOUTH_EAST: the reference point is at the lower right corner.
* @GDK_GRAVITY_STATIC: the reference point is at the top left corner of the
* surface itself, ignoring window manager decorations.
*
* Defines the reference point of a surface and is used in `GdkPopupLayout`.
*/
typedef enum
{
GDK_GRAVITY_NORTH_WEST = 1,
GDK_GRAVITY_NORTH,
GDK_GRAVITY_NORTH_EAST,
GDK_GRAVITY_WEST,
GDK_GRAVITY_CENTER,
GDK_GRAVITY_EAST,
GDK_GRAVITY_SOUTH_WEST,
GDK_GRAVITY_SOUTH,
GDK_GRAVITY_SOUTH_EAST,
GDK_GRAVITY_STATIC
} GdkGravity;
/* Types of modifiers.
*/
/**
* GdkModifierType:
* @GDK_SHIFT_MASK: the Shift key.
* @GDK_LOCK_MASK: a Lock key (depending on the modifier mapping of the
* X server this may either be CapsLock or ShiftLock).
* @GDK_CONTROL_MASK: the Control key.
* @GDK_ALT_MASK: the fourth modifier key (it depends on the modifier
* mapping of the X server which key is interpreted as this modifier, but
* normally it is the Alt key).
* @GDK_BUTTON1_MASK: the first mouse button.
* @GDK_BUTTON2_MASK: the second mouse button.
* @GDK_BUTTON3_MASK: the third mouse button.
* @GDK_BUTTON4_MASK: the fourth mouse button.
* @GDK_BUTTON5_MASK: the fifth mouse button.
* @GDK_SUPER_MASK: the Super modifier
* @GDK_HYPER_MASK: the Hyper modifier
* @GDK_META_MASK: the Meta modifier
*
* Flags to indicate the state of modifier keys and mouse buttons
* in events.
*
* Typical modifier keys are Shift, Control, Meta, Super, Hyper, Alt, Compose,
* Apple, CapsLock or ShiftLock.
*
* Note that GDK may add internal values to events which include values outside
* of this enumeration. Your code should preserve and ignore them. You can use
* %GDK_MODIFIER_MASK to remove all private values.
*/
typedef enum
{
GDK_SHIFT_MASK = 1 << 0,
GDK_LOCK_MASK = 1 << 1,
GDK_CONTROL_MASK = 1 << 2,
GDK_ALT_MASK = 1 << 3,
GDK_BUTTON1_MASK = 1 << 8,
GDK_BUTTON2_MASK = 1 << 9,
GDK_BUTTON3_MASK = 1 << 10,
GDK_BUTTON4_MASK = 1 << 11,
GDK_BUTTON5_MASK = 1 << 12,
GDK_SUPER_MASK = 1 << 26,
GDK_HYPER_MASK = 1 << 27,
GDK_META_MASK = 1 << 28,
} GdkModifierType;
/**
* GDK_MODIFIER_MASK:
*
* A mask covering all entries in `GdkModifierType`.
*/
#define GDK_MODIFIER_MASK (GDK_SHIFT_MASK|GDK_LOCK_MASK|GDK_CONTROL_MASK| \
GDK_ALT_MASK|GDK_SUPER_MASK|GDK_HYPER_MASK|GDK_META_MASK| \
GDK_BUTTON1_MASK|GDK_BUTTON2_MASK|GDK_BUTTON3_MASK| \
GDK_BUTTON4_MASK|GDK_BUTTON5_MASK)
/**
* GdkGLError:
* @GDK_GL_ERROR_NOT_AVAILABLE: OpenGL support is not available
* @GDK_GL_ERROR_UNSUPPORTED_FORMAT: The requested visual format is not supported
* @GDK_GL_ERROR_UNSUPPORTED_PROFILE: The requested profile is not supported
* @GDK_GL_ERROR_COMPILATION_FAILED: The shader compilation failed
* @GDK_GL_ERROR_LINK_FAILED: The shader linking failed
*
* Error enumeration for `GdkGLContext`.
*/
typedef enum {
GDK_GL_ERROR_NOT_AVAILABLE,
GDK_GL_ERROR_UNSUPPORTED_FORMAT,
GDK_GL_ERROR_UNSUPPORTED_PROFILE,
GDK_GL_ERROR_COMPILATION_FAILED,
GDK_GL_ERROR_LINK_FAILED
} GdkGLError;
/**
* GdkVulkanError:
* @GDK_VULKAN_ERROR_UNSUPPORTED: Vulkan is not supported on this backend or has not been
* compiled in.
* @GDK_VULKAN_ERROR_NOT_AVAILABLE: Vulkan support is not available on this Surface
*
* Error enumeration for `GdkVulkanContext`.
*/
typedef enum {
GDK_VULKAN_ERROR_UNSUPPORTED,
GDK_VULKAN_ERROR_NOT_AVAILABLE,
} GdkVulkanError;
/**
* GdkAxisUse:
* @GDK_AXIS_IGNORE: the axis is ignored.
* @GDK_AXIS_X: the axis is used as the x axis.
* @GDK_AXIS_Y: the axis is used as the y axis.
* @GDK_AXIS_DELTA_X: the axis is used as the scroll x delta
* @GDK_AXIS_DELTA_Y: the axis is used as the scroll y delta
* @GDK_AXIS_PRESSURE: the axis is used for pressure information.
* @GDK_AXIS_XTILT: the axis is used for x tilt information.
* @GDK_AXIS_YTILT: the axis is used for y tilt information.
* @GDK_AXIS_WHEEL: the axis is used for wheel information.
* @GDK_AXIS_DISTANCE: the axis is used for pen/tablet distance information
* @GDK_AXIS_ROTATION: the axis is used for pen rotation information
* @GDK_AXIS_SLIDER: the axis is used for pen slider information
* @GDK_AXIS_LAST: a constant equal to the numerically highest axis value.
*
* Defines how device axes are interpreted by GTK.
*
* Note that the X and Y axes are not really needed; pointer devices
* report their location via the x/y members of events regardless. Whether
* X and Y are present as axes depends on the GDK backend.
*/
typedef enum
{
GDK_AXIS_IGNORE,
GDK_AXIS_X,
GDK_AXIS_Y,
GDK_AXIS_DELTA_X,
GDK_AXIS_DELTA_Y,
GDK_AXIS_PRESSURE,
GDK_AXIS_XTILT,
GDK_AXIS_YTILT,
GDK_AXIS_WHEEL,
GDK_AXIS_DISTANCE,
GDK_AXIS_ROTATION,
GDK_AXIS_SLIDER,
GDK_AXIS_LAST
} GdkAxisUse;
/**
* GdkAxisFlags:
* @GDK_AXIS_FLAG_X: X axis is present
* @GDK_AXIS_FLAG_Y: Y axis is present
* @GDK_AXIS_FLAG_DELTA_X: Scroll X delta axis is present
* @GDK_AXIS_FLAG_DELTA_Y: Scroll Y delta axis is present
* @GDK_AXIS_FLAG_PRESSURE: Pressure axis is present
* @GDK_AXIS_FLAG_XTILT: X tilt axis is present
* @GDK_AXIS_FLAG_YTILT: Y tilt axis is present
* @GDK_AXIS_FLAG_WHEEL: Wheel axis is present
* @GDK_AXIS_FLAG_DISTANCE: Distance axis is present
* @GDK_AXIS_FLAG_ROTATION: Z-axis rotation is present
* @GDK_AXIS_FLAG_SLIDER: Slider axis is present
*
* Flags describing the current capabilities of a device/tool.
*/
typedef enum
{
GDK_AXIS_FLAG_X = 1 << GDK_AXIS_X,
GDK_AXIS_FLAG_Y = 1 << GDK_AXIS_Y,
GDK_AXIS_FLAG_DELTA_X = 1 << GDK_AXIS_DELTA_X,
GDK_AXIS_FLAG_DELTA_Y = 1 << GDK_AXIS_DELTA_Y,
GDK_AXIS_FLAG_PRESSURE = 1 << GDK_AXIS_PRESSURE,
GDK_AXIS_FLAG_XTILT = 1 << GDK_AXIS_XTILT,
GDK_AXIS_FLAG_YTILT = 1 << GDK_AXIS_YTILT,
GDK_AXIS_FLAG_WHEEL = 1 << GDK_AXIS_WHEEL,
GDK_AXIS_FLAG_DISTANCE = 1 << GDK_AXIS_DISTANCE,
GDK_AXIS_FLAG_ROTATION = 1 << GDK_AXIS_ROTATION,
GDK_AXIS_FLAG_SLIDER = 1 << GDK_AXIS_SLIDER,
} GdkAxisFlags;
/**
* GdkDragAction:
* @GDK_ACTION_COPY: Copy the data.
* @GDK_ACTION_MOVE: Move the data, i.e. first copy it, then delete
* it from the source using the DELETE target of the X selection protocol.
* @GDK_ACTION_LINK: Add a link to the data. Note that this is only
* useful if source and destination agree on what it means, and is not
* supported on all platforms.
* @GDK_ACTION_ASK: Ask the user what to do with the data.
*
* Used in `GdkDrop` and `GdkDrag` to indicate the actions that the
* destination can and should do with the dropped data.
*/
typedef enum
{
GDK_ACTION_COPY = 1 << 0,
GDK_ACTION_MOVE = 1 << 1,
GDK_ACTION_LINK = 1 << 2,
GDK_ACTION_ASK = 1 << 3
} GdkDragAction;
/**
* GDK_ACTION_ALL:
*
* Defines all possible DND actions.
*
* This can be used in [method@Gdk.Drop.status] messages when any drop
* can be accepted or a more specific drop method is not yet known.
*/
#define GDK_ACTION_ALL (GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK)
/**
* GdkMemoryFormat:
* @GDK_MEMORY_B8G8R8A8_PREMULTIPLIED: 4 bytes; for blue, green, red, alpha.
* The color values are premultiplied with the alpha value.
* @GDK_MEMORY_A8R8G8B8_PREMULTIPLIED: 4 bytes; for alpha, red, green, blue.
* 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_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_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_N_FORMATS: The number of formats. This value will change as
* more formats get added, so do not rely on its concrete integer.
*
* `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
* byte each of red, green and blue. It is not endian-dependent, so
* 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).
*/
typedef enum {
GDK_MEMORY_B8G8R8A8_PREMULTIPLIED,
GDK_MEMORY_A8R8G8B8_PREMULTIPLIED,
GDK_MEMORY_R8G8B8A8_PREMULTIPLIED,
GDK_MEMORY_B8G8R8A8,
GDK_MEMORY_A8R8G8B8,
GDK_MEMORY_R8G8B8A8,
GDK_MEMORY_A8B8G8R8,
GDK_MEMORY_R8G8B8,
GDK_MEMORY_B8G8R8,
GDK_MEMORY_R16G16B16,
GDK_MEMORY_R16G16B16A16_PREMULTIPLIED,
GDK_MEMORY_R16G16B16A16,
GDK_MEMORY_R16G16B16_FLOAT,
GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED,
GDK_MEMORY_R16G16B16A16_FLOAT,
GDK_MEMORY_R32G32B32_FLOAT,
GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED,
GDK_MEMORY_R32G32B32A32_FLOAT,
GDK_MEMORY_N_FORMATS
} GdkMemoryFormat;
G_END_DECLS
#endif /* __GDK_ENUMS_H__ */

View File

@@ -24,13 +24,13 @@
#include "config.h"
#include "gdkintl.h"
#include "gdkeventsprivate.h"
#include "gdkinternals.h"
#include "gdkdisplayprivate.h"
#include "gdkdragprivate.h"
#include "gdkdropprivate.h"
#include "gdkeventsprivate.h"
#include "gdkintl.h"
#include "gdkkeysprivate.h"
#include "gdkkeysyms.h"
#include "gdk-private.h"
#include <gobject/gvaluecollector.h>

View File

@@ -29,12 +29,11 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkdrag.h>
#include <gdk/gdkdevice.h>
#include <gdk/gdkdevicetool.h>
#include <gdk/gdkdrag.h>
#include <gdk/gdkenums.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS

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