All of lore.kernel.org
 help / color / mirror / Atom feed
From: Clemens Ladisch <clemens@ladisch.de>
To: Daniel Mack <daniel@caiaq.de>
Cc: Andrea Righi <righi.andrea@gmail.com>,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Greg Kroah-Hartman <gregkh@suse.de>
Subject: Re: [PATCH] fbcon: make cursor display conditional
Date: Mon, 09 Nov 2009 09:35:05 +0100	[thread overview]
Message-ID: <4AF7D439.4030305@ladisch.de> (raw)
In-Reply-To: <20091106164532.GK14091@buzzloop.caiaq.de>

Daniel Mack wrote:
> > On Fri, Nov 06, 2009 at 09:16:44AM +0100, Clemens Ladisch wrote:
> > > Wouldn't it be more useful to change the CUR_DEFAULT symbol (see the
> > > end of <linux/console_struct.h>) into a kernel parameter, instead of
> > > adding a new flag?
> 
> Ok, much better idea, I agree. See the patch below.
> 
> Subject: [PATCH] char/console: make default cursor type configurable
> 
> --- a/drivers/char/vt.c
> +++ b/drivers/char/vt.c
> +#if defined(CONFIG_CONSOLE_DEF_CUR_NONE)
> +#define CUR_DEFAULT CUR_NONE
> +
> +#elif defined(CONFIG_CONSOLE_DEF_CUR_UNDERLINE)
> +#define CUR_DEFAULT CUR_UNDERLINE
> +...

With a separate Kconfig variable, we can avoid having to put the
parallel list into vt.c.

Furthermore, we can add options for the software cursor while we're
at it; something like this:

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>

--- linux-2.6/include/linux/console_struct.h
+++ linux-2.6/include/linux/console_struct.h
@@ -130,8 +130,6 @@ extern void vc_SAK(struct work_struct *w
 #define CUR_HWMASK	0x0f
 #define CUR_SWMASK	0xfff0
 
-#define CUR_DEFAULT CUR_UNDERLINE
-
 #define CON_IS_VISIBLE(conp) (*conp->vc_display_fg == conp)
 
 #endif /* _LINUX_CONSOLE_STRUCT_H */
--- linux-2.6/drivers/char/vt.c
+++ linux-2.6/drivers/char/vt.c
@@ -138,6 +138,11 @@ const struct consw *conswitchp;
 #define DEFAULT_BELL_PITCH	750
 #define DEFAULT_BELL_DURATION	(HZ/8)
 
+#define CUR_DEFAULT (CONFIG_CUR_DEFAULT_HW | \
+		     CONFIG_CUR_DEFAULT_SW_FLAGS | \
+		     (CONFIG_CUR_DEFAULT_SW_ATTR_XOR << 8) | \
+		     (CONFIG_CUR_DEFAULT_SW_ATTR_SET << 16))
+
 struct vc vc_cons [MAX_NR_CONSOLES];
 
 #ifndef VT_SINGLE_DRIVER
--- linux-2.6/drivers/char/Kconfig
+++ linux-2.6/drivers/char/Kconfig
@@ -88,6 +88,104 @@ config VT_HW_CONSOLE_BINDING
 	 information. For framebuffer console users, please refer to
 	 <file:Documentation/fb/fbcon.txt>.
 
