2023-06-02 18:37:51 +02:00
|
|
|
/* See LICENSE file for copyright and license details. */
|
|
|
|
|
|
|
|
void prepare_window_size_wl(void) {
|
2023-06-23 03:38:21 +02:00
|
|
|
sp.sp = menupaddingh;
|
|
|
|
sp.vp = (menuposition == 1) ? menupaddingv : - menupaddingv;
|
2023-06-02 18:37:51 +02:00
|
|
|
|
2023-06-23 03:49:23 +02:00
|
|
|
sp.bh = MAX(draw->font->h, draw->font->h + 2 + lineheight);
|
2023-06-02 18:37:51 +02:00
|
|
|
lines = MAX(lines, 0);
|
2023-08-07 06:37:38 +02:00
|
|
|
#if IMAGE
|
2023-06-23 03:38:21 +02:00
|
|
|
img.setlines = lines;
|
|
|
|
#endif
|
2023-06-02 18:37:51 +02:00
|
|
|
|
2023-06-23 03:49:23 +02:00
|
|
|
sp.lrpad = draw->font->h + textpadding;
|
2023-06-02 18:37:51 +02:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
void handle_wl(void) {
|
|
|
|
if (!setlocale(LC_CTYPE, "")) {
|
|
|
|
die("spmenu: no locale support");
|
|
|
|
}
|
|
|
|
|
|
|
|
prepare_window_size_wl();
|
2023-06-23 03:38:21 +02:00
|
|
|
sp.promptw = (prompt && *prompt) ? pango_prompt ? TEXTWM(prompt) : TEXTW(prompt) - sp.lrpad / 4 : 0;
|
2023-06-02 18:37:51 +02:00
|
|
|
|
|
|
|
allow_draw = 1;
|
|
|
|
|
|
|
|
init_keys(&state);
|
|
|
|
init_disp(&state);
|
|
|
|
|
|
|
|
if (no_display) {
|
2023-06-03 19:14:54 +02:00
|
|
|
die("spmenu: failed to connect to wayland display");
|
2023-06-02 18:37:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
create_layer(&state, "spmenu");
|
|
|
|
|
2023-06-24 17:13:17 +02:00
|
|
|
mo.output_width = output_width;
|
|
|
|
mo.output_height = output_height;
|
|
|
|
|
|
|
|
sp.mw = (menuwidth > 0 ? menuwidth : mo.output_width);
|
2023-06-11 16:46:36 +02:00
|
|
|
get_mh();
|
2023-06-02 18:37:51 +02:00
|
|
|
|
|
|
|
if (menuposition == 2) {
|
2023-07-14 01:54:48 +02:00
|
|
|
sp.mw = MIN(MAX(max_textw() + sp.promptw, centerwidth), mo.output_width);
|
2023-06-02 18:37:51 +02:00
|
|
|
}
|
|
|
|
|
2023-06-23 03:38:21 +02:00
|
|
|
state.width = sp.mw;
|
|
|
|
state.height = sp.mh;
|
2023-06-02 18:37:51 +02:00
|
|
|
|
|
|
|
set_layer_size(&state, state.width, state.height);
|
|
|
|
|
|
|
|
anchor_layer(&state, menuposition);
|
|
|
|
set_exclusive_zone(&state, -1);
|
|
|
|
set_keyboard(&state, 1);
|
|
|
|
add_layer_listener(&state);
|
|
|
|
set_visible_layer(&state);
|
|
|
|
|
|
|
|
roundtrip(&state);
|
|
|
|
|
|
|
|
match();
|
2023-07-27 00:39:57 +02:00
|
|
|
create_drawable(&state);
|
2023-06-02 18:37:51 +02:00
|
|
|
|
2023-07-27 01:30:56 +02:00
|
|
|
await_dispatch(&state);
|
2023-06-02 18:37:51 +02:00
|
|
|
|
2023-07-27 01:30:56 +02:00
|
|
|
disconnect_display(&state);
|
2023-06-02 18:37:51 +02:00
|
|
|
}
|