if (compositor == NULL)
return NULL;
+ if (weston_compositor_init(&compositor->base, display, argc, argv,
+ config_file) < 0)
+ return NULL;
+
compositor->base.destroy = android_compositor_destroy;
compositor->base.focus = 1;
if (android_init_egl(compositor, output) < 0)
return NULL;
- if (weston_compositor_init(&compositor->base, display, argc, argv,
- config_file) < 0)
+ if (weston_compositor_init_gl(&compositor->base) < 0)
return NULL;
android_compositor_add_output(compositor, output);
ec = malloc(sizeof *ec);
if (ec == NULL)
return NULL;
-
memset(ec, 0, sizeof *ec);
+
+ if (weston_compositor_init(&ec->base, display, argc, argv,
+ config_file) < 0)
+ return NULL;
+
ec->udev = udev_new();
if (ec->udev == NULL) {
weston_log("failed to initialize udev context\n");
ec->prev_state = WESTON_COMPOSITOR_ACTIVE;
- /* Can't init base class until we have a current egl context */
- if (weston_compositor_init(&ec->base, display, argc, argv,
- config_file) < 0)
+ if (weston_compositor_init_gl(&ec->base) < 0)
return NULL;
for (key = KEY_F1; key < KEY_F9; key++)
memset(ec, 0, sizeof *ec);
+ /* XXX: This is totally broken and doesn't even compile. */
+ if (weston_compositor_init(&ec->base, display) < 0)
+ return NULL;
+
gettimeofday(&tv, NULL);
ec->start_time = tv.tv_sec * 1000 + tv.tv_usec / 1000;
glGenFramebuffers(1, &ec->base.fbo);
glBindFramebuffer(GL_FRAMEBUFFER, ec->base.fbo);
- /* Can't init base class until we have a current egl context */
- if (weston_compositor_init(&ec->base, display) < 0)
+ if (weston_compositor_init_gl(&ec->base) < 0)
return NULL;
if (create_outputs(ec, connector) < 0) {
wl_seat_set_user_data(input->seat, input);
}
-/* We can't start adding input devices until weston_compositor_init, but
- * also can't call weston_compositor_init until we've handled some of the
- * base display code first. So, we have a separate global handler for
- * seats. */
-static void
-display_handle_global_input(struct wl_display *display, uint32_t id,
- const char *interface, uint32_t version,
- void *data)
-{
- struct wayland_compositor *c = data;
-
- if (strcmp(interface, "wl_seat") == 0)
- display_add_seat(c, id);
-}
-
-
static void
display_handle_global(struct wl_display *display, uint32_t id,
const char *interface, uint32_t version, void *data)
} else if (strcmp(interface, "wl_shell") == 0) {
c->parent.shell =
wl_display_bind(display, id, &wl_shell_interface);
+ } else if (strcmp(interface, "wl_seat") == 0) {
+ display_add_seat(c, id);
}
}
c->base.seat = seat;
- wl_display_add_global_listener(c->parent.wl_display,
- display_handle_global_input,
- c);
-
return 0;
}
memset(c, 0, sizeof *c);
+ if (weston_compositor_init(&c->base, display, argc, argv,
+ config_file) < 0)
+ return NULL;
+
+ if (wayland_input_create(c) < 0)
+ return NULL;
+
c->parent.wl_display = wl_display_connect(display_name);
if (c->parent.wl_display == NULL) {
c->base.destroy = wayland_destroy;
- /* Can't init base class until we have a current egl context */
- if (weston_compositor_init(&c->base, display, argc, argv,
- config_file) < 0)
+ if (weston_compositor_init_gl(&c->base) < 0)
return NULL;
create_border(c);
if (wayland_compositor_create_output(c, width, height) < 0)
return NULL;
- if (wayland_input_create(c) < 0)
- return NULL;
-
loop = wl_display_get_event_loop(c->base.wl_display);
fd = wl_display_get_fd(c->parent.wl_display, update_event_mask, c);
memset(c, 0, sizeof *c);
+ if (weston_compositor_init(&c->base, display, argc, argv,
+ config_file) < 0)
+ return NULL;
+
c->dpy = XOpenDisplay(NULL);
if (c->dpy == NULL)
return NULL;
c->base.destroy = x11_destroy;
- /* Can't init base class until we have a current egl context */
- if (weston_compositor_init(&c->base, display, argc, argv,
- config_file) < 0)
+ if (weston_compositor_init_gl(&c->base) < 0)
return NULL;
if (x11_input_create(c, no_input) < 0)
const char *config_file)
{
struct wl_event_loop *loop;
- const char *extensions;
struct xkb_rule_names xkb_names;
const struct config_key keyboard_config_keys[] = {
{ "keymap_rules", CONFIG_KEY_STRING, &xkb_names.rules },
ec, compositor_bind))
return -1;
+ wl_list_init(&ec->surface_list);
+ wl_list_init(&ec->layer_list);
+ wl_list_init(&ec->seat_list);
+ wl_list_init(&ec->output_list);
+ wl_list_init(&ec->key_binding_list);
+ wl_list_init(&ec->button_binding_list);
+ wl_list_init(&ec->axis_binding_list);
+ wl_list_init(&ec->fade.animation.link);
+
+ weston_compositor_xkb_init(ec, &xkb_names);
+
+ ec->ping_handler = NULL;
+
+ screenshooter_create(ec);
+ text_cursor_position_notifier_create(ec);
+ input_method_create(ec);
+
+ wl_data_device_manager_init(ec->wl_display);
+
wl_display_init_shm(display);
+ loop = wl_display_get_event_loop(ec->wl_display);
+ ec->idle_source = wl_event_loop_add_timer(loop, idle_handler, ec);
+ wl_event_source_timer_update(ec->idle_source, ec->idle_time * 1000);
+
+ ec->input_loop = wl_event_loop_create();
+
+ return 0;
+}
+
+WL_EXPORT int
+weston_compositor_init_gl(struct weston_compositor *ec)
+{
+ const char *extensions;
+
log_egl_gl_info(ec->egl_display);
ec->image_target_texture_2d =
if (ec->has_bind_display)
ec->bind_display(ec->egl_display, ec->wl_display);
- wl_list_init(&ec->surface_list);
- wl_list_init(&ec->layer_list);
- wl_list_init(&ec->seat_list);
- wl_list_init(&ec->output_list);
- wl_list_init(&ec->key_binding_list);
- wl_list_init(&ec->button_binding_list);
- wl_list_init(&ec->axis_binding_list);
weston_spring_init(&ec->fade.spring, 30.0, 1.0, 1.0);
ec->fade.animation.frame = fade_frame;
- wl_list_init(&ec->fade.animation.link);
weston_layer_init(&ec->fade_layer, &ec->layer_list);
weston_layer_init(&ec->cursor_layer, &ec->fade_layer.link);
- screenshooter_create(ec);
- text_cursor_position_notifier_create(ec);
- input_method_create(ec);
-
- ec->ping_handler = NULL;
-
- wl_data_device_manager_init(ec->wl_display);
-
glActiveTexture(GL_TEXTURE0);
if (weston_shader_init(&ec->texture_shader,
vertex_shader, solid_fragment_shader) < 0)
return -1;
- weston_compositor_xkb_init(ec, &xkb_names);
-
- loop = wl_display_get_event_loop(ec->wl_display);
- ec->idle_source = wl_event_loop_add_timer(loop, idle_handler, ec);
- wl_event_source_timer_update(ec->idle_source, ec->idle_time * 1000);
-
- ec->input_loop = wl_event_loop_create();
-
weston_compositor_schedule_repaint(ec);
return 0;
int
weston_compositor_init(struct weston_compositor *ec, struct wl_display *display,
int argc, char *argv[], const char *config_file);
+int
+weston_compositor_init_gl(struct weston_compositor *ec);
void
weston_compositor_shutdown(struct weston_compositor *ec);
void