unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#28621: Proposed patch for doc of posn-window and code of posn-set-point to handle frame arguments
@ 2017-09-27 16:01 Robert Weiner
  2017-09-27 21:34 ` John Wiegley
                   ` (2 more replies)
  0 siblings, 3 replies; 33+ messages in thread
From: Robert Weiner @ 2017-09-27 16:01 UTC (permalink / raw)
  To: 28621

[-- Attachment #1: Type: text/plain, Size: 2750 bytes --]

The doc for posn-window is incomplete.  posn-set-point does not handle drag
events whose end point argument is a frame, rather than a window.
This patch fixes both of these.  Read the code of posn-set-point to ensure
the logic is right in terms of using frame-selected-window.

This diff is against subr.el in Emacs 25.3 but I see none of this has yet
changed in Emacs 26 either, so it is still applicable.

*** subr.el.gz 2017-09-27 11:50:06.000000000 -0400
--- subr-new.el.gz 2017-09-27 11:50:06.000000000 -0400
***************
*** 1090,1096 ****
  The following accessor functions are used to access the elements
  of the position:

! `posn-window': The window the event is in.
  `posn-area': A symbol identifying the area the event occurred in,
  or nil if the event occurred in the text area.
  `posn-point': The buffer position of the event.
--- 1090,1096 ----
  The following accessor functions are used to access the elements
  of the position:

! `posn-window': The window or frame of the event end.
  `posn-area': A symbol identifying the area the event occurred in,
  or nil if the event occurred in the text area.
  `posn-point': The buffer position of the event.
***************
*** 1141,1148 ****

  (defsubst posn-window (position)
    "Return the window in POSITION.
! POSITION should be a list of the form returned by the `event-start'
! and `event-end' functions."
    (nth 0 position))

  (defsubst posn-area (position)
--- 1141,1149 ----

  (defsubst posn-window (position)
    "Return the window in POSITION.
! If POSITION is outside the frame where the event was initiated, return
! that frame instead.  POSITION should be a list of the form returned by
! the `event-start' and `event-end' functions."
    (nth 0 position))

  (defsubst posn-area (position)
***************
*** 1169,1177 ****
  (defun posn-set-point (position)
    "Move point to POSITION.
  Select the corresponding window as well."
!   (if (not (windowp (posn-window position)))
!       (error "Position not in text area of window"))
!   (select-window (posn-window position))
    (if (numberp (posn-point position))
        (goto-char (posn-point position))))

--- 1170,1182 ----
  (defun posn-set-point (position)
    "Move point to POSITION.
  Select the corresponding window as well."
!   (if (framep (posn-window position))
!       (progn (if (not (windowp (frame-selected-window (posn-window
position))))
! (error "Position not in text area of window"))
!      (select-window (frame-selected-window (posn-window position))))
!     (if (not (windowp (posn-window position)))
! (error "Position not in text area of window"))
!     (select-window (posn-window position)))
    (if (numberp (posn-point position))
        (goto-char (posn-point position))))

[-- Attachment #2: Type: text/html, Size: 8361 bytes --]

^ permalink raw reply	[flat|nested] 33+ messages in thread
* bug#28620: Mouse drag event records wrong window for release when crossing frames
@ 2017-09-27 15:44 Robert Weiner
  2017-10-03 20:54 ` bug#28620: (mouse-position_ wrong on macOS after mouse-1 click (Was: Interact directly on Emacs bug#28620: mouse drag event records wrong release window) Robert Weiner
                   ` (2 more replies)
  0 siblings, 3 replies; 33+ messages in thread
From: Robert Weiner @ 2017-09-27 15:44 UTC (permalink / raw)
  To: 28620

[-- Attachment #1: Type: text/plain, Size: 6543 bytes --]

With Emacs 25.3 under MacOS 10.12, a drag with mouse-1 depressed from
the text area of frame F1 to the text area of frame F2 improperly
generates a drag event whose (posn-window (event-end <event>)) shows
F1 rather than F2.

Note that for a drag between frames, posn-window should return a frame
(according to the Elisp manual but not its own doc string).  The bug is
that the event itself records the wrong frame (the depress frame rather
than the release frame).

I have confirmed this with Emacs 25.2 under Windows 7 as well.

Bob


In GNU Emacs 25.3.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version
10.9.5 (Build 13F1911))
 of 2017-09-12 built on builder10-9.local
Windowing system distributor 'Apple', version 10.3.1504
Configured using:
 'configure --with-ns '--enable-locallisppath=/Library/Application
 Support/Emacs/${version}/site-lisp:/Library/Application
 Support/Emacs/site-lisp' --with-modules'

Configured features:
NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp

Minor modes in effect:
  recentf-mode: t
  shell-dirtrack-mode: t
  diff-auto-refine-mode: t
  desktop-save-mode: t
  winner-mode: t
  which-key-mode: t
  show-paren-mode: t
  which-function-mode: t
  persistent-scratch-autosave-mode: t
  paredit-everywhere-mode: t
  dynamic-completion-mode: t
  global-edit-server-edit-mode: t
  delete-selection-mode: t
  auto-compile-on-load-mode: t
  auto-compile-on-save-mode: t
  auto-compile-mode: t
  outline-minor-mode: t
  minibuffer-depth-indicate-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  auto-fill-function: do-auto-fill
  transient-mark-mode: t

Features:
(shadow mail-extr emacsbug tabify man magit-utils crm pulse glasses
cus-start cus-load mule-diag ispell filecache two-column iso-transl
debug recentf tree-widget helm-x-files helm-for-files helm-bookmark
helm-adaptive helm-info bookmark helm-external helm-net helm-files
image-dired ffap helm-tags helm-locate tramp tramp-compat tramp-loaddefs
trampver eieio-opt speedbar sb-image ezimage dframe helm-buffers
helm-grep helm-regexp helm-utils helm-help helm-types thai-util
thai-word misearch multi-isearch pcmpl-unix pcmpl-gnu shell dired-aux
grep hywconfig network-stream nsm starttls web-beautify org-element
org-rmail org-mhe org-irc org-info org-gnus org-docview org-bibtex
bibtex org-bbdb org-w3m doc-view arc-mode archive-mode eww mm-url gnus
gnus-ems nnheader wid-edit url-queue shr dom texinfo make-mode
skewer-html markdown-mode color sh-script smie executable rst conf-mode
tern-auto-complete tern jsdock helm-dash cursor-sensor image-mode
flycheck rx flymake jedi auto-complete popup jedi-core
python-environment epc ctable concurrent deferred pydock pydoc goto-addr
autorevert filenotify vc-git diff-mode .emacs desktop frameset
window-jump winner which-key supercite regi sort skewer-setup
skewer-mode cache-table js2-mode js cc-mode cc-fonts cc-guess cc-menus
cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs simple-httpd pp
json map python-mode compile thingatpt aggressive-indent paren
which-func imenu persistent-scratch js-lookup paredit-everywhere
paredit-menu paredit par-align rep-region id-edit wrect rect id-linecol
bw-tags apropos file-hdr lib site-key site-func id-keys id-vers
chrome-macos emmet-mode dired-x completion ido server edit-server delsel
jka-compr auto-compile packed dash hmouse-tag etags xref project
rsw-helm helm-easymenu helm edmacro kmacro helm-source eieio-compat
helm-multi-match helm-lib wdired async hyperbole hinit hibtypes
hib-doc-id hsys-www klink subr-x hib-kbd hib-social hib-debbugs
debbugs-gnu debbugs soap-client url-http tls gnutls url-auth url-gw
warnings rng-xsd rng-dt rng-util xsd-regexp hsys-org org org-macro
org-footnote org-pcomplete pcomplete org-list org-faces org-entities
org-version ob-emacs-lisp ob ob-tangle ob-ref ob-lob ob-table ob-exp
org-src ob-keys ob-comint ob-core ob-eval org-compat org-macs
org-loaddefs find-func hactypes comint ansi-color hui-mini hui hui-mouse
hui-window hargs hui-menu hyrolo-menu hyrolo google-contacts xml
url-cache url url-proxy url-privacy url-expand url-methods url-history
url-cookie url-domsuf mailcap url-util url-parse auth-source cl-seq
eieio url-vars google-oauth hmail hui-jmenu noutline outline easy-mmode
hmouse-key hmouse-sh hmouse-drv hypb locate hsettings hui-em-but hbut
hact hpath hhist hbdata htz cal-julian cal-menu calendar cal-loaddefs
hbmap hmoccur derived browse-url hui-select web-mode disp-table
sgml-mode hvar set hversion hload-path package-x mail-hist sendmail ring
message dired format-spec rfc822 mml mml-sec password-cache epg
gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047
rfc2045 ietf-drums mm-util help-fns mail-prsvr mailabbrev mail-utils
gmm-utils mailheader rsw-evernote epic htmlize cl add-log
exec-path-from-shell finder-inf eieio-core cl-macs kotl-loaddefs
pydoc-info advice info-look info package epg-config seq byte-opt gv
bytecomp byte-compile cl-extra help-mode cconv mb-depth edebug easymenu
cl-loaddefs pcase cl-lib time-date mule-util tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel ns-win ucs-normalize
term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese charscript case-table epa-hook jka-cmpr-hook help
simple abbrev minibuffer cl-preloaded nadvice loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
kqueue cocoa ns multi-tty make-network-process emacs)

Memory information:
((conses 16 1208296 206512)
 (symbols 48 87755 1)
 (miscs 40 9963 6750)
 (strings 32 234897 19520)
 (string-bytes 1 7230712)
 (vectors 16 99432)
 (vector-slots 8 2323157 242912)
 (floats 8 1648 1850)
 (intervals 56 53652 6347)
 (buffers 976 433))

[-- Attachment #2: Type: text/html, Size: 17446 bytes --]

^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2020-10-11  2:06 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-27 16:01 bug#28621: Proposed patch for doc of posn-window and code of posn-set-point to handle frame arguments Robert Weiner
2017-09-27 21:34 ` John Wiegley
2017-09-29  8:34 ` martin rudalics
2017-09-29 16:48   ` Robert Weiner
2017-09-29 19:42   ` Eli Zaretskii
2017-09-29 19:41 ` Eli Zaretskii
2017-09-29 20:11   ` Robert Weiner
2017-09-30  8:32     ` martin rudalics
2017-09-30 12:45       ` Robert Weiner
2017-09-30 12:52         ` Robert Weiner
2017-09-30 17:12         ` martin rudalics
2017-09-30 21:56           ` bug#28620: " Robert Weiner
2017-09-30 23:34             ` Robert Weiner
2017-10-16 15:11             ` bug#28620: Emacs bug#28620: (PARTIAL SOLUTION) mouse-position wrong on macOS and Windows 7 after mouse-1 click Bob Weiner
2019-06-24 16:08     ` bug#28621: Proposed patch for doc of posn-window and code of posn-set-point to handle frame arguments Lars Ingebrigtsen
2019-06-27  2:20       ` Robert Weiner
2019-06-27 10:39         ` Lars Ingebrigtsen
2019-06-27 12:27         ` Robert Weiner
2020-08-24 13:28           ` Lars Ingebrigtsen
2020-08-24 13:29           ` Lars Ingebrigtsen
2020-10-11  2:06             ` Lars Ingebrigtsen
  -- strict thread matches above, loose matches on Subject: below --
2017-09-27 15:44 bug#28620: Mouse drag event records wrong window for release when crossing frames Robert Weiner
2017-10-03 20:54 ` bug#28620: (mouse-position_ wrong on macOS after mouse-1 click (Was: Interact directly on Emacs bug#28620: mouse drag event records wrong release window) Robert Weiner
2017-10-16 15:57 ` bug#28620: (PARTIAL SOLUTION) Mouse drag event records wrong window for release when crossing frames Bob Weiner
2019-07-27  9:26 ` bug#36269: bug#28620: " martin rudalics
2019-07-27 10:08   ` Eli Zaretskii
2019-07-28  7:34     ` martin rudalics
2019-07-29 23:21       ` Robert Weiner
2019-07-30  7:00         ` bug#36269: " martin rudalics
2019-08-03 11:25       ` Eli Zaretskii
2019-08-04  7:59         ` martin rudalics
2020-08-18 11:31           ` bug#28620: bug#36269: " Stefan Kangas
2020-08-18 12:15             ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).