Commit a6085637 authored by Karl Heuer's avatar Karl Heuer
Browse files

(win32_wnd_proc): Handle WM_ERASEBKGND and

WM_PALETTECHANGED messages inline (as they should be).
parent 210df3bf
......@@ -2932,25 +2932,41 @@ win32_wnd_proc (hwnd, msg, wParam, lParam)
Win32Msg wmsg;
int windows_translate;
/* Note that it is okay to call x_window_to_frame, even though we are
not running in the main lisp thread, because frame deletion
requires the lisp thread to synchronize with this thread. Thus, if
a frame struct is returned, it can be used without concern that the
lisp thread might make it disappear while we are using it.
NB. Walking the frame list in this thread is safe (as long as
writes of Lisp_Object slots are atomic, which they are on Windows).
Although delete-frame can destructively modify the frame list while
we are walking it, a garbage collection cannot occur until after
delete-frame has synchronized with this thread.
It is also safe to use functions that make GDI calls, such as
win32_clear_rect, because these functions must obtain a DC handle
from the frame struct using get_frame_dc which is thread-aware. */
switch (msg)
/* This is (always?) generated by BeginPaint, so there is no gain
in forwarding this message to the main thread - it can simply
erase the background before repainting. */
#if 0
enter_crit ();
GetUpdateRect (hwnd, &wmsg.rect, FALSE);
leave_crit ();
my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
f = x_window_to_frame (dpyinfo, hwnd);
if (f)
GetUpdateRect (hwnd, &wmsg.rect, FALSE);
win32_clear_rect (f, NULL, &wmsg.rect);
return 1;
/* ignore our own changes */
if ((HWND)wParam != hwnd)
/* simply notify main thread it may need to update frames */
my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
f = x_window_to_frame (dpyinfo, hwnd);
if (f)
/* get_frame_dc will realize our palette and force all
frames to be redrawn if needed. */
release_frame_dc (f, get_frame_dc (f));
return 0;
case WM_PAINT:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment