Discussion:
xterm: set mouse pointer type for ncurses
Tobias Girstmair
2017-05-21 22:01:43 UTC
Permalink
Hi, I'm new here.

I am trying to build a curses based program, and I'd like to know if
there is an option to change the mouse cursor type.

The default is the text selection cursor, but I need to use the 'normal'
pointer style, if that makes sense to any of you.

Is there a control sequence (or at least a command line parameter) for
this available?

thanks
tobias

PS: I'm sorry if i broke any rules and apologize in advance.
_______________________________________________
***@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: https://lists.x.org/mailman/listinfo/xorg
Your subscri
Thomas Dickey
2017-05-22 01:07:25 UTC
Permalink
Post by Tobias Girstmair
Hi, I'm new here.
I am trying to build a curses based program, and I'd like to know if
there is an option to change the mouse cursor type.
The default is the text selection cursor, but I need to use the
'normal' pointer style, if that makes sense to any of you.
Is there a control sequence (or at least a command line parameter)
for this available?
man curs_set

The curs_set routine sets the cursor state to invisible, normal, or
very visible for visibility equal to 0, 1, or 2 respectively. If the
terminal supports the visibility requested, the previous cursor state
is returned; otherwise, ERR is returned.
--
Thomas E. Dickey <***@invisible-island.net>
http://invisible-island.net
ftp://invisible-island.net
Ralf Mattes
2017-05-22 07:29:33 UTC
Permalink
Post by Thomas Dickey
Post by Tobias Girstmair
Hi, I'm new here.
I am trying to build a curses based program, and I'd like to know if
there is an option to change the mouse cursor type.
The default is the text selection cursor, but I need to use the
'normal' pointer style, if that makes sense to any of you.
Is there a control sequence (or at least a command line parameter)
for this available?
man curs_set
But this sets the _cursor_. The OP asked about the _mouse pointer_. IIRC ncurses
doesn't deal with the X layer, it only operates at the terminal (emulation) layer.

Cheers, Ralf Mattes
Post by Thomas Dickey
The curs_set routine sets the cursor state to invisible, normal, or
very visible for visibility equal to 0, 1, or 2 respectively. If the
terminal supports the visibility requested, the previous cursor state
is returned; otherwise, ERR is returned.
--
http://invisible-island.net
ftp://invisible-island.net
_______________________________________________
***@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: https://lists.x.org/mailman/listinfo/xorg
Your subscription ad
Thomas Dickey
2017-05-22 08:49:28 UTC
Permalink
Post by Ralf Mattes
Post by Thomas Dickey
Post by Tobias Girstmair
Hi, I'm new here.
I am trying to build a curses based program, and I'd like to know if
there is an option to change the mouse cursor type.
The default is the text selection cursor, but I need to use the
'normal' pointer style, if that makes sense to any of you.
Is there a control sequence (or at least a command line parameter)
for this available?
man curs_set
But this sets the _cursor_. The OP asked about the _mouse pointer_. IIRC ncurses
doesn't deal with the X layer, it only operates at the terminal (emulation) layer.
agreed - that interface is all that ncurses provides.

The "mouse pointer" in _xterm_ may be set via an X resource (unless it's
using the cursor-theme stuff). That's done via XDefineCursor().

pointerShape (class Cursor)
Specifies the name of the shape of the pointer. The default is
“xterm”.

Technically its color can be set using an escape sequence, but iirc the
required support in the X server has been broken for a long time (due to
some changes for acceleration).

