Beispiel #1
0
func parseModifiers(e C.id) (m Modifiers) {
	mods := C.modifierFlags(e)
	if (mods & C.cNSControlKeyMask) != 0 {
		m |= Ctrl
	}
	if (mods & C.cNSAlternateKeyMask) != 0 {
		m |= Alt
	}
	if (mods & C.cNSShiftKeyMask) != 0 {
		m |= Shift
	}
	if (mods & C.cNSCommandKeyMask) != 0 {
		m |= Super
	}
	return m
}
Beispiel #2
0
func parseModifiers(e C.id) (m Modifiers) {
	const (
		_NSShiftKeyMask     = 1 << 17
		_NSControlKeyMask   = 1 << 18
		_NSAlternateKeyMask = 1 << 19
		_NSCommandKeyMask   = 1 << 20
	)

	mods := uintptr(C.modifierFlags(e))
	if (mods & _NSControlKeyMask) != 0 {
		m |= Ctrl
	}
	if (mods & _NSAlternateKeyMask) != 0 {
		m |= Alt
	}
	if (mods & _NSShiftKeyMask) != 0 {
		m |= Shift
	}
	if (mods & _NSCommandKeyMask) != 0 {
		m |= Super
	}
	return m
}