Commit Graph

71403 Commits

Author SHA1 Message Date
Benjamin Otte
a7ef4c75ea Merge branch 'wip/otte/memoryformat' into 'master'
Refactor various texture machinery

See merge request GNOME/gtk!4057
2021-10-13 12:51:37 +00:00
Benjamin Otte
9a2e9c5be4 gl: Use gdk_memory_texture_new_from_texture()
Way less code to prepare the texture in a proper format.
2021-10-13 14:33:44 +02:00
Benjamin Otte
ddc4a40c33 gl: Refactor texture uploading
Don't pass texture + rect, but instead have
  gdk_memory_texture_new_subtexture()
and use it to generate subtextures and pass them.

This has the advantage of downloading the a too large texture only once
instead of N times.
2021-10-13 14:33:44 +02:00
Benjamin Otte
52e88ed4c8 gltexture: Determine format in current thread
Close widget-factory and observe:

Thread 1:
 * acquire main loop
 * handle close button
 * close window
 * dispose video and media stream
 * stop GstPlayer
WAIT on pipeline stopping

Thread 2:
 * prepare next image in pipeline
 * hand image to GtkGstSink
 * create GdkTexture from image
 * gdk_gl_texture_new() determines format
WAIT on acquiring main loop

Sounds like a deadlock?

Indeed, so don't do that.
2021-10-13 14:33:44 +02:00
Benjamin Otte
5199bebdb5 gl: Move texture uploading to the renderer
It does not belong in GdkGLContext, it's a renderer thing.
It's also the only user of that API.

Introduce gdk_gl_context_check_version() private API to make version
checks simpler.
2021-10-13 14:33:44 +02:00
Benjamin Otte
31e9072906 gl: Fix downloading textures *again*
It turns out glReadPixels() cannot convert pixels and you are only
allowed to pass a single value into the function arguments. You need to
know which ones or things will explode.

GL is great.
2021-10-13 14:33:44 +02:00
Benjamin Otte
c2368cc605 png: Refactor png saving
Do all the memory format shenanigans in GTK now and support all the PNG
formats.
2021-10-13 14:33:44 +02:00
Benjamin Otte
1e7fb52b21 Add memory formats used by libpng
Add unpremultiplied high-depth formats. They are used in the real world,
so let's support them.
2021-10-13 14:33:44 +02:00
Chun-wei Fan
53705a537c tools/generate-uac-manifest.py: Fix UAC manifest .rc
The resource compiler in the Windows 11 SDK does not allow one to include
winuser.h directly in resource scripts (.rc) with a rather cryptic error
message, so fix generating the .rc file to embed the UAC manifest by including
windows.h with WIN32_LEAN_AND_MEAN instead.
2021-10-13 12:21:10 +08:00
Chun-wei Fan
3481ebdafb gtk: Fix version resource on for Windows 11 SDK
The rc.exe that comes with the Windows 11 SDK does not allow one to include
winuser.h directly in the .rc scripts, so make sure that it is not included
by gtk-win32.rc.body.in, but instead include windows.h with WIN32_LEAN_AND_MEAN
defined.
2021-10-13 12:21:10 +08:00
Sveinn í Felli
71eece2f35 Update Icelandic translation
(cherry picked from commit 83b3c7d826)
2021-10-12 22:48:16 +00:00
Christopher Davis
454ca897bb gtkflowbox: Add prepend() and append()
These functions are common across container implementations,
but GtkFlowBox was missing them.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4277
2021-10-12 11:07:17 -07:00
Niels De Graef
41ca09d645 calendar: Add an explanatory comment
On the magic numbers used to get the abbreviated day names.
2021-10-12 19:37:13 +02:00
Rafael Fontenelle
24b7eec687 Update Brazilian Portuguese translation
(cherry picked from commit 4b9260608a)
2021-10-12 17:34:01 +00:00
Niels De Graef
dcbfd61558 calendar: Fix abbreviated day names
... if the current locale has a different starting day than Sunday.

This needed 2 fixes:
* We need to take into account `calendar->week_start` when
  creating/adding the appropriate `day_name_labels` field
