예제 #1
0
파일: gtk.go 프로젝트: evmar/smash
//export smashGoKey
func smashGoKey(winKey unsafe.Pointer, gkey *C.GdkEventKey) {
	win := globalPointerStore.Get(winKey).(*Window)

	switch gkey.keyval {
	case C.GDK_KEY_Shift_L, C.GDK_KEY_Shift_R,
		C.GDK_KEY_Control_L, C.GDK_KEY_Control_R,
		C.GDK_KEY_Alt_L, C.GDK_KEY_Alt_R,
		C.GDK_KEY_Meta_L, C.GDK_KEY_Meta_R,
		C.GDK_KEY_Super_L, C.GDK_KEY_Super_R:
		return
	}

	rune := C.gdk_keyval_to_unicode(gkey.keyval)
	key := keys.Key{}
	key.Sym = keys.Sym(rune)
	if gkey.state&C.GDK_CONTROL_MASK != 0 {
		key.Mods |= keys.ModControl
	}
	if gkey.state&C.GDK_MOD1_MASK != 0 {
		key.Mods |= keys.ModMeta
	}
	win.delegate.Key(key)
}
예제 #2
0
파일: gdk.go 프로젝트: gotk3/gotk3
func KeyvalToUnicode(v uint) rune {
	return rune(C.gdk_keyval_to_unicode(C.guint(v)))
}
예제 #3
0
/*
Convert from a GDK key symbol to the corresponding ISO10646 (Unicode)
character.
*/
func KeyvalToUnicode(keyval uint) (return__ uint32) {
	var __cgo__return__ C.guint32
	__cgo__return__ = C.gdk_keyval_to_unicode(C.guint(keyval))
	return__ = uint32(__cgo__return__)
	return
}