Closed Bug 38444 Opened 24 years ago Closed 23 years ago

Complete support of CSS2/3 cursors on Gtk

Categories

(Core :: CSS Parsing and Computation, defect, P3)

All
Linux
defect

Tracking

()

VERIFIED FIXED
Future

People

(Reporter: michael.j.lowe, Assigned: pavlov)

References

Details

(Keywords: css2, css3, platform-parity)

Attachments

(16 files)

6.11 KB, patch
Details | Diff | Splinter Review
3.99 KB, patch
Details | Diff | Splinter Review
6.55 KB, patch
Details | Diff | Splinter Review
1.32 KB, patch
Details | Diff | Splinter Review
12.78 KB, patch
Details | Diff | Splinter Review
1.28 KB, patch
Details | Diff | Splinter Review
12.78 KB, patch
Details | Diff | Splinter Review
10.20 KB, patch
Details | Diff | Splinter Review
14.10 KB, patch
Details | Diff | Splinter Review
9.95 KB, patch
Details | Diff | Splinter Review
9.64 KB, patch
Details | Diff | Splinter Review
9.70 KB, patch
Details | Diff | Splinter Review
3.01 KB, patch
Details | Diff | Splinter Review
13.73 KB, patch
Details | Diff | Splinter Review
13.73 KB, patch
Details | Diff | Splinter Review
557 bytes, patch
Details | Diff | Splinter Review
Implementation of CSS2 and CSS3 cursor properties needs to be completed on Gtk.
  The Windows implementation of these is mostly complete now.   

Work needs to be done in nsWidget::SetCursor(nsCursor aCursor) to support the 
following cases correctly:

      case eCursor_sizeWE:
      case eCursor_sizeNS:
      case eCursor_sizeNW:
      case eCursor_sizeSE:
      case eCursor_sizeNE:
      case eCursor_sizeSW:

      case eCursor_crosshair:
      case eCursor_move:
      case eCursor_help:

      case eCursor_copy: // CSS3
      case eCursor_alias:
      case eCursor_cell:
      case eCursor_grab:
      case eCursor_grabbing:
      case eCursor_spinning:
      case eCursor_context_menu:
      case eCursor_count_up:
      case eCursor_count_down:
      case eCursor_count_up_down:

Refer to the following URL for a test case of CSS2 cursors:

http://www.people.fas.harvard.edu/~dbaron/css/test/sec1801
Keywords: css2, css3
Keywords: pp
Blocks: 1916
i'm accepting patches.  this should be easy to do, but I'm not gonna have time
to look at it for a while.
Status: NEW → ASSIGNED
Target Milestone: --- → M30
Mass-moving all M20-M30 XPToolkit bugs to Future
Target Milestone: M30 → Future
Blocks: 40421
Available Gnome cursors are defined in:

http://lxr.mozilla.org/gnome/source/gtk+/gdk/gdkcursors.h

For example, GDK_HAND2

The Gnome cursors are created by calling XCreateFontCursor()

