LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Manually setting X Cursor or Theme - doesn't work, no errors (https://www.linuxquestions.org/questions/linux-general-1/manually-setting-x-cursor-or-theme-doesnt-work-no-errors-700965/)

paulcsf 01-30-2009 02:37 AM

Manually setting X Cursor or Theme - doesn't work, no errors
 
I am developing a LFS/CLFS/BLFS system that I have gotten working all the way through X-windows and loading a browser which is the intended use. It has a touch screen, and will be used as a kiosk.

I started with CLFS 1.1.0, and then extended it with BLFS 6.3/svn.
Code:

X version 7.2.0
Kernel version 2.6.27.10
TWM

I would like to turn off, or hide, or make transparent the cursor in X. I have tried several items with no luck.

1. I created a file ~/'emptycursor', with the following contents:
Code:

#define nn1_width 16
#define nn1_height 16
static unsigned char nn1_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

and added:
Code:

xsetroot -cursor emptycursor emptycursor
to my ~/.xinitrc.

This works, but only while the cursor is over the background/desktop. When I move the cursor over a window, a context sensitive cursor comes back, the arrow pointer, the text symbol, etc.


2. I tried a transparent cursor theme from: http://matchbox-project.org/sources/utils/
This configures, compiles, and installs just fine. It installs to
Code:

/usr/local/share/icons/xcursor-transparent/
/usr/local/share/icons/xcursor-transparent/cursors/*

However, I can't get this theme to work. The directions have you create ~/.icons/default/index.theme with the following contents:
Code:

[Icon Theme]
Inherits=xcursor-transparent

The directions also mention you may have to create a link:
Code:

ln -s ~/.icons/xcursor-transparent /usr/local/share/icons/xcursor-transparent
which I did, and it still doesn't change any behavior.


3. When I installed X, I also installed xcursor-themes-1.0.1, which includes redglass and whiteglass themes. These installed to:
Code:

/usr/X11/share/icons/redglass
/usr/X11/share/icons/whiteglass
/usr/X11/share/icons/handhelds (I think this was part of xcursor-themes)

The directions state to use ~/.Xresources with the following contents:
Code:

Xcursor.theme: whiteglass
*background: blue  (not related, but for testing)

This doesn't change the behavior. I have tried "xrdb -load .Xresources" and "xrdb -merge .Xresources", with no change from either, both work with no errors.


4. I tried moving the xcursor-transparent files/directories to /usr/X11/share/icons/xcursor-transparent/*, and nothing changed. I also tried moving /usr/X11/share/icons/* to a different directory all together, still no change, and still no errors.


5. The most perplexing part is I don't get error messages anywhere that I know to look. /var/log/Xorg.0.log doesn't say anything about cursors, icons, themes, etc.


6. Here is my ~/.xinitrc
Code:

# Begin .xinitrc file
xsetroot -cursor emptycursor emptycursor
xterm  -g 80x40+0+0  &
xclock -g 100x100-0+0 &
xrdb -load ~/.Xresources &
twm


7. I don't want to clutter up this post with my .twmrc, but I will post it if necessary. It doesn't have any themes, cursors, it's very simple. It sets up two menus, set random placement, and that's about it.

So, I am hoping that somebody can point out what I am doing incorrectly, and help me get a hidden or transparent cursor.

Thank you, Paul.

paulcsf 02-05-2009 12:08 AM

Here is how I solved my cursor problems.

Get the xcursor-transparent-theme-0.1.1.gz package. Un-pack it and change into it's source directory. Run the following commands (replace user with appropriate directory):
Code:

./configure
cd cursors
make install-data-local DESTDIR=/home/user/.icons/default CURSOR_DIR=/cursors
chown -R user:user /home/user/.icons

(I don't know if the chown command is necessary)

This makes a file /home/user/.icons/default/cursors/transp which is the transparent cursor. It also creates a bunch of links to this file with the names of the X-windows cursors, arrow, base_arrow_down, base_arrow_up, based_arrow_down, based_arrow_up and about 75 more.

As best as I can tell X-windows' default location for cursors is ~/.icons/default/cursors, and without any other direction, it looks there first. This works to replace the cursors with a transparent cursor, and I haven't seen any cursors since.

[Optional]
When X first starts, the default "X" cursor shows up on the hatched background until other applications load.

I also created the emptycursor file above, and added the following to my ~/.xinitrc which hides the default "X" cursor almost right away.
Code:

xsetroot -cursor /home/user/.icons/default/cursors/emptycursor /home/user/.icons/default/cursors/emptycursor
The full path is important in xsetroot, because a partial path is attempted from where you issued the "startx" command.

Hope it helps somebody in the future.

vesperatus 01-13-2011 10:33 AM

I know the thread is old, but thank you for posting you solution to your original problem.

I tried an approach using the Xlib functions like :
XDefineCursor(display, rootWindow, cursor);

But applications like firefox seem to be redefining and this does not work.

Do you have a dynamic solution ( on / off ) without restarting the X ?


All times are GMT -5. The time now is 10:25 AM.