[Scummvm-git-logs] scummvm master -> bdbbcd81ae6da794833c8ea84b0fba69c5cb0e7e
criezy
criezy at scummvm.org
Sat Sep 12 17:01:44 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
bdbbcd81ae OSX: Fix taskbar update
Commit: bdbbcd81ae6da794833c8ea84b0fba69c5cb0e7e
https://github.com/scummvm/scummvm/commit/bdbbcd81ae6da794833c8ea84b0fba69c5cb0e7e
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2020-09-12T18:01:15+01:00
Commit Message:
OSX: Fix taskbar update
This was broken sometimes between release 1.8.1 and 1.9.0. I did not
track the change that broke it, but it looks like the code was trying
to get the DockTile object too early causing it to be nil.
Changed paths:
NEWS.md
backends/taskbar/macosx/macosx-taskbar.mm
diff --git a/NEWS.md b/NEWS.md
index 260493f16c..601741f0e8 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -143,6 +143,8 @@ For a more comprehensive changelog of the latest experimental code, see:
MacOS X port:
- Fixed blurry on Retina screens. Unfortunately this required dropping support
for the dark theme for window decorations.
+ - Fixed Taskbar icon display when running a game (this was broken since ScummVM
+ 1.9.0).
#### 2.1.2 "Fixing Powerful Windows" (2020-03-31)
diff --git a/backends/taskbar/macosx/macosx-taskbar.mm b/backends/taskbar/macosx/macosx-taskbar.mm
index 4600ea7df5..36ed30ac78 100644
--- a/backends/taskbar/macosx/macosx-taskbar.mm
+++ b/backends/taskbar/macosx/macosx-taskbar.mm
@@ -52,15 +52,24 @@ NSDockTilePtr _dockTile;
NSImageView *_applicationIconView;
NSImageView *_overlayIconView;
+BOOL hasDockTile() {
+ if (_dockTile != nil)
+ return YES;
+ if ([NSApp respondsToSelector:@selector(dockTile)])
+ _dockTile = [NSApp dockTile];
+ return _dockTile != nil;
+}
+
// Using a NSProgressIndicator as a sub-view of the NSDockTile view does not work properly.
// The progress indicator is grayed out and display no progress. So instead the bar is drawn
// manually, which is a bit more work :(
MacOSXTaskbarManager::MacOSXTaskbarManager() : _progress(-1.0) {
- if ([NSApp respondsToSelector:@selector(dockTile)])
- _dockTile = [NSApp dockTile];
+ _dockTile = nil;
_applicationIconView = nil;
_overlayIconView = nil;
+
+
}
MacOSXTaskbarManager::~MacOSXTaskbarManager() {
@@ -68,7 +77,7 @@ MacOSXTaskbarManager::~MacOSXTaskbarManager() {
}
void MacOSXTaskbarManager::initApplicationIconView() {
- if (_dockTile == nil)
+ if (!hasDockTile())
return;
if (_applicationIconView == nil) {
_applicationIconView = [[NSImageView alloc] init];
@@ -78,7 +87,7 @@ void MacOSXTaskbarManager::initApplicationIconView() {
}
void MacOSXTaskbarManager::clearApplicationIconView() {
- if (_dockTile == nil)
+ if (!hasDockTile())
return;
[_dockTile performSelector:@selector(setContentView:) withObject:nil];
[_applicationIconView release];
@@ -86,7 +95,7 @@ void MacOSXTaskbarManager::clearApplicationIconView() {
}
void MacOSXTaskbarManager::initOverlayIconView() {
- if (_dockTile == nil)
+ if (!hasDockTile())
return;
if (_overlayIconView == nil) {
const double overlaySize = 0.75;
@@ -108,7 +117,7 @@ void MacOSXTaskbarManager::clearOverlayIconView() {
}
void MacOSXTaskbarManager::setOverlayIcon(const Common::String &name, const Common::String &description) {
- if (_dockTile == nil)
+ if (!hasDockTile())
return;
if (name.empty()) {
@@ -133,7 +142,7 @@ void MacOSXTaskbarManager::setOverlayIcon(const Common::String &name, const Comm
}
void MacOSXTaskbarManager::setProgressValue(int completed, int total) {
- if (_dockTile == nil)
+ if (!hasDockTile())
return;
if (total > 0)
@@ -159,7 +168,7 @@ void MacOSXTaskbarManager::setProgressValue(int completed, int total) {
}
void MacOSXTaskbarManager::setProgressState(TaskbarProgressState state) {
- if (_dockTile == nil)
+ if (!hasDockTile())
return;
// Only support two states: visible and not visible.
@@ -176,7 +185,7 @@ void MacOSXTaskbarManager::setProgressState(TaskbarProgressState state) {
}
void MacOSXTaskbarManager::setCount(int count) {
- if (_dockTile == nil)
+ if (!hasDockTile())
return;
if (count > 0)
@@ -186,7 +195,7 @@ void MacOSXTaskbarManager::setCount(int count) {
}
void MacOSXTaskbarManager::notifyError() {
- if (_dockTile == nil)
+ if (!hasDockTile())
return;
// NSImageNameCaution was introduced in 10.6.
@@ -198,7 +207,7 @@ void MacOSXTaskbarManager::notifyError() {
}
void MacOSXTaskbarManager::clearError() {
- if (_dockTile == nil)
+ if (!hasDockTile())
return;
clearOverlayIconView();
@@ -209,7 +218,7 @@ void MacOSXTaskbarManager::clearError() {
void MacOSXTaskbarManager::addRecent(const Common::String &name, const Common::String &description) {
//warning("[MacOSXTaskbarManager::addRecent] Adding recent list entry: %s (%s)", name.c_str(), description.c_str());
- if (_dockTile == nil)
+ if (!hasDockTile())
return;
// Store the game, description and icon in user preferences.
More information about the Scummvm-git-logs
mailing list