Merge pull request #1538 from ndandoulakis/ndandoulakis-CS_DBLCLKS-patch

Examples: DirectX9,10,10: Support for CS_DBLCLKS by treating double-click down messages are regular down. (#1538, #754)
This commit is contained in:
omar 2018-01-05 22:27:40 +01:00 committed by GitHub
commit 65dd55cb2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 9 deletions

View File

@ -246,13 +246,16 @@ IMGUI_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARAM wPa
switch (msg) switch (msg)
{ {
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
case WM_LBUTTONDBLCLK:
case WM_RBUTTONDOWN: case WM_RBUTTONDOWN:
case WM_RBUTTONDBLCLK:
case WM_MBUTTONDOWN: case WM_MBUTTONDOWN:
case WM_MBUTTONDBLCLK:
{ {
int button = 0; int button = 0;
if (msg == WM_LBUTTONDOWN) button = 0; if (msg == WM_LBUTTONDOWN || msg == WM_LBUTTONDBLCLK) button = 0;
if (msg == WM_RBUTTONDOWN) button = 1; if (msg == WM_RBUTTONDOWN || msg == WM_RBUTTONDBLCLK) button = 1;
if (msg == WM_MBUTTONDOWN) button = 2; if (msg == WM_MBUTTONDOWN || msg == WM_MBUTTONDBLCLK) button = 2;
if (!IsAnyMouseButtonDown() && GetCapture() == NULL) if (!IsAnyMouseButtonDown() && GetCapture() == NULL)
SetCapture(hwnd); SetCapture(hwnd);
io.MouseDown[button] = true; io.MouseDown[button] = true;

View File

@ -253,13 +253,16 @@ IMGUI_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARAM wPa
switch (msg) switch (msg)
{ {
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
case WM_LBUTTONDBLCLK:
case WM_RBUTTONDOWN: case WM_RBUTTONDOWN:
case WM_RBUTTONDBLCLK:
case WM_MBUTTONDOWN: case WM_MBUTTONDOWN:
case WM_MBUTTONDBLCLK:
{ {
int button = 0; int button = 0;
if (msg == WM_LBUTTONDOWN) button = 0; if (msg == WM_LBUTTONDOWN || msg == WM_LBUTTONDBLCLK) button = 0;
if (msg == WM_RBUTTONDOWN) button = 1; if (msg == WM_RBUTTONDOWN || msg == WM_RBUTTONDBLCLK) button = 1;
if (msg == WM_MBUTTONDOWN) button = 2; if (msg == WM_MBUTTONDOWN || msg == WM_MBUTTONDBLCLK) button = 2;
if (!IsAnyMouseButtonDown() && GetCapture() == NULL) if (!IsAnyMouseButtonDown() && GetCapture() == NULL)
SetCapture(hwnd); SetCapture(hwnd);
io.MouseDown[button] = true; io.MouseDown[button] = true;

View File

@ -192,13 +192,16 @@ IMGUI_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARAM wPa
switch (msg) switch (msg)
{ {
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
case WM_LBUTTONDBLCLK:
case WM_RBUTTONDOWN: case WM_RBUTTONDOWN:
case WM_RBUTTONDBLCLK:
case WM_MBUTTONDOWN: case WM_MBUTTONDOWN:
case WM_MBUTTONDBLCLK:
{ {
int button = 0; int button = 0;
if (msg == WM_LBUTTONDOWN) button = 0; if (msg == WM_LBUTTONDOWN || msg == WM_LBUTTONDBLCLK) button = 0;
if (msg == WM_RBUTTONDOWN) button = 1; if (msg == WM_RBUTTONDOWN || msg == WM_RBUTTONDBLCLK) button = 1;
if (msg == WM_MBUTTONDOWN) button = 2; if (msg == WM_MBUTTONDOWN || msg == WM_MBUTTONDBLCLK) button = 2;
if (!IsAnyMouseButtonDown() && GetCapture() == NULL) if (!IsAnyMouseButtonDown() && GetCapture() == NULL)
SetCapture(hwnd); SetCapture(hwnd);
io.MouseDown[button] = true; io.MouseDown[button] = true;