Deal with X11 headers mess that causes compilation errors

This commit is contained in:
Tvangeste 2011-06-09 09:29:21 +02:00
parent 649fe9ce0b
commit 2a31365012
3 changed files with 72 additions and 6 deletions

63
fixx11h.h Normal file
View file

@ -0,0 +1,63 @@
// This is a standard way (e.g., in KDE libs) of dealing
// with X11 headers mess.
#ifdef Unsorted
#undef Unsorted
#endif
#ifdef None
#undef None
#endif
#ifdef Bool
#undef Bool
#endif
#ifdef FontChange
#undef FontChange
#endif
#ifdef KeyPress
#undef KeyPress
#endif
#ifdef KeyRelease
#undef KeyRelease
#endif
#ifdef Above
#undef Above
#endif
#ifdef Below
#undef Below
#endif
#ifdef FocusIn
#undef FocusIn
#endif
#ifdef FocusOut
#undef FocusOut
#endif
#ifdef Always
#undef Always
#endif
#ifdef Success
#undef Success
#endif
#ifdef GrayScale
#undef GrayScale
#endif
#ifdef Status
#undef Status
#endif
#ifdef CursorShape
#undef CursorShape
#endif

View file

@ -468,7 +468,7 @@ void MainWindow::mousePressEvent( QMouseEvent *event)
QClipboard::Selection);
ui.translateLine->setText(str);
QKeyEvent ev(QEvent::Type(6)/*QEvent::KeyPress*/, Qt::Key_Enter,
QKeyEvent ev(QEvent::KeyPress, Qt::Key_Enter,
Qt::NoModifier);
QApplication::sendEvent(ui.translateLine, &ev);
}
@ -1413,7 +1413,7 @@ bool MainWindow::eventFilter( QObject * obj, QEvent * ev )
if ( obj == ui.translateLine )
{
if ( ev->type() == /*QEvent::KeyPress*/ 6 )
if ( ev->type() == QEvent::KeyPress )
{
QKeyEvent * keyEvent = static_cast< QKeyEvent * >( ev );
@ -1425,7 +1425,7 @@ bool MainWindow::eventFilter( QObject * obj, QEvent * ev )
}
}
else
if ( ev->type() == /*QEvent::FocusIn*/ 8 ) {
if ( ev->type() == QEvent::FocusIn ) {
QFocusEvent * focusEvent = static_cast< QFocusEvent * >( ev );
// select all on mouse click
@ -1438,7 +1438,7 @@ bool MainWindow::eventFilter( QObject * obj, QEvent * ev )
else
if ( obj == ui.wordList )
{
if ( ev->type() == /*QEvent::KeyPress*/ 6 )
if ( ev->type() == QEvent::KeyPress )
{
QKeyEvent * keyEvent = static_cast< QKeyEvent * >( ev );
@ -1485,7 +1485,7 @@ bool MainWindow::eventFilter( QObject * obj, QEvent * ev )
}
else
if (obj == ui.dictsList) {
if ( ev->type() == /*QEvent::KeyPress*/ 6 )
if ( ev->type() == QEvent::KeyPress )
{
QKeyEvent * keyEvent = static_cast< QKeyEvent * >( ev );

View file

@ -19,11 +19,14 @@
#include "scanpopup.hh"
#include "articleview.hh"
#include "wordfinder.hh"
#include "hotkeywrapper.hh"
#include "dictionarybar.hh"
#include "history.hh"
#include "hotkeywrapper.hh"
#ifdef Q_WS_X11
#include <fixx11h.h>
#endif
using std::string;
using std::vector;