m_fsIsMaximized = FALSE;
m_fsIsShowing = FALSE;
- m_focusWidget = NULL;
+ m_needResizeInIdle = FALSE;
}
bool wxTopLevelWindowX11::Create(wxWindow *parent,
// TODO: if we want no border, caption etc.,
// I think we set this to True to remove decorations
// No. RR.
- xattributes.override_redirect = False;
+ // Yes :-) JACS (because some WMs don't respect
+ // the hints)
+ xattributes.override_redirect = (style & wxNO_BORDER) ? True : False;
#endif
#if wxUSE_NANOX
wm_protocols[0] = XInternAtom( xdisplay, "WM_DELETE_WINDOW", False );
wm_protocols[1] = XInternAtom( xdisplay, "WM_TAKE_FOCUS", False );
XSetWMProtocols( xdisplay, xwindow, wm_protocols, 2);
+
+#if 0 // TODO
+ // You will need a compliant window manager for this to work
+ // (e.g. sawfish/enlightenment/kde/icewm/windowmaker)
+ if (style & wxSTAY_ON_TOP)
+ {
+ CARD32 data = 4; // or should this be 6? According to http://developer.gnome.org/doc/standards/wm/c44.html
+ XChangeProperty (xdisplay,
+ xwindow,
+ XInternAtom (xdisplay, "_WIN_LAYER", False),
+ XA_CARDINAL,
+ 32,
+ PropModeReplace,
+ (unsigned char *)&data,
+ 1);
+ }
+#endif
+
#endif
wxSetWMDecorations( xwindow, style);
}
}
+void wxTopLevelWindowX11::OnInternalIdle()
+{
+ wxWindow::OnInternalIdle();
+
+ if (m_needResizeInIdle)
+ {
+ wxSizeEvent event( GetClientSize(), GetId() );
+ event.SetEventObject( this );
+ GetEventHandler()->ProcessEvent( event );
+
+ m_needResizeInIdle = FALSE;
+ }
+}
+
// ----------------------------------------------------------------------------
// wxTopLevelWindowX11 showing
// ----------------------------------------------------------------------------
// else there's no initial size.
#if wxUSE_NANOX
if (show)
+#else
+ if (show && m_needResizeInIdle)
+#endif
{
wxSizeEvent event(GetSize(), GetId());
event.SetEventObject(this);
GetEventHandler()->ProcessEvent(event);
+
+ m_needResizeInIdle = FALSE;
+ }
+
+ if (show)
+ {
+ // This does the layout _before_ the
+ // window is shown, else the items are
+ // drawn first at the wrong positions,
+ // then at the correct positions.
+ if (GetAutoLayout())
+ {
+ Layout();
+ }
}
-#endif
return wxWindowX11::Show(show);
}
hints.decorations |= MWM_DECOR_TITLE;
}
- if ((style & wxTHICK_FRAME) || (style & wxSIMPLE_BORDER) || (style & wxCAPTION))
+ if ((style & wxTHICK_FRAME) || (style & wxCAPTION))
{
// wxLogDebug("MWM_DECOR_BORDER");
hints.flags |= MWM_HINTS_DECORATIONS;
{
wxWindowX11::DoSetClientSize(width, height);
+#if !wxUSE_NANOX
// Set the top-level window size
XSizeHints size_hints;
wxSize oldSize = GetSize();
wxSize newSize = GetSize();
wxLogDebug("New size is %d, %d", (int) newSize.x, (int) newSize.y);
#endif
-
-#if 0
- if (!GetMainWindow())
- return;
-
- XWindowChanges windowChanges;
- int valueMask = 0;
-
- if (width != -1)
- {
- windowChanges.width = width ;
- valueMask |= CWWidth;
- }
- if (height != -1)
- {
- windowChanges.height = height ;
- valueMask |= CWHeight;
- }
- XConfigureWindow(wxGlobalDisplay(), (Window) GetMainWindow(),
- valueMask, & windowChanges);
#endif
}
// search for the parent that is child of ROOT, because the WM may
// reparent twice and notify only the next parent (like FVWM)
while (next_parent != root) {
- Window *theChildren; unsigned int n;
+ Window *theChildren;
+#if wxUSE_NANOX
+ GR_COUNT n;
+#else
+ unsigned int n;
+#endif
parent_window = next_parent;
XQueryTree(display, parent_window, &root,
&next_parent, &theChildren, &n);
}
XConfigureWindow( display, parent_window, valueMask, &windowChanges );
-
+
+#if !wxUSE_NANOX
XSizeHints size_hints;
size_hints.flags = 0;
if (x > -1 && y > -1)
// box of the minimal sample probably won't be resized right.
XSync(wxGlobalDisplay(), False);
XSync(wxGlobalDisplay(), False);
-
-#if 0
- wxLogDebug("DoSetSize: Tried to set size to %d, %d", (int) size_hints.width, (int) size_hints.height);
-
- XSync(wxGlobalDisplay(), False);
- wxSize newSize = GetSize();
- wxLogDebug("New size is %d, %d", (int) newSize.x, (int) newSize.y);
-#endif
-
-#if 0
- wxPoint pt = GetPosition();
- // wxLogDebug( "After, pos: %d, %d", pt.x, pt.y );
-
- XSync(wxGlobalDisplay(), False);
- int w, h;
- GetSize(& w, & h);
- wxString msg;
- msg.Printf("Before setting size: %d, %d", w, h);
- wxLogDebug(msg);
- if (!GetMainWindow())
- return;
-
- XWindowChanges windowChanges;
- int valueMask = 0;
-
- if (x != -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
- {
- int yy = 0;
- AdjustForParentClientOrigin( x, yy, sizeFlags);
- windowChanges.x = x;
- valueMask |= CWX;
- }
- if (y != -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
- {
- int xx = 0;
- AdjustForParentClientOrigin( xx, y, sizeFlags);
- windowChanges.y = y;
- valueMask |= CWY;
- }
- if (width != -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
- {
- windowChanges.width = width /* - m_borderSize*2 */;
- valueMask |= CWWidth;
- }
- if (height != -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
- {
- windowChanges.height = height /* -m_borderSize*2*/;
- valueMask |= CWHeight;
- }
-
- XConfigureWindow(wxGlobalDisplay(), (Window) GetMainWindow(),
- valueMask, & windowChanges);
- XSync(wxGlobalDisplay(), False);
- GetSize(& w, & h);
- msg.Printf("Tried to set to %d, %d. After setting size: %d, %d", width, height, w, h);
- wxLogDebug(msg);
#endif
}
// search for the parent that is child of ROOT, because the WM may
// reparent twice and notify only the next parent (like FVWM)
while (next_parent != root) {
- Window *theChildren; unsigned int n;
+ Window *theChildren;
+#if wxUSE_NANOX
+ GR_COUNT n;
+#else
+ unsigned int n;
+#endif
parent_window = next_parent;
XQueryTree(display, parent_window, &root,
&next_parent, &theChildren, &n);
XFree(theChildren); // not needed
}
+#if 0
int xx, yy; unsigned int dummy;
XGetGeometry(display, parent_window, &root,
- &xx, &yy, &dummy, &dummy, &dummy, &dummy);
+ &xx, &yy, &dummy, &dummy, &dummy, &dummy);
if (x) *x = xx;
if (y) *y = yy;
-
-#if 0
- if (window)
+#else
+ XWindowAttributes attr;
+ Status status = XGetWindowAttributes((Display*) GetXDisplay(), parent_window, & attr);
+ if (status)
{
- int offsetX = 0;
- int offsetY = 0;
-
-#if !wxUSE_NANOX
- // wxLogDebug("Translating...");
- Window childWindow;
- XTranslateCoordinates(wxGlobalDisplay(), window, XDefaultRootWindow(wxGlobalDisplay()),
- 0, 0, & offsetX, & offsetY, & childWindow);
-
- // wxLogDebug("Offset: %d, %d", offsetX, offsetY);
-#endif
-
- XWindowAttributes attr;
- Status status = XGetWindowAttributes(wxGlobalDisplay(), window, & attr);
- wxASSERT(status);
-
- if (status)
- {
- *x = attr.x + offsetX;
- *y = attr.y + offsetY;
- }
+ if (x) *x = attr.x;
+ if (y) *y = attr.y;
+ }
+ else
+ {
+ if (x) *x = 0;
+ if (y) *y = 0;
}
#endif
}