Merge branch 'master' into next

This commit is contained in:
Michael Stapelberg 2011-12-18 17:25:15 +00:00
commit c4298b9311
4 changed files with 43 additions and 22 deletions

View File

@ -137,4 +137,13 @@ void drag_pointer(Con *con, const xcb_button_press_event_t *event,
xcb_window_t confine_to, border_t border, callback_t callback, xcb_window_t confine_to, border_t border, callback_t callback,
const void *extra); const void *extra);
/**
* Repositions the CT_FLOATING_CON to have the coordinates specified by
* newrect, but only if the coordinates are not out-of-bounds. Also reassigns
* the floating con to a different workspace if this move was across different
* outputs.
*
*/
void floating_reposition(Con *con, Rect newrect);
#endif #endif

View File

@ -780,20 +780,21 @@ move:
printf("moving in direction %d\n", direction); printf("moving in direction %d\n", direction);
if (con_is_floating(focused)) { if (con_is_floating(focused)) {
printf("floating move with %d pixels\n", px); printf("floating move with %d pixels\n", px);
Rect newrect = focused->parent->rect;
if (direction == TOK_LEFT) { if (direction == TOK_LEFT) {
focused->parent->rect.x -= px; newrect.x -= px;
} else if (direction == TOK_RIGHT) { } else if (direction == TOK_RIGHT) {
focused->parent->rect.x += px; newrect.x += px;
} else if (direction == TOK_UP) { } else if (direction == TOK_UP) {
focused->parent->rect.y -= px; newrect.y -= px;
} else if (direction == TOK_DOWN) { } else if (direction == TOK_DOWN) {
focused->parent->rect.y += px; newrect.y += px;
} }
floating_reposition(focused->parent, newrect);
} else { } else {
tree_move(direction); tree_move(direction);
tree_render();
} }
tree_render();
} }
| TOK_MOVE TOK_WORKSPACE STR | TOK_MOVE TOK_WORKSPACE STR
{ {

View File

@ -514,6 +514,31 @@ void drag_pointer(Con *con, const xcb_button_press_event_t *event, xcb_window_t
xcb_flush(conn); xcb_flush(conn);
} }
/*
* Repositions the CT_FLOATING_CON to have the coordinates specified by
* newrect, but only if the coordinates are not out-of-bounds. Also reassigns
* the floating con to a different workspace if this move was across different
* outputs.
*
*/
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) {
ELOG("No output found at destination coordinates. Not repositioning.\n");
return;
}
con->rect = newrect;
floating_maybe_reassign_ws(con);
tree_render();
}
#if 0 #if 0
/* /*
* Moves the client 10px to the specified direction. * Moves the client 10px to the specified direction.

View File

@ -400,23 +400,9 @@ static int handle_configure_request(xcb_configure_request_event_t *event) {
event->height, newrect.height, con->border_width); event->height, newrect.height, con->border_width);
} }
/* 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) {
ELOG("No output found at destination coordinates. Ignoring this ConfigureRequest.\n");
fake_absolute_configure_notify(con);
return 0;
}
DLOG("Container is a floating leaf node, will do that.\n"); DLOG("Container is a floating leaf node, will do that.\n");
floatingcon->rect = newrect; floating_reposition(floatingcon, newrect);
return 1;
floating_maybe_reassign_ws(floatingcon);
tree_render();
} }
/* Dock windows can be reconfigured in their height */ /* Dock windows can be reconfigured in their height */