Floating move drag: use threshold
This commit is contained in:
parent
551ec20941
commit
c6b56b09ab
|
@ -75,7 +75,7 @@ void floating_move_to_pointer(Con *con);
|
|||
* Calls the drag_pointer function with the drag_window callback
|
||||
*
|
||||
*/
|
||||
void floating_drag_window(Con *con, const xcb_button_press_event_t *event);
|
||||
void floating_drag_window(Con *con, const xcb_button_press_event_t *event, bool use_threshold);
|
||||
|
||||
/**
|
||||
* Called when the user clicked on a floating window while holding the
|
||||
|
|
|
@ -221,6 +221,7 @@ static int route_click(Con *con, xcb_button_press_event_t *event, const bool mod
|
|||
Con *floatingcon = con_inside_floating(con);
|
||||
const bool proportional = (event->state & XCB_KEY_BUT_MASK_SHIFT) == XCB_KEY_BUT_MASK_SHIFT;
|
||||
const bool in_stacked = (con->parent->layout == L_STACKED || con->parent->layout == L_TABBED);
|
||||
const bool was_focused = focused == con;
|
||||
|
||||
/* 1: see if the user scrolled on the decoration of a stacked/tabbed con */
|
||||
if (in_stacked &&
|
||||
|
@ -258,7 +259,7 @@ static int route_click(Con *con, xcb_button_press_event_t *event, const bool mod
|
|||
if (floatingcon != NULL && fs != con) {
|
||||
/* 4: floating_modifier plus left mouse button drags */
|
||||
if (mod_pressed && event->detail == XCB_BUTTON_CLICK_LEFT) {
|
||||
floating_drag_window(floatingcon, event);
|
||||
floating_drag_window(floatingcon, event, false);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -293,9 +294,8 @@ static int route_click(Con *con, xcb_button_press_event_t *event, const bool mod
|
|||
|
||||
/* 6: dragging, if this was a click on a decoration (which did not lead
|
||||
* to a resize) */
|
||||
if (!in_stacked && dest == CLICK_DECORATION &&
|
||||
(event->detail == XCB_BUTTON_CLICK_LEFT)) {
|
||||
floating_drag_window(floatingcon, event);
|
||||
if (dest == CLICK_DECORATION && event->detail == XCB_BUTTON_CLICK_LEFT) {
|
||||
floating_drag_window(floatingcon, event, !was_focused);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -582,7 +582,7 @@ DRAGGING_CB(drag_window_callback) {
|
|||
* Calls the drag_pointer function with the drag_window callback
|
||||
*
|
||||
*/
|
||||
void floating_drag_window(Con *con, const xcb_button_press_event_t *event) {
|
||||
void floating_drag_window(Con *con, const xcb_button_press_event_t *event, bool use_threshold) {
|
||||
DLOG("floating_drag_window\n");
|
||||
|
||||
/* Push changes before dragging, so that the window gets raised now and not
|
||||
|
@ -593,7 +593,7 @@ void floating_drag_window(Con *con, const xcb_button_press_event_t *event) {
|
|||
Rect initial_rect = con->rect;
|
||||
|
||||
/* Drag the window */
|
||||
drag_result_t drag_result = drag_pointer(con, event, XCB_NONE, XCURSOR_CURSOR_MOVE, false, drag_window_callback, NULL);
|
||||
drag_result_t drag_result = drag_pointer(con, event, XCB_NONE, XCURSOR_CURSOR_MOVE, use_threshold, drag_window_callback, NULL);
|
||||
|
||||
if (!con_exists(con)) {
|
||||
DLOG("The container has been closed in the meantime.\n");
|
||||
|
|
|
@ -913,7 +913,7 @@ static void handle_client_message(xcb_client_message_event_t *event) {
|
|||
.event_y = y_root - (con->rect.y)};
|
||||
switch (direction) {
|
||||
case _NET_WM_MOVERESIZE_MOVE:
|
||||
floating_drag_window(con->parent, &fake);
|
||||
floating_drag_window(con->parent, &fake, false);
|
||||
break;
|
||||
case _NET_WM_MOVERESIZE_SIZE_TOPLEFT ... _NET_WM_MOVERESIZE_SIZE_LEFT:
|
||||
floating_resize_window(con->parent, false, &fake);
|
||||
|
|
Loading…
Reference in New Issue