unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Madhu <enometh@meer.net>
Cc: 62135@debbugs.gnu.org
Subject: bug#62135: xterm.c: (x_set_offset)
Date: Sun, 12 Mar 2023 17:18:35 +0800	[thread overview]
Message-ID: <87y1o2ba50.fsf@yahoo.com> (raw)
In-Reply-To: <20230312.065843.1304315041062918300.enometh@meer.net> (Madhu's message of "Sun, 12 Mar 2023 06:58:43 +0530 (IST)")

Madhu <enometh@meer.net> writes:

> 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.

`change_gravity' means the function should update f->top_pos and
f->left_pos, then reset the window gravity, as well as move the window
to f->top_pos and f->left_pos.

`change_gravity' < 0 means to leave f->top_pos and f->left_pos intact.

However, at that point, the window's configuration is not guaranteed to
have its origin at f->top_pos and f->left_pos, so the window must still
be moved over.  Thus, the code is correct.  The comment above the
function is somewhat misleading but still correct.

To test out one theory of mine, please say what this does:

diff --git a/src/xterm.c b/src/xterm.c
index 70bcb67d80d..de5733c8b7c 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -26956,7 +26956,7 @@ x_set_offset (struct frame *f, int xoff, int yoff, int change_gravity)
   x_calc_absolute_position (f);
 
   block_input ();
-  x_wm_set_size_hint (f, 0, false);
+  x_wm_set_size_hint (f, 0, true);
 
 #ifdef USE_GTK
   if (x_gtk_use_window_move)

> 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.

If that is the case, I think we have a bug in the x_gtk_use_window_move
code, and another bug (or at least misbehavior) in Wayfire.





  reply	other threads:[~2023-03-12  9:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-12  1:28 bug#62135: xterm.c: (x_set_offset) Madhu
2023-03-12  9:18 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-03-25 14:20   ` Madhu
2024-04-01 12:41     ` Madhu
2024-04-02  3:38   ` Madhu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y1o2ba50.fsf@yahoo.com \
    --to=bug-gnu-emacs@gnu.org \
    --cc=62135@debbugs.gnu.org \
    --cc=enometh@meer.net \
    --cc=luangruo@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).