make client windows only reparented one below toplevel - i.e. not into

clientarea
This commit is contained in:
rathnor 2003-10-28 02:17:03 +00:00
parent 6b9b0e89e4
commit f5f979ef37
6 changed files with 80 additions and 58 deletions

View file

@ -1,5 +1,14 @@
(Format: Year/Month/Day) (Format: Year/Month/Day)
Changes for 0.9.6: 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: *03/10/26:
* Fixed bug in FbWindow::setNew (Henrik) * Fixed bug in FbWindow::setNew (Henrik)
It didn't update member variables It didn't update member variables

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // 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" #include "FbWinFrame.hh"
@ -368,14 +368,16 @@ void FbWinFrame::setClientWindow(Window win) {
XChangeSaveSet(display, win, SetModeInsert); 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 // we need to mask this so we don't get unmap event
XSelectInput(display, win, NoEventMask); 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 // remask window so we get events
XSelectInput(display, win, PropertyChangeMask | StructureNotifyMask | XSelectInput(display, win, PropertyChangeMask | StructureNotifyMask |
FocusChangeMask); FocusChangeMask);
XSelectInput(display, m_clientarea.window(), SubstructureRedirectMask); XSelectInput(display, m_window.window(), ButtonPressMask | ButtonReleaseMask |
ButtonMotionMask | EnterWindowMask | SubstructureRedirectMask);
XFlush(display); XFlush(display);
@ -387,8 +389,8 @@ void FbWinFrame::setClientWindow(Window win) {
XChangeWindowAttributes(display, win, CWEventMask|CWDontPropagate, &attrib_set); XChangeWindowAttributes(display, win, CWEventMask|CWDontPropagate, &attrib_set);
m_clientarea.raise(); m_clientarea.raise();
m_clientarea.showSubwindows(); XRaiseWindow(display, win);
m_window.showSubwindows();
} }
bool FbWinFrame::hideTitlebar() { bool FbWinFrame::hideTitlebar() {
@ -397,7 +399,6 @@ bool FbWinFrame::hideTitlebar() {
m_titlebar.hide(); m_titlebar.hide();
m_use_titlebar = false; m_use_titlebar = false;
m_clientarea.raise();
// only take away one borderwidth (as the other border is still the "top" border) // 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() - m_window.resize(m_window.width(), m_window.height() - m_titlebar.height() -
@ -623,8 +624,12 @@ void FbWinFrame::reconfigure() {
gripLeft().height()); gripLeft().height());
// align titlebar and render it // align titlebar and render it
if (m_use_titlebar) if (m_use_titlebar) {
reconfigureTitlebar(); reconfigureTitlebar();
m_titlebar.raise();
} else
m_titlebar.lower();
// leave client+grips alone if we're shaded (it'll get fixed when we unshade) // leave client+grips alone if we're shaded (it'll get fixed when we unshade)
if (!m_shaded) { if (!m_shaded) {
@ -644,10 +649,8 @@ void FbWinFrame::reconfigure() {
m_clientarea.moveResize(0, client_top, m_clientarea.moveResize(0, client_top,
m_window.width(), client_height); m_window.width(), client_height);
if (m_use_handle) { if (m_use_handle) {
// align handle and grips // align handle and grips
const int grip_height = m_handle.height(); const int grip_height = m_handle.height();
const int grip_width = 20; //TODO const int grip_width = 20; //TODO
@ -662,9 +665,13 @@ void FbWinFrame::reconfigure() {
m_grip_right.moveResize(m_handle.width() - grip_width - handle_bw, -handle_bw, m_grip_right.moveResize(m_handle.width() - grip_width - handle_bw, -handle_bw,
grip_width, grip_height); grip_width, grip_height);
m_handle.raise();
} else {
m_handle.lower();
} }
} }
// render the theme // render the theme
renderButtons(); renderButtons();
if (!m_shaded) if (!m_shaded)

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // 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 #ifndef FBWINFRAME_HH
#define FBWINFRAME_HH #define FBWINFRAME_HH
@ -228,7 +228,7 @@ private:
FbTk::FbWindow m_handle; ///< handle between grips FbTk::FbWindow m_handle; ///< handle between grips
FbTk::FbWindow m_grip_right, ///< rightgrip FbTk::FbWindow m_grip_right, ///< rightgrip
m_grip_left; ///< left grip 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<FbTk::Button *> ButtonList; typedef std::vector<FbTk::Button *> ButtonList;
ButtonList m_buttons_left, ///< buttons to the left ButtonList m_buttons_left, ///< buttons to the left

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // 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" #include "Window.hh"
@ -467,12 +467,12 @@ void FluxboxWindow::init() {
upsize(); upsize();
associateClientWindow(); applyDecorations(true);
associateClientWindow(true, wattrib.x, wattrib.y, wattrib.width, wattrib.height);
grabButtons(); grabButtons();
applyDecorations(true);
if (m_workspace_number < 0 || m_workspace_number >= screen().getCount()) if (m_workspace_number < 0 || m_workspace_number >= screen().getCount())
m_workspace_number = screen().currentWorkspaceID(); m_workspace_number = screen().currentWorkspaceID();
@ -504,9 +504,6 @@ void FluxboxWindow::init() {
if (wattrib.height <= 0) if (wattrib.height <= 0)
wattrib.height = 1; 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 we're a transient then we should be on the same layer as our parent
if (m_client->isTransient() && if (m_client->isTransient() &&
m_client->transientFor()->fbwindow() && m_client->transientFor()->fbwindow() &&
@ -558,7 +555,7 @@ void FluxboxWindow::init() {
if (m_shaped) if (m_shaped)
shape(); shape();
XSync(display, false);
} }
/// apply shape to this window /// apply shape to this window
@ -607,9 +604,11 @@ void FluxboxWindow::attachClient(WinClient &client) {
// reparent window to this // reparent window to this
frame().setClientWindow(**client_it); frame().setClientWindow(**client_it);
resizeClient(**client_it, moveResizeClient(**client_it,
frame().clientArea().width(), frame().clientArea().x(),
frame().clientArea().height()); frame().clientArea().y(),
frame().clientArea().width(),
frame().clientArea().height());
(*client_it)->m_win = this; (*client_it)->m_win = this;
// create a labelbutton for this client and // create a labelbutton for this client and
@ -910,22 +909,27 @@ bool FluxboxWindow::isGroupable() const {
return false; 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); m_client->setBorderWidth(0);
updateTitleFromClient(*m_client); updateTitleFromClient(*m_client);
updateIconNameFromClient(*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().setClientWindow(*m_client);
frame().resizeForClient(m_client->width(), m_client->height());
} }
void FluxboxWindow::grabButtons() { void FluxboxWindow::grabButtons() {
XGrabButton(display, Button1, AnyModifier, XGrabButton(display, Button1, AnyModifier,
frame().clientArea().window(), True, ButtonPressMask, frame().window().window(), True, ButtonPressMask,
GrabModeSync, GrabModeSync, None, None); 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, XGrabButton(display, Button1, Mod1Mask, frame().window().window(), True,
@ -2268,11 +2272,11 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent &be) {
setInputFocus(); setInputFocus();
} }
if (frame().clientArea() == be.window) { if (frame().window().window() == be.window) {
if (screen().clickRaises()) if (screen().clickRaises())
raise(); raise();
XAllowEvents(display, ReplayPointer, be.time); XAllowEvents(display, ReplayPointer, be.time);
} else {
m_button_grab_x = be.x_root - frame().x() - frame().window().borderWidth(); 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();
} }
@ -2668,7 +2672,7 @@ void FluxboxWindow::applyDecorations(bool initial) {
} }
frame().reconfigure(); frame().reconfigure();
if (client_move) if (!initial && client_move)
sendConfigureNotify(); 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) { unsigned int height, unsigned int width) {
client.resize(frame().clientArea().width(), client.moveResize(x, y,
frame().clientArea().height()); frame().clientArea().width(),
frame().clientArea().height());
client.updateRect(frame().x() + frame().clientArea().x(), client.updateRect(frame().x() + frame().clientArea().x(),
frame().y() + frame().clientArea().y(), frame().y() + frame().clientArea().y(),
frame().clientArea().width(), frame().clientArea().width(),
@ -3256,29 +3261,29 @@ void FluxboxWindow::sendConfigureNotify(bool send_to_netizens) {
//!! //!!
client.x = frame().x(); client.x = frame().x();
client.y = frame().y(); client.y = frame().y();
resizeClient(client, moveResizeClient(client,
frame().clientArea().x(),
frame().clientArea().y(),
frame().clientArea().width(), frame().clientArea().width(),
frame().clientArea().height()); frame().clientArea().height());
if (send_to_netizens) {
XEvent event;
event.type = ConfigureNotify;
XEvent event; event.xconfigure.display = display;
event.type = ConfigureNotify; 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;
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)
screen().updateNetizenConfigNotify(event); screen().updateNetizenConfigNotify(event);
}
} // end for } // end for
} }

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // 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 #ifndef WINDOW_HH
#define WINDOW_HH #define WINDOW_HH
@ -388,7 +388,7 @@ private:
void updateBlackboxHintsFromClient(WinClient &client); void updateBlackboxHintsFromClient(WinClient &client);
void saveBlackboxAttribs(); void saveBlackboxAttribs();
void setNetWMAttributes(); 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 restoreGravity();
void setGravityOffsets(); void setGravityOffsets();
@ -400,7 +400,7 @@ private:
void doSnapping(int &left, int &top); void doSnapping(int &left, int &top);
// user_w/h return the values that should be shown to the user // user_w/h return the values that should be shown to the user
void fixsize(int *user_w = 0, int *user_h = 0); 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 /// sends configurenotify to all clients
void sendConfigureNotify(bool send_to_netizens = true); void sendConfigureNotify(bool send_to_netizens = true);
// state and hint signals // state and hint signals

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // 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" #include "fluxbox.hh"
@ -565,6 +565,7 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
for (size_t atomh=0; atomh<m_atomhandler.size(); ++atomh) { for (size_t atomh=0; atomh<m_atomhandler.size(); ++atomh) {
m_atomhandler[atomh]->initForScreen(*screen); m_atomhandler[atomh]->initForScreen(*screen);
} }
revertFocus(*screen, false); // make sure focus style is correct
} }
m_keyscreen = m_mousescreen = m_screen_list.front(); m_keyscreen = m_mousescreen = m_screen_list.front();