[Debian-on-mobile-maintainers] [Git][DebianOnMobile-team/phoc][debian/master] 10 commits: desktop: Refresh all views when auto-maximize changes

Arnaud Ferraris gitlab at salsa.debian.org
Wed Oct 28 10:19:26 GMT 2020



Arnaud Ferraris pushed to branch debian/master at Debian On Mobile / phoc


Commits:
cde70286 by Guido Günther at 2020-10-08T18:35:29+02:00
desktop: Refresh all views when auto-maximize changes

So far this only affected new views but when e.g. unplugging an
external (switching to 'phone' mode) we want running apps to
behave.

- - - - -
37744a7b by Guido Günther at 2020-10-15T09:01:31+02:00
phosh: Drop rotate-display

The rotate_display served us well but it's too simplistic (no events,
degrees instead of transforms, ...). Since phosh now uses
wlr-output-management for bid to use this part of the private protocol.

- - - - -
983c3497 by Guido Günther at 2020-10-15T09:03:01+02:00
d/control: Add breaks for older phosh

These require the rotate_display private protocol bit

- - - - -
488a3ea1 by Clayton Craft at 2020-10-15T09:17:38-07:00
input: convert roots_input to PhocInput gobject

- - - - -
60f06033 by Clayton Craft at 2020-10-15T09:17:38-07:00
input: apply phosh code formatting styles

This is a cosmetic change that applies code formatting styles from
Phosh's style guidelines to input.c/h.

- - - - -
626c81fb by Clayton Craft at 2020-10-15T09:17:39-07:00
Use PhocInput objects instead of roots_input

- - - - -
5efd5b2c by Guido Günther at 2020-10-21T19:28:38+02:00
phosh: Fix indentation

- - - - -
f153f896 by Guido Günther at 2020-10-21T19:28:38+02:00
phosh: Ungrab accelerators

This lead to a compositor crash so far

- - - - -
b3b55d11 by Guido Günther at 2020-10-27T19:16:24+01:00
Document changes and release 0.4.4

- - - - -
58792968 by Arnaud Ferraris at 2020-10-28T11:14:38+01:00
New upstream version 0.4.4

- - - - -


20 changed files:

- debian/control
- meson.build
- src/desktop.c
- src/desktop.h
- src/gtk-shell.c
- src/input.c
- src/input.h
- src/layer_shell.c
- src/output.c
- src/output.h
- src/phosh.c
- src/render.c
- src/seat.c
- src/seat.h
- src/server.c
- src/server.h
- src/view.c
- src/virtual.c
- src/xdg_shell.c
- src/xwayland.c


Changes:

=====================================
debian/control
=====================================
@@ -35,7 +35,7 @@ Depends:
  mutter-common,
 Recommends: phosh
 Breaks:
- phosh (<< 0.2.0),
+ phosh (<< 0.4.5),
 Description: Wayland compositor for mobile phones
  Tiny wayland compositor based on wlroots for use on mobile phones like the
  Librem 5.


