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

Side by Side Diff: ui/base/win/events_win.cc

Issue 16336027: Enable high dpi in win/views. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase Created 7 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
« no previous file with comments | « ui/base/win/dpi.cc ('k') | ui/gfx/canvas_paint_win.h » ('j') | 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 <windowsx.h> 5 #include <windowsx.h>
6 6
7 #include "ui/base/events/event_constants.h" 7 #include "ui/base/events/event_constants.h"
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/time.h" 10 #include "base/time.h"
11 #include "base/win/win_util.h" 11 #include "base/win/win_util.h"
12 #include "ui/base/events/event_utils.h" 12 #include "ui/base/events/event_utils.h"
13 #include "ui/base/keycodes/keyboard_code_conversion_win.h" 13 #include "ui/base/keycodes/keyboard_code_conversion_win.h"
14 #include "ui/base/win/dpi.h"
14 #include "ui/gfx/point.h" 15 #include "ui/gfx/point.h"
15 16
16 namespace ui { 17 namespace ui {
17 18
18 namespace { 19 namespace {
19 20
20 // From MSDN: "Mouse" events are flagged with 0xFF515700 if they come 21 // From MSDN: "Mouse" events are flagged with 0xFF515700 if they come
21 // from a touch or stylus device. In Vista or later, they are also flagged 22 // from a touch or stylus device. In Vista or later, they are also flagged
22 // with 0x80 if they come from touch. 23 // with 0x80 if they come from touch.
23 #define MOUSEEVENTF_FROMTOUCH (0xFF515700 | 0x80) 24 #define MOUSEEVENTF_FROMTOUCH (0xFF515700 | 0x80)
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // Client message. The position is contained in the LPARAM. 205 // Client message. The position is contained in the LPARAM.
205 if (IsClientMouseEvent(native_event) && !IsMouseWheelEvent(native_event)) 206 if (IsClientMouseEvent(native_event) && !IsMouseWheelEvent(native_event))
206 return gfx::Point(native_event.lParam); 207 return gfx::Point(native_event.lParam);
207 DCHECK(IsNonClientMouseEvent(native_event) || 208 DCHECK(IsNonClientMouseEvent(native_event) ||
208 IsMouseWheelEvent(native_event)); 209 IsMouseWheelEvent(native_event));
209 // Non-client message. The position is contained in a POINTS structure in 210 // Non-client message. The position is contained in a POINTS structure in
210 // LPARAM, and is in screen coordinates so we have to convert to client. 211 // LPARAM, and is in screen coordinates so we have to convert to client.
211 POINT native_point = { GET_X_LPARAM(native_event.lParam), 212 POINT native_point = { GET_X_LPARAM(native_event.lParam),
212 GET_Y_LPARAM(native_event.lParam) }; 213 GET_Y_LPARAM(native_event.lParam) };
213 ScreenToClient(native_event.hwnd, &native_point); 214 ScreenToClient(native_event.hwnd, &native_point);
214 return gfx::Point(native_point); 215 gfx::Point location(native_point);
216 location = ui::win::ScreenToDIPPoint(location);
217 return location;
215 } 218 }
216 219
217 gfx::Point EventSystemLocationFromNative( 220 gfx::Point EventSystemLocationFromNative(
218 const base::NativeEvent& native_event) { 221 const base::NativeEvent& native_event) {
219 // TODO(ben): Needs to always return screen position here. Returning normal 222 // TODO(ben): Needs to always return screen position here. Returning normal
220 // origin for now since that's obviously wrong. 223 // origin for now since that's obviously wrong.
221 return gfx::Point(0, 0); 224 return gfx::Point(0, 0);
222 } 225 }
223 226
224 KeyboardCode KeyboardCodeFromNative(const base::NativeEvent& native_event) { 227 KeyboardCode KeyboardCodeFromNative(const base::NativeEvent& native_event) {
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 } 357 }
355 358
356 // Windows emulates mouse messages for touch events. 359 // Windows emulates mouse messages for touch events.
357 bool IsMouseEventFromTouch(UINT message) { 360 bool IsMouseEventFromTouch(UINT message) {
358 return (message >= WM_MOUSEFIRST) && (message <= WM_MOUSELAST) && 361 return (message >= WM_MOUSEFIRST) && (message <= WM_MOUSELAST) &&
359 (GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) == 362 (GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) ==
360 MOUSEEVENTF_FROMTOUCH; 363 MOUSEEVENTF_FROMTOUCH;
361 } 364 }
362 365
363 } // namespace ui 366 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/win/dpi.cc ('k') | ui/gfx/canvas_paint_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698