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;
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
// 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->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->VScrollPos = gtk_adjustment_get_value(ap->va);
|
||||
|
||||
|
|
|
@ -127,11 +127,11 @@ enum uiModifiers {
|
|||
};
|
||||
|
||||
struct uiAreaMouseEvent {
|
||||
// notes:
|
||||
// - relative to content rect
|
||||
intmax_t X;
|
||||
intmax_t Y;
|
||||
|
||||
intmax_t ClientWidth;
|
||||
intmax_t ClientHeight;
|
||||
intmax_t HScrollPos;
|
||||
intmax_t VScrollPos;
|
||||
|
||||
|
|
|
@ -145,6 +145,7 @@ struct uiArea {
|
|||
return YES;
|
||||
}
|
||||
|
||||
// capture on drag is done automatically on OS X
|
||||
- (void)doMouseEvent:(NSEvent *)e
|
||||
{
|
||||
uiAreaMouseEvent me;
|
||||
|
@ -159,10 +160,11 @@ struct uiArea {
|
|||
point = [self convertPoint:[e locationInWindow] fromView:nil];
|
||||
me.X = point.x;
|
||||
me.Y = point.y;
|
||||
|
||||
me.ClientWidth = [self frame].size.width;
|
||||
me.ClientHeight = [self frame].size.height;
|
||||
me.HScrollPos = [av hscrollPos];
|
||||
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;
|
||||
// swap button numbers 2 and 3 (right and middle)
|
||||
|
|
|
@ -127,11 +127,11 @@ enum uiModifiers {
|
|||
};
|
||||
|
||||
struct uiAreaMouseEvent {
|
||||
// notes:
|
||||
// - relative to content rect
|
||||
intmax_t X;
|
||||
intmax_t Y;
|
||||
|
||||
intmax_t ClientWidth;
|
||||
intmax_t ClientHeight;
|
||||
intmax_t HScrollPos;
|
||||
intmax_t VScrollPos;
|
||||
|
||||
|
|
|
@ -272,10 +272,15 @@ static void areaMouseEvent(uiArea *a, uintmax_t down, uintmax_t up, WPARAM wPar
|
|||
{
|
||||
uiAreaMouseEvent me;
|
||||
uintmax_t button;
|
||||
RECT r;
|
||||
|
||||
me.X = GET_X_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.VScrollPos = a->vscrollpos;
|
||||
|
||||
|
|
|
@ -127,11 +127,11 @@ enum uiModifiers {
|
|||
};
|
||||
|
||||
struct uiAreaMouseEvent {
|
||||
// notes:
|
||||
// - relative to content rect
|
||||
intmax_t X;
|
||||
intmax_t Y;
|
||||
|
||||
intmax_t ClientWidth;
|
||||
intmax_t ClientHeight;
|
||||
intmax_t HScrollPos;
|
||||
intmax_t VScrollPos;
|
||||
|
||||
|
|
Loading…
Reference in New Issue