DFBWindow Focus and Input Control
From DirectFBWiki
DBFWindows will get focus or keyboard input based on the window manager rerouting the input into the window, for example if the mouse moves over a window, it will receive the DWET_GOT_FOCUS
message, and when the cursor leaves the window it will receive the DWET_LOSTFOCUS
.
If you want to control this further, here are some things good to know.
You could tell a specific window to always receive the mouse events using the IDirectFBWindow::GrabPointer (http://www.directfb.org/docs/DirectFB_Reference/IDirectFBWindow_GrabPointer.html) interface. There's a corresponding IDirectFBWindow::UngrabPointer (http://www.directfb.org/docs/DirectFB_Reference/IDirectFBWindow_UngrabPointer.html) interface to release this relationship.
If you want to force all keyboard input to a specific window, use the IDirectFBWindow::GrabKeyboard (http://www.directfb.org/docs/DirectFB_Reference/IDirectFBWindow_GrabKeyboard.html) interface, and to release this relationship, use the IDirectFBWindow::UngrabKeyboard (http://www.directfb.org/docs/DirectFB_Reference/IDirectFBWindow_UngrabKeyboard.html) interface. If you want specific keys to trigger the focus to a specific window, use the IDirectFBWindow::GrabKey (http://www.directfb.org/docs/DirectFB_Reference/IDirectFBWindow_GrabKey.html) interface, and to release the key, the IDirectFBWindow::UngrabKey (http://www.directfb.org/docs/DirectFB_Reference/IDirectFBWindow_UngrabKey.html) interface.
You could force the specific focus to a window using the IDirectFBWindow::RequestsFocus (http://www.directfb.org/docs/DirectFB_Reference/IDirectFBWindow_RequestFocus.html) interface.
If you want to create a window that is totally transparent to focus and input control, in other words will never receive focus or input events, then set the DFBWindowOptions (http://www.directfb.org/docs/DirectFB_Reference/types.html#DFBWindowOptions) flag called DWOP_GHOST
using the IDirectFBWindow::SetOptions (http://www.directfb.org/docs/DirectFB_Reference/IDirectFBWindow_SetOptions.html) interface. For example the DFBCursor is using this technique.