summaryrefslogtreecommitdiff
path: root/src/wayland/meta-wayland-outputs.c
blob: cb393ddf50f398d20b9ce657b77cfd7e0abd8591 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */

/*
 * Copyright (C) 2014 Red Hat
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 * 02111-1307, USA.
 *
 * Written by:
 *     Jasper St. Pierre <jstpierre@mecheye.net>
 */

#include "config.h"

#include "wayland/meta-wayland-outputs.h"

#include <string.h>

#include "backends/meta-logical-monitor.h"
#include "backends/meta-monitor.h"
#include "backends/meta-monitor-manager-private.h"
#include "wayland/meta-wayland-private.h"

#include "xdg-output-unstable-v1-server-protocol.h"


enum {
  OUTPUT_DESTROYED,

  LAST_SIGNAL
};

static guint signals[LAST_SIGNAL];

G_DEFINE_TYPE (MetaWaylandOutput, meta_wayland_output, G_TYPE_OBJECT)

static void
send_xdg_output_events (struct wl_resource *resource,
                        MetaWaylandOutput  *wayland_output,
                        MetaLogicalMonitor *logical_monitor,
                        gboolean            need_all_events,
                        gboolean           *pending_done_event);

static void
output_resource_destroy (struct wl_resource *res)
{
  MetaWaylandOutput *wayland_output;

  wayland_output = wl_resource_get_user_data (res);
  if (!wayland_output)
    return;

  wayland_output->resources = g_list_remove (wayland_output->resources, res);
}

static MetaMonitor *
pick_main_monitor (MetaLogicalMonitor *logical_monitor)
{
  GList *monitors;

  monitors = meta_logical_monitor_get_monitors (logical_monitor);
  return g_list_first (monitors)->data;
}

static enum wl_output_subpixel
cogl_subpixel_order_to_wl_output_subpixel (CoglSubpixelOrder subpixel_order)
{
  switch (subpixel_order)
    {
    case COGL_SUBPIXEL_ORDER_UNKNOWN:
      return WL_OUTPUT_SUBPIXEL_UNKNOWN;
    case COGL_SUBPIXEL_ORDER_NONE:
      return WL_OUTPUT_SUBPIXEL_NONE;
    case COGL_SUBPIXEL_ORDER_HORIZONTAL_RGB:
      return WL_OUTPUT_SUBPIXEL_HORIZONTAL_RGB;
    case COGL_SUBPIXEL_ORDER_HORIZONTAL_BGR:
      return WL_OUTPUT_SUBPIXEL_HORIZONTAL_BGR;
    case COGL_SUBPIXEL_ORDER_VERTICAL_RGB:
      return WL_OUTPUT_SUBPIXEL_VERTICAL_RGB;
    case COGL_SUBPIXEL_ORDER_VERTICAL_BGR:
      return WL_OUTPUT_SUBPIXEL_VERTICAL_BGR;
    }

  g_assert_not_reached ();
}

static enum wl_output_subpixel
calculate_suitable_subpixel_order (MetaLogicalMonitor *logical_monitor)
{
  GList *monitors;
  GList *l;
  MetaMonitor *first_monitor;
  CoglSubpixelOrder subpixel_order;

  monitors = meta_logical_monitor_get_monitors (logical_monitor);
  first_monitor = monitors->data;
  subpixel_order = meta_monitor_get_subpixel_order (first_monitor);

  for (l = monitors->next; l; l = l->next)
    {
      MetaMonitor *monitor = l->data;

      if (meta_monitor_get_subpixel_order (monitor) != subpixel_order)
        {
          subpixel_order = COGL_SUBPIXEL_ORDER_UNKNOWN;
          break;
        }
    }

  return cogl_subpixel_order_to_wl_output_subpixel (subpixel_order);
}

static int
calculate_wayland_output_scale (MetaLogicalMonitor *logical_monitor)
{
  float scale;

  scale = meta_logical_monitor_get_scale (logical_monitor);
  return ceilf (scale);
}

static void
get_rotated_physical_dimensions (MetaMonitor *monitor,
                                 int         *width_mm,
                                 int         *height_mm)
{
  int monitor_width_mm, monitor_height_mm;
  MetaLogicalMonitor *logical_monitor;

  meta_monitor_get_physical_dimensions (monitor,
                                        &monitor_width_mm,
                                        &monitor_height_mm);
  logical_monitor = meta_monitor_get_logical_monitor (monitor);

  if (meta_monitor_transform_is_rotated (logical_monitor->transform))
    {
      *width_mm = monitor_height_mm;
      *height_mm = monitor_width_mm;
    }
  else
    {
      *width_mm = monitor_width_mm;
      *height_mm = monitor_height_mm;
    }
}

