diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2011-08-24 11:09:53 -0400 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2011-08-29 17:12:36 -0400 |
commit | 9de79a92a667b766c8d6c94b2a176718ba262a52 (patch) | |
tree | 6df15b2931d281957cd6c4f5ed27c01917efc562 | |
parent | a8d1fa762efb501340bbde180b26b3fba76b7f60 (diff) |
window.c: Drop global handler argument
We can just register a global handler directly on the wl_display now.
-rw-r--r-- | clients/dnd.c | 12 | ||||
-rw-r--r-- | clients/eventdemo.c | 2 | ||||
-rw-r--r-- | clients/flower.c | 2 | ||||
-rw-r--r-- | clients/gears.c | 2 | ||||
-rw-r--r-- | clients/image.c | 2 | ||||
-rw-r--r-- | clients/resizor.c | 2 | ||||
-rw-r--r-- | clients/smoke.c | 2 | ||||
-rw-r--r-- | clients/terminal.c | 2 | ||||
-rw-r--r-- | clients/window.c | 9 | ||||
-rw-r--r-- | clients/window.h | 8 |
10 files changed, 16 insertions, 27 deletions
diff --git a/clients/dnd.c b/clients/dnd.c index f598e38..a521edc 100644 --- a/clients/dnd.c +++ b/clients/dnd.c @@ -486,8 +486,8 @@ static const struct wl_drag_offer_listener drag_offer_listener = { }; static void -global_handler(struct display *display, - const char *interface, uint32_t id, uint32_t version) +global_handler(struct wl_display *display, uint32_t id, + const char *interface, uint32_t version, void *data) { struct wl_drag_offer *offer; struct dnd_offer *dnd_offer; @@ -495,8 +495,7 @@ global_handler(struct display *display, if (strcmp(interface, "wl_drag_offer") != 0) return; - offer = wl_display_bind(display_get_display(display), - id, &wl_drag_offer_interface); + offer = wl_display_bind(display, id, &wl_drag_offer_interface); dnd_offer = malloc(sizeof *dnd_offer); if (dnd_offer == NULL) @@ -643,6 +642,9 @@ dnd_create(struct display *display) dnd->display = display; dnd->key = 100; + wl_display_add_global_listener(display_get_display(display), + global_handler, dnd); + for (i = 0; i < ARRAY_LENGTH(dnd->items); i++) { x = (i % 4) * (item_width + item_padding) + item_padding; y = (i / 4) * (item_height + item_padding) + item_padding; @@ -680,7 +682,7 @@ main(int argc, char *argv[]) { struct display *d; - d = display_create(&argc, &argv, option_entries, global_handler); + d = display_create(&argc, &argv, option_entries); if (d == NULL) { fprintf(stderr, "failed to create display: %m\n"); return -1; diff --git a/clients/eventdemo.c b/clients/eventdemo.c index 3a0fd0d..8de620a 100644 --- a/clients/eventdemo.c +++ b/clients/eventdemo.c @@ -377,7 +377,7 @@ main(int argc, char *argv[]) struct eventdemo *e; /* Connect to the display and have the arguments parsed */ - d = display_create(&argc, &argv, option_entries, NULL); + d = display_create(&argc, &argv, option_entries); if (d == NULL) { fprintf(stderr, "failed to create display: %m\n"); return -1; diff --git a/clients/flower.c b/clients/flower.c index 0828fae..a87e20f 100644 --- a/clients/flower.c +++ b/clients/flower.c @@ -129,7 +129,7 @@ int main(int argc, char *argv[]) struct display *d; struct timeval tv; - d = display_create(&argc, &argv, NULL, NULL); + d = display_create(&argc, &argv, NULL); if (d == NULL) { fprintf(stderr, "failed to create display: %m\n"); return -1; diff --git a/clients/gears.c b/clients/gears.c index d83a62c..1d59fac 100644 --- a/clients/gears.c +++ b/clients/gears.c @@ -377,7 +377,7 @@ int main(int argc, char *argv[]) { struct display *d; - d = display_create(&argc, &argv, NULL, NULL); + d = display_create(&argc, &argv, NULL); if (d == NULL) { fprintf(stderr, "failed to create display: %m\n"); return -1; diff --git a/clients/image.c b/clients/image.c index f7d040f..3eada1e 100644 --- a/clients/image.c +++ b/clients/image.c @@ -244,7 +244,7 @@ main(int argc, char *argv[]) struct display *d; int i; - d = display_create(&argc, &argv, option_entries, NULL); + d = display_create(&argc, &argv, option_entries); if (d == NULL) { fprintf(stderr, "failed to create display: %m\n"); return -1; diff --git a/clients/resizor.c b/clients/resizor.c index 899c152..3b52e68 100644 --- a/clients/resizor.c +++ b/clients/resizor.c @@ -226,7 +226,7 @@ main(int argc, char *argv[]) { struct display *d; - d = display_create(&argc, &argv, NULL, NULL); + d = display_create(&argc, &argv, NULL); if (d == NULL) { fprintf(stderr, "failed to create display: %m\n"); return -1; diff --git a/clients/smoke.c b/clients/smoke.c index bae6e96..e084b27 100644 --- a/clients/smoke.c +++ b/clients/smoke.c @@ -258,7 +258,7 @@ int main(int argc, char *argv[]) struct display *d; int size; - d = display_create(&argc, &argv, NULL, NULL); + d = display_create(&argc, &argv, NULL); if (d == NULL) { fprintf(stderr, "failed to create display: %m\n"); return -1; diff --git a/clients/terminal.c b/clients/terminal.c index 6b2cc8c..501d465 100644 --- a/clients/terminal.c +++ b/clients/terminal.c @@ -2382,7 +2382,7 @@ int main(int argc, char *argv[]) struct display *d; struct terminal *terminal; - d = display_create(&argc, &argv, option_entries, NULL); + d = display_create(&argc, &argv, option_entries); if (d == NULL) { fprintf(stderr, "failed to create display: %m\n"); return -1; diff --git a/clients/window.c b/clients/window.c index eb1e64b..a969cd8 100644 --- a/clients/window.c +++ b/clients/window.c @@ -79,8 +79,6 @@ struct display { struct xkb_desc *xkb; cairo_surface_t **pointer_surfaces; - display_global_handler_t global_handler; - PFNGLEGLIMAGETARGETTEXTURE2DOESPROC image_target_texture_2d; PFNEGLCREATEIMAGEKHRPROC create_image; PFNEGLDESTROYIMAGEKHRPROC destroy_image; @@ -1786,8 +1784,6 @@ display_handle_global(struct wl_display *display, uint32_t id, d->shm = wl_display_bind(display, id, &wl_shm_interface); } else if (strcmp(interface, "wl_selection_offer") == 0) { add_selection_offer(d, id); - } else if (d->global_handler) { - d->global_handler(d, interface, id, version); } } @@ -1899,8 +1895,7 @@ init_egl(struct display *d) } struct display * -display_create(int *argc, char **argv[], const GOptionEntry *option_entries, - display_global_handler_t handler) +display_create(int *argc, char **argv[], const GOptionEntry *option_entries) { struct display *d; GOptionContext *context; @@ -1933,8 +1928,6 @@ display_create(int *argc, char **argv[], const GOptionEntry *option_entries, memset(d, 0, sizeof *d); - d->global_handler = handler; - d->display = wl_display_connect(NULL); if (d->display == NULL) { fprintf(stderr, "failed to create display: %m\n"); diff --git a/clients/window.h b/clients/window.h index c04d77e..2a6cd30 100644 --- a/clients/window.h +++ b/clients/window.h @@ -40,14 +40,8 @@ struct rectangle { struct display; struct input; -typedef void (*display_global_handler_t)(struct display *display, - const char *interface, - uint32_t id, - uint32_t version); - struct display * -display_create(int *argc, char **argv[], const GOptionEntry *option_entries, - display_global_handler_t handler); +display_create(int *argc, char **argv[], const GOptionEntry *option_entries); struct wl_display * display_get_display(struct display *display); |