Merge branch 'ebassi/for-master' into 'master'

GdkWayland API cleanups

Closes #3249

See merge request GNOME/gtk!2688
This commit is contained in:
Matthias Clasen
2020-10-15 16:55:19 +00:00
17 changed files with 134 additions and 67 deletions

View File

@@ -961,7 +961,6 @@ gdk_wayland_display_query_registry
gdk_wayland_display_set_cursor_theme
gdk_wayland_display_get_startup_notification_id
gdk_wayland_display_set_startup_notification_id
gdk_wayland_display_prefers_ssd
gdk_wayland_display_query_registry
<SUBSECTION Device>
@@ -970,7 +969,6 @@ gdk_wayland_device_get_wl_seat
gdk_wayland_device_get_wl_pointer
gdk_wayland_device_get_wl_keyboard
gdk_wayland_device_get_node_ath
gdk_wayland_device_pad_set_feedback
<SUBSECTION Monitor>
gdk_wayland_monitor_get_wl_output
@@ -982,9 +980,6 @@ gdk_wayland_toplevel_export_handle
gdk_wayland_toplevel_unexport_handle
gdk_wayland_toplevel_set_transient_for_exported
gdk_wayland_toplevel_set_application_id
gdk_wayland_toplevel_announce_csd
gdk_wayland_toplevel_inhibit_idle
gdk_wayland_toplevel_uninhibit_idle
<SUBSECTION Standard>
GDK_TYPE_WAYLAND_DEVICE

View File

@@ -3,11 +3,15 @@
#include "gdkwaylanddevice.h"
void
gdk_wayland_device_query_state (GdkDevice *device,
GdkSurface *surface,
double *win_x,
double *win_y,
GdkModifierType *mask);
void gdk_wayland_device_query_state (GdkDevice *device,
GdkSurface *surface,
double *win_x,
double *win_y,
GdkModifierType *mask);
void gdk_wayland_device_pad_set_feedback (GdkDevice *device,
GdkDevicePadFeature feature,
guint feature_idx,
const char *label);
#endif

View File

@@ -5013,11 +5013,11 @@ gdk_wayland_device_set_selection (GdkDevice *gdk_device,
/**
* gdk_wayland_seat_get_wl_seat: (skip)
* @seat: a #GdkSeat
* @seat: (type GdkWaylandSeat): a #GdkSeat
*
* Returns the Wayland wl_seat of a #GdkSeat.
* Returns the Wayland `wl_seat` of a #GdkSeat.
*
* Returns: (transfer none): a Wayland wl_seat
* Returns: (transfer none): a Wayland `wl_seat`
*/
struct wl_seat *
gdk_wayland_seat_get_wl_seat (GdkSeat *seat)
@@ -5064,7 +5064,7 @@ gdk_wayland_device_get_node_path (GdkDevice *device)
return NULL;
}
/**
/*<private>
* gdk_wayland_device_pad_set_feedback:
* @device: (type GdkWaylandDevice): a %GDK_SOURCE_TABLET_PAD device
* @feature: Feature to set the feedback label for

View File

@@ -384,7 +384,7 @@ static const struct org_kde_kwin_server_decoration_manager_listener server_decor
.default_mode = server_decoration_manager_default_mode
};
/**
/*
* gdk_wayland_display_prefers_ssd:
* @display: (type GdkWaylandDisplay): a #GdkDisplay
*

View File

@@ -165,6 +165,8 @@ struct _GdkWaylandDisplayClass
GdkDisplayClass parent_class;
};
gboolean gdk_wayland_display_prefers_ssd (GdkDisplay *display);
G_END_DECLS
#endif /* __GDK_WAYLAND_DISPLAY__ */

View File