+choice
+	prompt "Default hardware cursor shape"
+	depends on HW_CONSOLE
+	default CUR_DEFAULT_UNDERLINE
+	help
+	  Select the default shape of the blinking hardware cursor.
+
+	config CUR_DEFAULT_DEF
+		bool "Default"
+	config CUR_DEFAULT_NONE
+		bool "None"
+	config CUR_DEFAULT_UNDERLINE
+		bool "Underline"
+	config CUR_DEFAULT_LOWER_THIRD
+		bool "Lower third"
+	config CUR_DEFAULT_LOWER_HALF
+		bool "Lower half"
+	config CUR_DEFAULT_TWO_THIRDS
+		bool "Two thirds"
+	config CUR_DEFAULT_BLOCK
+		bool "Block"
+endchoice
+
+config CUR_DEFAULT_HW
+	depends on HW_CONSOLE
+	int
+	default 0 if CUR_DEFAULT_DEF
+	default 1 if CUR_DEFAULT_NONE
+	default 2 if CUR_DEFAULT_UNDERLINE
+	default 3 if CUR_DEFAULT_LOWER_THIRD
+	default 4 if CUR_DEFAULT_LOWER_HALF
+	default 5 if CUR_DEFAULT_TWO_THIRDS
+	default 6 if CUR_DEFAULT_BLOCK
+
+config CUR_DEFAULT_SW
+	bool "Use software cursor by default"
+	depends on HW_CONSOLE
+	default n
+	help
+	  The software cursor allows you to customize the appearance of the
+	  cursor; this is done by changing the attributes (the color) of the
+	  character under the cursor.
+
+	  See <file:Documentation/VGA-softcursor.txt> for more information.
+
+config CUR_DEFAULT_SW_ATTR_XOR
+	depends on HW_CONSOLE
+	prompt "Software cursor changed attribute bits" if CUR_DEFAULT_SW
+	int
+	range 0 255
+	default 0
+	help
+	  Enter the character attribute bits that are changed by the
+	  software cursor. This is equivalent to the second parameter
+	  of the <ESC>[?1;2;3c escape sequence; for more information,
+	  see <file:Documentation/VGA-softcursor.txt>.
+
+config CUR_DEFAULT_SW_ATTR_SET
+	depends on HW_CONSOLE
+	prompt "Software cursor set attribute bits" if CUR_DEFAULT_SW
+	int
+	range 0 255
+	default 0
+	help
+	  Enter the character attribute bits that are set by the
+	  software cursor. This is equivalent to the third parameter
+	  of the <ESC>[?1;2;3c escape sequence; for more information,
+	  see <file:Documentation/VGA-softcursor.txt>.
+
+config CUR_DEFAULT_SW_CHANGE_BKGND
+	bool "Software cursor always changes background"
+	depends on CUR_DEFAULT_SW
+	default y
+	help
+	  If you say Y here, the software cursor will ensure that the
+	  background color of the character under the cursor is changed,
+	  even if the cursor color is the same as the original character's
+	  color.
+
+config CUR_DEFAULT_SW_BKGND_DIFFERENT
+	bool "Software cursor makes foreground color different from background"
+	depends on CUR_DEFAULT_SW
+	default y
+	help
+	  If you say Y here, the software cursor will ensure that the
+	  foreground color of the character under the cursor is different
+	  from the background color.
+
+config CUR_DEFAULT_SW_FLAGS
+	depends on HW_CONSOLE
+	int
+	default 0 if !CUR_DEFAULT_SW
+	# 16 + (32 if CHANGE_BKGND) + (64 if BKGND_DIFFERENT):
+	default 16 if !CUR_DEFAULT_SW_CHANGE_BKGND && !CUR_DEFAULT_SW_BKGND_DIFFERENT
+	default 48 if CUR_DEFAULT_SW_CHANGE_BKGND && !CUR_DEFAULT_SW_BKGND_DIFFERENT
+	default 80 if !CUR_DEFAULT_SW_CHANGE_BKGND && CUR_DEFAULT_SW_BKGND_DIFFERENT
+	default 112 if CUR_DEFAULT_SW_CHANGE_BKGND && CUR_DEFAULT_SW_BKGND_DIFFERENT
+
 config DEVKMEM
 	bool "/dev/kmem virtual device support"
 	default y

  reply	other threads:[~2009-11-09  8:35 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-05  9:17 [PATCH] fbcon: make cursor display conditional Daniel Mack
2009-11-06  8:16 ` Clemens Ladisch
2009-11-06 14:39   ` Andrea Righi
2009-11-06 16:45     ` Daniel Mack
2009-11-09  8:35       ` Clemens Ladisch [this message]
2009-11-09  9:10         ` Daniel Mack
2009-11-09  9:15           ` [PATCH] vt: make the default cursor shape configurable Clemens Ladisch
2009-11-09  9:53             ` Alan Cox
2009-11-09 11:26               ` Clemens Ladisch
2009-11-09 11:46                 ` Alan Cox
2009-11-09 12:21                   ` Clemens Ladisch
2009-11-09 14:50                   ` Daniel Mack
2009-11-09 17:58                     ` David Newall
2009-11-09 18:07                       ` Daniel Mack
2009-11-09 22:09                       ` Daniel Mack
2009-11-10 12:05                         ` David Newall
2009-11-10 12:30                           ` Daniel Mack
2009-11-10 12:36                             ` David Newall
2009-11-10 12:39                               ` Daniel Mack
2009-11-10 21:09                         ` Pavel Machek
2009-11-10 23:26                           ` Andrew Morton
2009-11-11  6:56                             ` Clemens Ladisch
2009-11-11  7:54                               ` Pavel Machek
2009-11-12 22:05                               ` Andrew Morton
2009-11-13  7:28                                 ` Clemens Ladisch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AF7D439.4030305@ladisch.de \
    --to=clemens@ladisch.de \
    --cc=akpm@linux-foundation.org \
    --cc=daniel@caiaq.de \
    --cc=geert@linux-m68k.org \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=righi.andrea@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.