Commit Graph

60 Commits

Author SHA1 Message Date
Matthias Clasen
ebc4bb2363 wayland: Switch to v4 of the color management protocol 2024-07-23 23:37:00 -06:00
Matthias Clasen
533aaba5eb wayland: Support xx-color-management-v2
This is a still experimental protocol (thus the xx prefix).

We are using it go obtain information about the compositors
preferred color state, and pass that on to our rendering machinery.

The currently supported color states are srgb, srgb-linear, rec2100-pq
and rec2100-linear. We don't have any support for ICC profiles.

Unlike other protocols, keep the support code for this protocol
fairly isolated behind wrapper objects, since the protocol is
still subject to change.
2024-07-14 14:58:00 -04:00
Carlos Garnacho
cf8c3be030 gdk/wayland: Implement support for xdg-dialog Wayland protocol
This protocol lifts some functionality from the gtk-shell protocol,
namely the ability to tag dialogs as modal. Ensure to use this
new protocol if available for the task, instead of the gtk-shell
protocol.
2024-05-23 12:40:39 +02:00
Carlos Garnacho
4eb715cf81 build: Support in-tree copies of wayland protocols
Make the info about the required protocols an array of definitions
again (a dict instead of an array this time) and add a field that
may be used for version checks of the wayland-protocols found.

Also, make it possible to have versioned protocols in-tree. Both
of these things will allow us to ship in-tree copies of wayland-protocols
without necessarily having to bump the version we depend on.
2024-05-23 12:40:19 +02:00
Matthias Clasen
b98c86fb7b wayland: Break out dmabuf feedback code
This will need to be used in surfaces as well, in the future.
Prepare for that by moving this code into its own file and struct.
2024-04-27 11:47:26 -04:00
Robert Mader
a70998aa50 wayland: Support the single-pixel-buffer protocol
This just gets the manager object. It is not used yet.
2024-04-15 19:53:46 -04:00
Matthias Clasen
d1bb1d091c Merge branch 'gdk-build-dep-fix' into 'main'
build: Add a missing dependency

Closes #6618

See merge request GNOME/gtk!7127
2024-04-11 20:57:34 +00:00
Matthias Clasen
6510b876d1 build: Add a missing dependency
Add the generated gdk headers to the sources for all the backends,
to guarantee that they are generated before the library is used.

Fixes: #6618
2024-04-11 15:47:38 -04:00
Xavier Claessens
95a8def7c2 Meson: Use wayland module 2024-04-10 11:43:04 -04:00
Christian Hergert
53616a73e9 gdk/wayland: use wp_presentation for more accurate frame timings
This attempts to improve the accuracy for the "presentation_time" of an
individual GdkFrameTimings. That information is currently filled in as soon
as we get a frame callback. However, if presentation-time wayland protocol
is available, that will be used to supliment a more accurate time which
may improve future presentation-time predictions within GdkFrameClockIdle.

The protocol states that all related and sub surfaces will receive the
same information so it is safe that this could be registered for more
than just the toplevel. The information becomes idempotent.
2024-03-20 14:45:58 -07:00
Matthias Clasen
59dbfb0843 wayland: Implement subsurface api
This is not used anywhere yet.
2023-11-13 22:17:35 +01:00
Matthias Clasen
489723916d wayland: Get format info for dmabufs
For now, all we do with it is dump the formats if you
set GDK_DEBUG=misc. In the future, this will be used
when attaching dmabufs to subsurfaces.
2023-11-13 22:17:35 +01:00
Xavier Claessens
090e01b383 meson: Add wayland-client to gtk4-wayland requires 2023-08-15 13:35:46 -04:00
Benjamin Otte
1a71e82fc5 wayland: Use wp_viewport to set buffer scale
Instead of setting the buffer scale via the buffer-scale command, set it
via the viewport.

This technically allows setting fractional scales, but we're not doing
that.
2023-04-01 20:05:01 +02:00
Benjamin Otte
54e8bd898a wayland: Add support for the fractional scale protocol
April fools!

