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

Method init

plugins/single_plugins/wrot.cpp:170–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168
169 public:
170 void init() override
171 {
172 input_grab = std::make_unique<wf::input_grab_t>("wrot", output, nullptr, this, nullptr);
173 call = [=] (auto)
174 {
175 if (current_mode != mode::NONE)
176 {
177 return false;
178 }
179
180 if (!output->activate_plugin(&grab_interface))
181 {
182 return false;
183 }
184
185 current_view = toplevel_cast(wf::get_core().get_cursor_focus_view());
186 if (!current_view || (current_view->role != wf::VIEW_ROLE_TOPLEVEL))
187 {
188 output->deactivate_plugin(&grab_interface);
189 return false;
190 }
191
192 wf::get_core().default_wm->focus_raise_view(current_view);
193 current_view->connect(&current_view_unmapped);
194 input_grab->grab_input(wf::scene::layer::OVERLAY);
195
196 last_position = output->get_cursor_position();
197 current_mode = mode::ROT_2D;
198 return false; // pass btn press to the grab node
199 };
200
201 output->add_button(wf::option_wrapper_t<wf::buttonbinding_t>("wrot/activate"), &call);
202 output->add_button(wf::option_wrapper_t<wf::buttonbinding_t>("wrot/activate-3d"), &call_3d);
203 output->add_key(wf::option_wrapper_t<wf::keybinding_t>{"wrot/reset"}, &reset);
204 output->add_key(wf::option_wrapper_t<wf::keybinding_t>{"wrot/reset-one"}, &reset_one);
205
206 grab_interface.cancel = [=] ()
207 {
208 if (input_grab->is_grabbed())
209 {
210 input_released();
211 }
212 };
213 }
214
215 void handle_pointer_button(const wlr_pointer_button_event& event) override
216 {

Callers

nothing calls this directly

Calls 11

toplevel_castFunction · 0.85
activate_pluginMethod · 0.80
get_cursor_focus_viewMethod · 0.80
deactivate_pluginMethod · 0.80
focus_raise_viewMethod · 0.80
connectMethod · 0.80
is_grabbedMethod · 0.80
grab_inputMethod · 0.45
get_cursor_positionMethod · 0.45
add_buttonMethod · 0.45
add_keyMethod · 0.45

Tested by

no test coverage detected