make use of the --enable-clobber option

This commit is contained in:
Dana Jansens 2002-05-25 03:46:25 +00:00
parent d744d37540
commit 2f65b6533c
2 changed files with 19 additions and 4 deletions

View file

@ -239,6 +239,7 @@ BaseDisplay::BaseDisplay(const char *app_name, const char *dpy_name) {
for (int i = 0; i < ScreenCount(display); ++i) for (int i = 0; i < ScreenCount(display); ++i)
screenInfoList.push_back(ScreenInfo(this, i)); screenInfoList.push_back(ScreenInfo(this, i));
#ifndef NOCLOBBER
NumLockMask = ScrollLockMask = 0; NumLockMask = ScrollLockMask = 0;
const XModifierKeymap* const modmap = XGetModifierMapping(display); const XModifierKeymap* const modmap = XGetModifierMapping(display);
@ -276,6 +277,10 @@ BaseDisplay::BaseDisplay(const char *app_name, const char *dpy_name) {
MaskListLength = sizeof(MaskList) / sizeof(MaskList[0]); MaskListLength = sizeof(MaskList) / sizeof(MaskList[0]);
if (modmap) XFreeModifiermap(const_cast<XModifierKeymap*>(modmap)); if (modmap) XFreeModifiermap(const_cast<XModifierKeymap*>(modmap));
#else // NOCLOBBER
NumLockMask = 0;
ScrollLockMask = 0;
#endif // NOCLOBBER
gccache = 0; gccache = 0;
} }
@ -366,11 +371,16 @@ void BaseDisplay::grabButton(unsigned int button, unsigned int modifiers,
unsigned int event_mask, int pointer_mode, unsigned int event_mask, int pointer_mode,
int keyboard_mode, Window confine_to, int keyboard_mode, Window confine_to,
Cursor cursor) const { Cursor cursor) const {
for (size_t cnt = 0; cnt < MaskListLength; ++cnt) { #ifndef NOCLOBBER
for (size_t cnt = 0; cnt < MaskListLength; ++cnt)
XGrabButton(display, button, modifiers | MaskList[cnt], grab_window, XGrabButton(display, button, modifiers | MaskList[cnt], grab_window,
owner_events, event_mask, pointer_mode, keyboard_mode, owner_events, event_mask, pointer_mode, keyboard_mode,
confine_to, cursor); confine_to, cursor);
} #else // NOCLOBBER
XGrabButton(display, button, modifiers, grab_window,
owner_events, event_mask, pointer_mode, keyboard_mode,
confine_to, cursor);
#endif // NOCLOBBER
} }
/* /*
@ -379,9 +389,12 @@ void BaseDisplay::grabButton(unsigned int button, unsigned int modifiers,
*/ */
void BaseDisplay::ungrabButton(unsigned int button, unsigned int modifiers, void BaseDisplay::ungrabButton(unsigned int button, unsigned int modifiers,
Window grab_window) const { Window grab_window) const {
for (size_t cnt = 0; cnt < MaskListLength; ++cnt) { #ifndef NOCLOBBER
for (size_t cnt = 0; cnt < MaskListLength; ++cnt)
XUngrabButton(display, button, modifiers | MaskList[cnt], grab_window); XUngrabButton(display, button, modifiers | MaskList[cnt], grab_window);
} #else // NOCLOBBER
XUngrabButton(display, button, modifiers, grab_window);
#endif // NOCLOBBER
} }

View file

@ -77,8 +77,10 @@ private:
}; };
BShape shape; BShape shape;
#ifndef NOCLOBBER
unsigned int MaskList[8]; unsigned int MaskList[8];
size_t MaskListLength; size_t MaskListLength;
#endif // NOCLOBBER
enum RunState { STARTUP, RUNNING, SHUTDOWN }; enum RunState { STARTUP, RUNNING, SHUTDOWN };
RunState run_state; RunState run_state;