all repos — fluxbox @ 7d793fc6a8d7aa07a7636df2e96054c4a8e2c6a8

custom fork of the fluxbox windowmanager

fix issues that resulted in unnecessary X errors
rathnor rathnor
commit

7d793fc6a8d7aa07a7636df2e96054c4a8e2c6a8

parent

c8f9cf1177b6de1cc210f0706dae302b9aa4f7b5

M ChangeLogChangeLog

@@ -1,5 +1,8 @@

(Format: Year/Month/Day) Changes for 0.9.11 +*04/09/11: + * Fix issues that caused unnecessary X errors (Simon) + fluxbox.cc Window.cc FbTk/Menu.cc FbTk/FbPixmap.cc FbTk/FbWindow.hh/cc *04/09/10: * Cosmetic and cleanup changes to FbTk/* (Mathias) - tabs -> spaces, wrong indention etc in all mentioned
M src/FbTk/FbPixmap.ccsrc/FbTk/FbPixmap.cc

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FbPixmap.cc,v 1.14 2004/09/10 15:46:08 akir Exp $ +// $Id: FbPixmap.cc,v 1.15 2004/09/11 12:33:14 rathnor Exp $ #include "FbPixmap.hh" #include "App.hh"

@@ -305,28 +305,26 @@ " !!! WARNING WARNING WARNING WARNING !!!!!!\n\n"

}; Pixmap root_pm = None; - for (prop = 0; prop_ids[prop]; prop++) { if (XGetWindowProperty(s_display, RootWindow(s_display, screen_num), XInternAtom(s_display, prop_ids[prop], False), - 0L, 4, + 0l, 4l, False, XA_PIXMAP, &real_type, &real_format, &items_read, &items_left, - (unsigned char **) &data) == Success && - real_format == 32 && items_read == 1) { + (unsigned char **) &data) == Success) { + if (real_format == 32 && items_read == 1) { - if (strcmp(prop_ids[prop], "_XSETROOT_ID") == 0) { - if (print_error) { + if (print_error && strcmp(prop_ids[prop], "_XSETROOT_ID") == 0) { fprintf(stderr, "%s", error_message); print_error = false; - } - } else - root_pm = (Pixmap) (*data); - + } else + root_pm = (Pixmap) (*data); + } XFree(data); - break; + if (root_pm != None) + break; } }
M src/FbTk/FbWindow.ccsrc/FbTk/FbWindow.cc

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FbWindow.cc,v 1.39 2004/09/10 15:46:08 akir Exp $ +// $Id: FbWindow.cc,v 1.40 2004/09/11 12:33:14 rathnor Exp $ #include "FbWindow.hh" #include "FbPixmap.hh"

@@ -315,10 +315,11 @@ void FbWindow::unsetCursor() {

XUndefineCursor(s_display, window()); } -void FbWindow::reparent(const FbWindow &parent, int x, int y) { +void FbWindow::reparent(const FbWindow &parent, int x, int y, bool continuing) { XReparentWindow(s_display, window(), parent.window(), x, y); m_parent = &parent; - updateGeometry(); + if (continuing) // we will continue managing this window after reparent + updateGeometry(); } std::string FbWindow::textProperty(Atom property) const {
M src/FbTk/FbWindow.hhsrc/FbTk/FbWindow.hh

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FbWindow.hh,v 1.33 2004/09/10 15:46:08 akir Exp $ +// $Id: FbWindow.hh,v 1.34 2004/09/11 12:33:14 rathnor Exp $ #ifndef FBTK_FBWINDOW_HH #define FBTK_FBWINDOW_HH

@@ -119,7 +119,7 @@ /// defines a cursor for this window

void setCursor(Cursor cur); /// uses the parents cursor instead void unsetCursor(); - void reparent(const FbWindow &parent, int x, int y); + void reparent(const FbWindow &parent, int x, int y, bool continuing = true); bool property(Atom property, long long_offset, long long_length,
M src/FbTk/Menu.ccsrc/FbTk/Menu.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Menu.cc,v 1.80 2004/09/09 14:29:10 akir Exp $ +// $Id: Menu.cc,v 1.81 2004/09/11 12:33:14 rathnor Exp $ //use GNU extensions #ifndef _GNU_SOURCE

@@ -433,7 +433,7 @@ menu.persub = 0;

} int itmp = (theme().itemHeight() * menu.persub); - menu.frame_h = itmp < 0 ? 0 : itmp; + menu.frame_h = itmp < 1 ? 1 : itmp; int new_width = (menu.sublevels * menu.item_w); int new_height = menu.frame_h;

@@ -442,8 +442,12 @@ if (title_vis)

new_height += theme().titleHeight() + ((menu.frame_h > 0)?menu.title.borderWidth():0); - if (new_width < 1) - new_width = menu.item_w; + if (new_width < 1) { + if (menu.item_w > 0) + new_width = menu.item_w; + else + new_width = 1; + } if (new_height < 1) new_height = 1;

@@ -548,7 +552,7 @@ width() + menu.title.borderWidth(), theme().titleHeight());

} menu.frame.moveResize(0, ((title_vis) ? menu.title.y() + menu.title.height() + - menu.title.borderWidth()*2 : 0), + menu.title.borderWidth()*2 : 1), width(), menu.frame_h);
M src/Window.ccsrc/Window.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.cc,v 1.298 2004/08/31 15:26:38 rathnor Exp $ +// $Id: Window.cc,v 1.299 2004/09/11 12:33:14 rathnor Exp $ #include "Window.hh"

@@ -3232,7 +3232,7 @@ cerr<<"FluxboxWindow::restore: reparent 0x"<<hex<<client->window()<<dec<<" to root"<<endl;

#endif // DEBUG // reparent to root window - client->reparent(screen().rootWindow(), frame().x(), frame().y()); + client->reparent(screen().rootWindow(), frame().x(), frame().y(), false); if (!remap) client->hide();
M src/fluxbox.ccsrc/fluxbox.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: fluxbox.cc,v 1.252 2004/09/08 16:50:42 akir Exp $ +// $Id: fluxbox.cc,v 1.253 2004/09/11 12:33:14 rathnor Exp $ #include "fluxbox.hh"

@@ -386,18 +386,20 @@

} // end anonymous static int handleXErrors(Display *d, XErrorEvent *e) { + if (e->error_code == BadWindow) + last_bad_window = e->resourceid; #ifdef DEBUG - /* - char errtxt[128]; - - XGetErrorText(d, e->error_code, errtxt, 128); - cerr<<"Fluxbox: X Error: "<<errtxt<<"("<<(int)e->error_code<<") opcodes "<< - (int)e->request_code<<"/"<<(int)e->minor_code<<" resource 0x"<<hex<<(int)e->resourceid<<dec<<endl; - */ + else { + // ignore bad window ones, they happen a lot + // when windows close themselves + char errtxt[128]; + + XGetErrorText(d, e->error_code, errtxt, 128); + cerr<<"Fluxbox: X Error: "<<errtxt<<"("<<(int)e->error_code<<") opcodes "<< + (int)e->request_code<<"/"<<(int)e->minor_code<<" resource 0x"<<hex<<(int)e->resourceid<<dec<<endl; + } #endif // !DEBUG - if (e->error_code == BadWindow) - last_bad_window = e->resourceid; return False; }

@@ -501,6 +503,7 @@ to.tv_usec = 1;

m_reconfig_timer.setTimeout(to); m_reconfig_timer.setCommand(reconfig_cmd); m_reconfig_timer.fireOnce(true); + //XSynchronize(disp, True); s_singleton = this; m_have_shape = false;

@@ -633,10 +636,11 @@ // setup theme manager to have our style file ready to be scanned

FbTk::ThemeManager::instance().load(FbTk::StringUtil::expandFilename(getStyleFilename())); XSynchronize(disp, False); + //XSynchronize(disp, True); sync(false); m_reconfigure_wait = m_reread_menu_wait = false; - + // Create keybindings handler and load keys file m_key.reset(new Keys(StringUtil::expandFilename(*m_rc_keyfile).c_str()));

@@ -1813,7 +1817,7 @@ StringUtil::stringtok(paths, value.addr, ", ");

for (unsigned int i=0; i<paths.size(); ++i) FbTk::Image::addSearchPath(paths[i]); } - + if (!dbfile.empty()) { if (!m_screen_rm.load(dbfile.c_str())) { cerr<<_FBTEXT(Fluxbox, CantLoadRCFile, "Failed to load database", "Failed trying to read rc file")<<":"<<dbfile<<endl;