sync with bb-cvs.

Add option in config menu for disabling mouse input with scroll lock.
Remove compile-time flag for event clobbering since this solves that problem for now.
This commit is contained in:
Dana Jansens 2002-07-21 09:56:18 +00:00
parent 54c495c83c
commit bd7f948159
31 changed files with 79 additions and 134 deletions

View file

@ -112,24 +112,6 @@ if test x$XFT = "xyes"; then
AC_DEFINE(XFT,1,Enable support of the Xft extension)
fi
dnl Check for the Slit
SLIT=""
AC_MSG_CHECKING([whether to include the Slit])
AC_ARG_ENABLE(
slit, [ --enable-slit include code for the Slit [default=yes]],
if test x$enableval = "xyes"; then
AC_MSG_RESULT([yes])
SLIT="yes"
else
AC_MSG_RESULT([no])
fi,
AC_MSG_RESULT([yes])
SLIT="yes"
)
if test x$SLIT = "xyes"; then
AC_DEFINE(SLIT,1,Enable the Slit)
fi
dnl Check for ordered 8bpp dithering
ORDEREDPSEUDO=""
AC_MSG_CHECKING([whether to include Pseudocolor ordered dithering code])
@ -148,24 +130,6 @@ if test x$ORDEREDPSEUDO = "xyes"; then
AC_DEFINE(ORDEREDPSEUDO,1,Enable pseudocolor ordered dithering)
fi
dnl Check for event clobbering
CLOBBER=""
AC_MSG_CHECKING([whether to intercept mouse events to clients])
AC_ARG_ENABLE(clobber,
[ --enable-clobber intercept mouse events to clients when num lock
or scroll lock are on [default=yes]],
if test x$enableval = "xno"; then
AC_MSG_RESULT([no])
CLOBBER="no"
else
AC_MSG_RESULT([yes])
fi,
AC_MSG_RESULT([yes])
)
if test x$CLOBBER = "xno"; then
AC_DEFINE(NOCLOBBER,1,Disable grabbing of mouse events when num/scoll lock is pressed)
fi
dnl Check whether to include debugging code
DEBUG=""
AC_MSG_CHECKING([whether to include verbose debugging code])

View file

@ -20,6 +20,8 @@ $ #WindowToWindowSnap
# Window-To-Window Snapping
$ #WindowCornerSnap
# Window Corner Snapping
$ #DisableBindings
# Disable Mouse with Scroll Lock
$ #HideToolbar
# Hide Toolbar
$ #ClickToFocus

View file

@ -21,6 +21,4 @@ $ #CompileOptions
# Compile time options:\n\
Debugging\t\t\t%s\n\
Shape:\t\t\t%s\n\
Slit:\t\t\t\t%s\n\
Event Clobbering:\t\t%s\n\
8bpp Ordered Dithering:\t%s\n\n

View file

@ -16,6 +16,8 @@ $ #FocusNew
# Fokus nyt vindue
$ #FocusLast
# Fokus vindue ved skrivebords ændring
$ #DisableBindings
# Deaktiver tastebindinger med Scroll Lock
$ #ClickToFocus
# Klik for fokus
$ #SloppyFocus

View file

@ -21,6 +21,4 @@ $ #CompileOptions
# Kompileret med:\n\
Debugging\t\t\t%s\n\
Shape:\t\t\t%s\n\
Slit:\t\t\t\t%s\n\
Event Clobbering:\t\t%s\n\
8bpp Ordered Dithering:\t%s\n\n

View file

@ -21,6 +21,4 @@ $ #CompileOptions
# Optionen zum Kompilationszeitpunkt:\n\
Debugging\t\t\t%s\n\
Shape:\t\t\t%s\n\
Slit:\t\t\t\t%s\n\
Event Clobbering:\t\t%s\n\
8bpp Ordered Dithering:\t%s\n\n

View file

@ -21,6 +21,4 @@ $ #CompileOptions
# Opciones durante la compilación:\n\
Información extra para depuración: %s\n\
Forma: %s\n\
Slit: %s\n\
Event Clobbering: %s\n\
8bpp simulación ordenada de colores en imágenes: %s\n\n

View file

@ -21,6 +21,4 @@ $ #CompileOptions
# Kompileerimisoptsioonid:\n\
Debuggimine\t\t\t%s\n\
Kuju:\t\t\t%s\n\
Slit:\t\t\t\t%s\n\
Event Clobbering:\t\t%s\n\
8bpp määratud teravustamine:\t%s\n\n

View file

