summaryrefslogtreecommitdiff
path: root/gdk/win32/gdkregion-win32.c
diff options
context:
space:
mode:
authorTor Lillqvist <tml@src.gnome.org>1999-07-10 00:26:54 +0000
committerTor Lillqvist <tml@src.gnome.org>1999-07-10 00:26:54 +0000
commitc9b2958b6c64583a74ac566824646ad4b59628af (patch)
tree52850e54ec2e13f4382301cd84b01f49c544c676 /gdk/win32/gdkregion-win32.c
parent68f895bd68e08c538db73dccec428d09aa96988e (diff)
downloadgtk+-c9b2958b6c64583a74ac566824646ad4b59628af.tar.gz
Don't draw anything if width or height is zero. Don't print a warning if
* gdk/win32/gdkdraw.c (gdk_draw_arc): Don't draw anything if width or height is zero. Don't print a warning if Pie or Arc fails, they always fail (?) for very narrow ellipses. * gdk/win32/gdkdraw.c (gdk_draw_pixmap): Call InvalidateRgn for the part or the destination window corresponding to source area outside of the source drawable's boundary. * gdk/win32/gdkdraw.c (gdk_draw_lines, gdk_draw_polygon): Don't do anything if less than two points. * gdk/win32/gdkselection.c (gdk_selection_owner_get): Always return NULL. Gtk cut-and-paste inside a single program works better this way. (It always gets the clipboard contents from Windows, not from its own copy, which is cleared anyway. I can't say I fully understand what happens... Emulating the X selection and property stuff is a bit of a mess.) * gdk/win32/gdkevents.c * gdk/win32/gdkproperty.c: A bít more verbose logging. * gdk/win32/gdkregion.c: Fix some memory leaks (temporary regions that never got deleted). Revamp gdk_region_shrink. * gdk/win32/gdkregion.c: Fix memory leak, delete temporary regions after use. * gtk/gtk.def: Add some missing entry points. * gtk/gtkrc.c: Strip trailing directory separator from pixmap path component.
Diffstat (limited to 'gdk/win32/gdkregion-win32.c')
-rw-r--r--gdk/win32/gdkregion-win32.c45
1 files changed, 31 insertions, 14 deletions
diff --git a/gdk/win32/gdkregion-win32.c b/gdk/win32/gdkregion-win32.c
index 55f5e98fb2..2b417ea0bd 100644
--- a/gdk/win32/gdkregion-win32.c
+++ b/gdk/win32/gdkregion-win32.c
@@ -36,9 +36,11 @@ gdk_region_new (void)
GdkRegionPrivate *private;
GdkRegion *region;
HRGN xregion;
+ RECT emptyRect;
/* Create an empty region */
- xregion = CreateRectRgn (1, 1, 0, 0);
+ SetRectEmpty (&emptyRect);
+ xregion = CreateRectRgnIndirect (&emptyRect);
private = g_new (GdkRegionPrivate, 1);
private->xregion = xregion;
region = (GdkRegion*) private;
@@ -207,28 +209,40 @@ gdk_region_shrink (GdkRegion *region,
gint dy)
{
GdkRegionPrivate *private;
+ HRGN shrunken_bbox;
RECT r;
g_return_if_fail (region != NULL);
private = (GdkRegionPrivate *) region;
- /* Is it correct just to intersect it with a smaller bounding box? */
- GetRgnBox (private->xregion, &r);
-
- if (-dx > r.right - r.left)
+ if (dx > 0 || dy > 0)
{
- r.left += dx/2;
- r.right -= dx/2;
+ /* We want to shrink it in one or both dimensions.
+ * Is it correct just to intersect it with a smaller bounding box?
+ * XXX
+ */
+ GetRgnBox (private->xregion, &r);
+ if (dx > 0)
+ {
+ r.left += dx - dx/2;
+ r.right -= dx/2;
+ }
+ if (dy > 0)
+ {
+ r.top += dy - dy/2;
+ r.bottom -= dy/2;
+ }
+
+ shrunken_bbox = CreateRectRgnIndirect (&r);
+ CombineRgn (private->xregion, private->xregion,
+ shrunken_bbox, RGN_AND);
+ DeleteObject (shrunken_bbox);
}
- if (-dy > r.bottom - r.top)
+ else
{
- r.top += dy/2;
- r.bottom -= dy/2;
+ /* Do nothing if the regions is expanded? XXX */
}
-
- CombineRgn (private->xregion, private->xregion,
- CreateRectRgnIndirect (&r), RGN_AND);
}
GdkRegion*
@@ -239,6 +253,7 @@ gdk_region_union_with_rect (GdkRegion *region,
GdkRegion *res;
GdkRegionPrivate *res_private;
RECT xrect;
+ HRGN rectangle;
g_return_val_if_fail (region != NULL, NULL);
@@ -252,8 +267,10 @@ gdk_region_union_with_rect (GdkRegion *region,
res = gdk_region_new ();
res_private = (GdkRegionPrivate *) res;
+ rectangle = CreateRectRgnIndirect (&xrect);
CombineRgn (res_private->xregion, private->xregion,
- CreateRectRgnIndirect (&xrect), RGN_OR);
+ rectangle, RGN_OR);
+ DeleteObject (rectangle);
return res;
}