* Modal Dialogs lose grab when comboboxes are used
@ 2002-09-18 13:50 Fernando Nasser
2002-09-18 14:52 ` Fernando Nasser
0 siblings, 1 reply; 5+ messages in thread
From: Fernando Nasser @ 2002-09-18 13:50 UTC (permalink / raw)
To: insight, Martin M. Hunt
[-- Attachment #1: Type: text/plain, Size: 1245 bytes --]
This happened in another application and I just checked and we also suffer from
the same problem.
When we create a modal dialog we usually have a local grab that prevents the
user to meddle with the main window (and others) before we dismiss the modal
one. We use this for preferences, target selection, attaching a target...
things that we cannot proceed before they are settled.
The problem is that if these dialogs have a combobox and the combobox is
expanded, a global grab is used by the combobox so that it is unposted
regardless of where in the desktop you click (Tk menus do the same).
Unfortunately once you grab the focus, any previous grab is lost (unless you
take care of saving and restoring it, what the combobox doesn't seem to be doing).
This problem is common to the iwidgets:combobox and our own libgui combobox.
I have a possible fix to libgui that seems to solve our problem. Maybe Martin
can double check that for us.
Here is the CL (patch attached):
* library/combobox.tcl (build): New variable to save grabs.
(widgetProc): Save and restore previous grabs.
--
Fernando Nasser
Red Hat - Toronto E-Mail: fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9
[-- Attachment #2: COMBOBOX.PATCH --]
[-- Type: text/plain, Size: 1518 bytes --]
Index: library/combobox.tcl
===================================================================
RCS file: /cvs/src/src/libgui/library/combobox.tcl,v
retrieving revision 1.2
diff -c -p -r1.2 combobox.tcl
*** library/combobox.tcl 8 Sep 2001 22:34:46 -0000 1.2
--- library/combobox.tcl 18 Sep 2002 20:40:49 -0000
*************** proc ::combobox::build {w args } {
*** 106,111 ****
--- 106,112 ----
variable options
variable oldValue
variable ignoreTrace
+ variable grablist
variable this
array set widgets {}
*************** proc ::combobox::doInternalWidgetCommand
*** 677,682 ****
--- 678,684 ----
proc ::combobox::widgetProc {w command args} {
upvar ::combobox::${w}::widgets widgets
upvar ::combobox::${w}::options options
+ upvar ::combobox::${w}::grablist grablist
# this is just shorthand notation...
set doWidgetCommand \
*************** proc ::combobox::widgetProc {w command a
*** 787,792 ****
--- 789,795 ----
# *gasp* do a global grab!!! Mom always told not to
# do things like this... :-)
+ set grablist [grab current]
grab -global $widgets(this)
# fake the listbox into thinking it has focus
*************** proc ::combobox::widgetProc {w command a
*** 802,807 ****
--- 805,813 ----
}
# hides the listbox
grab release $widgets(this)
+ foreach grabitem $grablist {
+ grab set $grabitem
+ }
$widgets(button) configure -relief raised
wm withdraw $widgets(popup)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Modal Dialogs lose grab when comboboxes are used
2002-09-18 13:50 Modal Dialogs lose grab when comboboxes are used Fernando Nasser
@ 2002-09-18 14:52 ` Fernando Nasser
2002-09-20 10:39 ` Fernando Nasser
2002-09-24 20:16 ` Martin M. Hunt
0 siblings, 2 replies; 5+ messages in thread
From: Fernando Nasser @ 2002-09-18 14:52 UTC (permalink / raw)
To: Fernando Nasser; +Cc: insight, Martin M. Hunt
[-- Attachment #1: Type: text/plain, Size: 283 bytes --]
Martin,
Here is a more complete version of the fix.
I was not keeping track if the old grabs were local or global.
Regards,
Fernando
--
Fernando Nasser
Red Hat - Toronto E-Mail: fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9
[-- Attachment #2: COMBOBOX.PATCH --]
[-- Type: text/plain, Size: 1855 bytes --]
Index: library/combobox.tcl
===================================================================
RCS file: /cvs/src/src/libgui/library/combobox.tcl,v
retrieving revision 1.2
diff -c -p -r1.2 combobox.tcl
*** library/combobox.tcl 8 Sep 2001 22:34:46 -0000 1.2
--- library/combobox.tcl 18 Sep 2002 21:49:20 -0000
*************** proc ::combobox::build {w args } {
*** 106,111 ****
--- 106,113 ----
variable options
variable oldValue
variable ignoreTrace
+ variable grablist
+ variable grabstatus
variable this
array set widgets {}
*************** proc ::combobox::doInternalWidgetCommand
*** 677,682 ****
--- 679,686 ----
proc ::combobox::widgetProc {w command args} {
upvar ::combobox::${w}::widgets widgets
upvar ::combobox::${w}::options options
+ upvar ::combobox::${w}::grablist grablist
+ upvar ::combobox::${w}::grabstatus grabstatus
# this is just shorthand notation...
set doWidgetCommand \
*************** proc ::combobox::widgetProc {w command a
*** 787,792 ****
--- 791,800 ----
# *gasp* do a global grab!!! Mom always told not to
# do things like this... :-)
+ set grablist [grab current]
+ foreach grabitem $grablist {
+ lappend grabstatus [grab status $grabitem]
+ }
grab -global $widgets(this)
# fake the listbox into thinking it has focus
*************** proc ::combobox::widgetProc {w command a
*** 802,807 ****
--- 810,824 ----
}
# hides the listbox
grab release $widgets(this)
+ foreach grabitem $grablist itemstatus $grabstatus {
+ if {$itemstatus == "global"} {
+ grab set -global $grabitem
+ } else {
+ grab set $grabitem
+ }
+ }
+ set grablist {}
+ set grabstatus {}
$widgets(button) configure -relief raised
wm withdraw $widgets(popup)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Modal Dialogs lose grab when comboboxes are used
2002-09-18 14:52 ` Fernando Nasser
@ 2002-09-20 10:39 ` Fernando Nasser
2002-09-24 20:16 ` Martin M. Hunt
1 sibling, 0 replies; 5+ messages in thread
From: Fernando Nasser @ 2002-09-20 10:39 UTC (permalink / raw)
To: Fernando Nasser; +Cc: insight, Martin M. Hunt
Committed.
Fernando Nasser wrote:
>
> Here is a more complete version of the fix.
>
> I was not keeping track if the old grabs were local or global.
>
> Regards,
> Fernando
>
>
>
> ------------------------------------------------------------------------
>
> Index: library/combobox.tcl
> ===================================================================
> RCS file: /cvs/src/src/libgui/library/combobox.tcl,v
> retrieving revision 1.2
> diff -c -p -r1.2 combobox.tcl
> *** library/combobox.tcl 8 Sep 2001 22:34:46 -0000 1.2
> --- library/combobox.tcl 18 Sep 2002 21:49:20 -0000
> *************** proc ::combobox::build {w args } {
> *** 106,111 ****
> --- 106,113 ----
> variable options
> variable oldValue
> variable ignoreTrace
> + variable grablist
> + variable grabstatus
> variable this
>
> array set widgets {}
> *************** proc ::combobox::doInternalWidgetCommand
> *** 677,682 ****
> --- 679,686 ----
> proc ::combobox::widgetProc {w command args} {
> upvar ::combobox::${w}::widgets widgets
> upvar ::combobox::${w}::options options
> + upvar ::combobox::${w}::grablist grablist
> + upvar ::combobox::${w}::grabstatus grabstatus
>
> # this is just shorthand notation...
> set doWidgetCommand \
> *************** proc ::combobox::widgetProc {w command a
> *** 787,792 ****
> --- 791,800 ----
>
> # *gasp* do a global grab!!! Mom always told not to
> # do things like this... :-)
> + set grablist [grab current]
> + foreach grabitem $grablist {
> + lappend grabstatus [grab status $grabitem]
> + }
> grab -global $widgets(this)
>
> # fake the listbox into thinking it has focus
> *************** proc ::combobox::widgetProc {w command a
> *** 802,807 ****
> --- 810,824 ----
> }
> # hides the listbox
> grab release $widgets(this)
> + foreach grabitem $grablist itemstatus $grabstatus {
> + if {$itemstatus == "global"} {
> + grab set -global $grabitem
> + } else {
> + grab set $grabitem
> + }
> + }
> + set grablist {}
> + set grabstatus {}
> $widgets(button) configure -relief raised
> wm withdraw $widgets(popup)
>
--
Fernando Nasser
Red Hat - Toronto E-Mail: fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Modal Dialogs lose grab when comboboxes are used
2002-09-18 14:52 ` Fernando Nasser
2002-09-20 10:39 ` Fernando Nasser
@ 2002-09-24 20:16 ` Martin M. Hunt
2002-09-24 22:04 ` Fernando Nasser
1 sibling, 1 reply; 5+ messages in thread
From: Martin M. Hunt @ 2002-09-24 20:16 UTC (permalink / raw)
To: Fernando Nasser; +Cc: insight
Fernando,
Did you forget something? This breaks all the comboboxes on Insight.
Looks like grabstatus is not initialized. Doing that gets things
working for me, but I did not look very closely.
Index: combobox.tcl
===================================================================
RCS file: /cvs/src/src/libgui/library/combobox.tcl,v
retrieving revision 1.4
diff -u -u -r1.4 combobox.tcl
--- combobox.tcl 20 Sep 2002 17:38:52 -0000 1.4
+++ combobox.tcl 25 Sep 2002 03:11:01 -0000
@@ -107,7 +107,7 @@
variable oldValue
variable ignoreTrace
variable grablist
- variable grabstatus
+ variable grabstatus ""
variable this
array set widgets {}
Martin
Fernando Nasser wrote:
> Martin,
>
> Here is a more complete version of the fix.
>
> I was not keeping track if the old grabs were local or global.
>
> Regards,
> Fernando
>
>
>
> ------------------------------------------------------------------------
>
> Index: library/combobox.tcl
> ===================================================================
> RCS file: /cvs/src/src/libgui/library/combobox.tcl,v
> retrieving revision 1.2
> diff -c -p -r1.2 combobox.tcl
> *** library/combobox.tcl 8 Sep 2001 22:34:46 -0000 1.2
> --- library/combobox.tcl 18 Sep 2002 21:49:20 -0000
> *************** proc ::combobox::build {w args } {
> *** 106,111 ****
> --- 106,113 ----
> variable options
> variable oldValue
> variable ignoreTrace
> + variable grablist
> + variable grabstatus
> variable this
>
> array set widgets {}
> *************** proc ::combobox::doInternalWidgetCommand
> *** 677,682 ****
> --- 679,686 ----
> proc ::combobox::widgetProc {w command args} {
> upvar ::combobox::${w}::widgets widgets
> upvar ::combobox::${w}::options options
> + upvar ::combobox::${w}::grablist grablist
> + upvar ::combobox::${w}::grabstatus grabstatus
>
> # this is just shorthand notation...
> set doWidgetCommand \
> *************** proc ::combobox::widgetProc {w command a
> *** 787,792 ****
> --- 791,800 ----
>
> # *gasp* do a global grab!!! Mom always told not to
> # do things like this... :-)
> + set grablist [grab current]
> + foreach grabitem $grablist {
> + lappend grabstatus [grab status $grabitem]
> + }
> grab -global $widgets(this)
>
> # fake the listbox into thinking it has focus
> *************** proc ::combobox::widgetProc {w command a
> *** 802,807 ****
> --- 810,824 ----
> }
> # hides the listbox
> grab release $widgets(this)
> + foreach grabitem $grablist itemstatus $grabstatus {
> + if {$itemstatus == "global"} {
> + grab set -global $grabitem
> + } else {
> + grab set $grabitem
> + }
> + }
> + set grablist {}
> + set grabstatus {}
> $widgets(button) configure -relief raised
> wm withdraw $widgets(popup)
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Modal Dialogs lose grab when comboboxes are used
2002-09-24 20:16 ` Martin M. Hunt
@ 2002-09-24 22:04 ` Fernando Nasser
0 siblings, 0 replies; 5+ messages in thread
From: Fernando Nasser @ 2002-09-24 22:04 UTC (permalink / raw)
To: Martin M. Hunt; +Cc: insight
[-- Attachment #1: Type: text/plain, Size: 505 bytes --]
Ouch! There is indeed a line missing from my patch.
I've committed the attached.
Thanks for spotting it Martin.
Fernando
Martin M. Hunt wrote:
> Fernando,
>
> Did you forget something? This breaks all the comboboxes on Insight.
> Looks like grabstatus is not initialized. Doing that gets things
> working for me, but I did not look very closely.
>
--
Fernando Nasser
Red Hat Canada Ltd. E-Mail: fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9
[-- Attachment #2: COMBOBOX2.PATCH --]
[-- Type: text/plain, Size: 670 bytes --]
Index: library/combobox.tcl
===================================================================
RCS file: /cvs/src/src/libgui/library/combobox.tcl,v
retrieving revision 1.4
retrieving revision 1.5
diff -c -p -r1.4 -r1.5
*** library/combobox.tcl 20 Sep 2002 17:38:52 -0000 1.4
--- library/combobox.tcl 25 Sep 2002 05:01:21 -0000 1.5
*************** proc ::combobox::widgetProc {w command a
*** 792,797 ****
--- 792,798 ----
# *gasp* do a global grab!!! Mom always told not to
# do things like this... :-)
set grablist [grab current]
+ set grabstatus {}
foreach grabitem $grablist {
lappend grabstatus [grab status $grabitem]
}
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-09-25 5:04 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-18 13:50 Modal Dialogs lose grab when comboboxes are used Fernando Nasser
2002-09-18 14:52 ` Fernando Nasser
2002-09-20 10:39 ` Fernando Nasser
2002-09-24 20:16 ` Martin M. Hunt
2002-09-24 22:04 ` Fernando Nasser
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).