diff options
| author | Eli Zaretskii | 2002-01-13 12:05:37 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2002-01-13 12:05:37 +0000 |
| commit | d0fa3e56c2bae075e7c769bb82ecf59b198824a7 (patch) | |
| tree | b7ceaaabd8906371afb530c824458227e4d68616 /src | |
| parent | cf22597407434e9d645b5d83dfd447bcdff46bb6 (diff) | |
| download | emacs-d0fa3e56c2bae075e7c769bb82ecf59b198824a7.tar.gz emacs-d0fa3e56c2bae075e7c769bb82ecf59b198824a7.zip | |
(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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/src/xterm.c b/src/xterm.c index 503b67bcdf3..9819bc8bc82 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -490,6 +490,8 @@ 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 | ||
| @@ -10243,6 +10245,8 @@ XTread_socket (sd, bufp, numchars, expected) | |||
| 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; |
| @@ -10844,9 +10848,18 @@ XTread_socket (sd, bufp, numchars, expected) | |||
| 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 |
| @@ -10874,6 +10887,10 @@ XTread_socket (sd, bufp, numchars, expected) | |||
| 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); |
| @@ -12643,6 +12660,114 @@ x_set_offset (f, xoff, yoff, change_gravity) | |||
| 12643 | UNBLOCK_INPUT; | 12660 | UNBLOCK_INPUT; |
| 12644 | } | 12661 | } |
| 12645 | 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; | ||
| 12769 | } | ||
| 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 |