Commit Graph

11216 Commits

Author SHA1 Message Date
dgsasha
b7e3a231b4 win32: Focus modal windows when clicking on unfocused parent 2023-06-02 12:33:03 -04:00
Matthias Clasen
c8c895d160 Merge branch 'trap-bad-rr-errors' into 'main'
x11: Trap XRandr errors when getting outputs during init and update

See merge request GNOME/gtk!6046
2023-06-02 11:31:45 +00:00
Luca Bacci
acbd7f212e Merge branch 'for-main' into 'main'
GdkWin32 Cleanup

See merge request GNOME/gtk!5714
2023-06-02 09:34:48 +00:00
Marco Trevisan (Treviño)
f2a2889153 x11: Trap XRandr errors when getting outputs during init and update
We may try to update the XRR outputs and Crtcs when they're changing in
the server, and so we may get BadRROutput that we're currently not
handling properly.

As per this, use traps and check whether we got errors, and if we did
let's ignore the current output.

It's not required to call init_randr13() again because if we got errors
it's very likely that there's a change coming that will be notified at
next iteration during which we'll repeat the init actions.
2023-06-02 00:30:14 +02:00
sumibi-yakitori
1fce2b1e06 Fix an issue where min_version was not being used as the minimum version required by GTK 2023-06-01 23:05:44 +09:00
sumibi-yakitori
7b8a5235d4 Fix a bug in error checking conditions. This avoids unintentional Legacy of the created OpenGL context 2023-06-01 16:46:24 +09:00
sumibi-yakitori
3c9b3ead6f The GL version reported by epoxy seems to depend on the current GL context, so the GL context to create should be the one determined by gdk_gl_context_get_matching_version 2023-06-01 16:43:57 +09:00
Matthias Clasen
39f4d5ccf7 gltexturebuilder: Update the docs
We do handle unpremultiplied alpha correctly (albeit
non-optimally) now.
2023-05-31 14:39:07 -04:00
Luca Bacci
24af4b48cc GdkWin32: Remove unused functions 2023-05-31 12:15:57 +02:00
Luca Bacci
1c8caf745f GdkWin32: Remove declarations of unused types from gdkprivate-win32.h 2023-05-31 12:15:57 +02:00
Luca Bacci
395d80f131 GdkWin32: Remove declarations of unexisting functions from gdkprivate-win32.h 2023-05-31 12:15:57 +02:00
Luca Bacci
74229572e7 GdkWin32: Remove defines for old MinGW headers 2023-05-31 12:15:57 +02:00
Luca Bacci
cbb3d3f177 GdkWin32: Remove _gdk_display_hdc global variable 2023-05-31 12:15:57 +02:00
Luca Bacci
8861d0eb53 GdkWin32: Turn a few functions to static
When used only in the source file they're defined in.
Also remove the corresponding declarations from
gdkrivate-win32.h.
2023-05-31 12:15:57 +02:00
Luca Bacci
a23bc894e9 GdkWin32: Remove unused debug functions
* _gdk_win32_print_paletteentries
 * _gdk_win32_print_system_palette
 * _gdk_win32_print_hpalette
 * _gdk_win32_drag_protocol_to_string
 * _gdk_win32_data_to_string
 * _gdk_win32_gdkrectangle_to_string
 * _gdk_win32_cairo_region_to_string
 * _gdk_win32_surface_description
2023-05-31 12:15:57 +02:00
Matthias Clasen
f29c7e76f5 gltexture: Use proper alignment for downloads 2023-05-30 22:35:45 -04:00
Matthias Clasen
876b439d4a Merge branch 'matthiasc/conversion-tests' into 'main'
Texture format work

See merge request GNOME/gtk!6035
2023-05-31 00:13:51 +00:00
Matthias Clasen
4f6d7c69a1 gltexturebuilder: Document format expectations
Provide some details about storage and alpha handling.
2023-05-30 19:46:13 -04:00
Matthias Clasen
1c72f46eed gltexture: Rewrite downloading code
For non-gles, make it handle unpremultiplied formats,
and everything else, by downloading the texture in its
preferred format and, in most cases, doing a
gdk_memory_convert afterwards.

