Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4526950

Need a way to set exclusive mode on the mouse and cursor (NO_CURSOR)

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • 5.0-pool
    • 1.4.0, 1.4.1
    • client-libs
    • x86
    • windows_nt

      The following is an email from a developer:

      my current project is the development of a 3D game engine.
      For this reason I use an java.awt.window as parent for an OpenGL
      Rendering Context and switch to fullscreen using an own native
      implementation. (still using jdk 1.3.1)
      The only thing I cannot control is the visibility of the mouse
      cursor shape. I really need to hide the system cursor and since
      java doesn't provide any support for this issue I tried to replace
      the system cursor shapes for cross, arrow and wait by an empty cursor.
      This really makes the cursor invisible but when I move the cursor
      over the GLCanvas the restoring of the underground still irritates
      the animated GLCanvas. Finally I created a more complex native solution.
      I opened a native Window, and transfered the handle and device context
      to java. To have Events in Java I use a Thread that calls native
      peekMessage and when I translate and dispatch the messages for the
      native Window I also callback to the java class and fire events.
      Ok, it works but I guess it is the most hard way to go and I still
      haven't all possible events done yet. As I looked to the jdk 1.3.1
      sources I found the C++ file "awt_Component.cpp". If I would call
      ShowCursor(false) right after the createWindow(..) command I could open
      a Window without a visible cursor. Since I don't create any other
      windows, buttons or frames in my game this solution would be very fine.
      It seems that 'ShowCursor(boolean visible)' can only be called from this
      part of code and in the Windows API there is no command to hide the
      cursor for a window with a given window handle or device context.
      The problem to me is, that I use the Borland C++ Builder instead of
      MS Visual Studio. Also the MKS Toolkit is not available to me, so would
      it be possible to send the modified "awt_Component.cpp" and get the
      compiled "awt.dll" ??
      Maybe some of you nice guys at Sun have already an well prepared
      environment to easily recompile this file.
      Don't you think a method to hide the cursor would be useful especially
      for game development ?
      If you cannot help me with the compilation of the requested file
      could you please please please forward this mail to an appropriate person.
      I'd really appreciate to hear from you !!

            Unassigned Unassigned
            mmartaksunw Michael Martak (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: