From aceeae34fb8c0e2d99b0e5c82c37232cfccc5c06 Mon Sep 17 00:00:00 2001 From: Hans Breuer Date: Sun, 12 Nov 2000 15:46:55 +0000 Subject: [PATCH] corrected object casts, make it work again on win32 --- ChangeLog | 35 +++++++++++++++++++++++++ ChangeLog.pre-2-0 | 35 +++++++++++++++++++++++++ ChangeLog.pre-2-10 | 35 +++++++++++++++++++++++++ ChangeLog.pre-2-2 | 35 +++++++++++++++++++++++++ ChangeLog.pre-2-4 | 35 +++++++++++++++++++++++++ ChangeLog.pre-2-6 | 35 +++++++++++++++++++++++++ ChangeLog.pre-2-8 | 35 +++++++++++++++++++++++++ gdk/win32/gdkcursor-win32.c | 4 +-- gdk/win32/gdkdrawable-win32.c | 48 ++++++++++++++++++++++------------ gdk/win32/gdkevents-win32.c | 11 ++++++-- gdk/win32/gdkgeometry-win32.c | 10 +++++-- gdk/win32/gdkimage-win32.c | 4 +-- gdk/win32/gdkpixmap-win32.c | 14 +++++++--- gdk/win32/gdkselection-win32.c | 7 ++++- gdk/win32/gdkwindow-win32.c | 6 +++-- gdk/win32/makefile.msc | 2 +- 16 files changed, 320 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3412cd8620..e8c8c804a6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,38 @@ +2000-11-12 Hans Breuer + + * gdk/win32/makefile.msc : reflect build module changes + + * gdk/win32/gdkcursor-win32.c : can't cast to impl type directly + from GdkPixmap*, cast implementation member instead. + + * gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_drawable) : The + passed in drawable is of type GdkDrawableImplWin32, the GdkPixmap *src + maybe either GdkDrawable or GdkDrawableImpl. Corrected all casts, add + more Gdi functions return value checking. + (gdk_win32_draw_image) : use IMAGE_PRIVATE_DATA to get on the + GdkImagePrivateWin32 *. + + * gdk/win32/gdkevents-win32.c : Disable the SetCapture call to make + menus useable again. Add #pragma message to keep reminded on this issue. + (gdk_event_translate) : don't generate GDK_EXPOSE events for InputOnly + windows. This allows to enable backing store on Win32! + + * gdk/win32/gdkimage-win32.c (_gdk_win32_get_image) : the passed + in drawable is of impl type. Correct specific type checks appropriate. + + * gdk/win32/gdkpixmap-win32.c (gdk_pixmap_create_from_data) : check + GDK_WINDOW_DESTROYED before allocating new resources. + + * gdk/win32/gdkselection-win32.c : Handle GDK_WINDOW_DESTROYED case + + * gdk/win32/gdkwindow-win32.c : more Gdi return value checking, + (gdk_window_foreign_new) initialize parent handle. + (gdk_window_destroy_notify) add GDK_IS_WINDOW check + + * gdk/win32/gdkgeometry-win32.c (_gdk_window_move_resize_child) : + Let the GDI invalidate the window on MoveWindow call to fix scrolling + problems (e.g. main buttons in testgtk). + Sat Nov 11 23:07:30 2000 Owen Taylor * gtk/gtkentry.c (gtk_entry_key_press): Call diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 3412cd8620..e8c8c804a6 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,38 @@ +2000-11-12 Hans Breuer + + * gdk/win32/makefile.msc : reflect build module changes + + * gdk/win32/gdkcursor-win32.c : can't cast to impl type directly + from GdkPixmap*, cast implementation member instead. + + * gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_drawable) : The + passed in drawable is of type GdkDrawableImplWin32, the GdkPixmap *src + maybe either GdkDrawable or GdkDrawableImpl. Corrected all casts, add + more Gdi functions return value checking. + (gdk_win32_draw_image) : use IMAGE_PRIVATE_DATA to get on the + GdkImagePrivateWin32 *. + + * gdk/win32/gdkevents-win32.c : Disable the SetCapture call to make + menus useable again. Add #pragma message to keep reminded on this issue. + (gdk_event_translate) : don't generate GDK_EXPOSE events for InputOnly + windows. This allows to enable backing store on Win32! + + * gdk/win32/gdkimage-win32.c (_gdk_win32_get_image) : the passed + in drawable is of impl type. Correct specific type checks appropriate. + + * gdk/win32/gdkpixmap-win32.c (gdk_pixmap_create_from_data) : check + GDK_WINDOW_DESTROYED before allocating new resources. + + * gdk/win32/gdkselection-win32.c : Handle GDK_WINDOW_DESTROYED case + + * gdk/win32/gdkwindow-win32.c : more Gdi return value checking, + (gdk_window_foreign_new) initialize parent handle. + (gdk_window_destroy_notify) add GDK_IS_WINDOW check + + * gdk/win32/gdkgeometry-win32.c (_gdk_window_move_resize_child) : + Let the GDI invalidate the window on MoveWindow call to fix scrolling + problems (e.g. main buttons in testgtk). + Sat Nov 11 23:07:30 2000 Owen Taylor * gtk/gtkentry.c (gtk_entry_key_press): Call diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 3412cd8620..e8c8c804a6 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,38 @@ +2000-11-12 Hans Breuer + + * gdk/win32/makefile.msc : reflect build module changes + + * gdk/win32/gdkcursor-win32.c : can't cast to impl type directly + from GdkPixmap*, cast implementation member instead. + + * gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_drawable) : The + passed in drawable is of type GdkDrawableImplWin32, the GdkPixmap *src + maybe either GdkDrawable or GdkDrawableImpl. Corrected all casts, add + more Gdi functions return value checking. + (gdk_win32_draw_image) : use IMAGE_PRIVATE_DATA to get on the + GdkImagePrivateWin32 *. + + * gdk/win32/gdkevents-win32.c : Disable the SetCapture call to make + menus useable again. Add #pragma message to keep reminded on this issue. + (gdk_event_translate) : don't generate GDK_EXPOSE events for InputOnly + windows. This allows to enable backing store on Win32! + + * gdk/win32/gdkimage-win32.c (_gdk_win32_get_image) : the passed + in drawable is of impl type. Correct specific type checks appropriate. + + * gdk/win32/gdkpixmap-win32.c (gdk_pixmap_create_from_data) : check + GDK_WINDOW_DESTROYED before allocating new resources. + + * gdk/win32/gdkselection-win32.c : Handle GDK_WINDOW_DESTROYED case + + * gdk/win32/gdkwindow-win32.c : more Gdi return value checking, + (gdk_window_foreign_new) initialize parent handle. + (gdk_window_destroy_notify) add GDK_IS_WINDOW check + + * gdk/win32/gdkgeometry-win32.c (_gdk_window_move_resize_child) : + Let the GDI invalidate the window on MoveWindow call to fix scrolling + problems (e.g. main buttons in testgtk). + Sat Nov 11 23:07:30 2000 Owen Taylor * gtk/gtkentry.c (gtk_entry_key_press): Call diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 3412cd8620..e8c8c804a6 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,38 @@ +2000-11-12 Hans Breuer + + * gdk/win32/makefile.msc : reflect build module changes + + * gdk/win32/gdkcursor-win32.c : can't cast to impl type directly + from GdkPixmap*, cast implementation member instead. + + * gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_drawable) : The + passed in drawable is of type GdkDrawableImplWin32, the GdkPixmap *src + maybe either GdkDrawable or GdkDrawableImpl. Corrected all casts, add + more Gdi functions return value checking. + (gdk_win32_draw_image) : use IMAGE_PRIVATE_DATA to get on the + GdkImagePrivateWin32 *. + + * gdk/win32/gdkevents-win32.c : Disable the SetCapture call to make + menus useable again. Add #pragma message to keep reminded on this issue. + (gdk_event_translate) : don't generate GDK_EXPOSE events for InputOnly + windows. This allows to enable backing store on Win32! + + * gdk/win32/gdkimage-win32.c (_gdk_win32_get_image) : the passed + in drawable is of impl type. Correct specific type checks appropriate. + + * gdk/win32/gdkpixmap-win32.c (gdk_pixmap_create_from_data) : check + GDK_WINDOW_DESTROYED before allocating new resources. + + * gdk/win32/gdkselection-win32.c : Handle GDK_WINDOW_DESTROYED case + + * gdk/win32/gdkwindow-win32.c : more Gdi return value checking, + (gdk_window_foreign_new) initialize parent handle. + (gdk_window_destroy_notify) add GDK_IS_WINDOW check + + * gdk/win32/gdkgeometry-win32.c (_gdk_window_move_resize_child) : + Let the GDI invalidate the window on MoveWindow call to fix scrolling + problems (e.g. main buttons in testgtk). + Sat Nov 11 23:07:30 2000 Owen Taylor * gtk/gtkentry.c (gtk_entry_key_press): Call diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 3412cd8620..e8c8c804a6 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,38 @@ +2000-11-12 Hans Breuer + + * gdk/win32/makefile.msc : reflect build module changes + + * gdk/win32/gdkcursor-win32.c : can't cast to impl type directly + from GdkPixmap*, cast implementation member instead. + + * gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_drawable) : The + passed in drawable is of type GdkDrawableImplWin32, the GdkPixmap *src + maybe either GdkDrawable or GdkDrawableImpl. Corrected all casts, add + more Gdi functions return value checking. + (gdk_win32_draw_image) : use IMAGE_PRIVATE_DATA to get on the + GdkImagePrivateWin32 *. + + * gdk/win32/gdkevents-win32.c : Disable the SetCapture call to make + menus useable again. Add #pragma message to keep reminded on this issue. + (gdk_event_translate) : don't generate GDK_EXPOSE events for InputOnly + windows. This allows to enable backing store on Win32! + + * gdk/win32/gdkimage-win32.c (_gdk_win32_get_image) : the passed + in drawable is of impl type. Correct specific type checks appropriate. + + * gdk/win32/gdkpixmap-win32.c (gdk_pixmap_create_from_data) : check + GDK_WINDOW_DESTROYED before allocating new resources. + + * gdk/win32/gdkselection-win32.c : Handle GDK_WINDOW_DESTROYED case + + * gdk/win32/gdkwindow-win32.c : more Gdi return value checking, + (gdk_window_foreign_new) initialize parent handle. + (gdk_window_destroy_notify) add GDK_IS_WINDOW check + + * gdk/win32/gdkgeometry-win32.c (_gdk_window_move_resize_child) : + Let the GDI invalidate the window on MoveWindow call to fix scrolling + problems (e.g. main buttons in testgtk). + Sat Nov 11 23:07:30 2000 Owen Taylor * gtk/gtkentry.c (gtk_entry_key_press): Call diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 3412cd8620..e8c8c804a6 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,38 @@ +2000-11-12 Hans Breuer + + * gdk/win32/makefile.msc : reflect build module changes + + * gdk/win32/gdkcursor-win32.c : can't cast to impl type directly + from GdkPixmap*, cast implementation member instead. + + * gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_drawable) : The + passed in drawable is of type GdkDrawableImplWin32, the GdkPixmap *src + maybe either GdkDrawable or GdkDrawableImpl. Corrected all casts, add + more Gdi functions return value checking. + (gdk_win32_draw_image) : use IMAGE_PRIVATE_DATA to get on the + GdkImagePrivateWin32 *. + + * gdk/win32/gdkevents-win32.c : Disable the SetCapture call to make + menus useable again. Add #pragma message to keep reminded on this issue. + (gdk_event_translate) : don't generate GDK_EXPOSE events for InputOnly + windows. This allows to enable backing store on Win32! + + * gdk/win32/gdkimage-win32.c (_gdk_win32_get_image) : the passed + in drawable is of impl type. Correct specific type checks appropriate. + + * gdk/win32/gdkpixmap-win32.c (gdk_pixmap_create_from_data) : check + GDK_WINDOW_DESTROYED before allocating new resources. + + * gdk/win32/gdkselection-win32.c : Handle GDK_WINDOW_DESTROYED case + + * gdk/win32/gdkwindow-win32.c : more Gdi return value checking, + (gdk_window_foreign_new) initialize parent handle. + (gdk_window_destroy_notify) add GDK_IS_WINDOW check + + * gdk/win32/gdkgeometry-win32.c (_gdk_window_move_resize_child) : + Let the GDI invalidate the window on MoveWindow call to fix scrolling + problems (e.g. main buttons in testgtk). + Sat Nov 11 23:07:30 2000 Owen Taylor * gtk/gtkentry.c (gtk_entry_key_press): Call diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 3412cd8620..e8c8c804a6 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,38 @@ +2000-11-12 Hans Breuer + + * gdk/win32/makefile.msc : reflect build module changes + + * gdk/win32/gdkcursor-win32.c : can't cast to impl type directly + from GdkPixmap*, cast implementation member instead. + + * gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_drawable) : The + passed in drawable is of type GdkDrawableImplWin32, the GdkPixmap *src + maybe either GdkDrawable or GdkDrawableImpl. Corrected all casts, add + more Gdi functions return value checking. + (gdk_win32_draw_image) : use IMAGE_PRIVATE_DATA to get on the + GdkImagePrivateWin32 *. + + * gdk/win32/gdkevents-win32.c : Disable the SetCapture call to make + menus useable again. Add #pragma message to keep reminded on this issue. + (gdk_event_translate) : don't generate GDK_EXPOSE events for InputOnly + windows. This allows to enable backing store on Win32! + + * gdk/win32/gdkimage-win32.c (_gdk_win32_get_image) : the passed + in drawable is of impl type. Correct specific type checks appropriate. + + * gdk/win32/gdkpixmap-win32.c (gdk_pixmap_create_from_data) : check + GDK_WINDOW_DESTROYED before allocating new resources. + + * gdk/win32/gdkselection-win32.c : Handle GDK_WINDOW_DESTROYED case + + * gdk/win32/gdkwindow-win32.c : more Gdi return value checking, + (gdk_window_foreign_new) initialize parent handle. + (gdk_window_destroy_notify) add GDK_IS_WINDOW check + + * gdk/win32/gdkgeometry-win32.c (_gdk_window_move_resize_child) : + Let the GDI invalidate the window on MoveWindow call to fix scrolling + problems (e.g. main buttons in testgtk). + Sat Nov 11 23:07:30 2000 Owen Taylor * gtk/gtkentry.c (gtk_entry_key_press): Call diff --git a/gdk/win32/gdkcursor-win32.c b/gdk/win32/gdkcursor-win32.c index 95da391243..7b6c8ac896 100644 --- a/gdk/win32/gdkcursor-win32.c +++ b/gdk/win32/gdkcursor-win32.c @@ -172,8 +172,8 @@ gdk_cursor_new_from_pixmap (GdkPixmap *source, g_return_val_if_fail (fg != NULL, NULL); g_return_val_if_fail (bg != NULL, NULL); - source_impl = GDK_PIXMAP_IMPL_WIN32 (source); - mask_impl = GDK_PIXMAP_IMPL_WIN32 (mask); + source_impl = GDK_PIXMAP_IMPL_WIN32 (GDK_PIXMAP_OBJECT (source)->impl); + mask_impl = GDK_PIXMAP_IMPL_WIN32 (GDK_PIXMAP_OBJECT (mask)->impl); g_return_val_if_fail (source_impl->width == mask_impl->width && source_impl->height == mask_impl->height, diff --git a/gdk/win32/gdkdrawable-win32.c b/gdk/win32/gdkdrawable-win32.c index 75b23583ca..0b85814f0d 100644 --- a/gdk/win32/gdkdrawable-win32.c +++ b/gdk/win32/gdkdrawable-win32.c @@ -607,6 +607,14 @@ gdk_win32_draw_drawable (GdkDrawable *drawable, RECT r; gint src_width, src_height; gboolean ok = TRUE; + GdkDrawableImplWin32 *impl; + HANDLE src_handle; + + impl = GDK_DRAWABLE_IMPL_WIN32 (drawable); + if (GDK_IS_DRAWABLE_IMPL_WIN32(src)) + src_handle = GDK_DRAWABLE_IMPL_WIN32 (src)->handle; + else + src_handle = GDK_DRAWABLE_HANDLE (src); GDK_NOTE (MISC, g_print ("gdk_draw_pixmap: dest: %#x @+%d+%d" "src: %#x %dx%d@+%d+%d\n", @@ -621,7 +629,7 @@ gdk_win32_draw_drawable (GdkDrawable *drawable, src_rgn = CreateRectRgn (0, 0, src_width + 1, src_height + 1); draw_rgn = CreateRectRgn (xsrc, ysrc, xsrc + width + 1, ysrc + height + 1); - if (GDK_IS_WINDOW (drawable)) + if (GDK_IS_WINDOW_IMPL_WIN32 (drawable)) { /* If we are drawing on a window, calculate the region that is * outside the source pixmap, and invalidate that, causing it to @@ -631,22 +639,26 @@ gdk_win32_draw_drawable (GdkDrawable *drawable, outside_rgn = CreateRectRgnIndirect (&r); if (CombineRgn (outside_rgn, draw_rgn, src_rgn, RGN_DIFF) != NULLREGION) { - OffsetRgn (outside_rgn, xdest, ydest); + if (ERROR == OffsetRgn (outside_rgn, xdest, ydest)) + WIN32_GDI_FAILED ("OffsetRgn"); GDK_NOTE (MISC, (GetRgnBox (outside_rgn, &r), g_print ("...calling InvalidateRgn, " "bbox: %ldx%ld@+%ld+%ld\n", r.right - r.left - 1, r.bottom - r.top - 1, r.left, r.top))); - InvalidateRgn (GDK_DRAWABLE_HANDLE (drawable), outside_rgn, TRUE); + if (!InvalidateRgn (impl->handle, outside_rgn, TRUE)) + WIN32_GDI_FAILED ("InvalidateRgn"); } - DeleteObject (outside_rgn); + if (!DeleteObject (outside_rgn)) + WIN32_GDI_FAILED ("DeleteObject"); } #if 1 /* Don't know if this is necessary */ if (CombineRgn (draw_rgn, draw_rgn, src_rgn, RGN_AND) == COMPLEXREGION) g_warning ("gdk_win32_draw_drawable: CombineRgn returned a COMPLEXREGION"); - GetRgnBox (draw_rgn, &r); + if (0 == GetRgnBox (draw_rgn, &r)) + WIN32_GDI_FAILED("GetRgnBox"); if (r.left != xsrc || r.top != ysrc || r.right != xsrc + width + 1 @@ -666,17 +678,19 @@ gdk_win32_draw_drawable (GdkDrawable *drawable, } #endif - DeleteObject (src_rgn); - DeleteObject (draw_rgn); + if (!DeleteObject (src_rgn)) + WIN32_GDI_FAILED ("DeleteObject"); + if (!DeleteObject (draw_rgn)) + WIN32_GDI_FAILED ("DeleteObject"); /* This function is called also to bitblt from a window. */ - if (GDK_IS_PIXMAP (src)) + if (GDK_IS_PIXMAP_IMPL_WIN32 (src) || GDK_IS_PIXMAP(src)) { if ((srcdc = CreateCompatibleDC (hdc)) == NULL) WIN32_GDI_FAILED ("CreateCompatibleDC"), ok = FALSE; - if (ok && (hgdiobj = SelectObject (srcdc, GDK_PIXMAP_HBITMAP (src))) == NULL) + if (ok && (hgdiobj = SelectObject (srcdc, src_handle)) == NULL) WIN32_GDI_FAILED ("SelectObject"), ok = FALSE; if (ok && !BitBlt (hdc, xdest, ydest, width, height, @@ -689,7 +703,7 @@ gdk_win32_draw_drawable (GdkDrawable *drawable, if (srcdc != NULL && !DeleteDC (srcdc)) WIN32_GDI_FAILED ("DeleteDC"); } - else if (GDK_DRAWABLE_HANDLE (drawable) == GDK_DRAWABLE_HANDLE (src)) + else if (impl->handle == src_handle) { /* Blitting inside a window, use ScrollDC */ RECT scrollRect, clipRect, emptyRect; @@ -711,21 +725,23 @@ gdk_win32_draw_drawable (GdkDrawable *drawable, &scrollRect, &clipRect, updateRgn, NULL)) WIN32_GDI_FAILED ("ScrollDC"), ok = FALSE; - if (ok && !InvalidateRgn (GDK_WINDOW_HWND (drawable), updateRgn, FALSE)) + if (ok && !InvalidateRgn (impl->handle, updateRgn, FALSE)) WIN32_GDI_FAILED ("InvalidateRgn"), ok = FALSE; - if (ok && !UpdateWindow (GDK_WINDOW_HWND (drawable))) + if (ok && !UpdateWindow (impl->handle)) WIN32_GDI_FAILED ("UpdateWindow"); - DeleteObject (updateRgn); + if (!DeleteObject (updateRgn)) + WIN32_GDI_FAILED ("DeleteObject"); } else { - if ((srcdc = GetDC (GDK_WINDOW_HWND (src))) == NULL) + if ((srcdc = GetDC (src_handle)) == NULL) WIN32_GDI_FAILED ("GetDC"), ok = FALSE; if (ok && !BitBlt (hdc, xdest, ydest, width, height, srcdc, xsrc, ysrc, SRCCOPY)) WIN32_GDI_FAILED ("BitBlt"); - ReleaseDC (GDK_WINDOW_HWND (src), srcdc); + if (ok && !ReleaseDC (src_handle, srcdc)) + WIN32_GDI_FAILED ("ReleaseDC"); } gdk_win32_hdc_release (drawable, gc, 0); } @@ -897,7 +913,7 @@ gdk_win32_draw_image (GdkDrawable *drawable, gint height) { GdkDrawableImplWin32 *impl = GDK_DRAWABLE_IMPL_WIN32 (drawable); - GdkImagePrivateWin32 *image_private = (GdkImagePrivateWin32 *) image; + GdkImagePrivateWin32 *image_private = IMAGE_PRIVATE_DATA (image); GdkColormapPrivateWin32 *colormap_private = (GdkColormapPrivateWin32 *) impl->colormap; HDC hdc, memdc; HGDIOBJ oldbitmap; diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c index 85d97b5a01..a4d66c33d2 100644 --- a/gdk/win32/gdkevents-win32.c +++ b/gdk/win32/gdkevents-win32.c @@ -530,10 +530,11 @@ gdk_pointer_grab (GdkWindow *window, p_grab_owner_events = (owner_events != 0); p_grab_automatic = FALSE; -#if 1 /* Menus don't work if we use mouse capture. Pity, because many other +#if 0 /* Menus don't work if we use mouse capture. Pity, because many other * things work better with mouse capture. */ SetCapture (GDK_WINDOW_HWND (window)); +# pragma message("Warning: SetCapture call, menus won't work!") #endif return_val = GDK_GRAB_SUCCESS; } @@ -2458,6 +2459,12 @@ gdk_event_translate (GdkEvent *event, break; } + /* HB: don't generate GDK_EXPOSE events for InputOnly + * windows -> backing store now works! + */ + if (GDK_WINDOW_OBJECT (window)->input_only) + break; + hdc = BeginPaint (msg->hwnd, &paintstruct); GDK_NOTE (EVENTS, @@ -2743,7 +2750,7 @@ gdk_event_translate (GdkEvent *event, return_val = window != NULL && !GDK_WINDOW_DESTROYED (window); - if (window != NULL) + if ((window != NULL) && (gdk_root_window != msg->hwnd)) gdk_window_destroy_notify (window); break; diff --git a/gdk/win32/gdkgeometry-win32.c b/gdk/win32/gdkgeometry-win32.c index ebfab62b98..bd14f1bdb5 100644 --- a/gdk/win32/gdkgeometry-win32.c +++ b/gdk/win32/gdkgeometry-win32.c @@ -353,11 +353,17 @@ _gdk_window_move_resize_child (GdkWindow *window, tmp_list = tmp_list->next; } + /* + * HB: Passing TRUE(=Redraw) to MoveWindow here fixes some + * redraw problems with (e.g. testgtk main buttons) + * scrolling. AFAIK the non flicker optimization would + * be done by the GDI anyway, if the window is SW_HIDE. + */ if (is_resize) { if (!MoveWindow (GDK_WINDOW_HWND (window), new_info.x, new_info.y, new_info.width, new_info.height, - FALSE)) + TRUE /*FALSE*/)) WIN32_API_FAILED ("MoveWindow"); } else @@ -366,7 +372,7 @@ _gdk_window_move_resize_child (GdkWindow *window, if (!MoveWindow (GDK_WINDOW_HWND (window), new_info.x, new_info.y, rect.right - rect.left, rect.bottom - rect.top, - FALSE)) + TRUE /*FALSE*/)) WIN32_API_FAILED ("MoveWindow"); } diff --git a/gdk/win32/gdkimage-win32.c b/gdk/win32/gdkimage-win32.c index 284dd79f0d..65ada9d6ea 100644 --- a/gdk/win32/gdkimage-win32.c +++ b/gdk/win32/gdkimage-win32.c @@ -362,7 +362,7 @@ _gdk_win32_get_image (GdkDrawable *drawable, /* This function is called both to blit from a window and from * a pixmap. */ - if (GDK_IS_PIXMAP (drawable)) + if (GDK_IS_PIXMAP_IMPL_WIN32 (drawable)) { if ((hdc = CreateCompatibleDC (NULL)) == NULL) { @@ -517,7 +517,7 @@ _gdk_win32_get_image (GdkDrawable *drawable, if (!DeleteDC (memdc)) WIN32_GDI_FAILED ("DeleteDC"); - if (GDK_IS_PIXMAP (drawable)) + if (GDK_IS_PIXMAP_IMPL_WIN32 (drawable)) { SelectObject (hdc, oldbitmap1); DeleteDC (hdc); diff --git a/gdk/win32/gdkpixmap-win32.c b/gdk/win32/gdkpixmap-win32.c index e7064601f4..f20a21df4d 100644 --- a/gdk/win32/gdkpixmap-win32.c +++ b/gdk/win32/gdkpixmap-win32.c @@ -380,9 +380,17 @@ gdk_pixmap_create_from_data (GdkWindow *window, * realized it's much easier to do it using gdk...: */ - GdkPixmap *result = gdk_pixmap_new (window, width, height, depth); - GdkPixmap *source = gdk_bitmap_create_from_data (window, data, width, height); - GdkGC *gc = gdk_gc_new (result); + GdkPixmap *result; + GdkPixmap *source; + GdkGC *gc; + + if (GDK_WINDOW_DESTROYED (window)) + return NULL; + + result = gdk_pixmap_new (window, width, height, depth); + source = gdk_bitmap_create_from_data (window, data, width, height); + gc = gdk_gc_new (result); + gdk_gc_set_foreground (gc, fg); gdk_gc_set_background (gc, bg); gdk_draw_drawable (result, gc, source, 0, 0, 0, 0, width, height); diff --git a/gdk/win32/gdkselection-win32.c b/gdk/win32/gdkselection-win32.c index bda364b8a8..bf5733c8b8 100644 --- a/gdk/win32/gdkselection-win32.c +++ b/gdk/win32/gdkselection-win32.c @@ -98,7 +98,12 @@ gdk_selection_owner_set (GdkWindow *owner, return FALSE; if (owner != NULL) - xwindow = GDK_WINDOW_HWND (owner); + { + if (GDK_WINDOW_DESTROYED (owner)) + return FALSE; + + xwindow = GDK_WINDOW_HWND (owner); + } else xwindow = NULL; diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c index 28fd509948..3d971e8657 100644 --- a/gdk/win32/gdkwindow-win32.c +++ b/gdk/win32/gdkwindow-win32.c @@ -135,7 +135,8 @@ gdk_window_impl_win32_finalize (GObject *object) if (window_impl->hcursor != NULL) { - DestroyCursor (window_impl->hcursor); + if (!DestroyCursor (window_impl->hcursor)) + WIN32_GDI_FAILED("DestroyCursor"); window_impl->hcursor = NULL; } @@ -178,7 +179,6 @@ gdk_window_impl_win32_set_colormap (GdkDrawable *drawable, GDK_DRAWABLE_GET_CLASS (draw_impl)->set_colormap (drawable, cmap); /* XXX */ - } static void @@ -676,6 +676,7 @@ gdk_window_foreign_new (GdkNativeWindow anid) impl = GDK_WINDOW_IMPL_WIN32 (private->impl); draw_impl = GDK_DRAWABLE_IMPL_WIN32 (private->impl); draw_impl->wrapper = GDK_DRAWABLE (window); + parent = GetParent ((HWND)anid); private->parent = gdk_win32_handle_table_lookup ((GdkNativeWindow) parent); @@ -750,6 +751,7 @@ void gdk_window_destroy_notify (GdkWindow *window) { g_return_if_fail (window != NULL); + g_return_if_fail (GDK_IS_WINDOW (window)); GDK_NOTE (EVENTS, g_print ("gdk_window_destroy_notify: %#x %s\n", diff --git a/gdk/win32/makefile.msc b/gdk/win32/makefile.msc index 1b4bed3063..a0102aaf45 100644 --- a/gdk/win32/makefile.msc +++ b/gdk/win32/makefile.msc @@ -74,7 +74,7 @@ gdk-win32.lib : $(gdk_win32_OBJECTS) .c.obj : $(CC) $(CFLAGS) -GD -c -DGDK_COMPILATION -DG_LOG_DOMAIN=\"Gdk\" $< -clean: +clean:: del *.obj del *.lib del *.err