fix issues that resulted in unnecessary X errors

This commit is contained in:
rathnor 2004-09-11 12:33:14 +00:00
parent c8f9cf1177
commit 7d793fc6a8
7 changed files with 47 additions and 37 deletions

View file

@ -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

View file

@ -19,7 +19,7 @@
// 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 @@ Pixmap FbPixmap::getRootPixmap(int screen_num) {
};
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;
}
}

View file

@ -19,7 +19,7 @@
// 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 {

View file

@ -19,7 +19,7 @@
// 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 @@ public:
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,

View file

@ -22,7 +22,7 @@
// 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 @@ void Menu::update(int active_index) {
}
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 @@ void Menu::update(int active_index) {
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 @@ void Menu::update(int active_index) {
}
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);

View file

@ -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.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 @@ void FluxboxWindow::restore(WinClient *client, bool remap) {
#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();

View file

@ -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.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 @@ void copyFile(const std::string &from, const std::string &to) {
} // end anonymous
static int handleXErrors(Display *d, XErrorEvent *e) {
#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;
*/
#endif // !DEBUG
if (e->error_code == BadWindow)
last_bad_window = e->resourceid;
#ifdef DEBUG
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
return False;
}
@ -501,6 +503,7 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
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 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
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 @@ void Fluxbox::load_rc(BScreen &screen) {
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;