here's a patch add command-line switches to disable keyboard and mouse input.
Niels, there's something to review in the patch with respect to vjsdl[]. From the code I see it's possible/planned to have several sdl outputs. (would be great to know how/to have !). This modification does not take that into account, it uses info->vjsdl[0].
Cheers, Charlot
diff --git a/veejay-current/veejay-server/veejay/veejay.c b/veejay-current/veejay-server/veejay/veejay.c index 43a3031..06eee33 100644 --- a/veejay-current/veejay-server/veejay/veejay.c +++ b/veejay-current/veejay-server/veejay/veejay.c @@ -51,6 +51,9 @@ static veejay_t *info = NULL; static float override_fps = 0.0; static int default_geometry_x = -1; static int default_geometry_y = -1; +static int use_keyboard = 1; +static int use_mouse = 1; +static int show_cursor = 0; static int force_video_file = 0; // unused static int override_pix_fmt = 0; static int switch_jpeg = 0; @@ -244,7 +247,12 @@ static void Usage(char *progname) " -x/--geometry-x <num> \tTop left x offset for SDL video window\n"); fprintf(stderr, " -y/--geometry-y <num> \tTop left y offset for SDL video window\n"); - + fprintf(stderr, + " --no-keyboard \t\t\tdisable keyboard for SDL video window\n"); + fprintf(stderr, + " --no-mouse \t\t\tdisable mouse for SDL video window\n"); + fprintf(stderr, + " --show-cursor \t\t\tshow mouse cursor in SDL video window\n"); #endif fprintf(stderr, " -A/--all [num] \t\tStart with capture device <num> \n"); @@ -399,6 +407,15 @@ static int set_option(const char *name, char *value) else if (strcmp(name, "geometry-y") == 0 || strcmp(name,"y")==0) { default_geometry_y = atoi(optarg); } + else if (strcmp(name, "no-keyboard") == 0) { + use_keyboard = 0; + } + else if (strcmp(name, "no-mouse") == 0) { + use_mouse = 0; + } + else if (strcmp(name, "show-cursor") == 0) { + show_cursor = 1; + } else if(strcmp(name,"dump-events")==0 || strcmp(name,"u")==0) { info->dump = 1; } @@ -495,6 +512,9 @@ static int check_command_line_options(int argc, char *argv[]) {"dummy",0,0,0}, {"geometry-x",1,0,0}, {"geometry-y",1,0,0}, + {"no-keyboard",0,0,0}, + {"no-mouse",0,0,0}, + {"show-cursor",0,0,0}, {"auto-loop",0,0,0}, {"fps",1,0,0}, {"no-color",0,0,0}, @@ -727,7 +747,13 @@ int main(int argc, char **argv) veejay_msg(VEEJAY_MSG_ERROR, "Cannot start Vveejay"); return 0; } - +#ifdef HAVE_SDL + if(info->video_out == 0) { + vj_sdl_use_keyboard(info->sdl[0], use_keyboard); + vj_sdl_use_mouse(info->sdl[0], use_mouse); + vj_sdl_show_cursor(info->sdl[0], show_cursor); + } +#endif if(auto_loop) veejay_auto_loop(info);
diff --git a/veejay-current/veejay-server/veejay/vj-event.c b/veejay-current/veejay-server/veejay/vj-event.c index 6717f35..d844c8a 100644 --- a/veejay-current/veejay-server/veejay/vj-event.c +++ b/veejay-current/veejay-server/veejay/vj-event.c @@ -1548,12 +1548,6 @@ int vj_event_parse_msg( void *ptr, char *msg, int msg_len ) return 1; }
On Fri, Jan 27, 2012 at 1:49 PM, Charles Goyard <c...@fsck.fr> wrote: > Hi all,
> here's a patch add command-line switches to disable keyboard and mouse > input.
> Niels, there's something to review in the patch with respect to vjsdl[]. > From the code I see it's possible/planned to have several sdl outputs. > (would be great to know how/to have !). This modification does not take > that into account, it uses info->vjsdl[0].
> +void vj_sdl_use_keyboard(vj_sdl *vjsdl, int x) { > + vjsdl->use_keyboard = x; > + if(vjsdl->use_keyboard == 1) > + SDL_EventState(SDL_KEYDOWN, SDL_ENABLE); > + else > + SDL_EventState(SDL_KEYDOWN, SDL_DISABLE); > +} > + > +void vj_sdl_use_mouse(vj_sdl *vjsdl, int x) { > + vjsdl->mouse_motion = x; > + if(vjsdl->mouse_motion == 1) > + SDL_EventState(SDL_MOUSEMOTION, SDL_ENABLE); > + else > + SDL_EventState(SDL_MOUSEMOTION, SDL_IGNORE); > +} > +void vj_sdl_show_cursor(vj_sdl *vjsdl, int x) { > + vjsdl->show_cursor = x; > + if (vjsdl->show_cursor == 1) > + SDL_ShowCursor(SDL_ENABLE); > + else > + SDL_ShowCursor(SDL_DISABLE); > +} > + > + > void vj_sdl_resize( vj_sdl *vjsdl , int scaled_width, int scaled_height, > int fs ) > { > //@ sw_scale_width is misleading ; it lets SDL use the BES > diff --git a/veejay-current/veejay-server/veejay/vj-sdl.h > b/veejay-current/veejay-server/veejay/vj-sdl.h > index 3dd0c53..e623b24 100644 > --- a/veejay-current/veejay-server/veejay/vj-sdl.h > +++ b/veejay-current/veejay-server/veejay/vj-sdl.h > @@ -66,7 +66,9 @@ void vj_sdl_resize( vj_sdl *vjsdl , int scaled_width, > int scaled_height, int fs > int vj_sdl_screen_w( vj_sdl *vjsdl ); > int vj_sdl_screen_h( vj_sdl *vjsdl ); > void vj_sdl_flip( vj_sdl *vjsdl ); > - > +void vj_sdl_use_keyboard( vj_sdl *vjsdl, int x); > +void vj_sdl_use_mouse( vj_sdl *vjsdl, int x); > +void vj_sdl_show_cursor( vj_sdl *vjsdl, int x);
> #endif > #endif
> -- > You received this message because you are subscribed to the Google Groups > "veejay-discussion" group. > To post to this group, send email to veejay-discussion@googlegroups.com. > To unsubscribe from this group, send email to > veejay-discussion+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/veejay-discussion?hl=en.
> Thanks for the patch, I might merge it into master, > But, I am curious as to why you need no keyboard / no mouse ?
In fact, I just need no keyboard, to prevent accidental press of some function key, because the information encoded in the video controls a motor. Just in case X focus in not in the good window.I just find out I'll do the same for the mouse and cursor, since everything was in place already.
So... What's this multi-sdl window code about ;) ?
On Fri, Jan 27, 2012 at 5:13 PM, Charles Goyard <c...@fsck.fr> wrote: > Niels Elburg wrote: > > Hi Charles,
> > Thanks for the patch, I might merge it into master, > > But, I am curious as to why you need no keyboard / no mouse ?
In fact, I just need no keyboard, to prevent accidental press of some
function key, because the information encoded in the video controls a
motor. Just in case X focus in not in the good window.I just find out
OK, patch accepted! I'll merge it in over the weekend :)
> I'll do the same for the mouse and cursor, since everything was in place > already.
> So... What's this multi-sdl window code about ;) ?
It's just one of the many features I never entirely worked out, originally it was intended to have a dual setup, where there's one video on the second monitor in full screen and a clone of it on the first monitor, but in windowed mode (for the keyboard/mouse controls).
> -- > You received this message because you are subscribed to the Google Groups > "veejay-discussion" group. > To post to this group, send email to veejay-discussion@googlegroups.com. > To unsubscribe from this group, send email to > veejay-discussion+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/veejay-discussion?hl=en.