Chromium Code Reviews| Index: ui/ozone/platform/x11/x11_window_ozone.h |
| diff --git a/ui/platform_window/x11/x11_window.h b/ui/ozone/platform/x11/x11_window_ozone.h |
| similarity index 60% |
| copy from ui/platform_window/x11/x11_window.h |
| copy to ui/ozone/platform/x11/x11_window_ozone.h |
| index 54bbed860829f9cb759bd6f66e3e3147d03a5c9b..8ab1e6cdd6f8a45428553069af615fbeb666a88d 100644 |
| --- a/ui/platform_window/x11/x11_window.h |
| +++ b/ui/ozone/platform/x11/x11_window_ozone.h |
| @@ -1,35 +1,38 @@ |
| -// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// 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_PLATFORM_WINDOW_X11_X11_WINDOW_H_ |
| -#define UI_PLATFORM_WINDOW_X11_X11_WINDOW_H_ |
| +#ifndef UI_OZONE_PLATFORM_X11_X11_WINDOW_OZONE_H_ |
| +#define UI_OZONE_PLATFORM_X11_X11_WINDOW_OZONE_H_ |
| -#include <stdint.h> |
| +#include <map> |
| -#include "base/macros.h" |
| #include "ui/events/platform/platform_event_dispatcher.h" |
| #include "ui/gfx/geometry/rect.h" |
| #include "ui/gfx/x/x11_atom_cache.h" |
| +#include "ui/ozone/platform/x11/x11_window_manager_ozone.h" |
| #include "ui/platform_window/platform_window.h" |
| -#include "ui/platform_window/platform_window_delegate.h" |
| -#include "ui/platform_window/x11/x11_window_export.h" |
| typedef struct _XDisplay XDisplay; |
| typedef unsigned long XID; |
| +typedef union _XEvent XEvent; |
| namespace ui { |
| -class X11_WINDOW_EXPORT X11Window : public PlatformWindow, |
| - public PlatformEventDispatcher { |
| +// Manages one XWindow and handles events for that window. |
| +class X11WindowOzone : public PlatformWindow, public PlatformEventDispatcher { |
|
sadrul
2016/01/21 14:53:01
Can you use X11Window instead? |on_create_callback
spang
2016/01/21 15:07:33
We have to pull out the event handling stuff since
|
| public: |
| - explicit X11Window(PlatformWindowDelegate* delegate); |
| - ~X11Window() override; |
| + explicit X11WindowOzone(PlatformWindowDelegate* delegate, |
| + WindowStatusCallback on_create_callback, |
| + WindowStatusCallback on_destroy_callback); |
| + ~X11WindowOzone() override; |
| - private: |
| - void Destroy(); |
| + // Creates new underlying XWindow. Does not map XWindow. |
| + void Create(); |
| - void ProcessXInput2Event(XEvent* xevent); |
| + // Processes an XEvent that can't be converted into an equivalent ui::Event |
| + // and handled by normal event loop. |
| + void ProcessXEvent(const XEvent& xev); |
| // PlatformWindow: |
| void Show() override; |
| @@ -49,12 +52,18 @@ class X11_WINDOW_EXPORT X11Window : public PlatformWindow, |
| void ConfineCursorToBounds(const gfx::Rect& bounds) override; |
| PlatformImeController* GetPlatformImeController() override; |
| + private: |
| + void Destroy(); |
| + |
| // PlatformEventDispatcher: |
| bool CanDispatchEvent(const PlatformEvent& event) override; |
| uint32_t DispatchEvent(const PlatformEvent& event) override; |
| PlatformWindowDelegate* delegate_; |
| + WindowStatusCallback on_create_callback_; |
| + WindowStatusCallback on_destroy_callback_; |
| + |
| XDisplay* xdisplay_; |
| XID xwindow_; |
| XID xroot_window_; |
| @@ -68,23 +77,11 @@ class X11_WINDOW_EXPORT X11Window : public PlatformWindow, |
| gfx::Rect requested_bounds_; |
| gfx::Rect confirmed_bounds_; |
| - bool window_mapped_; |
| + bool window_mapped_ = false; |
| - DISALLOW_COPY_AND_ASSIGN(X11Window); |
| + DISALLOW_COPY_AND_ASSIGN(X11WindowOzone); |
| }; |
| -namespace test { |
| - |
| -// Sets the value of the |override_redirect| flag when creating an X11 window. |
| -// It is necessary to set this flag on for various tests, otherwise the call to |
| -// X11Window::Show() blocks because it never receives the MapNotify event. It is |
| -// unclear why this is necessary, but might be related to calls to |
| -// XInitThreads(). |
| -X11_WINDOW_EXPORT void SetUseOverrideRedirectWindowByDefault( |
| - bool override_redirect); |
| - |
| -} // namespace test |
| - |
| } // namespace ui |
| -#endif // UI_PLATFORM_WINDOW_X11_X11_WINDOW_H_ |
| +#endif // UI_OZONE_PLATFORM_X11_X11_WINDOW_OZONE_H_ |