diff options
Diffstat (limited to 'util/fbcompose/main.cc')
-rw-r--r-- | util/fbcompose/main.cc | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/util/fbcompose/main.cc b/util/fbcompose/main.cc new file mode 100644 index 0000000..870d505 --- /dev/null +++ b/util/fbcompose/main.cc | |||
@@ -0,0 +1,84 @@ | |||
1 | /** main.cc file for the fluxbox compositor. */ | ||
2 | |||
3 | // Copyright (c) 2011 Gediminas Liktaras (gliktaras at gmail dot com) | ||
4 | // | ||
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy | ||
6 | // of this software and associated documentation files (the "Software"), to deal | ||
7 | // in the Software without restriction, including without limitation the rights | ||
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
9 | // copies of the Software, and to permit persons to whom the Software is | ||
10 | // furnished to do so, subject to the following conditions: | ||
11 | // | ||
12 | // The above copyright notice and this permission notice shall be included in | ||
13 | // all copies or substantial portions of the Software. | ||
14 | // | ||
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
21 | // THE SOFTWARE. | ||
22 | |||
23 | |||
24 | #ifdef HAVE_CONFIG_H | ||
25 | #include "config.h" | ||
26 | #endif // HAVE_CONFIG_H | ||
27 | |||
28 | #ifndef SERVERAUTO_COMPOSITING_ONLY | ||
29 | #include "Compositor.hh" | ||
30 | #endif // SERVERAUTO_COMPOSITING_ONLY | ||
31 | #include "CompositorConfig.hh" | ||
32 | #include "Enumerations.hh" | ||
33 | #include "Exceptions.hh" | ||
34 | #include "Logging.hh" | ||
35 | #include "ServerAutoApp.hh" | ||
36 | |||
37 | #include "FbTk/FbString.hh" | ||
38 | |||
39 | #include <X11/Xlib.h> | ||
40 | |||
41 | #include <vector> | ||
42 | #include <cstdlib> | ||
43 | |||
44 | using namespace FbCompositor; | ||
45 | |||
46 | |||
47 | /** | ||
48 | * The entry point. | ||
49 | * | ||
50 | * \param argc The number of command line arguments. | ||
51 | * \param argv An array of strings, containing the arguments. | ||
52 | * \returns Application's exit status. | ||
53 | */ | ||
54 | int main(int argc, char **argv) { | ||
55 | try { | ||
56 | Logger::setLoggingLevel(LOG_LEVEL_WARN); | ||
57 | |||
58 | std::vector<FbTk::FbString> args(argv + 1, argv + argc); | ||
59 | CompositorConfig config(args); | ||
60 | |||
61 | if (config.renderingMode() == RM_ServerAuto) { | ||
62 | ServerAutoApp app(config); | ||
63 | app.eventLoop(); | ||
64 | } | ||
65 | #ifndef SERVERAUTO_COMPOSITING_ONLY | ||
66 | else { | ||
67 | Compositor app(config); | ||
68 | app.eventLoop(); | ||
69 | } | ||
70 | #endif // SERVERAUTO_COMPOSITING_ONLY | ||
71 | } catch (const ConfigException &e) { | ||
72 | std::cerr << e.what() << std::endl; | ||
73 | CompositorConfig::printShortHelp(std::cerr); | ||
74 | return EXIT_FAILURE; | ||
75 | } catch (const PluginException &e) { | ||
76 | std::cerr << "Failed to initialize plugins: " << e.what() << std::endl; | ||
77 | return EXIT_FAILURE; | ||
78 | } catch (const CompositorException &e) { | ||
79 | fbLog_error << e.what() << std::endl; | ||
80 | return EXIT_FAILURE; | ||
81 | } | ||
82 | |||
83 | return EXIT_SUCCESS; | ||
84 | } | ||