NS_IMETHODIMP HttpChannelChild::Resume() { NS_ENSURE_TRUE(mIPCOpen, NS_ERROR_NOT_AVAILABLE); NS_ENSURE_TRUE(mSuspendCount > 0, NS_ERROR_UNEXPECTED); SendResume(); mSuspendCount--; if (!mSuspendCount) FlushEventQueue(); return NS_OK; }
NS_IMETHODIMP FTPChannelChild::Resume() { NS_ENSURE_TRUE(mIPCOpen, NS_ERROR_NOT_AVAILABLE); SendResume(); --mSuspendCount; if (!mSuspendCount) { if (mQueuePhase == PHASE_UNQUEUED) mQueuePhase = PHASE_FINISHED_QUEUEING; FlushEventQueue(); } return NS_OK; }
NS_IMETHODIMP HttpChannelChild::Resume() { NS_ENSURE_TRUE(mIPCOpen, NS_ERROR_NOT_AVAILABLE); NS_ENSURE_TRUE(mSuspendCount > 0, NS_ERROR_UNEXPECTED); SendResume(); mSuspendCount--; if (!mSuspendCount) { // If we were suspended outside of an event handler (bug 595972) we'll // consider ourselves unqueued. This is a legal state of affairs but // FlushEventQueue() can't easily ensure this fact, so we'll do some // fudging to set the invariants correctly. if (mQueuePhase == PHASE_UNQUEUED) mQueuePhase = PHASE_FINISHED_QUEUEING; FlushEventQueue(); } return NS_OK; }
static pascal OSStatus ControllerEventHandler (EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void *inUserData) { OSStatus err, result = eventNotHandledErr; WindowRef tWindowRef; tWindowRef = (WindowRef) inUserData; switch (GetEventClass(inEvent)) { case kEventClassWindow: switch (GetEventKind(inEvent)) { case kEventWindowClose: QuitAppModalLoopForWindow(tWindowRef); result = noErr; break; } break; case kEventClassCommand: switch (GetEventKind(inEvent)) { HICommand tHICommand; case kEventCommandUpdateStatus: err = GetEventParameter(inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &tHICommand); if (err == noErr && tHICommand.commandID == 'clos') { UpdateMenuCommandStatus(true); result = noErr; } break; case kEventCommandProcess: err = GetEventParameter(inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &tHICommand); if (err == noErr) { if (tHICommand.commandID == 'CLRa') { ClearPadSetting(); result = noErr; } else { SInt32 command = -1, count; for (count = 0; count < kNeedCount; count++) if (tHICommand.commandID == gControlIDs[count].signature) command = count; if (command >= 0) { pRecDevice pDevice; pRecElement pElement; FlushEventQueue(GetCurrentEventQueue()); if (HIDConfigureAction(&pDevice, &pElement, 2.5f)) { if (command < MAC_MAX_PLAYERS * 4) // Direction { int i = command >> 2; // Player long curv = HIDGetElementValue(pDevice, pElement); if (pElement->usage == kHIDUsage_GD_Hatswitch) // Hat Switch { gActionRecs[kUp(i)].fDevice = gActionRecs[kDn(i)].fDevice = gActionRecs[kLf(i)].fDevice = gActionRecs[kRt(i)].fDevice = pDevice; gActionRecs[kUp(i)].fElement = gActionRecs[kDn(i)].fElement = gActionRecs[kLf(i)].fElement = gActionRecs[kRt(i)].fElement = pElement; if (pDevice->vendorID == 1103) // Thrustmaster gDirectionInfo[i].type = (pElement->max > 4) ? kPadElemTypeOtherHat8 : kPadElemTypeOtherHat4; else { if (pElement->max > 4) { if (((command % 4 == 0) && (curv == 0)) || // Up : 0 ((command % 4 == 1) && (curv == 4)) || // Down : 4 ((command % 4 == 2) && (curv == 6)) || // Left : 6 ((command % 4 == 3) && (curv == 2))) // Right : 2 gDirectionInfo[i].type = kPadElemTypeOtherHat8; else gDirectionInfo[i].type = kPadElemTypeHat8; } else { if (((command % 4 == 0) && (curv == 0)) || // Up : 0 ((command % 4 == 1) && (curv == 2)) || // Down : 2 ((command % 4 == 2) && (curv == 3)) || // Left : 3 ((command % 4 == 3) && (curv == 1))) // Right : 1 gDirectionInfo[i].type = kPadElemTypeOtherHat4; else gDirectionInfo[i].type = kPadElemTypeHat4; } } gDirectionInfo[i].device [kPadHat] = pDevice; gDirectionInfo[i].element[kPadHat] = pElement; gDirectionInfo[i].max [kPadHat] = pElement->max; gDirectionInfo[i].min [kPadHat] = pElement->min; } else if (pElement->max - pElement->min > 1) // Axis (maybe) { if ((command % 4 == 0) || (command % 4 == 1)) // Up or Dn { gActionRecs[kUp(i)].fDevice = gActionRecs[kDn(i)].fDevice = pDevice; gActionRecs[kUp(i)].fElement = gActionRecs[kDn(i)].fElement = pElement; gDirectionInfo[i].type = kPadElemTypeAxis; gDirectionInfo[i].device [kPadYAxis] = pDevice; gDirectionInfo[i].element[kPadYAxis] = pElement; gDirectionInfo[i].max [kPadYAxis] = pElement->max; gDirectionInfo[i].min [kPadYAxis] = pElement->min; gDirectionInfo[i].mid [kPadYAxis] = (gDirectionInfo[i].max[kPadYAxis] + gDirectionInfo[i].min[kPadYAxis]) >> 1; gDirectionInfo[i].maxmid [kPadYAxis] = (gDirectionInfo[i].max[kPadYAxis] + gDirectionInfo[i].mid[kPadYAxis]) >> 1; gDirectionInfo[i].midmin [kPadYAxis] = (gDirectionInfo[i].mid[kPadYAxis] + gDirectionInfo[i].min[kPadYAxis]) >> 1; } else // Lf or Rt { gActionRecs[kLf(i)].fDevice = gActionRecs[kRt(i)].fDevice = pDevice; gActionRecs[kLf(i)].fElement = gActionRecs[kRt(i)].fElement = pElement; gDirectionInfo[i].type = kPadElemTypeAxis; gDirectionInfo[i].device [kPadXAxis] = pDevice; gDirectionInfo[i].element[kPadXAxis] = pElement; gDirectionInfo[i].max [kPadXAxis] = pElement->max; gDirectionInfo[i].min [kPadXAxis] = pElement->min; gDirectionInfo[i].mid [kPadXAxis] = (gDirectionInfo[i].max[kPadXAxis] + gDirectionInfo[i].min[kPadXAxis]) >> 1; gDirectionInfo[i].maxmid [kPadXAxis] = (gDirectionInfo[i].max[kPadXAxis] + gDirectionInfo[i].mid[kPadXAxis]) >> 1; gDirectionInfo[i].midmin [kPadXAxis] = (gDirectionInfo[i].mid[kPadXAxis] + gDirectionInfo[i].min[kPadXAxis]) >> 1; } } else // Button (maybe) { gActionRecs[command].fDevice = pDevice; gActionRecs[command].fElement = pElement; gDirectionInfo[i].type = kPadElemTypeButton; } gDirectionHint[i] = gDirectionInfo[i].type; } else { gActionRecs[command].fDevice = pDevice; gActionRecs[command].fElement = pElement; } }