char *get_notify_detail_label(uint8_t);
char *get_notify_mode_label(uint8_t);
#endif
+struct ws_win *get_pointer_win(xcb_window_t);
struct ws_win *get_region_focus(struct swm_region *);
xcb_screen_t *get_screen(int);
char *get_win_name(xcb_window_t);
quit(NULL, NULL);
}
+struct ws_win *
+get_pointer_win(xcb_window_t root)
+{
+ struct ws_win *win = NULL;
+ xcb_query_pointer_reply_t *r;
+
+ DNPRINTF(SWM_D_EVENT, "get_pointer_win: root: 0x%x.\n", root);
+
+ r = xcb_query_pointer_reply(conn, xcb_query_pointer(conn, root), NULL);
+ if (r) {
+ win = find_window(r->child);
+ if (win) {
+ DNPRINTF(SWM_D_EVENT, "get_pointer_win: 0x%x.\n",
+ win->id);
+ } else {
+ DNPRINTF(SWM_D_EVENT, "get_pointer_win: none.\n");
+ }
+ }
+
+ return win;
+}
+
struct swm_region *
root_to_region(xcb_window_t root, int check)
{
if (strncmp(s, resp, len) == 0) {
/* XXX this should be a callback to generalize */
set_swm_iconic(win, 0);
- xcb_flush(conn);
free(s);
break;
}
return;
resize(win, args);
+ focus_flush();
}
#define SWM_MOVE_STEPS (50)
return;
move(win, args);
+ focus_flush();
}
/* user/key callable function IDs */
void
buttonpress(xcb_button_press_event_t *e)
{
- struct ws_win *win;
+ struct ws_win *win = NULL;
struct swm_region *r, *old_r;
int i;
int handled = 0;
if (win == NULL)
return;
+ win->mapped = 0;
ws = win->ws;
if (getstate(e->window) == XCB_ICCCM_WM_STATE_NORMAL) {
- win->mapped = 0;
set_win_state(win, XCB_ICCCM_WM_STATE_ICONIC);
/* If we were focused, make sure we focus on something else. */
stack();
DNPRINTF(SWM_D_EVENT, "unmapnotify: focus_pending: 0x%x\n",
- ws->focus_pending->id);
+ WINID(ws->focus_pending));
if (focus_mode != SWM_FOCUS_FOLLOW) {
if (ws->focus_pending) {
}
focus_flush();
+ } else if (focus_mode == SWM_FOCUS_FOLLOW) {
+ if (ws->r) {
+ focus_win(get_pointer_win(ws->r->s->root));
+ xcb_flush(conn);
+ }
}
}