Commit Graph

11137 Commits

Author SHA1 Message Date
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
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