forked from enlightenment/enlightenment
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
This commit is contained in:
parent
dfd14bc7d3
commit
1ac25835db
|
@ -653,7 +653,36 @@ _shot_now(E_Zone *zone, E_Client *ec, const char *params)
|
|||
depth = ec->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();
|
||||
|
|
Loading…
Reference in New Issue