Author Topic: Window position problem with 2nd monitor  (Read 4384 times)

Offline Anonymous

  • Anonymous
  • Jr. Member
  • **
  • Posts: 77
  • Karma: +0/-0
Window position problem with 2nd monitor
« on: May 23, 2011, 07:18:50 AM »
Hi, first off, I want to say that I really like Hippoedit - I bought it immediately after it loaded up a 30MB log file in ~3 seconds instead of the 1 minute I was used to.

However, there's a bug (I think) that's been getting on my nerves.

I have two monitors set up side-by-side, and my workspace is set to remember the window positions.

The setup:

monitor1 (1080w*1920h)::monitor2(1050w*1680h)

(no mistake, they're setup in portrait mode)

The problem:
If I close the editor while it's left edge is to the right of 1048 pixels , it gets set back there when it's opened next. In other words, the h-position, h-size, and w-size are correctly remembered, but the left edge is 32 pixels into the left monitor. I use the editor primarily on the right monitor, so this gets kind of irritating after a while.

To illustrate, a couple bits of my workspace file (the location section).
First after closing hippoedit in my preferred position:

Code: [Select]
<Layout position="(1080,0,2130,1176)" status="1" style="1">
<Bars size="(1080,1920)">
<Bar id="59393" panes="(0,9,117,114,107,119,118,108,116,127,59137,59138,59140,59139)"/>
<Bar id="59419" bars="(0,128,591,197,347,202,195,0,59398,0)"/>
<Bar id="59420" bars="(0,2457,0)"/>
<Bar id="59422" bars="(0,2455,0)"/>
<Bar id="59398" pos="(0,0)" docking="true" mru_dockid="59419" mru_floatstyle="8192" mru_floatpos="(1322,552)"/>
<Bar id="128" hidden="true" pos="(0,27)" docking="true" mru_dockpos="(0,27,449,53)" mru_floatstyle="8196" mru_floatpos="(-1,-1)" auto="false"/>
<Bar id="197" hidden="true" pos="(475,27)" docking="true" mru_dockpos="(475,27,817,53)" mru_floatstyle="8196" mru_floatpos="(-1,-1)" auto="false"/>
<Bar id="195" hidden="true" pos="(476,27)" docking="true" mru_floatstyle="8196" mru_floatpos="(-1,-1)"/>
<Bar id="591" hidden="true" pos="(1,27)" docking="true" mru_floatstyle="8196" mru_floatpos="(-1,-1)"/>
<Bar id="202" hidden="true" pos="(477,27)" docking="true" mru_floatstyle="8196" mru_floatpos="(-1,-1)"/>
<Bar id="347" hidden="true" pos="(478,27)" docking="true" mru_floatstyle="8196" mru_floatpos="(-1,-1)"/>
<Bar id="2457" hidden="true" pos="(0,0)" docking="true" mru_floatstyle="8192" mru_floatpos="(-1,-1)" sz_horz="(200,100)" sz_vert="(200,1271)" sz_floating="(200,100)"/>
<Bar id="2455" hidden="true" pos="(0,0)" docking="true" mru_dockid="59422" mru_floatstyle="8192" mru_floatpos="(-1,-1)" sz_horz="(1070,233)" sz_vert="(200,100)" sz_floating="(200,584)"/>
</Bars>
<Windows dpi="96">
<Window name="Properties" pos="(1311,515,1874,894)"/>
<Window name="FindEx" pos="(1307,599,1778,898)"/>
</Windows>
</Layout>

Then, I reopen it (it's now in the wrong position), and close it.
The updated location section:

Code: [Select]
<Layout position="(1048,0,2098,1176)" status="1" style="1">
<Bars size="(1080,1920)">
<Bar id="59393" panes="(0,9,117,114,107,119,118,108,116,127,59137,59138,59140,59139)"/>
<Bar id="59419" bars="(0,128,591,197,347,202,195,0,59398,0)"/>
<Bar id="59420" bars="(0,2457,0)"/>
<Bar id="59422" bars="(0,2455,0)"/>
<Bar id="59398" pos="(0,0)" docking="true" mru_dockid="59419" mru_floatstyle="8192" mru_floatpos="(1322,552)"/>
<Bar id="128" hidden="true" pos="(0,27)" docking="true" mru_dockpos="(0,27,449,53)" mru_floatstyle="8196" mru_floatpos="(-1,-1)" auto="false"/>
<Bar id="197" hidden="true" pos="(475,27)" docking="true" mru_dockpos="(475,27,817,53)" mru_floatstyle="8196" mru_floatpos="(-1,-1)" auto="false"/>
<Bar id="195" hidden="true" pos="(476,27)" docking="true" mru_floatstyle="8196" mru_floatpos="(-1,-1)"/>
<Bar id="591" hidden="true" pos="(1,27)" docking="true" mru_floatstyle="8196" mru_floatpos="(-1,-1)"/>
<Bar id="202" hidden="true" pos="(477,27)" docking="true" mru_floatstyle="8196" mru_floatpos="(-1,-1)"/>
<Bar id="347" hidden="true" pos="(478,27)" docking="true" mru_floatstyle="8196" mru_floatpos="(-1,-1)"/>
<Bar id="2457" hidden="true" pos="(0,0)" docking="true" mru_floatstyle="8192" mru_floatpos="(-1,-1)" sz_horz="(200,100)" sz_vert="(200,1271)" sz_floating="(200,100)"/>
<Bar id="2455" hidden="true" pos="(0,0)" docking="true" mru_dockid="59422" mru_floatstyle="8192" mru_floatpos="(-1,-1)" sz_horz="(1070,233)" sz_vert="(200,100)" sz_floating="(200,584)"/>
</Bars>
<Windows dpi="96">
<Window name="FindEx" pos="(1307,599,1778,898)"/>
<Window name="Properties" pos="(1311,515,1874,894)"/>
</Windows>
</Layout>

Any Ideas?

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2224
  • Karma: +37/-3
    • HippoEDIT
Re: Window position problem with 2nd monitor
« Reply #1 on: May 23, 2011, 12:30:28 PM »
Hi,

thanks for the feedback ;).

Of course I have ideas :). A lot. But, for this specific case there is not magic, this is just visibility check for main window which works wrong on systems with multiple monitors (not on all, but probably with ones with portrait layout). The reason I think in shift because of the taskbar size.

