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

Side by Side Diff: chrome/views/window.cc

Issue 43052: Fix black titlebar rendering when toggling DWM when the window is maximized:... (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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 unified diff | Download patch
« no previous file with comments | « chrome/views/window.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/window.h" 5 #include "chrome/views/window.h"
6 6
7 #include <shellapi.h> 7 #include <shellapi.h>
8 8
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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 owning_hwnd_(NULL), 318 owning_hwnd_(NULL),
319 minimum_size_(100, 100), 319 minimum_size_(100, 100),
320 is_modal_(false), 320 is_modal_(false),
321 restored_enabled_(false), 321 restored_enabled_(false),
322 is_always_on_top_(false), 322 is_always_on_top_(false),
323 window_closed_(false), 323 window_closed_(false),
324 disable_inactive_rendering_(false), 324 disable_inactive_rendering_(false),
325 is_active_(false), 325 is_active_(false),
326 lock_updates_(false), 326 lock_updates_(false),
327 saved_window_style_(0), 327 saved_window_style_(0),
328 saved_maximized_state_(0) { 328 saved_maximized_state_(0),
329 force_hidden_(false) {
329 InitClass(); 330 InitClass();
330 DCHECK(window_delegate_); 331 DCHECK(window_delegate_);
331 window_delegate_->window_.reset(this); 332 window_delegate_->window_.reset(this);
332 // Initialize these values to 0 so that subclasses can override the default 333 // Initialize these values to 0 so that subclasses can override the default
333 // behavior before calling Init. 334 // behavior before calling Init.
334 set_window_style(0); 335 set_window_style(0);
335 set_window_ex_style(0); 336 set_window_ex_style(0);
336 } 337 }
337 338
338 void Window::Init(HWND parent, const gfx::Rect& bounds) { 339 void Window::Init(HWND parent, const gfx::Rect& bounds) {
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 bounds.top - clip_state->y, 644 bounds.top - clip_state->y,
644 bounds.right - clip_state->x, 645 bounds.right - clip_state->x,
645 bounds.bottom - clip_state->y); 646 bounds.bottom - clip_state->y);
646 } 647 }
647 return TRUE; 648 return TRUE;
648 } 649 }
649 } // namespace 650 } // namespace
650 651
651 void Window::OnNCPaint(HRGN rgn) { 652 void Window::OnNCPaint(HRGN rgn) {
652 // We only do non-client painting if we're not using the native frame. 653 // We only do non-client painting if we're not using the native frame.
653 if (non_client_view_->UseNativeFrame()) 654 if (non_client_view_->UseNativeFrame()) {
654 return WidgetWin::OnNCPaint(rgn); 655 WidgetWin::OnNCPaint(rgn);
656 return;
657 }
655 658
656 // We have an NC region and need to paint it. We expand the NC region to 659 // We have an NC region and need to paint it. We expand the NC region to
657 // include the dirty region of the root view. This is done to minimize 660 // include the dirty region of the root view. This is done to minimize
658 // paints. 661 // paints.
659 CRect window_rect; 662 CRect window_rect;
660 GetWindowRect(&window_rect); 663 GetWindowRect(&window_rect);
661 664
662 if (window_rect.Width() != root_view_->width() || 665 if (window_rect.Width() != root_view_->width() ||
663 window_rect.Height() != root_view_->height()) { 666 window_rect.Height() != root_view_->height()) {
664 // If the size of the window differs from the size of the root view it 667 // If the size of the window differs from the size of the root view it
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 } else if ((notification_code == SC_KEYMENU) && (click.x == VK_SPACE)) { 913 } else if ((notification_code == SC_KEYMENU) && (click.x == VK_SPACE)) {
911 // Run the system menu at the NonClientView's desired location. 914 // Run the system menu at the NonClientView's desired location.
912 RunSystemMenu(non_client_view_->GetSystemMenuPoint()); 915 RunSystemMenu(non_client_view_->GetSystemMenuPoint());
913 } else { 916 } else {
914 // Use the default implementation for any other command. 917 // Use the default implementation for any other command.
915 DefWindowProc(GetHWND(), WM_SYSCOMMAND, notification_code, 918 DefWindowProc(GetHWND(), WM_SYSCOMMAND, notification_code,
916 MAKELPARAM(click.y, click.x)); 919 MAKELPARAM(click.y, click.x));
917 } 920 }
918 } 921 }
919 922
923 void Window::OnWindowPosChanging(WINDOWPOS* window_pos) {
924 if (force_hidden_) {
925 // Prevent the window from being made visible if we've been asked to do so.
926 // See comment in header as to why we might want this.
927 window_pos->flags &= ~SWP_SHOWWINDOW;
928 }
929 WidgetWin::OnWindowPosChanging(window_pos);
930 }
931
920 //////////////////////////////////////////////////////////////////////////////// 932 ////////////////////////////////////////////////////////////////////////////////
921 // Window, private: 933 // Window, private:
922 934
923 void Window::BecomeModal() { 935 void Window::BecomeModal() {
924 // We implement modality by crawling up the hierarchy of windows starting 936 // We implement modality by crawling up the hierarchy of windows starting
925 // at the owner, disabling all of them so that they don't receive input 937 // at the owner, disabling all of them so that they don't receive input
926 // messages. 938 // messages.
927 DCHECK(owning_hwnd_) << "Can't create a modal dialog without an owner"; 939 DCHECK(owning_hwnd_) << "Can't create a modal dialog without an owner";
928 HWND start = owning_hwnd_; 940 HWND start = owning_hwnd_;
929 while (start != NULL) { 941 while (start != NULL) {
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 resize_cursors_[RC_NORMAL] = LoadCursor(NULL, IDC_ARROW); 1184 resize_cursors_[RC_NORMAL] = LoadCursor(NULL, IDC_ARROW);
1173 resize_cursors_[RC_VERTICAL] = LoadCursor(NULL, IDC_SIZENS); 1185 resize_cursors_[RC_VERTICAL] = LoadCursor(NULL, IDC_SIZENS);
1174 resize_cursors_[RC_HORIZONTAL] = LoadCursor(NULL, IDC_SIZEWE); 1186 resize_cursors_[RC_HORIZONTAL] = LoadCursor(NULL, IDC_SIZEWE);
1175 resize_cursors_[RC_NESW] = LoadCursor(NULL, IDC_SIZENESW); 1187 resize_cursors_[RC_NESW] = LoadCursor(NULL, IDC_SIZENESW);
1176 resize_cursors_[RC_NWSE] = LoadCursor(NULL, IDC_SIZENWSE); 1188 resize_cursors_[RC_NWSE] = LoadCursor(NULL, IDC_SIZENWSE);
1177 initialized = true; 1189 initialized = true;
1178 } 1190 }
1179 } 1191 }
1180 1192
1181 } // namespace views 1193 } // namespace views
OLDNEW
« no previous file with comments | « chrome/views/window.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698