/** Handle a mouse button release event. */ char HandleDialogButtonRelease(const XButtonEvent *event) { Assert(event); if(dialog && event->window == dialog->node->window) { char cancelPressed = 0; char okPressed = 0; const int y = event->y; if(y >= dialog->buttony && y < dialog->buttony + dialog->buttonHeight) { const int x = event->x; if(x >= dialog->okx && x < dialog->okx + dialog->buttonWidth) { okPressed = 1; } else if(x >= dialog->cancelx && x < dialog->cancelx + dialog->buttonWidth) { cancelPressed = 1; } } if(okPressed) { RunDialogAction(); } if(cancelPressed || okPressed) { DestroyConfirmDialog(); } else { dialog->buttonState = DBS_NORMAL; DrawButtons(); ExposeConfirmDialog(); } return 1; } else { if(dialog) { if(dialog->buttonState != DBS_NORMAL) { dialog->buttonState = DBS_NORMAL; DrawButtons(); ExposeConfirmDialog(); } } return 0; } }
/** Handle a key press. */ char HandleDialogKeyPress(const XKeyEvent *event) { if(dialog && event->window == dialog->node->window) { KeyType key = GetKey(event); switch(key & 0xFF) { case KEY_ENTER: RunDialogAction(); DestroyConfirmDialog(); break; case KEY_ESC: DestroyConfirmDialog(); break; default: break; } return 1; } else { return 0; } }
/** Handle a key press. */ char HandleDialogKeyPress(const XKeyEvent *event) { if(dialog && event->window == dialog->node->window) { const ActionType key = GetKey(MC_NONE, event->state, event->keycode); switch(key.action) { case ACTION_ENTER: RunDialogAction(); DestroyConfirmDialog(); break; case ACTION_ESC: DestroyConfirmDialog(); break; default: break; } return 1; } else { return 0; } }