void Viewer::mouseReleaseEvent(QMouseEvent* evt) { if (!readyForInteraction) { return; } lastEvt = evt; if (buttonMode) { buttonMode->release(getViewActionData(evt)); emit selectionMightBeChanged(); } buttonMode = getButtonAction(Qt::NoButton, evt->modifiers()); setCursor(buttonMode->getCursor()); buttonMode->click(getViewActionData(evt)); }
void Viewer::startHover() { if (!readyForInteraction) { return; } if (!lastEvt || !buttonMode) { qFatal("Must have a prior click/buttonMode before startHover is called."); return; } buttonMode->release(getViewActionData(lastEvt)); buttonMode = getButtonAction(Qt::NoButton, lastEvt->modifiers()); setCursor(buttonMode->getCursor()); buttonMode->click(getViewActionData(lastEvt)); }
static void showData(_Panel * panel) { char *str; int i; int a = -1, b = -1; float accel; char buffer[32]; Display *dpy = WMScreenDisplay(WMWidgetScreen(panel->parent)); for (i = 0; i < wlengthof(button_list); i++) { int action; str = GetStringForKey(button_list[i].db_key); if (button_list[i].type == T_BUTTON) action = getButtonAction(str); else action = getWheelAction(str); if (action < 0) { if (action == -1) wwarning(_("bad value %s for option %s"), str, button_list[i].db_key); action = button_list[i].default_action; } WMSetPopUpButtonSelectedItem(panel->mouse_action[i].popup, action); } WMSetButtonSelected(panel->disaB, GetBoolForKey("DisableWSMouseActions")); toggle_disabling_of_mouse_actions(panel->disaB, panel); /**/ getMouseParameters(dpy, &accel, &a); panel->maxThreshold = WidthOfScreen(DefaultScreenOfDisplay(dpy)); if (a > panel->maxThreshold) { panel->maxThreshold = a; } sprintf(buffer, "%i", a); WMSetTextFieldText(panel->threT, buffer); WMSetSliderValue(panel->speedS, (accel - 0.25F) / 0.25F); panel->acceleration = accel; sprintf(buffer, "%.2f", (double)accel); WMSetTextFieldText(panel->acceT, buffer); /**/ b = GetIntegerForKey("DoubleClickTime"); /* find best match */ a = -1; for (i = 0; i < wlengthof(panel->ddelaB); i++) { if (DELAY(i) == b) a = i; } if (a >= 0) WMPerformButtonClick(panel->ddelaB[a]); sprintf(buffer, "%i", b); WMSetTextFieldText(panel->ddelaT, buffer); /**/ str = GetStringForKey("ModifierKey"); if (!str) str = "mod1"; a = ModifierFromKey(dpy, str); if (a != -1) { str = modifierNames[a]; a = 0; for (i = 0; i < WMGetPopUpButtonNumberOfItems(panel->grabP); i++) { if (strstr(WMGetPopUpButtonItem(panel->grabP, i), str)) { WMSetPopUpButtonSelectedItem(panel->grabP, i); a = 1; break; } } } if (a < 1) { char *previous; previous = WMGetPopUpButtonItem(panel->grabP, 0); if (previous != NULL) WMSetPopUpButtonSelectedItem(panel->grabP, 0); wwarning(_("modifier key %s for option ModifierKey was not recognized. Using %s as default"), str, previous?previous:"(empty)"); } }