commit 5b20050

Michael Forney  ·  2017-06-28 04:51:56 +0000 UTC
parent bc1c4f5
Revert "Update pointer focus on surface resize, move, show, and hide"

This reverts commit 0013242c02a32f880bed4a84867903db30121152.

This causes problems because mod-Return in velox causes the windows to
move around, and we don't want to change focus in this case. I'll need
to think of another solution.
1 files changed,  +23, -33
+23, -33
 1@@ -174,30 +174,6 @@ error0:
 2 	return NULL;
 3 }
 4 
 5-static void
 6-update_pointer_focus(void)
 7-{
 8-	struct compositor_view *view;
 9-	bool found = false;
10-	int32_t x = wl_fixed_to_int(swc.seat->pointer->x);
11-	int32_t y = wl_fixed_to_int(swc.seat->pointer->y);
12-	struct swc_rectangle *geom;
13-
14-	wl_list_for_each (view, &compositor.views, link) {
15-		if (!view->visible)
16-			continue;
17-		geom = &view->base.geometry;
18-		if (rectangle_contains_point(geom, x, y)) {
19-			if (pixman_region32_contains_point(&view->surface->state.input, x - geom->x, y - geom->y, NULL)) {
20-				found = true;
21-				break;
22-			}
23-		}
24-	}
25-
26-	pointer_set_focus(swc.seat->pointer, found ? view : NULL);
27-}
28-
29 /* Rendering {{{ */
30 
31 static void
32@@ -403,7 +379,6 @@ attach(struct view *base, struct wld_buffer *buffer)
33 			view_update_screens(&view->base);
34 			damage_below_view(view);
35 			update(&view->base);
36-			update_pointer_focus();
37 		}
38 	}
39 
40@@ -431,7 +406,6 @@ move(struct view *base, int32_t x, int32_t y)
41 			view_update_screens(&view->base);
42 			damage_below_view(view);
43 			update(&view->base);
44-			update_pointer_focus();
45 		}
46 	}
47 
48@@ -525,8 +499,6 @@ compositor_view_show(struct compositor_view *view)
49 		if (other->parent == view)
50 			compositor_view_show(other);
51 	}
52-
53-	update_pointer_focus();
54 }
55 
56 void
57@@ -548,8 +520,6 @@ compositor_view_hide(struct compositor_view *view)
58 		if (other->parent == view)
59 			compositor_view_hide(other);
60 	}
61-
62-	update_pointer_focus();
63 }
64 
65 void
66@@ -714,9 +684,29 @@ perform_update(void *data)
67 bool
68 handle_motion(struct pointer_handler *handler, uint32_t time, wl_fixed_t fx, wl_fixed_t fy)
69 {
70-	/* Only change pointer focus if no buttons are pressed. */
71-	if (swc.seat->pointer->buttons.size == 0)
72-		update_pointer_focus();
73+	struct compositor_view *view;
74+	bool found = false;
75+	int32_t x = wl_fixed_to_int(fx), y = wl_fixed_to_int(fy);
76+	struct swc_rectangle *geom;
77+
78+	/* If buttons are pressed, don't change pointer focus. */
79+	if (swc.seat->pointer->buttons.size > 0)
80+		return false;
81+
82+	wl_list_for_each (view, &compositor.views, link) {
83+		if (!view->visible)
84+			continue;
85+		geom = &view->base.geometry;
86+		if (rectangle_contains_point(geom, x, y)) {
87+			if (pixman_region32_contains_point(&view->surface->state.input, x - geom->x, y - geom->y, NULL)) {
88+				found = true;
89+				break;
90+			}
91+		}
92+	}
93+
94+	pointer_set_focus(swc.seat->pointer, found ? view : NULL);
95+
96 	return false;
97 }
98