Don't reach for globals to choose output

This actually removes the size request from panel creation. Incidentally, this still works becuae the following configure event gets the sizes from glib.
This commit is contained in:
Dorota Czaplejewicz
2022-01-30 13:32:05 +00:00
parent f040e708a4
commit a4b67c65ff

View File

@ -141,20 +141,18 @@ on_surface_configure(ServerContextService *self, PhoshLayerSurface *surface)
} }
static void static void
make_window (ServerContextService *self) make_window (ServerContextService *self, struct wl_output *output)
{ {
if (self->window) { if (self->window) {
g_error("Window already present"); g_error("Window already present");
} }
struct squeek_output_handle output = squeek_outputs_get_current(squeek_wayland->outputs);
squeek_uiman_set_output(self->manager, output);
uint32_t height = squeek_uiman_get_perceptual_height(self->manager); uint32_t height = squeek_uiman_get_perceptual_height(self->manager);
self->window = g_object_new ( self->window = g_object_new (
PHOSH_TYPE_LAYER_SURFACE, PHOSH_TYPE_LAYER_SURFACE,
"layer-shell", squeek_wayland->layer_shell, "layer-shell", squeek_wayland->layer_shell,
"wl-output", output.output, "wl-output", output,
"height", height, "height", height,
"anchor", ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM "anchor", ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM
| ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT
@ -209,7 +207,7 @@ void
server_context_service_real_show_keyboard (ServerContextService *self, struct wl_output *output) server_context_service_real_show_keyboard (ServerContextService *self, struct wl_output *output)
{ {
if (!self->window) { if (!self->window) {
make_window (self); make_window (self, output);
} }
if (!self->widget) { if (!self->widget) {
make_widget (self); make_widget (self);