2008-12-02 23:15:01 +03:00
|
|
|
/*
|
|
|
|
* Copyright © 2008 Kristian Høgsberg
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, distribute, and sell this software and its
|
|
|
|
* documentation for any purpose is hereby granted without fee, provided that
|
|
|
|
* the above copyright notice appear in all copies and that both that copyright
|
|
|
|
* notice and this permission notice appear in supporting documentation, and
|
|
|
|
* that the name of the copyright holders not be used in advertising or
|
|
|
|
* publicity pertaining to distribution of the software without specific,
|
|
|
|
* written prior permission. The copyright holders make no representations
|
|
|
|
* about the suitability of this software for any purpose. It is provided "as
|
|
|
|
* is" without express or implied warranty.
|
|
|
|
*
|
|
|
|
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
|
|
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
|
|
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
|
|
|
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
|
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
|
|
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
|
|
|
* OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2008-10-07 18:10:36 +04:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <sys/un.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <sys/poll.h>
|
|
|
|
|
2008-10-08 21:32:07 +04:00
|
|
|
#include "connection.h"
|
2008-11-24 07:41:08 +03:00
|
|
|
#include "wayland-util.h"
|
2008-10-08 21:32:07 +04:00
|
|
|
#include "wayland-client.h"
|
|
|
|
|
2008-10-07 18:10:36 +04:00
|
|
|
static const char socket_name[] = "\0wayland";
|
|
|
|
|
2008-11-24 07:41:08 +03:00
|
|
|
struct wl_global {
|
|
|
|
uint32_t id;
|
|
|
|
char *interface;
|
|
|
|
struct wl_list link;
|
|
|
|
};
|
|
|
|
|
2008-10-07 18:10:36 +04:00
|
|
|
struct wl_proxy {
|
2008-10-08 21:32:07 +04:00
|
|
|
struct wl_display *display;
|
2008-10-07 18:10:36 +04:00
|
|
|
uint32_t id;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct wl_display {
|
|
|
|
struct wl_proxy proxy;
|
2008-10-08 21:32:07 +04:00
|
|
|
struct wl_connection *connection;
|
|
|
|
int fd;
|
|
|
|
uint32_t id;
|
2008-11-07 22:27:23 +03:00
|
|
|
uint32_t mask;
|
2008-11-24 07:41:08 +03:00
|
|
|
struct wl_list global_list;
|
2008-12-19 01:55:33 +03:00
|
|
|
struct wl_list visual_list;
|
2008-11-07 22:27:23 +03:00
|
|
|
|
|
|
|
wl_display_update_func_t update;
|
|
|
|
void *update_data;
|
2008-11-02 18:55:25 +03:00
|
|
|
|
|
|
|
wl_display_event_func_t event_handler;
|
|
|
|
void *event_handler_data;
|
2008-10-07 18:10:36 +04:00
|
|
|
};
|
|
|
|
|
2008-12-16 04:35:24 +03:00
|
|
|
struct wl_compositor {
|
|
|
|
struct wl_proxy proxy;
|
|
|
|
};
|
|
|
|
|
2008-10-07 18:10:36 +04:00
|
|
|
struct wl_surface {
|
|
|
|
struct wl_proxy proxy;
|
|
|
|
};
|
|
|
|
|
2008-12-19 01:55:33 +03:00
|
|
|
struct wl_visual {
|
|
|
|
struct wl_proxy proxy;
|
|
|
|
struct wl_list link;
|
|
|
|
};
|
|
|
|
|
2008-11-07 22:27:23 +03:00
|
|
|
static int
|
|
|
|
connection_update(struct wl_connection *connection,
|
|
|
|
uint32_t mask, void *data)
|
|
|
|
{
|
|
|
|
struct wl_display *display = data;
|
|
|
|
|
|
|
|
display->mask = mask;
|
|
|
|
if (display->update)
|
|
|
|
return display->update(display->mask,
|
|
|
|
display->update_data);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-12-19 01:55:33 +03:00
|
|
|
static void
|
|
|
|
add_visual(struct wl_display *display, struct wl_global *global)
|
|
|
|
{
|
|
|
|
struct wl_visual *visual;
|
|
|
|
|
|
|
|
visual = malloc(sizeof *visual);
|
|
|
|
if (visual == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
visual->proxy.display = display;
|
|
|
|
visual->proxy.id = global->id;
|
|
|
|
wl_list_insert(display->visual_list.prev, &visual->link);
|
|
|
|
|
|
|
|
printf("added visual, id %d\n", global->id);
|
|
|
|
}
|
|
|
|
|
|
|
|
WL_EXPORT struct wl_visual *
|
|
|
|
wl_display_get_argb_visual(struct wl_display *display)
|
|
|
|
{
|
|
|
|
return container_of(display->visual_list.next,
|
|
|
|
struct wl_visual, link);
|
|
|
|
}
|
|
|
|
|
|
|
|
WL_EXPORT struct wl_visual *
|
|
|
|
wl_display_get_premultiplied_argb_visual(struct wl_display *display)
|
|
|
|
{
|
|
|
|
return container_of(display->visual_list.next->next,
|
|
|
|
struct wl_visual, link);
|
|
|
|
}
|
|
|
|
|
|
|
|
WL_EXPORT struct wl_visual *
|
|
|
|
wl_display_get_rgb_visual(struct wl_display *display)
|
|
|
|
{
|
|
|
|
/* FIXME: Where's cddar when you need it... */
|
|
|
|
|
|
|
|
return container_of(display->visual_list.next->next->next,
|
|
|
|
struct wl_visual, link);
|
|
|
|
}
|
|
|
|
|
2008-11-08 23:39:41 +03:00
|
|
|
WL_EXPORT struct wl_display *
|
2008-12-07 23:22:22 +03:00
|
|
|
wl_display_create(const char *name, size_t name_size)
|
2008-10-07 18:10:36 +04:00
|
|
|
{
|
|
|
|
struct wl_display *display;
|
2008-11-24 07:41:08 +03:00
|
|
|
struct wl_global *global;
|
2008-12-07 23:22:22 +03:00
|
|
|
struct sockaddr_un addr;
|
2008-10-07 18:10:36 +04:00
|
|
|
socklen_t size;
|
|
|
|
char buffer[256];
|
2008-11-24 07:41:08 +03:00
|
|
|
uint32_t id, length, count, i;
|
2008-10-07 18:10:36 +04:00
|
|
|
|
2008-10-08 21:32:07 +04:00
|
|
|
display = malloc(sizeof *display);
|
|
|
|
if (display == NULL)
|
2008-10-07 18:10:36 +04:00
|
|
|
return NULL;
|
|
|
|
|
2008-10-08 21:32:07 +04:00
|
|
|
memset(display, 0, sizeof *display);
|
|
|
|
display->fd = socket(PF_LOCAL, SOCK_STREAM, 0);
|
|
|
|
if (display->fd < 0) {
|
|
|
|
free(display);
|
2008-10-07 18:10:36 +04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2008-12-07 23:22:22 +03:00
|
|
|
addr.sun_family = AF_LOCAL;
|
|
|
|
memcpy(addr.sun_path, name, name_size);
|
2008-10-07 18:10:36 +04:00
|
|
|
|
2008-12-07 23:22:22 +03:00
|
|
|
size = offsetof (struct sockaddr_un, sun_path) + name_size;
|
2008-10-07 18:10:36 +04:00
|
|
|
|
2008-12-07 23:22:22 +03:00
|
|
|
if (connect(display->fd, (struct sockaddr *) &addr, size) < 0) {
|
2008-10-08 21:32:07 +04:00
|
|
|
close(display->fd);
|
|
|
|
free(display);
|
2008-10-07 18:10:36 +04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2008-10-12 02:40:23 +04:00
|
|
|
/* FIXME: We'll need a protocol for getting a new range, I
|
|
|
|
* guess... */
|
|
|
|
read(display->fd, &display->id, sizeof display->id);
|
|
|
|
|
2008-11-24 07:41:08 +03:00
|
|
|
read(display->fd, &count, sizeof count);
|
|
|
|
|
|
|
|
wl_list_init(&display->global_list);
|
2008-12-19 01:55:33 +03:00
|
|
|
wl_list_init(&display->visual_list);
|
2008-11-24 07:41:08 +03:00
|
|
|
for (i = 0; i < count; i++) {
|
|
|
|
/* FIXME: actually discover advertised objects here. */
|
|
|
|
read(display->fd, &id, sizeof id);
|
|
|
|
read(display->fd, &length, sizeof length);
|
|
|
|
read(display->fd, buffer, (length + 3) & ~3);
|
|
|
|
|
|
|
|
global = malloc(sizeof *global);
|
|
|
|
if (global == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
global->id = id;
|
|
|
|
global->interface = malloc(length + 1);
|
|
|
|
memcpy(global->interface, buffer, length);
|
|
|
|
global->interface[length] = '\0';
|
|
|
|
wl_list_insert(display->global_list.prev, &global->link);
|
2008-12-19 01:55:33 +03:00
|
|
|
|
|
|
|
if (strcmp(global->interface, "visual") == 0)
|
|
|
|
add_visual(display, global);
|
2008-11-24 07:41:08 +03:00
|
|
|
}
|
2008-10-07 18:10:36 +04:00
|
|
|
|
2008-10-08 21:32:07 +04:00
|
|
|
display->proxy.display = display;
|
2008-11-24 07:41:08 +03:00
|
|
|
display->proxy.id = wl_display_get_object_id(display, "display");
|
2008-10-07 18:10:36 +04:00
|
|
|
|
2008-10-08 21:32:07 +04:00
|
|
|
display->connection = wl_connection_create(display->fd,
|
2008-11-07 22:27:23 +03:00
|
|
|
connection_update,
|
|
|
|
display);
|
2008-10-08 21:32:07 +04:00
|
|
|
|
|
|
|
return display;
|
2008-10-07 18:10:36 +04:00
|
|
|
}
|
|
|
|
|
2008-11-08 23:39:41 +03:00
|
|
|
WL_EXPORT void
|
2008-10-08 21:32:07 +04:00
|
|
|
wl_display_destroy(struct wl_display *display)
|
2008-10-07 18:10:36 +04:00
|
|
|
{
|
2008-10-08 21:32:07 +04:00
|
|
|
wl_connection_destroy(display->connection);
|
|
|
|
close(display->fd);
|
|
|
|
free(display);
|
2008-10-07 18:10:36 +04:00
|
|
|
}
|
|
|
|
|
2008-11-24 07:41:08 +03:00
|
|
|
WL_EXPORT uint32_t
|
|
|
|
wl_display_get_object_id(struct wl_display *display, const char *interface)
|
|
|
|
{
|
|
|
|
struct wl_global *global;
|
|
|
|
|
|
|
|
global = container_of(display->global_list.next,
|
|
|
|
struct wl_global, link);
|
|
|
|
while (&global->link != &display->global_list) {
|
|
|
|
if (strcmp(global->interface, interface) == 0)
|
|
|
|
return global->id;
|
|
|
|
|
|
|
|
global = container_of(global->link.next,
|
|
|
|
struct wl_global, link);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-11-08 23:39:41 +03:00
|
|
|
WL_EXPORT int
|
2008-11-07 22:27:23 +03:00
|
|
|
wl_display_get_fd(struct wl_display *display,
|
|
|
|
wl_display_update_func_t update, void *data)
|
2008-10-07 18:10:36 +04:00
|
|
|
{
|
2008-11-07 22:27:23 +03:00
|
|
|
display->update = update;
|
|
|
|
display->update_data = data;
|
|
|
|
|
|
|
|
display->update(display->mask, display->update_data);
|
|
|
|
|
2008-10-08 21:32:07 +04:00
|
|
|
return display->fd;
|
2008-10-07 18:10:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-11-26 06:40:39 +03:00
|
|
|
handle_event(struct wl_display *display,
|
|
|
|
uint32_t object, uint32_t opcode, uint32_t size)
|
2008-10-07 18:10:36 +04:00
|
|
|
{
|
2008-11-26 06:40:39 +03:00
|
|
|
uint32_t p[10];
|
2008-10-07 18:10:36 +04:00
|
|
|
|
2008-11-02 18:55:25 +03:00
|
|
|
wl_connection_copy(display->connection, p, size);
|
|
|
|
if (display->event_handler != NULL)
|
2008-11-26 06:40:39 +03:00
|
|
|
display->event_handler(display, object, opcode, size, p + 2,
|
2008-11-02 18:55:25 +03:00
|
|
|
display->event_handler_data);
|
|
|
|
wl_connection_consume(display->connection, size);
|
2008-10-07 18:10:36 +04:00
|
|
|
}
|
|
|
|
|
2008-11-08 23:39:41 +03:00
|
|
|
WL_EXPORT void
|
2008-10-08 21:32:07 +04:00
|
|
|
wl_display_iterate(struct wl_display *display, uint32_t mask)
|
2008-10-07 18:10:36 +04:00
|
|
|
{
|
2008-11-26 06:40:39 +03:00
|
|
|
uint32_t p[2], object, opcode, size;
|
2008-10-07 18:10:36 +04:00
|
|
|
int len;
|
|
|
|
|
2008-10-08 21:32:07 +04:00
|
|
|
len = wl_connection_data(display->connection, mask);
|
2008-10-07 18:10:36 +04:00
|
|
|
while (len > 0) {
|
2008-10-08 21:32:07 +04:00
|
|
|
if (len < sizeof p)
|
2008-10-07 18:10:36 +04:00
|
|
|
break;
|
|
|
|
|
2008-10-08 21:32:07 +04:00
|
|
|
wl_connection_copy(display->connection, p, sizeof p);
|
2008-11-26 06:40:39 +03:00
|
|
|
object = p[0];
|
2008-10-07 18:10:36 +04:00
|
|
|
opcode = p[1] & 0xffff;
|
|
|
|
size = p[1] >> 16;
|
2008-10-08 21:32:07 +04:00
|
|
|
if (len < size)
|
2008-10-07 18:10:36 +04:00
|
|
|
break;
|
|
|
|
|
2008-11-26 06:40:39 +03:00
|
|
|
handle_event(display, object, opcode, size);
|
2008-11-02 18:12:29 +03:00
|
|
|
len -= size;
|
2008-10-07 18:10:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (len < 0) {
|
|
|
|
fprintf(stderr, "read error: %m\n");
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-08 23:39:41 +03:00
|
|
|
WL_EXPORT void
|
2008-11-02 18:55:25 +03:00
|
|
|
wl_display_set_event_handler(struct wl_display *display,
|
|
|
|
wl_display_event_func_t handler,
|
|
|
|
void *data)
|
|
|
|
{
|
|
|
|
/* FIXME: This needs something more generic... */
|
|
|
|
display->event_handler = handler;
|
|
|
|
display->event_handler_data = data;
|
|
|
|
}
|
|
|
|
|
2008-11-24 07:41:08 +03:00
|
|
|
WL_EXPORT uint32_t
|
|
|
|
wl_display_allocate_id(struct wl_display *display)
|
|
|
|
{
|
|
|
|
return display->id++;
|
|
|
|
}
|
|
|
|
|
|
|
|
WL_EXPORT void
|
|
|
|
wl_display_write(struct wl_display *display, const void *data, size_t count)
|
|
|
|
{
|
|
|
|
wl_connection_write(display->connection, data, count);
|
|
|
|
}
|
|
|
|
|
2008-12-16 04:35:24 +03:00
|
|
|
WL_EXPORT struct wl_compositor *
|
|
|
|
wl_display_get_compositor(struct wl_display *display)
|
|
|
|
{
|
|
|
|
struct wl_compositor *compositor;
|
|
|
|
uint32_t id;
|
|
|
|
|
|
|
|
id = wl_display_get_object_id(display, "compositor");
|
|
|
|
if (id == 0)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
compositor = malloc(sizeof *compositor);
|
|
|
|
compositor->proxy.display = display;
|
|
|
|
compositor->proxy.id = id;
|
|
|
|
|
|
|
|
return compositor;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define WL_COMPOSITOR_CREATE_SURFACE 0
|
|
|
|
#define WL_COMPOSITOR_COMMIT 1
|
2008-10-07 18:10:36 +04:00
|
|
|
|
2008-11-08 23:39:41 +03:00
|
|
|
WL_EXPORT struct wl_surface *
|
2008-12-16 04:35:24 +03:00
|
|
|
wl_compositor_create_surface(struct wl_compositor *compositor)
|
2008-10-07 18:10:36 +04:00
|
|
|
{
|
|
|
|
struct wl_surface *surface;
|
|
|
|
uint32_t request[3];
|
|
|
|
|
|
|
|
surface = malloc(sizeof *surface);
|
|
|
|
if (surface == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
2008-12-16 04:35:24 +03:00
|
|
|
surface->proxy.id = wl_display_allocate_id(compositor->proxy.display);
|
|
|
|
surface->proxy.display = compositor->proxy.display;
|
2008-10-07 18:10:36 +04:00
|
|
|
|
2008-12-16 04:35:24 +03:00
|
|
|
request[0] = compositor->proxy.id;
|
|
|
|
request[1] = WL_COMPOSITOR_CREATE_SURFACE | ((sizeof request) << 16);
|
2008-10-07 18:10:36 +04:00
|
|
|
request[2] = surface->proxy.id;
|
2008-12-16 04:35:24 +03:00
|
|
|
wl_connection_write(compositor->proxy.display->connection,
|
|
|
|
request, sizeof request);
|
2008-10-07 18:10:36 +04:00
|
|
|
|
|
|
|
return surface;
|
|
|
|
}
|
|
|
|
|
2008-11-26 06:40:39 +03:00
|
|
|
WL_EXPORT void
|
2008-12-16 04:35:24 +03:00
|
|
|
wl_compositor_commit(struct wl_compositor *compositor, uint32_t key)
|
2008-11-26 06:40:39 +03:00
|
|
|
{
|
|
|
|
uint32_t request[3];
|
|
|
|
|
2008-12-16 04:35:24 +03:00
|
|
|
request[0] = compositor->proxy.id;
|
|
|
|
request[1] = WL_COMPOSITOR_COMMIT | ((sizeof request) << 16);
|
2008-11-26 06:40:39 +03:00
|
|
|
request[2] = key;
|
2008-12-16 04:35:24 +03:00
|
|
|
wl_connection_write(compositor->proxy.display->connection,
|
|
|
|
request, sizeof request);
|
2008-11-26 06:40:39 +03:00
|
|
|
}
|
|
|
|
|
2008-10-07 18:10:36 +04:00
|
|
|
#define WL_SURFACE_DESTROY 0
|
|
|
|
#define WL_SURFACE_ATTACH 1
|
|
|
|
#define WL_SURFACE_MAP 2
|
2008-11-07 16:39:37 +03:00
|
|
|
#define WL_SURFACE_COPY 3
|
|
|
|
#define WL_SURFACE_DAMAGE 4
|
2008-10-07 18:10:36 +04:00
|
|
|
|
2008-11-08 23:39:41 +03:00
|
|
|
WL_EXPORT void
|
|
|
|
wl_surface_destroy(struct wl_surface *surface)
|
2008-10-07 18:10:36 +04:00
|
|
|
{
|
|
|
|
uint32_t request[2];
|
|
|
|
|
|
|
|
request[0] = surface->proxy.id;
|
|
|
|
request[1] = WL_SURFACE_DESTROY | ((sizeof request) << 16);
|
|
|
|
|
2008-10-08 21:32:07 +04:00
|
|
|
wl_connection_write(surface->proxy.display->connection,
|
|
|
|
request, sizeof request);
|
2008-10-07 18:10:36 +04:00
|
|
|
}
|
2008-10-07 18:10:36 +04:00
|
|
|
|
2008-11-08 23:39:41 +03:00
|
|
|
WL_EXPORT void
|
|
|
|
wl_surface_attach(struct wl_surface *surface, uint32_t name,
|
2008-12-19 01:55:33 +03:00
|
|
|
int32_t width, int32_t height, uint32_t stride,
|
|
|
|
struct wl_visual *visual)
|
2008-10-07 18:10:36 +04:00
|
|
|
{
|
2008-12-19 01:55:33 +03:00
|
|
|
uint32_t request[7];
|
2008-10-07 18:10:36 +04:00
|
|
|
|
|
|
|
request[0] = surface->proxy.id;
|
|
|
|
request[1] = WL_SURFACE_ATTACH | ((sizeof request) << 16);
|
|
|
|
request[2] = name;
|
|
|
|
request[3] = width;
|
|
|
|
request[4] = height;
|
|
|
|
request[5] = stride;
|
2008-12-19 01:55:33 +03:00
|
|
|
request[6] = visual->proxy.id;
|
|
|
|
|
|
|
|
printf("attach, visual id is %d\n", visual->proxy.id);
|
2008-10-07 18:10:36 +04:00
|
|
|
|
2008-10-08 21:32:07 +04:00
|
|
|
wl_connection_write(surface->proxy.display->connection,
|
|
|
|
request, sizeof request);
|
2008-10-07 18:10:36 +04:00
|
|
|
}
|
2008-10-07 18:10:36 +04:00
|
|
|
|
2008-11-08 23:39:41 +03:00
|
|
|
WL_EXPORT void
|
|
|
|
wl_surface_map(struct wl_surface *surface,
|
|
|
|
int32_t x, int32_t y, int32_t width, int32_t height)
|
2008-10-07 18:10:36 +04:00
|
|
|
{
|
|
|
|
uint32_t request[6];
|
|
|
|
|
|
|
|
request[0] = surface->proxy.id;
|
|
|
|
request[1] = WL_SURFACE_MAP | ((sizeof request) << 16);
|
|
|
|
request[2] = x;
|
|
|
|
request[3] = y;
|
|
|
|
request[4] = width;
|
|
|
|
request[5] = height;
|
|
|
|
|
2008-10-08 21:32:07 +04:00
|
|
|
wl_connection_write(surface->proxy.display->connection,
|
|
|
|
request, sizeof request);
|
2008-10-07 18:10:36 +04:00
|
|
|
}
|
2008-11-07 16:39:37 +03:00
|
|
|
|
2008-11-08 23:39:41 +03:00
|
|
|
WL_EXPORT void
|
|
|
|
wl_surface_copy(struct wl_surface *surface, int32_t dst_x, int32_t dst_y,
|
|
|
|
uint32_t name, uint32_t stride,
|
|
|
|
int32_t x, int32_t y, int32_t width, int32_t height)
|
2008-11-07 16:39:37 +03:00
|
|
|
{
|
|
|
|
uint32_t request[10];
|
|
|
|
|
|
|
|
request[0] = surface->proxy.id;
|
|
|
|
request[1] = WL_SURFACE_COPY | ((sizeof request) << 16);
|
|
|
|
request[2] = dst_x;
|
|
|
|
request[3] = dst_y;
|
|
|
|
request[4] = name;
|
|
|
|
request[5] = stride;
|
|
|
|
request[6] = x;
|
|
|
|
request[7] = y;
|
|
|
|
request[8] = width;
|
|
|
|
request[9] = height;
|
|
|
|
|
|
|
|
wl_connection_write(surface->proxy.display->connection,
|
|
|
|
request, sizeof request);
|
|
|
|
}
|
|
|
|
|
2008-11-08 23:39:41 +03:00
|
|
|
WL_EXPORT void
|
|
|
|
wl_surface_damage(struct wl_surface *surface,
|
|
|
|
int32_t x, int32_t y, int32_t width, int32_t height)
|
2008-11-07 16:39:37 +03:00
|
|
|
{
|
|
|
|
uint32_t request[6];
|
|
|
|
|
|
|
|
request[0] = surface->proxy.id;
|
|
|
|
request[1] = WL_SURFACE_DAMAGE | ((sizeof request) << 16);
|
|
|
|
request[2] = x;
|
|
|
|
request[3] = y;
|
|
|
|
request[4] = width;
|
|
|
|
request[5] = height;
|
|
|
|
|
|
|
|
wl_connection_write(surface->proxy.display->connection,
|
|
|
|
request, sizeof request);
|
|
|
|
}
|