Implement moving of floating clients
This commit is contained in:
parent
51402b05f5
commit
4135aaad7c
|
@ -46,4 +46,10 @@ void floating_drag_window(xcb_connection_t *conn, Client *client, xcb_button_pre
|
|||
*/
|
||||
void floating_focus_direction(xcb_connection_t *conn, Client *currently_focused, direction_t direction);
|
||||
|
||||
/**
|
||||
* Moves the client 10px to the specified direction.
|
||||
*
|
||||
*/
|
||||
void floating_move(xcb_connection_t *conn, Client *currently_focused, direction_t direction);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -928,7 +928,8 @@ void parse_command(xcb_connection_t *conn, const char *command) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (last_focused->floating >= FLOATING_AUTO_ON && action != ACTION_FOCUS) {
|
||||
if (last_focused->floating >= FLOATING_AUTO_ON &&
|
||||
(action != ACTION_FOCUS && action != ACTION_MOVE)) {
|
||||
LOG("Not performing (floating)\n");
|
||||
return;
|
||||
}
|
||||
|
@ -947,20 +948,32 @@ void parse_command(xcb_connection_t *conn, const char *command) {
|
|||
LOG("unknown direction: %c\n", *rest);
|
||||
return;
|
||||
}
|
||||
rest++;
|
||||
|
||||
if (action == ACTION_FOCUS) {
|
||||
if (last_focused->floating >= FLOATING_AUTO_ON)
|
||||
if (last_focused->floating >= FLOATING_AUTO_ON) {
|
||||
floating_focus_direction(conn, last_focused, direction);
|
||||
else focus_thing(conn, direction, (with == WITH_WINDOW ? THING_WINDOW : THING_CONTAINER));
|
||||
} else if (action == ACTION_MOVE) {
|
||||
continue;
|
||||
}
|
||||
focus_thing(conn, direction, (with == WITH_WINDOW ? THING_WINDOW : THING_CONTAINER));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (action == ACTION_MOVE) {
|
||||
if (last_focused->floating >= FLOATING_AUTO_ON) {
|
||||
floating_move(conn, last_focused, direction);
|
||||
continue;
|
||||
}
|
||||
if (with == WITH_WINDOW)
|
||||
move_current_window(conn, direction);
|
||||
else move_current_container(conn, direction);
|
||||
continue;
|
||||
}
|
||||
else if (action == ACTION_SNAP)
|
||||
snap_current_container(conn, direction);
|
||||
|
||||
rest++;
|
||||
if (action == ACTION_SNAP) {
|
||||
snap_current_container(conn, direction);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
LOG("--- done ---\n");
|
||||
|
|
|
@ -318,3 +318,40 @@ void floating_focus_direction(xcb_connection_t *conn, Client *currently_focused,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Moves the client 10px to the specified direction.
|
||||
*
|
||||
*/
|
||||
void floating_move(xcb_connection_t *conn, Client *currently_focused, direction_t direction) {
|
||||
LOG("floating move\n");
|
||||
|
||||
switch (direction) {
|
||||
case D_LEFT:
|
||||
if (currently_focused->rect.x < 10)
|
||||
return;
|
||||
currently_focused->rect.x -= 10;
|
||||
break;
|
||||
case D_RIGHT:
|
||||
currently_focused->rect.x += 10;
|
||||
break;
|
||||
case D_UP:
|
||||
if (currently_focused->rect.y < 10)
|
||||
return;
|
||||
currently_focused->rect.y -= 10;
|
||||
break;
|
||||
case D_DOWN:
|
||||
currently_focused->rect.y += 10;
|
||||
break;
|
||||
/* to make static analyzers happy */
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
reposition_client(conn, currently_focused);
|
||||
|
||||
/* Because reposition_client does not send a faked configure event (only resize does),
|
||||
* we need to initiate that on our own */
|
||||
fake_absolute_configure_notify(conn, currently_focused);
|
||||
/* fake_absolute_configure_notify flushes */
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue