mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2024-12-04 20:07:36 +00:00
parent
03ede5b574
commit
3201c8e69b
11 changed files with 1152 additions and 8 deletions
21
debian/copyright
vendored
21
debian/copyright
vendored
|
@ -22,3 +22,24 @@ License: GPL-3+
|
|||
.
|
||||
On Debian systems, the full text of the GNU General Public License version 3
|
||||
can be found in the file `/usr/share/common-licenses/GPL-3'.
|
||||
|
||||
Files: src/wayland/wlr-layer-shell-unstable-v1.xml
|
||||
Copytight: Copyright © 2017 Drew DeVault
|
||||
License: X11
|
||||
Permission to use, copy, modify, distribute, and sell this software and
|
||||
its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and fthat both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation, and that the name of the copyright holders not be used in
|
||||
advertising or publicity pertaining to distribution of the software
|
||||
without specific, written prior permission. The copyright holders make
|
||||
no representations about the suitability of this software for any
|
||||
purpose. It is provided "as is" without express or implied warranty.
|
||||
.
|
||||
THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
|
||||
RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
|
||||
CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
|
|
@ -24,7 +24,7 @@ project(
|
|||
'c',
|
||||
version: '0.0.1',
|
||||
license: 'GPLv3+',
|
||||
meson_version: '>= 0.46.0',
|
||||
meson_version: '>= 0.47.0',
|
||||
default_options: [
|
||||
'warning_level=1',
|
||||
'buildtype=debugoptimized',
|
||||
|
|
|
@ -5,3 +5,7 @@ option('gtk_doc',
|
|||
option('tests',
|
||||
type: 'boolean', value: true,
|
||||
description: 'Whether to compile unit tests')
|
||||
|
||||
option('wayland',
|
||||
type: 'feature', value: 'enabled',
|
||||
description: 'Whether to support Wayland lockscreen interaction')
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "calls-call-selector-item.h"
|
||||
#include "calls-new-call-box.h"
|
||||
#include "calls-enumerate.h"
|
||||
#include "calls-wayland-config.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
|
@ -38,6 +39,11 @@
|
|||
#define HANDY_USE_UNSTABLE_API
|
||||
#include <handy.h>
|
||||
|
||||
#ifdef CALLS_WAYLAND
|
||||
#include <gdk/gdkwayland.h>
|
||||
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
|
||||
#include "wayland/layersurface.h"
|
||||
#endif // CALLS_WAYLAND
|
||||
|
||||
struct _CallsCallWindow
|
||||
{
|
||||
|
@ -55,6 +61,13 @@ struct _CallsCallWindow
|
|||
GtkButton *show_calls;
|
||||
GtkStack *call_stack;
|
||||
GtkFlowBox *call_selector;
|
||||
|
||||
#ifdef CALLS_WAYLAND
|
||||
gboolean screensaver_active;
|
||||
struct zwlr_layer_shell_v1 *layer_shell_iface;
|
||||
struct wl_output *output;
|
||||
GtkWindow *layer_surface;
|
||||
#endif // CALLS_WAYLAND
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (CallsCallWindow, calls_call_window, GTK_TYPE_APPLICATION_WINDOW);
|
||||
|
@ -68,11 +81,108 @@ enum {
|
|||
static GParamSpec *props[PROP_LAST_PROP];
|
||||
|
||||
|
||||
#ifdef CALLS_WAYLAND
|
||||
static void
|
||||
tear_down_layer_surface (CallsCallWindow *self)
|
||||
{
|
||||
GtkWidget *child;
|
||||
|
||||
if (!self->layer_surface)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
g_debug ("Tearing down layer surface");
|
||||
|
||||
// Remove window content from layer surface
|
||||
child = gtk_bin_get_child (GTK_BIN (self->layer_surface));
|
||||
g_object_ref (child);
|
||||
|
||||
gtk_container_remove (GTK_CONTAINER (self->layer_surface),
|
||||
child);
|
||||
|
||||
// Add to the call window
|
||||
gtk_container_add (GTK_CONTAINER (self), child);
|
||||
g_object_unref (child);
|
||||
|
||||
// Destroy layer surface
|
||||
gtk_widget_destroy (GTK_WIDGET (self->layer_surface));
|
||||
self->layer_surface = NULL;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
set_up_layer_surface (CallsCallWindow *self)
|
||||
{
|
||||
GtkWidget *child;
|
||||
|
||||
if (self->layer_surface
|
||||
|| !self->layer_shell_iface
|
||||
|| !self->output)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
g_debug ("Setting up layer surface");
|
||||
|
||||
// Create layer surface
|
||||
self->layer_surface = g_object_new
|
||||
(PHOSH_TYPE_LAYER_SURFACE,
|
||||
"layer-shell", self->layer_shell_iface,
|
||||
"wl-output", self->output,
|
||||
"layer", ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY,
|
||||
"namespace", "calls",
|
||||
"anchor", ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP
|
||||
| ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM
|
||||
| ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT
|
||||
| ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT,
|
||||
NULL);
|
||||
g_assert (self->layer_surface);
|
||||
|
||||
// Remove window content from call window
|
||||
child = gtk_bin_get_child (GTK_BIN (self));
|
||||
g_object_ref (child);
|
||||
|
||||
gtk_container_remove (GTK_CONTAINER (self), child);
|
||||
|
||||
// Add to the layer surface
|
||||
gtk_container_add (GTK_CONTAINER (self->layer_surface),
|
||||
child);
|
||||
g_object_unref (child);
|
||||
|
||||
// Show the layer surface
|
||||
gtk_window_set_keep_above (self->layer_surface, TRUE);
|
||||
gtk_widget_show (GTK_WIDGET (self->layer_surface));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
update_layer_surface (CallsCallWindow *self,
|
||||
guint calls)
|
||||
{
|
||||
g_debug ("Updating layer surface");
|
||||
|
||||
if (calls == 0)
|
||||
{
|
||||
tear_down_layer_surface (self);
|
||||
}
|
||||
else if (self->screensaver_active)
|
||||
{
|
||||
set_up_layer_surface (self);
|
||||
}
|
||||
}
|
||||
#endif // CALLS_WAYLAND
|
||||
|
||||
|
||||
static void
|
||||
update_visibility (CallsCallWindow *self)
|
||||
{
|
||||
guint calls = g_list_model_get_n_items (G_LIST_MODEL (self->call_holders));
|
||||
|
||||
#ifdef CALLS_WAYLAND
|
||||
update_layer_surface (self, calls);
|
||||
#endif // CALLS_WAYLAND
|
||||
|
||||
gtk_widget_set_visible (GTK_WIDGET (self), calls > 0);
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (self->show_calls), calls > 1);
|
||||
|
||||
|
@ -347,6 +457,7 @@ set_provider (CallsCallWindow *self, CallsProvider *provider)
|
|||
g_object_unref (params);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
set_property (GObject *object,
|
||||
guint property_id,
|
||||
|
@ -368,6 +479,163 @@ set_property (GObject *object,
|
|||
}
|
||||
|
||||
|
||||
#ifdef CALLS_WAYLAND
|
||||
static void
|
||||
get_screensaver_active (CallsCallWindow *self,
|
||||
GtkApplication *app)
|
||||
{
|
||||
g_object_get (app,
|
||||
"screensaver-active", &self->screensaver_active,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
notify_screensaver_active_cb (CallsCallWindow *self,
|
||||
GParamSpec *pspec,
|
||||
GtkApplication *app)
|
||||
{
|
||||
get_screensaver_active (self, app);
|
||||
g_debug ("Screensaver became %sactive",
|
||||
self->screensaver_active ? "" : "in");
|
||||
|
||||
update_visibility (self);
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
set_up_screensaver (CallsCallWindow *self)
|
||||
{
|
||||
GtkApplication *app;
|
||||
gboolean reg;
|
||||
|
||||
app = gtk_window_get_application (GTK_WINDOW (self));
|
||||
g_assert (app != NULL);
|
||||
|
||||
g_object_get (app,
|
||||
"register-session", ®,
|
||||
NULL);
|
||||
if (!reg)
|
||||
{
|
||||
g_warning ("Cannot monitor screensaver state because"
|
||||
" Application is not set to register with session");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_signal_connect_swapped (app,
|
||||
"notify::screensaver-active",
|
||||
G_CALLBACK (notify_screensaver_active_cb),
|
||||
self);
|
||||
|
||||
get_screensaver_active (self, app);
|
||||
g_debug ("Screensaver is %sactive at startup",
|
||||
self->screensaver_active ? "" : "in");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
registry_global_cb (void *data,
|
||||
struct wl_registry *registry,
|
||||
uint32_t name,
|
||||
const char *interface,
|
||||
uint32_t version)
|
||||
{
|
||||
CallsCallWindow *self = CALLS_CALL_WINDOW (data);
|
||||
|
||||
if (strcmp (interface, zwlr_layer_shell_v1_interface.name) == 0)
|
||||
{
|
||||
self->layer_shell_iface = wl_registry_bind
|
||||
(registry, name, &zwlr_layer_shell_v1_interface, version);
|
||||
}
|
||||
else if (strcmp (interface, "wl_output") == 0)
|
||||
{
|
||||
// FIXME: Deal with more than one output
|
||||
if (!self->output)
|
||||
{
|
||||
self->output = wl_registry_bind
|
||||
(registry, name, &wl_output_interface, version);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const struct wl_registry_listener registry_listener =
|
||||
{
|
||||
registry_global_cb,
|
||||
// FIXME: Add a remove callback
|
||||
};
|
||||
|
||||
|
||||
static void
|
||||
set_up_wayland (CallsCallWindow *self)
|
||||
{
|
||||
GdkDisplay *gdk_display;
|
||||
struct wl_display *display;
|
||||
struct wl_registry *registry;
|
||||
|
||||
gdk_display = gdk_display_get_default ();
|
||||
g_assert (gdk_display != NULL);
|
||||
|
||||
if (!GDK_IS_WAYLAND_DISPLAY (gdk_display))
|
||||
{
|
||||
g_debug ("GDK display is not a Wayland display");
|
||||
return;
|
||||
}
|
||||
|
||||
display = gdk_wayland_display_get_wl_display (gdk_display);
|
||||
g_assert (display != NULL);
|
||||
|
||||
registry = wl_display_get_registry (display);
|
||||
g_assert (registry != NULL);
|
||||
|
||||
wl_registry_add_listener (registry, ®istry_listener, self);
|
||||
wl_display_roundtrip (display);
|
||||
|
||||
|
||||
if (!self->layer_shell_iface)
|
||||
{
|
||||
g_warning ("Wayland display has no layer shell interface");
|
||||
}
|
||||
if (!self->output)
|
||||
{
|
||||
g_warning ("Wayland display has no output");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
application_cb (CallsCallWindow *self)
|
||||
{
|
||||
gboolean ok;
|
||||
|
||||
ok = set_up_screensaver (self);
|
||||
|
||||
if (ok)
|
||||
{
|
||||
set_up_wayland (self);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
notify (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
CallsCallWindow *self = CALLS_CALL_WINDOW (object);
|
||||
const gchar *name;
|
||||
|
||||
name = g_param_spec_get_name (pspec);
|
||||
if (strcmp (name, "application") == 0)
|
||||
{
|
||||
application_cb (self);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
#endif // CALLS_WAYLAND
|
||||
|
||||
|
||||
static void
|
||||
constructed (GObject *object)
|
||||
{
|
||||
|
@ -379,6 +647,8 @@ constructed (GObject *object)
|
|||
(GtkFlowBoxCreateWidgetFunc) call_holders_create_widget_cb,
|
||||
NULL, NULL);
|
||||
|
||||
update_visibility (self);
|
||||
|
||||
parent_class->constructed (object);
|
||||
}
|
||||
|
||||
|
@ -389,8 +659,6 @@ calls_call_window_init (CallsCallWindow *self)
|
|||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
|
||||
self->call_holders = g_list_store_new (CALLS_TYPE_CALL_HOLDER);
|
||||
|
||||
update_visibility (self);
|
||||
}
|
||||
|
||||
|
||||
|
@ -422,6 +690,12 @@ calls_call_window_class_init (CallsCallWindowClass *klass)
|
|||
object_class->constructed = constructed;
|
||||
object_class->dispose = dispose;
|
||||
|
||||
#ifdef CALLS_WAYLAND
|
||||
// The "application" property is not a construction property so we
|
||||
// have to wait for it to be set before setting up wayland & co.
|
||||
object_class->notify = notify;
|
||||
#endif // CALLS_WAYLAND
|
||||
|
||||
props[PROP_PROVIDER] =
|
||||
g_param_spec_object ("provider",
|
||||
_("Provider"),
|
||||
|
|
37
src/calls-wayland-config.h
Normal file
37
src/calls-wayland-config.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Purism SPC
|
||||
*
|
||||
* This file is part of Calls.
|
||||
*
|
||||
* Calls is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Calls 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
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Calls. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author: Bob Ham <bob.ham@puri.sm>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CALLS__WAYLAND_CONFIG_H__
|
||||
#define CALLS__WAYLAND_CONFIG_H__
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if WL_SCANNER_FOUND
|
||||
#include <gdk/gdk.h>
|
||||
#ifdef GDK_WINDOWING_WAYLAND
|
||||
#define CALLS_WAYLAND
|
||||
#endif // GDK_WINDOWING_WAYLAND
|
||||
#endif // WL_SCANNER_FOUND
|
||||
|
||||
#endif /* CALLS__WAYLAND_CONFIG_H__ */
|
|
@ -21,9 +21,12 @@
|
|||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
|
||||
subdir('wayland')
|
||||
|
||||
gnome = import('gnome')
|
||||
|
||||
src_include = include_directories('.')
|
||||
calls_includes = [ top_include, src_include ]
|
||||
|
||||
calls_deps = [ dependency('gobject-2.0'),
|
||||
dependency('gtk+-3.0'),
|
||||
|
@ -34,6 +37,11 @@ calls_deps = [ dependency('gobject-2.0'),
|
|||
dependency('libebook-contacts-1.2'),
|
||||
]
|
||||
|
||||
if wl_scanner.found()
|
||||
calls_includes += include_directories('wayland')
|
||||
calls_deps += dependency('wayland-client', version: '>=1.14')
|
||||
endif
|
||||
|
||||
calls_sources = files(['calls-message-source.c', 'calls-message-source.h',
|
||||
'calls-call.c',
|
||||
'calls-origin.c', 'calls-origin.h',
|
||||
|
@ -60,6 +68,7 @@ calls_sources = files(['calls-message-source.c', 'calls-message-source.h',
|
|||
|
||||
calls_config_data = config_data
|
||||
calls_config_data.set_quoted('VCS_TAG', '@VCS_TAG@')
|
||||
calls_config_data.set10('WL_SCANNER_FOUND', wl_scanner.found())
|
||||
|
||||
config_h_in = configure_file(
|
||||
output: 'config.h.in',
|
||||
|
@ -84,8 +93,9 @@ calls_resources = gnome.compile_resources(
|
|||
)
|
||||
|
||||
executable('calls',
|
||||
calls_sources, calls_enum_sources, calls_resources, 'main.c',
|
||||
calls_sources, calls_enum_sources, calls_resources,
|
||||
wl_proto_sources, wayland_sources, 'main.c',
|
||||
dependencies : calls_deps,
|
||||
export_dynamic : true,
|
||||
include_directories : include_directories('..'),
|
||||
include_directories : calls_includes,
|
||||
install : true)
|
||||
|
|
440
src/wayland/layersurface.c
Normal file
440
src/wayland/layersurface.c
Normal file
|
@ -0,0 +1,440 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Purism SPC
|
||||
* SPDX-License-Identifier: GPL-3.0+
|
||||
* Author: Guido Günther <agx@sigxcpu.org>
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
||||
WARNING: this file is taken directly from phosh, with no modificaions apart from this message. Please update phosh instead of changing this file. Please copy the file back here afterwards, with the same notice.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#define G_LOG_DOMAIN "phosh-layer-surface"
|
||||
|
||||
#include "config.h"
|
||||
#include "layersurface.h"
|
||||
|
||||
#include <gdk/gdkwayland.h>
|
||||
|
||||
enum {
|
||||
PHOSH_LAYER_SURFACE_PROP_0,
|
||||
PHOSH_LAYER_SURFACE_PROP_LAYER_SHELL,
|
||||
PHOSH_LAYER_SURFACE_PROP_WL_OUTPUT,
|
||||
PHOSH_LAYER_SURFACE_PROP_ANCHOR,
|
||||
PHOSH_LAYER_SURFACE_PROP_LAYER,
|
||||
PHOSH_LAYER_SURFACE_PROP_KBD_INTERACTIVITY,
|
||||
PHOSH_LAYER_SURFACE_PROP_EXCLUSIVE_ZONE,
|
||||
PHOSH_LAYER_SURFACE_PROP_LAYER_WIDTH,
|
||||
PHOSH_LAYER_SURFACE_PROP_LAYER_HEIGHT,
|
||||
PHOSH_LAYER_SURFACE_PROP_NAMESPACE,
|
||||
PHOSH_LAYER_SURFACE_PROP_LAST_PROP
|
||||
};
|
||||
static GParamSpec *props[PHOSH_LAYER_SURFACE_PROP_LAST_PROP];
|
||||
|
||||
enum {
|
||||
CONFIGURED,
|
||||
N_SIGNALS
|
||||
};
|
||||
static guint signals [N_SIGNALS];
|
||||
|
||||
|
||||
typedef struct {
|
||||
struct wl_surface *wl_surface;
|
||||
struct zwlr_layer_surface_v1 *layer_surface;
|
||||
|
||||
/* Properties */
|
||||
guint anchor;
|
||||
guint layer;
|
||||
gboolean kbd_interactivity;
|
||||
gint exclusive_zone;
|
||||
gint width, height;
|
||||
gchar *namespace;
|
||||
struct zwlr_layer_shell_v1 *layer_shell;
|
||||
struct wl_output *wl_output;
|
||||
} PhoshLayerSurfacePrivate;
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (PhoshLayerSurface, phosh_layer_surface, GTK_TYPE_WINDOW)
|
||||
|
||||
static void layer_surface_configure(void *data,
|
||||
struct zwlr_layer_surface_v1 *surface,
|
||||
uint32_t serial,
|
||||
uint32_t width,
|
||||
uint32_t height)
|
||||
{
|
||||
PhoshLayerSurface *self = data;
|
||||
|
||||
gtk_window_resize (GTK_WINDOW (self), width, height);
|
||||
zwlr_layer_surface_v1_ack_configure(surface, serial);
|
||||
|
||||
g_signal_emit (self, signals[CONFIGURED], 0);
|
||||
}
|
||||
|
||||
|
||||
static void layer_surface_closed (void *data,
|
||||
struct zwlr_layer_surface_v1 *surface)
|
||||
{
|
||||
PhoshLayerSurface *self = data;
|
||||
PhoshLayerSurfacePrivate *priv = phosh_layer_surface_get_instance_private (self);
|
||||
|
||||
g_return_if_fail (priv->layer_surface == surface);
|
||||
zwlr_layer_surface_v1_destroy(priv->layer_surface);
|
||||
priv->layer_surface = NULL;
|
||||
gtk_widget_destroy (GTK_WIDGET (self));
|
||||
}
|
||||
|
||||
static struct zwlr_layer_surface_v1_listener layer_surface_listener = {
|
||||
.configure = layer_surface_configure,
|
||||
.closed = layer_surface_closed,
|
||||
};
|
||||
|
||||
static void
|
||||
phosh_layer_surface_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
PhoshLayerSurface *self = PHOSH_LAYER_SURFACE (object);
|
||||
PhoshLayerSurfacePrivate *priv = phosh_layer_surface_get_instance_private (self);
|
||||
|
||||
switch (property_id) {
|
||||
case PHOSH_LAYER_SURFACE_PROP_LAYER_SHELL:
|
||||
priv->layer_shell = g_value_get_pointer (value);
|
||||
break;
|
||||
case PHOSH_LAYER_SURFACE_PROP_WL_OUTPUT:
|
||||
priv->wl_output = g_value_get_pointer (value);
|
||||
break;
|
||||
case PHOSH_LAYER_SURFACE_PROP_ANCHOR:
|
||||
priv->anchor = g_value_get_uint (value);
|
||||
break;
|
||||
case PHOSH_LAYER_SURFACE_PROP_LAYER:
|
||||
priv->layer = g_value_get_uint (value);
|
||||
break;
|
||||
case PHOSH_LAYER_SURFACE_PROP_KBD_INTERACTIVITY:
|
||||
priv->kbd_interactivity = g_value_get_boolean (value);
|
||||
break;
|
||||
case PHOSH_LAYER_SURFACE_PROP_EXCLUSIVE_ZONE:
|
||||
priv->exclusive_zone = g_value_get_int (value);
|
||||
break;
|
||||
case PHOSH_LAYER_SURFACE_PROP_LAYER_WIDTH:
|
||||
priv->width = g_value_get_uint (value);
|
||||
break;
|
||||
case PHOSH_LAYER_SURFACE_PROP_LAYER_HEIGHT:
|
||||
priv->height = g_value_get_uint (value);
|
||||
break;
|
||||
case PHOSH_LAYER_SURFACE_PROP_NAMESPACE:
|
||||
g_free (priv->namespace);
|
||||
priv->namespace = g_value_dup_string (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
phosh_layer_surface_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
PhoshLayerSurface *self = PHOSH_LAYER_SURFACE (object);
|
||||
PhoshLayerSurfacePrivate *priv = phosh_layer_surface_get_instance_private (self);
|
||||
|
||||
switch (property_id) {
|
||||
case PHOSH_LAYER_SURFACE_PROP_LAYER_SHELL:
|
||||
g_value_set_pointer (value, priv->layer_shell);
|
||||
break;
|
||||
case PHOSH_LAYER_SURFACE_PROP_WL_OUTPUT:
|
||||
g_value_set_pointer (value, priv->wl_output);
|
||||
break;
|
||||
case PHOSH_LAYER_SURFACE_PROP_ANCHOR:
|
||||
g_value_set_uint (value, priv->anchor);
|
||||
break;
|
||||
case PHOSH_LAYER_SURFACE_PROP_LAYER:
|
||||
g_value_set_uint (value, priv->layer);
|
||||
break;
|
||||
case PHOSH_LAYER_SURFACE_PROP_KBD_INTERACTIVITY:
|
||||
g_value_set_boolean (value, priv->kbd_interactivity);
|
||||
break;
|
||||
case PHOSH_LAYER_SURFACE_PROP_EXCLUSIVE_ZONE:
|
||||
g_value_set_boolean (value, priv->exclusive_zone);
|
||||
break;
|
||||
case PHOSH_LAYER_SURFACE_PROP_LAYER_WIDTH:
|
||||
g_value_set_uint (value, priv->width);
|
||||
break;
|
||||
case PHOSH_LAYER_SURFACE_PROP_LAYER_HEIGHT:
|
||||
g_value_set_uint (value, priv->height);
|
||||
break;
|
||||
case PHOSH_LAYER_SURFACE_PROP_NAMESPACE:
|
||||
g_value_set_string (value, priv->namespace);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
on_phosh_layer_surface_realized (PhoshLayerSurface *self, gpointer unused)
|
||||
{
|
||||
PhoshLayerSurfacePrivate *priv;
|
||||
GdkWindow *gdk_window;
|
||||
|
||||
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
||||
|
||||
priv = phosh_layer_surface_get_instance_private (self);
|
||||
|
||||
gdk_window = gtk_widget_get_window (GTK_WIDGET (self));
|
||||
gdk_wayland_window_set_use_custom_surface (gdk_window);
|
||||
priv->wl_surface = gdk_wayland_window_get_wl_surface (gdk_window);
|
||||
|
||||
gtk_window_set_decorated (GTK_WINDOW (self), FALSE);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
on_phosh_layer_surface_mapped (PhoshLayerSurface *self, gpointer unused)
|
||||
{
|
||||
PhoshLayerSurfacePrivate *priv;
|
||||
GdkWindow *gdk_window;
|
||||
|
||||
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
||||
priv = phosh_layer_surface_get_instance_private (self);
|
||||
|
||||
if (!priv->wl_surface) {
|
||||
gdk_window = gtk_widget_get_window (GTK_WIDGET (self));
|
||||
gdk_wayland_window_set_use_custom_surface (gdk_window);
|
||||
priv->wl_surface = gdk_wayland_window_get_wl_surface (gdk_window);
|
||||
}
|
||||
g_debug ("Mapped %p", priv->wl_surface);
|
||||
|
||||
priv->layer_surface = zwlr_layer_shell_v1_get_layer_surface(priv->layer_shell,
|
||||
priv->wl_surface,
|
||||
priv->wl_output,
|
||||
priv->layer,
|
||||
priv->namespace);
|
||||
zwlr_layer_surface_v1_set_exclusive_zone(priv->layer_surface, priv->exclusive_zone);
|
||||
zwlr_layer_surface_v1_set_size(priv->layer_surface, priv->width, priv->height);
|
||||
zwlr_layer_surface_v1_set_anchor(priv->layer_surface, priv->anchor);
|
||||
zwlr_layer_surface_v1_set_keyboard_interactivity(priv->layer_surface, priv->kbd_interactivity);
|
||||
zwlr_layer_surface_v1_add_listener(priv->layer_surface,
|
||||
&layer_surface_listener,
|
||||
self);
|
||||
wl_surface_commit(priv->wl_surface);
|
||||
|
||||
/* Process all pending events, otherwise we end up sending ack configure
|
||||
* to a not yet configured surface */
|
||||
wl_display_roundtrip (gdk_wayland_display_get_wl_display (gdk_display_get_default ()));
|
||||
}
|
||||
|
||||
static void
|
||||
on_phosh_layer_surface_unmapped (PhoshLayerSurface *self, gpointer unused)
|
||||
{
|
||||
PhoshLayerSurfacePrivate *priv;
|
||||
|
||||
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
|
||||
priv = phosh_layer_surface_get_instance_private (self);
|
||||
|
||||
priv = phosh_layer_surface_get_instance_private (self);
|
||||
if (priv->layer_surface) {
|
||||
zwlr_layer_surface_v1_destroy(priv->layer_surface);
|
||||
priv->layer_surface = NULL;
|
||||
}
|
||||
priv->wl_surface = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
phosh_layer_surface_constructed (GObject *object)
|
||||
{
|
||||
PhoshLayerSurface *self = PHOSH_LAYER_SURFACE (object);
|
||||
|
||||
g_signal_connect (self, "realize",
|
||||
G_CALLBACK (on_phosh_layer_surface_realized),
|
||||
NULL);
|
||||
g_signal_connect (self, "map",
|
||||
G_CALLBACK (on_phosh_layer_surface_mapped),
|
||||
NULL);
|
||||
g_signal_connect (self, "unmap",
|
||||
G_CALLBACK (on_phosh_layer_surface_unmapped),
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
phosh_layer_surface_dispose (GObject *object)
|
||||
{
|
||||
PhoshLayerSurface *self = PHOSH_LAYER_SURFACE (object);
|
||||
PhoshLayerSurfacePrivate *priv = phosh_layer_surface_get_instance_private (self);
|
||||
|
||||
if (priv->layer_surface) {
|
||||
zwlr_layer_surface_v1_destroy(priv->layer_surface);
|
||||
priv->layer_surface = NULL;
|
||||
}
|
||||
g_clear_pointer (&priv->namespace, g_free);
|
||||
|
||||
G_OBJECT_CLASS (phosh_layer_surface_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
phosh_layer_surface_class_init (PhoshLayerSurfaceClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = (GObjectClass *)klass;
|
||||
|
||||
object_class->constructed = phosh_layer_surface_constructed;
|
||||
object_class->dispose = phosh_layer_surface_dispose;
|
||||
|
||||
object_class->set_property = phosh_layer_surface_set_property;
|
||||
object_class->get_property = phosh_layer_surface_get_property;
|
||||
|
||||
props[PHOSH_LAYER_SURFACE_PROP_LAYER_SHELL] =
|
||||
g_param_spec_pointer (
|
||||
"layer-shell",
|
||||
"Wayland Layer Shell Global",
|
||||
"The layer shell wayland global",
|
||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
props[PHOSH_LAYER_SURFACE_PROP_WL_OUTPUT] =
|
||||
g_param_spec_pointer (
|
||||
"wl-output",
|
||||
"Wayland Output",
|
||||
"The wl_output associated with this surface",
|
||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
props[PHOSH_LAYER_SURFACE_PROP_ANCHOR] =
|
||||
g_param_spec_uint (
|
||||
"anchor",
|
||||
"Anchor edges",
|
||||
"The edges to anchor the surface to",
|
||||
0,
|
||||
G_MAXUINT,
|
||||
0,
|
||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
props[PHOSH_LAYER_SURFACE_PROP_LAYER] =
|
||||
g_param_spec_uint (
|
||||
"layer",
|
||||
"Layer",
|
||||
"The layer the surface should be attached to",
|
||||
0,
|
||||
G_MAXUINT,
|
||||
0,
|
||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
props[PHOSH_LAYER_SURFACE_PROP_KBD_INTERACTIVITY] =
|
||||
g_param_spec_boolean (
|
||||
"kbd-interactivity",
|
||||
"Keyboard interactivity",
|
||||
"Whether the surface interacts with the keyboard",
|
||||
FALSE,
|
||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
props[PHOSH_LAYER_SURFACE_PROP_EXCLUSIVE_ZONE] =
|
||||
g_param_spec_int (
|
||||
"exclusive-zone",
|
||||
"Exclusive Zone",
|
||||
"Set area that is not occluded with other surfaces",
|
||||
-1,
|
||||
G_MAXINT,
|
||||
0,
|
||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
props[PHOSH_LAYER_SURFACE_PROP_LAYER_WIDTH] =
|
||||
g_param_spec_uint (
|
||||
"width",
|
||||
"Width",
|
||||
"The width of the layer surface",
|
||||
0,
|
||||
G_MAXUINT,
|
||||
0,
|
||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
props[PHOSH_LAYER_SURFACE_PROP_LAYER_HEIGHT] =
|
||||
g_param_spec_uint (
|
||||
"height",
|
||||
"Height",
|
||||
"The height of the layer surface",
|
||||
0,
|
||||
G_MAXUINT,
|
||||
0,
|
||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
props[PHOSH_LAYER_SURFACE_PROP_NAMESPACE] =
|
||||
g_param_spec_string (
|
||||
"namespace",
|
||||
"Namespace",
|
||||
"Namespace of the layer surface",
|
||||
"",
|
||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, PHOSH_LAYER_SURFACE_PROP_LAST_PROP, props);
|
||||
|
||||
/**
|
||||
* PhoshLayersurface::configured
|
||||
* @self: The #PhoshLayersurface instance.
|
||||
*
|
||||
* This signal is emitted once we received the configure event from the
|
||||
* compositor.
|
||||
*/
|
||||
signals[CONFIGURED] =
|
||||
g_signal_new ("configured",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (PhoshLayerSurfaceClass, configured),
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
phosh_layer_surface_init (PhoshLayerSurface *self)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
GtkWidget *
|
||||
phosh_layer_surface_new (gpointer layer_shell,
|
||||
gpointer wl_output)
|
||||
{
|
||||
return g_object_new (PHOSH_TYPE_LAYER_SURFACE,
|
||||
"layer-shell", layer_shell,
|
||||
"wl-output", wl_output);
|
||||
}
|
||||
|
||||
/**
|
||||
* phosh_layer_surface_get_surface:
|
||||
*
|
||||
* Get the layer layer surface or #NULL if the window
|
||||
* is not yet realized.
|
||||
*/
|
||||
struct zwlr_layer_surface_v1 *
|
||||
phosh_layer_surface_get_layer_surface(PhoshLayerSurface *self)
|
||||
{
|
||||
PhoshLayerSurfacePrivate *priv;
|
||||
|
||||
g_return_val_if_fail (PHOSH_IS_LAYER_SURFACE (self), NULL);
|
||||
priv = phosh_layer_surface_get_instance_private (self);
|
||||
return priv->layer_surface;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* phosh_layer_surface_get_wl_surface:
|
||||
*
|
||||
* Get the layer wayland surface or #NULL if the window
|
||||
* is not yet realized.
|
||||
*/
|
||||
struct wl_surface *
|
||||
phosh_layer_surface_get_wl_surface(PhoshLayerSurface *self)
|
||||
{
|
||||
PhoshLayerSurfacePrivate *priv;
|
||||
|
||||
g_return_val_if_fail (PHOSH_IS_LAYER_SURFACE (self), NULL);
|
||||
priv = phosh_layer_surface_get_instance_private (self);
|
||||
return priv->wl_surface;
|
||||
}
|
41
src/wayland/layersurface.h
Normal file
41
src/wayland/layersurface.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Purism SPC
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0+
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
||||
WARNING: this file is taken directly from phosh, with no modificaions apart from this message. Please update phosh instead of changing this file. Please copy the file back here afterwards, with the same notice.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
/* TODO: We use the enum constants from here, use glib-mkenums */
|
||||
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
|
||||
|
||||
#define PHOSH_TYPE_LAYER_SURFACE (phosh_layer_surface_get_type ())
|
||||
|
||||
G_DECLARE_DERIVABLE_TYPE (PhoshLayerSurface, phosh_layer_surface, PHOSH, LAYER_SURFACE, GtkWindow)
|
||||
|
||||
/**
|
||||
* PhoshLayerSurfaceClass
|
||||
* @parent_class: The parent class
|
||||
*/
|
||||
struct _PhoshLayerSurfaceClass
|
||||
{
|
||||
GtkWindowClass parent_class;
|
||||
|
||||
/* Signals
|
||||
*/
|
||||
void (*configured) (PhoshLayerSurface *self);
|
||||
};
|
||||
|
||||
GtkWidget *phosh_layer_surface_new (gpointer layer_shell,
|
||||
gpointer wl_output);
|
||||
struct zwlr_layer_surface_v1 *phosh_layer_surface_get_layer_surface(PhoshLayerSurface *self);
|
||||
struct wl_surface *phosh_layer_surface_get_wl_surface(PhoshLayerSurface *self);
|
32
src/wayland/meson.build
Normal file
32
src/wayland/meson.build
Normal file
|
@ -0,0 +1,32 @@
|
|||
# Copied from squeekboard and modified for Calls by Bob Ham
|
||||
|
||||
wl_scanner = find_program('wayland-scanner',
|
||||
required: get_option('wayland'))
|
||||
|
||||
wl_proto_sources = []
|
||||
wayland_source_files = []
|
||||
|
||||
if wl_scanner.found()
|
||||
wayland_protos = dependency('wayland-protocols', version: '>=1.12')
|
||||
wl_protocol_dir = wayland_protos.get_pkgconfig_variable('pkgdatadir')
|
||||
|
||||
gen_scanner_client_header = generator(wl_scanner,
|
||||
output: '@BASENAME@-client-protocol.h',
|
||||
arguments: ['client-header', '@INPUT@', '@OUTPUT@'])
|
||||
gen_scanner_client_code = generator(wl_scanner,
|
||||
output: '@BASENAME@-protocol.c',
|
||||
arguments: ['private-code', '@INPUT@', '@OUTPUT@'])
|
||||
|
||||
wl_protos = [
|
||||
wl_protocol_dir + '/stable/xdg-shell/xdg-shell.xml',
|
||||
'wlr-layer-shell-unstable-v1.xml',
|
||||
]
|
||||
foreach proto: wl_protos
|
||||
wl_proto_sources += gen_scanner_client_header.process(proto)
|
||||
wl_proto_sources += gen_scanner_client_code.process(proto)
|
||||
endforeach
|
||||
|
||||
wayland_source_files += ['layersurface.c', 'layersurface.h']
|
||||
endif
|
||||
|
||||
wayland_sources = files(wayland_source_files)
|
285
src/wayland/wlr-layer-shell-unstable-v1.xml
Normal file
285
src/wayland/wlr-layer-shell-unstable-v1.xml
Normal file
|
@ -0,0 +1,285 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<protocol name="wlr_layer_shell_unstable_v1">
|
||||
<copyright>
|
||||
Copyright © 2017 Drew DeVault
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that copyright notice and this permission
|
||||
notice appear in supporting documentation, and that the name of
|
||||
the copyright holders not be used in advertising or publicity
|
||||
pertaining to distribution of the software without specific,
|
||||
written prior permission. The copyright holders make no
|
||||
representations about the suitability of this software for any
|
||||
purpose. It is provided "as is" without express or implied
|
||||
warranty.
|
||||
|
||||
THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
||||
AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
THIS SOFTWARE.
|
||||
</copyright>
|
||||
|
||||
<interface name="zwlr_layer_shell_v1" version="1">
|
||||
<description summary="create surfaces that are layers of the desktop">
|
||||
Clients can use this interface to assign the surface_layer role to
|
||||
wl_surfaces. Such surfaces are assigned to a "layer" of the output and
|
||||
rendered with a defined z-depth respective to each other. They may also be
|
||||
anchored to the edges and corners of a screen and specify input handling
|
||||
semantics. This interface should be suitable for the implementation of
|
||||
many desktop shell components, and a broad number of other applications
|
||||
that interact with the desktop.
|
||||
</description>
|
||||
|
||||
<request name="get_layer_surface">
|
||||
<description summary="create a layer_surface from a surface">
|
||||
Create a layer surface for an existing surface. This assigns the role of
|
||||
layer_surface, or raises a protocol error if another role is already
|
||||
assigned.
|
||||
|
||||
Creating a layer surface from a wl_surface which has a buffer attached
|
||||
or committed is a client error, and any attempts by a client to attach
|
||||
or manipulate a buffer prior to the first layer_surface.configure call
|
||||
must also be treated as errors.
|
||||
|
||||
You may pass NULL for output to allow the compositor to decide which
|
||||
output to use. Generally this will be the one that the user most
|
||||
recently interacted with.
|
||||
|
||||
Clients can specify a namespace that defines the purpose of the layer
|
||||
surface.
|
||||
</description>
|
||||
<arg name="id" type="new_id" interface="zwlr_layer_surface_v1"/>
|
||||
<arg name="surface" type="object" interface="wl_surface"/>
|
||||
<arg name="output" type="object" interface="wl_output" allow-null="true"/>
|
||||
<arg name="layer" type="uint" enum="layer" summary="layer to add this surface to"/>
|
||||
<arg name="namespace" type="string" summary="namespace for the layer surface"/>
|
||||
</request>
|
||||
|
||||
<enum name="error">
|
||||
<entry name="role" value="0" summary="wl_surface has another role"/>
|
||||
<entry name="invalid_layer" value="1" summary="layer value is invalid"/>
|
||||
<entry name="already_constructed" value="2" summary="wl_surface has a buffer attached or committed"/>
|
||||
</enum>
|
||||
|
||||
<enum name="layer">
|
||||
<description summary="available layers for surfaces">
|
||||
These values indicate which layers a surface can be rendered in. They
|
||||
are ordered by z depth, bottom-most first. Traditional shell surfaces
|
||||
will typically be rendered between the bottom and top layers.
|
||||
Fullscreen shell surfaces are typically rendered at the top layer.
|
||||
Multiple surfaces can share a single layer, and ordering within a
|
||||
single layer is undefined.
|
||||
</description>
|
||||
|
||||
<entry name="background" value="0"/>
|
||||
<entry name="bottom" value="1"/>
|
||||
<entry name="top" value="2"/>
|
||||
<entry name="overlay" value="3"/>
|
||||
</enum>
|
||||
</interface>
|
||||
|
||||
<interface name="zwlr_layer_surface_v1" version="1">
|
||||
<description summary="layer metadata interface">
|
||||
An interface that may be implemented by a wl_surface, for surfaces that
|
||||
are designed to be rendered as a layer of a stacked desktop-like
|
||||
environment.
|
||||
|
||||
Layer surface state (size, anchor, exclusive zone, margin, interactivity)
|
||||
is double-buffered, and will be applied at the time wl_surface.commit of
|
||||
the corresponding wl_surface is called.
|
||||
</description>
|
||||
|
||||
<request name="set_size">
|
||||
<description summary="sets the size of the surface">
|
||||
Sets the size of the surface in surface-local coordinates. The
|
||||
compositor will display the surface centered with respect to its
|
||||
anchors.
|
||||
|
||||
If you pass 0 for either value, the compositor will assign it and
|
||||
inform you of the assignment in the configure event. You must set your
|
||||
anchor to opposite edges in the dimensions you omit; not doing so is a
|
||||
protocol error. Both values are 0 by default.
|
||||
|
||||
Size is double-buffered, see wl_surface.commit.
|
||||
</description>
|
||||
<arg name="width" type="uint"/>
|
||||
<arg name="height" type="uint"/>
|
||||
</request>
|
||||
|
||||
<request name="set_anchor">
|
||||
<description summary="configures the anchor point of the surface">
|
||||
Requests that the compositor anchor the surface to the specified edges
|
||||
and corners. If two orthogonal edges are specified (e.g. 'top' and
|
||||
'left'), then the anchor point will be the intersection of the edges
|
||||
(e.g. the top left corner of the output); otherwise the anchor point
|
||||
will be centered on that edge, or in the center if none is specified.
|
||||
|
||||
Anchor is double-buffered, see wl_surface.commit.
|
||||
</description>
|
||||
<arg name="anchor" type="uint" enum="anchor"/>
|
||||
</request>
|
||||
|
||||
<request name="set_exclusive_zone">
|
||||
<description summary="configures the exclusive geometry of this surface">
|
||||
Requests that the compositor avoids occluding an area of the surface
|
||||
with other surfaces. The compositor's use of this information is
|
||||
implementation-dependent - do not assume that this region will not
|
||||
actually be occluded.
|
||||
|
||||
A positive value is only meaningful if the surface is anchored to an
|
||||
edge, rather than a corner. The zone is the number of surface-local
|
||||
coordinates from the edge that is considered exclusive.
|
||||
|
||||
Surfaces that do not wish to have an exclusive zone may instead specify
|
||||
how they should interact with surfaces that do. If set to zero, the
|
||||
surface indicates that it would like to be moved to avoid occluding
|
||||
surfaces with a positive exclusive zone. If set to -1, the surface
|
||||
indicates that it would not like to be moved to accommodate for other
|
||||
surfaces, and the compositor should extend it all the way to the edges
|
||||
it is anchored to.
|
||||
|
||||
For example, a panel might set its exclusive zone to 10, so that
|
||||
maximized shell surfaces are not shown on top of it. A notification
|
||||
might set its exclusive zone to 0, so that it is moved to avoid
|
||||
occluding the panel, but shell surfaces are shown underneath it. A
|
||||
wallpaper or lock screen might set their exclusive zone to -1, so that
|
||||
they stretch below or over the panel.
|
||||
|
||||
The default value is 0.
|
||||
|
||||
Exclusive zone is double-buffered, see wl_surface.commit.
|
||||
</description>
|
||||
<arg name="zone" type="int"/>
|
||||
</request>
|
||||
|
||||
<request name="set_margin">
|
||||
<description summary="sets a margin from the anchor point">
|
||||
Requests that the surface be placed some distance away from the anchor
|
||||
point on the output, in surface-local coordinates. Setting this value
|
||||
for edges you are not anchored to has no effect.
|
||||
|
||||
The exclusive zone includes the margin.
|
||||
|
||||
Margin is double-buffered, see wl_surface.commit.
|
||||
</description>
|
||||
<arg name="top" type="int"/>
|
||||
<arg name="right" type="int"/>
|
||||
<arg name="bottom" type="int"/>
|
||||
<arg name="left" type="int"/>
|
||||
</request>
|
||||
|
||||
<request name="set_keyboard_interactivity">
|
||||
<description summary="requests keyboard events">
|
||||
Set to 1 to request that the seat send keyboard events to this layer
|
||||
surface. For layers below the shell surface layer, the seat will use
|
||||
normal focus semantics. For layers above the shell surface layers, the
|
||||
seat will always give exclusive keyboard focus to the top-most layer
|
||||
which has keyboard interactivity set to true.
|
||||
|
||||
Layer surfaces receive pointer, touch, and tablet events normally. If
|
||||
you do not want to receive them, set the input region on your surface
|
||||
to an empty region.
|
||||
|
||||
Events is double-buffered, see wl_surface.commit.
|
||||
</description>
|
||||
<arg name="keyboard_interactivity" type="uint"/>
|
||||
</request>
|
||||
|
||||
<request name="get_popup">
|
||||
<description summary="assign this layer_surface as an xdg_popup parent">
|
||||
This assigns an xdg_popup's parent to this layer_surface. This popup
|
||||
should have been created via xdg_surface::get_popup with the parent set
|
||||
to NULL, and this request must be invoked before committing the popup's
|
||||
initial state.
|
||||
|
||||
See the documentation of xdg_popup for more details about what an
|
||||
xdg_popup is and how it is used.
|
||||
</description>
|
||||
<arg name="popup" type="object" interface="xdg_popup"/>
|
||||
</request>
|
||||
|
||||
<request name="ack_configure">
|
||||
<description summary="ack a configure event">
|
||||
When a configure event is received, if a client commits the
|
||||
surface in response to the configure event, then the client
|
||||
must make an ack_configure request sometime before the commit
|
||||
request, passing along the serial of the configure event.
|
||||
|
||||
If the client receives multiple configure events before it
|
||||
can respond to one, it only has to ack the last configure event.
|
||||
|
||||
A client is not required to commit immediately after sending
|
||||
an ack_configure request - it may even ack_configure several times
|
||||
before its next surface commit.
|
||||
|
||||
A client may send multiple ack_configure requests before committing, but
|
||||
only the last request sent before a commit indicates which configure
|
||||
event the client really is responding to.
|
||||
</description>
|
||||
<arg name="serial" type="uint" summary="the serial from the configure event"/>
|
||||
</request>
|
||||
|
||||
<request name="destroy" type="destructor">
|
||||
<description summary="destroy the layer_surface">
|
||||
This request destroys the layer surface.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<event name="configure">
|
||||
<description summary="suggest a surface change">
|
||||
The configure event asks the client to resize its surface.
|
||||
|
||||
Clients should arrange their surface for the new states, and then send
|
||||
an ack_configure request with the serial sent in this configure event at
|
||||
some point before committing the new surface.
|
||||
|
||||
The client is free to dismiss all but the last configure event it
|
||||
received.
|
||||
|
||||
The width and height arguments specify the size of the window in
|
||||
surface-local coordinates.
|
||||
|
||||
The size is a hint, in the sense that the client is free to ignore it if
|
||||
it doesn't resize, pick a smaller size (to satisfy aspect ratio or
|
||||
resize in steps of NxM pixels). If the client picks a smaller size and
|
||||
is anchored to two opposite anchors (e.g. 'top' and 'bottom'), the
|
||||
surface will be centered on this axis.
|
||||
|
||||
If the width or height arguments are zero, it means the client should
|
||||
decide its own window dimension.
|
||||
</description>
|
||||
<arg name="serial" type="uint"/>
|
||||
<arg name="width" type="uint"/>
|
||||
<arg name="height" type="uint"/>
|
||||
</event>
|
||||
|
||||
<event name="closed">
|
||||
<description summary="surface should be closed">
|
||||
The closed event is sent by the compositor when the surface will no
|
||||
longer be shown. The output may have been destroyed or the user may
|
||||
have asked for it to be removed. Further changes to the surface will be
|
||||
ignored. The client should destroy the resource after receiving this
|
||||
event, and create a new surface if they so choose.
|
||||
</description>
|
||||
</event>
|
||||
|
||||
<enum name="error">
|
||||
<entry name="invalid_surface_state" value="0" summary="provided surface state is invalid"/>
|
||||
<entry name="invalid_size" value="1" summary="size is invalid"/>
|
||||
<entry name="invalid_anchor" value="2" summary="anchor bitfield is invalid"/>
|
||||
</enum>
|
||||
|
||||
<enum name="anchor" bitfield="true">
|
||||
<entry name="top" value="1" summary="the top edge of the anchor rectangle"/>
|
||||
<entry name="bottom" value="2" summary="the bottom edge of the anchor rectangle"/>
|
||||
<entry name="left" value="4" summary="the left edge of the anchor rectangle"/>
|
||||
<entry name="right" value="8" summary="the right edge of the anchor rectangle"/>
|
||||
</enum>
|
||||
</interface>
|
||||
</protocol>
|
|
@ -40,14 +40,14 @@ foreach test : tests
|
|||
|
||||
t = executable(name, test_sources,
|
||||
calls_sources, dummy_sources, calls_enum_sources, calls_resources,
|
||||
wl_proto_sources, wayland_sources,
|
||||
c_args : test_cflags,
|
||||
link_args: test_link_args,
|
||||
link_with : gdbofono_lib,
|
||||
dependencies: calls_deps,
|
||||
include_directories : [
|
||||
top_include,
|
||||
src_include,
|
||||
dummy_include
|
||||
calls_includes,
|
||||
dummy_include,
|
||||
]
|
||||
)
|
||||
test(name, t, env: test_env)
|
||||
|
|
Loading…
Reference in a new issue