For gles, keep using glReadPixels, but handle cases
where the gl read format doesn't match the texture
format by doing the necessary swizzling before calling
gdk_memory_convert.
2023-05-30 15:57:18 -04:00
Matthias Clasen
0f61c52593 gdk: Simplify gdk_memory_format_gl_format
Make the callers of this function check for
straight alpha themselves, and only do the
version compatibility check here. This makes
the function usable in contexts where straight
alpha is acceptable.
2023-05-30 14:49:45 -04:00
Sophie Herold
894a4bda85 gdk: Support gray/alpha in PNG loader 2023-05-30 14:41:01 -04:00
Sophie Herold
2b88505ca4 gdk: Support gray/alpha in TIFF loader
Use PHOTOMETRIC_MINISBLACK for grayscale image
2023-05-30 14:41:01 -04:00
Sophie Herold
ef8c835762 gsk: Support swizzle for gray and alpha formats
Swizzling is needed to display one channel memory formats
as gray etc.
2023-05-30 14:41:01 -04:00
Sophie Herold
50115d70c6 gdk: Add grayscale and alpha memory formats 2023-05-30 14:41:01 -04:00
Luca Bacci
1a058a41c9 Do not keep HINSTANCE variables around
Use &__ImageBase for the GTK DLL and GetModuleHandle (NULL)
for the application module. Then remove DllMain as it's not
necessary anymore.

References:

 [1] Accessing the current module's HINSTANCE from a static library:
     https://devblogs.microsoft.com/oldnewthing/20041025-00/?p=37483
2023-05-30 19:31:54 +02:00
Marco Trevisan (Treviño)
be4f6ff3da gdkselectioninputstream-x11: Explicitly handle stream ownership in signal
The display xevent signal connection takes the ownership of the stream
until we get a valid event, so it should manage the stream lifetime.

So make this clearer, by automatically removing the stream reference
when we disconnect from the xevent signal handler.
2023-05-30 17:59:19 +02:00
Marco Trevisan (Treviño)
4fcf899852 gdkselectioninputstream-x11: Make it clearer how we manage the stream ownership
It gets unreffed during gdk_x11_selection_input_stream_complete, so use
APIs that make this clearer.
2023-05-30 17:54:29 +02:00
Marco Trevisan (Treviño)
371e860184 gtkselectioninputstream-x11: Do not add an extra reference to the returned stream
We create a new stream during gdk_x11_selection_input_stream_new_async()
then such stream is referenced when passed to the task via
g_task_return_pointer(), so there's no need to reference it again before
returning it, or we'd end up leaking.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4892
2023-05-30 17:50:56 +02:00
Marco Trevisan (Treviño)
bce1e0bfdd gtkselectioninputstream-x11: Do not add unreffed bytes to the chunks queue
This should never happen, but we may exit the loop because of count value
with an unreffed bytes pointer being added back to the chunks queue.
2023-05-30 17:43:57 +02:00
Marco Trevisan (Treviño)
468d2cb7f2 gtkselectioninputstream-x11: Do not add EOF marker twice to the chunks queue
We were adding the same EOF marker two times back to the chunks queue,
one implicitly, and the other time could happen when exiting the loop.
2023-05-30 17:42:59 +02:00
Luca Bacci
21c53a1969 Merge branch 'win32-monitors' into 'main'
GdkWin32Monitor fixes

See merge request GNOME/gtk!6015
2023-05-29 09:50:30 +00:00
FineFindus
2d8c112f08
docs: add HSL to Gdk.RGBA.parse
Update the Gdk.RGBA.parse docs to reflect the ability to parse HSL, which has been added in 4.5.0.
2023-05-25 17:16:55 +02:00
Jason Francis
cf79ad4433
win32: implement fullscreen_on_monitor
Track the HMONITOR so it can be used by the toplevel layout.
2023-05-24 18:48:37 -04:00
Benjamin Otte
d912628583 Merge branch 'wip/otte/for-main' into 'main'
2 GDK GL XWayland improvements

See merge request GNOME/gtk!6014
2023-05-24 22:22:48 +00:00
Jason Francis
f254ab700c
win32: Invalidate inactive monitors
Without this, there are still GdkMonitors present for displays that are
present but disconnected (such as when a laptop disables the internal
display to connect to an external monitor).
2023-05-24 17:34:34 -04:00
Benjamin Otte
c7b62d89e3 glx: Implement support for EXT_swap_control
XWayland (at least on gnome-shell) does not support SGI_swap_control,
which we were using to unset the swap interval.

It does support EXT_swap_control though, which is the more modern
version of the same thing, so this commit adds support for that.

