From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.devel Subject: Re: Child-frame can not move to proper position when run "env GDK_SCALE=2 emacs" Date: Tue, 09 Jan 2018 11:06:29 +0100 Message-ID: <87incbe47u.fsf@gmail.com> References: <87wp0sy3bq.fsf@163.com> <5A53B5C5.70105@gmx.at> <87608c54xw.fsf@163.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1515492345 22627 195.159.176.226 (9 Jan 2018 10:05:45 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 9 Jan 2018 10:05:45 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) Cc: Feng Shu , emacs-devel@gnu.org To: martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jan 09 11:05:40 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eYqmj-00052i-BT for ged-emacs-devel@m.gmane.org; Tue, 09 Jan 2018 11:05:33 +0100 Original-Received: from localhost ([::1]:42850 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eYqoh-0000OW-3E for ged-emacs-devel@m.gmane.org; Tue, 09 Jan 2018 05:07:35 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36937) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eYqnp-0000LO-KV for emacs-devel@gnu.org; Tue, 09 Jan 2018 05:06:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eYqnl-0004MB-M8 for emacs-devel@gnu.org; Tue, 09 Jan 2018 05:06:41 -0500 Original-Received: from mail-wm0-x232.google.com ([2a00:1450:400c:c09::232]:36643) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eYqnl-0004JK-Et for emacs-devel@gnu.org; Tue, 09 Jan 2018 05:06:37 -0500 Original-Received: by mail-wm0-x232.google.com with SMTP id b76so19584543wmg.1 for ; Tue, 09 Jan 2018 02:06:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:references:cc:gmane-reply-to-list:date:message-id :user-agent:mime-version; bh=HvYeQOWCGbQo/acNv2MwubrHJgqa/mjHVe7DQl+2Joc=; b=tYLU+SSh5jI0H1l6V8X5HBiMpDnU5Wro93F9NSTLskwXV3e5yDUivgWZo8EwvJf7Rt 4NQEExnJJ7SSeAWbe5WNTf/WPh581fipSGBwqiAxmYkz8jkRqvQHN/5AeH1ZVAaxsw30 CxcoTTY1OimjdBQPqRGyOpMSZjiAbhW11Bnx8IopA4TfCClpiiEb4E+TcDnvIFcXqBqq sotRh6xwUpvr58rqEFVT+XBSzpOMTS52KK9oVhNOq91MmZJKhfmix5F15OovvuCOKjbO 4MUPov+uKAx8BlSTExiWJ1MdFjNiGUQHneEvXtlxjyIZi53R7eQKxwF21RVdzI8NJ8rV dKpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:references:cc :gmane-reply-to-list:date:message-id:user-agent:mime-version; bh=HvYeQOWCGbQo/acNv2MwubrHJgqa/mjHVe7DQl+2Joc=; b=bFm9d0b/1WnVTAaV4nGMEX6SjyIz9MC6i92Ti9Yox6MWC8mF71huWzEuoexVpN4XnR GJ4JQ4MxrUvVKPSoaqWRCIdb7qsOuNGn0i0b+8vn9HTh2TZHt9wVjPT1wDZWnMYHosz9 UUGBTH+gyCCLO3ix9SJItR+gmlCFPHTXelz+SFXxD1Okje/K0NCGNd5B5olJVXQBYDTW CEizX9jw5A72S3v5NxwXndrwvHjFO0F2s3Sqyo9oSAGh4XLySo1H8ttqEOXTkdXuVxe/ 5uPOdzqe9/0GqrfOOcv3FVlUO74Q5DqN7zNlAczx4pEl3mko02ip1rfdcly5mWVevhwD KJ6Q== X-Gm-Message-State: AKwxytdzII9E0JdM2MLuSxB+dwK6X5C0ZFsTWv+q2OXxuZ2p/HHRADUv q4dwz6J1M1gbe0I0d/BDfTRya+co X-Google-Smtp-Source: ACJfBov8bqBRyADOu1U5XMix+7DjBqB11B+yBho7vDVUDv5vPx/ktIQys6q6xUYyhWrkFcsqJK6Qng== X-Received: by 10.80.241.152 with SMTP id x24mr1198865edl.59.1515492394502; Tue, 09 Jan 2018 02:06:34 -0800 (PST) Original-Received: from rpluim-ubuntu ([149.5.228.1]) by smtp.gmail.com with ESMTPSA id v20sm7886766edm.10.2018.01.09.02.06.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 02:06:32 -0800 (PST) Gmane-Reply-To-List: yes X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::232 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:221754 Archived-At: "Feng Shu" writes: > martin rudalics writes: > >>> When I run "env GDK_SCALE=2 emacs", the below code can not work properly >>> >>> ``` >>> (let ((test (let ((after-make-frame-functions nil)) >>> (make-frame >>> `((parent-frame . ,(window-frame)) >>> (width . 50) >>> (height . 1))))) >>> (pos (posn-x-y (posn-at-point (point) (selected-window))))) >>> (set-frame-position test (car pos) (cdr pos))) >>> ``` >>> >>> When I eval the code at the , the new created frame can not move to >>> , it move to the wrong position. >> >> What happens when you divide the pos values by two? > > When (/ x 2) and (/ y 2), It works! :-) > >> >> We do not expose the GTK/GDK scale values in Lisp, maybe we should. >> Robert any ideas? Ugh. I don't think we should expose the scale values, we should fix whatever the issue is with set-frame-position. Naively that's the attached patch, but I worry about other places that assume unscaled coordinates. I'll run with it for a while and see if any pop up. Longer term we need to implement your 'eliminate direct X calls' plan, and have everything inside Emacs use GTK coordinates. Robert diff --git i/src/xterm.c w/src/xterm.c index f771631daf..950e6231e0 100644 --- i/src/xterm.c +++ w/src/xterm.c @@ -10311,6 +10311,14 @@ x_set_offset (struct frame *f, register int xoff, register int yoff, int change_ { int modified_top, modified_left; +#ifdef USE_GTK + { + int scale = xg_get_scale(f); + xoff /= scale; + yoff /= scale; + } +#endif + if (change_gravity > 0) { f->top_pos = yoff;