Browse Source

Fix abort on startup due to oversized tray icon creation when icon widget has not yet been shown

Timothy Pearson 4 years ago
parent
commit
5997a6378c
2 changed files with 9 additions and 6 deletions
  1. 2
    2
      .gitmodules
  2. 7
    4
      src/kpowersave.cpp

+ 2
- 2
.gitmodules View File

@@ -1,6 +1,6 @@
1 1
 [submodule "admin"]
2 2
 	path = admin
3
-	url = http://system@scm.trinitydesktop.org/scm/git/tde-common-admin
3
+	url = http://scm.trinitydesktop.org/scm/git/tde-common-admin
4 4
 [submodule "cmake"]
5 5
 	path = cmake
6
-	url = http://system@scm.trinitydesktop.org/scm/git/tde-common-cmake
6
+	url = http://scm.trinitydesktop.org/scm/git/tde-common-cmake

+ 7
- 4
src/kpowersave.cpp View File

@@ -361,10 +361,11 @@ void kpowersave::loadIcon(bool forceReload){
361 361
 	if ((pixmap_name_tmp != pixmap_name) || (forceReload)) {
362 362
 		pixmap_name = pixmap_name_tmp;
363 363
 		if (pixmap_name.startsWith("ERROR")) {
364
-			pixmap = SmallIcon("laptoppower", width(), TDEIcon::DisabledState);
364
+			pixmap = SmallIcon("laptoppower", isShown() ? width() : 22, TDEIcon::DisabledState);
365
+		}
366
+		else {
367
+			pixmap = SmallIcon(pixmap_name, isShown() ? width() : 22);
365 368
 		}
366
-		else
367
-			pixmap = SmallIcon(pixmap_name, width());
368 369
 	}
369 370
 
370 371
 	kdDebugFuncOut(trace);
@@ -435,7 +436,9 @@ void kpowersave::drawIcon(){
435 436
 		}
436 437
 	}
437 438
 quit:
438
-	image = image.smoothScale(width(), height());
439
+	if (isShown()) {
440
+		image = image.smoothScale(width(), height());
441
+	}
439 442
 	fullIcon.convertFromImage(image);
440 443
 	setPixmap(fullIcon);
441 444
 

Loading…
Cancel
Save