| 97 | }; |
| 98 | |
| 99 | class WayfireSwitcher : public wf::per_output_plugin_instance_t, public wf::keyboard_interaction_t |
| 100 | { |
| 101 | wf::option_wrapper_t<double> view_thumbnail_scale{ |
| 102 | "switcher/view_thumbnail_scale"}; |
| 103 | wf::option_wrapper_t<wf::animation_description_t> speed{"switcher/speed"}; |
| 104 | wf::option_wrapper_t<int> view_thumbnail_rotation{ |
| 105 | "switcher/view_thumbnail_rotation"}; |
| 106 | |
| 107 | duration_t duration{speed}; |
| 108 | duration_t background_dim_duration{speed}; |
| 109 | timed_transition_t background_dim{background_dim_duration}; |
| 110 | |
| 111 | std::unique_ptr<wf::input_grab_t> input_grab; |
| 112 | |
| 113 | /* If a view comes before another in this list, it is on top of it */ |
| 114 | std::vector<SwitcherView> views; |
| 115 | |
| 116 | // the modifiers which were used to activate switcher |
| 117 | uint32_t activating_modifiers = 0; |
| 118 | bool active = false; |
| 119 | |
| 120 | class switcher_render_node_t : public wf::scene::node_t |
| 121 | { |
| 122 | class switcher_render_instance_t : public wf::scene::render_instance_t |
| 123 | { |
| 124 | std::shared_ptr<switcher_render_node_t> self; |
| 125 | wf::scene::damage_callback push_damage; |
| 126 | wf::signal::connection_t<wf::scene::node_damage_signal> on_switcher_damage = |
| 127 | [=] (wf::scene::node_damage_signal *ev) |
| 128 | { |
| 129 | push_damage(ev->region); |
| 130 | }; |
| 131 | |
| 132 | public: |
| 133 | switcher_render_instance_t(switcher_render_node_t *self, wf::scene::damage_callback push_damage) |
| 134 | { |
| 135 | this->self = std::dynamic_pointer_cast<switcher_render_node_t>(self->shared_from_this()); |
| 136 | this->push_damage = push_damage; |
| 137 | self->connect(&on_switcher_damage); |
| 138 | } |
| 139 | |
| 140 | void schedule_instructions( |
| 141 | std::vector<wf::scene::render_instruction_t>& instructions, |
| 142 | const wf::render_target_t& target, wf::region_t& damage) override |
| 143 | { |
| 144 | instructions.push_back(wf::scene::render_instruction_t{ |
| 145 | .instance = this, |
| 146 | .target = target, |
| 147 | .damage = damage & self->get_bounding_box(), |
| 148 | }); |
| 149 | |
| 150 | // Don't render anything below |
| 151 | auto bbox = self->get_bounding_box(); |
| 152 | damage ^= bbox; |
| 153 | } |
| 154 | |
| 155 | void render(const wf::scene::render_instruction_t& data) override |
| 156 | { |
nothing calls this directly
no test coverage detected