Merge pull request #1698 from Airblader/feature-1696

Added 'move position mouse'
This commit is contained in:
Michael Stapelberg
2015-05-17 15:02:50 +02:00
7 changed files with 262 additions and 23 deletions

View File

@ -1833,6 +1833,30 @@ void cmd_move_window_to_center(I3_CMD, char *method) {
ysuccess(true);
}
/*
* Implementation of 'move [window|container] [to] position mouse'
*
*/
void cmd_move_window_to_mouse(I3_CMD) {
HANDLE_EMPTY_MATCH;
owindow *current;
TAILQ_FOREACH(current, &owindows, owindows) {
Con *floating_con = con_inside_floating(current->con);
if (floating_con == NULL) {
DLOG("con %p / %s is not floating, cannot move it to the mouse position.\n",
current->con, current->con->name);
continue;
}
DLOG("moving floating container %p / %s to cursor position\n", floating_con, floating_con->name);
floating_move_to_pointer(floating_con);
}
cmd_output->needs_tree_render = true;
ysuccess(true);
}
/*
* Implementation of 'move scratchpad'.
*