And now GDK_DEBUG=no-vsync gives me >1000fps instead of just 60fps,
2023-05-24 21:44:43 +02:00
Benjamin Otte
46e3454eb7 gl: Update tracked buffers from 2 to 4
With XWayland and direct scanout it is possible that some apps get into
a situation where more than 2 buffers are in flight and in that case we
want to be able to still track the change regions for those buffers.

Usually 3 buffers are in use, so we go one higher, just to be safe.
2023-05-24 21:44:43 +02:00
Benjamin Otte
7573a9d2a7 gl: Rewrite update area tracking code
Make it more generic. That way we could dynamically change the number of
buffers we track.

We don't do that yet though.
2023-05-24 21:44:29 +02:00
Matthias Clasen
d6fc0d6c94 gdk: Fix up introspection build
Referring to files across directories is not
easy, we need to use files() in just the right
way to make this work.
2023-05-21 09:46:49 -04:00
Benjamin Otte
b530ade8c6 gdk: Clamp frame region to surface size
The region may be larger than the surface's size, but many rendering
APIs require the size to be clamped.

Fixes #5812
2023-05-16 18:53:09 +02:00
Matthias Clasen
0b59290bad gdk: Drop some unused private api 2023-05-15 20:30:38 -04:00
Matthias Clasen
3fb06ca29d Merge branch 'matthiasc/for-main' into 'main'
tools: Cosmetics

See merge request GNOME/gtk!5972
2023-05-16 00:02:15 +00:00
Matthias Clasen
ed265f6a7e gdk: Deprecated some pixbuf apis
These are already documented as 'don't use
in new apis'. Lets make it official and
deprecate them properly.
2023-05-15 18:22:37 -04:00
Matthias Clasen
343472931d Cosmetics
Linkify a reference.
2023-05-15 15:25:11 -04:00
Matthias Clasen
89d993b6ec wayland: Try harder to be compatible
We can keep the old unexport_handle api working
in the case that there is only a single exported
handle.
2023-05-15 00:20:24 -04:00
Matthias Clasen
250a5c0dfd Deprecate gdk_wayland_toplevel_unexport_handle
It doesn't do anything anymore, and is no longer
used internally. The replacement is
gdk_wayland_toplevel_drop_exported_handled().
2023-05-15 00:20:24 -04:00
Matthias Clasen
af3ceb5755 wayland: Reimplement exporting
Change things so that every call to export_handle
creates a new handle, and unexport_handle destroys
the handle that it is given.
2023-05-14 23:49:44 -04:00
Matthias Clasen
982a696311 wayland: Give toplevels a destroy hook
We will need to do some cleanup before the
wl_surface is destroyed, so add a hook for that.
2023-05-14 23:49:44 -04:00
Matthias Clasen
e5f1e4545d gdk: Change the private export handle api
Make unexport_handle take the handle, so we
can in the future deal with multiple exports.

Update the one caller in gtkwindow.c to pass
the handle.
2023-05-14 23:49:44 -04:00
Matthias Clasen
bf87a40b20 wayland: Add new backend api
Add an alternative to unexport_handle that
does take the handle.
2023-05-14 23:49:44 -04:00
Matthias Clasen
38f610f85e Fix a typo 2023-05-14 13:26:14 -04:00
Matthias Clasen
5393173afa wayland: Remove some unused fields 2023-05-14 13:06:00 -04:00
Matthias Clasen
51ad2a55a8 gdk: Add an assertion
We simply overwrite any previous region,
so assert that the field was NULL before.
2023-05-14 07:50:11 -04:00
Matthias Clasen
2cd5b4df1b Add missing va marshallers
Whenever we pass a marshaller to g_signal_new,
call g_signal_set_va_marshaller with the corresponding
va marshaller.
2023-05-13 12:38:24 -04:00
Emmanuele Bassi
9d68bebdd1 Minimize the amount of inclusions in public headers
Public headers should mainly include gdktypes.h, which already include
the symbol visibility and versioning macros; we can also modify
gdktypes.h to include the enumerations.
2023-05-09 17:36:59 +01:00
Matthias Clasen
d7b9d35c02 Use #pragma once
We switched over to using #pragma once, so lets
use it consistently, in generated headers as well.
2023-05-09 16:43:35 +01:00
Matthias Clasen
383c404792 Drop the gdk/gdkversionmacros.h header
It was just added to avoid touching too many files.
Touching them now.
2023-05-09 16:43:35 +01:00
Matthias Clasen
197d921347 Add a missing file 2023-05-09 16:43:25 +01:00
Matthias Clasen
3d5529760a Fix install location 2023-05-09 16:43:25 +01:00
Matthias Clasen
e216f469a1 Don't excessively define GDK_EXTERN
Once is enough.
2023-05-09 16:43:25 +01:00
Matthias Clasen
5ae25519a7 Make it build
Fix the circular dependency by moving the generated
headers to gdk/version/, and build that directory
first.

