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

Side by Side Diff: chrome/browser/ui/views/frame/minimize_button_metrics_win.cc

Issue 254583004: Fix incorrect bitmask check. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 "chrome/browser/ui/views/frame/minimize_button_metrics_win.h" 5 #include "chrome/browser/ui/views/frame/minimize_button_metrics_win.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/i18n/rtl.h" 8 #include "base/i18n/rtl.h"
9 #include "ui/base/win/shell.h" 9 #include "ui/base/win/shell.h"
10 #include "ui/gfx/win/dpi.h" 10 #include "ui/gfx/win/dpi.h"
11 11
12 namespace { 12 namespace {
13 13
14 int GetMinimizeButtonOffsetForWindow(HWND hwnd) { 14 int GetMinimizeButtonOffsetForWindow(HWND hwnd) {
15 // The WM_GETTITLEBARINFOEX message can fail if we are not active/visible. By 15 // The WM_GETTITLEBARINFOEX message can fail if we are not active/visible. By
16 // fail we get a location of 0; the return status code is always the same and 16 // fail we get a location of 0; the return status code is always the same and
17 // similarly the state never seems to change (titlebar_info.rgstate). 17 // similarly the state never seems to change (titlebar_info.rgstate).
18 TITLEBARINFOEX titlebar_info = {0}; 18 TITLEBARINFOEX titlebar_info = {0};
19 titlebar_info.cbSize = sizeof(TITLEBARINFOEX); 19 titlebar_info.cbSize = sizeof(TITLEBARINFOEX);
20 SendMessage(hwnd, WM_GETTITLEBARINFOEX, 0, 20 SendMessage(hwnd, WM_GETTITLEBARINFOEX, 0,
21 reinterpret_cast<WPARAM>(&titlebar_info)); 21 reinterpret_cast<WPARAM>(&titlebar_info));
22 22
23 if (titlebar_info.rgrect[2].left == titlebar_info.rgrect[2].right || 23 if (titlebar_info.rgrect[2].left == titlebar_info.rgrect[2].right ||
24 (titlebar_info.rgstate[2] & (STATE_SYSTEM_INVISIBLE || 24 (titlebar_info.rgstate[2] & (STATE_SYSTEM_INVISIBLE |
25 STATE_SYSTEM_OFFSCREEN || 25 STATE_SYSTEM_OFFSCREEN |
26 STATE_SYSTEM_UNAVAILABLE))) { 26 STATE_SYSTEM_UNAVAILABLE))) {
27 return 0; 27 return 0;
28 } 28 }
29 29
30 // Most versions of Windows return screen coordinates for 30 // Most versions of Windows return screen coordinates for
31 // WM_GETTITLEBARINFOEX. Since chrome is not dpi aware (currently) we need to 31 // WM_GETTITLEBARINFOEX. Since chrome is not dpi aware (currently) we need to
32 // unscale these coordinates. Surface Pro seems to be unique, in that it 32 // unscale these coordinates. Surface Pro seems to be unique, in that it
33 // returns local coordinates (eg they don't need to be scaled). There doesn't 33 // returns local coordinates (eg they don't need to be scaled). There doesn't
34 // appear to be a clear way to detect this, so we assume that if the minimize 34 // appear to be a clear way to detect this, so we assume that if the minimize
35 // button is outside the bounds of the window coordinates are scaled. 35 // button is outside the bounds of the window coordinates are scaled.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 cached_minimize_button_x_delta_ = minimize_button_offset; 105 cached_minimize_button_x_delta_ = minimize_button_offset;
106 } else { 106 } else {
107 RECT client_rect = {0}; 107 RECT client_rect = {0};
108 GetClientRect(hwnd_, &client_rect); 108 GetClientRect(hwnd_, &client_rect);
109 cached_minimize_button_x_delta_ = 109 cached_minimize_button_x_delta_ =
110 client_rect.right - minimize_button_offset; 110 client_rect.right - minimize_button_offset;
111 } 111 }
112 last_cached_minimize_button_x_delta_ = cached_minimize_button_x_delta_; 112 last_cached_minimize_button_x_delta_ = cached_minimize_button_x_delta_;
113 return minimize_button_offset; 113 return minimize_button_offset;
114 } 114 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698