bug-ddd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DDD accepts commands when gdb pane is closed


From: Andreas Zeller
Subject: Re: DDD accepts commands when gdb pane is closed
Date: 16 Nov 2000 10:41:40 +0100
User-agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands)

Hi!

Colin <address@hidden> writes:

> We are running DDD via its tty interface so that it
> can be driven by commands from a parent process. When
> DDD is started up in this way (via the --tty option)
> it by default hides the GDB command pane.
> 
> However even though the pane is hidden, you can still
> type commands and they are executed by DDD (even
> though you can't see what you are typing!)
> 
> We think that this is wrong. Whenever the GDB pane is
> closed then all keyboard-based command input should be
> disabled aswell.
> 
> This causes us a particular problem because we are
> sending commands to DDD via its tty interface, but if
> the user accidentally hits the keyboard then the
> keypresses get interleaved with the tty commands and
> we end up with a complete failure due to unrecognised
> commands!

The enclosed patch fixes this problem - if the debugger console is
closed, keyboard input in the source window will no longer be forwarded.

Note that you can still invoke commands using menu accelerators such
as function keys.  But at least, these accelerators can be turned off
and modified just by changing the resource settings.


Index: ddd/editing.C
===================================================================
RCS file: /cvsroot/ddd/ddd/ddd/editing.C,v
retrieving revision 1.49
diff -u -r1.49 editing.C
--- ddd/editing.C       2000/05/26 12:13:30     1.49
+++ ddd/editing.C       2000/11/16 09:36:37
@@ -53,6 +53,7 @@
 #include "regexps.h"
 #include "status.h"
 #include "string-fun.h"
+#include "windows.h"
 
 #include <iostream.h>
 #include <Xm/Xm.h>
@@ -427,15 +428,39 @@
     }
 
     if (e->type != KeyPress && e->type != KeyRelease)
-       return;
+       return;                 // Forward only keyboard events
+
+    if (!XtIsRealized(gdb_w))
+       return;                 // We don't have a console yet
+
+    if (!have_command_window())
+       return;                 // The console is closed
+
+    // Rationale: Colin <address@hidden> writes:
+    // We are running DDD via its tty interface so that it
+    // can be driven by commands from a parent process. When
+    // DDD is started up in this way (via the --tty option)
+    // it by default hides the GDB command pane.
+    // 
+    // However even though the pane is hidden, you can still
+    // type commands and they are executed by DDD (even
+    // though you can't see what you are typing!)
+    // 
+    // We think that this is wrong. Whenever the GDB pane is
+    // closed then all keyboard-based command input should be
+    // disabled as well.
+    // 
+    // This causes us a particular problem because we are
+    // sending commands to DDD via its tty interface, but if
+    // the user accidentally hits the keyboard then the
+    // keypresses get interleaved with the tty commands and
+    // we end up with a complete failure due to unrecognised
+    // commands!
 
     static bool running = false;
 
-    if (running || !XtIsRealized(gdb_w))
-    {
-       // Ignore event
-       return;
-    }
+    if (running)
+       return;                 // We have already entered this procedure
 
     running = true;

-- 
Andreas Zeller     Universitaet Passau
                   http://www.fmi.uni-passau.de/st/staff/zeller/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]