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

session lock surface: animate #2555

Open
NamorNiradnug opened this issue Jan 1, 2025 · 2 comments
Open

session lock surface: animate #2555

NamorNiradnug opened this issue Jan 1, 2025 · 2 comments
Labels
enhancement PRs-welcome Issues which are unlikely to be fixed unless someone sends a PR

Comments

@NamorNiradnug
Copy link
Contributor

Session lock surface is currently appears without animation. Would be nice if it'd be animated.

@ammen99
Copy link
Member

ammen99 commented Jan 1, 2025

If anyone is looking in doing this, we would need to have the lock surface not be a regular surface + node attached to the scenegraph, but also a view. The existing code does most of the 'hard' work - input grabs, rendering, etc. The view implementation does not have to do much - see for a reference the colored rect views

/* Implementation of color_rect_view_t */
wf::color_rect_view_t::color_rect_view_t() : wf::view_interface_t()
{
this->geometry = {0, 0, 1, 1};
this->_color = {0, 0, 0, 1};
this->border = 0;
}
std::shared_ptr<wf::color_rect_view_t> wf::color_rect_view_t::create(view_role_t role,
wf::output_t *start_output, std::optional<wf::scene::layer> layer)
{
auto self = view_interface_t::create<wf::color_rect_view_t>();
self->set_surface_root_node(std::make_shared<color_rect_node_t>(self));
self->set_role(role);
self->_is_mapped = true;
self->get_root_node()->set_enabled(true);
if (start_output)
{
self->set_output(start_output);
if (layer)
{
auto parent = (layer == wf::scene::layer::WORKSPACE) ?
start_output->wset()->get_node() : start_output->node_for_layer(*layer);
wf::scene::readd_front(parent, self->get_root_node());
}
}
wf::view_implementation::emit_view_map_signal(self, true);
return self;
}
void wf::color_rect_view_t::close()
{
this->_is_mapped = false;
emit_view_unmap();
}
void wf::color_rect_view_t::set_color(wf::color_t color)
{
this->_color = color;
damage();
}
void wf::color_rect_view_t::set_border_color(wf::color_t border)
{
this->_border_color = border;
damage();
}
void wf::color_rect_view_t::set_border(int width)
{
this->border = width;
damage();
}
bool wf::color_rect_view_t::is_mapped() const
{
return _is_mapped;
}
void wf::color_rect_view_t::set_geometry(wf::geometry_t g)
{
damage();
this->geometry = g;
damage();
}
wf::geometry_t wf::color_rect_view_t::get_geometry()
{
return this->geometry;
}
wlr_surface*wf::color_rect_view_t::get_keyboard_focus_surface()
{
return nullptr;
}
bool wf::color_rect_view_t::is_focusable() const
{
return false;

@ammen99 ammen99 added the PRs-welcome Issues which are unlikely to be fixed unless someone sends a PR label Jan 1, 2025
@NamorNiradnug
Copy link
Contributor Author

If anyone is looking in doing this, we would need to have the lock surface not be a regular surface + node attached to the scenegraph, but also a view. The existing code does most of the 'hard' work - input grabs, rendering, etc. The view implementation does not have to do much - see for a reference the colored rect views

/* Implementation of color_rect_view_t */
wf::color_rect_view_t::color_rect_view_t() : wf::view_interface_t()
{
this->geometry = {0, 0, 1, 1};
this->_color = {0, 0, 0, 1};
this->border = 0;
}
std::shared_ptr<wf::color_rect_view_t> wf::color_rect_view_t::create(view_role_t role,
wf::output_t *start_output, std::optional<wf::scene::layer> layer)
{
auto self = view_interface_t::create<wf::color_rect_view_t>();
self->set_surface_root_node(std::make_shared<color_rect_node_t>(self));
self->set_role(role);
self->_is_mapped = true;
self->get_root_node()->set_enabled(true);
if (start_output)
{
self->set_output(start_output);
if (layer)
{
auto parent = (layer == wf::scene::layer::WORKSPACE) ?
start_output->wset()->get_node() : start_output->node_for_layer(*layer);
wf::scene::readd_front(parent, self->get_root_node());
}
}
wf::view_implementation::emit_view_map_signal(self, true);
return self;
}
void wf::color_rect_view_t::close()
{
this->_is_mapped = false;
emit_view_unmap();
}
void wf::color_rect_view_t::set_color(wf::color_t color)
{
this->_color = color;
damage();
}
void wf::color_rect_view_t::set_border_color(wf::color_t border)
{
this->_border_color = border;
damage();
}
void wf::color_rect_view_t::set_border(int width)
{
this->border = width;
damage();
}
bool wf::color_rect_view_t::is_mapped() const
{
return _is_mapped;
}
void wf::color_rect_view_t::set_geometry(wf::geometry_t g)
{
damage();
this->geometry = g;
damage();
}
wf::geometry_t wf::color_rect_view_t::get_geometry()
{
return this->geometry;
}
wlr_surface*wf::color_rect_view_t::get_keyboard_focus_surface()
{
return nullptr;
}
bool wf::color_rect_view_t::is_focusable() const
{
return false;

Thanks, I was also thinking about that! I'm going to implement it in a few days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement PRs-welcome Issues which are unlikely to be fixed unless someone sends a PR
Projects
None yet
Development

No branches or pull requests

2 participants