diff --git a/doc/EQL-Slime-Integration.htm b/doc/EQL-Slime-Integration.htm index 4491ff0..2ae9add 100644 --- a/doc/EQL-Slime-Integration.htm +++ b/doc/EQL-Slime-Integration.htm @@ -27,7 +27,7 @@ ;; in some ECL thread (let (values) - (run-in-gui-thread + (run-on-ui-thread ;; in ECL main/GUI thread (lambda () @@ -36,14 +36,14 @@ ;; back in some ECL thread (values-list values)) -
Here the implementation of the ECL function run-in-gui-thread (embedded in Qt):
Here the implementation of the ECL function run-on-ui-thread (embedded in Qt):
- cl_object run_in_gui_thread(cl_object closure) // define ECL function
+ cl_object run_on_ui_thread(cl_object closure) // define ECL function
{
QMetaObject::invokeMethod(
object, // any QObject from GUI thread
- "runInGuiThread", // see Q_INVOKABLE
+ "runOnUiThread", // see Q_INVOKABLE
Qt::BlockingQueuedConnection, // blocking for return values
Q_ARG(void*, closure)); // 'closure' is just a pointer
@@ -53,7 +53,7 @@
Now the Lisp closure will run in the GUI/main thread, and the implementation of the Qt function runInGuiThread is as simple as:
- Q_INVOKABLE void runInGuiThread(void* closure) // note Q_INVOKABLE
+ Q_INVOKABLE void runOnUiThread(void* closure) // note Q_INVOKABLE
{
cl_funcall(1, (cl_object)closure); // ECL function call
}
diff --git a/doc/auto-doc.htm b/doc/auto-doc.htm
index b9edf9f..26454fe 100644
--- a/doc/auto-doc.htm
+++ b/doc/auto-doc.htm
@@ -463,17 +463,17 @@ Loads an EQL module, corresponding to a Qt module.
Returns the module name if
Constructs a (unsigned-byte 32) value that represents a 32 bit pixel color specified by the red, green, blue and alpha values.
-QRUN-IN-GUI-THREAD (function &optional (blocking t))
+QRUN-ON-UI-THREAD (function &optional (blocking t))
QRUN
-Runs function in GUI thread while (by default) blocking the calling thread (if called from main thread, function will simply be called directly).
This is needed to run GUI code from ECL threads other than the main thread.
Returns T on success.
There are 2 reasons to always wrap any EQL function like this, if called from another ECL thread:qrun*.
+Runs function on the UI thread while (by default) blocking the calling thread (if called from main thread, function will simply be called directly).T on success.qrun*.
(qrun 'update-view-data)
function in GUI thread while (by default) blocking the calling thread (if called from main thread, function will simply be called directly).T on success.qrun*.
+ /// Runs function on the UI thread while (by default) blocking the calling thread (if called from main thread, function will simply be called directly).T on success.qrun*.
/// (qrun 'update-view-data)
ecl_process_env()->nvalues = 1;
if(l_function_or_closure != Cnil) {
QObject o;
if(o.thread() == QApplication::instance()->thread()) {
// direct call
- LObjects::eql->runInGuiThread(l_function_or_closure);
+ LObjects::eql->runOnUiThread(l_function_or_closure);
return Ct; }
else {
// queued call in main event loop (GUI thread)
QMetaObject::invokeMethod(LObjects::eql,
- "runInGuiThread",
+ "runOnUiThread",
(l_blocking != Cnil) ? Qt::BlockingQueuedConnection : Qt::QueuedConnection,
Q_ARG(void*, l_function_or_closure));
return Ct; }}
- error_msg("QRUN-IN-GUI-THREAD", LIST1(l_function_or_closure));
+ error_msg("QRUN-ON-UI-THREAD", LIST1(l_function_or_closure));
return Cnil; }
cl_object qlog2(cl_object l_msg) {
diff --git a/src/ecl_fun.h b/src/ecl_fun.h
index 5f4cdf6..3440d89 100644
--- a/src/ecl_fun.h
+++ b/src/ecl_fun.h
@@ -272,7 +272,7 @@ cl_object qprocess_events ();
cl_object qproperty (cl_object, cl_object);
cl_object qremove_event_filter (cl_object);
cl_object qrequire2 (cl_object, cl_object);
-cl_object qrun_in_gui_thread2 (cl_object, cl_object);
+cl_object qrun_on_ui_thread2 (cl_object, cl_object);
cl_object qsender ();
cl_object qset_gc (cl_object);
cl_object qset_property (cl_object, cl_object, cl_object);
diff --git a/src/eql.cpp b/src/eql.cpp
index a7529ab..f3f8caa 100644
--- a/src/eql.cpp
+++ b/src/eql.cpp
@@ -179,11 +179,12 @@ void EQL::exec(QWidget* widget, const QString& lispFile, const QString& slimeHoo
if(exec_with_simple_restart) {
eval("(eql::exec-with-simple-restart)"); }}
-void EQL::runInGuiThread(void* function_or_closure) {
+void EQL::runOnUiThread(void* function_or_closure) {
const cl_env_ptr l_env = ecl_process_env();
CL_CATCH_ALL_BEGIN(l_env) {
CL_UNWIND_PROTECT_BEGIN(l_env) {
- cl_funcall(1, (cl_object)function_or_closure); }
+ cl_object l_fun = (cl_object)function_or_closure;
+ cl_funcall(1, l_fun); }
CL_UNWIND_PROTECT_EXIT {}
CL_UNWIND_PROTECT_END; }
CL_CATCH_ALL_END; }
diff --git a/src/eql5/eql.h b/src/eql5/eql.h
index b435d1f..ec698ae 100644
--- a/src/eql5/eql.h
+++ b/src/eql5/eql.h
@@ -43,7 +43,7 @@ public:
" (eql:qversion)"
" (format t \"EQL5 ~A (ECL ~A, Qt ~A)~%\" eql (lisp-implementation-version) qt))"); }
- Q_INVOKABLE void runInGuiThread(void*);
+ Q_INVOKABLE void runOnUiThread(void*);
public Q_SLOTS:
void exitEventLoop() { eventLoop->exit(); }
diff --git a/src/lisp/ini.lisp b/src/lisp/ini.lisp
index 0f05c20..c1cad51 100644
--- a/src/lisp/ini.lisp
+++ b/src/lisp/ini.lisp
@@ -328,7 +328,7 @@
(unless (find-package :ecl-readline)
(princ "> "))
(let ((form (si::%tpl-read)))
- (qrun-in-gui-thread (lambda () (eval-top-level form)) nil))
+ (qrun-on-ui-thread (lambda () (eval-top-level form)) nil))
(values))
(defun start-read-thread ()
@@ -690,13 +690,13 @@
(funcall ,reloaded ',variable ,library-name)))))
(defvar ,reloaded nil))))
-(defun qrun-in-gui-thread (function &optional (blocking t))
- (%qrun-in-gui-thread function blocking))
+(defun qrun-on-ui-thread (function &optional (blocking t))
+ (%qrun-on-ui-thread function blocking))
#+threads
(defvar *gui-thread* mp:*current-process*)
-(defmacro qrun-in-gui-thread* (&body body)
+(defmacro qrun-on-ui-thread* (&body body)
"args: (&body body)
alias: qrun*
Convenience macro for qrun, wrapping body in a closure (passing arguments, return values).
@@ -722,7 +722,7 @@
(first body)))
(defmacro qrun* (&body body) ; alias
- `(qrun-in-gui-thread* ,@body))
+ `(qrun-on-ui-thread* ,@body))
(defun qload (file-name)
"args: (file-name)
@@ -772,7 +772,7 @@
(alias qfun+ qinvoke-method+)
(alias qmsg qmessage-box)
(alias qnull qnull-object)
-(alias qrun qrun-in-gui-thread)
+(alias qrun qrun-on-ui-thread)
(alias qsel qselect)
(alias qq qquit)
@@ -834,9 +834,9 @@
(cons 'qrequire '(module &optional quiet))
(cons 'qrgb '(red green blue &optional (alpha 255)))
(cons 'qrun '(function))
- (cons 'qrun-in-gui-thread '(function))
+ (cons 'qrun-on-ui-thread '(function))
(cons 'qrun* '(&body body))
- (cons 'qrun-in-gui-thread* '(&body body))
+ (cons 'qrun-on-ui-thread* '(&body body))
(cons 'qset-null '(object))
(cons 'qset '(object name value))
(cons 'qset-color '(widget color-role color))
diff --git a/src/lisp/package.lisp b/src/lisp/package.lisp
index 2f427ce..5adb90d 100644
--- a/src/lisp/package.lisp
+++ b/src/lisp/package.lisp
@@ -77,9 +77,9 @@
#:qrequire
#:qrgb
#:qrun
- #:qrun-in-gui-thread
+ #:qrun-on-ui-thread
#:qrun*
- #:qrun-in-gui-thread*
+ #:qrun-on-ui-thread*
#:qsel
#:qselect
#:qsender