aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ecore/src/lib/ecore_x/xlib
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-04-22 09:19:23 +1000
committerDavid Walter Seikel2012-04-22 09:19:23 +1000
commitc963d75dfdeec11f82e79e727062fbf89afa2c04 (patch)
tree895633dbf641110be46f117c29890c49b3ffc0bd /libraries/ecore/src/lib/ecore_x/xlib
parentAdding the new extantz viewer and grid manager. (diff)
downloadSledjHamr-c963d75dfdeec11f82e79e727062fbf89afa2c04.zip
SledjHamr-c963d75dfdeec11f82e79e727062fbf89afa2c04.tar.gz
SledjHamr-c963d75dfdeec11f82e79e727062fbf89afa2c04.tar.bz2
SledjHamr-c963d75dfdeec11f82e79e727062fbf89afa2c04.tar.xz
Update EFL to latest beta.
Diffstat (limited to 'libraries/ecore/src/lib/ecore_x/xlib')
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/Makefile.in20
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_atoms.c15
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_e.c233
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_netwm.c51
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12.c246
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_test.c12
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window.c4
7 files changed, 515 insertions, 66 deletions
diff --git a/libraries/ecore/src/lib/ecore_x/xlib/Makefile.in b/libraries/ecore/src/lib/ecore_x/xlib/Makefile.in
index 27a2841..cada69a 100644
--- a/libraries/ecore/src/lib/ecore_x/xlib/Makefile.in
+++ b/libraries/ecore/src/lib/ecore_x/xlib/Makefile.in
@@ -48,16 +48,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
48 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ 48 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
49 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ 49 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
50 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ 50 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
51 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ 51 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
52 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ 52 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
53 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ 53 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
54 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ 54 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
55 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ 55 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
56 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ 56 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
57 $(top_srcdir)/configure.ac
58am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 57am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
59 $(ACLOCAL_M4) 58 $(ACLOCAL_M4)
60mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 59mkinstalldirs = $(install_sh) -d
61CONFIG_HEADER = $(top_builddir)/config.h 60CONFIG_HEADER = $(top_builddir)/config.h
62CONFIG_CLEAN_FILES = 61CONFIG_CLEAN_FILES =
63CONFIG_CLEAN_VPATH_FILES = 62CONFIG_CLEAN_VPATH_FILES =
@@ -197,6 +196,8 @@ EVAS_LIBS = @EVAS_LIBS@
197EVIL_CFLAGS = @EVIL_CFLAGS@ 196EVIL_CFLAGS = @EVIL_CFLAGS@
198EVIL_LIBS = @EVIL_LIBS@ 197EVIL_LIBS = @EVIL_LIBS@
199EXEEXT = @EXEEXT@ 198EXEEXT = @EXEEXT@
199EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
200EXOTIC_LIBS = @EXOTIC_LIBS@
200FGREP = @FGREP@ 201FGREP = @FGREP@
201GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ 202GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
202GLIB_CFLAGS = @GLIB_CFLAGS@ 203GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -252,6 +253,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
252PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 253PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
253PIXMAN_LIBS = @PIXMAN_LIBS@ 254PIXMAN_LIBS = @PIXMAN_LIBS@
254PKG_CONFIG = @PKG_CONFIG@ 255PKG_CONFIG = @PKG_CONFIG@
256PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
257PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
255POSUB = @POSUB@ 258POSUB = @POSUB@
256RANLIB = @RANLIB@ 259RANLIB = @RANLIB@
257SCIM_CFLAGS = @SCIM_CFLAGS@ 260SCIM_CFLAGS = @SCIM_CFLAGS@
@@ -262,6 +265,7 @@ SDL_LIBS = @SDL_LIBS@
262SED = @SED@ 265SED = @SED@
263SET_MAKE = @SET_MAKE@ 266SET_MAKE = @SET_MAKE@
264SHELL = @SHELL@ 267SHELL = @SHELL@
268SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
265SSL_CFLAGS = @SSL_CFLAGS@ 269SSL_CFLAGS = @SSL_CFLAGS@
266SSL_LIBS = @SSL_LIBS@ 270SSL_LIBS = @SSL_LIBS@
267STRIP = @STRIP@ 271STRIP = @STRIP@
diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_atoms.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_atoms.c
index ee981fe..7a8bffa 100644
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_atoms.c
+++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_atoms.c
@@ -270,7 +270,20 @@ _ecore_x_atoms_init(void)
270 { "_E_ILLUME_QUICKPANEL_ZONE", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE }, 270 { "_E_ILLUME_QUICKPANEL_ZONE", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE },
271 { "_E_ILLUME_QUICKPANEL_POSITION_UPDATE", 271 { "_E_ILLUME_QUICKPANEL_POSITION_UPDATE",
272 &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE }, 272 &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE },
273 273 { "_E_ILLUME_INDICATOR_STATE", &ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE },
274 { "_E_ILLUME_INDICATOR_ON", &ECORE_X_ATOM_E_ILLUME_INDICATOR_ON },
275 { "_E_ILLUME_INDICATOR_OFF", &ECORE_X_ATOM_E_ILLUME_INDICATOR_OFF },
276 { "_E_ILLUME_INDICATOR_OPACITY_MODE", &ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE },
277 { "_E_ILLUME_INDICATOR_OPAQUE", &ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE },
278 { "_E_ILLUME_INDICATOR_TRANSLUCENT", &ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT },
279 { "_E_ILLUME_INDICATOR_TRANSPARENT", &ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT },
280 { "_E_ILLUME_ROTATE_WINDOW_AVAILABLE_ANGLES", &ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_AVAILABLE_ANGLE },
281 { "_E_ILLUME_ROTATE_WINDOW_ANGLE", &ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE },
282 { "_E_ILLUME_ROTATE_ROOT_ANGLE", &ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE },
283 { "_E_ILLUME_CLIPBOARD_STATE", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE },
284 { "_E_ILLUME_CLIPBOARD_ON", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_ON },
285 { "_E_ILLUME_CLIPBOARD_OFF", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF },
286 { "_E_ILLUME_CLIPBOARD_GEOMETRY", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY },
274 { "_E_COMP_SYNC_COUNTER", &ECORE_X_ATOM_E_COMP_SYNC_COUNTER }, 287 { "_E_COMP_SYNC_COUNTER", &ECORE_X_ATOM_E_COMP_SYNC_COUNTER },
275 { "_E_COMP_SYNC_DRAW_DONE", &ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE }, 288 { "_E_COMP_SYNC_DRAW_DONE", &ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE },
276 { "_E_COMP_SYNC_SUPPORTED", &ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED }, 289 { "_E_COMP_SYNC_SUPPORTED", &ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED },
diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_e.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_e.c
index 5966bbd..4bd5218 100644
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_e.c
+++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_e.c
@@ -768,6 +768,99 @@ ecore_x_e_illume_quickpanel_position_update_send(Ecore_X_Window win)
768 1, 0, 0, 0, 0); 768 1, 0, 0, 0, 0);
769} 769}
770 770
771static Ecore_X_Atom
772_ecore_x_e_clipboard_atom_get(Ecore_X_Illume_Clipboard_State state)
773{
774 switch (state)
775 {
776 case ECORE_X_ILLUME_CLIPBOARD_STATE_ON:
777 return ECORE_X_ATOM_E_ILLUME_CLIPBOARD_ON;
778 case ECORE_X_ILLUME_CLIPBOARD_STATE_OFF:
779 return ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF;
780 default:
781 break;
782 }
783 return 0;
784}
785
786static Ecore_X_Illume_Clipboard_State
787_ecore_x_e_clipboard_state_get(Ecore_X_Atom atom)
788{
789 if (atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_ON)
790 return ECORE_X_ILLUME_CLIPBOARD_STATE_ON;
791
792 if (atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF)
793 return ECORE_X_ILLUME_CLIPBOARD_STATE_OFF;
794
795 return ECORE_X_ILLUME_INDICATOR_STATE_UNKNOWN;
796}
797
798EAPI void
799ecore_x_e_illume_clipboard_state_set(Ecore_X_Window win,
800 Ecore_X_Illume_Clipboard_State state)
801{
802 Ecore_X_Atom atom = 0;
803
804 LOGFN(__FILE__, __LINE__, __FUNCTION__);
805 atom = _ecore_x_e_clipboard_atom_get(state);
806
807 ecore_x_window_prop_atom_set(win,
808 ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE,
809 &atom, 1);
810}
811
812EAPI Ecore_X_Illume_Clipboard_State
813ecore_x_e_illume_clipboard_state_get(Ecore_X_Window win)
814{
815 Ecore_X_Atom atom = 0;
816
817 LOGFN(__FILE__, __LINE__, __FUNCTION__);
818
819 if (!ecore_x_window_prop_atom_get(win,
820 ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE,
821 &atom, 1))
822 return ECORE_X_ILLUME_CLIPBOARD_STATE_UNKNOWN;
823 return _ecore_x_e_clipboard_state_get(atom);
824}
825
826EAPI void
827ecore_x_e_illume_clipboard_geometry_set(Ecore_X_Window win,
828 int x, int y, int w, int h)
829{
830 unsigned int geom[4];
831
832 LOGFN(__FILE__, __LINE__, __FUNCTION__);
833 geom[0] = x;
834 geom[1] = y;
835 geom[2] = w;
836 geom[3] = h;
837 ecore_x_window_prop_card32_set(win,
838 ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY,
839 geom, 4);
840}
841
842EAPI Eina_Bool
843ecore_x_e_illume_clipboard_geometry_get(Ecore_X_Window win,
844 int *x, int *y, int *w, int *h)
845{
846 int ret = 0;
847 unsigned int geom[4];
848
849 LOGFN(__FILE__, __LINE__, __FUNCTION__);
850 ret =
851 ecore_x_window_prop_card32_get(win,
852 ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY,
853 geom, 4);
854 if (ret != 4) return EINA_FALSE;
855
856 if (x) *x = geom[0];
857 if (y) *y = geom[1];
858 if (w) *w = geom[2];
859 if (h) *h = geom[3];
860
861 return EINA_TRUE;
862}
863
771EAPI void 864EAPI void
772ecore_x_e_comp_sync_counter_set(Ecore_X_Window win, 865ecore_x_e_comp_sync_counter_set(Ecore_X_Window win,
773 Ecore_X_Sync_Counter counter) 866 Ecore_X_Sync_Counter counter)
@@ -1058,3 +1151,143 @@ ecore_x_e_comp_pixmap_get(Ecore_X_Window win)
1058 return pixmap; 1151 return pixmap;
1059} 1152}
1060 1153
1154static Ecore_X_Atom
1155_ecore_x_e_indicator_atom_get(Ecore_X_Illume_Indicator_State state)
1156{
1157 switch (state)
1158 {
1159 case ECORE_X_ILLUME_INDICATOR_STATE_ON:
1160 return ECORE_X_ATOM_E_ILLUME_INDICATOR_ON;
1161
1162 case ECORE_X_ILLUME_INDICATOR_STATE_OFF:
1163 return ECORE_X_ATOM_E_ILLUME_INDICATOR_OFF;
1164
1165 default:
1166 break;
1167 }
1168 return 0;
1169}
1170
1171static Ecore_X_Illume_Indicator_State
1172_ecore_x_e_indicator_state_get(Ecore_X_Atom atom)
1173{
1174 if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_ON)
1175 return ECORE_X_ILLUME_INDICATOR_STATE_ON;
1176
1177 if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_OFF)
1178 return ECORE_X_ILLUME_INDICATOR_STATE_OFF;
1179
1180 return ECORE_X_ILLUME_INDICATOR_STATE_UNKNOWN;
1181}
1182
1183EAPI void
1184ecore_x_e_illume_indicator_state_set(Ecore_X_Window win,
1185 Ecore_X_Illume_Indicator_State state)
1186{
1187 Ecore_X_Atom atom = 0;
1188
1189 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1190 atom = _ecore_x_e_indicator_atom_get(state);
1191 ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE,
1192 &atom, 1);
1193}
1194
1195EAPI Ecore_X_Illume_Indicator_State
1196ecore_x_e_illume_indicator_state_get(Ecore_X_Window win)
1197{
1198 Ecore_X_Atom atom;
1199
1200 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1201 if (!ecore_x_window_prop_atom_get(win,
1202 ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE,
1203 &atom, 1))
1204 return ECORE_X_ILLUME_INDICATOR_STATE_UNKNOWN;
1205
1206 return _ecore_x_e_indicator_state_get(atom);
1207}
1208
1209EAPI void
1210ecore_x_e_illume_indicator_state_send(Ecore_X_Window win,
1211 Ecore_X_Illume_Indicator_State state)
1212{
1213 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1214 ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE,
1215 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
1216 _ecore_x_e_indicator_atom_get(state),
1217 0, 0, 0, 0);
1218}
1219
1220static Ecore_X_Atom
1221_ecore_x_e_indicator_opacity_atom_get(Ecore_X_Illume_Indicator_Opacity_Mode mode)
1222{
1223 switch (mode)
1224 {
1225 case ECORE_X_ILLUME_INDICATOR_OPAQUE:
1226 return ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE;
1227
1228 case ECORE_X_ILLUME_INDICATOR_TRANSLUCENT:
1229 return ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT;
1230
1231 case ECORE_X_ILLUME_INDICATOR_TRANSPARENT:
1232 return ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT;
1233
1234 default:
1235 break;
1236 }
1237 return 0;
1238}
1239
1240static Ecore_X_Illume_Indicator_Opacity_Mode
1241_ecore_x_e_indicator_opacity_get(Ecore_X_Atom atom)
1242{
1243 if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE)
1244 return ECORE_X_ILLUME_INDICATOR_OPAQUE;
1245
1246 if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT)
1247 return ECORE_X_ILLUME_INDICATOR_TRANSLUCENT;
1248
1249 if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT)
1250 return ECORE_X_ILLUME_INDICATOR_TRANSPARENT;
1251
1252 return ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN;
1253}
1254
1255EAPI void
1256ecore_x_e_illume_indicator_opacity_set(Ecore_X_Window win,
1257 Ecore_X_Illume_Indicator_Opacity_Mode mode)
1258{
1259 Ecore_X_Atom atom = 0;
1260
1261 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1262 atom = _ecore_x_e_indicator_opacity_atom_get(mode);
1263 ecore_x_window_prop_atom_set(win,
1264 ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE,
1265 &atom, 1);
1266}
1267
1268EAPI Ecore_X_Illume_Indicator_Opacity_Mode
1269ecore_x_e_illume_indicator_opacity_get(Ecore_X_Window win)
1270{
1271 Ecore_X_Atom atom;
1272
1273 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1274 if (!ecore_x_window_prop_atom_get(win,
1275 ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE,
1276 &atom, 1))
1277 return ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN;
1278
1279 return _ecore_x_e_indicator_opacity_get(atom);
1280}
1281
1282EAPI void
1283ecore_x_e_illume_indicator_opacity_send(Ecore_X_Window win,
1284 Ecore_X_Illume_Indicator_Opacity_Mode mode)
1285{
1286 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1287 ecore_x_client_message32_send(win,
1288 ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE,
1289 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
1290 _ecore_x_e_indicator_opacity_atom_get(mode),
1291 0, 0, 0, 0);
1292}
1293
diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_netwm.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_netwm.c
index 9fc428a..3076c3c 100644
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_netwm.c
+++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_netwm.c
@@ -661,6 +661,57 @@ ecore_x_netwm_strut_partial_get(Ecore_X_Window win,
661 return EINA_TRUE; 661 return EINA_TRUE;
662} 662}
663 663
664EAPI void
665ecore_x_netwm_icons_set(Ecore_X_Window win,
666 Ecore_X_Icon *icon,
667 int num)
668{
669 unsigned int *data, *p, *p2;
670 unsigned int i, size, x, y;
671
672 LOGFN(__FILE__, __LINE__, __FUNCTION__);
673 size = 0;
674 for (i = 0; i < (unsigned int)num; i++)
675 {
676 size += 2 + (icon[i].width * icon[i].height);
677 }
678 data = malloc(size * sizeof(unsigned int));
679 if (!data) return;
680 p = data;
681 for (i = 0; i < (unsigned int)num; i++)
682 {
683 p[0] = icon[i].width;
684 p[1] = icon[i].height;
685 p += 2;
686 p2 = icon[i].data;
687 for (y = 0; y < icon[i].height; y++)
688 {
689 for (x = 0; x < icon[i].width; x++)
690 {
691 unsigned int r, g, b, a;
692
693 a = (*p2 >> 24) & 0xff;
694 r = (*p2 >> 16) & 0xff;
695 g = (*p2 >> 8 ) & 0xff;
696 b = (*p2 ) & 0xff;
697 if ((a > 0) && (a < 255))
698 {
699 // unpremul
700 r = (r * 255) / a;
701 g = (g * 255) / a;
702 b = (b * 255) / a;
703 }
704 *p = (a << 24) | (r << 16) | (g << 8) | b;
705 p++;
706 p2++;
707 }
708 }
709 }
710 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_ICON,
711 data, size);
712 free(data);
713}
714
664EAPI Eina_Bool 715EAPI Eina_Bool
665ecore_x_netwm_icons_get(Ecore_X_Window win, 716ecore_x_netwm_icons_get(Ecore_X_Window win,
666 Ecore_X_Icon **icon, 717 Ecore_X_Icon **icon,
diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12.c
index 38218a5..ec23b3c 100644
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12.c
+++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12.c
@@ -347,9 +347,9 @@ ecore_x_randr_modes_info_get(Ecore_X_Window root,
347 ret[i]->vSyncStart = res->modes[i].vSyncStart; 347 ret[i]->vSyncStart = res->modes[i].vSyncStart;
348 ret[i]->vSyncEnd = res->modes[i].vSyncEnd; 348 ret[i]->vSyncEnd = res->modes[i].vSyncEnd;
349 ret[i]->vTotal = res->modes[i].vTotal; 349 ret[i]->vTotal = res->modes[i].vTotal;
350 if ((ret[i]->name = (malloc(res->modes[i].nameLength)))) 350 if ((ret[i]->name = (malloc(res->modes[i].nameLength + 1))))
351 strncpy(ret[i]->name, res->modes[i].name, 351 strncpy(ret[i]->name, res->modes[i].name,
352 res->modes[i].nameLength); 352 (res->modes[i].nameLength + 1));
353 else 353 else
354 ret[i]->name = NULL; 354 ret[i]->name = NULL;
355 355
@@ -380,6 +380,48 @@ ecore_x_randr_modes_info_get(Ecore_X_Window root,
380} 380}
381 381
382/* 382/*
383 * @brief add a mode to a display
384 * @param root window to which's screen's ressources are added
385 * @param mode_info
386 * @return Ecore_X_Randr_Mode of the added mode. Ecore_X_Randr_None if mode
387 * adding failed.
388 * @since 1.2.0
389 */
390EAPI Ecore_X_Randr_Mode
391ecore_x_randr_mode_info_add(Ecore_X_Window root,
392 Ecore_X_Randr_Mode_Info *mode_info)
393{
394#ifdef ECORE_XRANDR
395 RANDR_CHECK_1_2_RET(EINA_FALSE);
396 Ecore_X_Randr_Mode mode = Ecore_X_Randr_None;
397
398 if (_ecore_x_randr_root_validate(root) && mode_info)
399 mode = XRRCreateMode(_ecore_x_disp, root, (XRRModeInfo*)mode_info);
400
401 return mode;
402#else
403 return Ecore_X_Randr_None;
404#endif
405}
406
407/*
408 * @brief delete a mode from the display
409 * @param mode_info
410 * @since 1.2.0
411 */
412EAPI void
413ecore_x_randr_mode_del(Ecore_X_Randr_Mode mode)
414{
415#ifdef ECORE_XRANDR
416 RANDR_CHECK_1_2_RET();
417
418 XRRDestroyMode(_ecore_x_disp, mode);
419#else
420 return;
421#endif
422}
423
424/*
383 * @brief get detailed information for a given mode id 425 * @brief get detailed information for a given mode id
384 * @param root window which's screen's ressources are queried 426 * @param root window which's screen's ressources are queried
385 * @param mode the XID which identifies the mode of interest 427 * @param mode the XID which identifies the mode of interest
@@ -491,6 +533,83 @@ ecore_x_randr_crtcs_get(Ecore_X_Window root,
491#endif 533#endif
492} 534}
493 535
536/*
537 * @deprecated bad naming. Use ecore_x_randr_window_crtcs_get instead.
538 * @brief get the CRTCs, which display a certain window
539 * @param window window the displaying crtcs shall be found for
540 * @param num the number of crtcs displaying the window
541 * @return array of crtcs that display a certain window. NULL if no crtcs
542 * was found that displays the specified window.
543 */
544EAPI Ecore_X_Randr_Crtc *
545ecore_x_randr_current_crtc_get(Ecore_X_Window window,
546 int *num)
547{
548 return ecore_x_randr_window_crtcs_get(window, num);
549}
550
551/*
552 * @brief get the CRTCs, which display a certain window
553 * @param window window the displaying crtcs shall be found for
554 * @param num the number of crtcs displaying the window
555 * @return array of crtcs that display a certain window. NULL if no crtcs
556 * was found that displays the specified window.
557 * @since 1.2.0
558 */
559EAPI Ecore_X_Randr_Crtc *
560ecore_x_randr_window_crtcs_get(Ecore_X_Window window,
561 int *num)
562{
563#ifdef ECORE_XRANDR
564 Ecore_X_Window root;
565 Eina_Rectangle w_geo, c_geo;
566 Ecore_X_Randr_Crtc *crtcs;
567 Ecore_X_Randr_Mode mode;
568 Ecore_X_Randr_Output *ret = NULL;
569 Window tw;
570 int ncrtcs, i, nret = 0, rx = 0, ry = 0;
571
572 if (_randr_version < RANDR_1_2) goto _ecore_x_randr_window_crtcs_get_fail;
573
574 ecore_x_window_geometry_get(window,
575 &w_geo.x, &w_geo.y,
576 &w_geo.w, &w_geo.h);
577
578 root = ecore_x_window_root_get(window);
579 crtcs = ecore_x_randr_crtcs_get(root, &ncrtcs);
580 if (!crtcs) goto _ecore_x_randr_window_crtcs_get_fail;
581
582 /* now get window RELATIVE to root window - thats what matters. */
583 XTranslateCoordinates(_ecore_x_disp, window, root, 0, 0, &rx, &ry, &tw);
584 w_geo.x = rx;
585 w_geo.y = ry;
586
587 for (i = 0, nret = 0; i < ncrtcs; i++)
588 {
589 /* if crtc is not enabled, don't bother about it any further */
590 mode = ecore_x_randr_crtc_mode_get(root, crtcs[i]);
591 if (mode == Ecore_X_Randr_None) continue;
592
593 ecore_x_randr_crtc_geometry_get(root, crtcs[i],
594 &c_geo.x, &c_geo.y,
595 &c_geo.w, &c_geo.h);
596 if (eina_rectangles_intersect(&w_geo, &c_geo))
597 {
598 ret = realloc(ret, (sizeof(Ecore_X_Randr_Crtc) * ++nret));
599 ret[nret] = crtcs[i];
600 }
601 }
602 free(crtcs);
603
604 if (num) *num = nret;
605 return ret;
606
607_ecore_x_randr_window_crtcs_get_fail:
608#endif
609 if (num) *num = 0;
610 return NULL;
611}
612
494EAPI Ecore_X_Randr_Output * 613EAPI Ecore_X_Randr_Output *
495ecore_x_randr_outputs_get(Ecore_X_Window root, 614ecore_x_randr_outputs_get(Ecore_X_Window root,
496 int *num) 615 int *num)
@@ -1364,6 +1483,54 @@ ecore_x_randr_crtc_pos_relative_set(Ecore_X_Window root,
1364#endif 1483#endif
1365} 1484}
1366 1485
1486/*
1487 * @brief add given mode to given output
1488 * @param output the output the mode is added to
1489 * @param mode the mode added to the output
1490 * @return EINA_FALSE if output or mode equal Ecore_X_Randr_None, else EINA_TRUE
1491 * Additionally, if xcb backend is used, the success of the addition is reported
1492 * back directly.
1493 * @since 1.2.0
1494 */
1495EAPI Eina_Bool
1496ecore_x_randr_output_mode_add(Ecore_X_Randr_Output output,
1497 Ecore_X_Randr_Mode mode)
1498{
1499#ifdef ECORE_XRANDR
1500 RANDR_CHECK_1_2_RET(EINA_FALSE);
1501
1502 if ((output == Ecore_X_Randr_None) || (mode == Ecore_X_Randr_None))
1503 return EINA_FALSE;
1504
1505 XRRAddOutputMode(_ecore_x_disp, output, mode);
1506 return EINA_TRUE;
1507#else
1508 return EINA_FALSE;
1509#endif
1510}
1511
1512/*
1513 * @brief delete given mode from given output
1514 * @param output the output the mode is removed from
1515 * @param mode the mode removed from the output
1516 * @since 1.2.0
1517 */
1518EAPI void
1519ecore_x_randr_output_mode_del(Ecore_X_Randr_Output output,
1520 Ecore_X_Randr_Mode mode)
1521{
1522#ifdef ECORE_XRANDR
1523 RANDR_CHECK_1_2_RET();
1524
1525 if ((output == Ecore_X_Randr_None) || (mode == Ecore_X_Randr_None))
1526 return;
1527
1528 XRRDeleteOutputMode(_ecore_x_disp, output, mode);
1529#else
1530 return;
1531#endif
1532}
1533
1367EAPI Ecore_X_Randr_Mode * 1534EAPI Ecore_X_Randr_Mode *
1368ecore_x_randr_output_modes_get(Ecore_X_Window root, 1535ecore_x_randr_output_modes_get(Ecore_X_Window root,
1369 Ecore_X_Randr_Output output, 1536 Ecore_X_Randr_Output output,
@@ -2136,70 +2303,39 @@ ecore_x_randr_window_outputs_get(Ecore_X_Window window,
2136{ 2303{
2137#ifdef ECORE_XRANDR 2304#ifdef ECORE_XRANDR
2138 Ecore_X_Window root; 2305 Ecore_X_Window root;
2139 Eina_Rectangle w_geo, c_geo;
2140 Ecore_X_Randr_Crtc *crtcs; 2306 Ecore_X_Randr_Crtc *crtcs;
2141 Ecore_X_Randr_Mode mode; 2307 Ecore_X_Randr_Output *outputs, *ret = NULL;
2142 Ecore_X_Randr_Output *outputs, *ret = NULL, *tret; 2308 int ncrtcs, noutputs, i, nret = 0;
2143 Window tw;
2144 int ncrtcs, noutputs, i, nret = 0, rx = 0, ry = 0;
2145 2309
2146 if (_randr_version < RANDR_1_2) goto _ecore_x_randr_current_output_get_fail; 2310 if (_randr_version < RANDR_1_2) goto _ecore_x_randr_current_output_get_fail;
2147 2311
2148 ecore_x_window_geometry_get(window,
2149 &w_geo.x, &w_geo.y,
2150 &w_geo.w, &w_geo.h);
2151
2152 root = ecore_x_window_root_get(window); 2312 root = ecore_x_window_root_get(window);
2153 crtcs = ecore_x_randr_crtcs_get(root, &ncrtcs); 2313 if (!(crtcs = ecore_x_randr_window_crtcs_get(window, &ncrtcs)))
2154 if (!crtcs) goto _ecore_x_randr_current_output_get_fail; 2314 goto _ecore_x_randr_current_output_get_fail;
2155
2156 /* now get window RELATIVE to root window - thats what matters. */
2157 XTranslateCoordinates(_ecore_x_disp, window, root, 0, 0, &rx, &ry, &tw);
2158 w_geo.x = rx;
2159 w_geo.y = ry;
2160 2315
2161 for (i = 0; i < ncrtcs; i++) 2316 for (i = 0, nret = 0; i < ncrtcs; i++)
2162 { 2317 {
2163 /* if crtc is not enabled, don't bother about it any further */
2164 mode = ecore_x_randr_crtc_mode_get(root, crtcs[i]);
2165 if (mode == Ecore_X_Randr_None) continue;
2166 2318
2167 ecore_x_randr_crtc_geometry_get(root, crtcs[i], 2319 outputs = ecore_x_randr_crtc_outputs_get(root, crtcs[i],
2168 &c_geo.x, &c_geo.y, 2320 &noutputs);
2169 &c_geo.w, &c_geo.h); 2321 if (!outputs)
2170 if (eina_rectangles_intersect(&w_geo, &c_geo)) 2322 goto _ecore_x_randr_current_output_get_fail_free;
2171 { 2323 nret += noutputs;
2172 outputs = ecore_x_randr_crtc_outputs_get(root, crtcs[i], 2324 ret = realloc(ret, (nret * sizeof(Ecore_X_Randr_Output)));
2173 &noutputs); 2325 memcpy(&ret[nret], outputs, (noutputs * sizeof(Ecore_X_Randr_Output)));
2174 /* The case below should be impossible, but for safety reasons 2326 free(outputs);
2175 * remains */
2176 if (!outputs)
2177 {
2178 if (num) *num = 0;
2179 free(ret);
2180 free(crtcs);
2181 return NULL;
2182 }
2183 tret = realloc(ret, ((nret + noutputs) * sizeof(Ecore_X_Randr_Output)));
2184 if (!tret)
2185 {
2186 if (num) *num = 0;
2187 free(outputs);
2188 free(ret);
2189 free(crtcs);
2190 return NULL;
2191 }
2192 ret = tret;
2193 memcpy(&ret[nret], outputs, (noutputs * sizeof(Ecore_X_Randr_Output)));
2194 nret += noutputs;
2195 free(outputs);
2196 }
2197 } 2327 }
2198 free(crtcs); 2328 free(crtcs);
2199 2329
2200 if (num) *num = nret; 2330 if (num)
2331 *num = nret;
2332
2201 return ret; 2333 return ret;
2202 2334
2335_ecore_x_randr_current_output_get_fail_free:
2336 free(outputs);
2337 free(crtcs);
2338 free(ret);
2203_ecore_x_randr_current_output_get_fail: 2339_ecore_x_randr_current_output_get_fail:
2204#endif 2340#endif
2205 if (num) *num = 0; 2341 if (num) *num = 0;
@@ -2207,7 +2343,7 @@ _ecore_x_randr_current_output_get_fail:
2207} 2343}
2208 2344
2209/* 2345/*
2210 * @depricated bad naming. Use ecore_x_randr_window_outputs_get instead. 2346 * @deprecated bad naming. Use ecore_x_randr_window_outputs_get instead.
2211 * @brief get the outputs, which display a certain window 2347 * @brief get the outputs, which display a certain window
2212 * @param window window the displaying outputs shall be found for 2348 * @param window window the displaying outputs shall be found for
2213 * @param num the number of outputs displaying the window 2349 * @param num the number of outputs displaying the window
@@ -2215,7 +2351,7 @@ _ecore_x_randr_current_output_get_fail:
2215 * was found that displays the specified window. 2351 * was found that displays the specified window.
2216 */ 2352 */
2217 2353
2218EINA_DEPRECATED EAPI Ecore_X_Randr_Output * 2354EAPI Ecore_X_Randr_Output *
2219ecore_x_randr_current_output_get(Ecore_X_Window window, 2355ecore_x_randr_current_output_get(Ecore_X_Window window,
2220 int *num) 2356 int *num)
2221{ 2357{
diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_test.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_test.c
index c8c04e4..23eea10 100644
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_test.c
+++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_test.c
@@ -153,3 +153,15 @@ ecore_x_keysym_string_get(int keysym)
153 return XKeysymToString(keysym); 153 return XKeysymToString(keysym);
154} 154}
155 155
156EAPI int
157ecore_x_keysym_keycode_get(const char *keyname)
158{
159 int keycode = 0;
160
161 if (!strncmp(keyname, "Keycode-", 8))
162 keycode = atoi(keyname + 8);
163 else
164 keycode = XKeysymToKeycode(_ecore_x_disp, XStringToKeysym(keyname));
165
166 return keycode;
167}
diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window.c
index 1adb36b..90392bf 100644
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window.c
+++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window.c
@@ -224,7 +224,7 @@ ecore_x_window_input_new(Ecore_X_Window parent,
224 * @c _NET_WM_PID. 224 * @c _NET_WM_PID.
225 * 225 *
226 * @param win The given window. 226 * @param win The given window.
227 * @ingroup Ecore_X_Window_Properties_Groups 227 * @ingroup Ecore_X_Window_Properties_Group
228 */ 228 */
229EAPI void 229EAPI void
230ecore_x_window_defaults_set(Ecore_X_Window win) 230ecore_x_window_defaults_set(Ecore_X_Window win)
@@ -597,7 +597,7 @@ ecore_x_window_focus_at_time(Ecore_X_Window win,
597} 597}
598 598
599/** 599/**
600 * gets the focus to the window @p win. 600 * gets the window that has focus.
601 * @return The window that has focus. 601 * @return The window that has focus.
602 * @ingroup Ecore_X_Window_Focus_Functions 602 * @ingroup Ecore_X_Window_Focus_Functions
603 */ 603 */