aboutsummaryrefslogtreecommitdiff
path: root/src/Window.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-03-19 14:30:43 (GMT)
committerfluxgen <fluxgen>2002-03-19 14:30:43 (GMT)
commit95aeda26271cce3061a46a3ca0b122bc13c8f5c8 (patch)
treeaaa01d20e77a2445a20a0522d86296b981049b8e /src/Window.cc
parent1871169b06d8b9909ff26b761d24a40a65ef18f9 (diff)
downloadfluxbox_pavel-95aeda26271cce3061a46a3ca0b122bc13c8f5c8.zip
fluxbox_pavel-95aeda26271cce3061a46a3ca0b122bc13c8f5c8.tar.bz2
Xinerama support
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc144
1 files changed, 121 insertions, 23 deletions
diff --git a/src/Window.cc b/src/Window.cc
index d41b77e..c74f101 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Window.cc,v 1.33 2002/03/19 00:15:58 fluxgen Exp $ 25// $Id: Window.cc,v 1.34 2002/03/19 14:30:42 fluxgen Exp $
26 26
27//use GNU extensions 27//use GNU extensions
28#ifndef _GNU_SOURCE 28#ifndef _GNU_SOURCE
@@ -265,32 +265,44 @@ tab(0)
265 client.normal_hint_flags & (PPosition|USPosition)) { 265 client.normal_hint_flags & (PPosition|USPosition)) {
266 setGravityOffsets(); 266 setGravityOffsets();
267 267
268 if (! fluxbox->isStartup()) { // is going to be used when position 268 if (! fluxbox->isStartup()) {
269 if (decorations.tab) { // window is cleanly fixed 269 #ifdef XINERAMA
270 int real_x = frame.x; 270 unsigned int head = 0;
271 int real_y = frame.y; 271 if (screen->hasXinerama()) {
272 head = screen->getHead(frame.x, frame.y);
273 }
274 #endif // XINERAMA
272 275
273 if (screen->getTabPlacement() == Tab::PTOP) 276 int real_x = frame.x;
274 real_y -= screen->getTabHeight(); 277 int real_y = frame.y;
275 278
276 else if (screen->getTabPlacement() == Tab::PLEFT) { 279 if (decorations.tab) {
277 if (screen->isTabRotateVertical()) 280 if (screen->getTabPlacement() == Tab::PTOP) {
278 real_x -= screen->getTabHeight(); 281 real_y -= screen->getTabHeight();
279 else 282 } else if (screen->getTabPlacement() == Tab::PLEFT) {
280 real_x -= screen->getTabWidth(); 283 real_x -= (screen->isTabRotateVertical())
284 ? screen->getTabHeight()
285 : screen->getTabWidth();
281 } 286 }
287 }
282 288
283 if (real_x >= 0 && 289 #ifdef XINERAMA
284 real_y + frame.y_border >= 0 && 290 // check is within the current head, so it won't overlap heads
285 real_x <= (signed) screen->getWidth() && 291 if (real_x >= screen->getHeadX(head) &&
286 real_y <= (signed) screen->getHeight()) 292 real_y + frame.y_border >= screen->getHeadY(head) &&
287 place_window = false; 293 (real_x + frame.width) <=
288 294 (screen->getHeadX(head) + screen->getHeadWidth(head)) &&
289 } else if (frame.x >= 0 && // non tab 295 (real_y + frame.height) <=
290 (signed) (frame.y + frame.y_border) >= 0 && 296 (screen->getHeadY(head) + screen->getHeadHeight(head)) )
291 frame.x <= (signed) screen->getWidth() && 297 place_window = false;
292 frame.y <= (signed) screen->getHeight()) 298 #else // !XINERAMA
299 if (real_x >= 0 &&
300 real_y + frame.y_border >= 0 &&
301 real_x <= (signed) screen->getWidth() &&
302 real_y <= (signed) screen->getHeight())
293 place_window = false; 303 place_window = false;
304 #endif // XIENRAMA
305
294 } else 306 } else
295 place_window = false; 307 place_window = false;
296 308
@@ -2083,7 +2095,25 @@ void FluxboxWindow::maximize(unsigned int button) {
2083 if (! maximized) { 2095 if (! maximized) {
2084 int dx, dy; 2096 int dx, dy;
2085 unsigned int dw, dh, slitModL = 0, slitModR = 0, slitModT = 0, slitModB = 0; 2097 unsigned int dw, dh, slitModL = 0, slitModR = 0, slitModT = 0, slitModB = 0;
2098
2099#ifdef XINERAMA
2100 // get the head the window is on, taking the middle of the window to
2101 // make it feel right, maybe someone will like client.x, client.y better
2102 // tough?
2103 unsigned int head = (screen->hasXinerama()) ?
2104 screen->getHead(client.x + (client.width / 2), client.y + (client.height / 2))
2105 : 0;
2106#endif // XINERAMA
2107
2108
2086#ifdef SLIT 2109#ifdef SLIT
2110
2111#ifdef XINERAMA
2112// take the slit in account if it's on the same head
2113// (always true if we don't have xinerama
2114if (!screen->hasXinerama() || screen->getSlitOnHead() == head) {
2115#endif // XINERAMA
2116
2087 Slit* mSlt = screen->getSlit(); 2117 Slit* mSlt = screen->getSlit();
2088 2118
2089 if(!screen->doMaxOverSlit() && !screen->doFullMax() && (mSlt->getWidth() > 1)) 2119 if(!screen->doMaxOverSlit() && !screen->doFullMax() && (mSlt->getWidth() > 1))
@@ -2138,6 +2168,10 @@ void FluxboxWindow::maximize(unsigned int button) {
2138 break; 2168 break;
2139 } 2169 }
2140 } 2170 }
2171#ifdef XINERAMA
2172}
2173#endif // XINERAMA
2174
2141#endif // SLIT 2175#endif // SLIT
2142 2176
2143 blackbox_attrib.premax_x = frame.x; 2177 blackbox_attrib.premax_x = frame.x;
@@ -2145,21 +2179,44 @@ void FluxboxWindow::maximize(unsigned int button) {
2145 blackbox_attrib.premax_w = frame.width; 2179 blackbox_attrib.premax_w = frame.width;
2146 blackbox_attrib.premax_h = frame.height; 2180 blackbox_attrib.premax_h = frame.height;
2147 2181
2182#ifdef XINERAMA
2183 dw = screen->getHeadWidth(head) - slitModL - slitModR;
2184#else // !XINERAMA
2148 dw = screen->getWidth() - slitModL - slitModR; 2185 dw = screen->getWidth() - slitModL - slitModR;
2186#endif // XINERAMA
2149 dw -= screen->getBorderWidth2x(); 2187 dw -= screen->getBorderWidth2x();
2150 dw -= frame.mwm_border_w * 2; 2188 dw -= frame.mwm_border_w * 2;
2151 dw -= client.base_width; 2189 dw -= client.base_width;
2152 2190
2191#ifdef XINERAMA
2192 dh = screen->getHeadHeight(head) - slitModT - slitModB;
2193#else // !XINERAMA
2153 dh = screen->getHeight() - slitModT - slitModB; 2194 dh = screen->getHeight() - slitModT - slitModB;
2195#endif // XINERAMA
2154 dh -= screen->getBorderWidth2x(); 2196 dh -= screen->getBorderWidth2x();
2155 dh -= frame.mwm_border_w * 2; 2197 dh -= frame.mwm_border_w * 2;
2156 dh -= ((frame.handle_h + screen->getBorderWidth()) * decorations.handle); 2198 dh -= ((frame.handle_h + screen->getBorderWidth()) * decorations.handle);
2157 dh -= client.base_height; 2199 dh -= client.base_height;
2158 dh -= frame.y_border; 2200 dh -= frame.y_border;
2159 2201
2160 if (! screen->doFullMax()) 2202 if (! screen->doFullMax()) {
2203#ifdef XINERAMA
2204 if (screen->hasXinerama()) {
2205 // is the toolbar on this head?
2206 if ((screen->getToolbarOnHead() == (signed) head) ||
2207 (screen->getToolbarOnHead() < 0)) {
2208 dh -= screen->getToolbar()->getExposedHeight() +
2209 screen->getBorderWidth2x();
2210 }
2211 } else {
2212 dh -= screen->getToolbar()->getExposedHeight() +
2213 screen->getBorderWidth2x();
2214 }
2215#else // !XINERAMA
2161 dh -= screen->getToolbar()->getExposedHeight() + 2216 dh -= screen->getToolbar()->getExposedHeight() +
2162 screen->getBorderWidth2x(); 2217 screen->getBorderWidth2x();
2218#endif // XINERAMA
2219 }
2163 2220
2164 if (dw < client.min_width) dw = client.min_width; 2221 if (dw < client.min_width) dw = client.min_width;
2165 if (dh < client.min_height) dh = client.min_height; 2222 if (dh < client.min_height) dh = client.min_height;
@@ -2177,20 +2234,61 @@ void FluxboxWindow::maximize(unsigned int button) {
2177 dh += (frame.handle_h + screen->getBorderWidth()); 2234 dh += (frame.handle_h + screen->getBorderWidth());
2178 dh += frame.mwm_border_w * 2; 2235 dh += frame.mwm_border_w * 2;
2179 2236
2237#ifdef XINERAMA
2238 dx = screen->getHeadX(head) +
2239 ((screen->getHeadWidth(head) + slitModL - slitModR - dw) / 2)
2240 - screen->getBorderWidth();
2241#else // !XINERAMA
2180 dx = ((screen->getWidth()+ slitModL - slitModR - dw) / 2) - screen->getBorderWidth(); 2242 dx = ((screen->getWidth()+ slitModL - slitModR - dw) / 2) - screen->getBorderWidth();
2243#endif // XINERAMA
2181 2244
2182 if (screen->doFullMax()) { 2245 if (screen->doFullMax()) {
2246#ifdef XINERAMA
2247 dy = screen->getHeadY(head) +
2248 ((screen->getHeadHeight(head) - dh) / 2) - screen->getBorderWidth();
2249#else // !XINERAMA
2183 dy = ((screen->getHeight() - dh) / 2) - screen->getBorderWidth(); 2250 dy = ((screen->getHeight() - dh) / 2) - screen->getBorderWidth();
2251#endif // XINERAMA
2184 } else { 2252 } else {
2253#ifdef XINERAMA
2254 if (screen->hasXinerama()) { // xinerama
2255 dy = screen->getHeadY(head);
2256 // is the toolbar on this head?
2257 if ((screen->getToolbarOnHead() == (signed) head) ||
2258 (screen->getToolbarOnHead() < 0)) {
2259 dy += (((screen->getHeadHeight(head) + slitModT - slitModB
2260 - (screen->getToolbar()->getExposedHeight())) - dh) / 2)
2261 - screen->getBorderWidth2x();
2262 } else {
2263 dy += ((screen->getHeadHeight(head) + slitModT - slitModB - dh) / 2) -
2264 screen->getBorderWidth();
2265 }
2266 } else { // no xinerama
2267 dy = (((screen->getHeight() + slitModT - slitModB -
2268 (screen->getToolbar()->getExposedHeight())) - dh) / 2) -
2269 screen->getBorderWidth2x();
2270 }
2271#else // !XINERAMA
2185 dy = (((screen->getHeight() + slitModT - slitModB - (screen->getToolbar()->getExposedHeight())) 2272 dy = (((screen->getHeight() + slitModT - slitModB - (screen->getToolbar()->getExposedHeight()))
2186 - dh) / 2) - screen->getBorderWidth2x(); 2273 - dh) / 2) - screen->getBorderWidth2x();
2274#endif // XINERAMA
2187 2275
2188 switch (screen->getToolbarPlacement()) { 2276 switch (screen->getToolbarPlacement()) {
2189 case Toolbar::TOPLEFT: 2277 case Toolbar::TOPLEFT:
2190 case Toolbar::TOPCENTER: 2278 case Toolbar::TOPCENTER:
2191 case Toolbar::TOPRIGHT: 2279 case Toolbar::TOPRIGHT:
2280#ifdef XINERAMA
2281 // if < 0 than it's over ALL heads, with no xinerama it's there too
2282 if (!screen->hasXinerama() ||
2283 (screen->getToolbarOnHead() == (signed) head) ||
2284 (screen->getToolbarOnHead() < 0)) {
2285 dy += screen->getToolbar()->getExposedHeight() +
2286 screen->getBorderWidth2x();
2287 }
2288#else // !XINERAMA
2192 dy += screen->getToolbar()->getExposedHeight() + 2289 dy += screen->getToolbar()->getExposedHeight() +
2193 screen->getBorderWidth2x(); 2290 screen->getBorderWidth2x();
2291#endif // XINERAMA
2194 break; 2292 break;
2195 default: 2293 default:
2196 break; 2294 break;