aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/shot
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2012-12-20 15:10:50 +0000
committerCarsten Haitzler <raster@rasterman.com>2012-12-20 15:10:50 +0000
commit30fe9349c4da5d1ef99a7e9d1d7b9bfb3a89b83c (patch)
tree5565d046da03f7f9e1824f458627855939603042 /src/modules/shot
parent829a5b0d286f198a7249059d8a7e8fcc0fccd326 (diff)
downloadenlightenment-30fe9349c4da5d1ef99a7e9d1d7b9bfb3a89b83c.tar.gz
enlightenment-30fe9349c4da5d1ef99a7e9d1d7b9bfb3a89b83c.tar.xz
enlightenment-30fe9349c4da5d1ef99a7e9d1d7b9bfb3a89b83c.zip
fix window screenshotting at least on nvidia... :/
SVN revision: 81466
Diffstat (limited to 'src/modules/shot')
-rw-r--r--src/modules/shot/e_mod_main.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/src/modules/shot/e_mod_main.c b/src/modules/shot/e_mod_main.c
index 71553fdc6..9618ce2f8 100644
--- a/src/modules/shot/e_mod_main.c
+++ b/src/modules/shot/e_mod_main.c
@@ -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);