static gboolean
is_different_rotation (MetaLogicalMonitor *a,
                       MetaLogicalMonitor *b)
{
  return (meta_monitor_transform_is_rotated (a->transform) !=
          meta_monitor_transform_is_rotated (b->transform));
}

static void
send_output_events (struct wl_resource *resource,
                    MetaWaylandOutput  *wayland_output,
                    MetaLogicalMonitor *logical_monitor,
                    gboolean            need_all_events,
                    gboolean           *pending_done_event)
{
  int version = wl_resource_get_version (resource);
  MetaMonitor *monitor;
  MetaMonitorMode *current_mode;
  MetaMonitorMode *preferred_mode;
  guint mode_flags = WL_OUTPUT_MODE_CURRENT;
  MetaLogicalMonitor *old_logical_monitor;
  guint old_mode_flags;
  gint old_scale;
  float old_refresh_rate;
  float refresh_rate;

  old_logical_monitor = wayland_output->logical_monitor;
  old_mode_flags = wayland_output->mode_flags;
  old_scale = wayland_output->scale;
  old_refresh_rate = wayland_output->refresh_rate;

  monitor = pick_main_monitor (logical_monitor);

  current_mode = meta_monitor_get_current_mode (monitor);
  refresh_rate = meta_monitor_mode_get_refresh_rate (current_mode);

  gboolean need_done = FALSE;

  if (need_all_events ||
      old_logical_monitor->rect.x != logical_monitor->rect.x ||
      old_logical_monitor->rect.y != logical_monitor->rect.y ||
      is_different_rotation (old_logical_monitor, logical_monitor))
    {
      int width_mm, height_mm;
      const char *vendor;
      const char *product;
      uint32_t transform;
      enum wl_output_subpixel subpixel_order;

      /*
       * While the wl_output carries information specific to a single monitor,
       * it is actually referring to a region of the compositor's screen region
       * (logical monitor), which may consist of multiple monitors (clones).
       * Arbitrarily use whatever monitor is the first in the logical monitor
       * and use that for these details.
       */
      get_rotated_physical_dimensions (monitor, &width_mm, &height_mm);
      vendor = meta_monitor_get_vendor (monitor);
      product = meta_monitor_get_product (monitor);

      subpixel_order = calculate_suitable_subpixel_order (logical_monitor);

      /*
       * TODO: When we support wl_surface.set_buffer_transform, pass along
       * the correct transform here instead of always pretending its 'normal'.
       * The reason for this is to try stopping clients from setting any buffer
       * transform other than 'normal'.
       */
      transform = WL_OUTPUT_TRANSFORM_NORMAL;

      wl_output_send_geometry (resource,
                               logical_monitor->rect.x,
                               logical_monitor->rect.y,
                               width_mm,
                               height_mm,
                               subpixel_order,
                               vendor,
                               product,
                               transform);
      need_done = TRUE;
    }

  preferred_mode = meta_monitor_get_preferred_mode (monitor);
  if (current_mode == preferred_mode)
    mode_flags |= WL_OUTPUT_MODE_PREFERRED;

  if (need_all_events ||
      old_logical_monitor->rect.width != logical_monitor->rect.width ||
      old_logical_monitor->rect.height != logical_monitor->rect.height ||
      old_refresh_rate != refresh_rate ||
      old_mode_flags != mode_flags)
    {
      wl_output_send_mode (resource,
                           mode_flags,
                           logical_monitor->rect.width,
                           logical_monitor->rect.height,
                           (int32_t) (refresh_rate * 1000));
      need_done = TRUE;
    }

  if (version >= WL_OUTPUT_SCALE_SINCE_VERSION)
    {
      int scale;

      scale = calculate_wayland_output_scale (logical_monitor);
      if (need_all_events ||
          old_scale != scale)
        {
          wl_output_send_scale (resource, scale);
          need_done = TRUE;
        }
    }

  if (need_all_events && version >= WL_OUTPUT_DONE_SINCE_VERSION)
    {
      wl_output_send_done (resource);
      need_done = FALSE;
    }

  if (pending_done_event && need_done)
    *pending_done_event = TRUE;
}

