|
@@ -379,7 +379,7 @@ static pascal OSStatus appEvtHndlr (EventHandlerCallRef myHandler, EventRef even
|
|
|
case kEventClassKeyboard:
|
|
case kEventClassKeyboard:
|
|
|
{
|
|
{
|
|
|
switch (kind) {
|
|
switch (kind) {
|
|
|
- case kEventRawKeyRepeat:
|
|
|
|
|
|
|
+ case kEventRawKeyRepeat:
|
|
|
case kEventRawKeyDown:
|
|
case kEventRawKeyDown:
|
|
|
result = osx_win->handleKeyInput (myHandler, event, true);
|
|
result = osx_win->handleKeyInput (myHandler, event, true);
|
|
|
break;
|
|
break;
|
|
@@ -1223,30 +1223,31 @@ OSStatus osxGraphicsWindow::handleKeyInput (EventHandlerCallRef myHandler, Event
|
|
|
// are already mapped in the desktop seem to not even come into this
|
|
// are already mapped in the desktop seem to not even come into this
|
|
|
// function in the first place.
|
|
// function in the first place.
|
|
|
UInt32 newModifiers = 0;
|
|
UInt32 newModifiers = 0;
|
|
|
- OSStatus error = GetEventParameter(event, kEventParamKeyModifiers,
|
|
|
|
|
- typeUInt32, NULL, sizeof(UInt32),
|
|
|
|
|
- NULL, &newModifiers);
|
|
|
|
|
- if(error == noErr) {
|
|
|
|
|
- HandleModifireDeleta(newModifiers);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ OSStatus error = GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &newModifiers);
|
|
|
|
|
+ if(error == noErr)
|
|
|
|
|
+ HandleModifireDeleta(newModifiers);
|
|
|
|
|
|
|
|
UInt32 keyCode;
|
|
UInt32 keyCode;
|
|
|
- GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL,
|
|
|
|
|
- sizeof(UInt32), NULL, &keyCode);
|
|
|
|
|
|
|
+ GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode);
|
|
|
ButtonHandle button = OSX_TranslateKey(keyCode, event);
|
|
ButtonHandle button = OSX_TranslateKey(keyCode, event);
|
|
|
|
|
|
|
|
- if (keyDown) {
|
|
|
|
|
- if ((newModifiers & cmdKey) != 0) {
|
|
|
|
|
- if (button == KeyboardButton::ascii_key("q") ||
|
|
|
|
|
- button == KeyboardButton::ascii_key("w")) {
|
|
|
|
|
|
|
+ if (keyDown)
|
|
|
|
|
+ {
|
|
|
|
|
+ if ((newModifiers & cmdKey) != 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (button == KeyboardButton::ascii_key("q") || button == KeyboardButton::ascii_key("w"))
|
|
|
|
|
+ {
|
|
|
// Command-Q or Command-W: quit the application or close the
|
|
// Command-Q or Command-W: quit the application or close the
|
|
|
// window, respectively. For now, we treat them both the
|
|
// window, respectively. For now, we treat them both the
|
|
|
// same: close the window.
|
|
// same: close the window.
|
|
|
user_close_request();
|
|
user_close_request();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
SendKeyEvent(button, true);
|
|
SendKeyEvent(button, true);
|
|
|
- } else {
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
SendKeyEvent(button, false);
|
|
SendKeyEvent(button, false);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1295,7 +1296,7 @@ void osxGraphicsWindow::SystemSetWindowForground(bool forground)
|
|
|
WindowRef window = NULL;
|
|
WindowRef window = NULL;
|
|
|
OSStatus result = eventNotHandledErr;
|
|
OSStatus result = eventNotHandledErr;
|
|
|
UInt32 kind = GetEventKind (event);
|
|
UInt32 kind = GetEventKind (event);
|
|
|
- EventMouseButton button = 0;
|
|
|
|
|
|
|
+// EventMouseButton button = 0;
|
|
|
Point qdGlobalPoint = {0, 0};
|
|
Point qdGlobalPoint = {0, 0};
|
|
|
UInt32 modifiers = 0;
|
|
UInt32 modifiers = 0;
|
|
|
Rect rectPort;
|
|
Rect rectPort;
|
|
@@ -1318,7 +1319,7 @@ void osxGraphicsWindow::SystemSetWindowForground(bool forground)
|
|
|
// start trackball, pan, or dolly
|
|
// start trackball, pan, or dolly
|
|
|
case kEventMouseDown:
|
|
case kEventMouseDown:
|
|
|
{
|
|
{
|
|
|
- GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(EventMouseButton), NULL, &button);
|
|
|
|
|
|
|
+// GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(EventMouseButton), NULL, &button);
|
|
|
GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
|
|
GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
|
|
|
if(_properties.get_mouse_mode()==WindowProperties::M_relative)
|
|
if(_properties.get_mouse_mode()==WindowProperties::M_relative)
|
|
|
{
|
|
{
|
|
@@ -1332,11 +1333,17 @@ void osxGraphicsWindow::SystemSetWindowForground(bool forground)
|
|
|
GetEventParameter(event, kEventParamMouseLocation,typeQDPoint, NULL, sizeof(Point),NULL , (void*) &qdGlobalPoint);
|
|
GetEventParameter(event, kEventParamMouseLocation,typeQDPoint, NULL, sizeof(Point),NULL , (void*) &qdGlobalPoint);
|
|
|
SystemPointToLocalPoint(qdGlobalPoint);
|
|
SystemPointToLocalPoint(qdGlobalPoint);
|
|
|
}
|
|
}
|
|
|
- ButtonHandle button_h = MouseButton::one();
|
|
|
|
|
- if(kEventMouseButtonSecondary == button)
|
|
|
|
|
|
|
+
|
|
|
|
|
+ ButtonHandle button_h = MouseButton::one();
|
|
|
|
|
+ UInt32 buttons = GetCurrentEventButtonState();
|
|
|
|
|
+
|
|
|
|
|
+ if (buttons & (1 << 1))
|
|
|
|
|
+// if(kEventMouseButtonSecondary == button)
|
|
|
button_h = MouseButton::three();
|
|
button_h = MouseButton::three();
|
|
|
- if(kEventMouseButtonTertiary == button)
|
|
|
|
|
|
|
+ if (buttons & (1 << 2))
|
|
|
|
|
+// if(kEventMouseButtonTertiary == button)
|
|
|
button_h = MouseButton::two();
|
|
button_h = MouseButton::two();
|
|
|
|
|
+
|
|
|
_input_devices[0].set_pointer_in_window((int)qdGlobalPoint.h, (int)qdGlobalPoint.v);
|
|
_input_devices[0].set_pointer_in_window((int)qdGlobalPoint.h, (int)qdGlobalPoint.v);
|
|
|
_input_devices[0].button_down(button_h);
|
|
_input_devices[0].button_down(button_h);
|
|
|
result = noErr;
|
|
result = noErr;
|
|
@@ -1345,7 +1352,7 @@ void osxGraphicsWindow::SystemSetWindowForground(bool forground)
|
|
|
// stop trackball, pan, or dolly
|
|
// stop trackball, pan, or dolly
|
|
|
case kEventMouseUp:
|
|
case kEventMouseUp:
|
|
|
{
|
|
{
|
|
|
- GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(EventMouseButton), NULL, &button);
|
|
|
|
|
|
|
+// GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(EventMouseButton), NULL, &button);
|
|
|
// GetEventParameter(event, kEventParamWindowMouseLocation, typeHIPoint, NULL, sizeof(HIPoint), NULL, &location); // Mac OS X v10.1 and later
|
|
// GetEventParameter(event, kEventParamWindowMouseLocation, typeHIPoint, NULL, sizeof(HIPoint), NULL, &location); // Mac OS X v10.1 and later
|
|
|
if(_properties.get_mouse_mode()==WindowProperties::M_relative)
|
|
if(_properties.get_mouse_mode()==WindowProperties::M_relative)
|
|
|
{
|
|
{
|
|
@@ -1359,11 +1366,17 @@ void osxGraphicsWindow::SystemSetWindowForground(bool forground)
|
|
|
GetEventParameter(event, kEventParamMouseLocation,typeQDPoint, NULL, sizeof(Point),NULL , (void*) &qdGlobalPoint);
|
|
GetEventParameter(event, kEventParamMouseLocation,typeQDPoint, NULL, sizeof(Point),NULL , (void*) &qdGlobalPoint);
|
|
|
SystemPointToLocalPoint(qdGlobalPoint);
|
|
SystemPointToLocalPoint(qdGlobalPoint);
|
|
|
}
|
|
}
|
|
|
- ButtonHandle button_h = MouseButton::one();
|
|
|
|
|
- if(kEventMouseButtonSecondary == button)
|
|
|
|
|
|
|
+
|
|
|
|
|
+ ButtonHandle button_h = MouseButton::one();
|
|
|
|
|
+ UInt32 buttons = GetCurrentEventButtonState();
|
|
|
|
|
+
|
|
|
|
|
+// if(kEventMouseButtonSecondary == button)
|
|
|
|
|
+ if (buttons & (1 << 1))
|
|
|
button_h = MouseButton::three();
|
|
button_h = MouseButton::three();
|
|
|
- if(kEventMouseButtonTertiary == button)
|
|
|
|
|
|
|
+// if(kEventMouseButtonTertiary == button)
|
|
|
|
|
+ if (buttons & (1 << 2))
|
|
|
button_h = MouseButton::two();
|
|
button_h = MouseButton::two();
|
|
|
|
|
+
|
|
|
_input_devices[0].set_pointer_in_window((int)qdGlobalPoint.h, (int)qdGlobalPoint.v);
|
|
_input_devices[0].set_pointer_in_window((int)qdGlobalPoint.h, (int)qdGlobalPoint.v);
|
|
|
_input_devices[0].button_up(button_h);
|
|
_input_devices[0].button_up(button_h);
|
|
|
result = noErr;
|
|
result = noErr;
|
|
@@ -1475,16 +1488,16 @@ void osxGraphicsWindow::SystemSetWindowForground(bool forground)
|
|
|
case 76: nk = KeyboardButton::enter(); break;
|
|
case 76: nk = KeyboardButton::enter(); break;
|
|
|
case 36: nk = KeyboardButton::enter(); break;
|
|
case 36: nk = KeyboardButton::enter(); break;
|
|
|
|
|
|
|
|
- case 123: nk = KeyboardButton::left(); break;
|
|
|
|
|
|
|
+ case 123: nk = KeyboardButton::left(); break;
|
|
|
case 124: nk = KeyboardButton::right(); break;
|
|
case 124: nk = KeyboardButton::right(); break;
|
|
|
- case 125: nk = KeyboardButton::down(); break;
|
|
|
|
|
|
|
+ case 125: nk = KeyboardButton::down(); break;
|
|
|
case 126: nk = KeyboardButton::up(); break;
|
|
case 126: nk = KeyboardButton::up(); break;
|
|
|
- case 116: nk = KeyboardButton::page_up(); break;
|
|
|
|
|
- case 121: nk = KeyboardButton::page_down(); break;
|
|
|
|
|
- case 115: nk = KeyboardButton::home(); break;
|
|
|
|
|
|
|
+ case 116: nk = KeyboardButton::page_up(); break;
|
|
|
|
|
+ case 121: nk = KeyboardButton::page_down(); break;
|
|
|
|
|
+ case 115: nk = KeyboardButton::home(); break;
|
|
|
case 119: nk = KeyboardButton::end(); break;
|
|
case 119: nk = KeyboardButton::end(); break;
|
|
|
case 114: nk = KeyboardButton::help(); break;
|
|
case 114: nk = KeyboardButton::help(); break;
|
|
|
- case 117: nk = KeyboardButton::del(); break;
|
|
|
|
|
|
|
+ case 117: nk = KeyboardButton::del(); break;
|
|
|
|
|
|
|
|
// case 71: nk = KeyboardButton::num_lock() break;
|
|
// case 71: nk = KeyboardButton::num_lock() break;
|
|
|
|
|
|
|
@@ -1507,17 +1520,17 @@ void osxGraphicsWindow::SystemSetWindowForground(bool forground)
|
|
|
case 106: nk = KeyboardButton::f16(); break;
|
|
case 106: nk = KeyboardButton::f16(); break;
|
|
|
|
|
|
|
|
// shiftable chartablet
|
|
// shiftable chartablet
|
|
|
- case 50: nk = KeyboardButton::ascii_key('`'); break;
|
|
|
|
|
- case 27: nk = KeyboardButton::ascii_key('-'); break;
|
|
|
|
|
- case 24: nk = KeyboardButton::ascii_key('='); break;
|
|
|
|
|
- case 33: nk = KeyboardButton::ascii_key('['); break;
|
|
|
|
|
- case 30: nk = KeyboardButton::ascii_key(']'); break;
|
|
|
|
|
- case 42: nk = KeyboardButton::ascii_key('\\'); break;
|
|
|
|
|
- case 41: nk = KeyboardButton::ascii_key(';'); break;
|
|
|
|
|
- case 39: nk = KeyboardButton::ascii_key('\''); break;
|
|
|
|
|
- case 43: nk = KeyboardButton::ascii_key(','); break;
|
|
|
|
|
- case 47: nk = KeyboardButton::ascii_key('.'); break;
|
|
|
|
|
- case 44: nk = KeyboardButton::ascii_key('/'); break;
|
|
|
|
|
|
|
+ case 50: nk = KeyboardButton::ascii_key('`'); break;
|
|
|
|
|
+ case 27: nk = KeyboardButton::ascii_key('-'); break;
|
|
|
|
|
+ case 24: nk = KeyboardButton::ascii_key('='); break;
|
|
|
|
|
+ case 33: nk = KeyboardButton::ascii_key('['); break;
|
|
|
|
|
+ case 30: nk = KeyboardButton::ascii_key(']'); break;
|
|
|
|
|
+ case 42: nk = KeyboardButton::ascii_key('\\'); break;
|
|
|
|
|
+ case 41: nk = KeyboardButton::ascii_key(';'); break;
|
|
|
|
|
+ case 39: nk = KeyboardButton::ascii_key('\''); break;
|
|
|
|
|
+ case 43: nk = KeyboardButton::ascii_key(','); break;
|
|
|
|
|
+ case 47: nk = KeyboardButton::ascii_key('.'); break;
|
|
|
|
|
+ case 44: nk = KeyboardButton::ascii_key('/'); break;
|
|
|
|
|
|
|
|
default:
|
|
default:
|
|
|
if (osxdisplay_cat.is_debug()) {
|
|
if (osxdisplay_cat.is_debug()) {
|