mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-23 11:34:06 +02:00
Temporarily move notification with Alt and restore by middle-clicking title bar
Closes #175
This commit is contained in:
parent
97da0b79e4
commit
8c9168a4bf
Core/Notification
@ -25,7 +25,7 @@ protected static int FontSizeLevel{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Point PrimaryLocation{
|
protected virtual Point PrimaryLocation{
|
||||||
get{
|
get{
|
||||||
UserConfig config = Program.UserConfig;
|
UserConfig config = Program.UserConfig;
|
||||||
Screen screen;
|
Screen screen;
|
||||||
|
@ -10,10 +10,24 @@ sealed partial class FormNotificationTweet : FormNotificationMain{
|
|||||||
private const int NonIntrusiveIdleLimit = 30;
|
private const int NonIntrusiveIdleLimit = 30;
|
||||||
private const int TrimMinimum = 32;
|
private const int TrimMinimum = 32;
|
||||||
|
|
||||||
|
protected override Point PrimaryLocation => hasTemporarilyMoved && IsNotificationVisible ? Location : base.PrimaryLocation;
|
||||||
private bool IsCursorOverNotificationArea => new Rectangle(PrimaryLocation, Size).Contains(Cursor.Position);
|
private bool IsCursorOverNotificationArea => new Rectangle(PrimaryLocation, Size).Contains(Cursor.Position);
|
||||||
|
|
||||||
|
protected override bool CanDragWindow{
|
||||||
|
get{
|
||||||
|
if (ModifierKeys.HasFlag(Keys.Alt)){
|
||||||
|
hasTemporarilyMoved = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private readonly Queue<TweetNotification> tweetQueue = new Queue<TweetNotification>(4);
|
private readonly Queue<TweetNotification> tweetQueue = new Queue<TweetNotification>(4);
|
||||||
private bool needsTrim;
|
private bool needsTrim;
|
||||||
|
private bool hasTemporarilyMoved;
|
||||||
|
|
||||||
public FormNotificationTweet(FormBrowser owner, PluginManager pluginManager) : base(owner, pluginManager, true){
|
public FormNotificationTweet(FormBrowser owner, PluginManager pluginManager) : base(owner, pluginManager, true){
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@ -26,6 +40,20 @@ public FormNotificationTweet(FormBrowser owner, PluginManager pluginManager) : b
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void WndProc(ref Message m){
|
||||||
|
if (m.Msg == 0x00A7){ // WM_NCMBUTTONDOWN
|
||||||
|
int hitTest = m.WParam.ToInt32();
|
||||||
|
|
||||||
|
if (hitTest == 2 || hitTest == 20){ // HTCAPTION, HTCLOSE
|
||||||
|
hasTemporarilyMoved = false;
|
||||||
|
MoveToVisibleLocation();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
base.WndProc(ref m);
|
||||||
|
}
|
||||||
|
|
||||||
// event handlers
|
// event handlers
|
||||||
|
|
||||||
private void Config_MuteToggled(object sender, EventArgs e){
|
private void Config_MuteToggled(object sender, EventArgs e){
|
||||||
@ -75,6 +103,8 @@ public override void HideNotification(){
|
|||||||
tweetQueue.TrimExcess();
|
tweetQueue.TrimExcess();
|
||||||
needsTrim = false;
|
needsTrim = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hasTemporarilyMoved = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void FinishCurrentNotification(){
|
public override void FinishCurrentNotification(){
|
||||||
|
Loading…
Reference in New Issue
Block a user