[pkg-fso-maint] Bug#546387: Bug#546387: nodm: set the default pointer

Andres Salomon dilinger at collabora.co.uk
Thu Nov 12 04:14:44 UTC 2009


On Wed, 11 Nov 2009 00:03:21 +0000
Enrico Zini <enrico at enricozini.org> wrote:

> On Sat, Sep 12, 2009 at 06:31:10PM -0400, Andres Salomon wrote:
> > It would appear that gdm sets the default cursor to left_ptr by
> > default:
> > 
> > dilinger at mycelium:~/gdm-2.20.9$ grep -r left_ptr .
> > ./config/PreSession.in:	"$XSETROOT" -cursor_name left_ptr
> > -solid "$BACKCOLOR"
> > 
> > It would be nice if nodm did this as well.  When running on a sid
> > system with gnome + xmonad + gdm, the default cursor (that is, the
> > one that shows up when focus is on the root window) is the left_ptr
> > cursor.  When gdm is replaced with nodm (so that's gnome + xmonad +
> > gdm), the default cursor is instead the X_cursor cursor.  This
> > looks pretty ugly by comparison.
> > 
> > Calling `xsetroot -cursor_name left_ptr` does fix this, but it would
> > be nice if it happened automatically.
> > 
> > Note that window managers can then override the default cursor as
> > well (metacity does this); setting the default would just make for a
> > nice fallback for those WMs that don't set the cursor.
> 
> I went to implement this, then I asked myself: should I actually do
> it? How?
> 
> Adding system("xsetroot -cursor_name left_ptr") to the nodm code
> doesn't seem ideal to me. Better would be to add something like:
> system("sh -c /etc/nodm/PreSession").

Yeah, calling out to xsetroot seems like a waste.  It's actually pretty
simple to set the root cursor in C:


Window root_win;
Display *dpy;
Cursor cur;

/* grab the open display and default root window */
dpy = XOpenDisplay(NULL);
root_win = DefaultRootWindow(dpy);

/* set the default cursor for the root window */
cur = XCreateFontCursor(dpy, XC_left_ptr);
XDefineCursor(dpy, root_win, cur);
XFlush(dpy);
XFreeCursor(dpy, cur);

This of course assumes an already-open display.  Presumably you already
have that in nodm, so only the last 4 lines of code would be necessary.

[...]
> 
> I cannot however edit ~/.xsessionrc to provide sane defaults, and you
> have a point that not calling xsetroot causes an unexpected behavious
> of nodm compared to other display managers.
> 
> What could be done is to create a /usr/share/doc/nodm/TIPS piece of
> documentation where I list the commands that one may want to add to
> their ~/.xsessionrc in order to get a behaviour that is as standard as
> possible.
> 

That is one possibility, yes.

> Does the reasoning make sense? Would that address the issue you raised
> in this bug?
> 

It's a corner case (I've since fixed xmonad to set the default cursor,
but I'm not sure how many other window managers are out there that don't
set one).  As the maintainer, it's your call; but if it were me, I would
just go w/ that snippet of C code I described above.  Then again, I'd
also be fine if nodm just provided simple instructions for setting the
root cursor (in an obvious place like /usr/share/doc/nodm or the
manpage).

Let me know if you'd like a proper(ly tested) patch.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-fso-maint/attachments/20091111/0b06a531/attachment.pgp>


More information about the pkg-fso-maint mailing list