[GTK3] Clear sidebar in async input requests
This commit is contained in:
parent
8f9d24c1e8
commit
16c040d2d2
17
gtk3/main.c
17
gtk3/main.c
@ -59,8 +59,8 @@ static gchar *vram_viewer_active_tab = "";
|
||||
static gboolean vram_viewer_is_cgb = false;
|
||||
static uint8_t vram_viewer_palette_data[16][0x40];
|
||||
|
||||
static bool running = false;
|
||||
static bool stopping = false;
|
||||
static volatile bool running = false;
|
||||
static volatile bool stopping = false;
|
||||
|
||||
#define tileset_buffer_length 256 * 192 * 4
|
||||
static uint32_t tileset_buffer[tileset_buffer_length] = {0};
|
||||
@ -420,7 +420,16 @@ static char *sync_console_input(GB_gameboy_t *gb) {
|
||||
return input;
|
||||
}
|
||||
|
||||
static void clear_sidebar() {
|
||||
GtkTextView *sidebar_output = builder_get(GTK_TEXT_VIEW, "console_sidebar_output");
|
||||
GtkTextBuffer *sidebar_output_text_buf = gtk_text_view_get_buffer(sidebar_output);
|
||||
gtk_text_buffer_set_text(sidebar_output_text_buf, "", -1);
|
||||
}
|
||||
|
||||
static char *async_console_input(GB_gameboy_t *gb) {
|
||||
// TODO: This is rather ugly
|
||||
g_idle_add((GSourceFunc) clear_sidebar, NULL);
|
||||
|
||||
if (debugger_input_queue->len == 0) return NULL;
|
||||
|
||||
g_mutex_lock(&debugger_input_mutex);
|
||||
@ -515,9 +524,7 @@ static void append_pending_output(void) {
|
||||
g_rec_mutex_lock(&console_output_lock);
|
||||
|
||||
if (should_clear_sidebar) {
|
||||
GtkTextView *sidebar_output = builder_get(GTK_TEXT_VIEW, "console_sidebar_output");
|
||||
GtkTextBuffer *sidebar_output_text_buf = gtk_text_view_get_buffer(sidebar_output);
|
||||
gtk_text_buffer_set_text(sidebar_output_text_buf, "", -1);
|
||||
clear_sidebar();
|
||||
should_clear_sidebar = FALSE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user