static void
create_border(struct wayland_compositor *c)
{
- uint32_t *pixels, stride;
+ pixman_image_t *image;
- pixels = weston_load_image(DATADIR "/weston/border.png",
- &c->border.width,
- &c->border.height, &stride);
- if (!pixels) {
+ image = load_image(DATADIR "/weston/border.png");
+ if (!image) {
fprintf(stderr, "could'nt load border image\n");
return;
}
+ c->border.width = pixman_image_get_width(image);
+ c->border.height = pixman_image_get_height(image);
+
glGenTextures(1, &c->border.texture);
glBindTexture(GL_TEXTURE_2D, c->border.texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA_EXT,
c->border.width,
c->border.height,
- 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, pixels);
+ 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE,
+ pixman_image_get_data(image));
c->border.top = 25;
c->border.bottom = 50;
c->border.left = 25;
c->border.right = 25;
+
+ pixman_image_unref(image);
}
static int
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_ALPHA_SIZE, 1,
- EGL_DEPTH_SIZE, 1,
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_NONE
};
}
static void
+input_handle_axis(void *data, struct wl_input_device *input_device,
+ uint32_t time, uint32_t axis, int32_t value)
+{
+ struct wayland_input *input = data;
+ struct wayland_compositor *c = input->compositor;
+
+ notify_axis(c->base.input_device, time, axis, value);
+}
+
+static void
input_handle_key(void *data, struct wl_input_device *input_device,
uint32_t time, uint32_t key, uint32_t state)
{
static const struct wl_input_device_listener input_device_listener = {
input_handle_motion,
input_handle_button,
+ input_handle_axis,
input_handle_key,
input_handle_pointer_enter,
input_handle_pointer_leave,
return &c->base;
}
-struct weston_compositor *
-backend_init(struct wl_display *display, char *options);
-
WL_EXPORT struct weston_compositor *
-backend_init(struct wl_display *display, char *options)
+backend_init(struct wl_display *display, int argc, char *argv[])
{
- int width = 1024, height = 640, i;
- char *p, *value, *display_name = NULL;
-
- static char * const tokens[] = { "width", "height", "display", NULL };
-
- p = options;
- while (i = getsubopt(&p, tokens, &value), i != -1) {
- switch (i) {
- case 0:
- width = strtol(value, NULL, 0);
- break;
- case 1:
- height = strtol(value, NULL, 0);
- break;
- case 2:
- display_name = strdup(value);
- break;
- }
- }
+ int width = 1024, height = 640;
+ char *display_name = NULL;
+
+ const struct weston_option wayland_options[] = {
+ { WESTON_OPTION_INTEGER, "width", 0, &width },
+ { WESTON_OPTION_INTEGER, "height", 0, &height },
+ { WESTON_OPTION_STRING, "display", 0, &display_name },
+ };
+
+ parse_options(wayland_options,
+ ARRAY_LENGTH(wayland_options), argc, argv);
return wayland_compositor_create(display, width, height, display_name);
}