Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / ozone / ui / desktop_aura / desktop_window_tree_host_wayland.cc
index 4ff0733..b1eba65 100644 (file)
@@ -170,14 +170,9 @@ void DesktopWindowTreeHostWayland::InitWaylandWindow(
       break;
   }
 
-  surface_factory->AttemptToResizeAcceleratedWidget(window_, bounds_);
   CreateCompositor(GetAcceleratedWidget());
 }
 
-bool DesktopWindowTreeHostWayland::IsWindowManagerPresent() {
-  return true;
-}
-
 ////////////////////////////////////////////////////////////////////////////////
 // DesktopWindowTreeHostWayland, DesktopWindowTreeHost implementation:
 
@@ -296,6 +291,8 @@ void DesktopWindowTreeHostWayland::ShowWindowWithState(
   }
 
   Show();
+  if (show_state == ui::SHOW_STATE_MAXIMIZED)
+    Maximize();
   // Set initial focus for root window.
   if (!window_parent_)
     native_widget_delegate_->AsWidget()->SetInitialFocus(show_state);
@@ -349,7 +346,7 @@ void DesktopWindowTreeHostWayland::CenterWindow(const gfx::Size& size) {
 void DesktopWindowTreeHostWayland::GetWindowPlacement(
     gfx::Rect* bounds,
     ui::WindowShowState* show_state) const {
-  *bounds = bounds_;
+  *bounds = GetRestoredBounds();
 
   if (IsFullscreen()) {
     *show_state = ui::SHOW_STATE_FULLSCREEN;
@@ -648,6 +645,11 @@ bool DesktopWindowTreeHostWayland::IsAnimatingClosed() const {
 ////////////////////////////////////////////////////////////////////////////////
 // DesktopWindowTreeHostWayland, aura::WindowTreeHost implementation:
 
+ui::EventSource* DesktopWindowTreeHostWayland::GetEventSource() {
+  NOTIMPLEMENTED();
+  return NULL;
+}
+
 gfx::AcceleratedWidget DesktopWindowTreeHostWayland::GetAcceleratedWidget() {
   return window_;
 }
@@ -662,6 +664,7 @@ void DesktopWindowTreeHostWayland::Show() {
   state_ |= Visible;
   ui::WindowStateChangeHandler::GetInstance()->SetWidgetState(window_,
                                                               ui::SHOW);
+  native_widget_delegate_->OnNativeWidgetVisibilityChanged(true);
 }
 
 void DesktopWindowTreeHostWayland::Hide() {
@@ -671,10 +674,7 @@ void DesktopWindowTreeHostWayland::Hide() {
   state_ &= ~Visible;
   ui::WindowStateChangeHandler::GetInstance()->SetWidgetState(window_,
                                                               ui::HIDE);
-}
-
-void DesktopWindowTreeHostWayland::ToggleFullScreen() {
-  SetFullscreen(!(state_ & FullScreen));
+  native_widget_delegate_->OnNativeWidgetVisibilityChanged(false);
 }
 
 gfx::Rect DesktopWindowTreeHostWayland::GetBounds() const {
@@ -689,20 +689,10 @@ void DesktopWindowTreeHostWayland::SetBounds(const gfx::Rect& bounds) {
 
   if (origin_changed)
     native_widget_delegate_->AsWidget()->OnNativeWidgetMove();
-  if (size_changed) {
-    ui::WindowStateChangeHandler::GetInstance()->SetWidgetState(
-        window_, ui::RESIZE, bounds.width(), bounds.height());
+  if (size_changed)
     OnHostResized(bounds.size());
-  } else {
+  else
     compositor()->ScheduleRedrawRect(bounds);
-  }
-}
-
-gfx::Insets DesktopWindowTreeHostWayland::GetInsets() const {
-  return gfx::Insets();
-}
-
-void DesktopWindowTreeHostWayland::SetInsets(const gfx::Insets& insets) {
 }
 
 gfx::Point DesktopWindowTreeHostWayland::GetLocationOnNativeScreen() const {
@@ -723,21 +713,6 @@ void DesktopWindowTreeHostWayland::SetCursorNative(gfx::NativeCursor cursor) {
       cursor.native_type());
 }
 
-bool DesktopWindowTreeHostWayland::QueryMouseLocation(
-    gfx::Point* location_return) {
-  NOTIMPLEMENTED();
-  return false;
-}
-
-bool DesktopWindowTreeHostWayland::ConfineCursorToRootWindow() {
-  NOTIMPLEMENTED();
-  return false;
-}
-
-void DesktopWindowTreeHostWayland::UnConfineCursor() {
-  NOTIMPLEMENTED();
-}
-
 void DesktopWindowTreeHostWayland::OnCursorVisibilityChangedNative(bool show) {
   // TODO(erg): Conditional on us enabling touch on desktop linux builds, do
   // the same tap-to-click disabling here that chromeos does.
@@ -782,8 +757,6 @@ void DesktopWindowTreeHostWayland::HandleWindowResize(unsigned width,
   } else {
     bounds_ = gfx::Rect(bounds_.x(), bounds_.y(), width, height);
     OnHostResized(bounds_.size());
-    ui::WindowStateChangeHandler::GetInstance()->SetWidgetState(
-        window_, ui::RESIZE, bounds_.width(), bounds_.height());
     Widget* widget = native_widget_delegate_->AsWidget();
     NonClientView* non_client_view = widget->non_client_view();
     // non_client_view may be NULL, especially during creation.
@@ -800,7 +773,7 @@ VIEWS_EXPORT ui::NativeTheme*
 DesktopWindowTreeHost::GetNativeTheme(aura::Window* window) {
   const views::LinuxUI* linux_ui = views::LinuxUI::instance();
   if (linux_ui) {
-    ui::NativeTheme* native_theme = linux_ui->GetNativeTheme();
+    ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window);
     if (native_theme)
       return native_theme;
   }