Misc other fixes, such as putting the custom targets
as sources, not depedencies, and using the correct
major version in the generator script.
2023-05-09 16:43:25 +01:00
Emmanuele Bassi
4d1f7a476d Generate version and deprecation macros at build time
Let's poach the same script used by GLib to avoid having to add all the
version macros by hand every time we increment the GTK version.

This is a work in progress:

- need to rename the GLIB_STATIC_COMPILATION check
- circular dependency: libgtkcss depends on gdkversionmacros.h, but libgdk
  depends on libgtkcss
2023-05-09 16:43:25 +01:00
Benjamin Otte
a959fba18a Merge branch 'wip/otte/no-vsync' into 'main'
Add GDK_DEBUG=no-vsync

See merge request GNOME/gtk!5944
2023-05-09 15:16:43 +00:00
Benjamin Otte
961a6c12ec wayland: Don't assert when requesting another frame
When GDK_DEBUG=no-vsync is on, we might have more than one outstanding
frame. Don't assert when that hapens. Just request a frame callback for
the first and skip the others.
2023-05-09 16:29:41 +02:00
Benjamin Otte
c227493c65 frameclock: Keep more history
Not all frames get timing info with GDK_DEBUG=no-vsync, so make sure
that even when we render tons of frames, the one frame that does get
timing info is still there when the timing info arrives.

I set it to 128 from 16 now.
This is roughly good enough to go to 5000fps from on a 60Hz monitor.
2023-05-09 16:29:41 +02:00
Benjamin Otte
02e2a6f311 gdk: Add GDK_DEBUG=no-vsync
That turns off waiting and freezing in the frame clock and in
surfaces and triggers redraws asap.
2023-05-09 16:29:41 +02:00
Benjamin Otte
fa42e02a76 frameclock: Add gdk_frame_clock_idle_is_frozen()
This is in preparation for a future commit.

Also turn some macros into inline functions and pass the clock instead
of its priv pointer.
2023-05-09 16:29:37 +02:00
Chun-wei Fan
0073ee29da gdkglcontext-win32-wgl.c: Always request alpha bits
...when we are using wglChoosePixelFormatARHB().  This ensures that we
hvae a HDC with a pixel format that will really support alpha bits, as
we did for the traditional ChoosePixelFormat().

Thanks to Patrick Zacharias for testing and pointing things out.
2023-05-09 18:15:23 +08:00
Benjamin Otte
e9ed5e21ef win32: Turn off multisampling
We know we draw beautiful Windows, but drawing them once is totally
enough.
2023-05-09 18:15:23 +08:00
Benjamin Otte
c37786af36 win32: Actually increase the counter
We were sending random junk to ChoosePixelFormat().

Also assert that we don't overflow the array. That might be usefu to
know if we carelessly add attributes later.
2023-05-09 18:15:23 +08:00
Chun-wei Fan
a7b09e19f1 GDK/Win32: Use dummy WGL contexts more
... for creating the actual WGL contexts, so that we can cut down on the
number of times where we need to create the base, legacy WGL contexts in
order to create the WGL contexts with attributes.  We could just use the
dummy context that we have to make it current to create the needed
WGL contexts.
2023-05-09 18:15:23 +08:00
Chun-wei Fan
50ef36d387 gdkglcontext-win32-wgl.c: Fix using wglChoosePixelFormatARB()
If we are querying the best supported pixel format for our HDC via
wglChoosePixelFormatARB() (i.e. we have the WGL_ARB_pixel_format extension),
it may return a pixel format that is different from the pixel format that we
used for the dummy context that we have setup, in order to, well, run
wglChoosePixelFormatARB(), which sadly requires a WGL context (HGLRC) to be
current in order to use it, which means the dummy HDC already has a pixel
format that has been set (notice that each HDC is only allowed to have its
pixel format to be set *once*). This is notably the case on Intel display
drivers.

