summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2011-11-15 08:58:34 -0500
committerKristian Høgsberg <krh@bitplanet.net>2011-11-23 16:05:58 -0500
commiteae3bcb4ccb80ef1c4dcd2f71987c1187aeb9e73 (patch)
treea6d959f0bc06a9fcc6f0d5e50a663a743094e447 /src
parent0b7d1e86af1e3da1dbee79ebdee2616a6e8bcf01 (diff)
New drag and drop / selection protocol
This commit brings a big change to the DND and copy/paste interfaces. Most importantly the functionality is now independent of wl_shell. The wl_shell interface is intended for desktop style UI interaction and an optional and experimental interface. The new interface also allows receiving the DND data multiple times or multiple times during the drag, and the mechanism for offering and receiving data is now shared between DND and selections.
Diffstat (limited to 'src')
-rw-r--r--src/connection.c6
-rw-r--r--src/wayland-client.c3
-rw-r--r--src/wayland-server.c13
-rw-r--r--src/wayland-server.h47
4 files changed, 23 insertions, 46 deletions
diff --git a/src/connection.c b/src/connection.c
index 8c9a64d..f19280a 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -449,7 +449,7 @@ wl_connection_vmarshal(struct wl_connection *connection,
closure->types[i] = &ffi_type_uint32;
closure->args[i] = p;
object = va_arg(ap, struct wl_object *);
- *p++ = object->id;
+ *p++ = object ? object->id : 0;
break;
case 'a':
@@ -493,6 +493,8 @@ wl_connection_vmarshal(struct wl_connection *connection,
&dup_fd, sizeof dup_fd);
break;
default:
+ fprintf(stderr, "unhandled format code: '%c'\n",
+ message->signature[i - 2]);
assert(0);
break;
}
@@ -632,7 +634,7 @@ wl_connection_demarshal(struct wl_connection *connection,
closure->types[i] = &ffi_type_uint32;
closure->args[i] = p;
object = wl_map_lookup(objects, *p);
- if (*p == 0 || object != NULL) {
+ if (object != NULL) {
printf("not a new object (%d), "
"message %s(%s)\n",
*p, message->name, message->signature);
diff --git a/src/wayland-client.c b/src/wayland-client.c
index c8bbe8f..939c17d 100644
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -152,8 +152,9 @@ wl_proxy_create_for_id(struct wl_proxy *factory,
proxy->object.interface = interface;
proxy->object.implementation = NULL;
- proxy->object.id = wl_map_insert_at(&display->objects, id, proxy);
+ proxy->object.id = id;
proxy->display = display;
+ wl_map_insert_at(&display->objects, id, proxy);
return proxy;
}
diff --git a/src/wayland-server.c b/src/wayland-server.c
index 4811639..7c93e3f 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -874,3 +874,16 @@ wl_client_add_object(struct wl_client *client,
return resource;
}
+
+WL_EXPORT struct wl_resource *
+wl_client_new_object(struct wl_client *client,
+ const struct wl_interface *interface,
+ const void *implementation, void *data)
+{
+ uint32_t id;
+
+ id = wl_map_insert_new(&client->objects, WL_MAP_SERVER_SIDE, NULL);
+ return wl_client_add_object(client,
+ interface, implementation, id, data);
+
+}
diff --git a/src/wayland-server.h b/src/wayland-server.h
index 269a079..4de2e83 100644
--- a/src/wayland-server.h
+++ b/src/wayland-server.h
@@ -104,6 +104,10 @@ struct wl_resource *
wl_client_add_object(struct wl_client *client,
const struct wl_interface *interface,
const void *implementation, uint32_t id, void *data);
+struct wl_resource *
+wl_client_new_object(struct wl_client *client,
+ const struct wl_interface *interface,
+ const void *implementation, void *data);
struct wl_resource {
struct wl_object object;
@@ -176,39 +180,6 @@ struct wl_input_device {
struct wl_listener grab_listener;
};
-struct wl_drag_offer {
- struct wl_resource resource;
-};
-
-struct wl_drag {
- struct wl_resource resource;
- struct wl_grab grab;
- struct wl_drag_offer drag_offer;
- struct wl_surface *source;
- struct wl_surface *drag_focus;
- struct wl_client *target;
- int32_t x, y, sx, sy;
- struct wl_array types;
- const char *type;
- uint32_t pointer_focus_time;
- struct wl_listener drag_focus_listener;
-};
-
-struct wl_selection_offer {
- struct wl_resource resource;
-};
-
-struct wl_selection {
- struct wl_resource resource;
- struct wl_client *client;
- struct wl_input_device *input_device;
- struct wl_selection_offer selection_offer;
- struct wl_surface *selection_focus;
- struct wl_client *target;
- struct wl_array types;
- struct wl_listener selection_focus_listener;
-};
-
void wl_resource_post_event(struct wl_resource *resource,
uint32_t opcode, ...);
void wl_resource_queue_event(struct wl_resource *resource,
@@ -217,11 +188,6 @@ void wl_resource_post_error(struct wl_resource *resource,
uint32_t code, const char *msg, ...);
void wl_resource_post_no_memory(struct wl_resource *resource);
-int
-wl_display_set_compositor(struct wl_display *display,
- struct wl_compositor *compositor,
- const struct wl_compositor_interface *implementation);
-
void
wl_display_post_frame(struct wl_display *display, struct wl_surface *surface,
uint32_t msecs);
@@ -287,11 +253,6 @@ wl_shm_init(struct wl_display *display,
void
wl_shm_finish(struct wl_shm *shm);
-int
-wl_compositor_init(struct wl_compositor *compositor,
- const struct wl_compositor_interface *interface,
- struct wl_display *display);
-
#ifdef __cplusplus
}
#endif