PDA

View Full Version : [MAC] Builds with newly implemented External Player - Focus Issue


tvont
2009-01-13, 22:10
External players do not gain the focus against XBMC, even if XBMC runs in windowed mode

Jester is programming very hard to fix this - but he is a win32 programmer so he suggested to open a new thread in the XBMC for Mac forum section for this one.
First of all, the current sources (build 17061) with the new patch (http://xbmc.org/track/ticket/5656), which should fix the focus issue, are building well on Mac OS X 10.5.6.
Unfortunately the patch does not fix the focus issue on OSX. Jester said, the focus is currently on win32...

As I have no idea how to implement this for Mac OS X, I ask here, what to do to make this work.

jmarshall
2009-01-13, 23:44
This is because those extra settings are applied only on win32. No such thing has yet been implemented on other platforms.

tvont
2009-01-14, 00:34
This is because those extra settings are applied only on win32. No such thing has yet been implemented on other platforms.

Could you give me a hint on which files I have to work on?

Thanks

jmarshall
2009-01-14, 00:43
xbmc/cores/ExternalPlayer/ExternalPlayer.cpp

It's the linux run command you have to work on. Compare with the win32 one.

Cheers,
Jonathan

Gamester17
2009-01-14, 13:01
You might also get some ideas on how to launch unix apps (like in Linux and Mac) from looking at the code inside the Launcher python script => http://xbmc.org/forum/showthread.php?t=35739

In addition, there where as well some older discussion about launching unix apps here => http://xbmc.org/forum/showthread.php?t=30659

Happy coding! :;):

tvont
2009-01-15, 00:44
You might also get some ideas on how to launch unix apps (like in Linux and Mac) from looking at the code inside the Launcher python script => http://xbmc.org/forum/showthread.php?t=35739

In addition, there where as well some older discussion about launching unix apps here => http://xbmc.org/forum/showthread.php?t=30659

Happy coding! :;):

Thanks Gamester & Jmarshall,

will do my best...but I have very little experience with that. And not that much time...

jeremyhu
2009-01-17, 10:28
The external player should themselves claim focus, but you can force this if they don't by doing:

SetFrontProcess(&psn);

where psn is a ProcessSerialNumber for the app you want to take focus. If you just have the PID, you want to do:


void SetPIDFrontProcess(pid_t pid) {
ProcessSerialNumber psn;

GetProcessForPID(pid, &psn );
SetFrontProcess(&psn);
}

tvont
2009-01-18, 13:47
The external player should themselves claim focus, but you can force this if they don't by doing:

SetFrontProcess(&psn);

where psn is a ProcessSerialNumber for the app you want to take focus. If you just have the PID, you want to do:


void SetPIDFrontProcess(pid_t pid) {
ProcessSerialNumber psn;

GetProcessForPID(pid, &psn );
SetFrontProcess(&psn);
}


Many thanks!
I really feel somekind of desperate as I am not a programmer, even if I can find mistakes in written code...sometimes.
Maybe if you can also tell me on how to get the pid of the launched player, I could implement this into ExternalPlayer.cpp

jeremyhu
2009-02-15, 12:20
Many thanks!
I really feel somekind of desperate as I am not a programmer, even if I can find mistakes in written code...sometimes.
Maybe if you can also tell me on how to get the pid of the launched player, I could implement this into ExternalPlayer.cpp

Sorry, been away for a bit... I haven't looked at the code myself, but there should be a fork() somewhere before the exec() that launches the external player. The fork() returns the pid_t.

tvont
2009-04-07, 22:39
Thanks, jeremyhu, but: currently I am stuck here.

Could it be that the focus issue is an issue of XBMC itself? I mean, i can give any "force on top" parameter to any external player - xbmc still occupies the topmost focus, also while beeing windowed.

as far as I know the windowmanagement of an application should release the focus if another application puts itsself on top.

If this issue is resolved there are no more focus probs anymore.

Could someone help here, please?

Many thanks in advance!

davilla
2009-04-07, 23:33
Thanks, jeremyhu, but: currently I am stuck here.

Could it be that the focus issue is an issue of XBMC itself? I mean, i can give any "force on top" parameter to any external player - xbmc still occupies the topmost focus, also while beeing windowed.

as far as I know the windowmanagement of an application should release the focus if another application puts itsself on top.

If this issue is resolved there are no more focus probs anymore.

Could someone help here, please?

Many thanks in advance!

see CocoaInterface.mm line 394.

comment out

[mainWindow setLevel:CGShieldingWindowLevel()];

uncomment

//[mainWindow setLevel:NSNormalWindowLevel];

CGShieldingWindowLevel() means nothing gets above, you need to minimize the app first. This is for fullscreen mode.

as for windowed, not sure what you are taking about, finder always lets me put something in front of a windowed xbmc.

to pop another app in front, use the SetFrontProcess API. need the ProcessSerialNumber of the App you want in front.

tvont
2009-04-08, 20:02
Thanks again for you help, Davilla.

uncommenting the prooper line should not be a prob for me...but the second hint is quite difficult for me. Where should I put in the code for bringng the external player to the foreground? I thought, giving the external player the correct "force on top" parameter should be enough...it isn't. Finder - and here you are absolutely right - has no problem to bring another app in front of a windowed XBMC, alone the parameter given f.i. to VLC is not enough to force VLC on top.

davilla
2009-04-08, 20:15
Thanks again for you help, Davilla.

uncommenting the prooper line should not be a prob for me...but the second hint is quite difficult for me. Where should I put in the code for bringng the external player to the foreground? I thought, giving the external player the correct "force on top" parameter should be enough...it isn't. Finder - and here you are absolutely right - has no problem to bring another app in front of a windowed XBMC, alone the parameter given f.i. to VLC is not enough to force VLC on top.

after you launch the external player, find it's PID, convert it to a psn and call SetFrontProcess. XBMCHelper has routines for finding a PID given the process name.

I've not looked at the external player code in OSX yet. It's on the radar for 9.04 release.

tvont
2009-04-08, 23:10
Many thanks for your effort.

I think its hopeless for me to get this programmed by myself quick...as I do not know cpp very well. Do you have a timeframe for 9.04?

I don't think its much more work than half an hour for you - for me it looks like having to do more than a few days to get into the XBMC code. I even do not have an idea how to get the pid from the external player through XBMCHelper.

davilla
2009-04-09, 00:57
Many thanks for your effort.

I think its hopeless for me to get this programmed by myself quick...as I do not know cpp very well. Do you have a timeframe for 9.04?

I don't think its much more work than half an hour for you - for me it looks like having to do more than a few days to get into the XBMC code. I even do not have an idea how to get the pid from the external player through XBMCHelper.

it's in the queue, that's all I can say right now.

tvont
2009-04-12, 19:58
Davilla, could you please leave me a note as soon as this is in work? I would like to compile and test on OSX.

Thanks and regards

tvont
2009-10-20, 16:16
Hi,

have been away a while...is there a fix now for the external player playing in the background on OSX? This error is open for almost 11 month now.
Thanks for replying,

TvonT