summaryrefslogtreecommitdiff
path: root/src/network/network_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-05-09 15:27:00 +0000
committerrubidium <rubidium@openttd.org>2008-05-09 15:27:00 +0000
commit8d0a7f4634b73a4e146230b72c2e48cc463bf748 (patch)
treeb0aab17d5b33d2a5b5bdd78514799a53ae27ef97 /src/network/network_gui.cpp
parent0f7d925121beb1033917918478c7d213305de595 (diff)
downloadopenttd-8d0a7f4634b73a4e146230b72c2e48cc463bf748.tar.xz
(svn r13025) -Codechange: remove the need for two WindowEvents.
Diffstat (limited to 'src/network/network_gui.cpp')
-rw-r--r--src/network/network_gui.cpp29
1 files changed, 12 insertions, 17 deletions
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index 8dd90d37d..b3b4f5a25 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -1480,8 +1480,6 @@ static Window *PopupClientList(Window *w, int client_no, int x, int y)
// Save our client
WP(w, menu_d).main_button = client_no;
WP(w, menu_d).sel_index = 0;
- // We are a popup
- _popup_menu_active = true;
return w;
}
@@ -1513,25 +1511,22 @@ static void ClientListPopupWndProc(Window *w, WindowEvent *e)
}
} break;
- case WE_POPUPMENU_SELECT: {
+ case WE_MOUSELOOP: {
/* We selected an action */
- int index = (e->we.popupmenu.pt.y - w->top) / CLNWND_ROWSIZE;
+ int index = (_cursor.pos.y - w->top) / CLNWND_ROWSIZE;
- if (index >= 0 && e->we.popupmenu.pt.y >= w->top) {
- HandleClientListPopupClick(index, WP(w, menu_d).main_button);
- }
-
- DeleteWindowById(WC_TOOLBAR_MENU, 0);
- } break;
+ if (_left_button_down) {
+ if (index == -1 || index == WP(w, menu_d).sel_index) return;
- case WE_POPUPMENU_OVER: {
- /* Our mouse hoovers over an action? Select it! */
- int index = (e->we.popupmenu.pt.y - w->top) / CLNWND_ROWSIZE;
-
- if (index == -1 || index == WP(w, menu_d).sel_index) return;
+ WP(w, menu_d).sel_index = index;
+ SetWindowDirty(w);
+ } else {
+ if (index >= 0 && _cursor.pos.y >= w->top) {
+ HandleClientListPopupClick(index, WP(w, menu_d).main_button);
+ }
- WP(w, menu_d).sel_index = index;
- SetWindowDirty(w);
+ DeleteWindowById(WC_TOOLBAR_MENU, 0);
+ }
} break;
}
}