libng: Add a get_min_size function to the plugins
PATCH 1/2 libng: Add a get_min_size function to the plugins
Signed-off-by Hans de Goede <[email protected]>
--- libng/grab-ng.h | 1 + libng/plugins/drv0-bsd.c | 8 +++++++ libng/plugins/drv0-v4l2.tmpl.c | 49 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+)
libng/grab-ng.h +1 -0
@@ -292,6 +292,7 @@ struct ng_vid_driver {char * (*get_devname)(void *handle);int (*capabilities)(void *handle);struct ng_attribute * (*list_attrs)(void *handle); +void (*get_min_size)(void *handle,int *min_width,int *min_height);/* overlay */ int (*setupfb)(void *handle,struct ng_video_fmt *fmt,void *base);
libng/plugins/drv0-bsd.c +8 -0
@@ -77,6 +77,7 @@ static int bsd_flags(void *handle);static struct ng_attribute *bsd_attrs (void *handle);static int bsd_read_attr (struct ng_attribute *);static void bsd_write_attr (struct ng_attribute *,int val); +static void bsd_get_min_size (void *hdl,int *min_width,int *min_height);static int bsd_setupfb (void *handle,struct ng_video_fmt *fmt,void *base); static int bsd_overlay(void *handle, struct ng_video_fmt *fmt, int x, int y,
@@ -103,6 +104,7 @@ struct ng_vid_driver bsd_driver = { capabilities: bsd_flags, list_attrs: bsd_attrs, + get_min_size: bsd_get_min_size, setupfb: bsd_setupfb, overlay: bsd_overlay,
@@ -471,6 +473,12 @@ static struct ng_attribute* bsd_attrs(void *handle)return h->attr; } +static void bsd_get_min_size (void *handle,int *min_width,int *min_height) +{ + *min_width =32 ; + *min_height =24 ; +} +/* ---------------------------------------------------------------------- */ static int
libng/plugins/drv0-v4l2.tmpl.c +49 -0
85 lines not on this page · raw message
Signature · 1 line
1.8.1.4
PATCH 2/2 xawtv: Limit minimum window size to minimum capture resolution
Signed-off-by Hans de Goede <[email protected]>
--- x11/xawtv.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
x11/xawtv.c +8 -3
@@ -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,
Signature · 1 line
1.8.1.4