Fix for STR #2648 continued: Fl_Window::decorated_w() and Fl_Window::decorated_h() are

also involved in this fix. 

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8756 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2011-05-29 18:01:17 +00:00
parent 84a025b174
commit 39998a972c
1 changed files with 9 additions and 2 deletions

View File

@ -1977,6 +1977,9 @@ int Fl_Window::decorated_h()
Window root, parent, *children;
unsigned n;
XQueryTree(fl_display, i->xid, &root, &parent, &children, &n); if (n) XFree(children);
// when compiz is used, root and parent are the same window
// and I don't know where to find the window decoration
if (root == parent) return h();
XWindowAttributes attributes;
XGetWindowAttributes(fl_display, parent, &attributes);
return attributes.height;
@ -1988,6 +1991,9 @@ int Fl_Window::decorated_w()
Window root, parent, *children;
unsigned n;
XQueryTree(fl_display, i->xid, &root, &parent, &children, &n); if (n) XFree(children);
// when compiz is used, root and parent are the same window
// and I don't know where to find the window decoration
if (root == parent) return w();
XWindowAttributes attributes;
XGetWindowAttributes(fl_display, parent, &attributes);
return attributes.width;
@ -2010,8 +2016,9 @@ void Fl_Paged_Device::print_window(Fl_Window *win, int x_offset, int y_offset)
do_it = (XQueryTree(fl_display, fl_window, &root, &parent, &children, &n) != 0 &&
XTranslateCoordinates(fl_display, fl_window, parent, 0, 0, &bx, &bt, &child_win) == True);
if (n) XFree(children);
// hack to bypass STR #2648: when compiz is used, bt is assigned a very high, misleading value
if (do_it && bt > 30) do_it = 0;
// hack to bypass STR #2648: when compiz is used, root and parent are the same window
// and I don't know where to find the window decoration
if (do_it && root == parent) do_it = 0;
if (!do_it) {
this->set_current();
this->print_widget(win, x_offset, y_offset);