static void
bind_output (struct wl_client *client,
             void *data,
             guint32 version,
             guint32 id)
{
  MetaWaylandOutput *wayland_output = data;
  MetaLogicalMonitor *logical_monitor = wayland_output->logical_monitor;
  struct wl_resource *resource;
#ifdef WITH_VERBOSE_MODE
  MetaMonitor *monitor;
#endif

  resource = wl_resource_create (client, &wl_output_interface, version, id);
  wayland_output->resources = g_list_prepend (wayland_output->resources, resource);

  wl_resource_set_user_data (resource, wayland_output);
  wl_resource_set_destructor (resource, output_resource_destroy);

  if (!logical_monitor)
    return;

#ifdef WITH_VERBOSE_MODE
  monitor = pick_main_monitor (logical_monitor);

  meta_verbose ("Binding monitor %p/%s (%u, %u, %u, %u) x %f\n",
                logical_monitor,
                meta_monitor_get_product (monitor),
                logical_monitor->rect.x, logical_monitor->rect.y,
                logical_monitor->rect.width, logical_monitor->rect.height,
                wayland_output->refresh_rate);
#endif

  send_output_events (resource, wayland_output, logical_monitor, TRUE, NULL);
}

static void
wayland_output_destroy_notify (gpointer data)
{
  MetaWaylandOutput *wayland_output = data;

  g_signal_emit (wayland_output, signals[OUTPUT_DESTROYED], 0);
  g_object_unref (wayland_output);
}

static void
meta_wayland_output_set_logical_monitor (MetaWaylandOutput  *wayland_output,
                                         MetaLogicalMonitor *logical_monitor)
{
  MetaMonitor *monitor;
  MetaMonitorMode *current_mode;
  MetaMonitorMode *preferred_mode;

  wayland_output->logical_monitor = logical_monitor;
  wayland_output->mode_flags = WL_OUTPUT_MODE_CURRENT;

  monitor = pick_main_monitor (logical_monitor);
  current_mode = meta_monitor_get_current_mode (monitor);
  preferred_mode = meta_monitor_get_preferred_mode (monitor);

  if (current_mode == preferred_mode)
    wayland_output->mode_flags |= WL_OUTPUT_MODE_PREFERRED;
  wayland_output->scale = calculate_wayland_output_scale (logical_monitor);
  wayland_output->refresh_rate = meta_monitor_mode_get_refresh_rate (current_mode);
}

static void
wayland_output_update_for_output (MetaWaylandOutput  *wayland_output,
                                  MetaLogicalMonitor *logical_monitor)
{
  GList *iter;
  gboolean pending_done_event;

  pending_done_event = FALSE;
  for (iter = wayland_output->resources; iter; iter = iter->next)
    {
      struct wl_resource *resource = iter->data;
      send_output_events (resource, wayland_output, logical_monitor, FALSE, &pending_done_event);
    }

  for (iter = wayland_output->xdg_output_resources; iter; iter = iter->next)
    {
      struct wl_resource *xdg_output = iter->data;
      send_xdg_output_events (xdg_output, wayland_output, logical_monitor, FALSE, &pending_done_event);
    }

  /* Send the "done" events if needed */
  if (pending_done_event)
    {
      for (iter = wayland_output->resources; iter; iter = iter->next)
        {
          struct wl_resource *resource = iter->data;
          if (wl_resource_get_version (resource) >= WL_OUTPUT_DONE_SINCE_VERSION)
            wl_output_send_done (resource);
        }

      for (iter = wayland_output->xdg_output_resources; iter; iter = iter->next)
        {
          struct wl_resource *xdg_output = iter->data;
          zxdg_output_v1_send_done (xdg_output);
        }
    }
  /* It's very important that we change the output pointer here, as
     the old structure is about to be freed by MetaMonitorManager */
  meta_wayland_output_set_logical_monitor (wayland_output, logical_monitor);
}

static MetaWaylandOutput *
meta_wayland_output_new (MetaWaylandCompositor *compositor,
                         MetaLogicalMonitor    *logical_monitor)
{
  MetaWaylandCompositor *wayland_compositor =
    meta_wayland_compositor_get_default ();
  MetaWaylandOutput *wayland_output;

  wayland_output = g_object_new (META_TYPE_WAYLAND_OUTPUT, NULL);
  wayland_output->global = wl_global_create (compositor->wayland_display,
                                             &wl_output_interface,
                                             META_WL_OUTPUT_VERSION,
                                             wayland_output, bind_output);
  meta_wayland_compositor_flush_clients (wayland_compositor);
  meta_wayland_output_set_logical_monitor (wayland_output, logical_monitor);

  return wayland_output;
}

