From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alex Newsgroups: gmane.emacs.bugs Subject: bug#23568: 25.0.94; Mode line menus appear incorrectly in some monitor configurations Date: Sun, 28 May 2017 01:09:17 -0600 Message-ID: <87y3thjw4i.fsf@gmail.com> References: <871t50xvm6.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1495955410 8288 195.159.176.226 (28 May 2017 07:10:10 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 28 May 2017 07:10:10 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) To: 23568@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun May 28 09:10:06 2017 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 1dEsL0-00024C-I1 for geb-bug-gnu-emacs@m.gmane.org; Sun, 28 May 2017 09:10:06 +0200 Original-Received: from localhost ([::1]:43001 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dEsL6-0003oK-2J for geb-bug-gnu-emacs@m.gmane.org; Sun, 28 May 2017 03:10:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47222) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dEsL0-0003lp-2N for bug-gnu-emacs@gnu.org; Sun, 28 May 2017 03:10:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dEsKw-0005EX-Sp for bug-gnu-emacs@gnu.org; Sun, 28 May 2017 03:10:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:38539) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dEsKw-0005EO-Pm for bug-gnu-emacs@gnu.org; Sun, 28 May 2017 03:10:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dEsKw-0000x7-Ex for bug-gnu-emacs@gnu.org; Sun, 28 May 2017 03:10:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alex Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 28 May 2017 07:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23568 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23568-submit@debbugs.gnu.org id=B23568.14959553833631 (code B ref 23568); Sun, 28 May 2017 07:10:02 +0000 Original-Received: (at 23568) by debbugs.gnu.org; 28 May 2017 07:09:43 +0000 Original-Received: from localhost ([127.0.0.1]:41216 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dEsKc-0000wV-W2 for submit@debbugs.gnu.org; Sun, 28 May 2017 03:09:43 -0400 Original-Received: from mail-io0-f193.google.com ([209.85.223.193]:36164) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dEsKb-0000wJ-Su for 23568@debbugs.gnu.org; Sun, 28 May 2017 03:09:42 -0400 Original-Received: by mail-io0-f193.google.com with SMTP id f102so4629752ioi.3 for <23568@debbugs.gnu.org>; Sun, 28 May 2017 00:09:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:references:date:in-reply-to:message-id:user-agent :mime-version; bh=8Sir0skE4oNU9OYOWFkYFqoG2xhWZPilA4e4ExY8YXY=; b=J/bSUvxSwmOnRaIGqTRzZ4UD91TzVxl980KFKgkKIZAa6nXtwnTceEM/YwkxfdutxR BPahrOXR8WpDqwEYNo7I+2s0lkW4RqgVgBEkmGxVnurMa3vA1o3Xq25ClWk+sMHTSZpr B1jtO5ae2+NJLQJAuLkgzxePm/1rE3zGSjMsR6cpJmVrtX7fNIXlsd5EW9S7zxDVqX0h xJe1MKH1zlRWyKtJGsSCPAZgF91rRiD+CnOvtibQY5S7sqyewZfp7apfuUZy3ClEBAkT OjIA+pX5TlAq7TFSw/ISvXvAHF2xO5bYCCbjPDkXfA6lai1QQflCkzXHf0WNHKkjbIux 4vDw== 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:date:in-reply-to :message-id:user-agent:mime-version; bh=8Sir0skE4oNU9OYOWFkYFqoG2xhWZPilA4e4ExY8YXY=; b=azEvf7cjQH+Bmv3twW07dEqhvo9WE/n2AiL1L9GF34rFKT/GwaRbYdMlKhl+Y5WX8+ eOpOwRpHICmjXeId1nwO8OX/g27KQMBOrnhq9JX6akQoyJ6QqEQxHQ7f1XTmR7kNewpi 5FOCiCIt6RO+a3bnDTiiCUBLAPUwJTMp4fYN+CQ1xoHimW9nuN5HhW/LP1C7U1aofmYp GUWmnXuMIWNztY+7rqwhGvx8BglgUm7gAMpo1QyF8Kjr8nRSA+wHW+p2e4eGJYrV0z1s MVo+A+cDvPAYdwKuYjnSFGMnOe0dMSNAPS/vSwm/IFuwn5IAV3o4+W1CQcHq74bo/J+U 59ZQ== X-Gm-Message-State: AODbwcC0/bpDXxhnR59VOUFLh3HeTLF/b+d5Oq/9MDPuIGUSDP0OW5bC GMmOyOVBiOBF46tT X-Received: by 10.107.187.135 with SMTP id l129mr8318220iof.219.1495955376067; Sun, 28 May 2017 00:09:36 -0700 (PDT) Original-Received: from lylat (S010664777d9cebe3.ss.shawcable.net. [70.64.85.59]) by smtp.gmail.com with ESMTPSA id g12sm2700187iog.60.2017.05.28.00.09.34 for <23568@debbugs.gnu.org> (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 May 2017 00:09:34 -0700 (PDT) In-Reply-To: <871t50xvm6.fsf@gmail.com> (Alex's message of "Tue, 17 May 2016 14:44:33 -0600") 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:132943 Archived-At: --=-=-= Content-Type: text/plain Alex writes: > The menus that display when clicking on various items in the mode line > (major mode, minor mode, buffer position) don't display correctly with > certain monitor setups on X, specifically when using multiple monitors > where the bottoms of the monitors are not even. They appear squished and > are effectively unusable. > > FWIW, a similar issue appeared with the mode line tooltips that > displayed when hovering over these items in Emacs 24.5, but they have > since been fixed. > > The menu bar menus do not suffer this problem. > > When running from the command line, the following message usually > appears: > > *** BUG *** > In pixman_region32_init_rect: Invalid rectangle passed > Set a breakpoint on '_pixman_log_error' to debug > > I tried to debug this in gdb, but setting the breakpoint made X hang > when encountering this issue, so I was unable to procure a backtrace. > > I have attached a picture showing the problem. The static displayed is > the area that I am unable to see, but is included by scrot. The squished > prompt was from clicking on `Lisp Interaction' in the mode line. This is still an issue in current master. The tooltip issue I mentioned above last year was fixed in 7b14da444, so I tried using pretty much the same code to fix this issue; a proof of concept diff is included below. I don't know if it's a good approach though. Partially because I have no idea why the values of req.{height, width} are so large, why they differ in different Emacs sessions, and how they relate to the other width/height variables. In any case, perhaps this functionality should be abstracted into a procedure that just computes the dimensions of the current monitor? --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=multi-head-popup.diff Content-Description: popup-diff diff --git a/src/xmenu.c b/src/xmenu.c index 2805249164..9a87fce380 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -1161,8 +1161,43 @@ menu_position_func (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer struct next_popup_x_y *data = user_data; GtkRequisition req; struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (data->f); - int disp_width = x_display_pixel_width (dpyinfo); - int disp_height = x_display_pixel_height (dpyinfo); + int disp_width; + int disp_height; + + int min_x, min_y, max_x, max_y = -1; + Lisp_Object frame, attributes, monitor, geometry; + + XSETFRAME(frame, data->f); + attributes = Fx_display_monitor_attributes_list (frame); + + /* Try to determine the current monitor's resolution */ + while (CONSP (attributes)) + { + monitor = XCAR (attributes); + geometry = Fassq (Qgeometry, monitor); + if (CONSP (geometry)) + { + min_x = XINT (Fnth (make_number (1), geometry)); + min_y = XINT (Fnth (make_number (2), geometry)); + max_x = min_x + XINT (Fnth (make_number (3), geometry)); + max_y = min_y + XINT (Fnth (make_number (4), geometry)); + if (min_x <= data->x && data->x < max_x + && min_y <= data->y && data->y < max_y) + { + disp_width = max_x; + disp_height = max_y; + break; + } + max_y = -1; + } + + attributes = XCDR (attributes); + } + if ( max_y < 0 ) + { + disp_width = x_display_pixel_width (dpyinfo); + disp_height = x_display_pixel_height (dpyinfo); + } *x = data->x; *y = data->y; --=-=-=--