[aseprite] 255/308: Don't reset Screen Scale when the main window cannot be created

Tobias Hansen thansen at moszumanska.debian.org
Tue Mar 8 02:45:17 UTC 2016


This is an automated email from the git hooks/post-receive script.

thansen pushed a commit to branch master
in repository aseprite.

commit 30672ba14427c50a3bbaa297bf9ee080e6ac209b
Author: David Capello <davidcapello at gmail.com>
Date:   Tue Feb 23 18:08:25 2016 -0300

    Don't reset Screen Scale when the main window cannot be created
    
    Should fix #860
---
 data/pref.xml           |  2 +-
 src/app/modules/gui.cpp | 33 +++++++++++++++++----------------
 2 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/data/pref.xml b/data/pref.xml
index db859fa..0dd1c81 100644
--- a/data/pref.xml
+++ b/data/pref.xml
@@ -67,7 +67,7 @@
 
   <global>
     <section id="general">
-      <option id="screen_scale" type="int" default="2" />
+      <option id="screen_scale" type="int" default="0" />
       <option id="gpu_acceleration" type="bool" default="false" />
       <option id="visible_timeline" type="bool" default="false" />
       <option id="autoshow_timeline" type="bool" default="true" migrate="Options.AutoShowTimeline" />
diff --git a/src/app/modules/gui.cpp b/src/app/modules/gui.cpp
index a472d7a..e80cbca 100644
--- a/src/app/modules/gui.cpp
+++ b/src/app/modules/gui.cpp
@@ -94,27 +94,25 @@ static void load_gui_config(int& w, int& h, bool& maximized,
                             std::string& windowLayout);
 static void save_gui_config();
 
-static int get_screen_scale()
-{
-  int scale = Preferences::instance().general.screenScale();
-  scale = MID(1, scale, 4);
-  return scale;
-}
-
 static bool create_main_display(bool gpuAccel,
                                 bool& maximized,
                                 std::string& lastError)
 {
   int w, h;
-  int scale = get_screen_scale();
   std::string windowLayout;
   load_gui_config(w, h, maximized, windowLayout);
 
+  // Scale is equal to 0 when it's the first time the program is
+  // executed.
+  int scale = Preferences::instance().general.screenScale();
+
   she::instance()->setGpuAcceleration(gpuAccel);
 
   try {
-    if (w > 0 && h > 0)
-      main_display = she::instance()->createDisplay(w, h, scale);
+    if (w > 0 && h > 0) {
+      main_display = she::instance()->createDisplay(
+        w, h, (scale == 0 ? 2: MID(1, scale, 4)));
+    }
   }
   catch (const she::DisplayCreationException& e) {
     lastError = e.what();
@@ -124,12 +122,10 @@ static bool create_main_display(bool gpuAccel,
     for (int c=0; try_resolutions[c].width; ++c) {
       try {
         main_display =
-          she::instance()->createDisplay(try_resolutions[c].width,
-                                         try_resolutions[c].height,
-                                         try_resolutions[c].scale);
-
-        scale = try_resolutions[c].scale;
-        Preferences::instance().general.screenScale(scale);
+          she::instance()->createDisplay(
+            try_resolutions[c].width,
+            try_resolutions[c].height,
+            (scale == 0 ? try_resolutions[c].scale: scale));
         break;
       }
       catch (const she::DisplayCreationException& e) {
@@ -139,6 +135,11 @@ static bool create_main_display(bool gpuAccel,
   }
 
   if (main_display && !windowLayout.empty()) {
+    // Change the scale value only in the first run (this will be
+    // saved when the program is closed).
+    if (scale == 0)
+      Preferences::instance().general.screenScale(main_display->scale());
+
     main_display->setLayout(windowLayout);
     if (main_display->isMinimized())
       main_display->maximize();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git



More information about the Pkg-games-commits mailing list