Mercurial > emacs
comparison src/xterm.c @ 52752:751a01f97570
Make (modify-frame-parameters nil '((top . 0))) work for all types
of window managers in X.
author | Jan Djärv <jan.h.d@swipnet.se> |
---|---|
date | Sun, 05 Oct 2003 11:52:47 +0000 |
parents | 7535333d9c75 |
children | 551e8ebadb62 |
comparison
equal
deleted
inserted
replaced
52751:5a2170a28c60 | 52752:751a01f97570 |
---|---|
360 static void x_scroll_bar_report_motion P_ ((struct frame **, Lisp_Object *, | 360 static void x_scroll_bar_report_motion P_ ((struct frame **, Lisp_Object *, |
361 enum scroll_bar_part *, | 361 enum scroll_bar_part *, |
362 Lisp_Object *, Lisp_Object *, | 362 Lisp_Object *, Lisp_Object *, |
363 unsigned long *)); | 363 unsigned long *)); |
364 static void x_check_fullscreen P_ ((struct frame *)); | 364 static void x_check_fullscreen P_ ((struct frame *)); |
365 static void x_check_fullscreen_move P_ ((struct frame *)); | 365 static void x_check_expected_move P_ ((struct frame *)); |
366 static int handle_one_xevent P_ ((struct x_display_info *, | 366 static int handle_one_xevent P_ ((struct x_display_info *, |
367 XEvent *, | 367 XEvent *, |
368 struct input_event **, | 368 struct input_event **, |
369 int *, | 369 int *, |
370 int *)); | 370 int *)); |
5988 int x, y; | 5988 int x, y; |
5989 f->output_data.x->parent_desc = event.xreparent.parent; | 5989 f->output_data.x->parent_desc = event.xreparent.parent; |
5990 x_real_positions (f, &x, &y); | 5990 x_real_positions (f, &x, &y); |
5991 f->left_pos = x; | 5991 f->left_pos = x; |
5992 f->top_pos = y; | 5992 f->top_pos = y; |
5993 | |
5994 /* Perhaps reparented due to a WM restart. Reset this. */ | |
5995 FRAME_X_DISPLAY_INFO (f)->wm_type = X_WMTYPE_UNKNOWN; | |
5993 } | 5996 } |
5994 goto OTHER; | 5997 goto OTHER; |
5995 break; | 5998 break; |
5996 | 5999 |
5997 case Expose: | 6000 case Expose: |
6765 { | 6768 { |
6766 /* What we have now is the position of Emacs's own window. | 6769 /* What we have now is the position of Emacs's own window. |
6767 Convert that to the position of the window manager window. */ | 6770 Convert that to the position of the window manager window. */ |
6768 x_real_positions (f, &f->left_pos, &f->top_pos); | 6771 x_real_positions (f, &f->left_pos, &f->top_pos); |
6769 | 6772 |
6770 x_check_fullscreen_move (f); | 6773 x_check_expected_move (f); |
6771 if (f->want_fullscreen & FULLSCREEN_WAIT) | 6774 if (f->want_fullscreen & FULLSCREEN_WAIT) |
6772 f->want_fullscreen &= ~(FULLSCREEN_WAIT|FULLSCREEN_BOTH); | 6775 f->want_fullscreen &= ~(FULLSCREEN_WAIT|FULLSCREEN_BOTH); |
6773 } | 6776 } |
6774 | 6777 |
6775 #ifdef HAVE_X_I18N | 6778 #ifdef HAVE_X_I18N |
8318 BLOCK_INPUT; | 8321 BLOCK_INPUT; |
8319 x_wm_set_size_hint (f, (long) 0, 0); | 8322 x_wm_set_size_hint (f, (long) 0, 0); |
8320 | 8323 |
8321 modified_left = f->left_pos; | 8324 modified_left = f->left_pos; |
8322 modified_top = f->top_pos; | 8325 modified_top = f->top_pos; |
8323 modified_left += FRAME_X_OUTPUT (f)->x_pixels_outer_diff; | |
8324 modified_top += FRAME_X_OUTPUT (f)->y_pixels_outer_diff; | |
8325 | 8326 |
8326 #if 0 /* Running on psilocin (Debian), and displaying on the NCD X-terminal, | 8327 #if 0 /* Running on psilocin (Debian), and displaying on the NCD X-terminal, |
8327 this seems to be unnecessary and incorrect. rms, 4/17/97. */ | 8328 this seems to be unnecessary and incorrect. rms, 4/17/97. */ |
8328 /* It is a mystery why we need to add the border_width here | 8329 /* It is a mystery why we need to add the border_width here |
8329 when the frame is already visible, but experiment says we do. */ | 8330 when the frame is already visible, but experiment says we do. */ |
8332 modified_left += f->border_width; | 8333 modified_left += f->border_width; |
8333 modified_top += f->border_width; | 8334 modified_top += f->border_width; |
8334 } | 8335 } |
8335 #endif | 8336 #endif |
8336 | 8337 |
8338 if (FRAME_X_DISPLAY_INFO (f)->wm_type == X_WMTYPE_A) | |
8339 { | |
8340 modified_left += FRAME_X_OUTPUT (f)->x_pixels_outer_diff; | |
8341 modified_top += FRAME_X_OUTPUT (f)->y_pixels_outer_diff; | |
8342 } | |
8343 | |
8337 XMoveWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), | 8344 XMoveWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), |
8338 modified_left, modified_top); | 8345 modified_left, modified_top); |
8346 | |
8347 if (FRAME_VISIBLE_P (f) | |
8348 && FRAME_X_DISPLAY_INFO (f)->wm_type == X_WMTYPE_UNKNOWN) | |
8349 { | |
8350 FRAME_X_OUTPUT (f)->check_expected_move = 1; | |
8351 FRAME_X_OUTPUT (f)->expected_top = f->top_pos; | |
8352 FRAME_X_OUTPUT (f)->expected_left = f->left_pos; | |
8353 } | |
8354 | |
8339 UNBLOCK_INPUT; | 8355 UNBLOCK_INPUT; |
8340 } | 8356 } |
8341 | 8357 |
8342 /* Check if we need to resize the frame due to a fullscreen request. | 8358 /* Check if we need to resize the frame due to a fullscreen request. |
8343 If so needed, resize the frame. */ | 8359 If so needed, resize the frame. */ |
8354 x_fullscreen_adjust (f, &width, &height, &ign, &ign); | 8370 x_fullscreen_adjust (f, &width, &height, &ign, &ign); |
8355 | 8371 |
8356 /* We do not need to move the window, it shall be taken care of | 8372 /* We do not need to move the window, it shall be taken care of |
8357 when setting WM manager hints. | 8373 when setting WM manager hints. |
8358 If the frame is visible already, the position is checked by | 8374 If the frame is visible already, the position is checked by |
8359 x_check_fullscreen_move. */ | 8375 x_check_expected_move. */ |
8360 if (FRAME_COLS (f) != width || FRAME_LINES (f) != height) | 8376 if (FRAME_COLS (f) != width || FRAME_LINES (f) != height) |
8361 { | 8377 { |
8362 change_frame_size (f, height, width, 0, 1, 0); | 8378 change_frame_size (f, height, width, 0, 1, 0); |
8363 SET_FRAME_GARBAGED (f); | 8379 SET_FRAME_GARBAGED (f); |
8364 cancel_mouse_face (f); | 8380 cancel_mouse_face (f); |
8368 } | 8384 } |
8369 } | 8385 } |
8370 } | 8386 } |
8371 | 8387 |
8372 /* If frame parameters are set after the frame is mapped, we need to move | 8388 /* If frame parameters are set after the frame is mapped, we need to move |
8373 the window. This is done in xfns.c. | 8389 the window. |
8374 Some window managers moves the window to the right position, some | 8390 Some window managers moves the window to the right position, some |
8375 moves the outer window manager window to the specified position. | 8391 moves the outer window manager window to the specified position. |
8376 Here we check that we are in the right spot. If not, make a second | 8392 Here we check that we are in the right spot. If not, make a second |
8377 move, assuming we are dealing with the second kind of window manager. */ | 8393 move, assuming we are dealing with the second kind of window manager. */ |
8378 static void | 8394 static void |
8379 x_check_fullscreen_move (f) | 8395 x_check_expected_move (f) |
8380 struct frame *f; | 8396 struct frame *f; |
8381 { | 8397 { |
8382 if (f->want_fullscreen & FULLSCREEN_MOVE_WAIT) | 8398 if (FRAME_X_OUTPUT (f)->check_expected_move) |
8383 { | 8399 { |
8384 int expect_top = f->top_pos; | 8400 int expect_top = FRAME_X_OUTPUT (f)->expected_top; |
8385 int expect_left = f->left_pos; | 8401 int expect_left = FRAME_X_OUTPUT (f)->expected_left; |
8386 | 8402 |
8387 if (f->want_fullscreen & FULLSCREEN_HEIGHT) | |
8388 expect_top = 0; | |
8389 if (f->want_fullscreen & FULLSCREEN_WIDTH) | |
8390 expect_left = 0; | |
8391 | |
8392 if (expect_top != f->top_pos || expect_left != f->left_pos) | 8403 if (expect_top != f->top_pos || expect_left != f->left_pos) |
8393 x_set_offset (f, expect_left, expect_top, 1); | 8404 { |
8405 if (FRAME_X_DISPLAY_INFO (f)->wm_type == X_WMTYPE_UNKNOWN) | |
8406 FRAME_X_DISPLAY_INFO (f)->wm_type = X_WMTYPE_A; | |
8407 x_set_offset (f, expect_left, expect_top, 1); | |
8408 } | |
8409 else if (FRAME_X_DISPLAY_INFO (f)->wm_type == X_WMTYPE_UNKNOWN) | |
8410 FRAME_X_DISPLAY_INFO (f)->wm_type = X_WMTYPE_B; | |
8394 | 8411 |
8395 /* Just do this once */ | 8412 /* Just do this once */ |
8396 f->want_fullscreen &= ~FULLSCREEN_MOVE_WAIT; | 8413 FRAME_X_OUTPUT (f)->check_expected_move = 0; |
8397 } | 8414 } |
8398 } | 8415 } |
8399 | 8416 |
8400 | 8417 |
8401 /* Change the size of frame F's X window to COLS/ROWS in the case F | 8418 /* Change the size of frame F's X window to COLS/ROWS in the case F |
10396 dpyinfo->mouse_face_hidden = 0; | 10413 dpyinfo->mouse_face_hidden = 0; |
10397 dpyinfo->x_focus_frame = 0; | 10414 dpyinfo->x_focus_frame = 0; |
10398 dpyinfo->x_focus_event_frame = 0; | 10415 dpyinfo->x_focus_event_frame = 0; |
10399 dpyinfo->x_highlight_frame = 0; | 10416 dpyinfo->x_highlight_frame = 0; |
10400 dpyinfo->image_cache = make_image_cache (); | 10417 dpyinfo->image_cache = make_image_cache (); |
10418 dpyinfo->wm_type = X_WMTYPE_UNKNOWN; | |
10401 | 10419 |
10402 /* See if we can construct pixel values from RGB values. */ | 10420 /* See if we can construct pixel values from RGB values. */ |
10403 dpyinfo->red_bits = dpyinfo->blue_bits = dpyinfo->green_bits = 0; | 10421 dpyinfo->red_bits = dpyinfo->blue_bits = dpyinfo->green_bits = 0; |
10404 dpyinfo->red_offset = dpyinfo->blue_offset = dpyinfo->green_offset = 0; | 10422 dpyinfo->red_offset = dpyinfo->blue_offset = dpyinfo->green_offset = 0; |
10405 | 10423 |