public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Insight List <insight@sourceware.cygnus.com>
Subject: Patch: conditionally open source window
Date: Fri, 08 Dec 2000 14:03:00 -0000	[thread overview]
Message-ID: <87g0jy1rvw.fsf@creche.redhat.com> (raw)

I had to write one last Insight patch today.  This fixes a problem
that has been annoying me for the last 3 weeks.  Here is how to see
the problem:

* Start Insight
* As soon as the source window appears, bury it.
  (I can do this quickly because I have F2 bound to bury a window.)
* Notice that Insight raises the source window again

I often start a program and then when the window appears I bury it.  I
task switch frequently so I will re-raise the window by hand when I
want it.  It annoys me when programs auto-raise their own windows
(Netscape does this sometimes and it drives me bonkers).  This is the
sort of bug that is really minor but acts as an ongoing irritant since
it interferes with habits that have been reinforced over a long period
of time.


In ManagedWin::startup, we do this:

  foreach cmd [pref get gdb/window/active] {
    eval $cmd
  }
  ManagedWin::open SrcWin

This makes sense because (I guess) there's no guarantee that the
source window already exists.  Unfortunately a side effect of
ManagedWin::open is that the window is raised, even if it already
exists.  And, given that this proc is used all over the place,
changing this is probably inadvisable.

However, I don't think we really need to re-raise the window here.  If
the source window was listed in the gdb/window/active preference, then
it was just opened and raised.  And if it wasn't in that preference
then it will be raised as a side effect of creation.

So I propose checking for the existence of the source window before
raising.  Patch appended.

Ok?

2000-12-08  Tom Tromey  <tromey@redhat.com>

	* managedwin.itb (ManagedWin::startup): Only open source window
	if it doesn't already exist.

Tom

Index: managedwin.itb
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/managedwin.itb,v
retrieving revision 1.7
diff -u -r1.7 managedwin.itb
--- managedwin.itb	2000/12/07 22:40:36	1.7
+++ managedwin.itb	2000/12/08 22:01:45
@@ -88,7 +88,16 @@
   foreach cmd [pref get gdb/window/active] {
     eval $cmd
   }
-  ManagedWin::open SrcWin
+  # If we open the source window, and a source window already exists,
+  # then we end up raising it twice during startup.  This yields an
+  # annoying effect for the user: if the user tries the bury the
+  # source window during startup, it will raise itself again.  This
+  # explains why we first check to see if a source window exists
+  # before trying to create it -- raising the window is an inevitable
+  # side effect of the creation process.
+  if {[llength [find SrcWin]] == 0} {
+    ManagedWin::open SrcWin
+  }
 }
 
 body ManagedWin::open_dlg {class args} {

             reply	other threads:[~2000-12-08 14:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-08 14:03 Tom Tromey [this message]
2000-12-11 10:15 ` Syd Polk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87g0jy1rvw.fsf@creche.redhat.com \
    --to=tromey@redhat.com \
    --cc=insight@sourceware.cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).