chromium/ui/base/x/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/linux/gtk/gtk.gni")
import("//build/config/ozone.gni")
import("//build/config/ui.gni")
import("//testing/libfuzzer/fuzzer_test.gni")

assert(ozone_platform_x11)

component("x") {
  output_name = "ui_base_x"

  sources = [
    "selection_requestor.cc",
    "selection_requestor.h",
    "selection_utils.cc",
    "selection_utils.h",
    "x11_clipboard_helper.cc",
    "x11_clipboard_helper.h",
    "x11_cursor.cc",
    "x11_cursor.h",
    "x11_cursor_factory.cc",
    "x11_cursor_factory.h",
    "x11_cursor_loader.cc",
    "x11_cursor_loader.h",
    "x11_desktop_window_move_client.cc",
    "x11_desktop_window_move_client.h",
    "x11_display_manager.cc",
    "x11_display_manager.h",
    "x11_display_util.cc",
    "x11_display_util.h",
    "x11_global_shortcut_listener.cc",
    "x11_global_shortcut_listener.h",
    "x11_idle_query.cc",
    "x11_idle_query.h",
    "x11_move_loop.h",
    "x11_move_loop_delegate.h",
    "x11_pointer_grab.cc",
    "x11_pointer_grab.h",
    "x11_screensaver.cc",
    "x11_screensaver.h",
    "x11_shm_image_pool.cc",
    "x11_shm_image_pool.h",
    "x11_software_bitmap_presenter.cc",
    "x11_software_bitmap_presenter.h",
    "x11_user_input_monitor.cc",
    "x11_user_input_monitor.h",
    "x11_util.cc",
    "x11_util.h",
    "x11_whole_screen_move_loop.cc",
    "x11_whole_screen_move_loop.h",
    "x11_workspace_handler.cc",
    "x11_workspace_handler.h",
    "x11_xrandr_interval_only_vsync_provider.cc",
    "x11_xrandr_interval_only_vsync_provider.h",
  ]

  configs += [ "//build/config/compiler:wexit_time_destructors" ]

  defines = [ "IS_UI_BASE_X_IMPL" ]

  public_deps = [
    "//ui/base/cursor",
    "//ui/base/cursor/mojom:cursor_type_shared",
  ]
  deps = [
    "//base",
    "//base:i18n",
    "//build:chromeos_buildflags",
    "//components/device_event_log",
    "//net",
    "//skia",
    "//ui/base:data_exchange",
    "//ui/base:features",
    "//ui/base/clipboard:clipboard_types",
    "//ui/base/clipboard:file_info",
    "//ui/display/util",
    "//ui/display/util:gpu_info_util",
    "//ui/events",
    "//ui/events:dom_keycode_converter",
    "//ui/events/devices/x11",
    "//ui/events/keycodes:x11",
    "//ui/events/platform/x11",
    "//ui/events/x:x",
    "//ui/gfx",
    "//ui/gfx:gfx_switches",
    "//ui/gfx/geometry",
    "//ui/gfx/x",
    "//ui/platform_window/common",
    "//ui/strings:ui_strings_grit",
  ]

  if (is_linux) {
    public_deps += [ "//ui/linux:linux_ui" ]
  }
  if (is_linux || is_chromeos) {
    sources += [
      "selection_owner.cc",
      "selection_owner.h",
      "x11_drag_context.cc",
      "x11_drag_context.h",
      "x11_drag_drop_client.cc",
      "x11_drag_drop_client.h",
      "x11_os_exchange_data_provider.cc",
      "x11_os_exchange_data_provider.h",
    ]
    public_deps += [ "//ui/base/dragdrop/mojom:mojom_shared" ]
    deps += [
      "//ui/base",
      "//ui/base/dragdrop:types",
      "//ui/base/dragdrop/mojom",
    ]
  }
}

source_set("gl") {
  sources = [
    "x11_gl_egl_utility.cc",
    "x11_gl_egl_utility.h",
  ]

  configs += [ "//build/config/compiler:wexit_time_destructors" ]
  deps = [
    ":x",
    "//base",
    "//third_party/angle:includes",
    "//ui/gfx/x",
    "//ui/gl",
  ]
}

source_set("test_support") {
  testonly = true

  sources = [
    "test/x11_property_change_waiter.cc",
    "test/x11_property_change_waiter.h",
    "test/x11_ui_controls_test_helper.cc",
    "test/x11_ui_controls_test_helper.h",
  ]

  deps = [
    ":x",
    "//ui/base:test_support",
    "//ui/events:platform_event",
    "//ui/events:test_support",
    "//ui/events/platform/x11",
    "//ui/gfx/x",
  ]
}

source_set("unittests") {
  testonly = true
  sources = [
    "selection_requestor_unittest.cc",
    "x11_cursor_factory_unittest.cc",
    "x11_cursor_loader_unittest.cc",
    "x11_display_util_unittest.cc",
  ]
  deps = [
    ":x",
    "//base",
    "//base/test:test_support",
    "//skia",
    "//testing/gtest",
    "//ui/base/cursor",
    "//ui/base/cursor/mojom:cursor_type_shared",
    "//ui/gfx/geometry",
    "//ui/gfx/x",
  ]
}

fuzzer_test("ui_x11_cursor_loader_fuzzer") {
  sources = [ "x11_cursor_loader_fuzzer.cc" ]
  deps = [
    ":x",
    "//base",
  ]
}