MCPcopy Create free account
hub / github.com/WayfireWM/wayfire / arrange

Method arrange

plugins/single_plugins/switcher.cpp:523–570  ·  view source on GitHub ↗

Create the initial arrangement on the screen * Also changes the focus to the next or the last view, depending on dir */

Source from the content-addressed store, hash-verified

521 /* Create the initial arrangement on the screen
522 * Also changes the focus to the next or the last view, depending on dir */
523 void arrange()
524 {
525 // clear views in case that deinit() hasn't been run
526 views.clear();
527
528 duration.start();
529 background_dim.set(1, background_dim_factor);
530 background_dim_duration.start();
531
532 auto ws_views = get_workspace_views();
533 for (auto v : ws_views)
534 {
535 views.push_back(create_switcher_view(v));
536 }
537
538 std::sort(views.begin(), views.end(), [] (SwitcherView& a, SwitcherView& b)
539 {
540 return wf::get_focus_timestamp(a.view) > wf::get_focus_timestamp(b.view);
541 });
542
543 if (ws_views.empty())
544 {
545 return;
546 }
547
548 /* Add a copy of the unfocused view if we have just 2 */
549 if (ws_views.size() == 2)
550 {
551 views.push_back(create_switcher_view(ws_views.back()));
552 }
553
554 arrange_view(views[0], SWITCHER_POSITION_CENTER);
555
556 /* If we have just 1 view, don't do anything else */
557 if (ws_views.size() > 1)
558 {
559 arrange_view(views.back(), SWITCHER_POSITION_LEFT);
560 }
561
562 for (int i = 1; i < (int)views.size() - 1; i++)
563 {
564 arrange_view(views[i], SWITCHER_POSITION_RIGHT);
565 }
566
567 // We want the next view to be focused right off the bat
568 // But we want it to be animated.
569 handle_switch_request(-1);
570 }
571
572 void dearrange()
573 {

Callers

nothing calls this directly

Calls 6

get_focus_timestampFunction · 0.85
beginMethod · 0.80
endMethod · 0.80
emptyMethod · 0.80
clearMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected