Added function to scroll contents of a window while keeping the window
Thu May 18 18:43:21 2000 Owen Taylor <otaylor@redhat.com> * gdk/gdkwindow.h gdk/x11/gdkgeometry-x11.c (gdk_window_scroll): Added function to scroll contents of a window while keeping the window constant. Works by XCopyArea or guffaw-scrolling depending on the details of how the window is set up. (guffaw-scrolling still needs to be filled in.)
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
Thu May 18 18:43:21 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/gdkwindow.h gdk/x11/gdkgeometry-x11.c (gdk_window_scroll):
|
||||
Added function to scroll contents of a window while keeping the
|
||||
window constant. Works by XCopyArea or guffaw-scrolling depending
|
||||
on the details of how the window is set up. (guffaw-scrolling
|
||||
still needs to be filled in.)
|
||||
|
||||
Wed May 17 22:36:53 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtktextiter.c gtk/gtkmain.c: Add a debug key for the text widget,
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
Thu May 18 18:43:21 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/gdkwindow.h gdk/x11/gdkgeometry-x11.c (gdk_window_scroll):
|
||||
Added function to scroll contents of a window while keeping the
|
||||
window constant. Works by XCopyArea or guffaw-scrolling depending
|
||||
on the details of how the window is set up. (guffaw-scrolling
|
||||
still needs to be filled in.)
|
||||
|
||||
Wed May 17 22:36:53 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtktextiter.c gtk/gtkmain.c: Add a debug key for the text widget,
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
Thu May 18 18:43:21 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/gdkwindow.h gdk/x11/gdkgeometry-x11.c (gdk_window_scroll):
|
||||
Added function to scroll contents of a window while keeping the
|
||||
window constant. Works by XCopyArea or guffaw-scrolling depending
|
||||
on the details of how the window is set up. (guffaw-scrolling
|
||||
still needs to be filled in.)
|
||||
|
||||
Wed May 17 22:36:53 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtktextiter.c gtk/gtkmain.c: Add a debug key for the text widget,
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
Thu May 18 18:43:21 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/gdkwindow.h gdk/x11/gdkgeometry-x11.c (gdk_window_scroll):
|
||||
Added function to scroll contents of a window while keeping the
|
||||
window constant. Works by XCopyArea or guffaw-scrolling depending
|
||||
on the details of how the window is set up. (guffaw-scrolling
|
||||
still needs to be filled in.)
|
||||
|
||||
Wed May 17 22:36:53 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtktextiter.c gtk/gtkmain.c: Add a debug key for the text widget,
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
Thu May 18 18:43:21 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/gdkwindow.h gdk/x11/gdkgeometry-x11.c (gdk_window_scroll):
|
||||
Added function to scroll contents of a window while keeping the
|
||||
window constant. Works by XCopyArea or guffaw-scrolling depending
|
||||
on the details of how the window is set up. (guffaw-scrolling
|
||||
still needs to be filled in.)
|
||||
|
||||
Wed May 17 22:36:53 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtktextiter.c gtk/gtkmain.c: Add a debug key for the text widget,
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
Thu May 18 18:43:21 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/gdkwindow.h gdk/x11/gdkgeometry-x11.c (gdk_window_scroll):
|
||||
Added function to scroll contents of a window while keeping the
|
||||
window constant. Works by XCopyArea or guffaw-scrolling depending
|
||||
on the details of how the window is set up. (guffaw-scrolling
|
||||
still needs to be filled in.)
|
||||
|
||||
Wed May 17 22:36:53 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtktextiter.c gtk/gtkmain.c: Add a debug key for the text widget,
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
Thu May 18 18:43:21 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/gdkwindow.h gdk/x11/gdkgeometry-x11.c (gdk_window_scroll):
|
||||
Added function to scroll contents of a window while keeping the
|
||||
window constant. Works by XCopyArea or guffaw-scrolling depending
|
||||
on the details of how the window is set up. (guffaw-scrolling
|
||||
still needs to be filled in.)
|
||||
|
||||
Wed May 17 22:36:53 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtktextiter.c gtk/gtkmain.c: Add a debug key for the text widget,
|
||||
|
||||
101
gdk/gdkwindow.h
101
gdk/gdkwindow.h
@@ -120,57 +120,56 @@ struct _GdkGeometry {
|
||||
|
||||
/* Windows
|
||||
*/
|
||||
GdkWindow* gdk_window_new (GdkWindow *parent,
|
||||
GdkWindowAttr *attributes,
|
||||
gint attributes_mask);
|
||||
|
||||
void gdk_window_destroy (GdkWindow *window);
|
||||
|
||||
GdkWindow* gdk_window_at_pointer (gint *win_x,
|
||||
gint *win_y);
|
||||
void gdk_window_show (GdkWindow *window);
|
||||
void gdk_window_hide (GdkWindow *window);
|
||||
void gdk_window_withdraw (GdkWindow *window);
|
||||
void gdk_window_move (GdkWindow *window,
|
||||
gint x,
|
||||
gint y);
|
||||
void gdk_window_resize (GdkWindow *window,
|
||||
gint width,
|
||||
gint height);
|
||||
void gdk_window_move_resize (GdkWindow *window,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
void gdk_window_reparent (GdkWindow *window,
|
||||
GdkWindow *new_parent,
|
||||
gint x,
|
||||
gint y);
|
||||
void gdk_window_clear (GdkWindow *window);
|
||||
void gdk_window_clear_area (GdkWindow *window,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
void gdk_window_clear_area_e(GdkWindow *window,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
void gdk_window_raise (GdkWindow *window);
|
||||
void gdk_window_lower (GdkWindow *window);
|
||||
|
||||
void gdk_window_set_user_data (GdkWindow *window,
|
||||
gpointer user_data);
|
||||
void gdk_window_set_override_redirect(GdkWindow *window,
|
||||
gboolean override_redirect);
|
||||
|
||||
void gdk_window_add_filter (GdkWindow *window,
|
||||
GdkFilterFunc function,
|
||||
gpointer data);
|
||||
void gdk_window_remove_filter (GdkWindow *window,
|
||||
GdkFilterFunc function,
|
||||
gpointer data);
|
||||
GdkWindow* gdk_window_new (GdkWindow *parent,
|
||||
GdkWindowAttr *attributes,
|
||||
gint attributes_mask);
|
||||
void gdk_window_destroy (GdkWindow *window);
|
||||
GdkWindow* gdk_window_at_pointer (gint *win_x,
|
||||
gint *win_y);
|
||||
void gdk_window_show (GdkWindow *window);
|
||||
void gdk_window_hide (GdkWindow *window);
|
||||
void gdk_window_withdraw (GdkWindow *window);
|
||||
void gdk_window_move (GdkWindow *window,
|
||||
gint x,
|
||||
gint y);
|
||||
void gdk_window_resize (GdkWindow *window,
|
||||
gint width,
|
||||
gint height);
|
||||
void gdk_window_move_resize (GdkWindow *window,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
void gdk_window_scroll (GdkWindow *window,
|
||||
gint dx,
|
||||
gint dy);
|
||||
void gdk_window_reparent (GdkWindow *window,
|
||||
GdkWindow *new_parent,
|
||||
gint x,
|
||||
gint y);
|
||||
void gdk_window_clear (GdkWindow *window);
|
||||
void gdk_window_clear_area (GdkWindow *window,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
void gdk_window_clear_area_e (GdkWindow *window,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
void gdk_window_raise (GdkWindow *window);
|
||||
void gdk_window_lower (GdkWindow *window);
|
||||
void gdk_window_set_user_data (GdkWindow *window,
|
||||
gpointer user_data);
|
||||
void gdk_window_set_override_redirect (GdkWindow *window,
|
||||
gboolean override_redirect);
|
||||
void gdk_window_add_filter (GdkWindow *window,
|
||||
GdkFilterFunc function,
|
||||
gpointer data);
|
||||
void gdk_window_remove_filter (GdkWindow *window,
|
||||
GdkFilterFunc function,
|
||||
gpointer data);
|
||||
|
||||
/*
|
||||
* This allows for making shaped (partially transparent) windows
|
||||
|
||||
@@ -110,6 +110,113 @@ _gdk_window_init_position (GdkWindow *window)
|
||||
gdk_window_compute_position (window, &parent_pos, &data->position_info);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_window_scroll:
|
||||
* @window: a #GdkWindow
|
||||
* @dx: Amount to scroll in the X direction
|
||||
* @dy: Amount to scroll in the Y direction
|
||||
*
|
||||
* Scroll the contents of its window, both pixels and children, by
|
||||
* the given amount. Portions of the window that the scroll operation
|
||||
* brings in from offscreen areas are invalidated. The invalidated
|
||||
* region may be bigger than what would strictly be necessary.
|
||||
* (For X11, a minimum area will be invalidated if the window has
|
||||
* no subwindows, or if the edges of the window's parent do not extend
|
||||
* beyond the edges of the window. In other cases, a multi-step process
|
||||
* is used to scroll the window which may produce temporary visual
|
||||
* artifacts and unnecessary invalidations.)
|
||||
**/
|
||||
void
|
||||
gdk_window_scroll (GdkWindow *window,
|
||||
gint dx,
|
||||
gint dy)
|
||||
{
|
||||
GdkWindowPrivate *private = (GdkWindowPrivate *)window;
|
||||
gboolean can_guffaw_scroll = FALSE;
|
||||
GdkWindowXData *data;
|
||||
|
||||
g_return_if_fail (window != NULL);
|
||||
g_return_if_fail (GDK_IS_WINDOW (window));
|
||||
|
||||
data = (GdkWindowXData *)private->drawable.klass_data;
|
||||
|
||||
/* We can guffaw scroll if we are a child window, and the parent
|
||||
* does not extend beyond our edges.
|
||||
*/
|
||||
|
||||
if (GDK_DRAWABLE_TYPE (private) == GDK_WINDOW_CHILD)
|
||||
{
|
||||
GdkWindowPrivate *parent_private = (GdkWindowPrivate *)private->parent;
|
||||
|
||||
can_guffaw_scroll = (private->x <= 0 &&
|
||||
private->y <= 0 &&
|
||||
private->x + private->drawable.width >= parent_private->drawable.width &&
|
||||
private->y + private->drawable.height >= parent_private->drawable.height);
|
||||
}
|
||||
|
||||
if (!private->children || !can_guffaw_scroll)
|
||||
{
|
||||
/* Use XCopyArea, then move any children later
|
||||
*/
|
||||
GList *tmp_list;
|
||||
GdkRegion *invalidate_region;
|
||||
GdkRectangle dest_rect;
|
||||
|
||||
invalidate_region = gdk_region_rectangle (&data->position_info.clip_rect);
|
||||
|
||||
dest_rect = data->position_info.clip_rect;
|
||||
dest_rect.x += dx;
|
||||
dest_rect.y += dy;
|
||||
gdk_rectangle_intersect (&dest_rect, &data->position_info.clip_rect, &dest_rect);
|
||||
|
||||
if (dest_rect.width > 0 && dest_rect.height > 0)
|
||||
{
|
||||
GC gc;
|
||||
XGCValues values;
|
||||
GdkRegion *tmp_region;
|
||||
|
||||
tmp_region = gdk_region_rectangle (&dest_rect);
|
||||
gdk_region_subtract (invalidate_region, tmp_region);
|
||||
gdk_region_destroy (tmp_region);
|
||||
|
||||
gdk_window_queue_translation (window, dx, dy);
|
||||
|
||||
values.graphics_exposures = True;
|
||||
gc = XCreateGC (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window),
|
||||
GCGraphicsExposures, &values);
|
||||
|
||||
XCopyArea (GDK_DRAWABLE_XDISPLAY (window),
|
||||
GDK_DRAWABLE_XID (window),
|
||||
GDK_DRAWABLE_XID (window),
|
||||
gc,
|
||||
dest_rect.x - dx, dest_rect.y - dy,
|
||||
dest_rect.width, dest_rect.height,
|
||||
dest_rect.x, dest_rect.y);
|
||||
|
||||
XFreeGC (GDK_DRAWABLE_XDISPLAY (window), gc);
|
||||
}
|
||||
|
||||
gdk_window_invalidate_region (window, invalidate_region, TRUE);
|
||||
gdk_region_destroy (invalidate_region);
|
||||
|
||||
tmp_list = private->children;
|
||||
while (tmp_list)
|
||||
{
|
||||
private = tmp_list->data;
|
||||
|
||||
gdk_window_move (tmp_list->data, private->x + dx, private->y + dy);
|
||||
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Guffaw scroll
|
||||
*/
|
||||
g_warning ("gdk_window_scroll(): guffaw scrolling not yet implemented");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_window_move_resize_child (GdkWindow *window,
|
||||
gint x,
|
||||
|
||||
Reference in New Issue
Block a user