*/
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
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;
}
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");
}
}
}
+
+/*
+ * 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 */
+}