diff --git a/plugins/onepad/CMakeLists.txt b/plugins/onepad/CMakeLists.txt index a3b873ece9..af91c3cf11 100644 --- a/plugins/onepad/CMakeLists.txt +++ b/plugins/onepad/CMakeLists.txt @@ -75,7 +75,6 @@ set(onepadLinuxSources # onepad Linux headers set(onepadLinuxHeaders - ${linux_headers}/linux.h ${linux_headers}/opPanel.h ${linux_headers}/GamepadConfiguration.h ${linux_headers}/JoystickConfiguration.h) diff --git a/plugins/onepad/Linux/dialog.cpp b/plugins/onepad/Linux/dialog.cpp index afd1abdc58..129ff26281 100644 --- a/plugins/onepad/Linux/dialog.cpp +++ b/plugins/onepad/Linux/dialog.cpp @@ -19,6 +19,30 @@ #include "dialog.h" +static std::string KeyName(int pad, int key, int keysym) +{ + if (!keysym) + return ""; + + // Mouse + if (keysym < 10) { + switch (keysym) { + case 0: + return ""; + case 1: + return "Mouse Left"; + case 2: + return "Mouse Middle"; + case 3: + return "Mouse Right"; + default: // Use only number for extra button + return "Mouse " + std::to_string(keysym); + } + } + + return std::string(XKeysymToString(keysym)); +} + // Construtor of Dialog Dialog::Dialog() : wxDialog(NULL, // Parent diff --git a/plugins/onepad/Linux/ini.cpp b/plugins/onepad/Linux/ini.cpp index a761d6aa4c..b2f3e182b2 100644 --- a/plugins/onepad/Linux/ini.cpp +++ b/plugins/onepad/Linux/ini.cpp @@ -24,42 +24,9 @@ #include "GamePad.h" #include "keyboard.h" #include "onepad.h" -#include "linux.h" extern std::string s_strIniPath; -string KeyName(int pad, int key, int keysym) -{ - string tmp; - tmp.resize(28); - - if (keysym) { - if (keysym < 10) { - // mouse - switch (keysym) { - case 1: - sprintf(&tmp[0], "Mouse Left"); - break; - case 2: - sprintf(&tmp[0], "Mouse Middle"); - break; - case 3: - sprintf(&tmp[0], "Mouse Right"); - break; - default: // Use only number for extra button - sprintf(&tmp[0], "Mouse %d", keysym); - } - } else { - // keyboard - char *pstr = XKeysymToString(keysym); - if (pstr != NULL) - tmp = pstr; - } - } - - return tmp; -} - void DefaultKeyboardValues() { set_keyboard_key(0, XK_a, PAD_L2); diff --git a/plugins/onepad/Linux/linux.cpp b/plugins/onepad/Linux/linux.cpp index 6e47e07a6f..0b6a27b0d3 100644 --- a/plugins/onepad/Linux/linux.cpp +++ b/plugins/onepad/Linux/linux.cpp @@ -26,7 +26,7 @@ #include <string.h> #include <gtk/gtk.h> -#include "linux.h" +#include "dialog.h" Display *GSdsp; Window GSwin; diff --git a/plugins/onepad/Linux/linux.h b/plugins/onepad/Linux/linux.h deleted file mode 100644 index 4671aff0ea..0000000000 --- a/plugins/onepad/Linux/linux.h +++ /dev/null @@ -1,26 +0,0 @@ -/* OnePAD - author: arcum42(@gmail.com) - * Copyright (C) 2009 - * - * Based on ZeroPAD, author zerofrog@gmail.com - * Copyright (C) 2006-2007 - * - * 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; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#ifndef __LINUX_H__ -#define __LINUX_H__ -extern void DisplayDialog(); -extern string KeyName(int pad, int key, int keysym = 0); -#endif diff --git a/plugins/onepad/keyboard.h b/plugins/onepad/keyboard.h index 63878f2e5e..beb20aa310 100644 --- a/plugins/onepad/keyboard.h +++ b/plugins/onepad/keyboard.h @@ -26,8 +26,6 @@ #if defined(__unix__) -#include "Linux/linux.h" - extern Display *GSdsp; extern void PollForX11KeyboardInput(); extern bool PollX11KeyboardMouseEvent(u32 &pkey);