Home > Archive > PerlTk > November 2004 > Main Window leaves ghost windows when dragging around on desktop
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Main Window leaves ghost windows when dragging around on desktop
|
|
| Johnny Google 2004-11-05, 3:56 pm |
| I am running a Tk app that has at least one repeat function which is
reading and writing to a file every so often (virtual pipes)... I think
this is what causes my main window to get stuck in positions on the
desktop and at times when I drag it I get lots of little copies
(ghosts?) and it appears to not be free.... I am not using ->Busy --
what is causing this and how can I get similar functionality as repeat
without locking up the display even repeat?
Using the folling:
$zz_gui->repeat(500,sub{&zz_pipe_monitor});
Is this what is causing this lockup and ghost window creation as I drag
the window every 500 milliseconds?
| |
| Marc Dashevsky 2004-11-05, 3:56 pm |
| In article <1099673205.765452.308460@f14g2000cwb.googlegroups.com>,
john_pataki@yahoo.com says...
> I am running a Tk app that has at least one repeat function which is
> reading and writing to a file every so often (virtual pipes)... I think
> this is what causes my main window to get stuck in positions on the
> desktop and at times when I drag it I get lots of little copies
> (ghosts?) and it appears to not be free.... I am not using ->Busy --
> what is causing this and how can I get similar functionality as repeat
> without locking up the display even repeat?
>
> Using the folling:
>
> $zz_gui->repeat(500,sub{&zz_pipe_monitor});
>
> Is this what is causing this lockup and ghost window creation as I drag
> the window every 500 milliseconds?
This almost certainly is a window manager/OS environment issue.
--
Go to http://MarcDashevsky.com to send me e-mail.
| |
| Johnny Google 2004-11-05, 3:56 pm |
| Marc,
Ok - then what is the issue or fix? I am running WinXP Pro with 2Gig of
Ram and a fairly high end graphics setup.
Also - the frequency of the multiple windows changes when I change the
# of milliseconds repeats....
John
| |
| Marc Dashevsky 2004-11-05, 3:56 pm |
| In article <1099676547.237142.111450@f14g2000cwb.googlegroups.com>,
john_pataki@yahoo.com says...
>
> Ok - then what is the issue or fix?
Oh, I see, you wanted a useful comment.
> I am running WinXP Pro with 2Gig of Ram and a fairly
> high end graphics setup.
Well, I recommend that you update your video driver or check out
the manufacturer's web site/knowledge base. (I know, there I go
with another suggestion of limited value.) It strikes me that if
artifacts occur outside the application window, this issue is outside
the domain of perl/Tk.
> Also - the frequency of the multiple windows changes when I change the
> # of milliseconds repeats....
This is exactly what you should look up in the video card knowledge base.
--
Go to http://MarcDashevsky.com to send me e-mail.
| |
| Ala Qumsieh 2004-11-05, 8:56 pm |
| Johnny Google wrote:
> I am running a Tk app that has at least one repeat function which is
> reading and writing to a file every so often (virtual pipes)... I think
> this is what causes my main window to get stuck in positions on the
> desktop and at times when I drag it I get lots of little copies
> (ghosts?) and it appears to not be free.... I am not using ->Busy --
> what is causing this and how can I get similar functionality as repeat
> without locking up the display even repeat?
It is very hard to diagnose. But, why aren't you using fileevent?
'perldoc Tk::fileevent' for more info. I don't know if it will fix your
problem, but it's a better approach than what you are doing.
--Ala
| |
| Johnny Google 2004-11-05, 8:56 pm |
| Ok,
So I am trying to re-write my pipe code using fileevent ....
I read the docs -- and it appears that it needs a filehandle (OO) for
the command ....
so I am 'use' ing FileHandle to 'open' the file... so I have a file
handle to give fileevent....
but now I have the ol'e chicken and the egg contraversy....
If the file doesn't exists yet as I start up (because I delete it just
in case previous fails) and I am waiting for the other app to create
it...
fileevent can't take a file handle to a failed attempt on a file
open....
Is there a nifty way to wait until the file exists, then open it for
reading, then pass the filehandle to fileevent .
other than creating a while(! -e $pipe_in)
{\&sit_and_wait_for_a_while};
thanks for the suggestion to use fileevent -- this might help unfeeze
events with main window if I can get it to work...
I need to be able pop the last message written to $pipe_in whenever it
gets written... the other app will be appending to this file.
Is this what fileevent will do for me if I have this setup:
sub zz_pipe_open {
zz_stat();
# old way
#
# undef $zz_pipe_id;
# open (PIPE,"< $pipe_in") or croak "Can't open pipe.";
#
# new way
$PIPE = new FileHandle;
$PIPE->open("< $pipe_in");# or croak "Can't open pipe.";
if (defined $zz_gui) {
zz_stat("\tTk GUI Mode");
# old way
#
# $zz_pipe_id = $zz_gui->repeat(500,sub{&zz_pipe_monitor});
# zz_stat($zz_pipe_id);
#
# new way
$zz_gui->fileevent($PIPE, 'readable', \&zz_pipe_in);
} # end if
if (!defined $zz_gui) {
#zz_stat("\tNon-GUI Mode");
#while (!$zz_pipe_id) {select(undef, undef, undef,
0.50);&zz_pipe_monitor}
} # end if
} # end sub
sub zz_pipe_in {
zz_stat();
# new way
my $message;
my $r = sysread $PIPE, $message, 1024;
if ($r) {
chomp $message;
zz_stat("\tMessage = $message");
zz_cmd_call($message) if $message ne $last_message;
$last_message = $message;
} # end if
# old way
# my @message;
# while (<PIPE> ){push @message,$_};
# foreach $message (@message) {
# chomp $message;
# $message =~ s/\"|\s+//g;
# zz_stat("\tMessage = $message");
# zz_cmd_call($message) if $message ne $last_message;
# $last_message = $message;
# } # end foreach
} # end sub
| |
| Johnny Google 2004-11-05, 8:56 pm |
| I tried just creating the file with nothing in it before opening the
filehandle -- but then it appears that even when the other app writes a
message to $pipe_in --- I never see zz_pipe_in called.... is there
something that I am missing?
|
|
|
|
|