aboutsummaryrefslogtreecommitdiff
path: root/src/cli_info.cc
diff options
context:
space:
mode:
authorMathias Gumz <akira at fluxbox dot org>2014-02-18 18:34:35 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2014-02-18 18:34:35 (GMT)
commit43bdf499d56c09a520dc3bc03438dee4092d3d58 (patch)
treefc08fe113eb7c577eb402bf9ffebd8038d4f90da /src/cli_info.cc
parent3696562aa87c7e68cb8b00b85f0e8d5cf2d199bf (diff)
downloadfluxbox-43bdf499d56c09a520dc3bc03438dee4092d3d58.zip
fluxbox-43bdf499d56c09a520dc3bc03438dee4092d3d58.tar.bz2
Fix race condition on shutdown
This commit fixes primarily a race condition that occurs when xinit(1) shuts down: by not acting properly fluxbox gets caught in an infinite loop. It caused bug #1100. xinit(1) sends a SIGHUP signal to all processes. fluxbox tries to shutdown itself properly by shutting down workspaces and screens. While doing that, the Xserver might be gone already. Additionally, fluxbox used to restart() itself on SIGHUP, which is clearly not the right thing to do when xinit(1) is about to end the session. So, fluxbox does this: * handling SIGHUP now shuts down fluxbox without clearing workspaces and screens. * A 2 second alarm() is triggered in Fluxbox::shutdown() as a last resort * XSetIOErrorHandler() is used to recognize the disconnect from the xserver. * SIGUSR1 is for restarting fluxbox, SIGUSR2 for reloading the config * FbTk/SignalHandler.cc/hh is gone; this unused abstraction served currently no real purpose. Signal handling is now done in main.cc * Unrelated to the issue itself src/main.cc was trimmed down quite a bit and the code (responsible for handling the command line interface) was moved to src/cli*
Diffstat (limited to 'src/cli_info.cc')
-rw-r--r--src/cli_info.cc191
1 files changed, 191 insertions, 0 deletions
diff --git a/src/cli_info.cc b/src/cli_info.cc
new file mode 100644
index 0000000..6156d56
--- /dev/null
+++ b/src/cli_info.cc
@@ -0,0 +1,191 @@
1// cli_info.cc for Fluxbox Window Manager
2// Copyright (c) 2014 - Mathias Gumz <akira at fluxbox.org>
3//
4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"),
6// to deal in the Software without restriction, including without limitation
7// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8// and/or sell copies of the Software, and to permit persons to whom the
9// Software is furnished to do so, subject to the following conditions:
10//
11// The above copyright notice and this permission notice shall be included in
12// all copies or substantial portions of the Software.
13//
14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE.
21
22#include "cli.hh"
23#include "defaults.hh"
24#include "version.h"
25
26#include "FbTk/I18n.hh"
27#include "FbTk/StringUtil.hh"
28
29#ifdef HAVE_CONFIG_H
30#include "config.h"
31#endif // HAVE_CONFIG_H
32
33#ifdef HAVE_CSTRING
34 #include <cstring>
35#else
36 #include <string.h>
37#endif
38
39using std::endl;
40using std::ostream;
41
42void FluxboxCli::showInfo(ostream &ostr) {
43 _FB_USES_NLS;
44 ostr <<
45 _FB_CONSOLETEXT(Common, FluxboxVersion, "Fluxbox version", "Fluxbox version heading")
46 << ": "
47 << __fluxbox_version <<endl;
48
49 if (strlen(gitrevision()) > 0)
50 ostr << _FB_CONSOLETEXT(Common, SvnRevision, "GIT Revision", "Revision number in GIT repositary")
51 << ": "
52 << gitrevision() << endl;
53#if defined(__DATE__) && defined(__TIME__)
54 ostr << _FB_CONSOLETEXT(Common, Compiled, "Compiled", "Time fluxbox was compiled")
55 << ": "
56 << __DATE__
57 << " "
58 << __TIME__ << endl;
59#endif
60#ifdef __fluxbox_compiler
61 ostr << _FB_CONSOLETEXT(Common, Compiler, "Compiler", "Compiler used to build fluxbox")
62 << ": "
63 << __fluxbox_compiler << endl;
64#endif // __fluxbox_compiler
65#ifdef __fluxbox_compiler_version
66 ostr << _FB_CONSOLETEXT(Common, CompilerVersion, "Compiler version", "Compiler version used to build fluxbox")
67 << ": "
68 << __fluxbox_compiler_version << endl;
69#endif // __fluxbox_compiler_version
70
71 ostr << endl
72 <<_FB_CONSOLETEXT(Common, Defaults, "Defaults", "Default values compiled in")
73 << ": " << endl;
74
75 ostr <<_FB_CONSOLETEXT(Common, DefaultMenuFile, " menu", "default menu file (right aligned - make sure same width as other default values)")
76 << ": "
77 << FbTk::StringUtil::expandFilename(DEFAULTMENU) << endl;
78 ostr << _FB_CONSOLETEXT(Common, DefaultStyle, " style", "default style (right aligned - make sure same width as other default values)")
79 << ": "
80 << FbTk::StringUtil::expandFilename(DEFAULTSTYLE) << endl;
81
82 ostr << _FB_CONSOLETEXT(Common, DefaultKeyFile, " keys", "default key file (right aligned - make sure same width as other default values)")
83 << ": "
84 << FbTk::StringUtil::expandFilename(DEFAULTKEYSFILE) << endl;
85 ostr << _FB_CONSOLETEXT(Common, DefaultInitFile, " init", "default init file (right aligned - make sure same width as other default values)")
86 << ": "
87 << FbTk::StringUtil::expandFilename(DEFAULT_INITFILE) << endl;
88
89#ifdef NLS
90 ostr << _FB_CONSOLETEXT(Common, DefaultLocalePath, " nls", "location for localization files (right aligned - make sure same width as other default values)")
91 << ": "
92 << FbTk::StringUtil::expandFilename(LOCALEPATH) << endl;
93#endif
94
95 const char NOT[] = "-";
96 ostr << endl
97 << _FB_CONSOLETEXT(Common, CompiledOptions, "Compiled options", "Options used when compiled")
98 << " (" << NOT << " => "
99 << _FB_CONSOLETEXT(Common, Disabled, "disabled", "option is turned off") << "): " << endl
100 <<
101
102/**** NOTE: This list is in alphabetical order! ****/
103
104#ifndef HAVE_FRIBIDI
105 NOT <<
106#endif
107 "BIDI" << endl <<
108
109#ifndef DEBUG
110 NOT <<
111#endif // DEBUG
112 "DEBUG" << endl <<
113
114#ifndef USE_EWMH
115 NOT <<
116#endif // USE_EWMH
117 "EWMH" << endl <<
118
119#ifndef HAVE_IMLIB2
120 NOT<<
121#endif // HAVE_IMLIB2
122 "IMLIB2" << endl <<
123
124#ifndef NLS
125 NOT<<
126#endif // NLS
127 "NLS" << endl <<
128
129#ifndef REMEMBER
130 NOT <<
131#endif // REMEMBER
132 "REMEMBER" << endl <<
133
134#ifndef HAVE_XRENDER
135 NOT <<
136#endif // HAVE_XRENDER
137 "RENDER" << endl <<
138
139#ifndef SHAPE
140 NOT <<
141#endif // SHAPE
142 "SHAPE" << endl <<
143
144#ifndef USE_SLIT
145 NOT <<
146#endif // SLIT
147 "SLIT" << endl <<
148
149#ifndef USE_SYSTRAY
150 NOT <<
151#endif
152 "SYSTEMTRAY" << endl <<
153
154
155#ifndef USE_TOOLBAR
156 NOT <<
157#endif // USE_TOOLBAR
158 "TOOLBAR" << endl <<
159
160#ifndef HAVE_RANDR
161 NOT <<
162#endif
163 "RANDR" <<
164#ifdef HAVE_RANDR1_2
165 "1.2" <<
166#endif
167 endl <<
168
169#ifndef USE_XFT
170 NOT <<
171#endif // USE_XFT
172 "XFT" << endl <<
173
174#ifndef XINERAMA
175 NOT <<
176#endif // XINERAMA
177 "XINERAMA" << endl <<
178
179#ifndef USE_XMB
180 NOT <<
181#endif // USE_XMB
182 "XMB" << endl <<
183
184#ifndef HAVE_XPM
185 NOT <<
186#endif // HAVE_XPM
187 "XPM" << endl
188
189 << endl;
190}
191