• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Connecting to window server after a user login
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Connecting to window server after a user login


  • Subject: Connecting to window server after a user login
  • From: John Scalo <email@hidden>
  • Date: Fri, 01 Aug 2003 00:39:25 -0700

In Panther how should a daemon attach to the window server when a user logs
in? In Jaguar I could accomplish this by doing something like:

void attachToWindowServer(void)
{
mach_port_t port = 0;
mach_port_t task = 0;
kern_return_t result;
long windowServerPID;
FILE* tFILE = popen("ps -axcocommand,pid | grep \"Window
Manager\"","r");

if (tFILE)
{
fscanf(tFILE,"Window Manager %ld",&windowServerPID);
pclose(tFILE);
}
else
{
fileLog("pipe for ps call faild");
return;
}

result = task_for_pid(task_self_trap(),windowServerPID, &task);
if (0 != result)
fileLog("\ntask_for_pid error: %d",result);

result = task_get_special_port(task,TASK_BOOTSTRAP_PORT,&port);
if (0 != result)
fileLog("\ntask_get_special_port error: %d",result);

result = task_set_special_port(task_self_trap(),
TASK_BOOTSTRAP_PORT,port);
if (0 != result)
fileLog("\ntask_set_special_port error: %d",result);
}

But this fails in Panther and seems rather hacky anyway.

BTW, all I really need this for is so that the daemon can call 'open' to
launch another Cocoa app. For security reasons, this app cannot be a user
login item.

Thanks
John
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Learning Mac programming (Cocoa)
  • Next by Date: Re: Learning Mac programming (Cocoa)
  • Previous by thread: Re: Learning Mac programming (Cocoa)
  • Next by thread: Centering a view in an NSScrollView
  • Index(es):
    • Date
    • Thread