1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

wmaker: Moved variable ValidModMask into the global namespace

This commit is contained in:
Christophe CURIS
2013-10-10 23:55:53 +02:00
committed by Carlos R. Mafra
parent 24ce829f7f
commit f751cc6a50
7 changed files with 18 additions and 15 deletions

View File

@@ -613,6 +613,12 @@ extern struct wmaker_global_variables {
/* Keyboard and shortcuts */
struct {
/*
* Bit-mask to hide special key modifiers which we don't want to
* impact the shortcuts (typically: CapsLock, NumLock, ScrollLock)
*/
unsigned int modifiers_mask;
WMArray *windows[MAX_WINDOW_SHORTCUTS];
} shortcut;
@@ -621,8 +627,6 @@ extern struct wmaker_global_variables {
} w_global;
extern unsigned int ValidModMask;
/****** Notifications ******/
extern const char WMNManaged[];
extern const char WMNUnmanaged[];

View File

@@ -144,7 +144,7 @@ void StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next, Bool class_only)
| PointerMotionMask | ButtonReleaseMask | EnterWindowMask, &ev);
/* ignore CapsLock */
modifiers = ev.xkey.state & ValidModMask;
modifiers = ev.xkey.state & w_global.shortcut.modifiers_mask;
if (!swpanel)
break;

View File

@@ -1311,7 +1311,7 @@ static void handleKeyPress(XEvent * event)
#endif /*KEEP_XKB_LOCK_STATUS */
/* ignore CapsLock */
modifiers = event->xkey.state & ValidModMask;
modifiers = event->xkey.state & w_global.shortcut.modifiers_mask;
for (i = 0; i < WKBD_LAST; i++) {
if (wKeyBindings[i].keycode == 0)

View File

@@ -72,8 +72,6 @@ Display *dpy;
char *ProgName;
unsigned int ValidModMask = 0xff;
struct WPreferences wPreferences;
WShortKey wKeyBindings[WKBD_LAST];
@@ -538,6 +536,7 @@ int main(int argc, char **argv)
w_global.timestamp.last_event = CurrentTime;
w_global.timestamp.focus_change = CurrentTime;
w_global.workspace.ignore_change = False;
w_global.shortcut.modifiers_mask = 0xff;
/* setup common stuff for the monitor and wmaker itself */
WMInitializeApplication("WindowMaker", &argc, argv);

View File

@@ -350,7 +350,7 @@ Bool wRootMenuPerformShortcut(XEvent * event)
int done = 0;
/* ignore CapsLock */
modifiers = event->xkey.state & ValidModMask;
modifiers = event->xkey.state & w_global.shortcut.modifiers_mask;
for (ptr = shortcutList; ptr != NULL; ptr = ptr->next) {
if (ptr->keycode == 0 || ptr->menu->menu->screen_ptr != scr)

View File

@@ -418,13 +418,13 @@ void StartUp(Bool defaultScreenOnly)
/*
* Ignore CapsLock in modifiers
*/
ValidModMask = 0xff & ~LockMask;
w_global.shortcut.modifiers_mask = 0xff & ~LockMask;
getOffendingModifiers();
/*
* Ignore NumLock and ScrollLock too
*/
ValidModMask &= ~(_NumLockMask | _ScrollLockMask);
w_global.shortcut.modifiers_mask &= ~(_NumLockMask | _ScrollLockMask);
memset(&wKeyBindings, 0, sizeof(wKeyBindings));

View File

@@ -2680,7 +2680,7 @@ static void resizebarMouseDown(WCoreWindow *sender, void *data, XEvent *event)
}
#endif
event->xbutton.state &= ValidModMask;
event->xbutton.state &= w_global.shortcut.modifiers_mask;
CloseWindowMenu(wwin->screen_ptr);
@@ -2714,7 +2714,7 @@ static void titlebarDblClick(WCoreWindow *sender, void *data, XEvent *event)
{
WWindow *wwin = data;
event->xbutton.state &= ValidModMask;
event->xbutton.state &= w_global.shortcut.modifiers_mask;
if (event->xbutton.button == Button1) {
if (event->xbutton.state == 0) {
@@ -2778,7 +2778,7 @@ static void frameMouseDown(WObjDescriptor *desc, XEvent *event)
resize_height_increment = wPreferences.resize_increment;
}
event->xbutton.state &= ValidModMask;
event->xbutton.state &= w_global.shortcut.modifiers_mask;
CloseWindowMenu(wwin->screen_ptr);
@@ -2834,7 +2834,7 @@ static void titlebarMouseDown(WCoreWindow *sender, void *data, XEvent *event)
wwarning(_("The NumLock, ScrollLock or similar key seems to be turned on. "
"Turn it off or some mouse actions and keyboard shortcuts will not work."));
#endif
event->xbutton.state &= ValidModMask;
event->xbutton.state &= w_global.shortcut.modifiers_mask;
CloseWindowMenu(wwin->screen_ptr);
@@ -2892,7 +2892,7 @@ static void windowCloseClick(WCoreWindow *sender, void *data, XEvent *event)
{
WWindow *wwin = data;
event->xbutton.state &= ValidModMask;
event->xbutton.state &= w_global.shortcut.modifiers_mask;
CloseWindowMenu(wwin->screen_ptr);
@@ -2955,7 +2955,7 @@ static void windowIconifyClick(WCoreWindow *sender, void *data, XEvent *event)
{
WWindow *wwin = data;
event->xbutton.state &= ValidModMask;
event->xbutton.state &= w_global.shortcut.modifiers_mask;
CloseWindowMenu(wwin->screen_ptr);