summaryrefslogtreecommitdiff
path: root/legacy/evas/src/modules/engines/gl_x11/evas_engine.c
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2010-01-08 07:10:53 +0000
committerCarsten Haitzler <raster@rasterman.com>2010-01-08 07:10:53 +0000
commit45d79a15cb29aa7990b70d44ad9c1ed2c71b2a88 (patch)
tree588490d36f8db6ff4ae55cdce76cb767190b6d0a /legacy/evas/src/modules/engines/gl_x11/evas_engine.c
parent83e8cfc7fc0be6f35c8f5ff4e42f9dfa0050ed94 (diff)
allow x11 engines to get x resource that sets dpi.
SVN revision: 44965
Diffstat (limited to '')
-rw-r--r--legacy/evas/src/modules/engines/gl_x11/evas_engine.c55
1 files changed, 53 insertions, 2 deletions
diff --git a/legacy/evas/src/modules/engines/gl_x11/evas_engine.c b/legacy/evas/src/modules/engines/gl_x11/evas_engine.c
index f989aac2d9..37e35f0c0a 100644
--- a/legacy/evas/src/modules/engines/gl_x11/evas_engine.c
+++ b/legacy/evas/src/modules/engines/gl_x11/evas_engine.c
@@ -19,6 +19,11 @@ struct _Render_Engine
19{ 19{
20 Evas_GL_X11_Window *win; 20 Evas_GL_X11_Window *win;
21 int end; 21 int end;
22
23 XrmDatabase xrdb; // xres - dpi
24 struct { // xres - dpi
25 int dpi; // xres - dpi
26 } xr; // xres - dpi
22}; 27};
23 28
24static void * 29static void *
@@ -75,9 +80,55 @@ eng_setup(Evas *e, void *in)
75 e->engine.data.output = NULL; 80 e->engine.data.output = NULL;
76 return 0; 81 return 0;
77 } 82 }
78 83
84 {
85 int status;
86 char *type = NULL;
87 XrmValue val;
88
89 re->xr.dpi = 75000; // dpy * 1000
90 re->xrdb = XrmGetDatabase(info->info.display);
91 status = XrmGetResource(re->xrdb, "Xft.dpi", "Xft.Dpi", &type, &val);
92 if ((status) && (type))
93 {
94 if (!strcmp(type, "String"))
95 {
96 const char *str, *dp;
97
98 str = val.addr;
99 dp = strchr(str, '.');
100 if (!dp) dp = strchr(str, ',');
101
102 if (dp)
103 {
104 int subdpi, len, i;
105 char *buf;
106
107 buf = alloca(dp - str + 1);
108 strncpy(buf, str, dp - str);
109 buf[dp - str] = 0;
110 len = strlen(dp + 1);
111 subdpi = atoi(dp + 1);
112
113 if (len < 3)
114 {
115 for (i = len; i < 3; i++) subdpi *= 10;
116 }
117 else if (len > 3)
118 {
119 for (i = len; i > 3; i--) subdpi /= 10;
120 }
121 re->xr.dpi = atoi(buf) * 1000;
122 }
123 else
124 re->xr.dpi = atoi(str) * 1000;
125 }
126 }
127 evas_common_font_dpi_set(re->xr.dpi / 1000);
128 }
129
79 evas_common_cpu_init(); 130 evas_common_cpu_init();
80 131
81 evas_common_blend_init(); 132 evas_common_blend_init();
82 evas_common_image_init(); 133 evas_common_image_init();
83 evas_common_convert_init(); 134 evas_common_convert_init();