chromium/ui/ozone/platform/x11/BUILD.gn

# Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/chromeos/ui_mode.gni")
import("//gpu/vulkan/features.gni")
import("//ui/base/ui_features.gni")

visibility = [ "//ui/ozone/*" ]

assert(is_linux || is_chromeos)

source_set("x11") {
  sources = [
    "client_native_pixmap_factory_x11.cc",
    "client_native_pixmap_factory_x11.h",
    "gl_egl_utility_x11.cc",
    "gl_egl_utility_x11.h",
    "gl_surface_egl_readback_x11.cc",
    "gl_surface_egl_readback_x11.h",
    "hit_test_x11.cc",
    "hit_test_x11.h",
    "native_pixmap_egl_x11_binding.cc",
    "native_pixmap_egl_x11_binding.h",
    "os_exchange_data_provider_x11.cc",
    "os_exchange_data_provider_x11.h",
    "ozone_platform_x11.cc",
    "ozone_platform_x11.h",
    "x11_canvas_surface.cc",
    "x11_canvas_surface.h",
    "x11_clipboard_ozone.cc",
    "x11_clipboard_ozone.h",
    "x11_global_shortcut_listener_ozone.cc",
    "x11_global_shortcut_listener_ozone.h",
    "x11_keyboard_hook.cc",
    "x11_keyboard_hook.h",
    "x11_menu_utils.cc",
    "x11_menu_utils.h",
    "x11_screen_ozone.cc",
    "x11_screen_ozone.h",
    "x11_surface_factory.cc",
    "x11_surface_factory.h",
    "x11_user_input_monitor.cc",
    "x11_user_input_monitor.h",
    "x11_utils.cc",
    "x11_utils.h",
    "x11_window.cc",
    "x11_window.h",
    "x11_window_manager.cc",
    "x11_window_manager.h",
  ]

  deps = [
    "//base",
    "//build:chromecast_buildflags",
    "//build:chromeos_buildflags",
    "//gpu/vulkan:buildflags",
    "//net",
    "//skia",
    "//third_party/angle:includes",
    "//ui/base:base",
    "//ui/base:buildflags",
    "//ui/base:data_exchange",
    "//ui/base:hit_test",
    "//ui/base:wm_role_names",
    "//ui/base/clipboard:clipboard_types",
    "//ui/base/cursor",
    "//ui/base/data_transfer_policy",
    "//ui/base/dragdrop:types",
    "//ui/base/dragdrop/mojom",
    "//ui/base/ime",
    "//ui/base/x",
    "//ui/base/x:gl",
    "//ui/display/types",
    "//ui/events",
    "//ui/events:dom_keycode_converter",
    "//ui/events/devices",
    "//ui/events/devices/x11",
    "//ui/events/ozone",
    "//ui/events/ozone/layout",
    "//ui/events/platform",
    "//ui/events/platform/x11",
    "//ui/events/x",
    "//ui/gfx",
    "//ui/gfx/geometry",
    "//ui/gfx/linux:gbm",
    "//ui/gfx/linux:gpu_memory_buffer_support_x11",
    "//ui/gfx/x",
    "//ui/gl",
    "//ui/ozone:ozone_base",
    "//ui/ozone/common",
    "//ui/platform_window",
    "//ui/platform_window/common",
    "//ui/platform_window/wm",
  ]

  if (is_linux) {
    sources += [
      "linux_ui_delegate_x11.cc",
      "linux_ui_delegate_x11.h",
    ]
    deps += [ "//ui/linux:linux_ui" ]
  }

  if (is_chromeos_ash) {
    deps += [ "//ui/base/ime/ash" ]
  } else {
    deps += [ "//ui/base/ime/linux" ]
  }

  if (enable_vulkan) {
    sources += [
      "vulkan_implementation_x11.cc",
      "vulkan_implementation_x11.h",
      "vulkan_surface_x11.cc",
      "vulkan_surface_x11.h",
    ]
    deps += [ "//gpu/vulkan" ]
  }

  if (use_xkbcommon) {
    configs += [ "//ui/events/ozone/layout:xkbcommon" ]
  }

  if (use_atk) {
    sources += [
      "atk_event_conversion.cc",
      "atk_event_conversion.h",
    ]
    configs += [ "//build/config/linux/atk" ]
    deps += [ "//ui/events/x" ]
  }
}

source_set("x11_unittests") {
  testonly = true
  sources = [
    "test/device_data_manager_x11_unittest.cc",
    "test/events_x_unittest.cc",
    "test/x11_event_translation_unittest.cc",
    "test/x11_window_unittest.cc",
    "x11_screen_ozone_unittest.cc",
    "x11_window_ozone_unittest.cc",
  ]

  deps = [
    ":x11",
    "//base",
    "//base/test:test_support",
    "//build:chromeos_buildflags",
    "//skia",
    "//testing/gmock",
    "//testing/gtest",
    "//ui/base",
    "//ui/base:features",
    "//ui/base/dragdrop:types",
    "//ui/base/x",
    "//ui/base/x:test_support",
    "//ui/base/x:unittests",
    "//ui/display:test_support",
    "//ui/events:test_support",
    "//ui/events/devices/x11",
    "//ui/events/platform/x11",
    "//ui/events/x",
    "//ui/gfx:test_support",
    "//ui/gfx/x",
    "//ui/gfx/x:unit_test",
    "//ui/ozone:platform",
    "//ui/ozone:test_support",
    "//ui/ozone/common",
  ]

  if (!is_chromeos) {
    sources += [ "test/os_exchange_data_provider_x11_unittest.cc" ]
    deps += [ "//ui/base/clipboard:clipboard_types" ]

    # ChromeOS uses a non-backed exchange data provider while the tests actually
    # expect to use a normal X11 provider. Running these tests with a non-backed
    # provided results in crashes when ownership selection call is made.
    # Moreover, X11 on ChromeOS is used only for dev purposes and it doesn't
    # support DnD between X11 windows. Instead, all the dnd operations are
    # performed within a single native windows, where ash spawns number of own
    # internal windows.
    sources += [ "test/x11_drag_drop_client_unittest.cc" ]
  }
}

source_set("test_support") {
  testonly = true

  sources = [
    "x11_ozone_ui_controls_test_helper.cc",
    "x11_ozone_ui_controls_test_helper.h",
  ]

  deps = [
    "//ui/aura:aura",
    "//ui/base/x",
    "//ui/base/x:test_support",
  ]
}