]> git.saurik.com Git - wxWidgets.git/commitdiff
Clean-up, speed-up and bug-fix for wxListCtrl drawing,
authorRobert Roebling <robert@roebling.de>
Fri, 3 Mar 2000 20:09:19 +0000 (20:09 +0000)
committerRobert Roebling <robert@roebling.de>
Fri, 3 Mar 2000 20:09:19 +0000 (20:09 +0000)
  Removed overlay things from wxScreenDC,
  Added test for bitmaps clipping with regions.
  Updates to changes.txt

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6424 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/gtk/changes.txt
samples/drawing/drawing.cpp
src/generic/listctrl.cpp
src/gtk/dcscreen.cpp
src/gtk1/dcscreen.cpp

index 694e7c857253d999bfa39540986e9b15955fad8f..5bb7d1c5d712deff1500586c06698c8a2f8f5fae 100644 (file)
@@ -1,13 +1,29 @@
+12th March '2000: wxWindows 2.1.14 released
 
 
-20th February '2000: wxWindows 2.1.14 released
+Added wxDragImage class for dragging easily images.
 
 
-Minor changes to socket code.
+The DEB and RPM packages now conform better to various
+standards.
+
+Renamed wx-config to wxgtk-config so that motif can be co-installed
+on the same machine (with wxmotif-config).
+
+Speed up for drawing by resuing once created DCs instead of
+creating and destroying them all the time.
+
+Corrections to clipping region code (among others related to
+simultaneous bitmap clipping).
+
+A few more improvements to tab traversal.
+
+A number of changes to socket code.
 
 Added code for rotating images.
 
 
 Added code for rotating images.
 
-Much work on the new grid class has been done.
+Much work on the new grid class has been done. Very cool now.
 
 
-wxPlotWindow is now useful and works.
+wxPlotWindow is now useful and works. Added on-off lines useful for
+displaying trigger signals.
 
 Corrected one more bug in the TIFF handler.
 
 
 Corrected one more bug in the TIFF handler.
 
@@ -20,7 +36,8 @@ Added default keyboard handling to wxScrolledWindow.
 Fixed slightly overoptimized window colour and style handling.
 This will expose a bug in the GtkPixmap theme, or more exactly
 in ImLib's image cashing so that wxGTK currently doesn't work
 Fixed slightly overoptimized window colour and style handling.
 This will expose a bug in the GtkPixmap theme, or more exactly
 in ImLib's image cashing so that wxGTK currently doesn't work
-well with pixamp themes.
+well with pixmap themes. As a result, wxGTK will disable all
+widget settings when using this theme.
 
 Fixed bug in drawing code that made GTK pick the wrong pen
 style when using the default.
 
 Fixed bug in drawing code that made GTK pick the wrong pen
 style when using the default.
index 1c67694c3203feead3c95e8fa9cb884eca5ec5bb..91a4cc41696935762dbd9c24f34dea27c11dba0a 100644 (file)
@@ -581,14 +581,11 @@ void MyCanvas::DrawDefault(wxDC& dc)
     dc.FloodFill(0, 0, wxColour(255, 0, 0));
 #endif //
 
     dc.FloodFill(0, 0, wxColour(255, 0, 0));
 #endif //
 
-    dc.DrawIcon( wxICON(mondrian), 40, 40 );
-
     dc.DrawCheckMark(5, 80, 15, 15);
     dc.DrawCheckMark(25, 80, 30, 30);
     dc.DrawCheckMark(60, 80, 60, 60);
 
     // this is the test for "blitting bitmap into DC damages selected brush" bug
     dc.DrawCheckMark(5, 80, 15, 15);
     dc.DrawCheckMark(25, 80, 30, 30);
     dc.DrawCheckMark(60, 80, 60, 60);
 
     // this is the test for "blitting bitmap into DC damages selected brush" bug
-    wxIcon m_std_icon = wxTheApp->GetStdIcon(wxICON_INFORMATION);
     wxCoord rectSize = m_std_icon.GetWidth() + 10;
     wxCoord x = 100;
     dc.SetPen(*wxTRANSPARENT_PEN);
     wxCoord rectSize = m_std_icon.GetWidth() + 10;
     wxCoord x = 100;
     dc.SetPen(*wxTRANSPARENT_PEN);
@@ -911,6 +908,14 @@ void MyCanvas::DrawRegions(wxDC& dc)
     
     dc.SetBrush( *wxGREY_BRUSH );
     dc.DrawRectangle( 10,10,310,310 );
     
     dc.SetBrush( *wxGREY_BRUSH );
     dc.DrawRectangle( 10,10,310,310 );
+    
+    if (m_smile_bmp.Ok())
+    {
+        dc.DrawBitmap( m_smile_bmp, 140, 20, TRUE );
+        dc.DrawBitmap( m_smile_bmp, 140, 290, TRUE );
+        dc.DrawBitmap( m_smile_bmp, 110, 80, TRUE );
+        dc.DrawBitmap( m_smile_bmp, 210, 80, TRUE );
+    }
 }
 
 void MyCanvas::OnPaint(wxPaintEvent &WXUNUSED(event))
 }
 
 void MyCanvas::OnPaint(wxPaintEvent &WXUNUSED(event))
