Esempio n. 1
0
File: gtk.go Progetto: 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)
}
Esempio n. 2
0
File: gdk.go Progetto: gotk3/gotk3
func KeyvalToUnicode(v uint) rune {
	return rune(C.gdk_keyval_to_unicode(C.guint(v)))
}
Esempio n. 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
}