Skip to content
Permalink
Browse files

core: Use correct screen Y offset when positioning bar

When using offset monitors the bar would incorrectly be positioned
outside of the monitor. When offsetting a monitor by e.g. +0+100, the
coordinates of the upper left corner of the monitor are (0, 100) and not
(0, 0) which was previously assumed when setting the bar position.

This update fixes the issue by considering *both* the `dest.x` and
`dest.y` coordinates from `gdk_screen_get_monitor_geometry()` as the
upper left corner of the monitor.
  • Loading branch information...
Lokaltog committed Sep 28, 2015
1 parent d23f877 commit e81b66abe3c2ad96d31c670fcf8b3717c96fe4a2
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/candybar.c
@@ -275,12 +275,12 @@ main (int argc, char *argv[]) {

if (bar->position == BAR_POSITION_TOP) {
bar->pos_x = dest.x;
bar->pos_y = 0;
bar->pos_y = dest.y;
gtk_window_move(window, bar->pos_x, bar->pos_y);
}
else if (bar->position == BAR_POSITION_BOTTOM) {
bar->pos_x = dest.x;
bar->pos_y = dest.height - bar->height;
bar->pos_y = dest.y + dest.height - bar->height;
gtk_window_move(window, bar->pos_x, bar->pos_y);
}

0 comments on commit e81b66a

Please sign in to comment.
You can’t perform that action at this time.