use _gdk_region_get_xrectangles()
2001-03-02 Havoc Pennington <hp@redhat.com> * gdk/x11/gdkgc-x11.c (_gdk_x11_gc_flush): use _gdk_region_get_xrectangles() * gdk/x11/gdkmain-x11.c (_gdk_region_get_xrectangles): new function * gtk/testgtk.c (create_shapes): add test for shape_combine_region * gdk/x11/gdkwindow-x11.c (gdk_window_shape_combine_region): new function, contributed by Ron Steinke * gdk/x11/gdkevents-x11.c (gdk_wmspec_supported): rename gdk_net_wm_supports * gdk/gdkregion-generic.c (gdk_region_get_rectangles): New function, contributed by Ron Steinke * gtk/gtkentry.c (gtk_entry_get_layout_offsets): New function, used to line up the text in the entry when using the entry for editable sheet cell hacks * gtk/testgtk.c (create_entry): test the activate_default setting on GtkEntry * gtk/gtkentry.c (gtk_entry_set_activates_default): New function to cause the entry to activate the default button for a dialog when activated (gtk_entry_get_activates_default): new function
This commit is contained in:
committed by
Havoc Pennington
parent
b0052ec843
commit
8860615d9a
@ -53,6 +53,7 @@
|
||||
|
||||
#include "gdkprivate-x11.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkregion-generic.h"
|
||||
#include "gdkinputprivate.h"
|
||||
|
||||
#include <pango/pangox.h>
|
||||
@ -737,3 +738,26 @@ gdk_send_xevent (Window window, gboolean propagate, glong event_mask,
|
||||
|
||||
return result && !gdk_error_code;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_region_get_xrectangles (GdkRegion *region,
|
||||
gint x_offset,
|
||||
gint y_offset,
|
||||
XRectangle **rects,
|
||||
gint *n_rects)
|
||||
{
|
||||
XRectangle *rectangles = g_new (XRectangle, region->numRects);
|
||||
GdkRegionBox *boxes = region->rects;
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < region->numRects; i++)
|
||||
{
|
||||
rectangles[i].x = CLAMP (boxes[i].x1 + x_offset, G_MINSHORT, G_MAXSHORT);
|
||||
rectangles[i].y = CLAMP (boxes[i].y1 + y_offset, G_MINSHORT, G_MAXSHORT);
|
||||
rectangles[i].width = CLAMP (boxes[i].x2 + x_offset, G_MINSHORT, G_MAXSHORT) - rectangles[i].x;
|
||||
rectangles[i].height = CLAMP (boxes[i].y2 + y_offset, G_MINSHORT, G_MAXSHORT) - rectangles[i].y;
|
||||
}
|
||||
|
||||
*rects = rectangles;
|
||||
*n_rects = region->numRects;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user