diff --git a/libraries/console/console.c b/libraries/console/console.c index 43028ed5..284f8474 100644 --- a/libraries/console/console.c +++ b/libraries/console/console.c @@ -52,10 +52,10 @@ return_type console_init(console_structure_type *console_structure, tag_type *ta // Allocate and open a new console with the specified attributes. -// FIXME: If input parameters are all zero (except for mode_type), a default mode with the requested type should be set and the -// attributes of that mode should be returned. -return_type console_open(console_structure_type *console_structure, unsigned int width, unsigned int height, unsigned int depth, - int mode_type) +// FIXME: If input parameters are all zero (except for mode_type), a default mode with the requested +// type should be set and the attributes of that mode should be returned. +return_type console_open(console_structure_type *console_structure, unsigned int width, + unsigned int height, unsigned int depth, int mode_type, bool activate) { if (!console_structure->initialised) { @@ -67,6 +67,7 @@ return_type console_open(console_structure_type *console_structure, unsigned int console_attribute.height = height; console_attribute.depth = depth; console_attribute.mode_type = mode_type; + console_attribute.activate = activate; message_parameter_type message_parameter; message_parameter.protocol = IPC_PROTOCOL_CONSOLE; diff --git a/libraries/console/functions.h b/libraries/console/functions.h index 3da0f32e..74bb3792 100644 --- a/libraries/console/functions.h +++ b/libraries/console/functions.h @@ -12,22 +12,29 @@ C_EXTERN_BEGIN -extern return_type console_init(console_structure_type *console_structure, tag_type *tag, unsigned int connection_class); -extern return_type console_open(console_structure_type *console_structure, unsigned int width, unsigned int height, - unsigned int depth, int mode_type); -extern return_type console_mode_set(console_structure_type *console_structure, unsigned int width, unsigned int height, - unsigned int depth, int mode_type); +extern return_type console_init(console_structure_type *console_structure, tag_type *tag, + unsigned int connection_class); +extern return_type console_open(console_structure_type *console_structure, unsigned int width, + unsigned int height, unsigned int depth, int mode_type, bool activate); +extern return_type console_mode_set(console_structure_type *console_structure, unsigned int width, + unsigned int height, unsigned int depth, int mode_type); -extern return_type console_resize(console_structure_type *console_structure, unsigned int width, unsigned int height); +extern return_type console_resize(console_structure_type *console_structure, unsigned int width, + unsigned int height); extern return_type console_print(console_structure_type *console_structure, const char *string); -extern return_type console_print_formatted(console_structure_type *console_structure, const char *string, ...); +extern return_type console_print_formatted(console_structure_type *console_structure, + const char *string, ...); // __attribute__ ((format (printf, 1, 2))); extern return_type console_clear(console_structure_type *console_structure); -extern return_type console_cursor_move(console_structure_type *console_structure, unsigned int x, unsigned int y); -extern return_type console_attribute_set(console_structure_type *console_structure, int foreground, int background, int attributes); -extern return_type console_cursor_appearance_set(console_structure_type *console_structure, bool visibility, bool block); +extern return_type console_cursor_move(console_structure_type *console_structure, unsigned int x, + unsigned int y); +extern return_type console_attribute_set(console_structure_type *console_structure, int foreground, + int background, int attributes); +extern return_type console_cursor_appearance_set(console_structure_type *console_structure, + bool visibility, bool block); extern return_type console_use_keyboard(console_structure_type *console_structure, bool which, int type); extern return_type console_use_mouse(console_structure_type *console_structure, bool which); -extern return_type console_event_wait(console_structure_type *console_structure, void *event_data, int *type, bool block); +extern return_type console_event_wait(console_structure_type *console_structure, void *event_data, + int *type, bool block); C_EXTERN_END diff --git a/libraries/ipc/console.h b/libraries/ipc/console.h index f6e6829f..c76d9e88 100644 --- a/libraries/ipc/console.h +++ b/libraries/ipc/console.h @@ -55,4 +55,5 @@ typedef struct unsigned int height; unsigned int depth; unsigned int mode_type; + bool activate; } ipc_console_attribute_type; diff --git a/programs/cluido/init.c b/programs/cluido/init.c index ee3ba1b1..3131ecb0 100644 --- a/programs/cluido/init.c +++ b/programs/cluido/init.c @@ -24,12 +24,14 @@ int main(void) system_thread_name_set("Initialising"); // First of all, initiate a connection to the console service. - if (console_init(&console_structure, &empty_tag, IPC_CONSOLE_CONNECTION_CLASS_CLIENT) != CONSOLE_RETURN_SUCCESS) + if (console_init(&console_structure, &empty_tag, IPC_CONSOLE_CONNECTION_CLASS_CLIENT) != + CONSOLE_RETURN_SUCCESS) { return -1; } - if (console_open(&console_structure, 80, 50, 4, VIDEO_MODE_TYPE_TEXT) != CONSOLE_RETURN_SUCCESS) + if (console_open(&console_structure, 80, 50, 4, VIDEO_MODE_TYPE_TEXT, TRUE) != + CONSOLE_RETURN_SUCCESS) { return -1; } diff --git a/servers/system/console/connection.c b/servers/system/console/connection.c index 1e58c87f..29ba147a 100644 --- a/servers/system/console/connection.c +++ b/servers/system/console/connection.c @@ -136,7 +136,9 @@ static void connection_client(message_parameter_type *message_parameter, console (*our_application)->ipc_structure.input_mailbox_id = ipc_structure->input_mailbox_id; (*our_application)->ipc_structure.output_mailbox_id = ipc_structure->output_mailbox_id; - if (current_console == NULL) + // The client opening a console can set the activate flag, to enable switching to + // the newly created console. + if (console_attribute->activate && current_console == NULL) { current_console = *our_console; (*our_console)->output = screen; diff --git a/servers/system/log/log.c b/servers/system/log/log.c index 31e3e8b1..768880bf 100644 --- a/servers/system/log/log.c +++ b/servers/system/log/log.c @@ -156,7 +156,7 @@ static return_type handle_server_logging(void) return -1; } - if (console_open(&console_structure_server, 80, 50, 4, VIDEO_MODE_TYPE_TEXT) != + if (console_open(&console_structure_server, 80, 50, 4, VIDEO_MODE_TYPE_TEXT, FALSE) != CONSOLE_RETURN_SUCCESS) { return -1; @@ -207,7 +207,7 @@ static void handle_kernel_logging(void *argument UNUSED) return; } - if (console_open(&console_structure_kernel, 80, 50, 4, VIDEO_MODE_TYPE_TEXT) != + if (console_open(&console_structure_kernel, 80, 50, 4, VIDEO_MODE_TYPE_TEXT, FALSE) != CONSOLE_RETURN_SUCCESS) { return;