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

Side by Side Diff: ui/views/win/hwnd_message_handler.cc

Issue 300163002: Update window region after widget resizes not changing HWND size (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits Created 6 years, 7 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 | « ui/views/win/hwnd_message_handler.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/views/win/hwnd_message_handler.h" 5 #include "ui/views/win/hwnd_message_handler.h"
6 6
7 #include <dwmapi.h> 7 #include <dwmapi.h>
8 #include <oleacc.h> 8 #include <oleacc.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #include <wtsapi32.h> 10 #include <wtsapi32.h>
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 if (show_state) { 518 if (show_state) {
519 if (wp.showCmd == SW_SHOWMAXIMIZED) 519 if (wp.showCmd == SW_SHOWMAXIMIZED)
520 *show_state = ui::SHOW_STATE_MAXIMIZED; 520 *show_state = ui::SHOW_STATE_MAXIMIZED;
521 else if (wp.showCmd == SW_SHOWMINIMIZED) 521 else if (wp.showCmd == SW_SHOWMINIMIZED)
522 *show_state = ui::SHOW_STATE_MINIMIZED; 522 *show_state = ui::SHOW_STATE_MINIMIZED;
523 else 523 else
524 *show_state = ui::SHOW_STATE_NORMAL; 524 *show_state = ui::SHOW_STATE_NORMAL;
525 } 525 }
526 } 526 }
527 527
528 void HWNDMessageHandler::SetBounds(const gfx::Rect& bounds_in_pixels) { 528 void HWNDMessageHandler::SetBounds(const gfx::Rect& bounds_in_pixels,
529 bool force_size_changed) {
529 LONG style = GetWindowLong(hwnd(), GWL_STYLE); 530 LONG style = GetWindowLong(hwnd(), GWL_STYLE);
530 if (style & WS_MAXIMIZE) 531 if (style & WS_MAXIMIZE)
531 SetWindowLong(hwnd(), GWL_STYLE, style & ~WS_MAXIMIZE); 532 SetWindowLong(hwnd(), GWL_STYLE, style & ~WS_MAXIMIZE);
533
534 gfx::Size old_size = GetClientAreaBounds().size();
532 SetWindowPos(hwnd(), NULL, bounds_in_pixels.x(), bounds_in_pixels.y(), 535 SetWindowPos(hwnd(), NULL, bounds_in_pixels.x(), bounds_in_pixels.y(),
533 bounds_in_pixels.width(), bounds_in_pixels.height(), 536 bounds_in_pixels.width(), bounds_in_pixels.height(),
534 SWP_NOACTIVATE | SWP_NOZORDER); 537 SWP_NOACTIVATE | SWP_NOZORDER);
538
539 // If HWND size is not changed, we will not receive standard size change
540 // notifications. If |force_size_changed| is |true|, we should pretend size is
541 // changed.
542 if (old_size == bounds_in_pixels.size() && force_size_changed) {
543 delegate_->HandleClientSizeChanged(GetClientAreaBounds().size());
544 ResetWindowRegion(false, true);
545 }
535 } 546 }
536 547
537 void HWNDMessageHandler::SetSize(const gfx::Size& size) { 548 void HWNDMessageHandler::SetSize(const gfx::Size& size) {
538 SetWindowPos(hwnd(), NULL, 0, 0, size.width(), size.height(), 549 SetWindowPos(hwnd(), NULL, 0, 0, size.width(), size.height(),
539 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE); 550 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE);
540 } 551 }
541 552
542 void HWNDMessageHandler::CenterWindow(const gfx::Size& size) { 553 void HWNDMessageHandler::CenterWindow(const gfx::Size& size) {
543 HWND parent = GetParent(hwnd()); 554 HWND parent = GetParent(hwnd());
544 if (!IsWindow(hwnd())) 555 if (!IsWindow(hwnd()))
(...skipping 1865 matching lines...) Expand 10 before | Expand all | Expand 10 after
2410 POINT cursor_pos = {0}; 2421 POINT cursor_pos = {0};
2411 ::GetCursorPos(&cursor_pos); 2422 ::GetCursorPos(&cursor_pos);
2412 if (memcmp(&cursor_pos, &mouse_location, sizeof(POINT))) 2423 if (memcmp(&cursor_pos, &mouse_location, sizeof(POINT)))
2413 return false; 2424 return false;
2414 return true; 2425 return true;
2415 } 2426 }
2416 return false; 2427 return false;
2417 } 2428 }
2418 2429
2419 } // namespace views 2430 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/win/hwnd_message_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698