summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBill Spitzak <spitzak@gmail.com>1999-11-04 18:35:12 +0000
committerBill Spitzak <spitzak@gmail.com>1999-11-04 18:35:12 +0000
commitde5a005e69d4cbd11386cdd5e8766476eecdcc2c (patch)
tree0f05e4506b9abac19896067cf434701b2085c4db /src
parentc3bd173a570d04961ffc1ccda39ea4a64846e030 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/Fl_x.cxx9
1 files changed, 7 insertions, 2 deletions
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 $".
//