Closed keigen-shu closed 9 years ago
I like this. Much clearer It has the additional bonus benefit for myself, when writing directly to the GraphicContext (avoiding Canvas) - It is now clear what type of mouse coordinates InputEvent/InputDevice returns.
I like this patch except for the fact that the default functions (get_position, etc) return DDP pixels rather than DIP. It really should be the other way around. get_position() should return a DIP float while a get_ddp_position() style function should return the integer variant.
Since there seems to be a lot of disagreement between you, me and Rombust about this, I wrote a small article about why DDP positioning shouldn't be the default:
dpjudas, that is a good article that you have written. I now fully understand.
It is going to take me a while to get used to it. But that's the problem with me being an old style programmer (as the "old dog new tricks" saying goes)!
I understand. I used the old convention to follow what GraphicContext does (get_size() is DDP), but I guess the reason behind that is different than this. I'll close this PR and make a new one without the merge conflict.
The unit used for mouse positioning was switched from Device Dependent Pixel (hardware pixel unit) to Device Independent Pixel (DPI-scaled pixel unit) in the DPR patch on January. This commit brings back DDP positioning for pointing devices and adds DIP positioning into clan::InputDevice as separate functions.
InputDevice::get_position()
andInputEvent::mouse_pos
are in integer hardware pixel units like in ClanLib 3.x.InputDevice::get_dip_position()
andInputEvent::mouse_dip_pos
are in the new floating-point DIP pixel unit.Note that the UI API has not changed at all; the module still uses DIP unit on everything. PointerEvent's pos() and set_pos() uses the DIP unit.
P/S: Implemented for Linux and Windows; only tested on Linux. I also removed Doxygen comments and added override keyword on the member functions of InputDeviceProvider implementors