Tries to initialize renderer, activate plugin, etc. */
| 357 | |
| 358 | /* Tries to initialize renderer, activate plugin, etc. */ |
| 359 | bool activate() |
| 360 | { |
| 361 | if (output->is_plugin_active(grab_interface.name)) |
| 362 | { |
| 363 | return true; |
| 364 | } |
| 365 | |
| 366 | if (!output->activate_plugin(&grab_interface)) |
| 367 | { |
| 368 | return false; |
| 369 | } |
| 370 | |
| 371 | wf::get_core().connect(&on_motion_event); |
| 372 | |
| 373 | render_node = std::make_shared<cube_render_node_t>(this); |
| 374 | wf::scene::add_front(wf::get_core().scene(), render_node); |
| 375 | output->render->add_effect(&pre_hook, wf::OUTPUT_EFFECT_PRE); |
| 376 | output->render->set_require_depth_buffer(true); |
| 377 | |
| 378 | wf::get_core().hide_cursor(); |
| 379 | input_grab->grab_input(wf::scene::layer::OVERLAY); |
| 380 | |
| 381 | auto wsize = output->wset()->get_workspace_grid_size(); |
| 382 | animation.side_angle = 2 * M_PI / float(wsize.width); |
| 383 | identity_z_offset = 0.5 / std::tan(animation.side_angle / 2); |
| 384 | if (wsize.width == 1) |
| 385 | { |
| 386 | // tan(M_PI) is 0, so identity_z_offset is invalid |
| 387 | identity_z_offset = 0.0f; |
| 388 | } |
| 389 | |
| 390 | reload_background(); |
| 391 | animation.cube_animation.offset_z.set(identity_z_offset + Z_OFFSET_NEAR, |
| 392 | identity_z_offset + Z_OFFSET_NEAR); |
| 393 | return true; |
| 394 | } |
| 395 | |
| 396 | int calculate_viewport_dx_from_rotation() |
| 397 | { |
nothing calls this directly
no test coverage detected