| 767 | |
| 768 | |
| 769 | class wayfire_cube_global : public wf::plugin_interface_t, |
| 770 | public wf::per_output_tracker_mixin_t<wayfire_cube> |
| 771 | { |
| 772 | wf::ipc_activator_t rotate_left{"cube/rotate_left"}; |
| 773 | wf::ipc_activator_t rotate_right{"cube/rotate_right"}; |
| 774 | wf::ipc_activator_t activate{"cube/activate"}; |
| 775 | |
| 776 | public: |
| 777 | void init() override |
| 778 | { |
| 779 | if (!wf::get_core().is_gles2()) |
| 780 | { |
| 781 | const char *render_type = |
| 782 | wf::get_core().is_vulkan() ? "vulkan" : (wf::get_core().is_pixman() ? "pixman" : "unknown"); |
| 783 | LOGE("cube: requires GLES2 support, but current renderer is ", render_type); |
| 784 | return; |
| 785 | } |
| 786 | |
| 787 | this->init_output_tracking(); |
| 788 | rotate_left.set_handler(rotate_left_cb); |
| 789 | rotate_right.set_handler(rotate_right_cb); |
| 790 | activate.set_handler(activate_cb); |
| 791 | } |
| 792 | |
| 793 | void fini() override |
| 794 | { |
| 795 | this->fini_output_tracking(); |
| 796 | } |
| 797 | |
| 798 | wf::ipc_activator_t::handler_t rotate_left_cb = [=] (wf::output_t *output, wayfire_view) |
| 799 | { |
| 800 | return this->output_instance[output]->move_vp(-1); |
| 801 | }; |
| 802 | |
| 803 | wf::ipc_activator_t::handler_t rotate_right_cb = [=] (wf::output_t *output, wayfire_view) |
| 804 | { |
| 805 | return this->output_instance[output]->move_vp(+1); |
| 806 | }; |
| 807 | |
| 808 | wf::ipc_activator_t::handler_t activate_cb = [=] (wf::output_t *output, wayfire_view) |
| 809 | { |
| 810 | return this->output_instance[output]->input_grabbed(); |
| 811 | }; |
| 812 | }; |
| 813 | |
| 814 | DECLARE_WAYFIRE_PLUGIN(wayfire_cube_global); |
nothing calls this directly
no test coverage detected