]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/toplevel.cpp
Remove unnecessary base class OnPaint() call from wxGenericColourDialog.
[wxWidgets.git] / src / gtk / toplevel.cpp
index d655fbad2e16c35d28d246cdcde348f91c545811..0dd59d4b330e95457eae77fe01f71aa86f5d68eb 100644 (file)
@@ -191,7 +191,7 @@ gboolean gtk_frame_focus_out_callback(GtkWidget * WXUNUSED(widget),
                                       GdkEventFocus *WXUNUSED(gdk_event),
                                       wxTopLevelWindowGTK * WXUNUSED(win))
 {
-    // if the focus goes out of our app alltogether, OnIdle() will send
+    // if the focus goes out of our app altogether, OnIdle() will send
     // wxActivateEvent, otherwise gtk_window_focus_in_callback() will reset
     // g_sendActivateEvent to -1
     g_sendActivateEvent = 0;
@@ -246,22 +246,6 @@ size_allocate(GtkWidget*, GtkAllocation* alloc, wxTopLevelWindowGTK* win)
 }
 }
 
-// ----------------------------------------------------------------------------
-// "size_request"
-// ----------------------------------------------------------------------------
-
-extern "C" {
-static
-void wxgtk_tlw_size_request_callback(GtkWidget * WXUNUSED(widget),
-                                     GtkRequisition *requisition,
-                                     wxTopLevelWindowGTK *win)
-{
-    // we must return the size of the window without WM decorations, otherwise
-    // GTK+ gets confused, so don't call just GetSize() here
-    win->GTKDoGetSize(&requisition->width, &requisition->height);
-}
-}
-
 //-----------------------------------------------------------------------------
 // "delete_event"
 //-----------------------------------------------------------------------------
@@ -628,8 +612,6 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
     g_signal_connect(m_wxwindow, "size_allocate",
         G_CALLBACK(size_allocate), this);
 
-    g_signal_connect (m_widget, "size_request",
-                      G_CALLBACK (wxgtk_tlw_size_request_callback), this);
     PostCreation();
 
 #if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED)
@@ -703,6 +685,15 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
         }
     }
 
+    // GTK sometimes chooses very small size if max size hint is not explicitly set
+    int maxWidth = m_maxWidth;
+    int maxHeight = m_maxHeight;
+    if (maxWidth < 0)
+        maxWidth = INT_MAX;
+    if (maxHeight < 0)
+        maxHeight = INT_MAX;
+    DoSetSizeHints(m_minWidth, m_minHeight, maxWidth, maxHeight, -1, -1);
+
     m_decorSize = GetCachedDecorSize();
     int w, h;
     GTKDoGetSize(&w, &h);
@@ -1401,28 +1392,6 @@ void wxTopLevelWindowGTK::SetWindowStyleFlag( long style )
     }
 }
 
-#ifdef GDK_WINDOWING_X11
-/* Get the X Window between child and the root window.
-   This should usually be the WM managed XID */
-static Window wxGetTopmostWindowX11(Display *dpy, Window child)
-{
-    Window root, parent;
-    Window* children;
-    unsigned int nchildren;
-
-    XQueryTree(dpy, child, &root, &parent, &children, &nchildren);
-    XFree(children);
-
-    while (parent != root) {
-        child = parent;
-        XQueryTree(dpy, child, &root, &parent, &children, &nchildren);
-        XFree(children);
-    }
-
-    return child;
-}
-#endif // GDK_WINDOWING_X11
-
 bool wxTopLevelWindowGTK::SetTransparent(wxByte alpha)
 {
     GdkWindow* window = NULL;
@@ -1433,11 +1402,7 @@ bool wxTopLevelWindowGTK::SetTransparent(wxByte alpha)
 
 #ifdef GDK_WINDOWING_X11
     Display* dpy = GDK_WINDOW_XDISPLAY(window);
-    // We need to get the X Window that has the root window as the immediate parent
-    // and m_widget->window as a child. This should be the X Window that the WM manages and
-    // from which the opacity property is checked from.
-    Window win = wxGetTopmostWindowX11(dpy, GDK_WINDOW_XID(window));
-
+    Window win = GDK_WINDOW_XID(window);
 
     // Using pure Xlib to not have a GTK version check mess due to gtk2.0 not having GdkDisplay
     if (alpha == 0xff)
@@ -1468,7 +1433,7 @@ bool wxTopLevelWindowGTK::CanSetTransparent()
 #if GTK_CHECK_VERSION(2,10,0)
     if (!gtk_check_version(2,10,0))
     {
-        return (gtk_widget_is_composited (m_widget));
+        return gtk_widget_is_composited(m_widget) != 0;
     }
     else
 #endif // In case of lower versions than gtk+-2.10.0 we could look for _NET_WM_CM_Sn ourselves