OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "config.h" | 7 #include "config.h" |
8 | 8 |
9 #include "wtf/ASCIICType.h" | 9 #include "wtf/ASCIICType.h" |
10 #include "webkit/glue/webinputevent.h" | 10 #include "webkit/glue/webinputevent.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 if ([event modifierFlags] & NSControlKeyMask) | 82 if ([event modifierFlags] & NSControlKeyMask) |
83 modifiers |= CTRL_KEY; | 83 modifiers |= CTRL_KEY; |
84 if ([event modifierFlags] & NSShiftKeyMask) | 84 if ([event modifierFlags] & NSShiftKeyMask) |
85 modifiers |= SHIFT_KEY; | 85 modifiers |= SHIFT_KEY; |
86 if ([event modifierFlags] & NSAlternateKeyMask) | 86 if ([event modifierFlags] & NSAlternateKeyMask) |
87 modifiers |= (ALT_KEY | META_KEY); // TODO(darin): set META properly | 87 modifiers |= (ALT_KEY | META_KEY); // TODO(darin): set META properly |
88 | 88 |
89 timestamp_sec = [event timestamp]; | 89 timestamp_sec = [event timestamp]; |
90 | 90 |
91 layout_test_click_count = 0; | 91 layout_test_click_count = 0; |
92 | |
93 mac_event = event; // retains |event| | |
94 } | 92 } |
95 | 93 |
96 // WebMouseWheelEvent --------------------------------------------------------- | 94 // WebMouseWheelEvent --------------------------------------------------------- |
97 | 95 |
98 WebMouseWheelEvent::WebMouseWheelEvent(NSEvent *event, NSView* view) { | 96 WebMouseWheelEvent::WebMouseWheelEvent(NSEvent *event, NSView* view) { |
99 type = MOUSE_WHEEL; | 97 type = MOUSE_WHEEL; |
100 button = BUTTON_NONE; | 98 button = BUTTON_NONE; |
101 | 99 |
102 NSPoint location = [NSEvent mouseLocation]; // global coordinates | 100 NSPoint location = [NSEvent mouseLocation]; // global coordinates |
103 global_x = location.x; | 101 global_x = location.x; |
(...skipping 19 matching lines...) Expand all Loading... |
123 delta_x = 0; | 121 delta_x = 0; |
124 delta_y = delta_lines; | 122 delta_y = delta_lines; |
125 } | 123 } |
126 | 124 |
127 if ([event modifierFlags] & NSControlKeyMask) | 125 if ([event modifierFlags] & NSControlKeyMask) |
128 modifiers |= CTRL_KEY; | 126 modifiers |= CTRL_KEY; |
129 if ([event modifierFlags] & NSShiftKeyMask) | 127 if ([event modifierFlags] & NSShiftKeyMask) |
130 modifiers |= SHIFT_KEY; | 128 modifiers |= SHIFT_KEY; |
131 if ([event modifierFlags] & NSAlternateKeyMask) | 129 if ([event modifierFlags] & NSAlternateKeyMask) |
132 modifiers |= ALT_KEY; | 130 modifiers |= ALT_KEY; |
133 | |
134 mac_event = event; // retains |event| | |
135 } | 131 } |
136 | 132 |
137 // WebKeyboardEvent ----------------------------------------------------------- | 133 // WebKeyboardEvent ----------------------------------------------------------- |
138 | 134 |
139 // ---------------------------------------------------------------------- | 135 // ---------------------------------------------------------------------- |
140 // Begin Apple code, copied from KeyEventMac.mm | 136 // Begin Apple code, copied from KeyEventMac.mm |
141 // | 137 // |
142 // We can share some of this code if we factored it out of KeyEventMac, but | 138 // We can share some of this code if we factored it out of KeyEventMac, but |
143 // the main problem is that it relies on the NSString ctor on String for | 139 // the main problem is that it relies on the NSString ctor on String for |
144 // conversions, and since we're building without PLATFORM(MAC), we don't have | 140 // conversions, and since we're building without PLATFORM(MAC), we don't have |
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
957 modifiers |= IS_AUTO_REPEAT; | 953 modifiers |= IS_AUTO_REPEAT; |
958 | 954 |
959 NSString* textString = WebCore::textFromEvent(event); | 955 NSString* textString = WebCore::textFromEvent(event); |
960 NSString* unmodifiedStr = WebCore::unmodifiedTextFromEvent(event); | 956 NSString* unmodifiedStr = WebCore::unmodifiedTextFromEvent(event); |
961 NSString* identStr = WebCore::keyIdentifierForKeyEvent(event); | 957 NSString* identStr = WebCore::keyIdentifierForKeyEvent(event); |
962 FillVectorFromNSString(&text, textString); | 958 FillVectorFromNSString(&text, textString); |
963 FillVectorFromNSString(&unmodified_text, unmodifiedStr); | 959 FillVectorFromNSString(&unmodified_text, unmodifiedStr); |
964 FillVectorFromNSString(&key_identifier, identStr); | 960 FillVectorFromNSString(&key_identifier, identStr); |
965 | 961 |
966 key_code = WebCore::windowsKeyCodeForKeyEvent(event); | 962 key_code = WebCore::windowsKeyCodeForKeyEvent(event); |
967 | |
968 mac_event = event; // retains |event| | |
969 } | 963 } |
OLD | NEW |