Commit e352fa19 authored by Alexandros Frantzis's avatar Alexandros Frantzis Committed by Alexandre Julliard

winewayland.drv: Allocate process_wayland statically.

There is currently no benefit to dynamic allocation, and static allocation allows us to simplify some aspects of initialization.
parent 5eeed9ab
......@@ -290,7 +290,7 @@ BOOL WAYLAND_UpdateDisplayDevices(const struct gdi_device_manager *device_manage
wl_array_init(&output_info_array);
wl_list_for_each(output, &process_wayland->output_list, link)
wl_list_for_each(output, &process_wayland.output_list, link)
{
if (!output->current_mode) continue;
output_info = wl_array_add(&output_info_array, sizeof(*output_info));
......
......@@ -32,8 +32,10 @@
WINE_DEFAULT_DEBUG_CHANNEL(waylanddrv);
struct wl_display *process_wl_display = NULL;
struct wayland *process_wayland = NULL;
struct wayland process_wayland =
{
.output_list = {&process_wayland.output_list, &process_wayland.output_list}
};
/**********************************************************************
* Registry handling
......@@ -54,12 +56,12 @@ static void registry_handle_global(void *data, struct wl_registry *registry,
{
struct wayland_output *output;
process_wayland->zxdg_output_manager_v1 =
process_wayland.zxdg_output_manager_v1 =
wl_registry_bind(registry, id, &zxdg_output_manager_v1_interface,
version < 3 ? version : 3);
/* Add zxdg_output_v1 to existing outputs. */
wl_list_for_each(output, &process_wayland->output_list, link)
wl_list_for_each(output, &process_wayland.output_list, link)
wayland_output_use_xdg_extension(output);
}
}
......@@ -71,7 +73,7 @@ static void registry_handle_global_remove(void *data, struct wl_registry *regist
TRACE("id=%u\n", id);
wl_list_for_each_safe(output, tmp, &process_wayland->output_list, link)
wl_list_for_each_safe(output, tmp, &process_wayland.output_list, link)
{
if (output->global_id == id)
{
......@@ -97,48 +99,41 @@ BOOL wayland_process_init(void)
{
struct wl_display *wl_display_wrapper;
process_wl_display = wl_display_connect(NULL);
if (!process_wl_display)
process_wayland.wl_display = wl_display_connect(NULL);
if (!process_wayland.wl_display)
return FALSE;
process_wayland = calloc(1, sizeof(*process_wayland));
if (!process_wayland)
return FALSE;
TRACE("wl_display=%p\n", process_wayland.wl_display);
TRACE("process_wayland=%p wl_display=%p\n", process_wayland, process_wl_display);
if (!(process_wayland->wl_event_queue = wl_display_create_queue(process_wl_display)))
if (!(process_wayland.wl_event_queue = wl_display_create_queue(process_wayland.wl_display)))
{
ERR("Failed to create event queue\n");
return FALSE;
}
if (!(wl_display_wrapper = wl_proxy_create_wrapper(process_wl_display)))
if (!(wl_display_wrapper = wl_proxy_create_wrapper(process_wayland.wl_display)))
{
ERR("Failed to create proxy wrapper for wl_display\n");
return FALSE;
}
wl_proxy_set_queue((struct wl_proxy *) wl_display_wrapper,
process_wayland->wl_event_queue);
process_wayland.wl_event_queue);
process_wayland->wl_registry = wl_display_get_registry(wl_display_wrapper);
process_wayland.wl_registry = wl_display_get_registry(wl_display_wrapper);
wl_proxy_wrapper_destroy(wl_display_wrapper);
if (!process_wayland->wl_registry)
if (!process_wayland.wl_registry)
{
ERR("Failed to get to wayland registry\n");
return FALSE;
}
wl_list_init(&process_wayland->output_list);
/* Populate registry */
wl_registry_add_listener(process_wayland->wl_registry, &registry_listener,
process_wayland);
wl_registry_add_listener(process_wayland.wl_registry, &registry_listener, NULL);
/* We need two roundtrips. One to get and bind globals, one to handle all
* initial events produced from registering the globals. */
wl_display_roundtrip_queue(process_wl_display, process_wayland->wl_event_queue);
wl_display_roundtrip_queue(process_wl_display, process_wayland->wl_event_queue);
wl_display_roundtrip_queue(process_wayland.wl_display, process_wayland.wl_event_queue);
wl_display_roundtrip_queue(process_wayland.wl_display, process_wayland.wl_event_queue);
wayland_init_display_devices();
......
......@@ -230,7 +230,7 @@ BOOL wayland_output_create(uint32_t id, uint32_t version)
goto err;
}
output->wl_output = wl_registry_bind(process_wayland->wl_registry, id,
output->wl_output = wl_registry_bind(process_wayland.wl_registry, id,
&wl_output_interface,
version < 2 ? version : 2);
output->global_id = id;
......@@ -252,10 +252,10 @@ BOOL wayland_output_create(uint32_t id, uint32_t version)
goto err;
}
if (process_wayland->zxdg_output_manager_v1)
if (process_wayland.zxdg_output_manager_v1)
wayland_output_use_xdg_extension(output);
wl_list_insert(process_wayland->output_list.prev, &output->link);
wl_list_insert(process_wayland.output_list.prev, &output->link);
return TRUE;
......@@ -293,7 +293,7 @@ void wayland_output_destroy(struct wayland_output *output)
void wayland_output_use_xdg_extension(struct wayland_output *output)
{
output->zxdg_output_v1 =
zxdg_output_manager_v1_get_xdg_output(process_wayland->zxdg_output_manager_v1,
zxdg_output_manager_v1_get_xdg_output(process_wayland.zxdg_output_manager_v1,
output->wl_output);
zxdg_output_v1_add_listener(output->zxdg_output_v1, &zxdg_output_v1_listener,
output);
......
......@@ -39,8 +39,7 @@
* Globals
*/
extern struct wl_display *process_wl_display DECLSPEC_HIDDEN;
extern struct wayland *process_wayland DECLSPEC_HIDDEN;
extern struct wayland process_wayland DECLSPEC_HIDDEN;
/**********************************************************************
* Definitions for wayland types
......@@ -48,6 +47,7 @@ extern struct wayland *process_wayland DECLSPEC_HIDDEN;
struct wayland
{
struct wl_display *wl_display;
struct wl_event_queue *wl_event_queue;
struct wl_registry *wl_registry;
struct zxdg_output_manager_v1 *zxdg_output_manager_v1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment