commit 94d46f739b288001a81b136fb8abec32491ddd1a
parent 5009ed3dcc749dae5ceb72c98c3dd606dcc48f5f
Author: Michael Forney <mforney@mforney.org>
Date: Sun, 15 Mar 2015 08:56:42 +0000
Implement subcompositor stubs
Diffstat:
6 files changed, 283 insertions(+), 13 deletions(-)
diff --git a/libswc/local.mk b/libswc/local.mk
@@ -43,6 +43,8 @@ SWC_SOURCES = \
libswc/shell.c \
libswc/shell_surface.c \
libswc/shm.c \
+ libswc/subcompositor.c \
+ libswc/subsurface.c \
libswc/surface.c \
libswc/swc.c \
libswc/util.c \
diff --git a/libswc/subcompositor.c b/libswc/subcompositor.c
@@ -0,0 +1,81 @@
+/* swc: libswc/subcompositor.c
+ *
+ * Copyright (c) 2015 Michael Forney
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "swc.h"
+#include "internal.h"
+#include "subcompositor.h"
+#include "subsurface.h"
+
+static struct wl_global * global;
+
+static void get_subsurface(struct wl_client * client,
+ struct wl_resource * resource,
+ uint32_t id,
+ struct wl_resource * surface_resource,
+ struct wl_resource * parent_resource)
+{
+ struct subsurface * subsurface;
+
+ subsurface = subsurface_new(client, wl_resource_get_version(resource), id);
+
+ if (!subsurface)
+ {
+ wl_resource_post_no_memory(resource);
+ return;
+ }
+}
+
+static struct wl_subcompositor_interface subcompositor_implementation = {
+ .get_subsurface = &get_subsurface,
+};
+
+static void bind_subcompositor(struct wl_client * client, void * data,
+ uint32_t version, uint32_t id)
+{
+ struct wl_resource * resource;
+
+ if (version > 1)
+ version = 1;
+
+ resource = wl_resource_create(client, &wl_subcompositor_interface,
+ version, id);
+ wl_resource_set_implementation(resource, &subcompositor_implementation,
+ NULL, NULL);
+}
+
+bool subcompositor_initialize()
+{
+ global = wl_global_create(swc.display, &wl_subcompositor_interface, 1,
+ NULL, &bind_subcompositor);
+
+ if (!global)
+ return false;
+
+ return true;
+}
+
+void subcompositor_finalize()
+{
+ wl_global_destroy(global);
+}
+
diff --git a/libswc/subcompositor.h b/libswc/subcompositor.h
@@ -0,0 +1,32 @@
+/* swc: libswc/subcompositor.h
+ *
+ * Copyright (c) 2015 Michael Forney
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef SWC_SUBCOMPOSITOR_H
+#define SWC_SUBCOMPOSITOR_H
+
+bool subcompositor_initialize();
+
+void subcompositor_finalize();
+
+#endif
+
diff --git a/libswc/subsurface.c b/libswc/subsurface.c
@@ -0,0 +1,106 @@
+/* swc: libswc/subsurface.c
+ *
+ * Copyright (c) 2015 Michael Forney
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "subsurface.h"
+
+#include <stdlib.h>
+#include <wayland-server.h>
+
+static void destroy(struct wl_client * client, struct wl_resource * resource)
+{
+ wl_resource_destroy(resource);
+}
+
+static void set_position(struct wl_client * client,
+ struct wl_resource * resource,
+ int32_t x, int32_t y)
+{
+ /* TODO: Implement. */
+}
+
+static void place_above(struct wl_client * client,
+ struct wl_resource * resource,
+ struct wl_resource * sibling_resource)
+{
+ /* TODO: Implement. */
+}
+
+static void place_below(struct wl_client * client,
+ struct wl_resource * resource,
+ struct wl_resource * sibling_resource)
+{
+ /* TODO: Implement. */
+}
+
+static void set_sync(struct wl_client * client, struct wl_resource * resource)
+{
+ /* TODO: Implement. */
+}
+
+static void set_desync(struct wl_client * client, struct wl_resource * resource)
+{
+ /* TODO: Implement. */
+}
+
+static struct wl_subsurface_interface subsurface_implementation = {
+ .destroy = &destroy,
+ .set_position = &set_position,
+ .place_above = &place_above,
+ .place_below = &place_below,
+ .set_sync = &set_sync,
+ .set_desync = &set_desync,
+};
+
+static void subsurface_destroy(struct wl_resource * resource)
+{
+ struct subsurface * subsurface = wl_resource_get_user_data(resource);
+
+ free(subsurface);
+}
+
+struct subsurface * subsurface_new(struct wl_client * client,
+ uint32_t version, uint32_t id)
+{
+ struct subsurface * subsurface;
+
+ if (!(subsurface = malloc(sizeof *subsurface)))
+ goto error0;
+
+ subsurface->resource = wl_resource_create(client, &wl_subsurface_interface,
+ version, id);
+
+ if (!subsurface->resource)
+ goto error1;
+
+ wl_resource_set_implementation(subsurface->resource,
+ &subsurface_implementation,
+ subsurface, &subsurface_destroy);
+
+ return subsurface;
+
+ error1:
+ free(subsurface);
+ error0:
+ return NULL;
+}
+
diff --git a/libswc/subsurface.h b/libswc/subsurface.h
@@ -0,0 +1,40 @@
+/* swc: libswc/subsurface.h
+ *
+ * Copyright (c) 2015 Michael Forney
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef SWC_SUBSURFACE_H
+#define SWC_SUBSURFACE_H
+
+#include <stdint.h>
+
+struct wl_client;
+
+struct subsurface
+{
+ struct wl_resource * resource;
+};
+
+struct subsurface * subsurface_new(struct wl_client * client,
+ uint32_t version, uint32_t id);
+
+#endif
+
diff --git a/libswc/swc.c b/libswc/swc.c
@@ -36,6 +36,7 @@
#include "seat.h"
#include "shell.h"
#include "shm.h"
+#include "subcompositor.h"
#include "util.h"
#include "window.h"
#include "xdg_shell.h"
@@ -145,53 +146,59 @@ bool swc_initialize(struct wl_display * display,
goto error3;
}
+ if (!subcompositor_initialize())
+ {
+ ERROR("Could not initialize subcompositor\n");
+ goto error4;
+ }
+
if (!screens_initialize())
{
ERROR("Could not initialize screens\n");
- goto error4;
+ goto error5;
}
if (!compositor_initialize())
{
ERROR("Could not initialize compositor\n");
- goto error5;
+ goto error6;
}
if (!data_device_manager_initialize())
{
ERROR("Could not initialize data device manager\n");
- goto error6;
+ goto error7;
}
if (!seat_initialize(default_seat))
{
ERROR("Could not initialize seat\n");
- goto error7;
+ goto error8;
}
if (!shell_initialize())
{
ERROR("Could not initialize shell\n");
- goto error8;
+ goto error9;
}
if (!xdg_shell_initialize())
{
ERROR("Could not initialize XDG shell\n");
- goto error9;
+ goto error10;
}
if (!panel_manager_initialize())
{
ERROR("Could not initialize panel manager\n");
- goto error10;
+ goto error11;
}
#ifdef ENABLE_XWAYLAND
if (!xserver_initialize())
{
ERROR("Could not initialize xwayland\n");
- goto error11;
+ goto error12;
}
#endif
@@ -200,17 +207,19 @@ bool swc_initialize(struct wl_display * display,
return true;
#ifdef ENABLE_XWAYLAND
- error11:
+ error12:
panel_manager_finalize();
#endif
- error10:
+ error11:
xdg_shell_finalize();
- error9:
+ error10:
shell_finalize();
- error8:
+ error9:
seat_finalize();
- error7:
+ error8:
data_device_manager_finalize();
+ error7:
+ subcompositor_finalize();
error6:
compositor_finalize();
error5: