Compare commits

..

14 Commits

Author SHA1 Message Date
Matthias Clasen ec271b47fb wip 2024-08-07 19:18:35 -04:00
Matthias Clasen 80bee35ab7 download op: wip 2024-08-07 18:13:34 -04:00
Matthias Clasen 4be4e53bdd memory convert: debug spew 2024-08-07 18:13:34 -04:00
Matthias Clasen d10c55c748 node processor: spew 2024-08-07 18:13:34 -04:00
Matthias Clasen 60d9d79bcc renderer: debug spew 2024-08-07 18:13:33 -04:00
Matthias Clasen d0fbe1db5a download op: debug spew 2024-08-07 18:13:33 -04:00
Matthias Clasen 44aca0cecf Add a test for render_texture 2024-08-07 18:13:33 -04:00
Matthias Clasen f8afc60c9b Some more color tests 2024-08-07 18:11:35 -04:00
Matthias Clasen 2f26bd9842 colorstate: Change the rendering color state api
Pass an extra boolean that tells whether the target image is GL_SRGB,
in which case, the rendering color state must be srgb-linear.

Update all callers to pass FALSE, except for the one call in
the node processor, where we want to take GL_LINEAR into account.
2024-08-07 18:11:35 -04:00
Matthias Clasen 449fc749e6 Add a compare test for handling of pq colors
The node file here has a pq color that is far out of range for
sRGB, and will produce widely different result if we don't clamp
things properly.
2024-08-07 13:34:45 -04:00
Matthias Clasen 56ea1754bf gsk: Pass color state to download op
This lets us create a texture in the desired color state.
2024-08-07 13:34:45 -04:00
Matthias Clasen cd18bb9fd1 renderer: Make hdr textures if necessary
Take the preferred color state of the content into account
when deciding what color state to use for the texture we
generate.
2024-08-07 13:34:45 -04:00
Matthias Clasen 9f3927e7a7 gsk: Adapt to new rendering colorstate api
Since we now handle the GL_SRGB case when the  node processor calls
get_rendering_color_state, we can just pass SRGB as input here.
2024-08-07 13:34:45 -04:00
Matthias Clasen df18749d6d colorstate: Change the rendering color state api
Pass an extra boolean that tells whether the target image is GL_SRGB,
in which case, the rendering color state must be srgb-linear.

