#include "ui/views/widget/widget_hwnd_utils.h"
#include "ui/views/win/fullscreen_handler.h"
#include "ui/views/win/hwnd_message_handler.h"
-#include "ui/views/window/native_frame_view.h"
#include "ui/wm/core/compound_event_filter.h"
#include "ui/wm/core/input_method_event_filter.h"
#include "ui/wm/core/window_animations.h"
}
bool DesktopWindowTreeHostWin::ShouldUseNativeFrame() const {
- return ui::win::IsAeroGlassEnabled();
+ return IsTranslucentWindowOpacitySupported();
}
bool DesktopWindowTreeHostWin::ShouldWindowContentsBeTransparent() const {
SetWindowTransparency();
}
-NonClientFrameView* DesktopWindowTreeHostWin::CreateNonClientFrameView() {
- return GetWidget()->ShouldUseNativeFrame() ?
- new NativeFrameView(GetWidget()) : NULL;
-}
-
void DesktopWindowTreeHostWin::SetFullscreen(bool fullscreen) {
message_handler_->fullscreen_handler()->SetFullscreen(fullscreen);
// TODO(sky): workaround for ScopedFullscreenVisibility showing window
message_handler_->FlashFrame(flash_frame);
}
-void DesktopWindowTreeHostWin::OnRootViewLayout() const {
+void DesktopWindowTreeHostWin::OnRootViewLayout() {
}
void DesktopWindowTreeHostWin::OnNativeWidgetFocus() {
return pending_close_;
}
+bool DesktopWindowTreeHostWin::IsTranslucentWindowOpacitySupported() const {
+ return ui::win::IsAeroGlassEnabled();
+}
+
////////////////////////////////////////////////////////////////////////////////
// DesktopWindowTreeHostWin, WindowTreeHost implementation:
+ui::EventSource* DesktopWindowTreeHostWin::GetEventSource() {
+ return this;
+}
+
gfx::AcceleratedWidget DesktopWindowTreeHostWin::GetAcceleratedWidget() {
return message_handler_->hwnd();
}
message_handler_->Hide();
}
-void DesktopWindowTreeHostWin::ToggleFullScreen() {
- SetWindowTransparency();
-}
-
// GetBounds and SetBounds work in pixel coordinates, whereas other get/set
// methods work in DIP.
window_enlargement_ =
gfx::Vector2d(new_expanded.width() - expanded.width(),
new_expanded.height() - expanded.height());
- message_handler_->SetBounds(new_expanded);
-
- // The client area size may have changed even though the window bounds have
- // not, if the window bounds were expanded to 64 pixels both times.
- if (old_hwnd_size == new_expanded.size() && old_content_size != bounds.size())
- HandleClientSizeChanged(new_expanded.size());
-}
-
-gfx::Insets DesktopWindowTreeHostWin::GetInsets() const {
- return gfx::Insets();
-}
-
-void DesktopWindowTreeHostWin::SetInsets(const gfx::Insets& insets) {
+ message_handler_->SetBounds(new_expanded, old_content_size != bounds.size());
}
gfx::Point DesktopWindowTreeHostWin::GetLocationOnNativeScreen() const {
message_handler_->ReleaseCapture();
}
-bool DesktopWindowTreeHostWin::QueryMouseLocation(gfx::Point* location_return) {
- aura::client::CursorClient* cursor_client =
- aura::client::GetCursorClient(window());
- if (cursor_client && !cursor_client->IsMouseEventsEnabled()) {
- *location_return = gfx::Point(0, 0);
- return false;
- }
- POINT pt = {0};
- ::GetCursorPos(&pt);
- *location_return =
- gfx::Point(static_cast<int>(pt.x), static_cast<int>(pt.y));
- return true;
-}
-
-bool DesktopWindowTreeHostWin::ConfineCursorToRootWindow() {
- RECT window_rect = window()->GetBoundsInScreen().ToRECT();
- ::ClipCursor(&window_rect);
- return true;
-}
-
-void DesktopWindowTreeHostWin::UnConfineCursor() {
- ::ClipCursor(NULL);
-}
-
void DesktopWindowTreeHostWin::PostNativeEvent(
const base::NativeEvent& native_event) {
}
-void DesktopWindowTreeHostWin::OnDeviceScaleFactorChanged(
- float device_scale_factor) {
-}
-
void DesktopWindowTreeHostWin::SetCursorNative(gfx::NativeCursor cursor) {
ui::CursorLoaderWin cursor_loader;
cursor_loader.SetPlatformCursor(&cursor);
return IsMaximized() || (widget && widget->ShouldUseNativeFrame());
}
-bool DesktopWindowTreeHostWin::CanSaveFocus() const {
- return GetWidget()->is_top_level();
-}
-
-void DesktopWindowTreeHostWin::SaveFocusOnDeactivate() {
- GetWidget()->GetFocusManager()->StoreFocusedView(true);
-}
-
-void DesktopWindowTreeHostWin::RestoreFocusOnActivate() {
- RestoreFocusOnEnable();
-}
-
-void DesktopWindowTreeHostWin::RestoreFocusOnEnable() {
- GetWidget()->GetFocusManager()->RestoreFocusedView();
-}
-
bool DesktopWindowTreeHostWin::IsModal() const {
return native_widget_delegate_->IsModal();
}
int DesktopWindowTreeHostWin::GetInitialShowState() const {
- return SW_SHOWNORMAL;
+ return CanActivate() ? SW_SHOWNORMAL : SW_SHOWNOACTIVATE;
}
bool DesktopWindowTreeHostWin::WillProcessWorkAreaChange() const {
}
void DesktopWindowTreeHostWin::PaintLayeredWindow(gfx::Canvas* canvas) {
- GetWidget()->GetRootView()->Paint(canvas);
+ GetWidget()->GetRootView()->Paint(canvas, views::CullSet());
}
gfx::NativeViewAccessible DesktopWindowTreeHostWin::GetNativeViewAccessible() {
void DesktopWindowTreeHostWin::HandleCaptureLost() {
OnHostLostWindowCapture();
- native_widget_delegate_->OnMouseCaptureLost();
}
void DesktopWindowTreeHostWin::HandleClose() {
}
void DesktopWindowTreeHostWin::HandlePaint(gfx::Canvas* canvas) {
- compositor()->ScheduleRedrawRect(gfx::Rect());
+ // It appears possible to get WM_PAINT after WM_DESTROY.
+ if (compositor())
+ compositor()->ScheduleRedrawRect(gfx::Rect());
}
bool DesktopWindowTreeHostWin::HandleTooltipNotify(int w_param,
return tooltip_ && tooltip_->HandleNotify(w_param, l_param, l_result);
}
-void DesktopWindowTreeHostWin::HandleTooltipMouseMove(UINT message,
- WPARAM w_param,
- LPARAM l_param) {
- // TooltipWin implementation doesn't need this.
- // TODO(sky): remove from HWNDMessageHandler once non-aura path nuked.
-}
-
void DesktopWindowTreeHostWin::HandleMenuLoop(bool in_menu_loop) {
if (in_menu_loop) {
tooltip_disabler_.reset(
return event.handled();
}
+void DesktopWindowTreeHostWin::HandleWindowSizeChanging() {
+ if (compositor())
+ compositor()->FinishAllRendering();
+}
+
////////////////////////////////////////////////////////////////////////////////
// DesktopWindowTreeHostWin, private: