~ubuntu-branches/ubuntu/wily/sawfish-merlin-ugliness/wily

« back to all changes in this revision

Viewing changes to icons.jl

  • Committer: Bazaar Package Importer
  • Author(s): Christian Marillat
  • Date: 2004-01-26 19:47:51 UTC
  • mfrom: (1.1.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20040126194751-p55l4p7q7mrpr8lu
Tags: 1.0.1.5-4
* Add gnome-icon-themes path for uglicon. Now display gnome-unknow.png
  icon instead of an ugly gray icon.
* Update to standards version 3.6.1 (No changes)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
;; merlin/icons.jl -- another bad icon manager
2
2
 
3
 
;; version -0.5.1
 
3
;; version -0.5.3
4
4
 
5
5
;; Copyright (C) 2000-2001 merlin <merlin@merlin.org>
6
6
 
20
20
;; along with sawfish; see the file COPYING.  If not, write to
21
21
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
22
22
 
23
 
;                                    ;
24
 
;                           #        ;
25
 
;                           #        ;
26
 
;                      ######        ;
27
 
;                 ###########        ;
28
 
;             ##########             ;
29
 
;        ##########                  ;
30
 
;          ####                      ;
31
 
;              ####                  ;
32
 
;           ##########               ;
33
 
;       ##########                   ;
34
 
;            ####                    ; This Software is Not Good Software.
35
 
;                 ###                ; 
36
 
;                     ####  #        ; The Tao of Sawfish is that
37
 
;                          ##        ; a Window Manager Manages Windows.
38
 
;                           #        ;
39
 
;       #                            ; That is How It Should Be. 
40
 
;       #                            ;
41
 
;       # ###                        ; That is Right.
42
 
;             ###                    ; 
43
 
;              #  ###                ; This Software violates the Tao of
44
 
;              #      ###            ; Sawfish by making the window manager
45
 
;              #      #######        ; do what it should not.
46
 
;              #  #########          ;
47
 
;             ########               ; The Purity of Sawfish is Sullied by
48
 
;       # #########                  ; this Software.
49
 
;       ######                       ;
50
 
;       ###                          ; This Software Should Not Be.
51
 
;       #                            ;
52
 
;       #                   #        ; Do not use this Software.
53
 
;       #####################        ;
54
 
;       #####################        ; Merely observe, weep, gnash of your
55
 
;       #          ##       #        ; teeth and pull of your hair.
56
 
;               #####       #        ;
57
 
;            ########       #        ; --
58
 
;       # #######   #       #        ;
59
 
;       ######      ##     ##        ; Use instead a real icon manager
60
 
;       ###          #######         ; based on stph or somesuch.
61
 
;       #              ###           ;
62
 
;       #                   #        ; --
63
 
;       #####################        ;
64
 
;       #                 ###        ; Let me reiterate one more time
65
 
;                      ######        ; before I'm drunk again:
66
 
;                   #######          ;
67
 
;                #######             ; This software is a retrograde step.
68
 
;             #######                ;
69
 
;           #######                  ; The Purity And Lightness of Sawfish
70
 
;        ######             #        ; is its Greatness.
71
 
;       #####################        ;
72
 
;                                    ; A Window Manager should not include
73
 
;       #                   #        ; Applications such as this.
74
 
;       #####################        ;
75
 
;       #####################        ; Discrete applications can do a much
76
 
;       #                   #        ; better job.
77
 
;                                    ;
78
 
;       #                   #        ; This Software is a return to the old
79
 
;       #####################        ; ways of proprietary gadgets on
80
 
;       #                 ###        ; bloated, unstable window managers.
81
 
;                      ######        ;
82
 
;                   #######          ; --
83
 
;                #######             ;
84
 
;             #######                ; For the love of all that is good,
85
 
;           #######                  ; turn back now.
86
 
;        ######             #        ;
87
 
;       #####################        ;
88
 
;                                    ;
89
 
;               #####                ;
90
 
;           #############            ;
91
 
;         #################          ;
92
 
;        ###              ##         ;
93
 
;        #                  #        ;
94
 
;       #                   #        ;
95
 
;        #                  #        ;
96
 
;        ##               ##         ;
97
 
;         #########      ####        ;
98
 
;            ######                  ;
99
 
;                 #                  ;
100
 
;                                    ;
101
 
 
102
23
;;;;;;;;;;;;;;;;;;;;;
103
24
;; HERE BE DRAGONS ;;
104
25
;;;;;;;;;;;;;;;;;;;;;
119
40
;; You also need merlin/util.jl, merlin/x-util.jl and merlin/uglicon.jl.
120
41
 
121
42
;; Then add to your .sawfishrc:
122
 
;;   (require 'merlin.icons.)
 
43
;;   (require 'merlin.icons)
123
44
 
124
45
;; Then restart sawfish. Iconified windows should now get little icons.
125
46
 
333
254
 
334
255
  ;;;;
335
256
 
336
 
  (define (icons-event-expose event)
337
 
    (let*
338
 
        ((window (cdr (assq 'window event)))
339
 
         (w (x-window-get window 'parent)))
340
 
      (icons-repaint w)))
 
257
  (define (expose-handler window event)
 
258
    (let
 
259
        ((w (x-window-get window 'parent)))
 
260
      (icons-repaint w))
 
261
    nil)
341
262
 
342
 
  (define (icons-event-enter-notify event)
343
 
    (let*
344
 
        ((window (cdr (assq 'window event)))
345
 
         (w (x-window-get window 'parent)))
 
263
  (define (enter-notify-handler window event)
 
264
    (let
 
265
        ((w (x-window-get window 'parent)))
346
266
      (when icons-tooltips
347
267
        (let ((tooltips-enabled t))
348
 
          (display-tooltip-after-delay (window-name w) (icons-get-icon w))))))
349
 
 
350
 
  (define (icons-event-leave-notify event)
351
 
    (let*
352
 
        ((window (cdr (assq 'window event)))
353
 
         (w (x-window-get window 'parent)))
354
 
      (when icons-tooltips
355
 
        (remove-tooltip))))
356
 
 
357
 
  (define (icons-event-client-message event)
358
 
    (let*
359
 
        ((window (cdr (assq 'window event)))
360
 
         (message-type (cdr (assq 'message-type event)))
 
268
          (display-tooltip-after-delay (window-name w) (icons-get-icon w)))))
 
269
    nil)
 
270
 
 
271
  (define (leave-notify-handler window event)
 
272
    (when icons-tooltips
 
273
      (remove-tooltip))
 
274
    nil)
 
275
 
 
276
  (define (client-message-handler window event)
 
277
    (let*
 
278
        ((message-type (cdr (assq 'message-type event)))
361
279
         (format (cdr (assq 'format event)))
362
280
         (data (cdr (assq 'data event)))
363
281
         (w (x-window-get window 'parent)))
364
282
      (when (and (eq message-type 'WM_PROTOCOLS)
365
283
                 (eq format 32)
366
284
                 (eq (aref data 0) (x-atom 'WM_DELETE_WINDOW)))
367
 
        (uniconify-window w)))) ;; or do I just delete the icon?
368
 
 
369
 
  (define (icons-event-handler type win event)
370
 
    (cond ((eq type 'expose) (icons-event-expose event))
371
 
          ((eq type 'enter-notify) (icons-event-enter-notify event))
372
 
          ((eq type 'leave-notify) (icons-event-leave-notify event))
373
 
          ((eq type 'client-message) (icons-event-client-message event))))
 
285
        (uniconify-window w)))
 
286
    nil) ;; or do I just delete the icon?
 
287
 
 
288
  (define background-event-handlers
 
289
    `((expose . ,expose-handler)
 
290
      (enter-notify . ,enter-notify-handler)
 
291
      (leave-notify . ,leave-notify-handler)))
 
292
 
 
293
  (define window-event-handlers
 
294
    `((client-message . ,client-message-handler)))
 
295
 
 
296
  (define (event-handler type window event handlers)
 
297
    (let
 
298
        ((handler (assq type handlers)))
 
299
      (when handler
 
300
        ((cdr handler) window event))))
374
301
 
375
302
  ;;;;
376
303
 
388
315
             0
389
316
             `((override-redirect . ,nil)
390
317
               (event-mask . ,'()))
391
 
             icons-event-handler))
 
318
             (lambda (type window event)
 
319
               (event-handler type window event window-event-handlers))))
392
320
           (background (x-create-window
393
321
             (cons 0 0)
394
322
             bg-dim
398
326
               (border-color . ,(cdr icons-border))
399
327
               (override-redirect . ,t)
400
328
               (event-mask . ,'(exposure enter-window leave-window)))
401
 
             icons-event-handler))
 
329
             (lambda (type window event)
 
330
               (event-handler type window event background-event-handlers))))
402
331
           (gc (x-create-gc
403
332
             window
404
333
             `((foreground . ,(car icons-text))))))