KKBSwitch – keyboard layout indicator
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

kbswitchapp.h 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /***************************************************************************
  2. kbswitchapp.h - description
  3. -------------------
  4. begin : Sun Jul 1 2001
  5. copyright : (C) 2001 by Leonid Zeitlin
  6. email : lz@europe.com
  7. ***************************************************************************/
  8. /***************************************************************************
  9. * *
  10. * This program is free software; you can redistribute it and/or modify *
  11. * it under the terms of the GNU General Public License as published by *
  12. * the Free Software Foundation; either version 2 of the License, or *
  13. * (at your option) any later version. *
  14. * *
  15. ***************************************************************************/
  16. #ifndef KBSWITCHAPP_H
  17. #define KBSWITCHAPP_H
  18. #ifdef HAVE_CONFIG_H
  19. #include <config.h>
  20. #endif
  21. #include <tdeversion.h>
  22. #if TDE_VERSION_MAJOR >= 3
  23. #include <kuniqueapplication.h>
  24. #else
  25. #include <kuniqueapp.h>
  26. #endif
  27. //#include <ntqmap.h>
  28. #include "kbgroup.h"
  29. #include "kbswitchtrayicon.h"
  30. #include "kbconfig.h"
  31. #include "xkeyboard.h"
  32. #include "kbswitchintf.h"
  33. #include "windowwatcher.h"
  34. /*class KWinModule;
  35. typedef struct _KBWinInfo {
  36. int groupno;
  37. int next_groupno;
  38. } KBWinInfo;
  39. typedef TQMap<WId, KBWinInfo> KBWindowMap;*/
  40. /**
  41. *@author Leonid Zeitlin
  42. */
  43. class KBSwitchApp : public KUniqueApplication {
  44. Q_OBJECT
  45. public:
  46. KBSwitchApp();
  47. ~KBSwitchApp();
  48. protected: // Protected methods
  49. /** No descriptions */
  50. bool x11EventFilter(XEvent *e);
  51. private: // Private attributes
  52. /** */
  53. bool m_force_group_setting;
  54. int m_cur_groupno;
  55. int m_next_groupno;
  56. XKeyboard m_xkb;
  57. /** */
  58. KBSwitchTrayIcon * m_trayicon;
  59. /** No descriptions */
  60. KBConfig m_kbconf;
  61. KBSwitchIntf *m_intf;
  62. #ifndef HAVE_LIBXKLAVIER
  63. /** Window manager interface */
  64. //KWinModule *m_twin_module;
  65. /** Maps Window IDs to their keyboard groups */
  66. //KBWindowMap m_window_map;
  67. //KBWindowMap::iterator m_active_window;
  68. WindowWatcher *m_watcher;
  69. KBConfig::GroupScope m_watcher_type;
  70. #endif
  71. private: // Private methods
  72. /** Update the tray icon to show the flag corresponding to the current keyboard group */
  73. void updateIcon(int groupno);
  74. /** No descriptions */
  75. void internalToggleGroups();
  76. /** No descriptions */
  77. void forceSetGroup(int groupno);
  78. /** No descriptions */
  79. /*int getNextGroup(int groupno) {
  80. return groupno >= m_kbconf.groupCount() - 1 ? 0 : groupno + 1;
  81. }*/
  82. /** No descriptions */
  83. void setStartGroup(int start_group);
  84. void adaptToGroup(int groupno);
  85. #ifndef HAVE_LIBXKLAVIER
  86. /** initialize Window groups map */
  87. //void resetWindowMap();
  88. /** Disable window manager notifications */
  89. //void disableKWinModule();
  90. /** Enable window manager notifications */
  91. //void enableKWinModule();
  92. /** adds a new window to the internal window map */
  93. //void addWindowToMap(WId window_id);
  94. void enableWatcher();
  95. void disableWatcher();
  96. #endif
  97. /** Set the current and next groups */
  98. void setGroups(int group, int next_group);
  99. private slots: // Private slots
  100. /** No descriptions */
  101. void slotGroupSelected(int groupno);
  102. /** No descriptions */
  103. void slotSelectNextGroup();
  104. /** No descriptions */
  105. void slotPreferences();
  106. /** No descriptions */
  107. void reconfigure();
  108. /** Respond to XKB changing the current group */
  109. void slotXkbGroupChanged(int groupno);
  110. /** Respond to changing of active window - active it's kb group */
  111. //void slotWindowChanged(WId activeWindow);
  112. /** Respond to removal of a window - remote it from Window groups map */
  113. //void slotWindowRemoved(WId window);
  114. void slotWindowChanged(int groupno, int next_groupno);
  115. /** React to a change in KKBSwitch's user preferences,
  116. * made by user in Configure dialog */
  117. void slotPrefChanged();
  118. };
  119. #endif