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:
committed by
Kristian Høgsberg
parent
96d8a75ec0
commit
58ba1370d8
@@ -2365,6 +2365,9 @@ weston_output_init(struct weston_output *output, struct weston_compositor *c,
|
|||||||
|
|
||||||
wl_list_init(&output->frame_callback_list);
|
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 =
|
output->global =
|
||||||
wl_display_add_global(c->wl_display, &wl_output_interface,
|
wl_display_add_global(c->wl_display, &wl_output_interface,
|
||||||
output, bind_output);
|
output, bind_output);
|
||||||
@@ -2393,6 +2396,8 @@ weston_compositor_init(struct weston_compositor *ec, struct wl_display *display)
|
|||||||
wl_signal_init(&ec->unlock_signal);
|
wl_signal_init(&ec->unlock_signal);
|
||||||
ec->launcher_sock = weston_environment_get_fd("WESTON_LAUNCHER_SOCK");
|
ec->launcher_sock = weston_environment_get_fd("WESTON_LAUNCHER_SOCK");
|
||||||
|
|
||||||
|
ec->output_id_pool = 0;
|
||||||
|
|
||||||
if (!wl_display_add_global(display, &wl_compositor_interface,
|
if (!wl_display_add_global(display, &wl_compositor_interface,
|
||||||
ec, compositor_bind))
|
ec, compositor_bind))
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -73,6 +73,8 @@ enum dpms_enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct weston_output {
|
struct weston_output {
|
||||||
|
uint32_t id;
|
||||||
|
|
||||||
struct wl_list link;
|
struct wl_list link;
|
||||||
struct wl_global *global;
|
struct wl_global *global;
|
||||||
struct weston_compositor *compositor;
|
struct weston_compositor *compositor;
|
||||||
@@ -240,6 +242,8 @@ struct weston_compositor {
|
|||||||
|
|
||||||
struct screenshooter *screenshooter;
|
struct screenshooter *screenshooter;
|
||||||
int launcher_sock;
|
int launcher_sock;
|
||||||
|
|
||||||
|
uint32_t output_id_pool;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MODIFIER_CTRL (1 << 8)
|
#define MODIFIER_CTRL (1 << 8)
|
||||||
|
|||||||
Reference in New Issue
Block a user