file-browser: adjust context menu position on right side of screen

This commit is contained in:
K. Lange 2019-01-05 16:30:07 +09:00
parent 256a719fba
commit 3a28814db9

View File

@ -2017,7 +2017,11 @@ int main(int argc, char * argv[]) {
toggle_selected(hilighted_offset, me->modifiers);
}
menu_show(context_menu, main_window->ctx);
yutani_window_move(main_window->ctx, context_menu->window, me->new_x + main_window->x, me->new_y + main_window->y);
if (me->new_x + context_menu->window->width + main_window->x > main_window->ctx->display_width) {
yutani_window_move(main_window->ctx, context_menu->window, me->new_x + main_window->x - context_menu->window->width, me->new_y + main_window->y);
} else {
yutani_window_move(main_window->ctx, context_menu->window, me->new_x + main_window->x, me->new_y + main_window->y);
}
}
}