forked from enlightenment/enlightenment
fix window screenshotting at least on nvidia... :/
SVN revision: 81466
This commit is contained in:
parent
829a5b0d28
commit
30fe9349c4
|
@ -617,14 +617,18 @@ _shot_now(E_Zone *zone, E_Border *bd)
|
|||
Ecore_X_Visual visual;
|
||||
Ecore_X_Display *display;
|
||||
Ecore_X_Screen *scr;
|
||||
|
||||
Ecore_X_Window_Attributes watt;
|
||||
Ecore_X_Colormap colormap;
|
||||
|
||||
watt.visual = 0;
|
||||
if ((!zone) && (!bd)) return;
|
||||
if (zone)
|
||||
{
|
||||
sman = zone->container->manager;
|
||||
scon = zone->container;
|
||||
xwin = sman->root;
|
||||
sw = sman->w, sh = sman->h;
|
||||
w = sw = sman->w;
|
||||
h = sh = sman->h;
|
||||
x = y = 0;
|
||||
}
|
||||
else
|
||||
|
@ -636,30 +640,27 @@ _shot_now(E_Zone *zone, E_Border *bd)
|
|||
if (ecore_x_window_parent_get(xwin) == root) break;
|
||||
xwin = ecore_x_window_parent_get(xwin);
|
||||
}
|
||||
ecore_x_window_geometry_get(xwin, NULL, NULL, &sw, &sh);
|
||||
ecore_x_window_geometry_get(xwin, &x, &y, &sw, &sh);
|
||||
w = sw;
|
||||
h = sh;
|
||||
xwin = root;
|
||||
x = E_CLAMP(bd->x, bd->zone->x, bd->zone->x + bd->zone->w);
|
||||
y = E_CLAMP(bd->y, bd->zone->y, bd->zone->y + bd->zone->h);
|
||||
sw = E_CLAMP(sw, 0, bd->zone->x + bd->zone->w - x);
|
||||
sh = E_CLAMP(sh, 0, bd->zone->y + bd->zone->h - y);
|
||||
}
|
||||
if (!ecore_x_window_attributes_get(xwin, &watt)) return;
|
||||
visual = watt.visual;
|
||||
img = ecore_x_image_new(w, h, visual, ecore_x_window_depth_get(xwin));
|
||||
ecore_x_image_get(img, xwin, x, y, 0, 0, sw, sh);
|
||||
src = ecore_x_image_data_get(img, &bpl, &rows, &bpp);
|
||||
display = ecore_x_display_get();
|
||||
scr = ecore_x_default_screen_get();
|
||||
visual = ecore_x_default_visual_get(display, scr);
|
||||
img = ecore_x_image_new(sw, sh, visual, ecore_x_window_depth_get(xwin));
|
||||
ecore_x_image_get(img, xwin, 0, 0, 0, 0, sw, sh);
|
||||
src = ecore_x_image_data_get(img, &bpl, &rows, &bpp);
|
||||
if (!ecore_x_image_is_argb32_get(img))
|
||||
{
|
||||
Ecore_X_Colormap colormap;
|
||||
|
||||
colormap = ecore_x_default_colormap_get(display, scr);
|
||||
dst = malloc(sw * sh * sizeof(int));
|
||||
ecore_x_image_to_argb_convert(src, bpp, bpl, colormap, visual,
|
||||
0, 0, sw, sh,
|
||||
dst, (sw * sizeof(int)), 0, 0);
|
||||
}
|
||||
else
|
||||
dst = (unsigned int *)src;
|
||||
colormap = ecore_x_default_colormap_get(display, scr);
|
||||
dst = malloc(sw * sh * sizeof(int));
|
||||
ecore_x_image_to_argb_convert(src, bpp, bpl, colormap, visual,
|
||||
0, 0, sw, sh,
|
||||
dst, (sw * sizeof(int)), 0, 0);
|
||||
|
||||
if (win) e_object_del(E_OBJECT(win));
|
||||
win = e_win_new(e_container_current_get(e_manager_current_get()));
|
||||
|
@ -702,7 +703,7 @@ _shot_now(E_Zone *zone, E_Border *bd)
|
|||
evas_object_image_alpha_set(o, EINA_FALSE);
|
||||
evas_object_image_size_set(o, sw, sh);
|
||||
evas_object_image_data_copy_set(o, dst);
|
||||
if (dst != (unsigned int *)src) free(dst);
|
||||
free(dst);
|
||||
ecore_x_image_free(img);
|
||||
evas_object_image_data_update_add(o, 0, 0, sw, sh);
|
||||
e_widget_preview_extern_object_set(op, o);
|
||||
|
|
Loading…
Reference in New Issue