[dasher] Fix remaining GSEAL_ENABLE issues (#614995). Remove CCanvas' copy of DasherScreen's width and height



commit 578d5f151ef0e705f4d52908e30439c20593aa21
Author: Patrick Welche <prlw1 cam ac uk>
Date:   Thu Jun 3 17:14:23 2010 +0100

    Fix remaining GSEAL_ENABLE issues (#614995).
    Remove CCanvas' copy of DasherScreen's width and height.

 Src/Gtk2/Canvas.cpp        |    8 +++-----
 Src/Gtk2/Canvas.h          |   15 ++-------------
 Src/Gtk2/DasherControl.cpp |   10 +++++++++-
 3 files changed, 14 insertions(+), 19 deletions(-)
---
diff --git a/Src/Gtk2/Canvas.cpp b/Src/Gtk2/Canvas.cpp
index 65b5dc3..11d4a00 100644
--- a/Src/Gtk2/Canvas.cpp
+++ b/Src/Gtk2/Canvas.cpp
@@ -7,8 +7,9 @@
 
 using namespace Dasher;
 
-CCanvas::CCanvas(GtkWidget *pCanvas, CPangoCache *pPangoCache)
-  : CDasherScreen(pCanvas->allocation.width, pCanvas->allocation.height) {
+CCanvas::CCanvas(GtkWidget *pCanvas, CPangoCache *pPangoCache,
+                 screenint iWidth, screenint iHeight)
+  : CDasherScreen(iWidth, iHeight) {
 
 #if WITH_CAIRO
   cairo_colours = 0;
@@ -19,9 +20,6 @@ CCanvas::CCanvas(GtkWidget *pCanvas, CPangoCache *pPangoCache)
   m_pCanvas = pCanvas;
   m_pPangoCache = pPangoCache;
   
-  m_iWidth = m_pCanvas->allocation.width;
-  m_iHeight = m_pCanvas->allocation.height;
-
   // Construct the buffer pixmaps
   // FIXME - only allocate without cairo
 
diff --git a/Src/Gtk2/Canvas.h b/Src/Gtk2/Canvas.h
index c0a3927..8b37cda 100644
--- a/Src/Gtk2/Canvas.h
+++ b/Src/Gtk2/Canvas.h
@@ -74,7 +74,8 @@ public:
   /// \param pPangoCache A cache for precomputed Pango layouts
   ///
 
-  CCanvas(GtkWidget * pCanvas, CPangoCache * pPangoCache);
+  CCanvas(GtkWidget *pCanvas, CPangoCache *pPangoCache,
+          screenint iWidth, screenint iHeight);
   ~CCanvas();
 
   ///
@@ -215,18 +216,6 @@ public:
     // Not required in this model
   };
 
-  /// 
-  /// Canvas width
-  ///
-
-  int m_iWidth;
-
-  ///
-  /// Canvas height
-  ///
-
-  int m_iHeight;
-
 private:
 
   ///
diff --git a/Src/Gtk2/DasherControl.cpp b/Src/Gtk2/DasherControl.cpp
index 6f692b2..96458e5 100644
--- a/Src/Gtk2/DasherControl.cpp
+++ b/Src/Gtk2/DasherControl.cpp
@@ -281,11 +281,19 @@ void CDasherControl::ShutdownTimer() {
 }
 
 int CDasherControl::CanvasConfigureEvent() {
+  GtkAllocation a;
+
+#if GTK_CHECK_VERSION (2,18,0)
+  gtk_widget_get_allocation(m_pCanvas, &a);
+#else
+  a.width  = m_pCanvas->width;
+  a.height = m_pCanvas->height;
+#endif
 
   if(m_pScreen != NULL)
     delete m_pScreen;
 
-  m_pScreen = new CCanvas(m_pCanvas, m_pPangoCache);
+  m_pScreen = new CCanvas(m_pCanvas, m_pPangoCache, a.width, a.height);
   ChangeScreen(m_pScreen);
  
   return 0;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]