Port extensions app and portal to GTK4
With the previous preparations in place, it is time to take the plunge. As both the app and the portal use the same small library for handling external windows, port everything at once to avoid the hassle of building and installing two versions of the library. With the portal using GTK4 now, all extensions must port their preference widgets as well. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1495>
This commit is contained in:

committed by
Marge Bot

parent
ba039bcce5
commit
edd34c50d9
@ -21,7 +21,7 @@ libshew_gir = gnome.generate_gir(libshew,
|
||||
sources: shew_sources + shew_public_headers,
|
||||
nsversion: api_version,
|
||||
namespace: 'Shew',
|
||||
includes: ['Gdk-3.0', 'Gtk-3.0'],
|
||||
includes: ['Gdk-4.0', 'Gtk-4.0'],
|
||||
extra_args: ['--quiet'],
|
||||
install_dir_gir: girdir,
|
||||
install_dir_typelib: typelibdir,
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <gdk/gdk.h>
|
||||
|
||||
#ifdef GDK_WINDOWING_WAYLAND
|
||||
#include <gdk/gdkwayland.h>
|
||||
#include <gdk/wayland/gdkwayland.h>
|
||||
#endif
|
||||
|
||||
#include "shew-external-window-wayland.h"
|
||||
@ -77,14 +77,14 @@ shew_external_window_wayland_new (const char *handle_str)
|
||||
|
||||
static void
|
||||
shew_external_window_wayland_set_parent_of (ShewExternalWindow *external_window,
|
||||
GdkWindow *child_window)
|
||||
GdkSurface *child_surface)
|
||||
{
|
||||
ShewExternalWindowWayland *external_window_wayland =
|
||||
SHEW_EXTERNAL_WINDOW_WAYLAND (external_window);
|
||||
char *handle_str = external_window_wayland->handle_str;
|
||||
|
||||
#ifdef GDK_WINDOWING_WAYLAND
|
||||
if (!gdk_wayland_window_set_transient_for_exported (child_window, handle_str))
|
||||
if (!gdk_wayland_toplevel_set_transient_for_exported (GDK_WAYLAND_TOPLEVEL (child_surface), handle_str))
|
||||
g_warning ("Failed to set portal window transient for external parent");
|
||||
#endif
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <errno.h>
|
||||
#include <gdk/gdk.h>
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
#include <gdk/gdkx.h>
|
||||
#include <gdk/x11/gdkx.h>
|
||||
#include <X11/Xlib.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
@ -110,14 +110,14 @@ shew_external_window_x11_new (const char *handle_str)
|
||||
|
||||
static void
|
||||
shew_external_window_x11_set_parent_of (ShewExternalWindow *external_window,
|
||||
GdkWindow *child_window)
|
||||
GdkSurface *child_surface)
|
||||
{
|
||||
ShewExternalWindowX11 *external_window_x11 =
|
||||
SHEW_EXTERNAL_WINDOW_X11 (external_window);
|
||||
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
XSetTransientForHint (GDK_WINDOW_XDISPLAY (child_window),
|
||||
GDK_WINDOW_XID (child_window),
|
||||
XSetTransientForHint (GDK_SURFACE_XDISPLAY (child_surface),
|
||||
GDK_SURFACE_XID (child_surface),
|
||||
external_window_x11->foreign_xid);
|
||||
#endif
|
||||
}
|
||||
|
@ -75,10 +75,10 @@ shew_external_window_new_from_handle (const char *handle_str)
|
||||
|
||||
void
|
||||
shew_external_window_set_parent_of (ShewExternalWindow *external_window,
|
||||
GdkWindow *child_window)
|
||||
GdkSurface *child_surface)
|
||||
{
|
||||
SHEW_EXTERNAL_WINDOW_GET_CLASS (external_window)->set_parent_of (external_window,
|
||||
child_window);
|
||||
child_surface);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -32,12 +32,12 @@ struct _ShewExternalWindowClass
|
||||
GObjectClass parent_class;
|
||||
|
||||
void (*set_parent_of) (ShewExternalWindow *external_window,
|
||||
GdkWindow *child_window);
|
||||
GdkSurface *child_surface);
|
||||
};
|
||||
|
||||
ShewExternalWindow *shew_external_window_new_from_handle (const char *handle_str);
|
||||
|
||||
void shew_external_window_set_parent_of (ShewExternalWindow *external_window,
|
||||
GdkWindow *child_window);
|
||||
GdkSurface *child_surface);
|
||||
|
||||
GdkDisplay *shew_external_window_get_display (ShewExternalWindow *external_window);
|
||||
|
@ -21,10 +21,10 @@
|
||||
#include "shew-window-exporter.h"
|
||||
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
#include <gdk/gdkx.h>
|
||||
#include <gdk/x11/gdkx.h>
|
||||
#endif
|
||||
#ifdef GDK_WINDOWING_WAYLAND
|
||||
#include <gdk/gdkwayland.h>
|
||||
#include <gdk/wayland/gdkwayland.h>
|
||||
#endif
|
||||
|
||||
struct _ShewWindowExporter
|
||||
@ -53,9 +53,9 @@ shew_window_exporter_new (GtkWindow *window)
|
||||
|
||||
#ifdef GDK_WINDOWING_WAYLAND
|
||||
static void
|
||||
wayland_window_exported (GdkWindow *window,
|
||||
const char *handle,
|
||||
gpointer user_data)
|
||||
wayland_window_exported (GdkToplevel *toplevel,
|
||||
const char *handle,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_autoptr (GTask) task = user_data;
|
||||
|
||||
@ -90,8 +90,8 @@ shew_window_exporter_export (ShewWindowExporter *exporter,
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
if (GDK_IS_X11_DISPLAY (gtk_widget_get_display (widget)))
|
||||
{
|
||||
GdkWindow *w = gtk_widget_get_window (widget);
|
||||
guint32 xid = (guint32) gdk_x11_window_get_xid (w);
|
||||
GdkSurface *s = gtk_native_get_surface (GTK_NATIVE (widget));
|
||||
guint32 xid = (guint32) gdk_x11_surface_get_xid (s);
|
||||
|
||||
g_task_return_pointer (task, g_strdup_printf ("x11:%x", xid), g_free);
|
||||
}
|
||||
@ -100,9 +100,10 @@ shew_window_exporter_export (ShewWindowExporter *exporter,
|
||||
#ifdef GDK_WINDOWING_WAYLAND
|
||||
if (GDK_IS_WAYLAND_DISPLAY (gtk_widget_get_display (widget)))
|
||||
{
|
||||
GdkWindow *w = gtk_widget_get_window (widget);
|
||||
gdk_wayland_window_export_handle (w, wayland_window_exported,
|
||||
g_steal_pointer (&task), NULL);
|
||||
GdkSurface *s = gtk_native_get_surface (GTK_NATIVE (widget));
|
||||
gdk_wayland_toplevel_export_handle (GDK_WAYLAND_TOPLEVEL (s),
|
||||
wayland_window_exported,
|
||||
g_steal_pointer (&task), NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -136,8 +137,8 @@ shew_window_exporter_unexport (ShewWindowExporter *exporter)
|
||||
#ifdef GDK_WINDOWING_WAYLAND
|
||||
if (GDK_IS_WAYLAND_DISPLAY (gtk_widget_get_display (widget)))
|
||||
{
|
||||
GdkWindow *w = gtk_widget_get_window (widget);
|
||||
gdk_wayland_window_unexport_handle (w);
|
||||
GdkSurface *s = gtk_native_get_surface (GTK_NATIVE (widget));
|
||||
gdk_wayland_toplevel_unexport_handle (GDK_WAYLAND_TOPLEVEL (s));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user