- pthread_mutex_lock (&plugin_mutex);
-
- /* Do things that are appropriate for plugins which have open editor windows:
- handle window creation requests, destroy requests,
- and run idle callbacks
- */
-
-again:
- for (fst = fst_first; fst; fst = fst->next) {
-
- pthread_mutex_lock (&fst->lock);
-
- if (fst->has_editor == 1) {
-
- if (fst->destroy) {
- fprintf (stderr, "%s scheduled for destroy\n", fst->handle->name);
- if (fst->windows_window) {
- fst->plugin->dispatcher( fst->plugin, effEditClose, 0, 0, NULL, 0.0 );
- CloseWindow (fst->windows_window);
- fst->windows_window = NULL;
- fst->destroy = FALSE;
- }
- fst_event_loop_remove_plugin (fst);
- fst->been_activated = FALSE;
- pthread_cond_signal (&fst->window_status_change);
- pthread_mutex_unlock (&fst->lock);
- goto again;
- }
-
- if (fst->windows_window == NULL) {
- if (fst_create_editor (fst)) {
- fst_error ("cannot create editor for plugin %s", fst->handle->name);
- fst_event_loop_remove_plugin (fst);
- pthread_cond_signal (&fst->window_status_change);
- pthread_mutex_unlock (&fst->lock);
- goto again;
- } else {
- /* condition/unlock: it was signalled & unlocked in fst_create_editor() */
- }
- }
-
- if (fst->dispatcher_wantcall) {
- fst->dispatcher_retval = fst->plugin->dispatcher( fst->plugin,
- fst->dispatcher_opcode,
- fst->dispatcher_index,
- fst->dispatcher_val,
- fst->dispatcher_ptr,
- fst->dispatcher_opt );
- fst->dispatcher_wantcall = 0;
- pthread_cond_signal (&fst->plugin_dispatcher_called);
- }
-
- fst->plugin->dispatcher (fst->plugin, effEditIdle, 0, 0, NULL, 0);
-
- if (fst->wantIdle) {
- fst->plugin->dispatcher (fst->plugin, 53, 0, 0, NULL, 0);
- }
-
- /* Dispatch messages to send keypresses to the plugin */
-
- for (i = 0; i < fst->n_pending_keys; ++i) {
- /* I'm not quite sure what is going on here; it seems
- `special' keys must be delivered with WM_KEYDOWN,
- but that alphanumerics etc. must use WM_CHAR or
- they will be ignored. Ours is not to reason why ...
- */
- if (fst->pending_keys[i].special != 0) {
- msg.message = WM_KEYDOWN;
- msg.wParam = fst->pending_keys[i].special;
- } else {
- msg.message = WM_CHAR;
- msg.wParam = fst->pending_keys[i].character;
- }
- msg.hwnd = GetFocus ();
- msg.lParam = 0;
- DispatchMessageA (&msg);
- }
-
- fst->n_pending_keys = 0;
-
- /* See comment for maybe_set_program call below */
- maybe_set_program (fst);
- fst->want_program = -1;
- fst->want_chunk = 0;
- }