aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Djärv2003-10-05 11:52:47 +0000
committerJan Djärv2003-10-05 11:52:47 +0000
commitc1f0671ae91a1259334de1d4785413a29e63bbff (patch)
tree5edb244c802abb80a831afb69386560ef3d43806 /src
parentf5379f1fc31754230b28818deb7064624ba49de7 (diff)
downloademacs-c1f0671ae91a1259334de1d4785413a29e63bbff.tar.gz
emacs-c1f0671ae91a1259334de1d4785413a29e63bbff.zip
Make (modify-frame-parameters nil '((top . 0))) work for all types
of window managers in X.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog20
-rw-r--r--src/frame.c6
-rw-r--r--src/xterm.c54
-rw-r--r--src/xterm.h25
4 files changed, 81 insertions, 24 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index db8271e3d13..b38aff206e3 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,23 @@
12003-10-05 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
2
3 * xterm.h (struct x_display_info): New member, wm_type.
4 (struct x_output): New members, expected_top/left and
5 check_expected_move.
6
7 * xterm.c (handle_one_xevent): Reset wm_type when ReparentNotify
8 is received.
9 (handle_one_xevent): x_check_expected_move renamed from
10 x_check_fullscreen_move
11 (x_set_offset): Only add WM decoration sizes to modified_top/left
12 for X_WMTYPE_A. Set check_expected_move when WM type is unknown.
13 (x_check_expected_move): Renamed from x_check_fullscreen_move.
14 Removed fullscreen specific code. Use check_expected_move,
15 expected_left/top instead. Also, set wm_type.
16 (x_term_init): Initialize wm_type to unknown.
17
18 * frame.c (x_fullscreen_move): Remove addition of WM decoration
19 sizes to move_x/y.
20
12003-10-03 Kenichi Handa <handa@m17n.org> 212003-10-03 Kenichi Handa <handa@m17n.org>
2 22
3 * macterm.c (x_load_font): Clear all members of FONTP before start 23 * macterm.c (x_load_font): Clear all members of FONTP before start
diff --git a/src/frame.c b/src/frame.c
index 12ae8cef479..17952b5ca16 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -2607,12 +2607,10 @@ x_fullscreen_move (f, new_top, new_left)
2607 int move_x = new_left; 2607 int move_x = new_left;
2608 int move_y = new_top; 2608 int move_y = new_top;
2609 2609
2610#ifdef HAVE_X_WINDOWS 2610#ifndef HAVE_X_WINDOWS
2611 move_x += FRAME_X_OUTPUT (f)->x_pixels_outer_diff; 2611 f->want_fullscreen |= FULLSCREEN_MOVE_WAIT;
2612 move_y += FRAME_X_OUTPUT (f)->y_pixels_outer_diff;
2613#endif 2612#endif
2614 2613
2615 f->want_fullscreen |= FULLSCREEN_MOVE_WAIT;
2616 x_set_offset (f, move_x, move_y, 1); 2614 x_set_offset (f, move_x, move_y, 1);
2617 } 2615 }
2618} 2616}
diff --git a/src/xterm.c b/src/xterm.c
index 5c5f6c60d4c..9189d6a0d2a 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -362,7 +362,7 @@ static void x_scroll_bar_report_motion P_ ((struct frame **, Lisp_Object *,
362 Lisp_Object *, Lisp_Object *, 362 Lisp_Object *, Lisp_Object *,
363 unsigned long *)); 363 unsigned long *));
364static void x_check_fullscreen P_ ((struct frame *)); 364static void x_check_fullscreen P_ ((struct frame *));
365static void x_check_fullscreen_move P_ ((struct frame *)); 365static void x_check_expected_move P_ ((struct frame *));
366static int handle_one_xevent P_ ((struct x_display_info *, 366static int handle_one_xevent P_ ((struct x_display_info *,
367 XEvent *, 367 XEvent *,
368 struct input_event **, 368 struct input_event **,
@@ -5990,6 +5990,9 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish)
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;
@@ -6767,7 +6770,7 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish)
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 }
@@ -8320,8 +8323,6 @@ x_set_offset (f, xoff, yoff, change_gravity)
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. */
@@ -8334,8 +8335,23 @@ x_set_offset (f, xoff, yoff, change_gravity)
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
@@ -8356,7 +8372,7 @@ x_check_fullscreen (f)
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);
@@ -8370,30 +8386,31 @@ x_check_fullscreen (f)
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. */
8378static void 8394static void
8379x_check_fullscreen_move (f) 8395x_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
@@ -10398,6 +10415,7 @@ x_term_init (display_name, xrm_option, resource_name)
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;
diff --git a/src/xterm.h b/src/xterm.h
index 4cc8cd34957..5f8a1af0444 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -361,10 +361,22 @@ struct x_display_info
361 XColor *color_cells; 361 XColor *color_cells;
362 int ncolor_cells; 362 int ncolor_cells;
363 363
364 /* Bits and shifts to use to compose pixel values on Direct and TrueColor 364 /* Bits and shifts to use to compose pixel values on TrueColor visuals. */
365 visuals. */
366 int red_bits, blue_bits, green_bits; 365 int red_bits, blue_bits, green_bits;
367 int red_offset, blue_offset, green_offset; 366 int red_offset, blue_offset, green_offset;
367
368 /* The type of window manager we have. If we move FRAME_OUTER_WINDOW
369 to x/y 0/0, some window managers (type A) puts the window manager
370 decorations outside the screen and FRAME_OUTER_WINDOW exactly at 0/0.
371 Other window managers (type B) puts the window including decorations
372 at 0/0, so FRAME_OUTER_WINDOW is a bit below 0/0.
373 Record the type of WM in use so we can compensate for type A WMs. */
374 enum
375 {
376 X_WMTYPE_UNKNOWN,
377 X_WMTYPE_A,
378 X_WMTYPE_B
379 } wm_type;
368}; 380};
369 381
370#ifdef HAVE_X_I18N 382#ifdef HAVE_X_I18N
@@ -611,6 +623,15 @@ struct x_output
611 frame, or IMPLICIT if we received an EnterNotify. 623 frame, or IMPLICIT if we received an EnterNotify.
612 FocusOut and LeaveNotify clears EXPLICIT/IMPLICIT. */ 624 FocusOut and LeaveNotify clears EXPLICIT/IMPLICIT. */
613 int focus_state; 625 int focus_state;
626
627 /* The latest move we made to FRAME_OUTER_WINDOW. Saved so we can
628 compensate for type A WMs (see wm_type in dpyinfo above. */
629 int expected_top;
630 int expected_left;
631
632 /* Nonzero if we have made a move and needs to check if the WM placed us
633 at the right position. */
634 int check_expected_move;
614}; 635};
615 636
616#define No_Cursor (None) 637#define No_Cursor (None)