Re: Howto grab all Maemo5 zoom key events in SDL/SDL_gles app?

2010-05-12 Thread Eero Tamminen

Hi,

Hamalainen Kimmo (Nokia-D/Helsinki) wrote:

On Sun, 2010-05-02 at 13:26 +0200, ext Till Harbaum / Lists wrote:

i'd like to access the zoom keys in a SDL/SDL_gles app (the 3d globe
i uploaded to extras-devel).

The odd thing is that my solution only partly works. Some key presses actually
reach my app as function key presses, but still most of them reach the volume
control. So when repeatedly pressing the zoom buttons my app zooms but also
the volume is changed.

I am using the following code which is inspired by code from scummvm. I am 
calling this code once immediately after the SDL setup is done.


Any idea why this still delivers some key events to the volume control?


It could be that _NET_ACTIVE_WINDOW or MB_CURRENT_APP_WINDOW on the root
window does not correspond to your window.  The volume app is tracking
one of these (I think _NET_ACTIVE_WINDOW) to determine the window whose
ZOOM_KEY window property matters.


Maemo SDL doesn't seem to set all required window properties for
fullscreen windows for tracking of the topmost application to work
properly.  See this bug:
  https://bugs.maemo.org/show_bug.cgi?id=6175#c3

xprop -root produces this when there's a fullscreen SDL window:
_NET_ACTIVE_WINDOW(WINDOW): window id # 0x3e2 


_MB_CURRENT_APP_WINDOW(WINDOW): window id # 0x3e1

I.e. for SDL applications the value in these properties differ,
unlike for normal applications.

_MB_CURRENT_APP_WINDOW is the fullscreen SDL window and
_NET_ACTIVE_WINDOW is the non-fullscreen SDL window.

(I think SDL uses fullscreen window for output and non-fullscreen
one for input.)


- Eero
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Howto grab all Maemo5 zoom key events in SDL/SDL_gles app?

2010-05-04 Thread Javier S. Pedro
Frantisek Dufka wrote:
 I am not sure why there are three X windows in info.info.x11 structure
 (fswindow, wmwindow and window). From brief look into SDL sources it
 seems to me like the 'window' is  used when SDL is initialized with not
 owned pre-created window passed to SDL via SDL_WINDOWID variable,
 otherwise wmwindow and fswindow are used depending of full screen state.
 In case you are not using SDL_WINDOWID maybe setting wmwindow and
 fswindow would help you with volume keys?

WMwindow and FSwindow are containers for window (aka gfxwindow) which is
the one where images are pushed into. On the Fremantle SDL, WMwindow and
FSwindow are alternatively mapped when changing from windowed to fullscreen
mode and viceversa -- on a normal SDL, WMwindow is always mapped.

Also, 
gfxdisplay - window (gfxwindow)
display - wmwindow,fswindow

Else you will get permission errors when you start trying to do more
complicated things.

-- 
Javier

___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Howto grab all Maemo5 zoom key events in SDL/SDL_gles app?

2010-05-04 Thread Kimmo Hämäläinen
On Tue, 2010-05-04 at 16:01 +0200, ext Javier S. Pedro wrote:
 Frantisek Dufka wrote:
  I am not sure why there are three X windows in info.info.x11 structure
  (fswindow, wmwindow and window). From brief look into SDL sources it
  seems to me like the 'window' is  used when SDL is initialized with not
  owned pre-created window passed to SDL via SDL_WINDOWID variable,
  otherwise wmwindow and fswindow are used depending of full screen state.
  In case you are not using SDL_WINDOWID maybe setting wmwindow and
  fswindow would help you with volume keys?
 
 WMwindow and FSwindow are containers for window (aka gfxwindow) which is
 the one where images are pushed into. On the Fremantle SDL, WMwindow and
 FSwindow are alternatively mapped when changing from windowed to fullscreen
 mode and viceversa -- on a normal SDL, WMwindow is always mapped.

Sounds a bit brain-damaged to have two windows when others do fine with
one... But if it must be so, you need to put the ZOOM_KEY property to
both windows because the topmost counts.

