Index: ui/platform_window/x11/x11_window_base.h |
diff --git a/ui/platform_window/x11/x11_window.h b/ui/platform_window/x11/x11_window_base.h |
similarity index 63% |
copy from ui/platform_window/x11/x11_window.h |
copy to ui/platform_window/x11/x11_window_base.h |
index 54bbed860829f9cb759bd6f66e3e3147d03a5c9b..87ec04af9578bb463454a56dd3ba5f959c50200d 100644 |
--- a/ui/platform_window/x11/x11_window.h |
+++ b/ui/platform_window/x11/x11_window_base.h |
@@ -1,14 +1,14 @@ |
-// 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_PLATFORM_WINDOW_X11_X11_WINDOW_BASE_H_ |
+#define UI_PLATFORM_WINDOW_X11_X11_WINDOW_BASE_H_ |
#include <stdint.h> |
+#include "base/callback.h" |
#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/platform_window/platform_window.h" |
@@ -17,19 +17,19 @@ |
typedef struct _XDisplay XDisplay; |
typedef unsigned long XID; |
+typedef union _XEvent XEvent; |
namespace ui { |
-class X11_WINDOW_EXPORT X11Window : public PlatformWindow, |
- public PlatformEventDispatcher { |
+// Abstract base implementation for a X11 based PlatformWindow. Methods that |
+// are platform specific are left unimplemented. |
+class X11_WINDOW_EXPORT X11WindowBase : public PlatformWindow { |
public: |
- explicit X11Window(PlatformWindowDelegate* delegate); |
- ~X11Window() override; |
+ explicit X11WindowBase(PlatformWindowDelegate* delegate); |
+ ~X11WindowBase() override; |
- private: |
- void Destroy(); |
- |
- void ProcessXInput2Event(XEvent* xevent); |
+ // Creates new underlying XWindow. Does not map XWindow. |
+ void Create(); |
// PlatformWindow: |
void Show() override; |
@@ -44,15 +44,24 @@ class X11_WINDOW_EXPORT X11Window : public PlatformWindow, |
void Maximize() override; |
void Minimize() override; |
void Restore() override; |
- void SetCursor(PlatformCursor cursor) override; |
void MoveCursorTo(const gfx::Point& location) override; |
void ConfineCursorToBounds(const gfx::Rect& bounds) override; |
PlatformImeController* GetPlatformImeController() override; |
- // PlatformEventDispatcher: |
- bool CanDispatchEvent(const PlatformEvent& event) override; |
- uint32_t DispatchEvent(const PlatformEvent& event) override; |
+ protected: |
+ void Destroy(); |
+ |
+ PlatformWindowDelegate* delegate() { return delegate_; } |
+ XDisplay* xdisplay() { return xdisplay_; } |
+ XID xwindow() { return xwindow_; } |
+ |
+ // Checks if a XWindow exists for this PlatformWindow. |
+ bool HasXWindow(); |
sadrul
2016/02/09 19:34:40
See comment in x11_window.cc. This can be replaced
kylechar
2016/02/09 21:31:54
Done.
|
+ // Processes events for this XWindow. |
+ void ProcessXWindowEvent(XEvent* xev); |
+ |
+ private: |
PlatformWindowDelegate* delegate_; |
XDisplay* xdisplay_; |
@@ -68,16 +77,17 @@ 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(X11WindowBase); |
}; |
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 |
+// X11WindowBase::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( |
@@ -87,4 +97,4 @@ X11_WINDOW_EXPORT void SetUseOverrideRedirectWindowByDefault( |
} // namespace ui |
-#endif // UI_PLATFORM_WINDOW_X11_X11_WINDOW_H_ |
+#endif // UI_PLATFORM_WINDOW_X11_X11_WINDOW_BASE_H_ |