Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / workspace / kcontrol / kxkb / x11helper.h
blob39c9f37b5db6c435533070785bdb6d6c249b7d90
1 /*
2 * Copyright (C) 2006 Andriy Rysin (rysin@kde.org)
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
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 General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #ifndef X11HELPER_H_
20 #define X11HELPER_H_
22 #include <X11/Xlib.h>
23 #include <QHash>
25 #include "kxkbconfig.h"
27 struct XkbOption;
28 struct XkbVariant;
30 struct XkbOptionGroup {
31 QString name;
32 QString description;
33 bool exclusive;
34 QList<XkbOption> options;
38 struct XkbOption {
39 QString name;
40 QString description;
41 XkbOptionGroup* group;
44 struct RulesInfo {
45 QHash<QString, QString> models;
46 QHash<QString, QString> layouts;
47 // QHash<QString, QList<XkbVariant>*> variants;
48 QHash<QString, XkbOption> options;
49 QHash<QString, XkbOptionGroup> optionGroups;
52 struct XkbVariant {
53 QString name;
54 QString description;
58 class X11Helper
60 public:
61 static const Window UNKNOWN_WINDOW_ID = (Window) 0;
62 static const QString X11_WIN_CLASS_ROOT;
63 static const QString X11_WIN_CLASS_UNKNOWN;
65 static QString getWindowClass(Window winId, Display* dpy);
67 #ifndef HAVE_XKLAVIER
68 /**
69 * Tries to find X11 xkb config dir
71 static const QString findX11Dir();
72 static const QString findXkbRulesFile(const QString &x11Dir, Display* dpy);
73 static QList<XkbVariant>* getVariants(const QString& layout, const QString& x11Dir);
74 static RulesInfo* loadRules(const QString& rulesFile, bool layoutsOnly=false);
75 static XkbConfig getGroupNames(Display* dpy);
76 private:
78 static XkbOptionGroup createMissingGroup(const QString& groupName);
79 static bool isGroupExclusive(const QString& groupName);
80 #endif /* HAVE_XKLAVIER */
84 #endif /*X11HELPER_H_*/