[Gambas-user] DesktopWatcher doesn't watch...

RICHARD WALKER richard.j.walker at ...247...
Sun Aug 26 21:27:58 CEST 2012


There is more to this problem than I first thought. It is not just
DesktopWatcher that I do not understand, but some of Desktop and
DesktopWindow too.

I have built a quick'n'dirty test harness to display some of the
difficulties I have encountered. It is attached.

It may be simplest to list what I can use with some confidence that it
will work as expected and not crash.

1. Read all Desktop static properties and suspend/resume the screen saver
2. Use Desktop static method SendKeys (I have not tried Open,
OpenTerminal,  RunAsRoot , SendMail)
3. Use DesktopWindow properties; Desktop, Id, Name (I have not tried
any of the methods Close,  GetIcon,  Move,  Refresh,  Resize)

The test program will:
(a) Try to implement a DesktopWatcher, trapping all events
(b) Try to list all desktop windows
(c) Try to list windows with names matching a pattern
(d) Try to activate the screensaver for 5 seconds
(e) Identify the currently active window
(f) Identify the current desktop and the total number of desktops


(a) will fail with no indication that anything is wrong. Could be I am
not doing it correctly.
(b) uses two methods. One will fail to list any windows opened after
the test program starts. The other will, from time to time, produce a
swift and silent death from an X error, but when it works it can find
more windows than the first method.
(c) Always works, if the first method of (b) is used to iterate
through the windows - so sadly it will fail if the window you are
searching for was opened after the test program starts. Using the
second method from (b) it will sometimes work, but there are quite a
few patterns it doesn't like looking for.
(d) Just doesn't seem to do anything - it neither works nor throws a hissy fit.
(e) and (f) look to be too simple to fail, and they don't.

[System]
OperatingSystem=Linux
Kernel=3.2.16-0.rt27.1.mga2
Architecture=x86_64
Memory=3092992 kB
DistributionVendor="Mageia"
DistributionRelease="Mageia 2"
Desktop=LXDE

[Gambas 3]
Version=3.1.1
Path=/usr/bin/gbx3


Richard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: WindowExplorer-0.0.3.tar.gz
Type: application/x-gzip
Size: 7640 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20120826/8997ecef/attachment.bin>


More information about the User mailing list