1/*
2 * Copyright © 2016 Red Hat, Inc
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "config.h"
19
20#include <glib.h>
21#include <gio/gio.h>
22#include "gdkprivate-wayland.h"
23
24#include "gdkmonitor-wayland.h"
25
26/**
27 * GdkWaylandMonitor:
28 *
29 * The Wayland implementation of `GdkMonitor`.
30 *
31 * Beyond the [class@Gdk.Monitor] API, the Wayland implementation
32 * offers access to the Wayland `wl_output` object with
33 * [method@GdkWayland.WaylandMonitor.get_wl_output].
34 */
35
36G_DEFINE_TYPE (GdkWaylandMonitor, gdk_wayland_monitor, GDK_TYPE_MONITOR)
37
38static void
39gdk_wayland_monitor_init (GdkWaylandMonitor *monitor)
40{
41}
42
43static void
44gdk_wayland_monitor_finalize (GObject *object)
45{
46 GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)object;
47
48 g_free (mem: monitor->name);
49
50 wl_output_destroy (wl_output: monitor->output);
51
52 G_OBJECT_CLASS (gdk_wayland_monitor_parent_class)->finalize (object);
53}
54
55static void
56gdk_wayland_monitor_class_init (GdkWaylandMonitorClass *class)
57{
58 G_OBJECT_CLASS (class)->finalize = gdk_wayland_monitor_finalize;
59}
60
61/**
62 * gdk_wayland_monitor_get_wl_output: (skip)
63 * @monitor: (type GdkWaylandMonitor): a `GdkMonitor`
64 *
65 * Returns the Wayland `wl_output` of a `GdkMonitor`.
66 *
67 * Returns: (transfer none): a Wayland `wl_output`
68 */
69struct wl_output *
70gdk_wayland_monitor_get_wl_output (GdkMonitor *monitor)
71{
72 g_return_val_if_fail (GDK_IS_WAYLAND_MONITOR (monitor), NULL);
73
74 return GDK_WAYLAND_MONITOR (monitor)->output;
75}
76

source code of gtk/gdk/wayland/gdkmonitor-wayland.c