menios
menios copied to clipboard
Implement focus management for windows
Summary
Implement window focus management, including click-to-focus, keyboard event routing, and focus visual indicators.
Goals
- Click-to-focus behavior
- Keyboard event routing to focused window
- Focus visual feedback
- Focus-follows-mouse (optional)
- Tab cycling between windows
Implementation
Focus Management
```c struct window *focused_window = NULL;
void wm_focus_window(struct window *w) { if (focused_window) { focused_window->focused = 0; wm_redraw_decoration(focused_window); // Inactive color }
focused_window = w;
w->focused = 1;
wm_raise_window(w);
wm_redraw_decoration(w); // Active color
send_focus_event(w);
}
void wm_handle_mouse_click(int x, int y) { struct window *w = wm_find_window_at(x, y); if (w && w != focused_window) { wm_focus_window(w); } } ```
Timeline
Total: 1-2 weeks
Definition of Done
- [ ] Click-to-focus works
- [ ] Keyboard events go to focused window
- [ ] Visual focus indicator
- [ ] Tab cycling works
- [ ] Focus events sent to applications
Dependencies
- #405: Window manager core
- #399: Input events
See docs/road/road_to_gui.md for complete roadmap.