;;;; panel-integration.jl -- integrate sawfish with the gnome panel
;;;;
;;;; Description: define function to popup the run-dialog and the
;;;; main menu of the gnome panel.
;;;;
;;;; Copyright (C) 2004 Damien Merenne <dam@capsule.org>  
;;;; There is no warranty and no restriction on redistribution.

;; I looked every where to find how to popup the run dialog
;; from sawfish and found nothing. I just found this link
;; http://linux.seindal.dk/item48.html and I tried to make
;; the lisp code there to work. I've found how to do it, but
;; the why I fetch the window for the panel is not very clean.
;; Maybe there's an other way. Theres also a problem with 
;; poping the gnome menu using a shortcut key. See by yourself.
;; Comments are welcome.


;; popup the gnome run dialog
(defun gnome-run-dialog ()
  "Popup the gnome run dialog."
  (interactive)
  (send-client-message (get-window-by-name "Top Panel") 
		       '_GNOME_PANEL_ACTION 
		       (vector (x-atom '_GNOME_PANEL_ACTION_RUN_DIALOG) 
			       (x-server-timestamp)) 32))

;; popup the gnome main menu
(defun gnome-main-menu ()
  "Popup the gnome main menu."
  (interactive)
  (let ((panel-window (get-window-by-name "Top Panel")))
    ((send-client-message panel-window 
			  '_GNOME_PANEL_ACTION 
			  (vector (x-atom '_GNOME_PANEL_ACTION_MAIN_MENU) 
				  (x-server-timestamp)) 32)
     (set-input-focus panel-window))))