A tiling window manager

window: Rename vscr in rp_window to vscreen

Not sure why I abbreviated this.

+79 -74
+1 -1
actions.c
··· 2873 2873 vscreen_resort_window(rp_current_vscreen, win); 2874 2874 2875 2875 /* Update the window list. */ 2876 - update_window_names(win->win->vscr->screen, 2876 + update_window_names(win->win->vscreen->screen, 2877 2877 defaults.window_fmt); 2878 2878 } 2879 2879
+1 -1
data.h
··· 75 75 }; 76 76 77 77 struct rp_window { 78 - rp_vscreen *vscr; 78 + rp_vscreen *vscreen; 79 79 Window w; 80 80 int state; 81 81 int last_access;
+18 -15
events.c
··· 48 48 void 49 49 show_rudeness_msg(rp_window *win, int raised) 50 50 { 51 - rp_vscreen *v = win->vscr; 51 + rp_vscreen *v = win->vscreen; 52 52 rp_window_elem *elem = vscreen_find_window(&v->mapped_windows, win); 53 53 54 54 if (v == rp_current_vscreen) { ··· 65 65 marked_message_printf(0, 0, raised ? 66 66 MESSAGE_RAISE_TRANSIENT_VSCREEN : 67 67 MESSAGE_MAP_TRANSIENT_VSCREEN, 68 - elem->number, window_name(win), win->vscr->number); 68 + elem->number, window_name(win), 69 + win->vscreen->number); 69 70 else 70 71 marked_message_printf(0, 0, raised ? 71 72 MESSAGE_RAISE_WINDOW_VSCREEN : 72 73 MESSAGE_MAP_WINDOW_VSCREEN, 73 - elem->number, window_name(win), win->vscr->number); 74 + elem->number, window_name(win), 75 + win->vscreen->number); 74 76 } 75 77 } 76 78 ··· 129 131 frame = find_windows_frame(win); 130 132 if (frame) { 131 133 cleanup_frame(frame); 132 - if (frame->number == win->vscr->current_frame 133 - && rp_current_vscreen == win->vscr) 134 + if (frame->number == win->vscreen->current_frame 135 + && rp_current_vscreen == win->vscreen) 134 136 set_active_frame(frame, 0); 135 137 /* Since we may have switched windows, call the hook. */ 136 138 if (frame->win_number != EMPTY) ··· 140 142 break; 141 143 } 142 144 143 - update_window_names(win->vscr->screen, defaults.window_fmt); 145 + update_window_names(win->vscreen->screen, defaults.window_fmt); 144 146 } 145 147 146 148 static void ··· 179 181 case IconicState: 180 182 PRINT_DEBUG(("Mapping Iconic window\n")); 181 183 182 - if (win->vscr != rp_current_vscreen) { 184 + if (win->vscreen != rp_current_vscreen) { 183 185 /* 184 186 * It is always rude to raise a window in another 185 187 * vscreen ··· 235 237 frame = find_windows_frame(win); 236 238 if (frame) { 237 239 cleanup_frame(frame); 238 - if (frame->number == win->vscr->current_frame 239 - && rp_current_vscreen == win->vscr) 240 + if (frame->number == win->vscreen->current_frame 241 + && rp_current_vscreen == win->vscreen) 240 242 set_active_frame(frame, 0); 241 243 /* Since we may have switched windows, call the hook. */ 242 244 if (frame->win_number != EMPTY) ··· 263 265 if (win) { 264 266 if (e->value_mask & CWStackMode) { 265 267 if (e->detail == Above && win->state != WithdrawnState) { 266 - if (win->vscr == rp_current_vscreen) { 268 + if (win->vscreen == rp_current_vscreen) { 267 269 /* 268 270 * Depending on the rudeness level, 269 271 * actually map the window. ··· 362 364 return; 363 365 } 364 366 365 - s = win->vscr->screen; 367 + s = win->vscreen->screen; 366 368 } 367 369 368 370 if (ev->window == s->root) { ··· 404 406 */ 405 407 PRINT_DEBUG(("Iconify Request.\n")); 406 408 if (win->state == NormalState) { 407 - rp_window *w = find_window_other(win->vscr); 409 + rp_window *w = find_window_other(win->vscreen); 408 410 409 411 if (w) 410 412 set_active_window(w); 411 413 else 412 - blank_frame(vscreen_get_frame(win->vscr, 413 - win->vscr->current_frame)); 414 + blank_frame(vscreen_get_frame( 415 + win->vscreen, 416 + win->vscreen->current_frame)); 414 417 } 415 418 } else { 416 419 warnx("non-standard WM_CHANGE_STATE format"); ··· 549 552 } else if (ev->xproperty.atom == XA_WM_NAME) { 550 553 PRINT_DEBUG(("updating window name\n")); 551 554 if (update_window_name(win)) { 552 - update_window_names(win->vscr->screen, 555 + update_window_names(win->vscreen->screen, 553 556 defaults.window_fmt); 554 557 hook_run(&rp_title_changed_hook); 555 558 }
+2 -2
format.c
··· 248 248 static void 249 249 fmt_screen(rp_window_elem *elem, struct sbuf *buf) 250 250 { 251 - sbuf_printf_concat(buf, "%d", elem->win->vscr->screen->screen_num); 251 + sbuf_printf_concat(buf, "%d", elem->win->vscreen->screen->screen_num); 252 252 } 253 253 254 254 static void 255 255 fmt_xrandrscreen(rp_window_elem *elem, struct sbuf *buf) 256 256 { 257 - sbuf_printf_concat(buf, "%d", elem->win->vscr->screen->xrandr.output); 257 + sbuf_printf_concat(buf, "%d", elem->win->vscreen->screen->xrandr.output); 258 258 } 259 259 260 260 static void
+1 -1
globals.c
··· 287 287 PRINT_DEBUG(("Giving focus to '%s'\n", window_name(win))); 288 288 XSetInputFocus(dpy, win->w, 289 289 RevertToPointerRoot, CurrentTime); 290 - set_atom(win->vscr->screen->root, _net_active_window, XA_WINDOW, 290 + set_atom(win->vscreen->screen->root, _net_active_window, XA_WINDOW, 291 291 &win->w, 1); 292 292 } 293 293
+19 -18
manage.c
··· 312 312 #endif 313 313 #ifdef MAXSIZE_WINDOWS_ARE_TRANSIENTS 314 314 || (win->hints->flags & PMaxSize 315 - && (win->hints->max_width < win->vscr->screen->width 316 - || win->hints->max_height < win->vscr->screen->height)) 315 + && (win->hints->max_width < win->vscreen->screen->width 316 + || win->hints->max_height < win->vscreen->screen->height)) 317 317 #endif 318 318 ; 319 319 } ··· 392 392 unmanage(rp_window *w) 393 393 { 394 394 list_del(&w->node); 395 - vscreen_del_window(w->vscr, w); 395 + vscreen_del_window(w->vscreen, w); 396 396 397 397 remove_atom(rp_glob_screen.root, _net_client_list, XA_WINDOW, w->w); 398 398 remove_atom(rp_glob_screen.root, _net_client_list_stacking, XA_WINDOW, ··· 551 551 frame = win_get_frame(win); 552 552 553 553 if (win->full_screen) { 554 - win->x = win->vscr->screen->left; 555 - win->y = win->vscr->screen->top; 554 + win->x = win->vscreen->screen->left; 555 + win->y = win->vscreen->screen->top; 556 556 return; 557 557 } 558 558 559 - if (defaults.only_border == 0 && num_frames(win->vscr) <= 1) 559 + if (defaults.only_border == 0 && num_frames(win->vscreen) <= 1) 560 560 gap = 0; 561 561 else 562 562 gap = defaults.gap; ··· 638 638 } 639 639 640 640 /* Set the window's border */ 641 - if ((defaults.only_border == 0 && num_frames(win->vscr) <= 1) || 641 + if ((defaults.only_border == 0 && num_frames(win->vscreen) <= 1) || 642 642 win->full_screen) 643 643 win->border = 0; 644 644 else 645 645 win->border = defaults.window_border_width; 646 646 647 647 if (win->full_screen) { 648 - maxw = win->vscr->screen->width; 649 - maxh = win->vscr->screen->height; 648 + maxw = win->vscreen->screen->width; 649 + maxh = win->vscreen->screen->height; 650 650 } else { 651 651 if (transient) { 652 652 maxw = win->width; ··· 672 672 PRINT_DEBUG(("adjusted to frame, maxsize %d %d\n", maxw, maxh)); 673 673 674 674 if (!transient && !(defaults.only_border == 0 && 675 - num_frames(win->vscr) <= 1)) { 675 + num_frames(win->vscreen) <= 1)) { 676 676 int fw, fh; 677 677 678 678 gap = (frame_right_screen_edge(frame) ? 0 : 1); ··· 795 795 * geometry changes were made. This initial resize solves the problem. 796 796 */ 797 797 if (!defaults.ignore_resize_hints && (win->hints->flags & PResizeInc)) { 798 - XMoveResizeWindow(dpy, win->w, win->vscr->screen->left + win->x, 799 - win->vscr->screen->top + win->y, 798 + XMoveResizeWindow(dpy, win->w, 799 + win->vscreen->screen->left + win->x, 800 + win->vscreen->screen->top + win->y, 800 801 win->width + win->hints->width_inc, 801 802 win->height + win->hints->height_inc); 802 803 } else { ··· 806 807 XSync(dpy, False); 807 808 808 809 /* Resize the window to its proper maximum size. */ 809 - XMoveResizeWindow(dpy, win->w, win->vscr->screen->left + win->x, 810 - win->vscr->screen->top + win->y, win->width, win->height); 810 + XMoveResizeWindow(dpy, win->w, win->vscreen->screen->left + win->x, 811 + win->vscreen->screen->top + win->y, win->width, win->height); 811 812 XSetWindowBorderWidth(dpy, win->w, win->border); 812 813 813 814 XSync(dpy, False); ··· 828 829 (transfor = find_window(win->transient_for))) { 829 830 PRINT_DEBUG(("map_window: transient_for %lu\n", 830 831 win->transient_for)); 831 - win->vscr = transfor->vscr; 832 + win->vscreen = transfor->vscreen; 832 833 win->intended_frame_number = transfor->frame_number; 833 834 } 834 835 ··· 839 840 list_del(&win->node); 840 841 insert_into_list(win, &rp_mapped_window); 841 842 842 - vscreen_map_window(win->vscr, win); 843 + vscreen_map_window(win->vscreen, win); 843 844 844 845 /* 845 846 * The window has never been accessed since it was brought back from the ··· 938 939 list_move_tail(&win->node, &rp_unmapped_window); 939 940 940 941 /* Update the vscreens. */ 941 - vscreen_unmap_window(win->vscr, win); 942 + vscreen_unmap_window(win->vscreen, win); 942 943 943 944 ignore_badwindow++; 944 945 ··· 982 983 rp_window *cur; 983 984 984 985 list_for_each_entry(cur, &rp_mapped_window, node) 985 - if (cur->vscr == v) 986 + if (cur->vscreen == v) 986 987 hide_window(cur); 987 988 } 988 989
+7 -7
split.c
··· 76 76 * screen, since with Xrandr, windows can move from one screen 77 77 * to another. 78 78 */ 79 - win->vscr = frame->vscreen; 79 + win->vscreen = frame->vscreen; 80 80 } else { 81 81 frame->win_number = EMPTY; 82 82 } ··· 162 162 rp_vscreen *v; 163 163 rp_frame *cur; 164 164 165 - v = win->vscr; 165 + v = win->vscreen; 166 166 167 167 list_for_each_entry(cur, &v->frames, node) { 168 168 if (cur->win_number == win->number) ··· 335 335 336 336 /* Hide all the windows not in the current frame. */ 337 337 list_for_each_entry(win, &rp_mapped_window, node) { 338 - if (win->frame_number != v->current_frame && win->vscr == v) 338 + if (win->frame_number != v->current_frame && win->vscreen == v) 339 339 hide_window(win); 340 340 341 341 if (win->sticky_frame != EMPTY && 342 - win->sticky_frame != v->current_frame && win->vscr == v) 342 + win->sticky_frame != v->current_frame && win->vscreen == v) 343 343 win->sticky_frame = EMPTY; 344 344 } 345 345 ··· 672 672 hide_others(win); 673 673 674 674 list_for_each_entry(win, &rp_mapped_window, node) { 675 - if (win->sticky_frame == frame->number && win->vscr == v) 675 + if (win->sticky_frame == frame->number && win->vscreen == v) 676 676 win->sticky_frame = EMPTY; 677 677 } 678 678 ··· 835 835 if (win) { 836 836 maximize(win); 837 837 /* Make sure the program bar is always on the top */ 838 - update_window_names(win->vscr->screen, defaults.window_fmt); 838 + update_window_names(win->vscreen->screen, defaults.window_fmt); 839 839 } 840 840 /* Make the switch */ 841 841 update_last_access(frame); ··· 901 901 frame = current_frame(rp_current_vscreen); 902 902 win = current_window(); 903 903 if (win) { 904 - elem = vscreen_find_window(&win->vscr->mapped_windows, win); 904 + elem = vscreen_find_window(&win->vscreen->mapped_windows, win); 905 905 if (!elem) 906 906 warnx("window 0x%lx not on any vscreen\n", 907 907 (unsigned long)win->w);
+6 -6
vscreen.c
··· 55 55 target = screen_find_vscreen_by_number(s, 0); 56 56 57 57 list_for_each_entry(cur, &rp_mapped_window, node) { 58 - if (cur->vscr == v && target) 58 + if (cur->vscreen == v && target) 59 59 vscreen_move_window(target, cur); 60 60 } 61 61 ··· 254 254 continue; 255 255 256 256 win = find_window_number(frame->restore_win_number); 257 - if (win && win->vscr != v) { 257 + if (win && win->vscreen != v) { 258 258 warnx("restore win for frame %d on incorrect vscreen\n", 259 259 frame->number); 260 260 win = NULL; ··· 293 293 void 294 294 vscreen_move_window(rp_vscreen *to, rp_window *w) 295 295 { 296 - rp_vscreen *from = w->vscr; 296 + rp_vscreen *from = w->vscreen; 297 297 rp_frame *f; 298 298 rp_window_elem *we; 299 299 struct rp_child_info *child; ··· 305 305 } 306 306 307 307 f = find_windows_frame(w); 308 - w->vscr = to; 308 + w->vscreen = to; 309 309 w->sticky_frame = EMPTY; 310 310 311 311 /* forget that this window was in the frame it was in */ ··· 630 630 if (cur->win->last_access >= last_access 631 631 && cur->win != current_window() 632 632 && !find_windows_frame(cur->win) 633 - && (cur->win->vscr == v || rp_have_xrandr)) { 633 + && (cur->win->vscreen == v || rp_have_xrandr)) { 634 634 most_recent = cur; 635 635 last_access = cur->win->last_access; 636 636 } ··· 673 673 continue; 674 674 675 675 if (!find_windows_frame(cur->win) && 676 - (cur->win->vscr == win->vscr || rp_have_xrandr)) 676 + (cur->win->vscreen == win->vscreen || rp_have_xrandr)) 677 677 return cur->win; 678 678 } 679 679
+24 -23
window.c
··· 38 38 int root_x, root_y; 39 39 unsigned int mask; 40 40 41 - XQueryPointer(dpy, win->vscr->screen->root, &root_win, &child_win, 41 + XQueryPointer(dpy, win->vscreen->screen->root, &root_win, &child_win, 42 42 mouse_x, mouse_y, &root_x, &root_y, &mask); 43 43 } 44 44 ··· 161 161 new_window = xmalloc(sizeof(rp_window)); 162 162 163 163 new_window->w = w; 164 - new_window->vscr = s->current_vscreen; 164 + new_window->vscreen = s->current_vscreen; 165 165 new_window->last_access = 0; 166 166 new_window->state = WithdrawnState; 167 167 new_window->number = -1; ··· 194 194 195 195 child_info = get_child_info(w, 1); 196 196 if (child_info) { 197 - if (child_info->vscreen != new_window->vscr) 198 - new_window->vscr = child_info->vscreen; 197 + if (child_info->vscreen != new_window->vscreen) 198 + new_window->vscreen = child_info->vscreen; 199 199 200 200 if (!child_info->window_mapped) { 201 201 rp_frame *frame = vscreen_find_frame_by_frame( ··· 217 217 if (vscreen) 218 218 vscreen_add_window(vscreen, new_window); 219 219 else 220 - vscreen_add_window(new_window->vscr, new_window); 220 + vscreen_add_window(new_window->vscreen, new_window); 221 221 222 222 PRINT_DEBUG(("frame_num: %d\n", frame_num)); 223 223 if (frame_num >= 0) ··· 386 386 XSetWindowBorder(dpy, win->w, rp_glob_screen.fw_color); 387 387 388 388 /* Finally, give the window focus */ 389 - rp_current_screen = win->vscr->screen; 390 - rp_current_screen->current_vscreen = win->vscr; 389 + rp_current_screen = win->vscreen->screen; 390 + rp_current_screen->current_vscreen = win->vscreen; 391 391 set_rp_window_focus(win); 392 392 393 393 raise_utility_windows(); ··· 442 442 443 443 /* use the intended frame if we can. */ 444 444 if (win->intended_frame_number >= 0) { 445 - frame = vscreen_get_frame(win->vscr, 445 + frame = vscreen_get_frame(win->vscreen, 446 446 win->intended_frame_number); 447 447 win->intended_frame_number = -1; 448 - if (frame != current_frame(win->vscr)) 449 - last_frame = current_frame(win->vscr); 448 + if (frame != current_frame(win->vscreen)) 449 + last_frame = current_frame(win->vscreen); 450 450 } 451 451 if (frame == NULL) 452 - frame = vscreen_get_frame(win->vscr, win->vscr->current_frame); 452 + frame = vscreen_get_frame(win->vscreen, 453 + win->vscreen->current_frame); 453 454 454 455 if (frame->dedicated && !force) { 455 456 /* Try to find a non-dedicated frame. */ 456 457 rp_frame *non_dedicated; 457 458 458 - non_dedicated = find_frame_non_dedicated(win->vscr); 459 + non_dedicated = find_frame_non_dedicated(win->vscreen); 459 460 if (non_dedicated != NULL) { 460 461 last_frame = frame; 461 462 frame = non_dedicated; 462 - if (win->vscr == rp_current_vscreen) 463 + if (win->vscreen == rp_current_vscreen) 463 464 set_active_frame(frame, 0); 464 465 } 465 466 } ··· 472 473 /* Make sure the window comes up full screen */ 473 474 maximize(win); 474 475 475 - if (win->vscr == rp_current_vscreen) 476 + if (win->vscreen == rp_current_vscreen) 476 477 /* Focus the window. */ 477 478 give_window_focus(win, last_win); 478 479 ··· 483 484 if (!window_is_transient(win)) 484 485 hide_others(win); 485 486 486 - if (win->vscr == rp_current_vscreen) 487 + if (win->vscreen == rp_current_vscreen) 487 488 /* Make sure the program bar is always on the top */ 488 - update_window_names(win->vscr->screen, defaults.window_fmt); 489 + update_window_names(win->vscreen->screen, defaults.window_fmt); 489 490 490 491 XSync(dpy, False); 491 492 492 493 /* If we switched frame, go back to the old one. */ 493 - if (win->vscr == rp_current_vscreen) { 494 + if (win->vscreen == rp_current_vscreen) { 494 495 if (last_frame != NULL) 495 496 set_active_frame(last_frame, 0); 496 497 ··· 609 610 610 611 list_for_each_safe_entry(cur, iter, tmp, &rp_unmapped_window, node) { 611 612 list_del(&cur->node); 612 - vscreen_del_window(cur->vscr, cur); 613 + vscreen_del_window(cur->vscreen, cur); 613 614 free_window(cur); 614 615 } 615 616 616 617 list_for_each_safe_entry(cur, iter, tmp, &rp_mapped_window, node) { 617 618 list_del(&cur->node); 618 - vscreen_unmap_window(cur->vscr, cur); 619 - vscreen_del_window(cur->vscr, cur); 619 + vscreen_unmap_window(cur->vscreen, cur); 620 + vscreen_del_window(cur->vscreen, cur); 620 621 free_window(cur); 621 622 } 622 623 ··· 627 628 win_get_frame(rp_window *win) 628 629 { 629 630 if (win->frame_number != EMPTY) 630 - return vscreen_get_frame(win->vscr, win->frame_number); 631 + return vscreen_get_frame(win->vscreen, win->frame_number); 631 632 632 633 return NULL; 633 634 } ··· 638 639 rp_window *win; 639 640 640 641 list_for_each_entry(win, &rp_mapped_window, node) { 641 - if (win->vscr == old_vscreen) 642 - win->vscr = new_vscreen; 642 + if (win->vscreen == old_vscreen) 643 + win->vscreen = new_vscreen; 643 644 } 644 645 } 645 646