From 184e7492028d53cc260406dbe017f4ddcb6b9470 Mon Sep 17 00:00:00 2001 From: Jaex Date: Sun, 29 Jun 2025 23:31:10 +0300 Subject: [PATCH] fixed #7999 #7989: Workaround dialog issue --- ShareX.HelpersLib/Enums.cs | 6 ------ ShareX.HelpersLib/Extensions/FormExtensions.cs | 10 ++++++++++ ShareX.HelpersLib/Forms/ColorPickerForm.cs | 7 +------ ShareX.ScreenCaptureLib/Forms/RegionCaptureForm.cs | 3 +++ .../Shapes/Drawing/StickerDrawingShape.cs | 2 +- .../Shapes/Drawing/TextDrawingShape.cs | 2 +- ShareX/Enums.cs | 6 ++++++ .../Forms => ShareX/Tools}/MonitorTestForm.Designer.cs | 10 +++++----- .../Forms => ShareX/Tools}/MonitorTestForm.ar-YE.resx | 0 .../Forms => ShareX/Tools}/MonitorTestForm.cs | 3 ++- .../Forms => ShareX/Tools}/MonitorTestForm.de.resx | 0 .../Forms => ShareX/Tools}/MonitorTestForm.es-MX.resx | 0 .../Forms => ShareX/Tools}/MonitorTestForm.es.resx | 0 .../Forms => ShareX/Tools}/MonitorTestForm.fa-IR.resx | 0 .../Forms => ShareX/Tools}/MonitorTestForm.fr.resx | 0 .../Forms => ShareX/Tools}/MonitorTestForm.he-IL.resx | 0 .../Forms => ShareX/Tools}/MonitorTestForm.hu.resx | 0 .../Forms => ShareX/Tools}/MonitorTestForm.id-ID.resx | 0 .../Forms => ShareX/Tools}/MonitorTestForm.it-IT.resx | 0 .../Forms => ShareX/Tools}/MonitorTestForm.ja-JP.resx | 0 .../Forms => ShareX/Tools}/MonitorTestForm.ko-KR.resx | 0 .../Forms => ShareX/Tools}/MonitorTestForm.nl-NL.resx | 0 .../Forms => ShareX/Tools}/MonitorTestForm.pl.resx | 0 .../Forms => ShareX/Tools}/MonitorTestForm.pt-BR.resx | 0 .../Forms => ShareX/Tools}/MonitorTestForm.pt-PT.resx | 0 .../Forms => ShareX/Tools}/MonitorTestForm.resx | 0 .../Forms => ShareX/Tools}/MonitorTestForm.ro.resx | 0 .../Forms => ShareX/Tools}/MonitorTestForm.ru.resx | 0 .../Forms => ShareX/Tools}/MonitorTestForm.tr.resx | 0 .../Forms => ShareX/Tools}/MonitorTestForm.uk.resx | 0 .../Forms => ShareX/Tools}/MonitorTestForm.vi-VN.resx | 0 .../Forms => ShareX/Tools}/MonitorTestForm.zh-CN.resx | 0 .../Forms => ShareX/Tools}/MonitorTestForm.zh-TW.resx | 0 ShareX/Tools/PinToScreen/PinToScreenForm.cs | 7 +------ .../Forms => ShareX/Tools}/ScreenTearingTestForm.cs | 3 ++- 35 files changed, 32 insertions(+), 27 deletions(-) rename {ShareX.HelpersLib/Forms => ShareX/Tools}/MonitorTestForm.Designer.cs (98%) rename {ShareX.HelpersLib/Forms => ShareX/Tools}/MonitorTestForm.ar-YE.resx (100%) rename {ShareX.HelpersLib/Forms => ShareX/Tools}/MonitorTestForm.cs (99%) rename {ShareX.HelpersLib/Forms => ShareX/Tools}/MonitorTestForm.de.resx (100%) rename {ShareX.HelpersLib/Forms => ShareX/Tools}/MonitorTestForm.es-MX.resx (100%) rename {ShareX.HelpersLib/Forms => ShareX/Tools}/MonitorTestForm.es.resx (100%) rename {ShareX.HelpersLib/Forms => ShareX/Tools}/MonitorTestForm.fa-IR.resx (100%) rename {ShareX.HelpersLib/Forms => ShareX/Tools}/MonitorTestForm.fr.resx (100%) rename {ShareX.HelpersLib/Forms => ShareX/Tools}/MonitorTestForm.he-IL.resx (100%) rename {ShareX.HelpersLib/Forms => ShareX/Tools}/MonitorTestForm.hu.resx (100%) rename {ShareX.HelpersLib/Forms => ShareX/Tools}/MonitorTestForm.id-ID.resx (100%) rename {ShareX.HelpersLib/Forms => ShareX/Tools}/MonitorTestForm.it-IT.resx (100%) rename {ShareX.HelpersLib/Forms => ShareX/Tools}/MonitorTestForm.ja-JP.resx (100%) rename {ShareX.HelpersLib/Forms => ShareX/Tools}/MonitorTestForm.ko-KR.resx (100%) rename {ShareX.HelpersLib/Forms => ShareX/Tools}/MonitorTestForm.nl-NL.resx (100%) rename {ShareX.HelpersLib/Forms => ShareX/Tools}/MonitorTestForm.pl.resx (100%) rename {ShareX.HelpersLib/Forms => ShareX/Tools}/MonitorTestForm.pt-BR.resx (100%) rename {ShareX.HelpersLib/Forms => ShareX/Tools}/MonitorTestForm.pt-PT.resx (100%) rename {ShareX.HelpersLib/Forms => ShareX/Tools}/MonitorTestForm.resx (100%) rename {ShareX.HelpersLib/Forms => ShareX/Tools}/MonitorTestForm.ro.resx (100%) rename {ShareX.HelpersLib/Forms => ShareX/Tools}/MonitorTestForm.ru.resx (100%) rename {ShareX.HelpersLib/Forms => ShareX/Tools}/MonitorTestForm.tr.resx (100%) rename {ShareX.HelpersLib/Forms => ShareX/Tools}/MonitorTestForm.uk.resx (100%) rename {ShareX.HelpersLib/Forms => ShareX/Tools}/MonitorTestForm.vi-VN.resx (100%) rename {ShareX.HelpersLib/Forms => ShareX/Tools}/MonitorTestForm.zh-CN.resx (100%) rename {ShareX.HelpersLib/Forms => ShareX/Tools}/MonitorTestForm.zh-TW.resx (100%) rename {ShareX.HelpersLib/Forms => ShareX/Tools}/ScreenTearingTestForm.cs (99%) diff --git a/ShareX.HelpersLib/Enums.cs b/ShareX.HelpersLib/Enums.cs index a38dbdcb8..55f8a4e55 100644 --- a/ShareX.HelpersLib/Enums.cs +++ b/ShareX.HelpersLib/Enums.cs @@ -161,12 +161,6 @@ namespace ShareX.HelpersLib Suffix } - public enum ScreenTearingTestMode - { - VerticalLines, - HorizontalLines - } - public enum HotkeyStatus { Registered, diff --git a/ShareX.HelpersLib/Extensions/FormExtensions.cs b/ShareX.HelpersLib/Extensions/FormExtensions.cs index 479cc79a1..01d086c47 100644 --- a/ShareX.HelpersLib/Extensions/FormExtensions.cs +++ b/ShareX.HelpersLib/Extensions/FormExtensions.cs @@ -474,5 +474,15 @@ namespace ShareX.HelpersLib tabControl.SelectedTab = tabPage; tabControl.Enabled = true; } + + public static DialogResult ShowDialogTopMost(this Form form, Form owner) + { + if (owner != null && owner.TopMost) + { + form.TopMost = true; + } + + return form.ShowDialog(owner); + } } } \ No newline at end of file diff --git a/ShareX.HelpersLib/Forms/ColorPickerForm.cs b/ShareX.HelpersLib/Forms/ColorPickerForm.cs index 9d77a2b8e..586164f34 100644 --- a/ShareX.HelpersLib/Forms/ColorPickerForm.cs +++ b/ShareX.HelpersLib/Forms/ColorPickerForm.cs @@ -110,17 +110,12 @@ namespace ShareX.HelpersLib { using (ColorPickerForm dialog = new ColorPickerForm(currentColor, options: options)) { - if (owner != null && owner.TopMost) - { - dialog.TopMost = true; - } - if (openScreenColorPicker != null) { dialog.EnableScreenColorPickerButton(openScreenColorPicker); } - if (dialog.ShowDialog(owner) == DialogResult.OK) + if (dialog.ShowDialogTopMost(owner) == DialogResult.OK) { newColor = dialog.NewColor; return true; diff --git a/ShareX.ScreenCaptureLib/Forms/RegionCaptureForm.cs b/ShareX.ScreenCaptureLib/Forms/RegionCaptureForm.cs index a658e0ff7..9d6ffe64b 100644 --- a/ShareX.ScreenCaptureLib/Forms/RegionCaptureForm.cs +++ b/ShareX.ScreenCaptureLib/Forms/RegionCaptureForm.cs @@ -201,6 +201,9 @@ namespace ShareX.ScreenCaptureLib FormBorderStyle = FormBorderStyle.None; Bounds = ScreenBounds; ShowInTaskbar = false; +#if !DEBUG + TopMost = true; +#endif } else { diff --git a/ShareX.ScreenCaptureLib/Shapes/Drawing/StickerDrawingShape.cs b/ShareX.ScreenCaptureLib/Shapes/Drawing/StickerDrawingShape.cs index b5c9b90de..e08e6e8ad 100644 --- a/ShareX.ScreenCaptureLib/Shapes/Drawing/StickerDrawingShape.cs +++ b/ShareX.ScreenCaptureLib/Shapes/Drawing/StickerDrawingShape.cs @@ -84,7 +84,7 @@ namespace ShareX.ScreenCaptureLib { using (StickerForm stickerForm = new StickerForm(AnnotationOptions.StickerPacks, AnnotationOptions.SelectedStickerPack, AnnotationOptions.StickerSize)) { - if (stickerForm.ShowDialog(Manager.Form) == DialogResult.OK) + if (stickerForm.ShowDialogTopMost(Manager.Form) == DialogResult.OK) { AnnotationOptions.SelectedStickerPack = stickerForm.SelectedStickerPack; AnnotationOptions.StickerSize = stickerForm.StickerSize; diff --git a/ShareX.ScreenCaptureLib/Shapes/Drawing/TextDrawingShape.cs b/ShareX.ScreenCaptureLib/Shapes/Drawing/TextDrawingShape.cs index 32169f278..2e9f55a0e 100644 --- a/ShareX.ScreenCaptureLib/Shapes/Drawing/TextDrawingShape.cs +++ b/ShareX.ScreenCaptureLib/Shapes/Drawing/TextDrawingShape.cs @@ -142,7 +142,7 @@ namespace ShareX.ScreenCaptureLib using (TextDrawingInputBox inputBox = new TextDrawingInputBox(Text, TextOptions, SupportGradient, Manager.Options.ColorPickerOptions)) { - result = inputBox.ShowDialog(Manager.Form) == DialogResult.OK; + result = inputBox.ShowDialogTopMost(Manager.Form) == DialogResult.OK; Text = inputBox.InputText; OnConfigSave(); } diff --git a/ShareX/Enums.cs b/ShareX/Enums.cs index 10434367b..144c8352e 100644 --- a/ShareX/Enums.cs +++ b/ShareX/Enums.cs @@ -393,6 +393,12 @@ namespace ShareX Default, Light, Transparent } + public enum ScreenTearingTestMode + { + VerticalLines, + HorizontalLines + } + #if !MicrosoftStore public enum StartupState { diff --git a/ShareX.HelpersLib/Forms/MonitorTestForm.Designer.cs b/ShareX/Tools/MonitorTestForm.Designer.cs similarity index 98% rename from ShareX.HelpersLib/Forms/MonitorTestForm.Designer.cs rename to ShareX/Tools/MonitorTestForm.Designer.cs index f77b5ce55..c68e10df6 100644 --- a/ShareX.HelpersLib/Forms/MonitorTestForm.Designer.cs +++ b/ShareX/Tools/MonitorTestForm.Designer.cs @@ -1,4 +1,4 @@ -namespace ShareX.HelpersLib +namespace ShareX { partial class MonitorTestForm { @@ -31,8 +31,8 @@ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MonitorTestForm)); pSettings = new System.Windows.Forms.Panel(); btnScreenTearingTest = new System.Windows.Forms.Button(); - btnGradientColor2 = new ColorButton(); - btnGradientColor1 = new ColorButton(); + btnGradientColor2 = new HelpersLib.ColorButton(); + btnGradientColor1 = new HelpersLib.ColorButton(); lblTip = new System.Windows.Forms.Label(); cbGradient = new System.Windows.Forms.ComboBox(); rbGradient = new System.Windows.Forms.RadioButton(); @@ -322,8 +322,8 @@ private System.Windows.Forms.ComboBox cbGradient; private System.Windows.Forms.RadioButton rbGradient; private System.Windows.Forms.Label lblTip; - private ColorButton btnGradientColor2; - private ColorButton btnGradientColor1; + private HelpersLib.ColorButton btnGradientColor2; + private HelpersLib.ColorButton btnGradientColor1; private System.Windows.Forms.Button btnScreenTearingTest; } } \ No newline at end of file diff --git a/ShareX.HelpersLib/Forms/MonitorTestForm.ar-YE.resx b/ShareX/Tools/MonitorTestForm.ar-YE.resx similarity index 100% rename from ShareX.HelpersLib/Forms/MonitorTestForm.ar-YE.resx rename to ShareX/Tools/MonitorTestForm.ar-YE.resx diff --git a/ShareX.HelpersLib/Forms/MonitorTestForm.cs b/ShareX/Tools/MonitorTestForm.cs similarity index 99% rename from ShareX.HelpersLib/Forms/MonitorTestForm.cs rename to ShareX/Tools/MonitorTestForm.cs index f09a52be9..b699bd474 100644 --- a/ShareX.HelpersLib/Forms/MonitorTestForm.cs +++ b/ShareX/Tools/MonitorTestForm.cs @@ -23,12 +23,13 @@ #endregion License Information (GPL v3) +using ShareX.HelpersLib; using System; using System.Drawing; using System.Drawing.Drawing2D; using System.Windows.Forms; -namespace ShareX.HelpersLib +namespace ShareX { public partial class MonitorTestForm : Form { diff --git a/ShareX.HelpersLib/Forms/MonitorTestForm.de.resx b/ShareX/Tools/MonitorTestForm.de.resx similarity index 100% rename from ShareX.HelpersLib/Forms/MonitorTestForm.de.resx rename to ShareX/Tools/MonitorTestForm.de.resx diff --git a/ShareX.HelpersLib/Forms/MonitorTestForm.es-MX.resx b/ShareX/Tools/MonitorTestForm.es-MX.resx similarity index 100% rename from ShareX.HelpersLib/Forms/MonitorTestForm.es-MX.resx rename to ShareX/Tools/MonitorTestForm.es-MX.resx diff --git a/ShareX.HelpersLib/Forms/MonitorTestForm.es.resx b/ShareX/Tools/MonitorTestForm.es.resx similarity index 100% rename from ShareX.HelpersLib/Forms/MonitorTestForm.es.resx rename to ShareX/Tools/MonitorTestForm.es.resx diff --git a/ShareX.HelpersLib/Forms/MonitorTestForm.fa-IR.resx b/ShareX/Tools/MonitorTestForm.fa-IR.resx similarity index 100% rename from ShareX.HelpersLib/Forms/MonitorTestForm.fa-IR.resx rename to ShareX/Tools/MonitorTestForm.fa-IR.resx diff --git a/ShareX.HelpersLib/Forms/MonitorTestForm.fr.resx b/ShareX/Tools/MonitorTestForm.fr.resx similarity index 100% rename from ShareX.HelpersLib/Forms/MonitorTestForm.fr.resx rename to ShareX/Tools/MonitorTestForm.fr.resx diff --git a/ShareX.HelpersLib/Forms/MonitorTestForm.he-IL.resx b/ShareX/Tools/MonitorTestForm.he-IL.resx similarity index 100% rename from ShareX.HelpersLib/Forms/MonitorTestForm.he-IL.resx rename to ShareX/Tools/MonitorTestForm.he-IL.resx diff --git a/ShareX.HelpersLib/Forms/MonitorTestForm.hu.resx b/ShareX/Tools/MonitorTestForm.hu.resx similarity index 100% rename from ShareX.HelpersLib/Forms/MonitorTestForm.hu.resx rename to ShareX/Tools/MonitorTestForm.hu.resx diff --git a/ShareX.HelpersLib/Forms/MonitorTestForm.id-ID.resx b/ShareX/Tools/MonitorTestForm.id-ID.resx similarity index 100% rename from ShareX.HelpersLib/Forms/MonitorTestForm.id-ID.resx rename to ShareX/Tools/MonitorTestForm.id-ID.resx diff --git a/ShareX.HelpersLib/Forms/MonitorTestForm.it-IT.resx b/ShareX/Tools/MonitorTestForm.it-IT.resx similarity index 100% rename from ShareX.HelpersLib/Forms/MonitorTestForm.it-IT.resx rename to ShareX/Tools/MonitorTestForm.it-IT.resx diff --git a/ShareX.HelpersLib/Forms/MonitorTestForm.ja-JP.resx b/ShareX/Tools/MonitorTestForm.ja-JP.resx similarity index 100% rename from ShareX.HelpersLib/Forms/MonitorTestForm.ja-JP.resx rename to ShareX/Tools/MonitorTestForm.ja-JP.resx diff --git a/ShareX.HelpersLib/Forms/MonitorTestForm.ko-KR.resx b/ShareX/Tools/MonitorTestForm.ko-KR.resx similarity index 100% rename from ShareX.HelpersLib/Forms/MonitorTestForm.ko-KR.resx rename to ShareX/Tools/MonitorTestForm.ko-KR.resx diff --git a/ShareX.HelpersLib/Forms/MonitorTestForm.nl-NL.resx b/ShareX/Tools/MonitorTestForm.nl-NL.resx similarity index 100% rename from ShareX.HelpersLib/Forms/MonitorTestForm.nl-NL.resx rename to ShareX/Tools/MonitorTestForm.nl-NL.resx diff --git a/ShareX.HelpersLib/Forms/MonitorTestForm.pl.resx b/ShareX/Tools/MonitorTestForm.pl.resx similarity index 100% rename from ShareX.HelpersLib/Forms/MonitorTestForm.pl.resx rename to ShareX/Tools/MonitorTestForm.pl.resx diff --git a/ShareX.HelpersLib/Forms/MonitorTestForm.pt-BR.resx b/ShareX/Tools/MonitorTestForm.pt-BR.resx similarity index 100% rename from ShareX.HelpersLib/Forms/MonitorTestForm.pt-BR.resx rename to ShareX/Tools/MonitorTestForm.pt-BR.resx diff --git a/ShareX.HelpersLib/Forms/MonitorTestForm.pt-PT.resx b/ShareX/Tools/MonitorTestForm.pt-PT.resx similarity index 100% rename from ShareX.HelpersLib/Forms/MonitorTestForm.pt-PT.resx rename to ShareX/Tools/MonitorTestForm.pt-PT.resx diff --git a/ShareX.HelpersLib/Forms/MonitorTestForm.resx b/ShareX/Tools/MonitorTestForm.resx similarity index 100% rename from ShareX.HelpersLib/Forms/MonitorTestForm.resx rename to ShareX/Tools/MonitorTestForm.resx diff --git a/ShareX.HelpersLib/Forms/MonitorTestForm.ro.resx b/ShareX/Tools/MonitorTestForm.ro.resx similarity index 100% rename from ShareX.HelpersLib/Forms/MonitorTestForm.ro.resx rename to ShareX/Tools/MonitorTestForm.ro.resx diff --git a/ShareX.HelpersLib/Forms/MonitorTestForm.ru.resx b/ShareX/Tools/MonitorTestForm.ru.resx similarity index 100% rename from ShareX.HelpersLib/Forms/MonitorTestForm.ru.resx rename to ShareX/Tools/MonitorTestForm.ru.resx diff --git a/ShareX.HelpersLib/Forms/MonitorTestForm.tr.resx b/ShareX/Tools/MonitorTestForm.tr.resx similarity index 100% rename from ShareX.HelpersLib/Forms/MonitorTestForm.tr.resx rename to ShareX/Tools/MonitorTestForm.tr.resx diff --git a/ShareX.HelpersLib/Forms/MonitorTestForm.uk.resx b/ShareX/Tools/MonitorTestForm.uk.resx similarity index 100% rename from ShareX.HelpersLib/Forms/MonitorTestForm.uk.resx rename to ShareX/Tools/MonitorTestForm.uk.resx diff --git a/ShareX.HelpersLib/Forms/MonitorTestForm.vi-VN.resx b/ShareX/Tools/MonitorTestForm.vi-VN.resx similarity index 100% rename from ShareX.HelpersLib/Forms/MonitorTestForm.vi-VN.resx rename to ShareX/Tools/MonitorTestForm.vi-VN.resx diff --git a/ShareX.HelpersLib/Forms/MonitorTestForm.zh-CN.resx b/ShareX/Tools/MonitorTestForm.zh-CN.resx similarity index 100% rename from ShareX.HelpersLib/Forms/MonitorTestForm.zh-CN.resx rename to ShareX/Tools/MonitorTestForm.zh-CN.resx diff --git a/ShareX.HelpersLib/Forms/MonitorTestForm.zh-TW.resx b/ShareX/Tools/MonitorTestForm.zh-TW.resx similarity index 100% rename from ShareX.HelpersLib/Forms/MonitorTestForm.zh-TW.resx rename to ShareX/Tools/MonitorTestForm.zh-TW.resx diff --git a/ShareX/Tools/PinToScreen/PinToScreenForm.cs b/ShareX/Tools/PinToScreen/PinToScreenForm.cs index fca5e3436..a904bc8d3 100644 --- a/ShareX/Tools/PinToScreen/PinToScreenForm.cs +++ b/ShareX/Tools/PinToScreen/PinToScreenForm.cs @@ -336,12 +336,7 @@ namespace ShareX using (PinToScreenOptionsForm pinToScreenOptionsForm = new PinToScreenOptionsForm(Options)) { - if (TopMost) - { - pinToScreenOptionsForm.TopMost = true; - } - - if (pinToScreenOptionsForm.ShowDialog(this) == DialogResult.OK) + if (pinToScreenOptionsForm.ShowDialogTopMost(this) == DialogResult.OK) { if (TopMost != Options.TopMost) { diff --git a/ShareX.HelpersLib/Forms/ScreenTearingTestForm.cs b/ShareX/Tools/ScreenTearingTestForm.cs similarity index 99% rename from ShareX.HelpersLib/Forms/ScreenTearingTestForm.cs rename to ShareX/Tools/ScreenTearingTestForm.cs index 1c242c8a8..ae8746556 100644 --- a/ShareX.HelpersLib/Forms/ScreenTearingTestForm.cs +++ b/ShareX/Tools/ScreenTearingTestForm.cs @@ -23,13 +23,14 @@ #endregion License Information (GPL v3) +using ShareX.HelpersLib; using System; using System.Diagnostics; using System.Drawing; using System.Drawing.Drawing2D; using System.Windows.Forms; -namespace ShareX.HelpersLib +namespace ShareX { public class ScreenTearingTestForm : Form {