From 068ae0fd96c6bbd9aaa3b3d96232cf548749a36d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Dj=C3=A4rv?= Date: Sun, 5 Oct 2003 13:42:04 +0000 Subject: [PATCH] * w32term.c (w32_read_socket): Remove call to x_check_fullscreen_move, that function is removed. * xterm.c (x_set_offset): Use move_offset_left/top instead of x/y_pixels_outer_diff. (x_check_expected_move): Calculate move_offset_left/top. * xterm.h (struct x_output): New members: move_offset_top/left. * frame.c (x_set_frame_parameters): x_fullscreen_move removed, call x_set_offset directly. * frame.h (enum): FULLSCREEN_MOVE_WAIT removed. --- src/ChangeLog | 14 ++++++++++++++ src/frame.c | 27 ++------------------------- src/frame.h | 1 - src/w32term.c | 36 +----------------------------------- src/xterm.c | 15 ++++++++++----- src/xterm.h | 6 +++++- 6 files changed, 32 insertions(+), 67 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 1dfef46a7ce..2063e768fdd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,19 @@ 2003-10-05 Jan Dj,Ad(Brv + * w32term.c (w32_read_socket): Remove call to x_check_fullscreen_move, + that function is removed. + + * xterm.c (x_set_offset): Use move_offset_left/top instead of + x/y_pixels_outer_diff. + (x_check_expected_move): Calculate move_offset_left/top. + + * xterm.h (struct x_output): New members: move_offset_top/left. + + * frame.c (x_set_frame_parameters): x_fullscreen_move removed, + call x_set_offset directly. + + * frame.h (enum): FULLSCREEN_MOVE_WAIT removed. + * frame.c (Fdelete_frame): Free decode_mode_spec_buffer. * xterm.c (x_delete_display): Free font names and font_encoder diff --git a/src/frame.c b/src/frame.c index 87175e0c6c9..3a3758b93e0 100644 --- a/src/frame.c +++ b/src/frame.c @@ -2593,30 +2593,6 @@ x_fullscreen_adjust (f, width, height, top_pos, left_pos) } -/* Really try to move where we want to be in case of fullscreen. Some WMs - moves the window where we tell them. Some (mwm, twm) moves the outer - window manager window there instead. - Try to compensate for those WM here. */ - -static void -x_fullscreen_move (f, new_top, new_left) - struct frame *f; - int new_top; - int new_left; -{ - if (new_top != f->top_pos || new_left != f->left_pos) - { - int move_x = new_left; - int move_y = new_top; - -#ifndef HAVE_X_WINDOWS - f->want_fullscreen |= FULLSCREEN_MOVE_WAIT; -#endif - - x_set_offset (f, move_x, move_y, 1); - } -} - /* Change the parameters of frame F as specified by ALIST. If a parameter is not specially recognized, do nothing special; otherwise call the `x_set_...' function for that parameter. @@ -2812,7 +2788,8 @@ x_set_frame_parameters (f, alist) int new_left, new_top; x_fullscreen_adjust (f, &width, &height, &new_top, &new_left); - x_fullscreen_move (f, new_top, new_left); + if (new_top != f->top_pos || new_left != f->left_pos) + x_set_offset (f, new_left, new_top, 1); } #endif diff --git a/src/frame.h b/src/frame.h index 0b758fccca7..5efede23199 100644 --- a/src/frame.h +++ b/src/frame.h @@ -1023,7 +1023,6 @@ enum FULLSCREEN_HEIGHT = 2, FULLSCREEN_BOTH = 3, FULLSCREEN_WAIT = 4, - FULLSCREEN_MOVE_WAIT = 8, }; diff --git a/src/w32term.c b/src/w32term.c index 27f221d06ca..3e4543471c3 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -3064,7 +3064,6 @@ note_mouse_movement (frame, msg) static struct scroll_bar *x_window_to_scroll_bar (); static void x_scroll_bar_report_motion (); static void x_check_fullscreen P_ ((struct frame *)); -static void x_check_fullscreen_move P_ ((struct frame *)); static int glyph_rect P_ ((struct frame *f, int, int, RECT *)); @@ -4476,7 +4475,6 @@ w32_read_socket (sd, bufp, numchars, expected) f = x_window_to_frame (dpyinfo, msg.msg.hwnd); if (f) { - x_check_fullscreen_move(f); if (f->want_fullscreen & FULLSCREEN_WAIT) f->want_fullscreen &= ~(FULLSCREEN_WAIT|FULLSCREEN_BOTH); } @@ -5442,9 +5440,7 @@ x_check_fullscreen (f) x_fullscreen_adjust (f, &width, &height, &ign, &ign); /* We do not need to move the window, it shall be taken care of - when setting WM manager hints. - If the frame is visible already, the position is checked by - x_check_fullscreen_move. */ + when setting WM manager hints. */ if (FRAME_COLS (f) != width || FRAME_LINES (f) != height) { change_frame_size (f, height, width, 0, 1, 0); @@ -5457,36 +5453,6 @@ x_check_fullscreen (f) } } -/* If frame parameters are set after the frame is mapped, we need to move - the window. This is done in xfns.c. - Some window managers moves the window to the right position, some - moves the outer window manager window to the specified position. - Here we check that we are in the right spot. If not, make a second - move, assuming we are dealing with the second kind of window manager. */ -static void -x_check_fullscreen_move (f) - struct frame *f; -{ - if (f->want_fullscreen & FULLSCREEN_MOVE_WAIT) - { - int expect_top = f->top_pos; - int expect_left = f->left_pos; - - if (f->want_fullscreen & FULLSCREEN_HEIGHT) - expect_top = 0; - if (f->want_fullscreen & FULLSCREEN_WIDTH) - expect_left = 0; - - if (expect_top != f->top_pos - || expect_left != f->left_pos) - x_set_offset (f, expect_left, expect_top, 1); - - /* Just do this once */ - f->want_fullscreen &= ~FULLSCREEN_MOVE_WAIT; - } -} - - /* Call this to change the size of frame F's x-window. If CHANGE_GRAVITY is 1, we change to top-left-corner window gravity for this size change and subsequent size changes. diff --git a/src/xterm.c b/src/xterm.c index c563757e63b..c686824a003 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -8337,8 +8337,11 @@ x_set_offset (f, xoff, yoff, change_gravity) if (FRAME_X_DISPLAY_INFO (f)->wm_type == X_WMTYPE_A) { - modified_left += FRAME_X_OUTPUT (f)->x_pixels_outer_diff; - modified_top += FRAME_X_OUTPUT (f)->y_pixels_outer_diff; + /* Some WMs (twm, wmaker at least) has an offset that is smaller + than the WM decorations. So we use the calculated offset instead + of the WM decoration sizes here (x/y_pixels_outer_diff). */ + modified_left += FRAME_X_OUTPUT (f)->move_offset_left; + modified_top += FRAME_X_OUTPUT (f)->move_offset_top; } XMoveWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), @@ -8399,11 +8402,13 @@ x_check_expected_move (f) { int expect_top = FRAME_X_OUTPUT (f)->expected_top; int expect_left = FRAME_X_OUTPUT (f)->expected_left; - + if (expect_top != f->top_pos || expect_left != f->left_pos) { - if (FRAME_X_DISPLAY_INFO (f)->wm_type == X_WMTYPE_UNKNOWN) - FRAME_X_DISPLAY_INFO (f)->wm_type = X_WMTYPE_A; + FRAME_X_DISPLAY_INFO (f)->wm_type = X_WMTYPE_A; + FRAME_X_OUTPUT (f)->move_offset_left = expect_left - f->left_pos; + FRAME_X_OUTPUT (f)->move_offset_top = expect_top - f->top_pos; + x_set_offset (f, expect_left, expect_top, 1); } else if (FRAME_X_DISPLAY_INFO (f)->wm_type == X_WMTYPE_UNKNOWN) diff --git a/src/xterm.h b/src/xterm.h index 5f8a1af0444..fbd268abda2 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -625,10 +625,14 @@ struct x_output int focus_state; /* The latest move we made to FRAME_OUTER_WINDOW. Saved so we can - compensate for type A WMs (see wm_type in dpyinfo above. */ + compensate for type A WMs (see wm_type in dpyinfo above). */ int expected_top; int expected_left; + /* The offset we need to add to compensate for type A WMs. */ + int move_offset_top; + int move_offset_left; + /* Nonzero if we have made a move and needs to check if the WM placed us at the right position. */ int check_expected_move; -- 2.39.2