[longomatch] Fixes initial flash creating the Window and focus loose on shown



commit 234b12c3fd36492c000d5b35c7eec787430329fe
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Mon Sep 7 21:17:37 2009 +0200

    Fixes initial flash creating the Window and focus loose on shown

 LongoMatch/Gui/TransparentDrawingArea.cs           |   37 +++++--------------
 .../LongoMatch.Gui.Popup.TransparentDrawingArea.cs |    1 +
 LongoMatch/gtk-gui/gui.stetic                      |    4 +--
 3 files changed, 12 insertions(+), 30 deletions(-)
---
diff --git a/LongoMatch/Gui/TransparentDrawingArea.cs b/LongoMatch/Gui/TransparentDrawingArea.cs
index da6fc47..c33e899 100644
--- a/LongoMatch/Gui/TransparentDrawingArea.cs
+++ b/LongoMatch/Gui/TransparentDrawingArea.cs
@@ -49,8 +49,7 @@ namespace LongoMatch.Gui.Popup
 			LineColor=foreground;
 			lineWidth = 6;			
 			modified = false;
-			this.targetWidget = targetWidget;
-			Maximize();			
+			this.targetWidget = targetWidget;					
 		}		
 				
 		public int LineWidth{
@@ -123,24 +122,24 @@ namespace LongoMatch.Gui.Popup
 					
 			//Create a 1 depth pixmap used as a shape
 			//that will contain the info about transparency
-			shape = new Pixmap(null,Allocation.Width,Allocation.Height,1);
+			shape = new Pixmap(null,Gdk.Screen.Default.Width,Gdk.Screen.Default.Height,1);
 			shapeGC = new Gdk.GC(shape);
 			shapeGCV = new GCValues();
 			shapeGC.GetValues(shapeGCV);
 			transparent = shapeGCV.Foreground;
 			opaque = shapeGCV.Background;				
 			shapeGC.Foreground = transparent;
-			shape.DrawRectangle(shapeGC,true,0,0,Allocation.Width,Allocation.Height);	
+			shape.DrawRectangle(shapeGC,true,0,0,Gdk.Screen.Default.Width,Gdk.Screen.Default.Height);	
 			shapeGC.Background=opaque;
 			
 			ShapeCombineMask(shape, 0,0);
 		
 			//Create the pixmap that will contain the real drawing
 			//Used on Expose event to redraw the drawing area
-			pixmap = new Pixmap (drawingarea.GdkWindow,Allocation.Width,Allocation.Height);
+			pixmap = new Pixmap (drawingarea.GdkWindow,Gdk.Screen.Default.Width,Gdk.Screen.Default.Height);
 			paintGC= new Gdk.GC(pixmap);
 			pixmap.Colormap = Gdk.Rgb.Colormap;
-			pixmap.DrawRectangle(drawingarea.Style.BlackGC,true,0,0,Allocation.Width,Allocation.Height);
+			pixmap.DrawRectangle(drawingarea.Style.BlackGC,true,0,0,Gdk.Screen.Default.Width,Gdk.Screen.Default.Height);
 		}
 		
 		private double Clamp(double val, double min, double max){
@@ -239,8 +238,8 @@ namespace LongoMatch.Gui.Popup
 		
 		protected override void  OnShown(){
 			//Prevent a dirty flash when the 
-			//Window is created and inmediatle hidden
-			if (targetWidget != null){
+			//Window is created and hidden
+			if (targetWidget != null){				
 				base.OnShown ();
 				timeoutId = GLib.Timeout.Add(20,Reshape);
 			}
@@ -249,24 +248,8 @@ namespace LongoMatch.Gui.Popup
 		protected virtual void OnDrawingareaConfigureEvent (object o, Gtk.ConfigureEventArgs args)
 		{
 			this.TransientFor = (Gtk.Window)targetWidget.Toplevel;	
-			if (ready){
-				CreatePixmaps();
-				ready=false;
-			}		
-		}
-
-		protected virtual void OnWindowStateEvent (object o, Gtk.WindowStateEventArgs args)
-		{
-			//Create pixmap and shape once, the first time the
-			//the widget is maximized
-			if (args.Event.NewWindowState == WindowState.Maximized 
-			    && pixmap == null)
-				ready=true;
-		}
-
-		protected virtual void OnFocused (object o, Gtk.FocusedArgs args)
-		{
-			
-		}			
+			this.Resize(Gdk.Screen.Default.Width,Gdk.Screen.Default.Height);
+			CreatePixmaps();
+		}				
 	}
 }
diff --git a/LongoMatch/gtk-gui/LongoMatch.Gui.Popup.TransparentDrawingArea.cs b/LongoMatch/gtk-gui/LongoMatch.Gui.Popup.TransparentDrawingArea.cs
index 48504d3..4119c6c 100644
--- a/LongoMatch/gtk-gui/LongoMatch.Gui.Popup.TransparentDrawingArea.cs
+++ b/LongoMatch/gtk-gui/LongoMatch.Gui.Popup.TransparentDrawingArea.cs
@@ -20,6 +20,7 @@ namespace LongoMatch.Gui.Popup {
             // Widget LongoMatch.Gui.Popup.TransparentDrawingArea
             this.Name = "LongoMatch.Gui.Popup.TransparentDrawingArea";
             this.Title = Mono.Unix.Catalog.GetString("TransparentDrawingArea");
+            this.TypeHint = ((Gdk.WindowTypeHint)(4));
             this.WindowPosition = ((Gtk.WindowPosition)(4));
             this.AllowShrink = true;
             this.Gravity = ((Gdk.Gravity)(5));
diff --git a/LongoMatch/gtk-gui/gui.stetic b/LongoMatch/gtk-gui/gui.stetic
index 1eac3cd..9b047fb 100755
--- a/LongoMatch/gtk-gui/gui.stetic
+++ b/LongoMatch/gtk-gui/gui.stetic
@@ -4283,13 +4283,12 @@ If you are not sure about what you are doing, click ok</property>
   <widget class="Gtk.Window" id="LongoMatch.Gui.Popup.TransparentDrawingArea" design-size="644 370">
     <property name="MemberName" />
     <property name="Title" translatable="yes">TransparentDrawingArea</property>
+    <property name="TypeHint">Splashscreen</property>
     <property name="WindowPosition">CenterOnParent</property>
     <property name="AllowShrink">True</property>
     <property name="Gravity">Center</property>
     <property name="SkipPagerHint">True</property>
     <property name="SkipTaskbarHint">True</property>
-    <signal name="WindowStateEvent" handler="OnWindowStateEvent" />
-    <signal name="Focused" handler="OnFocused" />
     <child>
       <widget class="Gtk.DrawingArea" id="drawingarea">
         <property name="MemberName" />
@@ -4338,7 +4337,6 @@ If you are not sure about what you are doing, click ok</property>
               <widget class="Gtk.RadioButton" id="bbutton">
                 <property name="MemberName" />
                 <property name="Label" translatable="yes" />
-                <property name="Active">True</property>
                 <property name="DrawIndicator">False</property>
                 <property name="HasLabel">True</property>
                 <property name="UseUnderline">True</property>



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