From f4f3b07b14cf150bf3cffe4bb518369c1088fca1 Mon Sep 17 00:00:00 2001 From: Emanuele Fornara Date: Fri, 23 Apr 2021 14:55:20 +0200 Subject: [PATCH] rpi: center the window --- src/video/raspberry/SDL_rpivideo.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/video/raspberry/SDL_rpivideo.c b/src/video/raspberry/SDL_rpivideo.c index cbcca20d3..3eb8d707a 100644 --- a/src/video/raspberry/SDL_rpivideo.c +++ b/src/video/raspberry/SDL_rpivideo.c @@ -298,8 +298,6 @@ RPI_CreateWindow(_THIS, SDL_Window * window) window->flags |= SDL_WINDOW_OPENGL; /* Create a dispman element and associate a window to it */ - dst_rect.x = 0; - dst_rect.y = 0; if (window_aspect >= display_aspect) { dst_rect.width = display->desktop_mode.w; dst_rect.height = display->desktop_mode.w / window_aspect; @@ -307,6 +305,9 @@ RPI_CreateWindow(_THIS, SDL_Window * window) dst_rect.width = display->desktop_mode.h * window_aspect; dst_rect.height = display->desktop_mode.h; } + /* Center the dispman element */ + dst_rect.x = (display->desktop_mode.w - dst_rect.width) / 2; + dst_rect.y = (display->desktop_mode.h - dst_rect.height) / 2; src_rect.x = 0; src_rect.y = 0;