]> git.saurik.com Git - wxWidgets.git/blobdiff - src/x11/toplevel.cpp
Unicode fixes and warnings cleanup
[wxWidgets.git] / src / x11 / toplevel.cpp
index 2a22dcb0b2dce4bf2b8968b9f4e753951e8dad0a..2c81bc7cef6d9ff87ced0cc7b442b67d36243b91 100644 (file)
@@ -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 |
@@ -139,10 +147,18 @@ bool wxTopLevelWindowX11::Create(wxWindow *parent,
     // background completely.
     XSetWindowBackgroundPixmap( xdisplay, xwindow, None );
 
-    // Messes up window management
-    //    XSetTransientForHint( xdisplay, xwindow, xparent );
+    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);
@@ -152,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);