See:

Sawfish WM users

The default kebindings for sawfish capture alt-leftclick and prevent it from getting to starcraft. Paste this in your ~/.sawfishrc to disable this keybinding on JUST the workspace that the wine window is in.

(defvar *starcraft-lock* nil)
(defvar *starcraft-bind-buffer1* nil)
(defvar *starcraft-bind-buffer2* nil)
(defvar starcraft-mode-hook ())
(defvar unstarcraft-mode-hook ())

(defun starcraft-mode ()
  (when (not *starcraft-lock*)
    (setq *starcraft-lock* t)
    ; store bindings before we remove them so they can be used later
    (setq *starcraft-bind-buffer1*
          (search-keymap (lookup-event "M-Button1-Move") window-keymap))
    (setq *starcraft-bind-buffer2*
          (search-keymap (lookup-event "M-Button1-Click") window-keymap))
    (unbind-keys window-keymap "M-Button1-Move" "M-Button1-Click")
    (call-hook 'starcraft-mode-hook () nil)))

(defun unstarcraft-mode ()
  (when *starcraft-lock*
    ; restore previously saved bindings, if any
    (when *starcraft-bind-buffer1*
      (bind-keys window-keymap "M-Button1-Move" (car *starcraft-bind-buffer1*))
      (setq *starcraft-bind-buffer1* nil))
    (when *starcraft-bind-buffer2*
      (bind-keys window-keymap "M-Button1-Click" (car *starcraft-bind-buffer2*))
      (setq *starcraft-bind-buffer2* nil))
    (call-hook 'unstarcraft-mode-hook () nil)
    (setq *starcraft-lock* nil)))



(defun starcraft-window-p (win)
  "Does this window contain starcraft? (Customize me for your system.)"
  (or (string= (window-name win) "Brood War")
      (string= (window-name win) "Wine desktop")))

(defun workspace-windows (ws)
  "get a list of windows in workspace n"
  (filter (lambda (window) (member ws (window-get window 'workspaces)))
          (managed-windows)))

(defun maybe-starcraft-mode (ws)
  "if there's at least one starcraft window in the workspace, bind the key"
  (if (filter starcraft-window-p (workspace-windows ws)) (starcraft-mode)))

(add-hook 'enter-workspace-hook maybe-starcraft-mode)
(add-hook 'leave-workspace-hook (lambda (ws) (unstarcraft-mode)))

(require 'move-resize) ; (contains the symbol move-window-interactively)
(add-hook 'starcraft-mode-hook
          (lambda () (bind-keys window-keymap "C-M-Button1-Move"
                                'move-window-interactively)))
(add-hook 'unstarcraft-mode-hook
          (lambda () (unbind-keys window-keymap "C-M-Button1-Move")))

Starcraft (last edited 2008-03-10 01:38:26 by localhost)