static void
make_output_resources_inert (MetaWaylandOutput *wayland_output)
{
  GList *l;

  for (l = wayland_output->resources; l; l = l->next)
    {
      struct wl_resource *output_resource = l->data;

      wl_resource_set_user_data (output_resource, NULL);
    }
  g_list_free (wayland_output->resources);
  wayland_output->resources = NULL;

  for (l = wayland_output->xdg_output_resources; l; l = l->next)
    {
      struct wl_resource *xdg_output_resource = l->data;

      wl_resource_set_user_data (xdg_output_resource, NULL);
    }
  g_list_free (wayland_output->xdg_output_resources);
  wayland_output->xdg_output_resources = NULL;
}

static void
make_output_inert (gpointer key,
                   gpointer value,
                   gpointer data)
{
  MetaWaylandOutput *wayland_output = value;

  wayland_output->logical_monitor = NULL;
  make_output_resources_inert (wayland_output);
}

static gboolean
delayed_destroy_outputs (gpointer data)
{
  g_hash_table_destroy (data);
  return G_SOURCE_REMOVE;
}

static GHashTable *
meta_wayland_compositor_update_outputs (MetaWaylandCompositor *compositor,
                                        MetaMonitorManager    *monitor_manager)
{
  GHashTable *new_table;
  GList *logical_monitors, *l;

  logical_monitors =
    meta_monitor_manager_get_logical_monitors (monitor_manager);
  new_table = g_hash_table_new_full (NULL, NULL, NULL,
                                     wayland_output_destroy_notify);

  for (l = logical_monitors; l; l = l->next)
    {
      MetaLogicalMonitor *logical_monitor = l->data;
      MetaWaylandOutput *wayland_output;

      if (logical_monitor->winsys_id == 0)
        continue;

      wayland_output =
        g_hash_table_lookup (compositor->outputs,
                             GSIZE_TO_POINTER (logical_monitor->winsys_id));

      if (wayland_output)
        {
          g_hash_table_steal (compositor->outputs,
                              GSIZE_TO_POINTER (logical_monitor->winsys_id));
        }
      else
        {
          wayland_output = meta_wayland_output_new (compositor, logical_monitor);
        }

      wayland_output_update_for_output (wayland_output, logical_monitor);
      g_hash_table_insert (new_table,
                           GSIZE_TO_POINTER (logical_monitor->winsys_id),
                           wayland_output);
    }

  g_hash_table_foreach (compositor->outputs, make_output_inert, NULL);
  g_timeout_add_seconds (10, delayed_destroy_outputs, compositor->outputs);

  return new_table;
}

static void
on_monitors_changed (MetaMonitorManager    *monitors,
                     MetaWaylandCompositor *compositor)
{
  compositor->outputs = meta_wayland_compositor_update_outputs (compositor, monitors);
}

static void
meta_wayland_output_init (MetaWaylandOutput *wayland_output)
{
}

static void
meta_wayland_output_finalize (GObject *object)
{
  MetaWaylandOutput *wayland_output = META_WAYLAND_OUTPUT (object);

  wl_global_destroy (wayland_output->global);

  /* Make sure the wl_output destructor doesn't try to access MetaWaylandOutput
   * after we have freed it.
   */
  make_output_resources_inert (wayland_output);

  G_OBJECT_CLASS (meta_wayland_output_parent_class)->finalize (object);
}

static void
meta_wayland_output_class_init (MetaWaylandOutputClass *klass)
{
  GObjectClass *object_class = G_OBJECT_CLASS (klass);

  object_class->finalize = meta_wayland_output_finalize;

  signals[OUTPUT_DESTROYED] = g_signal_new ("output-destroyed",
                                            G_TYPE_FROM_CLASS (object_class),
                                            G_SIGNAL_RUN_LAST,
                                            0,
                                            NULL, NULL, NULL,
                                            G_TYPE_NONE, 0);
}

