Fix switching containers by moving the mouse over their decorations when in the same container
This commit is contained in:
parent
6fe0e58a64
commit
622b51a1ea
|
@ -32,7 +32,6 @@ int handle_key_press(void *ignored, xcb_connection_t *conn,
|
||||||
int handle_enter_notify(void *ignored, xcb_connection_t *conn,
|
int handle_enter_notify(void *ignored, xcb_connection_t *conn,
|
||||||
xcb_enter_notify_event_t *event);
|
xcb_enter_notify_event_t *event);
|
||||||
|
|
||||||
#if 0
|
|
||||||
/**
|
/**
|
||||||
* When the user moves the mouse but does not change the active window
|
* When the user moves the mouse but does not change the active window
|
||||||
* (e.g. when having no windows opened but moving mouse on the root screen
|
* (e.g. when having no windows opened but moving mouse on the root screen
|
||||||
|
@ -42,6 +41,7 @@ int handle_enter_notify(void *ignored, xcb_connection_t *conn,
|
||||||
int handle_motion_notify(void *ignored, xcb_connection_t *conn,
|
int handle_motion_notify(void *ignored, xcb_connection_t *conn,
|
||||||
xcb_motion_notify_event_t *event);
|
xcb_motion_notify_event_t *event);
|
||||||
|
|
||||||
|
#if 0
|
||||||
/**
|
/**
|
||||||
* Called when the keyboard mapping changes (for example by using Xmodmap),
|
* Called when the keyboard mapping changes (for example by using Xmodmap),
|
||||||
* we need to update our key bindings then (re-translate symbols).
|
* we need to update our key bindings then (re-translate symbols).
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
/** The XCB_CW_EVENT_MASK for its frame */
|
/** The XCB_CW_EVENT_MASK for its frame */
|
||||||
#define FRAME_EVENT_MASK (XCB_EVENT_MASK_BUTTON_PRESS | /* …mouse is pressed/released */ \
|
#define FRAME_EVENT_MASK (XCB_EVENT_MASK_BUTTON_PRESS | /* …mouse is pressed/released */ \
|
||||||
XCB_EVENT_MASK_BUTTON_RELEASE | \
|
XCB_EVENT_MASK_BUTTON_RELEASE | \
|
||||||
|
XCB_EVENT_MASK_POINTER_MOTION | /* …mouse is moved */ \
|
||||||
XCB_EVENT_MASK_EXPOSURE | /* …our window needs to be redrawn */ \
|
XCB_EVENT_MASK_EXPOSURE | /* …our window needs to be redrawn */ \
|
||||||
XCB_EVENT_MASK_STRUCTURE_NOTIFY | /* …the frame gets destroyed */ \
|
XCB_EVENT_MASK_STRUCTURE_NOTIFY | /* …the frame gets destroyed */ \
|
||||||
XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | /* …the application tries to resize itself */ \
|
XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | /* …the application tries to resize itself */ \
|
||||||
|
|
|
@ -243,7 +243,6 @@ int handle_enter_notify(void *ignored, xcb_connection_t *conn,
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When the user moves the mouse but does not change the active window
|
* When the user moves the mouse but does not change the active window
|
||||||
|
@ -252,16 +251,37 @@ int handle_enter_notify(void *ignored, xcb_connection_t *conn,
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int handle_motion_notify(void *ignored, xcb_connection_t *conn, xcb_motion_notify_event_t *event) {
|
int handle_motion_notify(void *ignored, xcb_connection_t *conn, xcb_motion_notify_event_t *event) {
|
||||||
/* Skip events where the pointer was over a child window, we are only
|
/* Skip events where the pointer was over a child window, we are only
|
||||||
* interested in events on the root window. */
|
* interested in events on the root window. */
|
||||||
if (event->child != 0)
|
if (event->child != 0)
|
||||||
return 1;
|
|
||||||
|
|
||||||
check_crossing_screen_boundary(event->root_x, event->root_y);
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
Con *con;
|
||||||
|
if ((con = con_by_frame_id(event->event)) == NULL) {
|
||||||
|
/* TODO; handle root window: */
|
||||||
|
//check_crossing_screen_boundary(event->root_x, event->root_y);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* see over which rect the user is */
|
||||||
|
Con *current;
|
||||||
|
TAILQ_FOREACH(current, &(con->nodes_head), nodes) {
|
||||||
|
if (!rect_contains(current->deco_rect, event->event_x, event->event_y))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* We found the rect, let’s see if this window is focused */
|
||||||
|
if (TAILQ_FIRST(&(con->focus_head)) == current)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
con_focus(current);
|
||||||
|
x_push_changes(croot);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
/*
|
/*
|
||||||
* Called when the keyboard mapping changes (for example by using Xmodmap),
|
* Called when the keyboard mapping changes (for example by using Xmodmap),
|
||||||
* we need to update our key bindings then (re-translate symbols).
|
* we need to update our key bindings then (re-translate symbols).
|
||||||
|
|
|
@ -211,6 +211,8 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
xcb_event_set_expose_handler(&evenths, handle_expose_event, NULL);
|
xcb_event_set_expose_handler(&evenths, handle_expose_event, NULL);
|
||||||
|
|
||||||
|
xcb_event_set_motion_notify_handler(&evenths, handle_motion_notify, NULL);
|
||||||
|
|
||||||
/* Enter window = user moved his mouse over the window */
|
/* Enter window = user moved his mouse over the window */
|
||||||
xcb_event_set_enter_notify_handler(&evenths, handle_enter_notify, NULL);
|
xcb_event_set_enter_notify_handler(&evenths, handle_enter_notify, NULL);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue