aboutsummaryrefslogtreecommitdiff
path: root/platform/windows/os_windows.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/windows/os_windows.cpp')
-rw-r--r--platform/windows/os_windows.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 99b689091..42597f79c 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -509,10 +509,13 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (!motion)
return 0;
- if (motion < 0)
+ if (motion < 0) {
mb.button_index = BUTTON_WHEEL_LEFT;
- else
+ mb.factor = fabs((double)motion / (double)WHEEL_DELTA);
+ } else {
mb.button_index = BUTTON_WHEEL_RIGHT;
+ mb.factor = fabs((double)motion / (double)WHEEL_DELTA);
+ }
} break;
/*
case WM_XBUTTONDOWN: {
@@ -1993,13 +1996,14 @@ String OS_Windows::get_executable_path() const {
return s;
}
-void OS_Windows::set_icon(const Image &p_icon) {
+void OS_Windows::set_icon(const Ref<Image> &p_icon) {
- Image icon = p_icon;
- if (icon.get_format() != Image::FORMAT_RGBA8)
- icon.convert(Image::FORMAT_RGBA8);
- int w = icon.get_width();
- int h = icon.get_height();
+ ERR_FAIL_COND(!p_icon.is_valid());
+ Ref<Image> icon = p_icon->duplicate();
+ if (icon->get_format() != Image::FORMAT_RGBA8)
+ icon->convert(Image::FORMAT_RGBA8);
+ int w = icon->get_width();
+ int h = icon->get_height();
/* Create temporary bitmap buffer */
int icon_len = 40 + h * w * 4;
@@ -2020,7 +2024,7 @@ void OS_Windows::set_icon(const Image &p_icon) {
encode_uint32(0, &icon_bmp[36]);
uint8_t *wr = &icon_bmp[40];
- PoolVector<uint8_t>::Read r = icon.get_data().read();
+ PoolVector<uint8_t>::Read r = icon->get_data().read();
for (int i = 0; i < h; i++) {