Mouse wheel on the splitter = fun
Basile B. via Digitalmars-d-ide
digitalmars-d-ide at puremagic.com
Mon Jun 13 12:16:05 PDT 2016
I've recently added this to Coedit: the split between the widgets
can be srolled and the mouse pointer follows.
Then As I'm building a GUI framework in D I've added what's
necessary to reproduce it in D. It's fun with free mouse wheels.
https://vimeo.com/170517792
And it's stupid simple:
struct Mouse
{
private OsWindowHandle _winHdl;
/// Constructs an instance with the handle of the target
window.
this(OsWindowHandle winHdl)
{
_winHdl = winHdl;
}
/// Returns the mouse position as a point of int.
Point!int position() const
{
Point!int result;
version(linux)
{
int a,b;
uint c;
Window r,t;
XQueryPointer(display, _winHdl, &r, &t, &a, &b,
&result.x, &result.y, &c);
return result;
}
}
/// Sets the mouse position from a point.
void position(T)(Point!T value) const
if (isNumeric!T)
{
version(linux)
{
XWarpPointer(display, _winHdl, _winHdl, 0, 0, 0, 0,
cast(int) value.x, cast(int) value.y);
}
else static assert(0);
}
}
More information about the Digitalmars-d-ide
mailing list