This is the mail archive of the
insight@sources.redhat.com
mailing list for the Insight project.
[RFA] managedwin patch for kde
- To: <insight at sources dot redhat dot com>
- Subject: [RFA] managedwin patch for kde
- From: "Martin M. Hunt" <hunt at redhat dot com>
- Date: Tue, 3 Apr 2001 21:38:57 -0700 (PDT)
I use kde and am annoyed that my windows change position every time I run
Insight. This is probably a kde problem, or a tk/kde misunderstanding.
What happens is that when a new window is created and the geometry is set,
then the window is deiconified, it is displayed at the correct position,
but tk thinks its position is off by the size of the window border. That
incorrect position is saved when Insight exits. The next time Insight is
run, the window is lower and to the right by the thickness of the window
border. So all the windows slowly creep down and to the right.
By experimentation, setting the geometry again after the window is
deiconified fixes the problem. It should have no impact on other window
managers. I have tested this on GNOME and KDE 2.1.
This is an ugly hack, but it works. Someday we'll probably have to
rewrite the managedwin stuff to specifically handle different broken
windoiw managers. OK to check in?
2001-04-03 Martin M. Hunt <hunt@redhat.com>
* library/managedwin.itb (ManagedWin::reveal): After
deiconifying window for the first time, set its geometry
again. This fixes a problem with kde.
(ManagedWin::_create): Set a variable with the initial
geometry.
Index: gdbtk/library/managedwin.itb
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/managedwin.itb,v
retrieving revision 1.11
diff -u -p -r1.11 managedwin.itb
--- managedwin.itb 2001/03/01 20:00:12 1.11
+++ managedwin.itb 2001/04/04 04:20:59
@@ -1,4 +1,4 @@
-# Managed window for GDBtk.
+# Managed window for Insight.
# Copyright 1998, 1999, 2000, 2001 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify it
@@ -67,8 +67,16 @@ body ManagedWin::reveal {} {
update idletasks
set top [winfo toplevel [namespace tail $this]]
+ set g [wm geometry $top]
+ #debug "$top geometry=$g state=[wm state $top]"
raise $top
wm deiconify $top
+ if {[info exists ::$top._init_geometry]} {
+ upvar ::$top._init_geometry gm
+ wm geometry $top $gm
+ unset ::$top._init_geometry
+ }
+ #debug "$top geometry=[wm geometry $top] state=[wm state $top]"
# There used to be a `focus -force' here, but using -force is
# unfriendly, so it was removed. It was then replaced with a simple
@@ -292,8 +300,9 @@ body ManagedWin::_create { class args }
set g "${w}x${h}+${x}+${y}"
}
if {[expr $x+50] < $_screenwidth && [expr $y+20] < $_screenheight} {
- wm geometry $top $g
wm positionfrom $top user
+ wm geometry $top $g
+ set ::$top._init_geometry $g
}
}
}
@@ -322,7 +331,6 @@ body ManagedWin::find { win } {
# PUBLIC PROC: init
# ------------------------------------------------------------
body ManagedWin::init {} {
- debug
wm withdraw .
set _screenheight [winfo screenheight .]
set _screenwidth [winfo screenwidth .]