OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2006-2009 Google Inc. | 3 * Copyright (C) 2006-2009 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
715 if ([event modifierFlags] & NSControlKeyMask) | 715 if ([event modifierFlags] & NSControlKeyMask) |
716 modifiers |= WebInputEvent::ControlKey; | 716 modifiers |= WebInputEvent::ControlKey; |
717 if ([event modifierFlags] & NSShiftKeyMask) | 717 if ([event modifierFlags] & NSShiftKeyMask) |
718 modifiers |= WebInputEvent::ShiftKey; | 718 modifiers |= WebInputEvent::ShiftKey; |
719 if ([event modifierFlags] & NSAlternateKeyMask) | 719 if ([event modifierFlags] & NSAlternateKeyMask) |
720 modifiers |= WebInputEvent::AltKey; | 720 modifiers |= WebInputEvent::AltKey; |
721 if ([event modifierFlags] & NSCommandKeyMask) | 721 if ([event modifierFlags] & NSCommandKeyMask) |
722 modifiers |= WebInputEvent::MetaKey; | 722 modifiers |= WebInputEvent::MetaKey; |
723 if ([event modifierFlags] & NSAlphaShiftKeyMask) | 723 if ([event modifierFlags] & NSAlphaShiftKeyMask) |
724 modifiers |= WebInputEvent::CapsLockOn; | 724 modifiers |= WebInputEvent::CapsLockOn; |
725 // TODO(port): Set mouse button states | 725 if ([NSEvent pressedMouseButtons] & 1 << 0) |
haraken
2014/12/11 16:24:13
Don't we want to have a constant variable for 1 <<
zino
2014/12/11 17:01:28
Done.
IMHO, it is better to use constant values h
| |
726 modifiers |= WebInputEvent::LeftButtonDown; | |
727 if ([NSEvent pressedMouseButtons] & 1 << 1) | |
728 modifiers |= WebInputEvent::RightButtonDown; | |
729 if ([NSEvent pressedMouseButtons] & 1 << 2) | |
730 modifiers |= WebInputEvent::MiddleButtonDown; | |
726 | 731 |
727 return modifiers; | 732 return modifiers; |
728 } | 733 } |
729 | 734 |
730 static inline void setWebEventLocationFromEventInView(WebMouseEvent* result, | 735 static inline void setWebEventLocationFromEventInView(WebMouseEvent* result, |
731 NSEvent* event, | 736 NSEvent* event, |
732 NSView* view) { | 737 NSView* view) { |
733 NSPoint windowLocal = [event locationInWindow]; | 738 NSPoint windowLocal = [event locationInWindow]; |
734 | 739 |
735 NSPoint screenLocal = [[view window] convertBaseToScreen:windowLocal]; | 740 NSPoint screenLocal = [[view window] convertBaseToScreen:windowLocal]; |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1140 break; | 1145 break; |
1141 default: | 1146 default: |
1142 ASSERT_NOT_REACHED(); | 1147 ASSERT_NOT_REACHED(); |
1143 result.type = WebInputEvent::Undefined; | 1148 result.type = WebInputEvent::Undefined; |
1144 } | 1149 } |
1145 | 1150 |
1146 return result; | 1151 return result; |
1147 } | 1152 } |
1148 | 1153 |
1149 } // namespace blink | 1154 } // namespace blink |
OLD | NEW |