[<<] [<] Page 1 of 1 [>] [>>] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Mouse pointer does not change in FLTK + nxlib + nano-X
From: "Martin Kajdas" ####@####.#### Date: 23 Feb 2006 22:12:01 +0000 Message-Id: <CF2BB830A62F914F848E5AD5FFF57AC22914DA@mkmail.MKPROD.COM> Hi, I am trying to change the mouse pointer in my FLTK 1.1.7 application + nxlib-0.45 and there is no effect. Seems that I cannot change the default arrow cursor. The debug log from nano-X shows calls to: XCreateFontCursor with shape=150 XLoadFont('cursor') completing successfully (loading cursor.pcf.gz) XCreateGlyphCursor XRecolorCursor (does not do anything in nxlib) These repeat several times (except XLoadFont). Any ideas what is missing or what could I do to debug it. I remember this app working with X windows. Martin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Re: [nanogui] Mouse pointer does not change in FLTK + nxlib + nano-X
From: "Greg Haerr" ####@####.#### Date: 24 Feb 2006 02:44:03 +0000 Message-Id: <136501c638eb$5a0e8990$6401a8c0@winXP> XCreateFontCursor with shape=150 XLoadFont('cursor') completing successfully (loading cursor.pcf.gz) -- These two calls are implemented. XCreateGlyphCursor XRecolorCursor (does not do anything in nxlib) -- I'm not sure these calls ever got implemented. Regards, Greg | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
RE: [nanogui] Mouse pointer does not change in FLTK + nxlib + nano-X
From: "Martin Kajdas" ####@####.#### Date: 24 Feb 2006 16:56:15 +0000 Message-Id: <CF2BB830A62F914F848E5AD5FFF57AC22914DC@mkmail.MKPROD.COM> I added more logging to the cursor functions in nxlib and the following sequence of calls occurs: XCreateFontCursor with shape=150 XLoadFont('cursor') completing successfully (loading cursor.pcf.gz) XCreateGlyphCursor (I believe this is implemented correctly) calls nxCreateCursor() XRecolorCursor (does not do anything in nxlib) XDefineCursor XFreeCursor I believe the error is in implementation of XFreeCursor, which it is immediately called after XDefineCursor. From the log it appears that the FLTK wants the cursor displayed by XDefineCursor until next XDefineCursor is called and the call to XFreeCursor should only clear the cursor associations (?) but still leave the cursor on screen. The description of XFreeCursor() is: XFreeCursor() deletes the association between the cursor ID and the specified cursor. The cursor storage is freed when all other clients have freed it. Windows with their cursor attribute set to this cursor will have this attribute set to None (which implies CopyFromParent). The specified cursor ID should not be referred to again. The nxlib deletes the cursor right away and redraws the default one. To prove this, I commented out the code in XFreeCrusor() and the cursor is WORKING CORRECTLY now. The question is: how to fix XFreeCrusor() properly so that the cursors are eventually destroyed (GrDestroyCrusor call in XFreeCursor) Martin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
RE: [nanogui] Mouse pointer does not change in FLTK + nxlib + nano-X
From: "Martin Kajdas" ####@####.#### Date: 24 Feb 2006 17:19:12 +0000 Message-Id: <CF2BB830A62F914F848E5AD5FFF57AC22914DD@mkmail.MKPROD.COM> While on the topic, I would like to implement function XRecolorCursor. It seems simple to do. Any reasons against it? What would be the easiest way to change foreground/background color of a cursor in microwindows? Martin The description is: Synopsis: XRecolorCursor(display, cursor, foreground_color, background_color) Display *display; Cursor cursor; XColor *foreground_color, *background_color; Arguments: display Specifies a connection to an X server; returned from XOpenDisplay(). cursor: Specifies the cursor ID. foreground_color: Specifies the red, green, and blue (RGB) values for the foreground. background_color: Specifies the red, green, and blue (RGB) values for the background. Description: XRecolorCursor() applies a foreground and background color to a cursor. Cursors are normally created using a single plane pixmap, composed of 0's and 1's, with one pixel value assigned to 1's and another assigned to 0's. XRecolorCursor() changes these pixel values. If the cursor is being displayed on a screen, the change is visible immediately. On some servers, these color selections are read/write cells from the colormap, and can't be shared by applications. Structures: typedef struct { unsigned long pixel; unsigned short red, green, blue; char flags; /* DoRed, DoGreen, DoBlue */ char pad; } XColor; Errors: BadCursor | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Re: [nanogui] Mouse pointer does not change in FLTK + nxlib + nano-X
From: "Greg Haerr" ####@####.#### Date: 24 Feb 2006 17:54:08 +0000 Message-Id: <165401c6396b$4b3a6580$6401a8c0@winXP> > What would be the easiest way to change foreground/background color of a cursor in microwindows? The cursor color is specified with GrNewCursor, and stored in the cursor.fgcolor/bgcolor member. To just change cursor colors, you will need a new API call to change just the above members, unless you want to just call GrNewCursor again with the original cursor bitmap and new colors. However, this could possibly have a negative effect for windows that are using the older cursor id. Regards, Greg | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Re: [nanogui] Mouse pointer does not change in FLTK + nxlib + nano-X
From: "Greg Haerr" ####@####.#### Date: 24 Feb 2006 17:58:26 +0000 Message-Id: <165901c6396b$e7ba54b0$6401a8c0@winXP> > The question is: how to fix XFreeCrusor() properly so that the cursors are eventually destroyed (GrDestroyCrusor call in XFreeCursor) Sounds like X keeps a cursor count, and then frees when 0. We free immediately in any case. You might have to keep an NXLIB cursor count, although this could be problematic since we don't keep an internal cursor count in nano-X. The internal function GsCheckCursor looks up the window cursor for display, and if not, uses the standard cursor. I'd recommend starting with an external cursor count before changing nano-X internals, since keeping a cursor count in nano-X changes semantics for other nano-X programs. Regards, Greg | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
RE: [nanogui] Mouse pointer does not change in FLTK + nxlib + nano-X
From: "Martin Kajdas" ####@####.#### Date: 24 Feb 2006 18:35:15 +0000 Message-Id: <CF2BB830A62F914F848E5AD5FFF57AC22914DE@mkmail.MKPROD.COM> That explains the problem and it is a problem. Because this is the way the X-windows operates, the nxlib should be the one keeping the cursor count and nano-X should not be changed in any way (if possible). The question is when to call GrDestroyCursor, keeping the number of clients using this cursor and destroy it when the number falls to 0. In my case (FLTK app), every XFreeCursor call is followed by XDefineCursor at some time later when needed. I will try to save the 'cursor' value in XFreeCursor and call the GrDestroyCursor in XDefineCursor when the previous 'cursor' is marked to be deleted. This may be enough for me. Martin -----Original Message----- From: Greg Haerr ####@####.#### Sent: Friday, February 24, 2006 9:58 AM To: Martin Kajdas; ####@####.#### Subject: Re: [nanogui] Mouse pointer does not change in FLTK + nxlib + nano-X > The question is: how to fix XFreeCrusor() properly so that the cursors are eventually destroyed (GrDestroyCrusor call in XFreeCursor) Sounds like X keeps a cursor count, and then frees when 0. We free immediately in any case. You might have to keep an NXLIB cursor count, although this could be problematic since we don't keep an internal cursor count in nano-X. The internal function GsCheckCursor looks up the window cursor for display, and if not, uses the standard cursor. I'd recommend starting with an external cursor count before changing nano-X internals, since keeping a cursor count in nano-X changes semantics for other nano-X programs. Regards, Greg | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
RE: [nanogui] Mouse pointer does not change in FLTK + nxlib + nano-X
From: "Martin Kajdas" ####@####.#### Date: 24 Feb 2006 19:01:16 +0000 Message-Id: <CF2BB830A62F914F848E5AD5FFF57AC22914DF@mkmail.MKPROD.COM> These are my changes which are working for me. Obviously, it may not work for everybody, but it will not be worse then the existing nxlib code. All it does is it delays the call to GrDestroyCursor until the next call to XDefineCursor or XfreeCursor. It may be helpful for someone. It is for me. If there is a bug list for nxlib, I would like to have this problem added to it. I will not continue working on it. Martin --- CrCursor.c.org 2002-08-02 01:38:05.000000000 +0000 +++ CrCursor.c 2006-02-24 10:54:53.152718408 +0000 @@ -73,6 +73,12 @@ int XFreeCursor(Display * display, Cursor cursor) { - GrDestroyCursor(cursor); +// GrDestroyCursor(cursor); +extern Cursor freed_cursor; + + if (freed_cursor) { + GrDestroyCursor(freed_cursor); + } + freed_cursor = cursor; return 1; } --- DefCursor.c.org 2002-07-14 01:52:58.000000000 +0000 +++ DefCursor.c 2006-02-24 10:44:43.183447832 +0000 @@ -1,8 +1,15 @@ #include "nxlib.h" +Cursor freed_cursor; + int XDefineCursor(Display *dpy, Window w, Cursor cursor) { + if (freed_cursor) { + GrDestroyCursor(freed_cursor); + freed_cursor = 0; + } + // FIXME assumes Cursor is nano-X compatible GrSetWindowCursor(w, cursor); return 1; -----Original Message----- From: Martin Kajdas Sent: Friday, February 24, 2006 10:35 AM To: 'Greg Haerr'; ####@####.#### Subject: RE: [nanogui] Mouse pointer does not change in FLTK + nxlib + nano-X That explains the problem and it is a problem. Because this is the way the X-windows operates, the nxlib should be the one keeping the cursor count and nano-X should not be changed in any way (if possible). The question is when to call GrDestroyCursor, keeping the number of clients using this cursor and destroy it when the number falls to 0. In my case (FLTK app), every XFreeCursor call is followed by XDefineCursor at some time later when needed. I will try to save the 'cursor' value in XFreeCursor and call the GrDestroyCursor in XDefineCursor when the previous 'cursor' is marked to be deleted. This may be enough for me. Martin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
RE: [nanogui] Mouse pointer does not change in FLTK + nxlib + nano-X
From: "Martin Kajdas" ####@####.#### Date: 24 Feb 2006 19:10:10 +0000 Message-Id: <CF2BB830A62F914F848E5AD5FFF57AC22914E0@mkmail.MKPROD.COM> I agree that a new API call (GrRecolorCursor?) would be a best solution and then the XRecolorCursor (nxlib) would be a one line fix. This should be an easy addition for someone familiar with microwindows API development. Let's add this to ToDo list. Martin -----Original Message----- From: Greg Haerr ####@####.#### Sent: Friday, February 24, 2006 9:54 AM To: Martin Kajdas; ####@####.#### Subject: Re: [nanogui] Mouse pointer does not change in FLTK + nxlib + nano-X > What would be the easiest way to change foreground/background color of a cursor in microwindows? The cursor color is specified with GrNewCursor, and stored in the cursor.fgcolor/bgcolor member. To just change cursor colors, you will need a new API call to change just the above members, unless you want to just call GrNewCursor again with the original cursor bitmap and new colors. However, this could possibly have a negative effect for windows that are using the older cursor id. Regards, Greg | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[<<] [<] Page 1 of 1 [>] [>>] |