* we were only calculating `calendar->week_start` _after_ attaching the
  `day_name_labels`, so it was still set to 0 (the default value).

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4338
2021-10-12 19:29:26 +02:00
Emmanuele Bassi
e98b83dade Merge branch 'bilelmoussaoui/gtk-snapshot' into 'master'
gtk: fix Snapshot.push_shadow annotation

See merge request GNOME/gtk!4060
2021-10-12 11:09:13 +00:00
Bilal Elmoussaoui
257adb4464 gtk: fix Snapshot.push_shadow annotation 2021-10-12 09:00:03 +00:00
Benjamin Otte
7b41738979 png: Do loader conversions in GDK
Not inside libpng.

We really want to do them in GL, but we don't have a premultiply step
yet.
2021-10-12 02:06:44 +02:00
Benjamin Otte
b65b64628d texture: Refactor downloading
Pass a format do GdkTextureClass::download(). That way we can download
data in any format.

Also replace gdk_texture_download_texture() with
gdk_memory_texture_from_texture() which again takes a format.

The old functionality is still there for code that wants it: Just pass
gdk_texture_get_format (texture) as the format argument.
2021-10-12 02:06:43 +02:00
Emmanuele Bassi
086a3044e3 Add getter to GdkFileList
Language bindings don't really have any mean of accessing the list of
files for GdkFileList.
2021-10-11 21:40:29 +01:00
Bastien Nocera
fc32c19ca7 broadway: Quiet initialisation failures
Broadway is the only GTK+ backend that throws an error on stderr for a
"display server" connection failure.

This causes problems when gtk_init_check() is used and unexpected error
output is generated such as with hotdoc, which fails when generating a
GTK plugin's documentation instead of overlooking the issue.

"Unable to init server: Could not connect: Connection refused"
2021-10-11 20:36:53 +02:00
Benjamin Otte
d89e82d4a0 Merge branch 'wip/otte/for-master' into 'master'
x11: Don't try to move destroyed windows

See merge request GNOME/gtk!4054
2021-10-11 18:36:20 +00:00
Benjamin Otte
f40ce51a13 x11: Don't try to move destroyed windows
Fixes BadWindow crashes when the resize happen right when tooltips or
other such transient popups were in the process of being destroyed.
2021-10-11 19:28:59 +02:00
Bastien Nocera
e6ae3b8a2b broadway: Quiet initialisation failures
Broadway is the only GTK+ backend that throws an error on stderr when
failing to initialise, which causes problems when gtk_init_check() is
used and unexpected error output is generated.

This causes hotdoc to fail when generating a GTK plugin's documentation
instead of failing quietly.

"Unable to init server: Could not connect: Connection refused"
2021-10-11 14:01:20 +02:00
David Edmundson
dc503897b1 wayland: Mark opaque_region as dirty on hide
Otherwise if we hide and show a window we recreate a new surface,
breaking the compositor's association, but potentially not resend this
data for the new surface.
This matches what we do for input_region.
2021-10-11 12:34:53 +01:00
Matthias Clasen
49a64da7ec Merge branch 'ngl-is-the-new-gl' into 'master'
Rename ngl to gl

Closes #4318

See merge request GNOME/gtk!4037
2021-10-11 06:43:41 +00:00
Matthias Clasen
922e6add38 Merge branch 'docs-window-position' into 'master'
docs: Mention gtk_window_set_position() being gone

See merge request GNOME/gtk!4048
2021-10-11 06:36:23 +00:00
Emmanuele Bassi
232003b046 Merge branch 'docs-urlmap' into 'master'
docs: Add GdkPixbuf to the URL map

See merge request GNOME/gtk!4051
2021-10-10 23:01:39 +00:00
John Ralls
cfadca696b [gtkimcontextquartz] Accommodate moving GdkSurface widget to private.
Fixes macOS build.
2021-10-10 13:16:49 -07:00
Benjamin Otte
5311616ca1 Merge branch 'wip/otte/gles' into 'master'
Improve GLES

