Bug 1777562 [wpt PR 34663] - [FedCM] Rename FederatedCredential to IdentityCredential...
[gecko.git] / widget / gtk / MozContainerWayland.h
blob86833b6198c4c970c5cb4b152b927d8c60c07dae
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:expandtab:shiftwidth=4:tabstop=4:
3 */
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 #ifndef __MOZ_CONTAINER_WAYLAND_H__
9 #define __MOZ_CONTAINER_WAYLAND_H__
11 #include <gtk/gtk.h>
12 #include <functional>
13 #include <vector>
14 #include "mozilla/Mutex.h"
15 #include "WindowSurface.h"
18 * MozContainer
20 * This class serves three purposes in the nsIWidget implementation.
22 * - It provides objects to receive signals from GTK for events on native
23 * windows.
25 * - It provides GdkWindow to draw content on Wayland or when Gtk+ renders
26 * client side decorations to mShell.
29 /* Workaround for bug at wayland-util.h,
30 * present in wayland-devel < 1.12
32 struct wl_surface;
33 struct wl_subsurface;
35 struct MozContainerWayland {
36 struct wl_surface* surface;
37 struct wl_subsurface* subsurface;
38 int subsurface_dx, subsurface_dy;
39 struct wl_egl_window* eglwindow;
40 struct wl_callback* frame_callback_handler;
41 struct wp_viewport* viewport;
42 gboolean opaque_region_needs_updates;
43 int opaque_region_corner_radius;
44 gboolean opaque_region_used;
45 gboolean ready_to_draw;
46 gboolean commit_to_parent;
47 gboolean before_first_size_alloc;
48 int buffer_scale;
49 std::vector<std::function<void(void)>> initial_draw_cbs;
50 // mozcontainer is used from Compositor and Rendering threads
51 // so we need to control access to mozcontainer where wayland internals
52 // are used directly.
53 mozilla::Mutex* container_lock;
56 struct _MozContainer;
57 struct _MozContainerClass;
58 typedef struct _MozContainer MozContainer;
59 typedef struct _MozContainerClass MozContainerClass;
61 void moz_container_wayland_class_init(MozContainerClass* klass);
62 void moz_container_wayland_init(MozContainerWayland* container);
64 struct wl_surface* moz_container_wayland_surface_lock(MozContainer* container);
65 void moz_container_wayland_surface_unlock(MozContainer* container,
66 struct wl_surface** surface);
68 struct wl_surface* moz_container_wayland_get_surface_locked(
69 const mozilla::MutexAutoLock& aProofOfLock, MozContainer* container);
70 void moz_container_wayland_lock(MozContainer* container);
71 void moz_container_wayland_unlock(MozContainer* container);
73 struct wl_egl_window* moz_container_wayland_get_egl_window(
74 MozContainer* container, double scale);
76 gboolean moz_container_wayland_has_egl_window(MozContainer* container);
77 void moz_container_wayland_egl_window_set_size(MozContainer* container,
78 int width, int height);
79 void moz_container_wayland_set_scale_factor(MozContainer* container);
80 void moz_container_wayland_set_scale_factor_locked(MozContainer* container);
81 void moz_container_wayland_add_initial_draw_callback(
82 MozContainer* container, const std::function<void(void)>& initial_draw_cb);
83 void moz_container_wayland_clear_initial_draw_callback(MozContainer* container);
84 wl_surface* moz_gtk_widget_get_wl_surface(GtkWidget* aWidget);
85 void moz_container_wayland_update_opaque_region(MozContainer* container,
86 int corner_radius);
87 gboolean moz_container_wayland_can_draw(MozContainer* container);
88 double moz_container_wayland_get_scale(MozContainer* container);
89 void moz_container_wayland_set_commit_to_parent(MozContainer* container);
90 bool moz_container_wayland_is_commiting_to_parent(MozContainer* container);
92 #endif /* __MOZ_CONTAINER_WAYLAND_H__ */