wl_output.cc 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright 2018 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "components/exo/wayland/wl_output.h"
  5. #include <wayland-server-core.h>
  6. #include <wayland-server-protocol-core.h>
  7. #include "components/exo/wayland/server_util.h"
  8. #include "components/exo/wayland/wayland_display_observer.h"
  9. #include "components/exo/wayland/wayland_display_output.h"
  10. #include "components/exo/wm_helper.h"
  11. #include "ui/display/display.h"
  12. #include "ui/display/manager/display_manager.h"
  13. #include "ui/display/manager/managed_display_info.h"
  14. #include "ui/display/screen.h"
  15. namespace exo {
  16. namespace wayland {
  17. ////////////////////////////////////////////////////////////////////////////////
  18. // wl_output_interface:
  19. void output_release(wl_client* client, wl_resource* resource) {
  20. wl_resource_destroy(resource);
  21. }
  22. const struct wl_output_interface output_implementation = {output_release};
  23. void bind_output(wl_client* client,
  24. void* data,
  25. uint32_t version,
  26. uint32_t output_id) {
  27. WaylandDisplayOutput* output = static_cast<WaylandDisplayOutput*>(data);
  28. wl_resource* resource =
  29. wl_resource_create(client, &wl_output_interface,
  30. std::min(version, kWlOutputVersion), output_id);
  31. auto handler = std::make_unique<WaylandDisplayHandler>(output, resource);
  32. handler->Initialize();
  33. SetImplementation(resource, &output_implementation, std::move(handler));
  34. }
  35. } // namespace wayland
  36. } // namespace exo