Mercurial > emacs
comparison src/xterm.c @ 54185:f6e4e454800a
xfns.c (x_window): Fixed indentation
* xterm.c (x_calc_absolute_position): Call x_real_positions
to get WM window sizes and use those to calculate position.
(x_set_offset): Removed code commented out.
| author | Jan Dj?rv <jan.h.d@swipnet.se> |
|---|---|
| date | Sat, 28 Feb 2004 16:22:06 +0000 |
| parents | 03cb01738926 |
| children | 66000dbe48c9 90ccc0dc0d3f |
comparison
equal
deleted
inserted
replaced
| 54184:814c8c5e6841 | 54185:f6e4e454800a |
|---|---|
| 8135 struct frame *f; | 8135 struct frame *f; |
| 8136 { | 8136 { |
| 8137 Window child; | 8137 Window child; |
| 8138 int win_x = 0, win_y = 0; | 8138 int win_x = 0, win_y = 0; |
| 8139 int flags = f->size_hint_flags; | 8139 int flags = f->size_hint_flags; |
| 8140 int this_window; | |
| 8141 | 8140 |
| 8142 /* We have nothing to do if the current position | 8141 /* We have nothing to do if the current position |
| 8143 is already for the top-left corner. */ | 8142 is already for the top-left corner. */ |
| 8144 if (! ((flags & XNegative) || (flags & YNegative))) | 8143 if (! ((flags & XNegative) || (flags & YNegative))) |
| 8145 return; | 8144 return; |
| 8146 | 8145 |
| 8147 this_window = FRAME_OUTER_WINDOW (f); | 8146 /* Find the offsets of the outside upper-left corner of |
| 8148 | |
| 8149 /* Find the position of the outside upper-left corner of | |
| 8150 the inner window, with respect to the outer window. | 8147 the inner window, with respect to the outer window. |
| 8151 But do this only if we will need the results. */ | 8148 But do this only if we will need the results. */ |
| 8152 if (f->output_data.x->parent_desc != FRAME_X_DISPLAY_INFO (f)->root_window) | 8149 if (f->output_data.x->parent_desc != FRAME_X_DISPLAY_INFO (f)->root_window) |
| 8153 { | 8150 /* This is to get *_pixels_outer_diff. */ |
| 8154 int count; | 8151 x_real_positions (f, &win_x, &win_y); |
| 8155 | |
| 8156 BLOCK_INPUT; | |
| 8157 count = x_catch_errors (FRAME_X_DISPLAY (f)); | |
| 8158 while (1) | |
| 8159 { | |
| 8160 x_clear_errors (FRAME_X_DISPLAY (f)); | |
| 8161 XTranslateCoordinates (FRAME_X_DISPLAY (f), | |
| 8162 | |
| 8163 /* From-window, to-window. */ | |
| 8164 this_window, | |
| 8165 f->output_data.x->parent_desc, | |
| 8166 | |
| 8167 /* From-position, to-position. */ | |
| 8168 0, 0, &win_x, &win_y, | |
| 8169 | |
| 8170 /* Child of win. */ | |
| 8171 &child); | |
| 8172 if (x_had_errors_p (FRAME_X_DISPLAY (f))) | |
| 8173 { | |
| 8174 Window newroot, newparent = 0xdeadbeef; | |
| 8175 Window *newchildren; | |
| 8176 unsigned int nchildren; | |
| 8177 | |
| 8178 if (! XQueryTree (FRAME_X_DISPLAY (f), this_window, &newroot, | |
| 8179 &newparent, &newchildren, &nchildren)) | |
| 8180 break; | |
| 8181 | |
| 8182 XFree ((char *) newchildren); | |
| 8183 | |
| 8184 f->output_data.x->parent_desc = newparent; | |
| 8185 } | |
| 8186 else | |
| 8187 break; | |
| 8188 } | |
| 8189 | |
| 8190 x_uncatch_errors (FRAME_X_DISPLAY (f), count); | |
| 8191 UNBLOCK_INPUT; | |
| 8192 } | |
| 8193 | 8152 |
| 8194 /* Treat negative positions as relative to the leftmost bottommost | 8153 /* Treat negative positions as relative to the leftmost bottommost |
| 8195 position that fits on the screen. */ | 8154 position that fits on the screen. */ |
| 8196 if (flags & XNegative) | 8155 if (flags & XNegative) |
| 8197 f->left_pos = (FRAME_X_DISPLAY_INFO (f)->width | 8156 f->left_pos = (FRAME_X_DISPLAY_INFO (f)->width |
| 8198 - 2 * f->border_width - win_x | 8157 - 2 * FRAME_X_OUTPUT (f)->x_pixels_outer_diff |
| 8199 - FRAME_PIXEL_WIDTH (f) | 8158 - FRAME_PIXEL_WIDTH (f) |
| 8200 + f->left_pos); | 8159 + f->left_pos); |
| 8201 | 8160 |
| 8202 { | 8161 { |
| 8203 int height = FRAME_PIXEL_HEIGHT (f); | 8162 int height = FRAME_PIXEL_HEIGHT (f); |
| 8218 XtVaGetValues (f->output_data.x->column_widget, XtNheight, &height, NULL); | 8177 XtVaGetValues (f->output_data.x->column_widget, XtNheight, &height, NULL); |
| 8219 #endif | 8178 #endif |
| 8220 | 8179 |
| 8221 if (flags & YNegative) | 8180 if (flags & YNegative) |
| 8222 f->top_pos = (FRAME_X_DISPLAY_INFO (f)->height | 8181 f->top_pos = (FRAME_X_DISPLAY_INFO (f)->height |
| 8223 - 2 * f->border_width | 8182 - FRAME_X_OUTPUT (f)->y_pixels_outer_diff |
| 8224 - win_y | 8183 |
| 8184 /* Assume the window manager decorations are the same size on | |
| 8185 three sides, i.e. left, right and bottom. This is to | |
| 8186 compensate for the bottom part. */ | |
| 8187 - FRAME_X_OUTPUT (f)->x_pixels_outer_diff | |
| 8225 - height | 8188 - height |
| 8226 + f->top_pos); | 8189 + f->top_pos); |
| 8227 } | 8190 } |
| 8228 | 8191 |
| 8229 /* The left_pos and top_pos | 8192 /* The left_pos and top_pos |
| 8262 BLOCK_INPUT; | 8225 BLOCK_INPUT; |
| 8263 x_wm_set_size_hint (f, (long) 0, 0); | 8226 x_wm_set_size_hint (f, (long) 0, 0); |
| 8264 | 8227 |
| 8265 modified_left = f->left_pos; | 8228 modified_left = f->left_pos; |
| 8266 modified_top = f->top_pos; | 8229 modified_top = f->top_pos; |
| 8267 | |
| 8268 #if 0 /* Running on psilocin (Debian), and displaying on the NCD X-terminal, | |
| 8269 this seems to be unnecessary and incorrect. rms, 4/17/97. */ | |
| 8270 /* It is a mystery why we need to add the border_width here | |
| 8271 when the frame is already visible, but experiment says we do. */ | |
| 8272 if (change_gravity != 0) | |
| 8273 { | |
| 8274 modified_left += f->border_width; | |
| 8275 modified_top += f->border_width; | |
| 8276 } | |
| 8277 #endif | |
| 8278 | 8230 |
| 8279 if (FRAME_X_DISPLAY_INFO (f)->wm_type == X_WMTYPE_A) | 8231 if (FRAME_X_DISPLAY_INFO (f)->wm_type == X_WMTYPE_A) |
| 8280 { | 8232 { |
| 8281 /* Some WMs (twm, wmaker at least) has an offset that is smaller | 8233 /* Some WMs (twm, wmaker at least) has an offset that is smaller |
| 8282 than the WM decorations. So we use the calculated offset instead | 8234 than the WM decorations. So we use the calculated offset instead |
