diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-23 23:06:51 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-23 23:06:51 +0000 |
commit | 511ca0d0a8c2941c64d4fd55c7bccaaef4d884ea (patch) | |
tree | 4c89b4ba1d89fd78c2b99cfb0c4a750edd2cde29 /views | |
parent | 2a021c45241b0556918f42df51709fdd7ff7a4fa (diff) | |
download | chromium_src-511ca0d0a8c2941c64d4fd55c7bccaaef4d884ea.zip chromium_src-511ca0d0a8c2941c64d4fd55c7bccaaef4d884ea.tar.gz chromium_src-511ca0d0a8c2941c64d4fd55c7bccaaef4d884ea.tar.bz2 |
Revert 79211 - Convert some WidgetWin construction to use CreateParams.
BUG=72040
TEST=none
Review URL: http://codereview.chromium.org/6719006
TBR=ben@chromium.org
Review URL: http://codereview.chromium.org/6696053
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79212 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/widget/native_widget.h | 2 | ||||
-rw-r--r-- | views/widget/widget.cc | 10 | ||||
-rw-r--r-- | views/widget/widget.h | 4 | ||||
-rw-r--r-- | views/widget/widget_gtk.cc | 10 | ||||
-rw-r--r-- | views/widget/widget_gtk.h | 2 | ||||
-rw-r--r-- | views/widget/widget_win.cc | 14 | ||||
-rw-r--r-- | views/widget/widget_win.h | 2 |
7 files changed, 18 insertions, 26 deletions
diff --git a/views/widget/native_widget.h b/views/widget/native_widget.h index b362453..9d6051f 100644 --- a/views/widget/native_widget.h +++ b/views/widget/native_widget.h @@ -88,7 +88,7 @@ class NativeWidget { virtual gfx::Rect GetWindowScreenBounds() const = 0; virtual gfx::Rect GetClientAreaScreenBounds() const = 0; virtual void SetBounds(const gfx::Rect& bounds) = 0; - virtual void MoveAbove(gfx::NativeView native_view) = 0; + virtual void MoveAbove(Widget* widget) = 0; virtual void SetShape(gfx::NativeRegion shape) = 0; virtual void Close() = 0; virtual void CloseNow() = 0; diff --git a/views/widget/widget.cc b/views/widget/widget.cc index 4963ce6..62f9cf9 100644 --- a/views/widget/widget.cc +++ b/views/widget/widget.cc @@ -21,7 +21,6 @@ Widget::CreateParams::CreateParams() : type(TYPE_TOPLEVEL), transparent(false), accept_events(true), - can_activate(true), delete_on_destroy(true), mirror_origin_in_rtl(true), has_dropshadow(false), @@ -32,7 +31,6 @@ Widget::CreateParams::CreateParams(Type type) : type(type), transparent(false), accept_events(true), - can_activate(type != TYPE_POPUP && type != TYPE_MENU), delete_on_destroy(true), mirror_origin_in_rtl(true), has_dropshadow(false), @@ -133,12 +131,8 @@ void Widget::SetBounds(const gfx::Rect& bounds) { native_widget_->SetBounds(bounds); } -void Widget::MoveAboveWidget(Widget* widget) { - native_widget_->MoveAbove(widget->GetNativeView()); -} - -void Widget::MoveAbove(gfx::NativeView native_view) { - native_widget_->MoveAbove(native_view); +void Widget::MoveAbove(Widget* widget) { + native_widget_->MoveAbove(widget); } void Widget::SetShape(gfx::NativeRegion shape) { diff --git a/views/widget/widget.h b/views/widget/widget.h index cb6a3ce..c164c16 100644 --- a/views/widget/widget.h +++ b/views/widget/widget.h @@ -75,7 +75,6 @@ class Widget : public internal::NativeWidgetDelegate, bool transparent; bool accept_events; - bool can_activate; bool delete_on_destroy; bool mirror_origin_in_rtl; bool has_dropshadow; @@ -165,8 +164,7 @@ class Widget : public internal::NativeWidgetDelegate, void SetBounds(const gfx::Rect& bounds); // Places the widget in front of the specified widget in z-order. - void MoveAboveWidget(Widget* widget); - void MoveAbove(gfx::NativeView native_view); + void MoveAbove(Widget* widget); // Sets a shape on the widget. This takes ownership of shape. void SetShape(gfx::NativeRegion shape); diff --git a/views/widget/widget_gtk.cc b/views/widget/widget_gtk.cc index b2371f8..d547386 100644 --- a/views/widget/widget_gtk.cc +++ b/views/widget/widget_gtk.cc @@ -18,7 +18,6 @@ #include "ui/base/dragdrop/drag_drop_types.h" #include "ui/base/dragdrop/os_exchange_data.h" #include "ui/base/dragdrop/os_exchange_data_provider_gtk.h" -#include "ui/base/gtk/gtk_windowing.h" #include "ui/base/x/x11_util.h" #include "ui/gfx/canvas_skia_paint.h" #include "ui/gfx/path.h" @@ -816,8 +815,13 @@ void WidgetGtk::SetBounds(const gfx::Rect& bounds) { } } -void WidgetGtk::MoveAbove(gfx::NativeView native_view) { - ui::StackPopupWindow(GetNativeView(), native_view); +void WidgetGtk::MoveAbove(Widget* widget) { + DCHECK(widget_); + DCHECK(widget_->window); + // TODO(oshima): gdk_window_restack is not available in gtk2.0, so + // we're simply raising the window to the top. We should switch to + // gdk_window_restack when we upgrade gtk to 2.18 or up. + gdk_window_raise(widget_->window); } void WidgetGtk::SetShape(gfx::NativeRegion region) { diff --git a/views/widget/widget_gtk.h b/views/widget/widget_gtk.h index 963076f..ed9e9fb 100644 --- a/views/widget/widget_gtk.h +++ b/views/widget/widget_gtk.h @@ -191,7 +191,7 @@ class WidgetGtk : public Widget, virtual gfx::Rect GetWindowScreenBounds() const OVERRIDE; virtual gfx::Rect GetClientAreaScreenBounds() const OVERRIDE; virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; - virtual void MoveAbove(gfx::NativeView native_view) OVERRIDE; + virtual void MoveAbove(Widget* widget) OVERRIDE; virtual void SetShape(gfx::NativeRegion shape) OVERRIDE; virtual void Close() OVERRIDE; virtual void CloseNow() OVERRIDE; diff --git a/views/widget/widget_win.cc b/views/widget/widget_win.cc index 147c443..bd8a049 100644 --- a/views/widget/widget_win.cc +++ b/views/widget/widget_win.cc @@ -157,15 +157,13 @@ void WidgetWin::SetCreateParams(const CreateParams& params) { // Set non-style attributes. set_delete_on_destroy(params.delete_on_destroy); - DWORD style = WS_CLIPCHILDREN | WS_CLIPSIBLINGS; + DWORD style = 0; DWORD ex_style = 0; DWORD class_style = CS_DBLCLKS; // Set type-independent style attributes. if (!params.accept_events) ex_style |= WS_EX_TRANSPARENT; - if (!params.can_activate) - ex_style |= WS_EX_NOACTIVATE; if (params.mirror_origin_in_rtl) ex_style |= l10n_util::GetExtendedTooltipStyles(); if (params.transparent) @@ -184,11 +182,11 @@ void WidgetWin::SetCreateParams(const CreateParams& params) { break; case CreateParams::TYPE_POPUP: style |= WS_POPUP; - ex_style |= WS_EX_TOOLWINDOW; + ex_style |= WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE; break; case CreateParams::TYPE_MENU: style |= WS_POPUP; - ex_style |= WS_EX_TOPMOST; + ex_style |= WS_EX_TOPMOST | WS_EX_NOACTIVATE; is_mouse_down_ = ((GetKeyState(VK_LBUTTON) & 0x80) || (GetKeyState(VK_RBUTTON) & 0x80) || @@ -356,8 +354,8 @@ void WidgetWin::SetBounds(const gfx::Rect& bounds) { SWP_NOACTIVATE | SWP_NOZORDER); } -void WidgetWin::MoveAbove(gfx::NativeView native_view) { - SetWindowPos(native_view, 0, 0, 0, 0, +void WidgetWin::MoveAbove(Widget* other) { + SetWindowPos(other->GetNativeView(), 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); } @@ -742,8 +740,6 @@ void WidgetWin::OnKillFocus(HWND focused_window) { LRESULT WidgetWin::OnMouseActivate(UINT message, WPARAM w_param, LPARAM l_param) { - if (GetWindowLong(GWL_EXSTYLE) & WS_EX_NOACTIVATE) - return MA_NOACTIVATE; SetMsgHandled(FALSE); return MA_ACTIVATE; } diff --git a/views/widget/widget_win.h b/views/widget/widget_win.h index b5bc23c..41e24f9 100644 --- a/views/widget/widget_win.h +++ b/views/widget/widget_win.h @@ -212,7 +212,7 @@ class WidgetWin : public ui::WindowImpl, virtual gfx::Rect GetWindowScreenBounds() const OVERRIDE; virtual gfx::Rect GetClientAreaScreenBounds() const OVERRIDE; virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; - virtual void MoveAbove(gfx::NativeView native_view) OVERRIDE; + virtual void MoveAbove(Widget* widget) OVERRIDE; virtual void SetShape(gfx::NativeRegion shape) OVERRIDE; virtual void Close() OVERRIDE; virtual void CloseNow() OVERRIDE; |