corrected object casts, make it work again on win32

This commit is contained in:
Hans Breuer 2000-11-12 15:46:55 +00:00
parent 8f05462d59
commit aceeae34fb
16 changed files with 320 additions and 31 deletions

View File

@ -1,3 +1,38 @@
2000-11-12 Hans Breuer <Hans@Breuer.Org>
* 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 <otaylor@redhat.com> Sat Nov 11 23:07:30 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_key_press): Call * gtk/gtkentry.c (gtk_entry_key_press): Call

View File

@ -1,3 +1,38 @@
2000-11-12 Hans Breuer <Hans@Breuer.Org>
* 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 <otaylor@redhat.com> Sat Nov 11 23:07:30 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_key_press): Call * gtk/gtkentry.c (gtk_entry_key_press): Call

View File

@ -1,3 +1,38 @@
2000-11-12 Hans Breuer <Hans@Breuer.Org>
* 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 <otaylor@redhat.com> Sat Nov 11 23:07:30 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_key_press): Call * gtk/gtkentry.c (gtk_entry_key_press): Call

View File

@ -1,3 +1,38 @@
2000-11-12 Hans Breuer <Hans@Breuer.Org>
* 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 <otaylor@redhat.com> Sat Nov 11 23:07:30 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_key_press): Call * gtk/gtkentry.c (gtk_entry_key_press): Call

View File

@ -1,3 +1,38 @@
2000-11-12 Hans Breuer <Hans@Breuer.Org>
* 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 <otaylor@redhat.com> Sat Nov 11 23:07:30 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_key_press): Call * gtk/gtkentry.c (gtk_entry_key_press): Call

View File

@ -1,3 +1,38 @@
2000-11-12 Hans Breuer <Hans@Breuer.Org>
* 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 <otaylor@redhat.com> Sat Nov 11 23:07:30 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_key_press): Call * gtk/gtkentry.c (gtk_entry_key_press): Call

View File

@ -1,3 +1,38 @@
2000-11-12 Hans Breuer <Hans@Breuer.Org>
* 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 <otaylor@redhat.com> Sat Nov 11 23:07:30 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_key_press): Call * gtk/gtkentry.c (gtk_entry_key_press): Call

View File

