From 68a1d75d9e351fa28db90937b5dae0f2d0cd2ff3 Mon Sep 17 00:00:00 2001 From: rubidium Date: Fri, 9 May 2008 15:27:00 +0000 Subject: (svn r13025) -Codechange: remove the need for two WindowEvents. --- src/network/network_gui.cpp | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) (limited to 'src/network/network_gui.cpp') 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; } } -- cgit v1.2.3-70-g09d2