From: Madhu <enometh@meer.net>
To: 62135@debbugs.gnu.org
Subject: bug#62135: xterm.c: (x_set_offset)
Date: Sun, 12 Mar 2023 06:58:43 +0530 (IST) [thread overview]
Message-ID: <20230312.065843.1304315041062918300.enometh@meer.net> (raw)
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'
next reply other threads:[~2023-03-12 1:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-12 1:28 Madhu [this message]
2023-03-12 9:18 ` bug#62135: xterm.c: (x_set_offset) Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230312.065843.1304315041062918300.enometh@meer.net \
--to=enometh@meer.net \
--cc=62135@debbugs.gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.