=====================================
meson.build
=====================================
@@ -1,5 +1,5 @@
 project('phoc', 'c',
-          version: '0.4.3',
+          version: '0.4.4',
           license: 'GPLv3+',
     meson_version: '>= 0.47.0',
   default_options: [


=====================================
src/desktop.c
=====================================
@@ -712,8 +712,17 @@ phoc_desktop_toggle_output_blank (PhocDesktop *self)
 void
 phoc_desktop_set_auto_maximize (PhocDesktop *self, gboolean enable)
 {
+  struct roots_view *view;
+
   g_debug ("auto-maximize: %d", enable);
   self->maximize = enable;
+
+  /* Disabling auto-maximize leaves all views in their current position */
+  if (!enable)
+    return;
+
+  wl_list_for_each (view, &self->views, link)
+    view_auto_maximize (view);
 }
 
 gboolean


=====================================
src/desktop.h
=====================================
@@ -44,6 +44,7 @@ G_DECLARE_FINAL_TYPE (PhocDesktop, phoc_desktop, PHOC, DESKTOP, GObject);
 /* These need to know about PhocDesktop so we have them after the type definition.
  * This will fix itself once output / view / phosh are gobjects and have their
  * most of their members made non-public */
+#include "input.h"
 #include "output.h"
 #include "view.h"
 #include "phosh.h"


=====================================
src/gtk-shell.c
=====================================
@@ -65,7 +65,7 @@ handle_request_focus(struct wl_client *client,
   PhocGtkSurface *gtk_surface =
     gtk_surface_from_resource (resource);
   PhocServer *server = phoc_server_get_default ();
-  struct roots_input *input = server->input;
+  PhocInput *input = server->input;
   struct roots_seat *seat = input_last_active_seat(input);
   struct roots_view *view;
 


=====================================
src/input.c
=====================================
@@ -15,11 +15,18 @@
 #ifdef PHOC_XWAYLAND
 #include <wlr/xwayland.h>
 #endif
-#include "settings.h"
 #include "input.h"
 #include "keyboard.h"
 #include "seat.h"
-#include "server.h"
+
+G_DEFINE_TYPE (PhocInput, phoc_input, G_TYPE_OBJECT);
+
+enum {
+  PROP_0,
+  PROP_CONFIG,
+  PROP_LAST_PROP,
+};
+static GParamSpec *props[PROP_LAST_PROP];
 
 const char *
 phoc_input_get_device_type (enum wlr_input_device_type type)
@@ -42,114 +49,219 @@ phoc_input_get_device_type (enum wlr_input_device_type type)
   }
 }
 
-struct roots_seat *input_get_seat(struct roots_input *input, char *name) {
-	struct roots_seat *seat = NULL;
-	wl_list_for_each(seat, &input->seats, link) {
-		if (strcmp(seat->seat->name, name) == 0) {
-			return seat;
-		}
-	}
+static void
+phoc_input_set_property (GObject      *object,
+                         guint         property_id,
+                         const GValue *value,
+                         GParamSpec   *pspec)
+{
+  PhocInput *self = PHOC_INPUT (object);
+
+  switch (property_id) {
+  case PROP_CONFIG:
+    self->config = g_value_get_pointer (value);
+    g_object_notify_by_pspec (G_OBJECT (self), props[PROP_CONFIG]);
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+    break;
+  }
+}
+
+static void
+phoc_input_get_property (GObject    *object,
+                         guint       property_id,
+                         GValue     *value,
+                         GParamSpec *pspec)
+{
+  PhocInput *self = PHOC_INPUT (object);
+
+  switch (property_id) {
+  case PROP_CONFIG:
+    g_value_set_pointer (value, self->config);
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+    break;
+  }
+}
+
+struct roots_seat *
+phoc_input_get_seat (PhocInput *self, char *name)
+{
+  struct roots_seat *seat = NULL;
+
+  wl_list_for_each (seat, &self->seats, link) {
+    if (strcmp (seat->seat->name, name) == 0) {
+      return seat;
+    }
+  }
+
+  seat = roots_seat_create (self, name);
+  return seat;
+}
+
+static void
+handle_new_input (struct wl_listener *listener, void *data)
+{
+  struct wlr_input_device *device = data;
+  PhocInput *input = wl_container_of (listener, input, new_input);
+
+  char *seat_name = ROOTS_CONFIG_DEFAULT_SEAT_NAME;
+  struct roots_device_config *dc =
+    roots_config_get_device (input->config, device);
+
+  if (dc) {
+    seat_name = dc->seat;
+  }
+
+  struct roots_seat *seat = phoc_input_get_seat (input, seat_name);
+
+  if (!seat) {
+    g_warning ("could not create roots seat");
+    return;
+  }
+
+  g_debug ("New input device: %s (%d:%d) %s seat:%s", device->name,
+           device->vendor, device->product,
+           phoc_input_get_device_type (device->type), seat_name);
+
+  roots_seat_add_device (seat, device);
+
+  if (dc && wlr_input_device_is_libinput (device)) {
+    struct libinput_device *libinput_dev =
+      wlr_libinput_get_device_handle (device);
+
+    g_debug ("input has config, tap_enabled: %d\n", dc->tap_enabled);
+    if (dc->tap_enabled) {
+      libinput_device_config_tap_set_enabled (libinput_dev,
+                                              LIBINPUT_CONFIG_TAP_ENABLED);
+    }
+  }
+}
+
+static void
+phoc_input_init (PhocInput *self)
+{
+}
 
-	seat = roots_seat_create(input, name);
-	return seat;
+PhocInput *
+phoc_input_new (struct roots_config *config)
+{
+  return g_object_new (PHOC_TYPE_INPUT,
+                       "config", config,
+                       NULL);
 }
 
-static void handle_new_input(struct wl_listener *listener, void *data) {
-	struct wlr_input_device *device = data;
-	struct roots_input *input = wl_container_of(listener, input, new_input);
-
-	char *seat_name = ROOTS_CONFIG_DEFAULT_SEAT_NAME;
-	struct roots_device_config *dc =
-		roots_config_get_device(input->config, device);
-	if (dc) {
-		seat_name = dc->seat;
-	}
-
-	struct roots_seat *seat = input_get_seat(input, seat_name);
-	if (!seat) {
-		g_warning("could not create roots seat");
-		return;
-	}
-
-	g_debug("New input device: %s (%d:%d) %s seat:%s", device->name,
-		device->vendor, device->product,
-		phoc_input_get_device_type(device->type), seat_name);
-
-	roots_seat_add_device(seat, device);
-
-	if (dc && wlr_input_device_is_libinput(device)) {
-		struct libinput_device *libinput_dev =
-			wlr_libinput_get_device_handle(device);
-
-		g_debug("input has config, tap_enabled: %d\n", dc->tap_enabled);
-		if (dc->tap_enabled) {
-			libinput_device_config_tap_set_enabled(libinput_dev,
-					LIBINPUT_CONFIG_TAP_ENABLED);
-		}
-	}
+static void
+phoc_input_constructed (GObject *object)
+{
+  PhocInput *self = PHOC_INPUT (object);
+  PhocServer *server = phoc_server_get_default ();
+
+  g_debug ("Initializing roots input");
+  assert (server->desktop);
+
+  wl_list_init (&self->seats);
+
+  self->new_input.notify = handle_new_input;
+  wl_signal_add (&server->backend->events.new_input, &self->new_input);
+  G_OBJECT_CLASS (phoc_input_parent_class)->constructed (object);
+
 }
 
-struct roots_input *input_create(struct roots_config *config) {
-	PhocServer *server = phoc_server_get_default ();
-	g_debug("Initializing roots input");
-	assert(server->desktop);
+static void
+phoc_input_finalize (GObject *object)
+{
+  PhocInput *self = PHOC_INPUT (object);
 
-	struct roots_input *input = calloc(1, sizeof(struct roots_input));
-	if (input == NULL) {
-		return NULL;
-	}
+  wl_list_remove (&self->seats);
 
-	input->config = config;
+  G_OBJECT_CLASS (phoc_input_parent_class)->finalize (object);
+}
 
-	wl_list_init(&input->seats);
+static void
+phoc_input_dispose (GObject *object)
+{
+  PhocInput *self = PHOC_INPUT (object);
 
-	input->new_input.notify = handle_new_input;
-	wl_signal_add(&server->backend->events.new_input, &input->new_input);
+  g_clear_object (&self->config);
 
-	return input;
+  G_OBJECT_CLASS (phoc_input_parent_class)->dispose (object);
 }
 
-void input_destroy(struct roots_input *input) {
-	// TODO
+static void
+phoc_input_class_init (PhocInputClass *klass)
+{
+  GObjectClass *object_class = (GObjectClass *)klass;
+
+  object_class->set_property = phoc_input_set_property;
+  object_class->get_property = phoc_input_get_property;
+
+  object_class->constructed = phoc_input_constructed;
+  object_class->dispose = phoc_input_dispose;
+  object_class->finalize = phoc_input_finalize;
+
+  props[PROP_CONFIG] =
+    g_param_spec_pointer (
+      "config",
+      "Config",
+      "The config object",
+      G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+  g_object_class_install_properties (object_class, PROP_LAST_PROP, props);
+
 }
 
-struct roots_seat *input_seat_from_wlr_seat(struct roots_input *input,
-		struct wlr_seat *wlr_seat) {
-	struct roots_seat *seat = NULL;
-	wl_list_for_each(seat, &input->seats, link) {
-		if (seat->seat == wlr_seat) {
-			return seat;
-		}
-	}
-	return seat;
+struct roots_seat *
+phoc_input_seat_from_wlr_seat (PhocInput       *self,
+                               struct wlr_seat *wlr_seat)
+{
+  struct roots_seat *seat = NULL;
+
+  wl_list_for_each (seat, &self->seats, link) {
+    if (seat->seat == wlr_seat) {
+      return seat;
+    }
+  }
+  return seat;
 }
 
-bool input_view_has_focus(struct roots_input *input, struct roots_view *view) {
-	if (!view) {
-		return false;
-	}
-	struct roots_seat *seat;
-	wl_list_for_each(seat, &input->seats, link) {
-		if (view == roots_seat_get_focus(seat)) {
-			return true;
-		}
-	}
-
-	return false;
+bool
+phoc_input_view_has_focus (PhocInput *self, struct roots_view *view)
+{
+  if (!view) {
+    return false;
+  }
+  struct roots_seat *seat;
+
+  wl_list_for_each (seat, &self->seats, link) {
+    if (view == roots_seat_get_focus (seat)) {
+      return true;
+    }
+  }
+
+  return false;
 }
 
-static inline int64_t timespec_to_msec(const struct timespec *a) {
-	return (int64_t)a->tv_sec * 1000 + a->tv_nsec / 1000000;
+static inline int64_t
+timespec_to_msec (const struct timespec *a)
+{
+  return (int64_t)a->tv_sec * 1000 + a->tv_nsec / 1000000;
 }
 
-void input_update_cursor_focus(struct roots_input *input) {
-	struct timespec now;
-	clock_gettime(CLOCK_MONOTONIC, &now);
-	g_assert_nonnull (input);
+void
+phoc_input_update_cursor_focus (PhocInput *self)
+{
+  struct timespec now;
+
+  clock_gettime (CLOCK_MONOTONIC, &now);
+  g_assert_nonnull (self);
 
-	struct roots_seat *seat;
-	wl_list_for_each(seat, &input->seats, link) {
-		roots_cursor_update_position(roots_seat_get_cursor (seat),
-					     timespec_to_msec(&now));
-	}
+  struct roots_seat *seat;
+
+  wl_list_for_each (seat, &self->seats, link) {
+    roots_cursor_update_position (roots_seat_get_cursor (seat),
+                                  timespec_to_msec (&now));
+  }
 }


=====================================
src/input.h
=====================================
@@ -1,36 +1,44 @@
-#ifndef ROOTSTON_INPUT_H
-#define ROOTSTON_INPUT_H
+#pragma once
 
 #include <wayland-server-core.h>
 #include <wlr/types/wlr_cursor.h>
 #include <wlr/types/wlr_input_device.h>
 #include <wlr/types/wlr_seat.h>
 #include "settings.h"
+
+#define PHOC_TYPE_INPUT (phoc_input_get_type ())
+
+G_DECLARE_FINAL_TYPE (PhocInput, phoc_input, PHOC, INPUT, GObject);
+
+/* These need to know about PhocInput so we have them after the type definition.
+ * This will fix itself once output / view / phosh are gobjects and most of
+ * their members are non-public. */
+#include "output.h"
 #include "cursor.h"
 #include "server.h"
 #include "view.h"
 
-struct roots_input {
-	struct roots_config *config;
+/* TODO: we keep the struct public due to the list links and
+   notifiers but we should avoid other member access */
+struct _PhocInput {
+  GObject              parent;
 
-	struct wl_listener new_input;
+  struct wl_listener   new_input;
+  struct wl_list       seats; // roots_seat::link */
 
-	struct wl_list seats; // roots_seat::link
+  /* private */
+  struct roots_config *config;
+  struct xkb_keymap   *keymap;
+  uint32_t             meta_key;
+  GnomeXkbInfo        *xkbinfo;
 };
 
-struct roots_input *input_create(struct roots_config *config);
-void input_destroy(struct roots_input *input);
-
-struct roots_seat *input_seat_from_wlr_seat(struct roots_input *input,
-		struct wlr_seat *seat);
-
-bool input_view_has_focus(struct roots_input *input, struct roots_view *view);
-
-struct roots_seat *input_get_seat(struct roots_input *input, char *name);
-
-struct roots_seat *input_last_active_seat(struct roots_input *input);
-
-void input_update_cursor_focus(struct roots_input *input);
-const char *phoc_input_get_device_type (enum wlr_input_device_type type);
-
-#endif
+PhocInput         *phoc_input_new (struct roots_config *config);
+bool               phoc_input_view_has_focus (PhocInput         *self,
+                                              struct roots_view *view);
+const char        *phoc_input_get_device_type (enum wlr_input_device_type type);
+struct roots_seat *phoc_input_get_seat (PhocInput *self, char *name);
+struct roots_seat *phoc_input_last_active_seat (PhocInput *self);
+void               phoc_input_update_cursor_focus (PhocInput *self);
+struct roots_seat *phoc_input_seat_from_wlr_seat (PhocInput       *self,
+                                                  struct wlr_seat *seat);


=====================================
src/layer_shell.c
=====================================
@@ -322,7 +322,7 @@ void arrange_layers(struct roots_output *output) {
 		}
 	}
 
-	struct roots_input *input = server->input;
+	PhocInput *input = server->input;
 	struct roots_seat *seat;
 	wl_list_for_each(seat, &input->seats, link) {
 		roots_seat_set_focus_layer(seat,
@@ -518,7 +518,7 @@ static void popup_handle_map(struct wl_listener *listener, void *data) {
 
 	wlr_surface_send_enter(popup->wlr_popup->base->surface, wlr_output);
 	popup_damage(popup, true);
-	input_update_cursor_focus(server->input);
+	phoc_input_update_cursor_focus(server->input);
 }
 
 static void popup_handle_unmap(struct wl_listener *listener, void *data) {
@@ -530,7 +530,7 @@ static void popup_handle_unmap(struct wl_listener *listener, void *data) {
 	}
 	wl_list_remove(&popup->new_subsurface.link);
 	popup_damage(popup, true);
-	input_update_cursor_focus(server->input);
+	phoc_input_update_cursor_focus(server->input);
 }
 
 static void popup_handle_commit(struct wl_listener *listener, void *data) {
@@ -638,7 +638,7 @@ static void subsurface_handle_map(struct wl_listener *listener, void *data) {
 
 	wlr_surface_send_enter(subsurface->wlr_subsurface->surface, subsurface_get_root_layer(subsurface)->layer_surface->output);
 	subsurface_damage(subsurface, true);
-	input_update_cursor_focus(server->input);
+	phoc_input_update_cursor_focus(server->input);
 }
 
 static void subsurface_handle_unmap(struct wl_listener *listener, void *data) {
@@ -650,7 +650,7 @@ static void subsurface_handle_unmap(struct wl_listener *listener, void *data) {
 	}
 	wl_list_remove(&subsurface->new_subsurface.link);
 	subsurface_damage(subsurface, true);
-	input_update_cursor_focus(server->input);
+	phoc_input_update_cursor_focus(server->input);
 }
 
 static void subsurface_handle_commit(struct wl_listener *listener, void *data) {
@@ -736,7 +736,7 @@ static void handle_unmap(struct wl_listener *listener, void *data) {
 	wl_list_remove(&layer->new_subsurface.link);
 
 	unmap(layer->layer_surface);
-	input_update_cursor_focus(server->input);
+	phoc_input_update_cursor_focus(server->input);
 }
 
 void handle_layer_shell_surface(struct wl_listener *listener, void *data) {
@@ -756,7 +756,7 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) {
 		layer_surface->client_pending.margin.left);
 
 	if (!layer_surface->output) {
-		struct roots_input *input = server->input;
+		PhocInput *input = server->input;
 		struct roots_seat *seat = input_last_active_seat(input);
 		assert(seat); // Technically speaking we should handle this case
 		struct roots_cursor *cursor = roots_seat_get_cursor(seat);


=====================================
src/output.c
=====================================
@@ -236,7 +236,7 @@ void output_layer_for_each_surface(struct roots_output *output,
 }
 
 void output_drag_icons_for_each_surface(struct roots_output *output,
-		struct roots_input *input, roots_surface_iterator_func_t iterator,
+		PhocInput *input, roots_surface_iterator_func_t iterator,
 		void *user_data) {
 	struct wlr_box *output_box =
 		wlr_output_layout_get_box(output->desktop->layout, output->wlr_output);
@@ -660,7 +660,7 @@ void handle_new_output(struct wl_listener *listener, void *data) {
 		new_output);
 	struct wlr_output *wlr_output = data;
 	PhocServer *server = phoc_server_get_default ();
-	struct roots_input *input = server->input;
+	PhocInput *input = server->input;
 	struct roots_config *config = desktop->config;
 
 	wlr_log(WLR_DEBUG, "Output '%s' added", wlr_output->name);


=====================================
src/output.h
=====================================
@@ -39,8 +39,6 @@ typedef void (*roots_surface_iterator_func_t)(struct roots_output *output,
 void rotate_child_position(double *sx, double *sy, double sw, double sh,
 	double pw, double ph, float rotation);
 
-struct roots_input;
-
 void output_surface_for_each_surface(struct roots_output *output,
 	struct wlr_surface *surface, double ox, double oy,
 	roots_surface_iterator_func_t iterator, void *user_data);
@@ -51,7 +49,7 @@ void output_view_for_each_surface(struct roots_output *output,
 	struct roots_view *view, roots_surface_iterator_func_t iterator,
 	void *user_data);
 void output_drag_icons_for_each_surface(struct roots_output *output,
-	struct roots_input *input, roots_surface_iterator_func_t iterator,
+	PhocInput *input, roots_surface_iterator_func_t iterator,
 	void *user_data);
 void output_layer_for_each_surface(struct roots_output *output,
 	struct wl_list *layer_surfaces, roots_surface_iterator_func_t iterator,


=====================================
src/phosh.c
=====================================
@@ -43,41 +43,8 @@ phosh_rotate_display (struct wl_client   *client,
                       struct wl_resource *surface_resource,
                       uint32_t            degrees)
 {
-  struct phosh_private *phosh = wl_resource_get_user_data (resource);
-  enum wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL;
-
-  g_debug ("rotation: %d", degrees);
-  degrees %= 360;
-
-  switch (degrees) {
-  case 0:
-    transform =  WL_OUTPUT_TRANSFORM_NORMAL;
-    break;
-  case 90:
-    transform = WL_OUTPUT_TRANSFORM_90;
-    break;
-  case 180:
-    transform = WL_OUTPUT_TRANSFORM_180;
-    break;
-  case 270:
-    transform = WL_OUTPUT_TRANSFORM_270;
-    break;
-  default:
-    wl_resource_post_error (resource,
-                            PHOSH_PRIVATE_ERROR_INVALID_ARGUMENT,
-                            "Can only rotate in 90 degree steps");
-  }
-
-  /* Make sure we rotate clockwise */
-  phoc_utils_fix_transform(&transform);
-
-  if (!phosh->panel) {
-    g_warning ("Tried to rotate inexistent panel");
-    return;
-  }
-
-  wlr_output_set_transform (phosh->panel->output, transform);
-  output_damage_whole(phosh->panel->output->data);
+  wl_resource_post_error (resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
+                          "Use wlr-output-management protocol instead");
 }
 
 
@@ -266,6 +233,39 @@ phosh_private_keyboard_event_grab_accelerator_request (struct wl_client   *wl_cl
 
 }
 
+
+static void
+phosh_private_keyboard_event_ungrab_accelerator_request (struct wl_client *client,
+							 struct wl_resource *resource,
+							 uint32_t action_id)
+{
+  GHashTableIter iter;
+  gpointer key, value, found = NULL;
+  struct phosh_private_keyboard_event_data *kbevent =
+    phosh_private_keyboard_event_from_resource (resource);
+
+  g_debug ("Ungrabbing accelerator %d", action_id);
+  g_hash_table_iter_init (&iter, kbevent->subscribed_accelerators);
+  while (g_hash_table_iter_next (&iter, &key, &value)) {
+    if (GPOINTER_TO_INT (value) == action_id) {
+      found = key;
+      break;
+    }
+  }
+
+  if (found) {
+    g_hash_table_remove (kbevent->subscribed_accelerators, key);
+    phosh_private_keyboard_event_send_ungrab_success_event (resource,
+							    action_id);
+
+  } else {
+    phosh_private_keyboard_event_send_ungrab_failed_event (resource,
+							   action_id,
+							   PHOSH_PRIVATE_KEYBOARD_EVENT_ERROR_INVALID_ARGUMENT);
+  }
+}
+
+
 static void
 phosh_private_keyboard_event_handle_destroy (struct wl_client   *client,
                                              struct wl_resource *resource)
@@ -275,6 +275,7 @@ phosh_private_keyboard_event_handle_destroy (struct wl_client   *client,
 
 static const struct phosh_private_keyboard_event_interface phosh_private_keyboard_event_impl = {
   .grab_accelerator_request = phosh_private_keyboard_event_grab_accelerator_request,
+  .ungrab_accelerator_request = phosh_private_keyboard_event_ungrab_accelerator_request,
   .destroy = phosh_private_keyboard_event_handle_destroy
 };
 
@@ -307,7 +308,7 @@ handle_get_keyboard_event (struct wl_client   *client,
       g_free (kbevent);
       wl_client_post_no_memory (client);
       return;
-    }
+  }
 
   struct phosh_private *phosh_private = phosh_private_from_resource (phosh_private_resource);
 


=====================================
src/render.c
=====================================
@@ -298,7 +298,7 @@ static bool scan_out_fullscreen_view(struct roots_output *output) {
 }
 
 static void render_drag_icons(struct roots_output *output,
-		pixman_region32_t *damage, struct roots_input *input) {
+		pixman_region32_t *damage, PhocInput *input) {
 	struct render_data data = {
 		.damage = damage,
 		.alpha = 1.0f,


=====================================
src/seat.c
=====================================
@@ -743,7 +743,7 @@ void roots_seat_destroy(struct roots_seat *seat) {
 	wlr_seat_destroy(seat->seat);
 }
 
-struct roots_seat *roots_seat_create(struct roots_input *input, char *name) {
+struct roots_seat *roots_seat_create(PhocInput *input, char *name) {
 	PhocServer *server = phoc_server_get_default ();
 	struct roots_seat *seat = calloc(1, sizeof(struct roots_seat));
 	if (!seat) {
@@ -1419,7 +1419,7 @@ void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) {
 	seat->has_focus = false;
 
 	// Deactivate the old view if it is not focused by some other seat
-	if (prev_focus != NULL && !input_view_has_focus(seat->input, prev_focus)) {
+	if (prev_focus != NULL && !phoc_input_view_has_focus(seat->input, prev_focus)) {
 		view_activate(prev_focus, false);
 	}
 
@@ -1673,7 +1673,7 @@ void roots_seat_end_compositor_grab(struct roots_seat *seat) {
 	cursor->mode = ROOTS_CURSOR_PASSTHROUGH;
 }
 
-struct roots_seat *input_last_active_seat(struct roots_input *input) {
+struct roots_seat *input_last_active_seat(PhocInput *input) {
 	struct roots_seat *seat = NULL, *_seat;
 	wl_list_for_each(_seat, &input->seats, link) {
 		if (!seat || (seat->seat->last_event.tv_sec > _seat->seat->last_event.tv_sec &&


=====================================
src/seat.h
=====================================
@@ -9,10 +9,10 @@
 #include "text_input.h"
 
 struct roots_seat {
-	struct roots_input *input;
+	PhocInput *input;
 	struct wlr_seat *seat;
 	struct roots_cursor *cursor;
-	struct wl_list link; // roots_input::seats
+	struct wl_list link; // PhocInput::seats
 
 	// coordinates of the first touch point if it exists
 	int32_t touch_id;
@@ -136,7 +136,7 @@ struct roots_pointer_constraint {
 	struct wl_listener destroy;
 };
 
-struct roots_seat *roots_seat_create(struct roots_input *input, char *name);
+struct roots_seat *roots_seat_create(PhocInput *input, char *name);
 
 void roots_seat_destroy(struct roots_seat *seat);
 
@@ -183,4 +183,6 @@ bool roots_seat_allow_input(struct roots_seat *seat,
 
 void roots_seat_maybe_set_cursor (struct roots_seat *seat, const char *name);
 
+struct roots_seat *input_last_active_seat(PhocInput *input);
+
 #endif


=====================================
src/server.c
=====================================
@@ -253,7 +253,7 @@ phoc_server_setup (PhocServer *self, const char *config_path,
   self->mainloop = mainloop;
   self->exit_status = 1;
   self->desktop = phoc_desktop_new (self->config);
-  self->input = input_create(self->config);
+  self->input = phoc_input_new (self->config);
   self->session = g_strdup (session);
   self->mainloop = mainloop;
   self->debug_flags = debug_flags;
@@ -279,7 +279,7 @@ phoc_server_setup (PhocServer *self, const char *config_path,
 #ifdef PHOC_XWAYLAND
   if (self->desktop->xwayland != NULL) {
     struct roots_seat *xwayland_seat =
-      input_get_seat(self->input, ROOTS_CONFIG_DEFAULT_SEAT_NAME);
+      phoc_input_get_seat(self->input, ROOTS_CONFIG_DEFAULT_SEAT_NAME);
     wlr_xwayland_set_seat(self->desktop->xwayland, xwayland_seat->seat);
   }
 #endif


=====================================
src/server.h
=====================================
@@ -35,7 +35,7 @@ struct _PhocServer {
   /* Phoc resources */
   struct roots_config *config;
   PhocDesktop *desktop;
-  struct roots_input *input;
+  PhocInput *input;
   PhocServerDebugFlags debug_flags;
   gboolean inited;
 


=====================================
src/view.c
=====================================
@@ -542,7 +542,7 @@ bool view_center(struct roots_view *view) {
 	view_get_geometry (view, &geom);
 
 	PhocDesktop *desktop = view->desktop;
-	struct roots_input *input = server->input;
+	PhocInput *input = server->input;
 	struct roots_seat *seat = input_last_active_seat(input);
 	struct roots_cursor *cursor;
 
@@ -645,7 +645,7 @@ static void subsurface_handle_map(struct wl_listener *listener,
 		wl_container_of(listener, subsurface, map);
 	struct roots_view *view = subsurface->view_child.view;
 	view_damage_whole(view);
-	input_update_cursor_focus(server->input);
+	phoc_input_update_cursor_focus(server->input);
 
 	struct wlr_box box;
 	view_get_box(view, &box);
@@ -666,7 +666,7 @@ static void subsurface_handle_unmap(struct wl_listener *listener,
 		wl_container_of(listener, subsurface, unmap);
 	struct roots_view *view = subsurface->view_child.view;
 	view_damage_whole(view);
-	input_update_cursor_focus(server->input);
+	phoc_input_update_cursor_focus(server->input);
 }
 
 struct roots_subsurface *subsurface_create(struct roots_view *view,
@@ -781,7 +781,7 @@ void view_map(struct roots_view *view, struct wlr_surface *surface) {
 
 	wl_list_insert(&view->desktop->views, &view->link);
 	view_damage_whole(view);
-	input_update_cursor_focus(server->input);
+	phoc_input_update_cursor_focus(server->input);
 }
 
 void view_unmap(struct roots_view *view) {
@@ -817,7 +817,7 @@ void view_unmap(struct roots_view *view) {
 
 void view_initial_focus(struct roots_view *view) {
 	PhocServer *server = phoc_server_get_default ();
-	struct roots_input *input = server->input;
+	PhocInput *input = server->input;
 	// TODO what seat gets focus? the one with the last input event?
 	struct roots_seat *seat;
 	wl_list_for_each(seat, &input->seats, link) {


=====================================
src/virtual.c
=====================================
@@ -15,7 +15,7 @@ phoc_handle_virtual_keyboard (struct wl_listener *listener, void *data)
     wl_container_of (listener, desktop, virtual_keyboard_new);
   struct wlr_virtual_keyboard_v1 *keyboard = data;
 
-  struct roots_seat *seat = input_seat_from_wlr_seat (server->input,
+  struct roots_seat *seat = phoc_input_seat_from_wlr_seat (server->input,
 						      keyboard->seat);
   g_return_if_fail (seat);
 
@@ -36,7 +36,7 @@ phoc_handle_virtual_pointer(struct wl_listener *listener, void *data)
 
   g_return_if_fail (PHOC_IS_DESKTOP (desktop));
   g_return_if_fail (PHOC_IS_SERVER (server));
-  seat = input_get_seat (server->input, seat_name);
+  seat = phoc_input_get_seat (server->input, seat_name);
   g_return_if_fail (seat);
 
   g_debug ("New virtual input device: %s (%d:%d) %s seat:%s", device->name,


=====================================
src/xdg_shell.c
=====================================
@@ -42,14 +42,14 @@ static void popup_handle_map(struct wl_listener *listener, void *data) {
 	PhocServer *server = phoc_server_get_default ();
 	struct roots_xdg_popup *popup = wl_container_of(listener, popup, map);
 	view_damage_whole(popup->view_child.view);
-	input_update_cursor_focus(server->input);
+	phoc_input_update_cursor_focus(server->input);
 }
 
 static void popup_handle_unmap(struct wl_listener *listener, void *data) {
 	PhocServer *server = phoc_server_get_default ();
 	struct roots_xdg_popup *popup = wl_container_of(listener, popup, unmap);
 	view_damage_whole(popup->view_child.view);
-	input_update_cursor_focus(server->input);
+	phoc_input_update_cursor_focus(server->input);
 }
 
 static struct roots_xdg_popup *popup_create(struct roots_view *view,
@@ -322,9 +322,9 @@ static void handle_request_move(struct wl_listener *listener, void *data) {
 	struct roots_xdg_surface *roots_xdg_surface =
 		wl_container_of(listener, roots_xdg_surface, request_move);
 	struct roots_view *view = &roots_xdg_surface->view;
-	struct roots_input *input = server->input;
+	PhocInput *input = server->input;
 	struct wlr_xdg_toplevel_move_event *e = data;
-	struct roots_seat *seat = input_seat_from_wlr_seat(input, e->seat->seat);
+	struct roots_seat *seat = phoc_input_seat_from_wlr_seat(input, e->seat->seat);
 
 	// TODO verify event serial
 	if (!seat || roots_seat_get_cursor(seat)->mode != ROOTS_CURSOR_PASSTHROUGH) {
@@ -338,9 +338,9 @@ static void handle_request_resize(struct wl_listener *listener, void *data) {
 	struct roots_xdg_surface *roots_xdg_surface =
 		wl_container_of(listener, roots_xdg_surface, request_resize);
 	struct roots_view *view = &roots_xdg_surface->view;
-	struct roots_input *input = server->input;
+	PhocInput *input = server->input;
 	struct wlr_xdg_toplevel_resize_event *e = data;
-	struct roots_seat *seat = input_seat_from_wlr_seat(input, e->seat->seat);
+	struct roots_seat *seat = phoc_input_seat_from_wlr_seat(input, e->seat->seat);
 
 	// TODO verify event serial
 	assert(seat);


=====================================
src/xwayland.c
=====================================
@@ -211,7 +211,7 @@ static struct roots_seat *guess_seat_for_view(struct roots_view *view) {
 	// the best we can do is to pick the first seat that has the surface focused
 	// for the pointer
 	PhocServer *server = phoc_server_get_default ();
-	struct roots_input *input = server->input;
+	PhocInput *input = server->input;
 	struct roots_seat *seat;
 	wl_list_for_each(seat, &input->seats, link) {
 		if (seat->seat->pointer_state.focused_surface == view->wlr_surface) {



View it on GitLab: https://salsa.debian.org/DebianOnMobile-team/phoc/-/compare/fa896add6acbc75cf459e5e2f089eaf5e6fee661...5879296889915aa6185ad5cac4cfc2ba9742afe6

-- 
View it on GitLab: https://salsa.debian.org/DebianOnMobile-team/phoc/-/compare/fa896add6acbc75cf459e5e2f089eaf5e6fee661...5879296889915aa6185ad5cac4cfc2ba9742afe6
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-on-mobile-maintainers/attachments/20201028/f72c5a0e/attachment-0001.html>


More information about the Debian-on-mobile-maintainers mailing list