Skip to content

Commit 549185e

Browse files
author
duke
committed
Backport db2cd1a4e0ee7b72339e7ee3c0286dc04fc5adbf
1 parent 403ae7b commit 549185e

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,6 @@
142142
import sun.awt.X11GraphicsEnvironment;
143143
import sun.awt.XSettings;
144144
import sun.awt.datatransfer.DataTransferer;
145-
import sun.awt.screencast.ScreencastHelper;
146-
import sun.awt.screencast.XdgDesktopPortal;
147145
import sun.awt.util.PerformanceLogger;
148146
import sun.awt.util.ThreadGroupUtils;
149147
import sun.font.FontConfigManager;
@@ -1574,21 +1572,16 @@ public int getNumberOfButtons(){
15741572
awtLock();
15751573
try {
15761574
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) {
15791584
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-
}
15921585
}
15931586
}
15941587
//Assume don't have to re-query the number again and again.

0 commit comments

Comments
 (0)