EAPI char * ecore_x_atom_name_get(Ecore_X_Atom atom) { char *name; char *xname; if (!_ecore_x_disp) return NULL; LOGFN(__FILE__, __LINE__, __FUNCTION__); xname = XGetAtomName(_ecore_x_disp, atom); if (!xname) return NULL; name = strdup(xname); XFree(xname); return name; } /* ecore_x_atom_name_get */
EAPI int ecore_x_screensaver_idle_time_get(void) { #ifdef ECORE_XSS XScreenSaverInfo *xss; int idle; LOGFN(__FILE__, __LINE__, __FUNCTION__); xss = XScreenSaverAllocInfo(); XScreenSaverQueryInfo(_ecore_x_disp, RootWindow(_ecore_x_disp, DefaultScreen( _ecore_x_disp)), xss); idle = xss->idle / 1000; XFree(xss); return idle; #else return 0; #endif /* ifdef ECORE_XSS */ } /* ecore_x_screensaver_idle_time_get */
static void _evas_swapper_shm_pool_free(Wl_Swapper *ws) { LOGFN(__FILE__, __LINE__, __FUNCTION__); /* check for valid swapper */ if (!ws) return; /* check for valid pool */ if (!ws->pool) return; /* unmap any existing data */ if (ws->data) munmap(ws->data, ws->pool_size); /* destroy the shm pool */ wl_shm_pool_destroy(ws->pool); ws->pool_size = 0; ws->used_size = 0; }
EAPI Ecore_X_Rectangle * ecore_x_region_fetch(Ecore_X_Region region, int *num, Ecore_X_Rectangle *bounds){ #ifdef ECORE_XFIXES Ecore_X_Rectangle *rects; XRectangle *xrect, xbound; LOGFN(__FILE__, __LINE__, __FUNCTION__); xrect = XFixesFetchRegionAndBounds(_ecore_x_disp, region, num, &xbound); rects = _ecore_x_rectangle_x_to_ecore(xrect, *num); (*bounds).x = xbound.x; (*bounds).y = xbound.y; (*bounds).width = xbound.width; (*bounds).height = xbound.height; return rects; #else /* ifdef ECORE_XFIXES */ return NULL; #endif /* ifdef ECORE_XFIXES */ } /* ecore_x_region_fetch */
EAPI Ecore_X_Pixmap ecore_x_composite_name_window_pixmap_get(Ecore_X_Window win) { #ifdef ECORE_XCB_COMPOSITE Ecore_X_Pixmap pmap = XCB_NONE; #endif LOGFN(__FILE__, __LINE__, __FUNCTION__); CHECK_XCB_CONN; if (!_composite_avail) return XCB_NONE; #ifdef ECORE_XCB_COMPOSITE pmap = xcb_generate_id(_ecore_xcb_conn); xcb_composite_name_window_pixmap(_ecore_xcb_conn, win, pmap); // ecore_x_flush(); #endif return pmap; }
EAPI void ecore_x_icccm_state_set(Ecore_X_Window win, Ecore_X_Window_State_Hint state) { unsigned long c[2]; LOGFN(__FILE__, __LINE__, __FUNCTION__); if (state == ECORE_X_WINDOW_STATE_HINT_WITHDRAWN) c[0] = WithdrawnState; else if (state == ECORE_X_WINDOW_STATE_HINT_NORMAL) c[0] = NormalState; else if (state == ECORE_X_WINDOW_STATE_HINT_ICONIC) c[0] = IconicState; c[1] = None; XChangeProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_STATE, ECORE_X_ATOM_WM_STATE, 32, PropModeReplace, (unsigned char *)c, 2); if (_ecore_xlib_sync) ecore_x_sync(); }
/* * Get X ID (array) property * * If the property was successfully fetched the number of items stored in * val is returned, otherwise -1 is returned. * The returned array must be freed with free(). * Note: Return value 0 means that the property exists but has no elements. */ EAPI int ecore_x_window_prop_xid_list_get(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Atom type, Ecore_X_ID **val) { unsigned char *prop_ret; Atom type_ret; unsigned long bytes_after, num_ret; int format_ret; Ecore_X_Atom *alst; int num; unsigned i; Eina_Bool success; LOGFN(__FILE__, __LINE__, __FUNCTION__); *val = NULL; prop_ret = NULL; success = (XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False, type, &type_ret, &format_ret, &num_ret, &bytes_after, &prop_ret) == Success); if (_ecore_xlib_sync) ecore_x_sync(); if (!success) return -1; if (type_ret != type || format_ret != 32) num = -1; else if (num_ret == 0 || !prop_ret) num = 0; else { alst = malloc(num_ret * sizeof(Ecore_X_ID)); for (i = 0; i < num_ret; i++) alst[i] = ((unsigned long *)prop_ret)[i]; num = num_ret; *val = alst; } if (prop_ret) XFree(prop_ret); return num; }
EAPI int ecore_x_xinerama_screen_count_get(void) { #ifdef ECORE_XINERAMA int event_base, error_base; LOGFN(__FILE__, __LINE__, __FUNCTION__); if (_xin_info) XFree(_xin_info); _xin_info = NULL; if (XineramaQueryExtension(_ecore_x_disp, &event_base, &error_base)) { _xin_info = XineramaQueryScreens(_ecore_x_disp, &_xin_scr_num); if (_xin_info) return _xin_scr_num; } #endif /* ifdef ECORE_XINERAMA */ return 0; }
void _ecore_x_fixes_init(void) { #ifdef ECORE_XFIXES _fixes_major = 3; _fixes_minor = 0; LOGFN(__FILE__, __LINE__, __FUNCTION__); if (XFixesQueryVersion(_ecore_x_disp, &_fixes_major, &_fixes_minor)) { _fixes_available = 1; ECORE_X_EVENT_FIXES_SELECTION_NOTIFY = ecore_event_type_new(); } else _fixes_available = 0; #else /* ifdef ECORE_XFIXES */ _fixes_available = 0; #endif /* ifdef ECORE_XFIXES */ }
EAPI void ecore_x_window_shape_input_window_add_xy(Ecore_X_Window win, Ecore_X_Window shape_win, int x, int y) { #ifdef ShapeInput LOGFN(__FILE__, __LINE__, __FUNCTION__); XShapeCombineShape(_ecore_x_disp, win, ShapeInput, x, y, shape_win, ShapeInput, ShapeUnion); #else return; win = shape_win = x = y = 0; #endif } /* ecore_x_window_shape_input_window_add_xy */
EAPI void ecore_x_e_comp_dump_send(Ecore_X_Window win) { XEvent xev; LOGFN(__FILE__, __LINE__, __FUNCTION__); xev.xclient.type = ClientMessage; xev.xclient.display = _ecore_x_disp; xev.xclient.window = win; xev.xclient.message_type = ECORE_X_ATOM_E_COMP_DUMP; xev.xclient.format = 32; xev.xclient.data.l[0] = win; xev.xclient.data.l[1] = 0; // later xev.xclient.data.l[2] = 0; // later xev.xclient.data.l[3] = 0; // later xev.xclient.data.l[4] = 0; // later XSendEvent(_ecore_x_disp, win, False, NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask, &xev); }
/** * Sets the background color of the given window. * @param win The given window * @param r red value (0...65536, 16 bits) * @param g green value (0...65536, 16 bits) * @param b blue value (0...65536, 16 bits) */ EAPI void ecore_x_window_background_color_set(Ecore_X_Window win, unsigned short r, unsigned short g, unsigned short b) { XSetWindowAttributes attr; Colormap map; XColor col; LOGFN(__FILE__, __LINE__, __FUNCTION__); col.red = r; col.green = g; col.blue = b; map = DefaultColormap(_ecore_x_disp, DefaultScreen(_ecore_x_disp)); XAllocColor(_ecore_x_disp, map, &col); attr.background_pixel = col.pixel; XChangeWindowAttributes(_ecore_x_disp, win, CWBackPixel, &attr); }
CEnumerator* CEnumerator::NewL( CWmDrmServer* aServer, const TDesC8& aMessageBuffer ) { TBuf8<KMaxWmDrmNamespaceNameSize> nameSpace; TBuf8<KMaxWmDrmStoreNameSize> store; TBuf8<KWmDrmIdSize> hashKey; CEnumerator* self = NULL; LOGFN( "CEnumerator::NewL" ); ExtractEnumeratorComponentsL( aMessageBuffer, store, nameSpace, hashKey ); if ( hashKey.Length() > 0 ) { self = CSlotEnumerator::NewL( aServer, store, nameSpace, hashKey ); } else { self = CNameSpaceEnumerator::NewL( aServer, store, nameSpace ); } return self; }
/** * Set the content of a region. * @param region The region to destroy. * @param rects The rectangles used to set the region. * @param num The number of rectangles. * * Replace the current contents of @p region with the region formed * by the union of the rectangles @p rects. * @ingroup Ecore_X_Fixes_Group */ EAPI void ecore_x_region_set(Ecore_X_Region region, Ecore_X_Rectangle *rects, int num) { #ifdef ECORE_XCB_XFIXES xcb_rectangle_t *xrects; #endif LOGFN(__FILE__, __LINE__, __FUNCTION__); CHECK_XCB_CONN; if (!_xfixes_avail) return; #ifdef ECORE_XCB_XFIXES xrects = _ecore_xcb_rect_to_xcb(rects, num); xcb_xfixes_set_region(_ecore_xcb_conn, region, num, xrects); free(xrects); // ecore_x_flush(); #endif }
EAPI Eina_Bool ecore_x_e_illume_clipboard_geometry_get(Ecore_X_Window win, int *x, int *y, int *w, int *h) { int ret = 0; unsigned int geom[4]; LOGFN(__FILE__, __LINE__, __FUNCTION__); ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY, geom, 4); if (ret != 4) return EINA_FALSE; if (x) *x = geom[0]; if (y) *y = geom[1]; if (w) *w = geom[2]; if (h) *h = geom[3]; return EINA_TRUE; }
Eina_Bool _ecore_xcb_render_visual_supports_alpha(Ecore_X_Visual visual) { Eina_Bool ret = EINA_FALSE; #ifdef ECORE_XCB_RENDER const xcb_render_query_pict_formats_reply_t *reply; xcb_render_pictvisual_t *vis; #endif LOGFN(__FILE__, __LINE__, __FUNCTION__); CHECK_XCB_CONN; if (!visual) return EINA_FALSE; if (!_render_avail) return EINA_FALSE; #ifdef ECORE_XCB_RENDER reply = xcb_render_util_query_formats(_ecore_xcb_conn); if (!reply) return EINA_FALSE; vis = xcb_render_util_find_visual_format(reply, ((xcb_visualtype_t *)visual)->visual_id); if (vis) { xcb_render_pictforminfo_t temp; xcb_render_pictforminfo_t *format; temp.id = vis->format; format = xcb_render_util_find_format(reply, XCB_PICT_FORMAT_ID, &temp, 0); if ((format->type == XCB_RENDER_PICT_TYPE_DIRECT) && (format->direct.alpha_mask)) ret = EINA_TRUE; } #endif return ret; }
/** * @brief Get a array containing the protocols of @a win * @note If there aren't any properties to be counted or any protocols to get * then the function returns NULL. * @param win The window for which protocol list will be got. * @param num_ret Contains the number of elements of the array to be returned. * @return The array that contains the protocols. */ EAPI Ecore_X_WM_Protocol * ecore_x_window_prop_protocol_list_get(Ecore_X_Window win, int *num_ret) { Atom *protos = NULL; int i, protos_count = 0; Ecore_X_WM_Protocol *prot_ret = NULL; Eina_Bool success; LOGFN(__FILE__, __LINE__, __FUNCTION__); success = XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count); if (_ecore_xlib_sync) ecore_x_sync(); if (!success) return NULL; if ((!protos) || (protos_count <= 0)) return NULL; prot_ret = calloc(1, protos_count * sizeof(Ecore_X_WM_Protocol)); if (!prot_ret) { XFree(protos); return NULL; } for (i = 0; i < protos_count; i++) { Ecore_X_WM_Protocol j; prot_ret[i] = -1; for (j = 0; j < ECORE_X_WM_PROTOCOL_NUM; j++) { if (_ecore_x_atoms_wm_protocols[j] == protos[i]) prot_ret[i] = j; } } XFree(protos); *num_ret = protos_count; return prot_ret; }
EAPI Eina_Bool ecore_x_selection_convert(Ecore_X_Atom selection, Ecore_X_Atom target, void **data_ret, int *size, Ecore_X_Atom *targtype, int *typesize) { Ecore_X_Selection_Intern *sel; Ecore_X_Selection_Converter *cnv; void *data = NULL; char *tgt_str; LOGFN(__FILE__, __LINE__, __FUNCTION__); sel = _ecore_xcb_selection_get(selection); tgt_str = _ecore_xcb_selection_target_get(target); for (cnv = _converters; cnv; cnv = cnv->next) { if (cnv->target == target) { int r; r = cnv->convert(tgt_str, sel->data, sel->length, &data, size, targtype, typesize); free(tgt_str); if (r) { if (data_ret) *data_ret = data; return r; } else return EINA_FALSE; } } free(tgt_str); return EINA_FALSE; }
/* * Get X ID (array) property * * At most len items are returned in val. * If the property was successfully fetched the number of items stored in * val is returned, otherwise -1 is returned. * Note: Return value 0 means that the property exists but has no elements. */ EAPI int ecore_x_window_prop_xid_get(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Atom type, Ecore_X_ID *lst, unsigned int len) { unsigned char *prop_ret; Atom type_ret; unsigned long bytes_after, num_ret; int format_ret; int num; unsigned i; LOGFN(__FILE__, __LINE__, __FUNCTION__); prop_ret = NULL; if (XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False, type, &type_ret, &format_ret, &num_ret, &bytes_after, &prop_ret) != Success) return -1; if (type_ret != type || format_ret != 32) num = -1; else if (num_ret == 0 || !prop_ret) num = 0; else { if (num_ret < len) len = num_ret; for (i = 0; i < len; i++) lst[i] = ((unsigned long *)prop_ret)[i]; num = len; } if (prop_ret) XFree(prop_ret); return num; }
void evas_swapper_buffer_idle_flush(Wl_Swapper *ws) { int i = 0; LOGFN(__FILE__, __LINE__, __FUNCTION__); /* check for valid swapper */ if (!ws) return; /* loop the swapper's buffers and free them */ for (i = 0; i < ws->buff_num; i++) { Wl_Buffer *wb = NULL; /* try to get out Wl_Buffer struct */ if (!(wb = (&(ws->buff[i])))) continue; /* if this buffer is not valid, then unmap data */ if (!wb->valid) _evas_swapper_buffer_free(wb); } }
void vmsWinSockHttpTrafficCollector::OnBeforeCloseSocket(SOCKET s) { LOGFN ("vmsWinSockHttpTrafficCollector::OnBeforeCloseSocket"); EnterCriticalSection (&m_pHttpTraffic->m_csModifyDialogsVector); int nIndex = m_pHttpTraffic->FindDialogIndexBySocket (s); if (nIndex != -1) { vmsHttpTrafficCollector::HttpDialogPtr spDlg = m_pHttpTraffic->m_vDialogsInProgress [nIndex]; assert (spDlg != NULL); m_pHttpTraffic->CloseDialog (spDlg); } for (size_t i = 0; i < m_pHttpTraffic->m_vCompletedDialogs.size (); i++) { if (m_pHttpTraffic->m_vCompletedDialogs [i]->s == s) m_pHttpTraffic->m_vCompletedDialogs [i]->s = INVALID_SOCKET; } LeaveCriticalSection (&m_pHttpTraffic->m_csModifyDialogsVector); }
/** * Sends a delete request to the given window. * @param win The given window. * @ingroup Ecore_X_Window_Destroy_Group */ EAPI void ecore_x_window_delete_request_send(Ecore_X_Window win) { XEvent xev; /* sorry sir, deleting the root window doesn't sound like * a smart idea. */ if (!win) return; LOGFN(__FILE__, __LINE__, __FUNCTION__); xev.xclient.type = ClientMessage; xev.xclient.display = _ecore_x_disp; xev.xclient.window = win; xev.xclient.message_type = ECORE_X_ATOM_WM_PROTOCOLS; xev.xclient.format = 32; xev.xclient.data.l[0] = ECORE_X_ATOM_WM_DELETE_WINDOW; xev.xclient.data.l[1] = CurrentTime; XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev); }
EAPI void ecore_x_e_comp_sync_draw_done_send(Ecore_X_Window root, Ecore_X_Window win) { XEvent xev; LOGFN(__FILE__, __LINE__, __FUNCTION__); if (!root) root = DefaultRootWindow(_ecore_x_disp); xev.xclient.type = ClientMessage; xev.xclient.display = _ecore_x_disp; xev.xclient.window = win; xev.xclient.message_type = ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE; xev.xclient.format = 32; xev.xclient.data.l[0] = win; xev.xclient.data.l[1] = 0; // later xev.xclient.data.l[2] = 0; // later xev.xclient.data.l[3] = 0; // later xev.xclient.data.l[4] = 0; // later XSendEvent(_ecore_x_disp, root, False, SubstructureRedirectMask | SubstructureNotifyMask, &xev); }
/* * Get CARD32 (array) property * * At most len items are returned in val. * If the property was successfully fetched the number of items stored in * val is returned, otherwise -1 is returned. * Note: Return value 0 means that the property exists but has no elements. */ EAPI int ecore_x_window_prop_card32_get(Ecore_X_Window win, Ecore_X_Atom atom, unsigned int *val, unsigned int len) { unsigned char *prop_ret; Atom type_ret; unsigned long bytes_after, num_ret; int format_ret; unsigned int i; int num; LOGFN(__FILE__, __LINE__, __FUNCTION__); prop_ret = NULL; if (XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False, XA_CARDINAL, &type_ret, &format_ret, &num_ret, &bytes_after, &prop_ret) != Success) return -1; if (type_ret != XA_CARDINAL || format_ret != 32) num = -1; else if (num_ret == 0 || !prop_ret) num = 0; else { if (num_ret < len) len = num_ret; for (i = 0; i < len; i++) val[i] = ((unsigned long *)prop_ret)[i]; num = len; } if (_ecore_xlib_sync) ecore_x_sync(); if (prop_ret) XFree(prop_ret); return num; }
EAPI void ecore_x_window_shape_input_rectangles_add(Ecore_X_Window win, Ecore_X_Rectangle *rects, int num) { #ifdef ShapeInput XRectangle *rect = NULL; int i; LOGFN(__FILE__, __LINE__, __FUNCTION__); if (num > 0) { rect = malloc(sizeof(XRectangle) * num); if (!rect) return; for (i = 0; i < num; i++) { rect[i].x = rects[i].x; rect[i].y = rects[i].y; rect[i].width = rects[i].width; rect[i].height = rects[i].height; } } XShapeCombineRectangles(_ecore_x_disp, win, ShapeInput, 0, 0, rect, num, ShapeUnion, Unsorted); if (_ecore_xlib_sync) ecore_x_sync(); if (rect) free(rect); #else return; win = rects = num = 0; #endif }
EAPI void ecore_x_window_shape_input_window_set_xy(Ecore_X_Window win, Ecore_X_Window shape_win, int x, int y) { #ifdef ShapeInput LOGFN(__FILE__, __LINE__, __FUNCTION__); XShapeCombineShape(_ecore_x_disp, win, ShapeInput, x, y, shape_win, ShapeInput, ShapeSet); if (_ecore_xlib_sync) ecore_x_sync(); #else return; win = shape_win = x = y = 0; #endif }
EAPI int ecore_x_test_fake_key_up(const char *key) { #ifdef ECORE_XTEST KeyCode keycode = 0; KeySym keysym; LOGFN(__FILE__, __LINE__, __FUNCTION__); if (!strncmp(key, "Keycode-", 8)) keycode = atoi(key + 8); else { keysym = XStringToKeysym(key); if (keysym == NoSymbol) return 0; keycode = XKeysymToKeycode(_ecore_x_disp, keysym); } if (keycode == 0) return 0; return XTestFakeKeyEvent(_ecore_x_disp, keycode, 0, 0); #else return 0; #endif }
// ---------------------------------------------------------------------------- // CWmDrmDlaDefaultHttpManager::DoStartL // ---------------------------------------------------------------------------- void CWmDrmDlaDefaultHttpManager::DoStartL( const TDesC8& aUrl, const RArray<CWmDrmDlaDefaultHttpManager::THeader>& aHeaders ) { LOGFN( "CWmDrmDlaDefaultHttpManager::DoStartL" ); CleanupTransaction(); // Store callers URL iSrcAddress = aUrl.AllocL(); // Store headers TInt nofheaders = aHeaders.Count(); for ( TInt i = 0; i < nofheaders; i++ ) { iHdrFields.AppendL( aHeaders[i].iField ); iHdrValues.AppendL( aHeaders[i].iVal.AllocL() ); } if ( (iState == EOpen) && iKeepAlive ) { TConnectionInfo connectionInfo; TRAPD(err, GetConnectionInfoL(connectionInfo) ); if ( err || ( connectionInfo.iIapId != iIapNumber && iIapNumber != 0 && connectionInfo.iIapId != 0 ) ) { CleanupConnection(); iState = EStart; } } else { iState = EConstructed == iState ? EStart : EOpen; } iError = KErrNone; iCredentialsOk = ETrue; CompleteSelf(); }
EAPI Ecore_X_Rectangle * ecore_x_window_shape_rectangles_get(Ecore_X_Window win, int *num_ret) { XRectangle *rect; Ecore_X_Rectangle *rects = NULL; int i, num = 0, ord; LOGFN(__FILE__, __LINE__, __FUNCTION__); rect = XShapeGetRectangles(_ecore_x_disp, win, ShapeBounding, &num, &ord); if (_ecore_xlib_sync) ecore_x_sync(); if (rect) { if (num < 1) { XFree(rect); if (num_ret) *num_ret = 0; return NULL; } rects = malloc(sizeof(Ecore_X_Rectangle) * num); if (!rects) { XFree(rect); if (num_ret) *num_ret = 0; return NULL; } for (i = 0; i < num; i++) { rects[i].x = rect[i].x; rects[i].y = rect[i].y; rects[i].width = rect[i].width; rects[i].height = rect[i].height; } XFree(rect); } if (num_ret) *num_ret = num; return rects; }
/** * @brief Set a property of Ecore_X_Window. * @param win The window for which the property will be set. * @param property The property of the window to be set. * @param type The type of the property that will be set. * @param size The size of the property that will be set. * @param data The data of the property that will be set. * @param number The size of data. */ EAPI void ecore_x_window_prop_property_set(Ecore_X_Window win, Ecore_X_Atom property, Ecore_X_Atom type, int size, void *data, int number) { LOGFN(__FILE__, __LINE__, __FUNCTION__); if (win == 0) win = DefaultRootWindow(_ecore_x_disp); if (size != 32) XChangeProperty(_ecore_x_disp, win, property, type, size, PropModeReplace, (unsigned char *)data, number); else { unsigned long *dat; int i, *ptr; dat = malloc(sizeof(unsigned long) * number); if (dat) { for (ptr = (int *)data, i = 0; i < number; i++) dat[i] = ptr[i]; XChangeProperty(_ecore_x_disp, win, property, type, size, PropModeReplace, (unsigned char *)dat, number); free(dat); } } if (_ecore_xlib_sync) ecore_x_sync(); }