void Card::dispatchButtonPress(const XEvent& ev) { static Time lastPressTime = 0; if (hilighted == _stack->topCard()) { hilighted->unhilighten(); hilighted = 0; if (ev.xbutton.time - lastPressTime < doubleClickInterval) { SingleStack* stack = emptySingleStack(); if (stack != 0) _stack->topCard()->moveToStack(stack); } } else if (hilighted != 0 && (hilighted->_stack == _stack) ) { hilighted->unhilighten(); hilighted = 0; } else if (hilighted == 0 && !_removed) { switch (ev.xbutton.button) { case 1: _stack->topCard()->hilighten(); hilighted = _stack->topCard(); lastPressTime = ev.xbutton.time; break; case 2: { SingleStack* stack = emptySingleStack(); if (stack != 0) _stack->topCard()->moveToStack(stack); } break; case 3: moveToAppropriateDoneStack(_stack->topCard()); break; } } else if (cursorChanged) { // cursorChanged == true means moving is possible. if (moveMode == SingleMode) { hilighted->unhilighten(); hilighted->moveToStack(_stack); hilighted = 0; XUndefineCursor(dpy, window()); cursorChanged = false; } else if (moveMode == MultipleMode) { hilighted->unhilighten(); moveMultipleCards(hilighted, _stack->topCard()); hilighted = 0; XUndefineCursor(dpy, window()); cursorChanged = false; } else { fprintf(stderr, "Bug in Card::dispatchButtonPress cursorChanged\n"); exit(1); } } }
void Card::dispatchButtonPress(const gi_msg_t& ev) { static time_t lastPressTime = 0; if (hilighted == _stack->topCard()) { _stack->topCard()->unhilighten(); hilighted = 0; //if (ev.xbutton.time - lastPressTime < doubleClickInterval) { if (ev.time - lastPressTime < doubleClickInterval) { SingleStack* stack = emptySingleStack(); if (stack != 0) _stack->topCard()->moveToStack(stack); } } else if (hilighted == 0 && !_removed) { switch (ev.params[2]) { case GI_BUTTON_L: _stack->topCard()->hilighten(); hilighted = _stack->topCard(); //lastPressTime = ev.xbutton.time; lastPressTime = ev.time; break; case GI_BUTTON_M: { SingleStack* stack = emptySingleStack(); if (stack != 0) _stack->topCard()->moveToStack(stack); } break; case GI_BUTTON_R: moveToAppropriateDoneStack(_stack->topCard()); break; } } else if (cursorChanged) { // cursorChanged == true means moving is possible. if (moveMode == SingleMode) { hilighted->unhilighten(); hilighted->moveToStack(_stack); hilighted = 0; UNDEFINE_CURSOR( window()); cursorChanged = false; } else if (moveMode == MultipleMode) { hilighted->unhilighten(); moveMultipleCards(hilighted, _stack->topCard()); hilighted = 0; UNDEFINE_CURSOR( window()); cursorChanged = false; } else { fprintf(stderr, "Bug in Card::dispatchButtonPress cursorChanged\n"); exit(1); } } }