No, really.
The fractional scale protocol is just a way to track the surface scale,
but not a way to draw fractional content.
This commit uses it for that, so tht we don't rely on tracking outputs.

This also allows magnifiers etc to send us a larger (integer) scale if
they would like that, that is not represented by the outputs.
2023-04-01 12:57:03 +02:00
Carlos Garnacho
4005eb8fe8 gdk/wayland: Rename gdkkeys-wayland.c file
Since it contains the GdkKeymap implementation, give it a more
obvious name.
2023-02-03 16:15:34 +01:00
Carlos Garnacho
1d4ceac2c5 gdk/wayland: "Split" GdkWaylandDevice implementation out
This is a bit spaghetti right now, since seats and devices were
heavily entangled there are a number of crossed private API calls that
should ideally not be there.

Let this be a first step, so more bits may move from the seat
implementation to devices.
2023-02-03 16:15:34 +01:00
Carlos Garnacho
a5246a6856 gdk/wayland: Split GdkDevicePad wayland implementation
This now lives in its own C file.
2023-02-03 16:08:07 +01:00
Carlos Garnacho
6426ab7466 gdk/wayland: Rename gdkdevice-wayland.c to gdkseat-wayland.c
This file, event though a clump of input-y objects, has more of
seats than anything else. Rename it so that we can start splitting
these objects out of it.
2023-02-03 15:58:11 +01:00
Matthias Clasen
120396fa40 wip: Split off GdkWaylandPopup
Like the GdkWaylandToplevel split-off, this needs some
more cleanup.
2023-01-06 16:50:19 -05:00
Matthias Clasen
d61ec38974 wip: Split off GdkWaylandToplevel
This still needs some more cleanup.
2023-01-06 16:50:19 -05:00
Matthias Clasen
348acde6bd wayland: Split public headers
Split gdkwaylandsurface.h into itself,
gdkwaylandtoplevel.h and gdkwaylandpopup.h.
This is in preparation for splitting the
types for real.
2023-01-06 13:47:34 -05:00
Matthias Clasen
7406f8165d wayland: Move drag surfaces to their own file 2023-01-06 13:46:58 -05:00
Matthias Clasen
0ba8e16e14 wayland: Add zxdg_foreign_v2 protocol support 2022-11-09 16:28:29 +01:00
Matthias Clasen
06aa640664 Fix build with wayland-protocols subproject
The missing files() was pointed out in #4530.

Fixes: #4530
2022-02-10 13:21:28 -05:00
Carlos Garnacho
be4216e051 gdk/wayland: Support the xdg-activation wayland protocol
This protocol implements the IPC necessary to focus application
windows across launcher/launchee. Add support for it.
2021-05-03 17:20:50 +02:00
Emmanuele Bassi
99e0929d6c build: Use a consistent style for Meson files 2020-12-15 12:46:59 +00:00
Emmanuele Bassi
7975bbfcaa build: Remove linker flags from static libraries
We only need hardening linker flags on the libgtk shared library;
internal static libraries don't really need them.
2020-12-15 11:36:20 +00:00
Emmanuele Bassi
da007ac97b Add a public header for GdkWaylandSeat
We have public API requiring it as a type.
2020-10-14 11:55:34 +01:00
Robert Mader
9ea0469ab0 gdk/wayland: Replace gtk-primary-selection with primary-selection-unstable-v1
The later is the public upstream version, while identical implementation wise.

https://gitlab.gnome.org/GNOME/gtk/-/issues/2591
2020-09-27 16:23:42 +02:00
Emmanuel Gil Peyrot
74a4432688 gdk/wayland: Add an API to inhibit and uninhibit idle
This uses the idle-inhibit protocol from wayland-protocols, to attach an
inhibitor to the GdkSurface.  The inhibit function can be called as many
times as the user wants, but the uninhibit function MUST be called as
many times to unset the idle inhibition.

