gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] libvob/doc/pegboard/cursors--humppake peg.rst


From: Asko Soukka
Subject: [Gzz-commits] libvob/doc/pegboard/cursors--humppake peg.rst
Date: Mon, 12 May 2003 08:30:37 -0400

CVSROOT:        /cvsroot/libvob
Module name:    libvob
Changes by:     Asko Soukka <address@hidden>    03/05/12 08:30:37

Modified files:
        doc/pegboard/cursors--humppake: peg.rst 

Log message:
        update

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/doc/pegboard/cursors--humppake/peg.rst.diff?tr1=1.7&tr2=1.8&r1=text&r2=text

Patches:
Index: libvob/doc/pegboard/cursors--humppake/peg.rst
diff -u libvob/doc/pegboard/cursors--humppake/peg.rst:1.7 
libvob/doc/pegboard/cursors--humppake/peg.rst:1.8
--- libvob/doc/pegboard/cursors--humppake/peg.rst:1.7   Fri May  9 09:36:51 2003
+++ libvob/doc/pegboard/cursors--humppake/peg.rst       Mon May 12 08:30:36 2003
@@ -4,30 +4,25 @@
 
 :Authors:  Asko Soukka
 :Date-Created: 2003-05-09
-:Last-Modified: $Date: 2003/05/09 13:36:51 $
-:Revision: $Revision: 1.7 $
+:Last-Modified: $Date: 2003/05/12 12:30:36 $
+:Revision: $Revision: 1.8 $
 :Status:   Current
 :Scope:    Trivial
 :Type:     Feature, Interface, Implementation
 
-.. :Stakeholders:
-.. :Type:     META|Policy|Architecture|Interface|Implementation
-
-.. Affect-PEGs:
-
 This peg describes, how changing of mouse cursor to any of the default
 system cursors could be easily implemented on LibVob.
 
 Issues
 ======
 
-.. - Do we want to change mouse cursor?
+- Do we want to change mouse cursor?
 
-       RESOLVED: Yes, we do. Different effective ares on
+       RESOLVED: Yes, we do. OF course, different effective areas on
         GUI should be noticeable also without changing mouse cursor on
-        top of them, of course, mouse cursors would work as
+        top of them, but mouse different cursors would work as
         additional visual glues. Except for the effective ares, also
-        for the application state.
+        for the overall application state.
 
 - How the mouse cursor should be changed?
 
@@ -38,6 +33,67 @@
        RE-RESOLVED: Calling 
``org.nongnu.libvob.GraphicsAPI.Window.setCursor()``
        with java.awt.Cursor as parameter.
 
+       RE-RESOLVED: Calling 
``org.nongnu.libvob.GraphicsAPI.Window.setCursor()``
+       with proper cursor name string as parameter.
+
+       AWTAPI will also have setCursor() overloaded with java.awt.Cursor 
+        as parameter..
+
+- How is changing the mouse cursor implemented?
+       
+       RESOLVED: Java AWT client uses ``java.awt.Cursor``, which can
+        be passed to any ``java.awt.Component`` - like ScreenCanvas in
+        AWTScreen. GL client needs a platform specific implementation.
+        Currently we are supporting X implementation. In X Windows,
+        mouse cursor could be changed via Xlib.
+
+- How cursor name string is mapped to Xlib mouse cursor values?
+
+       RE-RESOLVED: Cursor name string is passed on in
+       ``org.nongnu.libvob.impl.gl.GLScreen`` and
+        low level implementation like using Xlib is determined later
+        on. Most probably in /src/os/Os-GLX.
+
+- How cursor name string is mapped to AWT mouse cursor values?
+
+       RE-RESOLVED: Cursor name string is converted to
+        corresponding ``java.awt.Cursor``, which is passed
+       to proper AWT component. 
+
+- What is the available set of mouse cursors?
+       
+       RESOLVED: The set of available mouse cursors is the intersection of
+        Xlib and AWT mouse cursors sets:
+
+       - http://java.sun.com/products/jdk/1.2/docs/api/java/awt/Cursor.html
+        - http://tronche.com/gui/x/xlib/appendix/b/
+
+       RE-RESOLVED: To be more specific, all Java AWT cursors except 
+        custom cursor are available.
+
+       RE-RESOLVED: A stable sub set of available cursor should be 
+        defined in Graphics API. At start, it will be the same as Java AWT
+        cursors except the custom cursor. AWT and GL cursor APIs can
+        then be extended (also separately).
+
+- Should we use our own custom cursors?
+
+       RESOLVED: Not yet. Probably we would like to use also our own
+        custom cursors in the future, but at first it is more relevant
+        to get at least changing of default system cursors work.
+
+       NOTE: In Java, Toolkit.createCustomCursor is available since
+        JDK 1.2. How custom cursor could be used efficiently in GL?
+
+       RE-RESOLVED: Since ustom cursors should be also possible 
+        outside the AWT, using custom cursor is allowed. Althought, left
+        yet unimplemented in GL.
+
+       RE-RESOLVED: General GraphicsAPI won't contain custom cursor
+        choice, but custom cursor can be added into GL and AWT APIs 
+       later on. If some cursor is implemented to them both, it can
+        be included into general GraphicsAPI.
+
 - How java.awt.Cursor is mapped to Xlib mouse cursor values?
 
        RESOLVED: Mapping is done in setCursor() method
