Otherwise the initial announcement of interfaces gets lost.
{
struct display *d;
- d = display_create(&argc, &argv, option_entries);
+ d = display_create(&argc, &argv, option_entries, global_handler);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
return -1;
}
- display_set_global_handler(d, global_handler);
-
dnd_create(d);
display_run(d);
struct eventdemo *e;
/* Connect to the display and have the arguments parsed */
- d = display_create(&argc, &argv, option_entries);
+ d = display_create(&argc, &argv, option_entries, NULL);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
return -1;
struct display *d;
struct timeval tv;
- d = display_create(&argc, &argv, NULL);
+ d = display_create(&argc, &argv, NULL, NULL);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
return -1;
{
struct display *d;
- d = display_create(&argc, &argv, NULL);
+ d = display_create(&argc, &argv, NULL, NULL);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
return -1;
struct display *d;
int i;
- d = display_create(&argc, &argv, option_entries);
+ d = display_create(&argc, &argv, option_entries, NULL);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
return -1;
{
struct display *d;
- d = display_create(&argc, &argv, NULL);
+ d = display_create(&argc, &argv, NULL, NULL);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
return -1;
struct display *d;
int size;
- d = display_create(&argc, &argv, NULL);
+ d = display_create(&argc, &argv, NULL, NULL);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
return -1;
struct display *d;
struct terminal *terminal;
- d = display_create(&argc, &argv, option_entries);
+ d = display_create(&argc, &argv, option_entries, NULL);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
return -1;
struct display *d;
int i;
- d = display_create(&argc, &argv, option_entries);
+ d = display_create(&argc, &argv, option_entries, NULL);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
return -1;
}
struct display *
-display_create(int *argc, char **argv[], const GOptionEntry *option_entries)
+display_create(int *argc, char **argv[], const GOptionEntry *option_entries,
+ display_global_handler_t handler)
{
struct display *d;
GOptionContext *context;
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");
{
g_main_loop_run(d->loop);
}
-
-void
-display_set_global_handler(struct display *display,
- display_global_handler_t handler)
-{
- display->global_handler = handler;
-}
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_create(int *argc, char **argv[], const GOptionEntry *option_entries,
+ display_global_handler_t handler);
struct wl_display *
display_get_display(struct display *display);
int32_t x, int32_t y,
int32_t sx, int32_t sy, void *data);
-typedef void (*display_global_handler_t)(struct display *display,
- const char *interface,
- uint32_t id,
- uint32_t version);
-
struct window *
window_create(struct display *display, int32_t width, int32_t height);
struct window *
const char *
window_get_title(struct window *window);
-void
-display_set_global_handler(struct display *display,
- display_global_handler_t handler);
-
struct wl_drag *
window_create_drag(struct window *window);