1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-08-17 00:31:42 +02:00

Fix some issues with multi-monitor setups (change default loc, fix config saving before window loaded)

This commit is contained in:
2016-04-13 02:33:21 +02:00
parent f99435ff6a
commit 81c29ab50c
5 changed files with 14 additions and 7 deletions

@@ -26,13 +26,13 @@ namespace TweetDick.Configuration{
public bool IsCustomWindowLocationSet{ public bool IsCustomWindowLocationSet{
get{ get{
return WindowLocation.X != 32000; return WindowLocation.X != -32000;
} }
} }
public bool IsCustomNotificationPositionSet{ public bool IsCustomNotificationPositionSet{
get{ get{
return CustomNotificationPosition.X != 32000; return CustomNotificationPosition.X != -32000;
} }
} }
@@ -45,10 +45,10 @@ namespace TweetDick.Configuration{
this.file = file; this.file = file;
IsMaximized = true; IsMaximized = true;
WindowLocation = new Point(32000,32000); WindowLocation = new Point(-32000,-32000);
NotificationDuration = TweetNotification.Duration.Medium; NotificationDuration = TweetNotification.Duration.Medium;
NotificationPosition = TweetNotification.Position.TopRight; NotificationPosition = TweetNotification.Position.TopRight;
CustomNotificationPosition = new Point(32000,32000); CustomNotificationPosition = new Point(-32000,-32000);
NotificationEdgeDistance = 8; NotificationEdgeDistance = 8;
} }

@@ -31,7 +31,7 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Icon = TweetDick.Properties.Resources.icon; this.Icon = TweetDick.Properties.Resources.icon;
this.Location = new System.Drawing.Point(32000, 32000); this.Location = new System.Drawing.Point(-32000, -32000);
this.Name = "FormBrowser"; this.Name = "FormBrowser";
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.ResizeEnd += new System.EventHandler(this.FormBrowser_ResizeEnd); this.ResizeEnd += new System.EventHandler(this.FormBrowser_ResizeEnd);

@@ -23,6 +23,7 @@ namespace TweetDick.Core{
private FormSettings currentFormSettings; private FormSettings currentFormSettings;
private FormAbout currentFormAbout; private FormAbout currentFormAbout;
private bool isLoaded;
public FormBrowser(){ public FormBrowser(){
InitializeComponent(); InitializeComponent();
@@ -72,6 +73,8 @@ namespace TweetDick.Core{
Size = Screen.PrimaryScreen.WorkingArea.Size; Size = Screen.PrimaryScreen.WorkingArea.Size;
WindowState = FormWindowState.Maximized; WindowState = FormWindowState.Maximized;
} }
isLoaded = true;
} }
// active event handlers // active event handlers
@@ -94,12 +97,16 @@ namespace TweetDick.Core{
} }
private void FormBrowser_ResizeEnd(object sender, EventArgs e){ // also triggers when the window moves private void FormBrowser_ResizeEnd(object sender, EventArgs e){ // also triggers when the window moves
if (!isLoaded)return;
Config.WindowLocation = Location; Config.WindowLocation = Location;
Config.WindowSize = Size; Config.WindowSize = Size;
Config.Save(); Config.Save();
} }
private void FormBrowser_WindowStateChanged(object sender, EventArgs e){ private void FormBrowser_WindowStateChanged(object sender, EventArgs e){
if (!isLoaded)return;
Config.IsMaximized = WindowState != FormWindowState.Normal; Config.IsMaximized = WindowState != FormWindowState.Normal;
FormBrowser_ResizeEnd(sender,e); FormBrowser_ResizeEnd(sender,e);
} }

@@ -65,7 +65,7 @@
this.Controls.Add(this.progressBarTimer); this.Controls.Add(this.progressBarTimer);
this.Controls.Add(this.panelBrowser); this.Controls.Add(this.panelBrowser);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Location = new System.Drawing.Point(32000, 32000); this.Location = new System.Drawing.Point(-32000, -32000);
this.Name = "FormNotification"; this.Name = "FormNotification";
this.ShowInTaskbar = false; this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;

@@ -78,7 +78,7 @@ namespace TweetDick.Core{
public void HideNotification(){ public void HideNotification(){
browser.LoadHtml("","about:blank"); browser.LoadHtml("","about:blank");
Location = new Point(32000,32000); Location = new Point(-32000,-32000);
TopMost = false; TopMost = false;
timerProgress.Stop(); timerProgress.Stop();
} }