Since we are emulating surfaceless GL contexts, we are using the dummy GL
context (and thus dummy HDC that is derived from the notification HWND used in
GdkWin32Display) for doing that, we would get into trouble if th actual HDC
from the GdkWin32Surface has a different pixel format set.

So, as a result, in order to fix this situation, we do the following:

* Create yet another dummy HWND in order to grab the HDC to query for the
  capabilities the GL drivers support, and to call wglChoosePixelFormatARB() as
  appropriate (or ChoosePixelFormat()) for the final pixel format that we use.
* Ditch the dummy GL context, HDC and HWND after obtaining the pixel format.
* Then set the final pixel format that we obtained onto the HDC that is derived
  from the HWND used in GdkWin32Display for notifications, which will become our
  new dummy HDC.
* Create a new dummy HGLRC for use with the new dummy HDC to emulate surfaceless
  GL support.
2023-05-09 18:15:23 +08:00
Chun-wei Fan
d02ae09124 gdkglcontext-win32-wgl.c: Fix WGL context realization on 32-bit
We are currently using g_clear_pointer() on the intermediate WGL contexts
(HGLRC)'s that we need to create in the way, which means that we need to ensure
that the correct calling convention for wglDeleteContext() is being applied.

To be absolutely safe about it, use the gdk_win32_private_wglDeleteContext()
calls, which will in turn call wglDeleteContext() directly from opengl32.dll
(using the OpenGL headers from the Windows SDK) instead of going via libepoxy,
which will assure us that the correct calling convention is applied.

Fixes issue #5808.
2023-05-09 11:47:28 +08:00
Benjamin Otte
2a950dec71 Merge branch 'wip/otte/update-texture' into 'main'
Add texture update regions

See merge request GNOME/gtk!5880
2023-05-06 00:59:25 +00:00
Benjamin Otte
6506a3bc9c texturebuilder: Add ::udpate-region and ::update-texture 2023-05-02 00:30:58 +02:00
Benjamin Otte
1883035d34 texture: Add gdk_texture_diff()
... and use it in rendernodes.

Setting up textures for diffing is done via gdk_texture_set_diff() which
should only be used during texture construction.

Note that the pointers to next/previous are allowed to dangle if one of
the textures is finalized, but that's fine because we always check both
textures' links to each other before we consider the pointer valid.
2023-05-01 22:24:14 +02:00
Matthias Clasen
d92c6406d1 Merge branch 'displaymanager-warning-fix' into 'main'
Avoid a bad warning

See merge request GNOME/gtk!5901
2023-05-01 16:56:40 +00:00
Matthias Clasen
d666f4ab7f Avoid a bad warning
This isn't what we intended, and it breaks CI for
various projects.
2023-05-01 10:40:26 -04:00
Jordan Petridis
0197149ba3 vulkan: Correct error enum version guards
Vulkan 218 introduced these errors by they were marked as
the beta till version 238.

00671c64ba (diff-e222ae95c2b0d5082b94d6086fb1c24da18ee31384c1a39840df3b9152023ee6)

Followup to f9b2d3104a
2023-05-01 09:41:35 +03:00
Benjamin Otte
6cc1548c5f Merge branch 'wip/carlosg/x11-artifacts' into 'main'
gdk/x11: Invalidate whole surface after size change

See merge request GNOME/gtk!5857
2023-04-29 18:11:21 +00:00
Carlos Garnacho
24302315fb gdk/x11: Invalidate whole surface after size change
The Expose events following a ConfigureNotify may arrive at
a time that we did not resize the surface yet, making these
expose events a no-op. Even though gsk/gtk take care of the
window content itself, this might lead to unrendered portions
of the window shadow.

This may be seen with GSK_RENDERER=cairo and GDK_BACKEND=x11,
attempting to tile a window (e.g. gtk4-demo) left or right.
The window will show black rectangles or other artifacts in
the window shadow areas that correspond to the newly painted
portions (as the window needs to expand vertically).

In order to fix this with a similar behavior to Wayland,
consider ourselves the whole surface invalidated after resize,
in order to ensure everything is painted from scratch.
2023-04-29 11:51:32 +02:00
Benjamin Otte
11aaa29a69 wayland: Use wl_surface_damage_buffer() in Cairo
... when it is available.

Also introduce the new function gdk_rectangle_transform_affine(), which
looks like overkill for this purpose, but I'm about to use it elsewhere.
2023-04-29 05:07:03 +02:00
Benjamin Otte
b4c859c011 wayland: Set EGL swap interval to 0.
There's no need for EGL to do any timing, we do it in GTK already.

