forked from enlightenment/efl
Ecore_X(cb): Trim down memory usage. Add checks for damage extension
before trying to use it. Enable getting xcursor core & anim from xdefaults. SVN revision: 63491
This commit is contained in:
parent
3561137e9a
commit
d7a1fd1630
|
@ -20,7 +20,8 @@ static void _ecore_xcb_cursor_image_destroy(xcb_image_t *img);
|
|||
static int _ecore_xcb_cursor_size = 0;
|
||||
static Eina_Bool _ecore_xcb_cursor = EINA_FALSE;
|
||||
#ifdef ECORE_XCB_CURSOR
|
||||
static xcb_render_pictforminfo_t *_ecore_xcb_cursor_format = NULL;
|
||||
static uint32_t _ecore_xcb_cursor_format_id = 0;
|
||||
// static xcb_render_pictforminfo_t *_ecore_xcb_cursor_format = NULL;
|
||||
#endif
|
||||
|
||||
void
|
||||
|
@ -39,7 +40,8 @@ _ecore_xcb_cursor_finalize(void)
|
|||
_ecore_xcb_cursor = _ecore_xcb_render_argb_get();
|
||||
|
||||
/* find render pict format */
|
||||
_ecore_xcb_cursor_format = _ecore_xcb_cursor_format_get();
|
||||
if (_ecore_xcb_cursor_format_id <= 0)
|
||||
_ecore_xcb_cursor_format_id = _ecore_xcb_cursor_format_get()->id;
|
||||
#endif
|
||||
|
||||
/* try to grab cursor size from XDefaults */
|
||||
|
@ -360,7 +362,7 @@ _ecore_xcb_cursor_image_load_cursor(xcb_image_t *img, int hot_x, int hot_y)
|
|||
|
||||
pict = xcb_generate_id(_ecore_xcb_conn);
|
||||
xcb_render_create_picture(_ecore_xcb_conn, pict, pmap,
|
||||
_ecore_xcb_cursor_format->id, 0, NULL);
|
||||
_ecore_xcb_cursor_format_id, 0, NULL);
|
||||
xcb_free_pixmap(_ecore_xcb_conn, pmap);
|
||||
|
||||
cursor = xcb_generate_id(_ecore_xcb_conn);
|
||||
|
|
|
@ -83,6 +83,8 @@ ecore_x_damage_new(Ecore_X_Drawable drawable, Ecore_X_Damage_Report_Level level)
|
|||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!_damage_avail) return 0;
|
||||
|
||||
#ifdef ECORE_XCB_DAMAGE
|
||||
damage = xcb_generate_id(_ecore_xcb_conn);
|
||||
xcb_damage_create(_ecore_xcb_conn, damage, drawable, level);
|
||||
|
@ -106,6 +108,8 @@ ecore_x_damage_free(Ecore_X_Damage damage)
|
|||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!_damage_avail) return;
|
||||
|
||||
#ifdef ECORE_XCB_DAMAGE
|
||||
xcb_damage_destroy(_ecore_xcb_conn, damage);
|
||||
// ecore_x_flush();
|
||||
|
@ -135,6 +139,8 @@ ecore_x_damage_subtract(Ecore_X_Damage damage, Ecore_X_Region repair, Ecore_X_Re
|
|||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!_damage_avail) return;
|
||||
|
||||
#ifdef ECORE_XCB_DAMAGE
|
||||
xcb_damage_subtract(_ecore_xcb_conn, damage, repair, parts);
|
||||
// ecore_x_flush();
|
||||
|
|
|
@ -90,7 +90,6 @@ ecore_x_dnd_send_status(Eina_Bool will_accept, Eina_Bool suppress, Ecore_X_Recta
|
|||
|
||||
if (_target->state == ECORE_X_DND_TARGET_IDLE) return;
|
||||
|
||||
DBG("Ecore_X_Dnd_Send_Status");
|
||||
memset(&ev, 0, sizeof(xcb_client_message_event_t));
|
||||
|
||||
_target->will_accept = will_accept;
|
||||
|
@ -132,7 +131,6 @@ ecore_x_dnd_drop(void)
|
|||
|
||||
memset(&ev, 0, sizeof(xcb_client_message_event_t));
|
||||
|
||||
DBG("Ecore_X_Dnd_Drop");
|
||||
if (_source->dest)
|
||||
{
|
||||
ev.response_type = XCB_CLIENT_MESSAGE;
|
||||
|
@ -183,7 +181,6 @@ ecore_x_dnd_aware_set(Ecore_X_Window win, Eina_Bool on)
|
|||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
DBG("Ecore_X_Dnd_Aware_Set");
|
||||
if (on)
|
||||
ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_AWARE,
|
||||
ECORE_X_ATOM_ATOM, 32, &prop_data, 1);
|
||||
|
@ -290,7 +287,6 @@ ecore_x_dnd_type_set(Ecore_X_Window win, const char *type, Eina_Bool on)
|
|||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
DBG("Ecore_X_Dnd_Type_Set");
|
||||
atom = ecore_x_atom_get(type);
|
||||
ecore_x_window_prop_property_get(win, ECORE_X_ATOM_XDND_TYPE_LIST,
|
||||
ECORE_X_ATOM_ATOM, 32, &old_data, &num);
|
||||
|
@ -344,7 +340,6 @@ ecore_x_dnd_types_set(Ecore_X_Window win, const char **types, unsigned int num_t
|
|||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
DBG("Ecore_X_Dnd_Types_Set");
|
||||
if (!num_types)
|
||||
ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_TYPE_LIST);
|
||||
else
|
||||
|
@ -374,7 +369,6 @@ ecore_x_dnd_actions_set(Ecore_X_Window win, Ecore_X_Atom *actions, unsigned int
|
|||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
DBG("Ecore_X_Dnd_Actions_Set");
|
||||
if (!num_actions)
|
||||
ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_ACTION_LIST);
|
||||
else
|
||||
|
@ -417,7 +411,6 @@ ecore_x_dnd_begin(Ecore_X_Window source, unsigned char *data, int size)
|
|||
|
||||
if (!ecore_x_dnd_version_get(source)) return EINA_FALSE;
|
||||
|
||||
DBG("Ecore_X_Dnd_Begin");
|
||||
/* Take ownership of XdndSelection */
|
||||
if (!ecore_x_selection_xdnd_set(source, data, size)) return EINA_FALSE;
|
||||
|
||||
|
@ -454,7 +447,6 @@ ecore_x_dnd_send_finished(void)
|
|||
|
||||
if (_target->state == ECORE_X_DND_TARGET_IDLE) return;
|
||||
|
||||
DBG("Ecore_X_Dnd_Send_Finished");
|
||||
memset(&ev, 0, sizeof(xcb_client_message_event_t));
|
||||
|
||||
ev.response_type = XCB_CLIENT_MESSAGE;
|
||||
|
@ -511,7 +503,6 @@ _ecore_xcb_dnd_drag(Ecore_X_Window root, int x, int y)
|
|||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
DBG("Ecore_X_Dnd_Drag");
|
||||
memset(&ev, 0, sizeof(xcb_client_message_event_t));
|
||||
|
||||
ev.response_type = XCB_CLIENT_MESSAGE;
|
||||
|
|
|
@ -101,7 +101,7 @@ static Ecore_X_Mouse_Down_Info *_ecore_xcb_event_mouse_down_info_get(int dev);
|
|||
|
||||
/* local variables */
|
||||
static Eina_Bool _ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
static Ecore_Event *_ecore_xcb_event_last_mouse_move_event = NULL;
|
||||
//static Ecore_Event *_ecore_xcb_event_last_mouse_move_event = NULL;
|
||||
static Eina_Inlist *_ecore_xcb_mouse_down_info_list = NULL;
|
||||
static Ecore_X_Time _ecore_xcb_event_last_time;
|
||||
static Ecore_X_Window _ecore_xcb_event_last_window = 0;
|
||||
|
@ -225,11 +225,11 @@ _ecore_xcb_events_shutdown(void)
|
|||
_ecore_xcb_event_mouse_down_info_clear();
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
if (_ecore_xcb_event_last_mouse_move_event)
|
||||
{
|
||||
ecore_event_del(_ecore_xcb_event_last_mouse_move_event);
|
||||
_ecore_xcb_event_last_mouse_move_event = NULL;
|
||||
}
|
||||
// if (_ecore_xcb_event_last_mouse_move_event)
|
||||
// {
|
||||
// ecore_event_del(_ecore_xcb_event_last_mouse_move_event);
|
||||
// _ecore_xcb_event_last_mouse_move_event = NULL;
|
||||
// }
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -282,23 +282,23 @@ _ecore_xcb_events_handle(xcb_generic_event_t *ev)
|
|||
return;
|
||||
}
|
||||
#endif
|
||||
/* WRN("Got Event Error:"); */
|
||||
/* WRN("\tMajor Code: %d", err->major_code); */
|
||||
/* WRN("\tMinor Code: %d", err->minor_code); */
|
||||
/* WRN("\tRequest: %s", xcb_event_get_request_label(err->major_code)); */
|
||||
/* WRN("\tError: %s", xcb_event_get_error_label(err->error_code)); */
|
||||
/* if (err->error_code == XCB_EVENT_ERROR_BAD_VALUE) */
|
||||
/* WRN("\tValue: %d", ((xcb_value_error_t *)err)->bad_value); */
|
||||
/* else if (err->error_code == XCB_EVENT_ERROR_BAD_MATCH) */
|
||||
/* WRN("\tMatch: %d", ((xcb_match_error_t *)err)->bad_value); */
|
||||
WRN("Got Event Error:");
|
||||
WRN("\tMajor Code: %d", err->major_code);
|
||||
WRN("\tMinor Code: %d", err->minor_code);
|
||||
WRN("\tRequest: %s", xcb_event_get_request_label(err->major_code));
|
||||
WRN("\tError: %s", xcb_event_get_error_label(err->error_code));
|
||||
if (err->error_code == XCB_EVENT_ERROR_BAD_VALUE)
|
||||
WRN("\tValue: %d", ((xcb_value_error_t *)err)->bad_value);
|
||||
else if (err->error_code == XCB_EVENT_ERROR_BAD_MATCH)
|
||||
WRN("\tMatch: %d", ((xcb_match_error_t *)err)->bad_value);
|
||||
|
||||
/* if (err->major_code == XCB_SEND_EVENT) */
|
||||
/* { */
|
||||
/* WRN("\tSend Event Error"); */
|
||||
/* WRN("\t\tSeq: %d", ev->sequence); */
|
||||
/* WRN("\t\tFull Seq: %d", ev->full_sequence); */
|
||||
/* WRN("\t\tType: %d", ev->response_type); */
|
||||
/* } */
|
||||
if (err->major_code == XCB_SEND_EVENT)
|
||||
{
|
||||
WRN("\tSend Event Error");
|
||||
WRN("\t\tSeq: %d", ev->sequence);
|
||||
WRN("\t\tFull Seq: %d", ev->full_sequence);
|
||||
WRN("\t\tType: %d", ev->response_type);
|
||||
}
|
||||
/* if (err->major_code == 148) */
|
||||
/* { */
|
||||
/* printf("GOT 148 Error\n"); */
|
||||
|
@ -2235,7 +2235,7 @@ _ecore_xcb_event_mouse_move(uint16_t timestamp, uint16_t modifiers, int16_t x, i
|
|||
_ecore_xcb_event_last_window = e->window;
|
||||
_ecore_xcb_event_last_root_x = root_x;
|
||||
_ecore_xcb_event_last_root_y = root_y;
|
||||
_ecore_xcb_event_last_mouse_move_event = event;
|
||||
// _ecore_xcb_event_last_mouse_move_event = event;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2244,11 +2244,11 @@ _ecore_xcb_event_mouse_move_free(void *data __UNUSED__, void *event)
|
|||
Ecore_Event_Mouse_Move *ev;
|
||||
|
||||
ev = event;
|
||||
if (_ecore_xcb_event_last_mouse_move_event)
|
||||
{
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
_ecore_xcb_event_last_mouse_move_event = NULL;
|
||||
}
|
||||
// if (_ecore_xcb_event_last_mouse_move_event)
|
||||
// {
|
||||
// _ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
// _ecore_xcb_event_last_mouse_move_event = NULL;
|
||||
// }
|
||||
if (ev) free(ev);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
#include "ecore_xcb_private.h"
|
||||
|
||||
/* local function prototypes */
|
||||
static void _ecore_xcb_netwm_startup_info_free(void *data);
|
||||
/* static void _ecore_xcb_netwm_startup_info_free(void *data); */
|
||||
static Ecore_X_Atom _ecore_xcb_netwm_window_type_atom_get(Ecore_X_Window_Type type);
|
||||
static Ecore_X_Window_Type _ecore_xcb_netwm_window_type_type_get(Ecore_X_Atom atom);
|
||||
static Ecore_X_Atom _ecore_xcb_netwm_window_state_atom_get(Ecore_X_Window_State state);
|
||||
static Ecore_X_Atom _ecore_xcb_netwm_action_atom_get(Ecore_X_Action action);
|
||||
|
||||
/* local variables */
|
||||
static Eina_Hash *_startup_info = NULL;
|
||||
//static Eina_Hash *_startup_info = NULL;
|
||||
|
||||
/* local structures */
|
||||
typedef struct _Ecore_Xcb_Startup_Info Ecore_Xcb_Startup_Info;
|
||||
|
@ -33,8 +33,8 @@ ecore_x_netwm_init(void)
|
|||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_startup_info =
|
||||
eina_hash_string_superfast_new(_ecore_xcb_netwm_startup_info_free);
|
||||
// _startup_info =
|
||||
// eina_hash_string_superfast_new(_ecore_xcb_netwm_startup_info_free);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
@ -42,8 +42,8 @@ ecore_x_netwm_shutdown(void)
|
|||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (_startup_info) eina_hash_free(_startup_info);
|
||||
_startup_info = NULL;
|
||||
// if (_startup_info) eina_hash_free(_startup_info);
|
||||
// _startup_info = NULL;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
|
@ -1146,23 +1146,23 @@ _ecore_xcb_netwm_startup_info(Ecore_X_Window win __UNUSED__, uint8_t data __UNUS
|
|||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_xcb_netwm_startup_info_free(void *data)
|
||||
{
|
||||
Ecore_Xcb_Startup_Info *info;
|
||||
/* static void */
|
||||
/* _ecore_xcb_netwm_startup_info_free(void *data) */
|
||||
/* { */
|
||||
/* Ecore_Xcb_Startup_Info *info; */
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
/* LOGFN(__FILE__, __LINE__, __FUNCTION__); */
|
||||
|
||||
if (!(info = data)) return;
|
||||
if (info->buffer) free(info->buffer);
|
||||
if (info->id) free(info->id);
|
||||
if (info->name) free(info->name);
|
||||
if (info->bin) free(info->bin);
|
||||
if (info->icon) free(info->icon);
|
||||
if (info->description) free(info->description);
|
||||
if (info->wmclass) free(info->wmclass);
|
||||
free(info);
|
||||
}
|
||||
/* if (!(info = data)) return; */
|
||||
/* if (info->buffer) free(info->buffer); */
|
||||
/* if (info->id) free(info->id); */
|
||||
/* if (info->name) free(info->name); */
|
||||
/* if (info->bin) free(info->bin); */
|
||||
/* if (info->icon) free(info->icon); */
|
||||
/* if (info->description) free(info->description); */
|
||||
/* if (info->wmclass) free(info->wmclass); */
|
||||
/* free(info); */
|
||||
/* } */
|
||||
|
||||
static Ecore_X_Atom
|
||||
_ecore_xcb_netwm_window_type_atom_get(Ecore_X_Window_Type type)
|
||||
|
|
|
@ -52,12 +52,13 @@ _ecore_xcb_render_finalize(void)
|
|||
char *v = NULL;
|
||||
|
||||
_render_avail = EINA_TRUE;
|
||||
_ecore_xcb_xdefaults_init();
|
||||
if ((reply->major_version > 0) || (reply->minor_version >= 5))
|
||||
{
|
||||
_render_argb = EINA_TRUE;
|
||||
v = getenv("XCURSOR_CORE");
|
||||
/* if (!v) */
|
||||
/* v = _ecore_xcb_resource_get_string("Xcursor", "core"); */
|
||||
if (!v)
|
||||
v = _ecore_xcb_xdefaults_string_get("Xcursor", "core");
|
||||
if ((v) && (_ecore_xcb_render_parse_boolean(v)))
|
||||
_render_argb = EINA_FALSE;
|
||||
}
|
||||
|
@ -66,11 +67,12 @@ _ecore_xcb_render_finalize(void)
|
|||
{
|
||||
_render_anim = EINA_TRUE;
|
||||
v = getenv("XCURSOR_ANIM");
|
||||
/* if (!v) */
|
||||
/* v = _ecore_xcb_resource_get_string("Xcursor", "anim"); */
|
||||
if (!v)
|
||||
v = _ecore_xcb_xdefaults_string_get("Xcursor", "anim");
|
||||
if ((v) && (_ecore_xcb_render_parse_boolean(v)))
|
||||
_render_anim = EINA_FALSE;
|
||||
}
|
||||
_ecore_xcb_xdefaults_shutdown();
|
||||
}
|
||||
}
|
||||
free(reply);
|
||||
|
|
|
@ -1270,7 +1270,6 @@ EAPI Ecore_X_Window *
|
|||
ecore_x_window_root_list(int *num_ret)
|
||||
{
|
||||
xcb_screen_iterator_t iter;
|
||||
const xcb_setup_t *setup;
|
||||
uint8_t i, num;
|
||||
Ecore_X_Window *roots = NULL;
|
||||
#ifdef ECORE_XCB_XPRINT
|
||||
|
@ -1280,10 +1279,15 @@ ecore_x_window_root_list(int *num_ret)
|
|||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!num_ret) return NULL;
|
||||
*num_ret = 0;
|
||||
if (num_ret) *num_ret = 0;
|
||||
|
||||
setup = xcb_get_setup(_ecore_xcb_conn);
|
||||
num = setup->roots_len;
|
||||
/* if (xcb_connection_has_error(_ecore_xcb_conn)) */
|
||||
/* { */
|
||||
/* DBG("XCB Connection Has Error !!!"); */
|
||||
/* return NULL; */
|
||||
/* } */
|
||||
|
||||
num = ecore_x_screen_count_get();
|
||||
|
||||
#ifdef ECORE_XCB_XPRINT
|
||||
ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_x_print_id);
|
||||
|
@ -1306,10 +1310,12 @@ ecore_x_window_root_list(int *num_ret)
|
|||
{
|
||||
for (j = 0; j < psnum; j++)
|
||||
{
|
||||
if ((_ecore_xcb_window_screen_of_display(i))->root ==
|
||||
screens[j])
|
||||
xcb_screen_t *s;
|
||||
|
||||
if ((s = _ecore_xcb_window_screen_of_display(i)))
|
||||
{
|
||||
overlap++;
|
||||
if (s->root == screens[j])
|
||||
overlap++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1321,34 +1327,38 @@ ecore_x_window_root_list(int *num_ret)
|
|||
|
||||
for (j = 0; j < psnum; j++)
|
||||
{
|
||||
if ((_ecore_xcb_window_screen_of_display(i))->root ==
|
||||
screens[j])
|
||||
xcb_screen_t *s;
|
||||
|
||||
if ((s = _ecore_xcb_window_screen_of_display(i)))
|
||||
{
|
||||
is_print = EINA_TRUE;
|
||||
break;
|
||||
if (s->root == screens[j])
|
||||
{
|
||||
is_print = EINA_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!is_print)
|
||||
{
|
||||
xcb_screen_t *s;
|
||||
|
||||
s = _ecore_xcb_window_screen_of_display(i);
|
||||
if (s)
|
||||
if ((s = _ecore_xcb_window_screen_of_display(i)))
|
||||
{
|
||||
roots[k] = s->root;
|
||||
k++;
|
||||
}
|
||||
}
|
||||
}
|
||||
*num_ret = k;
|
||||
if (num_ret) *num_ret = k;
|
||||
free(reply);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Fallback to default method */
|
||||
iter = xcb_setup_roots_iterator(setup);
|
||||
iter =
|
||||
xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn));
|
||||
if (!(roots = malloc(num * sizeof(Ecore_X_Window)))) return NULL;
|
||||
*num_ret = num;
|
||||
if (num_ret) *num_ret = num;
|
||||
for (i = 0; iter.rem; xcb_screen_next(&iter), i++)
|
||||
roots[i] = iter.data->root;
|
||||
}
|
||||
|
@ -1356,16 +1366,18 @@ ecore_x_window_root_list(int *num_ret)
|
|||
else
|
||||
{
|
||||
/* Fallback to default method */
|
||||
iter = xcb_setup_roots_iterator(setup);
|
||||
iter =
|
||||
xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn));
|
||||
if (!(roots = malloc(num * sizeof(Ecore_X_Window)))) return NULL;
|
||||
*num_ret = num;
|
||||
if (num_ret) *num_ret = num;
|
||||
for (i = 0; iter.rem; xcb_screen_next(&iter), i++)
|
||||
roots[i] = iter.data->root;
|
||||
}
|
||||
#else
|
||||
iter = xcb_setup_roots_iterator(setup);
|
||||
iter =
|
||||
xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn));
|
||||
if (!(roots = malloc(num * sizeof(Ecore_X_Window)))) return NULL;
|
||||
*num_ret = num;
|
||||
if (num_ret) *num_ret = num;
|
||||
for (i = 0; iter.rem; xcb_screen_next(&iter), i++)
|
||||
roots[i] = iter.data->root;
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue