+ Warn if a user's running certain X.Org releases which have the RECORD

extension broken.
This commit is contained in:
Konstantin Isakov 2009-09-29 13:01:05 +00:00
parent 0fd5ddee85
commit 230ab47891
5 changed files with 71 additions and 2 deletions

30
src/broken_xrecord.cc Normal file
View file

@ -0,0 +1,30 @@
/* This file is (c) 2008-2009 Konstantin Isakov <ikm@users.berlios.de>
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
#include "broken_xrecord.hh"
#include <QtGui>
#ifdef Q_WS_X11
#include <X11/Xlib.h>
#include <X11/extensions/record.h>
#include <QX11Info>
#endif
bool isRECORDBroken()
{
#ifdef Q_WS_X11
char const * vendor = ServerVendor( QX11Info::display() );
if ( vendor && strstr( vendor, "X.Org" ) )
{
int release = VendorRelease( QX11Info::display() );
return release >= 10600000 && release < 10701000;
}
#endif
return false;
}

13
src/broken_xrecord.hh Normal file
View file

@ -0,0 +1,13 @@
/* This file is (c) 2008-2009 Konstantin Isakov <ikm@users.berlios.de>
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
#ifndef __BROKEN_XRECORD_HH_INCLUDED__
#define __BROKEN_XRECORD_HH_INCLUDED__
/// Returns true if the RECORD extension is likely to be broken. Under Windows
/// it always returns false.
/// This function is to be removed once the RECORD extension is working again
/// on all the major distributions.
bool isRECORDBroken();
#endif

View file

@ -118,7 +118,8 @@ HEADERS += folding.hh \
website.hh \
orderandprops.hh \
language.hh \
dictionarybar.hh
dictionarybar.hh \
broken_xrecord.hh
FORMS += groups.ui \
dictgroupwidget.ui \
mainwindow.ui \
@ -188,7 +189,8 @@ SOURCES += folding.cc \
website.cc \
orderandprops.cc \
language.cc \
dictionarybar.cc
dictionarybar.cc \
broken_xrecord.cc
win32 {
SOURCES += mouseover_win32/ThTypes.c
HEADERS += mouseover_win32/ThTypes.h

View file

@ -3,6 +3,7 @@
#include "language.hh"
#include "langcoder.hh"
#include <QMessageBox>
#include "broken_xrecord.hh"
Preferences::Preferences( QWidget * parent, Config::Preferences const & p ):
QDialog( parent ), prevInterfaceLanguage( 0 )
@ -135,6 +136,9 @@ Preferences::Preferences( QWidget * parent, Config::Preferences const & p ):
ui.audioPlaybackProgramLabel->hide();
#endif
if ( !isRECORDBroken() )
ui.brokenXRECORD->hide();
// Proxy server
ui.useProxyServer->setChecked( p.proxyServer.enabled );

View file

@ -645,6 +645,26 @@ seconds, which is specified here.</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="brokenXRECORD">
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; color:#ff0000;&quot;&gt;Note: You appear to be running an X.Org XServer release which has the RECORD extension broken. Hotkeys in GoldenDict will probably not work. This must be fixed in the server itself. Please refer to the following &lt;/span&gt;&lt;a href=&quot;https://bugs.freedesktop.org/show_bug.cgi?id=20500&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;bug entry&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; color:#ff0000;&quot;&gt; and leave a comment there if you like.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_12">
<property name="orientation">