* Eli Zaretskii (2006-06-23) writes:
> One possible way of solving this would be to call SystemParametersInfo
> with SPI_GETWORKAREA arg in x_make_frame_visible, and fix f->left_pos
> and f->top_pos we pass to x_set_offset, if their values are inside the
> task bar. I think this should be done for all frames, not just the
> initial frame.
The attached patch implements window position adjustment in
`x_make_frame_visible'. Note that only the case of vertical
adjustment in case the lower part of the frame is covered by the task
bar. I haven't seen problems with frame positioning if the task bar
is located at the top or the sides of the desktop.
I am not sure if `x_make_frame_visible' is the right place for this
adjustment. Personally I'd rather do this in `w32_createwindow' right
after the call to `CreateWindow'. That way `ShowWindow' will already
get a frame with its final coordinates.
Besides, the patch does not address the problem of window placement
with a changed default face mentioned before. If you customize the
default face by giving it a smaller font size and create several new
frames with `C-x 5 2' those will get placed in a cascading manner
until the bottom of the frame relating to the original font size (not
the one in effect) hits the bottom of the usable desktop area.
> A minor catch in this is that user-defined frame parameters will be
> only approximately obeyed (if the specified position invades the
> taskbar). I don't know if this is bad.
We could check if a `top' frame parameter is defined and don't do the
position adjustment if it is. IIUC `w32_get_arg' would be suitable to
check such a parameter. Unfortunately it is not available in
w32term.c (and no w32fns.h declaring it which could be sourced in
w32term.c). That would be another reason to do the adjustment in
`w32_createwindow'.
--
Ralf
Index: w32fns.c
===================================================================
RCS file: /sources/emacs/emacs/src/w32fns.c,v
retrieving revision 1.270
diff -u -r1.270 w32fns.c
--- w32fns.c 2 Jun 2006 21:20:44 -0000 1.270
+++ w32fns.c 25 Jun 2006 13:04:05 -0000
@@ -2085,8 +2085,8 @@
= CreateWindow (EMACS_CLASS,
f->namebuf,
f->output_data.w32->dwStyle | WS_CLIPCHILDREN,
- f->left_pos,
- f->top_pos,
+ CW_USEDEFAULT,
+ SW_SHOW,
rect.right - rect.left,
rect.bottom - rect.top,
NULL,
@@ -2107,6 +2107,11 @@
/* Do this to discard the default setting specified by our parent. */
ShowWindow (hwnd, SW_HIDE);
+
+ /* Update frame positions. */
+ GetWindowRect (hwnd, &rect);
+ f->left_pos = rect.left;
+ f->top_pos = rect.top;
}
}
Index: w32term.c
===================================================================
RCS file: /sources/emacs/emacs/src/w32term.c,v
retrieving revision 1.246
diff -u -r1.246 w32term.c
--- w32term.c 5 Jun 2006 21:20:59 -0000 1.246
+++ w32term.c 25 Jun 2006 13:04:13 -0000
@@ -5665,7 +5665,22 @@
before the window gets really visible. */
if (! FRAME_ICONIFIED_P (f)
&& ! f->output_data.w32->asked_for_visible)
- x_set_offset (f, f->left_pos, f->top_pos, 0);
+ {
+ RECT workarea_rect;
+ RECT window_rect;
+
+ /* Adjust vertical window position in order to avoid being
+ covered by a task bar placed at the bottom of the desktop. */
+ SystemParametersInfo(SPI_GETWORKAREA, 0, &workarea_rect, 0);
+ GetWindowRect(FRAME_W32_WINDOW(f), &window_rect);
+ if (window_rect.bottom > workarea_rect.bottom
+ && window_rect.top > workarea_rect.top)
+ f->top_pos = max (window_rect.top
+ - window_rect.bottom + workarea_rect.bottom,
+ workarea_rect.top);
+
+ x_set_offset (f, f->left_pos, f->top_pos, 0);
+ }
f->output_data.w32->asked_for_visible = 1;
_______________________________________________
emacs-pretest-bug mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug