|
|
dbc690 |
From 28a560fdc1a8571d0e1d34da5cb57f43d2fe1a54 Mon Sep 17 00:00:00 2001
|
|
|
dbc690 |
From: Ray Strode <rstrode@redhat.com>
|
|
|
dbc690 |
Date: Wed, 11 Aug 2021 14:47:05 -0400
|
|
|
dbc690 |
Subject: [PATCH 1/6] compositor: Ignore some of the builtin keybindings
|
|
|
dbc690 |
|
|
|
dbc690 |
Mutter on wayland currently has a bug where it crashes if the run dialog
|
|
|
dbc690 |
keybinding is pressed. No one notices the bug for gnome-shell, since
|
|
|
dbc690 |
gnome-shell overrides mutters run dialog keybinding.
|
|
|
dbc690 |
|
|
|
dbc690 |
This commit makes GNOME Kiosk also override the keybinding to avoid the
|
|
|
dbc690 |
crash. At the same time it neuters a few other builtin keybindings that
|
|
|
dbc690 |
aren't so useful to GNOME Kiosk.
|
|
|
dbc690 |
---
|
|
|
dbc690 |
compositor/kiosk-compositor.c | 90 +++++++++++++++++++++++++++++++++++
|
|
|
dbc690 |
1 file changed, 90 insertions(+)
|
|
|
dbc690 |
|
|
|
dbc690 |
diff --git a/compositor/kiosk-compositor.c b/compositor/kiosk-compositor.c
|
|
|
dbc690 |
index 43329c7..2db58ed 100644
|
|
|
dbc690 |
--- a/compositor/kiosk-compositor.c
|
|
|
dbc690 |
+++ b/compositor/kiosk-compositor.c
|
|
|
dbc690 |
@@ -1,42 +1,43 @@
|
|
|
dbc690 |
#include "config.h"
|
|
|
dbc690 |
#include "kiosk-compositor.h"
|
|
|
dbc690 |
|
|
|
dbc690 |
#include <stdlib.h>
|
|
|
dbc690 |
#include <string.h>
|
|
|
dbc690 |
|
|
|
dbc690 |
#include <glib-object.h>
|
|
|
dbc690 |
|
|
|
dbc690 |
#include <clutter/clutter.h>
|
|
|
dbc690 |
#include <clutter/x11/clutter-x11.h>
|
|
|
dbc690 |
#include <meta/common.h>
|
|
|
dbc690 |
#include <meta/display.h>
|
|
|
dbc690 |
+#include <meta/keybindings.h>
|
|
|
dbc690 |
#include <meta/main.h>
|
|
|
dbc690 |
#include <meta/util.h>
|
|
|
dbc690 |
#include <meta/meta-window-group.h>
|
|
|
dbc690 |
|
|
|
dbc690 |
#include <systemd/sd-daemon.h>
|
|
|
dbc690 |
|
|
|
dbc690 |
#include "kiosk-backgrounds.h"
|
|
|
dbc690 |
#include "kiosk-input-sources-manager.h"
|
|
|
dbc690 |
#include "kiosk-service.h"
|
|
|
dbc690 |
|
|
|
dbc690 |
#include "org.gnome.DisplayManager.Manager.h"
|
|
|
dbc690 |
|
|
|
dbc690 |
struct _KioskCompositor
|
|
|
dbc690 |
{
|
|
|
dbc690 |
MetaPlugin parent;
|
|
|
dbc690 |
|
|
|
dbc690 |
/* weak references */
|
|
|
dbc690 |
MetaDisplay *display;
|
|
|
dbc690 |
ClutterBackend *backend;
|
|
|
dbc690 |
ClutterActor *stage;
|
|
|
dbc690 |
|
|
|
dbc690 |
/* strong references */
|
|
|
dbc690 |
GCancellable *cancellable;
|
|
|
dbc690 |
KioskBackgrounds *backgrounds;
|
|
|
dbc690 |
KioskInputSourcesManager *input_sources_manager;
|
|
|
dbc690 |
KioskService *service;
|
|
|
dbc690 |
};
|
|
|
dbc690 |
|
|
|
dbc690 |
enum {
|
|
|
dbc690 |
X_SERVER_EVENT,
|
|
|
dbc690 |
@@ -103,82 +104,171 @@ register_with_display_manager (KioskCompositor *self)
|
|
|
dbc690 |
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{ss}"));
|
|
|
dbc690 |
|
|
|
dbc690 |
gdm_manager_call_register_display_sync (display_manager,
|
|
|
dbc690 |
g_variant_builder_end (&builder),
|
|
|
dbc690 |
self->cancellable,
|
|
|
dbc690 |
&error);
|
|
|
dbc690 |
|
|
|
dbc690 |
if (error != NULL) {
|
|
|
dbc690 |
g_debug ("KioskCompositor: Could not register with display manager: %s",
|
|
|
dbc690 |
error->message);
|
|
|
dbc690 |
return;
|
|
|
dbc690 |
}
|
|
|
dbc690 |
}
|
|
|
dbc690 |
|
|
|
dbc690 |
static void
|
|
|
dbc690 |
register_with_systemd (KioskCompositor *self)
|
|
|
dbc690 |
{
|
|
|
dbc690 |
sd_notify (TRUE, "READY=1");
|
|
|
dbc690 |
}
|
|
|
dbc690 |
|
|
|
dbc690 |
static void
|
|
|
dbc690 |
register_session (KioskCompositor *self)
|
|
|
dbc690 |
{
|
|
|
dbc690 |
meta_register_with_session ();
|
|
|
dbc690 |
|
|
|
dbc690 |
register_with_display_manager (self);
|
|
|
dbc690 |
|
|
|
dbc690 |
register_with_systemd (self);
|
|
|
dbc690 |
}
|
|
|
dbc690 |
|
|
|
dbc690 |
+static void
|
|
|
dbc690 |
+on_builtin_keybinding_triggered (MetaDisplay *display,
|
|
|
dbc690 |
+ MetaWindow *window,
|
|
|
dbc690 |
+ ClutterKeyEvent *event,
|
|
|
dbc690 |
+ MetaKeyBinding *binding,
|
|
|
dbc690 |
+ KioskCompositor *self)
|
|
|
dbc690 |
+{
|
|
|
dbc690 |
+ g_debug ("KioskCompositor: Ignoring '%s' request",
|
|
|
dbc690 |
+ meta_key_binding_get_name (binding));
|
|
|
dbc690 |
+}
|
|
|
dbc690 |
+
|
|
|
dbc690 |
+static void
|
|
|
dbc690 |
+neuter_builtin_keybindings (KioskCompositor *self)
|
|
|
dbc690 |
+{
|
|
|
dbc690 |
+ const char *builtin_keybindings[] = {
|
|
|
dbc690 |
+ "switch-to-workspace-1",
|
|
|
dbc690 |
+ "switch-to-workspace-2",
|
|
|
dbc690 |
+ "switch-to-workspace-3",
|
|
|
dbc690 |
+ "switch-to-workspace-4",
|
|
|
dbc690 |
+ "switch-to-workspace-5",
|
|
|
dbc690 |
+ "switch-to-workspace-6",
|
|
|
dbc690 |
+ "switch-to-workspace-7",
|
|
|
dbc690 |
+ "switch-to-workspace-8",
|
|
|
dbc690 |
+ "switch-to-workspace-9",
|
|
|
dbc690 |
+ "switch-to-workspace-10",
|
|
|
dbc690 |
+ "switch-to-workspace-11",
|
|
|
dbc690 |
+ "switch-to-workspace-12",
|
|
|
dbc690 |
+ "switch-to-workspace-left",
|
|
|
dbc690 |
+ "switch-to-workspace-right",
|
|
|
dbc690 |
+ "switch-to-workspace-up",
|
|
|
dbc690 |
+ "switch-to-workspace-down",
|
|
|
dbc690 |
+ "switch-to-workspace-last",
|
|
|
dbc690 |
+ "panel-main-menu",
|
|
|
dbc690 |
+ "panel-run-dialog",
|
|
|
dbc690 |
+ "set-spew-mark",
|
|
|
dbc690 |
+ "switch-monitor",
|
|
|
dbc690 |
+ "rotate-monitor",
|
|
|
dbc690 |
+ "switch-to-session-1",
|
|
|
dbc690 |
+ "switch-to-session-2",
|
|
|
dbc690 |
+ "switch-to-session-3",
|
|
|
dbc690 |
+ "switch-to-session-4",
|
|
|
dbc690 |
+ "switch-to-session-5",
|
|
|
dbc690 |
+ "switch-to-session-6",
|
|
|
dbc690 |
+ "switch-to-session-7",
|
|
|
dbc690 |
+ "switch-to-session-8",
|
|
|
dbc690 |
+ "switch-to-session-9",
|
|
|
dbc690 |
+ "switch-to-session-10",
|
|
|
dbc690 |
+ "switch-to-session-11",
|
|
|
dbc690 |
+ "switch-to-session-12",
|
|
|
dbc690 |
+ "restore-shortcuts",
|
|
|
dbc690 |
+ "activate-window-menu",
|
|
|
dbc690 |
+ "toggle-above",
|
|
|
dbc690 |
+ "toggle-shaded",
|
|
|
dbc690 |
+ "minimize",
|
|
|
dbc690 |
+ "toggle-on-all-workspaces",
|
|
|
dbc690 |
+ "move-to-workspace-1",
|
|
|
dbc690 |
+ "move-to-workspace-2",
|
|
|
dbc690 |
+ "move-to-workspace-3",
|
|
|
dbc690 |
+ "move-to-workspace-4",
|
|
|
dbc690 |
+ "move-to-workspace-5",
|
|
|
dbc690 |
+ "move-to-workspace-6",
|
|
|
dbc690 |
+ "move-to-workspace-7",
|
|
|
dbc690 |
+ "move-to-workspace-8",
|
|
|
dbc690 |
+ "move-to-workspace-9",
|
|
|
dbc690 |
+ "move-to-workspace-10",
|
|
|
dbc690 |
+ "move-to-workspace-11",
|
|
|
dbc690 |
+ "move-to-workspace-12",
|
|
|
dbc690 |
+ "move-to-workspace-last",
|
|
|
dbc690 |
+ "move-to-workspace-left",
|
|
|
dbc690 |
+ "move-to-workspace-right",
|
|
|
dbc690 |
+ "move-to-workspace-up",
|
|
|
dbc690 |
+ "move-to-workspace-down",
|
|
|
dbc690 |
+ NULL
|
|
|
dbc690 |
+ };
|
|
|
dbc690 |
+ size_t i;
|
|
|
dbc690 |
+
|
|
|
dbc690 |
+ g_debug ("KioskCompositor: Neutering builtin keybindings");
|
|
|
dbc690 |
+
|
|
|
dbc690 |
+ for (i = 0; builtin_keybindings[i] != NULL; i++) {
|
|
|
dbc690 |
+ meta_keybindings_set_custom_handler (builtin_keybindings[i],
|
|
|
dbc690 |
+ (MetaKeyHandlerFunc)
|
|
|
dbc690 |
+ on_builtin_keybinding_triggered,
|
|
|
dbc690 |
+ self,
|
|
|
dbc690 |
+ NULL);
|
|
|
dbc690 |
+ }
|
|
|
dbc690 |
+}
|
|
|
dbc690 |
+
|
|
|
dbc690 |
static void
|
|
|
dbc690 |
kiosk_compositor_start (MetaPlugin *plugin)
|
|
|
dbc690 |
{
|
|
|
dbc690 |
KioskCompositor *self = KIOSK_COMPOSITOR (plugin);
|
|
|
dbc690 |
g_autoptr (GError) error = NULL;
|
|
|
dbc690 |
|
|
|
dbc690 |
g_set_weak_pointer (&self->display, meta_plugin_get_display (META_PLUGIN (self)));
|
|
|
dbc690 |
g_set_weak_pointer (&self->backend, clutter_get_default_backend ());
|
|
|
dbc690 |
g_set_weak_pointer (&self->stage, meta_get_stage_for_display (self->display));
|
|
|
dbc690 |
|
|
|
dbc690 |
clutter_actor_show (self->stage);
|
|
|
dbc690 |
|
|
|
dbc690 |
self->cancellable = g_cancellable_new ();
|
|
|
dbc690 |
|
|
|
dbc690 |
self->service = kiosk_service_new (self);
|
|
|
dbc690 |
kiosk_service_start (self->service, &error);
|
|
|
dbc690 |
|
|
|
dbc690 |
if (error != NULL) {
|
|
|
dbc690 |
g_debug ("KioskCompositor: Could not start D-Bus service: %s", error->message);
|
|
|
dbc690 |
g_clear_error (&error);
|
|
|
dbc690 |
}
|
|
|
dbc690 |
|
|
|
dbc690 |
+ neuter_builtin_keybindings (self);
|
|
|
dbc690 |
+
|
|
|
dbc690 |
self->backgrounds = kiosk_backgrounds_new (self);
|
|
|
dbc690 |
self->input_sources_manager = kiosk_input_sources_manager_new (self);
|
|
|
dbc690 |
|
|
|
dbc690 |
register_session (self);
|
|
|
dbc690 |
}
|
|
|
dbc690 |
|
|
|
dbc690 |
static void
|
|
|
dbc690 |
kiosk_compositor_minimize (MetaPlugin *plugin,
|
|
|
dbc690 |
MetaWindowActor *actor)
|
|
|
dbc690 |
{
|
|
|
dbc690 |
meta_plugin_minimize_completed (plugin, actor);
|
|
|
dbc690 |
}
|
|
|
dbc690 |
|
|
|
dbc690 |
static void
|
|
|
dbc690 |
kiosk_compositor_unminimize (MetaPlugin *plugin,
|
|
|
dbc690 |
MetaWindowActor *actor)
|
|
|
dbc690 |
{
|
|
|
dbc690 |
meta_plugin_unminimize_completed (plugin, actor);
|
|
|
dbc690 |
}
|
|
|
dbc690 |
|
|
|
dbc690 |
static void
|
|
|
dbc690 |
kiosk_compositor_size_changed (MetaPlugin *plugin,
|
|
|
dbc690 |
MetaWindowActor *actor)
|
|
|
dbc690 |
{
|
|
|
dbc690 |
g_assert (META_PLUGIN_CLASS (kiosk_compositor_parent_class)->size_changed == NULL);
|
|
|
dbc690 |
}
|
|
|
dbc690 |
|
|
|
dbc690 |
static void
|
|
|
dbc690 |
kiosk_compositor_size_change (MetaPlugin *plugin,
|
|
|
dbc690 |
MetaWindowActor *actor,
|
|
|
dbc690 |
--
|
|
|
dbc690 |
2.31.1
|
|
|
dbc690 |
|