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

Unified Diff: ui/aura/window_tree_host_x11.cc

Issue 255823009: [WIP] ui/window: Master CL. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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/aura/window_tree_host_x11.cc
diff --git a/ui/aura/window_tree_host_x11.cc b/ui/aura/window_tree_host_x11.cc
index bd897d9c76448c88b7388c830f922d0d55f260f6..97121def221a67d4663dff1b577f8cfa839c75db 100644
--- a/ui/aura/window_tree_host_x11.cc
+++ b/ui/aura/window_tree_host_x11.cc
@@ -44,6 +44,7 @@
#include "ui/events/x/device_list_cache_x.h"
#include "ui/events/x/touch_factory_x11.h"
#include "ui/gfx/screen.h"
+#include "ui/window/platform_window.h"
using std::max;
using std::min;
@@ -175,6 +176,9 @@ WindowTreeHostX11::WindowTreeHostX11(const gfx::Rect& bounds)
XRRSelectInput(xdisplay_, x_root_window_,
RRScreenChangeNotifyMask | RROutputChangeNotifyMask);
CreateCompositor(GetAcceleratedWidget());
+
+ platform_window_ = ui::CreateDefaultPlatformWindow(this);
+ platform_window_->SetBounds(bounds);
}
WindowTreeHostX11::~WindowTreeHostX11() {
@@ -373,9 +377,11 @@ void WindowTreeHostX11::Show() {
ui::X11EventSource::GetInstance()->BlockUntilWindowMapped(xwindow_);
window_mapped_ = true;
}
+ platform_window_->Show();
}
void WindowTreeHostX11::Hide() {
+ platform_window_->Hide();
if (window_mapped_) {
XWithdrawWindow(xdisplay_, xwindow_, 0);
window_mapped_ = false;
@@ -424,6 +430,7 @@ void WindowTreeHostX11::SetBounds(const gfx::Rect& bounds) {
} else {
window()->SchedulePaintInRect(window()->bounds());
}
+ platform_window_->SetBounds(bounds);
}
gfx::Point WindowTreeHostX11::GetLocationOnNativeScreen() const {
@@ -520,6 +527,49 @@ ui::EventProcessor* WindowTreeHostX11::GetEventProcessor() {
return dispatcher();
}
+void WindowTreeHostX11::OnBoundsChanged(const gfx::Rect& new_bounds) {
+ bool size_changed = bounds_.size() != new_bounds.size();
+ bool origin_changed = bounds_.origin() != new_bounds.origin();
+ bounds_ = new_bounds;
+ OnConfigureNotify();
+ if (size_changed)
+ OnHostResized(new_bounds.size());
+ if (origin_changed)
+ OnHostMoved(bounds_.origin());
+}
+
+void WindowTreeHostX11::OnDamageRect(const gfx::Rect& damaged_rect) {
+ compositor()->ScheduleRedrawRect(damaged_rect);
+}
+
+void WindowTreeHostX11::DispatchEvent(ui::Event* event) {
+ LOG(ERROR) << "X: " << event->name();
+ if (event->type() == ui::ET_MOUSE_MOVED &&
+ (event->flags() & ui::EF_IS_SYNTHESIZED)) {
+ aura::Window* root_window = window();
+ client::CursorClient* cursor_client = client::GetCursorClient(root_window);
+ if (cursor_client) {
+ const gfx::Display display = gfx::Screen::GetScreenFor(root_window)
+ ->GetDisplayNearestWindow(root_window);
+ cursor_client->SetDisplay(display);
+ }
+ }
+}
+
+void WindowTreeHostX11::OnCloseRequest() {
+}
+
+void WindowTreeHostX11::OnClosed() {
+}
+
+void WindowTreeHostX11::OnWindowStateChanged(
+ ui::PlatformWindowState new_state) {
+}
+
+void WindowTreeHostX11::OnLostCapture() {
+ OnHostLostWindowCapture();
+}
+
void WindowTreeHostX11::DispatchXI2Event(const base::NativeEvent& event) {
ui::TouchFactory* factory = ui::TouchFactory::GetInstance();
XEvent* xev = event;

Powered by Google App Engine
This is Rietveld 408576698