Merge pull request #693 from emersion/fix-output-bind-multiple

Fix clients binding multiple times to the same output
This commit is contained in:
Drew DeVault 2018-03-01 11:23:41 -05:00 committed by GitHub
commit 0820557c8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 8 deletions

View file

@ -16,9 +16,7 @@
#include "util/signal.h" #include "util/signal.h"
static void wl_output_send_to_resource(struct wl_resource *resource) { static void wl_output_send_to_resource(struct wl_resource *resource) {
assert(resource);
struct wlr_output *output = wlr_output_from_resource(resource); struct wlr_output *output = wlr_output_from_resource(resource);
assert(output);
const uint32_t version = wl_resource_get_version(resource); const uint32_t version = wl_resource_get_version(resource);
if (version >= WL_OUTPUT_GEOMETRY_SINCE_VERSION) { if (version >= WL_OUTPUT_GEOMETRY_SINCE_VERSION) {
wl_output_send_geometry(resource, output->lx, output->ly, wl_output_send_geometry(resource, output->lx, output->ly,
@ -52,9 +50,7 @@ static void wl_output_send_to_resource(struct wl_resource *resource) {
static void wlr_output_send_current_mode_to_resource( static void wlr_output_send_current_mode_to_resource(
struct wl_resource *resource) { struct wl_resource *resource) {
assert(resource);
struct wlr_output *output = wlr_output_from_resource(resource); struct wlr_output *output = wlr_output_from_resource(resource);
assert(output);
const uint32_t version = wl_resource_get_version(resource); const uint32_t version = wl_resource_get_version(resource);
if (version < WL_OUTPUT_MODE_SINCE_VERSION) { if (version < WL_OUTPUT_MODE_SINCE_VERSION) {
return; return;
@ -76,7 +72,7 @@ static void wlr_output_send_current_mode_to_resource(
static void wl_output_destroy(struct wl_resource *resource) { static void wl_output_destroy(struct wl_resource *resource) {
struct wlr_output *output = wlr_output_from_resource(resource); struct wlr_output *output = wlr_output_from_resource(resource);
struct wl_resource *_resource = NULL; struct wl_resource *_resource;
wl_resource_for_each(_resource, &output->wl_resources) { wl_resource_for_each(_resource, &output->wl_resources) {
if (_resource == resource) { if (_resource == resource) {
struct wl_list *link = wl_resource_get_link(_resource); struct wl_list *link = wl_resource_get_link(_resource);
@ -98,7 +94,6 @@ static struct wl_output_interface wl_output_impl = {
static void wl_output_bind(struct wl_client *wl_client, void *data, static void wl_output_bind(struct wl_client *wl_client, void *data,
uint32_t version, uint32_t id) { uint32_t version, uint32_t id) {
struct wlr_output *wlr_output = data; struct wlr_output *wlr_output = data;
assert(wl_client && wlr_output);
struct wl_resource *wl_resource = wl_resource_create(wl_client, struct wl_resource *wl_resource = wl_resource_create(wl_client,
&wl_output_interface, version, id); &wl_output_interface, version, id);

View file

@ -901,7 +901,6 @@ void wlr_surface_send_enter(struct wlr_surface *surface,
wl_resource_for_each(resource, &output->wl_resources) { wl_resource_for_each(resource, &output->wl_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);
break;
} }
} }
} }
@ -913,7 +912,6 @@ void wlr_surface_send_leave(struct wlr_surface *surface,
wl_resource_for_each(resource, &output->wl_resources) { wl_resource_for_each(resource, &output->wl_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);
break;
} }
} }
} }