mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 09:29:38 +01:00
JBR-3779 Unexpected Alt+Tab behaviour for Java frames on Cinnamon DE
(cherry picked from commit 0bf13985d5)
This commit is contained in:
committed by
alexey.ushakov@jetbrains.com
parent
e1731c7c14
commit
fd3604ccd3
@@ -168,8 +168,6 @@ public class XBaseWindow {
|
||||
|
||||
// Set WM_CLIENT_LEADER property
|
||||
initClientLeader();
|
||||
|
||||
initUserTimeWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -441,13 +439,6 @@ public class XBaseWindow {
|
||||
}
|
||||
}
|
||||
|
||||
private void initUserTimeWindow() {
|
||||
XNETProtocol netProtocol = XWM.getWM().getNETProtocol();
|
||||
if (netProtocol != null ) {
|
||||
netProtocol.setupUserTimeWindow(this);
|
||||
}
|
||||
}
|
||||
|
||||
static XRootWindow getXAWTRootWindow() {
|
||||
return XRootWindow.getInstance();
|
||||
}
|
||||
@@ -1314,12 +1305,18 @@ public class XBaseWindow {
|
||||
}
|
||||
|
||||
protected void setUserTime(long time, boolean updateGlobalTime) {
|
||||
setUserTime(time, updateGlobalTime, true);
|
||||
}
|
||||
|
||||
protected void setUserTime(long time, boolean updateGlobalTime, boolean updateWindowProperty) {
|
||||
if (updateGlobalTime && (int)time - (int)globalUserTime > 0 /* accounting for wrap-around */) {
|
||||
globalUserTime = time;
|
||||
}
|
||||
XNETProtocol netProtocol = XWM.getWM().getNETProtocol();
|
||||
if (netProtocol != null) {
|
||||
netProtocol.setUserTime(this, time);
|
||||
if (updateWindowProperty) {
|
||||
XNETProtocol netProtocol = XWM.getWM().getNETProtocol();
|
||||
if (netProtocol != null) {
|
||||
netProtocol.setUserTime(this, time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1072,10 +1072,13 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
||||
XClientMessageEvent cl = xev.get_xclient();
|
||||
if ((wm_protocols != null) && (cl.get_message_type() == wm_protocols.getAtom())) {
|
||||
long timestamp = getTimeStampFromClientMessage(cl);
|
||||
// we should treat WM_TAKE_FOCUS and WM_DELETE_WINDOW messages as user interaction, as they can originate
|
||||
// We should treat WM_TAKE_FOCUS and WM_DELETE_WINDOW messages as user interaction, as they can originate
|
||||
// e.g. from user clicking on window title bar and window close button correspondingly
|
||||
// (there will be no ButtonPress/ButtonRelease events in those cases)
|
||||
setUserTime(timestamp, true);
|
||||
// (there will be no ButtonPress/ButtonRelease events in those cases).
|
||||
// The received timestamp will be used to set _NET_WM_USER_TIME on newly opened windows to ensure their
|
||||
// correct focusing/positioning, but we don't set it on current window to avoid race conditions (when e.g.
|
||||
// WM_TAKE_FOCUS arrives around the time of new window opening).
|
||||
setUserTime(timestamp, true, false);
|
||||
|
||||
if (cl.get_data(0) == wm_delete_window.getAtom()) {
|
||||
handleQuit();
|
||||
|
||||
@@ -296,7 +296,6 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
|
||||
XAtom XA_NET_WM_WINDOW_OPACITY = XAtom.get("_NET_WM_WINDOW_OPACITY");
|
||||
|
||||
XAtom XA_NET_WM_USER_TIME = XAtom.get("_NET_WM_USER_TIME");
|
||||
XAtom XA_NET_WM_USER_TIME_WINDOW = XAtom.get("_NET_WM_USER_TIME_WINDOW");
|
||||
|
||||
/* For _NET_WM_STATE ClientMessage requests */
|
||||
static final int _NET_WM_STATE_REMOVE =0; /* remove/unset property */
|
||||
@@ -465,20 +464,9 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
|
||||
return (state != null && state.size() != 0 && state.contains(XA_NET_WM_STATE_HIDDEN));
|
||||
}
|
||||
|
||||
private boolean isUserTimeWindowSupported() {
|
||||
return checkProtocol(XA_NET_SUPPORTED, XA_NET_WM_USER_TIME_WINDOW);
|
||||
}
|
||||
|
||||
void setupUserTimeWindow(XBaseWindow window) {
|
||||
if (active() && isUserTimeWindowSupported()) {
|
||||
XA_NET_WM_USER_TIME_WINDOW.setWindowProperty(window, XRootWindow.getInstance());
|
||||
}
|
||||
}
|
||||
|
||||
void setUserTime(XBaseWindow window, long time) {
|
||||
if (active()) {
|
||||
XBaseWindow target = isUserTimeWindowSupported() ? XRootWindow.getInstance() : window;
|
||||
XA_NET_WM_USER_TIME.setCard32Property(target, time);
|
||||
XA_NET_WM_USER_TIME.setCard32Property(window, time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user