Do this for consistency with other applications, some people just set
.Xdefaults but do not have xrdb to load it to screen. This works with
most of the systems, like Gtk and Qt, but not in Evas, so we get
different font sizes as they calculate based on DPI.
HOWEVER, and this may be a big thing, so RASTERMAN take a look, this
might impose a performance hit on window creation... remember that
every E17 popup/tooltip will hit this process of reading the file (if
exists) and then query X server (round trip).
I'd rather make this a global resource, loaded just once for all
created windows, we can store the mtime to know when it changed and
invalidate the pointer... but as Raster did not keep the
XrmGetDatabase() result as global, I'm not doing it here either.
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@48403
7cbeb6ba-43b4-40fd-8cce-
4c39aea84d33
Evas *evas;
int end;
- XrmDatabase xrdb; // xres - dpi
+ // TODO: maybe use these as shared global resources, acquired only once?
+ XrmDatabase xrdb_dpy; // xres - dpi
+ XrmDatabase xrdb_user;
struct { // xres - dpi
int dpi; // xres - dpi
} xr; // xres - dpi
{
int status;
char *type = NULL;
+ const char *home;
XrmValue val;
re->xr.dpi = 75000; // dpy * 1000
- re->xrdb = XrmGetDatabase(info->info.display);
- status = XrmGetResource(re->xrdb, "Xft.dpi", "Xft.Dpi", &type, &val);
+
+ if ((home = getenv("HOME")))
+ {
+ char tmp[PATH_MAX];
+ snprintf(tmp, sizeof(tmp), "%s/.Xdefaults", home);
+ re->xrdb_user = XrmGetFileDatabase(tmp);
+ if (re->xrdb_user)
+ status = XrmGetResource(re->xrdb_user,
+ "Xft.dpi", "Xft.Dpi", &type, &val);
+ }
+
+ if ((!status) || (!type))
+ {
+ re->xrdb_dpy = XrmGetDatabase(info->info.display);
+ if (re->xrdb_dpy)
+ status = XrmGetResource(re->xrdb_dpy,
+ "Xft.dpi", "Xft.Dpi", &type, &val);
+ }
+
if ((status) && (type))
{
if (!strcmp(type, "String"))
re = (Render_Engine *)data;
-// if (re->xrdb) XrmDestroyDatabase(re->xrdb);
+// if (re->xrdb_user) XrmDestroyDatabase(re->xrdb_user);
+// if (re->xrdb_dpy) XrmDestroyDatabase(re->xrdb_dpy);
eng_window_free(re->win);
free(re);
Tilebuf_Rect *rects;
Tilebuf_Rect *cur_rect;
- XrmDatabase xrdb; // xres - dpi
+ // TODO: maybe use these as shared global resources, acquired only once?
+ XrmDatabase xrdb_dpy; // xres - dpi
+ XrmDatabase xrdb_user;
struct { // xres - dpi
int dpi; // xres - dpi
} xr; // xres - dpi
{
int status;
char *type = NULL;
+ const char *home;
XrmValue val;
re->xr.dpi = 75000; // dpy * 1000
- re->xrdb = XrmGetDatabase(re->disp);
- status = XrmGetResource(re->xrdb, "Xft.dpi", "Xft.Dpi", &type, &val);
+
+ if ((home = getenv("HOME")))
+ {
+ char tmp[PATH_MAX];
+ snprintf(tmp, sizeof(tmp), "%s/.Xdefaults", home);
+ re->xrdb_user = XrmGetFileDatabase(tmp);
+ if (re->xrdb_user)
+ status = XrmGetResource(re->xrdb_user,
+ "Xft.dpi", "Xft.Dpi", &type, &val);
+ }
+
+ if ((!status) || (!type))
+ {
+ re->xrdb_dpy = XrmGetDatabase(re->disp);
+ if (re->xrdb_dpy)
+ status = XrmGetResource(re->xrdb_dpy,
+ "Xft.dpi", "Xft.Dpi", &type, &val);
+ }
+
if ((status) && (type))
{
if (!strcmp(type, "String"))
re = (Render_Engine *)data;
-// if (re->xrdb) XrmDestroyDatabase(re->xrdb);
+// if (re->xrdb_user) XrmDestroyDatabase(re->xrdb_user);
+// if (re->xrdb_dpy) XrmDestroyDatabase(re->xrdb_dpy);
if (re->shbuf) evas_software_x11_x_output_buffer_free(re->shbuf, 0);
if (re->clip_rects) XDestroyRegion(re->clip_rects);
int end : 1;
#ifdef BUILD_ENGINE_SOFTWARE_XLIB
- XrmDatabase xrdb; // xres - dpi
+ // TODO: maybe use these as shared global resources, acquired only once?
+ XrmDatabase xrdb_dpy; // xres - dpi
+ XrmDatabase xrdb_user;
struct { // xres - dpi
int dpi; // xres - dpi
} xr; // xres - dpi
evas_software_xlib_outbuf_init();
{
- int status;
+ int status = 0;
char *type = NULL;
+ const char *home;
XrmValue val;
re->xr.dpi = 75000; // dpy * 1000
- re->xrdb = XrmGetDatabase(disp);
- status = XrmGetResource(re->xrdb, "Xft.dpi", "Xft.Dpi", &type, &val);
+
+ if ((home = getenv("HOME")))
+ {
+ char tmp[PATH_MAX];
+ snprintf(tmp, sizeof(tmp), "%s/.Xdefaults", home);
+ re->xrdb_user = XrmGetFileDatabase(tmp);
+ if (re->xrdb_user)
+ status = XrmGetResource(re->xrdb_user,
+ "Xft.dpi", "Xft.Dpi", &type, &val);
+ }
+
+ if ((!status) || (!type))
+ {
+ re->xrdb_dpy = XrmGetDatabase(disp);
+ if (re->xrdb_dpy)
+ status = XrmGetResource(re->xrdb_dpy,
+ "Xft.dpi", "Xft.Dpi", &type, &val);
+ }
+
if ((status) && (type))
{
if (!strcmp(type, "String"))
evas_software_xcb_x_color_init();
evas_software_xcb_outbuf_init();
- // FIXME: re->xrdb
+ // FIXME: re->xrdb_user, re->xrdb_dpy
re->ob = evas_software_xcb_outbuf_setup_x(w,
h,
re = (Render_Engine *)data;
#ifdef BUILD_ENGINE_SOFTWARE_XLIB
-// if (re->xrdb) XrmDestroyDatabase(re->xrdb);
+// if (re->xrdb_user) XrmDestroyDatabase(re->xrdb_user);
+// if (re->xrdb_dpy) XrmDestroyDatabase(re->xrdb_dpy);
#endif
re->outbuf_free(re->ob);
unsigned char destination_alpha : 1;
#ifdef BUILD_ENGINE_XRENDER_X11
- XrmDatabase xrdb; // xres - dpi
+ // TODO: maybe use these as shared global resources, acquired only once?
+ XrmDatabase xrdb_dpy; // xres - dpi
+ XrmDatabase xrdb_user;
struct { // xres - dpi
int dpi; // xres - dpi
} xr; // xres - dpi
{
int status;
char *type = NULL;
+ const char *home;
XrmValue val;
re->xr.dpi = 75000; // dpy * 1000
- re->xrdb = XrmGetDatabase((Display *)re->x11.connection);
- status = XrmGetResource(re->xrdb, "Xft.dpi", "Xft.Dpi", &type, &val);
+
+ if ((home = getenv("HOME")))
+ {
+ char tmp[PATH_MAX];
+ snprintf(tmp, sizeof(tmp), "%s/.Xdefaults", home);
+ re->xrdb_user = XrmGetFileDatabase(tmp);
+ if (re->xrdb_user)
+ status = XrmGetResource(re->xrdb_user,
+ "Xft.dpi", "Xft.Dpi", &type, &val);
+ }
+
+ if ((!status) || (!type))
+ {
+ re->xrdb_dpy = XrmGetDatabase((Display *)re->x11.connection);
+ if (re->xrdb_dpy)
+ status = XrmGetResource(re->xrdb_dpy,
+ "Xft.dpi", "Xft.Dpi", &type, &val);
+ }
+
if ((status) && (type))
{
if (!strcmp(type, "String"))
re = (Render_Engine *)data;
#ifdef BUILD_ENGINE_XRENDER_X11
-// if (re->xrdb) XrmDestroyDatabase(re->xrdb);
+// if (re->xrdb_user) XrmDestroyDatabase(re->xrdb_user);
+// if (re->xrdb_dpy) XrmDestroyDatabase(re->xrdb_dpy);
#endif
evas_common_font_shutdown();