|
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; |
@@ -1567,21 +1565,16 @@ public int getNumberOfButtons(){ |
1567 | 1565 | awtLock(); |
1568 | 1566 | try { |
1569 | 1567 | if (numberOfButtons == 0) { |
1570 | | - if (XdgDesktopPortal.isRemoteDesktop() |
1571 | | - && ScreencastHelper.isAvailable()) { |
| 1568 | + numberOfButtons = getNumberOfButtonsImpl(); |
| 1569 | + numberOfButtons = (numberOfButtons > MAX_BUTTONS_SUPPORTED) ? MAX_BUTTONS_SUPPORTED : numberOfButtons; |
| 1570 | + //4th and 5th buttons are for wheel and shouldn't be reported as buttons. |
| 1571 | + //If we have more than 3 physical buttons and a wheel, we report N-2 buttons. |
| 1572 | + //If we have 3 physical buttons and a wheel, we report 3 buttons. |
| 1573 | + //If we have 1,2,3 physical buttons, we report it as is i.e. 1,2 or 3 respectively. |
| 1574 | + if (numberOfButtons >= 5) { |
| 1575 | + numberOfButtons -= 2; |
| 1576 | + } else if (numberOfButtons == 4 || numberOfButtons == 5) { |
1572 | 1577 | numberOfButtons = 3; |
1573 | | - } else { |
1574 | | - numberOfButtons = getNumberOfButtonsImpl(); |
1575 | | - numberOfButtons = (numberOfButtons > MAX_BUTTONS_SUPPORTED) ? MAX_BUTTONS_SUPPORTED : numberOfButtons; |
1576 | | - //4th and 5th buttons are for wheel and shouldn't be reported as buttons. |
1577 | | - //If we have more than 3 physical buttons and a wheel, we report N-2 buttons. |
1578 | | - //If we have 3 physical buttons and a wheel, we report 3 buttons. |
1579 | | - //If we have 1,2,3 physical buttons, we report it as is i.e. 1,2 or 3 respectively. |
1580 | | - if (numberOfButtons >= 5) { |
1581 | | - numberOfButtons -= 2; |
1582 | | - } else if (numberOfButtons == 4 || numberOfButtons == 5) { |
1583 | | - numberOfButtons = 3; |
1584 | | - } |
1585 | 1578 | } |
1586 | 1579 | } |
1587 | 1580 | //Assume don't have to re-query the number again and again. |
|
0 commit comments