[libgd/wip/ernestask/gtk4: 10/22] main-list-view: set up a clip region
- From: Ernestas Kulik <ernestask src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgd/wip/ernestask/gtk4: 10/22] main-list-view: set up a clip region
- Date: Sun, 11 Mar 2018 08:32:16 +0000 (UTC)
commit b1b529bfab218daf80d9e0dbd6bcb81faa94b4ee
Author: Ernestas Kulik <ernestask gnome org>
Date: Sat Mar 10 13:05:58 2018 +0200
main-list-view: set up a clip region
Otherwise we draw the rubberband effect outside the window.
libgd/gd-main-list-view.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/libgd/gd-main-list-view.c b/libgd/gd-main-list-view.c
index 63539af..d5f49f9 100644
--- a/libgd/gd-main-list-view.c
+++ b/libgd/gd-main-list-view.c
@@ -260,6 +260,11 @@ gd_main_list_view_snapshot (GtkWidget *widget,
if (rubberband_start)
{
+ GtkAllocation allocation;
+ GtkAdjustment *hadjustment;
+ GtkAdjustment *vadjustment;
+ graphene_rect_t bounds;
+
context = gtk_widget_get_style_context (widget);
gtk_style_context_save (context);
@@ -282,6 +287,19 @@ gd_main_list_view_snapshot (GtkWidget *widget,
}
gtk_tree_path_free (path);
+ gtk_widget_get_allocation (widget, &allocation);
+
+ hadjustment = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (widget));
+ vadjustment = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (widget));
+ bounds = GRAPHENE_RECT_INIT (0, 0,
+ allocation.width + gtk_adjustment_get_value (hadjustment),
+ allocation.height + gtk_adjustment_get_value (vadjustment));
+
+ gtk_snapshot_push_clip (snapshot, &bounds, "GdMainListView Rubberband Clip");
+ gtk_snapshot_offset (snapshot,
+ -gtk_adjustment_get_value (hadjustment),
+ -gtk_adjustment_get_value (vadjustment));
+
gtk_snapshot_render_background (snapshot, context,
lines_rect.x, lines_rect.y,
lines_rect.width, lines_rect.height);
@@ -289,6 +307,7 @@ gd_main_list_view_snapshot (GtkWidget *widget,
lines_rect.x, lines_rect.y,
lines_rect.width, lines_rect.height);
+ gtk_snapshot_pop (snapshot);
gtk_style_context_restore (context);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]