SFML community forums

Help => Window => Topic started by: Redee on June 26, 2015, 10:04:08 am

Title: Possibly issue ??
Post by: Redee on June 26, 2015, 10:04:08 am
LOWORD / HIWORD.........
https://github.com/SFML/SFML/blob/master/src/SFML/Window/Win32/WindowImplWin32.cpp#L833

Msdn Warning !!! >
https://msdn.microsoft.com/en-us/library/windows/desktop/ms645616%28v=vs.85%29.aspx
Quote
Important  Do not use the LOWORD or HIWORD macros to extract the x- and y- coordinates of the cursor position because these macros return incorrect results on systems with multiple monitors. Systems with multiple monitors can have negative x- and y- coordinates, and LOWORD and HIWORD treat the coordinates as unsigned quantities.
Title: Re: Possibly issue ??
Post by: Laurent on June 26, 2015, 10:32:32 am
https://github.com/SFML/SFML/pull/904
Title: Re: Possibly issue ??
Post by: Redee on June 26, 2015, 02:49:20 pm
You can do this manualy read / write bytes for 2 numbers without Windowsx.h header !!!
Title: Re: Possibly issue ??
Post by: Laurent on June 26, 2015, 03:17:26 pm
Yes, that's what the current implementation does.
Title: Re: Possibly issue ??
Post by: Redee on June 26, 2015, 03:34:46 pm
I no see in 2.3.x branch any changes.
https://github.com/SFML/SFML/blob/2.3.x/src/SFML/Window/Win32/WindowImplWin32.cpp#L673

And WORD / DWORD types its unsigned types.
We need read / write as > int.
Title: Re: Possibly issue ??
Post by: eXpl0it3r on June 26, 2015, 03:47:13 pm
Do you actually have an issue or do you just make a fuss about something you read while not really understanding what the code base does? ::)
Title: Re: Possibly issue ??
Post by: Redee on June 26, 2015, 05:25:11 pm
There said we can get negative numbers, I said above convert to DWORD or WORD its unsigned types.

You tested at 2 monitors (1st half of window at first monitor, 2nd half at second monitor) ?
75% of all questions unfortunately  I fixing alone.

What prevent to simply write like this ? >
int Num = (int)lparam;
Int16 x = (Int16)(Num << 16 >> 16);
Int16 y = (Int16)(Num >> 16);
Title: Re: Possibly issue ??
Post by: eXpl0it3r on June 26, 2015, 06:01:28 pm
You did not answer the question. Do you have an issue or not? ;)
Title: Re: Possibly issue ??
Post by: Laurent on June 26, 2015, 06:04:28 pm
To be clear: the code in SFML is exactly what the suggested macros would do.