@@ -48,6 +104,8 @@
         low level implementation like usin Xlib is determined later on.
        At first in /src/os/Os-GLX.
 
+       RE-RESOLVED: Irrelevant.
+
 - What are the mouse cursor IDs?
        
        RESOLVED: IDs are our own constants mapped to integer values that
@@ -66,17 +124,6 @@
 
        RE-RESOLVED: Irrelevant.
 
-- What is the available set of mouse cursors?
-       
-       RESOLVED: The set of available mouse cursors is the intersection of
-        Xlib and AWT mouse cursors sets:
-
-       - http://java.sun.com/products/jdk/1.2/docs/api/java/awt/Cursor.html
-        - http://tronche.com/gui/x/xlib/appendix/b/
-
-       RE-RESOLVED: To be more specific, all Java AWT cursors except 
-        custom cursor are available.
-
 - Since it's possible to call setCursor() with pure integer values, is
   it allowed to use AWT or Xlib specific cursors?
 
@@ -86,84 +133,131 @@
 
        RESOLVED: Irrelevant. Not possible anymore.
 
-- Should we use our own custom cursors?
-
-       RESOLVED: Not yet. Probably we would like to use also our own
-        custom cursors in the future, but at first it is more relevant
-        to get at least changing of default system cursors work.
-
-       NOTE: In Java, Toolkit.createCustomCursor is available since
-        JDK 1.2. How custom cursor could be used efficiently in GL?
-
-       RE-RESOLVED: Since ustom cursors should be also possible 
-        outside the AWT, using custom cursor is allowed. Althought, left
-        yet unimplemented in GL.
-
 Changes
 =======
 
-Java
-----
+Interfaces
+----------
 
 Into ``org.nongnu.libvob.GraphicsAPI.Window``::
 
     /** Set the mouse cursor for the window.
+     * Available cursor types  (case insensitive):
+     * "CROSSHAIR_CURSOR"  The crosshair cursor type.
+     * "DEFAULT_CURSOR" The default cursor type (gets set if no cursor is 
defined).
+     * "E_RESIZE_CURSOR" The east-resize cursor type.
+     * "HAND_CURSOR" The hand cursor type.
+     * "MOVE_CURSOR" The move cursor type.
+     * "N_RESIZE_CURSOR" The north-resize cursor type.
+     * "NE_RESIZE_CURSOR" The north-east-resize cursor type.
+     * "NW_RESIZE_CURSOR" The north-west-resize cursor type.
+     * "S_RESIZE_CURSOR" The south-resize cursor type.
+     * "SE_RESIZE_CURSOR" The south-east-resize cursor type.
+     * "SW_RESIZE_CURSOR" The south-west-resize cursor type.
+     * "TEXT_CURSOR" The text cursor type.
+     * "W_RESIZE_CURSOR" The west-resize cursor type.
+     * "WAIT_CURSOR" The wait cursor type.
      */
-    void setCursor(Cursor cursor);
+    public void setCursor(String shape);
 
 Into ``org.nongnu.libvob.impl.awt.AWTScreen``::
  
