manutalcual / winredock

Rearrange windows on traybar icon click after docking the laptop
GNU General Public License v3.0
533 stars 32 forks source link

wm.exe hangs sometimes after re-dock #14

Closed zoidy closed 4 years ago

zoidy commented 5 years ago

Sometimes the program hangs after re-docking. I can't reliably replicate but it seems to happen most often when the screen gets locked while undocked and I re-dock while the screen is locked. After logging in, the wm.exe process hangs with 100% CPU usage and no windows get repositioned.

I was able to capture an occurrence using the logging version from this commit wm.log

raidersan commented 4 years ago

Same issue here, dont know what triggers it, don't think it is the lock screen process per se, could be linked to the dock/undocked status change while locked/sleeping

manutalcual commented 4 years ago

I think it is the loop that verifies the windows when there is a lock between two resolutions. When the laptop is in lock or suspended, it doesn't gets resolution updates. When this occur, there is a little function to check windows existence, screen resolution and positions and tries to do things. Obviously this isn't working well and I'm not sure if it takes a long time or is an infinite loop. The workaround is to undock/dock always with the laptop awake and/or not locked.

Sorry guys not to have time to fix this. I have currently two jobs only to pay the bills, so I don't have time to fix/work on this.

Thank you for your time to use this and to report things. I will eventually work on this when I have time.

sbiefeni commented 4 years ago

Any chance for a resolution for this?

sbiefeni commented 4 years ago

It seems to be that first run, it's fine.

  1. run - ok
  2. undock - ok
  3. dock - ok - windows reposition, perfect.
  4. undock - now vm.exe is frozen, and CPU usage starts to rise.
  5. dock - fail to position windows.

the CPU usage rises gradually too, it's doesn't start at 100%.. it rises.. 10%...20%... etc.. so it's like it's building up cycles.

I have multiple desktops - about 6.

manutalcual commented 4 years ago

I will test it this weekend.

sbiefeni commented 4 years ago

That would be awesome.. thanks Manuel.

Another issue - I have multiple desktops - 5 I notice that often, it correctly moves windows to the external monitor when docking, but not to the original desktop they were on. It sometimes works, but sometimes it piles all the windows onto the leftmost desktop.

manutalcual commented 4 years ago

Ok. I'll try to debug this evening and weekend.

manutalcual commented 4 years ago

I've tested this over the weekend and I think I've found a bug and solved but didn't have time to put a release. I'll do it this evening (my time is UTC+2 by the way.)

ziddey commented 4 years ago

seeing the same behavior as @sbiefeni. However, it seems to not be related to screen lock for me. Just an unplug/replug will do. Subsequent unplug/replug will not restore, and a core is pegged.

manutalcual commented 4 years ago

I have that pending. Unfortunately I didn't have time to upload the code and make a release :-(. Will try to do it today.

sbiefeni commented 4 years ago

seeing the same behavior as @sbiefeni. However, it seems to not be related to screen lock for me. Just an unplug/replug will do. Subsequent unplug/replug will not restore, and a core is pegged.

I think you're referring to the same issue I was talking about... dock = plug, undock = unplug.

ziddey commented 4 years ago

@sbiefeni right, @zoidy was saying something about screen locking in the original post.

edit: I see what you mean now. -however

manutalcual commented 4 years ago

I'm sorry guys, I didn't do it yet. I've been working twelve hours a day and don't had time. Will try today.

MYSTRAVIL commented 4 years ago

@manutalcual please don't stress yourself with this. Focus on important things first

manutalcual commented 4 years ago

I've made a release based on the bug fix. I'm not sure it is solved because I can't reproduce the failure, but you may try. Release: v0.2bf

starryalley commented 4 years ago

The exe depends on libstdc++-6.dll/libgcc_s_seh-1.dll which aren't included in the zip.

I tried to build your branch "ISSUE_0014" myself and the wm.exe doesn't actually depend on those 2, but the ones with cyg*. Not sure if I'm building it correctly but it runs.

Thanks for this great tool!

manutalcual commented 4 years ago

@starryalley can you confirm if it doesn't hung when plugin and unplugin? If so I merge the change and create another release. I think there is a problem with window sizes also, so I have to test that.

manutalcual commented 4 years ago

I've made another release that should work better. This has support for multi-window applications (i.e. apps that have more than one window but are equal, like Firefox, Chrome, not apps that have several different windows (like apps with tool windows.)

sbiefeni commented 4 years ago

I'm not able to run wm.exe because of this error.. I'm not compiling the program, just running the file from bin.

Annotation 2020-03-05 123824

starryalley commented 4 years ago

@manutalcual yes it works. My use case is slightly different but should be the same. Most of the time the computer has 2 screens but sometimes one of it can be switched off (unplugged). But when it is switched on I need all the previous windows restored to their original screen. This works great.

manutalcual commented 4 years ago

I've created another issue for the missing dlls. #24 I'm merging and closing this issue.