[MWF] Implement multi-display support on Linux (Fixes #325669)
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / XplatUIDriver.cs
index 93bc594745d95c1eabd15bed34f46bcc75ba0c65..ff2427e069041443921e17fff29bb2903512acac 100644 (file)
@@ -173,11 +173,9 @@ namespace System.Windows.Forms {
                        get { return LeftRightAlignment.Left; }
                }
                
-#if NET_2_0
                internal virtual PowerStatus PowerStatus {
                        get { throw new NotImplementedException ("Has not been implemented yet for this platform."); }
                }
-#endif
 
                internal virtual int SizingBorderWidth {
                        get { return 4; }
@@ -250,6 +248,7 @@ namespace System.Windows.Forms {
                internal abstract bool MouseWheelPresent { get; }
                internal abstract Rectangle VirtualScreen { get; }
                internal abstract Rectangle WorkingArea { get; }
+               internal abstract Screen[] AllScreens { get; }
                internal abstract bool ThemesEnabled { get; }
 
                internal virtual bool RequiresPositiveClientAreaSize {
@@ -274,7 +273,9 @@ namespace System.Windows.Forms {
                internal abstract event EventHandler Idle;
 
                #region XplatUI Driver Methods
-               internal abstract void AudibleAlert();
+               internal abstract void AudibleAlert(AlertType alert);
+
+               internal abstract void BeginMoveResize (IntPtr handle); // init a window manager driven resize event
 
                internal abstract void EnableThemes();
 
@@ -388,9 +389,7 @@ namespace System.Windows.Forms {
                internal abstract bool SystrayAdd(IntPtr hwnd, string tip, Icon icon, out ToolTip tt);
                internal abstract bool SystrayChange(IntPtr hwnd, string tip, Icon icon, ref ToolTip tt);
                internal abstract void SystrayRemove(IntPtr hwnd, ref ToolTip tt);
-#if NET_2_0            
                internal abstract void SystrayBalloon(IntPtr hwnd, int timeout, string title, string text, ToolTipIcon icon);
-#endif
 
                internal abstract Point GetMenuOrigin(IntPtr hwnd);
                internal abstract void MenuToScreen(IntPtr hwnd, ref int x, ref int y);
@@ -401,7 +400,7 @@ namespace System.Windows.Forms {
                internal abstract void ClipboardClose(IntPtr handle);
                internal abstract IntPtr ClipboardOpen (bool primary_selection);
                internal abstract int ClipboardGetID(IntPtr handle, string format);
-               internal abstract void ClipboardStore(IntPtr handle, object obj, int id, XplatUI.ObjectToClipboard converter);
+               internal abstract void ClipboardStore(IntPtr handle, object obj, int id, XplatUI.ObjectToClipboard converter, bool copy);
                internal abstract int[] ClipboardAvailableFormats(IntPtr handle);
                internal abstract object ClipboardRetrieve(IntPtr handle, int id, XplatUI.ClipboardToObject converter);
 
@@ -471,12 +470,23 @@ namespace System.Windows.Forms {
 
        internal class XplatUIDriverSupport {
                #region XplatUI Driver Support Methods
-#if NET_2_0
                internal static void ExecutionCallback (object state)
                {
                        AsyncMethodData data = (AsyncMethodData) state;
                        AsyncMethodResult result = data.Result;
-                       object ret = data.Method.DynamicInvoke (data.Args);
+                       
+                       object ret;
+                       try {
+                               ret = data.Method.DynamicInvoke (data.Args);
+                       } catch (Exception ex) {
+                               if (result != null) {
+                                       result.CompleteWithException (ex);
+                                       return;
+                               }
+                               
+                               throw;
+                       }
+               
                        if (result != null) {
                                result.Complete (ret);
                        }
@@ -496,38 +506,6 @@ namespace System.Windows.Forms {
                                gchandle.Free ();
                        }
                }
-#else
-               // for NET_1_0 and NET_1_1 no (public) ExecutionContext exists 
-               // so we must use the System.Threading.CompressedStack class
-               internal static void ExecuteClientMessage (GCHandle gchandle) {
-                       AsyncMethodData data = (AsyncMethodData) gchandle.Target;
-                       CompressedStack original = null;
-                       
-#if !MWF_ON_MSRUNTIME
-                       // Stack is non-null only if the security manager is active
-                       if (data.Stack != null) {
-                               original = Thread.CurrentThread.GetCompressedStack ();
-                               Thread.CurrentThread.SetCompressedStack (data.Stack);
-                       }
-#endif
-
-                       try {
-                               AsyncMethodResult result = data.Result;
-                               object ret = data.Method.DynamicInvoke (data.Args);
-                               result.Complete (ret);
-                       }
-                       finally {
-#if !MWF_ON_MSRUNTIME
-                               if (data.Stack != null) {
-                                       // whatever occurs we must revert to the original compressed
-                                       // stack (null being a valid, empty, value in this case).
-                                       Thread.CurrentThread.SetCompressedStack (original);
-                               }
-#endif
-                               gchandle.Free ();
-                       }
-               }
-#endif
                
                #endregion      // XplatUI Driver Support Methods
        }