Author: cazfi
Date: Wed Nov  4 19:41:11 2015
New Revision: 30409

URL: http://svn.gna.org/viewcvs/freeciv?rev=30409&view=rev
Log:
Set password from sdl2-client edit widget to password to send when Enter pressed

See patch #6514

Modified:
    branches/S2_6/client/gui-sdl2/connectdlg.c

Modified: branches/S2_6/client/gui-sdl2/connectdlg.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-sdl2/connectdlg.c?rev=30409&r1=30408&r2=30409&view=diff
==============================================================================
--- branches/S2_6/client/gui-sdl2/connectdlg.c  (original)
+++ branches/S2_6/client/gui-sdl2/connectdlg.c  Wed Nov  4 19:41:11 2015
@@ -722,7 +722,9 @@
 **************************************************************************/
 static int convert_passwd_callback(struct widget *pWidget)
 {
-  if (Main.event.button.button == SDL_BUTTON_LEFT) {
+  if (Main.event.type == SDL_KEYDOWN
+      || (Main.event.type == SDL_MOUSEBUTTONDOWN
+          && Main.event.button.button == SDL_BUTTON_LEFT)) {
     if (pWidget->string_utf8->text != NULL) {
       fc_snprintf(password, MAX_LEN_NAME, "%s", pWidget->string_utf8->text);
     }
@@ -911,9 +913,11 @@
 /**************************************************************************
   Verify Password
 **************************************************************************/
-static int convert_secound_passwd_callback(struct widget *pWidget)
-{
-  if (Main.event.button.button == SDL_BUTTON_LEFT) {
+static int convert_second_passwd_callback(struct widget *pWidget)
+{
+  if (Main.event.type == SDL_KEYDOWN
+      || (Main.event.type == SDL_MOUSEBUTTONDOWN
+          && Main.event.button.button == SDL_BUTTON_LEFT)) {
     if (pWidget->string_utf8->text != NULL
         && !strncmp(password, pWidget->string_utf8->text, MAX_LEN_NAME)) {
       set_wstate(pWidget->prev, FC_WS_NORMAL); /* next button */
@@ -977,7 +981,7 @@
   pBuf = create_edit(NULL, pWindow->dst, create_utf8_str(NULL, 0, 
adj_font(16)),
                      adj_size(210),
                      (WF_PASSWD_EDIT|WF_RESTORE_BACKGROUND|WF_FREE_DATA));
-  pBuf->action = convert_secound_passwd_callback;
+  pBuf->action = convert_second_passwd_callback;
   add_to_gui_list(ID_EDIT, pBuf);
   area.h += pBuf->size.h + adj_size(10);
 


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to