By the way, being a "curses" question, it should have been directed to
bug-ncurses (xorg won't provide any useful insight).
--
Thomas E. Dickey <***@invisible-island.net>
http://invisible-island.net
ftp://invisible-island.net
Matthias Apitz
2017-05-22 09:14:46 UTC
Permalink
Post by Thomas Dickey
The "mouse pointer" in _xterm_ may be set via an X resource (unless it's
using the cursor-theme stuff). That's done via XDefineCursor().
pointerShape (class Cursor)
Specifies the name of the shape of the pointer. The default is
“xterm”.
Technically its color can be set using an escape sequence, but iirc the
required support in the X server has been broken for a long time (due to
some changes for acceleration).
By the way, being a "curses" question, it should have been directed to
bug-ncurses (xorg won't provide any useful insight).
There is an application to modify a xterm on the flight, 'xtermcontrol',
which supports:

$ xtermcontrol --help

Options:
--fg=COLOR set foreground color
--bg=COLOR set background color
--colorN=COLOR set N'th [0-15] color
--highlight=COLOR set highlight color
--cursor=COLOR set cursor color
--mouse-fg=COLOR set mouse pointer foreground color
--mouse-bg=COLOR set mouse pointer background color
--font=FONT set font
--title=STRING set window title
--geometry=WIDTHxHEIGHT+XOFF+YOFF set size and/or position
--get-fg report foreground color
--get-bg report background color
--get-colorN report N'th [0-15] color
--get-highlight report highlight color
--get-cursor report cursor color
--get-mouse-fg report mouse pointer foreground
color
--get-mouse-bg report mouse pointer background
color
--get-font report font
--get-title report window title
--get-geometry report size and position
--maximize maximize window
--restore restore maximized window
--iconify iconify window
--de-iconify de-iconify window
--raise raise window
--lower lower window
--reset full reset
--raw=CTLSEQS issue raw control sequence
--file=FILE alternative configuration file
--force, -f skip TERM check
--verbose, -v print verbose reports
--help, -h print this help and exit
--version print the version number and exit

I poked around a bit and it seems to work with just sending
ESC-sequences to STDOUT. One could dig into its source and check for
more details.

matthias
--
Matthias Apitz | /"\ ASCII Ribbon Campaign:
E-mail: ***@unixarea.de | \ / - No HTML/RTF in E-mail
WWW: http://www.unixarea.de/ | X - No proprietary attachments
phone: +49-176-38902045 | / \ - Respect for open standards
| en.wikipedia.org/wiki/ASCII_Ribbon_Campaign
Henrik Pauli
2017-05-22 09:43:24 UTC
Permalink
I know you said it's a bit off-topic here, but I noticed something and
thought it might be related to Tobias's question. In Konsole (and also
in mate-terminal), if I open mc (which I think is an ncurses
application), the mouse pointer changes to arrow (from the normal I-beam
thing); however it does not do so in xterm. less also uses the
alternative buffer just like mc, but does not cause the pointer to
change, so I guess it's not merely the terminal mode change that
triggers this behaviour in Konsole and mate-terminal.


Is this perhaps some feature that is missing from xterm then but exists
in Konsole/mate-terminal?
Post by Thomas Dickey
Post by Ralf Mattes
Post by Thomas Dickey
Post by Tobias Girstmair
Hi, I'm new here.
I am trying to build a curses based program, and I'd like to know if
there is an option to change the mouse cursor type.
The default is the text selection cursor, but I need to use the
'normal' pointer style, if that makes sense to any of you.
Is there a control sequence (or at least a command line parameter)
for this available?
man curs_set
But this sets the _cursor_. The OP asked about the _mouse pointer_. IIRC ncurses
doesn't deal with the X layer, it only operates at the terminal (emulation) layer.
agreed - that interface is all that ncurses provides.
The "mouse pointer" in _xterm_ may be set via an X resource (unless it's
using the cursor-theme stuff). That's done via XDefineCursor().
pointerShape (class Cursor)
Specifies the name of the shape of the pointer. The default is
“xterm”.
Technically its color can be set using an escape sequence, but iirc the
required support in the X server has been broken for a long time (due to
some changes for acceleration).
By the way, being a "curses" question, it should have been directed to
bug-ncurses (xorg won't provide any useful insight).
_______________________________________________
Archives: http://lists.freedesktop.org/archives/xorg
Info: https://lists.x.org/mailman/listinfo/xorg
Your subscription address: %(user_address)s
Marius Gedminas
2017-05-22 10:29:24 UTC
Permalink
I know you said it's a bit off-topic here, but I noticed something and thought
it might be related to Tobias's question.  In Konsole (and also in
mate-terminal), if I open mc (which I think is an ncurses application), the
mouse pointer changes to arrow (from the normal I-beam thing); however it does
not do so in xterm.  less also uses the alternative buffer just like mc, but
does not cause the pointer to change, so I guess it's not merely the terminal
mode change that triggers this behaviour in Konsole and mate-terminal.
I would guess the terminal reacts this way to the application enabling mouse
tracking:
http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking

(Just like some terminals react to the application switching to the
alternate screen by disabling the scrollbar and changing the mouse wheel
to send up/down arrow key events instead of scrolling.)
Is this perhaps some feature that is missing from xterm then but exists in
Konsole/mate-terminal?
xterm supports mouse tracking, but doesn't change the mouse cursor to
indicate this.

Marius Gedminas
--
(Why, oh! why is X not written in Lisp?)
-- Juliusz Chroboczek
Matthias Apitz
2017-05-22 10:46:47 UTC
Permalink
Check also: http://rtfm.etla.org/xterm/ctlseq.html
HIH

matthias
--
Matthias Apitz | /"\ ASCII Ribbon Campaign:
E-mail: ***@unixarea.de | \ / - No HTML/RTF in E-mail
WWW: http://www.unixarea.de/ | X - No proprietary attachments
phone: +49-176-38902045 | / \ - Respect for open standards
| en.wikipedia.org/wiki/ASCII_Ribbon_Campaign
_______________________________________________
***@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: https://lists.x.org/mailman/
Tobias Girstmair
2017-05-22 12:30:31 UTC
Permalink
First, thanks for all your replies.
Post by Marius Gedminas
I know you said it's a bit off-topic here, but I noticed something and thought
it might be related to Tobias's question.  In Konsole (and also in
mate-terminal), if I open mc (which I think is an ncurses application), the
mouse pointer changes to arrow (from the normal I-beam thing); however it does
not do so in xterm.  less also uses the alternative buffer just like mc, but
does not cause the pointer to change, so I guess it's not merely the terminal
mode change that triggers this behaviour in Konsole and mate-terminal.
This is what I wanted to say - GNOME Terminal, Konsole and others change
the cursor to an arrow, but xTerm doesn't.
Post by Marius Gedminas
I would guess the terminal reacts this way to the application enabling mouse
http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
This is the document I used to piece information together.
Post by Marius Gedminas
(Just like some terminals react to the application switching to the
alternate screen by disabling the scrollbar and changing the mouse wheel
to send up/down arrow key events instead of scrolling.)
Is this perhaps some feature that is missing from xterm then but exists in
Konsole/mate-terminal?
xterm supports mouse tracking, but doesn't change the mouse cursor to
indicate this.
Bummer - But at least I know now.
Post by Marius Gedminas
Marius Gedminas
Thanks to all of you for your help!

tobias
_______________________________________________
***@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: https://lists.x.org/mailman/listinfo/xorg
Your
Thomas Dickey
2017-05-23 01:23:58 UTC
Permalink
Post by Tobias Girstmair
First, thanks for all your replies.
I know you said it's a bit off-topic here, but I noticed something and thought
it might be related to Tobias's question.  In Konsole (and also in
mate-terminal), if I open mc (which I think is an ncurses application), the
mouse pointer changes to arrow (from the normal I-beam thing); however it does
not do so in xterm.  less also uses the alternative buffer just like mc, but
does not cause the pointer to change, so I guess it's not merely the terminal
mode change that triggers this behaviour in Konsole and mate-terminal.
This is what I wanted to say - GNOME Terminal, Konsole and others change
the cursor to an arrow, but xTerm doesn't.
VTE (the actual terminal emulator for GNOME Terminal) has done that for quite
a while, anytime the application turns on the mouse-mode. Likewise Konsole.
Which was first is hard to say...

That's unrelated to the alternate buffer.
--
Thomas E. Dickey <***@invisible-island.net>
http://invisible-island.net
ftp://invisible-island.net
Loading...