From de5a005e69d4cbd11386cdd5e8766476eecdcc2c Mon Sep 17 00:00:00 2001 From: Bill Spitzak Date: Thu, 4 Nov 1999 18:35:12 +0000 Subject: 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 --- src/Fl_x.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx index bd665ecf8..c9c6c2790 100644 --- a/src/Fl_x.cxx +++ b/src/Fl_x.cxx @@ -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 $". // -- cgit v1.2.3