Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Trusted Contributor
Posts: 195
Registered: ‎03-12-2012
My Device: PlayBook
My Carrier: None

Re: No screen events when transparent window is on top of camera viewfinder

I tried it on both.

 

Could you get it to compile?

Sucroid.com
Sweet Apps for the Fans
Trusted Contributor
Posts: 195
Registered: ‎03-12-2012
My Device: PlayBook
My Carrier: None

Re: No screen events when transparent window is on top of camera viewfinder

One thing you need to do is to add the libcamapi manually.  You can't find this library under Add Library.

 

You have to go to Project->Properties->C/C++ Build->Settings->QCC Linker->Libraries

and add camapi

 

Otherwise, it wouldn't link.

Sucroid.com
Sweet Apps for the Fans
BlackBerry Development Advisor
Posts: 683
Registered: ‎11-29-2011
My Device: PRIV
My Carrier: Rogers

Re: No screen events when transparent window is on top of camera viewfinder


sucroid wrote:

Both changes need to be present for this to break.

 

Thanks to everyone looking into this mysterious problem.



Actually.. it breaks as soon as I add the TRANSPARENCY change.  It does not need the ZORDER change in order to break.

BlackBerry Development Advisor
Posts: 683
Registered: ‎11-29-2011
My Device: PRIV
My Carrier: Rogers

Re: No screen events when transparent window is on top of camera viewfinder

Seems that all you need to break the NativeCamera sample is the following code:

    int prop = SCREEN_TRANSPARENCY_SOURCE_COLOR;
    screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_TRANSPARENCY, &prop);

 I think I understand what's happening, but I will ask the screen experts.

 

Since you have just turned your APPLICATION window transparent, I believe it no longer receives screen events.  If you want to do a transparent overlay, then I suggest making a CHILD window that sits in front of the viewfinder, and leave your APPLICATION window as-is.  (eg. not transparent).

 

Cheers,

Sean

Developer
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Re: No screen events when transparent window is on top of camera viewfinder

>I tried it on both.

> Could you get it to compile?

Yes compile is fine (I figured that I needed one more library). When I try to start debugging NDK 10 just hangs.

Do I need some beta version on PB itself?

BlackBerry Development Advisor
Posts: 683
Registered: ‎11-29-2011
My Device: PRIV
My Carrier: Rogers

Re: No screen events when transparent window is on top of camera viewfinder

Okay, I had it 50% right.  Spoke with the screen guy....

 

The problem is that screen will only register touch events against the non-transparent parts of your overlay.  Quite likely in your case, the touch events are being delivered to the viewfinder window, and not to your application window.

 

If you blit like this:

int attribs[] = { SCREEN_BLIT_COLOR, 0xff0011ff,
            SCREEN_BLIT_DESTINATION_X, 20, SCREEN_BLIT_DESTINATION_WIDTH, 300,
             SCREEN_BLIT_END };

 

eg. set the alpha channel to "SOLID", then you'll notice that touch events are now delivered if you tap in the blue area, but not elsewhere.

 

This isn't quite what you want... you want the events to be delivered even if the user taps in a transparent area, so what you have to do is the following:

    prop = SCREEN_SENSITIVITY_ALWAYS;
    screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_SENSITIVITY, &prop);

This tells screen to ignore transparency on your foreground window when trying to determine where the events should be sent.

 

Cheers,

Sean

 

Trusted Contributor
Posts: 195
Registered: ‎03-12-2012
My Device: PlayBook
My Carrier: None

Re: No screen events when transparent window is on top of camera viewfinder

Thanks Sean.  I would have never figured this out.

 

I'll give this a try.  My app actually has an OpenGL window on top.  But I think the fix should work.

 

If everything works fine, I'll probably write an article for the knowledge base.

Sucroid.com
Sweet Apps for the Fans
Trusted Contributor
Posts: 195
Registered: ‎03-12-2012
My Device: PlayBook
My Carrier: None

Re: No screen events when transparent window is on top of camera viewfinder


smcveigh wrote:

 

This isn't quite what you want... you want the events to be delivered even if the user taps in a transparent area, so what you have to do is the following:

    prop = SCREEN_SENSITIVITY_ALWAYS;
    screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_SENSITIVITY, &prop);

This tells screen to ignore transparency on your foreground window when trying to determine where the events should be sent.

 

Cheers,

Sean

 


SUCCESS! 

 

This is to confirm that setting the property for the window to

SCREEN_SENSITIVITY_ALWAYS

solves the problem.  This is great.  Otherwise, I would have to tap the buffers from the view finder and create textures which is an overkill for something so simple.

 

Is there anything else about screens that one needs to know about? 

Sucroid.com
Sweet Apps for the Fans
BlackBerry Development Advisor
Posts: 683
Registered: ‎11-29-2011
My Device: PRIV
My Carrier: Rogers

Re: No screen events when transparent window is on top of camera viewfinder


sucroid wrote:

Is there anything else about screens that one needs to know about? 



Oh, there is always something new to learn.  This was news to me Smiley Happy