Code: [Select]
CRect rcPos(ndLayout.attributer(_T("position")));

// the following correction is needed when the task bar is
// at the left or top and it is not "auto-hidden"
CRect workArea;
SystemParametersInfo(SPI_GETWORKAREA, 0, &workArea, 0);
rcPos.OffsetRect(workArea.TopLeft());

// make sure the window is not completely out of sight
int max_x = GetSystemMetrics(SM_CXSCREEN) - GetSystemMetrics(SM_CXICON);
int max_y = GetSystemMetrics(SM_CYSCREEN) - GetSystemMetrics(SM_CYICON);

rcPos.MoveToXY(min(rcPos.left, max_x), min(rcPos.top, max_y));
pFrame->SetWindowPos(NULL, rcPos.left, rcPos.top, rcPos.Width(), rcPos.Height(), SWP_NOZORDER);

problem is here: rcPos.OffsetRect(workArea.TopLeft());
Both API functions used here SystemParametersInfo(SPI_GETWORKAREA.. GetSystemMetrics(SM_CYSCREEN) works wrong in multi monitor environment (thez consider only primary monitor), but because there were no complaints, logic was not changed here. Now this can be done and tested :)

So, what I need:
- version of HippoEDIT you are using
- what is a primary monitor? Left or right?
- can you please do the test with same conditions but for the Find dialog from HE. Put HE main window on position where is stable and Find dialog on position which were shifted for main window and check if it will not work also (it has different logic, that may work right). If it works correctly I can also reuse it for main window.
- maybe we will need some iterations for check, but fix will be in 1.49 release (I hope I will release it this week).

BR, Alex.
 

Offline Anonymous

  • Anonymous
  • Jr. Member
  • **
  • Posts: 77
  • Karma: +0/-0
Re: Window position problem with 2nd monitor
« Reply #2 on: May 24, 2011, 02:26:13 AM »
Thanks for the reply :)

I'm using 1.49.812 64bit on windows 7

The left monitor is the primary according to windows, but is labeled index #2 (I think determined by which connector it's plugged into on the video card).

taskbar is on the bottom of the left monitor. It's two layers deep, ~82 pixels high

As for your test,
main window is here:
<Layout position="(565,0,1615,1176)" status="1" style="1">,
is stable

I left the Bars info out this time, hopefully nothing you needed

set the find window in the right monitor, close program

<Window name="FindEx" pos="(1142,83,1613,526)"/>

Open program, open Find --> It is now centered on the right monitor
close dialog, close program, change in position is not reflected in workspace:

<Window name="FindEx" pos="(1142,83,1613,526)"/>

Open program, open find, nudge it a bit, close program, now it is

<Window name="FindEx" pos="(1382,655,1853,1098)"/>

It behaves as expected on the left monitor.

So there you go, at least it's a better failure mode -- I never noticed because I usually leave the dialog in the center anyway.

