summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2000-05-18 22:44:31 +0000
committerOwen Taylor <otaylor@src.gnome.org>2000-05-18 22:44:31 +0000
commit5d2600cb0debbf32601e20767760db9482808dd7 (patch)
treedb57a62dea7c3d3bfee8a312049c6f58acb9bb6a
parent723247ca478739506bf5793de548c5941dfdc62a (diff)
downloadgtk+-5d2600cb0debbf32601e20767760db9482808dd7.tar.gz
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.)
-rw-r--r--ChangeLog8
-rw-r--r--ChangeLog.pre-2-08
-rw-r--r--ChangeLog.pre-2-108
-rw-r--r--ChangeLog.pre-2-28
-rw-r--r--ChangeLog.pre-2-48
-rw-r--r--ChangeLog.pre-2-68
-rw-r--r--ChangeLog.pre-2-88
-rw-r--r--gdk/gdkwindow.h101
-rw-r--r--gdk/x11/gdkgeometry-x11.c107
9 files changed, 213 insertions, 51 deletions
diff --git a/ChangeLog b/ChangeLog
index f07f72fa59..1f34fdd31f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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,
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index f07f72fa59..1f34fdd31f 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -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,
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index f07f72fa59..1f34fdd31f 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -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,
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index f07f72fa59..1f34fdd31f 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -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,
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index f07f72fa59..1f34fdd31f 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -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,
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index f07f72fa59..1f34fdd31f 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -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,
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index f07f72fa59..1f34fdd31f 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -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,
diff --git a/gdk/gdkwindow.h b/gdk/gdkwindow.h
index 41087d2cc1..08e3535d15 100644
--- a/gdk/gdkwindow.h
+++ b/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
diff --git a/gdk/x11/gdkgeometry-x11.c b/gdk/x11/gdkgeometry-x11.c
index 40855e8abb..69c0254e0e 100644
--- a/gdk/x11/gdkgeometry-x11.c
+++ b/gdk/x11/gdkgeometry-x11.c
@@ -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,