summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkylechar <kylechar@chromium.org>2016-01-19 11:53:39 -0800
committerCommit bot <commit-bot@chromium.org>2016-01-19 19:55:03 +0000
commited7bad7bc8e12dab2a18e685bf959ee114b8bb93 (patch)
tree34cc386420a822e453001c53a6979a1254edcf00
parent445c24e6597d74c8253a9fe28e1c7907cd38c05d (diff)
downloadchromium_src-ed7bad7bc8e12dab2a18e685bf959ee114b8bb93.zip
chromium_src-ed7bad7bc8e12dab2a18e685bf959ee114b8bb93.tar.gz
chromium_src-ed7bad7bc8e12dab2a18e685bf959ee114b8bb93.tar.bz2
Add build rules for platform_ozone_x11.
This CL modifies the GN build rules in ui/ so that a X11 ozone platform can be added. It adds a GN argument platform_ozone_x11 and modifies other X11 related targets to be included if use_ozone && ozone_platform_x11 are true. BUG=361137 Review URL: https://codereview.chromium.org/1590103003 Cr-Commit-Position: refs/heads/master@{#370171}
-rw-r--r--ui/events/BUILD.gn17
-rw-r--r--ui/events/devices/BUILD.gn3
-rw-r--r--ui/events/events.gyp7
-rw-r--r--ui/events/x/BUILD.gn23
-rw-r--r--ui/events/x/events_x.cc2
-rw-r--r--ui/events/x/events_x.gyp38
-rw-r--r--ui/events/x/events_x_export.h29
-rw-r--r--ui/events/x/events_x_utils.cc4
-rw-r--r--ui/events/x/events_x_utils.h58
-rw-r--r--ui/gfx/x/BUILD.gn3
-rw-r--r--ui/ozone/ozone.gni1
11 files changed, 137 insertions, 48 deletions
diff --git a/ui/events/BUILD.gn b/ui/events/BUILD.gn
index 5c55728..d8148af 100644
--- a/ui/events/BUILD.gn
+++ b/ui/events/BUILD.gn
@@ -4,6 +4,7 @@
import("//build/config/ui.gni")
import("//testing/test.gni")
+import("//ui/ozone/ozone.gni")
if (is_android) {
import("//build/config/android/rules.gni")
@@ -69,7 +70,9 @@ component("events_base") {
"//ui/gfx/geometry",
]
- if (use_x11) {
+ # TODO(kylechar): move keycodes/ files into own component and x/ files into
+ # ui/events/x component
+ if (use_x11 || ozone_platform_x11) {
configs += [ "//build/config/linux:x11" ]
sources += [
@@ -82,7 +85,7 @@ component("events_base") {
deps += [ "//ui/gfx/x" ]
}
- if (use_x11 || use_xkbcommon) {
+ if (use_x11 || ozone_platform_x11 || use_xkbcommon) {
sources += [
"keycodes/keyboard_code_conversion_xkb.cc",
"keycodes/keyboard_code_conversion_xkb.h",
@@ -142,11 +145,7 @@ component("events") {
]
if (use_x11) {
- sources += [
- "x/events_x.cc",
- "x/events_x_utils.cc",
- "x/events_x_utils.h",
- ]
+ sources += [ "x/events_x.cc" ]
configs += [
"//build/config/linux:glib",
"//build/config/linux:x11",
@@ -157,6 +156,10 @@ component("events") {
]
}
+ if (use_x11 || ozone_platform_x11) {
+ deps += [ "//ui/events/x" ]
+ }
+
if (!is_chromeos && is_linux) {
sources += [
"linux/text_edit_command_auralinux.cc",
diff --git a/ui/events/devices/BUILD.gn b/ui/events/devices/BUILD.gn
index ac001ed..f3dbfd5 100644
--- a/ui/events/devices/BUILD.gn
+++ b/ui/events/devices/BUILD.gn
@@ -3,6 +3,7 @@
# found in the LICENSE file.
import("//build/config/ui.gni")
+import("//ui/ozone/ozone.gni")
component("devices") {
sources = [
@@ -31,7 +32,7 @@ component("devices") {
"//ui/gfx/geometry",
]
- if (use_x11) {
+ if (use_x11 || ozone_platform_x11) {
configs += [ "//build/config/linux:x11" ]
sources += [
diff --git a/ui/events/events.gyp b/ui/events/events.gyp
index dd83a60..6c23b30 100644
--- a/ui/events/events.gyp
+++ b/ui/events/events.gyp
@@ -153,15 +153,14 @@
'win/system_event_state_lookup.cc',
'win/system_event_state_lookup.h',
'x/events_x.cc',
- 'x/events_x_utils.cc',
- 'x/events_x_utils.h',
],
'conditions': [
['use_x11==1', {
'dependencies': [
- 'devices/events_devices.gyp:events_devices',
- '../gfx/x/gfx_x11.gyp:gfx_x11',
'../../build/linux/system.gyp:x11',
+ '../gfx/x/gfx_x11.gyp:gfx_x11',
+ 'devices/events_devices.gyp:events_devices',
+ 'x/events_x.gyp:events_x',
],
}],
['use_aura==0', {
diff --git a/ui/events/x/BUILD.gn b/ui/events/x/BUILD.gn
new file mode 100644
index 0000000..2329946
--- /dev/null
+++ b/ui/events/x/BUILD.gn
@@ -0,0 +1,23 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+component("x") {
+ sources = [
+ "events_x_export.h",
+ "events_x_utils.cc",
+ "events_x_utils.h",
+ ]
+ defines = [ "EVENTS_X_IMPLEMENTATION" ]
+ deps = [
+ "//base",
+ "//skia",
+ "//ui/events:events_base",
+ "//ui/events/devices",
+ "//ui/gfx/x",
+ ]
+ configs += [
+ "//build/config/linux:glib",
+ "//build/config/linux:x11",
+ ]
+}
diff --git a/ui/events/x/events_x.cc b/ui/events/x/events_x.cc
index c1fc65a..9432a60 100644
--- a/ui/events/x/events_x.cc
+++ b/ui/events/x/events_x.cc
@@ -127,7 +127,7 @@ int GetChangedMouseButtonFlagsFromNative(
PointerDetails GetMousePointerDetailsFromNative(
const base::NativeEvent& native_event) {
- return GetMousePointerDetailsFromXEvent(*native_event);
+ return PointerDetails(EventPointerType::POINTER_TYPE_MOUSE);
}
gfx::Vector2d GetMouseWheelOffset(const base::NativeEvent& native_event) {
diff --git a/ui/events/x/events_x.gyp b/ui/events/x/events_x.gyp
new file mode 100644
index 0000000..0432178
--- /dev/null
+++ b/ui/events/x/events_x.gyp
@@ -0,0 +1,38 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'variables': {
+ 'chromium_code': 1,
+ },
+ 'targets': [
+ {
+ # GN version: //ui/events/x
+ 'target_name': 'events_x',
+ 'type': '<(component)',
+ 'dependencies': [
+ '<(DEPTH)/base/base.gyp:base',
+ '<(DEPTH)/skia/skia.gyp:skia',
+ '../../events/devices/events_devices.gyp:events_devices',
+ '../../events/events.gyp:events_base',
+ '../../gfx/x/gfx_x11.gyp:gfx_x11',
+ ],
+ 'defines': [
+ 'EVENTS_X_IMPLEMENTATION',
+ ],
+ 'sources': [
+ 'events_x_export.h',
+ 'events_x_utils.cc',
+ 'events_x_utils.h',
+ ],
+ 'conditions': [
+ ['use_x11==1', {
+ 'dependencies': [
+ '<(DEPTH)/build/linux/system.gyp:x11',
+ ],
+ }],
+ ],
+ },
+ ],
+}
diff --git a/ui/events/x/events_x_export.h b/ui/events/x/events_x_export.h
new file mode 100644
index 0000000..2079087
--- /dev/null
+++ b/ui/events/x/events_x_export.h
@@ -0,0 +1,29 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_EVENTS_X_EVENTS_X_EXPORT_H_
+#define UI_EVENTS_X_EVENTS_X_EXPORT_H_
+
+#if defined(COMPONENT_BUILD)
+#if defined(WIN32)
+
+#if defined(EVENTS_X_IMPLEMENTATION)
+#define EVENTS_X_EXPORT __declspec(dllexport)
+#else
+#define EVENTS_X_EXPORT __declspec(dllimport)
+#endif // defined(EVENTS_X_IMPLEMENTATION)
+
+#else // defined(WIN32)
+#if defined(EVENTS_X_IMPLEMENTATION)
+#define EVENTS_X_EXPORT __attribute__((visibility("default")))
+#else
+#define EVENTS_X_EXPORT
+#endif
+#endif
+
+#else // defined(COMPONENT_BUILD)
+#define EVENTS_X_EXPORT
+#endif
+
+#endif // UI_EVENTS_X_EVENTS_X_EXPORT_H_
diff --git a/ui/events/x/events_x_utils.cc b/ui/events/x/events_x_utils.cc
index c79266e..fb762f5 100644
--- a/ui/events/x/events_x_utils.cc
+++ b/ui/events/x/events_x_utils.cc
@@ -598,10 +598,6 @@ int GetChangedMouseButtonFlagsFromXEvent(const XEvent& xev) {
return 0;
}
-PointerDetails GetMousePointerDetailsFromXEvent(const XEvent& xev) {
- return PointerDetails(EventPointerType::POINTER_TYPE_MOUSE);
-}
-
gfx::Vector2d GetMouseWheelOffsetFromXEvent(const XEvent& xev) {
float x_offset, y_offset;
if (GetScrollOffsetsFromXEvent(xev, &x_offset, &y_offset, NULL, NULL, NULL)) {
diff --git a/ui/events/x/events_x_utils.h b/ui/events/x/events_x_utils.h
index 671c3bb..ceccfc9 100644
--- a/ui/events/x/events_x_utils.h
+++ b/ui/events/x/events_x_utils.h
@@ -8,79 +8,77 @@
#include <stdint.h>
#include "base/time/time.h"
-#include "ui/events/event.h"
#include "ui/events/event_constants.h"
+#include "ui/events/x/events_x_export.h"
+#include "ui/gfx/geometry/point.h"
typedef union _XEvent XEvent;
namespace ui {
// Get the EventType from a XEvent.
-EventType EventTypeFromXEvent(const XEvent& xev);
+EVENTS_X_EXPORT EventType EventTypeFromXEvent(const XEvent& xev);
// Get the EventFlags from a XEvent.
-int EventFlagsFromXEvent(const XEvent& xev);
+EVENTS_X_EXPORT int EventFlagsFromXEvent(const XEvent& xev);
// Get the timestamp from a XEvent.
-base::TimeDelta EventTimeFromXEvent(const XEvent& xev);
+EVENTS_X_EXPORT base::TimeDelta EventTimeFromXEvent(const XEvent& xev);
// Get the location from a XEvent. The coordinate system of the resultant
// |Point| has the origin at top-left of the "root window". The nature of
// this "root window" and how it maps to platform-specific drawing surfaces is
// defined in ui/aura/root_window.* and ui/aura/window_tree_host*.
-gfx::Point EventLocationFromXEvent(const XEvent& xev);
+EVENTS_X_EXPORT gfx::Point EventLocationFromXEvent(const XEvent& xev);
// Gets the location in native system coordinate space.
-gfx::Point EventSystemLocationFromXEvent(const XEvent& xev);
+EVENTS_X_EXPORT gfx::Point EventSystemLocationFromXEvent(const XEvent& xev);
// Returns the 'real' button for an event. The button reported in slave events
// does not take into account any remapping (e.g. using xmodmap), while the
// button reported in master events do. This is a utility function to always
// return the mapped button.
-int EventButtonFromXEvent(const XEvent& xev);
+EVENTS_X_EXPORT int EventButtonFromXEvent(const XEvent& xev);
// Returns the flags of the button that changed during a press/release.
-int GetChangedMouseButtonFlagsFromXEvent(const XEvent& xev);
-
-// Returns the detailed pointer information for mouse events.
-PointerDetails GetMousePointerDetailsFromXEvent(const XEvent& xev);
+EVENTS_X_EXPORT int GetChangedMouseButtonFlagsFromXEvent(const XEvent& xev);
// Gets the mouse wheel offsets from a XEvent.
-gfx::Vector2d GetMouseWheelOffsetFromXEvent(const XEvent& xev);
+EVENTS_X_EXPORT gfx::Vector2d GetMouseWheelOffsetFromXEvent(const XEvent& xev);
// Clear the touch id from bookkeeping if it is a release/cancel event.
-void ClearTouchIdIfReleasedFromXEvent(const XEvent& xev);
+EVENTS_X_EXPORT void ClearTouchIdIfReleasedFromXEvent(const XEvent& xev);
// Gets the touch id from a XEvent.
-int GetTouchIdFromXEvent(const XEvent& xev);
+EVENTS_X_EXPORT int GetTouchIdFromXEvent(const XEvent& xev);
// Gets the radius along the X/Y axis from a XEvent. Default is 1.0.
-float GetTouchRadiusXFromXEvent(const XEvent& xev);
-float GetTouchRadiusYFromXEvent(const XEvent& xev);
+EVENTS_X_EXPORT float GetTouchRadiusXFromXEvent(const XEvent& xev);
+EVENTS_X_EXPORT float GetTouchRadiusYFromXEvent(const XEvent& xev);
// Gets the angle of the major axis away from the X axis. Default is 0.0.
-float GetTouchAngleFromXEvent(const XEvent& xev);
+EVENTS_X_EXPORT float GetTouchAngleFromXEvent(const XEvent& xev);
// Gets the force from a native_event. Normalized to be [0, 1]. Default is 0.0.
-float GetTouchForceFromXEvent(const XEvent& xev);
+EVENTS_X_EXPORT float GetTouchForceFromXEvent(const XEvent& xev);
// Returns whether this is a scroll event and optionally gets the amount to be
// scrolled. |x_offset|, |y_offset| and |finger_count| can be NULL.
-bool GetScrollOffsetsFromXEvent(const XEvent& xev,
- float* x_offset,
- float* y_offset,
- float* x_offset_ordinal,
- float* y_offset_ordinal,
- int* finger_count);
+EVENTS_X_EXPORT bool GetScrollOffsetsFromXEvent(const XEvent& xev,
+ float* x_offset,
+ float* y_offset,
+ float* x_offset_ordinal,
+ float* y_offset_ordinal,
+ int* finger_count);
// Gets the fling velocity from a XEvent. is_cancel is set to true if
// this was a tap down, intended to stop an ongoing fling.
-bool GetFlingDataFromXEvent(const XEvent& xev,
- float* vx,
- float* vy,
- float* vx_ordinal,
- float* vy_ordinal,
- bool* is_cancel);
+EVENTS_X_EXPORT bool GetFlingDataFromXEvent(const XEvent& xev,
+ float* vx,
+ float* vy,
+ float* vx_ordinal,
+ float* vy_ordinal,
+ bool* is_cancel);
} // namespace ui
diff --git a/ui/gfx/x/BUILD.gn b/ui/gfx/x/BUILD.gn
index 6ffba24..ad4d31a 100644
--- a/ui/gfx/x/BUILD.gn
+++ b/ui/gfx/x/BUILD.gn
@@ -3,8 +3,9 @@
# found in the LICENSE file.
import("//build/config/ui.gni")
+import("//ui/ozone/ozone.gni")
-assert(use_x11)
+assert(use_x11 || ozone_platform_x11)
# GYP version: //ui/gfx/x/gfx_x11.gyp:gfx_x11
component("x") {
diff --git a/ui/ozone/ozone.gni b/ui/ozone/ozone.gni
index 7f75f2d..8b67fab 100644
--- a/ui/ozone/ozone.gni
+++ b/ui/ozone/ozone.gni
@@ -28,6 +28,7 @@ declare_args() {
ozone_platform_gbm = false
ozone_platform_ozonex = false
ozone_platform_headless = false
+ ozone_platform_x11 = false
if (ozone_auto_platforms) {
# Use headless as the default platform.