tasklist: Use Gdk to to determine which monitor contains a window

Desktop / Xfce / xfce4-panel - Alistair Buxton [gmail.com] - 2 December 2018 22:59 EST

Calculating which monitor contains a window can be surprisingly difficult. A window can span more than one monitor but more confusingly it can also be on zero monitors. Gdk already has robust functions for finding the "best" monitor for a window, and they handle all the corner cases much better than the code in the tasklist plugin. Specifically they will return the nearest monitor if the window is outside all monitors. This will prevent some cases where windows go missing from the panel.

This also removes the need to maintain lists of monitor geometry inside the tasklist, meaning a whole load of error-prone g_new/g_renew code can be ripped out.

c7e53e87 tasklist: Use Gdk to to determine which monitor contains a window
plugins/tasklist/tasklist-widget.c | 55 ++++++++++----------------------------
1 file changed, 14 insertions(+), 41 deletions(-)

Upstream: git.xfce.org


  • Share