From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Mon, 7 Aug 2000 12:30:40 -0600 From: andrey mirtchovski To: 9fans@cse.psu.edu Subject: [9fans] graphics Message-ID: MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="-1463809928-349689878-965673040=:3867" Topicbox-Message-UUID: f787ec0e-eac8-11e9-9e20-41e7f4b1d025 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. ---1463809928-349689878-965673040=:3867 Content-Type: TEXT/PLAIN; charset=US-ASCII hi, i spent the weekend trying to learn more about the plan9 graphics model and trying to write a simple program (started off with russ cox' click.c and worked on top of it) and i must say i am quite impressed with the ease with which programs are created, relative size, simplicity and speed... included is a simple program that emulates one of the x-screensavers by drawing random squares in the window it is started in... one can use it mostly for speed-evaluation and/or to tell me if there is any problem with terminals running in less-than-24 bit mode... several questions popped up while i was implementing it: the 'eresized()' routine seems not to be called if the program is not waiting on any event. e.g. in one of my earlier implementations i lacked a call to ecanread/emouse/emenuhit in the main loop and as a side effect eresized was not called when the window was moved... it only started working after i added (any) of the abovementioned function calls. it is possible to force the machine to reboot if one mistakingly forgets to free the allocimagemix pointer after the recangle is drawn... this seems to be a big problem, because i've always assumed a runaway process that takes up the entire memory would just be terminated instead of causing the machine to reboot... or maybe plan9 does things in a different way? :) well.. comments/flames are welcome :) cheers: andrey PS: obligatory screenshot of plan9 in 'working condition' is available from http://homepage.usask.ca/aam396/scrsht.gif you can see my irc client running in the bottom left corner of the screen, the language spoken is bulgarian (transliterated)... the entire page is not operational though, i'm just using it for this screenshot... ---1463809928-349689878-965673040=:3867 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="scr.c" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-Disposition: attachment; filename="scr.c" LyogZHJhdyByYW5kb20gcmVjdGFuZ2xlcyBpbiB0aGUgY3VycmVudCB3aW5k b3cNCiogc29ydCBvZiBsaWtlIHR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