This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch evas-sdl3-rewrite
in repository efl.
View the commit online.
commit b948a518bc3ac19f9c9aaf374be1d54eb3068cc3
Author: Swagtoy <[email protected]>
AuthorDate: Sun May 10 14:19:05 2026 -0400
ecore_evas_sdl: Completely strip away the old code for the new age
The old code did not work at all because of threading; it was
originally written back when SDL1 was a thing, and hasn't seen the
light of day since.
It serves as an okay boilerplate, but there isn't going to be much
original code leftover in the future.
It's also now wired up to the new software_sdl backend instead of just
using the buffer backend. Later there will be GL support, but for
simplicity purposes.. not now.
---
.../ecore_evas/engines/sdl/ecore_evas_sdl.c | 471 +++++++--------------
1 file changed, 142 insertions(+), 329 deletions(-)
diff --git a/src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c b/src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c
index be2aaa563e..1f48912630 100644
--- a/src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c
+++ b/src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c
@@ -5,7 +5,7 @@
#include <stdlib.h>
#include <string.h>
-#include <SDL2/SDL.h>
+#include <SDL3/SDL.h>
#include <Ecore.h>
#include "ecore_private.h"
@@ -13,6 +13,8 @@
#include <Ecore_Input_Evas.h>
#include <Ecore_Sdl.h>
#include <Evas_Engine_Buffer.h>
+#include <Evas_Engine_Software_SDL.h>
+// TODO
#ifdef BUILD_ECORE_EVAS_OPENGL_SDL
# include <Evas_Engine_GL_SDL.h>
#endif
@@ -38,14 +40,6 @@
# define EMODAPI
#endif
-/*
- * SDL only handle one window at a time. That's by definition, there is nothing wrong here.
- *
- */
-
-/* static char *ecore_evas_default_display = "0"; */
-/* static Ecore_List *ecore_evas_input_devices = NULL; */
-
typedef struct _Ecore_Evas_SDL_Switch_Data Ecore_Evas_SDL_Switch_Data;
struct _Ecore_Evas_SDL_Switch_Data
{
@@ -62,40 +56,17 @@ static Ecore_Event_Handler *ecore_evas_event_handlers[4] = {
NULL, NULL, NULL, NULL
};
-static const char *ecore_evas_sdl_default = "EFL SDL";
static Ecore_Poller *ecore_evas_event;
-static int _ecore_evas_fps_debug = 0;
-static int ecore_evas_sdl_count = 0;
static Ecore_Evas *
_ecore_evas_sdl_match(unsigned int windowID)
{
- return SDL_GetWindowData(SDL_GetWindowFromID(windowID), "_Ecore_Evas");
-}
-
-static void *
-_ecore_evas_sdl_switch_buffer(void *data, void *dest EINA_UNUSED)
-{
- Ecore_Evas_SDL_Switch_Data *swd = data;
- void *pixels;
- int pitch;
-
- /* Push current buffer to screen */
- SDL_UnlockTexture(swd->pages[swd->current]);
- SDL_RenderCopy(swd->r, swd->pages[swd->current], NULL, NULL);
- SDL_RenderPresent(swd->r);
-
- /* Switch to next buffer for rendering */
- swd->current = (swd->current + 1) % 2;
- if (SDL_LockTexture(swd->pages[swd->current], NULL, &pixels, &pitch) < 0)
- return NULL;
-
- return pixels;
+ return SDL_GetPointerProperty(SDL_GetWindowProperties(SDL_GetWindowFromID(windowID)), "_Ecore_Evas", NULL);
}
static Eina_Bool
_ecore_evas_sdl_event_got_focus(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
+{ printf("%s\n", __FUNCTION__); // yes im too lazy to use ecore
Ecore_Sdl_Event_Window *ev = event;
Ecore_Evas *ee;
@@ -108,7 +79,7 @@ _ecore_evas_sdl_event_got_focus(void *data EINA_UNUSED, int type EINA_UNUSED, vo
static Eina_Bool
_ecore_evas_sdl_event_lost_focus(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
-{
+{ printf("%s\n", __FUNCTION__);
Ecore_Sdl_Event_Window *ev = event;
Ecore_Evas *ee;
@@ -122,7 +93,7 @@ _ecore_evas_sdl_event_lost_focus(void *data EINA_UNUSED, int type EINA_UNUSED, v
static Eina_Bool
_ecore_evas_sdl_event_video_resize(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
+{ printf("%s\n", __FUNCTION__);
Ecore_Sdl_Event_Video_Resize *e;
Ecore_Evas *ee;
int rmethod;
@@ -132,46 +103,6 @@ _ecore_evas_sdl_event_video_resize(void *data EINA_UNUSED, int type EINA_UNUSED,
if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
- rmethod = evas_output_method_get(ee->evas);
- if (rmethod == evas_render_method_lookup("buffer"))
- {
- Evas_Engine_Info_Buffer *einfo;
-
- einfo = (Evas_Engine_Info_Buffer *) evas_engine_info_get(ee->evas);
- if (einfo)
- {
- Ecore_Evas_SDL_Switch_Data *swd = (Ecore_Evas_SDL_Switch_Data*)(ee + 1);
- void *pixels;
- int pitch;
-
- SDL_UnlockTexture(swd->pages[swd->current]);
-
- SDL_DestroyTexture(swd->pages[0]);
- SDL_DestroyTexture(swd->pages[1]);
-
- SDL_RenderClear(swd->r);
-
- swd->pages[0] = SDL_CreateTexture(swd->r, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, e->w, e->h);
- swd->pages[1] = SDL_CreateTexture(swd->r, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, e->w, e->h);
-
- SDL_LockTexture(swd->pages[swd->current], NULL, &pixels, &pitch);
-
- einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32;
- einfo->info.switch_data = swd;
- einfo->info.dest_buffer = pixels;
- einfo->info.dest_buffer_row_bytes = pitch;
- 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;
- einfo->info.func.switch_buffer = _ecore_evas_sdl_switch_buffer;
- if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *) einfo))
- {
- return EINA_FALSE;
- }
- }
- }
-
ee->w = e->w;
ee->h = e->h;
ee->req.w = e->w;
@@ -185,7 +116,7 @@ _ecore_evas_sdl_event_video_resize(void *data EINA_UNUSED, int type EINA_UNUSED,
static Eina_Bool
_ecore_evas_sdl_event_video_expose(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
+{ printf("%s\n", __FUNCTION__);
Ecore_Sdl_Event_Window *ev = event;
Ecore_Evas *ee;
int w;
@@ -195,6 +126,7 @@ _ecore_evas_sdl_event_video_expose(void *data EINA_UNUSED, int type EINA_UNUSED,
if (!ee) return ECORE_CALLBACK_PASS_ON;
evas_output_size_get(ee->evas, &w, &h);
+
evas_damage_rectangle_add(ee->evas, 0, 0, w, h);
return ECORE_CALLBACK_PASS_ON;
@@ -203,28 +135,34 @@ _ecore_evas_sdl_event_video_expose(void *data EINA_UNUSED, int type EINA_UNUSED,
static Eina_Bool
_ecore_evas_sdl_event(void *data EINA_UNUSED)
{
+ // RENDERING...
+ Ecore_Evas *ee = data;
+ Evas_Engine_Info_Software_SDL *info = (Evas_Engine_Info_Software_SDL *) evas_engine_info_get(ee->evas);
+ Ecore_Evas_SDL_Switch_Data *swd = (Ecore_Evas_SDL_Switch_Data*) (ee + 1);
ecore_sdl_feed_events();
+
+ // XXX: this is not sufficient at all
+ SDL_Surface *surface = SDL_GetWindowSurface(swd->w);
+ SDL_BlitSurface(info->surface, NULL, surface, NULL);
+ if (!SDL_UpdateWindowSurface(swd->w))
+ printf("Couldn't update window surface: %s\n", SDL_GetError());
+
return ECORE_CALLBACK_RENEW;
}
static int
-_ecore_evas_sdl_init(int w EINA_UNUSED, int h EINA_UNUSED)
-{
+_ecore_evas_sdl_init(void* data, int w EINA_UNUSED, int h EINA_UNUSED)
+{ printf("%s\n", __FUNCTION__);
_ecore_evas_init_count++;
if (_ecore_evas_init_count > 1) return _ecore_evas_init_count;
-#ifndef _WIN32
- if (getenv("ECORE_EVAS_FPS_DEBUG")) _ecore_evas_fps_debug = 1;
-#endif /* _WIN32 */
// this is pretty bad: poller? and set poll time? pol time is meant to be
// adjustable for things like polling battery state, or amoutn of spare
// memory etc.
//
- ecore_evas_event = ecore_poller_add(ECORE_POLLER_CORE, 1, _ecore_evas_sdl_event, NULL);
+ // to whoever wrote the above comment: agreed!
+ ecore_evas_event = ecore_poller_add(ECORE_POLLER_CORE, 1, _ecore_evas_sdl_event, data);
ecore_poller_poll_interval_set(ECORE_POLLER_CORE, 0.006);
-#ifndef _WIN32
- if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_init();
-#endif /* _WIN32 */
ecore_event_evas_init();
@@ -238,7 +176,7 @@ _ecore_evas_sdl_init(int w EINA_UNUSED, int h EINA_UNUSED)
static int
_ecore_evas_sdl_shutdown(void)
-{
+{ printf("%s\n", __FUNCTION__);
_ecore_evas_init_count--;
if (_ecore_evas_init_count == 0)
{
@@ -249,9 +187,6 @@ _ecore_evas_sdl_shutdown(void)
ecore_event_evas_shutdown();
ecore_poller_del(ecore_evas_event);
ecore_evas_event = NULL;
-#ifndef _WIN32
- if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_shutdown();
-#endif /* _WIN32 */
}
if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0;
return _ecore_evas_init_count;
@@ -259,34 +194,21 @@ _ecore_evas_sdl_shutdown(void)
static void
_ecore_evas_sdl_free(Ecore_Evas *ee)
-{
+{ printf("%s\n", __FUNCTION__);
Ecore_Evas_SDL_Switch_Data *swd = (Ecore_Evas_SDL_Switch_Data*) (ee + 1);
ecore_event_window_unregister(SDL_GetWindowID(swd->w));
- if (swd->pages[swd->current])
- SDL_UnlockTexture(swd->pages[swd->current]);
-
- if (swd->pages[0])
- SDL_DestroyTexture(swd->pages[0]);
- if (swd->pages[1])
- SDL_DestroyTexture(swd->pages[1]);
- if (swd->r)
- SDL_DestroyRenderer(swd->r);
- if (swd->w)
- SDL_DestroyWindow(swd->w);
+ SDL_DestroyWindow(swd->w);
_ecore_evas_sdl_shutdown();
ecore_sdl_shutdown();
- ecore_evas_sdl_count--;
-
- SDL_VideoQuit();
}
static void
_ecore_evas_resize(Ecore_Evas *ee, int w, int h)
-{
- int rmethod;
+{ printf("%s\n", __FUNCTION__);
+ Ecore_Evas_SDL_Switch_Data *swd = (Ecore_Evas_SDL_Switch_Data*)(ee + 1);
if ((w == ee->w) && (h == ee->h)) return;
ee->req.w = w;
@@ -294,46 +216,7 @@ _ecore_evas_resize(Ecore_Evas *ee, int w, int h)
ee->w = w;
ee->h = h;
- rmethod = evas_output_method_get(ee->evas);
- if (rmethod == evas_render_method_lookup("buffer"))
- {
- Evas_Engine_Info_Buffer *einfo;
-
- einfo = (Evas_Engine_Info_Buffer *) evas_engine_info_get(ee->evas);
- if (einfo)
- {
- Ecore_Evas_SDL_Switch_Data *swd = (Ecore_Evas_SDL_Switch_Data*)(ee + 1);
- void *pixels;
- int pitch;
-
- SDL_UnlockTexture(swd->pages[swd->current]);
-
- SDL_DestroyTexture(swd->pages[0]);
- SDL_DestroyTexture(swd->pages[1]);
-
- SDL_RenderClear(swd->r);
-
- swd->pages[0] = SDL_CreateTexture(swd->r, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, w, h);
- swd->pages[1] = SDL_CreateTexture(swd->r, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, w, h);
-
- SDL_LockTexture(swd->pages[swd->current], NULL, &pixels, &pitch);
-
- einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32;
- einfo->info.switch_data = swd;
- einfo->info.dest_buffer = pixels;
- einfo->info.dest_buffer_row_bytes = pitch;
- 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;
- einfo->info.func.switch_buffer = _ecore_evas_sdl_switch_buffer;
- if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *) einfo))
- {
- return;
- }
- }
- }
-
+ SDL_SetWindowSize(swd->w, w, h);
evas_output_size_set(ee->evas, ee->w, ee->h);
evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
@@ -357,111 +240,114 @@ _ecore_evas_move_resize(Ecore_Evas *ee, int x, int y, int w, int h)
static void
_ecore_evas_show(Ecore_Evas *ee)
-{
+{ printf("%s\n", __FUNCTION__);
+
ee->prop.withdrawn = EINA_FALSE;
if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
+
+ printf("show %d %d\n", ee->w, ee->h);
+
if (ecore_evas_focus_device_get(ee, NULL)) return;
_ecore_evas_focus_device_set(ee, NULL, EINA_TRUE);
evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
}
-
static void
_ecore_evas_title_set(Ecore_Evas *ee, const char *t)
-{
+{ printf("%s %s\n", __FUNCTION__, t);
Ecore_Evas_SDL_Switch_Data *swd = (Ecore_Evas_SDL_Switch_Data*)(ee + 1);
- SDL_SetWindowTitle(swd->w, t);
+ SDL_SetWindowTitle(swd->w, strfry(strdup(t ? t : "something")));
}
static Ecore_Evas_Engine_Func _ecore_sdl_engine_func =
{
- _ecore_evas_sdl_free,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- _ecore_evas_resize,
- _ecore_evas_move_resize,
- NULL,
- NULL,
- _ecore_evas_show,
- NULL,
- NULL,
- NULL,
- NULL,
- _ecore_evas_title_set,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL, //transparent
- NULL, // profiles_set
- NULL, // profile_set
+ .fn_free = _ecore_evas_sdl_free,
+ .fn_callback_resize_set = NULL,
+ .fn_callback_move_set = NULL,
+ .fn_callback_show_set = NULL,
+ .fn_callback_hide_set = NULL,
+ .fn_callback_delete_request_set = NULL,
+ .fn_callback_destroy_set = NULL,
+ .fn_callback_focus_in_set = NULL,
+ .fn_callback_focus_out_set = NULL,
+ .fn_callback_mouse_in_set = NULL,
+ .fn_callback_mouse_out_set = NULL,
+ .fn_callback_sticky_set = NULL,
+ .fn_callback_unsticky_set = NULL,
+ .fn_callback_pre_render_set = NULL,
+ .fn_callback_post_render_set = NULL,
+ .fn_move = NULL,
+ .fn_managed_move = NULL,
+ .fn_resize = _ecore_evas_resize,
+ .fn_move_resize = _ecore_evas_move_resize,
+ .fn_rotation_set = NULL,
+ .fn_shaped_set = NULL,
+ .fn_show = _ecore_evas_show,
+ .fn_hide = NULL,
+ .fn_raise = NULL,
+ .fn_lower = NULL,
+ .fn_activate = NULL,
+ .fn_title_set = _ecore_evas_title_set,
+ .fn_name_class_set = NULL,
+ .fn_size_min_set = NULL,
+ .fn_size_max_set = NULL,
+ .fn_size_base_set = NULL,
+ .fn_size_step_set = NULL,
+ .fn_object_cursor_set = NULL,
+ .fn_object_cursor_unset = NULL,
+ .fn_layer_set = NULL,
+ .fn_focus_set = NULL,
+ .fn_iconified_set = NULL,
+ .fn_borderless_set = NULL,
+ .fn_override_set = NULL,
+ .fn_maximized_set = NULL,
+ .fn_fullscreen_set = NULL,
+ .fn_avoid_damage_set = NULL,
+ .fn_withdrawn_set = NULL,
+ .fn_sticky_set = NULL,
+ .fn_ignore_events_set = NULL,
+ .fn_alpha_set = NULL,
+ .fn_transparent_set = NULL,
+ .fn_profiles_set = NULL,
+ .fn_profile_set = NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+ .fn_window_group_set = NULL,
+ .fn_aspect_set = NULL,
+ .fn_urgent_set = NULL,
+ .fn_modal_set = NULL,
+ .fn_demands_attention_set = NULL,
+ .fn_focus_skip_set = NULL,
- NULL, // render
- NULL, // screen_geometry_get
- NULL, // screen_dpi_get
- NULL,
- NULL, // msg_send
+ .fn_render = NULL,
+ .fn_screen_geometry_get = NULL,
+ .fn_screen_dpi_get = NULL,
+ .fn_msg_parent_send = NULL,
+ .fn_msg_send = NULL,
- NULL, // pointer_xy_get
- NULL, // pointer_warp
+ .fn_pointer_xy_get = NULL,
+ .fn_pointer_warp = NULL,
- NULL, // wm_rot_preferred_rotation_set
- NULL, // wm_rot_available_rotations_set
- NULL, // wm_rot_manual_rotation_done_set
- NULL, // wm_rot_manual_rotation_done
+ .fn_wm_rot_preferred_rotation_set = NULL,
+ .fn_wm_rot_available_rotations_set = NULL,
+ .fn_wm_rot_manual_rotation_done_set = NULL,
+ .fn_wm_rot_manual_rotation_done = NULL,
- NULL, // aux_hints_set
+ .fn_aux_hints_set = NULL,
- NULL, // fn_animator_register
- NULL, // fn_animator_unregister
+ .fn_animator_register = NULL,
+ .fn_animator_unregister = NULL,
- NULL, // fn_evas_changed
- NULL, //fn_focus_device_set
- NULL, //fn_callback_focus_device_in_set
- NULL, //fn_callback_focus_device_out_set
- NULL, //fn_callback_device_mouse_in_set
- NULL, //fn_callback_device_mouse_out_set
- NULL, //fn_pointer_device_xy_get
- NULL, //fn_prepare
- NULL, //fn_last_tick_get
- NULL, //fn_selection_claim
- NULL, //fn_selection_has_owner
- NULL, //fn_selection_request
+ .fn_evas_changed = NULL,
+ .fn_focus_device_set = NULL,
+ .fn_callback_focus_device_in_set = NULL,
+ .fn_callback_focus_device_out_set = NULL,
+ .fn_callback_device_mouse_in_set = NULL,
+ .fn_callback_device_mouse_out_set = NULL,
+ .fn_pointer_device_xy_get = NULL,
+ .fn_prepare = NULL,
+ .fn_last_tick_get = NULL,
+ .fn_selection_claim = NULL,
+ .fn_selection_has_owner = NULL,
+ .fn_selection_request = NULL,
};
static Ecore_Evas*
@@ -471,23 +357,20 @@ _ecore_evas_internal_sdl_new(int rmethod, const char* name, int w, int h, int fu
Ecore_Evas *ee;
Eina_Bool gl = EINA_FALSE;
- if (ecore_evas_sdl_count > 0) return NULL;
if (!name)
- name = ecore_evas_sdl_default;
+ name = "(We shouldn't ever see this)";
if (!ecore_sdl_init(name)) return NULL;
- if (SDL_VideoInit(NULL) != 0)
+ if (!SDL_Init(SDL_INIT_VIDEO))
{
- ERR("SDL Video initialization failed !");
+ ERR("SDL Video initialization failed: %s", SDL_GetError());
return NULL;
}
ee = calloc(1, sizeof(Ecore_Evas) + sizeof (Ecore_Evas_SDL_Switch_Data));
if (!ee) return NULL;
-
swd = (Ecore_Evas_SDL_Switch_Data*)(ee + 1);
-
ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_sdl_engine_func;
@@ -515,119 +398,49 @@ _ecore_evas_internal_sdl_new(int rmethod, const char* name, int w, int h, int fu
ee->prop.window = 0;
ee->alpha = alpha;
ee->prop.hwsurface = hwsurface;
-
/* init evas here */
if (!ecore_evas_evas_new(ee, w, h))
{
ERR("Can not create Canvas.");
goto on_error;
}
-
+ gl = !(rmethod == evas_render_method_lookup("software_sdl"));
evas_output_method_set(ee->evas, rmethod);
-
- gl = !(rmethod == evas_render_method_lookup("buffer"));
ee->can_async_render = gl ? EINA_FALSE : EINA_TRUE;
- swd->w = SDL_CreateWindow(name,
- SDL_WINDOWPOS_UNDEFINED,
- SDL_WINDOWPOS_UNDEFINED,
- w, h,
- SDL_WINDOW_RESIZABLE | (gl ? SDL_WINDOW_OPENGL : 0));
+ swd->w = SDL_CreateWindow(name, w+500, h+500, SDL_WINDOW_RESIZABLE);
if (!swd->w)
{
- ERR("SDL_CreateWindow failed.");
+ ERR("SDL_CreateWindow failed: %s", SDL_GetError());
+ goto on_error;
+ }
+ // XXX error
+ SDL_Surface *surface = SDL_GetWindowSurface(swd->w);
+
+ Evas_Engine_Info_Software_SDL *einfo = (Evas_Engine_Info_Software_SDL *) evas_engine_info_get(ee->evas);
+ if (!einfo)
+ {
+ ERR("evas_engine_info_get failed.");
goto on_error;
}
- if (!gl)
+ einfo->info.format = surface->format;
+ if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *) einfo))
{
- Evas_Engine_Info_Buffer *einfo;
-
- einfo = (Evas_Engine_Info_Buffer *) evas_engine_info_get(ee->evas);
- if (einfo)
- {
- void *pixels;
- int pitch;
-
- swd->r = SDL_CreateRenderer(swd->w, -1, 0);
- if (!swd->r)
- {
- ERR("SDL_CreateRenderer failed.");
- goto on_error;
- }
-
- swd->pages[0] = SDL_CreateTexture(swd->r, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, w, h);
- swd->pages[1] = SDL_CreateTexture(swd->r, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, w, h);
-
- einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32;
- einfo->info.switch_data = swd;
-
- SDL_RenderClear(swd->r);
- if (SDL_LockTexture(swd->pages[0], NULL, &pixels, &pitch) < 0)
- {
- ERR("SDL_LockTexture failed.");
- goto on_error;
- }
-
- einfo->info.dest_buffer = pixels;
- einfo->info.dest_buffer_row_bytes = pitch;
- 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;
- einfo->info.func.switch_buffer = _ecore_evas_sdl_switch_buffer;
- if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *) einfo))
- {
- ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
- ecore_evas_free(ee);
- return NULL;
- }
- }
- else
- {
- ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
- ecore_evas_free(ee);
- return NULL;
- }
+ ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
+ ecore_evas_free(ee);
+ return NULL;
}
- else
- {
- /* FIXME */
-#ifdef BUILD_ECORE_EVAS_OPENGL_SDL
- Evas_Engine_Info_GL_SDL *einfo;
+ // XXX move to new function, split out from gl
- einfo = (Evas_Engine_Info_GL_SDL *) evas_engine_info_get(ee->evas);
- if (einfo)
- {
- einfo->flags.fullscreen = fullscreen;
- einfo->flags.noframe = noframe;
- einfo->window = swd->w;
- if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
- {
- ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
- ecore_evas_free(ee);
- return NULL;
- }
- }
- else
- {
- ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
- ecore_evas_free(ee);
- return NULL;
- }
-#endif
- }
-
- _ecore_evas_sdl_init(w, h);
+ _ecore_evas_sdl_init(ee, w, h);
ee->prop.window = SDL_GetWindowID(swd->w);
ecore_evas_done(ee, EINA_FALSE);
- SDL_SetWindowData(swd->w, "_Ecore_Evas", ee);
- SDL_ShowCursor(SDL_ENABLE);
+ SDL_SetPointerProperty(SDL_GetWindowProperties(swd->w), "_Ecore_Evas", ee);
_ecore_evas_focus_device_set(ee, NULL, EINA_TRUE);
- ecore_evas_sdl_count++;
return ee;
on_error:
@@ -642,7 +455,7 @@ ecore_evas_sdl_new_internal(const char* name, int w, int h, int fullscreen,
Ecore_Evas *ee;
int rmethod;
- rmethod = evas_render_method_lookup("buffer");
+ rmethod = evas_render_method_lookup("software_sdl");
if (!rmethod) return NULL;
ee = _ecore_evas_internal_sdl_new(rmethod, name, w, h, fullscreen, hwsurface, noframe, alpha);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.