Commit 0134a210 authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(x_make_frame_visible): Don't call XMapSubwindows.

(x_iconify_frame): Likewise.

(pending_autoraise_frame): New variable.
(x_new_focus_frame): Don't autoraise here; just set that var.
(XTread_socket): Raise that frame here.

(x_destroy_window): Call clear_mouse_face if necessary.

(x_new_font): Always call x_set_window_size.

(x_wm_set_size_hint): If PROMPTING is 0,
copy the old win_gravity field.
If USPosition is set, don't set PWinGravity.

(x_wm_set_size_hint): If change_gravity is 0, just don't set the gravity.
parent 90eb1019
...@@ -193,6 +193,9 @@ extern struct frame *updating_frame; ...@@ -193,6 +193,9 @@ extern struct frame *updating_frame;
x_focus_event_frame. */ x_focus_event_frame. */
struct frame *x_focus_frame; struct frame *x_focus_frame;
/* This is a frame waiting to be autoraised, within XTread_socket. */
struct frame *pending_autoraise_frame;
/* The last frame mentioned in a FocusIn or FocusOut event. This is /* The last frame mentioned in a FocusIn or FocusOut event. This is
separate from x_focus_frame, because whether or not LeaveNotify separate from x_focus_frame, because whether or not LeaveNotify
events cause us to lose focus depends on whether or not we have events cause us to lose focus depends on whether or not we have
...@@ -1717,7 +1720,9 @@ x_new_focus_frame (frame) ...@@ -1717,7 +1720,9 @@ x_new_focus_frame (frame)
#endif /* ! 0 */ #endif /* ! 0 */
if (x_focus_frame && x_focus_frame->auto_raise) if (x_focus_frame && x_focus_frame->auto_raise)
x_raise_frame (x_focus_frame); pending_autoraise_frame = x_focus_frame;
else
pending_autoraise_frame = 0;
} }
XTframe_rehighlight (); XTframe_rehighlight ();
...@@ -4302,6 +4307,16 @@ XTread_socket (sd, bufp, numchars, waitp, expected) ...@@ -4302,6 +4307,16 @@ XTread_socket (sd, bufp, numchars, waitp, expected)
x_do_pending_expose (); x_do_pending_expose ();
#endif #endif
/* If the focus was just given to an autoraising frame,
raise it now. */
#ifdef HAVE_X11
if (pending_autoraise_frame)
{
x_raise_frame (pending_autoraise_frame);
pending_autoraise_frame = 0;
}
#endif
UNBLOCK_INPUT; UNBLOCK_INPUT;
return count; return count;
} }
...@@ -5082,6 +5097,7 @@ x_new_font (f, fontname) ...@@ -5082,6 +5097,7 @@ x_new_font (f, fontname)
f->display.x->font->fid); f->display.x->font->fid);
frame_update_line_height (f); frame_update_line_height (f);
x_set_window_size (f, 0, f->width, f->height);
} }
else else
/* If we are setting a new frame's font for the first time, /* If we are setting a new frame's font for the first time,
...@@ -5397,8 +5413,12 @@ x_make_frame_visible (f) ...@@ -5397,8 +5413,12 @@ x_make_frame_visible (f)
#else /* not USE_X_TOOLKIT */ #else /* not USE_X_TOOLKIT */
XMapWindow (XDISPLAY FRAME_X_WINDOW (f)); XMapWindow (XDISPLAY FRAME_X_WINDOW (f));
#endif /* not USE_X_TOOLKIT */ #endif /* not USE_X_TOOLKIT */
#if 0 /* This seems to bring back scroll bars in the wrong places
if the window configuration has changed. They seem
to come back ok without this. */
if (FRAME_HAS_VERTICAL_SCROLL_BARS (f)) if (FRAME_HAS_VERTICAL_SCROLL_BARS (f))
XMapSubwindows (x_current_display, FRAME_X_WINDOW (f)); XMapSubwindows (x_current_display, FRAME_X_WINDOW (f));
#endif
#else /* ! defined (HAVE_X11) */ #else /* ! defined (HAVE_X11) */
XMapWindow (XDISPLAY FRAME_X_WINDOW (f)); XMapWindow (XDISPLAY FRAME_X_WINDOW (f));
if (f->display.x->icon_desc != 0) if (f->display.x->icon_desc != 0)
...@@ -5563,8 +5583,10 @@ x_iconify_frame (f) ...@@ -5563,8 +5583,10 @@ x_iconify_frame (f)
{ {
/* If the frame was withdrawn, before, we must map it. */ /* If the frame was withdrawn, before, we must map it. */
XMapWindow (XDISPLAY FRAME_X_WINDOW (f)); XMapWindow (XDISPLAY FRAME_X_WINDOW (f));
#if 0 /* We don't have subwindows in the icon. */
if (FRAME_HAS_VERTICAL_SCROLL_BARS (f)) if (FRAME_HAS_VERTICAL_SCROLL_BARS (f))
XMapSubwindows (x_current_display, FRAME_X_WINDOW (f)); XMapSubwindows (x_current_display, FRAME_X_WINDOW (f));
#endif
} }
f->async_iconified = 1; f->async_iconified = 1;
...@@ -5609,6 +5631,9 @@ x_destroy_window (f) ...@@ -5609,6 +5631,9 @@ x_destroy_window (f)
if (f == x_highlight_frame) if (f == x_highlight_frame)
x_highlight_frame = 0; x_highlight_frame = 0;
if (f == mouse_face_mouse_frame)
clear_mouse_face ();
UNBLOCK_INPUT; UNBLOCK_INPUT;
} }
...@@ -5690,13 +5715,12 @@ mouse_event_pending_p () ...@@ -5690,13 +5715,12 @@ mouse_event_pending_p ()
#ifdef HAVE_X11 #ifdef HAVE_X11
/* Record the gravity used previously, in case CHANGE_GRAVITY is 0. */
static int previous_gravity;
/* SPEC_X and SPEC_Y are the specified positions. /* SPEC_X and SPEC_Y are the specified positions.
We look only at their sign, to decide the gravity. We look only at their sign, to decide the gravity.
If CHANGE_GRAVITY is 0, we ignore SPEC_X and SPEC_Y If CHANGE_GRAVITY is 0, we ignore SPEC_X and SPEC_Y
and leave the gravity unchanged. */ and leave the gravity unchanged.
CHANGE_GRAVITY is nonzero when PROMPTING is nonzero. */
x_wm_set_size_hint (f, prompting, change_gravity, spec_x, spec_y) x_wm_set_size_hint (f, prompting, change_gravity, spec_x, spec_y)
struct frame *f; struct frame *f;
...@@ -5733,42 +5757,36 @@ x_wm_set_size_hint (f, prompting, change_gravity, spec_x, spec_y) ...@@ -5733,42 +5757,36 @@ x_wm_set_size_hint (f, prompting, change_gravity, spec_x, spec_y)
#endif /* not USE_X_TOOLKIT */ #endif /* not USE_X_TOOLKIT */
size_hints.width_inc = FONT_WIDTH (f->display.x->font); size_hints.width_inc = FONT_WIDTH (f->display.x->font);
size_hints.height_inc = f->display.x->line_height; size_hints.height_inc = f->display.x->line_height;
#if 0
size_hints.max_width = x_screen_width - CHAR_TO_PIXEL_WIDTH (f, 0);
size_hints.max_height = x_screen_height - CHAR_TO_PIXEL_HEIGHT (f, 0);
#endif
{ {
int base_width, base_height; int base_width, base_height;
int min_rows = 0, min_cols = 0;
base_width = CHAR_TO_PIXEL_WIDTH (f, 0); base_width = CHAR_TO_PIXEL_WIDTH (f, 0);
base_height = CHAR_TO_PIXEL_HEIGHT (f, 0); base_height = CHAR_TO_PIXEL_HEIGHT (f, 0);
{ check_frame_size (f, &min_rows, &min_cols);
int min_rows = 0, min_cols = 0;
check_frame_size (f, &min_rows, &min_cols);
/* The window manager uses the base width hints to calculate the /* The window manager uses the base width hints to calculate the
current number of rows and columns in the frame while current number of rows and columns in the frame while
resizing; min_width and min_height aren't useful for this resizing; min_width and min_height aren't useful for this
purpose, since they might not give the dimensions for a purpose, since they might not give the dimensions for a
zero-row, zero-column frame. zero-row, zero-column frame.
We use the base_width and base_height members if we have We use the base_width and base_height members if we have
them; otherwise, we set the min_width and min_height members them; otherwise, we set the min_width and min_height members
to the size for a zero x zero frame. */ to the size for a zero x zero frame. */
#ifdef HAVE_X11R4 #ifdef HAVE_X11R4
size_hints.flags |= PBaseSize; size_hints.flags |= PBaseSize;
size_hints.base_width = base_width; size_hints.base_width = base_width;
size_hints.base_height = base_height; size_hints.base_height = base_height;
size_hints.min_width = base_width + min_cols * size_hints.width_inc; size_hints.min_width = base_width + min_cols * size_hints.width_inc;
size_hints.min_height = base_height + min_rows * size_hints.height_inc; size_hints.min_height = base_height + min_rows * size_hints.height_inc;
#else #else
size_hints.min_width = base_width; size_hints.min_width = base_width;
size_hints.min_height = base_height; size_hints.min_height = base_height;
#endif #endif
}
} }
if (prompting) if (prompting)
...@@ -5787,7 +5805,9 @@ x_wm_set_size_hint (f, prompting, change_gravity, spec_x, spec_y) ...@@ -5787,7 +5805,9 @@ x_wm_set_size_hint (f, prompting, change_gravity, spec_x, spec_y)
size_hints.flags |= USPosition; size_hints.flags |= USPosition;
if (hints.flags & USSize) if (hints.flags & USSize)
size_hints.flags |= USSize; size_hints.flags |= USSize;
size_hints.win_gravity = hints.win_gravity;
} }
#if defined (PWinGravity) #if defined (PWinGravity)
if (change_gravity) if (change_gravity)
{ {
...@@ -5797,21 +5817,18 @@ x_wm_set_size_hint (f, prompting, change_gravity, spec_x, spec_y) ...@@ -5797,21 +5817,18 @@ x_wm_set_size_hint (f, prompting, change_gravity, spec_x, spec_y)
size_hints.win_gravity = NorthWestGravity; size_hints.win_gravity = NorthWestGravity;
break; break;
case 1: case 1:
size_hints.win_gravity = NorthEastGravity; size_hints.win_gravity = SouthWestGravity;
break; break;
case 2: case 2:
size_hints.win_gravity = SouthWestGravity; size_hints.win_gravity = NorthEastGravity;
break; break;
case 3: case 3:
size_hints.win_gravity = SouthEastGravity; size_hints.win_gravity = SouthEastGravity;
break; break;
} }
previous_gravity = size_hints.win_gravity; if (! (size_hints.flags & USPosition))
size_hints.flags |= PWinGravity;
} }
else
size_hints.win_gravity = previous_gravity;
size_hints.flags |= PWinGravity;
#endif /* PWinGravity */ #endif /* PWinGravity */
#ifdef HAVE_X11R4 #ifdef HAVE_X11R4
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment