I'm in currently trying to decouple Display and Mouse -- specifically "display_hwnd" and "clientSize". "display_hwnd" is not much of a problem, but "clientSize" currently is.
"clientSize" is used in Mouse.cpp:getScreenClientRect(). Some smart person wrote the two lines:
clientRect->top = -clientSize.top + windowRect->top;
clientRect->left = -clientSize.left + windowRect->left;
Unfortunately, this smart person felt the need to keep the
reason a secret. Why? I don't know. Programmers like to keep secrets, I guess. Whoever wrote this knew why it was necessary at the time and could have jotted it down to help future generations but I digress.
From org_lwjgl_input_Display.cpp we see that:
// If we're not a fullscreen window, adjust the height to account for the
// height of the title bar (unless undecorated)
clientSize.bottom = height;
clientSize.left = 0;
clientSize.right = width;
clientSize.top = 0;
AdjustWindowRectEx(
&clientSize, // client-rectangle structure
windowflags, // window styles
FALSE, // menu-present option
exstyle // extended window style
);
(Yay! A comment!) where "height" and "width" are the user desired values for the client area (the drawing area). AdjustWindowRectEx(), as I understand it, changes "clientSize" such that it includes any window decorations. To me, "clientSize" is now GetWindowRect() but given Display.cpp:getGDICursorDelta() it doesn't seem that it can be. Any help here would be appreciated.
I thought that I would just T&E (trial and error) this problem out of existance so I turned to MouseTest to get a baseline of current functionality and I noticed the following:
dx=0, dy=0 | dx=a, dy=0 | dx=0, dy=0
x=0, y=h | x=i, y=h | x=w, y=h
------------+--------------+------------
dx=0, dy=b | dx=a, dy=b | dx=0, dy=b
x=0, y=j | x=i, y=j | x=w, y=j
------------+--------------+------------
dx=0, dy=0 | dx=a, dy=0 | dx=0, dy=0
x=0, y=0 | x=i, y=0 | x=w, y=h
where "h" is the height - 1, "w" is the width - 1, "a", "b" and "i", "j" are non-zero values and "0" means never non-zero when the mouse is moved in the quadrant. It appears that "dx", "dy" and "x", "y" are only defined within the bounds of the window (which is fine -- but it's not doc'd this way).
The long and the short of this is that I can't "fix" (i.e. remove "clientSize" from) Mouse.cpp:getScreenClientRect() until I know what the expected behavior of Mouse.getX(), .getY(), .getDX() and .getDY() are in a windowed situation.