window.c: Drop global handler argument

We can just register a global handler directly on the wl_display now.
dev
Kristian Høgsberg 14 years ago
parent a8d1fa762e
commit 9de79a92a6
  1. 12
      clients/dnd.c
  2. 2
      clients/eventdemo.c
  3. 2
      clients/flower.c
  4. 2
      clients/gears.c
  5. 2
      clients/image.c
  6. 2
      clients/resizor.c
  7. 2
      clients/smoke.c
  8. 2
      clients/terminal.c
  9. 9
      clients/window.c
  10. 8
      clients/window.h

@ -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;

@ -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;

@ -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;

@ -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;

@ -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;

@ -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;

@ -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;

@ -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;

@ -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");

@ -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);

Loading…
Cancel
Save