From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.bugs Subject: bug#31880: 26.1; VC mode line popup when clicked is off screen Date: Wed, 20 Jun 2018 16:31:32 +0200 Message-ID: <87vaad4ji3.fsf@gmail.com> References: <5B28ADFC.4060704@gmx.at> <380133793885a54af49bbc8715cfea4ced525342.camel@echosa.net> <5B2A056F.1040003@gmx.at> <874lhx6azn.fsf@gmail.com> <5B2A40B2.4020600@gmx.at> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1529505102 7939 195.159.176.226 (20 Jun 2018 14:31:42 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 20 Jun 2018 14:31:42 +0000 (UTC) Cc: Brian Zwahr , 31880@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jun 20 16:31:37 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1fVe93-0001yW-8c for geb-bug-gnu-emacs@m.gmane.org; Wed, 20 Jun 2018 16:31:37 +0200 Original-Received: from localhost ([::1]:50055 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVeBA-00088M-4N for geb-bug-gnu-emacs@m.gmane.org; Wed, 20 Jun 2018 10:33:48 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44734) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVe9W-0007Jq-0z for bug-gnu-emacs@gnu.org; Wed, 20 Jun 2018 10:32:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fVe9S-0007AE-3D for bug-gnu-emacs@gnu.org; Wed, 20 Jun 2018 10:32:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:49894) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fVe9R-0007A4-Vd for bug-gnu-emacs@gnu.org; Wed, 20 Jun 2018 10:32:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fVe9R-00019T-Q6 for bug-gnu-emacs@gnu.org; Wed, 20 Jun 2018 10:32:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Robert Pluim Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 20 Jun 2018 14:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31880 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 31880-submit@debbugs.gnu.org id=B31880.15295051024400 (code B ref 31880); Wed, 20 Jun 2018 14:32:01 +0000 Original-Received: (at 31880) by debbugs.gnu.org; 20 Jun 2018 14:31:42 +0000 Original-Received: from localhost ([127.0.0.1]:57791 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fVe97-00018u-Sy for submit@debbugs.gnu.org; Wed, 20 Jun 2018 10:31:42 -0400 Original-Received: from mail-wr0-f180.google.com ([209.85.128.180]:36965) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fVe96-00018h-DL for 31880@debbugs.gnu.org; Wed, 20 Jun 2018 10:31:40 -0400 Original-Received: by mail-wr0-f180.google.com with SMTP id k6-v6so727148wrp.4 for <31880@debbugs.gnu.org>; Wed, 20 Jun 2018 07:31:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:mail-copies-to:gmane-reply-to-list :date:in-reply-to:message-id:mime-version:content-transfer-encoding; bh=+xkdnWWK7SJP5x7Pqpsl9/vWoFcStdZ5G6lJhDTXNlA=; b=NgMWCcwTWKq8z45CwDa82xW8Y08CpIkptvmYklN2Mq7brWe9lAldqAkxERZI80mOkE b+zN7BdctOisobr86zIMVoPNYc+GWeTAV7SAm+2WHRJ1EHTLO7Mc+yfV5R9PFpbrfJBy Pujk2X8NscUzp7rbxzsVRydYvL+ybSqQjvvexhmQ42PzqV1ODLQIsGZObKst4Lzp1eOZ RG3AhfIvu1FkoeDKm1ZEIt6c/RSXTIzWlSKnSI4zUwcuPL2IkceVabdOMiUyagtmM1nj 8q9YwWiQtEVryXHAZuyUqFLPR3DDXLMQtULswlCOvfwEcty7stKfjw/JdREP1se+YWeH 9PUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:mail-copies-to :gmane-reply-to-list:date:in-reply-to:message-id:mime-version :content-transfer-encoding; bh=+xkdnWWK7SJP5x7Pqpsl9/vWoFcStdZ5G6lJhDTXNlA=; b=NSz9EtJ67ON7eVHBP9yyOErMk4o5Et0ux7n+CFRidyHtQ94PRcwk0iDsGDZX3vAWze 7xcHO9c6oO0sltzm/3PEIE9f8NsYNavYqZ0Vxj0CqMUL+fZlLVRE3/qJO3WRt8R5fTKY lc1vnJ58l2Gb0lPFoI58yX6Dc8Q+DGRGW8mFCclVOI2cICSqstd/9ZouobjQ3PPbyLTc +yI0NkqqbshD8fAcMx6Aa3ab4PcYg4gzj/RaWMbrwuIboB52LarJatL1dNUlg7NZDtzt hGaHj95RVhyQxZEs0+1fSt6ztwxAiNinrdjVujOuwCE9YpZ8UQ5cMlGg+K8AcsxUcILv wjtA== X-Gm-Message-State: APt69E1lPkJBFzoYDag3i0UuWwh9iBKWndjrnoh376nAgo4W6Ia7mgMc q1MzN8ZS9Jvh+cujM4TYcV5Ny4U1 X-Google-Smtp-Source: ADUXVKKGrAwxt6L65dPqjJS/QmFpllHlz4sn24ligBoLcVBi/HZFVEL5vOMnzUBkjt+MTc9ytGTMDA== X-Received: by 2002:adf:da4e:: with SMTP id r14-v6mr17548923wrl.154.1529505094157; Wed, 20 Jun 2018 07:31:34 -0700 (PDT) Original-Received: from rpluim-ubuntu ([149.5.228.1]) by smtp.gmail.com with ESMTPSA id h71-v6sm3498273wme.47.2018.06.20.07.31.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jun 2018 07:31:33 -0700 (PDT) Mail-Copies-To: never Gmane-Reply-To-List: yes In-Reply-To: <5B2A40B2.4020600@gmx.at> (martin rudalics's message of "Wed, 20 Jun 2018 13:55:30 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:147659 Archived-At: martin rudalics writes: >> It should, but it doesn=CA=BCt. I see similar problems here, but I don= =CA=BCt >> understand why (unless this is another instance of "Mixing X and GTK >> calls will bite your arse eventually"). > > What happens when you move a frame to the bottom of your screen and > open a menu bar entry? Does it also get hidden? No, menu bar menus are fine. >> GTK tooltips seem to appear in the right place, so I=CA=BCll look for >> inspiration there. > > It's up to GTK to decide whether a menu fits on the screen so maybe it > messes up the height of menu bar text when scaling is in effect. Does > scaling affect the height of menus in the first place? Does it affect > the height of tooltips? > Yes and yes, because it affects the size of the font used to display them. > Thanks for looking into this, martin Yet another instance of a disagreement between how GTK and X calculate pixels. Who will rid me of this turbulent mix? Brian, would it be possible for you to try out the following patch? It fixes things for me here. diff --git i/src/xmenu.c w/src/xmenu.c index e7ef31ac56..3a245771e1 100644 --- i/src/xmenu.c +++ w/src/xmenu.c @@ -1162,11 +1162,16 @@ menu_position_func (GtkMenu *menu, gint *x, gint *y= , gboolean *push_in, gpointer GtkRequisition req; int max_x =3D -1; int max_y =3D -1; + int scale =3D 1; =20 Lisp_Object frame, workarea; =20 XSETFRAME (frame, data->f); =20 +#ifdef HAVE_GTK3 + scale =3D xg_get_scale (data->f); +#endif + /* TODO: Get the monitor workarea directly without calculating other items in x-display-monitor-attributes-list. */ workarea =3D call3 (Qframe_monitor_workarea, @@ -1192,11 +1197,18 @@ menu_position_func (GtkMenu *menu, gint *x, gint *y= , gboolean *push_in, gpointer max_y =3D x_display_pixel_height (dpyinfo); } =20 + /* frame-monitor-workarea and {x,y}_display_pixel_width/height all + return device pixels, but GTK wants scaled pixels. The positions + passed in via data were already scaled for us. */ + max_x /=3D scale; + max_y /=3D scale; *x =3D data->x; *y =3D data->y; =20 /* Check if there is room for the menu. If not, adjust x/y so that - the menu is fully visible. */ + the menu is fully visible. gtk_widget_get_preferred_size returns + scaled pixels, so there is no need to apply the scaling + factor. */ gtk_widget_get_preferred_size (GTK_WIDGET (menu), NULL, &req); if (data->x + req.width > max_x) *x -=3D data->x + req.width - max_x;