[Debian-on-mobile-maintainers] [Git][DebianOnMobile-team/phoc][upstream/latest] 17 commits: Drop xdg_shell_V6 support

Arnaud Ferraris gitlab at salsa.debian.org
Thu Oct 8 15:43:50 BST 2020



Arnaud Ferraris pushed to branch upstream/latest at Debian On Mobile / phoc


Commits:
a7c07b37 by Guido Günther at 2020-09-14T14:57:54+02:00
Drop xdg_shell_V6 support

wlroots drops this post 0.11.0 in
a9cbfd950e83df2053474f50f7d12cf79dd74d74
and dropping it now makes building against newer wlroots simpler.

- - - - -
f5b28767 by Guido Günther at 2020-09-14T14:58:46+02:00
xdg-shell: Drop mention of v6 protocol

We always used the non-v6 function.

- - - - -
eec6a66a by Arnaud Ferraris at 2020-09-15T20:31:04+00:00
src: add utility function to fix rotation on wlroots v0.11+

Starting with version 0.11.0, wlroots rotates counter-clockwise, while
it rotated clockwise in previous version.

In order to keep the same behavior no matter which wlroots version is
used, this patch adds a new `phoc_utils_fix_transform()` function and
uses it for correcting rotation requests.

This makes sure we always rotate clockwise, as it was the previous
behavior.

- - - - -
15dff45a by Sebastian Krzyszkowiak at 2020-09-18T16:35:02+02:00
xwayland: Don't apply size constraints to maximized windows

- - - - -
1fc8b5ec by Sebastian Krzyszkowiak at 2020-09-18T16:35:02+02:00
xwayland: Correctly handle windows that are maximized on map

- - - - -
85c20cd3 by Sebastian Krzyszkowiak at 2020-09-18T16:36:01+02:00
xwayland: Automaximization support

- - - - -
03e2e2e9 by Sebastian Krzyszkowiak at 2020-09-18T16:36:01+02:00
seat: Check whether moving and resizing is allowed

There's no need to have it handled by each shell individually now
that XWayland windows are maximized the same way xdg-shell ones are.

- - - - -
b5bdf51e by Sebastian Krzyszkowiak at 2020-09-18T16:59:03+02:00
xwayland: Don't allow to move non-regular windows

Moving menus, tooltips etc. causes input redirection issues.

- - - - -
b06f3a59 by Sebastian Krzyszkowiak at 2020-09-19T00:35:42+02:00
xwayland: Don't automaximize non-resizable windows

Let them be centered instead.

- - - - -
5c09db6e by Sebastian Krzyszkowiak at 2020-09-19T00:35:42+02:00
layer-shell: Recenter non-maximized views when rearranging

...but only when automaximization is enabled.

- - - - -
731efbbe by Guido Günther at 2020-10-06T17:40:48+00:00
desktop: Adjust to wlr_xcursor_manager_load 0.11.0 API change

As of wlroots 0.11.0  (666498db015ad1439a8916bce609baf8fa042b5d) The
function now returns a bool instead of an int with an inverted logic.

- - - - -
77558a6f by Guido Günther at 2020-10-07T00:55:44+00:00
server: Unblock SIGUSR1 when spawning child

We wan't to ignore SIGUSR1 in phoc due to XWayland but not in
any spawned session.

- - - - -
a61e77a2 by Guido Günther at 2020-10-07T19:49:22+00:00
desktop: Reindent handle_layout_change

There will be more around this with multiple outputs so
the churn should be o.k.

- - - - -
971553ad by Guido Günther at 2020-10-07T19:49:22+00:00
desktop: Refresh all outputs on layout changes

- - - - -
79591f26 by Dorota Czaplejewicz at 2020-10-07T20:02:28+00:00
input method: Forward only supported state

The input-method state is a reflection of the text-input state. Sending all availble state change events to the input-method on each done doesn't actually reflect the state text-input is in, if the values were filled in from defaults because text-input doesn't support them.

With this change, support is taken into account, and defaulted values are not sent at all.

- - - - -
5aee8f31 by Sebastian Krzyszkowiak at 2020-10-07T22:23:45+02:00
Update wlroots submodule

Forward up to 7723a09a226d812aa51d1439c2b5e8e21238d45c.

output-management-v1: send complete head state on enable change

- - - - -
816bdf31 by Sebastian Krzyszkowiak at 2020-10-08T01:41:42+02:00
Document changes and release 0.4.3

- - - - -


23 changed files:

- debian/changelog
- debian/control
- meson.build
- protocols/meson.build
- src/desktop.c
- src/desktop.h
- src/layer_shell.c
- src/meson.build
- src/output.c
- src/phosh.c
- src/seat.c
- src/server.c
- src/server.h
- src/settings.c
- src/text_input.c
- + src/utils.c
- + src/utils.h
- src/view.h
- src/xdg_shell.c
- − src/xdg_shell_v6.c
- src/xwayland.c
- + src/xwayland.h
- subprojects/wlroots


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,31 @@
+phoc (0.4.3) amber-phone; urgency=medium
+
+  [ Guido Günther ]
+  * Drop xdg_shell_V6 support
+  * xdg-shell: Drop mention of v6 protocol
+  * desktop: Adjust to wlr_xcursor_manager_load 0.11.0 API change
+  * server: Unblock SIGUSR1 when spawning child
+  * desktop: Reindent handle_layout_change
+  * desktop: Refresh all outputs on layout changes
+
+  [ Arnaud Ferraris ]
+  * src: add utility function to fix rotation on wlroots v0.11+
+
+  [ Sebastian Krzyszkowiak ]
+  * xwayland: Don't apply size constraints to maximized windows
+  * xwayland: Correctly handle windows that are maximized on map
+  * xwayland: Automaximization support
+  * seat: Check whether moving and resizing is allowed
+  * xwayland: Don't allow to move non-regular windows
+  * xwayland: Don't automaximize non-resizable windows
+  * layer-shell: Recenter non-maximized views when rearranging
+  * Update wlroots submodule
+
+  [ Dorota Czaplejewicz ]
+  * input method: Forward only supported state
+
+ -- Sebastian Krzyszkowiak <sebastian.krzyszkowiak at puri.sm>  Thu, 08 Oct 2020 01:40:58 +0200
+
 phoc (0.4.2) amber-phone; urgency=medium
 
   [ Evangelos Ribeiro Tzaras ]


=====================================
debian/control
=====================================
@@ -13,6 +13,7 @@ Build-Depends:
  meson (>= 0.47.0),
  pkg-config,
  wayland-protocols,
+ libxcb1-dev,
  libwlroots-dev (>= 0.10.0) <!pkg.phoc.embedwlroots>,
 # For wlroots subproject build
  libcap-dev <pkg.phoc.embedwlroots>,
@@ -25,7 +26,6 @@ Build-Depends:
  libpng-dev <pkg.phoc.embedwlroots>,
  libsystemd-dev <pkg.phoc.embedwlroots>,
  libwayland-dev <pkg.phoc.embedwlroots>,
- libxcb1-dev <pkg.phoc.embedwlroots>,
  libxcb-composite0-dev <pkg.phoc.embedwlroots>,
  libxcb-icccm4-dev <pkg.phoc.embedwlroots>,
  libxcb-image0-dev <pkg.phoc.embedwlroots>,


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


