ecore_x_randr to not work for pretty much everyone. Short version,
don't memcpy something potentially Larger into something Certainly
smaller. (read on for the details).
NB: This 'should' fix all the randr problems in ecore_x (tho I have
not tested Everything).
NB: Ok, here goes:
XRRGetScreenResources returns a struct. Inside that struct is a
list of RROutputs.
RROutput is defined as (from randrproto.h):
#define RROutput CARD32
CARD32 is defined as (from X11/Xmd.h):
# ifdef LONG64
typedef unsigned long CARD64;
typedef unsigned int CARD32;
# else
typedef unsigned long CARD32;
# endif
so CARD32 can change based on the system (32/64 bit).
Ecore_X_Randr_Output is defined as (Ecore_X.h):
typedef Ecore_X_ID Ecore_X_Randr_Output;
(for reference: typedef unsigned int Ecore_X_ID)
Double bonus points if you have already spotted the problem !! ;)
SVN revision: 76306
{
if ((ret = malloc(sizeof(Ecore_X_Randr_Output) * res->noutput)))
{
- memcpy(ret, res->outputs,
- (sizeof(Ecore_X_Randr_Output) * res->noutput));
- if (num)
- *num = res->noutput;
+ int i = 0;
+
+ if (num) *num = res->noutput;
+
+ for (i = 0; i < res->noutput; i++)
+ ret[i] = res->outputs[i];
}
if (res)