28
struct CommandLineXParameter
31
const char * description;
32
bool MImServerXOptions::*value;
35
CommandLineXParameter AvailableParameters[] = {
36
{ "-manual-redirection", "Enable manual redirection", &MImServerXOptions::manualRedirection },
37
{ "-bypass-wm-hint", "Bypass window manager", &MImServerXOptions::bypassWMHint },
38
{ "-use-self-composition", "Enable self composition", &MImServerXOptions::selfComposited },
39
{ "-unconditional-show", "Always use show() for server window regardless "
40
"of current state of server and remote windows",
41
&MImServerXOptions::unconditionalShow }
45
27
struct CommandLineParameter {
47
29
const char * description;
148
128
MImServerCommonOptions *storage;
151
#if defined(Q_WS_X11)
153
* \brief Parser of command line parameters which are applicable if
154
* input method server works with X11.
156
struct MImServerXOptionsParser : public MImServerOptionsParserBase
158
/*! \brief Construct new instance.
159
* Object should be created when application starts and should stay alive until moment
160
* when application will exit, so it is recommnded to create it in main().
161
* \note It does not makes sense tp create more than one object of this class.
163
MImServerXOptionsParser(MImServerXOptions *options);
166
virtual ParsingResult parseParameter(const char * parameter,
169
virtual void printAvailableOptions(const char *format);
173
MImServerXOptions *storage;
178
132
* \brief Parser of command line parameters for the server<->input context connection
434
388
unregisterParser(this);
437
#if defined(Q_WS_X11)
439
// parser for options related to X windows system
440
MImServerXOptionsParser::MImServerXOptionsParser(MImServerXOptions *options)
441
: MImServerOptionsParserBase(options),
446
MImServerOptionsParserBase::ParsingResult
447
MImServerXOptionsParser::parseParameter(const char *parameter,
451
const int count = sizeof(AvailableParameters) / sizeof(AvailableParameters[0]);
452
ParsingResult result = Invalid;
456
for (int i = 0; i < count; ++i) {
457
if (!strcmp(parameter, AvailableParameters[i].name)) {
458
if (AvailableParameters[i].value) {
459
storage->*AvailableParameters[i].value = true;
469
void MImServerXOptionsParser::printAvailableOptions(const char *format)
471
const int count = sizeof(AvailableParameters) / sizeof(AvailableParameters[0]);
473
for (int i = 0; i < count; ++i) {
474
if (AvailableParameters[i].description) {
475
fprintf(stderr, format, AvailableParameters[i].name,
476
AvailableParameters[i].description);
481
MImServerXOptions::MImServerXOptions()
482
: selfComposited(false),
483
manualRedirection(false),
485
unconditionalShow(false)
487
const ParserBasePtr p(new MImServerXOptionsParser(this));
491
MImServerXOptions::~MImServerXOptions()
493
unregisterParser(this);