diff --git a/App.xaml.cs b/App.xaml.cs index 98c18a2..8db8379 100644 --- a/App.xaml.cs +++ b/App.xaml.cs @@ -21,6 +21,8 @@ public partial class App : Application protected override void OnStartup(StartupEventArgs e) { Languages.Apply(); + // Software or graphics card: has to be set before anything is drawn. + Rendering.Apply(); // Before any window or dialog exists, so everything is drawn in the chosen theme. Theme.Apply(Resources); diff --git a/CHANGELOG.md b/CHANGELOG.md index d4f673c..b3ae8a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ +## v2.5.1 +- إصلاح: عناصر القائمة كانت تختفي تحت الماوس والأزرار تطلع مخططة على بعض كروت الشاشة وتطبيقات التحكم عن بعد +- البرنامج صار يرسم برمجياً افتراضياً، وتقدر ترجع لكرت الشاشة من صفحة «حول» + ## v2.5.0 - صفحة «الجوال» جديدة: مواصفات الجوال وحمايته وهو شغّال على أندرويد - تتعرف على إضافة Fastboot Studio Companion: حالة AVB من البوت لودر وتعارض المودات diff --git a/FastbootEnhance.csproj b/FastbootEnhance.csproj index a1429fe..58f53d1 100644 --- a/FastbootEnhance.csproj +++ b/FastbootEnhance.csproj @@ -15,7 +15,7 @@ - 2.5.0 + 2.5.1 Fastboot Studio Fastboot Studio IFOKNR; LibXZR diff --git a/MainWindow.xaml b/MainWindow.xaml index a617cfd..097f150 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -1465,7 +1465,7 @@ - + @@ -1506,6 +1506,10 @@ + + + diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index 1a38231..f0a052f 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -11,7 +11,7 @@ namespace FastbootEnhance public partial class MainWindow : Window { public static MainWindow THIS; - const string version = "2.5.0"; + const string version = "2.5.1"; public MainWindow() { @@ -53,6 +53,7 @@ public MainWindow() wireLogs(); wireLanguages(); wireThemes(); + wireRendering(); RootUI.init(); PhoneUI.init(); TerminalUI.init(); @@ -152,6 +153,40 @@ void wireThemes() } } + /// Software or graphics card drawing: the one in use is highlighted. Applies on restart. + void wireRendering() + { + Rendering.Mode[] modes = { Rendering.Mode.Software, Rendering.Mode.Gpu }; + string[] names = { Properties.Resources.rendering_software, Properties.Resources.rendering_gpu }; + for (int i = 0; i < modes.Length; i++) + { + Rendering.Mode mode = modes[i]; + System.Windows.Controls.Button button = new System.Windows.Controls.Button + { + Content = names[i], + Tag = mode.ToString().ToLowerInvariant(), + Padding = new Thickness(14, 5, 14, 5), + Margin = new Thickness(0, 0, 8, 8), + Style = (Style)FindResource(mode == Rendering.Chosen ? "AccentButton" : "GhostButton"), + }; + button.Click += delegate + { + if (mode == Rendering.Chosen) + return; + if (FastbootUI.flashing || PayloadUI.extracting) + { + ThemedDialog.Show(Properties.Resources.theme_busy); + return; + } + Rendering.Save(mode); + if (ThemedDialog.Show(Properties.Resources.rendering_restart, Properties.Resources.rendering, + MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes) == MessageBoxResult.Yes) + App.Restart(); + }; + rendering_buttons.Children.Add(button); + } + } + static bool looksLikePayload(string path) { try diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs index 5ff1dde..7359a19 100644 --- a/Properties/Resources.Designer.cs +++ b/Properties/Resources.Designer.cs @@ -6070,5 +6070,50 @@ public static string phone_reboot_failed { return ResourceManager.GetString("phone_reboot_failed", resourceCulture); } } + + /// + /// Looks up a localized string similar to Drawing. + /// + public static string rendering { + get { + return ResourceManager.GetString("rendering", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Software (steady). + /// + public static string rendering_software { + get { + return ResourceManager.GetString("rendering_software", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Graphics card. + /// + public static string rendering_gpu { + get { + return ResourceManager.GetString("rendering_gpu", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Software drawing stops the flicker, vanishing menu items and striped buttons that some graphics drivers and remote-desktop apps cause.. + /// + public static string rendering_note { + get { + return ResourceManager.GetString("rendering_note", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The new drawing mode applies after a restart. Restart Fastboot Studio now?. + /// + public static string rendering_restart { + get { + return ResourceManager.GetString("rendering_restart", resourceCulture); + } + } } } diff --git a/Properties/Resources.ar.resx b/Properties/Resources.ar.resx index f0db04b..f4ceaf9 100644 --- a/Properties/Resources.ar.resx +++ b/Properties/Resources.ar.resx @@ -2185,4 +2185,19 @@ adb shell يحتاج أمر بعده، مثل adb shell getprop. وزر إيقا الجوال ما أعاد التشغيل: {0} + + طريقة الرسم + + + برمجي (ثابت) + + + كرت الشاشة + + + الرسم البرمجي يمنع الوميض واختفاء عناصر القائمة والأزرار المخططة اللي تسببها بعض تعريفات كرت الشاشة وتطبيقات التحكم عن بعد. + + + طريقة الرسم الجديدة تشتغل بعد إعادة التشغيل. تعيد تشغيل البرنامج الحين؟ + diff --git a/Properties/Resources.resx b/Properties/Resources.resx index 31f0b4e..2b85c3d 100644 --- a/Properties/Resources.resx +++ b/Properties/Resources.resx @@ -2185,4 +2185,19 @@ The bootloader must be unlocked. If the phone does not start afterwards, flash t The phone did not restart: {0} + + Drawing + + + Software (steady) + + + Graphics card + + + Software drawing stops the flicker, vanishing menu items and striped buttons that some graphics drivers and remote-desktop apps cause. + + + The new drawing mode applies after a restart. Restart Fastboot Studio now? + \ No newline at end of file diff --git a/Rendering.cs b/Rendering.cs new file mode 100644 index 0000000..754d1ff --- /dev/null +++ b/Rendering.cs @@ -0,0 +1,46 @@ +using System; +using System.Windows.Interop; +using System.Windows.Media; + +namespace FastbootEnhance +{ + /// + /// How WPF draws the app. With the graphics card, some drivers and remote-desktop apps leave + /// parts of the window undrawn: menu items vanish under the mouse and buttons turn into + /// stripes. Drawing in software avoids that and is plenty fast for this app, so it is the + /// default; the graphics card can be chosen on the About page. Applies on restart. + /// + static class Rendering + { + public enum Mode + { + Software, + Gpu, + } + + /// For automated runs and troubleshooting: overrides the saved choice without touching it. + const string OverrideVariable = "FASTBOOT_STUDIO_RENDERING"; + + public static Mode Chosen { get; private set; } = Mode.Software; + + public static Mode Parse(string raw) + { + return (raw ?? "").Trim().ToLowerInvariant() == "gpu" ? Mode.Gpu : Mode.Software; + } + + /// Called once, before the first window or dialog. + public static void Apply() + { + string raw = Environment.GetEnvironmentVariable(OverrideVariable); + if (string.IsNullOrWhiteSpace(raw)) + raw = Settings.Get("rendering"); + Chosen = Parse(raw); + RenderOptions.ProcessRenderMode = Chosen == Mode.Software ? RenderMode.SoftwareOnly : RenderMode.Default; + } + + public static bool Save(Mode mode) + { + return Settings.Set("rendering", mode == Mode.Gpu ? "gpu" : "software"); + } + } +} diff --git a/Themes/Styles.xaml b/Themes/Styles.xaml index c01af82..485c602 100644 --- a/Themes/Styles.xaml +++ b/Themes/Styles.xaml @@ -540,7 +540,7 @@ RenderOptions.BitmapScalingMode="HighQuality"/> - +