Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

squeezimize: Set output pointer and avoid shadowing #2473

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions plugins/animate/squeezimize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ class squeezimize_animation_t : public duration_t
class squeezimize_transformer : public wf::scene::view_2d_transformer_t
{
public:
wf::output_t *output;
wayfire_view view;
wf::output_t *wo;
OpenGL::program_t program;
wf::geometry_t minimize_target;
wf::geometry_t animation_geometry;
Expand Down Expand Up @@ -182,7 +183,7 @@ class squeezimize_transformer : public wf::scene::view_2d_transformer_t
auto progress = self->progression.progress();
int upward = ((src_box.y > self->minimize_target.y) ||
((src_box.y < 0) &&
(self->minimize_target.y < self->output->get_relative_geometry().height / 2)));
(self->minimize_target.y < self->wo->get_relative_geometry().height / 2)));
static const float vertex_data_uv[] = {
0.0f, 0.0f,
1.0f, 0.0f,
Expand Down Expand Up @@ -254,13 +255,15 @@ class squeezimize_transformer : public wf::scene::view_2d_transformer_t
squeezimize_transformer(wayfire_view view,
wf::geometry_t minimize_target, wf::geometry_t bbox) : wf::scene::view_2d_transformer_t(view)
{
this->view = view;
this->wo = view->get_output();
this->minimize_target = minimize_target;
/* If there is no minimize target set, minimize to the bottom center of the output */
if ((this->minimize_target.width <= 0) || (this->minimize_target.height <= 0))
{
if (auto output = view->get_output())
if (this->wo)
{
auto og = output->get_relative_geometry();
auto og = this->wo->get_relative_geometry();
this->minimize_target.x = og.width / 2 - 50;
this->minimize_target.y = og.height;
this->minimize_target.width = 100;
Expand Down Expand Up @@ -293,8 +296,14 @@ class squeezimize_transformer : public wf::scene::view_2d_transformer_t
void gen_render_instances(std::vector<render_instance_uptr>& instances,
damage_callback push_damage, wf::output_t *shown_on) override
{
this->wo = view->get_output();
if (!this->wo)
{
return;
}

instances.push_back(std::make_unique<simple_node_render_instance_t>(
this, push_damage, shown_on));
this, push_damage, this->wo));
}

void init_animation(bool squeeze)
Expand Down
Loading