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

Method input_released

plugins/single_plugins/wrot.cpp:241–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

239 }
240
241 void input_released()
242 {
243 input_grab->ungrab_input();
244 output->deactivate_plugin(&grab_interface);
245 current_view_unmapped.disconnect();
246 if ((current_mode == mode::ROT_3D) && current_view)
247 {
248 auto tr = current_view->get_transformed_node()
249 ->get_transformer<wf::scene::view_3d_transformer_t>(transformer_3d);
250 if (tr)
251 {
252 /* check if the view was rotated to perpendicular to the screen
253 * and move it a bit more, so it will not get "stuck" that way */
254 glm::vec4 n{0, 0, 1.f, 0};
255 glm::vec4 x = tr->rotation * n;
256 auto dot = glm::dot(n, x);
257 if (std::abs(dot) < 0.05)
258 {
259 /* rotate 2.5 degrees around an axis perpendicular to x */
260 current_view->get_transformed_node()->begin_transform_update();
261 tr->rotation = glm::rotate<float>(tr->rotation, glm::radians(
262 dot < 0 ? -2.5f : 2.5f), {x.y, -x.x, 0});
263 current_view->get_transformed_node()->end_transform_update();
264 }
265 }
266 }
267
268 current_mode = mode::NONE;
269 }
270
271 void fini() override
272 {

Callers

nothing calls this directly

Calls 6

absFunction · 0.85
ungrab_inputMethod · 0.80
deactivate_pluginMethod · 0.80
end_transform_updateMethod · 0.80
disconnectMethod · 0.45

Tested by

no test coverage detected