1553 awtUnlock(); 1554 } 1555 return timeStamp; 1556 } 1557 @Override 1558 protected void initializeDesktopProperties() { 1559 desktopProperties.put("DnD.Autoscroll.initialDelay", 1560 Integer.valueOf(50)); 1561 desktopProperties.put("DnD.Autoscroll.interval", 1562 Integer.valueOf(50)); 1563 desktopProperties.put("DnD.Autoscroll.cursorHysteresis", 1564 Integer.valueOf(5)); 1565 desktopProperties.put("Shell.shellFolderManager", 1566 "sun.awt.shell.ShellFolderManager"); 1567 // Don't want to call getMultiClickTime() if we are headless 1568 if (!GraphicsEnvironment.isHeadless()) { 1569 desktopProperties.put("awt.multiClickInterval", 1570 Integer.valueOf(getMultiClickTime())); 1571 desktopProperties.put("awt.mouse.numButtons", 1572 Integer.valueOf(getNumberOfButtons())); 1573 } 1574 } 1575 1576 /** 1577 * This method runs through the XPointer and XExtendedPointer array. 1578 * XExtendedPointer has priority because on some systems XPointer 1579 * (which is assigned to the virtual pointer) reports the maximum 1580 * capabilities of the mouse pointer (i.e. 32 physical buttons). 1581 */ 1582 private native int getNumberOfButtonsImpl(); 1583 1584 @Override 1585 public int getNumberOfButtons(){ 1586 awtLock(); 1587 try { 1588 if (numberOfButtons == 0) { 1589 numberOfButtons = getNumberOfButtonsImpl(); 1590 numberOfButtons = (numberOfButtons > MAX_BUTTONS_SUPPORTED)? MAX_BUTTONS_SUPPORTED : numberOfButtons; 1591 //4th and 5th buttons are for wheel and shouldn't be reported as buttons. 1592 //If we have more than 3 physical buttons and a wheel, we report N-2 buttons. | 1553 awtUnlock(); 1554 } 1555 return timeStamp; 1556 } 1557 @Override 1558 protected void initializeDesktopProperties() { 1559 desktopProperties.put("DnD.Autoscroll.initialDelay", 1560 Integer.valueOf(50)); 1561 desktopProperties.put("DnD.Autoscroll.interval", 1562 Integer.valueOf(50)); 1563 desktopProperties.put("DnD.Autoscroll.cursorHysteresis", 1564 Integer.valueOf(5)); 1565 desktopProperties.put("Shell.shellFolderManager", 1566 "sun.awt.shell.ShellFolderManager"); 1567 // Don't want to call getMultiClickTime() if we are headless 1568 if (!GraphicsEnvironment.isHeadless()) { 1569 desktopProperties.put("awt.multiClickInterval", 1570 Integer.valueOf(getMultiClickTime())); 1571 desktopProperties.put("awt.mouse.numButtons", 1572 Integer.valueOf(getNumberOfButtons())); 1573 if(SunGraphicsEnvironment.isUIScaleEnabled()) { 1574 addPropertyChangeListener("gnome.Xft/DPI", evt -> 1575 localEnv.displayChanged()); 1576 } 1577 } 1578 } 1579 1580 /** 1581 * This method runs through the XPointer and XExtendedPointer array. 1582 * XExtendedPointer has priority because on some systems XPointer 1583 * (which is assigned to the virtual pointer) reports the maximum 1584 * capabilities of the mouse pointer (i.e. 32 physical buttons). 1585 */ 1586 private native int getNumberOfButtonsImpl(); 1587 1588 @Override 1589 public int getNumberOfButtons(){ 1590 awtLock(); 1591 try { 1592 if (numberOfButtons == 0) { 1593 numberOfButtons = getNumberOfButtonsImpl(); 1594 numberOfButtons = (numberOfButtons > MAX_BUTTONS_SUPPORTED)? MAX_BUTTONS_SUPPORTED : numberOfButtons; 1595 //4th and 5th buttons are for wheel and shouldn't be reported as buttons. 1596 //If we have more than 3 physical buttons and a wheel, we report N-2 buttons. |