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

Method next_view

plugins/single_plugins/switcher.cpp:794–837  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

792 }
793
794 void next_view(int dir)
795 {
796 cleanup_expired();
797
798 if (count_different_active_views() <= 1)
799 {
800 return;
801 }
802
803 /* Count of views in the left/right slots */
804 int count_right = 0;
805 int count_left = 0;
806
807 /* Move the topmost view from the center and the left/right group,
808 * depending on the direction*/
809 int to_move = (1 << SWITCHER_POSITION_CENTER) | (1 << (1 - dir));
810 for (auto& sv : views)
811 {
812 if (!view_expired(sv.position) && ((1 << sv.position) & to_move))
813 {
814 to_move ^= (1 << sv.position); // only the topmost one
815 move(sv, dir);
816 } else if (!view_expired(sv.position))
817 {
818 /* Make sure animations start from where we are now */
819 sv.refresh_start();
820 }
821
822 count_left += (sv.position == SWITCHER_POSITION_LEFT);
823 count_right += (sv.position == SWITCHER_POSITION_RIGHT);
824 }
825
826 /* Create a new view on the missing slot, but if both are missing,
827 * show just the centered view */
828 if (bool(count_left) ^ bool(count_right))
829 {
830 const int empty_slot = 1 - dir;
831 fill_empty_slot(empty_slot);
832 }
833
834 rebuild_view_list();
835 wf::view_bring_to_front(views.front().view);
836 duration.start();
837 }
838
839 int count_different_active_views()
840 {

Callers

nothing calls this directly

Calls 2

view_expiredFunction · 0.85
refresh_startMethod · 0.80

Tested by

no test coverage detected