Browse Source

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

K. Lange 2 years ago
parent
commit
3a28814db9
1 changed files with 5 additions and 1 deletions
  1. 5 1
      apps/file-browser.c

+ 5 - 1
apps/file-browser.c

@@ -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);
+										}
 									}
 								}