comparison src/xterm.c @ 6883:77ceede38423

(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.
author Richard M. Stallman <rms@gnu.org>
date Thu, 14 Apr 1994 17:31:06 +0000
parents 7036e4fd549f
children e0ab4f59004e
comparison
equal deleted inserted replaced
6882:3096a6f7fffb 6883:77ceede38423
190 Zero if none. This is examined by Ffocus_frame in frame.c. Note 190 Zero if none. This is examined by Ffocus_frame in frame.c. Note
191 that a mere EnterNotify event can set this; if you need to know the 191 that a mere EnterNotify event can set this; if you need to know the
192 last frame specified in a FocusIn or FocusOut event, use 192 last frame specified in a FocusIn or FocusOut event, use
193 x_focus_event_frame. */ 193 x_focus_event_frame. */
194 struct frame *x_focus_frame; 194 struct frame *x_focus_frame;
195
196 /* This is a frame waiting to be autoraised, within XTread_socket. */
197 struct frame *pending_autoraise_frame;
195 198
196 /* The last frame mentioned in a FocusIn or FocusOut event. This is 199 /* The last frame mentioned in a FocusIn or FocusOut event. This is
197 separate from x_focus_frame, because whether or not LeaveNotify 200 separate from x_focus_frame, because whether or not LeaveNotify
198 events cause us to lose focus depends on whether or not we have 201 events cause us to lose focus depends on whether or not we have
199 received a FocusIn event for it. */ 202 received a FocusIn event for it. */
1715 Fselect_window (selected_frame->selected_window); 1718 Fselect_window (selected_frame->selected_window);
1716 choose_minibuf_frame (); 1719 choose_minibuf_frame ();
1717 #endif /* ! 0 */ 1720 #endif /* ! 0 */
1718 1721
1719 if (x_focus_frame && x_focus_frame->auto_raise) 1722 if (x_focus_frame && x_focus_frame->auto_raise)
1720 x_raise_frame (x_focus_frame); 1723 pending_autoraise_frame = x_focus_frame;
1724 else
1725 pending_autoraise_frame = 0;
1721 } 1726 }
1722 1727
1723 XTframe_rehighlight (); 1728 XTframe_rehighlight ();
1724 } 1729 }
1725 1730
4300 #ifndef HAVE_X11 4305 #ifndef HAVE_X11
4301 if (updating_frame == 0) 4306 if (updating_frame == 0)
4302 x_do_pending_expose (); 4307 x_do_pending_expose ();
4303 #endif 4308 #endif
4304 4309
4310 /* If the focus was just given to an autoraising frame,
4311 raise it now. */
4312 #ifdef HAVE_X11
4313 if (pending_autoraise_frame)
4314 {
4315 x_raise_frame (pending_autoraise_frame);
4316 pending_autoraise_frame = 0;
4317 }
4318 #endif
4319
4305 UNBLOCK_INPUT; 4320 UNBLOCK_INPUT;
4306 return count; 4321 return count;
4307 } 4322 }
4308 4323
4309 #ifndef HAVE_X11 4324 #ifndef HAVE_X11
5080 f->display.x->font->fid); 5095 f->display.x->font->fid);
5081 XSetFont (x_current_display, f->display.x->cursor_gc, 5096 XSetFont (x_current_display, f->display.x->cursor_gc,
5082 f->display.x->font->fid); 5097 f->display.x->font->fid);
5083 5098
5084 frame_update_line_height (f); 5099 frame_update_line_height (f);
5100 x_set_window_size (f, 0, f->width, f->height);
5085 } 5101 }
5086 else 5102 else
5087 /* If we are setting a new frame's font for the first time, 5103 /* If we are setting a new frame's font for the first time,
5088 there are no faces yet, so this font's height is the line height. */ 5104 there are no faces yet, so this font's height is the line height. */
5089 f->display.x->line_height = FONT_HEIGHT (f->display.x->font); 5105 f->display.x->line_height = FONT_HEIGHT (f->display.x->font);
5395 #ifdef USE_X_TOOLKIT 5411 #ifdef USE_X_TOOLKIT
5396 XtPopup (f->display.x->widget, XtGrabNone); 5412 XtPopup (f->display.x->widget, XtGrabNone);
5397 #else /* not USE_X_TOOLKIT */ 5413 #else /* not USE_X_TOOLKIT */
5398 XMapWindow (XDISPLAY FRAME_X_WINDOW (f)); 5414 XMapWindow (XDISPLAY FRAME_X_WINDOW (f));
5399 #endif /* not USE_X_TOOLKIT */ 5415 #endif /* not USE_X_TOOLKIT */
5416 #if 0 /* This seems to bring back scroll bars in the wrong places
5417 if the window configuration has changed. They seem
5418 to come back ok without this. */
5400 if (FRAME_HAS_VERTICAL_SCROLL_BARS (f)) 5419 if (FRAME_HAS_VERTICAL_SCROLL_BARS (f))
5401 XMapSubwindows (x_current_display, FRAME_X_WINDOW (f)); 5420 XMapSubwindows (x_current_display, FRAME_X_WINDOW (f));
5421 #endif
5402 #else /* ! defined (HAVE_X11) */ 5422 #else /* ! defined (HAVE_X11) */
5403 XMapWindow (XDISPLAY FRAME_X_WINDOW (f)); 5423 XMapWindow (XDISPLAY FRAME_X_WINDOW (f));
5404 if (f->display.x->icon_desc != 0) 5424 if (f->display.x->icon_desc != 0)
5405 XUnmapWindow (f->display.x->icon_desc); 5425 XUnmapWindow (f->display.x->icon_desc);
5406 5426
5561 5581
5562 if (!FRAME_VISIBLE_P (f)) 5582 if (!FRAME_VISIBLE_P (f))
5563 { 5583 {
5564 /* If the frame was withdrawn, before, we must map it. */ 5584 /* If the frame was withdrawn, before, we must map it. */
5565 XMapWindow (XDISPLAY FRAME_X_WINDOW (f)); 5585 XMapWindow (XDISPLAY FRAME_X_WINDOW (f));
5586 #if 0 /* We don't have subwindows in the icon. */
5566 if (FRAME_HAS_VERTICAL_SCROLL_BARS (f)) 5587 if (FRAME_HAS_VERTICAL_SCROLL_BARS (f))
5567 XMapSubwindows (x_current_display, FRAME_X_WINDOW (f)); 5588 XMapSubwindows (x_current_display, FRAME_X_WINDOW (f));
5589 #endif
5568 } 5590 }
5569 5591
5570 f->async_iconified = 1; 5592 f->async_iconified = 1;
5571 #else /* ! defined (HAVE_X11) */ 5593 #else /* ! defined (HAVE_X11) */
5572 XUnmapWindow (XDISPLAY FRAME_X_WINDOW (f)); 5594 XUnmapWindow (XDISPLAY FRAME_X_WINDOW (f));
5606 f->display.x = 0; 5628 f->display.x = 0;
5607 if (f == x_focus_frame) 5629 if (f == x_focus_frame)
5608 x_focus_frame = 0; 5630 x_focus_frame = 0;
5609 if (f == x_highlight_frame) 5631 if (f == x_highlight_frame)
5610 x_highlight_frame = 0; 5632 x_highlight_frame = 0;
5633
5634 if (f == mouse_face_mouse_frame)
5635 clear_mouse_face ();
5611 5636
5612 UNBLOCK_INPUT; 5637 UNBLOCK_INPUT;
5613 } 5638 }
5614 5639
5615 /* Manage event queues for X10. */ 5640 /* Manage event queues for X10. */
5688 5713
5689 /* Setting window manager hints. */ 5714 /* Setting window manager hints. */
5690 5715
5691 #ifdef HAVE_X11 5716 #ifdef HAVE_X11
5692 5717
5693 /* Record the gravity used previously, in case CHANGE_GRAVITY is 0. */
5694 static int previous_gravity;
5695
5696 /* SPEC_X and SPEC_Y are the specified positions. 5718 /* SPEC_X and SPEC_Y are the specified positions.
5697 We look only at their sign, to decide the gravity. 5719 We look only at their sign, to decide the gravity.
5698 If CHANGE_GRAVITY is 0, we ignore SPEC_X and SPEC_Y 5720 If CHANGE_GRAVITY is 0, we ignore SPEC_X and SPEC_Y
5699 and leave the gravity unchanged. */ 5721 and leave the gravity unchanged.
5722
5723 CHANGE_GRAVITY is nonzero when PROMPTING is nonzero. */
5700 5724
5701 x_wm_set_size_hint (f, prompting, change_gravity, spec_x, spec_y) 5725 x_wm_set_size_hint (f, prompting, change_gravity, spec_x, spec_y)
5702 struct frame *f; 5726 struct frame *f;
5703 long prompting; 5727 long prompting;
5704 int change_gravity; 5728 int change_gravity;
5731 size_hints.height = PIXEL_HEIGHT (f); 5755 size_hints.height = PIXEL_HEIGHT (f);
5732 size_hints.width = PIXEL_WIDTH (f); 5756 size_hints.width = PIXEL_WIDTH (f);
5733 #endif /* not USE_X_TOOLKIT */ 5757 #endif /* not USE_X_TOOLKIT */
5734 size_hints.width_inc = FONT_WIDTH (f->display.x->font); 5758 size_hints.width_inc = FONT_WIDTH (f->display.x->font);
5735 size_hints.height_inc = f->display.x->line_height; 5759 size_hints.height_inc = f->display.x->line_height;
5736 #if 0 5760
5737 size_hints.max_width = x_screen_width - CHAR_TO_PIXEL_WIDTH (f, 0);
5738 size_hints.max_height = x_screen_height - CHAR_TO_PIXEL_HEIGHT (f, 0);
5739 #endif
5740 { 5761 {
5741 int base_width, base_height; 5762 int base_width, base_height;
5763 int min_rows = 0, min_cols = 0;
5742 5764
5743 base_width = CHAR_TO_PIXEL_WIDTH (f, 0); 5765 base_width = CHAR_TO_PIXEL_WIDTH (f, 0);
5744 base_height = CHAR_TO_PIXEL_HEIGHT (f, 0); 5766 base_height = CHAR_TO_PIXEL_HEIGHT (f, 0);
5745 5767
5746 { 5768 check_frame_size (f, &min_rows, &min_cols);
5747 int min_rows = 0, min_cols = 0; 5769
5748 check_frame_size (f, &min_rows, &min_cols); 5770 /* The window manager uses the base width hints to calculate the
5749 5771 current number of rows and columns in the frame while
5750 /* The window manager uses the base width hints to calculate the 5772 resizing; min_width and min_height aren't useful for this
5751 current number of rows and columns in the frame while 5773 purpose, since they might not give the dimensions for a
5752 resizing; min_width and min_height aren't useful for this 5774 zero-row, zero-column frame.
5753 purpose, since they might not give the dimensions for a 5775
5754 zero-row, zero-column frame. 5776 We use the base_width and base_height members if we have
5755 5777 them; otherwise, we set the min_width and min_height members
5756 We use the base_width and base_height members if we have 5778 to the size for a zero x zero frame. */
5757 them; otherwise, we set the min_width and min_height members
5758 to the size for a zero x zero frame. */
5759 5779
5760 #ifdef HAVE_X11R4 5780 #ifdef HAVE_X11R4
5761 size_hints.flags |= PBaseSize; 5781 size_hints.flags |= PBaseSize;
5762 size_hints.base_width = base_width; 5782 size_hints.base_width = base_width;
5763 size_hints.base_height = base_height; 5783 size_hints.base_height = base_height;
5764 size_hints.min_width = base_width + min_cols * size_hints.width_inc; 5784 size_hints.min_width = base_width + min_cols * size_hints.width_inc;
5765 size_hints.min_height = base_height + min_rows * size_hints.height_inc; 5785 size_hints.min_height = base_height + min_rows * size_hints.height_inc;
5766 #else 5786 #else
5767 size_hints.min_width = base_width; 5787 size_hints.min_width = base_width;
5768 size_hints.min_height = base_height; 5788 size_hints.min_height = base_height;
5769 #endif 5789 #endif
5770 }
5771
5772 } 5790 }
5773 5791
5774 if (prompting) 5792 if (prompting)
5775 size_hints.flags |= prompting; 5793 size_hints.flags |= prompting;
5776 else 5794 else
5785 size_hints.flags |= PPosition; 5803 size_hints.flags |= PPosition;
5786 if (hints.flags & USPosition) 5804 if (hints.flags & USPosition)
5787 size_hints.flags |= USPosition; 5805 size_hints.flags |= USPosition;
5788 if (hints.flags & USSize) 5806 if (hints.flags & USSize)
5789 size_hints.flags |= USSize; 5807 size_hints.flags |= USSize;
5790 } 5808 size_hints.win_gravity = hints.win_gravity;
5809 }
5810
5791 #if defined (PWinGravity) 5811 #if defined (PWinGravity)
5792 if (change_gravity) 5812 if (change_gravity)
5793 { 5813 {
5794 switch (((spec_x < 0) << 1) + (spec_y < 0)) 5814 switch (((spec_x < 0) << 1) + (spec_y < 0))
5795 { 5815 {
5796 case 0: 5816 case 0:
5797 size_hints.win_gravity = NorthWestGravity; 5817 size_hints.win_gravity = NorthWestGravity;
5798 break; 5818 break;
5799 case 1: 5819 case 1:
5800 size_hints.win_gravity = NorthEastGravity; 5820 size_hints.win_gravity = SouthWestGravity;
5801 break; 5821 break;
5802 case 2: 5822 case 2:
5803 size_hints.win_gravity = SouthWestGravity; 5823 size_hints.win_gravity = NorthEastGravity;
5804 break; 5824 break;
5805 case 3: 5825 case 3:
5806 size_hints.win_gravity = SouthEastGravity; 5826 size_hints.win_gravity = SouthEastGravity;
5807 break; 5827 break;
5808 } 5828 }
5809 previous_gravity = size_hints.win_gravity; 5829 if (! (size_hints.flags & USPosition))
5810 } 5830 size_hints.flags |= PWinGravity;
5811 else 5831 }
5812 size_hints.win_gravity = previous_gravity;
5813
5814 size_hints.flags |= PWinGravity;
5815 #endif /* PWinGravity */ 5832 #endif /* PWinGravity */
5816 5833
5817 #ifdef HAVE_X11R4 5834 #ifdef HAVE_X11R4
5818 XSetWMNormalHints (x_current_display, window, &size_hints); 5835 XSetWMNormalHints (x_current_display, window, &size_hints);
5819 #else 5836 #else