index 5ddfbf0f03f490d0e1a3dafbd1d4b9a66b5f08d8..573cdd50073e0dc473771a727c27eaabb3dea37a 100644 (file)
@@ -620,15 +620,42 @@ void wxListLineData::CalculateSize( wxDC *dc, int spacing )
         case wxLC_ICON:
         {
             m_bound_all.width = m_spacing;
         case wxLC_ICON:
         {
             m_bound_all.width = m_spacing;
-            m_bound_all.height = m_spacing+13;
             wxNode *node = m_items.First();
             if (node)
             {
                 wxListItemData *item = (wxListItemData*)node->Data();
                 wxString s = item->GetText();
             wxNode *node = m_items.First();
             if (node)
             {
                 wxListItemData *item = (wxListItemData*)node->Data();
                 wxString s = item->GetText();
+                if (s.IsEmpty()) s = wxT("H");
                 wxCoord lw,lh;
                 dc->GetTextExtent( s, &lw, &lh );
                 wxCoord lw,lh;
                 dc->GetTextExtent( s, &lw, &lh );
+                if (lh < 15) lh = 15;
+                lw += 4;
+                lh += 3;
+                
+                m_bound_all.height = m_spacing+lh;
                 if (lw > m_spacing) m_bound_all.width = lw;
                 if (lw > m_spacing) m_bound_all.width = lw;
+                m_bound_label.width = lw;
+                m_bound_label.height = lh;
+                
+                if (item->HasImage())
+                {
+                    int w = 0;
+                    int h = 0;
+                    m_owner->GetImageSize( item->GetImage(), w, h );
+                    m_bound_icon.width = w + 8;
+                    m_bound_icon.height = h + 8;
+                }
+                
+                if (!item->HasText())
+                {
+                    m_bound_hilight.width = m_bound_icon.width;
+                    m_bound_hilight.height = m_bound_icon.height;
+                }
+                else
+                {
+                    m_bound_hilight.width = m_bound_label.width;
+                    m_bound_hilight.height = m_bound_label.height;
+                }
             }
             break;
         }
             }
             break;
         }
@@ -638,24 +665,34 @@ void wxListLineData::CalculateSize( wxDC *dc, int spacing )
             if (node)
             {
                 wxListItemData *item = (wxListItemData*)node->Data();
             if (node)
             {
                 wxListItemData *item = (wxListItemData*)node->Data();
+                
                 wxString s = item->GetText();
                 wxString s = item->GetText();
+                if (s.IsEmpty()) s = wxT("H");
                 wxCoord lw,lh;
                 dc->GetTextExtent( s, &lw, &lh );
                 wxCoord lw,lh;
                 dc->GetTextExtent( s, &lw, &lh );
+                if (lh < 15) lh = 15;
+                lw += 4;
+                lh += 3;
+                m_bound_label.width = lw;
+                m_bound_label.height = lh;
+                
                 m_bound_all.width = lw;
                 m_bound_all.height = lh;
                 m_bound_all.width = lw;
                 m_bound_all.height = lh;
+                
                 if (item->HasImage())
                 {
                 if (item->HasImage())
                 {
-#ifdef __WIN16__
                     int w = 0;
                     int h = 0;
                     int w = 0;
                     int h = 0;
-#else
-                    wxCoord w = 0;
-                    wxCoord h = 0;
-#endif
                     m_owner->GetImageSize( item->GetImage(), w, h );
                     m_owner->GetImageSize( item->GetImage(), w, h );
+                    m_bound_icon.width = w;
+                    m_bound_icon.height = h;
+                    
                     m_bound_all.width += 4 + w;
                     if (h > m_bound_all.height) m_bound_all.height = h;
                 }
                     m_bound_all.width += 4 + w;
                     if (h > m_bound_all.height) m_bound_all.height = h;
                 }
+                
+                m_bound_hilight.width = m_bound_all.width;
+                m_bound_hilight.height = m_bound_all.height;
             }
             break;
         }
             }
             break;
         }
@@ -667,12 +704,14 @@ void wxListLineData::CalculateSize( wxDC *dc, int spacing )
             while (node)
             {
                 wxListItemData *item = (wxListItemData*)node->Data();
             while (node)
             {
                 wxListItemData *item = (wxListItemData*)node->Data();
-                wxString s;
-                item->GetText( s );
-                if (s.IsNull()) s = "H";
+                wxString s = item->GetText();
+                if (s.IsEmpty()) s = wxT("H");
                 wxCoord lw,lh;
                 dc->GetTextExtent( s, &lw, &lh );
                 if (lh < 15) lh = 15;
                 wxCoord lw,lh;
                 dc->GetTextExtent( s, &lw, &lh );
                 if (lh < 15) lh = 15;
+                lw += 4;
+                lh += 3;
+                
                 item->SetSize( item->GetWidth(), lh );
                 m_bound_all.width += lw;
                 m_bound_all.height = lh;
                 item->SetSize( item->GetWidth(), lh );
                 m_bound_all.width += lw;
                 m_bound_all.height = lh;
@@ -691,63 +730,38 @@ void wxListLineData::SetPosition( wxDC *dc, int x, int y, int window_width )
     {
         case wxLC_ICON:
         {
     {
         case wxLC_ICON:
         {
-            AssignRect( m_bound_icon, 0, 0, 0, 0 );
-            AssignRect( m_bound_label, 0, 0, 0, 0 );
-            AssignRect( m_bound_hilight, m_bound_all );
             wxNode *node = m_items.First();
             if (node)
             {
                 wxListItemData *item = (wxListItemData*)node->Data();
                 if (item->HasImage())
                 {
             wxNode *node = m_items.First();
             if (node)
             {
                 wxListItemData *item = (wxListItemData*)node->Data();
                 if (item->HasImage())
                 {
-                    wxListItemData *item = (wxListItemData*)node->Data();
-                    int w = 0;
-                    int h = 0;
-                    m_owner->GetImageSize( item->GetImage(), w, h );
-                    m_bound_icon.x = m_bound_all.x + (m_spacing/2) - (w/2);
-                    m_bound_icon.y = m_bound_all.y + m_spacing - h - 5;
-                    m_bound_icon.width = w;
-                    m_bound_icon.height = h;
-                    if (!item->HasText())
-                    {
-                        AssignRect( m_bound_hilight, m_bound_icon );
-                        m_bound_hilight.x -= 5;
-                        m_bound_hilight.y -= 5;
-                        m_bound_hilight.width += 9;
-                        m_bound_hilight.height += 9;
-                    }
+                    m_bound_icon.x = m_bound_all.x + 4 + (m_spacing/2) - (m_bound_icon.width/2);
+                    m_bound_icon.y = m_bound_all.y + 4;
                 }
                 if (item->HasText())
                 {
                 }
                 if (item->HasText())
                 {
-                    wxString s;
-                    item->GetText( s );
-                    wxCoord lw,lh;
-                    dc->GetTextExtent( s, &lw, &lh );
                     if (m_bound_all.width > m_spacing)
                     if (m_bound_all.width > m_spacing)
-                        m_bound_label.x = m_bound_all.x;
+                        m_bound_label.x = m_bound_all.x + 2;
                     else
                     else
-                        m_bound_label.x = m_bound_all.x +  (m_spacing/2) - lw/2;
-                    m_bound_label.y = m_bound_all.y + m_bound_all.height - lh;
-                    m_bound_label.width = lw;
-                    m_bound_label.height = lh;
-                    AssignRect( m_bound_hilight, m_bound_label );
-                    m_bound_hilight.x -= 2;
-                    m_bound_hilight.y -= 2;
-                    m_bound_hilight.width += 4;
-                    m_bound_hilight.height += 4;
+                        m_bound_label.x = m_bound_all.x + 2 + (m_spacing/2) - (m_bound_label.width/2);
+                    m_bound_label.y = m_bound_all.y + m_bound_all.height + 2 - m_bound_label.height;
+                    m_bound_hilight.x = m_bound_label.x - 2;
+                    m_bound_hilight.y = m_bound_label.y - 2;
+                }
+                else
+                {
+                    m_bound_hilight.x = m_bound_icon.x - 4;
+                    m_bound_hilight.y = m_bound_icon.y - 4;
                 }
             }
             break;
         }
         case wxLC_LIST:
         {
                 }
             }
             break;
         }
         case wxLC_LIST:
         {
-            AssignRect( m_bound_label, m_bound_all );
-            m_bound_all.x -= 2;
-            m_bound_all.y -= 2;
-            m_bound_all.width += 4;
-            m_bound_all.height += 3;
-            AssignRect( m_bound_hilight, m_bound_all );
-            AssignRect( m_bound_icon, 0, 0, 0, 0 );
+            m_bound_hilight.x = m_bound_all.x;
+            m_bound_hilight.y = m_bound_all.y;
+            m_bound_label.y = m_bound_all.y + 2;
             wxNode *node = m_items.First();
             if (node)
             {
             wxNode *node = m_items.First();
             if (node)
             {
@@ -756,51 +770,31 @@ void wxListLineData::SetPosition( wxDC *dc, int x, int y, int window_width )
                 {
                     m_bound_icon.x = m_bound_all.x + 2;
                     m_bound_icon.y = m_bound_all.y + 2;
                 {
                     m_bound_icon.x = m_bound_all.x + 2;
                     m_bound_icon.y = m_bound_all.y + 2;
-                    int w;
-                    int h;
-                    m_owner->GetImageSize( item->GetImage(), w, h );
-                    m_bound_icon.width = w;
-                    m_bound_icon.height = h;
-                    m_bound_label.x += 4 + w;
-                    m_bound_label.width -= 4 + w;
+                    m_bound_label.x = m_bound_all.x + 6 + m_bound_icon.width;
+                }
+                else
+                {
+                    m_bound_label.x = m_bound_all.x + 2;
                 }
             }
             break;
         }
         case wxLC_REPORT:
         {
                 }
             }
             break;
         }
         case wxLC_REPORT:
         {
-            wxCoord lw,lh;
-            dc->GetTextExtent( "H", &lw, &lh );
-            if (lh < 15) lh = 15;
             m_bound_all.x = 0;
             m_bound_all.x = 0;
-            m_bound_all.y -= 0;
-            m_bound_all.height = lh+3;
             m_bound_all.width = window_width;
             AssignRect( m_bound_hilight, m_bound_all );
             m_bound_all.width = window_width;
             AssignRect( m_bound_hilight, m_bound_all );
-            AssignRect( m_bound_label, m_bound_all );
-            AssignRect( m_bound_icon, 0, 0, 0, 0 );
+            m_bound_label.x = m_bound_all.x + 2;
+            m_bound_label.y = m_bound_all.y + 2;
             wxNode *node = m_items.First();
             if (node)
             {
                 wxListItemData *item = (wxListItemData*)node->Data();
             wxNode *node = m_items.First();
             if (node)
             {
                 wxListItemData *item = (wxListItemData*)node->Data();
-                wxString s;
-                item->GetText( s );
-                if (s.IsEmpty()) s = wxT("H");
-                wxCoord lw,lh;
-                dc->GetTextExtent( s, &lw, &lh );
-                if (lh < 15) lh = 15;
-                m_bound_label.width = lw;
-                m_bound_label.height = lh;
                 if (item->HasImage())
                 {
                     m_bound_icon.x = m_bound_all.x + 2;
                     m_bound_icon.y = m_bound_all.y + 2;
                 if (item->HasImage())
                 {
                     m_bound_icon.x = m_bound_all.x + 2;
                     m_bound_icon.y = m_bound_all.y + 2;
-                    int w;
-                    int h;
-                    m_owner->GetImageSize( item->GetImage(), w, h );
-                    m_bound_icon.width = w;
-                    m_bound_icon.height = h;
-                    m_bound_label.x += 4 + w;
+                    m_bound_label.x += 4 + m_bound_icon.width;
                 }
             }
             break;
                 }
             }
             break;
@@ -2586,7 +2580,7 @@ void wxListMainWindow::CalculatePositions()
     line->CalculateSize( &dc, iconSpacing );
     int dummy = 0;
     line->GetSize( dummy, lineSpacing );
     line->CalculateSize( &dc, iconSpacing );
     int dummy = 0;
     line->GetSize( dummy, lineSpacing );
-    lineSpacing += 4;
+    lineSpacing += 1;
 
     int clientWidth = 0;
     int clientHeight = 0;
 
     int clientWidth = 0;
     int clientHeight = 0;
@@ -2643,8 +2637,8 @@ void wxListMainWindow::CalculatePositions()
         for (int tries = 0; tries < 2; tries++)
         {
             entireWidth = 0;
         for (int tries = 0; tries < 2; tries++)
         {
             entireWidth = 0;
-            int x = 5;  // painting is done at x-2
-            int y = 5;  // painting is done at y-2
+            int x = 2;
+            int y = 2;
             int maxWidth = 0;
             m_visibleLines = 0;
             int m_currentVisibleLines = 0;
             int maxWidth = 0;
             m_visibleLines = 0;
             int m_currentVisibleLines = 0;
index 33766926fd95d59cd927f0271f865bcaa9fc74b6..825cd2b2deacd64b2fd236c779b49d9f8645d4b9 100644 (file)
@@ -15,6 +15,7 @@
 #include "wx/window.h"
 
 #include <gdk/gdk.h>
 #include "wx/window.h"
 
 #include <gdk/gdk.h>
+#include <gdk/gdkx.h>
 #include <gtk/gtk.h>
 
 //-----------------------------------------------------------------------------
 #include <gtk/gtk.h>
 
 //-----------------------------------------------------------------------------
@@ -25,219 +26,6 @@ GdkWindow *wxScreenDC::sm_overlayWindow  = (GdkWindow*) NULL;
 int wxScreenDC::sm_overlayWindowX = 0;
 int wxScreenDC::sm_overlayWindowY = 0;
 
 int wxScreenDC::sm_overlayWindowX = 0;
 int wxScreenDC::sm_overlayWindowY = 0;
 
-//-----------------------------------------------------------------------------
-// create X window
-//-----------------------------------------------------------------------------
-
-extern "C" {
-
-#include <gdk/gdkprivate.h>
-#include <gdk/gdkx.h>
-#include <netinet/in.h>
-
-int my_nevent_masks = 17;
-int my_event_masks_table[19] =
-{
-  ExposureMask,
-  PointerMotionMask,
-  PointerMotionHintMask,
-  ButtonMotionMask,
-  Button1MotionMask,
-  Button2MotionMask,
-  Button3MotionMask,
-  ButtonPressMask | OwnerGrabButtonMask,
-  ButtonReleaseMask | OwnerGrabButtonMask,
-  KeyPressMask,
-  KeyReleaseMask,
-  EnterWindowMask,
-  LeaveWindowMask,
-  FocusChangeMask,
-  StructureNotifyMask,
-  PropertyChangeMask,
-  VisibilityChangeMask,
-  0,                                /* PROXIMITY_IN */
-  0                                /* PROXIMTY_OUT */
-};
-
-GdkWindow*
-gdk_window_transparent_new ( GdkWindow     *parent,
-                             GdkWindowAttr *attributes,
-                             gint           attributes_mask)
-{
-  GdkWindow *window;
-  GdkWindowPrivate *gprivate;
-  GdkWindowPrivate *parent_private;
-  GdkVisual *visual;
-  Display *parent_display;
-  Window xparent;
-  Visual *xvisual;
-  XSetWindowAttributes xattributes;
-  long xattributes_mask;
-  XSizeHints size_hints;
-  XWMHints wm_hints;
-  XClassHint *class_hint;
-  int x, y, depth;
-  unsigned int gclass;
-  char *title;
-  int i;
-
-  g_return_val_if_fail (attributes != NULL, NULL);
-
-  if (!parent)
-    parent = (GdkWindow*) &gdk_root_parent;
-
-  parent_private = (GdkWindowPrivate*) parent;
-  if (parent_private->destroyed)
-    return NULL;
-
-  xparent = parent_private->xwindow;
-  parent_display = parent_private->xdisplay;
-
-  gprivate = g_new (GdkWindowPrivate, 1);
-  window = (GdkWindow*) gprivate;
-
-  gprivate->parent = parent;
-
-  if (parent_private != &gdk_root_parent)
-    parent_private->children = g_list_prepend (parent_private->children, window);
-
-  gprivate->xdisplay = parent_display;
-  gprivate->destroyed = FALSE;
-  gprivate->resize_count = 0;
-  gprivate->ref_count = 1;
-  xattributes_mask = 0;
-
-  if (attributes_mask & GDK_WA_X)
-    x = attributes->x;
-  else
-    x = 0;
-
-  if (attributes_mask & GDK_WA_Y)
-    y = attributes->y;
-  else
-    y = 0;
-
-  gprivate->x = x;
-  gprivate->y = y;
-  gprivate->width = (attributes->width > 1) ? (attributes->width) : (1);
-  gprivate->height = (attributes->height > 1) ? (attributes->height) : (1);
-  gprivate->window_type = attributes->window_type;
-  gprivate->extension_events = FALSE;
-
-#if (GTK_MINOR_VERSION == 0)
-  gprivate->dnd_drag_data_type = None;
-  gprivate->dnd_drag_data_typesavail =
-    gprivate->dnd_drop_data_typesavail = NULL;
-  gprivate->dnd_drop_enabled = gprivate->dnd_drag_enabled =
-    gprivate->dnd_drag_accepted = gprivate->dnd_drag_datashow =
-    gprivate->dnd_drop_data_numtypesavail =
-    gprivate->dnd_drag_data_numtypesavail = 0;
-  gprivate->dnd_drag_eventmask = gprivate->dnd_drag_savedeventmask = 0;
-#endif
-
-  gprivate->filters = NULL;
-  gprivate->children = NULL;
-
-  window->user_data = NULL;
-
-  if (attributes_mask & GDK_WA_VISUAL)
-    visual = attributes->visual;
-  else
-    visual = gdk_visual_get_system ();
-  xvisual = ((GdkVisualPrivate*) visual)->xvisual;
-
-  xattributes.event_mask = StructureNotifyMask;
-  for (i = 0; i < my_nevent_masks; i++)
-    {
-      if (attributes->event_mask & (1 << (i + 1)))
-        xattributes.event_mask |= my_event_masks_table[i];
-    }
-
-  if (xattributes.event_mask)
-    xattributes_mask |= CWEventMask;
-
-  if(attributes_mask & GDK_WA_NOREDIR) {
-        xattributes.override_redirect =
-                (attributes->override_redirect == FALSE)?False:True;
-        xattributes_mask |= CWOverrideRedirect;
-  } else
-    xattributes.override_redirect = False;
-
-      gclass = InputOutput;
-      depth = visual->depth;
-
-      if (attributes_mask & GDK_WA_COLORMAP)
-        gprivate->colormap = attributes->colormap;
-      else
-        gprivate->colormap = gdk_colormap_get_system ();
-
-          xattributes.colormap = ((GdkColormapPrivate*) gprivate->colormap)->xcolormap;
-          xattributes_mask |= CWColormap;
-
-          xparent = gdk_root_window;
-
-          xattributes.save_under = True;
-          xattributes.override_redirect = True;
-          xattributes.cursor = None;
-          xattributes_mask |= CWSaveUnder | CWOverrideRedirect;
-
-  gprivate->xwindow = XCreateWindow (gprivate->xdisplay, xparent,
-                                    x, y, gprivate->width, gprivate->height,
-                                    0, depth, gclass, xvisual,
-                                    xattributes_mask, &xattributes);
-  gdk_window_ref (window);
-  gdk_xid_table_insert (&gprivate->xwindow, window);
-
-  if (gprivate->colormap)
-    gdk_colormap_ref (gprivate->colormap);
-
-      XSetWMProtocols (gprivate->xdisplay, gprivate->xwindow, gdk_wm_window_protocols, 2);
-
-  size_hints.flags = PSize;
-  size_hints.width = gprivate->width;
-  size_hints.height = gprivate->height;
-
-  wm_hints.flags = InputHint | StateHint | WindowGroupHint;
-  wm_hints.window_group = gdk_leader_window;
-  wm_hints.input = True;
-  wm_hints.initial_state = NormalState;
-
-  /* FIXME: Is there any point in doing this? Do any WM's pay
-   * attention to PSize, and even if they do, is this the
-   * correct value???
-   */
-  XSetWMNormalHints (gprivate->xdisplay, gprivate->xwindow, &size_hints);
-
-  XSetWMHints (gprivate->xdisplay, gprivate->xwindow, &wm_hints);
-
-  if (attributes_mask & GDK_WA_TITLE)
-    title = attributes->title;
-  else
-#if (GTK_MINOR_VERSION > 0)
-    title = "Unknown"; // GLH: Well I don't know for the moment what to write here.
-#else
-    title = gdk_progname;
-#endif
-
-  XmbSetWMProperties (gprivate->xdisplay, gprivate->xwindow,
-                      title, title,
-                      NULL, 0,
-                      NULL, NULL, NULL);
-
-  if (attributes_mask & GDK_WA_WMCLASS)
-    {
-      class_hint = XAllocClassHint ();
-      class_hint->res_name = attributes->wmclass_name;
-      class_hint->res_class = attributes->wmclass_class;
-      XSetClassHint (gprivate->xdisplay, gprivate->xwindow, class_hint);
-      XFree (class_hint);
-    }
-
-  return window;
-}
-
-} // extern "C"
-
 //-----------------------------------------------------------------------------
 // wxScreenDC
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 // wxScreenDC
 //-----------------------------------------------------------------------------
@@ -247,19 +35,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxScreenDC,wxPaintDC)
 wxScreenDC::wxScreenDC()
 {
     m_ok = FALSE;
 wxScreenDC::wxScreenDC()
 {
     m_ok = FALSE;
-    m_window = (GdkWindow *) NULL;
     m_cmap = gdk_colormap_get_system();
     m_cmap = gdk_colormap_get_system();
-
-    if (sm_overlayWindow)
-    {
-        m_window = sm_overlayWindow;
-        m_deviceOriginX = - sm_overlayWindowX;
-        m_deviceOriginY = - sm_overlayWindowY;
-    }
-    else
-    {
-       m_window = GDK_ROOT_PARENT();
-    }
+    m_window = GDK_ROOT_PARENT();
 
     SetUpDC();
 
 
     SetUpDC();
 
@@ -271,6 +48,11 @@ wxScreenDC::wxScreenDC()
 
 wxScreenDC::~wxScreenDC()
 {
 
 wxScreenDC::~wxScreenDC()
 {
+    gdk_gc_set_subwindow( m_penGC, GDK_CLIP_BY_CHILDREN );
+    gdk_gc_set_subwindow( m_brushGC, GDK_CLIP_BY_CHILDREN );
+    gdk_gc_set_subwindow( m_textGC, GDK_CLIP_BY_CHILDREN );
+    gdk_gc_set_subwindow( m_bgGC, GDK_CLIP_BY_CHILDREN );
+
     EndDrawingOnTop();
 }
 
     EndDrawingOnTop();
 }
 
@@ -297,47 +79,23 @@ bool wxScreenDC::StartDrawingOnTop( wxWindow *window )
 
 bool wxScreenDC::StartDrawingOnTop( wxRect *rect )
 {
 
 bool wxScreenDC::StartDrawingOnTop( wxRect *rect )
 {
-  int x = 0;
-  int y = 0;
-  int width = gdk_screen_width();
-  int height = gdk_screen_height();
-  if (rect)
-  {
-    x = rect->x;
-    y = rect->y;
-    width = rect->width;
-    height = rect->height;
-  }
-
-  sm_overlayWindowX = x;
-  sm_overlayWindowY = y;
-
-  GdkWindowAttr attr;
-  attr.x = x;
-  attr.y = y;
-  attr.width = width;
-  attr.height = height;
-  attr.override_redirect = TRUE;
-  attr.wclass = GDK_INPUT_OUTPUT;
-  attr.event_mask = 0;
-  attr.window_type = GDK_WINDOW_TEMP;
-
-  // GTK cannot set transparent backgrounds. :-(
-  sm_overlayWindow = gdk_window_transparent_new( NULL, &attr, GDK_WA_NOREDIR | GDK_WA_X | GDK_WA_Y );
-
-  if (sm_overlayWindow) gdk_window_show( sm_overlayWindow );
+    int x = 0;
+    int y = 0;
+    int width = gdk_screen_width();
+    int height = gdk_screen_height();
+    if (rect)
+    {
+        x = rect->x;
+        y = rect->y;
+        width = rect->width;
+        height = rect->height;
+    }
 
 
-  return (sm_overlayWindow != NULL);
+    return TRUE;
 }
 
 bool wxScreenDC::EndDrawingOnTop()
 {
 }
 
 bool wxScreenDC::EndDrawingOnTop()
 {
-    if (sm_overlayWindow) gdk_window_destroy( sm_overlayWindow );
-
-    sm_overlayWindow = NULL;
-    sm_overlayWindowX = 0;
-    sm_overlayWindowY = 0;
-
     return TRUE;
 }
 
     return TRUE;
 }
 
index 33766926fd95d59cd927f0271f865bcaa9fc74b6..825cd2b2deacd64b2fd236c779b49d9f8645d4b9 100644 (file)
@@ -15,6 +15,7 @@
 #include "wx/window.h"
 
 #include <gdk/gdk.h>
 #include "wx/window.h"
 
 #include <gdk/gdk.h>
+#include <gdk/gdkx.h>
 #include <gtk/gtk.h>
 
 //-----------------------------------------------------------------------------
 #include <gtk/gtk.h>
 
 //-----------------------------------------------------------------------------
@@ -25,219 +26,6 @@ GdkWindow *wxScreenDC::sm_overlayWindow  = (GdkWindow*) NULL;
 int wxScreenDC::sm_overlayWindowX = 0;
 int wxScreenDC::sm_overlayWindowY = 0;
 
 int wxScreenDC::sm_overlayWindowX = 0;
 int wxScreenDC::sm_overlayWindowY = 0;
 
-//-----------------------------------------------------------------------------
-// create X window
-//-----------------------------------------------------------------------------
-
-extern "C" {
-
-#include <gdk/gdkprivate.h>
-#include <gdk/gdkx.h>
-#include <netinet/in.h>
-
-int my_nevent_masks = 17;
-int my_event_masks_table[19] =
-{
-  ExposureMask,
-  PointerMotionMask,
-  PointerMotionHintMask,
-  ButtonMotionMask,
-  Button1MotionMask,
-  Button2MotionMask,
-  Button3MotionMask,
-  ButtonPressMask | OwnerGrabButtonMask,
-  ButtonReleaseMask | OwnerGrabButtonMask,
-  KeyPressMask,
-  KeyReleaseMask,
-  EnterWindowMask,
-  LeaveWindowMask,
-  FocusChangeMask,
-  StructureNotifyMask,
-  PropertyChangeMask,
-  VisibilityChangeMask,
-  0,                                /* PROXIMITY_IN */
-  0                                /* PROXIMTY_OUT */
-};
-
-GdkWindow*
-gdk_window_transparent_new ( GdkWindow     *parent,
-                             GdkWindowAttr *attributes,
-                             gint           attributes_mask)
-{
-  GdkWindow *window;
-  GdkWindowPrivate *gprivate;
-  GdkWindowPrivate *parent_private;
-  GdkVisual *visual;
-  Display *parent_display;
-  Window xparent;
-  Visual *xvisual;
-  XSetWindowAttributes xattributes;
-  long xattributes_mask;
-  XSizeHints size_hints;
-  XWMHints wm_hints;
-  XClassHint *class_hint;
-  int x, y, depth;
-  unsigned int gclass;
-  char *title;
-  int i;
-
-  g_return_val_if_fail (attributes != NULL, NULL);
-
-  if (!parent)
-    parent = (GdkWindow*) &gdk_root_parent;
-
-  parent_private = (GdkWindowPrivate*) parent;
-  if (parent_private->destroyed)
-    return NULL;
-
-  xparent = parent_private->xwindow;
-  parent_display = parent_private->xdisplay;
-
-  gprivate = g_new (GdkWindowPrivate, 1);
-  window = (GdkWindow*) gprivate;
-
-  gprivate->parent = parent;
-
-  if (parent_private != &gdk_root_parent)
-    parent_private->children = g_list_prepend (parent_private->children, window);
-
-  gprivate->xdisplay = parent_display;
-  gprivate->destroyed = FALSE;
-  gprivate->resize_count = 0;
-  gprivate->ref_count = 1;
-  xattributes_mask = 0;
-
-  if (attributes_mask & GDK_WA_X)
-    x = attributes->x;
-  else
-    x = 0;
-
-  if (attributes_mask & GDK_WA_Y)
-    y = attributes->y;
-  else
-    y = 0;
-
-  gprivate->x = x;
-  gprivate->y = y;
-  gprivate->width = (attributes->width > 1) ? (attributes->width) : (1);
-  gprivate->height = (attributes->height > 1) ? (attributes->height) : (1);
-  gprivate->window_type = attributes->window_type;
-  gprivate->extension_events = FALSE;
-
-#if (GTK_MINOR_VERSION == 0)
-  gprivate->dnd_drag_data_type = None;
-  gprivate->dnd_drag_data_typesavail =
-    gprivate->dnd_drop_data_typesavail = NULL;
-  gprivate->dnd_drop_enabled = gprivate->dnd_drag_enabled =
-    gprivate->dnd_drag_accepted = gprivate->dnd_drag_datashow =
-    gprivate->dnd_drop_data_numtypesavail =
-    gprivate->dnd_drag_data_numtypesavail = 0;
-  gprivate->dnd_drag_eventmask = gprivate->dnd_drag_savedeventmask = 0;
-#endif
-
-  gprivate->filters = NULL;
-  gprivate->children = NULL;
-
-  window->user_data = NULL;
-
-  if (attributes_mask & GDK_WA_VISUAL)
-    visual = attributes->visual;
-  else
-    visual = gdk_visual_get_system ();
-  xvisual = ((GdkVisualPrivate*) visual)->xvisual;
-
-  xattributes.event_mask = StructureNotifyMask;
-  for (i = 0; i < my_nevent_masks; i++)
-    {
-      if (attributes->event_mask & (1 << (i + 1)))
-        xattributes.event_mask |= my_event_masks_table[i];
-    }
-
-  if (xattributes.event_mask)
-    xattributes_mask |= CWEventMask;
-
-  if(attributes_mask & GDK_WA_NOREDIR) {
-        xattributes.override_redirect =
-                (attributes->override_redirect == FALSE)?False:True;
-        xattributes_mask |= CWOverrideRedirect;
-  } else
-    xattributes.override_redirect = False;
-
-      gclass = InputOutput;
-      depth = visual->depth;
-
-      if (attributes_mask & GDK_WA_COLORMAP)
-        gprivate->colormap = attributes->colormap;
-      else
-        gprivate->colormap = gdk_colormap_get_system ();
-
-          xattributes.colormap = ((GdkColormapPrivate*) gprivate->colormap)->xcolormap;
-          xattributes_mask |= CWColormap;
-
-          xparent = gdk_root_window;
-
-          xattributes.save_under = True;
-          xattributes.override_redirect = True;
-          xattributes.cursor = None;
-          xattributes_mask |= CWSaveUnder | CWOverrideRedirect;
-
-  gprivate->xwindow = XCreateWindow (gprivate->xdisplay, xparent,
-                                    x, y, gprivate->width, gprivate->height,
-                                    0, depth, gclass, xvisual,
-                                    xattributes_mask, &xattributes);
-  gdk_window_ref (window);
-  gdk_xid_table_insert (&gprivate->xwindow, window);
-
-  if (gprivate->colormap)
-    gdk_colormap_ref (gprivate->colormap);
-
-      XSetWMProtocols (gprivate->xdisplay, gprivate->xwindow, gdk_wm_window_protocols, 2);
-
-  size_hints.flags = PSize;
-  size_hints.width = gprivate->width;
-  size_hints.height = gprivate->height;
-
-  wm_hints.flags = InputHint | StateHint | WindowGroupHint;
-  wm_hints.window_group = gdk_leader_window;
-  wm_hints.input = True;
-  wm_hints.initial_state = NormalState;
-
-  /* FIXME: Is there any point in doing this? Do any WM's pay
-   * attention to PSize, and even if they do, is this the
-   * correct value???
-   */
-  XSetWMNormalHints (gprivate->xdisplay, gprivate->xwindow, &size_hints);
-
-  XSetWMHints (gprivate->xdisplay, gprivate->xwindow, &wm_hints);
-
-  if (attributes_mask & GDK_WA_TITLE)
-    title = attributes->title;
-  else
-#if (GTK_MINOR_VERSION > 0)
-    title = "Unknown"; // GLH: Well I don't know for the moment what to write here.
-#else
-    title = gdk_progname;
-#endif
-
-  XmbSetWMProperties (gprivate->xdisplay, gprivate->xwindow,
-                      title, title,
-                      NULL, 0,
-                      NULL, NULL, NULL);
-
-  if (attributes_mask & GDK_WA_WMCLASS)
-    {
-      class_hint = XAllocClassHint ();
-      class_hint->res_name = attributes->wmclass_name;
-      class_hint->res_class = attributes->wmclass_class;
-      XSetClassHint (gprivate->xdisplay, gprivate->xwindow, class_hint);
-      XFree (class_hint);
-    }
-
-  return window;
-}
-
-} // extern "C"
-
 //-----------------------------------------------------------------------------
 // wxScreenDC
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 // wxScreenDC
 //-----------------------------------------------------------------------------
@@ -247,19 +35,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxScreenDC,wxPaintDC)
 wxScreenDC::wxScreenDC()
 {
     m_ok = FALSE;
 wxScreenDC::wxScreenDC()
 {
     m_ok = FALSE;
-    m_window = (GdkWindow *) NULL;
     m_cmap = gdk_colormap_get_system();
     m_cmap = gdk_colormap_get_system();
-
-    if (sm_overlayWindow)
-    {
-        m_window = sm_overlayWindow;
-        m_deviceOriginX = - sm_overlayWindowX;
-        m_deviceOriginY = - sm_overlayWindowY;
-    }
-    else
-    {
-       m_window = GDK_ROOT_PARENT();
-    }
+    m_window = GDK_ROOT_PARENT();
 
     SetUpDC();
 
 
     SetUpDC();
 
@@ -271,6 +48,11 @@ wxScreenDC::wxScreenDC()
 
 wxScreenDC::~wxScreenDC()
 {
 
 wxScreenDC::~wxScreenDC()
 {
+    gdk_gc_set_subwindow( m_penGC, GDK_CLIP_BY_CHILDREN );
+    gdk_gc_set_subwindow( m_brushGC, GDK_CLIP_BY_CHILDREN );
+    gdk_gc_set_subwindow( m_textGC, GDK_CLIP_BY_CHILDREN );
+    gdk_gc_set_subwindow( m_bgGC, GDK_CLIP_BY_CHILDREN );
+
     EndDrawingOnTop();
 }
 
     EndDrawingOnTop();
 }
 
@@ -297,47 +79,23 @@ bool wxScreenDC::StartDrawingOnTop( wxWindow *window )
 
 bool wxScreenDC::StartDrawingOnTop( wxRect *rect )
 {
 
 bool wxScreenDC::StartDrawingOnTop( wxRect *rect )
 {
-  int x = 0;
-  int y = 0;
-  int width = gdk_screen_width();
-  int height = gdk_screen_height();
-  if (rect)
-  {
-    x = rect->x;
-    y = rect->y;
-    width = rect->width;
-    height = rect->height;
-  }
-
-  sm_overlayWindowX = x;
-  sm_overlayWindowY = y;
-
-  GdkWindowAttr attr;
-  attr.x = x;
-  attr.y = y;
-  attr.width = width;
-  attr.height = height;
-  attr.override_redirect = TRUE;
-  attr.wclass = GDK_INPUT_OUTPUT;
-  attr.event_mask = 0;
-  attr.window_type = GDK_WINDOW_TEMP;
-
-  // GTK cannot set transparent backgrounds. :-(
-  sm_overlayWindow = gdk_window_transparent_new( NULL, &attr, GDK_WA_NOREDIR | GDK_WA_X | GDK_WA_Y );
-
-  if (sm_overlayWindow) gdk_window_show( sm_overlayWindow );
+    int x = 0;
+    int y = 0;
+    int width = gdk_screen_width();
+    int height = gdk_screen_height();
+    if (rect)
+    {
+        x = rect->x;
+        y = rect->y;
+        width = rect->width;
+        height = rect->height;
+    }
 
 
-  return (sm_overlayWindow != NULL);
+    return TRUE;
 }
 
 bool wxScreenDC::EndDrawingOnTop()
 {
 }
 
 bool wxScreenDC::EndDrawingOnTop()
 {
-    if (sm_overlayWindow) gdk_window_destroy( sm_overlayWindow );
-
-    sm_overlayWindow = NULL;
-    sm_overlayWindowX = 0;
-    sm_overlayWindowY = 0;
-
     return TRUE;
 }
 
     return TRUE;
 }