aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrathnor <rathnor>2004-09-11 12:33:14 (GMT)
committerrathnor <rathnor>2004-09-11 12:33:14 (GMT)
commit7d793fc6a8d7aa07a7636df2e96054c4a8e2c6a8 (patch)
treead753983b54d61f8a01fb32794d67bf50585789e /src
parentc8f9cf1177b6de1cc210f0706dae302b9aa4f7b5 (diff)
downloadfluxbox-7d793fc6a8d7aa07a7636df2e96054c4a8e2c6a8.zip
fluxbox-7d793fc6a8d7aa07a7636df2e96054c4a8e2c6a8.tar.bz2
fix issues that resulted in unnecessary X errors
Diffstat (limited to 'src')
-rw-r--r--src/FbTk/FbPixmap.cc22
-rw-r--r--src/FbTk/FbWindow.cc7
-rw-r--r--src/FbTk/FbWindow.hh4
-rw-r--r--src/FbTk/Menu.cc14
-rw-r--r--src/Window.cc4
-rw-r--r--src/fluxbox.cc28
6 files changed, 43 insertions, 36 deletions
diff --git a/src/FbTk/FbPixmap.cc b/src/FbTk/FbPixmap.cc
index 43e74d8..66eee21 100644
--- a/src/FbTk/FbPixmap.cc
+++ b/src/FbTk/FbPixmap.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: FbPixmap.cc,v 1.14 2004/09/10 15:46:08 akir Exp $ 22// $Id: FbPixmap.cc,v 1.15 2004/09/11 12:33:14 rathnor Exp $
23 23
24#include "FbPixmap.hh" 24#include "FbPixmap.hh"
25#include "App.hh" 25#include "App.hh"
@@ -305,28 +305,26 @@ Pixmap FbPixmap::getRootPixmap(int screen_num) {
305 }; 305 };
306 306
307 Pixmap root_pm = None; 307 Pixmap root_pm = None;
308
309 for (prop = 0; prop_ids[prop]; prop++) { 308 for (prop = 0; prop_ids[prop]; prop++) {
310 if (XGetWindowProperty(s_display, 309 if (XGetWindowProperty(s_display,
311 RootWindow(s_display, screen_num), 310 RootWindow(s_display, screen_num),
312 XInternAtom(s_display, prop_ids[prop], False), 311 XInternAtom(s_display, prop_ids[prop], False),
313 0L, 4, 312 0l, 4l,
314 False, XA_PIXMAP, 313 False, XA_PIXMAP,
315 &real_type, &real_format, 314 &real_type, &real_format,
316 &items_read, &items_left, 315 &items_read, &items_left,
317 (unsigned char **) &data) == Success && 316 (unsigned char **) &data) == Success) {
318 real_format == 32 && items_read == 1) { 317 if (real_format == 32 && items_read == 1) {
319 318
320 if (strcmp(prop_ids[prop], "_XSETROOT_ID") == 0) { 319 if (print_error && strcmp(prop_ids[prop], "_XSETROOT_ID") == 0) {
321 if (print_error) {
322 fprintf(stderr, "%s", error_message); 320 fprintf(stderr, "%s", error_message);
323 print_error = false; 321 print_error = false;
324 } 322 } else
325 } else 323 root_pm = (Pixmap) (*data);
326 root_pm = (Pixmap) (*data); 324 }
327
328 XFree(data); 325 XFree(data);
329 break; 326 if (root_pm != None)
327 break;
330 } 328 }
331 } 329 }
332 330
diff --git a/src/FbTk/FbWindow.cc b/src/FbTk/FbWindow.cc
index ea84701..2a4aafa 100644
--- a/src/FbTk/FbWindow.cc
+++ b/src/FbTk/FbWindow.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: FbWindow.cc,v 1.39 2004/09/10 15:46:08 akir Exp $ 22// $Id: FbWindow.cc,v 1.40 2004/09/11 12:33:14 rathnor Exp $
23 23
24#include "FbWindow.hh" 24#include "FbWindow.hh"
25#include "FbPixmap.hh" 25#include "FbPixmap.hh"
@@ -315,10 +315,11 @@ void FbWindow::unsetCursor() {
315 XUndefineCursor(s_display, window()); 315 XUndefineCursor(s_display, window());
316} 316}
317 317
318void FbWindow::reparent(const FbWindow &parent, int x, int y) { 318void FbWindow::reparent(const FbWindow &parent, int x, int y, bool continuing) {
319 XReparentWindow(s_display, window(), parent.window(), x, y); 319 XReparentWindow(s_display, window(), parent.window(), x, y);
320 m_parent = &parent; 320 m_parent = &parent;
321 updateGeometry(); 321 if (continuing) // we will continue managing this window after reparent
322 updateGeometry();
322} 323}
323 324
324std::string FbWindow::textProperty(Atom property) const { 325std::string FbWindow::textProperty(Atom property) const {
diff --git a/src/FbTk/FbWindow.hh b/src/FbTk/FbWindow.hh
index 36b39be..c39b8c1 100644
--- a/src/FbTk/FbWindow.hh
+++ b/src/FbTk/FbWindow.hh
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: FbWindow.hh,v 1.33 2004/09/10 15:46:08 akir Exp $ 22// $Id: FbWindow.hh,v 1.34 2004/09/11 12:33:14 rathnor Exp $
23 23
24#ifndef FBTK_FBWINDOW_HH 24#ifndef FBTK_FBWINDOW_HH
25#define FBTK_FBWINDOW_HH 25#define FBTK_FBWINDOW_HH
@@ -119,7 +119,7 @@ public:
119 void setCursor(Cursor cur); 119 void setCursor(Cursor cur);
120 /// uses the parents cursor instead 120 /// uses the parents cursor instead
121 void unsetCursor(); 121 void unsetCursor();
122 void reparent(const FbWindow &parent, int x, int y); 122 void reparent(const FbWindow &parent, int x, int y, bool continuing = true);
123 123
124 bool property(Atom property, 124 bool property(Atom property,
125 long long_offset, long long_length, 125 long long_offset, long long_length,
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc
index a1fdf8c..c784498 100644
--- a/src/FbTk/Menu.cc
+++ b/src/FbTk/Menu.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: Menu.cc,v 1.80 2004/09/09 14:29:10 akir Exp $ 25// $Id: Menu.cc,v 1.81 2004/09/11 12:33:14 rathnor Exp $
26 26
27//use GNU extensions 27//use GNU extensions
28#ifndef _GNU_SOURCE 28#ifndef _GNU_SOURCE
@@ -433,7 +433,7 @@ void Menu::update(int active_index) {
433 } 433 }
434 434
435 int itmp = (theme().itemHeight() * menu.persub); 435 int itmp = (theme().itemHeight() * menu.persub);
436 menu.frame_h = itmp < 0 ? 0 : itmp; 436 menu.frame_h = itmp < 1 ? 1 : itmp;
437 437
438 int new_width = (menu.sublevels * menu.item_w); 438 int new_width = (menu.sublevels * menu.item_w);
439 int new_height = menu.frame_h; 439 int new_height = menu.frame_h;
@@ -442,8 +442,12 @@ void Menu::update(int active_index) {
442 new_height += theme().titleHeight() + ((menu.frame_h > 0)?menu.title.borderWidth():0); 442 new_height += theme().titleHeight() + ((menu.frame_h > 0)?menu.title.borderWidth():0);
443 443
444 444
445 if (new_width < 1) 445 if (new_width < 1) {
446 new_width = menu.item_w; 446 if (menu.item_w > 0)
447 new_width = menu.item_w;
448 else
449 new_width = 1;
450 }
447 451
448 if (new_height < 1) 452 if (new_height < 1)
449 new_height = 1; 453 new_height = 1;
@@ -548,7 +552,7 @@ void Menu::update(int active_index) {
548 } 552 }
549 553
550 menu.frame.moveResize(0, ((title_vis) ? menu.title.y() + menu.title.height() + 554 menu.frame.moveResize(0, ((title_vis) ? menu.title.y() + menu.title.height() +
551 menu.title.borderWidth()*2 : 0), 555 menu.title.borderWidth()*2 : 1),
552 width(), menu.frame_h); 556 width(), menu.frame_h);
553 557
554 558
diff --git a/src/Window.cc b/src/Window.cc
index 8187c15..a110686 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.298 2004/08/31 15:26:38 rathnor Exp $ 25// $Id: Window.cc,v 1.299 2004/09/11 12:33:14 rathnor Exp $
26 26
27#include "Window.hh" 27#include "Window.hh"
28 28
@@ -3232,7 +3232,7 @@ void FluxboxWindow::restore(WinClient *client, bool remap) {
3232 3232
3233#endif // DEBUG 3233#endif // DEBUG
3234 // reparent to root window 3234 // reparent to root window
3235 client->reparent(screen().rootWindow(), frame().x(), frame().y()); 3235 client->reparent(screen().rootWindow(), frame().x(), frame().y(), false);
3236 3236
3237 if (!remap) 3237 if (!remap)
3238 client->hide(); 3238 client->hide();
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index f242f8c..324fb05 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.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: fluxbox.cc,v 1.252 2004/09/08 16:50:42 akir Exp $ 25// $Id: fluxbox.cc,v 1.253 2004/09/11 12:33:14 rathnor Exp $
26 26
27#include "fluxbox.hh" 27#include "fluxbox.hh"
28 28
@@ -386,18 +386,20 @@ void copyFile(const std::string &from, const std::string &to) {
386} // end anonymous 386} // end anonymous
387 387
388static int handleXErrors(Display *d, XErrorEvent *e) { 388static int handleXErrors(Display *d, XErrorEvent *e) {
389 if (e->error_code == BadWindow)
390 last_bad_window = e->resourceid;
389#ifdef DEBUG 391#ifdef DEBUG
390 /* 392 else {
391 char errtxt[128]; 393 // ignore bad window ones, they happen a lot
392 394 // when windows close themselves
393 XGetErrorText(d, e->error_code, errtxt, 128); 395 char errtxt[128];
394 cerr<<"Fluxbox: X Error: "<<errtxt<<"("<<(int)e->error_code<<") opcodes "<< 396
395 (int)e->request_code<<"/"<<(int)e->minor_code<<" resource 0x"<<hex<<(int)e->resourceid<<dec<<endl; 397 XGetErrorText(d, e->error_code, errtxt, 128);
396 */ 398 cerr<<"Fluxbox: X Error: "<<errtxt<<"("<<(int)e->error_code<<") opcodes "<<
399 (int)e->request_code<<"/"<<(int)e->minor_code<<" resource 0x"<<hex<<(int)e->resourceid<<dec<<endl;
400 }
397#endif // !DEBUG 401#endif // !DEBUG
398 402
399 if (e->error_code == BadWindow)
400 last_bad_window = e->resourceid;
401 403
402 return False; 404 return False;
403} 405}
@@ -501,6 +503,7 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
501 m_reconfig_timer.setTimeout(to); 503 m_reconfig_timer.setTimeout(to);
502 m_reconfig_timer.setCommand(reconfig_cmd); 504 m_reconfig_timer.setCommand(reconfig_cmd);
503 m_reconfig_timer.fireOnce(true); 505 m_reconfig_timer.fireOnce(true);
506 //XSynchronize(disp, True);
504 507
505 s_singleton = this; 508 s_singleton = this;
506 m_have_shape = false; 509 m_have_shape = false;
@@ -633,10 +636,11 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
633 FbTk::ThemeManager::instance().load(FbTk::StringUtil::expandFilename(getStyleFilename())); 636 FbTk::ThemeManager::instance().load(FbTk::StringUtil::expandFilename(getStyleFilename()));
634 637
635 XSynchronize(disp, False); 638 XSynchronize(disp, False);
639 //XSynchronize(disp, True);
636 sync(false); 640 sync(false);
637 641
638 m_reconfigure_wait = m_reread_menu_wait = false; 642 m_reconfigure_wait = m_reread_menu_wait = false;
639 643
640 // Create keybindings handler and load keys file 644 // Create keybindings handler and load keys file
641 m_key.reset(new Keys(StringUtil::expandFilename(*m_rc_keyfile).c_str())); 645 m_key.reset(new Keys(StringUtil::expandFilename(*m_rc_keyfile).c_str()));
642 646
@@ -1813,7 +1817,7 @@ void Fluxbox::load_rc(BScreen &screen) {
1813 for (unsigned int i=0; i<paths.size(); ++i) 1817 for (unsigned int i=0; i<paths.size(); ++i)
1814 FbTk::Image::addSearchPath(paths[i]); 1818 FbTk::Image::addSearchPath(paths[i]);
1815 } 1819 }
1816 1820
1817 if (!dbfile.empty()) { 1821 if (!dbfile.empty()) {
1818 if (!m_screen_rm.load(dbfile.c_str())) { 1822 if (!m_screen_rm.load(dbfile.c_str())) {
1819 cerr<<_FBTEXT(Fluxbox, CantLoadRCFile, "Failed to load database", "Failed trying to read rc file")<<":"<<dbfile<<endl; 1823 cerr<<_FBTEXT(Fluxbox, CantLoadRCFile, "Failed to load database", "Failed trying to read rc file")<<":"<<dbfile<<endl;