Added a ClientWidth and ClientHeight fields to uiAreaMouseEvent. This is necessary for the updated dragging behavior, since both GTK+ and OS X do it: drags automatically capture.
This commit is contained in:
parent
aa171bd4a3
commit
848eff27e7
|
@ -188,6 +188,7 @@ static uiModifiers toModifiers(guint state)
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// capture on drag is done automatically on GTK+
|
||||||
static void finishMouseEvent(struct areaPrivate *ap, uiAreaMouseEvent *me, guint mb, gdouble x, gdouble y, guint state, GdkWindow *window)
|
static void finishMouseEvent(struct areaPrivate *ap, uiAreaMouseEvent *me, guint mb, gdouble x, gdouble y, guint state, GdkWindow *window)
|
||||||
{
|
{
|
||||||
// on GTK+, mouse buttons 4-7 are for scrolling; if we got here, that's a mistake
|
// on GTK+, mouse buttons 4-7 are for scrolling; if we got here, that's a mistake
|
||||||
|
@ -215,7 +216,9 @@ static void finishMouseEvent(struct areaPrivate *ap, uiAreaMouseEvent *me, guint
|
||||||
|
|
||||||
me->X = x;
|
me->X = x;
|
||||||
me->Y = y;
|
me->Y = y;
|
||||||
// do not cap to the area bounds in the case of captures
|
|
||||||
|
me->ClientWidth = ap->clientWidth;
|
||||||
|
me->ClientHeight = ap->clientHeight;
|
||||||
me->HScrollPos = gtk_adjustment_get_value(ap->ha);
|
me->HScrollPos = gtk_adjustment_get_value(ap->ha);
|
||||||
me->VScrollPos = gtk_adjustment_get_value(ap->va);
|
me->VScrollPos = gtk_adjustment_get_value(ap->va);
|
||||||
|
|
||||||
|
|
|
@ -127,11 +127,11 @@ enum uiModifiers {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct uiAreaMouseEvent {
|
struct uiAreaMouseEvent {
|
||||||
// notes:
|
|
||||||
// - relative to content rect
|
|
||||||
intmax_t X;
|
intmax_t X;
|
||||||
intmax_t Y;
|
intmax_t Y;
|
||||||
|
|
||||||
|
intmax_t ClientWidth;
|
||||||
|
intmax_t ClientHeight;
|
||||||
intmax_t HScrollPos;
|
intmax_t HScrollPos;
|
||||||
intmax_t VScrollPos;
|
intmax_t VScrollPos;
|
||||||
|
|
||||||
|
|
|
@ -145,6 +145,7 @@ struct uiArea {
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// capture on drag is done automatically on OS X
|
||||||
- (void)doMouseEvent:(NSEvent *)e
|
- (void)doMouseEvent:(NSEvent *)e
|
||||||
{
|
{
|
||||||
uiAreaMouseEvent me;
|
uiAreaMouseEvent me;
|
||||||
|
@ -159,10 +160,11 @@ struct uiArea {
|
||||||
point = [self convertPoint:[e locationInWindow] fromView:nil];
|
point = [self convertPoint:[e locationInWindow] fromView:nil];
|
||||||
me.X = point.x;
|
me.X = point.x;
|
||||||
me.Y = point.y;
|
me.Y = point.y;
|
||||||
|
|
||||||
|
me.ClientWidth = [self frame].size.width;
|
||||||
|
me.ClientHeight = [self frame].size.height;
|
||||||
me.HScrollPos = [av hscrollPos];
|
me.HScrollPos = [av hscrollPos];
|
||||||
me.VScrollPos = [av vscrollPos];
|
me.VScrollPos = [av vscrollPos];
|
||||||
// don't clip to outside the view in the case of captures
|
|
||||||
// TODO cocoa captures automatically on a drag?
|
|
||||||
|
|
||||||
buttonNumber = [e buttonNumber] + 1;
|
buttonNumber = [e buttonNumber] + 1;
|
||||||
// swap button numbers 2 and 3 (right and middle)
|
// swap button numbers 2 and 3 (right and middle)
|
||||||
|
|
|
@ -127,11 +127,11 @@ enum uiModifiers {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct uiAreaMouseEvent {
|
struct uiAreaMouseEvent {
|
||||||
// notes:
|
|
||||||
// - relative to content rect
|
|
||||||
intmax_t X;
|
intmax_t X;
|
||||||
intmax_t Y;
|
intmax_t Y;
|
||||||
|
|
||||||
|
intmax_t ClientWidth;
|
||||||
|
intmax_t ClientHeight;
|
||||||
intmax_t HScrollPos;
|
intmax_t HScrollPos;
|
||||||
intmax_t VScrollPos;
|
intmax_t VScrollPos;
|
||||||
|
|
||||||
|
|
|
@ -272,10 +272,15 @@ static void areaMouseEvent(uiArea *a, uintmax_t down, uintmax_t up, WPARAM wPar
|
||||||
{
|
{
|
||||||
uiAreaMouseEvent me;
|
uiAreaMouseEvent me;
|
||||||
uintmax_t button;
|
uintmax_t button;
|
||||||
|
RECT r;
|
||||||
|
|
||||||
me.X = GET_X_LPARAM(lParam);
|
me.X = GET_X_LPARAM(lParam);
|
||||||
me.Y = GET_Y_LPARAM(lParam);
|
me.Y = GET_Y_LPARAM(lParam);
|
||||||
// do not cap to the client rect in the case of a capture
|
|
||||||
|
if (GetClientRect(a->hwnd, &r) == 0)
|
||||||
|
logLastError("error getting client rect of area in areaMouseEvent()");
|
||||||
|
me.ClientWidth = r.right - r.left;
|
||||||
|
me.ClientHeight = r.bottom - r.top;
|
||||||
me.HScrollPos = a->hscrollpos;
|
me.HScrollPos = a->hscrollpos;
|
||||||
me.VScrollPos = a->vscrollpos;
|
me.VScrollPos = a->vscrollpos;
|
||||||
|
|
||||||
|
|
|
@ -127,11 +127,11 @@ enum uiModifiers {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct uiAreaMouseEvent {
|
struct uiAreaMouseEvent {
|
||||||
// notes:
|
|
||||||
// - relative to content rect
|
|
||||||
intmax_t X;
|
intmax_t X;
|
||||||
intmax_t Y;
|
intmax_t Y;
|
||||||
|
|
||||||
|
intmax_t ClientWidth;
|
||||||
|
intmax_t ClientHeight;
|
||||||
intmax_t HScrollPos;
|
intmax_t HScrollPos;
|
||||||
intmax_t VScrollPos;
|
intmax_t VScrollPos;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue