Jump to content
Eternal Lands Official Forums
Quesar

middle click uses items - includes patch to fix

Recommended Posts

Hi all,

 

I've had a problem on Linux that middle clicking to rotate the camera can use an item if you misclick in the inv window. I asked on channel 6 and windows users don't seem to have the problem.

 

I've made this patch to make using items in both the inv window and the quickbar require using the left button only instead of allowing left or middle.

 

http://www.reptileroom.net/elstuff/item-use-left-click-only.diff

 

Hopefully this can be accepted.

 

Thanks,

Q

Share this post


Link to post
Share on other sites

That change still allows the items to be picked up etc. How about completely blocking middle mouse presses in those two functions?

diff --git a/hud.c b/hud.c
index 6e3c873..eb26533 100644
--- a/hud.c
+++ b/hud.c
@@ -1917,8 +1917,8 @@ int	   click_quickbar_handler(window_info *win, int mx, int my, Uint32 flags)
	int ctrl_on = flags & ELW_CTRL;
	int shift_on = flags & ELW_SHIFT;

-	   // only handle mouse button clicks, not scroll wheels moves
-	   if ( (flags & ELW_MOUSE_BUTTON) == 0) return 0;
+	   // only handle mouse button clicks, not scroll wheels moves or clicks
+	   if (( (flags & ELW_MOUSE_BUTTON) == 0) || ( (flags & ELW_MID_MOUSE) != 0)) return 0;

	if(right_click) {
			switch(qb_action_mode) {
diff --git a/items.c b/items.c
index 3dc20a4..7d8dc2b 100644
--- a/items.c
+++ b/items.c
@@ -810,6 +810,9 @@ int click_items_handler(window_info *win, int mx, int my, Uint32 flags)
	// only handle mouse button clicks, not scroll wheels moves (unless its the mix button)
	if (((flags & ELW_MOUSE_BUTTON) == 0) && (over_button(win, mx, my) != BUT_MIX)) return 0;

+	   // ignore middle mouse button presses
+	   if ((flags & ELW_MID_MOUSE) != 0) return 0;
+
	if (!right_click && over_button(win, mx, my) != -1)
			do_click_sound();

Edited by bluap

Share this post


Link to post
Share on other sites

That's great too. I just wanted to make as few changes to existing behavior as possible. I wasn't sure what would/would not be wanted.

 

Thanks!

Q

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×