Author: cazfi
Date: Tue Oct 27 21:47:18 2015
New Revision: 30251

URL: http://svn.gna.org/viewcvs/freeciv?rev=30251&view=rev
Log:
Accept city name suggestion with Enter in sdl2-client.

See patch #6477

Modified:
    trunk/client/gui-sdl2/mapctrl.c

Modified: trunk/client/gui-sdl2/mapctrl.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-sdl2/mapctrl.c?rev=30251&r1=30250&r2=30251&view=diff
==============================================================================
--- trunk/client/gui-sdl2/mapctrl.c     (original)
+++ trunk/client/gui-sdl2/mapctrl.c     Tue Oct 27 21:47:18 2015
@@ -2705,11 +2705,13 @@
 /**************************************************************************
   User interacted with the Ok button of the new city dialog.
 **************************************************************************/
-static int newcity_ok_callback(struct widget *pOk_Button)
-{
-  if (Main.event.button.button == SDL_BUTTON_LEFT) {
-
-    finish_city(pOk_Button->data.tile, 
pNewCity_Dlg->pBeginWidgetList->string_utf8->text);
+static int newcity_ok_callback(struct widget *ok_button)
+{
+  if (Main.event.type == SDL_KEYDOWN
+      || (Main.event.type == SDL_MOUSEBUTTONDOWN
+          && Main.event.button.button == SDL_BUTTON_LEFT)) {
+
+    finish_city(ok_button->data.tile, 
pNewCity_Dlg->pBeginWidgetList->string_utf8->text);
 
     popdown_window_group_dialog(pNewCity_Dlg->pBeginWidgetList,
                                 pNewCity_Dlg->pEndWidgetList);
@@ -2799,7 +2801,7 @@
     create_themeicon_button_from_chars(current_theme->Small_OK_Icon, 
pWindow->dst,
                                        _("OK"), adj_font(10), 0);
   pOK_Button->action = newcity_ok_callback;
-  pOK_Button->key = SDLK_RETURN;  
+  pOK_Button->key = SDLK_RETURN;
   pOK_Button->data.tile = unit_tile(pUnit);
 
   area.h += pOK_Button->size.h;


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

Reply via email to