1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-09-15 13:32:09 +02:00

Compare commits

..

5 Commits

Author SHA1 Message Date
a58a1b347a Show a deprecation notice on launch
References #360
2023-07-17 01:04:49 +02:00
37303ddf02 Fix doubled border in Settings dialog 2023-07-17 00:58:50 +02:00
f8417706e1 Update CefSharp to 109 2023-07-16 21:40:55 +02:00
c5a42e74d9 Release 1.25.4 2023-05-09 23:03:38 +02:00
23ebd58da0 Fix video player showing controls when cursor is above a different window
Closes #357
2023-03-18 13:48:29 +01:00
12 changed files with 78 additions and 27 deletions

View File

@@ -6,6 +6,6 @@ using TweetDuck;
namespace TweetDuck { namespace TweetDuck {
internal static class Version { internal static class Version {
public const string Tag = "1.25.3"; public const string Tag = "1.25.4";
} }
} }

View File

@@ -32,7 +32,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="CefSharp.Common.NETCore" Version="107.1.90" /> <PackageReference Include="CefSharp.Common.NETCore" Version="109.1.110" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -237,7 +237,7 @@ namespace TweetDuck.Video {
int maxWidth = Math.Min(DpiScaled(media.imageSourceWidth), ownerWidth * 3 / 4); int maxWidth = Math.Min(DpiScaled(media.imageSourceWidth), ownerWidth * 3 / 4);
int maxHeight = Math.Min(DpiScaled(media.imageSourceHeight), ownerHeight * 3 / 4); int maxHeight = Math.Min(DpiScaled(media.imageSourceHeight), ownerHeight * 3 / 4);
bool isCursorInside = ClientRectangle.Contains(PointToClient(Cursor.Position)); bool isCursorInside = ClientRectangle.Contains(PointToClient(Cursor.Position)) && Handle == NativeMethods.GetFormHandleAt(Cursor.Position);
Size newSize = new Size(Math.Max(minWidth + 2, maxWidth), Math.Max(minHeight + 2, maxHeight)); Size newSize = new Size(Math.Max(minWidth + 2, maxWidth), Math.Max(minHeight + 2, maxHeight));
Point newLocation = new Point(ownerLeft + (ownerWidth - newSize.Width) / 2, ownerTop + (ownerHeight - newSize.Height + SystemInformation.CaptionHeight) / 2); Point newLocation = new Point(ownerLeft + (ownerWidth - newSize.Width) / 2, ownerTop + (ownerHeight - newSize.Height + SystemInformation.CaptionHeight) / 2);

View File

@@ -1,11 +1,13 @@
#nullable enable #nullable enable
using System; using System;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.Drawing;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace TweetDuck.Video { namespace TweetDuck.Video {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
static class NativeMethods { static class NativeMethods {
private const int GA_ROOT = 2;
private const int GWL_HWNDPARENT = -8; private const int GWL_HWNDPARENT = -8;
[DllImport("user32.dll")] [DllImport("user32.dll")]
@@ -25,6 +27,12 @@ namespace TweetDuck.Video {
[DllImport("user32.dll")] [DllImport("user32.dll")]
public static extern IntPtr GetForegroundWindow(); public static extern IntPtr GetForegroundWindow();
[DllImport("user32.dll")]
private static extern IntPtr WindowFromPoint(Point point);
[DllImport("user32.dll")]
private static extern IntPtr GetAncestor(IntPtr hwnd, int flags);
[DllImport("user32.dll")] [DllImport("user32.dll")]
public static extern bool SetProcessDPIAware(); public static extern bool SetProcessDPIAware();
@@ -49,5 +57,10 @@ namespace TweetDuck.Video {
* ...so technically, this is following the documentation to the word. * ...so technically, this is following the documentation to the word.
*/ */
} }
public static IntPtr GetFormHandleAt(Point point) {
IntPtr window = WindowFromPoint(point);
return window == IntPtr.Zero ? IntPtr.Zero : GetAncestor(window, GA_ROOT);
}
} }
} }

View File

@@ -9,6 +9,7 @@ namespace TweetDuck.Configuration {
public const string ArgIgnoreGDPR = "-nogdpr"; public const string ArgIgnoreGDPR = "-nogdpr";
public const string ArgHttpVideo = "-httpvideo"; public const string ArgHttpVideo = "-httpvideo";
public const string ArgFreeze = "-freeze"; public const string ArgFreeze = "-freeze";
public const string ArgHideDeprecation = "-hidedeprecation";
// internal args // internal args
public const string ArgRestart = "-restart"; public const string ArgRestart = "-restart";

View File

@@ -0,0 +1,36 @@
using System;
using System.Windows.Forms;
using TweetLib.Core;
namespace TweetDuck.Dialogs;
static class DeprecationNoticeDialog {
public static bool Show() {
const string contents = """
TweetDuck is no longer being maintained:
- Twitter has been constantly breaking TweetDeck and therefore also breaking TweetDuck.
- Twitter will be replacing TweetDeck with a new version that is incompatible with most of the app's features.
- Twitter is planning to put TweetDeck behind a subscription paywall.
There will be no more updates.
Continue at your own risk.
""";
using FormMessage message = new FormMessage("TweetDuck Deprecation Notice", contents, MessageBoxIcon.Warning);
message.AddButton("Exit", DialogResult.Cancel, ControlType.Cancel);
message.AddButton("Continue", DialogResult.OK, ControlType.Accept | ControlType.Focused);
Button btnLearnMore = message.CreateButton("Learn More", x: 9, width: 106);
btnLearnMore.Anchor |= AnchorStyles.Left;
btnLearnMore.Margin = new Padding(0, 0, 48, 0);
btnLearnMore.Click += OnBtnLearnMoreClick;
message.AddActionControl(btnLearnMore);
return message.ShowDialog() == DialogResult.OK;
}
private static void OnBtnLearnMoreClick(object? sender, EventArgs args) {
App.SystemHandler.OpenBrowser(Program.Website + "/deprecation");
}
}

View File

@@ -124,15 +124,7 @@ namespace TweetDuck.Dialogs {
} }
public Button AddButton(string title, DialogResult result = DialogResult.OK, ControlType type = ControlType.None) { public Button AddButton(string title, DialogResult result = DialogResult.OK, ControlType type = ControlType.None) {
Button button = new Button { Button button = CreateButton(title);
Anchor = AnchorStyles.Bottom,
Font = SystemFonts.MessageBoxFont,
Location = new Point(0, 12),
Size = new Size(BrowserUtils.Scale(88, dpiScale), BrowserUtils.Scale(26, dpiScale)),
TabIndex = 256 - buttonCount,
Text = title,
UseVisualStyleBackColor = true
};
button.Click += (_, _) => { button.Click += (_, _) => {
ClickedButton = button; ClickedButton = button;
@@ -162,6 +154,18 @@ namespace TweetDuck.Dialogs {
return button; return button;
} }
public Button CreateButton(string title, int x = 0, int width = 88) {
return new Button {
Anchor = AnchorStyles.Bottom,
Font = SystemFonts.MessageBoxFont,
Location = new Point(x, 12),
Size = new Size(BrowserUtils.Scale(width, dpiScale), BrowserUtils.Scale(26, dpiScale)),
TabIndex = 256 - buttonCount,
Text = title,
UseVisualStyleBackColor = true
};
}
public void AddActionControl(Control control) { public void AddActionControl(Control control) {
panelActions.Controls.Add(control); panelActions.Controls.Add(control);

View File

@@ -50,10 +50,10 @@
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.panelContents.AutoScroll = true; this.panelContents.AutoScroll = true;
this.panelContents.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.panelContents.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelContents.Location = new System.Drawing.Point(135, 12); this.panelContents.Location = new System.Drawing.Point(134, 12);
this.panelContents.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); this.panelContents.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.panelContents.Name = "panelContents"; this.panelContents.Name = "panelContents";
this.panelContents.Size = new System.Drawing.Size(662, 482); this.panelContents.Size = new System.Drawing.Size(663, 482);
this.panelContents.TabIndex = 1; this.panelContents.TabIndex = 1;
// //
// panelButtons // panelButtons

View File

@@ -108,6 +108,10 @@ namespace TweetDuck {
if (Config.System.Migrate()) { if (Config.System.Migrate()) {
Config.System.Save(); Config.System.Save();
} }
if (!Arguments.HasFlag(Arguments.ArgHideDeprecation) && !DeprecationNoticeDialog.Show()) {
Environment.Exit(0);
}
} }
public void Launch(ResourceCache resourceCache, PluginManager pluginManager) { public void Launch(ResourceCache resourceCache, PluginManager pluginManager) {

View File

@@ -1,6 +1,5 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
using TweetDuck.Dialogs; using TweetDuck.Dialogs;
using TweetDuck.Management; using TweetDuck.Management;
@@ -36,16 +35,10 @@ namespace TweetDuck {
btnIgnore.Enabled = canIgnore; btnIgnore.Enabled = canIgnore;
form.ActiveControl = canIgnore ? btnIgnore : btnExit; form.ActiveControl = canIgnore ? btnIgnore : btnExit;
Button btnOpenLog = new Button { Button btnOpenLog = form.CreateButton("Show Error Log", x: 9, width: 106);
Anchor = AnchorStyles.Bottom | AnchorStyles.Left, btnOpenLog.Anchor |= AnchorStyles.Left;
Enabled = loggedSuccessfully, btnOpenLog.Enabled = loggedSuccessfully;
Font = SystemFonts.MessageBoxFont, btnOpenLog.Margin = new Padding(0, 0, 48, 0);
Location = new Point(9, 12),
Margin = new Padding(0, 0, 48, 0),
Size = new Size(106, 26),
Text = "Show Error Log",
UseVisualStyleBackColor = true
};
btnOpenLog.Click += static (_, _) => { btnOpenLog.Click += static (_, _) => {
if (!OpenLogFile()) { if (!OpenLogFile()) {

View File

@@ -36,7 +36,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="CefSharp.WinForms.NETCore" Version="107.1.90" /> <PackageReference Include="CefSharp.WinForms.NETCore" Version="109.1.110" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -28,7 +28,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="CefSharp.WinForms.NETCore" Version="107.1.90" /> <PackageReference Include="CefSharp.WinForms.NETCore" Version="109.1.110" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>