Mercurial > dwindows
changeset 1499:97e5e8688fe1
Added gravity obstacle support for GTK 3.4 and later.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 25 Dec 2011 14:49:59 +0000 |
parents | f8b4d6075cac |
children | 97002721c4ca |
files | gtk3/dw.c |
diffstat | 1 files changed, 26 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/gtk3/dw.c Sun Dec 25 13:56:30 2011 +0000 +++ b/gtk3/dw.c Sun Dec 25 14:49:59 2011 +0000 @@ -8834,6 +8834,32 @@ newy += ((gdk_screen_height() / 2) - (height / 2)); else if((vert & 0xf) == DW_GRAV_BOTTOM) newy = gdk_screen_height() - height - y; + +#if GTK_CHECK_VERSION(3,4,0) + /* Adjust the values to avoid Gnome bar if requested */ + if((horz | vert) & DW_GRAV_OBSTACLES) + { + GdkRectangle rect; + GdkScreen *screen = gdk_screen_get_default(); + + gdk_screen_get_monitor_workarea(screen, 0, &rect); + + if(horz & DW_GRAV_OBSTACLES) + { + if((horz & 0xf) == DW_GRAV_LEFT) + newx += rect.x; + else if((horz & 0xf) == DW_GRAV_RIGHT) + newx -= dw_screen_width() - (rect.x + rect.width); + } + if(vert & DW_GRAV_OBSTACLES) + { + if((vert & 0xf) == DW_GRAV_TOP) + newy += rect.y; + else if((vert & 0xf) == DW_GRAV_BOTTOM) + newy -= dw_screen_height() - (rect.y + rect.height); + } + } +#endif } /* Finally move the window into place */ gtk_window_move(GTK_WINDOW(handle), newx, newy);