summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/network/network_chat_gui.cpp4
-rw-r--r--src/settings.cpp1
-rw-r--r--src/window.cpp13
-rw-r--r--src/window_func.h1
4 files changed, 17 insertions, 2 deletions
diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp
index 539a49270..e610f9cbf 100644
--- a/src/network/network_chat_gui.cpp
+++ b/src/network/network_chat_gui.cpp
@@ -303,6 +303,8 @@ struct NetworkChatWindow : public QueryStringBaseWindow {
this->SetFocusedWidget(NWCW_TEXTBOX);
InvalidateWindowData(WC_NEWS_WINDOW, 0, this->height);
_chat_tab_completion_active = false;
+
+ PositionNetworkChatWindow(this);
}
~NetworkChatWindow()
@@ -457,7 +459,7 @@ struct NetworkChatWindow : public QueryStringBaseWindow {
virtual Point OnInitialPosition(const WindowDesc *desc, int16 sm_width, int16 sm_height, int window_number)
{
- Point pt = { (_screen.width - max(sm_width, desc->default_width)) / 2, _screen.height - sm_height - FindWindowById(WC_STATUS_BAR, 0)->height };
+ Point pt = { 0, _screen.height - sm_height - FindWindowById(WC_STATUS_BAR, 0)->height };
return pt;
}
diff --git a/src/settings.cpp b/src/settings.cpp
index 30201541c..ded3b441e 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -693,6 +693,7 @@ static bool v_PositionStatusbar(int32 p1)
if (_game_mode != GM_MENU) {
PositionStatusbar(NULL);
PositionNewsMessage(NULL);
+ PositionNetworkChatWindow(NULL);
}
return true;
}
diff --git a/src/window.cpp b/src/window.cpp
index d6bdf4ffb..2c6f1f1e1 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -2675,6 +2675,17 @@ int PositionNewsMessage(Window *w)
return PositionWindow(w, WC_NEWS_WINDOW, _settings_client.gui.statusbar_pos);
}
+/**
+ * (Re)position network chat window at the screen.
+ * @param w Window structure of the network chat window, may also be \c NULL.
+ * @return X coordinate of left edge of the repositioned network chat winodw.
+ */
+int PositionNetworkChatWindow(Window *w)
+{
+ DEBUG(misc, 5, "Repositioning network chat window...");
+ return PositionWindow(w, WC_SEND_NETWORK_MSG, _settings_client.gui.statusbar_pos);
+}
+
/**
* Switches viewports following vehicles, which get autoreplaced
@@ -2739,7 +2750,7 @@ void RelocateAllWindows(int neww, int newh)
case WC_SEND_NETWORK_MSG:
ResizeWindow(w, Clamp(neww, 320, 640) - w->width, 0);
top = newh - w->height - FindWindowById(WC_STATUS_BAR, 0)->height;
- left = (neww - w->width) >> 1;
+ left = PositionNetworkChatWindow(w);
break;
case WC_CONSOLE:
diff --git a/src/window_func.h b/src/window_func.h
index 1f5a292e5..3d51644f6 100644
--- a/src/window_func.h
+++ b/src/window_func.h
@@ -23,6 +23,7 @@ void ResizeWindow(Window *w, int x, int y);
int PositionMainToolbar(Window *w);
int PositionStatusbar(Window *w);
int PositionNewsMessage(Window *w);
+int PositionNetworkChatWindow(Window *w);
int GetMainViewTop();
int GetMainViewBottom();