diff mbox

[2/2] xawtv: Limit minimum window size to minimum capture resolution

Message ID 1364734085-4227-2-git-send-email-hdegoede@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Hans de Goede March 31, 2013, 12:48 p.m. UTC
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 x11/xawtv.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/x11/xawtv.c b/x11/xawtv.c
index bade35a..9c578da 100644
--- a/x11/xawtv.c
+++ b/x11/xawtv.c
@@ -1636,7 +1636,7 @@  create_launchwin(void)
 int
 main(int argc, char *argv[])
 {
-    int            i;
+    int            i, min_width, min_height;
     unsigned long  freq;
 
     hello_world("xawtv");
@@ -1784,11 +1784,16 @@  main(int argc, char *argv[])
     XSetWMProtocols(XtDisplay(app_shell), XtWindow(app_shell),
 		    &WM_DELETE_WINDOW, 1);
 
+    drv->get_min_size(h_drv, &min_width, &min_height);
+    min_width  = ((min_width + (WIDTH_INC - 1)) / WIDTH_INC) * WIDTH_INC;
+    min_height = ((min_height + (HEIGHT_INC - 1)) / HEIGHT_INC) * HEIGHT_INC;
+    if (debug)
+	fprintf(stderr,"main: window min size %dx%d\n", min_width, min_height);
     XtVaSetValues(app_shell,
 		  XtNwidthInc,  WIDTH_INC,
 		  XtNheightInc, HEIGHT_INC,
-		  XtNminWidth,  WIDTH_INC,
-		  XtNminHeight, HEIGHT_INC,
+		  XtNminWidth,  min_width,
+		  XtNminHeight, min_height,
 		  NULL);
     if (f_drv & CAN_TUNE)
 	XtVaSetValues(chan_shell,