@@ -1482,6 +1482,13 @@ public void setCursor(PImage img, int x, int y) {
14821482 // Don't set cursorType, instead use cursorType to save the last
14831483 // regular cursor type used for when cursor() is called.
14841484 //cursor_type = Cursor.CUSTOM_CURSOR;
1485+
1486+ // this is a temporary workaround for the CHIP, will be removed
1487+ Dimension cursorSize = Toolkit .getDefaultToolkit ().getBestCursorSize (img .width , img .height );
1488+ if (cursorSize .width == 0 || cursorSize .height == 0 ) {
1489+ return ;
1490+ }
1491+
14851492 Cursor cursor =
14861493 canvas .getToolkit ().createCustomCursor ((Image ) img .getNative (),
14871494 new Point (x , y ),
@@ -1511,8 +1518,14 @@ public void hideCursor() {
15111518 if (invisibleCursor == null ) {
15121519 BufferedImage cursorImg =
15131520 new BufferedImage (16 , 16 , BufferedImage .TYPE_INT_ARGB );
1514- invisibleCursor =
1515- canvas .getToolkit ().createCustomCursor (cursorImg , new Point (8 , 8 ), "blank" );
1521+ // this is a temporary workaround for the CHIP, will be removed
1522+ Dimension cursorSize = Toolkit .getDefaultToolkit ().getBestCursorSize (16 , 16 );
1523+ if (cursorSize .width == 0 || cursorSize .height == 0 ) {
1524+ invisibleCursor = Cursor .getDefaultCursor ();
1525+ } else {
1526+ invisibleCursor =
1527+ canvas .getToolkit ().createCustomCursor (cursorImg , new Point (8 , 8 ), "blank" );
1528+ }
15161529 }
15171530 canvas .setCursor (invisibleCursor );
15181531 cursorVisible = false ;
0 commit comments