]> git.mdlowis.com Git - proto/labwc.git/commitdiff
HiDPI: send output_enter events to views when they open
authorARDiDo <90479315+ARDiDo@users.noreply.github.com>
Sat, 13 Nov 2021 17:32:01 +0000 (12:32 -0500)
committerARDiDo <90479315+ARDiDo@users.noreply.github.com>
Wed, 24 Nov 2021 22:33:10 +0000 (17:33 -0500)
include/labwc.h
src/view.c
src/xdg.c
src/xwayland.c

index dfbf739308e93b2502dabcc5f37ab5dde2d07084..5946c495b7834324299c53739b66816cc20d9590 100644 (file)
@@ -376,6 +376,8 @@ void view_for_each_surface(struct view *view,
        wlr_surface_iterator_func_t iterator, void *user_data);
 void view_for_each_popup_surface(struct view *view,
        wlr_surface_iterator_func_t iterator, void *data);
+void view_output_enter(struct view *view, struct wlr_output *wlr_output);
+void view_output_leave(struct view *view, struct wlr_output *wlr_output);
 void view_move_to_edge(struct view *view, const char *direction);
 void view_snap_to_edge(struct view *view, const char *direction);
 const char *view_get_string_prop(struct view *view, const char *prop);
index 1e560e8e9ad5078b850c7b25ee443ca6f6440c05..fdbeb8426e56f3ff66e781dd3a381f1685b96827 100644 (file)
@@ -254,6 +254,44 @@ view_border(struct view *view)
        return border;
 }
 
+void
+surface_enter_for_each_surface(struct wlr_surface *surface, int sx, int sy,
+               void *user_data)
+{
+       struct wlr_output *wlr_output = user_data;
+       wlr_surface_send_enter(surface, wlr_output);
+}
+
+void
+surface_leave_for_each_surface(struct wlr_surface *surface, int sx, int sy,
+               void *user_data)
+{
+       struct wlr_output *wlr_output = user_data;
+       wlr_surface_send_leave(surface, wlr_output);
+}
+
+void
+view_output_enter(struct view *view, struct wlr_output *wlr_output)
+{
+       view_for_each_surface(view, surface_enter_for_each_surface,
+               wlr_output);
+       if (view->toplevel_handle) {
+               wlr_foreign_toplevel_handle_v1_output_enter(
+                       view->toplevel_handle, wlr_output);
+       }
+}
+
+void
+view_output_leave(struct view *view, struct wlr_output *wlr_output)
+{
+       view_for_each_surface(view, surface_leave_for_each_surface,
+               wlr_output);
+       if (view->toplevel_handle) {
+               wlr_foreign_toplevel_handle_v1_output_leave(
+                       view->toplevel_handle, wlr_output);
+       }
+}
+
 void
 view_move_to_edge(struct view *view, const char *direction)
 {
index 6ad5b6d6f62dc85e8646d80f2ea96244ecd86d70..c63167ae57bccc0a30224c48c4be0074b970e74f 100644 (file)
--- a/src/xdg.c
+++ b/src/xdg.c
@@ -343,6 +343,8 @@ xdg_toplevel_view_map(struct view *view)
                                 current.link) {
                        view_subsurface_create(view, subsurface);
                }
+               struct wlr_output *wlr_output = view_wlr_output(view);
+               view_output_enter(view, wlr_output);
 
                view->been_mapped = true;
        }
index 08846303ba61119bd335a8eb2c7ce540208284c4..f74c1b6ca712b673ed26d49682c33ac6769a7278 100644 (file)
@@ -256,6 +256,9 @@ map(struct view *view)
                view->x = box.x;
                view->y = box.y;
                view_center(view);
+
+               struct wlr_output *wlr_output = view_wlr_output(view);
+               view_output_enter(view, wlr_output);
                view->been_mapped = true;
        }