Mercurial > dwindows
comparison gtk3/dw.c @ 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 | d77b8cf25f04 |
children | 7060e258e383 |
comparison
equal
deleted
inserted
replaced
1498:f8b4d6075cac | 1499:97e5e8688fe1 |
---|---|
8832 /* Handle vertical center gravity */ | 8832 /* Handle vertical center gravity */ |
8833 if((vert & 0xf) == DW_GRAV_CENTER) | 8833 if((vert & 0xf) == DW_GRAV_CENTER) |
8834 newy += ((gdk_screen_height() / 2) - (height / 2)); | 8834 newy += ((gdk_screen_height() / 2) - (height / 2)); |
8835 else if((vert & 0xf) == DW_GRAV_BOTTOM) | 8835 else if((vert & 0xf) == DW_GRAV_BOTTOM) |
8836 newy = gdk_screen_height() - height - y; | 8836 newy = gdk_screen_height() - height - y; |
8837 | |
8838 #if GTK_CHECK_VERSION(3,4,0) | |
8839 /* Adjust the values to avoid Gnome bar if requested */ | |
8840 if((horz | vert) & DW_GRAV_OBSTACLES) | |
8841 { | |
8842 GdkRectangle rect; | |
8843 GdkScreen *screen = gdk_screen_get_default(); | |
8844 | |
8845 gdk_screen_get_monitor_workarea(screen, 0, &rect); | |
8846 | |
8847 if(horz & DW_GRAV_OBSTACLES) | |
8848 { | |
8849 if((horz & 0xf) == DW_GRAV_LEFT) | |
8850 newx += rect.x; | |
8851 else if((horz & 0xf) == DW_GRAV_RIGHT) | |
8852 newx -= dw_screen_width() - (rect.x + rect.width); | |
8853 } | |
8854 if(vert & DW_GRAV_OBSTACLES) | |
8855 { | |
8856 if((vert & 0xf) == DW_GRAV_TOP) | |
8857 newy += rect.y; | |
8858 else if((vert & 0xf) == DW_GRAV_BOTTOM) | |
8859 newy -= dw_screen_height() - (rect.y + rect.height); | |
8860 } | |
8861 } | |
8862 #endif | |
8837 } | 8863 } |
8838 /* Finally move the window into place */ | 8864 /* Finally move the window into place */ |
8839 gtk_window_move(GTK_WINDOW(handle), newx, newy); | 8865 gtk_window_move(GTK_WINDOW(handle), newx, newy); |
8840 } | 8866 } |
8841 else if((window = gtk_widget_get_window(handle))) | 8867 else if((window = gtk_widget_get_window(handle))) |