Anonymous Login
2018-01-16 08:39 CET

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0001693OpenClonkEngine - GUIpublic2018-01-15 00:29
ReporterZapper 
Assigned ToCaesar 
PrioritynormalSeverityminorReproducibilityN/A
StatusresolvedResolutionfixed 
Product Version7.0 
Target Version8.0Fixed in Version 
Summary0001693: Player Controls dialogue does not support certain assignments
DescriptionI have been told that it is impossible to assign

* modifier key combinations (such as Ctrl/Shift/Alt + [Key])
* mouse wheel events
* mouse buttons

to controls. Both are used in the default player control assignment and thus it is quite weird that you cannot set them yourself.
TagsNo tags attached.
Attached Files
  • patch file icon 0001-Fail1.patch (3,238 bytes) 2018-01-11 23:55 -
    From 569ca6964218cfed785e72db43027e264f532252 Mon Sep 17 00:00:00 2001
    From: Julius Michaelis <gitter@liftm.de>
    Date: Thu, 11 Jan 2018 23:51:29 +0100
    Subject: [PATCH] Fail1
    
    ---
     src/gui/C4StartupOptionsDlg.cpp | 36 ++++++++++++++++++++++++++++++++++++
     src/gui/C4StartupOptionsDlg.h   |  1 +
     2 files changed, 37 insertions(+)
    
    diff --git a/src/gui/C4StartupOptionsDlg.cpp b/src/gui/C4StartupOptionsDlg.cpp
    index bcbbbd885..c75e44308 100644
    --- a/src/gui/C4StartupOptionsDlg.cpp
    +++ b/src/gui/C4StartupOptionsDlg.cpp
    @@ -23,6 +23,7 @@
     #include "graphics/C4Draw.h"
     #include "graphics/C4GraphicsResource.h"
     #include "gui/C4MouseControl.h"
    +#include "gui/C4KeyboardInput.h"
     #include "gui/C4StartupMainDlg.h"
     #include "network/C4Network2.h"
     #include "platform/C4GamePadCon.h"
    @@ -183,6 +184,41 @@ C4StartupOptionsDlg::KeySelDialog::~KeySelDialog()
     	delete pKeyListener;
     }
     
    +void C4StartupOptionsDlg::KeySelDialog::MouseInput(C4GUI::CMouse& rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam)
    +{
    +	C4GUI::MessageDialog::MouseInput(rMouse, iButton, iX, iY, dwKeyParam);
    +	if (IsFading() || !fShow) return;
    +	// Logic duplication of C4PlayerControl::DoMouseInput (and C4MouseControl::Move for the wheel_dir.) There has to be a better way. :(
    +	uint8_t mouseevent_code;
    +	int wheel_dir = 0;
    +	if (iButton == C4MC_Button_Wheel) wheel_dir = (short)(dwKeyParam >> 16);
    +	switch (iButton)
    +	{
    +	case C4MC_Button_LeftUp:
    +	case C4MC_Button_RightUp:
    +	case C4MC_Button_MiddleUp:
    +	case C4MC_Button_X1Up:
    +	case C4MC_Button_X2Up:
    +	case C4MC_Button_None:
    +		return;
    +	case C4MC_Button_LeftDown: mouseevent_code = KEY_MOUSE_ButtonLeft; break;
    +	case C4MC_Button_LeftDouble: mouseevent_code = KEY_MOUSE_ButtonLeftDouble; break;
    +	case C4MC_Button_RightDown: mouseevent_code = KEY_MOUSE_ButtonRight; break;
    +	case C4MC_Button_RightDouble: mouseevent_code = KEY_MOUSE_ButtonRightDouble; break;
    +	case C4MC_Button_MiddleDown: mouseevent_code = KEY_MOUSE_ButtonMiddle; break;
    +	case C4MC_Button_MiddleDouble: mouseevent_code = KEY_MOUSE_ButtonMiddleDouble; break;
    +	case C4MC_Button_X1Down: mouseevent_code = KEY_MOUSE_ButtonX1; break;
    +	case C4MC_Button_X1Double: mouseevent_code = KEY_MOUSE_ButtonX1Double; break;
    +	case C4MC_Button_X2Down: mouseevent_code = KEY_MOUSE_ButtonX2; break;
    +	case C4MC_Button_X2Double: mouseevent_code = KEY_MOUSE_ButtonX2Double; break;
    +	case C4MC_Button_Wheel:
    +		if (!wheel_dir) return;
    +		mouseevent_code = (wheel_dir > 0) ? KEY_MOUSE_Wheel1Up : KEY_MOUSE_Wheel1Down; break;
    +	}
    +	auto key = C4KeyCodeEx(KEY_Mouse(0, mouseevent_code));
    +	KeyDown(key);
    +}
    +
     bool C4StartupOptionsDlg::KeySelDialog::KeyDown(const C4KeyCodeEx &key)
     {
     	// safety
    diff --git a/src/gui/C4StartupOptionsDlg.h b/src/gui/C4StartupOptionsDlg.h
    index 689be61db..9febab990 100644
    --- a/src/gui/C4StartupOptionsDlg.h
    +++ b/src/gui/C4StartupOptionsDlg.h
    @@ -166,6 +166,7 @@ private:
     
     	protected:
     		bool KeyDown(const C4KeyCodeEx &key);
    +		void MouseInput(C4GUI::CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam) override;
     	public:
     		KeySelDialog(const class C4PlayerControlAssignment *assignment, const class C4PlayerControlAssignmentSet *assignment_set);
     		~KeySelDialog() override;
    -- 
    2.15.1
    
    
    patch file icon 0001-Fail1.patch (3,238 bytes) 2018-01-11 23:55 +

-Relationships
related to 0001692resolvedCaesar Mouse buttons controlls cannot be changed?! (but should be?) 
related to 0001684acknowledged Additional mouse buttons should be usable 
+Relationships

-Notes

~0006033

Caesar (developer)

Last edited: 2018-01-11 20:23

View 2 revisions

I'm not sure. Was this originally intended to work and broke at some point, or was it forgotten in the beginning.

If it was forgotten, I guess C4StartupOptionsDlg::KeySelDialog needs to overload void MouseInput(CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam). But Maybe I missed something, and the DlgKeyCBPassKey is supposed to receive the clicks and pass them on.

@Sven2 do you maybe remember something related?

~0006038

Caesar (developer)

No, overloading MouseInput in that class does not seem to be a good idea. Attached patch makes it impossible to use the Reset or Cancel button.

~0006065

occ (reporter)

Hi! There's been a check-in that references this bug. For more information you can visit the repository browser at this address:
https://git.openclonk.org/openclonk.git/commitdiff/b115641685a1d4aa8f829b2baabf5eb3bf03c46d

Changeset b115641 by Julius Michaelis <gitter@liftm.de>
Allow using mouse keys and key combinations from the control assignment configuration dialogue (0001693, 0001692)

+Notes

-Issue History
Date Modified Username Field Change
2016-02-27 18:51 Zapper New Issue
2016-02-27 18:52 Zapper Description Updated View Revisions
2016-02-27 18:52 Zapper Relationship added related to 0001692
2016-02-28 16:21 Zapper Relationship added related to 0001684
2018-01-11 20:22 Caesar Note Added: 0006033
2018-01-11 20:23 Caesar Note Edited: 0006033 View Revisions
2018-01-11 23:55 Caesar File Added: 0001-Fail1.patch
2018-01-11 23:55 Caesar Note Added: 0006038
2018-01-15 00:28 occ Note Added: 0006065
2018-01-15 00:29 Caesar Assigned To => Caesar
2018-01-15 00:29 Caesar Status new => resolved
2018-01-15 00:29 Caesar Resolution open => fixed
+Issue History