Thanks again for the quick feedback.

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2224
  • Karma: +37/-3
    • HippoEDIT
Re: Window position problem with 2nd monitor
« Reply #3 on: May 26, 2011, 01:16:52 AM »
Ok... So, the second algorithm (used for Find dialog and all other internal dialogs) also does not work...
That corrected position was not stored, I think is fine, because correction logic is stable it will be on same place next load.
It makes it more difficult, that you touched the dialog, because now we do not know that size of shift is same, but most important, that this second logic is does not work.

I will try to provide new way of checking, using monitor information, and maybe it will works. In any case I will need yours help for testing.

Offline Anonymous

  • Anonymous
  • Jr. Member
  • **
  • Posts: 77
  • Karma: +0/-0
Re: Window position problem with 2nd monitor
« Reply #4 on: May 26, 2011, 03:13:46 AM »
I'm not quite clear on what you're saying about the size of the shift. If I place the the find dialog anywhere on the second (right) monitor, it appears in the same location (the center) the next time I restart the editor, regardless of the saved location.

I guess I should also note that within a session, I can place the find dialog anywhere, and it remembers it's location properly. It's just when the program is restarted that it forgets.

Anyway, I'll keep an eye on this thread for the new way of checking.

PS. I've tried a few times to sign up for the forums, and the confirmation email never arrives, in my spam folder or otherwise.

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2224
  • Karma: +37/-3
    • HippoEDIT
Re: Window position problem with 2nd monitor
« Reply #5 on: May 27, 2011, 01:39:22 AM »
Quote
I'm not quite clear on what you're saying about the size of the shift. If I place the the find dialog anywhere on the second (right) monitor, it appears in the same location (the center) the next time I restart the editor, regardless of the saved location.
Ok, now clear for me :) I understood, it was moving same way as main window (this what I meant under the shift, I think). Moving to the center always also a bug.  I think Center it is default position (if stored position i wrong), but than I would assume that it will be shown on center of the primary (left screen).

Quote
I guess I should also note that within a session, I can place the find dialog anywhere, and it remembers it's location properly. It's just when the program is restarted that it forgets.
Try to change from Find -> to Replace dialog mode. I think in this case it will also position dialog wrong (at least this I see from the code).

Quote
PS. I've tried a few times to sign up for the forums, and the confirmation email never arrives, in my spam folder or otherwise.
Strange, should not happen. New users have registered, since I did last update of forum, and as far as I remember, there is no spam protection active.
Just send me a personal message or mail to supportbox on hippoedit.com with desired name, and I will register the user for you. I think this would be simplest.

Offline tgfym

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
Re: Window position problem with 2nd monitor
« Reply #6 on: June 02, 2011, 06:32:32 AM »
Hey, I'm the Anonymous from earlier. I got a login to work--  I probably mistyped my email last time.

I haven't done any rigorous testing or anything, but this issue appears to be fixed for me in 1.49.817.

Are there any specific things I can check for you?

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2224
  • Karma: +37/-3
    • HippoEDIT
Re: Window position problem with 2nd monitor
« Reply #7 on: June 02, 2011, 12:17:55 PM »
Yes, I have changed the logic for checking if window is visible in current monitor configuration or not in 817.
Now it should support correctly multi-monitor configuration.

What you can check is how main and find windows behaves in your case in different position: I have checked it with two monitors but with landscape configuration - all was fine.
The window position should be adjusted or if window is not visible already (one monitor was removed) or title bar of the window hidden by Windows Task Bar (in this case it is not so easy to move the window).

BR, Alex.
P.S: I am on vacation till Monday, so be aware of delays with my responses :)

Offline tgfym

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
Re: Window position problem with 2nd monitor
« Reply #8 on: June 07, 2011, 05:08:17 AM »
I've checked a bunch of semi-random configurations. Everything seems quite functional here for both dialogs and windows. I also tried removing the 2nd monitor, and that worked as well.

Thanks for the fix!
 
A slight inconsistency: if a window is closed while extending out the left side of the left monitor, it is shifted back within the monitor bounds when restarted. But if it extends out the right side of the right monitor, it is not shifted when restarted. I guess this arises from the side-task-bar-check: I don't see this as much of an issue, just an observation.


Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2224
  • Karma: +37/-3
    • HippoEDIT
Re: Window position problem with 2nd monitor
« Reply #9 on: June 07, 2011, 08:04:04 PM »
Thanks for testing. Good news!

The inconsistency is by design. I check if left side of the window hidden (part with system menu, on top left corner) or title bar of the window is hidden, and correct the position than. Maybe it will be enough to check only hiding of the title bar...