- fix bugs in copy&paste on win32.

- paste: grabbing the data from the clipboard in win32 was not implemented
  at all.  I found some example code on usenet and adapted it for Bochs.
- keymap: now if you call loadKeymap with NULL for the function pointer,
  it just fills in all the X windows keysyms with zero.  Added a call
  to loadKeymap in win32.cc.
This commit is contained in:
Bryce Denney 2002-03-11 16:35:41 +00:00
parent 12a812296d
commit ebc19a5e6c
3 changed files with 31 additions and 8 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: gui.cc,v 1.33 2002-03-11 15:45:34 bdenney Exp $
// $Id: gui.cc,v 1.34 2002-03-11 16:35:41 bdenney Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -335,7 +335,23 @@ bx_gui_c::paste_handler(void)
BX_ERROR (("keyboard_mapping disabled, so paste cannot work"));
return;
}
#if BX_WITH_X11
#ifdef WIN32
HANDLE hMem = GetClipboardData (CF_TEXT);
if (!OpenClipboard(NULL)) {
BX_ERROR (("paste: could not open clipboard"));
return;
}
HGLOBAL hg = GetClipboardData(CF_TEXT);
char *data = (char *)GlobalLock(hg);
nbytes = strlen(data);
bytes = (Bit8u *)malloc (nbytes+1);
BX_INFO (("found %d bytes on the clipboard", nbytes));
memcpy (bytes, data, nbytes+1);
BX_INFO (("first byte is 0x%02x", bytes[0]));
GlobalUnlock(hg);
CloseClipboard();
#elif BX_WITH_X11
extern Display *bx_x_display;
bytes = (Bit8u *)XFetchBytes (bx_x_display, &nbytes);
#else

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: keymap.cc,v 1.4 2002-03-11 15:04:58 bdenney Exp $
// $Id: keymap.cc,v 1.5 2002-03-11 16:35:41 bdenney Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 Christophe Bothamy
@ -224,9 +224,11 @@ bx_keymap_c::loadKeymap(Bit32u stringToSymbol(const char*), const char* filename
if (strncmp ("XK_", xwinSym, 3) != 0) {
BX_PANIC (("keymap line %d: X windows symbol '%s' must start with XK_", lineCount, xwinSym));
}
modKey = convertStringToBXKey(modSym);
xwinKey = stringToSymbol(xwinSym + 3); // skip over the "XK_"
modKey = convertStringToBXKey(modSym);
xwinKey = 0;
if (stringToSymbol != NULL)
xwinKey = stringToSymbol(xwinSym + 3); // skip over the "XK_"
// Check if data is valid
if( baseKey==BX_KEYMAP_UNKNOWN ) {
BX_PANIC (("line %d: unknown BX_KEY constant '%s'",lineCount,baseSym));

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: win32.cc,v 1.24 2002-03-10 04:51:24 bdenney Exp $
// $Id: win32.cc,v 1.25 2002-03-11 16:35:41 bdenney Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -335,7 +335,12 @@ void bx_gui_c::specific_init(bx_gui_c *th, int argc, char **argv, unsigned
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL);
if (bx_options.Oprivate_colormap->get ())
BX_INFO(( "private_colormap option ignored."));
BX_INFO(( "private_colormap option ignored."));
// load keymap tables
if(bx_options.keyboard.OuseMapping->get()) {
bx_keymap.loadKeymap(NULL); // I have no function to convert X windows symbols
}
}