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)
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 ba4a42732..52a62e06e 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)
646 depth = bd->client.initial_attributes.depth; 646 depth = bd->client.initial_attributes.depth;
647 } 647 }
648 img = ecore_x_image_new(w, h, visual, depth); 648 img = ecore_x_image_new(w, h, visual, depth);
649 ecore_x_image_get(img, xwin, x, y, 0, 0, sw, sh); 649 if (!ecore_x_image_get(img, xwin, x, y, 0, 0, sw, sh))
650 {
651 Eina_Bool dialog = EINA_FALSE;
652 ecore_x_image_free(img);
653#ifdef __linux__
654 FILE *f;
655
656 f = fopen("/proc/sys/kernel/shmmax", "r");
657 if (f)
658 {
659 long long unsigned int max = 0;
660
661 fscanf(f, "%llu", &max);
662 if (max && (max < (w * h * sizeof(int))))
663 {
664 e_util_dialog_show(_("Screenshot Error"),
665 _("SHMMAX is too small to take screenshot.<br>"
666 "Consider increasing /proc/sys/kernel/shmmax to a value larger than %llu"),
667 (long long unsigned int)(w * h * sizeof(int)));
668 dialog = EINA_TRUE;
669 }
670 fclose(f);
671 }
672#endif
673 if (!dialog)
674 e_util_dialog_show(_("Screenshot Error"),
675 _("SHM creation failed.<br>"
676 "Ensure your system has enough RAM free and your user has sufficient permissions."));
677 return;
678 }
650 src = ecore_x_image_data_get(img, &bpl, &rows, &bpp); 679 src = ecore_x_image_data_get(img, &bpl, &rows, &bpp);
651 display = ecore_x_display_get(); 680 display = ecore_x_display_get();
652 scr = ecore_x_default_screen_get(); 681 scr = ecore_x_default_screen_get();