-    public void setCursor(cursor Cursor) {
-       canvas.setCursor(cursor);
+    /** Set the mouse cursor for the window.
+     */        
+    public void setCursor(Cursor cursor) {
+        canvas.setCursor(cursor);
     }
 
-Into ``org.nongnu.libvob.gl.GL``::
 
-    static private native void impl_Window_setCursor(int id, String shape);
+
+Implementation
+--------------
+
+Java
+""""
+
+Into ``org.nongnu.libvob.impl.awt.AWTScreen``::
+ 
+    public void setCursor(String cursorName) {
+        Cursor cursor = null;
+       if (cursorName == "CROSSHAIR_CURSOR")
+         cursor = new Cursor(Cursor.CROSSHAIR_CURSOR);
+       else if (cursorName == "DEFAULT_CURSOR")
+         cursor = new Cursor(Cursor.DEFAULT_CURSOR);
+       else if (cursorName == "E_RESIZE_CURSOR")
+         cursor = new Cursor(Cursor.E_RESIZE_CURSOR);
+       else if (cursorName == "HAND_CURSOR")
+         cursor = new Cursor(Cursor.HAND_CURSOR);
+       else if (cursorName == "MOVE_CURSOR")
+         cursor = new Cursor(Cursor.MOVE_CURSOR);
+       else if (cursorName == "N_RESIZE_CURSOR")
+         cursor = new Cursor(Cursor.N_RESIZE_CURSOR);
+       else if (cursorName == "NE_RESIZE_CURSOR")
+         cursor = new Cursor(Cursor.NE_RESIZE_CURSOR);
+       else if (cursorName == "NW_RESIZE_CURSOR")
+         cursor = new Cursor(Cursor.NW_RESIZE_CURSOR);
+       else if (cursorName == "S_RESIZE_CURSOR")
+         cursor = new Cursor(Cursor.S_RESIZE_CURSOR);
+       else if (cursorName == "SE_RESIZE_CURSOR")
+         cursor = new Cursor(Cursor.SE_RESIZE_CURSOR);
+       else if (cursorName == "SW_RESIZE_CURSOR")
+         cursor = new Cursor(Cursor.SW_RESIZE_CURSOR);
+       else if (cursorName == "TEXT_CURSOR")
+         cursor = new Cursor(Cursor.TEXT_CURSOR);
+       else if (cursorName == "W_RESIZE_CURSOR")
+         cursor = new Cursor(Cursor.W_RESIZE_CURSOR);
+       else if (cursorName == "WAIT_CURSOR")
+         cursor = new Cursor(Cursor.WAIT_CURSOR);
+       else throw new IllegalArgumentException("Unknown cursor: "+cursorName);
+       canvas.setCursor(cursor);
+    }
 
 Into ``org.nongnu.libvob.gl.GL.Window``::
 
     /** Set the mouse cursor of the window.
      */
-    public void setCursor(String shape) { impl_Window_setCursor(getId(), 
shape); }
+    public void setCursor(String cursorName) { impl_Window_setCursor(getId(), 
cursorName); }
+
+Into ``org.nongnu.libvob.gl.GL``::
+
+    static private native void impl_Window_setCursor(int id, String 
cursorName);
 
 Into ``org.nongnu.libvob.impl.GL.GLScreen``::
 
-    public void setCursor(Cursor cursor) {
-        switch (cursor.getType()) {
-       case Cursor.CROSSHAIR_CURSOR: window.setCursor("CROSSHAIR_CURSOR"); 
break;
-       case Cursor.DEFAULT_CURSOR: window.setCursor("DEFAULT_CURSOR"); break;
-       case Cursor.E_RESIZE_CURSOR: window.setCursor("E_RESIZE_CURSOR"); break;
-       case Cursor.HAND_CURSOR: window.setCursor("HAND_CURSOR"); break;
-       case Cursor.MOVE_CURSOR: window.setCursor("MOVE_CURSOR"); break;
-       case Cursor.N_RESIZE_CURSOR: window.setCursor("N_RESIZE_CURSOR"); break;
-       case Cursor.NE_RESIZE_CURSOR: window.setCursor("NE_RESIZE_CURSOR"); 
break;
-       case Cursor.NW_RESIZE_CURSOR: window.setCursor("NW_RESIZE_CURSOR"); 
break;
-       case Cursor.S_RESIZE_CURSOR: window.setCursor("S_RESIZE_CURSOR"); break;
-       case Cursor.SE_RESIZE_CURSOR: window.setCursor("SE_RESIZE_CURSOR"); 
break;
-       case Cursor.SW_RESIZE_CURSOR: window.setCursor("SW_RESIZE_CURSOR"); 
break;
-       case Cursor.TEXT_CURSOR: window.setCursor("TEXT_CURSOR"); break;
-       case Cursor.W_RESIZE_CURSOR: window.setCursor("W_RESIZE_CURSOR"); break;
-       case Cursor.WAIT_CURSOR: window.setCursor("WAIT_CURSOR"); break;
-       case Cursor.CUSTOM_CURSOR: window.setCursor("CUSTOM_CURSOR"); break;
-        };
+    public void setCursor(String cursorName) {
+      if (cursorName == "CROSSHAIR_CURSOR" ||
+         cursorName == "DEFAULT_CURSOR" ||
+         cursorName == "E_RESIZE_CURSOR" ||
+         cursorName == "HAND_CURSOR" ||
+         cursorName == "MOVE_CURSOR" ||
+         cursorName == "N_RESIZE_CURSOR" ||
+         cursorName == "NE_RESIZE_CURSOR" ||
+         cursorName == "NW_RESIZE_CURSOR" ||
+         cursorName == "S_RESIZE_CURSOR" ||
+         cursorName == "SE_RESIZE_CURSOR" ||
+         cursorName == "SW_RESIZE_CURSOR" ||
+         cursorName == "TEXT_CURSOR" ||
+         cursorName == "W_RESIZE_CURSOR" ||
+         cursorName == "WAIT_CURSOR")
+            window.setCursor(cursorName);
+      else throw new IllegalArgumentException("Unknown cursor: "+cursorName);
     }
 
 C
--
+"
 
 Into ``include/vob/os/Os.cxx Vob.Os.Window``::
 
-    virtual void setCursor(const std::string shape) = 0;
+    virtual void setCursor(const std::string cursorName) = 0;
 
 Into ``src/jni/Main.cxx``::
 
     jf(void, impl_1Window_1setCursor)
-    (JNIEnv *env, jclass, jint id, jstring shape) {
+    (JNIEnv *env, jclass, jint id, jstring cursorName) {
           Os::Window *w = (Os::Window *)windows.get(id);
-          DBG(dbg) << "Set window "<<id<<" Cursor shape "<<shape<<" at 
"<<(int)w<<"\n";
-          std::string shape_str = jstr2stdstr(env, shape);
-          w->setCursor(shape_str);
+          DBG(dbg) << "Set window "<<id<<" Cursor cursorName "<<cursorName<<" 
at "<<(int)w<<"\n";
+          std::string cCursorName_str = jstr2stdstr(env, cursorName);
+          w->setCursor(cCursorName_str);
     }
 
 Into ``src/os/Os-GLX.cxx``::
@@ -175,35 +269,35 @@
 
 Into ``src/os/Os-GLX.cxx Vob.Os.LXWindow``::
 
-    virtual void setCursor(const std::string shape) {
-    Cursor *cursor = 0;
-       if (shape == "CROSSHAIR_CURSOR")
+    virtual void setCursor(const std::string cursorName) {
+        Cursor cursor = 0;
+       if (cursorName == "CROSSHAIR_CURSOR")
          cursor = XCreateFontCursor(ws->dpy, XC_crosshair);
-       else if (shape == "DEFAULT_CURSOR")
+       else if (cursorName == "DEFAULT_CURSOR")
          cursor = XCreateFontCursor(ws->dpy, XC_left_ptr);
-       else if (shape == "E_RESIZE_CURSOR")
+       else if (cursorName == "E_RESIZE_CURSOR")
          cursor = XCreateFontCursor(ws->dpy, XC_right_side);
-       else if (shape == "HAND_CURSOR")
+       else if (cursorName == "HAND_CURSOR")
          cursor = XCreateFontCursor(ws->dpy, XC_hand2);
-       else if (shape == "MOVE_CURSOR")
+       else if (cursorName == "MOVE_CURSOR")
          cursor = XCreateFontCursor(ws->dpy, XC_fleur);
-       else if (shape == "N_RESIZE_CURSOR")
+       else if (cursorName == "N_RESIZE_CURSOR")
          cursor = XCreateFontCursor(ws->dpy, XC_top_side);
-       else if (shape == "NE_RESIZE_CURSOR")
+       else if (cursorName == "NE_RESIZE_CURSOR")
          cursor = XCreateFontCursor(ws->dpy, XC_top_right_corner);
-       else if (shape == "NW_RESIZE_CURSOR")
+       else if (cursorName == "NW_RESIZE_CURSOR")
          cursor = XCreateFontCursor(ws->dpy, XC_top_left_corner);
-       else if (shape == "S_RESIZE_CURSOR")
+       else if (cursorName == "S_RESIZE_CURSOR")
          cursor = XCreateFontCursor(ws->dpy, XC_bottom_side);
-       else if (shape == "SE_RESIZE_CURSOR")
+       else if (cursorName == "SE_RESIZE_CURSOR")
          cursor = XCreateFontCursor(ws->dpy, XC_bottom_right_corner);
-       else if (shape == "SW_RESIZE_CURSOR")
+       else if (cursorName == "SW_RESIZE_CURSOR")
          cursor = XCreateFontCursor(ws->dpy, XC_bottom_left_corner);
-       else if (shape == "TEXT_CURSOR")
+       else if (cursorName == "TEXT_CURSOR")
          cursor = XCreateFontCursor(ws->dpy, XC_xterm);
-       else if (shape == "W_RESIZE_CURSOR")
+       else if (cursorName == "W_RESIZE_CURSOR")
          cursor = XCreateFontCursor(ws->dpy, XC_left_side);
-       else if (shape == "WAIT_CURSOR")
+       else if (cursorName == "WAIT_CURSOR")
          cursor = XCreateFontCursor(ws->dpy, XC_watch);
        if (cursor != 0) XDefineCursor(ws->dpy, xw, cursor);
     } 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]