cmd_move_window_to_position: improve error message

next
Orestis Floros 2018-03-18 02:41:12 +02:00
parent 174dc389ff
commit 5e8a3f3f0c
3 changed files with 8 additions and 5 deletions

View File

@ -143,7 +143,7 @@ drag_result_t drag_pointer(Con *con, const xcb_button_press_event_t *event,
* outputs. * outputs.
* *
*/ */
void floating_reposition(Con *con, Rect newrect); bool floating_reposition(Con *con, Rect newrect);
/** /**
* Sets size of the CT_FLOATING_CON to specified dimensions. Might limit the * Sets size of the CT_FLOATING_CON to specified dimensions. Might limit the

View File

@ -1718,10 +1718,12 @@ void cmd_move_window_to_position(I3_CMD, long x, long y) {
newrect.x = x; newrect.x = x;
newrect.y = y; newrect.y = y;
floating_reposition(current->con->parent, newrect); if (!floating_reposition(current->con->parent, newrect)) {
yerror("Cannot move window/container out of bounds.");
has_error = true;
}
} }
// XXX: default reply for now, make this a better reply
if (!has_error) if (!has_error)
ysuccess(true); ysuccess(true);
} }

View File

@ -864,12 +864,12 @@ drag_result_t drag_pointer(Con *con, const xcb_button_press_event_t *event, xcb_
* outputs. * outputs.
* *
*/ */
void floating_reposition(Con *con, Rect newrect) { bool floating_reposition(Con *con, Rect newrect) {
/* Sanity check: Are the new coordinates on any output? If not, we /* Sanity check: Are the new coordinates on any output? If not, we
* ignore that request. */ * ignore that request. */
if (!contained_by_output(newrect)) { if (!contained_by_output(newrect)) {
ELOG("No output found at destination coordinates. Not repositioning.\n"); ELOG("No output found at destination coordinates. Not repositioning.\n");
return; return false;
} }
con->rect = newrect; con->rect = newrect;
@ -881,6 +881,7 @@ void floating_reposition(Con *con, Rect newrect) {
con->scratchpad_state = SCRATCHPAD_CHANGED; con->scratchpad_state = SCRATCHPAD_CHANGED;
tree_render(); tree_render();
return true;
} }
/* /*