~ubuntu-branches/ubuntu/precise/xorg-server/precise-updates

« back to all changes in this revision

Viewing changes to hw/xquartz/X11Application.m

Tags: 2:1.10.1-2
* Build xserver-xorg-core-udeb on hurd-i386.  Thanks, Samuel Thibault!
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1050
1050
}
1051
1051
#endif
1052
1052
 
 
1053
#ifdef DEBUG_UNTRUSTED_POINTER_DELTA
 
1054
static const char *untrusted_str(NSEvent *e) {
 
1055
    switch([e type]) {
 
1056
        case NSScrollWheel:
 
1057
            return "NSScrollWheel";
 
1058
        case NSTabletPoint:
 
1059
            return "NSTabletPoint";
 
1060
        case NSOtherMouseDown:
 
1061
            return "NSOtherMouseDown";
 
1062
        case NSOtherMouseUp:
 
1063
            return "NSOtherMouseUp";
 
1064
        case NSLeftMouseDown:
 
1065
            return "NSLeftMouseDown";
 
1066
        case NSLeftMouseUp:
 
1067
            return "NSLeftMouseUp";
 
1068
        default:
 
1069
            switch([e subtype]) {
 
1070
                case NSTabletPointEventSubtype:
 
1071
                    return "NSTabletPointEventSubtype";
 
1072
                case NSTabletProximityEventSubtype:
 
1073
                    return "NSTabletProximityEventSubtype";
 
1074
                default:
 
1075
                    return "Other";
 
1076
            }
 
1077
    }
 
1078
}
 
1079
#endif
 
1080
 
1053
1081
- (void) sendX11NSEvent:(NSEvent *)e {
1054
1082
    NSPoint location = NSZeroPoint, tilt = NSZeroPoint;
1055
1083
    int ev_button, ev_type;
1087
1115
        // The deltaXY for scroll events correspond to the scroll delta, not the pointer delta
1088
1116
        // <rdar://problem/7989690> deltaXY for wheel events are being sent as mouse movement
1089
1117
        hasUntrustedPointerDelta = hasUntrustedPointerDelta || [e type] == NSScrollWheel;
 
1118
 
 
1119
#ifdef DEBUG_UNTRUSTED_POINTER_DELTA
 
1120
        hasUntrustedPointerDelta = hasUntrustedPointerDelta || [e type] == NSLeftMouseDown || [e type] == NSLeftMouseUp;
 
1121
#endif
1090
1122
        
1091
1123
        if (window != nil)      {
1092
1124
            NSRect frame = [window frame];
1095
1127
            location.y += frame.origin.y;
1096
1128
            lastpt = location;
1097
1129
        } else if(hasUntrustedPointerDelta) {
 
1130
#ifdef DEBUG_UNTRUSTED_POINTER_DELTA
 
1131
            ErrorF("--- Begin Event Debug ---\n");
 
1132
            ErrorF("Event type: %s\n", untrusted_str(e));
 
1133
            ErrorF("old lastpt: (%0.2f, %0.2f)\n", lastpt.x, lastpt.y);
 
1134
            ErrorF("     delta: (%0.2f, %0.2f)\n", [e deltaX], -[e deltaY]);
 
1135
            ErrorF("  location: (%0.2f, %0.2f)\n", lastpt.x + [e deltaX], lastpt.y - [e deltaY]);
 
1136
            ErrorF("workaround: (%0.2f, %0.2f)\n", [e locationInWindow].x, [e locationInWindow].y);
 
1137
            ErrorF("--- End Event Debug ---\n");
 
1138
 
 
1139
            location.x = lastpt.x + [e deltaX];
 
1140
            location.y = lastpt.y - [e deltaY];
 
1141
            lastpt = [e locationInWindow];
 
1142
#else
1098
1143
            location = [e locationInWindow];
1099
1144
            lastpt = location;
 
1145
#endif
1100
1146
        } else {
1101
1147
            location.x = lastpt.x + [e deltaX];
1102
1148
            location.y = lastpt.y - [e deltaY];