You can see what they all look like (with the exception of GDK_NUM_GLYPHS (154)) 
at:  (brace yourself, it's not a pretty sight)

http://www.tigr.net/afterstep/X/xlib/appendix/b/

We might be able to choose something reasonable from that list for each of our 
eCursor_xxx.  Or, maybe not.

Gnome is considering adding their own cursors, as we see in:

http://lxr.mozilla.org/gnome/source/gnome-libs/TODO.shtml#310

Because, "X's default cursors are butt ugly."

I suggest that we contact whoever wrote that at Gnome, and ask them to consider 
CSS2 / CSS3 cursors while they're adding some.

In the meantime, I suggest we pick from the available list.

Does anyone know where the standard for CSS2 / 3 cursors is?

This also needs fixing in nsWindow.cpp as described in bug 40421.
I'm working on a patch for this and bug 40421.
My patch should fix bug 40421 completely, support pre-defined CSS2 cursors, and
some of the CSS3 cursors.  I picked the closest available cursor.

For several of the CSS3 cursors, there is no appropriate cursor available from
XCreateFontCursor().

As yet unimplemented:

eCursor_copy, eCursor_alias, eCursor_count_up, eCursor_count_down,
eCursor_count_up_down.


CSS2 also supports loading custom cursors from URLs which doesn't seem to be
supported yet.

The CSS3 Cursor spec is at:

http://www.w3.org/TR/css3-userint#cursor
The CSS3 cursors are still in (early) working draft, and are subject to change. 
If they are implemented (which they really shouldn't be unless there's a real
need for them) then the status of the draft should be tracked closely.
Keywords: patch
sorry I havn't responded earlier... like weeks ago...

this patch looks fine.  I'm nominating it for nsbeta2 so that I can check it in
for you.

PDT: this patch is fine and from an outside contributor that does not have a cvs
account.  Please let me check this in for him.
Keywords: nsbeta2
[nsbeta2-] not required for seamonkey beta2, but you can check in mozilla 
community contributions as long as brendan or waterson approve.
Whiteboard: [nsbeta2-]
Attached patch patch -u styleSplinter Review
ok, i've checked in the patch.  i'm going to leave this open until we get the
rest of the css3 cursors.  I think that we should probably make some xbms for
the cursors we need/don't like.
Keywords: nsbeta2, patch
Whiteboard: [nsbeta2-]
I've downloaded the daily snapshot of the source, and the patch has been applied 
to widget/src/gtk/nsWindow.cpp

However, the patch put the comment in the wrong place in the function 
nsWindow::Setcursor.  The 3 line comment should be just above the 
switch(aCursor) statement.

There were two files patched in that diff I uploaded, and the other one did not 
get the patch applied at all.  It's identical patch applied to nsWidget.cpp in 
the same directory.

If you will, please move that comment down a few lines, and patch the other 
file.

Thanks!
Pavv, can you look at this one? On the Mac and Windows, we just added the 
resources and a couple of switch() cases... It's a 30 minutes work.
The CSS2 cursors seem to work well (tested at
http://www.people.fas.harvard.edu/~dbaron/css/test/sec1801), but in the third
case (cursor=auto in <a href="">) the cursor is a I-beam instead of a pointing
hand. (2000-08-13-20/Linux). (I haven't tested uri('*.cur').)
Netscape's standard compliance QA team reorganised itself once again, so taking 
remaining non-tables style bugs. Sorry about the spam. I tried to get this done 
directly at the database level, but apparently that is "not easy because of the 
shadow db", "plus it screws up the audit trail", so no can do...
QA Contact: chrisd → ian
The problem reported by Tobias last year about "cursor:auto" is addressed in bug 
30971.  If that was the only problem left, maybe you can close this bug now.
Okay, this patch adds GtkCreateCursor() function which creates a GdkCursor from
bitmap data + mask.
First patch is a diff for widget/src/gtk, and 2 files following are header files
to be placed in the same directory.
One contains the cursor names + structure name another has the cursor bits.

3 unimplemented cursors are countup countdown and countupdown, but I have *no*
idea what they should look like.
This patch also improves "question-arrow" look to be a bit more user friendly.

looking for reviews
How to review this bug:

1. http://bugzilla.mozilla.org/showattachment.cgi?attach_id=40674
2. http://bugzilla.mozilla.org/showattachment.cgi?attach_id=40675
3. http://bugzilla.mozilla.org/showattachment.cgi?attach_id=40732

1) is the only "code" change, the other 2 files are just cursor data and some
structs.

Looking for r/sr
Identical code (adapted for xlib) has been already reviewed at bug 88457
r=tor
Please use enum names other than:

'GTK_CURSOR_QUESTION_ARROW'

They are in the GTK name space but they are specific to Mozilla.  That will help
tell when you should be using GtkCreateCursor() instead of gdk_cursor_new().  

Also, please cache the resulting values for the cursors somewhere instead of
re-creating them every time.  It's expensive if you don't.
Two things:

Change:

+// #define DEBUG_CURSORCACHE
+

To:

+#undef DEBUG_CURSORCACHE

and remove this:

+  static GdkCursor  *GtkCursorCache[eCursor_count_up_down];

it doesn't appear to be used.  Do that and you have an sr=blizzard
to check-in

a) attachment 41792 [details] [diff] [review] - patch
b) attachment 41718 [details] [diff] [review] - new file - widget/src/gtk/nsGtkCursors.h
Sorry about the spam.

Final version of GTK cursor patch ready to check-in:

a) attachment 41792 [details] [diff] [review]
b) attachment 41856 [details] [diff] [review]

the reason I had to re-post the cursor data was because I copied wrong license
boilerplate (NPL instead of MPL)
I just checked in pocemit's fix; I think we're done. If not someone 
should provide a list of what's left.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
verified 
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: