X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3a0b23eb745d4159dcb2ed5f1710444d98807ccf..761e1e0702fb50aca31fb7a38dcb0f00ae4d2ac6:/src/x11/toplevel.cpp diff --git a/src/x11/toplevel.cpp b/src/x11/toplevel.cpp index 632a4e48b7..2c81bc7cef 100644 --- a/src/x11/toplevel.cpp +++ b/src/x11/toplevel.cpp @@ -61,6 +61,8 @@ void wxTopLevelWindowX11::Init() m_fsStyle = 0; m_fsIsMaximized = FALSE; m_fsIsShowing = FALSE; + + m_focusWidget = NULL; } bool wxTopLevelWindowX11::Create(wxWindow *parent, @@ -92,8 +94,10 @@ bool wxTopLevelWindowX11::Create(wxWindow *parent, Window xparent = RootWindow( xdisplay, xscreen ); Colormap cm = DefaultColormap( xdisplay, xscreen ); - // TODO: For dialogs, this should be wxSYS_COLOUR_3DFACE - m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE); + if (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG) + m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE); + else + m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE); m_backgroundColour.CalcPixel( (WXColormap) cm ); m_hasBgCol = TRUE; @@ -109,6 +113,7 @@ 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; wxSize size2(size); @@ -128,6 +133,9 @@ bool wxTopLevelWindowX11::Create(wxWindow *parent, m_mainWidget = (WXWindow) xwindow; XSelectInput( xdisplay, xwindow, +#if wxUSE_NANOX + GR_EVENT_MASK_CLOSE_REQ | +#endif ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask | KeymapStateMask | FocusChangeMask | ColormapChangeMask | StructureNotifyMask | @@ -135,10 +143,22 @@ bool wxTopLevelWindowX11::Create(wxWindow *parent, wxAddWindowToTable( xwindow, (wxWindow*) this ); - // Messes up window management - // XSetTransientForHint( xdisplay, xwindow, xparent ); + // Set background to None which will prevent X11 from clearing the + // background completely. + XSetWindowBackgroundPixmap( xdisplay, xwindow, None ); + + if (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG) + { + if (GetParent() && GetParent()->GetMainWindow()) + { + Window xparentwindow = (Window) GetParent()->GetMainWindow(); + XSetTransientForHint( xdisplay, xwindow, xparentwindow ); + } + } - size_hints.flags = PSize; + size_hints.flags = PSize | PPosition; + size_hints.x = pos2.x; + size_hints.y = pos2.y; size_hints.width = size2.x; size_hints.height = size2.y; XSetWMNormalHints( xdisplay, xwindow, &size_hints); @@ -148,10 +168,12 @@ bool wxTopLevelWindowX11::Create(wxWindow *parent, wm_hints.initial_state = NormalState; XSetWMHints( xdisplay, xwindow, &wm_hints); - Atom wm_delete_window = XInternAtom( xdisplay, "WM_DELETE_WINDOW", False); - XSetWMProtocols( xdisplay, xwindow, &wm_delete_window, 1); + Atom wm_protocols[2]; + wm_protocols[0] = XInternAtom( xdisplay, "WM_DELETE_WINDOW", False ); + wm_protocols[1] = XInternAtom( xdisplay, "WM_TAKE_FOCUS", False ); + XSetWMProtocols( xdisplay, xwindow, wm_protocols, 2); - wxSetWMDecorations((Window) GetMainWindow(), style); + wxSetWMDecorations( xwindow, style); SetTitle(title);