mirror of
https://github.com/fltk/fltk.git
synced 2026-05-24 00:06:20 +08:00
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. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8759 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
+3
-3
@@ -3392,7 +3392,7 @@ Window fl_xid(const Fl_Window* w)
|
||||
|
||||
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_w()
|
||||
|
||||
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 @@ int Fl_Window::decorated_h()
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
+3
-3
@@ -1966,7 +1966,7 @@ Window fl_xid_(const Fl_Window *w) {
|
||||
|
||||
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_w()
|
||||
|
||||
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 @@ int Fl_Window::decorated_h()
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
+25
-19
@@ -1971,37 +1971,41 @@ Window fl_xid_(const Fl_Window *w) {
|
||||
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 @@ void Fl_Paged_Device::print_window(Fl_Window *win, int x_offset, int y_offset)
|
||||
}
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user