@ -172,8 +172,8 @@ gdk_cursor_new_from_pixmap (GdkPixmap *source,
g_return_val_if_fail (fg != NULL, NULL); g_return_val_if_fail (fg != NULL, NULL);
g_return_val_if_fail (bg != NULL, NULL); g_return_val_if_fail (bg != NULL, NULL);
source_impl = GDK_PIXMAP_IMPL_WIN32 (source); source_impl = GDK_PIXMAP_IMPL_WIN32 (GDK_PIXMAP_OBJECT (source)->impl);
mask_impl = GDK_PIXMAP_IMPL_WIN32 (mask); mask_impl = GDK_PIXMAP_IMPL_WIN32 (GDK_PIXMAP_OBJECT (mask)->impl);
g_return_val_if_fail (source_impl->width == mask_impl->width g_return_val_if_fail (source_impl->width == mask_impl->width
&& source_impl->height == mask_impl->height, && source_impl->height == mask_impl->height,

View File

@ -607,6 +607,14 @@ gdk_win32_draw_drawable (GdkDrawable *drawable,
RECT r; RECT r;
gint src_width, src_height; gint src_width, src_height;
gboolean ok = TRUE; 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" GDK_NOTE (MISC, g_print ("gdk_draw_pixmap: dest: %#x @+%d+%d"
"src: %#x %dx%d@+%d+%d\n", "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); src_rgn = CreateRectRgn (0, 0, src_width + 1, src_height + 1);
draw_rgn = CreateRectRgn (xsrc, ysrc, xsrc + width + 1, ysrc + 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 /* If we are drawing on a window, calculate the region that is
* outside the source pixmap, and invalidate that, causing it to * outside the source pixmap, and invalidate that, causing it to
@ -631,22 +639,26 @@ gdk_win32_draw_drawable (GdkDrawable *drawable,
outside_rgn = CreateRectRgnIndirect (&r); outside_rgn = CreateRectRgnIndirect (&r);
if (CombineRgn (outside_rgn, draw_rgn, src_rgn, RGN_DIFF) != NULLREGION) 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), GDK_NOTE (MISC, (GetRgnBox (outside_rgn, &r),
g_print ("...calling InvalidateRgn, " g_print ("...calling InvalidateRgn, "
"bbox: %ldx%ld@+%ld+%ld\n", "bbox: %ldx%ld@+%ld+%ld\n",
r.right - r.left - 1, r.bottom - r.top - 1, r.right - r.left - 1, r.bottom - r.top - 1,
r.left, r.top))); 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 1 /* Don't know if this is necessary */
if (CombineRgn (draw_rgn, draw_rgn, src_rgn, RGN_AND) == COMPLEXREGION) if (CombineRgn (draw_rgn, draw_rgn, src_rgn, RGN_AND) == COMPLEXREGION)
g_warning ("gdk_win32_draw_drawable: CombineRgn returned a 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 if (r.left != xsrc
|| r.top != ysrc || r.top != ysrc
|| r.right != xsrc + width + 1 || r.right != xsrc + width + 1
@ -666,17 +678,19 @@ gdk_win32_draw_drawable (GdkDrawable *drawable,
} }
#endif #endif
DeleteObject (src_rgn); if (!DeleteObject (src_rgn))
DeleteObject (draw_rgn); WIN32_GDI_FAILED ("DeleteObject");
if (!DeleteObject (draw_rgn))
WIN32_GDI_FAILED ("DeleteObject");
/* This function is called also to bitblt from a window. /* 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) if ((srcdc = CreateCompatibleDC (hdc)) == NULL)
WIN32_GDI_FAILED ("CreateCompatibleDC"), ok = FALSE; 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; WIN32_GDI_FAILED ("SelectObject"), ok = FALSE;
if (ok && !BitBlt (hdc, xdest, ydest, width, height, if (ok && !BitBlt (hdc, xdest, ydest, width, height,
@ -689,7 +703,7 @@ gdk_win32_draw_drawable (GdkDrawable *drawable,
if (srcdc != NULL && !DeleteDC (srcdc)) if (srcdc != NULL && !DeleteDC (srcdc))
WIN32_GDI_FAILED ("DeleteDC"); 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 */ /* Blitting inside a window, use ScrollDC */
RECT scrollRect, clipRect, emptyRect; RECT scrollRect, clipRect, emptyRect;
@ -711,21 +725,23 @@ gdk_win32_draw_drawable (GdkDrawable *drawable,
&scrollRect, &clipRect, &scrollRect, &clipRect,
updateRgn, NULL)) updateRgn, NULL))
WIN32_GDI_FAILED ("ScrollDC"), ok = FALSE; 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; WIN32_GDI_FAILED ("InvalidateRgn"), ok = FALSE;
if (ok && !UpdateWindow (GDK_WINDOW_HWND (drawable))) if (ok && !UpdateWindow (impl->handle))
WIN32_GDI_FAILED ("UpdateWindow"); WIN32_GDI_FAILED ("UpdateWindow");
DeleteObject (updateRgn); if (!DeleteObject (updateRgn))
WIN32_GDI_FAILED ("DeleteObject");
} }
else else
{ {
if ((srcdc = GetDC (GDK_WINDOW_HWND (src))) == NULL) if ((srcdc = GetDC (src_handle)) == NULL)
WIN32_GDI_FAILED ("GetDC"), ok = FALSE; WIN32_GDI_FAILED ("GetDC"), ok = FALSE;
if (ok && !BitBlt (hdc, xdest, ydest, width, height, if (ok && !BitBlt (hdc, xdest, ydest, width, height,
srcdc, xsrc, ysrc, SRCCOPY)) srcdc, xsrc, ysrc, SRCCOPY))
WIN32_GDI_FAILED ("BitBlt"); 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); gdk_win32_hdc_release (drawable, gc, 0);
} }
@ -897,7 +913,7 @@ gdk_win32_draw_image (GdkDrawable *drawable,
gint height) gint height)
{ {
GdkDrawableImplWin32 *impl = GDK_DRAWABLE_IMPL_WIN32 (drawable); 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; GdkColormapPrivateWin32 *colormap_private = (GdkColormapPrivateWin32 *) impl->colormap;
HDC hdc, memdc; HDC hdc, memdc;
HGDIOBJ oldbitmap; HGDIOBJ oldbitmap;

View File

@ -530,10 +530,11 @@ gdk_pointer_grab (GdkWindow *window,
p_grab_owner_events = (owner_events != 0); p_grab_owner_events = (owner_events != 0);
p_grab_automatic = FALSE; 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. * things work better with mouse capture.
*/ */
SetCapture (GDK_WINDOW_HWND (window)); SetCapture (GDK_WINDOW_HWND (window));
# pragma message("Warning: SetCapture call, menus won't work!")
#endif #endif
return_val = GDK_GRAB_SUCCESS; return_val = GDK_GRAB_SUCCESS;
} }
@ -2458,6 +2459,12 @@ gdk_event_translate (GdkEvent *event,
break; 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); hdc = BeginPaint (msg->hwnd, &paintstruct);
GDK_NOTE (EVENTS, GDK_NOTE (EVENTS,
@ -2743,7 +2750,7 @@ gdk_event_translate (GdkEvent *event,
return_val = window != NULL && !GDK_WINDOW_DESTROYED (window); return_val = window != NULL && !GDK_WINDOW_DESTROYED (window);
if (window != NULL) if ((window != NULL) && (gdk_root_window != msg->hwnd))
gdk_window_destroy_notify (window); gdk_window_destroy_notify (window);
break; break;

View File

@ -353,11 +353,17 @@ _gdk_window_move_resize_child (GdkWindow *window,
tmp_list = tmp_list->next; 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 (is_resize)
{ {
if (!MoveWindow (GDK_WINDOW_HWND (window), if (!MoveWindow (GDK_WINDOW_HWND (window),
new_info.x, new_info.y, new_info.width, new_info.height, new_info.x, new_info.y, new_info.width, new_info.height,
FALSE)) TRUE /*FALSE*/))
WIN32_API_FAILED ("MoveWindow"); WIN32_API_FAILED ("MoveWindow");
} }
else else
@ -366,7 +372,7 @@ _gdk_window_move_resize_child (GdkWindow *window,
if (!MoveWindow (GDK_WINDOW_HWND (window), if (!MoveWindow (GDK_WINDOW_HWND (window),
new_info.x, new_info.y, new_info.x, new_info.y,
rect.right - rect.left, rect.bottom - rect.top, rect.right - rect.left, rect.bottom - rect.top,
FALSE)) TRUE /*FALSE*/))
WIN32_API_FAILED ("MoveWindow"); WIN32_API_FAILED ("MoveWindow");
} }

View File

@ -362,7 +362,7 @@ _gdk_win32_get_image (GdkDrawable *drawable,
/* This function is called both to blit from a window and from /* This function is called both to blit from a window and from
* a pixmap. * a pixmap.
*/ */
if (GDK_IS_PIXMAP (drawable)) if (GDK_IS_PIXMAP_IMPL_WIN32 (drawable))
{ {
if ((hdc = CreateCompatibleDC (NULL)) == NULL) if ((hdc = CreateCompatibleDC (NULL)) == NULL)
{ {
@ -517,7 +517,7 @@ _gdk_win32_get_image (GdkDrawable *drawable,
if (!DeleteDC (memdc)) if (!DeleteDC (memdc))
WIN32_GDI_FAILED ("DeleteDC"); WIN32_GDI_FAILED ("DeleteDC");
if (GDK_IS_PIXMAP (drawable)) if (GDK_IS_PIXMAP_IMPL_WIN32 (drawable))
{ {
SelectObject (hdc, oldbitmap1); SelectObject (hdc, oldbitmap1);
DeleteDC (hdc); DeleteDC (hdc);

View File

@ -380,9 +380,17 @@ gdk_pixmap_create_from_data (GdkWindow *window,
* realized it's much easier to do it using gdk...: * realized it's much easier to do it using gdk...:
*/ */
GdkPixmap *result = gdk_pixmap_new (window, width, height, depth); GdkPixmap *result;
GdkPixmap *source = gdk_bitmap_create_from_data (window, data, width, height); GdkPixmap *source;
GdkGC *gc = gdk_gc_new (result); 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_foreground (gc, fg);
gdk_gc_set_background (gc, bg); gdk_gc_set_background (gc, bg);
gdk_draw_drawable (result, gc, source, 0, 0, 0, 0, width, height); gdk_draw_drawable (result, gc, source, 0, 0, 0, 0, width, height);

View File

@ -98,7 +98,12 @@ gdk_selection_owner_set (GdkWindow *owner,
return FALSE; return FALSE;
if (owner != NULL) if (owner != NULL)
xwindow = GDK_WINDOW_HWND (owner); {
if (GDK_WINDOW_DESTROYED (owner))
return FALSE;
xwindow = GDK_WINDOW_HWND (owner);
}
else else
xwindow = NULL; xwindow = NULL;

View File

@ -135,7 +135,8 @@ gdk_window_impl_win32_finalize (GObject *object)
if (window_impl->hcursor != NULL) if (window_impl->hcursor != NULL)
{ {
DestroyCursor (window_impl->hcursor); if (!DestroyCursor (window_impl->hcursor))
WIN32_GDI_FAILED("DestroyCursor");
window_impl->hcursor = NULL; 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); GDK_DRAWABLE_GET_CLASS (draw_impl)->set_colormap (drawable, cmap);
/* XXX */ /* XXX */
} }
static void static void
@ -676,6 +676,7 @@ gdk_window_foreign_new (GdkNativeWindow anid)
impl = GDK_WINDOW_IMPL_WIN32 (private->impl); impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
draw_impl = GDK_DRAWABLE_IMPL_WIN32 (private->impl); draw_impl = GDK_DRAWABLE_IMPL_WIN32 (private->impl);
draw_impl->wrapper = GDK_DRAWABLE (window); draw_impl->wrapper = GDK_DRAWABLE (window);
parent = GetParent ((HWND)anid);
private->parent = gdk_win32_handle_table_lookup ((GdkNativeWindow) parent); private->parent = gdk_win32_handle_table_lookup ((GdkNativeWindow) parent);
@ -750,6 +751,7 @@ void
gdk_window_destroy_notify (GdkWindow *window) gdk_window_destroy_notify (GdkWindow *window)
{ {
g_return_if_fail (window != NULL); g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
GDK_NOTE (EVENTS, GDK_NOTE (EVENTS,
g_print ("gdk_window_destroy_notify: %#x %s\n", g_print ("gdk_window_destroy_notify: %#x %s\n",

View File

@ -74,7 +74,7 @@ gdk-win32.lib : $(gdk_win32_OBJECTS)
.c.obj : .c.obj :
$(CC) $(CFLAGS) -GD -c -DGDK_COMPILATION -DG_LOG_DOMAIN=\"Gdk\" $< $(CC) $(CFLAGS) -GD -c -DGDK_COMPILATION -DG_LOG_DOMAIN=\"Gdk\" $<
clean: clean::
del *.obj del *.obj
del *.lib del *.lib
del *.err del *.err