mIRC Home    About    Download    Register    News    Help

Topic Options
#261256 - 23/08/17 08:56 PM Overflow error when saving X position of window??
Mufkatar Offline
Self-satisified door

Registered: 23/08/17
Posts: 3
Hi,

I love mIRC, but one thing annoys me. I can use the Position -> Save function on the parent window as many times as I like, but Position -> Reset always puts it at the left edge of the screen, even though I saved it while its right edge was flush with the right border of the screen. The Y position is maintained, though.
If I save the position while the window is in the middle (left-right) of my screen, Reset returns it to the saved position.
This leads me to conclude that there is a cap on the X value when saving the position, and that it gets reset to zero instead of the proper saved position - I could be wrong, but it's the most obvious inference to draw.
As long as I leave the window where I put it, it stays there, and "survives" through reboots. But that is likely Windows' position restore feature, rather than mIRC's.

My screen is 2560x1440, and I'm running mIRC 7.49 on Windows 10 build 1703 x64. My mIRC window is 1050 px wide.

Hope you can fix this, or alternatively point me to the error of my ways. :-)


Edited by Mufkatar (23/08/17 09:23 PM)

Top
#261257 - 24/08/17 09:39 AM Re: Overflow error when saving X position of window?? [Re: Mufkatar]
Khaled Offline


Planetary brain

Registered: 04/12/02
Posts: 4379
Loc: London, UK
Thanks for your bug report. I cannot seem to reproduce this issue here. I have tried placing the mIRC main window left/right sides flush/not flush with the sides of the desktop and saving/resetting position and it has worked correctly for me. That said, my desktop is 1440x900.

If you change your display size to 1440x900 or thereabouts, do you see the same issue? If you do, can you describe a step by step method that you used to reproduce it?

Note that Windows does not position/size mIRC's window when you run mIRC - mIRC does that.

Top
#261258 - 24/08/17 05:17 PM Re: Overflow error when saving X position of window?? [Re: Khaled]
Mufkatar Offline
Self-satisified door

Registered: 23/08/17
Posts: 3
Hi Khaled,

thanks for the quick response. I've now tried reducing my resolution to yours, and also at 2048x1152 - in neither resolution am I able to reproduce the problem.
Set it back to full resolution, and the issue is back.

I then measured as best I could, and the threshold seems to be at 1040 pixels horizontal, AKA X-axis. I then switched back to 2048x1152, reduced the width of my mIRC window, and presto, the problem occurred there as well. It zaps to X = 8 again.

Interestingly, the threshold is clearly lower than 1040 for the lower resolution - it seems to relate to the width of the mIRC window more than the width of the screen resolution.
In other words, it might be that if the window does not overlap "itself", were it to be placed flush with the left border of the screen - but instead to the right of where that window would end - then it zaps to the left when I click reset after having saved the position. If an exact copy of the window could *not* fit between itself and the left border, then the position is correctly reset.

Step-by-step:
- I place the window such that the left border of it is to the left of the invisible threshold
- click the mIRC icon in the upper left corner, and choose "Save"
- I then immediately repeat the first click, but choose "Reset" instead.
- The window zaps to X = 8, Y is unchanged.

I hope this is clear; I'm happy to expound if any of the above was unhelpful.

Regarding Windows vs. mIRC: My bad, I guess. It's just that all Windows apps remember their last position when closed, and so I mistakenly assumed that Windows stored and recalled it automatically. I figured that at least one or two coders out there would have forgotten to implement this, and thus I ought to have experienced this lack at some point with some app or another. Perhaps I did and forgot. :-) But given your explanation, I guess a bug might lie solely within the "Reset" function, if that function differs from how placement is handled when the window is created from scratch (when launching the application)?


Edited by Mufkatar (24/08/17 05:20 PM)

Top
#261263 - 24/08/17 09:58 PM Re: Overflow error when saving X position of window?? [Re: Mufkatar]
Khaled Offline


Planetary brain

