Use a saner sanity check for floating_reposition.

The function contained_by_output checks whether any output contains any
parts of a give rect. Rather than relying on the central point of the rect.
This commit is contained in:
Yuxuan Shui
2013-03-22 01:36:40 +08:00
committed by Michael Stapelberg
parent 5b4ff1804d
commit 5adb09c5fc
3 changed files with 36 additions and 5 deletions

View File

@ -659,11 +659,7 @@ void drag_pointer(Con *con, const xcb_button_press_event_t *event, xcb_window_t
void floating_reposition(Con *con, Rect newrect) {
/* Sanity check: Are the new coordinates on any output? If not, we
* ignore that request. */
Output *output = get_output_containing(
newrect.x + (newrect.width / 2),
newrect.y + (newrect.height / 2));
if (!output) {
if (!contained_by_output(newrect)) {
ELOG("No output found at destination coordinates. Not repositioning.\n");
return;
}