[education/rkward] rkward: Implement canGenIdle, and provide slightly more informative message in case of GE version mismatches.
Thomas Friedrichsmeier
null at kde.org
Sun Apr 3 16:25:45 BST 2022
Git commit 89e15d3dc371b57f76059bc049d2b7f88c21e0ca by Thomas Friedrichsmeier.
Committed on 03/04/2022 at 15:25.
Pushed by tfry into branch 'master'.
Implement canGenIdle, and provide slightly more informative message in case of GE version mismatches.
A +16 -0 rkward/pages/rkward_incompatible_version.rkh
M +8 -0 rkward/rbackend/rkrbackend.cpp
M +2 -0 rkward/rbackend/rkrbackend.h
M +2 -2 rkward/rbackend/rkrinterface.cpp
M +6 -1 rkward/rbackend/rkwarddevice/rkgraphicsdevice_setup.cpp
M +4 -2 rkward/rbackend/rkwarddevice/rkgraphicsdevice_stubs.cpp
https://invent.kde.org/education/rkward/commit/89e15d3dc371b57f76059bc049d2b7f88c21e0ca
diff --git a/rkward/pages/rkward_incompatible_version.rkh b/rkward/pages/rkward_incompatible_version.rkh
new file mode 100644
index 00000000..c489d063
--- /dev/null
+++ b/rkward/pages/rkward_incompatible_version.rkh
@@ -0,0 +1,16 @@
+<!DOCTYPE rkhelp>
+<document>
+ <title>Version incompatibilities</title>
+ <summary>
+While RKWard tries to support a large number of different R versions, some of the time, a new version of R will not be compatible with RKWard out of the box. In these cases you will have to install a new version of RKWard. Quite often, this does not actually have to be a <i>new</i> version, but simply one that was compiled against your new version of R.
+
+If you have installed RKWard using the package manager of your Linux distribution, but no updated package is available, please contact your distribution maintainer or file a bug report, there.
+
+For more information about available versions, and more troubleshooting information, see <link href="https://rkward.kde.org">the project homepage</link>.
+ </summary>
+
+ <section title="Graphics Engine Version Mismatch" id="ge_version_mismatch">
+This is the most common kind of version incompatibility. The same advice applies as above, i.e. please install an updated version of RKWard. However, if no update appears to be immediately available,
+and you are desparate to continue working, set <link href="rkward://settings/graphics">Settings->Onscreen Graphics</link>->"Integration of R standard device" to "No integration". Then you can use the vanille onscreen devices (X11() or Windows() or Quartz()), for plotting.
+ </section>
+</document>
diff --git a/rkward/rbackend/rkrbackend.cpp b/rkward/rbackend/rkrbackend.cpp
index d415a5b1..341c50ae 100644
--- a/rkward/rbackend/rkrbackend.cpp
+++ b/rkward/rbackend/rkrbackend.cpp
@@ -1809,3 +1809,11 @@ bool RKRBackend::doMSleep (int msecs) {
return true;
}
+bool RKRBackend::graphicsEngineMismatchMessage(int compiled_version, int runtime_version) {
+ static bool shown = false;
+ if (!shown) {
+ shown = true;
+ doDialogHelper(i18n("Graphics version mismatch"), i18n("R Graphics Engine version has changed (from %1 to %2).<br>This change requires a recompilation.<br><a href=\"rkward://page/rkward_incompatible_version\">Additional information</a>", compiled_version, runtime_version), i18n("Ok"), QString(), QString(), QString(), true);
+ }
+ return false;
+}
diff --git a/rkward/rbackend/rkrbackend.h b/rkward/rbackend/rkrbackend.h
index 74780a95..f60bfff9 100644
--- a/rkward/rbackend/rkrbackend.h
+++ b/rkward/rbackend/rkrbackend.h
@@ -202,6 +202,8 @@ handleHistoricalSubstackRequest(). Exactly which requests get handled by which f
RCommandProxy *pending_priority_command;
QMutex priority_command_mutex;
int r_version;
+
+ bool graphicsEngineMismatchMessage(int compiled_version, int runtime_version);
private:
void clearPendingInterrupt ();
protected:
diff --git a/rkward/rbackend/rkrinterface.cpp b/rkward/rbackend/rkrinterface.cpp
index cb28b92d..2b5427d2 100644
--- a/rkward/rbackend/rkrinterface.cpp
+++ b/rkward/rbackend/rkrinterface.cpp
@@ -2,7 +2,7 @@
rkrinterface.cpp - description
-------------------
begin : Fri Nov 1 2002
- copyright : (C) 2002-2020 by Thomas Friedrichsmeier
+ copyright : (C) 2002-2022 by Thomas Friedrichsmeier
email : thomas.friedrichsmeier at kdemail.net
***************************************************************************/
@@ -802,7 +802,7 @@ void RInterface::processRBackendRequest (RBackendRequest *request) {
}
bool synchronous = request->synchronous || (button_count > 1);
- KMessageBox::createKMessageBox (dialog, button_box, button_count < 2 ? QMessageBox::Information : QMessageBox::Question, message, QStringList (), QString (), 0, KMessageBox::Notify | KMessageBox::NoExec);
+ KMessageBox::createKMessageBox (dialog, button_box, button_count < 2 ? QMessageBox::Information : QMessageBox::Question, message, QStringList (), QString (), 0, KMessageBox::Notify | KMessageBox::NoExec | KMessageBox::AllowLink);
dialog->setWindowTitle (caption);
if (!synchronous) {
diff --git a/rkward/rbackend/rkwarddevice/rkgraphicsdevice_setup.cpp b/rkward/rbackend/rkwarddevice/rkgraphicsdevice_setup.cpp
index c6ef49f3..0b02f2e6 100644
--- a/rkward/rbackend/rkwarddevice/rkgraphicsdevice_setup.cpp
+++ b/rkward/rbackend/rkwarddevice/rkgraphicsdevice_setup.cpp
@@ -24,6 +24,7 @@
***************************************************************************/
#include "../rkrsupport.h"
+#include "../rkrbackend.h"
#ifdef TRUE
# undef TRUE
@@ -75,7 +76,10 @@ void RKStartGraphicsDevice (double width, double height, double pointsize, const
desc->width = width;
desc->height = height;
- R_GE_checkVersionOrDie (R_GE_version);
+ if (R_GE_getVersion() == R_GE_version) {
+ RKRBackend::this_pointer->graphicsEngineMismatchMessage(R_GE_version, R_GE_getVersion());
+ Rf_error("Graphics version mismatch");
+ }
R_CheckDeviceAvailable ();
pDevDesc dev;
BEGIN_SUSPEND_INTERRUPTS {
@@ -183,6 +187,7 @@ bool RKGraphicsDeviceDesc::init (pDevDesc dev, double pointsize, const QStringLi
dev->canGenMouseMove = TRUE;
dev->canGenMouseUp = TRUE;
dev->canGenKeybd = TRUE;
+ dev->canGenIdle = TRUE;
// gettingEvent; This is set while getGraphicsEvent is actively
// looking for events
diff --git a/rkward/rbackend/rkwarddevice/rkgraphicsdevice_stubs.cpp b/rkward/rbackend/rkwarddevice/rkgraphicsdevice_stubs.cpp
index 0eea4225..cd072472 100644
--- a/rkward/rbackend/rkwarddevice/rkgraphicsdevice_stubs.cpp
+++ b/rkward/rbackend/rkwarddevice/rkgraphicsdevice_stubs.cpp
@@ -592,8 +592,10 @@ void RKD_EventHelper (pDevDesc dev, int code) {
Rf_error ("Interrupted by user");
return; // not reached
}
- if (event_code == RKDNothing) return;
- else if (event_code == RKDKeyPress) {
+ if (event_code == RKDNothing) {
+ if (Rf_doesIdle(dev)) Rf_doIdle(dev);
+ return;
+ } else if (event_code == RKDKeyPress) {
if (modifiers - (modifiers & Qt::ShiftModifier)) { // any other modifier than Shift, alone. NOTE: devX11.c and devWindows.c handle Ctrl, only as of R 3.0.0
QString mod_text;
if (modifiers & Qt::ControlModifier) mod_text.append ("ctrl-");
More information about the rkward-tracker
mailing list