improvements/fixes from MatN and Andrew related to AppImage and batch render
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / remotecontrol.C
index de2bc271323c317ce7dd2742687bedca6de0e190..0907707d6e6311c0935f2e6eb56cdc8c679cc489 100644 (file)
@@ -12,6 +12,8 @@ RemoteWindow::RemoteWindow(RemoteControl *remote_control)
                0, 0, xS(16), yS(16), -1, -1, 1, 0, 1)
 {
        this->remote_control = remote_control;
+// *** CONTEXT_HELP ***
+       context_help_set_keyword("Remote Control for DVB");
 }
 
 RemoteWindow::~RemoteWindow()
@@ -53,11 +55,13 @@ RemoteControl::~RemoteControl()
 int RemoteControl::activate(RemoteHandler *handler)
 {
        int result = 0;
-       active_lock->lock("RemoteControl::activate");
-       if( !is_active() ) {
-               if( !handler ) handler = !mwindow_gui->record->running() ?
+       deactivate();
+       if( !handler )
+               handler = !mwindow_gui->record->running() ?
                        (RemoteHandler *)mwindow_gui->cwindow_remote_handler :
                        (RemoteHandler *)mwindow_gui->record_remote_handler ;
+       active_lock->lock("RemoteControl::activate");
+       if( handler ) {
                gui->lock_window("RemoteControl::activate");
                gui->set_active(handler);
                gui->set_color(handler->color);
@@ -72,19 +76,21 @@ int RemoteControl::activate(RemoteHandler *handler)
 int RemoteControl::deactivate()
 {
        int result = 0;
-       active_lock->lock("RemoteControl::deactivate");
        if( is_active() ) {
-               gui->set_inactive();
-               result = 1;
+               active_lock->lock("RemoteControl::deactivate");
+               if( is_active() ) {
+                       gui->set_inactive();
+                       result = 1;
+               }
+               active_lock->unlock();
        }
-       active_lock->unlock();
        return result;
 }
 
 int RemoteControl::remote_key(int key)
 {
        if( !is_active() ) return 0;
-       return handler->process_key(key);
+       return handler->remote_key(key);
 }
 
 void RemoteControl::set_color(int color)
@@ -182,4 +188,14 @@ RemoteHandler::~RemoteHandler()
 {
 }
 
+int RemoteHandler::remote_key(int key)
+{
+       gui->set_inactive();
+       return -1;
+}
+
+int RemoteHandler::process_key(int key)
+{
+       return -1;
+}