linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #04046
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2513: Fix taskbar thumbnails and "Aero Peek" live previews when DC++ is elevated
------------------------------------------------------------
revno: 2513
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Mon 2011-04-25 22:41:09 +0200
message:
Fix taskbar thumbnails and "Aero Peek" live previews when DC++ is elevated
modified:
changelog.txt
dwt/src/Taskbar.cpp
--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk
Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'changelog.txt'
--- changelog.txt 2011-04-23 10:33:55 +0000
+++ changelog.txt 2011-04-25 20:41:09 +0000
@@ -25,6 +25,7 @@
* Increase the max bandwidth limit from 32 MiB/s to 1 GiB/s
* More icons (many from the Crystal Clear project, thanks to them)
* Add notifications via balloon popups and sound (poy)
+* Fix taskbar thumbnails and "Aero Peek" live previews when DC++ is elevated (poy)
-- 0.782 2011-03-05 --
* Prevent a remote crash triggered via malformed user commands (poy)
=== modified file 'dwt/src/Taskbar.cpp'
--- dwt/src/Taskbar.cpp 2011-04-23 13:14:05 +0000
+++ dwt/src/Taskbar.cpp 2011-04-25 20:41:09 +0000
@@ -52,6 +52,9 @@
typedef HRESULT (WINAPI *t_DwmSetWindowAttribute)(HWND, DWORD, LPCVOID, DWORD);
static t_DwmSetWindowAttribute DwmSetWindowAttribute = 0;
+typedef BOOL (WINAPI *t_ChangeWindowMessageFilterEx)(HWND, UINT, DWORD, void*);
+static t_ChangeWindowMessageFilterEx ChangeWindowMessageFilterEx = 0;
+
Taskbar::Taskbar() :
taskbar(0),
window(0)
@@ -77,6 +80,13 @@
get(DwmSetWindowAttribute);
#undef get
+ if(!ChangeWindowMessageFilterEx) {
+ LibraryLoader lib_user32(_T("user32"));
+ ChangeWindowMessageFilterEx = reinterpret_cast<t_ChangeWindowMessageFilterEx>(
+ lib_user32.getProcAddress(_T("ChangeWindowMessageFilterEx")));
+ // ignore failures, this isn't a vital call to have.
+ }
+
window = window_;
dwtassert(window, _T("Taskbar: no widget set"));
@@ -94,21 +104,9 @@
#endif
if(::CoCreateInstance(CLSID_TaskbarList, 0, CLSCTX_INPROC_SERVER, IID_ITaskbarList,
reinterpret_cast<LPVOID*>(&taskbar)) != S_OK) { taskbar = 0; }
- if(taskbar) {
- if(taskbar->HrInit() == S_OK) {
- /* call ChangeWindowMessageFilterEx on the 2 messages we use to dispatch bitmaps to
- the destktop manager to prevent blockings because of different privilege levels. */
- LibraryLoader lib_user32(_T("user32"));
- if(auto ChangeWindowMessageFilterEx = reinterpret_cast<BOOL (WINAPI *)(HWND, UINT, DWORD, void*)>(
- lib_user32.getProcAddress(_T("ChangeWindowMessageFilterEx"))))
- {
- ChangeWindowMessageFilterEx(window->handle(), WM_DWMSENDICONICTHUMBNAIL, 1/*MSGFLT_ALLOW*/, 0);
- ChangeWindowMessageFilterEx(window->handle(), WM_DWMSENDICONICLIVEPREVIEWBITMAP, 1/*MSGFLT_ALLOW*/, 0);
- }
- } else {
+ if(taskbar && taskbar->HrInit() != S_OK) {
taskbar->Release();
taskbar = 0;
- }
}
}
}
@@ -120,6 +118,7 @@
public:
typedef Proxy ThisType;
typedef ThisType* ObjectType;
+
struct Seed : BaseType::Seed {
typedef ThisType WidgetType;
Seed(const tstring& caption) : BaseType::Seed(caption, 0, 0) {
@@ -128,6 +127,7 @@
location = Rectangle();
}
};
+
Proxy(Widget* parent) : BaseType(parent, NormalDispatcher::getDefault()) { }
};
@@ -141,6 +141,13 @@
auto proxy = window->addChild(Proxy::Seed(tab->getText()));
tabs[tab] = proxy;
+ /* call ChangeWindowMessageFilterEx on the 2 messages we use to dispatch bitmaps to the
+ destktop manager to prevent blockings because of different privilege levels. */
+ if(ChangeWindowMessageFilterEx) {
+ ChangeWindowMessageFilterEx(proxy->handle(), WM_DWMSENDICONICTHUMBNAIL, 1/*MSGFLT_ALLOW*/, 0);
+ ChangeWindowMessageFilterEx(proxy->handle(), WM_DWMSENDICONICLIVEPREVIEWBITMAP, 1/*MSGFLT_ALLOW*/, 0);
+ }
+
// keep the proxy window in sync with the actual tab window.
tab->onTextChanging([proxy](const tstring& text) { proxy->setText(text); });
tab->onSized([proxy](const SizedEvent&) { DwmInvalidateIconicBitmaps(proxy->handle()); });