Merge branch 'central-widget'
[krunner.git] / main.cpp
blob486a641b29170a52ad9794d3cf5b6b06d3ef5fc1
1 /*
2 * Copyright (C) 2006 Aaron Seigo <aseigo@kde.org>
3 * Copyright (C) 2006 Zack Rusin <zack@kde.org>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Library General Public License version 2 as
7 * published by the Free Software Foundation
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details
14 * You should have received a copy of the GNU Library General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #include <KAboutData>
21 #include <KCmdLineArgs>
22 #include <kdebug.h>
23 #include <KLocale>
25 #include "krunnerapp.h"
26 #include "saverengine.h"
27 #include "startupid.h"
28 #include "kscreensaversettings.h" // contains screen saver config
29 #include "klaunchsettings.h" // contains startup config
31 #include <X11/extensions/Xrender.h>
33 static const char description[] = I18N_NOOP( "KDE run command interface" );
34 static const char version[] = "0.1";
37 bool KRunnerApp::s_haveCompositeManager = false;
39 int main(int argc, char* argv[])
41 KAboutData aboutData( "krunner", 0, ki18n( "Run Command Interface" ),
42 version, ki18n(description), KAboutData::License_GPL,
43 ki18n("(c) 2006, Aaron Seigo") );
44 aboutData.addAuthor( ki18n("Aaron J. Seigo"),
45 ki18n( "Author and maintainer" ),
46 "aseigo@kde.org" );
48 KCmdLineArgs::init(argc, argv, &aboutData);
49 if (!KUniqueApplication::start()) {
50 return 0;
53 // thanks to zack rusin and frederik for pointing me in the right direction
54 // for the following bits of X11 code
55 // Display *dpy = XOpenDisplay(0); // open default display
56 // if (!dpy)
57 // {
58 // kError() << "Cannot connect to the X server" << endl;
59 // return 1;
60 // }
61 //
62 // bool argbVisual = false ;
63 // KRunnerApp::s_haveCompositeManager = XGetSelectionOwner(dpy,
64 // XInternAtom(dpy,
65 // "_NET_WM_CM_S0",
66 // false));
67 //
68 // Colormap colormap = 0;
69 // Visual *visual = 0;
70 //
71 // if (KRunnerApp::s_haveCompositeManager)
72 // {
73 // int screen = DefaultScreen(dpy);
74 // int eventBase, errorBase;
75 //
76 // if (XRenderQueryExtension(dpy, &eventBase, &errorBase))
77 // {
78 // int nvi;
79 // XVisualInfo templ;
80 // templ.screen = screen;
81 // templ.depth = 32;
82 // templ.c_class = TrueColor;
83 // XVisualInfo *xvi = XGetVisualInfo(dpy, VisualScreenMask |
84 // VisualDepthMask |
85 // VisualClassMask,
86 // &templ, &nvi);
87 // for (int i = 0; i < nvi; ++i)
88 // {
89 // XRenderPictFormat *format = XRenderFindVisualFormat(dpy,
90 // xvi[i].visual);
91 // if (format->type == PictTypeDirect && format->direct.alphaMask)
92 // {
93 // visual = xvi[i].visual;
94 // colormap = XCreateColormap(dpy, RootWindow(dpy, screen),
95 // visual, AllocNone);
96 // argbVisual = true;
97 // break;
98 // }
99 // }
100 // }
102 // KRunnerApp::s_haveCompositeManager = argbVisual;
103 // }
105 // kDebug() << "KRunnerApp::s_haveCompositeManager: " << KRunnerApp::s_haveCompositeManager << endl;
107 KRunnerApp app;
109 // if (KRunnerApp::s_haveCompositeManager) {
110 // app = new KRunnerApp(dpy, Qt::HANDLE(visual), Qt::HANDLE(colormap));
111 // } else {
112 // app = new KRunnerApp;//(dpy, 0, 0);
113 // }
115 int rc = app.exec();
116 //delete app;
117 return rc;