improve session lock support stability
This commit is contained in:
parent
5b29514b09
commit
4a7219f03c
27
session.c
27
session.c
@ -23,13 +23,16 @@ static void focus_output(struct diyac_output * output)
|
|||||||
static void session_lock_update_geometry(struct diyac_output *output, bool align)
|
static void session_lock_update_geometry(struct diyac_output *output, bool align)
|
||||||
{
|
{
|
||||||
struct wlr_box box;
|
struct wlr_box box;
|
||||||
|
wlr_output_layout_get_box(g_server->output_layout, output->wlr_output, &box);
|
||||||
if (align)
|
if (align)
|
||||||
{
|
{
|
||||||
wlr_output_layout_get_box(g_server->output_layout, output->wlr_output, &box);
|
|
||||||
wlr_scene_node_set_position(&output->scenes.session->node, box.x, box.y);
|
wlr_scene_node_set_position(&output->scenes.session->node, box.x, box.y);
|
||||||
|
wlr_log(WLR_INFO, "session_lock_update_geometry: Align lock screen on %d, %d", box.x, box.y);
|
||||||
}
|
}
|
||||||
wlr_scene_rect_set_size(output->lock_handle->background, box.width, box.height);
|
wlr_scene_rect_set_size(output->lock_handle->background, box.width, box.height);
|
||||||
if (output->lock_handle->surface) {
|
if (output->lock_handle->surface)
|
||||||
|
{
|
||||||
|
wlr_log(WLR_INFO, "session_lock_update_geometry: configure lock screen %d, %d", box.width, box.height);
|
||||||
wlr_session_lock_surface_v1_configure(output->lock_handle->surface, box.width, box.height);
|
wlr_session_lock_surface_v1_configure(output->lock_handle->surface, box.width, box.height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -41,6 +44,7 @@ static void handle_surface_map(struct wl_listener *listener, void *data)
|
|||||||
{
|
{
|
||||||
focus_output(handle->output);
|
focus_output(handle->output);
|
||||||
}
|
}
|
||||||
|
wlr_log(WLR_INFO, "handle_surface_map: surface is mapped");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_surface_destroy(struct wl_listener *listener, void *data)
|
static void handle_surface_destroy(struct wl_listener *listener, void *data)
|
||||||
@ -68,7 +72,7 @@ static void handle_surface_destroy(struct wl_listener *listener, void *data)
|
|||||||
}
|
}
|
||||||
focus_output(NULL);
|
focus_output(NULL);
|
||||||
}
|
}
|
||||||
|
wlr_log(WLR_INFO, "handle_surface_destroy: Lock surface destroyed");
|
||||||
assert(handle->surface);
|
assert(handle->surface);
|
||||||
handle->surface = NULL;
|
handle->surface = NULL;
|
||||||
wl_list_remove(&handle->surface_destroy.link);
|
wl_list_remove(&handle->surface_destroy.link);
|
||||||
@ -80,7 +84,7 @@ static void handle_new_surface(struct wl_listener *listener, void *data)
|
|||||||
struct diyac_session_lock *lock = wl_container_of(listener, lock, new_surface);
|
struct diyac_session_lock *lock = wl_container_of(listener, lock, new_surface);
|
||||||
struct wlr_session_lock_surface_v1 *lock_surface = data;
|
struct wlr_session_lock_surface_v1 *lock_surface = data;
|
||||||
struct diyac_output *output = lock_surface->output->data;
|
struct diyac_output *output = lock_surface->output->data;
|
||||||
|
wlr_log(WLR_INFO, "handle_new_surface: New lock surface requested");
|
||||||
assert(output->lock_handle);
|
assert(output->lock_handle);
|
||||||
|
|
||||||
output->lock_handle->surface = lock_surface;
|
output->lock_handle->surface = lock_surface;
|
||||||
@ -113,12 +117,14 @@ static void session_lock_destroy(struct diyac_session_lock *lock)
|
|||||||
wl_list_remove(&lock->unlock.link);
|
wl_list_remove(&lock->unlock.link);
|
||||||
wl_list_remove(&lock->new_surface.link);
|
wl_list_remove(&lock->new_surface.link);
|
||||||
}
|
}
|
||||||
|
wlr_log(WLR_INFO, "session_lock_destroy");
|
||||||
free(lock);
|
free(lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_unlock(struct wl_listener *listener, void *data)
|
static void handle_unlock(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
struct diyac_session_lock *lock = wl_container_of(listener, lock, unlock);
|
struct diyac_session_lock *lock = wl_container_of(listener, lock, unlock);
|
||||||
|
wlr_log(WLR_INFO, "handle_unlock: Lock session is unlocked");
|
||||||
session_lock_destroy(lock);
|
session_lock_destroy(lock);
|
||||||
diyac_focus_topmost_view(g_server, true);
|
diyac_focus_topmost_view(g_server, true);
|
||||||
}
|
}
|
||||||
@ -127,6 +133,7 @@ static void handle_session_lock_destroy(struct wl_listener *listener, void *data
|
|||||||
{
|
{
|
||||||
struct diyac_session_lock *lock = wl_container_of(listener, lock, destroy);
|
struct diyac_session_lock *lock = wl_container_of(listener, lock, destroy);
|
||||||
lock->abandoned = true;
|
lock->abandoned = true;
|
||||||
|
wlr_log(WLR_INFO, "handle_session_lock_destroy: Lock session is destroyed without unlocking, session abandoned");
|
||||||
wl_list_remove(&lock->destroy.link);
|
wl_list_remove(&lock->destroy.link);
|
||||||
wl_list_remove(&lock->unlock.link);
|
wl_list_remove(&lock->unlock.link);
|
||||||
wl_list_remove(&lock->new_surface.link);
|
wl_list_remove(&lock->new_surface.link);
|
||||||
@ -143,13 +150,14 @@ static void handle_new_session_lock(struct wl_listener *listener, void *data)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wlr_log(WLR_ERROR, "session already locked");
|
wlr_log(WLR_ERROR, "handle_new_session_lock: session already locked");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
struct diyac_session_lock *session = malloc(sizeof(struct diyac_session_lock));
|
struct diyac_session_lock *session = malloc(sizeof(struct diyac_session_lock));
|
||||||
if (!session) {
|
if (!session)
|
||||||
wlr_log(WLR_ERROR, "session-lock: out of memory");
|
{
|
||||||
|
wlr_log(WLR_ERROR, "handle_new_session_lock: out of memory");
|
||||||
wlr_session_lock_v1_destroy(lock);
|
wlr_session_lock_v1_destroy(lock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -183,15 +191,13 @@ static void handle_commit(struct wl_listener *listener, void *data)
|
|||||||
{
|
{
|
||||||
struct wlr_output_event_commit *event = data;
|
struct wlr_output_event_commit *event = data;
|
||||||
struct diyac_output_lock_handle *handle = wl_container_of(listener, handle, commit);
|
struct diyac_output_lock_handle *handle = wl_container_of(listener, handle, commit);
|
||||||
uint32_t require_reconfigure = WLR_OUTPUT_STATE_MODE
|
uint32_t require_reconfigure = WLR_OUTPUT_STATE_MODE | WLR_OUTPUT_STATE_SCALE | WLR_OUTPUT_STATE_TRANSFORM;
|
||||||
| WLR_OUTPUT_STATE_SCALE | WLR_OUTPUT_STATE_TRANSFORM;
|
|
||||||
if (event->state->committed & require_reconfigure)
|
if (event->state->committed & require_reconfigure)
|
||||||
{
|
{
|
||||||
session_lock_update_geometry(handle->output, false);
|
session_lock_update_geometry(handle->output, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void handle_lock_manager_destroy(struct wl_listener *listener, void *data)
|
static void handle_lock_manager_destroy(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
if (g_server->lock)
|
if (g_server->lock)
|
||||||
@ -253,7 +259,6 @@ void diyac_session_lock_output(struct diyac_output * output)
|
|||||||
output->lock_handle = handle;
|
output->lock_handle = handle;
|
||||||
|
|
||||||
session_lock_update_geometry(output, true);
|
session_lock_update_geometry(output, true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void diyac_session_unlock_output(struct diyac_output *output)
|
void diyac_session_unlock_output(struct diyac_output *output)
|
||||||
|
4
view.c
4
view.c
@ -424,6 +424,10 @@ void diyac_view_sync_geo(struct diyac_view *view)
|
|||||||
{
|
{
|
||||||
struct wlr_box size;
|
struct wlr_box size;
|
||||||
int current_x, current_y, next_x, next_y;
|
int current_x, current_y, next_x, next_y;
|
||||||
|
if(!view->mapped)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
wlr_scene_node_coords(&view->scene_tree->node, ¤t_x, ¤t_y);
|
wlr_scene_node_coords(&view->scene_tree->node, ¤t_x, ¤t_y);
|
||||||
wlr_xdg_surface_get_geometry(view->xdg_surface, &size);
|
wlr_xdg_surface_get_geometry(view->xdg_surface, &size);
|
||||||
|
|
||||||
|
3
xdg.c
3
xdg.c
@ -208,7 +208,10 @@ static void xdg_toplevel_destroy(struct wl_listener *listener, void *data)
|
|||||||
wl_event_source_remove(toplevel->configuration_timeout);
|
wl_event_source_remove(toplevel->configuration_timeout);
|
||||||
toplevel->configuration_timeout = NULL;
|
toplevel->configuration_timeout = NULL;
|
||||||
}
|
}
|
||||||
|
if(toplevel->mapped)
|
||||||
|
{
|
||||||
wl_list_remove(&toplevel->commit.link);
|
wl_list_remove(&toplevel->commit.link);
|
||||||
|
}
|
||||||
wl_list_remove(&toplevel->map.link);
|
wl_list_remove(&toplevel->map.link);
|
||||||
wl_list_remove(&toplevel->unmap.link);
|
wl_list_remove(&toplevel->unmap.link);
|
||||||
wl_list_remove(&toplevel->destroy.link);
|
wl_list_remove(&toplevel->destroy.link);
|
||||||
|
Loading…
Reference in New Issue
Block a user