1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-06-01 11:34:04 +02:00

Disable moving the notification window if not in Settings menu & having Custom pos enabled

This commit is contained in:
chylex 2016-04-13 11:22:45 +02:00
parent cf450447e5
commit c53636c013
3 changed files with 14 additions and 3 deletions

View File

@ -41,7 +41,7 @@ public FormBrowser(){
Disposed += (sender, args) => browser.Dispose(); Disposed += (sender, args) => browser.Dispose();
notification = new FormNotification(this,bridge,true); notification = new FormNotification(this,bridge,true){ CanMoveWindow = () => false };
notification.Show(); notification.Show();
} }

View File

@ -10,6 +10,8 @@
namespace TweetDick.Core{ namespace TweetDick.Core{
sealed partial class FormNotification : Form{ sealed partial class FormNotification : Form{
public Func<bool> CanMoveWindow = () => true;
private readonly Form owner; private readonly Form owner;
private readonly ChromiumWebBrowser browser; private readonly ChromiumWebBrowser browser;
@ -51,6 +53,14 @@ private void Browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){
} }
} }
protected override void WndProc(ref Message m){
if (m.Msg == 0x0112 && (m.WParam.ToInt32() & 0xFFF0) == 0xF010 && !CanMoveWindow()){ // WM_SYSCOMMAND, SC_MOVE
return;
}
base.WndProc(ref m);
}
public void ShowNotification(TweetNotification notification){ public void ShowNotification(TweetNotification notification){
MoveToVisibleLocation(); MoveToVisibleLocation();

View File

@ -20,8 +20,7 @@ public FormSettings(FormBrowser browserForm){
Text = Program.BrandName+" Settings"; Text = Program.BrandName+" Settings";
notification = new FormNotification(browserForm,false); notification = new FormNotification(browserForm,false){ CanMoveWindow = () => radioLocCustom.Checked };
notification.Show(this);
notification.Move += (sender, args) => { notification.Move += (sender, args) => {
if (radioLocCustom.Checked){ if (radioLocCustom.Checked){
@ -29,6 +28,8 @@ public FormSettings(FormBrowser browserForm){
} }
}; };
notification.Show(this);
switch(Config.NotificationPosition){ switch(Config.NotificationPosition){
case TweetNotification.Position.TopLeft: radioLocTL.Checked = true; break; case TweetNotification.Position.TopLeft: radioLocTL.Checked = true; break;
case TweetNotification.Position.TopRight: radioLocTR.Checked = true; break; case TweetNotification.Position.TopRight: radioLocTR.Checked = true; break;