This has been tested on Sway.
2020-07-14 21:47:22 +02:00
Jonas Ådahl
5425edff82 wayland: Move popups with xdg_popup.reposition
The third version of xdg-shell introduces support for explicit popup
repositioning. If available, make use of this to implement popup
repositioning.

Note that this does *NOT* include atomic parent-child state
synchronization. For that,
https://gitlab.freedesktop.org/wayland/wayland-protocols/issues/13 will
be needed.

This currently uses my own fork of wayland-protocols which adds meson
support, so that we can use it as a subproject. Eventually when
wayland-protocols' meson support lands upstream, we should change it to
point there.

Silence some meson warnings while at it to make CI happy.

This also bumps the glib requirement, since g_warning_once() is used.
2020-04-08 23:32:47 +02:00
Benjamin Otte
28dced597f gdk: Remove gdk_text_property_to_utf8_list_for_display()
A lot of files became empty now, so they have been removed, which makes
this commit seem larger than it is.
2020-02-23 01:59:26 +01:00
Matthias Clasen
4e58541d52 Make wayland load cursors on demand
Copy just enough of libwayland-cursor to make our own
loading. This lets us drop the dependency on libwayland-cursor,
and changes the startup cost for cursor theme loading
from 25ms to 0.1ms.

At the same time, simplify the handling of scaled cursors -
instead of creating an array of theme objects, just make a
single theme object provide all scaled cursor sizes.
2020-01-24 17:27:45 -05:00
Emmanuele Bassi
def700739d Use a single compilation symbol
We use a compilation symbol in our build to allow the inclusion of
specific headers while building GTK, to avoid the need to include only
the global header.

Each namespace has its own compilation symbol because we used to have
different libraries, and strict symbol visibility between libraries;
now that we have a single library, and we can use private symbols across
namespaces while building GTK, we should have a single compilation
symbol, and simplify the build rules.
2019-11-27 13:33:43 +00:00
Benjamin Otte
7ae675b469 build: Install the backend headers in the backend directories
That's where they are in the sources and we include them from other
headers. So make sure the directories match.
2019-05-06 20:14:53 +02:00
Olivier Fourdan
1f58e0ed6b wayland: Add support for xdg-output
Previously, the GDK backend for Wayland would deduce the logical size
of the monitors from the wl_output size and scale.

With the addition of fractional scaling which advertises a larger scale
value and then scale down the client surface, the computed logical size
of the monitors in GDK would be wrong and confuse applications which
insist on using the monitor size and position (like Firefox).

The xdg-output protocol aims at describing outputs in a way which is more
in line with the concept of an output on desktop oriented systems by
presenting the outputs using their logical size and position appropriately
transformed.

Add support for the optional xdg-output protocol so that the size and
position of the monitors as reported by GDK is correct even when using
fractional scaling.

Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/1828
2019-04-16 16:14:43 +02:00
Matthias Clasen
0e2ac0ebf2 wayland: Rename a source file
Rename gdkdnd-wayland.c to gdkdrag-wayland.c to go along
with gdkdrop-wayland.c.
2018-07-12 13:02:42 +02:00
Benjamin Otte
4eb3a9faaa wayland: Split drop context into GdkWaylandDrop
GdkWaylandDrop no longer inherits from GdkDragContext now.
2018-06-18 23:49:52 +02:00
Jonas Ådahl
a40923b03a wayland: Add support for xdg-shell stable
This commit adds support the stable version of the xdg-shell protocol.
Support for the last version of the unstable series is left intact, but
will not receive new features.

The stable version is prioritized above the older version.

https://bugzilla.gnome.org/show_bug.cgi?id=791939
2018-05-01 13:36:38 +02:00
Benjamin Otte
813e9c95fb gdk: Add Cairo context implementations for all backends
And make the GdkCairoContext as abstract.

