2 #define I3__FILE__ "scratchpad.c"
22 if (con->
type == CT_WORKSPACE) {
23 LOG(
"'move scratchpad' used on a workspace \"%s\". Calling it "
24 "recursively on all windows on this workspace.\n", con->
name);
34 DLOG(
"should move con %p to __i3_scratch\n", con);
38 DLOG(
"This window is already on __i3_scratch.\n");
53 if (maybe_floating_con == NULL) {
57 con = maybe_floating_con;
68 DLOG(
"This window was never used as a scratchpad before.\n");
69 if (con == maybe_floating_con) {
70 DLOG(
"It was in floating mode before, set scratchpad state to changed.\n");
73 DLOG(
"It was in tiling mode before, set scratchpad state to fresh.\n");
89 DLOG(
"should show scratchpad window %p\n", con);
99 DLOG(
"Focused window is a scratchpad window, hiding it.\n");
110 if (fs && fs->
type != CT_WORKSPACE) {
118 TAILQ_FOREACH(walk_con, &(focused_ws->floating_head), floating_windows) {
122 DLOG(
"Found an unfocused scratchpad window on this workspace\n");
123 DLOG(
"Focusing it: %p\n", walk_con);
138 if (!con && walk_ws &&
142 DLOG(
"Found a visible scratchpad window on another workspace,\n");
143 DLOG(
"moving it to this workspace: con = %p\n", walk_con);
152 DLOG(
"Window is not in the scratchpad, doing nothing.\n");
163 current != __i3_scratch) {
166 if (current == active) {
167 DLOG(
"Window is a scratchpad window, hiding it.\n");
180 LOG(
"You don't have any scratchpad windows yet.\n");
181 LOG(
"Use 'move scratchpad' to move a window to the scratchpad.\n");
195 DLOG(
"Adjusting size of this window.\n");
208 if (current != active) {
220 static int _gcd(
const int m,
const int n) {
223 return _gcd(n, (m % n));
237 static int _lcm(
const int m,
const int n) {
238 const int o =
_gcd(m, n);
239 return ((m * n) / o);
253 DLOG(
"Current resolution: (%d, %d) %d x %d\n",
260 if (output == __i3_output)
262 DLOG(
"output %s's resolution: (%d, %d) %d x %d\n",
265 if (new_width == -1) {
276 DLOG(
"new width = %d, new height = %d\n",
277 new_width, new_height);
283 if (memcmp(&old_rect, &new_rect,
sizeof(
Rect)) == 0) {
284 DLOG(
"Scratchpad size unchanged.\n");
288 DLOG(
"Fixing coordinates of scratchpad windows\n");
290 TAILQ_FOREACH(con, &(__i3_scratch->floating_head), floating_windows) {