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

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: Pass size change status as an argument to SetBounds() Created 6 years, 6 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
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 widget_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 // If HWND size is not changed, but the actual size of widget is changed,
539 // we'll not receive standard size change notifications; so, we should update
540 // manually.
541 if (old_size == bounds_in_pixels.size() && widget_size_changed) {
542 delegate_->HandleClientSizeChanged(GetClientAreaBounds().size());
543 ResetWindowRegion(false, true);
544 }
535 } 545 }
536 546
537 void HWNDMessageHandler::SetSize(const gfx::Size& size) { 547 void HWNDMessageHandler::SetSize(const gfx::Size& size) {
538 SetWindowPos(hwnd(), NULL, 0, 0, size.width(), size.height(), 548 SetWindowPos(hwnd(), NULL, 0, 0, size.width(), size.height(),
539 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE); 549 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE);
540 } 550 }
541 551
542 void HWNDMessageHandler::CenterWindow(const gfx::Size& size) { 552 void HWNDMessageHandler::CenterWindow(const gfx::Size& size) {
543 HWND parent = GetParent(hwnd()); 553 HWND parent = GetParent(hwnd());
544 if (!IsWindow(hwnd())) 554 if (!IsWindow(hwnd()))
(...skipping 1865 matching lines...) Expand 10 before | Expand all | Expand 10 after
2410 POINT cursor_pos = {0}; 2420 POINT cursor_pos = {0};
2411 ::GetCursorPos(&cursor_pos); 2421 ::GetCursorPos(&cursor_pos);
2412 if (memcmp(&cursor_pos, &mouse_location, sizeof(POINT))) 2422 if (memcmp(&cursor_pos, &mouse_location, sizeof(POINT)))
2413 return false; 2423 return false;
2414 return true; 2424 return true;
2415 } 2425 }
2416 return false; 2426 return false;
2417 } 2427 }
2418 2428
2419 } // namespace views 2429 } // namespace views
OLDNEW
« ui/views/win/hwnd_message_handler.h ('K') | « 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