Registered: 04/12/02
Posts: 4379
Loc: London, UK
Thanks for the feedback. Unfortunately I am unable to set a screen size as large as yours. If you were unable to reproduce the issue at my resolution, it seems that I will not be able to reproduce it.

That said, I have checked all of the code relating to the window position reset feature and have not found any limitations on window position/size.

I have set mIRC's horizontal window width at both below and above the 1040 pixel width you mention, placed the left edge of mIRC's window at the left edge of the desktop, saved and reset the window position, and it worked correctly for me, so it does not look like it is related to the window width since that works for both you and me at larger widths on lower resolution desktops.

At this point, the only cause I can think of is a display driver bug. However, if anyone else on the forums can reproduce the issue, that would help narrow it down.

Top
#261266 - 25/08/17 10:25 AM Re: Overflow error when saving X position of window?? [Re: Mufkatar]
Khaled Offline


Planetary brain

Registered: 04/12/02
Posts: 4379
Loc: London, UK
Looking into this a little more, there is code in the position reset routine that checks if the mIRC main window is 10 pixels less than the leftmost border of the screen. If it is, mIRC's leftmost position is set at zero. This was implemented a long time ago to prevent mIRC disappearing offscreen in some situations.

Windows 10 uses invisible borders for main application windows of about 8 pixels. If you are trying to position mIRC left/right flush with the screen, it is possible that this is the cause of the issue. When mIRC resets its position to zero, it looks like it is not flush with the left of the screen, even though it actually is at position zero - the invisible borders make it look like it isn't.

The Windows 10 invisible borders are a tricky issue to resolve - they are not backwards compatible with how most applications set window size/position and most applications experience issues with them, eg. see here, here, here, here, and here. In the last link, someone found a solution, however applying it is difficult - it would require changing hundreds of places in the code that set/get window position/size and even then it is not clear if this would resolve the issue or introduce new ones in other contexts.

I will see if I can find a way of calculating the invisible border width and, in this specific context, resetting the position to be flush with the border, however I cannot guarantee that I will be able to find a working solution.

Top
#261268 - 25/08/17 04:54 PM Re: Overflow error when saving X position of window?? [Re: Khaled]
BhaaL Offline
Babel fish

Registered: 23/03/08
Posts: 86
Loc: Austria
This sounds awfully familiar to the issue I see.
On my dual-screen setup (primary 2560x1440 to the left, secondary 1920x1080 to the right) I keep mIRC maximized on the secondary; but after every mIRC boot (which coincides with a shutdown/reboot) it opens on the primary screen (still maximized though).

I tried Window > Position > Save, but that didn't have the desired result. mIRC.ini has the following entries (not sure which ones are relevant):
Code:
[windows]
main=2558,1160,163,840,2,1,0

[mode]
normal=-4,-4,1160,840,1,2,2,1,0,1,0,1,1,0,0
state=normal
compact=710,310,260,400,0,1,0,2,1,0,1,1,1,1,1

[fullscreen]
normal=-4,-4,1160,840,1,2,2,1,0,1,1,1
full=-4,-4,1160,840,1,2,1,1,0,0,0,0
state=normal


I used WinAero Tweaker to change the border width on Windows 10 to be less imposing (border width is 1 and border padding is 2), which also requires the Aero Lite theme; so the position of 2558 sounds like it matches 2560 with 2px padding.

Also, for completeness sake:
Code:
//echo -a $os $version $beta $md5($mircexe,2) $file($mircexe).sig $alias(0) $script(0) $dll(0) $com(0)
; 10 7.49 97c5ea9ce0093eef4776a5ec6ab12d69 ok 9 32 1 0

Top
#261272 - 26/08/17 12:16 AM Re: Overflow error when saving X position of window?? [Re: BhaaL]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3475
Loc: France
I have a similar configuration, dual screen but the main screen is on the right and mIRC is ran maximized on the second screen (left). It starts correctly maximized on that screen.
I think only the 'main' item from the windows section is relevant here, I have main=-983,1440,158,900,2,1,0 if that helps.
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#261275 - 26/08/17 01:46 PM Re: Overflow error when saving X position of window?? [Re: Wims]
BhaaL Offline
Babel fish

