Author: mir3x
Date: Wed Jan 11 19:16:52 2017
New Revision: 34813

URL: http://svn.gna.org/viewcvs/freeciv?rev=34813&view=rev
Log:
Qt client - fix keyboard goto

See bug #25419


Modified:
    trunk/client/gui-qt/mapctrl.cpp
    trunk/client/gui-qt/mapview.cpp
    trunk/client/gui-qt/mapview.h
    trunk/client/gui-qt/menu.cpp

Modified: trunk/client/gui-qt/mapctrl.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/mapctrl.cpp?rev=34813&r1=34812&r2=34813&view=diff
==============================================================================
--- trunk/client/gui-qt/mapctrl.cpp     (original)
+++ trunk/client/gui-qt/mapctrl.cpp     Wed Jan 11 19:16:52 2017
@@ -387,7 +387,9 @@
   }
   sc = fc_shortcuts::sc()->get_shortcut(SC_SELECT_BUTTON);
   if (((key && key == sc->key) || bt == sc->mouse) && md == sc->mod) {
-    action_button_pressed(pos.x(), pos.y(), SELECT_FOCUS);
+    if (goto_is_active() == false && pcity == nullptr) {
+      action_button_pressed(pos.x(), pos.y(), SELECT_FOCUS);
+    }
     return;
   }
 
@@ -424,11 +426,14 @@
 
   sc = fc_shortcuts::sc()->get_shortcut(SC_SELECT_BUTTON);
   if (bt == sc->mouse && md == sc->mod) {
-    if (keyboardless_goto_active) {
-      release_goto_button(pos.x(), pos.y());
-    } else {
+    if (menu_click == true) {
+      menu_click = false;
+      return;
+    }
+    if (keyboardless_goto_active == false || goto_is_active() == true) {
       action_button_pressed(pos.x(), pos.y(), SELECT_POPUP);
     }
+    release_goto_button(pos.x(), pos.y());
     return;
   }
 }

Modified: trunk/client/gui-qt/mapview.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/mapview.cpp?rev=34813&r1=34812&r2=34813&view=diff
==============================================================================
--- trunk/client/gui-qt/mapview.cpp     (original)
+++ trunk/client/gui-qt/mapview.cpp     Wed Jan 11 19:16:52 2017
@@ -174,6 +174,7 @@
 **************************************************************************/
 map_view::map_view() : QWidget()
 {
+  menu_click = false;
   cursor = -1;
   QTimer *timer = new QTimer(this);
   setAttribute(Qt::WA_OpaquePaintEvent, true);

Modified: trunk/client/gui-qt/mapview.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/mapview.h?rev=34813&r1=34812&r2=34813&view=diff
==============================================================================
--- trunk/client/gui-qt/mapview.h       (original)
+++ trunk/client/gui-qt/mapview.h       Wed Jan 11 19:16:52 2017
@@ -90,6 +90,7 @@
   void resume_searching(int pos_x,int pos_y,int &w, int &h,
                         int wdtht, int hght, int recursive_nr);
   void update_cursor(enum cursor_type);
+  bool menu_click;
 
 protected:
   void paintEvent(QPaintEvent *event);

Modified: trunk/client/gui-qt/menu.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/menu.cpp?rev=34813&r1=34812&r2=34813&view=diff
==============================================================================
--- trunk/client/gui-qt/menu.cpp        (original)
+++ trunk/client/gui-qt/menu.cpp        Wed Jan 11 19:16:52 2017
@@ -1644,6 +1644,7 @@
   fc_shortcut *fcs;
 
   if (sid == SC_GOTO) {
+    gui()->mapview_wdg->menu_click = true;
     slot_unit_goto();
     return;
   }


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

Reply via email to