mirror of
https://github.com/fltk/fltk.git
synced 2026-05-30 04:55:29 +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()
|
int Fl_Window::decorated_w()
|
||||||
{
|
{
|
||||||
if (parent() || !border()) return w();
|
if (!shown() || parent() || !border() || !visible()) return w();
|
||||||
int bx, by, bt;
|
int bx, by, bt;
|
||||||
get_window_frame_sizes(bx, by, bt);
|
get_window_frame_sizes(bx, by, bt);
|
||||||
return w() + 2 * bx;
|
return w() + 2 * bx;
|
||||||
@@ -3400,7 +3400,7 @@ int Fl_Window::decorated_w()
|
|||||||
|
|
||||||
int Fl_Window::decorated_h()
|
int Fl_Window::decorated_h()
|
||||||
{
|
{
|
||||||
if (parent() || !border()) return h();
|
if (!shown() || parent() || !border() || !visible()) return h();
|
||||||
int bx, by, bt;
|
int bx, by, bt;
|
||||||
get_window_frame_sizes(bx, by, bt);
|
get_window_frame_sizes(bx, by, bt);
|
||||||
return h() + bt + by;
|
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)
|
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);
|
this->print_widget(win, x_offset, y_offset);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -1966,7 +1966,7 @@ Window fl_xid_(const Fl_Window *w) {
|
|||||||
|
|
||||||
int Fl_Window::decorated_w()
|
int Fl_Window::decorated_w()
|
||||||
{
|
{
|
||||||
if (parent() || !shown()) return w();
|
if (!shown() || parent() || !border() || !visible()) return w();
|
||||||
int X, Y, bt, bx, by;
|
int X, Y, bt, bx, by;
|
||||||
Fl_X::fake_X_wm(this, X, Y, bt, bx, by);
|
Fl_X::fake_X_wm(this, X, Y, bt, bx, by);
|
||||||
return w() + 2 * bx;
|
return w() + 2 * bx;
|
||||||
@@ -1974,7 +1974,7 @@ int Fl_Window::decorated_w()
|
|||||||
|
|
||||||
int Fl_Window::decorated_h()
|
int Fl_Window::decorated_h()
|
||||||
{
|
{
|
||||||
if (this->parent() || !shown()) return h();
|
if (!shown() || parent() || !border() || !visible()) return h();
|
||||||
int X, Y, bt, bx, by;
|
int X, Y, bt, bx, by;
|
||||||
Fl_X::fake_X_wm(this, X, Y, bt, bx, by);
|
Fl_X::fake_X_wm(this, X, Y, bt, bx, by);
|
||||||
return h() + bt + 2 * 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)
|
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);
|
this->print_widget(win, x_offset, y_offset);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
+25
-19
@@ -1971,37 +1971,41 @@ Window fl_xid_(const Fl_Window *w) {
|
|||||||
return temp ? temp->xid : 0;
|
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;
|
Window root, parent, *children;
|
||||||
unsigned n;
|
unsigned n = 0;
|
||||||
XQueryTree(fl_display, i->xid, &root, &parent, &children, &n); if (n) XFree(children);
|
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
|
// when compiz is used, root and parent are the same window
|
||||||
// and I don't know where to find the window decoration
|
// and I don't know where to find the window decoration
|
||||||
if (root == parent) return h();
|
if (status == 0 || root == parent) return;
|
||||||
XWindowAttributes attributes;
|
XWindowAttributes attributes;
|
||||||
XGetWindowAttributes(fl_display, parent, &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()
|
int Fl_Window::decorated_w()
|
||||||
{
|
{
|
||||||
if (parent() || !shown()) return w();
|
int w, h;
|
||||||
Window root, parent, *children;
|
decorated_win_size(this, w, h);
|
||||||
unsigned n;
|
return w;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fl_Paged_Device::print_window(Fl_Window *win, int x_offset, int y_offset)
|
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);
|
this->print_widget(win, x_offset, y_offset);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -2034,8 +2038,10 @@ void Fl_Paged_Device::print_window(Fl_Window *win, int x_offset, int y_offset)
|
|||||||
}
|
}
|
||||||
fl_window = from;
|
fl_window = from;
|
||||||
this->set_current();
|
this->set_current();
|
||||||
fl_draw_image(top_image, x_offset, y_offset, win->w() + 2 * bx, bt, 3);
|
if (top_image) {
|
||||||
delete[] top_image;
|
fl_draw_image(top_image, x_offset, y_offset, win->w() + 2 * bx, bt, 3);
|
||||||
|
delete[] top_image;
|
||||||
|
}
|
||||||
if (bx) {
|
if (bx) {
|
||||||
if (left_image) fl_draw_image(left_image, x_offset, y_offset + bt, bx, win->h() + bx, 3);
|
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);
|
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