本文整理汇总了C++中DCOPClient::setDefaultObject方法的典型用法代码示例。如果您正苦于以下问题:C++ DCOPClient::setDefaultObject方法的具体用法?C++ DCOPClient::setDefaultObject怎么用?C++ DCOPClient::setDefaultObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DCOPClient
的用法示例。
在下文中一共展示了DCOPClient::setDefaultObject方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: aboutData
extern "C" KDE_EXPORT int kdemain(int argc, char *argv[])
{
bool restored = false;
for(int arg = 1; arg < argc; arg++)
{
if(!qstrcmp(argv[arg], "-session"))
{
restored = true;
break;
}
}
if(!restored)
{
// we only do the multihead fork if we are not restored by the session
// manager, since the session manager will register multiple kwins,
// one for each screen...
QCString multiHead = getenv("KDE_MULTIHEAD");
if(multiHead.lower() == "true")
{
Display *dpy = XOpenDisplay(NULL);
if(!dpy)
{
fprintf(stderr, "%s: FATAL ERROR while trying to open display %s\n", argv[0], XDisplayName(NULL));
exit(1);
}
int number_of_screens = ScreenCount(dpy);
KWinInternal::screen_number = DefaultScreen(dpy);
int pos; // temporarily needed to reconstruct DISPLAY var if multi-head
QCString display_name = XDisplayString(dpy);
XCloseDisplay(dpy);
dpy = 0;
if((pos = display_name.findRev('.')) != -1)
display_name.remove(pos, 10); // 10 is enough to be sure we removed ".s"
QCString envir;
if(number_of_screens != 1)
{
for(int i = 0; i < number_of_screens; i++)
{
// if execution doesn't pass by here, then kwin
// acts exactly as previously
if(i != KWinInternal::screen_number && fork() == 0)
{
KWinInternal::screen_number = i;
// break here because we are the child process, we don't
// want to fork() anymore
break;
}
}
// in the next statement, display_name shouldn't contain a screen
// number. If it had it, it was removed at the "pos" check
envir.sprintf("DISPLAY=%s.%d", display_name.data(), KWinInternal::screen_number);
if(putenv(strdup(envir.data())))
{
fprintf(stderr, "%s: WARNING: unable to set DISPLAY environment variable\n", argv[0]);
perror("putenv()");
}
}
}
}
KGlobal::locale()->setMainCatalogue("kwin");
KAboutData aboutData("kwin", I18N_NOOP("KWin"), version, description, KAboutData::License_GPL, I18N_NOOP("(c) 1999-2005, The KDE Developers"));
aboutData.addAuthor("Matthias Ettrich", 0, "[email protected]");
aboutData.addAuthor("Cristian Tibirna", 0, "[email protected]");
aboutData.addAuthor("Daniel M. Duley", 0, "[email protected]");
aboutData.addAuthor("Luboš Luňák", I18N_NOOP("Maintainer"), "[email protected]");
KCmdLineArgs::init(argc, argv, &aboutData);
KCmdLineArgs::addCmdLineOptions(args);
if(signal(SIGTERM, KWinInternal::sighandler) == SIG_IGN)
signal(SIGTERM, SIG_IGN);
if(signal(SIGINT, KWinInternal::sighandler) == SIG_IGN)
signal(SIGINT, SIG_IGN);
if(signal(SIGHUP, KWinInternal::sighandler) == SIG_IGN)
signal(SIGHUP, SIG_IGN);
KApplication::disableAutoDcopRegistration();
KWinInternal::Application a;
KWinInternal::SessionManaged weAreIndeed;
KWinInternal::SessionSaveDoneHelper helper;
fcntl(ConnectionNumber(qt_xdisplay()), F_SETFD, 1);
QCString appname;
if(KWinInternal::screen_number == 0)
appname = "kwin";
else
appname.sprintf("kwin-screen-%d", KWinInternal::screen_number);
DCOPClient *client = a.dcopClient();
client->registerAs(appname.data(), false);
client->setDefaultObject("KWinInterface");
//.........这里部分代码省略.........