Page 1 of 1
An idea
Posted: Sat Mar 02, 2002 7:27 pm
by Aurelious
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
Re: An idea
Posted: Sun Mar 03, 2002 1:58 pm
by Telemachos
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
Re: An idea
Posted: Mon Mar 04, 2002 2:14 am
by Kurt
that's quite nifty, I'll do that myself when I get a chance
Re: An idea
Posted: Mon Mar 04, 2002 5:04 am
by Colourless
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
Re: An idea
Posted: Mon Mar 04, 2002 7:04 am
by Telemachos
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
Re: An idea
Posted: Mon Mar 04, 2002 9:28 am
by Colourless
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
Re: An idea
Posted: Mon Mar 04, 2002 9:49 am
by Colourless
Also, If you want, I'll add in all the required changes myself. Doing this won't exactly be very difficult.
-Colourless Dragon
Re: An idea
Posted: Mon Mar 04, 2002 5:00 pm
by Telemachos
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
Re: An idea
Posted: Tue Mar 05, 2002 6:09 am
by Colourless
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