summaryrefslogtreecommitdiff
path: root/src/Window.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc69
1 files changed, 43 insertions, 26 deletions
diff --git a/src/Window.cc b/src/Window.cc
index 7dc268f..52672c0 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -1016,7 +1016,6 @@ bool FluxboxWindow::setCurrentClient(WinClient &client, bool setinput) {
1016 // frame focused doesn't necessarily mean input focused 1016 // frame focused doesn't necessarily mean input focused
1017 frame().setLabelButtonFocus(*button); 1017 frame().setLabelButtonFocus(*button);
1018 frame().setShapingClient(&client, false); 1018 frame().setShapingClient(&client, false);
1019 frame().setSizeHints(client.sizeHints());
1020 return ret; 1019 return ret;
1021} 1020}
1022 1021
@@ -1033,10 +1032,50 @@ void FluxboxWindow::associateClientWindow() {
1033 m_client->width(), m_client->height(), 1032 m_client->width(), m_client->height(),
1034 m_client->gravity(), m_client->old_bw); 1033 m_client->gravity(), m_client->old_bw);
1035 1034
1036 frame().setSizeHints(m_client->sizeHints()); 1035 updateSizeHints();
1037 frame().setClientWindow(*m_client); 1036 frame().setClientWindow(*m_client);
1038} 1037}
1039 1038
1039void FluxboxWindow::updateSizeHints() {
1040 m_size_hint = m_client->sizeHints();
1041
1042 ClientList::const_iterator it = clientList().begin();
1043 ClientList::const_iterator it_end = clientList().end();
1044 for (; it != it_end; ++it) {
1045 if ((*it) == m_client)
1046 continue;
1047
1048 const FbWinFrame::SizeHints &hint = (*it)->sizeHints();
1049 if (m_size_hint.min_width < hint.min_width)
1050 m_size_hint.min_width = hint.min_width;
1051 if (m_size_hint.max_width > hint.max_width)
1052 m_size_hint.max_width = hint.max_width;
1053 if (m_size_hint.min_height < hint.min_height)
1054 m_size_hint.min_height = hint.min_height;
1055 if (m_size_hint.max_height > hint.max_height)
1056 m_size_hint.max_height = hint.max_height;
1057 // lcm could end up a bit silly, and the situation is bad no matter what
1058 if (m_size_hint.width_inc < hint.width_inc)
1059 m_size_hint.width_inc = hint.width_inc;
1060 if (m_size_hint.height_inc < hint.height_inc)
1061 m_size_hint.height_inc = hint.height_inc;
1062 if (m_size_hint.base_width < hint.base_width)
1063 m_size_hint.base_width = hint.base_width;
1064 if (m_size_hint.base_height < hint.base_height)
1065 m_size_hint.base_height = hint.base_height;
1066 if (m_size_hint.min_aspect_x * hint.min_aspect_y >
1067 m_size_hint.min_aspect_y * hint.min_aspect_x) {
1068 m_size_hint.min_aspect_x = hint.min_aspect_x;
1069 m_size_hint.min_aspect_y = hint.min_aspect_y;
1070 }
1071 if (m_size_hint.max_aspect_x * hint.max_aspect_y >
1072 m_size_hint.max_aspect_y * hint.max_aspect_x) {
1073 m_size_hint.max_aspect_x = hint.max_aspect_x;
1074 m_size_hint.max_aspect_y = hint.max_aspect_y;
1075 }
1076 }
1077 frame().setSizeHints(m_size_hint);
1078}
1040 1079
1041void FluxboxWindow::grabButtons() { 1080void FluxboxWindow::grabButtons() {
1042 1081
@@ -1208,32 +1247,10 @@ void FluxboxWindow::moveResizeForClient(int new_x, int new_y,
1208} 1247}
1209 1248
1210void FluxboxWindow::getMaxSize(unsigned int* width, unsigned int* height) const { 1249void FluxboxWindow::getMaxSize(unsigned int* width, unsigned int* height) const {
1211
1212 if (!width || !height)
1213 return;
1214
1215 ClientList::const_iterator it = clientList().begin();
1216 ClientList::const_iterator it_end = clientList().end();
1217
1218 unsigned int w;
1219 unsigned int h;
1220
1221 w = h = 0; // unlimited
1222
1223 for (; it != it_end; ++it) {
1224 // special case for max height/width == 0
1225 // 0 indicates unlimited size, so we skip them
1226 if (!h || ((*it)->maxHeight() && h > (*it)->maxHeight()))
1227 h = (*it)->maxHeight();
1228 if (!w || ((*it)->maxWidth() && w > (*it)->maxWidth()))
1229 w = (*it)->maxWidth();
1230 }
1231
1232 if (width) 1250 if (width)
1233 *width = w; 1251 *width = m_size_hint.max_width;
1234
1235 if (height) 1252 if (height)
1236 *height = h; 1253 *height = m_size_hint.max_height;
1237} 1254}
1238 1255
1239// returns whether the focus was "set" to this window 1256// returns whether the focus was "set" to this window