diff options
author | Lluis Sanchez <llsan@microsoft.com> | 2018-07-06 12:12:47 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-06 12:12:47 +0300 |
commit | 35cd3d62d3dd9e10cecc3b8dd7b089106db3ffa1 (patch) | |
tree | cf0665d4a13efdcbd49efa7de32544b7caef3a39 /main/src | |
parent | 7ceffc1e3d78ae498083af6406e9303380d31b4e (diff) | |
parent | 47443b400943a22eb1f3a30407a2c9d0dbc19c6a (diff) |
Merge pull request #5195 from mono/fix-window-launch-glitch
Fix window launch glitch
Diffstat (limited to 'main/src')
4 files changed, 108 insertions, 118 deletions
diff --git a/main/src/addins/WindowsPlatform/WindowsPlatform/WindowsPlatform.cs b/main/src/addins/WindowsPlatform/WindowsPlatform/WindowsPlatform.cs index aca3855241..133db60e95 100644 --- a/main/src/addins/WindowsPlatform/WindowsPlatform/WindowsPlatform.cs +++ b/main/src/addins/WindowsPlatform/WindowsPlatform/WindowsPlatform.cs @@ -1,34 +1,34 @@ -//
-// WindowsPlatform.cs
-//
-// Author:
-// Jonathan Pobst <monkey@jpobst.com>
-// Lluis Sanchez Gual <lluis@novell.com>
-// Michael Hutchinson <m.j.hutchinson@gmail.com>
-//
-// Copyright (C) 2007-2011 Novell, Inc (http://www.novell.com)
-// Copyright (C) 2012-2013 Xamarin Inc. (https://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
+// +// WindowsPlatform.cs +// +// Author: +// Jonathan Pobst <monkey@jpobst.com> +// Lluis Sanchez Gual <lluis@novell.com> +// Michael Hutchinson <m.j.hutchinson@gmail.com> +// +// Copyright (C) 2007-2011 Novell, Inc (http://www.novell.com) +// Copyright (C) 2012-2013 Xamarin Inc. (https://www.xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + using System; using System.IO; using System.Drawing; @@ -42,18 +42,18 @@ using MonoDevelop.Ide.Desktop; using System.Diagnostics; using MonoDevelop.Core.Execution; using System.Text; -using MonoDevelop.Core;
+using MonoDevelop.Core; using Microsoft.WindowsAPICodePack.InternetExplorer; using Microsoft.WindowsAPICodePack.Taskbar; using MonoDevelop.Ide; using MonoDevelop.Components.Windows; using WindowsPlatform.MainToolbar; -using MonoDevelop.Components.Commands;
+using MonoDevelop.Components.Commands; using System.Windows.Controls; using System.Collections.ObjectModel; -using System.Windows;
-using System.Windows.Input;
-
+using System.Windows; +using System.Windows.Input; + namespace MonoDevelop.Platform { public class WindowsPlatform : PlatformService @@ -70,8 +70,8 @@ namespace MonoDevelop.Platform public override string Name { get { return "Windows"; } - }
-
+ } + #region Toolbar implementation Components.Commands.CommandManager commandManager; string commandMenuAddinPath; @@ -89,13 +89,13 @@ namespace MonoDevelop.Platform const int WM_SYSCHAR = 0x0106; internal override void AttachMainToolbar (Gtk.VBox parent, Components.MainToolbar.IMainToolbarView toolbar) { - titleBar = new TitleBar ();
- var topMenu = new WPFTitlebar (titleBar);
-
- //commandManager.IncompleteKeyPressed += (sender, e) => {
- // if (e.Key == Gdk.Key.Alt_L) {
- // Keyboard.Focus(titleBar.DockTitle.Children[0]);
- // }
+ titleBar = new TitleBar (); + var topMenu = new WPFTitlebar (titleBar); + + //commandManager.IncompleteKeyPressed += (sender, e) => { + // if (e.Key == Gdk.Key.Alt_L) { + // Keyboard.Focus(titleBar.DockTitle.Children[0]); + // } //}; parent.PackStart (topMenu, false, true, 0); SetupMenu (); @@ -104,20 +104,20 @@ namespace MonoDevelop.Platform } void SetupMenu () - {
- // TODO: Use this?
+ { + // TODO: Use this? CommandEntrySet appCes = commandManager.CreateCommandEntrySet (appMenuAddinPath); CommandEntrySet ces = commandManager.CreateCommandEntrySet (commandMenuAddinPath); - var mainMenu = new Menu {
- IsMainMenu = true,
- FocusVisualStyle = null,
+ var mainMenu = new Menu { + IsMainMenu = true, + FocusVisualStyle = null, }; - foreach (CommandEntrySet ce in ces)
- {
- var item = new TitleMenuItem (commandManager, ce, menu: mainMenu);
- mainMenu.Items.Add(item);
- }
+ foreach (CommandEntrySet ce in ces) + { + var item = new TitleMenuItem (commandManager, ce, menu: mainMenu); + mainMenu.Items.Add(item); + } titleBar.DockTitle.Children.Add (mainMenu); DockPanel.SetDock (mainMenu, Dock.Left); @@ -128,36 +128,25 @@ namespace MonoDevelop.Platform TitleBar titleBar; internal override Components.MainToolbar.IMainToolbarView CreateMainToolbar (Gtk.Window window) - {
- return new WPFToolbar {
- HeightRequest = 40,
+ { + return new WPFToolbar { + HeightRequest = 40, }; - }
+ } #endregion - public override bool GetIsFullscreen (Components.Window window)
+ public override bool GetIsFullscreen (Components.Window window) { - WINDOWPLACEMENT lpwndpl = new WINDOWPLACEMENT (); - lpwndpl.length = Marshal.SizeOf (lpwndpl); - - Gtk.Window controlWindow = window; - IntPtr handle = GdkWin32.HgdiobjGet (controlWindow.GdkWindow); - Win32.GetWindowPlacement (handle, ref lpwndpl); - return lpwndpl.showCmd == Win32.SW_SHOWMAXIMIZED;
+ //the Fullscreen functionality is broken in GTK on Win7+ + //TODO: implement a workaround. + return false; } - public override void SetIsFullscreen (Components.Window window, bool isFullscreen)
+ public override void SetIsFullscreen (Components.Window window, bool isFullscreen) { - WINDOWPLACEMENT lpwndpl = new WINDOWPLACEMENT (); - lpwndpl.length = Marshal.SizeOf (lpwndpl); - - Gtk.Window controlWindow = window; - IntPtr handle = GdkWin32.HgdiobjGet (controlWindow.GdkWindow); - Win32.GetWindowPlacement (handle, ref lpwndpl); - lpwndpl.showCmd = isFullscreen ? Win32.SW_SHOWMAXIMIZED : Win32.SW_SHOWNORMAL; - Win32.SetWindowPlacement (handle, ref lpwndpl);
+ //no-op as we have not yet implemented this } -
+ internal static Xwt.Toolkit WPFToolkit; public override void Initialize () @@ -165,8 +154,8 @@ namespace MonoDevelop.Platform // Only initialize elements for Win7+. if (TaskbarManager.IsPlatformSupported) { TaskbarManager.Instance.ApplicationId = BrandingService.ApplicationName; - }
- // Set InternetExplorer emulation mode
+ } + // Set InternetExplorer emulation mode InternetExplorer.EmulationMode = IEEmulationMode.IE11; } @@ -550,8 +539,8 @@ namespace MonoDevelop.Platform try { SHOpenFolderAndSelectItems (dir, (uint)files.Length, files, 0); } finally { - ILFree (dir);
- foreach (var file in files)
+ ILFree (dir); + foreach (var file in files) ILFree (file); } } @@ -573,34 +562,34 @@ namespace MonoDevelop.Platform foreach (string file in files) Process.Start (ExePath, ProcessArgumentBuilder.Quote (file)); } - }
-
- static void ApplyTheme (System.Windows.Window window)
- {
- var color = System.Windows.Media.Color.FromArgb (
- (byte)(MonoDevelop.Ide.Gui.Styles.BackgroundColor.Alpha * 255.0),
- (byte)(MonoDevelop.Ide.Gui.Styles.BackgroundColor.Red * 255.0),
- (byte)(MonoDevelop.Ide.Gui.Styles.BackgroundColor.Green * 255.0),
- (byte)(MonoDevelop.Ide.Gui.Styles.BackgroundColor.Blue * 255.0));
- window.Background = new System.Windows.Media.SolidColorBrush (color);
- }
-
- public class ThemedWpfWindowBackend : Xwt.WPFBackend.WindowBackend
- {
- public override void Initialize ()
- {
- base.Initialize ();
- ApplyTheme (Window);
- }
- }
-
- public class ThemedWpfDialogBackend : Xwt.WPFBackend.DialogBackend
- { - public override void Initialize ()
- {
- base.Initialize ();
- ApplyTheme (Window);
- }
+ } + + static void ApplyTheme (System.Windows.Window window) + { + var color = System.Windows.Media.Color.FromArgb ( + (byte)(MonoDevelop.Ide.Gui.Styles.BackgroundColor.Alpha * 255.0), + (byte)(MonoDevelop.Ide.Gui.Styles.BackgroundColor.Red * 255.0), + (byte)(MonoDevelop.Ide.Gui.Styles.BackgroundColor.Green * 255.0), + (byte)(MonoDevelop.Ide.Gui.Styles.BackgroundColor.Blue * 255.0)); + window.Background = new System.Windows.Media.SolidColorBrush (color); + } + + public class ThemedWpfWindowBackend : Xwt.WPFBackend.WindowBackend + { + public override void Initialize () + { + base.Initialize (); + ApplyTheme (Window); + } + } + + public class ThemedWpfDialogBackend : Xwt.WPFBackend.DialogBackend + { + public override void Initialize () + { + base.Initialize (); + ApplyTheme (Window); + } } } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ViewCommands.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ViewCommands.cs index 7a1eca14b3..18eb5d3f9f 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ViewCommands.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ViewCommands.cs @@ -220,6 +220,9 @@ namespace MonoDevelop.Ide.Commands info.Text = IdeApp.Workbench.FullScreen ? GettextCatalog.GetString ("Exit Full Screen") : GettextCatalog.GetString ("Enter Full Screen"); + } else if (Platform.IsWindows) { + //this is currently a no-op on Windows as it's broken, so hide it + info.Visible = info.Enabled = false; } else { info.Checked = IdeApp.Workbench.FullScreen; } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DefaultWorkbench.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DefaultWorkbench.cs index 35772dc3e9..046f397317 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DefaultWorkbench.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DefaultWorkbench.cs @@ -80,7 +80,6 @@ namespace MonoDevelop.Ide.Gui bool closeAll; - bool fullscreen; Rectangle normalBounds = new Rectangle(0, 0, MinimumWidth, MinimumHeight); Gtk.Container rootWidget; @@ -641,10 +640,9 @@ namespace MonoDevelop.Ide.Gui public ICustomXmlSerializer Memento { get { - WorkbenchMemento memento = new WorkbenchMemento (new Properties ()); - int x, y, width, height; - GetPosition (out x, out y); - GetSize (out width, out height); + var memento = new WorkbenchMemento (new Properties ()); + GetPosition (out int x, out int y); + GetSize (out int width, out int height); // HACK: always capture bounds on OS X because we don't restore Gdk.WindowState.Maximized due to // the bug mentioned below. So we simular Maximized by capturing the Maximized size. if (GdkWindow.State == 0 || Platform.IsMac) { @@ -653,7 +651,7 @@ namespace MonoDevelop.Ide.Gui memento.Bounds = normalBounds; } memento.WindowState = GdkWindow.State; - memento.FullScreen = fullscreen; + memento.FullScreen = FullScreen; return memento.ToProperties (); } set { diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs index e513708297..f541ac413f 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs @@ -126,8 +126,7 @@ namespace MonoDevelop.Ide.Gui var memento = PropertyService.Get (workbenchMemento, new Properties ()); Counters.Initialization.Trace ("Setting memento"); workbench.Memento = memento; - Counters.Initialization.Trace ("Making Visible"); - RootWindow.Visible = true; + Counters.Initialization.Trace ("Setting layout"); workbench.CurrentLayout = "Solution"; // now we have an layout set notify it @@ -137,7 +136,8 @@ namespace MonoDevelop.Ide.Gui Counters.Initialization.Trace ("Initializing monitors"); monitors.Initialize (); - + + Counters.Initialization.Trace ("Making visible"); Present (); } |