summaryrefslogtreecommitdiff
path: root/clients
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2011-01-18 09:17:57 -0500
committerKristian Høgsberg <krh@bitplanet.net>2011-01-19 14:25:12 -0500
commitb46df05fa82578a24949a63909d23c650af92305 (patch)
treef6845ab56c12f8e6a455e09648c7b17c8a4e5bdd /clients
parentae6c8a6d731b3543bdea0f40757206908d75d6f4 (diff)
window: Add a catch-all global handler hook
Diffstat (limited to 'clients')
-rw-r--r--clients/window.c10
-rw-r--r--clients/window.h8
2 files changed, 18 insertions, 0 deletions
diff --git a/clients/window.c b/clients/window.c
index 84d0418..9d5c9d1 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -80,6 +80,7 @@ struct display {
cairo_surface_t **pointer_surfaces;
display_drag_offer_handler_t drag_offer_handler;
+ display_global_handler_t global_handler;
};
struct window {
@@ -1338,6 +1339,8 @@ display_handle_global(struct wl_display *display, uint32_t id,
offer = wl_drag_offer_create(display, id);
d->drag_offer_handler(offer, d);
}
+ } else if (d->global_handler) {
+ d->global_handler(d, interface, version);
}
}
@@ -1544,3 +1547,10 @@ display_set_drag_offer_handler(struct display *display,
{
display->drag_offer_handler = handler;
}
+
+void
+display_set_global_handler(struct display *display,
+ display_global_handler_t handler)
+{
+ display->global_handler = handler;
+}
diff --git a/clients/window.h b/clients/window.h
index 2709917..f84ae92 100644
--- a/clients/window.h
+++ b/clients/window.h
@@ -127,6 +127,10 @@ typedef int (*window_motion_handler_t)(struct window *window,
typedef void (*display_drag_offer_handler_t)(struct wl_drag_offer *offer,
struct display *display);
+typedef void (*display_global_handler_t)(struct display *display,
+ const char *interface,
+ uint32_t version);
+
struct window *
window_create(struct display *display, const char *title,
int32_t width, int32_t height);
@@ -224,6 +228,10 @@ void
display_set_drag_offer_handler(struct display *display,
display_drag_offer_handler_t handler);
+void
+display_set_global_handler(struct display *display,
+ display_global_handler_t handler);
+
struct wl_drag *
window_create_drag(struct window *window);