From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1TJot6-00021B-1m for mharc-grub-devel@gnu.org; Thu, 04 Oct 2012 13:07:04 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57571) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJosy-0001xd-0u for grub-devel@gnu.org; Thu, 04 Oct 2012 13:07:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TJost-0005N2-E2 for grub-devel@gnu.org; Thu, 04 Oct 2012 13:06:55 -0400 Received: from mail-lb0-f169.google.com ([209.85.217.169]:65095) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJost-0005MK-1L for grub-devel@gnu.org; Thu, 04 Oct 2012 13:06:51 -0400 Received: by mail-lb0-f169.google.com with SMTP id k6so619622lbo.0 for ; Thu, 04 Oct 2012 10:06:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:to:date:content-type:x-mailer:mime-version; bh=I72wPPObDEJLjbLauNzhyvCr1Os3vcMsRJB7FUX0JMU=; b=lGraRbxX/qZUWMGDymSYC79XGNmBW76hkDCvqdYGzB7QRYQxhUbfVUWXVGVldJHIqT YAMvTeQwU1rr+19sC2MnxsdAXeQKjyeZ2OLZnYO1NSi9V/3X4+P3lBfQ3WONE86EKqFg kFaqk3bb1p9kTaaJnBpRXM+wgq/g7zIgeJvGnM4B6XFMPNpeFNtfkyFaIAU1a21LWsQv bZ7SGqryltzuxgB4LyEah4h4l0YZvPK+GEeClx/r3jj/LfWPps2AeWhiiJUoCHEDTpKD +MEaytkNDLDkAgANYER+FerOU2Qi6mQpdFWBOZuayisDhepEIPL36ox/JWRQ27thFRJy Z6nA== Received: by 10.112.46.35 with SMTP id s3mr2949125lbm.88.1349370409732; Thu, 04 Oct 2012 10:06:49 -0700 (PDT) Received: from [192.168.10.142] (ppp83-237-5-4.pppoe.mtu-net.ru. [83.237.5.4]) by mx.google.com with ESMTPS id oj5sm2417350lab.8.2012.10.04.10.06.47 (version=SSLv3 cipher=OTHER); Thu, 04 Oct 2012 10:06:48 -0700 (PDT) Message-ID: <1349370405.2182.6.camel@opensuse.site> Subject: [PATCH] do not ignore current values for {normal,highlight}_color when loading terminal output module From: Andrey Borzenkov To: grub-devel@gnu.org Date: Thu, 04 Oct 2012 21:06:45 +0400 Content-Type: multipart/mixed; boundary="=-zdufPtBHj3FFpIqCKruA" X-Mailer: Evolution 3.4.4 Mime-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.217.169 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Oct 2012 17:07:02 -0000 --=-zdufPtBHj3FFpIqCKruA Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Currently every loaded module starts with hardcoded default colors, ignoring current value of variables normal_color and highlight_color. This provides inconsistent experience because which color is actually used for terminal window depends in which place of grub.cfg color is set. Additionally even if color is set in terminal window, terminal is closed and reopened again, color is reset to hardcoded default. The patch makes sure current values are applied on module load. Also normal_color is applied when new instance of terminal window is created. In principle this patch makes term->normal_color and term->highlight_color redundant, as there is no place where they are set individually, they always follow variables normal_color, highlight_color. -andrey --=-zdufPtBHj3FFpIqCKruA Content-Disposition: attachment; filename="grub2-dont-ignore-default-colors.patch" Content-Type: text/x-patch; name="grub2-dont-ignore-default-colors.patch"; charset="UTF-8" Content-Transfer-Encoding: 7bit === modified file 'grub-core/kern/term.c' Index: b/grub-core/kern/term.c =================================================================== --- a/grub-core/kern/term.c +++ b/grub-core/kern/term.c @@ -23,6 +23,9 @@ #include #include +grub_uint8_t grub_term_normal_color = GRUB_TERM_DEFAULT_NORMAL_COLOR; +grub_uint8_t grub_term_highlight_color = GRUB_TERM_DEFAULT_HIGHLIGHT_COLOR; + struct grub_term_output *grub_term_outputs_disabled; struct grub_term_input *grub_term_inputs_disabled; struct grub_term_output *grub_term_outputs; Index: b/grub-core/normal/color.c =================================================================== --- a/grub-core/normal/color.c +++ b/grub-core/normal/color.c @@ -106,8 +106,6 @@ free_and_return: return result; } -static grub_uint8_t color_normal, color_highlight; - static void set_colors (void) { @@ -116,7 +114,7 @@ set_colors (void) FOR_ACTIVE_TERM_OUTPUTS(term) { /* Reloads terminal `normal' and `highlight' colors. */ - grub_term_setcolor (term, color_normal, color_highlight); + grub_term_setcolor (term, grub_term_normal_color, grub_term_highlight_color); /* Propagates `normal' color to terminal current color. */ grub_term_setcolorstate (term, GRUB_TERM_COLOR_NORMAL); @@ -128,7 +126,7 @@ char * grub_env_write_color_normal (struct grub_env_var *var __attribute__ ((unused)), const char *val) { - if (grub_parse_color_name_pair (&color_normal, val)) + if (grub_parse_color_name_pair (&grub_term_normal_color, val)) return NULL; set_colors (); @@ -141,7 +139,7 @@ char * grub_env_write_color_highlight (struct grub_env_var *var __attribute__ ((unused)), const char *val) { - if (grub_parse_color_name_pair (&color_highlight, val)) + if (grub_parse_color_name_pair (&grub_term_highlight_color, val)) return NULL; set_colors (); Index: b/grub-core/normal/main.c =================================================================== --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -539,8 +539,8 @@ GRUB_MOD_INIT(normal) grub_env_export ("color_highlight"); /* Set default color names. */ - grub_env_set ("color_normal", "white/black"); - grub_env_set ("color_highlight", "black/white"); + grub_env_set ("color_normal", "light-gray/black"); + grub_env_set ("color_highlight", "black/light-gray"); for (i = 0; i < ARRAY_SIZE (features); i++) { Index: b/grub-core/term/gfxterm.c =================================================================== --- a/grub-core/term/gfxterm.c +++ b/grub-core/term/gfxterm.c @@ -253,7 +253,7 @@ grub_virtual_screen_setup (unsigned int virtual_screen.standard_color_setting = DEFAULT_STANDARD_COLOR; - virtual_screen.term_color = GRUB_TERM_DEFAULT_NORMAL_COLOR; + virtual_screen.term_color = grub_term_normal_color; set_term_color (virtual_screen.term_color); Index: b/include/grub/term.h =================================================================== --- a/include/grub/term.h +++ b/include/grub/term.h @@ -233,6 +233,9 @@ typedef struct grub_term_output *grub_te #define GRUB_TERM_DEFAULT_HIGHLIGHT_COLOR 0x70 #define GRUB_TERM_DEFAULT_STANDARD_COLOR 0x07 +extern grub_uint8_t EXPORT_VAR(grub_term_normal_color); +extern grub_uint8_t EXPORT_VAR(grub_term_highlight_color); + extern struct grub_term_output *EXPORT_VAR(grub_term_outputs_disabled); extern struct grub_term_input *EXPORT_VAR(grub_term_inputs_disabled); extern struct grub_term_output *EXPORT_VAR(grub_term_outputs); @@ -273,6 +276,9 @@ static inline void grub_term_register_output (const char *name __attribute__ ((unused)), grub_term_output_t term) { + term->normal_color = grub_term_normal_color; + term->highlight_color = grub_term_highlight_color; + if (grub_term_outputs) grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs_disabled), GRUB_AS_LIST (term)); @@ -289,6 +295,9 @@ static inline void grub_term_register_output_inactive (const char *name __attribute__ ((unused)), grub_term_output_t term) { + term->normal_color = grub_term_normal_color; + term->highlight_color = grub_term_highlight_color; + grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs_disabled), GRUB_AS_LIST (term)); } @@ -297,6 +306,9 @@ static inline void grub_term_register_output_active (const char *name __attribute__ ((unused)), grub_term_output_t term) { + term->normal_color = grub_term_normal_color; + term->highlight_color = grub_term_highlight_color; + if (! term->init || term->init (term) == GRUB_ERR_NONE) grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs), GRUB_AS_LIST (term)); --=-zdufPtBHj3FFpIqCKruA--