- remove tabs
This commit is contained in:
parent
f7b3ba2a76
commit
89cf45ec2d
444
bochs/gui/wx.cc
444
bochs/gui/wx.cc
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// $Id: wx.cc,v 1.35 2002-10-04 10:52:44 vruppert Exp $
|
||||
// $Id: wx.cc,v 1.36 2002-10-05 12:40:34 bdenney Exp $
|
||||
/////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// wxWindows VGA display for Bochs. wx.cc implements a custom
|
||||
@ -69,9 +69,9 @@ static unsigned long wxCursorX = 0;
|
||||
static unsigned long wxCursorY = 0;
|
||||
static unsigned long wxFontY = 0;
|
||||
struct {
|
||||
unsigned char red;
|
||||
unsigned char green;
|
||||
unsigned char blue;
|
||||
unsigned char red;
|
||||
unsigned char green;
|
||||
unsigned char blue;
|
||||
} wxBochsPalette[256];
|
||||
wxCriticalSection event_thread_lock;
|
||||
BxEvent event_queue[MAX_EVENTS];
|
||||
@ -123,20 +123,20 @@ void MyPanel::OnTimer(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyPanel::OnPaint(wxPaintEvent& WXUNUSED(event))
|
||||
{
|
||||
wxPaintDC dc(this);
|
||||
IFDBG_VGA (wxLogDebug ("OnPaint"));
|
||||
//PrepareDC(dc);
|
||||
wxPaintDC dc(this);
|
||||
IFDBG_VGA (wxLogDebug ("OnPaint"));
|
||||
//PrepareDC(dc);
|
||||
|
||||
IFDBG_VGA(wxLogDebug ("MyPanel::OnPaint trying to get lock. wxScreen=%p", wxScreen));
|
||||
wxCriticalSectionLocker lock(wxScreen_lock);
|
||||
IFDBG_VGA(wxLogDebug ("MyPanel::OnPaint got lock. wxScreen=%p", wxScreen));
|
||||
if(wxScreen != NULL) {
|
||||
wxPoint pt = GetClientAreaOrigin();
|
||||
wxImage screenImage(wxScreenX, wxScreenY, (unsigned char *)wxScreen, TRUE);
|
||||
IFDBG_VGA(wxLogDebug ("drawBitmap"));
|
||||
dc.DrawBitmap(screenImage.ConvertToBitmap(), pt.x, pt.y, FALSE);
|
||||
}
|
||||
needRefresh = false;
|
||||
IFDBG_VGA(wxLogDebug ("MyPanel::OnPaint trying to get lock. wxScreen=%p", wxScreen));
|
||||
wxCriticalSectionLocker lock(wxScreen_lock);
|
||||
IFDBG_VGA(wxLogDebug ("MyPanel::OnPaint got lock. wxScreen=%p", wxScreen));
|
||||
if(wxScreen != NULL) {
|
||||
wxPoint pt = GetClientAreaOrigin();
|
||||
wxImage screenImage(wxScreenX, wxScreenY, (unsigned char *)wxScreen, TRUE);
|
||||
IFDBG_VGA(wxLogDebug ("drawBitmap"));
|
||||
dc.DrawBitmap(screenImage.ConvertToBitmap(), pt.x, pt.y, FALSE);
|
||||
}
|
||||
needRefresh = false;
|
||||
}
|
||||
|
||||
void MyPanel::ToggleMouse ()
|
||||
@ -224,27 +224,27 @@ MyPanel::MyRefresh ()
|
||||
|
||||
void MyPanel::OnKeyDown(wxKeyEvent& event)
|
||||
{
|
||||
if(event.GetKeyCode() == WXK_F12) {
|
||||
ToggleMouse ();
|
||||
return;
|
||||
}
|
||||
wxCriticalSectionLocker lock(event_thread_lock);
|
||||
if(num_events < MAX_EVENTS) {
|
||||
event_queue[num_events].type = BX_ASYNC_EVT_KEY;
|
||||
fillBxKeyEvent (event, event_queue[num_events].u.key, false);
|
||||
num_events++;
|
||||
}
|
||||
if(event.GetKeyCode() == WXK_F12) {
|
||||
ToggleMouse ();
|
||||
return;
|
||||
}
|
||||
wxCriticalSectionLocker lock(event_thread_lock);
|
||||
if(num_events < MAX_EVENTS) {
|
||||
event_queue[num_events].type = BX_ASYNC_EVT_KEY;
|
||||
fillBxKeyEvent (event, event_queue[num_events].u.key, false);
|
||||
num_events++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MyPanel::OnKeyUp(wxKeyEvent& event)
|
||||
{
|
||||
wxCriticalSectionLocker lock(event_thread_lock);
|
||||
if(num_events < MAX_EVENTS) {
|
||||
event_queue[num_events].type = BX_ASYNC_EVT_KEY;
|
||||
fillBxKeyEvent (event, event_queue[num_events].u.key, true);
|
||||
num_events++;
|
||||
}
|
||||
wxCriticalSectionLocker lock(event_thread_lock);
|
||||
if(num_events < MAX_EVENTS) {
|
||||
event_queue[num_events].type = BX_ASYNC_EVT_KEY;
|
||||
fillBxKeyEvent (event, event_queue[num_events].u.key, true);
|
||||
num_events++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -393,8 +393,8 @@ MyPanel::fillBxKeyEvent_MSW (wxKeyEvent& wxev, BxKeyEvent& bxev, Boolean release
|
||||
// Swap the scancodes of "numlock" and "pause"
|
||||
if ((key & 0xff)==0x45) key ^= 0x100;
|
||||
if (key & 0x0100) {
|
||||
// Its an extended key
|
||||
bxev.bx_key = 0xE000;
|
||||
// Its an extended key
|
||||
bxev.bx_key = 0xE000;
|
||||
}
|
||||
// Its a key
|
||||
bxev.bx_key |= (key & 0x00FF) | (release? 0x80 : 0x00);
|
||||
@ -592,99 +592,99 @@ MyPanel::fillBxKeyEvent (wxKeyEvent& wxev, BxKeyEvent& bxev, Boolean release)
|
||||
Bit32u bx_key;
|
||||
|
||||
if(key >= WXK_SPACE && key < WXK_DELETE) {
|
||||
bx_key = wxAsciiKey[key - WXK_SPACE];
|
||||
bx_key = wxAsciiKey[key - WXK_SPACE];
|
||||
} else {
|
||||
// handle extended keys here
|
||||
switch(key) {
|
||||
case WXK_BACK: bx_key = BX_KEY_BACKSPACE; break;
|
||||
case WXK_TAB: bx_key = BX_KEY_TAB; break;
|
||||
case WXK_RETURN: bx_key = BX_KEY_ENTER; break;
|
||||
case WXK_ESCAPE: bx_key = BX_KEY_ESC; break;
|
||||
case WXK_DELETE: bx_key = BX_KEY_DELETE; break;
|
||||
case WXK_SHIFT: bx_key = BX_KEY_SHIFT_L; break;
|
||||
case WXK_CONTROL: bx_key = BX_KEY_CTRL_L; break;
|
||||
case WXK_ALT: bx_key = BX_KEY_ALT_L; break;
|
||||
case WXK_MENU: bx_key = BX_KEY_MENU; break;
|
||||
case WXK_PAUSE: bx_key = BX_KEY_PAUSE; break;
|
||||
case WXK_PRIOR: bx_key = BX_KEY_PAGE_UP; break;
|
||||
case WXK_NEXT: bx_key = BX_KEY_PAGE_DOWN; break;
|
||||
case WXK_END: bx_key = BX_KEY_END; break;
|
||||
case WXK_HOME: bx_key = BX_KEY_HOME; break;
|
||||
case WXK_LEFT: bx_key = BX_KEY_LEFT; break;
|
||||
case WXK_UP: bx_key = BX_KEY_UP; break;
|
||||
case WXK_RIGHT: bx_key = BX_KEY_RIGHT; break;
|
||||
case WXK_DOWN: bx_key = BX_KEY_DOWN; break;
|
||||
case WXK_INSERT: bx_key = BX_KEY_INSERT; break;
|
||||
case WXK_NUMPAD0: bx_key = BX_KEY_KP_INSERT; break;
|
||||
case WXK_NUMPAD1: bx_key = BX_KEY_KP_END; break;
|
||||
case WXK_NUMPAD2: bx_key = BX_KEY_KP_DOWN; break;
|
||||
case WXK_NUMPAD3: bx_key = BX_KEY_KP_PAGE_DOWN; break;
|
||||
case WXK_NUMPAD4: bx_key = BX_KEY_KP_LEFT; break;
|
||||
case WXK_NUMPAD5: bx_key = BX_KEY_KP_5; break;
|
||||
case WXK_NUMPAD6: bx_key = BX_KEY_KP_RIGHT; break;
|
||||
case WXK_NUMPAD7: bx_key = BX_KEY_KP_HOME; break;
|
||||
case WXK_NUMPAD8: bx_key = BX_KEY_KP_UP; break;
|
||||
case WXK_NUMPAD9: bx_key = BX_KEY_KP_PAGE_UP; break;
|
||||
case WXK_F1: bx_key = BX_KEY_F1; break;
|
||||
case WXK_F2: bx_key = BX_KEY_F2; break;
|
||||
case WXK_F3: bx_key = BX_KEY_F3; break;
|
||||
case WXK_F4: bx_key = BX_KEY_F4; break;
|
||||
case WXK_F5: bx_key = BX_KEY_F5; break;
|
||||
case WXK_F6: bx_key = BX_KEY_F6; break;
|
||||
case WXK_F7: bx_key = BX_KEY_F7; break;
|
||||
case WXK_F8: bx_key = BX_KEY_F8; break;
|
||||
case WXK_F9: bx_key = BX_KEY_F9; break;
|
||||
case WXK_F10: bx_key = BX_KEY_F10; break;
|
||||
case WXK_F11: bx_key = BX_KEY_F11; break;
|
||||
case WXK_F12: bx_key = BX_KEY_F12; break;
|
||||
case WXK_NUMLOCK: bx_key = BX_KEY_NUM_LOCK; break;
|
||||
case WXK_SCROLL: bx_key = BX_KEY_SCRL_LOCK; break;
|
||||
case WXK_DECIMAL: bx_key = BX_KEY_PERIOD; break;
|
||||
case WXK_SUBTRACT: bx_key = BX_KEY_MINUS; break;
|
||||
case WXK_ADD: bx_key = BX_KEY_EQUALS; break;
|
||||
case WXK_MULTIPLY: bx_key = BX_KEY_KP_MULTIPLY; break;
|
||||
case WXK_DIVIDE: bx_key = BX_KEY_KP_DIVIDE; break;
|
||||
// handle extended keys here
|
||||
switch(key) {
|
||||
case WXK_BACK: bx_key = BX_KEY_BACKSPACE; break;
|
||||
case WXK_TAB: bx_key = BX_KEY_TAB; break;
|
||||
case WXK_RETURN: bx_key = BX_KEY_ENTER; break;
|
||||
case WXK_ESCAPE: bx_key = BX_KEY_ESC; break;
|
||||
case WXK_DELETE: bx_key = BX_KEY_DELETE; break;
|
||||
case WXK_SHIFT: bx_key = BX_KEY_SHIFT_L; break;
|
||||
case WXK_CONTROL: bx_key = BX_KEY_CTRL_L; break;
|
||||
case WXK_ALT: bx_key = BX_KEY_ALT_L; break;
|
||||
case WXK_MENU: bx_key = BX_KEY_MENU; break;
|
||||
case WXK_PAUSE: bx_key = BX_KEY_PAUSE; break;
|
||||
case WXK_PRIOR: bx_key = BX_KEY_PAGE_UP; break;
|
||||
case WXK_NEXT: bx_key = BX_KEY_PAGE_DOWN; break;
|
||||
case WXK_END: bx_key = BX_KEY_END; break;
|
||||
case WXK_HOME: bx_key = BX_KEY_HOME; break;
|
||||
case WXK_LEFT: bx_key = BX_KEY_LEFT; break;
|
||||
case WXK_UP: bx_key = BX_KEY_UP; break;
|
||||
case WXK_RIGHT: bx_key = BX_KEY_RIGHT; break;
|
||||
case WXK_DOWN: bx_key = BX_KEY_DOWN; break;
|
||||
case WXK_INSERT: bx_key = BX_KEY_INSERT; break;
|
||||
case WXK_NUMPAD0: bx_key = BX_KEY_KP_INSERT; break;
|
||||
case WXK_NUMPAD1: bx_key = BX_KEY_KP_END; break;
|
||||
case WXK_NUMPAD2: bx_key = BX_KEY_KP_DOWN; break;
|
||||
case WXK_NUMPAD3: bx_key = BX_KEY_KP_PAGE_DOWN; break;
|
||||
case WXK_NUMPAD4: bx_key = BX_KEY_KP_LEFT; break;
|
||||
case WXK_NUMPAD5: bx_key = BX_KEY_KP_5; break;
|
||||
case WXK_NUMPAD6: bx_key = BX_KEY_KP_RIGHT; break;
|
||||
case WXK_NUMPAD7: bx_key = BX_KEY_KP_HOME; break;
|
||||
case WXK_NUMPAD8: bx_key = BX_KEY_KP_UP; break;
|
||||
case WXK_NUMPAD9: bx_key = BX_KEY_KP_PAGE_UP; break;
|
||||
case WXK_F1: bx_key = BX_KEY_F1; break;
|
||||
case WXK_F2: bx_key = BX_KEY_F2; break;
|
||||
case WXK_F3: bx_key = BX_KEY_F3; break;
|
||||
case WXK_F4: bx_key = BX_KEY_F4; break;
|
||||
case WXK_F5: bx_key = BX_KEY_F5; break;
|
||||
case WXK_F6: bx_key = BX_KEY_F6; break;
|
||||
case WXK_F7: bx_key = BX_KEY_F7; break;
|
||||
case WXK_F8: bx_key = BX_KEY_F8; break;
|
||||
case WXK_F9: bx_key = BX_KEY_F9; break;
|
||||
case WXK_F10: bx_key = BX_KEY_F10; break;
|
||||
case WXK_F11: bx_key = BX_KEY_F11; break;
|
||||
case WXK_F12: bx_key = BX_KEY_F12; break;
|
||||
case WXK_NUMLOCK: bx_key = BX_KEY_NUM_LOCK; break;
|
||||
case WXK_SCROLL: bx_key = BX_KEY_SCRL_LOCK; break;
|
||||
case WXK_DECIMAL: bx_key = BX_KEY_PERIOD; break;
|
||||
case WXK_SUBTRACT: bx_key = BX_KEY_MINUS; break;
|
||||
case WXK_ADD: bx_key = BX_KEY_EQUALS; break;
|
||||
case WXK_MULTIPLY: bx_key = BX_KEY_KP_MULTIPLY; break;
|
||||
case WXK_DIVIDE: bx_key = BX_KEY_KP_DIVIDE; break;
|
||||
|
||||
case WXK_NUMPAD_ENTER: bx_key = BX_KEY_KP_ENTER; break;
|
||||
case WXK_NUMPAD_HOME: bx_key = BX_KEY_KP_HOME; break;
|
||||
case WXK_NUMPAD_LEFT: bx_key = BX_KEY_KP_LEFT; break;
|
||||
case WXK_NUMPAD_UP: bx_key = BX_KEY_KP_UP; break;
|
||||
case WXK_NUMPAD_RIGHT: bx_key = BX_KEY_KP_RIGHT; break;
|
||||
case WXK_NUMPAD_DOWN: bx_key = BX_KEY_KP_DOWN; break;
|
||||
case WXK_NUMPAD_PRIOR: bx_key = BX_KEY_KP_PAGE_UP; break;
|
||||
case WXK_NUMPAD_PAGEUP: bx_key = BX_KEY_KP_PAGE_UP; break;
|
||||
case WXK_NUMPAD_NEXT: bx_key = BX_KEY_KP_PAGE_DOWN; break;
|
||||
case WXK_NUMPAD_PAGEDOWN: bx_key = BX_KEY_KP_PAGE_DOWN; break;
|
||||
case WXK_NUMPAD_END: bx_key = BX_KEY_KP_END; break;
|
||||
case WXK_NUMPAD_BEGIN: bx_key = BX_KEY_KP_HOME; break;
|
||||
case WXK_NUMPAD_INSERT: bx_key = BX_KEY_KP_INSERT; break;
|
||||
case WXK_NUMPAD_DELETE: bx_key = BX_KEY_KP_DELETE; break;
|
||||
case WXK_NUMPAD_EQUAL: bx_key = BX_KEY_KP_ENTER; break;
|
||||
case WXK_NUMPAD_MULTIPLY: bx_key = BX_KEY_KP_MULTIPLY; break;
|
||||
case WXK_NUMPAD_SUBTRACT: bx_key = BX_KEY_KP_SUBTRACT; break;
|
||||
case WXK_NUMPAD_DECIMAL: bx_key = BX_KEY_KP_DELETE; break;
|
||||
case WXK_NUMPAD_DIVIDE: bx_key = BX_KEY_KP_DIVIDE; break;
|
||||
case WXK_NUMPAD_ENTER: bx_key = BX_KEY_KP_ENTER; break;
|
||||
case WXK_NUMPAD_HOME: bx_key = BX_KEY_KP_HOME; break;
|
||||
case WXK_NUMPAD_LEFT: bx_key = BX_KEY_KP_LEFT; break;
|
||||
case WXK_NUMPAD_UP: bx_key = BX_KEY_KP_UP; break;
|
||||
case WXK_NUMPAD_RIGHT: bx_key = BX_KEY_KP_RIGHT; break;
|
||||
case WXK_NUMPAD_DOWN: bx_key = BX_KEY_KP_DOWN; break;
|
||||
case WXK_NUMPAD_PRIOR: bx_key = BX_KEY_KP_PAGE_UP; break;
|
||||
case WXK_NUMPAD_PAGEUP: bx_key = BX_KEY_KP_PAGE_UP; break;
|
||||
case WXK_NUMPAD_NEXT: bx_key = BX_KEY_KP_PAGE_DOWN; break;
|
||||
case WXK_NUMPAD_PAGEDOWN: bx_key = BX_KEY_KP_PAGE_DOWN; break;
|
||||
case WXK_NUMPAD_END: bx_key = BX_KEY_KP_END; break;
|
||||
case WXK_NUMPAD_BEGIN: bx_key = BX_KEY_KP_HOME; break;
|
||||
case WXK_NUMPAD_INSERT: bx_key = BX_KEY_KP_INSERT; break;
|
||||
case WXK_NUMPAD_DELETE: bx_key = BX_KEY_KP_DELETE; break;
|
||||
case WXK_NUMPAD_EQUAL: bx_key = BX_KEY_KP_ENTER; break;
|
||||
case WXK_NUMPAD_MULTIPLY: bx_key = BX_KEY_KP_MULTIPLY; break;
|
||||
case WXK_NUMPAD_SUBTRACT: bx_key = BX_KEY_KP_SUBTRACT; break;
|
||||
case WXK_NUMPAD_DECIMAL: bx_key = BX_KEY_KP_DELETE; break;
|
||||
case WXK_NUMPAD_DIVIDE: bx_key = BX_KEY_KP_DIVIDE; break;
|
||||
|
||||
// Keys not handled by wxMSW
|
||||
case 20: bx_key = BX_KEY_CAPS_LOCK; break; // =+
|
||||
case 186: bx_key = BX_KEY_SEMICOLON; break; // ;:
|
||||
case 187: bx_key = BX_KEY_EQUALS; break; // =+
|
||||
case 188: bx_key = BX_KEY_COMMA; break; // ,<
|
||||
case 189: bx_key = BX_KEY_MINUS; break; // -_
|
||||
case 190: bx_key = BX_KEY_PERIOD; break; // .>
|
||||
case 191: bx_key = BX_KEY_SLASH; break; // /?
|
||||
case 192: bx_key = BX_KEY_GRAVE; break; // `~
|
||||
case 219: bx_key = BX_KEY_LEFT_BRACKET; break; // [{
|
||||
case 221: bx_key = BX_KEY_RIGHT_BRACKET; break; // ]}
|
||||
case 220: bx_key = BX_KEY_BACKSLASH; break; // \|
|
||||
case 222: bx_key = BX_KEY_SINGLE_QUOTE; break; // '"
|
||||
case 305: bx_key = BX_KEY_KP_5; break; // keypad 5
|
||||
case 392: bx_key = BX_KEY_KP_ADD; break; // keypad plus
|
||||
// Keys not handled by wxMSW
|
||||
case 20: bx_key = BX_KEY_CAPS_LOCK; break; // =+
|
||||
case 186: bx_key = BX_KEY_SEMICOLON; break; // ;:
|
||||
case 187: bx_key = BX_KEY_EQUALS; break; // =+
|
||||
case 188: bx_key = BX_KEY_COMMA; break; // ,<
|
||||
case 189: bx_key = BX_KEY_MINUS; break; // -_
|
||||
case 190: bx_key = BX_KEY_PERIOD; break; // .>
|
||||
case 191: bx_key = BX_KEY_SLASH; break; // /?
|
||||
case 192: bx_key = BX_KEY_GRAVE; break; // `~
|
||||
case 219: bx_key = BX_KEY_LEFT_BRACKET; break; // [{
|
||||
case 221: bx_key = BX_KEY_RIGHT_BRACKET; break; // ]}
|
||||
case 220: bx_key = BX_KEY_BACKSLASH; break; // \|
|
||||
case 222: bx_key = BX_KEY_SINGLE_QUOTE; break; // '"
|
||||
case 305: bx_key = BX_KEY_KP_5; break; // keypad 5
|
||||
case 392: bx_key = BX_KEY_KP_ADD; break; // keypad plus
|
||||
|
||||
default:
|
||||
wxLogMessage("Unhandled key event: %i (0x%x)", key, key);
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
wxLogMessage("Unhandled key event: %i (0x%x)", key, key);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
IFDBG_KEY (wxLogDebug ("fillBxKeyEvent: after remapping, key=%d", bx_key));
|
||||
bxev.bx_key = bx_key | (release? BX_KEY_RELEASED : BX_KEY_PRESSED);
|
||||
@ -710,9 +710,9 @@ bx_gui_c::specific_init(bx_gui_c *th, int argc, char **argv, unsigned tilewidth,
|
||||
}
|
||||
|
||||
for(i = 0; i < 256; i++) {
|
||||
wxBochsPalette[i].red = 0;
|
||||
wxBochsPalette[i].green = 0;
|
||||
wxBochsPalette[i].blue = 0;
|
||||
wxBochsPalette[i].red = 0;
|
||||
wxBochsPalette[i].green = 0;
|
||||
wxBochsPalette[i].blue = 0;
|
||||
}
|
||||
|
||||
for(i = 0; i < 256; i++) {
|
||||
@ -774,29 +774,29 @@ void bx_gui_c::handle_events(void)
|
||||
break;
|
||||
case BX_ASYNC_EVT_KEY:
|
||||
bx_key = event_queue[i].u.key.bx_key;
|
||||
if (event_queue[i].u.key.raw_scancode) {
|
||||
// event contains raw scancodes: use put_scancode
|
||||
Bit8u scancode;
|
||||
if (bx_key & 0xFF00) { // for extended keys
|
||||
scancode = 0xFF & (bx_key>>8);
|
||||
IFDBG_KEY (wxLogDebug ("sending raw scancode 0x%02x (extended key)", (int)scancode));
|
||||
bx_devices.keyboard->put_scancode (&scancode, 1);
|
||||
}
|
||||
scancode = 0xFF & bx_key;
|
||||
IFDBG_KEY (wxLogDebug ("sending raw scancode 0x%02x", (int)scancode));
|
||||
bx_devices.keyboard->put_scancode (&scancode, 1);
|
||||
} else {
|
||||
// event contains BX_KEY_* codes: use gen_scancode
|
||||
IFDBG_KEY (wxLogDebug ("sending key event 0x%02x", bx_key));
|
||||
bx_devices.keyboard->gen_scancode(bx_key);
|
||||
}
|
||||
if (event_queue[i].u.key.raw_scancode) {
|
||||
// event contains raw scancodes: use put_scancode
|
||||
Bit8u scancode;
|
||||
if (bx_key & 0xFF00) { // for extended keys
|
||||
scancode = 0xFF & (bx_key>>8);
|
||||
IFDBG_KEY (wxLogDebug ("sending raw scancode 0x%02x (extended key)", (int)scancode));
|
||||
bx_devices.keyboard->put_scancode (&scancode, 1);
|
||||
}
|
||||
scancode = 0xFF & bx_key;
|
||||
IFDBG_KEY (wxLogDebug ("sending raw scancode 0x%02x", (int)scancode));
|
||||
bx_devices.keyboard->put_scancode (&scancode, 1);
|
||||
} else {
|
||||
// event contains BX_KEY_* codes: use gen_scancode
|
||||
IFDBG_KEY (wxLogDebug ("sending key event 0x%02x", bx_key));
|
||||
bx_devices.keyboard->gen_scancode(bx_key);
|
||||
}
|
||||
break;
|
||||
case BX_ASYNC_EVT_MOUSE:
|
||||
bx_devices.keyboard->mouse_motion (
|
||||
event_queue[i].u.mouse.dx,
|
||||
event_queue[i].u.mouse.dy,
|
||||
event_queue[i].u.mouse.buttons);
|
||||
break;
|
||||
bx_devices.keyboard->mouse_motion (
|
||||
event_queue[i].u.mouse.dx,
|
||||
event_queue[i].u.mouse.dy,
|
||||
event_queue[i].u.mouse.buttons);
|
||||
break;
|
||||
default:
|
||||
wxLogError ("handle_events received unhandled event type %d in queue", (int)event_queue[i].type);
|
||||
}
|
||||
@ -833,51 +833,51 @@ bx_gui_c::clear_screen(void)
|
||||
static void
|
||||
UpdateScreen(char *newBits, int x, int y, int width, int height)
|
||||
{
|
||||
IFDBG_VGA(wxLogDebug ("MyPanel::UpdateScreen trying to get lock. wxScreen=%p", wxScreen));
|
||||
wxCriticalSectionLocker lock(wxScreen_lock);
|
||||
IFDBG_VGA(wxLogDebug ("MyPanel::UpdateScreen got lock. wxScreen=%p", wxScreen));
|
||||
if(wxScreen != NULL) {
|
||||
for(int i = 0; i < height; i++) {
|
||||
for(int c = 0; c < width; c++) {
|
||||
wxScreen[(y * wxScreenX * 3) + ((x+c) * 3)] = wxBochsPalette[newBits[(i * width) + c]].red;
|
||||
wxScreen[(y * wxScreenX * 3) + ((x+c) * 3) + 1] = wxBochsPalette[newBits[(i * width) + c]].green;
|
||||
wxScreen[(y * wxScreenX * 3) + ((x+c) * 3) + 2] = wxBochsPalette[newBits[(i * width) + c]].blue;
|
||||
}
|
||||
y++;
|
||||
if(y >= wxScreenY) break;
|
||||
}
|
||||
} else {
|
||||
IFDBG_VGA (wxLogDebug ("UpdateScreen with null wxScreen"));
|
||||
}
|
||||
IFDBG_VGA(wxLogDebug ("MyPanel::UpdateScreen trying to get lock. wxScreen=%p", wxScreen));
|
||||
wxCriticalSectionLocker lock(wxScreen_lock);
|
||||
IFDBG_VGA(wxLogDebug ("MyPanel::UpdateScreen got lock. wxScreen=%p", wxScreen));
|
||||
if(wxScreen != NULL) {
|
||||
for(int i = 0; i < height; i++) {
|
||||
for(int c = 0; c < width; c++) {
|
||||
wxScreen[(y * wxScreenX * 3) + ((x+c) * 3)] = wxBochsPalette[newBits[(i * width) + c]].red;
|
||||
wxScreen[(y * wxScreenX * 3) + ((x+c) * 3) + 1] = wxBochsPalette[newBits[(i * width) + c]].green;
|
||||
wxScreen[(y * wxScreenX * 3) + ((x+c) * 3) + 2] = wxBochsPalette[newBits[(i * width) + c]].blue;
|
||||
}
|
||||
y++;
|
||||
if(y >= wxScreenY) break;
|
||||
}
|
||||
} else {
|
||||
IFDBG_VGA (wxLogDebug ("UpdateScreen with null wxScreen"));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
DrawBochsBitmap(int x, int y, int width, int height, char *bmap, char color, int cs_start, int cs_end)
|
||||
{
|
||||
int j = 0;
|
||||
char bgcolor = (color >> 4) & 0xF;
|
||||
char fgcolor = color & 0xF;
|
||||
int j = 0;
|
||||
char bgcolor = (color >> 4) & 0xF;
|
||||
char fgcolor = color & 0xF;
|
||||
|
||||
if (cs_start <= cs_end) {
|
||||
height = cs_end - cs_start + 1;
|
||||
y += cs_start;
|
||||
j = cs_start * ((width - 1) / 8 + 1);
|
||||
}
|
||||
char *newBits = (char *)malloc(width * height);
|
||||
memset(newBits, 0, (width * height));
|
||||
for(int i = 0; i < (width * height) / 8; i++) {
|
||||
newBits[i * 8 + 0] = (bmap[j] & 0x80) ? fgcolor : bgcolor;
|
||||
newBits[i * 8 + 1] = (bmap[j] & 0x40) ? fgcolor : bgcolor;
|
||||
newBits[i * 8 + 2] = (bmap[j] & 0x20) ? fgcolor : bgcolor;
|
||||
newBits[i * 8 + 3] = (bmap[j] & 0x10) ? fgcolor : bgcolor;
|
||||
newBits[i * 8 + 4] = (bmap[j] & 0x08) ? fgcolor : bgcolor;
|
||||
newBits[i * 8 + 5] = (bmap[j] & 0x04) ? fgcolor : bgcolor;
|
||||
newBits[i * 8 + 6] = (bmap[j] & 0x02) ? fgcolor : bgcolor;
|
||||
newBits[i * 8 + 7] = (bmap[j] & 0x01) ? fgcolor : bgcolor;
|
||||
j++;
|
||||
}
|
||||
UpdateScreen(newBits, x, y, width, height);
|
||||
free(newBits);
|
||||
if (cs_start <= cs_end) {
|
||||
height = cs_end - cs_start + 1;
|
||||
y += cs_start;
|
||||
j = cs_start * ((width - 1) / 8 + 1);
|
||||
}
|
||||
char *newBits = (char *)malloc(width * height);
|
||||
memset(newBits, 0, (width * height));
|
||||
for(int i = 0; i < (width * height) / 8; i++) {
|
||||
newBits[i * 8 + 0] = (bmap[j] & 0x80) ? fgcolor : bgcolor;
|
||||
newBits[i * 8 + 1] = (bmap[j] & 0x40) ? fgcolor : bgcolor;
|
||||
newBits[i * 8 + 2] = (bmap[j] & 0x20) ? fgcolor : bgcolor;
|
||||
newBits[i * 8 + 3] = (bmap[j] & 0x10) ? fgcolor : bgcolor;
|
||||
newBits[i * 8 + 4] = (bmap[j] & 0x08) ? fgcolor : bgcolor;
|
||||
newBits[i * 8 + 5] = (bmap[j] & 0x04) ? fgcolor : bgcolor;
|
||||
newBits[i * 8 + 6] = (bmap[j] & 0x02) ? fgcolor : bgcolor;
|
||||
newBits[i * 8 + 7] = (bmap[j] & 0x01) ? fgcolor : bgcolor;
|
||||
j++;
|
||||
}
|
||||
UpdateScreen(newBits, x, y, width, height);
|
||||
free(newBits);
|
||||
}
|
||||
|
||||
|
||||
@ -902,47 +902,47 @@ DrawBochsBitmap(int x, int y, int width, int height, char *bmap, char color, int
|
||||
|
||||
void bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
|
||||
unsigned long cursor_x, unsigned long cursor_y,
|
||||
Bit16u cursor_state, unsigned nrows)
|
||||
Bit16u cursor_state, unsigned nrows)
|
||||
{
|
||||
IFDBG_VGA(wxLogDebug ("text_update"));
|
||||
//static Bit32u counter = 0;
|
||||
//BX_INFO (("text_update executed %d times", ++counter));
|
||||
|
||||
Bit8u cs_start = (cursor_state >> 8) & 0x3f;
|
||||
Bit8u cs_end = cursor_state & 0x1f;
|
||||
unsigned char cChar;
|
||||
unsigned int ncols = wxScreenX / 8;
|
||||
unsigned int nchars = ncols * nrows;
|
||||
Boolean forceUpdate = 0;
|
||||
if(bx_gui.charmap_updated) {
|
||||
forceUpdate = 1;
|
||||
bx_gui.charmap_updated = 0;
|
||||
}
|
||||
if((wxCursorY * ncols + wxCursorX) < nchars) {
|
||||
cChar = new_text[(wxCursorY * ncols + wxCursorX) * 2];
|
||||
DrawBochsBitmap(wxCursorX * 8, wxCursorY * wxFontY, 8, wxFontY, (char *)&bx_gui.vga_charmap[cChar<<5], new_text[((wxCursorY * ncols + wxCursorX) * 2) + 1], 1, 0);
|
||||
}
|
||||
|
||||
for(unsigned int i = 0; i < nchars * 2; i += 2) {
|
||||
if(forceUpdate || (old_text[i] != new_text[i])
|
||||
|| (old_text[i+1] != new_text[i+1])) {
|
||||
cChar = new_text[i];
|
||||
int x = (i / 2) % ncols;
|
||||
int y = (i / 2) / ncols;
|
||||
DrawBochsBitmap(x * 8, y * wxFontY, 8, wxFontY, (char *)&bx_gui.vga_charmap[cChar<<5], new_text[i+1], 1, 0);
|
||||
}
|
||||
}
|
||||
wxCursorX = cursor_x;
|
||||
wxCursorY = cursor_y;
|
||||
Bit8u cs_start = (cursor_state >> 8) & 0x3f;
|
||||
Bit8u cs_end = cursor_state & 0x1f;
|
||||
unsigned char cChar;
|
||||
unsigned int ncols = wxScreenX / 8;
|
||||
unsigned int nchars = ncols * nrows;
|
||||
Boolean forceUpdate = 0;
|
||||
if(bx_gui.charmap_updated) {
|
||||
forceUpdate = 1;
|
||||
bx_gui.charmap_updated = 0;
|
||||
}
|
||||
if((wxCursorY * ncols + wxCursorX) < nchars) {
|
||||
cChar = new_text[(wxCursorY * ncols + wxCursorX) * 2];
|
||||
DrawBochsBitmap(wxCursorX * 8, wxCursorY * wxFontY, 8, wxFontY, (char *)&bx_gui.vga_charmap[cChar<<5], new_text[((wxCursorY * ncols + wxCursorX) * 2) + 1], 1, 0);
|
||||
}
|
||||
|
||||
for(unsigned int i = 0; i < nchars * 2; i += 2) {
|
||||
if(forceUpdate || (old_text[i] != new_text[i])
|
||||
|| (old_text[i+1] != new_text[i+1])) {
|
||||
cChar = new_text[i];
|
||||
int x = (i / 2) % ncols;
|
||||
int y = (i / 2) / ncols;
|
||||
DrawBochsBitmap(x * 8, y * wxFontY, 8, wxFontY, (char *)&bx_gui.vga_charmap[cChar<<5], new_text[i+1], 1, 0);
|
||||
}
|
||||
}
|
||||
wxCursorX = cursor_x;
|
||||
wxCursorY = cursor_y;
|
||||
|
||||
if(((cursor_y * ncols + cursor_x) < nchars) && (cs_start <= cs_end)) {
|
||||
cChar = new_text[(cursor_y * ncols + cursor_x) * 2];
|
||||
char cAttr = new_text[((cursor_y * ncols + cursor_x) * 2) + 1];
|
||||
cAttr = ((cAttr >> 4) & 0xF) + ((cAttr & 0xF) << 4);
|
||||
DrawBochsBitmap(wxCursorX * 8, wxCursorY * wxFontY, 8, wxFontY, (char *)&bx_gui.vga_charmap[cChar<<5], cAttr, cs_start, cs_end);
|
||||
}
|
||||
if(((cursor_y * ncols + cursor_x) < nchars) && (cs_start <= cs_end)) {
|
||||
cChar = new_text[(cursor_y * ncols + cursor_x) * 2];
|
||||
char cAttr = new_text[((cursor_y * ncols + cursor_x) * 2) + 1];
|
||||
cAttr = ((cAttr >> 4) & 0xF) + ((cAttr & 0xF) << 4);
|
||||
DrawBochsBitmap(wxCursorX * 8, wxCursorY * wxFontY, 8, wxFontY, (char *)&bx_gui.vga_charmap[cChar<<5], cAttr, cs_start, cs_end);
|
||||
}
|
||||
|
||||
thePanel->MyRefresh ();
|
||||
thePanel->MyRefresh ();
|
||||
}
|
||||
|
||||
|
||||
@ -1005,7 +1005,7 @@ void bx_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight)
|
||||
IFDBG_VGA(wxLogDebug ("MyPanel::dimension_update got lock. wxScreen=%p", wxScreen));
|
||||
BX_INFO (("dimension update"));
|
||||
if (fheight > 0) {
|
||||
wxFontY = fheight;
|
||||
wxFontY = fheight;
|
||||
}
|
||||
wxScreenX = x;
|
||||
wxScreenY = y;
|
||||
|
Loading…
Reference in New Issue
Block a user