I think right-clicking on the gumps should make them close (like in Ultima Online)
as far as I know right clicking on gumps does nothing at the moment
An idea
Forum rules
NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Re: An idea
You can easily add that behaviour yourself if you download the current CVS source code and make a (tiny) change to the code:
First of all - you know that double-left clicking currently does what you want (closes the gump beneath it)? You can easily make a single right-click call the same code as a double left-click call which will give you the behaviour you want.
Open the file exult.cc and go to line 790. this is the SDL handler code for a "release mouse button" event. First the code checks which button was released (event.button.button == 3 means right button, event.button.button == 1 means left)
Change the part where it says:
if (event.button.button == 3) {
.
// some code-stuff
.
else
gwin->stop_actor();
last_b3_click = curtime;
}
to:
if (event.button.button == 3) {
.
// some code-stuff
.
else {
gwin->stop_actor();
gwin->double_clicked(event.button.x / scale, event.button.y / scale);
}
last_b3_click = curtime;
}
Now single right-clicking a gump will close it.
- Telemachos
First of all - you know that double-left clicking currently does what you want (closes the gump beneath it)? You can easily make a single right-click call the same code as a double left-click call which will give you the behaviour you want.
Open the file exult.cc and go to line 790. this is the SDL handler code for a "release mouse button" event. First the code checks which button was released (event.button.button == 3 means right button, event.button.button == 1 means left)
Change the part where it says:
if (event.button.button == 3) {
.
// some code-stuff
.
else
gwin->stop_actor();
last_b3_click = curtime;
}
to:
if (event.button.button == 3) {
.
// some code-stuff
.
else {
gwin->stop_actor();
gwin->double_clicked(event.button.x / scale, event.button.y / scale);
}
last_b3_click = curtime;
}
Now single right-clicking a gump will close it.
- Telemachos
-
- Site Admin
- Posts: 731
- Joined: Thu May 14, 2020 1:34 pm
Re: An idea
Isn't that code going to have some serious side effects? You'd also need to include a check to make sure that you are actually clicking on a gump, that you are actually not clicking on an item in the gump, and that the gump is actually closable.
-Colourless Dragon
-Colourless Dragon
Re: An idea
From what I can see all this happens in the gwin::double_clicked() function which will call the double_clicked function in the gump. Also since the very same line of code is called from the double left-click handler code (which I assume was made by an Exult team member) I don't see how this could be dangerous in any way. If it's triggered by a right click or a double left-click - that shouldn't matter ?!?
- Tele
- Tele
-
- Site Admin
- Posts: 731
- Joined: Thu May 14, 2020 1:34 pm
Re: An idea
The problem is double click doesn't just close the gump, it does other things as well, such as use and item and open up other gumps. The change you propose would make releasing the right button always act like a left double, regardless of what was being right clicked, and this is a 'bad' thing. This includes everytime you lift your finger off the mouse button when you want to stop moving, exult will then attempt to 'double click' what ever the mouse was over.
-Colourless Dragon
-Colourless Dragon
-
- Site Admin
- Posts: 731
- Joined: Thu May 14, 2020 1:34 pm
Re: An idea
Also, If you want, I'll add in all the required changes myself. Doing this won't exactly be very difficult.
-Colourless Dragon
-Colourless Dragon
Re: An idea
Yeah I follow you now - hadn't thought of the move problem. That's what I get for messing around with code I don't know the inner workings of I guess
I simply hacked around in the code for 5minz and only tested the change on a few open gumps - and it seemed to work. So kids, don't try this at home and sorry if I got you to mess up your exult code
- Tele
I simply hacked around in the code for 5minz and only tested the change on a few open gumps - and it seemed to work. So kids, don't try this at home and sorry if I got you to mess up your exult code
- Tele
-
- Site Admin
- Posts: 731
- Joined: Thu May 14, 2020 1:34 pm
Re: An idea
Ok, just committed the changes to allow right clicking on gumps to close them. As always, it will be in the next snapshot.
-Colourless Dragon
-Colourless Dragon