Bochs gui code cleanup
- Only keep the comments for the specific gui methods in nogui.cc and add references to this file in all other gui sources. - Changed the order of methods and added some useful comments in gui.cc / gui.h. - Minor other cleanups
This commit is contained in:
parent
ffd7c4c492
commit
1546c8803b
@ -2,7 +2,7 @@
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2000-2013 The Bochs Project
|
||||
// Copyright (C) 2000-2017 The Bochs Project
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
@ -202,7 +202,7 @@ bx_bool open_screen(void)
|
||||
h = GetCyberIDAttr(CYBRIDATTR_HEIGHT, id);
|
||||
w = GetCyberIDAttr(CYBRIDATTR_WIDTH, id);
|
||||
d = GetCyberIDAttr(CYBRIDATTR_DEPTH, id);
|
||||
|
||||
|
||||
//sprintf(scrmode, "%d", id);
|
||||
//setenv("env:bochs/screenmode", scrmode, 1);
|
||||
|
||||
@ -302,6 +302,8 @@ bx_bool open_screen(void)
|
||||
black = ObtainBestPen(window->WScreen->ViewPort.ColorMap, 0x00000000, 0x00000000, 0x00000000, NULL);
|
||||
}
|
||||
|
||||
// AmigaOS implementation of the bx_gui_c methods (see nogui.cc for details)
|
||||
|
||||
void bx_amigaos_gui_c::specific_init(int argc, char **argv, unsigned headerbar_y)
|
||||
{
|
||||
put("AMGUI");
|
||||
|
@ -274,7 +274,7 @@ pascal OSStatus CEvtHandleWindowBackdropUpdate (EventHandlerCallRef nextHandler,
|
||||
}
|
||||
|
||||
// Translate MouseDowns in a handled window into Bochs events
|
||||
// Main ::HANDLE_EVENTS will feed all mouse updates to Bochs
|
||||
// Main ::handle_events() will feed all mouse updates to Bochs
|
||||
pascal OSStatus CEvtHandleWindowEmulatorClick (EventHandlerCallRef nextHandler,
|
||||
EventRef theEvent,
|
||||
void* userData)
|
||||
@ -784,18 +784,7 @@ void CreateWindows(void)
|
||||
SetPortWindowPort(win);
|
||||
}
|
||||
|
||||
// ::SPECIFIC_INIT()
|
||||
//
|
||||
// Called from gui.cc, once upon program startup, to allow for the
|
||||
// specific GUI code (X11, Win32, ...) to be initialized.
|
||||
//
|
||||
// argc, argv: not used right now, but the intention is to pass native GUI
|
||||
// specific options from the command line. (X11 options, Win32 options,...)
|
||||
//
|
||||
// headerbar_y: A headerbar (toolbar) is display on the top of the
|
||||
// VGA window, showing floppy status, and other information. It
|
||||
// always assumes the width of the current VGA mode width, but
|
||||
// it's height is defined by this parameter.
|
||||
// CARBON implementation of the bx_gui_c methods (see nogui.cc for details)
|
||||
|
||||
void bx_carbon_gui_c::specific_init(int argc, char **argv, unsigned headerbar_y)
|
||||
{
|
||||
@ -931,12 +920,6 @@ BX_CPP_INLINE void ResetPointer(void)
|
||||
}
|
||||
}
|
||||
|
||||
// ::HANDLE_EVENTS()
|
||||
//
|
||||
// Called periodically (vga_update_interval in .bochsrc) so the
|
||||
// the gui code can poll for keyboard, mouse, and other
|
||||
// relevant events.
|
||||
|
||||
void bx_carbon_gui_c::handle_events(void)
|
||||
{
|
||||
EventRecord event;
|
||||
@ -1069,11 +1052,6 @@ void bx_carbon_gui_c::handle_events(void)
|
||||
}
|
||||
|
||||
|
||||
// ::FLUSH()
|
||||
//
|
||||
// Called periodically, requesting that the gui code flush all pending
|
||||
// screen update requests.
|
||||
|
||||
void bx_carbon_gui_c::flush(void)
|
||||
{
|
||||
// an opportunity to make the Window Manager happy.
|
||||
@ -1100,11 +1078,6 @@ void bx_carbon_gui_c::flush(void)
|
||||
}
|
||||
|
||||
|
||||
// ::CLEAR_SCREEN()
|
||||
//
|
||||
// Called to request that the VGA region is cleared. Don't
|
||||
// clear the area that defines the headerbar.
|
||||
|
||||
void bx_carbon_gui_c::clear_screen(void)
|
||||
{
|
||||
Rect r;
|
||||
@ -1121,25 +1094,6 @@ void bx_carbon_gui_c::clear_screen(void)
|
||||
|
||||
|
||||
|
||||
// ::TEXT_UPDATE()
|
||||
//
|
||||
// Called in a VGA text mode, to update the screen with
|
||||
// new content.
|
||||
//
|
||||
// old_text: array of character/attributes making up the contents
|
||||
// of the screen from the last call. See below
|
||||
// new_text: array of character/attributes making up the current
|
||||
// contents, which should now be displayed. See below
|
||||
//
|
||||
// format of old_text & new_text: each is tm_info->line_offset*text_rows
|
||||
// bytes long. Each character consists of 2 bytes. The first by is
|
||||
// the character value, the second is the attribute byte.
|
||||
//
|
||||
// cursor_x: new x location of cursor
|
||||
// cursor_y: new y location of cursor
|
||||
// tm_info: this structure contains information for additional
|
||||
// features in text mode (cursor shape, line offset,...)
|
||||
|
||||
void bx_carbon_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
|
||||
unsigned long cursor_x, unsigned long cursor_y,
|
||||
bx_vga_tminfo_t *tm_info)
|
||||
@ -1305,13 +1259,6 @@ int bx_carbon_gui_c::set_clipboard_text(char *text_snapshot, Bit32u len)
|
||||
return 1;
|
||||
}
|
||||
|
||||
// ::PALETTE_CHANGE()
|
||||
//
|
||||
// Allocate a color in the native GUI, for this color, and put
|
||||
// it in the colormap location 'index'.
|
||||
// returns: 0=no screen update needed (color map change has direct effect)
|
||||
// 1=screen updated needed (redraw using current colormap)
|
||||
|
||||
bx_bool bx_carbon_gui_c::palette_change(Bit8u index, Bit8u red, Bit8u green, Bit8u blue)
|
||||
{
|
||||
PaletteHandle thePal, oldpal;
|
||||
@ -1359,21 +1306,6 @@ bx_bool bx_carbon_gui_c::palette_change(Bit8u index, Bit8u red, Bit8u green, Bit
|
||||
}
|
||||
|
||||
|
||||
// ::GRAPHICS_TILE_UPDATE()
|
||||
//
|
||||
// Called to request that a tile of graphics be drawn to the
|
||||
// screen, since info in this region has changed.
|
||||
//
|
||||
// tile: array of 8bit values representing a block of pixels with
|
||||
// dimension equal to the 'x_tilesize' & 'y_tilesize' members.
|
||||
// Each value specifies an index into the
|
||||
// array of colors you allocated for ::palette_change()
|
||||
// x0: x origin of tile
|
||||
// y0: y origin of tile
|
||||
//
|
||||
// note: origin of tile and of window based on (0,0) being in the upper
|
||||
// left of the window.
|
||||
|
||||
void bx_carbon_gui_c::graphics_tile_update(Bit8u *tile, unsigned x0, unsigned y0)
|
||||
{
|
||||
Rect destRect;
|
||||
@ -1431,19 +1363,6 @@ void bx_carbon_gui_c::graphics_tile_update(Bit8u *tile, unsigned x0, unsigned y0
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ::DIMENSION_UPDATE()
|
||||
//
|
||||
// Called when the VGA mode changes it's X,Y dimensions.
|
||||
// Resize the window to this size, but you need to add on
|
||||
// the height of the headerbar to the Y value.
|
||||
//
|
||||
// x: new VGA x size
|
||||
// y: new VGA y size (add headerbar_y parameter from ::specific_init().
|
||||
// fheight: new VGA character height in text mode
|
||||
// fwidth : new VGA character width in text mode
|
||||
// bpp : bits per pixel in graphics mode
|
||||
|
||||
void bx_carbon_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsigned fwidth, unsigned bpp)
|
||||
{
|
||||
if ((bpp != 1) && (bpp != 2) && (bpp != 4) && (bpp != 8) && (bpp != 15) && (bpp != 16) && (bpp != 24) && (bpp != 32)) {
|
||||
@ -1504,15 +1423,6 @@ void bx_carbon_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight,
|
||||
|
||||
// ::CREATE_BITMAP()
|
||||
//
|
||||
// Create a monochrome bitmap of size 'xdim' by 'ydim', which will
|
||||
// be drawn in the headerbar. Return an integer ID to the bitmap,
|
||||
// with which the bitmap can be referenced later.
|
||||
//
|
||||
// bmap: packed 8 pixels-per-byte bitmap. The pixel order is:
|
||||
// bit0 is the left most pixel, bit7 is the right most pixel.
|
||||
// xdim: x dimension of bitmap
|
||||
// ydim: y dimension of bitmap
|
||||
|
||||
// rewritten by tim senecal to use the cicn (color icon) resources instead
|
||||
|
||||
// We need to have a cicn resource for each and every call to create_bitmap
|
||||
@ -1534,17 +1444,6 @@ unsigned bx_carbon_gui_c::create_bitmap(const unsigned char *bmap, unsigned xdim
|
||||
}
|
||||
|
||||
|
||||
// ::HEADERBAR_BITMAP()
|
||||
//
|
||||
// Called to install a bitmap in the bochs headerbar (toolbar).
|
||||
//
|
||||
// bmap_id: will correspond to an ID returned from
|
||||
// ::create_bitmap(). 'alignment' is either BX_GRAVITY_LEFT
|
||||
// or BX_GRAVITY_RIGHT, meaning install the bitmap in the next
|
||||
// available leftmost or rightmost space.
|
||||
// f: a 'C' function pointer to callback when the mouse is clicked in
|
||||
// the boundaries of this bitmap.
|
||||
|
||||
unsigned bx_carbon_gui_c::headerbar_bitmap(unsigned bmap_id, unsigned alignment, void (*f)(void))
|
||||
{
|
||||
unsigned hb_index;
|
||||
@ -1588,11 +1487,6 @@ unsigned bx_carbon_gui_c::headerbar_bitmap(unsigned bmap_id, unsigned alignment,
|
||||
return(hb_index);
|
||||
}
|
||||
|
||||
// ::SHOW_HEADERBAR()
|
||||
//
|
||||
// Show (redraw) the current headerbar, which is composed of
|
||||
// currently installed bitmaps.
|
||||
|
||||
void bx_carbon_gui_c::show_headerbar(void)
|
||||
{
|
||||
UpdateTools();
|
||||
@ -1600,19 +1494,6 @@ void bx_carbon_gui_c::show_headerbar(void)
|
||||
}
|
||||
|
||||
|
||||
// ::REPLACE_BITMAP()
|
||||
//
|
||||
// Replace the bitmap installed in the headerbar ID slot 'hbar_id',
|
||||
// with the one specified by 'bmap_id'. 'bmap_id' will have
|
||||
// been generated by ::create_bitmap(). The old and new bitmap
|
||||
// must be of the same size. This allows the bitmap the user
|
||||
// sees to change, when some action occurs. For example when
|
||||
// the user presses on the floppy icon, it then displays
|
||||
// the ejected status.
|
||||
//
|
||||
// hbar_id: headerbar slot ID
|
||||
// bmap_id: bitmap ID
|
||||
|
||||
void bx_carbon_gui_c::replace_bitmap(unsigned hbar_id, unsigned bmap_id)
|
||||
{
|
||||
//bx_tool_pixmap[hbar_id].pm = bx_pixmap[bmap_id];
|
||||
@ -1628,11 +1509,6 @@ void bx_carbon_gui_c::replace_bitmap(unsigned hbar_id, unsigned bmap_id)
|
||||
}
|
||||
|
||||
|
||||
// ::EXIT()
|
||||
//
|
||||
// Called before bochs terminates, to allow for a graceful
|
||||
// exit from the native GUI mechanism.
|
||||
|
||||
void bx_carbon_gui_c::exit(void)
|
||||
{
|
||||
if (!menubarVisible)
|
||||
|
100
bochs/gui/gui.cc
100
bochs/gui/gui.cc
@ -49,6 +49,8 @@ bx_gui_c *bx_gui = NULL;
|
||||
#define BX_GUI_THIS bx_gui->
|
||||
#define LOG_THIS BX_GUI_THIS
|
||||
|
||||
// user button shortcut stuff
|
||||
|
||||
#define BX_KEY_UNKNOWN 0x7fffffff
|
||||
#define N_USER_KEYS 38
|
||||
|
||||
@ -99,6 +101,20 @@ static user_key_t user_keys[N_USER_KEYS] =
|
||||
{ "scrlck", BX_KEY_SCRL_LOCK }
|
||||
};
|
||||
|
||||
Bit32u get_user_key(char *key)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
while (i < N_USER_KEYS) {
|
||||
if (!strcmp(key, user_keys[i].key))
|
||||
return user_keys[i].symbol;
|
||||
i++;
|
||||
}
|
||||
return BX_KEY_UNKNOWN;
|
||||
}
|
||||
|
||||
// font bitmap helper function
|
||||
|
||||
Bit8u reverse_bitorder(Bit8u b)
|
||||
{
|
||||
Bit8u ret = 0;
|
||||
@ -110,6 +126,8 @@ Bit8u reverse_bitorder(Bit8u b)
|
||||
return ret;
|
||||
}
|
||||
|
||||
// common gui implementation
|
||||
|
||||
bx_gui_c::bx_gui_c(void): disp_mode(DISP_MODE_SIM)
|
||||
{
|
||||
put("GUI"); // Init in specific_init
|
||||
@ -679,18 +697,6 @@ const char* bx_gui_c::get_toggle_info(void)
|
||||
return mouse_toggle_text;
|
||||
}
|
||||
|
||||
Bit32u get_user_key(char *key)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
while (i < N_USER_KEYS) {
|
||||
if (!strcmp(key, user_keys[i].key))
|
||||
return user_keys[i].symbol;
|
||||
i++;
|
||||
}
|
||||
return BX_KEY_UNKNOWN;
|
||||
}
|
||||
|
||||
bx_bool bx_gui_c::parse_user_shortcut(const char *val)
|
||||
{
|
||||
char *ptr, shortcut_tmp[512];
|
||||
@ -922,6 +928,42 @@ void bx_gui_c::get_capabilities(Bit16u *xres, Bit16u *yres, Bit16u *bpp)
|
||||
*bpp = 32;
|
||||
}
|
||||
|
||||
bx_bool bx_gui_c::palette_change_common(Bit8u index, Bit8u red, Bit8u green, Bit8u blue)
|
||||
{
|
||||
BX_GUI_THIS palette[index].red = red;
|
||||
BX_GUI_THIS palette[index].green = green;
|
||||
BX_GUI_THIS palette[index].blue = blue;
|
||||
return palette_change(index, red, green, blue);
|
||||
}
|
||||
|
||||
void bx_gui_c::show_ips(Bit32u ips_count)
|
||||
{
|
||||
#if BX_SHOW_IPS
|
||||
BX_INFO(("ips = %3.3fM", ips_count / 1000000.0));
|
||||
#endif
|
||||
}
|
||||
|
||||
Bit8u bx_gui_c::get_mouse_headerbar_id()
|
||||
{
|
||||
return BX_GUI_THIS mouse_hbar_id;
|
||||
}
|
||||
|
||||
#if BX_DEBUGGER && BX_DEBUGGER_GUI
|
||||
void bx_gui_c::init_debug_dialog()
|
||||
{
|
||||
extern void InitDebugDialog();
|
||||
InitDebugDialog();
|
||||
}
|
||||
|
||||
void bx_gui_c::close_debug_dialog()
|
||||
{
|
||||
extern void CloseDebugDialog();
|
||||
CloseDebugDialog();
|
||||
}
|
||||
#endif
|
||||
|
||||
// new graphics API (compatibility code)
|
||||
|
||||
bx_svga_tileinfo_t *bx_gui_c::graphics_tile_info(bx_svga_tileinfo_t *info)
|
||||
{
|
||||
BX_GUI_THIS host_pitch = BX_GUI_THIS host_xres * ((BX_GUI_THIS host_bpp + 1) >> 3);
|
||||
@ -1067,40 +1109,6 @@ bx_svga_tileinfo_t * bx_gui_c::graphics_tile_info_common(bx_svga_tileinfo_t *inf
|
||||
return info;
|
||||
}
|
||||
|
||||
bx_bool bx_gui_c::palette_change_common(Bit8u index, Bit8u red, Bit8u green, Bit8u blue)
|
||||
{
|
||||
BX_GUI_THIS palette[index].red = red;
|
||||
BX_GUI_THIS palette[index].green = green;
|
||||
BX_GUI_THIS palette[index].blue = blue;
|
||||
return palette_change(index, red, green, blue);
|
||||
}
|
||||
|
||||
void bx_gui_c::show_ips(Bit32u ips_count)
|
||||
{
|
||||
#if BX_SHOW_IPS
|
||||
BX_INFO(("ips = %3.3fM", ips_count / 1000000.0));
|
||||
#endif
|
||||
}
|
||||
|
||||
Bit8u bx_gui_c::get_mouse_headerbar_id()
|
||||
{
|
||||
return BX_GUI_THIS mouse_hbar_id;
|
||||
}
|
||||
|
||||
#if BX_DEBUGGER && BX_DEBUGGER_GUI
|
||||
void bx_gui_c::init_debug_dialog()
|
||||
{
|
||||
extern void InitDebugDialog();
|
||||
InitDebugDialog();
|
||||
}
|
||||
|
||||
void bx_gui_c::close_debug_dialog()
|
||||
{
|
||||
extern void CloseDebugDialog();
|
||||
CloseDebugDialog();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if BX_USE_GUI_CONSOLE
|
||||
|
||||
#define BX_CONSOLE_BUFSIZE 4000
|
||||
|
@ -105,9 +105,6 @@ public:
|
||||
unsigned long cursor_x, unsigned long cursor_y,
|
||||
bx_vga_tminfo_t *tm_info) = 0;
|
||||
virtual void graphics_tile_update(Bit8u *tile, unsigned x, unsigned y) = 0;
|
||||
virtual bx_svga_tileinfo_t *graphics_tile_info(bx_svga_tileinfo_t *info);
|
||||
virtual Bit8u *graphics_tile_get(unsigned x, unsigned y, unsigned *w, unsigned *h);
|
||||
virtual void graphics_tile_update_in_place(unsigned x, unsigned y, unsigned w, unsigned h);
|
||||
virtual void handle_events(void) = 0;
|
||||
virtual void flush(void) = 0;
|
||||
virtual void clear_screen(void) = 0;
|
||||
@ -120,9 +117,14 @@ public:
|
||||
virtual int get_clipboard_text(Bit8u **bytes, Bit32s *nbytes) = 0;
|
||||
virtual int set_clipboard_text(char *snapshot, Bit32u len) = 0;
|
||||
virtual void mouse_enabled_changed_specific (bx_bool val) = 0;
|
||||
virtual void exit(void) = 0;
|
||||
// new graphics API methods (compatibility mode in gui.cc)
|
||||
virtual bx_svga_tileinfo_t *graphics_tile_info(bx_svga_tileinfo_t *info);
|
||||
virtual Bit8u *graphics_tile_get(unsigned x, unsigned y, unsigned *w, unsigned *h);
|
||||
virtual void graphics_tile_update_in_place(unsigned x, unsigned y, unsigned w, unsigned h);
|
||||
// optional gui methods (stubs or default code in gui.cc)
|
||||
virtual void statusbar_setitem_specific(int element, bx_bool active, bx_bool w) {}
|
||||
virtual void set_tooltip(unsigned hbar_id, const char *tip) {}
|
||||
virtual void exit(void) = 0;
|
||||
// set_display_mode() changes the mode between the configuration interface
|
||||
// and the simulation. This is primarily intended for display libraries
|
||||
// which have a full-screen mode such as SDL, term, and svgalib. The display
|
||||
|
@ -380,18 +380,7 @@ void CreateWindows(void)
|
||||
SetPort(win);
|
||||
}
|
||||
|
||||
// ::SPECIFIC_INIT()
|
||||
//
|
||||
// Called from gui.cc, once upon program startup, to allow for the
|
||||
// specific GUI code (X11, Win32, ...) to be initialized.
|
||||
//
|
||||
// argc, argv: not used right now, but the intention is to pass native GUI
|
||||
// specific options from the command line. (X11 options, Win32 options,...)
|
||||
//
|
||||
// headerbar_y: A headerbar (toolbar) is display on the top of the
|
||||
// VGA window, showing floppy status, and other information. It
|
||||
// always assumes the width of the current VGA mode width, but
|
||||
// it's height is defined by this parameter.
|
||||
// MACINTOSH implementation of the bx_gui_c methods (see nogui.cc for details)
|
||||
|
||||
void bx_macintosh_gui_c::specific_init(int argc, char **argv, unsigned headerbar_y)
|
||||
{
|
||||
@ -722,12 +711,6 @@ void UpdateWindow(WindowPtr window)
|
||||
SetPort(oldPort);
|
||||
}
|
||||
|
||||
// ::HANDLE_EVENTS()
|
||||
//
|
||||
// Called periodically (vga_update_interval in .bochsrc) so the
|
||||
// the gui code can poll for keyboard, mouse, and other
|
||||
// relevant events.
|
||||
|
||||
void bx_macintosh_gui_c::handle_events(void)
|
||||
{
|
||||
EventRecord event;
|
||||
@ -829,22 +812,12 @@ void bx_macintosh_gui_c::handle_events(void)
|
||||
SetPort(oldport);
|
||||
}
|
||||
|
||||
// ::FLUSH()
|
||||
//
|
||||
// Called periodically, requesting that the gui code flush all pending
|
||||
// screen update requests.
|
||||
|
||||
void bx_macintosh_gui_c::flush(void)
|
||||
{
|
||||
// an opportunity to make the Window Manager happy.
|
||||
// not needed on the macintosh....
|
||||
}
|
||||
|
||||
// ::CLEAR_SCREEN()
|
||||
//
|
||||
// Called to request that the VGA region is cleared. Don't
|
||||
// clear the area that defines the headerbar.
|
||||
|
||||
void bx_macintosh_gui_c::clear_screen(void)
|
||||
{
|
||||
SetPort(win);
|
||||
@ -855,25 +828,6 @@ void bx_macintosh_gui_c::clear_screen(void)
|
||||
FillRect(&win->portRect, &qd.black);
|
||||
}
|
||||
|
||||
// ::TEXT_UPDATE()
|
||||
//
|
||||
// Called in a VGA text mode, to update the screen with
|
||||
// new content.
|
||||
//
|
||||
// old_text: array of character/attributes making up the contents
|
||||
// of the screen from the last call. See below
|
||||
// new_text: array of character/attributes making up the current
|
||||
// contents, which should now be displayed. See below
|
||||
//
|
||||
// format of old_text & new_text: each is tm_info->line_offset*text_rows
|
||||
// bytes long. Each character consists of 2 bytes. The first by is
|
||||
// the character value, the second is the attribute byte.
|
||||
//
|
||||
// cursor_x: new x location of cursor
|
||||
// cursor_y: new y location of cursor
|
||||
// tm_info: this structure contains information for additional
|
||||
// features in text mode (cursor shape, line offset,...)
|
||||
|
||||
void bx_macintosh_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
|
||||
unsigned long cursor_x, unsigned long cursor_y,
|
||||
bx_vga_tminfo_t *tm_info)
|
||||
@ -958,13 +912,6 @@ int bx_macintosh_gui_c::set_clipboard_text(char *text_snapshot, Bit32u len)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ::PALETTE_CHANGE()
|
||||
//
|
||||
// Allocate a color in the native GUI, for this color, and put
|
||||
// it in the colormap location 'index'.
|
||||
// returns: 0=no screen update needed (color map change has direct effect)
|
||||
// 1=screen updated needed (redraw using current colormap)
|
||||
|
||||
bx_bool bx_macintosh_gui_c::palette_change(Bit8u index, Bit8u red, Bit8u green, Bit8u blue)
|
||||
{
|
||||
PaletteHandle thePal, oldpal;
|
||||
@ -1014,21 +961,6 @@ bx_bool bx_macintosh_gui_c::palette_change(Bit8u index, Bit8u red, Bit8u green,
|
||||
return((**gTile).pixelType != RGBDirect);
|
||||
}
|
||||
|
||||
// ::GRAPHICS_TILE_UPDATE()
|
||||
//
|
||||
// Called to request that a tile of graphics be drawn to the
|
||||
// screen, since info in this region has changed.
|
||||
//
|
||||
// tile: array of 8bit values representing a block of pixels with
|
||||
// dimension equal to the 'x_tilesize' & 'y_tilesize' members.
|
||||
// Each value specifies an index into the
|
||||
// array of colors you allocated for ::palette_change()
|
||||
// x0: x origin of tile
|
||||
// y0: y origin of tile
|
||||
//
|
||||
// note: origin of tile and of window based on (0,0) being in the upper
|
||||
// left of the window.
|
||||
|
||||
void bx_macintosh_gui_c::graphics_tile_update(Bit8u *tile, unsigned x0, unsigned y0)
|
||||
{
|
||||
Rect destRect;
|
||||
@ -1073,18 +1005,6 @@ void bx_macintosh_gui_c::graphics_tile_update(Bit8u *tile, unsigned x0, unsigned
|
||||
//SetGWorld(savePort, saveDevice);
|
||||
}
|
||||
|
||||
// ::DIMENSION_UPDATE()
|
||||
//
|
||||
// Called when the VGA mode changes it's X,Y dimensions.
|
||||
// Resize the window to this size, but you need to add on
|
||||
// the height of the headerbar to the Y value.
|
||||
//
|
||||
// x: new VGA x size
|
||||
// y: new VGA y size (add headerbar_y parameter from ::specific_init().
|
||||
// fheight: new VGA character height in text mode
|
||||
// fwidth : new VGA character width in text mode
|
||||
// bpp : bits per pixel in graphics mode
|
||||
|
||||
void bx_macintosh_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsigned fwidth, unsigned bpp)
|
||||
{
|
||||
if ((bpp != 1) && (bpp != 2) && (bpp != 4) && (bpp != 8) && (bpp != 15) && (bpp != 16) && (bpp != 24) && (bpp != 32)) {
|
||||
@ -1129,15 +1049,6 @@ void bx_macintosh_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheig
|
||||
|
||||
// ::CREATE_BITMAP()
|
||||
//
|
||||
// Create a monochrome bitmap of size 'xdim' by 'ydim', which will
|
||||
// be drawn in the headerbar. Return an integer ID to the bitmap,
|
||||
// with which the bitmap can be referenced later.
|
||||
//
|
||||
// bmap: packed 8 pixels-per-byte bitmap. The pixel order is:
|
||||
// bit0 is the left most pixel, bit7 is the right most pixel.
|
||||
// xdim: x dimension of bitmap
|
||||
// ydim: y dimension of bitmap
|
||||
|
||||
// rewritten by tim senecal to use the cicn (color icon) resources instead
|
||||
|
||||
unsigned bx_macintosh_gui_c::create_bitmap(const unsigned char *bmap, unsigned xdim, unsigned ydim)
|
||||
@ -1154,17 +1065,6 @@ unsigned bx_macintosh_gui_c::create_bitmap(const unsigned char *bmap, unsigned x
|
||||
return(numPixMaps-1);
|
||||
}
|
||||
|
||||
// ::HEADERBAR_BITMAP()
|
||||
//
|
||||
// Called to install a bitmap in the bochs headerbar (toolbar).
|
||||
//
|
||||
// bmap_id: will correspond to an ID returned from
|
||||
// ::create_bitmap(). 'alignment' is either BX_GRAVITY_LEFT
|
||||
// or BX_GRAVITY_RIGHT, meaning install the bitmap in the next
|
||||
// available leftmost or rightmost space.
|
||||
// f: a 'C' function pointer to callback when the mouse is clicked in
|
||||
// the boundaries of this bitmap.
|
||||
|
||||
unsigned bx_macintosh_gui_c::headerbar_bitmap(unsigned bmap_id, unsigned alignment, void (*f)(void))
|
||||
{
|
||||
unsigned hb_index;
|
||||
@ -1193,11 +1093,6 @@ unsigned bx_macintosh_gui_c::headerbar_bitmap(unsigned bmap_id, unsigned alignme
|
||||
return(hb_index);
|
||||
}
|
||||
|
||||
// ::SHOW_HEADERBAR()
|
||||
//
|
||||
// Show (redraw) the current headerbar, which is composed of
|
||||
// currently installed bitmaps.
|
||||
|
||||
void bx_macintosh_gui_c::show_headerbar(void)
|
||||
{
|
||||
Rect destRect;
|
||||
@ -1222,19 +1117,6 @@ void bx_macintosh_gui_c::show_headerbar(void)
|
||||
|
||||
}
|
||||
|
||||
// ::REPLACE_BITMAP()
|
||||
//
|
||||
// Replace the bitmap installed in the headerbar ID slot 'hbar_id',
|
||||
// with the one specified by 'bmap_id'. 'bmap_id' will have
|
||||
// been generated by ::create_bitmap(). The old and new bitmap
|
||||
// must be of the same size. This allows the bitmap the user
|
||||
// sees to change, when some action occurs. For example when
|
||||
// the user presses on the floppy icon, it then displays
|
||||
// the ejected status.
|
||||
//
|
||||
// hbar_id: headerbar slot ID
|
||||
// bmap_id: bitmap ID
|
||||
|
||||
void bx_macintosh_gui_c::replace_bitmap(unsigned hbar_id, unsigned bmap_id)
|
||||
{
|
||||
//bx_tool_pixmap[hbar_id].pm = bx_pixmap[bmap_id];
|
||||
@ -1242,11 +1124,6 @@ void bx_macintosh_gui_c::replace_bitmap(unsigned hbar_id, unsigned bmap_id)
|
||||
show_headerbar();
|
||||
}
|
||||
|
||||
// ::EXIT()
|
||||
//
|
||||
// Called before bochs terminates, to allow for a graceful
|
||||
// exit from the native GUI mechanism.
|
||||
|
||||
void bx_macintosh_gui_c::exit(void)
|
||||
{
|
||||
if (!menubarVisible)
|
||||
|
@ -2,7 +2,7 @@
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001-2013 The Bochs Project
|
||||
// Copyright (C) 2001-2017 The Bochs Project
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
@ -84,7 +84,7 @@ void bx_nogui_gui_c::specific_init(int argc, char **argv, unsigned headerbar_y)
|
||||
|
||||
// ::HANDLE_EVENTS()
|
||||
//
|
||||
// Called periodically (vga_update_interval in .bochsrc) so the
|
||||
// Called periodically (every 1 virtual millisecond) so the
|
||||
// the gui code can poll for keyboard, mouse, and other
|
||||
// relevant events.
|
||||
|
||||
|
129
bochs/gui/rfb.cc
129
bochs/gui/rfb.cc
@ -207,20 +207,7 @@ static const rfbPixelFormat BGR233Format = {
|
||||
#define PF_EQ(x,y) ((x.bitsPerPixel == y.bitsPerPixel) && (x.depth == y.depth) && (x.trueColourFlag == y.trueColourFlag) && ((x.bigEndianFlag == y.bigEndianFlag) || (x.bitsPerPixel == 8)) && (!x.trueColourFlag || ((x.redMax == y.redMax) && (x.greenMax == y.greenMax) && (x.blueMax == y.blueMax) && (x.redShift == y.redShift) && (x.greenShift == y.greenShift) && (x.blueShift == y.blueShift))))
|
||||
|
||||
|
||||
// RFB implementation of the bx_gui_c methods
|
||||
|
||||
// ::SPECIFIC_INIT()
|
||||
//
|
||||
// Called from gui.cc, once upon program startup, to allow for the
|
||||
// specific GUI code (X11, Win32, ...) to be initialized.
|
||||
//
|
||||
// argc, argv: used to pass display library specific options to the init code
|
||||
// (X11 options, Win32 options,...)
|
||||
//
|
||||
// headerbar_y: A headerbar (toolbar) is display on the top of the
|
||||
// VGA window, showing floppy status, and other information. It
|
||||
// always assumes the width of the current VGA mode width, but
|
||||
// it's height is defined by this parameter.
|
||||
// RFB implementation of the bx_gui_c methods (see nogui.cc for details)
|
||||
|
||||
void bx_rfb_gui_c::specific_init(int argc, char **argv, unsigned headerbar_y)
|
||||
{
|
||||
@ -325,12 +312,6 @@ void bx_rfb_gui_c::specific_init(int argc, char **argv, unsigned headerbar_y)
|
||||
console.present = 1;
|
||||
}
|
||||
|
||||
// ::HANDLE_EVENTS()
|
||||
//
|
||||
// Called periodically (vga_update_interval in .bochsrc) so the
|
||||
// the gui code can poll for keyboard, mouse, and other
|
||||
// relevant events.
|
||||
|
||||
void bx_rfb_gui_c::handle_events(void)
|
||||
{
|
||||
while (bKeyboardInUse) ;
|
||||
@ -365,43 +346,15 @@ void bx_rfb_gui_c::handle_events(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
// ::FLUSH()
|
||||
//
|
||||
// Called periodically, requesting that the gui code flush all pending
|
||||
// screen update requests.
|
||||
|
||||
void bx_rfb_gui_c::flush(void)
|
||||
{
|
||||
}
|
||||
|
||||
// ::CLEAR_SCREEN()
|
||||
//
|
||||
// Called to request that the VGA region is cleared. Don't
|
||||
// clear the area that defines the headerbar.
|
||||
void bx_rfb_gui_c::clear_screen(void)
|
||||
{
|
||||
memset(&rfbScreen[rfbWindowX * rfbHeaderbarY], 0, rfbWindowX * rfbDimensionY);
|
||||
}
|
||||
|
||||
// ::TEXT_UPDATE()
|
||||
//
|
||||
// Called in a VGA text mode, to update the screen with
|
||||
// new content.
|
||||
//
|
||||
// old_text: array of character/attributes making up the contents
|
||||
// of the screen from the last call. See below
|
||||
// new_text: array of character/attributes making up the current
|
||||
// contents, which should now be displayed. See below
|
||||
//
|
||||
// format of old_text & new_text: each is tm_info->line_offset*text_rows
|
||||
// bytes long. Each character consists of 2 bytes. The first by is
|
||||
// the character value, the second is the attribute byte.
|
||||
//
|
||||
// cursor_x: new x location of cursor
|
||||
// cursor_y: new y location of cursor
|
||||
// tm_info: this structure contains information for additional
|
||||
// features in text mode (cursor shape, line offset,...)
|
||||
|
||||
void bx_rfb_gui_c::text_update(Bit8u *old_text, Bit8u *new_text, unsigned long cursor_x, unsigned long cursor_y, bx_vga_tminfo_t *tm_info)
|
||||
{
|
||||
Bit8u *old_line, *new_line;
|
||||
@ -498,33 +451,12 @@ int bx_rfb_gui_c::set_clipboard_text(char *text_snapshot, Bit32u len)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ::PALETTE_CHANGE()
|
||||
//
|
||||
// Allocate a color in the native GUI, for this color, and put
|
||||
// it in the colormap location 'index'.
|
||||
// returns: 0=no screen update needed (color map change has direct effect)
|
||||
// 1=screen updated needed (redraw using current colormap)
|
||||
|
||||
bx_bool bx_rfb_gui_c::palette_change(Bit8u index, Bit8u red, Bit8u green, Bit8u blue)
|
||||
{
|
||||
rfbPalette[index] = (((red * 7 + 127) / 255) << 0) | (((green * 7 + 127) / 255) << 3) | (((blue * 3 + 127) / 255) << 6);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// ::GRAPHICS_TILE_UPDATE()
|
||||
//
|
||||
// Called to request that a tile of graphics be drawn to the
|
||||
// screen, since info in this region has changed.
|
||||
//
|
||||
// tile: array of 8bit values representing a block of pixels with
|
||||
// dimension equal to the 'x_tilesize' & 'y_tilesize' members.
|
||||
// Each value specifies an index into the
|
||||
// array of colors you allocated for ::palette_change()
|
||||
// x0: x origin of tile
|
||||
// y0: y origin of tile
|
||||
//
|
||||
// note: origin of tile and of window based on (0,0) being in the upper
|
||||
// left of the window.
|
||||
void bx_rfb_gui_c::graphics_tile_update(Bit8u *tile, unsigned x0, unsigned y0)
|
||||
{
|
||||
unsigned c, i, h, y;
|
||||
@ -552,18 +484,6 @@ void bx_rfb_gui_c::graphics_tile_update(Bit8u *tile, unsigned x0, unsigned y0)
|
||||
rfbAddUpdateRegion(x0, y0 + rfbHeaderbarY, rfbTileX, h);
|
||||
}
|
||||
|
||||
// ::DIMENSION_UPDATE()
|
||||
//
|
||||
// Called when the VGA mode changes it's X,Y dimensions.
|
||||
// Resize the window to this size, but you need to add on
|
||||
// the height of the headerbar to the Y value.
|
||||
//
|
||||
// x: new VGA x size
|
||||
// y: new VGA y size (add headerbar_y parameter from ::specific_init().
|
||||
// fheight: new VGA character height in text mode
|
||||
// fwidth : new VGA character width in text mode
|
||||
// bpp : bits per pixel in graphics mode
|
||||
|
||||
void bx_rfb_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsigned fwidth, unsigned bpp)
|
||||
{
|
||||
if (bpp == 8) {
|
||||
@ -605,17 +525,6 @@ void bx_rfb_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, un
|
||||
}
|
||||
}
|
||||
|
||||
// ::CREATE_BITMAP()
|
||||
//
|
||||
// Create a monochrome bitmap of size 'xdim' by 'ydim', which will
|
||||
// be drawn in the headerbar. Return an integer ID to the bitmap,
|
||||
// with which the bitmap can be referenced later.
|
||||
//
|
||||
// bmap: packed 8 pixels-per-byte bitmap. The pixel order is:
|
||||
// bit0 is the left most pixel, bit7 is the right most pixel.
|
||||
// xdim: x dimension of bitmap
|
||||
// ydim: y dimension of bitmap
|
||||
|
||||
unsigned bx_rfb_gui_c::create_bitmap(const unsigned char *bmap, unsigned xdim, unsigned ydim)
|
||||
{
|
||||
if (rfbBitmapCount >= BX_MAX_PIXMAPS) {
|
||||
@ -631,20 +540,6 @@ unsigned bx_rfb_gui_c::create_bitmap(const unsigned char *bmap, unsigned xdim, u
|
||||
return (rfbBitmapCount - 1);
|
||||
}
|
||||
|
||||
// ::HEADERBAR_BITMAP()
|
||||
//
|
||||
// Called to install a bitmap in the bochs headerbar (toolbar).
|
||||
//
|
||||
// bmap_id: will correspond to an ID returned from
|
||||
// ::create_bitmap(). 'alignment' is either BX_GRAVITY_LEFT
|
||||
// or BX_GRAVITY_RIGHT, meaning install the bitmap in the next
|
||||
// available leftmost or rightmost space.
|
||||
// alignment: is either BX_GRAVITY_LEFT or BX_GRAVITY_RIGHT,
|
||||
// meaning install the bitmap in the next
|
||||
// available leftmost or rightmost space.
|
||||
// f: a 'C' function pointer to callback when the mouse is clicked in
|
||||
// the boundaries of this bitmap.
|
||||
|
||||
unsigned bx_rfb_gui_c::headerbar_bitmap(unsigned bmap_id, unsigned alignment, void (*f)(void))
|
||||
{
|
||||
int hb_index;
|
||||
@ -669,11 +564,6 @@ unsigned bx_rfb_gui_c::headerbar_bitmap(unsigned bmap_id, unsigned alignment, vo
|
||||
return hb_index;
|
||||
}
|
||||
|
||||
// ::SHOW_HEADERBAR()
|
||||
//
|
||||
// Show (redraw) the current headerbar, which is composed of
|
||||
// currently installed bitmaps.
|
||||
|
||||
void bx_rfb_gui_c::show_headerbar(void)
|
||||
{
|
||||
char *newBits, value;
|
||||
@ -710,19 +600,6 @@ void bx_rfb_gui_c::show_headerbar(void)
|
||||
}
|
||||
}
|
||||
|
||||
// ::REPLACE_BITMAP()
|
||||
//
|
||||
// Replace the bitmap installed in the headerbar ID slot 'hbar_id',
|
||||
// with the one specified by 'bmap_id'. 'bmap_id' will have
|
||||
// been generated by ::create_bitmap(). The old and new bitmap
|
||||
// must be of the same size. This allows the bitmap the user
|
||||
// sees to change, when some action occurs. For example when
|
||||
// the user presses on the floppy icon, it then displays
|
||||
// the ejected status.
|
||||
//
|
||||
// hbar_id: headerbar slot ID
|
||||
// bmap_id: bitmap ID
|
||||
|
||||
void bx_rfb_gui_c::replace_bitmap(unsigned hbar_id, unsigned bmap_id)
|
||||
{
|
||||
unsigned int xorigin;
|
||||
@ -739,10 +616,6 @@ void bx_rfb_gui_c::replace_bitmap(unsigned hbar_id, unsigned bmap_id)
|
||||
rfbBitmaps[bmap_id].bmap, headerbar_fg, headerbar_bg, 1);
|
||||
}
|
||||
|
||||
// ::EXIT()
|
||||
//
|
||||
// Called before bochs terminates, to allow for a graceful
|
||||
// exit from the native GUI mechanism.
|
||||
void bx_rfb_gui_c::exit(void)
|
||||
{
|
||||
unsigned int i;
|
||||
|
@ -499,6 +499,8 @@ bx_sdl_gui_c::bx_sdl_gui_c()
|
||||
}
|
||||
|
||||
|
||||
// SDL implementation of the bx_gui_c methods (see nogui.cc for details)
|
||||
|
||||
void bx_sdl_gui_c::specific_init(int argc, char **argv, unsigned headerbar_y)
|
||||
{
|
||||
int i, j;
|
||||
|
@ -400,6 +400,8 @@ bx_sdl2_gui_c::bx_sdl2_gui_c()
|
||||
info("maximum host resolution: x=%d y=%d", sdl_maxres.w, sdl_maxres.h);
|
||||
}
|
||||
|
||||
// SDL2 implementation of the bx_gui_c methods (see nogui.cc for details)
|
||||
|
||||
void bx_sdl2_gui_c::specific_init(int argc, char **argv, unsigned headerbar_y)
|
||||
{
|
||||
int i, j;
|
||||
|
@ -86,6 +86,8 @@ bx_svga_gui_c::bx_svga_gui_c()
|
||||
put("SVGA");
|
||||
}
|
||||
|
||||
// SVGA implementation of the bx_gui_c methods (see nogui.cc for details)
|
||||
|
||||
void bx_svga_gui_c::specific_init(int argc, char **argv, unsigned header_bar_y)
|
||||
{
|
||||
put("VGAGUI");
|
||||
@ -531,10 +533,6 @@ void bx_svga_gui_c::mouse_enabled_changed_specific (bx_bool val)
|
||||
}
|
||||
|
||||
|
||||
void headerbar_click(int x)
|
||||
{
|
||||
}
|
||||
|
||||
void bx_svga_gui_c::exit(void)
|
||||
{
|
||||
vga_setmode(TEXT);
|
||||
|
@ -2,7 +2,7 @@
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2000-2015 The Bochs Project
|
||||
// Copyright (C) 2000-2017 The Bochs Project
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
@ -166,18 +166,7 @@ void bx_term_gui_c::sighandler(int signo)
|
||||
}
|
||||
}
|
||||
|
||||
// ::SPECIFIC_INIT()
|
||||
//
|
||||
// Called from gui.cc, once upon program startup, to allow for the
|
||||
// specific GUI code (X11, Win32, ...) to be initialized.
|
||||
//
|
||||
// argc, argv: not used right now, but the intention is to pass native GUI
|
||||
// specific options from the command line. (X11 options, Win32 options,...)
|
||||
//
|
||||
// headerbar_y: A headerbar (toolbar) is display on the top of the
|
||||
// VGA window, showing floppy status, and other information. It
|
||||
// always assumes the width of the current VGA mode width, but
|
||||
// it's height is defined by this parameter.
|
||||
// TERM implementation of the bx_gui_c methods (see nogui.cc for details)
|
||||
|
||||
void bx_term_gui_c::specific_init(int argc, char **argv, unsigned headerbar_y)
|
||||
{
|
||||
@ -424,12 +413,6 @@ void do_char(int character, int alt)
|
||||
}
|
||||
}
|
||||
|
||||
// ::HANDLE_EVENTS()
|
||||
//
|
||||
// Called periodically (vga_update_interval in .bochsrc) so the
|
||||
// the gui code can poll for keyboard, mouse, and other
|
||||
// relevant events.
|
||||
|
||||
void bx_term_gui_c::handle_events(void)
|
||||
{
|
||||
int character;
|
||||
@ -439,21 +422,11 @@ void bx_term_gui_c::handle_events(void)
|
||||
}
|
||||
}
|
||||
|
||||
// ::FLUSH()
|
||||
//
|
||||
// Called periodically, requesting that the gui code flush all pending
|
||||
// screen update requests.
|
||||
|
||||
void bx_term_gui_c::flush(void)
|
||||
{
|
||||
if (initialized) refresh();
|
||||
}
|
||||
|
||||
// ::CLEAR_SCREEN()
|
||||
//
|
||||
// Called to request that the VGA region is cleared. Don't
|
||||
// clear the area that defines the headerbar.
|
||||
|
||||
void bx_term_gui_c::clear_screen(void)
|
||||
{
|
||||
clear();
|
||||
@ -552,25 +525,6 @@ chtype get_term_char(Bit8u vga_char[])
|
||||
return term_char;
|
||||
}
|
||||
|
||||
// ::TEXT_UPDATE()
|
||||
//
|
||||
// Called in a VGA text mode, to update the screen with
|
||||
// new content.
|
||||
//
|
||||
// old_text: array of character/attributes making up the contents
|
||||
// of the screen from the last call. See below
|
||||
// new_text: array of character/attributes making up the current
|
||||
// contents, which should now be displayed. See below
|
||||
//
|
||||
// format of old_text & new_text: each is tm_info->line_offset*text_rows
|
||||
// bytes long. Each character consists of 2 bytes. The first by is
|
||||
// the character value, the second is the attribute byte.
|
||||
//
|
||||
// cursor_x: new x location of cursor
|
||||
// cursor_y: new y location of cursor
|
||||
// tm_info: this structure contains information for additional
|
||||
// features in text mode (cursor shape, line offset,...)
|
||||
|
||||
void bx_term_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
|
||||
unsigned long cursor_x, unsigned long cursor_y,
|
||||
bx_vga_tminfo_t *tm_info)
|
||||
@ -650,13 +604,6 @@ int bx_term_gui_c::set_clipboard_text(char *text_snapshot, Bit32u len)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ::PALETTE_CHANGE()
|
||||
//
|
||||
// Allocate a color in the native GUI, for this color, and put
|
||||
// it in the colormap location 'index'.
|
||||
// returns: 0=no screen update needed (color map change has direct effect)
|
||||
// 1=screen updated needed (redraw using current colormap)
|
||||
|
||||
bx_bool bx_term_gui_c::palette_change(Bit8u index, Bit8u red, Bit8u green, Bit8u blue)
|
||||
{
|
||||
BX_DEBUG(("color pallete request (%d,%d,%d,%d) ignored", index,red,green,blue));
|
||||
@ -664,37 +611,10 @@ bx_bool bx_term_gui_c::palette_change(Bit8u index, Bit8u red, Bit8u green, Bit8u
|
||||
}
|
||||
|
||||
|
||||
// ::GRAPHICS_TILE_UPDATE()
|
||||
//
|
||||
// Called to request that a tile of graphics be drawn to the
|
||||
// screen, since info in this region has changed.
|
||||
//
|
||||
// tile: array of 8bit values representing a block of pixels with
|
||||
// dimension equal to the 'x_tilesize' & 'y_tilesize' members.
|
||||
// Each value specifies an index into the
|
||||
// array of colors you allocated for ::palette_change()
|
||||
// x0: x origin of tile
|
||||
// y0: y origin of tile
|
||||
//
|
||||
// note: origin of tile and of window based on (0,0) being in the upper
|
||||
// left of the window.
|
||||
|
||||
void bx_term_gui_c::graphics_tile_update(Bit8u *tile, unsigned x0, unsigned y0)
|
||||
{
|
||||
}
|
||||
|
||||
// ::DIMENSION_UPDATE()
|
||||
//
|
||||
// Called when the VGA mode changes it's X,Y dimensions.
|
||||
// Resize the window to this size, but you need to add on
|
||||
// the height of the headerbar to the Y value.
|
||||
//
|
||||
// x: new VGA x size
|
||||
// y: new VGA y size (add headerbar_y parameter from ::specific_init().
|
||||
// fheight: new VGA character height in text mode
|
||||
// fwidth : new VGA character width in text mode
|
||||
// bpp : bits per pixel in graphics mode
|
||||
|
||||
void bx_term_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsigned fwidth, unsigned bpp)
|
||||
{
|
||||
if (bpp > 8) {
|
||||
@ -726,72 +646,24 @@ void bx_term_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, u
|
||||
}
|
||||
}
|
||||
|
||||
// ::CREATE_BITMAP()
|
||||
//
|
||||
// Create a monochrome bitmap of size 'xdim' by 'ydim', which will
|
||||
// be drawn in the headerbar. Return an integer ID to the bitmap,
|
||||
// with which the bitmap can be referenced later.
|
||||
//
|
||||
// bmap: packed 8 pixels-per-byte bitmap. The pixel order is:
|
||||
// bit0 is the left most pixel, bit7 is the right most pixel.
|
||||
// xdim: x dimension of bitmap
|
||||
// ydim: y dimension of bitmap
|
||||
|
||||
unsigned bx_term_gui_c::create_bitmap(const unsigned char *bmap, unsigned xdim, unsigned ydim)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
// ::HEADERBAR_BITMAP()
|
||||
//
|
||||
// Called to install a bitmap in the bochs headerbar (toolbar).
|
||||
//
|
||||
// bmap_id: will correspond to an ID returned from
|
||||
// ::create_bitmap(). 'alignment' is either BX_GRAVITY_LEFT
|
||||
// or BX_GRAVITY_RIGHT, meaning install the bitmap in the next
|
||||
// available leftmost or rightmost space.
|
||||
// alignment: is either BX_GRAVITY_LEFT or BX_GRAVITY_RIGHT,
|
||||
// meaning install the bitmap in the next
|
||||
// available leftmost or rightmost space.
|
||||
// f: a 'C' function pointer to callback when the mouse is clicked in
|
||||
// the boundaries of this bitmap.
|
||||
|
||||
unsigned bx_term_gui_c::headerbar_bitmap(unsigned bmap_id, unsigned alignment, void (*f)(void))
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
// ::SHOW_HEADERBAR()
|
||||
//
|
||||
// Show (redraw) the current headerbar, which is composed of
|
||||
// currently installed bitmaps.
|
||||
|
||||
void bx_term_gui_c::show_headerbar(void)
|
||||
{
|
||||
}
|
||||
|
||||
// ::REPLACE_BITMAP()
|
||||
//
|
||||
// Replace the bitmap installed in the headerbar ID slot 'hbar_id',
|
||||
// with the one specified by 'bmap_id'. 'bmap_id' will have
|
||||
// been generated by ::create_bitmap(). The old and new bitmap
|
||||
// must be of the same size. This allows the bitmap the user
|
||||
// sees to change, when some action occurs. For example when
|
||||
// the user presses on the floppy icon, it then displays
|
||||
// the ejected status.
|
||||
//
|
||||
// hbar_id: headerbar slot ID
|
||||
// bmap_id: bitmap ID
|
||||
|
||||
void bx_term_gui_c::replace_bitmap(unsigned hbar_id, unsigned bmap_id)
|
||||
{
|
||||
}
|
||||
|
||||
// ::EXIT()
|
||||
//
|
||||
// Called before bochs terminates, to allow for a graceful
|
||||
// exit from the native GUI mechanism.
|
||||
|
||||
void bx_term_gui_c::exit(void)
|
||||
{
|
||||
if (!initialized) return;
|
||||
|
@ -213,20 +213,7 @@ DWORD WINAPI vncShowIPSthread(LPVOID);
|
||||
#endif
|
||||
|
||||
|
||||
// VNCSRV implementation of the bx_gui_c methods
|
||||
|
||||
// ::SPECIFIC_INIT()
|
||||
//
|
||||
// Called from gui.cc, once upon program startup, to allow for the
|
||||
// specific GUI code (X11, Win32, ...) to be initialized.
|
||||
//
|
||||
// argc, argv: used to pass display library specific options to the init code
|
||||
// (X11 options, Win32 options,...)
|
||||
//
|
||||
// headerbar_y: A headerbar (toolbar) is display on the top of the
|
||||
// VGA window, showing floppy status, and other information. It
|
||||
// always assumes the width of the current VGA mode width, but
|
||||
// it's height is defined by this parameter.
|
||||
// VNCSRV implementation of the bx_gui_c methods (see nogui.cc for details)
|
||||
|
||||
void bx_vncsrv_gui_c::specific_init(int argc, char **argv, unsigned headerbar_y)
|
||||
{
|
||||
@ -339,12 +326,6 @@ void bx_vncsrv_gui_c::specific_init(int argc, char **argv, unsigned headerbar_y)
|
||||
console.present = 1;
|
||||
}
|
||||
|
||||
// ::HANDLE_EVENTS()
|
||||
//
|
||||
// Called periodically (vga_update_interval in .bochsrc) so the
|
||||
// the gui code can poll for keyboard, mouse, and other
|
||||
// relevant events.
|
||||
|
||||
void bx_vncsrv_gui_c::handle_events(void)
|
||||
{
|
||||
BX_LOCK(bKeyboardInUse);
|
||||
@ -369,19 +350,10 @@ void bx_vncsrv_gui_c::handle_events(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
// ::FLUSH()
|
||||
//
|
||||
// Called periodically, requesting that the gui code flush all pending
|
||||
// screen update requests.
|
||||
|
||||
void bx_vncsrv_gui_c::flush(void)
|
||||
{
|
||||
}
|
||||
|
||||
// ::CLEAR_SCREEN()
|
||||
//
|
||||
// Called to request that the VGA region is cleared. Don't
|
||||
// clear the area that defines the headerbar.
|
||||
void bx_vncsrv_gui_c::clear_screen(void)
|
||||
{
|
||||
memset(&(screen->frameBuffer[rfbWindowX * rfbHeaderbarY * sizeof(rfbPixel)]),
|
||||
@ -389,25 +361,6 @@ void bx_vncsrv_gui_c::clear_screen(void)
|
||||
SendUpdate(0, rfbHeaderbarY, rfbDimensionX, rfbDimensionY);
|
||||
}
|
||||
|
||||
// ::TEXT_UPDATE()
|
||||
//
|
||||
// Called in a VGA text mode, to update the screen with
|
||||
// new content.
|
||||
//
|
||||
// old_text: array of character/attributes making up the contents
|
||||
// of the screen from the last call. See below
|
||||
// new_text: array of character/attributes making up the current
|
||||
// contents, which should now be displayed. See below
|
||||
//
|
||||
// format of old_text & new_text: each is tm_info->line_offset*text_rows
|
||||
// bytes long. Each character consists of 2 bytes. The first by is
|
||||
// the character value, the second is the attribute byte.
|
||||
//
|
||||
// cursor_x: new x location of cursor
|
||||
// cursor_y: new y location of cursor
|
||||
// tm_info: this structure contains information for additional
|
||||
// features in text mode (cursor shape, line offset,...)
|
||||
|
||||
void bx_vncsrv_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
|
||||
unsigned long cursor_x, unsigned long cursor_y,
|
||||
bx_vga_tminfo_t *tm_info)
|
||||
@ -511,13 +464,6 @@ int bx_vncsrv_gui_c::set_clipboard_text(char *text_snapshot, Bit32u len)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ::PALETTE_CHANGE()
|
||||
//
|
||||
// Allocate a color in the native GUI, for this color, and put
|
||||
// it in the colormap location 'index'.
|
||||
// returns: 0=no screen update needed (color map change has direct effect)
|
||||
// 1=screen updated needed (redraw using current colormap)
|
||||
|
||||
bx_bool bx_vncsrv_gui_c::palette_change(U8 index, U8 red,
|
||||
U8 green, U8 blue)
|
||||
{
|
||||
@ -525,20 +471,6 @@ bx_bool bx_vncsrv_gui_c::palette_change(U8 index, U8 red,
|
||||
return 1;
|
||||
}
|
||||
|
||||
// ::GRAPHICS_TILE_UPDATE()
|
||||
//
|
||||
// Called to request that a tile of graphics be drawn to the
|
||||
// screen, since info in this region has changed.
|
||||
//
|
||||
// tile: array of 8bit values representing a block of pixels with
|
||||
// dimension equal to the 'x_tilesize' & 'y_tilesize' members.
|
||||
// Each value specifies an index into the
|
||||
// array of colors you allocated for ::palette_change()
|
||||
// x0: x origin of tile
|
||||
// y0: y origin of tile
|
||||
//
|
||||
// note: origin of tile and of window based on (0,0) being in the upper
|
||||
// left of the window.
|
||||
void bx_vncsrv_gui_c::graphics_tile_update(Bit8u *tile, unsigned x0, unsigned y0)
|
||||
{
|
||||
rfbPixel *buf;
|
||||
@ -574,18 +506,6 @@ void bx_vncsrv_gui_c::graphics_tile_update(Bit8u *tile, unsigned x0, unsigned y0
|
||||
SendUpdate(x0, y0 + rfbHeaderbarY, rfbTileX, rfbTileY);
|
||||
}
|
||||
|
||||
// ::DIMENSION_UPDATE()
|
||||
//
|
||||
// Called when the VGA mode changes it's X,Y dimensions.
|
||||
// Resize the window to this size, but you need to add on
|
||||
// the height of the headerbar to the Y value.
|
||||
//
|
||||
// x: new VGA x size
|
||||
// y: new VGA y size (add headerbar_y parameter from ::specific_init().
|
||||
// fheight: new VGA character height in text mode
|
||||
// fwidth : new VGA character width in text mode
|
||||
// bpp : bits per pixel in graphics mode
|
||||
|
||||
void bx_vncsrv_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight,
|
||||
unsigned fwidth, unsigned bpp)
|
||||
{
|
||||
@ -628,17 +548,6 @@ void bx_vncsrv_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight,
|
||||
}
|
||||
}
|
||||
|
||||
// ::CREATE_BITMAP()
|
||||
//
|
||||
// Create a monochrome bitmap of size 'xdim' by 'ydim', which will
|
||||
// be drawn in the headerbar. Return an integer ID to the bitmap,
|
||||
// with which the bitmap can be referenced later.
|
||||
//
|
||||
// bmap: packed 8 pixels-per-byte bitmap. The pixel order is:
|
||||
// bit0 is the left most pixel, bit7 is the right most pixel.
|
||||
// xdim: x dimension of bitmap
|
||||
// ydim: y dimension of bitmap
|
||||
|
||||
unsigned bx_vncsrv_gui_c::create_bitmap(const unsigned char *bmap, unsigned xdim,
|
||||
unsigned ydim)
|
||||
{
|
||||
@ -655,20 +564,6 @@ unsigned bx_vncsrv_gui_c::create_bitmap(const unsigned char *bmap, unsigned xdim
|
||||
return (rfbBitmapCount - 1);
|
||||
}
|
||||
|
||||
// ::HEADERBAR_BITMAP()
|
||||
//
|
||||
// Called to install a bitmap in the bochs headerbar (toolbar).
|
||||
//
|
||||
// bmap_id: will correspond to an ID returned from
|
||||
// ::create_bitmap(). 'alignment' is either BX_GRAVITY_LEFT
|
||||
// or BX_GRAVITY_RIGHT, meaning install the bitmap in the next
|
||||
// available leftmost or rightmost space.
|
||||
// alignment: is either BX_GRAVITY_LEFT or BX_GRAVITY_RIGHT,
|
||||
// meaning install the bitmap in the next
|
||||
// available leftmost or rightmost space.
|
||||
// f: a 'C' function pointer to callback when the mouse is clicked in
|
||||
// the boundaries of this bitmap.
|
||||
|
||||
unsigned bx_vncsrv_gui_c::headerbar_bitmap(unsigned bmap_id, unsigned alignment,
|
||||
void (*f)(void))
|
||||
{
|
||||
@ -694,11 +589,6 @@ unsigned bx_vncsrv_gui_c::headerbar_bitmap(unsigned bmap_id, unsigned alignment,
|
||||
return hb_index;
|
||||
}
|
||||
|
||||
// ::SHOW_HEADERBAR()
|
||||
//
|
||||
// Show (redraw) the current headerbar, which is composed of
|
||||
// currently installed bitmaps.
|
||||
|
||||
void bx_vncsrv_gui_c::show_headerbar(void)
|
||||
{
|
||||
char *newBits, value;
|
||||
@ -736,19 +626,6 @@ void bx_vncsrv_gui_c::show_headerbar(void)
|
||||
}
|
||||
}
|
||||
|
||||
// ::REPLACE_BITMAP()
|
||||
//
|
||||
// Replace the bitmap installed in the headerbar ID slot 'hbar_id',
|
||||
// with the one specified by 'bmap_id'. 'bmap_id' will have
|
||||
// been generated by ::create_bitmap(). The old and new bitmap
|
||||
// must be of the same size. This allows the bitmap the user
|
||||
// sees to change, when some action occurs. For example when
|
||||
// the user presses on the floppy icon, it then displays
|
||||
// the ejected status.
|
||||
//
|
||||
// hbar_id: headerbar slot ID
|
||||
// bmap_id: bitmap ID
|
||||
|
||||
void bx_vncsrv_gui_c::replace_bitmap(unsigned hbar_id, unsigned bmap_id)
|
||||
{
|
||||
unsigned int xorigin;
|
||||
@ -765,10 +642,6 @@ void bx_vncsrv_gui_c::replace_bitmap(unsigned hbar_id, unsigned bmap_id)
|
||||
rfbBitmaps[bmap_id].bmap, headerbar_fg, headerbar_bg);
|
||||
}
|
||||
|
||||
// ::EXIT()
|
||||
//
|
||||
// Called before bochs terminates, to allow for a graceful
|
||||
// exit from the native GUI mechanism.
|
||||
void bx_vncsrv_gui_c::exit(void)
|
||||
{
|
||||
unsigned int i;
|
||||
|
@ -567,6 +567,8 @@ void terminateEmul(int reason)
|
||||
}
|
||||
|
||||
|
||||
// WIN32 implementation of the bx_gui_c methods (see nogui.cc for details)
|
||||
|
||||
bx_win32_gui_c::bx_win32_gui_c()
|
||||
{
|
||||
// prepare for possible fullscreen mode
|
||||
@ -577,19 +579,6 @@ bx_win32_gui_c::bx_win32_gui_c()
|
||||
}
|
||||
|
||||
|
||||
// ::SPECIFIC_INIT()
|
||||
//
|
||||
// Called from gui.cc, once upon program startup, to allow for the
|
||||
// specific GUI code (X11, Win32, ...) to be initialized.
|
||||
//
|
||||
// argc, argv: used to pass display library specific options to the init code
|
||||
// (X11 options, Win32 options,...)
|
||||
//
|
||||
// headerbar_y: A headerbar (toolbar) is display on the top of the
|
||||
// VGA window, showing floppy status, and other information. It
|
||||
// always assumes the width of the current VGA mode width, but
|
||||
// it's height is defined by this parameter.
|
||||
|
||||
void bx_win32_gui_c::specific_init(int argc, char **argv, unsigned headerbar_y)
|
||||
{
|
||||
int i;
|
||||
@ -1477,12 +1466,6 @@ QueueEvent* deq_key_event(void)
|
||||
}
|
||||
|
||||
|
||||
// ::HANDLE_EVENTS()
|
||||
//
|
||||
// Called periodically (vga_update_interval in .bochsrc) so the
|
||||
// the gui code can poll for keyboard, mouse, and other
|
||||
// relevant events.
|
||||
|
||||
void bx_win32_gui_c::handle_events(void)
|
||||
{
|
||||
Bit32u key;
|
||||
@ -1536,11 +1519,6 @@ void bx_win32_gui_c::handle_events(void)
|
||||
}
|
||||
|
||||
|
||||
// ::FLUSH()
|
||||
//
|
||||
// Called periodically, requesting that the gui code flush all pending
|
||||
// screen update requests.
|
||||
|
||||
void bx_win32_gui_c::flush(void)
|
||||
{
|
||||
EnterCriticalSection(&stInfo.drawCS);
|
||||
@ -1554,11 +1532,6 @@ void bx_win32_gui_c::flush(void)
|
||||
LeaveCriticalSection(&stInfo.drawCS);
|
||||
}
|
||||
|
||||
// ::CLEAR_SCREEN()
|
||||
//
|
||||
// Called to request that the VGA region is cleared. Don't
|
||||
// clear the area that defines the headerbar.
|
||||
|
||||
void bx_win32_gui_c::clear_screen(void)
|
||||
{
|
||||
HGDIOBJ oldObj;
|
||||
@ -1577,25 +1550,6 @@ void bx_win32_gui_c::clear_screen(void)
|
||||
}
|
||||
|
||||
|
||||
// ::TEXT_UPDATE()
|
||||
//
|
||||
// Called in a VGA text mode, to update the screen with
|
||||
// new content.
|
||||
//
|
||||
// old_text: array of character/attributes making up the contents
|
||||
// of the screen from the last call. See below
|
||||
// new_text: array of character/attributes making up the current
|
||||
// contents, which should now be displayed. See below
|
||||
//
|
||||
// format of old_text & new_text: each is tm_info->line_offset*text_rows
|
||||
// bytes long. Each character consists of 2 bytes. The first by is
|
||||
// the character value, the second is the attribute byte.
|
||||
//
|
||||
// cursor_x: new x location of cursor
|
||||
// cursor_y: new y location of cursor
|
||||
// tm_info: this structure contains information for additional
|
||||
// features in text mode (cursor shape, line offset,...)
|
||||
|
||||
void bx_win32_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
|
||||
unsigned long cursor_x, unsigned long cursor_y,
|
||||
bx_vga_tminfo_t *tm_info)
|
||||
@ -1841,13 +1795,6 @@ int bx_win32_gui_c::set_clipboard_text(char *text_snapshot, Bit32u len)
|
||||
}
|
||||
|
||||
|
||||
// ::PALETTE_CHANGE()
|
||||
//
|
||||
// Allocate a color in the native GUI, for this color, and put
|
||||
// it in the colormap location 'index'.
|
||||
// returns: 0=no screen update needed (color map change has direct effect)
|
||||
// 1=screen updated needed (redraw using current colormap)
|
||||
|
||||
bx_bool bx_win32_gui_c::palette_change(Bit8u index, Bit8u red, Bit8u green,
|
||||
Bit8u blue) {
|
||||
if ((current_bpp == 16) && (index < 3)) {
|
||||
@ -1864,21 +1811,6 @@ bx_bool bx_win32_gui_c::palette_change(Bit8u index, Bit8u red, Bit8u green,
|
||||
}
|
||||
|
||||
|
||||
// ::GRAPHICS_TILE_UPDATE()
|
||||
//
|
||||
// Called to request that a tile of graphics be drawn to the
|
||||
// screen, since info in this region has changed.
|
||||
//
|
||||
// tile: array of 8bit values representing a block of pixels with
|
||||
// dimension equal to the 'x_tilesize' & 'y_tilesize' members.
|
||||
// Each value specifies an index into the
|
||||
// array of colors you allocated for ::palette_change()
|
||||
// x0: x origin of tile
|
||||
// y0: y origin of tile
|
||||
//
|
||||
// note: origin of tile and of window based on (0,0) being in the upper
|
||||
// left of the window.
|
||||
|
||||
void bx_win32_gui_c::graphics_tile_update(Bit8u *tile, unsigned x0, unsigned y0)
|
||||
{
|
||||
HDC hdc;
|
||||
@ -1902,18 +1834,6 @@ void bx_win32_gui_c::graphics_tile_update(Bit8u *tile, unsigned x0, unsigned y0)
|
||||
|
||||
|
||||
|
||||
// ::DIMENSION_UPDATE()
|
||||
//
|
||||
// Called when the VGA mode changes it's X,Y dimensions.
|
||||
// Resize the window to this size, but you need to add on
|
||||
// the height of the headerbar to the Y value.
|
||||
//
|
||||
// x: new VGA x size
|
||||
// y: new VGA y size (add headerbar_y parameter from ::specific_init().
|
||||
// fheight: new VGA character height in text mode
|
||||
// fwidth : new VGA character width in text mode
|
||||
// bpp : bits per pixel in graphics mode
|
||||
|
||||
void bx_win32_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsigned fwidth, unsigned bpp)
|
||||
{
|
||||
guest_textmode = (fheight > 0);
|
||||
@ -1987,17 +1907,6 @@ void bx_win32_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight,
|
||||
}
|
||||
|
||||
|
||||
// ::CREATE_BITMAP()
|
||||
//
|
||||
// Create a monochrome bitmap of size 'xdim' by 'ydim', which will
|
||||
// be drawn in the headerbar. Return an integer ID to the bitmap,
|
||||
// with which the bitmap can be referenced later.
|
||||
//
|
||||
// bmap: packed 8 pixels-per-byte bitmap. The pixel order is:
|
||||
// bit0 is the left most pixel, bit7 is the right most pixel.
|
||||
// xdim: x dimension of bitmap
|
||||
// ydim: y dimension of bitmap
|
||||
|
||||
unsigned bx_win32_gui_c::create_bitmap(const unsigned char *bmap, unsigned xdim, unsigned ydim)
|
||||
{
|
||||
unsigned char *data;
|
||||
@ -2029,20 +1938,6 @@ unsigned bx_win32_gui_c::create_bitmap(const unsigned char *bmap, unsigned xdim,
|
||||
}
|
||||
|
||||
|
||||
// ::HEADERBAR_BITMAP()
|
||||
//
|
||||
// Called to install a bitmap in the bochs headerbar (toolbar).
|
||||
//
|
||||
// bmap_id: will correspond to an ID returned from
|
||||
// ::create_bitmap(). 'alignment' is either BX_GRAVITY_LEFT
|
||||
// or BX_GRAVITY_RIGHT, meaning install the bitmap in the next
|
||||
// available leftmost or rightmost space.
|
||||
// alignment: is either BX_GRAVITY_LEFT or BX_GRAVITY_RIGHT,
|
||||
// meaning install the bitmap in the next
|
||||
// available leftmost or rightmost space.
|
||||
// f: a 'C' function pointer to callback when the mouse is clicked in
|
||||
// the boundaries of this bitmap.
|
||||
|
||||
unsigned bx_win32_gui_c::headerbar_bitmap(unsigned bmap_id, unsigned alignment, void (*f)(void))
|
||||
{
|
||||
unsigned hb_index;
|
||||
@ -2080,11 +1975,6 @@ unsigned bx_win32_gui_c::headerbar_bitmap(unsigned bmap_id, unsigned alignment,
|
||||
}
|
||||
|
||||
|
||||
// ::SHOW_HEADERBAR()
|
||||
//
|
||||
// Show (redraw) the current headerbar, which is composed of
|
||||
// currently installed bitmaps.
|
||||
|
||||
void bx_win32_gui_c::show_headerbar(void)
|
||||
{
|
||||
if (!IsWindowVisible(hwndTB)) {
|
||||
@ -2096,19 +1986,6 @@ void bx_win32_gui_c::show_headerbar(void)
|
||||
}
|
||||
|
||||
|
||||
// ::REPLACE_BITMAP()
|
||||
//
|
||||
// Replace the bitmap installed in the headerbar ID slot 'hbar_id',
|
||||
// with the one specified by 'bmap_id'. 'bmap_id' will have
|
||||
// been generated by ::create_bitmap(). The old and new bitmap
|
||||
// must be of the same size. This allows the bitmap the user
|
||||
// sees to change, when some action occurs. For example when
|
||||
// the user presses on the floppy icon, it then displays
|
||||
// the ejected status.
|
||||
//
|
||||
// hbar_id: headerbar slot ID
|
||||
// bmap_id: bitmap ID
|
||||
|
||||
void bx_win32_gui_c::replace_bitmap(unsigned hbar_id, unsigned bmap_id)
|
||||
{
|
||||
if (bmap_id != win32_toolbar_entry[hbar_id].bmap_id) {
|
||||
@ -2127,10 +2004,6 @@ void bx_win32_gui_c::replace_bitmap(unsigned hbar_id, unsigned bmap_id)
|
||||
}
|
||||
|
||||
|
||||
// ::EXIT()
|
||||
//
|
||||
// Called before bochs terminates, to allow for a graceful
|
||||
// exit from the native GUI mechanism.
|
||||
void bx_win32_gui_c::exit(void)
|
||||
{
|
||||
#if BX_DEBUGGER && BX_DEBUGGER_GUI
|
||||
|
124
bochs/gui/wx.cc
124
bochs/gui/wx.cc
@ -955,9 +955,7 @@ DWORD WINAPI DebugGuiThread(LPVOID)
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// fill in methods of bx_gui
|
||||
//////////////////////////////////////////////////////////////
|
||||
// wxWidgets implementation of the bx_gui_c methods (see nogui.cc for details)
|
||||
|
||||
void bx_wx_gui_c::specific_init(int argc, char **argv, unsigned headerbar_y)
|
||||
{
|
||||
@ -1045,12 +1043,6 @@ void bx_wx_gui_c::specific_init(int argc, char **argv, unsigned headerbar_y)
|
||||
dialog_caps = BX_GUI_DLG_USER | BX_GUI_DLG_SNAPSHOT | BX_GUI_DLG_SAVE_RESTORE;
|
||||
}
|
||||
|
||||
// ::HANDLE_EVENTS()
|
||||
//
|
||||
// Called periodically (vga_update_interval in .bochsrc) so the
|
||||
// the gui code can poll for keyboard, mouse, and other
|
||||
// relevant events.
|
||||
|
||||
void bx_wx_gui_c::handle_events(void)
|
||||
{
|
||||
unsigned tb_button = 0;
|
||||
@ -1199,20 +1191,10 @@ void bx_wx_gui_c::statusbar_setitem_specific(int element, bx_bool active, bx_boo
|
||||
wxMutexGuiLeave();
|
||||
}
|
||||
|
||||
// ::FLUSH()
|
||||
//
|
||||
// Called periodically, requesting that the gui code flush all pending
|
||||
// screen update requests.
|
||||
|
||||
void bx_wx_gui_c::flush(void)
|
||||
{
|
||||
}
|
||||
|
||||
// ::CLEAR_SCREEN()
|
||||
//
|
||||
// Called to request that the VGA region is cleared. Don't
|
||||
// clear the area that defines the headerbar.
|
||||
|
||||
void bx_wx_gui_c::clear_screen(void)
|
||||
{
|
||||
IFDBG_VGA(wxLogDebug (wxT ("MyPanel::clear_screen trying to get lock. wxScreen=%p", wxScreen)));
|
||||
@ -1281,25 +1263,6 @@ static void DrawBochsBitmap(int x, int y, int width, int height, char *bmap, cha
|
||||
}
|
||||
|
||||
|
||||
// ::TEXT_UPDATE()
|
||||
//
|
||||
// Called in a VGA text mode, to update the screen with
|
||||
// new content.
|
||||
//
|
||||
// old_text: array of character/attributes making up the contents
|
||||
// of the screen from the last call. See below
|
||||
// new_text: array of character/attributes making up the current
|
||||
// contents, which should now be displayed. See below
|
||||
//
|
||||
// format of old_text & new_text: each is tm_info->line_offset*text_rows
|
||||
// bytes long. Each character consists of 2 bytes. The first by is
|
||||
// the character value, the second is the attribute byte.
|
||||
//
|
||||
// cursor_x: new x location of cursor
|
||||
// cursor_y: new y location of cursor
|
||||
// tm_info: this structure contains information for additional
|
||||
// features in text mode (cursor shape, line offset,...)
|
||||
|
||||
void bx_wx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
|
||||
unsigned long cursor_x, unsigned long cursor_y,
|
||||
bx_vga_tminfo_t *tm_info)
|
||||
@ -1485,13 +1448,6 @@ void bx_wx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
|
||||
thePanel->MyRefresh();
|
||||
}
|
||||
|
||||
// ::PALETTE_CHANGE()
|
||||
//
|
||||
// Allocate a color in the native GUI, for this color, and put
|
||||
// it in the colormap location 'index'.
|
||||
// returns: 0=no screen update needed (color map change has direct effect)
|
||||
// 1=screen update needed (redraw using current colormap)
|
||||
|
||||
bx_bool bx_wx_gui_c::palette_change(Bit8u index, Bit8u red, Bit8u green, Bit8u blue)
|
||||
{
|
||||
IFDBG_VGA(wxLogDebug (wxT ("palette_change")));
|
||||
@ -1502,21 +1458,6 @@ bx_bool bx_wx_gui_c::palette_change(Bit8u index, Bit8u red, Bit8u green, Bit8u b
|
||||
}
|
||||
|
||||
|
||||
// ::GRAPHICS_TILE_UPDATE()
|
||||
//
|
||||
// Called to request that a tile of graphics be drawn to the
|
||||
// screen, since info in this region has changed.
|
||||
//
|
||||
// tile: array of 8bit values representing a block of pixels with
|
||||
// dimension equal to the 'x_tilesize' & 'y_tilesize' members.
|
||||
// Each value specifies an index into the
|
||||
// array of colors you allocated for ::palette_change()
|
||||
// x0: x origin of tile
|
||||
// y0: y origin of tile
|
||||
//
|
||||
// note: origin of tile and of window based on (0,0) being in the upper
|
||||
// left of the window.
|
||||
|
||||
void bx_wx_gui_c::graphics_tile_update(Bit8u *tile, unsigned x0, unsigned y0)
|
||||
{
|
||||
IFDBG_VGA (wxLogDebug (wxT ("graphics_tile_update")));
|
||||
@ -1570,18 +1511,6 @@ void bx_wx_gui_c::graphics_tile_update_in_place(unsigned x0, unsigned y0,
|
||||
thePanel->MyRefresh();
|
||||
}
|
||||
|
||||
// ::DIMENSION_UPDATE()
|
||||
//
|
||||
// Called from the simulator when the VGA mode changes it's X,Y dimensions.
|
||||
// Resize the window to this size, but you need to add on
|
||||
// the height of the headerbar to the Y value.
|
||||
//
|
||||
// x: new VGA x size
|
||||
// y: new VGA y size
|
||||
// fheight: new VGA character height in text mode
|
||||
// fwidth : new VGA character width in text mode
|
||||
// bpp : bits per pixel in graphics mode
|
||||
|
||||
void bx_wx_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsigned fwidth, unsigned bpp)
|
||||
{
|
||||
IFDBG_VGA(wxLogDebug (wxT ("MyPanel::dimension_update trying to get lock. wxScreen=%p", wxScreen)));
|
||||
@ -1632,17 +1561,6 @@ void bx_wx_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, uns
|
||||
}
|
||||
|
||||
|
||||
// ::CREATE_BITMAP()
|
||||
//
|
||||
// Create a monochrome bitmap of size 'xdim' by 'ydim', which will
|
||||
// be drawn in the headerbar. Return an integer ID to the bitmap,
|
||||
// with which the bitmap can be referenced later.
|
||||
//
|
||||
// bmap: packed 8 pixels-per-byte bitmap. The pixel order is:
|
||||
// bit0 is the left most pixel, bit7 is the right most pixel.
|
||||
// xdim: x dimension of bitmap
|
||||
// ydim: y dimension of bitmap
|
||||
|
||||
unsigned bx_wx_gui_c::create_bitmap(const unsigned char *bmap, unsigned xdim, unsigned ydim)
|
||||
{
|
||||
UNUSED(bmap);
|
||||
@ -1652,20 +1570,6 @@ unsigned bx_wx_gui_c::create_bitmap(const unsigned char *bmap, unsigned xdim, un
|
||||
}
|
||||
|
||||
|
||||
// ::HEADERBAR_BITMAP()
|
||||
//
|
||||
// Called to install a bitmap in the bochs headerbar (toolbar).
|
||||
//
|
||||
// bmap_id: will correspond to an ID returned from
|
||||
// ::create_bitmap(). 'alignment' is either BX_GRAVITY_LEFT
|
||||
// or BX_GRAVITY_RIGHT, meaning install the bitmap in the next
|
||||
// available leftmost or rightmost space.
|
||||
// alignment: is either BX_GRAVITY_LEFT or BX_GRAVITY_RIGHT,
|
||||
// meaning install the bitmap in the next
|
||||
// available leftmost or rightmost space.
|
||||
// f: a 'C' function pointer to callback when the mouse is clicked in
|
||||
// the boundaries of this bitmap.
|
||||
|
||||
unsigned bx_wx_gui_c::headerbar_bitmap(unsigned bmap_id, unsigned alignment, void (*f)(void))
|
||||
{
|
||||
UNUSED(bmap_id);
|
||||
@ -1674,41 +1578,17 @@ unsigned bx_wx_gui_c::headerbar_bitmap(unsigned bmap_id, unsigned alignment, voi
|
||||
return(0);
|
||||
}
|
||||
|
||||
// ::SHOW_HEADERBAR()
|
||||
//
|
||||
// Show (redraw) the current headerbar, which is composed of
|
||||
// currently installed bitmaps.
|
||||
|
||||
void bx_wx_gui_c::show_headerbar(void)
|
||||
{
|
||||
}
|
||||
|
||||
// ::REPLACE_BITMAP()
|
||||
//
|
||||
// Replace the bitmap installed in the headerbar ID slot 'hbar_id',
|
||||
// with the one specified by 'bmap_id'. 'bmap_id' will have
|
||||
// been generated by ::create_bitmap(). The old and new bitmap
|
||||
// must be of the same size. This allows the bitmap the user
|
||||
// sees to change, when some action occurs. For example when
|
||||
// the user presses on the floppy icon, it then displays
|
||||
// the ejected status.
|
||||
//
|
||||
// hbar_id: headerbar slot ID
|
||||
// bmap_id: bitmap ID
|
||||
|
||||
void
|
||||
bx_wx_gui_c::replace_bitmap(unsigned hbar_id, unsigned bmap_id)
|
||||
void bx_wx_gui_c::replace_bitmap(unsigned hbar_id, unsigned bmap_id)
|
||||
{
|
||||
UNUSED(hbar_id);
|
||||
UNUSED(bmap_id);
|
||||
}
|
||||
|
||||
|
||||
// ::EXIT()
|
||||
//
|
||||
// Called before bochs terminates, to allow for a graceful
|
||||
// exit from the native GUI mechanism.
|
||||
|
||||
void bx_wx_gui_c::exit(void)
|
||||
{
|
||||
clear_screen();
|
||||
|
@ -55,7 +55,7 @@ extern "C" {
|
||||
|
||||
class bx_x_gui_c : public bx_gui_c {
|
||||
public:
|
||||
bx_x_gui_c (void);
|
||||
bx_x_gui_c(void);
|
||||
DECLARE_GUI_VIRTUAL_METHODS()
|
||||
DECLARE_GUI_NEW_VIRTUAL_METHODS()
|
||||
#if BX_USE_IDLE_HACK
|
||||
@ -133,7 +133,7 @@ static void enable_cursor();
|
||||
// keyboard
|
||||
static bx_bool x11_nokeyrepeat = 0;
|
||||
static bx_bool x11_use_kbd_mapping = 0;
|
||||
static Bit32u convertStringToXKeysym (const char *string);
|
||||
static Bit32u convertStringToXKeysym(const char *string);
|
||||
|
||||
static bx_bool x_init_done = 0;
|
||||
|
||||
@ -302,7 +302,7 @@ static void create_internal_vga_font(void);
|
||||
unsigned long col_vals[MAX_VGA_COLORS]; // 256 VGA colors
|
||||
unsigned curr_foreground, curr_background;
|
||||
|
||||
BxEvent *x11_notify_callback (void *unused, BxEvent *event);
|
||||
BxEvent *x11_notify_callback(void *unused, BxEvent *event);
|
||||
static bxevent_handler old_callback = NULL;
|
||||
static void *old_callback_arg = NULL;
|
||||
|
||||
@ -312,8 +312,8 @@ static void *old_callback_arg = NULL;
|
||||
// up the color cells so that we don't add to the problem!) This is used
|
||||
// to determine whether Bochs should use a private colormap even when the
|
||||
// user did not specify it.
|
||||
static bx_bool
|
||||
test_alloc_colors (Colormap cmap, Bit32u n_tries) {
|
||||
static bx_bool test_alloc_colors(Colormap cmap, Bit32u n_tries)
|
||||
{
|
||||
XColor color;
|
||||
unsigned long pixel[MAX_VGA_COLORS];
|
||||
bx_bool pixel_valid[MAX_VGA_COLORS];
|
||||
@ -333,15 +333,17 @@ test_alloc_colors (Colormap cmap, Bit32u n_tries) {
|
||||
n_allocated++;
|
||||
}
|
||||
}
|
||||
BX_INFO (("test_alloc_colors: %d colors available out of %d colors tried", n_allocated, n_tries));
|
||||
BX_INFO(("test_alloc_colors: %d colors available out of %d colors tried", n_allocated, n_tries));
|
||||
// now free them all
|
||||
for (i=0; i<n_tries; i++) {
|
||||
if (pixel_valid[i]) XFreeColors (bx_x_display, cmap, &pixel[i], 1, 0);
|
||||
if (pixel_valid[i]) XFreeColors(bx_x_display, cmap, &pixel[i], 1, 0);
|
||||
}
|
||||
return (n_allocated == n_tries);
|
||||
}
|
||||
|
||||
bx_x_gui_c::bx_x_gui_c () {}
|
||||
bx_x_gui_c::bx_x_gui_c() {}
|
||||
|
||||
// X11 implementation of the bx_gui_c methods (see nogui.cc for details)
|
||||
|
||||
void bx_x_gui_c::specific_init(int argc, char **argv, unsigned headerbar_y)
|
||||
{
|
||||
@ -453,8 +455,8 @@ void bx_x_gui_c::specific_init(int argc, char **argv, unsigned headerbar_y)
|
||||
// then switch to private colormap despite the user setting. There
|
||||
// are too many cases when no colors are available and Bochs simply
|
||||
// draws everything in black on black.
|
||||
if (!test_alloc_colors (default_cmap, 16)) {
|
||||
BX_ERROR (("I can't even allocate 16 colors! Switching to a private colormap"));
|
||||
if (!test_alloc_colors(default_cmap, 16)) {
|
||||
BX_ERROR(("I can't even allocate 16 colors! Switching to a private colormap"));
|
||||
x11_private_colormap = 1;
|
||||
}
|
||||
col_vals[0] = BlackPixel(bx_x_display, bx_x_screen_num);
|
||||
@ -499,7 +501,7 @@ void bx_x_gui_c::specific_init(int argc, char **argv, unsigned headerbar_y)
|
||||
white_pixel = col_vals[15];
|
||||
|
||||
BX_INFO(("font %u wide x %u high, display depth = %d",
|
||||
(unsigned) font_width, (unsigned) font_height, default_depth));
|
||||
(unsigned) font_width, (unsigned) font_height, default_depth));
|
||||
|
||||
//select_visual();
|
||||
|
||||
@ -663,9 +665,9 @@ void bx_x_gui_c::specific_init(int argc, char **argv, unsigned headerbar_y)
|
||||
XFlush(bx_x_display);
|
||||
|
||||
// redirect notify callback to X11 specific code
|
||||
SIM->get_notify_callback (&old_callback, &old_callback_arg);
|
||||
assert (old_callback != NULL);
|
||||
SIM->set_notify_callback (x11_notify_callback, NULL);
|
||||
SIM->get_notify_callback(&old_callback, &old_callback_arg);
|
||||
assert(old_callback != NULL);
|
||||
SIM->set_notify_callback(x11_notify_callback, NULL);
|
||||
|
||||
// loads keymap for x11
|
||||
x11_use_kbd_mapping = SIM->get_param_bool(BXPN_KBD_USEMAPPING)->get();
|
||||
@ -815,7 +817,7 @@ void bx_x_gui_c::handle_events(void)
|
||||
return;
|
||||
}
|
||||
|
||||
switch (report.type) {
|
||||
switch (report.type) {
|
||||
|
||||
case Expose:
|
||||
expose_event = &report.xexpose;
|
||||
@ -1235,7 +1237,7 @@ void bx_x_gui_c::xkeypress(KeySym keysym, int press_release)
|
||||
}
|
||||
else {
|
||||
/* use mapping */
|
||||
BXKeyEntry *entry = bx_keymap.findHostKey (keysym);
|
||||
BXKeyEntry *entry = bx_keymap.findHostKey(keysym);
|
||||
if (!entry) {
|
||||
BX_ERROR(("xkeypress(): keysym %x unhandled!", (unsigned) keysym));
|
||||
return;
|
||||
@ -1502,24 +1504,24 @@ void bx_x_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
|
||||
int bx_x_gui_c::get_clipboard_text(Bit8u **bytes, Bit32s *nbytes)
|
||||
{
|
||||
int len;
|
||||
Bit8u *tmp = (Bit8u *)XFetchBytes (bx_x_display, &len);
|
||||
Bit8u *tmp = (Bit8u *)XFetchBytes(bx_x_display, &len);
|
||||
// according to man XFetchBytes, tmp must be freed by XFree(). So allocate
|
||||
// a new buffer with "new". The keyboard code will free it with delete []
|
||||
// when the paste is done.
|
||||
Bit8u *buf = new Bit8u[len];
|
||||
memcpy (buf, tmp, len);
|
||||
memcpy(buf, tmp, len);
|
||||
*bytes = buf;
|
||||
*nbytes = len;
|
||||
XFree (tmp);
|
||||
XFree(tmp);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int bx_x_gui_c::set_clipboard_text(char *text_snapshot, Bit32u len)
|
||||
{
|
||||
// this writes data to the clipboard.
|
||||
BX_INFO (("storing %d bytes to X windows clipboard", len));
|
||||
BX_INFO(("storing %d bytes to X windows clipboard", len));
|
||||
XSetSelectionOwner(bx_x_display, XA_PRIMARY, None, CurrentTime);
|
||||
XStoreBytes (bx_x_display, (char *)text_snapshot, len);
|
||||
XStoreBytes(bx_x_display, (char *)text_snapshot, len);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1889,7 +1891,7 @@ void bx_x_gui_c::exit(void)
|
||||
BX_INFO(("Exit"));
|
||||
}
|
||||
|
||||
static void warp_cursor (int dx, int dy)
|
||||
static void warp_cursor(int dx, int dy)
|
||||
{
|
||||
if (mouse_captured && (warp_dx || warp_dy || dx || dy)) {
|
||||
warp_dx = dx;
|
||||
@ -1953,7 +1955,7 @@ static void enable_cursor()
|
||||
*
|
||||
* It returns a Bit32u constant or BX_KEYMAP_UNKNOWN if it fails
|
||||
*/
|
||||
static Bit32u convertStringToXKeysym (const char *string)
|
||||
static Bit32u convertStringToXKeysym(const char *string)
|
||||
{
|
||||
if (strncmp ("XK_", string, 3) != 0)
|
||||
return BX_KEYMAP_UNKNOWN;
|
||||
@ -2063,7 +2065,7 @@ void bx_x_gui_c::get_capabilities(Bit16u *xres, Bit16u *yres, Bit16u *bpp)
|
||||
}
|
||||
Window root = RootWindow(dpy, 0);
|
||||
|
||||
if (XRRQueryExtension (dpy, &event_base, &error_base)) {
|
||||
if (XRRQueryExtension(dpy, &event_base, &error_base)) {
|
||||
XRRScreenSize *xrrs = XRRSizes(dpy, 0, &num_sizes);
|
||||
XRRScreenConfiguration *conf = XRRGetScreenInfo(dpy, root);
|
||||
SizeID original_size_id = XRRConfigCurrentConfiguration(conf, &original_rotation);
|
||||
|
Loading…
x
Reference in New Issue
Block a user