=====================================
protocols/meson.build
=====================================
@@ -29,7 +29,6 @@ wayland_scanner_client = generator(
 
 server_protocols = [
 	[wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'],
-	[wl_protocol_dir, 'unstable/xdg-shell/xdg-shell-unstable-v6.xml'],
 	[wl_protocol_dir, 'unstable/pointer-constraints/pointer-constraints-unstable-v1.xml'],
         [wl_protocol_dir, 'unstable/tablet/tablet-unstable-v2.xml'],
 	['gtk-shell.xml'],


=====================================
src/desktop.c
=====================================
@@ -29,9 +29,9 @@
 #include <wlr/types/wlr_xcursor_manager.h>
 #include <wlr/types/wlr_xdg_output_v1.h>
 #include <wlr/types/wlr_xdg_output_v1.h>
-#include <wlr/types/wlr_xdg_shell_v6.h>
 #include <wlr/types/wlr_xdg_shell.h>
 #include <wlr/util/log.h>
+#include <wlr/version.h>
 #include "layers.h"
 #include "seat.h"
 #include "server.h"
@@ -105,12 +105,6 @@ static bool view_at(struct roots_view *view, double lx, double ly,
 	double _sx, _sy;
 	struct wlr_surface *_surface = NULL;
 	switch (view->type) {
-	case ROOTS_XDG_SHELL_V6_VIEW:;
-		struct roots_xdg_surface_v6 *xdg_surface_v6 =
-			roots_xdg_surface_v6_from_view(view);
-		_surface = wlr_xdg_surface_v6_surface_at(xdg_surface_v6->xdg_surface_v6,
-			view_sx, view_sy, &_sx, &_sy);
-		break;
 	case ROOTS_XDG_SHELL_VIEW:;
 		struct roots_xdg_surface *xdg_surface =
 			roots_xdg_surface_from_view(view);
@@ -267,32 +261,38 @@ struct wlr_surface *desktop_surface_at(PhocDesktop *desktop,
 	return NULL;
 }
 
-static void handle_layout_change(struct wl_listener *listener, void *data) {
-	PhocDesktop *desktop =
-		wl_container_of(listener, desktop, layout_change);
+static void
+handle_layout_change (struct wl_listener *listener, void *data)
+{
+  PhocDesktop *self;
+  struct wlr_output *center_output;
+  struct wlr_box *center_output_box;
+  double center_x, center_y;
+  struct roots_view *view;
+  struct roots_output *output;
 
-	struct wlr_output *center_output =
-		wlr_output_layout_get_center_output(desktop->layout);
-	if (center_output == NULL) {
-		return;
-	}
+  self = wl_container_of (listener, self, layout_change);
+  center_output = wlr_output_layout_get_center_output (self->layout);
+  if (center_output == NULL)
+    return;
 
-	struct wlr_box *center_output_box =
-		wlr_output_layout_get_box(desktop->layout, center_output);
-	double center_x = center_output_box->x + center_output_box->width/2;
-	double center_y = center_output_box->y + center_output_box->height/2;
+  center_output_box = wlr_output_layout_get_box (self->layout, center_output);
+  center_x = center_output_box->x + center_output_box->width / 2;
+  center_y = center_output_box->y + center_output_box->height / 2;
 
-	struct roots_view *view;
-	wl_list_for_each(view, &desktop->views, link) {
-		struct wlr_box box;
-		view_get_box(view, &box);
+  /* Make sure all views are on an existing output */
+  wl_list_for_each (view, &self->views, link) {
+    struct wlr_box box;
+    view_get_box (view, &box);
 
-		if (wlr_output_layout_intersects(desktop->layout, NULL, &box)) {
-			continue;
-		}
+    if (wlr_output_layout_intersects (self->layout, NULL, &box))
+      continue;
+    view_move (view, center_x - box.width / 2, center_y - box.height / 2);
+  }
 
-		view_move(view, center_x - box.width/2, center_y - box.height/2);
-	}
+  /* Damage all outputs since the move above damaged old layout space */
+  wl_list_for_each(output, &self->outputs, link)
+    output_damage_whole(output);
 }
 
 static void input_inhibit_activate(struct wl_listener *listener, void *data) {
@@ -403,6 +403,48 @@ scale_to_fit_changed_cb (PhocDesktop *self,
     phoc_desktop_set_scale_to_fit (self, max);
 }
 
+#ifdef PHOC_XWAYLAND
+static const char *atom_map[XWAYLAND_ATOM_LAST] = {
+	"_NET_WM_WINDOW_TYPE_NORMAL",
+	"_NET_WM_WINDOW_TYPE_DIALOG"
+};
+
+static
+void handle_xwayland_ready(struct wl_listener *listener, void *data) {
+  PhocDesktop *desktop = wl_container_of (
+        listener, desktop, xwayland_ready);
+  xcb_connection_t *xcb_conn = xcb_connect (NULL, NULL);
+
+  int err = xcb_connection_has_error (xcb_conn);
+  if (err) {
+    g_warning ("XCB connect failed: %d", err);
+    return;
+  }
+
+  xcb_intern_atom_cookie_t cookies[XWAYLAND_ATOM_LAST];
+
+  for (size_t i = 0; i < XWAYLAND_ATOM_LAST; i++)
+    cookies[i] = xcb_intern_atom (xcb_conn, 0, strlen (atom_map[i]), atom_map[i]);
+
+  for (size_t i = 0; i < XWAYLAND_ATOM_LAST; i++) {
+    xcb_generic_error_t *error = NULL;
+    xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply (xcb_conn, cookies[i], &error);
+
+    if (error) {
+      g_warning ("could not resolve atom %s, X11 error code %d",
+        atom_map[i], error->error_code);
+      free (error);
+    }
+
+    if (reply)
+      desktop->xwayland_atoms[i] = reply->atom;
+
+    free (reply);
+  }
+
+  xcb_disconnect (xcb_conn);
+}
+#endif
 
 static void
 phoc_desktop_constructed (GObject *object)
@@ -427,11 +469,6 @@ phoc_desktop_constructed (GObject *object)
   self->compositor = wlr_compositor_create(server->wl_display,
 					   server->renderer);
 
-  self->xdg_shell_v6 = wlr_xdg_shell_v6_create(server->wl_display);
-  wl_signal_add(&self->xdg_shell_v6->events.new_surface,
-		&self->xdg_shell_v6_surface);
-  self->xdg_shell_v6_surface.notify = handle_xdg_shell_v6_surface;
-
   self->xdg_shell = wlr_xdg_shell_create(server->wl_display);
   wl_signal_add(&self->xdg_shell->events.new_surface,
 		&self->xdg_shell_surface);
@@ -479,9 +516,17 @@ phoc_desktop_constructed (GObject *object)
 		  &self->xwayland_surface);
     self->xwayland_surface.notify = handle_xwayland_surface;
 
+    wl_signal_add(&self->xwayland->events.ready,
+		  &self->xwayland_ready);
+    self->xwayland_ready.notify = handle_xwayland_ready;
+
     setenv("DISPLAY", self->xwayland->display_name, true);
 
+#if (WLR_VERSION_MAJOR > 0 || WLR_VERSION_MINOR > 10)
+    if (!wlr_xcursor_manager_load(self->xcursor_manager, 1)) {
+#else
     if (wlr_xcursor_manager_load(self->xcursor_manager, 1)) {
+#endif
       wlr_log(WLR_ERROR, "Cannot load XWayland XCursor theme");
     }
     struct wlr_xcursor *xcursor = wlr_xcursor_manager_get_xcursor(


=====================================
src/desktop.h
=====================================
@@ -27,13 +27,16 @@
 #include <wlr/types/wlr_virtual_pointer_v1.h>
 #include <wlr/types/wlr_xcursor_manager.h>
 #include <wlr/types/wlr_xdg_decoration_v1.h>
-#include <wlr/types/wlr_xdg_shell_v6.h>
 #include <wlr/types/wlr_xdg_shell.h>
 
 #include <gio/gio.h>
 
 #include "settings.h"
 
+#ifdef PHOC_XWAYLAND
+#include "xwayland.h"
+#endif
+
 #define PHOC_TYPE_DESKTOP (phoc_desktop_get_type())
 
 G_DECLARE_FINAL_TYPE (PhocDesktop, phoc_desktop, PHOC, DESKTOP, GObject);
@@ -60,7 +63,6 @@ struct _PhocDesktop {
 	struct wlr_xcursor_manager *xcursor_manager;
 
 	struct wlr_compositor *compositor;
-	struct wlr_xdg_shell_v6 *xdg_shell_v6;
 	struct wlr_xdg_shell *xdg_shell;
 	struct wlr_gamma_control_manager_v1 *gamma_control_manager_v1;
 	struct wlr_export_dmabuf_manager_v1 *export_dmabuf_manager_v1;
@@ -89,7 +91,6 @@ struct _PhocDesktop {
 
 	struct wl_listener new_output;
 	struct wl_listener layout_change;
-	struct wl_listener xdg_shell_v6_surface;
 	struct wl_listener xdg_shell_surface;
 	struct wl_listener layer_shell_surface;
 	struct wl_listener xdg_toplevel_decoration;
@@ -107,6 +108,8 @@ struct _PhocDesktop {
 #ifdef PHOC_XWAYLAND
 	struct wlr_xwayland *xwayland;
 	struct wl_listener xwayland_surface;
+	struct wl_listener xwayland_ready;
+	xcb_atom_t xwayland_atoms[XWAYLAND_ATOM_LAST];
 #endif
 
 	GSettings *settings;
@@ -128,7 +131,6 @@ struct wlr_surface *desktop_surface_at(PhocDesktop *desktop,
 		double lx, double ly, double *sx, double *sy,
 		struct roots_view **view);
 
-void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data);
 void handle_xdg_shell_surface(struct wl_listener *listener, void *data);
 void handle_xdg_toplevel_decoration(struct wl_listener *listener, void *data);
 void handle_layer_shell_surface(struct wl_listener *listener, void *data);


=====================================
src/layer_shell.c
=====================================
@@ -282,6 +282,8 @@ void arrange_layers(struct roots_output *output) {
 	wl_list_for_each(view, &output->desktop->views, link) {
 		if (view_is_maximized(view)) {
 			view_arrange_maximized(view);
+		} else if (output->desktop->maximize) {
+			view_center(view);
 		}
 	}
 


=====================================
src/meson.build
=====================================
@@ -15,16 +15,12 @@ sources = [
   'server.c',
   'switch.c',
   'text_input.c',
+  'utils.c',
   'view.c',
   'virtual.c',
   'xdg_shell.c',
-  'xdg_shell_v6.c',
 ]
 
-if have_xwayland
-  sources += 'xwayland.c'
-endif
-
 phoc_deps = [
   input,
   drm,
@@ -39,6 +35,11 @@ phoc_deps = [
   xkbcommon,
 ]
 
+if have_xwayland
+  sources += 'xwayland.c'
+  phoc_deps += dependency('xcb')
+endif
+
 phoc_lib = static_library(
   'phoc',
   sources,


=====================================
src/output.c
=====================================
@@ -14,7 +14,6 @@
 #ifdef PHOC_HAS_WLR_OUTPUT_POWER_MANAGEMENT
 #include <wlr/types/wlr_output_power_management_v1.h>
 #endif
-#include <wlr/types/wlr_xdg_shell_v6.h>
 #include <wlr/types/wlr_xdg_shell.h>
 #include <wlr/util/log.h>
 #include <wlr/util/region.h>


=====================================
src/phosh.c
=====================================
@@ -24,6 +24,7 @@
 #include "desktop.h"
 #include "phosh.h"
 #include "render.h"
+#include "utils.h"
 
 struct phosh_private_keyboard_event_data {
   GHashTable *subscribed_accelerators;
@@ -67,6 +68,9 @@ phosh_rotate_display (struct wl_client   *client,
                             "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;


=====================================
src/seat.c
=====================================
@@ -19,6 +19,7 @@
 #include <wlr/types/wlr_tablet_v2.h>
 #include <wlr/types/wlr_xcursor_manager.h>
 #include <wlr/util/log.h>
+#include <wlr/version.h>
 #include "cursor.h"
 #include "keyboard.h"
 #include "seat.h"
@@ -1200,7 +1201,11 @@ void roots_seat_configure_xcursor(struct roots_seat *seat) {
 	struct roots_output *output;
 	wl_list_for_each(output, &server->desktop->outputs, link) {
 		float scale = output->wlr_output->scale;
+#if (WLR_VERSION_MAJOR > 0 || WLR_VERSION_MINOR > 10)
+		if (!wlr_xcursor_manager_load(seat->cursor->xcursor_manager, scale)) {
+#else
 		if (wlr_xcursor_manager_load(seat->cursor->xcursor_manager, scale)) {
+#endif
 			wlr_log(WLR_ERROR, "Cannot load xcursor theme for output '%s' "
 				"with scale %f", output->wlr_output->name, scale);
 		}
@@ -1579,6 +1584,9 @@ void roots_seat_cycle_focus(struct roots_seat *seat) {
 }
 
 void roots_seat_begin_move(struct roots_seat *seat, struct roots_view *view) {
+	if (view->desktop->maximize)
+		return;
+
 	struct roots_cursor *cursor = seat->cursor;
 	cursor->mode = ROOTS_CURSOR_MOVE;
 	cursor->offs_x = cursor->cursor->x;
@@ -1598,6 +1606,9 @@ void roots_seat_begin_move(struct roots_seat *seat, struct roots_view *view) {
 
 void roots_seat_begin_resize(struct roots_seat *seat, struct roots_view *view,
 		uint32_t edges) {
+	if (view->desktop->maximize)
+		return;
+
 	struct roots_cursor *cursor = seat->cursor;
 	cursor->mode = ROOTS_CURSOR_RESIZE;
 	cursor->offs_x = cursor->cursor->x;


=====================================
src/server.c
=====================================
@@ -97,6 +97,19 @@ on_session_exit (GPid pid, gint status, PhocServer *self)
 }
 
 
+static void
+on_child_setup (gpointer unused)
+{
+  sigset_t mask;
+
+  /* phoc wants SIGUSR1 blocked due to wlroots/xwayland but we
+     don't want to inherit that to childs */
+  sigemptyset(&mask);
+  sigaddset(&mask, SIGUSR1);
+  sigprocmask(SIG_UNBLOCK, &mask, NULL);
+}
+
+
 static gboolean
 phoc_startup_session_in_idle(PhocServer *self)
 {
@@ -106,7 +119,7 @@ phoc_startup_session_in_idle(PhocServer *self)
 
   if (g_spawn_async (NULL, cmd, NULL,
 		      G_SPAWN_DO_NOT_REAP_CHILD,
-		      NULL, self, &pid, &err)) {
+		      on_child_setup, self, &pid, &err)) {
     g_child_watch_add (pid, (GChildWatchFunc)on_session_exit, self);
   } else {
     g_warning ("Failed to launch session: %s", err->message);


=====================================
src/server.h
=====================================
@@ -8,6 +8,7 @@
 #include <wlr/types/wlr_data_device.h>
 #ifdef PHOC_XWAYLAND
 #include <wlr/xwayland.h>
+#include <xcb/xproto.h>
 #endif
 #include "settings.h"
 #include "desktop.h"


=====================================
src/settings.c
=====================================
@@ -18,6 +18,7 @@
 #include <wlr/util/log.h>
 #include "settings.h"
 #include "ini.h"
+#include "utils.h"
 
 static bool parse_modeline(const char *s, drmModeModeInfo *mode) {
 	char hsync[16];
@@ -203,6 +204,8 @@ static int config_ini_handler(void *user, const char *section, const char *name,
 			} else {
 				wlr_log(WLR_ERROR, "got unknown transform value: %s", value);
 			}
+			/* Make sure we rotate clockwise */
+			phoc_utils_fix_transform(&oc->transform);
 		} else if (strcmp(name, "mode") == 0) {
 			char *end;
 			oc->mode.width = strtol(value, &end, 10);


=====================================
src/text_input.c
=====================================
@@ -101,13 +101,17 @@ static void relay_send_im_done(struct roots_input_method_relay *relay,
 		return;
 	}
 	// TODO: only send each of those if they were modified
-	wlr_input_method_v2_send_surrounding_text(input_method,
-		input->current.surrounding.text, input->current.surrounding.cursor,
-		input->current.surrounding.anchor);
+	if (input->active_features & WLR_TEXT_INPUT_V3_FEATURE_SURROUNDING_TEXT) {
+		wlr_input_method_v2_send_surrounding_text(input_method,
+			input->current.surrounding.text, input->current.surrounding.cursor,
+			input->current.surrounding.anchor);
+	}
 	wlr_input_method_v2_send_text_change_cause(input_method,
 		input->current.text_change_cause);
-	wlr_input_method_v2_send_content_type(input_method,
-		input->current.content_type.hint, input->current.content_type.purpose);
+	if (input->active_features & WLR_TEXT_INPUT_v3_FEATURE_CONTENT_TYPE) {
+		wlr_input_method_v2_send_content_type(input_method,
+			input->current.content_type.hint, input->current.content_type.purpose);
+	}
 	wlr_input_method_v2_send_done(input_method);
 	// TODO: pass intent, display popup size
 }


=====================================
src/utils.c
=====================================
@@ -0,0 +1,33 @@
+#define G_LOG_DOMAIN "phoc-utils"
+
+#include <wlr/version.h>
+#include "utils.h"
+
+void phoc_utils_fix_transform(enum wl_output_transform *transform)
+{
+  /*
+   * Starting from version 0.11.0, wlroots rotates counter-clockwise, while
+   * it was rotating clockwise previously.
+   * In order to maintain the same behavior, we need to modify the transform
+   * before applying it
+   */
+#if (WLR_VERSION_MAJOR > 0 || WLR_VERSION_MINOR > 10)
+  switch(*transform) {
+    case WL_OUTPUT_TRANSFORM_90:
+      *transform = WL_OUTPUT_TRANSFORM_270;
+      break;
+    case WL_OUTPUT_TRANSFORM_270:
+      *transform = WL_OUTPUT_TRANSFORM_90;
+      break;
+    case WL_OUTPUT_TRANSFORM_FLIPPED_90:
+      *transform = WL_OUTPUT_TRANSFORM_FLIPPED_270;
+      break;
+    case WL_OUTPUT_TRANSFORM_FLIPPED_270:
+      *transform = WL_OUTPUT_TRANSFORM_FLIPPED_90;
+      break;
+    default:
+      /* Nothing to be done */
+      break;
+  }
+#endif
+}


=====================================
src/utils.h
=====================================
@@ -0,0 +1,5 @@
+#pragma once
+
+#include <wlr/types/wlr_output_layout.h>
+
+void phoc_utils_fix_transform(enum wl_output_transform *transform);


=====================================
src/view.h
=====================================
@@ -9,7 +9,6 @@
 #include <wlr/types/wlr_foreign_toplevel_management_v1.h>
 #include <wlr/types/wlr_surface.h>
 #include <wlr/types/wlr_xdg_decoration_v1.h>
-#include <wlr/types/wlr_xdg_shell_v6.h>
 #include <wlr/types/wlr_xdg_shell.h>
 
 struct roots_view;
@@ -32,7 +31,6 @@ struct roots_view_interface {
 };
 
 enum roots_view_type {
-	ROOTS_XDG_SHELL_V6_VIEW,
 	ROOTS_XDG_SHELL_VIEW,
 #ifdef PHOC_XWAYLAND
 	ROOTS_XWAYLAND_VIEW,
@@ -104,28 +102,6 @@ struct roots_view {
 	} events;
 };
 
-struct roots_xdg_surface_v6 {
-	struct roots_view view;
-
-	struct wlr_xdg_surface_v6 *xdg_surface_v6;
-
-	struct wl_listener destroy;
-	struct wl_listener new_popup;
-	struct wl_listener map;
-	struct wl_listener unmap;
-	struct wl_listener request_move;
-	struct wl_listener request_resize;
-	struct wl_listener request_maximize;
-	struct wl_listener request_fullscreen;
-	struct wl_listener set_title;
-	struct wl_listener set_app_id;
-	struct wl_listener set_parent;
-
-	struct wl_listener surface_commit;
-
-	uint32_t pending_move_resize_configure_serial;
-};
-
 struct roots_xdg_toplevel_decoration;
 
 struct roots_xdg_surface {
@@ -197,15 +173,6 @@ struct roots_subsurface {
 	struct wl_listener unmap;
 };
 
-struct roots_xdg_popup_v6 {
-	struct roots_view_child view_child;
-	struct wlr_xdg_popup_v6 *wlr_popup;
-	struct wl_listener destroy;
-	struct wl_listener map;
-	struct wl_listener unmap;
-	struct wl_listener new_popup;
-};
-
 struct roots_xdg_popup {
 	struct roots_view_child view_child;
 	struct wlr_xdg_popup *wlr_popup;
@@ -264,8 +231,6 @@ void view_for_each_surface(struct roots_view *view,
 struct roots_view *roots_view_from_wlr_surface (struct wlr_surface *surface);
 
 struct roots_xdg_surface *roots_xdg_surface_from_view(struct roots_view *view);
-struct roots_xdg_surface_v6 *roots_xdg_surface_v6_from_view(
-	struct roots_view *view);
 struct roots_xwayland_surface *roots_xwayland_surface_from_view(
 	struct roots_view *view);
 


=====================================
src/xdg_shell.c
=====================================
@@ -65,7 +65,7 @@ static void popup_handle_new_popup(struct wl_listener *listener, void *data) {
 static void popup_unconstrain(struct roots_xdg_popup *popup) {
 	// get the output of the popup's positioner anchor point and convert it to
 	// the toplevel parent's coordinate system and then pass it to
-	// wlr_xdg_popup_v6_unconstrain_from_box
+	// wlr_xdg_popup_unconstrain_from_box
 
 	// TODO: unconstrain popups for rotated windows
 	if (popup->view_child.view->rotation != 0.0) {
@@ -326,10 +326,6 @@ static void handle_request_move(struct wl_listener *listener, void *data) {
 	struct wlr_xdg_toplevel_move_event *e = data;
 	struct roots_seat *seat = input_seat_from_wlr_seat(input, e->seat->seat);
 
-	if (view->desktop->maximize) {
-		return;
-	}
-
 	// TODO verify event serial
 	if (!seat || roots_seat_get_cursor(seat)->mode != ROOTS_CURSOR_PASSTHROUGH) {
 		return;
@@ -346,10 +342,6 @@ static void handle_request_resize(struct wl_listener *listener, void *data) {
 	struct wlr_xdg_toplevel_resize_event *e = data;
 	struct roots_seat *seat = input_seat_from_wlr_seat(input, e->seat->seat);
 
-	if (view->desktop->maximize) {
-		return;
-	}
-
 	// TODO verify event serial
 	assert(seat);
 	if (!seat || roots_seat_get_cursor(seat)->mode != ROOTS_CURSOR_PASSTHROUGH) {


=====================================
src/xdg_shell_v6.c deleted
=====================================
@@ -1,561 +0,0 @@
-#define G_LOG_DOMAIN "phoc-xdg-shell-v6"
-
-#include "config.h"
-
-#include <assert.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <wayland-server-core.h>
-#include <wlr/types/wlr_box.h>
-#include <wlr/types/wlr_surface.h>
-#include <wlr/types/wlr_xdg_shell_v6.h>
-#include <wlr/util/log.h>
-#include "desktop.h"
-#include "input.h"
-#include "server.h"
-
-static const struct roots_view_child_interface popup_impl;
-
-static void popup_destroy(struct roots_view_child *child) {
-	assert(child->impl == &popup_impl);
-	struct roots_xdg_popup_v6 *popup = (struct roots_xdg_popup_v6 *)child;
-	wl_list_remove(&popup->destroy.link);
-	wl_list_remove(&popup->new_popup.link);
-	wl_list_remove(&popup->map.link);
-	wl_list_remove(&popup->unmap.link);
-	free(popup);
-}
-
-static const struct roots_view_child_interface popup_impl = {
-	.destroy = popup_destroy,
-};
-
-static void popup_handle_destroy(struct wl_listener *listener, void *data) {
-	struct roots_xdg_popup_v6 *popup =
-		wl_container_of(listener, popup, destroy);
-	view_child_destroy(&popup->view_child);
-}
-
-static void popup_handle_map(struct wl_listener *listener, void *data) {
-	PhocServer *server = phoc_server_get_default ();
-	struct roots_xdg_popup_v6 *popup =
-		wl_container_of(listener, popup, map);
-	view_damage_whole(popup->view_child.view);
-	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_v6 *popup =
-		wl_container_of(listener, popup, unmap);
-	view_damage_whole(popup->view_child.view);
-	input_update_cursor_focus(server->input);
-}
-
-static struct roots_xdg_popup_v6 *popup_create(struct roots_view *view,
-	struct wlr_xdg_popup_v6 *wlr_popup);
-
-static void popup_handle_new_popup(struct wl_listener *listener, void *data) {
-	struct roots_xdg_popup_v6 *popup =
-		wl_container_of(listener, popup, new_popup);
-	struct wlr_xdg_popup_v6 *wlr_popup = data;
-	popup_create(popup->view_child.view, wlr_popup);
-}
-
-static void popup_unconstrain(struct roots_xdg_popup_v6 *popup) {
-	// get the output of the popup's positioner anchor point and convert it to
-	// the toplevel parent's coordinate system and then pass it to
-	// wlr_xdg_popup_v6_unconstrain_from_box
-
-	// TODO: unconstrain popups for rotated windows
-	if (popup->view_child.view->rotation != 0.0) {
-		return;
-	}
-
-	struct roots_view *view = popup->view_child.view;
-	struct wlr_output_layout *layout = view->desktop->layout;
-	struct wlr_xdg_popup_v6 *wlr_popup = popup->wlr_popup;
-
-	int anchor_lx, anchor_ly;
-	wlr_xdg_popup_v6_get_anchor_point(wlr_popup, &anchor_lx, &anchor_ly);
-
-	int popup_lx, popup_ly;
-	wlr_xdg_popup_v6_get_toplevel_coords(wlr_popup, wlr_popup->geometry.x,
-		wlr_popup->geometry.y, &popup_lx, &popup_ly);
-	popup_lx += view->box.x;
-	popup_ly += view->box.y;
-
-	anchor_lx += popup_lx;
-	anchor_ly += popup_ly;
-
-	double dest_x = 0, dest_y = 0;
-	wlr_output_layout_closest_point(layout, NULL, anchor_lx, anchor_ly,
-		&dest_x, &dest_y);
-
-	struct wlr_output *output =
-		wlr_output_layout_output_at(layout, dest_x, dest_y);
-	if (output == NULL) {
-		return;
-	}
-
-	struct wlr_box *output_box =
-		wlr_output_layout_get_box(view->desktop->layout, output);
-
-	// the output box expressed in the coordinate system of the toplevel parent
-	// of the popup
-	struct wlr_box output_toplevel_sx_box = {
-		.x = output_box->x - view->box.x,
-		.y = output_box->y - view->box.y,
-		.width = output_box->width,
-		.height = output_box->height,
-	};
-
-	wlr_xdg_popup_v6_unconstrain_from_box(popup->wlr_popup, &output_toplevel_sx_box);
-}
-
-static struct roots_xdg_popup_v6 *popup_create(struct roots_view *view,
-		struct wlr_xdg_popup_v6 *wlr_popup) {
-	struct roots_xdg_popup_v6 *popup =
-		calloc(1, sizeof(struct roots_xdg_popup_v6));
-	if (popup == NULL) {
-		return NULL;
-	}
-	popup->wlr_popup = wlr_popup;
-	view_child_init(&popup->view_child, &popup_impl,
-		view, wlr_popup->base->surface);
-	popup->destroy.notify = popup_handle_destroy;
-	wl_signal_add(&wlr_popup->base->events.destroy, &popup->destroy);
-	popup->map.notify = popup_handle_map;
-	wl_signal_add(&wlr_popup->base->events.map, &popup->map);
-	popup->unmap.notify = popup_handle_unmap;
-	wl_signal_add(&wlr_popup->base->events.unmap, &popup->unmap);
-	popup->new_popup.notify = popup_handle_new_popup;
-	wl_signal_add(&wlr_popup->base->events.new_popup, &popup->new_popup);
-
-	popup_unconstrain(popup);
-
-	return popup;
-}
-
-
-static void get_size(struct roots_view *view, struct wlr_box *box) {
-	struct wlr_xdg_surface_v6 *surface =
-		roots_xdg_surface_v6_from_view(view)->xdg_surface_v6;
-
-	struct wlr_box geo_box;
-	wlr_xdg_surface_v6_get_geometry(surface, &geo_box);
-	box->width = geo_box.width;
-	box->height = geo_box.height;
-}
-
-static void activate(struct roots_view *view, bool active) {
-	struct wlr_xdg_surface_v6 *surface =
-		roots_xdg_surface_v6_from_view(view)->xdg_surface_v6;
-	if (surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL) {
-		wlr_xdg_toplevel_v6_set_activated(surface, active);
-	}
-}
-
-static void apply_size_constraints(struct wlr_xdg_surface_v6 *surface,
-		uint32_t width, uint32_t height, uint32_t *dest_width,
-		uint32_t *dest_height) {
-	*dest_width = width;
-	*dest_height = height;
-
-	struct wlr_xdg_toplevel_v6_state *state = &surface->toplevel->current;
-	if (width < state->min_width) {
-		*dest_width = state->min_width;
-	} else if (state->max_width > 0 &&
-			width > state->max_width) {
-		*dest_width = state->max_width;
-	}
-	if (height < state->min_height) {
-		*dest_height = state->min_height;
-	} else if (state->max_height > 0 &&
-			height > state->max_height) {
-		*dest_height = state->max_height;
-	}
-}
-
-static void resize(struct roots_view *view, uint32_t width, uint32_t height) {
-	struct wlr_xdg_surface_v6 *surface =
-		roots_xdg_surface_v6_from_view(view)->xdg_surface_v6;
-	if (surface->role != WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL) {
-		return;
-	}
-
-	uint32_t constrained_width, constrained_height;
-	apply_size_constraints(surface, width, height, &constrained_width,
-		&constrained_height);
-
-	wlr_xdg_toplevel_v6_set_size(surface, constrained_width,
-		constrained_height);
-}
-
-static void move_resize(struct roots_view *view, double x, double y,
-		uint32_t width, uint32_t height) {
-	struct roots_xdg_surface_v6 *roots_surface =
-		roots_xdg_surface_v6_from_view(view);
-	struct wlr_xdg_surface_v6 *surface = roots_surface->xdg_surface_v6;
-	if (surface->role != WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL) {
-		return;
-	}
-
-	bool update_x = x != view->box.x;
-	bool update_y = y != view->box.y;
-
-	uint32_t constrained_width, constrained_height;
-	apply_size_constraints(surface, width, height, &constrained_width,
-		&constrained_height);
-
-	if (update_x) {
-		x = x + width - constrained_width;
-	}
-	if (update_y) {
-		y = y + height - constrained_height;
-	}
-
-	view->pending_move_resize.update_x = update_x;
-	view->pending_move_resize.update_y = update_y;
-	view->pending_move_resize.x = x;
-	view->pending_move_resize.y = y;
-	view->pending_move_resize.width = constrained_width;
-	view->pending_move_resize.height = constrained_height;
-
-	uint32_t serial = wlr_xdg_toplevel_v6_set_size(surface, constrained_width,
-		constrained_height);
-	if (serial > 0) {
-		roots_surface->pending_move_resize_configure_serial = serial;
-	} else if (roots_surface->pending_move_resize_configure_serial == 0) {
-		view_update_position(view, x, y);
-	}
-}
-
-static bool want_scaling(struct roots_view *view) {
-	return true;
-}
-
-static bool want_auto_maximize(struct roots_view *view) {
-	struct wlr_xdg_surface_v6 *surface =
-		roots_xdg_surface_v6_from_view(view)->xdg_surface_v6;
-
-	return surface->toplevel && !surface->toplevel->parent;
-}
-
-static void maximize(struct roots_view *view, bool maximized) {
-	struct wlr_xdg_surface_v6 *surface =
-		roots_xdg_surface_v6_from_view(view)->xdg_surface_v6;
-	if (surface->role != WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL) {
-		return;
-	}
-
-	wlr_xdg_toplevel_v6_set_maximized(surface, maximized);
-}
-
-static void set_fullscreen(struct roots_view *view, bool fullscreen) {
-	struct wlr_xdg_surface_v6 *surface =
-		roots_xdg_surface_v6_from_view(view)->xdg_surface_v6;
-	if (surface->role != WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL) {
-		return;
-	}
-
-	wlr_xdg_toplevel_v6_set_fullscreen(surface, fullscreen);
-}
-
-static void _close(struct roots_view *view) {
-	struct wlr_xdg_surface_v6 *surface =
-		roots_xdg_surface_v6_from_view(view)->xdg_surface_v6;
-	struct wlr_xdg_popup_v6 *popup = NULL;
-	wl_list_for_each(popup, &surface->popups, link) {
-		wlr_xdg_surface_v6_send_close(popup->base);
-	}
-	wlr_xdg_surface_v6_send_close(surface);
-}
-
-static void for_each_surface(struct roots_view *view,
-		wlr_surface_iterator_func_t iterator, void *user_data) {
-	struct wlr_xdg_surface_v6 *surface =
-		roots_xdg_surface_v6_from_view(view)->xdg_surface_v6;
-	wlr_xdg_surface_v6_for_each_surface(surface, iterator, user_data);
-}
-
-static void get_geometry(struct roots_view *view, struct wlr_box *geom) {
-	wlr_xdg_surface_v6_get_geometry (roots_xdg_surface_v6_from_view(view)->xdg_surface_v6, geom);
-}
-
-static void destroy(struct roots_view *view) {
-	struct roots_xdg_surface_v6 *roots_xdg_surface =
-		roots_xdg_surface_v6_from_view(view);
-	wl_list_remove(&roots_xdg_surface->surface_commit.link);
-	wl_list_remove(&roots_xdg_surface->destroy.link);
-	wl_list_remove(&roots_xdg_surface->new_popup.link);
-	wl_list_remove(&roots_xdg_surface->map.link);
-	wl_list_remove(&roots_xdg_surface->unmap.link);
-	wl_list_remove(&roots_xdg_surface->request_move.link);
-	wl_list_remove(&roots_xdg_surface->request_resize.link);
-	wl_list_remove(&roots_xdg_surface->request_maximize.link);
-	wl_list_remove(&roots_xdg_surface->request_fullscreen.link);
-	wl_list_remove(&roots_xdg_surface->set_title.link);
-	wl_list_remove(&roots_xdg_surface->set_app_id.link);
-	wl_list_remove(&roots_xdg_surface->set_parent.link);
-	free(roots_xdg_surface);
-}
-
-static const struct roots_view_interface view_impl = {
-	.activate = activate,
-	.resize = resize,
-	.move_resize = move_resize,
-	.want_scaling = want_scaling,
-	.want_auto_maximize = want_auto_maximize,
-	.maximize = maximize,
-	.set_fullscreen = set_fullscreen,
-	.close = _close,
-	.for_each_surface = for_each_surface,
-	.get_geometry = get_geometry,
-	.destroy = destroy,
-};
-
-static void handle_request_move(struct wl_listener *listener, void *data) {
-	PhocServer *server = phoc_server_get_default ();
-	struct roots_xdg_surface_v6 *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;
-	struct wlr_xdg_toplevel_v6_move_event *e = data;
-	struct roots_seat *seat = input_seat_from_wlr_seat(input, e->seat->seat);
-
-	if (view->desktop->maximize) {
-		return;
-	}
-
-	// TODO verify event serial
-	if (!seat || roots_seat_get_cursor(seat)->mode != ROOTS_CURSOR_PASSTHROUGH) {
-		return;
-	}
-	roots_seat_begin_move(seat, view);
-}
-
-static void handle_request_resize(struct wl_listener *listener, void *data) {
-	PhocServer *server = phoc_server_get_default ();
-	struct roots_xdg_surface_v6 *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;
-	struct wlr_xdg_toplevel_v6_resize_event *e = data;
-	struct roots_seat *seat = input_seat_from_wlr_seat(input, e->seat->seat);
-
-	if (view->desktop->maximize) {
-		return;
-	}
-
-	// TODO verify event serial
-	assert(seat);
-	if (!seat || roots_seat_get_cursor(seat)->mode != ROOTS_CURSOR_PASSTHROUGH) {
-		return;
-	}
-	roots_seat_begin_resize(seat, view, e->edges);
-}
-
-static void handle_request_maximize(struct wl_listener *listener, void *data) {
-	struct roots_xdg_surface_v6 *roots_xdg_surface =
-		wl_container_of(listener, roots_xdg_surface, request_maximize);
-	struct roots_view *view = &roots_xdg_surface->view;
-	struct wlr_xdg_surface_v6 *surface = roots_xdg_surface->xdg_surface_v6;
-
-	if (surface->role != WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL) {
-		return;
-	}
-
-	view_maximize(view, surface->toplevel->client_pending.maximized);
-}
-
-static void handle_request_fullscreen(struct wl_listener *listener,
-		void *data) {
-	struct roots_xdg_surface_v6 *roots_xdg_surface =
-		wl_container_of(listener, roots_xdg_surface, request_fullscreen);
-	struct roots_view *view = &roots_xdg_surface->view;
-	struct wlr_xdg_surface_v6 *surface = roots_xdg_surface->xdg_surface_v6;
-	struct wlr_xdg_toplevel_v6_set_fullscreen_event *e = data;
-
-	if (surface->role != WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL) {
-		return;
-	}
-
-	view_set_fullscreen(view, e->fullscreen, e->output);
-}
-
-static void handle_set_title(struct wl_listener *listener, void *data) {
-	struct roots_xdg_surface_v6 *roots_xdg_surface =
-		wl_container_of(listener, roots_xdg_surface, set_title);
-
-	view_set_title(&roots_xdg_surface->view,
-		roots_xdg_surface->xdg_surface_v6->toplevel->title);
-}
-
-static void handle_set_app_id(struct wl_listener *listener, void *data) {
-	struct roots_xdg_surface_v6 *roots_xdg_surface =
-		wl_container_of(listener, roots_xdg_surface, set_app_id);
-
-	view_set_app_id(&roots_xdg_surface->view,
-		roots_xdg_surface->xdg_surface_v6->toplevel->app_id);
-}
-
-static void handle_set_parent(struct wl_listener* listener, void* data) {
-	struct roots_xdg_surface_v6* roots_xdg_surface =
-		wl_container_of(listener, roots_xdg_surface, set_parent);
-
-	if (roots_xdg_surface->xdg_surface_v6->toplevel->parent) {
-		struct roots_xdg_surface *parent = roots_xdg_surface->xdg_surface_v6->toplevel->parent->data;
-		view_set_parent(&roots_xdg_surface->view, &parent->view);
-	} else {
-		view_set_parent(&roots_xdg_surface->view, NULL);
-	}
-}
-
-static void handle_surface_commit(struct wl_listener *listener, void *data) {
-	struct roots_xdg_surface_v6 *roots_surface =
-		wl_container_of(listener, roots_surface, surface_commit);
-	struct roots_view *view = &roots_surface->view;
-	struct wlr_xdg_surface_v6 *surface = roots_surface->xdg_surface_v6;
-
-	if (!surface->mapped) {
-		return;
-	}
-
-	view_apply_damage(view);
-
-	struct wlr_box size;
-	get_size(view, &size);
-	view_update_size(view, size.width, size.height);
-
-	uint32_t pending_serial =
-		roots_surface->pending_move_resize_configure_serial;
-	if (pending_serial > 0 && pending_serial >= surface->configure_serial) {
-		double x = view->box.x;
-		double y = view->box.y;
-		if (view->pending_move_resize.update_x) {
-			x = view->pending_move_resize.x + view->pending_move_resize.width -
-				size.width;
-		}
-		if (view->pending_move_resize.update_y) {
-			y = view->pending_move_resize.y + view->pending_move_resize.height -
-				size.height;
-		}
-		view_update_position(view, x, y);
-
-		if (pending_serial == surface->configure_serial) {
-			roots_surface->pending_move_resize_configure_serial = 0;
-		}
-	}
-}
-
-static void handle_new_popup(struct wl_listener *listener, void *data) {
-	struct roots_xdg_surface_v6 *roots_xdg_surface =
-		wl_container_of(listener, roots_xdg_surface, new_popup);
-	struct wlr_xdg_popup_v6 *wlr_popup = data;
-	popup_create(&roots_xdg_surface->view, wlr_popup);
-}
-
-static void handle_map(struct wl_listener *listener, void *data) {
-	struct roots_xdg_surface_v6 *roots_xdg_surface =
-		wl_container_of(listener, roots_xdg_surface, map);
-	struct roots_view *view = &roots_xdg_surface->view;
-
-	struct wlr_box box;
-	get_size(view, &box);
-	view->box.width = box.width;
-	view->box.height = box.height;
-
-	view_map(view, roots_xdg_surface->xdg_surface_v6->surface);
-	view_setup(view);
-}
-
-static void handle_unmap(struct wl_listener *listener, void *data) {
-	struct roots_xdg_surface_v6 *roots_xdg_surface =
-		wl_container_of(listener, roots_xdg_surface, unmap);
-	view_unmap(&roots_xdg_surface->view);
-}
-
-static void handle_destroy(struct wl_listener *listener, void *data) {
-	struct roots_xdg_surface_v6 *roots_xdg_surface =
-		wl_container_of(listener, roots_xdg_surface, destroy);
-	view_destroy(&roots_xdg_surface->view);
-}
-
-void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
-	struct wlr_xdg_surface_v6 *surface = data;
-	assert(surface->role != WLR_XDG_SURFACE_V6_ROLE_NONE);
-
-	if (surface->role == WLR_XDG_SURFACE_V6_ROLE_POPUP) {
-		wlr_log(WLR_DEBUG, "new xdg popup");
-		return;
-	}
-
-	PhocDesktop *desktop =
-		wl_container_of(listener, desktop, xdg_shell_v6_surface);
-
-	wlr_log(WLR_DEBUG, "new xdg toplevel: title=%s, app_id=%s",
-		surface->toplevel->title, surface->toplevel->app_id);
-	wlr_xdg_surface_v6_ping(surface);
-
-	struct roots_xdg_surface_v6 *roots_surface =
-		calloc(1, sizeof(struct roots_xdg_surface_v6));
-	if (!roots_surface) {
-		return;
-	}
-
-	view_init(&roots_surface->view, &view_impl, ROOTS_XDG_SHELL_V6_VIEW, desktop);
-	roots_surface->xdg_surface_v6 = surface;
-	surface->data = roots_surface;
-
-	// catch up with state accumulated before commiting
-	if (surface->toplevel->parent) {
-		struct roots_xdg_surface* parent = surface->toplevel->parent->data;
-		view_set_parent(&roots_surface->view, &parent->view);
-	}
-	view_maximize(&roots_surface->view, surface->toplevel->client_pending.maximized);
-	view_set_fullscreen(&roots_surface->view, surface->toplevel->client_pending.fullscreen,
-		surface->toplevel->client_pending.fullscreen_output);
-	view_auto_maximize(&roots_surface->view);
-	view_set_title(&roots_surface->view, surface->toplevel->title);
-	view_set_app_id(&roots_surface->view, surface->toplevel->app_id);
-
-	roots_surface->surface_commit.notify = handle_surface_commit;
-	wl_signal_add(&surface->surface->events.commit,
-		&roots_surface->surface_commit);
-	roots_surface->destroy.notify = handle_destroy;
-	wl_signal_add(&surface->events.destroy, &roots_surface->destroy);
-	roots_surface->map.notify = handle_map;
-	wl_signal_add(&surface->events.map, &roots_surface->map);
-	roots_surface->unmap.notify = handle_unmap;
-	wl_signal_add(&surface->events.unmap, &roots_surface->unmap);
-	roots_surface->request_move.notify = handle_request_move;
-	wl_signal_add(&surface->toplevel->events.request_move,
-		&roots_surface->request_move);
-	roots_surface->request_resize.notify = handle_request_resize;
-	wl_signal_add(&surface->toplevel->events.request_resize,
-		&roots_surface->request_resize);
-	roots_surface->request_maximize.notify = handle_request_maximize;
-	wl_signal_add(&surface->toplevel->events.request_maximize,
-		&roots_surface->request_maximize);
-	roots_surface->request_fullscreen.notify = handle_request_fullscreen;
-	wl_signal_add(&surface->toplevel->events.request_fullscreen,
-		&roots_surface->request_fullscreen);
-	roots_surface->set_title.notify = handle_set_title;
-	wl_signal_add(&surface->toplevel->events.set_title,
-		&roots_surface->set_title);
-	roots_surface->set_app_id.notify = handle_set_app_id;
-	wl_signal_add(&surface->toplevel->events.set_app_id,
-		&roots_surface->set_app_id);
-	roots_surface->set_parent.notify = handle_set_parent;
-	wl_signal_add(&surface->toplevel->events.set_parent,
-		&roots_surface->set_parent);
-	roots_surface->new_popup.notify = handle_new_popup;
-	wl_signal_add(&surface->events.new_popup, &roots_surface->new_popup);
-}
-
-struct roots_xdg_surface_v6 *roots_xdg_surface_v6_from_view(
-		struct roots_view *view) {
-	assert(view->impl == &view_impl);
-	return (struct roots_xdg_surface_v6 *)view;
-}


=====================================
src/xwayland.c
=====================================
@@ -13,6 +13,25 @@
 #include <wlr/xwayland.h>
 #include "server.h"
 #include "view.h"
+#include "xwayland.h"
+
+static
+bool is_moveable(struct roots_view *view)
+{
+	PhocServer *server = phoc_server_get_default ();
+	struct wlr_xwayland_surface *xwayland_surface =
+		roots_xwayland_surface_from_view (view)->xwayland_surface;
+
+	if (xwayland_surface->window_type == NULL)
+		return true;
+
+	for (guint i = 0; i < xwayland_surface->window_type_len; i++)
+		if (xwayland_surface->window_type[i] != server->desktop->xwayland_atoms[NET_WM_WINDOW_TYPE_NORMAL] &&
+		    xwayland_surface->window_type[i] != server->desktop->xwayland_atoms[NET_WM_WINDOW_TYPE_DIALOG])
+			return false;
+
+	return true;
+}
 
 static void activate(struct roots_view *view, bool active) {
 	struct wlr_xwayland_surface *xwayland_surface =
@@ -23,17 +42,24 @@ static void activate(struct roots_view *view, bool active) {
 static void move(struct roots_view *view, double x, double y) {
 	struct wlr_xwayland_surface *xwayland_surface =
 		roots_xwayland_surface_from_view(view)->xwayland_surface;
+
+	if (!is_moveable (view))
+		return;
+
 	view_update_position(view, x, y);
 	wlr_xwayland_surface_configure(xwayland_surface, x, y,
 		xwayland_surface->width, xwayland_surface->height);
 }
 
-static void apply_size_constraints(
+static void apply_size_constraints(struct roots_view *view,
 		struct wlr_xwayland_surface *xwayland_surface, uint32_t width,
 		uint32_t height, uint32_t *dest_width, uint32_t *dest_height) {
 	*dest_width = width;
 	*dest_height = height;
 
+	if (view_is_maximized(view))
+		return;
+
 	struct wlr_xwayland_surface_size_hints *size_hints =
 		xwayland_surface->size_hints;
 	if (size_hints != NULL) {
@@ -57,7 +83,7 @@ static void resize(struct roots_view *view, uint32_t width, uint32_t height) {
 		roots_xwayland_surface_from_view(view)->xwayland_surface;
 
 	uint32_t constrained_width, constrained_height;
-	apply_size_constraints(xwayland_surface, width, height, &constrained_width,
+	apply_size_constraints(view, xwayland_surface, width, height, &constrained_width,
 		&constrained_height);
 
 	wlr_xwayland_surface_configure(xwayland_surface, xwayland_surface->x,
@@ -69,11 +95,16 @@ static void move_resize(struct roots_view *view, double x, double y,
 	struct wlr_xwayland_surface *xwayland_surface =
 		roots_xwayland_surface_from_view(view)->xwayland_surface;
 
+	if (!is_moveable (view)) {
+		x = view->box.x;
+		y = view->box.y;
+	}
+
 	bool update_x = x != view->box.x;
 	bool update_y = y != view->box.y;
 
 	uint32_t constrained_width, constrained_height;
-	apply_size_constraints(xwayland_surface, width, height, &constrained_width,
+	apply_size_constraints(view, xwayland_surface, width, height, &constrained_width,
 		&constrained_height);
 
 	if (update_x) {
@@ -106,7 +137,15 @@ static bool want_scaling(struct roots_view *view) {
 }
 
 static bool want_auto_maximize(struct roots_view *view) {
-	return false;
+	struct wlr_xwayland_surface *surface =
+		roots_xwayland_surface_from_view(view)->xwayland_surface;
+
+	if (surface->size_hints &&
+	    (surface->size_hints->min_width > 0 && surface->size_hints->min_width == surface->size_hints->max_width) &&
+	    (surface->size_hints->min_height > 0 && surface->size_hints->min_height == surface->size_hints->max_height))
+		return false;
+
+	return is_moveable(view);
 }
 
 static void maximize(struct roots_view *view, bool maximized) {
@@ -289,6 +328,9 @@ static void handle_map(struct wl_listener *listener, void *data) {
 	wl_signal_add(&surface->surface->events.commit,
 		&roots_surface->surface_commit);
 
+	view_maximize(view, surface->maximized_horz && surface->maximized_vert);
+	view_auto_maximize(view);
+
 	view_map(view, surface->surface);
 
 	if (!surface->override_redirect) {
@@ -331,6 +373,8 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
 	view_init(&roots_surface->view, &view_impl, ROOTS_XWAYLAND_VIEW, desktop);
 	roots_surface->view.box.x = surface->x;
 	roots_surface->view.box.y = surface->y;
+	roots_surface->view.box.width = surface->width;
+	roots_surface->view.box.height = surface->height;
 	roots_surface->xwayland_surface = surface;
 
 	view_set_title(&roots_surface->view, surface->title);


=====================================
src/xwayland.h
=====================================
@@ -0,0 +1,10 @@
+#pragma once
+
+#include <wlr/xwayland.h>
+#include <xcb/xproto.h>
+
+enum xwayland_atom_name {
+	NET_WM_WINDOW_TYPE_NORMAL,
+	NET_WM_WINDOW_TYPE_DIALOG,
+	XWAYLAND_ATOM_LAST
+};


=====================================
subprojects/wlroots
=====================================
@@ -1 +1 @@
-Subproject commit 59f7adfe2977c3cb27a8def72c0d9fc2f2926c6d
+Subproject commit 7723a09a226d812aa51d1439c2b5e8e21238d45c



View it on GitLab: https://salsa.debian.org/DebianOnMobile-team/phoc/-/compare/0be2173791e709e8d07d5916ad12adbba614a799...816bdf318ba97badd2b3834c714026f05a3fb5d5

-- 
View it on GitLab: https://salsa.debian.org/DebianOnMobile-team/phoc/-/compare/0be2173791e709e8d07d5916ad12adbba614a799...816bdf318ba97badd2b3834c714026f05a3fb5d5
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/20201008/3c054b4b/attachment-0001.html>


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