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

Unified Diff: ui/ozone/platform/x11/x11_window_host.h

Issue 1602173005: Add PlatformWindow/Event related code for Ozone X11. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Small fixes. 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/ozone/platform/x11/x11_window_host.h
diff --git a/ui/platform_window/x11/x11_window.h b/ui/ozone/platform/x11/x11_window_host.h
similarity index 60%
copy from ui/platform_window/x11/x11_window.h
copy to ui/ozone/platform/x11/x11_window_host.h
index 54bbed860829f9cb759bd6f66e3e3147d03a5c9b..aa89912a0665ecf4fd38f6d4ee50dda1aa4ee7eb 100644
--- a/ui/platform_window/x11/x11_window.h
+++ b/ui/ozone/platform/x11/x11_window_host.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_HOST_H_
+#define UI_OZONE_PLATFORM_X11_X11_WINDOW_HOST_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_host_manager.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 X11WindowHost : public PlatformWindow, public PlatformEventDispatcher {
spang 2016/01/20 19:53:31 Suggest calling it X11WindowOzone, the "host" thin
kylechar 2016/01/20 21:46:16 Done.
public:
- explicit X11Window(PlatformWindowDelegate* delegate);
- ~X11Window() override;
+ explicit X11WindowHost(PlatformWindowDelegate* delegate,
+ WindowStatusCallback on_create_callback,
+ WindowStatusCallback on_destroy_callback);
+ ~X11WindowHost() 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(X11WindowHost);
};
-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_HOST_H_

Powered by Google App Engine
This is Rietveld 408576698