* Add lua mouse button event handler that can be consumed.
* Fix middle-mouse down/click not getting sent to lua
This is a flexible event handler mechanism to allow for more advanced
add-on features. It does not allow the add-on to consume the value
however, so there's no mechanism for the add-on to requrest the default
action not be executed.
We would normally deal separately with mouse down, up and click, with
the later being an event where the mouse has gone both down and up on
the same UI component. However, Wesnoth's code seems to allow a mouse up
on many UI components to serve as a click, so this implementation
follows that behavior.
This addresses issue #7949
The mouse handling code needs an overhaul, so this patch works with it
in it's current state in the best possible way. The revised code
attempts to restrict clicks to those events where a mouse went both down
and up on the same map tile. It is able to do this with the right mouse
button as well as X1 and X2, but must work as existing click events are
treated for now.
This means that "left click" is managed via the `left_click()` function
which occurrs at mouse down, "right click" via `right_mouse_up()` when
the right mouse button comes up, and the middle button's click behavior
is coded directly into mouse_handler_base::mouse_press() (so no function
is called) and "clicks" when the button comes down. The new
`on_mouse_button()` code will allow the mod developer to consume any
click event, preventing the default behavior, and also receive event
callbacks for up and down events, although the return value is ignored
for these calls and left and middle click occur on mouse down.
There is a new sdl::get_mouse_state() function that should be used in place
of SDL_GetMouseState() in every case. It returns coordinates relative to
the drawing surface.
With this, the pixel scale option seems to be working without issue.
This additionally:
* Makes all copyright notices identical aside from the starting year for Wesnoth-specific source files. Files not included: mariadbpp, lua, spirit po, xbrz, and bcrypt (crypt_blowfish).
* Removes all attribution from the files, since the vast majority of them are outdated or seemingly just outright incorrect. For example, I would guess that Dave is no longer the sole author of the majority of Wesnoth's current code.
After testing, it seems these calls to raise_draw_event and display/game_display::draw()
were unnecessary - or at least, became unnecessary at some point. One or two are definitely
still needed, but removing these doesn't seem to cause anything to to glitch out. Likely
explanation is anything that needs updating just gets updated either immediately or on the
next play_slice loop.
This slider hasn't worked in ages, and we're planning to remove it anyway.
The slider "groove" image remains since it's hard drawn in the background image file.
This commit still doesn't fix all of them. I decided to leave alone
cases where variables with the same name are assigned in multiple
conditions of the same if...else if...else statement, and cases where a
scope logging macro is used multiple times in the same scope. In any
case, this commit greatly reduces the warning count on MSVC2015 and makes
new warnings much easier to spot.
This re-creates the main display-gui() buttons on a full redraw to take
into account that the theme expects them to be out of sync. As a
consequence I have also been forced to refactor how said buttons are
managed and introduced a new method to join the same event context
as another component.
This removes all legacy SDL1.2 code. It was done by invoking:
coan source --replace --no-transients -D"SDL_VERSION_ATLEAST(X, Y, Z)"=1 <file>
on each file.
For Apple, control is the modifier key that is used for contextual menus.
KMOD_CTRL will check for a control-click. This fixes#15259 (https://gna.org/bugs/?15259). (I’ve built and verified with this patch, it works correctly.)
This is the result of running command, in src/,
find . -type f -exec sed -i 's/\(WRN.*\)\\n\"\;/\1\" << std::endl\;/g' '{}' \;
and inspecting the results.
Also ran this subsequently:
find . -type f -exec sed -i 's/\(WARN.*\)\\n\"\;/\1\" << std::endl\;/g' '{}' \;
which only affected render.cpp
From cd8c83532b0d33a3a2e24d9af04dac0455a84625:
gui::slider* s = gui().find_slider("map-zoom-slider");
if (point_in_rect(event.x, event.y, s->location())) {
scrollx = 0; scrolly = 0;
}
s is not guaranteed to not be NULL. display::find_slider() WILL return
NULL if it can't find the requested widget. As it turns out, the editor
currently lacks a slider called "map-zoom-slider".