Some work on the gui console support for the text runtime configuration.

- vncserv.cc: Fixed sdl font issue.
- Don't check for mouse toggle event if console is active.
- Added support for blinking cursor.
- Added stubs in the gui code to reduce BX_USE_TEXTCONIG usage in x.cc.
This commit is contained in:
Volker Ruppert 2017-01-02 19:11:23 +00:00
parent 5f5f40e3d6
commit c0f6caa03b
4 changed files with 32 additions and 26 deletions

View File

@ -632,6 +632,8 @@ bx_bool bx_gui_c::mouse_toggle_check(Bit32u key, bx_bool pressed)
Bit32u newstate;
bx_bool toggle = 0;
if (console_running())
return 0;
newstate = toggle_keystate;
if (pressed) {
newstate |= key;
@ -1096,9 +1098,8 @@ void bx_gui_c::console_init(void)
memset(&console.tminfo, 0, sizeof(bx_vga_tminfo_t));
console.tminfo.line_offset = 160;
console.tminfo.line_compare = 1023;
console.tminfo.cs_start = 14;
console.tminfo.cs_end = 15;
console.tminfo.blink_flags = BX_TEXT_BLINK_MODE | BX_TEXT_BLINK_STATE;
console.tminfo.cs_start = 0x2e;
console.tminfo.cs_end = 0x0f;
console.tminfo.actl_palette[7] = 0x07;
dimension_update(720, 400, 16, 9, 8);
console.n_keys = 0;
@ -1179,11 +1180,12 @@ char* bx_gui_c::bx_gets(char *s, int size)
{
char keystr[2];
int pos = 0, done = 0;
int cs_counter = 1, cs_visible = 0;
keystr[1] = 0;
do {
handle_events();
while ((console.n_keys > 0) && !done) {
while (console.n_keys > 0) {
if ((console.keys[0] >= 0x20) && (pos < (size-1))) {
s[pos++] = console.keys[0];
keystr[0] = console.keys[0];
@ -1206,7 +1208,18 @@ char* bx_gui_c::bx_gets(char *s, int size)
#else
msleep(25);
#endif
if (--cs_counter == 0) {
cs_counter = 10;
cs_visible ^= 1;
if (cs_visible) {
console.tminfo.cs_start &= ~0x20;
} else {
console.tminfo.cs_start |= 0x20;
}
console_refresh(0);
}
} while (!done);
console.tminfo.cs_start |= 0x20;
return s;
}
#endif

View File

@ -165,10 +165,15 @@ public:
#if BX_USE_TEXTCONFIG
// gui console support
bx_bool has_gui_console(void) {return console.present;}
bx_bool console_running(void) {return console.running;}
void console_refresh(bx_bool force);
void console_key_enq(Bit8u key);
int bx_printf(const char *s);
char* bx_gets(char *s, int size);
#else
bx_bool console_running(void) {return 0;}
void console_refresh(bx_bool force) {}
void console_key_enq(Bit8u key) {}
#endif
protected:
@ -195,6 +200,8 @@ protected:
// gui console support
void console_init(void);
void console_cleanup(void);
#else
void console_cleanup(void) {}
#endif
// header bar buttons

View File

@ -7,7 +7,7 @@
// Donald Becker
// http://www.psyon.org
//
// Copyright (C) 2001-2015 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
@ -52,11 +52,7 @@
#include "icon_bochs.h"
#include "font/vga.bitmap.h"
#if (BX_WITH_SDL || BX_WITH_SDL2 || BX_WITH_RFB) && !BX_PLUGINS
extern unsigned char sdl_font8x8[256][8];
#else
#include "sdl.h" // 8x8 font for status text
#endif
#define HAVE_LIBVNCSERVER

View File

@ -841,12 +841,9 @@ void bx_x_gui_c::handle_events(void)
y = 0;
}
#if BX_USE_TEXTCONFIG
if (console.running) {
if (console_running()) {
console_refresh(1);
} else
#endif
{
} else {
DEV_vga_redraw_area((unsigned) expose_event->x, y,
(unsigned) expose_event->width, height);
}
@ -1028,9 +1025,8 @@ void bx_x_gui_c::send_mouse_status(void)
BX_DEBUG(("XXX: prev=(%d,%d) curr=(%d,%d)",
prev_x, prev_y, current_x, current_y));
#if BX_USE_TEXTCONFIG
if (console.running) return;
#endif
if (console_running()) return;
if (x11_mouse_mode_absxy) {
if ((current_y >= (int)bx_headerbar_y) && (current_y < (int)(dimension_y + bx_headerbar_y))) {
dx = current_x * 0x7fff / dimension_x;
@ -1075,15 +1071,13 @@ void bx_x_gui_c::xkeypress(KeySym keysym, int press_release)
Bit32u key_event;
bx_bool mouse_toggle = 0;
#if BX_USE_TEXTCONFIG
if (console.running && !press_release) {
if (console_running() && !press_release) {
if (((keysym >= XK_space) && (keysym <= XK_asciitilde)) ||
(keysym == XK_Return) || (keysym == XK_BackSpace)) {
console_key_enq((Bit8u)(keysym & 0xff));
}
return;
}
#endif
if ((keysym == XK_Control_L) || (keysym == XK_Control_R)) {
mouse_toggle = mouse_toggle_check(BX_MT_KEY_CTRL, !press_release);
} else if (keysym == XK_Alt_L) {
@ -1899,10 +1893,8 @@ void bx_x_gui_c::headerbar_click(int x)
else
xorigin = dimension_x - bx_headerbar_entry[i].xorigin;
if ((x>=xorigin) && (x<(xorigin+int(bx_headerbar_entry[i].xdim)))) {
#if BX_USE_TEXTCONFIG
if (console.running && (i != power_hbar_id))
if (console_running() && (i != power_hbar_id))
return;
#endif
bx_headerbar_entry[i].f();
return;
}
@ -2152,11 +2144,9 @@ void bx_x_gui_c::set_display_mode(disp_mode_t newmode)
if (disp_mode == newmode) return;
// remember the display mode for next time
disp_mode = newmode;
#if BX_USE_TEXTCONFIG
if ((newmode == DISP_MODE_SIM) && console.running) {
if ((newmode == DISP_MODE_SIM) && console_running()) {
console_cleanup();
}
#endif
}
// X11 control class