Merge pull request #1121 from emersion/rename-wl-resources-global

Rename wl_resources to resource, wl_global to global
This commit is contained in:
Drew DeVault 2018-07-08 12:10:35 -07:00 committed by GitHub
commit ffc8780893
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 114 additions and 114 deletions

View File

@ -248,8 +248,8 @@ listener. Example:
```c ```c
struct wlr_compositor { struct wlr_compositor {
struct wl_global *wl_global; struct wl_global *global;
struct wl_list wl_resources; struct wl_list resources;
struct wl_listener display_destroy; struct wl_listener display_destroy;

View File

@ -7,14 +7,14 @@
struct wlr_surface; struct wlr_surface;
struct wlr_subcompositor { struct wlr_subcompositor {
struct wl_global *wl_global; struct wl_global *global;
struct wl_list wl_resources; struct wl_list resources;
struct wl_list subsurface_resources; struct wl_list subsurface_resources;
}; };
struct wlr_compositor { struct wlr_compositor {
struct wl_global *wl_global; struct wl_global *global;
struct wl_list wl_resources; struct wl_list resources;
struct wlr_renderer *renderer; struct wlr_renderer *renderer;
struct wl_list surface_resources; struct wl_list surface_resources;
struct wl_list region_resources; struct wl_list region_resources;

View File

@ -15,7 +15,7 @@ wlr_touch_grab_interface wlr_data_device_touch_drag_interface;
struct wlr_data_device_manager { struct wlr_data_device_manager {
struct wl_global *global; struct wl_global *global;
struct wl_list wl_resources; struct wl_list resources;
struct wl_list data_sources; struct wl_list data_sources;
struct wl_listener display_destroy; struct wl_listener display_destroy;

View File

@ -4,7 +4,7 @@
#include <wayland-server.h> #include <wayland-server.h>
struct wlr_gamma_control_manager { struct wlr_gamma_control_manager {
struct wl_global *wl_global; struct wl_global *global;
struct wl_list controls; // wlr_gamma_control::link struct wl_list controls; // wlr_gamma_control::link
struct wl_listener display_destroy; struct wl_listener display_destroy;

View File

@ -14,7 +14,7 @@
struct wlr_idle { struct wlr_idle {
struct wl_global *wl_global; struct wl_global *global;
struct wl_list idle_timers; // wlr_idle_timeout::link struct wl_list idle_timers; // wlr_idle_timeout::link
struct wl_event_loop *event_loop; struct wl_event_loop *event_loop;
bool enabled; bool enabled;

View File

@ -16,7 +16,7 @@
*/ */
struct wlr_idle_inhibit_manager_v1 { struct wlr_idle_inhibit_manager_v1 {
struct wl_list wl_resources; // wl_resource_get_link struct wl_list resources; // wl_resource_get_link
struct wl_list inhibitors; // wlr_idle_inhibit_inhibitor_v1::link struct wl_list inhibitors; // wlr_idle_inhibit_inhibitor_v1::link
struct wl_global *global; struct wl_global *global;

View File

@ -3,7 +3,7 @@
#include <wayland-server.h> #include <wayland-server.h>
struct wlr_input_inhibit_manager { struct wlr_input_inhibit_manager {
struct wl_global *wl_global; struct wl_global *global;
struct wl_client *active_client; struct wl_client *active_client;
struct wl_resource *active_inhibitor; struct wl_resource *active_inhibitor;

View File

@ -20,7 +20,7 @@
* the compositor should begin rendering the surface. * the compositor should begin rendering the surface.
*/ */
struct wlr_layer_shell { struct wlr_layer_shell {
struct wl_global *wl_global; struct wl_global *global;
struct wl_list client_resources; // wl_resource struct wl_list client_resources; // wl_resource
struct wl_list surfaces; // wl_layer_surface struct wl_list surfaces; // wl_layer_surface

View File

@ -35,9 +35,9 @@ struct wlr_dmabuf_buffer *wlr_dmabuf_buffer_from_params_resource(
/* the protocol interface */ /* the protocol interface */
struct wlr_linux_dmabuf { struct wlr_linux_dmabuf {
struct wl_global *wl_global; struct wl_global *global;
struct wlr_renderer *renderer; struct wlr_renderer *renderer;
struct wl_list wl_resources; struct wl_list resources;
struct { struct {
struct wl_signal destroy; struct wl_signal destroy;

View File

@ -53,8 +53,8 @@ struct wlr_output {
struct wlr_backend *backend; struct wlr_backend *backend;
struct wl_display *display; struct wl_display *display;
struct wl_global *wl_global; struct wl_global *global;
struct wl_list wl_resources; struct wl_list resources;
char name[24]; char name[24];
char make[48]; char make[48];

View File

@ -4,7 +4,7 @@
#include <wayland-server.h> #include <wayland-server.h>
struct wlr_screenshooter { struct wlr_screenshooter {
struct wl_global *wl_global; struct wl_global *global;
struct wl_list screenshots; // wlr_screenshot::link struct wl_list screenshots; // wlr_screenshot::link
struct wl_listener display_destroy; struct wl_listener display_destroy;

View File

@ -17,7 +17,7 @@ struct wlr_seat_client {
struct wlr_seat *seat; struct wlr_seat *seat;
// lists of wl_resource // lists of wl_resource
struct wl_list wl_resources; struct wl_list resources;
struct wl_list pointers; struct wl_list pointers;
struct wl_list keyboards; struct wl_list keyboards;
struct wl_list touches; struct wl_list touches;
@ -170,7 +170,7 @@ struct wlr_seat_touch_state {
}; };
struct wlr_seat { struct wlr_seat {
struct wl_global *wl_global; struct wl_global *global;
struct wl_display *display; struct wl_display *display;
struct wl_list clients; struct wl_list clients;
struct wl_list drag_icons; // wlr_drag_icon::link struct wl_list drag_icons; // wlr_drag_icon::link

View File

@ -27,8 +27,8 @@ enum wlr_server_decoration_manager_mode {
}; };
struct wlr_server_decoration_manager { struct wlr_server_decoration_manager {
struct wl_global *wl_global; struct wl_global *global;
struct wl_list wl_resources; struct wl_list resources;
struct wl_list decorations; // wlr_server_decoration::link struct wl_list decorations; // wlr_server_decoration::link
uint32_t default_mode; // enum wlr_server_decoration_manager_mode uint32_t default_mode; // enum wlr_server_decoration_manager_mode

View File

@ -6,8 +6,8 @@
#include <wlr/types/wlr_seat.h> #include <wlr/types/wlr_seat.h>
struct wlr_wl_shell { struct wlr_wl_shell {
struct wl_global *wl_global; struct wl_global *global;
struct wl_list wl_resources; struct wl_list resources;
struct wl_list surfaces; struct wl_list surfaces;
struct wl_list popup_grabs; struct wl_list popup_grabs;
uint32_t ping_timeout; uint32_t ping_timeout;

View File

@ -6,7 +6,7 @@
#include "xdg-shell-protocol.h" #include "xdg-shell-protocol.h"
struct wlr_xdg_shell { struct wlr_xdg_shell {
struct wl_global *wl_global; struct wl_global *global;
struct wl_list clients; struct wl_list clients;
struct wl_list popup_grabs; struct wl_list popup_grabs;
uint32_t ping_timeout; uint32_t ping_timeout;

View File

@ -7,7 +7,7 @@
#include "xdg-shell-unstable-v6-protocol.h" #include "xdg-shell-unstable-v6-protocol.h"
struct wlr_xdg_shell_v6 { struct wlr_xdg_shell_v6 {
struct wl_global *wl_global; struct wl_global *global;
struct wl_list clients; struct wl_list clients;
struct wl_list popup_grabs; struct wl_list popup_grabs;
uint32_t ping_timeout; uint32_t ping_timeout;

View File

@ -227,7 +227,7 @@ static void data_device_manager_bind(struct wl_client *client,
wl_resource_set_implementation(resource, &data_device_manager_impl, wl_resource_set_implementation(resource, &data_device_manager_impl,
manager, data_device_manager_handle_resource_destroy); manager, data_device_manager_handle_resource_destroy);
wl_list_insert(&manager->wl_resources, wl_resource_get_link(resource)); wl_list_insert(&manager->resources, wl_resource_get_link(resource));
} }
void wlr_data_device_manager_destroy(struct wlr_data_device_manager *manager) { void wlr_data_device_manager_destroy(struct wlr_data_device_manager *manager) {
@ -238,7 +238,7 @@ void wlr_data_device_manager_destroy(struct wlr_data_device_manager *manager) {
wl_list_remove(&manager->display_destroy.link); wl_list_remove(&manager->display_destroy.link);
wl_global_destroy(manager->global); wl_global_destroy(manager->global);
struct wl_resource *resource, *tmp; struct wl_resource *resource, *tmp;
wl_resource_for_each_safe(resource, tmp, &manager->wl_resources) { wl_resource_for_each_safe(resource, tmp, &manager->resources) {
wl_resource_destroy(resource); wl_resource_destroy(resource);
} }
wl_resource_for_each_safe(resource, tmp, &manager->data_sources) { wl_resource_for_each_safe(resource, tmp, &manager->data_sources) {
@ -262,7 +262,7 @@ struct wlr_data_device_manager *wlr_data_device_manager_create(
return NULL; return NULL;
} }
wl_list_init(&manager->wl_resources); wl_list_init(&manager->resources);
wl_list_init(&manager->data_sources); wl_list_init(&manager->data_sources);
wl_signal_init(&manager->events.destroy); wl_signal_init(&manager->events.destroy);

View File

@ -62,7 +62,7 @@ static void seat_client_handle_resource_destroy(
wlr_seat_client_from_resource(seat_resource); wlr_seat_client_from_resource(seat_resource);
wl_list_remove(wl_resource_get_link(seat_resource)); wl_list_remove(wl_resource_get_link(seat_resource));
if (!wl_list_empty(&client->wl_resources)) { if (!wl_list_empty(&client->resources)) {
return; return;
} }
@ -133,7 +133,7 @@ static void seat_handle_bind(struct wl_client *client, void *_wlr_seat,
seat_client->client = client; seat_client->client = client;
seat_client->seat = wlr_seat; seat_client->seat = wlr_seat;
wl_list_init(&seat_client->wl_resources); wl_list_init(&seat_client->resources);
wl_list_init(&seat_client->pointers); wl_list_init(&seat_client->pointers);
wl_list_init(&seat_client->keyboards); wl_list_init(&seat_client->keyboards);
wl_list_init(&seat_client->touches); wl_list_init(&seat_client->touches);
@ -146,7 +146,7 @@ static void seat_handle_bind(struct wl_client *client, void *_wlr_seat,
wl_resource_set_implementation(wl_resource, &seat_impl, wl_resource_set_implementation(wl_resource, &seat_impl,
seat_client, seat_client_handle_resource_destroy); seat_client, seat_client_handle_resource_destroy);
wl_list_insert(&seat_client->wl_resources, wl_resource_get_link(wl_resource)); wl_list_insert(&seat_client->resources, wl_resource_get_link(wl_resource));
if (version >= WL_SEAT_NAME_SINCE_VERSION) { if (version >= WL_SEAT_NAME_SINCE_VERSION) {
wl_seat_send_name(wl_resource, wlr_seat->name); wl_seat_send_name(wl_resource, wlr_seat->name);
} }
@ -181,16 +181,16 @@ void wlr_seat_destroy(struct wlr_seat *seat) {
* 'next' update that usually is harmless here. * 'next' update that usually is harmless here.
* Work around this by breaking one step ahead * Work around this by breaking one step ahead
*/ */
wl_resource_for_each_safe(resource, next, &client->wl_resources) { wl_resource_for_each_safe(resource, next, &client->resources) {
// will destroy other resources as well // will destroy other resources as well
wl_resource_destroy(resource); wl_resource_destroy(resource);
if (wl_resource_get_link(next) == &client->wl_resources) { if (wl_resource_get_link(next) == &client->resources) {
break; break;
} }
} }
} }
wl_global_destroy(seat->wl_global); wl_global_destroy(seat->global);
free(seat->pointer_state.default_grab); free(seat->pointer_state.default_grab);
free(seat->keyboard_state.default_grab); free(seat->keyboard_state.default_grab);
free(seat->touch_state.default_grab); free(seat->touch_state.default_grab);
@ -258,9 +258,9 @@ struct wlr_seat *wlr_seat_create(struct wl_display *display, const char *name) {
seat->touch_state.seat = seat; seat->touch_state.seat = seat;
wl_list_init(&seat->touch_state.touch_points); wl_list_init(&seat->touch_state.touch_points);
seat->wl_global = wl_global_create(display, &wl_seat_interface, seat->global = wl_global_create(display, &wl_seat_interface,
SEAT_VERSION, seat, seat_handle_bind); SEAT_VERSION, seat, seat_handle_bind);
if (seat->wl_global == NULL) { if (seat->global == NULL) {
free(touch_grab); free(touch_grab);
free(pointer_grab); free(pointer_grab);
free(keyboard_grab); free(keyboard_grab);
@ -335,7 +335,7 @@ void wlr_seat_set_capabilities(struct wlr_seat *wlr_seat,
} }
struct wl_resource *resource; struct wl_resource *resource;
wl_resource_for_each(resource, &client->wl_resources) { wl_resource_for_each(resource, &client->resources) {
wl_seat_send_capabilities(resource, capabilities); wl_seat_send_capabilities(resource, capabilities);
} }
} }
@ -347,7 +347,7 @@ void wlr_seat_set_name(struct wlr_seat *wlr_seat, const char *name) {
struct wlr_seat_client *client; struct wlr_seat_client *client;
wl_list_for_each(client, &wlr_seat->clients, link) { wl_list_for_each(client, &wlr_seat->clients, link) {
struct wl_resource *resource; struct wl_resource *resource;
wl_resource_for_each(resource, &client->wl_resources) { wl_resource_for_each(resource, &client->resources) {
wl_seat_send_name(resource, name); wl_seat_send_name(resource, name);
} }
} }

View File

@ -102,30 +102,30 @@ static void subcompositor_bind(struct wl_client *client, void *data,
} }
wl_resource_set_implementation(resource, &subcompositor_impl, wl_resource_set_implementation(resource, &subcompositor_impl,
subcompositor, subcompositor_resource_destroy); subcompositor, subcompositor_resource_destroy);
wl_list_insert(&subcompositor->wl_resources, wl_resource_get_link(resource)); wl_list_insert(&subcompositor->resources, wl_resource_get_link(resource));
} }
static void subcompositor_init(struct wlr_subcompositor *subcompositor, static void subcompositor_init(struct wlr_subcompositor *subcompositor,
struct wl_display *display) { struct wl_display *display) {
subcompositor->wl_global = wl_global_create(display, subcompositor->global = wl_global_create(display,
&wl_subcompositor_interface, SUBCOMPOSITOR_VERSION, subcompositor, &wl_subcompositor_interface, SUBCOMPOSITOR_VERSION, subcompositor,
subcompositor_bind); subcompositor_bind);
if (subcompositor->wl_global == NULL) { if (subcompositor->global == NULL) {
wlr_log_errno(L_ERROR, "Could not allocate subcompositor global"); wlr_log_errno(L_ERROR, "Could not allocate subcompositor global");
return; return;
} }
wl_list_init(&subcompositor->wl_resources); wl_list_init(&subcompositor->resources);
wl_list_init(&subcompositor->subsurface_resources); wl_list_init(&subcompositor->subsurface_resources);
} }
static void subcompositor_finish(struct wlr_subcompositor *subcompositor) { static void subcompositor_finish(struct wlr_subcompositor *subcompositor) {
wl_global_destroy(subcompositor->wl_global); wl_global_destroy(subcompositor->global);
struct wl_resource *resource, *tmp; struct wl_resource *resource, *tmp;
wl_resource_for_each_safe(resource, tmp, wl_resource_for_each_safe(resource, tmp,
&subcompositor->subsurface_resources) { &subcompositor->subsurface_resources) {
wl_resource_destroy(resource); wl_resource_destroy(resource);
} }
wl_resource_for_each_safe(resource, tmp, &subcompositor->wl_resources) { wl_resource_for_each_safe(resource, tmp, &subcompositor->resources) {
wl_resource_destroy(resource); wl_resource_destroy(resource);
} }
} }
@ -183,7 +183,7 @@ static void compositor_bind(struct wl_client *wl_client, void *data,
} }
wl_resource_set_implementation(resource, &compositor_impl, wl_resource_set_implementation(resource, &compositor_impl,
compositor, compositor_resource_destroy); compositor, compositor_resource_destroy);
wl_list_insert(&compositor->wl_resources, wl_resource_get_link(resource)); wl_list_insert(&compositor->resources, wl_resource_get_link(resource));
} }
void wlr_compositor_destroy(struct wlr_compositor *compositor) { void wlr_compositor_destroy(struct wlr_compositor *compositor) {
@ -193,7 +193,7 @@ void wlr_compositor_destroy(struct wlr_compositor *compositor) {
wlr_signal_emit_safe(&compositor->events.destroy, compositor); wlr_signal_emit_safe(&compositor->events.destroy, compositor);
subcompositor_finish(&compositor->subcompositor); subcompositor_finish(&compositor->subcompositor);
wl_list_remove(&compositor->display_destroy.link); wl_list_remove(&compositor->display_destroy.link);
wl_global_destroy(compositor->wl_global); wl_global_destroy(compositor->global);
struct wl_resource *resource, *tmp; struct wl_resource *resource, *tmp;
wl_resource_for_each_safe(resource, tmp, &compositor->surface_resources) { wl_resource_for_each_safe(resource, tmp, &compositor->surface_resources) {
wl_resource_destroy(resource); wl_resource_destroy(resource);
@ -201,7 +201,7 @@ void wlr_compositor_destroy(struct wlr_compositor *compositor) {
wl_resource_for_each_safe(resource, tmp, &compositor->region_resources) { wl_resource_for_each_safe(resource, tmp, &compositor->region_resources) {
wl_resource_destroy(resource); wl_resource_destroy(resource);
} }
wl_resource_for_each_safe(resource, tmp, &compositor->wl_resources) { wl_resource_for_each_safe(resource, tmp, &compositor->resources) {
wl_resource_destroy(resource); wl_resource_destroy(resource);
} }
free(compositor); free(compositor);
@ -222,16 +222,16 @@ struct wlr_compositor *wlr_compositor_create(struct wl_display *display,
return NULL; return NULL;
} }
compositor->wl_global = wl_global_create(display, &wl_compositor_interface, compositor->global = wl_global_create(display, &wl_compositor_interface,
COMPOSITOR_VERSION, compositor, compositor_bind); COMPOSITOR_VERSION, compositor, compositor_bind);
if (!compositor->wl_global) { if (!compositor->global) {
free(compositor); free(compositor);
wlr_log_errno(L_ERROR, "Could not allocate compositor global"); wlr_log_errno(L_ERROR, "Could not allocate compositor global");
return NULL; return NULL;
} }
compositor->renderer = renderer; compositor->renderer = renderer;
wl_list_init(&compositor->wl_resources); wl_list_init(&compositor->resources);
wl_list_init(&compositor->surface_resources); wl_list_init(&compositor->surface_resources);
wl_list_init(&compositor->region_resources); wl_list_init(&compositor->region_resources);
wl_signal_init(&compositor->events.new_surface); wl_signal_init(&compositor->events.new_surface);

View File

@ -160,7 +160,7 @@ void wlr_gamma_control_manager_destroy(
wl_list_for_each_safe(gamma_control, tmp, &manager->controls, link) { wl_list_for_each_safe(gamma_control, tmp, &manager->controls, link) {
gamma_control_destroy(gamma_control); gamma_control_destroy(gamma_control);
} }
wl_global_destroy(manager->wl_global); wl_global_destroy(manager->global);
free(manager); free(manager);
} }
@ -177,14 +177,14 @@ struct wlr_gamma_control_manager *wlr_gamma_control_manager_create(
if (!manager) { if (!manager) {
return NULL; return NULL;
} }
struct wl_global *wl_global = wl_global_create(display, struct wl_global *global = wl_global_create(display,
&gamma_control_manager_interface, 1, manager, &gamma_control_manager_interface, 1, manager,
gamma_control_manager_bind); gamma_control_manager_bind);
if (!wl_global) { if (!global) {
free(manager); free(manager);
return NULL; return NULL;
} }
manager->wl_global = wl_global; manager->global = global;
wl_list_init(&manager->controls); wl_list_init(&manager->controls);

View File

@ -192,7 +192,7 @@ void wlr_idle_destroy(struct wlr_idle *idle) {
wl_list_for_each_safe(timer, tmp, &idle->idle_timers, link) { wl_list_for_each_safe(timer, tmp, &idle->idle_timers, link) {
idle_timeout_destroy(timer); idle_timeout_destroy(timer);
} }
wl_global_destroy(idle->wl_global); wl_global_destroy(idle->global);
free(idle); free(idle);
} }
@ -219,9 +219,9 @@ struct wlr_idle *wlr_idle_create(struct wl_display *display) {
idle->display_destroy.notify = handle_display_destroy; idle->display_destroy.notify = handle_display_destroy;
wl_display_add_destroy_listener(display, &idle->display_destroy); wl_display_add_destroy_listener(display, &idle->display_destroy);
idle->wl_global = wl_global_create(display, &org_kde_kwin_idle_interface, idle->global = wl_global_create(display, &org_kde_kwin_idle_interface,
1, idle, idle_bind); 1, idle, idle_bind);
if (idle->wl_global == NULL){ if (idle->global == NULL){
wl_list_remove(&idle->display_destroy.link); wl_list_remove(&idle->display_destroy.link);
free(idle); free(idle);
return NULL; return NULL;

View File

@ -132,7 +132,7 @@ static void idle_inhibit_bind(struct wl_client *wl_client, void *data,
return; return;
} }
wl_list_insert(&idle_inhibit->wl_resources, wl_resource_get_link(wl_resource)); wl_list_insert(&idle_inhibit->resources, wl_resource_get_link(wl_resource));
wl_resource_set_implementation(wl_resource, &idle_inhibit_impl, wl_resource_set_implementation(wl_resource, &idle_inhibit_impl,
idle_inhibit, idle_inhibit_manager_v1_handle_resource_destroy); idle_inhibit, idle_inhibit_manager_v1_handle_resource_destroy);
@ -154,7 +154,7 @@ void wlr_idle_inhibit_v1_destroy(struct wlr_idle_inhibit_manager_v1 *idle_inhibi
struct wl_resource *resource; struct wl_resource *resource;
struct wl_resource *tmp_resource; struct wl_resource *tmp_resource;
wl_resource_for_each_safe(resource, tmp_resource, &idle_inhibit->wl_resources) { wl_resource_for_each_safe(resource, tmp_resource, &idle_inhibit->resources) {
wl_resource_destroy(resource); wl_resource_destroy(resource);
} }
@ -170,7 +170,7 @@ struct wlr_idle_inhibit_manager_v1 *wlr_idle_inhibit_v1_create(struct wl_display
return NULL; return NULL;
} }
wl_list_init(&idle_inhibit->wl_resources); wl_list_init(&idle_inhibit->resources);
wl_list_init(&idle_inhibit->inhibitors); wl_list_init(&idle_inhibit->inhibitors);
idle_inhibit->display_destroy.notify = handle_display_destroy; idle_inhibit->display_destroy.notify = handle_display_destroy;
wl_display_add_destroy_listener(display, &idle_inhibit->display_destroy); wl_display_add_destroy_listener(display, &idle_inhibit->display_destroy);

View File

@ -113,7 +113,7 @@ void wlr_input_inhibit_manager_destroy(
manager->active_inhibitor); manager->active_inhibitor);
} }
wl_list_remove(&manager->display_destroy.link); wl_list_remove(&manager->display_destroy.link);
wl_global_destroy(manager->wl_global); wl_global_destroy(manager->global);
free(manager); free(manager);
} }
@ -132,10 +132,10 @@ struct wlr_input_inhibit_manager *wlr_input_inhibit_manager_create(
return NULL; return NULL;
} }
manager->wl_global = wl_global_create(display, manager->global = wl_global_create(display,
&zwlr_input_inhibit_manager_v1_interface, &zwlr_input_inhibit_manager_v1_interface,
1, manager, inhibit_manager_bind); 1, manager, inhibit_manager_bind);
if (manager->wl_global == NULL){ if (manager->global == NULL){
wl_list_remove(&manager->display_destroy.link); wl_list_remove(&manager->display_destroy.link);
free(manager); free(manager);
return NULL; return NULL;

View File

@ -434,13 +434,13 @@ struct wlr_layer_shell *wlr_layer_shell_create(struct wl_display *display) {
wl_list_init(&layer_shell->client_resources); wl_list_init(&layer_shell->client_resources);
wl_list_init(&layer_shell->surfaces); wl_list_init(&layer_shell->surfaces);
struct wl_global *wl_global = wl_global_create(display, struct wl_global *global = wl_global_create(display,
&zwlr_layer_shell_v1_interface, 1, layer_shell, layer_shell_bind); &zwlr_layer_shell_v1_interface, 1, layer_shell, layer_shell_bind);
if (!wl_global) { if (!global) {
free(layer_shell); free(layer_shell);
return NULL; return NULL;
} }
layer_shell->wl_global = wl_global; layer_shell->global = global;
wl_signal_init(&layer_shell->events.new_surface); wl_signal_init(&layer_shell->events.new_surface);
@ -459,7 +459,7 @@ void wlr_layer_shell_destroy(struct wlr_layer_shell *layer_shell) {
wl_resource_destroy(client); wl_resource_destroy(client);
} }
wl_list_remove(&layer_shell->display_destroy.link); wl_list_remove(&layer_shell->display_destroy.link);
wl_global_destroy(layer_shell->wl_global); wl_global_destroy(layer_shell->global);
free(layer_shell); free(layer_shell);
} }

View File

@ -438,7 +438,7 @@ static void linux_dmabuf_bind(struct wl_client *client, void *data,
} }
wl_resource_set_implementation(resource, &linux_dmabuf_impl, wl_resource_set_implementation(resource, &linux_dmabuf_impl,
linux_dmabuf, linux_dmabuf_resource_destroy); linux_dmabuf, linux_dmabuf_resource_destroy);
wl_list_insert(&linux_dmabuf->wl_resources, wl_resource_get_link(resource)); wl_list_insert(&linux_dmabuf->resources, wl_resource_get_link(resource));
if (version >= ZWP_LINUX_DMABUF_V1_MODIFIER_SINCE_VERSION) { if (version >= ZWP_LINUX_DMABUF_V1_MODIFIER_SINCE_VERSION) {
linux_dmabuf_send_modifiers(linux_dmabuf, resource); linux_dmabuf_send_modifiers(linux_dmabuf, resource);
@ -456,11 +456,11 @@ void wlr_linux_dmabuf_destroy(struct wlr_linux_dmabuf *linux_dmabuf) {
wl_list_remove(&linux_dmabuf->renderer_destroy.link); wl_list_remove(&linux_dmabuf->renderer_destroy.link);
struct wl_resource *resource, *tmp; struct wl_resource *resource, *tmp;
wl_resource_for_each_safe(resource, tmp, &linux_dmabuf->wl_resources) { wl_resource_for_each_safe(resource, tmp, &linux_dmabuf->resources) {
wl_resource_destroy(resource); wl_resource_destroy(resource);
} }
wl_global_destroy(linux_dmabuf->wl_global); wl_global_destroy(linux_dmabuf->global);
free(linux_dmabuf); free(linux_dmabuf);
} }
@ -486,13 +486,13 @@ struct wlr_linux_dmabuf *wlr_linux_dmabuf_create(struct wl_display *display,
} }
linux_dmabuf->renderer = renderer; linux_dmabuf->renderer = renderer;
wl_list_init(&linux_dmabuf->wl_resources); wl_list_init(&linux_dmabuf->resources);
wl_signal_init(&linux_dmabuf->events.destroy); wl_signal_init(&linux_dmabuf->events.destroy);
linux_dmabuf->wl_global = linux_dmabuf->global =
wl_global_create(display, &zwp_linux_dmabuf_v1_interface, wl_global_create(display, &zwp_linux_dmabuf_v1_interface,
LINUX_DMABUF_VERSION, linux_dmabuf, linux_dmabuf_bind); LINUX_DMABUF_VERSION, linux_dmabuf, linux_dmabuf_bind);
if (!linux_dmabuf->wl_global) { if (!linux_dmabuf->global) {
wlr_log(L_ERROR, "could not create linux dmabuf v1 wl global"); wlr_log(L_ERROR, "could not create linux dmabuf v1 wl global");
free(linux_dmabuf); free(linux_dmabuf);
return NULL; return NULL;

View File

@ -97,34 +97,34 @@ static void output_bind(struct wl_client *wl_client, void *data,
} }
wl_resource_set_implementation(resource, &output_impl, output, wl_resource_set_implementation(resource, &output_impl, output,
output_handle_resource_destroy); output_handle_resource_destroy);
wl_list_insert(&output->wl_resources, wl_resource_get_link(resource)); wl_list_insert(&output->resources, wl_resource_get_link(resource));
output_send_to_resource(resource); output_send_to_resource(resource);
} }
void wlr_output_create_global(struct wlr_output *output) { void wlr_output_create_global(struct wlr_output *output) {
if (output->wl_global != NULL) { if (output->global != NULL) {
return; return;
} }
output->wl_global = wl_global_create(output->display, output->global = wl_global_create(output->display,
&wl_output_interface, OUTPUT_VERSION, output, output_bind); &wl_output_interface, OUTPUT_VERSION, output, output_bind);
if (output->wl_global == NULL) { if (output->global == NULL) {
wlr_log(L_ERROR, "Failed to allocate wl_output global"); wlr_log(L_ERROR, "Failed to allocate wl_output global");
} }
} }
void wlr_output_destroy_global(struct wlr_output *output) { void wlr_output_destroy_global(struct wlr_output *output) {
if (output->wl_global == NULL) { if (output->global == NULL) {
return; return;
} }
// Make all output resources inert // Make all output resources inert
struct wl_resource *resource, *tmp; struct wl_resource *resource, *tmp;
wl_resource_for_each_safe(resource, tmp, &output->wl_resources) { wl_resource_for_each_safe(resource, tmp, &output->resources) {
wl_resource_set_user_data(resource, NULL); wl_resource_set_user_data(resource, NULL);
wl_list_remove(wl_resource_get_link(resource)); wl_list_remove(wl_resource_get_link(resource));
wl_list_init(wl_resource_get_link(resource)); wl_list_init(wl_resource_get_link(resource));
} }
wl_global_destroy(output->wl_global); wl_global_destroy(output->global);
output->wl_global = NULL; output->global = NULL;
} }
void wlr_output_update_enabled(struct wlr_output *output, bool enabled) { void wlr_output_update_enabled(struct wlr_output *output, bool enabled) {
@ -188,7 +188,7 @@ void wlr_output_update_custom_mode(struct wlr_output *output, int32_t width,
output->refresh = refresh; output->refresh = refresh;
struct wl_resource *resource; struct wl_resource *resource;
wl_resource_for_each(resource, &output->wl_resources) { wl_resource_for_each(resource, &output->resources) {
output_send_current_mode_to_resource(resource); output_send_current_mode_to_resource(resource);
} }
@ -202,7 +202,7 @@ void wlr_output_set_transform(struct wlr_output *output,
// TODO: only send geometry and done // TODO: only send geometry and done
struct wl_resource *resource; struct wl_resource *resource;
wl_resource_for_each(resource, &output->wl_resources) { wl_resource_for_each(resource, &output->resources) {
output_send_to_resource(resource); output_send_to_resource(resource);
} }
@ -220,7 +220,7 @@ void wlr_output_set_position(struct wlr_output *output, int32_t lx,
// TODO: only send geometry and done // TODO: only send geometry and done
struct wl_resource *resource; struct wl_resource *resource;
wl_resource_for_each(resource, &output->wl_resources) { wl_resource_for_each(resource, &output->resources) {
output_send_to_resource(resource); output_send_to_resource(resource);
} }
} }
@ -234,7 +234,7 @@ void wlr_output_set_scale(struct wlr_output *output, float scale) {
// TODO: only send mode and done // TODO: only send mode and done
struct wl_resource *resource; struct wl_resource *resource;
wl_resource_for_each(resource, &output->wl_resources) { wl_resource_for_each(resource, &output->resources) {
output_send_to_resource(resource); output_send_to_resource(resource);
} }
@ -260,7 +260,7 @@ void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend,
output->transform = WL_OUTPUT_TRANSFORM_NORMAL; output->transform = WL_OUTPUT_TRANSFORM_NORMAL;
output->scale = 1; output->scale = 1;
wl_list_init(&output->cursors); wl_list_init(&output->cursors);
wl_list_init(&output->wl_resources); wl_list_init(&output->resources);
wl_signal_init(&output->events.frame); wl_signal_init(&output->events.frame);
wl_signal_init(&output->events.needs_swap); wl_signal_init(&output->events.needs_swap);
wl_signal_init(&output->events.swap_buffers); wl_signal_init(&output->events.swap_buffers);

View File

@ -420,7 +420,7 @@ void wlr_primary_selection_device_manager_destroy(
return; return;
} }
wl_list_remove(&manager->display_destroy.link); wl_list_remove(&manager->display_destroy.link);
// TODO: free wl_resources // TODO: free resources
wl_global_destroy(manager->global); wl_global_destroy(manager->global);
free(manager); free(manager);
} }

View File

@ -177,7 +177,7 @@ void wlr_screenshooter_destroy(struct wlr_screenshooter *screenshooter) {
wl_list_for_each_safe(screenshot, tmp, &screenshooter->screenshots, link) { wl_list_for_each_safe(screenshot, tmp, &screenshooter->screenshots, link) {
screenshot_destroy(screenshot); screenshot_destroy(screenshot);
} }
wl_global_destroy(screenshooter->wl_global); wl_global_destroy(screenshooter->global);
free(screenshooter); free(screenshooter);
} }
@ -199,9 +199,9 @@ struct wlr_screenshooter *wlr_screenshooter_create(struct wl_display *display) {
screenshooter->display_destroy.notify = handle_display_destroy; screenshooter->display_destroy.notify = handle_display_destroy;
wl_display_add_destroy_listener(display, &screenshooter->display_destroy); wl_display_add_destroy_listener(display, &screenshooter->display_destroy);
screenshooter->wl_global = wl_global_create(display, screenshooter->global = wl_global_create(display,
&orbital_screenshooter_interface, 1, screenshooter, screenshooter_bind); &orbital_screenshooter_interface, 1, screenshooter, screenshooter_bind);
if (screenshooter->wl_global == NULL) { if (screenshooter->global == NULL) {
free(screenshooter); free(screenshooter);
return NULL; return NULL;
} }

View File

@ -132,7 +132,7 @@ void wlr_server_decoration_manager_set_default_mode(
manager->default_mode = default_mode; manager->default_mode = default_mode;
struct wl_resource *resource; struct wl_resource *resource;
wl_resource_for_each(resource, &manager->wl_resources) { wl_resource_for_each(resource, &manager->resources) {
org_kde_kwin_server_decoration_manager_send_default_mode(resource, org_kde_kwin_server_decoration_manager_send_default_mode(resource,
manager->default_mode); manager->default_mode);
} }
@ -156,7 +156,7 @@ static void server_decoration_manager_bind(struct wl_client *client, void *data,
wl_resource_set_implementation(resource, &server_decoration_manager_impl, wl_resource_set_implementation(resource, &server_decoration_manager_impl,
manager, server_decoration_manager_destroy_resource); manager, server_decoration_manager_destroy_resource);
wl_list_insert(&manager->wl_resources, wl_resource_get_link(resource)); wl_list_insert(&manager->resources, wl_resource_get_link(resource));
org_kde_kwin_server_decoration_manager_send_default_mode(resource, org_kde_kwin_server_decoration_manager_send_default_mode(resource,
manager->default_mode); manager->default_mode);
@ -174,10 +174,10 @@ void wlr_server_decoration_manager_destroy(
server_decoration_destroy(decoration); server_decoration_destroy(decoration);
} }
struct wl_resource *resource, *tmp_resource; struct wl_resource *resource, *tmp_resource;
wl_resource_for_each_safe(resource, tmp_resource, &manager->wl_resources) { wl_resource_for_each_safe(resource, tmp_resource, &manager->resources) {
server_decoration_manager_destroy_resource(resource); server_decoration_manager_destroy_resource(resource);
} }
wl_global_destroy(manager->wl_global); wl_global_destroy(manager->global);
free(manager); free(manager);
} }
@ -194,15 +194,15 @@ struct wlr_server_decoration_manager *wlr_server_decoration_manager_create(
if (manager == NULL) { if (manager == NULL) {
return NULL; return NULL;
} }
manager->wl_global = wl_global_create(display, manager->global = wl_global_create(display,
&org_kde_kwin_server_decoration_manager_interface, 1, manager, &org_kde_kwin_server_decoration_manager_interface, 1, manager,
server_decoration_manager_bind); server_decoration_manager_bind);
if (manager->wl_global == NULL) { if (manager->global == NULL) {
free(manager); free(manager);
return NULL; return NULL;
} }
manager->default_mode = ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_NONE; manager->default_mode = ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_NONE;
wl_list_init(&manager->wl_resources); wl_list_init(&manager->resources);
wl_list_init(&manager->decorations); wl_list_init(&manager->decorations);
wl_signal_init(&manager->events.new_decoration); wl_signal_init(&manager->events.new_decoration);

View File

@ -932,7 +932,7 @@ void wlr_surface_send_enter(struct wlr_surface *surface,
struct wlr_output *output) { struct wlr_output *output) {
struct wl_client *client = wl_resource_get_client(surface->resource); struct wl_client *client = wl_resource_get_client(surface->resource);
struct wl_resource *resource; struct wl_resource *resource;
wl_resource_for_each(resource, &output->wl_resources) { wl_resource_for_each(resource, &output->resources) {
if (client == wl_resource_get_client(resource)) { if (client == wl_resource_get_client(resource)) {
wl_surface_send_enter(surface->resource, resource); wl_surface_send_enter(surface->resource, resource);
} }
@ -943,7 +943,7 @@ void wlr_surface_send_leave(struct wlr_surface *surface,
struct wlr_output *output) { struct wlr_output *output) {
struct wl_client *client = wl_resource_get_client(surface->resource); struct wl_client *client = wl_resource_get_client(surface->resource);
struct wl_resource *resource; struct wl_resource *resource;
wl_resource_for_each(resource, &output->wl_resources) { wl_resource_for_each(resource, &output->resources) {
if (client == wl_resource_get_client(resource)) { if (client == wl_resource_get_client(resource)) {
wl_surface_send_leave(surface->resource, resource); wl_surface_send_leave(surface->resource, resource);
} }

View File

@ -596,7 +596,7 @@ static void shell_bind(struct wl_client *wl_client, void *data,
} }
wl_resource_set_implementation(wl_resource, &shell_impl, wl_shell, wl_resource_set_implementation(wl_resource, &shell_impl, wl_shell,
shell_destroy); shell_destroy);
wl_list_insert(&wl_shell->wl_resources, wl_resource_get_link(wl_resource)); wl_list_insert(&wl_shell->resources, wl_resource_get_link(wl_resource));
} }
static void handle_display_destroy(struct wl_listener *listener, void *data) { static void handle_display_destroy(struct wl_listener *listener, void *data) {
@ -611,14 +611,14 @@ struct wlr_wl_shell *wlr_wl_shell_create(struct wl_display *display) {
return NULL; return NULL;
} }
wl_shell->ping_timeout = 10000; wl_shell->ping_timeout = 10000;
struct wl_global *wl_global = wl_global_create(display, &wl_shell_interface, struct wl_global *global = wl_global_create(display, &wl_shell_interface,
1, wl_shell, shell_bind); 1, wl_shell, shell_bind);
if (!wl_global) { if (!global) {
free(wl_shell); free(wl_shell);
return NULL; return NULL;
} }
wl_shell->wl_global = wl_global; wl_shell->global = global;
wl_list_init(&wl_shell->wl_resources); wl_list_init(&wl_shell->resources);
wl_list_init(&wl_shell->surfaces); wl_list_init(&wl_shell->surfaces);
wl_list_init(&wl_shell->popup_grabs); wl_list_init(&wl_shell->popup_grabs);
wl_signal_init(&wl_shell->events.new_surface); wl_signal_init(&wl_shell->events.new_surface);
@ -635,12 +635,12 @@ void wlr_wl_shell_destroy(struct wlr_wl_shell *wlr_wl_shell) {
} }
wl_list_remove(&wlr_wl_shell->display_destroy.link); wl_list_remove(&wlr_wl_shell->display_destroy.link);
struct wl_resource *resource = NULL, *temp = NULL; struct wl_resource *resource = NULL, *temp = NULL;
wl_resource_for_each_safe(resource, temp, &wlr_wl_shell->wl_resources) { wl_resource_for_each_safe(resource, temp, &wlr_wl_shell->resources) {
// shell_destroy will remove the resource from the list // shell_destroy will remove the resource from the list
wl_resource_destroy(resource); wl_resource_destroy(resource);
} }
// TODO: destroy surfaces // TODO: destroy surfaces
wl_global_destroy(wlr_wl_shell->wl_global); wl_global_destroy(wlr_wl_shell->global);
free(wlr_wl_shell); free(wlr_wl_shell);
} }

View File

@ -146,13 +146,13 @@ struct wlr_xdg_shell *wlr_xdg_shell_create(struct wl_display *display) {
wl_list_init(&xdg_shell->clients); wl_list_init(&xdg_shell->clients);
wl_list_init(&xdg_shell->popup_grabs); wl_list_init(&xdg_shell->popup_grabs);
struct wl_global *wl_global = wl_global_create(display, struct wl_global *global = wl_global_create(display,
&xdg_wm_base_interface, WM_BASE_VERSION, xdg_shell, xdg_shell_bind); &xdg_wm_base_interface, WM_BASE_VERSION, xdg_shell, xdg_shell_bind);
if (!wl_global) { if (!global) {
free(xdg_shell); free(xdg_shell);
return NULL; return NULL;
} }
xdg_shell->wl_global = wl_global; xdg_shell->global = global;
wl_signal_init(&xdg_shell->events.new_surface); wl_signal_init(&xdg_shell->events.new_surface);
@ -167,6 +167,6 @@ void wlr_xdg_shell_destroy(struct wlr_xdg_shell *xdg_shell) {
return; return;
} }
wl_list_remove(&xdg_shell->display_destroy.link); wl_list_remove(&xdg_shell->display_destroy.link);
wl_global_destroy(xdg_shell->wl_global); wl_global_destroy(xdg_shell->global);
free(xdg_shell); free(xdg_shell);
} }

View File

@ -147,13 +147,13 @@ struct wlr_xdg_shell_v6 *wlr_xdg_shell_v6_create(struct wl_display *display) {
wl_list_init(&xdg_shell->clients); wl_list_init(&xdg_shell->clients);
wl_list_init(&xdg_shell->popup_grabs); wl_list_init(&xdg_shell->popup_grabs);
struct wl_global *wl_global = wl_global_create(display, struct wl_global *global = wl_global_create(display,
&zxdg_shell_v6_interface, SHELL_VERSION, xdg_shell, xdg_shell_bind); &zxdg_shell_v6_interface, SHELL_VERSION, xdg_shell, xdg_shell_bind);
if (!wl_global) { if (!global) {
free(xdg_shell); free(xdg_shell);
return NULL; return NULL;
} }
xdg_shell->wl_global = wl_global; xdg_shell->global = global;
wl_signal_init(&xdg_shell->events.new_surface); wl_signal_init(&xdg_shell->events.new_surface);
@ -168,6 +168,6 @@ void wlr_xdg_shell_v6_destroy(struct wlr_xdg_shell_v6 *xdg_shell) {
return; return;
} }
wl_list_remove(&xdg_shell->display_destroy.link); wl_list_remove(&xdg_shell->display_destroy.link);
wl_global_destroy(xdg_shell->wl_global); wl_global_destroy(xdg_shell->global);
free(xdg_shell); free(xdg_shell);
} }