File: raise-commands.jl

package info (click to toggle)
sawfish 1%3A1.3.5.2-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 11,636 kB
  • ctags: 1,327
  • sloc: lisp: 22,765; ansic: 15,810; sh: 10,203; makefile: 675; perl: 19
file content (101 lines) | stat: -rw-r--r-- 3,696 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
;; raise-commands.jl -- some commands for raising windows
;; $Id: raise-commands.jl,v 1.11 2002/04/21 04:52:14 jsh Exp $

;; Copyright (C) 1999-2000 John Harper <john@dcs.warwick.ac.uk>

;; This file is part of sawmill.

;; sawmill is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; sawmill is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with sawmill; see the file COPYING.  If not, write to
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

(define-structure sawfish.wm.commands.raise-commands ()

    (open rep
	  sawfish.wm.windows
	  sawfish.wm.events
	  sawfish.wm.stacking
	  sawfish.wm.util.stacking
	  sawfish.wm.state.transient
	  sawfish.wm.commands.groups
	  sawfish.wm.commands
	  sawfish.wm.focus)

  (define (replay-pointer w)
    ;; click-to-focus mode sets this to t when it calls a command
    ;; from within a button press event
    (unless (and (fluid focus-within-click-event)
		 (not (or focus-click-through
			  (window-get w 'focus-click-through)
			  (not (window-really-wants-input-p w)))))
      (allow-events 'replay-pointer)
      (unless (clicked-frame-part)
	(forget-button-press))))

  (define (and-pass-through-click w)
    "Raise the window that received the current event, then replay any pointer
events that invoked the command."
    (when (windowp w)
      (maybe-raise-window w))
    (replay-pointer w))

  (define (and-pass-through-click-if-focused w)
    "Raise the window that received the current event (if it's focused), then
replay any pointer events that invoked the command."
    (when (and (windowp w) (eq w (input-focus)))
      (maybe-raise-window w))
    (replay-pointer w))

  (define (or-pass-through-click w)
    (if (and (windowp w) (not (window-on-top-p w)))
	(maybe-raise-window w)
      (replay-pointer w)))

  ;;###autoload
  (define-command 'raise-and-pass-through-click
    and-pass-through-click #:spec "%W")
  (define-command 'raise-and-pass-through-click-if-focused
    and-pass-through-click-if-focused #:spec "%w")
  (define-command 'raise-or-pass-through-click
    or-pass-through-click #:spec "%w")

;;; these should probably be considered obsolete

  (define (window-and-pass-through-click w)
    "Raise the window that received the current event, then replay any pointer
events that invoked the command."
    (when (windowp w)
      (raise-window w))
    (replay-pointer w))

  (define (group-and-pass-through-click w)
    "Raise the group of windows that received the current event, then replay
any pointer events that invoked the command."
    (when (windowp w)
      (raise-group w))
    (replay-pointer w))

  (define (transients-and-pass-through-click w)
    "Raise the window that received the current event and any transients it
has, then replay any pointer events that invoked the command."
    (when (windowp w)
      (raise-window-and-transients w))
    (replay-pointer w))

  ;;###autoload
  (define-command 'raise-window-and-pass-through-click
    window-and-pass-through-click #:spec "%w" #:class 'advanced)
  (define-command 'raise-group-and-pass-through-click
    group-and-pass-through-click #:spec "%w" #:class 'advanced)
  (define-command 'raise-transients-and-pass-through-click
    transients-and-pass-through-click #:spec "%w" #:class 'advanced))