The idea of this and thje following commits is to get rid of all
Cairo code in gdksurface.c (and $backend/gdksurface-$backend.c)
by moving that code into the Cairo context files.
In particular, the GdkSurfaceClass.begin_frame/end_frame()
functions (which are currently exclusively used by the Cairo code
should end up being moved to GdkDrawContextClass.begin/end_frame().

This has multiple benefits:

1. It unifies code between the different drawing contexts.
   GL lives in GLContext, Vulkan in VulkanContext and Cairo in
   CairoContext. In turn, this makes it way easier to reason about
   what's going on in surface-specific code. Currently pretty much
   all backends do things wrong when they want to sync to drawing
   or to the frame clock.

2. It makes the API of GdkSurface smaller. No drawing code (apart
   from creating the contexts) needs to remain.

3. It confines Cairo to the Drawcontext, thereby making it way
   more obvious when backends are still using it in situations
   where it may now conflict with OpenGL (like when doing the dnd
   failed animation or in the APIs that I'm removing in this
   branch).

4. We have 2 very different types of Cairo contexts: The X/win32
   model, where we have a natively supported Cairo backend but do
   double buffering ourselves and use similar surfaces and the
   Wayland/Broadway model where we use image surfaces without any
   Cairo backend support and have to submit the buffers manually.
   By not sharing code between those 2 versions, we can make the
   actual code way smaller. We also get around the need to create
   1x1 image surfaces in the Wayland backend where we pretend
   there's a native Cairo surface.
2018-04-24 23:16:12 +02:00
Emmanuele Bassi
a2a99d27c9 Simplify the Wayland code generation
Instead of going through an ancillary script to strip away the
`WL_EXPORT` annotation from the generated code, we should bump up the
required version of Wayland, and use the `private-code` argument for
wayland-scanner, which does the right thing for us.
2018-04-11 15:06:43 +01:00
Alexander Larsson
890080ebf7 GdkWindow -> GdkSurface: File renames
Rename all *window.[ch] source files.

This is an automatic operation, done by the following commands:

for i in $(git ls-files gdk | grep window); do
    git mv $i $(echo $i | sed s/window/surface/);
    git sed -f g $(basename $i) $(basename $i | sed s/window/surface/) ;
done

git checkout NEWS* po-properties po
2018-03-20 11:46:11 +01:00
Benjamin Otte
ff577e6c2c wayland: Add primary clipboard subclass
I decided to put this in a custom subclass, because then I could keep
the whole gtk primary protocol self-contained.

The other option would have been reusing GdkWaylandClipboard, but that
didn't seem worth it, especially because that code needs to interact
with the DND machinery, while the primary doesn't.
2017-12-03 05:46:49 +01:00
Benjamin Otte
00192266a1 wayland: Add skeleton for a GdkClipboardWayland
Creates the source file and a custom subclass and makes sure it's used
by GDK.
2017-12-03 05:46:49 +01:00
Benjamin Otte
fb94f79094 selection: Remove #ifdef WAYLAND
Instead, turn the functions into backend API:
  gdk_broadway_display_add_selection_targets()
  gdk_broadway_display_clear_selection_targets()
Remove the old per-backend functions, too.
2017-11-15 19:07:16 +01:00
Matthias Clasen
0f9e9a9ec2 wayland: No more screen
This gets rid of the GdkWaylandScreen object and all
remnants of GdkScreen in the wayland backend.
2017-11-01 19:44:29 -04:00
Drew DeVault
1b279e3d4a Wayland: Implement KDE's SSD protocol
If the compositor prefers server-side decorations and the client doesn't
customize the title bar, we disable client-side decorations and let the
compositor know. Otherwise, we continue to use client-side decorations.

Signed-off-by: Drew DeVault <sir@cmpwn.com>

https://bugzilla.gnome.org/show_bug.cgi?id=781909
2017-10-26 15:51:56 -04:00
Emmanuele Bassi
b4b2fa4a98 meson: Add missing Wayland protocol
GDK depends on a new Wayland protocol.
2017-08-02 12:31:30 +01:00
Emmanuele Bassi
0dad501d16 meson: Remove G_LOG_USE_STRUCTURED from target C flags
The G_LOG_USE_STRUCTURED symbol is defined in the project flags, so we
don't need to add it again in the per-target flags.
2017-05-03 16:22:52 +01:00