See merge request GNOME/gtk!4050
2021-10-09 11:59:42 +00:00
Emmanuele Bassi
c7bb4a9678 docs: Add GdkPixbuf to the URL map
Allow cross-linking to the GdkPixbuf reference.
2021-10-09 10:55:24 +01:00
Benjamin Otte
e581c148d9 testsuite: Add run for GLES
This is supposed to test the most fallback GL stuff, so we might want to
set even more env vars here.

Also enable the run for the Fedora builder in CI.
2021-10-09 06:27:21 +02:00
Benjamin Otte
d4959a95c2 gl: Make sure to set a proper alignment
No matter which branch we take, the alignment setting is always the
same.
2021-10-09 05:25:41 +02:00
Benjamin Otte
780ae5232d gl: Check the stride is a multiple of the bpp 2021-10-09 05:25:41 +02:00
Benjamin Otte
caddea4624 gl: Set stride properly in fallback 2021-10-09 04:44:30 +02:00
Benjamin Otte
27b5dc1452 gl: Fix broken internal format 2021-10-09 04:44:30 +02:00
Benjamin Otte
b4ab9f7b8c testsuite: Add a test targeting GL upload code
Previously, all the tests used the icon upload path using
glTexSubImage2D().

This test uses the custom texture path using glTexImage2D().
2021-10-09 04:44:30 +02:00
Benjamin Otte
e371bd09c1 ngl: Use the right value
It's GL_RGBA, not GL_BGRA, or GLES will complain.
2021-10-09 04:44:30 +02:00
Asier Sarasua Garmendia
db167e09c5 Update Basque translation
(cherry picked from commit 2492729238)
2021-10-08 17:44:35 +00:00
Benjamin Otte
27573d9576 Merge branch 'wip/otte/glcontext' into 'master'
glcontext: Make GLES vs GL configuration clearer

Closes #4221

See merge request GNOME/gtk!4044
2021-10-08 15:57:08 +00:00
Emmanuele Bassi
0054f8bd74 docs: Mention gtk_window_set_position() being gone
People search for it in the migration guide much more than other
GdkSurface and GtkWindow methods.
2021-10-08 12:27:24 +01:00
Benjamin Otte
5c1e402429 Merge branch 'wip/otte/for-master' into 'master'
Fix GLES fallout from recent NGL updates

See merge request GNOME/gtk!4046
2021-10-08 09:11:03 +00:00
Benjamin Otte
e974a0412f glcontext: Add gdk_gl_context_get_api()
This is mostly for inspector.

Not sure if we also want to deprecate gdk_gl_context_get_use_es() in
favor of this function.
2021-10-08 03:31:07 +02:00
Benjamin Otte
76420d7146 ngl: Fix glTexImage2D() usage on GLES
GLES is very adamant about the format and type matching the internal
format, even if the data is NULL.
2021-10-08 03:31:07 +02:00
Benjamin Otte
f584d4f500 gl: Check allowed APIs in realize()
Add gdk_gl_context_is_api_allowed() for backends and make them use it.

Finally, have them return the final API as the return value (or 0 on
error).

And then use that api instead of a use_es boolean flag.

Fixes #4221
2021-10-08 03:31:07 +02:00
Benjamin Otte
8c1f7f7531 glcontext: Deprecate gdk_gl_context_set_use_es()
Make it call gdk_gl_context_set_allowed_apis().

Also port callers to use this function.
2021-10-08 03:31:07 +02:00
Benjamin Otte
c6dd3c11fa glcontext: Add GdkGLContext::allowed-apis
This allows specifying the GL APIs in a more comprehensive way than
gdk_gl_context_set_use_es().
2021-10-08 03:31:07 +02:00
Benjamin Otte
3b9967db48 ngl: Compute correct renderformat
We want to round up, not down.
2021-10-08 03:31:06 +02:00
Benjamin Otte
4f53645e5d ngl: fbo 0 has no color attachment
Query the backbuffer instead.
2021-10-08 03:31:06 +02:00
Matthias Clasen
b7eb1d3310 gsk: provide an ngl renderer
Provide a minimal renderer implementation that fails
in realize. This avoids reusing the same type, which
might give bindings trouble.
2021-10-07 16:46:29 -04:00