1
0
Fork 0
mirror of https://github.com/Cloudef/bemenu synced 2024-05-09 09:06:43 +02:00

Compare commits

...

6 Commits

Author SHA1 Message Date
Matt A 2a748060a2
Merge 9740d37d17 into c0c608cad7 2024-03-10 14:51:40 -06:00
Andrei E c0c608cad7 Move SIGCHLD to client launch 2024-03-09 23:46:46 +09:00
Andrei E 9a7b736dd9 Remove SIGCHLD handler
SIG_DFL on SIGCHLD prevents proper functioning of pclose, which the new version of the pasting functionality requires.

Closes Cloudef#385

Ref: https://stackoverflow.com/questions/54189212/popen-returns-1-unexpectedly
2024-03-09 23:46:46 +09:00
Jari Vetoniemi fab01c9906 Bump version to 0.6.20 2024-03-07 17:51:45 +09:00
Julian Orth 6bcffe408c wayland: bind to zwlr_layer_shell_v1 version 3
zwlr_layer_shell_v1_destroy is not available in version 2 of the
interface.
2024-03-07 17:41:43 +09:00
Matt Allan 9740d37d17
[Wayland] Anchor top edge of menu to center
Anchor only the top edge of the menu to the center when
--center mode is used instead of centering the entire menu. This
prevents the menu from bouncing around as the list is shortened.

For this to work we only anchor to the top instead of the top and
the bottom and set a top margin equal to half of the display width.
The max height of the menu also needs to be halved to prevent drawing
a menu that overflows the bottom edge of the screen.
2022-08-12 15:31:50 -04:00
4 changed files with 19 additions and 14 deletions

View File

@ -1 +1 @@
0.6.19
0.6.20

View File

@ -133,6 +133,14 @@ static inline void ignore_ret(int useless, ...) { (void)useless; }
static void
launch(const struct client *client, const char *bin)
{
struct sigaction action = {
.sa_handler = SIG_DFL,
.sa_flags = SA_NOCLDWAIT
};
// do not care about childs
sigaction(SIGCHLD, &action, NULL);
if (!bin)
return;
@ -166,14 +174,6 @@ item_cb(const struct client *client, struct bm_item *item)
int
main(int argc, char **argv)
{
struct sigaction action = {
.sa_handler = SIG_DFL,
.sa_flags = SA_NOCLDWAIT
};
// do not care about childs
sigaction(SIGCHLD, &action, NULL);
if (!bm_init())
return EXIT_FAILURE;

View File

@ -582,7 +582,7 @@ registry_handle_global(void *data, struct wl_registry *registry, uint32_t id, co
if (strcmp(interface, "wl_compositor") == 0) {
wayland->compositor = wl_registry_bind(registry, id, &wl_compositor_interface, 4);
} else if (strcmp(interface, zwlr_layer_shell_v1_interface.name) == 0) {
wayland->layer_shell = wl_registry_bind(registry, id, &zwlr_layer_shell_v1_interface, 2);
wayland->layer_shell = wl_registry_bind(registry, id, &zwlr_layer_shell_v1_interface, 3);
} else if (strcmp(interface, "wl_seat") == 0) {
wayland->seat = wl_registry_bind(registry, id, &wl_seat_interface, 7);
wl_seat_add_listener(wayland->seat, &seat_listener, &wayland->input);

View File

@ -217,10 +217,8 @@ get_align_anchor(enum bm_align align)
{
uint32_t anchor = ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT;
if(align == BM_ALIGN_TOP) {
if(align == BM_ALIGN_TOP || align == BM_ALIGN_CENTER) {
anchor |= ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP;
} else if(align == BM_ALIGN_CENTER) {
anchor |= ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP | ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM;
} else {
anchor |= ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM;
}
@ -256,7 +254,11 @@ bm_wl_window_render(struct window *window, struct wl_display *display, struct bm
break;
struct cairo_paint_result result;
window->notify.render(&buffer->cairo, buffer->width, window->max_height, menu, &result);
uint32_t max_height = window->max_height;
if (menu->align == BM_ALIGN_CENTER) {
max_height /= 2;
}
window->notify.render(&buffer->cairo, buffer->width, max_height, menu, &result);
window->displayed = result.displayed;
if (window->height == (uint32_t) ceil(result.height / window->scale))
@ -378,6 +380,9 @@ bm_wl_window_set_align(struct window *window, struct wl_display *display, enum b
window->align_anchor = get_align_anchor(window->align);
zwlr_layer_surface_v1_set_anchor(window->layer_surface, window->align_anchor);
if (align == BM_ALIGN_CENTER) {
zwlr_layer_surface_v1_set_margin(window->layer_surface, window->max_height / 2, 0, 0, 0);
}
wl_surface_commit(window->surface);
wl_display_roundtrip(display);
}