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");
83 DLOG(
"should show scratchpad window %p\n", con);
93 DLOG(
"Focused window is a scratchpad window, hiding it.\n");
104 if (fs && fs->
type != CT_WORKSPACE) {
112 TAILQ_FOREACH(walk_con, &(focused_ws->floating_head), floating_windows) {
116 DLOG(
"Found an unfocused scratchpad window on this workspace\n");
117 DLOG(
"Focusing it: %p\n", walk_con);
132 if (!con && walk_ws &&
136 DLOG(
"Found a visible scratchpad window on another workspace,\n");
137 DLOG(
"moving it to this workspace: con = %p\n", walk_con);
146 DLOG(
"Window is not in the scratchpad, doing nothing.\n");
157 current != __i3_scratch) {
160 if (current == active) {
161 DLOG(
"Window is a scratchpad window, hiding it.\n");
174 LOG(
"You don't have any scratchpad windows yet.\n");
175 LOG(
"Use 'move scratchpad' to move a window to the scratchpad.\n");
189 DLOG(
"Adjusting size of this window.\n");
202 if (current != active) {
214 static int _gcd(
const int m,
const int n) {
217 return _gcd(n, (m % n));
231 static int _lcm(
const int m,
const int n) {
232 const int o =
_gcd(m, n);
233 return ((m * n) / o);
247 DLOG(
"Current resolution: (%d, %d) %d x %d\n",
254 if (output == __i3_output)
256 DLOG(
"output %s's resolution: (%d, %d) %d x %d\n",
259 if (new_width == -1) {
270 DLOG(
"new width = %d, new height = %d\n",
271 new_width, new_height);
277 if (memcmp(&old_rect, &new_rect,
sizeof(
Rect)) == 0) {
278 DLOG(
"Scratchpad size unchanged.\n");
282 DLOG(
"Fixing coordinates of scratchpad windows\n");
284 TAILQ_FOREACH(con, &(__i3_scratch->floating_head), floating_windows) {