From 5f501ec0109ebcfcd3890511a62b0ef6e60c4d46 Mon Sep 17 00:00:00 2001
From: c vw <dl1ycf@darc.de>
Date: Thu, 5 Dec 2019 10:42:56 +0100
Subject: [PATCH] Go to window mode only if there is enough space

---
 main.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/main.c b/main.c
index bed1b68..ded7365 100644
--- a/main.c
+++ b/main.c
@@ -216,7 +216,10 @@ static void activate_pihpsdr(GtkApplication *app, gpointer data) {
 
 fprintf(stderr,"width=%d height=%d\n", display_width, display_height);
 
-  if(display_width>MAX_DISPLAY_WIDTH || display_height>MAX_DISPLAY_HEIGHT) {
+  // Go to "window" mode if there is enough space on the screen.
+  // Do not forget extra space needed for window top bars, screen bars etc.
+
+  if(display_width>(MAX_DISPLAY_WIDTH+10) && display_height>(MAX_DISPLAY_HEIGHT+30)) {
     display_width=MAX_DISPLAY_WIDTH;
     display_height=MAX_DISPLAY_HEIGHT;
     full_screen=0;
-- 
2.45.2