Fix cross build for windows.

This commit is contained in:
Jonas Kvinge
2018-04-02 18:35:58 +02:00
parent 1817127a90
commit 6bbc1271e4
16 changed files with 72 additions and 72 deletions

View File

@@ -28,13 +28,15 @@
#include "core/logging.h"
#ifdef Q_OS_WIN32
# define _WIN32_WINNT 0x0600
# include <windows.h>
# include <commctrl.h>
# include <shobjidl.h>
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0600
#endif
#include <windows.h>
#include <commctrl.h>
#include <shobjidl.h>
extern HICON qt_pixmapToWinHICON(const QPixmap &p);
#endif // Q_OS_WIN32
const int Windows7ThumbBar::kIconSize = 16;
const int Windows7ThumbBar::kMaxButtonCount = 7;
@@ -66,7 +68,7 @@ void Windows7ThumbBar::SetActions(const QList<QAction*>& actions) {
static void SetupButton(const QAction *action, THUMBBUTTON *button) {
if (action) {
button->hIcon = action->icon().pixmap(Windows7ThumbBar::kIconSize).toWinHICON();
button->hIcon = qt_pixmapToWinHICON(action->icon().pixmap(Windows7ThumbBar::kIconSize));
button->dwFlags = action->isEnabled() ? THBF_ENABLED : THBF_DISABLED;
// This is unsafe - doesn't obey 260-char restriction
action->text().toWCharArray(button->szTip);
@@ -108,8 +110,7 @@ void Windows7ThumbBar::HandleWinEvent(MSG *msg) {
// Copied from win7 SDK shobjidl.h
static const GUID CLSID_ITaskbarList ={ 0x56FDF344,0xFD6D,0x11d0,{0x95,0x8A,0x00,0x60,0x97,0xC9,0xA0,0x90}};
// Create the taskbar list
hr = CoCreateInstance(CLSID_ITaskbarList, nullptr, CLSCTX_ALL,
IID_ITaskbarList3, (void**)&taskbar_list_);
hr = CoCreateInstance(CLSID_ITaskbarList, nullptr, CLSCTX_ALL, IID_ITaskbarList3, (void**)&taskbar_list_);
if (hr != S_OK) {
qLog(Warning) << "Error creating the ITaskbarList3 interface" << hex << DWORD (hr);
return;
@@ -135,7 +136,7 @@ void Windows7ThumbBar::HandleWinEvent(MSG *msg) {
}
qLog(Debug) << "Adding buttons";
hr = taskbar_list->ThumbBarAddButtons(widget_->winId(), actions_.count(), buttons);
hr = taskbar_list->ThumbBarAddButtons((HWND)widget_->winId(), actions_.count(), buttons);
if (hr != S_OK)
qLog(Debug) << "Failed to add buttons" << hex << DWORD (hr);
for (int i = 0; i < actions_.count(); i++) {
@@ -172,7 +173,7 @@ void Windows7ThumbBar::ActionChanged() {
if (buttons->hIcon > 0) DestroyIcon(buttons->hIcon);
}
taskbar_list->ThumbBarUpdateButtons(widget_->winId(), actions_.count(), buttons);
taskbar_list->ThumbBarUpdateButtons((HWND)widget_->winId(), actions_.count(), buttons);
#endif // Q_OS_WIN32
}