Location: lg@xxxxxxxxxxxxxx http://arch.xwem.org/2005/
Revision: xwem--main--2.2--patch-45
Archive: lg@xxxxxxxxxxxxxx
Creator: Zajcev Evgeny <lg@xxxxxxxx>
Date: Mon Jan 2 03:10:52 MSK 2006
Standard-date: 2006-01-02 00:10:52 GMT
Modified-files: dockapp/xwem-weather.el utils/xwem-osd.el
New-patches: lg@xxxxxxxxxxxxxx/xwem--main--2.2--patch-45
Summary: OSD and weather fixes
Keywords: osd, xwem-weather
* utils/xwem-osd.el (xwem-osd-set-color): [add] Save color as osd
property for default color value for osd instances.
* utils/xwem-osd.el (xwem-osd-instance-add): [add] Use osd's color if
color for instance is not specified.
* utils/xwem-osd.el (xwem-osd-redraw): [fix] Validate osd before
redrawing.
* dockapp/xwem-weather.el (xwem-weather-display-text): [fix] Use
instances for both text and arc.
* dockapp/xwem-weather.el (xwem-weather-fetch-function): [add] choice
menu
* added files
{arch}/xwem/xwem--main/xwem--main--2.2/lg@xxxxxxxxxxxxxx/patch-log/patch-45
* modified files
--- orig/dockapp/xwem-weather.el
+++ mod/dockapp/xwem-weather.el
@@ -179,9 +179,12 @@
(defcustom xwem-weather-fetch-function 'xwem-weather-fetch-default
"Function used to fetch weather file.
-Use `xwem-weather-fetch-with-url' to use `url' package, or
+Use `xwem-weather-fetch-with-url' to use W3 package, or
`xwem-weather-fetch-direct' if you have direct connect to internet."
- :type 'function
+ :type '(choice (function :tag "Direct" xwem-weather-fetch-direct)
+ (function :tag "Using W3" xwem-weather-fetch-with-url)
+ (function :tag "Autoconfigure" xwem-weather-fetch-default)
+ (function :tag "User defined"))
:group 'xwem-weather)
(defconst xwem-weather-url
"http://weather.noaa.gov/pub/data/observations/metar/decoded"
@@ -290,16 +293,26 @@
(let ((we-width (xwem-weather-osd-text-width text))
(height (xwem-weather-osd-text-height text))
(goff (xwem-weather-osd-text-width
- (substring text 0 (- (length text) 2)))))
+ (substring text 0 (- (length text) 2))))
+ (tinst (xwem-osd-get-prop xwem-weather-osd 'text-instance))
+ (ainst (xwem-osd-get-prop xwem-weather-osd 'arc-instance)))
+ ;; Resize weather osd
(xwem-osd-set-width xwem-weather-osd we-width)
(xwem-osd-set-height xwem-weather-osd height)
- (xwem-osd-text xwem-weather-osd text)
- ;; Display degree
- (xwem-osd-arc-add xwem-weather-osd
- (make-X-Arc :x goff :y 0
- :width 3 :height 3
- :angle1 0 :angle2 360))))
+ ;; Display temperature text and degree sign
+ (if (xwem-osd-instance-p tinst)
+ (xwem-osd-instance-change tinst :text text)
+ (xwem-osd-put-prop xwem-weather-osd 'text-instance
+ (xwem-osd-text-add xwem-weather-osd 0 0 text)))
+
+ (let ((arc (make-X-Arc :x goff :y 0
+ :width 3 :height 3 ; XXX
+ :angle1 0 :angle2 360)))
+ (if (xwem-osd-instance-p ainst)
+ (xwem-osd-instance-change ainst :xarc arc)
+ (xwem-osd-put-prop xwem-weather-osd 'arc-instance
+ (xwem-osd-arc-add xwem-weather-osd arc))))))
;;;###autoload(autoload 'xwem-weather-update "xwem-weather" nil t)
(define-xwem-command xwem-weather-update ()
--- orig/utils/xwem-osd.el
+++ mod/utils/xwem-osd.el
@@ -244,6 +244,7 @@
"In OSD add osd instance of TYPE and properties PLIST."
(let* ((depth (or (plist-get plist :depth) 0))
(color (or (plist-get plist :color)
+ (xwem-osd-get-prop osd 'color)
xwem-osd-default-color))
(xdpy (xwem-osd-xdpy osd))
(osin (make-xwem-osd-instance :type type :osd osd :plist plist)))
@@ -545,6 +546,7 @@
(let* ((xdpy (xwem-osd-xdpy osd))
(col (XAllocNamedColor xdpy (XDefaultColormap xdpy)
color-name)))
+ (xwem-osd-put-prop osd 'color color-name)
(XSetWindowBackground xdpy (xwem-osd-xwin osd) col)
(xwem-osd-clear-xwin osd)
(XChangeGC xdpy (xwem-osd-gc osd) :foreground col)))
@@ -563,8 +565,9 @@
(define-xwem-deffered xwem-osd-redraw (osd)
"Redraw all OSD's instances."
- (xwem-osd-clear-mask osd)
- (mapc #'xwem-osd-instance-draw (xwem-osd-instances osd)))
+ (when (xwem-osd-p osd)
+ (xwem-osd-clear-mask osd)
+ (mapc #'xwem-osd-instance-draw (xwem-osd-instances osd))))
(defun xwem-osd-destroy-instances (osd)
"Destroy all instances in OSD."
|