From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arthur Miller Newsgroups: gmane.emacs.bugs Subject: bug#43672: 28.0.50; select-frame-set-input-focus does not set focus first time called Date: Sat, 17 Oct 2020 23:51:16 +0200 Message-ID: References: <87d026uhp7.fsf@gnus.org> <87y2kut2cp.fsf@gnus.org> <87a6x8elva.fsf@gnus.org> <7b7b537b-0092-446c-4197-465e75595248@gmx.at> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16821"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Lars Ingebrigtsen , "43672@debbugs.gnu.org" <43672@debbugs.gnu.org> To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 17 23:52:13 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kTu7Y-0004FF-NE for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 17 Oct 2020 23:52:12 +0200 Original-Received: from localhost ([::1]:42202 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kTu7X-0003QJ-9O for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 17 Oct 2020 17:52:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43518) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kTu7P-0003Q8-Ml for bug-gnu-emacs@gnu.org; Sat, 17 Oct 2020 17:52:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52366) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kTu7O-0004UY-IE for bug-gnu-emacs@gnu.org; Sat, 17 Oct 2020 17:52:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kTu7O-0007sF-Fk for bug-gnu-emacs@gnu.org; Sat, 17 Oct 2020 17:52:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Arthur Miller Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 17 Oct 2020 21:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43672 X-GNU-PR-Package: emacs Original-Received: via spool by 43672-submit@debbugs.gnu.org id=B43672.160297148830216 (code B ref 43672); Sat, 17 Oct 2020 21:52:02 +0000 Original-Received: (at 43672) by debbugs.gnu.org; 17 Oct 2020 21:51:28 +0000 Original-Received: from localhost ([127.0.0.1]:35679 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kTu6q-0007rI-2o for submit@debbugs.gnu.org; Sat, 17 Oct 2020 17:51:28 -0400 Original-Received: from mail-vi1eur05olkn2037.outbound.protection.outlook.com ([40.92.90.37]:45056 helo=EUR05-VI1-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kTu6n-0007r0-PV for 43672@debbugs.gnu.org; Sat, 17 Oct 2020 17:51:26 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dwHUfvl5vHosVYpsJKIU8Mzo02vtsejUpSxPG8e6G9ppg/GKqkgjR3dD6NQUFn5H+91WgzBwsrQH1bRVJZPcIWZPrfVmDMbIpLjq2Ru64qq7Ckj9N0+rvL+IIVIXYbXrTEAG6Uhv6pbEU3A4YTrZ+FZxL/sgnFVa/U3fiZAbmC8pBwcYPWTp+BHumtmLEwHJXfSrMTkmI1BMGvHctZas9t+Fzsg56M8MUXSZtevYkxjOZj0YkTK9FzGxOkQYuaq40hehb8Ib/KcrWdsbXwTbWXvYprMEAuYludTfL0dzoI1razaBSKFrQrtskJ6tAtnCsghiQ35UPIRqfGrsN2zYzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VXeOsPpXOjiU5fPGN4Wi8u7bKJwQ+TR0qpoXjnKUExQ=; b=jAjeVc7x0En6BNVL9i0Dg8u/vwD0zDN3TK51p1QcVuYvHNGoCy1NC8d5tHXcC6rNAmxmVclwOTme7une8VzhCQAbclTuLhM0m2tUeIanGLy+/OvDGv34tIqzpPo6IGBTL59kTHAoTSjsKQgWqcr17r45AkrSg/g0riGbFWw8F9u9FxnuwBwp9yUKmNspVqBV874cSfWFi+Cw+wrc8IUiG1wsSF28lOc1dbmFdVesV64qqVxizhWpWbwPtSUzOw8mt93Juk2cAdCVhZUaPi88AzmyFybIW5sQ55vdUbn8W+RKl3SW/KFw1xx8DoMudBB6SHdIxCUjSGNYbFEltLvkVg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VXeOsPpXOjiU5fPGN4Wi8u7bKJwQ+TR0qpoXjnKUExQ=; b=u8lmEOvxXaiKz32SVijPH9f3IHnprMw3Yl1G/3noLAFnwfFgAO7GrYMOSZzISz0fcFJMRN2r4Jgw7Hh70xPEqVJuUp76XvA7J4JYJAwAW/M5UG6EdDL80FsBlvMtxzrj4CKFrdK3TeyITm2JiQqzaDb/IWYLeZD5jerYHbJ984bwvZa4kyUyTVWFSAm6Nj1/0IsoLIZDYI53EQwWMmTDKj2R7hlV9ZoE2Z5NyrHTd8nzcD2zbkyTpfvp/kh0nytJY9RRui2TqCnv8ppQExXeQzSqPCHeuvtpLgls0QfvPATmx809KGvHaFBgtwaM6Lc+bLGHlbdbcGdDJ0/Vb+9AmA== Original-Received: from DB8EUR05FT058.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::50) by DB8EUR05HT094.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::462) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.23; Sat, 17 Oct 2020 21:51:18 +0000 Original-Received: from VI1PR06MB4526.eurprd06.prod.outlook.com (2a01:111:e400:fc0f::48) by DB8EUR05FT058.mail.protection.outlook.com (2a01:111:e400:fc0f::164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.21 via Frontend Transport; Sat, 17 Oct 2020 21:51:18 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:B661D5DB3DE11FD5AC4C73F8F8F2A39892EEC29F9F53E0AFE92CA73FDC35C75C; UpperCasedChecksum:24E1877314640F545F17866302F9555EAA7E1D2519B1CF3756EA9266880DD5FC; SizeAsReceived:9404; Count:46 Original-Received: from VI1PR06MB4526.eurprd06.prod.outlook.com ([fe80::187b:196a:cb2d:adf1]) by VI1PR06MB4526.eurprd06.prod.outlook.com ([fe80::187b:196a:cb2d:adf1%5]) with mapi id 15.20.3477.023; Sat, 17 Oct 2020 21:51:18 +0000 In-Reply-To: (martin rudalics's message of "Thu, 1 Oct 2020 10:39:15 +0200") X-TMN: [P0PE8iE1dqrcL8Ps7EExSTZcoxTVJp9H] X-ClientProxiedBy: BEXP281CA0005.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10::15) To VI1PR06MB4526.eurprd06.prod.outlook.com (2603:10a6:803:ac::17) X-Microsoft-Original-Message-ID: <87r1pw5xnv.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (90.230.29.56) by BEXP281CA0005.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.4 via Frontend Transport; Sat, 17 Oct 2020 21:51:18 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 46 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 1c77da46-4e2d-440d-09b5-08d872e6c72f X-MS-TrafficTypeDiagnostic: DB8EUR05HT094: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HK1ew6wxUoa783qyss+1HDhQuEN4naeJMuqQSIYFRvfT3fOkvexUV2MLMeXTNXfni+sgNYmqIR+3ZrYmBWm8USNjcO7TqU5nny1DFZDhLS0DU/5nKUzNLLYzkLhZich8y1guCd8pMTlxhh0YGn5zB4bms4p51BMnvC2QD/9w2nqFuPTlwEz50T9NAbos/vUGrLl/QCgbcoY7C+cE4P545A== X-MS-Exchange-AntiSpam-MessageData: D482GuqIGOKeK5p0V2SRClKEyCb7sYVL+CNoBsJVcmo0OmTU7Oy4R+94UUz28fVcTqk99LondaE5Yg4IlYSztg31lFpPuBHk1ps3frrvl1e3GzA957zoJTWV72foUHoaxUPrnt+PbLaNhUM+XY58Uw== X-OriginatorOrg: live.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1c77da46-4e2d-440d-09b5-08d872e6c72f X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2020 21:51:18.8105 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: DB8EUR05FT058.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8EUR05HT094 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:190840 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable martin rudalics writes: >> I am sorry f=C3=B6r the confusion, I was just to fast typing. Yes, you >> understand me correctly. It works correctly in emacsclient; not >> correctly when I run Emacs as a standalone process, either with -Q >> flag or without. > > Then please with emacs -Q try the simpler > > (defvar child-frame nil) > > (defun make-child-frame () > (interactive) > (setq child-frame > (make-frame `((parent-frame . ,(selected-frame)) > (left . 10) > (top . 10) > (width . 20) > (height . 10)))) > (select-frame-set-input-focus child-frame)) > > (defun delete-child-frame () > (interactive) > (delete-frame child-frame)) > > and tell us whether the child frame gets focus. > > martin Hello Martin, sorry for being a bit late with this. I have tested and it was very strange, so I realized I need more time to play with it. Here is how I got it: If I pass parent in the frame-params list to make-frame, then all is grandy-dandy; but if I don't then the behaviour is as following: If parent is set after creation; the frame will be reparented correctly and appear at correct place on the screen, but it won't switch focus. If parent is not set after the creation; the frame will switch focus, buf it will of course appear somewhere at the screen (absolute coordinates I guess). I have tested only emacsclient. I hope it helps. I have attached a simplified test file: --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=poorman-menu.el ;;; poorman-menu.el --- -*- lexical-binding: t; -*- ;; Copyright (C) 2020 Arthur Miller ;; Author: Arthur Miller ;; Keywords: ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . ;;; Commentary: ;; ;;; Code: (defvar pm-menu-dir ) (defun pm-load-menu (menuname) (with-current-buffer (get-buffer-create menuname) (insert-file-contents (concat pm-menu-dir menuname)) (not-modified) (current-buffer))) (defun pm-menutest () (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-cursor "testmenu")) (defun pm-unload-menu (menuname) (let ((b (get-buffer menuname))) (if b (kill-buffer b)))) (define-minor-mode pm-minor-mode "" :keymap (let ((map (make-sparse-keymap))) (define-key map (kbd "C-g") 'pm-quit) map)) (defun pm-hide-menu (menuframe) (make-frame-invisible)) (defun pm-quit () (interactive) (let ((b (window-buffer))) (when b (kill-buffer b))) (delete-frame (selected-frame))) (defun pm-show-at-point (menuname) (let ((pos (pos-visible-in-window-p nil nil t))) (pm-create-menu menuname (nth 0 pos) (nth 1 pos)))) (defun pm-show-at-cursor (menuname) (let ((pos (mouse-pixel-position))) (if pos (pm-create-menu menuname (cadr pos) (cddr pos)) (pm-show-at-point (menuname))))) (defun pm-create-menu (menuname x y) "Displays a menu MENUNAME as a vertical menu. If x and y are given, the menu will be shown at those coordinates. Default is current cursor position. If cursor is outside an Emacs frame window is displayed at active point." (when (not (get-buffer menuname)) (pm-load-menu menuname)) (with-current-buffer (get-buffer menuname) (pm-minor-mode) (setq tab-line-format nil) (setq mode-line-format nil) (let ((parent (selected-frame)) (child-frame ;; (make-frame `((parent-frame . ,(selected-frame)) ;; (left . ,x) ;; (top . ,y) ;; (width . 20) ;; (height . 10))))) ;; (select-frame-set-input-focus child-frame))) (make-frame `((visible . nil) ;;(parent-frame . ,(selected-frame)) (undecorated . nil))))) (fit-frame-to-buffer child-frame) (set-frame-position child-frame x y) (set-frame-parameter child-frame 'parent-frame parent) (select-frame-set-input-focus child-frame))) ) (provide 'poorman-menu) ;;; pure-menu.el ends here --=-=-=--