diff options
Diffstat (limited to 'src/Window.cc')
-rw-r--r-- | src/Window.cc | 87 |
1 files changed, 46 insertions, 41 deletions
diff --git a/src/Window.cc b/src/Window.cc index cde054a..cce7d16 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.242 2003/10/26 20:59:07 fluxgen Exp $ | 25 | // $Id: Window.cc,v 1.243 2003/10/28 02:17:02 rathnor Exp $ |
26 | 26 | ||
27 | #include "Window.hh" | 27 | #include "Window.hh" |
28 | 28 | ||
@@ -467,12 +467,12 @@ void FluxboxWindow::init() { | |||
467 | 467 | ||
468 | upsize(); | 468 | upsize(); |
469 | 469 | ||
470 | associateClientWindow(); | 470 | applyDecorations(true); |
471 | |||
472 | associateClientWindow(true, wattrib.x, wattrib.y, wattrib.width, wattrib.height); | ||
471 | 473 | ||
472 | grabButtons(); | 474 | grabButtons(); |
473 | 475 | ||
474 | applyDecorations(true); | ||
475 | |||
476 | if (m_workspace_number < 0 || m_workspace_number >= screen().getCount()) | 476 | if (m_workspace_number < 0 || m_workspace_number >= screen().getCount()) |
477 | m_workspace_number = screen().currentWorkspaceID(); | 477 | m_workspace_number = screen().currentWorkspaceID(); |
478 | 478 | ||
@@ -504,9 +504,6 @@ void FluxboxWindow::init() { | |||
504 | if (wattrib.height <= 0) | 504 | if (wattrib.height <= 0) |
505 | wattrib.height = 1; | 505 | wattrib.height = 1; |
506 | 506 | ||
507 | frame().moveResizeForClient(wattrib.x, wattrib.y, | ||
508 | wattrib.width, wattrib.height); | ||
509 | |||
510 | // if we're a transient then we should be on the same layer as our parent | 507 | // if we're a transient then we should be on the same layer as our parent |
511 | if (m_client->isTransient() && | 508 | if (m_client->isTransient() && |
512 | m_client->transientFor()->fbwindow() && | 509 | m_client->transientFor()->fbwindow() && |
@@ -558,7 +555,7 @@ void FluxboxWindow::init() { | |||
558 | if (m_shaped) | 555 | if (m_shaped) |
559 | shape(); | 556 | shape(); |
560 | 557 | ||
561 | 558 | XSync(display, false); | |
562 | } | 559 | } |
563 | 560 | ||
564 | /// apply shape to this window | 561 | /// apply shape to this window |
@@ -607,9 +604,11 @@ void FluxboxWindow::attachClient(WinClient &client) { | |||
607 | 604 | ||
608 | // reparent window to this | 605 | // reparent window to this |
609 | frame().setClientWindow(**client_it); | 606 | frame().setClientWindow(**client_it); |
610 | resizeClient(**client_it, | 607 | moveResizeClient(**client_it, |
611 | frame().clientArea().width(), | 608 | frame().clientArea().x(), |
612 | frame().clientArea().height()); | 609 | frame().clientArea().y(), |
610 | frame().clientArea().width(), | ||
611 | frame().clientArea().height()); | ||
613 | 612 | ||
614 | (*client_it)->m_win = this; | 613 | (*client_it)->m_win = this; |
615 | // create a labelbutton for this client and | 614 | // create a labelbutton for this client and |
@@ -910,22 +909,27 @@ bool FluxboxWindow::isGroupable() const { | |||
910 | return false; | 909 | return false; |
911 | } | 910 | } |
912 | 911 | ||
913 | void FluxboxWindow::associateClientWindow() { | 912 | void FluxboxWindow::associateClientWindow(bool use_attrs, int x, int y, unsigned int width, unsigned int height) { |
914 | m_client->setBorderWidth(0); | 913 | m_client->setBorderWidth(0); |
915 | updateTitleFromClient(*m_client); | 914 | updateTitleFromClient(*m_client); |
916 | updateIconNameFromClient(*m_client); | 915 | updateIconNameFromClient(*m_client); |
917 | 916 | ||
917 | if (use_attrs) | ||
918 | frame().moveResizeForClient(x, y, | ||
919 | width, height); | ||
920 | else | ||
921 | frame().resizeForClient(m_client->width(), m_client->height()); | ||
922 | |||
918 | frame().setClientWindow(*m_client); | 923 | frame().setClientWindow(*m_client); |
919 | frame().resizeForClient(m_client->width(), m_client->height()); | ||
920 | } | 924 | } |
921 | 925 | ||
922 | 926 | ||
923 | void FluxboxWindow::grabButtons() { | 927 | void FluxboxWindow::grabButtons() { |
924 | 928 | ||
925 | XGrabButton(display, Button1, AnyModifier, | 929 | XGrabButton(display, Button1, AnyModifier, |
926 | frame().clientArea().window(), True, ButtonPressMask, | 930 | frame().window().window(), True, ButtonPressMask, |
927 | GrabModeSync, GrabModeSync, None, None); | 931 | GrabModeSync, GrabModeSync, None, None); |
928 | XUngrabButton(display, Button1, Mod1Mask|Mod2Mask|Mod3Mask, frame().clientArea().window()); | 932 | XUngrabButton(display, Button1, Mod1Mask|Mod2Mask|Mod3Mask, frame().window().window()); |
929 | 933 | ||
930 | 934 | ||
931 | XGrabButton(display, Button1, Mod1Mask, frame().window().window(), True, | 935 | XGrabButton(display, Button1, Mod1Mask, frame().window().window(), True, |
@@ -2268,13 +2272,13 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent &be) { | |||
2268 | setInputFocus(); | 2272 | setInputFocus(); |
2269 | } | 2273 | } |
2270 | 2274 | ||
2271 | if (frame().clientArea() == be.window) { | 2275 | if (frame().window().window() == be.window) { |
2272 | if (screen().clickRaises()) | 2276 | if (screen().clickRaises()) |
2273 | raise(); | 2277 | raise(); |
2274 | XAllowEvents(display, ReplayPointer, be.time); | 2278 | XAllowEvents(display, ReplayPointer, be.time); |
2275 | } else { | 2279 | |
2276 | m_button_grab_x = be.x_root - frame().x() - frame().window().borderWidth(); | 2280 | m_button_grab_x = be.x_root - frame().x() - frame().window().borderWidth(); |
2277 | m_button_grab_y = be.y_root - frame().y() - frame().window().borderWidth(); | 2281 | m_button_grab_y = be.y_root - frame().y() - frame().window().borderWidth(); |
2278 | } | 2282 | } |
2279 | 2283 | ||
2280 | if (m_windowmenu.isVisible()) | 2284 | if (m_windowmenu.isVisible()) |
@@ -2668,7 +2672,7 @@ void FluxboxWindow::applyDecorations(bool initial) { | |||
2668 | } | 2672 | } |
2669 | 2673 | ||
2670 | frame().reconfigure(); | 2674 | frame().reconfigure(); |
2671 | if (client_move) | 2675 | if (!initial && client_move) |
2672 | sendConfigureNotify(); | 2676 | sendConfigureNotify(); |
2673 | } | 2677 | } |
2674 | 2678 | ||
@@ -3234,10 +3238,11 @@ void FluxboxWindow::fixsize(int *user_w, int *user_h) { | |||
3234 | 3238 | ||
3235 | } | 3239 | } |
3236 | 3240 | ||
3237 | void FluxboxWindow::resizeClient(WinClient &client, | 3241 | void FluxboxWindow::moveResizeClient(WinClient &client, int x, int y, |
3238 | unsigned int height, unsigned int width) { | 3242 | unsigned int height, unsigned int width) { |
3239 | client.resize(frame().clientArea().width(), | 3243 | client.moveResize(x, y, |
3240 | frame().clientArea().height()); | 3244 | frame().clientArea().width(), |
3245 | frame().clientArea().height()); | ||
3241 | client.updateRect(frame().x() + frame().clientArea().x(), | 3246 | client.updateRect(frame().x() + frame().clientArea().x(), |
3242 | frame().y() + frame().clientArea().y(), | 3247 | frame().y() + frame().clientArea().y(), |
3243 | frame().clientArea().width(), | 3248 | frame().clientArea().width(), |
@@ -3256,29 +3261,29 @@ void FluxboxWindow::sendConfigureNotify(bool send_to_netizens) { | |||
3256 | //!! | 3261 | //!! |
3257 | client.x = frame().x(); | 3262 | client.x = frame().x(); |
3258 | client.y = frame().y(); | 3263 | client.y = frame().y(); |
3259 | resizeClient(client, | 3264 | moveResizeClient(client, |
3265 | frame().clientArea().x(), | ||
3266 | frame().clientArea().y(), | ||
3260 | frame().clientArea().width(), | 3267 | frame().clientArea().width(), |
3261 | frame().clientArea().height()); | 3268 | frame().clientArea().height()); |
3262 | 3269 | ||
3263 | 3270 | if (send_to_netizens) { | |
3264 | XEvent event; | 3271 | XEvent event; |
3265 | event.type = ConfigureNotify; | 3272 | event.type = ConfigureNotify; |
3266 | 3273 | ||
3267 | event.xconfigure.display = display; | 3274 | event.xconfigure.display = display; |
3268 | event.xconfigure.event = client.window(); | 3275 | event.xconfigure.event = client.window(); |
3269 | event.xconfigure.window = client.window(); | 3276 | event.xconfigure.window = client.window(); |
3270 | event.xconfigure.x = frame().x() + frame().clientArea().x(); | 3277 | event.xconfigure.x = frame().x() + frame().clientArea().x(); |
3271 | event.xconfigure.y = frame().y() + frame().clientArea().y(); | 3278 | event.xconfigure.y = frame().y() + frame().clientArea().y(); |
3272 | event.xconfigure.width = client.width(); | 3279 | event.xconfigure.width = client.width(); |
3273 | event.xconfigure.height = client.height(); | 3280 | event.xconfigure.height = client.height(); |
3274 | event.xconfigure.border_width = client.old_bw; | 3281 | event.xconfigure.border_width = client.old_bw; |
3275 | event.xconfigure.above = frame().window().window(); | 3282 | event.xconfigure.above = frame().window().window(); |
3276 | event.xconfigure.override_redirect = false; | 3283 | event.xconfigure.override_redirect = false; |
3277 | 3284 | ||
3278 | XSendEvent(display, client.window(), False, StructureNotifyMask, &event); | ||
3279 | |||
3280 | if (send_to_netizens) | ||
3281 | screen().updateNetizenConfigNotify(event); | 3285 | screen().updateNetizenConfigNotify(event); |
3286 | } | ||
3282 | } // end for | 3287 | } // end for |
3283 | } | 3288 | } |
3284 | 3289 | ||