@ -21,6 +21,4 @@ $ #CompileOptions
# Options de compilation:\n\
Debugage\t\t\t%s\n\
Shape:\t\t\t%s\n\
Slit:\t\t\t\t%s\n\
Event Clobbering:\t\t%s\n\
8bpp Lissage ordonné:\t%s\n\n

View file

@ -21,6 +21,4 @@ $ #CompileOptions
# Fordításnál állítható lehetõségek:\n\
Debugging\t\t\t%s\n\
Shape:\t\t\t%s\n\
Slit:\t\t\t\t%s\n\
Event Clobbering:\t\t%s\n\
8bpp Ordered Dithering:\t%s\n\n

View file

@ -21,6 +21,4 @@ $ #CompileOptions
# Opzioni in fase di compilazione:\n\
Debugging\t\t\t%s\n\
Shape:\t\t\t%s\n\
Slit:\t\t\t\t%s\n\
Event Clobbering:\t\t%s\n\
8bpp Ordered Dithering:\t%s\n\n

View file

@ -21,6 +21,4 @@ $ #CompileOptions
# :\n\
Debugging\t\t\t%s\n\
Shape:\t\t\t%s\n\
Slit:\t\t\t\t%s\n\
Event Clobbering:\t\t%s\n\
8bpp Ordered Dithering:\t%s\n\n

View file

@ -2,13 +2,16 @@ $set 14 #main
$ #RCRequiresArg
# error: '-rc' requires an argument\n
$ #MENURequiresArg
# error: '-menu' requires an argument\n
$ #DISPLAYRequiresArg
# error: '-display' requires an argument\n
$ #WarnDisplaySet
# warning: could not set environment variable 'DISPLAY'\n
$ #Usage
# Blackbox %s : (c) 2001 - 2002 Sean 'Shaleh' Perry\n\
\t\t\t 1997 - 2000, 2002 Brad Hughes\n\n\
# Openbox %s : (c) 2002 - 2002 Ben Jansens\n\
2001 - 2002 Sean 'Shaleh' Perry\n\
1997 - 2000, 2002 Brad Hughes\n\n\
-display <string>\t\tuse display connection.\n\
-rc <string>\t\t\tuse alternate resource file.\n\
-version\t\t\tdisplay version and exit.\n\

View file

@ -21,6 +21,4 @@ $ #CompileOptions
# Gecompileerd met instellingen:\n\
Debugging: %s\n\
Shape: %s\n\
Slit:\t\t\t\t%s\n\
Event Clobbering:\t\t%s\n\
8bpp Ordered Dithering: %s\n\n

View file

@ -2,13 +2,16 @@ $set 14 #main
$ #RCRequiresArg
# feil: '-rc' krever et argument\n
$ #MENURequiresArg
# feil: '-menu' krever et argument\n
$ #DISPLAYRequiresArg
# feil: '-display' krever et argument\n
$ #WarnDisplaySet
# advarsel: kunne ikke sette 'DISPLAY' miljøvariabelen\n
$ #Usage
# Blackbox %s : (c) 2001 - 2002 Sean 'Shaleh' Perry\n\
\t\t\t 1997 - 2000, 2002 Brad Hughes\n\n\
# Openbox %s : (c) 2002 - 2002 Ben Jansens\n\
2001 - 2002 Sean 'Shaleh' Perry\n\
1997 - 2000, 2002 Brad Hughes\n\n\
-display <streng>\t\tbruk skjermtilkobling.\n\
-rc <streng>\t\t\tbrug alternativ ressursfil.\n\
-version\t\t\tvis versjonsnummeret og avslutt.\n\

View file

@ -21,6 +21,4 @@ $ #CompileOptions
# Opções em tempo de compilação:\n\
Informações extras para problemas:\t\t\t%s\n\
Forma:\t\t\t%s\n\
Slit:\t\t\t\t%s\n\
Event Clobbering:\t\t%s\n\
8bpp Simulação ordenada de cores em imagens:\t%s\n\n

View file

@ -2,13 +2,16 @@ $set 14 #main
$ #RCRequiresArg
# eroare: '-rc' necesita inca un parametru\n
$ #MENURequiresArg
# eroare: '-menu' necesita inca un parametru\n
$ #DISPLAYRequiresArg
# eroare: '-display' necesita inca un parametru\n
$ #WarnDisplaySet
# atentionare: nu am putut crea variabila de mediu 'DISPLAY'\n
$ #Usage
# Blackbox %s : (c) 2001 - 2002 Sean 'Shaleh' Perry\n\
\t\t\t 1997 - 2000, 2002 Brad Hughes\n\n\
# Openbox %s : (c) 2002 - 2002 Ben Jansens\n\
2001 - 2002 Sean 'Shaleh' Perry\n\
1997 - 2000, 2002 Brad Hughes\n\n\
-display <sir>\t\tconexiunea la ecran.\n\
-rc <sir>\t\t\tfisier de configurare.\n\
-version\t\t\tafiseaza versiunea.\n\