Registered: 23/03/08
Posts: 86
Loc: Austria
I just threw a screenshot of my full desktop into Paint, and 2558,163 is exactly where it should be (since the screens aren't same size, I just left them about centered-ish as Windows suggest; since neither top- nor bottom-aliging them felt good when moving the mouse across). Still starts on the primary screen (which is connected via Display Port, btw; while the secondary is HDMI).
Not sure about the 2nd and 4th parameter in there. If its width/height, it should be closer to 1920x1040 rather than 1160x840. I'm not aware of any scaling on either of the screens; both should be 100% with no per-screen DPI.

Other Programs like Visual Studio correctly launch on the secondary screen when I close them there, so I'm not sure if this is some Windows thing or a mIRC issue.


Edited by BhaaL (26/08/17 01:48 PM)

Top
#261278 - 27/08/17 07:02 AM Re: Overflow error when saving X position of window?? [Re: BhaaL]
Khaled Offline


Planetary brain

Registered: 04/12/02
Posts: 4379
Loc: London, UK
Quote:
On my dual-screen setup (primary 2560x1440 to the left, secondary 1920x1080 to the right) I keep mIRC maximized on the secondary; but after every mIRC boot (which coincides with a shutdown/reboot) it opens on the primary screen (still maximized though).

This sounds like a different issue. If you place mIRC on the second monitor and position/size it smaller so that it is in the center of the display and -then- maximize it, the "main" entry in mirc.ini will be the small position/size in the middle of the screen, so it will not be affected by being close to the desktop borders. The maximize setting is applied after mIRC is opened on the second monitor.

If you are still seeing this issue after sizing mIRC smaller, away from the desktop borders, this is a different multi-monitor issue.

Also, so that we can eliminate the multi-monitor complexity, can you test this on your primary monitor to see if it shows the same issue that the OP reported?

Top
#261279 - 27/08/17 07:31 AM Re: Overflow error when saving X position of window?? [Re: Mufkatar]
Khaled Offline


Planetary brain

Registered: 04/12/02
Posts: 4379
Loc: London, UK
Right, I was able to reproduce an issue that looks like the original reported bug, where mIRC was opening in the correct saved position on startup but using reset position caused it to change position. The fix should be in the next beta and may fix the reported issue.

Top
#261281 - 27/08/17 12:05 PM Re: Overflow error when saving X position of window?? [Re: Khaled]
BhaaL Offline
Babel fish

Registered: 23/03/08
Posts: 86
Loc: Austria
It looks like it has to do with being maximized while saving the position.

I tried the following:
1. mIRC on secondary screen, maximized, Position > Save, exit mIRC, start -> starts on primary screen
2. mIRC on secondary screen, not maximized, Position > Save, exit mIRC, start -> starts on secondary screen
3. mIRC on secondary screen again, settings restored correctly from 2., maximize the window, Position > Save, exit mIRC, start -> starts on secondary screen

This was slightly unexpected, but works for me if it keeps starting on the secondary screen from now on. I do hope a reboot (or otherwise active monitor sense from Display Port) doesn't change this; if it does I'll add another reply.

However, even after being on the secondary screen and maximized, the position stored as main is slightly different to before:
Code:
[windows]
main=2965,1160,307,840,2,1,0


It looks more like the center of the screen, where I had it for the test in 2. before maximizing it.
Perhaps it is related to the position after all, and you don't store the position when it goes off screen?


Edited by BhaaL (27/08/17 12:06 PM)

Top
#261309 - 31/08/17 07:52 PM Re: Overflow error when saving X position of window?? [Re: Khaled]
Mufkatar Offline
Self-satisified door

Registered: 23/08/17
Posts: 3
Originally Posted By: Khaled
Right, I was able to reproduce an issue that looks like the original reported bug, where mIRC was opening in the correct saved position on startup but using reset position caused it to change position. The fix should be in the next beta and may fix the reported issue.

And right you are, Khaled - it now works flawlessly for me with the beta! Thank you, this is great. grin

Top