Explorar el Código

Fix ngui button release tracking

Johannes Zellner hace 2 semanas
padre
commit
9cfa9d9b39
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  1. 5 1
      ngui.c

+ 5 - 1
ngui.c

@@ -249,7 +249,11 @@ void ngui_end_ex(struct ngui *ui, int present)
 
 	if (ui->clicked && !ui->focus_claimed)
 		ui->focus = 0;
-	if (ui->released || !ui->buttons)
+	/* Only the release edge ends a press.  The sampled button state is not
+	 * synchronized with the event queue: it can read 0 for a frame before
+	 * the release event is delivered.  Clearing active on "!buttons" made
+	 * clicks fire only when the two happened to land in the same frame. */
+	if (ui->released)
 		ui->active = 0;
 
 	ui->pressed = ui->released = 0;