Helmut.Jahns at sennheiser.com
2008-Dec-01 17:38 UTC
[Swfdec] Swfdec does not respond to key events
Hi, I'm using Swfdec 0.8.2 and cannot process any kepress events to Swfdec, neither on GTK nor using Direct FB. The initial screen is OK, but on pressing a key, swfdec_player_key_press() is invoked providing the Swfdec key ID (with UCS4 key = 0). I noticed that swfdec_dfb_player_handle_input_event() is called by swfdec_marshal, therefore I assume that transmitting the key event message works fine, but may be the way of setting up the player is wrong. Do I need a special Function call for processing key events properly? The setup of Swfdec is listed below. Any help would be appreciated. With kind regards, Helmut Jahns (void) setUpSwfdecPlayer:(NSString*)flashFileUr { unsigned int w, h; IDirectFB* dfb; DIRECTFB(DirectFBCreate,(&dfb)); DIRECTFB(dfb->SetCooperativeLevel,(dfb, DFSCL_EXCLUSIVE)); IDirectFBSurface* surface; DFBSurfaceDescription surface_description = { .flags = DSDESC_CAPS, .caps = DSCAPS_PRIMARY, }; DIRECTFB(dfb->CreateSurface,(dfb, &surface_description, &surface)); DIRECTFB(surface->GetSize,(surface,(int*)&w,(int*)&h)); fprintf(stderr, "DirectFB: width=%u, height=%u\n", w, h); DIRECTFB(surface->Clear,(surface,0,0,0,0xff)); DIRECTFB(surface->Flip,(surface,NULL,DSFLIP_NONE)); ioctl(devfb, FBIOBLANK, 0); // create Cairo and link it to Direct FB surface cairo_surface_t* cairo_surface = cairo_directfb_surface_create(dfb, surface); cr = cairo_create(cairo_surface); cairo_set_tolerance(cr, 1); cairo_set_operator(cr, CAIRO_OPERATOR_OVER); cairo_set_source_rgba(cr, 0, 0, 0, 1); cairo_paint(cr); ioctl(devfb, FBIOBLANK, 0); // create player - swfdec_player_init() is executed implicitely my_player = swfdec_player_new(NULL); // 0: no AS debugger // set file to playback SwfdecURL* flash_file_location swfdec_url_new_from_input ([flashFileUrl cString]); swfdec_player_set_url(my_player, flash_file_location); swfdec_url_free (flash_file_location); // provide renderer to the player SwfdecRenderer* my_renderer swfdec_renderer_new_for_player (cairo_surface, my_player); swfdec_player_set_renderer (my_player, my_renderer); // initial drawing int i; for (i=0; i<3; i++ ) { swfdec_player_advance(my_player, 100); swfdec_player_render(my_player, cr); ioctl(devfb, FBIOBLANK, 0); } // TODO: remove this. This loop has been introduced due to // a delay of the special swf file to permit to draw // the menu icons. } Sennheiser electronic GmbH & Co.KG, Sitz: Wedemark, Handelsregister: AG Hannover HRA 120100, Aufsichtsratsvorsitzender: Prof. Dr. sc. techn. J?rg Sennheiser phG: Sennheiser Beteiligungsgesellschaft mbH, Sitz: Wedemark, Handelsregister: AG Hannover HRB 120179, Gesch?ftsf?hrer: Volker Bartels, Dr. Heinrich Esser, Stefan Junker Diese E-Mail enth?lt vertrauliche oder rechtlich gesch?tzte Informationen. Wenn Sie nicht der beabsichtigte Empf?nger sind, informieren Sie bitte sofort den Absender und l?schen Sie diese E-Mail. Das unbefugte Kopieren dieser E-Mail oder die unbefugte Weitergabe der enthaltenen Informationen ist nicht gestattet. The information contained in this message is confidential or protected by law. If you are not the intended recipient, please contact the sender and delete this message. Any unauthorized copying of this message or unauthorized distribution of the information contained herein is prohibited.
Hey, I'm a bit confused about your code, as it does not use any Swfdec directfb functions, in particular not swfdec_dfb_player_new(), swfdec_dfb_player_set_playing() and swfdec_dfb_main(), which are the things required to get input events working with swfdec-directfb - see the player in the sources for the example. Keep in mind tht Swfdec-directfb is in a bit of an unmaintained state currently, so there might be some bugs lurking. If you're not using swfdec-directfb however, you need to make sure to call swfdec_player_key_press() and swfdec_player_key_release() on the player to send it keyboard input. See the Swfdec documentation for those. Last but not least I am very sure that Keyboard input does work with the Gtk player, as I'm using that all the time. The only problem there can be keyboard focus, as the Swfdec widget does not have a way to indicate keyboard focus. Cheers, Benjamin On Mon, Dec 1, 2008 at 6:38 PM, <Helmut.Jahns at sennheiser.com> wrote:> > Hi, > > I'm using Swfdec 0.8.2 and cannot process any kepress events to Swfdec, > neither on GTK nor using Direct FB. > > The initial screen is OK, but on pressing a key, swfdec_player_key_press() > is invoked providing the Swfdec key ID (with UCS4 key = 0). I noticed that > swfdec_dfb_player_handle_input_event() is called by swfdec_marshal, > therefore I assume that transmitting the key event message works fine, but > may be the way of setting up the player is wrong. > > Do I need a special Function call for processing key events properly? > > The setup of Swfdec is listed below. > > Any help would be appreciated. > > With kind regards, > > Helmut Jahns > > > > > (void) setUpSwfdecPlayer:(NSString*)flashFileUr > > { > unsigned int w, h; > IDirectFB* dfb; > > DIRECTFB(DirectFBCreate,(&dfb)); > DIRECTFB(dfb->SetCooperativeLevel,(dfb, DFSCL_EXCLUSIVE)); > IDirectFBSurface* surface; > DFBSurfaceDescription surface_description = { > .flags = DSDESC_CAPS, > .caps = DSCAPS_PRIMARY, > }; > > DIRECTFB(dfb->CreateSurface,(dfb, &surface_description, &surface)); > DIRECTFB(surface->GetSize,(surface,(int*)&w,(int*)&h)); > fprintf(stderr, "DirectFB: width=%u, height=%u\n", w, h); > DIRECTFB(surface->Clear,(surface,0,0,0,0xff)); > DIRECTFB(surface->Flip,(surface,NULL,DSFLIP_NONE)); > ioctl(devfb, FBIOBLANK, 0); > > // create Cairo and link it to Direct FB surface > cairo_surface_t* cairo_surface > = cairo_directfb_surface_create(dfb, surface); > cr = cairo_create(cairo_surface); > cairo_set_tolerance(cr, 1); > cairo_set_operator(cr, CAIRO_OPERATOR_OVER); > cairo_set_source_rgba(cr, 0, 0, 0, 1); > cairo_paint(cr); > ioctl(devfb, FBIOBLANK, 0); > > // create player - swfdec_player_init() is executed implicitely > my_player = swfdec_player_new(NULL); // 0: no AS debugger > > // set file to playback > SwfdecURL* flash_file_location > swfdec_url_new_from_input ([flashFileUrl cString]); > swfdec_player_set_url(my_player, flash_file_location); > swfdec_url_free (flash_file_location); > > // provide renderer to the player > SwfdecRenderer* my_renderer > swfdec_renderer_new_for_player (cairo_surface, my_player); > swfdec_player_set_renderer (my_player, my_renderer); > > // initial drawing > int i; > for (i=0; i<3; i++ ) > { > swfdec_player_advance(my_player, 100); > swfdec_player_render(my_player, cr); > ioctl(devfb, FBIOBLANK, 0); > } > // TODO: remove this. This loop has been introduced due to > // a delay of the special swf file to permit to draw > // the menu icons. > } > Sennheiser electronic GmbH & Co.KG, Sitz: Wedemark, Handelsregister: AG > Hannover HRA 120100, Aufsichtsratsvorsitzender: Prof. Dr. sc. techn. J?rg > Sennheiser phG: > Sennheiser Beteiligungsgesellschaft mbH, Sitz: Wedemark, Handelsregister: > AG Hannover HRB 120179, Gesch?ftsf?hrer: Volker Bartels, Dr. Heinrich > Esser, Stefan Junker > > Diese E-Mail enth?lt vertrauliche oder rechtlich gesch?tzte Informationen. > Wenn Sie nicht der beabsichtigte Empf?nger sind, informieren Sie bitte > sofort den Absender > und l?schen Sie diese E-Mail. Das unbefugte Kopieren dieser E-Mail oder die > unbefugte Weitergabe der enthaltenen Informationen ist nicht gestattet. > > The information contained in this message is confidential or protected by > law. If you are not the intended recipient, please contact the sender > and delete this message. Any unauthorized copying of this message or > unauthorized distribution of the information contained herein is > prohibited. > > _______________________________________________ > Swfdec mailing list > Swfdec at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/swfdec >