Add a function gdk_window_get_internal_paint_info(), so that using X
Fri Jul 13 15:33:32 2001 Owen Taylor <otaylor@redhat.com> * gdk/gdkwindow.[ch]: Add a function gdk_window_get_internal_paint_info(), so that using X functions on a GdkWindow is possible, if a little hairy. * gdk/gdkgc.c (gdk_gc_offset): Add a function to offset the clip and ts_origin of a GC, so that external parties can offset/restore a GC, when using gdk_window_get_internal_paint_info().
This commit is contained in:
parent
0349676329
commit
94239d144e
11 changed files with 164 additions and 0 deletions
10
ChangeLog
10
ChangeLog
|
|
@ -1,3 +1,13 @@
|
|||
Fri Jul 13 15:33:32 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/gdkwindow.[ch]: Add a function gdk_window_get_internal_paint_info(),
|
||||
so that using X functions on a GdkWindow is possible, if
|
||||
a little hairy.
|
||||
|
||||
* gdk/gdkgc.c (gdk_gc_offset): Add a function to offset the clip
|
||||
and ts_origin of a GC, so that external parties can offset/restore
|
||||
a GC, when using gdk_window_get_internal_paint_info().
|
||||
|
||||
2001-07-17 Darin Adler <darin@bentspoon.com>
|
||||
|
||||
* .cvsignore: Ignore the sgml directory made by gtkdoc.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,13 @@
|
|||
Fri Jul 13 15:33:32 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/gdkwindow.[ch]: Add a function gdk_window_get_internal_paint_info(),
|
||||
so that using X functions on a GdkWindow is possible, if
|
||||
a little hairy.
|
||||
|
||||
* gdk/gdkgc.c (gdk_gc_offset): Add a function to offset the clip
|
||||
and ts_origin of a GC, so that external parties can offset/restore
|
||||
a GC, when using gdk_window_get_internal_paint_info().
|
||||
|
||||
2001-07-17 Darin Adler <darin@bentspoon.com>
|
||||
|
||||
* .cvsignore: Ignore the sgml directory made by gtkdoc.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,13 @@
|
|||
Fri Jul 13 15:33:32 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/gdkwindow.[ch]: Add a function gdk_window_get_internal_paint_info(),
|
||||
so that using X functions on a GdkWindow is possible, if
|
||||
a little hairy.
|
||||
|
||||
* gdk/gdkgc.c (gdk_gc_offset): Add a function to offset the clip
|
||||
and ts_origin of a GC, so that external parties can offset/restore
|
||||
a GC, when using gdk_window_get_internal_paint_info().
|
||||
|
||||
2001-07-17 Darin Adler <darin@bentspoon.com>
|
||||
|
||||
* .cvsignore: Ignore the sgml directory made by gtkdoc.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,13 @@
|
|||
Fri Jul 13 15:33:32 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/gdkwindow.[ch]: Add a function gdk_window_get_internal_paint_info(),
|
||||
so that using X functions on a GdkWindow is possible, if
|
||||
a little hairy.
|
||||
|
||||
* gdk/gdkgc.c (gdk_gc_offset): Add a function to offset the clip
|
||||
and ts_origin of a GC, so that external parties can offset/restore
|
||||
a GC, when using gdk_window_get_internal_paint_info().
|
||||
|
||||
2001-07-17 Darin Adler <darin@bentspoon.com>
|
||||
|
||||
* .cvsignore: Ignore the sgml directory made by gtkdoc.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,13 @@
|
|||
Fri Jul 13 15:33:32 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/gdkwindow.[ch]: Add a function gdk_window_get_internal_paint_info(),
|
||||
so that using X functions on a GdkWindow is possible, if
|
||||
a little hairy.
|
||||
|
||||
* gdk/gdkgc.c (gdk_gc_offset): Add a function to offset the clip
|
||||
and ts_origin of a GC, so that external parties can offset/restore
|
||||
a GC, when using gdk_window_get_internal_paint_info().
|
||||
|
||||
2001-07-17 Darin Adler <darin@bentspoon.com>
|
||||
|
||||
* .cvsignore: Ignore the sgml directory made by gtkdoc.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,13 @@
|
|||
Fri Jul 13 15:33:32 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/gdkwindow.[ch]: Add a function gdk_window_get_internal_paint_info(),
|
||||
so that using X functions on a GdkWindow is possible, if
|
||||
a little hairy.
|
||||
|
||||
* gdk/gdkgc.c (gdk_gc_offset): Add a function to offset the clip
|
||||
and ts_origin of a GC, so that external parties can offset/restore
|
||||
a GC, when using gdk_window_get_internal_paint_info().
|
||||
|
||||
2001-07-17 Darin Adler <darin@bentspoon.com>
|
||||
|
||||
* .cvsignore: Ignore the sgml directory made by gtkdoc.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,13 @@
|
|||
Fri Jul 13 15:33:32 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/gdkwindow.[ch]: Add a function gdk_window_get_internal_paint_info(),
|
||||
so that using X functions on a GdkWindow is possible, if
|
||||
a little hairy.
|
||||
|
||||
* gdk/gdkgc.c (gdk_gc_offset): Add a function to offset the clip
|
||||
and ts_origin of a GC, so that external parties can offset/restore
|
||||
a GC, when using gdk_window_get_internal_paint_info().
|
||||
|
||||
2001-07-17 Darin Adler <darin@bentspoon.com>
|
||||
|
||||
* .cvsignore: Ignore the sgml directory made by gtkdoc.
|
||||
|
|
|
|||
33
gdk/gdkgc.c
33
gdk/gdkgc.c
|
|
@ -366,6 +366,39 @@ gdk_gc_set_dashes (GdkGC *gc,
|
|||
GDK_GC_GET_CLASS (gc)->set_dashes (gc, dash_offset, dash_list, n);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gc_offset:
|
||||
* @gc: a #GdkGC
|
||||
* @x_offset: amount by which to offset the GC in the X direction
|
||||
* @y_offset: amount by which to offset the GC in the Y direction
|
||||
*
|
||||
* Offset attributes such as the clip and tile-stipple origins
|
||||
* of the GC so that drawing at x - x_offset, y - y_offset with
|
||||
* the offset GC has the same effect as drawing at x, y with the original
|
||||
* GC.
|
||||
**/
|
||||
void
|
||||
gdk_gc_offset (GdkGC *gc,
|
||||
gint x_offset,
|
||||
gint y_offset)
|
||||
{
|
||||
if (x_offset != 0 || y_offset != 0)
|
||||
{
|
||||
GdkGCValues values;
|
||||
|
||||
values.clip_x_origin = gc->clip_x_origin - x_offset;
|
||||
values.clip_y_origin = gc->clip_y_origin - y_offset;
|
||||
values.ts_x_origin = gc->ts_x_origin - x_offset;
|
||||
values.ts_y_origin = gc->ts_y_origin - y_offset;
|
||||
|
||||
gdk_gc_set_values (gc, &values,
|
||||
GDK_GC_CLIP_X_ORIGIN |
|
||||
GDK_GC_CLIP_Y_ORIGIN |
|
||||
GDK_GC_TS_X_ORIGIN |
|
||||
GDK_GC_TS_Y_ORIGIN);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gc_set_colormap:
|
||||
* @gc: a #GdkGC
|
||||
|
|
|
|||
|
|
@ -237,6 +237,9 @@ void gdk_gc_set_dashes (GdkGC *gc,
|
|||
gint dash_offset,
|
||||
gint8 dash_list[],
|
||||
gint n);
|
||||
void gdk_gc_offset (GdkGC *gc,
|
||||
gint x_offset,
|
||||
gint y_offset);
|
||||
void gdk_gc_copy (GdkGC *dst_gc,
|
||||
GdkGC *src_gc);
|
||||
|
||||
|
|
|
|||
|
|
@ -979,6 +979,59 @@ gdk_window_get_offsets (GdkWindow *window,
|
|||
_gdk_windowing_window_get_offsets (window, x_offset, y_offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_window_get_internal_paint_info:
|
||||
* @window: a #GdkWindow
|
||||
* @real_drawable: location to store the drawable to which drawing should be done.
|
||||
* @x_offset: location to store the X offset between coordinates in @window, and
|
||||
* the underlying window system primitive coordinates for *@real_drawable.
|
||||
* @y_offset: location to store the Y offset between coordinates in @window, and
|
||||
* the underlying window system primitive coordinates for *@real_drawable.
|
||||
*
|
||||
* If you bypass the GDK layer and use windowing system primitives to
|
||||
* draw directly onto a #GdkWindow, then you need to deal with two
|
||||
* details: there may be an offset between GDK coordinates and windowing
|
||||
* system coordinates, and GDK may have redirected drawing to a offscreen
|
||||
* pixmap as the result of a gdk_window_begin_paint_region() calls.
|
||||
* This function allows retrieving the information you need to compensate
|
||||
* for these effects.
|
||||
*
|
||||
* This function exposes details of the GDK implementation, and is thus
|
||||
* likely to change in future releases of GDK.
|
||||
**/
|
||||
void
|
||||
gdk_window_get_internal_paint_info (GdkWindow *window,
|
||||
GdkDrawable **real_drawable,
|
||||
gint *x_offset,
|
||||
gint *y_offset)
|
||||
{
|
||||
gint x_off, y_off;
|
||||
|
||||
GdkWindowObject *private;
|
||||
|
||||
g_return_if_fail (GDK_IS_WINDOW (window));
|
||||
|
||||
private = (GdkWindowObject *)window;
|
||||
|
||||
if (real_drawable)
|
||||
{
|
||||
if (private->paint_stack)
|
||||
{
|
||||
GdkWindowPaint *paint = private->paint_stack->data;
|
||||
*real_drawable = paint->pixmap;
|
||||
}
|
||||
else
|
||||
*real_drawable = window;
|
||||
}
|
||||
|
||||
gdk_window_get_offsets (window, &x_off, &y_off);
|
||||
|
||||
if (x_offset)
|
||||
*x_offset = x_off;
|
||||
if (y_offset)
|
||||
*y_offset = y_off;
|
||||
}
|
||||
|
||||
#define OFFSET_GC(gc) \
|
||||
gint x_offset, y_offset; \
|
||||
gint old_clip_x = gc->clip_x_origin; \
|
||||
|
|
|
|||
|
|
@ -507,6 +507,11 @@ void gdk_window_constrain_size (GdkGeometry *geometry,
|
|||
gint *new_width,
|
||||
gint *new_height);
|
||||
|
||||
void gdk_window_get_internal_paint_info (GdkWindow *window,
|
||||
GdkDrawable **real_drawable,
|
||||
gint *x_offset,
|
||||
gint *y_offset);
|
||||
|
||||
GdkPointerHooks *gdk_set_pointer_hooks (const GdkPointerHooks *new_hooks);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
Loading…
Reference in a new issue