[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#62135: xterm.c: (x_set_offset)
From: |
Madhu |
Subject: |
bug#62135: xterm.c: (x_set_offset) |
Date: |
Sun, 12 Mar 2023 06:58:43 +0530 (IST) |
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'
- bug#62135: xterm.c: (x_set_offset),
Madhu <=