@@ -22,25 +22,18 @@
#include "config.h"
#include <gdk/gdkseatprivate.h>
#include "gdkwaylandseat.h"
#include "gdk/gdkseatprivate.h"
#define GDK_TYPE_WAYLAND_SEAT (gdk_wayland_seat_get_type ())
#define GDK_WAYLAND_SEAT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_WAYLAND_SEAT, GdkWaylandSeat))
#define GDK_WAYLAND_SEAT_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GDK_TYPE_WAYLAND_SEAT, GdkWaylandSeatClass))
#define GDK_IS_WAYLAND_SEAT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_WAYLAND_SEAT))
#define GDK_IS_WAYLAND_SEAT_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GDK_TYPE_WAYLAND_SEAT))
#define GDK_WAYLAND_SEAT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_WAYLAND_SEAT, GdkWaylandSeatClass))
typedef struct _GdkWaylandSeat GdkWaylandSeat;
typedef struct _GdkWaylandSeatClass GdkWaylandSeatClass;
struct _GdkWaylandSeatClass
{
GdkSeatClass parent_class;
};
GType gdk_wayland_seat_get_type (void) G_GNUC_CONST;
void gdk_wayland_seat_update_cursor_scale (GdkWaylandSeat *seat);
void gdk_wayland_seat_clear_touchpoints (GdkWaylandSeat *seat,

View File

@@ -17,12 +17,7 @@
#include "config.h"
#include <netinet/in.h>
#include <unistd.h>
#include "gdk.h"
#include "gdkwayland.h"
#include "gdkwaylandsurface.h"
#include "gdksurface-wayland.h"
#include "gdkdeviceprivate.h"
#include "gdkdisplay-wayland.h"
@@ -45,6 +40,9 @@
#include <string.h>
#include <errno.h>
#include <netinet/in.h>
#include <unistd.h>
#define SURFACE_IS_TOPLEVEL(surface) TRUE
#define MAX_WL_BUFFER_SIZE (4083) /* 4096 minus header, string argument length and NUL byte */
@@ -4172,13 +4170,13 @@ maybe_set_gtk_surface_dbus_properties (GdkWaylandSurface *impl)
}
void
gdk_wayland_toplevel_set_dbus_properties_libgtk_only (GdkToplevel *toplevel,
const char *application_id,
const char *app_menu_path,
const char *menubar_path,
const char *window_object_path,
const char *application_object_path,
const char *unique_bus_name)
gdk_wayland_toplevel_set_dbus_properties (GdkToplevel *toplevel,
const char *application_id,
const char *app_menu_path,
const char *menubar_path,
const char *window_object_path,
const char *application_object_path,
const char *unique_bus_name)
{
GdkWaylandSurface *impl;

View File

@@ -0,0 +1,40 @@
/* gdksurface-wayland.h: Private header for GdkWaylandSurface
*
* Copyright 2020 GNOME Foundation
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "gdkwaylandsurface.h"
G_BEGIN_DECLS
void gdk_wayland_toplevel_set_dbus_properties (GdkToplevel *toplevel,
const char *application_id,
const char *app_menu_path,
const char *menubar_path,
const char *window_object_path,
const char *application_object_path,
const char *unique_bus_name);
void gdk_wayland_toplevel_announce_csd (GdkToplevel *toplevel);
gboolean gdk_wayland_toplevel_inhibit_idle (GdkToplevel *toplevel);
void gdk_wayland_toplevel_uninhibit_idle (GdkToplevel *toplevel);
G_END_DECLS

View File

@@ -32,6 +32,7 @@
#include <gdk/wayland/gdkwaylanddevice.h>
#include <gdk/wayland/gdkwaylanddisplay.h>
#include <gdk/wayland/gdkwaylandmonitor.h>
#include <gdk/wayland/gdkwaylandseat.h>
#include <gdk/wayland/gdkwaylandsurface.h>
#include <gdk/wayland/gdkwaylandglcontext.h>

View File

@@ -33,6 +33,7 @@ typedef struct _GdkWaylandDevice GdkWaylandDevice;
#else
typedef GdkDevice GdkWaylandDevice;
#endif
typedef struct _GdkWaylandDeviceClass GdkWaylandDeviceClass;
#define GDK_TYPE_WAYLAND_DEVICE (gdk_wayland_device_get_type ())
@@ -52,18 +53,9 @@ struct wl_pointer *gdk_wayland_device_get_wl_pointer (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
struct wl_keyboard *gdk_wayland_device_get_wl_keyboard (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
struct wl_seat *gdk_wayland_seat_get_wl_seat (GdkSeat *seat);
GDK_AVAILABLE_IN_ALL
const char *gdk_wayland_device_get_node_path (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
void gdk_wayland_device_pad_set_feedback (GdkDevice *device,
GdkDevicePadFeature feature,
guint feature_idx,
const char *label);
G_END_DECLS
#endif /* __GDK_WAYLAND_DEVICE_H__ */

View File

@@ -59,8 +59,6 @@ GDK_AVAILABLE_IN_ALL
void gdk_wayland_display_set_startup_notification_id (GdkDisplay *display,
const char *startup_id);
gboolean gdk_wayland_display_prefers_ssd (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
gboolean gdk_wayland_display_query_registry (GdkDisplay *display,
const char *global);

View File

@@ -0,0 +1,49 @@
/* gdkwaylandseat.h: Wayland GdkSeat
*
* Copyright 2020 GNOME Foundation
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#if !defined (__GDKWAYLAND_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gdk/wayland/gdkwayland.h> can be included directly."
#endif
#include <gdk/gdk.h>
#include <wayland-client.h>
G_BEGIN_DECLS
#ifdef GTK_COMPILATION
typedef struct _GdkWaylandSeat GdkWaylandSeat;
#else
typedef GdkSeat GdkWaylandSeat;
#endif
typedef struct _GdkWaylandSeatClass GdkWaylandSeatClass;
#define GDK_TYPE_WAYLAND_SEAT (gdk_wayland_seat_get_type ())
#define GDK_WAYLAND_SEAT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_WAYLAND_SEAT, GdkWaylandSeat))
#define GDK_IS_WAYLAND_SEAT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_WAYLAND_SEAT))
GDK_AVAILABLE_IN_ALL
GType gdk_wayland_seat_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
struct wl_seat * gdk_wayland_seat_get_wl_seat (GdkSeat *seat);
G_END_DECLS

View File

@@ -62,15 +62,6 @@ GType gdk_wayland_popup_get_type (void);
GDK_AVAILABLE_IN_ALL
struct wl_surface *gdk_wayland_surface_get_wl_surface (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
void gdk_wayland_toplevel_set_dbus_properties_libgtk_only (GdkToplevel *toplevel,
const char *application_id,
const char *app_menu_path,
const char *menubar_path,
const char *window_object_path,
const char *application_object_path,
const char *unique_bus_name);
typedef void (*GdkWaylandToplevelExported) (GdkToplevel *toplevel,
const char *handle,
gpointer user_data);
@@ -92,11 +83,6 @@ GDK_AVAILABLE_IN_ALL
void gdk_wayland_toplevel_set_application_id (GdkToplevel *toplevel,
const char *application_id);
void gdk_wayland_toplevel_announce_csd (GdkToplevel *toplevel);
gboolean gdk_wayland_toplevel_inhibit_idle (GdkToplevel *toplevel);
void gdk_wayland_toplevel_uninhibit_idle (GdkToplevel *toplevel);
G_END_DECLS
#endif /* __GDK_WAYLAND_SURFACE_H__ */

View File

@@ -24,7 +24,8 @@ gdk_wayland_public_headers = files([
'gdkwaylanddisplay.h',
'gdkwaylandglcontext.h',
'gdkwaylandmonitor.h',
'gdkwaylandsurface.h'
'gdkwaylandseat.h',
'gdkwaylandsurface.h',
])
install_headers(gdk_wayland_public_headers, 'gdkwayland.h', subdir: 'gtk-4.0/gdk/wayland/')

View File

@@ -26,6 +26,7 @@
#include <gdk/wayland/gdkwayland.h>
#include <gdk/wayland/gdkdisplay-wayland.h>
#include <gdk/wayland/gdksurface-wayland.h>
#include <gdk/wayland/idle-inhibit-unstable-v1-client-protocol.h>
typedef struct
@@ -83,9 +84,13 @@ gtk_application_impl_wayland_handle_window_realize (GtkApplicationImpl *impl,
window_path = gtk_application_impl_dbus_get_window_path (dbus, window);
gdk_wayland_toplevel_set_dbus_properties_libgtk_only (GDK_TOPLEVEL (gdk_surface),
dbus->application_id, dbus->app_menu_path, dbus->menubar_path,
window_path, dbus->object_path, dbus->unique_name);
gdk_wayland_toplevel_set_dbus_properties (GDK_TOPLEVEL (gdk_surface),
dbus->application_id,
dbus->app_menu_path,
dbus->menubar_path,
window_path,
dbus->object_path,
dbus->unique_name);
g_free (window_path);

View File

@@ -77,6 +77,7 @@
#ifdef GDK_WINDOWING_WAYLAND
#include <gdk/wayland/gdkwayland.h>
#include "gdk/wayland/gdkdevice-wayland-private.h"
#endif
struct _GtkPadController {

View File

@@ -88,6 +88,8 @@
#ifdef GDK_WINDOWING_WAYLAND
#include "wayland/gdkwayland.h"
#include "wayland/gdkdisplay-wayland.h"
#include "wayland/gdksurface-wayland.h"
#endif
#ifdef GDK_WINDOWING_BROADWAY