improve: better support foreign protocol

This commit is contained in:
DanyLE
2024-04-13 00:25:39 +02:00
parent dced6db8b2
commit 68a0b669ef
5 changed files with 93 additions and 24 deletions

View File

@ -9,7 +9,6 @@ static void handle_request_minimize(struct wl_listener *listener, void *data)
// view_minimize(view, event->minimized);
diyac_view_set_mimimize(view, event->minimized);
wlr_log(WLR_INFO, "foreign: request minimize");
}
static void handle_request_maximize(struct wl_listener *listener, void *data)
@ -37,7 +36,7 @@ static void handle_request_activate(struct wl_listener *listener, void *data)
// struct wlr_foreign_toplevel_handle_v1_activated_event *event = data;
/* In a multi-seat world we would select seat based on event->seat here. */
// desktop_focus_view(view, /*raise*/ true);
diyac_focus_view(view,true);
diyac_focus_view(view, true);
wlr_log(WLR_INFO, "foreign: request activate");
}
@ -45,7 +44,7 @@ static void
handle_request_close(struct wl_listener *listener, void *data)
{
struct diyac_view *view = wl_container_of(listener, view, toplevel.close);
//view_close(view);
wlr_xdg_toplevel_send_close(view->xdg_toplevel);
}
static void
@ -94,4 +93,20 @@ void diyac_init_foreign_toplevel(struct diyac_view *view)
toplevel->destroy.notify = handle_destroy;
wl_signal_add(&toplevel->handle->events.destroy, &toplevel->destroy);
wlr_foreign_toplevel_handle_v1_output_enter(
view->toplevel.handle, view->output->wlr_output);
//wlr_foreign_toplevel_handle_v1_output_enter
struct wlr_xdg_toplevel *xdg_toplevel = view->xdg_toplevel;
if (!xdg_toplevel->parent)
{
return;
}
struct wlr_xdg_surface *surface = xdg_toplevel->parent->base;
struct diyac_view *parent = surface->data;
if (!parent->toplevel.handle)
{
return;
}
wlr_foreign_toplevel_handle_v1_set_parent(view->toplevel.handle, parent->toplevel.handle);
}