diff options
author | fluxgen <fluxgen> | 2004-07-15 18:20:13 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2004-07-15 18:20:13 (GMT) |
commit | 38bd7f47d929fab76b55ea4e6a479eda981d3603 (patch) | |
tree | 96d1e16e637051757e38efc4c3641256446a5f04 /src | |
parent | e9791076b039e9c935adc4b642fb20776ec5765c (diff) | |
download | fluxbox-38bd7f47d929fab76b55ea4e6a479eda981d3603.zip fluxbox-38bd7f47d929fab76b55ea4e6a479eda981d3603.tar.bz2 |
click on handle raises, and some other minor fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/Window.cc | 115 |
1 files changed, 77 insertions, 38 deletions
diff --git a/src/Window.cc b/src/Window.cc index f5952dc..fc990c8 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.292 2004/06/29 12:41:23 rathnor Exp $ | 25 | // $Id: Window.cc,v 1.293 2004/07/15 18:20:13 fluxgen Exp $ |
26 | 26 | ||
27 | #include "Window.hh" | 27 | #include "Window.hh" |
28 | 28 | ||
@@ -153,7 +153,9 @@ WinClient *getRootTransientFor(WinClient *client) { | |||
153 | void raiseFluxboxWindow(FluxboxWindow &win) { | 153 | void raiseFluxboxWindow(FluxboxWindow &win) { |
154 | if (win.oplock) return; | 154 | if (win.oplock) return; |
155 | win.oplock = true; | 155 | win.oplock = true; |
156 | 156 | #ifdef DEBUG | |
157 | cerr<<"raiseFluxboxWindow("<<win.title()<<")"<<endl; | ||
158 | #endif // DEBUG | ||
157 | // we need to lock actual restacking so that raising above active transient | 159 | // we need to lock actual restacking so that raising above active transient |
158 | // won't do anything nasty | 160 | // won't do anything nasty |
159 | if (!win.winClient().transientList().empty()) | 161 | if (!win.winClient().transientList().empty()) |
@@ -176,6 +178,9 @@ void raiseFluxboxWindow(FluxboxWindow &win) { | |||
176 | 178 | ||
177 | if (!win.winClient().transientList().empty()) | 179 | if (!win.winClient().transientList().empty()) |
178 | win.screen().layerManager().unlock(); | 180 | win.screen().layerManager().unlock(); |
181 | #ifdef DEBUG | ||
182 | cerr<<"window("<<win.title()<<") transient size: "<<win.winClient().transientList().size()<<endl; | ||
183 | #endif // DEBUG | ||
179 | } | 184 | } |
180 | 185 | ||
181 | /// lower window and do the same for each transient it holds | 186 | /// lower window and do the same for each transient it holds |
@@ -485,7 +490,6 @@ void FluxboxWindow::init() { | |||
485 | decorations.tab = false; //no tab for this window | 490 | decorations.tab = false; //no tab for this window |
486 | } | 491 | } |
487 | 492 | ||
488 | upsize(); | ||
489 | 493 | ||
490 | applyDecorations(true); | 494 | applyDecorations(true); |
491 | 495 | ||
@@ -528,10 +532,17 @@ void FluxboxWindow::init() { | |||
528 | if (m_client->isTransient() && | 532 | if (m_client->isTransient() && |
529 | m_client->transientFor()->fbwindow() && | 533 | m_client->transientFor()->fbwindow() && |
530 | m_client->transientFor()->fbwindow() != this) | 534 | m_client->transientFor()->fbwindow() != this) |
531 | layerItem().setLayer(m_client->transientFor()->fbwindow()->layerItem().getLayer()); | 535 | layerItem().setLayer(m_client->transientFor()->fbwindow()->layerItem().getLayer()); |
532 | else // if no parent then set default layer | 536 | else // if no parent then set default layer |
533 | moveToLayer(m_layernum); | 537 | moveToLayer(m_layernum); |
534 | 538 | #ifdef DEBUG | |
539 | cerr<<"FluxboxWindow::init("<<title()<<") transientFor: "<< | ||
540 | m_client->transientFor()<<endl; | ||
541 | if (m_client->transientFor() && m_client->transientFor()->fbwindow()) { | ||
542 | cerr<<"FluxboxWindow::init("<<title()<<") transientFor->title(): "<< | ||
543 | m_client->transientFor()->fbwindow()->title()<<endl; | ||
544 | } | ||
545 | #endif // DEBUG | ||
535 | if (!place_window) | 546 | if (!place_window) |
536 | moveResize(frame().x(), frame().y(), frame().width(), frame().height()); | 547 | moveResize(frame().x(), frame().y(), frame().width(), frame().height()); |
537 | 548 | ||
@@ -920,6 +931,10 @@ bool FluxboxWindow::setCurrentClient(WinClient &client, bool setinput) { | |||
920 | m_client = &client; | 931 | m_client = &client; |
921 | m_client->raise(); | 932 | m_client->raise(); |
922 | 933 | ||
934 | #ifdef DEBUG | ||
935 | cerr<<"FluxboxWindow::"<<__FUNCTION__<<": labelbutton[client] = "<< | ||
936 | m_labelbuttons[m_client]<<endl; | ||
937 | #endif // DEBUG | ||
923 | // frame focused doesn't necessarily mean input focused | 938 | // frame focused doesn't necessarily mean input focused |
924 | frame().setLabelButtonFocus(*m_labelbuttons[m_client]); | 939 | frame().setLabelButtonFocus(*m_labelbuttons[m_client]); |
925 | 940 | ||
@@ -936,7 +951,9 @@ bool FluxboxWindow::isGroupable() const { | |||
936 | return false; | 951 | return false; |
937 | } | 952 | } |
938 | 953 | ||
939 | void FluxboxWindow::associateClientWindow(bool use_attrs, int x, int y, unsigned int width, unsigned int height) { | 954 | void FluxboxWindow::associateClientWindow(bool use_attrs, |
955 | int x, int y, | ||
956 | unsigned int width, unsigned int height) { | ||
940 | m_client->setBorderWidth(0); | 957 | m_client->setBorderWidth(0); |
941 | updateTitleFromClient(*m_client); | 958 | updateTitleFromClient(*m_client); |
942 | updateIconNameFromClient(*m_client); | 959 | updateIconNameFromClient(*m_client); |
@@ -982,8 +999,6 @@ void FluxboxWindow::grabButtons() { | |||
982 | 999 | ||
983 | void FluxboxWindow::reconfigure() { | 1000 | void FluxboxWindow::reconfigure() { |
984 | 1001 | ||
985 | upsize(); | ||
986 | |||
987 | applyDecorations(); | 1002 | applyDecorations(); |
988 | 1003 | ||
989 | setFocusFlag(focused); | 1004 | setFocusFlag(focused); |
@@ -1118,8 +1133,7 @@ void FluxboxWindow::updateBlackboxHintsFromClient(const WinClient &client) { | |||
1118 | ATTRIB_MAXHORIZ) ? MAX_HORZ : MAX_NONE); | 1133 | ATTRIB_MAXHORIZ) ? MAX_HORZ : MAX_NONE); |
1119 | 1134 | ||
1120 | if (hint->flags & ATTRIB_OMNIPRESENT) | 1135 | if (hint->flags & ATTRIB_OMNIPRESENT) |
1121 | stuck = (hint->attrib & | 1136 | stuck = (hint->attrib & ATTRIB_OMNIPRESENT); |
1122 | ATTRIB_OMNIPRESENT); | ||
1123 | 1137 | ||
1124 | if (hint->flags & ATTRIB_WORKSPACE) | 1138 | if (hint->flags & ATTRIB_WORKSPACE) |
1125 | m_workspace_number = hint->workspace; | 1139 | m_workspace_number = hint->workspace; |
@@ -1156,7 +1170,6 @@ void FluxboxWindow::moveResize(int new_x, int new_y, | |||
1156 | if ((((signed) frame().height()) + new_y) < 0) | 1170 | if ((((signed) frame().height()) + new_y) < 0) |
1157 | new_y = 0; | 1171 | new_y = 0; |
1158 | 1172 | ||
1159 | downsize(); | ||
1160 | if (!isResizable()) { | 1173 | if (!isResizable()) { |
1161 | new_width = width(); | 1174 | new_width = width(); |
1162 | new_height = height(); | 1175 | new_height = height(); |
@@ -1218,11 +1231,23 @@ bool FluxboxWindow::setInputFocus() { | |||
1218 | 1231 | ||
1219 | if (! m_client->validateClient()) | 1232 | if (! m_client->validateClient()) |
1220 | return false; | 1233 | return false; |
1221 | 1234 | #ifdef DEBUG | |
1235 | cerr<<"FluxboxWindow::"<<__FUNCTION__<<" isModal() = "<<m_client->isModal()<<endl; | ||
1236 | cerr<<"FluxboxWindow::"<<__FUNCTION__<<" transient size = "<<m_client->transients.size()<<endl; | ||
1237 | #endif // DEBUG | ||
1222 | if (!m_client->transients.empty() && m_client->isModal()) { | 1238 | if (!m_client->transients.empty() && m_client->isModal()) { |
1239 | #ifdef DEBUG | ||
1240 | cerr<<__FUNCTION__<<": isModal and have transients client = "<< | ||
1241 | hex<<m_client->window()<<dec<<endl; | ||
1242 | cerr<<__FUNCTION__<<": this = "<<this<<endl; | ||
1243 | #endif // DEBUG | ||
1244 | |||
1223 | WinClient::TransientList::iterator it = m_client->transients.begin(); | 1245 | WinClient::TransientList::iterator it = m_client->transients.begin(); |
1224 | WinClient::TransientList::iterator it_end = m_client->transients.end(); | 1246 | WinClient::TransientList::iterator it_end = m_client->transients.end(); |
1225 | for (; it != it_end; ++it) { | 1247 | for (; it != it_end; ++it) { |
1248 | #ifdef DEBUG | ||
1249 | cerr<<__FUNCTION__<<": transient 0x"<<(*it)<<endl; | ||
1250 | #endif // DEBUG | ||
1226 | if ((*it)->isModal()) | 1251 | if ((*it)->isModal()) |
1227 | return (*it)->fbwindow()->setCurrentClient(**it, true); | 1252 | return (*it)->fbwindow()->setCurrentClient(**it, true); |
1228 | } | 1253 | } |
@@ -1373,6 +1398,9 @@ void FluxboxWindow::deiconify(bool reassoc, bool do_raise) { | |||
1373 | Set window in withdrawn state | 1398 | Set window in withdrawn state |
1374 | */ | 1399 | */ |
1375 | void FluxboxWindow::withdraw(bool interrupt_moving) { | 1400 | void FluxboxWindow::withdraw(bool interrupt_moving) { |
1401 | #ifdef DEBUG | ||
1402 | cerr<<"FluxboxWindow::"<<__FUNCTION__<<": this = "<<this<<endl; | ||
1403 | #endif // DEBUG | ||
1376 | iconic = false; | 1404 | iconic = false; |
1377 | 1405 | ||
1378 | hide(interrupt_moving); | 1406 | hide(interrupt_moving); |
@@ -1560,7 +1588,9 @@ void FluxboxWindow::stick() { | |||
1560 | void FluxboxWindow::raise() { | 1588 | void FluxboxWindow::raise() { |
1561 | if (isIconic()) | 1589 | if (isIconic()) |
1562 | deiconify(); | 1590 | deiconify(); |
1563 | 1591 | #ifdef DEBUG | |
1592 | cerr<<"FluxboxWindow("<<title()<<")::raise()[layer="<<layerNum()<<""<<endl; | ||
1593 | #endif // DEBUG | ||
1564 | // get root window | 1594 | // get root window |
1565 | WinClient *client = getRootTransientFor(m_client); | 1595 | WinClient *client = getRootTransientFor(m_client); |
1566 | 1596 | ||
@@ -1576,7 +1606,9 @@ void FluxboxWindow::raise() { | |||
1576 | void FluxboxWindow::lower() { | 1606 | void FluxboxWindow::lower() { |
1577 | if (isIconic()) | 1607 | if (isIconic()) |
1578 | deiconify(); | 1608 | deiconify(); |
1579 | 1609 | #ifdef DEBUG | |
1610 | cerr<<"FluxboxWindow("<<title()<<")::lower()"<<endl; | ||
1611 | #endif // DEBUG | ||
1580 | // get root window | 1612 | // get root window |
1581 | WinClient *client = getRootTransientFor(m_client); | 1613 | WinClient *client = getRootTransientFor(m_client); |
1582 | 1614 | ||
@@ -1673,6 +1705,10 @@ void FluxboxWindow::lowerLayer() { | |||
1673 | 1705 | ||
1674 | 1706 | ||
1675 | void FluxboxWindow::moveToLayer(int layernum) { | 1707 | void FluxboxWindow::moveToLayer(int layernum) { |
1708 | #ifdef DEBUG | ||
1709 | cerr<<"FluxboxWindow("<<title()<<")::moveToLayer("<<layernum<<")"<<endl; | ||
1710 | #endif // DEBUG | ||
1711 | |||
1676 | Fluxbox * fluxbox = Fluxbox::instance(); | 1712 | Fluxbox * fluxbox = Fluxbox::instance(); |
1677 | 1713 | ||
1678 | // don't let it set its layer into menu area | 1714 | // don't let it set its layer into menu area |
@@ -1730,7 +1766,9 @@ void FluxboxWindow::setIconHidden(bool value) { | |||
1730 | void FluxboxWindow::setFocusFlag(bool focus) { | 1766 | void FluxboxWindow::setFocusFlag(bool focus) { |
1731 | bool was_focused = isFocused(); | 1767 | bool was_focused = isFocused(); |
1732 | focused = focus; | 1768 | focused = focus; |
1733 | 1769 | #ifdef DEBUG | |
1770 | cerr<<"FluxboxWindow("<<title()<<")::setFocusFlag("<<focus<<")"<<endl; | ||
1771 | #endif // DEBUG | ||
1734 | // Record focus timestamp for window cycling enhancements | 1772 | // Record focus timestamp for window cycling enhancements |
1735 | if (focused) { | 1773 | if (focused) { |
1736 | gettimeofday(&m_last_focus_time, 0); | 1774 | gettimeofday(&m_last_focus_time, 0); |
@@ -2100,8 +2138,16 @@ void FluxboxWindow::mapNotifyEvent(XMapEvent &ne) { | |||
2100 | WinClient *client = findClient(ne.window); | 2138 | WinClient *client = findClient(ne.window); |
2101 | if (client == 0) | 2139 | if (client == 0) |
2102 | return; | 2140 | return; |
2141 | #ifdef DEBUG | ||
2142 | cerr<<"FluxboxWindow::mapNotifyEvent: " | ||
2143 | <<"ne.override_redirect = "<<ne.override_redirect | ||
2144 | <<" isVisible() = "<<isVisible()<<endl; | ||
2145 | #endif // DEBUG | ||
2103 | 2146 | ||
2104 | if (!ne.override_redirect && isVisible()) { | 2147 | if (!ne.override_redirect && isVisible()) { |
2148 | #ifdef DEBUG | ||
2149 | cerr<<"FluxboxWindow::mapNotify: not override redirect ans visible!"<<endl; | ||
2150 | #endif // DEBUG | ||
2105 | Fluxbox *fluxbox = Fluxbox::instance(); | 2151 | Fluxbox *fluxbox = Fluxbox::instance(); |
2106 | fluxbox->grab(); | 2152 | fluxbox->grab(); |
2107 | if (! client->validateClient()) | 2153 | if (! client->validateClient()) |
@@ -2222,7 +2268,6 @@ void FluxboxWindow::propertyNotifyEvent(WinClient &client, Atom atom) { | |||
2222 | int x = frame().x(), y = frame().y(); | 2268 | int x = frame().x(), y = frame().y(); |
2223 | unsigned int w = frame().width(), h = frame().height(); | 2269 | unsigned int w = frame().width(), h = frame().height(); |
2224 | 2270 | ||
2225 | upsize(); | ||
2226 | 2271 | ||
2227 | // reconfigure if the old values changed | 2272 | // reconfigure if the old values changed |
2228 | if (x != frame().x() || y != frame().y() || | 2273 | if (x != frame().x() || y != frame().y() || |
@@ -2272,12 +2317,15 @@ void FluxboxWindow::configureRequestEvent(XConfigureRequestEvent &cr) { | |||
2272 | if (cr.value_mask & CWBorderWidth) | 2317 | if (cr.value_mask & CWBorderWidth) |
2273 | client->old_bw = cr.border_width; | 2318 | client->old_bw = cr.border_width; |
2274 | 2319 | ||
2275 | if (cr.value_mask & CWX) { | 2320 | if ((cr.value_mask & CWX) && |
2321 | (cr.value_mask & CWY)) { | ||
2322 | cx = cr.x; | ||
2323 | cy = cr.y; | ||
2324 | frame().gravityTranslate(cx, cy, client->gravity(), false); | ||
2325 | } else if (cr.value_mask & CWX) { | ||
2276 | cx = cr.x; | 2326 | cx = cr.x; |
2277 | frame().gravityTranslate(cx, ignore, client->gravity(), false); | 2327 | frame().gravityTranslate(cx, ignore, client->gravity(), false); |
2278 | } | 2328 | } else if (cr.value_mask & CWY) { |
2279 | |||
2280 | if (cr.value_mask & CWY) { | ||
2281 | cy = cr.y; | 2329 | cy = cr.y; |
2282 | frame().gravityTranslate(ignore, cy, client->gravity(), false); | 2330 | frame().gravityTranslate(ignore, cy, client->gravity(), false); |
2283 | } | 2331 | } |
@@ -2289,19 +2337,15 @@ void FluxboxWindow::configureRequestEvent(XConfigureRequestEvent &cr) { | |||
2289 | ch = cr.height; | 2337 | ch = cr.height; |
2290 | 2338 | ||
2291 | // whether we should send ConfigureNotify to netizens | 2339 | // whether we should send ConfigureNotify to netizens |
2292 | bool send_notify = false; | ||
2293 | |||
2294 | // the request is for client window so we resize the frame to it first | 2340 | // the request is for client window so we resize the frame to it first |
2295 | if (frame().width() != cw || frame().height() != ch) { | 2341 | if (frame().width() != cw || frame().height() != ch) { |
2296 | if (frame().x() != cx || frame().y() != cy) | 2342 | if (frame().x() != cx || frame().y() != cy) |
2297 | frame().moveResizeForClient(cx, cy, cw, ch); | 2343 | frame().moveResizeForClient(cx, cy, cw, ch); |
2298 | else | 2344 | else |
2299 | frame().resizeForClient(cw, ch); | 2345 | frame().resizeForClient(cw, ch); |
2300 | send_notify = true; | 2346 | |
2301 | } else if (frame().x() != cx || frame().y() != cy) { | 2347 | } else if (frame().x() != cx || frame().y() != cy) { |
2302 | move(cx, cy); | 2348 | frame().move(cx, cy); |
2303 | // since we already send a notify in move we don't need to do that again | ||
2304 | send_notify = false; | ||
2305 | } | 2349 | } |
2306 | 2350 | ||
2307 | if (cr.value_mask & CWStackMode) { | 2351 | if (cr.value_mask & CWStackMode) { |
@@ -2319,7 +2363,7 @@ void FluxboxWindow::configureRequestEvent(XConfigureRequestEvent &cr) { | |||
2319 | } | 2363 | } |
2320 | } | 2364 | } |
2321 | 2365 | ||
2322 | sendConfigureNotify(send_notify); | 2366 | sendConfigureNotify(); |
2323 | } | 2367 | } |
2324 | 2368 | ||
2325 | 2369 | ||
@@ -2338,11 +2382,16 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent &be) { | |||
2338 | if (frame().window().window() == be.window) { | 2382 | if (frame().window().window() == be.window) { |
2339 | if (screen().clickRaises()) | 2383 | if (screen().clickRaises()) |
2340 | raise(); | 2384 | raise(); |
2385 | #ifdef DEBUG | ||
2386 | cerr<<"FluxboxWindow::buttonPressEvent: AllowEvent"<<endl; | ||
2387 | #endif // DEBUG | ||
2388 | |||
2341 | XAllowEvents(display, ReplayPointer, be.time); | 2389 | XAllowEvents(display, ReplayPointer, be.time); |
2342 | 2390 | ||
2343 | m_button_grab_x = be.x_root - frame().x() - frame().window().borderWidth(); | 2391 | m_button_grab_x = be.x_root - frame().x() - frame().window().borderWidth(); |
2344 | m_button_grab_y = be.y_root - frame().y() - frame().window().borderWidth(); | 2392 | m_button_grab_y = be.y_root - frame().y() - frame().window().borderWidth(); |
2345 | } | 2393 | } else if (frame().handle() == be.window) |
2394 | raise(); | ||
2346 | 2395 | ||
2347 | Fluxbox::instance()->hideExtraMenus(screen()); | 2396 | Fluxbox::instance()->hideExtraMenus(screen()); |
2348 | screen().hideWindowMenus(this); | 2397 | screen().hideWindowMenus(this); |
@@ -3269,16 +3318,6 @@ void FluxboxWindow::changeBlackboxHints(const BlackboxHints &net) { | |||
3269 | 3318 | ||
3270 | } | 3319 | } |
3271 | 3320 | ||
3272 | void FluxboxWindow::upsize() { | ||
3273 | |||
3274 | } | ||
3275 | |||
3276 | |||
3277 | ///TODO | ||
3278 | void FluxboxWindow::downsize() { | ||
3279 | |||
3280 | } | ||
3281 | |||
3282 | 3321 | ||
3283 | void FluxboxWindow::fixsize(int *user_w, int *user_h) { | 3322 | void FluxboxWindow::fixsize(int *user_w, int *user_h) { |
3284 | int titlebar_height = (decorations.titlebar ? | 3323 | int titlebar_height = (decorations.titlebar ? |