@@ -174,30 +174,6 @@ target_new(struct screen *screen)
174
174
return NULL ;
175
175
}
176
176
177
- static void
178
- update_pointer_focus (void )
179
- {
180
- struct compositor_view * view ;
181
- bool found = false;
182
- int32_t x = wl_fixed_to_int (swc .seat -> pointer -> x );
183
- int32_t y = wl_fixed_to_int (swc .seat -> pointer -> y );
184
- struct swc_rectangle * geom ;
185
-
186
- wl_list_for_each (view , & compositor .views , link ) {
187
- if (!view -> visible )
188
- continue ;
189
- geom = & view -> base .geometry ;
190
- if (rectangle_contains_point (geom , x , y )) {
191
- if (pixman_region32_contains_point (& view -> surface -> state .input , x - geom -> x , y - geom -> y , NULL )) {
192
- found = true;
193
- break ;
194
- }
195
- }
196
- }
197
-
198
- pointer_set_focus (swc .seat -> pointer , found ? view : NULL );
199
- }
200
-
201
177
/* Rendering {{{ */
202
178
203
179
static void
@@ -403,7 +379,6 @@ attach(struct view *base, struct wld_buffer *buffer)
403
379
view_update_screens (& view -> base );
404
380
damage_below_view (view );
405
381
update (& view -> base );
406
- update_pointer_focus ();
407
382
}
408
383
}
409
384
@@ -431,7 +406,6 @@ move(struct view *base, int32_t x, int32_t y)
431
406
view_update_screens (& view -> base );
432
407
damage_below_view (view );
433
408
update (& view -> base );
434
- update_pointer_focus ();
435
409
}
436
410
}
437
411
@@ -525,8 +499,6 @@ compositor_view_show(struct compositor_view *view)
525
499
if (other -> parent == view )
526
500
compositor_view_show (other );
527
501
}
528
-
529
- update_pointer_focus ();
530
502
}
531
503
532
504
void
@@ -548,8 +520,6 @@ compositor_view_hide(struct compositor_view *view)
548
520
if (other -> parent == view )
549
521
compositor_view_hide (other );
550
522
}
551
-
552
- update_pointer_focus ();
553
523
}
554
524
555
525
void
@@ -714,9 +684,29 @@ perform_update(void *data)
714
684
bool
715
685
handle_motion (struct pointer_handler * handler , uint32_t time , wl_fixed_t fx , wl_fixed_t fy )
716
686
{
717
- /* Only change pointer focus if no buttons are pressed. */
718
- if (swc .seat -> pointer -> buttons .size == 0 )
719
- update_pointer_focus ();
687
+ struct compositor_view * view ;
688
+ bool found = false;
689
+ int32_t x = wl_fixed_to_int (fx ), y = wl_fixed_to_int (fy );
690
+ struct swc_rectangle * geom ;
691
+
692
+ /* If buttons are pressed, don't change pointer focus. */
693
+ if (swc .seat -> pointer -> buttons .size > 0 )
694
+ return false;
695
+
696
+ wl_list_for_each (view , & compositor .views , link ) {
697
+ if (!view -> visible )
698
+ continue ;
699
+ geom = & view -> base .geometry ;
700
+ if (rectangle_contains_point (geom , x , y )) {
701
+ if (pixman_region32_contains_point (& view -> surface -> state .input , x - geom -> x , y - geom -> y , NULL )) {
702
+ found = true;
703
+ break ;
704
+ }
705
+ }
706
+ }
707
+
708
+ pointer_set_focus (swc .seat -> pointer , found ? view : NULL );
709
+
720
710
return false;
721
711
}
722
712
0 commit comments