Update all callers to pass FALSE, except for the one call in
the node processor, where we want to take GL_LINEAR into account.
2024-08-07 13:34:45 -04:00
317 changed files with 19960 additions and 28991 deletions
+2 -4
View File
@@ -26,8 +26,7 @@ variables:
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true"
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled -Dbuild-testsuite=true -Dintrospection=enabled"
MESON_TEST_TIMEOUT_MULTIPLIER: 3
MESON_TEST_MAX_PROCESSES: 8
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v52"
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v49"
workflow:
rules:
@@ -415,12 +414,11 @@ static-scan:
# Run tests with the address sanitizer. We need to turn off introspection
# and f16c, since they are incompatible with asan
asan-build:
extends: .build-fedora-default
image: $FEDORA_IMAGE
tags: [ asan ]
stage: analysis
needs: []
variables:
MESON_TEST_MAX_PROCESSES: 4
script:
- export PATH="$HOME/.local/bin:$PATH"
- CC=clang meson setup
+1 -4
View File
@@ -1,4 +1,4 @@
FROM fedora:40
FROM fedora:39
RUN dnf -y install \
adwaita-icon-theme \
@@ -99,11 +99,8 @@ RUN dnf -y install \
which \
wireplumber \
xorg-x11-server-Xvfb \
&& dnf -y update \
&& dnf clean all
RUN rm /usr/share/vulkan/icd.d/powervr_mesa_icd.x86_64.json
# Enable sudo for wheel users
RUN sed -i -e 's/# %wheel/%wheel/' -e '0,/%wheel/{s/%wheel/# %wheel/}' /etc/sudoers
+4 -10
View File
@@ -8,19 +8,17 @@ builddir=$1
setup=$2
suite=$3
multiplier=${MESON_TEST_TIMEOUT_MULTIPLIER:-1}
n_processes=${MESON_TEST_MAX_PROCESSES:-1}
# Ignore memory leaks lower in dependencies
export LSAN_OPTIONS=suppressions=$srcdir/lsan.supp:print_suppressions=0:detect_leaks=0:allocator_may_return_null=1
export G_SLICE=always-malloc
case "${setup}" in
x11*)
dbus-run-session -- \
xvfb-run -a -s "-screen 0 1024x768x24 -noreset" \
xvfb-run -a -s "-screen 0 1024x768x24 -noreset" \
meson test -C ${builddir} \
--quiet \
--timeout-multiplier "${multiplier}" \
--num-processes "${n_processes}" \
--print-errorlogs \
--setup=${setup} \
--suite=${suite//,/ --suite=} \
@@ -42,11 +40,9 @@ case "${setup}" in
compositor=$!
export WAYLAND_DISPLAY=wayland-5
dbus-run-session -- \
meson test -C ${builddir} \
meson test -C ${builddir} \
--quiet \
--timeout-multiplier "${multiplier}" \
--num-processes "${n_processes}" \
--print-errorlogs \
--setup=${setup} \
--suite=${suite//,/ --suite=} \
@@ -67,11 +63,9 @@ case "${setup}" in
server=$!
export BROADWAY_DISPLAY=:5
dbus-run-session -- \
meson test -C ${builddir} \
meson test -C ${builddir} \
--quiet \
--timeout-multiplier "${multiplier}" \
--num-processes "${n_processes}" \
--print-errorlogs \
--setup=${setup} \
--suite=${suite//,/ --suite=} \
+1 -195
View File
@@ -1,200 +1,6 @@
Overview of Changes in 4.16.0, 09-06-2024
Overview of Changes in 4.15.5, xx-xx-xxxx
=========================================
Note: This release changes the default GSK renderer to be Vulkan,
on Wayland. Other platforms still use ngl. The intent of this change
is to use the best available platform APIs. You can still override
the renderer choice using the GSK_RENDERER environment variable.
We believe that most of the problems reported with the new renderers
during the 4.13 and 4.15 development cycles have been addressed by now.
But the new renderers and dmabuf support are using graphics drivers
in different ways than the old gl renderer, and trigger new driver bugs.
Therefore, it is recommended to use the latest mesa release (24.2)
with the new renderers.
* GtkScale:
- Fix positioning of scale values
* GtkEmojiChooser:
- Make Control-clicks work for the recent section
* GtkPopover:
- Make sure focus lands on the right widget when cascading
* GtkSpinButton:
- Disable Emoji input for numeric spin buttons
* GtkSingleSelection:
- Implement unselect_all
* Accssibility:
- Fix roles for radio buttons
- Check if ATs are listening before exporting trees
- Add a check for sandboxed accessibility bus
- Fix handling of the error message relation
- Turn criticals into debug messages
- Set expanded states properly in menus
* CSS:
- Fix a few issues on bigendian systems
- Avoid a crash with relative colors
* GSK:
- Use the right GL context when exporting textures
- Don't let colors influence depth decisions
- Allow uploading of mipmap levels when tiling textures
* GDK:
- Update keysyms from libX11 1.8.10
- Implement cpu-side mipmapping
- Use a thread pool for color conversions and mipmapping
* Vulkan:
- Fix drag surface offsets
* Wayland:
- Fix a crash
- Associate EGL windows with context later
* X11:
- Fix initial EGL context creation
- Fix a problem with GL context creation
* Broadway:
- Implement compute_size and request_layout
* MacOS:
- Set transparent backgroiund for toplevel windows
* Windows:
- Improve debug output
- Detect Mesas d3d12 driver and request GDI compat
* Demos:
- Set window icons in demos
- Add a 64k x 64k image to the image scaling demo
* Translation updates
Belarusian
Brazilian Portuguese
Catalan
Czech
Galician
German
Hebrew
Indonesian
Korean
Lithuanian
Persian
Polish
Portuguese
Slovenian
Spanish
Turkish
Ukrainian
Overview of Changes in 4.15.6, 08-26-2024
=========================================
* GtkCheckButton:
- Add a grouped style class for radio buttons
* GtkScale:
- Fix alignment and positioning problems
* Css:
- Fix crashes in the variable support
* Gsk:
- Make graphics offloading work better with kwin
- Make colorstate transfer functions more robust
- GC dead textures more agressively
- Only use a single render pass per frame
* GL:
- Round damage rectangles properly
- Use the shared context when creating textures
- Fix a file descriptor leak in dmabuf export
* Vulkan:
- Round damage rectangles properly
* Wayland:
- Work with the kwin implementation of xx-color-management-v4
* Windows:
- Make gtk_show_uri use SHOpenWithDialog()
- Enable incremental rendering with WGL
* Macos:
- Open context menus on Ctrl-left click
* Debugging:
- Show color state information in the inspector
- Collect input event traces in the recorder
- Add shortcuts for toggling recording: Super-r
and for screenshots: Super-c
- Split the GDK_DEBUG env var into GDK_DEBUG and GDK_DISABLE
- Add GDK_DISABLE=color-mgmt and GDK_DISABLE=offload
* Tools:
- Add a 'Paste as node' action in gtk4-node-editor
* Translations updates
Basque
Belarusian
Brazilian Portuguese
Chinese (China)
Georgian
Hebrew
Hindi
Russian
Slovenian
Turkish
Ukrainian
Overview of Changes in 4.15.5, 11-08-2024
=========================================
* GtkTextView:
- ADd GtkTextBufferCommitNotify
* CSS:
- Propagate color state information to GSK for many features:
colors, borders, shadows, text
* Gdk:
- Fix an fd leak in the Vulkan code
- Fix a leak of EGLSurfaces and DMA buffers
- Set the opaque region of surfaces automatically based on their content
* Gsk:
- Fix Emoji rendering in Vulkan
- Rework color handling to take color states into account
- Implement more powerful occlusion culling
- Minimize our use of renderpasses
* Macos:
- Fix window transparency
* Debugging:
- The inspector shows details about color states
* Deprecations:
- gdk_draw_context_begin/end_frame
- gdk_surface_set_opaque_region
* Build:
- Require gstreamer 1.24
* Translation updates
Romanian
Overview of Changes in 4.15.4, 30-07-2024
=========================================
-3
View File
@@ -454,9 +454,6 @@
<file>icons/16x16/categories/applications-other.png</file>
<file>icons/48x48/status/starred.png</file>
<file alias="icons/scalable/apps/org.gtk.Demo4.svg">data/scalable/apps/org.gtk.Demo4.svg</file>
<file>portland-rose-thumbnail.png</file>
<file>large-image-thumbnail.png</file>
<file compressed="true">large-image.png</file>
</gresource>
<gresource prefix="/org/gtk/Demo4/gtk">
<file preprocess="xml-stripblanks">help-overlay.ui</file>
+1 -1
View File
@@ -55,7 +55,7 @@ mode_switch_state_set (GtkSwitch *sw,
{
gtk_widget_set_visible (label, TRUE);
gtk_accessible_update_relation (GTK_ACCESSIBLE (sw),
GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE, label, NULL,
GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE, label,
-1);
gtk_accessible_update_state (GTK_ACCESSIBLE (sw),
GTK_ACCESSIBLE_STATE_INVALID, GTK_ACCESSIBLE_INVALID_TRUE,
+14 -150
View File
@@ -14,103 +14,6 @@
#include <gtk/gtk.h>
#include "demo3widget.h"
static GtkWidget *window = NULL;
static GCancellable *cancellable = NULL;
static void
load_texture (GTask *task,
gpointer source_object,
gpointer task_data,
GCancellable *cable)
{
GFile *file = task_data;
GdkTexture *texture;
GError *error = NULL;
texture = gdk_texture_new_from_file (file, &error);
if (texture)
g_task_return_pointer (task, texture, g_object_unref);
else
g_task_return_error (task, error);
}
static void
set_wait_cursor (GtkWidget *widget)
{
gtk_widget_set_cursor_from_name (GTK_WIDGET (gtk_widget_get_root (widget)), "wait");
}
static void
unset_wait_cursor (GtkWidget *widget)
{
gtk_widget_set_cursor (GTK_WIDGET (gtk_widget_get_root (widget)), NULL);
}
static void
texture_loaded (GObject *source,
GAsyncResult *result,
gpointer data)
{
GdkTexture *texture;
GError *error = NULL;
texture = g_task_propagate_pointer (G_TASK (result), &error);
if (!texture)
{
g_print ("%s\n", error->message);
g_error_free (error);
return;
}
if (!window)
{
g_object_unref (texture);
return;
}
unset_wait_cursor (GTK_WIDGET (data));
g_object_set (G_OBJECT (data), "texture", texture, NULL);
}
static void
open_file_async (GFile *file,
GtkWidget *demo)
{
GTask *task;
set_wait_cursor (demo);
task = g_task_new (demo, cancellable, texture_loaded, demo);
g_task_set_task_data (task, g_object_ref (file), g_object_unref);
g_task_run_in_thread (task, load_texture);
g_object_unref (task);
}
static void
open_portland_rose (GtkWidget *button,
GtkWidget *demo)
{
GFile *file;
file = g_file_new_for_uri ("resource:///transparent/portland-rose.jpg");
open_file_async (file, demo);
g_object_unref (file);
}
static void
open_large_image (GtkWidget *button,
GtkWidget *demo)
{
GFile *file;
file = g_file_new_for_uri ("resource:///org/gtk/Demo4/large-image.png");
open_file_async (file, demo);
g_object_unref (file);
}
static void
file_opened (GObject *source,
GAsyncResult *result,
@@ -118,6 +21,7 @@ file_opened (GObject *source,
{
GFile *file;
GError *error = NULL;
GdkTexture *texture;
file = gtk_file_dialog_open_finish (GTK_FILE_DIALOG (source), result, &error);
@@ -128,9 +32,17 @@ file_opened (GObject *source,
return;
}
open_file_async (file, data);
texture = gdk_texture_new_from_file (file, &error);
g_object_unref (file);
if (!texture)
{
g_print ("%s\n", error->message);
g_error_free (error);
return;
}
g_object_set (G_OBJECT (data), "texture", texture, NULL);
g_object_unref (texture);
}
static void
@@ -204,26 +116,11 @@ transform_from (GBinding *binding,
return TRUE;
}
static void
free_cancellable (gpointer data)
{
g_cancellable_cancel (cancellable);
g_clear_object (&cancellable);
}
static gboolean
cancel_load (GtkWidget *widget,
GVariant *args,
gpointer data)
{
unset_wait_cursor (widget);
g_cancellable_cancel (G_CANCELLABLE (data));
return TRUE;
}
GtkWidget *
do_image_scaling (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
if (!window)
{
GtkWidget *box;
@@ -233,7 +130,6 @@ do_image_scaling (GtkWidget *do_widget)
GtkWidget *scale;
GtkWidget *dropdown;
GtkWidget *button;
GtkEventController *controller;
window = gtk_window_new ();
gtk_window_set_title (GTK_WINDOW (window), "Image Scaling");
@@ -242,20 +138,6 @@ do_image_scaling (GtkWidget *do_widget)
gtk_widget_get_display (do_widget));
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
cancellable = g_cancellable_new ();
g_object_set_data_full (G_OBJECT (window), "cancellable",
cancellable, free_cancellable);
controller = gtk_shortcut_controller_new ();
gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller),
gtk_shortcut_new (
gtk_keyval_trigger_new (GDK_KEY_Escape, 0),
gtk_callback_action_new (cancel_load, cancellable, NULL)
));
gtk_shortcut_controller_set_scope (GTK_SHORTCUT_CONTROLLER (controller),
GTK_SHORTCUT_SCOPE_GLOBAL);
gtk_widget_add_controller (window, controller);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_window_set_child (GTK_WINDOW (window), box);
@@ -274,22 +156,6 @@ do_image_scaling (GtkWidget *do_widget)
g_signal_connect (button, "clicked", G_CALLBACK (open_file), widget);
gtk_box_append (GTK_BOX (box2), button);
button = gtk_button_new ();
gtk_button_set_child (GTK_BUTTON (button),
gtk_image_new_from_resource ("/org/gtk/Demo4/portland-rose-thumbnail.png"));
gtk_widget_add_css_class (button, "image-button");
gtk_widget_set_tooltip_text (button, "Portland Rose");
g_signal_connect (button, "clicked", G_CALLBACK (open_portland_rose), widget);
gtk_box_append (GTK_BOX (box2), button);
button = gtk_button_new ();
gtk_button_set_child (GTK_BUTTON (button),
gtk_image_new_from_resource ("/org/gtk/Demo4/large-image-thumbnail.png"));
gtk_widget_add_css_class (button, "image-button");
gtk_widget_set_tooltip_text (button, "Large image");
g_signal_connect (button, "clicked", G_CALLBACK (open_large_image), widget);
gtk_box_append (GTK_BOX (box2), button);
button = gtk_button_new_from_icon_name ("object-rotate-right-symbolic");
gtk_widget_set_tooltip_text (button, "Rotate");
g_signal_connect (button, "clicked", G_CALLBACK (rotate), widget);
@@ -325,9 +191,7 @@ do_image_scaling (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_set_visible (window, TRUE);
else
{
gtk_window_destroy (GTK_WINDOW (window));
}
gtk_window_destroy (GTK_WINDOW (window));
return window;
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 622 KiB

-2
View File
@@ -1068,8 +1068,6 @@ command_line (GApplication *app,
window = gtk_application_get_windows (GTK_APPLICATION (app))->data;
gtk_window_set_icon_name (GTK_WINDOW (window), "org.gtk.Demo4");
if (name == NULL)
goto out;
+1 -2
View File
@@ -225,8 +225,7 @@ print_ready (GObject *source,
if (!g_output_stream_close (stream, NULL, &error))
{
if (!g_error_matches (error, GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_DISMISSED))
g_print ("Error from close: %s\n", error->message);
g_print ("Error from close: %s\n", error->message);
g_error_free (error);
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

-2
View File
@@ -139,8 +139,6 @@ icon_browser_app_activate (GApplication *app)
if (g_strcmp0 (PROFILE, "devel") == 0)
gtk_widget_add_css_class (GTK_WIDGET (win), "devel");
gtk_window_set_icon_name (GTK_WINDOW (win), "org.gtk.IconBrowser4");
gtk_window_present (GTK_WINDOW (win));
}
@@ -219,8 +219,6 @@ node_editor_application_activate (GApplication *app)
if (g_strcmp0 (PROFILE, "devel") == 0)
gtk_widget_add_css_class (GTK_WIDGET (win), "devel");
gtk_window_set_icon_name (GTK_WINDOW (win), "org.gtk.gtk4.NodeEditor");
gtk_window_present (GTK_WINDOW (win));
}
-58
View File
@@ -1205,19 +1205,6 @@ node_editor_window_add_renderer (NodeEditorWindow *self,
g_object_unref (paintable);
}
static void
update_paste_action (GdkClipboard *clipboard,
GParamSpec *pspec,
gpointer data)
{
GtkWidget *widget = GTK_WIDGET (data);
gboolean has_node;
has_node = gdk_content_formats_contain_mime_type (gdk_clipboard_get_formats (clipboard), "application/x-gtk-render-node");
gtk_widget_action_set_enabled (widget, "paste-node", has_node);
}
static void
node_editor_window_realize (GtkWidget *widget)
{
@@ -1255,7 +1242,6 @@ node_editor_window_realize (GtkWidget *widget)
self->after_paint_handler = g_signal_connect (frameclock, "after-paint",
G_CALLBACK (after_paint), self);
g_signal_connect (gtk_widget_get_clipboard (widget), "notify::formats", G_CALLBACK (update_paste_action), widget);
}
static void
@@ -1265,8 +1251,6 @@ node_editor_window_unrealize (GtkWidget *widget)
GdkFrameClock *frameclock;
guint i;
g_signal_handlers_disconnect_by_func (gtk_widget_get_clipboard (widget), update_paste_action, widget);
frameclock = gtk_widget_get_frame_clock (widget);
g_signal_handler_disconnect (frameclock, self->after_paint_handler);
self->after_paint_handler = 0;
@@ -1631,41 +1615,6 @@ edit_action_cb (GtkWidget *widget,
node_editor_window_edit (self, &start);
}
static void
text_received (GObject *source,
GAsyncResult *result,
gpointer data)
{
GdkClipboard *clipboard = GDK_CLIPBOARD (source);
NodeEditorWindow *self = NODE_EDITOR_WINDOW (data);
char *text;
text = gdk_clipboard_read_text_finish (clipboard, result, NULL);
if (text)
{
GtkTextBuffer *buffer;
GtkTextIter start, end;
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self->text_view));
gtk_text_buffer_begin_user_action (buffer);
gtk_text_buffer_get_bounds (buffer, &start, &end);
gtk_text_buffer_delete (buffer, &start, &end);
gtk_text_buffer_insert (buffer, &start, text, -1);
gtk_text_buffer_end_user_action (buffer);
g_free (text);
}
}
static void
paste_node_cb (GtkWidget *widget,
const char *action_name,
GVariant *parameter)
{
GdkClipboard *clipboard = gtk_widget_get_clipboard (widget);
gdk_clipboard_read_text_async (clipboard, NULL, text_received, widget);
}
static void
node_editor_window_set_property (GObject *object,
guint prop_id,
@@ -1778,13 +1727,6 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
action = gtk_named_action_new ("smart-edit");
shortcut = gtk_shortcut_new (trigger, action);
gtk_widget_class_add_shortcut (widget_class, shortcut);
gtk_widget_class_install_action (widget_class, "paste-node", NULL, paste_node_cb);
trigger = gtk_keyval_trigger_new (GDK_KEY_v, GDK_CONTROL_MASK | GDK_SHIFT_MASK);
action = gtk_named_action_new ("paste-node");
shortcut = gtk_shortcut_new (trigger, action);
gtk_widget_class_add_shortcut (widget_class, shortcut);
}
static GtkWidget *
-4
View File
@@ -22,10 +22,6 @@
</menu>
<menu id="extra_menu">
<section>
<item>
<attribute name="label" translatable="yes">Paste _Node</attribute>
<attribute name="action">paste-node</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Assisted _Edit</attribute>
<attribute name="action">smart-edit</attribute>
+1 -1
View File
@@ -798,7 +798,7 @@ activate (GApplication *app)
if (g_strcmp0 (PROFILE, "devel") == 0)
gtk_widget_add_css_class (GTK_WIDGET (main_window), "devel");
gtk_window_set_icon_name (GTK_WINDOW (main_window), "org.gtk.PrintEditor4");
gtk_window_set_icon_name (GTK_WINDOW (main_window), "text-editor");
gtk_window_set_default_size (GTK_WINDOW (main_window), 400, 600);
gtk_application_window_set_show_menubar (GTK_APPLICATION_WINDOW (main_window), TRUE);
update_title (GTK_WINDOW (main_window));
-1
View File
@@ -2241,7 +2241,6 @@ activate (GApplication *app)
if (g_strcmp0 (PROFILE, "devel") == 0)
gtk_widget_add_css_class (GTK_WIDGET (window), "devel");
gtk_window_set_icon_name (window, "org.gtk.WidgetFactory4");
gtk_application_add_window (GTK_APPLICATION (app), window);
g_action_map_add_action_entries (G_ACTION_MAP (window),
win_entries, G_N_ELEMENTS (win_entries),
+1 -1
View File
@@ -38,7 +38,7 @@ if get_option('documentation')
gdk_gir[0],
],
depends: gdk_gir[0],
suite: ['docs', 'failing'],
suite: ['docs'],
)
if x11_enabled
+3 -7
View File
@@ -1,16 +1,12 @@
Title: The Broadway windowing system
Slug: broadway
## Using GTK with Broadway
The GDK Broadway backend provides support for displaying GTK applications in
a web browser, using HTML5 and web sockets.
Broadway was written as an experiment and is not the most actively developed
backend. It supports the features that were required of GDK backends in GTK 4.0,
but may not be up-to-date with the latest developments.
## Using GTK with Broadway
To run your application under Broadway, first run the broadway server,
To run your application in this way, first run the broadway server,
`gtk-broadwayd`, that ships with GTK:
```
+1 -1
View File
@@ -260,4 +260,4 @@ name = "StyleProvider"
hidden = true
[check]
ignore_deprecated = true
skip_deprecated = true
+1 -1
View File
@@ -74,7 +74,7 @@ if get_option('documentation')
gtk_gir[0],
],
depends: gtk_gir[0],
suite: ['docs', 'failing'],
suite: ['docs'],
)
endif
+38 -38
View File
@@ -24,36 +24,36 @@ the motivation and goals of larger API changes.
## Cell renderers are going away
Cell renderers were introduced in GTK 2 to support rendering of
big data UIs, in particular treeviews. Over the years, more
data-like widgets have started to use them, and cell renderers
"big data" UIs, in particular treeviews. Over the years, more
"data-like" widgets have started to use them, and cell renderers
have grown into a shadowy, alternative rendering infrastructure
that duplicates much of what widgets do, while duplicating the
code and adding their own dose of bugs.
In GTK 4, replacement widgets for `GtkTreeView`, `GtkIconView` and
`GtkComboBox` have appeared: [class@Gtk.ListView], [class@Gtk.ColumnView], [class@Gtk.GridView]
and [class@Gtk.DropDown]. For GTK 5, we will take the next step and remove
In GTK 4, replacement widgets for GtkTreeView, GtkIconView and
GtkComboBox have appeared: GtkListView, GtkColumnView, GtkGridView
and GtkDropDown. For GTK 5, we will take the next step and remove
all cell renderer-based widgets.
## Themed rendering APIs are going away
The old GTK 2 era rendering APIs for theme components like
`gtk_render_frame()` or `gtk_render_check()` have not been used by
gtk_render_frame() or gtk_render_check() have not been used by
GTK itself even in later GTK 3, but they have been kept around
for the benefit of external drawing users applications that
for the benefit of "external drawing" users - applications that
want their controls to look like GTK without using widgets.
Supporting this is increasingly getting in the way of making
the GTK CSS machinery fast and correct. One notable problem is
that temporary style changes (using `gtk_style_context_save()`)
that temporary style changes (using gtk_style_context_save())
is breaking animations. Therefore, these APIs will be going away
in GTK 5, together with their more modern [class@Gtk.Snapshot] variants
like `gtk_snapshot_render_background()` or `gtk_snapshot_render_focus()`.
in GTK 5, together with their more modern GtkSnapshot variants
like gtk_snapshot_render_background() or gtk_snapshot_render_focus().
The best way to render parts of your widget using CSS styling
is to use subwidgets. For example, to show a piece of text with
fonts, effects and shadows according to the current CSS style,
use a [class@Gtk.Label].
use a GtkLabel.
If you have a need for custom drawing that fits into the current
(dark or light) theme, e.g. for rendering a graph, you can still
@@ -62,28 +62,28 @@ get the current style foreground color, using
## Local stylesheets are going away
The cascading part of GTKs CSS implementation is complicated by
The cascading part of GTK's CSS implementation is complicated by
the existence of local stylesheets (i.e. those added with
`gtk_style_context_add_provider()`). And local stylesheets are
gtk_style_context_add_provider()). And local stylesheets are
unintuitive in that they do not apply to the whole subtree of
widgets, but just to the one widget where the stylesheet was
added.
GTK 5 will no longer provide this functionality. The recommendation
is to use a global stylesheet (i.e. [func@Gtk.StyleContext.add_provider_for_display])
GTK 5 will no longer provide this functionality. The recommendations
is to use a global stylesheet (i.e. gtk_style_context_add_provider_for_display())
and rely on style classes to make your CSS apply only where desired.
## Non-standard CSS extensions are going away
GTKs CSS machinery has a some non-standard extensions around colors:
named colors with `@define-color` and color functions: `lighter()`, `darker()`,
`shade()`, `alpha()`, `mix()`.
GTK's CSS machinery has a some non-standard extensions around colors:
named colors with \@define-color and color functions: lighter(), darker(),
shade(), alpha(), mix().
GTK now implements equivalent functionality from the CSS specs.
### `@define-color` is going away
### \@define-color is going away
`@define-color` should be replaced by custom properties in the `:root` scope.
\@define-color should be replaced by custom properties in the :root scope.
Instead of
@@ -117,9 +117,9 @@ spec.
### Color expressions are going away
The color functions can all be replaced by combinations of `calc()` and `color-mix()`.
The color functions can all be replaced by combinations of calc() and color-mix().
`lighter(c)` and `darker(c)` are just `shade(c, 1.3)` or `shade(c, 0.7)`, respectively, and
ligher(c) and darker(c) are just shade(c, 1.3) or shade(c, 0.7), respectively, and
thus can be handled the same way as shade in the examples below.
Replace
@@ -164,7 +164,7 @@ d {
Variations of these replacements are possible.
Note that GTK has historically computed `mix()` and `shade()` values in the SRGB and HSL
Note that GTK has historically computed mix() and shade() values in the SRGB and HSL
colorspaces, but using OKLAB instead might yield slightly better results.
For more information about color-mix(), see the
@@ -172,32 +172,32 @@ For more information about color-mix(), see the
## Chooser interfaces are going away
The `GtkColorChooser`, `GtkFontChooser`, `GtkFileChooser` and `GtkAppChooser`
The GtkColorChooser, GtkFontChooser, GtkFileChooser and GtkAppChooser
interfaces and their implementations as dialogs, buttons and widgets
are phased out. The are being replaced by a new family of async APIs
that will be more convenient to use from language bindings, in particular
for languages that have concepts like promises. The new APIs are
[class@Gtk.ColorDialog], [class@Gtk.FontDialog] and [class@Gtk.FileDialog],
There are also equivalents for some of the button widgets:
There are also equivalents for some of the 'button' widgets:
[class@Gtk.ColorDialogButton], [class@Gtk.FontDialogButton].
## GtkMessageDialog is going away
Like the Chooser interfaces, `GtkMessageDialog` has been replaced by
Like the Chooser interfaces, GtkMessageDialog has been replaced by
a new async API that will be more convenient, in particular for
language binding. The new API is [class@Gtk.AlertDialog].
## GtkDialog is going away
After `gtk_dialog_run()` was removed, the usefulness of `GtkDialog`
is much reduced, and it has awkward, archaic APIs. Therefore,
After gtk_dialog_run() was removed, the usefulness of GtkDialog
is much reduced, and it has awkward, archaice APIs. Therefore,
it is dropped. The recommended replacement is to just create
your own window and add buttons as required, either in the header
or elsewhere.
## GtkInfoBar is going away
`GtkInfoBar` had a dialog API, and with dialogs going away, it was time to
GtkInfoBar had a dialog API, and with dialogs going away, it was time to
retire it. If you need such a widget, it is relatively trivial to create one
using a [class@Gtk.Revealer] with labels and buttons.
@@ -205,11 +205,11 @@ Other libraries, such as libadwaita, may provide replacements as well.
## gtk_show_uri is being replaced
Instead of `gtk_show_uri()`, you should use [class@Gtk.UriLauncher]or [class@Gtk.FileLauncher].
Instead of gtk_show_uri(), you should use GtkUriLauncher or GtkFileLauncher.
## GtkStatusbar is going away
This is an old fashioned widget that does not do all that much any more, since
This is an oldfashioned widget that does not do all that much anymore, since
it no longer has a resize handle for the window.
## GtkLockButton and GtkVolumeButton are going away
@@ -217,22 +217,22 @@ it no longer has a resize handle for the window.
These are very specialized widgets that should better live with the application
where they are used.
## Widget size API changes
## Widget size api changes
The functions `gtk_widget_get_allocated_width()` and `gtk_widget_get_allocated_height()`
The functions gtk_widget_get_allocated_width() and gtk_widget_get_allocated_height()
are going away. In most cases, [method@Gtk.Widget.get_width] and [method@Gtk.Widget.get_height]
are suitable replacements. Note that the semantics are slightly different though:
the old functions return the size of the CSS border area, while the new functions return
the size of the widgets content area. In places where this difference matters, you can
use `gtk_widget_compute_bounds (widget, widget, &bounds)` instead.
The function `gtk_widget_get_allocation()` is also going away. It does not have a direct
The function gtk_widget_get_allocation() is also going away. It does not have a direct
replacement, but the previously mentioned alternatives can be used for it too.
The function `gtk_widget_get_allocated_baseline()` has been renamed to [method@Gtk.Widget.get_baseline].
The function gtk_widget_get_allocated_baseline() has been renamed to [method@Gtk.Widget.get_baseline].
## Stop using GdkPixbuf
GTK is moving away from `GdkPixbuf` as the primary API for transporting image data, in favor
of [class@Gdk.Texture]. APIs that are accepting or returning `GdkPixbuf`s are being replaced by equivalent
APIs using `GdkTexture` or [iface@Gdk.Paintable] objects.
GTK is moving away from GdkPixbuf as the primary API for transporting image data, in favor
of GdkTexture. APIs that are accepting or returning GdkPixbufs are being replaced by equivalent
APIs using GdkTexture or GdkPaintable objects.
+15 -61
View File
@@ -6,7 +6,7 @@ The format is a text format that follows the [CSS syntax rules](https://drafts.c
The grammar of a node text representation using [the CSS value definition syntax](https://drafts.csswg.org/css-values-3/#value-defs) looks like this:
document: <@-rule>*<node>
document: <@-rule>*<node>*
@-rule: @cicp "name" { <property>* }
node: container [ "name" ] { <document> } | <node-type> [ "name" ] { <property>* } | "name"
property: <property-name>: <node> | <value> ;
@@ -49,16 +49,12 @@ The following properties can be set for custom color states:
| primaries | `<integer>` | 2 | always |
| transfer | `<integer>` | 2 | always |
| matrix | `<integer>` | 2 | always |
| range | `<range>` | full | non-default |
| range | `narrow | full` | full | non-default |
Note that the primaries, transfer and matrix properties always need
to be specified, since GTK does not allow creating color state objects
with these being set to 2 (== unspecified).
Range can have the following values:
range: narrow | full
# Colors
Colors can be specified with a variation of the modern CSS color syntax:
@@ -70,16 +66,6 @@ The traditional syntax for sRGB colors still works as well:
rgba(<number>, <number>, <number>, <number)
rgb(<number, <number>, <number>)
# Rectangles
Rectangles can be specified just as four integers for x, y, width and height:
rect: <number> <number> <number> <number>
Rounded rectangles use a CSS-like syntax:
rounded-rect: <rect> [ "/" <number>{1,4} [ "/" <number>{1,4} ] ]
# Nodes
### container
@@ -96,13 +82,6 @@ The **container** node is a special node that allows specifying a list of child
Creates a node like `gsk_blend_node_new()` with the given properties.
Possible values for the mode property are:
blend-mode: normal | multiply | screen | overlay | darken |
lighten | color-dodge | color-burn | hard-light |
soft-light | difference | exclusion | color |
hue | saturation | luminosity
### blur
| property | syntax | default | printed |
@@ -222,10 +201,6 @@ Creates a node like `gsk_fill_node_new()` with the given properties.
The default child node is the default color node, but created with the
bounds of the path.
Possible values for the fill-rule property are:
fill-rule: winding | even-odd
### glshader
| property | syntax | default | printed |
@@ -277,10 +252,6 @@ Creates a node like `gsk_linear_gradient_node_new()` with the given properties.
Creates a node like `gsk_mask_node_new()` with the given properties.
Possible values for the mode property are:
mask-mode: alpha | inverted-alpha | luminance | inverted-luminance
### opacity
| property | syntax | default | printed |
@@ -319,11 +290,11 @@ Creates a node like `gsk_radial_gradient_node_new()` with the given properties.
### repeat
| property | syntax | default | printed |
| ------------ | ---------- | ---------------------- | ----------- |
| bounds | `<rect>` | *bounds of child node* | non-default |
| child | `<node>` | color { } | always |
| child-bounds | `<rect>` | *bounds of child node* | non-default |
| property | syntax | default | printed |
| ----------- | ---------------- | ---------------------- | ----------- |
| bounds | `<rect>` | *bounds of child node* | non-default |
| child | `<node>` | color { } | always |
| child-bounds| `<rect>` | *bounds of child node* | non-default |
Creates a node like `gsk_repeat_node_new()` with the given properties.
@@ -390,14 +361,6 @@ Creates a node like `gsk_stroke_node_new()` with the given properties.
The default child node is the default color node, but created with the
stroke bounds of the path.
Possible values for the line-cap property are:
line-cap: butt | round | square
Possible values for the line-join property are:
line-join: miter | round | bevel
### text
| property | syntax | default | printed |
@@ -406,9 +369,9 @@ Possible values for the line-join property are:
| font | `<string>` `<url>`? | "Cantarell 15px" | always |
| glyphs | `<glyphs>` | "Hello" | always |
| offset | `<point>` | 0 0 | non-default |
| hint-style | `<hint-style>` | slight | non-default |
| hint-style | `<hint style>` | slight | non-default |
| antialias | `<antialias>` | gray | non-default |
| hint-metrics | `<hint-metrics>` | off | non-default |
| hint-metrics | `<hint metrics>` | off | non-default |
Creates a node like `gsk_text_node_new()` with the given properties.
@@ -423,17 +386,9 @@ be specified as well, like this: 40 10 0 0 color.
If the given font does not exist or the given glyphs are invalid for the given
font, an error node will be returned.
Possible values for the hint-style property are:
hint-style: none | slight | full
Possible value for the antialias property are:
antialias: none | gray
Possible value for hint-metrics are:
hint-metrics: on | off
Possible values for hint-style are none, slight or full.
Possible value for antialias are none or gray.
Possible value for hint-metrics are on or off.
### texture
@@ -459,15 +414,14 @@ representation for this texture is `url("data:image/png;base64,iVBORw0KGgoAAAANS
| -------- | ---------------- | ---------------------- | ----------- |
| bounds | `<rect>` | 50 | always |
| texture | `<url>` | *see below* | always |
| filter | `filter` | linear | non-default |
| filter | `filter` | *see below* | non-default |
Creates a node like `gsk_texture_scale_node_new()` with the given properties.
The default texture is a 10x10 checkerboard, just like for texture.
Possible values for the filter property are:
filter: linear | nearest | trilinear
The possible filter values are `linear`, `nearest` and `trilinear`, with
`linear` being the default.
### transform
+40 -65
View File
@@ -19,7 +19,8 @@ be used for end-user configuration and customization.
### `GTK_DEBUG`
This variable can be set to a list of debug options, which cause GTK to
print out different types of debugging information.
print out different types of debugging information. Some of these options
are only available when GTK has been configured with `-Ddebug=true`.
`actions`
: Actions and menu models
@@ -64,7 +65,7 @@ print out different types of debugging information.
: Layout managers
`accessibility`
: Accessibility state changes
: Accessibility state changs
A number of keys are influencing behavior instead of just logging:
@@ -168,7 +169,8 @@ The `loaders.cache` file is generated by the
### `GDK_DEBUG`
This variable can be set to a list of debug options, which cause GDK to
print out different types of debugging information.
print out different types of debugging information. Some of these options
are only available when GTK has been configured with `-Ddebug=true`.
`misc`
: Miscellaneous information
@@ -221,15 +223,36 @@ A number of options affect behavior instead of logging:
: Force graphics offload for all textures, even when slower. This allows
to debug offloading in the absence of dmabufs.
`gl-disable`
: Disable OpenGL support
`gl-no-fractional`
: Disable fractional scaling for OpenGL.
`gl-debug`
: Insert debugging information in OpenGL
`gl-disable-gl`
: Don't allow the use of OpenGL GL API. This forces GLES to be used
`gl-disable-gles`
: Don't allow the use of OpenGL GLES API. This forces GL to be used
`gl-prefer-gl`
: Prefer OpenGL over OpenGL ES. This was the default behavior before GTK 4.14.
`gl-egl`
: Use an EGL context on X11 or Windows
`gl-glx`
: Use GLX on X11
`gl-wgl`
: Use WGL on Windows
`vulkan-disable`
: Disable Vulkan support
`vulkan-validate`
: Load the Vulkan validation layer, if available
@@ -239,26 +262,27 @@ A number of options affect behavior instead of logging:
`high-depth`
: Use high bit depth rendering if possible
`linear`
: Enable linear rendering
`hdr`
: Force HDR rendering
`no-vsync`
: Repaint instantly (uses 100% CPU with animations)
`dmabuf-disable`
: Disable dmabuf support
The special value `all` can be used to turn on all debug options. The special
value `help` can be used to obtain a list of all supported debug options.
### `GSK_DEBUG`
This variable can be set to a list of debug options, which cause GSK to
print out different types of debugging information.
print out different types of debugging information. Some of these options
are only available when GTK has been configured with `-Ddebug=true`.
`renderer`
: General renderer information
`opengl`
: OpenGL renderer information
`vulkan`
: Check Vulkan errors
@@ -285,12 +309,12 @@ A number of options affect behavior instead of logging:
`staging`
: Use a staging image for texture upload (Vulkan only)
`offload-disable`
: Disable graphics offload to subsurfaces
`cairo`
: Overlay error pattern over cairo drawing (finds fallbacks)
`occlusion`
: Overlay highlight over areas optimized via occlusion culling
The special value `all` can be used to turn on all debug options. The special
value `help` can be used to obtain a list of all supported debug options.
@@ -323,41 +347,6 @@ a `*`, which means: try all remaining backends. The special value
backends. For more information about selecting backends,
see the [func@Gdk.DisplayManager.get] function.
### `GDK_DISABLE`
This variable can be set to a list of values, which cause GDK to
disable certain features.
`gl`
: Disable OpenGL support
`gl-api`
: Don't allow the use of OpenGL GL API. This forces GLES to be used
`gles-api`
: Don't allow the use of OpenGL GLES API. This forces GL to be used
`egl`
: Don't allow the use of an EGL context
`glx`
: Don't allow the use of GLX
`wgl`
: Don't allow the use of WGL
`vulkan`
: Disable Vulkan support
`dmabuf`
: Disable dmabuf support
`offload`
: Disable graphics offload to subsurfaces
`color-mgmt`
: Disable color management
### `GDK_GL_DISABLE`
This variable can be set to a list of values, which cause GDK to
@@ -472,12 +461,12 @@ using and the GDK backend supports them:
This variable can be set to a list of values, which cause GSK to
disable certain optimizations of the "ngl" and "vulkan" renderer.
`uber`
: Don't use the uber shader
`clear`
: Use shaders instead of vkCmdClearAttachment()/glClear()
`merge`
: USe one vkCmdDraw()/glDrawArrays() per operation
`blit`
: Use shaders instead of vkCmdBlit()/glBlitFramebuffer()
@@ -487,13 +476,6 @@ disable certain optimizations of the "ngl" and "vulkan" renderer.
`mipmap`
: Avoid creating mipmaps
`to-image`
: Don't fast-path creation of images for nodes
`occlusion`
: Disable occlusion culling via opacity tracking
The special value `all` can be used to turn on all values. The special
value `help` can be used to obtain a list of all supported values.
@@ -581,12 +563,6 @@ To enable the GTK inspector, you can use the <kbd>Control</kbd>+<kbd>Shift</kbd>
<kbd>Control</kbd>+<kbd>Shift</kbd>+<kbd>D</kbd> keyboard shortcuts, or
set the `GTK_DEBUG=interactive` environment variable.
After opening the inspector, it listens for a few keyboard shortcuts that
let you use its frame and event recording functionality without moving the
focus away from the application window: <kbd>Super</kbd>+<kbd>R</kbd> turns
the recording on and off, and <kbd>Super</kbd>+<kbd>C</kbd> records a single
frame.
There are a few more environment variables that can be set to influence
how the inspector renders its UI. `GTK_INSPECTOR_DISPLAY` and
`GTK_INSPECTOR_RENDERER` determine the GDK display and the GSK
@@ -597,7 +573,6 @@ the GTK inspector. The keyboard shortcuts can be disabled with the
`enable-inspector-keybinding` key in the `org.gtk.Settings.Debug`
GSettings schema.
## Profiling
GTK supports profiling with sysprof. It exports timing information
+2 -2
View File
@@ -171,7 +171,7 @@ Each relation name is part of the `GtkAccessibleRelation` enumeration.
| %GTK_ACCESSIBLE_RELATION_CONTROLS | “aria-controls” | a list of `GtkAccessible` |
| %GTK_ACCESSIBLE_RELATION_DESCRIBED_BY | “aria-describedby” | a list of `GtkAccessible` |
| %GTK_ACCESSIBLE_RELATION_DETAILS | “aria-details” | a list of `GtkAccessible` |
| %GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE | “aria-errormessage” | a list of `GtkAccessible` |
| %GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE | “aria-errormessage” | `GtkAccessible` |
| %GTK_ACCESSIBLE_RELATION_FLOW_TO | “aria-flowto” | a list of `GtkAccessible` |
| %GTK_ACCESSIBLE_RELATION_LABELLED_BY | “aria-labelledby” | a list of `GtkAccessible` |
| %GTK_ACCESSIBLE_RELATION_OWNS | “aria-owns” | a list of `GtkAccessible` |
@@ -300,7 +300,7 @@ The attributes can also enhance the UI:
```c
gtk_button_set_label (GTK_BUTTON (button), "Download");
gtk_box_append (GTK_BOX (box), button);
gtk_box_append (GTK_BOX (button), button);
gtk_label_set_text (GTK_LABEL (label), "Final report.pdf");
gtk_box_append (GTK_BOX (box), label);
-1
View File
@@ -9,7 +9,6 @@ documentation in the form of man pages.
- [gtk4-demo-application](gtk4-demo-application.html)
- [gtk4-encode-symbolic-svg](gtk4-encode-symbolic-svg.html)
- [gtk4-icon-browser](gtk4-icon-browser.html)
- [gtk4-image-tool](gtk4-image-tool.html)
- [gtk4-launch](gtk4-launch.html)
- [gtk4-node-editor](gtk4-node-editor.html)
- [gtk4-path-tool](gtk4-path-tool.html)
+52 -178
View File
@@ -49,135 +49,6 @@
G_DEFINE_TYPE (GdkBroadwaySurface, gdk_broadway_surface, GDK_TYPE_SURFACE)
static void
gdk_broadway_surface_toplevel_resize (GdkSurface *surface,
int width,
int height);
static void
gdk_broadway_surface_set_geometry_hints (GdkSurface *surface,
const GdkGeometry *geometry,
GdkSurfaceHints geom_mask);
static void
gdk_broadway_surface_move_resize_internal (GdkSurface *surface,
gboolean with_move,
int x,
int y,
int width,
int height);
static void
compute_toplevel_size (GdkSurface *surface,
gboolean resizible,
int *width,
int *height)
{
GdkBroadwaySurface *impl = GDK_BROADWAY_SURFACE (surface);
GdkDisplay *display = gdk_surface_get_display (surface);
GdkMonitor *monitor;
GdkToplevelSize size;
int bounds_width, bounds_height;
GdkGeometry geometry;
GdkSurfaceHints mask;
monitor = gdk_display_get_monitor_at_surface (display, surface);
if (monitor)
{
GdkRectangle monitor_geometry;
gdk_monitor_get_geometry (monitor, &monitor_geometry);
bounds_width = monitor_geometry.width;
bounds_height = monitor_geometry.height;
}
else
{
bounds_width = G_MAXINT;
bounds_height = G_MAXINT;
}
gdk_toplevel_size_init (&size, bounds_width, bounds_height);
gdk_toplevel_notify_compute_size (GDK_TOPLEVEL (surface), &size);
g_warn_if_fail (size.width > 0);
g_warn_if_fail (size.height > 0);
*width = size.width;
*height = size.height;
impl->resizible = (impl->resizible && resizible);
if (impl->resizible)
{
geometry.min_width = size.min_width;
geometry.min_height = size.min_height;
mask = GDK_HINT_MIN_SIZE;
}
else
{
geometry.max_width = geometry.min_width = size.width;
geometry.max_height = geometry.min_height = size.height;
mask = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE;
}
gdk_broadway_surface_set_geometry_hints (surface, &geometry, mask);
if (!(surface->state & (GDK_TOPLEVEL_STATE_FULLSCREEN |
GDK_TOPLEVEL_STATE_MAXIMIZED |
GDK_TOPLEVEL_STATE_TILED |
GDK_TOPLEVEL_STATE_TOP_TILED |
GDK_TOPLEVEL_STATE_RIGHT_TILED |
GDK_TOPLEVEL_STATE_BOTTOM_TILED |
GDK_TOPLEVEL_STATE_LEFT_TILED |
GDK_TOPLEVEL_STATE_MINIMIZED)))
{
gdk_surface_constrain_size (&geometry, mask,
size.width, size.height,
&size.width, &size.height);
if (impl->last_computed_width != size.width ||
impl->last_computed_height != size.height)
{
*width = size.width;
*height = size.height;
impl->last_computed_width = size.width;
impl->last_computed_height = size.height;
gdk_broadway_surface_toplevel_resize (surface, *width, *height);
}
}
if (size.shadow.is_valid)
{
impl->shadow_left = size.shadow.left;
impl->shadow_right = size.shadow.right;
impl->shadow_top = size.shadow.top;
impl->shadow_bottom = size.shadow.bottom;
}
}
static gboolean
compute_size_idle (gpointer user_data)
{
GdkSurface *surface = user_data;
GdkBroadwaySurface *impl = GDK_BROADWAY_SURFACE (surface);
int width, height;
impl->compute_size_source_id = 0;
compute_toplevel_size (surface, TRUE, &width, &height);
return G_SOURCE_REMOVE;
}
static void
on_frame_clock_after_update (GdkFrameClock *clock,
GdkSurface *surface)
{
GdkBroadwaySurface *impl = GDK_BROADWAY_SURFACE (surface);
if (impl->compute_size_source_id)
{
g_clear_handle_id (&impl->compute_size_source_id, g_source_remove);
compute_size_idle (surface);
}
}
/* We need to flush in an idle rather than AFTER_PAINT, as the clock
is frozen during e.g. surface resizes so the paint will not happen
and the surface resize request is never flushed. */
@@ -241,8 +112,6 @@ connect_frame_clock (GdkSurface *surface)
g_signal_connect (frame_clock, "before-paint",
G_CALLBACK (on_frame_clock_before_paint), surface);
g_signal_connect_after (frame_clock, "update",
G_CALLBACK (on_frame_clock_after_update), surface);
g_signal_connect (frame_clock, "after-paint",
G_CALLBACK (on_frame_clock_after_paint), surface);
}
@@ -254,8 +123,6 @@ disconnect_frame_clock (GdkSurface *surface)
g_signal_handlers_disconnect_by_func (frame_clock,
on_frame_clock_before_paint, surface);
g_signal_handlers_disconnect_by_func (frame_clock,
on_frame_clock_after_update, surface);
g_signal_handlers_disconnect_by_func (frame_clock,
on_frame_clock_after_paint, surface);
}
@@ -270,7 +137,6 @@ gdk_broadway_surface_constructed (GObject *object)
if (!surface->parent)
broadway_display->toplevels = g_list_prepend (broadway_display->toplevels, self);
self->resizible = TRUE;
self->id = _gdk_broadway_server_new_surface (broadway_display->server,
self->root_x,
self->root_y,
@@ -450,7 +316,6 @@ gdk_broadway_surface_hide (GdkSurface *surface)
_gdk_broadway_surface_grab_check_unmap (surface,
_gdk_broadway_server_get_next_serial (broadway_display->server));
g_clear_handle_id (&impl->compute_size_source_id, g_source_remove);
if (_gdk_broadway_server_surface_hide (broadway_display->server, impl->id))
queue_flush (surface);
@@ -1144,8 +1009,6 @@ _gdk_broadway_moveresize_configure_done (GdkDisplay *display,
BroadwayInputMsg *tmp_event;
MoveResizeData *mv_resize = get_move_resize_data (display, FALSE);
gdk_surface_request_layout (surface);
if (!mv_resize || surface != mv_resize->moveresize_surface)
return FALSE;
@@ -1305,43 +1168,6 @@ gdk_broadway_surface_beep (GdkSurface *surface)
return FALSE;
}
static void
gdk_broadway_surface_request_layout (GdkSurface *surface)
{
GdkBroadwaySurface *impl = GDK_BROADWAY_SURFACE (surface);
if (!impl->compute_size_source_id &&
GDK_IS_TOPLEVEL (surface))
{
impl->compute_size_source_id = g_idle_add_full (G_PRIORITY_HIGH - 10,
compute_size_idle,
surface,
NULL);
}
}
static gboolean
gdk_broadway_surface_compute_size (GdkSurface *surface)
{
int width, height;
if (GDK_IS_TOPLEVEL (surface))
{
compute_toplevel_size (surface, TRUE, &width, &height);
}
else
{
width = gdk_surface_get_width(surface);
height = gdk_surface_get_height(surface);
gdk_broadway_surface_move_resize_internal (surface, FALSE,
0, 0,
width,
height);
}
return FALSE;
}
static void
gdk_broadway_surface_class_init (GdkBroadwaySurfaceClass *klass)
{
@@ -1361,8 +1187,6 @@ gdk_broadway_surface_class_init (GdkBroadwaySurfaceClass *klass)
impl_class->destroy_notify = gdk_broadway_surface_destroy_notify;
impl_class->drag_begin = _gdk_broadway_surface_drag_begin;
impl_class->get_scale = gdk_broadway_surface_get_scale;
impl_class->request_layout = gdk_broadway_surface_request_layout;
impl_class->compute_size = gdk_broadway_surface_compute_size;
}
#define LAST_PROP 1
@@ -1680,12 +1504,55 @@ gdk_broadway_toplevel_present (GdkToplevel *toplevel,
GdkToplevelLayout *layout)
{
GdkSurface *surface = GDK_SURFACE (toplevel);
GdkBroadwaySurface *impl = GDK_BROADWAY_SURFACE (surface);
GdkDisplay *display = gdk_surface_get_display (surface);
GdkMonitor *monitor;
GdkToplevelSize size;
int bounds_width, bounds_height;
int width, height;
GdkGeometry geometry;
GdkSurfaceHints mask;
gboolean maximize;
gdk_broadway_surface_unminimize (surface);
compute_toplevel_size (surface, gdk_toplevel_layout_get_resizable (layout), &width, &height);
monitor = gdk_display_get_monitor_at_surface (display, surface);
if (monitor)
{
GdkRectangle monitor_geometry;
gdk_monitor_get_geometry (monitor, &monitor_geometry);
bounds_width = monitor_geometry.width;
bounds_height = monitor_geometry.height;
}
else
{
bounds_width = G_MAXINT;
bounds_height = G_MAXINT;
}
gdk_toplevel_size_init (&size, bounds_width, bounds_height);
gdk_toplevel_notify_compute_size (toplevel, &size);
g_warn_if_fail (size.width > 0);
g_warn_if_fail (size.height > 0);
width = size.width;
height = size.height;
if (gdk_toplevel_layout_get_resizable (layout))
{
geometry.min_width = size.min_width;
geometry.min_height = size.min_height;
mask = GDK_HINT_MIN_SIZE;
}
else
{
geometry.max_width = geometry.min_width = width;
geometry.max_height = geometry.min_height = height;
mask = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE;
}
gdk_broadway_surface_set_geometry_hints (surface, &geometry, mask);
gdk_surface_constrain_size (&geometry, mask, width, height, &width, &height);
gdk_broadway_surface_toplevel_resize (surface, width, height);
if (gdk_toplevel_layout_get_maximized (layout, &maximize))
{
@@ -1695,7 +1562,14 @@ gdk_broadway_toplevel_present (GdkToplevel *toplevel,
gdk_broadway_surface_unmaximize (surface);
}
gdk_surface_request_layout (surface);
if (size.shadow.is_valid)
{
impl->shadow_left = size.shadow.left;
impl->shadow_right = size.shadow.right;
impl->shadow_top = size.shadow.top;
impl->shadow_bottom = size.shadow.bottom;
}
show_surface (surface);
}
-7
View File
@@ -76,13 +76,6 @@ struct _GdkBroadwaySurface
int shadow_right;
int shadow_top;
int shadow_bottom;
int last_computed_width;
int last_computed_height;
guint compute_size_source_id;
gboolean resizible;
};
struct _GdkBroadwaySurfaceClass
+17 -37
View File
@@ -133,35 +133,22 @@ static const GdkDebugKey gdk_debug_keys[] = {
{ "portals", GDK_DEBUG_PORTALS, "Force use of portals" },
{ "no-portals", GDK_DEBUG_NO_PORTALS, "Disable use of portals" },
{ "force-offload", GDK_DEBUG_FORCE_OFFLOAD, "Force graphics offload for all textures" },
{ "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support" },
{ "gl-no-fractional", GDK_DEBUG_GL_NO_FRACTIONAL, "Disable fractional scaling for OpenGL" },
{ "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL" },
{ "gl-disable-gl", GDK_DEBUG_GL_DISABLE_GL, "Only allow OpenGL GLES API" },
{ "gl-disable-gles", GDK_DEBUG_GL_DISABLE_GLES, "Don't allow OpenGL GLES API" },
{ "gl-prefer-gl", GDK_DEBUG_GL_PREFER_GL, "Prefer GL over GLES API" },
{ "gl-egl", GDK_DEBUG_GL_EGL, "Use EGL on X11 or Windows" },
{ "gl-glx", GDK_DEBUG_GL_GLX, "Use GLX on X11" },
{ "gl-wgl", GDK_DEBUG_GL_WGL, "Use WGL on Windows" },
{ "vulkan-disable", GDK_DEBUG_VULKAN_DISABLE, "Disable Vulkan support" },
{ "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings" },
{ "high-depth", GDK_DEBUG_HIGH_DEPTH, "Use high bit depth rendering if possible" },
{ "no-vsync", GDK_DEBUG_NO_VSYNC, "Repaint instantly (uses 100% CPU with animations)" },
{ "dmabuf-disable", GDK_DEBUG_DMABUF_DISABLE, "Disable dmabuf support" },
};
static const GdkDebugKey gdk_feature_keys[] = {
{ "gl", GDK_FEATURE_OPENGL, "Disable OpenGL support" },
{ "gl-api", GDK_FEATURE_GL_API, "Disable non-GLES GL API" },
{ "gles-api", GDK_FEATURE_GLES_API, "Disable GLES GL API" },
{ "egl", GDK_FEATURE_EGL, "Disable EGL" },
{ "glx", GDK_FEATURE_GLX, "Disable GLX" },
{ "wgl", GDK_FEATURE_WGL, "Disable WGL" },
{ "vulkan", GDK_FEATURE_VULKAN, "Disable Vulkan support" },
{ "dmabuf", GDK_FEATURE_DMABUF, "Disable dmabuf support" },
{ "offload", GDK_FEATURE_OFFLOAD, "Disable graphics offload" },
{ "color-mgmt", GDK_FEATURE_COLOR_MANAGEMENT, "Disable color management" },
};
static GdkFeatures gdk_features;
gboolean
gdk_has_feature (GdkFeatures features)
{
return (features & gdk_features) == features;
}
#ifdef G_HAS_CONSTRUCTORS
#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
@@ -229,7 +216,6 @@ gdk_ensure_resources (void)
guint
gdk_parse_debug_var (const char *variable,
const char *docs,
const GdkDebugKey *keys,
guint nkeys)
{
@@ -290,7 +276,6 @@ gdk_parse_debug_var (const char *variable,
max_width = MAX (max_width, strlen (keys[i].key));
max_width += 4;
fprintf (stderr, "%s\n", docs);
fprintf (stderr, "Supported %s values:\n", variable);
for (i = 0; i < nkeys; i++) {
fprintf (stderr, " %s%*s%s\n", keys[i].key, (int)(max_width - strlen (keys[i].key)), " ", keys[i].help);
@@ -318,26 +303,21 @@ gdk_parse_debug_var (const char *variable,
void
gdk_pre_parse (void)
{
GdkFeatures disabled_features;
gdk_initialized = TRUE;
gdk_ensure_resources ();
_gdk_debug_flags = gdk_parse_debug_var ("GDK_DEBUG",
"GDK_DEBUG can be set to values that make GDK print out different\n"
"types of debugging information or change the behavior of GDK for\n"
"debugging purposes.\n",
gdk_debug_keys,
G_N_ELEMENTS (gdk_debug_keys));
gdk_debug_keys,
G_N_ELEMENTS (gdk_debug_keys));
disabled_features = gdk_parse_debug_var ("GDK_DISABLE",
"GDK_DISABLE can be set to values which cause GDK to disable\n"
"certain features.\n",
gdk_feature_keys,
G_N_ELEMENTS (gdk_feature_keys));
gdk_features = GDK_ALL_FEATURES & ~disabled_features;
/* These are global */
if (_gdk_debug_flags & GDK_DEBUG_GL_EGL)
gdk_gl_backend_use (GDK_GL_EGL);
else if (_gdk_debug_flags & GDK_DEBUG_GL_GLX)
gdk_gl_backend_use (GDK_GL_GLX);
else if (_gdk_debug_flags & GDK_DEBUG_GL_WGL)
gdk_gl_backend_use (GDK_GL_WGL);
#ifndef G_HAS_CONSTRUCTORS
stash_and_unset_environment ();
-2
View File
@@ -82,10 +82,8 @@ gdk_cairo_context_cairo_create (GdkCairoContext *self)
draw_context = GDK_DRAW_CONTEXT (self);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (!gdk_draw_context_is_in_frame (draw_context))
return NULL;
G_GNUC_END_IGNORE_DEPRECATIONS
cr = GDK_CAIRO_CONTEXT_GET_CLASS (self)->cairo_create (self);
+1 -1
View File
@@ -58,7 +58,7 @@ void gdk_cicp_params_set_matrix_coefficients (GdkCicpParams *self,
/**
* GdkCicpRange:
* @GDK_CICP_RANGE_NARROW: The values use the range of 16-235 (for Y) and 16-240 for u and v.
* @GDK_CICP_RANGE_FULL: The values use the full range.
* @GDK_CICO_RANGE_FULL: The values use the full range.
*
* The values of this enumeration describe whether image data uses
* the full range of 8-bit values.
+14
View File
@@ -229,6 +229,20 @@ gdk_color_from_rgba (GdkColor *self,
gdk_color_finish (&tmp);
}
/*< private >
* gdk_color_get_depth:
* @self: a `GdkColor`
*
* Returns the preferred depth for the color state of @self.
*
* Returns: the preferred depth
*/
GdkMemoryDepth
(gdk_color_get_depth) (const GdkColor *self)
{
return gdk_color_state_get_depth (self->color_state);
}
/*< private >
* gdk_color_print:
* @self: the `GdkColor` to print
+21 -29
View File
@@ -20,17 +20,11 @@
* and tests, and must not include other headers.
*/
static inline int
sign (float v)
{
return v < 0 ? -1 : 1;
}
static inline float
srgb_oetf (float v)
{
if (fabsf (v) > 0.0031308f)
return sign (v) * (1.055f * powf (fabsf (v), 1.f / 2.4f) - 0.055f);
if (v > 0.0031308f)
return 1.055f * powf (v, 1.f / 2.4f) - 0.055f;
else
return 12.92f * v;
}
@@ -38,8 +32,8 @@ srgb_oetf (float v)
static inline float
srgb_eotf (float v)
{
if (fabsf (v) >= 0.04045f)
return sign (v) * powf (((fabsf (v) + 0.055f) / (1.f + 0.055f)), 2.4f);
if (v >= 0.04045f)
return powf (((v + 0.055f) / (1.f + 0.055f)), 2.4f);
else
return v / 12.92f;
}
@@ -47,25 +41,25 @@ srgb_eotf (float v)
static inline float
gamma22_oetf (float v)
{
return sign (v) * powf (fabsf (v), 1.f / 2.2f);
return powf (v, 1.f / 2.2f);
}
static inline float
gamma22_eotf (float v)
{
return sign (v) * powf (fabsf (v), 2.2f);
return powf (v, 2.2f);
}
static inline float
gamma28_oetf (float v)
{
return sign (v) * powf (fabsf (v), 1.f / 2.8f);
return powf (v, 1.f / 2.8f);
}
static inline float
gamma28_eotf (float v)
{
return sign (v) * powf (fabsf (v), 2.8f);
return powf (v, 2.8f);
}
static inline float
@@ -77,10 +71,9 @@ pq_eotf (float v)
float c2 = 2413.0 / (1 << 7);
float c3 = 2392.0 / (1 << 7);
float x = powf (fabsf (v), minv);
x = powf (MAX ((x - c1), 0) / (c2 - (c3 * x)), ninv);
float x = powf (MAX ((powf (v, minv) - c1), 0) / (c2 - (c3 * (powf (v, minv)))), ninv);
return sign (v) * x * 10000 / 203.0;
return x * 10000 / 203.0;
}
static inline float
@@ -93,8 +86,7 @@ pq_oetf (float v)
float c2 = 2413.0 / (1 << 7);
float c3 = 2392.0 / (1 << 7);
x = powf (fabsf (x), n);
return sign (v) * powf (((c1 + (c2 * x)) / (1 + (c3 * x))), m);
return powf (((c1 + (c2 * powf (x, n))) / (1 + (c3 * powf (x, n)))), m);
}
static inline float
@@ -103,10 +95,10 @@ bt709_eotf (float v)
const float a = 1.099;
const float d = 0.0812;
if (fabsf (v) < d)
if (v < d)
return v / 4.5f;
else
return sign (v) * powf ((fabsf (v) + (a - 1)) / a, 1 / 0.45f);
return powf ((v + (a - 1)) / a, 1 / 0.45f);
}
static inline float
@@ -115,10 +107,10 @@ bt709_oetf (float v)
const float a = 1.099;
const float b = 0.018;
if (fabsf (v) < b)
if (v < b)
return v * 4.5f;
else
return sign (v) * (a * powf (fabsf (v), 0.45f) - (a - 1));
return a * powf (v, 0.45f) - (a - 1);
}
static inline float
@@ -128,10 +120,10 @@ hlg_eotf (float v)
const float b = 0.28466892;
const float c = 0.55991073;
if (fabsf (v) <= 0.5)
return sign (v) * (v * v) / 3;
if (v <= 0.5)
return (v * v) / 3;
else
return sign (v) * (expf ((fabsf (v) - c) / a) + b) / 12.0;
return (expf ((v - c) / a) + b) / 12.0;
}
static inline float
@@ -141,10 +133,10 @@ hlg_oetf (float v)
const float b = 0.28466892;
const float c = 0.55991073;
if (fabsf (v) <= 1/12.0)
return sign (v) * sqrtf (3 * fabsf (v));
if (v <= 1/12.0)
return sqrtf (3 * v);
else
return sign (v) * (a * logf (12 * fabsf (v) - b) + c);
return a * logf (12 * v - b) + c;
}
/* See http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
+8 -4
View File
@@ -116,10 +116,7 @@ _gdk_color_to_float (const GdkColor *self,
{
if (gdk_color_state_equal (self->color_state, color_state))
{
values[0] = self->values[0];
values[1] = self->values[1];
values[2] = self->values[2];
values[3] = self->values[3];
memcpy (values, self->values, sizeof (float) * 4);
return;
}
@@ -129,3 +126,10 @@ _gdk_color_to_float (const GdkColor *self,
values);
}
#define gdk_color_get_depth(self) _gdk_color_get_depth ((self))
static inline GdkMemoryDepth
_gdk_color_get_depth (const GdkColor *self)
{
return gdk_color_state_get_depth (self->color_state);
}
+1
View File
@@ -83,6 +83,7 @@ gboolean gdk_color_equal (const GdkColor *color1,
const GdkColor *color2);
gboolean gdk_color_is_clear (const GdkColor *self);
gboolean gdk_color_is_opaque (const GdkColor *self);
GdkMemoryDepth gdk_color_get_depth (const GdkColor *self);
void gdk_color_convert (GdkColor *self,
GdkColorState *color_state,
+27 -114
View File
@@ -38,9 +38,9 @@
* Crucially, GTK knows how to convert colors from one color
* state to another.
*
* `GdkColorState` objects are immutable and therefore threadsafe.
* `GdkColorState objects are immutable and therefore threadsafe.
*
* Since: 4.16
* Since 4.16
*/
G_DEFINE_BOXED_TYPE (GdkColorState, gdk_color_state,
@@ -331,68 +331,6 @@ gdk_default_color_state_get_cicp (GdkColorState *color_state)
return &self->cicp;
}
static gboolean
gdk_color_state_check_inf_nan (const float src[4],
float dest[4])
{
if (isnan (src[0]) ||
isnan (src[1]) ||
isnan (src[2]) ||
isnan (src[3]))
{
dest = (float[4]) { 1.0, 0.0, 0.8, 1.0 };
return TRUE;
}
if (isinf (src[0]) ||
isinf (src[1]) ||
isinf (src[2]) ||
isinf (src[3]))
{
dest = (float[4]) { 0.0, 0.8, 1.0, 1.0 };
return TRUE;
}
return FALSE;
}
static void
gdk_color_state_clamp_0_1 (GdkColorState *self,
const float src[4],
float dest[4])
{
if (gdk_color_state_check_inf_nan (src, dest))
return;
dest[0] = CLAMP (src[0], 0.0f, 1.0f);
dest[1] = CLAMP (src[1], 0.0f, 1.0f);
dest[2] = CLAMP (src[2], 0.0f, 1.0f);
dest[3] = CLAMP (src[3], 0.0f, 1.0f);
}
static void
gdk_color_state_clamp_unbounded (GdkColorState *self,
const float src[4],
float dest[4])
{
if (gdk_color_state_check_inf_nan (src, dest))
return;
dest[0] = src[0];
dest[1] = src[1];
dest[2] = src[2];
dest[3] = CLAMP (src[3], 0.0f, 1.0f);
}
static void
gdk_default_color_state_clamp (GdkColorState *color_state,
const float in[4],
float out[4])
{
GdkDefaultColorState *self = (GdkDefaultColorState *) color_state;
self->clamp (color_state, in, out);
}
/* }}} */
static const
@@ -404,7 +342,6 @@ GdkColorStateClass GDK_DEFAULT_COLOR_STATE_CLASS = {
.get_convert_to = gdk_default_color_state_get_convert_to,
.get_convert_from = gdk_default_color_state_get_convert_from,
.get_cicp = gdk_default_color_state_get_cicp,
.clamp = gdk_default_color_state_clamp,
};
GdkDefaultColorState gdk_default_color_states[] = {
@@ -413,8 +350,7 @@ GdkDefaultColorState gdk_default_color_states[] = {
.klass = &GDK_DEFAULT_COLOR_STATE_CLASS,
.ref_count = 0,
.depth = GDK_MEMORY_U8_SRGB,
.rendering_color_state = GDK_COLOR_STATE_SRGB,
.rendering_color_state_linear = GDK_COLOR_STATE_SRGB_LINEAR,
.rendering_color_state = GDK_COLOR_STATE_SRGB_LINEAR,
},
.name = "srgb",
.no_srgb = GDK_COLOR_STATE_SRGB_LINEAR,
@@ -423,7 +359,6 @@ GdkDefaultColorState gdk_default_color_states[] = {
[GDK_COLOR_STATE_ID_REC2100_PQ] = gdk_default_srgb_to_rec2100_pq,
[GDK_COLOR_STATE_ID_REC2100_LINEAR] = gdk_default_srgb_to_rec2100_linear,
},
.clamp = gdk_color_state_clamp_0_1,
.cicp = { 1, 13, 0, 1 },
},
[GDK_COLOR_STATE_ID_SRGB_LINEAR] = {
@@ -432,7 +367,6 @@ GdkDefaultColorState gdk_default_color_states[] = {
.ref_count = 0,
.depth = GDK_MEMORY_U8,
.rendering_color_state = GDK_COLOR_STATE_SRGB_LINEAR,
.rendering_color_state_linear = GDK_COLOR_STATE_SRGB_LINEAR,
},
.name = "srgb-linear",
.no_srgb = NULL,
@@ -441,7 +375,6 @@ GdkDefaultColorState gdk_default_color_states[] = {
[GDK_COLOR_STATE_ID_REC2100_PQ] = gdk_default_srgb_linear_to_rec2100_pq,
[GDK_COLOR_STATE_ID_REC2100_LINEAR] = gdk_default_srgb_linear_to_rec2100_linear,
},
.clamp = gdk_color_state_clamp_0_1,
.cicp = { 1, 8, 0, 1 },
},
[GDK_COLOR_STATE_ID_REC2100_PQ] = {
@@ -449,8 +382,7 @@ GdkDefaultColorState gdk_default_color_states[] = {
.klass = &GDK_DEFAULT_COLOR_STATE_CLASS,
.ref_count = 0,
.depth = GDK_MEMORY_FLOAT16,
.rendering_color_state = GDK_COLOR_STATE_REC2100_PQ,
.rendering_color_state_linear = GDK_COLOR_STATE_REC2100_LINEAR,
.rendering_color_state = GDK_COLOR_STATE_REC2100_LINEAR,
},
.name = "rec2100-pq",
.no_srgb = NULL,
@@ -459,7 +391,6 @@ GdkDefaultColorState gdk_default_color_states[] = {
[GDK_COLOR_STATE_ID_SRGB_LINEAR] = gdk_default_rec2100_pq_to_srgb_linear,
[GDK_COLOR_STATE_ID_REC2100_LINEAR] = gdk_default_rec2100_pq_to_rec2100_linear,
},
.clamp = gdk_color_state_clamp_0_1,
.cicp = { 9, 16, 0, 1 },
},
[GDK_COLOR_STATE_ID_REC2100_LINEAR] = {
@@ -468,7 +399,6 @@ GdkDefaultColorState gdk_default_color_states[] = {
.ref_count = 0,
.depth = GDK_MEMORY_FLOAT16,
.rendering_color_state = GDK_COLOR_STATE_REC2100_LINEAR,
.rendering_color_state_linear = GDK_COLOR_STATE_REC2100_LINEAR,
},
.name = "rec2100-linear",
.no_srgb = NULL,
@@ -477,7 +407,6 @@ GdkDefaultColorState gdk_default_color_states[] = {
[GDK_COLOR_STATE_ID_SRGB_LINEAR] = gdk_default_rec2100_linear_to_srgb_linear,
[GDK_COLOR_STATE_ID_REC2100_PQ] = gdk_default_rec2100_linear_to_rec2100_pq,
},
.clamp = gdk_color_state_clamp_unbounded,
.cicp = { 9, 8, 0, 1 },
},
};
@@ -492,15 +421,15 @@ struct _GdkCicpColorState
GdkColorState *no_srgb;
char *name;
const char *name;
GdkTransferFunc eotf;
GdkTransferFunc oetf;
float to_srgb[9];
float to_rec2020[9];
float from_srgb[9];
float from_rec2020[9];
float *to_srgb;
float *to_rec2020;
float *from_srgb;
float *from_rec2020;
GdkCicp cicp;
};
@@ -520,6 +449,7 @@ TRANSFORM(gdk_cicp_from_rec2100_linear, NONE, cicp->from_rec2020, cicp->o
#undef cicp
/* }}} */
/* }}} */
/* {{{ Vfuncs */
@@ -528,11 +458,14 @@ gdk_cicp_color_state_free (GdkColorState *cs)
{
GdkCicpColorState *self = (GdkCicpColorState *) cs;
g_free (self->name);
if (self->no_srgb)
gdk_color_state_unref (self->no_srgb);
g_free (self->to_srgb);
g_free (self->to_rec2020);
g_free (self->from_srgb);
g_free (self->from_rec2020);
g_free (self);
}
@@ -622,7 +555,7 @@ gdk_cicp_color_state_get_cicp (GdkColorState *color_state)
return &self->cicp;
}
/* }}} */
/* }}} */
static const
GdkColorStateClass GDK_CICP_COLOR_STATE_CLASS = {
@@ -633,7 +566,6 @@ GdkColorStateClass GDK_CICP_COLOR_STATE_CLASS = {
.get_convert_to = gdk_cicp_color_state_get_convert_to,
.get_convert_from = gdk_cicp_color_state_get_convert_from,
.get_cicp = gdk_cicp_color_state_get_cicp,
.clamp = gdk_color_state_clamp_0_1,
};
static inline float *
@@ -762,8 +694,7 @@ gdk_color_state_new_for_cicp (const GdkCicp *cicp,
self->parent.ref_count = 1;
/* sRGB is special-cased by being a default colorstate */
self->parent.rendering_color_state = GDK_COLOR_STATE_REC2100_PQ;
self->parent.rendering_color_state_linear = GDK_COLOR_STATE_REC2100_LINEAR;
self->parent.rendering_color_state = GDK_COLOR_STATE_REC2100_LINEAR;
self->parent.depth = GDK_MEMORY_FLOAT16;
@@ -772,10 +703,10 @@ gdk_color_state_new_for_cicp (const GdkCicp *cicp,
self->eotf = eotf;
self->oetf = oetf;
multiply (self->to_srgb, xyz_to_srgb, to_xyz);
multiply (self->to_rec2020, xyz_to_rec2020, to_xyz);
multiply (self->from_srgb, from_xyz, srgb_to_xyz);
multiply (self->from_rec2020, from_xyz, rec2020_to_xyz);
self->to_srgb = multiply (g_new (float, 9), xyz_to_srgb, to_xyz);
self->to_rec2020 = multiply (g_new (float, 9), xyz_to_rec2020, to_xyz);
self->from_srgb = multiply (g_new (float, 9), from_xyz, srgb_to_xyz);
self->from_rec2020 = multiply (g_new (float, 9), from_xyz, rec2020_to_xyz);
self->name = g_strdup_printf ("cicp-%u/%u/%u/%u",
cicp->color_primaries,
@@ -785,12 +716,12 @@ gdk_color_state_new_for_cicp (const GdkCicp *cicp,
if (cicp->transfer_function == 13)
{
self->no_srgb = gdk_color_state_new_for_cicp (&(GdkCicp) {
cicp->color_primaries,
8,
cicp->matrix_coefficients,
cicp->range },
NULL);
GdkCicp no_srgb;
memcpy (&no_srgb, cicp, sizeof (GdkCicp));
no_srgb.transfer_function = 8;
self->no_srgb = gdk_color_state_new_for_cicp (&no_srgb, NULL);
}
return (GdkColorState *) self;
@@ -838,24 +769,6 @@ gdk_color_state_get_no_srgb_tf (GdkColorState *self)
return self->klass->get_no_srgb_tf (self);
}
/*< private >
* gdk_color_state_clamp:
* @self: a `GdkColorState`
* @src: the values to clamp
* @dest: (out): location to store the result, may be identical to
* the src argument
*
* Clamps the values to be within the allowed ranges for the given
* color state.
*/
void
gdk_color_state_clamp (GdkColorState *self,
const float src[4],
float dest[4])
{
self->klass->clamp (self, src, dest);
}
/* }}} */
/* vim:set foldmethod=marker expandtab: */
+12 -18
View File
@@ -26,7 +26,6 @@ struct _GdkColorState
GdkMemoryDepth depth;
GdkColorState *rendering_color_state;
GdkColorState *rendering_color_state_linear;
};
/* Note: self may be the source or the target colorstate */
@@ -46,9 +45,6 @@ struct _GdkColorStateClass
GdkFloatColorConvert (* get_convert_from) (GdkColorState *self,
GdkColorState *source);
const GdkCicp * (* get_cicp) (GdkColorState *self);
void (* clamp) (GdkColorState *self,
const float src[4],
float dest[4]);
};
typedef struct _GdkDefaultColorState GdkDefaultColorState;
@@ -60,9 +56,6 @@ struct _GdkDefaultColorState
const char *name;
GdkColorState *no_srgb;
GdkFloatColorConvert convert_to[GDK_COLOR_STATE_N_IDS];
void (* clamp) (GdkColorState *self,
const float src[4],
float dest[4]);
GdkCicp cicp;
};
@@ -84,20 +77,23 @@ GdkColorState * gdk_color_state_get_no_srgb_tf (GdkColorState
GdkColorState * gdk_color_state_new_for_cicp (const GdkCicp *cicp,
GError **error);
void gdk_color_state_clamp (GdkColorState *self,
const float src[4],
float dest[4]);
static inline GdkColorState *
gdk_color_state_get_rendering_color_state (GdkColorState *self)
gdk_color_state_get_rendering_color_state (GdkColorState *self,
gboolean srgb)
{
if (srgb)
{
self = gdk_color_state_get_no_srgb_tf (self);
g_assert (self);
}
if (GDK_DEBUG_CHECK (HDR))
self = GDK_COLOR_STATE_REC2100_PQ;
if (!GDK_DEBUG_CHECK (LINEAR))
return self->rendering_color_state;
return self;
return self->rendering_color_state_linear;
return self->rendering_color_state;
}
static inline GdkMemoryDepth
@@ -187,10 +183,7 @@ gdk_color_state_convert_color (GdkColorState *src_cs,
GdkFloatColorConvert convert = NULL;
GdkFloatColorConvert convert2 = NULL;
dest[0] = src[0];
dest[1] = src[1];
dest[2] = src[2];
dest[3] = src[3];
memcpy (dest, src, sizeof (float) * 4);
if (gdk_color_state_equal (src_cs, dest_cs))
return;
@@ -224,3 +217,4 @@ gdk_color_state_from_rgba (GdkColorState *self,
self,
out_color);
}
+15 -25
View File
@@ -44,38 +44,29 @@ typedef enum {
GDK_DEBUG_HDR = 1 << 14,
GDK_DEBUG_PORTALS = 1 << 15,
GDK_DEBUG_NO_PORTALS = 1 << 16,
GDK_DEBUG_GL_NO_FRACTIONAL= 1 << 17,
GDK_DEBUG_FORCE_OFFLOAD = 1 << 18,
GDK_DEBUG_GL_PREFER_GL = 1 << 19,
GDK_DEBUG_GL_DEBUG = 1 << 20,
GDK_DEBUG_DEFAULT_SETTINGS= 1 << 21,
GDK_DEBUG_HIGH_DEPTH = 1 << 22,
GDK_DEBUG_NO_VSYNC = 1 << 23,
GDK_DEBUG_GL_DISABLE = 1 << 17,
GDK_DEBUG_GL_NO_FRACTIONAL= 1 << 18,
GDK_DEBUG_FORCE_OFFLOAD = 1 << 19,
GDK_DEBUG_GL_DISABLE_GL = 1 << 20,
GDK_DEBUG_GL_DISABLE_GLES = 1 << 21,
GDK_DEBUG_GL_PREFER_GL = 1 << 22,
GDK_DEBUG_GL_DEBUG = 1 << 23,
GDK_DEBUG_GL_EGL = 1 << 24,
GDK_DEBUG_GL_GLX = 1 << 25,
GDK_DEBUG_GL_WGL = 1 << 26,
GDK_DEBUG_VULKAN_DISABLE = 1 << 27,
GDK_DEBUG_DEFAULT_SETTINGS= 1 << 28,
GDK_DEBUG_HIGH_DEPTH = 1 << 29,
GDK_DEBUG_NO_VSYNC = 1 << 30,
GDK_DEBUG_DMABUF_DISABLE = 1 << 31,
} GdkDebugFlags;
typedef enum {
GDK_FEATURE_OPENGL = 1 << 0,
GDK_FEATURE_GL_API = 1 << 1,
GDK_FEATURE_GLES_API = 1 << 2,
GDK_FEATURE_EGL = 1 << 3,
GDK_FEATURE_GLX = 1 << 4,
GDK_FEATURE_WGL = 1 << 5,
GDK_FEATURE_VULKAN = 1 << 6,
GDK_FEATURE_DMABUF = 1 << 7,
GDK_FEATURE_OFFLOAD = 1 << 8,
GDK_FEATURE_COLOR_MANAGEMENT = 1 << 9,
} GdkFeatures;
#define GDK_ALL_FEATURES ((1 << 10) - 1)
extern guint _gdk_debug_flags;
GdkDebugFlags gdk_display_get_debug_flags (GdkDisplay *display);
void gdk_display_set_debug_flags (GdkDisplay *display,
GdkDebugFlags flags);
gboolean gdk_has_feature (GdkFeatures feature);
static inline void
gdk_debug_message (const char *format, ...) G_GNUC_PRINTF(1, 2);
static inline void
@@ -115,7 +106,6 @@ typedef struct
} GdkDebugKey;
guint gdk_parse_debug_var (const char *variable,
const char *docs,
const GdkDebugKey *keys,
guint nkeys);
+6 -6
View File
@@ -1309,10 +1309,10 @@ gdk_display_create_vulkan_context (GdkDisplay *self,
g_return_val_if_fail (surface == NULL || GDK_IS_SURFACE (surface), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
if (!gdk_has_feature (GDK_FEATURE_VULKAN))
if (gdk_display_get_debug_flags (self) & GDK_DEBUG_VULKAN_DISABLE)
{
g_set_error_literal (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE,
_("Vulkan support disabled via GDK_DISABLE"));
_("Vulkan support disabled via GDK_DEBUG"));
return NULL;
}
@@ -1362,11 +1362,11 @@ gdk_display_init_gl (GdkDisplay *self)
before = GDK_PROFILER_CURRENT_TIME;
if (!gdk_has_feature (GDK_FEATURE_OPENGL))
if (gdk_display_get_debug_flags (self) & GDK_DEBUG_GL_DISABLE)
{
g_set_error_literal (&priv->gl_error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
_("OpenGL support disabled via GDK_DISABLE"));
_("GL support disabled via GDK_DEBUG"));
return;
}
@@ -1477,7 +1477,7 @@ gdk_display_create_gl_context (GdkDisplay *self,
if (!gdk_display_prepare_gl (self, error))
return NULL;
return gdk_gl_context_new (self, NULL, FALSE);
return gdk_gl_context_new (self, NULL);
}
/*< private >
@@ -2006,7 +2006,7 @@ gdk_display_init_dmabuf (GdkDisplay *self)
builder = gdk_dmabuf_formats_builder_new ();
#ifdef HAVE_DMABUF
if (gdk_has_feature (GDK_FEATURE_DMABUF))
if (!GDK_DISPLAY_DEBUG_CHECK (self, DMABUF_DISABLE))
{
#ifdef GDK_RENDERING_VULKAN
gdk_display_add_dmabuf_downloader (self, gdk_vulkan_get_dmabuf_downloader (self, builder));
+1 -1
View File
@@ -71,7 +71,7 @@ download_memcpy (guchar *dst_data,
bpp = gdk_memory_format_bytes_per_pixel (dst_format);
src_stride = dmabuf->planes[0].stride;
src_data = src_datas[0] + dmabuf->planes[0].offset;
g_return_if_fail (sizes[0] >= dmabuf->planes[0].offset + gdk_memory_format_min_buffer_size (dst_format, src_stride, width, height));
g_return_if_fail (sizes[0] >= dmabuf->planes[0].offset + gdk_memory_format_min_buffer_size (dst_format, dst_stride, width, height));
if (dst_stride == src_stride)
memcpy (dst_data, src_data, (height - 1) * dst_stride + width * bpp);
-4
View File
@@ -5,10 +5,6 @@
#include <drm_fourcc.h>
#endif
#ifndef DRM_FORMAT_MOD_INVALID
#define DRM_FORMAT_MOD_INVALID ((1ULL << 56) - 1)
#endif
#ifndef fourcc_code
#define fourcc_code(a, b, c, d) ((__u32)(a) | ((__u32)(b) << 8) | \
((__u32)(c) << 16) | ((__u32)(d) << 24))
+2 -2
View File
@@ -1063,11 +1063,11 @@ gdk_dmabuf_texture_builder_build (GdkDmabufTextureBuilder *self,
for (i = 0; i < self->dmabuf.n_planes; i++)
g_return_val_if_fail (self->dmabuf.planes[i].fd != -1, NULL);
if (!gdk_has_feature (GDK_FEATURE_DMABUF))
if (GDK_DISPLAY_DEBUG_CHECK (self->display, DMABUF_DISABLE))
{
g_set_error_literal (error,
GDK_DMABUF_ERROR, GDK_DMABUF_ERROR_NOT_AVAILABLE,
"dmabuf support disabled via GDK_DISABLE environment variable");
"dmabuf support disabled via GDK_DEBUG environment variable");
return NULL;
}
+15 -47
View File
@@ -223,9 +223,6 @@ gdk_draw_context_init (GdkDrawContext *self)
*
* Returns: %TRUE if the context is between [method@Gdk.DrawContext.begin_frame]
* and [method@Gdk.DrawContext.end_frame] calls.
*
* Deprecated: 4.16: Drawing directly to the surface is no longer recommended.
* Use `GskRenderNode` and `GskRenderer`.
*/
gboolean
gdk_draw_context_is_in_frame (GdkDrawContext *context)
@@ -316,9 +313,6 @@ gdk_draw_context_get_surface (GdkDrawContext *context)
* gdk_draw_context_begin_frame() and gdk_draw_context_end_frame() via the
* use of [GskRenderer](../gsk4/class.Renderer.html)s, so application code
* does not need to call these functions explicitly.
*
* Deprecated: 4.16: Drawing directly to the surface is no longer recommended.
* Use `GskRenderNode` and `GskRenderer`.
*/
void
gdk_draw_context_begin_frame (GdkDrawContext *context,
@@ -330,12 +324,11 @@ gdk_draw_context_begin_frame (GdkDrawContext *context,
g_return_if_fail (priv->surface != NULL);
g_return_if_fail (region != NULL);
gdk_draw_context_begin_frame_full (context, GDK_MEMORY_U8, region, NULL);
gdk_draw_context_begin_frame_full (context, GDK_MEMORY_U8, region);
}
/*
* @depth: best depth to render in
* @opaque: (nullable): opaque region of the rendering
*
* If the given depth is not `GDK_MEMORY_U8`, GDK will see about providing a
* rendering target that supports a higher bit depth than 8 bits per channel.
@@ -358,10 +351,9 @@ gdk_draw_context_begin_frame (GdkDrawContext *context,
* to choose.
*/
void
gdk_draw_context_begin_frame_full (GdkDrawContext *context,
GdkMemoryDepth depth,
const cairo_region_t *region,
const graphene_rect_t *opaque)
gdk_draw_context_begin_frame_full (GdkDrawContext *context,
GdkMemoryDepth depth,
const cairo_region_t *region)
{
GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context);
@@ -386,23 +378,19 @@ gdk_draw_context_begin_frame_full (GdkDrawContext *context,
return;
}
gdk_surface_set_opaque_rect (priv->surface, opaque);
if (gdk_display_get_debug_flags (priv->display) & GDK_DEBUG_HIGH_DEPTH)
depth = GDK_MEMORY_FLOAT32;
priv->frame_region = cairo_region_copy (region);
priv->surface->paint_context = g_object_ref (context);
g_assert (priv->color_state == NULL);
GDK_DRAW_CONTEXT_GET_CLASS (context)->begin_frame (context,
depth,
priv->frame_region,
&priv->color_state,
&priv->depth);
/* The callback is meant to set them. Note that it does not return a ref */
/* the callback is meant to set them */
g_assert (priv->color_state != NULL);
g_assert (priv->depth < GDK_N_DEPTHS);
@@ -432,21 +420,6 @@ region_get_pixels (cairo_region_t *region)
}
#endif
void
gdk_draw_context_end_frame_full (GdkDrawContext *context)
{
GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context);
GDK_DRAW_CONTEXT_GET_CLASS (context)->end_frame (context, priv->frame_region);
gdk_profiler_set_int_counter (pixels_counter, region_get_pixels (priv->frame_region));
priv->color_state = NULL;
g_clear_pointer (&priv->frame_region, cairo_region_destroy);
g_clear_object (&priv->surface->paint_context);
priv->depth = GDK_N_DEPTHS;
}
/**
* gdk_draw_context_end_frame:
* @context: a `GdkDrawContext`
@@ -459,9 +432,6 @@ gdk_draw_context_end_frame_full (GdkDrawContext *context)
* When using a [class@Gdk.GLContext], this function may call `glFlush()`
* implicitly before returning; it is not recommended to call `glFlush()`
* explicitly before calling this function.
*
* Deprecated: 4.16: Drawing directly to the surface is no longer recommended.
* Use `GskRenderNode` and `GskRenderer`.
*/
void
gdk_draw_context_end_frame (GdkDrawContext *context)
@@ -489,7 +459,14 @@ gdk_draw_context_end_frame (GdkDrawContext *context)
return;
}
gdk_draw_context_end_frame_full (context);
GDK_DRAW_CONTEXT_GET_CLASS (context)->end_frame (context, priv->frame_region);
gdk_profiler_set_int_counter (pixels_counter, region_get_pixels (priv->frame_region));
g_clear_pointer (&priv->color_state, gdk_color_state_unref);
g_clear_pointer (&priv->frame_region, cairo_region_destroy);
g_clear_object (&priv->surface->paint_context);
priv->depth = GDK_N_DEPTHS;
}
/**
@@ -506,24 +483,15 @@ gdk_draw_context_end_frame (GdkDrawContext *context)
* and [method@Gdk.DrawContext.end_frame], %NULL will be returned.
*
* Returns: (transfer none) (nullable): a Cairo region
*
* Deprecated: 4.16: Drawing directly to the surface is no longer recommended.
* Use `GskRenderNode` and `GskRenderer`.
*/
const cairo_region_t *
_gdk_draw_context_get_frame_region (GdkDrawContext *context)
gdk_draw_context_get_frame_region (GdkDrawContext *context)
{
GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context);
return priv->frame_region;
}
const cairo_region_t *
(gdk_draw_context_get_frame_region) (GdkDrawContext *context)
{
g_return_val_if_fail (GDK_IS_DRAW_CONTEXT (context), NULL);
return _gdk_draw_context_get_frame_region (context);
return priv->frame_region;
}
/*<private>
+4 -4
View File
@@ -40,15 +40,15 @@ GdkDisplay * gdk_draw_context_get_display (GdkDrawContext
GDK_AVAILABLE_IN_ALL
GdkSurface * gdk_draw_context_get_surface (GdkDrawContext *context);
GDK_DEPRECATED_IN_4_16
GDK_AVAILABLE_IN_ALL
void gdk_draw_context_begin_frame (GdkDrawContext *context,
const cairo_region_t *region);
GDK_DEPRECATED_IN_4_16
GDK_AVAILABLE_IN_ALL
void gdk_draw_context_end_frame (GdkDrawContext *context);
GDK_DEPRECATED_IN_4_16
GDK_AVAILABLE_IN_ALL
gboolean gdk_draw_context_is_in_frame (GdkDrawContext *context);
GDK_DEPRECATED_IN_4_16
GDK_AVAILABLE_IN_ALL
const cairo_region_t * gdk_draw_context_get_frame_region (GdkDrawContext *context);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrawContext, g_object_unref)
+1 -7
View File
@@ -25,8 +25,6 @@
#include "gdkcolorstateprivate.h"
#include "gdkmemoryformatprivate.h"
#include <graphene.h>
G_BEGIN_DECLS
#define GDK_DRAW_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DRAW_CONTEXT, GdkDrawContextClass))
@@ -59,14 +57,10 @@ void gdk_draw_context_surface_resized (GdkDrawContext
void gdk_draw_context_begin_frame_full (GdkDrawContext *context,
GdkMemoryDepth depth,
const cairo_region_t *region,
const graphene_rect_t *opaque);
void gdk_draw_context_end_frame_full (GdkDrawContext *context);
const cairo_region_t *region);
void gdk_draw_context_empty_frame (GdkDrawContext *context);
#define gdk_draw_context_get_frame_region(...) _gdk_draw_context_get_frame_region(__VA_ARGS__)
const cairo_region_t * _gdk_draw_context_get_frame_region (GdkDrawContext *self);
GdkColorState * gdk_draw_context_get_color_state (GdkDrawContext *self);
GdkMemoryDepth gdk_draw_context_get_depth (GdkDrawContext *self);
+1 -12
View File
@@ -978,13 +978,9 @@ gdk_event_get_axis (GdkEvent *event,
* according to platform conventions.
*
* The right mouse button typically triggers context menus.
* On macOS, Control+left mouse button also triggers.
*
* This function should always be used instead of simply checking for
*
* ```c
* event->button == GDK_BUTTON_SECONDARY
* ```
* event->button == %GDK_BUTTON_SECONDARY.
*
* Returns: %TRUE if the event should trigger a context menu.
*/
@@ -1002,13 +998,6 @@ gdk_event_triggers_context_menu (GdkEvent *event)
if (bevent->button == GDK_BUTTON_SECONDARY &&
! (bevent->state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK)))
return TRUE;
#ifdef __APPLE__
if (bevent->button == GDK_BUTTON_PRIMARY &&
(bevent->state & GDK_CONTROL_MASK) &&
! (bevent->state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK)))
return TRUE;
#endif
}
return FALSE;
+32 -78
View File
@@ -122,7 +122,6 @@ struct _GdkGLContextPrivate
GdkGLMemoryFlags memory_flags[GDK_MEMORY_N_FORMATS];
GdkGLFeatures features;
guint surface_attached : 1;
guint use_khr_debug : 1;
guint has_debug_output : 1;
guint extensions_checked : 1;
@@ -638,10 +637,7 @@ gdk_gl_context_real_begin_frame (GdkDrawContext *draw_context,
else
*out_depth = GDK_MEMORY_U8;
if (*out_depth == GDK_MEMORY_U8_SRGB)
*out_color_state = gdk_color_state_get_no_srgb_tf (color_state);
else
*out_color_state = color_state;
*out_color_state = color_state;
#else
*out_color_state = gdk_color_state_get_srgb ();
*out_depth = GDK_MEMORY_U8;
@@ -718,8 +714,8 @@ gdk_gl_context_real_end_frame (GdkDrawContext *draw_context,
cairo_region_get_rectangle (painted, i, &rect);
rects[j++] = (int) floor (rect.x * scale);
rects[j++] = (int) floor ((surface_height - rect.height - rect.y) * scale);
rects[j++] = (int) ceil ((rect.x + rect.width) * scale) - floor (rect.x * scale);
rects[j++] = (int) ceil ((surface_height - rect.y) * scale) - floor ((surface_height - rect.height - rect.y) * scale);
rects[j++] = (int) ceil (rect.width * scale);
rects[j++] = (int) ceil (rect.height * scale);
}
priv->eglSwapBuffersWithDamage (gdk_display_get_egl_display (display), egl_surface, rects, n_rects);
g_free (heap_rects);
@@ -830,28 +826,20 @@ gdk_gl_context_init (GdkGLContext *self)
/* Must have called gdk_display_prepare_gl() before */
GdkGLContext *
gdk_gl_context_new (GdkDisplay *display,
GdkSurface *surface,
gboolean surface_attached)
GdkSurface *surface)
{
GdkGLContextPrivate *priv;
GdkGLContext *shared, *result;
GdkGLContext *shared;
g_assert (surface == NULL || display == gdk_surface_get_display (surface));
g_assert (!surface_attached || surface != NULL);
/* assert gdk_display_prepare_gl() had been called */
shared = gdk_display_get_gl_context (display);
g_assert (shared);
result = g_object_new (G_OBJECT_TYPE (shared),
"display", display,
"surface", surface,
NULL);
priv = gdk_gl_context_get_instance_private (result);
priv->surface_attached = surface_attached;
return result;
return g_object_new (G_OBJECT_TYPE (shared),
"display", display,
"surface", surface,
NULL);
}
void
@@ -1328,28 +1316,31 @@ gdk_gl_context_is_api_allowed (GdkGLContext *self,
GError **error)
{
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self);
GdkDebugFlags flags;
GdkGLAPI allowed_apis;
allowed_apis = priv->allowed_apis;
if (!gdk_has_feature (GDK_FEATURE_GLES_API))
flags = gdk_display_get_debug_flags (gdk_gl_context_get_display (self));
if (flags & GDK_DEBUG_GL_DISABLE_GLES)
{
if (api == GDK_GL_API_GLES)
{
g_set_error_literal (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
_("OpenGL ES API disabled via GDK_DISABLE"));
_("OpenGL ES disabled via GDK_DEBUG"));
return FALSE;
}
allowed_apis &= ~GDK_GL_API_GLES;
}
if (!gdk_has_feature (GDK_FEATURE_GL_API))
if (flags & GDK_DEBUG_GL_DISABLE_GL)
{
if (api == GDK_GL_API_GL)
{
g_set_error_literal (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
_("OpenGL API disabled via GDK_DISABLE"));
_("OpenGL disabled via GDK_DEBUG"));
return FALSE;
}
@@ -1776,10 +1767,8 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
supported_features = gdk_gl_context_check_features (context);
disabled_features = gdk_parse_debug_var ("GDK_GL_DISABLE",
"GDK_GL_DISABLE can be set to values which cause GDK to disable\n"
"certain OpenGL extensions.\n",
gdk_gl_feature_keys,
G_N_ELEMENTS (gdk_gl_feature_keys));
gdk_gl_feature_keys,
G_N_ELEMENTS (gdk_gl_feature_keys));
priv->features = supported_features & ~disabled_features;
@@ -1833,22 +1822,12 @@ gdk_gl_context_check_is_current (GdkGLContext *context)
void
gdk_gl_context_make_current (GdkGLContext *context)
{
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
MaskedContext *current, *masked_context;
gboolean surfaceless;
g_return_if_fail (GDK_IS_GL_CONTEXT (context));
if (priv->surface_attached)
{
surfaceless = FALSE;
}
else
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
surfaceless = !gdk_draw_context_is_in_frame (GDK_DRAW_CONTEXT (context));
G_GNUC_END_IGNORE_DEPRECATIONS
}
surfaceless = !gdk_draw_context_is_in_frame (GDK_DRAW_CONTEXT (context));
masked_context = mask_context (context, surfaceless);
current = g_private_get (&thread_current_context);
@@ -2037,11 +2016,8 @@ gdk_gl_context_clear_current (void)
*
* Does a gdk_gl_context_clear_current() if the current context is attached
* to @surface, leaves the current context alone otherwise.
*
* Returns: (nullable) (transfer full): The context that was cleared, so that it can be
* re-made current later
**/
GdkGLContext *
void
gdk_gl_context_clear_current_if_surface (GdkSurface *surface)
{
MaskedContext *current;
@@ -2052,20 +2028,11 @@ gdk_gl_context_clear_current_if_surface (GdkSurface *surface)
GdkGLContext *context = unmask_context (current);
if (gdk_gl_context_get_surface (context) != surface)
return NULL;
g_object_ref (context);
return;
if (GDK_GL_CONTEXT_GET_CLASS (context)->clear_current (context))
{
g_private_replace (&thread_current_context, NULL);
return context;
}
g_object_unref (context);
g_private_replace (&thread_current_context, NULL);
}
return NULL;
}
/**
@@ -2165,30 +2132,17 @@ gboolean
gdk_gl_backend_can_be_used (GdkGLBackend backend_type,
GError **error)
{
if (the_gl_backend_type != GDK_GL_NONE &&
the_gl_backend_type != backend_type)
{
g_set_error (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
/* translators: This is about OpenGL backend names, like
* "Trying to use X11 GLX, but EGL is already in use"
*/
_("Trying to use %s, but %s is already in use"),
gl_backend_names[backend_type],
gl_backend_names[the_gl_backend_type]);
return FALSE;
}
if (the_gl_backend_type == GDK_GL_NONE ||
the_gl_backend_type == backend_type)
return TRUE;
if ((backend_type == GDK_GL_EGL && !gdk_has_feature (GDK_FEATURE_EGL)) ||
(backend_type == GDK_GL_GLX && !gdk_has_feature (GDK_FEATURE_GLX)) ||
(backend_type == GDK_GL_WGL && !gdk_has_feature (GDK_FEATURE_WGL)))
{
g_set_error (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
_("Trying to use %s, but it is disabled via GDK_DISABLE"),
gl_backend_names[backend_type]);
return FALSE;
}
return TRUE;
g_set_error (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
/* translators: This is about OpenGL backend names, like
* "Trying to use X11 GLX, but EGL is already in use" */
_("Trying to use %s, but %s is already in use"),
gl_backend_names[backend_type],
gl_backend_names[the_gl_backend_type]);
return FALSE;
}
/*<private>
+3 -4
View File
@@ -120,11 +120,10 @@ gboolean gdk_gl_backend_can_be_used (GdkGLBackend
GError **error);
void gdk_gl_backend_use (GdkGLBackend backend_type);
GdkGLContext * gdk_gl_context_clear_current_if_surface (GdkSurface *surface) G_GNUC_WARN_UNUSED_RESULT;
void gdk_gl_context_clear_current_if_surface (GdkSurface *surface);
GdkGLContext * gdk_gl_context_new (GdkDisplay *display,
GdkSurface *surface,
gboolean surface_attached);
GdkGLContext * gdk_gl_context_new (GdkDisplay *display,
GdkSurface *surface);
gboolean gdk_gl_context_is_api_allowed (GdkGLContext *self,
GdkGLAPI api,
+4 -1
View File
@@ -96,7 +96,8 @@ print OUT_GDKKEYSYMS<<EOF;
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#pragma once
#ifndef __GDK_KEYSYMS_H__
#define __GDK_KEYSYMS_H__
EOF
@@ -164,6 +165,8 @@ close IN_XF86KEYSYM;
print OUT_GDKKEYSYMS<<EOF;
#endif /* __GDK_KEYSYMS_H__ */
EOF
printf "We just finished converting keysymdef.h to gdkkeysyms.h\nThank you\n";
+1 -11
View File
@@ -297,11 +297,8 @@
#define GDK_KEY_dead_u 0xfe88
#define GDK_KEY_dead_U 0xfe89
#define GDK_KEY_dead_small_schwa 0xfe8a
#define GDK_KEY_dead_schwa 0xfe8a
#define GDK_KEY_dead_capital_schwa 0xfe8b
#define GDK_KEY_dead_SCHWA 0xfe8b
#define GDK_KEY_dead_greek 0xfe8c
#define GDK_KEY_dead_hamza 0xfe8d
#define GDK_KEY_First_Virtual_Screen 0xfed0
#define GDK_KEY_Prev_Virtual_Screen 0xfed1
#define GDK_KEY_Next_Virtual_Screen 0xfed2
@@ -493,7 +490,6 @@
#define GDK_KEY_copyright 0x0a9
#define GDK_KEY_ordfeminine 0x0aa
#define GDK_KEY_guillemotleft 0x0ab
#define GDK_KEY_guillemetleft 0x0ab
#define GDK_KEY_notsign 0x0ac
#define GDK_KEY_hyphen 0x0ad
#define GDK_KEY_registered 0x0ae
@@ -509,9 +505,7 @@
#define GDK_KEY_cedilla 0x0b8
#define GDK_KEY_onesuperior 0x0b9
#define GDK_KEY_masculine 0x0ba
#define GDK_KEY_ordmasculine 0x0ba
#define GDK_KEY_guillemotright 0x0bb
#define GDK_KEY_guillemetright 0x0bb
#define GDK_KEY_onequarter 0x0bc
#define GDK_KEY_onehalf 0x0bd
#define GDK_KEY_threequarters 0x0be
@@ -1749,11 +1743,6 @@
#define GDK_KEY_ohorn 0x10001a1
#define GDK_KEY_Uhorn 0x10001af
#define GDK_KEY_uhorn 0x10001b0
#define GDK_KEY_combining_tilde 0x1000303
#define GDK_KEY_combining_grave 0x1000300
#define GDK_KEY_combining_acute 0x1000301
#define GDK_KEY_combining_hook 0x1000309
#define GDK_KEY_combining_belowdot 0x1000323
#define GDK_KEY_EcuSign 0x10020a0
#define GDK_KEY_ColonSign 0x10020a1
#define GDK_KEY_CruzeiroSign 0x10020a2
@@ -2324,3 +2313,4 @@
#define GDK_KEY_Prev_VMode 0x1008fe23
#define GDK_KEY_LogWindowTree 0x1008fe24
#define GDK_KEY_LogGrabInfo 0x1008fe25
+176 -602
View File
File diff suppressed because it is too large Load Diff
-10
View File
@@ -110,16 +110,6 @@ void gdk_memory_convert_color_state (guchar
GdkColorState *dest_color_state,
gsize width,
gsize height);
void gdk_memory_mipmap (guchar *dest,
gsize dest_stride,
GdkMemoryFormat dest_format,
const guchar *src,
gsize src_stride,
GdkMemoryFormat src_format,
gsize src_width,
gsize src_height,
guint lod_level,
gboolean linear);
G_END_DECLS
+2 -4
View File
@@ -111,7 +111,7 @@ gdk_memory_sanitize (GBytes *bytes,
stride % align == 0)
{
*out_stride = stride;
return bytes;
return g_bytes_ref (bytes);
}
bpp = gdk_memory_format_bytes_per_pixel (format);
@@ -122,8 +122,6 @@ gdk_memory_sanitize (GBytes *bytes,
for (y = 0; y < height; y++)
memcpy (copy + y * copy_stride, data + y * stride, bpp * width);
g_bytes_unref (bytes);
*out_stride = copy_stride;
return g_bytes_new_take (copy, copy_stride * height);
}
@@ -199,7 +197,7 @@ gdk_memory_texture_new (int width,
/* needs to be this complex to support subtexture of the bottom right part */
g_return_val_if_fail (g_bytes_get_size (bytes) >= gdk_memory_format_min_buffer_size (format, stride, width, height), NULL);
bytes = gdk_memory_sanitize (g_bytes_ref (bytes), width, height, format, stride, &stride);
bytes = gdk_memory_sanitize (bytes, width, height, format, stride, &stride);
self = g_object_new (GDK_TYPE_MEMORY_TEXTURE,
"width", width,
+1 -1
View File
@@ -649,7 +649,7 @@ void
gdk_monitor_set_scale (GdkMonitor *monitor,
double scale)
{
g_return_if_fail (scale > 0.);
g_return_if_fail (scale >= 1.);
monitor->scale_set = TRUE;
-86
View File
@@ -1,86 +0,0 @@
/*
* Copyright © 2024 Benjamin Otte
*
* 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.1 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/>.
*
* Authors: Benjamin Otte <otte@gnome.org>
*/
#include "config.h"
#include "gdkparalleltaskprivate.h"
typedef struct _TaskData TaskData;
struct _TaskData
{
GdkTaskFunc task_func;
gpointer task_data;
int n_running_tasks;
};
static void
gdk_parallel_task_thread_func (gpointer data,
gpointer unused)
{
TaskData *task = data;
task->task_func (task->task_data);
g_atomic_int_add (&task->n_running_tasks, -1);
}
/**
* gdk_parallel_task_run:
* @task_func: the function to spawn
* @task_data: data to pass to the function
*
* Spawns the given function in many threads.
* Once all functions have exited, this function returns.
**/
void
gdk_parallel_task_run (GdkTaskFunc task_func,
gpointer task_data)
{
static GThreadPool *pool;
TaskData task = {
.task_func = task_func,
.task_data = task_data,
};
int i, n_tasks;
if (g_once_init_enter (&pool))
{
GThreadPool *the_pool = g_thread_pool_new (gdk_parallel_task_thread_func,
NULL,
MAX (2, g_get_num_processors ()) - 1,
FALSE,
NULL);
g_once_init_leave (&pool, the_pool);
}
n_tasks = g_get_num_processors ();
task.n_running_tasks = n_tasks;
/* Start with 1 because we run 1 task ourselves */
for (i = 1; i < n_tasks; i++)
{
g_thread_pool_push (pool, &task, NULL);
}
gdk_parallel_task_thread_func (&task, NULL);
while (g_atomic_int_get (&task.n_running_tasks) > 0)
g_thread_yield ();
}
-32
View File
@@ -1,32 +0,0 @@
/*
* Copyright © 2024 Benjamin Otte
*
* 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.1 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/>.
*
* Authors: Benjamin Otte <otte@gnome.org>
*/
#pragma once
#include <glib.h>
G_BEGIN_DECLS
typedef void (* GdkTaskFunc) (gpointer user_data);
void gdk_parallel_task_run (GdkTaskFunc task_func,
gpointer task_data);
G_END_DECLS
-10
View File
@@ -52,16 +52,6 @@ gdk_rectangle_transform_affine (const GdkRectangle *src,
dest->height = ceilf (MAX (y1, y2)) - dest->y;
}
static inline gboolean
gdk_rectangle_contains (const GdkRectangle *rect,
const GdkRectangle *contained)
{
return contained->x >= rect->x
&& contained->y >= rect->y
&& contained->x + contained->width <= rect->x + rect->width
&& contained->y + contained->height <= rect->y + rect->height;
}
G_END_DECLS
-6
View File
@@ -167,12 +167,6 @@ gdk_subsurface_attach (GdkSubsurface *subsurface,
g_return_val_if_fail (sibling == NULL || GDK_IS_SUBSURFACE (sibling), FALSE);
g_return_val_if_fail (sibling == NULL || sibling->parent == subsurface->parent, FALSE);
/* if the texture fully covers the background, ignore it */
if (background &&
gsk_rect_contains_rect (dest, background) &&
gdk_memory_format_alpha (gdk_texture_get_format (texture)) == GDK_MEMORY_ALPHA_OPAQUE)
background = NULL;
result = GDK_SUBSURFACE_GET_CLASS (subsurface)->attach (subsurface,
texture,
source,
+18 -129
View File
@@ -40,13 +40,11 @@
#include <glib/gi18n-lib.h>
#include "gdkmarshalers.h"
#include "gdkpopupprivate.h"
#include "gdkrectangleprivate.h"
#include "gdkrectangle.h"
#include "gdktoplevelprivate.h"
#include "gdkvulkancontext.h"
#include "gdksubsurfaceprivate.h"
#include "gsk/gskrectprivate.h"
#include <math.h>
#ifdef HAVE_EGL
@@ -77,9 +75,6 @@ struct _GdkSurfacePrivate
GdkMemoryDepth egl_surface_depth;
#endif
cairo_region_t *opaque_region;
cairo_rectangle_int_t opaque_rect; /* This is different from the region */
gpointer widget;
GdkColorState *color_state;
@@ -515,12 +510,6 @@ gdk_surface_real_create_subsurface (GdkSurface *surface)
return NULL;
}
static void
gdk_surface_default_set_opaque_region (GdkSurface *surface,
cairo_region_t *region)
{
}
static void
gdk_surface_constructed (GObject *object)
{
@@ -544,7 +533,6 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
klass->beep = gdk_surface_real_beep;
klass->get_scale = gdk_surface_real_get_scale;
klass->create_subsurface = gdk_surface_real_create_subsurface;
klass->set_opaque_region = gdk_surface_default_set_opaque_region;
/**
* GdkSurface:cursor: (attributes org.gtk.Property.get=gdk_surface_get_cursor org.gtk.Property.set=gdk_surface_set_cursor)
@@ -783,7 +771,7 @@ gdk_surface_finalize (GObject *object)
g_clear_object (&surface->display);
g_clear_pointer (&priv->opaque_region, cairo_region_destroy);
g_clear_pointer (&surface->opaque_region, cairo_region_destroy);
if (surface->parent)
surface->parent->children = g_list_remove (surface->parent->children, surface);
@@ -1136,7 +1124,6 @@ gdk_surface_set_egl_native_window (GdkSurface *self,
{
#ifdef HAVE_EGL
GdkSurfacePrivate *priv = gdk_surface_get_instance_private (self);
GdkGLContext *current = NULL;
/* This checks that all EGL platforms we support conform to the same struct sizes.
* When this ever fails, there will be some fun times happening for whoever tries
@@ -1147,19 +1134,12 @@ gdk_surface_set_egl_native_window (GdkSurface *self,
{
GdkDisplay *display = gdk_surface_get_display (self);
current = gdk_gl_context_clear_current_if_surface (self);
gdk_gl_context_clear_current_if_surface (self);
eglDestroySurface (gdk_display_get_egl_display (display), priv->egl_surface);
priv->egl_surface = NULL;
}
priv->egl_native_window = native_window;
if (current)
{
gdk_gl_context_make_current (current);
g_object_unref (current);
}
}
gpointer /* EGLSurface */
@@ -1179,26 +1159,20 @@ gdk_surface_ensure_egl_surface (GdkSurface *self,
g_return_val_if_fail (priv->egl_native_window != NULL, depth);
if (depth == GDK_MEMORY_NONE)
if (priv->egl_surface_depth != depth &&
priv->egl_surface != NULL &&
gdk_display_get_egl_config (display, priv->egl_surface_depth) != gdk_display_get_egl_config (display, depth))
{
if (priv->egl_surface_depth == GDK_MEMORY_NONE)
depth = GDK_MEMORY_U8;
else
depth = priv->egl_surface_depth;
gdk_gl_context_clear_current_if_surface (self);
eglDestroySurface (gdk_display_get_egl_display (display), priv->egl_surface);
priv->egl_surface = NULL;
}
if (priv->egl_surface == NULL ||
(priv->egl_surface != NULL &&
gdk_display_get_egl_config (display, priv->egl_surface_depth) != gdk_display_get_egl_config (display, depth)))
if (priv->egl_surface == NULL)
{
GdkGLContext *cleared;
EGLint attribs[4];
int i;
cleared = gdk_gl_context_clear_current_if_surface (self);
if (priv->egl_surface != NULL)
eglDestroySurface (gdk_display_get_egl_display (display), priv->egl_surface);
i = 0;
if (depth == GDK_MEMORY_U8_SRGB && display->have_egl_gl_colorspace)
{
@@ -1223,12 +1197,6 @@ gdk_surface_ensure_egl_surface (GdkSurface *self,
NULL);
}
priv->egl_surface_depth = depth;
if (cleared)
{
gdk_gl_context_make_current (cleared);
g_object_unref (cleared);
}
}
return priv->egl_surface_depth;
@@ -1288,7 +1256,7 @@ gdk_surface_create_gl_context (GdkSurface *surface,
if (!gdk_display_prepare_gl (surface->display, error))
return NULL;
return gdk_gl_context_new (surface->display, surface, FALSE);
return gdk_gl_context_new (surface->display, surface);
}
/**
@@ -2665,35 +2633,6 @@ gdk_surface_get_scale (GdkSurface *surface)
return GDK_SURFACE_GET_CLASS (surface)->get_scale (surface);
}
static void
gdk_surface_update_opaque_region (GdkSurface *self)
{
GdkSurfacePrivate *priv = gdk_surface_get_instance_private (self);
cairo_region_t *region;
if (priv->opaque_region == NULL)
{
if (priv->opaque_rect.width <= 0)
region = NULL;
else
region = cairo_region_create_rectangle (&priv->opaque_rect);
}
else
{
if (priv->opaque_rect.width <= 0)
region = cairo_region_reference (priv->opaque_region);
else
{
region = cairo_region_copy (priv->opaque_region);
cairo_region_union_rectangle (region, &priv->opaque_rect);
}
}
GDK_SURFACE_GET_CLASS (self)->set_opaque_region (self, region);
g_clear_pointer (&region, cairo_region_destroy);
}
/**
* gdk_surface_set_opaque_region:
* @surface: a top-level `GdkSurface`
@@ -2715,77 +2654,27 @@ gdk_surface_update_opaque_region (GdkSurface *self)
* is opaque, as we know where the opaque regions are. If your surface
* background is not opaque, please update this property in your
* [GtkWidgetClass.css_changed](../gtk4/vfunc.Widget.css_changed.html) handler.
*
* Deprecated: 4.16: GDK can figure out the opaque parts of a window itself
* by inspecting the contents that are drawn.
*/
void
gdk_surface_set_opaque_region (GdkSurface *surface,
cairo_region_t *region)
{
GdkSurfacePrivate *priv = gdk_surface_get_instance_private (surface);
GdkSurfaceClass *class;
g_return_if_fail (GDK_IS_SURFACE (surface));
g_return_if_fail (!GDK_SURFACE_DESTROYED (surface));
if (cairo_region_equal (priv->opaque_region, region))
if (cairo_region_equal (surface->opaque_region, region))
return;
g_clear_pointer (&priv->opaque_region, cairo_region_destroy);
g_clear_pointer (&surface->opaque_region, cairo_region_destroy);
if (region != NULL)
priv->opaque_region = cairo_region_reference (region);
surface->opaque_region = cairo_region_reference (region);
gdk_surface_update_opaque_region (surface);
}
/* Sets the opaque rect from the rendernode via end_frame() */
void
gdk_surface_set_opaque_rect (GdkSurface *self,
const graphene_rect_t *rect)
{
GdkSurfacePrivate *priv = gdk_surface_get_instance_private (self);
cairo_rectangle_int_t opaque;
if (rect)
gsk_rect_to_cairo_shrink (rect, &opaque);
else
opaque = (cairo_rectangle_int_t) { 0, 0, 0, 0 };
if (gdk_rectangle_equal (&priv->opaque_rect, &opaque))
return;
priv->opaque_rect = opaque;
gdk_surface_update_opaque_region (self);
}
/*
* gdk_surface_is_opaque:
* @self: a surface
*
* Checks if the whole surface is known to be opaque.
* This allows using an RGBx buffer instead of RGBA.
*
* This function works for the currently rendered frame inside
* begin_frame() implementations.
*
* Returns: %TRUE if the whole surface is provably opaque
**/
gboolean
gdk_surface_is_opaque (GdkSurface *self)
{
GdkSurfacePrivate *priv = gdk_surface_get_instance_private (self);
cairo_rectangle_int_t whole = { 0, 0, self->width, self->height };
if (gdk_rectangle_contains (&priv->opaque_rect, &whole))
return TRUE;
if (priv->opaque_region &&
cairo_region_contains_rectangle (priv->opaque_region, &whole) == CAIRO_REGION_OVERLAP_IN)
return TRUE;
return FALSE;
class = GDK_SURFACE_GET_CLASS (surface);
if (class->set_opaque_region)
class->set_opaque_region (surface, region);
}
void
+1 -1
View File
@@ -125,7 +125,7 @@ void gdk_surface_request_layout (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
GdkFrameClock* gdk_surface_get_frame_clock (GdkSurface *surface);
GDK_DEPRECATED_IN_4_16
GDK_AVAILABLE_IN_ALL
void gdk_surface_set_opaque_region (GdkSurface *surface,
cairo_region_t *region);
+10 -11
View File
@@ -96,6 +96,8 @@ struct _GdkSurface
GSList *draw_contexts;
GdkDrawContext *paint_context;
cairo_region_t *opaque_region;
GdkSeat *current_shortcuts_inhibited_seat;
GPtrArray *subsurfaces;
@@ -251,17 +253,14 @@ gdk_gravity_flip_vertically (GdkGravity anchor)
g_assert_not_reached ();
}
void _gdk_surface_destroy (GdkSurface *surface,
gboolean foreign_destroy);
void gdk_surface_invalidate_rect (GdkSurface *surface,
const GdkRectangle *rect);
void gdk_surface_invalidate_region (GdkSurface *surface,
const cairo_region_t *region);
void _gdk_surface_clear_update_area (GdkSurface *surface);
void _gdk_surface_update_size (GdkSurface *surface);
void gdk_surface_set_opaque_rect (GdkSurface *self,
const graphene_rect_t *rect);
gboolean gdk_surface_is_opaque (GdkSurface *self);
void _gdk_surface_destroy (GdkSurface *surface,
gboolean foreign_destroy);
void gdk_surface_invalidate_rect (GdkSurface *surface,
const GdkRectangle *rect);
void gdk_surface_invalidate_region (GdkSurface *surface,
const cairo_region_t *region);
void _gdk_surface_clear_update_area (GdkSurface *surface);
void _gdk_surface_update_size (GdkSurface *surface);
GdkGLContext * gdk_surface_get_paint_gl_context (GdkSurface *surface,
GError **error);
+1 -12
View File
@@ -33,18 +33,7 @@
*
* `GdkTexture` is an immutable object: That means you cannot change
* anything about it other than increasing the reference count via
* [method@GObject.Object.ref], and consequently, it is a threadsafe object.
*
* GDK provides a number of threadsafe texture loading functions:
* [ctor@Gdk.Texture.new_from_resource],
* [ctor@Gdk.Texture.new_from_bytes],
* [ctor@Gdk.Texture.new_from_file],
* [ctor@Gdk.Texture.new_from_filename],
* [ctor@Gdk.Texture.new_for_pixbuf]. Note that these are meant for loading
* icons and resources that are shipped with the toolkit or application. It
* is recommended that you use a dedicated image loading framework such as
* [glycin](https://lib.rs/crates/glycin), if you need to load untrusted image
* data.
* [method@GObject.Object.ref], and consequently, it is a thread-safe object.
*/
#include "config.h"
+1 -8
View File
@@ -85,6 +85,7 @@ typedef enum
* @GDK_TOPLEVEL_STATE_BOTTOM_RESIZABLE: whether the bottom edge is resizable
* @GDK_TOPLEVEL_STATE_LEFT_TILED: whether the left edge is tiled
* @GDK_TOPLEVEL_STATE_LEFT_RESIZABLE: whether the left edge is resizable
* @GDK_TOPLEVEL_STATE_SUSPENDED: the surface is not visible to the user
*
* Specifies the state of a toplevel surface.
*
@@ -94,14 +95,6 @@ typedef enum
* will give an indication of tiledness without any of the per-edge states
* being set.
*/
/**
* GDK_TOPLEVEL_STATE_SUSPENDED:
*
* The surface is not visible to the user.
*
* Since: 4.12
*/
typedef enum
{
GDK_TOPLEVEL_STATE_MINIMIZED = 1 << 0,
+29 -31
View File
@@ -678,10 +678,7 @@ gdk_vulkan_context_begin_frame (GdkDrawContext *draw_context,
cairo_region_union (region, priv->regions[priv->draw_index]);
if (priv->current_depth == GDK_MEMORY_U8_SRGB)
*out_color_state = gdk_color_state_get_no_srgb_tf (color_state);
else
*out_color_state = color_state;
*out_color_state = color_state;
*out_depth = priv->current_depth;
}
@@ -714,8 +711,8 @@ gdk_vulkan_context_end_frame (GdkDrawContext *draw_context,
.layer = 0,
.offset.x = (int) floor (r.x * scale),
.offset.y = (int) floor (r.y * scale),
.extent.width = (int) ceil ((r.x + r.width) * scale) - floor (r.x * scale),
.extent.height = (int) ceil ((r.y + r.height) * scale) - floor (r.y * scale),
.extent.width = (int) ceil (r.width * scale),
.extent.height = (int) ceil (r.height * scale),
};
}
}
@@ -1348,6 +1345,7 @@ gdk_vulkan_context_get_draw_index (GdkVulkanContext *context)
GdkVulkanContextPrivate *priv = gdk_vulkan_context_get_instance_private (context);
g_return_val_if_fail (GDK_IS_VULKAN_CONTEXT (context), 0);
g_return_val_if_fail (gdk_draw_context_is_in_frame (GDK_DRAW_CONTEXT (context)), 0);
return priv->draw_index;
}
@@ -1371,6 +1369,7 @@ gdk_vulkan_context_set_draw_semaphore (GdkVulkanContext *context,
GdkVulkanContextPrivate *priv = gdk_vulkan_context_get_instance_private (context);
g_return_if_fail (GDK_IS_VULKAN_CONTEXT (context));
g_return_if_fail (!gdk_draw_context_is_in_frame (GDK_DRAW_CONTEXT (context)));
g_return_if_fail (priv->draw_semaphore == VK_NULL_HANDLE);
priv->draw_semaphore = semaphore;
@@ -1406,9 +1405,8 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
last = n_devices;
skip_features = gdk_parse_debug_var ("GDK_VULKAN_DISABLE",
"GDK_VULKAN_DISABLE can be set to a list of Vulkan features to disable.\n",
gsk_vulkan_feature_keys,
G_N_ELEMENTS (gsk_vulkan_feature_keys));
gsk_vulkan_feature_keys,
G_N_ELEMENTS (gsk_vulkan_feature_keys));
if (skip_features & GDK_VULKAN_FEATURE_YCBCR)
skip_features |= GDK_VULKAN_FEATURE_DMABUF;
@@ -1627,10 +1625,10 @@ gdk_display_create_vulkan_instance (GdkDisplay *display,
gboolean have_debug_report = FALSE;
VkResult res;
if (!gdk_has_feature (GDK_FEATURE_VULKAN))
if (gdk_display_get_debug_flags (display) & GDK_DEBUG_VULKAN_DISABLE)
{
g_set_error_literal (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE,
_("Vulkan support disabled via GDK_DISABLE"));
_("Vulkan support disabled via GDK_DEBUG"));
return FALSE;
}
@@ -1673,26 +1671,26 @@ gdk_display_create_vulkan_instance (GdkDisplay *display,
g_ptr_array_add (used_extensions, (gpointer) VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME);
}
res = vkCreateInstance (&(VkInstanceCreateInfo) {
.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
.pNext = NULL,
.flags = 0,
.pApplicationInfo = &(VkApplicationInfo) {
.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO,
.pNext = NULL,
.pApplicationName = g_get_application_name (),
.applicationVersion = 0,
.pEngineName = "GTK",
.engineVersion = VK_MAKE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION, GDK_MICRO_VERSION),
.apiVersion = VK_API_VERSION_1_3
},
.enabledLayerCount = 0,
.ppEnabledLayerNames = NULL,
.enabledExtensionCount = used_extensions->len,
.ppEnabledExtensionNames = (const char * const *) used_extensions->pdata,
},
NULL,
&display->vk_instance);
res = GDK_VK_CHECK (vkCreateInstance, &(VkInstanceCreateInfo) {
.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
.pNext = NULL,
.flags = 0,
.pApplicationInfo = &(VkApplicationInfo) {
.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO,
.pNext = NULL,
.pApplicationName = g_get_application_name (),
.applicationVersion = 0,
.pEngineName = "GTK",
.engineVersion = VK_MAKE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION, GDK_MICRO_VERSION),
.apiVersion = VK_API_VERSION_1_3
},
.enabledLayerCount = 0,
.ppEnabledLayerNames = NULL,
.enabledExtensionCount = used_extensions->len,
.ppEnabledExtensionNames = (const char * const *) used_extensions->pdata,
},
NULL,
&display->vk_instance);
g_ptr_array_free (used_extensions, TRUE);
if (res != VK_SUCCESS)
+1 -1
View File
@@ -65,7 +65,7 @@ gdk_vulkan_handle_result (VkResult res,
{
if (res != VK_SUCCESS)
{
g_warning ("%s(): %s (%d)", called_function, gdk_vulkan_strerror (res), res);
GDK_DEBUG (VULKAN, "%s(): %s (%d)", called_function, gdk_vulkan_strerror (res), res);
}
return res;
-6
View File
@@ -1133,7 +1133,6 @@
0x00fe8a dead_small_schwa
0x00fe8b dead_capital_schwa
0x00fe8c dead_greek
0x00fe8d dead_hamza
0x00fea0 ch
0x00fea1 Ch
0x00fea2 CH
@@ -1399,11 +1398,6 @@
0x1000259 schwa
0x1000275 obarred
0x1000292 ezh
0x1000300 combining_grave
0x1000301 combining_acute
0x1000303 combining_tilde
0x1000309 combining_hook
0x1000323 combining_belowdot
0x1000492 Cyrillic_GHE_bar
0x1000493 Cyrillic_ghe_bar
0x1000496 Cyrillic_ZHE_descender
+2275 -2293
View File
File diff suppressed because it is too large Load Diff
+17 -9
View File
@@ -692,9 +692,24 @@ typedef NSString *CALayerContentsGravity;
-(void)setStyleMask:(NSWindowStyleMask)styleMask
{
gboolean was_opaque;
gboolean is_opaque;
was_opaque = (([self styleMask] & NSWindowStyleMaskTitled) != 0);
[super setStyleMask:styleMask];
is_opaque = (([self styleMask] & NSWindowStyleMaskTitled) != 0);
_gdk_macos_surface_update_fullscreen_state (gdk_surface);
if (was_opaque != is_opaque)
{
[self setOpaque:is_opaque];
if (!is_opaque)
[self setBackgroundColor:[NSColor clearColor]];
}
}
-(NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen
@@ -770,20 +785,13 @@ typedef NSString *CALayerContentsGravity;
if (decorated)
{
style_mask &= ~NSWindowStyleMaskFullSizeContentView;
[self setTitleVisibility:NSWindowTitleVisible];
style_mask |= NSWindowStyleMaskTitled;
}
else
{
style_mask |= NSWindowStyleMaskFullSizeContentView;
[self setTitleVisibility:NSWindowTitleHidden];
style_mask &= ~NSWindowStyleMaskTitled;
}
[self setTitlebarAppearsTransparent:!decorated];
[[self standardWindowButton:NSWindowCloseButton] setHidden:!decorated];
[[self standardWindowButton:NSWindowMiniaturizeButton] setHidden:!decorated];
[[self standardWindowButton:NSWindowZoomButton] setHidden:!decorated];
[self setStyleMask:style_mask];
}
+21 -2
View File
@@ -107,13 +107,32 @@ _gdk_macos_cairo_context_cairo_create (GdkCairoContext *cairo_context)
cairo_clip (cr);
}
/* If we have some exposed transparent area in the damage region,
* we need to clear the existing content first to leave an transparent
* area for cairo. We use (surface_bounds or damage)-(opaque) to get
* the smallest set of rectangles we need to clear as it's expensive.
*/
if (!opaque)
{
cairo_region_t *transparent;
cairo_rectangle_int_t r = { 0, 0, width/scale, height/scale };
cairo_save (cr);
cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
cairo_paint (cr);
if (damage != NULL)
cairo_region_get_extents (damage, &r);
transparent = cairo_region_create_rectangle (&r);
if (surface->opaque_region)
cairo_region_subtract (transparent, surface->opaque_region);
if (!cairo_region_is_empty (transparent))
{
gdk_cairo_region (cr, transparent);
cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
cairo_fill (cr);
}
cairo_region_destroy (transparent);
cairo_restore (cr);
}
+1 -1
View File
@@ -242,7 +242,7 @@ gdk_macos_gl_context_allocate (GdkMacosGLContext *self)
return;
/* Alter to an opaque surface if necessary */
opaque = gdk_surface_is_opaque (surface);
opaque = _gdk_macos_surface_is_opaque (GDK_MACOS_SURFACE (surface));
if (opaque != self->last_opaque)
{
self->last_opaque = !!opaque;
+1
View File
@@ -86,6 +86,7 @@ CGDirectDisplayID _gdk_macos_surface_get_screen_id (GdkMacosSurface
const char *_gdk_macos_surface_get_title (GdkMacosSurface *self);
void _gdk_macos_surface_set_title (GdkMacosSurface *self,
const char *title);
gboolean _gdk_macos_surface_is_opaque (GdkMacosSurface *self);
NSView *_gdk_macos_surface_get_view (GdkMacosSurface *self);
gboolean _gdk_macos_surface_get_modal_hint (GdkMacosSurface *self);
void _gdk_macos_surface_set_modal_hint (GdkMacosSurface *self,
+23
View File
@@ -553,6 +553,29 @@ gdk_macos_surface_init (GdkMacosSurface *self)
self->monitors = g_ptr_array_new_with_free_func (g_object_unref);
}
gboolean
_gdk_macos_surface_is_opaque (GdkMacosSurface *self)
{
GdkSurface *surface = (GdkSurface *)self;
g_return_val_if_fail (GDK_IS_MACOS_SURFACE (self), FALSE);
if (surface->opaque_region != NULL &&
cairo_region_num_rectangles (surface->opaque_region) == 1)
{
cairo_rectangle_int_t extents;
cairo_region_get_extents (surface->opaque_region, &extents);
return (extents.x == 0 &&
extents.y == 0 &&
extents.width == GDK_SURFACE (self)->width &&
extents.height == GDK_SURFACE (self)->height);
}
return FALSE;
}
const char *
_gdk_macos_surface_get_title (GdkMacosSurface *self)
{
-8
View File
@@ -617,14 +617,6 @@ _gdk_macos_toplevel_surface_constructed (GObject *object)
_gdk_macos_surface_set_native (GDK_MACOS_SURFACE (self), window);
[window setOpaque:NO];
/* Workaround: if we use full transparency, window rendering becomes slow,
* because macOS tries to dynamically calculate the shadow.
* Instead provide a tiny bit of alpha, so shadows are drawn around the window.
*/
[window setBackgroundColor:[[NSColor blackColor] colorWithAlphaComponent:0.00001]];
/* Allow NSWindow to go fullscreen */
[window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
+6 -7
View File
@@ -52,24 +52,23 @@ gdk_public_sources = files([
'gdkmonitor.c',
'gdkpaintable.c',
'gdkpango.c',
'gdkparalleltask.c',
'gdkpipeiostream.c',
'gdkpopup.c',
'gdkpopuplayout.c',
'gdkprofiler.c',
'gdkrectangle.c',
'gdkrgba.c',
'gdkseat.c',
'gdkseatdefault.c',
'gdksnapshot.c',
'gdksubsurface.c',
'gdksurface.c',
'gdktexture.c',
'gdktexturedownloader.c',
'gdkvulkancontext.c',
'gdksubsurface.c',
'gdksurface.c',
'gdkpopuplayout.c',
'gdkprofiler.c',
'gdkpopup.c',
'gdktoplevellayout.c',
'gdktoplevelsize.c',
'gdktoplevel.c',
'gdkvulkancontext.c',
'loaders/gdkpng.c',
'loaders/gdktiff.c',
'loaders/gdkjpeg.c',
+28 -31
View File
@@ -61,7 +61,6 @@
#include <wayland/server-decoration-client-protocol.h>
#include "linux-dmabuf-unstable-v1-client-protocol.h"
#include "presentation-time-client-protocol.h"
#include "xx-color-management-v4-client-protocol.h"
#include "wm-button-layout-translation.h"
@@ -353,19 +352,19 @@ gdk_registry_handle_global (void *data,
GDK_DEBUG (MISC, "add global %u, interface %s, version %u", id, interface, version);
if (strcmp (interface, wl_compositor_interface.name) == 0)
if (strcmp (interface, "wl_compositor") == 0)
{
display_wayland->compositor =
wl_registry_bind (display_wayland->wl_registry, id,
&wl_compositor_interface, MIN (version, 6));
}
else if (strcmp (interface, wl_shm_interface.name) == 0)
else if (strcmp (interface, "wl_shm") == 0)
{
display_wayland->shm =
wl_registry_bind (display_wayland->wl_registry, id, &wl_shm_interface, 1);
wl_shm_add_listener (display_wayland->shm, &wl_shm_listener, display_wayland);
}
else if (strcmp (interface, zwp_linux_dmabuf_v1_interface.name) == 0 && version >= 4)
else if (strcmp (interface, "zwp_linux_dmabuf_v1") == 0 && version >= 4)
{
struct zwp_linux_dmabuf_feedback_v1 *feedback;
@@ -377,23 +376,23 @@ gdk_registry_handle_global (void *data,
feedback);
_gdk_wayland_display_async_roundtrip (display_wayland);
}
else if (strcmp (interface, xdg_wm_base_interface.name) == 0)
else if (strcmp (interface, "xdg_wm_base") == 0)
{
display_wayland->xdg_wm_base_id = id;
display_wayland->xdg_wm_base_version = version;
}
else if (strcmp (interface, zxdg_shell_v6_interface.name) == 0)
else if (strcmp (interface, "zxdg_shell_v6") == 0)
{
display_wayland->zxdg_shell_v6_id = id;
}
else if (strcmp (interface, xdg_wm_dialog_v1_interface.name) == 0)
else if (strcmp (interface, "xdg_wm_dialog_v1") == 0)
{
display_wayland->xdg_wm_dialog =
wl_registry_bind (display_wayland->wl_registry, id,
&xdg_wm_dialog_v1_interface,
MIN (version, XDG_WM_DIALOG_VERSION));
}
else if (strcmp (interface, gtk_shell1_interface.name) == 0)
else if (strcmp (interface, "gtk_shell1") == 0)
{
display_wayland->gtk_shell =
wl_registry_bind (display_wayland->wl_registry, id,
@@ -401,7 +400,7 @@ gdk_registry_handle_global (void *data,
MIN (version, GTK_SHELL1_VERSION));
gdk_wayland_display_set_has_gtk_shell (display_wayland);
}
else if (strcmp (interface, wl_output_interface.name) == 0)
else if (strcmp (interface, "wl_output") == 0)
{
output =
wl_registry_bind (display_wayland->wl_registry, id, &wl_output_interface,
@@ -410,7 +409,7 @@ gdk_registry_handle_global (void *data,
MIN (version, OUTPUT_VERSION));
_gdk_wayland_display_async_roundtrip (display_wayland);
}
else if (strcmp (interface, wl_seat_interface.name) == 0)
else if (strcmp (interface, "wl_seat") == 0)
{
SeatAddedClosure *closure;
static const char *required_device_manager_globals[] = {
@@ -426,67 +425,67 @@ gdk_registry_handle_global (void *data,
closure->version = version;
postpone_on_globals_closure (display_wayland, &closure->base);
}
else if (strcmp (interface, wl_data_device_manager_interface.name) == 0)
else if (strcmp (interface, "wl_data_device_manager") == 0)
{
display_wayland->data_device_manager =
wl_registry_bind (display_wayland->wl_registry, id, &wl_data_device_manager_interface,
MIN (version, 3));
}
else if (strcmp (interface, wl_subcompositor_interface.name) == 0)
else if (strcmp (interface, "wl_subcompositor") == 0)
{
display_wayland->subcompositor =
wl_registry_bind (display_wayland->wl_registry, id, &wl_subcompositor_interface, 1);
}
else if (strcmp (interface, zwp_pointer_gestures_v1_interface.name) == 0)
else if (strcmp (interface, "zwp_pointer_gestures_v1") == 0)
{
display_wayland->pointer_gestures =
wl_registry_bind (display_wayland->wl_registry,
id, &zwp_pointer_gestures_v1_interface,
MIN (version, GDK_ZWP_POINTER_GESTURES_V1_VERSION));
}
else if (strcmp (interface, zwp_primary_selection_device_manager_v1_interface.name) == 0)
else if (strcmp (interface, "zwp_primary_selection_device_manager_v1") == 0)
{
display_wayland->primary_selection_manager =
wl_registry_bind(display_wayland->wl_registry, id,
&zwp_primary_selection_device_manager_v1_interface, 1);
}
else if (strcmp (interface, zwp_tablet_manager_v2_interface.name) == 0)
else if (strcmp (interface, "zwp_tablet_manager_v2") == 0)
{
display_wayland->tablet_manager =
wl_registry_bind(display_wayland->wl_registry, id,
&zwp_tablet_manager_v2_interface, 1);
}
else if (strcmp (interface, zxdg_exporter_v1_interface.name) == 0)
else if (strcmp (interface, "zxdg_exporter_v1") == 0)
{
display_wayland->xdg_exporter =
wl_registry_bind (display_wayland->wl_registry, id,
&zxdg_exporter_v1_interface, 1);
}
else if (strcmp (interface, zxdg_exporter_v2_interface.name) == 0)
else if (strcmp (interface, "zxdg_exporter_v2") == 0)
{
display_wayland->xdg_exporter_v2 =
wl_registry_bind (display_wayland->wl_registry, id,
&zxdg_exporter_v2_interface, 1);
}
else if (strcmp (interface, zxdg_importer_v1_interface.name) == 0)
else if (strcmp (interface, "zxdg_importer_v1") == 0)
{
display_wayland->xdg_importer =
wl_registry_bind (display_wayland->wl_registry, id,
&zxdg_importer_v1_interface, 1);
}
else if (strcmp (interface, zxdg_importer_v2_interface.name) == 0)
else if (strcmp (interface, "zxdg_importer_v2") == 0)
{
display_wayland->xdg_importer_v2 =
wl_registry_bind (display_wayland->wl_registry, id,
&zxdg_importer_v2_interface, 1);
}
else if (strcmp (interface, zwp_keyboard_shortcuts_inhibit_manager_v1_interface.name) == 0)
else if (strcmp (interface, "zwp_keyboard_shortcuts_inhibit_manager_v1") == 0)
{
display_wayland->keyboard_shortcuts_inhibit =
wl_registry_bind (display_wayland->wl_registry, id,
&zwp_keyboard_shortcuts_inhibit_manager_v1_interface, 1);
}
else if (strcmp (interface, org_kde_kwin_server_decoration_manager_interface.name) == 0)
else if (strcmp (interface, "org_kde_kwin_server_decoration_manager") == 0)
{
display_wayland->server_decoration_manager =
wl_registry_bind (display_wayland->wl_registry, id,
@@ -495,7 +494,7 @@ gdk_registry_handle_global (void *data,
&server_decoration_listener,
display_wayland);
}
else if (strcmp (interface, zxdg_output_manager_v1_interface.name) == 0)
else if (strcmp(interface, "zxdg_output_manager_v1") == 0)
{
display_wayland->xdg_output_manager =
wl_registry_bind (display_wayland->wl_registry, id,
@@ -504,39 +503,38 @@ gdk_registry_handle_global (void *data,
gdk_wayland_display_init_xdg_output (display_wayland);
_gdk_wayland_display_async_roundtrip (display_wayland);
}
else if (strcmp (interface, zwp_idle_inhibit_manager_v1_interface.name) == 0)
else if (strcmp(interface, "zwp_idle_inhibit_manager_v1") == 0)
{
display_wayland->idle_inhibit_manager =
wl_registry_bind (display_wayland->wl_registry, id,
&zwp_idle_inhibit_manager_v1_interface, 1);
}
else if (strcmp (interface, xdg_activation_v1_interface.name) == 0)
else if (strcmp (interface, "xdg_activation_v1") == 0)
{
display_wayland->xdg_activation =
wl_registry_bind (display_wayland->wl_registry, id,
&xdg_activation_v1_interface, 1);
}
else if (strcmp (interface, wp_fractional_scale_manager_v1_interface.name) == 0)
else if (strcmp (interface, "wp_fractional_scale_manager_v1") == 0)
{
display_wayland->fractional_scale =
wl_registry_bind (display_wayland->wl_registry, id,
&wp_fractional_scale_manager_v1_interface, 1);
}
else if (strcmp (interface, wp_viewporter_interface.name) == 0)
else if (strcmp (interface, "wp_viewporter") == 0)
{
display_wayland->viewporter =
wl_registry_bind (display_wayland->wl_registry, id,
&wp_viewporter_interface, 1);
}
else if (strcmp (interface, wp_presentation_interface.name) == 0)
else if (strcmp (interface, "wp_presentation") == 0)
{
display_wayland->presentation =
wl_registry_bind (display_wayland->wl_registry, id,
&wp_presentation_interface,
MIN (version, 1));
}
else if (strcmp (interface, xx_color_manager_v4_interface.name) == 0 &&
gdk_has_feature (GDK_FEATURE_COLOR_MANAGEMENT))
else if (strcmp (interface, "xx_color_manager_v4") == 0)
{
display_wayland->color = gdk_wayland_color_new (display_wayland, registry, id, version);
}
@@ -1944,8 +1942,7 @@ init_settings (GdkDisplay *display)
GSettings *settings;
int i;
if (gdk_should_use_portal () &&
!(gdk_display_get_debug_flags (display) & GDK_DEBUG_DEFAULT_SETTINGS))
if (gdk_should_use_portal ())
{
GVariant *ret;
GError *error = NULL;
+4 -3
View File
@@ -185,8 +185,8 @@ get_dmabuf_wl_buffer (GdkWaylandSubsurface *self,
while (!cd.done)
gdk_wayland_display_dispatch_queue (GDK_DISPLAY (display), event_queue);
zwp_linux_buffer_params_v1_destroy (params);
wl_event_queue_destroy (event_queue);
zwp_linux_buffer_params_v1_destroy (params);
buffer = cd.buffer;
@@ -491,6 +491,9 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
has_background = self->bg_rect.width > 0 && self->bg_rect.height > 0;
if (has_background)
ensure_bg_surface (self);
if (!scaled_rect_is_integral (dest, 1, &device_rect))
{
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
@@ -666,8 +669,6 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
if (has_background)
{
ensure_bg_surface (self);
if (background_changed)
{
wl_subsurface_set_position (self->bg_subsurface, self->bg_rect.x, self->bg_rect.y);
+8 -7
View File
@@ -1451,15 +1451,16 @@ void
gdk_wayland_surface_ensure_wl_egl_window (GdkSurface *surface)
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
int width, height;
if (impl->display_server.egl_window != NULL)
return;
if (impl->display_server.egl_window == NULL)
{
int width, height;
get_egl_window_size (surface, &width, &height);
impl->display_server.egl_window =
wl_egl_window_create (impl->display_server.wl_surface, width, height);
gdk_surface_set_egl_native_window (surface, impl->display_server.egl_window);
get_egl_window_size (surface, &width, &height);
impl->display_server.egl_window =
wl_egl_window_create (impl->display_server.wl_surface, width, height);
gdk_surface_set_egl_native_window (surface, impl->display_server.egl_window);
}
}
/* }}} */
+1 -1
View File
@@ -26,6 +26,6 @@
G_BEGIN_DECLS
void gdk_wayland_surface_ensure_wl_egl_window (GdkSurface *surface);
void gdk_wayland_surface_ensure_wl_egl_window (GdkSurface *surface);
G_END_DECLS
@@ -33,6 +33,9 @@ void gdk_wayland_toplevel_set_dbus_properties (GdkToplevel *toplevel,
const char *application_object_path,
const char *unique_bus_name);
void gdk_wayland_toplevel_announce_csd (GdkToplevel *toplevel);
void gdk_wayland_toplevel_announce_ssd (GdkToplevel *toplevel);
gboolean gdk_wayland_toplevel_inhibit_idle (GdkToplevel *toplevel);
void gdk_wayland_toplevel_uninhibit_idle (GdkToplevel *toplevel);
+38 -29
View File
@@ -141,7 +141,6 @@ struct _GdkWaylandToplevel
gboolean has_bounds;
char *title;
gboolean decorated;
GdkGeometry geometry_hints;
GdkSurfaceHints geometry_mask;
@@ -1257,32 +1256,6 @@ gdk_wayland_toplevel_set_transient_for (GdkWaylandToplevel *toplevel,
#define LAST_PROP 1
static void
gdk_wayland_toplevel_set_decorated (GdkWaylandToplevel *self,
gboolean decorated)
{
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (GDK_SURFACE (self)));
if (self->decorated == decorated)
return;
self->decorated = decorated;
if (display_wayland->server_decoration_manager)
{
if (self->server_decoration == NULL)
self->server_decoration =
org_kde_kwin_server_decoration_manager_create (display_wayland->server_decoration_manager,
gdk_wayland_surface_get_wl_surface (GDK_SURFACE (self)));
org_kde_kwin_server_decoration_request_mode (self->server_decoration,
decorated ? ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_SERVER
: ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_CLIENT);
}
g_object_notify (G_OBJECT (self), "decorated");
}
static void
gdk_wayland_toplevel_set_property (GObject *object,
guint prop_id,
@@ -1318,7 +1291,6 @@ gdk_wayland_toplevel_set_property (GObject *object,
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_DECORATED:
gdk_wayland_toplevel_set_decorated (toplevel, g_value_get_boolean (value));
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_DELETABLE:
@@ -1374,7 +1346,6 @@ gdk_wayland_toplevel_get_property (GObject *object,
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_DECORATED:
g_value_set_boolean (value, toplevel->decorated);
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_DELETABLE:
@@ -2480,6 +2451,44 @@ gdk_wayland_toplevel_set_application_id (GdkToplevel *toplevel,
}
}
void
gdk_wayland_toplevel_announce_csd (GdkToplevel *toplevel)
{
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (GDK_SURFACE (toplevel)));
GdkWaylandToplevel *toplevel_wayland;
g_return_if_fail (GDK_IS_WAYLAND_TOPLEVEL (toplevel));
toplevel_wayland = GDK_WAYLAND_TOPLEVEL (toplevel);
if (!display_wayland->server_decoration_manager)
return;
toplevel_wayland->server_decoration =
org_kde_kwin_server_decoration_manager_create (display_wayland->server_decoration_manager,
gdk_wayland_surface_get_wl_surface (GDK_SURFACE (toplevel_wayland)));
if (toplevel_wayland->server_decoration)
org_kde_kwin_server_decoration_request_mode (toplevel_wayland->server_decoration,
ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_CLIENT);
}
void
gdk_wayland_toplevel_announce_ssd (GdkToplevel *toplevel)
{
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (GDK_SURFACE (toplevel)));
GdkWaylandToplevel *toplevel_wayland;
g_return_if_fail (GDK_IS_WAYLAND_TOPLEVEL (toplevel));
toplevel_wayland = GDK_WAYLAND_TOPLEVEL (toplevel);
if (!display_wayland->server_decoration_manager)
return;
toplevel_wayland->server_decoration =
org_kde_kwin_server_decoration_manager_create (display_wayland->server_decoration_manager,
gdk_wayland_surface_get_wl_surface (GDK_SURFACE (toplevel_wayland)));
if (toplevel_wayland->server_decoration)
org_kde_kwin_server_decoration_request_mode (toplevel_wayland->server_decoration,
ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_SERVER);
}
gboolean
gdk_wayland_toplevel_inhibit_idle (GdkToplevel *toplevel)
{
-6
View File
@@ -64,16 +64,10 @@ gdk_vulkan_context_wayland_end_frame (GdkDrawContext *context,
cairo_region_t *painted)
{
GdkSurface *surface = gdk_draw_context_get_surface (GDK_DRAW_CONTEXT (context));
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
int dx = impl->pending_buffer_offset_x;
int dy = impl->pending_buffer_offset_y;
gdk_wayland_surface_sync (surface);
gdk_wayland_surface_request_frame (surface);
if (wl_surface_get_version (impl->display_server.wl_surface) >= WL_SURFACE_OFFSET_SINCE_VERSION)
wl_surface_offset (impl->display_server.wl_surface, dx, dy);
GDK_DRAW_CONTEXT_CLASS (gdk_wayland_vulkan_context_parent_class)->end_frame (context, painted);
gdk_wayland_surface_notify_committed (surface);
+16 -108
View File
@@ -1,11 +1,10 @@
#include "config.h"
#include "gdkwaylandcolor-private.h"
#include "gdksurface-wayland-private.h"
#include <gdk/wayland/xx-color-management-v4-client-protocol.h>
typedef struct _ImageDescription ImageDescription;
static const uint primaries_map[] = {
static uint primaries_map[] = {
[XX_COLOR_MANAGER_V4_PRIMARIES_SRGB] = 1,
[XX_COLOR_MANAGER_V4_PRIMARIES_PAL_M] = 4,
[XX_COLOR_MANAGER_V4_PRIMARIES_PAL] = 5,
@@ -34,48 +33,7 @@ cicp_to_wl_primaries (uint cp)
return 0;
}
static const uint primaries_primaries[][8] = {
[XX_COLOR_MANAGER_V4_PRIMARIES_SRGB] = { 6400, 3300, 3000, 6000, 1500, 600, 3127, 3290 },
[XX_COLOR_MANAGER_V4_PRIMARIES_PAL_M] = { 6700, 3300, 2100, 7100, 1400, 800, 3100, 3160 },
[XX_COLOR_MANAGER_V4_PRIMARIES_PAL] = { 6400, 3300, 2900, 6000, 1500, 600, 3127, 3290 },
[XX_COLOR_MANAGER_V4_PRIMARIES_NTSC] = { 6300, 3400, 3100, 5950, 1550, 700, 3127, 3290 },
[XX_COLOR_MANAGER_V4_PRIMARIES_GENERIC_FILM] = { 2430, 6920, 1450, 490, 6810, 3190, 3100, 3160 },
[XX_COLOR_MANAGER_V4_PRIMARIES_BT2020] = { 7080, 2920, 1700, 7970, 1310, 460, 3127, 3290 },
[XX_COLOR_MANAGER_V4_PRIMARIES_CIE1931_XYZ] = {10000, 0, 0,10000, 0, 0, 3333, 3333 },
[XX_COLOR_MANAGER_V4_PRIMARIES_DCI_P3] = { 6800, 3200, 2650, 6900, 1500, 600, 3140, 3510 },
[XX_COLOR_MANAGER_V4_PRIMARIES_DISPLAY_P3] = { 6800, 3200, 2650, 6900, 1500, 600, 3127, 3290 },
[XX_COLOR_MANAGER_V4_PRIMARIES_ADOBE_RGB] = { 6400, 3300, 2100, 7100, 1500, 600, 3127, 3290 },
};
static const uint *
wl_primaries_to_primaries (enum xx_color_manager_v4_primaries primaries)
{
return primaries_primaries[primaries];
}
static gboolean
primaries_to_wl_primaries (const uint primaries[8],
enum xx_color_manager_v4_primaries *out_primaries)
{
guint i, j;
for (i = 0; i < G_N_ELEMENTS (primaries_primaries); i++)
{
for (j = 0; j < 8; j++)
{
if (primaries[j] != primaries_primaries[i][j])
break;
}
if (j == 8)
{
*out_primaries = i;
return TRUE;
}
}
return FALSE;
}
static const uint transfer_map[] = {
static uint transfer_map[] = {
[XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_BT709] = 1,
[XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_GAMMA22] = 4,
[XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_GAMMA28] = 5,
@@ -341,8 +299,7 @@ create_image_desc (GdkWaylandColor *color,
primaries = cicp_to_wl_primaries (norm.color_primaries);
tf = cicp_to_wl_transfer (norm.transfer_function);
if (((color->color_manager_supported.primaries & (1 << primaries)) == 0 &&
(color->color_manager_supported.features & (1 << XX_COLOR_MANAGER_V4_FEATURE_SET_PRIMARIES)) == 0) ||
if ((color->color_manager_supported.primaries & (1 << primaries)) == 0 ||
(color->color_manager_supported.transfers & (1 << tf)) == 0)
{
GDK_DEBUG (MISC, "Unsupported color state %s: Primaries or transfer function unsupported",
@@ -358,19 +315,7 @@ create_image_desc (GdkWaylandColor *color,
creator = xx_color_manager_v4_new_parametric_creator (color->color_manager);
if (color->color_manager_supported.primaries & (1 << primaries))
{
xx_image_description_creator_params_v4_set_primaries_named (creator, primaries);
}
else
{
const uint *p = wl_primaries_to_primaries (primaries);
xx_image_description_creator_params_v4_set_primaries (creator,
p[0], p[1],
p[2], p[3],
p[4], p[5],
p[6], p[7]);
}
xx_image_description_creator_params_v4_set_primaries_named (creator, primaries);
xx_image_description_creator_params_v4_set_tf_named (creator, tf);
desc = xx_image_description_creator_params_v4_create (creator);
@@ -449,8 +394,7 @@ gdk_wayland_color_prepare (GdkWaylandColor *color)
if (color->color_manager &&
(!(color->color_manager_supported.features & (1 << XX_COLOR_MANAGER_V4_FEATURE_PARAMETRIC)) ||
!(color->color_manager_supported.transfers & (1 << XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_SRGB)) ||
!((color->color_manager_supported.primaries & (1 << XX_COLOR_MANAGER_V4_PRIMARIES_SRGB)) ||
(color->color_manager_supported.features & (1 << XX_COLOR_MANAGER_V4_FEATURE_SET_PRIMARIES)))))
!(color->color_manager_supported.primaries & (1 << XX_COLOR_MANAGER_V4_PRIMARIES_SRGB))))
{
GDK_DEBUG (MISC, "Not using color management: Can't create srgb image description");
@@ -464,8 +408,7 @@ gdk_wayland_color_prepare (GdkWaylandColor *color)
if (color->color_manager_supported.transfers & (1 << XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_LINEAR))
create_image_desc (color, GDK_COLOR_STATE_SRGB_LINEAR, FALSE);
if ((color->color_manager_supported.primaries & (1 << XX_COLOR_MANAGER_V4_PRIMARIES_BT2020) ||
(color->color_manager_supported.features & (1 << XX_COLOR_MANAGER_V4_FEATURE_SET_PRIMARIES))))
if (color->color_manager_supported.primaries & (1 << XX_COLOR_MANAGER_V4_PRIMARIES_BT2020))
{
if (color->color_manager_supported.transfers & (1 << XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_ST2084_PQ))
create_image_desc (color, GDK_COLOR_STATE_REC2100_PQ, FALSE);
@@ -483,12 +426,11 @@ struct _GdkWaylandColorSurface
GdkWaylandColor *color;
struct xx_color_management_surface_v4 *surface;
struct xx_color_management_feedback_surface_v4 *feedback;
ImageDescription *current_desc;
GdkColorStateChanged callback;
gpointer data;
};
struct _ImageDescription
typedef struct
{
GdkWaylandColorSurface *surface;
@@ -518,7 +460,7 @@ struct _ImageDescription
unsigned int has_target_luminance : 1;
unsigned int has_target_max_cll : 1;
unsigned int has_target_max_fall : 1;
};
} ImageDescription;
static GdkColorState *
gdk_color_state_from_image_description_bits (ImageDescription *desc)
@@ -538,21 +480,6 @@ gdk_color_state_from_image_description_bits (ImageDescription *desc)
return NULL;
}
static void
gdk_wayland_color_surface_clear_image_desc (GdkWaylandColorSurface *self)
{
ImageDescription *desc = self->current_desc;
if (desc == NULL)
return;
g_clear_pointer (&desc->image_desc, xx_image_description_v4_destroy);
g_clear_pointer (&desc->info, xx_image_description_info_v4_destroy);
g_free (desc);
self->current_desc = NULL;
}
static void
image_desc_info_done (void *data,
struct xx_image_description_info_v4 *info)
@@ -561,8 +488,6 @@ image_desc_info_done (void *data,
GdkWaylandColorSurface *self = desc->surface;
GdkColorState *cs;
g_assert (self->current_desc == desc);
cs = gdk_color_state_from_image_description_bits (desc);
if (cs)
{
@@ -573,7 +498,7 @@ image_desc_info_done (void *data,
else
{
cs = GDK_COLOR_STATE_SRGB;
g_clear_pointer (&desc->image_desc, xx_image_description_v4_destroy);
xx_image_description_v4_destroy (desc->image_desc);
}
if (self->callback)
@@ -581,7 +506,8 @@ image_desc_info_done (void *data,
gdk_color_state_unref (cs);
gdk_wayland_color_surface_clear_image_desc (self);
xx_image_description_info_v4_destroy (desc->info);
g_free (desc);
}
static void
@@ -612,9 +538,6 @@ image_desc_info_primaries (void *data,
desc->b_x = b_x; desc->r_y = b_y;
desc->w_x = w_x; desc->r_y = w_y;
desc->has_primaries = 1;
if (primaries_to_wl_primaries ((uint[]) { r_x, r_y, g_x, g_y, b_x, b_y, w_x, w_y },
&desc->primaries))
desc->has_primaries_named = 1;
}
static void
@@ -623,16 +546,9 @@ image_desc_info_primaries_named (void *data,
uint32_t primaries)
{
ImageDescription *desc = data;
const uint *p;
desc->primaries = primaries;
desc->has_primaries_named = 1;
desc->has_primaries = 1;
p = wl_primaries_to_primaries (primaries);
desc->r_x = p[0]; desc->r_y = p[1];
desc->g_x = p[2]; desc->r_y = p[3];
desc->b_x = p[4]; desc->r_y = p[5];
desc->w_x = p[6]; desc->r_y = p[7];
}
static void
@@ -747,11 +663,10 @@ image_desc_failed (void *data,
ImageDescription *desc = data;
GdkWaylandColorSurface *self = desc->surface;
g_assert (self->current_desc == desc);
self->callback (self, GDK_COLOR_STATE_SRGB, self->data);
gdk_wayland_color_surface_clear_image_desc (self);
xx_image_description_v4_destroy (desc->image_desc);
g_free (desc);
}
static void
@@ -763,14 +678,13 @@ image_desc_ready (void *data,
GdkWaylandColorSurface *self = desc->surface;
GdkColorState *cs;
g_assert (self->current_desc == desc);
cs = g_hash_table_lookup (self->color->id_to_cs, GUINT_TO_POINTER (identity));
if (cs)
{
self->callback (self, cs, self->data);
gdk_wayland_color_surface_clear_image_desc (self);
xx_image_description_v4_destroy (desc->image_desc);
g_free (desc);
return;
}
@@ -795,13 +709,9 @@ preferred_changed (void *data,
if (!self->callback)
return;
/* If there's still an ongoing query, cancel it. It's outdated. */
gdk_wayland_color_surface_clear_image_desc (self);
desc = g_new0 (ImageDescription, 1);
desc->surface = self;
self->current_desc = desc;
desc->image_desc = xx_color_management_feedback_surface_v4_get_preferred (self->feedback);
@@ -839,8 +749,6 @@ gdk_wayland_color_surface_new (GdkWaylandColor *color,
void
gdk_wayland_color_surface_free (GdkWaylandColorSurface *self)
{
gdk_wayland_color_surface_clear_image_desc (self);
xx_color_management_surface_v4_destroy (self->surface);
xx_color_management_feedback_surface_v4_destroy (self->feedback);
+51 -57
View File
@@ -561,70 +561,64 @@ G_DEFINE_TYPE (GdkWin32Display, gdk_win32_display, GDK_TYPE_DISPLAY)
static const char *
gdk_win32_display_get_name (GdkDisplay *display)
{
HDESK hdesk = GetThreadDesktop (GetCurrentThreadId ());
char dummy;
char *desktop_name;
HWINSTA hwinsta = GetProcessWindowStation ();
char *window_station_name;
DWORD n;
DWORD session_id;
char *display_name;
static const char *display_name_cache = NULL;
typedef BOOL (WINAPI *PFN_ProcessIdToSessionId) (DWORD, DWORD *);
PFN_ProcessIdToSessionId processIdToSessionId;
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
if (g_once_init_enter (&display_name_cache))
if (display_name_cache != NULL)
return display_name_cache;
n = 0;
GetUserObjectInformation (hdesk, UOI_NAME, &dummy, 0, &n);
if (n == 0)
desktop_name = "Default";
else
{
HDESK hdesk = GetThreadDesktop (GetCurrentThreadId ());
char dummy;
char dummy_dword[11];
wchar_t *desktop_name;
HWINSTA hwinsta = GetProcessWindowStation ();
wchar_t *window_station_name;
DWORD n;
DWORD session_id;
wchar_t *display_name_w;
char *display_name;
size_t wchar_size;
size_t display_name_len = 0;
n++;
desktop_name = g_alloca (n + 1);
memset (desktop_name, 0, n + 1);
n = 0;
GetUserObjectInformation (hdesk, UOI_NAME, &dummy, 0, &n);
wchar_size = sizeof (wchar_t);
if (n == 0)
desktop_name = L"Default";
else
{
n++;
desktop_name = g_alloca ((n + 1) * wchar_size);
memset (desktop_name, 0, (n + 1) * wchar_size);
if (!GetUserObjectInformation (hdesk, UOI_NAME, desktop_name, n, &n))
desktop_name = L"Default";
}
n = 0;
GetUserObjectInformation (hwinsta, UOI_NAME, &dummy, 0, &n);
if (n == 0)
window_station_name = L"WinSta0";
else
{
n++;
window_station_name = g_alloca ((n + 1) * wchar_size);
memset (window_station_name, 0, (n + 1) * wchar_size);
if (!GetUserObjectInformation (hwinsta, UOI_NAME, window_station_name, n, &n))
window_station_name = L"WinSta0";
}
if (!ProcessIdToSessionId (GetCurrentProcessId (), &session_id))
session_id = 0;
/* display_name is in the form of "%ld\\%s\\%s" */
display_name_len = strlen (itoa (session_id, dummy_dword, 10)) + 1 + wcslen (window_station_name) + 1 + wcslen (desktop_name);
display_name_w = g_alloca ((display_name_len + 1) * wchar_size);
memset (display_name_w, 0, (display_name_len + 1) * wchar_size);
swprintf_s (display_name_w, display_name_len + 1, L"%ld\\%s\\%s", session_id, window_station_name, desktop_name);
display_name = g_utf16_to_utf8 (display_name_w, -1, NULL, NULL, NULL);
GDK_NOTE (MISC, g_print ("gdk_win32_display_get_name: %s\n", display_name));
g_once_init_leave (&display_name_cache, display_name);
if (!GetUserObjectInformation (hdesk, UOI_NAME, desktop_name, n, &n))
desktop_name = "Default";
}
n = 0;
GetUserObjectInformation (hwinsta, UOI_NAME, &dummy, 0, &n);
if (n == 0)
window_station_name = "WinSta0";
else
{
n++;
window_station_name = g_alloca (n + 1);
memset (window_station_name, 0, n + 1);
if (!GetUserObjectInformation (hwinsta, UOI_NAME, window_station_name, n, &n))
window_station_name = "WinSta0";
}
processIdToSessionId = (PFN_ProcessIdToSessionId) GetProcAddress (GetModuleHandle (L"kernel32.dll"), "ProcessIdToSessionId");
if (!processIdToSessionId || !processIdToSessionId (GetCurrentProcessId (), &session_id))
session_id = 0;
display_name = g_strdup_printf ("%ld\\%s\\%s",
session_id,
window_station_name,
desktop_name);
GDK_NOTE (MISC, g_print ("gdk_win32_display_get_name: %s\n", display_name));
display_name_cache = display_name;
return display_name_cache;
}
@@ -1208,7 +1202,7 @@ gdk_win32_display_init_gl (GdkDisplay *display,
* Disable defaulting to EGL as EGL is used more as a compatibility layer
* on Windows rather than being a native citizen on Windows
*/
if (!gdk_has_feature (GDK_FEATURE_WGL) || !gdk_has_feature (GDK_FEATURE_GL_API))
if (gdk_display_get_debug_flags (display) & (GDK_DEBUG_GL_EGL|GDK_DEBUG_GL_DISABLE_GL))
{
init_gl_hdc = GetDC (display_win32->hwnd);
+1 -2
View File
@@ -134,8 +134,7 @@ struct _GdkWin32Display
guint hasWglEXTSwapControl : 1;
guint hasWglOMLSyncControl : 1;
guint hasWglARBPixelFormat : 1;
guint hasGlWINSwapHint : 1;
guint wgl_support_gdi : 1;
guint force_enable_depth_bits : 1;
#ifdef HAVE_EGL
guint hasEglKHRCreateContext : 1;
+79 -456
View File
@@ -41,24 +41,12 @@
#include <cairo.h>
#include <epoxy/wgl.h>
/* libepoxy doesn't know about GL_WIN_swap_hint */
typedef void (WINAPI *glAddSwapHintRectWIN_t) (GLint, GLint, GLsizei, GLsizei);
struct _GdkWin32GLContextWGL
{
GdkWin32GLContext parent_instance;
HGLRC wgl_context;
guint do_frame_sync : 1;
guint double_buffered : 1;
enum {
SWAP_METHOD_UNDEFINED = 0,
SWAP_METHOD_COPY,
SWAP_METHOD_EXCHANGE,
} swap_method;
glAddSwapHintRectWIN_t ptr_glAddSwapHintRectWIN;
};
typedef struct _GdkWin32GLContextClass GdkWin32GLContextWGLClass;
@@ -92,7 +80,6 @@ gdk_win32_gl_context_wgl_end_frame (GdkDrawContext *draw_context,
GdkWin32GLContextWGL *context_wgl = GDK_WIN32_GL_CONTEXT_WGL (context);
GdkSurface *surface = gdk_gl_context_get_surface (context);
GdkWin32Display *display_win32 = (GDK_WIN32_DISPLAY (gdk_gl_context_get_display (context)));
GdkWin32Surface *surface_win32 = GDK_WIN32_SURFACE (surface);
gboolean can_wait = display_win32->hasWglOMLSyncControl;
HDC hdc;
@@ -103,37 +90,10 @@ gdk_win32_gl_context_wgl_end_frame (GdkDrawContext *draw_context,
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "win32", "swap buffers");
if (surface != NULL)
hdc = surface_win32->hdc;
hdc = GDK_WIN32_SURFACE (surface)->hdc;
else
hdc = display_win32->dummy_context_wgl.hdc;
/* context->old_updated_area[0] contains this frame's updated region
* (what actually changed since the previous frame) */
if (context_wgl->ptr_glAddSwapHintRectWIN &&
GDK_GL_MAX_TRACKED_BUFFERS >= 1 &&
context->old_updated_area[0])
{
int num_rectangles = cairo_region_num_rectangles (context->old_updated_area[0]);
int scale = surface_win32->surface_scale;
cairo_rectangle_int_t rectangle;
for (int i = 0; i < num_rectangles; i++)
{
cairo_region_get_rectangle (context->old_updated_area[0], i, &rectangle);
/* glAddSwapHintRectWIN works in OpenGL buffer coordinates and uses OpenGL
* conventions. Coordinates are that of the client-area, but the origin is
* at the lower-left corner; rectangles are passed by their lower-left corner
*/
rectangle.y = surface->height - rectangle.y - rectangle.height;
context_wgl->ptr_glAddSwapHintRectWIN (rectangle.x * scale,
rectangle.y * scale,
rectangle.width * scale,
rectangle.height * scale);
}
}
if (context_wgl->do_frame_sync)
{
@@ -161,27 +121,6 @@ gdk_win32_gl_context_wgl_empty_frame (GdkDrawContext *draw_context)
{
}
static cairo_region_t *
gdk_win32_gl_context_wgl_get_damage (GdkGLContext *gl_context)
{
GdkWin32GLContextWGL *self = GDK_WIN32_GL_CONTEXT_WGL (gl_context);
if (!self->double_buffered ||
self->swap_method == SWAP_METHOD_COPY)
{
return cairo_region_create ();
}
if (self->swap_method == SWAP_METHOD_EXCHANGE &&
GDK_GL_MAX_TRACKED_BUFFERS >= 1 &&
gl_context->old_updated_area[0])
{
return cairo_region_reference (gl_context->old_updated_area[0]);
}
return GDK_GL_CONTEXT_CLASS (gdk_win32_gl_context_wgl_parent_class)->get_damage (gl_context);
}
static void
gdk_win32_gl_context_wgl_begin_frame (GdkDrawContext *draw_context,
GdkMemoryDepth depth,
@@ -194,301 +133,7 @@ gdk_win32_gl_context_wgl_begin_frame (GdkDrawContext *draw_context,
GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_wgl_parent_class)->begin_frame (draw_context, depth, update_area, out_color_state, out_depth);
}
typedef struct {
GArray *array;
guint committed;
} attribs_t;
static void
attribs_init (attribs_t *attribs,
guint reserved)
{
attribs->array = g_array_sized_new (TRUE, FALSE, sizeof (int), reserved);
attribs->committed = 0;
}
static void
attribs_commit (attribs_t *attribs)
{
g_assert_true (attribs->array->len % 2 == 0);
attribs->committed = attribs->array->len;
}
static void
attribs_reset (attribs_t *attribs)
{
g_array_set_size (attribs->array, attribs->committed);
}
static void
attribs_add_bulk (attribs_t *attribs,
const int *array,
int n_elements)
{
g_assert (n_elements >= 0);
g_assert_true (n_elements % 2 == 0);
g_array_append_vals (attribs->array, array, n_elements);
}
static void
attribs_add (attribs_t *attribs,
int key,
int value)
{
int array[2] = {key, value};
attribs_add_bulk (attribs, array, G_N_ELEMENTS (array));
}
static bool
attribs_remove_last (attribs_t *attribs)
{
g_assert (attribs->array->len % 2 == 0);
if (attribs->array->len > attribs->committed)
{
g_array_set_size (attribs->array, attribs->array->len - 2);
return true;
}
return false;
}
static const int *
attribs_data (attribs_t *attribs)
{
return (const int *) attribs->array->data;
}
static void
attribs_fini (attribs_t *attribs)
{
g_array_free (attribs->array, TRUE);
}
#define attribs_add_static_array(attribs, array) \
do attribs_add_bulk (attribs, array, G_N_ELEMENTS (array)); while (0)
static int
find_pixel_format_with_defined_swap_flag (HDC hdc,
int formats[],
UINT count)
{
for (UINT i = 0; i < count; i++)
{
int query = WGL_SWAP_METHOD_ARB;
int value = WGL_SWAP_UNDEFINED_ARB;
SetLastError (0);
if (!wglGetPixelFormatAttribivARB (hdc, formats[i], 0, 1, &query, &value))
{
WIN32_API_FAILED ("wglGetPixelFormatAttribivARB");
continue;
}
if (value != WGL_SWAP_UNDEFINED_ARB)
return formats[i];
}
return 0;
}
static int
choose_pixel_format_arb_attribs (GdkWin32Display *display_win32,
HDC hdc)
{
const int attribs_base[] = {
WGL_DRAW_TO_WINDOW_ARB,
GL_TRUE,
WGL_SUPPORT_OPENGL_ARB,
GL_TRUE,
WGL_DOUBLE_BUFFER_ARB,
GL_TRUE,
WGL_ACCELERATION_ARB,
WGL_FULL_ACCELERATION_ARB,
WGL_PIXEL_TYPE_ARB,
WGL_TYPE_RGBA_ARB,
WGL_COLOR_BITS_ARB,
32,
WGL_ALPHA_BITS_ARB,
8,
};
const int attribs_ancillary_buffers[] = {
WGL_STENCIL_BITS_ARB,
0,
WGL_ACCUM_BITS_ARB,
0,
WGL_DEPTH_BITS_ARB,
0,
};
attribs_t attribs;
int formats[4];
UINT count = 0;
int format = 0;
int saved = 0;
#define EXT_CALL(api, args) \
do { \
memset (formats, 0, sizeof (formats)); \
count = G_N_ELEMENTS (formats); \
\
if (!api args || count > G_N_ELEMENTS (formats)) \
{ \
count = 0; \
} \
} \
while (0)
const guint reserved = G_N_ELEMENTS (attribs_base) +
G_N_ELEMENTS (attribs_ancillary_buffers) +
1;
attribs_init (&attribs, reserved);
attribs_add_static_array (&attribs, attribs_base);
if (display_win32->wgl_support_gdi)
attribs_add (&attribs, WGL_SUPPORT_GDI_ARB, GL_TRUE);
attribs_commit (&attribs);
attribs_add_static_array (&attribs, attribs_ancillary_buffers);
do
{
EXT_CALL (wglChoosePixelFormatARB, (hdc, attribs_data (&attribs), NULL,
G_N_ELEMENTS (formats), formats,
&count));
}
while (count == 0 && attribs_remove_last (&attribs));
if (count == 0)
goto done;
attribs_commit (&attribs);
/* That's an usable pixel format, save it */
saved = formats[0];
/* Do we have a defined swap method? */
format = find_pixel_format_with_defined_swap_flag (hdc, formats, count);
if (format > 0)
goto done;
/* Nope, but we can try to ask for it explicitly */
const int swap_methods[] = {
WGL_SWAP_EXCHANGE_ARB,
WGL_SWAP_COPY_ARB,
};
for (size_t i = 0; i < G_N_ELEMENTS (swap_methods); i++)
{
attribs_add (&attribs, WGL_SWAP_METHOD_ARB, swap_methods[i]);
EXT_CALL (wglChoosePixelFormatARB, (hdc, attribs_data (&attribs), NULL,
G_N_ELEMENTS (formats), formats,
&count));
format = find_pixel_format_with_defined_swap_flag (hdc, formats, count);
if (format > 0)
goto done;
attribs_reset (&attribs);
}
done:
attribs_fini (&attribs);
if (format == 0)
return saved;
return format;
#undef EXT_CALL
}
static int
get_distance (PIXELFORMATDESCRIPTOR *pfd)
{
const DWORD swap_flags = PFD_SWAP_COPY | PFD_SWAP_EXCHANGE;
int is_double_buffered = (pfd->dwFlags & PFD_DOUBLEBUFFER) != 0;
int is_swap_defined = (pfd->dwFlags & swap_flags) != 0;
int is_mono = (pfd->dwFlags & PFD_STEREO) == 0;
int ancillary_bits = pfd->cStencilBits + pfd->cDepthBits + pfd->cAccumBits;
int quality_distance = !is_double_buffered * 1000;
int performance_distance = !is_swap_defined * 200;
int memory_distance = !is_mono + ancillary_bits;
return quality_distance +
performance_distance +
memory_distance;
}
/* ChoosePixelFormat ignored some fields and flags, which makes it
* less useful for GTK. In particular, it ignores the PFD_SWAP flags,
* which are very important for GUI toolkits. Here we implement an
* analog function which is tied to the needs of GTK.
*
* Note that ChoosePixelFormat is not implemented by the ICD, it's
* implemented in OpenGL32.DLL (though the driver can influence the
* outcome by ordering pixel formats in specific ways.
*/
static int
choose_pixel_format_opengl32 (GdkWin32Display *display_win32,
HDC hdc)
{
const DWORD skip_flags = PFD_GENERIC_FORMAT |
PFD_GENERIC_ACCELERATED;
const DWORD required_flags = PFD_DRAW_TO_WINDOW |
PFD_SUPPORT_OPENGL |
(display_win32->wgl_support_gdi ? PFD_SUPPORT_GDI : 0);
struct {
int index;
int distance;
} best = { 0, 1, }, current;
PIXELFORMATDESCRIPTOR pfd;
int count = DescribePixelFormat (hdc, 1, sizeof (pfd), NULL);
for (current.index = 1; current.index <= count && best.distance > 0; current.index++)
{
if (DescribePixelFormat (hdc, current.index, sizeof (pfd), &pfd) <= 0)
{
WIN32_API_FAILED ("DescribePixelFormat");
return 0;
}
if ((pfd.dwFlags & skip_flags) != 0 ||
(pfd.dwFlags & required_flags) != required_flags)
continue;
if (pfd.iPixelType != PFD_TYPE_RGBA ||
(pfd.cRedBits != 8 || pfd.cGreenBits != 8 ||
pfd.cBlueBits != 8 || pfd.cAlphaBits != 8))
continue;
current.distance = get_distance (&pfd);
if (best.index == 0 || current.distance < best.distance)
best = current;
}
return best.index;
}
#define PIXEL_ATTRIBUTES 21
static int
get_wgl_pfd (HDC hdc,
@@ -497,12 +142,58 @@ get_wgl_pfd (HDC hdc,
{
int best_pf = 0;
pfd->nSize = sizeof (PIXELFORMATDESCRIPTOR);
if (display_win32->hasWglARBPixelFormat)
{
UINT num_formats;
int colorbits = GetDeviceCaps (hdc, BITSPIXEL);
int i = 0;
int pixelAttribs[PIXEL_ATTRIBUTES];
/* Save up the HDC and HGLRC that we are currently using, to restore back to it when we are done here */
HDC hdc_current = wglGetCurrentDC ();
HGLRC hglrc_current = wglGetCurrentContext ();
/* Update PIXEL_ATTRIBUTES above if any groups are added here! */
pixelAttribs[i++] = WGL_DRAW_TO_WINDOW_ARB;
pixelAttribs[i++] = GL_TRUE;
pixelAttribs[i++] = WGL_SUPPORT_OPENGL_ARB;
pixelAttribs[i++] = GL_TRUE;
pixelAttribs[i++] = WGL_DOUBLE_BUFFER_ARB;
pixelAttribs[i++] = GL_TRUE;
pixelAttribs[i++] = WGL_ACCELERATION_ARB;
pixelAttribs[i++] = WGL_FULL_ACCELERATION_ARB;
pixelAttribs[i++] = WGL_PIXEL_TYPE_ARB;
pixelAttribs[i++] = WGL_TYPE_RGBA_ARB;
pixelAttribs[i++] = WGL_COLOR_BITS_ARB;
pixelAttribs[i++] = colorbits;
pixelAttribs[i++] = WGL_ALPHA_BITS_ARB;
pixelAttribs[i++] = 8;
pixelAttribs[i++] = WGL_STENCIL_BITS_ARB;
pixelAttribs[i++] = 0;
pixelAttribs[i++] = WGL_ACCUM_BITS_ARB;
pixelAttribs[i++] = 0;
if (!display_win32->force_enable_depth_bits)
{
pixelAttribs[i++] = WGL_DEPTH_BITS_ARB;
pixelAttribs[i++] = 0;
}
/* end of "Update PIXEL_ATTRIBUTES above if any groups are added here!" */
pixelAttribs[i++] = 0; /* end of pixelAttribs */
g_assert (i == PIXEL_ATTRIBUTES);
if (!wglMakeCurrent (display_win32->dummy_context_wgl.hdc,
display_win32->dummy_context_wgl.hglrc))
{
@@ -510,17 +201,38 @@ get_wgl_pfd (HDC hdc,
return 0;
}
best_pf = choose_pixel_format_arb_attribs (display_win32, hdc);
wglChoosePixelFormatARB (hdc,
pixelAttribs,
NULL,
1,
&best_pf,
&num_formats);
/* Go back to the HDC that we were using, since we are done with the dummy HDC and GL Context */
wglMakeCurrent (hdc_current, hglrc_current);
}
else
{
best_pf = choose_pixel_format_opengl32 (display_win32, hdc);
pfd->nVersion = 1;
pfd->dwFlags = PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER;
pfd->iPixelType = PFD_TYPE_RGBA;
pfd->cColorBits = GetDeviceCaps (hdc, BITSPIXEL);
pfd->cAlphaBits = 8;
pfd->iLayerType = PFD_MAIN_PLANE;
pfd->cAccumBits = 0;
pfd->cStencilBits = 0;
if (best_pf > 0)
DescribePixelFormat (hdc, best_pf, sizeof (PIXELFORMATDESCRIPTOR), pfd);
if (!display_win32->force_enable_depth_bits)
pfd->cDepthBits = 0;
best_pf = ChoosePixelFormat (hdc, pfd);
/* try again if driver enforces depth buffers */
if (best_pf == 0 && !display_win32->force_enable_depth_bits)
{
display_win32->force_enable_depth_bits = TRUE;
get_wgl_pfd (hdc, pfd, display_win32);
}
}
return best_pf;
@@ -594,18 +306,6 @@ create_dummy_gl_window (void)
return hwnd;
}
static bool
check_driver_is_d3d12 (void)
{
const char *vendor = (const char *) glGetString (GL_VENDOR);
const char *renderer = (const char *) glGetString (GL_RENDERER);
return vendor != NULL &&
g_ascii_strncasecmp (vendor, "MICROSOFT", strlen ("MICROSOFT")) == 0 &&
renderer != NULL &&
g_ascii_strncasecmp (renderer, "D3D12", strlen ("D3D12")) == 0;
}
GdkGLContext *
gdk_win32_display_init_wgl (GdkDisplay *display,
GError **error)
@@ -655,10 +355,6 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
epoxy_has_wgl_extension (hdc, "WGL_OML_sync_control");
display_win32->hasWglARBPixelFormat =
epoxy_has_wgl_extension (hdc, "WGL_ARB_pixel_format");
display_win32->hasGlWINSwapHint =
epoxy_has_gl_extension ("GL_WIN_swap_hint");
display_win32->wgl_support_gdi = check_driver_is_d3d12();
context = g_object_new (GDK_TYPE_WIN32_GL_CONTEXT_WGL,
"display", display,
@@ -669,33 +365,25 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
return NULL;
}
gdk_gl_context_make_current (context);
{
int major, minor;
gdk_gl_context_get_version (context, &major, &minor);
GDK_NOTE (OPENGL, g_print ("WGL API version %d.%d found\n"
" - Vendor: %s\n"
" - Renderer: %s\n"
" - GDI compatibility required: %s\n"
" - Checked extensions:\n"
"\t* WGL_ARB_pixel_format: %s\n"
"\t* WGL_ARB_create_context: %s\n"
"\t* WGL_EXT_swap_control: %s\n"
"\t* WGL_OML_sync_control: %s\n"
"\t* GL_WIN_swap_hint: %s\n",
"\t* WGL_OML_sync_control: %s\n",
major, minor,
glGetString (GL_VENDOR),
glGetString (GL_RENDERER),
display_win32->wgl_support_gdi ? "yes" : "no",
display_win32->hasWglARBPixelFormat ? "yes" : "no",
display_win32->hasWglARBCreateContext ? "yes" : "no",
display_win32->hasWglEXTSwapControl ? "yes" : "no",
display_win32->hasWglOMLSyncControl ? "yes" : "no",
display_win32->hasGlWINSwapHint ? "yes" : "no"));
display_win32->hasWglOMLSyncControl ? "yes" : "no"));
}
gdk_gl_context_clear_current ();
wglMakeCurrent (NULL, NULL);
return context;
}
@@ -769,7 +457,7 @@ create_wgl_context_with_attribs (HDC hdc,
GDK_NOTE (OPENGL,
g_print ("Creating %s WGL context (version:%d.%d, debug:%s, forward:%s)\n",
is_legacy ? "compat" : "core",
is_legacy ? "core" : "compat",
gdk_gl_version_get_major (version),
gdk_gl_version_get_minor (version),
(flags & WGL_CONTEXT_DEBUG_BIT_ARB) ? "yes" : "no",
@@ -1072,77 +760,13 @@ gdk_win32_gl_context_wgl_realize (GdkGLContext *context,
if (hglrc == NULL)
return 0;
context_wgl->wgl_context = hglrc;
HDC hdc_current = wglGetCurrentDC ();
HGLRC hglrc_current = wglGetCurrentContext ();
if (wglMakeCurrent (hdc, hglrc))
{
if (display_win32->hasWglARBPixelFormat)
{
/* wglChoosePixelFormatARB should match these attributes exactly
* as requested, according to the spec, but better check anyway */
int query_attribs[] = {
WGL_DOUBLE_BUFFER_ARB,
WGL_SWAP_METHOD_ARB,
};
int query_values[G_N_ELEMENTS (query_attribs)];
memset (query_values, 0, sizeof (query_values));
if (wglGetPixelFormatAttribivARB (hdc, pixel_format, 0, G_N_ELEMENTS (query_attribs), query_attribs, query_values))
{
context_wgl->double_buffered = (query_values[0] == GL_TRUE);
switch (query_values[1])
{
case WGL_SWAP_COPY_ARB:
context_wgl->swap_method = SWAP_METHOD_COPY;
break;
case WGL_SWAP_EXCHANGE_ARB:
context_wgl->swap_method = SWAP_METHOD_EXCHANGE;
break;
default:
context_wgl->swap_method = SWAP_METHOD_UNDEFINED;
break;
}
}
}
else
{
PIXELFORMATDESCRIPTOR pfd = {0};
if (DescribePixelFormat (hdc, pixel_format, sizeof (pfd), &pfd))
{
context_wgl->double_buffered = (pfd.dwFlags & PFD_DOUBLEBUFFER) != 0;
if (pfd.dwFlags & PFD_SWAP_COPY)
context_wgl->swap_method = SWAP_METHOD_COPY;
else if (pfd.dwFlags & PFD_SWAP_EXCHANGE)
context_wgl->swap_method = SWAP_METHOD_EXCHANGE;
else
context_wgl->swap_method = SWAP_METHOD_UNDEFINED;
}
}
if (display_win32->hasGlWINSwapHint)
{
context_wgl->ptr_glAddSwapHintRectWIN = (glAddSwapHintRectWIN_t)
wglGetProcAddress ("glAddSwapHintRectWIN");
}
}
wglMakeCurrent (hdc_current, hglrc_current);
if (context_wgl->swap_method == SWAP_METHOD_UNDEFINED)
g_message ("Unknown swap method");
GDK_NOTE (OPENGL,
g_print ("Created WGL context[%p], pixel_format=%d\n",
hglrc,
pixel_format));
context_wgl->wgl_context = hglrc;
return GDK_GL_API_GL;
}
@@ -1212,7 +836,6 @@ gdk_win32_gl_context_wgl_class_init (GdkWin32GLContextWGLClass *klass)
context_class->make_current = gdk_win32_gl_context_wgl_make_current;
context_class->clear_current = gdk_win32_gl_context_wgl_clear_current;
context_class->is_current = gdk_win32_gl_context_wgl_is_current;
context_class->get_damage = gdk_win32_gl_context_wgl_get_damage;
draw_context_class->begin_frame = gdk_win32_gl_context_wgl_begin_frame;
draw_context_class->end_frame = gdk_win32_gl_context_wgl_end_frame;
+1 -19
View File
@@ -4483,13 +4483,8 @@ _gdk_win32_surface_compute_size (GdkSurface *surface)
if (!impl->drag_move_resize_context.native_move_resize_pending)
{
bool size_changed;
if (GDK_IS_TOPLEVEL (surface) && impl->force_recompute_size)
{
size_changed = width != surface->width ||
height != surface->height;
surface->width = width;
surface->height = height;
gdk_win32_surface_resize (surface, width, height);
@@ -4497,15 +4492,11 @@ _gdk_win32_surface_compute_size (GdkSurface *surface)
}
else
{
size_changed = width != impl->next_layout.configured_width ||
height != impl->next_layout.configured_height;
surface->width = impl->next_layout.configured_width;
surface->height = impl->next_layout.configured_height;
}
if (size_changed)
_gdk_surface_update_size (surface);
_gdk_surface_update_size (surface);
}
return FALSE;
@@ -5089,15 +5080,6 @@ gdk_win32_surface_apply_queued_move_resize (GdkSurface *surface,
GDK_NOTE (EVENTS, g_print (" ... set window position\n"));
/*
* Workaround situations in the current Win32 surface resize code that may have notified GDK
* too late for resizes, which manifests on nVidia drivers (and AMD drivers in mailbox
* presentation mode) running under Vulkan when one interactively enlarges the surface (HWND).
*
* See MR !7562 for more details
*/
_gdk_surface_update_size (surface);
return;
}
+4 -7
View File
@@ -1472,7 +1472,7 @@ gdk_x11_display_open (const char *display_name)
}
#endif
/* initialize the display's screens */
/* initialize the display's screens */
display_x11->screen = _gdk_x11_screen_new (display, DefaultScreen (display_x11->xdisplay));
/* If GL is available we want to pick better default/rgba visuals,
@@ -1484,11 +1484,8 @@ gdk_x11_display_open (const char *display_name)
*/
if (!gdk_display_prepare_gl (display, NULL))
{
if (!display_x11->leader_gdk_surface)
{
gdk_x11_display_query_default_visual (display_x11, &display_x11->window_visual, &display_x11->window_depth);
gdk_x11_display_init_leader_surface (display_x11);
}
gdk_x11_display_query_default_visual (display_x11, &display_x11->window_visual, &display_x11->window_depth);
gdk_x11_display_init_leader_surface (display_x11);
}
#ifdef HAVE_XFIXES
@@ -3024,7 +3021,7 @@ gdk_x11_display_init_gl (GdkDisplay *display,
GdkX11Display *self = GDK_X11_DISPLAY (display);
if (!gdk_x11_display_init_gl_backend (self, &self->window_visual, &self->window_depth, error))
return NULL;
return FALSE;
gdk_x11_display_init_leader_surface (self);
+17 -7
View File
@@ -84,13 +84,10 @@ gdk_x11_surface_get_glx_drawable (GdkSurface *surface)
void
gdk_x11_surface_destroy_glx_drawable (GdkX11Surface *self)
{
GdkGLContext *context;
if (self->glx_drawable == None)
return;
context = gdk_gl_context_clear_current_if_surface (GDK_SURFACE (self));
g_clear_object (&context);
gdk_gl_context_clear_current_if_surface (GDK_SURFACE (self));
glXDestroyWindow (gdk_x11_display_get_xdisplay (gdk_surface_get_display (GDK_SURFACE (self))),
self->glx_drawable);
@@ -123,6 +120,20 @@ maybe_wait_for_vblank (GdkDisplay *display,
}
}
static GLXDrawable
gdk_x11_gl_context_glx_get_drawable (GdkX11GLContextGLX *self)
{
GdkDrawContext *draw_context = GDK_DRAW_CONTEXT (self);
GdkSurface *surface;
if (gdk_draw_context_is_in_frame (draw_context))
surface = gdk_draw_context_get_surface (draw_context);
else
surface = GDK_X11_DISPLAY (gdk_draw_context_get_display (draw_context))->leader_gdk_surface;
return gdk_x11_surface_get_glx_drawable (surface);
}
static void
gdk_x11_gl_context_glx_end_frame (GdkDrawContext *draw_context,
cairo_region_t *painted)
@@ -307,11 +318,10 @@ gdk_x11_gl_context_glx_get_damage (GdkGLContext *context)
if (display_x11->has_glx_buffer_age)
{
GdkSurface *surface = gdk_draw_context_get_surface (GDK_DRAW_CONTEXT (context));
GdkX11GLContextGLX *self = GDK_X11_GL_CONTEXT_GLX (context);
gdk_gl_context_make_current (context);
glXQueryDrawable (dpy,
gdk_x11_surface_get_glx_drawable (surface),
glXQueryDrawable (dpy, gdk_x11_gl_context_glx_get_drawable (self),
GLX_BACK_BUFFER_AGE_EXT, &buffer_age);
if (buffer_age > 0 && buffer_age <= GDK_GL_MAX_TRACKED_BUFFERS)
+2 -2
View File
@@ -934,7 +934,7 @@ gsk_broadway_renderer_render (GskRenderer *renderer,
self->node_lookup = g_hash_table_new (g_direct_hash, g_direct_equal);
gdk_draw_context_begin_frame_full (GDK_DRAW_CONTEXT (self->draw_context), GDK_MEMORY_U8, update_area, NULL);
gdk_draw_context_begin_frame (GDK_DRAW_CONTEXT (self->draw_context), update_area);
/* These are owned by the draw context between begin and end, but
cache them here for easier access during the render */
@@ -946,7 +946,7 @@ gsk_broadway_renderer_render (GskRenderer *renderer,
self->nodes = NULL;
self->node_textures = NULL;
gdk_draw_context_end_frame_full (GDK_DRAW_CONTEXT (self->draw_context));
gdk_draw_context_end_frame (GDK_DRAW_CONTEXT (self->draw_context));
if (self->last_node_lookup)
g_hash_table_unref (self->last_node_lookup);
+4 -4
View File
@@ -133,7 +133,7 @@ void half_to_float4 (const guint16 h[4], float f[4]) __attribute__((ifunc ("reso
void float_to_half (const float *f, guint16 *h, int n) __attribute__((ifunc ("resolve_float_to_half")));
void half_to_float (const guint16 *h, float *f, int n) __attribute__((ifunc ("resolve_half_to_float")));
static void * __attribute__ ((no_sanitize_address)) G_GNUC_UNUSED
static void * __attribute__ ((no_sanitize_address))
resolve_float_to_half4 (void)
{
__builtin_cpu_init ();
@@ -143,7 +143,7 @@ resolve_float_to_half4 (void)
return float_to_half4_c;
}
static void * __attribute__ ((no_sanitize_address)) G_GNUC_UNUSED
static void * __attribute__ ((no_sanitize_address))
resolve_half_to_float4 (void)
{
__builtin_cpu_init ();
@@ -153,7 +153,7 @@ resolve_half_to_float4 (void)
return half_to_float4_c;
}
static void * __attribute__ ((no_sanitize_address)) G_GNUC_UNUSED
static void * __attribute__ ((no_sanitize_address))
resolve_float_to_half (void)
{
__builtin_cpu_init ();
@@ -163,7 +163,7 @@ resolve_float_to_half (void)
return float_to_half_c;
}
static void * __attribute__ ((no_sanitize_address)) G_GNUC_UNUSED
static void * __attribute__ ((no_sanitize_address))
resolve_half_to_float (void)
{
__builtin_cpu_init ();
+3 -6
View File
@@ -217,9 +217,6 @@ gsk_gl_driver_dispose (GObject *object)
g_assert (GSK_IS_GL_DRIVER (self));
g_assert (self->in_frame == FALSE);
if (self->shared_command_queue)
gsk_gl_command_queue_make_current (self->shared_command_queue);
#define GSK_GL_NO_UNIFORMS
#define GSK_GL_SHADER_RESOURCE(name)
#define GSK_GL_SHADER_STRING(str)
@@ -1842,14 +1839,14 @@ gsk_gl_driver_create_gdk_texture (GskGLDriver *self,
state = g_new0 (GskGLTextureState, 1);
state->texture_id = texture_id;
state->context = g_object_ref (self->shared_command_queue->context);
if (gdk_gl_context_has_feature (self->shared_command_queue->context, GDK_GL_FEATURE_SYNC))
state->context = g_object_ref (self->command_queue->context);
if (gdk_gl_context_has_feature (self->command_queue->context, GDK_GL_FEATURE_SYNC))
state->sync = glFenceSync (GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
g_hash_table_steal (self->textures, GUINT_TO_POINTER (texture_id));
builder = gdk_gl_texture_builder_new ();
gdk_gl_texture_builder_set_context (builder, self->shared_command_queue->context);
gdk_gl_texture_builder_set_context (builder, self->command_queue->context);
gdk_gl_texture_builder_set_id (builder, texture_id);
gdk_gl_texture_builder_set_format (builder, format);
gdk_gl_texture_builder_set_width (builder, texture->width);
+70 -19
View File
@@ -192,12 +192,12 @@ gsk_gl_renderer_realize (GskRenderer *renderer,
g_assert (self->context == NULL);
g_assert (self->command_queue == NULL);
if (!gdk_display_prepare_gl (display, error))
goto failure;
if (surface == NULL)
context = gdk_display_create_gl_context (display, error);
else
context = gdk_surface_create_gl_context (surface, error);
context = gdk_gl_context_new (display, surface, surface != NULL);
if (!gdk_gl_context_realize (context, error))
if (!context || !gdk_gl_context_realize (context, error))
goto failure;
api = gdk_gl_context_get_api (context);
@@ -258,8 +258,6 @@ gsk_gl_renderer_unrealize (GskRenderer *renderer)
g_clear_object (&self->driver);
g_clear_object (&self->command_queue);
g_clear_object (&self->context);
gdk_gl_context_clear_current ();
}
static cairo_region_t *
@@ -295,6 +293,65 @@ get_render_region (GdkSurface *surface,
return cairo_region_create_rectangle (&extents);
}
static gboolean
update_area_requires_clear (GdkSurface *surface,
const cairo_region_t *update_area)
{
cairo_rectangle_int_t rect;
guint n_rects;
g_assert (GDK_IS_SURFACE (surface));
/* No opaque region, assume we have to clear */
if (surface->opaque_region == NULL)
return TRUE;
/* If the update_area is the whole surface, then clear it
* because many drivers optimize for this by avoiding extra
* work to reload any contents.
*/
if (update_area == NULL)
return TRUE;
if (cairo_region_num_rectangles (update_area) == 1)
{
cairo_region_get_rectangle (update_area, 0, &rect);
if (rect.x == 0 &&
rect.y == 0 &&
rect.width == surface->width &&
rect.height == surface->height)
return TRUE;
}
/* If the entire surface is opaque, then we can skip clearing
* (with the exception of full surface clearing above).
*/
if (cairo_region_num_rectangles (surface->opaque_region) == 1)
{
cairo_region_get_rectangle (surface->opaque_region, 0, &rect);
if (rect.x == 0 &&
rect.y == 0 &&
rect.width == surface->width &&
rect.height == surface->height)
return FALSE;
}
/* If any update_area rectangle overlaps our transparent
* regions, then we need to clear the area.
*/
n_rects = cairo_region_num_rectangles (update_area);
for (guint i = 0; i < n_rects; i++)
{
cairo_region_get_rectangle (update_area, i, &rect);
if (cairo_region_contains_rectangle (surface->opaque_region, &rect) != CAIRO_REGION_OVERLAP_IN)
return TRUE;
}
return FALSE;
}
static void
gsk_gl_renderer_render (GskRenderer *renderer,
GskRenderNode *root,
@@ -305,8 +362,7 @@ gsk_gl_renderer_render (GskRenderer *renderer,
graphene_rect_t viewport;
GskGLRenderJob *job;
GdkSurface *surface;
graphene_rect_t opaque_tmp;
const graphene_rect_t *opaque;
gboolean clear_framebuffer;
float scale;
g_assert (GSK_IS_GL_RENDERER (renderer));
@@ -326,27 +382,23 @@ gsk_gl_renderer_render (GskRenderer *renderer,
viewport.size.width = gdk_surface_get_width (surface) * scale;
viewport.size.height = gdk_surface_get_height (surface) * scale;
if (gsk_render_node_get_opaque_rect (root, &opaque_tmp))
opaque = &opaque_tmp;
else
opaque = NULL;
gdk_draw_context_begin_frame_full (GDK_DRAW_CONTEXT (self->context),
gsk_render_node_get_preferred_depth (root),
update_area,
opaque);
update_area);
gdk_gl_context_make_current (self->context);
/* Must be called *AFTER* gdk_draw_context_begin_frame() */
render_region = get_render_region (surface, self->context);
clear_framebuffer = update_area_requires_clear (surface, render_region);
gsk_gl_driver_begin_frame (self->driver, self->command_queue);
job = gsk_gl_render_job_new (self->driver, &viewport, scale, render_region, 0, TRUE);
job = gsk_gl_render_job_new (self->driver, &viewport, scale, render_region, 0, clear_framebuffer);
gsk_gl_render_job_render (job, root);
gsk_gl_driver_end_frame (self->driver);
gsk_gl_render_job_free (job);
gdk_draw_context_end_frame_full (GDK_DRAW_CONTEXT (self->context));
gdk_draw_context_end_frame (GDK_DRAW_CONTEXT (self->context));
gsk_gl_driver_after_frame (self->driver);
@@ -407,8 +459,7 @@ gsk_gl_renderer_render_texture (GskRenderer *renderer,
/* Don't use float textures for SRGB or node-editor turns on high
* depth unconditionally. */
if (gsk_render_node_get_preferred_depth (root) != GDK_MEMORY_NONE &&
gsk_render_node_get_preferred_depth (root) != GDK_MEMORY_U8 &&
if (gsk_render_node_get_preferred_depth (root) != GDK_MEMORY_U8 &&
gsk_render_node_get_preferred_depth (root) != GDK_MEMORY_U8_SRGB &&
gdk_gl_context_check_version (self->context, "3.0", "3.0"))
{
+8 -22
View File
@@ -2182,10 +2182,6 @@ gsk_gl_render_job_visit_unblurred_inset_shadow_node (GskGLRenderJob *job,
if (gsk_gl_render_job_begin_draw (job, CHOOSE_PROGRAM (job, inset_shadow)))
{
const GdkRGBA rgba;
gdk_color_to_float (gsk_inset_shadow_node_get_color2 (node), GDK_COLOR_STATE_SRGB, (float *) &rgba);
gsk_gl_program_set_uniform_rounded_rect (job->current_program,
UNIFORM_INSET_SHADOW_OUTLINE_RECT, 0,
&transformed_outline);
@@ -2196,7 +2192,7 @@ gsk_gl_render_job_visit_unblurred_inset_shadow_node (GskGLRenderJob *job,
UNIFORM_INSET_SHADOW_OFFSET, 0,
gsk_inset_shadow_node_get_dx (node),
gsk_inset_shadow_node_get_dy (node));
rgba_to_half (&rgba, color);
rgba_to_half (gsk_inset_shadow_node_get_color (node), color);
gsk_gl_render_job_draw_rect_with_color (job, &node->bounds, color);
gsk_gl_render_job_end_draw (job);
}
@@ -2289,10 +2285,6 @@ gsk_gl_render_job_visit_blurred_inset_shadow_node (GskGLRenderJob *job,
/* Actual inset shadow outline drawing */
if (gsk_gl_render_job_begin_draw (job, CHOOSE_PROGRAM (job, inset_shadow)))
{
const GdkRGBA rgba;
gdk_color_to_float (gsk_inset_shadow_node_get_color2 (node), GDK_COLOR_STATE_SRGB, (float *) &rgba);
gsk_gl_program_set_uniform_rounded_rect (job->current_program,
UNIFORM_INSET_SHADOW_OUTLINE_RECT, 0,
&transformed_outline);
@@ -2303,7 +2295,7 @@ gsk_gl_render_job_visit_blurred_inset_shadow_node (GskGLRenderJob *job,
UNIFORM_INSET_SHADOW_OFFSET, 0,
offset_x * scale_x,
offset_y * scale_y);
rgba_to_half (&rgba, color);
rgba_to_half (gsk_inset_shadow_node_get_color (node), color);
gsk_gl_render_job_draw_with_color (job,
0, 0, texture_width, texture_height,
color);
@@ -2386,7 +2378,6 @@ gsk_gl_render_job_visit_unblurred_outset_shadow_node (GskGLRenderJob *job,
float spread = gsk_outset_shadow_node_get_spread (node);
float dx = gsk_outset_shadow_node_get_dx (node);
float dy = gsk_outset_shadow_node_get_dy (node);
GdkRGBA rgba;
guint16 color[4];
const float edge_sizes[] = { // Top, right, bottom, left
spread - dy, spread + dx, spread + dy, spread - dx
@@ -2398,8 +2389,7 @@ gsk_gl_render_job_visit_unblurred_outset_shadow_node (GskGLRenderJob *job,
{ outline->corner[3].width + spread - dx, outline->corner[3].height + spread + dy },
};
gdk_color_to_float (gsk_outset_shadow_node_get_color2 (node), GDK_COLOR_STATE_SRGB, (float *) &rgba);
rgba_to_half (&rgba, color);
rgba_to_half (gsk_outset_shadow_node_get_color (node), color);
gsk_gl_render_job_translate_rounded_rect (job, outline, &transformed_outline);
@@ -2483,13 +2473,11 @@ gsk_gl_render_job_visit_blurred_outset_shadow_node (GskGLRenderJob *job,
int blurred_texture_id;
int cached_tid;
gboolean do_slicing;
GdkRGBA rgba;
guint16 color[4];
float half_width = outline->bounds.size.width / 2;
float half_height = outline->bounds.size.height / 2;
gdk_color_to_float (gsk_outset_shadow_node_get_color2 (node), GDK_COLOR_STATE_SRGB, (float *) &rgba);
rgba_to_half (&rgba, color);
rgba_to_half (gsk_outset_shadow_node_get_color (node), color);
/* scaled_outline is the minimal outline we need to draw the given drop shadow,
* enlarged by the spread and offset by the blur radius. */
@@ -4221,12 +4209,10 @@ gsk_gl_render_job_visit_node (GskGLRenderJob *job,
break;
case GSK_TEXT_NODE:
{
GdkRGBA rgba;
gdk_color_to_float (gsk_text_node_get_color2 (node), GDK_COLOR_STATE_SRGB, (float *) &rgba);
gsk_gl_render_job_visit_text_node (job, node, &rgba, FALSE);
}
gsk_gl_render_job_visit_text_node (job,
node,
gsk_text_node_get_color (node),
FALSE);
break;
case GSK_TEXTURE_NODE:
+3 -3
View File
@@ -75,10 +75,10 @@ void main() {
if (offset < next_offset) {
float f = (offset - curr_offset) / (next_offset - curr_offset);
vec4 curr_color = gsk_scaled_premultiply (get_color(i), u_alpha);
vec4 next_color = gsk_scaled_premultiply (get_color(i + 1), u_alpha);
vec4 curr_color = get_color(i);
vec4 next_color = get_color(i + 1);
vec4 color = mix(curr_color, next_color, f);
gskSetOutputColor(color);
gskSetScaledOutputColor(gsk_premultiply(color), u_alpha);
return;
}
}
+3 -3
View File
@@ -97,10 +97,10 @@ void main() {
if (offset < next_offset) {
float f = (offset - curr_offset) / (next_offset - curr_offset);
vec4 curr_color = gsk_scaled_premultiply (get_color(i), u_alpha);
vec4 next_color = gsk_scaled_premultiply (get_color(i + 1), u_alpha);
vec4 curr_color = get_color(i);
vec4 next_color = get_color(i + 1);
vec4 color = mix(curr_color, next_color, f);
gskSetOutputColor(color);
gskSetScaledOutputColor(gsk_premultiply (color), u_alpha);
return;
}
}
+3 -3
View File
@@ -77,10 +77,10 @@ void main() {
if (offset < next_offset) {
float f = (offset - curr_offset) / (next_offset - curr_offset);
vec4 curr_color = gsk_scaled_premultiply (get_color(i), u_alpha);
vec4 next_color = gsk_scaled_premultiply (get_color(i + 1), u_alpha);
vec4 curr_color = get_color(i);
vec4 next_color = get_color(i + 1);
vec4 color = mix(curr_color, next_color, f);
gskSetOutputColor(color);
gskSetScaledOutputColor(gsk_premultiply(color), u_alpha);
return;
}
}
+11 -11
View File
@@ -46,7 +46,7 @@ gsk_gl_image_finalize (GObject *object)
if (self->texture_id && self->framebuffer_id)
glDeleteFramebuffers (1, &self->framebuffer_id);
if (gsk_gpu_image_get_flags (GSK_GPU_IMAGE (self)) & GSK_GPU_IMAGE_TOGGLE_REF)
if (self->owns_texture)
glDeleteTextures (1, &self->texture_id);
G_OBJECT_CLASS (gsk_gl_image_parent_class)->finalize (object);
@@ -336,17 +336,17 @@ gsk_gl_image_get_gl_type (GskGLImage *self)
}
GLuint
gsk_gl_image_get_texture_id (GskGLImage *self)
gsk_gl_image_steal_texture (GskGLImage *self)
{
return self->texture_id;
}
void
gsk_gl_image_steal_texture_ownership (GskGLImage *self)
{
g_assert (self->texture_id);
g_assert (self->owns_texture);
self->owns_texture = FALSE;
}
if (self->framebuffer_id)
{
glDeleteFramebuffers (1, &self->framebuffer_id);
self->framebuffer_id = 0;
}
self->owns_texture = FALSE;
return self->texture_id;
}
+1 -2
View File
@@ -39,7 +39,6 @@ GLint gsk_gl_image_get_gl_internal_format (GskGLIm
GLenum gsk_gl_image_get_gl_format (GskGLImage *self);
GLenum gsk_gl_image_get_gl_type (GskGLImage *self);
GLuint gsk_gl_image_get_texture_id (GskGLImage *self);
void gsk_gl_image_steal_texture_ownership (GskGLImage *self);
GLuint gsk_gl_image_steal_texture (GskGLImage *self);
G_END_DECLS
+40 -31
View File
@@ -53,21 +53,22 @@ static const GskGpuShaderOpClass GSK_GPU_BLUR_OP_CLASS = {
gsk_gpu_blur_setup_vao
};
void
gsk_gpu_blur_op (GskGpuFrame *frame,
GskGpuShaderClip clip,
GdkColorState *ccs,
float opacity,
const graphene_point_t *offset,
const GskGpuShaderImage *image,
const graphene_vec2_t *blur_direction)
static void
gsk_gpu_blur_op_full (GskGpuFrame *frame,
GskGpuShaderClip clip,
GskGpuColorStates color_states,
guint32 variation,
const graphene_point_t *offset,
const GskGpuShaderImage *image,
const graphene_vec2_t *blur_direction,
float blur_color[4])
{
GskGpuBlurInstance *instance;
gsk_gpu_shader_op_alloc (frame,
&GSK_GPU_BLUR_OP_CLASS,
gsk_gpu_color_states_create_equal (TRUE, TRUE),
0,
color_states,
variation,
clip,
(GskGpuImage *[1]) { image->image },
(GskGpuSampler[1]) { image->sampler },
@@ -76,35 +77,43 @@ gsk_gpu_blur_op (GskGpuFrame *frame,
gsk_gpu_rect_to_float (image->coverage, offset, instance->rect);
gsk_gpu_rect_to_float (image->bounds, offset, instance->tex_rect);
graphene_vec2_to_float (blur_direction, instance->blur_direction);
gsk_gpu_vec4_to_float (blur_color, instance->blur_color);
}
void
gsk_gpu_blur_op (GskGpuFrame *frame,
GskGpuShaderClip clip,
GskGpuColorStates color_states,
const graphene_point_t *offset,
const GskGpuShaderImage *image,
const graphene_vec2_t *blur_direction)
{
gsk_gpu_blur_op_full (frame,
clip,
color_states,
0,
offset,
image,
blur_direction,
(float[4]) { 1, 1, 1, 1 });
}
void
gsk_gpu_blur_shadow_op (GskGpuFrame *frame,
GskGpuShaderClip clip,
GdkColorState *ccs,
float opacity,
GskGpuColorStates color_states,
const graphene_point_t *offset,
const GskGpuShaderImage *image,
const graphene_vec2_t *blur_direction,
const GdkColor *shadow_color)
float shadow_color[4])
{
GskGpuBlurInstance *instance;
GdkColorState *alt;
alt = gsk_gpu_color_states_find (ccs, shadow_color);
gsk_gpu_shader_op_alloc (frame,
&GSK_GPU_BLUR_OP_CLASS,
gsk_gpu_color_states_create (ccs, TRUE, alt, FALSE),
VARIATION_COLORIZE,
clip,
(GskGpuImage *[1]) { image->image },
(GskGpuSampler[1]) { image->sampler },
&instance);
gsk_gpu_rect_to_float (image->coverage, offset, instance->rect);
gsk_gpu_rect_to_float (image->bounds, offset, instance->tex_rect);
graphene_vec2_to_float (blur_direction, instance->blur_direction);
gsk_gpu_color_to_float (shadow_color, alt, opacity, instance->blur_color);
gsk_gpu_blur_op_full (frame,
clip,
color_states,
VARIATION_COLORIZE,
offset,
image,
blur_direction,
shadow_color);
}

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