fix taking window shots when window is partially offscreen by clamping shot to screen geometry

ticket #1667


SVN revision: 78519
This commit is contained in:
Mike Blumenkrantz 2012-10-26 10:33:22 +00:00
parent 80ff1bdcb6
commit b17f560116
1 changed files with 6 additions and 2 deletions

View File

@ -578,7 +578,7 @@ _shot_now(E_Zone *zone, E_Border *bd)
int bpl = 0, rows = 0, bpp = 0, sw, sh; int bpl = 0, rows = 0, bpp = 0, sw, sh;
Evas *evas, *evas2; Evas *evas, *evas2;
Evas_Object *o, *oa, *op, *ol; Evas_Object *o, *oa, *op, *ol;
Evas_Coord w, h; int x, y, w, h;
Evas_Modifier_Mask mask; Evas_Modifier_Mask mask;
Ecore_X_Window xwin, root; Ecore_X_Window xwin, root;
E_Radio_Group *rg; E_Radio_Group *rg;
@ -592,10 +592,10 @@ _shot_now(E_Zone *zone, E_Border *bd)
scon = zone->container; scon = zone->container;
xwin = sman->root; xwin = sman->root;
sw = sman->w, sh = sman->h; sw = sman->w, sh = sman->h;
x = y = 0;
} }
else else
{ {
sw = bd->client.w, sh = bd->client.h;
root = bd->zone->container->manager->root; root = bd->zone->container->manager->root;
xwin = bd->client.win; xwin = bd->client.win;
while (xwin != root) while (xwin != root)
@ -604,6 +604,10 @@ _shot_now(E_Zone *zone, E_Border *bd)
xwin = ecore_x_window_parent_get(xwin); xwin = ecore_x_window_parent_get(xwin);
} }
ecore_x_window_geometry_get(xwin, NULL, NULL, &sw, &sh); ecore_x_window_geometry_get(xwin, NULL, NULL, &sw, &sh);
x = E_CLAMP(bd->x, bd->zone->x, bd->zone->w);
y = E_CLAMP(bd->y, bd->zone->y, bd->zone->h);
sw = E_CLAMP(sw, 0, bd->zone->w - x);
sh = E_CLAMP(sh, 0, bd->zone->h - y);
} }
display = ecore_x_display_get(); display = ecore_x_display_get();
scr = ecore_x_default_screen_get(); scr = ecore_x_default_screen_get();