summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2012-11-06 11:13:27 +0000
committerJon TURNEY <jon.turney@dronecode.org.uk>2012-11-30 14:26:35 +0000
commit2f1d5367b74d0b7513cb4ebc04da25c6aec0126c (patch)
tree397f3ed4a9eb6899ee4b5f6b8620c8c6b600ca70 /src
parentd8fdd10c66825497ff12f9a502d6ee4a887abd94 (diff)
Remove damage even if we can't draw to window because it doesn't exist yet
Diffstat (limited to 'src')
-rw-r--r--src/wndproc.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/wndproc.c b/src/wndproc.c
index 337b274..a41db56 100644
--- a/src/wndproc.c
+++ b/src/wndproc.c
@@ -278,10 +278,6 @@ BitBltFromImage(xcwm_image_t *image, HDC hdcUpdate,
void
UpdateImage(xcwm_window_t *window)
{
- HWND hWnd = xcwm_window_get_local_data(window);
- if (!hWnd)
- return;
-
xcwm_rect_t *dmgRect = xcwm_window_get_damaged_rect(window);
RECT damage;
@@ -290,8 +286,23 @@ UpdateImage(xcwm_window_t *window)
damage.right = dmgRect->x + dmgRect->width;
damage.bottom = dmgRect->y + dmgRect->height;
- DEBUG("UpdateImage: invalidating %dx%d @ %d,%d on HWND 0x08%x\n", dmgRect->width, dmgRect->height, damage.left, damage.top, hWnd);
- InvalidateRect(hWnd, &damage, FALSE);
+ /*
+ We may not have a hWnd yet, if the window is still being created when this
+ damage arrives. Just discard the damage as we will draw the whole thing after
+ being created...
+ */
+ HWND hWnd = xcwm_window_get_local_data(window);
+ if (hWnd)
+ {
+ DEBUG("UpdateImage: invalidating %dx%d @ %d,%d on HWND 0x08%x\n", dmgRect->width, dmgRect->height, dmgRect->x, dmgRect->y, hWnd);
+ InvalidateRect(hWnd, &damage, FALSE);
+ }
+ else
+ {
+ DEBUG("UpdateImage: discarding damage, no hWnd\n");
+ // Remove the damage
+ xcwm_window_remove_damage(window);
+ }
}
/* Windows window styles */