comparison src/xterm.c @ 42717:839386cf6e9b

(x_check_fullscreen, x_check_fullscreen_move) (x_fullscreen_adjust): New functions. (XTread_socket) <Expose>: Call x_check_fullscreen. <ConfigureNotify>: Don't resize to fullscreen. Call x_check_fullscreen_move, and set the want_fullscreen member of output_data.x.
author Eli Zaretskii <eliz@gnu.org>
date Sun, 13 Jan 2002 12:05:37 +0000
parents 21f5612addbb
children a9d49e89d31f
comparison
equal deleted inserted replaced
42716:8f8e4c09c652 42717:839386cf6e9b
488 static struct scroll_bar *x_window_to_scroll_bar P_ ((Window)); 488 static struct scroll_bar *x_window_to_scroll_bar P_ ((Window));
489 static void x_scroll_bar_report_motion P_ ((struct frame **, Lisp_Object *, 489 static void x_scroll_bar_report_motion P_ ((struct frame **, Lisp_Object *,
490 enum scroll_bar_part *, 490 enum scroll_bar_part *,
491 Lisp_Object *, Lisp_Object *, 491 Lisp_Object *, Lisp_Object *,
492 unsigned long *)); 492 unsigned long *));
493 static void x_check_fullscreen P_ ((struct frame *));
494 static void x_check_fullscreen_move P_ ((struct frame *));
493 495
494 /* Flush display of frame F, or of all frames if F is null. */ 496 /* Flush display of frame F, or of all frames if F is null. */
495 497
496 static void 498 static void
497 x_flush (f) 499 x_flush (f)
10241 10243
10242 case Expose: 10244 case Expose:
10243 f = x_window_to_frame (dpyinfo, event.xexpose.window); 10245 f = x_window_to_frame (dpyinfo, event.xexpose.window);
10244 if (f) 10246 if (f)
10245 { 10247 {
10248 x_check_fullscreen (f);
10249
10246 if (f->async_visible == 0) 10250 if (f->async_visible == 0)
10247 { 10251 {
10248 f->async_visible = 1; 10252 f->async_visible = 1;
10249 f->async_iconified = 0; 10253 f->async_iconified = 0;
10250 f->output_data.x->has_been_visible = 1; 10254 f->output_data.x->has_been_visible = 1;
10842 10846
10843 case ConfigureNotify: 10847 case ConfigureNotify:
10844 f = x_top_window_to_frame (dpyinfo, event.xconfigure.window); 10848 f = x_top_window_to_frame (dpyinfo, event.xconfigure.window);
10845 if (f) 10849 if (f)
10846 { 10850 {
10851 /* If there is a pending resize for fullscreen, don't
10852 do this one, the right one will come later.
10853 The toolkit version doesn't seem to need this, but we
10854 need to reset it below. */
10855 int dont_resize =
10856 ((f->output_data.x->want_fullscreen & FULLSCREEN_WAIT)
10857 && FRAME_NEW_WIDTH (f) != 0);
10847 #ifndef USE_X_TOOLKIT 10858 #ifndef USE_X_TOOLKIT
10848 int rows = PIXEL_TO_CHAR_HEIGHT (f, event.xconfigure.height); 10859 int rows = PIXEL_TO_CHAR_HEIGHT (f, event.xconfigure.height);
10849 int columns = PIXEL_TO_CHAR_WIDTH (f, event.xconfigure.width); 10860 int columns = PIXEL_TO_CHAR_WIDTH (f, event.xconfigure.width);
10861 if (dont_resize)
10862 goto OTHER;
10850 10863
10851 /* In the toolkit version, change_frame_size 10864 /* In the toolkit version, change_frame_size
10852 is called by the code that handles resizing 10865 is called by the code that handles resizing
10853 of the EmacsFrame widget. */ 10866 of the EmacsFrame widget. */
10854 10867
10872 /* What we have now is the position of Emacs's own window. 10885 /* What we have now is the position of Emacs's own window.
10873 Convert that to the position of the window manager window. */ 10886 Convert that to the position of the window manager window. */
10874 x_real_positions (f, &f->output_data.x->left_pos, 10887 x_real_positions (f, &f->output_data.x->left_pos,
10875 &f->output_data.x->top_pos); 10888 &f->output_data.x->top_pos);
10876 10889
10890 x_check_fullscreen_move(f);
10891 if (f->output_data.x->want_fullscreen & FULLSCREEN_WAIT)
10892 f->output_data.x->want_fullscreen &=
10893 ~(FULLSCREEN_WAIT|FULLSCREEN_BOTH);
10877 #ifdef HAVE_X_I18N 10894 #ifdef HAVE_X_I18N
10878 if (FRAME_XIC (f) && (FRAME_XIC_STYLE (f) & XIMStatusArea)) 10895 if (FRAME_XIC (f) && (FRAME_XIC_STYLE (f) & XIMStatusArea))
10879 xic_set_statusarea (f); 10896 xic_set_statusarea (f);
10880 #endif 10897 #endif
10881 10898
12639 #else /* not USE_X_TOOLKIT */ 12656 #else /* not USE_X_TOOLKIT */
12640 XMoveWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 12657 XMoveWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
12641 modified_left, modified_top); 12658 modified_left, modified_top);
12642 #endif /* not USE_X_TOOLKIT */ 12659 #endif /* not USE_X_TOOLKIT */
12643 UNBLOCK_INPUT; 12660 UNBLOCK_INPUT;
12661 }
12662
12663 /* Check if we need to resize the frame due to a fullscreen request.
12664 If so needed, resize the frame. */
12665 static void
12666 x_check_fullscreen (f)
12667 struct frame *f;
12668 {
12669 if (f->output_data.x->want_fullscreen & FULLSCREEN_BOTH)
12670 {
12671 int width, height, ign;
12672
12673 x_real_positions (f, &f->output_data.x->left_pos,
12674 &f->output_data.x->top_pos);
12675
12676 x_fullscreen_adjust (f, &width, &height, &ign, &ign);
12677
12678 /* We do not need to move the window, it shall be taken care of
12679 when setting WM manager hints.
12680 If the frame is visible already, the position is checked by
12681 x_check_fullscreen_move. */
12682 if (f->width != width || f->height != height)
12683 {
12684 change_frame_size (f, height, width, 0, 1, 0);
12685 SET_FRAME_GARBAGED (f);
12686 cancel_mouse_face (f);
12687
12688 /* Wait for the change of frame size to occur */
12689 f->output_data.x->want_fullscreen |= FULLSCREEN_WAIT;
12690
12691 }
12692 }
12693 }
12694
12695 /* If frame parameters are set after the frame is mapped, we need to move
12696 the window. This is done in xfns.c.
12697 Some window managers moves the window to the right position, some
12698 moves the outer window manager window to the specified position.
12699 Here we check that we are in the right spot. If not, make a second
12700 move, assuming we are dealing with the second kind of window manager. */
12701 static void
12702 x_check_fullscreen_move (f)
12703 struct frame *f;
12704 {
12705 if (f->output_data.x->want_fullscreen & FULLSCREEN_MOVE_WAIT)
12706 {
12707 int expect_top = f->output_data.x->top_pos;
12708 int expect_left = f->output_data.x->left_pos;
12709
12710 if (f->output_data.x->want_fullscreen & FULLSCREEN_HEIGHT)
12711 expect_top = 0;
12712 if (f->output_data.x->want_fullscreen & FULLSCREEN_WIDTH)
12713 expect_left = 0;
12714
12715 if (expect_top != f->output_data.x->top_pos
12716 || expect_left != f->output_data.x->left_pos)
12717 x_set_offset (f, expect_left, expect_top, 1);
12718
12719 /* Just do this once */
12720 f->output_data.x->want_fullscreen &= ~FULLSCREEN_MOVE_WAIT;
12721 }
12722 }
12723
12724
12725 /* Calculate fullscreen size. Return in *TOP_POS and *LEFT_POS the
12726 wanted positions of the WM window (not emacs window).
12727 Return in *WIDTH and *HEIGHT the wanted width and height of Emacs
12728 window (FRAME_X_WINDOW).
12729 */
12730 void
12731 x_fullscreen_adjust (f, width, height, top_pos, left_pos)
12732 struct frame *f;
12733 int *width;
12734 int *height;
12735 int *top_pos;
12736 int *left_pos;
12737 {
12738 int newwidth = f->width, newheight = f->height;
12739
12740 *top_pos = f->output_data.x->top_pos;
12741 *left_pos = f->output_data.x->left_pos;
12742
12743 if (f->output_data.x->want_fullscreen & FULLSCREEN_HEIGHT)
12744 {
12745 int ph;
12746
12747 ph = FRAME_X_DISPLAY_INFO (f)->height;
12748 newheight = PIXEL_TO_CHAR_HEIGHT (f, ph);
12749 ph = CHAR_TO_PIXEL_HEIGHT (f, newheight)
12750 - f->output_data.x->y_pixels_diff;
12751 newheight = PIXEL_TO_CHAR_HEIGHT (f, ph);
12752 *top_pos = 0;
12753 }
12754
12755 if (f->output_data.x->want_fullscreen & FULLSCREEN_WIDTH)
12756 {
12757 int pw;
12758
12759 pw = FRAME_X_DISPLAY_INFO (f)->width;
12760 newwidth = PIXEL_TO_CHAR_WIDTH (f, pw);
12761 pw = CHAR_TO_PIXEL_WIDTH (f, newwidth)
12762 - f->output_data.x->x_pixels_diff;
12763 newwidth = PIXEL_TO_CHAR_WIDTH (f, pw);
12764 *left_pos = 0;
12765 }
12766
12767 *width = newwidth;
12768 *height = newheight;
12644 } 12769 }
12645 12770
12646 12771
12647 /* Change the size of frame F's X window to COLS/ROWS in the case F 12772 /* Change the size of frame F's X window to COLS/ROWS in the case F
12648 doesn't have a widget. If CHANGE_GRAVITY is 1, we change to 12773 doesn't have a widget. If CHANGE_GRAVITY is 1, we change to