[Build] Cleanup files in src/common

* Remove unused files.
* Move files used only by the SDL frontend to the sdl folder.
* Remove contains.h in favor of manual iterator parsing.
This commit is contained in:
Fabrice de Gans 2024-03-15 13:50:56 -07:00 committed by Fabrice de Gans
parent 8f92d99968
commit 2f10e71f1d
18 changed files with 87 additions and 783 deletions

View File

@ -393,10 +393,9 @@ set(
SRC_MAIN
src/Util.cpp
src/Util_common.cpp
src/common/dictionary.c
src/common/iniparser.c
src/common/Patch.cpp
src/common/SoundSDL.cpp
src/common/version.cpp
)
if(MSVC)
@ -408,12 +407,11 @@ set(
src/System.h
src/Util.h
src/common/array.h
src/common/dictionary.h
src/common/iniparser.h
src/common/Port.h
src/common/sizes.h
src/common/SoundDriver.h
src/common/SoundSDL.h
src/common/version_cpp.h
)
if(MSVC)
@ -542,25 +540,27 @@ set(
set(
SRC_SDL
src/sdl/ConfigManager.cpp
src/sdl/SDL.cpp
src/sdl/filters.cpp
src/sdl/text.cpp
src/sdl/inputSDL.cpp
src/sdl/dictionary.c
src/sdl/expr.cpp
src/sdl/exprNode.cpp
src/sdl/expr-lex.cpp
src/common/version.cpp
src/sdl/filters.cpp
src/sdl/iniparser.c
src/sdl/inputSDL.cpp
src/sdl/SDL.cpp
src/sdl/text.cpp
)
set(
HDR_SDL
src/sdl/ConfigManager.h
src/sdl/filters.h
src/sdl/text.h
src/sdl/inputSDL.h
src/sdl/dictionary.h
src/sdl/expr.cpp.h
src/sdl/exprNode.h
src/common/version_cpp.h
src/sdl/filters.h
src/sdl/iniparser.h
src/sdl/inputSDL.h
src/sdl/text.h
)
set(

View File

@ -1,11 +0,0 @@
#ifndef VBAM_BSD_H
#define VBAM_BSD_H
#define fopen64 fopen
#define fseeko64 fseeko
#define fseek64 fseek
#define ftell64 ftell
#define ftello64 ftello
#endif // VBAM_BSD_H

View File

@ -11,7 +11,11 @@
#if defined(__FreeBSD__) || defined(__NetBSD__)
#include <sys/param.h>
#include "BSD.h"
#define fopen64 fopen
#define fseeko64 fseeko
#define fseek64 fseek
#define ftell64 ftell
#define ftello64 ftello
#endif
#ifndef __LIBRETRO__

View File

@ -1,8 +1,7 @@
#ifndef PATCH_H
#define PATCH_H
#include "../Util.h"
#include "Types.h"
#include <cstdint>
bool applyPatch(const char *patchname, uint8_t **rom, int *size);

View File

@ -18,11 +18,16 @@
#ifndef __VBA_TYPES_H__
#define __VBA_TYPES_H__
#ifdef __LIBRETRO__
#include <stdint.h>
#else
#if defined(__LIBRETRO__)
#include <cstdint>
#else // !defined(__LIBRETRO__)
#include <cstdint>
#include <zlib.h>
#include "cstdint.h"
#endif
#endif // defined(__LIBRETRO__)
#endif // __VBA_TYPES_H__

View File

@ -1,10 +0,0 @@
#ifndef CONTAINS_HPP_
#define CONTAINS_HPP_
template <class C, class V>
bool contains(const C& container, const V& val)
{
return (container.find(val) != container.end());
}
#endif /* CONTAINS_HPP_ */

View File

@ -1,18 +0,0 @@
#ifndef CSTDINT_H
#define CSTDINT_H
#if defined(__has_include)
# if __has_include(<cstdint>)
# include <cstdint>
// necessary on Mac OS X Lion 10.7 or any clang <= 3.0
# elif __has_include(<tr1/cstdint>)
# include <tr1/cstdint>
# else
// throw error
# include <cstdint>
# endif
#else
# include <cstdint>
#endif
#endif // CSTDINT_H

View File

@ -1,669 +0,0 @@
/*
Range
=====
Copyright (c) 2009-2011 Khaled Alshaya
Distributed under the Boost Software License, version 1.0
(See the license at: http://www.boost.org/license_1_0.txt).
*/
/*
Rationale
=========
In Python, there is a beautiful function called "range".
"range" allows the programmer to iterate over a range elegantly.
This concept is not as general as "for-loops" in C++,
but non the less, it expresses the intent of the programmer
clearer than the general "for-loops" in many cases.
Design
======
Range is made to be STL-like library. In fact, it is
built on top of the concepts of STL. The library is designed to
work with STL algorithms as well. Range is more flexible
than the Python "range", because:
Range is an "immutable ordered random access container"
Specifications
==============
Range satisfies the following requirements:
* Immutable.
* Random Access Container.
* Random Access Iterator Interface.
* Constant Time Complexity Operations.
Range models an ordered sequence of elements,
where a range is defined by:
[begin, end)
* begin: the first element in the range. (Inclusive)
* end : the last element in the range. (Exclusive)
* step : the distance between two consecutive elements in a range.
where each element in the range is defined by:
element = begin + step * i
* i: is the index of the element in range.
The following precondition must be met for the sequence
to be a valid range:
step != 0
&&
(
begin <= end && step > 0
||
begin >= end && step < 0
)
Portability
===========
Range Generator is written in standard C++ (C++98). It depends
-only- on the standard C++ library.
*/
#ifndef range_h__
#define range_h__
// using std::range
// using std::size_t from <cstddef>
// using std::ceil from <cmath>
#include <iterator>
#include <stdexcept>
#include <cstddef>
#include <cmath>
namespace Range
{
template <class IntegerType>
struct basic_range
{
struct const_iterator_impl
{
typedef IntegerType value_type;
typedef std::size_t size_type;
typedef IntegerType difference_type;
typedef value_type* pointer;
typedef value_type& reference;
typedef
std::random_access_iterator_tag
iterator_category;
const_iterator_impl(): r(0), index(0)
{ }
const_iterator_impl(const const_iterator_impl& rhs)
: r(rhs.r), index(rhs.index)
{ }
const_iterator_impl(basic_range<IntegerType> const * p_range, size_type p_index)
:r(p_range), index(p_index)
{ }
const_iterator_impl& operator=(const const_iterator_impl& rhs)
{
r = rhs.r;
index = rhs.index;
return *this;
}
bool operator==(const const_iterator_impl& rhs) const
{
return *r == *(rhs.r) && index == rhs.index;
}
bool operator!=(const const_iterator_impl& rhs) const
{
return !(*this == rhs);
}
bool operator<(const const_iterator_impl& rhs) const
{
return index < rhs.index;
}
bool operator>(const const_iterator_impl& rhs) const
{
return index > rhs.index;
}
bool operator<=(const const_iterator_impl& rhs) const
{
return index <= rhs.index;
}
bool operator>=(const const_iterator_impl& rhs) const
{
return index >= rhs.index;
}
value_type operator*() const
{
return r->m_first_element + r->m_step*index;
}
// operator->
// is not implemented because the value_type is an integer type
// and primitive types in C++ don't define member functions.
const_iterator_impl& operator++()
{
++index;
return *this;
}
const_iterator_impl operator++(int)
{
const_iterator_impl temp = *this;
++index;
return temp;
}
const_iterator_impl& operator--()
{
--index;
return *this;
}
const_iterator_impl operator--(int)
{
const_iterator_impl temp = *this;
--index;
return temp;
}
const_iterator_impl& operator+=(difference_type increment)
{
index += increment;
return *this;
}
// operator+
// is friend operator but operator-
// is not, because we want to allow the following for "+":
// iterator+5
// 5+iterator
// For the "-" it is not correct to do so, because
// iterator-5 != 5-iterator
friend const_iterator_impl operator+
(const const_iterator_impl& lhs, difference_type increment)
{
const_iterator_impl sum;
sum.r = lhs.r;
sum.index = lhs.index + increment;
return sum;
}
const_iterator_impl& operator-=(difference_type decrement)
{
index -= decrement;
return *this;
}
const_iterator_impl operator-(difference_type decrement) const
{
const_iterator_impl shifted_iterator;
shifted_iterator.r = r;
shifted_iterator.index = index - decrement;
return shifted_iterator;
}
difference_type operator-(const const_iterator_impl& rhs) const
{
return index - rhs.index;
}
value_type operator[](difference_type offset) const
{
size_type new_index = index + offset;
return r->m_first_element + r->m_step*new_index;
}
private:
basic_range<IntegerType> const * r;
size_type index;
};
struct const_reverse_iterator_impl
{
typedef IntegerType value_type;
typedef std::size_t size_type;
typedef IntegerType difference_type;
typedef value_type* pointer;
typedef value_type& reference;
typedef
std::random_access_iterator_tag
iterator_category;
const_reverse_iterator_impl(): r(0), index(0)
{ }
const_reverse_iterator_impl(const const_reverse_iterator_impl& rhs)
: r(rhs.r), index(rhs.index)
{ }
const_reverse_iterator_impl(basic_range<IntegerType> const * p_range, size_type p_index)
:r(p_range), index(p_index)
{ }
const_reverse_iterator_impl& operator=(const const_reverse_iterator_impl& rhs)
{
r = rhs.r;
index = rhs.index;
return *this;
}
bool operator==(const const_reverse_iterator_impl& rhs) const
{
return *r == *(rhs.r) && index == rhs.index;
}
bool operator!=(const const_reverse_iterator_impl& rhs) const
{
return !(*this == rhs);
}
bool operator<(const const_reverse_iterator_impl& rhs) const
{
return index < rhs.index;
}
bool operator>(const const_reverse_iterator_impl& rhs) const
{
return index > rhs.index;
}
bool operator<=(const const_reverse_iterator_impl& rhs) const
{
return index <= rhs.index;
}
bool operator>=(const const_reverse_iterator_impl& rhs) const
{
return index >= rhs.index;
}
value_type operator*() const
{
size_type reverse_index
= (r->m_element_count - 1) - index;
return r->m_first_element + r->m_step*reverse_index;
}
// operator->
// is not implemented because the value_type is integer type
// and primitive types in C++ don't define member functions.
const_reverse_iterator_impl& operator++()
{
++index;
return *this;
}
const_reverse_iterator_impl operator++(int)
{
const_reverse_iterator_impl temp = *this;
++index;
return temp;
}
const_reverse_iterator_impl& operator--()
{
--index;
return *this;
}
const_reverse_iterator_impl operator--(int)
{
const_reverse_iterator_impl temp = *this;
--index;
return temp;
}
const_reverse_iterator_impl& operator+=(difference_type increment)
{
index += increment;
return *this;
}
// operator+
// is friend operator but operator-
// is not, because we want to allow the following for "+":
// iterator+5
// 5+iterator
// For the "-" it is not correct to do so, because
// iterator-5 != 5-iterator
friend const_reverse_iterator_impl operator+
(const const_reverse_iterator_impl& lhs, difference_type increment)
{
const_reverse_iterator_impl sum;
sum.r = lhs.r;
sum.index = lhs.index + increment;
return sum;
}
const_reverse_iterator_impl& operator-=(difference_type decrement)
{
index -= decrement;
return *this;
}
const_reverse_iterator_impl operator-(difference_type decrement) const
{
const_reverse_iterator_impl shifted_iterator;
shifted_iterator.r = r;
shifted_iterator.index = index - decrement;
return shifted_iterator;
}
difference_type operator-(const const_reverse_iterator_impl& rhs) const
{
return index - rhs.index;
}
value_type operator[](difference_type offset) const
{
size_type new_reverse_index
= (r->m_element_count - 1) - (index + offset);
return r->m_first_element + r->m_step*new_reverse_index;
}
private:
basic_range<IntegerType> const * r;
size_type index;
};
typedef IntegerType value_type;
typedef const_iterator_impl iterator;
typedef const_iterator_impl const_iterator;
typedef const_reverse_iterator_impl reverse_iterator;
typedef const_reverse_iterator_impl const_reverse_iterator;
typedef value_type& reference;
typedef const value_type& const_reference;
typedef value_type* pointer;
typedef IntegerType difference_type;
typedef std::size_t size_type;
// In the case of default construction,
// the range is considered as an empty range with no elements.
// step can be anything other than 0. 1 is
// an implementation convention, and it doesn't have
// a significance in this case because the range is empty.
basic_range(): m_first_element(0), m_element_count(0), m_step(1)
{ }
// first_element: is begin in specifications.
// last_element: is end in specifications.
basic_range(value_type first_element, value_type last_element, value_type step)
: m_first_element(first_element),
m_step(step)
{
// We need to count the number of elements.
// The only case where a range is invalid,
// when the step=0. It means that the range
// is infinite, because the number of elements
// in a range, is the length of that range
// divided by the difference between
// every two successive elements.
if(step == 0)
throw std::out_of_range("Invalid Range: step can't be equal to zero!");
if(first_element < last_element && step < 0)
throw std::out_of_range("Invalid Range: step can't be backward, while the range is forward!");
if(first_element > last_element && step > 0)
throw std::out_of_range("Invalid Range: step can't be forward, while the range is backward!");
m_element_count = (last_element-first_element)/step;
if( (last_element-first_element)%step != 0 )
++m_element_count;
}
// The following constructor, determines the step
// automatically. If the range is forward, then
// step will be one. If the range is backward,
// step will be minus one. If the begin is equal
// to end, then the step must not equal to zero
// and it is set to one as a convention.
basic_range(value_type first_element, value_type last_element)
: m_first_element(first_element)
{
if(last_element >= first_element) *this = basic_range<IntegerType>(first_element, last_element, 1);
else *this = basic_range<IntegerType>(first_element, last_element, -1);
}
// The following constructor is a shortcut
// if you want the first element as zero.
// the step is determined automatically, based
// on the last element. If the last element is
// positive, then step is one, but if it is negative
// then step is minus one.
basic_range<IntegerType>(value_type last_element)
: m_first_element(0)
{
if(last_element >= m_first_element) *this = basic_range<IntegerType>(m_first_element, last_element, 1);
else *this = basic_range<IntegerType>(m_first_element, last_element, -1);
}
basic_range<IntegerType>(const basic_range<IntegerType>& r)
: m_first_element(r.m_first_element),
m_element_count(r.m_element_count),
m_step(r.m_step)
{ }
basic_range<IntegerType>& operator=(const basic_range<IntegerType>& r)
{
m_first_element = r.m_first_element;
m_element_count = r.m_element_count;
m_step = r.m_step;
return *this;
}
bool operator==(const basic_range<IntegerType>& r) const
{
return m_first_element == r.m_first_element
&&
m_element_count == r.m_element_count
&&
m_step == r.m_step;
}
bool operator!=(const basic_range<IntegerType>& r) const
{
return !(*this == r);
}
// The following four functions enable the user to compare
// ranges using ( <, >, <=, >=).
// The comparison between two ranges is a simple lexicographical
// comparison(element by element). By convention, if two ranges
// R1, R2 where R1 has a smaller number of elements. Then if
// R1 contains more elements but all R1 elements are found in R2
// R1 is considered less than R2.
bool operator<(const basic_range<IntegerType>& r) const
{
// ********** This function needs refactoring.
if(m_element_count == 0 && r.m_element_count == 0)
return false;
if(m_element_count == 0 && r.m_element_count > 0)
return true;
if(m_element_count > 0 && r.m_element_count == 0)
return false;
// At this point, both has at least one element.
if(m_first_element < r.m_first_element)
return true;
if(m_first_element > r.m_first_element)
return false;
// At this point, the first element of both are equal.
if(m_element_count == 1 && r.m_element_count == 1)
return false;
if(m_element_count == 1 && r.m_element_count > 1)
return true;
if(m_element_count > 1 && r.m_element_count == 1)
return false;
// At this point, both have at least two elements with
// a similar first element. Note than the final answer
// in this case depends on the second element only, because
// we don't need to compare the elements further.
// Note that the second element is at (index == 1), because
// the first element is at (index == 0).
if(m_first_element+m_step*1 < r.m_first_element+r.m_step*1)
return true;
if(m_first_element+m_step*1 > r.m_first_element+r.m_step*1)
return false;
// if the first two elements of both ranges are equal, then
// they are co-linear ranges(because the step is constant).
// In that case, they comparison depends only on
// the size of the ranges by convention.
return m_element_count < r.m_element_count;
}
bool operator>(const basic_range<IntegerType>& r) const
{
// ********** This function needs refactoring.
if(m_element_count == 0 && r.m_element_count == 0)
return false;
if(m_element_count == 0 && r.m_element_count > 0)
return false;
if(m_element_count > 0 && r.m_element_count == 0)
return true;
// At this point, both has at least one element.
if(m_first_element < r.m_first_element)
return false;
if(m_first_element > r.m_first_element)
return true;
// At this point, the first element of both are equal.
if(m_element_count == 1 && r.m_element_count == 1)
return false;
if(m_element_count == 1 && r.m_element_count > 1)
return false;
if(m_element_count > 1 && r.m_element_count == 1)
return true;
// At this point, both have at least two elements with
// a similar first element. Note than the final answer
// in this case depends on the second element only, because
// we don't need to compare the elements further.
// Note that the second element is at (index == 1), because
// the first element is at (index == 0).
if(m_first_element+m_step*1 < r.m_first_element+r.m_step*1)
return false;
if(m_first_element+m_step*1 > r.m_first_element+r.m_step*1)
return true;
// if the first two elements of both ranges are equal, then
// they are co-linear ranges(because the step is constant).
// In that case, they comparison depends only on
// the size of the ranges by convention.
return m_element_count > r.m_element_count;
}
bool operator <=(const basic_range<IntegerType>& r) const
{
return !(*this > r);
}
bool operator >=(const basic_range<IntegerType>& r) const
{
return !(*this < r);
}
const_iterator begin() const
{
return const_iterator(this, 0);
}
const_iterator end() const
{
return const_iterator(this, m_element_count);
}
const_reverse_iterator rbegin() const
{
return const_reverse_iterator(this, 0);
}
const_reverse_iterator rend() const
{
return const_reverse_iterator(this, m_element_count);
}
size_type size() const
{
return m_element_count;
}
size_type max_size() const
{
// Because this is an immutable container,
// max_size() == size()
return m_element_count;
}
bool empty() const
{
return m_element_count == 0;
}
// exist() and find() are similar except that
// find() returns the index of the element.
iterator find(value_type element) const
{
value_type element_index = (element - m_first_element) / m_step;
bool in_range = element_index >= 0 && element_index < m_element_count &&
(element - m_first_element) % m_step == 0;
if(in_range)
return begin() + element_index;
return end();
}
bool exist(value_type element) const
{
return find(element) != end();
}
// In the standard, the operator[]
// should return a const reference.
// Because Range Generator doesn't store its elements
// internally, we return a copy of the value.
// In any case, this doesn't affect the semantics of the operator.
value_type operator[](size_type index) const
{
return m_first_element + m_step*index;
}
private:
// m_first_element: begin (see specifications).
// m_element_count: (end - begin) / step
value_type m_first_element, m_element_count, m_step;
};
// This is the default type of range!
typedef basic_range<int> range;
}
#endif // range_h__

View File

@ -5,6 +5,8 @@
#ifndef __ARMDIS_H__
#define __ARMDIS_H__
#include <cstdint>
#define DIS_VIEW_ADDRESS 1
#define DIS_VIEW_CODE 2

View File

@ -1,36 +1,31 @@
#include "ConfigManager.h"
// necessary to get portable strerror_r
#undef _GNU_SOURCE
#include <string.h>
#define _GNU_SOURCE 1
#include "ConfigManager.h"
extern "C" {
#include "../common/iniparser.h"
}
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <cerrno>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <sys/types.h>
#include <sys/stat.h>
#include <cmath>
#include <cerrno>
#include "core/base/file_util.h"
#include "../common/Patch.h"
#include "../gba/GBA.h"
#include "../gba/agbprint.h"
#include "iniparser.h"
#include "../Util.h"
#include "../gb/gbGlobals.h"
#include "../gb/gbSound.h"
#include "../gba/Flash.h"
#include "../gba/Cheats.h"
#include "../gba/remote.h"
#include "../gba/GBA.h"
#include "../gba/RTC.h"
#include "../gba/Sound.h"
#include "../gb/gb.h"
#include "../gb/gbGlobals.h"
#include "../gb/gbCheats.h"
#include "../gb/gbSound.h"
#include "../Util.h"
#include "../gba/agbprint.h"
#include "../gba/remote.h"
#include "core/base/file_util.h"
#ifndef _WIN32
#define GETCWD getcwd

View File

@ -21,7 +21,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//#include <unistd.h>
#ifdef __cplusplus
extern "C" {
#endif
/*---------------------------------------------------------------------------
New types
@ -158,4 +161,8 @@ void dictionary_unset(dictionary *d, const char *key);
/*--------------------------------------------------------------------------*/
void dictionary_dump(dictionary *d, FILE *out);
#ifdef __cplusplus
} // extern "C"
#endif
#endif

View File

@ -27,6 +27,10 @@
#include "dictionary.h"
#ifdef __cplusplus
extern "C" {
#endif
/*-------------------------------------------------------------------------*/
/**
@brief Get number of sections in a dictionary
@ -300,4 +304,8 @@ dictionary *iniparser_load(const char *ininame);
/*--------------------------------------------------------------------------*/
void iniparser_freedict(dictionary *d);
#ifdef __cplusplus
} // extern "C"
#endif
#endif

View File

@ -767,7 +767,6 @@ set(
../sdl/text.cpp
# from external source with minor modifications
widgets/checkedlistctrl.cpp
../common/version.cpp
)
set(ALL_SRC_WX ${SRC_WX})
@ -824,9 +823,6 @@ set(
../sdl/text.h
# from external source with minor modifications
widgets/wx/checkedlistctrl.h
../common/version_cpp.h
../common/range.hpp
../common/contains.h
)
set(ALL_HDR_WX ${HDR_WX})

View File

@ -1,14 +1,26 @@
#include "background-input.h"
#include "../common/contains.h"
#if defined(__WXMSW__)
#include <windows.h>
#elif defined(__WXMAC__)
#else // defined(__WXGTK__)
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include <X11/XKBlib.h>
#include "wayland.h"
#endif // defined(__WXMSW__)
#include <unordered_map>
#define NO_ERROR (wxThread::ExitCode)0
#define ANY_ERROR (wxThread::ExitCode)1
#if defined(__WXMSW__)
#include <windows.h>
/* The following functions are copied from wxWidgets repo file
* `src/msw/window.cpp` that convert a Windows Virtual Key into a
* WX keycode.
@ -22,7 +34,7 @@ int ChooseNormalOrExtended(int lParam, int keyNormal, int keyExtended)
return !lParam || (HIWORD(lParam) & KF_EXTENDED) ? keyExtended : keyNormal;
}
std::unordered_map<int, wxKeyCode> gs_specialKeys =
static const std::unordered_map<int, wxKeyCode> kSpecialKeys =
{
{ VK_CANCEL, WXK_CANCEL },
{ VK_BACK, WXK_BACK },
@ -113,8 +125,9 @@ int VKToWX(WXWORD vk, WXLPARAM lParam, wchar_t *uc)
int wxk;
// check the table first
if (contains(gs_specialKeys, vk)) {
wxk = gs_specialKeys[vk];
const auto iter = kSpecialKeys.find(vk);
if (iter != kSpecialKeys.end()) {
wxk = iter->second;
if (wxk < WXK_START) {
// Unicode code for this key is the same as its ASCII code.
if (uc) *uc = wxk;
@ -247,16 +260,11 @@ int VKToWX(WXWORD vk, WXLPARAM lParam, wchar_t *uc)
#else // defined(__WXGTK__)
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include <X11/XKBlib.h>
#include "wayland.h"
/* The following functions are copied from wxWidgets repo file
* `src/x11/utils.cpp` that convert a XLib keycode into a
* WX keycode.
*/
std::unordered_map<unsigned, int> x11KeySym = {
static const std::unordered_map<unsigned, int> kKeyMap = {
#include "x11keymap.h"
};
@ -459,13 +467,14 @@ int wxUnicodeCharXToWX(unsigned long keySym)
if ((keySym & 0xff000000) == 0x01000000)
return keySym & 0x00ffffff;
if (contains(x11KeySym, keySym))
return x11KeySym[keySym];
const auto iter = kKeyMap.find(keySym);
if (iter != kKeyMap.end())
return iter->second;
return WXK_NONE;
}
#endif
#endif // defined(__WXMSW__)
class BackgroundInput : public wxThread {
public:
@ -576,9 +585,7 @@ wxThread::ExitCode BackgroundInput::CheckKeyboard()
if (xKeySym >= 'a' && xKeySym <= 'z') xKeySym = xKeySym + 'A' - 'a';
//fprintf(stderr, "(%d,%d): %ld - %s --- %d\n", i, j, kSym, XKeysymToString(kSym), xKeySym);
wxKeyEvent ev(wxEVT_KEY_DOWN);
#if wxUSE_UNICODE
ev.m_uniChar = xKeySym;
#endif
ev.m_keyCode = xKeySym;
handler->AddPendingEvent(ev);
}
@ -596,9 +603,7 @@ wxThread::ExitCode BackgroundInput::CheckKeyboard()
if (xKeySym >= 'a' && xKeySym <= 'z') xKeySym = xKeySym + 'A' - 'a';
//fprintf(stderr, "(%d,%d): %ld - %s --- %d\n", i, j, kSym, XKeysymToString(kSym), xKeySym);
wxKeyEvent ev(wxEVT_KEY_UP);
#if wxUSE_UNICODE
ev.m_uniChar = xKeySym;
#endif
ev.m_keyCode = xKeySym;
handler->AddPendingEvent(ev);
}

View File

@ -9,13 +9,6 @@
#include <unordered_map>
#if defined(__WXMSW__)
extern std::unordered_map<int, wxKeyCode> gs_specialKeys;
#elif defined(__WXMAC__)
#else // defined(__WXGTK__)
extern std::unordered_map<unsigned, int> x11KeySym;
#endif
void enableKeyboardBackgroundInput(wxEvtHandler* handler);
void disableKeyboardBackgroundInput();

View File

@ -2,8 +2,6 @@
// these are all the viewer dialogs except for the ones with graphical areas
// they can be instantiated multiple times
#include "../common/cstdint.h"
#include <limits>
#include <wx/ffile.h>