OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/views/widget_win.h" | 5 #include "chrome/views/widget_win.h" |
6 | 6 |
7 #include "base/gfx/native_theme.h" | 7 #include "base/gfx/native_theme.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/win_util.h" | 9 #include "base/win_util.h" |
10 #include "chrome/app/chrome_dll_resource.h" | 10 #include "chrome/app/chrome_dll_resource.h" |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 ::ClientToScreen(hwnd_, &p); | 234 ::ClientToScreen(hwnd_, &p); |
235 out->SetRect(crect.left + p.x, crect.top + p.y, | 235 out->SetRect(crect.left + p.x, crect.top + p.y, |
236 crect.Width(), crect.Height()); | 236 crect.Width(), crect.Height()); |
237 } | 237 } |
238 | 238 |
239 void WidgetWin::MoveToFront(bool should_activate) { | 239 void WidgetWin::MoveToFront(bool should_activate) { |
240 int flags = SWP_NOMOVE | SWP_NOSIZE; | 240 int flags = SWP_NOMOVE | SWP_NOSIZE; |
241 if (!should_activate) { | 241 if (!should_activate) { |
242 flags |= SWP_NOACTIVATE; | 242 flags |= SWP_NOACTIVATE; |
243 } | 243 } |
244 SetWindowPos(HWND_NOTOPMOST, 0, 0, 0, 0, flags); | 244 |
| 245 // Check if the window is topmost. |
| 246 WINDOWINFO wi; |
| 247 wi.cbSize = sizeof(WINDOWINFO); |
| 248 GetWindowInfo(GetHWND(), &wi); |
| 249 if ((wi.dwExStyle & WS_EX_TOPMOST) > 0) |
| 250 SetWindowPos(HWND_TOPMOST, 0, 0, 0, 0, flags); |
| 251 else |
| 252 SetWindowPos(HWND_NOTOPMOST, 0, 0, 0, 0, flags); |
245 } | 253 } |
246 | 254 |
247 HWND WidgetWin::GetHWND() const { | 255 HWND WidgetWin::GetHWND() const { |
248 return hwnd_; | 256 return hwnd_; |
249 } | 257 } |
250 | 258 |
251 void WidgetWin::PaintNow(const gfx::Rect& update_rect) { | 259 void WidgetWin::PaintNow(const gfx::Rect& update_rect) { |
252 if (use_layered_buffer_) { | 260 if (use_layered_buffer_) { |
253 PaintLayeredWindow(); | 261 PaintLayeredWindow(); |
254 } else if (root_view_->NeedsPainting(false) && IsWindow()) { | 262 } else if (root_view_->NeedsPainting(false) && IsWindow()) { |
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
954 if (message == WM_NCDESTROY) { | 962 if (message == WM_NCDESTROY) { |
955 TRACK_HWND_DESTRUCTION(window); | 963 TRACK_HWND_DESTRUCTION(window); |
956 widget->hwnd_ = NULL; | 964 widget->hwnd_ = NULL; |
957 widget->OnFinalMessage(window); | 965 widget->OnFinalMessage(window); |
958 } | 966 } |
959 return result; | 967 return result; |
960 } | 968 } |
961 | 969 |
962 } // namespace views | 970 } // namespace views |
963 | 971 |
OLD | NEW |