Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(662)

Unified Diff: ui/platform_window/x11/x11_window_base.h

Issue 1602173005: Add PlatformWindow/Event related code for Ozone X11. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Split X11EventSource and X11Window. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 67%
copy from ui/platform_window/x11/x11_window.h
copy to ui/platform_window/x11/x11_window_base.h
index 54bbed860829f9cb759bd6f66e3e3147d03a5c9b..54d924986c51d1affaa62661e9c67c0ec82714c2 100644
--- a/ui/platform_window/x11/x11_window.h
+++ b/ui/platform_window/x11/x11_window_base.h
@@ -1,12 +1,13 @@
-// 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"
@@ -17,19 +18,20 @@
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 PlatformEventDispatcher {
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,14 +46,15 @@ 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;
sadrul 2016/02/02 16:33:54 Since X11WindowBase no longer actually implements
kylechar 2016/02/02 19:01:42 Yep! Done.
+ protected:
+ void Destroy();
+
+ // Processes events for this XWindow.
+ void ProcessXWindowEvent(XEvent* xev);
PlatformWindowDelegate* delegate_;
@@ -68,16 +71,18 @@ class X11_WINDOW_EXPORT X11Window : public PlatformWindow,
gfx::Rect requested_bounds_;
gfx::Rect confirmed_bounds_;
- bool window_mapped_;
+ bool window_mapped_ = false;
sadrul 2016/02/02 16:33:54 data members need to be private (see style guide).
kylechar 2016/02/02 19:01:42 Fixed that here and in X11EventSource.
- DISALLOW_COPY_AND_ASSIGN(X11Window);
+ private:
+ 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 +92,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_

Powered by Google App Engine
This is Rietveld 408576698