summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBalazs Endresz <[email protected]>2023-01-11 13:18:34 +0100
committerraveit65 <[email protected]>2023-01-14 16:50:43 +0100
commit28300f782fcb5849719260ec3fb2e998d02f6596 (patch)
tree820c34556e150c1b51a9914450537e6e3764227f
parent5240fdc4a7efba5da151ac257e8b327d494a8845 (diff)
downloadmate-panel-28300f782fcb5849719260ec3fb2e998d02f6596.tar.bz2
mate-panel-28300f782fcb5849719260ec3fb2e998d02f6596.tar.xz
wncklet: center previews when scaling is enabled
-rw-r--r--applets/wncklet/window-list.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/applets/wncklet/window-list.c b/applets/wncklet/window-list.c
index 2f58be96..85c305d4 100644
--- a/applets/wncklet/window-list.c
+++ b/applets/wncklet/window-list.c
@@ -320,7 +320,7 @@ static int g_int_compare(gconstpointer a, gconstpointer b)
return 1;
}
-static int find_offset(GList *list, int target)
+static int find_offset(GList *list, gdouble target)
{
GList *node = list;
while (node != NULL) {
@@ -342,19 +342,17 @@ preview_window_reposition (WnckTasklist *tl,
{
/* Known issues:
* - When grouping is toggled the previews won't be centered correctly until a new window is opened or one is closed.
- * - We don't center previews when scaling is enabled because hovering over the first or last pixels of each button
- * would cause the preview to appear centered above the adjecent button instead.
* - Previews are not shown at all for grouped windows, this function is not called when hovering over those.
*/
GdkMonitor *monitor;
GdkRectangle monitor_geom;
MatePanelAppletOrient orient;
- int x_pos, y_pos;
+ gdouble x_pos, y_pos;
int x_offset, y_offset;
/* Get mouse position */
- gdk_device_get_position (gdk_seat_get_pointer (gdk_display_get_default_seat (gdk_display_get_default ())), NULL, &x_pos, &y_pos);
+ gdk_device_get_position_double (gdk_seat_get_pointer (gdk_display_get_default_seat (gdk_display_get_default ())), NULL, &x_pos, &y_pos);
/* Get geometry of monitor where tasklist is located to calculate correct position of preview */
monitor = gdk_display_get_monitor_at_point (gdk_display_get_default (), x_pos, y_pos);
@@ -417,25 +415,17 @@ preview_window_reposition (WnckTasklist *tl,
children = children->next;
}
- /* Center preview at the midpoint of the tasklist button.
- * Except when scaling is enabled we position it near the pointer instead because scaling can cause
- * the preview to appear above the wrong button when the pointer is over the first or last pixel. */
+ /* Center preview at the midpoint of the tasklist button */
if (orient == MATE_PANEL_APPLET_ORIENT_LEFT || orient == MATE_PANEL_APPLET_ORIENT_RIGHT)
{
/* Vertical panel */
- if (scale == 1)
- y_pos = y_offset + find_offset (alloc_y_list, y_pos - y_offset) + (last_alloc.height - height) / 2;
- else
- y_pos -= height / 2;
+ y_pos = y_offset + find_offset (alloc_y_list, y_pos - y_offset) + (last_alloc.height - height) / 2;
y_pos = y_pos < PREVIEW_PADDING ? PREVIEW_PADDING : y_pos;
}
else if (orient == MATE_PANEL_APPLET_ORIENT_UP || orient == MATE_PANEL_APPLET_ORIENT_DOWN)
{
/* Horizontal panel */
- if (scale == 1)
- x_pos = x_offset + find_offset (alloc_x_list, x_pos - x_offset) + (last_alloc.width - width) / 2;
- else
- x_pos -= width / 2;
+ x_pos = x_offset + find_offset (alloc_x_list, x_pos - x_offset) + (last_alloc.width - width) / 2;
x_pos = x_pos < PREVIEW_PADDING ? PREVIEW_PADDING : x_pos;
}