Minor change: if the X window manager does not do anything else with windows

that don't have their position specified, the windows appear centered in
the screen, rather than in the top-left corner.  This happened with modal
windows under Irix 4Dwm.  This also causes windows to be centered when no
window manager is running, which might be useful for installation gui programs?


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@823 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Bill Spitzak 1999-11-04 18:35:12 +00:00
parent c3bd173a57
commit de5a005e69

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_x.cxx,v 1.24.2.6 1999/05/06 06:20:47 bill Exp $"
// "$Id: Fl_x.cxx,v 1.24.2.7 1999/11/04 18:35:12 bill Exp $"
//
// X specific code for the Fast Light Tool Kit (FLTK).
//
@ -618,6 +618,11 @@ void Fl_X::make_xid(Fl_Window* w, XVisualInfo *visual, Colormap colormap)
int H = w->h();
if (H <= 0) H = 1; // X don't like zero...
if (!w->parent() && !Fl::grab()) {
// center windows in case window manager does not do anything:
if (!(w->flags() & Fl_Window::FL_FORCE_POSITION)) {
w->x(X = (Fl::w()-W)/2);
w->y(Y = (Fl::h()-H)/2);
}
// force the window to be on-screen. Usually the X window manager
// does this, but a few don't, so we do it here for consistency:
if (w->border()) {
@ -866,5 +871,5 @@ void Fl_Window::make_current() {
#endif
//
// End of "$Id: Fl_x.cxx,v 1.24.2.6 1999/05/06 06:20:47 bill Exp $".
// End of "$Id: Fl_x.cxx,v 1.24.2.7 1999/11/04 18:35:12 bill Exp $".
//