public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* Patch: conditionally open source window
@ 2000-12-08 14:03 Tom Tromey
  2000-12-11 10:15 ` Syd Polk
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Tromey @ 2000-12-08 14:03 UTC (permalink / raw)
  To: Insight List

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} {

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Patch: conditionally open source window
  2000-12-08 14:03 Patch: conditionally open source window Tom Tromey
@ 2000-12-11 10:15 ` Syd Polk
  0 siblings, 0 replies; 2+ messages in thread
From: Syd Polk @ 2000-12-11 10:15 UTC (permalink / raw)
  To: tromey, Insight List

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.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-12-11 10:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-08 14:03 Patch: conditionally open source window Tom Tromey
2000-12-11 10:15 ` Syd Polk

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).