[Scummvm-git-logs] scummvm master -> 079330547048d11ab0151ef6e100d66e3902b96a

a-yyg 76591232+a-yyg at users.noreply.github.com
Fri Aug 13 13:17:36 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
0793305470 SAGA2: Fix Return and Escape keys on gTextBox


Commit: 079330547048d11ab0151ef6e100d66e3902b96a
    https://github.com/scummvm/scummvm/commit/079330547048d11ab0151ef6e100d66e3902b96a
Author: a/ (yuri.kgpps at gmail.com)
Date: 2021-08-13T22:17:21+09:00

Commit Message:
SAGA2: Fix Return and Escape keys on gTextBox

Changed paths:
    engines/saga2/gtextbox.cpp


diff --git a/engines/saga2/gtextbox.cpp b/engines/saga2/gtextbox.cpp
index 9da96076a7..119200d948 100644
--- a/engines/saga2/gtextbox.cpp
+++ b/engines/saga2/gtextbox.cpp
@@ -670,7 +670,38 @@ bool gTextBox::keyStroke(gPanelMessage &msg) {
 		return true;
 	}
 
-	if (editing) {
+	if (key == Common::ASCII_RETURN) { // return key
+		if (editing) {
+			commitEdit();
+			if (!(flags & textBoxStayActive))
+				deactivate();                       // deactivate the text box
+		}
+
+		if (onEnter != NULL) {
+			gEvent ev;
+			ev.eventType = gEventKeyDown ;
+			ev.value = 1;
+			ev.panel = parent;
+			(*onEnter)(ev);
+		}
+
+		return true;
+	} else if (key == Common::ASCII_ESCAPE) {               // escape key
+		revertEdit();
+		deactivate();                       // deactivate the text box
+		if (onEscape != NULL) {
+			gEvent ev;
+			ev.eventType = gEventKeyDown ;
+			ev.value = 1;
+			ev.value = 1;
+			ev.panel = this; //parent;
+			(*onEscape)(ev);
+		}
+
+		if (flags & textBoxNoFilter)
+			return false;
+		return true;
+	} else if (editing) {
 		switch (key) {
 		case Common::KEYCODE_LEFT:
 			if (anchorPos > 0)
@@ -763,37 +794,6 @@ bool gTextBox::keyStroke(gPanelMessage &msg) {
 
 			break;
 		}
-	} else if (key == Common::ASCII_RETURN) { // return key
-		if (editing) {
-			commitEdit();
-			if (!(flags & textBoxStayActive))
-				deactivate();                       // deactivate the text box
-		}
-
-		if (onEnter != NULL) {
-			gEvent ev;
-			ev.eventType = gEventKeyDown ;
-			ev.value = 1;
-			ev.panel = parent;
-			(*onEnter)(ev);
-		}
-
-		return true;
-	} else if (key == Common::ASCII_ESCAPE) {               // escape key
-		revertEdit();
-		deactivate();                       // deactivate the text box
-		if (onEscape != NULL) {
-			gEvent ev;
-			ev.eventType = gEventKeyDown ;
-			ev.value = 1;
-			ev.value = 1;
-			ev.panel = this; //parent;
-			(*onEscape)(ev);
-		}
-
-		if (flags & textBoxNoFilter)
-			return false;
-		return true;
 	}
 
 	if (editing) {




More information about the Scummvm-git-logs mailing list