From f5f979ef374623fffc321300ec7f699acd20e426 Mon Sep 17 00:00:00 2001 From: rathnor Date: Tue, 28 Oct 2003 02:17:03 +0000 Subject: make client windows only reparented one below toplevel - i.e. not into clientarea --- ChangeLog | 9 ++++++ src/FbWinFrame.cc | 31 ++++++++++++-------- src/FbWinFrame.hh | 4 +-- src/Window.cc | 87 +++++++++++++++++++++++++++++-------------------------- src/Window.hh | 6 ++-- src/fluxbox.cc | 5 ++-- 6 files changed, 82 insertions(+), 60 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3caf342..7b6d846 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ (Format: Year/Month/Day) Changes for 0.9.6: +*03/10/27: + * Change FbWinFrame to NOT reparent client windows into clientarea (Simon) + - fixes (I think) java bug with missing drawing bits of window + - allows us to remove some dodgy "and for parent" hacks (not done in + this patch, but will be in new action system which depends on this) + - clientarea still exists for future implementation of improved + sizing, particularly to provide a backing to clients that don't + take up the whole area. + FbWinFrame.hh/cc Window.hh/cc fluxbox.cc *03/10/26: * Fixed bug in FbWindow::setNew (Henrik) It didn't update member variables diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc index ccbcaed..0d84fd6 100644 --- a/src/FbWinFrame.cc +++ b/src/FbWinFrame.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FbWinFrame.cc,v 1.59 2003/10/09 16:48:09 rathnor Exp $ +// $Id: FbWinFrame.cc,v 1.60 2003/10/28 02:17:02 rathnor Exp $ #include "FbWinFrame.hh" @@ -367,15 +367,17 @@ void FbWinFrame::setClientWindow(Window win) { XSetWindowBorderWidth(display, win, 0); XChangeSaveSet(display, win, SetModeInsert); - - XSelectInput(display, m_clientarea.window(), NoEventMask); + + XSelectInput(display, m_window.window(), NoEventMask); + // we need to mask this so we don't get unmap event XSelectInput(display, win, NoEventMask); - XReparentWindow(display, win, m_clientarea.window(), 0, 0); + XReparentWindow(display, win, m_window.window(), 0, m_clientarea.y()); // remask window so we get events XSelectInput(display, win, PropertyChangeMask | StructureNotifyMask | FocusChangeMask); - XSelectInput(display, m_clientarea.window(), SubstructureRedirectMask); + XSelectInput(display, m_window.window(), ButtonPressMask | ButtonReleaseMask | + ButtonMotionMask | EnterWindowMask | SubstructureRedirectMask); XFlush(display); @@ -387,8 +389,8 @@ void FbWinFrame::setClientWindow(Window win) { XChangeWindowAttributes(display, win, CWEventMask|CWDontPropagate, &attrib_set); m_clientarea.raise(); - m_clientarea.showSubwindows(); - + XRaiseWindow(display, win); + m_window.showSubwindows(); } bool FbWinFrame::hideTitlebar() { @@ -397,7 +399,6 @@ bool FbWinFrame::hideTitlebar() { m_titlebar.hide(); m_use_titlebar = false; - m_clientarea.raise(); // only take away one borderwidth (as the other border is still the "top" border) m_window.resize(m_window.width(), m_window.height() - m_titlebar.height() - @@ -623,8 +624,12 @@ void FbWinFrame::reconfigure() { gripLeft().height()); // align titlebar and render it - if (m_use_titlebar) + if (m_use_titlebar) { reconfigureTitlebar(); + m_titlebar.raise(); + } else + m_titlebar.lower(); + // leave client+grips alone if we're shaded (it'll get fixed when we unshade) if (!m_shaded) { @@ -644,10 +649,8 @@ void FbWinFrame::reconfigure() { m_clientarea.moveResize(0, client_top, m_window.width(), client_height); - if (m_use_handle) { - // align handle and grips const int grip_height = m_handle.height(); const int grip_width = 20; //TODO @@ -662,8 +665,12 @@ void FbWinFrame::reconfigure() { m_grip_right.moveResize(m_handle.width() - grip_width - handle_bw, -handle_bw, grip_width, grip_height); + m_handle.raise(); + } else { + m_handle.lower(); } - } + } + // render the theme renderButtons(); diff --git a/src/FbWinFrame.hh b/src/FbWinFrame.hh index f1ca769..9c26903 100644 --- a/src/FbWinFrame.hh +++ b/src/FbWinFrame.hh @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FbWinFrame.hh,v 1.23 2003/10/05 09:03:43 rathnor Exp $ +// $Id: FbWinFrame.hh,v 1.24 2003/10/28 02:17:02 rathnor Exp $ #ifndef FBWINFRAME_HH #define FBWINFRAME_HH @@ -228,7 +228,7 @@ private: FbTk::FbWindow m_handle; ///< handle between grips FbTk::FbWindow m_grip_right, ///< rightgrip m_grip_left; ///< left grip - FbTk::FbWindow m_clientarea; ///< window that holds client window @see setClientWindow + FbTk::FbWindow m_clientarea; ///< window that sits behind client window to fill gaps @see setClientWindow //@} typedef std::vector ButtonList; ButtonList m_buttons_left, ///< buttons to the left 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 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.cc,v 1.242 2003/10/26 20:59:07 fluxgen Exp $ +// $Id: Window.cc,v 1.243 2003/10/28 02:17:02 rathnor Exp $ #include "Window.hh" @@ -467,12 +467,12 @@ void FluxboxWindow::init() { upsize(); - associateClientWindow(); + applyDecorations(true); + + associateClientWindow(true, wattrib.x, wattrib.y, wattrib.width, wattrib.height); grabButtons(); - applyDecorations(true); - if (m_workspace_number < 0 || m_workspace_number >= screen().getCount()) m_workspace_number = screen().currentWorkspaceID(); @@ -504,9 +504,6 @@ void FluxboxWindow::init() { if (wattrib.height <= 0) wattrib.height = 1; - frame().moveResizeForClient(wattrib.x, wattrib.y, - wattrib.width, wattrib.height); - // if we're a transient then we should be on the same layer as our parent if (m_client->isTransient() && m_client->transientFor()->fbwindow() && @@ -558,7 +555,7 @@ void FluxboxWindow::init() { if (m_shaped) shape(); - + XSync(display, false); } /// apply shape to this window @@ -607,9 +604,11 @@ void FluxboxWindow::attachClient(WinClient &client) { // reparent window to this frame().setClientWindow(**client_it); - resizeClient(**client_it, - frame().clientArea().width(), - frame().clientArea().height()); + moveResizeClient(**client_it, + frame().clientArea().x(), + frame().clientArea().y(), + frame().clientArea().width(), + frame().clientArea().height()); (*client_it)->m_win = this; // create a labelbutton for this client and @@ -910,22 +909,27 @@ bool FluxboxWindow::isGroupable() const { return false; } -void FluxboxWindow::associateClientWindow() { +void FluxboxWindow::associateClientWindow(bool use_attrs, int x, int y, unsigned int width, unsigned int height) { m_client->setBorderWidth(0); updateTitleFromClient(*m_client); updateIconNameFromClient(*m_client); + if (use_attrs) + frame().moveResizeForClient(x, y, + width, height); + else + frame().resizeForClient(m_client->width(), m_client->height()); + frame().setClientWindow(*m_client); - frame().resizeForClient(m_client->width(), m_client->height()); } void FluxboxWindow::grabButtons() { XGrabButton(display, Button1, AnyModifier, - frame().clientArea().window(), True, ButtonPressMask, + frame().window().window(), True, ButtonPressMask, GrabModeSync, GrabModeSync, None, None); - XUngrabButton(display, Button1, Mod1Mask|Mod2Mask|Mod3Mask, frame().clientArea().window()); + XUngrabButton(display, Button1, Mod1Mask|Mod2Mask|Mod3Mask, frame().window().window()); XGrabButton(display, Button1, Mod1Mask, frame().window().window(), True, @@ -2268,13 +2272,13 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent &be) { setInputFocus(); } - if (frame().clientArea() == be.window) { + if (frame().window().window() == be.window) { if (screen().clickRaises()) raise(); XAllowEvents(display, ReplayPointer, be.time); - } else { + m_button_grab_x = be.x_root - frame().x() - frame().window().borderWidth(); - m_button_grab_y = be.y_root - frame().y() - frame().window().borderWidth(); + m_button_grab_y = be.y_root - frame().y() - frame().window().borderWidth(); } if (m_windowmenu.isVisible()) @@ -2668,7 +2672,7 @@ void FluxboxWindow::applyDecorations(bool initial) { } frame().reconfigure(); - if (client_move) + if (!initial && client_move) sendConfigureNotify(); } @@ -3234,10 +3238,11 @@ void FluxboxWindow::fixsize(int *user_w, int *user_h) { } -void FluxboxWindow::resizeClient(WinClient &client, +void FluxboxWindow::moveResizeClient(WinClient &client, int x, int y, unsigned int height, unsigned int width) { - client.resize(frame().clientArea().width(), - frame().clientArea().height()); + client.moveResize(x, y, + frame().clientArea().width(), + frame().clientArea().height()); client.updateRect(frame().x() + frame().clientArea().x(), frame().y() + frame().clientArea().y(), frame().clientArea().width(), @@ -3256,29 +3261,29 @@ void FluxboxWindow::sendConfigureNotify(bool send_to_netizens) { //!! client.x = frame().x(); client.y = frame().y(); - resizeClient(client, + moveResizeClient(client, + frame().clientArea().x(), + frame().clientArea().y(), frame().clientArea().width(), frame().clientArea().height()); - - XEvent event; - event.type = ConfigureNotify; - - event.xconfigure.display = display; - event.xconfigure.event = client.window(); - event.xconfigure.window = client.window(); - event.xconfigure.x = frame().x() + frame().clientArea().x(); - event.xconfigure.y = frame().y() + frame().clientArea().y(); - event.xconfigure.width = client.width(); - event.xconfigure.height = client.height(); - event.xconfigure.border_width = client.old_bw; - event.xconfigure.above = frame().window().window(); - event.xconfigure.override_redirect = false; - - XSendEvent(display, client.window(), False, StructureNotifyMask, &event); - - if (send_to_netizens) + if (send_to_netizens) { + XEvent event; + event.type = ConfigureNotify; + + event.xconfigure.display = display; + event.xconfigure.event = client.window(); + event.xconfigure.window = client.window(); + event.xconfigure.x = frame().x() + frame().clientArea().x(); + event.xconfigure.y = frame().y() + frame().clientArea().y(); + event.xconfigure.width = client.width(); + event.xconfigure.height = client.height(); + event.xconfigure.border_width = client.old_bw; + event.xconfigure.above = frame().window().window(); + event.xconfigure.override_redirect = false; + screen().updateNetizenConfigNotify(event); + } } // end for } diff --git a/src/Window.hh b/src/Window.hh index 480d637..7db118c 100644 --- a/src/Window.hh +++ b/src/Window.hh @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.hh,v 1.99 2003/10/06 06:22:43 rathnor Exp $ +// $Id: Window.hh,v 1.100 2003/10/28 02:17:03 rathnor Exp $ #ifndef WINDOW_HH #define WINDOW_HH @@ -388,7 +388,7 @@ private: void updateBlackboxHintsFromClient(WinClient &client); void saveBlackboxAttribs(); void setNetWMAttributes(); - void associateClientWindow(); + void associateClientWindow(bool use_attrs = false, int x = 0, int y = 0, unsigned int width = 1, unsigned int height = 1); void restoreGravity(); void setGravityOffsets(); @@ -400,7 +400,7 @@ private: void doSnapping(int &left, int &top); // user_w/h return the values that should be shown to the user void fixsize(int *user_w = 0, int *user_h = 0); - void resizeClient(WinClient &client, unsigned int width, unsigned int height); + void moveResizeClient(WinClient &client, int x, int y, unsigned int width, unsigned int height); /// sends configurenotify to all clients void sendConfigureNotify(bool send_to_netizens = true); // state and hint signals diff --git a/src/fluxbox.cc b/src/fluxbox.cc index 50cb292..7b6f0b8 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: fluxbox.cc,v 1.200 2003/10/14 16:23:15 rathnor Exp $ +// $Id: fluxbox.cc,v 1.201 2003/10/28 02:17:03 rathnor Exp $ #include "fluxbox.hh" @@ -560,11 +560,12 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile screen->workspaceCountSig().attach(this); screen->workspaceNamesSig().attach(this); screen->clientListSig().attach(this); - + // initiate atomhandler for screen specific stuff for (size_t atomh=0; atomhinitForScreen(*screen); } + revertFocus(*screen, false); // make sure focus style is correct } m_keyscreen = m_mousescreen = m_screen_list.front(); -- cgit v0.11.2