This is the mail archive of the
insight@sources.redhat.com
mailing list for the Insight project.
Re: Patch: conditionally open source window
- To: tromey at redhat dot com, Insight List <insight at sourceware dot cygnus dot com>
- Subject: Re: Patch: conditionally open source window
- From: Syd Polk <spolk at redhat dot com>
- Date: Mon, 11 Dec 2000 10:18:49 -0800
Approved.
At 03:15 PM 12/8/00 -0700, Tom Tromey wrote:
>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} {
Syd Polk spolk@redhat.com
Engineering Manager +1 415 777 9810 x 241
Red Hat, Inc.