/[EmuXPortal]/branches/mono/EmuXPortal/Form1.cs
ViewVC logotype

Diff of /branches/mono/EmuXPortal/Form1.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- branches/mono/EmuXPortal/Form1.cs	2016/03/17 04:23:49	264
+++ branches/mono/EmuXPortal/Form1.cs	2016/03/17 05:23:38	266
@@ -1,4 +1,6 @@
-//#define DISABLE_CURSOR_HIDE // when this is present, the cursor will not be hidden
+#define HAVE_X11_BORDERSTYLE_ERROR // indicates that there is an error with Control.set_InternalBorderStyle resulting in an X11 Error BadWindow (invalid Window parameter)
+
+//#define DISABLE_CURSOR_HIDE // when this is present, the cursor will not be hidden
 //#define DISABLE_PROGRESS_PERCENTAGE_MESSASGE // when this is present, no progress percent message will be shown on any progressbar
 #define DISABLE_RELEASE_MODE_KLOGLEVEL_DEBUG // when defined will turn off kLogLevel_Debug messages, in release mode
 //#define DISABLE_DEBUG_MODE_KLOGLEVEL_VERBOSE_DEBUG // when defined will turn off kLogLevel_VerboseDebug message, in debug mode
@@ -65,6 +67,7 @@
         {
             InitializeComponent();
 
+			this.KeyPreview = true;
          
             #region logging support
             string log_path = Application.StartupPath;
@@ -95,8 +98,8 @@
             #endregion
 
             #region unhandled exception support
-            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnhandledExceptionEventHandler);
-            Application.ThreadException += Application_Unhandled_ThreadException;
+//            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnhandledExceptionEventHandler);
+//            Application.ThreadException += Application_Unhandled_ThreadException;
             #endregion
 
             platform_flow.Dock = DockStyle.Fill;
@@ -134,19 +137,28 @@
         void platform_ctrl_LostFocus(object sender, EventArgs e)
         {
             PlatformControl c = sender as PlatformControl;
-            c.BorderStyle = BorderStyle.None;
-            c.BackColor = this.BackColor;
+			if (c != null) {
+				#if !HAVE_X11_BORDERSTYLE_ERROR
+				c.BorderStyle = BorderStyle.None;
+				#endif
+				c.BackColor = this.BackColor;
+			}
         }
 
         void platform_ctrl_GotFocus(object sender, EventArgs e)
-        {
+        {			
             PlatformControl c = sender as PlatformControl;
-            c.BorderStyle = BorderStyle.FixedSingle;
-            c.BackColor = SELECTED_CONTROL_BACKCOLOR;
-            CurrentPlatformControl = c;
+			if (c != null) {
+				#if !HAVE_X11_BORDERSTYLE_ERROR
+				c.BorderStyle = BorderStyle.FixedSingle;
+				#endif
+				c.BackColor = SELECTED_CONTROL_BACKCOLOR; 
+				CurrentPlatformControl = c;
+			}
         }
         void game_ctrl_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
         {
+			gLog.Verbose.Debug.WriteLine ("game_ctrl_PreviewKeyDown() fired -- keycode [{0}]", e.KeyCode);
             GameControl c = sender as GameControl;
 
             int changeAmount = 0;
@@ -351,6 +363,7 @@
         }
         void platform_ctrl_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
         {
+			gLog.Verbose.Debug.WriteLine ("platform_ctrl_PreviewKeyDown() fired -- keycode [{0}]", e.KeyCode);
             PlatformControl c = sender as PlatformControl;
             int changeAmount = 0;
             int currentPosition = 0;
@@ -489,14 +502,18 @@
         void game_ctrl_LostFocus(object sender, EventArgs e)
         {
             GameControl c = sender as GameControl;
+			#if !HAVE_X11_BORDERSTYLE_ERROR
             c.BorderStyle = BorderStyle.None;
+			#endif
             c.BackColor = this.BackColor;
         }
 
         void game_ctrl_GotFocus(object sender, EventArgs e)
         {
             GameControl c = sender as GameControl;
+			#if !HAVE_X11_BORDERSTYLE_ERROR
             c.BorderStyle = BorderStyle.FixedSingle;
+			#endif
             c.BackColor = SELECTED_CONTROL_BACKCOLOR;
             CurrentGameControl = c;
         }

 

  ViewVC Help
Powered by ViewVC 1.1.22