Eina_Bool engine_gl_sdl_args(const char *engine, int width, int height) { Evas_Engine_Info_GL_SDL *einfo; int i; evas_output_method_set(evas, evas_render_method_lookup("gl_sdl")); einfo = (Evas_Engine_Info_GL_SDL *) evas_engine_info_get(evas); if (!einfo) { printf("Evas wasn't build with GL SDL backend.\n"); return EINA_FALSE; } /* the following is specific to the engine */ einfo->flags.fullscreen = fullscreen; einfo->flags.noframe = 0; if (!evas_engine_info_set(evas, (Evas_Engine_Info *) einfo)) { printf("Evas could not initialize the GL SDL Engine\n"); return EINA_FALSE; } return EINA_TRUE; }
int main(int argc, char **argv) { int rot = 0; if ((argc >= 3) && (!strcmp(argv[1], "-rot"))) rot = atoi(argv[2]); evas_init(); evas = evas_new(); evas_output_method_set(evas, evas_render_method_lookup("fb")); evas_output_size_set(evas, win_w, win_h); evas_output_viewport_set(evas, 0, 0, win_w, win_h); { Evas_Engine_Info_FB *einfo; einfo = (Evas_Engine_Info_FB *) evas_engine_info_get(evas); /* the following is specific to the engine */ einfo->info.virtual_terminal = 0; einfo->info.device_number = 0; einfo->info.refresh = 0; einfo->info.rotation = rot; evas_engine_info_set(evas, (Evas_Engine_Info *) einfo); } setup(); orig_start_time = start_time = get_time(); for (;;) { loop(); evas_render(evas); } evas_shutdown(); return 0; }
static Evas* create_canvas(int width, int height) { Evas *canvas; Evas_Engine_Info_Buffer *einfo; int method; void *pixels; method = evas_render_method_lookup("buffer"); if (unlikely(method <= 0)) { //fputs("ERROR: evas was not compiled with 'buffer' engine!\n", stderr); return NULL; } canvas = evas_new(); if (unlikely(canvas == NULL)) { //fputs("ERROR: could not instantiate new evas canvas.\n", stderr); return NULL; } evas_output_method_set(canvas, method); evas_output_size_set(canvas, width, height); evas_output_viewport_set(canvas, 0, 0, width, height); einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(canvas); if (unlikely(einfo == NULL)) { //fputs("ERROR: could not get evas engine info!\n", stderr); evas_free(canvas); return NULL; } // ARGB32 is sizeof(int), that is 4 bytes, per pixel pixels = real_malloc(width * height * sizeof(int)); if (unlikely(pixels == NULL)) { //fputs("ERROR: could not allocate canvas pixels!\n", stderr); evas_free(canvas); return NULL; } einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32; einfo->info.dest_buffer = pixels; einfo->info.dest_buffer_row_bytes = width * sizeof(int); einfo->info.use_color_key = 0; einfo->info.alpha_threshold = 0; einfo->info.func.new_update_region = NULL; einfo->info.func.free_update_region = NULL; if (unlikely(evas_engine_info_set(canvas,(Evas_Engine_Info*)einfo) == EINA_FALSE)) { PRINTMSG("ERROR: could not set evas engine info!\n"); evas_free(canvas); return NULL; } return canvas; }
PyObject *engine_buffer_setup(Evas_PyObject *o, PyObject *kwargs) { Evas_Engine_Info_Buffer *einfo; int buflen, w, h; PyObject *value, *buffer; BENCH_START evas_output_method_set(o->evas, evas_render_method_lookup("buffer")); BENCH_END einfo = (Evas_Engine_Info_Buffer *) evas_engine_info_get(o->evas); if (!einfo) { PyErr_Format(PyExc_SystemError, "Evas is not built with buffer engine support."); return NULL; } einfo->info.func.new_update_region = NULL; einfo->info.func.free_update_region = NULL; einfo->info.use_color_key = 0; einfo->info.alpha_threshold = 0; // Class wrapper ensures these kwargs exist. if (!PyArg_ParseTuple(PyDict_GetItemString(kwargs, "size"), "ii", &w, &h)) return 0; einfo->info.depth_type = PyLong_AsLong(PyDict_GetItemString(kwargs, "depth")); einfo->info.dest_buffer_row_bytes = PyLong_AsLong(PyDict_GetItemString(kwargs, "stride")); einfo->info.dest_buffer = 0; value = PyDict_GetItemString(kwargs, "buffer"); if (!value || value == Py_None) { buffer = PyBuffer_New(einfo->info.dest_buffer_row_bytes * h); if (PyObject_AsWriteBuffer(buffer, &einfo->info.dest_buffer, &buflen) == -1) return 0; } else { if (PyNumber_Check(value)) { einfo->info.dest_buffer = (void *) PyLong_AsLong(value); buffer = PyBuffer_FromReadWriteMemory(einfo->info.dest_buffer, einfo->info.dest_buffer_row_bytes * h); } else { if (PyObject_AsWriteBuffer(value, &einfo->info.dest_buffer, &buflen) == -1) return 0; if (buflen < einfo->info.dest_buffer_row_bytes * h) { PyErr_SetString(PyExc_AttributeError, "Buffer not big enough"); return 0; } buffer = value; Py_INCREF(buffer); } } BENCH_START evas_engine_info_set(o->evas, (Evas_Engine_Info *) einfo); BENCH_END return buffer; }
Eina_Bool engine_directfb_args(const char *engine, int width, int height) { Evas_Engine_Info_DirectFB *einfo; DFBWindowDescription desc; int i; evas_output_method_set(evas, evas_render_method_lookup("directfb")); einfo = (Evas_Engine_Info_DirectFB *)evas_engine_info_get(evas); if (!einfo) { printf("Evas does not support the DirectFB Engine\n"); return EINA_FALSE; } DFBCHECK(DirectFBInit(NULL, NULL)); DFBCHECK(DirectFBCreate(&_dfb)); DFBCHECK(_dfb->GetDisplayLayer(_dfb, DLID_PRIMARY, &_layer)); DFBCHECK(_dfb->CreateEventBuffer(_dfb, &_window_event)); DFBCHECK(_dfb->CreateInputEventBuffer(_dfb, DICAPS_ALL, DFB_FALSE, &_input_event)); memset(&desc, 0, sizeof(DFBWindowDescription)); desc.flags = (DWDESC_POSX | DWDESC_POSY | DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_PIXELFORMAT); desc.posx = 0; desc.posy = 0; desc.width = width; desc.height = height; desc.pixelformat = DSPF_ARGB; DFBCHECK(_layer->CreateWindow(_layer, &desc, &_dfb_window)); DFBCHECK(_dfb_window->AttachEventBuffer(_dfb_window, _window_event)); DFBCHECK(_dfb_window->SetOptions(_dfb_window, DWOP_NONE)); DFBCHECK(_dfb_window->SetOpacity(_dfb_window, 0xFF)); DFBCHECK(_dfb_window->GetSurface(_dfb_window, &_dfb_surface)); DFBCHECK(_dfb_surface->SetPorterDuff(_dfb_surface, DSPD_SRC_OVER)); einfo->info.dfb = _dfb; einfo->info.surface = _dfb_surface; if (!evas_engine_info_set(evas, (Evas_Engine_Info *) einfo)) { printf("Evas can not setup the informations of the DirectFB Engine\n"); return EINA_FALSE; } return EINA_TRUE; }
EvasTestApp::EvasTestApp(QWidget *parent, const char *name, int wFlags) : QMainWindow(parent, name, wFlags) { setCaption(tr("Evas Qtopia Demo")); evas_target_widget = new EvasTargetWidget(this, "EvasTargetWidget"); evas_init(); evas = evas_new(); evas_output_method_set(evas, evas_render_method_lookup("software_qtopia")); evas_output_size_set(evas, win_w, win_h); evas_output_viewport_set(evas, 0, 0, win_w, win_h); { Evas_Engine_Info_Software_Qtopia *einfo; einfo = (Evas_Engine_Info_Software_Qtopia *)evas_engine_info_get(evas); /* the following is specific to the engine */ einfo->info.target = evas_target_widget; evas_engine_info_set(evas, (Evas_Engine_Info *) einfo); } setup(); orig_start_time = start_time = get_time(); }
Eina_Bool engine_software_16_x11_args(const char *engine, int width, int height) { XSetWindowAttributes attr; XClassHint chint; XSizeHints szhints; Evas_Engine_Info_Software_16_X11 *einfo; int i; disp = XOpenDisplay(NULL); if (!disp) return EINA_FALSE; evas_output_method_set(evas, evas_render_method_lookup("software_16_x11")); einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(evas); if (!einfo) { printf("Evas does not support the Software 16bit X11 Engine\n"); goto close_display; } einfo->info.display = disp; attr.backing_store = NotUseful; attr.colormap = DefaultColormap(disp, DefaultScreen(disp)); attr.border_pixel = 0; attr.background_pixmap = None; attr.event_mask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask | EnterWindowMask | LeaveWindowMask | KeyPressMask | KeyReleaseMask; attr.bit_gravity = ForgetGravity; win = XCreateWindow(disp, DefaultRootWindow(disp), 0, 0, width, height, 0, DefaultDepth(disp, DefaultScreen(disp)), InputOutput, DefaultVisual(disp, DefaultScreen(disp)), CWBackingStore | CWColormap | CWBackPixmap | CWBorderPixel | CWBitGravity | CWEventMask, &attr); if (!win) goto close_display; einfo->info.drawable = win; if (!evas_engine_info_set(evas, (Evas_Engine_Info *) einfo)) { printf("Evas can not setup the informations of the Software 16bit X11 Engine\n"); goto destroy_window; } if (fullscreen) { Atom prop = XInternAtom(disp, "_NET_WM_STATE", False); Atom state = XInternAtom(disp, "_NET_WM_STATE_FULLSCREEN", False); unsigned long data = state; XChangeProperty(disp, win, prop, XA_ATOM, 32, PropModeReplace, (unsigned char*) &data, 1); } XStoreName(disp, win, "Expedite - Evas Test Suite"); chint.res_name = "expedite"; chint.res_class = "Expedite"; XSetClassHint(disp, win, &chint); szhints.flags = PMinSize | PMaxSize | PSize | USSize; szhints.min_width = szhints.max_width = width; szhints.min_height = szhints.max_height = height; XSetWMNormalHints(disp, win, &szhints); XMapWindow(disp, win); XSync(disp, False); while (!first_expose) engine_software_16_x11_loop(); return EINA_TRUE; destroy_window: XDestroyWindow(disp, win); close_display: XCloseDisplay(disp); return EINA_FALSE; }
int main( int argc, char *argv[] ) { IDirectFB *dfb; IDirectFBDisplayLayer *layer; IDirectFBSurface *bgsurface; IDirectFBImageProvider *provider; IDirectFBWindow *window1; IDirectFBWindow *window2; IDirectFBSurface *window_surface1; IDirectFBSurface *window_surface2; IDirectFBEventBuffer *buffer; DFBDisplayLayerConfig layer_config; #if ((DIRECTFB_MAJOR_VERSION == 0) && (DIRECTFB_MINOR_VERSION == 9) && (DIRECTFB_MICRO_VERSION < 23)) DFBCardCapabilities caps; #else DFBGraphicsDeviceDescription caps; #endif IDirectFBWindow* upper; DFBWindowID id1; IDirectFBFont *font; int fontheight; int err; int quit = 0; DFBCHECK(DirectFBInit( &argc, &argv )); DFBCHECK(DirectFBCreate( &dfb )); #if ((DIRECTFB_MAJOR_VERSION == 0) && (DIRECTFB_MINOR_VERSION == 9) && (DIRECTFB_MICRO_VERSION < 23)) dfb->GetCardCapabilities( dfb, &caps ); #else dfb->GetDeviceDescription( dfb, &caps ); #endif dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &layer ); if (!((caps.blitting_flags & DSBLIT_BLEND_ALPHACHANNEL) && (caps.blitting_flags & DSBLIT_BLEND_COLORALPHA ))) { layer_config.flags = DLCONF_BUFFERMODE; layer_config.buffermode = DLBM_BACKSYSTEM; layer->SetConfiguration( layer, &layer_config ); } layer->GetConfiguration( layer, &layer_config ); layer->EnableCursor ( layer, 1 ); { DFBFontDescription desc; desc.flags = DFDESC_HEIGHT; desc.height = layer_config.width/50; DFBCHECK(dfb->CreateFont( dfb, PACKAGE_DATA_DIR"/grunge.ttf", &desc, &font )); font->GetHeight( font, &fontheight ); } { DFBSurfaceDescription desc; DFBCHECK(dfb->CreateImageProvider( dfb, PACKAGE_DATA_DIR"/bg.png", &provider )); desc.flags = DSDESC_WIDTH | DSDESC_HEIGHT; desc.width = layer_config.width; desc.height = layer_config.height; DFBCHECK(dfb->CreateSurface( dfb, &desc, &bgsurface ) ); provider->RenderTo( provider, bgsurface, NULL ); provider->Release( provider ); DFBCHECK(bgsurface->SetFont( bgsurface, font )); bgsurface->SetColor( bgsurface, 0xCF, 0xCF, 0xFF, 0xFF ); bgsurface->DrawString( bgsurface, "Move the mouse over a window to activate it.", -1, 10, 0, DSTF_LEFT | DSTF_TOP ); bgsurface->SetColor( bgsurface, 0xFF, 0xCF, 0xFF, 0xFF ); bgsurface->DrawString( bgsurface, "You can drag them around, too, if you want.", -1, 10 , 40, DSTF_LEFT | DSTF_TOP ); bgsurface->SetColor( bgsurface, 0xCF, 0xCF, 0xFF, 0xFF ); bgsurface->DrawString( bgsurface, "The one with funky stuff happening and things flying around is an evas.", -1, 10, 80, DSTF_LEFT | DSTF_TOP ); layer->SetBackgroundImage( layer, bgsurface ); layer->SetBackgroundMode( layer, DLBM_IMAGE ); } { DFBWindowDescription desc; desc.flags = ( DWDESC_POSX | DWDESC_POSY | DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_CAPS ); desc.posx = 20; desc.posy = 120; desc.width = 200; desc.height = 200; desc.caps = DWCAPS_ALPHACHANNEL; DFBCHECK( layer->CreateWindow( layer, &desc, &window2 ) ); window2->GetSurface( window2, &window_surface2 ); window2->SetOpacity( window2, 0xFF ); window2->CreateEventBuffer( window2, &buffer ); { window_surface2->SetColor( window_surface2, 0x00, 0x30, 0x10, 0xc0 ); window_surface2->DrawRectangle( window_surface2, 0, 0, desc.width, desc.height ); window_surface2->SetColor( window_surface2, 0x80, 0xa0, 0x00, 0x90 ); window_surface2->FillRectangle( window_surface2, 1, 1, desc.width-2, desc.height-2 ); DFBCHECK(window_surface2->SetFont(window_surface2, font )); window_surface2->SetColor( window_surface2, 0xCF, 0xFF, 0xCF, 0xFF ); window_surface2->DrawString( window_surface2, "Pants!", -1,10, fontheight + 5, DSTF_LEFT | DSTF_TOP ); } window_surface2->Flip( window_surface2, NULL, 0 ); } { DFBWindowDescription desc; desc.flags = ( DWDESC_POSX | DWDESC_POSY | DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_CAPS ); desc.posx = 200; desc.posy = 200; desc.width = 240; desc.height = 320; desc.caps = DWCAPS_ALPHACHANNEL; DFBCHECK(layer->CreateWindow( layer, &desc, &window1 ) ); window1->GetSurface( window1, &window_surface1 ); window_surface1->SetColor( window_surface1, 0xFF, 0x20, 0x20, 0x90 ); window_surface1->DrawRectangle( window_surface1, 0, 0, desc.width, desc.height ); window_surface1->Flip( window_surface1, NULL, 0 ); window1->SetOpacity( window1, 0xFF ); window1->GetID( window1, &id1 ); window1->AttachEventBuffer( window1, buffer ); } window1->RequestFocus( window1 ); window1->RaiseToTop( window1 ); upper = window1; { evas_init(); evas = evas_new(); evas_output_method_set(evas, evas_render_method_lookup("directfb")); evas_output_size_set(evas, 240, 320); evas_output_viewport_set(evas, 0, 0, 240, 320); { Evas_Engine_Info_DirectFB *einfo; einfo = (Evas_Engine_Info_DirectFB *) evas_engine_info_get(evas); einfo->info.dfb = dfb; einfo->info.surface = window_surface1; einfo->info.flags = DSDRAW_BLEND; evas_engine_info_set(evas, (Evas_Engine_Info *) einfo); } setup(); evas_render(evas); start_time = get_time(); } while (!quit) { static IDirectFBWindow* active = NULL; static int grabbed = 0; static int startx = 0; static int starty = 0; static int endx = 0; static int endy = 0; DFBWindowEvent evt; buffer->WaitForEventWithTimeout( buffer, 0, 10 ); while (buffer->GetEvent( buffer, DFB_EVENT(&evt) ) == DFB_OK) { IDirectFBWindow* window; if (evt.window_id == id1) window = window1; else window = window2; if (active) { switch (evt.type) { case DWET_BUTTONDOWN: if (!grabbed && evt.button == DIBI_LEFT) { grabbed = 1; layer->GetCursorPosition( layer, &startx, &starty ); window->GrabPointer( window ); } break; case DWET_BUTTONUP: switch (evt.button) { case DIBI_LEFT: if (grabbed) { window->UngrabPointer( window ); grabbed = 0; } break; case DIBI_MIDDLE: upper->LowerToBottom( upper ); upper = (upper == window1) ? window2 : window1; break; case DIBI_RIGHT: quit = DIKS_DOWN; break; default: break; } break; case DWET_KEYDOWN: if (grabbed) break; switch (evt.key_id) { case DIKI_RIGHT: active->Move (active, 1, 0); break; case DIKI_LEFT: active->Move (active, -1, 0); break; case DIKI_UP: active->Move (active, 0, -1); break; case DIKI_DOWN: active->Move (active, 0, 1); break; default: break; } break; case DWET_LOSTFOCUS: if (!grabbed) active = NULL; break; default: break; } } else if (evt.type == DWET_GOTFOCUS) active = window; switch (evt.type) { case DWET_MOTION: endx = evt.cx; endy = evt.cy; break; case DWET_KEYDOWN: switch (evt.key_symbol) { case DIKS_ESCAPE: case DIKS_SMALL_Q: case DIKS_CAPITAL_Q: case DIKS_BACK: case DIKS_STOP: quit = 1; break; default: break; } break; default: break; } } if (active) { if (grabbed) { active->Move( active, endx - startx, endy - starty); startx = endx; starty = endy; } active->SetOpacity( active, (sin( myclock()/300.0 ) * 85) + 170 ); } loop(); { Eina_List *updates; updates = evas_render_updates(evas); /* efficient update.. only flip the rectangle regions that changed! */ if (updates) { DFBRegion region; Eina_List *l; for (l = updates; l; l = l->next) { Evas_Rectangle *rect; rect = l->data; region.x1 = rect->x; region.y1 = rect->y; region.x2 = rect->x + rect->w - 1; region.y2 = rect->y + rect->h - 1; window_surface1->Flip(window_surface1, ®ion, DSFLIP_BLIT); } evas_render_updates_free(updates); } } } buffer->Release( buffer ); window_surface2->Release( window_surface2 ); window_surface1->Release( window_surface1 ); window2->Release( window2 ); window1->Release( window1 ); layer->Release( layer ); bgsurface->Release( bgsurface ); dfb->Release( dfb ); evas_shutdown(); return 0; }
#include "main.h" #include <Evas_Engine_FB.h> Eina_Bool engine_fb_args(const char *engine __UNUSED__, int width __UNUSED__, int height __UNUSED__) { Evas_Engine_Info_FB *einfo; evas_output_method_set(evas, evas_render_method_lookup("fb")); einfo = (Evas_Engine_Info_FB *)evas_engine_info_get(evas); if (!einfo) { printf("Evas does not support the FB Engine\n"); return EINA_FALSE; } einfo->info.virtual_terminal = 0; einfo->info.device_number = 0; einfo->info.device_number = 0; einfo->info.refresh = 0; einfo->info.rotation = 0; if (!evas_engine_info_set(evas, (Evas_Engine_Info *) einfo)) { printf("Evas can not setup the informations of the FB Engine\n"); return EINA_FALSE; } return EINA_TRUE; }
/* external functions */ EAPI Ecore_Evas * ecore_evas_wayland_egl_new_internal(const char *disp_name, unsigned int parent, int x, int y, int w, int h, Eina_Bool frame) { Ecore_Wl_Window *p = NULL; Evas_Engine_Info_Wayland_Egl *einfo; Ecore_Evas_Interface_Wayland *iface; Ecore_Evas_Engine_Wl_Data *wdata; Ecore_Evas *ee; int method = 0, count = 0; LOGFN(__FILE__, __LINE__, __FUNCTION__); if (!(method = evas_render_method_lookup("wayland_egl"))) { ERR("Render method lookup failed for Wayland_Egl"); return NULL; } count = ecore_wl_init(disp_name); if (!count) { ERR("Failed to initialize Ecore_Wayland"); return NULL; } else if (count == 1) ecore_wl_display_iterate(); if (!(ee = calloc(1, sizeof(Ecore_Evas)))) { ERR("Failed to allocate Ecore_Evas"); goto ee_err; } if (!(wdata = calloc(1, sizeof(Ecore_Evas_Engine_Wl_Data)))) { ERR("Failed to allocate Ecore_Evas_Engine_Wl_Data"); free(ee); goto ee_err; } ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); _ecore_evas_wl_common_init(); ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_wl_engine_func; ee->engine.data = wdata; iface = _ecore_evas_wl_interface_new(); ee->engine.ifaces = eina_list_append(ee->engine.ifaces, iface); ee->driver = "wayland_egl"; if (disp_name) ee->name = strdup(disp_name); if (w < 1) w = 1; if (h < 1) h = 1; ee->x = x; ee->y = y; ee->w = w; ee->h = h; ee->req.x = ee->x; ee->req.y = ee->y; ee->req.w = ee->w; ee->req.h = ee->h; ee->rotation = 0; ee->prop.max.w = 32767; ee->prop.max.h = 32767; ee->prop.layer = 4; ee->prop.request_pos = 0; ee->prop.sticky = 0; ee->prop.draw_frame = frame; ee->alpha = EINA_FALSE; ee->evas = evas_new(); evas_data_attach_set(ee->evas, ee); evas_output_method_set(ee->evas, method); evas_output_size_set(ee->evas, ee->w, ee->h); evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); /* FIXME: This needs to be set based on theme & scale */ if (ee->prop.draw_frame) evas_output_framespace_set(ee->evas, 4, 18, 8, 22); if (parent) p = ecore_wl_window_find(parent); /* FIXME: Get if parent is alpha, and set */ wdata->parent = p; wdata->win = ecore_wl_window_new(p, x, y, w, h, ECORE_WL_WINDOW_BUFFER_TYPE_EGL_WINDOW); ee->prop.window = wdata->win->id; if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas))) { einfo->info.display = ecore_wl_display_get(); einfo->info.destination_alpha = ee->alpha; einfo->info.rotation = ee->rotation; einfo->info.depth = 32; if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) { ERR("Failed to set Evas Engine Info for '%s'", ee->driver); goto err; } } else { ERR("Failed to get Evas Engine Info for '%s'", ee->driver); goto err; } ecore_evas_callback_pre_free_set(ee, _ecore_evas_wl_common_pre_free); if (ee->prop.draw_frame) { wdata->frame = _ecore_evas_wl_common_frame_add(ee->evas); evas_object_is_frame_object_set(wdata->frame, EINA_TRUE); evas_object_move(wdata->frame, 0, 0); } _ecore_evas_register(ee); ecore_evas_input_event_register(ee); ecore_event_window_register(ee->prop.window, ee, ee->evas, (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); return ee; err: ecore_evas_free(ee); _ecore_evas_wl_common_shutdown(); ee_err: ecore_wl_shutdown(); return NULL; }
int EvasCanvas::lookupRenderMethod( const char* method ) { return evas_render_method_lookup( method ); }
Eina_Bool engine_direct3d_args(const char *engine, int width, int height) { WNDCLASS wc; RECT rect; HDC dc; MSG msg; Evas_Engine_Info_Direct3D *einfo; DWORD style; int depth; int i; instance = GetModuleHandle(NULL); if (!instance) return EINA_FALSE; wc.style = 0; wc.lpfnWndProc = MainWndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = instance; wc.hIcon = LoadIcon (NULL, IDI_APPLICATION); wc.hCursor = LoadCursor (NULL, IDC_ARROW); wc.hbrBackground = GetSysColorBrush(COLOR_BTNFACE); wc.lpszMenuName = NULL; wc.lpszClassName = "Evas_Direct3D_Test"; if(!RegisterClass(&wc)) goto free_library; rect.left = 0; rect.top = 0; rect.right = width; rect.bottom = height; AdjustWindowRect (&rect, WS_OVERLAPPEDWINDOW | WS_SIZEBOX, FALSE); window = CreateWindowEx(0, "Evas_Direct3D_Test", "Evas_Direct3D_Test", WS_OVERLAPPEDWINDOW | WS_SIZEBOX, CW_USEDEFAULT, CW_USEDEFAULT, rect.right - rect.left, rect.bottom - rect.top, NULL, NULL, instance, NULL); if (!window) goto unregister_class; /* make the window non resizable */ style = GetWindowLong(window, GWL_STYLE); style &= ~WS_THICKFRAME; if (!SetWindowLong(window, GWL_STYLE, style)) goto unregister_class; dc = GetDC(NULL); if (!dc) goto destroy_window; depth = GetDeviceCaps(dc, BITSPIXEL); ReleaseDC(NULL, dc); evas_output_method_set(evas, evas_render_method_lookup("direct3d")); einfo = (Evas_Engine_Info_Direct3D *)evas_engine_info_get(evas); if (!einfo) { fprintf(stderr, "Evas does not support the Direct3D Engine\n"); goto destroy_window; } einfo->info.window = window; einfo->info.depth = depth; einfo->info.rotation = 0; if (!evas_engine_info_set(evas, (Evas_Engine_Info *)einfo)) { printf("Evas can not setup the informations of the Direct3D Engine\n"); goto destroy_window; } /* the second parameter is ignored, as it's the first call of ShowWindow */ ShowWindow(window, SW_SHOWDEFAULT); UpdateWindow(window); return EINA_TRUE; destroy_window: DestroyWindow(window); unregister_class: UnregisterClass("Evas_Direct3D_Test", instance); free_library: FreeLibrary(instance); return EINA_FALSE; }
int main(int argc, char **argv) { WNDCLASS wc; RECT rect; HINSTANCE hinstance; MSG msg; HWND window; LPDIRECTDRAW object; LPDIRECTDRAWSURFACE surface_primary; LPDIRECTDRAWSURFACE surface_back; int depth; int running; int pause_me = 0; hinstance = GetModuleHandle(0); wc.style = 0; wc.lpfnWndProc = MainWndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hinstance; wc.hIcon = LoadIcon (NULL, IDI_APPLICATION); wc.hCursor = LoadCursor (NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)(1 + COLOR_BTNFACE); wc.lpszMenuName = NULL; wc.lpszClassName = "Evas_Software_DDraw_Test"; if(!RegisterClass(&wc)) return EXIT_FAILURE; rect.left = 0; rect.top = 0; rect.right = win_w; rect.bottom = win_h; AdjustWindowRect (&rect, WS_OVERLAPPEDWINDOW | WS_SIZEBOX, FALSE); window = CreateWindowEx(0, "Evas_Software_DDraw_Test", "Evas_Software_DDraw_Test", WS_OVERLAPPEDWINDOW | WS_SIZEBOX, CW_USEDEFAULT, CW_USEDEFAULT, rect.right - rect.left, rect.bottom - rect.top, NULL, NULL, hinstance, NULL); if (!window) return EXIT_FAILURE; if (!_directdraw_init(window, &object, &surface_primary, &surface_back, &depth, win_w, win_h)) return EXIT_FAILURE; ShowWindow(window, SW_SHOWDEFAULT); UpdateWindow(window); /* test evas_free.... :) */ evas_init(); evas = evas_new(); evas_output_method_set(evas, evas_render_method_lookup("software_ddraw")); evas_output_size_set(evas, win_w, win_h); evas_output_viewport_set(evas, 0, 0, win_w, win_h); { Evas_Engine_Info_Software_DDraw *einfo; einfo = (Evas_Engine_Info_Software_DDraw *)evas_engine_info_get(evas); /* the following is specific to the engine */ einfo->info.window = window; einfo->info.object = object; einfo->info.surface_primary = surface_primary; einfo->info.surface_back = surface_back; einfo->info.depth = depth; einfo->info.rotation = 0; evas_engine_info_set(evas, (Evas_Engine_Info *) einfo); } setup(); printf("################ evas free\n"); setdown(); evas_free(evas); printf("evas freed. DONE\n"); evas = evas_new(); evas_output_method_set(evas, evas_render_method_lookup("software_ddraw")); evas_output_size_set(evas, win_w, win_h); evas_output_viewport_set(evas, 0, 0, win_w, win_h); { Evas_Engine_Info_Software_DDraw *einfo; einfo = (Evas_Engine_Info_Software_DDraw *) evas_engine_info_get(evas); /* the following is specific to the engine */ einfo->info.window = window; einfo->info.object = object; einfo->info.surface_primary = surface_primary; einfo->info.surface_back = surface_back; einfo->info.depth = depth; einfo->info.rotation = 0; evas_engine_info_set(evas, (Evas_Engine_Info *) einfo); } setup(); printf("################ evas free\n"); setdown(); evas_free(evas); printf("evas freed. DONE\n"); evas = evas_new(); evas_output_method_set(evas, evas_render_method_lookup("software_ddraw")); evas_output_size_set(evas, win_w, win_h); evas_output_viewport_set(evas, 0, 0, win_w, win_h); { Evas_Engine_Info_Software_DDraw *einfo; einfo = (Evas_Engine_Info_Software_DDraw *) evas_engine_info_get(evas); /* the following is specific to the engine */ einfo->info.window = window; einfo->info.object = object; einfo->info.surface_primary = surface_primary; einfo->info.surface_back = surface_back; einfo->info.depth = depth; einfo->info.rotation = 0; evas_engine_info_set(evas, (Evas_Engine_Info *) einfo); } setup(); printf("################ evas free\n"); setdown(); evas_free(evas); printf("evas freed. DONE\n"); evas = evas_new(); evas_output_method_set(evas, evas_render_method_lookup("software_ddraw")); evas_output_size_set(evas, win_w, win_h); evas_output_viewport_set(evas, 0, 0, win_w, win_h); { Evas_Engine_Info_Software_DDraw *einfo; einfo = (Evas_Engine_Info_Software_DDraw *) evas_engine_info_get(evas); /* the following is specific to the engine */ einfo->info.window = window; einfo->info.object = object; einfo->info.surface_primary = surface_primary; einfo->info.surface_back = surface_back; einfo->info.depth = depth; einfo->info.rotation = 0; evas_engine_info_set(evas, (Evas_Engine_Info *) einfo); } setup(); printf("################ evas free\n"); setdown(); evas_free(evas); printf("evas freed. DONE\n"); evas = evas_new(); evas_output_method_set(evas, evas_render_method_lookup("software_ddraw")); evas_output_size_set(evas, win_w, win_h); evas_output_viewport_set(evas, 0, 0, win_w, win_h); { Evas_Engine_Info_Software_DDraw *einfo; einfo = (Evas_Engine_Info_Software_DDraw *) evas_engine_info_get(evas); /* the following is specific to the engine */ einfo->info.window = window; einfo->info.object = object; einfo->info.surface_primary = surface_primary; einfo->info.surface_back = surface_back; einfo->info.depth = depth; einfo->info.rotation = 0; evas_engine_info_set(evas, (Evas_Engine_Info *) einfo); } setup(); orig_start_time = start_time = get_time(); running = 1; while (running) { while (PeekMessage (&msg, window, 0, 0, PM_NOREMOVE)) { int res; res = GetMessage (&msg, NULL, 0, 0); TranslateMessage (&msg); DispatchMessage (&msg); if (res == 0) running = 0; } if (!(pause_me == 1)) { loop(); evas_render(evas); } } exit: setdown(); evas_free(evas); if (surface_primary) IDirectDrawSurface7_Release (surface_primary); if (object) IDirectDraw7_Release (object); evas_shutdown(); return EXIT_SUCCESS; }
void setup_cc_with_pos(int x, int y) { ControlCentre *cc; char *edjefn = malloc(PATH_MAX); char *fontpath = malloc(PATH_MAX); Evas_Coord edje_w, edje_h; CCPos *pos; cc = malloc(sizeof(ControlCentre)); controlcentre = cc; pos = get_cc_pos(); if (x >= 0 || y >= 0) { pos->x = x; pos->y = y; } /* Setup the Window */ if (!strcmp(main_config->render_method, "gl")) { #ifdef HAVE_ECORE_EVAS_GL cc->win = ecore_evas_gl_x11_new(NULL, 0, pos->x, pos->y, pos->width, pos->height); #else dml("GL not in Ecore_Evas module. Falling back on software!", 1); free(main_config->render_method); main_config->render_method = strdup("software"); cc->win = ecore_evas_software_x11_new(NULL, 0, pos->x, pos->y, pos->width, pos->height); #endif } else cc->win = ecore_evas_software_x11_new(NULL, 0, pos->x, pos->y, pos->width, pos->height); ecore_evas_title_set(cc->win, "Enotes"); ecore_evas_name_class_set(cc->win, "Enotes", "Enotes"); if (main_config->ontop == 1) ecore_evas_layer_set(cc->win, 7); else ecore_evas_layer_set(cc->win, 2); if (main_config->sticky == 1) ecore_evas_sticky_set(cc->win, 1); else ecore_evas_sticky_set(cc->win, 0); ecore_evas_borderless_set(cc->win, 1); ecore_evas_shaped_set(cc->win, 1); if (pos->x != 0 && pos->y != 0) ecore_evas_resize(cc->win, pos->x, pos->y); ecore_evas_show(cc->win); // if(main_config->ontop==1) /* Moving the damn thing */ ecore_evas_move(cc->win, pos->x, pos->y); /* Setup the Canvas, Render-Method and Font Path */ cc->evas = ecore_evas_get(cc->win); evas_output_method_set(cc->evas, evas_render_method_lookup(main_config-> render_method)); snprintf(fontpath, PATH_MAX, "%s/fonts", PACKAGE_DATA_DIR); evas_font_path_append(cc->evas, fontpath); free(fontpath); /* Draggable Setup */ cc->dragger = esmart_draggies_new(cc->win); evas_object_name_set(cc->dragger, "dragger"); evas_object_move(cc->dragger, 0, 0); evas_object_layer_set(cc->dragger, 0); evas_object_color_set(cc->dragger, 255, 255, 255, 0); esmart_draggies_button_set(cc->dragger, 1); evas_object_show(cc->dragger); /* Setup the EDJE */ cc->edje = edje_object_add(cc->evas); snprintf(edjefn, PATH_MAX, CC_EDJE, PACKAGE_DATA_DIR, main_config->theme); edje_object_file_set(cc->edje, edjefn, CC_PART); free(edjefn); evas_object_move(cc->edje, 0, 0); evas_object_layer_set(cc->edje, 1); evas_object_name_set(cc->edje, "edje"); evas_object_pass_events_set(cc->edje, 0); evas_object_show(cc->edje); if (pos->shaded) edje_object_signal_emit(cc->edje, EDJE_SIGNAL_CC_SHADE "_GO", ""); else edje_object_signal_emit(cc->edje, EDJE_SIGNAL_CC_UNSHADE "_GO", ""); /* EDJE and ECORE min, max and resizing */ edje_object_size_max_get(cc->edje, &edje_w, &edje_h); ecore_evas_size_max_set(cc->win, edje_w, edje_h); edje_object_size_min_get(cc->edje, &edje_w, &edje_h); ecore_evas_size_min_set(cc->win, edje_w, edje_h); ecore_evas_resize(cc->win, (int) edje_w, (int) edje_h); evas_object_resize(cc->edje, edje_w, edje_h); evas_object_resize(cc->dragger, edje_w, edje_h); /* Ecore Callbacks */ ecore_evas_callback_resize_set(cc->win, cc_resize); ecore_evas_callback_destroy_set(cc->win, cc_close_win); ecore_evas_callback_delete_request_set(cc->win, cc_close_win); /* Edje Callbacks */ edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_MINIMIZE, "", (void *) cc_minimize, cc->win); edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_CLOSE, "", (void *) cc_close, NULL); edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_SAVELOAD, "", (void *) cc_saveload, NULL); edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_SETTINGS, "", (void *) cc_settings, NULL); edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_NEW, "", (void *) cc_newnote, NULL); edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_SHADE, "", (void *) cc_shade, NULL); edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_UNSHADE, "", (void *) cc_unshade, NULL); free(pos); return; }