static void
meta_xdg_output_destructor (struct wl_resource *resource)
{
  MetaWaylandOutput *wayland_output;

  wayland_output = wl_resource_get_user_data (resource);
  if (!wayland_output)
    return;

  wayland_output->xdg_output_resources =
    g_list_remove (wayland_output->xdg_output_resources, resource);
}

static void
meta_xdg_output_destroy (struct wl_client   *client,
                         struct wl_resource *resource)
{
  wl_resource_destroy (resource);
}

static const struct zxdg_output_v1_interface
  meta_xdg_output_interface = {
    meta_xdg_output_destroy,
  };

static void
send_xdg_output_events (struct wl_resource *resource,
                        MetaWaylandOutput  *wayland_output,
                        MetaLogicalMonitor *logical_monitor,
                        gboolean            need_all_events,
                        gboolean           *pending_done_event)
{
  MetaRectangle new_layout;
  MetaRectangle old_layout;
  MetaLogicalMonitor *old_logical_monitor;
  gboolean need_done;

  need_done = FALSE;
  old_logical_monitor = wayland_output->logical_monitor;
  old_layout = meta_logical_monitor_get_layout (old_logical_monitor);
  new_layout = meta_logical_monitor_get_layout (logical_monitor);

  if (need_all_events ||
      old_layout.x != new_layout.x ||
      old_layout.y != new_layout.y)
    {
      zxdg_output_v1_send_logical_position (resource,
                                            new_layout.x,
                                            new_layout.y);
      need_done = TRUE;
    }

  if (need_all_events ||
      old_layout.width != new_layout.width ||
      old_layout.height != new_layout.height)
    {
      zxdg_output_v1_send_logical_size (resource,
                                        new_layout.width,
                                        new_layout.height);
      need_done = TRUE;
    }

  if (need_all_events)
    {
      zxdg_output_v1_send_done (resource);
      need_done = FALSE;
    }

  if (pending_done_event && need_done)
    *pending_done_event = TRUE;
}

static void
meta_xdg_output_manager_get_xdg_output (struct wl_client   *client,
                                        struct wl_resource *resource,
                                        uint32_t            id,
                                        struct wl_resource *output)
{
  struct wl_resource *xdg_output_resource;
  MetaWaylandOutput *wayland_output;

  xdg_output_resource = wl_resource_create (client,
                                            &zxdg_output_v1_interface,
                                            wl_resource_get_version (resource),
                                            id);

  wl_resource_set_implementation (xdg_output_resource,
                                  &meta_xdg_output_interface,
                                  NULL, meta_xdg_output_destructor);

  wayland_output = wl_resource_get_user_data (output);
  if (!wayland_output)
    return;

  wayland_output->xdg_output_resources =
    g_list_prepend (wayland_output->xdg_output_resources, xdg_output_resource);

  if (!wayland_output->logical_monitor)
    return;

  send_xdg_output_events (xdg_output_resource,
                          wayland_output,
                          wayland_output->logical_monitor,
                          TRUE, NULL);
}

static void
meta_xdg_output_manager_destroy (struct wl_client   *client,
                                 struct wl_resource *resource)
{
  wl_resource_destroy (resource);
}

static const struct zxdg_output_manager_v1_interface
  meta_xdg_output_manager_interface = {
    meta_xdg_output_manager_destroy,
    meta_xdg_output_manager_get_xdg_output,
  };

static void
bind_xdg_output_manager (struct wl_client *client,
                         void             *data,
                         uint32_t          version,
                         uint32_t          id)
{
  struct wl_resource *resource;

  resource = wl_resource_create (client,
                                 &zxdg_output_manager_v1_interface,
                                 version, id);

  wl_resource_set_implementation (resource,
                                  &meta_xdg_output_manager_interface,
                                  NULL, NULL);
}

void
meta_wayland_outputs_init (MetaWaylandCompositor *compositor)
{
  MetaMonitorManager *monitors;

  monitors = meta_monitor_manager_get ();
  g_signal_connect (monitors, "monitors-changed-internal",
                    G_CALLBACK (on_monitors_changed), compositor);

  compositor->outputs = g_hash_table_new_full (NULL, NULL, NULL, wayland_output_destroy_notify);
  compositor->outputs = meta_wayland_compositor_update_outputs (compositor, monitors);

  wl_global_create (compositor->wayland_display,
                    &zxdg_output_manager_v1_interface,
                    META_ZXDG_OUTPUT_V1_VERSION,
                    NULL,
                    bind_xdg_output_manager);
}