|
142 | 142 | import sun.awt.X11GraphicsEnvironment; |
143 | 143 | import sun.awt.XSettings; |
144 | 144 | import sun.awt.datatransfer.DataTransferer; |
145 | | -import sun.awt.screencast.ScreencastHelper; |
146 | | -import sun.awt.screencast.XdgDesktopPortal; |
147 | 145 | import sun.awt.util.PerformanceLogger; |
148 | 146 | import sun.awt.util.ThreadGroupUtils; |
149 | 147 | import sun.font.FontConfigManager; |
@@ -1574,21 +1572,16 @@ public int getNumberOfButtons(){ |
1574 | 1572 | awtLock(); |
1575 | 1573 | try { |
1576 | 1574 | if (numberOfButtons == 0) { |
1577 | | - if (XdgDesktopPortal.isRemoteDesktop() |
1578 | | - && ScreencastHelper.isAvailable()) { |
| 1575 | + numberOfButtons = getNumberOfButtonsImpl(); |
| 1576 | + numberOfButtons = (numberOfButtons > MAX_BUTTONS_SUPPORTED) ? MAX_BUTTONS_SUPPORTED : numberOfButtons; |
| 1577 | + //4th and 5th buttons are for wheel and shouldn't be reported as buttons. |
| 1578 | + //If we have more than 3 physical buttons and a wheel, we report N-2 buttons. |
| 1579 | + //If we have 3 physical buttons and a wheel, we report 3 buttons. |
| 1580 | + //If we have 1,2,3 physical buttons, we report it as is i.e. 1,2 or 3 respectively. |
| 1581 | + if (numberOfButtons >= 5) { |
| 1582 | + numberOfButtons -= 2; |
| 1583 | + } else if (numberOfButtons == 4 || numberOfButtons == 5) { |
1579 | 1584 | numberOfButtons = 3; |
1580 | | - } else { |
1581 | | - numberOfButtons = getNumberOfButtonsImpl(); |
1582 | | - numberOfButtons = (numberOfButtons > MAX_BUTTONS_SUPPORTED) ? MAX_BUTTONS_SUPPORTED : numberOfButtons; |
1583 | | - //4th and 5th buttons are for wheel and shouldn't be reported as buttons. |
1584 | | - //If we have more than 3 physical buttons and a wheel, we report N-2 buttons. |
1585 | | - //If we have 3 physical buttons and a wheel, we report 3 buttons. |
1586 | | - //If we have 1,2,3 physical buttons, we report it as is i.e. 1,2 or 3 respectively. |
1587 | | - if (numberOfButtons >= 5) { |
1588 | | - numberOfButtons -= 2; |
1589 | | - } else if (numberOfButtons == 4 || numberOfButtons == 5) { |
1590 | | - numberOfButtons = 3; |
1591 | | - } |
1592 | 1585 | } |
1593 | 1586 | } |
1594 | 1587 | //Assume don't have to re-query the number again and again. |
|
0 commit comments