Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ int getOperationFromKeyState() {
if (currEvent != null) {
long modifiers = currEvent.modifierFlags();
boolean option = (modifiers & OS.NSAlternateKeyMask) == OS.NSAlternateKeyMask;
boolean control = (modifiers & OS.NSControlKeyMask) == OS.NSControlKeyMask;
boolean control = (modifiers & OS.NSEventModifierFlagControl) == OS.NSEventModifierFlagControl;
if (control && option) return DND.DROP_DEFAULT;
if (control) return DND.DROP_LINK;
if (option) return DND.DROP_COPY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1198,6 +1198,9 @@
<enum name='NSAlertFirstButtonReturn' value='1000'/>
<enum name='NSAlertOtherReturn' value='-1'/>
<enum name='NSAlertSecondButtonReturn' value='1001'/>
<enum name='NSAlertStyleCritical' value='2'/>
<enum name='NSAlertStyleInformational' value='1'/>
<enum name='NSAlertStyleWarning' value='0'/>
<enum name='NSAlertThirdButtonReturn' value='1002'/>
<enum name='NSAllScrollerParts' value='2'/>
<enum name='NSAlphaFirstBitmapFormat' value='1'/>
Expand Down Expand Up @@ -1421,7 +1424,6 @@
<enum name='NSColorRenderingIntentRelativeColorimetric' value='2'/>
<enum name='NSColorRenderingIntentSaturation' value='4'/>
<enum name='NSColorSpaceModelRGB' value='1'/>
<enum name='NSCommandKeyMask' value='1048576'/>
<enum name='NSCompositeClear' value='0'/>
<enum name='NSCompositeColor' value='27'/>
<enum name='NSCompositeColorBurn' value='20'/>
Expand Down Expand Up @@ -1466,7 +1468,6 @@
<enum name='NSControlCharacterActionWhitespace' value='2'/>
<enum name='NSControlCharacterActionZeroAdvancement' value='1'/>
<enum name='NSControlGlyph' value='16777215'/>
<enum name='NSControlKeyMask' value='262144'/>
<enum name='NSCorrectionIndicatorTypeDefault' value='0'/>
<enum name='NSCorrectionIndicatorTypeGuesses' value='2'/>
<enum name='NSCorrectionIndicatorTypeReversion' value='1'/>
Expand All @@ -1477,7 +1478,6 @@
<enum name='NSCorrectionResponseRejected' value='2'/>
<enum name='NSCorrectionResponseReverted' value='5'/>
<enum name='NSCrayonModeColorPanel' value='7'/>
<enum name='NSCriticalAlertStyle' value='2'/>
<enum name='NSCriticalRequest' value='0'/>
<enum name='NSCursorPointingDevice' value='2'/>
<enum name='NSCursorUpdate' value='17'/>
Expand Down Expand Up @@ -1545,6 +1545,10 @@
<enum name='NSEventMaskRotate' value='262144'/>
<enum name='NSEventMaskSmartMagnify' value64='4294967296'/>
<enum name='NSEventMaskSwipe' value='2147483648'/>
<enum name='NSEventModifierFlagCommand' value='1048576'/>
<enum name='NSEventModifierFlagControl' value='262144'/>
<enum name='NSEventModifierFlagHelp' value='4194304'/>
<enum name='NSEventModifierFlagShift' value='131072'/>
<enum name='NSEventPhaseBegan' value='1'/>
<enum name='NSEventPhaseCancelled' value='16'/>
<enum name='NSEventPhaseChanged' value='4'/>
Expand Down Expand Up @@ -1726,7 +1730,6 @@
<enum name='NSHeavierFontAction' value='5'/>
<enum name='NSHelpButtonBezelStyle' value='9'/>
<enum name='NSHelpFunctionKey' value='63302'/>
<enum name='NSHelpKeyMask' value='4194304'/>
<enum name='NSHighlightModeMatrix' value='1'/>
<enum name='NSHomeFunctionKey' value='63273'/>
<enum name='NSHorizontalRuler' value='0'/>
Expand Down Expand Up @@ -1783,7 +1786,6 @@
<enum name='NSImageScaleProportionallyDown' value='0'/>
<enum name='NSImageScaleProportionallyUpOrDown' value='3'/>
<enum name='NSIndexedColorSpaceModel' value='5'/>
<enum name='NSInformationalAlertStyle' value='1'/>
<enum name='NSInformationalRequest' value='10'/>
<enum name='NSInlineBezelStyle' value='15'/>
<enum name='NSInsertCharFunctionKey' value='63293'/>
Expand Down Expand Up @@ -2207,7 +2209,6 @@
<enum name='NSSharingServiceErrorMaximum' value='67327'/>
<enum name='NSSharingServiceErrorMinimum' value='67072'/>
<enum name='NSSharingServiceNotConfiguredError' value='67072'/>
<enum name='NSShiftKeyMask' value='131072'/>
<enum name='NSShowControlGlyphs' value='1'/>
<enum name='NSShowInvisibleGlyphs' value='2'/>
<enum name='NSSingleDateMode' value='0'/>
Expand Down Expand Up @@ -2522,7 +2523,6 @@
<enum name='NSVisualEffectStateFollowsWindowActiveState' value='0'/>
<enum name='NSVisualEffectStateInactive' value='2'/>
<enum name='NSWantsBidiLevels' value='4'/>
<enum name='NSWarningAlertStyle' value='0'/>
<enum name='NSWheelModeColorPanel' value='6'/>
<enum name='NSWindowAbove' value='1'/>
<enum name='NSWindowAnimationBehaviorAlertPanel' value='5'/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4373,6 +4373,9 @@
<constant name="NSWindowWillCloseNotification" swt_gen="true"></constant>
<enum name="NSAlertFirstButtonReturn" swt_gen="true"></enum>
<enum name="NSAlertSecondButtonReturn" swt_gen="true"></enum>
<enum name="NSAlertStyleCritical" swt_gen="true"></enum>
<enum name="NSAlertStyleInformational" swt_gen="true"></enum>
<enum name="NSAlertStyleWarning" swt_gen="true"></enum>
<enum name="NSAlertThirdButtonReturn" swt_gen="true"></enum>
<enum name="NSAlphaFirstBitmapFormat" swt_gen="true"></enum>
<enum name="NSAlphaNonpremultipliedBitmapFormat" swt_gen="true"></enum>
Expand Down Expand Up @@ -4405,20 +4408,17 @@
<enum name="NSCarriageReturnCharacter" swt_gen="true"></enum>
<enum name="NSClosePathBezierPathElement" swt_gen="true"></enum>
<enum name="NSColorSpaceModelRGB" swt_gen="true"></enum>
<enum name="NSCommandKeyMask" swt_gen="true"></enum>
<enum name="NSCompositingOperationClear" swt_gen="true"></enum>
<enum name="NSCompositingOperationCopy" swt_gen="true"></enum>
<enum name="NSCompositingOperationSourceAtop" swt_gen="true"></enum>
<enum name="NSCompositingOperationSourceOver" swt_gen="true"></enum>
<enum name="NSContentsCellMask" swt_gen="true"></enum>
<enum name="NSControlKeyMask" swt_gen="true"></enum>
<enum name="NSControlSizeMini" swt_gen="true"></enum>
<enum name="NSControlSizeRegular" swt_gen="true"></enum>
<enum name="NSControlSizeSmall" swt_gen="true"></enum>
<enum name="NSControlStateValueMixed" swt_gen="true"></enum>
<enum name="NSControlStateValueOff" swt_gen="true"></enum>
<enum name="NSControlStateValueOn" swt_gen="true"></enum>
<enum name="NSCriticalAlertStyle" swt_gen="true"></enum>
<enum name="NSCurveToBezierPathElement" swt_gen="true"></enum>
<enum name="NSDatePickerStyleClockAndCalendar" swt_gen="true"></enum>
<enum name="NSDatePickerStyleTextField" swt_gen="true"></enum>
Expand All @@ -4433,6 +4433,10 @@
<enum name="NSDragOperationNone" swt_gen="true"></enum>
<enum name="NSEnterCharacter" swt_gen="true"></enum>
<enum name="NSEvenOddWindingRule" swt_gen="true"></enum>
<enum name="NSEventModifierFlagCommand" swt_gen="true"></enum>
<enum name="NSEventModifierFlagControl" swt_gen="true"></enum>
<enum name="NSEventModifierFlagHelp" swt_gen="true"></enum>
<enum name="NSEventModifierFlagShift" swt_gen="true"></enum>
<enum name="NSEventPhaseBegan" swt_gen="true"></enum>
<enum name="NSEventPhaseCancelled" swt_gen="true"></enum>
<enum name="NSEventPhaseEnded" swt_gen="true"></enum>
Expand All @@ -4449,7 +4453,6 @@
<enum name="NSFontPanelModeMaskAllEffects" swt_gen="true"></enum>
<enum name="NSFontPanelModeMaskAllModes" swt_gen="true"></enum>
<enum name="NSHelpFunctionKey" swt_gen="true"></enum>
<enum name="NSHelpKeyMask" swt_gen="true"></enum>
<enum name="NSHourMinuteDatePickerElementFlag" swt_gen="true"></enum>
<enum name="NSHourMinuteSecondDatePickerElementFlag" swt_gen="true"></enum>
<enum name="NSImageAbove" swt_gen="true"></enum>
Expand All @@ -4465,7 +4468,6 @@
<enum name="NSImageOnly" swt_gen="true"></enum>
<enum name="NSImageOverlaps" swt_gen="true"></enum>
<enum name="NSImageScaleNone" swt_gen="true"></enum>
<enum name="NSInformationalAlertStyle" swt_gen="true"></enum>
<enum name="NSItalicFontMask" swt_gen="true"></enum>
<enum name="NSKeyDown" swt_gen="true"></enum>
<enum name="NSKeyUp" swt_gen="true"></enum>
Expand Down Expand Up @@ -4525,7 +4527,6 @@
<enum name="NSScrollerKnobSlot" swt_gen="true"></enum>
<enum name="NSScrollerStyleLegacy" swt_gen="true"></enum>
<enum name="NSScrollerStyleOverlay" swt_gen="true"></enum>
<enum name="NSShiftKeyMask" swt_gen="true"></enum>
<enum name="NSSquareLineCapStyle" swt_gen="true"></enum>
<enum name="NSStatusWindowLevel" swt_gen="true"></enum>
<enum name="NSStringDrawingUsesLineFragmentOrigin" swt_gen="true"></enum>
Expand Down Expand Up @@ -4562,7 +4563,6 @@
<enum name="NSViewMinXMargin" swt_gen="true"></enum>
<enum name="NSViewMinYMargin" swt_gen="true"></enum>
<enum name="NSViewWidthSizable" swt_gen="true"></enum>
<enum name="NSWarningAlertStyle" swt_gen="true"></enum>
<enum name="NSWindowAbove" swt_gen="true"></enum>
<enum name="NSWindowBelow" swt_gen="true"></enum>
<enum name="NSWindowCollectionBehaviorFullScreenAuxiliary" swt_gen="true"></enum>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2144,6 +2144,9 @@ public static Selector getSelector (long value) {
/** Constants */
public static final int NSAlertFirstButtonReturn = 1000;
public static final int NSAlertSecondButtonReturn = 1001;
public static final int NSAlertStyleCritical = 2;
public static final int NSAlertStyleInformational = 1;
public static final int NSAlertStyleWarning = 0;
public static final int NSAlertThirdButtonReturn = 1002;
public static final int NSAlphaFirstBitmapFormat = 1;
public static final int NSAlphaNonpremultipliedBitmapFormat = 2;
Expand Down Expand Up @@ -2176,14 +2179,11 @@ public static Selector getSelector (long value) {
public static final int NSCarriageReturnCharacter = 13;
public static final int NSClosePathBezierPathElement = 3;
public static final int NSColorSpaceModelRGB = 1;
public static final int NSCommandKeyMask = 1048576;
public static final int NSCompositingOperationClear = 0;
public static final int NSCompositingOperationCopy = 1;
public static final int NSCompositingOperationSourceAtop = 5;
public static final int NSCompositingOperationSourceOver = 2;
public static final int NSContentsCellMask = 1;
public static final int NSControlKeyMask = 262144;
public static final int NSCriticalAlertStyle = 2;
public static final int NSCurveToBezierPathElement = 2;
public static final int NSDatePickerStyleClockAndCalendar = 1;
public static final int NSDatePickerStyleTextField = 2;
Expand All @@ -2198,6 +2198,10 @@ public static Selector getSelector (long value) {
public static final int NSDragOperationNone = 0;
public static final int NSEnterCharacter = 3;
public static final int NSEvenOddWindingRule = 1;
public static final int NSEventModifierFlagCommand = 1048576;
public static final int NSEventModifierFlagControl = 262144;
public static final int NSEventModifierFlagHelp = 4194304;
public static final int NSEventModifierFlagShift = 131072;
public static final int NSEventPhaseBegan = 1;
public static final int NSEventPhaseCancelled = 16;
public static final int NSEventPhaseEnded = 8;
Expand All @@ -2214,7 +2218,6 @@ public static Selector getSelector (long value) {
public static final int NSFontPanelModeMaskAllEffects = 1048320;
public static final int NSFontPanelModeMaskAllModes = -1;
public static final int NSHelpFunctionKey = 63302;
public static final int NSHelpKeyMask = 4194304;
public static final int NSHourMinuteDatePickerElementFlag = 12;
public static final int NSHourMinuteSecondDatePickerElementFlag = 14;
public static final int NSImageAbove = 5;
Expand All @@ -2230,7 +2233,6 @@ public static Selector getSelector (long value) {
public static final int NSImageOnly = 1;
public static final int NSImageOverlaps = 6;
public static final int NSImageScaleNone = 2;
public static final int NSInformationalAlertStyle = 1;
public static final int NSItalicFontMask = 1;
public static final int NSKeyDown = 10;
public static final int NSKeyUp = 11;
Expand Down Expand Up @@ -2296,7 +2298,6 @@ public static Selector getSelector (long value) {
public static final int NSScrollerKnobSlot = 6;
public static final int NSScrollerStyleLegacy = 0;
public static final int NSScrollerStyleOverlay = 1;
public static final int NSShiftKeyMask = 131072;
public static final int NSSquareLineCapStyle = 2;
public static final int NSStatusWindowLevel = 25;
public static final int NSStringDrawingUsesLineFragmentOrigin = 1;
Expand Down Expand Up @@ -2333,7 +2334,6 @@ public static Selector getSelector (long value) {
public static final int NSViewMinXMargin = 1;
public static final int NSViewMinYMargin = 8;
public static final int NSViewWidthSizable = 2;
public static final int NSWarningAlertStyle = 0;
public static final int NSWindowAbove = 1;
public static final int NSWindowBelow = -1;
public static final int NSWindowCollectionBehaviorFullScreenAuxiliary = 256;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1445,9 +1445,9 @@ boolean sendKeyEvent (NSEvent nsEvent, int type) {
int stateMask = 0;
long modifierFlags = nsEvent.modifierFlags();
if ((modifierFlags & OS.NSAlternateKeyMask) != 0) stateMask |= SWT.ALT;
if ((modifierFlags & OS.NSShiftKeyMask) != 0) stateMask |= SWT.SHIFT;
if ((modifierFlags & OS.NSControlKeyMask) != 0) stateMask |= SWT.CONTROL;
if ((modifierFlags & OS.NSCommandKeyMask) != 0) stateMask |= SWT.COMMAND;
if ((modifierFlags & OS.NSEventModifierFlagShift) != 0) stateMask |= SWT.SHIFT;
if ((modifierFlags & OS.NSEventModifierFlagControl) != 0) stateMask |= SWT.CONTROL;
if ((modifierFlags & OS.NSEventModifierFlagCommand) != 0) stateMask |= SWT.COMMAND;
if (type != SWT.KeyDown) return result;
short keyCode = nsEvent.keyCode ();
if (stateMask == SWT.COMMAND) {
Expand Down Expand Up @@ -1484,7 +1484,7 @@ boolean sendTrackingKeyEvent (NSEvent nsEvent, int type) {
* queue.
*/
long modifiers = nsEvent.modifierFlags();
if ((modifiers & OS.NSShiftKeyMask) == 0) {
if ((modifiers & OS.NSEventModifierFlagShift) == 0) {
short keyCode = nsEvent.keyCode ();
switch (keyCode) {
case 125: /* Arrow Down */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,7 @@ void doCommandBySelector (long id, long sel, long selector) {
* is down, because we likely triggered the current key sequence via flagsChanged.
*/
long modifiers = nsEvent.modifierFlags();
if (s.keyInputHappened == false || (modifiers & OS.NSCommandKeyMask) != 0) {
if (s.keyInputHappened == false || (modifiers & OS.NSEventModifierFlagCommand) != 0) {
s.keyInputHappened = true;
boolean [] consume = new boolean [1];
if (translateTraversal (nsEvent.keyCode (), nsEvent, consume)) return;
Expand Down Expand Up @@ -1363,9 +1363,9 @@ void flagsChanged (long id, long sel, long theEvent) {
int keyCode = Display.translateKey (nsEvent.keyCode ());
switch (keyCode) {
case SWT.ALT: mask = OS.NSAlternateKeyMask; break;
case SWT.CONTROL: mask = OS.NSControlKeyMask; break;
case SWT.COMMAND: mask = OS.NSCommandKeyMask; break;
case SWT.SHIFT: mask = OS.NSShiftKeyMask; break;
case SWT.CONTROL: mask = OS.NSEventModifierFlagControl; break;
case SWT.COMMAND: mask = OS.NSEventModifierFlagCommand; break;
case SWT.SHIFT: mask = OS.NSEventModifierFlagShift; break;
case SWT.CAPS_LOCK:
Event event = new Event();
event.keyCode = keyCode;
Expand Down Expand Up @@ -2558,7 +2558,7 @@ boolean mouseEvent (long id, long sel, long theEvent, int type) {

switch (nsType) {
case OS.NSLeftMouseDown:
if (nsEvent.clickCount() == 1 && (nsEvent.modifierFlags() & OS.NSControlKeyMask) == 0 && (state & DRAG_DETECT) != 0 && hooks (SWT.DragDetect)) {
if (nsEvent.clickCount() == 1 && (nsEvent.modifierFlags() & OS.NSEventModifierFlagControl) == 0 && (state & DRAG_DETECT) != 0 && hooks (SWT.DragDetect)) {
consume = new boolean[1];
NSPoint location = view.convertPoint_fromView_(nsEvent.locationInWindow(), null);
if (!view.isFlipped ()) {
Expand Down Expand Up @@ -4783,7 +4783,7 @@ boolean translateTraversal (int key, NSEvent theEvent, boolean [] consume) {
}
case 48: /* Tab */ {
long modifiers = theEvent.modifierFlags ();
boolean next = (modifiers & OS.NSShiftKeyMask) == 0;
boolean next = (modifiers & OS.NSEventModifierFlagShift) == 0;
detail = next ? SWT.TRAVERSE_TAB_NEXT : SWT.TRAVERSE_TAB_PREVIOUS;
break;
}
Expand All @@ -4799,7 +4799,7 @@ boolean translateTraversal (int key, NSEvent theEvent, boolean [] consume) {
case 121: /* Page down */ {
all = true;
long modifiers = theEvent.modifierFlags ();
if ((modifiers & OS.NSControlKeyMask) == 0) return false;
if ((modifiers & OS.NSEventModifierFlagControl) == 0) return false;
detail = key == 121 /* Page down */ ? SWT.TRAVERSE_PAGE_NEXT : SWT.TRAVERSE_PAGE_PREVIOUS;
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,7 @@ void createMainMenu () {

title = NSString.stringWith(SWT.getMessage("SWT_HideOthers"));
menuItem = appleMenu.addItemWithTitle(title, OS.sel_hideOtherApplications_, NSString.stringWith("h"));
menuItem.setKeyEquivalentModifierMask(OS.NSCommandKeyMask | OS.NSAlternateKeyMask);
menuItem.setKeyEquivalentModifierMask(OS.NSEventModifierFlagCommand | OS.NSAlternateKeyMask);
menuItem.setTarget(applicationDelegate);

title = NSString.stringWith(SWT.getMessage("SWT_ShowAll"));
Expand Down Expand Up @@ -3924,9 +3924,9 @@ boolean performKeyEquivalent(NSWindow window, NSEvent nsEvent) {
long selector = 0;
long modifierFlags = nsEvent.modifierFlags();
if ((modifierFlags & OS.NSAlternateKeyMask) != 0) stateMask |= SWT.ALT;
if ((modifierFlags & OS.NSShiftKeyMask) != 0) stateMask |= SWT.SHIFT;
if ((modifierFlags & OS.NSControlKeyMask) != 0) stateMask |= SWT.CONTROL;
if ((modifierFlags & OS.NSCommandKeyMask) != 0) stateMask |= SWT.COMMAND;
if ((modifierFlags & OS.NSEventModifierFlagShift) != 0) stateMask |= SWT.SHIFT;
if ((modifierFlags & OS.NSEventModifierFlagControl) != 0) stateMask |= SWT.CONTROL;
if ((modifierFlags & OS.NSEventModifierFlagCommand) != 0) stateMask |= SWT.COMMAND;
if (stateMask == SWT.COMMAND) {
short keyCode = nsEvent.keyCode ();
switch (keyCode) {
Expand Down Expand Up @@ -5679,15 +5679,15 @@ void applicationSendEvent (long id, long sel, long event) {
* Feature in Cocoa. The help key triggers context-sensitive help but doesn't get forwarded to the window as a key event.
* If the event is destined for the key window, is the help key, and is an NSKeyDown, send it directly to the window first.
*/
if (window != null && window.isKeyWindow() && nsEvent.type() == OS.NSKeyDown && (nsEvent.modifierFlags() & OS.NSHelpKeyMask) != 0) {
if (window != null && window.isKeyWindow() && nsEvent.type() == OS.NSKeyDown && (nsEvent.modifierFlags() & OS.NSEventModifierFlagHelp) != 0) {
window.sendEvent(nsEvent);
}

/*
* Feature in Cocoa. NSKeyUp events are not delivered to the window if the command key is down.
* If the event is destined for the key window, and it's a key up and the command key is down, send it directly to the window.
*/
if (window != null && window.isKeyWindow() && nsEvent.type() == OS.NSKeyUp && (nsEvent.modifierFlags() & OS.NSCommandKeyMask) != 0) {
if (window != null && window.isKeyWindow() && nsEvent.type() == OS.NSKeyUp && (nsEvent.modifierFlags() & OS.NSEventModifierFlagCommand) != 0) {
window.sendEvent(nsEvent);
} else {
objc_super super_struct = new objc_super ();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ int traversalCode (int key, NSEvent theEvent) {
int bits = super.traversalCode (key, theEvent);
if (key == 48 /* Tab */ && theEvent != null) {
long modifierFlags = theEvent.modifierFlags();
boolean next = (modifierFlags & OS.NSShiftKeyMask) == 0;
boolean next = (modifierFlags & OS.NSEventModifierFlagShift) == 0;
if (next && focusIndex < offsets.length - 1) {
return bits & ~ SWT.TRAVERSE_TAB_NEXT;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ void createItem (MenuItem item, int index) {
long keyEquiv = 0;
if (keyEquivString != null) {
keyEquiv = keyEquivString.characterAtIndex(0);
if ((keyMask & OS.NSCommandKeyMask) != 0) keyEquiv |= SWT.COMMAND;
if ((keyMask & OS.NSEventModifierFlagCommand) != 0) keyEquiv |= SWT.COMMAND;
if ((keyMask & OS.NSAlternateKeyMask) != 0) keyEquiv |= SWT.ALT;
item.accelerator = (int) keyEquiv;
}
Expand Down
Loading
Loading