1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-04 14:40:54 -08:00

c:/Temp/gtk-window-move/ChangeLog.txt

This commit is contained in:
Martin Rudalics 2017-03-23 07:51:19 +01:00
parent 560d6f9124
commit fe3af8d4f2
2 changed files with 73 additions and 22 deletions

View file

@ -783,33 +783,55 @@ xg_set_geometry (struct frame *f)
{
if (f->size_hint_flags & (USPosition | PPosition))
{
int left = f->left_pos;
int xneg = f->size_hint_flags & XNegative;
int top = f->top_pos;
int yneg = f->size_hint_flags & YNegative;
char geom_str[sizeof "=x--" + 4 * INT_STRLEN_BOUND (int)];
guint id;
if (x_gtk_use_window_move)
{
/* Handle negative positions without consulting
gtk_window_parse_geometry (Bug#25851). The position will
be off by scrollbar width + window manager decorations. */
if (f->size_hint_flags & XNegative)
f->left_pos = (x_display_pixel_width (FRAME_DISPLAY_INFO (f))
- FRAME_PIXEL_WIDTH (f) + f->left_pos);
if (xneg)
left = -left;
if (yneg)
top = -top;
if (f->size_hint_flags & YNegative)
f->top_pos = (x_display_pixel_height (FRAME_DISPLAY_INFO (f))
- FRAME_PIXEL_HEIGHT (f) + f->top_pos);
sprintf (geom_str, "=%dx%d%c%d%c%d",
FRAME_PIXEL_WIDTH (f),
FRAME_PIXEL_HEIGHT (f),
(xneg ? '-' : '+'), left,
(yneg ? '-' : '+'), top);
gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
f->left_pos, f->top_pos);
/* Silence warning about visible children. */
id = g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL
| G_LOG_FLAG_RECURSION, my_log_handler, NULL);
/* Reset size hint flags. */
f->size_hint_flags &= ~ (XNegative | YNegative);
}
else
{
int left = f->left_pos;
int xneg = f->size_hint_flags & XNegative;
int top = f->top_pos;
int yneg = f->size_hint_flags & YNegative;
char geom_str[sizeof "=x--" + 4 * INT_STRLEN_BOUND (int)];
guint id;
if (!gtk_window_parse_geometry (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
geom_str))
fprintf (stderr, "Failed to parse: '%s'\n", geom_str);
if (xneg)
left = -left;
if (yneg)
top = -top;
g_log_remove_handler ("Gtk", id);
sprintf (geom_str, "=%dx%d%c%d%c%d",
FRAME_PIXEL_WIDTH (f),
FRAME_PIXEL_HEIGHT (f),
(xneg ? '-' : '+'), left,
(yneg ? '-' : '+'), top);
/* Silence warning about visible children. */
id = g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL
| G_LOG_FLAG_RECURSION, my_log_handler, NULL);
if (!gtk_window_parse_geometry (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
geom_str))
fprintf (stderr, "Failed to parse: '%s'\n", geom_str);
g_log_remove_handler ("Gtk", id);
}
}
}
@ -1406,6 +1428,13 @@ x_wm_set_size_hint (struct frame *f, long int flags, bool user_position)
else if (win_gravity == StaticGravity)
size_hints.win_gravity = GDK_GRAVITY_STATIC;
if (x_gtk_use_window_move)
{
if (flags & PPosition) hint_flags |= GDK_HINT_POS;
if (flags & USPosition) hint_flags |= GDK_HINT_USER_POS;
if (flags & USSize) hint_flags |= GDK_HINT_USER_SIZE;
}
if (user_position)
{
hint_flags &= ~GDK_HINT_POS;

View file

@ -10056,11 +10056,26 @@ x_set_offset (struct frame *f, register int xoff, register int yoff, int change_
f->size_hint_flags |= YNegative;
f->win_gravity = NorthWestGravity;
}
x_calc_absolute_position (f);
block_input ();
x_wm_set_size_hint (f, 0, false);
#ifdef USE_GTK
if (x_gtk_use_window_move)
{
/* When a position change was requested and the outer GTK widget
has been realized already, leave it to gtk_window_move to DTRT
and return. Used for Bug#25851 and Bug#25943. */
if (change_gravity != 0 && FRAME_GTK_OUTER_WIDGET (f))
gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
f->left_pos, f->top_pos);
unblock_input ();
return;
}
#endif /* USE_GTK */
modified_left = f->left_pos;
modified_top = f->top_pos;
@ -12905,4 +12920,11 @@ state.
Set this variable only if your window manager cannot handle the
transition between the various maximization states. */);
x_frame_normalize_before_maximize = false;
DEFVAR_BOOL ("x-gtk-use-window-move", x_gtk_use_window_move,
doc: /* Non-nil means rely on gtk_window_move to set frame positions.
If this variable is t, the GTK build uses the function gtk_window_move
to set or store frame positions and disables some time consuming frame
position adjustments. */);
x_gtk_use_window_move = false;
}