aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeff Becker <ampernand@gmail.com>2016-10-17 10:05:29 -0400
committerJeff Becker <ampernand@gmail.com>2016-10-17 10:05:29 -0400
commitce1da9219745261f04610cd1846c6438d7ab8c4d (patch)
tree39b309ca99ca3b9843eb1aeb3e40ec9f7a062f9f /src
parentc7364b21084917e6dc4b166a8a2e9896fda6573d (diff)
downloadwterm-ce1da9219745261f04610cd1846c6438d7ab8c4d.zip
wterm-ce1da9219745261f04610cd1846c6438d7ab8c4d.tar.gz
wterm-ce1da9219745261f04610cd1846c6438d7ab8c4d.tar.bz2
make it compile
Diffstat (limited to 'src')
-rw-r--r--src/st.c7
-rw-r--r--src/wld/buffer.c2
-rw-r--r--src/wld/buffered_surface.c2
-rw-r--r--src/wld/color.c2
-rw-r--r--src/wld/context.c2
-rw-r--r--src/wld/drm-private.h46
-rw-r--r--src/wld/drm.c4
-rw-r--r--src/wld/drm.h52
-rw-r--r--src/wld/dumb.c6
-rw-r--r--src/wld/font.c2
-rw-r--r--src/wld/intel/intel.c (renamed from src/wld/intel.c)18
-rw-r--r--src/wld/nouveau/nouveau.c14
-rw-r--r--src/wld/pixman.c4
-rw-r--r--src/wld/pixman.h44
-rw-r--r--src/wld/renderer.c2
-rw-r--r--src/wld/surface.c2
-rw-r--r--src/wld/wayland-drm.c10
-rw-r--r--src/wld/wayland-private.h60
-rw-r--r--src/wld/wayland-shm.c8
-rw-r--r--src/wld/wayland.c6
-rw-r--r--src/wld/wayland.h84
-rw-r--r--src/wld/wld-private.h243
-rw-r--r--src/wld/wld.h283
23 files changed, 47 insertions, 856 deletions
diff --git a/src/st.c b/src/st.c
index 871b0de..abad585 100644
--- a/src/st.c
+++ b/src/st.c
@@ -44,7 +44,6 @@ char *argv0;
#include <libutil.h>
#endif
-
/* Arbitrary sizes */
#define UTF_INVALID 0xFFFD
#define UTF_SIZ 4
@@ -3203,8 +3202,12 @@ wlinit(void)
registry = wl_display_get_registry(wl.dpy);
wl_registry_add_listener(registry, &reglistener, NULL);
- wld.ctx = wld_wayland_create_context(wl.dpy, WLD_SHM);
+ wld.ctx = wld_wayland_create_context(wl.dpy, WLD_ANY);
+ if(!wld.ctx)
+ die("could not create wayland context");
wld.renderer = wld_create_renderer(wld.ctx);
+ if(!wld.renderer)
+ die("could not create wayland rendering context");
wl_display_roundtrip(wl.dpy);
if (!wl.shm)
diff --git a/src/wld/buffer.c b/src/wld/buffer.c
index 46b1b3b..2426037 100644
--- a/src/wld/buffer.c
+++ b/src/wld/buffer.c
@@ -21,7 +21,7 @@
* SOFTWARE.
*/
-#include "wld-private.h"
+#include "wld/wld-private.h"
void buffer_initialize(struct buffer * buffer,
const struct wld_buffer_impl * impl,
diff --git a/src/wld/buffered_surface.c b/src/wld/buffered_surface.c
index e3d9133..4687554 100644
--- a/src/wld/buffered_surface.c
+++ b/src/wld/buffered_surface.c
@@ -21,7 +21,7 @@
* SOFTWARE.
*/
-#include "wld-private.h"
+#include "wld/wld-private.h"
#include "interface/surface.h"
IMPL(buffered_surface, wld_surface)
diff --git a/src/wld/color.c b/src/wld/color.c
index 88e791a..94785f8 100644
--- a/src/wld/color.c
+++ b/src/wld/color.c
@@ -46,7 +46,7 @@ SOFTWARE.
******************************************************************/
-#include "wld-private.h"
+#include "wld/wld-private.h"
#include <strings.h>
diff --git a/src/wld/context.c b/src/wld/context.c
index a735d40..af2d5bd 100644
--- a/src/wld/context.c
+++ b/src/wld/context.c
@@ -21,7 +21,7 @@
* SOFTWARE.
*/
-#include "wld-private.h"
+#include "wld/wld-private.h"
void context_initialize(struct wld_context * context,
const struct wld_context_impl * impl)
diff --git a/src/wld/drm-private.h b/src/wld/drm-private.h
deleted file mode 100644
index 6c36088..0000000
--- a/src/wld/drm-private.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* wld: drm-private.h
- *
- * Copyright (c) 2013, 2014 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 WLD_DRM_PRIVATE_H
-#define WLD_DRM_PRIVATE_H
-
-#include "wld-private.h"
-
-struct drm_driver
-{
- const char * name;
- bool (* device_supported)(uint32_t vendor_id, uint32_t device_id);
- struct wld_context * (* create_context)(int drm_fd);
-};
-
-#if WITH_DRM_INTEL
-extern const struct drm_driver intel_drm_driver;
-#endif
-#if WITH_DRM_NOUVEAU
-extern const struct drm_driver nouveau_drm_driver;
-#endif
-extern const struct drm_driver dumb_drm_driver;
-extern const struct wld_context_impl * dumb_context_impl;
-
-#endif
-
diff --git a/src/wld/drm.c b/src/wld/drm.c
index 2768640..e2f6180 100644
--- a/src/wld/drm.c
+++ b/src/wld/drm.c
@@ -21,8 +21,8 @@
* SOFTWARE.
*/
-#include "drm.h"
-#include "drm-private.h"
+#include "wld/drm.h"
+#include "wld/drm-private.h"
#include <sys/sysmacros.h>
diff --git a/src/wld/drm.h b/src/wld/drm.h
deleted file mode 100644
index 20ee3e8..0000000
--- a/src/wld/drm.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* wld: drm.h
- *
- * Copyright (c) 2013, 2014 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 WLD_DRM_H
-#define WLD_DRM_H
-
-#include <stdbool.h>
-#include <stdint.h>
-
-#define WLD_DRM_ID (0x02 << 24)
-
-enum wld_drm_object_type
-{
- WLD_DRM_OBJECT_HANDLE = WLD_DRM_ID,
- WLD_DRM_OBJECT_PRIME_FD,
-};
-
-enum wld_drm_flags
-{
- WLD_DRM_FLAG_SCANOUT = 0x1,
- WLD_DRM_FLAG_TILED = 0x2
-};
-
-/**
- * Create a new WLD context from an opened DRM device file descriptor.
- */
-struct wld_context * wld_drm_create_context(int fd);
-
-bool wld_drm_is_dumb(struct wld_context * context);
-
-#endif
-
diff --git a/src/wld/dumb.c b/src/wld/dumb.c
index b08d098..340ba16 100644
--- a/src/wld/dumb.c
+++ b/src/wld/dumb.c
@@ -21,9 +21,9 @@
* SOFTWARE.
*/
-#include "drm-private.h"
-#include "drm.h"
-#include "pixman.h"
+#include "wld/drm-private.h"
+#include "wld/drm.h"
+#include "wld/pixman.h"
#include <fcntl.h>
#include <unistd.h>
diff --git a/src/wld/font.c b/src/wld/font.c
index 36b8a07..a43c3e6 100644
--- a/src/wld/font.c
+++ b/src/wld/font.c
@@ -21,7 +21,7 @@
* SOFTWARE.
*/
-#include "wld-private.h"
+#include "wld/wld-private.h"
#include <fontconfig/fcfreetype.h>
diff --git a/src/wld/intel.c b/src/wld/intel/intel.c
index 78c3c0f..4ee2c2e 100644
--- a/src/wld/intel.c
+++ b/src/wld/intel/intel.c
@@ -21,11 +21,11 @@
* SOFTWARE.
*/
-#include "drm-private.h"
-#include "drm.h"
-#include "intel/batch.h"
-#include "intel/blt.h"
-#include "wld-private.h"
+#include "wld/drm-private.h"
+#include "wld/drm.h"
+#include "batch.h"
+#include "blt.h"
+#include "wld/wld-private.h"
#include <unistd.h>
#include <intel_bufmgr.h>
@@ -51,11 +51,11 @@ struct intel_buffer
drm_intel_bo * bo;
};
-#include "interface/context.h"
-#include "interface/renderer.h"
-#include "interface/buffer.h"
+#include "../interface/context.h"
+#include "../interface/renderer.h"
+#include "../interface/buffer.h"
#define DRM_DRIVER_NAME intel
-#include "interface/drm.h"
+#include "../interface/drm.h"
IMPL(intel_context, wld_context)
IMPL(intel_renderer, wld_renderer)
IMPL(intel_buffer, wld_buffer)
diff --git a/src/wld/nouveau/nouveau.c b/src/wld/nouveau/nouveau.c
index 34829eb..7d2e364 100644
--- a/src/wld/nouveau/nouveau.c
+++ b/src/wld/nouveau/nouveau.c
@@ -26,9 +26,9 @@
* SOFTWARE.
*/
-#include "drm-private.h"
-#include "drm.h"
-#include "pixman.h"
+#include "wld/drm-private.h"
+#include "wld/drm.h"
+#include "wld/pixman.h"
#include "nv_object.xml.h"
#include "g80_2d.xml.h"
#include "g80_defs.xml.h"
@@ -70,11 +70,11 @@ struct nouveau_buffer
struct nouveau_bo * bo;
};
-#include "interface/context.h"
-#include "interface/renderer.h"
-#include "interface/buffer.h"
+#include "../interface/context.h"
+#include "../interface/renderer.h"
+#include "../interface/buffer.h"
#define DRM_DRIVER_NAME nouveau
-#include "interface/drm.h"
+#include "../interface/drm.h"
IMPL(nouveau_context, wld_context)
IMPL(nouveau_renderer, wld_renderer)
IMPL(nouveau_buffer, wld_buffer)
diff --git a/src/wld/pixman.c b/src/wld/pixman.c
index 5f14a7b..50a10ec 100644
--- a/src/wld/pixman.c
+++ b/src/wld/pixman.c
@@ -21,8 +21,8 @@
* SOFTWARE.
*/
-#include "pixman.h"
-#include "wld-private.h"
+#include "wld/pixman.h"
+#include "wld/wld-private.h"
#define PIXMAN_COLOR(c) { \
.alpha = ((c >> 24) & 0xff) * 0x101, \
diff --git a/src/wld/pixman.h b/src/wld/pixman.h
deleted file mode 100644
index c864385..0000000
--- a/src/wld/pixman.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* wld: pixman.h
- *
- * Copyright (c) 2013, 2014 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 WLD_PIXMAN_H
-#define WLD_PIXMAN_H
-
-#include <stdint.h>
-
-#define WLD_PIXMAN_ID (0x01 << 24)
-
-enum wld_pixman_object_type
-{
- WLD_PIXMAN_OBJECT_IMAGE = WLD_PIXMAN_ID
-};
-
-extern struct wld_context * wld_pixman_context;
-
-static inline struct wld_context * wld_pixman_create_context()
-{
- return wld_pixman_context;
-}
-
-#endif
-
diff --git a/src/wld/renderer.c b/src/wld/renderer.c
index a038095..b014eae 100644
--- a/src/wld/renderer.c
+++ b/src/wld/renderer.c
@@ -21,7 +21,7 @@
* SOFTWARE.
*/
-#include "wld-private.h"
+#include "wld/wld-private.h"
void default_fill_region(struct wld_renderer * renderer, uint32_t color,
pixman_region32_t * region)
diff --git a/src/wld/surface.c b/src/wld/surface.c
index 3f936bd..9e678de 100644
--- a/src/wld/surface.c
+++ b/src/wld/surface.c
@@ -21,7 +21,7 @@
* SOFTWARE.
*/
-#include "wld-private.h"
+#include "wld/wld-private.h"
struct wld_surface * default_create_surface(struct wld_context * context,
uint32_t width, uint32_t height,
diff --git a/src/wld/wayland-drm.c b/src/wld/wayland-drm.c
index 7e7fe4c..43695a3 100644
--- a/src/wld/wayland-drm.c
+++ b/src/wld/wayland-drm.c
@@ -21,12 +21,12 @@
* SOFTWARE.
*/
-#include "wayland.h"
-#include "drm.h"
+#include "wld/wayland.h"
+#include "wld/drm.h"
#include "wayland-drm-client-protocol.h"
-#include "wayland-private.h"
-#include "wld-private.h"
-#include "drm-private.h"
+#include "wld/wayland-private.h"
+#include "wld/wld-private.h"
+#include "wld/drm-private.h"
#include <stdlib.h>
#include <string.h>
diff --git a/src/wld/wayland-private.h b/src/wld/wayland-private.h
deleted file mode 100644
index f52e3ae..0000000
--- a/src/wld/wayland-private.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* wld: wayland-private.h
- *
- * Copyright (c) 2013, 2014 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 WLD_WAYLAND_PRIVATE_H
-#define WLD_WAYLAND_PRIVATE_H
-
-#include "wld.h"
-
-struct buffer;
-struct wl_display;
-struct wl_event_queue;
-struct wl_buffer;
-
-struct wayland_context
-{
- struct wld_context base;
- const struct wayland_impl * impl;
- struct wl_display * display;
- struct wl_event_queue * queue;
-};
-
-struct wayland_impl
-{
- struct wayland_context * (* create_context)(struct wl_display * display,
- struct wl_event_queue * queue);
- bool (* has_format)(struct wld_context * context, uint32_t format);
-};
-
-#if WITH_WAYLAND_DRM
-extern const struct wayland_impl drm_wayland_impl;
-#endif
-
-#if WITH_WAYLAND_SHM
-extern const struct wayland_impl shm_wayland_impl;
-#endif
-
-bool wayland_buffer_add_exporter(struct buffer * buffer, struct wl_buffer * wl);
-
-#endif
-
diff --git a/src/wld/wayland-shm.c b/src/wld/wayland-shm.c
index 520eb2c..19840f6 100644
--- a/src/wld/wayland-shm.c
+++ b/src/wld/wayland-shm.c
@@ -23,10 +23,10 @@
#define _GNU_SOURCE /* Required for mkostemp */
-#include "wayland.h"
-#include "wayland-private.h"
-#include "wld-private.h"
-#include "pixman.h"
+#include "wld/wayland.h"
+#include "wld/wayland-private.h"
+#include "wld/wld-private.h"
+#include "wld/pixman.h"
#include <fcntl.h>
#include <stdlib.h>
diff --git a/src/wld/wayland.c b/src/wld/wayland.c
index 40a4b34..b6a0d3c 100644
--- a/src/wld/wayland.c
+++ b/src/wld/wayland.c
@@ -21,9 +21,9 @@
* SOFTWARE.
*/
-#include "wayland.h"
-#include "wayland-private.h"
-#include "wld-private.h"
+#include "wld/wayland.h"
+#include "wld/wayland-private.h"
+#include "wld/wld-private.h"
#include <stdlib.h>
#include <wayland-client.h>
diff --git a/src/wld/wayland.h b/src/wld/wayland.h
deleted file mode 100644
index 3127ee6..0000000
--- a/src/wld/wayland.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* wld: wayland.h
- *
- * Copyright (c) 2013, 2014 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 WLD_WAYLAND_H
-#define WLD_WAYLAND_H
-
-#include <stdbool.h>
-#include <stdint.h>
-
-struct wl_display;
-struct wl_surface;
-
-#define WLD_WAYLAND_ID (0x3 << 24)
-
-enum wld_wayland_interface_id
-{
- /**
- * Give up on trying any new interfaces. This can be considered as a
- * sentinel for wld_wayland_create_context.
- */
- WLD_NONE = -2,
-
- /**
- * Try any available interface.
- */
- WLD_ANY = -1,
- WLD_DRM,
- WLD_SHM
-};
-
-enum wld_wayland_object_type
-{
- WLD_WAYLAND_OBJECT_BUFFER = WLD_WAYLAND_ID
-};
-
-/**
- * Create a new WLD context which uses various available Wayland interfaces
- * (such as wl_shm and wl_drm) to create wl_buffers backed by implementations
- * specific to the interface.
- *
- * You can specify the particular interface you want to use by specifying them
- * as arguments. Interfaces will be tried in the order they are given.
- *
- * The last argument must be either WLD_NONE or WLD_ANY.
- *
- * @see enum wld_wayland_interface_id
- */
-struct wld_context * wld_wayland_create_context
- (struct wl_display * display, enum wld_wayland_interface_id id, ...);
-
-struct wld_surface * wld_wayland_create_surface(struct wld_context * context,
- uint32_t width, uint32_t height,
- uint32_t format, uint32_t flags,
- struct wl_surface * surface);
-
-/**
- * Check if the wayland implementation supports a particular pixel format.
- *
- * @see enum wld_format
- */
-bool wld_wayland_has_format(struct wld_context * context, uint32_t format);
-
-#endif
-
diff --git a/src/wld/wld-private.h b/src/wld/wld-private.h
deleted file mode 100644
index e812b11..0000000
--- a/src/wld/wld-private.h
+++ /dev/null
@@ -1,243 +0,0 @@
-/* wld: wld-private.h
- *
- * Copyright (c) 2013, 2014 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 WLD_PRIVATE_H
-#define WLD_PRIVATE_H
-
-#include "wld.h"
-
-#include <assert.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_BITMAP_H
-
-#define ARRAY_LENGTH(array) (sizeof (array) / sizeof (array)[0])
-#if ENABLE_DEBUG
-# define DEBUG(format, ...) \
- fprintf(stderr, "# %s: " format, __func__, ## __VA_ARGS__)
-#else
-# define DEBUG(format, ...)
-#endif
-
-#define EXPORT __attribute__((visibility("default")))
-#define CONTAINER_OF(ptr, type, member) \
- ((type *)((uintptr_t) ptr - offsetof(type, member)))
-#define IMPL(impl_type, base_type) \
- static inline struct impl_type * impl_type(struct base_type * object) \
- { \
- assert(object->impl == &base_type ## _impl); \
- return (struct impl_type *) object; \
- }
-
-struct wld_font_context
-{
- FT_Library library;
-};
-
-struct glyph
-{
- FT_Bitmap bitmap;
-
- /**
- * The offset from the origin to the top left corner of the bitmap.
- */
- int16_t x, y;
-
- /**
- * The width to advance to the origin of the next character.
- */
- uint16_t advance;
-};
-
-struct font
-{
- struct wld_font base;
-
- struct wld_font_context * context;
- FT_Face face;
- struct glyph ** glyphs;
-};
-
-struct wld_context_impl
-{
- struct wld_renderer * (* create_renderer)(struct wld_context * context);
- struct buffer * (* create_buffer)(struct wld_context * context,
- uint32_t width, uint32_t height,
- uint32_t format, uint32_t flags);
- struct buffer * (* import_buffer)(struct wld_context * context,
- uint32_t type, union wld_object object,
- uint32_t width, uint32_t height,
- uint32_t format, uint32_t pitch);
- struct wld_surface * (* create_surface)(struct wld_context * context,
- uint32_t width, uint32_t height,
- uint32_t format, uint32_t flags);
- void (* destroy)(struct wld_context * context);
-};
-
-struct wld_renderer_impl
-{
- uint32_t (* capabilities)(struct wld_renderer * renderer,
- struct buffer * buffer);
- bool (* set_target)(struct wld_renderer * renderer, struct buffer * buffer);
- void (* fill_rectangle)(struct wld_renderer * renderer,
- uint32_t color, int32_t x, int32_t y,
- uint32_t width, uint32_t height);
- void (* fill_region)(struct wld_renderer * renderer,
- uint32_t color, pixman_region32_t * region);
- void (* copy_rectangle)(struct wld_renderer * renderer, struct buffer * src,
- int32_t dst_x, int32_t dst_y,
- int32_t src_x, int32_t src_y,
- uint32_t width, uint32_t height);
- void (* copy_region)(struct wld_renderer * renderer, struct buffer * src,
- int32_t dst_x, int32_t dst_y,
- pixman_region32_t * region);
- void (* draw_text)(struct wld_renderer * renderer,
- struct font * font, uint32_t color,
- int32_t x, int32_t y, const char * text, uint32_t length,
- struct wld_extents * extents);
- void (* flush)(struct wld_renderer * renderer);
- void (* destroy)(struct wld_renderer * renderer);
-};
-
-struct buffer
-{
- struct wld_buffer base;
-
- unsigned references, map_references;
- struct wld_exporter * exporters;
- struct wld_destructor * destructors;
-};
-
-struct wld_buffer_impl
-{
- bool (* map)(struct buffer * buffer);
- bool (* unmap)(struct buffer * buffer);
- void (* destroy)(struct buffer * buffer);
-};
-
-struct wld_surface_impl
-{
- pixman_region32_t * (* damage)(struct wld_surface * surface,
- pixman_region32_t * damage);
- struct buffer * (* back)(struct wld_surface * surface);
- struct buffer * (* take)(struct wld_surface * surface);
- bool (* release)(struct wld_surface * surface, struct buffer * buffer);
- bool (* swap)(struct wld_surface * surface);
- void (* destroy)(struct wld_surface * surface);
-};
-
-struct buffer_socket
-{
- const struct buffer_socket_impl * impl;
-};
-
-struct buffer_socket_impl
-{
- bool (* attach)(struct buffer_socket * socket, struct buffer * buffer);
- void (* process)(struct buffer_socket * socket);
- void (* destroy)(struct buffer_socket * socket);
-};
-
-bool font_ensure_glyph(struct font * font, FT_UInt glyph_index);
-
-/**
- * Returns the number of bytes per pixel for the given format.
- */
-static inline uint8_t format_bytes_per_pixel(enum wld_format format)
-{
- switch (format)
- {
- case WLD_FORMAT_ARGB8888:
- case WLD_FORMAT_XRGB8888:
- return 4;
- default:
- return 0;
- }
-}
-
-static inline pixman_format_code_t format_wld_to_pixman(uint32_t format)
-{
- switch (format)
- {
- case WLD_FORMAT_ARGB8888:
- return PIXMAN_a8r8g8b8;
- case WLD_FORMAT_XRGB8888:
- return PIXMAN_x8r8g8b8;
- default:
- return 0;
- }
-}
-
-static inline uint32_t format_pixman_to_wld(pixman_format_code_t format)
-{
- switch (format)
- {
- case PIXMAN_a8r8g8b8:
- return WLD_FORMAT_ARGB8888;
- case PIXMAN_x8r8g8b8:
- return WLD_FORMAT_XRGB8888;
- default:
- return 0;
- }
-}
-
-/**
- * This default fill_region method is implemented in terms of fill_rectangle.
- */
-void default_fill_region(struct wld_renderer * renderer, uint32_t color,
- pixman_region32_t * region);
-
-/**
- * This default copy_region method is implemented in terms of copy_rectangle.
- */
-void default_copy_region(struct wld_renderer * renderer, struct buffer * buffer,
- int32_t dst_x, int32_t dst_y,
- pixman_region32_t * region);
-
-struct wld_surface * default_create_surface(struct wld_context * context,
- uint32_t width, uint32_t height,
- uint32_t format, uint32_t flags);
-
-struct wld_surface * buffered_surface_create(struct wld_context * context,
- uint32_t width, uint32_t height,
- uint32_t format, uint32_t flags,
- struct buffer_socket * socket);
-
-void context_initialize(struct wld_context * context,
- const struct wld_context_impl * impl);
-
-void renderer_initialize(struct wld_renderer * renderer,
- const struct wld_renderer_impl * impl);
-
-void buffer_initialize(struct buffer * buffer,
- const struct wld_buffer_impl * impl,
- uint32_t width, uint32_t height,
- uint32_t format, uint32_t pitch);
-
-void surface_initialize(struct wld_surface * surface,
- const struct wld_surface_impl * impl);
-
-#endif
-
diff --git a/src/wld/wld.h b/src/wld/wld.h
deleted file mode 100644
index c36081c..0000000
--- a/src/wld/wld.h
+++ /dev/null
@@ -1,283 +0,0 @@
-/* wld: wld.h
- *
- * Copyright (c) 2013, 2014 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 WLD_H
-#define WLD_H
-
-#include <stdbool.h>
-#include <stdint.h>
-#include <pixman.h>
-#include <fontconfig/fontconfig.h>
-
-#define WLD_USER_ID (0xff << 24)
-
-#define __WLD_FOURCC(a, b, c, d) ( (a) \
- | ((b) << 8) \
- | ((c) << 16) \
- | ((d) << 24) )
-
-/**
- * Supported pixel formats.
- *
- * These formats can safely be interchanged with GBM and wl_drm formats.
- */
-enum wld_format
-{
- WLD_FORMAT_XRGB8888 = __WLD_FOURCC('X', 'R', '2', '4'),
- WLD_FORMAT_ARGB8888 = __WLD_FOURCC('A', 'R', '2', '4')
-};
-
-enum wld_flags
-{
- WLD_FLAG_MAP = 0x1 << 16
-};
-
-bool wld_lookup_named_color(const char * name, uint32_t * color);
-
-/**** WLD Context ****/
-
-enum wld_object_type
-{
- WLD_OBJECT_DATA
-};
-
-union wld_object
-{
- void * ptr;
- uint32_t u32;
- int i;
-};
-
-struct wld_context
-{
- const struct wld_context_impl * const impl;
-};
-
-struct wld_renderer * wld_create_renderer(struct wld_context * context);
-
-struct wld_buffer * wld_create_buffer(struct wld_context * context,
- uint32_t width, uint32_t height,
- uint32_t format, uint32_t flags);
-
-struct wld_buffer * wld_import_buffer(struct wld_context * context,
- uint32_t type, union wld_object object,
- uint32_t width, uint32_t height,
- uint32_t format, uint32_t pitch);
-
-struct wld_surface * wld_create_surface(struct wld_context * context,
- uint32_t width, uint32_t height,
- uint32_t format, uint32_t flags);
-
-void wld_destroy_context(struct wld_context * context);
-
-/**** Font Handling ****/
-
-struct wld_extents
-{
- uint32_t advance;
-};
-
-struct wld_font
-{
- uint32_t ascent, descent;
- uint32_t height;
- uint32_t max_advance;
-};
-
-/**
- * Create a new font context.
- *
- * This sets up the underlying FreeType library.
- */
-struct wld_font_context * wld_font_create_context();
-
-/**
- * Destroy a font context.
- */
-void wld_font_destroy_context(struct wld_font_context * context);
-
-/**
- * Open a new font from the given fontconfig match.
- */
-struct wld_font * wld_font_open_pattern(struct wld_font_context * context,
- FcPattern * match);
-
-/**
- * Open a new font from a fontconfig pattern string.
- */
-struct wld_font * wld_font_open_name(struct wld_font_context * context,
- const char * name);
-
-/**
- * Close a font.
- */
-void wld_font_close(struct wld_font * font);
-
-/**
- * Check if the given font has a particular character (in UTF-32), and if so,
- * load the glyph.
- */
-bool wld_font_ensure_char(struct wld_font * font, uint32_t character);
-
-/**
- * Calculate the text extents of the given UTF-8 string.
- *
- * @param length The maximum number of bytes in the string to process
- */
-void wld_font_text_extents_n(struct wld_font * font,
- const char * text, int32_t length,
- struct wld_extents * extents);
-
-static inline void wld_font_text_extents(struct wld_font * font,
- const char * text,
- struct wld_extents * extents)
-{
- wld_font_text_extents_n(font, text, INT32_MAX, extents);
-}
-
-/**** Buffers ****/
-
-struct wld_exporter
-{
- bool (* export)(struct wld_exporter * exporter, struct wld_buffer * buffer,
- uint32_t type, union wld_object * object);
- struct wld_exporter * next;
-};
-
-struct wld_destructor
-{
- void (* destroy)(struct wld_destructor * destructor);
- struct wld_destructor * next;
-};
-
-struct wld_buffer
-{
- const struct wld_buffer_impl * const impl;
-
- uint32_t width, height, pitch;
- enum wld_format format;
- pixman_region32_t damage;
- void * map;
-};
-
-bool wld_map(struct wld_buffer * buffer);
-bool wld_unmap(struct wld_buffer * buffer);
-
-bool wld_export(struct wld_buffer * buffer,
- uint32_t type, union wld_object * object);
-
-void wld_buffer_add_exporter(struct wld_buffer * buffer,
- struct wld_exporter * exporter);
-
-void wld_buffer_add_destructor(struct wld_buffer * buffer,
- struct wld_destructor * destructor);
-
-/**
- * Increase the reference count of a buffer.
- */
-void wld_buffer_reference(struct wld_buffer * buffer);
-
-/**
- * Decrease the reference count of a buffer.
- *
- * When the reference count drops to zero, the buffer will be destroyed.
- */
-void wld_buffer_unreference(struct wld_buffer * buffer);
-
-/**** Surfaces ****/
-
-struct wld_surface
-{
- const struct wld_surface_impl * const impl;
-};
-
-pixman_region32_t * wld_surface_damage(struct wld_surface * surface,
- pixman_region32_t * new_damage);
-
-struct wld_buffer * wld_surface_take(struct wld_surface * surface);
-
-void wld_surface_release(struct wld_surface * surface,
- struct wld_buffer * buffer);
-
-bool wld_swap(struct wld_surface * surface);
-
-void wld_destroy_surface(struct wld_surface * surface);
-
-/**** Renderers ****/
-
-struct wld_renderer
-{
- const struct wld_renderer_impl * const impl;
- struct wld_buffer * target;
-};
-
-enum wld_capability
-{
- WLD_CAPABILITY_READ = 1<<0,
- WLD_CAPABILITY_WRITE = 1<<1,
-};
-
-void wld_destroy_renderer(struct wld_renderer * renderer);
-
-uint32_t wld_capabilities(struct wld_renderer * renderer,
- struct wld_buffer * buffer);
-
-bool wld_set_target_buffer(struct wld_renderer * renderer,
- struct wld_buffer * buffer);
-
-bool wld_set_target_surface(struct wld_renderer * renderer,
- struct wld_surface * surface);
-
-void wld_fill_rectangle(struct wld_renderer * renderer, uint32_t color,
- int32_t x, int32_t y, uint32_t width, uint32_t height);
-
-void wld_fill_region(struct wld_renderer * renderer, uint32_t color,
- pixman_region32_t * region);
-
-void wld_copy_rectangle(struct wld_renderer * renderer,
- struct wld_buffer * buffer,
- int32_t dst_x, int32_t dst_y,
- int32_t src_x, int32_t src_y,
- uint32_t width, uint32_t height);
-
-void wld_copy_region(struct wld_renderer * renderer,
- struct wld_buffer * buffer,
- int32_t dst_x, int32_t dst_y, pixman_region32_t * region);
-
-/**
- * Draw a UTF-8 text string to the given buffer.
- *
- * @param length The maximum number of bytes in the string to process. If
- * length is -1, then draw until a NULL byte is found.
- * @param extents If not NULL, will be initialized to the extents of the
- * drawn text
- */
-void wld_draw_text(struct wld_renderer * renderer,
- struct wld_font * font, uint32_t color,
- int32_t x, int32_t y, const char * text, uint32_t length,
- struct wld_extents * extents);
-
-void wld_flush(struct wld_renderer * renderer);
-
-#endif
-