Add an id field to outputs

All outputs now have a unique integer ID, allocated from a bitfield pool in the
compositor.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
This commit is contained in:
Casey Dahlin 2012-04-19 22:50:08 -04:00 committed by Kristian Høgsberg
parent 96d8a75ec0
commit 58ba1370d8
2 changed files with 9 additions and 0 deletions

View File

@ -2365,6 +2365,9 @@ weston_output_init(struct weston_output *output, struct weston_compositor *c,
wl_list_init(&output->frame_callback_list);
output->id = ffs(~output->compositor->output_id_pool) - 1;
output->compositor->output_id_pool |= 1 << output->id;
output->global =
wl_display_add_global(c->wl_display, &wl_output_interface,
output, bind_output);
@ -2393,6 +2396,8 @@ weston_compositor_init(struct weston_compositor *ec, struct wl_display *display)
wl_signal_init(&ec->unlock_signal);
ec->launcher_sock = weston_environment_get_fd("WESTON_LAUNCHER_SOCK");
ec->output_id_pool = 0;
if (!wl_display_add_global(display, &wl_compositor_interface,
ec, compositor_bind))
return -1;

View File

@ -73,6 +73,8 @@ enum dpms_enum {
};
struct weston_output {
uint32_t id;
struct wl_list link;
struct wl_global *global;
struct weston_compositor *compositor;
@ -240,6 +242,8 @@ struct weston_compositor {
struct screenshooter *screenshooter;
int launcher_sock;
uint32_t output_id_pool;
};
#define MODIFIER_CTRL (1 << 8)