Compare commits
1 Commits
offload-li
...
inline-vec
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd06452b0f |
BIN
.gitlab-ci/.fedora.Dockerfile.swp
Normal file
@@ -2,6 +2,8 @@ FROM fedora:39
|
||||
|
||||
RUN dnf -y install \
|
||||
adwaita-icon-theme \
|
||||
atk-devel \
|
||||
at-spi2-atk-devel \
|
||||
avahi-gobject-devel \
|
||||
cairo-devel \
|
||||
cairo-gobject-devel \
|
||||
@@ -16,6 +18,7 @@ RUN dnf -y install \
|
||||
dejavu-sans-mono-fonts \
|
||||
desktop-file-utils \
|
||||
diffutils \
|
||||
docbook-style-xsl \
|
||||
elfutils-libelf-devel \
|
||||
expat-devel \
|
||||
fribidi-devel \
|
||||
|
||||
@@ -19,6 +19,7 @@ flatpak build ${builddir} meson \
|
||||
--buildtype=debugoptimized \
|
||||
-Dx11-backend=true \
|
||||
-Dwayland-backend=true \
|
||||
-Dvulkan=disabled \
|
||||
-Dbuild-tests=false \
|
||||
-Dbuild-testsuite=false \
|
||||
-Dbuild-examples=false \
|
||||
|
||||
@@ -34,8 +34,7 @@ pacman --noconfirm -S --needed \
|
||||
mingw-w64-$MSYS2_ARCH-shared-mime-info \
|
||||
mingw-w64-$MSYS2_ARCH-python-gobject \
|
||||
mingw-w64-$MSYS2_ARCH-shaderc \
|
||||
mingw-w64-$MSYS2_ARCH-vulkan \
|
||||
mingw-w64-$MSYS2_ARCH-vulkan-headers
|
||||
mingw-w64-$MSYS2_ARCH-vulkan
|
||||
|
||||
mkdir -p _ccache
|
||||
export CCACHE_BASEDIR="$(pwd)"
|
||||
@@ -45,7 +44,7 @@ export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
|
||||
ccache --zero-stats
|
||||
ccache --show-stats
|
||||
export CCACHE_DISABLE=true
|
||||
meson setup \
|
||||
meson \
|
||||
-Dx11-backend=false \
|
||||
-Dwayland-backend=false \
|
||||
-Dwin32-backend=true \
|
||||
|
||||
93
NEWS
@@ -1,97 +1,6 @@
|
||||
Overview of Changes in 4.15.0, xx-xx-xxxx
|
||||
Overview of Changes in 4.14.1, xx-xx-xxxx
|
||||
=========================================
|
||||
|
||||
Overview of Changes in 4.14.2, 03-04-2024
|
||||
=========================================
|
||||
|
||||
* GtkScale:
|
||||
- Improve positioning of values in some cases
|
||||
|
||||
* Theme:
|
||||
- Make progress in entries visible
|
||||
|
||||
* Accessibility:
|
||||
- Fix text insertion handling
|
||||
|
||||
* GDK:
|
||||
- dnd: Use the default cursor durion motion
|
||||
- dnd: Use a better cursor for indicating the move action
|
||||
|
||||
* GSK:
|
||||
- gl: Handle offloads in offscreen context better
|
||||
- Fix text rendering problems with some fonts
|
||||
|
||||
* Wayland:
|
||||
- Tighten up some protocol version checks
|
||||
- Use the presentation time protocol
|
||||
- Fix a crash with subsurfaces
|
||||
- Improve settings portal handling
|
||||
|
||||
* macOS:
|
||||
- Fix up the app menu support
|
||||
|
||||
* Windows:
|
||||
- Fix problems with minimization
|
||||
- Fix build without fontconfig
|
||||
|
||||
* Debugging:
|
||||
- Add font settings in the inspector
|
||||
|
||||
* Demos:
|
||||
- Clean up the application demo
|
||||
- Update cursor images for the cursor demo
|
||||
|
||||
* Translation updates:
|
||||
Catalan
|
||||
Czech
|
||||
French
|
||||
Georgian
|
||||
Hebrew
|
||||
Persian
|
||||
Slovenian
|
||||
Turkish
|
||||
Ukrainian
|
||||
|
||||
|
||||
Overview of Changes in 4.14.1, 16-03-2024
|
||||
=========================================
|
||||
|
||||
* GtkTextView:
|
||||
- Fix a mixup of cursor and anchor when retrieving surrounding text
|
||||
in input methods
|
||||
|
||||
* Printing:
|
||||
- Avoid accessing freed printers
|
||||
|
||||
* Accessibility:
|
||||
- Fix memory leaks
|
||||
|
||||
* GDK:
|
||||
- Rename the GDK_VULKAN_SKIP environment variable to GDK_VULKAN_DISABLE
|
||||
- Add a GDK_GL_DISABLE environment variable
|
||||
|
||||
* GSK:
|
||||
- Rename the GSK_GPU_SKIP environment variable to GSK_GPU_DISABLE
|
||||
- Speed up handling of repeated ops, which should help for text
|
||||
- Speed up the inner loop of text node conversion
|
||||
- Drop the glyph-align optimization flag
|
||||
- ngl: Avoid reusing frames while they are in use
|
||||
- Fix flickering thumbnails in nautilus
|
||||
- Speed up buffer handling in both ngl and Vulkan
|
||||
|
||||
* Demos:
|
||||
- Skip demos using gl shaders when we're not using the gl renderer
|
||||
|
||||
* Build:
|
||||
- Fix some ubsan warnings
|
||||
- Avoid zink in ci since it spams stderr
|
||||
|
||||
* Translation updates:
|
||||
Czech
|
||||
German
|
||||
Korean
|
||||
Russian
|
||||
|
||||
|
||||
Overview of Changes in 4.14.0, 12-03-2024
|
||||
=========================================
|
||||
|
||||
@@ -125,7 +125,7 @@ version, for example `gtk-4-10`.
|
||||
How to report bugs
|
||||
------------------
|
||||
|
||||
Bugs should be reported on the [issues page](https://gitlab.gnome.org/GNOME/gtk/issues/).
|
||||
Bugs should be reported on the [issues page](https://gitlab.gnome.org/GNOME/gtk/issues/new).
|
||||
|
||||
In the bug report please include:
|
||||
|
||||
|
||||
@@ -185,6 +185,7 @@
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dvulkan=disabled",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Ddemo-profile=devel"
|
||||
],
|
||||
|
||||
@@ -114,6 +114,7 @@
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dvulkan=disabled",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Ddemo-profile=devel"
|
||||
],
|
||||
|
||||
@@ -114,6 +114,7 @@
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dvulkan=disabled",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Ddemo-profile=devel"
|
||||
],
|
||||
@@ -130,6 +131,7 @@
|
||||
"env" : {
|
||||
"DBUS_SESSION_BUS_ADDRESS" : "''",
|
||||
"GSK_RENDERER" : "opengl",
|
||||
"GDK_DEBUG" : "vulkan-disable",
|
||||
"G_ENABLE_DEBUG" : "true"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,6 +114,7 @@
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dvulkan=disabled",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Ddemo-profile=devel"
|
||||
],
|
||||
@@ -130,6 +131,7 @@
|
||||
"env" : {
|
||||
"DBUS_SESSION_BUS_ADDRESS" : "''",
|
||||
"GSK_RENDERER" : "opengl",
|
||||
"GDK_DEBUG" : "vulkan-disable",
|
||||
"G_ENABLE_DEBUG" : "true"
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
@@ -15,54 +15,12 @@ on_destroy (gpointer data)
|
||||
window = NULL;
|
||||
}
|
||||
|
||||
static GdkTexture *
|
||||
cursor_callback (GdkCursor *cursor,
|
||||
int cursor_size,
|
||||
double scale,
|
||||
int *width,
|
||||
int *height,
|
||||
int *hotspot_x,
|
||||
int *hotspot_y,
|
||||
gpointer data)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkTexture *texture;
|
||||
GError *error = NULL;
|
||||
int scaled_size;
|
||||
|
||||
scaled_size = ceil (cursor_size * scale);
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_resource_at_scale ("/cursors/images/gtk-logo.svg",
|
||||
scaled_size, scaled_size,
|
||||
TRUE,
|
||||
&error);
|
||||
if (!pixbuf)
|
||||
{
|
||||
g_print ("%s\n", error->message);
|
||||
g_error_free (error);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
||||
|
||||
g_object_unref (pixbuf);
|
||||
|
||||
*width = cursor_size;
|
||||
*height = cursor_size;
|
||||
*hotspot_x = 18 * cursor_size / 32.0;
|
||||
*hotspot_y = 2 * cursor_size / 32.0;
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_cursors (GtkWidget *do_widget)
|
||||
{
|
||||
if (!window)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
GtkWidget *logo_callback;
|
||||
GdkCursor *cursor;
|
||||
|
||||
builder = gtk_builder_new_from_resource ("/cursors/cursors.ui");
|
||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
||||
@@ -71,10 +29,6 @@ do_cursors (GtkWidget *do_widget)
|
||||
gtk_widget_get_display (do_widget));
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (on_destroy), NULL);
|
||||
logo_callback = GTK_WIDGET (gtk_builder_get_object (builder, "logo_callback"));
|
||||
cursor = gdk_cursor_new_from_callback (cursor_callback, NULL, NULL, NULL);
|
||||
gtk_widget_set_cursor (logo_callback, cursor);
|
||||
g_object_unref (cursor);
|
||||
g_object_unref (builder);
|
||||
}
|
||||
|
||||
|
||||
@@ -116,7 +116,6 @@
|
||||
<file>w_resize_cursor.png</file>
|
||||
<file>zoom_in_cursor.png</file>
|
||||
<file>zoom_out_cursor.png</file>
|
||||
<file>gtk-logo.svg</file>
|
||||
</gresource>
|
||||
<gresource prefix="/dnd">
|
||||
<file>dnd.css</file>
|
||||
|
||||
@@ -184,12 +184,6 @@ create_cogs (void)
|
||||
return picture;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
check_cogs (GtkFishbowl *fb)
|
||||
{
|
||||
return GSK_IS_GL_RENDERER (gtk_native_get_renderer (gtk_widget_get_native (GTK_WIDGET (fb))));
|
||||
}
|
||||
|
||||
static void
|
||||
mapped (GtkWidget *w)
|
||||
{
|
||||
@@ -224,41 +218,36 @@ create_graph (void)
|
||||
|
||||
static const struct {
|
||||
const char *name;
|
||||
GtkWidget * (* create_func) (void);
|
||||
gboolean (* check) (GtkFishbowl *fb);
|
||||
GtkWidget * (*create_func) (void);
|
||||
} widget_types[] = {
|
||||
{ "Icon", create_icon, NULL },
|
||||
{ "Button", create_button, NULL },
|
||||
{ "Blurbutton", create_blurred_button, NULL },
|
||||
{ "Fontbutton", create_font_button, NULL },
|
||||
{ "Levelbar", create_level_bar, NULL },
|
||||
{ "Label", create_label, NULL },
|
||||
{ "Spinner", create_spinner, NULL },
|
||||
{ "Spinbutton", create_spinbutton, NULL },
|
||||
{ "Video", create_video, NULL },
|
||||
{ "Gears", create_gears, NULL },
|
||||
{ "Switch", create_switch, NULL },
|
||||
{ "Menubutton", create_menu_button, NULL },
|
||||
{ "Shader", create_cogs, check_cogs },
|
||||
{ "Tiger", create_tiger, NULL },
|
||||
{ "Graph", create_graph, NULL },
|
||||
{ "Icon", create_icon },
|
||||
{ "Button", create_button },
|
||||
{ "Blurbutton", create_blurred_button },
|
||||
{ "Fontbutton", create_font_button },
|
||||
{ "Levelbar", create_level_bar },
|
||||
{ "Label", create_label },
|
||||
{ "Spinner", create_spinner },
|
||||
{ "Spinbutton", create_spinbutton },
|
||||
{ "Video", create_video },
|
||||
{ "Gears", create_gears },
|
||||
{ "Switch", create_switch },
|
||||
{ "Menubutton", create_menu_button },
|
||||
{ "Shader", create_cogs },
|
||||
{ "Tiger", create_tiger },
|
||||
{ "Graph", create_graph },
|
||||
};
|
||||
|
||||
static int selected_widget_type = -1;
|
||||
static const int N_WIDGET_TYPES = G_N_ELEMENTS (widget_types);
|
||||
|
||||
static gboolean
|
||||
static void
|
||||
set_widget_type (GtkFishbowl *fishbowl,
|
||||
int widget_type_index)
|
||||
{
|
||||
GtkWidget *window;
|
||||
|
||||
if (widget_type_index == selected_widget_type)
|
||||
return TRUE;
|
||||
|
||||
if (widget_types[widget_type_index].check != NULL &&
|
||||
!widget_types[widget_type_index].check (fishbowl))
|
||||
return FALSE;
|
||||
return;
|
||||
|
||||
selected_widget_type = widget_type_index;
|
||||
|
||||
@@ -268,8 +257,6 @@ set_widget_type (GtkFishbowl *fishbowl,
|
||||
window = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (fishbowl)));
|
||||
gtk_window_set_title (GTK_WINDOW (window),
|
||||
widget_types[selected_widget_type].name);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT void
|
||||
@@ -277,17 +264,14 @@ fishbowl_next_button_clicked_cb (GtkButton *source,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkFishbowl *fishbowl = user_data;
|
||||
int new_index = selected_widget_type;
|
||||
int new_index;
|
||||
|
||||
do
|
||||
{
|
||||
if (new_index + 1 >= N_WIDGET_TYPES)
|
||||
new_index = 0;
|
||||
else
|
||||
new_index = new_index + 1;
|
||||
if (selected_widget_type + 1 >= N_WIDGET_TYPES)
|
||||
new_index = 0;
|
||||
else
|
||||
new_index = selected_widget_type + 1;
|
||||
|
||||
}
|
||||
while (!set_widget_type (fishbowl, new_index));
|
||||
set_widget_type (fishbowl, new_index);
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT void
|
||||
@@ -295,18 +279,14 @@ fishbowl_prev_button_clicked_cb (GtkButton *source,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkFishbowl *fishbowl = user_data;
|
||||
int new_index = selected_widget_type;
|
||||
int new_index;
|
||||
|
||||
do
|
||||
{
|
||||
if (new_index - 1 < 0)
|
||||
new_index = N_WIDGET_TYPES - 1;
|
||||
else
|
||||
new_index = new_index - 1;
|
||||
if (selected_widget_type - 1 < 0)
|
||||
new_index = N_WIDGET_TYPES - 1;
|
||||
else
|
||||
new_index = selected_widget_type - 1;
|
||||
|
||||
}
|
||||
|
||||
while (!set_widget_type (fishbowl, new_index));
|
||||
set_widget_type (fishbowl, new_index);
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT void
|
||||
|
||||
@@ -1,138 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="128"
|
||||
height="128"
|
||||
id="svg6843"
|
||||
sodipodi:version="0.32"
|
||||
inkscape:version="0.92.4 5da689c313, 2019-01-14"
|
||||
version="1.0"
|
||||
sodipodi:docname="gtk-logo.svg"
|
||||
inkscape:output_extension="org.inkscape.output.svg.inkscape"
|
||||
inkscape:export-filename="/home/ebassi/Pictures/gtk-logo-256.png"
|
||||
inkscape:export-xdpi="192"
|
||||
inkscape:export-ydpi="192">
|
||||
<defs
|
||||
id="defs6845">
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="-50 : 600 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_z="700 : 600 : 1"
|
||||
inkscape:persp3d-origin="300 : 400 : 1"
|
||||
id="perspective13" />
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="2.8284271"
|
||||
inkscape:cx="69.874353"
|
||||
inkscape:cy="64.313526"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:document-units="px"
|
||||
inkscape:grid-bbox="true"
|
||||
width="128px"
|
||||
height="128px"
|
||||
showguides="true"
|
||||
inkscape:guide-bbox="true"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1016"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="27"
|
||||
inkscape:window-maximized="1">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid7947" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata6848">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title />
|
||||
<dc:date />
|
||||
<dc:creator>
|
||||
<cc:Agent>
|
||||
<dc:title />
|
||||
</cc:Agent>
|
||||
</dc:creator>
|
||||
<dc:rights>
|
||||
<cc:Agent>
|
||||
<dc:title />
|
||||
</cc:Agent>
|
||||
</dc:rights>
|
||||
<dc:publisher>
|
||||
<cc:Agent>
|
||||
<dc:title />
|
||||
</cc:Agent>
|
||||
</dc:publisher>
|
||||
<dc:identifier />
|
||||
<dc:source />
|
||||
<dc:relation />
|
||||
<dc:language />
|
||||
<dc:subject>
|
||||
<rdf:Bag />
|
||||
</dc:subject>
|
||||
<dc:coverage />
|
||||
<dc:description />
|
||||
<dc:contributor>
|
||||
<cc:Agent>
|
||||
<dc:title />
|
||||
</cc:Agent>
|
||||
</dc:contributor>
|
||||
<cc:license
|
||||
rdf:resource="" />
|
||||
</cc:Work>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
id="layer1"
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer">
|
||||
<path
|
||||
sodipodi:nodetypes="ccccc"
|
||||
id="path6976"
|
||||
d="M 20.88413,30.82696 L 53.816977,55.527708 L 107.33282,39.060543 L 70.587303,17.177763 L 20.88413,30.82696 z"
|
||||
style="fill:#729fcf;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:2.12364459;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline" />
|
||||
<path
|
||||
id="path6978"
|
||||
d="M 22.94243,82.287118 L 20.88413,30.82696 L 53.816977,55.527708 L 53.816977,111.10486 L 22.94243,82.287118 z"
|
||||
style="fill:#e40000;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:2.12364459;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline" />
|
||||
<path
|
||||
id="path6980"
|
||||
d="M 53.816977,111.10486 L 103.21619,90.5207 L 107.33282,39.060543 L 53.816977,55.527708 L 53.816977,111.10486 z"
|
||||
style="fill:#7fe719;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:2.12364459;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline" />
|
||||
<path
|
||||
sodipodi:nodetypes="ccc"
|
||||
id="path6982"
|
||||
d="M 23.216626,81.319479 L 70.48573,67.361442 L 103.38422,90.444516"
|
||||
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<path
|
||||
sodipodi:nodetypes="cc"
|
||||
id="path6984"
|
||||
d="M 70.434539,17.875593 L 70.434539,66.984877"
|
||||
style="opacity:1;fill:#babdb6;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 4.8 KiB |
@@ -456,33 +456,43 @@ gtk_fishbowl_do_update (GtkFishbowl *fishbowl)
|
||||
{
|
||||
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
||||
GdkFrameClock *frame_clock;
|
||||
GdkFrameTimings *end;
|
||||
gint64 end_counter;
|
||||
double fps, expected_fps;
|
||||
GdkFrameTimings *start, *end;
|
||||
gint64 start_counter, end_counter;
|
||||
gint64 n_frames, expected_frames;
|
||||
gint64 start_timestamp, end_timestamp;
|
||||
gint64 interval;
|
||||
|
||||
frame_clock = gtk_widget_get_frame_clock (GTK_WIDGET (fishbowl));
|
||||
if (frame_clock == NULL)
|
||||
return;
|
||||
|
||||
fps = gdk_frame_clock_get_fps (frame_clock);
|
||||
if (fps <= 0.0)
|
||||
start_counter = gdk_frame_clock_get_history_start (frame_clock);
|
||||
end_counter = gdk_frame_clock_get_frame_counter (frame_clock);
|
||||
start = gdk_frame_clock_get_timings (frame_clock, start_counter);
|
||||
for (end = gdk_frame_clock_get_timings (frame_clock, end_counter);
|
||||
end_counter > start_counter && end != NULL && !gdk_frame_timings_get_complete (end);
|
||||
end = gdk_frame_clock_get_timings (frame_clock, end_counter))
|
||||
end_counter--;
|
||||
if (end_counter - start_counter < 4)
|
||||
return;
|
||||
|
||||
priv->framerate = fps;
|
||||
start_timestamp = gdk_frame_timings_get_presentation_time (start);
|
||||
end_timestamp = gdk_frame_timings_get_presentation_time (end);
|
||||
if (start_timestamp == 0 || end_timestamp == 0)
|
||||
{
|
||||
start_timestamp = gdk_frame_timings_get_frame_time (start);
|
||||
end_timestamp = gdk_frame_timings_get_frame_time (end);
|
||||
}
|
||||
|
||||
n_frames = end_counter - start_counter;
|
||||
priv->framerate = ((double) n_frames) * G_USEC_PER_SEC / (end_timestamp - start_timestamp);
|
||||
priv->framerate = ((int)(priv->framerate * 100))/100.0;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (fishbowl), props[PROP_FRAMERATE]);
|
||||
|
||||
if (!priv->benchmark)
|
||||
return;
|
||||
|
||||
end_counter = gdk_frame_clock_get_frame_counter (frame_clock);
|
||||
for (end = gdk_frame_clock_get_timings (frame_clock, end_counter);
|
||||
end != NULL && !gdk_frame_timings_get_complete (end);
|
||||
end = gdk_frame_clock_get_timings (frame_clock, end_counter))
|
||||
end_counter--;
|
||||
if (end == NULL)
|
||||
return;
|
||||
|
||||
interval = gdk_frame_timings_get_refresh_interval (end);
|
||||
if (interval == 0)
|
||||
{
|
||||
@@ -490,16 +500,16 @@ gtk_fishbowl_do_update (GtkFishbowl *fishbowl)
|
||||
if (interval == 0)
|
||||
return;
|
||||
}
|
||||
expected_fps = (double) G_USEC_PER_SEC / interval;
|
||||
expected_frames = round ((double) (end_timestamp - start_timestamp) / interval);
|
||||
|
||||
if (fps > (expected_fps - 1))
|
||||
if (n_frames >= expected_frames)
|
||||
{
|
||||
if (priv->last_benchmark_change > 0)
|
||||
priv->last_benchmark_change *= 2;
|
||||
else
|
||||
priv->last_benchmark_change = 1;
|
||||
}
|
||||
else if (0.95 * fps < expected_fps)
|
||||
else if (n_frames + 1 < expected_frames)
|
||||
{
|
||||
if (priv->last_benchmark_change < 0)
|
||||
priv->last_benchmark_change--;
|
||||
|
||||
@@ -827,25 +827,13 @@ demo_search_changed_cb (GtkSearchEntry *entry,
|
||||
gtk_filter_changed (filter, GTK_FILTER_CHANGE_DIFFERENT);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
demo_can_run (GtkWidget *window,
|
||||
const char *name)
|
||||
{
|
||||
if (name != NULL && strcmp (name, "gltransition") == 0)
|
||||
return GSK_IS_GL_RENDERER (gtk_native_get_renderer (GTK_NATIVE (window)));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GListModel *
|
||||
create_demo_model (GtkWidget *window)
|
||||
create_demo_model (void)
|
||||
{
|
||||
GListStore *store = g_list_store_new (GTK_TYPE_DEMO);
|
||||
DemoData *demo = gtk_demos;
|
||||
GtkDemo *d;
|
||||
|
||||
gtk_widget_realize (window);
|
||||
|
||||
d = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
|
||||
d->name = "main";
|
||||
d->title = "GTK Demo";
|
||||
@@ -857,20 +845,16 @@ create_demo_model (GtkWidget *window)
|
||||
|
||||
while (demo->title)
|
||||
{
|
||||
DemoData *children = demo->children;
|
||||
d = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
|
||||
DemoData *children = demo->children;
|
||||
|
||||
if (demo_can_run (window, demo->name))
|
||||
{
|
||||
d = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
|
||||
d->name = demo->name;
|
||||
d->title = demo->title;
|
||||
d->keywords = demo->keywords;
|
||||
d->filename = demo->filename;
|
||||
d->func = demo->func;
|
||||
|
||||
d->name = demo->name;
|
||||
d->title = demo->title;
|
||||
d->keywords = demo->keywords;
|
||||
d->filename = demo->filename;
|
||||
d->func = demo->func;
|
||||
|
||||
g_list_store_append (store, d);
|
||||
}
|
||||
g_list_store_append (store, d);
|
||||
|
||||
if (children)
|
||||
{
|
||||
@@ -878,19 +862,15 @@ create_demo_model (GtkWidget *window)
|
||||
|
||||
while (children->title)
|
||||
{
|
||||
if (demo_can_run (window, children->name))
|
||||
{
|
||||
GtkDemo *child = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
|
||||
GtkDemo *child = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
|
||||
|
||||
child->name = children->name;
|
||||
child->title = children->title;
|
||||
child->keywords = children->keywords;
|
||||
child->filename = children->filename;
|
||||
child->func = children->func;
|
||||
|
||||
g_list_store_append (G_LIST_STORE (d->children_model), child);
|
||||
}
|
||||
child->name = children->name;
|
||||
child->title = children->title;
|
||||
child->keywords = children->keywords;
|
||||
child->filename = children->filename;
|
||||
child->func = children->func;
|
||||
|
||||
g_list_store_append (G_LIST_STORE (d->children_model), child);
|
||||
children++;
|
||||
}
|
||||
}
|
||||
@@ -956,7 +936,7 @@ activate (GApplication *app)
|
||||
search_bar = GTK_WIDGET (gtk_builder_get_object (builder, "searchbar"));
|
||||
g_signal_connect (search_bar, "notify::search-mode-enabled", G_CALLBACK (clear_search), NULL);
|
||||
|
||||
listmodel = create_demo_model (window);
|
||||
listmodel = create_demo_model ();
|
||||
treemodel = gtk_tree_list_model_new (G_LIST_MODEL (listmodel),
|
||||
FALSE,
|
||||
TRUE,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<interface>
|
||||
<menu id="menubar">
|
||||
<submenu>
|
||||
<attribute name="label" translatable="yes">_File</attribute>
|
||||
<attribute name="label" translatable="yes">_Application</attribute>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_New</attribute>
|
||||
@@ -33,7 +33,7 @@
|
||||
</section>
|
||||
</submenu>
|
||||
<submenu>
|
||||
<attribute name="label" translatable="yes">_Preferences</attribute>
|
||||
<attribute name="label" translatable="yes">_File</attribute>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Prefer Dark Theme</attribute>
|
||||
|
||||
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
@@ -338,7 +338,7 @@ do_path_maze (GtkWidget *do_widget)
|
||||
GskPath *path;
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Follow the maze with the mouse");
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
@@ -120,7 +120,7 @@ create_shadertoy_window (GtkWidget *do_widget)
|
||||
gtk_box_append (GTK_BOX (box), aspect);
|
||||
|
||||
shadertoy = new_shadertoy ("/shadertoy/alienplanet.glsl");
|
||||
gtk_aspect_frame_set_child (GTK_ASPECT_FRAME (aspect), gtk_graphics_offload_new (shadertoy));
|
||||
gtk_aspect_frame_set_child (GTK_ASPECT_FRAME (aspect), shadertoy);
|
||||
|
||||
sw = gtk_scrolled_window_new ();
|
||||
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (sw), 250);
|
||||
|
||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
@@ -38,13 +38,13 @@ can run the build, using Ninja:
|
||||
|
||||
```
|
||||
cd builddir
|
||||
meson compile
|
||||
meson install
|
||||
ninja
|
||||
ninja install
|
||||
```
|
||||
|
||||
If you don't have permission to write to the directory you are
|
||||
installing in, you may have to change to root temporarily before
|
||||
running `meson install`.
|
||||
running `ninja install`.
|
||||
|
||||
Several environment variables are useful to pass to set before
|
||||
running *meson*. `CPPFLAGS` contains options to pass to the C
|
||||
@@ -112,10 +112,10 @@ responsible for controlling the debugging features of GTK with
|
||||
|
||||
## Dependencies
|
||||
|
||||
Before you can compile GTK, you need to have various other tools and
|
||||
libraries installed on your system. Dependencies of GTK have their own
|
||||
build systems, so you will need to refer to their own installation
|
||||
instructions.
|
||||
Before you can compile the GTK widget toolkit, you need to have
|
||||
various other tools and libraries installed on your
|
||||
system. Dependencies of GTK have their own build systems, so
|
||||
you will need to refer to their own installation instructions.
|
||||
|
||||
A particular important tool used by GTK to find its dependencies
|
||||
is `pkg-config`.
|
||||
@@ -156,8 +156,8 @@ Other libraries are maintained separately.
|
||||
the development environment for these libraries that your
|
||||
operating system vendor provides.
|
||||
- The [fontconfig](https://www.freedesktop.org/wiki/Software/fontconfig/)
|
||||
library provides Pango with a standard way of locating fonts and matching
|
||||
them against font names.
|
||||
library provides Pango with a standard way of locating
|
||||
fonts and matching them against font names.
|
||||
- [Cairo](https://www.cairographics.org) is a graphics library that
|
||||
supports vector graphics and image compositing. Both Pango and GTK
|
||||
use Cairo for drawing. Note that we also need the auxiliary cairo-gobject
|
||||
@@ -220,12 +220,13 @@ meson configure builddir
|
||||
|
||||
### `x11-backend`, `win32-backend`, `broadway-backend`, `wayland-backend` and `macos-backend`
|
||||
|
||||
Enable specific backends for GDK. If none of these options are given, the
|
||||
Wayland backend will be enabled by default, if the platform is Linux; the
|
||||
X11 backend will also be enabled by default, unless the platform is Windows,
|
||||
in which case the default is win32, or the platform is macOS, in which case
|
||||
the default is macOS. If any backend is explicitly enabled or disabled, no
|
||||
other platform will be enabled automatically.
|
||||
Enable specific backends for GDK. If none of these options
|
||||
are given, the Wayland backend will be enabled by default,
|
||||
if the platform is Linux; the X11 backend will also be enabled
|
||||
by default, unless the platform is Windows, in which case the
|
||||
default is win32, or the platform is macOS, in which case the
|
||||
default is macOS. If any backend is explicitly enabled or disabled,
|
||||
no other platform will be enabled automatically.
|
||||
|
||||
### `vulkan`
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Title: CSS in GTK
|
||||
Slug: css
|
||||
|
||||
This chapter describes how GTK uses CSS for styling and layout.
|
||||
This chapter describes how GTK uses CSS for styling and layout.
|
||||
It is not meant to be an explanation of CSS from first principles,
|
||||
but focuses on listing supported CSS features and differences
|
||||
between Web CSS and GTK.
|
||||
|
||||
@@ -28,9 +28,6 @@ GTK depends on the following libraries:
|
||||
- **OpenGL**: OpenGL is the premier environment for developing portable,
|
||||
interactive 2D and 3D graphics applications. More information available
|
||||
on the [Khronos website][opengl].
|
||||
- **Vulkan**: Vulkan is the a newer graphics API, that can be considered
|
||||
the successor of OpenGL. More information available on the
|
||||
[Khronos website][vulkan].
|
||||
- **Pango**: Pango is a library for internationalized text handling. It
|
||||
centers around the `PangoLayout` object, representing a paragraph of
|
||||
text. Pango provides the engine for `GtkTextView`, `GtkLabel`,
|
||||
@@ -63,7 +60,6 @@ GTK is divided into three parts:
|
||||
[gio]: https://developer.gnome.org/gio/stable/
|
||||
[cairo]: https://www.cairographics.org/manual/
|
||||
[opengl]: https://www.opengl.org/about/
|
||||
[vulkan]: https://www.vulkan.org/
|
||||
[pango]: https://pango.gnome.org/
|
||||
[gdkpixbuf]: https://developer.gnome.org/gdk-pixbuf/stable/
|
||||
[graphene]: https://ebassi.github.io/graphene/
|
||||
|
||||
@@ -27,7 +27,7 @@ the question you have, this list is a good place to start.
|
||||
Every major version of GTK comes with a [migration guide](#migrating). You may also
|
||||
find useful information in the documentation for specific widgets and functions. If
|
||||
you have a question not covered in the manual, feel free to ask, and please
|
||||
[file a bug report](https://gitlab.gnome.org/GNOME/gtk/issues/) against the
|
||||
[file a bug report](https://gitlab.gnome.org/GNOME/gtk/issues/new) against the
|
||||
documentation.
|
||||
|
||||
* Should I maintain parallel versions of my UI in GTK x and GTK y?
|
||||
@@ -54,7 +54,7 @@ the question you have, this list is a good place to start.
|
||||
For strings returned from functions, they will be declared "const" if they should
|
||||
not be freed. Non-const strings should be freed with `g_free()`. Arrays follow the
|
||||
same rule. If you find an undocumented exception to the rules, please
|
||||
[file a bug report.](https://gitlab.gnome.org/GNOME/gtk/issues/).
|
||||
[file a bug report.](https://gitlab.gnome.org/GNOME/gtk/issues/new).
|
||||
|
||||
The transfer annotations for gobject-introspection that are part of the
|
||||
documentation can provide useful hints for memory handling semantics as well.
|
||||
|
||||
@@ -4,7 +4,7 @@ Slug: gtk-resources
|
||||
## Opening a bug or feature request
|
||||
|
||||
If you encounter a bug, misfeature, or missing feature in GTK, please
|
||||
file a bug report on our [GitLab project](https://gitlab.gnome.org/GNOME/gtk/issues/).
|
||||
file a bug report on our [GitLab project](https://gitlab.gnome.org/GNOME/gtk/issues/new).
|
||||
You should also file issues if the documentation is out of date with the
|
||||
existing API, or unclear.
|
||||
|
||||
|
||||
@@ -278,11 +278,14 @@ are only available when GTK has been configured with `-Ddebug=true`.
|
||||
: OpenGL renderer information
|
||||
|
||||
`vulkan`
|
||||
: Check Vulkan errors
|
||||
: Vulkan renderer information
|
||||
|
||||
`shaders`
|
||||
: Information about shaders
|
||||
|
||||
`surface`
|
||||
: Information about surfaces
|
||||
|
||||
`fallback`
|
||||
: Information about fallback usage in renderers
|
||||
|
||||
@@ -300,6 +303,9 @@ A number of options affect behavior instead of logging:
|
||||
`full-redraw`
|
||||
: Force full redraws
|
||||
|
||||
`sync`
|
||||
: Sync after each frame
|
||||
|
||||
`staging`
|
||||
: Use a staging image for texture upload (Vulkan only)
|
||||
|
||||
@@ -341,28 +347,6 @@ a `*`, which means: try all remaining backends. The special value
|
||||
backends. For more information about selecting backends,
|
||||
see the [func@Gdk.DisplayManager.get] function.
|
||||
|
||||
### `GDK_GL_DISABLE`
|
||||
|
||||
This variable can be set to a list of values, which cause GDK to
|
||||
disable extension features of the OpenGL support.
|
||||
Note that these features may already be disabled if the GL driver
|
||||
does not support them.
|
||||
|
||||
`debug`
|
||||
: GL_KHR_debug
|
||||
|
||||
`unpack-subimage`
|
||||
:GL_EXT_unpack_subimage
|
||||
|
||||
`half-float`
|
||||
:GL_OES_vertex_half_float
|
||||
|
||||
`sync`
|
||||
:GL_ARB_sync
|
||||
|
||||
`base-instance`
|
||||
:GL_EXT_base_instance
|
||||
|
||||
### `GDK_VULKAN_DEVICE`
|
||||
|
||||
This variable can be set to the index of a Vulkan device to override
|
||||
@@ -370,7 +354,7 @@ the default selection of the device that is used for Vulkan rendering.
|
||||
The special value `list` can be used to obtain a list of all Vulkan
|
||||
devices.
|
||||
|
||||
### `GDK_VULKAN_DISABLE`
|
||||
### `GDK_VULKAN_SKIP`
|
||||
|
||||
This variable can be set to a list of values, which cause GDK to
|
||||
disable features of the Vulkan support.
|
||||
@@ -450,7 +434,7 @@ using and the GDK backend supports them:
|
||||
installation.
|
||||
|
||||
|
||||
### `GSK_GPU_DISABLE`
|
||||
### `GSK_GPU_SKIP`
|
||||
|
||||
This variable can be set to a list of values, which cause GSK to
|
||||
disable certain optimizations of the "ngl" and "vulkan" renderer.
|
||||
@@ -470,6 +454,9 @@ disable certain optimizations of the "ngl" and "vulkan" renderer.
|
||||
`mipmap`
|
||||
: Avoid creating mipmaps
|
||||
|
||||
`gl-baseinstance`
|
||||
: Assume no ARB/EXT_base_instance support
|
||||
|
||||
The special value `all` can be used to turn on all values. The special
|
||||
value `help` can be used to obtain a list of all supported values.
|
||||
|
||||
@@ -482,10 +469,10 @@ n seconds. The default timeout is 15 seconds.
|
||||
|
||||
### `GSK_MAX_TEXTURE_SIZE`
|
||||
|
||||
Limit texture size to the minimum of this value and the OpenGL limit for
|
||||
texture sizes in the "gl" renderer. This can be used to debug issues with
|
||||
texture slicing on systems where the OpenGL texture size limit would
|
||||
otherwise make texture slicing difficult to test.
|
||||
Limit texture size to the minimum of this value and the OpenGL limit
|
||||
for texture sizes. This can be used to debug issues with texture slicing
|
||||
on systems where the OpenGL texture size limit would otherwise make
|
||||
texture slicing difficult to test.
|
||||
|
||||
### `GTK_CSD`
|
||||
|
||||
|
||||
@@ -156,9 +156,6 @@ gdk_cursor_finalize (GObject *object)
|
||||
g_clear_object (&cursor->texture);
|
||||
g_clear_object (&cursor->fallback);
|
||||
|
||||
if (cursor->destroy)
|
||||
cursor->destroy (cursor->data);
|
||||
|
||||
G_OBJECT_CLASS (gdk_cursor_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
@@ -256,11 +253,6 @@ gdk_cursor_hash (gconstpointer pointer)
|
||||
hash ^= g_str_hash (cursor->name);
|
||||
else if (cursor->texture)
|
||||
hash ^= g_direct_hash (cursor->texture);
|
||||
else if (cursor->callback)
|
||||
{
|
||||
hash ^= g_direct_hash (cursor->callback);
|
||||
hash ^= g_direct_hash (cursor->data);
|
||||
}
|
||||
|
||||
hash ^= (cursor->hotspot_x << 8) | cursor->hotspot_y;
|
||||
|
||||
@@ -289,10 +281,6 @@ gdk_cursor_equal (gconstpointer a,
|
||||
ca->hotspot_y != cb->hotspot_y)
|
||||
return FALSE;
|
||||
|
||||
if (ca->callback != cb->callback ||
|
||||
ca->data != cb->data)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -367,45 +355,6 @@ gdk_cursor_new_from_texture (GdkTexture *texture,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_cursor_new_from_callback:
|
||||
* @callback: the `GdkCursorGetTextureCallback`
|
||||
* @data: data to pass to @callback
|
||||
* @destroy: destroy notify for @data
|
||||
* @fallback: (nullable): the `GdkCursor` to fall back to when
|
||||
* this one cannot be supported
|
||||
*
|
||||
* Creates a new callback-based cursor object.
|
||||
*
|
||||
* Cursors of this kind produce textures for the cursor
|
||||
* image on demand, when the @callback is called.
|
||||
*
|
||||
* Returns: (nullable): a new `GdkCursor`
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
GdkCursor *
|
||||
gdk_cursor_new_from_callback (GdkCursorGetTextureCallback callback,
|
||||
gpointer data,
|
||||
GDestroyNotify destroy,
|
||||
GdkCursor *fallback)
|
||||
{
|
||||
GdkCursor *cursor;
|
||||
|
||||
g_return_val_if_fail (callback != NULL, NULL);
|
||||
g_return_val_if_fail (fallback == NULL || GDK_IS_CURSOR (fallback), NULL);
|
||||
|
||||
cursor = g_object_new (GDK_TYPE_CURSOR,
|
||||
"fallback", fallback,
|
||||
NULL);
|
||||
|
||||
cursor->callback = callback;
|
||||
cursor->data = data;
|
||||
cursor->destroy = destroy;
|
||||
|
||||
return cursor;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_cursor_get_fallback: (attributes org.gtk.Method.get_property=fallback)
|
||||
* @cursor: a `GdkCursor`
|
||||
@@ -510,22 +459,3 @@ gdk_cursor_get_hotspot_y (GdkCursor *cursor)
|
||||
|
||||
return cursor->hotspot_y;
|
||||
}
|
||||
|
||||
GdkTexture *
|
||||
gdk_cursor_get_texture_for_size (GdkCursor *cursor,
|
||||
int cursor_size,
|
||||
double scale,
|
||||
int *width,
|
||||
int *height,
|
||||
int *hotspot_x,
|
||||
int *hotspot_y)
|
||||
{
|
||||
if (cursor->callback == NULL)
|
||||
return NULL;
|
||||
|
||||
return cursor->callback (cursor,
|
||||
cursor_size, scale,
|
||||
width, height,
|
||||
hotspot_x, hotspot_y,
|
||||
cursor->data);
|
||||
}
|
||||
|
||||
@@ -51,52 +51,6 @@ GDK_AVAILABLE_IN_ALL
|
||||
GdkCursor* gdk_cursor_new_from_name (const char *name,
|
||||
GdkCursor *fallback);
|
||||
|
||||
/**
|
||||
* GdkCursorGetTestureCallback:
|
||||
* @cursor: the `GdkCursor`
|
||||
* @cursor_size: the nominal cursor size, in application pixels
|
||||
* @scale: the device scale
|
||||
* @width: (out): return location for the actual cursor width,
|
||||
* in application pixels
|
||||
* @height: (out): return location for the actual cursor height,
|
||||
* in application pixels
|
||||
* @hotspot_x: (out): return location for the hotspot X position,
|
||||
* in application pixels
|
||||
* @hotspot_y: (out): return location for the hotspot Y position,
|
||||
* in application pixels
|
||||
* @data: User data for the callback
|
||||
*
|
||||
* The type of callback used by a dynamic `GdkCursor` to generate
|
||||
* a texture for the cursor image at the given @cursor_size
|
||||
* and @scale.
|
||||
*
|
||||
* The actual cursor size in application pixels may be different
|
||||
* from @cursor_size x @cursor_size, and will be returned in
|
||||
* @width, @height. The returned texture should have a size that
|
||||
* corresponds to the actual cursor size, in device pixels (i.e.
|
||||
* application pixels, multiplied by @scale).
|
||||
*
|
||||
* This function may fail and return `NULL`, in which case
|
||||
* the fallback cursor will be used.
|
||||
*
|
||||
* Returns: (nullable) (transfer full): the cursor image, or
|
||||
* `NULL` if none could be produced.
|
||||
*/
|
||||
typedef GdkTexture * (* GdkCursorGetTextureCallback) (GdkCursor *cursor,
|
||||
int cursor_size,
|
||||
double scale,
|
||||
int *width,
|
||||
int *height,
|
||||
int *hotspot_x,
|
||||
int *hotspot_y,
|
||||
gpointer data);
|
||||
|
||||
GDK_AVAILABLE_IN_4_16
|
||||
GdkCursor * gdk_cursor_new_from_callback (GdkCursorGetTextureCallback callback,
|
||||
gpointer data,
|
||||
GDestroyNotify destroy,
|
||||
GdkCursor *fallback);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkCursor * gdk_cursor_get_fallback (GdkCursor *cursor);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
||||
@@ -44,10 +44,6 @@ struct _GdkCursor
|
||||
GdkTexture *texture;
|
||||
int hotspot_x;
|
||||
int hotspot_y;
|
||||
|
||||
GdkCursorGetTextureCallback callback;
|
||||
gpointer data;
|
||||
GDestroyNotify destroy;
|
||||
};
|
||||
|
||||
struct _GdkCursorClass
|
||||
@@ -59,13 +55,5 @@ guint gdk_cursor_hash (gconstpointer
|
||||
gboolean gdk_cursor_equal (gconstpointer a,
|
||||
gconstpointer b);
|
||||
|
||||
GdkTexture * gdk_cursor_get_texture_for_size (GdkCursor *cursor,
|
||||
int cursor_size,
|
||||
double scale,
|
||||
int *width,
|
||||
int *height,
|
||||
int *hotspot_x,
|
||||
int *hotspot_y);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -1538,7 +1538,6 @@ describe_egl_config (EGLDisplay egl_display,
|
||||
EGLConfig egl_config)
|
||||
{
|
||||
EGLint red, green, blue, alpha, type;
|
||||
EGLint depth, stencil;
|
||||
|
||||
if (egl_config == NULL)
|
||||
return g_strdup ("-");
|
||||
@@ -1557,16 +1556,7 @@ describe_egl_config (EGLDisplay egl_display,
|
||||
else
|
||||
type = EGL_COLOR_COMPONENT_TYPE_FIXED_EXT;
|
||||
|
||||
if (!eglGetConfigAttrib (egl_display, egl_config, EGL_DEPTH_SIZE, &depth))
|
||||
depth = 0;
|
||||
|
||||
if (!eglGetConfigAttrib (egl_display, egl_config, EGL_STENCIL_SIZE, &stencil))
|
||||
stencil = 0;
|
||||
|
||||
return g_strdup_printf ("R%dG%dB%dA%d%s, depth %d, stencil %d", red, green, blue, alpha,
|
||||
type == EGL_COLOR_COMPONENT_TYPE_FIXED_EXT ? "" : " float",
|
||||
depth,
|
||||
stencil);
|
||||
return g_strdup_printf ("R%dG%dB%dA%d%s", red, green, blue, alpha, type == EGL_COLOR_COMPONENT_TYPE_FIXED_EXT ? "" : " float");
|
||||
}
|
||||
|
||||
gpointer
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "gdkdmabufformatsbuilderprivate.h"
|
||||
#include "gdkdmabuffourccprivate.h"
|
||||
#include "gdkdmabufprivate.h"
|
||||
#include "gdkdmabuftexturebuilderprivate.h"
|
||||
#include "gdktextureprivate.h"
|
||||
#include <gdk/gdkglcontext.h>
|
||||
#include <gdk/gdkgltexturebuilder.h>
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdkenumtypes.h"
|
||||
#include "gdkdmabuftextureprivate.h"
|
||||
#include "gdkdmabuftexturebuilderprivate.h"
|
||||
|
||||
#include <cairo-gobject.h>
|
||||
|
||||
@@ -949,20 +948,22 @@ gdk_dmabuf_texture_builder_set_update_region (GdkDmabufTextureBuilder *self,
|
||||
*
|
||||
* Builds a new `GdkTexture` with the values set up in the builder.
|
||||
*
|
||||
* It is a programming error to call this function if any mandatory property has not been set.
|
||||
* It is a programming error to call this function if any mandatory
|
||||
* property has not been set.
|
||||
*
|
||||
* Not all formats defined in the `drm_fourcc.h` header are supported. You can use
|
||||
* [method@Gdk.Display.get_dmabuf_formats] to get a list of supported formats. If the
|
||||
* format is not supported by GTK, %NULL will be returned and @error will be set.
|
||||
* If the dmabuf is not supported by GTK, %NULL will be returned and @error will be set.
|
||||
*
|
||||
* The `destroy` function gets called when the returned texture gets released.
|
||||
*
|
||||
* It is possible to call this function multiple times to create multiple textures,
|
||||
* possibly with changing properties in between.
|
||||
*
|
||||
* It is the responsibility of the caller to keep the file descriptors for the planes
|
||||
* open until the created texture is no longer used, and close them afterwards (possibly
|
||||
* using the @destroy notify).
|
||||
*
|
||||
* It is possible to call this function multiple times to create multiple textures,
|
||||
* possibly with changing properties in between.
|
||||
* Not all formats defined in the `drm_fourcc.h` header are supported. You can use
|
||||
* [method@Gdk.Display.get_dmabuf_formats] to get a list of supported formats.
|
||||
*
|
||||
* Returns: (transfer full) (nullable): a newly built `GdkTexture` or `NULL`
|
||||
* if the format is not supported
|
||||
@@ -1003,19 +1004,3 @@ gdk_dmabuf_texture_builder_get_dmabuf (GdkDmabufTextureBuilder *self)
|
||||
{
|
||||
return &self->dmabuf;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_dmabuf_texture_builder_set_dmabuf (GdkDmabufTextureBuilder *self,
|
||||
const GdkDmabuf *dmabuf)
|
||||
{
|
||||
gdk_dmabuf_texture_builder_set_fourcc (self, dmabuf->fourcc);
|
||||
gdk_dmabuf_texture_builder_set_modifier (self, dmabuf->modifier);
|
||||
gdk_dmabuf_texture_builder_set_n_planes (self, dmabuf->n_planes);
|
||||
|
||||
for (unsigned int i = 0; i < dmabuf->n_planes; i++)
|
||||
{
|
||||
gdk_dmabuf_texture_builder_set_fd (self, i, dmabuf->planes[i].fd);
|
||||
gdk_dmabuf_texture_builder_set_stride (self, i, dmabuf->planes[i].stride);
|
||||
gdk_dmabuf_texture_builder_set_offset (self, i, dmabuf->planes[i].offset);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "gdkdmabuftexturebuilder.h"
|
||||
#include "gdkdmabufprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
const GdkDmabuf * gdk_dmabuf_texture_builder_get_dmabuf (GdkDmabufTextureBuilder *builder);
|
||||
|
||||
void gdk_dmabuf_texture_builder_set_dmabuf (GdkDmabufTextureBuilder *builder,
|
||||
const GdkDmabuf *dmabuf);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
const GdkDmabuf * gdk_dmabuf_texture_builder_get_dmabuf (GdkDmabufTextureBuilder *builder);
|
||||
|
||||
GdkTexture * gdk_dmabuf_texture_new_from_builder (GdkDmabufTextureBuilder *builder,
|
||||
GDestroyNotify destroy,
|
||||
gpointer data,
|
||||
|
||||
@@ -50,6 +50,18 @@
|
||||
#include "gdkenumtypes.h"
|
||||
#include "gdkeventsprivate.h"
|
||||
|
||||
static struct {
|
||||
GdkDragAction action;
|
||||
const char *name;
|
||||
GdkCursor *cursor;
|
||||
} drag_cursors[] = {
|
||||
{ GDK_ACTION_ASK, "dnd-ask", NULL },
|
||||
{ GDK_ACTION_COPY, "copy", NULL },
|
||||
{ GDK_ACTION_MOVE, "move", NULL },
|
||||
{ GDK_ACTION_LINK, "alias", NULL },
|
||||
{ 0, "no-drop", NULL },
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_CONTENT,
|
||||
@@ -774,20 +786,6 @@ gdk_drag_handle_source_event (GdkEvent *event)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static struct {
|
||||
GdkDragAction action;
|
||||
const char *name;
|
||||
GdkCursor *cursor;
|
||||
} drag_cursors[] = {
|
||||
{ 0, "default", NULL },
|
||||
{ GDK_ACTION_ASK, "dnd-ask", NULL },
|
||||
{ GDK_ACTION_COPY, "copy", NULL },
|
||||
{ GDK_ACTION_MOVE, "dnd-move", NULL }, /* Not using move here, since move is stuck using
|
||||
* a mismatched visual metaphor in Adwaita
|
||||
*/
|
||||
{ GDK_ACTION_LINK, "alias", NULL },
|
||||
};
|
||||
|
||||
GdkCursor *
|
||||
gdk_drag_get_cursor (GdkDrag *drag,
|
||||
GdkDragAction action)
|
||||
|
||||
@@ -125,7 +125,7 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
|
||||
* the GL_UNPACK_ROW_LENGTH support
|
||||
*/
|
||||
if (gdk_gl_context_get_use_es (paint_context) &&
|
||||
!(version >= 300 || gdk_gl_context_has_feature (paint_context, GDK_GL_FEATURE_UNPACK_SUBIMAGE)))
|
||||
!(version >= 300 || gdk_gl_context_has_unpack_subimage (paint_context)))
|
||||
return;
|
||||
|
||||
/* TODO: avoid reading back non-required data due to dest clip */
|
||||
|
||||
@@ -103,15 +103,6 @@
|
||||
|
||||
#define DEFAULT_ALLOWED_APIS GDK_GL_API_GL | GDK_GL_API_GLES
|
||||
|
||||
static const GdkDebugKey gdk_gl_feature_keys[] = {
|
||||
{ "debug", GDK_GL_FEATURE_DEBUG, "GL_KHR_debug" },
|
||||
{ "unpack-subimage", GDK_GL_FEATURE_UNPACK_SUBIMAGE, "GL_EXT_unpack_subimage" },
|
||||
{ "half-float", GDK_GL_FEATURE_VERTEX_HALF_FLOAT, "GL_OES_vertex_half_float" },
|
||||
{ "sync", GDK_GL_FEATURE_SYNC, "GL_ARB_sync" },
|
||||
{ "base-instance", GDK_GL_FEATURE_BASE_INSTANCE, "GL_ARB_base_instance" },
|
||||
{ "buffer-storage", GDK_GL_FEATURE_BUFFER_STORAGE, "GL_EXT_buffer_storage" },
|
||||
};
|
||||
|
||||
typedef struct _GdkGLContextPrivate GdkGLContextPrivate;
|
||||
|
||||
struct _GdkGLContextPrivate
|
||||
@@ -121,9 +112,13 @@ struct _GdkGLContextPrivate
|
||||
|
||||
GdkGLMemoryFlags memory_flags[GDK_MEMORY_N_FORMATS];
|
||||
|
||||
GdkGLFeatures features;
|
||||
guint has_khr_debug : 1;
|
||||
guint use_khr_debug : 1;
|
||||
guint has_half_float : 1;
|
||||
guint has_sync : 1;
|
||||
guint has_unpack_subimage : 1;
|
||||
guint has_debug_output : 1;
|
||||
guint has_bgra : 1;
|
||||
guint extensions_checked : 1;
|
||||
guint debug_enabled : 1;
|
||||
guint forward_compatible : 1;
|
||||
@@ -295,7 +290,7 @@ gdk_gl_context_create_egl_context (GdkGLContext *context,
|
||||
GdkDisplay *display = gdk_gl_context_get_display (context);
|
||||
EGLDisplay egl_display = gdk_display_get_egl_display (display);
|
||||
GdkGLContext *share = gdk_display_get_gl_context (display);
|
||||
GdkGLContextPrivate *share_priv = share ? gdk_gl_context_get_instance_private (share) : NULL;
|
||||
GdkGLContextPrivate *share_priv = gdk_gl_context_get_instance_private (share);
|
||||
EGLConfig egl_config;
|
||||
EGLContext ctx;
|
||||
EGLint context_attribs[N_EGL_ATTRS], i = 0, flags = 0;
|
||||
@@ -903,12 +898,11 @@ gdk_gl_context_label_object_printf (GdkGLContext *context,
|
||||
|
||||
|
||||
gboolean
|
||||
gdk_gl_context_has_feature (GdkGLContext *self,
|
||||
GdkGLFeatures feature)
|
||||
gdk_gl_context_has_unpack_subimage (GdkGLContext *context)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self);
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
|
||||
|
||||
return (priv->features & feature) == feature;
|
||||
return priv->has_unpack_subimage;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -1670,53 +1664,10 @@ gdk_gl_version_init_epoxy (GdkGLVersion *version)
|
||||
*version = GDK_GL_VERSION_INIT (epoxy_version / 10, epoxy_version % 10);
|
||||
}
|
||||
|
||||
static GdkGLFeatures
|
||||
gdk_gl_context_check_features (GdkGLContext *context)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
|
||||
GdkGLFeatures features = 0;
|
||||
|
||||
if (gdk_gl_context_get_use_es (context))
|
||||
{
|
||||
if (gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 0)) ||
|
||||
epoxy_has_gl_extension ("GL_EXT_unpack_subimage"))
|
||||
features |= GDK_GL_FEATURE_UNPACK_SUBIMAGE;
|
||||
}
|
||||
else
|
||||
{
|
||||
features |= GDK_GL_FEATURE_UNPACK_SUBIMAGE;
|
||||
}
|
||||
|
||||
if (epoxy_has_gl_extension ("GL_KHR_debug"))
|
||||
features |= GDK_GL_FEATURE_DEBUG;
|
||||
|
||||
if (gdk_gl_context_check_version (context, "3.0", "3.0") ||
|
||||
epoxy_has_gl_extension ("GL_OES_vertex_half_float"))
|
||||
features |= GDK_GL_FEATURE_VERTEX_HALF_FLOAT;
|
||||
|
||||
if (gdk_gl_context_check_version (context, "3.2", "3.0") ||
|
||||
epoxy_has_gl_extension ("GL_ARB_sync") ||
|
||||
epoxy_has_gl_extension ("GL_APPLE_sync"))
|
||||
features |= GDK_GL_FEATURE_SYNC;
|
||||
|
||||
if (gdk_gl_context_check_version (context, "4.2", "9.9") ||
|
||||
epoxy_has_gl_extension ("GL_EXT_base_instance") ||
|
||||
epoxy_has_gl_extension ("GL_ARB_base_instance"))
|
||||
features |= GDK_GL_FEATURE_BASE_INSTANCE;
|
||||
|
||||
if (gdk_gl_context_check_version (context, "4.4", "9.9") ||
|
||||
epoxy_has_gl_extension ("GL_EXT_buffer_storage") ||
|
||||
epoxy_has_gl_extension ("GL_ARB_buffer_storage"))
|
||||
features |= GDK_GL_FEATURE_BUFFER_STORAGE;
|
||||
|
||||
return features;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_gl_context_check_extensions (GdkGLContext *context)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
|
||||
GdkGLFeatures supported_features, disabled_features;
|
||||
gboolean gl_debug = FALSE;
|
||||
GdkDisplay *display;
|
||||
|
||||
@@ -1734,54 +1685,69 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
|
||||
|
||||
if (priv->has_debug_output && gl_debug)
|
||||
{
|
||||
gdk_gl_context_make_current (context);
|
||||
glEnable (GL_DEBUG_OUTPUT);
|
||||
glEnable (GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
||||
glDebugMessageCallback (gl_debug_message_callback, NULL);
|
||||
}
|
||||
|
||||
/* If we asked for a core profile, but didn't get one, we're in legacy mode */
|
||||
if (!gdk_gl_context_get_use_es (context) &&
|
||||
!gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 2)))
|
||||
priv->is_legacy = TRUE;
|
||||
if (gdk_gl_context_get_use_es (context))
|
||||
{
|
||||
priv->has_unpack_subimage = gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 0)) ||
|
||||
epoxy_has_gl_extension ("GL_EXT_unpack_subimage");
|
||||
priv->has_khr_debug = epoxy_has_gl_extension ("GL_KHR_debug");
|
||||
priv->has_bgra = epoxy_has_gl_extension ("GL_EXT_texture_format_BGRA8888");
|
||||
}
|
||||
else
|
||||
{
|
||||
priv->has_unpack_subimage = TRUE;
|
||||
priv->has_khr_debug = epoxy_has_gl_extension ("GL_KHR_debug");
|
||||
priv->has_bgra = TRUE;
|
||||
|
||||
supported_features = gdk_gl_context_check_features (context);
|
||||
disabled_features = gdk_parse_debug_var ("GDK_GL_DISABLE",
|
||||
gdk_gl_feature_keys,
|
||||
G_N_ELEMENTS (gdk_gl_feature_keys));
|
||||
/* We asked for a core profile, but we didn't get one, so we're in legacy mode */
|
||||
if (!gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 2)))
|
||||
priv->is_legacy = TRUE;
|
||||
}
|
||||
|
||||
priv->features = supported_features & ~disabled_features;
|
||||
|
||||
gdk_gl_context_init_memory_flags (context);
|
||||
|
||||
if ((priv->features & GDK_GL_FEATURE_DEBUG) && gl_debug)
|
||||
if (priv->has_khr_debug && gl_debug)
|
||||
{
|
||||
priv->use_khr_debug = TRUE;
|
||||
glGetIntegerv (GL_MAX_LABEL_LENGTH, &priv->max_debug_label_length);
|
||||
}
|
||||
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (display, OPENGL))
|
||||
{
|
||||
int i, max_texture_size;
|
||||
glGetIntegerv (GL_MAX_TEXTURE_SIZE, &max_texture_size);
|
||||
gdk_debug_message ("%s version: %d.%d (%s)\n"
|
||||
"* GLSL version: %s\n"
|
||||
"* Max texture size: %d\n",
|
||||
gdk_gl_context_get_use_es (context) ? "OpenGL ES" : "OpenGL",
|
||||
gdk_gl_version_get_major (&priv->gl_version), gdk_gl_version_get_minor (&priv->gl_version),
|
||||
priv->is_legacy ? "legacy" : "core",
|
||||
glGetString (GL_SHADING_LANGUAGE_VERSION),
|
||||
max_texture_size);
|
||||
gdk_debug_message ("Enabled features (use GDK_GL_DISABLE env var to disable):");
|
||||
for (i = 0; i < G_N_ELEMENTS (gdk_gl_feature_keys); i++)
|
||||
{
|
||||
gdk_debug_message (" %s: %s",
|
||||
gdk_gl_feature_keys[i].key,
|
||||
(priv->features & gdk_gl_feature_keys[i].value) ? "YES" :
|
||||
((disabled_features & gdk_gl_feature_keys[i].value) ? "disabled via env var" :
|
||||
(((supported_features & gdk_gl_feature_keys[i].value) == 0) ? "not supported" :
|
||||
"Hum, what? This should not happen.")));
|
||||
}
|
||||
}
|
||||
priv->has_half_float = gdk_gl_context_check_version (context, "3.0", "3.0") ||
|
||||
epoxy_has_gl_extension ("GL_OES_vertex_half_float");
|
||||
|
||||
priv->has_sync = gdk_gl_context_check_version (context, "3.2", "3.0") ||
|
||||
epoxy_has_gl_extension ("GL_ARB_sync") ||
|
||||
epoxy_has_gl_extension ("GL_APPLE_sync");
|
||||
|
||||
gdk_gl_context_init_memory_flags (context);
|
||||
|
||||
{
|
||||
int max_texture_size;
|
||||
glGetIntegerv (GL_MAX_TEXTURE_SIZE, &max_texture_size);
|
||||
GDK_DISPLAY_DEBUG (gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context)), OPENGL,
|
||||
"%s version: %d.%d (%s)\n"
|
||||
"* GLSL version: %s\n"
|
||||
"* Max texture size: %d\n"
|
||||
"* Extensions checked:\n"
|
||||
" - GL_KHR_debug: %s\n"
|
||||
" - GL_EXT_unpack_subimage: %s\n"
|
||||
" - half float: %s\n"
|
||||
" - sync: %s\n"
|
||||
" - bgra: %s",
|
||||
gdk_gl_context_get_use_es (context) ? "OpenGL ES" : "OpenGL",
|
||||
gdk_gl_version_get_major (&priv->gl_version), gdk_gl_version_get_minor (&priv->gl_version),
|
||||
priv->is_legacy ? "legacy" : "core",
|
||||
glGetString (GL_SHADING_LANGUAGE_VERSION),
|
||||
max_texture_size,
|
||||
priv->has_khr_debug ? "yes" : "no",
|
||||
priv->has_unpack_subimage ? "yes" : "no",
|
||||
priv->has_half_float ? "yes" : "no",
|
||||
priv->has_sync ? "yes" : "no",
|
||||
priv->has_bgra ? "yes" : "no");
|
||||
}
|
||||
|
||||
priv->extensions_checked = TRUE;
|
||||
}
|
||||
@@ -2050,6 +2016,30 @@ gdk_gl_context_get_format_flags (GdkGLContext *self,
|
||||
return priv->memory_flags[format];
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_gl_context_has_debug (GdkGLContext *self)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self);
|
||||
|
||||
return priv->debug_enabled || priv->use_khr_debug;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_gl_context_has_vertex_half_float (GdkGLContext *self)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self);
|
||||
|
||||
return priv->has_half_float;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_gl_context_has_sync (GdkGLContext *self)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self);
|
||||
|
||||
return priv->has_sync;
|
||||
}
|
||||
|
||||
/* Return if glGenVertexArrays, glBindVertexArray and glDeleteVertexArrays
|
||||
* can be used
|
||||
*/
|
||||
|
||||
@@ -27,15 +27,6 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef enum {
|
||||
GDK_GL_FEATURE_DEBUG = 1 << 0,
|
||||
GDK_GL_FEATURE_UNPACK_SUBIMAGE = 1 << 1,
|
||||
GDK_GL_FEATURE_VERTEX_HALF_FLOAT = 1 << 2,
|
||||
GDK_GL_FEATURE_SYNC = 1 << 3,
|
||||
GDK_GL_FEATURE_BASE_INSTANCE = 1 << 4,
|
||||
GDK_GL_FEATURE_BUFFER_STORAGE = 1 << 5,
|
||||
} GdkGLFeatures;
|
||||
|
||||
typedef enum {
|
||||
GDK_GL_NONE = 0,
|
||||
GDK_GL_EGL,
|
||||
@@ -151,6 +142,7 @@ void gdk_gl_context_get_matching_version (GdkGLContext
|
||||
gboolean legacy,
|
||||
GdkGLVersion *out_version);
|
||||
|
||||
gboolean gdk_gl_context_has_unpack_subimage (GdkGLContext *context);
|
||||
void gdk_gl_context_push_debug_group (GdkGLContext *context,
|
||||
const char *message);
|
||||
void gdk_gl_context_push_debug_group_printf (GdkGLContext *context,
|
||||
@@ -171,11 +163,14 @@ const char * gdk_gl_context_get_glsl_version_string (GdkGLContext
|
||||
|
||||
GdkGLMemoryFlags gdk_gl_context_get_format_flags (GdkGLContext *self,
|
||||
GdkMemoryFormat format) G_GNUC_PURE;
|
||||
gboolean gdk_gl_context_has_feature (GdkGLContext *self,
|
||||
GdkGLFeatures feature) G_GNUC_PURE;
|
||||
gboolean gdk_gl_context_has_debug (GdkGLContext *self) G_GNUC_PURE;
|
||||
|
||||
gboolean gdk_gl_context_use_es_bgra (GdkGLContext *context);
|
||||
|
||||
gboolean gdk_gl_context_has_vertex_half_float (GdkGLContext *self) G_GNUC_PURE;
|
||||
|
||||
gboolean gdk_gl_context_has_sync (GdkGLContext *self) G_GNUC_PURE;
|
||||
|
||||
gboolean gdk_gl_context_has_vertex_arrays (GdkGLContext *self) G_GNUC_PURE;
|
||||
|
||||
double gdk_gl_context_get_scale (GdkGLContext *self);
|
||||
|
||||
@@ -494,7 +494,7 @@ gdk_gl_texture_new_from_builder (GdkGLTextureBuilder *builder,
|
||||
self->id = gdk_gl_texture_builder_get_id (builder);
|
||||
GDK_TEXTURE (self)->format = gdk_gl_texture_builder_get_format (builder);
|
||||
self->has_mipmap = gdk_gl_texture_builder_get_has_mipmap (builder);
|
||||
if (gdk_gl_context_has_feature (self->context, GDK_GL_FEATURE_SYNC))
|
||||
if (gdk_gl_context_has_sync (self->context))
|
||||
self->sync = gdk_gl_texture_builder_get_sync (builder);
|
||||
self->destroy = destroy;
|
||||
self->data = data;
|
||||
|
||||
@@ -59,7 +59,7 @@ typedef enum {
|
||||
* @get_current_image: return a `GdkPaintable` that does not change over
|
||||
* time. This means the `GDK_PAINTABLE_STATIC_SIZE` and
|
||||
* `GDK_PAINTABLE_STATIC_CONTENTS` flag are set.
|
||||
* @get_flags: Get the flags for this instance. See [flags@Gdk.PaintableFlags]
|
||||
* @get_flags: Get the flags for this instance. See [enum@Gdk.PaintableFlags]
|
||||
* for details.
|
||||
* @get_intrinsic_width: The preferred width for this object to be
|
||||
* snapshot at or 0 if none. This is purely a hint. The object must still
|
||||
|
||||
@@ -113,8 +113,6 @@ gdk_subsurface_attach (GdkSubsurface *subsurface,
|
||||
GdkTexture *texture,
|
||||
const graphene_rect_t *source,
|
||||
const graphene_rect_t *dest,
|
||||
GdkTextureTransform transform,
|
||||
gboolean lightbox,
|
||||
gboolean above,
|
||||
GdkSubsurface *sibling)
|
||||
{
|
||||
@@ -157,7 +155,7 @@ gdk_subsurface_attach (GdkSubsurface *subsurface,
|
||||
}
|
||||
}
|
||||
|
||||
return GDK_SUBSURFACE_GET_CLASS (subsurface)->attach (subsurface, texture, source, dest, transform, lightbox, above, sibling);
|
||||
return GDK_SUBSURFACE_GET_CLASS (subsurface)->attach (subsurface, texture, source, dest, above, sibling);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -205,19 +203,3 @@ gdk_subsurface_is_above_parent (GdkSubsurface *subsurface)
|
||||
|
||||
return subsurface->above_parent;
|
||||
}
|
||||
|
||||
GdkTextureTransform
|
||||
gdk_subsurface_get_transform (GdkSubsurface *subsurface)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), GDK_TEXTURE_TRANSFORM_NORMAL);
|
||||
|
||||
return GDK_SUBSURFACE_GET_CLASS (subsurface)->get_transform (subsurface);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_subsurface_get_lightbox (GdkSubsurface *subsurface)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), FALSE);
|
||||
|
||||
return GDK_SUBSURFACE_GET_CLASS (subsurface)->get_lightbox (subsurface);
|
||||
}
|
||||
|
||||
@@ -47,16 +47,6 @@ struct _GdkSubsurface
|
||||
GdkSubsurface *sibling_below;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
GDK_TEXTURE_TRANSFORM_NORMAL,
|
||||
GDK_TEXTURE_TRANSFORM_90,
|
||||
GDK_TEXTURE_TRANSFORM_180,
|
||||
GDK_TEXTURE_TRANSFORM_270,
|
||||
GDK_TEXTURE_TRANSFORM_FLIPPED,
|
||||
GDK_TEXTURE_TRANSFORM_FLIPPED_90,
|
||||
GDK_TEXTURE_TRANSFORM_FLIPPED_180,
|
||||
GDK_TEXTURE_TRANSFORM_FLIPPED_270,
|
||||
} GdkTextureTransform;
|
||||
|
||||
struct _GdkSubsurfaceClass
|
||||
{
|
||||
@@ -66,8 +56,6 @@ struct _GdkSubsurfaceClass
|
||||
GdkTexture *texture,
|
||||
const graphene_rect_t *source,
|
||||
const graphene_rect_t *dest,
|
||||
GdkTextureTransform transform,
|
||||
gboolean lightbox,
|
||||
gboolean above,
|
||||
GdkSubsurface *sibling);
|
||||
void (* detach) (GdkSubsurface *subsurface);
|
||||
@@ -76,21 +64,15 @@ struct _GdkSubsurfaceClass
|
||||
graphene_rect_t *source);
|
||||
void (* get_dest) (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *dest);
|
||||
GdkTextureTransform
|
||||
(* get_transform) (GdkSubsurface *subsurface);
|
||||
gboolean (* get_lightbox) (GdkSubsurface *subsurface);
|
||||
};
|
||||
|
||||
GType gdk_subsurface_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GdkSurface * gdk_subsurface_get_parent (GdkSubsurface *subsurface);
|
||||
|
||||
gboolean gdk_subsurface_attach (GdkSubsurface *subsurface,
|
||||
GdkTexture *texture,
|
||||
const graphene_rect_t *source,
|
||||
const graphene_rect_t *dest,
|
||||
GdkTextureTransform transform,
|
||||
gboolean lightbox,
|
||||
gboolean above,
|
||||
GdkSubsurface *sibling);
|
||||
void gdk_subsurface_detach (GdkSubsurface *subsurface);
|
||||
@@ -100,9 +82,6 @@ void gdk_subsurface_get_source (GdkSubsurface *subsurfac
|
||||
void gdk_subsurface_get_dest (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *dest);
|
||||
gboolean gdk_subsurface_is_above_parent (GdkSubsurface *subsurface);
|
||||
GdkTextureTransform
|
||||
gdk_subsurface_get_transform (GdkSubsurface *subsurface);
|
||||
gboolean gdk_subsurface_get_lightbox (GdkSubsurface *subsurface);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -552,8 +552,9 @@ physical_device_supports_extension (VkPhysicalDevice device,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static GdkVulkanFeatures
|
||||
physical_device_check_features (VkPhysicalDevice device)
|
||||
static gboolean
|
||||
physical_device_check_features (VkPhysicalDevice device,
|
||||
GdkVulkanFeatures *out_features)
|
||||
{
|
||||
VkPhysicalDeviceVulkan12Features v12_features = {
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES,
|
||||
@@ -562,16 +563,15 @@ physical_device_check_features (VkPhysicalDevice device)
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES,
|
||||
.pNext = &v12_features
|
||||
};
|
||||
VkPhysicalDeviceFeatures2 v10_features = {
|
||||
VkPhysicalDeviceFeatures2 features = {
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2,
|
||||
.pNext = &ycbcr_features
|
||||
};
|
||||
VkExternalSemaphoreProperties semaphore_props = {
|
||||
.sType = VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES,
|
||||
};
|
||||
GdkVulkanFeatures features;
|
||||
|
||||
vkGetPhysicalDeviceFeatures2 (device, &v10_features);
|
||||
vkGetPhysicalDeviceFeatures2 (device, &features);
|
||||
vkGetPhysicalDeviceExternalSemaphoreProperties (device,
|
||||
&(VkPhysicalDeviceExternalSemaphoreInfo) {
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO,
|
||||
@@ -579,46 +579,46 @@ physical_device_check_features (VkPhysicalDevice device)
|
||||
},
|
||||
&semaphore_props);
|
||||
|
||||
features = 0;
|
||||
*out_features = 0;
|
||||
|
||||
if (v10_features.features.shaderUniformBufferArrayDynamicIndexing &&
|
||||
v10_features.features.shaderSampledImageArrayDynamicIndexing)
|
||||
features |= GDK_VULKAN_FEATURE_DYNAMIC_INDEXING;
|
||||
if (features.features.shaderUniformBufferArrayDynamicIndexing &&
|
||||
features.features.shaderSampledImageArrayDynamicIndexing)
|
||||
*out_features |= GDK_VULKAN_FEATURE_DYNAMIC_INDEXING;
|
||||
|
||||
if (v12_features.descriptorIndexing &&
|
||||
v12_features.descriptorBindingPartiallyBound &&
|
||||
v12_features.descriptorBindingVariableDescriptorCount &&
|
||||
v12_features.descriptorBindingSampledImageUpdateAfterBind &&
|
||||
v12_features.descriptorBindingStorageBufferUpdateAfterBind)
|
||||
features |= GDK_VULKAN_FEATURE_DESCRIPTOR_INDEXING;
|
||||
*out_features |= GDK_VULKAN_FEATURE_DESCRIPTOR_INDEXING;
|
||||
else if (physical_device_supports_extension (device, VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME))
|
||||
features |= GDK_VULKAN_FEATURE_DESCRIPTOR_INDEXING;
|
||||
*out_features |= GDK_VULKAN_FEATURE_DESCRIPTOR_INDEXING;
|
||||
|
||||
if (v12_features.shaderSampledImageArrayNonUniformIndexing &&
|
||||
v12_features.shaderStorageBufferArrayNonUniformIndexing)
|
||||
features |= GDK_VULKAN_FEATURE_NONUNIFORM_INDEXING;
|
||||
*out_features |= GDK_VULKAN_FEATURE_NONUNIFORM_INDEXING;
|
||||
|
||||
if (ycbcr_features.samplerYcbcrConversion ||
|
||||
physical_device_supports_extension (device, VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME))
|
||||
features |= GDK_VULKAN_FEATURE_YCBCR;
|
||||
*out_features |= GDK_VULKAN_FEATURE_YCBCR;
|
||||
|
||||
if (physical_device_supports_extension (device, VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME) &&
|
||||
physical_device_supports_extension (device, VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME))
|
||||
features |= GDK_VULKAN_FEATURE_DMABUF;
|
||||
*out_features |= GDK_VULKAN_FEATURE_DMABUF;
|
||||
|
||||
if (physical_device_supports_extension (device, VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME))
|
||||
{
|
||||
if (semaphore_props.externalSemaphoreFeatures & VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT)
|
||||
features |= GDK_VULKAN_FEATURE_SEMAPHORE_EXPORT;
|
||||
*out_features |= GDK_VULKAN_FEATURE_SEMAPHORE_EXPORT;
|
||||
|
||||
if (semaphore_props.externalSemaphoreFeatures & VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT)
|
||||
features |= GDK_VULKAN_FEATURE_SEMAPHORE_IMPORT;
|
||||
*out_features |= GDK_VULKAN_FEATURE_SEMAPHORE_IMPORT;
|
||||
}
|
||||
|
||||
if (physical_device_supports_extension (device, VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME))
|
||||
features |= GDK_VULKAN_FEATURE_INCREMENTAL_PRESENT;
|
||||
*out_features |= GDK_VULKAN_FEATURE_INCREMENTAL_PRESENT;
|
||||
|
||||
return features;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1366,7 +1366,7 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
|
||||
first = 0;
|
||||
last = n_devices;
|
||||
|
||||
skip_features = gdk_parse_debug_var ("GDK_VULKAN_DISABLE",
|
||||
skip_features = gdk_parse_debug_var ("GDK_VULKAN_SKIP",
|
||||
gsk_vulkan_feature_keys,
|
||||
G_N_ELEMENTS (gsk_vulkan_feature_keys));
|
||||
|
||||
@@ -1454,7 +1454,8 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
|
||||
GdkVulkanFeatures features, device_features;
|
||||
uint32_t n_queue_props;
|
||||
|
||||
device_features = physical_device_check_features (devices[i]);
|
||||
if (!physical_device_check_features (devices[i], &device_features))
|
||||
continue;
|
||||
|
||||
features = device_features & ~skip_features;
|
||||
|
||||
@@ -1539,7 +1540,7 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
|
||||
display->vk_queue_family_index = j;
|
||||
display->vulkan_features = features;
|
||||
|
||||
GDK_DISPLAY_DEBUG (display, VULKAN, "Enabled features (use GDK_VULKAN_DISABLE env var to disable):");
|
||||
GDK_DISPLAY_DEBUG (display, VULKAN, "Enabled features (use GDK_VULKAN_SKIP env var to disable):");
|
||||
for (i = 0; i < G_N_ELEMENTS (gsk_vulkan_feature_keys); i++)
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (display, VULKAN, " %s: %s",
|
||||
|
||||
@@ -296,6 +296,10 @@ typedef NSString *CALayerContentsGravity;
|
||||
GdkMonitor *monitor;
|
||||
GdkRectangle geometry;
|
||||
GdkRectangle workarea;
|
||||
int shadow_top = 0;
|
||||
int shadow_left = 0;
|
||||
int shadow_right = 0;
|
||||
int shadow_bottom = 0;
|
||||
GdkRectangle window_gdk;
|
||||
GdkPoint pointer_position;
|
||||
GdkPoint new_origin;
|
||||
@@ -303,6 +307,13 @@ typedef NSString *CALayerContentsGravity;
|
||||
if (!inManualMove)
|
||||
return NO;
|
||||
|
||||
/* Get our shadow so we can adjust the window position sans-shadow */
|
||||
_gdk_macos_surface_get_shadow (gdk_surface,
|
||||
&shadow_top,
|
||||
&shadow_right,
|
||||
&shadow_bottom,
|
||||
&shadow_left);
|
||||
|
||||
windowFrame = [self frame];
|
||||
currentLocation = [NSEvent mouseLocation];
|
||||
|
||||
@@ -328,9 +339,21 @@ typedef NSString *CALayerContentsGravity;
|
||||
window_gdk.width = windowFrame.size.width;
|
||||
window_gdk.height = windowFrame.size.height;
|
||||
|
||||
/* Subtract our shadowin from the window */
|
||||
window_gdk.x += shadow_left;
|
||||
window_gdk.y += shadow_top;
|
||||
window_gdk.width = window_gdk.width - shadow_left - shadow_right;
|
||||
window_gdk.height = window_gdk.height - shadow_top - shadow_bottom;
|
||||
|
||||
/* Now place things on the monitor */
|
||||
_edge_snapping_motion (&self->snapping, &pointer_position, &window_gdk);
|
||||
|
||||
/* And add our shadow back to the frame */
|
||||
window_gdk.x -= shadow_left;
|
||||
window_gdk.y -= shadow_top;
|
||||
window_gdk.width += shadow_left + shadow_right;
|
||||
window_gdk.height += shadow_top + shadow_bottom;
|
||||
|
||||
/* Convert to quartz coordinates */
|
||||
_gdk_macos_display_to_display_coords ([self gdkDisplay],
|
||||
window_gdk.x,
|
||||
@@ -692,16 +715,26 @@ typedef NSString *CALayerContentsGravity;
|
||||
|
||||
-(void)setStyleMask:(NSWindowStyleMask)styleMask
|
||||
{
|
||||
gboolean was_fullscreen;
|
||||
gboolean is_fullscreen;
|
||||
gboolean was_opaque;
|
||||
gboolean is_opaque;
|
||||
|
||||
was_fullscreen = (([self styleMask] & NSWindowStyleMaskFullScreen) != 0);
|
||||
was_opaque = (([self styleMask] & NSWindowStyleMaskTitled) != 0);
|
||||
|
||||
[super setStyleMask:styleMask];
|
||||
|
||||
is_fullscreen = (([self styleMask] & NSWindowStyleMaskFullScreen) != 0);
|
||||
is_opaque = (([self styleMask] & NSWindowStyleMaskTitled) != 0);
|
||||
|
||||
_gdk_macos_surface_update_fullscreen_state (gdk_surface);
|
||||
if (was_fullscreen != is_fullscreen)
|
||||
{
|
||||
if (was_fullscreen)
|
||||
[self setFrame:lastUnfullscreenFrame display:NO];
|
||||
|
||||
_gdk_macos_surface_update_fullscreen_state (gdk_surface);
|
||||
}
|
||||
|
||||
if (was_opaque != is_opaque)
|
||||
{
|
||||
@@ -714,11 +747,17 @@ typedef NSString *CALayerContentsGravity;
|
||||
|
||||
-(NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen
|
||||
{
|
||||
GdkMacosSurface *surface = gdk_surface;
|
||||
NSRect rect;
|
||||
int shadow_top;
|
||||
|
||||
/* Allow the window to move up "shadow_top" more than normally allowed
|
||||
* by the default impl. This makes it possible to move windows with
|
||||
* client side shadow right up to the screen's menu bar. */
|
||||
_gdk_macos_surface_get_shadow (surface, &shadow_top, NULL, NULL, NULL);
|
||||
rect = [super constrainFrameRect:frameRect toScreen:screen];
|
||||
if (frameRect.origin.y > rect.origin.y)
|
||||
rect.origin.y = MIN (frameRect.origin.y, rect.origin.y);
|
||||
rect.origin.y = MIN (frameRect.origin.y, rect.origin.y + shadow_top);
|
||||
|
||||
return rect;
|
||||
}
|
||||
@@ -738,6 +777,7 @@ typedef NSString *CALayerContentsGravity;
|
||||
-(void)windowWillEnterFullScreen:(NSNotification *)aNotification
|
||||
{
|
||||
inFullscreenTransition = YES;
|
||||
lastUnfullscreenFrame = [self frame];
|
||||
}
|
||||
|
||||
-(void)windowDidEnterFullScreen:(NSNotification *)aNotification
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
|
||||
EdgeSnapping snapping;
|
||||
|
||||
NSRect lastUnfullscreenFrame;
|
||||
BOOL inFullscreenTransition;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "gdkmacoscursor-private.h"
|
||||
#include "gdkcursorprivate.h"
|
||||
|
||||
@interface NSCursor()
|
||||
-(long long)_coreCursorType;
|
||||
@@ -218,25 +217,9 @@ _gdk_macos_cursor_get_ns_cursor (GdkCursor *cursor)
|
||||
|
||||
if (name == NULL)
|
||||
{
|
||||
GdkTexture *texture;
|
||||
int hotspot_x, hotspot_y;
|
||||
|
||||
texture = gdk_cursor_get_texture (cursor);
|
||||
hotspot_x = gdk_cursor_get_hotspot_x (cursor);
|
||||
hotspot_y = gdk_cursor_get_hotspot_y (cursor);
|
||||
|
||||
if (texture == NULL)
|
||||
{
|
||||
int size = 32; // FIXME
|
||||
int width, height;
|
||||
|
||||
texture = gdk_cursor_get_texture_for_size (cursor, size, 1,
|
||||
&width, &height,
|
||||
&hotspot_x, &hotspot_y);
|
||||
}
|
||||
|
||||
nscursor = create_cursor_from_texture (texture, hotspot_x, hotspot_y);
|
||||
|
||||
nscursor = create_cursor_from_texture (gdk_cursor_get_texture (cursor),
|
||||
gdk_cursor_get_hotspot_x (cursor),
|
||||
gdk_cursor_get_hotspot_y (cursor));
|
||||
return nscursor;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,20 +47,20 @@ _gdk_macos_display_position_toplevel_with_parent (GdkMacosDisplay *self,
|
||||
/* Try to center on top of the parent but also try to make the whole thing
|
||||
* visible in case that lands us under the topbar/panel/etc.
|
||||
*/
|
||||
parent_rect.x = parent->root_x;
|
||||
parent_rect.y = parent->root_y;
|
||||
parent_rect.width = GDK_SURFACE (parent)->width;
|
||||
parent_rect.height = GDK_SURFACE (parent)->height;
|
||||
parent_rect.x = parent->root_x + parent->shadow_left;
|
||||
parent_rect.y = parent->root_y + parent->shadow_top;
|
||||
parent_rect.width = GDK_SURFACE (parent)->width - parent->shadow_left - parent->shadow_right;
|
||||
parent_rect.height = GDK_SURFACE (parent)->height - parent->shadow_top - parent->shadow_bottom;
|
||||
|
||||
surface_rect.width = GDK_SURFACE (surface)->width;
|
||||
surface_rect.height = GDK_SURFACE (surface)->height;
|
||||
surface_rect.width = GDK_SURFACE (surface)->width - surface->shadow_left - surface->shadow_right;
|
||||
surface_rect.height = GDK_SURFACE (surface)->height - surface->shadow_top - surface->shadow_bottom;
|
||||
surface_rect.x = parent_rect.x + ((parent_rect.width - surface_rect.width) / 2);
|
||||
surface_rect.y = parent_rect.y + ((parent_rect.height - surface_rect.height) / 2);
|
||||
|
||||
_gdk_macos_monitor_clamp (GDK_MACOS_MONITOR (monitor), &surface_rect);
|
||||
|
||||
*x = surface_rect.x;
|
||||
*y = surface_rect.y;
|
||||
*x = surface_rect.x - surface->shadow_left;
|
||||
*y = surface_rect.y - surface->shadow_top;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
@@ -99,15 +99,15 @@ _gdk_macos_display_position_toplevel (GdkMacosDisplay *self,
|
||||
gdk_macos_monitor_get_workarea (monitor, &workarea);
|
||||
|
||||
/* First place at top-left of current monitor */
|
||||
surface_rect.width = GDK_SURFACE (surface)->width;
|
||||
surface_rect.height = GDK_SURFACE (surface)->height;
|
||||
surface_rect.width = GDK_SURFACE (surface)->width - surface->shadow_left - surface->shadow_right;
|
||||
surface_rect.height = GDK_SURFACE (surface)->height - surface->shadow_top - surface->shadow_bottom;
|
||||
surface_rect.x = workarea.x + ((workarea.width - surface_rect.width) / 2);
|
||||
surface_rect.y = workarea.y + ((workarea.height - surface_rect.height) / 2);
|
||||
|
||||
_gdk_macos_monitor_clamp (GDK_MACOS_MONITOR (surface->best_monitor), &surface_rect);
|
||||
|
||||
*x = surface_rect.x;
|
||||
*y = surface_rect.y;
|
||||
*x = surface_rect.x - surface->shadow_left;
|
||||
*y = surface_rect.y - surface->shadow_top;
|
||||
|
||||
/* Try to see if there are any other surfaces at this origin and if so,
|
||||
* adjust until we get something better.
|
||||
@@ -119,11 +119,11 @@ _gdk_macos_display_position_toplevel (GdkMacosDisplay *self,
|
||||
*y += WARP_OFFSET_Y;
|
||||
|
||||
/* If we reached the bottom right, just bail and try the workspace origin */
|
||||
if (*x + WARP_OFFSET_X > workarea.x + workarea.width ||
|
||||
*y + WARP_OFFSET_Y > workarea.y + workarea.height)
|
||||
if (*x + surface->shadow_left + WARP_OFFSET_X > workarea.x + workarea.width ||
|
||||
*y + surface->shadow_top + WARP_OFFSET_Y > workarea.y + workarea.height)
|
||||
{
|
||||
*x = workarea.x;
|
||||
*y = workarea.y;
|
||||
*x = workarea.x - surface->shadow_left;
|
||||
*y = workarea.y - surface->shadow_top;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -998,9 +998,7 @@ _gdk_macos_display_get_nsevent (GdkEvent *event)
|
||||
{
|
||||
const GdkToNSEventMap *map = iter->data;
|
||||
|
||||
if (map->gdk_event->event_type == event->event_type &&
|
||||
map->gdk_event->device == event->device &&
|
||||
map->gdk_event->time == event->time)
|
||||
if (map->gdk_event == event)
|
||||
return map->nsevent;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,10 +68,19 @@ gdk_macos_popup_surface_layout (GdkMacosPopupSurface *self,
|
||||
monitor = _gdk_macos_surface_get_best_monitor (GDK_MACOS_SURFACE (self));
|
||||
gdk_macos_monitor_get_workarea (monitor, &bounds);
|
||||
|
||||
gdk_popup_layout_get_shadow_width (layout,
|
||||
&self->parent_instance.shadow_left,
|
||||
&self->parent_instance.shadow_right,
|
||||
&self->parent_instance.shadow_top,
|
||||
&self->parent_instance.shadow_bottom);
|
||||
|
||||
gdk_surface_layout_popup_helper (GDK_SURFACE (self),
|
||||
width,
|
||||
height,
|
||||
0, 0, 0, 0, /* shadow-left/right/top/bottom */
|
||||
self->parent_instance.shadow_left,
|
||||
self->parent_instance.shadow_right,
|
||||
self->parent_instance.shadow_top,
|
||||
self->parent_instance.shadow_bottom,
|
||||
monitor,
|
||||
&bounds,
|
||||
self->layout,
|
||||
|
||||
@@ -61,6 +61,11 @@ struct _GdkMacosSurface
|
||||
int height;
|
||||
} next_layout;
|
||||
|
||||
int shadow_top;
|
||||
int shadow_right;
|
||||
int shadow_bottom;
|
||||
int shadow_left;
|
||||
|
||||
cairo_rectangle_int_t next_frame;
|
||||
|
||||
gint64 pending_frame_counter;
|
||||
@@ -86,6 +91,16 @@ 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);
|
||||
void _gdk_macos_surface_get_shadow (GdkMacosSurface *self,
|
||||
int *top,
|
||||
int *right,
|
||||
int *bottom,
|
||||
int *left);
|
||||
void _gdk_macos_surface_set_shadow (GdkMacosSurface *self,
|
||||
int top,
|
||||
int right,
|
||||
int bottom,
|
||||
int left);
|
||||
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);
|
||||
|
||||
@@ -56,6 +56,14 @@ enum {
|
||||
|
||||
static GParamSpec *properties [LAST_PROP];
|
||||
|
||||
static gboolean
|
||||
window_is_fullscreen (GdkMacosSurface *self)
|
||||
{
|
||||
g_assert (GDK_IS_MACOS_SURFACE (self));
|
||||
|
||||
return ([self->window styleMask] & NSWindowStyleMaskFullScreen) != 0;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_macos_surface_request_frame (GdkMacosSurface *self)
|
||||
{
|
||||
@@ -236,6 +244,32 @@ gdk_macos_surface_get_scale (GdkSurface *surface)
|
||||
return [self->window backingScaleFactor];
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_macos_surface_set_shadow (GdkMacosSurface *surface,
|
||||
int top,
|
||||
int right,
|
||||
int bottom,
|
||||
int left)
|
||||
{
|
||||
GdkMacosSurface *self = (GdkMacosSurface *)surface;
|
||||
|
||||
g_assert (GDK_IS_MACOS_SURFACE (self));
|
||||
|
||||
if (self->shadow_top == top &&
|
||||
self->shadow_right == right &&
|
||||
self->shadow_bottom == bottom &&
|
||||
self->shadow_left == left)
|
||||
return;
|
||||
|
||||
self->shadow_top = top;
|
||||
self->shadow_right = right;
|
||||
self->shadow_bottom = bottom;
|
||||
self->shadow_left = left;
|
||||
|
||||
if (top || right || bottom || left)
|
||||
[self->window setHasShadow:NO];
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_macos_surface_begin_frame (GdkMacosSurface *self)
|
||||
{
|
||||
@@ -553,6 +587,29 @@ gdk_macos_surface_init (GdkMacosSurface *self)
|
||||
self->monitors = g_ptr_array_new_with_free_func (g_object_unref);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_macos_surface_get_shadow (GdkMacosSurface *self,
|
||||
int *top,
|
||||
int *right,
|
||||
int *bottom,
|
||||
int *left)
|
||||
{
|
||||
|
||||
g_return_if_fail (GDK_IS_MACOS_SURFACE (self));
|
||||
|
||||
if (top)
|
||||
*top = self->shadow_top;
|
||||
|
||||
if (left)
|
||||
*left = self->shadow_left;
|
||||
|
||||
if (bottom)
|
||||
*bottom = self->shadow_bottom;
|
||||
|
||||
if (right)
|
||||
*right = self->shadow_right;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gdk_macos_surface_is_opaque (GdkMacosSurface *self)
|
||||
{
|
||||
@@ -701,7 +758,7 @@ _gdk_macos_surface_update_fullscreen_state (GdkMacosSurface *self)
|
||||
g_return_if_fail (GDK_IS_MACOS_SURFACE (self));
|
||||
|
||||
state = GDK_SURFACE (self)->state;
|
||||
is_fullscreen = ([self->window styleMask] & NSWindowStyleMaskFullScreen) != 0;
|
||||
is_fullscreen = window_is_fullscreen (self);
|
||||
was_fullscreen = (state & GDK_TOPLEVEL_STATE_FULLSCREEN) != 0;
|
||||
|
||||
if (is_fullscreen != was_fullscreen)
|
||||
@@ -1048,12 +1105,16 @@ _gdk_macos_surface_monitor_changed (GdkMacosSurface *self)
|
||||
|
||||
g_set_object (&child->best_monitor, best);
|
||||
|
||||
area.x = self->root_x + GDK_SURFACE (child)->x;
|
||||
area.y = self->root_y + GDK_SURFACE (child)->y;
|
||||
area.width = GDK_SURFACE (child)->width;
|
||||
area.height = GDK_SURFACE (child)->height;
|
||||
area.x = self->root_x + GDK_SURFACE (child)->x + child->shadow_left;
|
||||
area.y = self->root_y + GDK_SURFACE (child)->y + child->shadow_top;
|
||||
area.width = GDK_SURFACE (child)->width - child->shadow_left - child->shadow_right;
|
||||
area.height = GDK_SURFACE (child)->height - child->shadow_top - child->shadow_bottom;
|
||||
|
||||
_gdk_macos_monitor_clamp (GDK_MACOS_MONITOR (best), &area);
|
||||
|
||||
area.x -= child->shadow_left;
|
||||
area.y -= child->shadow_top;
|
||||
|
||||
_gdk_macos_surface_move (child, area.x, area.y);
|
||||
gdk_surface_invalidate_rect (GDK_SURFACE (child), NULL);
|
||||
}
|
||||
|
||||
@@ -152,6 +152,13 @@ _gdk_macos_toplevel_surface_compute_size (GdkSurface *surface)
|
||||
mask = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE;
|
||||
}
|
||||
|
||||
if (size.shadow.is_valid)
|
||||
_gdk_macos_surface_set_shadow (macos_surface,
|
||||
size.shadow.top,
|
||||
size.shadow.right,
|
||||
size.shadow.bottom,
|
||||
size.shadow.left);
|
||||
|
||||
_gdk_macos_surface_set_geometry_hints (macos_surface, &geometry, mask);
|
||||
|
||||
if (surface->state & (GDK_TOPLEVEL_STATE_FULLSCREEN |
|
||||
|
||||
@@ -79,7 +79,6 @@ static const struct {
|
||||
{ "move", "dnd-move" },
|
||||
{ "no-drop", "dnd-none" },
|
||||
{ "dnd-ask", "dnd-copy" }, /* not CSS, but we want to guarantee it anyway */
|
||||
{ "dnd-move", "default" },
|
||||
{ "not-allowed", "crossed_circle" },
|
||||
{ "grab", "hand2" },
|
||||
{ "grabbing", "hand2" },
|
||||
@@ -155,19 +154,15 @@ static const struct wl_buffer_listener buffer_listener = {
|
||||
struct wl_buffer *
|
||||
_gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
|
||||
GdkCursor *cursor,
|
||||
double desired_scale,
|
||||
gboolean use_viewporter,
|
||||
guint desired_scale,
|
||||
guint image_index,
|
||||
int *hotspot_x,
|
||||
int *hotspot_y,
|
||||
int *width,
|
||||
int *height,
|
||||
double *scale)
|
||||
int *scale)
|
||||
{
|
||||
GdkTexture *texture;
|
||||
int desired_scale_factor;
|
||||
|
||||
desired_scale_factor = (int) ceil (desired_scale);
|
||||
|
||||
if (gdk_cursor_get_name (cursor))
|
||||
{
|
||||
@@ -178,7 +173,7 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
|
||||
|
||||
c = gdk_wayland_cursor_load_for_name (display,
|
||||
_gdk_wayland_display_get_cursor_theme (display),
|
||||
desired_scale_factor,
|
||||
desired_scale,
|
||||
gdk_cursor_get_name (cursor));
|
||||
if (c && c->image_count > 0)
|
||||
{
|
||||
@@ -195,7 +190,7 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
|
||||
|
||||
image = c->images[image_index];
|
||||
|
||||
cursor_scale = desired_scale_factor;
|
||||
cursor_scale = desired_scale;
|
||||
if ((image->width % cursor_scale != 0) ||
|
||||
(image->height % cursor_scale != 0))
|
||||
{
|
||||
@@ -215,7 +210,7 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
|
||||
return wl_cursor_image_get_buffer (image);
|
||||
}
|
||||
}
|
||||
else if (gdk_cursor_get_texture (cursor))
|
||||
else
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
struct wl_buffer *buffer;
|
||||
@@ -230,7 +225,7 @@ from_texture:
|
||||
gdk_texture_get_width (texture),
|
||||
gdk_texture_get_height (texture),
|
||||
&GDK_FRACTIONAL_SCALE_INIT_INT (1));
|
||||
|
||||
|
||||
gdk_texture_download (texture,
|
||||
cairo_image_surface_get_data (surface),
|
||||
cairo_image_surface_get_stride (surface));
|
||||
@@ -254,50 +249,11 @@ from_texture:
|
||||
|
||||
return buffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!use_viewporter)
|
||||
*scale = desired_scale_factor;
|
||||
else
|
||||
*scale = desired_scale;
|
||||
|
||||
texture = gdk_cursor_get_texture_for_size (cursor,
|
||||
display->cursor_theme_size,
|
||||
*scale,
|
||||
width,
|
||||
height,
|
||||
hotspot_x,
|
||||
hotspot_y);
|
||||
|
||||
if (texture)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
struct wl_buffer *buffer;
|
||||
|
||||
surface = gdk_wayland_display_create_shm_surface (display,
|
||||
gdk_texture_get_width (texture),
|
||||
gdk_texture_get_height (texture),
|
||||
&GDK_FRACTIONAL_SCALE_INIT_INT (1));
|
||||
|
||||
gdk_texture_download (texture,
|
||||
cairo_image_surface_get_data (surface),
|
||||
cairo_image_surface_get_stride (surface));
|
||||
cairo_surface_mark_dirty (surface);
|
||||
|
||||
buffer = _gdk_wayland_shm_surface_get_wl_buffer (surface);
|
||||
wl_buffer_add_listener (buffer, &buffer_listener, surface);
|
||||
|
||||
g_object_unref (texture);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
|
||||
if (gdk_cursor_get_fallback (cursor))
|
||||
return _gdk_wayland_cursor_get_buffer (display,
|
||||
gdk_cursor_get_fallback (cursor),
|
||||
gdk_cursor_get_fallback (cursor),
|
||||
desired_scale,
|
||||
use_viewporter,
|
||||
image_index,
|
||||
hotspot_x, hotspot_y,
|
||||
width, height,
|
||||
|
||||
@@ -62,7 +62,6 @@ struct _GdkWaylandPointerData {
|
||||
uint32_t grab_time;
|
||||
|
||||
struct wl_surface *pointer_surface;
|
||||
struct wp_viewport *pointer_surface_viewport;
|
||||
guint cursor_is_default: 1;
|
||||
GdkCursor *cursor;
|
||||
guint cursor_timeout_id;
|
||||
@@ -70,7 +69,7 @@ struct _GdkWaylandPointerData {
|
||||
guint cursor_image_delay;
|
||||
guint touchpad_event_sequence;
|
||||
|
||||
double current_output_scale;
|
||||
guint current_output_scale;
|
||||
GSList *pointer_surface_outputs;
|
||||
|
||||
/* Accumulated event data for a pointer frame */
|
||||
@@ -183,8 +182,6 @@ struct _GdkWaylandSeat
|
||||
GdkWaylandPointerData pointer_info;
|
||||
GdkWaylandPointerData touch_info;
|
||||
|
||||
uint32_t latest_touch_down_serial;
|
||||
|
||||
GdkModifierType key_modifiers;
|
||||
GdkSurface *keyboard_focus;
|
||||
GdkSurface *grab_surface;
|
||||
|
||||
@@ -260,25 +260,18 @@ gdk_wayland_device_update_surface_cursor (GdkDevice *device)
|
||||
GdkWaylandPointerData *pointer =
|
||||
gdk_wayland_device_get_pointer (wayland_device);
|
||||
struct wl_buffer *buffer;
|
||||
int x, y, w, h;
|
||||
double scale;
|
||||
int x, y, w, h, scale;
|
||||
guint next_image_index, next_image_delay;
|
||||
gboolean retval = G_SOURCE_REMOVE;
|
||||
GdkWaylandTabletData *tablet;
|
||||
gboolean use_viewport;
|
||||
|
||||
tablet = gdk_wayland_seat_find_tablet (seat, device);
|
||||
|
||||
use_viewport = pointer->pointer_surface_viewport != NULL;
|
||||
if (g_getenv ("NO_POINTER_VIEWPORT"))
|
||||
use_viewport = FALSE;
|
||||
|
||||
if (pointer->cursor)
|
||||
{
|
||||
buffer = _gdk_wayland_cursor_get_buffer (GDK_WAYLAND_DISPLAY (seat->display),
|
||||
pointer->cursor,
|
||||
pointer->current_output_scale,
|
||||
use_viewport,
|
||||
pointer->cursor_image_index,
|
||||
&x, &y, &w, &h, &scale);
|
||||
}
|
||||
@@ -317,17 +310,7 @@ gdk_wayland_device_update_surface_cursor (GdkDevice *device)
|
||||
if (buffer)
|
||||
{
|
||||
wl_surface_attach (pointer->pointer_surface, buffer, 0, 0);
|
||||
if (use_viewport)
|
||||
{
|
||||
wp_viewport_set_source (pointer->pointer_surface_viewport,
|
||||
wl_fixed_from_int (0),
|
||||
wl_fixed_from_int (0),
|
||||
wl_fixed_from_double (w * scale),
|
||||
wl_fixed_from_double (h * scale));
|
||||
wp_viewport_set_destination (pointer->pointer_surface_viewport, w, h);
|
||||
}
|
||||
else if (wl_surface_get_version (pointer->pointer_surface) >= WL_SURFACE_SET_BUFFER_SCALE_SINCE_VERSION)
|
||||
wl_surface_set_buffer_scale (pointer->pointer_surface, scale);
|
||||
wl_surface_set_buffer_scale (pointer->pointer_surface, scale);
|
||||
wl_surface_damage (pointer->pointer_surface, 0, 0, w, h);
|
||||
wl_surface_commit (pointer->pointer_surface);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,6 @@
|
||||
#include <wayland/xdg-foreign-unstable-v2-client-protocol.h>
|
||||
#include <wayland/server-decoration-client-protocol.h>
|
||||
#include "linux-dmabuf-unstable-v1-client-protocol.h"
|
||||
#include "presentation-time-client-protocol.h"
|
||||
|
||||
#include "wm-button-layout-translation.h"
|
||||
|
||||
@@ -96,6 +95,7 @@
|
||||
#define GTK_SHELL1_VERSION 5
|
||||
#define OUTPUT_VERSION_WITH_DONE 2
|
||||
#define NO_XDG_OUTPUT_DONE_SINCE_VERSION 3
|
||||
#define XDG_ACTIVATION_VERSION 1
|
||||
#define OUTPUT_VERSION 3
|
||||
|
||||
#ifdef HAVE_TOPLEVEL_STATE_SUSPENDED
|
||||
@@ -585,25 +585,21 @@ gdk_registry_handle_global (void *data,
|
||||
{
|
||||
display_wayland->xdg_activation =
|
||||
wl_registry_bind (display_wayland->wl_registry, id,
|
||||
&xdg_activation_v1_interface, 1);
|
||||
&xdg_activation_v1_interface,
|
||||
MIN (version, XDG_ACTIVATION_VERSION));
|
||||
}
|
||||
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);
|
||||
&wp_fractional_scale_manager_v1_interface,
|
||||
MIN (version, 1));
|
||||
}
|
||||
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") == 0)
|
||||
{
|
||||
display_wayland->presentation =
|
||||
wl_registry_bind (display_wayland->wl_registry, id,
|
||||
&wp_presentation_interface,
|
||||
&wp_viewporter_interface,
|
||||
MIN (version, 1));
|
||||
}
|
||||
|
||||
@@ -704,8 +700,7 @@ _gdk_wayland_display_open (const char *display_name)
|
||||
process_on_globals_closures (display_wayland);
|
||||
|
||||
/* Wait for initializing to complete. This means waiting for all
|
||||
* asynchronous roundtrips that were triggered during initial roundtrip.
|
||||
*/
|
||||
* asynchronous roundtrips that were triggered during initial roundtrip. */
|
||||
while (display_wayland->async_roundtrips != NULL)
|
||||
{
|
||||
if (wl_display_dispatch (display_wayland->wl_display) < 0)
|
||||
@@ -715,18 +710,6 @@ _gdk_wayland_display_open (const char *display_name)
|
||||
}
|
||||
}
|
||||
|
||||
/* Check that we got all the required globals */
|
||||
if (display_wayland->compositor == NULL ||
|
||||
display_wayland->shm == NULL ||
|
||||
display_wayland->data_device_manager == NULL)
|
||||
{
|
||||
g_warning ("The Wayland compositor does not provide one or more of the required interfaces, "
|
||||
"not using Wayland display");
|
||||
g_object_unref (display);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (display_wayland->xdg_wm_base_id)
|
||||
{
|
||||
display_wayland->shell_variant = GDK_WAYLAND_SHELL_VARIANT_XDG_SHELL;
|
||||
@@ -816,7 +799,6 @@ gdk_wayland_display_dispose (GObject *object)
|
||||
g_clear_pointer (&display_wayland->xdg_activation, xdg_activation_v1_destroy);
|
||||
g_clear_pointer (&display_wayland->fractional_scale, wp_fractional_scale_manager_v1_destroy);
|
||||
g_clear_pointer (&display_wayland->viewporter, wp_viewporter_destroy);
|
||||
g_clear_pointer (&display_wayland->presentation, wp_presentation_destroy);
|
||||
g_clear_pointer (&display_wayland->linux_dmabuf, zwp_linux_dmabuf_v1_destroy);
|
||||
g_clear_pointer (&display_wayland->linux_dmabuf_feedback, zwp_linux_dmabuf_feedback_v1_destroy);
|
||||
if (display_wayland->linux_dmabuf_formats)
|
||||
@@ -2014,10 +1996,9 @@ init_settings (GdkDisplay *display)
|
||||
|
||||
g_variant_get (ret, "(a{sa{sv}})", &iter);
|
||||
|
||||
if (g_variant_iter_n_children (iter) == 0)
|
||||
if (g_variant_n_children (ret) == 0)
|
||||
{
|
||||
g_debug ("Received no portal settings");
|
||||
g_clear_pointer (&iter, g_variant_iter_free);
|
||||
g_clear_pointer (&ret, g_variant_unref);
|
||||
|
||||
goto fallback;
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
#include <gdk/wayland/xdg-activation-v1-client-protocol.h>
|
||||
#include <gdk/wayland/fractional-scale-v1-client-protocol.h>
|
||||
#include <gdk/wayland/viewporter-client-protocol.h>
|
||||
#include <gdk/wayland/presentation-time-client-protocol.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <gdk/gdkkeys.h>
|
||||
@@ -126,7 +125,6 @@ struct _GdkWaylandDisplay
|
||||
struct xdg_activation_v1 *xdg_activation;
|
||||
struct wp_fractional_scale_manager_v1 *fractional_scale;
|
||||
struct wp_viewporter *viewporter;
|
||||
struct wp_presentation *presentation;
|
||||
|
||||
GList *async_roundtrips;
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include <gdk/wayland/gdkwayland.h>
|
||||
#include <gdk/wayland/gdkdisplay-wayland.h>
|
||||
#include <gdk/wayland/gdkseat-wayland.h>
|
||||
#include <gdk/wayland/gdkwaylandpresentationtime-private.h>
|
||||
|
||||
#include <xkbcommon/xkbcommon.h>
|
||||
|
||||
@@ -116,14 +115,13 @@ void gdk_wayland_display_system_bell (GdkDisplay *display,
|
||||
|
||||
struct wl_buffer *_gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
|
||||
GdkCursor *cursor,
|
||||
double desired_scale,
|
||||
gboolean use_viewporter,
|
||||
guint desired_scale,
|
||||
guint image_index,
|
||||
int *hotspot_x,
|
||||
int *hotspot_y,
|
||||
int *w,
|
||||
int *h,
|
||||
double *scale);
|
||||
int *scale);
|
||||
guint _gdk_wayland_cursor_get_next_image_index (GdkWaylandDisplay *display,
|
||||
GdkCursor *cursor,
|
||||
guint scale,
|
||||
|
||||
@@ -1640,7 +1640,6 @@ touch_handle_down (void *data,
|
||||
touch->x = wl_fixed_to_double (x);
|
||||
touch->y = wl_fixed_to_double (y);
|
||||
touch->touch_down_serial = serial;
|
||||
seat->latest_touch_down_serial = serial;
|
||||
|
||||
event = gdk_touch_event_new (GDK_TOUCH_BEGIN,
|
||||
GDK_SLOT_TO_EVENT_SEQUENCE (touch->id),
|
||||
@@ -3767,7 +3766,8 @@ pointer_surface_update_scale (GdkDevice *device)
|
||||
GdkWaylandDevice *wayland_device = GDK_WAYLAND_DEVICE (device);
|
||||
GdkWaylandPointerData *pointer =
|
||||
gdk_wayland_device_get_pointer (wayland_device);
|
||||
double scale;
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
|
||||
guint32 scale;
|
||||
GSList *l;
|
||||
|
||||
if (wl_surface_get_version (pointer->pointer_surface) < WL_SURFACE_SET_BUFFER_SCALE_SINCE_VERSION)
|
||||
@@ -3782,8 +3782,8 @@ pointer_surface_update_scale (GdkDevice *device)
|
||||
scale = 1;
|
||||
for (l = pointer->pointer_surface_outputs; l != NULL; l = l->next)
|
||||
{
|
||||
GdkMonitor *monitor = gdk_wayland_display_get_monitor_for_output (seat->display, l->data);
|
||||
scale = MAX (scale, gdk_monitor_get_scale (monitor));
|
||||
guint32 output_scale = gdk_wayland_display_get_output_scale (display_wayland, l->data);
|
||||
scale = MAX (scale, output_scale);
|
||||
}
|
||||
|
||||
if (pointer->current_output_scale == scale)
|
||||
@@ -3878,7 +3878,6 @@ gdk_wayland_pointer_data_finalize (GdkWaylandPointerData *pointer)
|
||||
g_clear_object (&pointer->cursor);
|
||||
wl_surface_destroy (pointer->pointer_surface);
|
||||
g_slist_free (pointer->pointer_surface_outputs);
|
||||
g_clear_pointer (&pointer->pointer_surface_viewport, wp_viewport_destroy);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -4242,9 +4241,6 @@ init_pointer_data (GdkWaylandPointerData *pointer_data,
|
||||
wl_surface_add_listener (pointer_data->pointer_surface,
|
||||
&pointer_surface_listener,
|
||||
logical_device);
|
||||
|
||||
if (display_wayland->viewporter)
|
||||
pointer_data->pointer_surface_viewport = wp_viewporter_get_viewport (display_wayland->viewporter, pointer_data->pointer_surface);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -4394,24 +4390,15 @@ _gdk_wayland_seat_get_last_implicit_grab_serial (GdkWaylandSeat *seat,
|
||||
serial = tablet->pointer_info.press_serial;
|
||||
}
|
||||
|
||||
if (g_hash_table_size (seat->touches) > 0)
|
||||
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &touch))
|
||||
{
|
||||
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &touch))
|
||||
if (touch->touch_down_serial > serial)
|
||||
{
|
||||
if (touch->touch_down_serial > serial)
|
||||
{
|
||||
if (sequence)
|
||||
*sequence = GDK_SLOT_TO_EVENT_SEQUENCE (touch->id);
|
||||
serial = touch->touch_down_serial;
|
||||
|
||||
}
|
||||
if (sequence)
|
||||
*sequence = GDK_SLOT_TO_EVENT_SEQUENCE (touch->id);
|
||||
serial = touch->touch_down_serial;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (seat->latest_touch_down_serial > serial)
|
||||
serial = seat->latest_touch_down_serial;
|
||||
}
|
||||
|
||||
return serial;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include "gdksubsurfaceprivate.h"
|
||||
|
||||
#include "wayland-client-protocol.h"
|
||||
|
||||
typedef struct _GdkWaylandSubsurface GdkWaylandSubsurface;
|
||||
typedef struct _GdkWaylandSubsurfaceClass GdkWaylandSubsurfaceClass;
|
||||
@@ -24,8 +23,6 @@ struct _GdkWaylandSubsurface
|
||||
GdkTexture *texture;
|
||||
cairo_rectangle_int_t dest;
|
||||
graphene_rect_t source;
|
||||
enum wl_output_transform transform;
|
||||
gboolean lightbox;
|
||||
|
||||
struct wl_region *opaque_region;
|
||||
|
||||
|
||||
@@ -149,26 +149,12 @@ get_wl_buffer (GdkWaylandSubsurface *self,
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static inline enum wl_output_transform
|
||||
gdk_texture_transform_to_wl (GdkTextureTransform transform)
|
||||
{
|
||||
return (enum wl_output_transform) transform;
|
||||
}
|
||||
|
||||
static inline GdkTextureTransform
|
||||
wl_output_transform_to_gdk (enum wl_output_transform transform)
|
||||
{
|
||||
return (GdkTextureTransform) transform;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
||||
GdkTexture *texture,
|
||||
const graphene_rect_t *source,
|
||||
const graphene_rect_t *dest,
|
||||
GdkTextureTransform transform,
|
||||
gboolean above,
|
||||
gboolean lightbox,
|
||||
GdkSubsurface *sibling)
|
||||
{
|
||||
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
|
||||
@@ -202,9 +188,6 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
||||
self->source.size.width = source->size.width;
|
||||
self->source.size.height = source->size.height;
|
||||
|
||||
self->transform = gdk_texture_transform_to_wl (transform);
|
||||
self->lightbox = lightbox;
|
||||
|
||||
scale = gdk_fractional_scale_to_double (&parent->scale);
|
||||
|
||||
device_rect.origin.x = dest->origin.x * scale;
|
||||
@@ -319,7 +302,6 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
||||
|
||||
if (result)
|
||||
{
|
||||
wl_surface_set_buffer_transform (self->surface, self->transform);
|
||||
wl_subsurface_set_position (self->subsurface, self->dest.x, self->dest.y);
|
||||
wp_viewport_set_destination (self->viewport, self->dest.width, self->dest.height);
|
||||
wp_viewport_set_source (self->viewport,
|
||||
@@ -424,22 +406,6 @@ gdk_wayland_subsurface_get_source (GdkSubsurface *sub,
|
||||
source->size.height = self->source.size.height;
|
||||
}
|
||||
|
||||
static GdkTextureTransform
|
||||
gdk_wayland_subsurface_get_transform (GdkSubsurface *sub)
|
||||
{
|
||||
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
|
||||
|
||||
return wl_output_transform_to_gdk (self->transform);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_wayland_subsurface_get_lightbox (GdkSubsurface *sub)
|
||||
{
|
||||
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
|
||||
|
||||
return self->lightbox;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_subsurface_class_init (GdkWaylandSubsurfaceClass *class)
|
||||
{
|
||||
@@ -453,8 +419,6 @@ gdk_wayland_subsurface_class_init (GdkWaylandSubsurfaceClass *class)
|
||||
subsurface_class->get_texture = gdk_wayland_subsurface_get_texture;
|
||||
subsurface_class->get_source = gdk_wayland_subsurface_get_source;
|
||||
subsurface_class->get_dest = gdk_wayland_subsurface_get_dest;
|
||||
subsurface_class->get_transform = gdk_wayland_subsurface_get_transform;
|
||||
subsurface_class->get_lightbox = gdk_wayland_subsurface_get_lightbox;
|
||||
};
|
||||
|
||||
static void
|
||||
@@ -502,9 +466,9 @@ gdk_wayland_surface_create_subsurface (GdkSurface *surface)
|
||||
GdkWaylandSubsurface *sub;
|
||||
struct wl_region *region;
|
||||
|
||||
if (disp->subcompositor == NULL || disp->viewporter == NULL)
|
||||
if (disp->viewporter == NULL)
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (display, OFFLOAD, "Can't use subsurfaces without subcompositor and viewporter");
|
||||
GDK_DISPLAY_DEBUG (display, OFFLOAD, "Can't use subsurfaces without viewporter");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,8 +44,6 @@ struct _GdkWaylandSurface
|
||||
struct wl_event_queue *event_queue;
|
||||
struct wl_callback *frame_callback;
|
||||
|
||||
GdkWaylandPresentationTime *presentation_time;
|
||||
|
||||
unsigned int initial_configure_received : 1;
|
||||
unsigned int has_uncommitted_ack_configure : 1;
|
||||
unsigned int has_pending_subsurface_commits : 1;
|
||||
|
||||
@@ -52,7 +52,6 @@
|
||||
#include "gdktoplevel-wayland-private.h"
|
||||
|
||||
#include "linux-dmabuf-unstable-v1-client-protocol.h"
|
||||
#include "presentation-time-client-protocol.h"
|
||||
|
||||
|
||||
/**
|
||||
@@ -271,20 +270,6 @@ gdk_wayland_surface_update_size (GdkSurface *surface,
|
||||
_gdk_surface_update_size (surface);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_surface_clear_frame_callback (GdkWaylandSurface *self)
|
||||
{
|
||||
GdkSurface *surface = GDK_SURFACE (self);
|
||||
|
||||
g_clear_pointer (&self->frame_callback, wl_callback_destroy);
|
||||
|
||||
for (gsize i = 0; i < gdk_surface_get_n_subsurfaces (surface); i++)
|
||||
{
|
||||
GdkSubsurface *subsurface = gdk_surface_get_subsurface (surface, i);
|
||||
gdk_wayland_subsurface_clear_frame_callback (subsurface);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gdk_wayland_surface_frame_callback (GdkSurface *surface,
|
||||
uint32_t time)
|
||||
@@ -298,7 +283,13 @@ gdk_wayland_surface_frame_callback (GdkSurface *surface,
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland frame event", NULL);
|
||||
GDK_DISPLAY_DEBUG (GDK_DISPLAY (display_wayland), EVENTS, "frame %p", surface);
|
||||
|
||||
gdk_wayland_surface_clear_frame_callback (impl);
|
||||
g_clear_pointer (&impl->frame_callback, wl_callback_destroy);
|
||||
|
||||
for (gsize i = 0; i < gdk_surface_get_n_subsurfaces (surface); i++)
|
||||
{
|
||||
GdkSubsurface *subsurface = gdk_surface_get_subsurface (surface, i);
|
||||
gdk_wayland_subsurface_clear_frame_callback (subsurface);
|
||||
}
|
||||
|
||||
GDK_WAYLAND_SURFACE_GET_CLASS (impl)->handle_frame (impl);
|
||||
|
||||
@@ -412,17 +403,6 @@ gdk_wayland_surface_request_frame (GdkSurface *surface)
|
||||
wl_proxy_set_queue ((struct wl_proxy *) self->frame_callback, NULL);
|
||||
wl_callback_add_listener (self->frame_callback, &frame_listener, surface);
|
||||
|
||||
if (self->presentation_time == NULL)
|
||||
{
|
||||
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
|
||||
self->presentation_time = gdk_wayland_presentation_time_new (wayland_display);
|
||||
}
|
||||
|
||||
gdk_wayland_presentation_time_track (self->presentation_time,
|
||||
clock,
|
||||
self->display_server.wl_surface,
|
||||
gdk_frame_clock_get_frame_counter (clock));
|
||||
|
||||
for (gsize i = 0; i < gdk_surface_get_n_subsurfaces (surface); i++)
|
||||
{
|
||||
GdkSubsurface *subsurface = gdk_surface_get_subsurface (surface, i);
|
||||
@@ -1068,8 +1048,7 @@ gdk_wayland_surface_hide_surface (GdkSurface *surface)
|
||||
|
||||
unmap_popups_for_surface (surface);
|
||||
|
||||
g_clear_pointer (&impl->presentation_time, gdk_wayland_presentation_time_free);
|
||||
gdk_wayland_surface_clear_frame_callback (impl);
|
||||
g_clear_pointer (&impl->frame_callback, wl_callback_destroy);
|
||||
if (impl->awaiting_frame_frozen)
|
||||
{
|
||||
impl->awaiting_frame_frozen = FALSE;
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include "gdktoplevelprivate.h"
|
||||
#include "gdkdevice-wayland-private.h"
|
||||
|
||||
#include <wayland/presentation-time-client-protocol.h>
|
||||
#include <wayland/xdg-shell-unstable-v6-client-protocol.h>
|
||||
#include <wayland/xdg-foreign-unstable-v2-client-protocol.h>
|
||||
|
||||
@@ -123,8 +122,6 @@ struct _GdkWaylandToplevel
|
||||
|
||||
struct wl_output *initial_fullscreen_output;
|
||||
|
||||
struct wp_presentation_feedback *feedback;
|
||||
|
||||
struct {
|
||||
GdkToplevelState unset_flags;
|
||||
GdkToplevelState set_flags;
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <gdk/gdkframeclock.h>
|
||||
#include <gdk/wayland/gdkdisplay-wayland.h>
|
||||
#include <gdk/wayland/gdksurface-wayland.h>
|
||||
#include <gdk/wayland/gdkwaylanddisplay.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GdkWaylandPresentationTime GdkWaylandPresentationTime;
|
||||
|
||||
GdkWaylandPresentationTime *gdk_wayland_presentation_time_new (GdkWaylandDisplay *display);
|
||||
void gdk_wayland_presentation_time_track (GdkWaylandPresentationTime *self,
|
||||
GdkFrameClock *frame_clock,
|
||||
struct wl_surface *surface,
|
||||
gint64 frame_number);
|
||||
void gdk_wayland_presentation_time_free (GdkWaylandPresentationTime *self);
|
||||
|
||||
G_END_DECLS
|
||||
@@ -1,152 +0,0 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <gdk/gdkframeclockprivate.h>
|
||||
|
||||
#include "gdkwaylandpresentationtime-private.h"
|
||||
|
||||
typedef struct _GdkWaylandPresentationFrame
|
||||
{
|
||||
GdkWaylandPresentationTime *self;
|
||||
struct wp_presentation_feedback *feedback;
|
||||
GdkFrameClock *frame_clock;
|
||||
gint64 frame_number;
|
||||
} GdkWaylandPresentationFrame;
|
||||
|
||||
static void
|
||||
gdk_wayland_presentation_frame_free (GdkWaylandPresentationFrame *frame)
|
||||
{
|
||||
g_clear_pointer (&frame->feedback, wp_presentation_feedback_destroy);
|
||||
g_clear_object (&frame->frame_clock);
|
||||
frame->self = NULL;
|
||||
g_free (frame);
|
||||
}
|
||||
|
||||
struct _GdkWaylandPresentationTime
|
||||
{
|
||||
GdkWaylandDisplay *display;
|
||||
GPtrArray *frames;
|
||||
};
|
||||
|
||||
GdkWaylandPresentationTime *
|
||||
gdk_wayland_presentation_time_new (GdkWaylandDisplay *display)
|
||||
{
|
||||
GdkWaylandPresentationTime *self;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_WAYLAND_DISPLAY (display), NULL);
|
||||
|
||||
self = g_new0 (GdkWaylandPresentationTime, 1);
|
||||
self->display = g_object_ref (display);
|
||||
self->frames = g_ptr_array_new_with_free_func ((GDestroyNotify)gdk_wayland_presentation_frame_free);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_wayland_presentation_time_free (GdkWaylandPresentationTime *self)
|
||||
{
|
||||
g_clear_pointer (&self->frames, g_ptr_array_unref);
|
||||
g_clear_object (&self->display);
|
||||
g_free (self);
|
||||
}
|
||||
|
||||
static gint64
|
||||
time_from_wayland (uint32_t tv_sec_hi,
|
||||
uint32_t tv_sec_lo,
|
||||
uint32_t tv_nsec)
|
||||
{
|
||||
guint64 t = tv_sec_hi;
|
||||
t <<= 32;
|
||||
t |= tv_sec_lo;
|
||||
t *= G_USEC_PER_SEC;
|
||||
t += tv_nsec / 1000L;
|
||||
return (gint64)t;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_presentation_feedback_sync_output (void *data,
|
||||
struct wp_presentation_feedback *feedback,
|
||||
struct wl_output *output)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_presentation_feedback_presented (void *data,
|
||||
struct wp_presentation_feedback *feedback,
|
||||
uint32_t tv_sec_hi,
|
||||
uint32_t tv_sec_lo,
|
||||
uint32_t tv_nsec,
|
||||
uint32_t refresh,
|
||||
uint32_t seq_hi,
|
||||
uint32_t seq_lo,
|
||||
uint32_t flags)
|
||||
{
|
||||
GdkWaylandPresentationFrame *frame = data;
|
||||
GdkWaylandPresentationTime *self;
|
||||
GdkFrameTimings *timings;
|
||||
guint pos;
|
||||
|
||||
g_assert (frame != NULL);
|
||||
g_assert (frame->self != NULL);
|
||||
|
||||
self = frame->self;
|
||||
|
||||
if ((timings = gdk_frame_clock_get_timings (frame->frame_clock, frame->frame_number)))
|
||||
{
|
||||
timings->presentation_time = time_from_wayland (tv_sec_hi, tv_sec_lo, tv_nsec);
|
||||
timings->complete = TRUE;
|
||||
}
|
||||
|
||||
if (g_ptr_array_find (self->frames, frame, &pos))
|
||||
g_ptr_array_remove_index_fast (self->frames, pos);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_presentation_feedback_discarded (void *data,
|
||||
struct wp_presentation_feedback *feedback)
|
||||
{
|
||||
GdkWaylandPresentationFrame *frame = data;
|
||||
guint pos;
|
||||
|
||||
g_assert (frame != NULL);
|
||||
g_assert (frame->self != NULL);
|
||||
|
||||
if (g_ptr_array_find (frame->self->frames, frame, &pos))
|
||||
g_ptr_array_remove_index_fast (frame->self->frames, pos);
|
||||
}
|
||||
|
||||
static const struct wp_presentation_feedback_listener gdk_wayland_presentation_feedback_listener = {
|
||||
gdk_wayland_presentation_feedback_sync_output,
|
||||
gdk_wayland_presentation_feedback_presented,
|
||||
gdk_wayland_presentation_feedback_discarded,
|
||||
};
|
||||
|
||||
void
|
||||
gdk_wayland_presentation_time_track (GdkWaylandPresentationTime *self,
|
||||
GdkFrameClock *frame_clock,
|
||||
struct wl_surface *surface,
|
||||
gint64 frame_number)
|
||||
{
|
||||
struct wp_presentation_feedback *feedback;
|
||||
GdkWaylandPresentationFrame *frame;
|
||||
|
||||
g_return_if_fail (self != NULL);
|
||||
g_return_if_fail (surface != NULL);
|
||||
|
||||
if (self->display->presentation == NULL)
|
||||
return;
|
||||
|
||||
if (!(feedback = wp_presentation_feedback (self->display->presentation, surface)))
|
||||
return;
|
||||
|
||||
frame = g_new0 (GdkWaylandPresentationFrame, 1);
|
||||
frame->self = self;
|
||||
frame->frame_clock = g_object_ref (frame_clock);
|
||||
frame->frame_number = frame_number;
|
||||
frame->feedback = g_steal_pointer (&feedback);
|
||||
|
||||
g_ptr_array_add (self->frames, frame);
|
||||
|
||||
wp_presentation_feedback_add_listener (frame->feedback,
|
||||
&gdk_wayland_presentation_feedback_listener,
|
||||
frame);
|
||||
}
|
||||
@@ -22,7 +22,6 @@ gdk_wayland_sources = files([
|
||||
'gdktoplevel-wayland.c',
|
||||
'gdkpopup-wayland.c',
|
||||
'gdkvulkancontext-wayland.c',
|
||||
'gdkwaylandpresentationtime.c',
|
||||
'wm-button-layout-translation.c',
|
||||
])
|
||||
|
||||
@@ -70,7 +69,6 @@ proto_sources = [
|
||||
['xdg-activation', 'staging', 'v1', ],
|
||||
['fractional-scale', 'staging', 'v1', ],
|
||||
['linux-dmabuf', 'unstable', 'v1', ],
|
||||
['presentation-time', 'stable', 'v1', ],
|
||||
]
|
||||
|
||||
gdk_wayland_gen_headers = []
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include "gdkcursor.h"
|
||||
#include "gdkwin32.h"
|
||||
#include "gdktextureprivate.h"
|
||||
#include "gdkcursorprivate.h"
|
||||
|
||||
#include "gdkdisplay-win32.h"
|
||||
|
||||
@@ -1482,7 +1481,6 @@ gdk_win32_display_get_win32hcursor (GdkWin32Display *display,
|
||||
GdkWin32Display *win32_display = GDK_WIN32_DISPLAY (display);
|
||||
GdkWin32HCursor *win32hcursor;
|
||||
const char *cursor_name;
|
||||
GdkTexture *texture;
|
||||
GdkCursor *fallback;
|
||||
|
||||
g_return_val_if_fail (cursor != NULL, NULL);
|
||||
@@ -1496,32 +1494,14 @@ gdk_win32_display_get_win32hcursor (GdkWin32Display *display,
|
||||
return win32hcursor;
|
||||
|
||||
cursor_name = gdk_cursor_get_name (cursor);
|
||||
texture = gdk_cursor_get_texture (cursor);
|
||||
|
||||
if (cursor_name)
|
||||
win32hcursor = gdk_win32hcursor_create_for_name (display, cursor_name);
|
||||
else if (texture)
|
||||
else
|
||||
win32hcursor = gdk_win32hcursor_create_for_texture (display,
|
||||
texture,
|
||||
gdk_cursor_get_texture (cursor),
|
||||
gdk_cursor_get_hotspot_x (cursor),
|
||||
gdk_cursor_get_hotspot_y (cursor));
|
||||
else
|
||||
{
|
||||
int size = display->cursor_theme_size;
|
||||
int width, height, hotspot_x, hotspot_y;
|
||||
|
||||
texture = gdk_cursor_get_texture_for_size (cursor, size, 1,
|
||||
&width, &height,
|
||||
&hotspot_x, &hotspot_y);
|
||||
if (texture)
|
||||
{
|
||||
win32hcursor = gdk_win32hcursor_create_for_texture (display,
|
||||
texture,
|
||||
hotspot_x,
|
||||
hotspot_y);
|
||||
g_object_unref (texture);
|
||||
}
|
||||
}
|
||||
|
||||
if (win32hcursor != NULL)
|
||||
{
|
||||
|
||||
@@ -1627,7 +1627,7 @@ _gdk_win32_surface_lacks_wm_decorations (GdkSurface *window)
|
||||
has_any_decorations = FALSE;
|
||||
|
||||
if (style & (WS_BORDER | WS_THICKFRAME | WS_CAPTION |
|
||||
WS_SYSMENU | WS_MAXIMIZEBOX))
|
||||
WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX))
|
||||
has_any_decorations = TRUE;
|
||||
else
|
||||
GDK_NOTE (MISC, g_print ("Window %p (handle %p): has no decorations (style %lx)\n",
|
||||
@@ -1696,6 +1696,7 @@ _gdk_win32_surface_update_style_bits (GdkSurface *window)
|
||||
update_single_bit (&new_style, all, decorations & GDK_DECOR_RESIZEH, WS_THICKFRAME);
|
||||
update_single_bit (&new_style, all, decorations & GDK_DECOR_TITLE, WS_CAPTION);
|
||||
update_single_bit (&new_style, all, decorations & GDK_DECOR_MENU, WS_SYSMENU);
|
||||
update_single_bit (&new_style, all, decorations & GDK_DECOR_MINIMIZE, WS_MINIMIZEBOX);
|
||||
update_single_bit (&new_style, all, decorations & GDK_DECOR_MAXIMIZE, WS_MAXIMIZEBOX);
|
||||
}
|
||||
|
||||
|
||||
@@ -370,33 +370,11 @@ gdk_x11_display_get_xcursor (GdkDisplay *display,
|
||||
|
||||
if (gdk_cursor_get_name (cursor))
|
||||
xcursor = gdk_x11_cursor_create_for_name (display, gdk_cursor_get_name (cursor));
|
||||
else if (gdk_cursor_get_texture (cursor))
|
||||
else
|
||||
xcursor = gdk_x11_cursor_create_for_texture (display,
|
||||
gdk_cursor_get_texture (cursor),
|
||||
gdk_cursor_get_hotspot_x (cursor),
|
||||
gdk_cursor_get_hotspot_y (cursor));
|
||||
else
|
||||
{
|
||||
int size;
|
||||
GdkTexture *texture;
|
||||
int width, height;
|
||||
int hotspot_x, hotspot_y;
|
||||
|
||||
size = XcursorGetDefaultSize (GDK_DISPLAY_XDISPLAY (display));
|
||||
|
||||
texture = gdk_cursor_get_texture_for_size (cursor, size, 1,
|
||||
&width, &height,
|
||||
&hotspot_x, &hotspot_y);
|
||||
|
||||
if (texture)
|
||||
{
|
||||
xcursor = gdk_x11_cursor_create_for_texture (display,
|
||||
texture,
|
||||
hotspot_x,
|
||||
hotspot_y);
|
||||
g_object_unref (texture);
|
||||
}
|
||||
}
|
||||
|
||||
if (xcursor != None)
|
||||
{
|
||||
|
||||
@@ -488,14 +488,12 @@ gsk_gl_command_queue_new (GdkGLContext *context,
|
||||
int max_texture_size = atoi (g_getenv ("GSK_MAX_TEXTURE_SIZE"));
|
||||
if (max_texture_size == 0)
|
||||
{
|
||||
g_warning ("Failed to parse %s", "GSK_MAX_TEXTURE_SIZE");
|
||||
g_warning ("Failed to parse GSK_MAX_TEXTURE_SIZE");
|
||||
}
|
||||
else
|
||||
{
|
||||
max_texture_size = MAX (max_texture_size, 512);
|
||||
GSK_DEBUG (RENDERER,
|
||||
"Limiting texture size in the GL renderer to %d (via %s)",
|
||||
max_texture_size, "GSK_MAX_TEXTURE_SIZE");
|
||||
GSK_DEBUG(OPENGL, "Limiting max texture size to %d", max_texture_size);
|
||||
self->max_texture_size = MIN (self->max_texture_size, max_texture_size);
|
||||
}
|
||||
}
|
||||
@@ -1624,7 +1622,7 @@ gsk_gl_command_queue_do_upload_texture_chunk (GskGLCommandQueue *self,
|
||||
{
|
||||
glTexSubImage2D (GL_TEXTURE_2D, 0, x, y, width, height, gl_format, gl_type, data);
|
||||
}
|
||||
else if (stride % bpp == 0 && gdk_gl_context_has_feature (self->context, GDK_GL_FEATURE_UNPACK_SUBIMAGE))
|
||||
else if (stride % bpp == 0 && gdk_gl_context_has_unpack_subimage (self->context))
|
||||
{
|
||||
glPixelStorei (GL_UNPACK_ROW_LENGTH, stride / bpp);
|
||||
|
||||
|
||||
@@ -1835,7 +1835,7 @@ gsk_gl_driver_create_gdk_texture (GskGLDriver *self,
|
||||
state = g_new0 (GskGLTextureState, 1);
|
||||
state->texture_id = texture_id;
|
||||
state->context = g_object_ref (self->command_queue->context);
|
||||
if (gdk_gl_context_has_feature (self->command_queue->context, GDK_GL_FEATURE_SYNC))
|
||||
if (gdk_gl_context_has_sync (self->command_queue->context))
|
||||
state->sync = glFenceSync (GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
||||
|
||||
g_hash_table_steal (self->textures, GUINT_TO_POINTER (texture_id));
|
||||
|
||||
@@ -194,7 +194,7 @@ gsk_gl_renderer_realize (GskRenderer *renderer,
|
||||
{
|
||||
gdk_gl_context_make_current (context);
|
||||
|
||||
if (!gdk_gl_context_has_feature (context, GDK_GL_FEATURE_VERTEX_HALF_FLOAT))
|
||||
if (!gdk_gl_context_has_vertex_half_float (context))
|
||||
{
|
||||
int major, minor;
|
||||
|
||||
|
||||
@@ -52,6 +52,8 @@
|
||||
#include "ninesliceprivate.h"
|
||||
#include "fp16private.h"
|
||||
|
||||
#define ALLOW_OFFLOAD_FOR_ANY_TEXTURE 1
|
||||
|
||||
#define ORTHO_NEAR_PLANE -10000
|
||||
#define ORTHO_FAR_PLANE 10000
|
||||
#define MAX_GRADIENT_STOPS 6
|
||||
@@ -174,8 +176,6 @@ struct _GskGLRenderJob
|
||||
* looking at the format of the framebuffer we are rendering on.
|
||||
*/
|
||||
int target_format;
|
||||
|
||||
guint offscreen_count; /* if > 0, we're rendering to an offscreen */
|
||||
};
|
||||
|
||||
typedef struct _GskGLRenderOffscreen
|
||||
@@ -1235,7 +1235,7 @@ gsk_gl_render_job_visit_as_fallback (GskGLRenderJob *job,
|
||||
texture = gdk_texture_new_for_surface (surface);
|
||||
texture_id = gsk_gl_driver_load_texture (job->driver, texture, FALSE);
|
||||
|
||||
if (gdk_gl_context_has_feature (job->command_queue->context, GDK_GL_FEATURE_DEBUG))
|
||||
if (gdk_gl_context_has_debug (job->command_queue->context))
|
||||
gdk_gl_context_label_object_printf (job->command_queue->context, GL_TEXTURE, texture_id,
|
||||
"Fallback %s %d",
|
||||
g_type_name_from_instance ((GTypeInstance *) node),
|
||||
@@ -2532,7 +2532,7 @@ gsk_gl_render_job_visit_blurred_outset_shadow_node (GskGLRenderJob *job,
|
||||
get_target_format (job, node),
|
||||
&render_target);
|
||||
|
||||
if (gdk_gl_context_has_feature (context, GDK_GL_FEATURE_DEBUG))
|
||||
if (gdk_gl_context_has_debug (context))
|
||||
{
|
||||
gdk_gl_context_label_object_printf (context,
|
||||
GL_TEXTURE,
|
||||
@@ -4002,15 +4002,9 @@ gsk_gl_render_job_visit_subsurface_node (GskGLRenderJob *job,
|
||||
{
|
||||
if (!gdk_subsurface_is_above_parent (subsurface))
|
||||
{
|
||||
if (job->offscreen_count > 0)
|
||||
/* Clear the area so we can see through */
|
||||
if (gsk_gl_render_job_begin_draw (job, CHOOSE_PROGRAM (job, color)))
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (gdk_gl_context_get_display (job->command_queue->context), OFFLOAD, "Hiding subsurface %p in offscreen context", subsurface);
|
||||
gdk_subsurface_detach (subsurface);
|
||||
gsk_gl_render_job_visit_node (job, gsk_subsurface_node_get_child (node));
|
||||
}
|
||||
else if (gsk_gl_render_job_begin_draw (job, CHOOSE_PROGRAM (job, color)))
|
||||
{
|
||||
/* Clear the area so we can see through */
|
||||
GskGLCommandBatch *batch;
|
||||
guint16 color[4];
|
||||
rgba_to_half (&(GdkRGBA){0,0,0,0}, color);
|
||||
@@ -4388,7 +4382,7 @@ gsk_gl_render_job_visit_node_with_offscreen (GskGLRenderJob *job,
|
||||
&render_target))
|
||||
g_assert_not_reached ();
|
||||
|
||||
if (gdk_gl_context_has_feature (job->command_queue->context, GDK_GL_FEATURE_DEBUG))
|
||||
if (gdk_gl_context_has_debug (job->command_queue->context))
|
||||
{
|
||||
gdk_gl_context_label_object_printf (job->command_queue->context,
|
||||
GL_TEXTURE,
|
||||
@@ -4428,12 +4422,8 @@ gsk_gl_render_job_visit_node_with_offscreen (GskGLRenderJob *job,
|
||||
reset_clip = TRUE;
|
||||
}
|
||||
|
||||
job->offscreen_count++;
|
||||
|
||||
gsk_gl_render_job_visit_node (job, node);
|
||||
|
||||
job->offscreen_count--;
|
||||
|
||||
if (reset_clip)
|
||||
gsk_gl_render_job_pop_clip (job);
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "gskglbufferprivate.h"
|
||||
#include <gdk/gdkprofilerprivate.h>
|
||||
|
||||
/* {{{ GskGLBuffer */
|
||||
#include "gskglbufferprivate.h"
|
||||
|
||||
struct _GskGLBuffer
|
||||
{
|
||||
@@ -10,16 +10,21 @@ struct _GskGLBuffer
|
||||
|
||||
GLenum target;
|
||||
GLuint buffer_id;
|
||||
GLenum access;
|
||||
guchar *data;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GskGLBuffer, gsk_gl_buffer, GSK_TYPE_GPU_BUFFER)
|
||||
|
||||
static guint profiler_buffer_uploads_id;
|
||||
static gint64 profiler_buffer_uploads;
|
||||
|
||||
static void
|
||||
gsk_gl_buffer_finalize (GObject *object)
|
||||
{
|
||||
GskGLBuffer *self = GSK_GL_BUFFER (object);
|
||||
|
||||
g_free (self->data);
|
||||
glDeleteBuffers (1, &self->buffer_id);
|
||||
|
||||
G_OBJECT_CLASS (gsk_gl_buffer_parent_class)->finalize (object);
|
||||
@@ -37,6 +42,16 @@ static void
|
||||
gsk_gl_buffer_unmap (GskGpuBuffer *buffer,
|
||||
gsize used)
|
||||
{
|
||||
GskGLBuffer *self = GSK_GL_BUFFER (buffer);
|
||||
|
||||
if (used == 0)
|
||||
return;
|
||||
|
||||
gsk_gl_buffer_bind (self);
|
||||
|
||||
profiler_buffer_uploads += used;
|
||||
glBufferSubData (self->target, 0, used, self->data);
|
||||
gdk_profiler_set_int_counter (profiler_buffer_uploads_id, profiler_buffer_uploads);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -49,6 +64,8 @@ gsk_gl_buffer_class_init (GskGLBufferClass *klass)
|
||||
buffer_class->unmap = gsk_gl_buffer_unmap;
|
||||
|
||||
gobject_class->finalize = gsk_gl_buffer_finalize;
|
||||
|
||||
profiler_buffer_uploads_id = gdk_profiler_define_int_counter ("ngl-buffer-uploads", "Number of bytes uploaded to GPU");
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -56,6 +73,28 @@ gsk_gl_buffer_init (GskGLBuffer *self)
|
||||
{
|
||||
}
|
||||
|
||||
GskGpuBuffer *
|
||||
gsk_gl_buffer_new (GLenum target,
|
||||
gsize size,
|
||||
GLenum access)
|
||||
{
|
||||
GskGLBuffer *self;
|
||||
|
||||
self = g_object_new (GSK_TYPE_GL_BUFFER, NULL);
|
||||
|
||||
gsk_gpu_buffer_setup (GSK_GPU_BUFFER (self), size);
|
||||
|
||||
self->target = target;
|
||||
self->access = access;
|
||||
|
||||
glGenBuffers (1, &self->buffer_id);
|
||||
glBindBuffer (target, self->buffer_id);
|
||||
glBufferData (target, size, NULL, GL_STATIC_DRAW);
|
||||
self->data = malloc (size);
|
||||
|
||||
return GSK_GPU_BUFFER (self);
|
||||
}
|
||||
|
||||
void
|
||||
gsk_gl_buffer_bind (GskGLBuffer *self)
|
||||
{
|
||||
@@ -69,140 +108,3 @@ gsk_gl_buffer_bind_base (GskGLBuffer *self,
|
||||
glBindBufferBase (self->target, index, self->buffer_id);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gl_buffer_setup (GskGLBuffer *self,
|
||||
GLenum target,
|
||||
gsize size)
|
||||
{
|
||||
gsk_gpu_buffer_setup (GSK_GPU_BUFFER (self), size);
|
||||
|
||||
self->target = target;
|
||||
|
||||
glGenBuffers (1, &self->buffer_id);
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ GskGLMappedBuffer */
|
||||
|
||||
struct _GskGLMappedBuffer
|
||||
{
|
||||
GskGLBuffer parent_instance;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GskGLMappedBuffer, gsk_gl_mapped_buffer, GSK_TYPE_GL_BUFFER)
|
||||
|
||||
static void
|
||||
gsk_gl_mapped_buffer_finalize (GObject *object)
|
||||
{
|
||||
GskGLBuffer *self = GSK_GL_BUFFER (object);
|
||||
|
||||
gsk_gl_buffer_bind (self);
|
||||
glUnmapBuffer (self->target);
|
||||
|
||||
G_OBJECT_CLASS (gsk_gl_mapped_buffer_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gl_mapped_buffer_class_init (GskGLMappedBufferClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->finalize = gsk_gl_mapped_buffer_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gl_mapped_buffer_init (GskGLMappedBuffer *self)
|
||||
{
|
||||
}
|
||||
|
||||
GskGpuBuffer *
|
||||
gsk_gl_mapped_buffer_new (GLenum target,
|
||||
gsize size)
|
||||
{
|
||||
GskGLBuffer *self;
|
||||
|
||||
self = g_object_new (GSK_TYPE_GL_MAPPED_BUFFER, NULL);
|
||||
|
||||
gsk_gl_buffer_setup (self, target, size);
|
||||
gsk_gl_buffer_bind (self);
|
||||
|
||||
glBufferStorage (target,
|
||||
size,
|
||||
NULL,
|
||||
GL_MAP_READ_BIT | GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT);
|
||||
self->data = glMapBufferRange (target,
|
||||
0,
|
||||
size,
|
||||
GL_MAP_READ_BIT | GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT);
|
||||
|
||||
return GSK_GPU_BUFFER (self);
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ GskGLCopiedBuffer */
|
||||
|
||||
struct _GskGLCopiedBuffer
|
||||
{
|
||||
GskGLBuffer parent_instance;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GskGLCopiedBuffer, gsk_gl_copied_buffer, GSK_TYPE_GL_BUFFER)
|
||||
|
||||
static void
|
||||
gsk_gl_copied_buffer_finalize (GObject *object)
|
||||
{
|
||||
GskGLBuffer *self = GSK_GL_BUFFER (object);
|
||||
|
||||
g_free (self->data);
|
||||
|
||||
G_OBJECT_CLASS (gsk_gl_copied_buffer_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gl_copied_buffer_unmap (GskGpuBuffer *buffer,
|
||||
gsize used)
|
||||
{
|
||||
GskGLBuffer *self = GSK_GL_BUFFER (buffer);
|
||||
|
||||
if (used == 0)
|
||||
return;
|
||||
|
||||
gsk_gl_buffer_bind (self);
|
||||
|
||||
glBufferSubData (self->target, 0, used, self->data);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gl_copied_buffer_class_init (GskGLCopiedBufferClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GskGpuBufferClass *buffer_class = GSK_GPU_BUFFER_CLASS (klass);
|
||||
|
||||
gobject_class->finalize = gsk_gl_copied_buffer_finalize;
|
||||
|
||||
buffer_class->unmap = gsk_gl_copied_buffer_unmap;
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gl_copied_buffer_init (GskGLCopiedBuffer *self)
|
||||
{
|
||||
}
|
||||
|
||||
GskGpuBuffer *
|
||||
gsk_gl_copied_buffer_new (GLenum target,
|
||||
gsize size)
|
||||
{
|
||||
GskGLBuffer *self;
|
||||
|
||||
self = g_object_new (GSK_TYPE_GL_COPIED_BUFFER, NULL);
|
||||
|
||||
gsk_gl_buffer_setup (self, target, size);
|
||||
gsk_gl_buffer_bind (self);
|
||||
|
||||
glBufferData (target, size, NULL, GL_STATIC_DRAW);
|
||||
self->data = malloc (size);
|
||||
|
||||
return GSK_GPU_BUFFER (self);
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
@@ -7,17 +7,12 @@
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GSK_TYPE_GL_BUFFER (gsk_gl_buffer_get_type ())
|
||||
#define GSK_TYPE_GL_MAPPED_BUFFER (gsk_gl_mapped_buffer_get_type ())
|
||||
#define GSK_TYPE_GL_COPIED_BUFFER (gsk_gl_copied_buffer_get_type ())
|
||||
|
||||
G_DECLARE_FINAL_TYPE (GskGLBuffer, gsk_gl_buffer, GSK, GL_BUFFER, GskGpuBuffer)
|
||||
G_DECLARE_FINAL_TYPE (GskGLMappedBuffer, gsk_gl_mapped_buffer, GSK, GL_MAPPED_BUFFER, GskGLBuffer)
|
||||
G_DECLARE_FINAL_TYPE (GskGLCopiedBuffer, gsk_gl_copied_buffer, GSK, GL_COPIED_BUFFER, GskGLBuffer)
|
||||
|
||||
GskGpuBuffer * gsk_gl_mapped_buffer_new (GLenum target,
|
||||
gsize size);
|
||||
GskGpuBuffer * gsk_gl_copied_buffer_new (GLenum target,
|
||||
gsize size);
|
||||
GskGpuBuffer * gsk_gl_buffer_new (GLenum target,
|
||||
gsize size,
|
||||
GLenum access);
|
||||
|
||||
void gsk_gl_buffer_bind (GskGLBuffer *self);
|
||||
void gsk_gl_buffer_bind_base (GskGLBuffer *self,
|
||||
|
||||
@@ -20,7 +20,6 @@ struct _GskGLFrame
|
||||
|
||||
GLuint globals_buffer_id;
|
||||
guint next_texture_slot;
|
||||
GLsync sync;
|
||||
|
||||
GHashTable *vaos;
|
||||
};
|
||||
@@ -35,23 +34,7 @@ G_DEFINE_TYPE (GskGLFrame, gsk_gl_frame, GSK_TYPE_GPU_FRAME)
|
||||
static gboolean
|
||||
gsk_gl_frame_is_busy (GskGpuFrame *frame)
|
||||
{
|
||||
GskGLFrame *self = GSK_GL_FRAME (frame);
|
||||
|
||||
if (!self->sync)
|
||||
return FALSE;
|
||||
|
||||
return glClientWaitSync (self->sync, 0, 0) == GL_TIMEOUT_EXPIRED;
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gl_frame_wait (GskGpuFrame *frame)
|
||||
{
|
||||
GskGLFrame *self = GSK_GL_FRAME (frame);
|
||||
|
||||
if (!self->sync)
|
||||
return;
|
||||
|
||||
glClientWaitSync (self->sync, 0, G_MAXINT64);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -67,12 +50,6 @@ gsk_gl_frame_cleanup (GskGpuFrame *frame)
|
||||
{
|
||||
GskGLFrame *self = GSK_GL_FRAME (frame);
|
||||
|
||||
if (self->sync)
|
||||
{
|
||||
glClientWaitSync (self->sync, 0, -1);
|
||||
g_clear_pointer (&self->sync, glDeleteSync);
|
||||
}
|
||||
|
||||
self->next_texture_slot = 0;
|
||||
|
||||
GSK_GPU_FRAME_CLASS (gsk_gl_frame_parent_class)->cleanup (frame);
|
||||
@@ -147,22 +124,14 @@ gsk_gl_frame_create_vertex_buffer (GskGpuFrame *frame,
|
||||
*/
|
||||
g_hash_table_remove_all (self->vaos);
|
||||
|
||||
if (gdk_gl_context_has_feature (GDK_GL_CONTEXT (gsk_gpu_frame_get_context (frame)),
|
||||
GDK_GL_FEATURE_BUFFER_STORAGE))
|
||||
return gsk_gl_mapped_buffer_new (GL_ARRAY_BUFFER, size);
|
||||
else
|
||||
return gsk_gl_copied_buffer_new (GL_ARRAY_BUFFER, size);
|
||||
return gsk_gl_buffer_new (GL_ARRAY_BUFFER, size, GL_WRITE_ONLY);
|
||||
}
|
||||
|
||||
static GskGpuBuffer *
|
||||
gsk_gl_frame_create_storage_buffer (GskGpuFrame *frame,
|
||||
gsize size)
|
||||
{
|
||||
if (gdk_gl_context_has_feature (GDK_GL_CONTEXT (gsk_gpu_frame_get_context (frame)),
|
||||
GDK_GL_FEATURE_BUFFER_STORAGE))
|
||||
return gsk_gl_mapped_buffer_new (GL_UNIFORM_BUFFER, size);
|
||||
else
|
||||
return gsk_gl_copied_buffer_new (GL_UNIFORM_BUFFER, size);
|
||||
return gsk_gl_buffer_new (GL_UNIFORM_BUFFER, size, GL_WRITE_ONLY);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -191,10 +160,6 @@ gsk_gl_frame_submit (GskGpuFrame *frame,
|
||||
{
|
||||
op = gsk_gpu_op_gl_command (op, frame, &state);
|
||||
}
|
||||
|
||||
if (gdk_gl_context_has_feature (GDK_GL_CONTEXT (gsk_gpu_frame_get_context (frame)),
|
||||
GDK_GL_FEATURE_SYNC))
|
||||
self->sync = glFenceSync (GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -215,7 +180,6 @@ gsk_gl_frame_class_init (GskGLFrameClass *klass)
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gpu_frame_class->is_busy = gsk_gl_frame_is_busy;
|
||||
gpu_frame_class->wait = gsk_gl_frame_wait;
|
||||
gpu_frame_class->setup = gsk_gl_frame_setup;
|
||||
gpu_frame_class->cleanup = gsk_gl_frame_cleanup;
|
||||
gpu_frame_class->upload_texture = gsk_gl_frame_upload_texture;
|
||||
|
||||
@@ -17,16 +17,23 @@ struct _GskGpuBlendModeOp
|
||||
};
|
||||
|
||||
static void
|
||||
gsk_gpu_blend_mode_op_print_instance (GskGpuShaderOp *shader,
|
||||
gpointer instance_,
|
||||
GString *string)
|
||||
gsk_gpu_blend_mode_op_print (GskGpuOp *op,
|
||||
GskGpuFrame *frame,
|
||||
GString *string,
|
||||
guint indent)
|
||||
{
|
||||
GskGpuBlendmodeInstance *instance = (GskGpuBlendmodeInstance *) instance_;
|
||||
GskGpuShaderOp *shader = (GskGpuShaderOp *) op;
|
||||
GskGpuBlendmodeInstance *instance;
|
||||
|
||||
instance = (GskGpuBlendmodeInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
|
||||
|
||||
gsk_gpu_print_op (string, indent, "blend-mode");
|
||||
gsk_gpu_print_shader_info (string, shader->clip);
|
||||
gsk_gpu_print_rect (string, instance->rect);
|
||||
gsk_gpu_print_image_descriptor (string, shader->desc, instance->bottom_id);
|
||||
gsk_gpu_print_enum (string, GSK_TYPE_BLEND_MODE, shader->variation);
|
||||
gsk_gpu_print_image_descriptor (string, shader->desc, instance->top_id);
|
||||
gsk_gpu_print_newline (string);
|
||||
}
|
||||
|
||||
static const GskGpuShaderOpClass GSK_GPU_BLEND_MODE_OP_CLASS = {
|
||||
@@ -34,7 +41,7 @@ static const GskGpuShaderOpClass GSK_GPU_BLEND_MODE_OP_CLASS = {
|
||||
GSK_GPU_OP_SIZE (GskGpuBlendModeOp),
|
||||
GSK_GPU_STAGE_SHADER,
|
||||
gsk_gpu_shader_op_finish,
|
||||
gsk_gpu_shader_op_print,
|
||||
gsk_gpu_blend_mode_op_print,
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
gsk_gpu_shader_op_vk_command,
|
||||
#endif
|
||||
@@ -45,7 +52,6 @@ static const GskGpuShaderOpClass GSK_GPU_BLEND_MODE_OP_CLASS = {
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
&gsk_gpu_blendmode_info,
|
||||
#endif
|
||||
gsk_gpu_blend_mode_op_print_instance,
|
||||
gsk_gpu_blendmode_setup_attrib_locations,
|
||||
gsk_gpu_blendmode_setup_vao
|
||||
};
|
||||
|
||||
@@ -20,15 +20,22 @@ struct _GskGpuBlurOp
|
||||
};
|
||||
|
||||
static void
|
||||
gsk_gpu_blur_op_print_instance (GskGpuShaderOp *shader,
|
||||
gpointer instance_,
|
||||
GString *string)
|
||||
gsk_gpu_blur_op_print (GskGpuOp *op,
|
||||
GskGpuFrame *frame,
|
||||
GString *string,
|
||||
guint indent)
|
||||
{
|
||||
GskGpuBlurInstance *instance = (GskGpuBlurInstance *) instance_;
|
||||
GskGpuShaderOp *shader = (GskGpuShaderOp *) op;
|
||||
GskGpuBlurInstance *instance;
|
||||
|
||||
instance = (GskGpuBlurInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
|
||||
|
||||
gsk_gpu_print_op (string, indent, "blur");
|
||||
gsk_gpu_print_shader_info (string, shader->clip);
|
||||
g_string_append_printf (string, "%g,%g ", instance->blur_direction[0], instance->blur_direction[1]);
|
||||
gsk_gpu_print_rect (string, instance->rect);
|
||||
gsk_gpu_print_image_descriptor (string, shader->desc, instance->tex_id);
|
||||
gsk_gpu_print_newline (string);
|
||||
}
|
||||
|
||||
static const GskGpuShaderOpClass GSK_GPU_BLUR_OP_CLASS = {
|
||||
@@ -36,7 +43,7 @@ static const GskGpuShaderOpClass GSK_GPU_BLUR_OP_CLASS = {
|
||||
GSK_GPU_OP_SIZE (GskGpuBlurOp),
|
||||
GSK_GPU_STAGE_SHADER,
|
||||
gsk_gpu_shader_op_finish,
|
||||
gsk_gpu_shader_op_print,
|
||||
gsk_gpu_blur_op_print,
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
gsk_gpu_shader_op_vk_command,
|
||||
#endif
|
||||
@@ -47,7 +54,6 @@ static const GskGpuShaderOpClass GSK_GPU_BLUR_OP_CLASS = {
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
&gsk_gpu_blur_info,
|
||||
#endif
|
||||
gsk_gpu_blur_op_print_instance,
|
||||
gsk_gpu_blur_setup_attrib_locations,
|
||||
gsk_gpu_blur_setup_vao
|
||||
};
|
||||
|
||||
@@ -25,12 +25,18 @@ color_equal (const float *color1,
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gpu_border_op_print_instance (GskGpuShaderOp *shader,
|
||||
gpointer instance_,
|
||||
GString *string)
|
||||
gsk_gpu_border_op_print (GskGpuOp *op,
|
||||
GskGpuFrame *frame,
|
||||
GString *string,
|
||||
guint indent)
|
||||
{
|
||||
GskGpuBorderInstance *instance = (GskGpuBorderInstance *) instance_;
|
||||
GskGpuShaderOp *shader = (GskGpuShaderOp *) op;
|
||||
GskGpuBorderInstance *instance;
|
||||
|
||||
instance = (GskGpuBorderInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
|
||||
|
||||
gsk_gpu_print_op (string, indent, "border");
|
||||
gsk_gpu_print_shader_info (string, shader->clip);
|
||||
gsk_gpu_print_rounded_rect (string, instance->outline);
|
||||
|
||||
gsk_gpu_print_rgba (string, (const float *) &instance->border_colors[0]);
|
||||
@@ -52,6 +58,8 @@ gsk_gpu_border_op_print_instance (GskGpuShaderOp *shader,
|
||||
instance->border_widths[2],
|
||||
instance->border_widths[3]);
|
||||
}
|
||||
|
||||
gsk_gpu_print_newline (string);
|
||||
}
|
||||
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
@@ -77,7 +85,7 @@ static const GskGpuShaderOpClass GSK_GPU_BORDER_OP_CLASS = {
|
||||
GSK_GPU_OP_SIZE (GskGpuBorderOp),
|
||||
GSK_GPU_STAGE_SHADER,
|
||||
gsk_gpu_shader_op_finish,
|
||||
gsk_gpu_shader_op_print,
|
||||
gsk_gpu_border_op_print,
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
gsk_gpu_border_op_vk_command,
|
||||
#endif
|
||||
@@ -88,7 +96,6 @@ static const GskGpuShaderOpClass GSK_GPU_BORDER_OP_CLASS = {
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
&gsk_gpu_border_info,
|
||||
#endif
|
||||
gsk_gpu_border_op_print_instance,
|
||||
gsk_gpu_border_setup_attrib_locations,
|
||||
gsk_gpu_border_setup_vao
|
||||
};
|
||||
|
||||
@@ -20,17 +20,24 @@ struct _GskGpuBoxShadowOp
|
||||
};
|
||||
|
||||
static void
|
||||
gsk_gpu_box_shadow_op_print_instance (GskGpuShaderOp *shader,
|
||||
gpointer instance_,
|
||||
GString *string)
|
||||
gsk_gpu_box_shadow_op_print (GskGpuOp *op,
|
||||
GskGpuFrame *frame,
|
||||
GString *string,
|
||||
guint indent)
|
||||
{
|
||||
GskGpuBoxshadowInstance *instance = (GskGpuBoxshadowInstance *) instance_;
|
||||
GskGpuShaderOp *shader = (GskGpuShaderOp *) op;
|
||||
GskGpuBoxshadowInstance *instance;
|
||||
|
||||
instance = (GskGpuBoxshadowInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
|
||||
|
||||
gsk_gpu_print_op (string, indent, shader->variation & VARIATION_INSET ? "inset-shadow" : "outset-shadow");
|
||||
gsk_gpu_print_shader_info (string, shader->clip);
|
||||
gsk_gpu_print_rounded_rect (string, instance->outline);
|
||||
gsk_gpu_print_rgba (string, instance->color);
|
||||
g_string_append_printf (string, "%g %g %g %g ",
|
||||
instance->shadow_offset[0], instance->shadow_offset[1],
|
||||
instance->blur_radius, instance->shadow_spread);
|
||||
gsk_gpu_print_newline (string);
|
||||
}
|
||||
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
@@ -56,7 +63,7 @@ static const GskGpuShaderOpClass GSK_GPU_BOX_SHADOW_OP_CLASS = {
|
||||
GSK_GPU_OP_SIZE (GskGpuBoxShadowOp),
|
||||
GSK_GPU_STAGE_SHADER,
|
||||
gsk_gpu_shader_op_finish,
|
||||
gsk_gpu_shader_op_print,
|
||||
gsk_gpu_box_shadow_op_print,
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
gsk_gpu_box_shadow_op_vk_command,
|
||||
#endif
|
||||
@@ -67,7 +74,6 @@ static const GskGpuShaderOpClass GSK_GPU_BOX_SHADOW_OP_CLASS = {
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
&gsk_gpu_boxshadow_info,
|
||||
#endif
|
||||
gsk_gpu_box_shadow_op_print_instance,
|
||||
gsk_gpu_boxshadow_setup_attrib_locations,
|
||||
gsk_gpu_boxshadow_setup_vao
|
||||
};
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
#include "gskgpubufferprivate.h"
|
||||
|
||||
#include <gdk/gdkprofilerprivate.h>
|
||||
|
||||
typedef struct _GskGpuBufferPrivate GskGpuBufferPrivate;
|
||||
|
||||
struct _GskGpuBufferPrivate
|
||||
@@ -13,13 +11,9 @@ struct _GskGpuBufferPrivate
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GskGpuBuffer, gsk_gpu_buffer, G_TYPE_OBJECT)
|
||||
|
||||
static guint profiler_buffer_uploads_id;
|
||||
static gint64 profiler_buffer_uploads;
|
||||
|
||||
static void
|
||||
gsk_gpu_buffer_class_init (GskGpuBufferClass *klass)
|
||||
{
|
||||
profiler_buffer_uploads_id = gdk_profiler_define_int_counter ("ngl-buffer-uploads", "Number of bytes uploaded to GPU");
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -35,7 +29,7 @@ gsk_gpu_buffer_setup (GskGpuBuffer *self,
|
||||
|
||||
priv->size = size;
|
||||
}
|
||||
|
||||
|
||||
gsize
|
||||
gsk_gpu_buffer_get_size (GskGpuBuffer *self)
|
||||
{
|
||||
@@ -55,8 +49,5 @@ gsk_gpu_buffer_unmap (GskGpuBuffer *self,
|
||||
gsize size)
|
||||
{
|
||||
GSK_GPU_BUFFER_GET_CLASS (self)->unmap (self, size);
|
||||
|
||||
profiler_buffer_uploads += size;
|
||||
gdk_profiler_set_int_counter (profiler_buffer_uploads_id, profiler_buffer_uploads);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,15 +16,22 @@ struct _GskGpuColorizeOp
|
||||
};
|
||||
|
||||
static void
|
||||
gsk_gpu_colorize_op_print_instance (GskGpuShaderOp *shader,
|
||||
gpointer instance_,
|
||||
GString *string)
|
||||
gsk_gpu_colorize_op_print (GskGpuOp *op,
|
||||
GskGpuFrame *frame,
|
||||
GString *string,
|
||||
guint indent)
|
||||
{
|
||||
GskGpuColorizeInstance *instance = (GskGpuColorizeInstance *) instance_;
|
||||
GskGpuShaderOp *shader = (GskGpuShaderOp *) op;
|
||||
GskGpuColorizeInstance *instance;
|
||||
|
||||
instance = (GskGpuColorizeInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
|
||||
|
||||
gsk_gpu_print_op (string, indent, "colorize");
|
||||
gsk_gpu_print_shader_info (string, shader->clip);
|
||||
gsk_gpu_print_rect (string, instance->rect);
|
||||
gsk_gpu_print_image_descriptor (string, shader->desc, instance->tex_id);
|
||||
gsk_gpu_print_rgba (string, instance->color);
|
||||
gsk_gpu_print_newline (string);
|
||||
}
|
||||
|
||||
static const GskGpuShaderOpClass GSK_GPU_COLORIZE_OP_CLASS = {
|
||||
@@ -32,7 +39,7 @@ static const GskGpuShaderOpClass GSK_GPU_COLORIZE_OP_CLASS = {
|
||||
GSK_GPU_OP_SIZE (GskGpuColorizeOp),
|
||||
GSK_GPU_STAGE_SHADER,
|
||||
gsk_gpu_shader_op_finish,
|
||||
gsk_gpu_shader_op_print,
|
||||
gsk_gpu_colorize_op_print,
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
gsk_gpu_shader_op_vk_command,
|
||||
#endif
|
||||
@@ -43,7 +50,6 @@ static const GskGpuShaderOpClass GSK_GPU_COLORIZE_OP_CLASS = {
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
&gsk_gpu_colorize_info,
|
||||
#endif
|
||||
gsk_gpu_colorize_op_print_instance,
|
||||
gsk_gpu_colorize_setup_attrib_locations,
|
||||
gsk_gpu_colorize_setup_vao
|
||||
};
|
||||
|
||||
@@ -16,14 +16,21 @@ struct _GskGpuColorMatrixOp
|
||||
};
|
||||
|
||||
static void
|
||||
gsk_gpu_color_matrix_op_print_instance (GskGpuShaderOp *shader,
|
||||
gpointer instance_,
|
||||
GString *string)
|
||||
gsk_gpu_color_matrix_op_print (GskGpuOp *op,
|
||||
GskGpuFrame *frame,
|
||||
GString *string,
|
||||
guint indent)
|
||||
{
|
||||
GskGpuColormatrixInstance *instance = (GskGpuColormatrixInstance *) instance_;
|
||||
GskGpuShaderOp *shader = (GskGpuShaderOp *) op;
|
||||
GskGpuColormatrixInstance *instance;
|
||||
|
||||
instance = (GskGpuColormatrixInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
|
||||
|
||||
gsk_gpu_print_op (string, indent, "color-matrix");
|
||||
gsk_gpu_print_shader_info (string, shader->clip);
|
||||
gsk_gpu_print_rect (string, instance->rect);
|
||||
gsk_gpu_print_image_descriptor (string, shader->desc, instance->tex_id);
|
||||
gsk_gpu_print_newline (string);
|
||||
}
|
||||
|
||||
static const GskGpuShaderOpClass GSK_GPU_COLOR_MATRIX_OP_CLASS = {
|
||||
@@ -31,7 +38,7 @@ static const GskGpuShaderOpClass GSK_GPU_COLOR_MATRIX_OP_CLASS = {
|
||||
GSK_GPU_OP_SIZE (GskGpuColorMatrixOp),
|
||||
GSK_GPU_STAGE_SHADER,
|
||||
gsk_gpu_shader_op_finish,
|
||||
gsk_gpu_shader_op_print,
|
||||
gsk_gpu_color_matrix_op_print,
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
gsk_gpu_shader_op_vk_command,
|
||||
#endif
|
||||
@@ -42,7 +49,6 @@ static const GskGpuShaderOpClass GSK_GPU_COLOR_MATRIX_OP_CLASS = {
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
&gsk_gpu_colormatrix_info,
|
||||
#endif
|
||||
gsk_gpu_color_matrix_op_print_instance,
|
||||
gsk_gpu_colormatrix_setup_attrib_locations,
|
||||
gsk_gpu_colormatrix_setup_vao
|
||||
};
|
||||
|
||||
@@ -17,14 +17,21 @@ struct _GskGpuColorOp
|
||||
};
|
||||
|
||||
static void
|
||||
gsk_gpu_color_op_print_instance (GskGpuShaderOp *shader,
|
||||
gpointer instance_,
|
||||
GString *string)
|
||||
gsk_gpu_color_op_print (GskGpuOp *op,
|
||||
GskGpuFrame *frame,
|
||||
GString *string,
|
||||
guint indent)
|
||||
{
|
||||
GskGpuColorInstance *instance = (GskGpuColorInstance *) instance_;
|
||||
GskGpuShaderOp *shader = (GskGpuShaderOp *) op;
|
||||
GskGpuColorInstance *instance;
|
||||
|
||||
instance = (GskGpuColorInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
|
||||
|
||||
gsk_gpu_print_op (string, indent, "color");
|
||||
gsk_gpu_print_shader_info (string, shader->clip);
|
||||
gsk_gpu_print_rect (string, instance->rect);
|
||||
gsk_gpu_print_rgba (string, instance->color);
|
||||
gsk_gpu_print_newline (string);
|
||||
}
|
||||
|
||||
static const GskGpuShaderOpClass GSK_GPU_COLOR_OP_CLASS = {
|
||||
@@ -32,7 +39,7 @@ static const GskGpuShaderOpClass GSK_GPU_COLOR_OP_CLASS = {
|
||||
GSK_GPU_OP_SIZE (GskGpuColorOp),
|
||||
GSK_GPU_STAGE_SHADER,
|
||||
gsk_gpu_shader_op_finish,
|
||||
gsk_gpu_shader_op_print,
|
||||
gsk_gpu_color_op_print,
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
gsk_gpu_shader_op_vk_command,
|
||||
#endif
|
||||
@@ -43,7 +50,6 @@ static const GskGpuShaderOpClass GSK_GPU_COLOR_OP_CLASS = {
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
&gsk_gpu_color_info,
|
||||
#endif
|
||||
gsk_gpu_color_op_print_instance,
|
||||
gsk_gpu_color_setup_attrib_locations,
|
||||
gsk_gpu_color_setup_vao
|
||||
};
|
||||
|
||||
@@ -18,13 +18,20 @@ struct _GskGpuConicGradientOp
|
||||
};
|
||||
|
||||
static void
|
||||
gsk_gpu_conic_gradient_op_print_instance (GskGpuShaderOp *shader,
|
||||
gpointer instance_,
|
||||
GString *string)
|
||||
gsk_gpu_conic_gradient_op_print (GskGpuOp *op,
|
||||
GskGpuFrame *frame,
|
||||
GString *string,
|
||||
guint indent)
|
||||
{
|
||||
GskGpuConicgradientInstance *instance = (GskGpuConicgradientInstance *) instance_;
|
||||
GskGpuShaderOp *shader = (GskGpuShaderOp *) op;
|
||||
GskGpuConicgradientInstance *instance;
|
||||
|
||||
instance = (GskGpuConicgradientInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
|
||||
|
||||
gsk_gpu_print_op (string, indent, "conic-gradient");
|
||||
gsk_gpu_print_shader_info (string, shader->clip);
|
||||
gsk_gpu_print_rect (string, instance->rect);
|
||||
gsk_gpu_print_newline (string);
|
||||
}
|
||||
|
||||
static const GskGpuShaderOpClass GSK_GPU_CONIC_GRADIENT_OP_CLASS = {
|
||||
@@ -32,7 +39,7 @@ static const GskGpuShaderOpClass GSK_GPU_CONIC_GRADIENT_OP_CLASS = {
|
||||
GSK_GPU_OP_SIZE (GskGpuConicGradientOp),
|
||||
GSK_GPU_STAGE_SHADER,
|
||||
gsk_gpu_shader_op_finish,
|
||||
gsk_gpu_shader_op_print,
|
||||
gsk_gpu_conic_gradient_op_print,
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
gsk_gpu_shader_op_vk_command,
|
||||
#endif
|
||||
@@ -43,7 +50,6 @@ static const GskGpuShaderOpClass GSK_GPU_CONIC_GRADIENT_OP_CLASS = {
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
&gsk_gpu_conicgradient_info,
|
||||
#endif
|
||||
gsk_gpu_conic_gradient_op_print_instance,
|
||||
gsk_gpu_conicgradient_setup_attrib_locations,
|
||||
gsk_gpu_conicgradient_setup_vao
|
||||
};
|
||||
|
||||
@@ -16,16 +16,23 @@ struct _GskGpuCrossFadeOp
|
||||
};
|
||||
|
||||
static void
|
||||
gsk_gpu_cross_fade_op_print_instance (GskGpuShaderOp *shader,
|
||||
gpointer instance_,
|
||||
GString *string)
|
||||
gsk_gpu_cross_fade_op_print (GskGpuOp *op,
|
||||
GskGpuFrame *frame,
|
||||
GString *string,
|
||||
guint indent)
|
||||
{
|
||||
GskGpuCrossfadeInstance *instance = (GskGpuCrossfadeInstance *) instance_;
|
||||
GskGpuShaderOp *shader = (GskGpuShaderOp *) op;
|
||||
GskGpuCrossfadeInstance *instance;
|
||||
|
||||
instance = (GskGpuCrossfadeInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
|
||||
|
||||
gsk_gpu_print_op (string, indent, "cross-fade");
|
||||
gsk_gpu_print_shader_info (string, shader->clip);
|
||||
gsk_gpu_print_rect (string, instance->rect);
|
||||
gsk_gpu_print_image_descriptor (string, shader->desc, instance->start_id);
|
||||
gsk_gpu_print_image_descriptor (string, shader->desc, instance->end_id);
|
||||
g_string_append_printf (string, "%g%%", 100 * instance->opacity_progress[1]);
|
||||
gsk_gpu_print_newline (string);
|
||||
}
|
||||
|
||||
static const GskGpuShaderOpClass GSK_GPU_CROSS_FADE_OP_CLASS = {
|
||||
@@ -33,7 +40,7 @@ static const GskGpuShaderOpClass GSK_GPU_CROSS_FADE_OP_CLASS = {
|
||||
GSK_GPU_OP_SIZE (GskGpuCrossFadeOp),
|
||||
GSK_GPU_STAGE_SHADER,
|
||||
gsk_gpu_shader_op_finish,
|
||||
gsk_gpu_shader_op_print,
|
||||
gsk_gpu_cross_fade_op_print,
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
gsk_gpu_shader_op_vk_command,
|
||||
#endif
|
||||
@@ -44,7 +51,6 @@ static const GskGpuShaderOpClass GSK_GPU_CROSS_FADE_OP_CLASS = {
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
&gsk_gpu_crossfade_info,
|
||||
#endif
|
||||
gsk_gpu_cross_fade_op_print_instance,
|
||||
gsk_gpu_crossfade_setup_attrib_locations,
|
||||
gsk_gpu_crossfade_setup_vao
|
||||
};
|
||||
|
||||
@@ -918,7 +918,12 @@ gsk_gpu_device_lookup_glyph_image (GskGpuDevice *self,
|
||||
return cache->image;
|
||||
}
|
||||
|
||||
scaled_font = gsk_reload_font (font, scale, CAIRO_HINT_METRICS_DEFAULT, CAIRO_HINT_STYLE_DEFAULT, CAIRO_ANTIALIAS_DEFAULT);
|
||||
/* Note: we want to scale the font to the required size *and* ensure that
|
||||
* metrics hinting is off. The latter is necessary since pango lets metrics
|
||||
* hinting influence the rendering of hexboxes, and we get bad outcomes if
|
||||
* that happens.
|
||||
*/
|
||||
scaled_font = gsk_reload_font (font, scale, CAIRO_HINT_METRICS_OFF, CAIRO_HINT_STYLE_DEFAULT, CAIRO_ANTIALIAS_DEFAULT);
|
||||
|
||||
subpixel_x = (flags & 3) / 4.f;
|
||||
subpixel_y = ((flags >> 2) & 3) / 4.f;
|
||||
|
||||
@@ -272,7 +272,7 @@ gsk_gpu_download_op_gl_command (GskGpuOp *op,
|
||||
data->context = g_object_ref (context);
|
||||
data->texture_id = gsk_gl_image_steal_texture (GSK_GL_IMAGE (self->image));
|
||||
|
||||
if (gdk_gl_context_has_feature (context, GDK_GL_FEATURE_SYNC))
|
||||
if (gdk_gl_context_has_sync (context))
|
||||
data->sync = glFenceSync (GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
||||
|
||||
builder = gdk_gl_texture_builder_new ();
|
||||
|
||||
@@ -40,7 +40,6 @@ struct _GskGpuFramePrivate
|
||||
|
||||
GskGpuOps ops;
|
||||
GskGpuOp *first_op;
|
||||
GskGpuOp *last_op;
|
||||
|
||||
GskGpuBuffer *vertex_buffer;
|
||||
guchar *vertex_buffer_data;
|
||||
@@ -71,8 +70,6 @@ gsk_gpu_frame_default_cleanup (GskGpuFrame *self)
|
||||
gsk_gpu_op_finish (op);
|
||||
}
|
||||
gsk_gpu_ops_set_size (&priv->ops, 0);
|
||||
|
||||
priv->last_op = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -251,35 +248,27 @@ gsk_gpu_frame_sort_render_pass (GskGpuFrame *self,
|
||||
SortData *sort_data)
|
||||
{
|
||||
SortData subpasses = { { NULL, NULL }, { NULL, NULL } };
|
||||
SortData pass = { { NULL, NULL }, { NULL, NULL } };
|
||||
|
||||
if (op->op_class->stage == GSK_GPU_STAGE_BEGIN_PASS)
|
||||
{
|
||||
pass.command.first = op;
|
||||
pass.command.last = op;
|
||||
op = op->next;
|
||||
}
|
||||
|
||||
while (op)
|
||||
{
|
||||
switch (op->op_class->stage)
|
||||
{
|
||||
case GSK_GPU_STAGE_UPLOAD:
|
||||
if (pass.upload.first == NULL)
|
||||
pass.upload.first = op;
|
||||
if (sort_data->upload.first == NULL)
|
||||
sort_data->upload.first = op;
|
||||
else
|
||||
pass.upload.last->next = op;
|
||||
pass.upload.last = op;
|
||||
sort_data->upload.last->next = op;
|
||||
sort_data->upload.last = op;
|
||||
op = op->next;
|
||||
break;
|
||||
|
||||
case GSK_GPU_STAGE_COMMAND:
|
||||
case GSK_GPU_STAGE_SHADER:
|
||||
if (pass.command.first == NULL)
|
||||
pass.command.first = op;
|
||||
if (sort_data->command.first == NULL)
|
||||
sort_data->command.first = op;
|
||||
else
|
||||
pass.command.last->next = op;
|
||||
pass.command.last = op;
|
||||
sort_data->command.last->next = op;
|
||||
sort_data->command.last = op;
|
||||
op = op->next;
|
||||
break;
|
||||
|
||||
@@ -293,13 +282,19 @@ gsk_gpu_frame_sort_render_pass (GskGpuFrame *self,
|
||||
break;
|
||||
|
||||
case GSK_GPU_STAGE_BEGIN_PASS:
|
||||
if (subpasses.command.first == NULL)
|
||||
subpasses.command.first = op;
|
||||
else
|
||||
subpasses.command.last->next = op;
|
||||
subpasses.command.last = op;
|
||||
|
||||
/* append subpass to existing subpasses */
|
||||
op = gsk_gpu_frame_sort_render_pass (self, op, &subpasses);
|
||||
op = gsk_gpu_frame_sort_render_pass (self, op->next, &subpasses);
|
||||
break;
|
||||
|
||||
case GSK_GPU_STAGE_END_PASS:
|
||||
pass.command.last->next = op;
|
||||
pass.command.last = op;
|
||||
sort_data->command.last->next = op;
|
||||
sort_data->command.last = op;
|
||||
op = op->next;
|
||||
goto out;
|
||||
|
||||
@@ -310,38 +305,22 @@ gsk_gpu_frame_sort_render_pass (GskGpuFrame *self,
|
||||
}
|
||||
|
||||
out:
|
||||
/* append to the sort data, first the subpasses, then the current pass */
|
||||
/* prepend subpasses to the current pass */
|
||||
if (subpasses.upload.first)
|
||||
{
|
||||
if (sort_data->upload.first != NULL)
|
||||
sort_data->upload.last->next = subpasses.upload.first;
|
||||
subpasses.upload.last->next = sort_data->upload.first;
|
||||
else
|
||||
sort_data->upload.first = subpasses.upload.first;
|
||||
sort_data->upload.last = subpasses.upload.last;
|
||||
}
|
||||
if (pass.upload.first)
|
||||
{
|
||||
if (sort_data->upload.first != NULL)
|
||||
sort_data->upload.last->next = pass.upload.first;
|
||||
else
|
||||
sort_data->upload.first = pass.upload.first;
|
||||
sort_data->upload.last = pass.upload.last;
|
||||
sort_data->upload.last = subpasses.upload.last;
|
||||
sort_data->upload.first = subpasses.upload.first;
|
||||
}
|
||||
if (subpasses.command.first)
|
||||
{
|
||||
if (sort_data->command.first != NULL)
|
||||
sort_data->command.last->next = subpasses.command.first;
|
||||
subpasses.command.last->next = sort_data->command.first;
|
||||
else
|
||||
sort_data->command.first = subpasses.command.first;
|
||||
sort_data->command.last = subpasses.command.last;
|
||||
}
|
||||
if (pass.command.first)
|
||||
{
|
||||
if (sort_data->command.first != NULL)
|
||||
sort_data->command.last->next = pass.command.first;
|
||||
else
|
||||
sort_data->command.first = pass.command.first;
|
||||
sort_data->command.last = pass.command.last;
|
||||
sort_data->command.last = subpasses.command.last;
|
||||
sort_data->command.first = subpasses.command.first;
|
||||
}
|
||||
|
||||
return op;
|
||||
@@ -352,13 +331,8 @@ gsk_gpu_frame_sort_ops (GskGpuFrame *self)
|
||||
{
|
||||
GskGpuFramePrivate *priv = gsk_gpu_frame_get_instance_private (self);
|
||||
SortData sort_data = { { NULL, }, };
|
||||
GskGpuOp *op;
|
||||
|
||||
op = priv->first_op;
|
||||
while (op)
|
||||
{
|
||||
op = gsk_gpu_frame_sort_render_pass (self, op, &sort_data);
|
||||
}
|
||||
|
||||
gsk_gpu_frame_sort_render_pass (self, priv->first_op, &sort_data);
|
||||
|
||||
if (sort_data.upload.first)
|
||||
{
|
||||
@@ -369,8 +343,6 @@ gsk_gpu_frame_sort_ops (GskGpuFrame *self)
|
||||
priv->first_op = sort_data.command.first;
|
||||
if (sort_data.command.last)
|
||||
sort_data.command.last->next = NULL;
|
||||
|
||||
priv->last_op = NULL;
|
||||
}
|
||||
|
||||
gpointer
|
||||
@@ -388,17 +360,7 @@ gsk_gpu_frame_alloc_op (GskGpuFrame *self,
|
||||
NULL,
|
||||
size);
|
||||
|
||||
priv->last_op = (GskGpuOp *) gsk_gpu_ops_index (&priv->ops, pos);
|
||||
|
||||
return priv->last_op;
|
||||
}
|
||||
|
||||
GskGpuOp *
|
||||
gsk_gpu_frame_get_last_op (GskGpuFrame *self)
|
||||
{
|
||||
GskGpuFramePrivate *priv = gsk_gpu_frame_get_instance_private (self);
|
||||
|
||||
return priv->last_op;
|
||||
return gsk_gpu_ops_index (&priv->ops, pos);
|
||||
}
|
||||
|
||||
GskGpuImage *
|
||||
@@ -543,12 +505,6 @@ gsk_gpu_frame_is_busy (GskGpuFrame *self)
|
||||
return GSK_GPU_FRAME_GET_CLASS (self)->is_busy (self);
|
||||
}
|
||||
|
||||
void
|
||||
gsk_gpu_frame_wait (GskGpuFrame *self)
|
||||
{
|
||||
GSK_GPU_FRAME_GET_CLASS (self)->wait (self);
|
||||
}
|
||||
|
||||
static void
|
||||
copy_texture (gpointer user_data,
|
||||
GdkTexture *texture)
|
||||
|
||||