diff options
author | Dmitri Shuralyov <shurcooL@gmail.com> | 2015-01-04 17:15:04 -0800 |
---|---|---|
committer | Dmitri Shuralyov <shurcooL@gmail.com> | 2015-02-21 18:51:42 -0800 |
commit | c7ee9b057895fe44bf232e4177d46de36a9c22bd (patch) | |
tree | 51762547e60ed9646ff6bdab8417ba5b6c5f5e71 | |
parent | 811fe928d7c61fa8c279c074fdc718996ad07c04 (diff) | |
download | glfw-c7ee9b057895fe44bf232e4177d46de36a9c22bd.tar.gz |
Rename Character to Char to match upstream API naming.
This adds a breaking API change by renaming `SetCharacterCallback` to and `SetCharCallback`, and `SetCharacterModsCallback` to `SetCharModsCallback`. Updating is easy thanks to static type checking, and can be automated with `gofmt`:
gofmt -w -r 'x.SetCharacterCallback -> x.SetCharCallback' *.go
gofmt -w -r 'x.SetCharacterModsCallback -> x.SetCharModsCallback' *.go
Closes #105.
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | input.go | 12 |
2 files changed, 10 insertions, 8 deletions
@@ -55,6 +55,8 @@ Changelog The revision of GLFW C library used is listed in [GLFW_C_REVISION.txt](GLFW_C_REVISION.txt) file. +* Method <code>window.SetCharacterCallback</code> renamed to <code>window.SetCharCallback</code>. +* Method <code>window.SetCharacterModsCallback</code> renamed to <code>window.SetCharModsCallback</code>. * Added `Floating` and `AutoIconify` window hints. * Easy `go get` installation (GLFW source code included in-repo and compiled in so you don't have to build GLFW on your own first and you don't have to distribute shared libraries). * <code>SetErrorCallback</code> This function is removed. The callback is now set internally. Functions return an error with corresponding code and description (do a type assertion to GlfwError for accessing the variables). @@ -66,9 +68,9 @@ The revision of GLFW C library used is listed in [GLFW_C_REVISION.txt](GLFW_C_RE * <code>GetJoystickName</code> No longer returns an error. * <code>window.GetMonitor</code> No longer returns an error. * <code>window.GetAttribute</code> Returns an error. -* <code>window.SetCharacterCallback</code> Accepts rune instead of uint. +* <code>window.SetCharCallback</code> Accepts rune instead of uint. * <code>window.SetDropCallback</code> added. -* <code>window.SetCharacterModsCallback</code> added. +* <code>window.SetCharModsCallback</code> added. * <code>PostEmptyEvent</code> added. * Native window and context handlers added. * Constant <code>ApiUnavailable</code> changed to <code>APIUnavailable</code>. @@ -369,9 +369,9 @@ func (w *Window) SetKeyCallback(cbfun KeyCallback) (previous KeyCallback, err er return previous, fetchError() } -type CharacterCallback func(w *Window, char rune) +type CharCallback func(w *Window, char rune) -// SetCharacterCallback sets the character callback which is called when a +// SetCharCallback sets the character callback which is called when a // Unicode character is input. // // The character callback is intended for Unicode text input. As it deals with @@ -385,7 +385,7 @@ type CharacterCallback func(w *Window, char rune) // not be called if modifier keys are held down that would prevent normal text // input on that platform, for example a Super (Command) key on OS X or Alt key // on Windows. There is a character with modifiers callback that receives these events. -func (w *Window) SetCharacterCallback(cbfun CharacterCallback) (previous CharacterCallback, err error) { +func (w *Window) SetCharCallback(cbfun CharCallback) (previous CharCallback, err error) { previous = w.fCharHolder w.fCharHolder = cbfun if cbfun == nil { @@ -396,9 +396,9 @@ func (w *Window) SetCharacterCallback(cbfun CharacterCallback) (previous Charact return previous, fetchError() } -type CharacterModsCallback func(w *Window, char rune, mods ModifierKey) +type CharModsCallback func(w *Window, char rune, mods ModifierKey) -// SetCharacterModsCallback sets the character with modifiers callback which is called when a +// SetCharModsCallback sets the character with modifiers callback which is called when a // Unicode character is input regardless of what modifier keys are used. // // The character with modifiers callback is intended for implementing custom @@ -408,7 +408,7 @@ type CharacterModsCallback func(w *Window, char rune, mods ModifierKey) // map 1:1 to physical keys, as a key may produce zero, one or more characters. // If you want to know whether a specific physical key was pressed or released, // see the key callback instead. -func (w *Window) SetCharacterModsCallback(cbfun CharacterModsCallback) (previous CharacterModsCallback, err error) { +func (w *Window) SetCharModsCallback(cbfun CharModsCallback) (previous CharModsCallback, err error) { previous = w.fCharModsHolder w.fCharModsHolder = cbfun if cbfun == nil { |