forked from RepoMirrors/bemenu
fixed indentation
This commit is contained in:
parent
a96ed87472
commit
21ff4e47da
@ -266,7 +266,7 @@ do_getopt(struct client *client, int *argc, char **argv[])
|
||||
{ "no-spacing", no_argument, 0, 's' },
|
||||
{ "monitor", required_argument, 0, 'm' },
|
||||
{ "line-height", required_argument, 0, 'H' },
|
||||
{ "margin", required_argument, 0, 'M' },
|
||||
{ "margin", required_argument, 0, 'M' },
|
||||
{ "ch", required_argument, 0, 0x118 },
|
||||
{ "fn", required_argument, 0, 0x101 },
|
||||
{ "tb", required_argument, 0, 0x102 },
|
||||
|
24
lib/menu.c
24
lib/menu.c
@ -357,12 +357,12 @@ bm_menu_get_scrollbar(struct bm_menu *menu)
|
||||
void
|
||||
bm_menu_set_align(struct bm_menu *menu, enum bm_align align)
|
||||
{
|
||||
assert(menu);
|
||||
assert(menu);
|
||||
|
||||
if(menu->align == align)
|
||||
return;
|
||||
if(menu->align == align)
|
||||
return;
|
||||
|
||||
menu->align = align;
|
||||
menu->align = align;
|
||||
|
||||
if (menu->renderer->api.set_align)
|
||||
menu->renderer->api.set_align(menu, align);
|
||||
@ -371,22 +371,22 @@ bm_menu_set_align(struct bm_menu *menu, enum bm_align align)
|
||||
enum bm_align
|
||||
bm_menu_get_align(struct bm_menu *menu)
|
||||
{
|
||||
assert(menu);
|
||||
return menu->align;
|
||||
assert(menu);
|
||||
return menu->align;
|
||||
}
|
||||
|
||||
void
|
||||
bm_menu_set_hmargin_size(struct bm_menu *menu, uint32_t margin)
|
||||
{
|
||||
assert(menu);
|
||||
assert(menu);
|
||||
|
||||
if(menu->hmargin_size == margin)
|
||||
return;
|
||||
if(menu->hmargin_size == margin)
|
||||
return;
|
||||
|
||||
menu->hmargin_size = margin;
|
||||
menu->hmargin_size = margin;
|
||||
|
||||
if(menu->renderer->api.set_hmargin_size)
|
||||
menu->renderer->api.set_hmargin_size(menu, margin);
|
||||
if(menu->renderer->api.set_hmargin_size)
|
||||
menu->renderer->api.set_hmargin_size(menu, margin);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
|
@ -236,7 +236,7 @@ set_hmargin_size(const struct bm_menu *menu, uint32_t margin)
|
||||
|
||||
struct window *window;
|
||||
wl_list_for_each(window, &wayland->windows, link) {
|
||||
bm_wl_window_set_hmargin_size(window, wayland->display, margin);
|
||||
bm_wl_window_set_hmargin_size(window, wayland->display, margin);
|
||||
}
|
||||
}
|
||||
|
||||
@ -317,7 +317,7 @@ recreate_windows(const struct bm_menu *menu, struct wayland *wayland)
|
||||
wl_surface_set_buffer_scale(surface, output->scale);
|
||||
|
||||
struct window *window = calloc(1, sizeof(struct window));
|
||||
window->align = menu->align;
|
||||
window->align = menu->align;
|
||||
window->hmargin_size = menu->hmargin_size;
|
||||
|
||||
const char *scale = getenv("BEMENU_SCALE");
|
||||
|
@ -308,7 +308,7 @@ get_window_width(struct window *window)
|
||||
uint32_t width = window->width - 2 * window->hmargin_size;
|
||||
|
||||
if(width < WINDOW_MIN_WIDTH || 2 * window->hmargin_size > window->width)
|
||||
width = WINDOW_MIN_WIDTH;
|
||||
width = WINDOW_MIN_WIDTH;
|
||||
|
||||
return width;
|
||||
}
|
||||
@ -321,23 +321,23 @@ static const struct zwlr_layer_surface_v1_listener layer_surface_listener = {
|
||||
void
|
||||
bm_wl_window_set_hmargin_size(struct window *window, struct wl_display *display, uint32_t margin)
|
||||
{
|
||||
if(window->hmargin_size == margin)
|
||||
return;
|
||||
if(window->hmargin_size == margin)
|
||||
return;
|
||||
|
||||
window->hmargin_size = margin;
|
||||
window->hmargin_size = margin;
|
||||
|
||||
zwlr_layer_surface_v1_set_anchor(window->layer_surface, window->align_anchor);
|
||||
zwlr_layer_surface_v1_set_size(window->layer_surface, get_window_width(window), window->height);
|
||||
zwlr_layer_surface_v1_set_anchor(window->layer_surface, window->align_anchor);
|
||||
zwlr_layer_surface_v1_set_size(window->layer_surface, get_window_width(window), window->height);
|
||||
|
||||
wl_surface_commit(window->surface);
|
||||
wl_display_roundtrip(display);
|
||||
wl_surface_commit(window->surface);
|
||||
wl_display_roundtrip(display);
|
||||
}
|
||||
|
||||
void
|
||||
bm_wl_window_set_align(struct window *window, struct wl_display *display, enum bm_align align)
|
||||
{
|
||||
if(window->align == align)
|
||||
return;
|
||||
return;
|
||||
|
||||
window->align = align;
|
||||
|
||||
@ -371,14 +371,14 @@ bm_wl_window_create(struct window *window, struct wl_display *display, struct wl
|
||||
|
||||
if (layer_shell && (window->layer_surface = zwlr_layer_shell_v1_get_layer_surface(layer_shell, surface, output, ZWLR_LAYER_SHELL_V1_LAYER_TOP, "menu"))) {
|
||||
zwlr_layer_surface_v1_add_listener(window->layer_surface, &layer_surface_listener, window);
|
||||
window->align_anchor = get_align_anchor(window->align);
|
||||
window->align_anchor = get_align_anchor(window->align);
|
||||
zwlr_layer_surface_v1_set_anchor(window->layer_surface, window->align_anchor);
|
||||
zwlr_layer_surface_v1_set_size(window->layer_surface, 0, 32);
|
||||
|
||||
wl_surface_commit(surface);
|
||||
wl_display_roundtrip(display);
|
||||
|
||||
zwlr_layer_surface_v1_set_size(window->layer_surface, get_window_width(window), 32);
|
||||
zwlr_layer_surface_v1_set_size(window->layer_surface, get_window_width(window), 32);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ get_window_width(struct window *window)
|
||||
uint32_t width = window->width - 2 * window->hmargin_size;
|
||||
|
||||
if(width < WINDOW_MIN_WIDTH || 2 * window->hmargin_size > window->width)
|
||||
width = WINDOW_MIN_WIDTH;
|
||||
width = WINDOW_MIN_WIDTH;
|
||||
|
||||
return width;
|
||||
}
|
||||
@ -218,10 +218,10 @@ bm_x11_window_set_monitor(struct window *window, int32_t monitor)
|
||||
window->width = DisplayWidth(window->display, window->screen);
|
||||
}
|
||||
|
||||
window->orig_width = window->width;
|
||||
window->orig_x = window->x;
|
||||
window->width = get_window_width(window);
|
||||
window->x += (window->orig_width - window->width) / 2;
|
||||
window->orig_width = window->width;
|
||||
window->orig_x = window->x;
|
||||
window->width = get_window_width(window);
|
||||
window->x += (window->orig_width - window->width) / 2;
|
||||
|
||||
#undef INTERSECT
|
||||
}
|
||||
@ -244,15 +244,15 @@ bm_x11_window_set_align(struct window *window, enum bm_align align)
|
||||
void
|
||||
bm_x11_window_set_hmargin_size(struct window *window, uint32_t margin)
|
||||
{
|
||||
if(window->hmargin_size == margin)
|
||||
return;
|
||||
if(window->hmargin_size == margin)
|
||||
return;
|
||||
|
||||
window->hmargin_size = margin;
|
||||
window->width = window->orig_width;
|
||||
window->x = window->orig_x;
|
||||
window->width = get_window_width(window);
|
||||
window->x += (window->orig_width - window->width) / 2;
|
||||
bm_x11_window_set_monitor(window, window->monitor);
|
||||
window->hmargin_size = margin;
|
||||
window->width = window->orig_width;
|
||||
window->x = window->orig_x;
|
||||
window->width = get_window_width(window);
|
||||
window->x += (window->orig_width - window->width) / 2;
|
||||
bm_x11_window_set_monitor(window, window->monitor);
|
||||
}
|
||||
|
||||
bool
|
||||
|
Loading…
Reference in New Issue
Block a user