/* local variables */
static Eina_Bool _randr_avail = EINA_FALSE;
+static Ecore_X_Atom connector_type = 0;
+static Ecore_X_Atom connector_number = 0;
+
#ifdef ECORE_XRANDR
# define RANDR_VERSION_1_1 ((1 << 16) | 1)
_ecore_x_randr_screen_resources_get = XRRGetScreenResources;
_randr_avail = EINA_TRUE;
+
+ connector_type = ecore_x_atom_get(RR_PROPERTY_CONNECTOR_TYPE);
+ connector_number = ecore_x_atom_get(RR_PROPERTY_CONNECTOR_NUMBER);
}
#endif
}
{
#ifdef ECORE_XRANDR
XRRPropertyInfo *info = NULL;
- Atom conn, type;
+ Atom type;
unsigned long bytes = 0;
unsigned long items = 0;
unsigned char *prop = NULL;
if (_randr_version < RANDR_VERSION_1_3) return -1;
- /* try to get the connector number atom */
- if (!(conn = XInternAtom(_ecore_x_disp, RR_PROPERTY_CONNECTOR_NUMBER, True)))
- return -1;
-
/* try to get the output property from Xrandr
*
* NB: Returns 0 on success */
- if (XRRGetOutputProperty(_ecore_x_disp, output, conn, 0, 100,
+ if (XRRGetOutputProperty(_ecore_x_disp, output, connector_number, 0, 100,
False, False, AnyPropertyType, &type, &format,
&items, &bytes, &prop))
{
free(prop);
/* try to get the output property from Xrandr */
- if ((info = XRRQueryOutputProperty(_ecore_x_disp, output, conn)))
+ if ((info = XRRQueryOutputProperty(_ecore_x_disp, output, connector_number)))
{
int ret = 0;
{
#ifdef ECORE_XRANDR
XRRPropertyInfo *info = NULL;
- Atom conn, type;
+ Atom type;
unsigned long bytes = 0;
unsigned long items = 0;
unsigned char *prop = NULL;
if (_randr_version < RANDR_VERSION_1_3) return -1;
/* try to get the connector type atom */
- if ((conn = XInternAtom(_ecore_x_disp, RR_PROPERTY_CONNECTOR_TYPE, True)))
- XRRGetOutputProperty(_ecore_x_disp, output, conn, 0, 4,
- False, False, AnyPropertyType, &type, &format,
- &items, &bytes, &prop);
+ if (XRRGetOutputProperty(_ecore_x_disp, output, connector_type, 0, 100,
+ False, False, AnyPropertyType, &type, &format,
+ &items, &bytes, &prop) != Success)
+ return -1;
if ((!prop) || (items == 0))
{
+ Atom conn;
+
/* NB: some butthead drivers (*cough* nouveau *cough*) do not
* implement randr properly. They are not using the connector type
* property of randr, but rather a "subconnector" property */
free(prop);
/* try to get the output property from Xrandr */
- if ((info = XRRQueryOutputProperty(_ecore_x_disp, output, conn)))
+ if ((info = XRRQueryOutputProperty(_ecore_x_disp, output, connector_type)))
{
int ret = 0;