unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#43672: 28.0.50; select-frame-set-input-focus does not set focus first time called
@ 2020-09-28 13:34 Arthur Miller
  2020-09-28 13:57 ` Lars Ingebrigtsen
  2020-09-28 17:59 ` martin rudalics
  0 siblings, 2 replies; 21+ messages in thread
From: Arthur Miller @ 2020-09-28 13:34 UTC (permalink / raw)
  To: 43672

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


When calling

      (select-frame-set-input-focus some-frame)

the frame is raised, but does not recieve the focus. I have to call 
twice to 'select-frame-set-input-focus' for the frame to get
focused. Docs says "focused if possible", so I am not sure if it some
bug or/and how much does it depend on my window manager used; but
calling it twice consecutively works.

I have attached an example code. To reproduce, emacs -Q, an eval
attached code.

If I missunderstand docs, or am calling it wrongly, dissregard the
rapport plz :-).


[-- Attachment #2: test example --]
[-- Type: text/plain, Size: 2507 bytes --]

;;; poor-man-menu.el ---                                 -*- lexical-binding: t; -*-

(defun pm-test ()
  (interactive)
  (let ((test (get-buffer "testmenu")))
    (when (not test)
      (with-current-buffer (get-buffer-create "testmenu")
        (insert "one")
        (newline)
        (insert "two")
        (newline)
        (insert "three")
        (newline)
        (insert "four"))))
  (pm-show-at-point "testmenu"))

(define-minor-mode pm-minor-mode
  :keymap (let ((map (make-sparse-keymap)))
            map))

(defun pm-quit ()
  (interactive)
  (let ((b (window-buffer)))
        (when b (kill-buffer b)))
  (delete-frame (selected-frame)))

(defun pm-show-at-point (menuname)
  (let ((position (pos-visible-in-window-p nil nil t)))
      (pm-create-menu menuname (nth 0 position) (nth 1 position))))

(defun pm-show-at-cursor (menuname)
  (let ((cursor-pos (mouse-pixel-position)))
        (pm-create-menu menuname (cadr cursor-pos) (cddr cursor-pos))))
    
(defun pm-create-menu (menuname x y)

  (when (not (get-buffer menuname))
    (pm-load-menu menuname))
  
  (with-current-buffer (get-buffer menuname)
    (pm-minor-mode)
    (define-key pm-minor-mode-map (kbd "C-g")   'pm-quit)

    (setq tab-line-format nil)
    (setq mode-line-format nil)
    
    (let ((parent (selected-frame))
          (child-frame (make-frame   '((visible . 0)
                                       (undecorated . 0)
                                       (keep-ratio . t)
                                       (menu-bar-lines . 0)
                                       (tool-bar-lines . 0)
                                       (left-fringe . 0)
                                       (right-fringe . 0)
                                       (line-spacing . 0)
                                       (unsplittable . t)
                                       (minibuffer . nil)
                                       (no-other-frame . t)
                                       (drag-internal-border . t)
                                       (inhibit-double-buffering . t)
                                       (desktop-dont-save . t)))))
      
      (set-frame-parameter child-frame 'parent-frame parent)
      (fit-frame-to-buffer child-frame)
      (set-frame-position child-frame x y)
      ;;(raise-frame child-frame)
      ;; needs two calls to get raised AND focused
      (select-frame-set-input-focus child-frame)
      (select-frame-set-input-focus child-frame))))

(provide 'poor-man-menu)

[-- Attachment #3: Type: text/plain, Size: 3156 bytes --]



In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.23, cairo version 1.17.3)
 of 2020-09-27 built on pascal
Repository revision: dc0cf16c7a60f36aafcf9b56513a855cefa7e1ad
Repository branch: feature/native-comp
Windowing system distributor 'The X.Org Foundation', version 11.0.12009000
System Description: Arch Linux

Configured using:
 'configure --with-gnutls --without-gconf --with-rsvg --with-x
 --with-xwidgets --without-toolkit-scroll-bars --without-xaw3d
 --without-gsettings --with-mailutils --with-nativecomp 'CFLAGS=-O3
 -mtune=native -march=native -fomit-frame-pointer''

Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GLIB NOTIFY INOTIFY ACL
GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB GTK3 X11 XDBE XIM
MODULES NATIVE_COMP THREADS XWIDGETS LIBSYSTEMD JSON PDUMPER LCMS2

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

Major mode: ELisp/l

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-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
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml easymenu mml-sec epa derived epg epg-config gnus-util rmail
rmail-loaddefs auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json map text-property-search seq byte-opt
gv bytecomp byte-compile cconv mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils edmacro kmacro time-date subr-x
cl-loaddefs cl-lib pure-menu easy-mmode tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer 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 composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button
loaddefs faces cus-face pcase macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads xwidget-internal dbusbind
inotify lcms2 dynamic-setting font-render-setting cairo move-toolbar gtk
x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 65534 9142)
 (symbols 48 7061 0)
 (strings 32 19304 1280)
 (string-bytes 1 699011)
 (vectors 16 12611)
 (vector-slots 8 276483 9931)
 (floats 8 26 105)
 (intervals 56 610 517)
 (buffers 992 13))

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

end of thread, other threads:[~2022-04-21 14:02 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-28 13:34 bug#43672: 28.0.50; select-frame-set-input-focus does not set focus first time called Arthur Miller
2020-09-28 13:57 ` Lars Ingebrigtsen
2020-09-28 14:11   ` Arthur Miller
2020-09-28 14:14     ` Lars Ingebrigtsen
2020-09-28 14:40       ` Arthur Miller
2020-09-29 13:46         ` Lars Ingebrigtsen
2020-09-29 14:34           ` martin rudalics
2020-09-29 14:44             ` Lars Ingebrigtsen
2020-09-29 20:43             ` Arthur Miller
2020-09-30  8:15               ` martin rudalics
2020-09-30  9:31                 ` Arthur Miller
2020-09-30 17:33                   ` martin rudalics
2020-09-30 17:36                     ` arthur miller
2020-10-01  8:39                       ` martin rudalics
2020-10-17 21:51                         ` Arthur Miller
2020-10-18  7:56                           ` martin rudalics
2020-10-18 14:10                             ` Arthur Miller
2020-10-20  7:20                               ` martin rudalics
2022-04-21 14:02                               ` Lars Ingebrigtsen
2020-09-28 17:59   ` martin rudalics
2020-09-28 17:59 ` martin rudalics

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).