# Remember windows pos after close, snap windows and multithreading

**URL:** <https://forum.opencv.org/t/remember-windows-pos-after-close-snap-windows-and-multithreading/17300>\
**Category:** C++\
**Created:** [April 15, 2024, 10:54am UTC](https://forum.opencv.org/t/remember-windows-pos-after-close-snap-windows-and-multithreading/17300 "2024-04-15T10:54:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Blazej\_Dobija](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/blazej_dobija/32/10204_2.png) [@Blazej\_Dobija](https://forum.opencv.org/u/Blazej_Dobija)\
**Post date:** [April 15, 2024, 10:54am UTC](https://forum.opencv.org/t/remember-windows-pos-after-close-snap-windows-and-multithreading/17300/1 "2024-04-15T10:54:23Z")

</div>

Hello.  
past year I begin use opencv in my project, but past week i upgrade my whole msys2 and everything changes in my project.  
It was very useful when I close windows then its position was remembered on next imshow() even after recompile, now all windows always appear at center my screen. My project display around 5 windows and I very often move them around and it was very useful when thier position was remembered, now its pretty annoing and hardcoding its position isnt helpful.  
Also it was nice when I moved windows then it snap to edges of screen or other windows, now its gone.  
And it was pretty useful to being able to call imshow from different threads, now as soon as I call imshow on different thread then app hang or other UB (i partially sove this writing gui worker thread and passing every imshow to it)

So my question is how can I restore all these features even if it is older version, then they are very useful diring prototyping app?

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [April 15, 2024, 1:52pm UTC](https://forum.opencv.org/t/remember-windows-pos-after-close-snap-windows-and-multithreading/17300/2 "2024-04-15T13:52:53Z")

</div>

the win32 backend remembers window positions. the win32 backend also _kinda_ supports calling imshow() from different threads, although that is not recommended.

did you install something that pretends to run on linux? something that uses GTK or whatever?

OpenCV highgui does not have a “snapping” feature. if anything snapped previously, it was something specific to your system.

DO NOT install an “older” version. that is NOT the issue.

install `opencv-python` natively, not in msys2 or docker or WSL2 or any of that. install it natively. install python natively. don’t install anaconda/conda/whatever. install plain python, natively, and opencv-python, natively, in native python, with pip.

---

<div class="post-metadata">

**Author:** ![Blazej\_Dobija](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/blazej_dobija/32/10204_2.png) [@Blazej\_Dobija](https://forum.opencv.org/u/Blazej_Dobija)\
**Post date:** [April 15, 2024, 2:59pm UTC](https://forum.opencv.org/t/remember-windows-pos-after-close-snap-windows-and-multithreading/17300/3 "2024-04-15T14:59:07Z")

</div>

as I remember i installed:  
pacman -S mingw-w64-ucrt-x86\_64-toolchain  
pacman -S mingw-w64-ucrt-x86\_64-opencv  
pacman -S mingw-w64-ucrt-x86\_64-qt6-5compat

Why should I install python thing as I use c++?  
I also remember that before update imshow display only images without zoom on wheel mouse but after update there are some button at top (save, copy zoom etc) + zooming on wheel mouse

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [April 15, 2024, 3:11pm UTC](https://forum.opencv.org/t/remember-windows-pos-after-close-snap-windows-and-multithreading/17300/4 "2024-04-15T15:11:23Z")

</div>

> [@Blazej\_Dobija](#):
>
> I use c++

ok then no python. I assumed that you were using python. I would strongly urge you to stick with Python. C++ development has a steep learning curve.

download official binaries from [opencv.org](http://opencv.org), use Visual Studio, or VSCode with MS compiler.

there are no official builds for mingw. there are inofficial builds somewhere. those assume _native_ mingw.

your using an _msys2_ build of mingw means you’re _doubly_ off the beaten path.

when in doubt, contact the package maintainers:

> **[Issues · msys2/MINGW-packages](https://github.com/msys2/MINGW-packages/issues?q=is%3Aissue%2Bis%3Aopen%2Bopencv)**
>
> Package scripts for MinGW-w64 targets to build under MSYS2. - Issues · msys2/MINGW-packages

> **[Build software better, together](https://github.com/msys2/MINGW-packages/issues/new?template=bug_report.yml&title=%5Bopencv%5D%2B)**
>
> GitHub is where people build software. More than 100 million people use GitHub to discover, fork, and contribute to over 420 million projects.
