]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/window.cpp
More theme goodies.
[wxWidgets.git] / src / gtk1 / window.cpp
index 7d1eed6e4241d123b5ed7a4fedd9f9c1567457ce..d216773c501d4b9ebe9655ab60014259b06072d5 100644 (file)
@@ -679,10 +679,18 @@ static int gtk_window_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_ev
     }
 */
                                 
-        win->GetUpdateRegion().Union( gdk_event->area.x,
-                                      gdk_event->area.y,
-                                      gdk_event->area.width,
-                                      gdk_event->area.height );
+    GtkPizza *pizza = GTK_PIZZA (widget);
+        
+    if (win->IsTopLevel())
+    {
+        gtk_paint_flat_box (widget->style, pizza->bin_window, GTK_STATE_NORMAL, 
+                     GTK_SHADOW_NONE, &gdk_event->area, widget, "base", 0, 0, -1, -1);
+    }
+        
+    win->GetUpdateRegion().Union( gdk_event->area.x,
+                                  gdk_event->area.y,
+                                  gdk_event->area.width,
+                                  gdk_event->area.height );
 
         if (gdk_event->count == 0)
         {
@@ -702,8 +710,6 @@ static int gtk_window_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_ev
            paint *anything* because it will then be allowed to paint
            over the window-less widgets */
        
-        GtkPizza *pizza = GTK_PIZZA (widget);
-        
         GList *children = pizza->children;
         while (children)
         {
@@ -776,6 +782,12 @@ static void gtk_window_draw_callback( GtkWidget *widget, GdkRectangle *rect, wxW
 */
    
     GtkPizza *pizza = GTK_PIZZA (widget);
+
+    if (win->IsTopLevel())
+    {
+        gtk_paint_flat_box (widget->style, pizza->bin_window, GTK_STATE_NORMAL, 
+                     GTK_SHADOW_NONE, rect, widget, "base", 0, 0, -1, -1);
+    }
         
         if (!(GTK_WIDGET_APP_PAINTABLE (widget)) &&
              (pizza->clear_on_draw))
@@ -3753,3 +3765,45 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
     }
 */
 }
+
+// Find the wxWindow at the current mouse position, also returning the mouse
+// position.
+wxWindow* wxFindWindowAtPointer(wxPoint& pt)
+{
+    pt = wxGetMousePosition();
+    wxWindow* found = wxFindWindowAtPoint(pt);
+    return found;
+}
+
+// Get the current mouse position.
+wxPoint wxGetMousePosition()
+{
+  /* This crashes when used within wxHelpContext,
+     so we have to use the X-specific implementation below.
+    gint x, y;
+    GdkModifierType *mask;
+    (void) gdk_window_get_pointer(NULL, &x, &y, mask);
+
+    return wxPoint(x, y);
+  */
+
+    int x, y;
+    GdkWindow* windowAtPtr = gdk_window_at_pointer(& x, & y);
+    if (!windowAtPtr)
+      return wxPoint(-999, -999);
+
+    Display *display = GDK_WINDOW_XDISPLAY(windowAtPtr);
+    Window rootWindow = RootWindowOfScreen (DefaultScreenOfDisplay(display));
+    Window rootReturn, childReturn;
+    int rootX, rootY, winX, winY;
+    unsigned int maskReturn;
+
+    XQueryPointer (display,
+                  rootWindow,
+                  &rootReturn,
+                   &childReturn,
+                   &rootX, &rootY, &winX, &winY, &maskReturn);
+    return wxPoint(rootX, rootY);
+
+}
+