This fixes hangs in Mesa when we hide a surface after a SwapBuffers()
but before the frame callback arrives.
If we then reshow the surface and immediately render to it, Mesa would
still have a frame callback from before the hiding and forever poll()
waiting for the compositor to send the callback.

Fixes #5761
2023-04-28 22:40:39 +02:00
Benjamin Otte
45216e1c88 wayland: Disconnect the frame callback when hiding
Do not leave spurious frame callbacks around wen hiding surfaces.
Instead, store the callback and remove it.
2023-04-28 22:21:42 +02:00
Matthias Clasen
6efaa79e3c gltexture: Synchronize when downloading
If the GL texture has a sync object, wait
on it before downloading the data.
2023-04-27 06:57:02 +02:00
Matthias Clasen
92eb845482 gltexture: Optionally take a sync object
Add a new function to TextureBuilder that takes a GLsync that
requires internal code to wait on before using the texture.

Somewhat sneakily, we don't take the sync if syncs are not supported by
the current GL context.
As public API has no code to query the sync for the destroy notify, this
is fine and it means we don't have to do the check every time we want to
call gdk_texture_get_sync() internally.
2023-04-27 06:55:37 +02:00
Matthias Clasen
5071e6154c glcontext: Add a way to check for GLsync 2023-04-27 06:54:49 +02:00
Benjamin Otte
18a4b2475e gltexture: Deprecate gdk_gl_texture_new()
Use GdkGLTextureBuilder instead.
2023-04-27 06:40:47 +02:00
Benjamin Otte
aae7b2c8a8 texturebuilder: Pass the destroy notify to the build() function
This is more compatible with bindings that want to create per-object
callbacks and not have their callbacks reused over different build()
calls.
2023-04-27 06:40:47 +02:00
Benjamin Otte
e37fbaf13a texturebuilder: Add ::format and ::has-mipmap
We were trying to deduce that previously. Now we have explicit API
2023-04-27 06:40:47 +02:00
Benjamin Otte
e4f4cfaf14 gdk: Add GdkGLTextureBuilder
Building GL textures is complicated, so create an object to make them.

So far, this object just contains the functionality of
gdk_gl_texture_new(), but that will change in the future.
2023-04-27 06:40:47 +02:00
Benjamin Otte
9254ab8503 wgl: Improve error messages when GL init fails
In particular, we want to get the GL version, when the Windows box/VM
has an unsuitable GL implementation.

This is somewhat helpful in analyzing failures to bring up GL on
machines where users claim GL does work.
2023-04-27 02:19:25 +02:00
Benjamin Otte
d6afcee1e4 wgl: Create context during WGL initialization
This way, we can realize it and either print success information about
it or return NULL if that fails.

This makes it more likely that we fail early, which means we can then
initialize EGL.
2023-04-27 02:16:46 +02:00
Benjamin Otte
c71ca481c1 win32: Get rid of display->gl_version
We can just query the display's GL context.

And it's not used otherwise anymore.
2023-04-27 02:13:33 +02:00
Benjamin Otte
8ef38c46b5 win32: Refactor context creation
This refactor achieves the following:

 * check GL version against proper matching context version
   In particular, for legacy contexts, we now actually check
 * make sure the actual version is set, even for legacy contexts
 * make sure set_is_legacy() is set properly
2023-04-27 02:13:33 +02:00
Benjamin Otte
4333d754b8 gdk: Add workaround for Visual Studio
apparently casting something to itself makes it not constant.
2023-04-27 02:13:33 +02:00
Benjamin Otte
9f82d537b0 mac: Properly set GLContext.is_legacy() 2023-04-27 02:13:32 +02:00
Benjamin Otte
7c7a3d67ca glcontext: assert all contexts set the version on realize()
Now that all contexts do that, insist that they keep doing it.

And because they keep doing it, we can support querying the GL version
from gdk_gl_context_get_version() without requiring the context to be
made current.
2023-04-27 02:13:32 +02:00
Benjamin Otte
d33b82249b mac: Try all different OpenGL profiles
.. and pick the best one that is supported.

Also make sure that the resulting context has at least the desired
version, otherwise bail.
2023-04-27 02:13:32 +02:00
Benjamin Otte
5f833f1d31 glcontext: Compute matching version the simple way
Do it all in one function instead of requiring two different ones.
2023-04-27 02:13:32 +02:00