View file

@ -21,6 +21,4 @@ $ #CompileOptions
# Compile time options:\n\
Debugging\t\t\t%s\n\
Shape:\t\t\t%s\n\
Slit:\t\t\t\t%s\n\
Event Clobbering:\t\t%s\n\
8bpp Ordered Dithering:\t%s\n\n

View file

@ -21,6 +21,4 @@ $ #CompileOptions
# Izbire pri prevajanju:\n\
Razhro¹èevanje\t\t\t%s\n\
Oblika:\t\t\t%s\n\
Slit:\t\t\t\t%s\n\
Event Clobbering:\t\t%s\n\
Osembitno stresanje barv:\t%s\n\n

View file

@ -21,6 +21,4 @@ $ #CompileOptions
# Kompilerad med:\n\
Avlusning\t\t\t%s\n\
Form:\t\t\t\t%s\n\
Slit:\t\t\t\t%s\n\
Event Clobbering:\t\t%s\n\
8bpp ordnad dithering:\t%s\n\n

View file

@ -21,6 +21,4 @@ $ #CompileOptions
# Denetleme seçenekleri :\n\
Bilgilendirme\t\t\t%s\n\
Gölgeleme:\t\t\t%s\n\
Slit:\t\t\t\t%s\n\
Event Clobbering:\t\t%s\n\
R8b'e göre týzla:\t%s\n\n

View file

@ -22,6 +22,4 @@ $ #CompileOptions
Debugging\t\t\t%s\n\
Interlacing:\t\t\t%s\n\
Shape:\t\t\t%s\n\
Slit:\t\t\t\t%s\n\
Event Clobbering:\t\t%s\n\
8bpp Ordered Dithering:\t%s\n\n

View file

@ -21,6 +21,4 @@ $ #CompileOptions
# ±àÒëÑ¡Ïî:\n\
Debugging\t\t\t%s\n\
Shape:\t\t\t%s\n\
Slit:\t\t\t\t%s\n\
Event Clobbering:\t\t%s\n\
8bpp Ordered Dithering:\t%s\n\n

View file

@ -21,6 +21,4 @@ $ #CompileOptions
# Compile time options:\n\
Debugging\t\t\t%s\n\
Shape:\t\t\t%s\n\
Slit:\t\t\t\t%s\n\
Event Clobbering:\t\t%s\n\
8bpp Ordered Dithering:\t%s\n\n

View file

