From: FruitieX Date: Thu, 10 Jun 2010 00:19:20 +0000 (+0300) Subject: check for doubleclicks for future menu communication, just print a string for now X-Git-Tag: xonotic-v0.1.0preview~541^2~69^2~2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9a079d3b2bf331e1c66a9a8d6445eabc3276035b;p=xonotic%2Fxonotic-data.pk3dir.git check for doubleclicks for future menu communication, just print a string for now --- diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 7d87df8f7..ab59b5c23 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -1161,6 +1161,8 @@ void HUD_Panel_SetPosSize(float id, vector resizeorigin) float mouseClicked; float prevMouseClicked; // previous state +float prevMouseClickedTime; // time during previous mouse click, to check for doubleclicks +vector prevMouseClickedPos; // pos during previous mouse click, to check for doubleclicks float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary) { if(!hud_configure) @@ -1218,6 +1220,13 @@ void HUD_Panel_Mouse() if(mouseClicked) { + if(time - prevMouseClickedTime < 0.4 && prevMouseClicked == 0 && prevMouseClickedPos == mousepos) + { + mouseClicked = 0; // to prevent spam, I guess. + print("Doubleclick!\n"); + return; + } + float i, border; vector panelPos; vector panelSize; @@ -1228,6 +1237,9 @@ void HUD_Panel_Mouse() panelSize = HUD_Panel_GetSize(i); border = HUD_Panel_GetBorder(i); if(prevMouseClicked == 0) { + prevMouseClickedTime = time; + prevMouseClickedPos = mousepos; + // move if(mousepos_x >= panelPos_x && mousepos_y >= panelPos_y && mousepos_x <= panelPos_x + panelSize_x && mousepos_y <= panelPos_y + panelSize_y) {