[libhandy] stackable-box: Fix touchpad swipes when leaflet is not at 0, 0
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libhandy] stackable-box: Fix touchpad swipes when leaflet is not at 0, 0
- Date: Thu, 11 Mar 2021 12:04:23 +0000 (UTC)
commit 24d98b9e68a5f41d11136ea17e5aeea52e8b72d2
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Thu Mar 11 15:52:19 2021 +0500
stackable-box: Fix touchpad swipes when leaflet is not at 0,0
Tweak the window configuration until it works.
src/hdy-deck.c | 14 --------------
src/hdy-leaflet.c | 14 --------------
src/hdy-stackable-box-private.h | 2 --
src/hdy-stackable-box.c | 36 +++++++-----------------------------
4 files changed, 7 insertions(+), 59 deletions(-)
---
diff --git a/src/hdy-deck.c b/src/hdy-deck.c
index 40e35378..04550c99 100644
--- a/src/hdy-deck.c
+++ b/src/hdy-deck.c
@@ -857,18 +857,6 @@ hdy_deck_unrealize (GtkWidget *widget)
hdy_stackable_box_unrealize (HDY_GET_HELPER (widget));
}
-static void
-hdy_deck_map (GtkWidget *widget)
-{
- hdy_stackable_box_map (HDY_GET_HELPER (widget));
-}
-
-static void
-hdy_deck_unmap (GtkWidget *widget)
-{
- hdy_stackable_box_unmap (HDY_GET_HELPER (widget));
-}
-
static void
hdy_deck_switch_child (HdySwipeable *swipeable,
guint index,
@@ -930,8 +918,6 @@ hdy_deck_class_init (HdyDeckClass *klass)
widget_class->realize = hdy_deck_realize;
widget_class->unrealize = hdy_deck_unrealize;
- widget_class->map = hdy_deck_map;
- widget_class->unmap = hdy_deck_unmap;
widget_class->get_preferred_width = hdy_deck_get_preferred_width;
widget_class->get_preferred_height = hdy_deck_get_preferred_height;
widget_class->get_preferred_width_for_height = hdy_deck_get_preferred_width_for_height;
diff --git a/src/hdy-leaflet.c b/src/hdy-leaflet.c
index 0954c7c5..6d09a213 100644
--- a/src/hdy-leaflet.c
+++ b/src/hdy-leaflet.c
@@ -931,18 +931,6 @@ hdy_leaflet_unrealize (GtkWidget *widget)
hdy_stackable_box_unrealize (HDY_GET_HELPER (widget));
}
-static void
-hdy_leaflet_map (GtkWidget *widget)
-{
- hdy_stackable_box_map (HDY_GET_HELPER (widget));
-}
-
-static void
-hdy_leaflet_unmap (GtkWidget *widget)
-{
- hdy_stackable_box_unmap (HDY_GET_HELPER (widget));
-}
-
static void
hdy_leaflet_switch_child (HdySwipeable *swipeable,
guint index,
@@ -1004,8 +992,6 @@ hdy_leaflet_class_init (HdyLeafletClass *klass)
widget_class->realize = hdy_leaflet_realize;
widget_class->unrealize = hdy_leaflet_unrealize;
- widget_class->map = hdy_leaflet_map;
- widget_class->unmap = hdy_leaflet_unmap;
widget_class->get_preferred_width = hdy_leaflet_get_preferred_width;
widget_class->get_preferred_height = hdy_leaflet_get_preferred_height;
widget_class->get_preferred_width_for_height = hdy_leaflet_get_preferred_width_for_height;
diff --git a/src/hdy-stackable-box-private.h b/src/hdy-stackable-box-private.h
index 9c7a5009..f0072081 100644
--- a/src/hdy-stackable-box-private.h
+++ b/src/hdy-stackable-box-private.h
@@ -125,8 +125,6 @@ gboolean hdy_stackable_box_draw (HdyStackableBox *self,
cairo_t *cr);
void hdy_stackable_box_realize (HdyStackableBox *self);
void hdy_stackable_box_unrealize (HdyStackableBox *self);
-void hdy_stackable_box_map (HdyStackableBox *self);
-void hdy_stackable_box_unmap (HdyStackableBox *self);
void hdy_stackable_box_direction_changed (HdyStackableBox *self,
GtkTextDirection previous_direction);
void hdy_stackable_box_prepend (HdyStackableBox *self,
diff --git a/src/hdy-stackable-box.c b/src/hdy-stackable-box.c
index 03debe6a..3971ff5c 100644
--- a/src/hdy-stackable-box.c
+++ b/src/hdy-stackable-box.c
@@ -109,8 +109,6 @@ struct _HdyStackableBox
HdyStackableBoxChildInfo *visible_child;
HdyStackableBoxChildInfo *last_visible_child;
- GdkWindow* view_window;
-
gboolean folded;
gboolean homogeneous[HDY_FOLD_MAX][GTK_ORIENTATION_MAX];
@@ -1955,7 +1953,7 @@ hdy_stackable_box_size_allocate (HdyStackableBox *self,
gtk_widget_set_allocation (widget, allocation);
if (gtk_widget_get_realized (widget)) {
- gdk_window_move_resize (self->view_window,
+ gdk_window_move_resize (gtk_widget_get_window (widget),
allocation->x, allocation->y,
allocation->width, allocation->height);
}
@@ -2258,7 +2256,7 @@ register_window (HdyStackableBox *self,
attributes.event_mask = gtk_widget_get_events (widget) |
gtk_widget_get_events (child->widget);
- child->window = gdk_window_new (self->view_window, &attributes, attributes_mask);
+ child->window = gdk_window_new (gtk_widget_get_window (widget), &attributes, attributes_mask);
gtk_widget_register_window (widget, child->window);
gtk_widget_set_parent_window (child->widget, child->window);
@@ -2483,9 +2481,9 @@ hdy_stackable_box_realize (HdyStackableBox *self)
GdkWindowAttr attributes = { 0 };
GdkWindowAttributesType attributes_mask;
GList *children;
+ GdkWindow *window;
gtk_widget_set_realized (widget, TRUE);
- gtk_widget_set_window (widget, g_object_ref (gtk_widget_get_parent_window (widget)));
gtk_widget_get_allocation (widget, &allocation);
@@ -2499,9 +2497,10 @@ hdy_stackable_box_realize (HdyStackableBox *self)
attributes.event_mask = gtk_widget_get_events (widget);
attributes_mask = (GDK_WA_X | GDK_WA_Y) | GDK_WA_VISUAL;
- self->view_window = gdk_window_new (gtk_widget_get_window (widget),
- &attributes, attributes_mask);
- gtk_widget_register_window (widget, self->view_window);
+ window = gdk_window_new (gtk_widget_get_parent_window (widget),
+ &attributes, attributes_mask);
+ gtk_widget_set_window (widget, window);
+ gtk_widget_register_window (widget, window);
for (children = self->children; children != NULL; children = children->next)
register_window (self, children->data);
@@ -2516,29 +2515,9 @@ hdy_stackable_box_unrealize (HdyStackableBox *self)
for (children = self->children; children != NULL; children = children->next)
unregister_window (self, children->data);
- gtk_widget_unregister_window (widget, self->view_window);
- gdk_window_destroy (self->view_window);
- self->view_window = NULL;
-
GTK_WIDGET_CLASS (self->klass)->unrealize (widget);
}
-void
-hdy_stackable_box_map (HdyStackableBox *self)
-{
- GTK_WIDGET_CLASS (self->klass)->map (GTK_WIDGET (self->container));
-
- gdk_window_show (self->view_window);
-}
-
-void
-hdy_stackable_box_unmap (HdyStackableBox *self)
-{
- gdk_window_hide (self->view_window);
-
- GTK_WIDGET_CLASS (self->klass)->unmap (GTK_WIDGET (self->container));
-}
-
HdySwipeTracker *
hdy_stackable_box_get_swipe_tracker (HdyStackableBox *self)
{
@@ -3244,7 +3223,6 @@ hdy_stackable_box_new (GtkContainer *container,
self->shadow_helper = hdy_shadow_helper_new (widget);
- gtk_widget_set_has_window (widget, FALSE);
gtk_widget_set_can_focus (widget, FALSE);
gtk_widget_set_redraw_on_allocate (widget, FALSE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]