Yes, I know I've been through an odyssey already trying to set my own cursors, but this is not over yet! I need to find out a way to choose the colors for the cursor as well. if I do a
xsetroot -cursor_name cursor_name -fg rgb:00/A0/A0 -bg rgb:00/30/60
in an x-window, the very first cursor will load as my 'default' cursor using the colors I specified, but if that very same line is used in the .xinitrc, I will get all of the cursor file, but in black and white. The man xsetroot says that setting colors is not for '-cursor_name', so there should be another way around this... can someone help me out on this? I keep reading documents here and there trying to set the colors for the pointer. Any help will be appreciated!
Wallex
09-04-2002, 07:21 PM
Well what I've discovered so far is that you can't just use that line I mentioned before in the .xinitrc, the cursor will 'flash' in the specified colors for a while, and then they get resetted to normal. It seems the key lies in the .Xresource file, but I can't seem to find all the options for it.. and doing something like *pointerColor= this and *cursorColor=that doesn't makes it work neither... it's strange, doesn't everyone wants to change the color of their cursor? Why I can't find enough info on this on the net?
Wallex
09-04-2002, 07:33 PM
Hey... look at my next block of information that I've found. When I did a query on my X's attributes (xrdb -query) I get the full list of resources... and among them I see a very particular set:
*Scrollbar*borderWidth: 2
*Scrollbar*cursorName: top_left_arrow
*Scrollbar*foreground: grey37
*Scrollbar*height: 15
*Scrollbar*pointerColor: black
*Scrollbar*pointerColorBackground: gray
*Scrollbar*pushThumb: false
*Scrollbar*shadowWidth: 2
What IS this scrollbar about? As far as I know scrollbars should not have 'cursornames' nor 'pointer color'... now if I could just restart my x-server at will, I would try to play with these values, but I can't because I am busy converting mp3's to ogg. I feel that I am nearing the end of my quest...
Wallex
09-04-2002, 08:46 PM
I think I made it work. From what I've read in the man xset (or was it man xrdb, or xsetroot? Heck I can't remember.. I went through a lot of x manuals) I read that programs are supposed to read their configuration from the file .Xresource, and from all that, I came to the conclusion that what I needed to do was modify the .xResource file so that I would have the following lines:
*pointerColor: yellow
*pointerColorBackground: rgb:00/A0/A0
(those are the colors I chose for the cursor), also, you have to make sure there are no other definitions of pointerColor or pointerColorBackground, because (obviously) more 'precise' definitions take precedence over more global ones. To test the changes I used the command 'xrdb -all .Xresource' and well... I am not sure it'll work absolutely... but when I open xterms or aterms they show up with the cursor colors I specified. Now... if ALL programs read their config from this file, then I must definitely would have achieved my goal, and if so, then I am ready to write an NHF on cursors. The only thing still lacking would be a way to find and modify the cursors that are not specified by the cursor.pcf, but instead came as part of an external program (examples: Mozilla and import use their own cursors). Whenever I can restart my X-server I'll know if I was successful or not!
liquidfx13
09-05-2002, 01:56 AM
most interesting......i will definitely be looking forward to reading and using your cursor NHF......
Wallex
09-05-2002, 12:11 PM
Heck.. This isn't gonna be as easy as I thought. It didn't work by playing around with the values in .Xresource. I am back and again reading the man X (that should be the 'root' starting point) looking for info... currently I am looking at files in the app-defaults of X. Why this isn't any easier? Whoever made X should have thought of an easy way to configure your cursor color. I might even go as far as redefining the colors black and white in the rgb file to get this working.. but that would not be the right way (plus who knows how much it would mess up your system if all black colors and all white colors were not black and white). Is it that noone here has ever changed the color of their cursor? I feel like I am swimming on uncharted waters.
EDIT: I must add.. to anyone who might been searching on this topic, that 'cursor' is the name X gives to that box you control with the arrows in terminals. Pointer is the correct name for that bitmap you control with the mouse.
toolio
09-05-2002, 12:33 PM
Here is what I do. It works but probably isn't the best way of doing it...
in .xinitrc
right before the window manager call add this line...
(sleep 4;xsetroot -cursor_name left_ptr -bg black -fg white)&
Or whatever colors you want...
basically it just waits till the WM finishes loading before changing the colors so they don't get overwritten. Pretty neat huh? :)
*Note you might need to change the time for your system
Wallex
09-05-2002, 01:53 PM
Originally posted by toolio
...
(sleep 4;xsetroot -cursor_name left_ptr -bg black -fg white)&
...
Hmm.... I was thinking about this. After following the 'logical path' of events, it all 'works' until the windows manager gets executed. So... perhaps the windows manager is the one that does 'something' which changes the cursor color. Should I blame the windows manager then? I'll try that sleep option and see how it works... I hope it changes ALL of the cursors colors, or else it won't really be an acceptable solution. I am still considering to go and actually change the black & white definitions in the rgb.txt file.
EDIT: After reading info here and there, all sources point to the same file: Xresources. Currently I am checking the global Xresources file and the global xinitrc. Apparently it merges the global Xresources (merges it? with what, I wonder...), and then if there are local Xresources, they get merged as well. According to xrdb, merge should 'replace' definitions already there, but not take out any not specified, geez... logically speaking it should be working already as I have set it. Why it still does not works is beyond me.
Wallex
09-05-2002, 03:58 PM
I was tired of not finding a way to make it work, so I took the easy way and modified the rgb.txt file... despite the fact that black and white were no longer black and white in most applications, the pointer... was STILL black and white. What can this mean?
1. The pointer color is not black and white, instead they are 'very similar' colors. Doubtful.
2. The pointer color is defined directly as rgb:00/00/00 and rgb:ff/ff/ff. Could be.
Option two sounds more likely... but it doesn't makes sense to believe there is a configuration file out there where they use that instead of the extensive rgb.txt file. I am not sure what to think... but this leads me to believe that the cursor colors are not specified anywhere! Could this be true? It can't be... Linux is popular for giving you 'freedom of choice', but it's ridiculous you can't choose something as basic as the pointer's color! What the heck.. this can't be true, windows users will be laughing everywhere at Linux users if they find out there's something that can't be done in Linux that is 'piece of cake' in Windows.
Argh someone prove me wrong! I need to contact whoever is in charge of the X windows system and asks them directly how in the world do you change the cursor color!!!
JohnT
09-05-2002, 04:58 PM
I don't think you can specify a color for your cursors as in some RGB config. You have to look at them in a different light I believe. The color is something that is pre-defined by origin rather than manipulation. Possibly running a script to load a previously constructed (colored) cursor.pcf.gz for instance.
JohnT
09-05-2002, 05:18 PM
Here's a link to something of interest. I've downloaded and compiled, but don't have enough time to play with it now............................................... .........
Originally posted by JohnT
I don't think you can specify a color for your cursors as in some RGB config. You have to look at them in a different light I believe. The color is something that is pre-defined by origin rather than manipulation. Possibly running a script to load a previously constructed (colored) cursor.pcf.gz for instance.
You know, this is something I was actually considering.. that maybe the colors were specified in the original pcf file. I'll go take a look at that site right away!
EDIT: What am I thinking? I jump to conclusions too early... the cursor is a FONT, and fonts don't come in color! You define the color for them... Hmm... I will keep researching on this matter, though, I will not give up until I find out how to get my colored cursor.
Wallex
09-06-2002, 11:06 AM
Doesn't it sounds unbelievable that to fix the color stuff I need to get down to source? I searched in like 20 Linux forums and none gave any answer. I then decided to go ask in irc to some *ahem* experts *ahem*. I got mainly two answers... modify the x86free source, or modify the window's manager source. I think modifying the windows manager source sounds more realistic, because I noticed that if you do a xsetroot before executing the windows manager, the windows manager will inmediately override your cursor color. I am not sure how exactly this works.. but if the windows manager is the one that decides the cursor color, they should include an utility to change the cursor color! I'll go ask on the Fluxbox forums.. maybe they can include cursor configuration lines in their init (or I'll have to go modify the source directly). Say.. is this is directly related to the windows manager, how come they don't already bring tools for modifying this? I just can't believe noone has thought of that before...
EDIT: I am most definitely sure I have to change the windows manager source instead of the xfree86's because if I do an xsetroot and then launch pwm (what an UGLY windows manager) my cursor will not be changed back, it remains in the colors I specified, but only the 'left_ptr' cursor changed it's color, the rest remained black and white. In other words, if I changed my xfree86's source to get the cursors I wanted, then running the windows manager would override it and all our effort would be in vain! Heck... there's no 'global' solution to this... we just need to go tell each of our windows manager to somehow include 'cursor color' options. Really... X is rather arcane.. we need a new windowing system that will support better cursors than this (and other nice stuff like transparency).
bwkaz
09-06-2002, 12:53 PM
X does support better cursors. The window manager is just another X client, as far as X goes -- it has some special privileges, like deciding where windows get put, but nothing special that I know of regarding cursor colors or things like that. It's just that the window manager you're using happens to disregard any settings you have chosen in favor of its defaults. Which is dumb, don't get me wrong, but don't throw out X just because the window manager, one of its clients (which the XFree86 team has no control over anyway) doesn't do things in the best possible way.
X also supports transparency. There's the XShape extension, which is all-or-nothing transparency, and I believe that's what GKrellM uses (though I haven't looked). There's also alpha-channel transparency support, where you can get like 50% transparent (it's adjustable per-pixel, that is). I don't remember if it was you or someone else that got transparent aterm's going a short while ago, but it does work -- just a couple options on aterm's command line.
Wallex
09-06-2002, 10:45 PM
Um... okay, I really didn't want to bash out on X, I mean.. I am a Windows basher, I don't wanna become an X-windows basher as well, plus it would be pretty difficult to get x-windows replaced. I guess it's sad when windows managers just decide on this stuff for us.. but there's still hope, I am gonna bring this issue 'out on the light' and hopefully one of the next Fluxbox versions will being the ability to define the cursor color in one of the configuration files (I hope it's not that difficult to implement), but... why is this a subject that hasn't been brought up before? Is it that everyone is happy with their black and white cursors? Or is it just that people gave up on trying to change it? Maybe it is too difficult to implement (I doubt it)? Maybe the windows managers makers just never thought about it? So many questions... and I'll eventually get my answers. Anyway... I guess I'll just have to write down a cursor/pointer nhf without really saying how to get your own colors (using xsetroot doesn't really counts).
EDIT: I forgot to add.. yeah I know X has 'transparency', somehow it doesn't seems to be true transparency so far, but it does the trick. I use aterm and gkrellm, both with transparencies (one has tinted transparency while the other has full transparency). Well.. if it ain't broken, don't fix it.. but I heard somewhere in here that the X system was pretty arcane already... so maybe it will get replaced someday in the future.
JohnT
09-07-2002, 09:14 AM
I think the lack of cursor and font support for that matter, have more to do with the adherents of the CLI not seeking or needing a change, so it's been slow coming. This will change. 'Viva Revolucion':D
Wallex
09-07-2002, 09:39 AM
I should have known... command line users do not care about cursors...or they do and that's why the terminals read the Xresources file to set their cursor color and they are the only programs to do that. Well... when I think about it, when I use enlightenment, it does uses their own cursors... nothing flashy except for the 'waiting' cursor on startup. Probably sometime in the future there will be a new x-cursor system or something like that which will be a server in charge of controlling the mouse pointer... then we could have cursors that rivals the likes of Window's pointers. I guess it's all a matter of time...
JohnT
09-07-2002, 09:58 AM
... then we could have cursors that rivals the likes of Window's pointers. I guess it's all a matter of time...
That link I gave you to "freshmeat" above says you can use it to import windows cursors.
Wallex
09-07-2002, 11:18 AM
Originally posted by JohnT
That link I gave you to "freshmeat" above says you can use it to import windows cursors.
Hmm... Ididn't play much with that file, but from what I read in the homepage and the '-help' command, it is used to convert from .cur to .png and viceversa. Well... whether it is a cur or a png file, how exactly does that becomes a Linux pointer? I do not know. I sort of 'gave up my hopes' too easily, but I have to admit there's something fishy about a 'windows cursor conversion' utility that would not create cursors for linux and that is installed in Linux.
JohnT
09-07-2002, 03:00 PM
but I have to admit there's something fishy about a 'windows cursor conversion' utility that would not create cursors for linux and that is installed in Linux.
Open source, open mind.:D
toolio
09-08-2002, 12:08 PM
Well, I've been digging through fluxbox code, and I see the call to create the cursor. It is just hard coded to the default black-white.
The call is line 00335 on fluxbox's site (http://fluxbox.org/docs/devbox/fluxbox_8cc-source.php) if your interested.
I'll start work on a patch, unfortunately the call they use (XCreateFontCursor) doesn't accept color parameters, so I'll have to read up on my X libraries for one that will...
I'll probably configure it so the init config file will configure colors.
Wallex
09-08-2002, 02:46 PM
Originally posted by toolio
Well, I've been digging through fluxbox code, and I see the call to create the cursor. It is just hard coded to the default black-white.
The call is line 00335 on fluxbox's site (http://fluxbox.org/docs/devbox/fluxbox_8cc-source.php) if your interested.
I'll start work on a patch, unfortunately the call they use (XCreateFontCursor) doesn't accept color parameters, so I'll have to read up on my X libraries for one that will...
I'll probably configure it so the init config file will configure colors.
Awesome! I was trying to find the line of code myself, altough I was looking into the /src folder inside the fluxbox folder (before compiling it). Hmm.. the function called does not takes color parameters... I'd like seeing the documentation for that function, perhaps that function 'takes' the colors from somewhere else... you don't think that function was made so that the colors are ALWAYS black and white, do you? Anyway.. if there's another function that would accept color parameters would be even better.
I wonder if that's the default function most windows manager use? Perhaps by understanding it we could make it so all windows managers can change their cursor colors. I can't wait to see the results!
EDIT: Bummer... man XCreateFontCursor tells me about different cursor creating functions, I don't really understand all three of the them.. but the one used by flux is the only one that doesn't accepts color parameters, likewise it is also the simplest one. I wonder how is the color decided for this function? Hmm... by reading further into this, I can see another 'link' to... the function XRecolorCursor... and it says here that this function updates the cursor immediately! Hey could this be the function we need? the syntax of XRecolorCursor is:
XRecolorCursor(display, cursor, foreground_color, background_color)
Display *display;
Cursor cursor;
XColor *foreground_color, *background_color;
Sounds nice except for the cursor argument. Does this means I have to issue a call to the function for each of the different cursors type there are? That could be a lot of work.. well, just a lot of typing. Hey you don't need to change the function.. you just need to add this recoloring function... I don't really know how to test it out, but I am pretty certain this is the way to do it. Man pages aren't a bad source of information!
bwkaz
09-08-2002, 04:25 PM
You could patch Fluxbox to just read the cursor colors from a config file, then use XRecolorCursor on the value of cursor.session (which is the return value from XCreateFontCursor). This makes sense in my head, not sure if it makes sense when you read it though... ;)
I can't find a man page for a function that allows you to get the current cursor, so writing a separate program that calls XRecolorCursor unfortunately probably won't work. Although if you can find something, feel free to use it.
Wallex
09-08-2002, 05:18 PM
It does makes sense.. altough it would be SO cool to just be able to get a function to get the session cursor, that way we could get a separate file to set the cursor color no matter the windows manager people use. Hmm... wished I had time to look into this! But I have other 'work' to do... anyway, I will not leave this quest forgotten, I'll make sure someday everyone can enjoy the freedom of having their own colored cursors.
EDIT: I have been thinking about this for a while, and I think XCreateFontCursor might be used by other programs as well... I mean, look at the code in Flux, it only creates four cursors, and incidentally we are talking about the four cursors Flux uses (normal, move, and resize bottom/left & bottom/right). What can this mean? Why do the other cursors exist? I mean, you can see the rest of cursors in other applications.. this could either mean some things... maybe other programs create their own cursors at run time, or they all exist all the time, and createfontCursor just gives a pointer to them... well, I am not sure if these makes sense at all, but I could either be: a. worried that each program will create it's own cursors, thus making it a pain to track them and color them individually, or b. that all cursors exist, and using creatFontCursor will just be useful get the pointer to them and thus making it easy to change the color... it's either heaven or hell... it's scary.
REEDIT: I thought about this even more, and there's likely a way to get the cursors... because, for example, the Gimp reuses the move cursor (when you drag with the third button), so... it is using a cursor that was already created, so it probably gets the same cursor Flux uses somehow.. either that or it creates another instance of the move cursor!? Heck.. the more I think about it the more my head hurts... I think I'll stop thinking about it until I can get time to actually test stuff.
toolio
09-09-2002, 12:31 AM
okay, here's the story...
I added color (hard-coded) to the fluxbox cursor call. It works, and starts the cursors I want.
The problem is using the xsetroot command gives you the same thing.
I did notice that GDK2 capable apps keep the parent-relative cursor. GDK1 apps do not. They just give the default left_ptr cursor in black and white. So the problem will eventually solve itself with the move to GDK2.
The command is GDKCursor *cursor = null
I found this in galeon and xmms. It is supposed to just take the parent cursor, but it doesn't. oh well.
I don't know anything about qt, since i don't use those apps anyways....
Wallex
09-09-2002, 09:14 PM
The same results as xsetroot? I guess that's partially correct... xsetroot is only used to change your 'standard' pointer, the recolorpointer method was to recolor any pointers I wanted. It's a shame that not all apps will listen and use the parent's colors... I guess all this fuss is the reason why noone has really implemented 'global-wide' cursor coloring... because many apps could just rewrite (and do) at will. Bummer... oh well, on the very least I'll give it a try by setting the default cursor colors... something is better than nothing. I guess this is the problem with developing stuff 'open source'... it ends up kinda distributed and thus there's no real 'communication' among projects.
EDIT: By the way... do you people think there could be a way to 'patch' the XCreateFontCursor function so that it will not use the default black/white colors and compile/install it without having to reinstall all of X? At most it would mean the recompiling of the X's library where the function is located, right?
REEDIT: I just patched my Fluxbox to get the colors I wanted (hardcoded as well, I don't have time for anything else!), and I can see now that the root of all evil lies in X. It's x's fault for creating cursors with the default colors being black&white. I can't blame apps, since they just create a cursor, they do not try to specify a color... Hmm... I need to find the library that contains XCreateFontCursor and add more code to it (to change the boring standard colors), that would be the only way to truly change all pointer colors.. now where is that library....
camelrider
09-09-2002, 11:58 PM
Have you checked out these guys?
http://www.hut.fi/u/pusavola/decurs.html
I just stumbled across it today and remembered this thread..
:)
Wallex
09-10-2002, 09:59 AM
These guys? From what I read on their site, it's just one of them. Hmm... well, I currently only need to locate how to modify the XCreateFontCursor function and recompile the file. xlib... maybe it's part of the x86free project. Think it would be possible to just download these... Hmm... I'll go give it a try.. it can't be that difficult to install it, can it? As for decurs.. yeah I was there before, I think I'll ask the guy after I fail at attempting X86's reinstall (if I don't break down my computer afterwards, that is). Afterall.. anyone who has made a program to change cursors must have wondered about the colors of it...
bwkaz
09-10-2002, 01:18 PM
Before you attempt to recompile X (and believe me, it takes FOREVER), check out some instructions (http://hints.linuxfromscratch.org/hints/xfree86_41.txt) for a Linux From Scratch system, for how they configured it. The hint is for X 4.1, but I've been using it with 4.2 for a while. There's also a hint (http://hints.linuxfromscratch.org/hints/xterm-256color.txt) on how to get a 256-color-capable xterm, but I'd say to not do that until you've done "make World" once already.
X, unfortunately, doesn't use the fairly-standard GNU autotools to configure itself; it basically uses a C header file.
Wallex
09-10-2002, 06:13 PM
Originally posted by bwkaz
Before you attempt to recompile X ...
Sounds like I have a long trip ahead of me... there's something odd about X... I have to 'make World'? I knew X was pretty important in Linux, but I did not expect it to go that far. Well... if I never come back, or my pc gets messed up beyond repair or anything.. you'll know I have given up on this quest. Likewise... I would not recommend people trying to get their color cursors by modifying the XCreateFontCursor function.. I mean, that really is something for advanced users or idiots, and I don't think I am an advanced user... well, good bye world.
JohnT
09-10-2002, 08:52 PM
Sniff, sniff-good-bye Wallex:(
:D
justlinux.com
Copyright Internet.com Inc. All Rights Reserved.