diff options
| -rw-r--r-- | area.go | 1 | ||||
| -rw-r--r-- | area_unix.go | 2 | ||||
| -rw-r--r-- | area_windows.go | 2 | ||||
| -rw-r--r-- | todo.md | 3 |
4 files changed, 6 insertions, 2 deletions
@@ -80,6 +80,7 @@ type MouseEvent struct { // If the event was generated by a mouse button being pressed, Down contains the ID of that button. // Otherwise, Down contains 0. + // If Down contains nonzero, the Area will also receive keyboard focus. Down uint // If the event was generated by a mouse button being released, Up contains the ID of that button. diff --git a/area_unix.go b/area_unix.go index 71a9edb..cfa5741 100644 --- a/area_unix.go +++ b/area_unix.go @@ -141,6 +141,8 @@ func finishMouseEvent(widget *C.GtkWidget, data C.gpointer, me MouseEvent, mb ui //export our_area_button_press_event_callback func our_area_button_press_event_callback(widget *C.GtkWidget, event *C.GdkEvent, data C.gpointer) C.gboolean { + // clicking doesn't automatically transfer keyboard focus; we must do so manually (thanks tristan in irc.gimp.net/#gtk+) + C.gtk_widget_grab_focus(widget) e := (*C.GdkEventButton)(unsafe.Pointer(event)) me := MouseEvent{ // GDK button ID == our button ID diff --git a/area_windows.go b/area_windows.go index a2e8631..9db8091 100644 --- a/area_windows.go +++ b/area_windows.go @@ -622,7 +622,7 @@ func areaWndProc(s *sysData) func(hwnd _HWND, uMsg uint32, wParam _WPARAM, lPara } return defwndproc() case _WM_MOUSEACTIVATE: - // register our window for keyboard input + // transfer keyboard focus to our Area on an activating click // (see http://www.catch22.net/tuts/custom-controls) r1, _, err := _setFocus.Call(uintptr(s.hwnd)) if r1 == 0 { // failure @@ -38,7 +38,8 @@ super ultra important things: - resizing seems to be completely and totally broken in the Wayland backend - TODO find out if this is a problem on the GTK+/Wayland side (no initial window-configure event?) - redrawing controls after a window resize on Windows does not work properly -- clicking on Areas in GTK+ don't bring keyboard focus to them? +- test click to keyboard focus for Areas on Mac OS X +- make sure Areas get keyboard focus when clicking outside the actual Area space on all platforms - make sure keyboard events on numpad off on all platforms don't switch between controls - on Windows, Shift+(num pad key) triggers the shifted key code when num lock is off; will need to reorder key code tests on all platforms to fix this - pressing global keycodes (including kwin's zoom in/out) when running the keyboard test in wine causes the Area to lose keyboard focus; this doesn't happen on the GTK+ version (fix the Windows version to behave like the GTK+ version) |
