149 | 149 |
return frame;
|
150 | 150 |
}
|
151 | 151 |
|
152 | |
void frame_insert_window(HSFrame* frame, Window window) {
|
|
152 |
void frame_insert_client(HSFrame* frame, struct HSClient* client) {
|
153 | 153 |
if (frame->type == TYPE_CLIENTS) {
|
154 | 154 |
// insert it here
|
155 | |
Window* buf = frame->content.clients.buf;
|
|
155 |
HSClient** buf = frame->content.clients.buf;
|
156 | 156 |
// append it to buf
|
157 | 157 |
size_t count = frame->content.clients.count;
|
158 | 158 |
count++;
|
159 | 159 |
// insert it after the selection
|
160 | 160 |
int index = frame->content.clients.selection + 1;
|
161 | 161 |
index = CLAMP(index, 0, count - 1);
|
162 | |
buf = g_renew(Window, buf, count);
|
|
162 |
buf = g_renew(HSClient*, buf, count);
|
163 | 163 |
// shift other windows to the back to insert the new one at index
|
164 | 164 |
memmove(buf + index + 1, buf + index, sizeof(*buf) * (count - index - 1));
|
165 | |
buf[index] = window;
|
|
165 |
buf[index] = client;
|
166 | 166 |
// write results back
|
167 | 167 |
frame->content.clients.count = count;
|
168 | 168 |
frame->content.clients.buf = buf;
|
|
170 | 170 |
if (g_cur_frame == frame
|
171 | 171 |
&& frame->content.clients.selection >= (count-1)) {
|
172 | 172 |
frame->content.clients.selection = count - 1;
|
173 | |
window_focus(window);
|
|
173 |
window_focus(client->window);
|
174 | 174 |
}
|
175 | 175 |
} else { /* frame->type == TYPE_FRAMES */
|
176 | 176 |
HSLayout* layout = &frame->content.layout;
|
177 | |
frame_insert_window((layout->selection == 0)? layout->a : layout->b, window);
|
|
177 |
frame_insert_client((layout->selection == 0)? layout->a : layout->b, client);
|
178 | 178 |
}
|
179 | 179 |
}
|
180 | 180 |
|
|
204 | 204 |
return lookup_frame(new_root, new_index);
|
205 | 205 |
}
|
206 | 206 |
|
207 | |
HSFrame* find_frame_with_window(HSFrame* frame, Window window) {
|
|
207 |
HSFrame* find_frame_with_client(HSFrame* frame, struct HSClient* client) {
|
208 | 208 |
if (frame->type == TYPE_CLIENTS) {
|
209 | |
Window* buf = frame->content.clients.buf;
|
|
209 |
HSClient** buf = frame->content.clients.buf;
|
210 | 210 |
size_t count = frame->content.clients.count;
|
211 | 211 |
for (int i = 0; i < count; i++) {
|
212 | |
if (buf[i] == window) {
|
|
212 |
if (buf[i] == client) {
|
213 | 213 |
return frame;
|
214 | 214 |
}
|
215 | 215 |
}
|
216 | 216 |
return NULL;
|
217 | 217 |
} else { /* frame->type == TYPE_FRAMES */
|
218 | |
HSFrame* found = find_frame_with_window(frame->content.layout.a, window);
|
|
218 |
HSFrame* found = find_frame_with_client(frame->content.layout.a, client);
|
219 | 219 |
if (!found) {
|
220 | |
found = find_frame_with_window(frame->content.layout.b, window);
|
|
220 |
found = find_frame_with_client(frame->content.layout.b, client);
|
221 | 221 |
}
|
222 | 222 |
return found;
|
223 | 223 |
}
|
224 | 224 |
}
|
225 | 225 |
|
226 | |
bool frame_remove_window(HSFrame* frame, Window window) {
|
|
226 |
bool frame_remove_client(HSFrame* frame, HSClient* client) {
|
227 | 227 |
if (frame->type == TYPE_CLIENTS) {
|
228 | |
Window* buf = frame->content.clients.buf;
|
|
228 |
HSClient** buf = frame->content.clients.buf;
|
229 | 229 |
size_t count = frame->content.clients.count;
|
230 | 230 |
int i;
|
231 | 231 |
for (i = 0; i < count; i++) {
|
232 | |
if (buf[i] == window) {
|
|
232 |
if (buf[i] == client) {
|
233 | 233 |
// if window was found
|
234 | 234 |
// them remove it
|
235 | |
memmove(buf+i, buf+i+1, sizeof(Window)*(count - i - 1));
|
|
235 |
memmove(buf+i, buf+i+1, sizeof(buf[0])*(count - i - 1));
|
236 | 236 |
count--;
|
237 | |
buf = g_renew(Window, buf, count);
|
|
237 |
buf = g_renew(HSClient*, buf, count);
|
238 | 238 |
frame->content.clients.buf = buf;
|
239 | 239 |
frame->content.clients.count = count;
|
240 | 240 |
// find out new selection
|
|
251 | 251 |
}
|
252 | 252 |
return false;
|
253 | 253 |
} else { /* frame->type == TYPE_FRAMES */
|
254 | |
bool found = frame_remove_window(frame->content.layout.a, window);
|
255 | |
found = found || frame_remove_window(frame->content.layout.b, window);
|
|
254 |
bool found = frame_remove_client(frame->content.layout.a, client);
|
|
255 |
found = found || frame_remove_client(frame->content.layout.b, client);
|
256 | 256 |
return found;
|
257 | 257 |
}
|
258 | 258 |
}
|
259 | 259 |
|
260 | |
void frame_destroy(HSFrame* frame, Window** buf, size_t* count) {
|
|
260 |
void frame_destroy(HSFrame* frame, HSClient*** buf, size_t* count) {
|
261 | 261 |
if (frame->type == TYPE_CLIENTS) {
|
262 | 262 |
*buf = frame->content.clients.buf;
|
263 | 263 |
*count = frame->content.clients.count;
|
264 | 264 |
} else { /* frame->type == TYPE_FRAMES */
|
265 | 265 |
size_t c1, c2;
|
266 | |
Window *buf1, *buf2;
|
|
266 |
HSClient **buf1, **buf2;
|
267 | 267 |
frame_destroy(frame->content.layout.a, &buf1, &c1);
|
268 | 268 |
frame_destroy(frame->content.layout.b, &buf2, &c2);
|
269 | 269 |
// append buf2 to buf1
|
270 | |
buf1 = g_renew(Window, buf1, c1 + c2);
|
271 | |
memcpy(buf1+c1, buf2, sizeof(Window) * c2);
|
|
270 |
buf1 = g_renew(HSClient*, buf1, c1 + c2);
|
|
271 |
memcpy(buf1+c1, buf2, sizeof(buf1[0]) * c2);
|
272 | 272 |
// free unused things
|
273 | 273 |
g_free(buf2);
|
274 | 274 |
// return;
|
|
289 | 289 |
LAYOUT_DUMP_WHITESPACES[0],
|
290 | 290 |
g_layout_names[frame->content.clients.layout],
|
291 | 291 |
frame->content.clients.selection);
|
292 | |
Window* buf = frame->content.clients.buf;
|
|
292 |
HSClient** buf = frame->content.clients.buf;
|
293 | 293 |
size_t i, count = frame->content.clients.count;
|
294 | 294 |
for (i = 0; i < count; i++) {
|
295 | 295 |
g_string_append_printf(output, "%c0x%lx",
|
296 | 296 |
LAYOUT_DUMP_WHITESPACES[0],
|
297 | |
buf[i]);
|
|
297 |
buf[i]->window);
|
298 | 298 |
}
|
299 | 299 |
g_string_append_c(output, LAYOUT_DUMP_BRACKETS[1]);
|
300 | 300 |
} else {
|
|
423 | 423 |
// ensure that it is a client frame
|
424 | 424 |
if (frame->type == TYPE_FRAMES) {
|
425 | 425 |
// remove childs
|
426 | |
Window *buf1, *buf2;
|
|
426 |
HSClient **buf1, **buf2;
|
427 | 427 |
size_t count1, count2;
|
428 | 428 |
frame_destroy(frame->content.layout.a, &buf1, &count1);
|
429 | 429 |
frame_destroy(frame->content.layout.b, &buf2, &count2);
|
430 | 430 |
|
431 | 431 |
// merge bufs
|
432 | 432 |
size_t count = count1 + count2;
|
433 | |
Window* buf = g_new(Window, count);
|
434 | |
memcpy(buf, buf1, sizeof(Window) * count1);
|
435 | |
memcpy(buf + count1, buf2, sizeof(Window) * count2);
|
|
433 |
HSClient** buf = g_new(HSClient*, count);
|
|
434 |
memcpy(buf, buf1, sizeof(buf[0]) * count1);
|
|
435 |
memcpy(buf + count1, buf2, sizeof(buf[0]) * count2);
|
436 | 436 |
g_free(buf1);
|
437 | 437 |
g_free(buf2);
|
438 | 438 |
|
|
469 | 469 |
|
470 | 470 |
// remove window from old tag
|
471 | 471 |
HSMonitor* clientmonitor = find_monitor_with_tag(client->tag);
|
472 | |
if (!frame_remove_window(client->tag->frame, win)) {
|
|
472 |
if (!frame_remove_client(client->tag->frame, client)) {
|
473 | 473 |
g_warning("window %lx was not found on tag %s\n",
|
474 | 474 |
win, client->tag->name->str);
|
475 | 475 |
}
|
|
479 | 479 |
stack_remove_slice(client->tag->stack, client->slice);
|
480 | 480 |
|
481 | 481 |
// insert it to buf
|
482 | |
Window* buf = frame->content.clients.buf;
|
|
482 |
HSClient** buf = frame->content.clients.buf;
|
483 | 483 |
size_t count = frame->content.clients.count;
|
484 | 484 |
count++;
|
485 | 485 |
index = CLAMP(index, 0, count - 1);
|
486 | |
buf = g_renew(Window, buf, count);
|
|
486 |
buf = g_renew(HSClient*, buf, count);
|
487 | 487 |
memmove(buf + index + 1, buf + index,
|
488 | |
sizeof(Window) * (count - index - 1));
|
489 | |
buf[index] = win;
|
|
488 |
sizeof(buf[0]) * (count - index - 1));
|
|
489 |
buf[index] = client;
|
490 | 490 |
frame->content.clients.buf = buf;
|
491 | 491 |
frame->content.clients.count = count;
|
492 | 492 |
|
|
548 | 548 |
// list of clients
|
549 | 549 |
g_string_append_printf(output, "%s:",
|
550 | 550 |
g_layout_names[frame->content.clients.layout]);
|
551 | |
Window* buf = frame->content.clients.buf;
|
|
551 |
HSClient** buf = frame->content.clients.buf;
|
552 | 552 |
size_t i, count = frame->content.clients.count;
|
553 | 553 |
for (i = 0; i < count; i++) {
|
554 | |
g_string_append_printf(output, " 0x%lx", buf[i]);
|
|
554 |
g_string_append_printf(output, " 0x%lx", buf[i]->window);
|
555 | 555 |
}
|
556 | 556 |
if (g_cur_frame == frame) {
|
557 | 557 |
g_string_append(output, " [FOCUS]");
|
|
604 | 604 |
} else {
|
605 | 605 |
/* if(frame->type == TYPE_CLIENTS) */
|
606 | 606 |
frame_set_visible(frame, false);
|
607 | |
Window* buf = frame->content.clients.buf;
|
|
607 |
HSClient** buf = frame->content.clients.buf;
|
608 | 608 |
size_t count = frame->content.clients.count;
|
609 | 609 |
size_t selection = frame->content.clients.selection;
|
610 | 610 |
/* border color */
|
611 | 611 |
for (int i = 0; i < count; i++) {
|
612 | |
HSClient* client = get_client_from_window(buf[i]);
|
|
612 |
HSClient* client = buf[i];
|
613 | 613 |
client_setup_border(client, (g_cur_frame == frame) && (i == selection));
|
614 | 614 |
client_resize_floating(client, m);
|
615 | 615 |
}
|
|
672 | 672 |
}
|
673 | 673 |
|
674 | 674 |
void frame_apply_client_layout_linear(HSFrame* frame, XRectangle rect, bool vertical) {
|
675 | |
Window* buf = frame->content.clients.buf;
|
|
675 |
HSClient** buf = frame->content.clients.buf;
|
676 | 676 |
size_t count = frame->content.clients.count;
|
677 | 677 |
int selection = frame->content.clients.selection;
|
678 | 678 |
XRectangle cur = rect;
|
|
696 | 696 |
step_x = cur.width;
|
697 | 697 |
}
|
698 | 698 |
for (int i = 0; i < count; i++) {
|
699 | |
HSClient* client = get_client_from_window(buf[i]);
|
|
699 |
HSClient* client = buf[i];
|
700 | 700 |
// add the space, if count does not divide frameheight without remainder
|
701 | 701 |
cur.height += (i == count-1) ? last_step_y : 0;
|
702 | 702 |
cur.width += (i == count-1) ? last_step_x : 0;
|
|
716 | 716 |
}
|
717 | 717 |
|
718 | 718 |
void frame_apply_client_layout_max(HSFrame* frame, XRectangle rect) {
|
719 | |
Window* buf = frame->content.clients.buf;
|
|
719 |
HSClient** buf = frame->content.clients.buf;
|
720 | 720 |
size_t count = frame->content.clients.count;
|
721 | 721 |
int selection = frame->content.clients.selection;
|
722 | 722 |
for (int i = 0; i < count; i++) {
|
723 | |
HSClient* client = get_client_from_window(buf[i]);
|
|
723 |
HSClient* client = buf[i];
|
724 | 724 |
client_setup_border(client, (g_cur_frame == frame) && (i == selection));
|
725 | 725 |
client_resize_tiling(client, rect, frame);
|
726 | 726 |
if (i == selection) {
|
|
743 | 743 |
}
|
744 | 744 |
|
745 | 745 |
void frame_apply_client_layout_grid(HSFrame* frame, XRectangle rect) {
|
746 | |
Window* buf = frame->content.clients.buf;
|
|
746 |
HSClient** buf = frame->content.clients.buf;
|
747 | 747 |
size_t count = frame->content.clients.count;
|
748 | 748 |
int selection = frame->content.clients.selection;
|
749 | 749 |
if (count == 0) {
|
|
776 | 776 |
}
|
777 | 777 |
|
778 | 778 |
// apply size
|
779 | |
HSClient* client = get_client_from_window(buf[i]);
|
|
779 |
HSClient* client = buf[i];
|
780 | 780 |
client_setup_border(client, (g_cur_frame == frame) && (i == selection));
|
781 | 781 |
client_resize_tiling(client, cur, frame);
|
782 | 782 |
cur.x += width;
|
|
929 | 929 |
return HERBST_INVALID_ARGUMENT;
|
930 | 930 |
}
|
931 | 931 |
tag_move_client(client, get_current_monitor()->tag);
|
932 | |
focus_window(client->window, false, false);
|
|
932 |
focus_client(client, false, false);
|
933 | 933 |
return 0;
|
934 | 934 |
}
|
935 | 935 |
|
|
950 | 950 |
index = frame->content.clients.count - 1;
|
951 | 951 |
}
|
952 | 952 |
frame->content.clients.selection = index;
|
953 | |
Window window = frame->content.clients.buf[index];
|
|
953 |
Window window = frame->content.clients.buf[index]->window;
|
954 | 954 |
window_focus(window);
|
955 | 955 |
return 0;
|
956 | 956 |
}
|
|
975 | 975 |
index += count;
|
976 | 976 |
index %= count;
|
977 | 977 |
frame->content.clients.selection = index;
|
978 | |
Window window = frame->content.clients.buf[index];
|
|
978 |
Window window = frame->content.clients.buf[index]->window;
|
979 | 979 |
window_focus(window);
|
980 | 980 |
return 0;
|
981 | 981 |
}
|
|
1135 | 1135 |
index %= frame->content.clients.count;
|
1136 | 1136 |
frame->content.clients.selection = index;
|
1137 | 1137 |
}
|
1138 | |
Window w = frame_focused_window(g_cur_frame);
|
1139 | |
if (w) {
|
1140 | |
HSClient* c = get_client_from_window(w);
|
1141 | |
if (c) {
|
1142 | |
client_raise(c);
|
1143 | |
}
|
|
1138 |
HSClient* c = frame_focused_client(g_cur_frame);
|
|
1139 |
if (c) {
|
|
1140 |
client_raise(c);
|
1144 | 1141 |
}
|
1145 | 1142 |
monitor_apply_layout(get_current_monitor());
|
1146 | 1143 |
return 0;
|
|
1431 | 1428 |
if (!external_only &&
|
1432 | 1429 |
(index = frame_inner_neighbour_index(g_cur_frame, direction)) != -1) {
|
1433 | 1430 |
int selection = g_cur_frame->content.clients.selection;
|
1434 | |
Window* buf = g_cur_frame->content.clients.buf;
|
|
1431 |
HSClient** buf = g_cur_frame->content.clients.buf;
|
1435 | 1432 |
// if internal neighbour was found, then swap
|
1436 | |
Window tmp = buf[selection];
|
|
1433 |
HSClient* tmp = buf[selection];
|
1437 | 1434 |
buf[selection] = buf[index];
|
1438 | 1435 |
buf[index] = tmp;
|
1439 | 1436 |
|
|
1442 | 1439 |
monitor_apply_layout(get_current_monitor());
|
1443 | 1440 |
} else {
|
1444 | 1441 |
HSFrame* neighbour = frame_neighbour(g_cur_frame, direction);
|
1445 | |
Window win = frame_focused_window(g_cur_frame);
|
1446 | |
if (win && neighbour != NULL) { // if neighbour was found
|
|
1442 |
HSClient* client = frame_focused_client(g_cur_frame);
|
|
1443 |
if (client && neighbour != NULL) { // if neighbour was found
|
1447 | 1444 |
// move window to neighbour
|
1448 | |
frame_remove_window(g_cur_frame, win);
|
1449 | |
frame_insert_window(neighbour, win);
|
|
1445 |
frame_remove_client(g_cur_frame, client);
|
|
1446 |
frame_insert_client(neighbour, client);
|
1450 | 1447 |
|
1451 | 1448 |
// change selection in parent
|
1452 | 1449 |
HSFrame* parent = neighbour->parent;
|
|
1457 | 1454 |
HSFrame* frame = g_cur_frame;
|
1458 | 1455 |
assert(frame);
|
1459 | 1456 |
int i;
|
1460 | |
Window* buf = frame->content.clients.buf;
|
|
1457 |
HSClient** buf = frame->content.clients.buf;
|
1461 | 1458 |
size_t count = frame->content.clients.count;
|
1462 | 1459 |
for (i = 0; i < count; i++) {
|
1463 | |
if (buf[i] == win) {
|
|
1460 |
if (buf[i] == client) {
|
1464 | 1461 |
frame->content.clients.selection = i;
|
1465 | |
window_focus(buf[i]);
|
|
1462 |
window_focus(buf[i]->window);
|
1466 | 1463 |
break;
|
1467 | 1464 |
}
|
1468 | 1465 |
}
|
|
1482 | 1479 |
//XSetInputFocus(g_display, g_root, RevertToPointerRoot, CurrentTime);
|
1483 | 1480 |
}
|
1484 | 1481 |
|
1485 | |
Window frame_focused_window(HSFrame* frame) {
|
|
1482 |
HSClient* frame_focused_client(HSFrame* frame) {
|
1486 | 1483 |
if (!frame) {
|
1487 | |
return (Window)0;
|
|
1484 |
return NULL;
|
1488 | 1485 |
}
|
1489 | 1486 |
// follow the selection to a leave
|
1490 | 1487 |
while (frame->type == TYPE_FRAMES) {
|
|
1496 | 1493 |
int selection = frame->content.clients.selection;
|
1497 | 1494 |
return frame->content.clients.buf[selection];
|
1498 | 1495 |
} // else, if there are no windows
|
1499 | |
return (Window)0;
|
|
1496 |
return NULL;
|
1500 | 1497 |
}
|
1501 | 1498 |
|
1502 | 1499 |
// try to focus window in frame
|
1503 | 1500 |
// it does not require anything from the frame. it may be infocused or even
|
1504 | 1501 |
// hidden.
|
1505 | 1502 |
// returns true if win was found and focused, else returns false
|
1506 | |
bool frame_focus_window(HSFrame* frame, Window win) {
|
|
1503 |
bool frame_focus_client(HSFrame* frame, HSClient* client) {
|
1507 | 1504 |
if (!frame) {
|
1508 | 1505 |
return false;
|
1509 | 1506 |
}
|
1510 | 1507 |
if (frame->type == TYPE_CLIENTS) {
|
1511 | 1508 |
int i;
|
1512 | 1509 |
size_t count = frame->content.clients.count;
|
1513 | |
Window* buf = frame->content.clients.buf;
|
|
1510 |
HSClient** buf = frame->content.clients.buf;
|
1514 | 1511 |
// search for win in buf
|
1515 | 1512 |
for (i = 0; i < count; i++) {
|
1516 | |
if (buf[i] == win) {
|
|
1513 |
if (buf[i] == client) {
|
1517 | 1514 |
// if found, set focus to it
|
1518 | 1515 |
frame->content.clients.selection = i;
|
1519 | 1516 |
return true;
|
|
1523 | 1520 |
} else {
|
1524 | 1521 |
// type == TYPE_FRAMES
|
1525 | 1522 |
// search in subframes
|
1526 | |
bool found = frame_focus_window(frame->content.layout.a, win);
|
|
1523 |
bool found = frame_focus_client(frame->content.layout.a, client);
|
1527 | 1524 |
if (found) {
|
1528 | 1525 |
// set selection to first frame
|
1529 | 1526 |
frame->content.layout.selection = 0;
|
1530 | 1527 |
return true;
|
1531 | 1528 |
}
|
1532 | |
found = frame_focus_window(frame->content.layout.b, win);
|
|
1529 |
found = frame_focus_client(frame->content.layout.b, client);
|
1533 | 1530 |
if (found) {
|
1534 | 1531 |
// set selection to second frame
|
1535 | 1532 |
frame->content.layout.selection = 1;
|
|
1543 | 1540 |
// switch_tag tells, whether to switch tag to focus to window
|
1544 | 1541 |
// switch_monitor tells, whether to switch monitor to focus to window
|
1545 | 1542 |
// returns if window was focused or not
|
1546 | |
bool focus_window(Window win, bool switch_tag, bool switch_monitor) {
|
1547 | |
HSClient* client = get_client_from_window(win);
|
|
1543 |
bool focus_client(struct HSClient* client, bool switch_tag, bool switch_monitor) {
|
1548 | 1544 |
if (!client) {
|
1549 | 1545 |
// client is not managed
|
1550 | 1546 |
return false;
|
|
1582 | 1578 |
}
|
1583 | 1579 |
// now the right tag is visible
|
1584 | 1580 |
// now focus it
|
1585 | |
bool found = frame_focus_window(tag->frame, win);
|
|
1581 |
bool found = frame_focus_client(tag->frame, client);
|
1586 | 1582 |
frame_focus_recursive(tag->frame);
|
1587 | 1583 |
monitor_apply_layout(cur_mon);
|
1588 | 1584 |
monitors_unlock();
|
|
1600 | 1596 |
frame_unfocus();
|
1601 | 1597 |
if (frame->content.clients.count) {
|
1602 | 1598 |
int selection = frame->content.clients.selection;
|
1603 | |
window_focus(frame->content.clients.buf[selection]);
|
|
1599 |
window_focus(frame->content.clients.buf[selection]->window);
|
1604 | 1600 |
} else {
|
1605 | 1601 |
window_unfocus_last();
|
1606 | 1602 |
}
|
|
1649 | 1645 |
frame_set_visible(frame, false);
|
1650 | 1646 |
if (frame->type == TYPE_CLIENTS) {
|
1651 | 1647 |
int i;
|
1652 | |
Window* buf = frame->content.clients.buf;
|
|
1648 |
HSClient** buf = frame->content.clients.buf;
|
1653 | 1649 |
size_t count = frame->content.clients.count;
|
1654 | 1650 |
for (i = 0; i < count; i++) {
|
1655 | |
window_hide(buf[i]);
|
|
1651 |
window_hide(buf[i]->window);
|
1656 | 1652 |
}
|
1657 | 1653 |
}
|
1658 | 1654 |
}
|
|
1665 | 1661 |
static void frame_show_clients(HSFrame* frame) {
|
1666 | 1662 |
if (frame->type == TYPE_CLIENTS) {
|
1667 | 1663 |
int i;
|
1668 | |
Window* buf = frame->content.clients.buf;
|
|
1664 |
HSClient** buf = frame->content.clients.buf;
|
1669 | 1665 |
size_t count = frame->content.clients.count;
|
1670 | 1666 |
for (i = 0; i < count; i++) {
|
1671 | |
window_show(buf[i]);
|
|
1667 |
window_show(buf[i]->window);
|
1672 | 1668 |
}
|
1673 | 1669 |
}
|
1674 | 1670 |
}
|
|
1719 | 1715 |
second = parent->content.layout.a;
|
1720 | 1716 |
}
|
1721 | 1717 |
size_t count;
|
1722 | |
Window* wins;
|
|
1718 |
HSClient** wins;
|
1723 | 1719 |
// get all wins from first child
|
1724 | 1720 |
frame_destroy(first, &wins, &count);
|
1725 | 1721 |
// and insert them to other child.. inefficiently
|
1726 | 1722 |
int i;
|
1727 | 1723 |
for (i = 0; i < count; i++) {
|
1728 | |
frame_insert_window(second, wins[i]);
|
|
1724 |
frame_insert_client(second, wins[i]);
|
1729 | 1725 |
}
|
1730 | 1726 |
g_free(wins);
|
1731 | 1727 |
XDestroyWindow(g_display, parent->window);
|
|
1751 | 1747 |
}
|
1752 | 1748 |
|
1753 | 1749 |
int close_or_remove_command(int argc, char** argv) {
|
1754 | |
if (frame_focused_window(g_cur_frame)) {
|
|
1750 |
if (frame_focused_client(g_cur_frame)) {
|
1755 | 1751 |
return window_close_current();
|
1756 | 1752 |
} else {
|
1757 | 1753 |
return frame_remove_command(argc, argv);
|
|
1788 | 1784 |
}
|
1789 | 1785 |
} else {
|
1790 | 1786 |
// frame->type == TYPE_CLIENTS
|
1791 | |
Window* buf = frame->content.clients.buf;
|
|
1787 |
HSClient** buf = frame->content.clients.buf;
|
1792 | 1788 |
size_t count = frame->content.clients.count;
|
1793 | 1789 |
HSClient* client;
|
1794 | 1790 |
for (int i = 0; i < count; i++) {
|
1795 | |
client = get_client_from_window(buf[i]);
|
|
1791 |
client = buf[i];
|
1796 | 1792 |
// do action for each client
|
1797 | 1793 |
status = action(client, data);
|
1798 | 1794 |
if (0 != status) {
|