Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/base/event_types.h b/base/event_types.h
- index 9905800d2e8c..1325effe1999 100644
- --- a/base/event_types.h
- +++ b/base/event_types.h
- @@ -22,7 +22,9 @@ class NSEvent;
- namespace base {
- // Cross platform typedefs for native event types.
- -#if defined(OS_WIN)
- +#if defined(USE_OZONE)
- +typedef void* NativeEvent;
- +#elif defined(OS_WIN)
- typedef MSG NativeEvent;
- #elif defined(USE_X11)
- typedef XEvent* NativeEvent;
- diff --git a/base/file_descriptor_posix.h b/base/file_descriptor_posix.h
- index 2a366116a31d..f00e5e283601 100644
- --- a/base/file_descriptor_posix.h
- +++ b/base/file_descriptor_posix.h
- @@ -31,8 +31,9 @@ struct FileDescriptor {
- FileDescriptor(int ifd, bool iauto_close) : fd(ifd), auto_close(iauto_close) {
- }
- - FileDescriptor(File file) : fd(file.TakePlatformFile()), auto_close(true) {}
- - explicit FileDescriptor(ScopedFD fd) : fd(fd.release()), auto_close(true) {}
- + // FileDescriptor(File file) : fd(file.TakePlatformFile()), auto_close(true)
- + // {} explicit FileDescriptor(ScopedFD fd) : fd(fd.release()),
- + // auto_close(true) {}
- bool operator==(const FileDescriptor& other) const {
- return (fd == other.fd && auto_close == other.auto_close);
- diff --git a/base/message_loop/message_loop.cc b/base/message_loop/message_loop.cc
- index 252cd04c63ea..b9dd177bd0fe 100644
- --- a/base/message_loop/message_loop.cc
- +++ b/base/message_loop/message_loop.cc
- @@ -533,7 +533,7 @@ void MessageLoopForUI::Attach() {
- }
- #endif
- -#if (defined(USE_OZONE) && !defined(OS_FUCHSIA)) || \
- +#if (!defined(OS_WIN) && defined(USE_OZONE) && !defined(OS_FUCHSIA)) || \
- (defined(USE_X11) && !defined(USE_GLIB))
- bool MessageLoopForUI::WatchFileDescriptor(
- int fd,
- diff --git a/base/message_loop/message_loop.h b/base/message_loop/message_loop.h
- index 2f4f24fdca5c..0c5f48ed218f 100644
- --- a/base/message_loop/message_loop.h
- +++ b/base/message_loop/message_loop.h
- @@ -458,7 +458,7 @@ class BASE_EXPORT MessageLoopForUI : public MessageLoop {
- void Abort();
- #endif
- -#if (defined(USE_OZONE) && !defined(OS_FUCHSIA)) || \
- +#if (!defined(OS_WIN) && defined(USE_OZONE) && !defined(OS_FUCHSIA)) || \
- (defined(USE_X11) && !defined(USE_GLIB))
- // Please see MessagePumpLibevent for definition.
- bool WatchFileDescriptor(
- diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h
- index 2df1c23c98da..d31170442078 100644
- --- a/ipc/ipc_message_utils.h
- +++ b/ipc/ipc_message_utils.h
- @@ -98,22 +98,23 @@ struct CheckedTuple {
- // 3. Any template referencing types above (e.g. std::vector<size_t>)
- template <class P>
- static inline void WriteParam(base::Pickle* m, const P& p) {
- - typedef typename SimilarTypeTraits<P>::Type Type;
- - ParamTraits<Type>::Write(m, static_cast<const Type& >(p));
- + // typedef typename SimilarTypeTraits<P>::Type Type;
- + // ParamTraits<Type>::Write(m, static_cast<const Type& >(p));
- }
- template <class P>
- static inline bool WARN_UNUSED_RESULT ReadParam(const base::Pickle* m,
- base::PickleIterator* iter,
- P* p) {
- - typedef typename SimilarTypeTraits<P>::Type Type;
- - return ParamTraits<Type>::Read(m, iter, reinterpret_cast<Type* >(p));
- + // typedef typename SimilarTypeTraits<P>::Type Type;
- + // return ParamTraits<Type>::Read(m, iter, reinterpret_cast<Type* >(p));
- + return false;
- }
- template <class P>
- static inline void LogParam(const P& p, std::string* l) {
- - typedef typename SimilarTypeTraits<P>::Type Type;
- - ParamTraits<Type>::Log(static_cast<const Type& >(p), l);
- + // typedef typename SimilarTypeTraits<P>::Type Type;
- + // ParamTraits<Type>::Log(static_cast<const Type& >(p), l);
- }
- // Primitive ParamTraits -------------------------------------------------------
- diff --git a/ipc/ipc_param_traits.h b/ipc/ipc_param_traits.h
- index 9aaeb5e506bb..a3aca6fe8678 100644
- --- a/ipc/ipc_param_traits.h
- +++ b/ipc/ipc_param_traits.h
- @@ -19,9 +19,9 @@ struct AlwaysFalse {
- } // namespace internal
- template <class P> struct ParamTraits {
- - static_assert(internal::AlwaysFalse<P>::value,
- - "Cannot find the IPC::ParamTraits specialization. Did you "
- - "forget to include the corresponding header file?");
- + // static_assert(internal::AlwaysFalse<P>::value,
- + // "Cannot find the IPC::ParamTraits specialization. Did you "
- + // "forget to include the corresponding header file?");
- };
- template <class P>
- diff --git a/ui/base/BUILD.gn b/ui/base/BUILD.gn
- index 9a5f703b7cf8..65bb840cca1f 100644
- --- a/ui/base/BUILD.gn
- +++ b/ui/base/BUILD.gn
- @@ -586,13 +586,13 @@ component("base") {
- if (use_ozone) {
- sources += [
- - "cursor/cursor_loader_ozone.cc",
- - "cursor/cursor_loader_ozone.h",
- - "cursor/cursor_ozone.cc",
- - "cursor/ozone/bitmap_cursor_factory_ozone.cc",
- - "cursor/ozone/bitmap_cursor_factory_ozone.h",
- - "cursor/ozone/cursor_data_factory_ozone.cc",
- - "cursor/ozone/cursor_data_factory_ozone.h",
- + #"cursor/cursor_loader_ozone.cc",
- + #"cursor/cursor_loader_ozone.h",
- + #"cursor/cursor_ozone.cc",
- + #"cursor/ozone/bitmap_cursor_factory_ozone.cc",
- + #"cursor/ozone/bitmap_cursor_factory_ozone.h",
- + #"cursor/ozone/cursor_data_factory_ozone.cc",
- + #"cursor/ozone/cursor_data_factory_ozone.h",
- ]
- deps += [
- @@ -601,7 +601,7 @@ component("base") {
- ]
- if (!is_fuchsia) {
- - deps += [ "//ui/events/ozone:events_ozone_evdev" ]
- + #deps += [ "//ui/events/ozone:events_ozone_evdev" ]
- }
- }
- diff --git a/ui/base/cursor/cursor.h b/ui/base/cursor/cursor.h
- index 716e7cf72b66..45182e928779 100644
- --- a/ui/base/cursor/cursor.h
- +++ b/ui/base/cursor/cursor.h
- @@ -17,7 +17,9 @@ typedef HICON HCURSOR;
- namespace ui {
- -#if defined(OS_WIN)
- +#if defined(USE_OZONE)
- +typedef void* PlatformCursor;
- +#elif defined(OS_WIN)
- typedef ::HCURSOR PlatformCursor;
- #elif defined(USE_X11)
- typedef unsigned long PlatformCursor;
- diff --git a/ui/base/cursor/cursors_aura.cc b/ui/base/cursor/cursors_aura.cc
- index fbefd76087e9..da8d85c5ebb2 100644
- --- a/ui/base/cursor/cursors_aura.cc
- +++ b/ui/base/cursor/cursors_aura.cc
- @@ -290,14 +290,14 @@ bool GetCursorBitmap(const Cursor& cursor,
- SkBitmap* bitmap,
- gfx::Point* point) {
- DCHECK(bitmap && point);
- -#if defined(OS_WIN)
- - Cursor cursor_copy = cursor;
- - ui::CursorLoaderWin cursor_loader;
- - cursor_loader.SetPlatformCursor(&cursor_copy);
- - const std::unique_ptr<SkBitmap> cursor_bitmap(
- - IconUtil::CreateSkBitmapFromHICON(cursor_copy.platform()));
- - *point = IconUtil::GetHotSpotFromHICON(cursor_copy.platform());
- -#else
- + // #if defined(OS_WIN)
- + // Cursor cursor_copy = cursor;
- + // ui::CursorLoaderWin cursor_loader;
- + // cursor_loader.SetPlatformCursor(&cursor_copy);
- + // const std::unique_ptr<SkBitmap> cursor_bitmap(
- + // IconUtil::CreateSkBitmapFromHICON(cursor_copy.platform()));
- + // *point = IconUtil::GetHotSpotFromHICON(cursor_copy.platform());
- + // #else
- int resource_id;
- if (!GetCursorDataFor(ui::CursorSize::kNormal, cursor.native_type(),
- cursor.device_scale_factor(), &resource_id, point)) {
- @@ -306,7 +306,7 @@ bool GetCursorBitmap(const Cursor& cursor,
- const SkBitmap* cursor_bitmap = ResourceBundle::GetSharedInstance().
- GetImageSkiaNamed(resource_id)->bitmap();
- -#endif
- + // #endif
- if (!cursor_bitmap)
- return false;
- *bitmap = *cursor_bitmap;
- diff --git a/ui/base/ime/input_method_win.cc b/ui/base/ime/input_method_win.cc
- index fc430495abfb..948ac4c977bc 100644
- --- a/ui/base/ime/input_method_win.cc
- +++ b/ui/base/ime/input_method_win.cc
- @@ -25,11 +25,11 @@
- namespace ui {
- namespace {
- -ui::EventDispatchDetails DispatcherDestroyedDetails() {
- - ui::EventDispatchDetails dispatcher_details;
- - dispatcher_details.dispatcher_destroyed = true;
- - return dispatcher_details;
- -}
- +// ui::EventDispatchDetails DispatcherDestroyedDetails() {
- +// ui::EventDispatchDetails dispatcher_details;
- +// dispatcher_details.dispatcher_destroyed = true;
- +// return dispatcher_details;
- +// }
- } // namespace
- @@ -57,40 +57,40 @@ bool InputMethodWin::OnUntranslatedIMEMessage(
- LRESULT original_result = 0;
- BOOL handled = FALSE;
- - switch (event.message) {
- - case WM_IME_SETCONTEXT:
- - original_result = OnImeSetContext(
- - event.hwnd, event.message, event.wParam, event.lParam, &handled);
- - break;
- - case WM_IME_STARTCOMPOSITION:
- - original_result = OnImeStartComposition(
- - event.hwnd, event.message, event.wParam, event.lParam, &handled);
- - break;
- - case WM_IME_COMPOSITION:
- - original_result = OnImeComposition(
- - event.hwnd, event.message, event.wParam, event.lParam, &handled);
- - break;
- - case WM_IME_ENDCOMPOSITION:
- - original_result = OnImeEndComposition(
- - event.hwnd, event.message, event.wParam, event.lParam, &handled);
- - break;
- - case WM_IME_REQUEST:
- - original_result = OnImeRequest(
- - event.message, event.wParam, event.lParam, &handled);
- - break;
- - case WM_CHAR:
- - case WM_SYSCHAR:
- - original_result = OnChar(event.hwnd, event.message, event.wParam,
- - event.lParam, event, &handled);
- - break;
- - case WM_IME_NOTIFY:
- - original_result = OnImeNotify(
- - event.message, event.wParam, event.lParam, &handled);
- - break;
- - default:
- - NOTREACHED() << "Unknown IME message:" << event.message;
- - break;
- - }
- + // switch (event.message) {
- + // case WM_IME_SETCONTEXT:
- + // original_result = OnImeSetContext(
- + // event.hwnd, event.message, event.wParam, event.lParam, &handled);
- + // break;
- + // case WM_IME_STARTCOMPOSITION:
- + // original_result = OnImeStartComposition(
- + // event.hwnd, event.message, event.wParam, event.lParam, &handled);
- + // break;
- + // case WM_IME_COMPOSITION:
- + // original_result = OnImeComposition(
- + // event.hwnd, event.message, event.wParam, event.lParam, &handled);
- + // break;
- + // case WM_IME_ENDCOMPOSITION:
- + // original_result = OnImeEndComposition(
- + // event.hwnd, event.message, event.wParam, event.lParam, &handled);
- + // break;
- + // case WM_IME_REQUEST:
- + // original_result = OnImeRequest(
- + // event.message, event.wParam, event.lParam, &handled);
- + // break;
- + // case WM_CHAR:
- + // case WM_SYSCHAR:
- + // original_result = OnChar(event.hwnd, event.message, event.wParam,
- + // event.lParam, event, &handled);
- + // break;
- + // case WM_IME_NOTIFY:
- + // original_result = OnImeNotify(
- + // event.message, event.wParam, event.lParam, &handled);
- + // break;
- + // default:
- + // NOTREACHED() << "Unknown IME message:" << event.message;
- + // break;
- + // }
- if (result)
- *result = original_result;
- return !!handled;
- @@ -101,18 +101,18 @@ ui::EventDispatchDetails InputMethodWin::DispatchKeyEvent(ui::KeyEvent* event) {
- return DispatchFabricatedKeyEvent(event);
- const base::NativeEvent& native_key_event = event->native_event();
- - BOOL handled = FALSE;
- - if (native_key_event.message == WM_CHAR) {
- - auto ref = weak_ptr_factory_.GetWeakPtr();
- - OnChar(native_key_event.hwnd, native_key_event.message,
- - native_key_event.wParam, native_key_event.lParam, native_key_event,
- - &handled);
- - if (!ref)
- - return DispatcherDestroyedDetails();
- - if (handled)
- - event->StopPropagation();
- - return ui::EventDispatchDetails();
- - }
- + // BOOL handled = FALSE;
- + // if (native_key_event.message == WM_CHAR) {
- + // auto ref = weak_ptr_factory_.GetWeakPtr();
- + // OnChar(native_key_event.hwnd, native_key_event.message,
- + // native_key_event.wParam, native_key_event.lParam,
- + // native_key_event, &handled);
- + // if (!ref)
- + // return DispatcherDestroyedDetails();
- + // if (handled)
- + // event->StopPropagation();
- + // return ui::EventDispatchDetails();
- + // }
- std::vector<MSG> char_msgs;
- // Combines the WM_KEY* and WM_CHAR messages in the event processing flow
- @@ -125,17 +125,17 @@ ui::EventDispatchDetails InputMethodWin::DispatchKeyEvent(ui::KeyEvent* event) {
- // the WM_KEY*.
- // Chrome never handles dead chars so it is safe to remove/ignore
- // WM_*DEADCHAR messages.
- - MSG msg;
- - while (::PeekMessage(&msg, native_key_event.hwnd, WM_CHAR, WM_DEADCHAR,
- - PM_REMOVE)) {
- - if (msg.message == WM_CHAR)
- - char_msgs.push_back(msg);
- - }
- - while (::PeekMessage(&msg, native_key_event.hwnd, WM_SYSCHAR,
- - WM_SYSDEADCHAR, PM_REMOVE)) {
- - if (msg.message == WM_SYSCHAR)
- - char_msgs.push_back(msg);
- - }
- + // MSG msg;
- + // while (::PeekMessage(&msg, native_key_event.hwnd, WM_CHAR, WM_DEADCHAR,
- + // PM_REMOVE)) {
- + // if (msg.message == WM_CHAR)
- + // char_msgs.push_back(msg);
- + // }
- + // while (::PeekMessage(&msg, native_key_event.hwnd, WM_SYSCHAR,
- + // WM_SYSDEADCHAR, PM_REMOVE)) {
- + // if (msg.message == WM_SYSCHAR)
- + // char_msgs.push_back(msg);
- + // }
- // Handles ctrl-shift key to change text direction and layout alignment.
- if (ui::IMM32Manager::IsRTLKeyboardLayoutInstalled() &&
- @@ -202,13 +202,13 @@ ui::EventDispatchDetails InputMethodWin::ProcessUnhandledKeyEvent(
- return details;
- }
- - BOOL handled;
- - for (const auto& msg : (*char_msgs)) {
- - auto ref = weak_ptr_factory_.GetWeakPtr();
- - OnChar(msg.hwnd, msg.message, msg.wParam, msg.lParam, msg, &handled);
- - if (!ref)
- - return DispatcherDestroyedDetails();
- - }
- + // BOOL handled;
- + // for (const auto& msg : (*char_msgs)) {
- + // auto ref = weak_ptr_factory_.GetWeakPtr();
- + // OnChar(msg.hwnd, msg.message, msg.wParam, msg.lParam, msg, &handled);
- + // if (!ref)
- + // return DispatcherDestroyedDetails();
- + // }
- return details;
- }
- diff --git a/ui/base/ime/input_method_win_tsf.cc b/ui/base/ime/input_method_win_tsf.cc
- index 427ac8920bb3..ffb2aa85b8d6 100644
- --- a/ui/base/ime/input_method_win_tsf.cc
- +++ b/ui/base/ime/input_method_win_tsf.cc
- @@ -59,25 +59,29 @@ bool InputMethodWinTSF::OnUntranslatedIMEMessage(
- LRESULT original_result = 0;
- BOOL handled = FALSE;
- // Even when TSF is enabled, following IMM32/Win32 messages must be handled.
- - switch (event.message) {
- - case WM_IME_REQUEST:
- - // Some TSF-native TIPs (Text Input Processors) such as ATOK and Mozc
- - // still rely on WM_IME_REQUEST message to implement reverse conversion.
- - original_result =
- - OnImeRequest(event.message, event.wParam, event.lParam, &handled);
- - break;
- - case WM_CHAR:
- - case WM_SYSCHAR:
- - // ui::InputMethod interface is responsible for handling Win32 character
- - // messages. For instance, we will be here in the following cases.
- - // - TIP is not activated. (e.g, the current language profile is English)
- - // - TIP does not handle and WM_KEYDOWN and WM_KEYDOWN is translated into
- - // WM_CHAR by TranslateMessage API. (e.g, TIP is turned off)
- - // - Another application sends WM_CHAR through SendMessage API.
- - original_result = OnChar(event.hwnd, event.message, event.wParam,
- - event.lParam, event, &handled);
- - break;
- - }
- + // switch (event.message) {
- + // case WM_IME_REQUEST:
- + // // Some TSF-native TIPs (Text Input Processors) such as ATOK and Mozc
- + // // still rely on WM_IME_REQUEST message to implement reverse
- + // conversion. original_result =
- + // OnImeRequest(event.message, event.wParam, event.lParam, &handled);
- + // break;
- + // case WM_CHAR:
- + // case WM_SYSCHAR:
- + // // ui::InputMethod interface is responsible for handling Win32
- + // character
- + // // messages. For instance, we will be here in the following cases.
- + // // - TIP is not activated. (e.g, the current language profile is
- + // English)
- + // // - TIP does not handle and WM_KEYDOWN and WM_KEYDOWN is translated
- + // into
- + // // WM_CHAR by TranslateMessage API. (e.g, TIP is turned off)
- + // // - Another application sends WM_CHAR through SendMessage API.
- + // original_result = OnChar(event.hwnd, event.message, event.wParam,
- + // event.lParam, event, &handled);
- + // break;
- + // }
- +
- if (result)
- *result = original_result;
- return !!handled;
- diff --git a/ui/events/BUILD.gn b/ui/events/BUILD.gn
- index 31b5ea9f74e0..5872ed95daa1 100644
- --- a/ui/events/BUILD.gn
- +++ b/ui/events/BUILD.gn
- @@ -148,8 +148,9 @@ component("events") {
- "scoped_target_handler.h",
- "system_input_injector.cc",
- "system_input_injector.h",
- - "win/events_win.cc",
- - "win/keyboard_hook_win.cc",
- +
- + #"win/events_win.cc",
- + #"win/keyboard_hook_win.cc",
- "win/system_event_state_lookup.cc",
- "win/system_event_state_lookup.h",
- "x/keyboard_hook_posix.cc",
- @@ -485,7 +486,8 @@ if (!is_ios) {
- deps += [
- "//ui/events/ozone:events_ozone",
- - "//ui/events/ozone:events_ozone_evdev",
- +
- + #"//ui/events/ozone:events_ozone_evdev",
- "//ui/events/ozone:events_ozone_layout",
- ]
- }
- diff --git a/ui/events/event.cc b/ui/events/event.cc
- index 68daf98868ed..6a70c334ce6d 100644
- --- a/ui/events/event.cc
- +++ b/ui/events/event.cc
- @@ -1135,7 +1135,7 @@ bool KeyEvent::IsRepeated(const KeyEvent& event) {
- if (event.HasNativeEvent()) {
- // Bit 30 of lParam represents the "previous key state". If set, the key
- // was already down, therefore this is an auto-repeat.
- - is_repeat = (event.native_event().lParam & 0x40000000) != 0;
- + // is_repeat = (event.native_event().lParam & 0x40000000) != 0;
- } else
- #endif
- {
- @@ -1181,8 +1181,8 @@ KeyEvent::KeyEvent(const base::NativeEvent& native_event, int event_flags)
- #if defined(OS_WIN)
- // Only Windows has native character events.
- if (is_char_) {
- - key_ = DomKey::FromCharacter(native_event.wParam);
- - set_flags(PlatformKeyMap::ReplaceControlAndAltWithAltGraph(flags()));
- + // key_ = DomKey::FromCharacter(native_event.wParam);
- + // set_flags(PlatformKeyMap::ReplaceControlAndAltWithAltGraph(flags()));
- } else {
- int adjusted_flags = flags();
- key_ = PlatformKeyMap::DomKeyFromKeyboardCode(key_code(), &adjusted_flags);
- diff --git a/ui/events/ozone/device/device_manager_manual.cc b/ui/events/ozone/device/device_manager_manual.cc
- index 8010870abd4a..0504b5ea1218 100644
- --- a/ui/events/ozone/device/device_manager_manual.cc
- +++ b/ui/events/ozone/device/device_manager_manual.cc
- @@ -17,11 +17,11 @@ namespace ui {
- namespace {
- -const char kDevInput[] = "/dev/input";
- +const base::FilePath::CharType kDevInput[] = FILE_PATH_LITERAL("/dev/input");
- void ScanDevicesOnWorkerThread(std::vector<base::FilePath>* result) {
- - base::FileEnumerator file_enum(base::FilePath(FILE_PATH_LITERAL(kDevInput)),
- - false, base::FileEnumerator::FILES,
- + base::FileEnumerator file_enum(base::FilePath(kDevInput), false,
- + base::FileEnumerator::FILES,
- FILE_PATH_LITERAL("event*[0-9]"));
- for (base::FilePath path = file_enum.Next(); !path.empty();
- path = file_enum.Next()) {
- @@ -58,7 +58,7 @@ void DeviceManagerManual::RemoveObserver(DeviceEventObserver* observer) {
- }
- void DeviceManagerManual::StartWatching() {
- - if (!watcher_.Watch(base::FilePath(FILE_PATH_LITERAL(kDevInput)), false,
- + if (!watcher_.Watch(base::FilePath(kDevInput), false,
- base::Bind(&DeviceManagerManual::OnWatcherEvent,
- weak_ptr_factory_.GetWeakPtr()))) {
- LOG(ERROR) << "Failed to start FilePathWatcher";
- diff --git a/ui/events/test/event_generator.cc b/ui/events/test/event_generator.cc
- index 5f97117f198e..56e985629399 100644
- --- a/ui/events/test/event_generator.cc
- +++ b/ui/events/test/event_generator.cc
- @@ -646,7 +646,7 @@ void EventGenerator::Init(gfx::NativeWindow root_window,
- void EventGenerator::DispatchKeyEvent(bool is_press,
- ui::KeyboardCode key_code,
- int flags) {
- -#if defined(OS_WIN)
- +#if defined(OS_WIN) && false
- UINT key_press = WM_KEYDOWN;
- uint16_t character = ui::DomCodeToUsLayoutCharacter(
- ui::UsLayoutKeyboardCodeToDomCode(key_code), flags);
- diff --git a/ui/gl/BUILD.gn b/ui/gl/BUILD.gn
- index b1bd611c72a6..8a031e0ad719 100644
- --- a/ui/gl/BUILD.gn
- +++ b/ui/gl/BUILD.gn
- @@ -198,7 +198,7 @@ component("gl") {
- "gl_surface_egl.h",
- ]
- - if (is_linux) {
- + if (is_linux || use_ozone) {
- sources += [
- "gl_image_native_pixmap.cc",
- "gl_image_native_pixmap.h",
- @@ -224,7 +224,7 @@ component("gl") {
- ]
- }
- }
- - if (is_android || is_linux || is_fuchsia) {
- + if (is_android || is_linux || is_fuchsia || is_win) {
- sources += [
- "gl_implementation_osmesa.cc",
- "gl_implementation_osmesa.h",
- diff --git a/ui/gl/gl_image_native_pixmap.cc b/ui/gl/gl_image_native_pixmap.cc
- index f86defd7c8df..9ee4dca0f399 100644
- --- a/ui/gl/gl_image_native_pixmap.cc
- +++ b/ui/gl/gl_image_native_pixmap.cc
- @@ -6,6 +6,7 @@
- #include <vector>
- +#include "build/build_config.h"
- #include "ui/gfx/buffer_format_util.h"
- #include "ui/gl/egl_util.h"
- #include "ui/gl/gl_context.h"
- @@ -300,7 +301,7 @@ gfx::NativePixmapHandle GLImageNativePixmap::ExportHandle() {
- }
- gfx::NativePixmapHandle handle;
- -
- +#if defined(OS_LINUX)
- for (int i = 0; i < num_planes; ++i) {
- // Sanity check. In principle all the fds are meant to be valid when
- // eglExportDMABUFImageMESA succeeds.
- @@ -320,7 +321,7 @@ gfx::NativePixmapHandle GLImageNativePixmap::ExportHandle() {
- handle.planes.emplace_back(strides[i], offsets[i], 0 /* size opaque */,
- modifiers);
- }
- -
- +#endif
- return handle;
- }
- diff --git a/ui/gl/gl_implementation_osmesa.cc b/ui/gl/gl_implementation_osmesa.cc
- index 14fa64897a22..8b6c6c39adfb 100644
- --- a/ui/gl/gl_implementation_osmesa.cc
- +++ b/ui/gl/gl_implementation_osmesa.cc
- @@ -33,7 +33,13 @@ bool InitializeStaticGLBindingsOSMesaGL() {
- }
- #endif // !defined(OS_FUCHSIA)
- - base::FilePath library_path = module_path.Append("libosmesa.so");
- +#if defined(OS_WIN)
- + base::FilePath library_path =
- + module_path.Append(FILE_PATH_LITERAL("osmesa.dll"));
- +#else
- + base::FilePath library_path =
- + module_path.Append(FILE_PATH_LITERAL("libosmesa.so"));
- +#endif
- base::NativeLibrary library = LoadLibraryAndPrintError(library_path);
- if (!library)
- return false;
- diff --git a/ui/gl/init/BUILD.gn b/ui/gl/init/BUILD.gn
- index d55a06bf4812..61ffac7112fb 100644
- --- a/ui/gl/init/BUILD.gn
- +++ b/ui/gl/init/BUILD.gn
- @@ -33,7 +33,15 @@ jumbo_component("init") {
- "//ui/gl",
- ]
- - if (is_android) {
- + if (use_ozone) {
- + sources += [
- + "gl_factory_ozone.cc",
- + "gl_initializer_ozone.cc",
- + "ozone_util.h",
- + ]
- +
- + deps += [ "//ui/ozone" ]
- + } else if (is_android) {
- sources += [
- "gl_factory_android.cc",
- "gl_initializer_android.cc",
- @@ -60,13 +68,5 @@ jumbo_component("init") {
- ]
- deps += [ "//ui/gfx/x" ]
- - } else if (use_ozone) {
- - sources += [
- - "gl_factory_ozone.cc",
- - "gl_initializer_ozone.cc",
- - "ozone_util.h",
- - ]
- -
- - deps += [ "//ui/ozone" ]
- }
- }
- diff --git a/ui/ozone/BUILD.gn b/ui/ozone/BUILD.gn
- index 2154dd02c676..fe264573fd45 100644
- --- a/ui/ozone/BUILD.gn
- +++ b/ui/ozone/BUILD.gn
- @@ -21,6 +21,11 @@ ozone_platform_deps = ozone_external_platform_deps
- # Extra dependencies to pull into ozone_unittests for built platforms.
- ozone_platform_test_deps = ozone_external_platform_test_deps
- +if (ozone_platform_windzone) {
- + ozone_platforms += [ "windzone" ]
- + ozone_platform_deps += [ "platform/windzone" ]
- +}
- +
- if (ozone_platform_headless) {
- ozone_platforms += [ "headless" ]
- ozone_platform_deps += [ "platform/headless" ]
- diff --git a/ui/ozone/DEPS b/ui/ozone/DEPS
- index bcaff46ed217..ef50f3ccbed4 100644
- --- a/ui/ozone/DEPS
- +++ b/ui/ozone/DEPS
- @@ -1,6 +1,7 @@
- include_rules = [
- "+services/service_manager/public/cpp",
- "+skia/ext",
- + "+third_party/angle",
- "+third_party/khronos",
- "+third_party/skia",
- "+ui/display",
- diff --git a/ui/ozone/common/egl_util.cc b/ui/ozone/common/egl_util.cc
- index 9a40d1db0017..86636c3f94b6 100644
- --- a/ui/ozone/common/egl_util.cc
- +++ b/ui/ozone/common/egl_util.cc
- @@ -14,12 +14,16 @@
- namespace ui {
- namespace {
- -const char kDefaultEglSoname[] = "libEGL.so.1";
- -const char kDefaultGlesSoname[] = "libGLESv2.so.2";
- +const base::FilePath::CharType kDefaultEglSoname[] =
- + FILE_PATH_LITERAL("libEGL.so.1");
- +const base::FilePath::CharType kDefaultGlesSoname[] =
- + FILE_PATH_LITERAL("libGLESv2.so.2");
- #if BUILDFLAG(ENABLE_SWIFTSHADER)
- -const char kGLESv2SwiftShaderLibraryName[] = "libGLESv2.so";
- -const char kEGLSwiftShaderLibraryName[] = "libEGL.so";
- +const base::FilePath::CharType kGLESv2SwiftShaderLibraryName[] =
- + FILE_PATH_LITERAL("libGLESv2.so");
- +const base::FilePath::CharType kEGLSwiftShaderLibraryName[] =
- + FILE_PATH_LITERAL("libEGL.so");
- #endif
- bool LoadEGLGLES2Bindings(const base::FilePath& egl_library_path,
- @@ -69,7 +73,7 @@ bool LoadDefaultEGLGLES2Bindings(gl::GLImplementation implementation) {
- base::FilePath module_path;
- if (!PathService::Get(base::DIR_MODULE, &module_path))
- return false;
- - module_path = module_path.Append("swiftshader/");
- + module_path = module_path.Append(FILE_PATH_LITERAL("swiftshader/"));
- glesv2_path = module_path.Append(kGLESv2SwiftShaderLibraryName);
- egl_path = module_path.Append(kEGLSwiftShaderLibraryName);
- diff --git a/ui/ozone/common/gl_ozone_egl.h b/ui/ozone/common/gl_ozone_egl.h
- index 7e43d71fd4f0..44b3687a667b 100644
- --- a/ui/ozone/common/gl_ozone_egl.h
- +++ b/ui/ozone/common/gl_ozone_egl.h
- @@ -7,6 +7,7 @@
- #include "base/callback.h"
- #include "base/macros.h"
- +#include "third_party/angle/include/EGL/eglplatform.h"
- #include "ui/gl/gl_implementation.h"
- #include "ui/ozone/public/gl_ozone.h"
- @@ -42,7 +43,7 @@ class GLOzoneEGL : public GLOzone {
- protected:
- // Returns native platform display handle. This is used to obtain the EGL
- // display connection for the native display.
- - virtual intptr_t GetNativeDisplay() = 0;
- + virtual EGLNativeDisplayType GetNativeDisplay() = 0;
- // Sets up GL bindings for the native surface.
- virtual bool LoadGLES2Bindings(gl::GLImplementation implementation) = 0;
- diff --git a/ui/ozone/demo/ozone_demo.cc b/ui/ozone/demo/ozone_demo.cc
- index ed283ba64945..4e38c870fb4b 100644
- --- a/ui/ozone/demo/ozone_demo.cc
- +++ b/ui/ozone/demo/ozone_demo.cc
- @@ -37,6 +37,10 @@
- #include "ui/platform_window/platform_window.h"
- #include "ui/platform_window/platform_window_delegate.h"
- +#if !defined(OS_WIN)
- +#error "OS IS NOT WINDOWS"
- +#endif
- +
- const int kTestWindowWidth = 800;
- const int kTestWindowHeight = 600;
- @@ -80,10 +84,10 @@ class RendererFactory {
- DISALLOW_COPY_AND_ASSIGN(RendererFactory);
- };
- -class WindowManager : public display::NativeDisplayObserver {
- +class WindowManager {
- public:
- explicit WindowManager(const base::Closure& quit_closure);
- - ~WindowManager() override;
- + ~WindowManager();
- void Quit();
- @@ -96,8 +100,8 @@ class WindowManager : public display::NativeDisplayObserver {
- void OnDisplayConfigured(const gfx::Rect& bounds, bool success);
- // display::NativeDisplayDelegate:
- - void OnConfigurationChanged() override;
- - void OnDisplaySnapshotsInvalidated() override;
- + void OnConfigurationChanged();
- + void OnDisplaySnapshotsInvalidated();
- std::unique_ptr<display::NativeDisplayDelegate> delegate_;
- base::Closure quit_closure_;
- @@ -254,7 +258,7 @@ WindowManager::WindowManager(const base::Closure& quit_closure)
- LOG(FATAL) << "Failed to initialize renderer factory";
- if (delegate_) {
- - delegate_->AddObserver(this);
- + // delegate_->AddObserver(this);
- delegate_->Initialize();
- OnConfigurationChanged();
- } else {
- @@ -273,8 +277,8 @@ WindowManager::WindowManager(const base::Closure& quit_closure)
- }
- WindowManager::~WindowManager() {
- - if (delegate_)
- - delegate_->RemoveObserver(this);
- + // if (delegate_)
- + // delegate_->RemoveObserver(this);
- }
- void WindowManager::Quit() {
- @@ -341,6 +345,7 @@ int main(int argc, char** argv) {
- // Initialize logging so we can enable VLOG messages.
- logging::LoggingSettings settings;
- + settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
- logging::InitLogging(settings);
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(kHelp)) {
- diff --git a/ui/ozone/demo/skia_renderer.cc b/ui/ozone/demo/skia_renderer.cc
- index 71154c08925b..73a168343530 100644
- --- a/ui/ozone/demo/skia_renderer.cc
- +++ b/ui/ozone/demo/skia_renderer.cc
- @@ -50,6 +50,7 @@ SkiaRenderer::~SkiaRenderer() {
- bool SkiaRenderer::Initialize() {
- gl_context_ = gl::init::CreateGLContext(nullptr, gl_surface_.get(),
- gl::GLContextAttribs());
- + printf("skia\n");
- if (!gl_context_.get()) {
- LOG(FATAL) << "Failed to create GL context";
- return false;
- diff --git a/ui/ozone/ozone.gni b/ui/ozone/ozone.gni
- index 8e8105136094..ead072a489f1 100644
- --- a/ui/ozone/ozone.gni
- +++ b/ui/ozone/ozone.gni
- @@ -59,11 +59,14 @@ declare_args() {
- ozone_platform = "x11"
- ozone_platform_wayland = true
- ozone_platform_x11 = true
- + } else if (is_win) {
- + ozone_platform = "windzone"
- + ozone_platform_windzone = true
- }
- }
- }
- assert(use_ozone || !(ozone_platform_cast || ozone_platform_gbm ||
- ozone_platform_headless || ozone_platform_x11 ||
- - ozone_platform_wayland),
- + ozone_platform_wayland || ozone_platform_windzone),
- "Must set use_ozone to select ozone platforms")
- diff --git a/ui/ozone/platform/headless/headless_surface_factory.cc b/ui/ozone/platform/headless/headless_surface_factory.cc
- index 6e64f51c5830..25092dcb2e71 100644
- --- a/ui/ozone/platform/headless/headless_surface_factory.cc
- +++ b/ui/ozone/platform/headless/headless_surface_factory.cc
- @@ -28,6 +28,8 @@ namespace ui {
- namespace {
- +const base::FilePath::CharType kDevNull[] = FILE_PATH_LITERAL("/dev/null");
- +
- void WriteDataToFile(const base::FilePath& location, const SkBitmap& bitmap) {
- DCHECK(!location.empty());
- std::vector<unsigned char> png_data;
- @@ -137,11 +139,19 @@ HeadlessSurfaceFactory::~HeadlessSurfaceFactory() = default;
- base::FilePath HeadlessSurfaceFactory::GetPathForWidget(
- gfx::AcceleratedWidget widget) {
- - if (base_path_.empty() || base_path_ == base::FilePath("/dev/null"))
- + if (base_path_.empty() || base_path_ == base::FilePath(kDevNull))
- return base_path_;
- // Disambiguate multiple window output files with the window id.
- +
- +#if defined(OS_WIN)
- + std::string path = base::IntToString(reinterpret_cast<int>(widget)) + ".png";
- + std::wstring wpath(path.begin(), path.end());
- + return base_path_.Append(wpath);
- +#else
- return base_path_.Append(base::IntToString(widget) + ".png");
- +#endif
- + // return base_path_.Append(FILE_PATH_LITERAL("123.png"));
- }
- std::vector<gl::GLImplementation>
- @@ -177,7 +187,7 @@ void HeadlessSurfaceFactory::CheckBasePath() const {
- return;
- if (!DirectoryExists(base_path_) && !base::CreateDirectory(base_path_) &&
- - base_path_ != base::FilePath("/dev/null"))
- + base_path_ != base::FilePath(kDevNull))
- PLOG(FATAL) << "Unable to create output directory";
- if (!base::PathIsWritable(base_path_))
- diff --git a/ui/ozone/platform/headless/headless_window.cc b/ui/ozone/platform/headless/headless_window.cc
- index 3608ffa42555..cbde29375b9f 100644
- --- a/ui/ozone/platform/headless/headless_window.cc
- +++ b/ui/ozone/platform/headless/headless_window.cc
- @@ -6,6 +6,7 @@
- #include <string>
- +#include "build/build_config.h"
- #include "ui/events/platform/platform_event_source.h"
- #include "ui/ozone/platform/headless/headless_window_manager.h"
- #include "ui/platform_window/platform_window_delegate.h"
- @@ -16,12 +17,20 @@ HeadlessWindow::HeadlessWindow(PlatformWindowDelegate* delegate,
- HeadlessWindowManager* manager,
- const gfx::Rect& bounds)
- : delegate_(delegate), manager_(manager), bounds_(bounds) {
- - widget_ = manager_->AddWindow(this);
- +#if defined(OS_WIN)
- + widget_ = reinterpret_cast<gfx::AcceleratedWidget>(manager_->AddWindow(this));
- +#else
- + widget_ = static_cast<gfx::AcceleratedWidget>(manager_->AddWindow(this));
- +#endif
- delegate_->OnAcceleratedWidgetAvailable(widget_, 1.f);
- }
- HeadlessWindow::~HeadlessWindow() {
- - manager_->RemoveWindow(widget_, this);
- +#if defined(OS_WIN)
- + manager_->RemoveWindow(reinterpret_cast<uint64_t>(widget_), this);
- +#else
- + manager_->RemoveWindow(static_cast<uint64_t>(widget_), this);
- +#endif
- }
- gfx::Rect HeadlessWindow::GetBounds() {
- diff --git a/ui/ozone/platform/headless/ozone_platform_headless.cc b/ui/ozone/platform/headless/ozone_platform_headless.cc
- index 8c569f491313..6bdb21683a13 100644
- --- a/ui/ozone/platform/headless/ozone_platform_headless.cc
- +++ b/ui/ozone/platform/headless/ozone_platform_headless.cc
- @@ -88,7 +88,7 @@ class OzonePlatformHeadless : public OzonePlatform {
- overlay_manager_ = std::make_unique<StubOverlayManager>();
- input_controller_ = CreateStubInputController();
- - cursor_factory_ozone_ = std::make_unique<BitmapCursorFactoryOzone>();
- + // cursor_factory_ozone_ = std::make_unique<BitmapCursorFactoryOzone>();
- gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost());
- }
- diff --git a/ui/ozone/platform/windzone/BUILD.gn b/ui/ozone/platform/windzone/BUILD.gn
- new file mode 100644
- index 000000000000..44b85e1b2d72
- --- /dev/null
- +++ b/ui/ozone/platform/windzone/BUILD.gn
- @@ -0,0 +1,38 @@
- +# Copyright 2018 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.
- +
- +visibility = [ "//ui/ozone/*" ]
- +
- +source_set("windzone") {
- + sources = [
- + "client_native_pixmap_factory_windzone.cc",
- + "client_native_pixmap_factory_windzone.h",
- + "ozone_platform_windzone.cc",
- + "ozone_platform_windzone.h",
- + "windzone_surface_factory.cc",
- + "windzone_surface_factory.h",
- + "windzone_window.cc",
- + "windzone_window.h",
- + "windzone_window_manager.cc",
- + "windzone_window_manager.h",
- + ]
- +
- + defines = [ "OZONE_IMPLEMENTATION" ]
- +
- + deps = [
- + "//base",
- + "//skia",
- + "//ui/base",
- + "//ui/display/manager",
- + "//ui/events",
- + "//ui/events/ozone:events_ozone_layout",
- + "//ui/events/platform",
- + "//ui/gfx/geometry",
- + "//ui/gl",
- + "//ui/ozone:ozone_base",
- + "//ui/ozone/common",
- + "//ui/platform_window",
- + "//ui/platform_window/win",
- + ]
- +}
- diff --git a/ui/ozone/platform/windzone/client_native_pixmap_factory_windzone.cc b/ui/ozone/platform/windzone/client_native_pixmap_factory_windzone.cc
- new file mode 100644
- index 000000000000..e06374d88c0c
- --- /dev/null
- +++ b/ui/ozone/platform/windzone/client_native_pixmap_factory_windzone.cc
- @@ -0,0 +1,15 @@
- +// Copyright 2018 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.
- +
- +#include "ui/ozone/platform/windzone/client_native_pixmap_factory_windzone.h"
- +
- +#include "ui/ozone/common/stub_client_native_pixmap_factory.h"
- +
- +namespace ui {
- +
- +gfx::ClientNativePixmapFactory* CreateClientNativePixmapFactoryWindzone() {
- + return CreateStubClientNativePixmapFactory();
- +}
- +
- +} // namespace ui
- diff --git a/ui/ozone/platform/windzone/client_native_pixmap_factory_windzone.h b/ui/ozone/platform/windzone/client_native_pixmap_factory_windzone.h
- new file mode 100644
- index 000000000000..09bc7cbcb1ed
- --- /dev/null
- +++ b/ui/ozone/platform/windzone/client_native_pixmap_factory_windzone.h
- @@ -0,0 +1,19 @@
- +// Copyright 2018 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_OZONE_PLATFORM_WINDZONE_CLIENT_NATIVE_PIXMAP_FACTORY_WINDZONE_H_
- +#define UI_OZONE_PLATFORM_WINDZONE_CLIENT_NATIVE_PIXMAP_FACTORY_WINDZONE_H_
- +
- +namespace gfx {
- +class ClientNativePixmapFactory;
- +}
- +
- +namespace ui {
- +
- +// Constructor hook for use in constructor_list.cc
- +gfx::ClientNativePixmapFactory* CreateClientNativePixmapFactoryWindzone();
- +
- +} // namespace ui
- +
- +#endif // UI_OZONE_PLATFORM_WINDZONE_CLIENT_NATIVE_PIXMAP_FACTORY_WINDZONE_H_
- diff --git a/ui/ozone/platform/windzone/ozone_platform_windzone.cc b/ui/ozone/platform/windzone/ozone_platform_windzone.cc
- new file mode 100644
- index 000000000000..3bf7b9ba4665
- --- /dev/null
- +++ b/ui/ozone/platform/windzone/ozone_platform_windzone.cc
- @@ -0,0 +1,115 @@
- +// Copyright 2018 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.
- +
- +#include "ui/ozone/platform/windzone/ozone_platform_windzone.h"
- +
- +#include "base/command_line.h"
- +#include "base/files/file_path.h"
- +#include "base/macros.h"
- +#include "base/memory/ptr_util.h"
- +#include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h"
- +#include "ui/display/manager/fake_display_delegate.h"
- +#include "ui/events/ozone/layout/keyboard_layout_engine_manager.h"
- +#include "ui/events/ozone/layout/stub/stub_keyboard_layout_engine.h"
- +#include "ui/events/platform/platform_event_source.h"
- +#include "ui/events/system_input_injector.h"
- +#include "ui/ozone/common/stub_overlay_manager.h"
- +#include "ui/ozone/platform/windzone/windzone_surface_factory.h"
- +#include "ui/ozone/platform/windzone/windzone_window.h"
- +#include "ui/ozone/platform/windzone/windzone_window_manager.h"
- +#include "ui/ozone/public/cursor_factory_ozone.h"
- +#include "ui/ozone/public/gpu_platform_support_host.h"
- +#include "ui/ozone/public/input_controller.h"
- +#include "ui/ozone/public/ozone_platform.h"
- +#include "ui/ozone/public/ozone_switches.h"
- +
- +namespace ui {
- +
- +namespace {
- +
- +// dummy class
- +class WindzonePlatformEventSource : public ui::PlatformEventSource {
- + public:
- + WindzonePlatformEventSource() = default;
- + ~WindzonePlatformEventSource() override = default;
- +
- + private:
- + DISALLOW_COPY_AND_ASSIGN(WindzonePlatformEventSource);
- +};
- +
- +// OzonePlatform for Windows
- +class OzonePlatformWindzone : public OzonePlatform {
- + public:
- + OzonePlatformWindzone() {}
- +
- + ~OzonePlatformWindzone() override {}
- +
- + // OzonePlatform:
- + ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override {
- + return surface_factory_.get();
- + }
- + OverlayManagerOzone* GetOverlayManager() override {
- + return overlay_manager_.get();
- + }
- + CursorFactoryOzone* GetCursorFactoryOzone() override {
- + return cursor_factory_ozone_.get();
- + }
- + InputController* GetInputController() override {
- + return input_controller_.get();
- + }
- + GpuPlatformSupportHost* GetGpuPlatformSupportHost() override {
- + return gpu_platform_support_host_.get();
- + }
- + std::unique_ptr<SystemInputInjector> CreateSystemInputInjector() override {
- + return nullptr; // no input injection support.
- + }
- + std::unique_ptr<PlatformWindow> CreatePlatformWindow(
- + PlatformWindowDelegate* delegate,
- + const gfx::Rect& bounds) override {
- + return std::make_unique<WindzoneWindow>(delegate, bounds);
- + }
- + std::unique_ptr<display::NativeDisplayDelegate> CreateNativeDisplayDelegate()
- + override {
- + return std::make_unique<display::FakeDisplayDelegate>();
- + }
- +
- + void InitializeUI(const InitParams& params) override {
- + window_manager_ = std::make_unique<WindzoneWindowManager>();
- + surface_factory_ = std::make_unique<WindzoneSurfaceFactory>();
- + // This unbreaks tests that create their own.
- + if (!PlatformEventSource::GetInstance())
- + platform_event_source_ = std::make_unique<WindzonePlatformEventSource>();
- + KeyboardLayoutEngineManager::SetKeyboardLayoutEngine(
- + std::make_unique<StubKeyboardLayoutEngine>());
- +
- + overlay_manager_ = std::make_unique<StubOverlayManager>();
- + input_controller_ = CreateStubInputController();
- + // cursor_factory_ozone_ = std::make_unique<BitmapCursorFactoryOzone>();
- + gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost());
- + }
- +
- + void InitializeGPU(const InitParams& params) override {
- + if (!surface_factory_)
- + surface_factory_ = std::make_unique<WindzoneSurfaceFactory>();
- + }
- +
- + private:
- + std::unique_ptr<WindzoneWindowManager> window_manager_;
- + std::unique_ptr<WindzoneSurfaceFactory> surface_factory_;
- + std::unique_ptr<PlatformEventSource> platform_event_source_;
- + std::unique_ptr<CursorFactoryOzone> cursor_factory_ozone_;
- + std::unique_ptr<InputController> input_controller_;
- + std::unique_ptr<GpuPlatformSupportHost> gpu_platform_support_host_;
- + std::unique_ptr<OverlayManagerOzone> overlay_manager_;
- +
- + DISALLOW_COPY_AND_ASSIGN(OzonePlatformWindzone);
- +};
- +
- +} // namespace
- +
- +OzonePlatform* CreateOzonePlatformWindzone() {
- + return new OzonePlatformWindzone;
- +}
- +
- +} // namespace ui
- diff --git a/ui/ozone/platform/windzone/ozone_platform_windzone.h b/ui/ozone/platform/windzone/ozone_platform_windzone.h
- new file mode 100644
- index 000000000000..004a12a176c9
- --- /dev/null
- +++ b/ui/ozone/platform/windzone/ozone_platform_windzone.h
- @@ -0,0 +1,17 @@
- +// Copyright 2018 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_OZONE_PLATFORM_WINDZONE_OZONE_PLATFORM_WINDZONE_H_
- +#define UI_OZONE_PLATFORM_WINDZONE_OZONE_PLATFORM_WINDZONE_H_
- +
- +namespace ui {
- +
- +class OzonePlatform;
- +
- +// Constructor hook for use in ozone_platform_list.cc
- +OzonePlatform* CreateOzonePlatformWindzone();
- +
- +} // namespace ui
- +
- +#endif // UI_OZONE_PLATFORM_WINDZONE_OZONE_PLATFORM_WINDZONE_H_
- diff --git a/ui/ozone/platform/windzone/windzone_surface_factory.cc b/ui/ozone/platform/windzone/windzone_surface_factory.cc
- new file mode 100644
- index 000000000000..f5f1d6cd2a27
- --- /dev/null
- +++ b/ui/ozone/platform/windzone/windzone_surface_factory.cc
- @@ -0,0 +1,67 @@
- +// Copyright 2018 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.
- +
- +#include "ui/ozone/platform/windzone/windzone_surface_factory.h"
- +
- +#include "base/bind.h"
- +#include "base/files/file_util.h"
- +#include "base/location.h"
- +#include "base/macros.h"
- +#include "base/memory/ptr_util.h"
- +#include "base/strings/string_number_conversions.h"
- +#include "base/task_scheduler/post_task.h"
- +#include "build/build_config.h"
- +#include "ui/gfx/codec/png_codec.h"
- +#include "ui/gfx/skia_util.h"
- +#include "ui/gfx/vsync_provider.h"
- +#include "ui/gl/gl_surface_osmesa_win.h"
- +#include "ui/ozone/common/egl_util.h"
- +#include "ui/ozone/common/gl_ozone_egl.h"
- +#include "ui/ozone/common/gl_ozone_osmesa.h"
- +#include "ui/ozone/platform/windzone/windzone_window.h"
- +#include "ui/ozone/platform/windzone/windzone_window_manager.h"
- +
- +namespace ui {
- +
- +namespace {
- +
- +class GLOzoneOSMesaWindzone : public GLOzoneOSMesa {
- + public:
- + GLOzoneOSMesaWindzone() = default;
- + ~GLOzoneOSMesaWindzone() override = default;
- +
- + // GLOzone:
- + scoped_refptr<gl::GLSurface> CreateViewGLSurface(
- + gfx::AcceleratedWidget window) override {
- + return gl::InitializeGLSurface(new gl::GLSurfaceOSMesaWin(window));
- + }
- +
- + // TODO(camurcu): Implement CreateOffscreenGLSurface().
- +
- + DISALLOW_COPY_AND_ASSIGN(GLOzoneOSMesaWindzone);
- +};
- +
- +} // namespace
- +
- +WindzoneSurfaceFactory::WindzoneSurfaceFactory()
- + : osmesa_implementation_(std::make_unique<GLOzoneOSMesaWindzone>()) {}
- +
- +WindzoneSurfaceFactory::~WindzoneSurfaceFactory() = default;
- +
- +std::vector<gl::GLImplementation>
- +WindzoneSurfaceFactory::GetAllowedGLImplementations() {
- + return std::vector<gl::GLImplementation>{gl::kGLImplementationOSMesaGL};
- +}
- +
- +GLOzone* WindzoneSurfaceFactory::GetGLOzone(
- + gl::GLImplementation implementation) {
- + switch (implementation) {
- + case gl::kGLImplementationOSMesaGL:
- + return osmesa_implementation_.get();
- + default:
- + return nullptr;
- + }
- +}
- +
- +} // namespace ui
- diff --git a/ui/ozone/platform/windzone/windzone_surface_factory.h b/ui/ozone/platform/windzone/windzone_surface_factory.h
- new file mode 100644
- index 000000000000..539d271c10f3
- --- /dev/null
- +++ b/ui/ozone/platform/windzone/windzone_surface_factory.h
- @@ -0,0 +1,36 @@
- +// Copyright 2018 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_OZONE_PLATFORM_WINDZONE_WINDZONE_SURFACE_FACTORY_H_
- +#define UI_OZONE_PLATFORM_WINDZONE_WINDZONE_SURFACE_FACTORY_H_
- +
- +#include <memory>
- +#include <vector>
- +
- +#include "base/files/file_path.h"
- +#include "base/macros.h"
- +#include "ui/ozone/public/gl_ozone.h"
- +#include "ui/ozone/public/surface_factory_ozone.h"
- +
- +namespace ui {
- +
- +// Handles GL initialization and surface/context creation for Windzone
- +class WindzoneSurfaceFactory : public SurfaceFactoryOzone {
- + public:
- + WindzoneSurfaceFactory();
- + ~WindzoneSurfaceFactory() override;
- +
- + // SurfaceFactoryOzone:
- + std::vector<gl::GLImplementation> GetAllowedGLImplementations() override;
- + GLOzone* GetGLOzone(gl::GLImplementation implementation) override;
- +
- + private:
- + std::unique_ptr<GLOzone> osmesa_implementation_;
- +
- + DISALLOW_COPY_AND_ASSIGN(WindzoneSurfaceFactory);
- +};
- +
- +} // namespace ui
- +
- +#endif // UI_OZONE_PLATFORM_WINDZONE_WINDZONE_SURFACE_FACTORY_H_
- diff --git a/ui/ozone/platform/windzone/windzone_window.cc b/ui/ozone/platform/windzone/windzone_window.cc
- new file mode 100644
- index 000000000000..0e17ff031df8
- --- /dev/null
- +++ b/ui/ozone/platform/windzone/windzone_window.cc
- @@ -0,0 +1,22 @@
- +// Copyright 2018 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.
- +
- +#include "ui/ozone/platform/windzone/windzone_window.h"
- +
- +#include <string>
- +
- +#include "build/build_config.h"
- +#include "ui/events/platform/platform_event_source.h"
- +#include "ui/ozone/platform/windzone/windzone_window_manager.h"
- +#include "ui/platform_window/platform_window_delegate.h"
- +
- +namespace ui {
- +
- +WindzoneWindow::WindzoneWindow(PlatformWindowDelegate* delegate,
- + const gfx::Rect& bounds)
- + : WinWindow(delegate, bounds) {}
- +
- +WindzoneWindow::~WindzoneWindow() {}
- +
- +} // namespace ui
- diff --git a/ui/ozone/platform/windzone/windzone_window.h b/ui/ozone/platform/windzone/windzone_window.h
- new file mode 100644
- index 000000000000..cde23ef66a18
- --- /dev/null
- +++ b/ui/ozone/platform/windzone/windzone_window.h
- @@ -0,0 +1,29 @@
- +// Copyright 2018 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_OZONE_PLATFORM_WINDZONE_WINDZONE_WINDOW_H_
- +#define UI_OZONE_PLATFORM_WINDZONE_WINDZONE_WINDOW_H_
- +
- +#include "base/macros.h"
- +#include "ui/gfx/geometry/rect.h"
- +#include "ui/gfx/native_widget_types.h"
- +#include "ui/platform_window/win/win_window.h"
- +
- +namespace ui {
- +
- +class PlatformWindowDelegate;
- +class WindzoneWindowManager;
- +
- +class WindzoneWindow : public WinWindow {
- + public:
- + WindzoneWindow(PlatformWindowDelegate* delegate, const gfx::Rect& bounds);
- + ~WindzoneWindow() override;
- +
- + private:
- + DISALLOW_COPY_AND_ASSIGN(WindzoneWindow);
- +};
- +
- +} // namespace ui
- +
- +#endif // UI_OZONE_PLATFORM_WINDZONE_WINDZONE_WINDOW_H_
- diff --git a/ui/ozone/platform/windzone/windzone_window_manager.cc b/ui/ozone/platform/windzone/windzone_window_manager.cc
- new file mode 100644
- index 000000000000..6b1040ce363b
- --- /dev/null
- +++ b/ui/ozone/platform/windzone/windzone_window_manager.cc
- @@ -0,0 +1,29 @@
- +// Copyright 2018 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.
- +
- +#include "ui/ozone/platform/windzone/windzone_window_manager.h"
- +
- +namespace ui {
- +
- +WindzoneWindowManager::WindzoneWindowManager() = default;
- +
- +WindzoneWindowManager::~WindzoneWindowManager() {
- + DCHECK(thread_checker_.CalledOnValidThread());
- +}
- +
- +int32_t WindzoneWindowManager::AddWindow(WindzoneWindow* window) {
- + return windows_.Add(window);
- +}
- +
- +void WindzoneWindowManager::RemoveWindow(int32_t window_id,
- + WindzoneWindow* window) {
- + DCHECK_EQ(window, windows_.Lookup(window_id));
- + windows_.Remove(window_id);
- +}
- +
- +WindzoneWindow* WindzoneWindowManager::GetWindow(int32_t window_id) {
- + return windows_.Lookup(window_id);
- +}
- +
- +} // namespace ui
- diff --git a/ui/ozone/platform/windzone/windzone_window_manager.h b/ui/ozone/platform/windzone/windzone_window_manager.h
- new file mode 100644
- index 000000000000..a7c7a3c4b4dc
- --- /dev/null
- +++ b/ui/ozone/platform/windzone/windzone_window_manager.h
- @@ -0,0 +1,46 @@
- +// Copyright 2018 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_OZONE_PLATFORM_WINDZONE_WINDZONE_WINDOW_MANAGER_H_
- +#define UI_OZONE_PLATFORM_WINDZONE_WINDZONE_WINDOW_MANAGER_H_
- +
- +#include <stdint.h>
- +
- +#include <memory>
- +
- +#include "base/containers/id_map.h"
- +#include "base/files/file_path.h"
- +#include "base/macros.h"
- +#include "base/threading/thread_checker.h"
- +#include "ui/gfx/native_widget_types.h"
- +#include "ui/ozone/public/surface_factory_ozone.h"
- +
- +namespace ui {
- +
- +class WindzoneWindow;
- +
- +class WindzoneWindowManager {
- + public:
- + WindzoneWindowManager();
- + ~WindzoneWindowManager();
- +
- + // Register a new window. Returns the window id.
- + int32_t AddWindow(WindzoneWindow* window);
- +
- + // Remove a window.
- + void RemoveWindow(int32_t window_id, WindzoneWindow* window);
- +
- + // Find a window object by id;
- + WindzoneWindow* GetWindow(int32_t window_id);
- +
- + private:
- + base::IDMap<WindzoneWindow*> windows_;
- + base::ThreadChecker thread_checker_;
- +
- + DISALLOW_COPY_AND_ASSIGN(WindzoneWindowManager);
- +};
- +
- +} // namespace ui
- +
- +#endif // UI_OZONE_PLATFORM_WINDZONE_WINDZONE_WINDOW_MANAGER_H_
- diff --git a/ui/platform_window/win/win_window.cc b/ui/platform_window/win/win_window.cc
- index 2f32390a5f5d..2d2d88dea757 100644
- --- a/ui/platform_window/win/win_window.cc
- +++ b/ui/platform_window/win/win_window.cc
- @@ -119,7 +119,7 @@ void WinWindow::Minimize() {}
- void WinWindow::Restore() {}
- void WinWindow::SetCursor(PlatformCursor cursor) {
- - ::SetCursor(cursor);
- + //::SetCursor(cursor);
- }
- void WinWindow::MoveCursorTo(const gfx::Point& location) {}
- @@ -132,15 +132,15 @@ PlatformImeController* WinWindow::GetPlatformImeController() {
- }
- LRESULT WinWindow::OnMouseRange(UINT message, WPARAM w_param, LPARAM l_param) {
- - MSG msg = { hwnd(), message, w_param, l_param,
- - static_cast<DWORD>(GetMessageTime()),
- - { CR_GET_X_LPARAM(l_param), CR_GET_Y_LPARAM(l_param) } };
- - std::unique_ptr<Event> event = EventFromNative(msg);
- - if (IsMouseEventFromTouch(message))
- - event->set_flags(event->flags() | EF_FROM_TOUCH);
- - if (!(event->flags() & ui::EF_IS_NON_CLIENT))
- - delegate_->DispatchEvent(event.get());
- - SetMsgHandled(event->handled());
- + // MSG msg = { hwnd(), message, w_param, l_param,
- + // static_cast<DWORD>(GetMessageTime()),
- + // { CR_GET_X_LPARAM(l_param), CR_GET_Y_LPARAM(l_param) } };
- + // std::unique_ptr<Event> event = EventFromNative(msg);
- + // if (IsMouseEventFromTouch(message))
- + // event->set_flags(event->flags() | EF_FROM_TOUCH);
- + // if (!(event->flags() & ui::EF_IS_NON_CLIENT))
- + // delegate_->DispatchEvent(event.get());
- + // SetMsgHandled(event->handled());
- return 0;
- }
- @@ -152,10 +152,10 @@ LRESULT WinWindow::OnCaptureChanged(UINT message,
- }
- LRESULT WinWindow::OnKeyEvent(UINT message, WPARAM w_param, LPARAM l_param) {
- - MSG msg = { hwnd(), message, w_param, l_param };
- - KeyEvent event(msg);
- - delegate_->DispatchEvent(&event);
- - SetMsgHandled(event.handled());
- + // MSG msg = { hwnd(), message, w_param, l_param };
- + // KeyEvent event(msg);
- + // delegate_->DispatchEvent(&event);
- + // SetMsgHandled(event.handled());
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement