diff options
author | Mavridis Philippe <[email protected]> | 2023-01-06 15:30:57 +0200 |
---|---|---|
committer | Mavridis Philippe <[email protected]> | 2023-03-24 15:28:11 +0200 |
commit | a67db2d4847d798c01d4fd7584c5bb9297e109e3 (patch) | |
tree | 6cb5bb70f6201fa62dec021b92e838d32a6036ec /kxkb/extension.h | |
parent | b50ab13974adf6f16d72f172f0cf768a44c161da (diff) | |
download | tdebase-a67db2d4847d798c01d4fd7584c5bb9297e109e3.tar.gz tdebase-a67db2d4847d798c01d4fd7584c5bb9297e109e3.zip |
Kxkb: Improve layout switching
1) New layout switching approach
The new approach is based on the "grp" options group of Xkb
and so enables us to use predefined X11 layout (group) switching
hotkeys like "Caps Lock" or "Shift+Alt" (you can see the full list
in the Options tab). The added bonus to this is that we conform
to the Xkb setting.
The code lets Xkb handle the keyboard layout switching hotkey(s)
and is similar to the one that is used in kkbswitch, monitoring
for an Xkb group (layout) change event.
This solution required me to remove some hacky and obsolete code
which was there to support really old pre-XFree-4.2 era systems
and included the "include groups" hack.
This means that the "Enable latin layout" checkbox is now gone
and setxkbmap is only called when the keyboard layouts and/or
options are modified, and not for every layout change.
2) Common layout switching hotkeys combobox
A combobox was added to the first page of the Keyboard Layouts
KCM module. It provides to the users a quick way to set a layout
switching key combination. It also controls the "grp" group in
the Xkb tab.
A special note about this combobox is that, even if Append Mode
was selected in the Xkb Options tab, this hotkey will overwrite
previous hotkey options. This means that all grp: options will
be forced removed before applying the option from the combobox
(in contrast to specifying options via the Xkb Options tab,
which, in Append Mode, will not get overwritten until next login).
Signed-off-by: Mavridis Philippe <[email protected]>
Diffstat (limited to 'kxkb/extension.h')
-rw-r--r-- | kxkb/extension.h | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/kxkb/extension.h b/kxkb/extension.h index bf4293d2b..fa482c222 100644 --- a/kxkb/extension.h +++ b/kxkb/extension.h @@ -2,36 +2,32 @@ #define __EXTENSION_H__ #include <X11/Xlib.h> +#include <tqobject.h> +#include "kxkbconfig.h" -class XKBExtension +class XKBExtension : public TQObject { + TQ_OBJECT + public: XKBExtension(Display *display=NULL); ~XKBExtension(); bool init(); - void reset(); - static bool setXkbOptions(const TQString& options, bool resetOldOptions); - bool setLayout(const TQString& model, - const TQString& layout, const TQString& variant, - const TQString& includeGroup, bool useCompiledLayouts=true); + static bool setXkbOptions(const XkbOptions options); bool setGroup(unsigned int group); unsigned int getGroup() const; + void processXEvent(XEvent *ev); private: Display *m_dpy; TQString m_tempDir; + int m_keycode; static TQMap<TQString, FILE*> fileCache; - - bool setLayoutInternal(const TQString& model, - const TQString& layout, const TQString& variant, - const TQString& includeGroup); - bool compileCurrentLayout(const TQString& layoutKey); - bool setCompiledLayout(const TQString& layoutKey); - - TQString getPrecompiledLayoutFilename(const TQString& layoutKey); -// void deletePrecompiledLayouts(); + +signals: + void groupChanged(uint group); }; #endif |