[MAC] Builds with newly implemented External Player - Focus Issue

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
tvont Offline
Senior Member
Posts: 107
Joined: Oct 2008
Reputation: 0
Post: #1
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://trac.xbmc.orgk/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.
(This post was last modified: 2009-01-14 12:48 by Gamester17.)
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 24,564
Joined: Oct 2003
Reputation: 138
Post: #2
This is because those extra settings are applied only on win32. No such thing has yet been implemented on other platforms.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
find quote
tvont Offline
Senior Member
Posts: 107
Joined: Oct 2008
Reputation: 0
Post: #3
jmarshall Wrote: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
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 24,564
Joined: Oct 2003
Reputation: 138
Post: #4
xbmc/cores/ExternalPlayer/ExternalPlayer.cpp

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

Cheers,
Jonathan

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
find quote
Gamester17 Offline
Team-XBMC Forum Moderator
Posts: 10,595
Joined: Sep 2003
Reputation: 9
Location: Sweden
Post: #5
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://forum.xbmc.org/showthread.php?tid=35739

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

Happy coding! Wink

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
find quote
tvont Offline
Senior Member
Posts: 107
Joined: Oct 2008
Reputation: 0
Post: #6
Gamester17 Wrote: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://forum.xbmc.org/showthread.php?tid=35739

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

Happy coding! Wink

Thanks Gamester & Jmarshall,

will do my best...but I have very little experience with that. And not that much time...
find quote
jeremyhu Offline
Junior Member
Posts: 34
Joined: Jan 2009
Reputation: 0
Post: #7
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:

Code:
void SetPIDFrontProcess(pid_t pid) {
    ProcessSerialNumber psn;

    GetProcessForPID(pid, &psn );
    SetFrontProcess(&psn);
}
find quote
tvont Offline
Senior Member
Posts: 107
Joined: Oct 2008
Reputation: 0
Post: #8
jeremyhu Wrote: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:

Code:
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
find quote
jeremyhu Offline
Junior Member
Posts: 34
Joined: Jan 2009
Reputation: 0
Post: #9
tvont Wrote: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.
find quote
tvont Offline
Senior Member
Posts: 107
Joined: Oct 2008
Reputation: 0
Post: #10
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!
(This post was last modified: 2009-04-07 21:43 by tvont.)
find quote
Post Reply