[no subject]



Hello, everyone.

I'm not sure this is the right place to ask this question. If not,
forgive me, please.

I hate pasting contents from X selection with button2 or Shift-Insert.
So, I want to write a function to simulate the event with others. But
now, I encountered a problem: In Iceweasel, even the cursor is in a
inputbox, I moved it here by keystroke,  the contents are pasted
elsewhere, where mouse clicked before.

If I can query the cursor(not mouse)'s position, I can deal it with
the same way, but I can't. How can I do this? Or, is there another
solution?

Thank you.

(defun catch-event-and-forward (event window #!optional raise)
  "Catch an event and send it to a window.
EVENT is either an event object, or the string representation of an event.
WINDOW is a window object. RAISE if not-nil, raise that window after send."
  (interactive)
  (when raise
    (maybe-raise-window window)
    (set-input-focus window))
  (synthesize-event event window))
(defun paste-primary-selection ()
  "Simulate XWindow Shift-Insert to paste content of PRIMARY selection."
  (interactive)
  (catch-event-and-forward "Button2-Click1"
			   (or (current-event-window)
			       (input-focus))
			   nil))


-- 
Regards,
Lave


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]