mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-19 18:44:13 +00:00
Convert remaining SDL1.2 defines to their SDL2 counterparts and dropped compat layer
This commit is contained in:
parent
59d815dcf1
commit
1fb26d9e1c
@ -958,7 +958,6 @@
|
||||
<Unit filename="../../src/scripting/plugins/manager.hpp" />
|
||||
<Unit filename="../../src/sdl/alpha.cpp" />
|
||||
<Unit filename="../../src/sdl/alpha.hpp" />
|
||||
<Unit filename="../../src/sdl/compat.hpp" />
|
||||
<Unit filename="../../src/sdl/exception.cpp" />
|
||||
<Unit filename="../../src/sdl/exception.hpp" />
|
||||
<Unit filename="../../src/sdl/image.cpp" />
|
||||
|
@ -1517,13 +1517,13 @@ static Uint8 ToggleFullscreen(GPU_Renderer* renderer, Uint8 use_desktop_resoluti
|
||||
Uint16 w, h;
|
||||
|
||||
if(SDL_WM_ToggleFullScreen(surf))
|
||||
return (surf->flags & SDL_FULLSCREEN);
|
||||
return (surf->flags & SDL_WINDOW_FULLSCREEN_DESKTOP);
|
||||
|
||||
w = surf->w;
|
||||
h = surf->h;
|
||||
surf->flags ^= SDL_FULLSCREEN;
|
||||
surf->flags ^= SDL_WINDOW_FULLSCREEN_DESKTOP;
|
||||
renderer->SetWindowResolution(renderer, w, h);
|
||||
return (surf->flags & SDL_FULLSCREEN);
|
||||
return (surf->flags & SDL_WINDOW_FULLSCREEN_DESKTOP);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -84,10 +84,8 @@ void controller_base::handle_event(const SDL_Event& event)
|
||||
case SDL_MOUSEMOTION:
|
||||
// Ignore old mouse motion events in the event queue
|
||||
SDL_Event new_event;
|
||||
if(SDL_PeepEvents(&new_event,1,SDL_GETEVENT,
|
||||
SDL_EVENTMASK(SDL_MOUSEMOTION)) > 0) {
|
||||
while(SDL_PeepEvents(&new_event,1,SDL_GETEVENT,
|
||||
SDL_EVENTMASK(SDL_MOUSEMOTION)) > 0) {};
|
||||
if(SDL_PeepEvents(&new_event, 1, SDL_GETEVENT, SDL_MOUSEMOTION, SDL_MOUSEMOTION) > 0) {
|
||||
while(SDL_PeepEvents(&new_event, 1, SDL_GETEVENT, SDL_MOUSEMOTION, SDL_MOUSEMOTION) > 0) {};
|
||||
get_mouse_handler_base().mouse_motion_event(new_event.motion, is_browsing());
|
||||
} else {
|
||||
get_mouse_handler_base().mouse_motion_event(event.motion, is_browsing());
|
||||
@ -134,7 +132,7 @@ void controller_base::process_keyup_event(const SDL_Event& /*event*/) {
|
||||
|
||||
bool controller_base::handle_scroll(int mousex, int mousey, int mouse_flags, double x_axis, double y_axis)
|
||||
{
|
||||
bool mouse_in_window = (SDL_GetAppState() & SDL_APPMOUSEFOCUS) != 0
|
||||
bool mouse_in_window = (CVideo::get_singleton().window_state() & SDL_APPMOUSEFOCUS) != 0
|
||||
|| preferences::get("scroll_when_mouse_outside", true);
|
||||
int scroll_speed = preferences::scroll_speed();
|
||||
int dx = 0, dy = 0;
|
||||
@ -277,7 +275,7 @@ void controller_base::play_slice(bool is_delay_enabled)
|
||||
|
||||
// be nice when window is not visible
|
||||
// NOTE should be handled by display instead, to only disable drawing
|
||||
if (is_delay_enabled && (SDL_GetAppState() & SDL_APPACTIVE) == 0) {
|
||||
if (is_delay_enabled && (CVideo::get_singleton().window_state() & SDL_APPACTIVE) == 0) {
|
||||
CVideo::delay(200);
|
||||
}
|
||||
|
||||
|
@ -18,9 +18,7 @@
|
||||
#include "game_preferences.hpp"
|
||||
#include "gettext.hpp"
|
||||
|
||||
#include "sdl/compat.hpp"
|
||||
|
||||
#include "video.hpp" //SDL_GetAppState()
|
||||
#include "video.hpp" //CVideo::get_singleton().window_state()
|
||||
|
||||
#ifdef HAVE_LIBDBUS
|
||||
#include "dbus_notification.hpp"
|
||||
@ -51,7 +49,7 @@ bool available() { return true; }
|
||||
|
||||
void send(const std::string& owner, const std::string& message, type t)
|
||||
{
|
||||
Uint8 app_state = SDL_GetAppState();
|
||||
Uint8 app_state = CVideo::get_singleton().window_state();
|
||||
|
||||
// Do not show notifications when the window is visible...
|
||||
if ((app_state & SDL_APPACTIVE) != 0)
|
||||
|
@ -135,7 +135,7 @@ bool mouse_action::has_shift_modifier() const
|
||||
bool mouse_action::has_ctrl_modifier() const
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
return key_[SDLK_RMETA] || key_[SDLK_LMETA];
|
||||
return key_[SDLK_RGUI] || key_[SDLK_LGUI];
|
||||
#else
|
||||
return key_[SDLK_RCTRL] || key_[SDLK_LCTRL];
|
||||
#endif
|
||||
|
@ -447,8 +447,7 @@ void gamebrowser::handle_event(const SDL_Event& event)
|
||||
// already has helped in generating a double click.
|
||||
// ??
|
||||
SDL_Event ev;
|
||||
SDL_PeepEvents(&ev, 1, SDL_PEEKEVENT,
|
||||
SDL_EVENTMASK(DOUBLE_CLICK_EVENT));
|
||||
SDL_PeepEvents(&ev, 1, SDL_PEEKEVENT, DOUBLE_CLICK_EVENT, DOUBLE_CLICK_EVENT);
|
||||
if (ev.type == DOUBLE_CLICK_EVENT) {
|
||||
ignore_next_doubleclick_ = true;
|
||||
}
|
||||
|
@ -210,8 +210,8 @@ tdispatcher::fire(const tevent event, twidget& target, const tpoint& coordinate)
|
||||
class ttrigger_keyboard
|
||||
{
|
||||
public:
|
||||
ttrigger_keyboard(const SDLKey key,
|
||||
const SDLMod modifier,
|
||||
ttrigger_keyboard(const SDL_Keycode key,
|
||||
const SDL_Keymod modifier,
|
||||
const utf8::string& unicode)
|
||||
: key_(key), modifier_(modifier), unicode_(unicode)
|
||||
{
|
||||
@ -227,15 +227,15 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
SDLKey key_;
|
||||
SDLMod modifier_;
|
||||
SDL_Keycode key_;
|
||||
SDL_Keymod modifier_;
|
||||
utf8::string unicode_;
|
||||
};
|
||||
|
||||
bool tdispatcher::fire(const tevent event,
|
||||
twidget& target,
|
||||
const SDLKey key,
|
||||
const SDLMod modifier,
|
||||
const SDL_Keycode key,
|
||||
const SDL_Keymod modifier,
|
||||
const utf8::string& unicode)
|
||||
{
|
||||
assert(find<tset_event_keyboard>(event, tevent_in_set()));
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
#include "gui/core/event/handler.hpp"
|
||||
#include "hotkey/hotkey_command.hpp"
|
||||
#include "sdl/compat.hpp"
|
||||
#include "serialization/unicode_types.hpp"
|
||||
|
||||
#include <SDL_events.h>
|
||||
@ -74,8 +73,8 @@ typedef std::function<void(tdispatcher& dispatcher,
|
||||
const tevent event,
|
||||
bool& handled,
|
||||
bool& halt,
|
||||
const SDLKey key,
|
||||
const SDLMod modifier,
|
||||
const SDL_Keycode key,
|
||||
const SDL_Keymod modifier,
|
||||
const utf8::string& unicode)>
|
||||
tsignal_keyboard_function;
|
||||
|
||||
@ -186,8 +185,8 @@ public:
|
||||
*/
|
||||
bool fire(const tevent event,
|
||||
twidget& target,
|
||||
const SDLKey key,
|
||||
const SDLMod modifier,
|
||||
const SDL_Keycode key,
|
||||
const SDL_Keymod modifier,
|
||||
const utf8::string& unicode);
|
||||
|
||||
/**
|
||||
|
@ -697,8 +697,8 @@ void tdistributor::keyboard_remove_from_chain(twidget* widget)
|
||||
}
|
||||
}
|
||||
|
||||
void tdistributor::signal_handler_sdl_key_down(const SDLKey key,
|
||||
const SDLMod modifier,
|
||||
void tdistributor::signal_handler_sdl_key_down(const SDL_Keycode key,
|
||||
const SDL_Keymod modifier,
|
||||
const utf8::string& unicode)
|
||||
{
|
||||
/** @todo Test whether recursion protection is needed. */
|
||||
|
@ -322,8 +322,8 @@ private:
|
||||
* widget. These functions are called by the SDL event handling functions.
|
||||
*/
|
||||
|
||||
void signal_handler_sdl_key_down(const SDLKey key,
|
||||
const SDLMod modifier,
|
||||
void signal_handler_sdl_key_down(const SDL_Keycode key,
|
||||
const SDL_Keymod modifier,
|
||||
const utf8::string& unicode);
|
||||
|
||||
void signal_handler_notify_removal(tdispatcher& widget, const tevent event);
|
||||
|
@ -256,8 +256,8 @@ private:
|
||||
* @param modifier The SDL key modifiers used.
|
||||
* @param unicode The unicode value for the key pressed.
|
||||
*/
|
||||
void key_down(const SDLKey key,
|
||||
const SDLMod modifier,
|
||||
void key_down(const SDL_Keycode key,
|
||||
const SDL_Keymod modifier,
|
||||
const utf8::string& unicode);
|
||||
|
||||
/**
|
||||
@ -710,7 +710,7 @@ void thandler::key_down(const SDL_Event& event)
|
||||
|
||||
void thandler::text_input(const std::string& unicode)
|
||||
{
|
||||
key_down(static_cast<SDLKey>(0), static_cast<SDLMod>(0), unicode);
|
||||
key_down(static_cast<SDL_Keycode>(0), static_cast<SDL_Keymod>(0), unicode);
|
||||
}
|
||||
|
||||
bool thandler::hotkey_pressed(const hotkey::hotkey_ptr key)
|
||||
@ -724,8 +724,8 @@ bool thandler::hotkey_pressed(const hotkey::hotkey_ptr key)
|
||||
return dispatcher->execute_hotkey(hotkey::get_id(key->get_command()));
|
||||
}
|
||||
|
||||
void thandler::key_down(const SDLKey key,
|
||||
const SDLMod modifier,
|
||||
void thandler::key_down(const SDL_Keycode key,
|
||||
const SDL_Keymod modifier,
|
||||
const utf8::string& unicode)
|
||||
{
|
||||
DBG_GUI_E << "Firing: " << SDL_KEY_DOWN << ".\n";
|
||||
|
@ -141,7 +141,7 @@ void tend_credits::timer_callback()
|
||||
}
|
||||
}
|
||||
|
||||
void tend_credits::key_press_callback(bool&, bool&, const SDLKey key)
|
||||
void tend_credits::key_press_callback(bool&, bool&, const SDL_Keycode key)
|
||||
{
|
||||
if(key == SDLK_UP && scroll_speed_ < 200) {
|
||||
scroll_speed_ <<= 1;
|
||||
|
@ -48,7 +48,7 @@ private:
|
||||
void pre_show(twindow& window);
|
||||
|
||||
void timer_callback();
|
||||
void key_press_callback(bool&, bool&, const SDLKey key);
|
||||
void key_press_callback(bool&, bool&, const SDL_Keycode key);
|
||||
|
||||
const std::string& focus_on_;
|
||||
|
||||
|
@ -690,7 +690,7 @@ void tlobby_main::update_selected_game()
|
||||
player_list_dirty_ = true;
|
||||
}
|
||||
|
||||
void tlobby_main::signal_handler_key_down(SDLKey key, bool& handled, bool& halt)
|
||||
void tlobby_main::signal_handler_key_down(SDL_Keycode key, bool& handled, bool& halt)
|
||||
{
|
||||
if(key == SDLK_ESCAPE) {
|
||||
if(quit()) {
|
||||
@ -1116,7 +1116,7 @@ void tlobby_main::game_filter_reload()
|
||||
lobby_info_.set_game_filter_invert(filter_invert_->get_value_bool());
|
||||
}
|
||||
|
||||
void tlobby_main::game_filter_keypress_callback(const SDLKey key)
|
||||
void tlobby_main::game_filter_keypress_callback(const SDL_Keycode key)
|
||||
{
|
||||
if(key == SDLK_RETURN || key == SDLK_KP_ENTER) {
|
||||
game_filter_reload();
|
||||
|
@ -158,7 +158,7 @@ private:
|
||||
|
||||
void game_filter_change_callback(twidget& widget);
|
||||
|
||||
void game_filter_keypress_callback(const SDLKey key);
|
||||
void game_filter_keypress_callback(const SDL_Keycode key);
|
||||
|
||||
void gamelist_change_callback(twindow& window);
|
||||
|
||||
@ -168,7 +168,7 @@ private:
|
||||
|
||||
void skip_replay_changed_callback(twindow& window);
|
||||
|
||||
void signal_handler_key_down(SDLKey key, bool& handled, bool& halt);
|
||||
void signal_handler_key_down(SDL_Keycode key, bool& handled, bool& halt);
|
||||
|
||||
static bool logout_prompt();
|
||||
|
||||
|
@ -388,7 +388,7 @@ public:
|
||||
|
||||
void input_keypress_callback(bool& handled,
|
||||
bool& halt,
|
||||
const SDLKey key,
|
||||
const SDL_Keycode key,
|
||||
twindow& window);
|
||||
|
||||
void update_view(); ///< Update the view based on the model
|
||||
@ -497,7 +497,7 @@ void tlua_interpreter::controller::handle_clear_button_clicked(twindow & /*windo
|
||||
/** Handle return key (execute) or tab key (tab completion) */
|
||||
void tlua_interpreter::controller::input_keypress_callback(bool& handled,
|
||||
bool& halt,
|
||||
const SDLKey key,
|
||||
const SDL_Keycode key,
|
||||
twindow& /*window*/)
|
||||
{
|
||||
assert(lua_model_);
|
||||
|
@ -164,7 +164,7 @@ void tchatbox::send_message_button_callback()
|
||||
}
|
||||
|
||||
|
||||
void tchatbox::chat_input_keypress_callback(bool& handled, bool& halt, const SDLKey key)
|
||||
void tchatbox::chat_input_keypress_callback(bool& handled, bool& halt, const SDL_Keycode key)
|
||||
{
|
||||
if (key == SDLK_RETURN || key == SDLK_KP_ENTER) {
|
||||
send_message_button_callback();
|
||||
|
@ -133,7 +133,7 @@ private:
|
||||
/** See @ref tcontainer_::set_self_active. */
|
||||
virtual void set_self_active(const bool active) override;
|
||||
|
||||
void chat_input_keypress_callback(bool& handled, bool& halt, const SDLKey key);
|
||||
void chat_input_keypress_callback(bool& handled, bool& halt, const SDL_Keycode key);
|
||||
|
||||
void append_to_chatbox(const std::string& text, const bool force_scroll = false);
|
||||
|
||||
|
@ -247,7 +247,7 @@ const twidget* thorizontal_list::find_at(const tpoint& coordinate,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void thorizontal_list::handle_key_left_arrow(SDLMod /*modifier*/, bool& handled)
|
||||
void thorizontal_list::handle_key_left_arrow(SDL_Keymod /*modifier*/, bool& handled)
|
||||
{
|
||||
if(get_item_count() == 0) {
|
||||
return;
|
||||
@ -285,7 +285,7 @@ void thorizontal_list::handle_key_left_arrow(SDLMod /*modifier*/, bool& handled)
|
||||
}
|
||||
}
|
||||
|
||||
void thorizontal_list::handle_key_right_arrow(SDLMod /*modifier*/,
|
||||
void thorizontal_list::handle_key_right_arrow(SDL_Keymod /*modifier*/,
|
||||
bool& handled)
|
||||
{
|
||||
if(get_item_count() == 0) {
|
||||
@ -467,7 +467,7 @@ const twidget* tvertical_list::find_at(const tpoint& coordinate,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void tvertical_list::handle_key_up_arrow(SDLMod /*modifier*/, bool& handled)
|
||||
void tvertical_list::handle_key_up_arrow(SDL_Keymod /*modifier*/, bool& handled)
|
||||
{
|
||||
if(get_item_count() == 0) {
|
||||
return;
|
||||
@ -505,7 +505,7 @@ void tvertical_list::handle_key_up_arrow(SDLMod /*modifier*/, bool& handled)
|
||||
}
|
||||
}
|
||||
|
||||
void tvertical_list::handle_key_down_arrow(SDLMod /*modifier*/, bool& handled)
|
||||
void tvertical_list::handle_key_down_arrow(SDL_Keymod /*modifier*/, bool& handled)
|
||||
{
|
||||
if(get_item_count() == 0) {
|
||||
return;
|
||||
@ -747,7 +747,7 @@ const twidget* tmatrix::find_at(const tpoint& coordinate,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void tmatrix::handle_key_up_arrow(SDLMod /*modifier*/, bool& handled)
|
||||
void tmatrix::handle_key_up_arrow(SDL_Keymod /*modifier*/, bool& handled)
|
||||
{
|
||||
if(get_item_count() == 0) {
|
||||
return;
|
||||
@ -785,7 +785,7 @@ void tmatrix::handle_key_up_arrow(SDLMod /*modifier*/, bool& handled)
|
||||
}
|
||||
}
|
||||
|
||||
void tmatrix::handle_key_down_arrow(SDLMod /*modifier*/, bool& handled)
|
||||
void tmatrix::handle_key_down_arrow(SDL_Keymod /*modifier*/, bool& handled)
|
||||
{
|
||||
if(get_item_count() == 0) {
|
||||
return;
|
||||
@ -823,7 +823,7 @@ void tmatrix::handle_key_down_arrow(SDLMod /*modifier*/, bool& handled)
|
||||
}
|
||||
}
|
||||
|
||||
void tmatrix::handle_key_left_arrow(SDLMod /*modifier*/, bool& handled)
|
||||
void tmatrix::handle_key_left_arrow(SDL_Keymod /*modifier*/, bool& handled)
|
||||
{
|
||||
if(get_item_count() == 0) {
|
||||
return;
|
||||
@ -861,7 +861,7 @@ void tmatrix::handle_key_left_arrow(SDLMod /*modifier*/, bool& handled)
|
||||
}
|
||||
}
|
||||
|
||||
void tmatrix::handle_key_right_arrow(SDLMod /*modifier*/,
|
||||
void tmatrix::handle_key_right_arrow(SDL_Keymod /*modifier*/,
|
||||
bool& handled)
|
||||
{
|
||||
if(get_item_count() == 0) {
|
||||
|
@ -303,7 +303,7 @@ public:
|
||||
* This is used in the keyboard event
|
||||
* changing.
|
||||
*/
|
||||
virtual void handle_key_up_arrow(SDLMod modifier, bool& handled) = 0;
|
||||
virtual void handle_key_up_arrow(SDL_Keymod modifier, bool& handled) = 0;
|
||||
|
||||
/**
|
||||
* Down arrow key pressed.
|
||||
@ -315,7 +315,7 @@ public:
|
||||
* This is used in the keyboard event
|
||||
* changing.
|
||||
*/
|
||||
virtual void handle_key_down_arrow(SDLMod modifier, bool& handled) = 0;
|
||||
virtual void handle_key_down_arrow(SDL_Keymod modifier, bool& handled) = 0;
|
||||
|
||||
/**
|
||||
* Left arrow key pressed.
|
||||
@ -327,7 +327,7 @@ public:
|
||||
* This is used in the keyboard event
|
||||
* changing.
|
||||
*/
|
||||
virtual void handle_key_left_arrow(SDLMod modifier, bool& handled) = 0;
|
||||
virtual void handle_key_left_arrow(SDL_Keymod modifier, bool& handled) = 0;
|
||||
|
||||
/**
|
||||
* Right arrow key pressed.
|
||||
@ -339,7 +339,7 @@ public:
|
||||
* This is used in the keyboard event
|
||||
* changing.
|
||||
*/
|
||||
virtual void handle_key_right_arrow(SDLMod modifier, bool& handled) = 0;
|
||||
virtual void handle_key_right_arrow(SDL_Keymod modifier, bool& handled) = 0;
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
@ -233,22 +233,22 @@ struct thorizontal_list : public virtual tgenerator_
|
||||
/***** ***** ***** ***** keyboard functions ***** ***** ***** *****/
|
||||
|
||||
/** Inherited from tgenerator_. */
|
||||
void handle_key_up_arrow(SDLMod /*modifier*/, bool& /*handled*/) override
|
||||
void handle_key_up_arrow(SDL_Keymod /*modifier*/, bool& /*handled*/) override
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
/** Inherited from tgenerator_. */
|
||||
void handle_key_down_arrow(SDLMod /*modifier*/, bool& /*handled*/) override
|
||||
void handle_key_down_arrow(SDL_Keymod /*modifier*/, bool& /*handled*/) override
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
/** Inherited from tgenerator_. */
|
||||
void handle_key_left_arrow(SDLMod modifier, bool& handled) override;
|
||||
void handle_key_left_arrow(SDL_Keymod modifier, bool& handled) override;
|
||||
|
||||
/** Inherited from tgenerator_. */
|
||||
void handle_key_right_arrow(SDLMod modifier, bool& handled) override;
|
||||
void handle_key_right_arrow(SDL_Keymod modifier, bool& handled) override;
|
||||
|
||||
private:
|
||||
/**
|
||||
@ -307,18 +307,18 @@ struct tvertical_list : public virtual tgenerator_
|
||||
/***** ***** ***** ***** keyboard functions ***** ***** ***** *****/
|
||||
|
||||
/** Inherited from tgenerator_. */
|
||||
void handle_key_up_arrow(SDLMod modifier, bool& handled) override;
|
||||
void handle_key_up_arrow(SDL_Keymod modifier, bool& handled) override;
|
||||
|
||||
/** Inherited from tgenerator_. */
|
||||
void handle_key_down_arrow(SDLMod modifier, bool& handled) override;
|
||||
void handle_key_down_arrow(SDL_Keymod modifier, bool& handled) override;
|
||||
|
||||
/** Inherited from tgenerator_. */
|
||||
void handle_key_left_arrow(SDLMod /*modifier*/, bool& /*handled*/) override
|
||||
void handle_key_left_arrow(SDL_Keymod /*modifier*/, bool& /*handled*/) override
|
||||
{ /* do nothing */
|
||||
}
|
||||
|
||||
/** Inherited from tgenerator_. */
|
||||
void handle_key_right_arrow(SDLMod /*modifier*/, bool& /*handled*/) override
|
||||
void handle_key_right_arrow(SDL_Keymod /*modifier*/, bool& /*handled*/) override
|
||||
{ /* do nothing */
|
||||
}
|
||||
|
||||
@ -392,16 +392,16 @@ struct tmatrix : public virtual tgenerator_
|
||||
/***** ***** ***** ***** keyboard functions ***** ***** ***** *****/
|
||||
|
||||
/** Inherited from tgenerator_. */
|
||||
void handle_key_up_arrow(SDLMod, bool&) override;
|
||||
void handle_key_up_arrow(SDL_Keymod, bool&) override;
|
||||
|
||||
/** Inherited from tgenerator_. */
|
||||
void handle_key_down_arrow(SDLMod, bool&) override;
|
||||
void handle_key_down_arrow(SDL_Keymod, bool&) override;
|
||||
|
||||
/** Inherited from tgenerator_. */
|
||||
void handle_key_left_arrow(SDLMod, bool&) override;
|
||||
void handle_key_left_arrow(SDL_Keymod, bool&) override;
|
||||
|
||||
/** Inherited from tgenerator_. */
|
||||
void handle_key_right_arrow(SDLMod, bool&) override;
|
||||
void handle_key_right_arrow(SDL_Keymod, bool&) override;
|
||||
private:
|
||||
/**
|
||||
* Has the grid already been placed?
|
||||
@ -467,25 +467,25 @@ struct tindependent : public virtual tgenerator_
|
||||
/***** ***** ***** ***** keyboard functions ***** ***** ***** *****/
|
||||
|
||||
/** Inherited from tgenerator_. */
|
||||
void handle_key_up_arrow(SDLMod, bool&) override
|
||||
void handle_key_up_arrow(SDL_Keymod, bool&) override
|
||||
{
|
||||
/* DO NOTHING */
|
||||
}
|
||||
|
||||
/** Inherited from tgenerator_. */
|
||||
void handle_key_down_arrow(SDLMod, bool&) override
|
||||
void handle_key_down_arrow(SDL_Keymod, bool&) override
|
||||
{
|
||||
/* DO NOTHING */
|
||||
}
|
||||
|
||||
/** Inherited from tgenerator_. */
|
||||
void handle_key_left_arrow(SDLMod, bool&) override
|
||||
void handle_key_left_arrow(SDL_Keymod, bool&) override
|
||||
{
|
||||
/* DO NOTHING */
|
||||
}
|
||||
|
||||
/** Inherited from tgenerator_. */
|
||||
void handle_key_right_arrow(SDLMod, bool&) override
|
||||
void handle_key_right_arrow(SDL_Keymod, bool&) override
|
||||
{
|
||||
/* DO NOTHING */
|
||||
}
|
||||
@ -913,25 +913,25 @@ public:
|
||||
/***** ***** ***** ***** keyboard functions ***** ***** ***** *****/
|
||||
|
||||
/** Inherited from tgenerator_. */
|
||||
void handle_key_up_arrow(SDLMod modifier, bool& handled) override
|
||||
void handle_key_up_arrow(SDL_Keymod modifier, bool& handled) override
|
||||
{
|
||||
placement::handle_key_up_arrow(modifier, handled);
|
||||
}
|
||||
|
||||
/** Inherited from tgenerator_. */
|
||||
void handle_key_down_arrow(SDLMod modifier, bool& handled) override
|
||||
void handle_key_down_arrow(SDL_Keymod modifier, bool& handled) override
|
||||
{
|
||||
placement::handle_key_down_arrow(modifier, handled);
|
||||
}
|
||||
|
||||
/** Inherited from tgenerator_. */
|
||||
void handle_key_left_arrow(SDLMod modifier, bool& handled) override
|
||||
void handle_key_left_arrow(SDL_Keymod modifier, bool& handled) override
|
||||
{
|
||||
placement::handle_key_left_arrow(modifier, handled);
|
||||
}
|
||||
|
||||
/** Inherited from tgenerator_. */
|
||||
void handle_key_right_arrow(SDLMod modifier, bool& handled) override
|
||||
void handle_key_right_arrow(SDL_Keymod modifier, bool& handled) override
|
||||
{
|
||||
placement::handle_key_right_arrow(modifier, handled);
|
||||
}
|
||||
|
@ -444,8 +444,8 @@ void tlist::signal_handler_left_button_click(tgrid* grid,
|
||||
|
||||
void tlist::signal_handler_sdl_key_down(const event::tevent event,
|
||||
bool& handled,
|
||||
const SDLKey key,
|
||||
SDLMod modifier)
|
||||
const SDL_Keycode key,
|
||||
SDL_Keymod modifier)
|
||||
{
|
||||
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n";
|
||||
|
||||
|
@ -288,8 +288,8 @@ private:
|
||||
|
||||
void signal_handler_sdl_key_down(const event::tevent event,
|
||||
bool& handled,
|
||||
const SDLKey key,
|
||||
SDLMod modifier);
|
||||
const SDL_Keycode key,
|
||||
SDL_Keymod modifier);
|
||||
};
|
||||
|
||||
typedef tlist tlistbox;
|
||||
|
@ -402,7 +402,7 @@ tlistbox::child_populate_dirty_list(twindow& caller,
|
||||
generator_->populate_dirty_list(caller, child_call_stack);
|
||||
}
|
||||
|
||||
void tlistbox::handle_key_up_arrow(SDLMod modifier, bool& handled)
|
||||
void tlistbox::handle_key_up_arrow(SDL_Keymod modifier, bool& handled)
|
||||
{
|
||||
assert(generator_);
|
||||
|
||||
@ -429,7 +429,7 @@ void tlistbox::handle_key_up_arrow(SDLMod modifier, bool& handled)
|
||||
}
|
||||
}
|
||||
|
||||
void tlistbox::handle_key_down_arrow(SDLMod modifier, bool& handled)
|
||||
void tlistbox::handle_key_down_arrow(SDL_Keymod modifier, bool& handled)
|
||||
{
|
||||
assert(generator_);
|
||||
|
||||
@ -456,7 +456,7 @@ void tlistbox::handle_key_down_arrow(SDLMod modifier, bool& handled)
|
||||
}
|
||||
}
|
||||
|
||||
void tlistbox::handle_key_left_arrow(SDLMod modifier, bool& handled)
|
||||
void tlistbox::handle_key_left_arrow(SDL_Keymod modifier, bool& handled)
|
||||
{
|
||||
assert(generator_);
|
||||
|
||||
@ -483,7 +483,7 @@ void tlistbox::handle_key_left_arrow(SDLMod modifier, bool& handled)
|
||||
}
|
||||
}
|
||||
|
||||
void tlistbox::handle_key_right_arrow(SDLMod modifier, bool& handled)
|
||||
void tlistbox::handle_key_right_arrow(SDL_Keymod modifier, bool& handled)
|
||||
{
|
||||
assert(generator_);
|
||||
|
||||
|
@ -260,16 +260,16 @@ protected:
|
||||
/***** ***** ***** ***** keyboard functions ***** ***** ***** *****/
|
||||
|
||||
/** Inherited from tscrollbar_container. */
|
||||
void handle_key_up_arrow(SDLMod modifier, bool& handled) override;
|
||||
void handle_key_up_arrow(SDL_Keymod modifier, bool& handled) override;
|
||||
|
||||
/** Inherited from tscrollbar_container. */
|
||||
void handle_key_down_arrow(SDLMod modifier, bool& handled) override;
|
||||
void handle_key_down_arrow(SDL_Keymod modifier, bool& handled) override;
|
||||
|
||||
/** Inherited from tscrollbar_container. */
|
||||
void handle_key_left_arrow(SDLMod modifier, bool& handled) override;
|
||||
void handle_key_left_arrow(SDL_Keymod modifier, bool& handled) override;
|
||||
|
||||
/** Inherited from tscrollbar_container. */
|
||||
void handle_key_right_arrow(SDLMod modifier, bool& handled) override;
|
||||
void handle_key_right_arrow(SDL_Keymod modifier, bool& handled) override;
|
||||
|
||||
private:
|
||||
/**
|
||||
|
@ -1022,7 +1022,7 @@ void tscrollbar_container::scroll_horizontal_scrollbar(
|
||||
scrollbar_moved();
|
||||
}
|
||||
|
||||
void tscrollbar_container::handle_key_home(SDLMod /*modifier*/, bool& handled)
|
||||
void tscrollbar_container::handle_key_home(SDL_Keymod /*modifier*/, bool& handled)
|
||||
{
|
||||
assert(vertical_scrollbar_ && horizontal_scrollbar_);
|
||||
|
||||
@ -1033,7 +1033,7 @@ void tscrollbar_container::handle_key_home(SDLMod /*modifier*/, bool& handled)
|
||||
handled = true;
|
||||
}
|
||||
|
||||
void tscrollbar_container::handle_key_end(SDLMod /*modifier*/, bool& handled)
|
||||
void tscrollbar_container::handle_key_end(SDL_Keymod /*modifier*/, bool& handled)
|
||||
{
|
||||
assert(vertical_scrollbar_);
|
||||
|
||||
@ -1043,7 +1043,7 @@ void tscrollbar_container::handle_key_end(SDLMod /*modifier*/, bool& handled)
|
||||
handled = true;
|
||||
}
|
||||
|
||||
void tscrollbar_container::handle_key_page_up(SDLMod /*modifier*/,
|
||||
void tscrollbar_container::handle_key_page_up(SDL_Keymod /*modifier*/,
|
||||
bool& handled)
|
||||
{
|
||||
assert(vertical_scrollbar_);
|
||||
@ -1054,7 +1054,7 @@ void tscrollbar_container::handle_key_page_up(SDLMod /*modifier*/,
|
||||
handled = true;
|
||||
}
|
||||
|
||||
void tscrollbar_container::handle_key_page_down(SDLMod /*modifier*/,
|
||||
void tscrollbar_container::handle_key_page_down(SDL_Keymod /*modifier*/,
|
||||
bool& handled)
|
||||
|
||||
{
|
||||
@ -1066,7 +1066,7 @@ void tscrollbar_container::handle_key_page_down(SDLMod /*modifier*/,
|
||||
handled = true;
|
||||
}
|
||||
|
||||
void tscrollbar_container::handle_key_up_arrow(SDLMod /*modifier*/,
|
||||
void tscrollbar_container::handle_key_up_arrow(SDL_Keymod /*modifier*/,
|
||||
bool& handled)
|
||||
{
|
||||
assert(vertical_scrollbar_);
|
||||
@ -1077,7 +1077,7 @@ void tscrollbar_container::handle_key_up_arrow(SDLMod /*modifier*/,
|
||||
handled = true;
|
||||
}
|
||||
|
||||
void tscrollbar_container::handle_key_down_arrow(SDLMod /*modifier*/,
|
||||
void tscrollbar_container::handle_key_down_arrow(SDL_Keymod /*modifier*/,
|
||||
bool& handled)
|
||||
{
|
||||
assert(vertical_scrollbar_);
|
||||
@ -1088,7 +1088,7 @@ void tscrollbar_container::handle_key_down_arrow(SDLMod /*modifier*/,
|
||||
handled = true;
|
||||
}
|
||||
|
||||
void tscrollbar_container::handle_key_left_arrow(SDLMod /*modifier*/,
|
||||
void tscrollbar_container::handle_key_left_arrow(SDL_Keymod /*modifier*/,
|
||||
bool& handled)
|
||||
{
|
||||
assert(horizontal_scrollbar_);
|
||||
@ -1099,7 +1099,7 @@ void tscrollbar_container::handle_key_left_arrow(SDLMod /*modifier*/,
|
||||
handled = true;
|
||||
}
|
||||
|
||||
void tscrollbar_container::handle_key_right_arrow(SDLMod /*modifier*/,
|
||||
void tscrollbar_container::handle_key_right_arrow(SDL_Keymod /*modifier*/,
|
||||
bool& handled)
|
||||
{
|
||||
assert(horizontal_scrollbar_);
|
||||
@ -1146,8 +1146,8 @@ const std::string& tscrollbar_container::get_control_type() const
|
||||
void
|
||||
tscrollbar_container::signal_handler_sdl_key_down(const event::tevent event,
|
||||
bool& handled,
|
||||
const SDLKey key,
|
||||
SDLMod modifier)
|
||||
const SDL_Keycode key,
|
||||
SDL_Keymod modifier)
|
||||
{
|
||||
DBG_GUI_E << LOG_HEADER << event << ".\n";
|
||||
|
||||
|
@ -347,7 +347,7 @@ protected:
|
||||
* This is used in the keyboard event
|
||||
* changing.
|
||||
*/
|
||||
virtual void handle_key_home(SDLMod modifier, bool& handled);
|
||||
virtual void handle_key_home(SDL_Keymod modifier, bool& handled);
|
||||
|
||||
/**
|
||||
* End key pressed.
|
||||
@ -359,7 +359,7 @@ protected:
|
||||
* This is used in the keyboard event
|
||||
* changing.
|
||||
*/
|
||||
virtual void handle_key_end(SDLMod modifier, bool& handled);
|
||||
virtual void handle_key_end(SDL_Keymod modifier, bool& handled);
|
||||
|
||||
/**
|
||||
* Page up key pressed.
|
||||
@ -371,7 +371,7 @@ protected:
|
||||
* This is used in the keyboard event
|
||||
* changing.
|
||||
*/
|
||||
virtual void handle_key_page_up(SDLMod modifier, bool& handled);
|
||||
virtual void handle_key_page_up(SDL_Keymod modifier, bool& handled);
|
||||
|
||||
/**
|
||||
* Page down key pressed.
|
||||
@ -383,7 +383,7 @@ protected:
|
||||
* This is used in the keyboard event
|
||||
* changing.
|
||||
*/
|
||||
virtual void handle_key_page_down(SDLMod modifier, bool& handled);
|
||||
virtual void handle_key_page_down(SDL_Keymod modifier, bool& handled);
|
||||
|
||||
|
||||
/**
|
||||
@ -396,7 +396,7 @@ protected:
|
||||
* This is used in the keyboard event
|
||||
* changing.
|
||||
*/
|
||||
virtual void handle_key_up_arrow(SDLMod modifier, bool& handled);
|
||||
virtual void handle_key_up_arrow(SDL_Keymod modifier, bool& handled);
|
||||
|
||||
/**
|
||||
* Down arrow key pressed.
|
||||
@ -408,7 +408,7 @@ protected:
|
||||
* This is used in the keyboard event
|
||||
* changing.
|
||||
*/
|
||||
virtual void handle_key_down_arrow(SDLMod modifier, bool& handled);
|
||||
virtual void handle_key_down_arrow(SDL_Keymod modifier, bool& handled);
|
||||
|
||||
/**
|
||||
* Left arrow key pressed.
|
||||
@ -420,7 +420,7 @@ protected:
|
||||
* This is used in the keyboard event
|
||||
* changing.
|
||||
*/
|
||||
virtual void handle_key_left_arrow(SDLMod modifier, bool& handled);
|
||||
virtual void handle_key_left_arrow(SDL_Keymod modifier, bool& handled);
|
||||
|
||||
/**
|
||||
* Right arrow key pressed.
|
||||
@ -432,7 +432,7 @@ protected:
|
||||
* This is used in the keyboard event
|
||||
* changing.
|
||||
*/
|
||||
virtual void handle_key_right_arrow(SDLMod modifier, bool& handled);
|
||||
virtual void handle_key_right_arrow(SDL_Keymod modifier, bool& handled);
|
||||
|
||||
private:
|
||||
/**
|
||||
@ -527,8 +527,8 @@ private:
|
||||
|
||||
void signal_handler_sdl_key_down(const event::tevent event,
|
||||
bool& handled,
|
||||
const SDLKey key,
|
||||
SDLMod modifier);
|
||||
const SDL_Keycode key,
|
||||
SDL_Keymod modifier);
|
||||
|
||||
void signal_handler_sdl_wheel_up(const event::tevent event, bool& handled);
|
||||
void signal_handler_sdl_wheel_down(const event::tevent event,
|
||||
|
@ -259,7 +259,7 @@ void tslider::handle_key_increase(bool& handled)
|
||||
|
||||
void tslider::signal_handler_sdl_key_down(const event::tevent event,
|
||||
bool& handled,
|
||||
const SDLKey key)
|
||||
const SDL_Keycode key)
|
||||
{
|
||||
|
||||
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n";
|
||||
|
@ -189,7 +189,7 @@ private:
|
||||
*/
|
||||
void signal_handler_sdl_key_down(const event::tevent event,
|
||||
bool& handled,
|
||||
const SDLKey key);
|
||||
const SDL_Keycode key);
|
||||
|
||||
// In this subclass, only used to grab keyboard focus -
|
||||
// see tscrollbar class for more handling of this event.
|
||||
|
@ -205,7 +205,7 @@ void ttext_::set_state(const tstate state)
|
||||
}
|
||||
}
|
||||
|
||||
void ttext_::handle_key_left_arrow(SDLMod modifier, bool& handled)
|
||||
void ttext_::handle_key_left_arrow(SDL_Keymod modifier, bool& handled)
|
||||
{
|
||||
/** @todo implement the ctrl key. */
|
||||
DBG_GUI_E << LOG_SCOPE_HEADER << '\n';
|
||||
@ -217,7 +217,7 @@ void ttext_::handle_key_left_arrow(SDLMod modifier, bool& handled)
|
||||
}
|
||||
}
|
||||
|
||||
void ttext_::handle_key_right_arrow(SDLMod modifier, bool& handled)
|
||||
void ttext_::handle_key_right_arrow(SDL_Keymod modifier, bool& handled)
|
||||
{
|
||||
/** @todo implement the ctrl key. */
|
||||
DBG_GUI_E << LOG_SCOPE_HEADER << '\n';
|
||||
@ -229,7 +229,7 @@ void ttext_::handle_key_right_arrow(SDLMod modifier, bool& handled)
|
||||
}
|
||||
}
|
||||
|
||||
void ttext_::handle_key_home(SDLMod modifier, bool& handled)
|
||||
void ttext_::handle_key_home(SDL_Keymod modifier, bool& handled)
|
||||
{
|
||||
DBG_GUI_E << LOG_SCOPE_HEADER << '\n';
|
||||
|
||||
@ -241,7 +241,7 @@ void ttext_::handle_key_home(SDLMod modifier, bool& handled)
|
||||
}
|
||||
}
|
||||
|
||||
void ttext_::handle_key_end(SDLMod modifier, bool& handled)
|
||||
void ttext_::handle_key_end(SDL_Keymod modifier, bool& handled)
|
||||
{
|
||||
DBG_GUI_E << LOG_SCOPE_HEADER << '\n';
|
||||
|
||||
@ -253,7 +253,7 @@ void ttext_::handle_key_end(SDLMod modifier, bool& handled)
|
||||
}
|
||||
}
|
||||
|
||||
void ttext_::handle_key_backspace(SDLMod /*modifier*/, bool& handled)
|
||||
void ttext_::handle_key_backspace(SDL_Keymod /*modifier*/, bool& handled)
|
||||
{
|
||||
DBG_GUI_E << LOG_SCOPE_HEADER << '\n';
|
||||
|
||||
@ -266,7 +266,7 @@ void ttext_::handle_key_backspace(SDLMod /*modifier*/, bool& handled)
|
||||
fire(event::NOTIFY_MODIFIED, *this, nullptr);
|
||||
}
|
||||
|
||||
void ttext_::handle_key_delete(SDLMod /*modifier*/, bool& handled)
|
||||
void ttext_::handle_key_delete(SDL_Keymod /*modifier*/, bool& handled)
|
||||
{
|
||||
DBG_GUI_E << LOG_SCOPE_HEADER << '\n';
|
||||
|
||||
@ -280,8 +280,8 @@ void ttext_::handle_key_delete(SDLMod /*modifier*/, bool& handled)
|
||||
}
|
||||
|
||||
void ttext_::handle_key_default(bool& handled,
|
||||
SDLKey /*key*/,
|
||||
SDLMod /*modifier*/,
|
||||
SDL_Keycode /*key*/,
|
||||
SDL_Keymod /*modifier*/,
|
||||
const utf8::string& unicode)
|
||||
{
|
||||
DBG_GUI_E << LOG_SCOPE_HEADER << '\n';
|
||||
@ -305,8 +305,8 @@ void ttext_::signal_handler_middle_button_click(const event::tevent event,
|
||||
|
||||
void ttext_::signal_handler_sdl_key_down(const event::tevent event,
|
||||
bool& handled,
|
||||
const SDLKey key,
|
||||
SDLMod modifier,
|
||||
const SDL_Keycode key,
|
||||
SDL_Keymod modifier,
|
||||
const utf8::string& unicode)
|
||||
{
|
||||
|
||||
@ -316,7 +316,7 @@ void ttext_::signal_handler_sdl_key_down(const event::tevent event,
|
||||
// be modifed seems not to be required when I read the comment in
|
||||
// widgets/textbox.cpp:516. Would be nice if somebody on a MAC would test it.
|
||||
#ifdef __APPLE__
|
||||
const unsigned copypaste_modifier = KMOD_LMETA | KMOD_RMETA;
|
||||
const unsigned copypaste_modifier = KMOD_LGUI | KMOD_RGUI;
|
||||
#else
|
||||
const unsigned copypaste_modifier = KMOD_CTRL;
|
||||
#endif
|
||||
@ -354,7 +354,7 @@ void ttext_::signal_handler_sdl_key_down(const event::tevent event,
|
||||
}
|
||||
|
||||
// If ctrl-a is used for home drop the control modifier
|
||||
modifier = static_cast<SDLMod>(modifier & ~KMOD_CTRL);
|
||||
modifier = static_cast<SDL_Keymod>(modifier & ~KMOD_CTRL);
|
||||
/* FALL DOWN */
|
||||
|
||||
case SDLK_HOME:
|
||||
@ -368,7 +368,7 @@ void ttext_::signal_handler_sdl_key_down(const event::tevent event,
|
||||
}
|
||||
|
||||
// If ctrl-e is used for end drop the control modifier
|
||||
modifier = static_cast<SDLMod>(modifier & ~KMOD_CTRL);
|
||||
modifier = static_cast<SDL_Keymod>(modifier & ~KMOD_CTRL);
|
||||
/* FALL DOWN */
|
||||
|
||||
case SDLK_END:
|
||||
|
@ -295,14 +295,14 @@ private:
|
||||
*
|
||||
* The behavior is implementation defined.
|
||||
*/
|
||||
virtual void handle_key_up_arrow(SDLMod modifier, bool& handled) = 0;
|
||||
virtual void handle_key_up_arrow(SDL_Keymod modifier, bool& handled) = 0;
|
||||
|
||||
/**
|
||||
* Down arrow key pressed.
|
||||
*
|
||||
* The behavior is implementation defined.
|
||||
*/
|
||||
virtual void handle_key_down_arrow(SDLMod modifier, bool& handled) = 0;
|
||||
virtual void handle_key_down_arrow(SDL_Keymod modifier, bool& handled) = 0;
|
||||
|
||||
/**
|
||||
* Clears the current line.
|
||||
@ -312,7 +312,7 @@ private:
|
||||
* Shift Ignored.
|
||||
* Alt Ignored.
|
||||
*/
|
||||
virtual void handle_key_clear_line(SDLMod modifier, bool& handled) = 0;
|
||||
virtual void handle_key_clear_line(SDL_Keymod modifier, bool& handled) = 0;
|
||||
|
||||
/**
|
||||
* Left arrow key pressed.
|
||||
@ -323,7 +323,7 @@ private:
|
||||
* Shift Selects the text while moving.
|
||||
* Alt Ignored.
|
||||
*/
|
||||
virtual void handle_key_left_arrow(SDLMod modifier, bool& handled);
|
||||
virtual void handle_key_left_arrow(SDL_Keymod modifier, bool& handled);
|
||||
|
||||
/**
|
||||
* Right arrow key pressed.
|
||||
@ -334,7 +334,7 @@ private:
|
||||
* Shift Selects the text while moving.
|
||||
* Alt Ignored.
|
||||
*/
|
||||
virtual void handle_key_right_arrow(SDLMod modifier, bool& handled);
|
||||
virtual void handle_key_right_arrow(SDL_Keymod modifier, bool& handled);
|
||||
|
||||
/**
|
||||
* Home key pressed.
|
||||
@ -346,7 +346,7 @@ private:
|
||||
* Shift Selects the text while moving.
|
||||
* Alt Ignored.
|
||||
*/
|
||||
virtual void handle_key_home(SDLMod modifier, bool& handled);
|
||||
virtual void handle_key_home(SDL_Keymod modifier, bool& handled);
|
||||
|
||||
/**
|
||||
* End key pressed.
|
||||
@ -356,7 +356,7 @@ private:
|
||||
* Shift Selects the text while moving.
|
||||
* Alt Ignored.
|
||||
*/
|
||||
virtual void handle_key_end(SDLMod modifier, bool& handled);
|
||||
virtual void handle_key_end(SDL_Keymod modifier, bool& handled);
|
||||
|
||||
/**
|
||||
* Backspace key pressed.
|
||||
@ -367,7 +367,7 @@ private:
|
||||
* Shift Ignored.
|
||||
* Alt Ignored.
|
||||
*/
|
||||
virtual void handle_key_backspace(SDLMod modifier, bool& handled);
|
||||
virtual void handle_key_backspace(SDL_Keymod modifier, bool& handled);
|
||||
|
||||
/**
|
||||
* Delete key pressed.
|
||||
@ -381,7 +381,7 @@ private:
|
||||
* Shift Ignored.
|
||||
* Alt Ignored.
|
||||
*/
|
||||
virtual void handle_key_delete(SDLMod modifier, bool& handled);
|
||||
virtual void handle_key_delete(SDL_Keymod modifier, bool& handled);
|
||||
|
||||
/**
|
||||
* Page up key.
|
||||
@ -391,7 +391,7 @@ private:
|
||||
* Shift Ignored.
|
||||
* Alt Ignored.
|
||||
*/
|
||||
virtual void handle_key_page_up(SDLMod /*modifier*/, bool& /*handled*/)
|
||||
virtual void handle_key_page_up(SDL_Keymod /*modifier*/, bool& /*handled*/)
|
||||
{
|
||||
}
|
||||
|
||||
@ -403,7 +403,7 @@ private:
|
||||
* Shift Ignored.
|
||||
* Alt Ignored.
|
||||
*/
|
||||
virtual void handle_key_page_down(SDLMod /*modifier*/, bool& /*handled*/)
|
||||
virtual void handle_key_page_down(SDL_Keymod /*modifier*/, bool& /*handled*/)
|
||||
{
|
||||
}
|
||||
|
||||
@ -421,8 +421,8 @@ protected:
|
||||
* Alt Ignored.
|
||||
*/
|
||||
virtual void handle_key_default(bool& handled,
|
||||
SDLKey key,
|
||||
SDLMod modifier,
|
||||
SDL_Keycode key,
|
||||
SDL_Keymod modifier,
|
||||
const utf8::string& unicode);
|
||||
|
||||
private:
|
||||
@ -444,8 +444,8 @@ private:
|
||||
|
||||
void signal_handler_sdl_key_down(const event::tevent event,
|
||||
bool& handled,
|
||||
const SDLKey key,
|
||||
SDLMod modifier,
|
||||
const SDL_Keycode key,
|
||||
SDL_Keymod modifier,
|
||||
const utf8::string& unicode);
|
||||
|
||||
void signal_handler_receive_keyboard_focus(const event::tevent event);
|
||||
|
@ -298,8 +298,8 @@ bool ttext_box::history_down()
|
||||
}
|
||||
|
||||
void ttext_box::handle_key_default(bool& handled,
|
||||
SDLKey key,
|
||||
SDLMod modifier,
|
||||
SDL_Keycode key,
|
||||
SDL_Keymod modifier,
|
||||
const utf8::string& unicode)
|
||||
{
|
||||
if(key == SDLK_TAB && (modifier & KMOD_CTRL)) {
|
||||
@ -316,7 +316,7 @@ void ttext_box::handle_key_default(bool& handled,
|
||||
}
|
||||
}
|
||||
|
||||
void ttext_box::handle_key_clear_line(SDLMod /*modifier*/, bool& handled)
|
||||
void ttext_box::handle_key_clear_line(SDL_Keymod /*modifier*/, bool& handled)
|
||||
{
|
||||
handled = true;
|
||||
|
||||
|
@ -217,7 +217,7 @@ private:
|
||||
* Shift Ignored.
|
||||
* Alt Ignored.
|
||||
*/
|
||||
void handle_key_up_arrow(SDLMod /*modifier*/, bool& /*handled*/) override
|
||||
void handle_key_up_arrow(SDL_Keymod /*modifier*/, bool& /*handled*/) override
|
||||
{
|
||||
}
|
||||
|
||||
@ -229,7 +229,7 @@ private:
|
||||
* Shift Ignored.
|
||||
* Alt Ignored.
|
||||
*/
|
||||
void handle_key_down_arrow(SDLMod /*modifier*/, bool& /*handled*/) override
|
||||
void handle_key_down_arrow(SDL_Keymod /*modifier*/, bool& /*handled*/) override
|
||||
{
|
||||
}
|
||||
|
||||
@ -249,12 +249,12 @@ private:
|
||||
|
||||
/** Inherited from ttext_. */
|
||||
void handle_key_default(bool& handled,
|
||||
SDLKey key,
|
||||
SDLMod modifier,
|
||||
SDL_Keycode key,
|
||||
SDL_Keymod modifier,
|
||||
const utf8::string& unicode) override;
|
||||
|
||||
/** Inherited from ttext_. */
|
||||
void handle_key_clear_line(SDLMod modifier, bool& handled) override;
|
||||
void handle_key_clear_line(SDL_Keymod modifier, bool& handled) override;
|
||||
|
||||
/** See @ref tcontrol::get_control_type. */
|
||||
virtual const std::string& get_control_type() const override;
|
||||
|
@ -224,7 +224,7 @@ bool ttree_view::handle_up_down_arrow()
|
||||
return false;
|
||||
}
|
||||
|
||||
void ttree_view::handle_key_up_arrow(SDLMod modifier, bool& handled)
|
||||
void ttree_view::handle_key_up_arrow(SDL_Keymod modifier, bool& handled)
|
||||
{
|
||||
if(handle_up_down_arrow<&ttree_view_node::get_selectable_node_above>()) {
|
||||
handled = true;
|
||||
@ -234,7 +234,7 @@ void ttree_view::handle_key_up_arrow(SDLMod modifier, bool& handled)
|
||||
}
|
||||
}
|
||||
|
||||
void ttree_view::handle_key_down_arrow(SDLMod modifier, bool& handled)
|
||||
void ttree_view::handle_key_down_arrow(SDL_Keymod modifier, bool& handled)
|
||||
{
|
||||
if(handle_up_down_arrow<&ttree_view_node::get_selectable_node_below>()) {
|
||||
handled = true;
|
||||
@ -245,7 +245,7 @@ void ttree_view::handle_key_down_arrow(SDLMod modifier, bool& handled)
|
||||
}
|
||||
|
||||
|
||||
void ttree_view::handle_key_left_arrow(SDLMod modifier, bool& handled)
|
||||
void ttree_view::handle_key_left_arrow(SDL_Keymod modifier, bool& handled)
|
||||
{
|
||||
ttree_view_node* selected = selected_item();
|
||||
if(!selected || selected->is_folded()) {
|
||||
@ -256,7 +256,7 @@ void ttree_view::handle_key_left_arrow(SDLMod modifier, bool& handled)
|
||||
handled = true;
|
||||
}
|
||||
|
||||
void ttree_view::handle_key_right_arrow(SDLMod modifier, bool& handled)
|
||||
void ttree_view::handle_key_right_arrow(SDL_Keymod modifier, bool& handled)
|
||||
{
|
||||
ttree_view_node* selected = selected_item();
|
||||
if(!selected || !selected->is_folded()) {
|
||||
|
@ -99,16 +99,16 @@ public:
|
||||
protected:
|
||||
/***** ***** ***** ***** keyboard functions ***** ***** ***** *****/
|
||||
/** Inherited from tscrollbar_container. */
|
||||
void handle_key_up_arrow(SDLMod modifier, bool& handled) override;
|
||||
void handle_key_up_arrow(SDL_Keymod modifier, bool& handled) override;
|
||||
|
||||
/** Inherited from tscrollbar_container. */
|
||||
void handle_key_down_arrow(SDLMod modifier, bool& handled) override;
|
||||
void handle_key_down_arrow(SDL_Keymod modifier, bool& handled) override;
|
||||
|
||||
/** Inherited from tscrollbar_container. */
|
||||
void handle_key_left_arrow(SDLMod modifier, bool& handled) override;
|
||||
void handle_key_left_arrow(SDL_Keymod modifier, bool& handled) override;
|
||||
|
||||
/** Inherited from tscrollbar_container. */
|
||||
void handle_key_right_arrow(SDLMod modifier, bool& handled) override;
|
||||
void handle_key_right_arrow(SDL_Keymod modifier, bool& handled) override;
|
||||
private:
|
||||
/**
|
||||
* @todo evaluate which way the dependancy should go.
|
||||
|
@ -391,7 +391,7 @@ twindow::twindow(CVideo& video,
|
||||
connect_signal<event::SDL_KEY_DOWN>(
|
||||
std::bind(
|
||||
&twindow::signal_handler_sdl_key_down, this, _2, _3, _5),
|
||||
event::tdispatcher::back_pre_child);
|
||||
event::tdispatcher::back_post_child);
|
||||
connect_signal<event::SDL_KEY_DOWN>(std::bind(
|
||||
&twindow::signal_handler_sdl_key_down, this, _2, _3, _5));
|
||||
|
||||
@ -1409,11 +1409,12 @@ void twindow::signal_handler_click_dismiss(const event::tevent event,
|
||||
|
||||
void twindow::signal_handler_sdl_key_down(const event::tevent event,
|
||||
bool& handled,
|
||||
SDLKey key)
|
||||
SDL_Keycode key)
|
||||
{
|
||||
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n";
|
||||
|
||||
if(!enter_disabled_ && (key == SDLK_KP_ENTER || key == SDLK_RETURN)) {
|
||||
std::cerr << "window key handler fires\n";
|
||||
set_retval(OK);
|
||||
handled = true;
|
||||
} else if(key == SDLK_ESCAPE && !escape_disabled_) {
|
||||
|
@ -776,7 +776,7 @@ private:
|
||||
|
||||
void signal_handler_sdl_key_down(const event::tevent event,
|
||||
bool& handled,
|
||||
const SDLKey key);
|
||||
const SDL_Keycode key);
|
||||
|
||||
void signal_handler_message_show_tooltip(const event::tevent event,
|
||||
bool& handled,
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
|
||||
/**
|
||||
* Set keyboard modifiers.
|
||||
* @param mods Bitmask of SDLMod.
|
||||
* @param mods Bitmask of SDL_Keymod.
|
||||
*/
|
||||
void set_mods(unsigned int mods)
|
||||
{
|
||||
|
@ -14,13 +14,12 @@
|
||||
|
||||
#include "global.hpp"
|
||||
#include "key.hpp"
|
||||
#include "sdl/compat.hpp"
|
||||
|
||||
#include <SDL_keyboard.h>
|
||||
#include <SDL_version.h>
|
||||
|
||||
CKey::CKey() :
|
||||
key_list(SDL_GetKeyState(nullptr))
|
||||
key_list(SDL_GetKeyboardState(nullptr))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,43 +0,0 @@
|
||||
/*
|
||||
Copyright (C) 2014 - 2016 by Mark de Wever <koraq@xs4all.nl>
|
||||
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY.
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
#ifndef SDL_COMPAT_HPP_INCLUDED
|
||||
#define SDL_COMPAT_HPP_INCLUDED
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Compatibility layer for using SDL 1.2 and 2.0.
|
||||
*
|
||||
* Only has some minimal wrapping for the changes. The layer can be removed once
|
||||
* we switch to SDL 2.0.
|
||||
*/
|
||||
|
||||
#include <SDL_version.h>
|
||||
|
||||
|
||||
#define SDLKey SDL_Keycode
|
||||
#define SDLMod SDL_Keymod
|
||||
#define SDL_keysym SDL_Keysym
|
||||
#define SDL_GetKeyState SDL_GetKeyboardState
|
||||
#define SDLK_LMETA SDLK_LGUI
|
||||
#define SDLK_RMETA SDLK_RGUI
|
||||
#define KMOD_LMETA KMOD_LGUI
|
||||
#define KMOD_RMETA KMOD_RGUI
|
||||
#define KMOD_META KMOD_GUI
|
||||
#define SDL_FULLSCREEN SDL_WINDOW_FULLSCREEN_DESKTOP
|
||||
#define SDL_EVENTMASK(EVENT) EVENT, EVENT
|
||||
#define SDL_GetAppState CVideo::get_singleton().window_state
|
||||
|
||||
|
||||
#endif
|
@ -99,7 +99,7 @@ SDL_Color create_color(const unsigned char red
|
||||
return result;
|
||||
}
|
||||
|
||||
SDLKey sdl_keysym_from_name(std::string const &keyname)
|
||||
SDL_Keycode sdl_keysym_from_name(std::string const &keyname)
|
||||
{
|
||||
return SDL_GetKeyFromName(keyname.c_str());
|
||||
}
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
#include "scoped_resource.hpp"
|
||||
#include "util.hpp"
|
||||
#include "sdl/compat.hpp"
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
@ -47,7 +46,7 @@
|
||||
#define SDL_BUTTON_WHEELRIGHT 7
|
||||
#endif
|
||||
|
||||
SDLKey sdl_keysym_from_name(std::string const &keyname);
|
||||
SDL_Keycode sdl_keysym_from_name(std::string const &keyname);
|
||||
|
||||
|
||||
struct surface
|
||||
|
@ -20,6 +20,5 @@
|
||||
#include <SDL.h>
|
||||
|
||||
#include "events.hpp"
|
||||
#include "sdl/compat.hpp"
|
||||
|
||||
#endif
|
||||
|
@ -184,7 +184,7 @@ public:
|
||||
void update_framebuffer();
|
||||
|
||||
/**
|
||||
* Wrapper for SDL_GetAppState.
|
||||
* Wrapper for CVideo::get_singleton().window_state.
|
||||
*/
|
||||
Uint8 window_state();
|
||||
|
||||
|
@ -584,7 +584,7 @@ void menu::reset_selection()
|
||||
set_selection_pos(0, true);
|
||||
}
|
||||
|
||||
void menu::key_press(SDLKey key)
|
||||
void menu::key_press(SDL_Keycode key)
|
||||
{
|
||||
if (!click_selects_) {
|
||||
switch(key) {
|
||||
@ -629,7 +629,7 @@ bool menu::requires_event_focus(const SDL_Event* event) const
|
||||
}
|
||||
|
||||
if(event->type == SDL_KEYDOWN) {
|
||||
SDLKey key = event->key.keysym.sym;
|
||||
SDL_Keycode key = event->key.keysym.sym;
|
||||
if (!click_selects_) {
|
||||
switch(key) {
|
||||
case SDLK_UP:
|
||||
@ -699,8 +699,7 @@ void menu::handle_event(const SDL_Event& event)
|
||||
// this double click was generated from a click that
|
||||
// already has helped in generating a double click.
|
||||
SDL_Event ev;
|
||||
SDL_PeepEvents(&ev, 1, SDL_PEEKEVENT,
|
||||
SDL_EVENTMASK(DOUBLE_CLICK_EVENT));
|
||||
SDL_PeepEvents(&ev, 1, SDL_PEEKEVENT, DOUBLE_CLICK_EVENT, DOUBLE_CLICK_EVENT);
|
||||
if (ev.type == DOUBLE_CLICK_EVENT) {
|
||||
ignore_next_doubleclick_ = true;
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ private:
|
||||
mutable int max_items_, item_height_;
|
||||
|
||||
void adjust_viewport_to_selection();
|
||||
void key_press(SDLKey key);
|
||||
void key_press(SDL_Keycode key);
|
||||
|
||||
std::vector<item> items_;
|
||||
std::vector<size_t> item_pos_;
|
||||
|
@ -278,7 +278,7 @@ bool slider::requires_event_focus(const SDL_Event* event) const
|
||||
}
|
||||
|
||||
if(event->type == SDL_KEYDOWN) {
|
||||
SDLKey key = event->key.keysym.sym;
|
||||
SDL_Keycode key = event->key.keysym.sym;
|
||||
switch(key) {
|
||||
case SDLK_LEFT:
|
||||
case SDLK_RIGHT:
|
||||
@ -317,7 +317,7 @@ void slider::handle_event(const SDL_Event& event)
|
||||
break;
|
||||
case SDL_KEYDOWN:
|
||||
if(focus(&event) && allow_key_events()) { //allow_key_events is used by zoom_sliders to disable left-right key press, which is buggy for them
|
||||
const SDL_keysym& key = reinterpret_cast<const SDL_KeyboardEvent&>(event).keysym;
|
||||
const SDL_Keysym& key = reinterpret_cast<const SDL_KeyboardEvent&>(event).keysym;
|
||||
const int c = key.sym;
|
||||
if(c == SDLK_LEFT) {
|
||||
sound::play_UI_sound(game_config::sounds::slider_adjust);
|
||||
|
@ -402,7 +402,7 @@ void textbox::erase_selection()
|
||||
namespace {
|
||||
const unsigned int copypaste_modifier =
|
||||
#ifdef __APPLE__
|
||||
KMOD_LMETA | KMOD_RMETA
|
||||
KMOD_LGUI | KMOD_RGUI
|
||||
#else
|
||||
KMOD_CTRL
|
||||
#endif
|
||||
@ -420,7 +420,7 @@ bool textbox::requires_event_focus(const SDL_Event* event) const
|
||||
}
|
||||
|
||||
if(event->type == SDL_KEYDOWN) {
|
||||
SDLKey key = event->key.keysym.sym;
|
||||
SDL_Keycode key = event->key.keysym.sym;
|
||||
switch(key) {
|
||||
case SDLK_UP:
|
||||
case SDLK_DOWN:
|
||||
@ -471,8 +471,8 @@ bool textbox::handle_key_down(const SDL_Event &event)
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
const SDL_keysym& key = reinterpret_cast<const SDL_KeyboardEvent&>(event).keysym;
|
||||
const SDLMod modifiers = SDL_GetModState();
|
||||
const SDL_Keysym& key = reinterpret_cast<const SDL_KeyboardEvent&>(event).keysym;
|
||||
const SDL_Keymod modifiers = SDL_GetModState();
|
||||
|
||||
const int c = key.sym;
|
||||
const int old_cursor = cursor_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user