Summary: | NEWT: Add support for custom [Mouse] Pointer Icons | ||
---|---|---|---|
Product: | [JogAmp] Newt | Reporter: | Sven Gothel <sgothel> |
Component: | core | Assignee: | Sven Gothel <sgothel> |
Status: | RESOLVED FIXED | ||
Severity: | enhancement | CC: | gouessej |
Priority: | --- | ||
Version: | 1 | ||
Hardware: | All | ||
OS: | all | ||
Type: | --- | SCM Refs: |
e7ffa68bce9bb707005be72530b207c732f62c31
d8b3e369cf5365d09853db20b817cda7553b9a48
6da365d9d3aa29070afa1a1c82996ec7f92a690b
09db30c4a0d9c0f29c47af76238b2abc275301c0
dd527308f9129c705d82e6421e4822ba1a48abb9
bb5c7496ed92b91dded30816a46b42ff85f37bec
3e85aa120149d882f52faf2c7fb053156313c896
e3cf96249f4c722f8b2a7d0e052e19165cef171e
fcc0e7397bb6f3ceb1fe143667f8c59b5bf63874
bec29cf970e6a55eb8f720afdae5a3bdc97c1ba2
82961bc22cd01d7d8b931c33cefe780b9498292c
58756bbd1d1fd63bb84dbfe2d6419d63de2da7ba
fe28bc125429b38cdcd016746081f4a6d521c6fd
bd98b927b910d9421e63cf0dbc2b746eec019f80
|
Workaround: | --- |
Description
Sven Gothel
2013-12-31 08:05:35 CET
e7ffa68bce9bb707005be72530b207c732f62c31 Bug 934, Bug 935: NEWT: Add support for custom Application/Window and Pointer Icons - Utilizing JOGL's PNG decoder for all icons, if available. - Application/window icons: - Providing default application/window icons in 16x16 and 32x32 size - NewtFactory.setWindowIcons(..) or property 'newt.window.icons' maybe used to override default icons. - Using icons at application/window instantiation - Display.PointerIcons: - NativeWindow Win32 WindowClass no more references a default cursor in favor of fine grained cursor control [in NEWT] - Display provides create/destroy methods, where display destruction also releases open PointerIcon references. - Window.setPointerIcon(..) sets custom PointerIcon - Implemented Platforms - X11 - Windows - OSX - Manual Test: TestGearsES2NEWT (Press 'c') d8b3e369cf5365d09853db20b817cda7553b9a48 Bug 935: NEWT: Expose Pointer Icons Feature in JOGLNewtAppletBase Tests 6da365d9d3aa29070afa1a1c82996ec7f92a690b Bug 935: NEWT PointerIcon: Add size, hotspot 'getter' and String representation PointerIcon's size and hotspot maybe be useful for certain user-app calculation. Issues w/ AWT/Parenting, e.g. NApplet's: - OSX: - PointerIcon not visible if offscreen w/ parent (nothing we can do here ..?) - Crash when trying to establish PointerIcon if onscreen w/o parent - Win32 - PointerIcon not visible if w/ parent Please can you add a method to create a pointer icon directly with a ByteBuffer (as a first parameter with hotx & hoty) into the class Display? I cannot use the current implementation with IOUtil.ClassRessources in Ardor3D, I only have a MouseCursor object when I'm in the mouse manager, I have no access to the file location of the image. Is there a way of setting a different icon for each GLWindow? commit 09db30c4a0d9c0f29c47af76238b2abc275301c0 NewtMacWindow: NSView: Remove unused 'myCursor' field +++ commit dd527308f9129c705d82e6421e4822ba1a48abb9 Bug 935: NEWT PointerIcon/Visibility: Perform JAWTWindow's OffscreenLayerSurface PointerIcon/Visibility tasks async on AWT-EDT setCursor(..) and hideCursor(..) must happen on the AWT-EDT w/o blocking, otherwise we may deadlock the NEWT-EDT. +++ commit bb5c7496ed92b91dded30816a46b42ff85f37bec Bug 935: NEWT PointerIcon OSX: Safe use of NSCursor handle +++ commit 3e85aa120149d882f52faf2c7fb053156313c896 Bug 935: NEWT PointerIcon PNGIcon: Remove return value 'elem_bytesize[]' which is always 4 (RGBA/BGRA) +++ commit e3cf96249f4c722f8b2a7d0e052e19165cef171e Bug 935: NEWT PointerIcon PNGIcon: Remove return value 'elem_bytesize[]' which is always 4 (RGBA/BGRA +++ commit fcc0e7397bb6f3ceb1fe143667f8c59b5bf63874 Bug 935: NEWT PointerIcon: Refine Spec and Implementation / Fix OSX Crash and Issues - Refine Display.PointerIcon: Complete type allowing re-creation - Add used IOUtil.ClassResources reference - Add isValid()/validate() methods for recreation - Refine API doc - Move Display.destroyPointerIcon(PointerIcon) -> PointerIcon.destroy() - Move DisplayImpl.PointerIconImpl -> PointerIconImpl (own source file) - Creation/Destruction and setting of PointerIcon happens on EDT - DisplayImpl.shutdownAll() and Display.destroy() calls destroyAllPointerIconFromList - WindowDriver.setPointerIconImpl: Validates PointerIconImpl (i.e. re-creates if required) - Fix 'initial' window.setPointerIcon(..) before createNative(..), tested w/ TestGearsES2NEWT - OSX Native Code: - Move mouse and pointer-state handling from NewtMacWindow -> NewtView class to retain states (pointer handle, pointer visibility, etc) when reparenting. Reparenting will move an exisiting NewtView into a new NewtMacWindow. - Enable all mouse move events: - NewtView::mouseEnter [nsWin makeFirstResponder: nsView]; - NewtView::mouseExited if( !mouseConfined ) { [nsView resignFirstResponder]; } - NewtView::mouseMoved issued [myCurser set] if required, fixing OSX issue not updating NSCursor properly. - MacWindow: - Test NewtMacWindow, NewtView and NSCursor handles before usage - Fix DBG_PRINT(..) warnings +++ commit bec29cf970e6a55eb8f720afdae5a3bdc97c1ba2 Bug 935: NEWT OSX PointerIcon/Pointer-Visibility: Impl. OffscreenLayerSurface (OSX CALayer) w/ JAWTWindow Path Add setCursor(..) and hideCursor() to OffscreenLayerSurface interface, impl. in JAWTWindow w/ AWT. This allows an OSX NEWT Window using CALayer (i.e. NewtCanvasAWT) to have setPointerIcon(..) and setPointerVisible(..) functionality! +++ commit 82961bc22cd01d7d8b931c33cefe780b9498292c Bug 935: NEWT Windows Pointer-Icon WM_SETCURSOR: Don't use DefWindowProc, SetCursor(..) if HTCLIENT && isChildWin && customCursor +++ commit 58756bbd1d1fd63bb84dbfe2d6419d63de2da7ba Bug 935: NEWT PointerIcon/Visibility: Perform OffscreenLayerSurface delegation _always_ in common WindowImpl ; Workaround for Windows+Applet issue. Perform OffscreenLayerSurface delegation _always_ in common WindowImpl Instead of performing OffscreenLayerSurface task on OSX's WindowDriver implementation, use generic implementation in WindowImpl for all platform exposing same behavior. ReparentAction takes care of reset/setup of PointerIcon/Visibility states. This is also a workaround for Windows+Applet issue, where the PointerIcon gets periodically overridden by the AWT Component's icon. (In reply to comment #5) > Is there a way of setting a different icon for each GLWindow? See Bug 934 Comment 4. (In reply to comment #4) > Please can you add a method to create a pointer icon directly with a > ByteBuffer (as a first parameter with hotx & hoty) into the class Display? I > cannot use the current implementation with IOUtil.ClassRessources in > Ardor3D, I only have a MouseCursor object when I'm in the mouse manager, I > have no access to the file location of the image. Yes, can do .. but we need to specify the pixelformat, i.e. - RGBA8888 - BGRA8888 Currently we require: - BGRA8888: OSX, Windows - RGBA8888: X11 We could have this pixelformat be returned by Display, so a user could adopt .. Further more, a PointerIcon instance shall have the ability to be recreated, e.g. due to destructive reparenting issues and it's Display association (OSX). A 64x64 icon would be of byte-size 64 x 64 x 4 = 16384, I thought we could safe that memory. Currently we throw this block away after creating the native pointer. A generic solution would keep this memory in PointerIcon to be reused .. probably even better. Maybe use the same convention than our competitor in order to avoid me some headaches: http://tinyurl.com/pezhxax RGBA8888? I suggest to add a method with this signature: /** * Returns the newly created {@link PointerIcon} or <code>null</code> if not implemented on platform. * <p> * See {@link PointerIcon} for lifecycle semantics. * </p> * * @param data pixels of the icon * @param bgra if <code>true</code>, the data is stored in BGRA order, otherwise it is stored in RGBA order * @param width * @param height * @param hotX pointer hotspot x-coord, origin is upper-left corner * @param hotY pointer hotspot y-coord, origin is upper-left corner * @throws IllegalStateException if this Display instance is not {@link #isNativeValid() valid yet}. * @throws MalformedURLException * @throws InterruptedException * @throws IOException * * @see PointerIcon * @see Window#setPointerIcon(PointerIcon) */ public abstract PointerIcon createPointerIcon(final ByteBuffer data, final boolean bgra, final int width, final int height, final int hotX, final int hotY) throws IllegalStateException, MalformedURLException, InterruptedException, IOException; fe28bc125429b38cdcd016746081f4a6d521c6fd Bug 935: NEWT PointerIcon: Add Toolkit Agnostic PixelFormat and Conversion Utilities (Allowing 'arbitrary' PointerIcon data input) To allowing 'arbitrary' PointerIcon data input, i.e. via raw pixels we need to define an agnostic PixelFormat and required conversion utilities. The latter is not hw accelereated (toolkit agnostic), but this shall be expected and satisfying for small amount of 'pixels'. bd98b927b910d9421e63cf0dbc2b746eec019f80 Commit fe28bc125429b38cdcd016746081f4a6d521c6fd added the notion of toolkit agnostic PixelFormat and conversion utilities, utilized and further tested by this patch. +++ - PointerIcon is a PixelRectangle and hence holds the decoded data. This allows on-the-fly conversion if required as well as recreation w/o PNG re-decoding. - Using array-backed PointerIcon data where possible, allowing better performance when converting PixelFormat etc. - NEWT Display adds 'createPointerIcon(final IOUtil.ClassResources pngResource...' method to support agnostic PointerIcon creation. - NEWT Display adds methods to allow users to avoid PixelFormat and Buffer NIO type forced conversion: - PixelFormat getNativePointerIconPixelFormat() - boolean getNativePointerIconForceDirectNIO() +++ PNGImage -> PNGPixelRect Deleted: com.jogamp.opengl.util.texture.spi.PNGImage Added: com.jogamp.opengl.util.PNGPixelRect (We hope nobody was using PNGImage directly since it was a service-plugin for TextureIO) PNGPixelRect is a PixelRectangle PNGPixelRect actually is implemented OpenGL agnostic, however - since our PNGJ support lives under package 'jogamp.opengl.util.pngj' it cannot be moved up (yet). PNGPixelRect now handles all PixelFormat for the target format and also added support for grayscale+alpha (2 channels). The latter is force-converted to RGB* - similar to paletted. Further more, PNGPixelRect allows simply passing an OutputStream to write the PNG data. Used by: TextureIO and NEWT +++ - OffscreenSurfaceLayer's setCursor(..) uses the agnostic PixelRectangle instead of a PNG resource. - AWTMisc uses the PixelRectangle to produce the AWT Cursor and converts it to the required format. Hence same pixels are used for NEWT and AWT pointer/cursor icon. - TestGearsES2Newt and NewtAWTReparentingKeyAdapter 'tests' iterate over 3 custom PointerIcon when pressed 'c'. - JOGLNewtAppletBase uses the new custom PointerIcon 'newt/data/crosshair-lumina-trans-32x32.png', which is included in NEWT (213 bytes only). - |