From dc733d0fb0201a9a01fd59f5008ffeaa2e2d1d64 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Thu, 27 Jun 2019 16:08:40 +0200 Subject: [PATCH] SDL2: added nodecorate option --- src/video_display/sdl2.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/video_display/sdl2.cpp b/src/video_display/sdl2.cpp index 49b42155b..df6ee943a 100644 --- a/src/video_display/sdl2.cpp +++ b/src/video_display/sdl2.cpp @@ -5,7 +5,7 @@ * @author Martin Pulec */ /* - * Copyright (c) 2018 CESNET, z. s. p. o. + * Copyright (c) 2018-2019 CESNET, z. s. p. o. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -93,6 +93,7 @@ struct state_sdl2 { bool fs{false}; bool deinterlace{false}; bool vsync{true}; + bool nodecorate{false}; mutex lock; condition_variable frame_consumed_cv; @@ -222,7 +223,7 @@ static void show_help(void) { SDL_Init(0); printf("SDL options:\n"); - printf("\t-d sdl[[:fs|:d|:display=|:driver=|:novsync|:renderer=]*|:help]\n"); + printf("\t-d sdl[[:fs|:d|:display=|:driver=|:novsync|:renderer=|:nodecorate]*|:help]\n"); printf("\twhere:\n"); printf("\t\t d - deinterlace\n"); printf("\t\t fs - fullscreen\n"); @@ -232,7 +233,8 @@ static void show_help(void) printf("%s%s", i == 0 ? "" : ", ", SDL_GetVideoDriver(i)); } printf("\n"); - printf("\t\tnovsync- disable sync on VBlank\n"); + printf("\t novsync - disable sync on VBlank\n"); + printf("\t nodecorate - disable window border\n"); printf("\t\t - renderer index: "); for (int i = 0; i < SDL_GetNumRenderDrivers(); ++i) { SDL_RendererInfo renderer_info; @@ -290,6 +292,10 @@ static int display_sdl_reconfigure_real(void *state, struct video_desc desc) return FALSE; } + if (s->nodecorate) { + SDL_SetWindowBordered(s->window, SDL_FALSE); + } + if (s->renderer) { SDL_DestroyRenderer(s->renderer); } @@ -391,6 +397,8 @@ static void *display_sdl_init(struct module *parent, const char *fmt, unsigned i return &display_init_noerr; } else if (strcmp(tok, "novsync") == 0) { s->vsync = false; + } else if (strcmp(tok, "nodecorate") == 0) { + s->nodecorate = true; } else if (strncmp(tok, "renderer=", strlen("renderer=")) == 0) { s->renderer_idx = atoi(tok + strlen("renderer=")); } else {