added a lock around keymap uses to avoid a reload in the middle of the key event process
this fixes bug #1177 git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21881 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
#include "kb_mouse_driver.h"
|
#include "kb_mouse_driver.h"
|
||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
|
#include <Autolock.h>
|
||||||
#include <Directory.h>
|
#include <Directory.h>
|
||||||
#include <Entry.h>
|
#include <Entry.h>
|
||||||
#include <NodeMonitor.h>
|
#include <NodeMonitor.h>
|
||||||
@@ -365,7 +366,8 @@ get_short_name(const char *longName)
|
|||||||
|
|
||||||
KeyboardInputDevice::KeyboardInputDevice()
|
KeyboardInputDevice::KeyboardInputDevice()
|
||||||
:
|
:
|
||||||
fTMWindow(NULL)
|
fTMWindow(NULL),
|
||||||
|
fKeymapLock("keymap lock")
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
if (sLogFile == NULL)
|
if (sLogFile == NULL)
|
||||||
@@ -428,7 +430,8 @@ KeyboardInputDevice::_InitFromSettings(void *cookie, uint32 opcode)
|
|||||||
|
|
||||||
if (opcode == 0
|
if (opcode == 0
|
||||||
|| opcode == B_KEY_MAP_CHANGED
|
|| opcode == B_KEY_MAP_CHANGED
|
||||||
|| opcode == B_KEY_LOCKS_CHANGED) {
|
|| opcode == B_KEY_LOCKS_CHANGED) {
|
||||||
|
BAutolock lock(fKeymapLock);
|
||||||
fKeymap.LoadCurrent();
|
fKeymap.LoadCurrent();
|
||||||
device->modifiers = fKeymap.Locks();
|
device->modifiers = fKeymap.Locks();
|
||||||
_SetLeds(device);
|
_SetLeds(device);
|
||||||
@@ -697,6 +700,8 @@ KeyboardInputDevice::_DeviceWatcher(void *arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BAutolock lock(owner->fKeymapLock);
|
||||||
|
|
||||||
uint32 modifiers = keymap->Modifier(keycode);
|
uint32 modifiers = keymap->Modifier(keycode);
|
||||||
if (modifiers
|
if (modifiers
|
||||||
&& (!(modifiers & (B_CAPS_LOCK | B_NUM_LOCK | B_SCROLL_LOCK))
|
&& (!(modifiers & (B_CAPS_LOCK | B_NUM_LOCK | B_SCROLL_LOCK))
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include <Handler.h>
|
#include <Handler.h>
|
||||||
#include <InputServerDevice.h>
|
#include <InputServerDevice.h>
|
||||||
|
#include <Locker.h>
|
||||||
#include <List.h>
|
#include <List.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -74,6 +75,7 @@ class KeyboardInputDevice : public BInputServerDevice {
|
|||||||
BList fDevices;
|
BList fDevices;
|
||||||
Keymap fKeymap;
|
Keymap fKeymap;
|
||||||
TMWindow *fTMWindow;
|
TMWindow *fTMWindow;
|
||||||
|
BLocker fKeymapLock;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern "C" BInputServerDevice *instantiate_input_device();
|
extern "C" BInputServerDevice *instantiate_input_device();
|
||||||
|
|||||||
Reference in New Issue
Block a user