1 // bbkeys.hh for bbkeys - Ye Olde Keystroke Grabber for Blackbox
3 // Copyright (c) 1998-1999 by John Kennis, jkennis@chello.nl
4 // Copyright (c) 1999-2001 by Jason Kasper (vanRijn) vR@movingparts.net
5 // Copyright (c) 2001 by Ben Jansens <xor@x-o-r.net>
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 2 of the License, or
10 // (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 // (See the included file COPYING / GPL-2.0)
26 #include "grab_defs.hh" // grab* definitions
27 #include "Basewindow.hh"
28 #include "resource.hh"
29 #include "wminterface.hh"
32 #include <X11/keysym.h>
34 #define MaxInstructions 50
37 unsigned long modMask
;
45 KEY_ACTION_MAP KeyMap
[MaxInstructions
];
46 } KEY_GRAB_INSTRUCTION
;
51 // Pixmap focusedDesktop;
52 // Pixmap focusedWindow;
59 Pixmap pix_pressedBtn
;
82 class ToolWindow
: public Basewindow
, public TimeoutHandler
{
84 ToolWindow(int argc
,char **argv
,struct CMDOPTIONS
*);
87 void reconfigure(void);
88 void execCommand(char *);
90 // functions for translation of grab information
91 char *index_to_name(int);
92 int translateAction(char *);
93 int translateModifier(char *);
95 // functions for handling/grabbing keys
96 void loadKeygrabs(void);
97 void setKeygrabs(void);
98 void activateKeygrabs(void);
99 void getOffendingModifiers(void);
100 void wHackedGrabKey(int,unsigned int,Window
,Bool
,int,int);
101 void x_reset_modifier_mapping(Display
*);
102 void InitializeModifiers(void);
104 // functions for maintaining the desktop list
105 void addDesktop(void);
106 void removeDesktop(int);
107 void focusDesktop(int);
108 void setDesktopCount(int); // this should only be called during the
109 // initialization stage
111 // functions for maintaining the window list
112 void addWindow(Window
,int);
113 void removeWindow(Window
);
114 void focusWindow(Window
);
115 void moveWinToDesktop(Window
,int);
116 void windowAttributeChange(Window
); // called when attributes for a window
117 // have changed, such as sticky
118 void cycleWindowFocus(bool);
120 // functions for modifying windows
121 void raiseWindow(Window
);
122 void lowerWindow(Window
);
124 // functions which return information
125 inline int getCurrentDesktopNr(void) {
126 return current_desktop
?current_desktop
->number
:-1;
128 inline int getDesktopCount(void) { return desktop_count
; }
130 // void setNETInit(void) { /*wm_init = True;*/ }
133 // functions for dealing with the bbkeys window
134 void MakeWindow(bool);
136 virtual void process_event(XEvent
*);
137 virtual void CheckConfig(void);
141 XGCValues gcv
; // font stuff
144 Window win_frame
; // windows for the tool
148 Window win_configBtn
;
149 GEOM frame
; // size/pos data for the windows and label
155 PIXMAP pixmap
; // pixmaps for all of the windows
156 BTimer
*timer
; // window background drawing timer
157 // bool raised; // window is raised above all others
159 KEY_GRAB_INSTRUCTION grabSet
; // key grab/handling vars
160 unsigned int ValidModMask
;
161 unsigned int _NumLockMask
;
162 unsigned int _ScrollLockMask
;
164 char *bbkeys_rcfile
; // resource file
165 time_t bbkeys_rcTime
; // time used for autoloading resource file
166 Resource
*resource
; // resource data
168 int desktop_count
; // the number of desktops
169 DesktopList
*current_desktop
; // the currently active desktop
170 LinkedList
<WindowList
> *windowList
; // list of all windows
171 LinkedList
<DesktopList
> *desktopList
; // list of all desktop windows
172 Window focus_window
; // window which has the focus
174 WMInterface
*wminterface
; // interface for communicating with the
178 // int day,month,year;
182 #endif /* __BBKEYS_HH */