summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2014-05-09 10:35:10 -0400
committerMike Blumenkrantz <zmike@samsung.com>2014-05-09 10:47:22 -0400
commitadfd1f331ccc241eda4a9b2a9121e472bf92fca6 (patch)
tree1afd8d76376fddec9238ea6e73e5186fa21a26d3
parentf5a92867520380821ec90c07643059f9c1e7f3cb (diff)
downloadenlightenment-adfd1f331ccc241eda4a9b2a9121e472bf92fca6.tar.gz
bugfix: screenshot now displays a helpful error message when it fails
now that larger xinerama setups are getting more common, it's also the case that shm creation is more likely to fail due to SHMMAX defaults only working on displays smaller than than 8,388,609 total pixels. in this case, we print a helpful error message so the user can (optionally) increase SHMMAX
-rw-r--r--src/modules/shot/e_mod_main.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/modules/shot/e_mod_main.c b/src/modules/shot/e_mod_main.c
index ba4a427325..52a62e06e2 100644
--- a/src/modules/shot/e_mod_main.c
+++ b/src/modules/shot/e_mod_main.c
@@ -646,7 +646,36 @@ _shot_now(E_Zone *zone, E_Border *bd)
depth = bd->client.initial_attributes.depth;
}
img = ecore_x_image_new(w, h, visual, depth);
- ecore_x_image_get(img, xwin, x, y, 0, 0, sw, sh);
+ if (!ecore_x_image_get(img, xwin, x, y, 0, 0, sw, sh))
+ {
+ Eina_Bool dialog = EINA_FALSE;
+ ecore_x_image_free(img);
+#ifdef __linux__
+ FILE *f;
+
+ f = fopen("/proc/sys/kernel/shmmax", "r");
+ if (f)
+ {
+ long long unsigned int max = 0;
+
+ fscanf(f, "%llu", &max);
+ if (max && (max < (w * h * sizeof(int))))
+ {
+ e_util_dialog_show(_("Screenshot Error"),
+ _("SHMMAX is too small to take screenshot.<br>"
+ "Consider increasing /proc/sys/kernel/shmmax to a value larger than %llu"),
+ (long long unsigned int)(w * h * sizeof(int)));
+ dialog = EINA_TRUE;
+ }
+ fclose(f);
+ }
+#endif
+ if (!dialog)
+ e_util_dialog_show(_("Screenshot Error"),
+ _("SHM creation failed.<br>"
+ "Ensure your system has enough RAM free and your user has sufficient permissions."));
+ return;
+ }
src = ecore_x_image_data_get(img, &bpl, &rows, &bpp);
display = ecore_x_display_get();
scr = ecore_x_default_screen_get();