xwm: Support _NET_WM_STATE_FULLSCREEN

We can now handle fullscreen X windows.  X clients request to go fullscreen
buy sending a _NET_WM_STATE client message to the root window.  When that
happens we call into the shell interface and asks the shell to make the
surface fullscreen.  The shell will then resize the window, which causes
the X wm to configure the X window appropriately.

Make sure we ignore configure requests from fullscreened clients and send out
the synthetic configure notify as required in that case.

Finally, inspect _NET_WM_STATE before mapping so we can handle initial
fullscreen correctly.
diff --git a/src/shell.c b/src/shell.c
index 368fa5b..72d2a73 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -1754,17 +1754,15 @@
 }
 
 static void
-shell_surface_set_fullscreen(struct wl_client *client,
-			     struct wl_resource *resource,
-			     uint32_t method,
-			     uint32_t framerate,
-			     struct wl_resource *output_resource)
+set_fullscreen(struct shell_surface *shsurf,
+	       uint32_t method,
+	       uint32_t framerate,
+	       struct weston_output *output)
 {
-	struct shell_surface *shsurf = resource->data;
 	struct weston_surface *es = shsurf->surface;
 
-	if (output_resource)
-		shsurf->output = output_resource->data;
+	if (output)
+		shsurf->output = output;
 	else if (es->output)
 		shsurf->output = es->output;
 	else
@@ -1781,6 +1779,24 @@
 }
 
 static void
+shell_surface_set_fullscreen(struct wl_client *client,
+			     struct wl_resource *resource,
+			     uint32_t method,
+			     uint32_t framerate,
+			     struct wl_resource *output_resource)
+{
+	struct shell_surface *shsurf = resource->data;
+	struct weston_output *output;
+
+	if (output_resource)
+		output = output_resource->data;
+	else
+		output = NULL;
+
+	set_fullscreen(shsurf, method, framerate, output);
+}
+
+static void
 popup_grab_focus(struct wl_pointer_grab *grab,
 		 struct wl_surface *surface,
 		 wl_fixed_t x,
@@ -3832,6 +3848,7 @@
 	ec->shell_interface.create_shell_surface = create_shell_surface;
 	ec->shell_interface.set_toplevel = set_toplevel;
 	ec->shell_interface.set_transient = set_transient;
+	ec->shell_interface.set_fullscreen = set_fullscreen;
 	ec->shell_interface.move = surface_move;
 	ec->shell_interface.resize = surface_resize;