From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Madhu Newsgroups: gmane.emacs.bugs Subject: bug#62135: xterm.c: (x_set_offset) Date: Sun, 12 Mar 2023 06:58:43 +0530 (IST) Message-ID: <20230312.065843.1304315041062918300.enometh@meer.net> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34091"; mail-complaints-to="usenet@ciao.gmane.io" To: 62135@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Mar 12 02:32:15 2023 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 1pbAZL-0008ky-69 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Mar 2023 02:32:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pbAZA-0003pA-9N; Sat, 11 Mar 2023 20:32:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pbAZ9-0003p1-22 for bug-gnu-emacs@gnu.org; Sat, 11 Mar 2023 20:32:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pbAZ8-0005Wc-Pm for bug-gnu-emacs@gnu.org; Sat, 11 Mar 2023 20:32:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pbAZ8-0006dV-AW for bug-gnu-emacs@gnu.org; Sat, 11 Mar 2023 20:32:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Madhu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 12 Mar 2023 01:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 62135 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.167858467225452 (code B ref -1); Sun, 12 Mar 2023 01:32:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 12 Mar 2023 01:31:12 +0000 Original-Received: from localhost ([127.0.0.1]:58849 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pbAYJ-0006cS-VQ for submit@debbugs.gnu.org; Sat, 11 Mar 2023 20:31:12 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:40266) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pbAYH-0006cJ-Kz for submit@debbugs.gnu.org; Sat, 11 Mar 2023 20:31:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pbAYH-0003l8-9P for bug-gnu-emacs@gnu.org; Sat, 11 Mar 2023 20:31:09 -0500 Original-Received: from smtp5.ctinetworks.com ([205.166.61.198]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pbAYE-0005AC-4Y for bug-gnu-emacs@gnu.org; Sat, 11 Mar 2023 20:31:08 -0500 Original-Received: from localhost (unknown [117.193.7.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: enometh@meer.net) by smtp5.ctinetworks.com (Postfix) with ESMTPSA id 99213165CAC for ; Sat, 11 Mar 2023 20:29:55 -0500 (EST) X-Mailer: Mew version 6.8 on Emacs 30.0.50 X-ctinetworks-Information: Please contact the ISP for more information X-ctinetworks-MailScanner-ID: 99213165CAC.A6561 X-ctinetworks-VirusCheck: Found to be clean X-ctinetworks-Watermark: 1679448597.10667@ch12PxrSboFadcdxJcL8Lg Received-SPF: pass client-ip=205.166.61.198; envelope-from=enometh@meer.net; helo=smtp5.ctinetworks.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:257828 Archived-At: While investingating some persistent placements at 0x0 by some wm, I was looking at x-set-offset, (which gets called via x_make_frame_visible). In the code below there is a comment that documents the role of the change_gravity argument. When called from x_make_frame_visible the parameter is set to 0, so as not to do anything. However lines 22713-22720 perform an unconditional move window, which happens in this code path even before the XWindow the mapped. 1) Shouldn't these lines be protected by a "if (change_gravity != 0) { ... }" conditional? My surmise is that most wms ignore the call to XMoveWindow because it is unmapped but at least wayfire (on Xwayland) persistently seems to position it at 0, 0 as the code calls it. Also the 0x0 placement only happens on non-gtk builds, because I think there is another bug in lines 22689-22702. x_gtk_use_window_move is always true and gtk builds exit x_set_offset before reaching that line. I hope martin can pick this up from here and take a look? ---Regards, Madhu ``` 22663 /* CHANGE_GRAVITY is 1 when calling from Fset_frame_position, 22664 to really change the position, and 0 when calling from 22665 x_make_frame_visible (in that case, XOFF and YOFF are the current 22666 position values). It is -1 when calling from gui_set_frame_parameters, 22667 which means, do adjust for borders but don't change the gravity. */ 22668 static void 22669 x_set_offset (struct frame *f, int xoff, int yoff, int change_gravity) 22670 { 22671 int modified_top, modified_left; 22672 #ifdef USE_GTK 22673 int scale = xg_get_scale (f); 22674 #endif 22675 if (change_gravity > 0) 22676 { [...] 22689 #ifdef USE_GTK 22690 if (x_gtk_use_window_move) 22691 { 22692 /* When a position change was requested and the outer GTK widget 22693 has been realized already, leave it to gtk_window_move to 22694 DTRT and return. Used for Bug#25851 and Bug#25943. Convert 22695 from X pixels to GTK scaled pixels. */ 22696 if (change_gravity != 0 && FRAME_GTK_OUTER_WIDGET (f)) 22697 gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), 22698 f->left_pos / scale, f->top_pos / scale); 22699 unblock_input (); 22700 return; 22701 } 22702 #endif /* USE_GTK */ 22703 modified_left = f->left_pos; 22704 modified_top = f->top_pos; 22705 if (change_gravity != 0 && FRAME_DISPLAY_INFO (f)->wm_type == X_WMTYPE_A) 22706 { 22707 /* Some WMs (twm, wmaker at least) has an offset that is smaller 22708 than the WM decorations. So we use the calculated offset instead 22709 of the WM decoration sizes here (x/y_pixels_outer_diff). */ 22710 modified_left += FRAME_X_OUTPUT (f)->move_offset_left; 22711 modified_top += FRAME_X_OUTPUT (f)->move_offset_top; 22712 } 22713 #ifdef USE_GTK 22714 /* Make sure we adjust for possible scaling. */ 22715 gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), 22716 modified_left / scale, modified_top / scale); 22717 #else 22718 XMoveWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), 22719 modified_left, modified_top); 22720 #endif ``` In GNU Emacs 30.0.50 (build 2, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw3d scroll bars) of 2023-02-14 Configured using: 'configure --with-x-toolkit=athena --with-native-compilation -C'