@ -238,7 +238,6 @@ BaseDisplay::BaseDisplay(const char *app_name, const char *dpy_name) {
for (int i = 0; i < ScreenCount(display); ++i)
screenInfoList.push_back(ScreenInfo(this, i));
#ifndef NOCLOBBER
NumLockMask = ScrollLockMask = 0;
const XModifierKeymap* const modmap = XGetModifierMapping(display);
@ -268,20 +267,16 @@ BaseDisplay::BaseDisplay(const char *app_name, const char *dpy_name) {
MaskList[0] = 0;
MaskList[1] = LockMask;
MaskList[2] = NumLockMask;
MaskList[3] = ScrollLockMask;
MaskList[4] = LockMask | NumLockMask;
MaskList[5] = NumLockMask | ScrollLockMask;
MaskList[6] = LockMask | ScrollLockMask;
MaskList[7] = LockMask | NumLockMask | ScrollLockMask;
MaskList[3] = LockMask | NumLockMask;
MaskList[4] = ScrollLockMask;
MaskList[5] = ScrollLockMask | LockMask;
MaskList[6] = ScrollLockMask | NumLockMask;
MaskList[7] = ScrollLockMask | LockMask | NumLockMask;
MaskListLength = sizeof(MaskList) / sizeof(MaskList[0]);
if (modmap) XFreeModifiermap(const_cast<XModifierKeymap*>(modmap));
#else // NOCLOBBER
NumLockMask = 0;
ScrollLockMask = 0;
#endif // NOCLOBBER
gccache = 0;
gccache = (BGCCache *) 0;
}
@ -359,36 +354,32 @@ void BaseDisplay::removeTimer(BTimer *timer) {
/*
* Grabs a button, but also grabs the button in every possible combination
* with the keyboard lock keys, so that they do not cancel out the event.
* if allow_scroll_lock is true then only the top half of the lock mask
* table is used and scroll lock is ignored. This value defaults to false.
*/
void BaseDisplay::grabButton(unsigned int button, unsigned int modifiers,
Window grab_window, bool owner_events,
unsigned int event_mask, int pointer_mode,
int keyboard_mode, Window confine_to,
Cursor cursor) const {
#ifndef NOCLOBBER
for (size_t cnt = 0; cnt < MaskListLength; ++cnt)
Cursor cursor, bool allow_scroll_lock) const {
unsigned int length = (allow_scroll_lock) ? MaskListLength / 2:
MaskListLength;
for (size_t cnt = 0; cnt < length; ++cnt)
XGrabButton(display, button, modifiers | MaskList[cnt], grab_window,
owner_events, event_mask, pointer_mode, keyboard_mode,
confine_to, cursor);
#else // NOCLOBBER
XGrabButton(display, button, modifiers, grab_window,
owner_events, event_mask, pointer_mode, keyboard_mode,
confine_to, cursor);
#endif // NOCLOBBER
}
/*
* Releases the grab on a button, and ungrabs all possible combinations of the
* keyboard lock keys.
*/
void BaseDisplay::ungrabButton(unsigned int button, unsigned int modifiers,
Window grab_window) const {
#ifndef NOCLOBBER
for (size_t cnt = 0; cnt < MaskListLength; ++cnt)
XUngrabButton(display, button, modifiers | MaskList[cnt], grab_window);
#else // NOCLOBBER
XUngrabButton(display, button, modifiers, grab_window);
#endif // NOCLOBBER
}
@ -399,9 +390,10 @@ const ScreenInfo* BaseDisplay::getScreenInfo(unsigned int s) const {
}
BGCCache *BaseDisplay::gcCache(void) const
{
if (! gccache) gccache = new BGCCache(this);
BGCCache* BaseDisplay::gcCache(void) const {
if (! gccache)
gccache = new BGCCache(this);
return gccache;
}

View file

@ -77,10 +77,8 @@ private:
};
BShape shape;
#ifndef NOCLOBBER
unsigned int MaskList[8];
size_t MaskListLength;
#endif // NOCLOBBER
enum RunState { STARTUP, RUNNING, SHUTDOWN };
RunState run_state;
@ -139,7 +137,8 @@ public:
void grabButton(unsigned int button, unsigned int modifiers,
Window grab_window, bool owner_events,
unsigned int event_mask, int pointer_mode,
int keyboard_mode, Window confine_to, Cursor cursor) const;
int keyboard_mode, Window confine_to, Cursor cursor,
bool allow_scroll_lock) const;
void ungrabButton(unsigned int button, unsigned int modifiers,
Window grab_window) const;

View file

@ -57,8 +57,10 @@ Configmenu::Configmenu(BScreen *scr) : Basemenu(scr) {
"Window-To-Window Snapping"), 6);
insert(i18n(ConfigmenuSet, ConfigmenuWindowCornerSnap,
"Window Corner Snapping"), 7);
insert(i18n(ConfigmenuSet, ConfigmenuDisableBindings,
"Disable Mouse with Scroll Lock"), 8);
insert(i18n(ConfigmenuSet, ConfigmenuHideToolbar,
"Hide Toolbar"), 8);
"Hide Toolbar"), 9);
update();
setValues();
}
@ -75,7 +77,8 @@ void Configmenu::setValues(void) {
setItemSelected(8, getScreen()->getWindowCornerSnap());
setItemEnabled(8, getScreen()->getWindowToWindowSnap());
setItemSelected(9, getScreen()->doHideToolbar());
setItemSelected(9, getScreen()->allowScrollLock());
setItemSelected(10, getScreen()->doHideToolbar());
}
@ -84,6 +87,7 @@ Configmenu::~Configmenu(void) {
delete placementmenu;
}
void Configmenu::itemSelected(int button, unsigned int index) {
if (button != 1)
return;
@ -130,7 +134,13 @@ void Configmenu::itemSelected(int button, unsigned int index) {
setItemSelected(index, getScreen()->getWindowCornerSnap());
break;
case 8: // hide toolbar
case 8: // disable mouse bindings with Scroll Lock
getScreen()->saveAllowScrollLock(! getScreen()->allowScrollLock());
setItemSelected(index, getScreen()->allowScrollLock());
getScreen()->reconfigure();
break;
case 9: // hide toolbar
getScreen()->saveHideToolbar(! getScreen()->doHideToolbar());
setItemSelected(index, getScreen()->doHideToolbar());
break;

View file

@ -526,6 +526,13 @@ void BScreen::savePlaceIgnoreMaximized(bool i) {
}
void BScreen::saveAllowScrollLock(bool a) {
resource.allow_scroll_lock = a;
config->setValue(screenstr + "disableBindingsWithScrollLock",
resource.allow_scroll_lock);
}
void BScreen::save_rc(void) {
saveSloppyFocus(resource.sloppy_focus);
saveAutoRaise(resource.auto_raise);
@ -552,6 +559,7 @@ void BScreen::save_rc(void) {
#endif // HAVE_STRFTIME
savePlaceIgnoreShaded(resource.ignore_shaded);
savePlaceIgnoreMaximized(resource.ignore_maximized);
saveAllowScrollLock(resource.allow_scroll_lock);
toolbar->save_rc();
slit->save_rc();
@ -686,6 +694,10 @@ void BScreen::load_rc(void) {
if (! config->getValue(screenstr + "placementIgnoreMaximized",
resource.ignore_maximized))
resource.ignore_maximized = true;
if (! config->getValue(screenstr + "disableBindingsWithScrollLock",
resource.allow_scroll_lock))
resource.allow_scroll_lock = false;
}

View file

@ -144,8 +144,8 @@ private:
bool sloppy_focus, auto_raise, auto_edge_balance, ordered_dither,
opaque_move, full_max, focus_new, focus_last, click_raise,
hide_toolbar, window_to_window_snap, window_corner_snap, aa_fonts,
ignore_shaded, ignore_maximized;
allow_scroll_lock, hide_toolbar, window_to_window_snap,
window_corner_snap, aa_fonts, ignore_shaded, ignore_maximized;
BColor border_color;
unsigned int workspaces;
@ -214,6 +214,7 @@ public:
{ return resource.window_to_window_snap; }
inline bool getWindowCornerSnap(void) const
{ return resource.window_corner_snap; }
inline bool allowScrollLock(void) const { return resource.allow_scroll_lock; }
inline const GC &getOpGC(void) const { return opGC; }
@ -285,6 +286,7 @@ public:
void saveResizeZones(unsigned int z);
void savePlaceIgnoreShaded(bool i);
void savePlaceIgnoreMaximized(bool i);
void saveAllowScrollLock(bool a);
inline void iconUpdate(void) { iconmenu->update(); }
#ifdef HAVE_STRFTIME

View file

@ -819,24 +819,27 @@ void BlackboxWindow::reconfigure(void) {
void BlackboxWindow::grabButtons(void) {
if ((! screen->isSloppyFocus()) || screen->doClickRaise())
if (! screen->isSloppyFocus() || screen->doClickRaise())
// grab button 1 for changing focus/raising
blackbox->grabButton(Button1, 0, frame.plate, True, ButtonPressMask,
GrabModeSync, GrabModeSync, frame.plate, None);
GrabModeSync, GrabModeSync, frame.plate, None,
screen->allowScrollLock());
if (functions & Func_Move)
blackbox->grabButton(Button1, Mod1Mask, frame.window, True,
ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
GrabModeAsync, frame.window,
blackbox->getMoveCursor());
GrabModeAsync, frame.window, None,
screen->allowScrollLock());
if (functions & Func_Resize)
blackbox->grabButton(Button3, Mod1Mask, frame.window, True,
ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
GrabModeAsync, frame.window, None);
GrabModeAsync, frame.window, None,
screen->allowScrollLock());
// alt+middle lowers the window
blackbox->grabButton(Button2, Mod1Mask, frame.window, True,
ButtonReleaseMask, GrabModeAsync, GrabModeAsync,
frame.window, None);
frame.window, None,
screen->allowScrollLock());
}

View file

@ -77,8 +77,6 @@ static void showHelp(int exitval) {
"Compile time options:\n"
" Debugging:\t\t\t%s\n"
" Shape:\t\t\t%s\n"
" Slit:\t\t\t\t%s\n"
" Event Clobbering:\t\t%s\n"
" 8bpp Ordered Dithering:\t%s\n\n"),
#ifdef DEBUG
i18n(CommonSet, CommonYes, "yes"),
@ -92,18 +90,6 @@ static void showHelp(int exitval) {
i18n(CommonSet, CommonNo, "no"),
#endif // SHAPE
#ifdef SLIT
i18n(CommonSet, CommonYes, "yes"),
#else // !SLIT
i18n(CommonSet, CommonNo, "no"),
#endif // SLIT
#ifndef NOCLOBBER
i18n(CommonSet, CommonYes, "yes"),
#else // !NOCLOBBER
i18n(CommonSet, CommonNo, "no"),
#endif // NOCLOBBER
#ifdef ORDEREDPSEUDO
i18n(CommonSet, CommonYes, "yes")
#else // !ORDEREDPSEUDO