-Kimmo

 Also, 
 gfxdisplay - window (gfxwindow)
 display - wmwindow,fswindow
 
 Else you will get permission errors when you start trying to do more
 complicated things.
 

___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Howto grab all Maemo5 zoom key events in SDL/SDL_gles app?

2010-05-03 Thread Frantisek Dufka

Till Harbaum / Lists wrote:

Any idea why this still delivers some key events to the volume control?


Maybe sometimes there is another window active which doesn't have the 
_HILDON_ZOOM_KEY_ATOM set? Something specific to GLES and/or double 
buffering? Does it work with simple SDL app without GLES?





  SDL_SysWMinfo info;
  SDL_VERSION(info.version);  
  if ( SDL_GetWMInfo(info) ) {


/* We use the SDL GFX display (we're using the GFX window too after all) */
Display *dpy = info.info.x11.display;
unsigned long val = 1;
Atom atom_zoom = XInternAtom(dpy, _HILDON_ZOOM_KEY_ATOM, 0);
info.info.x11.lock_func();
Window win = info.info.x11.window;
XUnmapWindow(dpy,win);
XChangeProperty (dpy,win,atom_zoom,XA_INTEGER,32,PropModeReplace,(unsigned char 
*) val,1);
XMapWindow(dpy,win);
info.info.x11.unlock_func();
  }


Does it work for you otherwise? Works better for me without 
XUnmapWindow(dpy,win)/XMapWindow(dpy,win) pair, just XChangeProperty. 
But maybe that's because I am messing with info.info.x11.fswindow and 
info.info.x11.wmwindow and SDL doesn't like (un)mapping those directly.


I am not sure why there are three X windows in info.info.x11 structure 
(fswindow, wmwindow and window). From brief look into SDL sources it 
seems to me like the 'window' is  used when SDL is initialized with not 
owned pre-created window passed to SDL via SDL_WINDOWID variable, 
otherwise wmwindow and fswindow are used depending of full screen state. 
In case you are not using SDL_WINDOWID maybe setting wmwindow and 
fswindow would help you with volume keys?


Frantisek

___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Howto grab all Maemo5 zoom key events in SDL/SDL_gles app?

2010-05-03 Thread Kimmo Hämäläinen
On Sun, 2010-05-02 at 13:26 +0200, ext Till Harbaum / Lists wrote:
 Hi,
 
 i'd like to access the zoom keys in a SDL/SDL_gles app (the 3d globe
 i uploaded to extras-devel).
 
 The odd thing is that my solution only partly works. Some key presses actually
 reach my app as function key presses, but still most of them reach the volume
 control. So when repeatedly pressing the zoom buttons my app zooms but also
 the volume is changed.
 
 I am using the following code which is inspired by code from scummvm. I am 
 calling this code once immediately after the SDL setup is done.
 
 Any idea why this still delivers some key events to the volume control?

It could be that _NET_ACTIVE_WINDOW or MB_CURRENT_APP_WINDOW on the root
window does not correspond to your window.  The volume app is tracking
one of these (I think _NET_ACTIVE_WINDOW) to determine the window whose
ZOOM_KEY window property matters.

-Kimmo

 
   SDL_SysWMinfo info;
   SDL_VERSION(info.version); 
  
   if ( SDL_GetWMInfo(info) ) {   
  
 
 /* We use the SDL GFX display (we're using the GFX window too after all) 
 */
 Display *dpy = info.info.x11.display;
 unsigned long val = 1;
 Atom atom_zoom = XInternAtom(dpy, _HILDON_ZOOM_KEY_ATOM, 0);
 info.info.x11.lock_func();
 Window win = info.info.x11.window;
 XUnmapWindow(dpy,win);
 XChangeProperty 
 (dpy,win,atom_zoom,XA_INTEGER,32,PropModeReplace,(unsigned char *) val,1);
 XMapWindow(dpy,win);
 info.info.x11.unlock_func();
   }
 
 Till
 ___
 maemo-developers mailing list
 maemo-developers@maemo.org
 https://lists.maemo.org/mailman/listinfo/maemo-developers

___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers