diff --git a/seat.c b/seat.c index ae5f998..9c5bac4 100644 --- a/seat.c +++ b/seat.c @@ -239,7 +239,6 @@ void diyac_init_seat(struct diyac_server *server) static void seat_focus(struct diyac_seat *seat, struct wlr_surface *surface, bool is_lock_surface) { - wlr_log(WLR_INFO, "seat_focus"); /* * Respect session lock. This check is critical, DO NOT REMOVE. * It should also come before the !surface condition, or the @@ -281,7 +280,6 @@ static void seat_focus(struct diyac_seat *seat, struct wlr_surface *surface, boo void diyac_seat_focus_surface(struct diyac_seat *seat, struct wlr_surface *surface) { - wlr_log(WLR_INFO, "diyac_seat_focus_surface"); /* Respect layer-shell exclusive keyboard-interactivity. */ if (seat->focused_layer && seat->focused_layer->current.keyboard_interactive == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE) { @@ -291,7 +289,7 @@ void diyac_seat_focus_surface(struct diyac_seat *seat, struct wlr_surface *surfa } void diyac_seat_focus_layer(struct diyac_seat *seat, struct wlr_layer_surface_v1 *layer) -{ wlr_log(WLR_INFO, "diyac_seat_focus_layer"); +{ if (!layer) { seat->focused_layer = NULL; diff --git a/view.c b/view.c index 0aa8760..2894409 100644 --- a/view.c +++ b/view.c @@ -21,10 +21,6 @@ void diyac_focus_view(struct diyac_view *toplevel, bool raise) { return; } - if(!toplevel->mapped) - { - return; - } struct diyac_server *server = toplevel->server; struct wlr_surface *prev_surface = server->seat.wlr_seat->keyboard_state.focused_surface; if (prev_surface == toplevel->xdg_toplevel->base->surface) @@ -46,6 +42,10 @@ void diyac_focus_view(struct diyac_view *toplevel, bool raise) wlr_xdg_toplevel_set_activated(prev_toplevel, false); } } + if(!toplevel->mapped) + { + return; + } raise_to_front(toplevel); if (raise) { @@ -82,7 +82,6 @@ struct diyac_view *diyac_view_at( void diyac_focus_topmost_view(struct diyac_server *server) { - wlr_log(WLR_INFO, "diyac_focus_topmost_view"); struct diyac_view *view = diyac_topmost_focusable_view(server); if (view) { @@ -152,16 +151,12 @@ bool diyac_view_update_geometry(struct diyac_view *view, bool grabbed) // view->output->wlr_output, &view->current)) //{ struct wlr_box usable = diyac_output_usable_area(view->output); - wlr_log(WLR_INFO, "diyac_view_update_geometry: current: [%d,%d,%d,%d], usable: [%d,%d,%d,%d] ", + wlr_log(WLR_DEBUG, "diyac_view_update_geometry: current: [%d,%d,%d,%d], usable: [%d,%d,%d,%d] ", geometry->x, geometry->y, geometry->width, geometry->height, usable.x, usable.y, usable.width, usable.height); struct diyac_server *server = view->server; if (!view->mapped) { - wlr_xdg_toplevel_set_maximized(view->xdg_toplevel, false); - wlr_xdg_toplevel_set_fullscreen(view->xdg_toplevel, false); - // the view has not yet be mapped, don't maximize it - wlr_log(WLR_INFO, "The view has not yet be mapped, ignore request"); view->state = DIYAC_VIEW_NORMAL; return false; } @@ -172,7 +167,6 @@ bool diyac_view_update_geometry(struct diyac_view *view, bool grabbed) * We dont change the current_view geometry in maximize state * */ - wlr_xdg_toplevel_set_maximized(view->xdg_toplevel, true); wlr_scene_node_set_position(&view->scene_tree->node, usable.x, usable.y); wlr_xdg_toplevel_set_size(view->xdg_toplevel, usable.width, usable.height); return true; @@ -184,7 +178,6 @@ bool diyac_view_update_geometry(struct diyac_view *view, bool grabbed) /*TODO: implement full-screen */ //view->state = DIYAC_VIEW_NORMAL; wlr_log(WLR_INFO, "diyac_view_update_geometry: full-screen ignore"); - wlr_xdg_toplevel_set_fullscreen(view->xdg_toplevel, false); return false; default: @@ -231,7 +224,7 @@ bool diyac_view_update_geometry(struct diyac_view *view, bool grabbed) if (adjusted) { - wlr_log(WLR_INFO, "diyac_view_update_geometry: updating geometry: %d %d %d %d", geometry->x, geometry->y, geometry->width, geometry->height); + wlr_log(WLR_DEBUG, "diyac_view_update_geometry: updating geometry: %d %d %d %d", geometry->x, geometry->y, geometry->width, geometry->height); wlr_scene_node_set_position(&view->scene_tree->node, geometry->x, geometry->y); wlr_xdg_toplevel_set_size(view->xdg_toplevel, geometry->width, geometry->height); } diff --git a/xdg.c b/xdg.c index 0087867..83d21ff 100644 --- a/xdg.c +++ b/xdg.c @@ -95,7 +95,7 @@ static void xdg_toplevel_unmap(struct wl_listener *listener, void *data) } struct diyac_view * root = diyac_get_root_view(toplevel); wl_list_remove(&toplevel->link); - if(root) + if(root && root->mapped) { diyac_focus_view(root, true); } @@ -141,21 +141,13 @@ static void xdg_toplevel_request_maximize( struct diyac_view *toplevel = wl_container_of(listener, toplevel, request_maximize); - // wlr_wl_output* output = get_wl_output_from_surface(struct wlr_wl_backend *wl, - // struct wl_surface *surface); - /* - struct wlr_output *output = wlr_output_layout_output_at( - toplevel->server->output_layout, toplevel->server->seat.cursor->x, - toplevel->server->seat.cursor->y); - if (!output) + if (!toplevel->mapped) { - wlr_log(WLR_ERROR, - "No output available to assign layer surface"); - wlr_xdg_surface_schedule_configure(toplevel->xdg_toplevel->base); + wlr_xdg_toplevel_set_maximized(toplevel->xdg_toplevel, false); + // the view has not yet be mapped, don't maximize it + wlr_log(WLR_INFO, "The view has not yet be mapped, ignore maximize request"); return; } - struct diyac_output * target_output = output->data; - */ wlr_log(WLR_INFO, "Request maximize"); diyac_reset_cursor_mode(toplevel->server); if (toplevel->state == DIYAC_VIEW_MAXIMIZE) @@ -166,6 +158,7 @@ static void xdg_toplevel_request_maximize( } else { + wlr_xdg_toplevel_set_maximized(toplevel->xdg_toplevel, true); toplevel->state = DIYAC_VIEW_MAXIMIZE; } diyac_view_update_geometry(toplevel, false); @@ -177,9 +170,18 @@ static void xdg_toplevel_request_fullscreen( { struct diyac_view *toplevel = wl_container_of(listener, toplevel, request_fullscreen); + if (!toplevel->mapped) + { + wlr_xdg_toplevel_set_fullscreen(toplevel->xdg_toplevel, false); + // the view has not yet be mapped, don't maximize it + wlr_log(WLR_INFO, "The view has not yet be mapped, ignore fullscreen request"); + return; + } wlr_log(WLR_INFO, "Request fullscreen"); - /* diyac_reset_cursor_mode(toplevel->server); + wlr_xdg_toplevel_set_fullscreen(toplevel->xdg_toplevel, false); + /* + if (toplevel->state == DIYAC_VIEW_FULL_SCREEN) { toplevel->state = DIYAC_VIEW_NORMAL; @@ -209,7 +211,6 @@ static void xdg_toplevel_request_minimize(struct wl_listener *listener, void *da toplevel->state = DIYAC_VIEW_MINIMIZE; } diyac_view_update_geometry(toplevel, false); - wlr_xdg_surface_schedule_configure(toplevel->xdg_toplevel->base); } static void xdg_toplevel_destroy(struct wl_listener *listener, void *data) @@ -247,8 +248,6 @@ static void popup_unconstrain(struct diyac_popup *popup) struct diyac_server *server = view->server; struct wlr_output_layout *output_layout = server->output_layout; struct wlr_output *wlr_output = view->output->wlr_output; - struct wlr_box output_box; - wlr_output_layout_get_box(output_layout, wlr_output, &output_box); struct wlr_box geo_box = diyac_view_get_geometry(view); struct wlr_box output_toplevel_box = { @@ -257,13 +256,6 @@ static void popup_unconstrain(struct diyac_popup *popup) .width = view->output->usable_area.width, .height = view->output->usable_area.height, }; - wlr_log(WLR_INFO, "Un constrain popup geometry: current x %d, y %d, popup [%d, %d, %d, %d] output_box: [%d, %d, %d, %d], caculate_box: [%d, %d, %d, %d]", - view->original.x, view->original.y, - geo_box.x, geo_box.y, geo_box.width, geo_box.height, - output_box.x, output_box.y, output_box.width, output_box.height, - output_toplevel_box.x, output_toplevel_box.y, output_toplevel_box.width, output_toplevel_box.height - ); - wlr_xdg_popup_unconstrain_from_box(popup->wlr_popup, &output_toplevel_box); } @@ -283,10 +275,6 @@ static void handle_xdg_popup_commit(struct wl_listener *listener, void *data) popup->commit.notify = NULL; // force commit output } - else - { - wlr_log(WLR_INFO, "ignore commit 2"); - } } static void handle_xdg_popup_new(struct wl_listener *listener, void *data) @@ -299,7 +287,6 @@ static void handle_xdg_popup_new(struct wl_listener *listener, void *data) static void xdg_popup_create(struct diyac_view *view, struct wlr_xdg_popup *wlr_popup) { - wlr_log(WLR_INFO, "xdg_popup_create: Creating new dialog"); struct wlr_xdg_surface *parent = wlr_xdg_surface_try_from_wlr_surface(wlr_popup->parent); if (!parent) @@ -360,7 +347,6 @@ static void xdg_set_appid_notify(struct wl_listener *listener, void *data) static void xdg_new_popup_notify(struct wl_listener *listener, void *data) { - wlr_log(WLR_INFO, "xdg_new_popup_notify: Creating new dialog"); struct diyac_view *view = wl_container_of(listener, view, new_popup); struct wlr_xdg_popup *wlr_popup = data; @@ -389,7 +375,7 @@ void diyac_new_xdg_surface(struct wl_listener *listener, void *data) xdg_surface->data = wlr_scene_xdg_surface_create( parent_tree, xdg_surface); return;*/ - wlr_log(WLR_INFO, "diyac_new_xdg_surface: Creating new dialog using another method"); + wlr_log(WLR_INFO, "diyac_new_xdg_surface: Creating new dialog using view popup"); return; } assert(xdg_surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);