Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Docking Pane
  New Posts New Posts RSS Feed - Cannot drag panels to other monitor with other DPI
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Cannot drag panels to other monitor with other DPI

 Post Reply Post Reply
Author
Message
andredevries View Drop Down
Newbie
Newbie


Joined: 22 June 2018
Location: Netherlands
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote andredevries Quote  Post ReplyReply Direct Link To This Post Topic: Cannot drag panels to other monitor with other DPI
    Posted: 22 June 2018 at 8:55am
Multiple 4K screens, some with 100% scaling, others with scaling other than 100. Can't move any of the windows across to the other screens if the scaling is different. They get stuck; they jump to a different location on the screen it comes from. See this short video showing the issue:
https://www.youtube.com/watch?v=IFiAtYSNl30

This happens when the "main" monitor is to the right of the "second" monitor, so the second monitor will have negative horizontal co-ordinates. Now, if the two monitors have different DPI scale settings then none of our "Floating Tool Panel" windows, that are based on a CodeJock control for dockable floating panels, can be dragged into the left panel (i.e the second monitor with negative co-ordinates).

Note: When you drag the floating panel towards the left monitor, Windows will send a notification to it when more than 50% of the panel is in the left monitor (WM_DPICHANGED). The notification is to tell the panel that it is now dragged into a monitor that has a different DPI Scale. It seems that the CodeJock Docking panel should respond to this notification in some way and it seems it is not doing that, or incorrectly?

I reproduced the issue using Codejock MFC 18.3.0.
I hope this problem can be solved or someone can tell me how to fix it myself. Thanks.

Back to Top
olebed View Drop Down
Admin Group
Admin Group
Avatar

Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 836
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 22 June 2018 at 11:50am
Hello,

I think this problem related to new macros XTP_POINT_FROM_LPARAM
It constructs wrong CPoint if .x or .y from lparam are negative.
I have investigated that negative points are only in method CXTPCommandBarsFrameHook::OnHookMessage()

So as workaround you can delete this macros from CXTPCommandBarsFrameHook::OnHookMessage 
because CPoint has own constructor with lparam as parameter CPoint(LPARAM dwPoint) throw();

CPoint point = XTP_POINT_FROM_LPARAM(lParam);
>
CPoint point(lParam);

Regards,
Oleksandr Lebed  
Back to Top
olebed View Drop Down
Admin Group
Admin Group
Avatar

Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 836
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 22 June 2018 at 12:11pm
However if you say that bug with DockingPane control,  than I can say that bug the same as with XTP_POINT_FROM_LPARAM - signed/unsigned casting.
Back to Top
Sven View Drop Down
Senior Member
Senior Member


Joined: 21 August 2003
Location: Germany
Status: Offline
Points: 125
Post Options Post Options   Thanks (0) Thanks(0)   Quote Sven Quote  Post ReplyReply Direct Link To This Post Posted: 23 June 2018 at 2:18am
I have changed XTP_POINT_FROM_LPARAM to

#define XTP_POINT_FROM_LPARAM(lParam) CPoint(static_cast<short>(LOWORD(lParam)), static_cast<short>(HIWORD(lParam)))

The original non-typecast macro is also the reason, that buttons in themed frames (minimize, maximize, restore) can't be clicked if the main window is on the left monitor with negative coordinates.
Back to Top
olebed View Drop Down
Admin Group
Admin Group
Avatar

Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 836
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 23 June 2018 at 4:41am
Sven, yes hit test for frame buttons doesn't work due to signed-unsigned cast. But CPoint class has own constructor with initialization with LParam.
Back to Top
andredevries View Drop Down
Newbie
Newbie


Joined: 22 June 2018
Location: Netherlands
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote andredevries Quote  Post ReplyReply Direct Link To This Post Posted: 25 June 2018 at 4:47am
Thanks for your responses.
However, I still have difficulty to come to a solution. It sounds plausible that it may be a signed/unsigned casting issue, and it might be a conversion issue between LPARAM and Point. But when I search in the sources on XTP_POINT_FROM_LPARAM, I find nothing. Where is that macro defined? I could not find anything similar that may be a problem. Any more ideas?

Back to Top
olebed View Drop Down
Admin Group
Admin Group
Avatar

Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 836
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 25 June 2018 at 5:37am
XTP_POINT_FROM_LPARAM introduced in v18.4.

Unfortunately I can't reproduce your problem. Can you provide sample ?
I have monitors configuration of work station as you described except 4k (only fullHD).
Back to Top
andredevries View Drop Down
Newbie
Newbie


Joined: 22 June 2018
Location: Netherlands
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote andredevries Quote  Post ReplyReply Direct Link To This Post Posted: 25 June 2018 at 8:17am
Aha, I am using v18.3. I just tested the DockingPane samples, they work fine. Seems like I am doing something wrong here.
Unfortunately it is not so easy to isolate sources to provide an example (and I am not that familiar with it).
Could you tell me what gets triggered when moving a docking pane to a screen with other DPI?
Back to Top
olebed View Drop Down
Admin Group
Admin Group
Avatar

Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 836
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 25 June 2018 at 9:03am
see method  CXTPDockingPaneMiniWnd::UpdatePosition()

also for drawing used 
ToolkitPro1840UD.dll!CXTPDockingPaneOffice2013Theme::DrawFloatingFrame(CDC * pDC, CXTPDockingPaneMiniWnd * pPane, CRect rc) Line 298 C++
ToolkitPro1840UD.dll!CXTPDockingPaneMiniWnd::OnNcPaint() Line 699 C++
Back to Top
andredevries View Drop Down
Newbie
Newbie


Joined: 22 June 2018
Location: Netherlands
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote andredevries Quote  Post ReplyReply Direct Link To This Post Posted: 25 June 2018 at 10:58am
Thanks, but does not help so far. Debugger does not stop at any of those methods.
Will have to search further myself I guess. Thanks anyway.
Back to Top
Cedric_ar View Drop Down
Groupie
Groupie


Joined: 04 September 2012
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote Cedric_ar Quote  Post ReplyReply Direct Link To This Post Posted: 31 October 2018 at 1:23pm
hi,

I have the same issue. it's realy hard to switch pane to a different monitor with a different DPI. I have a monitor in 125% and another in 100%. 

I try to remove XTPWM_DOCKINGPANE_NOTIFY to test if the problem is on my side, but i have the same issue. the mainframe inherited from 

class CMainFrame:public CXTPMDIFrameWnd, CXTPCommandBarsFrameHook

i initialize the dockingpane manager like this

kPaneManager = new CXTPDockingPaneManager();
kPaneManager->InstallDockingPanes( AfxGetApp()->m_pMainWnd );
kPaneManager->SetTheme( /*xtpPaneThemeVisualStudio2005Beta1*/xtpPaneThemeVisualStudio2015 );
kPaneManager->SetAlphaDockingContext(TRUE);
kPaneManager->SetShowDockingContextStickers(/*TRUE*/(XTPDockingContextStickerStyle)xtpPaneStickerStyleVisualStudio2015Dark);

i'm on 18.5.0.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0.066 seconds.