bbidulock / icewm

A window manager designed for speed, usability, and consistency
Other
567 stars 97 forks source link

Wine windows are needing to be moved or re entered to focus correctly. #700

Closed ghost closed 10 months ago

ghost commented 1 year ago

Hello,

every window that opens from wine needs to be moved, clicked or re-entered (games) to focus correctly.

Using: FreeBSD 13.1 IceWM: 3.3.0

Thank you in advance!

gijsbers commented 1 year ago

Works fine here for winecfg, winemine, BGB. They all immediately get focus.

ghost commented 1 year ago

True in normal wine windows it seems to work but in some games no keyboard input is getting passed only until I switch out and back in the window (even if the workspace is emtpy and the game is the only window).

First found in Borderlands 2 (Wine) using in windowed fullscreen mode.

As far as i can tell its not the game itself as it works correctly in other window managers.

gijsbers commented 1 year ago

Do icesh focusmodel on that window. And xprop | grep -e '[:=]'.

Find some app which I can install easily. Not on steam.

jakoprd commented 1 year ago

As temporary solution you can run winecfg and set Emulate virtual desktop in graphics settings. For example Warcraft3 completely ignore keyboard input without that. Even Alt+Tab will not help.

gijsbers commented 1 year ago

This might be fixed by commit f9149e6, which is in release 3.3.4. Please try again.

ghost commented 1 year ago

Hello,

thank you for your reminder.

The issue seems to be still there.

In the meantime i have found a tiny free client accessible WoW client from an private server that has the exact issue.

https://cdn.wowlibrary.com/clients/MoP_minimal.zip Patch 5.4.8 taken from https://stormforge.gg/how-to-connect

I have found an normal Wine window aswell that maybe behaves the same as its not shown in the forground after entering the command but normal it should be in the foreground.

This window is the "configure prefix" window that you get when you create a new Wine prefix.

Screenshot at 2023-05-21 10-47-32

ghost commented 1 year ago

Alexander88207@Home:~ $ xprop | grep -e '[:=]'

_WIN_LAYER(CARDINAL) = 4
_NET_WM_DESKTOP(CARDINAL) = 0
WM_STATE(WM_STATE):
        window state: Normal
        icon window: 0x0
_NET_FRAME_EXTENTS(CARDINAL) = 3, 3, 30, 4
_NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_MOVE, _NET_WM_ACTION_RESIZE, _NET_WM_ACTION_CLOSE, _NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_MAXIMIZE_HORZ, _NET_WM_ACTION_MAXIMIZE_VERT, _NET_WM_ACTION_SHADE, _NET_WM_ACTION_FULLSCREEN, _NET_WM_ACTION_ABOVE, _NET_WM_ACTION_BELOW, _NET_WM_ACTION_STICK, _NET_WM_ACTION_CHANGE_DESKTOP
_NET_WM_VISIBLE_NAME(UTF8_STRING) = "World of Warcraft"
_NET_WM_VISIBLE_ICON_NAME(UTF8_STRING) = "World of Warcraft"
_NET_WM_ICON(CARDINAL) =    Icon (32 x 32):
    Icon (16 x 16):
_NET_WM_STATE(ATOM) = 
_NET_WM_NAME(UTF8_STRING) = "World of Warcraft"
WM_ICON_NAME(STRING) = "World of Warcraft"
WM_NAME(STRING) = "World of Warcraft"
WM_HINTS(WM_HINTS):
        Client accepts input or input focus: False
        bitmap id # to use for icon: 0x3a00024
        bitmap id # of mask for icon: 0x3a00026
        window id # of group leader: 0x3c00001
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
_MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x3, 0x3e, 0x7e, 0x0, 0x0
WM_NORMAL_HINTS(WM_SIZE_HINTS):
        program specified location: 160, 82
        window gravity: Static
_NET_WM_USER_TIME_WINDOW(WINDOW): window id # 0x3a00015
XdndAware(ATOM) = BITMAP
_NET_WM_PID(CARDINAL) = 15181
WM_LOCALE_NAME(STRING) = "C.UTF-8"
WM_CLIENT_MACHINE(STRING) = "Home"
WM_CLASS(STRING) = "wow-64.exe", "wow-64.exe"
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, _NET_WM_PING, WM_TAKE_FOCUS

Alexander88207@Home:~ $ icesh focusmodel 0x3c00001 focusmodel Globally

ghost commented 1 year ago

Another interesting thing: The WoW window gets focused correctly if an other Window is in the foreground. But not if the desktop is empty.

gijsbers commented 1 year ago

In the last case, by repeatedly clicking slow on its task button it will finally accept focus, right? When it is the only window on the desktop, icewm correctly sends a WM_TAKE_FOCUS message to WoW, but Wine ignores it. For each click on the task button of WoW, icewm sends another, when it finally accepts it. This looks like a Wine bug to me.

gijsbers commented 1 year ago

Here is how Wine handles an incoming WM_TAKE_FOCUS message:

https://sources.debian.org/src/wine/8.0~repack-4/dlls/winex11.drv/event.c/?hl=699#L699 https://sources.debian.org/src/wine-development/7.22~repack-2/dlls/winex11.drv/event.c/?hl=699#L699

These codes look similar. Both depend on the evaluation of a function can_activate_window:

https://sources.debian.org/src/wine/8.0~repack-4/dlls/winex11.drv/event.c/?hl=544#L544 https://sources.debian.org/src/wine-development/7.22~repack-2/dlls/winex11.drv/event.c/?hl=540#L540

While I don't understand what is going on, it is clear that the reception of a WM_TAKE_FOCUS message is not a guarantee that Wine will actually focus its window. It may therefore be plausible that some timing or event interferes. I don't see any reason why this could be a icewm bug. It would be best to report this to WineHQ.