Author: manolo
Date: 2011-05-30 05:33:51 -0700 (Mon, 30 May 2011)
New Revision: 8759
Log:
Fix Fl_Paged_Device::print_window(), Fl_Window::decorated_w() and
Fl_Window::decorated_h()
when the window is iconized for all platforms.
Also, factorized some duplicated code in src/Fl_x.cxx.
Modified:
branches/branch-1.3/src/Fl_cocoa.mm
branches/branch-1.3/src/Fl_win32.cxx
branches/branch-1.3/src/Fl_x.cxx
Modified: branches/branch-1.3/src/Fl_cocoa.mm
===================================================================
--- branches/branch-1.3/src/Fl_cocoa.mm 2011-05-29 18:17:52 UTC (rev 8758)
+++ branches/branch-1.3/src/Fl_cocoa.mm 2011-05-30 12:33:51 UTC (rev 8759)
@@ -3392,7 +3392,7 @@
int Fl_Window::decorated_w()
{
- if (parent() || !border()) return w();
+ if (!shown() || parent() || !border() || !visible()) return w();
int bx, by, bt;
get_window_frame_sizes(bx, by, bt);
return w() + 2 * bx;
@@ -3400,7 +3400,7 @@
int Fl_Window::decorated_h()
{
- if (parent() || !border()) return h();
+ if (!shown() || parent() || !border() || !visible()) return h();
int bx, by, bt;
get_window_frame_sizes(bx, by, bt);
return h() + bt + by;
@@ -3408,7 +3408,7 @@
void Fl_Paged_Device::print_window(Fl_Window *win, int x_offset, int y_offset)
{
- if (!win->shown() || win->parent() || !win->border()) {
+ if (!win->shown() || win->parent() || !win->border() || !win->visible()) {
this->print_widget(win, x_offset, y_offset);
return;
}
Modified: branches/branch-1.3/src/Fl_win32.cxx
===================================================================
--- branches/branch-1.3/src/Fl_win32.cxx 2011-05-29 18:17:52 UTC (rev
8758)
+++ branches/branch-1.3/src/Fl_win32.cxx 2011-05-30 12:33:51 UTC (rev
8759)
@@ -1966,7 +1966,7 @@
int Fl_Window::decorated_w()
{
- if (parent() || !shown()) return w();
+ if (!shown() || parent() || !border() || !visible()) return w();
int X, Y, bt, bx, by;
Fl_X::fake_X_wm(this, X, Y, bt, bx, by);
return w() + 2 * bx;
@@ -1974,7 +1974,7 @@
int Fl_Window::decorated_h()
{
- if (this->parent() || !shown()) return h();
+ if (!shown() || parent() || !border() || !visible()) return h();
int X, Y, bt, bx, by;
Fl_X::fake_X_wm(this, X, Y, bt, bx, by);
return h() + bt + 2 * by;
@@ -1982,7 +1982,7 @@
void Fl_Paged_Device::print_window(Fl_Window *win, int x_offset, int y_offset)
{
- if (win->parent() || !win->border()) {
+ if (!win->shown() || win->parent() || !win->border() || !win->visible()) {
this->print_widget(win, x_offset, y_offset);
return;
}
Modified: branches/branch-1.3/src/Fl_x.cxx
===================================================================
--- branches/branch-1.3/src/Fl_x.cxx 2011-05-29 18:17:52 UTC (rev 8758)
+++ branches/branch-1.3/src/Fl_x.cxx 2011-05-30 12:33:51 UTC (rev 8759)
@@ -1971,37 +1971,41 @@
return temp ? temp->xid : 0;
}
-int Fl_Window::decorated_h()
+static void decorated_win_size(Fl_Window *win, int &w, int &h)
{
- if (parent() || !shown()) return h();
+ w = win->w();
+ h = win->h();
+ if (!win->shown() || win->parent() || !win->border() || !win->visible())
return;
Window root, parent, *children;
- unsigned n;
- XQueryTree(fl_display, i->xid, &root, &parent, &children, &n); if (n)
XFree(children);
+ unsigned n = 0;
+ Status status = XQueryTree(fl_display, Fl_X::i(win)->xid, &root, &parent,
&children, &n);
+ if (status != 0 && 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();
+ if (status == 0 || root == parent) return;
XWindowAttributes attributes;
XGetWindowAttributes(fl_display, parent, &attributes);
- return attributes.height;
+ w = attributes.width;
+ h = attributes.height;
}
+int Fl_Window::decorated_h()
+{
+ int w, h;
+ decorated_win_size(this, w, h);
+ return h;
+}
+
int Fl_Window::decorated_w()
{
- if (parent() || !shown()) return 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;
+ int w, h;
+ decorated_win_size(this, w, h);
+ return w;
}
void Fl_Paged_Device::print_window(Fl_Window *win, int x_offset, int y_offset)
{
- if (win->parent() || !win->border()) {
+ if (!win->shown() || win->parent() || !win->border() || !win->visible()) {
this->print_widget(win, x_offset, y_offset);
return;
}
@@ -2034,8 +2038,10 @@
}
fl_window = from;
this->set_current();
- fl_draw_image(top_image, x_offset, y_offset, win->w() + 2 * bx, bt, 3);
- delete[] top_image;
+ if (top_image) {
+ fl_draw_image(top_image, x_offset, y_offset, win->w() + 2 * bx, bt, 3);
+ delete[] top_image;
+ }
if (bx) {
if (left_image) fl_draw_image(left_image, x_offset, y_offset + bt, bx,
win->h() + bx, 3);
if (right_image) fl_draw_image(right_image, x_offset + win->w() + bx,
y_offset + bt, bx, win->h() + bx, 3);
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit